@ashx-j/lunr 0.2.11 → 0.2.13
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/CHANGELOG.md +13 -0
- package/README.md +211 -236
- package/dist/builtin-extensions/ashxj-tui.d.ts +3 -0
- package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.js +28 -11
- package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +0 -2
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/lunr-cron.d.ts +1 -1
- package/dist/builtin-extensions/lunr-cron.d.ts.map +1 -1
- package/dist/builtin-extensions/lunr-cron.js +1 -1
- package/dist/builtin-extensions/lunr-cron.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.js +3 -3
- package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/doctor.d.ts +0 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/doctor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/doctor.js +1 -23
- package/dist/builtin-extensions/pi-subagents/src/extension/doctor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js +6 -7
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +7 -14
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts +12 -9
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +38 -34
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +3 -3
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +32 -47
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +7 -10
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +90 -109
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts +3 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js +37 -50
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.d.ts +4 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.js +5 -5
- package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +31 -13
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts +4 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +48 -20
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +90 -64
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts +6 -8
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +262 -161
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js +24 -33
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +25 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +51 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.js +20 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts +4 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +5 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +9 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +2 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js +20 -17
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts +70 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +153 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.d.ts +13 -8
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.js +20 -51
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +80 -20
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js +10 -2
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +20 -32
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +23 -449
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +13 -11
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.js +18 -17
- package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.js.map +1 -1
- package/dist/builtin-extensions/simple-pi-memory.d.ts +2 -2
- package/dist/builtin-extensions/simple-pi-memory.d.ts.map +1 -1
- package/dist/builtin-extensions/simple-pi-memory.js +41 -17
- package/dist/builtin-extensions/simple-pi-memory.js.map +1 -1
- package/dist/catalog/models.json +1 -1
- package/dist/catalog/providers/amazon-bedrock.json +1 -1
- package/dist/catalog/providers/azure-openai-responses.json +1 -1
- package/dist/catalog/providers/cloudflare-ai-gateway.json +1 -1
- package/dist/catalog/providers/cloudflare-workers-ai.json +1 -1
- package/dist/catalog/providers/fireworks.json +1 -1
- package/dist/catalog/providers/github-copilot.json +1 -1
- package/dist/catalog/providers/huggingface.json +1 -1
- package/dist/catalog/providers/minimax-cn.json +1 -1
- package/dist/catalog/providers/minimax.json +1 -1
- package/dist/catalog/providers/mistral.json +1 -1
- package/dist/catalog/providers/nvidia.json +1 -1
- package/dist/catalog/providers/openai.json +1 -1
- package/dist/catalog/providers/opencode-go.json +1 -1
- package/dist/catalog/providers/opencode.json +1 -1
- package/dist/catalog/providers/openrouter.json +1 -1
- package/dist/catalog/providers/qwen-cloud-cn.json +1 -1
- package/dist/catalog/providers/qwen-cloud.json +1 -1
- package/dist/catalog/providers/qwen-token-plan-cn.json +1 -1
- package/dist/catalog/providers/qwen-token-plan.json +1 -1
- package/dist/catalog/providers/together.json +1 -1
- package/dist/catalog/providers/vercel-ai-gateway.json +1 -1
- package/dist/catalog/providers/zai-coding-cn.json +1 -1
- package/dist/catalog/providers/zai.json +1 -1
- package/dist/catalog/publication.json +3 -3
- package/dist/core/agent-session.d.ts +7 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +34 -4
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/context-breakdown.d.ts +3 -1
- package/dist/core/context-breakdown.d.ts.map +1 -1
- package/dist/core/context-breakdown.js +5 -2
- package/dist/core/context-breakdown.js.map +1 -1
- package/dist/core/customize.d.ts +2 -0
- package/dist/core/customize.d.ts.map +1 -1
- package/dist/core/customize.js +6 -0
- package/dist/core/customize.js.map +1 -1
- package/dist/core/memory-cap.d.ts +4 -8
- package/dist/core/memory-cap.d.ts.map +1 -1
- package/dist/core/memory-cap.js +8 -8
- package/dist/core/memory-cap.js.map +1 -1
- package/dist/core/permissions.d.ts +2 -0
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +30 -14
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +1 -9
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/rollback.d.ts.map +1 -1
- package/dist/core/rollback.js +1 -1
- package/dist/core/rollback.js.map +1 -1
- package/dist/core/settings-manager.d.ts +16 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +37 -10
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -5
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/subagent-permission-inherit.d.ts +34 -22
- package/dist/core/subagent-permission-inherit.d.ts.map +1 -1
- package/dist/core/subagent-permission-inherit.js +37 -80
- package/dist/core/subagent-permission-inherit.js.map +1 -1
- package/dist/core/swarm.d.ts.map +1 -1
- package/dist/core/swarm.js +13 -7
- package/dist/core/swarm.js.map +1 -1
- package/dist/core/system-prompt.d.ts +6 -4
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +38 -48
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/usage-adapters/openai-codex.d.ts +1 -1
- package/dist/core/usage-adapters/openai-codex.d.ts.map +1 -1
- package/dist/core/usage-adapters/openai-codex.js +22 -17
- package/dist/core/usage-adapters/openai-codex.js.map +1 -1
- package/dist/core/usage-service.d.ts +10 -1
- package/dist/core/usage-service.d.ts.map +1 -1
- package/dist/core/usage-service.js +17 -6
- package/dist/core/usage-service.js.map +1 -1
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +1 -4
- package/dist/gateway/agent-bridge.js.map +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +1 -4
- package/dist/gateway/cron.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +0 -5
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +2 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +21 -0
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +7 -4
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +122 -162
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/usage-view.d.ts +1 -1
- package/dist/modes/interactive/components/usage-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/usage-view.js +7 -4
- package/dist/modes/interactive/components/usage-view.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +55 -96
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/skill-tag-autocomplete.d.ts +13 -0
- package/dist/modes/interactive/skill-tag-autocomplete.d.ts.map +1 -0
- package/dist/modes/interactive/skill-tag-autocomplete.js +72 -0
- package/dist/modes/interactive/skill-tag-autocomplete.js.map +1 -0
- package/docs/compaction.md +23 -23
- package/docs/containerization.md +24 -24
- package/docs/custom-provider.md +18 -18
- package/docs/development.md +16 -15
- package/docs/docs.json +6 -2
- package/docs/extensions.md +82 -80
- package/docs/features.md +102 -0
- package/docs/index.md +25 -19
- package/docs/json.md +7 -7
- package/docs/keybindings.md +4 -4
- package/docs/models.md +2 -2
- package/docs/packages.md +38 -42
- package/docs/prompt-templates.md +4 -4
- package/docs/providers.md +22 -10
- package/docs/quickstart.md +81 -46
- package/docs/rpc.md +7 -13
- package/docs/sdk.md +43 -41
- package/docs/security.md +18 -18
- package/docs/session-format.md +9 -9
- package/docs/sessions.md +13 -12
- package/docs/settings.md +63 -24
- package/docs/shell-aliases.md +2 -2
- package/docs/skills.md +21 -11
- package/docs/terminal-setup.md +5 -5
- package/docs/termux.md +7 -7
- package/docs/themes.md +12 -14
- package/docs/tmux.md +4 -4
- package/docs/tui.md +23 -23
- package/docs/usage.md +112 -87
- package/docs/windows.md +10 -2
- package/examples/README.md +3 -1
- package/examples/extensions/README.md +6 -6
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/doom-overlay/README.md +2 -2
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/plan-mode/README.md +3 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/README.md +13 -11
- package/examples/extensions/todo.ts +2 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/README.md +9 -5
- package/package.json +6 -7
- package/dist/builtin-extensions/lunr-behavior.d.ts +0 -44
- package/dist/builtin-extensions/lunr-behavior.d.ts.map +0 -1
- package/dist/builtin-extensions/lunr-behavior.js +0 -213
- package/dist/builtin-extensions/lunr-behavior.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/agents/context-builder.md +0 -46
- package/dist/builtin-extensions/pi-subagents/agents/deep-researcher.md +0 -36
- package/dist/builtin-extensions/pi-subagents/agents/delegate.md +0 -12
- package/dist/builtin-extensions/pi-subagents/agents/oracle.md +0 -73
- package/dist/builtin-extensions/pi-subagents/agents/planner.md +0 -55
- package/dist/builtin-extensions/pi-subagents/agents/research-writer.md +0 -37
- package/dist/builtin-extensions/pi-subagents/agents/researcher.md +0 -52
- package/dist/builtin-extensions/pi-subagents/agents/reviewer.md +0 -79
- package/dist/builtin-extensions/pi-subagents/agents/scout.md +0 -50
- package/dist/builtin-extensions/pi-subagents/agents/worker.md +0 -55
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.d.ts +0 -20
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.js +0 -1273
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.d.ts +0 -49
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.js +0 -252
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.d.ts +0 -3
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.js +0 -6
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.d.ts +0 -3
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.js +0 -23
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.d.ts +0 -8
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.js +0 -143
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agents.d.ts +0 -176
- package/dist/builtin-extensions/pi-subagents/src/agents/agents.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agents.js +0 -1326
- package/dist/builtin-extensions/pi-subagents/src/agents/agents.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.d.ts +0 -7
- package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.js +0 -307
- package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/identity.d.ts +0 -8
- package/dist/builtin-extensions/pi-subagents/src/agents/identity.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/identity.js +0 -30
- package/dist/builtin-extensions/pi-subagents/src/agents/identity.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.d.ts +0 -35
- package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.js +0 -151
- package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.js.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.d.ts +0 -131
- package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.d.ts.map +0 -1
- package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.js +0 -491
- package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.js.map +0 -1
- package/dist/core/behavior-preset.d.ts +0 -60
- package/dist/core/behavior-preset.d.ts.map +0 -1
- package/dist/core/behavior-preset.js +0 -257
- package/dist/core/behavior-preset.js.map +0 -1
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
import * as path from "node:path";
|
|
5
|
-
import {
|
|
5
|
+
import { snapshotParentPermissionMode } from "../../../../../core/subagent-permission-inherit.js";
|
|
6
|
+
import { normalizeChildSpec } from "../../shared/child-spec.js";
|
|
6
7
|
import { getArtifactsDir, getProjectChainRunsDir } from "../../shared/artifacts.js";
|
|
7
8
|
import { ChainClarifyComponent } from "./chain-clarify.js";
|
|
8
9
|
import { toModelInfo } from "../../shared/model-info.js";
|
|
9
10
|
import { executeChain } from "./chain-execution.js";
|
|
10
|
-
import { resolveExecutionAgentScope } from "../../agents/agent-scope.js";
|
|
11
|
-
import { handleManagementAction } from "../../agents/agent-management.js";
|
|
12
11
|
import { buildDoctorReport } from "../../extension/doctor.js";
|
|
13
12
|
import { clearPendingForegroundControlNotices } from "../../extension/control-notices.js";
|
|
14
13
|
import { runSync } from "./execution.js";
|
|
@@ -33,7 +32,7 @@ import { finalizeSingleOutput, injectSingleOutputInstruction, normalizeSingleOut
|
|
|
33
32
|
import { compactForegroundDetails, getSingleResultOutput, mapConcurrent, readStatus, resolveChildCwd, sumResultsCost, sumResultsUsage } from "../../shared/utils.js";
|
|
34
33
|
import { DEFAULT_GLOBAL_CONCURRENCY_LIMIT, Semaphore } from "../shared/parallel-utils.js";
|
|
35
34
|
import { attachNestedChildrenToResultChildren, buildSubagentResultIntercomPayload, deliverSubagentIntercomMessageEvent, deliverSubagentResultIntercomEvent, formatSubagentResultReceipt, resolveSubagentResultStatus, stripDetailsOutputsForIntercomReceipt, } from "../../intercom/result-intercom.js";
|
|
36
|
-
import {
|
|
35
|
+
import { buildRevivedAsyncTask, interruptLiveAsyncResumeTarget, resolveAsyncResumeTarget, resolveAsyncRunLocation } from "../background/async-resume.js";
|
|
37
36
|
import { deliverInterruptRequest, deliverStopRequest, requestAsyncSteer } from "../background/control-channel.js";
|
|
38
37
|
import { waitForSteeringAction } from "../background/steering.js";
|
|
39
38
|
import { steerAsyncRun } from "./async-steering-action.js";
|
|
@@ -591,19 +590,24 @@ function appendStepToAsyncChain(input) {
|
|
|
591
590
|
details: { mode: "management", results: [] },
|
|
592
591
|
};
|
|
593
592
|
}
|
|
594
|
-
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
593
|
+
let appendParams;
|
|
594
|
+
const appendChildRunId = `${resolved.id}-append-${randomUUID().slice(0, 8)}`;
|
|
595
|
+
try {
|
|
596
|
+
appendParams = internalizePromptDrivenChildren(input.params, {
|
|
597
|
+
runId: appendChildRunId,
|
|
598
|
+
parentMode: snapshotParentPermissionMode(input.deps.state.currentSessionId),
|
|
599
|
+
dynamicFanoutMaxItems: input.deps.config.chain?.dynamicFanout?.maxItems,
|
|
600
|
+
}).params;
|
|
601
|
+
}
|
|
602
|
+
catch (error) {
|
|
599
603
|
return {
|
|
600
|
-
content: [{ type: "text", text:
|
|
604
|
+
content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }],
|
|
601
605
|
isError: true,
|
|
602
606
|
details: { mode: "management", results: [] },
|
|
603
607
|
};
|
|
604
608
|
}
|
|
605
|
-
const contextPolicy = resolveExplicitContextPolicy(
|
|
606
|
-
const chainSkillInput = normalizeSkillInput(
|
|
609
|
+
const contextPolicy = resolveExplicitContextPolicy(appendParams);
|
|
610
|
+
const chainSkillInput = normalizeSkillInput(appendParams.skill);
|
|
607
611
|
const chainSkills = chainSkillInput === false ? [] : (chainSkillInput ?? []);
|
|
608
612
|
const asyncCtx = {
|
|
609
613
|
pi: input.deps.pi,
|
|
@@ -612,13 +616,12 @@ function appendStepToAsyncChain(input) {
|
|
|
612
616
|
parentSessionId: input.ctx.sessionManager.getSessionId() ?? undefined,
|
|
613
617
|
currentModelProvider: input.ctx.model?.provider,
|
|
614
618
|
currentModel: input.ctx.model,
|
|
615
|
-
modelScope:
|
|
619
|
+
modelScope: undefined,
|
|
616
620
|
};
|
|
617
621
|
const built = buildAsyncRunnerSteps(resolved.id, {
|
|
618
|
-
chain: wrapChainTasksForFork(
|
|
619
|
-
task:
|
|
622
|
+
chain: wrapChainTasksForFork(appendParams.chain, contextPolicy),
|
|
623
|
+
task: appendParams.task,
|
|
620
624
|
resultMode: "chain",
|
|
621
|
-
agents,
|
|
622
625
|
ctx: asyncCtx,
|
|
623
626
|
availableModels: input.ctx.modelRegistry.getAvailable().map(toModelInfo),
|
|
624
627
|
cwd: status.cwd ?? input.requestCwd,
|
|
@@ -627,6 +630,7 @@ function appendStepToAsyncChain(input) {
|
|
|
627
630
|
maxSubagentDepth: resolveCurrentMaxSubagentDepth(input.deps.config.maxSubagentDepth),
|
|
628
631
|
waitToolEnabled: input.deps.waitToolEnabled,
|
|
629
632
|
asyncDir: resolved.location.asyncDir,
|
|
633
|
+
childIdRunId: appendChildRunId,
|
|
630
634
|
validateOutputBindings: false,
|
|
631
635
|
});
|
|
632
636
|
if ("error" in built) {
|
|
@@ -947,38 +951,14 @@ async function resumeAsyncRun(input) {
|
|
|
947
951
|
}
|
|
948
952
|
input.deps.state.currentSessionId = resolveCurrentSessionId(input.ctx.sessionManager);
|
|
949
953
|
const effectiveCwd = target.cwd ?? input.requestCwd;
|
|
950
|
-
const
|
|
951
|
-
const discovered = input.deps.discoverAgents(effectiveCwd, scope);
|
|
952
|
-
const discoveredAgents = discovered.agents;
|
|
953
|
-
const modelScope = discovered.modelScope;
|
|
954
|
+
const modelScope = undefined;
|
|
954
955
|
const sessionName = resolveIntercomSessionTarget(input.deps.pi.getSessionName(), input.ctx.sessionManager.getSessionId());
|
|
955
956
|
const intercomBridge = resolveIntercomBridge({
|
|
956
957
|
config: input.deps.config.intercomBridge,
|
|
957
958
|
context: input.params.context,
|
|
958
959
|
orchestratorTarget: sessionName,
|
|
959
960
|
});
|
|
960
|
-
const agents = intercomBridge.active
|
|
961
|
-
? discoveredAgents.map((agent) => applyIntercomBridgeToAgent(agent, intercomBridge))
|
|
962
|
-
: discoveredAgents;
|
|
963
961
|
const recoveryDescriptor = "recoveryDescriptor" in target ? target.recoveryDescriptor : undefined;
|
|
964
|
-
const discoveredAgentConfig = agents.find((agent) => agent.name === target.agent);
|
|
965
|
-
const agentConfig = discoveredAgentConfig ?? (recoveryDescriptor ? {
|
|
966
|
-
name: recoveryDescriptor.agent,
|
|
967
|
-
description: "Persisted async recovery contract",
|
|
968
|
-
systemPrompt: "",
|
|
969
|
-
systemPromptMode: recoveryDescriptor.systemPromptMode,
|
|
970
|
-
inheritProjectContext: recoveryDescriptor.inheritProjectContext,
|
|
971
|
-
inheritSkills: recoveryDescriptor.inheritSkills,
|
|
972
|
-
source: "project",
|
|
973
|
-
filePath: recoveryDescriptor.agentFilePath ?? path.join(recoveryDescriptor.cwd, ".pi-subagents-recovery-agent"),
|
|
974
|
-
} : undefined);
|
|
975
|
-
if (!agentConfig) {
|
|
976
|
-
return {
|
|
977
|
-
content: [{ type: "text", text: `Unknown agent for resume: ${target.agent}` }],
|
|
978
|
-
isError: true,
|
|
979
|
-
details: { mode: "management", results: [] },
|
|
980
|
-
};
|
|
981
|
-
}
|
|
982
962
|
if (attachChain) {
|
|
983
963
|
if (target.source !== "async") {
|
|
984
964
|
return {
|
|
@@ -1014,7 +994,6 @@ async function resumeAsyncRun(input) {
|
|
|
1014
994
|
agent: target.agent,
|
|
1015
995
|
label: `Attached ${target.runId}`,
|
|
1016
996
|
},
|
|
1017
|
-
agents,
|
|
1018
997
|
ctx: {
|
|
1019
998
|
pi: input.deps.pi,
|
|
1020
999
|
cwd: input.requestCwd,
|
|
@@ -1056,15 +1035,35 @@ async function resumeAsyncRun(input) {
|
|
|
1056
1035
|
return { content: [{ type: "text", text: formatAsyncStartedMessage(lines.join("\n")) }], details: result.details };
|
|
1057
1036
|
}
|
|
1058
1037
|
const runId = randomUUID().slice(0, 8);
|
|
1059
|
-
const recoveryAgentConfig = recoveryDescriptor ? applySteeringRecoveryAgentConfig(agentConfig, recoveryDescriptor) : agentConfig;
|
|
1060
1038
|
const artifactConfig = recoveryDescriptor?.artifactConfig ?? { ...DEFAULT_ARTIFACT_CONFIG, enabled: input.params.artifacts !== false };
|
|
1061
1039
|
const artifactsDir = recoveryDescriptor?.artifactsDir ?? getArtifactsDir(parentSessionFile, effectiveCwd);
|
|
1062
1040
|
const availableModels = input.ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
1041
|
+
let recoverySpec;
|
|
1042
|
+
try {
|
|
1043
|
+
recoverySpec = normalizeChildSpec({
|
|
1044
|
+
task: buildRevivedAsyncTask(target, followUp),
|
|
1045
|
+
description: recoveryDescriptor?.description ?? target.description ?? target.agent,
|
|
1046
|
+
permissions: recoveryDescriptor?.permissions ?? target.permissions ?? "read-only",
|
|
1047
|
+
model: input.params.model ?? recoveryDescriptor?.model ?? target.model,
|
|
1048
|
+
skill: recoveryDescriptor?.skills,
|
|
1049
|
+
cwd: effectiveCwd,
|
|
1050
|
+
output: recoveryDescriptor?.outputPath,
|
|
1051
|
+
outputMode: recoveryDescriptor?.outputMode,
|
|
1052
|
+
acceptance: input.params.acceptance ?? recoveryDescriptor?.acceptance,
|
|
1053
|
+
toolBudget: recoveryDescriptor?.initialToolBudget,
|
|
1054
|
+
}, {
|
|
1055
|
+
parentMode: snapshotParentPermissionMode(input.deps.state.currentSessionId),
|
|
1056
|
+
runId,
|
|
1057
|
+
index: 0,
|
|
1058
|
+
childId: recoveryDescriptor?.childId ?? target.childId ?? `${runId}-0`,
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
catch (error) {
|
|
1062
|
+
return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true, details: { mode: "management", results: [] } };
|
|
1063
|
+
}
|
|
1063
1064
|
const result = executeAsyncSingle(runId, {
|
|
1064
|
-
|
|
1065
|
-
task: buildRevivedAsyncTask(target, followUp),
|
|
1065
|
+
spec: recoverySpec,
|
|
1066
1066
|
goal: followUp,
|
|
1067
|
-
agentConfig: recoveryAgentConfig,
|
|
1068
1067
|
ctx: {
|
|
1069
1068
|
pi: input.deps.pi,
|
|
1070
1069
|
cwd: input.requestCwd,
|
|
@@ -1200,13 +1199,13 @@ async function maybeBuildForegroundIntercomReceipt(input) {
|
|
|
1200
1199
|
details: stripDetailsOutputsForIntercomReceipt(input.details),
|
|
1201
1200
|
};
|
|
1202
1201
|
}
|
|
1203
|
-
function validateExecutionInput(params,
|
|
1202
|
+
function validateExecutionInput(params, hasChain, hasTasks, hasSingle, allowClarifyTaskPrompt) {
|
|
1204
1203
|
if (Number(hasChain) + Number(hasTasks) + Number(hasSingle) !== 1) {
|
|
1205
1204
|
return {
|
|
1206
1205
|
content: [
|
|
1207
1206
|
{
|
|
1208
1207
|
type: "text",
|
|
1209
|
-
text:
|
|
1208
|
+
text: "Provide exactly one mode: { task, description, permissions? }, { tasks: [...] }, or { chain: [...] }.",
|
|
1210
1209
|
},
|
|
1211
1210
|
],
|
|
1212
1211
|
isError: true,
|
|
@@ -1221,9 +1220,9 @@ function validateExecutionInput(params, agents, hasChain, hasTasks, hasSingle, a
|
|
|
1221
1220
|
details: { mode: getRequestedModeLabel(params), results: [] },
|
|
1222
1221
|
};
|
|
1223
1222
|
}
|
|
1224
|
-
if (hasSingle &&
|
|
1223
|
+
if (hasSingle && !params.description) {
|
|
1225
1224
|
return {
|
|
1226
|
-
content: [{ type: "text", text:
|
|
1225
|
+
content: [{ type: "text", text: "description is required and must be a concise single-line label (max 80 characters)." }],
|
|
1227
1226
|
isError: true,
|
|
1228
1227
|
details: { mode: "single", results: [] },
|
|
1229
1228
|
};
|
|
@@ -1231,9 +1230,9 @@ function validateExecutionInput(params, agents, hasChain, hasTasks, hasSingle, a
|
|
|
1231
1230
|
if (hasTasks && params.tasks) {
|
|
1232
1231
|
for (let i = 0; i < params.tasks.length; i++) {
|
|
1233
1232
|
const task = params.tasks[i];
|
|
1234
|
-
if (!
|
|
1233
|
+
if (!task.description) {
|
|
1235
1234
|
return {
|
|
1236
|
-
content: [{ type: "text", text: `
|
|
1235
|
+
content: [{ type: "text", text: `description is required (task ${i + 1})` }],
|
|
1237
1236
|
isError: true,
|
|
1238
1237
|
details: { mode: "parallel", results: [] },
|
|
1239
1238
|
};
|
|
@@ -1275,11 +1274,18 @@ function validateExecutionInput(params, agents, hasChain, hasTasks, hasSingle, a
|
|
|
1275
1274
|
}
|
|
1276
1275
|
for (let i = 0; i < params.chain.length; i++) {
|
|
1277
1276
|
const step = params.chain[i];
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1277
|
+
if (!isParallelStep(step) && !isDynamicParallelStep(step) && !step.description) {
|
|
1278
|
+
return {
|
|
1279
|
+
content: [{ type: "text", text: `description is required (step ${i + 1})` }],
|
|
1280
|
+
isError: true,
|
|
1281
|
+
details: { mode: "chain", results: [] },
|
|
1282
|
+
};
|
|
1283
|
+
}
|
|
1284
|
+
if (isParallelStep(step)) {
|
|
1285
|
+
const missing = step.parallel.findIndex((t) => !t.description);
|
|
1286
|
+
if (missing !== -1) {
|
|
1281
1287
|
return {
|
|
1282
|
-
content: [{ type: "text", text: `
|
|
1288
|
+
content: [{ type: "text", text: `description is required (step ${i + 1}, parallel task ${missing + 1})` }],
|
|
1283
1289
|
isError: true,
|
|
1284
1290
|
details: { mode: "chain", results: [] },
|
|
1285
1291
|
};
|
|
@@ -1319,11 +1325,11 @@ function getRequestedModeLabel(params) {
|
|
|
1319
1325
|
return "chain";
|
|
1320
1326
|
if ((params.tasks?.length ?? 0) > 0)
|
|
1321
1327
|
return "parallel";
|
|
1322
|
-
if (params.
|
|
1328
|
+
if (params.task)
|
|
1323
1329
|
return "single";
|
|
1324
1330
|
return "single";
|
|
1325
1331
|
}
|
|
1326
|
-
function resolveAgentDefaultContextPolicy(params
|
|
1332
|
+
function resolveAgentDefaultContextPolicy(params) {
|
|
1327
1333
|
// lunr: hide fork from the model; force every child to fresh. Fork internals stay.
|
|
1328
1334
|
return lunrContextPolicy(params);
|
|
1329
1335
|
}
|
|
@@ -1331,23 +1337,6 @@ function resolveExplicitContextPolicy(params) {
|
|
|
1331
1337
|
// lunr: `context: "fork"` from the model is coerced to fresh.
|
|
1332
1338
|
return lunrContextPolicy(params);
|
|
1333
1339
|
}
|
|
1334
|
-
function collectRequestedAgentNames(params) {
|
|
1335
|
-
const names = [];
|
|
1336
|
-
if (params.agent)
|
|
1337
|
-
names.push(params.agent);
|
|
1338
|
-
for (const task of params.tasks ?? [])
|
|
1339
|
-
names.push(task.agent);
|
|
1340
|
-
for (const step of params.chain ?? [])
|
|
1341
|
-
names.push(...getStepAgents(step));
|
|
1342
|
-
return names;
|
|
1343
|
-
}
|
|
1344
|
-
function collectRequestedAgents(params, agents) {
|
|
1345
|
-
const byName = new Map(agents.map((agent) => [agent.name, agent]));
|
|
1346
|
-
return collectRequestedAgentNames(params).map((name) => {
|
|
1347
|
-
const agent = byName.get(name);
|
|
1348
|
-
return { name, tools: agent?.tools };
|
|
1349
|
-
});
|
|
1350
|
-
}
|
|
1351
1340
|
function shouldForkAgent(contextPolicy, agentName) {
|
|
1352
1341
|
return contextPolicy.contextForAgent(agentName) === "fork";
|
|
1353
1342
|
}
|
|
@@ -1358,24 +1347,82 @@ function buildRequestedModeError(params, message) {
|
|
|
1358
1347
|
details: { mode: getRequestedModeLabel(params), results: [] },
|
|
1359
1348
|
}, params.context);
|
|
1360
1349
|
}
|
|
1361
|
-
function
|
|
1362
|
-
if ((params.chain?.length ?? 0) > 0 || (params.tasks?.length ?? 0) > 0 || !params.agent)
|
|
1363
|
-
return params;
|
|
1364
|
-
const agent = agents.find((candidate) => candidate.name === params.agent);
|
|
1365
|
-
if (!agent)
|
|
1366
|
-
return params;
|
|
1350
|
+
function runtimeConfigFromChildSpec(spec) {
|
|
1367
1351
|
return {
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1352
|
+
name: spec.childId,
|
|
1353
|
+
description: spec.description,
|
|
1354
|
+
model: spec.model,
|
|
1355
|
+
thinking: undefined,
|
|
1356
|
+
systemPromptMode: "append",
|
|
1357
|
+
inheritProjectContext: true,
|
|
1358
|
+
inheritSkills: false,
|
|
1359
|
+
acceptanceRole: spec.effectivePermissions === "read-only" ? "read-only" : "writer",
|
|
1360
|
+
systemPrompt: "",
|
|
1361
|
+
skills: spec.skill === false ? [] : normalizeSkillInput(spec.skill) || undefined,
|
|
1362
|
+
output: typeof spec.output === "string" ? spec.output : undefined,
|
|
1363
|
+
toolBudget: spec.toolBudget,
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
function internalizePromptDrivenChildren(params, options) {
|
|
1367
|
+
const agents = [];
|
|
1368
|
+
let flatIndex = 0;
|
|
1369
|
+
const normalize = (input, defaultTask) => {
|
|
1370
|
+
const spec = normalizeChildSpec(input, {
|
|
1371
|
+
parentMode: options.parentMode,
|
|
1372
|
+
runId: options.runId,
|
|
1373
|
+
index: flatIndex,
|
|
1374
|
+
defaultTask,
|
|
1375
|
+
});
|
|
1376
|
+
agents.push(runtimeConfigFromChildSpec(spec));
|
|
1377
|
+
return { input: { ...input, agent: spec.childId }, spec };
|
|
1378
|
+
};
|
|
1379
|
+
if ((params.tasks?.length ?? 0) > 0) {
|
|
1380
|
+
const tasks = params.tasks.map((task) => {
|
|
1381
|
+
const normalized = normalize(task);
|
|
1382
|
+
flatIndex++;
|
|
1383
|
+
return normalized.input;
|
|
1384
|
+
});
|
|
1385
|
+
return { params: { ...params, tasks }, agents };
|
|
1386
|
+
}
|
|
1387
|
+
if ((params.chain?.length ?? 0) > 0) {
|
|
1388
|
+
const chain = params.chain.map((step) => {
|
|
1389
|
+
if (isParallelStep(step)) {
|
|
1390
|
+
const parallel = step.parallel.map((task) => {
|
|
1391
|
+
const normalized = normalize(task, flatIndex === 0 ? params.task : "{previous}");
|
|
1392
|
+
flatIndex++;
|
|
1393
|
+
return normalized.input;
|
|
1394
|
+
});
|
|
1395
|
+
return { ...step, parallel };
|
|
1396
|
+
}
|
|
1397
|
+
if (isDynamicParallelStep(step)) {
|
|
1398
|
+
const normalized = normalize(step.parallel, "{previous}");
|
|
1399
|
+
const reserved = step.expand.maxItems ?? options.dynamicFanoutMaxItems ?? 1;
|
|
1400
|
+
flatIndex += Math.max(1, reserved);
|
|
1401
|
+
return { ...step, parallel: normalized.input };
|
|
1402
|
+
}
|
|
1403
|
+
const normalized = normalize(step, flatIndex === 0 ? params.task : "{previous}");
|
|
1404
|
+
flatIndex++;
|
|
1405
|
+
return normalized.input;
|
|
1406
|
+
});
|
|
1407
|
+
return { params: { ...params, chain }, agents };
|
|
1408
|
+
}
|
|
1409
|
+
const normalized = normalize({
|
|
1410
|
+
agent: params.agent,
|
|
1411
|
+
task: params.task ?? "",
|
|
1412
|
+
description: params.description,
|
|
1413
|
+
permissions: params.permissions,
|
|
1414
|
+
cwd: params.cwd,
|
|
1415
|
+
model: params.model,
|
|
1416
|
+
tier: params.tier,
|
|
1417
|
+
skill: params.skill,
|
|
1418
|
+
output: params.output,
|
|
1419
|
+
outputMode: params.outputMode,
|
|
1420
|
+
acceptance: params.acceptance,
|
|
1421
|
+
toolBudget: params.toolBudget,
|
|
1422
|
+
});
|
|
1423
|
+
return {
|
|
1424
|
+
params: { ...params, agent: normalized.spec.childId },
|
|
1425
|
+
agents,
|
|
1379
1426
|
};
|
|
1380
1427
|
}
|
|
1381
1428
|
function resolveForegroundTimeout(params) {
|
|
@@ -1720,7 +1767,6 @@ function runAsyncPath(data, deps) {
|
|
|
1720
1767
|
}],
|
|
1721
1768
|
resultMode: "parallel",
|
|
1722
1769
|
goal: params.tasks[0]?.task ?? "",
|
|
1723
|
-
agents,
|
|
1724
1770
|
ctx: asyncCtx,
|
|
1725
1771
|
availableModels,
|
|
1726
1772
|
cwd: effectiveCwd,
|
|
@@ -1757,7 +1803,6 @@ function runAsyncPath(data, deps) {
|
|
|
1757
1803
|
chain,
|
|
1758
1804
|
task: params.task,
|
|
1759
1805
|
goal: resolveAsyncEventGoal(params.task, rawChain),
|
|
1760
|
-
agents,
|
|
1761
1806
|
ctx: asyncCtx,
|
|
1762
1807
|
availableModels,
|
|
1763
1808
|
cwd: effectiveCwd,
|
|
@@ -1803,11 +1848,27 @@ function runAsyncPath(data, deps) {
|
|
|
1803
1848
|
const maxSubagentDepth = resolveChildMaxSubagentDepth(currentMaxSubagentDepth, a.maxSubagentDepth);
|
|
1804
1849
|
// lunr: model tiers — explicit model wins; otherwise resolve params.tier via the tier bridge.
|
|
1805
1850
|
const modelOverride = resolveEffectiveSubagentModel(params.model ?? resolveTierModelOverride(params.tier), a.model, ctx.model, availableModels, currentProvider, { scope: data.modelScope });
|
|
1806
|
-
|
|
1807
|
-
agent: params.agent,
|
|
1851
|
+
const spec = normalizeChildSpec({
|
|
1808
1852
|
task: shouldForkAgent(contextPolicy, params.agent) ? wrapForkTask(params.task ?? "") : (params.task ?? ""),
|
|
1853
|
+
description: params.description,
|
|
1854
|
+
permissions: params.permissions,
|
|
1855
|
+
model: modelOverride,
|
|
1856
|
+
tier: params.tier,
|
|
1857
|
+
skill: params.skill,
|
|
1858
|
+
cwd: effectiveCwd,
|
|
1859
|
+
output: effectiveOutput,
|
|
1860
|
+
outputMode: effectiveOutputMode,
|
|
1861
|
+
acceptance: params.acceptance,
|
|
1862
|
+
toolBudget: params.toolBudget,
|
|
1863
|
+
}, {
|
|
1864
|
+
parentMode: snapshotParentPermissionMode(deps.state.currentSessionId),
|
|
1865
|
+
runId: id,
|
|
1866
|
+
index: 0,
|
|
1867
|
+
childId: params.agent,
|
|
1868
|
+
});
|
|
1869
|
+
return executeAsyncSingle(id, {
|
|
1870
|
+
spec,
|
|
1809
1871
|
goal: params.task ?? "",
|
|
1810
|
-
agentConfig: a,
|
|
1811
1872
|
ctx: asyncCtx,
|
|
1812
1873
|
availableModels,
|
|
1813
1874
|
cwd: effectiveCwd,
|
|
@@ -1916,7 +1977,6 @@ async function runChainPath(data, deps) {
|
|
|
1916
1977
|
chain: asyncChain,
|
|
1917
1978
|
task: params.task,
|
|
1918
1979
|
goal: resolveAsyncEventGoal(params.task, rawAsyncChain, firstAgent ? shouldForkAgent(contextPolicy, firstAgent) : false),
|
|
1919
|
-
agents,
|
|
1920
1980
|
ctx: asyncCtx,
|
|
1921
1981
|
availableModels: ctx.modelRegistry.getAvailable().map(toModelInfo),
|
|
1922
1982
|
cwd: effectiveCwd,
|
|
@@ -2076,7 +2136,8 @@ async function runForegroundParallelTasks(input) {
|
|
|
2076
2136
|
const taskText = injectSingleOutputInstruction(`${readInstructions.prefix}${input.taskTexts[index]}${progressInstructions.suffix}`, outputPath, agentConfig);
|
|
2077
2137
|
const interruptController = new AbortController();
|
|
2078
2138
|
if (input.foregroundControl) {
|
|
2079
|
-
input.foregroundControl.currentAgent = task.agent;
|
|
2139
|
+
input.foregroundControl.currentAgent = task.description || task.agent;
|
|
2140
|
+
input.foregroundControl.currentChildId = task.agent;
|
|
2080
2141
|
input.foregroundControl.currentIndex = index;
|
|
2081
2142
|
input.foregroundControl.currentActivityState = undefined;
|
|
2082
2143
|
input.foregroundControl.updatedAt = Date.now();
|
|
@@ -2089,7 +2150,18 @@ async function runForegroundParallelTasks(input) {
|
|
|
2089
2150
|
return true;
|
|
2090
2151
|
};
|
|
2091
2152
|
}
|
|
2092
|
-
return runSync(input.ctx.cwd,
|
|
2153
|
+
return runSync(input.ctx.cwd, normalizeChildSpec({
|
|
2154
|
+
task: taskText,
|
|
2155
|
+
description: task.description,
|
|
2156
|
+
permissions: task.permissions,
|
|
2157
|
+
model: input.modelOverrides[index] ?? task.model,
|
|
2158
|
+
skill: task.skill,
|
|
2159
|
+
cwd: taskCwd,
|
|
2160
|
+
output: task.output,
|
|
2161
|
+
outputMode: task.outputMode,
|
|
2162
|
+
acceptance: task.acceptance,
|
|
2163
|
+
toolBudget: task.toolBudget,
|
|
2164
|
+
}, { parentMode: snapshotParentPermissionMode(input.ctx.sessionManager.getSessionId() ?? undefined), runId: input.runId, index }), {
|
|
2093
2165
|
parentSessionId: input.ctx.sessionManager.getSessionId() ?? undefined,
|
|
2094
2166
|
cwd: taskCwd,
|
|
2095
2167
|
signal: input.signal,
|
|
@@ -2132,7 +2204,8 @@ async function runForegroundParallelTasks(input) {
|
|
|
2132
2204
|
const stepProgress = progressUpdate.details?.progress || [];
|
|
2133
2205
|
if (input.foregroundControl && stepProgress.length > 0) {
|
|
2134
2206
|
const current = stepProgress[0];
|
|
2135
|
-
input.foregroundControl.currentAgent = task.agent;
|
|
2207
|
+
input.foregroundControl.currentAgent = task.description || task.agent;
|
|
2208
|
+
input.foregroundControl.currentChildId = task.agent;
|
|
2136
2209
|
input.foregroundControl.currentIndex = index;
|
|
2137
2210
|
input.foregroundControl.currentActivityState = current?.activityState;
|
|
2138
2211
|
input.foregroundControl.lastActivityAt = current?.lastActivityAt;
|
|
@@ -2227,7 +2300,7 @@ async function runParallelPath(data, deps) {
|
|
|
2227
2300
|
// lunr: model tiers — explicit per-task model wins; otherwise resolve task.tier via the tier bridge.
|
|
2228
2301
|
resolveEffectiveSubagentModel(behaviorOverrides[i]?.model ?? resolveTierModelOverride(task.tier), agentConfigs[i]?.model, ctx.model, availableModels, currentProvider, { scope: data.modelScope }));
|
|
2229
2302
|
if (params.clarify === true && ctx.hasUI) {
|
|
2230
|
-
const behaviors = agentConfigs.map((
|
|
2303
|
+
const behaviors = agentConfigs.map((_c, i) => resolveStepBehavior(behaviorOverrides[i]));
|
|
2231
2304
|
const availableSkills = discoverAvailableSkills(effectiveCwd);
|
|
2232
2305
|
const result = await ctx.ui.custom((tui, theme, _kb, done) => new ChainClarifyComponent(tui, theme, agentConfigs, taskTexts, "", undefined, behaviors, availableModels, currentProvider, availableSkills, done, "parallel"), { overlay: true, overlayOptions: { anchor: "center", width: 84, maxHeight: "80%" } });
|
|
2233
2306
|
if (!result || !result.confirmed) {
|
|
@@ -2290,7 +2363,6 @@ async function runParallelPath(data, deps) {
|
|
|
2290
2363
|
chain: [{ parallel: parallelTasks, concurrency: parallelConcurrency, worktree: params.worktree }],
|
|
2291
2364
|
resultMode: "parallel",
|
|
2292
2365
|
goal: taskTexts[0] ?? "",
|
|
2293
|
-
agents,
|
|
2294
2366
|
ctx: asyncCtx,
|
|
2295
2367
|
availableModels,
|
|
2296
2368
|
cwd: effectiveCwd,
|
|
@@ -2316,7 +2388,7 @@ async function runParallelPath(data, deps) {
|
|
|
2316
2388
|
});
|
|
2317
2389
|
}
|
|
2318
2390
|
}
|
|
2319
|
-
const behaviors = agentConfigs.map((
|
|
2391
|
+
const behaviors = agentConfigs.map((_config, index) => suppressProgressForReadOnlyTask(resolveStepBehavior(behaviorOverrides[index]), taskTexts[index]));
|
|
2320
2392
|
const firstProgressIndex = behaviors.findIndex((behavior) => behavior.progress);
|
|
2321
2393
|
const liveResults = new Array(tasks.length).fill(undefined);
|
|
2322
2394
|
const liveProgress = new Array(tasks.length).fill(undefined);
|
|
@@ -2478,18 +2550,45 @@ async function runParallelPath(data, deps) {
|
|
|
2478
2550
|
async function runSinglePath(data, deps) {
|
|
2479
2551
|
const { params, effectiveCwd, agents, ctx, signal, runId, sessionDirForIndex, sessionFileForTask, thinkingOverrideForTask, shareEnabled, artifactConfig, artifactsDir, onUpdate, sessionRoot, controlConfig, contextPolicy, } = data;
|
|
2480
2552
|
const onControlEvent = createForegroundControlNotifier(data, deps);
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2553
|
+
let spec;
|
|
2554
|
+
try {
|
|
2555
|
+
spec = normalizeChildSpec({
|
|
2556
|
+
task: params.task,
|
|
2557
|
+
description: params.description,
|
|
2558
|
+
permissions: params.permissions,
|
|
2559
|
+
model: params.model,
|
|
2560
|
+
tier: params.tier,
|
|
2561
|
+
skill: params.skill,
|
|
2562
|
+
cwd: effectiveCwd,
|
|
2563
|
+
output: params.output,
|
|
2564
|
+
outputMode: params.outputMode,
|
|
2565
|
+
acceptance: params.acceptance,
|
|
2566
|
+
toolBudget: params.toolBudget,
|
|
2567
|
+
}, { parentMode: snapshotParentPermissionMode(deps.state.currentSessionId), runId, index: 0 });
|
|
2568
|
+
}
|
|
2569
|
+
catch (error) {
|
|
2486
2570
|
return {
|
|
2487
|
-
content: [{ type: "text", text:
|
|
2571
|
+
content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }],
|
|
2488
2572
|
isError: true,
|
|
2489
2573
|
details: { mode: "single", results: [] },
|
|
2490
2574
|
};
|
|
2491
2575
|
}
|
|
2492
|
-
const
|
|
2576
|
+
const childIntercomTarget = data.intercomBridge.active ? resolveSubagentIntercomTarget(runId, spec.childId, 0) : undefined;
|
|
2577
|
+
const allProgress = [];
|
|
2578
|
+
const allArtifactPaths = [];
|
|
2579
|
+
const agentConfig = {
|
|
2580
|
+
name: spec.childId,
|
|
2581
|
+
description: spec.description,
|
|
2582
|
+
model: spec.model,
|
|
2583
|
+
output: typeof spec.output === "string" ? spec.output : undefined,
|
|
2584
|
+
toolBudget: spec.toolBudget,
|
|
2585
|
+
skills: spec.skill === false ? [] : undefined,
|
|
2586
|
+
systemPrompt: "",
|
|
2587
|
+
systemPromptMode: "append",
|
|
2588
|
+
inheritProjectContext: true,
|
|
2589
|
+
inheritSkills: false,
|
|
2590
|
+
};
|
|
2591
|
+
const effectiveToolBudget = resolveEffectiveToolBudget({ runBudget: data.toolBudget, agentBudget: spec.toolBudget, configBudget: data.configToolBudget });
|
|
2493
2592
|
if (effectiveToolBudget.error)
|
|
2494
2593
|
return toExecutionErrorResult(params, new Error(effectiveToolBudget.error));
|
|
2495
2594
|
const currentProvider = ctx.model?.provider;
|
|
@@ -2504,7 +2603,7 @@ async function runSinglePath(data, deps) {
|
|
|
2504
2603
|
const currentMaxSubagentDepth = resolveCurrentMaxSubagentDepth(deps.config.maxSubagentDepth);
|
|
2505
2604
|
const maxSubagentDepth = resolveChildMaxSubagentDepth(currentMaxSubagentDepth, agentConfig.maxSubagentDepth);
|
|
2506
2605
|
if (params.clarify === true && ctx.hasUI) {
|
|
2507
|
-
const behavior = resolveStepBehavior(
|
|
2606
|
+
const behavior = resolveStepBehavior({ output: effectiveOutput, skills: skillOverride });
|
|
2508
2607
|
const availableSkills = discoverAvailableSkills(effectiveCwd);
|
|
2509
2608
|
const result = await ctx.ui.custom((tui, theme, _kb, done) => new ChainClarifyComponent(tui, theme, [agentConfig], [task], task, undefined, [behavior], availableModels, currentProvider, availableSkills, done, "single"), { overlay: true, overlayOptions: { anchor: "center", width: 84, maxHeight: "80%" } });
|
|
2510
2609
|
if (!result || !result.confirmed) {
|
|
@@ -2537,10 +2636,8 @@ async function runSinglePath(data, deps) {
|
|
|
2537
2636
|
modelScope: data.modelScope,
|
|
2538
2637
|
};
|
|
2539
2638
|
return executeAsyncSingle(id, {
|
|
2540
|
-
|
|
2541
|
-
task: shouldForkAgent(contextPolicy, params.agent) ? wrapForkTask(task) : task,
|
|
2639
|
+
spec: { ...spec, task: shouldForkAgent(contextPolicy, params.agent) ? wrapForkTask(task) : task },
|
|
2542
2640
|
goal: task,
|
|
2543
|
-
agentConfig,
|
|
2544
2641
|
ctx: asyncCtx,
|
|
2545
2642
|
availableModels,
|
|
2546
2643
|
cwd: effectiveCwd,
|
|
@@ -2549,7 +2646,7 @@ async function runSinglePath(data, deps) {
|
|
|
2549
2646
|
artifactConfig,
|
|
2550
2647
|
shareEnabled,
|
|
2551
2648
|
sessionRoot,
|
|
2552
|
-
sessionFile: sessionFileForTask(
|
|
2649
|
+
sessionFile: sessionFileForTask(spec.childId, 0, modelOverride),
|
|
2553
2650
|
skills: skillOverride === false ? [] : skillOverride,
|
|
2554
2651
|
output: effectiveOutput,
|
|
2555
2652
|
outputMode: effectiveOutputMode,
|
|
@@ -2590,7 +2687,8 @@ async function runSinglePath(data, deps) {
|
|
|
2590
2687
|
const interruptController = new AbortController();
|
|
2591
2688
|
const foregroundControl = deps.state.foregroundControls.get(runId);
|
|
2592
2689
|
if (foregroundControl) {
|
|
2593
|
-
foregroundControl.currentAgent = params.agent;
|
|
2690
|
+
foregroundControl.currentAgent = params.description || params.agent;
|
|
2691
|
+
foregroundControl.currentChildId = params.agent;
|
|
2594
2692
|
foregroundControl.currentIndex = 0;
|
|
2595
2693
|
foregroundControl.currentActivityState = undefined;
|
|
2596
2694
|
foregroundControl.updatedAt = Date.now();
|
|
@@ -2607,7 +2705,8 @@ async function runSinglePath(data, deps) {
|
|
|
2607
2705
|
? (update) => {
|
|
2608
2706
|
if (foregroundControl) {
|
|
2609
2707
|
const firstProgress = update.details?.progress?.[0];
|
|
2610
|
-
foregroundControl.currentAgent = params.agent;
|
|
2708
|
+
foregroundControl.currentAgent = params.description || params.agent;
|
|
2709
|
+
foregroundControl.currentChildId = params.agent;
|
|
2611
2710
|
foregroundControl.currentIndex = firstProgress?.index ?? 0;
|
|
2612
2711
|
foregroundControl.currentActivityState = firstProgress?.activityState;
|
|
2613
2712
|
foregroundControl.lastActivityAt = firstProgress?.lastActivityAt;
|
|
@@ -2623,16 +2722,16 @@ async function runSinglePath(data, deps) {
|
|
|
2623
2722
|
}
|
|
2624
2723
|
: undefined;
|
|
2625
2724
|
const deadlineAt = data.deadlineAt ?? (data.timeoutMs !== undefined ? Date.now() + data.timeoutMs : undefined);
|
|
2626
|
-
const r = await runSync(ctx.cwd,
|
|
2725
|
+
const r = await runSync(ctx.cwd, { ...spec, task }, {
|
|
2627
2726
|
parentSessionId: ctx.sessionManager.getSessionId() ?? undefined,
|
|
2628
2727
|
cwd: effectiveCwd,
|
|
2629
2728
|
signal,
|
|
2630
2729
|
interruptSignal: interruptController.signal,
|
|
2631
|
-
allowIntercomDetach:
|
|
2730
|
+
allowIntercomDetach: data.intercomBridge.active,
|
|
2632
2731
|
intercomEvents: deps.pi.events,
|
|
2633
2732
|
runId,
|
|
2634
2733
|
sessionDir: sessionDirForIndex(0),
|
|
2635
|
-
sessionFile: sessionFileForTask(
|
|
2734
|
+
sessionFile: sessionFileForTask(spec.childId, 0, modelOverride),
|
|
2636
2735
|
share: shareEnabled,
|
|
2637
2736
|
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
2638
2737
|
artifactConfig,
|
|
@@ -2760,7 +2859,7 @@ function foregroundCapacityResult(params, inFlight, limit) {
|
|
|
2760
2859
|
return {
|
|
2761
2860
|
content: [{
|
|
2762
2861
|
type: "text",
|
|
2763
|
-
text: `Foreground subagent capacity reached (${inFlight}/${limit} running). Wait for a child to finish, use ONE subagent call with tasks: [{
|
|
2862
|
+
text: `Foreground subagent capacity reached (${inFlight}/${limit} running). Wait for a child to finish, use ONE subagent call with tasks: [{task, description}, …], or set async: true.`,
|
|
2764
2863
|
}],
|
|
2765
2864
|
isError: true,
|
|
2766
2865
|
details: { mode: inferExecutionMode(params), results: [] },
|
|
@@ -2768,7 +2867,7 @@ function foregroundCapacityResult(params, inFlight, limit) {
|
|
|
2768
2867
|
}
|
|
2769
2868
|
function omitExecutionModeActionAlias(params) {
|
|
2770
2869
|
const action = params.action?.toLowerCase();
|
|
2771
|
-
if (action === "single" &&
|
|
2870
|
+
if (action === "single" && params.task !== undefined) {
|
|
2772
2871
|
const rest = { ...params };
|
|
2773
2872
|
delete rest.action;
|
|
2774
2873
|
return rest;
|
|
@@ -3007,25 +3106,13 @@ export function createSubagentExecutor(deps) {
|
|
|
3007
3106
|
details: { mode: "management", results: [] },
|
|
3008
3107
|
};
|
|
3009
3108
|
}
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
}
|
|
3016
|
-
}
|
|
3017
|
-
if (deps.allowMutatingManagementActions === false && MUTATING_MANAGEMENT_ACTIONS.has(action)) {
|
|
3018
|
-
return {
|
|
3019
|
-
content: [{ type: "text", text: `Action '${action}' is not available from child-safe subagent fanout mode.` }],
|
|
3020
|
-
isError: true,
|
|
3021
|
-
details: { mode: "management", results: [] },
|
|
3022
|
-
};
|
|
3023
|
-
}
|
|
3024
|
-
return handleManagementAction(action, paramsWithResolvedCwd, {
|
|
3025
|
-
...ctx,
|
|
3026
|
-
cwd: requestCwd,
|
|
3027
|
-
config: deps.config,
|
|
3028
|
-
});
|
|
3109
|
+
// Every supported control action returns above. Named-agent CRUD actions are
|
|
3110
|
+
// intentionally absent from SUBAGENT_ACTIONS and have no fallback handler.
|
|
3111
|
+
return {
|
|
3112
|
+
content: [{ type: "text", text: `Unknown action: ${action}. Valid: ${SUBAGENT_ACTIONS.join(", ")}` }],
|
|
3113
|
+
isError: true,
|
|
3114
|
+
details: { mode: "management", results: [] },
|
|
3115
|
+
};
|
|
3029
3116
|
}
|
|
3030
3117
|
const { blocked, depth, maxDepth } = checkSubagentDepth(deps.config.maxSubagentDepth);
|
|
3031
3118
|
if (blocked) {
|
|
@@ -3053,21 +3140,32 @@ export function createSubagentExecutor(deps) {
|
|
|
3053
3140
|
const configToolBudget = resolveToolBudget(deps.config.toolBudget, "config.toolBudget");
|
|
3054
3141
|
if (configToolBudget.error)
|
|
3055
3142
|
return buildRequestedModeError(effectiveParams, configToolBudget.error);
|
|
3056
|
-
const scope = resolveExecutionAgentScope(effectiveParams.agentScope);
|
|
3057
3143
|
const effectiveCwd = effectiveParams.cwd ?? ctx.cwd;
|
|
3058
3144
|
const parentSessionFile = ctx.sessionManager.getSessionFile() ?? null;
|
|
3059
3145
|
deps.state.currentSessionId = resolveCurrentSessionId(ctx.sessionManager);
|
|
3060
|
-
const
|
|
3061
|
-
const
|
|
3062
|
-
|
|
3063
|
-
|
|
3146
|
+
const runId = randomUUID().slice(0, 8);
|
|
3147
|
+
const parentPermissionMode = snapshotParentPermissionMode(deps.state.currentSessionId);
|
|
3148
|
+
let internalized;
|
|
3149
|
+
try {
|
|
3150
|
+
internalized = internalizePromptDrivenChildren(effectiveParams, {
|
|
3151
|
+
runId,
|
|
3152
|
+
parentMode: parentPermissionMode,
|
|
3153
|
+
dynamicFanoutMaxItems: deps.config.chain?.dynamicFanout?.maxItems,
|
|
3154
|
+
});
|
|
3155
|
+
}
|
|
3156
|
+
catch (error) {
|
|
3157
|
+
return buildRequestedModeError(effectiveParams, error instanceof Error ? error.message : String(error));
|
|
3158
|
+
}
|
|
3159
|
+
effectiveParams = internalized.params;
|
|
3160
|
+
const discoveredAgents = internalized.agents;
|
|
3161
|
+
const modelScope = undefined;
|
|
3064
3162
|
const foregroundTimeout = resolveForegroundTimeout(effectiveParams);
|
|
3065
3163
|
if (foregroundTimeout.error)
|
|
3066
3164
|
return buildRequestedModeError(effectiveParams, foregroundTimeout.error);
|
|
3067
3165
|
const turnBudget = resolveTurnBudgetConfig(effectiveParams.turnBudget ?? deps.config.turnBudget);
|
|
3068
3166
|
if (turnBudget.error)
|
|
3069
3167
|
return buildRequestedModeError(effectiveParams, turnBudget.error);
|
|
3070
|
-
const contextPolicy = resolveAgentDefaultContextPolicy(effectiveParams
|
|
3168
|
+
const contextPolicy = resolveAgentDefaultContextPolicy(effectiveParams);
|
|
3071
3169
|
effectiveParams = contextPolicy.params;
|
|
3072
3170
|
const sessionName = resolveIntercomSessionTarget(deps.pi.getSessionName(), ctx.sessionManager.getSessionId());
|
|
3073
3171
|
const intercomBridge = resolveIntercomBridge({
|
|
@@ -3078,25 +3176,20 @@ export function createSubagentExecutor(deps) {
|
|
|
3078
3176
|
const agents = intercomBridge.active
|
|
3079
3177
|
? discoveredAgents.map((agent) => applyIntercomBridgeToAgent(agent, intercomBridge))
|
|
3080
3178
|
: discoveredAgents;
|
|
3081
|
-
const runId = randomUUID().slice(0, 8);
|
|
3082
3179
|
const inheritedNestedRoute = resolveInheritedNestedRouteFromEnv();
|
|
3083
3180
|
const nestedParentAddress = inheritedNestedRoute ? resolveNestedParentAddressFromEnv() : undefined;
|
|
3084
3181
|
const nestedRoute = inheritedNestedRoute ?? createNestedRoute(runId);
|
|
3085
3182
|
const shareEnabled = effectiveParams.share === true;
|
|
3086
3183
|
const hasChain = (effectiveParams.chain?.length ?? 0) > 0;
|
|
3087
3184
|
const hasTasks = (effectiveParams.tasks?.length ?? 0) > 0;
|
|
3088
|
-
const hasSingle = !hasChain && !hasTasks && Boolean(effectiveParams.
|
|
3185
|
+
const hasSingle = !hasChain && !hasTasks && Boolean(effectiveParams.task);
|
|
3089
3186
|
const allowClarifyTaskPrompt = hasChain
|
|
3090
3187
|
&& effectiveParams.clarify === true
|
|
3091
3188
|
&& ctx.hasUI
|
|
3092
3189
|
&& !(effectiveParams.chain?.some(isParallelStep) ?? false);
|
|
3093
|
-
const validationError = validateExecutionInput(effectiveParams,
|
|
3190
|
+
const validationError = validateExecutionInput(effectiveParams, hasChain, hasTasks, hasSingle, allowClarifyTaskPrompt);
|
|
3094
3191
|
if (validationError)
|
|
3095
3192
|
return validationError;
|
|
3096
|
-
const parentPermissionMode = snapshotParentPermissionMode(deps.state.currentSessionId);
|
|
3097
|
-
const writeSpawnError = planModeWriteSpawnError(parentPermissionMode, collectRequestedAgents(effectiveParams, agents));
|
|
3098
|
-
if (writeSpawnError)
|
|
3099
|
-
return buildRequestedModeError(effectiveParams, writeSpawnError);
|
|
3100
3193
|
let forkSessionFileForIndex = () => undefined;
|
|
3101
3194
|
let forkThinkingOverrideForIndex = () => undefined;
|
|
3102
3195
|
let prepareForkThinking = (_agentName, _index, _modelOverride) => { };
|
|
@@ -3225,6 +3318,7 @@ export function createSubagentExecutor(deps) {
|
|
|
3225
3318
|
startedAt: Date.now(),
|
|
3226
3319
|
updatedAt: Date.now(),
|
|
3227
3320
|
currentAgent: undefined,
|
|
3321
|
+
currentChildId: undefined,
|
|
3228
3322
|
currentIndex: undefined,
|
|
3229
3323
|
currentActivityState: undefined,
|
|
3230
3324
|
nestedRoute,
|
|
@@ -3249,13 +3343,20 @@ export function createSubagentExecutor(deps) {
|
|
|
3249
3343
|
const errorText = result?.isError
|
|
3250
3344
|
? result.content.find((item) => item.type === "text")?.text
|
|
3251
3345
|
: undefined;
|
|
3252
|
-
const
|
|
3346
|
+
const internalChildKeys = hasTasks && effectiveParams.tasks
|
|
3253
3347
|
? effectiveParams.tasks.map((task) => task.agent)
|
|
3254
3348
|
: hasChain && effectiveParams.chain
|
|
3255
|
-
? effectiveParams.chain.flatMap((step) => isParallelStep(step)
|
|
3349
|
+
? effectiveParams.chain.flatMap((step) => isParallelStep(step)
|
|
3350
|
+
? step.parallel.map((task) => task.agent)
|
|
3351
|
+
: isDynamicParallelStep(step) ? [step.parallel.agent] : [step.agent])
|
|
3256
3352
|
: effectiveParams.agent ? [effectiveParams.agent] : [];
|
|
3257
|
-
const
|
|
3258
|
-
?
|
|
3353
|
+
const childrenForSummary = hasTasks && effectiveParams.tasks
|
|
3354
|
+
? effectiveParams.tasks.map((task) => task.description || task.agent || "child")
|
|
3355
|
+
: hasChain && effectiveParams.chain
|
|
3356
|
+
? effectiveParams.chain.flatMap(getStepAgents)
|
|
3357
|
+
: [effectiveParams.description || effectiveParams.agent || "child"];
|
|
3358
|
+
const leafIntercomTarget = intercomBridge.active && internalChildKeys[0]
|
|
3359
|
+
? resolveSubagentIntercomTarget(runId, internalChildKeys[0], 0)
|
|
3259
3360
|
: undefined;
|
|
3260
3361
|
try {
|
|
3261
3362
|
writeNestedEvent(inheritedNestedRoute, {
|
|
@@ -3275,8 +3376,8 @@ export function createSubagentExecutor(deps) {
|
|
|
3275
3376
|
ownerState: state === "running" ? "live" : "gone",
|
|
3276
3377
|
mode: foregroundMode,
|
|
3277
3378
|
state,
|
|
3278
|
-
agent:
|
|
3279
|
-
agents:
|
|
3379
|
+
agent: childrenForSummary[0],
|
|
3380
|
+
agents: childrenForSummary,
|
|
3280
3381
|
startedAt: foregroundControl?.startedAt ?? now,
|
|
3281
3382
|
...(state !== "running" ? { endedAt: now } : {}),
|
|
3282
3383
|
lastUpdate: now,
|