feat: surface codex app-server approval progress
This commit is contained in:
@@ -116,6 +116,28 @@ export interface ExecutionProgressAgent {
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export interface ExecutionProgressApproval {
|
||||
id?: string;
|
||||
kind?: string;
|
||||
label: string;
|
||||
status?: string;
|
||||
riskLevel?: string;
|
||||
detail?: string;
|
||||
}
|
||||
|
||||
export interface ExecutionProgressWarning {
|
||||
id?: string;
|
||||
message: string;
|
||||
severity?: string;
|
||||
}
|
||||
|
||||
export interface ExecutionProgressFileChange {
|
||||
id?: string;
|
||||
path: string;
|
||||
kind?: string;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export interface ExecutionProgressSnapshot {
|
||||
taskId: string;
|
||||
projectId: string;
|
||||
@@ -131,6 +153,9 @@ export interface ExecutionProgressSnapshot {
|
||||
branch?: ExecutionProgressBranchDetails;
|
||||
artifacts?: ExecutionProgressArtifact[];
|
||||
agents?: ExecutionProgressAgent[];
|
||||
approvals?: ExecutionProgressApproval[];
|
||||
warnings?: ExecutionProgressWarning[];
|
||||
fileChanges?: ExecutionProgressFileChange[];
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
@@ -139,6 +164,9 @@ export interface ExecutionProgressInput {
|
||||
branch?: Partial<ExecutionProgressBranchDetails>;
|
||||
artifacts?: Array<Partial<ExecutionProgressArtifact> & { label?: string }>;
|
||||
agents?: Array<Partial<ExecutionProgressAgent> & { name?: string }>;
|
||||
approvals?: Array<Partial<ExecutionProgressApproval> & { label?: string }>;
|
||||
warnings?: Array<Partial<ExecutionProgressWarning> & { message?: string }>;
|
||||
fileChanges?: Array<Partial<ExecutionProgressFileChange> & { path?: string }>;
|
||||
}
|
||||
|
||||
export interface ForwardSource {
|
||||
@@ -3805,6 +3833,9 @@ function normalizeExecutionProgressSnapshot(raw: Partial<ExecutionProgressSnapsh
|
||||
branch: nativeRemoteControl ? undefined : normalizeExecutionProgressBranch(raw.branch),
|
||||
artifacts: normalizeExecutionProgressArtifacts(raw.artifacts),
|
||||
agents: nativeRemoteControl ? undefined : normalizeExecutionProgressAgents(raw.agents),
|
||||
approvals: nativeRemoteControl ? undefined : normalizeExecutionProgressApprovals(raw.approvals),
|
||||
warnings: nativeRemoteControl ? undefined : normalizeExecutionProgressWarnings(raw.warnings),
|
||||
fileChanges: nativeRemoteControl ? undefined : normalizeExecutionProgressFileChanges(raw.fileChanges),
|
||||
updatedAt: raw.updatedAt ?? nowIso(),
|
||||
};
|
||||
}
|
||||
@@ -5276,6 +5307,61 @@ function normalizeExecutionProgressAgents(input?: ExecutionProgressInput["agents
|
||||
.slice(0, 8);
|
||||
}
|
||||
|
||||
function normalizeExecutionProgressApprovals(input?: ExecutionProgressInput["approvals"]) {
|
||||
return (input ?? [])
|
||||
.map((approval, index): ExecutionProgressApproval | null => {
|
||||
const label = safeExecutionProgressText(approval?.label);
|
||||
if (!label) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
id: safeExecutionProgressText(approval?.id) || `approval-${index + 1}`,
|
||||
kind: safeExecutionProgressText(approval?.kind) || undefined,
|
||||
label,
|
||||
status: safeExecutionProgressText(approval?.status) || undefined,
|
||||
riskLevel: safeExecutionProgressText(approval?.riskLevel) || undefined,
|
||||
detail: safeExecutionProgressText(approval?.detail) || undefined,
|
||||
};
|
||||
})
|
||||
.filter((approval): approval is ExecutionProgressApproval => Boolean(approval))
|
||||
.slice(0, 8);
|
||||
}
|
||||
|
||||
function normalizeExecutionProgressWarnings(input?: ExecutionProgressInput["warnings"]) {
|
||||
return (input ?? [])
|
||||
.map((warning, index): ExecutionProgressWarning | null => {
|
||||
const message = safeExecutionProgressText(warning?.message);
|
||||
if (!message) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
id: safeExecutionProgressText(warning?.id) || `warning-${index + 1}`,
|
||||
message,
|
||||
severity: safeExecutionProgressText(warning?.severity) || "warning",
|
||||
};
|
||||
})
|
||||
.filter((warning): warning is ExecutionProgressWarning => Boolean(warning))
|
||||
.slice(0, 6);
|
||||
}
|
||||
|
||||
function normalizeExecutionProgressFileChanges(input?: ExecutionProgressInput["fileChanges"]) {
|
||||
return (input ?? [])
|
||||
.map((fileChange, index): ExecutionProgressFileChange | null => {
|
||||
const path = safeExecutionProgressText(fileChange?.path);
|
||||
if (!path) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
id: safeExecutionProgressText(fileChange?.id) || `file-change-${index + 1}`,
|
||||
path,
|
||||
kind: safeExecutionProgressText(fileChange?.kind) || undefined,
|
||||
status: safeExecutionProgressText(fileChange?.status) || undefined,
|
||||
};
|
||||
})
|
||||
.filter((fileChange): fileChange is ExecutionProgressFileChange => Boolean(fileChange))
|
||||
.slice(0, 12);
|
||||
}
|
||||
|
||||
function defaultExecutionProgressStepTexts(task: Pick<MasterAgentTask, "taskType" | "relayViaMasterAgent">) {
|
||||
if (task.taskType === "browser_control") {
|
||||
return [
|
||||
@@ -5408,6 +5494,9 @@ function buildExecutionProgressSnapshot(
|
||||
branch: nativeRemoteControl ? undefined : normalizeExecutionProgressBranch(input?.branch),
|
||||
artifacts: normalizeExecutionProgressArtifacts(input?.artifacts),
|
||||
agents: nativeRemoteControl ? undefined : normalizeExecutionProgressAgents(input?.agents),
|
||||
approvals: nativeRemoteControl ? undefined : normalizeExecutionProgressApprovals(input?.approvals),
|
||||
warnings: nativeRemoteControl ? undefined : normalizeExecutionProgressWarnings(input?.warnings),
|
||||
fileChanges: nativeRemoteControl ? undefined : normalizeExecutionProgressFileChanges(input?.fileChanges),
|
||||
updatedAt: nowIso(),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user