@ashx-j/lunr 0.1.0
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 +5042 -0
- package/README.md +691 -0
- package/dist/builtin-extensions/ashxj-spinners.d.ts +3 -0
- package/dist/builtin-extensions/ashxj-spinners.d.ts.map +1 -0
- package/dist/builtin-extensions/ashxj-spinners.js +271 -0
- package/dist/builtin-extensions/ashxj-spinners.js.map +1 -0
- package/dist/builtin-extensions/ashxj-thinking.d.ts +65 -0
- package/dist/builtin-extensions/ashxj-thinking.d.ts.map +1 -0
- package/dist/builtin-extensions/ashxj-thinking.js +308 -0
- package/dist/builtin-extensions/ashxj-thinking.js.map +1 -0
- package/dist/builtin-extensions/ashxj-tui.d.ts +137 -0
- package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -0
- package/dist/builtin-extensions/ashxj-tui.js +579 -0
- package/dist/builtin-extensions/ashxj-tui.js.map +1 -0
- package/dist/builtin-extensions/index.d.ts +11 -0
- package/dist/builtin-extensions/index.d.ts.map +1 -0
- package/dist/builtin-extensions/index.js +62 -0
- package/dist/builtin-extensions/index.js.map +1 -0
- package/dist/builtin-extensions/lunr-behavior.d.ts +43 -0
- package/dist/builtin-extensions/lunr-behavior.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-behavior.js +201 -0
- package/dist/builtin-extensions/lunr-behavior.js.map +1 -0
- package/dist/builtin-extensions/lunr-cron.d.ts +26 -0
- package/dist/builtin-extensions/lunr-cron.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-cron.js +346 -0
- package/dist/builtin-extensions/lunr-cron.js.map +1 -0
- package/dist/builtin-extensions/lunr-local-providers/index.d.ts +20 -0
- package/dist/builtin-extensions/lunr-local-providers/index.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-local-providers/index.js +108 -0
- package/dist/builtin-extensions/lunr-local-providers/index.js.map +1 -0
- package/dist/builtin-extensions/lunr-local-providers/local-servers.d.ts +51 -0
- package/dist/builtin-extensions/lunr-local-providers/local-servers.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-local-providers/local-servers.js +128 -0
- package/dist/builtin-extensions/lunr-local-providers/local-servers.js.map +1 -0
- package/dist/builtin-extensions/lunr-plan-tools.d.ts +25 -0
- package/dist/builtin-extensions/lunr-plan-tools.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-plan-tools.js +59 -0
- package/dist/builtin-extensions/lunr-plan-tools.js.map +1 -0
- package/dist/builtin-extensions/lunr-skill-creator/index.d.ts +12 -0
- package/dist/builtin-extensions/lunr-skill-creator/index.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-skill-creator/index.js +18 -0
- package/dist/builtin-extensions/lunr-skill-creator/index.js.map +1 -0
- package/dist/builtin-extensions/lunr-skill-creator/skills/skill-creator/SKILL.md +68 -0
- package/dist/builtin-extensions/lunr-todos.d.ts +52 -0
- package/dist/builtin-extensions/lunr-todos.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-todos.js +189 -0
- package/dist/builtin-extensions/lunr-todos.js.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/accounting.d.ts +23 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/accounting.d.ts.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/accounting.js +77 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/accounting.js.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/command.d.ts +18 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/command.d.ts.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/command.js +165 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/command.js.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/commands.d.ts +19 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/commands.d.ts.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/commands.js +495 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/commands.js.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.d.ts +10 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.d.ts.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.js +857 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.js.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/persistence.d.ts +57 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/persistence.d.ts.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/persistence.js +225 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/persistence.js.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/prompts.d.ts +20 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/prompts.d.ts.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/prompts.js +75 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/prompts.js.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/queue.d.ts +16 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/queue.d.ts.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/queue.js +67 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/queue.js.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/runtime.d.ts +157 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/runtime.d.ts.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/runtime.js +825 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/runtime.js.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/settings.d.ts +22 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/settings.d.ts.map +1 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/settings.js +64 -0
- package/dist/builtin-extensions/narumiruna-pi-goal/src/settings.js.map +1 -0
- package/dist/builtin-extensions/pi-intercom/broker/broker.d.ts +2 -0
- package/dist/builtin-extensions/pi-intercom/broker/broker.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-intercom/broker/broker.js +541 -0
- package/dist/builtin-extensions/pi-intercom/broker/broker.js.map +1 -0
- package/dist/builtin-extensions/pi-intercom/broker/client.d.ts +39 -0
- package/dist/builtin-extensions/pi-intercom/broker/client.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-intercom/broker/client.js +484 -0
- package/dist/builtin-extensions/pi-intercom/broker/client.js.map +1 -0
- package/dist/builtin-extensions/pi-intercom/broker/framing.d.ts +14 -0
- package/dist/builtin-extensions/pi-intercom/broker/framing.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-intercom/broker/framing.js +74 -0
- package/dist/builtin-extensions/pi-intercom/broker/framing.js.map +1 -0
- package/dist/builtin-extensions/pi-intercom/broker/paths.d.ts +22 -0
- package/dist/builtin-extensions/pi-intercom/broker/paths.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-intercom/broker/paths.js +88 -0
- package/dist/builtin-extensions/pi-intercom/broker/paths.js.map +1 -0
- package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts +27 -0
- package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-intercom/broker/spawn.js +313 -0
- package/dist/builtin-extensions/pi-intercom/broker/spawn.js.map +1 -0
- package/dist/builtin-extensions/pi-intercom/config.d.ts +22 -0
- package/dist/builtin-extensions/pi-intercom/config.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-intercom/config.js +103 -0
- package/dist/builtin-extensions/pi-intercom/config.js.map +1 -0
- package/dist/builtin-extensions/pi-intercom/index.d.ts +3 -0
- package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-intercom/index.js +1800 -0
- package/dist/builtin-extensions/pi-intercom/index.js.map +1 -0
- package/dist/builtin-extensions/pi-intercom/reply-tracker.d.ts +27 -0
- package/dist/builtin-extensions/pi-intercom/reply-tracker.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-intercom/reply-tracker.js +101 -0
- package/dist/builtin-extensions/pi-intercom/reply-tracker.js.map +1 -0
- package/dist/builtin-extensions/pi-intercom/types.d.ts +84 -0
- package/dist/builtin-extensions/pi-intercom/types.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-intercom/types.js +2 -0
- package/dist/builtin-extensions/pi-intercom/types.js.map +1 -0
- package/dist/builtin-extensions/pi-intercom/ui/compose.d.ts +27 -0
- package/dist/builtin-extensions/pi-intercom/ui/compose.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-intercom/ui/compose.js +112 -0
- package/dist/builtin-extensions/pi-intercom/ui/compose.js.map +1 -0
- package/dist/builtin-extensions/pi-intercom/ui/inline-message.d.ts +15 -0
- package/dist/builtin-extensions/pi-intercom/ui/inline-message.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-intercom/ui/inline-message.js +86 -0
- package/dist/builtin-extensions/pi-intercom/ui/inline-message.js.map +1 -0
- package/dist/builtin-extensions/pi-intercom/ui/session-list.d.ts +18 -0
- package/dist/builtin-extensions/pi-intercom/ui/session-list.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-intercom/ui/session-list.js +134 -0
- package/dist/builtin-extensions/pi-intercom/ui/session-list.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/bemol.d.ts +81 -0
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/bemol.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/bemol.js +273 -0
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/bemol.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/index.d.ts +13 -0
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/index.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/index.js +163 -0
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/index.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/locks.d.ts +34 -0
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/locks.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/locks.js +148 -0
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/locks.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/file-sync.d.ts +59 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/file-sync.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/file-sync.js +172 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/file-sync.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts +25 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js +521 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-client.d.ts +80 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-client.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-client.js +366 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-client.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-daemon.d.ts +22 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-daemon.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-daemon.js +476 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-daemon.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-manager.d.ts +141 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-manager.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-manager.js +633 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-manager.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/resolve-provider.d.ts +30 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/resolve-provider.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/resolve-provider.js +52 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/resolve-provider.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/constants.d.ts +12 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/constants.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/constants.js +18 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/constants.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/debug.d.ts +10 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/debug.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/debug.js +18 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/debug.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/format.d.ts +9 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/format.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/format.js +29 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/format.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/language-map.d.ts +10 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/language-map.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/language-map.js +51 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/language-map.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/resolve-position.d.ts +33 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/resolve-position.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/resolve-position.js +191 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/resolve-position.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/timing.d.ts +14 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/timing.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/timing.js +15 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/shared/timing.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-actions.d.ts +23 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-actions.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-actions.js +259 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-actions.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-overview.d.ts +23 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-overview.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-overview.js +197 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-overview.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-rewrite.d.ts +23 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-rewrite.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-rewrite.js +131 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-rewrite.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-search.d.ts +18 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-search.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-search.js +87 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-search.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/completions.d.ts +34 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/completions.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/completions.js +347 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/completions.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/definition.d.ts +20 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/definition.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/definition.js +166 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/definition.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/diagnostics.d.ts +22 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/diagnostics.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/diagnostics.js +228 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/diagnostics.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/hover.d.ts +19 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/hover.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/hover.js +143 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/hover.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/references.d.ts +20 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/references.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/references.js +98 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/references.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/rename.d.ts +22 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/rename.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/rename.js +150 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/rename.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/symbols.d.ts +18 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/symbols.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/symbols.js +211 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/symbols.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/parser-manager.d.ts +44 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/parser-manager.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/parser-manager.js +188 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/parser-manager.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/pattern-compiler.d.ts +58 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/pattern-compiler.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/pattern-compiler.js +260 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/pattern-compiler.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/rewrite-engine.d.ts +33 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/rewrite-engine.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/rewrite-engine.js +102 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/rewrite-engine.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/search-engine.d.ts +38 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/search-engine.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/search-engine.js +276 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/search-engine.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/symbol-extractor.d.ts +77 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/symbol-extractor.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/symbol-extractor.js +339 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/symbol-extractor.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/workspace-index.d.ts +51 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/workspace-index.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/workspace-index.js +219 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/workspace-index.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/workspace-provider.d.ts +45 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/workspace-provider.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/workspace-provider.js +30 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/workspace-provider.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/abort.d.ts +3 -0
- package/dist/builtin-extensions/pi-mcp-adapter/abort.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/abort.js +37 -0
- package/dist/builtin-extensions/pi-mcp-adapter/abort.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/agent-dir.d.ts +3 -0
- package/dist/builtin-extensions/pi-mcp-adapter/agent-dir.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/agent-dir.js +22 -0
- package/dist/builtin-extensions/pi-mcp-adapter/agent-dir.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/commands.d.ts +18 -0
- package/dist/builtin-extensions/pi-mcp-adapter/commands.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/commands.js +327 -0
- package/dist/builtin-extensions/pi-mcp-adapter/commands.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/config.d.ts +79 -0
- package/dist/builtin-extensions/pi-mcp-adapter/config.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/config.js +557 -0
- package/dist/builtin-extensions/pi-mcp-adapter/config.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/consent-manager.d.ts +14 -0
- package/dist/builtin-extensions/pi-mcp-adapter/consent-manager.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/consent-manager.js +61 -0
- package/dist/builtin-extensions/pi-mcp-adapter/consent-manager.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts +11 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +374 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/elicitation-handler.d.ts +18 -0
- package/dist/builtin-extensions/pi-mcp-adapter/elicitation-handler.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/elicitation-handler.js +309 -0
- package/dist/builtin-extensions/pi-mcp-adapter/elicitation-handler.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/error-signal.d.ts +16 -0
- package/dist/builtin-extensions/pi-mcp-adapter/error-signal.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/error-signal.js +23 -0
- package/dist/builtin-extensions/pi-mcp-adapter/error-signal.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/errors.d.ts +100 -0
- package/dist/builtin-extensions/pi-mcp-adapter/errors.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/errors.js +167 -0
- package/dist/builtin-extensions/pi-mcp-adapter/errors.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/glimpse-ui.d.ts +10 -0
- package/dist/builtin-extensions/pi-mcp-adapter/glimpse-ui.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/glimpse-ui.js +77 -0
- package/dist/builtin-extensions/pi-mcp-adapter/glimpse-ui.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/host-html-template.d.ts +17 -0
- package/dist/builtin-extensions/pi-mcp-adapter/host-html-template.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/host-html-template.js +413 -0
- package/dist/builtin-extensions/pi-mcp-adapter/host-html-template.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts +3 -0
- package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/index.js +334 -0
- package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts +11 -0
- package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/init.js +296 -0
- package/dist/builtin-extensions/pi-mcp-adapter/init.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/lifecycle.d.ts +30 -0
- package/dist/builtin-extensions/pi-mcp-adapter/lifecycle.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/lifecycle.js +80 -0
- package/dist/builtin-extensions/pi-mcp-adapter/lifecycle.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/logger.d.ts +52 -0
- package/dist/builtin-extensions/pi-mcp-adapter/logger.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/logger.js +132 -0
- package/dist/builtin-extensions/pi-mcp-adapter/logger.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth-flow.d.ts +86 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth-flow.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth-flow.js +482 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth-flow.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth.d.ts +104 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth.js +252 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-callback-server.d.ts +45 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-callback-server.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-callback-server.js +305 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-callback-server.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-oauth-provider.d.ts +111 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-oauth-provider.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-oauth-provider.js +302 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-oauth-provider.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-output-guard.d.ts +59 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-output-guard.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-output-guard.js +325 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-output-guard.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-panel.d.ts +64 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-panel.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-panel.js +777 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-panel.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-setup-panel.d.ts +77 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-setup-panel.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-setup-panel.js +490 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-setup-panel.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.d.ts +32 -0
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js +160 -0
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/npx-resolver.d.ts +7 -0
- package/dist/builtin-extensions/pi-mcp-adapter/npx-resolver.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/npx-resolver.js +388 -0
- package/dist/builtin-extensions/pi-mcp-adapter/npx-resolver.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/oauth-handler.d.ts +19 -0
- package/dist/builtin-extensions/pi-mcp-adapter/oauth-handler.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/oauth-handler.js +53 -0
- package/dist/builtin-extensions/pi-mcp-adapter/oauth-handler.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/onboarding-state.d.ts +13 -0
- package/dist/builtin-extensions/pi-mcp-adapter/onboarding-state.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/onboarding-state.js +58 -0
- package/dist/builtin-extensions/pi-mcp-adapter/onboarding-state.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/panel-keys.d.ts +17 -0
- package/dist/builtin-extensions/pi-mcp-adapter/panel-keys.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/panel-keys.js +17 -0
- package/dist/builtin-extensions/pi-mcp-adapter/panel-keys.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/proxy-modes.d.ts +14 -0
- package/dist/builtin-extensions/pi-mcp-adapter/proxy-modes.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/proxy-modes.js +853 -0
- package/dist/builtin-extensions/pi-mcp-adapter/proxy-modes.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/resource-tools.d.ts +2 -0
- package/dist/builtin-extensions/pi-mcp-adapter/resource-tools.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/resource-tools.js +16 -0
- package/dist/builtin-extensions/pi-mcp-adapter/resource-tools.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/sampling-handler.d.ts +16 -0
- package/dist/builtin-extensions/pi-mcp-adapter/sampling-handler.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/sampling-handler.js +209 -0
- package/dist/builtin-extensions/pi-mcp-adapter/sampling-handler.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts +58 -0
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +403 -0
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/state.d.ts +41 -0
- package/dist/builtin-extensions/pi-mcp-adapter/state.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/state.js +2 -0
- package/dist/builtin-extensions/pi-mcp-adapter/state.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/tool-metadata.d.ts +11 -0
- package/dist/builtin-extensions/pi-mcp-adapter/tool-metadata.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/tool-metadata.js +178 -0
- package/dist/builtin-extensions/pi-mcp-adapter/tool-metadata.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/tool-registrar.d.ts +11 -0
- package/dist/builtin-extensions/pi-mcp-adapter/tool-registrar.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/tool-registrar.js +66 -0
- package/dist/builtin-extensions/pi-mcp-adapter/tool-registrar.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/tool-result-renderer.d.ts +35 -0
- package/dist/builtin-extensions/pi-mcp-adapter/tool-result-renderer.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/tool-result-renderer.js +107 -0
- package/dist/builtin-extensions/pi-mcp-adapter/tool-result-renderer.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/types.d.ts +286 -0
- package/dist/builtin-extensions/pi-mcp-adapter/types.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/types.js +94 -0
- package/dist/builtin-extensions/pi-mcp-adapter/types.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-resource-handler.d.ts +10 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-resource-handler.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-resource-handler.js +118 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-resource-handler.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-server.d.ts +37 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-server.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-server.js +524 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-server.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-session.d.ts +27 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-session.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-session.js +311 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-session.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-stream-types.d.ts +105 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-stream-types.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-stream-types.js +60 -0
- package/dist/builtin-extensions/pi-mcp-adapter/ui-stream-types.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/utils.d.ts +18 -0
- package/dist/builtin-extensions/pi-mcp-adapter/utils.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/utils.js +112 -0
- package/dist/builtin-extensions/pi-mcp-adapter/utils.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/vitest.config.d.ts +3 -0
- package/dist/builtin-extensions/pi-mcp-adapter/vitest.config.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/vitest.config.js +15 -0
- package/dist/builtin-extensions/pi-mcp-adapter/vitest.config.js.map +1 -0
- package/dist/builtin-extensions/pi-ollama-cloud/index.d.ts +31 -0
- package/dist/builtin-extensions/pi-ollama-cloud/index.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-ollama-cloud/index.js +120 -0
- package/dist/builtin-extensions/pi-ollama-cloud/index.js.map +1 -0
- package/dist/builtin-extensions/pi-ollama-cloud/models.d.ts +49 -0
- package/dist/builtin-extensions/pi-ollama-cloud/models.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-ollama-cloud/models.generated.d.ts +3 -0
- package/dist/builtin-extensions/pi-ollama-cloud/models.generated.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-ollama-cloud/models.generated.js +1135 -0
- package/dist/builtin-extensions/pi-ollama-cloud/models.generated.js.map +1 -0
- package/dist/builtin-extensions/pi-ollama-cloud/models.js +239 -0
- package/dist/builtin-extensions/pi-ollama-cloud/models.js.map +1 -0
- package/dist/builtin-extensions/pi-ollama-cloud/thinking-levels.d.ts +40 -0
- package/dist/builtin-extensions/pi-ollama-cloud/thinking-levels.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-ollama-cloud/thinking-levels.js +80 -0
- package/dist/builtin-extensions/pi-ollama-cloud/thinking-levels.js.map +1 -0
- package/dist/builtin-extensions/pi-ollama-cloud/utils.d.ts +9 -0
- package/dist/builtin-extensions/pi-ollama-cloud/utils.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-ollama-cloud/utils.js +52 -0
- package/dist/builtin-extensions/pi-ollama-cloud/utils.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/args.d.ts +56 -0
- package/dist/builtin-extensions/pi-prompt-template-model/args.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/args.js +555 -0
- package/dist/builtin-extensions/pi-prompt-template-model/args.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/chain-parser.d.ts +22 -0
- package/dist/builtin-extensions/pi-prompt-template-model/chain-parser.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/chain-parser.js +249 -0
- package/dist/builtin-extensions/pi-prompt-template-model/chain-parser.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/deterministic-renderer.d.ts +20 -0
- package/dist/builtin-extensions/pi-prompt-template-model/deterministic-renderer.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/deterministic-renderer.js +102 -0
- package/dist/builtin-extensions/pi-prompt-template-model/deterministic-renderer.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/deterministic-step.d.ts +30 -0
- package/dist/builtin-extensions/pi-prompt-template-model/deterministic-step.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/deterministic-step.js +260 -0
- package/dist/builtin-extensions/pi-prompt-template-model/deterministic-step.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/index.d.ts +3 -0
- package/dist/builtin-extensions/pi-prompt-template-model/index.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/index.js +1403 -0
- package/dist/builtin-extensions/pi-prompt-template-model/index.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/loop-utils.d.ts +8 -0
- package/dist/builtin-extensions/pi-prompt-template-model/loop-utils.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/loop-utils.js +164 -0
- package/dist/builtin-extensions/pi-prompt-template-model/loop-utils.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/model-selection.d.ts +22 -0
- package/dist/builtin-extensions/pi-prompt-template-model/model-selection.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/model-selection.js +82 -0
- package/dist/builtin-extensions/pi-prompt-template-model/model-selection.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/notifications.d.ts +6 -0
- package/dist/builtin-extensions/pi-prompt-template-model/notifications.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/notifications.js +21 -0
- package/dist/builtin-extensions/pi-prompt-template-model/notifications.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-execution.d.ts +24 -0
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-execution.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-execution.js +56 -0
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-execution.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.d.ts +80 -0
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js +1234 -0
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/skill-loaded-renderer.d.ts +11 -0
- package/dist/builtin-extensions/pi-prompt-template-model/skill-loaded-renderer.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/skill-loaded-renderer.js +31 -0
- package/dist/builtin-extensions/pi-prompt-template-model/skill-loaded-renderer.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-renderer.d.ts +43 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-renderer.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-renderer.js +177 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-renderer.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-runtime.d.ts +97 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-runtime.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-runtime.js +64 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-runtime.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-step.d.ts +48 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-step.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-step.js +550 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-step.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-widget.d.ts +8 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-widget.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-widget.js +230 -0
- package/dist/builtin-extensions/pi-prompt-template-model/subagent-widget.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/template-conditionals.d.ts +10 -0
- package/dist/builtin-extensions/pi-prompt-template-model/template-conditionals.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/template-conditionals.js +226 -0
- package/dist/builtin-extensions/pi-prompt-template-model/template-conditionals.js.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts +17 -0
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js +201 -0
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/agents/context-builder.md +46 -0
- package/dist/builtin-extensions/pi-subagents/agents/deep-researcher.md +36 -0
- package/dist/builtin-extensions/pi-subagents/agents/delegate.md +12 -0
- package/dist/builtin-extensions/pi-subagents/agents/oracle.md +73 -0
- package/dist/builtin-extensions/pi-subagents/agents/planner.md +55 -0
- package/dist/builtin-extensions/pi-subagents/agents/research-writer.md +37 -0
- package/dist/builtin-extensions/pi-subagents/agents/researcher.md +52 -0
- package/dist/builtin-extensions/pi-subagents/agents/reviewer.md +79 -0
- package/dist/builtin-extensions/pi-subagents/agents/scout.md +50 -0
- package/dist/builtin-extensions/pi-subagents/agents/worker.md +55 -0
- package/dist/builtin-extensions/pi-subagents/index.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/index.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/index.js +3 -0
- package/dist/builtin-extensions/pi-subagents/index.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.d.ts +20 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.js +1273 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.d.ts +49 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.js +252 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.d.ts +3 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.js +6 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.d.ts +3 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.js +23 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.d.ts +8 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.js +143 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agents.d.ts +176 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agents.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agents.js +1326 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/agents.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.d.ts +7 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.js +307 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/frontmatter.d.ts +11 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/frontmatter.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/frontmatter.js +84 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/frontmatter.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/identity.d.ts +8 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/identity.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/identity.js +30 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/identity.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.d.ts +35 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.js +151 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/skills.d.ts +33 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/skills.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/skills.js +674 -0
- package/dist/builtin-extensions/pi-subagents/src/agents/skills.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/api/background-work.d.ts +35 -0
- package/dist/builtin-extensions/pi-subagents/src/api/background-work.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/api/background-work.js +162 -0
- package/dist/builtin-extensions/pi-subagents/src/api/background-work.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/api/delegation.d.ts +113 -0
- package/dist/builtin-extensions/pi-subagents/src/api/delegation.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/api/delegation.js +10 -0
- package/dist/builtin-extensions/pi-subagents/src/api/delegation.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.d.ts +34 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.js +125 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/config.d.ts +6 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/config.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/config.js +37 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/config.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts +21 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js +70 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/doctor.d.ts +33 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/doctor.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/doctor.js +174 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/doctor.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.d.ts +3 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js +175 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +17 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +577 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/rpc.d.ts +57 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/rpc.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/rpc.js +291 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/rpc.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts +225 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +301 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/steering-notices.d.ts +15 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/steering-notices.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/steering-notices.js +23 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/steering-notices.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +12 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +225 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts +35 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js +144 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts +36 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +626 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.d.ts +31 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.js +331 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.d.ts +131 -0
- package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.js +491 -0
- package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +169 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +1065 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.d.ts +20 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js +500 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts +64 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js +525 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-status.d.ts +96 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-status.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-status.js +336 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-status.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts +15 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js +47 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-append.d.ts +31 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-append.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-append.js +260 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-append.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-root-attachment.d.ts +35 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-root-attachment.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-root-attachment.js +146 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-root-attachment.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/completion-batcher.d.ts +52 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/completion-batcher.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/completion-batcher.js +119 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/completion-batcher.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/completion-dedupe.d.ts +14 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/completion-dedupe.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/completion-dedupe.js +55 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/completion-dedupe.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/control-channel.d.ts +182 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/control-channel.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/control-channel.js +487 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/control-channel.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/fleet-view.d.ts +43 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/fleet-view.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/fleet-view.js +518 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/fleet-view.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts +63 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js +202 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/parallel-groups.d.ts +4 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/parallel-groups.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/parallel-groups.js +47 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/parallel-groups.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts +22 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js +247 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-id-resolver.d.ts +23 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-id-resolver.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-id-resolver.js +91 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-id-resolver.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.d.ts +24 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js +453 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.d.ts +48 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.js +473 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/stale-run-reconciler.d.ts +34 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/stale-run-reconciler.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/stale-run-reconciler.js +351 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/stale-run-reconciler.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/steering.d.ts +44 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/steering.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/steering.js +228 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/steering.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +3513 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts +95 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js +387 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.d.ts +8 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js +6 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-config.d.ts +7 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-config.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-config.js +34 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-config.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts +4 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +24 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/async-steering-action.d.ts +23 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/async-steering-action.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/async-steering-action.js +230 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/async-steering-action.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.d.ts +127 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.js +1161 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts +81 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +1014 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts +10 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +1374 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts +87 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +3358 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts +64 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js +1122 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.d.ts +19 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.js +106 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-protocol.d.ts +27 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-protocol.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-protocol.js +108 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-protocol.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.d.ts +19 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.js +51 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.d.ts +49 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.js +274 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/long-running-guard.d.ts +33 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/long-running-guard.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/long-running-guard.js +152 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/long-running-guard.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.d.ts +18 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.js +326 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts +83 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js +291 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-scope.d.ts +49 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-scope.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-scope.js +98 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-scope.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-events.d.ts +121 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-events.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-events.js +881 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-events.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-path.d.ts +11 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-path.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-path.js +50 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-path.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-render.d.ts +19 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-render.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-render.js +109 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-render.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts +101 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js +112 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +80 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +252 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-spawn.d.ts +25 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-spawn.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-spawn.js +111 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-spawn.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/run-history.d.ts +11 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/run-history.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/run-history.js +57 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/run-history.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/session-lease.d.ts +54 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/session-lease.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/session-lease.js +244 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/session-lease.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/single-output.d.ts +50 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/single-output.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/single-output.js +202 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/single-output.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/structured-output.d.ts +22 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/structured-output.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/structured-output.js +67 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/structured-output.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts +35 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js +187 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts +22 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +438 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts +35 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js +154 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/tool-availability.d.ts +13 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/tool-availability.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/tool-availability.js +51 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/tool-availability.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/tool-budget.d.ts +16 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/tool-budget.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/tool-budget.js +74 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/tool-budget.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/turn-budget.d.ts +14 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/turn-budget.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/turn-budget.js +66 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/turn-budget.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/workflow-graph.d.ts +30 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/workflow-graph.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/workflow-graph.js +200 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/workflow-graph.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/worktree.d.ts +49 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/worktree.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/worktree.js +473 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/worktree.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/artifacts.d.ts +13 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/artifacts.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/artifacts.js +104 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/artifacts.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/atomic-json.d.ts +17 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/atomic-json.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/atomic-json.js +68 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/atomic-json.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-transcript.d.ts +36 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-transcript.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-transcript.js +173 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-transcript.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/file-coalescer.d.ts +11 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/file-coalescer.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/file-coalescer.js +26 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/file-coalescer.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.d.ts +44 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js +158 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts +34 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js +128 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/jsonl-writer.d.ts +20 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/jsonl-writer.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/jsonl-writer.js +59 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/jsonl-writer.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/model-info.d.ts +31 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/model-info.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/model-info.js +68 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/model-info.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/post-exit-stdio-guard.d.ts +17 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/post-exit-stdio-guard.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/post-exit-stdio-guard.js +72 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/post-exit-stdio-guard.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/session-identity.d.ts +7 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/session-identity.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/session-identity.js +7 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/session-identity.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/session-tokens.d.ts +3 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/session-tokens.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/session-tokens.js +49 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/session-tokens.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.d.ts +136 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.js +285 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/status-format.d.ts +10 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/status-format.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/status-format.js +61 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/status-format.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +1101 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js +221 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/utils.d.ts +52 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/utils.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/utils.js +562 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/utils.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.d.ts +149 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.js +321 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/delegation-request.d.ts +11 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/delegation-request.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/delegation-request.js +102 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/delegation-request.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-template-bridge.d.ts +25 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-template-bridge.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-template-bridge.js +200 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-template-bridge.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts +23 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +305 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-bridge.d.ts +31 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-bridge.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-bridge.js +117 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-bridge.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +51 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +1531 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-live-state.d.ts +22 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-live-state.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-live-state.js +246 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-live-state.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/fleet.d.ts +78 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/fleet.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/fleet.js +401 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/fleet.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/render-helpers.d.ts +13 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/render-helpers.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/render-helpers.js +74 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/render-helpers.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +35 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +1687 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/change-signature.d.ts +8 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/change-signature.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/change-signature.js +123 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/change-signature.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/child-status.d.ts +58 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/child-status.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/child-status.js +160 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/child-status.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/emission-guard.d.ts +34 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/emission-guard.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/emission-guard.js +96 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/emission-guard.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/lsp-diagnostics.d.ts +18 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/lsp-diagnostics.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/lsp-diagnostics.js +485 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/lsp-diagnostics.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/model-selection.d.ts +21 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/model-selection.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/model-selection.js +151 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/model-selection.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-child.d.ts +4 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-child.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-child.js +111 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-child.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.d.ts +10 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js +407 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/render.d.ts +12 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/render.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/render.js +55 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/render.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts +29 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js +245 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.d.ts +141 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.js +647 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/settings.d.ts +30 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/settings.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/settings.js +486 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/settings.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts +18 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js +150 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/turn-delta.d.ts +10 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/turn-delta.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/turn-delta.js +159 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/turn-delta.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/types.d.ts +143 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/types.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/types.js +31 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/types.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/warning-format.d.ts +8 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/warning-format.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/warning-format.js +62 -0
- package/dist/builtin-extensions/pi-subagents/src/watchdog/warning-format.js.map +1 -0
- package/dist/builtin-extensions/pi-tps.d.ts +3 -0
- package/dist/builtin-extensions/pi-tps.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-tps.js +89 -0
- package/dist/builtin-extensions/pi-tps.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/activity.d.ts +34 -0
- package/dist/builtin-extensions/pi-web-access/activity.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/activity.js +68 -0
- package/dist/builtin-extensions/pi-web-access/activity.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/brave.d.ts +4 -0
- package/dist/builtin-extensions/pi-web-access/brave.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/brave.js +185 -0
- package/dist/builtin-extensions/pi-web-access/brave.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/chrome-cookies.d.ts +9 -0
- package/dist/builtin-extensions/pi-web-access/chrome-cookies.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/chrome-cookies.js +299 -0
- package/dist/builtin-extensions/pi-web-access/chrome-cookies.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/curator-page.d.ts +13 -0
- package/dist/builtin-extensions/pi-web-access/curator-page.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/curator-page.js +3382 -0
- package/dist/builtin-extensions/pi-web-access/curator-page.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/curator-server.d.ts +71 -0
- package/dist/builtin-extensions/pi-web-access/curator-server.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/curator-server.js +604 -0
- package/dist/builtin-extensions/pi-web-access/curator-server.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/exa.d.ts +10 -0
- package/dist/builtin-extensions/pi-web-access/exa.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/exa.js +391 -0
- package/dist/builtin-extensions/pi-web-access/exa.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/extract.d.ts +48 -0
- package/dist/builtin-extensions/pi-web-access/extract.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/extract.js +619 -0
- package/dist/builtin-extensions/pi-web-access/extract.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/fetch-params.d.ts +21 -0
- package/dist/builtin-extensions/pi-web-access/fetch-params.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/fetch-params.js +44 -0
- package/dist/builtin-extensions/pi-web-access/fetch-params.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/gemini-api.d.ts +18 -0
- package/dist/builtin-extensions/pi-web-access/gemini-api.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/gemini-api.js +120 -0
- package/dist/builtin-extensions/pi-web-access/gemini-api.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts +14 -0
- package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/gemini-search.js +371 -0
- package/dist/builtin-extensions/pi-web-access/gemini-search.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/gemini-url-context.d.ts +4 -0
- package/dist/builtin-extensions/pi-web-access/gemini-url-context.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/gemini-url-context.js +101 -0
- package/dist/builtin-extensions/pi-web-access/gemini-url-context.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/gemini-web-config.d.ts +4 -0
- package/dist/builtin-extensions/pi-web-access/gemini-web-config.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/gemini-web-config.js +43 -0
- package/dist/builtin-extensions/pi-web-access/gemini-web-config.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/gemini-web.d.ts +12 -0
- package/dist/builtin-extensions/pi-web-access/gemini-web.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/gemini-web.js +331 -0
- package/dist/builtin-extensions/pi-web-access/gemini-web.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/github-api.d.ts +7 -0
- package/dist/builtin-extensions/pi-web-access/github-api.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/github-api.js +161 -0
- package/dist/builtin-extensions/pi-web-access/github-api.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/github-extract.d.ts +13 -0
- package/dist/builtin-extensions/pi-web-access/github-extract.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/github-extract.js +558 -0
- package/dist/builtin-extensions/pi-web-access/github-extract.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/index.d.ts +3 -0
- package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/index.js +2347 -0
- package/dist/builtin-extensions/pi-web-access/index.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/openai-search.d.ts +13 -0
- package/dist/builtin-extensions/pi-web-access/openai-search.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/openai-search.js +374 -0
- package/dist/builtin-extensions/pi-web-access/openai-search.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/parallel.d.ts +12 -0
- package/dist/builtin-extensions/pi-web-access/parallel.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/parallel.js +316 -0
- package/dist/builtin-extensions/pi-web-access/parallel.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/pdf-extract.d.ts +26 -0
- package/dist/builtin-extensions/pi-web-access/pdf-extract.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/pdf-extract.js +150 -0
- package/dist/builtin-extensions/pi-web-access/pdf-extract.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/perplexity.d.ts +20 -0
- package/dist/builtin-extensions/pi-web-access/perplexity.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/perplexity.js +150 -0
- package/dist/builtin-extensions/pi-web-access/perplexity.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/render-search-error.d.ts +57 -0
- package/dist/builtin-extensions/pi-web-access/render-search-error.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/render-search-error.js +131 -0
- package/dist/builtin-extensions/pi-web-access/render-search-error.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/rsc-extract.d.ts +12 -0
- package/dist/builtin-extensions/pi-web-access/rsc-extract.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/rsc-extract.js +330 -0
- package/dist/builtin-extensions/pi-web-access/rsc-extract.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/ssrf-protection.d.ts +24 -0
- package/dist/builtin-extensions/pi-web-access/ssrf-protection.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/ssrf-protection.js +255 -0
- package/dist/builtin-extensions/pi-web-access/ssrf-protection.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/storage.d.ts +25 -0
- package/dist/builtin-extensions/pi-web-access/storage.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/storage.js +49 -0
- package/dist/builtin-extensions/pi-web-access/storage.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/summary-model-scope.d.ts +13 -0
- package/dist/builtin-extensions/pi-web-access/summary-model-scope.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/summary-model-scope.js +86 -0
- package/dist/builtin-extensions/pi-web-access/summary-model-scope.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/summary-review.d.ts +21 -0
- package/dist/builtin-extensions/pi-web-access/summary-review.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/summary-review.js +278 -0
- package/dist/builtin-extensions/pi-web-access/summary-review.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/tavily.d.ts +8 -0
- package/dist/builtin-extensions/pi-web-access/tavily.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/tavily.js +184 -0
- package/dist/builtin-extensions/pi-web-access/tavily.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/utils.d.ts +12 -0
- package/dist/builtin-extensions/pi-web-access/utils.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/utils.js +61 -0
- package/dist/builtin-extensions/pi-web-access/utils.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/video-extract.d.ts +14 -0
- package/dist/builtin-extensions/pi-web-access/video-extract.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/video-extract.js +324 -0
- package/dist/builtin-extensions/pi-web-access/video-extract.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/youtube-extract.d.ts +27 -0
- package/dist/builtin-extensions/pi-web-access/youtube-extract.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/youtube-extract.js +282 -0
- package/dist/builtin-extensions/pi-web-access/youtube-extract.js.map +1 -0
- package/dist/builtin-extensions/simple-pi-memory.d.ts +55 -0
- package/dist/builtin-extensions/simple-pi-memory.d.ts.map +1 -0
- package/dist/builtin-extensions/simple-pi-memory.js +239 -0
- package/dist/builtin-extensions/simple-pi-memory.js.map +1 -0
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +11 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -0
- package/dist/bun/register-bedrock.js +4 -0
- package/dist/bun/register-bedrock.js.map +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +17 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +36 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/catalog/models.json +1 -0
- package/dist/catalog/providers/amazon-bedrock.json +1 -0
- package/dist/catalog/providers/ant-ling.json +1 -0
- package/dist/catalog/providers/anthropic.json +1 -0
- package/dist/catalog/providers/azure-openai-responses.json +1 -0
- package/dist/catalog/providers/cerebras.json +1 -0
- package/dist/catalog/providers/cloudflare-ai-gateway.json +1 -0
- package/dist/catalog/providers/cloudflare-workers-ai.json +1 -0
- package/dist/catalog/providers/deepseek.json +1 -0
- package/dist/catalog/providers/fireworks.json +1 -0
- package/dist/catalog/providers/github-copilot.json +1 -0
- package/dist/catalog/providers/google-vertex.json +1 -0
- package/dist/catalog/providers/google.json +1 -0
- package/dist/catalog/providers/groq.json +1 -0
- package/dist/catalog/providers/huggingface.json +1 -0
- package/dist/catalog/providers/kimi-coding.json +1 -0
- package/dist/catalog/providers/minimax-cn.json +1 -0
- package/dist/catalog/providers/minimax.json +1 -0
- package/dist/catalog/providers/mistral.json +1 -0
- package/dist/catalog/providers/moonshotai-cn.json +1 -0
- package/dist/catalog/providers/moonshotai.json +1 -0
- package/dist/catalog/providers/nvidia.json +1 -0
- package/dist/catalog/providers/openai-codex.json +1 -0
- package/dist/catalog/providers/openai.json +1 -0
- package/dist/catalog/providers/opencode-go.json +1 -0
- package/dist/catalog/providers/opencode.json +1 -0
- package/dist/catalog/providers/openrouter.json +1 -0
- package/dist/catalog/providers/qwen-cloud-cn.json +1 -0
- package/dist/catalog/providers/qwen-cloud.json +1 -0
- package/dist/catalog/providers/qwen-token-plan-cn.json +1 -0
- package/dist/catalog/providers/qwen-token-plan.json +1 -0
- package/dist/catalog/providers/together.json +1 -0
- package/dist/catalog/providers/vercel-ai-gateway.json +1 -0
- package/dist/catalog/providers/xai.json +1 -0
- package/dist/catalog/providers/xiaomi-token-plan-ams.json +1 -0
- package/dist/catalog/providers/xiaomi-token-plan-cn.json +1 -0
- package/dist/catalog/providers/xiaomi-token-plan-sgp.json +1 -0
- package/dist/catalog/providers/xiaomi.json +1 -0
- package/dist/catalog/providers/zai-coding-cn.json +1 -0
- package/dist/catalog/providers/zai.json +1 -0
- package/dist/catalog/providers.json +1 -0
- package/dist/catalog/publication.json +6 -0
- package/dist/cli/args.d.ts +57 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +381 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config-selector.d.ts +16 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/file-processor.d.ts +15 -0
- package/dist/cli/file-processor.d.ts.map +1 -0
- package/dist/cli/file-processor.js +70 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/initial-message.d.ts +18 -0
- package/dist/cli/initial-message.d.ts.map +1 -0
- package/dist/cli/initial-message.js +22 -0
- package/dist/cli/initial-message.js.map +1 -0
- package/dist/cli/install-cli.d.ts +13 -0
- package/dist/cli/install-cli.d.ts.map +1 -0
- package/dist/cli/install-cli.js +352 -0
- package/dist/cli/install-cli.js.map +1 -0
- package/dist/cli/list-models.d.ts +9 -0
- package/dist/cli/list-models.d.ts.map +1 -0
- package/dist/cli/list-models.js +98 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/project-trust.d.ts +10 -0
- package/dist/cli/project-trust.d.ts.map +1 -0
- package/dist/cli/project-trust.js +48 -0
- package/dist/cli/project-trust.js.map +1 -0
- package/dist/cli/read-secret.d.ts +6 -0
- package/dist/cli/read-secret.d.ts.map +1 -0
- package/dist/cli/read-secret.js +62 -0
- package/dist/cli/read-secret.js.map +1 -0
- package/dist/cli/session-picker.d.ts +10 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +36 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +20 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +190 -0
- package/dist/cli/startup-ui.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +18 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +84 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +211 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +119 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +306 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +85 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +120 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session.d.ts +650 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +2797 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-guidance.d.ts +5 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +21 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +56 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +229 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +32 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +111 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/cache-stats.d.ts +49 -0
- package/dist/core/cache-stats.d.ts.map +1 -0
- package/dist/core/cache-stats.js +101 -0
- package/dist/core/cache-stats.js.map +1 -0
- package/dist/core/catalog-merge.d.ts +46 -0
- package/dist/core/catalog-merge.d.ts.map +1 -0
- package/dist/core/catalog-merge.js +128 -0
- package/dist/core/catalog-merge.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +92 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +249 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +121 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +600 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.d.ts.map +1 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/index.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +38 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +153 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/context-breakdown.d.ts +67 -0
- package/dist/core/context-breakdown.d.ts.map +1 -0
- package/dist/core/context-breakdown.js +116 -0
- package/dist/core/context-breakdown.js.map +1 -0
- package/dist/core/cron/fire-guard.d.ts +16 -0
- package/dist/core/cron/fire-guard.d.ts.map +1 -0
- package/dist/core/cron/fire-guard.js +24 -0
- package/dist/core/cron/fire-guard.js.map +1 -0
- package/dist/core/cron/jobs.d.ts +162 -0
- package/dist/core/cron/jobs.d.ts.map +1 -0
- package/dist/core/cron/jobs.js +545 -0
- package/dist/core/cron/jobs.js.map +1 -0
- package/dist/core/cron/origin-context.d.ts +22 -0
- package/dist/core/cron/origin-context.d.ts.map +1 -0
- package/dist/core/cron/origin-context.js +22 -0
- package/dist/core/cron/origin-context.js.map +1 -0
- package/dist/core/cron/scheduler.d.ts +51 -0
- package/dist/core/cron/scheduler.d.ts.map +1 -0
- package/dist/core/cron/scheduler.js +165 -0
- package/dist/core/cron/scheduler.js.map +1 -0
- package/dist/core/customize.d.ts +31 -0
- package/dist/core/customize.d.ts.map +1 -0
- package/dist/core/customize.js +54 -0
- package/dist/core/customize.js.map +1 -0
- package/dist/core/defaults.d.ts +3 -0
- package/dist/core/defaults.d.ts.map +1 -0
- package/dist/core/defaults.js +2 -0
- package/dist/core/defaults.js.map +1 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +29 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +75 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/experimental.d.ts +2 -0
- package/dist/core/experimental.d.ts.map +1 -0
- package/dist/core/experimental.js +4 -0
- package/dist/core/experimental.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +37 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +226 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1864 -0
- package/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +108 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +78 -0
- package/dist/core/extensions/index.d.ts +12 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/index.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +23 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +547 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +170 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +923 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1247 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +45 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +41 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +54 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +338 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -0
- package/dist/core/http-dispatcher.js +91 -0
- package/dist/core/http-dispatcher.js.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/injected-prompt.d.ts +20 -0
- package/dist/core/injected-prompt.d.ts.map +1 -0
- package/dist/core/injected-prompt.js +64 -0
- package/dist/core/injected-prompt.js.map +1 -0
- package/dist/core/install-features.d.ts +106 -0
- package/dist/core/install-features.d.ts.map +1 -0
- package/dist/core/install-features.js +392 -0
- package/dist/core/install-features.js.map +1 -0
- package/dist/core/install-layout.d.ts +18 -0
- package/dist/core/install-layout.d.ts.map +1 -0
- package/dist/core/install-layout.js +54 -0
- package/dist/core/install-layout.js.map +1 -0
- package/dist/core/keybindings.d.ts +373 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +309 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/live-catalog.d.ts +74 -0
- package/dist/core/live-catalog.d.ts.map +1 -0
- package/dist/core/live-catalog.js +351 -0
- package/dist/core/live-catalog.js.map +1 -0
- package/dist/core/memory-cap.d.ts +27 -0
- package/dist/core/memory-cap.d.ts.map +1 -0
- package/dist/core/memory-cap.js +32 -0
- package/dist/core/memory-cap.js.map +1 -0
- package/dist/core/messages.d.ts +77 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +123 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-config-writer.d.ts +24 -0
- package/dist/core/model-config-writer.d.ts.map +1 -0
- package/dist/core/model-config-writer.js +84 -0
- package/dist/core/model-config-writer.js.map +1 -0
- package/dist/core/model-config.d.ts +512 -0
- package/dist/core/model-config.d.ts.map +1 -0
- package/dist/core/model-config.js +243 -0
- package/dist/core/model-config.js.map +1 -0
- package/dist/core/model-registry.d.ts +39 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +89 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +121 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +536 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/model-runtime.d.ts +115 -0
- package/dist/core/model-runtime.d.ts.map +1 -0
- package/dist/core/model-runtime.js +640 -0
- package/dist/core/model-runtime.js.map +1 -0
- package/dist/core/model-tiers.d.ts +34 -0
- package/dist/core/model-tiers.d.ts.map +1 -0
- package/dist/core/model-tiers.js +53 -0
- package/dist/core/model-tiers.js.map +1 -0
- package/dist/core/models-store.d.ts +17 -0
- package/dist/core/models-store.d.ts.map +1 -0
- package/dist/core/models-store.js +45 -0
- package/dist/core/models-store.js.map +1 -0
- package/dist/core/official-catalog.d.ts +72 -0
- package/dist/core/official-catalog.d.ts.map +1 -0
- package/dist/core/official-catalog.js +370 -0
- package/dist/core/official-catalog.js.map +1 -0
- package/dist/core/output-guard.d.ts +7 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +89 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-manager.d.ts +198 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +2005 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/permission-mode.d.ts +19 -0
- package/dist/core/permission-mode.d.ts.map +1 -0
- package/dist/core/permission-mode.js +26 -0
- package/dist/core/permission-mode.js.map +1 -0
- package/dist/core/permissions.d.ts +99 -0
- package/dist/core/permissions.d.ts.map +1 -0
- package/dist/core/permissions.js +323 -0
- package/dist/core/permissions.js.map +1 -0
- package/dist/core/plan-mode.d.ts +37 -0
- package/dist/core/plan-mode.d.ts.map +1 -0
- package/dist/core/plan-mode.js +388 -0
- package/dist/core/plan-mode.js.map +1 -0
- package/dist/core/process-registry.d.ts +40 -0
- package/dist/core/process-registry.d.ts.map +1 -0
- package/dist/core/process-registry.js +190 -0
- package/dist/core/process-registry.js.map +1 -0
- package/dist/core/project-trust.d.ts +15 -0
- package/dist/core/project-trust.d.ts.map +1 -0
- package/dist/core/project-trust.js +59 -0
- package/dist/core/project-trust.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +53 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +236 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/provider-attribution.d.ts +4 -0
- package/dist/core/provider-attribution.d.ts.map +1 -0
- package/dist/core/provider-attribution.js +31 -0
- package/dist/core/provider-attribution.js.map +1 -0
- package/dist/core/provider-composer.d.ts +55 -0
- package/dist/core/provider-composer.d.ts.map +1 -0
- package/dist/core/provider-composer.js +375 -0
- package/dist/core/provider-composer.js.map +1 -0
- package/dist/core/radius.d.ts +2 -0
- package/dist/core/radius.d.ts.map +1 -0
- package/dist/core/radius.js +2 -0
- package/dist/core/radius.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +247 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +206 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +816 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/rollback.d.ts +80 -0
- package/dist/core/rollback.d.ts.map +1 -0
- package/dist/core/rollback.js +582 -0
- package/dist/core/rollback.js.map +1 -0
- package/dist/core/runtime-credentials.d.ts +15 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -0
- package/dist/core/runtime-credentials.js +36 -0
- package/dist/core/runtime-credentials.js.map +1 -0
- package/dist/core/sdk.d.ts +106 -0
- package/dist/core/sdk.d.ts.map +1 -0
- package/dist/core/sdk.js +264 -0
- package/dist/core/sdk.js.map +1 -0
- package/dist/core/search-curator.d.ts +23 -0
- package/dist/core/search-curator.d.ts.map +1 -0
- package/dist/core/search-curator.js +34 -0
- package/dist/core/search-curator.js.map +1 -0
- package/dist/core/session-cwd.d.ts +19 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +38 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/session-manager.d.ts +351 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1262 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/session-retention.d.ts +17 -0
- package/dist/core/session-retention.d.ts.map +1 -0
- package/dist/core/session-retention.js +69 -0
- package/dist/core/session-retention.js.map +1 -0
- package/dist/core/settings-manager.d.ts +355 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +1064 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +60 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +387 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +15 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +58 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/source-info.d.ts +18 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +19 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/subscriptions.d.ts +64 -0
- package/dist/core/subscriptions.d.ts.map +1 -0
- package/dist/core/subscriptions.js +259 -0
- package/dist/core/subscriptions.js.map +1 -0
- package/dist/core/swarm.d.ts +41 -0
- package/dist/core/swarm.d.ts.map +1 -0
- package/dist/core/swarm.js +81 -0
- package/dist/core/swarm.js.map +1 -0
- package/dist/core/system-prompt.d.ts +28 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +107 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/timings.d.ts +10 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +41 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +69 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +395 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +106 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +424 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +51 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +293 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +52 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +35 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +313 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +37 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +312 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +40 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +112 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +37 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +175 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +52 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +184 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +10 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +99 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +35 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +285 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +36 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +88 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.js +34 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
- package/dist/core/tools/truncate.d.ts +70 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +215 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/write.d.ts +26 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +202 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/core/trust-manager.d.ts +36 -0
- package/dist/core/trust-manager.d.ts.map +1 -0
- package/dist/core/trust-manager.js +202 -0
- package/dist/core/trust-manager.js.map +1 -0
- package/dist/core/usage-adapters/kimi-coding.d.ts +11 -0
- package/dist/core/usage-adapters/kimi-coding.d.ts.map +1 -0
- package/dist/core/usage-adapters/kimi-coding.js +78 -0
- package/dist/core/usage-adapters/kimi-coding.js.map +1 -0
- package/dist/core/usage-adapters/openai-codex.d.ts +4 -0
- package/dist/core/usage-adapters/openai-codex.d.ts.map +1 -0
- package/dist/core/usage-adapters/openai-codex.js +180 -0
- package/dist/core/usage-adapters/openai-codex.js.map +1 -0
- package/dist/core/usage-adapters/shared.d.ts +20 -0
- package/dist/core/usage-adapters/shared.d.ts.map +1 -0
- package/dist/core/usage-adapters/shared.js +75 -0
- package/dist/core/usage-adapters/shared.js.map +1 -0
- package/dist/core/usage-adapters/xai.d.ts +21 -0
- package/dist/core/usage-adapters/xai.d.ts.map +1 -0
- package/dist/core/usage-adapters/xai.js +77 -0
- package/dist/core/usage-adapters/xai.js.map +1 -0
- package/dist/core/usage-adapters/zai.d.ts +14 -0
- package/dist/core/usage-adapters/zai.d.ts.map +1 -0
- package/dist/core/usage-adapters/zai.js +67 -0
- package/dist/core/usage-adapters/zai.js.map +1 -0
- package/dist/core/usage-history.d.ts +63 -0
- package/dist/core/usage-history.d.ts.map +1 -0
- package/dist/core/usage-history.js +239 -0
- package/dist/core/usage-history.js.map +1 -0
- package/dist/core/usage-limit.d.ts +17 -0
- package/dist/core/usage-limit.d.ts.map +1 -0
- package/dist/core/usage-limit.js +79 -0
- package/dist/core/usage-limit.js.map +1 -0
- package/dist/core/usage-service.d.ts +33 -0
- package/dist/core/usage-service.d.ts.map +1 -0
- package/dist/core/usage-service.js +56 -0
- package/dist/core/usage-service.js.map +1 -0
- package/dist/core/user-models.d.ts +50 -0
- package/dist/core/user-models.d.ts.map +1 -0
- package/dist/core/user-models.js +192 -0
- package/dist/core/user-models.js.map +1 -0
- package/dist/gateway/adapters/discord.d.ts +251 -0
- package/dist/gateway/adapters/discord.d.ts.map +1 -0
- package/dist/gateway/adapters/discord.js +693 -0
- package/dist/gateway/adapters/discord.js.map +1 -0
- package/dist/gateway/adapters/telegram.d.ts +187 -0
- package/dist/gateway/adapters/telegram.d.ts.map +1 -0
- package/dist/gateway/adapters/telegram.js +581 -0
- package/dist/gateway/adapters/telegram.js.map +1 -0
- package/dist/gateway/agent-bridge.d.ts +143 -0
- package/dist/gateway/agent-bridge.d.ts.map +1 -0
- package/dist/gateway/agent-bridge.js +466 -0
- package/dist/gateway/agent-bridge.js.map +1 -0
- package/dist/gateway/approval.d.ts +34 -0
- package/dist/gateway/approval.d.ts.map +1 -0
- package/dist/gateway/approval.js +152 -0
- package/dist/gateway/approval.js.map +1 -0
- package/dist/gateway/authz.d.ts +21 -0
- package/dist/gateway/authz.d.ts.map +1 -0
- package/dist/gateway/authz.js +61 -0
- package/dist/gateway/authz.js.map +1 -0
- package/dist/gateway/buttons.d.ts +58 -0
- package/dist/gateway/buttons.d.ts.map +1 -0
- package/dist/gateway/buttons.js +269 -0
- package/dist/gateway/buttons.js.map +1 -0
- package/dist/gateway/command.d.ts +8 -0
- package/dist/gateway/command.d.ts.map +1 -0
- package/dist/gateway/command.js +16 -0
- package/dist/gateway/command.js.map +1 -0
- package/dist/gateway/commands.d.ts +43 -0
- package/dist/gateway/commands.d.ts.map +1 -0
- package/dist/gateway/commands.js +642 -0
- package/dist/gateway/commands.js.map +1 -0
- package/dist/gateway/config.d.ts +53 -0
- package/dist/gateway/config.d.ts.map +1 -0
- package/dist/gateway/config.js +136 -0
- package/dist/gateway/config.js.map +1 -0
- package/dist/gateway/cron.d.ts +69 -0
- package/dist/gateway/cron.d.ts.map +1 -0
- package/dist/gateway/cron.js +321 -0
- package/dist/gateway/cron.js.map +1 -0
- package/dist/gateway/index.d.ts +31 -0
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/index.js +233 -0
- package/dist/gateway/index.js.map +1 -0
- package/dist/gateway/pairing.d.ts +44 -0
- package/dist/gateway/pairing.d.ts.map +1 -0
- package/dist/gateway/pairing.js +171 -0
- package/dist/gateway/pairing.js.map +1 -0
- package/dist/gateway/router.d.ts +48 -0
- package/dist/gateway/router.d.ts.map +1 -0
- package/dist/gateway/router.js +215 -0
- package/dist/gateway/router.js.map +1 -0
- package/dist/gateway/session-keys.d.ts +18 -0
- package/dist/gateway/session-keys.d.ts.map +1 -0
- package/dist/gateway/session-keys.js +26 -0
- package/dist/gateway/session-keys.js.map +1 -0
- package/dist/gateway/store.d.ts +28 -0
- package/dist/gateway/store.d.ts.map +1 -0
- package/dist/gateway/store.js +93 -0
- package/dist/gateway/store.js.map +1 -0
- package/dist/gateway/stream.d.ts +55 -0
- package/dist/gateway/stream.d.ts.map +1 -0
- package/dist/gateway/stream.js +107 -0
- package/dist/gateway/stream.js.map +1 -0
- package/dist/gateway/text.d.ts +18 -0
- package/dist/gateway/text.d.ts.map +1 -0
- package/dist/gateway/text.js +136 -0
- package/dist/gateway/text.js.map +1 -0
- package/dist/gateway/types.d.ts +95 -0
- package/dist/gateway/types.d.ts.map +1 -0
- package/dist/gateway/types.js +9 -0
- package/dist/gateway/types.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +12 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +742 -0
- package/dist/main.js.map +1 -0
- package/dist/migrations.d.ts +46 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +351 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/index.d.ts +9 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +8 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/modes/interactive/components/armin.d.ts.map +1 -0
- package/dist/modes/interactive/components/armin.js +333 -0
- package/dist/modes/interactive/components/armin.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +31 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +246 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +32 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +171 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/boot-ascii.d.ts +6 -0
- package/dist/modes/interactive/components/boot-ascii.d.ts.map +1 -0
- package/dist/modes/interactive/components/boot-ascii.js +6 -0
- package/dist/modes/interactive/components/boot-ascii.js.map +1 -0
- package/dist/modes/interactive/components/boot-screen.d.ts +22 -0
- package/dist/modes/interactive/components/boot-screen.d.ts.map +1 -0
- package/dist/modes/interactive/components/boot-screen.js +53 -0
- package/dist/modes/interactive/components/boot-screen.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +54 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +44 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +45 -0
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +102 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +761 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/context-view.d.ts +13 -0
- package/dist/modes/interactive/components/context-view.d.ts.map +1 -0
- package/dist/modes/interactive/components/context-view.js +42 -0
- package/dist/modes/interactive/components/context-view.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +70 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-entry.d.ts +19 -0
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-entry.js +52 -0
- package/dist/modes/interactive/components/custom-entry.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +79 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
- package/dist/modes/interactive/components/daxnuts.js +140 -0
- package/dist/modes/interactive/components/daxnuts.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +133 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +21 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
- package/dist/modes/interactive/components/earendil-announcement.js +40 -0
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
- package/dist/modes/interactive/components/exit-card.d.ts +22 -0
- package/dist/modes/interactive/components/exit-card.d.ts.map +1 -0
- package/dist/modes/interactive/components/exit-card.js +69 -0
- package/dist/modes/interactive/components/exit-card.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +22 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +128 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-input.js +61 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +30 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +106 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.js +99 -0
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +32 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +221 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +34 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/dist/modes/interactive/components/index.js +35 -0
- package/dist/modes/interactive/components/index.js.map +1 -0
- package/dist/modes/interactive/components/injected-prompt-message.d.ts +21 -0
- package/dist/modes/interactive/components/injected-prompt-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/injected-prompt-message.js +51 -0
- package/dist/modes/interactive/components/injected-prompt-message.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +36 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +52 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +188 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +61 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +320 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +163 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/processes-selector.d.ts +19 -0
- package/dist/modes/interactive/components/processes-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/processes-selector.js +170 -0
- package/dist/modes/interactive/components/processes-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +42 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +293 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +155 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +857 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +139 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +1156 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +39 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +47 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/status-indicator.d.ts +28 -0
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
- package/dist/modes/interactive/components/status-indicator.js +60 -0
- package/dist/modes/interactive/components/status-indicator.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js +50 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.js +52 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/thinking-summary.d.ts +36 -0
- package/dist/modes/interactive/components/thinking-summary.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-summary.js +94 -0
- package/dist/modes/interactive/components/thinking-summary.js.map +1 -0
- package/dist/modes/interactive/components/thinking-tail.d.ts +21 -0
- package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-tail.js +29 -0
- package/dist/modes/interactive/components/thinking-tail.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +67 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +340 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +94 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1245 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/trust-selector.js +91 -0
- package/dist/modes/interactive/components/trust-selector.js.map +1 -0
- package/dist/modes/interactive/components/usage-view.d.ts +63 -0
- package/dist/modes/interactive/components/usage-view.d.ts.map +1 -0
- package/dist/modes/interactive/components/usage-view.js +189 -0
- package/dist/modes/interactive/components/usage-view.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +114 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +16 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +62 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +448 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +6487 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/model-search.d.ts +12 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -0
- package/dist/modes/interactive/model-search.js +15 -0
- package/dist/modes/interactive/model-search.js.map +1 -0
- package/dist/modes/interactive/smooth-streaming.d.ts +10 -0
- package/dist/modes/interactive/smooth-streaming.d.ts.map +1 -0
- package/dist/modes/interactive/smooth-streaming.js +95 -0
- package/dist/modes/interactive/smooth-streaming.js.map +1 -0
- package/dist/modes/interactive/theme/moon.json +83 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +97 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +363 -0
- package/dist/modes/interactive/theme/theme.d.ts +128 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +1092 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/print-mode.d.ts +28 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +132 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +49 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +242 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +481 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +635 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +446 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/package-manager-cli.d.ts +8 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +378 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/rpc-entry.d.ts +3 -0
- package/dist/rpc-entry.d.ts.map +1 -0
- package/dist/rpc-entry.js +10 -0
- package/dist/rpc-entry.js.map +1 -0
- package/dist/utils/ansi.d.ts +2 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +52 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/child-process.d.ts +18 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +106 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +300 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +20 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +4 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +130 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/deprecation.d.ts +4 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/deprecation.js +13 -0
- package/dist/utils/deprecation.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +158 -0
- package/dist/utils/exif-orientation.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/fs-watch.d.ts +5 -0
- package/dist/utils/fs-watch.d.ts.map +1 -0
- package/dist/utils/fs-watch.js +25 -0
- package/dist/utils/fs-watch.js.map +1 -0
- package/dist/utils/git.d.ts +26 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +195 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/image-convert.d.ts +10 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +45 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-process.d.ts +18 -0
- package/dist/utils/image-process.d.ts.map +1 -0
- package/dist/utils/image-process.js +83 -0
- package/dist/utils/image-process.js.map +1 -0
- package/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -0
- package/dist/utils/image-resize-core.js +124 -0
- package/dist/utils/image-resize-core.js.map +1 -0
- package/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/utils/image-resize-worker.d.ts.map +1 -0
- package/dist/utils/image-resize-worker.js +31 -0
- package/dist/utils/image-resize-worker.js.map +1 -0
- package/dist/utils/image-resize.d.ts +16 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +97 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +7 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/mime.d.ts +3 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +110 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +22 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/paths.d.ts +31 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +92 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/photon.d.ts +21 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +121 -0
- package/dist/utils/photon.js.map +1 -0
- package/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/utils/pi-user-agent.d.ts.map +1 -0
- package/dist/utils/pi-user-agent.js +5 -0
- package/dist/utils/pi-user-agent.js.map +1 -0
- package/dist/utils/shell.d.ts +31 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +202 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +118 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +3 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +328 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/docs/compaction.md +396 -0
- package/docs/containerization.md +111 -0
- package/docs/custom-provider.md +735 -0
- package/docs/development.md +71 -0
- package/docs/docs.json +156 -0
- package/docs/extensions.md +2911 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +82 -0
- package/docs/json.md +82 -0
- package/docs/keybindings.md +201 -0
- package/docs/models.md +540 -0
- package/docs/packages.md +228 -0
- package/docs/prompt-templates.md +95 -0
- package/docs/providers.md +294 -0
- package/docs/quickstart.md +165 -0
- package/docs/rpc.md +1480 -0
- package/docs/sdk.md +1183 -0
- package/docs/security.md +59 -0
- package/docs/session-format.md +422 -0
- package/docs/sessions.md +145 -0
- package/docs/settings.md +302 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +231 -0
- package/docs/terminal-setup.md +142 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +297 -0
- package/docs/tmux.md +63 -0
- package/docs/tui.md +927 -0
- package/docs/usage.md +312 -0
- package/docs/windows.md +17 -0
- package/examples/README.md +25 -0
- package/examples/extensions/README.md +213 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +150 -0
- package/examples/extensions/built-in-tool-renderer.ts +249 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +128 -0
- package/examples/extensions/custom-footer.ts +64 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +604 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +404 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +15 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/entry-renderer.ts +41 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/gondolin/index.ts +531 -0
- package/examples/extensions/gondolin/package-lock.json +185 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/examples/extensions/handoff.ts +191 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform-streaming.ts +39 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/kimi-deferred-tools.ts +61 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +426 -0
- package/examples/extensions/modal-editor.ts +85 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +55 -0
- package/examples/extensions/overlay-qa-tests.ts +1450 -0
- package/examples/extensions/overlay-test.ts +153 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +66 -0
- package/examples/extensions/plan-mode/index.ts +390 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +436 -0
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +122 -0
- package/examples/extensions/question.ts +286 -0
- package/examples/extensions/questionnaire.ts +448 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/sandbox/index.ts +321 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +343 -0
- package/examples/extensions/space-invaders.ts +560 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +175 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +126 -0
- package/examples/extensions/subagent/index.ts +1015 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +207 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1008 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +297 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +146 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +195 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/rpc-extension-ui.ts +632 -0
- package/examples/sdk/01-minimal.ts +26 -0
- package/examples/sdk/02-custom-model.ts +50 -0
- package/examples/sdk/03-custom-prompt.ts +75 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +48 -0
- package/examples/sdk/06-extensions.ts +99 -0
- package/examples/sdk/07-context-files.ts +47 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +52 -0
- package/examples/sdk/12-full-control.ts +72 -0
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/README.md +140 -0
- package/package.json +116 -0
|
@@ -0,0 +1,3358 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import * as fs from "node:fs";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { getArtifactsDir, getProjectChainRunsDir } from "../../shared/artifacts.js";
|
|
6
|
+
import { ChainClarifyComponent } from "./chain-clarify.js";
|
|
7
|
+
import { toModelInfo } from "../../shared/model-info.js";
|
|
8
|
+
import { executeChain } from "./chain-execution.js";
|
|
9
|
+
import { resolveExecutionAgentScope } from "../../agents/agent-scope.js";
|
|
10
|
+
import { handleManagementAction } from "../../agents/agent-management.js";
|
|
11
|
+
import { buildDoctorReport } from "../../extension/doctor.js";
|
|
12
|
+
import { clearPendingForegroundControlNotices } from "../../extension/control-notices.js";
|
|
13
|
+
import { runSync } from "./execution.js";
|
|
14
|
+
import { handleWatchdogToolAction, WATCHDOG_TOOL_ACTIONS } from "../../watchdog/tool-actions.js";
|
|
15
|
+
import { buildModelCandidates, resolveEffectiveSubagentModel, resolveTierModelOverride } from "../shared/model-fallback.js";
|
|
16
|
+
import { aggregateParallelOutputs } from "../shared/parallel-utils.js";
|
|
17
|
+
import { recordRun } from "../shared/run-history.js";
|
|
18
|
+
import { buildChainInstructions, writeInitialProgressFile, getStepAgents, isParallelStep, isDynamicParallelStep, resolveStepBehavior, suppressProgressForReadOnlyTask, taskDisallowsFileUpdates, } from "../../shared/settings.js";
|
|
19
|
+
import { discoverAvailableSkills, normalizeSkillInput } from "../../agents/skills.js";
|
|
20
|
+
import { buildAsyncRunnerSteps, executeAsyncChain, executeAsyncSingle, formatAsyncStartedMessage, isAsyncAvailable } from "../background/async-execution.js";
|
|
21
|
+
import { enqueueChainAppendRequest, readPendingChainAppendRequests, runnerStepOutputNames } from "../background/chain-append.js";
|
|
22
|
+
import { ChainOutputValidationError, validateChainOutputBindingsWithContext } from "../shared/chain-outputs.js";
|
|
23
|
+
import { validateExecutionAcceptance } from "../shared/acceptance.js";
|
|
24
|
+
import { createForkContextResolver, forkedChildRequiresThinkingOff } from "../../shared/fork-context.js";
|
|
25
|
+
import { resolveCurrentSessionId } from "../../shared/session-identity.js";
|
|
26
|
+
import { applyIntercomBridgeToAgent, INTERCOM_BRIDGE_MARKER, resolveIntercomBridge, resolveIntercomSessionTarget, resolveSubagentIntercomTarget } from "../../intercom/intercom-bridge.js";
|
|
27
|
+
import { formatControlIntercomMessage, formatControlNoticeMessage, resolveControlConfig, shouldNotifyControlEvent } from "../shared/subagent-control.js";
|
|
28
|
+
import { resolveTurnBudgetConfig } from "../shared/turn-budget.js";
|
|
29
|
+
import { validateToolBudgetConfig } from "../shared/tool-budget.js";
|
|
30
|
+
import { finalizeSingleOutput, injectSingleOutputInstruction, normalizeSingleOutputOverride, resolveSingleOutputPath, validateFileOnlyOutputMode } from "../shared/single-output.js";
|
|
31
|
+
import { compactForegroundDetails, getSingleResultOutput, mapConcurrent, readStatus, resolveChildCwd, sumResultsCost, sumResultsUsage } from "../../shared/utils.js";
|
|
32
|
+
import { DEFAULT_GLOBAL_CONCURRENCY_LIMIT, Semaphore } from "../shared/parallel-utils.js";
|
|
33
|
+
import { attachNestedChildrenToResultChildren, buildSubagentResultIntercomPayload, deliverSubagentIntercomMessageEvent, deliverSubagentResultIntercomEvent, formatSubagentResultReceipt, resolveSubagentResultStatus, stripDetailsOutputsForIntercomReceipt, } from "../../intercom/result-intercom.js";
|
|
34
|
+
import { applySteeringRecoveryAgentConfig, buildRevivedAsyncTask, interruptLiveAsyncResumeTarget, resolveAsyncResumeTarget, resolveAsyncRunLocation } from "../background/async-resume.js";
|
|
35
|
+
import { deliverInterruptRequest, deliverStopRequest, requestAsyncSteer } from "../background/control-channel.js";
|
|
36
|
+
import { waitForSteeringAction } from "../background/steering.js";
|
|
37
|
+
import { steerAsyncRun } from "./async-steering-action.js";
|
|
38
|
+
import { reconcileAsyncRun } from "../background/stale-run-reconciler.js";
|
|
39
|
+
import { resolveAsyncRootResultPath } from "../background/chain-root-attachment.js";
|
|
40
|
+
import { attachRootChildrenToSteps, createNestedRoute, readNestedControlResults, resolveInheritedNestedRouteFromEnv, resolveNestedAsyncDir, resolveNestedParentAddressFromEnv, updateForegroundNestedProjection, writeNestedControlRequest, writeNestedEvent } from "../shared/nested-events.js";
|
|
41
|
+
import { resolveSubagentRunId } from "../background/run-id-resolver.js";
|
|
42
|
+
import { formatNestedRunStatusLines } from "../shared/nested-render.js";
|
|
43
|
+
import { inspectSubagentStatus } from "../background/run-status.js";
|
|
44
|
+
import { applyForceTopLevelAsyncOverride } from "../background/top-level-async.js";
|
|
45
|
+
import { cleanupWorktrees, createWorktrees, diffWorktrees, findWorktreeTaskCwdConflict, formatWorktreeDiffSummary, formatWorktreeTaskCwdConflict, } from "../shared/worktree.js";
|
|
46
|
+
import { ASYNC_DIR, DEFAULT_ARTIFACT_CONFIG, DEFAULT_FORK_PREAMBLE, RESULTS_DIR, SUBAGENT_ACTIONS, SUBAGENT_CONTROL_EVENT, SUBAGENT_CONTROL_INTERCOM_EVENT, SUBAGENT_FOREGROUND_COMPLETE_EVENT, checkSubagentDepth, resolveMaxSubagentSpawnsPerSession, resolveTopLevelParallelConcurrency, resolveTopLevelParallelMaxTasks, resolveChildMaxSubagentDepth, resolveCurrentMaxSubagentDepth, wrapForkTask, } from "../../shared/types.js";
|
|
47
|
+
const MUTATING_MANAGEMENT_ACTIONS = new Set(["create", "update", "delete", "eject", "disable", "enable", "reset", "watchdog.configure"]);
|
|
48
|
+
function resolveRequestedCwd(runtimeCwd, requestedCwd) {
|
|
49
|
+
return requestedCwd ? path.resolve(runtimeCwd, requestedCwd) : runtimeCwd;
|
|
50
|
+
}
|
|
51
|
+
function getForegroundControl(state, runId) {
|
|
52
|
+
if (runId)
|
|
53
|
+
return state.foregroundControls.get(runId);
|
|
54
|
+
if (state.lastForegroundControlId) {
|
|
55
|
+
const latest = state.foregroundControls.get(state.lastForegroundControlId);
|
|
56
|
+
if (latest)
|
|
57
|
+
return latest;
|
|
58
|
+
}
|
|
59
|
+
let newest;
|
|
60
|
+
for (const control of state.foregroundControls.values()) {
|
|
61
|
+
if (!newest || control.updatedAt > newest.updatedAt)
|
|
62
|
+
newest = control;
|
|
63
|
+
}
|
|
64
|
+
return newest;
|
|
65
|
+
}
|
|
66
|
+
function formatForegroundActivity(control) {
|
|
67
|
+
const facts = [];
|
|
68
|
+
if (control.currentTool && control.currentToolStartedAt)
|
|
69
|
+
facts.push(`tool ${control.currentTool} for ${Math.floor(Math.max(0, Date.now() - control.currentToolStartedAt) / 1000)}s`);
|
|
70
|
+
else if (control.currentTool)
|
|
71
|
+
facts.push(`tool ${control.currentTool}`);
|
|
72
|
+
if (control.currentPath)
|
|
73
|
+
facts.push(`path ${control.currentPath}`);
|
|
74
|
+
if (control.turnCount !== undefined)
|
|
75
|
+
facts.push(`${control.turnCount} turns`);
|
|
76
|
+
if (control.tokens !== undefined)
|
|
77
|
+
facts.push(`${control.tokens} tokens`);
|
|
78
|
+
if (control.toolCount !== undefined)
|
|
79
|
+
facts.push(`${control.toolCount} tools`);
|
|
80
|
+
if (!control.lastActivityAt) {
|
|
81
|
+
if (control.currentActivityState === "needs_attention")
|
|
82
|
+
return ["needs attention", ...facts].join(" | ");
|
|
83
|
+
if (control.currentActivityState === "active_long_running")
|
|
84
|
+
return ["active but long-running", ...facts].join(" | ");
|
|
85
|
+
return facts.length ? facts.join(" | ") : undefined;
|
|
86
|
+
}
|
|
87
|
+
const seconds = Math.floor(Math.max(0, Date.now() - control.lastActivityAt) / 1000);
|
|
88
|
+
if (control.currentActivityState === "needs_attention")
|
|
89
|
+
return [`no activity for ${seconds}s`, ...facts].join(" | ");
|
|
90
|
+
if (control.currentActivityState === "active_long_running")
|
|
91
|
+
return [`active but long-running; last activity ${seconds}s ago`, ...facts].join(" | ");
|
|
92
|
+
return [`active ${seconds}s ago`, ...facts].join(" | ");
|
|
93
|
+
}
|
|
94
|
+
function nestedResolutionScopeForExecutor(deps) {
|
|
95
|
+
if (deps.allowMutatingManagementActions !== false)
|
|
96
|
+
return undefined;
|
|
97
|
+
const route = resolveInheritedNestedRouteFromEnv();
|
|
98
|
+
const address = route ? resolveNestedParentAddressFromEnv() : undefined;
|
|
99
|
+
return {
|
|
100
|
+
routes: route ? [route] : [],
|
|
101
|
+
...(address ? { descendantOf: { parentRunId: address.parentRunId, ...(address.parentStepIndex !== undefined ? { parentStepIndex: address.parentStepIndex } : {}) } } : {}),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function trustedSessionRootsForStatus(ctx, deps) {
|
|
105
|
+
const roots = deps.config.defaultSessionDir ? [path.resolve(deps.expandTilde(deps.config.defaultSessionDir))] : [];
|
|
106
|
+
const parentSessionFile = ctx.sessionManager.getSessionFile() ?? null;
|
|
107
|
+
if (parentSessionFile)
|
|
108
|
+
roots.push(deps.getSubagentSessionRoot(parentSessionFile));
|
|
109
|
+
return [...new Set(roots)];
|
|
110
|
+
}
|
|
111
|
+
function reserveSubagentSpawns(input) {
|
|
112
|
+
if (input.requested <= 0)
|
|
113
|
+
return undefined;
|
|
114
|
+
const maxSpawns = resolveMaxSubagentSpawnsPerSession(input.config.maxSubagentSpawnsPerSession);
|
|
115
|
+
if (maxSpawns === undefined)
|
|
116
|
+
return undefined;
|
|
117
|
+
if (input.state.subagentSpawns?.sessionId !== input.sessionId) {
|
|
118
|
+
input.state.subagentSpawns = { sessionId: input.sessionId, count: 0 };
|
|
119
|
+
}
|
|
120
|
+
const used = input.state.subagentSpawns.count;
|
|
121
|
+
if (used + input.requested > maxSpawns) {
|
|
122
|
+
return {
|
|
123
|
+
content: [{ type: "text", text: `Subagent spawn limit reached for this session (${used}/${maxSpawns} used, ${input.requested} requested). Complete the work directly or start a new session.` }],
|
|
124
|
+
isError: true,
|
|
125
|
+
details: { mode: input.mode, results: [] },
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
input.state.subagentSpawns.count = used + input.requested;
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
function countRequestedSubagentSpawns(params, config) {
|
|
132
|
+
if (params.tasks)
|
|
133
|
+
return params.tasks.length;
|
|
134
|
+
if (params.chain) {
|
|
135
|
+
return params.chain.reduce((total, step) => {
|
|
136
|
+
if (isDynamicParallelStep(step))
|
|
137
|
+
return total + (step.expand.maxItems ?? config.chain?.dynamicFanout?.maxItems ?? 0);
|
|
138
|
+
return total + getStepAgents(step).length;
|
|
139
|
+
}, 0);
|
|
140
|
+
}
|
|
141
|
+
return params.agent ? 1 : 0;
|
|
142
|
+
}
|
|
143
|
+
function foregroundStatusResult(control) {
|
|
144
|
+
let nestedWarning;
|
|
145
|
+
try {
|
|
146
|
+
updateForegroundNestedProjection(control);
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
nestedWarning = `Nested status unavailable: ${error instanceof Error ? error.message : String(error)}`;
|
|
150
|
+
}
|
|
151
|
+
const activity = formatForegroundActivity(control);
|
|
152
|
+
const lines = [
|
|
153
|
+
`Run: ${control.runId}`,
|
|
154
|
+
"State: running",
|
|
155
|
+
`Mode: ${control.mode}`,
|
|
156
|
+
control.currentAgent ? `Current: ${control.currentAgent}${control.currentIndex !== undefined ? ` step ${control.currentIndex + 1}` : ""}` : undefined,
|
|
157
|
+
activity ? `Activity: ${activity}` : undefined,
|
|
158
|
+
].filter((line) => Boolean(line));
|
|
159
|
+
lines.push(...formatNestedRunStatusLines(control.nestedChildren, { indent: "", commandHints: true, maxLines: 20 }));
|
|
160
|
+
if (nestedWarning)
|
|
161
|
+
lines.push(`Warning: ${nestedWarning}`);
|
|
162
|
+
return { content: [{ type: "text", text: lines.join("\n") }], details: { mode: "management", results: [] } };
|
|
163
|
+
}
|
|
164
|
+
function trimRememberedForegroundRuns(state) {
|
|
165
|
+
if (!state.foregroundRuns)
|
|
166
|
+
return;
|
|
167
|
+
while (state.foregroundRuns.size > 50) {
|
|
168
|
+
const oldestTerminal = [...state.foregroundRuns.values()]
|
|
169
|
+
.filter((run) => !run.children.some((child) => child.status === "detached"))
|
|
170
|
+
.sort((left, right) => left.updatedAt - right.updatedAt)[0];
|
|
171
|
+
if (!oldestTerminal)
|
|
172
|
+
break;
|
|
173
|
+
state.foregroundRuns.delete(oldestTerminal.runId);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function rememberForegroundRun(state, input) {
|
|
177
|
+
state.foregroundRuns ??= new Map();
|
|
178
|
+
const previous = state.foregroundRuns.get(input.runId);
|
|
179
|
+
const updatedAt = Date.now();
|
|
180
|
+
state.foregroundRuns.set(input.runId, {
|
|
181
|
+
runId: input.runId,
|
|
182
|
+
mode: input.mode,
|
|
183
|
+
cwd: input.cwd,
|
|
184
|
+
...(input.sessionId ? { sessionId: input.sessionId } : {}),
|
|
185
|
+
updatedAt,
|
|
186
|
+
children: input.results.map((result, index) => {
|
|
187
|
+
const child = {
|
|
188
|
+
agent: result.agent,
|
|
189
|
+
index,
|
|
190
|
+
status: resolveSubagentResultStatus({ exitCode: result.exitCode, interrupted: result.interrupted, detached: result.detached }),
|
|
191
|
+
updatedAt,
|
|
192
|
+
...(result.exitCode !== undefined ? { exitCode: result.exitCode } : {}),
|
|
193
|
+
...(result.error ? { error: result.error } : {}),
|
|
194
|
+
...(result.finalOutput ? { finalOutput: result.finalOutput } : {}),
|
|
195
|
+
...(result.outputMode ? { outputMode: result.outputMode } : {}),
|
|
196
|
+
...(result.savedOutputPath ? { savedOutputPath: result.savedOutputPath } : {}),
|
|
197
|
+
...(result.outputSaveError ? { outputSaveError: result.outputSaveError } : {}),
|
|
198
|
+
...(result.sessionFile ? { sessionFile: result.sessionFile } : {}),
|
|
199
|
+
...(result.artifactPaths ? { artifactPaths: result.artifactPaths } : {}),
|
|
200
|
+
...(result.transcriptPath ? { transcriptPath: result.transcriptPath } : {}),
|
|
201
|
+
...(result.transcriptError ? { transcriptError: result.transcriptError } : {}),
|
|
202
|
+
...(result.detachedReason ? { detachedReason: result.detachedReason } : {}),
|
|
203
|
+
...(result.acceptance ? { acceptance: result.acceptance } : {}),
|
|
204
|
+
};
|
|
205
|
+
const recovered = previous?.children[index];
|
|
206
|
+
return child.status === "detached" && recovered && recovered.status !== "detached" ? recovered : child;
|
|
207
|
+
}),
|
|
208
|
+
});
|
|
209
|
+
trimRememberedForegroundRuns(state);
|
|
210
|
+
}
|
|
211
|
+
function updateRememberedForegroundChild(state, input) {
|
|
212
|
+
state.foregroundRuns ??= new Map();
|
|
213
|
+
const updatedAt = Date.now();
|
|
214
|
+
let run = state.foregroundRuns.get(input.runId);
|
|
215
|
+
if (!run) {
|
|
216
|
+
run = { runId: input.runId, mode: input.mode, cwd: input.cwd, ...(input.sessionId ? { sessionId: input.sessionId } : {}), updatedAt, children: [] };
|
|
217
|
+
state.foregroundRuns.set(input.runId, run);
|
|
218
|
+
}
|
|
219
|
+
run.updatedAt = updatedAt;
|
|
220
|
+
const child = run.children[input.index] ?? { agent: input.result.agent, index: input.index, status: "detached" };
|
|
221
|
+
run.children[input.index] = {
|
|
222
|
+
...child,
|
|
223
|
+
agent: input.result.agent,
|
|
224
|
+
index: input.index,
|
|
225
|
+
status: input.result.acceptance?.status === "rejected"
|
|
226
|
+
? "failed"
|
|
227
|
+
: resolveSubagentResultStatus({ exitCode: input.result.exitCode, interrupted: input.result.interrupted, detached: false }),
|
|
228
|
+
updatedAt,
|
|
229
|
+
...(input.result.exitCode !== undefined ? { exitCode: input.result.exitCode } : {}),
|
|
230
|
+
...(input.result.error ? { error: input.result.error } : {}),
|
|
231
|
+
...(input.result.finalOutput ? { finalOutput: input.result.finalOutput } : {}),
|
|
232
|
+
outputMode: input.result.outputMode,
|
|
233
|
+
savedOutputPath: input.result.savedOutputPath,
|
|
234
|
+
outputSaveError: input.result.outputSaveError,
|
|
235
|
+
...(input.result.sessionFile ? { sessionFile: input.result.sessionFile } : {}),
|
|
236
|
+
...(input.result.artifactPaths ? { artifactPaths: input.result.artifactPaths } : {}),
|
|
237
|
+
...(input.result.transcriptPath ? { transcriptPath: input.result.transcriptPath } : {}),
|
|
238
|
+
...(input.result.transcriptError ? { transcriptError: input.result.transcriptError } : {}),
|
|
239
|
+
...(input.result.detachedReason ? { detachedReason: input.result.detachedReason } : {}),
|
|
240
|
+
...(input.result.acceptance ? { acceptance: input.result.acceptance } : {}),
|
|
241
|
+
};
|
|
242
|
+
trimRememberedForegroundRuns(state);
|
|
243
|
+
const output = getSingleResultOutput(input.result).trim();
|
|
244
|
+
const success = input.result.exitCode === 0 && input.result.acceptance?.status !== "rejected";
|
|
245
|
+
const summary = !success && input.result.error
|
|
246
|
+
? `${input.result.error}${output ? `\n\nOutput:\n${output}` : ""}`
|
|
247
|
+
: output || input.result.error || "Detached child exited without final output.";
|
|
248
|
+
input.events.emit(SUBAGENT_FOREGROUND_COMPLETE_EVENT, {
|
|
249
|
+
id: `${input.runId}:${input.index}`,
|
|
250
|
+
runId: input.runId,
|
|
251
|
+
source: "foreground",
|
|
252
|
+
mode: input.mode,
|
|
253
|
+
agent: input.result.agent,
|
|
254
|
+
success,
|
|
255
|
+
summary,
|
|
256
|
+
exitCode: input.result.exitCode,
|
|
257
|
+
state: success ? "complete" : "failed",
|
|
258
|
+
timestamp: updatedAt,
|
|
259
|
+
cwd: input.cwd,
|
|
260
|
+
sessionFile: input.result.sessionFile,
|
|
261
|
+
sessionId: input.sessionId,
|
|
262
|
+
taskIndex: input.index,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function resolveForegroundResumeTarget(params, state) {
|
|
266
|
+
const requested = (params.id ?? params.runId)?.trim();
|
|
267
|
+
if (!requested || !state.foregroundRuns?.size || !state.currentSessionId)
|
|
268
|
+
return undefined;
|
|
269
|
+
const sessionRuns = [...state.foregroundRuns.values()].filter((run) => run.sessionId === state.currentSessionId);
|
|
270
|
+
const direct = sessionRuns.find((run) => run.runId === requested);
|
|
271
|
+
const matches = direct ? [direct] : sessionRuns.filter((run) => run.runId.startsWith(requested));
|
|
272
|
+
if (matches.length === 0)
|
|
273
|
+
return undefined;
|
|
274
|
+
if (matches.length > 1)
|
|
275
|
+
throw new Error(`Ambiguous foreground run id prefix '${requested}' matched: ${matches.map((run) => run.runId).join(", ")}. Provide a longer id.`);
|
|
276
|
+
const run = matches[0];
|
|
277
|
+
if (run.children.some((child) => child.status === "detached"))
|
|
278
|
+
throw new Error(`Foreground run '${run.runId}' is detached for intercom coordination and cannot be revived safely while any child may still be live. Reply to the supervisor request first, then wait with subagent_wait({ id: "${run.runId}" }); use status to recover the result and do not launch a replacement while it remains detached.`);
|
|
279
|
+
if (run.children.length > 1 && params.index === undefined)
|
|
280
|
+
throw new Error(`Foreground run '${run.runId}' has ${run.children.length} children. Provide index to choose one.`);
|
|
281
|
+
const index = params.index ?? 0;
|
|
282
|
+
if (!Number.isInteger(index))
|
|
283
|
+
throw new Error(`Foreground run '${run.runId}' index must be an integer.`);
|
|
284
|
+
if (index < 0 || index >= run.children.length)
|
|
285
|
+
throw new Error(`Foreground run '${run.runId}' has ${run.children.length} children. Index ${index} is out of range.`);
|
|
286
|
+
const child = run.children[index];
|
|
287
|
+
if (!child.sessionFile)
|
|
288
|
+
throw new Error(`Foreground run '${run.runId}' child ${index} does not have a persisted session file to resume from.`);
|
|
289
|
+
if (path.extname(child.sessionFile) !== ".jsonl")
|
|
290
|
+
throw new Error(`Foreground run '${run.runId}' child ${index} session file must be a .jsonl file: ${child.sessionFile}`);
|
|
291
|
+
const sessionFile = path.resolve(child.sessionFile);
|
|
292
|
+
if (!fs.existsSync(sessionFile))
|
|
293
|
+
throw new Error(`Foreground run '${run.runId}' child ${index} session file does not exist: ${child.sessionFile}`);
|
|
294
|
+
return { runId: run.runId, mode: run.mode, state: "complete", agent: child.agent, index, intercomTarget: resolveSubagentIntercomTarget(run.runId, child.agent, index), cwd: run.cwd, sessionFile };
|
|
295
|
+
}
|
|
296
|
+
function isAsyncRunNotFound(error) {
|
|
297
|
+
return error instanceof Error && error.message.startsWith("Async run not found.");
|
|
298
|
+
}
|
|
299
|
+
function isResumeAmbiguity(error) {
|
|
300
|
+
return error instanceof Error && /Ambiguous .*run id prefix/.test(error.message);
|
|
301
|
+
}
|
|
302
|
+
function resumeTargetExact(target, requested) {
|
|
303
|
+
return target?.runId === requested;
|
|
304
|
+
}
|
|
305
|
+
function escapeRegExp(value) {
|
|
306
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
307
|
+
}
|
|
308
|
+
function isExactResumeError(error, source, requested) {
|
|
309
|
+
if (!(error instanceof Error) || !requested)
|
|
310
|
+
return false;
|
|
311
|
+
return new RegExp(`\\b${source} run '${escapeRegExp(requested)}'`, "i").test(error.message);
|
|
312
|
+
}
|
|
313
|
+
function resolveResumeTarget(params, state, options = {}) {
|
|
314
|
+
const requested = (params.id ?? params.runId)?.trim() ?? "";
|
|
315
|
+
let foregroundTarget;
|
|
316
|
+
let foregroundError;
|
|
317
|
+
let asyncTarget;
|
|
318
|
+
let asyncError;
|
|
319
|
+
try {
|
|
320
|
+
const target = resolveForegroundResumeTarget(params, state);
|
|
321
|
+
if (target)
|
|
322
|
+
foregroundTarget = { kind: "revive", source: "foreground", ...target };
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
foregroundError = error;
|
|
326
|
+
}
|
|
327
|
+
try {
|
|
328
|
+
asyncTarget = { source: "async", ...resolveAsyncResumeTarget(params, {}, { requireSessionFile: options.asyncRequireSessionFile }) };
|
|
329
|
+
}
|
|
330
|
+
catch (error) {
|
|
331
|
+
asyncError = error;
|
|
332
|
+
}
|
|
333
|
+
if (foregroundTarget && asyncTarget) {
|
|
334
|
+
const foregroundExact = resumeTargetExact(foregroundTarget, requested);
|
|
335
|
+
const asyncExact = resumeTargetExact(asyncTarget, requested);
|
|
336
|
+
if (foregroundExact && !asyncExact)
|
|
337
|
+
return foregroundTarget;
|
|
338
|
+
if (asyncExact && !foregroundExact)
|
|
339
|
+
return asyncTarget;
|
|
340
|
+
throw new Error(`Resume id '${requested}' is ambiguous between foreground run '${foregroundTarget.runId}' and async run '${asyncTarget.runId}'. Provide a full run id.`);
|
|
341
|
+
}
|
|
342
|
+
if (foregroundTarget) {
|
|
343
|
+
if (isExactResumeError(asyncError, "async", requested))
|
|
344
|
+
throw asyncError;
|
|
345
|
+
if (isResumeAmbiguity(asyncError) && !resumeTargetExact(foregroundTarget, requested))
|
|
346
|
+
throw asyncError;
|
|
347
|
+
return foregroundTarget;
|
|
348
|
+
}
|
|
349
|
+
if (asyncTarget) {
|
|
350
|
+
if (isExactResumeError(foregroundError, "foreground", requested))
|
|
351
|
+
throw foregroundError;
|
|
352
|
+
if (isResumeAmbiguity(foregroundError) && !resumeTargetExact(asyncTarget, requested))
|
|
353
|
+
throw foregroundError;
|
|
354
|
+
return asyncTarget;
|
|
355
|
+
}
|
|
356
|
+
if (foregroundError && !isAsyncRunNotFound(asyncError))
|
|
357
|
+
throw foregroundError;
|
|
358
|
+
if (foregroundError)
|
|
359
|
+
throw foregroundError;
|
|
360
|
+
if (asyncError)
|
|
361
|
+
throw asyncError;
|
|
362
|
+
throw new Error("Run not found. Provide id or runId.");
|
|
363
|
+
}
|
|
364
|
+
function getAsyncInterruptTarget(state, runId, location, options = {}) {
|
|
365
|
+
if (location?.asyncDir) {
|
|
366
|
+
return {
|
|
367
|
+
asyncId: location.resolvedId ?? runId ?? path.basename(location.asyncDir),
|
|
368
|
+
asyncDir: location.asyncDir,
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
if (runId) {
|
|
372
|
+
const direct = state.asyncJobs.get(runId);
|
|
373
|
+
if (direct)
|
|
374
|
+
return { asyncId: direct.asyncId, asyncDir: direct.asyncDir };
|
|
375
|
+
if (options.fallbackToNewest === false)
|
|
376
|
+
return undefined;
|
|
377
|
+
}
|
|
378
|
+
let newest;
|
|
379
|
+
for (const job of state.asyncJobs.values()) {
|
|
380
|
+
if (job.status !== "running")
|
|
381
|
+
continue;
|
|
382
|
+
if (!newest || (job.updatedAt ?? 0) > newest.updatedAt) {
|
|
383
|
+
newest = { asyncId: job.asyncId, asyncDir: job.asyncDir, updatedAt: job.updatedAt ?? 0 };
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return newest ? { asyncId: newest.asyncId, asyncDir: newest.asyncDir } : undefined;
|
|
387
|
+
}
|
|
388
|
+
function emitControlNotification(input) {
|
|
389
|
+
if (!shouldNotifyControlEvent(input.controlConfig, input.event))
|
|
390
|
+
return;
|
|
391
|
+
const childIntercomTarget = input.intercomBridge.active
|
|
392
|
+
? resolveSubagentIntercomTarget(input.event.runId, input.event.agent, input.event.index)
|
|
393
|
+
: undefined;
|
|
394
|
+
const payload = {
|
|
395
|
+
event: input.event,
|
|
396
|
+
source: "foreground",
|
|
397
|
+
childIntercomTarget,
|
|
398
|
+
noticeText: formatControlNoticeMessage(input.event, childIntercomTarget),
|
|
399
|
+
};
|
|
400
|
+
if (input.controlConfig.notifyChannels.includes("event")) {
|
|
401
|
+
input.pi.events.emit(SUBAGENT_CONTROL_EVENT, payload);
|
|
402
|
+
}
|
|
403
|
+
if (input.event.type !== "active_long_running" && input.controlConfig.notifyChannels.includes("intercom") && input.intercomBridge.active && input.intercomBridge.orchestratorTarget) {
|
|
404
|
+
input.pi.events.emit(SUBAGENT_CONTROL_INTERCOM_EVENT, {
|
|
405
|
+
...payload,
|
|
406
|
+
to: input.intercomBridge.orchestratorTarget,
|
|
407
|
+
message: formatControlIntercomMessage(input.event, childIntercomTarget),
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
function interruptAsyncRun(state, runId, kill, location) {
|
|
412
|
+
const target = getAsyncInterruptTarget(state, runId, location);
|
|
413
|
+
if (!target)
|
|
414
|
+
return null;
|
|
415
|
+
const status = reconcileAsyncRun(target.asyncDir, { kill }).status;
|
|
416
|
+
if (!status || status.state !== "running" || typeof status.pid !== "number") {
|
|
417
|
+
return {
|
|
418
|
+
content: [{ type: "text", text: `No running async run with an interrupt-capable pid was found for '${runId ?? "current"}'.` }],
|
|
419
|
+
isError: true,
|
|
420
|
+
details: { mode: "management", results: [] },
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
try {
|
|
424
|
+
deliverInterruptRequest({ asyncDir: target.asyncDir, pid: status.pid, kill, source: "interrupt-action" });
|
|
425
|
+
const tracked = state.asyncJobs.get(target.asyncId);
|
|
426
|
+
if (tracked) {
|
|
427
|
+
tracked.activityState = undefined;
|
|
428
|
+
tracked.updatedAt = Date.now();
|
|
429
|
+
}
|
|
430
|
+
return {
|
|
431
|
+
content: [{ type: "text", text: `Interrupt requested for async run ${target.asyncId}.` }],
|
|
432
|
+
details: { mode: "management", results: [] },
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
catch (error) {
|
|
436
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
437
|
+
return {
|
|
438
|
+
content: [{ type: "text", text: `Failed to interrupt async run ${target.asyncId}: ${message}` }],
|
|
439
|
+
isError: true,
|
|
440
|
+
details: { mode: "management", results: [] },
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
function stopAsyncRun(state, runId, kill, location) {
|
|
445
|
+
const target = getAsyncInterruptTarget(state, runId, location, { fallbackToNewest: false });
|
|
446
|
+
if (!target)
|
|
447
|
+
return null;
|
|
448
|
+
const status = reconcileAsyncRun(target.asyncDir, { kill }).status;
|
|
449
|
+
if (state.currentSessionId && status?.sessionId !== state.currentSessionId) {
|
|
450
|
+
return {
|
|
451
|
+
content: [{ type: "text", text: `Async run '${target.asyncId}' was not found in the active session.` }],
|
|
452
|
+
isError: true,
|
|
453
|
+
details: { mode: "management", results: [] },
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
if (!status || (status.state !== "running" && status.state !== "queued")) {
|
|
457
|
+
return {
|
|
458
|
+
content: [{ type: "text", text: `No running or queued async run was found for '${runId ?? "current"}'.` }],
|
|
459
|
+
isError: true,
|
|
460
|
+
details: { mode: "management", results: [] },
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
try {
|
|
464
|
+
deliverStopRequest({ asyncDir: target.asyncDir, pid: typeof status.pid === "number" ? status.pid : undefined, kill, source: "stop-action" });
|
|
465
|
+
const tracked = state.asyncJobs.get(target.asyncId);
|
|
466
|
+
if (tracked) {
|
|
467
|
+
tracked.activityState = undefined;
|
|
468
|
+
tracked.updatedAt = Date.now();
|
|
469
|
+
}
|
|
470
|
+
return {
|
|
471
|
+
content: [{ type: "text", text: `Stop requested for async run ${target.asyncId}.` }],
|
|
472
|
+
details: { mode: "management", results: [] },
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
catch (error) {
|
|
476
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
477
|
+
return {
|
|
478
|
+
content: [{ type: "text", text: `Failed to stop async run ${target.asyncId}: ${message}` }],
|
|
479
|
+
isError: true,
|
|
480
|
+
details: { mode: "management", results: [] },
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
function duplicateNames(names) {
|
|
485
|
+
const seen = new Set();
|
|
486
|
+
const duplicates = new Set();
|
|
487
|
+
for (const name of names) {
|
|
488
|
+
if (seen.has(name))
|
|
489
|
+
duplicates.add(name);
|
|
490
|
+
else
|
|
491
|
+
seen.add(name);
|
|
492
|
+
}
|
|
493
|
+
return [...duplicates];
|
|
494
|
+
}
|
|
495
|
+
function appendStepToAsyncChain(input) {
|
|
496
|
+
const targetRunId = input.params.id ?? input.params.runId;
|
|
497
|
+
if (!targetRunId) {
|
|
498
|
+
return {
|
|
499
|
+
content: [{ type: "text", text: "action='append-step' requires id." }],
|
|
500
|
+
isError: true,
|
|
501
|
+
details: { mode: "management", results: [] },
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
if (!input.params.chain || input.params.chain.length !== 1) {
|
|
505
|
+
return {
|
|
506
|
+
content: [{ type: "text", text: "action='append-step' requires chain with exactly one step." }],
|
|
507
|
+
isError: true,
|
|
508
|
+
details: { mode: "management", results: [] },
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
const acceptanceErrors = validateExecutionAcceptance(input.params);
|
|
512
|
+
if (acceptanceErrors.length > 0) {
|
|
513
|
+
return {
|
|
514
|
+
content: [{ type: "text", text: `Cannot append step: ${acceptanceErrors.join(" ")}` }],
|
|
515
|
+
isError: true,
|
|
516
|
+
details: { mode: "management", results: [] },
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
let resolved;
|
|
520
|
+
try {
|
|
521
|
+
resolved = resolveSubagentRunId(targetRunId, { state: input.deps.state, nested: nestedResolutionScopeForExecutor(input.deps) });
|
|
522
|
+
}
|
|
523
|
+
catch (error) {
|
|
524
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
525
|
+
return { content: [{ type: "text", text: message }], isError: true, details: { mode: "management", results: [] } };
|
|
526
|
+
}
|
|
527
|
+
if (!resolved) {
|
|
528
|
+
return {
|
|
529
|
+
content: [{ type: "text", text: `No async chain run found for '${targetRunId}'.` }],
|
|
530
|
+
isError: true,
|
|
531
|
+
details: { mode: "management", results: [] },
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
if (resolved.kind !== "async" || !resolved.location.asyncDir) {
|
|
535
|
+
return {
|
|
536
|
+
content: [{ type: "text", text: `Run '${resolved.id}' is not an append-capable async chain run.` }],
|
|
537
|
+
isError: true,
|
|
538
|
+
details: { mode: "management", results: [] },
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
const status = readStatus(resolved.location.asyncDir);
|
|
542
|
+
if (!status) {
|
|
543
|
+
return {
|
|
544
|
+
content: [{ type: "text", text: `No async run status found for '${resolved.id}'.` }],
|
|
545
|
+
isError: true,
|
|
546
|
+
details: { mode: "management", results: [] },
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
if (status.mode !== "chain") {
|
|
550
|
+
return {
|
|
551
|
+
content: [{ type: "text", text: `Run '${resolved.id}' is ${status.mode}; only active chain runs accept appended steps.` }],
|
|
552
|
+
isError: true,
|
|
553
|
+
details: { mode: "management", results: [] },
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
if (status.state !== "running") {
|
|
557
|
+
return {
|
|
558
|
+
content: [{ type: "text", text: `Run '${resolved.id}' is ${status.state}; only running chain runs accept appended steps.` }],
|
|
559
|
+
isError: true,
|
|
560
|
+
details: { mode: "management", results: [] },
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
const stillInProgress = (status.steps ?? []).some((step) => step.status === "running" || step.status === "pending") || (status.pendingAppends ?? 0) > 0;
|
|
564
|
+
if (!stillInProgress) {
|
|
565
|
+
return {
|
|
566
|
+
content: [{ type: "text", text: `Run '${resolved.id}' has no running or pending chain steps left; append-step must target an in-progress chain.` }],
|
|
567
|
+
isError: true,
|
|
568
|
+
details: { mode: "management", results: [] },
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
const pendingAppendRequests = readPendingChainAppendRequests(resolved.location.asyncDir);
|
|
572
|
+
const reservedOutputNames = new Set([
|
|
573
|
+
...Object.keys(status.outputs ?? {}),
|
|
574
|
+
...(status.steps ?? []).map((step) => step.outputName).filter((name) => Boolean(name)),
|
|
575
|
+
...pendingAppendRequests.flatMap((request) => runnerStepOutputNames(request.steps)),
|
|
576
|
+
]);
|
|
577
|
+
try {
|
|
578
|
+
validateChainOutputBindingsWithContext(input.params.chain, { maxItems: input.deps.config.chain?.dynamicFanout?.maxItems }, {
|
|
579
|
+
priorOutputNames: reservedOutputNames,
|
|
580
|
+
startStepIndex: status.chainStepCount ?? status.steps?.length ?? 0,
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
catch (error) {
|
|
584
|
+
if (!(error instanceof ChainOutputValidationError))
|
|
585
|
+
throw error;
|
|
586
|
+
return {
|
|
587
|
+
content: [{ type: "text", text: `Cannot append step to run '${resolved.id}': ${error.message}` }],
|
|
588
|
+
isError: true,
|
|
589
|
+
details: { mode: "management", results: [] },
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
const scope = resolveExecutionAgentScope(input.params.agentScope);
|
|
593
|
+
const discoveredForAppend = input.deps.discoverAgents(input.requestCwd, scope);
|
|
594
|
+
const agents = discoveredForAppend.agents;
|
|
595
|
+
const contextPolicy = resolveExplicitContextPolicy(input.params);
|
|
596
|
+
const chainSkillInput = normalizeSkillInput(input.params.skill);
|
|
597
|
+
const chainSkills = chainSkillInput === false ? [] : (chainSkillInput ?? []);
|
|
598
|
+
const asyncCtx = {
|
|
599
|
+
pi: input.deps.pi,
|
|
600
|
+
cwd: input.ctx.cwd,
|
|
601
|
+
currentSessionId: resolveCurrentSessionId(input.ctx.sessionManager),
|
|
602
|
+
parentSessionId: input.ctx.sessionManager.getSessionId() ?? undefined,
|
|
603
|
+
currentModelProvider: input.ctx.model?.provider,
|
|
604
|
+
currentModel: input.ctx.model,
|
|
605
|
+
modelScope: discoveredForAppend.modelScope,
|
|
606
|
+
};
|
|
607
|
+
const built = buildAsyncRunnerSteps(resolved.id, {
|
|
608
|
+
chain: wrapChainTasksForFork(input.params.chain, contextPolicy),
|
|
609
|
+
task: input.params.task,
|
|
610
|
+
resultMode: "chain",
|
|
611
|
+
agents,
|
|
612
|
+
ctx: asyncCtx,
|
|
613
|
+
availableModels: input.ctx.modelRegistry.getAvailable().map(toModelInfo),
|
|
614
|
+
cwd: status.cwd ?? input.requestCwd,
|
|
615
|
+
chainSkills,
|
|
616
|
+
dynamicFanoutMaxItems: input.deps.config.chain?.dynamicFanout?.maxItems,
|
|
617
|
+
maxSubagentDepth: resolveCurrentMaxSubagentDepth(input.deps.config.maxSubagentDepth),
|
|
618
|
+
waitToolEnabled: input.deps.waitToolEnabled,
|
|
619
|
+
asyncDir: resolved.location.asyncDir,
|
|
620
|
+
validateOutputBindings: false,
|
|
621
|
+
});
|
|
622
|
+
if ("error" in built) {
|
|
623
|
+
return {
|
|
624
|
+
content: [{ type: "text", text: built.error }],
|
|
625
|
+
isError: true,
|
|
626
|
+
details: { mode: "management", results: [] },
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
const appendedOutputNames = runnerStepOutputNames(built.steps);
|
|
630
|
+
const duplicateAppendedOutputs = duplicateNames(appendedOutputNames);
|
|
631
|
+
if (duplicateAppendedOutputs.length > 0) {
|
|
632
|
+
return {
|
|
633
|
+
content: [{ type: "text", text: `Cannot append step to run '${resolved.id}': duplicate output name in appended step: ${duplicateAppendedOutputs.join(", ")}.` }],
|
|
634
|
+
isError: true,
|
|
635
|
+
details: { mode: "management", results: [] },
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
const pendingOutputNames = new Set(pendingAppendRequests.flatMap((request) => runnerStepOutputNames(request.steps)));
|
|
639
|
+
const pendingDuplicateOutputs = appendedOutputNames.filter((name) => pendingOutputNames.has(name));
|
|
640
|
+
if (pendingDuplicateOutputs.length > 0) {
|
|
641
|
+
return {
|
|
642
|
+
content: [{ type: "text", text: `Cannot append step to run '${resolved.id}': output name already belongs to a pending append: ${pendingDuplicateOutputs.join(", ")}.` }],
|
|
643
|
+
isError: true,
|
|
644
|
+
details: { mode: "management", results: [] },
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
try {
|
|
648
|
+
const result = enqueueChainAppendRequest({
|
|
649
|
+
asyncDir: resolved.location.asyncDir,
|
|
650
|
+
runId: resolved.id,
|
|
651
|
+
steps: built.steps,
|
|
652
|
+
});
|
|
653
|
+
const stepText = built.steps.length === 1 ? "step" : "steps";
|
|
654
|
+
return {
|
|
655
|
+
content: [{
|
|
656
|
+
type: "text",
|
|
657
|
+
text: `Append queued for chain run ${resolved.id}: ${built.steps.length} ${stepText}. It becomes eligible after the chain's already-queued steps finish. Pending appends: ${result.pendingCount}.`,
|
|
658
|
+
}],
|
|
659
|
+
details: { mode: "management", results: [], asyncId: resolved.id, asyncDir: resolved.location.asyncDir },
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
catch (error) {
|
|
663
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
664
|
+
return {
|
|
665
|
+
content: [{ type: "text", text: `Failed to append step to chain run ${resolved.id}: ${message}` }],
|
|
666
|
+
isError: true,
|
|
667
|
+
details: { mode: "management", results: [] },
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
function nestedRunSessionFile(run) {
|
|
672
|
+
return run.sessionFile ?? (run.steps?.length === 1 ? run.steps[0]?.sessionFile : undefined);
|
|
673
|
+
}
|
|
674
|
+
function nestedRunAgent(run) {
|
|
675
|
+
return run.agent ?? run.agents?.[0] ?? (run.steps?.length === 1 ? run.steps[0]?.agent : undefined);
|
|
676
|
+
}
|
|
677
|
+
function pathWithin(base, candidate) {
|
|
678
|
+
const resolvedBase = path.resolve(base);
|
|
679
|
+
const resolvedCandidate = path.resolve(candidate);
|
|
680
|
+
return resolvedCandidate === resolvedBase || resolvedCandidate.startsWith(`${resolvedBase}${path.sep}`);
|
|
681
|
+
}
|
|
682
|
+
function validateNestedSessionFile(run, trustedSessionRoots) {
|
|
683
|
+
const sessionFile = nestedRunSessionFile(run);
|
|
684
|
+
if (!sessionFile)
|
|
685
|
+
throw new Error(`Nested run '${run.id}' does not have a persisted session file to resume from.`);
|
|
686
|
+
if (path.extname(sessionFile) !== ".jsonl")
|
|
687
|
+
throw new Error(`Nested run '${run.id}' session file must be a .jsonl file: ${sessionFile}`);
|
|
688
|
+
const resolved = path.resolve(sessionFile);
|
|
689
|
+
if (!path.isAbsolute(sessionFile))
|
|
690
|
+
throw new Error(`Nested run '${run.id}' session file must be absolute: ${sessionFile}`);
|
|
691
|
+
if (!fs.existsSync(resolved))
|
|
692
|
+
throw new Error(`Nested run '${run.id}' session file does not exist: ${sessionFile}`);
|
|
693
|
+
const stat = fs.lstatSync(resolved);
|
|
694
|
+
if (!stat.isFile() || stat.isSymbolicLink())
|
|
695
|
+
throw new Error(`Nested run '${run.id}' session file is not a regular file: ${sessionFile}`);
|
|
696
|
+
const realSessionFile = fs.realpathSync(resolved);
|
|
697
|
+
const trustedRoots = trustedSessionRoots
|
|
698
|
+
.filter((root) => fs.existsSync(root))
|
|
699
|
+
.map((root) => fs.realpathSync(root));
|
|
700
|
+
if (!trustedRoots.some((root) => pathWithin(root, realSessionFile))) {
|
|
701
|
+
throw new Error(`Nested run '${run.id}' session file is outside trusted nested session roots: ${sessionFile}`);
|
|
702
|
+
}
|
|
703
|
+
if (!realSessionFile.split(path.sep).includes(run.id)) {
|
|
704
|
+
throw new Error(`Nested run '${run.id}' session file is not under that nested run's session directory: ${sessionFile}`);
|
|
705
|
+
}
|
|
706
|
+
return realSessionFile;
|
|
707
|
+
}
|
|
708
|
+
function resolveNestedResumeTarget(match, trustedSessionRoots) {
|
|
709
|
+
const run = match.match.run;
|
|
710
|
+
if (run.state === "running" || run.state === "queued")
|
|
711
|
+
throw new Error(`Nested run '${run.id}' is live; route the follow-up to the owner process instead.`);
|
|
712
|
+
const agent = nestedRunAgent(run);
|
|
713
|
+
if (!agent)
|
|
714
|
+
throw new Error(`Could not determine child agent for nested run '${run.id}'.`);
|
|
715
|
+
const state = run.state === "complete" || run.state === "failed" || run.state === "paused" || run.state === "stopped" ? run.state : "failed";
|
|
716
|
+
const asyncDir = resolveNestedAsyncDir(match.match.rootRunId, run);
|
|
717
|
+
return {
|
|
718
|
+
kind: "revive",
|
|
719
|
+
source: "nested",
|
|
720
|
+
runId: run.id,
|
|
721
|
+
state,
|
|
722
|
+
agent,
|
|
723
|
+
index: 0,
|
|
724
|
+
intercomTarget: resolveSubagentIntercomTarget(run.id, agent, 0),
|
|
725
|
+
cwd: asyncDir ? path.dirname(asyncDir) : undefined,
|
|
726
|
+
sessionFile: validateNestedSessionFile(run, trustedSessionRoots),
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
async function waitForNestedControlResult(target, requestId, timeoutMs = 1_000) {
|
|
730
|
+
const deadline = Date.now() + timeoutMs;
|
|
731
|
+
while (Date.now() < deadline) {
|
|
732
|
+
const result = readNestedControlResults(target.match.route).find((candidate) => candidate.requestId === requestId && candidate.targetRunId === target.match.run.id);
|
|
733
|
+
if (result)
|
|
734
|
+
return result;
|
|
735
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
736
|
+
}
|
|
737
|
+
return undefined;
|
|
738
|
+
}
|
|
739
|
+
async function sendNestedControlRequest(target, action, message) {
|
|
740
|
+
const requestId = randomUUID();
|
|
741
|
+
writeNestedControlRequest(target.match.route, {
|
|
742
|
+
ts: Date.now(),
|
|
743
|
+
requestId,
|
|
744
|
+
targetRunId: target.match.run.id,
|
|
745
|
+
action,
|
|
746
|
+
...(message ? { message } : {}),
|
|
747
|
+
});
|
|
748
|
+
return waitForNestedControlResult(target, requestId);
|
|
749
|
+
}
|
|
750
|
+
function directNestedAsyncInterrupt(target) {
|
|
751
|
+
const run = target.match.run;
|
|
752
|
+
const asyncDir = resolveNestedAsyncDir(target.match.rootRunId, run);
|
|
753
|
+
if (!asyncDir)
|
|
754
|
+
return undefined;
|
|
755
|
+
const status = reconcileAsyncRun(asyncDir, { resultsDir: path.join(RESULTS_DIR, "nested", target.match.rootRunId) }).status;
|
|
756
|
+
const pid = typeof status?.pid === "number" && status.pid > 0 ? status.pid : run.pid;
|
|
757
|
+
if (!status || status.state !== "running" || typeof pid !== "number" || pid <= 0)
|
|
758
|
+
return undefined;
|
|
759
|
+
try {
|
|
760
|
+
deliverInterruptRequest({ asyncDir, pid, source: "nested-interrupt" });
|
|
761
|
+
return { content: [{ type: "text", text: `Interrupt requested for nested async run ${run.id}.` }], details: { mode: "management", results: [] } };
|
|
762
|
+
}
|
|
763
|
+
catch (error) {
|
|
764
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
765
|
+
return { content: [{ type: "text", text: `Failed to interrupt nested async run ${run.id}: ${message}` }], isError: true, details: { mode: "management", results: [] } };
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
async function directNestedAsyncSteer(input) {
|
|
769
|
+
const run = input.target.match.run;
|
|
770
|
+
const asyncDir = resolveNestedAsyncDir(input.target.match.rootRunId, run);
|
|
771
|
+
if (!asyncDir)
|
|
772
|
+
return undefined;
|
|
773
|
+
const status = reconcileAsyncRun(asyncDir, { resultsDir: path.join(RESULTS_DIR, "nested", input.target.match.rootRunId) }).status;
|
|
774
|
+
if (!status || (status.state !== "running" && status.state !== "queued"))
|
|
775
|
+
return undefined;
|
|
776
|
+
const steps = status.steps ?? [];
|
|
777
|
+
if (input.index !== undefined) {
|
|
778
|
+
if (input.index < 0 || input.index >= steps.length)
|
|
779
|
+
return { content: [{ type: "text", text: `Nested async run ${run.id} has ${steps.length} children. Index ${input.index} is out of range.` }], isError: true, details: { mode: "management", results: [] } };
|
|
780
|
+
const step = steps[input.index];
|
|
781
|
+
if (step && step.status !== "running" && step.status !== "pending")
|
|
782
|
+
return { content: [{ type: "text", text: `Nested async run ${run.id} child ${input.index} is ${step.status} and cannot be steered.` }], isError: true, details: { mode: "management", results: [] } };
|
|
783
|
+
}
|
|
784
|
+
const runningIndexes = steps
|
|
785
|
+
.map((step, index) => step.status === "running" ? index : undefined)
|
|
786
|
+
.filter((index) => index !== undefined);
|
|
787
|
+
const effectiveTargetIndex = input.index ?? (status.mode === "single" && runningIndexes.length === 0 && steps[0]?.status === "pending" ? 0 : undefined);
|
|
788
|
+
const targetIndexes = effectiveTargetIndex !== undefined ? [effectiveTargetIndex] : runningIndexes;
|
|
789
|
+
if (targetIndexes.length === 0)
|
|
790
|
+
return { content: [{ type: "text", text: `Nested async run ${run.id} has no running child to steer.` }], isError: true, details: { mode: "management", results: [] } };
|
|
791
|
+
const requestId = randomUUID();
|
|
792
|
+
try {
|
|
793
|
+
requestAsyncSteer(asyncDir, {
|
|
794
|
+
message: input.message,
|
|
795
|
+
...(effectiveTargetIndex !== undefined ? { targetIndex: effectiveTargetIndex } : { targetIndexes }),
|
|
796
|
+
source: "nested-steer",
|
|
797
|
+
id: requestId,
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
catch (error) {
|
|
801
|
+
return { content: [{ type: "text", text: `Failed to queue steering for nested async run ${run.id}: ${error instanceof Error ? error.message : String(error)}` }], isError: true, details: { mode: "management", results: [] } };
|
|
802
|
+
}
|
|
803
|
+
const targets = targetIndexes.map((index) => ({ index, state: steps[index]?.status === "pending" ? "scheduled" : "pending" }));
|
|
804
|
+
if (targets.every((target) => target.state === "scheduled")) {
|
|
805
|
+
const scheduled = { requestId, state: "scheduled", sourceRunId: run.id, targets };
|
|
806
|
+
return { content: [{ type: "text", text: `Steering scheduled for nested async run ${run.id} (request ${requestId}).` }], details: { mode: "management", results: [], steering: scheduled } };
|
|
807
|
+
}
|
|
808
|
+
const waited = await waitForSteeringAction({ asyncDir, sourceRunId: run.id, requestId, timeoutMs: 3_000, signal: input.signal });
|
|
809
|
+
const result = waited ?? { requestId, state: "pending", sourceRunId: run.id, targets };
|
|
810
|
+
const stateText = result.state === "delivered" ? "delivered" : result.state === "failed" ? "failed" : result.state === "partial" ? "partial" : "pending";
|
|
811
|
+
return { content: [{ type: "text", text: `Steering ${stateText} for nested async run ${run.id} (request ${requestId}).` }], ...(result.state === "failed" || result.state === "partial" ? { isError: true } : {}), details: { mode: "management", results: [], steering: result } };
|
|
812
|
+
}
|
|
813
|
+
async function interruptNestedRun(target) {
|
|
814
|
+
const run = target.match.run;
|
|
815
|
+
if (run.state === "complete")
|
|
816
|
+
return { content: [{ type: "text", text: `Nested run ${run.id} is already complete and cannot be interrupted.` }], isError: true, details: { mode: "management", results: [] } };
|
|
817
|
+
if (run.state === "failed")
|
|
818
|
+
return { content: [{ type: "text", text: `Nested run ${run.id} has failed and cannot be interrupted.` }], isError: true, details: { mode: "management", results: [] } };
|
|
819
|
+
if (run.state === "paused")
|
|
820
|
+
return { content: [{ type: "text", text: `Nested run ${run.id} is already paused.` }], isError: true, details: { mode: "management", results: [] } };
|
|
821
|
+
const result = await sendNestedControlRequest(target, "interrupt");
|
|
822
|
+
if (result)
|
|
823
|
+
return { content: [{ type: "text", text: result.message }], isError: result.ok ? undefined : true, details: { mode: "management", results: [] } };
|
|
824
|
+
const direct = directNestedAsyncInterrupt(target);
|
|
825
|
+
if (direct)
|
|
826
|
+
return direct;
|
|
827
|
+
return { content: [{ type: "text", text: `Nested run ${run.id} owner is not reachable and no safe direct async interrupt fallback is available.` }], isError: true, details: { mode: "management", results: [] } };
|
|
828
|
+
}
|
|
829
|
+
async function resumeLiveNestedRun(input) {
|
|
830
|
+
const run = input.target.match.run;
|
|
831
|
+
const result = await sendNestedControlRequest(input.target, "resume", input.message);
|
|
832
|
+
if (result)
|
|
833
|
+
return { content: [{ type: "text", text: result.message }], isError: result.ok ? undefined : true, details: { mode: "management", results: [] } };
|
|
834
|
+
return { content: [{ type: "text", text: `Nested run ${run.id} appears live but its owner route is not reachable. Wait for completion, then retry action='resume'.` }], isError: true, details: { mode: "management", results: [] } };
|
|
835
|
+
}
|
|
836
|
+
async function steerNestedRun(input) {
|
|
837
|
+
const run = input.target.match.run;
|
|
838
|
+
if (run.state !== "running" && run.state !== "queued")
|
|
839
|
+
return { content: [{ type: "text", text: `Nested run ${run.id} is ${run.state} and cannot be steered.` }], isError: true, details: { mode: "management", results: [] } };
|
|
840
|
+
const direct = await directNestedAsyncSteer(input);
|
|
841
|
+
if (direct)
|
|
842
|
+
return direct;
|
|
843
|
+
return { content: [{ type: "text", text: `Nested run ${run.id} is not a live async Pi child session with a steering inbox. action='steer' cannot target foreground nested runs.` }], isError: true, details: { mode: "management", results: [] } };
|
|
844
|
+
}
|
|
845
|
+
async function resumeAsyncRun(input) {
|
|
846
|
+
const followUp = (input.params.message ?? input.params.task ?? "").trim();
|
|
847
|
+
const attachChain = (input.params.chain?.length ?? 0) > 0 ? input.params.chain : undefined;
|
|
848
|
+
if (!followUp && !attachChain) {
|
|
849
|
+
return {
|
|
850
|
+
content: [{ type: "text", text: "action='resume' requires message." }],
|
|
851
|
+
isError: true,
|
|
852
|
+
details: { mode: "management", results: [] },
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
const acceptanceErrors = validateExecutionAcceptance(input.params);
|
|
856
|
+
if (acceptanceErrors.length > 0) {
|
|
857
|
+
return {
|
|
858
|
+
content: [{ type: "text", text: `Cannot resume: ${acceptanceErrors.join(" ")}` }],
|
|
859
|
+
isError: true,
|
|
860
|
+
details: { mode: "management", results: [] },
|
|
861
|
+
};
|
|
862
|
+
}
|
|
863
|
+
input.deps.state.currentSessionId = resolveCurrentSessionId(input.ctx.sessionManager);
|
|
864
|
+
let target;
|
|
865
|
+
const parentSessionFile = input.ctx.sessionManager.getSessionFile() ?? null;
|
|
866
|
+
try {
|
|
867
|
+
const requestedId = input.params.id ?? input.params.runId;
|
|
868
|
+
let resolved;
|
|
869
|
+
try {
|
|
870
|
+
resolved = requestedId ? resolveSubagentRunId(requestedId, { state: input.deps.state, nested: nestedResolutionScopeForExecutor(input.deps) }) : undefined;
|
|
871
|
+
}
|
|
872
|
+
catch (error) {
|
|
873
|
+
const message = error instanceof Error ? error.message : "";
|
|
874
|
+
const asyncMatches = message.match(/async:/g)?.length ?? 0;
|
|
875
|
+
if (!isResumeAmbiguity(error) || !message.includes("foreground:") || asyncMatches !== 1)
|
|
876
|
+
throw error;
|
|
877
|
+
}
|
|
878
|
+
if (resolved?.kind === "nested") {
|
|
879
|
+
if (attachChain) {
|
|
880
|
+
return {
|
|
881
|
+
content: [{ type: "text", text: "Attaching a running subagent as a chain root is currently available for top-level async runs only." }],
|
|
882
|
+
isError: true,
|
|
883
|
+
details: { mode: "management", results: [] },
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
if (resolved.match.run.state === "running" || resolved.match.run.state === "queued") {
|
|
887
|
+
return resumeLiveNestedRun({ target: resolved, message: followUp });
|
|
888
|
+
}
|
|
889
|
+
const trustedSessionRoots = [
|
|
890
|
+
...(input.deps.config.defaultSessionDir ? [path.resolve(input.deps.expandTilde(input.deps.config.defaultSessionDir))] : []),
|
|
891
|
+
...(parentSessionFile ? [input.deps.getSubagentSessionRoot(parentSessionFile)] : []),
|
|
892
|
+
];
|
|
893
|
+
target = resolveNestedResumeTarget(resolved, trustedSessionRoots);
|
|
894
|
+
}
|
|
895
|
+
else {
|
|
896
|
+
target = resolveResumeTarget(input.params, input.deps.state, { asyncRequireSessionFile: !attachChain });
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
catch (error) {
|
|
900
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
901
|
+
return { content: [{ type: "text", text: message }], isError: true, details: { mode: "management", results: [] } };
|
|
902
|
+
}
|
|
903
|
+
if (target.kind === "live" && !attachChain) {
|
|
904
|
+
const interrupt = interruptLiveAsyncResumeTarget({
|
|
905
|
+
target,
|
|
906
|
+
state: input.deps.state,
|
|
907
|
+
kill: input.deps.kill,
|
|
908
|
+
resultsDir: RESULTS_DIR,
|
|
909
|
+
});
|
|
910
|
+
if (!interrupt.ok) {
|
|
911
|
+
return {
|
|
912
|
+
content: [{ type: "text", text: interrupt.message }],
|
|
913
|
+
isError: true,
|
|
914
|
+
details: { mode: "management", results: [] },
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
const delivered = await deliverSubagentIntercomMessageEvent(input.deps.pi.events, target.intercomTarget, `Follow-up for async run ${target.runId} (${target.agent}):\n\n${followUp}`, 500, { source: "async-resume", runId: target.runId, agent: target.agent, index: target.index });
|
|
918
|
+
if (delivered) {
|
|
919
|
+
return {
|
|
920
|
+
content: [{ type: "text", text: [`Interrupted live async child, then delivered follow-up.`, `Run: ${target.runId}`, `Intercom target: ${target.intercomTarget}`].join("\n") }],
|
|
921
|
+
details: { mode: "management", results: [] },
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
return {
|
|
925
|
+
content: [{ type: "text", text: [`Async child appears live but its intercom target is not registered.`, `Run: ${target.runId}`, `Intercom target: ${target.intercomTarget}`, `Wait for completion, then retry action='resume'.`].join("\n") }],
|
|
926
|
+
isError: true,
|
|
927
|
+
details: { mode: "management", results: [] },
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
const { blocked, depth, maxDepth } = checkSubagentDepth(input.deps.config.maxSubagentDepth);
|
|
931
|
+
if (blocked) {
|
|
932
|
+
return {
|
|
933
|
+
content: [{ type: "text", text: `Nested subagent resume blocked (depth=${depth}, max=${maxDepth}). Complete the follow-up directly instead.` }],
|
|
934
|
+
isError: true,
|
|
935
|
+
details: { mode: "management", results: [] },
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
input.deps.state.currentSessionId = resolveCurrentSessionId(input.ctx.sessionManager);
|
|
939
|
+
const effectiveCwd = target.cwd ?? input.requestCwd;
|
|
940
|
+
const scope = resolveExecutionAgentScope(input.params.agentScope);
|
|
941
|
+
const discovered = input.deps.discoverAgents(effectiveCwd, scope);
|
|
942
|
+
const discoveredAgents = discovered.agents;
|
|
943
|
+
const modelScope = discovered.modelScope;
|
|
944
|
+
const sessionName = resolveIntercomSessionTarget(input.deps.pi.getSessionName(), input.ctx.sessionManager.getSessionId());
|
|
945
|
+
const intercomBridge = resolveIntercomBridge({
|
|
946
|
+
config: input.deps.config.intercomBridge,
|
|
947
|
+
context: input.params.context,
|
|
948
|
+
orchestratorTarget: sessionName,
|
|
949
|
+
});
|
|
950
|
+
const agents = intercomBridge.active
|
|
951
|
+
? discoveredAgents.map((agent) => applyIntercomBridgeToAgent(agent, intercomBridge))
|
|
952
|
+
: discoveredAgents;
|
|
953
|
+
const recoveryDescriptor = "recoveryDescriptor" in target ? target.recoveryDescriptor : undefined;
|
|
954
|
+
const discoveredAgentConfig = agents.find((agent) => agent.name === target.agent);
|
|
955
|
+
const agentConfig = discoveredAgentConfig ?? (recoveryDescriptor ? {
|
|
956
|
+
name: recoveryDescriptor.agent,
|
|
957
|
+
description: "Persisted async recovery contract",
|
|
958
|
+
systemPrompt: "",
|
|
959
|
+
systemPromptMode: recoveryDescriptor.systemPromptMode,
|
|
960
|
+
inheritProjectContext: recoveryDescriptor.inheritProjectContext,
|
|
961
|
+
inheritSkills: recoveryDescriptor.inheritSkills,
|
|
962
|
+
source: "project",
|
|
963
|
+
filePath: recoveryDescriptor.agentFilePath ?? path.join(recoveryDescriptor.cwd, ".pi-subagents-recovery-agent"),
|
|
964
|
+
} : undefined);
|
|
965
|
+
if (!agentConfig) {
|
|
966
|
+
return {
|
|
967
|
+
content: [{ type: "text", text: `Unknown agent for resume: ${target.agent}` }],
|
|
968
|
+
isError: true,
|
|
969
|
+
details: { mode: "management", results: [] },
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
if (attachChain) {
|
|
973
|
+
if (target.source !== "async") {
|
|
974
|
+
return {
|
|
975
|
+
content: [{ type: "text", text: "Attaching a running subagent as a chain root is currently available for async runs only." }],
|
|
976
|
+
isError: true,
|
|
977
|
+
details: { mode: "management", results: [] },
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
if (!isAsyncAvailable()) {
|
|
981
|
+
return {
|
|
982
|
+
content: [{ type: "text", text: "Async mode requires upstream jiti for TypeScript execution but it could not be found. Ensure the pi-subagents package dependencies are installed." }],
|
|
983
|
+
isError: true,
|
|
984
|
+
details: { mode: "chain", results: [] },
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
const runId = randomUUID().slice(0, 8);
|
|
988
|
+
const artifactConfig = { ...DEFAULT_ARTIFACT_CONFIG, enabled: input.params.artifacts !== false };
|
|
989
|
+
const availableModels = input.ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
990
|
+
const contextPolicy = resolveExplicitContextPolicy(input.params);
|
|
991
|
+
const workflowTask = (input.params.task ?? followUp) || undefined;
|
|
992
|
+
const goal = resolveAsyncEventGoal(workflowTask, attachChain);
|
|
993
|
+
const chain = wrapChainTasksForFork(attachChain, contextPolicy);
|
|
994
|
+
const normalized = normalizeSkillInput(input.params.skill);
|
|
995
|
+
const result = executeAsyncChain(runId, {
|
|
996
|
+
chain,
|
|
997
|
+
task: workflowTask,
|
|
998
|
+
goal,
|
|
999
|
+
attachRoot: {
|
|
1000
|
+
runId: target.runId,
|
|
1001
|
+
asyncDir: target.asyncDir ?? path.join(ASYNC_DIR, target.runId),
|
|
1002
|
+
resultPath: resolveAsyncRootResultPath(RESULTS_DIR, target.runId),
|
|
1003
|
+
index: target.index,
|
|
1004
|
+
agent: target.agent,
|
|
1005
|
+
label: `Attached ${target.runId}`,
|
|
1006
|
+
},
|
|
1007
|
+
agents,
|
|
1008
|
+
ctx: {
|
|
1009
|
+
pi: input.deps.pi,
|
|
1010
|
+
cwd: input.requestCwd,
|
|
1011
|
+
currentSessionId: input.deps.state.currentSessionId,
|
|
1012
|
+
parentSessionId: input.ctx.sessionManager.getSessionId() ?? undefined,
|
|
1013
|
+
currentModelProvider: input.ctx.model?.provider,
|
|
1014
|
+
currentModel: input.ctx.model,
|
|
1015
|
+
modelScope,
|
|
1016
|
+
},
|
|
1017
|
+
availableModels,
|
|
1018
|
+
cwd: effectiveCwd,
|
|
1019
|
+
maxOutput: input.params.maxOutput,
|
|
1020
|
+
artifactsDir: getArtifactsDir(parentSessionFile, effectiveCwd),
|
|
1021
|
+
artifactConfig,
|
|
1022
|
+
shareEnabled: input.params.share === true,
|
|
1023
|
+
sessionRoot: input.deps.getSubagentSessionRoot(parentSessionFile),
|
|
1024
|
+
chainSkills: normalized === false ? [] : (normalized ?? []),
|
|
1025
|
+
dynamicFanoutMaxItems: input.deps.config.chain?.dynamicFanout?.maxItems,
|
|
1026
|
+
maxSubagentDepth: resolveCurrentMaxSubagentDepth(input.deps.config.maxSubagentDepth),
|
|
1027
|
+
waitToolEnabled: input.deps.waitToolEnabled,
|
|
1028
|
+
worktreeSetupHook: input.deps.config.worktreeSetupHook,
|
|
1029
|
+
worktreeSetupHookTimeoutMs: input.deps.config.worktreeSetupHookTimeoutMs,
|
|
1030
|
+
worktreeBaseDir: input.deps.config.worktreeBaseDir,
|
|
1031
|
+
controlConfig: resolveControlConfig(input.deps.config.control, input.params.control),
|
|
1032
|
+
controlIntercomTarget: intercomBridge.active ? intercomBridge.orchestratorTarget : undefined,
|
|
1033
|
+
childIntercomTarget: intercomBridge.active ? (agent, index) => resolveSubagentIntercomTarget(runId, agent, index) : undefined,
|
|
1034
|
+
globalConcurrencyLimit: input.deps.config.globalConcurrencyLimit,
|
|
1035
|
+
});
|
|
1036
|
+
if (result.isError)
|
|
1037
|
+
return result;
|
|
1038
|
+
const attachedId = result.details.asyncId ?? runId;
|
|
1039
|
+
const lines = [
|
|
1040
|
+
`Attached async subagent ${target.runId} as the first step of a new chain.`,
|
|
1041
|
+
`Chain run: ${attachedId}`,
|
|
1042
|
+
`Root: ${target.agent} (step ${target.index + 1})`,
|
|
1043
|
+
result.details.asyncDir ? `Async dir: ${result.details.asyncDir}` : undefined,
|
|
1044
|
+
`Status if needed: subagent({ action: "status", id: "${attachedId}" })`,
|
|
1045
|
+
].filter((line) => Boolean(line));
|
|
1046
|
+
return { content: [{ type: "text", text: formatAsyncStartedMessage(lines.join("\n")) }], details: result.details };
|
|
1047
|
+
}
|
|
1048
|
+
const runId = randomUUID().slice(0, 8);
|
|
1049
|
+
const recoveryAgentConfig = recoveryDescriptor ? applySteeringRecoveryAgentConfig(agentConfig, recoveryDescriptor) : agentConfig;
|
|
1050
|
+
const artifactConfig = recoveryDescriptor?.artifactConfig ?? { ...DEFAULT_ARTIFACT_CONFIG, enabled: input.params.artifacts !== false };
|
|
1051
|
+
const artifactsDir = recoveryDescriptor?.artifactsDir ?? getArtifactsDir(parentSessionFile, effectiveCwd);
|
|
1052
|
+
const availableModels = input.ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
1053
|
+
const result = executeAsyncSingle(runId, {
|
|
1054
|
+
agent: target.agent,
|
|
1055
|
+
task: buildRevivedAsyncTask(target, followUp),
|
|
1056
|
+
goal: followUp,
|
|
1057
|
+
agentConfig: recoveryAgentConfig,
|
|
1058
|
+
ctx: {
|
|
1059
|
+
pi: input.deps.pi,
|
|
1060
|
+
cwd: input.requestCwd,
|
|
1061
|
+
currentSessionId: input.deps.state.currentSessionId,
|
|
1062
|
+
parentSessionId: input.ctx.sessionManager.getSessionId() ?? undefined,
|
|
1063
|
+
currentModelProvider: input.ctx.model?.provider,
|
|
1064
|
+
currentModel: input.ctx.model,
|
|
1065
|
+
modelScope,
|
|
1066
|
+
},
|
|
1067
|
+
cwd: effectiveCwd,
|
|
1068
|
+
maxOutput: input.params.maxOutput ?? recoveryDescriptor?.maxOutput,
|
|
1069
|
+
artifactsDir,
|
|
1070
|
+
artifactConfig,
|
|
1071
|
+
shareEnabled: recoveryDescriptor?.share ?? input.params.share === true,
|
|
1072
|
+
sessionRoot: input.deps.getSubagentSessionRoot(parentSessionFile),
|
|
1073
|
+
...(recoveryDescriptor?.sessionDir ? { sessionDir: recoveryDescriptor.sessionDir } : {}),
|
|
1074
|
+
sessionFile: target.sessionFile,
|
|
1075
|
+
revivalLease: {
|
|
1076
|
+
sessionFile: target.sessionFile,
|
|
1077
|
+
runId,
|
|
1078
|
+
sourceRunId: target.runId,
|
|
1079
|
+
...(input.deps.state.currentSessionId ? { parentSessionId: input.deps.state.currentSessionId } : {}),
|
|
1080
|
+
},
|
|
1081
|
+
modelOverride: input.params.model ?? recoveryDescriptor?.model ?? target.model,
|
|
1082
|
+
thinkingOverride: input.params.model ? undefined : recoveryDescriptor?.thinking ?? target.thinking,
|
|
1083
|
+
outputBaseDir: resolveSingleRunOutputBaseDir(input.deps, artifactsDir, runId),
|
|
1084
|
+
maxSubagentDepth: recoveryDescriptor?.maxSubagentDepth ?? resolveCurrentMaxSubagentDepth(input.deps.config.maxSubagentDepth),
|
|
1085
|
+
waitToolEnabled: input.deps.waitToolEnabled,
|
|
1086
|
+
worktreeSetupHook: input.deps.config.worktreeSetupHook,
|
|
1087
|
+
worktreeSetupHookTimeoutMs: input.deps.config.worktreeSetupHookTimeoutMs,
|
|
1088
|
+
worktreeBaseDir: input.deps.config.worktreeBaseDir,
|
|
1089
|
+
controlConfig: recoveryDescriptor?.controlConfig ?? resolveControlConfig(input.deps.config.control, input.params.control),
|
|
1090
|
+
controlIntercomTarget: intercomBridge.active ? intercomBridge.orchestratorTarget : undefined,
|
|
1091
|
+
childIntercomTarget: intercomBridge.active ? (agent, index) => resolveSubagentIntercomTarget(runId, agent, index) : undefined,
|
|
1092
|
+
availableModels,
|
|
1093
|
+
output: recoveryDescriptor?.outputPath,
|
|
1094
|
+
outputMode: recoveryDescriptor?.outputMode,
|
|
1095
|
+
...(recoveryDescriptor?.skills ? { skills: [...recoveryDescriptor.skills] } : {}),
|
|
1096
|
+
...(recoveryDescriptor?.acceptance !== undefined && input.params.acceptance === undefined ? { acceptance: recoveryDescriptor.acceptance } : {}),
|
|
1097
|
+
...(input.params.timeoutMs !== undefined ? { timeoutMs: input.params.timeoutMs } : {}),
|
|
1098
|
+
...(input.absoluteDeadlineAt !== undefined ? { absoluteDeadlineAt: input.absoluteDeadlineAt } : {}),
|
|
1099
|
+
...(input.params.turnBudget !== undefined ? { turnBudget: input.params.turnBudget } : {}),
|
|
1100
|
+
...(input.params.toolBudget !== undefined ? { toolBudget: input.params.toolBudget } : {}),
|
|
1101
|
+
});
|
|
1102
|
+
if (result.isError)
|
|
1103
|
+
return result;
|
|
1104
|
+
const revivedId = result.details.asyncId ?? runId;
|
|
1105
|
+
const revivedTarget = intercomBridge.active ? resolveSubagentIntercomTarget(revivedId, target.agent, 0) : undefined;
|
|
1106
|
+
const sourceLabel = target.source;
|
|
1107
|
+
const lines = [
|
|
1108
|
+
`Revived ${sourceLabel} subagent from ${target.runId}.`,
|
|
1109
|
+
`Revived run: ${revivedId}`,
|
|
1110
|
+
`Agent: ${target.agent}`,
|
|
1111
|
+
`Session: ${target.sessionFile}`,
|
|
1112
|
+
result.details.asyncDir ? `Async dir: ${result.details.asyncDir}` : undefined,
|
|
1113
|
+
revivedTarget ? `Intercom target: ${revivedTarget} (if registered)` : undefined,
|
|
1114
|
+
`Status if needed: subagent({ action: "status", id: "${revivedId}" })`,
|
|
1115
|
+
].filter((line) => Boolean(line));
|
|
1116
|
+
return { content: [{ type: "text", text: formatAsyncStartedMessage(lines.join("\n")) }], details: result.details };
|
|
1117
|
+
}
|
|
1118
|
+
function resultSummaryForIntercom(result) {
|
|
1119
|
+
const output = getSingleResultOutput(result);
|
|
1120
|
+
if (result.exitCode !== 0 && result.error) {
|
|
1121
|
+
return output ? `${result.error}\n\nOutput:\n${output}` : result.error;
|
|
1122
|
+
}
|
|
1123
|
+
return output || result.error || "(no output)";
|
|
1124
|
+
}
|
|
1125
|
+
function formatFailedSingleRunOutput(result, displayOutput) {
|
|
1126
|
+
const error = result.error || "Failed";
|
|
1127
|
+
const output = displayOutput.trim();
|
|
1128
|
+
const lines = [error];
|
|
1129
|
+
if (output && output !== error.trim()) {
|
|
1130
|
+
lines.push("", "Output:", output);
|
|
1131
|
+
}
|
|
1132
|
+
if (result.artifactPaths?.outputPath) {
|
|
1133
|
+
lines.push("", `Output artifact: ${result.artifactPaths.outputPath}`);
|
|
1134
|
+
}
|
|
1135
|
+
return lines.join("\n");
|
|
1136
|
+
}
|
|
1137
|
+
function createForegroundControlNotifier(data, deps) {
|
|
1138
|
+
return (event) => emitControlNotification({
|
|
1139
|
+
pi: deps.pi,
|
|
1140
|
+
controlConfig: data.controlConfig,
|
|
1141
|
+
intercomBridge: data.intercomBridge,
|
|
1142
|
+
event,
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
async function emitForegroundResultIntercom(input) {
|
|
1146
|
+
if (!input.intercomBridge.active || !input.intercomBridge.orchestratorTarget)
|
|
1147
|
+
return null;
|
|
1148
|
+
const children = input.results.flatMap((result, index) => result.detached ? [] : [{
|
|
1149
|
+
agent: result.agent,
|
|
1150
|
+
status: resolveSubagentResultStatus({
|
|
1151
|
+
exitCode: result.exitCode,
|
|
1152
|
+
interrupted: result.interrupted,
|
|
1153
|
+
detached: result.detached,
|
|
1154
|
+
}),
|
|
1155
|
+
summary: resultSummaryForIntercom(result),
|
|
1156
|
+
index,
|
|
1157
|
+
artifactPath: result.artifactPaths?.outputPath,
|
|
1158
|
+
sessionPath: result.sessionFile,
|
|
1159
|
+
intercomTarget: resolveSubagentIntercomTarget(input.runId, result.agent, index),
|
|
1160
|
+
}]);
|
|
1161
|
+
if (children.length === 0)
|
|
1162
|
+
return null;
|
|
1163
|
+
const payload = buildSubagentResultIntercomPayload({
|
|
1164
|
+
to: input.intercomBridge.orchestratorTarget,
|
|
1165
|
+
runId: input.runId,
|
|
1166
|
+
mode: input.mode,
|
|
1167
|
+
source: "foreground",
|
|
1168
|
+
children: attachNestedChildrenToResultChildren(input.runId, children, input.nestedChildren),
|
|
1169
|
+
...(typeof input.chainSteps === "number" ? { chainSteps: input.chainSteps } : {}),
|
|
1170
|
+
});
|
|
1171
|
+
const delivered = await deliverSubagentResultIntercomEvent(input.pi.events, payload);
|
|
1172
|
+
if (!delivered)
|
|
1173
|
+
return null;
|
|
1174
|
+
return payload;
|
|
1175
|
+
}
|
|
1176
|
+
async function maybeBuildForegroundIntercomReceipt(input) {
|
|
1177
|
+
const payload = await emitForegroundResultIntercom({
|
|
1178
|
+
pi: input.pi,
|
|
1179
|
+
intercomBridge: input.intercomBridge,
|
|
1180
|
+
runId: input.runId,
|
|
1181
|
+
mode: input.mode,
|
|
1182
|
+
results: input.details.results,
|
|
1183
|
+
...(typeof input.details.totalSteps === "number" ? { chainSteps: input.details.totalSteps } : {}),
|
|
1184
|
+
...(input.nestedChildren?.length ? { nestedChildren: input.nestedChildren } : {}),
|
|
1185
|
+
});
|
|
1186
|
+
if (!payload)
|
|
1187
|
+
return null;
|
|
1188
|
+
return {
|
|
1189
|
+
text: formatSubagentResultReceipt({ mode: input.mode, runId: input.runId, payload }),
|
|
1190
|
+
details: stripDetailsOutputsForIntercomReceipt(input.details),
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
function validateExecutionInput(params, agents, hasChain, hasTasks, hasSingle, allowClarifyTaskPrompt) {
|
|
1194
|
+
if (Number(hasChain) + Number(hasTasks) + Number(hasSingle) !== 1) {
|
|
1195
|
+
return {
|
|
1196
|
+
content: [
|
|
1197
|
+
{
|
|
1198
|
+
type: "text",
|
|
1199
|
+
text: `Provide exactly one mode. Agents: ${agents.map((a) => a.name).join(", ") || "none"}`,
|
|
1200
|
+
},
|
|
1201
|
+
],
|
|
1202
|
+
isError: true,
|
|
1203
|
+
details: { mode: "single", results: [] },
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
const acceptanceErrors = validateExecutionAcceptance(params);
|
|
1207
|
+
if (acceptanceErrors.length > 0) {
|
|
1208
|
+
return {
|
|
1209
|
+
content: [{ type: "text", text: acceptanceErrors.join(" ") }],
|
|
1210
|
+
isError: true,
|
|
1211
|
+
details: { mode: getRequestedModeLabel(params), results: [] },
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
if (hasSingle && params.agent && !agents.find((agent) => agent.name === params.agent)) {
|
|
1215
|
+
return {
|
|
1216
|
+
content: [{ type: "text", text: `Unknown agent: ${params.agent}` }],
|
|
1217
|
+
isError: true,
|
|
1218
|
+
details: { mode: "single", results: [] },
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
if (hasTasks && params.tasks) {
|
|
1222
|
+
for (let i = 0; i < params.tasks.length; i++) {
|
|
1223
|
+
const task = params.tasks[i];
|
|
1224
|
+
if (!agents.find((agent) => agent.name === task.agent)) {
|
|
1225
|
+
return {
|
|
1226
|
+
content: [{ type: "text", text: `Unknown agent: ${task.agent} (task ${i + 1})` }],
|
|
1227
|
+
isError: true,
|
|
1228
|
+
details: { mode: "parallel", results: [] },
|
|
1229
|
+
};
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
if (hasChain && params.chain) {
|
|
1234
|
+
if (params.chain.length === 0) {
|
|
1235
|
+
return {
|
|
1236
|
+
content: [{ type: "text", text: "Chain must have at least one step" }],
|
|
1237
|
+
isError: true,
|
|
1238
|
+
details: { mode: "chain", results: [] },
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
const firstStep = params.chain[0];
|
|
1242
|
+
if (isParallelStep(firstStep)) {
|
|
1243
|
+
const missingTaskIndex = firstStep.parallel.findIndex((t) => !t.task);
|
|
1244
|
+
if (missingTaskIndex !== -1) {
|
|
1245
|
+
return {
|
|
1246
|
+
content: [{ type: "text", text: `First parallel step: task ${missingTaskIndex + 1} must have a task (no previous output to reference)` }],
|
|
1247
|
+
isError: true,
|
|
1248
|
+
details: { mode: "chain", results: [] },
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
else if (isDynamicParallelStep(firstStep)) {
|
|
1253
|
+
return {
|
|
1254
|
+
content: [{ type: "text", text: "First step in chain cannot be dynamic fanout; expand.from requires a prior structured named output" }],
|
|
1255
|
+
isError: true,
|
|
1256
|
+
details: { mode: "chain", results: [] },
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
else if (!firstStep.task && !params.task && !allowClarifyTaskPrompt) {
|
|
1260
|
+
return {
|
|
1261
|
+
content: [{ type: "text", text: "First step in chain must have a task" }],
|
|
1262
|
+
isError: true,
|
|
1263
|
+
details: { mode: "chain", results: [] },
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1266
|
+
for (let i = 0; i < params.chain.length; i++) {
|
|
1267
|
+
const step = params.chain[i];
|
|
1268
|
+
const stepAgents = getStepAgents(step);
|
|
1269
|
+
for (const agentName of stepAgents) {
|
|
1270
|
+
if (!agents.find((a) => a.name === agentName)) {
|
|
1271
|
+
return {
|
|
1272
|
+
content: [{ type: "text", text: `Unknown agent: ${agentName} (step ${i + 1})` }],
|
|
1273
|
+
isError: true,
|
|
1274
|
+
details: { mode: "chain", results: [] },
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
if (isParallelStep(step) && step.parallel.length === 0) {
|
|
1279
|
+
return {
|
|
1280
|
+
content: [{ type: "text", text: `Parallel step ${i + 1} must have at least one task` }],
|
|
1281
|
+
isError: true,
|
|
1282
|
+
details: { mode: "chain", results: [] },
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
return null;
|
|
1288
|
+
}
|
|
1289
|
+
function validateExecutionChainBindings(params, dynamicFanoutMaxItems) {
|
|
1290
|
+
if ((params.chain?.length ?? 0) === 0)
|
|
1291
|
+
return null;
|
|
1292
|
+
try {
|
|
1293
|
+
validateChainOutputBindingsWithContext(params.chain, { maxItems: dynamicFanoutMaxItems });
|
|
1294
|
+
}
|
|
1295
|
+
catch (error) {
|
|
1296
|
+
if (error instanceof ChainOutputValidationError) {
|
|
1297
|
+
return {
|
|
1298
|
+
content: [{ type: "text", text: error.message }],
|
|
1299
|
+
isError: true,
|
|
1300
|
+
details: { mode: "chain", results: [] },
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
throw error;
|
|
1304
|
+
}
|
|
1305
|
+
return null;
|
|
1306
|
+
}
|
|
1307
|
+
function getRequestedModeLabel(params) {
|
|
1308
|
+
if ((params.chain?.length ?? 0) > 0)
|
|
1309
|
+
return "chain";
|
|
1310
|
+
if ((params.tasks?.length ?? 0) > 0)
|
|
1311
|
+
return "parallel";
|
|
1312
|
+
if (params.agent)
|
|
1313
|
+
return "single";
|
|
1314
|
+
return "single";
|
|
1315
|
+
}
|
|
1316
|
+
function resolveAgentDefaultContextPolicy(params, agents) {
|
|
1317
|
+
if (params.context !== undefined) {
|
|
1318
|
+
return resolveExplicitContextPolicy(params);
|
|
1319
|
+
}
|
|
1320
|
+
const byName = new Map(agents.map((agent) => [agent.name, agent]));
|
|
1321
|
+
const contextForAgent = (agentName) => byName.get(agentName)?.defaultContext === "fork" ? "fork" : "fresh";
|
|
1322
|
+
const usesFork = collectRequestedAgentNames(params).some((name) => contextForAgent(name) === "fork");
|
|
1323
|
+
return {
|
|
1324
|
+
params: usesFork ? { ...params, context: "fork" } : params,
|
|
1325
|
+
contextForAgent,
|
|
1326
|
+
usesFork,
|
|
1327
|
+
};
|
|
1328
|
+
}
|
|
1329
|
+
function resolveExplicitContextPolicy(params) {
|
|
1330
|
+
const context = params.context === "fork" ? "fork" : "fresh";
|
|
1331
|
+
return {
|
|
1332
|
+
params,
|
|
1333
|
+
contextForAgent: () => context,
|
|
1334
|
+
usesFork: context === "fork",
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1337
|
+
function collectRequestedAgentNames(params) {
|
|
1338
|
+
const names = [];
|
|
1339
|
+
if (params.agent)
|
|
1340
|
+
names.push(params.agent);
|
|
1341
|
+
for (const task of params.tasks ?? [])
|
|
1342
|
+
names.push(task.agent);
|
|
1343
|
+
for (const step of params.chain ?? [])
|
|
1344
|
+
names.push(...getStepAgents(step));
|
|
1345
|
+
return names;
|
|
1346
|
+
}
|
|
1347
|
+
function shouldForkAgent(contextPolicy, agentName) {
|
|
1348
|
+
return contextPolicy.contextForAgent(agentName) === "fork";
|
|
1349
|
+
}
|
|
1350
|
+
function buildRequestedModeError(params, message) {
|
|
1351
|
+
return withForkContext({
|
|
1352
|
+
content: [{ type: "text", text: message }],
|
|
1353
|
+
isError: true,
|
|
1354
|
+
details: { mode: getRequestedModeLabel(params), results: [] },
|
|
1355
|
+
}, params.context);
|
|
1356
|
+
}
|
|
1357
|
+
function applySingleAgentLaunchDefaults(params, agents) {
|
|
1358
|
+
if ((params.chain?.length ?? 0) > 0 || (params.tasks?.length ?? 0) > 0 || !params.agent)
|
|
1359
|
+
return params;
|
|
1360
|
+
const agent = agents.find((candidate) => candidate.name === params.agent);
|
|
1361
|
+
if (!agent)
|
|
1362
|
+
return params;
|
|
1363
|
+
return {
|
|
1364
|
+
...params,
|
|
1365
|
+
...(params.async === undefined && agent.defaultAsync !== undefined ? { async: agent.defaultAsync } : {}),
|
|
1366
|
+
...(params.timeoutMs === undefined && params.maxRuntimeMs === undefined && agent.defaultTimeoutMs !== undefined
|
|
1367
|
+
? { timeoutMs: agent.defaultTimeoutMs }
|
|
1368
|
+
: {}),
|
|
1369
|
+
...(params.turnBudget === undefined && agent.defaultTurnBudget !== undefined
|
|
1370
|
+
? { turnBudget: agent.defaultTurnBudget }
|
|
1371
|
+
: {}),
|
|
1372
|
+
...(params.acceptance === undefined && agent.defaultAcceptance !== undefined
|
|
1373
|
+
? { acceptance: agent.defaultAcceptance }
|
|
1374
|
+
: {}),
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
function resolveForegroundTimeout(params) {
|
|
1378
|
+
const rawTimeout = params.timeoutMs;
|
|
1379
|
+
const rawMaxRuntime = params.maxRuntimeMs;
|
|
1380
|
+
if (rawTimeout === undefined && rawMaxRuntime === undefined)
|
|
1381
|
+
return {};
|
|
1382
|
+
for (const [name, value] of [["timeoutMs", rawTimeout], ["maxRuntimeMs", rawMaxRuntime]]) {
|
|
1383
|
+
if (value === undefined)
|
|
1384
|
+
continue;
|
|
1385
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value <= 0) {
|
|
1386
|
+
return { error: `${name} must be a positive integer.` };
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
if (rawTimeout !== undefined && rawMaxRuntime !== undefined && rawTimeout !== rawMaxRuntime) {
|
|
1390
|
+
return { error: "timeoutMs and maxRuntimeMs are aliases; provide only one value or use the same value for both." };
|
|
1391
|
+
}
|
|
1392
|
+
return { timeoutMs: rawTimeout ?? rawMaxRuntime };
|
|
1393
|
+
}
|
|
1394
|
+
function resolveToolBudget(raw, label = "toolBudget") {
|
|
1395
|
+
const resolved = validateToolBudgetConfig(raw, label);
|
|
1396
|
+
return { toolBudget: resolved.budget, error: resolved.error };
|
|
1397
|
+
}
|
|
1398
|
+
function resolveEffectiveToolBudget(input) {
|
|
1399
|
+
if (input.stepBudget !== undefined)
|
|
1400
|
+
return resolveToolBudget(input.stepBudget, "toolBudget");
|
|
1401
|
+
if (input.runBudget !== undefined)
|
|
1402
|
+
return { toolBudget: input.runBudget };
|
|
1403
|
+
if (input.agentBudget !== undefined)
|
|
1404
|
+
return resolveToolBudget(input.agentBudget, "agent.toolBudget");
|
|
1405
|
+
return resolveToolBudget(input.configBudget, "config.toolBudget");
|
|
1406
|
+
}
|
|
1407
|
+
function expandTopLevelTaskCounts(tasks) {
|
|
1408
|
+
const expanded = [];
|
|
1409
|
+
for (let taskIndex = 0; taskIndex < tasks.length; taskIndex++) {
|
|
1410
|
+
const task = tasks[taskIndex];
|
|
1411
|
+
const rawCount = task.count;
|
|
1412
|
+
if (rawCount !== undefined && (typeof rawCount !== "number" || !Number.isInteger(rawCount) || rawCount < 1)) {
|
|
1413
|
+
return { error: `tasks[${taskIndex}].count must be an integer >= 1` };
|
|
1414
|
+
}
|
|
1415
|
+
const { count, ...concreteTask } = task;
|
|
1416
|
+
for (let repeat = 0; repeat < (rawCount ?? 1); repeat++) {
|
|
1417
|
+
expanded.push({ ...concreteTask });
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
return { tasks: expanded };
|
|
1421
|
+
}
|
|
1422
|
+
function expandChainParallelCounts(chain) {
|
|
1423
|
+
const expandedChain = [];
|
|
1424
|
+
for (let stepIndex = 0; stepIndex < chain.length; stepIndex++) {
|
|
1425
|
+
const step = chain[stepIndex];
|
|
1426
|
+
if (!isParallelStep(step)) {
|
|
1427
|
+
expandedChain.push(step);
|
|
1428
|
+
continue;
|
|
1429
|
+
}
|
|
1430
|
+
const expandedParallel = [];
|
|
1431
|
+
for (let taskIndex = 0; taskIndex < step.parallel.length; taskIndex++) {
|
|
1432
|
+
const task = step.parallel[taskIndex];
|
|
1433
|
+
const rawCount = task.count;
|
|
1434
|
+
if (rawCount !== undefined && (typeof rawCount !== "number" || !Number.isInteger(rawCount) || rawCount < 1)) {
|
|
1435
|
+
return { error: `chain[${stepIndex}].parallel[${taskIndex}].count must be an integer >= 1` };
|
|
1436
|
+
}
|
|
1437
|
+
const { count, ...concreteTask } = task;
|
|
1438
|
+
for (let repeat = 0; repeat < (rawCount ?? 1); repeat++) {
|
|
1439
|
+
expandedParallel.push({ ...concreteTask });
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
expandedChain.push({ ...step, parallel: expandedParallel });
|
|
1443
|
+
}
|
|
1444
|
+
return { chain: expandedChain };
|
|
1445
|
+
}
|
|
1446
|
+
function normalizeRepeatedParallelCounts(params) {
|
|
1447
|
+
if (params.tasks) {
|
|
1448
|
+
const expandedTasks = expandTopLevelTaskCounts(params.tasks);
|
|
1449
|
+
if (expandedTasks.error) {
|
|
1450
|
+
return { error: buildRequestedModeError(params, expandedTasks.error) };
|
|
1451
|
+
}
|
|
1452
|
+
return { params: { ...params, tasks: expandedTasks.tasks } };
|
|
1453
|
+
}
|
|
1454
|
+
if (params.chain) {
|
|
1455
|
+
const expandedChain = expandChainParallelCounts(params.chain);
|
|
1456
|
+
if (expandedChain.error) {
|
|
1457
|
+
return { error: buildRequestedModeError(params, expandedChain.error) };
|
|
1458
|
+
}
|
|
1459
|
+
return { params: { ...params, chain: expandedChain.chain } };
|
|
1460
|
+
}
|
|
1461
|
+
return { params };
|
|
1462
|
+
}
|
|
1463
|
+
function withForkContext(result, context) {
|
|
1464
|
+
if (context !== "fork" || !result.details)
|
|
1465
|
+
return result;
|
|
1466
|
+
return {
|
|
1467
|
+
...result,
|
|
1468
|
+
details: {
|
|
1469
|
+
...result.details,
|
|
1470
|
+
context: "fork",
|
|
1471
|
+
},
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
function withForkThinkingNotes(result, downgrades) {
|
|
1475
|
+
if (downgrades.size === 0)
|
|
1476
|
+
return result;
|
|
1477
|
+
const children = [...downgrades.entries()]
|
|
1478
|
+
.sort(([a], [b]) => a - b)
|
|
1479
|
+
.map(([index, agent]) => `${agent} (child ${index})`)
|
|
1480
|
+
.join(", ");
|
|
1481
|
+
const note = `Note: fork context forced thinking off for ${children}. The forked transcript contained signed Anthropic thinking blocks that were sanitized, and Anthropic children cannot resume such a transcript with thinking enabled. Use context: "fresh" when an Anthropic child needs thinking.`;
|
|
1482
|
+
return { ...result, content: [...result.content, { type: "text", text: note }] };
|
|
1483
|
+
}
|
|
1484
|
+
function toExecutionErrorResult(params, error) {
|
|
1485
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1486
|
+
return withForkContext({
|
|
1487
|
+
content: [{ type: "text", text: message }],
|
|
1488
|
+
isError: true,
|
|
1489
|
+
details: { mode: getRequestedModeLabel(params), results: [] },
|
|
1490
|
+
}, params.context);
|
|
1491
|
+
}
|
|
1492
|
+
function collectChainSessionFiles(chain, sessionFileForTask, dynamicFanoutMaxItems) {
|
|
1493
|
+
const sessionFiles = [];
|
|
1494
|
+
let flatIndex = 0;
|
|
1495
|
+
for (const step of chain) {
|
|
1496
|
+
if (isParallelStep(step)) {
|
|
1497
|
+
for (const task of step.parallel) {
|
|
1498
|
+
sessionFiles.push(sessionFileForTask(task.agent, flatIndex, task.model));
|
|
1499
|
+
flatIndex++;
|
|
1500
|
+
}
|
|
1501
|
+
continue;
|
|
1502
|
+
}
|
|
1503
|
+
if (isDynamicParallelStep(step)) {
|
|
1504
|
+
const maxItems = step.expand.maxItems ?? dynamicFanoutMaxItems ?? 0;
|
|
1505
|
+
for (let itemIndex = 0; itemIndex < maxItems; itemIndex++) {
|
|
1506
|
+
sessionFiles.push(sessionFileForTask(step.parallel.agent, flatIndex, step.parallel.model));
|
|
1507
|
+
flatIndex++;
|
|
1508
|
+
}
|
|
1509
|
+
continue;
|
|
1510
|
+
}
|
|
1511
|
+
const sequential = step;
|
|
1512
|
+
sessionFiles.push(sessionFileForTask(sequential.agent, flatIndex, sequential.model));
|
|
1513
|
+
flatIndex++;
|
|
1514
|
+
}
|
|
1515
|
+
return sessionFiles;
|
|
1516
|
+
}
|
|
1517
|
+
function collectChainThinkingOverrides(chain, thinkingOverrideForTask, dynamicFanoutMaxItems) {
|
|
1518
|
+
const thinkingOverrides = [];
|
|
1519
|
+
let flatIndex = 0;
|
|
1520
|
+
for (const step of chain) {
|
|
1521
|
+
if (isParallelStep(step)) {
|
|
1522
|
+
for (const task of step.parallel) {
|
|
1523
|
+
thinkingOverrides.push(thinkingOverrideForTask(task.agent, flatIndex, task.model));
|
|
1524
|
+
flatIndex++;
|
|
1525
|
+
}
|
|
1526
|
+
continue;
|
|
1527
|
+
}
|
|
1528
|
+
if (isDynamicParallelStep(step)) {
|
|
1529
|
+
const maxItems = step.expand.maxItems ?? dynamicFanoutMaxItems ?? 0;
|
|
1530
|
+
for (let itemIndex = 0; itemIndex < maxItems; itemIndex++) {
|
|
1531
|
+
thinkingOverrides.push(thinkingOverrideForTask(step.parallel.agent, flatIndex, step.parallel.model));
|
|
1532
|
+
flatIndex++;
|
|
1533
|
+
}
|
|
1534
|
+
continue;
|
|
1535
|
+
}
|
|
1536
|
+
const sequential = step;
|
|
1537
|
+
thinkingOverrides.push(thinkingOverrideForTask(sequential.agent, flatIndex, sequential.model));
|
|
1538
|
+
flatIndex++;
|
|
1539
|
+
}
|
|
1540
|
+
return thinkingOverrides;
|
|
1541
|
+
}
|
|
1542
|
+
function firstChainAgent(chain) {
|
|
1543
|
+
const first = chain[0];
|
|
1544
|
+
if (!first)
|
|
1545
|
+
return undefined;
|
|
1546
|
+
if (isParallelStep(first))
|
|
1547
|
+
return first.parallel[0]?.agent;
|
|
1548
|
+
if (isDynamicParallelStep(first))
|
|
1549
|
+
return first.parallel.agent;
|
|
1550
|
+
return first.agent;
|
|
1551
|
+
}
|
|
1552
|
+
function firstRawChainTask(chain) {
|
|
1553
|
+
const first = chain[0];
|
|
1554
|
+
if (!first)
|
|
1555
|
+
return undefined;
|
|
1556
|
+
if (isParallelStep(first))
|
|
1557
|
+
return first.parallel[0]?.task;
|
|
1558
|
+
if (isDynamicParallelStep(first))
|
|
1559
|
+
return first.parallel.task;
|
|
1560
|
+
return first.task;
|
|
1561
|
+
}
|
|
1562
|
+
function resolveAsyncEventGoal(workflowTask, rawChain, unwrapForkFallback = false) {
|
|
1563
|
+
if (workflowTask?.trim())
|
|
1564
|
+
return workflowTask;
|
|
1565
|
+
const fallback = firstRawChainTask(rawChain) || "";
|
|
1566
|
+
if (!unwrapForkFallback)
|
|
1567
|
+
return fallback;
|
|
1568
|
+
const forkPrefix = `${DEFAULT_FORK_PREAMBLE}\n\nTask:\n`;
|
|
1569
|
+
return fallback.startsWith(forkPrefix) ? fallback.slice(forkPrefix.length) : fallback;
|
|
1570
|
+
}
|
|
1571
|
+
function wrapChainTasksForFork(chain, contextPolicy) {
|
|
1572
|
+
return chain.map((step, stepIndex) => {
|
|
1573
|
+
if (isParallelStep(step)) {
|
|
1574
|
+
return {
|
|
1575
|
+
...step,
|
|
1576
|
+
parallel: step.parallel.map((task) => ({
|
|
1577
|
+
...task,
|
|
1578
|
+
task: shouldForkAgent(contextPolicy, task.agent)
|
|
1579
|
+
? wrapForkTask(task.task ?? "{previous}")
|
|
1580
|
+
: task.task,
|
|
1581
|
+
})),
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
if (isDynamicParallelStep(step)) {
|
|
1585
|
+
return {
|
|
1586
|
+
...step,
|
|
1587
|
+
parallel: {
|
|
1588
|
+
...step.parallel,
|
|
1589
|
+
task: shouldForkAgent(contextPolicy, step.parallel.agent)
|
|
1590
|
+
? wrapForkTask(step.parallel.task ?? "{previous}")
|
|
1591
|
+
: step.parallel.task,
|
|
1592
|
+
},
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
const sequential = step;
|
|
1596
|
+
return {
|
|
1597
|
+
...sequential,
|
|
1598
|
+
task: shouldForkAgent(contextPolicy, sequential.agent)
|
|
1599
|
+
? wrapForkTask(sequential.task ?? (stepIndex === 0 ? "{task}" : "{previous}"))
|
|
1600
|
+
: sequential.task,
|
|
1601
|
+
};
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
function preflightForkSessionsForStaticTasks(params, contextPolicy, sessionFileForTask, dynamicFanoutMaxItems) {
|
|
1605
|
+
if (!contextPolicy.usesFork)
|
|
1606
|
+
return;
|
|
1607
|
+
if (params.agent) {
|
|
1608
|
+
if (shouldForkAgent(contextPolicy, params.agent))
|
|
1609
|
+
sessionFileForTask(params.agent, 0, params.model);
|
|
1610
|
+
return;
|
|
1611
|
+
}
|
|
1612
|
+
if (params.tasks) {
|
|
1613
|
+
params.tasks.forEach((task, index) => {
|
|
1614
|
+
if (shouldForkAgent(contextPolicy, task.agent))
|
|
1615
|
+
sessionFileForTask(task.agent, index, task.model);
|
|
1616
|
+
});
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1619
|
+
if (!params.chain?.length)
|
|
1620
|
+
return;
|
|
1621
|
+
let flatIndex = 0;
|
|
1622
|
+
for (const step of params.chain) {
|
|
1623
|
+
if (isParallelStep(step)) {
|
|
1624
|
+
for (const task of step.parallel) {
|
|
1625
|
+
if (shouldForkAgent(contextPolicy, task.agent))
|
|
1626
|
+
sessionFileForTask(task.agent, flatIndex, task.model);
|
|
1627
|
+
flatIndex++;
|
|
1628
|
+
}
|
|
1629
|
+
continue;
|
|
1630
|
+
}
|
|
1631
|
+
if (isDynamicParallelStep(step)) {
|
|
1632
|
+
const maxItems = step.expand.maxItems ?? dynamicFanoutMaxItems ?? 0;
|
|
1633
|
+
if (shouldForkAgent(contextPolicy, step.parallel.agent)) {
|
|
1634
|
+
for (let itemIndex = 0; itemIndex < maxItems; itemIndex++)
|
|
1635
|
+
sessionFileForTask(step.parallel.agent, flatIndex + itemIndex, step.parallel.model);
|
|
1636
|
+
}
|
|
1637
|
+
flatIndex += maxItems;
|
|
1638
|
+
continue;
|
|
1639
|
+
}
|
|
1640
|
+
const sequential = step;
|
|
1641
|
+
if (shouldForkAgent(contextPolicy, sequential.agent))
|
|
1642
|
+
sessionFileForTask(sequential.agent, flatIndex, sequential.model);
|
|
1643
|
+
flatIndex++;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
function runAsyncPath(data, deps) {
|
|
1647
|
+
const { params, effectiveCwd, agents, ctx, shareEnabled, sessionRoot, sessionFileForIndex, sessionFileForTask, thinkingOverrideForTask, artifactConfig, artifactsDir, effectiveAsync, controlConfig, intercomBridge, nestedRoute, contextPolicy, } = data;
|
|
1648
|
+
const hasChain = (params.chain?.length ?? 0) > 0;
|
|
1649
|
+
const hasTasks = (params.tasks?.length ?? 0) > 0;
|
|
1650
|
+
const hasSingle = !hasChain && !hasTasks && Boolean(params.agent);
|
|
1651
|
+
if (!effectiveAsync)
|
|
1652
|
+
return null;
|
|
1653
|
+
if (hasChain && params.chain) {
|
|
1654
|
+
const chainWorktreeTaskCwdError = buildChainWorktreeTaskCwdError(params.chain, effectiveCwd);
|
|
1655
|
+
if (chainWorktreeTaskCwdError) {
|
|
1656
|
+
return {
|
|
1657
|
+
content: [{ type: "text", text: chainWorktreeTaskCwdError }],
|
|
1658
|
+
isError: true,
|
|
1659
|
+
details: { mode: "chain", results: [] },
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
if (hasTasks && params.tasks) {
|
|
1664
|
+
const maxParallelTasks = resolveTopLevelParallelMaxTasks(deps.config.parallel?.maxTasks);
|
|
1665
|
+
if (params.tasks.length > maxParallelTasks) {
|
|
1666
|
+
return buildParallelModeError(`Max ${maxParallelTasks} tasks`);
|
|
1667
|
+
}
|
|
1668
|
+
if (params.worktree) {
|
|
1669
|
+
const worktreeTaskCwdError = buildParallelWorktreeTaskCwdError(params.tasks, effectiveCwd);
|
|
1670
|
+
if (worktreeTaskCwdError)
|
|
1671
|
+
return buildParallelModeError(worktreeTaskCwdError);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
if (!isAsyncAvailable()) {
|
|
1675
|
+
return {
|
|
1676
|
+
content: [{ type: "text", text: "Async mode requires upstream jiti for TypeScript execution but it could not be found. Ensure the pi-subagents package dependencies are installed." }],
|
|
1677
|
+
isError: true,
|
|
1678
|
+
details: { mode: "single", results: [] },
|
|
1679
|
+
};
|
|
1680
|
+
}
|
|
1681
|
+
const id = randomUUID();
|
|
1682
|
+
const asyncCtx = {
|
|
1683
|
+
pi: deps.pi,
|
|
1684
|
+
cwd: ctx.cwd,
|
|
1685
|
+
currentSessionId: deps.state.currentSessionId,
|
|
1686
|
+
parentSessionId: ctx.sessionManager.getSessionId() ?? undefined,
|
|
1687
|
+
currentModelProvider: ctx.model?.provider,
|
|
1688
|
+
currentModel: ctx.model,
|
|
1689
|
+
modelScope: data.modelScope,
|
|
1690
|
+
};
|
|
1691
|
+
const availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
1692
|
+
const currentMaxSubagentDepth = resolveCurrentMaxSubagentDepth(deps.config.maxSubagentDepth);
|
|
1693
|
+
const currentProvider = ctx.model?.provider;
|
|
1694
|
+
const controlIntercomTarget = intercomBridge.active ? intercomBridge.orchestratorTarget : undefined;
|
|
1695
|
+
const childIntercomTarget = intercomBridge.active ? (agent, index) => resolveSubagentIntercomTarget(id, agent, index) : undefined;
|
|
1696
|
+
if (hasTasks && params.tasks) {
|
|
1697
|
+
const skillOverrides = params.tasks.map((task) => normalizeSkillInput(task.skill));
|
|
1698
|
+
const parallelTasks = params.tasks.map((task, index) => ({
|
|
1699
|
+
agent: task.agent,
|
|
1700
|
+
task: shouldForkAgent(contextPolicy, task.agent) ? wrapForkTask(task.task) : task.task,
|
|
1701
|
+
cwd: task.cwd,
|
|
1702
|
+
...(task.model !== undefined ? { model: task.model } : {}),
|
|
1703
|
+
...(skillOverrides[index] !== undefined ? { skill: skillOverrides[index] } : {}),
|
|
1704
|
+
...(task.output !== undefined && task.output !== true ? { output: task.output } : {}),
|
|
1705
|
+
...(task.outputMode !== undefined ? { outputMode: task.outputMode } : {}),
|
|
1706
|
+
...(task.reads !== undefined && task.reads !== true ? { reads: task.reads } : {}),
|
|
1707
|
+
...(task.progress !== undefined ? { progress: task.progress } : {}),
|
|
1708
|
+
...(task.toolBudget !== undefined ? { toolBudget: task.toolBudget } : {}),
|
|
1709
|
+
...(task.acceptance !== undefined ? { acceptance: task.acceptance } : {}),
|
|
1710
|
+
}));
|
|
1711
|
+
return executeAsyncChain(id, {
|
|
1712
|
+
chain: [{
|
|
1713
|
+
parallel: parallelTasks,
|
|
1714
|
+
concurrency: resolveTopLevelParallelConcurrency(params.concurrency, deps.config.parallel?.concurrency),
|
|
1715
|
+
worktree: params.worktree,
|
|
1716
|
+
}],
|
|
1717
|
+
resultMode: "parallel",
|
|
1718
|
+
goal: params.tasks[0]?.task ?? "",
|
|
1719
|
+
agents,
|
|
1720
|
+
ctx: asyncCtx,
|
|
1721
|
+
availableModels,
|
|
1722
|
+
cwd: effectiveCwd,
|
|
1723
|
+
maxOutput: params.maxOutput,
|
|
1724
|
+
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
1725
|
+
artifactConfig,
|
|
1726
|
+
shareEnabled,
|
|
1727
|
+
sessionRoot,
|
|
1728
|
+
chainSkills: [],
|
|
1729
|
+
sessionFilesByFlatIndex: params.tasks.map((task, index) => sessionFileForTask(task.agent, index, task.model)),
|
|
1730
|
+
thinkingOverridesByFlatIndex: params.tasks.map((task, index) => thinkingOverrideForTask(task.agent, index, task.model)),
|
|
1731
|
+
maxSubagentDepth: currentMaxSubagentDepth,
|
|
1732
|
+
waitToolEnabled: deps.waitToolEnabled,
|
|
1733
|
+
worktreeSetupHook: deps.config.worktreeSetupHook,
|
|
1734
|
+
worktreeSetupHookTimeoutMs: deps.config.worktreeSetupHookTimeoutMs,
|
|
1735
|
+
worktreeBaseDir: deps.config.worktreeBaseDir,
|
|
1736
|
+
controlConfig,
|
|
1737
|
+
controlIntercomTarget,
|
|
1738
|
+
childIntercomTarget,
|
|
1739
|
+
nestedRoute,
|
|
1740
|
+
timeoutMs: data.timeoutMs,
|
|
1741
|
+
turnBudget: data.turnBudget,
|
|
1742
|
+
toolBudget: data.toolBudget,
|
|
1743
|
+
configToolBudget: data.configToolBudget,
|
|
1744
|
+
globalConcurrencyLimit: deps.config.globalConcurrencyLimit,
|
|
1745
|
+
});
|
|
1746
|
+
}
|
|
1747
|
+
if (hasChain && params.chain) {
|
|
1748
|
+
const normalized = normalizeSkillInput(params.skill);
|
|
1749
|
+
const chainSkills = normalized === false ? [] : (normalized ?? []);
|
|
1750
|
+
const rawChain = params.chain;
|
|
1751
|
+
const chain = wrapChainTasksForFork(rawChain, contextPolicy);
|
|
1752
|
+
return executeAsyncChain(id, {
|
|
1753
|
+
chain,
|
|
1754
|
+
task: params.task,
|
|
1755
|
+
goal: resolveAsyncEventGoal(params.task, rawChain),
|
|
1756
|
+
agents,
|
|
1757
|
+
ctx: asyncCtx,
|
|
1758
|
+
availableModels,
|
|
1759
|
+
cwd: effectiveCwd,
|
|
1760
|
+
maxOutput: params.maxOutput,
|
|
1761
|
+
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
1762
|
+
artifactConfig,
|
|
1763
|
+
shareEnabled,
|
|
1764
|
+
sessionRoot,
|
|
1765
|
+
chainSkills,
|
|
1766
|
+
sessionFilesByFlatIndex: collectChainSessionFiles(chain, sessionFileForTask, deps.config.chain?.dynamicFanout?.maxItems),
|
|
1767
|
+
thinkingOverridesByFlatIndex: collectChainThinkingOverrides(chain, thinkingOverrideForTask, deps.config.chain?.dynamicFanout?.maxItems),
|
|
1768
|
+
dynamicFanoutMaxItems: deps.config.chain?.dynamicFanout?.maxItems,
|
|
1769
|
+
maxSubagentDepth: currentMaxSubagentDepth,
|
|
1770
|
+
waitToolEnabled: deps.waitToolEnabled,
|
|
1771
|
+
worktreeSetupHook: deps.config.worktreeSetupHook,
|
|
1772
|
+
worktreeSetupHookTimeoutMs: deps.config.worktreeSetupHookTimeoutMs,
|
|
1773
|
+
worktreeBaseDir: deps.config.worktreeBaseDir,
|
|
1774
|
+
controlConfig,
|
|
1775
|
+
controlIntercomTarget,
|
|
1776
|
+
childIntercomTarget,
|
|
1777
|
+
nestedRoute,
|
|
1778
|
+
timeoutMs: data.timeoutMs,
|
|
1779
|
+
turnBudget: data.turnBudget,
|
|
1780
|
+
toolBudget: data.toolBudget,
|
|
1781
|
+
configToolBudget: data.configToolBudget,
|
|
1782
|
+
globalConcurrencyLimit: deps.config.globalConcurrencyLimit,
|
|
1783
|
+
});
|
|
1784
|
+
}
|
|
1785
|
+
if (hasSingle) {
|
|
1786
|
+
const a = agents.find((x) => x.name === params.agent);
|
|
1787
|
+
if (!a) {
|
|
1788
|
+
return {
|
|
1789
|
+
content: [{ type: "text", text: `Unknown agent: ${params.agent}` }],
|
|
1790
|
+
isError: true,
|
|
1791
|
+
details: { mode: "single", results: [] },
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
const rawOutput = params.output !== undefined ? params.output : a.output;
|
|
1795
|
+
const effectiveOutput = normalizeSingleOutputOverride(rawOutput, a.output);
|
|
1796
|
+
const effectiveOutputMode = params.outputMode ?? "inline";
|
|
1797
|
+
const normalizedSkills = normalizeSkillInput(params.skill);
|
|
1798
|
+
const skills = normalizedSkills === false ? [] : normalizedSkills;
|
|
1799
|
+
const maxSubagentDepth = resolveChildMaxSubagentDepth(currentMaxSubagentDepth, a.maxSubagentDepth);
|
|
1800
|
+
// lunr: model tiers — explicit model wins; otherwise resolve params.tier via the tier bridge.
|
|
1801
|
+
const modelOverride = resolveEffectiveSubagentModel(params.model ?? resolveTierModelOverride(params.tier), a.model, ctx.model, availableModels, currentProvider, { scope: data.modelScope });
|
|
1802
|
+
return executeAsyncSingle(id, {
|
|
1803
|
+
agent: params.agent,
|
|
1804
|
+
task: shouldForkAgent(contextPolicy, params.agent) ? wrapForkTask(params.task ?? "") : (params.task ?? ""),
|
|
1805
|
+
goal: params.task ?? "",
|
|
1806
|
+
agentConfig: a,
|
|
1807
|
+
ctx: asyncCtx,
|
|
1808
|
+
availableModels,
|
|
1809
|
+
cwd: effectiveCwd,
|
|
1810
|
+
maxOutput: params.maxOutput,
|
|
1811
|
+
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
1812
|
+
artifactConfig,
|
|
1813
|
+
shareEnabled,
|
|
1814
|
+
sessionRoot,
|
|
1815
|
+
sessionFile: sessionFileForTask(params.agent, 0, modelOverride),
|
|
1816
|
+
skills,
|
|
1817
|
+
output: effectiveOutput,
|
|
1818
|
+
outputMode: effectiveOutputMode,
|
|
1819
|
+
outputBaseDir: resolveSingleRunOutputBaseDir(deps, artifactsDir, id),
|
|
1820
|
+
modelOverride,
|
|
1821
|
+
thinkingOverride: thinkingOverrideForTask(params.agent, 0, modelOverride),
|
|
1822
|
+
maxSubagentDepth,
|
|
1823
|
+
waitToolEnabled: deps.waitToolEnabled,
|
|
1824
|
+
worktreeSetupHook: deps.config.worktreeSetupHook,
|
|
1825
|
+
worktreeSetupHookTimeoutMs: deps.config.worktreeSetupHookTimeoutMs,
|
|
1826
|
+
worktreeBaseDir: deps.config.worktreeBaseDir,
|
|
1827
|
+
controlConfig,
|
|
1828
|
+
controlIntercomTarget,
|
|
1829
|
+
childIntercomTarget: childIntercomTarget ? (agent, index) => childIntercomTarget(agent, index) : undefined,
|
|
1830
|
+
nestedRoute,
|
|
1831
|
+
acceptance: params.acceptance,
|
|
1832
|
+
timeoutMs: data.timeoutMs,
|
|
1833
|
+
turnBudget: data.turnBudget,
|
|
1834
|
+
toolBudget: data.toolBudget,
|
|
1835
|
+
configToolBudget: data.configToolBudget,
|
|
1836
|
+
});
|
|
1837
|
+
}
|
|
1838
|
+
return null;
|
|
1839
|
+
}
|
|
1840
|
+
async function runChainPath(data, deps) {
|
|
1841
|
+
const { params, effectiveCwd, agents, ctx, signal, runId, shareEnabled, sessionDirForIndex, sessionFileForIndex, sessionFileForTask, thinkingOverrideForTask, artifactsDir, artifactConfig, onUpdate, sessionRoot, controlConfig, contextPolicy, } = data;
|
|
1842
|
+
const onControlEvent = createForegroundControlNotifier(data, deps);
|
|
1843
|
+
const childIntercomTarget = data.intercomBridge.active ? resolveSubagentIntercomTarget : undefined;
|
|
1844
|
+
const foregroundControl = deps.state.foregroundControls.get(runId);
|
|
1845
|
+
const normalized = normalizeSkillInput(params.skill);
|
|
1846
|
+
const chainSkills = normalized === false ? [] : (normalized ?? []);
|
|
1847
|
+
const chain = wrapChainTasksForFork(params.chain, contextPolicy);
|
|
1848
|
+
const currentMaxSubagentDepth = resolveCurrentMaxSubagentDepth(deps.config.maxSubagentDepth);
|
|
1849
|
+
const chainResult = await executeChain({
|
|
1850
|
+
chain,
|
|
1851
|
+
task: params.task,
|
|
1852
|
+
agents,
|
|
1853
|
+
ctx,
|
|
1854
|
+
modelScope: data.modelScope,
|
|
1855
|
+
intercomEvents: deps.pi.events,
|
|
1856
|
+
signal,
|
|
1857
|
+
runId,
|
|
1858
|
+
cwd: effectiveCwd,
|
|
1859
|
+
shareEnabled,
|
|
1860
|
+
sessionDirForIndex,
|
|
1861
|
+
sessionFileForIndex,
|
|
1862
|
+
sessionFileForTask,
|
|
1863
|
+
thinkingOverrideForTask,
|
|
1864
|
+
artifactsDir,
|
|
1865
|
+
artifactConfig,
|
|
1866
|
+
includeProgress: params.includeProgress,
|
|
1867
|
+
clarify: params.clarify,
|
|
1868
|
+
onUpdate,
|
|
1869
|
+
onControlEvent,
|
|
1870
|
+
controlConfig,
|
|
1871
|
+
childIntercomTarget: childIntercomTarget ? (agent, index) => childIntercomTarget(runId, agent, index) : undefined,
|
|
1872
|
+
orchestratorIntercomTarget: data.intercomBridge.active ? data.intercomBridge.orchestratorTarget : undefined,
|
|
1873
|
+
foregroundControl,
|
|
1874
|
+
nestedRoute: foregroundControl?.nestedRoute,
|
|
1875
|
+
chainSkills,
|
|
1876
|
+
chainDir: params.chainDir ?? getProjectChainRunsDir(effectiveCwd),
|
|
1877
|
+
dynamicFanoutMaxItems: deps.config.chain?.dynamicFanout?.maxItems,
|
|
1878
|
+
maxSubagentDepth: currentMaxSubagentDepth,
|
|
1879
|
+
worktreeSetupHook: deps.config.worktreeSetupHook,
|
|
1880
|
+
worktreeSetupHookTimeoutMs: deps.config.worktreeSetupHookTimeoutMs,
|
|
1881
|
+
worktreeBaseDir: deps.config.worktreeBaseDir,
|
|
1882
|
+
timeoutMs: data.timeoutMs,
|
|
1883
|
+
deadlineAt: data.deadlineAt,
|
|
1884
|
+
turnBudget: data.turnBudget,
|
|
1885
|
+
onDetachedExit: (index, result) => updateRememberedForegroundChild(deps.state, { runId, mode: "chain", cwd: effectiveCwd, sessionId: data.parentSessionId, index, result, events: deps.pi.events }),
|
|
1886
|
+
toolBudget: data.toolBudget,
|
|
1887
|
+
configToolBudget: data.configToolBudget,
|
|
1888
|
+
globalConcurrencyLimit: deps.config.globalConcurrencyLimit,
|
|
1889
|
+
});
|
|
1890
|
+
if (chainResult.requestedAsync) {
|
|
1891
|
+
if (!isAsyncAvailable()) {
|
|
1892
|
+
return {
|
|
1893
|
+
content: [{ type: "text", text: "Background mode requires upstream jiti for TypeScript execution but it could not be found. Ensure the pi-subagents package dependencies are installed." }],
|
|
1894
|
+
isError: true,
|
|
1895
|
+
details: { mode: "chain", results: [] },
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1898
|
+
const id = randomUUID();
|
|
1899
|
+
const asyncCtx = {
|
|
1900
|
+
pi: deps.pi,
|
|
1901
|
+
cwd: ctx.cwd,
|
|
1902
|
+
currentSessionId: deps.state.currentSessionId,
|
|
1903
|
+
parentSessionId: ctx.sessionManager.getSessionId() ?? undefined,
|
|
1904
|
+
currentModelProvider: ctx.model?.provider,
|
|
1905
|
+
currentModel: ctx.model,
|
|
1906
|
+
modelScope: data.modelScope,
|
|
1907
|
+
};
|
|
1908
|
+
const rawAsyncChain = chainResult.requestedAsync.chain;
|
|
1909
|
+
const asyncChain = wrapChainTasksForFork(rawAsyncChain, contextPolicy);
|
|
1910
|
+
const firstAgent = firstChainAgent(rawAsyncChain);
|
|
1911
|
+
return executeAsyncChain(id, {
|
|
1912
|
+
chain: asyncChain,
|
|
1913
|
+
task: params.task,
|
|
1914
|
+
goal: resolveAsyncEventGoal(params.task, rawAsyncChain, firstAgent ? shouldForkAgent(contextPolicy, firstAgent) : false),
|
|
1915
|
+
agents,
|
|
1916
|
+
ctx: asyncCtx,
|
|
1917
|
+
availableModels: ctx.modelRegistry.getAvailable().map(toModelInfo),
|
|
1918
|
+
cwd: effectiveCwd,
|
|
1919
|
+
maxOutput: params.maxOutput,
|
|
1920
|
+
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
1921
|
+
artifactConfig,
|
|
1922
|
+
shareEnabled,
|
|
1923
|
+
sessionRoot,
|
|
1924
|
+
chainSkills: chainResult.requestedAsync.chainSkills,
|
|
1925
|
+
sessionFilesByFlatIndex: collectChainSessionFiles(asyncChain, sessionFileForTask, deps.config.chain?.dynamicFanout?.maxItems),
|
|
1926
|
+
thinkingOverridesByFlatIndex: collectChainThinkingOverrides(asyncChain, thinkingOverrideForTask, deps.config.chain?.dynamicFanout?.maxItems),
|
|
1927
|
+
dynamicFanoutMaxItems: deps.config.chain?.dynamicFanout?.maxItems,
|
|
1928
|
+
maxSubagentDepth: currentMaxSubagentDepth,
|
|
1929
|
+
waitToolEnabled: deps.waitToolEnabled,
|
|
1930
|
+
worktreeSetupHook: deps.config.worktreeSetupHook,
|
|
1931
|
+
worktreeSetupHookTimeoutMs: deps.config.worktreeSetupHookTimeoutMs,
|
|
1932
|
+
worktreeBaseDir: deps.config.worktreeBaseDir,
|
|
1933
|
+
controlConfig,
|
|
1934
|
+
controlIntercomTarget: data.intercomBridge.active ? data.intercomBridge.orchestratorTarget : undefined,
|
|
1935
|
+
childIntercomTarget: data.intercomBridge.active ? (agent, index) => resolveSubagentIntercomTarget(id, agent, index) : undefined,
|
|
1936
|
+
nestedRoute: data.nestedRoute,
|
|
1937
|
+
timeoutMs: data.timeoutMs,
|
|
1938
|
+
turnBudget: data.turnBudget,
|
|
1939
|
+
toolBudget: data.toolBudget,
|
|
1940
|
+
configToolBudget: data.configToolBudget,
|
|
1941
|
+
globalConcurrencyLimit: deps.config.globalConcurrencyLimit,
|
|
1942
|
+
});
|
|
1943
|
+
}
|
|
1944
|
+
const rawChainDetails = chainResult.details ? { ...chainResult.details, runId } : undefined;
|
|
1945
|
+
if (foregroundControl && rawChainDetails) {
|
|
1946
|
+
updateForegroundNestedProjection(foregroundControl);
|
|
1947
|
+
attachRootChildrenToSteps(runId, rawChainDetails.results, foregroundControl.nestedChildren);
|
|
1948
|
+
rawChainDetails.totalCost = sumResultsCost(rawChainDetails.results);
|
|
1949
|
+
}
|
|
1950
|
+
const chainDetails = rawChainDetails ? compactForegroundDetails(rawChainDetails) : undefined;
|
|
1951
|
+
if (chainDetails)
|
|
1952
|
+
rememberForegroundRun(deps.state, { runId, mode: "chain", cwd: effectiveCwd, sessionId: data.parentSessionId, results: chainDetails.results });
|
|
1953
|
+
const intercomReceipt = chainDetails && !chainDetails.results.some((result) => result.interrupted || result.detached)
|
|
1954
|
+
? await maybeBuildForegroundIntercomReceipt({
|
|
1955
|
+
pi: deps.pi,
|
|
1956
|
+
intercomBridge: data.intercomBridge,
|
|
1957
|
+
runId,
|
|
1958
|
+
mode: "chain",
|
|
1959
|
+
details: chainDetails,
|
|
1960
|
+
...(foregroundControl?.nestedChildren?.length ? { nestedChildren: foregroundControl.nestedChildren } : {}),
|
|
1961
|
+
})
|
|
1962
|
+
: null;
|
|
1963
|
+
if (intercomReceipt) {
|
|
1964
|
+
return {
|
|
1965
|
+
...chainResult,
|
|
1966
|
+
content: [{ type: "text", text: intercomReceipt.text }],
|
|
1967
|
+
details: intercomReceipt.details,
|
|
1968
|
+
};
|
|
1969
|
+
}
|
|
1970
|
+
return chainDetails ? { ...chainResult, details: chainDetails } : chainResult;
|
|
1971
|
+
}
|
|
1972
|
+
function buildParallelModeError(message) {
|
|
1973
|
+
return {
|
|
1974
|
+
content: [{ type: "text", text: message }],
|
|
1975
|
+
isError: true,
|
|
1976
|
+
details: { mode: "parallel", results: [] },
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
function createParallelWorktreeSetup(enabled, cwd, runId, tasks, setupHook, setupHookTimeoutMs, baseDir) {
|
|
1980
|
+
if (!enabled)
|
|
1981
|
+
return {};
|
|
1982
|
+
try {
|
|
1983
|
+
return {
|
|
1984
|
+
setup: createWorktrees(cwd, runId, tasks.length, {
|
|
1985
|
+
agents: tasks.map((task) => task.agent),
|
|
1986
|
+
setupHook: setupHook
|
|
1987
|
+
? { hookPath: setupHook, timeoutMs: setupHookTimeoutMs }
|
|
1988
|
+
: undefined,
|
|
1989
|
+
baseDir,
|
|
1990
|
+
}),
|
|
1991
|
+
};
|
|
1992
|
+
}
|
|
1993
|
+
catch (error) {
|
|
1994
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1995
|
+
return { errorResult: buildParallelModeError(message) };
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
function buildParallelWorktreeTaskCwdError(tasks, sharedCwd) {
|
|
1999
|
+
const conflict = findWorktreeTaskCwdConflict(tasks, sharedCwd);
|
|
2000
|
+
if (!conflict)
|
|
2001
|
+
return undefined;
|
|
2002
|
+
return formatWorktreeTaskCwdConflict(conflict, sharedCwd);
|
|
2003
|
+
}
|
|
2004
|
+
function resolveSingleRunOutputBaseDir(deps, artifactsDir, runId) {
|
|
2005
|
+
return deps.config.singleRunOutputBaseDir
|
|
2006
|
+
? path.resolve(deps.expandTilde(deps.config.singleRunOutputBaseDir))
|
|
2007
|
+
: path.join(artifactsDir, "outputs", runId);
|
|
2008
|
+
}
|
|
2009
|
+
function buildChainWorktreeTaskCwdError(chain, sharedCwd) {
|
|
2010
|
+
for (let stepIndex = 0; stepIndex < chain.length; stepIndex++) {
|
|
2011
|
+
const step = chain[stepIndex];
|
|
2012
|
+
if (!isParallelStep(step) || !step.worktree)
|
|
2013
|
+
continue;
|
|
2014
|
+
const stepCwd = resolveChildCwd(sharedCwd, step.cwd);
|
|
2015
|
+
const conflict = findWorktreeTaskCwdConflict(step.parallel, stepCwd);
|
|
2016
|
+
if (!conflict)
|
|
2017
|
+
continue;
|
|
2018
|
+
const detail = formatWorktreeTaskCwdConflict(conflict, stepCwd);
|
|
2019
|
+
return `parallel chain step ${stepIndex + 1}: ${detail}`;
|
|
2020
|
+
}
|
|
2021
|
+
return undefined;
|
|
2022
|
+
}
|
|
2023
|
+
function resolveParallelTaskCwd(task, paramsCwd, worktreeSetup, index) {
|
|
2024
|
+
if (worktreeSetup)
|
|
2025
|
+
return worktreeSetup.worktrees[index].agentCwd;
|
|
2026
|
+
return resolveChildCwd(paramsCwd, task.cwd);
|
|
2027
|
+
}
|
|
2028
|
+
function buildParallelWorktreeSuffix(worktreeSetup, artifactsDir, tasks) {
|
|
2029
|
+
if (!worktreeSetup)
|
|
2030
|
+
return "";
|
|
2031
|
+
const diffsDir = path.join(artifactsDir, "worktree-diffs");
|
|
2032
|
+
const diffs = diffWorktrees(worktreeSetup, tasks.map((task) => task.agent), diffsDir);
|
|
2033
|
+
return formatWorktreeDiffSummary(diffs);
|
|
2034
|
+
}
|
|
2035
|
+
function findDuplicateParallelOutputPath(input) {
|
|
2036
|
+
const seen = new Map();
|
|
2037
|
+
for (let index = 0; index < input.tasks.length; index++) {
|
|
2038
|
+
const behavior = input.behaviors[index];
|
|
2039
|
+
if (!behavior?.output)
|
|
2040
|
+
continue;
|
|
2041
|
+
const task = input.tasks[index];
|
|
2042
|
+
const taskCwd = resolveParallelTaskCwd(task, input.paramsCwd, input.worktreeSetup, index);
|
|
2043
|
+
const outputPath = resolveSingleOutputPath(behavior.output, input.ctxCwd, taskCwd, input.outputBaseDir);
|
|
2044
|
+
if (!outputPath)
|
|
2045
|
+
continue;
|
|
2046
|
+
const previous = seen.get(outputPath);
|
|
2047
|
+
if (previous) {
|
|
2048
|
+
return `Parallel tasks ${previous.index + 1} (${previous.agent}) and ${index + 1} (${task.agent}) resolve output to the same path: ${outputPath}. Use distinct output paths.`;
|
|
2049
|
+
}
|
|
2050
|
+
seen.set(outputPath, { index, agent: task.agent });
|
|
2051
|
+
}
|
|
2052
|
+
return undefined;
|
|
2053
|
+
}
|
|
2054
|
+
async function runForegroundParallelTasks(input) {
|
|
2055
|
+
// Pre-warm fork session files sequentially before concurrent dispatch to avoid
|
|
2056
|
+
// races where multiple workers simultaneously try to branch the same parent session.
|
|
2057
|
+
for (let i = 0; i < input.tasks.length; i++) {
|
|
2058
|
+
input.sessionFileForTask(input.tasks[i].agent, i, input.modelOverrides[i]);
|
|
2059
|
+
}
|
|
2060
|
+
return mapConcurrent(input.tasks, input.concurrencyLimit, async (task, index) => {
|
|
2061
|
+
const behavior = input.behaviors[index];
|
|
2062
|
+
const effectiveSkills = behavior?.skills;
|
|
2063
|
+
const taskCwd = resolveParallelTaskCwd(task, input.paramsCwd, input.worktreeSetup, index);
|
|
2064
|
+
const readInstructions = behavior
|
|
2065
|
+
? buildChainInstructions({ ...behavior, output: false, progress: false }, taskCwd, false)
|
|
2066
|
+
: { prefix: "", suffix: "" };
|
|
2067
|
+
const progressInstructions = behavior
|
|
2068
|
+
? buildChainInstructions({ ...behavior, output: false, reads: false }, input.progressDir, index === input.firstProgressIndex)
|
|
2069
|
+
: { prefix: "", suffix: "" };
|
|
2070
|
+
const outputPath = resolveSingleOutputPath(behavior?.output, input.ctx.cwd, taskCwd, input.outputBaseDir);
|
|
2071
|
+
const agentConfig = input.agents.find((agent) => agent.name === task.agent);
|
|
2072
|
+
const taskText = injectSingleOutputInstruction(`${readInstructions.prefix}${input.taskTexts[index]}${progressInstructions.suffix}`, outputPath, agentConfig);
|
|
2073
|
+
const interruptController = new AbortController();
|
|
2074
|
+
if (input.foregroundControl) {
|
|
2075
|
+
input.foregroundControl.currentAgent = task.agent;
|
|
2076
|
+
input.foregroundControl.currentIndex = index;
|
|
2077
|
+
input.foregroundControl.currentActivityState = undefined;
|
|
2078
|
+
input.foregroundControl.updatedAt = Date.now();
|
|
2079
|
+
input.foregroundControl.interrupt = () => {
|
|
2080
|
+
if (interruptController.signal.aborted)
|
|
2081
|
+
return false;
|
|
2082
|
+
interruptController.abort();
|
|
2083
|
+
input.foregroundControl.currentActivityState = undefined;
|
|
2084
|
+
input.foregroundControl.updatedAt = Date.now();
|
|
2085
|
+
return true;
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
return runSync(input.ctx.cwd, input.agents, task.agent, taskText, {
|
|
2089
|
+
parentSessionId: input.ctx.sessionManager.getSessionId() ?? undefined,
|
|
2090
|
+
cwd: taskCwd,
|
|
2091
|
+
signal: input.signal,
|
|
2092
|
+
interruptSignal: interruptController.signal,
|
|
2093
|
+
allowIntercomDetach: agentConfig?.systemPrompt?.includes(INTERCOM_BRIDGE_MARKER) === true,
|
|
2094
|
+
intercomEvents: input.intercomEvents,
|
|
2095
|
+
runId: input.runId,
|
|
2096
|
+
index,
|
|
2097
|
+
sessionDir: input.sessionDirForIndex(index),
|
|
2098
|
+
sessionFile: input.sessionFileForTask(task.agent, index, input.modelOverrides[index]),
|
|
2099
|
+
share: input.shareEnabled,
|
|
2100
|
+
artifactsDir: input.artifactConfig.enabled ? input.artifactsDir : undefined,
|
|
2101
|
+
artifactConfig: input.artifactConfig,
|
|
2102
|
+
maxOutput: input.maxOutput,
|
|
2103
|
+
outputPath,
|
|
2104
|
+
outputMode: behavior?.outputMode,
|
|
2105
|
+
maxSubagentDepth: input.maxSubagentDepths[index],
|
|
2106
|
+
waitToolEnabled: input.waitToolEnabled,
|
|
2107
|
+
controlConfig: input.controlConfig,
|
|
2108
|
+
onControlEvent: input.onControlEvent,
|
|
2109
|
+
onDetachedExit: (result) => updateRememberedForegroundChild(input.state, { runId: input.runId, mode: "parallel", cwd: taskCwd, sessionId: input.parentSessionId, index, result, events: input.intercomEvents }),
|
|
2110
|
+
intercomSessionName: input.childIntercomTarget?.(task.agent, index),
|
|
2111
|
+
orchestratorIntercomTarget: input.orchestratorIntercomTarget,
|
|
2112
|
+
nestedRoute: input.foregroundControl?.nestedRoute,
|
|
2113
|
+
modelOverride: input.modelOverrides[index],
|
|
2114
|
+
thinkingOverride: input.thinkingOverrideForTask(task.agent, index, input.modelOverrides[index]),
|
|
2115
|
+
availableModels: input.availableModels,
|
|
2116
|
+
preferredModelProvider: input.ctx.model?.provider,
|
|
2117
|
+
modelScope: input.modelScope,
|
|
2118
|
+
skills: effectiveSkills === false ? [] : effectiveSkills,
|
|
2119
|
+
acceptance: task.acceptance,
|
|
2120
|
+
acceptanceContext: { mode: "parallel" },
|
|
2121
|
+
timeoutMs: input.timeoutMs,
|
|
2122
|
+
deadlineAt: input.deadlineAt,
|
|
2123
|
+
turnBudget: input.turnBudget,
|
|
2124
|
+
toolBudget: input.toolBudgets[index],
|
|
2125
|
+
onUpdate: input.onUpdate
|
|
2126
|
+
? (progressUpdate) => {
|
|
2127
|
+
const stepResults = progressUpdate.details?.results || [];
|
|
2128
|
+
const stepProgress = progressUpdate.details?.progress || [];
|
|
2129
|
+
if (input.foregroundControl && stepProgress.length > 0) {
|
|
2130
|
+
const current = stepProgress[0];
|
|
2131
|
+
input.foregroundControl.currentAgent = task.agent;
|
|
2132
|
+
input.foregroundControl.currentIndex = index;
|
|
2133
|
+
input.foregroundControl.currentActivityState = current?.activityState;
|
|
2134
|
+
input.foregroundControl.lastActivityAt = current?.lastActivityAt;
|
|
2135
|
+
input.foregroundControl.currentTool = current?.currentTool;
|
|
2136
|
+
input.foregroundControl.currentToolStartedAt = current?.currentToolStartedAt;
|
|
2137
|
+
input.foregroundControl.currentPath = current?.currentPath;
|
|
2138
|
+
input.foregroundControl.turnCount = current?.turnCount;
|
|
2139
|
+
input.foregroundControl.tokens = current?.tokens;
|
|
2140
|
+
input.foregroundControl.toolCount = current?.toolCount;
|
|
2141
|
+
input.foregroundControl.updatedAt = Date.now();
|
|
2142
|
+
}
|
|
2143
|
+
if (stepResults.length > 0)
|
|
2144
|
+
input.liveResults[index] = stepResults[0];
|
|
2145
|
+
if (stepProgress.length > 0)
|
|
2146
|
+
input.liveProgress[index] = stepProgress[0];
|
|
2147
|
+
const mergedResults = input.liveResults.filter((result) => result !== undefined);
|
|
2148
|
+
const mergedProgress = input.liveProgress.filter((progress) => progress !== undefined);
|
|
2149
|
+
input.onUpdate?.({
|
|
2150
|
+
content: progressUpdate.content,
|
|
2151
|
+
details: {
|
|
2152
|
+
mode: "parallel",
|
|
2153
|
+
results: mergedResults,
|
|
2154
|
+
progress: mergedProgress,
|
|
2155
|
+
controlEvents: progressUpdate.details?.controlEvents,
|
|
2156
|
+
totalSteps: input.tasks.length,
|
|
2157
|
+
},
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
: undefined,
|
|
2161
|
+
}).finally(() => {
|
|
2162
|
+
if (input.foregroundControl?.currentIndex === index) {
|
|
2163
|
+
input.foregroundControl.interrupt = undefined;
|
|
2164
|
+
input.foregroundControl.updatedAt = Date.now();
|
|
2165
|
+
}
|
|
2166
|
+
});
|
|
2167
|
+
}, input.globalSemaphore);
|
|
2168
|
+
}
|
|
2169
|
+
async function runParallelPath(data, deps) {
|
|
2170
|
+
const { params, effectiveCwd, agents, ctx, signal, runId, sessionDirForIndex, sessionFileForIndex, sessionFileForTask, thinkingOverrideForTask, shareEnabled, artifactConfig, artifactsDir, backgroundRequestedWhileClarifying, onUpdate, sessionRoot, controlConfig, contextPolicy, } = data;
|
|
2171
|
+
const onControlEvent = createForegroundControlNotifier(data, deps);
|
|
2172
|
+
const childIntercomTarget = data.intercomBridge.active ? resolveSubagentIntercomTarget : undefined;
|
|
2173
|
+
const allProgress = [];
|
|
2174
|
+
const allArtifactPaths = [];
|
|
2175
|
+
const tasks = params.tasks;
|
|
2176
|
+
const maxParallelTasks = resolveTopLevelParallelMaxTasks(deps.config.parallel?.maxTasks);
|
|
2177
|
+
const parallelConcurrency = resolveTopLevelParallelConcurrency(params.concurrency, deps.config.parallel?.concurrency);
|
|
2178
|
+
if (tasks.length > maxParallelTasks)
|
|
2179
|
+
return {
|
|
2180
|
+
content: [{ type: "text", text: `Max ${maxParallelTasks} tasks` }],
|
|
2181
|
+
isError: true,
|
|
2182
|
+
details: { mode: "parallel", results: [] },
|
|
2183
|
+
};
|
|
2184
|
+
const agentConfigs = [];
|
|
2185
|
+
for (const t of tasks) {
|
|
2186
|
+
const config = agents.find((a) => a.name === t.agent);
|
|
2187
|
+
if (!config) {
|
|
2188
|
+
return {
|
|
2189
|
+
content: [{ type: "text", text: `Unknown agent: ${t.agent}` }],
|
|
2190
|
+
isError: true,
|
|
2191
|
+
details: { mode: "parallel", results: [] },
|
|
2192
|
+
};
|
|
2193
|
+
}
|
|
2194
|
+
agentConfigs.push(config);
|
|
2195
|
+
}
|
|
2196
|
+
const currentMaxSubagentDepth = resolveCurrentMaxSubagentDepth(deps.config.maxSubagentDepth);
|
|
2197
|
+
const maxSubagentDepths = agentConfigs.map((config) => resolveChildMaxSubagentDepth(currentMaxSubagentDepth, config.maxSubagentDepth));
|
|
2198
|
+
const toolBudgets = [];
|
|
2199
|
+
for (let index = 0; index < tasks.length; index++) {
|
|
2200
|
+
const resolved = resolveEffectiveToolBudget({ stepBudget: tasks[index]?.toolBudget, runBudget: data.toolBudget, agentBudget: agentConfigs[index]?.toolBudget, configBudget: data.configToolBudget });
|
|
2201
|
+
if (resolved.error)
|
|
2202
|
+
return buildParallelModeError(resolved.error);
|
|
2203
|
+
toolBudgets.push(resolved.toolBudget);
|
|
2204
|
+
}
|
|
2205
|
+
if (params.worktree) {
|
|
2206
|
+
const worktreeTaskCwdError = buildParallelWorktreeTaskCwdError(tasks, effectiveCwd);
|
|
2207
|
+
if (worktreeTaskCwdError)
|
|
2208
|
+
return buildParallelModeError(worktreeTaskCwdError);
|
|
2209
|
+
}
|
|
2210
|
+
const currentProvider = ctx.model?.provider;
|
|
2211
|
+
const availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
2212
|
+
let taskTexts = tasks.map((t) => t.task);
|
|
2213
|
+
const skillOverrides = tasks.map((t) => normalizeSkillInput(t.skill));
|
|
2214
|
+
const behaviorOverrides = tasks.map((task, index) => ({
|
|
2215
|
+
...(task.output !== undefined && task.output !== true ? { output: task.output } : {}),
|
|
2216
|
+
...(task.outputMode !== undefined ? { outputMode: task.outputMode } : {}),
|
|
2217
|
+
...(task.reads !== undefined && task.reads !== true ? { reads: task.reads } : {}),
|
|
2218
|
+
...(task.progress !== undefined ? { progress: task.progress } : {}),
|
|
2219
|
+
...(skillOverrides[index] !== undefined ? { skills: skillOverrides[index] } : {}),
|
|
2220
|
+
...(task.model !== undefined ? { model: task.model } : {}),
|
|
2221
|
+
}));
|
|
2222
|
+
const modelOverrides = tasks.map((task, i) =>
|
|
2223
|
+
// lunr: model tiers — explicit per-task model wins; otherwise resolve task.tier via the tier bridge.
|
|
2224
|
+
resolveEffectiveSubagentModel(behaviorOverrides[i]?.model ?? resolveTierModelOverride(task.tier), agentConfigs[i]?.model, ctx.model, availableModels, currentProvider, { scope: data.modelScope }));
|
|
2225
|
+
if (params.clarify === true && ctx.hasUI) {
|
|
2226
|
+
const behaviors = agentConfigs.map((c, i) => resolveStepBehavior(c, behaviorOverrides[i]));
|
|
2227
|
+
const availableSkills = discoverAvailableSkills(effectiveCwd);
|
|
2228
|
+
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%" } });
|
|
2229
|
+
if (!result || !result.confirmed) {
|
|
2230
|
+
return { content: [{ type: "text", text: "Cancelled" }], details: { mode: "parallel", results: [] } };
|
|
2231
|
+
}
|
|
2232
|
+
taskTexts = result.templates;
|
|
2233
|
+
for (let i = 0; i < result.behaviorOverrides.length; i++) {
|
|
2234
|
+
const override = result.behaviorOverrides[i];
|
|
2235
|
+
if (override?.model !== undefined) {
|
|
2236
|
+
modelOverrides[i] = resolveEffectiveSubagentModel(override.model, agentConfigs[i]?.model, ctx.model, availableModels, currentProvider, { scope: data.modelScope });
|
|
2237
|
+
behaviorOverrides[i].model = override.model;
|
|
2238
|
+
}
|
|
2239
|
+
if (override?.output !== undefined)
|
|
2240
|
+
behaviorOverrides[i].output = override.output;
|
|
2241
|
+
if (override?.reads !== undefined)
|
|
2242
|
+
behaviorOverrides[i].reads = override.reads;
|
|
2243
|
+
if (override?.progress !== undefined)
|
|
2244
|
+
behaviorOverrides[i].progress = override.progress;
|
|
2245
|
+
if (override?.skills !== undefined) {
|
|
2246
|
+
skillOverrides[i] = override.skills;
|
|
2247
|
+
behaviorOverrides[i].skills = override.skills;
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
if (result.runInBackground) {
|
|
2251
|
+
if (!isAsyncAvailable()) {
|
|
2252
|
+
return {
|
|
2253
|
+
content: [{ type: "text", text: "Background mode requires upstream jiti for TypeScript execution but it could not be found. Ensure the pi-subagents package dependencies are installed." }],
|
|
2254
|
+
isError: true,
|
|
2255
|
+
details: { mode: "parallel", results: [] },
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
const id = randomUUID();
|
|
2259
|
+
const asyncCtx = {
|
|
2260
|
+
pi: deps.pi,
|
|
2261
|
+
cwd: ctx.cwd,
|
|
2262
|
+
currentSessionId: deps.state.currentSessionId,
|
|
2263
|
+
parentSessionId: ctx.sessionManager.getSessionId() ?? undefined,
|
|
2264
|
+
currentModelProvider: ctx.model?.provider,
|
|
2265
|
+
currentModel: ctx.model,
|
|
2266
|
+
modelScope: data.modelScope,
|
|
2267
|
+
};
|
|
2268
|
+
const parallelTasks = tasks.map((t, i) => {
|
|
2269
|
+
const taskText = shouldForkAgent(contextPolicy, t.agent) ? wrapForkTask(taskTexts[i]) : taskTexts[i];
|
|
2270
|
+
const progress = taskDisallowsFileUpdates(taskText) ? false : behaviorOverrides[i]?.progress;
|
|
2271
|
+
return {
|
|
2272
|
+
agent: t.agent,
|
|
2273
|
+
task: taskText,
|
|
2274
|
+
cwd: t.cwd,
|
|
2275
|
+
...(behaviorOverrides[i]?.model !== undefined ? { model: behaviorOverrides[i].model } : {}),
|
|
2276
|
+
...(skillOverrides[i] !== undefined ? { skill: skillOverrides[i] } : {}),
|
|
2277
|
+
...(behaviorOverrides[i]?.output !== undefined ? { output: behaviorOverrides[i].output } : {}),
|
|
2278
|
+
...(behaviorOverrides[i]?.outputMode !== undefined ? { outputMode: behaviorOverrides[i].outputMode } : {}),
|
|
2279
|
+
...(behaviorOverrides[i]?.reads !== undefined ? { reads: behaviorOverrides[i].reads } : {}),
|
|
2280
|
+
...(progress !== undefined ? { progress } : {}),
|
|
2281
|
+
...(t.toolBudget !== undefined ? { toolBudget: t.toolBudget } : {}),
|
|
2282
|
+
...(t.acceptance !== undefined ? { acceptance: t.acceptance } : {}),
|
|
2283
|
+
};
|
|
2284
|
+
});
|
|
2285
|
+
return executeAsyncChain(id, {
|
|
2286
|
+
chain: [{ parallel: parallelTasks, concurrency: parallelConcurrency, worktree: params.worktree }],
|
|
2287
|
+
resultMode: "parallel",
|
|
2288
|
+
goal: taskTexts[0] ?? "",
|
|
2289
|
+
agents,
|
|
2290
|
+
ctx: asyncCtx,
|
|
2291
|
+
availableModels,
|
|
2292
|
+
cwd: effectiveCwd,
|
|
2293
|
+
maxOutput: params.maxOutput,
|
|
2294
|
+
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
2295
|
+
artifactConfig,
|
|
2296
|
+
shareEnabled,
|
|
2297
|
+
sessionRoot,
|
|
2298
|
+
chainSkills: [],
|
|
2299
|
+
sessionFilesByFlatIndex: tasks.map((task, index) => sessionFileForTask(task.agent, index, modelOverrides[index])),
|
|
2300
|
+
thinkingOverridesByFlatIndex: tasks.map((task, index) => thinkingOverrideForTask(task.agent, index, modelOverrides[index])),
|
|
2301
|
+
maxSubagentDepth: currentMaxSubagentDepth,
|
|
2302
|
+
waitToolEnabled: deps.waitToolEnabled,
|
|
2303
|
+
worktreeSetupHook: deps.config.worktreeSetupHook,
|
|
2304
|
+
worktreeSetupHookTimeoutMs: deps.config.worktreeSetupHookTimeoutMs,
|
|
2305
|
+
worktreeBaseDir: deps.config.worktreeBaseDir,
|
|
2306
|
+
controlConfig,
|
|
2307
|
+
controlIntercomTarget: data.intercomBridge.active ? data.intercomBridge.orchestratorTarget : undefined,
|
|
2308
|
+
childIntercomTarget: data.intercomBridge.active ? (agent, index) => resolveSubagentIntercomTarget(id, agent, index) : undefined,
|
|
2309
|
+
timeoutMs: data.timeoutMs,
|
|
2310
|
+
turnBudget: data.turnBudget,
|
|
2311
|
+
globalConcurrencyLimit: deps.config.globalConcurrencyLimit,
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
const behaviors = agentConfigs.map((config, index) => suppressProgressForReadOnlyTask(resolveStepBehavior(config, behaviorOverrides[index]), taskTexts[index]));
|
|
2316
|
+
const firstProgressIndex = behaviors.findIndex((behavior) => behavior.progress);
|
|
2317
|
+
const liveResults = new Array(tasks.length).fill(undefined);
|
|
2318
|
+
const liveProgress = new Array(tasks.length).fill(undefined);
|
|
2319
|
+
const foregroundControl = deps.state.foregroundControls.get(runId);
|
|
2320
|
+
const { setup: worktreeSetup, errorResult } = createParallelWorktreeSetup(params.worktree, effectiveCwd, runId, tasks, deps.config.worktreeSetupHook, deps.config.worktreeSetupHookTimeoutMs, deps.config.worktreeBaseDir);
|
|
2321
|
+
if (errorResult)
|
|
2322
|
+
return errorResult;
|
|
2323
|
+
try {
|
|
2324
|
+
const outputBaseDir = path.join(artifactsDir, "outputs", runId);
|
|
2325
|
+
const duplicateOutputError = findDuplicateParallelOutputPath({
|
|
2326
|
+
tasks,
|
|
2327
|
+
behaviors,
|
|
2328
|
+
paramsCwd: effectiveCwd,
|
|
2329
|
+
ctxCwd: ctx.cwd,
|
|
2330
|
+
outputBaseDir,
|
|
2331
|
+
worktreeSetup,
|
|
2332
|
+
});
|
|
2333
|
+
if (duplicateOutputError)
|
|
2334
|
+
return buildParallelModeError(duplicateOutputError);
|
|
2335
|
+
for (let index = 0; index < tasks.length; index++) {
|
|
2336
|
+
const taskCwd = resolveParallelTaskCwd(tasks[index], effectiveCwd, worktreeSetup, index);
|
|
2337
|
+
const outputPath = resolveSingleOutputPath(behaviors[index]?.output, ctx.cwd, taskCwd, outputBaseDir);
|
|
2338
|
+
const validationError = validateFileOnlyOutputMode(behaviors[index]?.outputMode, outputPath, `Parallel task ${index + 1} (${tasks[index].agent})`);
|
|
2339
|
+
if (validationError)
|
|
2340
|
+
return buildParallelModeError(validationError);
|
|
2341
|
+
}
|
|
2342
|
+
const parallelProgressPrecreated = firstProgressIndex !== -1;
|
|
2343
|
+
const parallelProgressDir = path.join(artifactsDir, "progress", runId);
|
|
2344
|
+
if (parallelProgressPrecreated)
|
|
2345
|
+
writeInitialProgressFile(parallelProgressDir);
|
|
2346
|
+
for (let i = 0; i < taskTexts.length; i++) {
|
|
2347
|
+
if (shouldForkAgent(contextPolicy, tasks[i].agent))
|
|
2348
|
+
taskTexts[i] = wrapForkTask(taskTexts[i]);
|
|
2349
|
+
}
|
|
2350
|
+
const deadlineAt = data.deadlineAt ?? (data.timeoutMs !== undefined ? Date.now() + data.timeoutMs : undefined);
|
|
2351
|
+
const results = await runForegroundParallelTasks({
|
|
2352
|
+
tasks,
|
|
2353
|
+
taskTexts,
|
|
2354
|
+
agents,
|
|
2355
|
+
ctx,
|
|
2356
|
+
state: deps.state,
|
|
2357
|
+
intercomEvents: deps.pi.events,
|
|
2358
|
+
parentSessionId: data.parentSessionId,
|
|
2359
|
+
signal,
|
|
2360
|
+
runId,
|
|
2361
|
+
sessionDirForIndex,
|
|
2362
|
+
sessionFileForIndex,
|
|
2363
|
+
sessionFileForTask,
|
|
2364
|
+
thinkingOverrideForTask,
|
|
2365
|
+
shareEnabled,
|
|
2366
|
+
artifactConfig,
|
|
2367
|
+
artifactsDir,
|
|
2368
|
+
outputBaseDir,
|
|
2369
|
+
maxOutput: params.maxOutput,
|
|
2370
|
+
paramsCwd: effectiveCwd,
|
|
2371
|
+
progressDir: parallelProgressDir,
|
|
2372
|
+
availableModels,
|
|
2373
|
+
modelScope: data.modelScope,
|
|
2374
|
+
modelOverrides,
|
|
2375
|
+
behaviors,
|
|
2376
|
+
firstProgressIndex: parallelProgressPrecreated ? -1 : firstProgressIndex,
|
|
2377
|
+
controlConfig,
|
|
2378
|
+
onControlEvent,
|
|
2379
|
+
childIntercomTarget: childIntercomTarget ? (agent, index) => childIntercomTarget(runId, agent, index) : undefined,
|
|
2380
|
+
orchestratorIntercomTarget: data.intercomBridge.active ? data.intercomBridge.orchestratorTarget : undefined,
|
|
2381
|
+
foregroundControl,
|
|
2382
|
+
concurrencyLimit: parallelConcurrency,
|
|
2383
|
+
globalSemaphore: new Semaphore(deps.config.globalConcurrencyLimit ?? DEFAULT_GLOBAL_CONCURRENCY_LIMIT),
|
|
2384
|
+
maxSubagentDepths,
|
|
2385
|
+
waitToolEnabled: deps.waitToolEnabled,
|
|
2386
|
+
liveResults,
|
|
2387
|
+
liveProgress,
|
|
2388
|
+
onUpdate,
|
|
2389
|
+
worktreeSetup,
|
|
2390
|
+
timeoutMs: data.timeoutMs,
|
|
2391
|
+
deadlineAt,
|
|
2392
|
+
turnBudget: data.turnBudget,
|
|
2393
|
+
toolBudgets,
|
|
2394
|
+
});
|
|
2395
|
+
for (let i = 0; i < results.length; i++) {
|
|
2396
|
+
const run = results[i];
|
|
2397
|
+
recordRun(run.agent, taskTexts[i], run.exitCode, run.progressSummary?.durationMs ?? 0);
|
|
2398
|
+
}
|
|
2399
|
+
for (const result of results) {
|
|
2400
|
+
if (result.progress)
|
|
2401
|
+
allProgress.push(result.progress);
|
|
2402
|
+
if (result.artifactPaths)
|
|
2403
|
+
allArtifactPaths.push(result.artifactPaths);
|
|
2404
|
+
}
|
|
2405
|
+
if (foregroundControl) {
|
|
2406
|
+
updateForegroundNestedProjection(foregroundControl);
|
|
2407
|
+
attachRootChildrenToSteps(runId, results, foregroundControl.nestedChildren);
|
|
2408
|
+
}
|
|
2409
|
+
const interrupted = results.find((result) => result.interrupted);
|
|
2410
|
+
const details = compactForegroundDetails({
|
|
2411
|
+
mode: "parallel",
|
|
2412
|
+
runId,
|
|
2413
|
+
results,
|
|
2414
|
+
progress: params.includeProgress ? allProgress : undefined,
|
|
2415
|
+
artifacts: allArtifactPaths.length ? { dir: artifactsDir, files: allArtifactPaths } : undefined,
|
|
2416
|
+
totalChildUsage: sumResultsUsage(results),
|
|
2417
|
+
totalCost: sumResultsCost(results),
|
|
2418
|
+
});
|
|
2419
|
+
rememberForegroundRun(deps.state, { runId, mode: "parallel", cwd: effectiveCwd, sessionId: data.parentSessionId, results: details.results });
|
|
2420
|
+
if (interrupted) {
|
|
2421
|
+
return {
|
|
2422
|
+
content: [{ type: "text", text: `Parallel run paused after interrupt (${interrupted.agent}). Waiting for explicit next action.` }],
|
|
2423
|
+
details,
|
|
2424
|
+
};
|
|
2425
|
+
}
|
|
2426
|
+
const detachedIndex = results.findIndex((result) => result.detached);
|
|
2427
|
+
const detached = detachedIndex >= 0 ? results[detachedIndex] : undefined;
|
|
2428
|
+
if (detached) {
|
|
2429
|
+
return {
|
|
2430
|
+
content: [{ type: "text", text: `Parallel run detached for intercom coordination (${detached.agent}). Reply to the supervisor request first, then wait with subagent_wait({ id: "${runId}" }). Use subagent({ action: "status", id: "${runId}" }) to recover the result; do not resume or launch a replacement while it remains detached.` }],
|
|
2431
|
+
details,
|
|
2432
|
+
};
|
|
2433
|
+
}
|
|
2434
|
+
if (foregroundControl)
|
|
2435
|
+
updateForegroundNestedProjection(foregroundControl);
|
|
2436
|
+
const intercomReceipt = await maybeBuildForegroundIntercomReceipt({
|
|
2437
|
+
pi: deps.pi,
|
|
2438
|
+
intercomBridge: data.intercomBridge,
|
|
2439
|
+
runId,
|
|
2440
|
+
mode: "parallel",
|
|
2441
|
+
details,
|
|
2442
|
+
...(foregroundControl?.nestedChildren?.length ? { nestedChildren: foregroundControl.nestedChildren } : {}),
|
|
2443
|
+
});
|
|
2444
|
+
if (intercomReceipt) {
|
|
2445
|
+
return {
|
|
2446
|
+
content: [{ type: "text", text: intercomReceipt.text }],
|
|
2447
|
+
details: intercomReceipt.details,
|
|
2448
|
+
};
|
|
2449
|
+
}
|
|
2450
|
+
const worktreeSuffix = buildParallelWorktreeSuffix(worktreeSetup, artifactsDir, tasks);
|
|
2451
|
+
const ok = results.filter((result) => result.exitCode === 0).length;
|
|
2452
|
+
const downgradeNote = backgroundRequestedWhileClarifying ? " (background requested, but clarify kept this run foreground)" : "";
|
|
2453
|
+
const aggregatedOutput = aggregateParallelOutputs(results.map((result) => ({
|
|
2454
|
+
agent: result.agent,
|
|
2455
|
+
output: result.truncation?.text || getSingleResultOutput(result),
|
|
2456
|
+
exitCode: result.exitCode,
|
|
2457
|
+
error: result.error,
|
|
2458
|
+
timedOut: result.timedOut,
|
|
2459
|
+
})), (i, agent) => `=== Task ${i + 1}: ${agent} ===`);
|
|
2460
|
+
const summary = `${ok}/${results.length} succeeded${downgradeNote}`;
|
|
2461
|
+
const fullContent = worktreeSuffix
|
|
2462
|
+
? `${summary}\n\n${aggregatedOutput}\n\n${worktreeSuffix}`
|
|
2463
|
+
: `${summary}\n\n${aggregatedOutput}`;
|
|
2464
|
+
return {
|
|
2465
|
+
content: [{ type: "text", text: fullContent }],
|
|
2466
|
+
details,
|
|
2467
|
+
};
|
|
2468
|
+
}
|
|
2469
|
+
finally {
|
|
2470
|
+
if (worktreeSetup)
|
|
2471
|
+
cleanupWorktrees(worktreeSetup);
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
async function runSinglePath(data, deps) {
|
|
2475
|
+
const { params, effectiveCwd, agents, ctx, signal, runId, sessionDirForIndex, sessionFileForTask, thinkingOverrideForTask, shareEnabled, artifactConfig, artifactsDir, onUpdate, sessionRoot, controlConfig, contextPolicy, } = data;
|
|
2476
|
+
const onControlEvent = createForegroundControlNotifier(data, deps);
|
|
2477
|
+
const childIntercomTarget = data.intercomBridge.active ? resolveSubagentIntercomTarget(runId, params.agent, 0) : undefined;
|
|
2478
|
+
const allProgress = [];
|
|
2479
|
+
const allArtifactPaths = [];
|
|
2480
|
+
const agentConfig = agents.find((a) => a.name === params.agent);
|
|
2481
|
+
if (!agentConfig) {
|
|
2482
|
+
return {
|
|
2483
|
+
content: [{ type: "text", text: `Unknown agent: ${params.agent}` }],
|
|
2484
|
+
isError: true,
|
|
2485
|
+
details: { mode: "single", results: [] },
|
|
2486
|
+
};
|
|
2487
|
+
}
|
|
2488
|
+
const effectiveToolBudget = resolveEffectiveToolBudget({ runBudget: data.toolBudget, agentBudget: agentConfig.toolBudget, configBudget: data.configToolBudget });
|
|
2489
|
+
if (effectiveToolBudget.error)
|
|
2490
|
+
return toExecutionErrorResult(params, new Error(effectiveToolBudget.error));
|
|
2491
|
+
const currentProvider = ctx.model?.provider;
|
|
2492
|
+
const availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
2493
|
+
let task = params.task ?? "";
|
|
2494
|
+
// lunr: model tiers — explicit model wins; otherwise resolve params.tier via the tier bridge.
|
|
2495
|
+
let modelOverride = resolveEffectiveSubagentModel(params.model ?? resolveTierModelOverride(params.tier), agentConfig.model, ctx.model, availableModels, currentProvider, { scope: data.modelScope });
|
|
2496
|
+
let skillOverride = normalizeSkillInput(params.skill);
|
|
2497
|
+
const rawOutput = params.output !== undefined ? params.output : agentConfig.output;
|
|
2498
|
+
let effectiveOutput = normalizeSingleOutputOverride(rawOutput, agentConfig.output);
|
|
2499
|
+
const effectiveOutputMode = params.outputMode ?? "inline";
|
|
2500
|
+
const currentMaxSubagentDepth = resolveCurrentMaxSubagentDepth(deps.config.maxSubagentDepth);
|
|
2501
|
+
const maxSubagentDepth = resolveChildMaxSubagentDepth(currentMaxSubagentDepth, agentConfig.maxSubagentDepth);
|
|
2502
|
+
if (params.clarify === true && ctx.hasUI) {
|
|
2503
|
+
const behavior = resolveStepBehavior(agentConfig, { output: effectiveOutput, skills: skillOverride });
|
|
2504
|
+
const availableSkills = discoverAvailableSkills(effectiveCwd);
|
|
2505
|
+
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%" } });
|
|
2506
|
+
if (!result || !result.confirmed) {
|
|
2507
|
+
return { content: [{ type: "text", text: "Cancelled" }], details: { mode: "single", results: [] } };
|
|
2508
|
+
}
|
|
2509
|
+
task = result.templates[0];
|
|
2510
|
+
const override = result.behaviorOverrides[0];
|
|
2511
|
+
if (override?.model !== undefined)
|
|
2512
|
+
modelOverride = resolveEffectiveSubagentModel(override.model, agentConfig.model, ctx.model, availableModels, currentProvider, { scope: data.modelScope });
|
|
2513
|
+
if (override?.output !== undefined)
|
|
2514
|
+
effectiveOutput = normalizeSingleOutputOverride(override.output, agentConfig.output);
|
|
2515
|
+
if (override?.skills !== undefined)
|
|
2516
|
+
skillOverride = override.skills;
|
|
2517
|
+
if (result.runInBackground) {
|
|
2518
|
+
if (!isAsyncAvailable()) {
|
|
2519
|
+
return {
|
|
2520
|
+
content: [{ type: "text", text: "Background mode requires upstream jiti for TypeScript execution but it could not be found. Ensure the pi-subagents package dependencies are installed." }],
|
|
2521
|
+
isError: true,
|
|
2522
|
+
details: { mode: "single", results: [] },
|
|
2523
|
+
};
|
|
2524
|
+
}
|
|
2525
|
+
const id = randomUUID();
|
|
2526
|
+
const asyncCtx = {
|
|
2527
|
+
pi: deps.pi,
|
|
2528
|
+
cwd: ctx.cwd,
|
|
2529
|
+
currentSessionId: deps.state.currentSessionId,
|
|
2530
|
+
parentSessionId: ctx.sessionManager.getSessionId() ?? undefined,
|
|
2531
|
+
currentModelProvider: ctx.model?.provider,
|
|
2532
|
+
currentModel: ctx.model,
|
|
2533
|
+
modelScope: data.modelScope,
|
|
2534
|
+
};
|
|
2535
|
+
return executeAsyncSingle(id, {
|
|
2536
|
+
agent: params.agent,
|
|
2537
|
+
task: shouldForkAgent(contextPolicy, params.agent) ? wrapForkTask(task) : task,
|
|
2538
|
+
goal: task,
|
|
2539
|
+
agentConfig,
|
|
2540
|
+
ctx: asyncCtx,
|
|
2541
|
+
availableModels,
|
|
2542
|
+
cwd: effectiveCwd,
|
|
2543
|
+
maxOutput: params.maxOutput,
|
|
2544
|
+
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
2545
|
+
artifactConfig,
|
|
2546
|
+
shareEnabled,
|
|
2547
|
+
sessionRoot,
|
|
2548
|
+
sessionFile: sessionFileForTask(params.agent, 0, modelOverride),
|
|
2549
|
+
skills: skillOverride === false ? [] : skillOverride,
|
|
2550
|
+
output: effectiveOutput,
|
|
2551
|
+
outputMode: effectiveOutputMode,
|
|
2552
|
+
outputBaseDir: resolveSingleRunOutputBaseDir(deps, artifactsDir, id),
|
|
2553
|
+
modelOverride,
|
|
2554
|
+
thinkingOverride: thinkingOverrideForTask(params.agent, 0, modelOverride),
|
|
2555
|
+
maxSubagentDepth,
|
|
2556
|
+
waitToolEnabled: deps.waitToolEnabled,
|
|
2557
|
+
worktreeSetupHook: deps.config.worktreeSetupHook,
|
|
2558
|
+
worktreeSetupHookTimeoutMs: deps.config.worktreeSetupHookTimeoutMs,
|
|
2559
|
+
worktreeBaseDir: deps.config.worktreeBaseDir,
|
|
2560
|
+
controlConfig,
|
|
2561
|
+
controlIntercomTarget: data.intercomBridge.active ? data.intercomBridge.orchestratorTarget : undefined,
|
|
2562
|
+
childIntercomTarget: data.intercomBridge.active ? (agent, index) => resolveSubagentIntercomTarget(id, agent, index) : undefined,
|
|
2563
|
+
timeoutMs: data.timeoutMs,
|
|
2564
|
+
turnBudget: data.turnBudget,
|
|
2565
|
+
toolBudget: effectiveToolBudget.toolBudget,
|
|
2566
|
+
});
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
if (shouldForkAgent(contextPolicy, params.agent)) {
|
|
2570
|
+
task = wrapForkTask(task);
|
|
2571
|
+
}
|
|
2572
|
+
const cleanTask = task;
|
|
2573
|
+
const outputPath = resolveSingleOutputPath(effectiveOutput, ctx.cwd, effectiveCwd, resolveSingleRunOutputBaseDir(deps, artifactsDir, runId));
|
|
2574
|
+
const validationError = validateFileOnlyOutputMode(effectiveOutputMode, outputPath, `Single run (${params.agent})`);
|
|
2575
|
+
if (validationError) {
|
|
2576
|
+
return { content: [{ type: "text", text: validationError }], isError: true, details: { mode: "single", results: [] } };
|
|
2577
|
+
}
|
|
2578
|
+
task = injectSingleOutputInstruction(task, outputPath, agentConfig);
|
|
2579
|
+
let effectiveSkills;
|
|
2580
|
+
if (skillOverride === false) {
|
|
2581
|
+
effectiveSkills = [];
|
|
2582
|
+
}
|
|
2583
|
+
else {
|
|
2584
|
+
effectiveSkills = skillOverride;
|
|
2585
|
+
}
|
|
2586
|
+
const interruptController = new AbortController();
|
|
2587
|
+
const foregroundControl = deps.state.foregroundControls.get(runId);
|
|
2588
|
+
if (foregroundControl) {
|
|
2589
|
+
foregroundControl.currentAgent = params.agent;
|
|
2590
|
+
foregroundControl.currentIndex = 0;
|
|
2591
|
+
foregroundControl.currentActivityState = undefined;
|
|
2592
|
+
foregroundControl.updatedAt = Date.now();
|
|
2593
|
+
foregroundControl.interrupt = () => {
|
|
2594
|
+
if (interruptController.signal.aborted)
|
|
2595
|
+
return false;
|
|
2596
|
+
interruptController.abort();
|
|
2597
|
+
foregroundControl.currentActivityState = undefined;
|
|
2598
|
+
foregroundControl.updatedAt = Date.now();
|
|
2599
|
+
return true;
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
const forwardSingleUpdate = onUpdate
|
|
2603
|
+
? (update) => {
|
|
2604
|
+
if (foregroundControl) {
|
|
2605
|
+
const firstProgress = update.details?.progress?.[0];
|
|
2606
|
+
foregroundControl.currentAgent = params.agent;
|
|
2607
|
+
foregroundControl.currentIndex = firstProgress?.index ?? 0;
|
|
2608
|
+
foregroundControl.currentActivityState = firstProgress?.activityState;
|
|
2609
|
+
foregroundControl.lastActivityAt = firstProgress?.lastActivityAt;
|
|
2610
|
+
foregroundControl.currentTool = firstProgress?.currentTool;
|
|
2611
|
+
foregroundControl.currentToolStartedAt = firstProgress?.currentToolStartedAt;
|
|
2612
|
+
foregroundControl.currentPath = firstProgress?.currentPath;
|
|
2613
|
+
foregroundControl.turnCount = firstProgress?.turnCount;
|
|
2614
|
+
foregroundControl.tokens = firstProgress?.tokens;
|
|
2615
|
+
foregroundControl.toolCount = firstProgress?.toolCount;
|
|
2616
|
+
foregroundControl.updatedAt = Date.now();
|
|
2617
|
+
}
|
|
2618
|
+
onUpdate(update);
|
|
2619
|
+
}
|
|
2620
|
+
: undefined;
|
|
2621
|
+
const deadlineAt = data.deadlineAt ?? (data.timeoutMs !== undefined ? Date.now() + data.timeoutMs : undefined);
|
|
2622
|
+
const r = await runSync(ctx.cwd, agents, params.agent, task, {
|
|
2623
|
+
parentSessionId: ctx.sessionManager.getSessionId() ?? undefined,
|
|
2624
|
+
cwd: effectiveCwd,
|
|
2625
|
+
signal,
|
|
2626
|
+
interruptSignal: interruptController.signal,
|
|
2627
|
+
allowIntercomDetach: agentConfig.systemPrompt?.includes(INTERCOM_BRIDGE_MARKER) === true,
|
|
2628
|
+
intercomEvents: deps.pi.events,
|
|
2629
|
+
runId,
|
|
2630
|
+
sessionDir: sessionDirForIndex(0),
|
|
2631
|
+
sessionFile: sessionFileForTask(params.agent, 0, modelOverride),
|
|
2632
|
+
share: shareEnabled,
|
|
2633
|
+
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
2634
|
+
artifactConfig,
|
|
2635
|
+
maxOutput: params.maxOutput,
|
|
2636
|
+
outputPath,
|
|
2637
|
+
outputMode: effectiveOutputMode,
|
|
2638
|
+
maxSubagentDepth,
|
|
2639
|
+
waitToolEnabled: deps.waitToolEnabled,
|
|
2640
|
+
onUpdate: forwardSingleUpdate,
|
|
2641
|
+
controlConfig,
|
|
2642
|
+
onControlEvent,
|
|
2643
|
+
intercomSessionName: childIntercomTarget,
|
|
2644
|
+
orchestratorIntercomTarget: data.intercomBridge.active ? data.intercomBridge.orchestratorTarget : undefined,
|
|
2645
|
+
nestedRoute: foregroundControl?.nestedRoute,
|
|
2646
|
+
index: 0,
|
|
2647
|
+
modelOverride,
|
|
2648
|
+
thinkingOverride: thinkingOverrideForTask(params.agent, 0, modelOverride),
|
|
2649
|
+
availableModels,
|
|
2650
|
+
preferredModelProvider: currentProvider,
|
|
2651
|
+
modelScope: data.modelScope,
|
|
2652
|
+
skills: effectiveSkills,
|
|
2653
|
+
acceptance: params.acceptance,
|
|
2654
|
+
acceptanceContext: { mode: "single" },
|
|
2655
|
+
onDetachedExit: (result) => updateRememberedForegroundChild(deps.state, { runId, mode: "single", cwd: effectiveCwd, sessionId: data.parentSessionId, index: 0, result, events: deps.pi.events }),
|
|
2656
|
+
timeoutMs: data.timeoutMs,
|
|
2657
|
+
deadlineAt,
|
|
2658
|
+
turnBudget: data.turnBudget,
|
|
2659
|
+
toolBudget: effectiveToolBudget.toolBudget,
|
|
2660
|
+
});
|
|
2661
|
+
if (foregroundControl?.currentIndex === 0) {
|
|
2662
|
+
foregroundControl.interrupt = undefined;
|
|
2663
|
+
foregroundControl.currentActivityState = r.progress?.activityState;
|
|
2664
|
+
foregroundControl.lastActivityAt = r.progress?.lastActivityAt;
|
|
2665
|
+
foregroundControl.currentTool = r.progress?.currentTool;
|
|
2666
|
+
foregroundControl.currentToolStartedAt = r.progress?.currentToolStartedAt;
|
|
2667
|
+
foregroundControl.currentPath = r.progress?.currentPath;
|
|
2668
|
+
foregroundControl.turnCount = r.progress?.turnCount;
|
|
2669
|
+
foregroundControl.tokens = r.progress?.tokens;
|
|
2670
|
+
foregroundControl.toolCount = r.progress?.toolCount;
|
|
2671
|
+
foregroundControl.updatedAt = Date.now();
|
|
2672
|
+
}
|
|
2673
|
+
recordRun(params.agent, cleanTask, r.exitCode, r.progressSummary?.durationMs ?? 0);
|
|
2674
|
+
if (r.progress)
|
|
2675
|
+
allProgress.push(r.progress);
|
|
2676
|
+
if (r.artifactPaths)
|
|
2677
|
+
allArtifactPaths.push(r.artifactPaths);
|
|
2678
|
+
const fullOutput = getSingleResultOutput(r);
|
|
2679
|
+
const finalizedOutput = finalizeSingleOutput({
|
|
2680
|
+
fullOutput,
|
|
2681
|
+
truncatedOutput: r.truncation?.text,
|
|
2682
|
+
outputPath,
|
|
2683
|
+
outputMode: r.outputMode,
|
|
2684
|
+
exitCode: r.exitCode,
|
|
2685
|
+
savedPath: r.savedOutputPath,
|
|
2686
|
+
outputReference: r.outputReference,
|
|
2687
|
+
saveError: r.outputSaveError,
|
|
2688
|
+
});
|
|
2689
|
+
if (foregroundControl) {
|
|
2690
|
+
updateForegroundNestedProjection(foregroundControl);
|
|
2691
|
+
attachRootChildrenToSteps(runId, [r], foregroundControl.nestedChildren);
|
|
2692
|
+
}
|
|
2693
|
+
const details = compactForegroundDetails({
|
|
2694
|
+
mode: "single",
|
|
2695
|
+
runId,
|
|
2696
|
+
results: [r],
|
|
2697
|
+
...(data.turnBudget ? { turnBudget: data.turnBudget } : {}),
|
|
2698
|
+
...(effectiveToolBudget.toolBudget ? { toolBudget: effectiveToolBudget.toolBudget } : {}),
|
|
2699
|
+
progress: params.includeProgress ? allProgress : undefined,
|
|
2700
|
+
artifacts: allArtifactPaths.length ? { dir: artifactsDir, files: allArtifactPaths } : undefined,
|
|
2701
|
+
truncation: r.truncation,
|
|
2702
|
+
totalChildUsage: sumResultsUsage([r]),
|
|
2703
|
+
totalCost: sumResultsCost([r]),
|
|
2704
|
+
});
|
|
2705
|
+
rememberForegroundRun(deps.state, { runId, mode: "single", cwd: effectiveCwd, sessionId: data.parentSessionId, results: details.results });
|
|
2706
|
+
if (!r.detached && !r.interrupted) {
|
|
2707
|
+
if (foregroundControl)
|
|
2708
|
+
updateForegroundNestedProjection(foregroundControl);
|
|
2709
|
+
const intercomReceipt = await maybeBuildForegroundIntercomReceipt({
|
|
2710
|
+
pi: deps.pi,
|
|
2711
|
+
intercomBridge: data.intercomBridge,
|
|
2712
|
+
runId,
|
|
2713
|
+
mode: "single",
|
|
2714
|
+
details,
|
|
2715
|
+
...(foregroundControl?.nestedChildren?.length ? { nestedChildren: foregroundControl.nestedChildren } : {}),
|
|
2716
|
+
});
|
|
2717
|
+
if (intercomReceipt) {
|
|
2718
|
+
return {
|
|
2719
|
+
content: [{ type: "text", text: intercomReceipt.text }],
|
|
2720
|
+
details: intercomReceipt.details,
|
|
2721
|
+
...(r.exitCode !== 0 ? { isError: true } : {}),
|
|
2722
|
+
};
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
if (r.detached) {
|
|
2726
|
+
return {
|
|
2727
|
+
content: [{ type: "text", text: `Detached for intercom coordination: ${params.agent}. Reply to the supervisor request first, then wait with subagent_wait({ id: "${runId}" }). Use subagent({ action: "status", id: "${runId}" }) to recover the result; do not resume or launch a replacement while it remains detached.` }],
|
|
2728
|
+
details,
|
|
2729
|
+
};
|
|
2730
|
+
}
|
|
2731
|
+
if (r.interrupted) {
|
|
2732
|
+
return {
|
|
2733
|
+
content: [{ type: "text", text: `Run paused after interrupt (${params.agent}). Waiting for explicit next action.` }],
|
|
2734
|
+
details,
|
|
2735
|
+
};
|
|
2736
|
+
}
|
|
2737
|
+
if (r.exitCode !== 0)
|
|
2738
|
+
return {
|
|
2739
|
+
content: [{ type: "text", text: formatFailedSingleRunOutput(r, finalizedOutput.displayOutput) }],
|
|
2740
|
+
details,
|
|
2741
|
+
isError: true,
|
|
2742
|
+
};
|
|
2743
|
+
return {
|
|
2744
|
+
content: [{ type: "text", text: finalizedOutput.displayOutput || "(no output)" }],
|
|
2745
|
+
details,
|
|
2746
|
+
};
|
|
2747
|
+
}
|
|
2748
|
+
function inferExecutionMode(params) {
|
|
2749
|
+
if ((params.chain?.length ?? 0) > 0)
|
|
2750
|
+
return "chain";
|
|
2751
|
+
if ((params.tasks?.length ?? 0) > 0)
|
|
2752
|
+
return "parallel";
|
|
2753
|
+
return "single";
|
|
2754
|
+
}
|
|
2755
|
+
function duplicateSubagentCallResult(params) {
|
|
2756
|
+
return {
|
|
2757
|
+
content: [{
|
|
2758
|
+
type: "text",
|
|
2759
|
+
// lunr: guide the model to the tasks array (parallel) or async:true.
|
|
2760
|
+
text: "A subagent call is already running in this turn. To run several subagents at once, use ONE subagent call with tasks: [{agent, task}, …] (parallel mode), or set async: true on each call.",
|
|
2761
|
+
}],
|
|
2762
|
+
isError: true,
|
|
2763
|
+
details: { mode: inferExecutionMode(params), results: [] },
|
|
2764
|
+
};
|
|
2765
|
+
}
|
|
2766
|
+
function omitExecutionModeActionAlias(params) {
|
|
2767
|
+
const action = params.action?.toLowerCase();
|
|
2768
|
+
if (action === "single" && (params.agent !== undefined || params.task !== undefined)) {
|
|
2769
|
+
const rest = { ...params };
|
|
2770
|
+
delete rest.action;
|
|
2771
|
+
return rest;
|
|
2772
|
+
}
|
|
2773
|
+
if ((action === "parallel" || action === "tasks") && (params.tasks?.length ?? 0) > 0) {
|
|
2774
|
+
const rest = { ...params };
|
|
2775
|
+
delete rest.action;
|
|
2776
|
+
return rest;
|
|
2777
|
+
}
|
|
2778
|
+
return params;
|
|
2779
|
+
}
|
|
2780
|
+
export function createSubagentExecutor(deps) {
|
|
2781
|
+
const execute = async (_id, params, signal, onUpdate, ctx) => {
|
|
2782
|
+
deps.state.baseCwd = ctx.cwd;
|
|
2783
|
+
deps.state.foregroundRuns ??= new Map();
|
|
2784
|
+
deps.state.foregroundControls ??= new Map();
|
|
2785
|
+
deps.state.lastForegroundControlId ??= null;
|
|
2786
|
+
const requestParams = omitExecutionModeActionAlias(params);
|
|
2787
|
+
const requestCwd = resolveRequestedCwd(ctx.cwd, requestParams.cwd);
|
|
2788
|
+
const paramsWithResolvedCwd = requestParams.cwd === undefined ? requestParams : { ...requestParams, cwd: requestCwd };
|
|
2789
|
+
const action = paramsWithResolvedCwd.action;
|
|
2790
|
+
if (action) {
|
|
2791
|
+
if (WATCHDOG_TOOL_ACTIONS.includes(action)) {
|
|
2792
|
+
if (deps.allowMutatingManagementActions === false && MUTATING_MANAGEMENT_ACTIONS.has(action)) {
|
|
2793
|
+
return {
|
|
2794
|
+
content: [{ type: "text", text: `Action '${action}' is not available from child-safe subagent fanout mode.` }],
|
|
2795
|
+
isError: true,
|
|
2796
|
+
details: { mode: "management", results: [] },
|
|
2797
|
+
};
|
|
2798
|
+
}
|
|
2799
|
+
return handleWatchdogToolAction(action, paramsWithResolvedCwd, ctx, deps.watchdog);
|
|
2800
|
+
}
|
|
2801
|
+
if (action === "doctor") {
|
|
2802
|
+
let currentSessionFile = null;
|
|
2803
|
+
let currentSessionId = deps.state.currentSessionId;
|
|
2804
|
+
let sessionError;
|
|
2805
|
+
try {
|
|
2806
|
+
currentSessionFile = ctx.sessionManager.getSessionFile() ?? null;
|
|
2807
|
+
currentSessionId = ctx.sessionManager.getSessionId();
|
|
2808
|
+
}
|
|
2809
|
+
catch (error) {
|
|
2810
|
+
sessionError = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
2811
|
+
}
|
|
2812
|
+
let orchestratorTarget;
|
|
2813
|
+
try {
|
|
2814
|
+
orchestratorTarget = resolveIntercomSessionTarget(deps.pi.getSessionName(), ctx.sessionManager.getSessionId());
|
|
2815
|
+
}
|
|
2816
|
+
catch (error) {
|
|
2817
|
+
if (!sessionError)
|
|
2818
|
+
sessionError = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
2819
|
+
}
|
|
2820
|
+
return {
|
|
2821
|
+
content: [{
|
|
2822
|
+
type: "text",
|
|
2823
|
+
text: buildDoctorReport({
|
|
2824
|
+
cwd: requestCwd,
|
|
2825
|
+
config: deps.config,
|
|
2826
|
+
state: deps.state,
|
|
2827
|
+
context: paramsWithResolvedCwd.context,
|
|
2828
|
+
requestedSessionDir: paramsWithResolvedCwd.sessionDir,
|
|
2829
|
+
currentSessionFile,
|
|
2830
|
+
currentSessionId,
|
|
2831
|
+
orchestratorTarget,
|
|
2832
|
+
sessionError,
|
|
2833
|
+
expandTilde: deps.expandTilde,
|
|
2834
|
+
}),
|
|
2835
|
+
}],
|
|
2836
|
+
details: { mode: "management", results: [] },
|
|
2837
|
+
};
|
|
2838
|
+
}
|
|
2839
|
+
if (action === "status") {
|
|
2840
|
+
deps.state.currentSessionId = resolveCurrentSessionId(ctx.sessionManager);
|
|
2841
|
+
const targetRunId = paramsWithResolvedCwd.id ?? paramsWithResolvedCwd.runId;
|
|
2842
|
+
const nestedScope = nestedResolutionScopeForExecutor(deps);
|
|
2843
|
+
const sessionRoots = trustedSessionRootsForStatus(ctx, deps);
|
|
2844
|
+
if (paramsWithResolvedCwd.view === "fleet") {
|
|
2845
|
+
return inspectSubagentStatus(paramsWithResolvedCwd, { state: deps.state, nested: nestedScope, sessionRoots });
|
|
2846
|
+
}
|
|
2847
|
+
if (targetRunId) {
|
|
2848
|
+
try {
|
|
2849
|
+
const resolved = resolveSubagentRunId(targetRunId, { state: deps.state, nested: nestedScope });
|
|
2850
|
+
if (resolved?.kind === "foreground") {
|
|
2851
|
+
const foreground = getForegroundControl(deps.state, resolved.id);
|
|
2852
|
+
if (foreground) {
|
|
2853
|
+
if (paramsWithResolvedCwd.view === "transcript") {
|
|
2854
|
+
return {
|
|
2855
|
+
content: [{ type: "text", text: "Live foreground transcript is already visible in the expanded running subagent result. Persisted session transcript becomes inspectable after the foreground run completes when sessions are enabled." }],
|
|
2856
|
+
details: { mode: "management", results: [] },
|
|
2857
|
+
};
|
|
2858
|
+
}
|
|
2859
|
+
return foregroundStatusResult(foreground);
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
catch (error) {
|
|
2864
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2865
|
+
return { content: [{ type: "text", text: message }], isError: true, details: { mode: "management", results: [] } };
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
else {
|
|
2869
|
+
const foreground = getForegroundControl(deps.state, undefined);
|
|
2870
|
+
if (foreground && paramsWithResolvedCwd.view !== "transcript")
|
|
2871
|
+
return foregroundStatusResult(foreground);
|
|
2872
|
+
if (foreground && paramsWithResolvedCwd.view === "transcript") {
|
|
2873
|
+
return {
|
|
2874
|
+
content: [{ type: "text", text: "Live foreground transcript is already visible in the expanded running subagent result. Pass an async run id to inspect a background transcript." }],
|
|
2875
|
+
details: { mode: "management", results: [] },
|
|
2876
|
+
};
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
return inspectSubagentStatus(paramsWithResolvedCwd, { state: deps.state, nested: nestedScope, sessionRoots });
|
|
2880
|
+
}
|
|
2881
|
+
if (action === "resume") {
|
|
2882
|
+
return resumeAsyncRun({ params: paramsWithResolvedCwd, requestCwd, ctx, deps });
|
|
2883
|
+
}
|
|
2884
|
+
if (action === "steer") {
|
|
2885
|
+
deps.state.currentSessionId = resolveCurrentSessionId(ctx.sessionManager);
|
|
2886
|
+
const message = (paramsWithResolvedCwd.message ?? paramsWithResolvedCwd.task ?? "").trim();
|
|
2887
|
+
if (!message)
|
|
2888
|
+
return { content: [{ type: "text", text: "action='steer' requires message." }], isError: true, details: { mode: "management", results: [] } };
|
|
2889
|
+
const targetRunId = paramsWithResolvedCwd.runId ?? paramsWithResolvedCwd.id;
|
|
2890
|
+
if (paramsWithResolvedCwd.dir) {
|
|
2891
|
+
try {
|
|
2892
|
+
const location = resolveAsyncRunLocation(paramsWithResolvedCwd, ASYNC_DIR, RESULTS_DIR);
|
|
2893
|
+
const runId = location.resolvedId ?? targetRunId ?? path.basename(location.asyncDir ?? paramsWithResolvedCwd.dir);
|
|
2894
|
+
return steerAsyncRun({ state: deps.state, runId, message, index: paramsWithResolvedCwd.index, kill: deps.kill, location, signal, recover: ({ absoluteDeadlineAt, ...limits }) => resumeAsyncRun({ params: { ...limits, action: "resume", id: runId, message }, requestCwd, ctx, deps, absoluteDeadlineAt }) });
|
|
2895
|
+
}
|
|
2896
|
+
catch (error) {
|
|
2897
|
+
const text = error instanceof Error ? error.message : String(error);
|
|
2898
|
+
return { content: [{ type: "text", text }], isError: true, details: { mode: "management", results: [] } };
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
if (!targetRunId)
|
|
2902
|
+
return { content: [{ type: "text", text: "action='steer' requires id or dir." }], isError: true, details: { mode: "management", results: [] } };
|
|
2903
|
+
let resolved;
|
|
2904
|
+
try {
|
|
2905
|
+
resolved = resolveSubagentRunId(targetRunId, { state: deps.state, nested: nestedResolutionScopeForExecutor(deps) });
|
|
2906
|
+
}
|
|
2907
|
+
catch (error) {
|
|
2908
|
+
const text = error instanceof Error ? error.message : String(error);
|
|
2909
|
+
return { content: [{ type: "text", text }], isError: true, details: { mode: "management", results: [] } };
|
|
2910
|
+
}
|
|
2911
|
+
if (resolved?.kind === "nested")
|
|
2912
|
+
return steerNestedRun({ target: resolved, message, index: paramsWithResolvedCwd.index, signal });
|
|
2913
|
+
if (resolved?.kind === "foreground")
|
|
2914
|
+
return { content: [{ type: "text", text: "action='steer' currently supports live async Pi child sessions only; use action='interrupt' or action='resume' for foreground runs." }], isError: true, details: { mode: "management", results: [] } };
|
|
2915
|
+
if (resolved?.kind !== "async")
|
|
2916
|
+
return { content: [{ type: "text", text: `No async run found for '${targetRunId}'.` }], isError: true, details: { mode: "management", results: [] } };
|
|
2917
|
+
return steerAsyncRun({ state: deps.state, runId: resolved.id, message, index: paramsWithResolvedCwd.index, kill: deps.kill, location: resolved.location, signal, recover: ({ absoluteDeadlineAt, ...limits }) => resumeAsyncRun({ params: { ...limits, action: "resume", id: resolved.id, message }, requestCwd, ctx, deps, absoluteDeadlineAt }) });
|
|
2918
|
+
}
|
|
2919
|
+
if (action === "append-step") {
|
|
2920
|
+
return appendStepToAsyncChain({ params: paramsWithResolvedCwd, requestCwd, ctx, deps });
|
|
2921
|
+
}
|
|
2922
|
+
if (action === "schedule" || action === "schedule-list" || action === "schedule-status" || action === "schedule-cancel") {
|
|
2923
|
+
if (!deps.handleScheduledRunAction) {
|
|
2924
|
+
return {
|
|
2925
|
+
content: [{ type: "text", text: `Action '${action}' is not available in this subagent context.` }],
|
|
2926
|
+
isError: true,
|
|
2927
|
+
details: { mode: "management", results: [] },
|
|
2928
|
+
};
|
|
2929
|
+
}
|
|
2930
|
+
return deps.handleScheduledRunAction(paramsWithResolvedCwd, ctx);
|
|
2931
|
+
}
|
|
2932
|
+
if (action === "stop") {
|
|
2933
|
+
const targetRunId = paramsWithResolvedCwd.runId ?? paramsWithResolvedCwd.id;
|
|
2934
|
+
let resolved;
|
|
2935
|
+
if (paramsWithResolvedCwd.dir) {
|
|
2936
|
+
try {
|
|
2937
|
+
const location = resolveAsyncRunLocation(paramsWithResolvedCwd, ASYNC_DIR, RESULTS_DIR);
|
|
2938
|
+
return stopAsyncRun(deps.state, location.resolvedId ?? targetRunId ?? path.basename(location.asyncDir ?? paramsWithResolvedCwd.dir), deps.kill, location);
|
|
2939
|
+
}
|
|
2940
|
+
catch (error) {
|
|
2941
|
+
const text = error instanceof Error ? error.message : String(error);
|
|
2942
|
+
return { content: [{ type: "text", text }], isError: true, details: { mode: "management", results: [] } };
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
if (!targetRunId)
|
|
2946
|
+
return { content: [{ type: "text", text: "action='stop' requires id or dir." }], isError: true, details: { mode: "management", results: [] } };
|
|
2947
|
+
try {
|
|
2948
|
+
resolved = resolveSubagentRunId(targetRunId, { state: deps.state, nested: nestedResolutionScopeForExecutor(deps) });
|
|
2949
|
+
}
|
|
2950
|
+
catch (error) {
|
|
2951
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2952
|
+
return { content: [{ type: "text", text: message }], isError: true, details: { mode: "management", results: [] } };
|
|
2953
|
+
}
|
|
2954
|
+
if (resolved?.kind === "nested")
|
|
2955
|
+
return { content: [{ type: "text", text: "action='stop' supports current-session top-level async runs only." }], isError: true, details: { mode: "management", results: [] } };
|
|
2956
|
+
if (resolved?.kind === "foreground")
|
|
2957
|
+
return { content: [{ type: "text", text: "action='stop' supports async runs only. Use action='interrupt' for foreground runs." }], isError: true, details: { mode: "management", results: [] } };
|
|
2958
|
+
const stopResult = stopAsyncRun(deps.state, resolved?.kind === "async" ? resolved.id : targetRunId, deps.kill, resolved?.kind === "async" ? resolved.location : undefined);
|
|
2959
|
+
if (stopResult)
|
|
2960
|
+
return stopResult;
|
|
2961
|
+
return {
|
|
2962
|
+
content: [{ type: "text", text: "No stoppable async run found in this session." }],
|
|
2963
|
+
isError: true,
|
|
2964
|
+
details: { mode: "management", results: [] },
|
|
2965
|
+
};
|
|
2966
|
+
}
|
|
2967
|
+
if (action === "interrupt") {
|
|
2968
|
+
const targetRunId = paramsWithResolvedCwd.runId ?? paramsWithResolvedCwd.id;
|
|
2969
|
+
let resolved;
|
|
2970
|
+
if (targetRunId) {
|
|
2971
|
+
try {
|
|
2972
|
+
resolved = resolveSubagentRunId(targetRunId, { state: deps.state, nested: nestedResolutionScopeForExecutor(deps) });
|
|
2973
|
+
}
|
|
2974
|
+
catch (error) {
|
|
2975
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2976
|
+
return { content: [{ type: "text", text: message }], isError: true, details: { mode: "management", results: [] } };
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
if (resolved?.kind === "nested")
|
|
2980
|
+
return interruptNestedRun(resolved);
|
|
2981
|
+
const foreground = getForegroundControl(deps.state, resolved?.kind === "foreground" ? resolved.id : targetRunId);
|
|
2982
|
+
if (foreground?.interrupt) {
|
|
2983
|
+
const interrupted = foreground.interrupt();
|
|
2984
|
+
if (interrupted) {
|
|
2985
|
+
foreground.updatedAt = Date.now();
|
|
2986
|
+
foreground.currentActivityState = undefined;
|
|
2987
|
+
return {
|
|
2988
|
+
content: [{ type: "text", text: `Interrupt requested for foreground run ${foreground.runId}.` }],
|
|
2989
|
+
details: { mode: "management", results: [] },
|
|
2990
|
+
};
|
|
2991
|
+
}
|
|
2992
|
+
return {
|
|
2993
|
+
content: [{ type: "text", text: `Foreground run ${foreground.runId} has no active child step to interrupt.` }],
|
|
2994
|
+
isError: true,
|
|
2995
|
+
details: { mode: "management", results: [] },
|
|
2996
|
+
};
|
|
2997
|
+
}
|
|
2998
|
+
const asyncInterruptResult = interruptAsyncRun(deps.state, resolved?.kind === "async" ? resolved.id : targetRunId, deps.kill, resolved?.kind === "async" ? resolved.location : undefined);
|
|
2999
|
+
if (asyncInterruptResult)
|
|
3000
|
+
return asyncInterruptResult;
|
|
3001
|
+
return {
|
|
3002
|
+
content: [{ type: "text", text: "No interrupt-capable run found in this session." }],
|
|
3003
|
+
isError: true,
|
|
3004
|
+
details: { mode: "management", results: [] },
|
|
3005
|
+
};
|
|
3006
|
+
}
|
|
3007
|
+
if (!SUBAGENT_ACTIONS.includes(action)) {
|
|
3008
|
+
return {
|
|
3009
|
+
content: [{ type: "text", text: `Unknown action: ${action}. Valid: ${SUBAGENT_ACTIONS.join(", ")}` }],
|
|
3010
|
+
isError: true,
|
|
3011
|
+
details: { mode: "management", results: [] },
|
|
3012
|
+
};
|
|
3013
|
+
}
|
|
3014
|
+
if (deps.allowMutatingManagementActions === false && MUTATING_MANAGEMENT_ACTIONS.has(action)) {
|
|
3015
|
+
return {
|
|
3016
|
+
content: [{ type: "text", text: `Action '${action}' is not available from child-safe subagent fanout mode.` }],
|
|
3017
|
+
isError: true,
|
|
3018
|
+
details: { mode: "management", results: [] },
|
|
3019
|
+
};
|
|
3020
|
+
}
|
|
3021
|
+
return handleManagementAction(action, paramsWithResolvedCwd, {
|
|
3022
|
+
...ctx,
|
|
3023
|
+
cwd: requestCwd,
|
|
3024
|
+
config: deps.config,
|
|
3025
|
+
});
|
|
3026
|
+
}
|
|
3027
|
+
const { blocked, depth, maxDepth } = checkSubagentDepth(deps.config.maxSubagentDepth);
|
|
3028
|
+
if (blocked) {
|
|
3029
|
+
return {
|
|
3030
|
+
content: [
|
|
3031
|
+
{
|
|
3032
|
+
type: "text",
|
|
3033
|
+
text: `Nested subagent call blocked (depth=${depth}, max=${maxDepth}). ` +
|
|
3034
|
+
"You are running at the maximum subagent nesting depth. " +
|
|
3035
|
+
"Complete your current task directly without delegating to further subagents.",
|
|
3036
|
+
},
|
|
3037
|
+
],
|
|
3038
|
+
isError: true,
|
|
3039
|
+
details: { mode: "single", results: [] },
|
|
3040
|
+
};
|
|
3041
|
+
}
|
|
3042
|
+
const normalized = normalizeRepeatedParallelCounts(paramsWithResolvedCwd);
|
|
3043
|
+
if (normalized.error)
|
|
3044
|
+
return normalized.error;
|
|
3045
|
+
const normalizedParams = normalized.params;
|
|
3046
|
+
let effectiveParams = applyForceTopLevelAsyncOverride(normalizedParams, depth, deps.config.forceTopLevelAsync === true);
|
|
3047
|
+
const runToolBudget = resolveToolBudget(effectiveParams.toolBudget, "toolBudget");
|
|
3048
|
+
if (runToolBudget.error)
|
|
3049
|
+
return buildRequestedModeError(effectiveParams, runToolBudget.error);
|
|
3050
|
+
const configToolBudget = resolveToolBudget(deps.config.toolBudget, "config.toolBudget");
|
|
3051
|
+
if (configToolBudget.error)
|
|
3052
|
+
return buildRequestedModeError(effectiveParams, configToolBudget.error);
|
|
3053
|
+
const scope = resolveExecutionAgentScope(effectiveParams.agentScope);
|
|
3054
|
+
const effectiveCwd = effectiveParams.cwd ?? ctx.cwd;
|
|
3055
|
+
const parentSessionFile = ctx.sessionManager.getSessionFile() ?? null;
|
|
3056
|
+
deps.state.currentSessionId = resolveCurrentSessionId(ctx.sessionManager);
|
|
3057
|
+
const discovered = deps.discoverAgents(effectiveCwd, scope);
|
|
3058
|
+
const discoveredAgents = discovered.agents;
|
|
3059
|
+
const modelScope = discovered.modelScope;
|
|
3060
|
+
effectiveParams = applySingleAgentLaunchDefaults(effectiveParams, discoveredAgents);
|
|
3061
|
+
const foregroundTimeout = resolveForegroundTimeout(effectiveParams);
|
|
3062
|
+
if (foregroundTimeout.error)
|
|
3063
|
+
return buildRequestedModeError(effectiveParams, foregroundTimeout.error);
|
|
3064
|
+
const turnBudget = resolveTurnBudgetConfig(effectiveParams.turnBudget ?? deps.config.turnBudget);
|
|
3065
|
+
if (turnBudget.error)
|
|
3066
|
+
return buildRequestedModeError(effectiveParams, turnBudget.error);
|
|
3067
|
+
const contextPolicy = resolveAgentDefaultContextPolicy(effectiveParams, discoveredAgents);
|
|
3068
|
+
effectiveParams = contextPolicy.params;
|
|
3069
|
+
const sessionName = resolveIntercomSessionTarget(deps.pi.getSessionName(), ctx.sessionManager.getSessionId());
|
|
3070
|
+
const intercomBridge = resolveIntercomBridge({
|
|
3071
|
+
config: deps.config.intercomBridge,
|
|
3072
|
+
context: effectiveParams.context,
|
|
3073
|
+
orchestratorTarget: sessionName,
|
|
3074
|
+
});
|
|
3075
|
+
const agents = intercomBridge.active
|
|
3076
|
+
? discoveredAgents.map((agent) => applyIntercomBridgeToAgent(agent, intercomBridge))
|
|
3077
|
+
: discoveredAgents;
|
|
3078
|
+
const runId = randomUUID().slice(0, 8);
|
|
3079
|
+
const inheritedNestedRoute = resolveInheritedNestedRouteFromEnv();
|
|
3080
|
+
const nestedParentAddress = inheritedNestedRoute ? resolveNestedParentAddressFromEnv() : undefined;
|
|
3081
|
+
const nestedRoute = inheritedNestedRoute ?? createNestedRoute(runId);
|
|
3082
|
+
const shareEnabled = effectiveParams.share === true;
|
|
3083
|
+
const hasChain = (effectiveParams.chain?.length ?? 0) > 0;
|
|
3084
|
+
const hasTasks = (effectiveParams.tasks?.length ?? 0) > 0;
|
|
3085
|
+
const hasSingle = !hasChain && !hasTasks && Boolean(effectiveParams.agent);
|
|
3086
|
+
const allowClarifyTaskPrompt = hasChain
|
|
3087
|
+
&& effectiveParams.clarify === true
|
|
3088
|
+
&& ctx.hasUI
|
|
3089
|
+
&& !(effectiveParams.chain?.some(isParallelStep) ?? false);
|
|
3090
|
+
const validationError = validateExecutionInput(effectiveParams, agents, hasChain, hasTasks, hasSingle, allowClarifyTaskPrompt);
|
|
3091
|
+
if (validationError)
|
|
3092
|
+
return validationError;
|
|
3093
|
+
let forkSessionFileForIndex = () => undefined;
|
|
3094
|
+
let forkThinkingOverrideForIndex = () => undefined;
|
|
3095
|
+
let prepareForkThinking = (_agentName, _index, _modelOverride) => { };
|
|
3096
|
+
const forkThinkingRequirements = new Map();
|
|
3097
|
+
const forkThinkingDowngrades = new Map();
|
|
3098
|
+
try {
|
|
3099
|
+
const forkAvailableModels = contextPolicy.usesFork ? ctx.modelRegistry.getAvailable().map(toModelInfo) : [];
|
|
3100
|
+
prepareForkThinking = (agentName, index, modelOverride) => {
|
|
3101
|
+
const agentConfig = agents.find((agent) => agent.name === agentName);
|
|
3102
|
+
const primaryModel = resolveEffectiveSubagentModel(modelOverride, agentConfig?.model, ctx.model, forkAvailableModels, ctx.model?.provider);
|
|
3103
|
+
const candidates = buildModelCandidates(primaryModel, agentConfig?.fallbackModels, forkAvailableModels, ctx.model?.provider);
|
|
3104
|
+
forkThinkingRequirements.set(index, candidates.length === 0
|
|
3105
|
+
|| candidates.some((candidate) => forkedChildRequiresThinkingOff(candidate, forkAvailableModels, ctx.model?.provider)));
|
|
3106
|
+
};
|
|
3107
|
+
const forkContextResolver = createForkContextResolver(ctx.sessionManager, contextPolicy.usesFork ? "fork" : undefined, {
|
|
3108
|
+
forceThinkingOffForIndex: (index) => forkThinkingRequirements.get(index) ?? true,
|
|
3109
|
+
});
|
|
3110
|
+
forkSessionFileForIndex = forkContextResolver.sessionFileForIndex;
|
|
3111
|
+
forkThinkingOverrideForIndex = forkContextResolver.thinkingOverrideForIndex;
|
|
3112
|
+
}
|
|
3113
|
+
catch (error) {
|
|
3114
|
+
return toExecutionErrorResult(effectiveParams, error);
|
|
3115
|
+
}
|
|
3116
|
+
const requestedAsync = effectiveParams.async ?? deps.asyncByDefault;
|
|
3117
|
+
const backgroundRequestedWhileClarifying = (hasChain || hasTasks) && requestedAsync && effectiveParams.clarify === true;
|
|
3118
|
+
const effectiveAsync = requestedAsync && effectiveParams.clarify !== true;
|
|
3119
|
+
const controlConfig = resolveControlConfig(deps.config.control, effectiveParams.control);
|
|
3120
|
+
const artifactConfig = {
|
|
3121
|
+
...DEFAULT_ARTIFACT_CONFIG,
|
|
3122
|
+
enabled: effectiveParams.artifacts !== false,
|
|
3123
|
+
};
|
|
3124
|
+
const artifactsDir = getArtifactsDir(parentSessionFile, effectiveCwd);
|
|
3125
|
+
let sessionRoot;
|
|
3126
|
+
if (effectiveParams.sessionDir) {
|
|
3127
|
+
sessionRoot = path.resolve(deps.expandTilde(effectiveParams.sessionDir));
|
|
3128
|
+
}
|
|
3129
|
+
else {
|
|
3130
|
+
const baseSessionRoot = deps.config.defaultSessionDir
|
|
3131
|
+
? path.resolve(deps.expandTilde(deps.config.defaultSessionDir))
|
|
3132
|
+
: deps.getSubagentSessionRoot(parentSessionFile);
|
|
3133
|
+
sessionRoot = path.join(baseSessionRoot, runId);
|
|
3134
|
+
}
|
|
3135
|
+
try {
|
|
3136
|
+
fs.mkdirSync(sessionRoot, { recursive: true });
|
|
3137
|
+
}
|
|
3138
|
+
catch (error) {
|
|
3139
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3140
|
+
return toExecutionErrorResult(effectiveParams, new Error(`Failed to create session directory '${sessionRoot}': ${message}`));
|
|
3141
|
+
}
|
|
3142
|
+
const sessionDirForIndex = (idx) => path.join(sessionRoot, `run-${idx ?? 0}`);
|
|
3143
|
+
const forkSessionFileForTask = (agentName, idx = 0, modelOverride) => {
|
|
3144
|
+
if (!shouldForkAgent(contextPolicy, agentName))
|
|
3145
|
+
return undefined;
|
|
3146
|
+
prepareForkThinking(agentName, idx, modelOverride);
|
|
3147
|
+
return forkSessionFileForIndex(idx);
|
|
3148
|
+
};
|
|
3149
|
+
const forkThinkingOverrideForTask = (agentName, idx = 0, modelOverride) => {
|
|
3150
|
+
if (!shouldForkAgent(contextPolicy, agentName))
|
|
3151
|
+
return undefined;
|
|
3152
|
+
prepareForkThinking(agentName, idx, modelOverride);
|
|
3153
|
+
const override = forkThinkingOverrideForIndex(idx);
|
|
3154
|
+
if (override === "off")
|
|
3155
|
+
forkThinkingDowngrades.set(idx, agentName);
|
|
3156
|
+
return override;
|
|
3157
|
+
};
|
|
3158
|
+
const childSessionFileForTask = (agentName, idx, modelOverride) => forkSessionFileForTask(agentName, idx, modelOverride) ?? path.join(sessionDirForIndex(idx), "session.jsonl");
|
|
3159
|
+
const childSessionFileForIndex = (idx) => path.join(sessionDirForIndex(idx), "session.jsonl");
|
|
3160
|
+
try {
|
|
3161
|
+
if (!(effectiveParams.clarify === true && ctx.hasUI)) {
|
|
3162
|
+
preflightForkSessionsForStaticTasks(effectiveParams, contextPolicy, forkSessionFileForTask, deps.config.chain?.dynamicFanout?.maxItems);
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
catch (error) {
|
|
3166
|
+
return toExecutionErrorResult(effectiveParams, error);
|
|
3167
|
+
}
|
|
3168
|
+
const chainBindingsError = validateExecutionChainBindings(effectiveParams, deps.config.chain?.dynamicFanout?.maxItems);
|
|
3169
|
+
if (chainBindingsError)
|
|
3170
|
+
return chainBindingsError;
|
|
3171
|
+
const onUpdateWithContext = onUpdate
|
|
3172
|
+
? (r) => onUpdate(withForkContext(r, effectiveParams.context))
|
|
3173
|
+
: undefined;
|
|
3174
|
+
const foregroundMode = hasChain ? "chain" : hasTasks ? "parallel" : "single";
|
|
3175
|
+
const spawnLimitError = reserveSubagentSpawns({
|
|
3176
|
+
state: deps.state,
|
|
3177
|
+
config: deps.config,
|
|
3178
|
+
sessionId: deps.state.currentSessionId,
|
|
3179
|
+
requested: countRequestedSubagentSpawns(effectiveParams, deps.config),
|
|
3180
|
+
mode: foregroundMode,
|
|
3181
|
+
});
|
|
3182
|
+
if (spawnLimitError)
|
|
3183
|
+
return spawnLimitError;
|
|
3184
|
+
const execData = {
|
|
3185
|
+
params: effectiveParams,
|
|
3186
|
+
effectiveCwd,
|
|
3187
|
+
ctx,
|
|
3188
|
+
signal,
|
|
3189
|
+
onUpdate: onUpdateWithContext,
|
|
3190
|
+
agents,
|
|
3191
|
+
runId,
|
|
3192
|
+
shareEnabled,
|
|
3193
|
+
sessionRoot,
|
|
3194
|
+
sessionDirForIndex,
|
|
3195
|
+
sessionFileForIndex: childSessionFileForIndex,
|
|
3196
|
+
sessionFileForTask: childSessionFileForTask,
|
|
3197
|
+
thinkingOverrideForTask: forkThinkingOverrideForTask,
|
|
3198
|
+
artifactConfig,
|
|
3199
|
+
artifactsDir,
|
|
3200
|
+
backgroundRequestedWhileClarifying,
|
|
3201
|
+
effectiveAsync,
|
|
3202
|
+
controlConfig,
|
|
3203
|
+
intercomBridge,
|
|
3204
|
+
nestedRoute,
|
|
3205
|
+
timeoutMs: foregroundTimeout.timeoutMs,
|
|
3206
|
+
turnBudget: turnBudget.turnBudget,
|
|
3207
|
+
toolBudget: runToolBudget.toolBudget,
|
|
3208
|
+
configToolBudget: configToolBudget.toolBudget,
|
|
3209
|
+
contextPolicy,
|
|
3210
|
+
modelScope,
|
|
3211
|
+
parentSessionId: deps.state.currentSessionId,
|
|
3212
|
+
};
|
|
3213
|
+
const foregroundControl = effectiveAsync
|
|
3214
|
+
? undefined
|
|
3215
|
+
: {
|
|
3216
|
+
runId,
|
|
3217
|
+
mode: foregroundMode,
|
|
3218
|
+
startedAt: Date.now(),
|
|
3219
|
+
updatedAt: Date.now(),
|
|
3220
|
+
currentAgent: undefined,
|
|
3221
|
+
currentIndex: undefined,
|
|
3222
|
+
currentActivityState: undefined,
|
|
3223
|
+
nestedRoute,
|
|
3224
|
+
interrupt: undefined,
|
|
3225
|
+
};
|
|
3226
|
+
if (foregroundControl) {
|
|
3227
|
+
deps.state.foregroundControls.set(runId, foregroundControl);
|
|
3228
|
+
deps.state.lastForegroundControlId = runId;
|
|
3229
|
+
}
|
|
3230
|
+
const writeNestedForegroundEvent = (type, result) => {
|
|
3231
|
+
if (!inheritedNestedRoute || !nestedParentAddress)
|
|
3232
|
+
return;
|
|
3233
|
+
const now = Date.now();
|
|
3234
|
+
const details = result?.details;
|
|
3235
|
+
const state = type === "subagent.nested.started"
|
|
3236
|
+
? "running"
|
|
3237
|
+
: details?.results.some((child) => child.interrupted || child.detached)
|
|
3238
|
+
? "paused"
|
|
3239
|
+
: result?.isError || details?.results.some((child) => child.exitCode !== 0)
|
|
3240
|
+
? "failed"
|
|
3241
|
+
: "complete";
|
|
3242
|
+
const errorText = result?.isError
|
|
3243
|
+
? result.content.find((item) => item.type === "text")?.text
|
|
3244
|
+
: undefined;
|
|
3245
|
+
const agentsForSummary = hasTasks && effectiveParams.tasks
|
|
3246
|
+
? effectiveParams.tasks.map((task) => task.agent)
|
|
3247
|
+
: hasChain && effectiveParams.chain
|
|
3248
|
+
? effectiveParams.chain.flatMap((step) => isParallelStep(step) ? step.parallel.map((task) => task.agent) : [step.agent])
|
|
3249
|
+
: effectiveParams.agent ? [effectiveParams.agent] : [];
|
|
3250
|
+
const leafIntercomTarget = intercomBridge.active && agentsForSummary[0]
|
|
3251
|
+
? resolveSubagentIntercomTarget(runId, agentsForSummary[0], 0)
|
|
3252
|
+
: undefined;
|
|
3253
|
+
try {
|
|
3254
|
+
writeNestedEvent(inheritedNestedRoute, {
|
|
3255
|
+
type,
|
|
3256
|
+
ts: now,
|
|
3257
|
+
parentRunId: nestedParentAddress.parentRunId,
|
|
3258
|
+
parentStepIndex: nestedParentAddress.parentStepIndex,
|
|
3259
|
+
child: {
|
|
3260
|
+
id: runId,
|
|
3261
|
+
parentRunId: nestedParentAddress.parentRunId,
|
|
3262
|
+
parentStepIndex: nestedParentAddress.parentStepIndex,
|
|
3263
|
+
depth: nestedParentAddress.depth,
|
|
3264
|
+
path: nestedParentAddress.path,
|
|
3265
|
+
ownerIntercomTarget: process.env.PI_SUBAGENT_INTERCOM_SESSION_NAME,
|
|
3266
|
+
leafIntercomTarget,
|
|
3267
|
+
intercomTarget: leafIntercomTarget,
|
|
3268
|
+
ownerState: state === "running" ? "live" : "gone",
|
|
3269
|
+
mode: foregroundMode,
|
|
3270
|
+
state,
|
|
3271
|
+
agent: agentsForSummary[0],
|
|
3272
|
+
agents: agentsForSummary,
|
|
3273
|
+
startedAt: foregroundControl?.startedAt ?? now,
|
|
3274
|
+
...(state !== "running" ? { endedAt: now } : {}),
|
|
3275
|
+
lastUpdate: now,
|
|
3276
|
+
...(details?.totalCost ? { totalCost: details.totalCost } : {}),
|
|
3277
|
+
...(errorText ? { error: errorText } : {}),
|
|
3278
|
+
...(details?.results.length ? { steps: details.results.map((child) => ({
|
|
3279
|
+
agent: child.agent,
|
|
3280
|
+
status: child.interrupted || child.detached ? "paused" : child.exitCode === 0 ? "complete" : "failed",
|
|
3281
|
+
...(child.sessionFile ? { sessionFile: child.sessionFile } : {}),
|
|
3282
|
+
...(child.error ? { error: child.error } : {}),
|
|
3283
|
+
})) } : {}),
|
|
3284
|
+
},
|
|
3285
|
+
});
|
|
3286
|
+
}
|
|
3287
|
+
catch (error) {
|
|
3288
|
+
console.error("Failed to emit nested foreground status event:", error);
|
|
3289
|
+
}
|
|
3290
|
+
};
|
|
3291
|
+
let nestedForegroundStarted = false;
|
|
3292
|
+
try {
|
|
3293
|
+
const asyncResult = runAsyncPath(execData, deps);
|
|
3294
|
+
if (asyncResult)
|
|
3295
|
+
return withForkContext(withForkThinkingNotes(asyncResult, forkThinkingDowngrades), effectiveParams.context);
|
|
3296
|
+
if (foregroundControl) {
|
|
3297
|
+
writeNestedForegroundEvent("subagent.nested.started");
|
|
3298
|
+
nestedForegroundStarted = true;
|
|
3299
|
+
}
|
|
3300
|
+
if (hasChain && effectiveParams.chain) {
|
|
3301
|
+
const result = await runChainPath(execData, deps);
|
|
3302
|
+
writeNestedForegroundEvent("subagent.nested.completed", result);
|
|
3303
|
+
return withForkContext(withForkThinkingNotes(result, forkThinkingDowngrades), effectiveParams.context);
|
|
3304
|
+
}
|
|
3305
|
+
if (hasTasks && effectiveParams.tasks) {
|
|
3306
|
+
const result = await runParallelPath(execData, deps);
|
|
3307
|
+
writeNestedForegroundEvent("subagent.nested.completed", result);
|
|
3308
|
+
return withForkContext(withForkThinkingNotes(result, forkThinkingDowngrades), effectiveParams.context);
|
|
3309
|
+
}
|
|
3310
|
+
if (hasSingle) {
|
|
3311
|
+
const result = await runSinglePath(execData, deps);
|
|
3312
|
+
writeNestedForegroundEvent("subagent.nested.completed", result);
|
|
3313
|
+
return withForkContext(withForkThinkingNotes(result, forkThinkingDowngrades), effectiveParams.context);
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
catch (error) {
|
|
3317
|
+
const errorResult = withForkThinkingNotes(toExecutionErrorResult(effectiveParams, error), forkThinkingDowngrades);
|
|
3318
|
+
if (nestedForegroundStarted)
|
|
3319
|
+
writeNestedForegroundEvent("subagent.nested.completed", errorResult);
|
|
3320
|
+
return errorResult;
|
|
3321
|
+
}
|
|
3322
|
+
finally {
|
|
3323
|
+
if (foregroundControl) {
|
|
3324
|
+
clearPendingForegroundControlNotices(deps.state, runId);
|
|
3325
|
+
deps.state.foregroundControls.delete(runId);
|
|
3326
|
+
if (deps.state.lastForegroundControlId === runId) {
|
|
3327
|
+
deps.state.lastForegroundControlId = null;
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
return withForkContext({
|
|
3332
|
+
content: [{ type: "text", text: "Invalid params" }],
|
|
3333
|
+
isError: true,
|
|
3334
|
+
details: { mode: "single", results: [] },
|
|
3335
|
+
}, effectiveParams.context);
|
|
3336
|
+
};
|
|
3337
|
+
const executeWithSingleDispatchGuard = async (id, params, signal, onUpdate, ctx) => {
|
|
3338
|
+
const requestParams = omitExecutionModeActionAlias(params);
|
|
3339
|
+
if (requestParams.action)
|
|
3340
|
+
return execute(id, requestParams, signal, onUpdate, ctx);
|
|
3341
|
+
const { depth } = checkSubagentDepth(deps.config.maxSubagentDepth);
|
|
3342
|
+
const dispatchParams = applyForceTopLevelAsyncOverride(requestParams, depth, deps.config.forceTopLevelAsync === true);
|
|
3343
|
+
const runsForeground = dispatchParams.clarify === true || (dispatchParams.async ?? deps.asyncByDefault) !== true;
|
|
3344
|
+
if (!runsForeground)
|
|
3345
|
+
return execute(id, requestParams, signal, onUpdate, ctx);
|
|
3346
|
+
if (deps.state.subagentInProgress === true)
|
|
3347
|
+
return duplicateSubagentCallResult(requestParams);
|
|
3348
|
+
deps.state.subagentInProgress = true;
|
|
3349
|
+
try {
|
|
3350
|
+
return await execute(id, requestParams, signal, onUpdate, ctx);
|
|
3351
|
+
}
|
|
3352
|
+
finally {
|
|
3353
|
+
deps.state.subagentInProgress = false;
|
|
3354
|
+
}
|
|
3355
|
+
};
|
|
3356
|
+
return { execute: executeWithSingleDispatchGuard };
|
|
3357
|
+
}
|
|
3358
|
+
//# sourceMappingURL=subagent-executor.js.map
|