Update ccweb codex app integration
This commit is contained in:
@@ -105,6 +105,57 @@ function threadPayload(thread) {
|
||||
};
|
||||
}
|
||||
|
||||
function emitChildCollabTurn(threadId, turnId, finalMessage) {
|
||||
const childThread = ensureThread(threadId);
|
||||
childThread.activeTurnId = turnId;
|
||||
send({
|
||||
method: 'turn/started',
|
||||
params: {
|
||||
threadId,
|
||||
turn: {
|
||||
id: turnId,
|
||||
status: 'running',
|
||||
items: [],
|
||||
},
|
||||
},
|
||||
});
|
||||
send({
|
||||
method: 'item/agentMessage/delta',
|
||||
params: {
|
||||
threadId,
|
||||
turnId,
|
||||
itemId: 'agent-msg',
|
||||
delta: finalMessage,
|
||||
},
|
||||
});
|
||||
send({
|
||||
method: 'item/completed',
|
||||
params: {
|
||||
threadId,
|
||||
turnId,
|
||||
completedAtMs: Date.now(),
|
||||
item: {
|
||||
id: 'agent-msg',
|
||||
type: 'agentMessage',
|
||||
content: [{ type: 'text', text: finalMessage }],
|
||||
status: 'completed',
|
||||
},
|
||||
},
|
||||
});
|
||||
send({
|
||||
method: 'turn/completed',
|
||||
params: {
|
||||
threadId,
|
||||
turn: {
|
||||
id: turnId,
|
||||
status: 'completed',
|
||||
items: [],
|
||||
},
|
||||
},
|
||||
});
|
||||
childThread.activeTurnId = null;
|
||||
}
|
||||
|
||||
function completeTurn(thread, turnId, text, status = 'completed') {
|
||||
if (thread.activeTurnId !== turnId) return;
|
||||
const suffix = thread.steers.length > 0 ? ` | steer: ${thread.steers.join(' | ')}` : '';
|
||||
@@ -205,7 +256,7 @@ function completeTurn(thread, turnId, text, status = 'completed') {
|
||||
});
|
||||
}
|
||||
|
||||
if (/subagent|collab/i.test(text)) {
|
||||
if (/subagent/i.test(text)) {
|
||||
send({
|
||||
method: 'item/started',
|
||||
params: {
|
||||
@@ -266,6 +317,16 @@ function completeTurn(thread, turnId, text, status = 'completed') {
|
||||
},
|
||||
},
|
||||
});
|
||||
emitChildCollabTurn(
|
||||
'child-thread-a',
|
||||
'child-turn-a',
|
||||
'子代理最终消息:结构化渲染和关闭按钮链路已完成。'
|
||||
);
|
||||
emitChildCollabTurn(
|
||||
'child-thread-b',
|
||||
'child-turn-b',
|
||||
'子代理最终消息:事件路由、持久化和状态推送检查通过。'
|
||||
);
|
||||
}
|
||||
|
||||
send({
|
||||
|
||||
Reference in New Issue
Block a user