{"version":3,"file":"run-status.d.ts","sourceRoot":"","sources":["../../../../src/runs/background/run-status.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM/D,OAAO,EAEN,KAAK,OAAO,EAKZ,KAAK,aAAa,EAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAGN,KAAK,wBAAwB,EAE7B,MAAM,4BAA4B,CAAC;AAqBpC,UAAU,eAAe;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,aAAa;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,OAAO,CAAC;IAC7D,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAgOD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,GAAE,aAAkB,GAAG,eAAe,CAAC,OAAO,CAAC,CA2fjH","sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport type { AgentToolResult } from \"@lpb-work/pi-agent-core\";\nimport { resolveSubagentIntercomTarget } from \"../../intercom/intercom-bridge.ts\";\nimport { resolveSubagentResultStatus } from \"../../intercom/result-intercom.ts\";\nimport { readMissionBinding } from \"../../missions/lifecycle.ts\";\nimport { formatModelThinking } from \"../../shared/formatters.ts\";\nimport { formatActivityLabel } from \"../../shared/status-format.ts\";\nimport {\n\ttype AsyncStatus,\n\ttype Details,\n\tDIRS,\n\ttype ForegroundResumeRun,\n\ttype NestedRunSummary,\n\ttype SteeringStatus,\n\ttype SubagentState,\n} from \"../../shared/types.ts\";\nimport { formatWorkflowJsonPreview } from \"../../workflows/scripted-workflow.ts\";\nimport {\n\tattachRootChildrenToSteps,\n\tfindNestedRouteForRootId,\n\ttype NestedRunResolutionScope,\n\tprojectNestedRegistryForRoot,\n} from \"../shared/nested-events.ts\";\nimport { formatNestedRunStatusLines } from \"../shared/nested-render.ts\";\nimport { resolveAsyncRunLocation } from \"./async-resume.ts\";\nimport {\n\tformatAsyncRunList,\n\tformatAsyncRunOutputPath,\n\tformatAsyncRunProgressLabel,\n\tlistAsyncRuns,\n} from \"./async-status.ts\";\nimport {\n\tformatAsyncResultTranscript,\n\tformatAsyncRunTranscript,\n\tformatNestedRunTranscript,\n\tinspectSubagentFleet,\n} from \"./fleet-view.ts\";\nimport { flatToLogicalStepIndex, normalizeParallelGroups } from \"./parallel-groups.ts\";\nimport { readProcessTerminal, sanitizeProcessTerminal } from \"./process-terminal.ts\";\nimport { resolveSubagentRunId } from \"./run-id-resolver.ts\";\nimport { reconcileAsyncRun, reconcileNestedAsyncDescendants } from \"./stale-run-reconciler.ts\";\nimport { formatWaitSubscriptions } from \"./wait-subscriptions.ts\";\n\ninterface RunStatusParams {\n\taction?: string;\n\tid?: string;\n\trunId?: string;\n\tdir?: string;\n\tindex?: number;\n\tview?: \"fleet\" | \"transcript\";\n\tlines?: number;\n}\n\ninterface RunStatusDeps {\n\tasyncDirRoot?: string;\n\tresultsDir?: string;\n\tkill?: (pid: number, signal?: NodeJS.Signals | 0) => boolean;\n\tnow?: () => number;\n\tstate?: SubagentState;\n\tnested?: NestedRunResolutionScope;\n\tsessionRoots?: string[];\n}\n\nfunction hasExistingSessionFile(value: unknown): value is string {\n\treturn typeof value === \"string\" && fs.existsSync(value);\n}\n\nfunction formatCheckpointGuidance(\n\trunId: string | undefined,\n\tcheckpoint: AsyncStatus[\"checkpoint\"] | undefined,\n): string | undefined {\n\tif (!runId || !checkpoint || checkpoint.status !== \"pending\") return undefined;\n\treturn `Checkpoint: ${checkpoint.name}${checkpoint.message ? ` — ${checkpoint.message}` : \"\"}\\nApprove: subagent({ action: \"approve-checkpoint\", id: \"${runId}\" })\\nReject: subagent({ action: \"reject-checkpoint\", id: \"${runId}\" })`;\n}\n\nfunction formatResumeGuidance(\n\trunId: string | undefined,\n\tchildren: Array<{ agent?: unknown; sessionFile?: unknown }>,\n\tfallbackSessionFile?: unknown,\n\toptions: { stopped?: boolean } = {},\n): string {\n\tif (options.stopped) return \"Resume: unavailable; stopped runs are not resumable. Start a new run instead.\";\n\tconst knownChildren = children\n\t\t.map((child, index) => ({ child, index }))\n\t\t.filter(({ child }) => typeof child.agent === \"string\");\n\tif (!runId || knownChildren.length === 0) return \"Resume: unavailable; no child session file was persisted.\";\n\tconst singleSessionFile = knownChildren[0]?.child.sessionFile ?? fallbackSessionFile;\n\tif (children.length === 1 && knownChildren.length === 1 && hasExistingSessionFile(singleSessionFile)) {\n\t\treturn `Revive: subagent({ action: \"resume\", id: \"${runId}\", message: \"...\" })`;\n\t}\n\tconst childWithSession = knownChildren.find(({ child }) => hasExistingSessionFile(child.sessionFile));\n\tif (childWithSession) {\n\t\treturn `Revive child: subagent({ action: \"resume\", id: \"${runId}\", index: ${childWithSession.index}, message: \"...\" })`;\n\t}\n\treturn \"Resume: unavailable; no child session file was persisted.\";\n}\n\nfunction stepLineLabel(status: AsyncStatus, index: number): string {\n\tconst steps = status.steps ?? [];\n\tif (status.mode === \"parallel\") return `Agent ${index + 1}/${steps.length || 1}`;\n\tif (status.mode === \"workflow\") return `Workflow child ${steps[index]?.workflowKey ?? index + 1}`;\n\tif (status.mode === \"chain\") {\n\t\tconst chainStepCount = status.chainStepCount ?? (steps.length || 1);\n\t\tconst groups = normalizeParallelGroups(status.parallelGroups, steps.length, chainStepCount);\n\t\tconst group = groups.find((candidate) => index >= candidate.start && index < candidate.start + candidate.count);\n\t\tif (group) return `Step ${group.stepIndex + 1}/${chainStepCount} Agent ${index - group.start + 1}/${group.count}`;\n\t\treturn `Step ${flatToLogicalStepIndex(index, chainStepCount, groups) + 1}/${chainStepCount}`;\n\t}\n\treturn `Step ${index + 1}`;\n}\n\nfunction nestedRunDisplayName(run: NestedRunSummary): string {\n\tif (run.agent) return run.agent;\n\tif (run.agents?.length) return run.agents.join(\", \");\n\treturn run.id;\n}\n\nfunction formatSteeringSummary(input: { steering?: SteeringStatus }): string | undefined {\n\tconst steering = input.steering;\n\tif (!steering || steering.requested === 0) return undefined;\n\tconst lateAcknowledgments = steering.recent.reduce(\n\t\t(count, request) => count + request.targets.filter((target) => target.lateDeliveredAt !== undefined).length,\n\t\t0,\n\t);\n\treturn `${steering.requested} requested, ${steering.scheduled} scheduled, ${steering.pending} pending, ${steering.delivered} delivered, ${steering.failed} failed, ${steering.recovered} recovered${lateAcknowledgments ? `, ${lateAcknowledgments} late acknowledged` : \"\"}`;\n}\n\nfunction rememberedForegroundChildOutput(child: ForegroundResumeRun[\"children\"][number]): string {\n\tconst outputPath = child.artifactPaths?.outputPath ?? child.savedOutputPath;\n\tif (outputPath && fs.existsSync(outputPath)) {\n\t\ttry {\n\t\t\tconst artifactOutput = fs.readFileSync(outputPath, \"utf-8\").trim();\n\t\t\tif (artifactOutput) return artifactOutput;\n\t\t} catch {\n\t\t\t// Fall back to the remembered snapshot below.\n\t\t}\n\t}\n\treturn child.finalOutput ?? \"\";\n}\n\nfunction formatRememberedForegroundStatus(run: ForegroundResumeRun): string {\n\tconst lines = [\n\t\t`Run: ${run.runId}`,\n\t\t\"State: remembered foreground\",\n\t\t`Mode: ${run.mode}`,\n\t\t`Updated: ${new Date(run.updatedAt).toISOString()}`,\n\t\t`Cwd: ${run.cwd}`,\n\t];\n\tfor (const child of run.children) {\n\t\tconst output = rememberedForegroundChildOutput(child)\n\t\t\t.trim()\n\t\t\t.split(/\\r?\\n/)\n\t\t\t.find((line) => line.trim());\n\t\tconst parts = [\n\t\t\t`${child.index + 1}. ${child.agent} ${child.status}`,\n\t\t\tchild.exitCode !== undefined ? `exit ${child.exitCode}` : undefined,\n\t\t\tchild.detachedReason ? `detached: ${child.detachedReason}` : undefined,\n\t\t\tchild.acceptance ? `acceptance: ${child.acceptance.status}` : undefined,\n\t\t\tchild.error ? `error: ${child.error}` : undefined,\n\t\t\toutput ? `output: ${output.slice(0, 160)}` : undefined,\n\t\t].filter(Boolean);\n\t\tlines.push(parts.join(\", \"));\n\t\tif (child.sessionFile) lines.push(`  Session: ${child.sessionFile}`);\n\t\tif (child.transcriptPath) lines.push(`  Transcript: ${child.transcriptPath}`);\n\t\tif (child.artifactPaths?.outputPath) lines.push(`  Output: ${child.artifactPaths.outputPath}`);\n\t\tif (child.savedOutputPath && child.savedOutputPath !== child.artifactPaths?.outputPath)\n\t\t\tlines.push(`  Saved output: ${child.savedOutputPath}`);\n\t\tif (child.outputSaveError) lines.push(`  Output warning: ${child.outputSaveError}`);\n\t\tif (child.transcriptError) lines.push(`  Transcript warning: ${child.transcriptError}`);\n\t}\n\tlines.push(\"\", `Status: subagent({ action: \"status\", id: \"${run.runId}\" })`);\n\tif (run.children.length === 1)\n\t\tlines.push(`Transcript: subagent({ action: \"status\", id: \"${run.runId}\", view: \"transcript\" })`);\n\telse lines.push(`Transcript: subagent({ action: \"status\", id: \"${run.runId}\", index: 0, view: \"transcript\" })`);\n\tconst detached = run.children.some((child) => child.status === \"detached\");\n\tconst resumable = run.children.find((child) => hasExistingSessionFile(child.sessionFile));\n\tif (run.checkpoint?.status === \"pending\") {\n\t\tlines.push(`Checkpoint: ${run.checkpoint.name}${run.checkpoint.message ? ` — ${run.checkpoint.message}` : \"\"}`);\n\t\tlines.push(`Approve: subagent({ action: \"approve-checkpoint\", id: \"${run.runId}\" })`);\n\t\tlines.push(`Reject: subagent({ action: \"reject-checkpoint\", id: \"${run.runId}\" })`);\n\t\treturn lines.join(\"\\n\");\n\t}\n\tif (detached) {\n\t\tlines.push(\n\t\t\t`Recovery: reply to the supervisor request first, then wait with subagent_wait({ id: \"${run.runId}\" }); do not resume or launch a replacement while any child remains detached.`,\n\t\t);\n\t} else if (resumable) {\n\t\tlines.push(\n\t\t\trun.children.length === 1\n\t\t\t\t? `Revive: subagent({ action: \"resume\", id: \"${run.runId}\", message: \"...\" })`\n\t\t\t\t: `Revive child: subagent({ action: \"resume\", id: \"${run.runId}\", index: ${resumable.index}, message: \"...\" })`,\n\t\t);\n\t} else {\n\t\tlines.push(\"Resume: unavailable; no child session file was persisted.\");\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nfunction formatRememberedForegroundTranscript(\n\trun: ForegroundResumeRun,\n\toptions: { index?: number; lines?: number },\n): string {\n\tlet index = options.index;\n\tif (index !== undefined && !Number.isInteger(index)) throw new Error(\"Transcript index must be an integer.\");\n\tif (index === undefined && run.children.length === 1) index = 0;\n\tif (index === undefined)\n\t\treturn `Transcript view requires index for foreground run '${run.runId}' with ${run.children.length} children.`;\n\tif (index < 0 || index >= run.children.length)\n\t\tthrow new Error(`Transcript index ${index} is out of range for ${run.children.length} foreground children.`);\n\tconst child = run.children[index]!;\n\tconst lineLimit = Math.max(1, Math.min(options.lines ?? 80, 1000));\n\tconst outputLines = rememberedForegroundChildOutput(child)\n\t\t.split(/\\r?\\n/)\n\t\t.filter((line) => line.trim())\n\t\t.slice(-lineLimit);\n\tconst lines = [\n\t\t`Run: ${run.runId}`,\n\t\t`State: ${child.status}`,\n\t\t`Child: ${index} (${child.agent})`,\n\t\tchild.sessionFile ? `Session: ${child.sessionFile}` : undefined,\n\t\tchild.transcriptPath ? `Transcript: ${child.transcriptPath}` : undefined,\n\t\tchild.artifactPaths?.outputPath ? `Output: ${child.artifactPaths.outputPath}` : undefined,\n\t\tchild.savedOutputPath && child.savedOutputPath !== child.artifactPaths?.outputPath\n\t\t\t? `Saved output: ${child.savedOutputPath}`\n\t\t\t: undefined,\n\t\tchild.outputSaveError ? `Output warning: ${child.outputSaveError}` : undefined,\n\t].filter((line): line is string => Boolean(line));\n\tlines.push(\"Result transcript tail:\");\n\tif (outputLines.length === 0) lines.push(\"  (no recovered final output available yet)\");\n\telse for (const line of outputLines) lines.push(`  ${line}`);\n\treturn lines.join(\"\\n\");\n}\n\nfunction formatNestedExactStatus(rootRunId: string, run: NestedRunSummary): string {\n\tconst lines = [\n\t\t`Nested run: ${run.id}`,\n\t\t`Root: ${rootRunId}`,\n\t\t`Parent: ${run.parentRunId}${run.parentStepIndex !== undefined ? ` step ${run.parentStepIndex + 1}` : \"\"}`,\n\t\t`State: ${run.state}`,\n\t\trun.activityState || run.lastActivityAt\n\t\t\t? `Activity: ${formatActivityLabel(run.lastActivityAt, run.activityState)}`\n\t\t\t: undefined,\n\t\trun.mode ? `Mode: ${run.mode}` : undefined,\n\t\t`Agent: ${nestedRunDisplayName(run)}`,\n\t\trun.currentStep !== undefined\n\t\t\t? `Progress: step ${run.currentStep + 1}/${run.chainStepCount ?? run.steps?.length ?? 1}`\n\t\t\t: undefined,\n\t\trun.turnBudget\n\t\t\t? `Turn budget: ${run.turnBudget.turnCount}/${run.turnBudget.maxTurns}+${run.turnBudget.graceTurns} (${run.turnBudget.outcome})`\n\t\t\t: undefined,\n\t\trun.asyncDir ? `Dir: ${run.asyncDir}` : undefined,\n\t\trun.sessionFile ? `Session: ${run.sessionFile}` : undefined,\n\t\trun.error ? `Error: ${run.error}` : undefined,\n\t].filter((line): line is string => Boolean(line));\n\tif (run.path.length) {\n\t\tlines.push(\n\t\t\t`Path: ${run.path.map((part) => `${part.runId}${part.stepIndex !== undefined ? `:${part.stepIndex + 1}` : \"\"}${part.agent ? `:${part.agent}` : \"\"}`).join(\" > \")} > ${run.id}`,\n\t\t);\n\t}\n\tif (run.steps?.length) {\n\t\tlines.push(\"Steps:\");\n\t\tfor (const [index, step] of run.steps.entries()) {\n\t\t\tconst activity =\n\t\t\t\tstep.status === \"running\" ? formatActivityLabel(step.lastActivityAt, step.activityState) : undefined;\n\t\t\tconst budget = step.turnBudget\n\t\t\t\t? `, turn budget: ${step.turnBudget.turnCount}/${step.turnBudget.maxTurns}+${step.turnBudget.graceTurns} (${step.turnBudget.outcome})`\n\t\t\t\t: \"\";\n\t\t\tlines.push(\n\t\t\t\t`  ${index + 1}. ${step.agent} ${step.status}${activity ? `, ${activity}` : \"\"}${budget}${step.error ? `, error: ${step.error}` : \"\"}`,\n\t\t\t);\n\t\t\tlines.push(...formatNestedRunStatusLines(step.children, { indent: \"    \", commandHints: true }));\n\t\t}\n\t}\n\tlines.push(...formatNestedRunStatusLines(run.children, { indent: \"  \", commandHints: true }));\n\tlines.push(\n\t\t\"Commands:\",\n\t\t`  Status: subagent({ action: \"status\", id: \"${run.id}\" })`,\n\t\t`  Interrupt: subagent({ action: \"interrupt\", id: \"${run.id}\" })`,\n\t\t`  Resume: subagent({ action: \"resume\", id: \"${run.id}\", message: \"...\" })`,\n\t\t`  Steer: subagent({ action: \"steer\", id: \"${run.id}\", message: \"...\" })`,\n\t\t`  Root status: subagent({ action: \"status\", id: \"${rootRunId}\" })`,\n\t);\n\treturn lines.join(\"\\n\");\n}\n\nexport function inspectSubagentStatus(params: RunStatusParams, deps: RunStatusDeps = {}): AgentToolResult<Details> {\n\tconst asyncDirRoot = deps.asyncDirRoot ?? DIRS.async;\n\tconst resultsDir = deps.resultsDir ?? DIRS.results;\n\tconst currentSessionId = deps.state?.currentSessionId ?? undefined;\n\tif (params.view && params.view !== \"fleet\" && params.view !== \"transcript\") {\n\t\treturn {\n\t\t\tcontent: [{ type: \"text\", text: `Unknown status view: ${params.view}. Valid: fleet, transcript.` }],\n\t\t\tisError: true,\n\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t};\n\t}\n\tif (params.view === \"fleet\") {\n\t\treturn inspectSubagentFleet(params, {\n\t\t\tasyncDirRoot,\n\t\t\tresultsDir,\n\t\t\tkill: deps.kill,\n\t\t\tnow: deps.now,\n\t\t\tstate: deps.state,\n\t\t\tchildSafe: Boolean(deps.nested),\n\t\t});\n\t}\n\tif (!params.id && !params.runId && !params.dir) {\n\t\tif (deps.nested) {\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{ type: \"text\", text: \"Child-safe subagent status requires an id when no foreground run is active.\" },\n\t\t\t\t],\n\t\t\t\tisError: true,\n\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t};\n\t\t}\n\t\ttry {\n\t\t\tconst runs = listAsyncRuns(asyncDirRoot, {\n\t\t\t\tstates: [\"queued\", \"running\"],\n\t\t\t\tsessionId: currentSessionId,\n\t\t\t\tresultsDir,\n\t\t\t\tkill: deps.kill,\n\t\t\t\tnow: deps.now,\n\t\t\t});\n\t\t\tif (params.view === \"transcript\") {\n\t\t\t\tif (runs.length === 1) return inspectSubagentStatus({ ...params, id: runs[0]!.id }, deps);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext:\n\t\t\t\t\t\t\t\truns.length === 0\n\t\t\t\t\t\t\t\t\t? \"No active async run transcript is available.\"\n\t\t\t\t\t\t\t\t\t: `Transcript view requires an id when ${runs.length} active async runs exist. Use subagent({ action: \"status\", view: \"fleet\" }) to choose one.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tisError: true,\n\t\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst waitSubscriptions = deps.state\n\t\t\t\t? formatWaitSubscriptions(deps.state, deps.now?.() ?? Date.now())\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{ type: \"text\", text: [formatAsyncRunList(runs), waitSubscriptions].filter(Boolean).join(\"\\n\\n\") },\n\t\t\t\t],\n\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: message }],\n\t\t\t\tisError: true,\n\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t};\n\t\t}\n\t}\n\n\tlet location;\n\ttry {\n\t\tconst requestedId = params.id ?? params.runId;\n\t\tif (!params.dir && requestedId) {\n\t\t\tconst resolved = resolveSubagentRunId(requestedId, {\n\t\t\t\tasyncDirRoot,\n\t\t\t\tresultsDir,\n\t\t\t\tstate: deps.state,\n\t\t\t\tnested: deps.nested,\n\t\t\t});\n\t\t\tif (resolved?.kind === \"foreground\") {\n\t\t\t\tconst run = deps.state?.foregroundRuns?.get(resolved.id);\n\t\t\t\tif (run) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\ttext:\n\t\t\t\t\t\t\t\t\t\tparams.view === \"transcript\"\n\t\t\t\t\t\t\t\t\t\t\t? formatRememberedForegroundTranscript(run, {\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex: params.index,\n\t\t\t\t\t\t\t\t\t\t\t\t\tlines: params.lines,\n\t\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t\t: formatRememberedForegroundStatus(run),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: message }],\n\t\t\t\t\t\t\tisError: true,\n\t\t\t\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (resolved?.kind === \"nested\") {\n\t\t\t\treconcileNestedAsyncDescendants(resolved.match.route, { resultsDir, kill: deps.kill, now: deps.now });\n\t\t\t\tconst refreshed = resolveSubagentRunId(requestedId, {\n\t\t\t\t\tasyncDirRoot,\n\t\t\t\t\tresultsDir,\n\t\t\t\t\tstate: deps.state,\n\t\t\t\t\tnested: deps.nested,\n\t\t\t\t});\n\t\t\t\tconst nested = refreshed?.kind === \"nested\" ? refreshed : resolved;\n\t\t\t\tif (params.view === \"transcript\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\ttext: formatNestedRunTranscript(nested.match.run, {\n\t\t\t\t\t\t\t\t\t\tindex: params.index,\n\t\t\t\t\t\t\t\t\t\tlines: params.lines,\n\t\t\t\t\t\t\t\t\t\tsessionRoots: deps.sessionRoots,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: message }],\n\t\t\t\t\t\t\tisError: true,\n\t\t\t\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: formatNestedExactStatus(nested.match.rootRunId, nested.match.run) }],\n\t\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (resolved?.kind === \"async\") location = resolved.location;\n\t\t\telse location = { asyncDir: null, resultPath: null, resolvedId: requestedId };\n\t\t} else {\n\t\t\tlocation = resolveAsyncRunLocation(params, asyncDirRoot, resultsDir);\n\t\t}\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\treturn {\n\t\t\tcontent: [{ type: \"text\", text: message }],\n\t\t\tisError: true,\n\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t};\n\t}\n\tconst { asyncDir, resultPath, resolvedId } = location;\n\n\tif (!asyncDir && !resultPath) {\n\t\treturn {\n\t\t\tcontent: [{ type: \"text\", text: \"Async run not found. Provide id or dir.\" }],\n\t\t\tisError: true,\n\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t};\n\t}\n\n\tif (asyncDir) {\n\t\tlet reconciliation;\n\t\ttry {\n\t\t\treconciliation = reconcileAsyncRun(asyncDir, { resultsDir, kill: deps.kill, now: deps.now });\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: message }],\n\t\t\t\tisError: true,\n\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t};\n\t\t}\n\t\tconst status = reconciliation.status;\n\t\tconst effectiveRunId = status?.runId ?? resolvedId ?? \"unknown\";\n\t\tconst logPath = path.join(asyncDir, `subagent-log-${effectiveRunId}.md`);\n\t\tconst eventsPath = path.join(asyncDir, \"events.jsonl\");\n\t\tif (status) {\n\t\t\tif (params.view === \"transcript\") {\n\t\t\t\tif (currentSessionId && status.sessionId !== currentSessionId) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\ttext: \"Transcript view is only available for async runs owned by the current session.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\ttext: formatAsyncRunTranscript(status, asyncDir, {\n\t\t\t\t\t\t\t\t\tindex: params.index,\n\t\t\t\t\t\t\t\t\tlines: params.lines,\n\t\t\t\t\t\t\t\t\tsessionRoots: deps.sessionRoots,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t\t\t};\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\", text: message }],\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet nestedChildren: NestedRunSummary[] = [];\n\t\t\tlet nestedWarning: string | undefined;\n\t\t\ttry {\n\t\t\t\tconst nestedRoute = findNestedRouteForRootId(status.runId);\n\t\t\t\tif (nestedRoute)\n\t\t\t\t\treconcileNestedAsyncDescendants(nestedRoute, { resultsDir, kill: deps.kill, now: deps.now });\n\t\t\t\tnestedChildren = projectNestedRegistryForRoot(status.runId)?.children ?? [];\n\t\t\t\tattachRootChildrenToSteps(status.runId, status.steps, nestedChildren);\n\t\t\t} catch (error) {\n\t\t\t\tnestedWarning = `Nested status unavailable: ${error instanceof Error ? error.message : String(error)}`;\n\t\t\t}\n\t\t\tconst outputPath = formatAsyncRunOutputPath({ asyncDir, outputFile: status.outputFile });\n\t\t\tconst progressLabel = formatAsyncRunProgressLabel({\n\t\t\t\tmode: status.mode,\n\t\t\t\tstate: status.state,\n\t\t\t\tcurrentStep: status.currentStep,\n\t\t\t\tchainStepCount: status.chainStepCount,\n\t\t\t\tparallelGroups: status.parallelGroups,\n\t\t\t\tsteps: (status.steps ?? []).map((step, index) => ({ index, agent: step.agent, status: step.status })),\n\t\t\t});\n\t\t\tconst started = new Date(status.startedAt).toISOString();\n\t\t\tconst updated = status.lastUpdate ? new Date(status.lastUpdate).toISOString() : \"n/a\";\n\t\t\tconst statusActivityText =\n\t\t\t\tstatus.state === \"running\" ? formatActivityLabel(status.lastActivityAt, status.activityState) : undefined;\n\t\t\tconst steeringText = formatSteeringSummary(status);\n\t\t\tconst processTerminal =\n\t\t\t\treadProcessTerminal(asyncDir, {\n\t\t\t\t\trunId: status.runId,\n\t\t\t\t\trunnerProcessInstanceId: status.processTerminal?.runnerProcessInstanceId,\n\t\t\t\t}) ??\n\t\t\t\tsanitizeProcessTerminal(\n\t\t\t\t\tstatus.processTerminal,\n\t\t\t\t\t{ runId: status.runId, runnerProcessInstanceId: status.processTerminal?.runnerProcessInstanceId },\n\t\t\t\t\tpath.join(asyncDir, \"status.json\"),\n\t\t\t\t);\n\t\t\tlet missionId: string | undefined;\n\t\t\ttry {\n\t\t\t\tmissionId = readMissionBinding(asyncDir)?.missionId;\n\t\t\t} catch (error) {\n\t\t\t\tnestedWarning = `${nestedWarning ? `${nestedWarning}; ` : \"\"}Mission binding unavailable: ${error instanceof Error ? error.message : String(error)}`;\n\t\t\t}\n\n\t\t\tconst workflowReturnPreview =\n\t\t\t\tstatus.workflow?.value !== undefined ? formatWorkflowJsonPreview(status.workflow.value, 240) : undefined;\n\t\t\tconst workflowEmitPreview = status.workflow?.emits.length\n\t\t\t\t? formatWorkflowJsonPreview(status.workflow.emits.at(-1), 240)\n\t\t\t\t: undefined;\n\t\t\tconst lines = [\n\t\t\t\t`Run: ${status.runId}`,\n\t\t\t\tmissionId ? `Mission: ${missionId}` : undefined,\n\t\t\t\t`State: ${status.state}`,\n\t\t\t\tprocessTerminal\n\t\t\t\t\t? `Process terminal: ${processTerminal.state}${processTerminal.reason ? ` (${processTerminal.reason})` : \"\"}`\n\t\t\t\t\t: undefined,\n\t\t\t\tstatus.capabilityCeiling\n\t\t\t\t\t? `Capability ceiling: ${status.capabilityCeiling.allowedTools === undefined ? \"names unrestricted\" : status.capabilityCeiling.allowedTools.length === 0 ? \"none\" : status.capabilityCeiling.allowedTools.join(\", \")}\\nExtensions denied: ${status.capabilityCeiling.denyExtensions ? \"yes\" : \"no\"} (sources: ${status.capabilityCeiling.sources.join(\", \")})`\n\t\t\t\t\t: undefined,\n\t\t\t\tstatus.capabilityAudit\n\t\t\t\t\t? `Capability audit: ${status.capabilityAudit.removedTools.length} tools removed, ${status.capabilityAudit.removedExtensionCount} extension entries removed`\n\t\t\t\t\t: undefined,\n\t\t\t\tstatus.error ? `Error: ${status.error}` : undefined,\n\t\t\t\tstatusActivityText ? `Activity: ${statusActivityText}` : undefined,\n\t\t\t\tsteeringText ? `Steering: ${steeringText}` : undefined,\n\t\t\t\t`Mode: ${status.mode}`,\n\t\t\t\tstatus.parentWorkflowRunId\n\t\t\t\t\t? `Workflow parent: ${status.parentWorkflowRunId}${status.workflowKey ? ` (${status.workflowKey})` : \"\"}`\n\t\t\t\t\t: undefined,\n\t\t\t\tstatus.mode === \"workflow\" && workflowReturnPreview !== undefined\n\t\t\t\t\t? `Return: ${workflowReturnPreview}`\n\t\t\t\t\t: undefined,\n\t\t\t\tstatus.mode === \"workflow\" && workflowEmitPreview !== undefined\n\t\t\t\t\t? `Latest emit: ${workflowEmitPreview}`\n\t\t\t\t\t: undefined,\n\t\t\t\t`Progress: ${progressLabel}`,\n\t\t\t\tstatus.pendingAppends ? `Pending appends: ${status.pendingAppends}` : undefined,\n\t\t\t\t`Started: ${started}`,\n\t\t\t\t`Updated: ${updated}`,\n\t\t\t\tstatus.turnBudget\n\t\t\t\t\t? `Turn budget: ${status.turnBudget.turnCount}/${status.turnBudget.maxTurns}+${status.turnBudget.graceTurns} (${status.turnBudget.outcome})`\n\t\t\t\t\t: undefined,\n\t\t\t\t`Dir: ${asyncDir}`,\n\t\t\t\toutputPath ? `Output: ${outputPath}` : undefined,\n\t\t\t\tstatus.parallelHandoff ? `Parallel handoff: ${status.parallelHandoff.path}` : undefined,\n\t\t\t\treconciliation.message ? `Diagnosis: ${reconciliation.message}` : undefined,\n\t\t\t\treconciliation.resultPath && fs.existsSync(reconciliation.resultPath)\n\t\t\t\t\t? `Result: ${reconciliation.resultPath}`\n\t\t\t\t\t: undefined,\n\t\t\t].filter((line): line is string => Boolean(line));\n\t\t\tfor (const [index, step] of (status.steps ?? []).entries()) {\n\t\t\t\tconst stepActivityText =\n\t\t\t\t\tstep.status === \"running\" ? formatActivityLabel(step.lastActivityAt, step.activityState) : undefined;\n\t\t\t\tconst modelThinking = formatModelThinking(step.model, step.thinking);\n\t\t\t\tconst modelText = modelThinking ? ` (${modelThinking})` : \"\";\n\t\t\t\tconst steeringText = formatSteeringSummary(step);\n\t\t\t\tconst steeringSuffix = steeringText ? `, steering: ${steeringText}` : \"\";\n\t\t\t\tconst errorText = step.error ? `, error: ${step.error}` : \"\";\n\t\t\t\tconst acceptanceText = step.acceptance?.status ? `, acceptance: ${step.acceptance.status}` : \"\";\n\t\t\t\tconst budgetText = step.turnBudget\n\t\t\t\t\t? `, turn budget: ${step.turnBudget.turnCount}/${step.turnBudget.maxTurns}+${step.turnBudget.graceTurns} (${step.turnBudget.outcome})`\n\t\t\t\t\t: \"\";\n\t\t\t\tconst display = step.label ? `${step.label} (${step.agent})` : step.agent;\n\t\t\t\tconst phase = step.phase ? `[${step.phase}] ` : \"\";\n\t\t\t\tlines.push(\n\t\t\t\t\t`${stepLineLabel(status, index)}: ${phase}${display} ${step.status}${modelText}${stepActivityText ? `, ${stepActivityText}` : \"\"}${steeringSuffix}${acceptanceText}${budgetText}${errorText}`,\n\t\t\t\t);\n\t\t\t\tif (step.runner?.type === \"external-cli\") {\n\t\t\t\t\tlines.push(\n\t\t\t\t\t\t`  Runner: external-cli (${step.runner.command}${step.runner.args.length ? ` ${step.runner.args.join(\" \")}` : \"\"})`,\n\t\t\t\t\t);\n\t\t\t\t\tif (step.runner.retry)\n\t\t\t\t\t\tlines.push(\n\t\t\t\t\t\t\t`  Retry: ${step.runner.retry.maxAttempts} attempts${step.runner.retry.backoffMs !== undefined ? `, ${step.runner.retry.backoffMs}ms backoff` : \"\"}`,\n\t\t\t\t\t\t);\n\t\t\t\t\tif (step.externalProcess?.pid !== undefined) lines.push(`  Process: ${step.externalProcess.pid}`);\n\t\t\t\t\tif (step.externalProcess?.attempt !== undefined)\n\t\t\t\t\t\tlines.push(\n\t\t\t\t\t\t\t`  Attempt: ${step.externalProcess.attempt}/${step.externalProcess.maxAttempts ?? step.externalProcess.attempt}`,\n\t\t\t\t\t\t);\n\t\t\t\t\tif (step.externalProcess)\n\t\t\t\t\t\tlines.push(\n\t\t\t\t\t\t\t`  Stdout: ${step.externalProcess.stdoutPath}`,\n\t\t\t\t\t\t\t`  Stderr: ${step.externalProcess.stderrPath}`,\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tlines.push(\n\t\t\t\t\t...formatNestedRunStatusLines(step.children, { indent: \"  \", commandHints: true, maxLines: 20 }),\n\t\t\t\t);\n\t\t\t\tconst stepOutputPath = path.join(asyncDir, `output-${index}.log`);\n\t\t\t\tif (stepOutputPath !== outputPath && fs.existsSync(stepOutputPath))\n\t\t\t\t\tlines.push(`  Output: ${stepOutputPath}`);\n\t\t\t\tif (step.status === \"running\" && step.runner?.type !== \"external-cli\") {\n\t\t\t\t\tlines.push(\n\t\t\t\t\t\t`  Intercom target: ${resolveSubagentIntercomTarget(status.runId, step.agent, index)} (if registered)`,\n\t\t\t\t\t);\n\t\t\t\t\tlines.push(\n\t\t\t\t\t\t`  Steer: subagent({ action: \"steer\", id: \"${status.runId}\", index: ${index}, message: \"...\" })`,\n\t\t\t\t\t);\n\t\t\t\t} else if (step.status === \"running\" && step.runner?.type === \"external-cli\") {\n\t\t\t\t\tlines.push(\"  Steer: unavailable; one-shot external CLI runners do not accept live messages.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst attached = new Set(\n\t\t\t\t(status.steps ?? []).flatMap((step) => step.children?.map((child) => child.id) ?? []),\n\t\t\t);\n\t\t\tconst unattached = nestedChildren.filter((child) => !attached.has(child.id));\n\t\t\tlines.push(...formatNestedRunStatusLines(unattached, { indent: \"\", commandHints: true, maxLines: 20 }));\n\t\t\tif (nestedWarning) lines.push(`Warning: ${nestedWarning}`);\n\t\t\tif (status.sessionFile) lines.push(`Session: ${status.sessionFile}`);\n\t\t\tconst allExternal =\n\t\t\t\t(status.steps?.length ?? 0) > 0 && status.steps!.every((step) => step.runner?.type === \"external-cli\");\n\t\t\tif (status.state === \"running\" && !allExternal)\n\t\t\t\tlines.push(`Steer running child: subagent({ action: \"steer\", id: \"${status.runId}\", message: \"...\" })`);\n\t\t\tif (status.state !== \"running\") {\n\t\t\t\tlines.push(\n\t\t\t\t\tallExternal\n\t\t\t\t\t\t? \"Resume: unavailable; one-shot external CLI runners do not persist sessions.\"\n\t\t\t\t\t\t: (formatCheckpointGuidance(status.runId, status.checkpoint) ??\n\t\t\t\t\t\t\t\tformatResumeGuidance(status.runId, status.steps ?? [], status.sessionFile, {\n\t\t\t\t\t\t\t\t\tstopped: status.state === \"stopped\" || status.stopped === true,\n\t\t\t\t\t\t\t\t})),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (fs.existsSync(logPath)) lines.push(`Log: ${logPath}`);\n\t\t\tif (fs.existsSync(eventsPath)) lines.push(`Events: ${eventsPath}`);\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: lines.join(\"\\n\") }],\n\t\t\t\tdetails: {\n\t\t\t\t\tmode: \"single\",\n\t\t\t\t\tresults: [],\n\t\t\t\t\t...(processTerminal ? { lifecycleStatus: { processTerminal } } : {}),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t}\n\n\tif (resultPath) {\n\t\ttry {\n\t\t\tconst raw = fs.readFileSync(resultPath, \"utf-8\");\n\t\t\tconst data = JSON.parse(raw) as {\n\t\t\t\tid?: string;\n\t\t\t\trunId?: string;\n\t\t\t\tagent?: string;\n\t\t\t\tsuccess?: boolean;\n\t\t\t\tsummary?: string;\n\t\t\t\toutput?: string;\n\t\t\t\texitCode?: number;\n\t\t\t\tstate?: string;\n\t\t\t\tstopped?: boolean;\n\t\t\t\ttimedOut?: boolean;\n\t\t\t\tturnBudgetExceeded?: boolean;\n\t\t\t\tprocessSignal?: string | null;\n\t\t\t\tsessionFile?: string;\n\t\t\t\tparallelHandoff?: { path?: string };\n\t\t\t\tresults?: Array<{\n\t\t\t\t\tagent?: string;\n\t\t\t\t\toutput?: string;\n\t\t\t\t\tsummary?: string;\n\t\t\t\t\tsessionFile?: string;\n\t\t\t\t\tstate?: string;\n\t\t\t\t\tsuccess?: boolean;\n\t\t\t\t\texitCode?: number | null;\n\t\t\t\t\tstopped?: boolean;\n\t\t\t\t\ttimedOut?: boolean;\n\t\t\t\t\tturnBudgetExceeded?: boolean;\n\t\t\t\t\tinterrupted?: boolean;\n\t\t\t\t\tprocessSignal?: string | null;\n\t\t\t\t}>;\n\t\t\t};\n\t\t\tif (params.view === \"transcript\") {\n\t\t\t\ttry {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\ttext: formatAsyncResultTranscript(data, resultPath, {\n\t\t\t\t\t\t\t\t\tindex: params.index,\n\t\t\t\t\t\t\t\t\tlines: params.lines,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t\t\t};\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\", text: message }],\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst childStatuses = Array.isArray(data.results)\n\t\t\t\t? data.results.map((child) =>\n\t\t\t\t\t\tresolveSubagentResultStatus({\n\t\t\t\t\t\t\tsuccess: child.success,\n\t\t\t\t\t\t\tstate: child.state,\n\t\t\t\t\t\t\tinterrupted: child.interrupted,\n\t\t\t\t\t\t\ttimedOut: child.timedOut,\n\t\t\t\t\t\t\tstopped: child.stopped,\n\t\t\t\t\t\t\tturnBudgetExceeded: child.turnBudgetExceeded,\n\t\t\t\t\t\t\tprocessSignal: child.processSignal,\n\t\t\t\t\t\t\texitCode: typeof child.exitCode === \"number\" ? child.exitCode : undefined,\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t: [];\n\t\t\tconst status =\n\t\t\t\tdata.state === \"stopped\" || data.stopped === true || childStatuses.includes(\"stopped\")\n\t\t\t\t\t? \"stopped\"\n\t\t\t\t\t: data.success\n\t\t\t\t\t\t? \"complete\"\n\t\t\t\t\t\t: data.state === \"paused\" || data.exitCode === 0\n\t\t\t\t\t\t\t? \"paused\"\n\t\t\t\t\t\t\t: \"failed\";\n\t\t\tconst runId = data.runId ?? data.id ?? resolvedId;\n\t\t\tconst lines = [`Run: ${runId}`, `State: ${status}`, `Result: ${resultPath}`];\n\t\t\tif (data.parallelHandoff?.path) lines.push(`Parallel handoff: ${data.parallelHandoff.path}`);\n\t\t\tconst children = Array.isArray(data.results)\n\t\t\t\t? data.results\n\t\t\t\t: data.agent\n\t\t\t\t\t? [{ agent: data.agent, sessionFile: data.sessionFile }]\n\t\t\t\t\t: [];\n\t\t\tlines.push(formatResumeGuidance(runId, children, data.sessionFile, { stopped: status === \"stopped\" }));\n\t\t\tif (data.summary) lines.push(\"\", data.summary);\n\t\t\treturn { content: [{ type: \"text\", text: lines.join(\"\\n\") }], details: { mode: \"single\", results: [] } };\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `Failed to read async result file: ${message}` }],\n\t\t\t\tisError: true,\n\t\t\t\tdetails: { mode: \"single\", results: [] },\n\t\t\t};\n\t\t}\n\t}\n\n\treturn {\n\t\tcontent: [{ type: \"text\", text: \"Status file not found.\" }],\n\t\tisError: true,\n\t\tdetails: { mode: \"single\", results: [] },\n\t};\n}\n"]}