feat: surface codex tool activity progress
This commit is contained in:
@@ -239,6 +239,13 @@ export interface ExecutionProgressThreadCollaboration {
|
||||
agentStatus?: string;
|
||||
}
|
||||
|
||||
export interface ExecutionProgressToolActivity {
|
||||
kind: string;
|
||||
name: string;
|
||||
status: string;
|
||||
detail?: string;
|
||||
}
|
||||
|
||||
export interface ExecutionProgressSnapshot {
|
||||
taskId: string;
|
||||
projectId: string;
|
||||
@@ -269,6 +276,7 @@ export interface ExecutionProgressSnapshot {
|
||||
threadSettings?: ExecutionProgressThreadSettings;
|
||||
compaction?: ExecutionProgressCompaction;
|
||||
threadCollaboration?: ExecutionProgressThreadCollaboration;
|
||||
toolActivities?: ExecutionProgressToolActivity[];
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
@@ -297,6 +305,17 @@ export interface ExecutionProgressInput {
|
||||
newThreadId?: unknown;
|
||||
prompt?: unknown;
|
||||
};
|
||||
toolActivities?: Array<
|
||||
Partial<ExecutionProgressToolActivity> & {
|
||||
arguments?: unknown;
|
||||
result?: unknown;
|
||||
contentItems?: unknown;
|
||||
url?: unknown;
|
||||
path?: unknown;
|
||||
command?: unknown;
|
||||
cwd?: unknown;
|
||||
}
|
||||
>;
|
||||
}
|
||||
|
||||
export interface ForwardSource {
|
||||
@@ -3984,6 +4003,7 @@ function normalizeExecutionProgressSnapshot(raw: Partial<ExecutionProgressSnapsh
|
||||
threadCollaboration: nativeRemoteControl
|
||||
? undefined
|
||||
: normalizeExecutionProgressThreadCollaboration(raw.threadCollaboration),
|
||||
toolActivities: nativeRemoteControl ? undefined : normalizeExecutionProgressToolActivities(raw.toolActivities),
|
||||
updatedAt: raw.updatedAt ?? nowIso(),
|
||||
};
|
||||
}
|
||||
@@ -5378,7 +5398,11 @@ function safeExecutionProgressText(value: unknown, fallback = "") {
|
||||
if (!text) {
|
||||
return fallback;
|
||||
}
|
||||
return sanitizeSensitiveUserVisibleText(text)?.trim() || fallback;
|
||||
const sanitized = sanitizeSensitiveUserVisibleText(text)
|
||||
?.replace(/sk-[A-Za-z0-9_-]{8,}/g, "[redacted]")
|
||||
.replace(/(api[_-]?key|token|secret|password)\s*[=:]\s*[^ \n\r\t]+/gi, "$1=[redacted]")
|
||||
.trim();
|
||||
return sanitized || fallback;
|
||||
}
|
||||
|
||||
function normalizeExecutionProgressStatus(status: unknown): ExecutionProgressStatus {
|
||||
@@ -5757,6 +5781,28 @@ function normalizeExecutionProgressThreadCollaboration(
|
||||
: undefined;
|
||||
}
|
||||
|
||||
function normalizeExecutionProgressToolActivities(
|
||||
input?: ExecutionProgressInput["toolActivities"],
|
||||
): ExecutionProgressToolActivity[] | undefined {
|
||||
const activities = (input ?? [])
|
||||
.map((item): ExecutionProgressToolActivity | null => {
|
||||
const kind = safeExecutionProgressText(item.kind);
|
||||
const name = safeExecutionProgressText(item.name);
|
||||
if (!kind || !name) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
kind,
|
||||
name,
|
||||
status: safeExecutionProgressText(item.status) || "running",
|
||||
detail: safeExecutionProgressText(item.detail) || undefined,
|
||||
};
|
||||
})
|
||||
.filter((item): item is ExecutionProgressToolActivity => Boolean(item))
|
||||
.slice(0, 8);
|
||||
return activities.length > 0 ? activities : undefined;
|
||||
}
|
||||
|
||||
function defaultExecutionProgressStepTexts(task: Pick<MasterAgentTask, "taskType" | "relayViaMasterAgent">) {
|
||||
if (task.taskType === "browser_control") {
|
||||
return [
|
||||
@@ -5908,6 +5954,7 @@ function buildExecutionProgressSnapshot(
|
||||
threadCollaboration: nativeRemoteControl
|
||||
? undefined
|
||||
: normalizeExecutionProgressThreadCollaboration(input?.threadCollaboration),
|
||||
toolActivities: nativeRemoteControl ? undefined : normalizeExecutionProgressToolActivities(input?.toolActivities),
|
||||
updatedAt: nowIso(),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user