fix: improve codex tool call live updates

This commit is contained in:
shiyue
2026-03-30 10:23:51 +08:00
parent 34e42b3254
commit 2e2dc21047
3 changed files with 228 additions and 30 deletions

View File

@@ -334,6 +334,26 @@ function createAgentRuntime(deps) {
break;
}
case 'item.updated': {
const item = event.item;
if (!item || !item.id || item.type === 'agent_message') break;
const tc = ensureCodexToolCall(entry, item);
const resultText = codexToolResult(item).slice(0, 2000);
tc.done = false;
tc.result = resultText;
wsSend(entry.ws, {
type: 'tool_update',
toolUseId: item.id,
name: tc.name,
input: tc.input,
result: resultText,
kind: tc.kind,
meta: tc.meta,
});
break;
}
case 'item.completed': {
const item = event.item;
if (!item || !item.id) break;
@@ -361,6 +381,7 @@ function createAgentRuntime(deps) {
const resultText = codexToolResult(item).slice(0, 2000);
tc.done = true;
tc.result = resultText;
wsSend(entry.ws, {
type: 'tool_end',
toolUseId: item.id,