fix: persist codexapp streaming state

This commit is contained in:
shiyue
2026-06-15 18:17:41 +08:00
parent fbfbcf1ce4
commit 0f4a1c27fe
6 changed files with 375 additions and 10 deletions

View File

@@ -468,7 +468,41 @@ function startTurn(params) {
return { turn: { id: turnId, status: 'running', items: [] } };
}
const delay = /slow/i.test(text) ? 900 : 80;
const delay = /recover/i.test(text) ? 5000 : /slow/i.test(text) ? 900 : 80;
if (/recover/i.test(text)) {
send({
method: 'item/agentMessage/delta',
params: {
threadId: thread.id,
turnId,
itemId: 'agent-msg',
delta: `partial before restart: ${text}`,
},
});
send({
method: 'item/started',
params: {
threadId: thread.id,
turnId,
startedAtMs: Date.now(),
item: {
id: 'recover-tool',
type: 'commandExecution',
command: '/bin/bash -lc echo recover',
status: 'inProgress',
},
},
});
send({
method: 'item/commandExecution/outputDelta',
params: {
threadId: thread.id,
turnId,
itemId: 'recover-tool',
delta: 'recover tool output\n',
},
});
}
thread.timer = setTimeout(() => completeTurn(thread, turnId, text), delay);
return { turn: { id: turnId, status: 'running', items: [] } };
}