feat: map codex thread collaboration progress
This commit is contained in:
@@ -599,6 +599,23 @@ function extractArtifactsFromItem(item, existingCount) {
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function extractThreadCollaborationSnapshot(item) {
|
||||
if (!item || typeof item !== "object" || item.type !== "collabToolCall") {
|
||||
return null;
|
||||
}
|
||||
const tool = safeProgressText(item.tool, 80);
|
||||
const status = safeProgressText(item.status, 40) || "running";
|
||||
const agentStatus = safeProgressText(item.agentStatus, 80);
|
||||
const target = item.receiverThreadId ? "已有线程" : item.newThreadId ? "新线程" : "";
|
||||
const snapshot = {
|
||||
tool: tool || undefined,
|
||||
status,
|
||||
target: target || undefined,
|
||||
agentStatus: agentStatus || undefined,
|
||||
};
|
||||
return Object.values(snapshot).some((value) => value !== undefined && value !== "") ? snapshot : null;
|
||||
}
|
||||
|
||||
function extractSubAgentSource(value) {
|
||||
if (!value || typeof value !== "object") {
|
||||
return undefined;
|
||||
@@ -1148,6 +1165,7 @@ function createProgressCollector() {
|
||||
let threadGoal;
|
||||
let threadSettings;
|
||||
let compaction;
|
||||
let threadCollaboration;
|
||||
let accountStatus;
|
||||
let modelVerification;
|
||||
|
||||
@@ -1271,9 +1289,20 @@ function createProgressCollector() {
|
||||
return;
|
||||
}
|
||||
if (message.method === "item/completed" || message.method === "item/started") {
|
||||
const item = message.params?.item;
|
||||
for (const artifact of extractArtifactsFromItem(message.params?.item, artifacts.length)) {
|
||||
upsertArtifact(artifact);
|
||||
}
|
||||
const nextCollaboration = extractThreadCollaborationSnapshot(item);
|
||||
if (nextCollaboration) {
|
||||
threadCollaboration = nextCollaboration;
|
||||
}
|
||||
if (item?.type === "contextCompaction") {
|
||||
compaction = {
|
||||
status: "completed",
|
||||
message: "上下文已压缩",
|
||||
};
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (
|
||||
@@ -1568,6 +1597,9 @@ function createProgressCollector() {
|
||||
if (compaction) {
|
||||
result.compaction = { ...compaction };
|
||||
}
|
||||
if (threadCollaboration) {
|
||||
result.threadCollaboration = { ...threadCollaboration };
|
||||
}
|
||||
if (accountStatus) {
|
||||
result.accountStatus = { ...accountStatus };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user