返回 DeepSeek-Reasonix
subagentOutcome.ts
根目录 / desktop / frontend / src / lib / subagentOutcome.ts
1 export type SubagentOutcome = readonly [
2 ref: string | undefined,
3 status: string | undefined,
4 errorCode: string | undefined,
5 retryable: boolean | undefined,
6 ];
7
8 export function parseSubagentOutcomeText(text?: string): SubagentOutcome | undefined {
9 if (!text) return undefined;
10 const head = text.slice(0, 1024);
11 const ref = head.match(/^Subagent reference(?: \(failed\))?: ([^\n]+)/m)?.[1]?.trim();
12 const match = head.match(/^Subagent outcome: status=([^\s]+) retryable=(true|false)(?: error_code=([^\s]+))?/m);
13 if (!ref || !match) return undefined;
14 return [ref, match[1], match[3], match[2] === "true"];
15 }
16
16 lines TYPESCRIPT