Add incoming message visibility and shell command execution to Aider runner
- Emit 'input' events so agents show received prompts in their console - Execute detected shell commands (btmsg, bttask, etc.) from LLM output - Feed command results back to aider for iterative autonomous work - Detect commands in code blocks, bare btmsg/bttask lines, and $ prefixes - More robust THINKING/ANSWER marker detection (multiple unicode variants) - Adapter handles new 'input' and 'tool_result' event types Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1a123f6835
commit
55ba8d0969
2 changed files with 141 additions and 9 deletions
|
|
@ -7,6 +7,7 @@ import type {
|
|||
TextContent,
|
||||
ThinkingContent,
|
||||
ToolCallContent,
|
||||
ToolResultContent,
|
||||
CostContent,
|
||||
ErrorContent,
|
||||
} from './claude-messages';
|
||||
|
|
@ -20,7 +21,9 @@ import { str, num } from '../utils/type-guards';
|
|||
* - {type:'system', subtype:'init', model, session_id, cwd}
|
||||
* - {type:'assistant', message:{role:'assistant', content:'...'}} — batched text block
|
||||
* - {type:'thinking', content:'...'} — thinking/reasoning block
|
||||
* - {type:'input', prompt:'...'} — incoming prompt/message (shown in console)
|
||||
* - {type:'tool_use', id, name, input} — shell command execution
|
||||
* - {type:'tool_result', tool_use_id, content} — shell command output
|
||||
* - {type:'result', subtype:'result', cost_usd, duration_ms, is_error}
|
||||
* - {type:'error', message:'...'}
|
||||
*/
|
||||
|
|
@ -50,6 +53,14 @@ export function adaptAiderMessage(raw: Record<string, unknown>): AgentMessage[]
|
|||
timestamp,
|
||||
}];
|
||||
|
||||
case 'input':
|
||||
return [{
|
||||
id: uuid,
|
||||
type: 'text',
|
||||
content: { text: `📨 **Received:**\n${str(raw.prompt)}` } satisfies TextContent,
|
||||
timestamp,
|
||||
}];
|
||||
|
||||
case 'thinking':
|
||||
return [{
|
||||
id: uuid,
|
||||
|
|
@ -84,6 +95,17 @@ export function adaptAiderMessage(raw: Record<string, unknown>): AgentMessage[]
|
|||
timestamp,
|
||||
}];
|
||||
|
||||
case 'tool_result':
|
||||
return [{
|
||||
id: uuid,
|
||||
type: 'tool_result',
|
||||
content: {
|
||||
toolUseId: str(raw.tool_use_id),
|
||||
output: raw.content,
|
||||
} satisfies ToolResultContent,
|
||||
timestamp,
|
||||
}];
|
||||
|
||||
case 'result':
|
||||
return [{
|
||||
id: uuid,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue