iosm-cli 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -47
- package/dist/core/agent-teams.d.ts.map +1 -1
- package/dist/core/agent-teams.js +38 -11
- package/dist/core/agent-teams.js.map +1 -1
- package/dist/core/failure-retrospective.d.ts +12 -0
- package/dist/core/failure-retrospective.d.ts.map +1 -0
- package/dist/core/failure-retrospective.js +115 -0
- package/dist/core/failure-retrospective.js.map +1 -0
- package/dist/core/project-index/index.d.ts +17 -0
- package/dist/core/project-index/index.d.ts.map +1 -0
- package/dist/core/project-index/index.js +323 -0
- package/dist/core/project-index/index.js.map +1 -0
- package/dist/core/project-index/types.d.ts +34 -0
- package/dist/core/project-index/types.d.ts.map +1 -0
- package/dist/core/project-index/types.js +2 -0
- package/dist/core/project-index/types.js.map +1 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +8 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/shared-memory.d.ts +46 -0
- package/dist/core/shared-memory.d.ts.map +1 -0
- package/dist/core/shared-memory.js +253 -0
- package/dist/core/shared-memory.js.map +1 -0
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +5 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/subagents.js +1 -1
- package/dist/core/subagents.js.map +1 -1
- package/dist/core/swarm/gates.d.ts +9 -0
- package/dist/core/swarm/gates.d.ts.map +1 -0
- package/dist/core/swarm/gates.js +65 -0
- package/dist/core/swarm/gates.js.map +1 -0
- package/dist/core/swarm/index.d.ts +9 -0
- package/dist/core/swarm/index.d.ts.map +1 -0
- package/dist/core/swarm/index.js +9 -0
- package/dist/core/swarm/index.js.map +1 -0
- package/dist/core/swarm/locks.d.ts +21 -0
- package/dist/core/swarm/locks.d.ts.map +1 -0
- package/dist/core/swarm/locks.js +93 -0
- package/dist/core/swarm/locks.js.map +1 -0
- package/dist/core/swarm/planner.d.ts +16 -0
- package/dist/core/swarm/planner.d.ts.map +1 -0
- package/dist/core/swarm/planner.js +137 -0
- package/dist/core/swarm/planner.js.map +1 -0
- package/dist/core/swarm/retry.d.ts +16 -0
- package/dist/core/swarm/retry.d.ts.map +1 -0
- package/dist/core/swarm/retry.js +32 -0
- package/dist/core/swarm/retry.js.map +1 -0
- package/dist/core/swarm/scheduler.d.ts +48 -0
- package/dist/core/swarm/scheduler.d.ts.map +1 -0
- package/dist/core/swarm/scheduler.js +554 -0
- package/dist/core/swarm/scheduler.js.map +1 -0
- package/dist/core/swarm/spawn.d.ts +16 -0
- package/dist/core/swarm/spawn.d.ts.map +1 -0
- package/dist/core/swarm/spawn.js +42 -0
- package/dist/core/swarm/spawn.js.map +1 -0
- package/dist/core/swarm/state-store.d.ts +35 -0
- package/dist/core/swarm/state-store.d.ts.map +1 -0
- package/dist/core/swarm/state-store.js +106 -0
- package/dist/core/swarm/state-store.js.map +1 -0
- package/dist/core/swarm/types.d.ts +116 -0
- package/dist/core/swarm/types.d.ts.map +1 -0
- package/dist/core/swarm/types.js +2 -0
- package/dist/core/swarm/types.js.map +1 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +3 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/shared-memory.d.ts +23 -0
- package/dist/core/tools/shared-memory.d.ts.map +1 -0
- package/dist/core/tools/shared-memory.js +134 -0
- package/dist/core/tools/shared-memory.js.map +1 -0
- package/dist/core/tools/task.d.ts +8 -1
- package/dist/core/tools/task.d.ts.map +1 -1
- package/dist/core/tools/task.js +664 -123
- package/dist/core/tools/task.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +27 -4
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/subagent-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/subagent-message.js +14 -0
- package/dist/modes/interactive/components/subagent-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +38 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1362 -31
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/cli-reference.md +11 -1
- package/docs/interactive-mode.md +42 -3
- package/docs/orchestration-and-subagents.md +96 -169
- package/package.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.js","sourceRoot":"","sources":["../../../src/core/tools/task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAsDrE,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9B,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC;QACxB,WAAW,EAAE,yDAAyD;KACtE,CAAC;IACF,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;QACnB,WAAW,EAAE,mCAAmC;KAChD,CAAC;IACF,KAAK,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC;QACX,WAAW,EAAE,oFAAoF;KACjG,CAAC,CACF;IACD,OAAO,EAAE,IAAI,CAAC,KAAK,CAClB;QACC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAC5B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AChB,oBAAoB,EAAE,gBAAgB;wBACtC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ;wBAC7B,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM;wBAC5C,gBAAgB,EAAE,cAAc,EAAE,gBAAgB;wBAClD,kBAAkB,EAAE,cAAc,EAAE,kBAAkB;wBACtD,iBAAiB,EAAE,cAAc,EAAE,iBAAiB;qBACpD;iBACD,CAAC;YACH,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,eAAe,EAAE,CAAC;YACvC,OAAO;gBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;gBACvD,OAAO,EAAE,MAAM,CAAC,OAAO;aACvB,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { existsSync, mkdirSync, rmSync, statSync, writeFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport { spawnSync } from \"node:child_process\";\nimport type { AgentTool } from \"@mariozechner/pi-agent-core\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { getTeamRun, updateTeamTaskStatus } from \"../agent-teams.js\";\nimport type { CustomSubagentDefinition } from \"../subagents.js\";\n\n/**\n * Callback type passed in from sdk.ts to avoid circular imports.\n * Spawns a sub-session and runs it to completion, returning the final text output.\n */\nexport type SubagentRunResult = {\n\toutput: string;\n\tsessionId?: string;\n\tstats?: {\n\t\ttoolCallsStarted: number;\n\t\ttoolCallsCompleted: number;\n\t\tassistantMessages: number;\n\t};\n};\n\nexport type TaskToolProgressPhase = \"queued\" | \"starting\" | \"running\" | \"responding\";\n\nexport type TaskDelegateProgressStatus = \"pending\" | \"running\" | \"done\" | \"failed\";\n\nexport interface TaskDelegateProgressItem {\n\tindex: number;\n\tdescription: string;\n\tprofile: string;\n\tstatus: TaskDelegateProgressStatus;\n}\n\nexport interface TaskToolProgress {\n\tkind: \"subagent_progress\";\n\tphase: TaskToolProgressPhase;\n\tmessage: string;\n\tcwd?: string;\n\tactiveTool?: string;\n\ttoolCallsStarted?: number;\n\ttoolCallsCompleted?: number;\n\tassistantMessages?: number;\n\tdelegateIndex?: number;\n\tdelegateTotal?: number;\n\tdelegateDescription?: string;\n\tdelegateProfile?: string;\n\tdelegateItems?: TaskDelegateProgressItem[];\n}\n\nexport type SubagentRunner = (options: {\n\tsystemPrompt: string;\n\ttools: string[];\n\tprompt: string;\n\tcwd: string;\n\tmodelOverride?: string;\n\tsignal?: AbortSignal;\n\tonProgress?: (progress: TaskToolProgress) => void;\n}) => Promise<string | SubagentRunResult>;\n\nconst taskSchema = Type.Object({\n\tdescription: Type.String({\n\t\tdescription: \"Short 3-5 word description of what the subagent will do\",\n\t}),\n\tprompt: Type.String({\n\t\tdescription: \"Full task prompt for the subagent\",\n\t}),\n\tagent: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Optional custom subagent name loaded from .iosm/agents or global agents directory.\",\n\t\t}),\n\t),\n\tprofile: Type.Union(\n\t\t[\n\t\t\tType.Literal(\"explore\"),\n\t\t\tType.Literal(\"plan\"),\n\t\t\tType.Literal(\"iosm\"),\n\t\t\tType.Literal(\"iosm_analyst\"),\n\t\t\tType.Literal(\"iosm_verifier\"),\n\t\t\tType.Literal(\"cycle_planner\"),\n\t\t\tType.Literal(\"full\"),\n\t\t],\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Subagent capability profile: explore (read-only), plan (read + bash, no edits), iosm (full tools + IOSM methodology), iosm_analyst (read + bash for IOSM artifacts), iosm_verifier (artifact-focused checks), cycle_planner (cycle planning), full (all tools)\",\n\t\t},\n\t),\n\tcwd: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Optional working directory for this subagent. Relative paths are resolved from the current workspace.\",\n\t\t}),\n\t),\n\tlock_key: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Optional logical lock key for write serialization (e.g. src/api/**). Agents with the same lock key run write phases sequentially.\",\n\t\t}),\n\t),\n\trun_id: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Optional orchestration run id (from /orchestrate). Use with task_id so the team board can track status.\",\n\t\t}),\n\t),\n\ttask_id: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Optional orchestration task id (for example task_1). Use with run_id to update the team board.\",\n\t\t}),\n\t),\n\tmodel: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Optional model override for this subagent (for example anthropic/claude-sonnet-4 or model id).\",\n\t\t}),\n\t),\n\tbackground: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription:\n\t\t\t\t\"Run subagent in background and return immediately with run id. Use for detached async runs; orchestrated run_id/task_id calls execute foreground for deterministic coordination. Background mode is read-only policy by default.\",\n\t\t}),\n\t),\n\tisolation: Type.Optional(\n\t\tType.Union([Type.Literal(\"none\"), Type.Literal(\"worktree\")], {\n\t\t\tdescription:\n\t\t\t\t\"Optional isolation mode. Set to worktree to run this subagent in a temporary git worktree.\",\n\t\t}),\n\t),\n});\n\nexport type TaskToolInput = Static<typeof taskSchema>;\n\n/** Details attached to the tool result for UI display */\nexport interface TaskToolDetails {\n\tprofile: string;\n\tdescription: string;\n\toutputLength: number;\n\tcwd: string;\n\tagent?: string;\n\tlockKey?: string;\n\trunId?: string;\n\ttaskId?: string;\n\tmodel?: string;\n\tsubagentSessionId?: string;\n\ttranscriptPath?: string;\n\tisolation?: \"none\" | \"worktree\";\n\tworktreePath?: string;\n\twaitMs?: number;\n\tbackground?: boolean;\n\tbackgroundStatusPath?: string;\n\ttoolCallsStarted?: number;\n\ttoolCallsCompleted?: number;\n\tassistantMessages?: number;\n\tdelegatedTasks?: number;\n\tdelegatedSucceeded?: number;\n\tdelegatedFailed?: number;\n}\n\nexport interface TaskToolOptions {\n\tresolveCustomSubagent?: (name: string) => CustomSubagentDefinition | undefined;\n\tavailableCustomSubagents?: string[];\n\tavailableCustomSubagentHints?: Array<{ name: string; description: string }>;\n\t/** Returns pending live meta updates entered during an active run. */\n\tgetMetaMessages?: () => readonly string[];\n}\n\n/** Tool names available per profile */\nconst toolsByProfile: Record<string, string[]> = {\n\texplore: [\"read\", \"grep\", \"find\", \"ls\"],\n\tplan: [\"read\", \"bash\", \"grep\", \"find\", \"ls\"],\n\tiosm: [\"read\", \"bash\", \"edit\", \"write\", \"grep\", \"find\", \"ls\"],\n\tiosm_analyst: [\"read\", \"bash\", \"grep\", \"find\", \"ls\"],\n\tiosm_verifier: [\"read\", \"bash\", \"write\"],\n\tcycle_planner: [\"read\", \"bash\", \"write\"],\n\tfull: [\"read\", \"bash\", \"edit\", \"write\", \"grep\", \"find\", \"ls\"],\n};\n\n/** System prompt injected per profile */\nconst systemPromptByProfile: Record<string, string> = {\n\texplore:\n\t\t\"You are a fast read-only codebase explorer. Answer concisely. Never write or edit files.\",\n\tplan: \"You are a technical architect. Analyze the codebase and produce a clear implementation plan. Do not write or edit files.\",\n\tiosm: \"You are an IOSM execution agent. Use IOSM methodology and keep IOSM artifacts synchronized with implementation.\",\n\tiosm_analyst:\n\t\t\"You are an IOSM metrics analyst. Analyze .iosm/ artifacts and codebase metrics. Be precise and evidence-based.\",\n\tiosm_verifier:\n\t\t\"You are an IOSM verifier. Validate checks and update only required IOSM artifacts with deterministic reasoning.\",\n\tcycle_planner:\n\t\t\"You are an IOSM cycle planner. Propose and align cycle goals with measurable outcomes and concrete risks.\",\n\tfull: \"You are a software engineering agent. Execute the task end-to-end.\",\n};\n\nconst writeCapableProfiles = new Set([\"full\", \"iosm_verifier\", \"cycle_planner\"]);\nconst delegationTagName = \"delegate_task\";\n\ntype DelegationRequest = {\n\tdescription: string;\n\tprofile: string;\n\tprompt: string;\n\tcwd?: string;\n\tlockKey?: string;\n\tmodel?: string;\n\tisolation?: \"none\" | \"worktree\";\n\tdependsOn?: number[];\n};\n\ntype ParsedDelegationRequests = {\n\tcleanedOutput: string;\n\trequests: DelegationRequest[];\n\twarnings: string[];\n};\n\nclass Semaphore {\n\tprivate active = 0;\n\tprivate readonly queue: Array<() => void> = [];\n\n\tconstructor(private readonly limit: number) {}\n\n\tasync acquire(): Promise<() => void> {\n\t\tif (this.active < this.limit) {\n\t\t\tthis.active += 1;\n\t\t\treturn () => this.release();\n\t\t}\n\n\t\tawait new Promise<void>((resolve) => {\n\t\t\tthis.queue.push(() => {\n\t\t\t\tthis.active += 1;\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\n\t\treturn () => this.release();\n\t}\n\n\tprivate release(): void {\n\t\tthis.active = Math.max(0, this.active - 1);\n\t\tconst next = this.queue.shift();\n\t\tif (next) {\n\t\t\tnext();\n\t\t}\n\t}\n}\n\nclass Mutex {\n\tprivate locked = false;\n\tprivate readonly waiters: Array<() => void> = [];\n\n\tasync acquire(): Promise<() => void> {\n\t\tif (!this.locked) {\n\t\t\tthis.locked = true;\n\t\t\treturn () => this.release();\n\t\t}\n\n\t\tawait new Promise<void>((resolve) => this.waiters.push(resolve));\n\t\tthis.locked = true;\n\t\treturn () => this.release();\n\t}\n\n\tprivate release(): void {\n\t\tthis.locked = false;\n\t\tconst next = this.waiters.shift();\n\t\tif (next) {\n\t\t\tnext();\n\t\t}\n\t}\n}\n\nconst maxParallelFromEnv = Number.parseInt(process.env.IOSM_SUBAGENT_MAX_PARALLEL ?? \"4\", 10);\nconst subagentSemaphore = new Semaphore(\n\tNumber.isInteger(maxParallelFromEnv) && maxParallelFromEnv > 0 ? Math.min(maxParallelFromEnv, 20) : 4,\n);\nconst maxDelegationDepthFromEnv = parseBoundedInt(process.env.IOSM_SUBAGENT_MAX_DELEGATION_DEPTH, 1, 0, 3);\nconst maxDelegationsPerTaskFromEnv = parseBoundedInt(\n\tprocess.env.IOSM_SUBAGENT_MAX_DELEGATIONS_PER_TASK,\n\t2,\n\t0,\n\t10,\n);\nconst maxDelegatedParallelFromEnv = parseBoundedInt(process.env.IOSM_SUBAGENT_MAX_DELEGATE_PARALLEL, 4, 1, 10);\nconst maxDelegatedOutputCharsFromEnv = parseBoundedInt(process.env.IOSM_SUBAGENT_DELEGATED_OUTPUT_MAX_CHARS, 6000, 500, 20_000);\nconst maxMetaUpdatesPerCheckpoint = parseBoundedInt(process.env.IOSM_SUBAGENT_META_MAX_ITEMS, 5, 1, 20);\nconst maxMetaUpdateChars = parseBoundedInt(process.env.IOSM_SUBAGENT_META_MAX_CHARS, 600, 100, 4000);\nconst orchestrationSemaphores = new Map<string, Semaphore>();\nconst cwdWriteLocks = new Map<string, Mutex>();\n\nfunction parseBoundedInt(raw: string | undefined, fallback: number, min: number, max: number): number {\n\tconst parsed = raw ? Number.parseInt(raw, 10) : fallback;\n\tif (!Number.isInteger(parsed)) return fallback;\n\treturn Math.max(min, Math.min(max, parsed));\n}\n\nfunction normalizeSpacing(text: string): string {\n\treturn text.replace(/[ \\t]+\\n/g, \"\\n\").replace(/\\n{3,}/g, \"\\n\\n\").trim();\n}\n\nfunction cloneDelegateItems(items: TaskDelegateProgressItem[] | undefined): TaskDelegateProgressItem[] | undefined {\n\treturn items ? items.map((item) => ({ ...item })) : undefined;\n}\n\nfunction formatMetaCheckpoint(metaMessages: readonly string[] | undefined): {\n\tsection: string | undefined;\n\tappliedCount: number;\n} {\n\tif (!metaMessages || metaMessages.length === 0) {\n\t\treturn { section: undefined, appliedCount: 0 };\n\t}\n\tconst normalized = metaMessages\n\t\t.map((item) => item.replace(/\\s+/g, \" \").trim())\n\t\t.filter((item) => item.length > 0)\n\t\t.slice(-maxMetaUpdatesPerCheckpoint)\n\t\t.map((item) => (item.length > maxMetaUpdateChars ? `${item.slice(0, maxMetaUpdateChars - 3)}...` : item));\n\n\tif (normalized.length === 0) {\n\t\treturn { section: undefined, appliedCount: 0 };\n\t}\n\n\tconst lines = normalized.map((item, index) => `${index + 1}. ${item}`).join(\"\\n\");\n\treturn {\n\t\tsection: [\n\t\t\t\"[META_UPDATES]\",\n\t\t\t\"Live user updates captured during execution. Apply them in this subtask if relevant.\",\n\t\t\t\"If conflicts exist, prioritize later items.\",\n\t\t\tlines,\n\t\t\t\"[/META_UPDATES]\",\n\t\t].join(\"\\n\"),\n\t\tappliedCount: normalized.length,\n\t};\n}\n\nfunction isAbortError(error: unknown): boolean {\n\tif (error instanceof Error) {\n\t\treturn /aborted/i.test(error.message);\n\t}\n\tif (typeof error === \"string\") {\n\t\treturn /aborted/i.test(error);\n\t}\n\treturn false;\n}\n\nfunction buildDelegationProtocolPrompt(depthRemaining: number): string {\n\tif (depthRemaining <= 0) {\n\t\treturn [\n\t\t\t`Delegation protocol: depth limit reached.`,\n\t\t\t`Do not emit <${delegationTagName}> blocks.`,\n\t\t].join(\"\\n\");\n\t}\n\treturn [\n\t\t`Delegation protocol (optional): if you discover a concrete follow-up that is better done by a separate specialist, emit up to ${maxDelegationsPerTaskFromEnv} XML block(s):`,\n\t\t`<${delegationTagName} profile=\"explore|plan|iosm|iosm_analyst|iosm_verifier|cycle_planner|full\" description=\"short title\" cwd=\"optional relative path\" lock_key=\"optional lock key\" model=\"optional model override\" isolation=\"none|worktree\" depends_on=\"optional indices like 1|3\">`,\n\t\t\"Detailed delegated task prompt\",\n\t\t`</${delegationTagName}>`,\n\t\t`Only emit blocks when necessary. Keep normal analysis/answer text outside those blocks.`,\n\t].join(\"\\n\");\n}\n\nfunction withDelegationPrompt(basePrompt: string, depthRemaining: number): string {\n\tconst protocol = buildDelegationProtocolPrompt(depthRemaining);\n\treturn `${basePrompt}\\n\\n${protocol}`;\n}\n\nfunction parseDelegationRequests(output: string, maxRequests: number): ParsedDelegationRequests {\n\tconst requests: DelegationRequest[] = [];\n\tconst warnings: string[] = [];\n\tconst pattern = new RegExp(`<${delegationTagName}\\\\b([^>]*)>([\\\\s\\\\S]*?)<\\\\/${delegationTagName}>`, \"gi\");\n\n\tconst cleaned = output.replace(pattern, (_full, attrsRaw: string, bodyRaw: string) => {\n\t\tif (maxRequests <= 0) {\n\t\t\twarnings.push(`Ignored delegation block: max delegated tasks per run is 0.`);\n\t\t\treturn \"\";\n\t\t}\n\t\tif (requests.length >= maxRequests) {\n\t\t\twarnings.push(`Ignored extra delegation block: max ${maxRequests} per run.`);\n\t\t\treturn \"\";\n\t\t}\n\t\tconst attrs: Record<string, string> = {};\n\t\tfor (const match of attrsRaw.matchAll(/([A-Za-z_][A-Za-z0-9_-]*)=\"([^\"]*)\"/g)) {\n\t\t\tattrs[match[1].toLowerCase()] = match[2];\n\t\t}\n\n\t\tconst prompt = normalizeSpacing(bodyRaw ?? \"\");\n\t\tif (!prompt) {\n\t\t\twarnings.push(`Ignored delegation block with empty prompt.`);\n\t\t\treturn \"\";\n\t\t}\n\t\tconst profile = (attrs.profile ?? \"explore\").trim();\n\t\tif (!(profile in toolsByProfile)) {\n\t\t\twarnings.push(`Ignored delegation block with unknown profile \"${profile}\".`);\n\t\t\treturn \"\";\n\t\t}\n\t\tconst isolationRaw = (attrs.isolation ?? \"\").trim().toLowerCase();\n\t\tconst isolation =\n\t\t\tisolationRaw === \"worktree\" ? \"worktree\" : isolationRaw === \"none\" ? \"none\" : undefined;\n\t\tif (isolationRaw && !isolation) {\n\t\t\twarnings.push(`Ignored invalid isolation value \"${attrs.isolation}\".`);\n\t\t\treturn \"\";\n\t\t}\n\n\t\trequests.push({\n\t\t\tdescription: (attrs.description ?? `delegated task ${requests.length + 1}`).trim(),\n\t\t\tprofile,\n\t\t\tprompt,\n\t\t\tcwd: attrs.cwd?.trim() || undefined,\n\t\t\tlockKey: attrs.lock_key?.trim() || undefined,\n\t\t\tmodel: attrs.model?.trim() || undefined,\n\t\t\tisolation,\n\t\t\tdependsOn: attrs.depends_on\n\t\t\t\t? attrs.depends_on\n\t\t\t\t\t\t.split(/[|,]/)\n\t\t\t\t\t\t.map((token) => Number.parseInt(token.trim(), 10))\n\t\t\t\t\t\t.filter((value) => Number.isInteger(value) && value > 0)\n\t\t\t\t: undefined,\n\t\t});\n\t\treturn \"\";\n\t});\n\n\treturn {\n\t\trequests,\n\t\twarnings,\n\t\tcleanedOutput: normalizeSpacing(cleaned),\n\t};\n}\n\nfunction getCwdLockKey(cwd: string): string {\n\t// Normalize lock key to keep behavior consistent across path aliases.\n\treturn path.resolve(cwd).toLowerCase();\n}\n\nfunction getOrCreateWriteLock(cwd: string): Mutex {\n\tconst key = getCwdLockKey(cwd);\n\tconst existing = cwdWriteLocks.get(key);\n\tif (existing) return existing;\n\tconst created = new Mutex();\n\tcwdWriteLocks.set(key, created);\n\treturn created;\n}\n\nfunction getRunParallelLimit(cwd: string, runId: string): number | undefined {\n\tconst teamRun = getTeamRun(cwd, runId);\n\tif (!teamRun) return undefined;\n\tif (teamRun.mode === \"sequential\") return 1;\n\tconst maxParallel = teamRun.maxParallel;\n\tif (!Number.isInteger(maxParallel) || !maxParallel || maxParallel < 1) {\n\t\treturn Math.max(1, Math.min(teamRun.agents, 20));\n\t}\n\treturn Math.max(1, Math.min(maxParallel, 20));\n}\n\nfunction getOrCreateOrchestrationSemaphore(cwd: string, runId: string): Semaphore | undefined {\n\tconst limit = getRunParallelLimit(cwd, runId);\n\tif (!limit || limit < 1) return undefined;\n\tconst key = `${path.resolve(cwd).toLowerCase()}::${runId}::${limit}`;\n\tconst existing = orchestrationSemaphores.get(key);\n\tif (existing) return existing;\n\tconst created = new Semaphore(limit);\n\torchestrationSemaphores.set(key, created);\n\treturn created;\n}\n\nfunction persistSubagentTranscript(input: {\n\trootCwd: string;\n\trunId: string;\n\tdescription: string;\n\tprofile: string;\n\tagent?: string;\n\tlockKey?: string;\n\tmodel?: string;\n\tsubagentCwd: string;\n\tsessionId?: string;\n\tprompt: string;\n\toutput: string;\n\tisolation?: \"none\" | \"worktree\";\n\tworktreePath?: string;\n}): string | undefined {\n\ttry {\n\t\tconst dir = path.join(input.rootCwd, \".iosm\", \"subagents\", \"runs\");\n\t\tmkdirSync(dir, { recursive: true });\n\t\tconst filePath = path.join(dir, `${input.runId}.md`);\n\t\tconst lines = [\n\t\t\t\"---\",\n\t\t\t`run_id: ${input.runId}`,\n\t\t\t`profile: ${input.profile}`,\n\t\t\t`description: ${JSON.stringify(input.description)}`,\n\t\t\t`cwd: ${JSON.stringify(input.subagentCwd)}`,\n\t\t\t`agent: ${JSON.stringify(input.agent ?? \"\")}`,\n\t\t\t`lock_key: ${JSON.stringify(input.lockKey ?? \"\")}`,\n\t\t\t`model: ${JSON.stringify(input.model ?? \"\")}`,\n\t\t\t`session_id: ${JSON.stringify(input.sessionId ?? \"\")}`,\n\t\t\t`isolation: ${JSON.stringify(input.isolation ?? \"none\")}`,\n\t\t\t`worktree_path: ${JSON.stringify(input.worktreePath ?? \"\")}`,\n\t\t\t`created_at: ${new Date().toISOString()}`,\n\t\t\t\"---\",\n\t\t\t\"\",\n\t\t\t\"## Prompt\",\n\t\t\t\"\",\n\t\t\tinput.prompt,\n\t\t\t\"\",\n\t\t\t\"## Output\",\n\t\t\t\"\",\n\t\t\tinput.output,\n\t\t\t\"\",\n\t\t];\n\t\twriteFileSync(filePath, lines.join(\"\\n\"), \"utf8\");\n\t\treturn filePath;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\ntype BackgroundRunStatus = {\n\trunId: string;\n\tstatus: \"queued\" | \"running\" | \"done\" | \"error\";\n\tcreatedAt: string;\n\tstartedAt?: string;\n\tfinishedAt?: string;\n\tdescription: string;\n\tprofile: string;\n\tcwd: string;\n\tagent?: string;\n\tmodel?: string;\n\terror?: string;\n\ttranscriptPath?: string;\n};\n\nfunction writeBackgroundRunStatus(rootCwd: string, status: BackgroundRunStatus): string | undefined {\n\ttry {\n\t\tconst dir = path.join(rootCwd, \".iosm\", \"subagents\", \"background\");\n\t\tmkdirSync(dir, { recursive: true });\n\t\tconst filePath = path.join(dir, `${status.runId}.json`);\n\t\twriteFileSync(filePath, `${JSON.stringify(status, null, 2)}\\n`, \"utf8\");\n\t\treturn filePath;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction gitResult(args: string[], cwd: string): { ok: boolean; stdout: string } {\n\tconst result = spawnSync(\"git\", args, {\n\t\tcwd,\n\t\tencoding: \"utf8\",\n\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t});\n\treturn {\n\t\tok: result.status === 0,\n\t\tstdout: (result.stdout ?? \"\").trim(),\n\t};\n}\n\nfunction provisionWorktree(\n\trootCwd: string,\n\ttargetCwd: string,\n\trunId: string,\n): { runCwd: string; worktreePath?: string; cleanup: () => void } {\n\tconst insideRepo = gitResult([\"rev-parse\", \"--is-inside-work-tree\"], rootCwd);\n\tif (!insideRepo.ok || insideRepo.stdout !== \"true\") {\n\t\treturn { runCwd: targetCwd, cleanup: () => {} };\n\t}\n\tconst repoRootResult = gitResult([\"rev-parse\", \"--show-toplevel\"], rootCwd);\n\tif (!repoRootResult.ok || !repoRootResult.stdout) {\n\t\treturn { runCwd: targetCwd, cleanup: () => {} };\n\t}\n\n\tconst repoRoot = repoRootResult.stdout;\n\tconst relative = path.relative(repoRoot, targetCwd);\n\tif (relative.startsWith(\"..\")) {\n\t\treturn { runCwd: targetCwd, cleanup: () => {} };\n\t}\n\n\tconst worktreePath = path.join(rootCwd, \".iosm\", \"subagents\", \"worktrees\", runId);\n\tmkdirSync(path.dirname(worktreePath), { recursive: true });\n\tconst added = gitResult([\"worktree\", \"add\", \"--detach\", worktreePath], repoRoot);\n\tif (!added.ok) {\n\t\treturn { runCwd: targetCwd, cleanup: () => {} };\n\t}\n\n\tconst runCwd = path.resolve(worktreePath, relative);\n\tconst cleanup = (): void => {\n\t\ttry {\n\t\t\tgitResult([\"worktree\", \"remove\", \"--force\", worktreePath], repoRoot);\n\t\t} catch {\n\t\t\t// best effort\n\t\t}\n\t\ttry {\n\t\t\trmSync(worktreePath, { recursive: true, force: true });\n\t\t} catch {\n\t\t\t// best effort\n\t\t}\n\t};\n\n\treturn { runCwd, worktreePath, cleanup };\n}\n\n/**\n * Create the Task tool using the factory pattern.\n *\n * The `runner` callback is supplied by sdk.ts to avoid a circular import:\n * sdk.ts → task.ts (tool) would otherwise import sdk.ts again.\n *\n * @param cwd Working directory forwarded to the subagent.\n * @param runner Callback that creates and runs a sub-session.\n */\nexport function createTaskTool(\n\tcwd: string,\n\trunner: SubagentRunner,\n\toptions?: TaskToolOptions,\n): AgentTool<typeof taskSchema> {\n\tconst customAgentsSnippet =\n\t\toptions?.availableCustomSubagentHints && options.availableCustomSubagentHints.length > 0\n\t\t\t? ` Available custom agents: ${options.availableCustomSubagentHints\n\t\t\t\t\t.map((item) => `${item.name} (${item.description})`)\n\t\t\t\t\t.join(\", \")}.`\n\t\t\t: options?.availableCustomSubagents && options.availableCustomSubagents.length > 0\n\t\t\t\t? ` Available custom agents: ${options.availableCustomSubagents.join(\", \")}.`\n\t\t\t: \"\";\n\treturn {\n\t\tname: \"task\",\n\t\tlabel: \"task\",\n\t\tdescription:\n\t\t\t\"Launch a specialized subagent to handle a subtask in isolation. \" +\n\t\t\t\"Use for: codebase exploration (profile=explore), architectural planning (profile=plan), \" +\n\t\t\t\"IOSM artifact analysis (profile=iosm_analyst/iosm_verifier/cycle_planner), or end-to-end implementation (profile=full). \" +\n\t\t\t\"Set cwd to isolate subagents into different project areas when orchestrating parallel work. \" +\n\t\t\t\"The subagent runs to completion and returns its full text output. \" +\n\t\t\t\"It may request bounded follow-up delegation via <delegate_task> blocks that are executed by the parent task tool.\" +\n\t\t\tcustomAgentsSnippet,\n\t\tparameters: taskSchema,\n\t\texecute: async (\n\t\t\t_toolCallId: string,\n\t\t\t{\n\t\t\t\tdescription,\n\t\t\t\tprompt,\n\t\t\t\tagent: agentName,\n\t\t\t\tprofile,\n\t\t\t\tcwd: targetCwd,\n\t\t\t\tlock_key: lockKey,\n\t\t\t\trun_id: orchestrationRunId,\n\t\t\t\ttask_id: orchestrationTaskId,\n\t\t\t\tmodel: requestedModel,\n\t\t\t\tbackground,\n\t\t\t\tisolation,\n\t\t\t}: TaskToolInput,\n\t\t\t_signal?: AbortSignal,\n\t\t\tonUpdate?,\n\t\t) => {\n\t\t\tconst throwIfAborted = (): void => {\n\t\t\t\tif (_signal?.aborted) {\n\t\t\t\t\tthrow new Error(\"Operation aborted\");\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst runId = `subagent_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;\n\t\t\tconst customSubagent =\n\t\t\t\tagentName && options?.resolveCustomSubagent ? options.resolveCustomSubagent(agentName) : undefined;\n\t\t\tif (agentName && !customSubagent) {\n\t\t\t\tconst available =\n\t\t\t\t\toptions?.availableCustomSubagents && options.availableCustomSubagents.length > 0\n\t\t\t\t\t\t? ` Available custom agents: ${options.availableCustomSubagents.join(\", \")}.`\n\t\t\t\t\t\t: \"\";\n\t\t\t\tthrow new Error(`Unknown subagent: ${agentName}.${available}`);\n\t\t\t}\n\n\t\t\tconst effectiveProfile = customSubagent?.profile ?? profile;\n\t\t\tlet tools = customSubagent?.tools\n\t\t\t\t? [...customSubagent.tools]\n\t\t\t\t: [...(toolsByProfile[effectiveProfile] ?? toolsByProfile.explore)];\n\t\t\tif (customSubagent?.disallowedTools?.length) {\n\t\t\t\tconst blocked = new Set(customSubagent.disallowedTools);\n\t\t\t\ttools = tools.filter((tool) => !blocked.has(tool));\n\t\t\t}\n\t\t\tconst delegationDepth = maxDelegationDepthFromEnv;\n\t\t\tconst baseSystemPrompt =\n\t\t\t\tcustomSubagent?.systemPrompt ??\n\t\t\t\tsystemPromptByProfile[effectiveProfile] ??\n\t\t\t\tsystemPromptByProfile.full;\n\t\t\tconst systemPrompt = withDelegationPrompt(baseSystemPrompt, delegationDepth);\n\t\t\tconst promptWithInstructions =\n\t\t\t\tcustomSubagent?.instructions && customSubagent.instructions.trim().length > 0\n\t\t\t\t\t? `${customSubagent.instructions.trim()}\\n\\nUser task:\\n${prompt}`\n\t\t\t\t\t: prompt;\n\t\t\tconst effectiveModelOverride = requestedModel?.trim() || customSubagent?.model?.trim() || undefined;\n\t\t\tconst requestedBackground = background === true || customSubagent?.background === true;\n\t\t\tconst trackedOrchestrationRun =\n\t\t\t\torchestrationRunId && orchestrationTaskId ? getTeamRun(cwd, orchestrationRunId) : undefined;\n\t\t\t// Deterministic orchestration UX: run tracked team tasks in foreground so the parent turn\n\t\t\t// naturally waits for subagents and aggregates their outputs without ad-hoc polling.\n\t\t\tconst runInBackground = trackedOrchestrationRun ? false : requestedBackground;\n\t\t\tconst requestedSubagentCwd = targetCwd\n\t\t\t\t? path.resolve(cwd, targetCwd)\n\t\t\t\t: customSubagent?.cwd ?? cwd;\n\t\t\tif (!existsSync(requestedSubagentCwd) || !statSync(requestedSubagentCwd).isDirectory()) {\n\t\t\t\tthrow new Error(`Subagent cwd does not exist or is not a directory: ${requestedSubagentCwd}`);\n\t\t\t}\n\t\t\tif (runInBackground && writeCapableProfiles.has(effectiveProfile)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Background policy violation: profile \"${effectiveProfile}\" is write-capable. Use explore/plan/iosm_analyst for background mode.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst useWorktree = isolation === \"worktree\";\n\n\t\t\tconst queuedAt = Date.now();\n\t\t\tlet latestProgress: TaskToolProgress | undefined;\n\t\t\tconst emitProgress = (incoming: TaskToolProgress): void => {\n\t\t\t\tconst activeTool = \"activeTool\" in incoming ? incoming.activeTool : latestProgress?.activeTool;\n\t\t\t\tconst delegateIndex = \"delegateIndex\" in incoming ? incoming.delegateIndex : latestProgress?.delegateIndex;\n\t\t\t\tconst delegateTotal = \"delegateTotal\" in incoming ? incoming.delegateTotal : latestProgress?.delegateTotal;\n\t\t\t\tconst delegateDescription =\n\t\t\t\t\t\"delegateDescription\" in incoming ? incoming.delegateDescription : latestProgress?.delegateDescription;\n\t\t\t\tconst delegateProfile =\n\t\t\t\t\t\"delegateProfile\" in incoming ? incoming.delegateProfile : latestProgress?.delegateProfile;\n\t\t\t\tconst delegateItems =\n\t\t\t\t\t\"delegateItems\" in incoming\n\t\t\t\t\t\t? cloneDelegateItems(incoming.delegateItems)\n\t\t\t\t\t\t: cloneDelegateItems(latestProgress?.delegateItems);\n\t\t\t\tconst merged: TaskToolProgress = {\n\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\tphase: incoming.phase,\n\t\t\t\t\tmessage: incoming.message,\n\t\t\t\t\tcwd: incoming.cwd ?? latestProgress?.cwd ?? requestedSubagentCwd,\n\t\t\t\t\tactiveTool,\n\t\t\t\t\ttoolCallsStarted: incoming.toolCallsStarted ?? latestProgress?.toolCallsStarted,\n\t\t\t\t\ttoolCallsCompleted: incoming.toolCallsCompleted ?? latestProgress?.toolCallsCompleted,\n\t\t\t\t\tassistantMessages: incoming.assistantMessages ?? latestProgress?.assistantMessages,\n\t\t\t\t\tdelegateIndex,\n\t\t\t\t\tdelegateTotal,\n\t\t\t\t\tdelegateDescription,\n\t\t\t\t\tdelegateProfile,\n\t\t\t\t\tdelegateItems,\n\t\t\t\t};\n\t\t\t\tlatestProgress = merged;\n\t\t\t\tif (!onUpdate) return;\n\t\t\t\tonUpdate({\n\t\t\t\t\tcontent: [{ type: \"text\" as const, text: merged.message }],\n\t\t\t\t\tdetails: { progress: merged },\n\t\t\t\t});\n\t\t\t};\n\t\t\tthrowIfAborted();\n\t\t\temitProgress({\n\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\tphase: \"queued\",\n\t\t\t\tmessage: \"queued\",\n\t\t\t\tcwd: requestedSubagentCwd,\n\t\t\t\ttoolCallsStarted: 0,\n\t\t\t\ttoolCallsCompleted: 0,\n\t\t\t\tassistantMessages: 0,\n\t\t\t});\n\n\t\t\tconst executeSubagent = async (): Promise<{ text: string; details: TaskToolDetails }> => {\n\t\t\t\tlet releaseRunSlot: (() => void) | undefined;\n\t\t\t\tlet releaseSlot: (() => void) | undefined;\n\t\t\t\tlet releaseWriteLock: (() => void) | undefined;\n\t\t\t\tlet releaseIsolation: (() => void) | undefined;\n\t\t\t\tlet subagentCwd = requestedSubagentCwd;\n\t\t\t\tlet worktreePath: string | undefined;\n\t\t\t\tlet runStats: SubagentRunResult[\"stats\"] | undefined;\n\t\t\t\ttry {\n\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\tconst orchestrationSemaphore =\n\t\t\t\t\t\torchestrationRunId && orchestrationTaskId\n\t\t\t\t\t\t\t? getOrCreateOrchestrationSemaphore(cwd, orchestrationRunId)\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\tif (orchestrationSemaphore) {\n\t\t\t\t\t\treleaseRunSlot = await orchestrationSemaphore.acquire();\n\t\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\t}\n\t\t\t\t\treleaseSlot = await subagentSemaphore.acquire();\n\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\tif (orchestrationRunId && orchestrationTaskId) {\n\t\t\t\t\t\tupdateTeamTaskStatus({\n\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\trunId: orchestrationRunId,\n\t\t\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\t\t\tstatus: \"running\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (writeCapableProfiles.has(effectiveProfile)) {\n\t\t\t\t\t\tconst explicitLockKey = lockKey?.trim();\n\t\t\t\t\t\t// Parallel orchestration should remain truly parallel by default.\n\t\t\t\t\t\t// Serialize write-capable agents only when an explicit lock_key is provided.\n\t\t\t\t\t\tif (explicitLockKey) {\n\t\t\t\t\t\t\tconst lock = getOrCreateWriteLock(explicitLockKey);\n\t\t\t\t\t\t\treleaseWriteLock = await lock.acquire();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (useWorktree) {\n\t\t\t\t\t\tconst isolated = provisionWorktree(cwd, requestedSubagentCwd, runId);\n\t\t\t\t\t\tsubagentCwd = isolated.runCwd;\n\t\t\t\t\t\tworktreePath = isolated.worktreePath;\n\t\t\t\t\t\treleaseIsolation = isolated.cleanup;\n\t\t\t\t\t}\n\t\t\t\t\temitProgress({\n\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\tphase: \"starting\",\n\t\t\t\t\t\tmessage: \"starting subagent\",\n\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t});\n\n\t\t\t\t\tlet output: string;\n\t\t\t\t\tlet subagentSessionId: string | undefined;\n\t\t\t\t\tlet delegatedTasks = 0;\n\t\t\t\t\tlet delegatedSucceeded = 0;\n\t\t\t\t\tlet delegatedFailed = 0;\n\t\t\t\t\tconst delegationWarnings: string[] = [];\n\t\t\t\t\tconst delegatedSections: Array<string | undefined> = [];\n\t\t\t\t\tconst delegatedStats = {\n\t\t\t\t\t\ttoolCallsStarted: 0,\n\t\t\t\t\t\ttoolCallsCompleted: 0,\n\t\t\t\t\t\tassistantMessages: 0,\n\t\t\t\t\t};\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst rootMeta = formatMetaCheckpoint(options?.getMetaMessages?.());\n\t\t\t\t\t\tconst rootPrompt =\n\t\t\t\t\t\t\trootMeta.section && rootMeta.appliedCount > 0\n\t\t\t\t\t\t\t\t? `${promptWithInstructions}\\n\\n${rootMeta.section}`\n\t\t\t\t\t\t\t\t: promptWithInstructions;\n\t\t\t\t\t\tif (rootMeta.appliedCount > 0) {\n\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\tmessage: `applied ${rootMeta.appliedCount} meta update(s) to root task`,\n\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst result = await runner({\n\t\t\t\t\t\t\tsystemPrompt,\n\t\t\t\t\t\t\ttools,\n\t\t\t\t\t\t\tprompt: rootPrompt,\n\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\tmodelOverride: effectiveModelOverride,\n\t\t\t\t\t\t\tsignal: _signal,\n\t\t\t\t\t\t\tonProgress: (progress) => emitProgress(progress),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\t\tif (typeof result === \"string\") {\n\t\t\t\t\t\t\toutput = result;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\toutput = result.output;\n\t\t\t\t\t\t\tsubagentSessionId = result.sessionId;\n\t\t\t\t\t\t\trunStats = result.stats;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst parsedDelegation = parseDelegationRequests(\n\t\t\t\t\t\t\toutput,\n\t\t\t\t\t\t\tdelegationDepth > 0 ? maxDelegationsPerTaskFromEnv : 0,\n\t\t\t\t\t\t);\n\t\t\t\t\t\toutput = parsedDelegation.cleanedOutput;\n\t\t\t\t\t\tdelegationWarnings.push(...parsedDelegation.warnings);\n\t\t\t\t\t\tconst delegateTotal = parsedDelegation.requests.length;\n\t\t\t\t\t\tconst delegateItems: TaskDelegateProgressItem[] = parsedDelegation.requests.map((request, index) => ({\n\t\t\t\t\t\t\tindex: index + 1,\n\t\t\t\t\t\t\tdescription: request.description,\n\t\t\t\t\t\t\tprofile: request.profile,\n\t\t\t\t\t\t\tstatus: \"pending\",\n\t\t\t\t\t\t}));\n\t\t\t\t\t\tconst normalizedDependsOn: number[][] = parsedDelegation.requests.map((request, index) => {\n\t\t\t\t\t\t\tconst current = index + 1;\n\t\t\t\t\t\t\tconst raw = request.dependsOn ?? [];\n\t\t\t\t\t\t\tconst unique = new Set<number>();\n\t\t\t\t\t\t\tfor (const dep of raw) {\n\t\t\t\t\t\t\t\tif (!Number.isInteger(dep) || dep <= 0 || dep > delegateTotal || dep === current) {\n\t\t\t\t\t\t\t\t\tdelegationWarnings.push(\n\t\t\t\t\t\t\t\t\t\t`Delegated task ${current} has invalid depends_on reference \"${dep}\" and it was ignored.`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tunique.add(dep);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn Array.from(unique).sort((a, b) => a - b);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tdelegatedTasks += delegateTotal;\n\t\t\t\t\t\tif (delegateTotal > 0) {\n\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\tmessage: `delegation scheduler: ${delegateTotal} task(s), max parallel ${Math.min(delegateTotal, maxDelegatedParallelFromEnv)}`,\n\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst pendingIndices = new Set<number>(Array.from({ length: delegateTotal }, (_v, i) => i));\n\t\t\t\t\t\tconst runningDelegates = new Map<number, Promise<void>>();\n\t\t\t\t\t\tconst maxDelegateParallel = Math.max(1, Math.min(delegateTotal || 1, maxDelegatedParallelFromEnv));\n\n\t\t\t\t\t\tconst statusOf = (idx: number): TaskDelegateProgressStatus =>\n\t\t\t\t\t\t\tdelegateItems[idx]?.status ?? \"pending\";\n\n\t\t\t\t\t\tconst markDelegateFailed = (index: number, message: string, details?: string): void => {\n\t\t\t\t\t\t\tconst request = parsedDelegation.requests[index];\n\t\t\t\t\t\t\tif (delegateItems[index]) {\n\t\t\t\t\t\t\t\tdelegateItems[index].status = \"failed\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdelegatedFailed += 1;\n\t\t\t\t\t\t\tif (details) {\n\t\t\t\t\t\t\t\tdelegationWarnings.push(details);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdelegatedSections[index] =\n\t\t\t\t\t\t\t\t`#### ${index + 1}. ${request.description} (${request.profile})\\nERROR: ${message}`;\n\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\tdelegateIndex: index + 1,\n\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\tdelegateDescription: request.description,\n\t\t\t\t\t\t\t\tdelegateProfile: request.profile,\n\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst runDelegate = async (index: number): Promise<void> => {\n\t\t\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\t\t\tconst request = parsedDelegation.requests[index];\n\t\t\t\t\t\t\tconst childProfile = request.profile;\n\t\t\t\t\t\t\tif (delegateItems[index]) {\n\t\t\t\t\t\t\t\tdelegateItems[index].status = \"running\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\tmessage: `delegating ${index + 1}/${delegateTotal}: ${request.description}`,\n\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\tdelegateIndex: index + 1,\n\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\tdelegateDescription: request.description,\n\t\t\t\t\t\t\t\tdelegateProfile: childProfile,\n\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst childTools = [...(toolsByProfile[childProfile] ?? toolsByProfile.explore)];\n\t\t\t\t\t\t\tconst childBaseSystemPrompt =\n\t\t\t\t\t\t\t\tsystemPromptByProfile[childProfile] ?? systemPromptByProfile.full;\n\t\t\t\t\t\t\tconst childSystemPrompt = withDelegationPrompt(\n\t\t\t\t\t\t\t\tchildBaseSystemPrompt,\n\t\t\t\t\t\t\t\tMath.max(0, delegationDepth - 1),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst requestedChildCwd = request.cwd ? path.resolve(subagentCwd, request.cwd) : subagentCwd;\n\t\t\t\t\t\t\tif (!existsSync(requestedChildCwd) || !statSync(requestedChildCwd).isDirectory()) {\n\t\t\t\t\t\t\t\tmarkDelegateFailed(\n\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t`delegate ${index + 1}/${delegateTotal} skipped: missing cwd`,\n\t\t\t\t\t\t\t\t\t`Delegated task \"${request.description}\" skipped: cwd does not exist (${requestedChildCwd}).`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlet childReleaseLock: (() => void) | undefined;\n\t\t\t\t\t\t\tlet childReleaseIsolation: (() => void) | undefined;\n\t\t\t\t\t\t\tlet childCwd = requestedChildCwd;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\t\t\t\tconst explicitChildLock = request.lockKey?.trim();\n\t\t\t\t\t\t\t\tif (writeCapableProfiles.has(childProfile) && explicitChildLock) {\n\t\t\t\t\t\t\t\t\tconst lock = getOrCreateWriteLock(explicitChildLock);\n\t\t\t\t\t\t\t\t\tchildReleaseLock = await lock.acquire();\n\t\t\t\t\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (request.isolation === \"worktree\") {\n\t\t\t\t\t\t\t\t\tconst isolated = provisionWorktree(cwd, requestedChildCwd, `${runId}_delegate_${index + 1}`);\n\t\t\t\t\t\t\t\t\tchildCwd = isolated.runCwd;\n\t\t\t\t\t\t\t\t\tchildReleaseIsolation = isolated.cleanup;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst delegateMeta = formatMetaCheckpoint(options?.getMetaMessages?.());\n\t\t\t\t\t\t\t\tconst delegatePrompt =\n\t\t\t\t\t\t\t\t\tdelegateMeta.section && delegateMeta.appliedCount > 0\n\t\t\t\t\t\t\t\t\t\t? `${request.prompt}\\n\\n${delegateMeta.section}`\n\t\t\t\t\t\t\t\t\t\t: request.prompt;\n\t\t\t\t\t\t\t\tif (delegateMeta.appliedCount > 0) {\n\t\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\t\t\tmessage: `delegate ${index + 1}/${delegateTotal}: applied ${delegateMeta.appliedCount} meta update(s)`,\n\t\t\t\t\t\t\t\t\t\tcwd: childCwd,\n\t\t\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\t\t\tdelegateIndex: index + 1,\n\t\t\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\t\t\tdelegateDescription: request.description,\n\t\t\t\t\t\t\t\t\t\tdelegateProfile: childProfile,\n\t\t\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst childResult = await runner({\n\t\t\t\t\t\t\t\t\tsystemPrompt: childSystemPrompt,\n\t\t\t\t\t\t\t\t\ttools: childTools,\n\t\t\t\t\t\t\t\t\tprompt: delegatePrompt,\n\t\t\t\t\t\t\t\t\tcwd: childCwd,\n\t\t\t\t\t\t\t\t\tmodelOverride: request.model,\n\t\t\t\t\t\t\t\t\tsignal: _signal,\n\t\t\t\t\t\t\t\t\tonProgress: (progress) => {\n\t\t\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\t\t\t\tmessage: `delegate ${index + 1}/${delegateTotal}: ${progress.message}`,\n\t\t\t\t\t\t\t\t\t\t\tcwd: progress.cwd ?? childCwd,\n\t\t\t\t\t\t\t\t\t\t\tactiveTool: progress.activeTool,\n\t\t\t\t\t\t\t\t\t\t\tdelegateIndex: index + 1,\n\t\t\t\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\t\t\t\tdelegateDescription: request.description,\n\t\t\t\t\t\t\t\t\t\t\tdelegateProfile: childProfile,\n\t\t\t\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t\t\t\t});\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\tthrowIfAborted();\n\n\t\t\t\t\t\t\t\tlet childOutput: string;\n\t\t\t\t\t\t\t\tlet childStats: SubagentRunResult[\"stats\"] | undefined;\n\t\t\t\t\t\t\t\tif (typeof childResult === \"string\") {\n\t\t\t\t\t\t\t\t\tchildOutput = childResult;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tchildOutput = childResult.output;\n\t\t\t\t\t\t\t\t\tchildStats = childResult.stats;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst parsedChildDelegation = parseDelegationRequests(childOutput, 0);\n\t\t\t\t\t\t\t\tchildOutput = parsedChildDelegation.cleanedOutput;\n\t\t\t\t\t\t\t\tdelegationWarnings.push(\n\t\t\t\t\t\t\t\t\t...parsedChildDelegation.warnings.map((warning) => `Child ${index + 1}: ${warning}`),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tdelegatedSucceeded += 1;\n\t\t\t\t\t\t\t\tif (delegateItems[index]) {\n\t\t\t\t\t\t\t\t\tdelegateItems[index].status = \"done\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdelegatedStats.toolCallsStarted += childStats?.toolCallsStarted ?? 0;\n\t\t\t\t\t\t\t\tdelegatedStats.toolCallsCompleted += childStats?.toolCallsCompleted ?? 0;\n\t\t\t\t\t\t\t\tdelegatedStats.assistantMessages += childStats?.assistantMessages ?? 0;\n\t\t\t\t\t\t\t\tconst normalizedChildOutput = childOutput.trim().length > 0 ? childOutput.trim() : \"(no output)\";\n\t\t\t\t\t\t\t\tconst childOutputExcerpt =\n\t\t\t\t\t\t\t\t\tnormalizedChildOutput.length > maxDelegatedOutputCharsFromEnv\n\t\t\t\t\t\t\t\t\t\t? `${normalizedChildOutput.slice(0, Math.max(1, maxDelegatedOutputCharsFromEnv - 3))}...`\n\t\t\t\t\t\t\t\t\t\t: normalizedChildOutput;\n\t\t\t\t\t\t\t\tdelegatedSections[index] =\n\t\t\t\t\t\t\t\t\t`#### ${index + 1}. ${request.description} (${childProfile})\\n${childOutputExcerpt}`;\n\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\t\tmessage: `delegate ${index + 1}/${delegateTotal} done`,\n\t\t\t\t\t\t\t\t\tcwd: childCwd,\n\t\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\t\tdelegateIndex: index + 1,\n\t\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\t\tdelegateDescription: request.description,\n\t\t\t\t\t\t\t\t\tdelegateProfile: childProfile,\n\t\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\t\t\t\tif (_signal?.aborted || isAbortError(error)) {\n\t\t\t\t\t\t\t\t\tthrow new Error(\"Operation aborted\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmarkDelegateFailed(index, `delegate ${index + 1}/${delegateTotal} failed`, message);\n\t\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\t\tchildReleaseIsolation?.();\n\t\t\t\t\t\t\t\tchildReleaseLock?.();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst resolveBlockedByFailedDependencies = (): boolean => {\n\t\t\t\t\t\t\tlet changed = false;\n\t\t\t\t\t\t\tfor (const index of Array.from(pendingIndices)) {\n\t\t\t\t\t\t\t\tconst deps = normalizedDependsOn[index] ?? [];\n\t\t\t\t\t\t\t\tif (deps.length === 0) continue;\n\t\t\t\t\t\t\t\tconst failedDep = deps.find((dep) => statusOf(dep - 1) === \"failed\");\n\t\t\t\t\t\t\t\tif (!failedDep) continue;\n\t\t\t\t\t\t\t\tpendingIndices.delete(index);\n\t\t\t\t\t\t\t\tmarkDelegateFailed(\n\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t`delegate ${index + 1}/${delegateTotal} skipped: dependency ${failedDep} failed`,\n\t\t\t\t\t\t\t\t\t`Delegated task ${index + 1} skipped because dependency ${failedDep} failed.`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn changed;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst launchReadyDelegates = (): boolean => {\n\t\t\t\t\t\t\tlet launched = false;\n\t\t\t\t\t\t\twhile (runningDelegates.size < maxDelegateParallel) {\n\t\t\t\t\t\t\t\tlet nextIndex: number | undefined;\n\t\t\t\t\t\t\t\tfor (const index of pendingIndices) {\n\t\t\t\t\t\t\t\t\tconst deps = normalizedDependsOn[index] ?? [];\n\t\t\t\t\t\t\t\t\tconst allDone = deps.every((dep) => statusOf(dep - 1) === \"done\");\n\t\t\t\t\t\t\t\t\tif (allDone) {\n\t\t\t\t\t\t\t\t\t\tnextIndex = index;\n\t\t\t\t\t\t\t\t\t\tbreak;\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\tif (nextIndex === undefined) {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tpendingIndices.delete(nextIndex);\n\t\t\t\t\t\t\t\tconst promise = runDelegate(nextIndex).finally(() => {\n\t\t\t\t\t\t\t\t\trunningDelegates.delete(nextIndex);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\trunningDelegates.set(nextIndex, promise);\n\t\t\t\t\t\t\t\tlaunched = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn launched;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\twhile (pendingIndices.size > 0 || runningDelegates.size > 0) {\n\t\t\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\t\t\tconst changed = resolveBlockedByFailedDependencies();\n\t\t\t\t\t\t\tconst launched = launchReadyDelegates();\n\t\t\t\t\t\t\tif (runningDelegates.size === 0) {\n\t\t\t\t\t\t\t\tif (pendingIndices.size > 0 && !changed && !launched) {\n\t\t\t\t\t\t\t\t\tfor (const index of Array.from(pendingIndices)) {\n\t\t\t\t\t\t\t\t\t\tpendingIndices.delete(index);\n\t\t\t\t\t\t\t\t\t\tconst deps = normalizedDependsOn[index] ?? [];\n\t\t\t\t\t\t\t\t\t\tmarkDelegateFailed(\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t`delegate ${index + 1}/${delegateTotal} blocked: unresolved depends_on`,\n\t\t\t\t\t\t\t\t\t\t\t`Delegated task ${index + 1} blocked by unresolved dependencies: ${deps.join(\", \") || \"unknown\"}.`,\n\t\t\t\t\t\t\t\t\t\t);\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\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait Promise.race(Array.from(runningDelegates.values()));\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\tif (_signal?.aborted || isAbortError(error)) {\n\t\t\t\t\t\t\tthrow new Error(\"Operation aborted\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst details: TaskToolDetails = {\n\t\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\toutputLength: 0,\n\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\t\tlockKey: lockKey?.trim() || undefined,\n\t\t\t\t\t\t\trunId,\n\t\t\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\t\tisolation: useWorktree ? \"worktree\" : \"none\",\n\t\t\t\t\t\t\tworktreePath,\n\t\t\t\t\t\t\twaitMs: Date.now() - queuedAt,\n\t\t\t\t\t\t\tbackground: runInBackground,\n\t\t\t\t\t\t\ttoolCallsStarted: runStats?.toolCallsStarted ?? latestProgress?.toolCallsStarted,\n\t\t\t\t\t\t\ttoolCallsCompleted: runStats?.toolCallsCompleted ?? latestProgress?.toolCallsCompleted,\n\t\t\t\t\t\t\tassistantMessages: runStats?.assistantMessages ?? latestProgress?.assistantMessages,\n\t\t\t\t\t\t\tdelegatedTasks: delegatedTasks > 0 ? delegatedTasks : undefined,\n\t\t\t\t\t\t\tdelegatedSucceeded: delegatedTasks > 0 ? delegatedSucceeded : undefined,\n\t\t\t\t\t\t\tdelegatedFailed: delegatedTasks > 0 ? delegatedFailed : undefined,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (orchestrationRunId && orchestrationTaskId) {\n\t\t\t\t\t\t\tupdateTeamTaskStatus({\n\t\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\t\trunId: orchestrationRunId,\n\t\t\t\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow Object.assign(new Error(`Subagent failed: ${message}`), { details });\n\t\t\t\t\t}\n\n\t\t\t\t\tconst normalizedOutput = output.trim().length > 0 ? output.trim() : \"(Subagent completed with no output)\";\n\t\t\t\t\tconst finalSections: string[] = [normalizedOutput];\n\t\t\t\t\tif (delegatedTasks > 0) {\n\t\t\t\t\t\tconst header = `### Delegated Subtasks (${delegatedSucceeded}/${delegatedTasks} done)`;\n\t\t\t\t\t\tconst delegatedBlocks = delegatedSections.filter(\n\t\t\t\t\t\t\t(section): section is string => typeof section === \"string\" && section.trim().length > 0,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfinalSections.push([header, ...delegatedBlocks].join(\"\\n\\n\"));\n\t\t\t\t\t}\n\t\t\t\t\tif (delegationWarnings.length > 0) {\n\t\t\t\t\t\tfinalSections.push(`### Delegation Notes\\n${delegationWarnings.map((w) => `- ${w}`).join(\"\\n\")}`);\n\t\t\t\t\t}\n\t\t\t\t\tconst text = finalSections.join(\"\\n\\n\");\n\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\tphase: \"responding\",\n\t\t\t\t\t\t\tmessage: delegatedTasks > 0 ? \"aggregating delegated results\" : \"finalizing response\",\n\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\tdelegateIndex: undefined,\n\t\t\t\t\t\t\tdelegateTotal: undefined,\n\t\t\t\t\t\t\tdelegateDescription: undefined,\n\t\t\t\t\t\t\tdelegateProfile: undefined,\n\t\t\t\t\t\t\tdelegateItems: undefined,\n\t\t\t\t\t\t});\n\n\t\t\t\t\tconst transcriptPath = persistSubagentTranscript({\n\t\t\t\t\t\trootCwd: cwd,\n\t\t\t\t\t\trunId,\n\t\t\t\t\t\tdescription,\n\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\tlockKey: lockKey?.trim() || undefined,\n\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\tsubagentCwd,\n\t\t\t\t\t\tsessionId: subagentSessionId,\n\t\t\t\t\t\tprompt: promptWithInstructions,\n\t\t\t\t\t\toutput: text,\n\t\t\t\t\t\tisolation: useWorktree ? \"worktree\" : \"none\",\n\t\t\t\t\t\tworktreePath,\n\t\t\t\t\t});\n\t\t\t\t\tconst details: TaskToolDetails = {\n\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\tdescription,\n\t\t\t\t\t\toutputLength: text.length,\n\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\tlockKey: lockKey?.trim() || undefined,\n\t\t\t\t\t\trunId,\n\t\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\tsubagentSessionId,\n\t\t\t\t\t\ttranscriptPath,\n\t\t\t\t\t\tisolation: useWorktree ? \"worktree\" : \"none\",\n\t\t\t\t\t\tworktreePath,\n\t\t\t\t\t\twaitMs: Date.now() - queuedAt,\n\t\t\t\t\t\tbackground: runInBackground,\n\t\t\t\t\t\ttoolCallsStarted:\n\t\t\t\t\t\t\ttypeof (runStats?.toolCallsStarted ?? latestProgress?.toolCallsStarted) === \"number\"\n\t\t\t\t\t\t\t\t? (runStats?.toolCallsStarted ?? latestProgress?.toolCallsStarted ?? 0) +\n\t\t\t\t\t\t\t\t\tdelegatedStats.toolCallsStarted\n\t\t\t\t\t\t\t\t: delegatedStats.toolCallsStarted > 0\n\t\t\t\t\t\t\t\t\t? delegatedStats.toolCallsStarted\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\ttoolCallsCompleted:\n\t\t\t\t\t\t\ttypeof (runStats?.toolCallsCompleted ?? latestProgress?.toolCallsCompleted) === \"number\"\n\t\t\t\t\t\t\t\t? (runStats?.toolCallsCompleted ?? latestProgress?.toolCallsCompleted ?? 0) +\n\t\t\t\t\t\t\t\t\tdelegatedStats.toolCallsCompleted\n\t\t\t\t\t\t\t\t: delegatedStats.toolCallsCompleted > 0\n\t\t\t\t\t\t\t\t\t? delegatedStats.toolCallsCompleted\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tassistantMessages:\n\t\t\t\t\t\t\ttypeof (runStats?.assistantMessages ?? latestProgress?.assistantMessages) === \"number\"\n\t\t\t\t\t\t\t\t? (runStats?.assistantMessages ?? latestProgress?.assistantMessages ?? 0) +\n\t\t\t\t\t\t\t\t\tdelegatedStats.assistantMessages\n\t\t\t\t\t\t\t\t: delegatedStats.assistantMessages > 0\n\t\t\t\t\t\t\t\t\t? delegatedStats.assistantMessages\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tdelegatedTasks: delegatedTasks > 0 ? delegatedTasks : undefined,\n\t\t\t\t\t\tdelegatedSucceeded: delegatedTasks > 0 ? delegatedSucceeded : undefined,\n\t\t\t\t\t\tdelegatedFailed: delegatedTasks > 0 ? delegatedFailed : undefined,\n\t\t\t\t\t};\n\t\t\t\t\tif (orchestrationRunId && orchestrationTaskId) {\n\t\t\t\t\t\tupdateTeamTaskStatus({\n\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\trunId: orchestrationRunId,\n\t\t\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\t\t\tstatus: \"done\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\treturn { text, details };\n\t\t\t\t} finally {\n\t\t\t\t\treleaseIsolation?.();\n\t\t\t\t\treleaseWriteLock?.();\n\t\t\t\t\treleaseSlot?.();\n\t\t\t\t\treleaseRunSlot?.();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tif (runInBackground) {\n\t\t\t\tconst now = new Date().toISOString();\n\t\t\t\tconst queuedStatusPath = writeBackgroundRunStatus(cwd, {\n\t\t\t\t\trunId,\n\t\t\t\t\tstatus: \"queued\",\n\t\t\t\t\tcreatedAt: now,\n\t\t\t\t\tdescription,\n\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\tcwd: requestedSubagentCwd,\n\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t});\n\t\t\t\tvoid (async () => {\n\t\t\t\t\twriteBackgroundRunStatus(cwd, {\n\t\t\t\t\t\trunId,\n\t\t\t\t\t\tstatus: \"running\",\n\t\t\t\t\t\tcreatedAt: now,\n\t\t\t\t\t\tstartedAt: new Date().toISOString(),\n\t\t\t\t\t\tdescription,\n\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\tcwd: requestedSubagentCwd,\n\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t});\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await executeSubagent();\n\t\t\t\t\t\twriteBackgroundRunStatus(cwd, {\n\t\t\t\t\t\t\trunId,\n\t\t\t\t\t\t\tstatus: \"done\",\n\t\t\t\t\t\t\tcreatedAt: now,\n\t\t\t\t\t\t\tfinishedAt: new Date().toISOString(),\n\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\t\tcwd: result.details.cwd,\n\t\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\t\ttranscriptPath: result.details.transcriptPath,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\twriteBackgroundRunStatus(cwd, {\n\t\t\t\t\t\t\trunId,\n\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\tcreatedAt: now,\n\t\t\t\t\t\t\tfinishedAt: new Date().toISOString(),\n\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\t\tcwd: requestedSubagentCwd,\n\t\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\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: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `Started background subagent run ${runId}. Check .iosm/subagents/background and /subagent-runs for results.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\tdescription,\n\t\t\t\t\t\toutputLength: 0,\n\t\t\t\t\t\tcwd: requestedSubagentCwd,\n\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\tlockKey: lockKey?.trim() || undefined,\n\t\t\t\t\t\trunId,\n\t\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\tbackground: true,\n\t\t\t\t\t\tbackgroundStatusPath: queuedStatusPath,\n\t\t\t\t\t\twaitMs: Date.now() - queuedAt,\n\t\t\t\t\t\tisolation: useWorktree ? \"worktree\" : \"none\",\n\t\t\t\t\t\ttoolCallsStarted: latestProgress?.toolCallsStarted,\n\t\t\t\t\t\ttoolCallsCompleted: latestProgress?.toolCallsCompleted,\n\t\t\t\t\t\tassistantMessages: latestProgress?.assistantMessages,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst result = await executeSubagent();\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text: result.text }],\n\t\t\t\tdetails: result.details,\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"task.js","sourceRoot":"","sources":["../../../src/core/tools/task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjF,O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E,gBAAgB;wBACtC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ;wBAC7B,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM;wBAC5C,gBAAgB,EAAE,cAAc,EAAE,gBAAgB;wBAClD,kBAAkB,EAAE,cAAc,EAAE,kBAAkB;wBACtD,iBAAiB,EAAE,cAAc,EAAE,iBAAiB;qBACpD;iBACD,CAAC;YACH,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,eAAe,EAAE,CAAC;YACvC,OAAO;gBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;gBACvD,OAAO,EAAE,MAAM,CAAC,OAAO;aACvB,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { existsSync, mkdirSync, rmSync, statSync, writeFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport { spawnSync } from \"node:child_process\";\nimport type { AgentTool } from \"@mariozechner/pi-agent-core\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { getTeamRun, updateTeamTaskStatus } from \"../agent-teams.js\";\nimport {\n\tbuildRetrospectiveDirective,\n\tclassifyFailureCause,\n\tformatFailureCauseCounts,\n\tisRetrospectiveRetryable,\n\ttype FailureCause,\n} from \"../failure-retrospective.js\";\nimport type { SharedMemoryContext } from \"../shared-memory.js\";\nimport type { CustomSubagentDefinition } from \"../subagents.js\";\n\n/**\n * Callback type passed in from sdk.ts to avoid circular imports.\n * Spawns a sub-session and runs it to completion, returning the final text output.\n */\nexport type SubagentRunResult = {\n\toutput: string;\n\tsessionId?: string;\n\tstats?: {\n\t\ttoolCallsStarted: number;\n\t\ttoolCallsCompleted: number;\n\t\tassistantMessages: number;\n\t};\n};\n\nexport type TaskToolProgressPhase = \"queued\" | \"starting\" | \"running\" | \"responding\";\n\nexport type TaskDelegateProgressStatus = \"pending\" | \"running\" | \"done\" | \"failed\";\n\nexport interface TaskDelegateProgressItem {\n\tindex: number;\n\tdescription: string;\n\tprofile: string;\n\tstatus: TaskDelegateProgressStatus;\n}\n\nexport interface TaskToolProgress {\n\tkind: \"subagent_progress\";\n\tphase: TaskToolProgressPhase;\n\tmessage: string;\n\tcwd?: string;\n\tactiveTool?: string;\n\ttoolCallsStarted?: number;\n\ttoolCallsCompleted?: number;\n\tassistantMessages?: number;\n\tdelegateIndex?: number;\n\tdelegateTotal?: number;\n\tdelegateDescription?: string;\n\tdelegateProfile?: string;\n\tdelegateItems?: TaskDelegateProgressItem[];\n}\n\nexport type SubagentRunner = (options: {\n\tsystemPrompt: string;\n\ttools: string[];\n\tprompt: string;\n\tcwd: string;\n\tmodelOverride?: string;\n\tsharedMemoryContext?: SharedMemoryContext;\n\tsignal?: AbortSignal;\n\tonProgress?: (progress: TaskToolProgress) => void;\n}) => Promise<string | SubagentRunResult>;\n\nconst taskSchema = Type.Object({\n\tdescription: Type.String({\n\t\tdescription: \"Short 3-5 word description of what the subagent will do\",\n\t}),\n\tprompt: Type.String({\n\t\tdescription: \"Full task prompt for the subagent\",\n\t}),\n\tagent: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Optional custom subagent name loaded from .iosm/agents or global agents directory.\",\n\t\t}),\n\t),\n\tprofile: Type.String({\n\t\tdescription:\n\t\t\t\"Subagent capability profile. Recommended values: explore, plan, iosm, iosm_analyst, iosm_verifier, cycle_planner, full. For custom agents, pass the agent name via `agent`, not `profile`.\",\n\t}),\n\tcwd: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Optional working directory for this subagent. Relative paths are resolved from the current workspace.\",\n\t\t}),\n\t),\n\tlock_key: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Optional logical lock key for write serialization (e.g. src/api/**). Agents with the same lock key run write phases sequentially.\",\n\t\t}),\n\t),\n\trun_id: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Optional orchestration run id (from /orchestrate or /swarm). Use with task_id so the team board can track status. When omitted, task mode uses an internal run id for shared-memory collaboration within this task execution.\",\n\t\t}),\n\t),\n\ttask_id: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Optional orchestration task id (for example task_1). Use with run_id to update the team board. When omitted, task mode uses an internal task id so task-scoped shared memory still works.\",\n\t\t}),\n\t),\n\tmodel: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Optional model override for this subagent (for example anthropic/claude-sonnet-4 or model id).\",\n\t\t}),\n\t),\n\tbackground: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription:\n\t\t\t\t\"Run subagent in background and return immediately with run id. Use for detached async runs; orchestrated run_id/task_id calls execute foreground for deterministic coordination. Background mode is read-only policy by default.\",\n\t\t}),\n\t),\n\tisolation: Type.Optional(\n\t\tType.Union([Type.Literal(\"none\"), Type.Literal(\"worktree\")], {\n\t\t\tdescription:\n\t\t\t\t\"Optional isolation mode. Set to worktree to run this subagent in a temporary git worktree.\",\n\t\t}),\n\t),\n\tdelegate_parallel_hint: Type.Optional(\n\t\tType.Integer({\n\t\t\tminimum: 1,\n\t\t\tmaximum: 10,\n\t\t\tdescription:\n\t\t\t\t\"Optional hint for intra-task delegation fan-out. Higher value allows more delegated subtasks to run in parallel inside a single task execution.\",\n\t\t}),\n\t),\n});\n\nexport type TaskToolInput = Static<typeof taskSchema>;\n\n/** Details attached to the tool result for UI display */\nexport interface TaskToolDetails {\n\tprofile: string;\n\tdescription: string;\n\toutputLength: number;\n\tcwd: string;\n\tagent?: string;\n\tlockKey?: string;\n\trunId?: string;\n\ttaskId?: string;\n\tmodel?: string;\n\tsubagentSessionId?: string;\n\ttranscriptPath?: string;\n\tisolation?: \"none\" | \"worktree\";\n\tworktreePath?: string;\n\twaitMs?: number;\n\tbackground?: boolean;\n\tbackgroundStatusPath?: string;\n\ttoolCallsStarted?: number;\n\ttoolCallsCompleted?: number;\n\tassistantMessages?: number;\n\tdelegatedTasks?: number;\n\tdelegatedSucceeded?: number;\n\tdelegatedFailed?: number;\n\tretrospectiveAttempts?: number;\n\tretrospectiveRecovered?: number;\n\tfailureCauses?: Partial<Record<FailureCause, number>>;\n}\n\nexport interface TaskToolOptions {\n\tresolveCustomSubagent?: (name: string) => CustomSubagentDefinition | undefined;\n\tavailableCustomSubagents?: string[];\n\tavailableCustomSubagentHints?: Array<{ name: string; description: string }>;\n\t/** Returns pending live meta updates entered during an active run. */\n\tgetMetaMessages?: () => readonly string[];\n}\n\n/** Tool names available per profile */\nconst toolsByProfile: Record<string, string[]> = {\n\texplore: [\"read\", \"grep\", \"find\", \"ls\"],\n\tplan: [\"read\", \"bash\", \"grep\", \"find\", \"ls\"],\n\tiosm: [\"read\", \"bash\", \"edit\", \"write\", \"grep\", \"find\", \"ls\"],\n\tiosm_analyst: [\"read\", \"bash\", \"grep\", \"find\", \"ls\"],\n\tiosm_verifier: [\"read\", \"bash\", \"write\"],\n\tcycle_planner: [\"read\", \"bash\", \"write\"],\n\tfull: [\"read\", \"bash\", \"edit\", \"write\", \"grep\", \"find\", \"ls\"],\n};\n\n/** System prompt injected per profile */\nconst systemPromptByProfile: Record<string, string> = {\n\texplore:\n\t\t\"You are a fast read-only codebase explorer. Answer concisely. Never write or edit files.\",\n\tplan: \"You are a technical architect. Analyze the codebase and produce a clear implementation plan. Do not write or edit files.\",\n\tiosm: \"You are an IOSM execution agent. Use IOSM methodology and keep IOSM artifacts synchronized with implementation.\",\n\tiosm_analyst:\n\t\t\"You are an IOSM metrics analyst. Analyze .iosm/ artifacts and codebase metrics. Be precise and evidence-based.\",\n\tiosm_verifier:\n\t\t\"You are an IOSM verifier. Validate checks and update only required IOSM artifacts with deterministic reasoning.\",\n\tcycle_planner:\n\t\t\"You are an IOSM cycle planner. Propose and align cycle goals with measurable outcomes and concrete risks.\",\n\tfull: \"You are a software engineering agent. Execute the task end-to-end.\",\n};\n\nconst writeCapableProfiles = new Set([\"full\", \"iosm_verifier\", \"cycle_planner\"]);\nconst delegationTagName = \"delegate_task\";\n\ntype DelegationRequest = {\n\tdescription: string;\n\tprofile: string;\n\tagent?: string;\n\tprompt: string;\n\tcwd?: string;\n\tlockKey?: string;\n\tmodel?: string;\n\tisolation?: \"none\" | \"worktree\";\n\tdependsOn?: number[];\n};\n\ntype ParsedDelegationRequests = {\n\tcleanedOutput: string;\n\trequests: DelegationRequest[];\n\twarnings: string[];\n};\n\nclass Semaphore {\n\tprivate active = 0;\n\tprivate readonly queue: Array<() => void> = [];\n\n\tconstructor(private readonly limit: number) {}\n\n\tasync acquire(): Promise<() => void> {\n\t\tif (this.active < this.limit) {\n\t\t\tthis.active += 1;\n\t\t\treturn () => this.release();\n\t\t}\n\n\t\tawait new Promise<void>((resolve) => {\n\t\t\tthis.queue.push(() => {\n\t\t\t\tthis.active += 1;\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\n\t\treturn () => this.release();\n\t}\n\n\tprivate release(): void {\n\t\tthis.active = Math.max(0, this.active - 1);\n\t\tconst next = this.queue.shift();\n\t\tif (next) {\n\t\t\tnext();\n\t\t}\n\t}\n\n\tisIdle(): boolean {\n\t\treturn this.active === 0 && this.queue.length === 0;\n\t}\n}\n\nclass Mutex {\n\tprivate locked = false;\n\tprivate readonly waiters: Array<() => void> = [];\n\n\tasync acquire(): Promise<() => void> {\n\t\tif (!this.locked) {\n\t\t\tthis.locked = true;\n\t\t\treturn () => this.release();\n\t\t}\n\n\t\tawait new Promise<void>((resolve) => this.waiters.push(resolve));\n\t\tthis.locked = true;\n\t\treturn () => this.release();\n\t}\n\n\tprivate release(): void {\n\t\tthis.locked = false;\n\t\tconst next = this.waiters.shift();\n\t\tif (next) {\n\t\t\tnext();\n\t\t}\n\t}\n\n\tisIdle(): boolean {\n\t\treturn !this.locked && this.waiters.length === 0;\n\t}\n}\n\nconst maxParallelFromEnv = parseBoundedInt(process.env.IOSM_SUBAGENT_MAX_PARALLEL, 20, 1, 20);\nconst subagentSemaphore = new Semaphore(maxParallelFromEnv);\nconst maxDelegationDepthFromEnv = parseBoundedInt(process.env.IOSM_SUBAGENT_MAX_DELEGATION_DEPTH, 1, 0, 3);\nconst maxDelegationsPerTaskFromEnv = parseBoundedInt(\n\tprocess.env.IOSM_SUBAGENT_MAX_DELEGATIONS_PER_TASK,\n\t10,\n\t0,\n\t10,\n);\nconst maxDelegatedParallelFromEnv = parseBoundedInt(process.env.IOSM_SUBAGENT_MAX_DELEGATE_PARALLEL, 10, 1, 10);\nconst emptyOutputRetriesFromEnv = parseBoundedInt(process.env.IOSM_SUBAGENT_EMPTY_OUTPUT_RETRIES, 1, 0, 2);\nconst retrospectiveRetriesFromEnv = parseBoundedInt(process.env.IOSM_SUBAGENT_RETRO_RETRIES, 1, 0, 1);\nconst orchestrationDependencyWaitTimeoutMsFromEnv = parseBoundedInt(\n\tprocess.env.IOSM_ORCHESTRATION_DEPENDENCY_WAIT_TIMEOUT_MS,\n\t120_000,\n\t5_000,\n\t900_000,\n);\nconst orchestrationDependencyPollMsFromEnv = parseBoundedInt(\n\tprocess.env.IOSM_ORCHESTRATION_DEPENDENCY_POLL_MS,\n\t150,\n\t50,\n\t2_000,\n);\nconst maxDelegatedOutputCharsFromEnv = parseBoundedInt(process.env.IOSM_SUBAGENT_DELEGATED_OUTPUT_MAX_CHARS, 6000, 500, 20_000);\nconst maxMetaUpdatesPerCheckpoint = parseBoundedInt(process.env.IOSM_SUBAGENT_META_MAX_ITEMS, 5, 1, 20);\nconst maxMetaUpdateChars = parseBoundedInt(process.env.IOSM_SUBAGENT_META_MAX_CHARS, 600, 100, 4000);\nconst orchestrationSemaphores = new Map<string, Semaphore>();\nconst cwdWriteLocks = new Map<string, Mutex>();\n\nfunction parseBoundedInt(raw: string | undefined, fallback: number, min: number, max: number): number {\n\tconst parsed = raw ? Number.parseInt(raw, 10) : fallback;\n\tif (!Number.isInteger(parsed)) return fallback;\n\treturn Math.max(min, Math.min(max, parsed));\n}\n\nfunction shouldAutoDelegateByAgent(agentName: string | undefined): boolean {\n\tif (!agentName) return false;\n\tconst normalized = agentName.trim().toLowerCase();\n\treturn normalized.includes(\"orchestrator\");\n}\n\nfunction deriveAutoDelegateParallelHint(\n\tagentName: string | undefined,\n\tdescription: string,\n\tprompt: string,\n): number | undefined {\n\tif (!shouldAutoDelegateByAgent(agentName)) return undefined;\n\tconst text = `${description}\\n${prompt}`.trim();\n\tif (!text) return 1;\n\tconst normalized = text.replace(/\\s+/g, \" \").trim();\n\tconst words = normalized.length > 0 ? normalized.split(/\\s+/).length : 0;\n\tconst clauses = normalized\n\t\t.split(/[.;:,\\n]+/g)\n\t\t.map((item) => item.trim())\n\t\t.filter((item) => item.length > 0).length;\n\tconst pathLikeMatches = normalized.match(/\\b(?:[A-Za-z0-9_.-]+\\/)+[A-Za-z0-9_.-]+\\b/g) ?? [];\n\tconst fileLikeMatches = normalized.match(/\\b[A-Za-z0-9_.-]+\\.[A-Za-z0-9]{1,8}\\b/g) ?? [];\n\tconst listMarkers = text.match(/(?:^|\\n)\\s*(?:[-*]|\\d+[.)])\\s+/g)?.length ?? 0;\n\tconst hasCodeBlock = text.includes(\"```\");\n\n\tlet score = 0;\n\tif (words >= 40) {\n\t\tscore += 2;\n\t} else if (words >= 20) {\n\t\tscore += 1;\n\t}\n\tif (clauses >= 5) {\n\t\tscore += 2;\n\t} else if (clauses >= 3) {\n\t\tscore += 1;\n\t}\n\tif (listMarkers >= 2) {\n\t\tscore += 1;\n\t}\n\tconst referenceCount = pathLikeMatches.length + fileLikeMatches.length;\n\tif (referenceCount >= 3 || (referenceCount >= 1 && words >= 20)) {\n\t\tscore += 1;\n\t}\n\tif (hasCodeBlock) {\n\t\tscore += 1;\n\t}\n\n\tif (score >= 6) return 10;\n\tif (score >= 5) return 8;\n\tif (score >= 4) return 6;\n\tif (score >= 3) return 4;\n\tif (score >= 2) return 3;\n\tif (score >= 1) return 2;\n\treturn 1;\n}\n\nfunction normalizeSpacing(text: string): string {\n\treturn text.replace(/[ \\t]+\\n/g, \"\\n\").replace(/\\n{3,}/g, \"\\n\\n\").trim();\n}\n\nfunction cloneDelegateItems(items: TaskDelegateProgressItem[] | undefined): TaskDelegateProgressItem[] | undefined {\n\treturn items ? items.map((item) => ({ ...item })) : undefined;\n}\n\nfunction formatMetaCheckpoint(metaMessages: readonly string[] | undefined): {\n\tsection: string | undefined;\n\tappliedCount: number;\n} {\n\tif (!metaMessages || metaMessages.length === 0) {\n\t\treturn { section: undefined, appliedCount: 0 };\n\t}\n\tconst normalized = metaMessages\n\t\t.map((item) => item.replace(/\\s+/g, \" \").trim())\n\t\t.filter((item) => item.length > 0)\n\t\t.slice(-maxMetaUpdatesPerCheckpoint)\n\t\t.map((item) => (item.length > maxMetaUpdateChars ? `${item.slice(0, maxMetaUpdateChars - 3)}...` : item));\n\n\tif (normalized.length === 0) {\n\t\treturn { section: undefined, appliedCount: 0 };\n\t}\n\n\tconst lines = normalized.map((item, index) => `${index + 1}. ${item}`).join(\"\\n\");\n\treturn {\n\t\tsection: [\n\t\t\t\"[META_UPDATES]\",\n\t\t\t\"Live user updates captured during execution. Apply them in this subtask if relevant.\",\n\t\t\t\"If conflicts exist, prioritize later items.\",\n\t\t\tlines,\n\t\t\t\"[/META_UPDATES]\",\n\t\t].join(\"\\n\"),\n\t\tappliedCount: normalized.length,\n\t};\n}\n\nfunction isAbortError(error: unknown): boolean {\n\tif (error instanceof Error) {\n\t\treturn /aborted/i.test(error.message);\n\t}\n\tif (typeof error === \"string\") {\n\t\treturn /aborted/i.test(error);\n\t}\n\treturn false;\n}\n\nfunction mergeRunStats(\n\tbase: SubagentRunResult[\"stats\"] | undefined,\n\tnext: SubagentRunResult[\"stats\"] | undefined,\n): SubagentRunResult[\"stats\"] | undefined {\n\tif (!base && !next) return undefined;\n\treturn {\n\t\ttoolCallsStarted: (base?.toolCallsStarted ?? 0) + (next?.toolCallsStarted ?? 0),\n\t\ttoolCallsCompleted: (base?.toolCallsCompleted ?? 0) + (next?.toolCallsCompleted ?? 0),\n\t\tassistantMessages: (base?.assistantMessages ?? 0) + (next?.assistantMessages ?? 0),\n\t};\n}\n\nfunction buildDelegationProtocolPrompt(depthRemaining: number, maxDelegations: number): string {\n\tif (depthRemaining <= 0) {\n\t\treturn [\n\t\t\t`Delegation protocol: depth limit reached.`,\n\t\t\t`Do not emit <${delegationTagName}> blocks.`,\n\t\t].join(\"\\n\");\n\t}\n\treturn [\n\t\t`Delegation protocol (optional): if you discover concrete independent follow-ups, emit up to ${maxDelegations} XML block(s):`,\n\t\t`<${delegationTagName} profile=\"explore|plan|iosm|iosm_analyst|iosm_verifier|cycle_planner|full\" agent=\"optional custom subagent name\" description=\"short title\" cwd=\"optional relative path\" lock_key=\"optional lock key\" model=\"optional model override\" isolation=\"none|worktree\" depends_on=\"optional indices like 1|3\">`,\n\t\t\"Detailed delegated task prompt\",\n\t\t`</${delegationTagName}>`,\n\t\t`Only emit blocks when necessary. Keep normal analysis/answer text outside those blocks.`,\n\t\t`When shared_memory tools are available, exchange intermediate state through shared_memory_write/shared_memory_read instead of repeating large context.`,\n\t].join(\"\\n\");\n}\n\nfunction withDelegationPrompt(basePrompt: string, depthRemaining: number, maxDelegations: number): string {\n\tconst protocol = buildDelegationProtocolPrompt(depthRemaining, maxDelegations);\n\treturn `${basePrompt}\\n\\n${protocol}`;\n}\n\nfunction buildSharedMemoryGuidance(runId: string, taskId: string | undefined): string {\n\treturn [\n\t\t\"[SHARED_MEMORY]\",\n\t\t`run_id: ${runId}`,\n\t\t`task_id: ${taskId ?? \"(none)\"}`,\n\t\t\"Use shared_memory_write/shared_memory_read to exchange intermediate state across parallel agents and delegates.\",\n\t\t\"Guidelines:\",\n\t\t\"- Use scope=run for cross-agent data and scope=task for task-local notes.\",\n\t\t\"- Keep entries compact and key-based (for example: findings/auth, plan/step-1, risks/session).\",\n\t\t\"- Read before overwrite when collaborating on the same key.\",\n\t\t\"[/SHARED_MEMORY]\",\n\t].join(\"\\n\");\n}\n\nfunction parseDelegationRequests(output: string, maxRequests: number): ParsedDelegationRequests {\n\tconst requests: DelegationRequest[] = [];\n\tconst warnings: string[] = [];\n\tconst pattern = new RegExp(`<${delegationTagName}\\\\b([^>]*)>([\\\\s\\\\S]*?)<\\\\/${delegationTagName}>`, \"gi\");\n\n\tconst cleaned = output.replace(pattern, (_full, attrsRaw: string, bodyRaw: string) => {\n\t\tif (maxRequests <= 0) {\n\t\t\twarnings.push(`Ignored delegation block: max delegated tasks per run is 0.`);\n\t\t\treturn \"\";\n\t\t}\n\t\tif (requests.length >= maxRequests) {\n\t\t\twarnings.push(`Ignored extra delegation block: max ${maxRequests} per run.`);\n\t\t\treturn \"\";\n\t\t}\n\t\tconst attrs: Record<string, string> = {};\n\t\tfor (const match of attrsRaw.matchAll(/([A-Za-z_][A-Za-z0-9_-]*)=\"([^\"]*)\"/g)) {\n\t\t\tattrs[match[1].toLowerCase()] = match[2];\n\t\t}\n\n\t\tconst prompt = normalizeSpacing(bodyRaw ?? \"\");\n\t\tif (!prompt) {\n\t\t\twarnings.push(`Ignored delegation block with empty prompt.`);\n\t\t\treturn \"\";\n\t\t}\n\t\tconst profile = (attrs.profile ?? \"explore\").trim();\n\t\tif (!(profile in toolsByProfile)) {\n\t\t\twarnings.push(`Ignored delegation block with unknown profile \"${profile}\".`);\n\t\t\treturn \"\";\n\t\t}\n\t\tconst isolationRaw = (attrs.isolation ?? \"\").trim().toLowerCase();\n\t\tconst isolation =\n\t\t\tisolationRaw === \"worktree\" ? \"worktree\" : isolationRaw === \"none\" ? \"none\" : undefined;\n\t\tif (isolationRaw && !isolation) {\n\t\t\twarnings.push(`Ignored invalid isolation value \"${attrs.isolation}\".`);\n\t\t\treturn \"\";\n\t\t}\n\n\t\trequests.push({\n\t\t\tdescription: (attrs.description ?? `delegated task ${requests.length + 1}`).trim(),\n\t\t\tprofile,\n\t\t\tagent: attrs.agent?.trim() || undefined,\n\t\t\tprompt,\n\t\t\tcwd: attrs.cwd?.trim() || undefined,\n\t\t\tlockKey: attrs.lock_key?.trim() || undefined,\n\t\t\tmodel: attrs.model?.trim() || undefined,\n\t\t\tisolation,\n\t\t\tdependsOn: attrs.depends_on\n\t\t\t\t? attrs.depends_on\n\t\t\t\t\t\t.split(/[|,]/)\n\t\t\t\t\t\t.map((token) => Number.parseInt(token.trim(), 10))\n\t\t\t\t\t\t.filter((value) => Number.isInteger(value) && value > 0)\n\t\t\t\t: undefined,\n\t\t});\n\t\treturn \"\";\n\t});\n\n\treturn {\n\t\trequests,\n\t\twarnings,\n\t\tcleanedOutput: normalizeSpacing(cleaned),\n\t};\n}\n\nfunction getCwdLockKey(cwd: string): string {\n\t// Normalize lock key to keep behavior consistent across path aliases.\n\treturn path.resolve(cwd).toLowerCase();\n}\n\nfunction getOrCreateWriteLock(cwd: string): Mutex {\n\tconst key = getCwdLockKey(cwd);\n\tconst existing = cwdWriteLocks.get(key);\n\tif (existing) return existing;\n\tconst created = new Mutex();\n\tcwdWriteLocks.set(key, created);\n\treturn created;\n}\n\nfunction cleanupWriteLock(lockKey: string | undefined): void {\n\tif (!lockKey) return;\n\tconst key = getCwdLockKey(lockKey);\n\tconst existing = cwdWriteLocks.get(key);\n\tif (!existing || !existing.isIdle()) return;\n\tcwdWriteLocks.delete(key);\n}\n\nfunction getRunParallelLimit(cwd: string, runId: string): number | undefined {\n\tconst teamRun = getTeamRun(cwd, runId);\n\tif (!teamRun) return undefined;\n\tif (teamRun.mode === \"sequential\") return 1;\n\tconst maxParallel = teamRun.maxParallel;\n\tif (!Number.isInteger(maxParallel) || !maxParallel || maxParallel < 1) {\n\t\treturn Math.max(1, Math.min(teamRun.agents, 20));\n\t}\n\treturn Math.max(1, Math.min(maxParallel, 20));\n}\n\nfunction getOrCreateOrchestrationSemaphore(cwd: string, runId: string): Semaphore | undefined {\n\tconst limit = getRunParallelLimit(cwd, runId);\n\tif (!limit || limit < 1) return undefined;\n\tconst key = `${path.resolve(cwd).toLowerCase()}::${runId}::${limit}`;\n\tconst existing = orchestrationSemaphores.get(key);\n\tif (existing) return existing;\n\tconst created = new Semaphore(limit);\n\torchestrationSemaphores.set(key, created);\n\treturn created;\n}\n\nfunction isTeamTaskTerminal(status: string | undefined): boolean {\n\treturn status === \"done\" || status === \"error\" || status === \"cancelled\";\n}\n\nfunction cleanupOrchestrationSemaphore(cwd: string, runId: string): void {\n\tconst prefix = `${path.resolve(cwd).toLowerCase()}::${runId}::`;\n\tconst run = getTeamRun(cwd, runId);\n\tconst canDeleteForRun = !run || run.tasks.every((task) => isTeamTaskTerminal(task.status));\n\tif (!canDeleteForRun) return;\n\tfor (const [key, semaphore] of orchestrationSemaphores.entries()) {\n\t\tif (!key.startsWith(prefix)) continue;\n\t\tif (!semaphore.isIdle()) continue;\n\t\torchestrationSemaphores.delete(key);\n\t}\n}\n\nfunction waitForWithAbort(ms: number, signal?: AbortSignal): Promise<void> {\n\tif (!signal) {\n\t\treturn new Promise((resolve) => setTimeout(resolve, ms));\n\t}\n\tif (signal.aborted) {\n\t\treturn Promise.reject(new Error(\"Operation aborted\"));\n\t}\n\treturn new Promise((resolve, reject) => {\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tconst onAbort = (): void => {\n\t\t\tclearTimeout(timer);\n\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\treject(new Error(\"Operation aborted\"));\n\t\t};\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n}\n\nasync function waitForOrchestrationDependencies(input: {\n\tcwd: string;\n\trunId: string;\n\ttaskId: string;\n\tsignal?: AbortSignal;\n\tonWaiting?: (message: string) => void;\n}): Promise<void> {\n\tconst started = Date.now();\n\tlet lastWaiting = \"\";\n\twhile (true) {\n\t\tif (input.signal?.aborted) {\n\t\t\tthrow new Error(\"Operation aborted\");\n\t\t}\n\t\tconst run = getTeamRun(input.cwd, input.runId);\n\t\tif (!run) {\n\t\t\treturn;\n\t\t}\n\t\tconst current = run.tasks.find((task) => task.id === input.taskId);\n\t\tif (!current) {\n\t\t\tthrow new Error(`Orchestration metadata missing task ${input.taskId} in run ${input.runId}.`);\n\t\t}\n\t\tconst dependencies = current.dependsOn ?? [];\n\t\tif (dependencies.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst dependencyTasks = dependencies.map((id) => run.tasks.find((task) => task.id === id));\n\t\tconst missing = dependencyTasks\n\t\t\t.map((task, index) => (task ? undefined : dependencies[index]))\n\t\t\t.filter((value): value is string => typeof value === \"string\");\n\t\tif (missing.length > 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`Orchestration metadata invalid for ${input.taskId}: missing dependency task(s) ${missing.join(\", \")}.`,\n\t\t\t);\n\t\t}\n\t\tconst failed = dependencyTasks.filter(\n\t\t\t(task): task is NonNullable<typeof task> => !!task && (task.status === \"error\" || task.status === \"cancelled\"),\n\t\t);\n\t\tif (failed.length > 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`Blocked by failed dependency: ${failed.map((task) => `${task.id}=${task.status}`).join(\", \")}.`,\n\t\t\t);\n\t\t}\n\t\tconst pending = dependencyTasks.filter(\n\t\t\t(task): task is NonNullable<typeof task> => !!task && task.status !== \"done\",\n\t\t);\n\t\tif (pending.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst waitedMs = Date.now() - started;\n\t\tif (waitedMs >= orchestrationDependencyWaitTimeoutMsFromEnv) {\n\t\t\tthrow new Error(\n\t\t\t\t`Timed out waiting for dependencies of ${input.taskId}: ${pending\n\t\t\t\t\t.map((task) => `${task.id}=${task.status}`)\n\t\t\t\t\t.join(\", \")}.`,\n\t\t\t);\n\t\t}\n\t\tconst waiting = pending.map((task) => `${task.id}=${task.status}`).join(\", \");\n\t\tif (waiting !== lastWaiting) {\n\t\t\tlastWaiting = waiting;\n\t\t\tinput.onWaiting?.(waiting);\n\t\t}\n\t\tawait waitForWithAbort(orchestrationDependencyPollMsFromEnv, input.signal);\n\t}\n}\n\nfunction persistSubagentTranscript(input: {\n\trootCwd: string;\n\trunId: string;\n\tdescription: string;\n\tprofile: string;\n\tagent?: string;\n\tlockKey?: string;\n\tmodel?: string;\n\tsubagentCwd: string;\n\tsessionId?: string;\n\tprompt: string;\n\toutput: string;\n\tisolation?: \"none\" | \"worktree\";\n\tworktreePath?: string;\n}): string | undefined {\n\ttry {\n\t\tconst dir = path.join(input.rootCwd, \".iosm\", \"subagents\", \"runs\");\n\t\tmkdirSync(dir, { recursive: true });\n\t\tconst filePath = path.join(dir, `${input.runId}.md`);\n\t\tconst lines = [\n\t\t\t\"---\",\n\t\t\t`run_id: ${input.runId}`,\n\t\t\t`profile: ${input.profile}`,\n\t\t\t`description: ${JSON.stringify(input.description)}`,\n\t\t\t`cwd: ${JSON.stringify(input.subagentCwd)}`,\n\t\t\t`agent: ${JSON.stringify(input.agent ?? \"\")}`,\n\t\t\t`lock_key: ${JSON.stringify(input.lockKey ?? \"\")}`,\n\t\t\t`model: ${JSON.stringify(input.model ?? \"\")}`,\n\t\t\t`session_id: ${JSON.stringify(input.sessionId ?? \"\")}`,\n\t\t\t`isolation: ${JSON.stringify(input.isolation ?? \"none\")}`,\n\t\t\t`worktree_path: ${JSON.stringify(input.worktreePath ?? \"\")}`,\n\t\t\t`created_at: ${new Date().toISOString()}`,\n\t\t\t\"---\",\n\t\t\t\"\",\n\t\t\t\"## Prompt\",\n\t\t\t\"\",\n\t\t\tinput.prompt,\n\t\t\t\"\",\n\t\t\t\"## Output\",\n\t\t\t\"\",\n\t\t\tinput.output,\n\t\t\t\"\",\n\t\t];\n\t\twriteFileSync(filePath, lines.join(\"\\n\"), \"utf8\");\n\t\treturn filePath;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\ntype BackgroundRunStatus = {\n\trunId: string;\n\tstatus: \"queued\" | \"running\" | \"done\" | \"error\" | \"cancelled\";\n\tcreatedAt: string;\n\tstartedAt?: string;\n\tfinishedAt?: string;\n\tdescription: string;\n\tprofile: string;\n\tcwd: string;\n\tagent?: string;\n\tmodel?: string;\n\terror?: string;\n\ttranscriptPath?: string;\n};\n\nfunction writeBackgroundRunStatus(rootCwd: string, status: BackgroundRunStatus): string | undefined {\n\ttry {\n\t\tconst dir = path.join(rootCwd, \".iosm\", \"subagents\", \"background\");\n\t\tmkdirSync(dir, { recursive: true });\n\t\tconst filePath = path.join(dir, `${status.runId}.json`);\n\t\twriteFileSync(filePath, `${JSON.stringify(status, null, 2)}\\n`, \"utf8\");\n\t\treturn filePath;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction gitResult(args: string[], cwd: string): { ok: boolean; stdout: string } {\n\tconst result = spawnSync(\"git\", args, {\n\t\tcwd,\n\t\tencoding: \"utf8\",\n\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t});\n\treturn {\n\t\tok: result.status === 0,\n\t\tstdout: (result.stdout ?? \"\").trim(),\n\t};\n}\n\nfunction provisionWorktree(\n\trootCwd: string,\n\ttargetCwd: string,\n\trunId: string,\n): { runCwd: string; worktreePath?: string; cleanup: () => void } {\n\tconst insideRepo = gitResult([\"rev-parse\", \"--is-inside-work-tree\"], rootCwd);\n\tif (!insideRepo.ok || insideRepo.stdout !== \"true\") {\n\t\treturn { runCwd: targetCwd, cleanup: () => {} };\n\t}\n\tconst repoRootResult = gitResult([\"rev-parse\", \"--show-toplevel\"], rootCwd);\n\tif (!repoRootResult.ok || !repoRootResult.stdout) {\n\t\treturn { runCwd: targetCwd, cleanup: () => {} };\n\t}\n\n\tconst repoRoot = repoRootResult.stdout;\n\tconst relative = path.relative(repoRoot, targetCwd);\n\tif (relative.startsWith(\"..\")) {\n\t\treturn { runCwd: targetCwd, cleanup: () => {} };\n\t}\n\n\tconst worktreePath = path.join(rootCwd, \".iosm\", \"subagents\", \"worktrees\", runId);\n\tmkdirSync(path.dirname(worktreePath), { recursive: true });\n\tconst added = gitResult([\"worktree\", \"add\", \"--detach\", worktreePath], repoRoot);\n\tif (!added.ok) {\n\t\treturn { runCwd: targetCwd, cleanup: () => {} };\n\t}\n\n\tconst runCwd = path.resolve(worktreePath, relative);\n\tconst cleanup = (): void => {\n\t\ttry {\n\t\t\tgitResult([\"worktree\", \"remove\", \"--force\", worktreePath], repoRoot);\n\t\t} catch {\n\t\t\t// best effort\n\t\t}\n\t\ttry {\n\t\t\trmSync(worktreePath, { recursive: true, force: true });\n\t\t} catch {\n\t\t\t// best effort\n\t\t}\n\t};\n\n\treturn { runCwd, worktreePath, cleanup };\n}\n\n/**\n * Create the Task tool using the factory pattern.\n *\n * The `runner` callback is supplied by sdk.ts to avoid a circular import:\n * sdk.ts → task.ts (tool) would otherwise import sdk.ts again.\n *\n * @param cwd Working directory forwarded to the subagent.\n * @param runner Callback that creates and runs a sub-session.\n */\nexport function createTaskTool(\n\tcwd: string,\n\trunner: SubagentRunner,\n\toptions?: TaskToolOptions,\n): AgentTool<typeof taskSchema> {\n\tconst customAgentsSnippet =\n\t\toptions?.availableCustomSubagentHints && options.availableCustomSubagentHints.length > 0\n\t\t\t? ` Available custom agents: ${options.availableCustomSubagentHints\n\t\t\t\t\t.map((item) => `${item.name} (${item.description})`)\n\t\t\t\t\t.join(\", \")}.`\n\t\t\t: options?.availableCustomSubagents && options.availableCustomSubagents.length > 0\n\t\t\t\t? ` Available custom agents: ${options.availableCustomSubagents.join(\", \")}.`\n\t\t\t: \"\";\n\treturn {\n\t\tname: \"task\",\n\t\tlabel: \"task\",\n\t\tdescription:\n\t\t\t\"Launch a specialized subagent to handle a subtask in isolation. \" +\n\t\t\t\"Use for: codebase exploration (profile=explore), architectural planning (profile=plan), \" +\n\t\t\t\"IOSM artifact analysis (profile=iosm_analyst/iosm_verifier/cycle_planner), or end-to-end implementation (profile=full). \" +\n\t\t\t\"Set cwd to isolate subagents into different project areas when orchestrating parallel work. \" +\n\t\t\t\"The subagent runs to completion and returns its full text output. \" +\n\t\t\t\"It may request bounded follow-up delegation via <delegate_task> blocks that are executed by the parent task tool.\" +\n\t\t\tcustomAgentsSnippet,\n\t\tparameters: taskSchema,\n\t\texecute: async (\n\t\t\t_toolCallId: string,\n\t\t\t{\n\t\t\t\tdescription,\n\t\t\t\tprompt,\n\t\t\t\tagent: agentName,\n\t\t\t\tprofile,\n\t\t\t\tcwd: targetCwd,\n\t\t\t\tlock_key: lockKey,\n\t\t\t\trun_id: orchestrationRunId,\n\t\t\t\ttask_id: orchestrationTaskId,\n\t\t\t\tmodel: requestedModel,\n\t\t\t\tbackground,\n\t\t\t\tisolation,\n\t\t\t\tdelegate_parallel_hint: delegateParallelHint,\n\t\t\t}: TaskToolInput,\n\t\t\t_signal?: AbortSignal,\n\t\t\tonUpdate?,\n\t\t) => {\n\t\t\tconst updateTrackedTaskStatus = (status: \"running\" | \"done\" | \"error\" | \"cancelled\"): void => {\n\t\t\t\tif (!orchestrationRunId || !orchestrationTaskId) return;\n\t\t\t\tupdateTeamTaskStatus({\n\t\t\t\t\tcwd,\n\t\t\t\t\trunId: orchestrationRunId,\n\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\tstatus,\n\t\t\t\t});\n\t\t\t};\n\t\t\tconst throwIfAborted = (): void => {\n\t\t\t\tif (_signal?.aborted) {\n\t\t\t\t\tupdateTrackedTaskStatus(\"cancelled\");\n\t\t\t\t\tthrow new Error(\"Operation aborted\");\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t\tconst runId = `subagent_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;\n\t\t\t\tconst sharedMemoryRunId = orchestrationRunId?.trim() || runId;\n\t\t\t\tconst sharedMemoryTaskId = orchestrationTaskId?.trim() || runId;\n\t\t\t\tconst availableCustomNames = options?.availableCustomSubagents ?? [];\n\t\t\t\tconst resolveCustom = (name: string | undefined): CustomSubagentDefinition | undefined => {\n\t\t\t\t\tif (!name || !options?.resolveCustomSubagent) return undefined;\n\t\t\t\t\treturn options.resolveCustomSubagent(name);\n\t\t\t\t};\n\n\t\t\t\tlet normalizedAgentName = agentName?.trim() || undefined;\n\t\t\t\tlet normalizedProfile = profile.trim().toLowerCase();\n\t\t\t\tif (!normalizedProfile) normalizedProfile = \"full\";\n\n\t\t\t\tlet customSubagent = resolveCustom(normalizedAgentName);\n\t\t\t\tif (normalizedAgentName && !customSubagent) {\n\t\t\t\t\tconst available =\n\t\t\t\t\t\tavailableCustomNames.length > 0 ? ` Available custom agents: ${availableCustomNames.join(\", \")}.` : \"\";\n\t\t\t\t\tthrow new Error(`Unknown subagent: ${normalizedAgentName}.${available}`);\n\t\t\t\t}\n\n\t\t\t\t// Recovery path: if model placed a custom agent name into `profile`, remap automatically.\n\t\t\t\tif (!customSubagent) {\n\t\t\t\t\tconst profileAsAgent = resolveCustom(normalizedProfile);\n\t\t\t\t\tif (profileAsAgent) {\n\t\t\t\t\t\tcustomSubagent = profileAsAgent;\n\t\t\t\t\t\tnormalizedAgentName = profileAsAgent.name;\n\t\t\t\t\t\tnormalizedProfile = (profileAsAgent.profile ?? \"full\").trim().toLowerCase();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!toolsByProfile[normalizedProfile]) {\n\t\t\t\t\tnormalizedProfile = \"full\";\n\t\t\t\t}\n\n\t\t\t\tconst effectiveProfile = customSubagent?.profile ?? normalizedProfile;\n\t\t\tlet tools = customSubagent?.tools\n\t\t\t\t? [...customSubagent.tools]\n\t\t\t\t: [...(toolsByProfile[effectiveProfile] ?? toolsByProfile.explore)];\n\t\t\tif (customSubagent?.disallowedTools?.length) {\n\t\t\t\tconst blocked = new Set(customSubagent.disallowedTools);\n\t\t\t\ttools = tools.filter((tool) => !blocked.has(tool));\n\t\t\t}\n\t\t\tconst delegationDepth = maxDelegationDepthFromEnv;\n\t\t\tconst requestedDelegateParallelHint =\n\t\t\t\ttypeof delegateParallelHint === \"number\" && Number.isInteger(delegateParallelHint)\n\t\t\t\t\t? Math.max(1, Math.min(10, delegateParallelHint))\n\t\t\t\t\t: undefined;\n\t\t\t\tconst autoDelegateParallelHint =\n\t\t\t\t\trequestedDelegateParallelHint === undefined\n\t\t\t\t\t\t? deriveAutoDelegateParallelHint(normalizedAgentName, description, prompt)\n\t\t\t\t\t\t: undefined;\n\t\t\tconst effectiveDelegateParallelHint = requestedDelegateParallelHint ?? autoDelegateParallelHint;\n\t\t\tconst effectiveMaxDelegations = Math.max(\n\t\t\t\t0,\n\t\t\t\tMath.min(maxDelegationsPerTaskFromEnv, effectiveDelegateParallelHint ?? maxDelegationsPerTaskFromEnv),\n\t\t\t);\n\t\t\tconst effectiveMaxDelegateParallel = Math.max(\n\t\t\t\t1,\n\t\t\t\tMath.min(maxDelegatedParallelFromEnv, effectiveDelegateParallelHint ?? maxDelegatedParallelFromEnv),\n\t\t\t);\n\t\t\tconst minDelegationsPreferred =\n\t\t\t\t(effectiveDelegateParallelHint ?? 0) >= 2 && effectiveMaxDelegations >= 2\n\t\t\t\t\t? Math.min(2, effectiveMaxDelegations)\n\t\t\t\t\t: 0;\n\t\t\tconst baseSystemPrompt =\n\t\t\t\tcustomSubagent?.systemPrompt ??\n\t\t\t\tsystemPromptByProfile[effectiveProfile] ??\n\t\t\t\tsystemPromptByProfile.full;\n\t\t\tconst systemPrompt = withDelegationPrompt(baseSystemPrompt, delegationDepth, effectiveMaxDelegations);\n\t\t\tconst promptWithInstructions =\n\t\t\t\tcustomSubagent?.instructions && customSubagent.instructions.trim().length > 0\n\t\t\t\t\t? `${customSubagent.instructions.trim()}\\n\\nUser task:\\n${prompt}`\n\t\t\t\t\t: prompt;\n\t\t\tconst effectiveModelOverride = requestedModel?.trim() || customSubagent?.model?.trim() || undefined;\n\t\t\tconst requestedBackground = background === true || customSubagent?.background === true;\n\t\t\tconst trackedOrchestrationRun =\n\t\t\t\torchestrationRunId && orchestrationTaskId ? getTeamRun(cwd, orchestrationRunId) : undefined;\n\t\t\t// Deterministic orchestration UX: run tracked team tasks in foreground so the parent turn\n\t\t\t// naturally waits for subagents and aggregates their outputs without ad-hoc polling.\n\t\t\tconst runInBackground = trackedOrchestrationRun ? false : requestedBackground;\n\t\t\tconst requestedSubagentCwd = targetCwd\n\t\t\t\t? path.resolve(cwd, targetCwd)\n\t\t\t\t: customSubagent?.cwd ?? cwd;\n\t\t\tif (!existsSync(requestedSubagentCwd) || !statSync(requestedSubagentCwd).isDirectory()) {\n\t\t\t\tthrow new Error(`Subagent cwd does not exist or is not a directory: ${requestedSubagentCwd}`);\n\t\t\t}\n\t\t\tif (runInBackground && writeCapableProfiles.has(effectiveProfile)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Background policy violation: profile \"${effectiveProfile}\" is write-capable. Use explore/plan/iosm_analyst for background mode.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst useWorktree = isolation === \"worktree\";\n\n\t\t\tconst queuedAt = Date.now();\n\t\t\tlet latestProgress: TaskToolProgress | undefined;\n\t\t\tconst emitProgress = (incoming: TaskToolProgress): void => {\n\t\t\t\tconst activeTool = \"activeTool\" in incoming ? incoming.activeTool : latestProgress?.activeTool;\n\t\t\t\tconst delegateIndex = \"delegateIndex\" in incoming ? incoming.delegateIndex : latestProgress?.delegateIndex;\n\t\t\t\tconst delegateTotal = \"delegateTotal\" in incoming ? incoming.delegateTotal : latestProgress?.delegateTotal;\n\t\t\t\tconst delegateDescription =\n\t\t\t\t\t\"delegateDescription\" in incoming ? incoming.delegateDescription : latestProgress?.delegateDescription;\n\t\t\t\tconst delegateProfile =\n\t\t\t\t\t\"delegateProfile\" in incoming ? incoming.delegateProfile : latestProgress?.delegateProfile;\n\t\t\t\tconst delegateItems =\n\t\t\t\t\t\"delegateItems\" in incoming\n\t\t\t\t\t\t? cloneDelegateItems(incoming.delegateItems)\n\t\t\t\t\t\t: cloneDelegateItems(latestProgress?.delegateItems);\n\t\t\t\tconst merged: TaskToolProgress = {\n\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\tphase: incoming.phase,\n\t\t\t\t\tmessage: incoming.message,\n\t\t\t\t\tcwd: incoming.cwd ?? latestProgress?.cwd ?? requestedSubagentCwd,\n\t\t\t\t\tactiveTool,\n\t\t\t\t\ttoolCallsStarted: incoming.toolCallsStarted ?? latestProgress?.toolCallsStarted,\n\t\t\t\t\ttoolCallsCompleted: incoming.toolCallsCompleted ?? latestProgress?.toolCallsCompleted,\n\t\t\t\t\tassistantMessages: incoming.assistantMessages ?? latestProgress?.assistantMessages,\n\t\t\t\t\tdelegateIndex,\n\t\t\t\t\tdelegateTotal,\n\t\t\t\t\tdelegateDescription,\n\t\t\t\t\tdelegateProfile,\n\t\t\t\t\tdelegateItems,\n\t\t\t\t};\n\t\t\t\tlatestProgress = merged;\n\t\t\t\tif (!onUpdate) return;\n\t\t\t\tonUpdate({\n\t\t\t\t\tcontent: [{ type: \"text\" as const, text: merged.message }],\n\t\t\t\t\tdetails: { progress: merged },\n\t\t\t\t});\n\t\t\t};\n\t\t\tthrowIfAborted();\n\t\t\temitProgress({\n\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\tphase: \"queued\",\n\t\t\t\tmessage: \"queued\",\n\t\t\t\tcwd: requestedSubagentCwd,\n\t\t\t\ttoolCallsStarted: 0,\n\t\t\t\ttoolCallsCompleted: 0,\n\t\t\t\tassistantMessages: 0,\n\t\t\t});\n\n\t\t\tconst executeSubagent = async (): Promise<{ text: string; details: TaskToolDetails }> => {\n\t\t\t\tlet releaseRunSlot: (() => void) | undefined;\n\t\t\t\tlet releaseSlot: (() => void) | undefined;\n\t\t\t\tlet releaseWriteLock: (() => void) | undefined;\n\t\t\t\tlet releaseIsolation: (() => void) | undefined;\n\t\t\t\tconst explicitRootLockKey = lockKey?.trim();\n\t\t\t\tlet subagentCwd = requestedSubagentCwd;\n\t\t\t\tlet worktreePath: string | undefined;\n\t\t\t\tlet runStats: SubagentRunResult[\"stats\"] | undefined;\n\t\t\t\ttry {\n\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\tif (orchestrationRunId && orchestrationTaskId) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait waitForOrchestrationDependencies({\n\t\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\t\trunId: orchestrationRunId,\n\t\t\t\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\t\t\t\tsignal: _signal,\n\t\t\t\t\t\t\t\tonWaiting: (waiting) => {\n\t\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\t\tphase: \"queued\",\n\t\t\t\t\t\t\t\t\t\tmessage: `waiting for dependencies: ${waiting}`,\n\t\t\t\t\t\t\t\t\t\tcwd: requestedSubagentCwd,\n\t\t\t\t\t\t\t\t\t\tactiveTool: undefined,\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\t} catch (error) {\n\t\t\t\t\t\t\t\tif (_signal?.aborted || isAbortError(error)) {\n\t\t\t\t\t\t\t\t\tupdateTrackedTaskStatus(\"cancelled\");\n\t\t\t\t\t\t\t\t\tthrow new Error(\"Operation aborted\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\t\t\t\tconst cause = classifyFailureCause(message);\n\t\t\t\t\t\t\t\tupdateTrackedTaskStatus(\"error\");\n\t\t\t\t\t\t\t\tconst details: TaskToolDetails = {\n\t\t\t\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\toutputLength: 0,\n\t\t\t\t\t\t\t\t\tcwd: requestedSubagentCwd,\n\t\t\t\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\t\t\t\tlockKey: lockKey?.trim() || undefined,\n\t\t\t\t\t\t\t\t\trunId,\n\t\t\t\t\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\t\t\t\tisolation: useWorktree ? \"worktree\" : \"none\",\n\t\t\t\t\t\t\t\t\tworktreePath,\n\t\t\t\t\t\t\t\t\twaitMs: Date.now() - queuedAt,\n\t\t\t\t\t\t\t\t\tbackground: runInBackground,\n\t\t\t\t\t\t\t\t\tfailureCauses: { [cause]: 1 },\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tthrow Object.assign(new Error(`Subagent failed: ${message}`), { details });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tconst orchestrationSemaphore =\n\t\t\t\t\t\torchestrationRunId && orchestrationTaskId\n\t\t\t\t\t\t\t? getOrCreateOrchestrationSemaphore(cwd, orchestrationRunId)\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\tif (orchestrationSemaphore) {\n\t\t\t\t\t\treleaseRunSlot = await orchestrationSemaphore.acquire();\n\t\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\t}\n\t\t\t\t\treleaseSlot = await subagentSemaphore.acquire();\n\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\tupdateTrackedTaskStatus(\"running\");\n\t\t\t\t\tif (writeCapableProfiles.has(effectiveProfile)) {\n\t\t\t\t\t\t// Parallel orchestration should remain truly parallel by default.\n\t\t\t\t\t\t// Serialize write-capable agents only when an explicit lock_key is provided.\n\t\t\t\t\t\tif (explicitRootLockKey) {\n\t\t\t\t\t\t\tconst lock = getOrCreateWriteLock(explicitRootLockKey);\n\t\t\t\t\t\t\treleaseWriteLock = await lock.acquire();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (useWorktree) {\n\t\t\t\t\t\tconst isolated = provisionWorktree(cwd, requestedSubagentCwd, runId);\n\t\t\t\t\t\tsubagentCwd = isolated.runCwd;\n\t\t\t\t\t\tworktreePath = isolated.worktreePath;\n\t\t\t\t\t\treleaseIsolation = isolated.cleanup;\n\t\t\t\t\t}\n\t\t\t\t\temitProgress({\n\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\tphase: \"starting\",\n\t\t\t\t\t\tmessage: \"starting subagent\",\n\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t});\n\n\t\t\t\t\t\tlet output: string;\n\t\t\t\t\t\tlet subagentSessionId: string | undefined;\n\t\t\t\t\t\tlet delegatedTasks = 0;\n\t\t\t\t\t\tlet delegatedSucceeded = 0;\n\t\t\t\t\t\tlet delegatedFailed = 0;\n\t\t\t\t\t\tlet retrospectiveAttempts = 0;\n\t\t\t\t\t\tlet retrospectiveRecovered = 0;\n\t\t\t\t\t\tconst delegationWarnings: string[] = [];\n\t\t\t\t\t\tconst delegatedSections: Array<string | undefined> = [];\n\t\t\t\t\t\tconst failureCauses: Partial<Record<FailureCause, number>> = {};\n\t\t\t\t\t\tconst delegatedStats = {\n\t\t\t\t\t\t\ttoolCallsStarted: 0,\n\t\t\t\t\t\t\ttoolCallsCompleted: 0,\n\t\t\t\t\t\t\tassistantMessages: 0,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst recordFailureCause = (cause: FailureCause): void => {\n\t\t\t\t\t\t\tfailureCauses[cause] = (failureCauses[cause] ?? 0) + 1;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst rootSharedMemoryContext: SharedMemoryContext = {\n\t\t\t\t\t\t\trootCwd: cwd,\n\t\t\t\t\t\t\trunId: sharedMemoryRunId,\n\t\t\t\t\t\t\ttaskId: sharedMemoryTaskId,\n\t\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\t};\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst runRootPass = async (runPrompt: string): Promise<{\n\t\t\t\t\t\t\t\toutput: string;\n\t\t\t\t\t\t\t\tsessionId?: string;\n\t\t\t\t\t\t\t\tstats?: SubagentRunResult[\"stats\"];\n\t\t\t\t\t\t\t}> => {\n\t\t\t\t\t\t\t\tlet emptyAttempt = 0;\n\t\t\t\t\t\t\t\tlet retrospectiveAttempt = 0;\n\t\t\t\t\t\t\t\tlet mergedStats: SubagentRunResult[\"stats\"] | undefined;\n\t\t\t\t\t\t\t\tlet sessionId: string | undefined;\n\t\t\t\t\t\t\t\tlet promptForAttempt = runPrompt;\n\t\t\t\t\t\t\t\twhile (true) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tconst result = await runner({\n\t\t\t\t\t\t\t\t\t\t\tsystemPrompt,\n\t\t\t\t\t\t\t\t\t\t\ttools,\n\t\t\t\t\t\t\t\t\t\t\tprompt: promptForAttempt,\n\t\t\t\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\t\t\t\tmodelOverride: effectiveModelOverride,\n\t\t\t\t\t\t\t\t\t\t\tsharedMemoryContext: rootSharedMemoryContext,\n\t\t\t\t\t\t\t\t\t\t\tsignal: _signal,\n\t\t\t\t\t\t\t\t\t\t\tonProgress: (progress) => emitProgress(progress),\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tthrowIfAborted();\n\n\t\t\t\t\t\t\t\t\t\tlet attemptOutput: string;\n\t\t\t\t\t\t\t\t\t\tlet attemptStats: SubagentRunResult[\"stats\"] | undefined;\n\t\t\t\t\t\t\t\t\t\tif (typeof result === \"string\") {\n\t\t\t\t\t\t\t\t\t\t\tattemptOutput = result;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tattemptOutput = result.output;\n\t\t\t\t\t\t\t\t\t\t\tattemptStats = result.stats;\n\t\t\t\t\t\t\t\t\t\t\tsessionId = result.sessionId ?? sessionId;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tmergedStats = mergeRunStats(mergedStats, attemptStats);\n\t\t\t\t\t\t\t\t\t\tif (attemptOutput.trim().length > 0) {\n\t\t\t\t\t\t\t\t\t\t\tif (retrospectiveAttempt > 0) {\n\t\t\t\t\t\t\t\t\t\t\t\tretrospectiveRecovered += 1;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\toutput: attemptOutput,\n\t\t\t\t\t\t\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\t\t\t\t\t\t\tstats: mergedStats,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (emptyAttempt >= emptyOutputRetriesFromEnv) {\n\t\t\t\t\t\t\t\t\t\t\tconst totalAttempts = emptyAttempt + 1;\n\t\t\t\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t\t\t\t`Subagent returned empty output after ${totalAttempts} attempt${totalAttempts === 1 ? \"\" : \"s\"}.`,\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\temptyAttempt += 1;\n\t\t\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\t\t\t\tmessage: `root subagent returned empty output; retry ${emptyAttempt}/${emptyOutputRetriesFromEnv}`,\n\t\t\t\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\t\tif (_signal?.aborted || isAbortError(error)) {\n\t\t\t\t\t\t\t\t\t\t\tthrow new Error(\"Operation aborted\");\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\t\t\t\t\t\tconst cause = classifyFailureCause(message);\n\t\t\t\t\t\t\t\t\t\trecordFailureCause(cause);\n\t\t\t\t\t\t\t\t\t\tconst canRetryRetrospective =\n\t\t\t\t\t\t\t\t\t\t\tretrospectiveAttempt < retrospectiveRetriesFromEnv && isRetrospectiveRetryable(cause);\n\t\t\t\t\t\t\t\t\t\tif (!canRetryRetrospective) {\n\t\t\t\t\t\t\t\t\t\t\tthrow Object.assign(new Error(message), { failureCause: cause as FailureCause });\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tretrospectiveAttempt += 1;\n\t\t\t\t\t\t\t\t\t\tretrospectiveAttempts += 1;\n\t\t\t\t\t\t\t\t\t\tconst directive = buildRetrospectiveDirective({\n\t\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t\t\terrorMessage: message,\n\t\t\t\t\t\t\t\t\t\t\tattempt: retrospectiveAttempt,\n\t\t\t\t\t\t\t\t\t\t\ttarget: \"root\",\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tpromptForAttempt = `${runPrompt}\\n\\n${directive}`;\n\t\t\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\t\t\t\tmessage: `root retrospective retry ${retrospectiveAttempt}/${retrospectiveRetriesFromEnv} (${cause})`,\n\t\t\t\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\t\t\t});\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\n\t\t\t\t\t\t\tconst rootMeta = formatMetaCheckpoint(options?.getMetaMessages?.());\n\t\t\t\t\t\t\tconst rootSharedMemoryGuidance = buildSharedMemoryGuidance(sharedMemoryRunId, sharedMemoryTaskId);\n\t\t\t\t\t\t\tconst rootPromptBase = `${promptWithInstructions}\\n\\n${rootSharedMemoryGuidance}`;\n\t\t\t\t\t\t\tconst rootPrompt =\n\t\t\t\t\t\t\t\trootMeta.section && rootMeta.appliedCount > 0\n\t\t\t\t\t\t\t\t\t? `${rootPromptBase}\\n\\n${rootMeta.section}`\n\t\t\t\t\t\t\t\t\t: rootPromptBase;\n\t\t\t\t\t\tif (rootMeta.appliedCount > 0) {\n\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\tmessage: `applied ${rootMeta.appliedCount} meta update(s) to root task`,\n\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst firstPass = await runRootPass(rootPrompt);\n\t\t\t\t\t\toutput = firstPass.output;\n\t\t\t\t\t\tsubagentSessionId = firstPass.sessionId;\n\t\t\t\t\t\trunStats = firstPass.stats;\n\n\t\t\t\t\t\tlet parsedDelegation = parseDelegationRequests(\n\t\t\t\t\t\t\toutput,\n\t\t\t\t\t\t\tdelegationDepth > 0 ? effectiveMaxDelegations : 0,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (minDelegationsPreferred > 0 && parsedDelegation.requests.length < minDelegationsPreferred) {\n\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\tmessage: `delegation preference unmet (${parsedDelegation.requests.length}/${minDelegationsPreferred}), retrying with stronger split guidance`,\n\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst enforcedPrompt = [\n\t\t\t\t\t\t\t\trootPrompt,\n\t\t\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\t\t\"[DELEGATION_ENFORCEMENT]\",\n\t\t\t\t\t\t\t\t`Prefer emitting at least ${minDelegationsPreferred} <delegate_task> blocks for independent sub-work when beneficial.`,\n\t\t\t\t\t\t\t\t`Target parallel fan-out: up to ${effectiveMaxDelegateParallel}.`,\n\t\t\t\t\t\t\t\t\"If decomposition is not beneficial, you may keep single-agent execution and optionally output one line:\",\n\t\t\t\t\t\t\t\t\"DELEGATION_IMPOSSIBLE: <reason>\",\n\t\t\t\t\t\t\t\t\"[/DELEGATION_ENFORCEMENT]\",\n\t\t\t\t\t\t\t].join(\"\\n\");\n\t\t\t\t\t\t\tconst secondPass = await runRootPass(enforcedPrompt);\n\t\t\t\t\t\t\toutput = secondPass.output;\n\t\t\t\t\t\t\tsubagentSessionId = secondPass.sessionId ?? subagentSessionId;\n\t\t\t\t\t\t\trunStats = secondPass.stats ?? runStats;\n\t\t\t\t\t\t\tparsedDelegation = parseDelegationRequests(\n\t\t\t\t\t\t\t\toutput,\n\t\t\t\t\t\t\t\tdelegationDepth > 0 ? effectiveMaxDelegations : 0,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (minDelegationsPreferred > 0 && parsedDelegation.requests.length < minDelegationsPreferred) {\n\t\t\t\t\t\t\tconst impossibleReason =\n\t\t\t\t\t\t\t\toutput.match(/^\\s*DELEGATION_IMPOSSIBLE\\s*:\\s*(.+)$/im)?.[1]?.trim() ?? \"not provided\";\n\t\t\t\t\t\t\tdelegationWarnings.push(\n\t\t\t\t\t\t\t\t`Delegation fallback: kept single-agent execution (preferred >=${minDelegationsPreferred} delegates, got ${parsedDelegation.requests.length}). Reason: ${impossibleReason}.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toutput = parsedDelegation.cleanedOutput;\n\t\t\t\t\t\tdelegationWarnings.push(...parsedDelegation.warnings);\n\t\t\t\t\t\tconst delegateTotal = parsedDelegation.requests.length;\n\t\t\t\t\t\tconst delegateItems: TaskDelegateProgressItem[] = parsedDelegation.requests.map((request, index) => ({\n\t\t\t\t\t\t\tindex: index + 1,\n\t\t\t\t\t\t\tdescription: request.description,\n\t\t\t\t\t\t\tprofile: request.profile,\n\t\t\t\t\t\t\tstatus: \"pending\",\n\t\t\t\t\t\t}));\n\t\t\t\t\t\tconst normalizedDependsOn: number[][] = parsedDelegation.requests.map((request, index) => {\n\t\t\t\t\t\t\tconst current = index + 1;\n\t\t\t\t\t\t\tconst raw = request.dependsOn ?? [];\n\t\t\t\t\t\t\tconst unique = new Set<number>();\n\t\t\t\t\t\t\tfor (const dep of raw) {\n\t\t\t\t\t\t\t\tif (!Number.isInteger(dep) || dep <= 0 || dep > delegateTotal || dep === current) {\n\t\t\t\t\t\t\t\t\tdelegationWarnings.push(\n\t\t\t\t\t\t\t\t\t\t`Delegated task ${current} has invalid depends_on reference \"${dep}\" and it was ignored.`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tunique.add(dep);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn Array.from(unique).sort((a, b) => a - b);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tdelegatedTasks += delegateTotal;\n\t\t\t\t\t\tif (delegateTotal > 0) {\n\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\t\tmessage: `delegation scheduler: ${delegateTotal} task(s), max parallel ${Math.min(delegateTotal, effectiveMaxDelegateParallel)}`,\n\t\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst pendingIndices = new Set<number>(Array.from({ length: delegateTotal }, (_v, i) => i));\n\t\t\t\t\t\tconst runningDelegates = new Map<number, Promise<void>>();\n\t\t\t\t\t\tconst maxDelegateParallel = Math.max(1, Math.min(delegateTotal || 1, effectiveMaxDelegateParallel));\n\n\t\t\t\t\t\tconst statusOf = (idx: number): TaskDelegateProgressStatus =>\n\t\t\t\t\t\t\tdelegateItems[idx]?.status ?? \"pending\";\n\t\t\t\t\t\tconst formatDelegateTarget = (request: DelegationRequest): string => {\n\t\t\t\t\t\t\tconst agent = request.agent?.trim();\n\t\t\t\t\t\t\treturn agent ? `${agent}/${request.profile}` : request.profile;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\tconst markDelegateFailed = (\n\t\t\t\t\t\t\t\tindex: number,\n\t\t\t\t\t\t\t\tmessage: string,\n\t\t\t\t\t\t\t\tdetails?: string,\n\t\t\t\t\t\t\t\tcause?: FailureCause,\n\t\t\t\t\t\t\t): void => {\n\t\t\t\t\t\t\t\tconst request = parsedDelegation.requests[index];\n\t\t\t\t\t\t\t\tif (delegateItems[index]) {\n\t\t\t\t\t\t\t\t\tdelegateItems[index].status = \"failed\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdelegatedFailed += 1;\n\t\t\t\t\t\t\t\tif (details) {\n\t\t\t\t\t\t\t\t\tdelegationWarnings.push(cause ? `${details} [cause=${cause}]` : details);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst causeLabel = cause ? ` [cause=${cause}]` : \"\";\n\t\t\t\t\t\t\t\tdelegatedSections[index] = `#### ${index + 1}. ${request.description} (${formatDelegateTarget(request)})\\nERROR${causeLabel}: ${message}`;\n\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\tdelegateIndex: index + 1,\n\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\tdelegateDescription: request.description,\n\t\t\t\t\t\t\t\tdelegateProfile: request.profile,\n\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst runDelegate = async (index: number): Promise<void> => {\n\t\t\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\t\t\tconst request = parsedDelegation.requests[index];\n\t\t\t\t\t\t\tconst requestedChildAgent = request.agent?.trim() || undefined;\n\t\t\t\t\t\t\tconst childCustomSubagent = resolveCustom(requestedChildAgent);\n\t\t\t\t\t\t\tif (requestedChildAgent && !childCustomSubagent) {\n\t\t\t\t\t\t\t\tdelegationWarnings.push(\n\t\t\t\t\t\t\t\t\t`Delegated task \"${request.description}\" requested unknown agent \"${requestedChildAgent}\". Falling back to profile \"${request.profile}\".`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst childProfileRaw = childCustomSubagent?.profile ?? request.profile;\n\t\t\t\t\t\t\tconst normalizedChildProfile = childProfileRaw.trim().toLowerCase();\n\t\t\t\t\t\t\tconst childProfile =\n\t\t\t\t\t\t\t\tnormalizedChildProfile && toolsByProfile[normalizedChildProfile]\n\t\t\t\t\t\t\t\t\t? normalizedChildProfile\n\t\t\t\t\t\t\t\t\t: \"full\";\n\t\t\t\t\t\t\tconst childProfileLabel = childCustomSubagent?.name\n\t\t\t\t\t\t\t\t? `${childCustomSubagent.name}/${childProfile}`\n\t\t\t\t\t\t\t\t: childProfile;\n\t\t\t\t\t\t\tif (delegateItems[index]) {\n\t\t\t\t\t\t\t\tdelegateItems[index].status = \"running\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\tmessage: `delegating ${index + 1}/${delegateTotal}: ${request.description}`,\n\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\tdelegateIndex: index + 1,\n\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\tdelegateDescription: request.description,\n\t\t\t\t\t\t\t\tdelegateProfile: childProfileLabel,\n\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tlet childTools = childCustomSubagent?.tools\n\t\t\t\t\t\t\t\t? [...childCustomSubagent.tools]\n\t\t\t\t\t\t\t\t: [...(toolsByProfile[childProfile] ?? toolsByProfile.explore)];\n\t\t\t\t\t\t\tif (childCustomSubagent?.disallowedTools?.length) {\n\t\t\t\t\t\t\t\tconst blocked = new Set(childCustomSubagent.disallowedTools);\n\t\t\t\t\t\t\t\tchildTools = childTools.filter((tool) => !blocked.has(tool));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst childBaseSystemPrompt =\n\t\t\t\t\t\t\t\tchildCustomSubagent?.systemPrompt ??\n\t\t\t\t\t\t\t\tsystemPromptByProfile[childProfile] ??\n\t\t\t\t\t\t\t\tsystemPromptByProfile.full;\n\t\t\t\t\t\t\tconst childSystemPrompt = withDelegationPrompt(\n\t\t\t\t\t\t\t\tchildBaseSystemPrompt,\n\t\t\t\t\t\t\t\tMath.max(0, delegationDepth - 1),\n\t\t\t\t\t\t\t\teffectiveMaxDelegations,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst requestedChildCwd = request.cwd\n\t\t\t\t\t\t\t\t\t? path.resolve(subagentCwd, request.cwd)\n\t\t\t\t\t\t\t\t\t: childCustomSubagent?.cwd ?? subagentCwd;\n\t\t\t\t\t\t\t\tif (!existsSync(requestedChildCwd) || !statSync(requestedChildCwd).isDirectory()) {\n\t\t\t\t\t\t\t\t\trecordFailureCause(\"dependency_env\");\n\t\t\t\t\t\t\t\t\tmarkDelegateFailed(\n\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t`delegate ${index + 1}/${delegateTotal} skipped: missing cwd`,\n\t\t\t\t\t\t\t\t\t\t`Delegated task \"${request.description}\" skipped: cwd does not exist (${requestedChildCwd}).`,\n\t\t\t\t\t\t\t\t\t\t\"dependency_env\",\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlet childReleaseLock: (() => void) | undefined;\n\t\t\t\t\t\t\tlet childReleaseIsolation: (() => void) | undefined;\n\t\t\t\t\t\t\tconst explicitChildLock = request.lockKey?.trim();\n\t\t\t\t\t\t\tlet childCwd = requestedChildCwd;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\t\t\t\tif (writeCapableProfiles.has(childProfile) && explicitChildLock) {\n\t\t\t\t\t\t\t\t\tconst lock = getOrCreateWriteLock(explicitChildLock);\n\t\t\t\t\t\t\t\t\tchildReleaseLock = await lock.acquire();\n\t\t\t\t\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (request.isolation === \"worktree\") {\n\t\t\t\t\t\t\t\t\tconst isolated = provisionWorktree(cwd, requestedChildCwd, `${runId}_delegate_${index + 1}`);\n\t\t\t\t\t\t\t\t\tchildCwd = isolated.runCwd;\n\t\t\t\t\t\t\t\t\tchildReleaseIsolation = isolated.cleanup;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tconst delegateMeta = formatMetaCheckpoint(options?.getMetaMessages?.());\n\t\t\t\t\t\t\t\t\tconst childPromptWithInstructions =\n\t\t\t\t\t\t\t\t\t\tchildCustomSubagent?.instructions && childCustomSubagent.instructions.trim().length > 0\n\t\t\t\t\t\t\t\t\t\t\t? `${childCustomSubagent.instructions.trim()}\\n\\nUser task:\\n${request.prompt}`\n\t\t\t\t\t\t\t\t\t\t\t: request.prompt;\n\t\t\t\t\t\t\t\t\tconst delegateSharedMemoryGuidance = buildSharedMemoryGuidance(\n\t\t\t\t\t\t\t\t\t\tsharedMemoryRunId,\n\t\t\t\t\t\t\t\t\t\tsharedMemoryTaskId,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tconst delegatePromptBase = `${childPromptWithInstructions}\\n\\n${delegateSharedMemoryGuidance}`;\n\t\t\t\t\t\t\t\t\tconst delegatePrompt =\n\t\t\t\t\t\t\t\t\t\tdelegateMeta.section && delegateMeta.appliedCount > 0\n\t\t\t\t\t\t\t\t\t\t\t? `${delegatePromptBase}\\n\\n${delegateMeta.section}`\n\t\t\t\t\t\t\t\t\t\t\t: delegatePromptBase;\n\t\t\t\t\t\t\t\t\tif (delegateMeta.appliedCount > 0) {\n\t\t\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\t\t\tmessage: `delegate ${index + 1}/${delegateTotal}: applied ${delegateMeta.appliedCount} meta update(s)`,\n\t\t\t\t\t\t\t\t\t\tcwd: childCwd,\n\t\t\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\t\t\tdelegateIndex: index + 1,\n\t\t\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\t\t\tdelegateDescription: request.description,\n\t\t\t\t\t\t\t\t\t\tdelegateProfile: childProfileLabel,\n\t\t\t\t\t\t\t\t\t\tdelegateItems,\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\t\tconst childModelOverride = request.model?.trim() || childCustomSubagent?.model?.trim() || undefined;\n\t\t\t\t\t\t\t\t\tconst childSharedMemoryContext: SharedMemoryContext = {\n\t\t\t\t\t\t\t\t\t\trootCwd: cwd,\n\t\t\t\t\t\t\t\t\t\trunId: sharedMemoryRunId,\n\t\t\t\t\t\t\t\t\t\ttaskId: sharedMemoryTaskId,\n\t\t\t\t\t\t\t\t\t\tdelegateId: String(index + 1),\n\t\t\t\t\t\t\t\t\t\tprofile: childProfile,\n\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\tlet childOutput = \"\";\n\t\t\t\t\t\t\t\t\tlet childStats: SubagentRunResult[\"stats\"] | undefined;\n\t\t\t\t\t\t\t\t\tlet childEmptyAttempt = 0;\n\t\t\t\t\t\t\t\t\tlet childRetrospectiveAttempt = 0;\n\t\t\t\t\t\t\t\t\tlet childPromptForAttempt = delegatePrompt;\n\t\t\t\t\t\t\t\t\twhile (true) {\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tconst childResult = await runner({\n\t\t\t\t\t\t\t\t\t\t\t\tsystemPrompt: childSystemPrompt,\n\t\t\t\t\t\t\t\t\t\t\t\ttools: childTools,\n\t\t\t\t\t\t\t\t\t\t\t\tprompt: childPromptForAttempt,\n\t\t\t\t\t\t\t\t\t\t\t\tcwd: childCwd,\n\t\t\t\t\t\t\t\t\t\t\t\tmodelOverride: childModelOverride,\n\t\t\t\t\t\t\t\t\t\t\t\tsharedMemoryContext: childSharedMemoryContext,\n\t\t\t\t\t\t\t\t\t\t\t\tsignal: _signal,\n\t\t\t\t\t\t\t\t\t\t\t\tonProgress: (progress) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: `delegate ${index + 1}/${delegateTotal}: ${progress.message}`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcwd: progress.cwd ?? childCwd,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tactiveTool: progress.activeTool,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdelegateIndex: index + 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdelegateDescription: request.description,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdelegateProfile: childProfileLabel,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\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});\n\t\t\t\t\t\t\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\t\t\t\t\t\t\tlet attemptOutput: string;\n\t\t\t\t\t\t\t\t\t\t\tlet attemptStats: SubagentRunResult[\"stats\"] | undefined;\n\t\t\t\t\t\t\t\t\t\t\tif (typeof childResult === \"string\") {\n\t\t\t\t\t\t\t\t\t\t\t\tattemptOutput = childResult;\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tattemptOutput = childResult.output;\n\t\t\t\t\t\t\t\t\t\t\t\tattemptStats = childResult.stats;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tchildStats = mergeRunStats(childStats, attemptStats);\n\t\t\t\t\t\t\t\t\t\t\tif (attemptOutput.trim().length > 0) {\n\t\t\t\t\t\t\t\t\t\t\t\tchildOutput = attemptOutput;\n\t\t\t\t\t\t\t\t\t\t\t\tif (childRetrospectiveAttempt > 0) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tretrospectiveRecovered += 1;\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\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif (childEmptyAttempt >= emptyOutputRetriesFromEnv) {\n\t\t\t\t\t\t\t\t\t\t\t\tconst totalAttempts = childEmptyAttempt + 1;\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t\t\t\t\t`delegate ${index + 1}/${delegateTotal} returned empty output after ${totalAttempts} attempt${totalAttempts === 1 ? \"\" : \"s\"}.`,\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}\n\t\t\t\t\t\t\t\t\t\t\tchildEmptyAttempt += 1;\n\t\t\t\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\t\t\t\t\tmessage: `delegate ${index + 1}/${delegateTotal}: empty output, retry ${childEmptyAttempt}/${emptyOutputRetriesFromEnv}`,\n\t\t\t\t\t\t\t\t\t\t\t\tcwd: childCwd,\n\t\t\t\t\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tdelegateIndex: index + 1,\n\t\t\t\t\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\t\t\t\t\tdelegateDescription: request.description,\n\t\t\t\t\t\t\t\t\t\t\t\tdelegateProfile: childProfileLabel,\n\t\t\t\t\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\t\t\tif (_signal?.aborted || isAbortError(error)) {\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new Error(\"Operation aborted\");\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\t\t\t\t\t\t\tconst cause = classifyFailureCause(message);\n\t\t\t\t\t\t\t\t\t\t\trecordFailureCause(cause);\n\t\t\t\t\t\t\t\t\t\t\tconst canRetryRetrospective =\n\t\t\t\t\t\t\t\t\t\t\t\tchildRetrospectiveAttempt < retrospectiveRetriesFromEnv &&\n\t\t\t\t\t\t\t\t\t\t\t\tisRetrospectiveRetryable(cause);\n\t\t\t\t\t\t\t\t\t\t\tif (!canRetryRetrospective) {\n\t\t\t\t\t\t\t\t\t\t\t\tthrow Object.assign(new Error(message), { failureCause: cause as FailureCause });\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tchildRetrospectiveAttempt += 1;\n\t\t\t\t\t\t\t\t\t\t\tretrospectiveAttempts += 1;\n\t\t\t\t\t\t\t\t\t\t\tconst directive = buildRetrospectiveDirective({\n\t\t\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t\t\t\terrorMessage: message,\n\t\t\t\t\t\t\t\t\t\t\t\tattempt: childRetrospectiveAttempt,\n\t\t\t\t\t\t\t\t\t\t\t\ttarget: \"delegate\",\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\tchildPromptForAttempt = `${delegatePrompt}\\n\\n${directive}`;\n\t\t\t\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\t\t\t\t\tmessage: `delegate ${index + 1}/${delegateTotal}: retrospective retry ${childRetrospectiveAttempt}/${retrospectiveRetriesFromEnv} (${cause})`,\n\t\t\t\t\t\t\t\t\t\t\t\tcwd: childCwd,\n\t\t\t\t\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tdelegateIndex: index + 1,\n\t\t\t\t\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\t\t\t\t\tdelegateDescription: request.description,\n\t\t\t\t\t\t\t\t\t\t\t\tdelegateProfile: childProfileLabel,\n\t\t\t\t\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst parsedChildDelegation = parseDelegationRequests(childOutput, 0);\n\t\t\t\t\t\t\t\tchildOutput = parsedChildDelegation.cleanedOutput;\n\t\t\t\t\t\t\t\tdelegationWarnings.push(\n\t\t\t\t\t\t\t\t\t...parsedChildDelegation.warnings.map((warning) => `Child ${index + 1}: ${warning}`),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tdelegatedSucceeded += 1;\n\t\t\t\t\t\t\t\tif (delegateItems[index]) {\n\t\t\t\t\t\t\t\t\tdelegateItems[index].status = \"done\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdelegatedStats.toolCallsStarted += childStats?.toolCallsStarted ?? 0;\n\t\t\t\t\t\t\t\tdelegatedStats.toolCallsCompleted += childStats?.toolCallsCompleted ?? 0;\n\t\t\t\t\t\t\t\tdelegatedStats.assistantMessages += childStats?.assistantMessages ?? 0;\n\t\t\t\t\t\t\t\tconst normalizedChildOutput = childOutput.trim().length > 0 ? childOutput.trim() : \"(no output)\";\n\t\t\t\t\t\t\t\tconst childOutputExcerpt =\n\t\t\t\t\t\t\t\t\tnormalizedChildOutput.length > maxDelegatedOutputCharsFromEnv\n\t\t\t\t\t\t\t\t\t\t? `${normalizedChildOutput.slice(0, Math.max(1, maxDelegatedOutputCharsFromEnv - 3))}...`\n\t\t\t\t\t\t\t\t\t\t: normalizedChildOutput;\n\t\t\t\t\t\t\t\tdelegatedSections[index] =\n\t\t\t\t\t\t\t\t\t`#### ${index + 1}. ${request.description} (${childProfileLabel})\\n${childOutputExcerpt}`;\n\t\t\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\t\t\tphase: \"running\",\n\t\t\t\t\t\t\t\t\tmessage: `delegate ${index + 1}/${delegateTotal} done`,\n\t\t\t\t\t\t\t\t\tcwd: childCwd,\n\t\t\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\t\t\tdelegateIndex: index + 1,\n\t\t\t\t\t\t\t\t\tdelegateTotal,\n\t\t\t\t\t\t\t\t\tdelegateDescription: request.description,\n\t\t\t\t\t\t\t\t\tdelegateProfile: childProfileLabel,\n\t\t\t\t\t\t\t\t\tdelegateItems,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\t\t\t\t\tif (_signal?.aborted || isAbortError(error)) {\n\t\t\t\t\t\t\t\t\t\tthrow new Error(\"Operation aborted\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tconst classified =\n\t\t\t\t\t\t\t\t\t\terror && typeof error === \"object\" && \"failureCause\" in error\n\t\t\t\t\t\t\t\t\t\t\t? (error.failureCause as FailureCause)\n\t\t\t\t\t\t\t\t\t\t\t: classifyFailureCause(message);\n\t\t\t\t\t\t\t\t\tif (!(error && typeof error === \"object\" && \"failureCause\" in error)) {\n\t\t\t\t\t\t\t\t\t\trecordFailureCause(classified);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tmarkDelegateFailed(\n\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t`delegate ${index + 1}/${delegateTotal} failed`,\n\t\t\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\t\t\tclassified,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\t\tchildReleaseIsolation?.();\n\t\t\t\t\t\t\t\tchildReleaseLock?.();\n\t\t\t\t\t\t\t\tcleanupWriteLock(explicitChildLock);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst resolveBlockedByFailedDependencies = (): boolean => {\n\t\t\t\t\t\t\tlet changed = false;\n\t\t\t\t\t\t\tfor (const index of Array.from(pendingIndices)) {\n\t\t\t\t\t\t\t\tconst deps = normalizedDependsOn[index] ?? [];\n\t\t\t\t\t\t\t\tif (deps.length === 0) continue;\n\t\t\t\t\t\t\t\tconst failedDep = deps.find((dep) => statusOf(dep - 1) === \"failed\");\n\t\t\t\t\t\t\t\tif (!failedDep) continue;\n\t\t\t\t\t\t\t\t\tpendingIndices.delete(index);\n\t\t\t\t\t\t\t\t\trecordFailureCause(\"logic_error\");\n\t\t\t\t\t\t\t\t\tmarkDelegateFailed(\n\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t`delegate ${index + 1}/${delegateTotal} skipped: dependency ${failedDep} failed`,\n\t\t\t\t\t\t\t\t\t\t`Delegated task ${index + 1} skipped because dependency ${failedDep} failed.`,\n\t\t\t\t\t\t\t\t\t\t\"logic_error\",\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn changed;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst launchReadyDelegates = (): boolean => {\n\t\t\t\t\t\t\tlet launched = false;\n\t\t\t\t\t\t\twhile (runningDelegates.size < maxDelegateParallel) {\n\t\t\t\t\t\t\t\tlet nextIndex: number | undefined;\n\t\t\t\t\t\t\t\tfor (const index of pendingIndices) {\n\t\t\t\t\t\t\t\t\tconst deps = normalizedDependsOn[index] ?? [];\n\t\t\t\t\t\t\t\t\tconst allDone = deps.every((dep) => statusOf(dep - 1) === \"done\");\n\t\t\t\t\t\t\t\t\tif (allDone) {\n\t\t\t\t\t\t\t\t\t\tnextIndex = index;\n\t\t\t\t\t\t\t\t\t\tbreak;\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\tif (nextIndex === undefined) {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tpendingIndices.delete(nextIndex);\n\t\t\t\t\t\t\t\tconst promise = runDelegate(nextIndex).finally(() => {\n\t\t\t\t\t\t\t\t\trunningDelegates.delete(nextIndex);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\trunningDelegates.set(nextIndex, promise);\n\t\t\t\t\t\t\t\tlaunched = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn launched;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\twhile (pendingIndices.size > 0 || runningDelegates.size > 0) {\n\t\t\t\t\t\t\tthrowIfAborted();\n\t\t\t\t\t\t\tconst changed = resolveBlockedByFailedDependencies();\n\t\t\t\t\t\t\tconst launched = launchReadyDelegates();\n\t\t\t\t\t\t\tif (runningDelegates.size === 0) {\n\t\t\t\t\t\t\t\tif (pendingIndices.size > 0 && !changed && !launched) {\n\t\t\t\t\t\t\t\t\t\tfor (const index of Array.from(pendingIndices)) {\n\t\t\t\t\t\t\t\t\t\t\tpendingIndices.delete(index);\n\t\t\t\t\t\t\t\t\t\t\tconst deps = normalizedDependsOn[index] ?? [];\n\t\t\t\t\t\t\t\t\t\t\trecordFailureCause(\"logic_error\");\n\t\t\t\t\t\t\t\t\t\t\tmarkDelegateFailed(\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t`delegate ${index + 1}/${delegateTotal} blocked: unresolved depends_on`,\n\t\t\t\t\t\t\t\t\t\t\t\t`Delegated task ${index + 1} blocked by unresolved dependencies: ${deps.join(\", \") || \"unknown\"}.`,\n\t\t\t\t\t\t\t\t\t\t\t\t\"logic_error\",\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\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\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait Promise.race(Array.from(runningDelegates.values()));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\t\t\tif (_signal?.aborted || isAbortError(error)) {\n\t\t\t\t\t\t\t\trecordFailureCause(\"aborted\");\n\t\t\t\t\t\t\t\tconst hasFailureCauses = Object.keys(failureCauses).length > 0;\n\t\t\t\t\t\t\t\tconst details: TaskToolDetails = {\n\t\t\t\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\toutputLength: 0,\n\t\t\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\t\t\t\tlockKey: lockKey?.trim() || undefined,\n\t\t\t\t\t\t\t\t\trunId,\n\t\t\t\t\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\t\t\t\tisolation: useWorktree ? \"worktree\" : \"none\",\n\t\t\t\t\t\t\t\t\tworktreePath,\n\t\t\t\t\t\t\t\t\twaitMs: Date.now() - queuedAt,\n\t\t\t\t\t\t\t\t\tbackground: runInBackground,\n\t\t\t\t\t\t\t\t\ttoolCallsStarted: runStats?.toolCallsStarted ?? latestProgress?.toolCallsStarted,\n\t\t\t\t\t\t\t\t\ttoolCallsCompleted: runStats?.toolCallsCompleted ?? latestProgress?.toolCallsCompleted,\n\t\t\t\t\t\t\t\t\tassistantMessages: runStats?.assistantMessages ?? latestProgress?.assistantMessages,\n\t\t\t\t\t\t\t\t\tdelegatedTasks: delegatedTasks > 0 ? delegatedTasks : undefined,\n\t\t\t\t\t\t\t\t\tdelegatedSucceeded: delegatedTasks > 0 ? delegatedSucceeded : undefined,\n\t\t\t\t\t\t\t\t\tdelegatedFailed: delegatedTasks > 0 ? delegatedFailed : undefined,\n\t\t\t\t\t\t\t\t\tretrospectiveAttempts: retrospectiveAttempts > 0 ? retrospectiveAttempts : undefined,\n\t\t\t\t\t\t\t\t\tretrospectiveRecovered: retrospectiveRecovered > 0 ? retrospectiveRecovered : undefined,\n\t\t\t\t\t\t\t\t\tfailureCauses: hasFailureCauses ? { ...failureCauses } : undefined,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tupdateTrackedTaskStatus(\"cancelled\");\n\t\t\t\t\t\t\t\tthrow Object.assign(new Error(\"Operation aborted\"), {\n\t\t\t\t\t\t\t\t\tdetails,\n\t\t\t\t\t\t\t\t\tfailureCause: \"aborted\" as FailureCause,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst classified =\n\t\t\t\t\t\t\t\terror && typeof error === \"object\" && \"failureCause\" in error\n\t\t\t\t\t\t\t\t\t? (error.failureCause as FailureCause)\n\t\t\t\t\t\t\t\t\t: classifyFailureCause(message);\n\t\t\t\t\t\t\tif (!(error && typeof error === \"object\" && \"failureCause\" in error)) {\n\t\t\t\t\t\t\t\trecordFailureCause(classified);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst hasFailureCauses = Object.keys(failureCauses).length > 0;\n\t\t\t\t\t\t\tconst details: TaskToolDetails = {\n\t\t\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\toutputLength: 0,\n\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\t\tlockKey: lockKey?.trim() || undefined,\n\t\t\t\t\t\t\trunId,\n\t\t\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\t\tisolation: useWorktree ? \"worktree\" : \"none\",\n\t\t\t\t\t\t\tworktreePath,\n\t\t\t\t\t\t\twaitMs: Date.now() - queuedAt,\n\t\t\t\t\t\t\tbackground: runInBackground,\n\t\t\t\t\t\t\ttoolCallsStarted: runStats?.toolCallsStarted ?? latestProgress?.toolCallsStarted,\n\t\t\t\t\t\t\ttoolCallsCompleted: runStats?.toolCallsCompleted ?? latestProgress?.toolCallsCompleted,\n\t\t\t\t\t\t\t\tassistantMessages: runStats?.assistantMessages ?? latestProgress?.assistantMessages,\n\t\t\t\t\t\t\t\tdelegatedTasks: delegatedTasks > 0 ? delegatedTasks : undefined,\n\t\t\t\t\t\t\t\tdelegatedSucceeded: delegatedTasks > 0 ? delegatedSucceeded : undefined,\n\t\t\t\t\t\t\t\tdelegatedFailed: delegatedTasks > 0 ? delegatedFailed : undefined,\n\t\t\t\t\t\t\t\tretrospectiveAttempts: retrospectiveAttempts > 0 ? retrospectiveAttempts : undefined,\n\t\t\t\t\t\t\t\tretrospectiveRecovered: retrospectiveRecovered > 0 ? retrospectiveRecovered : undefined,\n\t\t\t\t\t\t\t\tfailureCauses: hasFailureCauses ? { ...failureCauses } : undefined,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\tupdateTrackedTaskStatus(\"error\");\n\t\t\t\t\t\tthrow Object.assign(new Error(`Subagent failed: ${message}`), { details });\n\t\t\t\t\t}\n\n\t\t\t\t\t\tconst normalizedOutput = output.trim().length > 0 ? output.trim() : \"(Subagent completed with no output)\";\n\t\t\t\t\t\tconst finalSections: string[] = [normalizedOutput];\n\t\t\t\t\t\tif (delegatedTasks > 0) {\n\t\t\t\t\t\t\tconst header = `### Delegated Subtasks (${delegatedSucceeded}/${delegatedTasks} done)`;\n\t\t\t\t\t\tconst delegatedBlocks = delegatedSections.filter(\n\t\t\t\t\t\t\t(section): section is string => typeof section === \"string\" && section.trim().length > 0,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfinalSections.push([header, ...delegatedBlocks].join(\"\\n\\n\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (delegationWarnings.length > 0) {\n\t\t\t\t\t\t\tfinalSections.push(`### Delegation Notes\\n${delegationWarnings.map((w) => `- ${w}`).join(\"\\n\")}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst failureCauseSummary = formatFailureCauseCounts(failureCauses);\n\t\t\t\t\t\tif (retrospectiveAttempts > 0 || failureCauseSummary) {\n\t\t\t\t\t\t\tfinalSections.push(\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\"### Retrospective\",\n\t\t\t\t\t\t\t\t\t`- attempts: ${retrospectiveAttempts}`,\n\t\t\t\t\t\t\t\t\t`- recovered: ${retrospectiveRecovered}`,\n\t\t\t\t\t\t\t\t\t`- failure_causes: ${failureCauseSummary || \"none\"}`,\n\t\t\t\t\t\t\t\t].join(\"\\n\"),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst text = finalSections.join(\"\\n\\n\");\n\t\t\t\t\t\temitProgress({\n\t\t\t\t\t\t\tkind: \"subagent_progress\",\n\t\t\t\t\t\t\tphase: \"responding\",\n\t\t\t\t\t\t\tmessage: delegatedTasks > 0 ? \"aggregating delegated results\" : \"finalizing response\",\n\t\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\t\tactiveTool: undefined,\n\t\t\t\t\t\t\tdelegateIndex: undefined,\n\t\t\t\t\t\t\tdelegateTotal: undefined,\n\t\t\t\t\t\t\tdelegateDescription: undefined,\n\t\t\t\t\t\t\tdelegateProfile: undefined,\n\t\t\t\t\t\t\tdelegateItems: undefined,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst transcriptPath = persistSubagentTranscript({\n\t\t\t\t\t\t\trootCwd: cwd,\n\t\t\t\t\t\trunId,\n\t\t\t\t\t\tdescription,\n\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\tlockKey: lockKey?.trim() || undefined,\n\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\tsubagentCwd,\n\t\t\t\t\t\tsessionId: subagentSessionId,\n\t\t\t\t\t\tprompt: promptWithInstructions,\n\t\t\t\t\t\toutput: text,\n\t\t\t\t\t\t\tisolation: useWorktree ? \"worktree\" : \"none\",\n\t\t\t\t\t\t\tworktreePath,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst hasFailureCauses = Object.keys(failureCauses).length > 0;\n\t\t\t\t\t\tconst details: TaskToolDetails = {\n\t\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\toutputLength: text.length,\n\t\t\t\t\t\tcwd: subagentCwd,\n\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\tlockKey: lockKey?.trim() || undefined,\n\t\t\t\t\t\trunId,\n\t\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\tsubagentSessionId,\n\t\t\t\t\t\ttranscriptPath,\n\t\t\t\t\t\tisolation: useWorktree ? \"worktree\" : \"none\",\n\t\t\t\t\t\tworktreePath,\n\t\t\t\t\t\twaitMs: Date.now() - queuedAt,\n\t\t\t\t\t\tbackground: runInBackground,\n\t\t\t\t\t\ttoolCallsStarted:\n\t\t\t\t\t\t\ttypeof (runStats?.toolCallsStarted ?? latestProgress?.toolCallsStarted) === \"number\"\n\t\t\t\t\t\t\t\t? (runStats?.toolCallsStarted ?? latestProgress?.toolCallsStarted ?? 0) +\n\t\t\t\t\t\t\t\t\tdelegatedStats.toolCallsStarted\n\t\t\t\t\t\t\t\t: delegatedStats.toolCallsStarted > 0\n\t\t\t\t\t\t\t\t\t? delegatedStats.toolCallsStarted\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\ttoolCallsCompleted:\n\t\t\t\t\t\t\ttypeof (runStats?.toolCallsCompleted ?? latestProgress?.toolCallsCompleted) === \"number\"\n\t\t\t\t\t\t\t\t? (runStats?.toolCallsCompleted ?? latestProgress?.toolCallsCompleted ?? 0) +\n\t\t\t\t\t\t\t\t\tdelegatedStats.toolCallsCompleted\n\t\t\t\t\t\t\t\t: delegatedStats.toolCallsCompleted > 0\n\t\t\t\t\t\t\t\t\t? delegatedStats.toolCallsCompleted\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tassistantMessages:\n\t\t\t\t\t\t\ttypeof (runStats?.assistantMessages ?? latestProgress?.assistantMessages) === \"number\"\n\t\t\t\t\t\t\t\t? (runStats?.assistantMessages ?? latestProgress?.assistantMessages ?? 0) +\n\t\t\t\t\t\t\t\t\tdelegatedStats.assistantMessages\n\t\t\t\t\t\t\t\t: delegatedStats.assistantMessages > 0\n\t\t\t\t\t\t\t\t\t? delegatedStats.assistantMessages\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\tdelegatedTasks: delegatedTasks > 0 ? delegatedTasks : undefined,\n\t\t\t\t\t\t\tdelegatedSucceeded: delegatedTasks > 0 ? delegatedSucceeded : undefined,\n\t\t\t\t\t\t\tdelegatedFailed: delegatedTasks > 0 ? delegatedFailed : undefined,\n\t\t\t\t\t\t\tretrospectiveAttempts: retrospectiveAttempts > 0 ? retrospectiveAttempts : undefined,\n\t\t\t\t\t\t\tretrospectiveRecovered: retrospectiveRecovered > 0 ? retrospectiveRecovered : undefined,\n\t\t\t\t\t\t\tfailureCauses: hasFailureCauses ? { ...failureCauses } : undefined,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tupdateTrackedTaskStatus(\"done\");\n\t\t\t\t\t\treturn { text, details };\n\t\t\t\t\t} finally {\n\t\t\t\t\treleaseIsolation?.();\n\t\t\t\t\treleaseWriteLock?.();\n\t\t\t\t\tcleanupWriteLock(explicitRootLockKey);\n\t\t\t\t\treleaseSlot?.();\n\t\t\t\t\treleaseRunSlot?.();\n\t\t\t\t\tif (orchestrationRunId) {\n\t\t\t\t\t\tcleanupOrchestrationSemaphore(cwd, orchestrationRunId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tif (runInBackground) {\n\t\t\t\tconst now = new Date().toISOString();\n\t\t\t\tconst queuedStatusPath = writeBackgroundRunStatus(cwd, {\n\t\t\t\t\trunId,\n\t\t\t\t\tstatus: \"queued\",\n\t\t\t\t\tcreatedAt: now,\n\t\t\t\t\tdescription,\n\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\tcwd: requestedSubagentCwd,\n\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t});\n\t\t\t\tvoid (async () => {\n\t\t\t\t\twriteBackgroundRunStatus(cwd, {\n\t\t\t\t\t\trunId,\n\t\t\t\t\t\tstatus: \"running\",\n\t\t\t\t\t\tcreatedAt: now,\n\t\t\t\t\t\tstartedAt: new Date().toISOString(),\n\t\t\t\t\t\tdescription,\n\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\tcwd: requestedSubagentCwd,\n\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t});\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await executeSubagent();\n\t\t\t\t\t\twriteBackgroundRunStatus(cwd, {\n\t\t\t\t\t\t\trunId,\n\t\t\t\t\t\t\tstatus: \"done\",\n\t\t\t\t\t\t\tcreatedAt: now,\n\t\t\t\t\t\t\tfinishedAt: new Date().toISOString(),\n\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\t\tcwd: result.details.cwd,\n\t\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\t\ttranscriptPath: result.details.transcriptPath,\n\t\t\t\t\t\t});\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tconst aborted = isAbortError(error);\n\t\t\t\t\t\t\twriteBackgroundRunStatus(cwd, {\n\t\t\t\t\t\t\t\trunId,\n\t\t\t\t\t\t\t\tstatus: aborted ? \"cancelled\" : \"error\",\n\t\t\t\t\t\t\t\tcreatedAt: now,\n\t\t\t\t\t\t\t\tfinishedAt: new Date().toISOString(),\n\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\t\tcwd: requestedSubagentCwd,\n\t\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\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: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `Started background subagent run ${runId}. Check .iosm/subagents/background and /subagent-runs for results.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tprofile: effectiveProfile,\n\t\t\t\t\t\tdescription,\n\t\t\t\t\t\toutputLength: 0,\n\t\t\t\t\t\tcwd: requestedSubagentCwd,\n\t\t\t\t\t\tagent: customSubagent?.name,\n\t\t\t\t\t\tlockKey: lockKey?.trim() || undefined,\n\t\t\t\t\t\trunId,\n\t\t\t\t\t\ttaskId: orchestrationTaskId,\n\t\t\t\t\t\tmodel: effectiveModelOverride,\n\t\t\t\t\t\tbackground: true,\n\t\t\t\t\t\tbackgroundStatusPath: queuedStatusPath,\n\t\t\t\t\t\twaitMs: Date.now() - queuedAt,\n\t\t\t\t\t\tisolation: useWorktree ? \"worktree\" : \"none\",\n\t\t\t\t\t\ttoolCallsStarted: latestProgress?.toolCallsStarted,\n\t\t\t\t\t\ttoolCallsCompleted: latestProgress?.toolCallsCompleted,\n\t\t\t\t\t\tassistantMessages: latestProgress?.assistantMessages,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst result = await executeSubagent();\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text: result.text }],\n\t\t\t\tdetails: result.details,\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
|
|
@@ -16,6 +16,7 @@ export declare class LoginDialogComponent extends Container implements Focusable
|
|
|
16
16
|
constructor(tui: TUI, providerId: string, onComplete: (success: boolean, message?: string) => void);
|
|
17
17
|
get signal(): AbortSignal;
|
|
18
18
|
private cancel;
|
|
19
|
+
private tryOpenBrowser;
|
|
19
20
|
/**
|
|
20
21
|
* Called by onAuth callback - show URL and optional instructions
|
|
21
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-dialog.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/login-dialog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAA6C,KAAK,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAMtH;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,SAAU,YAAW,SAAS;IAqBtE,OAAO,CAAC,UAAU;IApBnB,OAAO,CAAC,gBAAgB,CAAY;IACpC,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,aAAa,CAAC,CAA0B;IAChD,OAAO,CAAC,aAAa,CAAC,CAAyB;IAG/C,OAAO,CAAC,QAAQ,CAAS;IACzB,IAAI,OAAO,IAAI,OAAO,CAErB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAGzB;gBAGA,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,MAAM,EACV,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI;IAmCjE,IAAI,MAAM,IAAI,WAAW,CAExB;IAED,OAAO,CAAC,MAAM;IAUd;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"login-dialog.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/login-dialog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAA6C,KAAK,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAMtH;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,SAAU,YAAW,SAAS;IAqBtE,OAAO,CAAC,UAAU;IApBnB,OAAO,CAAC,gBAAgB,CAA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