feat: surface codex hook lifecycle progress
This commit is contained in:
@@ -709,6 +709,37 @@ function extractToolActivitySnapshot(item, lifecycleStatus = "running") {
|
||||
return null;
|
||||
}
|
||||
|
||||
function extractHookActivitySnapshot(params, lifecycleStatus = "running") {
|
||||
const run = params?.run && typeof params.run === "object" ? params.run : null;
|
||||
if (!run) {
|
||||
return null;
|
||||
}
|
||||
const eventName = safeProgressText(run.eventName, 80);
|
||||
const handlerType = safeProgressText(run.handlerType, 80);
|
||||
if (!eventName && !handlerType) {
|
||||
return null;
|
||||
}
|
||||
const detailParts = [];
|
||||
const source = safeProgressText(run.source, 80);
|
||||
const executionMode = safeProgressText(run.executionMode, 40);
|
||||
const durationMs = extractNumber(run.durationMs);
|
||||
if (source) {
|
||||
detailParts.push(source);
|
||||
}
|
||||
if (executionMode) {
|
||||
detailParts.push(executionMode);
|
||||
}
|
||||
if (durationMs !== undefined) {
|
||||
detailParts.push(`${durationMs}ms`);
|
||||
}
|
||||
return {
|
||||
kind: "hook",
|
||||
name: eventName && handlerType ? `${eventName}/${handlerType}` : eventName || handlerType,
|
||||
status: safeProgressText(run.status, 40) || lifecycleStatus,
|
||||
detail: detailParts.join(" · ") || undefined,
|
||||
};
|
||||
}
|
||||
|
||||
function cleanPlanStepText(text) {
|
||||
return safeProgressText(text, 220)
|
||||
.replace(/^\s*(?:[-*•]|\d+[.)]|[☐✓✔]|\[[ xX✓]\])\s*/u, "")
|
||||
@@ -1718,6 +1749,15 @@ function createProgressCollector() {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (message.method === "hook/started" || message.method === "hook/completed") {
|
||||
upsertToolActivity(
|
||||
extractHookActivitySnapshot(
|
||||
message.params,
|
||||
message.method === "hook/completed" ? "completed" : "running",
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (message.method === "thread/started") {
|
||||
upsertAgent(extractAgentFromThreadStarted(message.params));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user