@ashx-j/lunr-dev 0.2.16-dev.9.1 → 0.2.21-dev.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -1
- package/README.md +7 -1
- package/dist/builtin-extensions/ashxj-thinking.d.ts +1 -0
- package/dist/builtin-extensions/ashxj-thinking.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-thinking.js +44 -19
- package/dist/builtin-extensions/ashxj-thinking.js.map +1 -1
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +1 -2
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/lunr-computer-use.d.ts +3 -0
- package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-computer-use.js +158 -0
- package/dist/builtin-extensions/lunr-computer-use.js.map +1 -0
- package/dist/builtin-extensions/lunr-todos.d.ts +6 -5
- package/dist/builtin-extensions/lunr-todos.d.ts.map +1 -1
- package/dist/builtin-extensions/lunr-todos.js +9 -7
- package/dist/builtin-extensions/lunr-todos.js.map +1 -1
- package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts +6 -4
- package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-intercom/broker/spawn.js +114 -61
- package/dist/builtin-extensions/pi-intercom/broker/spawn.js.map +1 -1
- package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-intercom/index.js +360 -351
- package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js +10 -3
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +5 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +26 -4
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.js +37 -27
- package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts +6 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +33 -8
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js +2 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +8 -6
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +179 -79
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts +18 -8
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +44 -15
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +4 -3
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +24 -14
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts +8 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +247 -18
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts +29 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js +179 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts +89 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js +541 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +11 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +38 -12
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js +3 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js +35 -8
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts +7 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js +26 -4
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js +55 -38
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts +100 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +46 -31
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts +3 -6
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js +64 -5
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.d.ts +15 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js +14 -4
- package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +7 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +21 -8
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts +10 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js +38 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts +0 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +74 -41
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js +75 -18
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts +13 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js +67 -11
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +3 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +7 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +13 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js +5 -10
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js +3 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts +3 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +68 -11
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts +12 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js +21 -2
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +21 -4
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts +7 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +11 -7
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +6 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +46 -29
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +47 -4
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +428 -431
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts +2 -13
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js +5 -91
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.js +103 -102
- package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/computer-use/adapter.d.ts +23 -0
- package/dist/core/computer-use/adapter.d.ts.map +1 -0
- package/dist/core/computer-use/adapter.js +116 -0
- package/dist/core/computer-use/adapter.js.map +1 -0
- package/dist/core/computer-use/image.d.ts +26 -0
- package/dist/core/computer-use/image.d.ts.map +1 -0
- package/dist/core/computer-use/image.js +64 -0
- package/dist/core/computer-use/image.js.map +1 -0
- package/dist/core/computer-use/lease.d.ts +18 -0
- package/dist/core/computer-use/lease.d.ts.map +1 -0
- package/dist/core/computer-use/lease.js +129 -0
- package/dist/core/computer-use/lease.js.map +1 -0
- package/dist/core/computer-use/macos-runtime.d.ts +14 -0
- package/dist/core/computer-use/macos-runtime.d.ts.map +1 -0
- package/dist/core/computer-use/macos-runtime.js +148 -0
- package/dist/core/computer-use/macos-runtime.js.map +1 -0
- package/dist/core/computer-use/policy.d.ts +19 -0
- package/dist/core/computer-use/policy.d.ts.map +1 -0
- package/dist/core/computer-use/policy.js +62 -0
- package/dist/core/computer-use/policy.js.map +1 -0
- package/dist/core/computer-use/release.generated.d.ts +31 -0
- package/dist/core/computer-use/release.generated.d.ts.map +1 -0
- package/dist/core/computer-use/release.generated.js +36 -0
- package/dist/core/computer-use/release.generated.js.map +1 -0
- package/dist/core/computer-use/runtime.d.ts +13 -0
- package/dist/core/computer-use/runtime.d.ts.map +1 -0
- package/dist/core/computer-use/runtime.js +158 -0
- package/dist/core/computer-use/runtime.js.map +1 -0
- package/dist/core/computer-use/schemas.d.ts +91 -0
- package/dist/core/computer-use/schemas.d.ts.map +1 -0
- package/dist/core/computer-use/schemas.js +71 -0
- package/dist/core/computer-use/schemas.js.map +1 -0
- package/dist/core/computer-use/windows-desktop.d.ts +3 -0
- package/dist/core/computer-use/windows-desktop.d.ts.map +1 -0
- package/dist/core/computer-use/windows-desktop.js +48 -0
- package/dist/core/computer-use/windows-desktop.js.map +1 -0
- package/dist/core/computer-use/workflow.d.ts +32 -0
- package/dist/core/computer-use/workflow.d.ts.map +1 -0
- package/dist/core/computer-use/workflow.js +341 -0
- package/dist/core/computer-use/workflow.js.map +1 -0
- package/dist/core/customize.d.ts +2 -0
- package/dist/core/customize.d.ts.map +1 -1
- package/dist/core/customize.js +3 -0
- package/dist/core/customize.js.map +1 -1
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +2 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-runtime.d.ts +0 -3
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +1 -10
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +1 -1
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/permissions.d.ts +2 -1
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +31 -11
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +9 -5
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/rollback.d.ts.map +1 -1
- package/dist/core/rollback.js +13 -90
- package/dist/core/rollback.js.map +1 -1
- package/dist/core/runtime-bridges.d.ts.map +1 -1
- package/dist/core/runtime-bridges.js +0 -2
- package/dist/core/runtime-bridges.js.map +1 -1
- package/dist/core/session-manager.d.ts +0 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +21 -79
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +10 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +30 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/subagent-cancellation.d.ts +21 -0
- package/dist/core/subagent-cancellation.d.ts.map +1 -0
- package/dist/core/subagent-cancellation.js +53 -0
- package/dist/core/subagent-cancellation.js.map +1 -0
- package/dist/core/subagent-spinner-setting.d.ts +6 -0
- package/dist/core/subagent-spinner-setting.d.ts.map +1 -0
- package/dist/core/subagent-spinner-setting.js +12 -0
- package/dist/core/subagent-spinner-setting.js.map +1 -0
- package/dist/core/subagent-spinner.d.ts +4 -0
- package/dist/core/subagent-spinner.d.ts.map +1 -0
- package/dist/core/subagent-spinner.js +6 -0
- package/dist/core/subagent-spinner.js.map +1 -0
- package/dist/dev-cli.js +0 -0
- package/dist/gateway/agent-bridge.d.ts +6 -1
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +23 -6
- package/dist/gateway/agent-bridge.js.map +1 -1
- package/dist/gateway/cron.d.ts +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +23 -7
- package/dist/gateway/cron.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +12 -18
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +4 -2
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +23 -32
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/processes-selector.d.ts +2 -3
- package/dist/modes/interactive/components/processes-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/processes-selector.js +5 -10
- package/dist/modes/interactive/components/processes-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +8 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +93 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +12 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/extension-widget-order.d.ts +8 -0
- package/dist/modes/interactive/extension-widget-order.d.ts.map +1 -0
- package/dist/modes/interactive/extension-widget-order.js +37 -0
- package/dist/modes/interactive/extension-widget-order.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +58 -26
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/thinking-level-slash.d.ts +4 -0
- package/dist/modes/interactive/thinking-level-slash.d.ts.map +1 -0
- package/dist/modes/interactive/thinking-level-slash.js +23 -0
- package/dist/modes/interactive/thinking-level-slash.js.map +1 -0
- package/dist/node-runtime/adapter-AZMY335J.js +279 -0
- package/dist/node-runtime/{agent-session-services-IFJMSX7Z.js → agent-session-services-QANFGM2V.js} +15 -11
- package/dist/node-runtime/{builtin-extensions-LYZ3BFWQ.js → builtin-extensions-SRCYQPZ6.js} +5 -3
- package/dist/node-runtime/chunk-2IDTZAG5.js +1415 -0
- package/dist/node-runtime/chunk-3ONQTOMR.js +68 -0
- package/dist/node-runtime/{chunk-TQNSPERU.js → chunk-5SQDLSZJ.js} +1 -1
- package/dist/node-runtime/chunk-5ZH3ZFIZ.js +308 -0
- package/dist/node-runtime/{chunk-PBC2Y6GS.js → chunk-6UB6NKA3.js} +29 -72
- package/dist/node-runtime/{chunk-A2KQXUJD.js → chunk-7AFOFSDY.js} +1 -1
- package/dist/node-runtime/chunk-A3KMVBZV.js +60 -0
- package/dist/node-runtime/{chunk-N77MY65L.js → chunk-BJ6H7DPI.js} +25 -25
- package/dist/node-runtime/{chunk-PGAJ5MO5.js → chunk-BYQ2MOFI.js} +6 -6
- package/dist/node-runtime/{chunk-QH42CDX3.js → chunk-CZUBYPFP.js} +234 -124
- package/dist/node-runtime/{chunk-LZAW4ZX3.js → chunk-D466UAID.js} +34 -13
- package/dist/node-runtime/{chunk-ZKMFUD3Q.js → chunk-GT5F3OKM.js} +3 -3
- package/dist/node-runtime/chunk-H2BI7G7T.js +73 -0
- package/dist/node-runtime/{chunk-5P7PZMRU.js → chunk-HRS4HMDX.js} +1 -1
- package/dist/node-runtime/{chunk-IPA627GP.js → chunk-HXJS2PJM.js} +4 -4
- package/dist/node-runtime/chunk-JZHEUQRL.js +180 -0
- package/dist/node-runtime/chunk-LISUTZS3.js +19 -0
- package/dist/node-runtime/chunk-LOYUC2ID.js +2185 -0
- package/dist/node-runtime/{chunk-2QKLKMKC.js → chunk-LTXUQJI4.js} +1 -1
- package/dist/node-runtime/{chunk-YF63P5ZT.js → chunk-LTYWTR3V.js} +1 -426
- package/dist/node-runtime/{chunk-MKKH27PH.js → chunk-LWJXTA6Z.js} +274 -2416
- package/dist/node-runtime/chunk-MW2XJZIK.js +108 -0
- package/dist/node-runtime/{chunk-CDFZEWPU.js → chunk-N3PNL74S.js} +537 -262
- package/dist/node-runtime/{chunk-4TLO4PO2.js → chunk-U6C7VTR5.js} +7 -1401
- package/dist/node-runtime/chunk-URD2SLIT.js +1019 -0
- package/dist/node-runtime/{chunk-HQCKFM2O.js → chunk-VGYZ3APQ.js} +3 -0
- package/dist/node-runtime/{chunk-AJX357CL.js → chunk-VQ4UBWSA.js} +30 -1013
- package/dist/node-runtime/{chunk-F4VQFJI2.js → chunk-VTGEKB7R.js} +2 -2
- package/dist/node-runtime/{chunk-AD6VXAO7.js → chunk-VTPM5V35.js} +5 -100
- package/dist/node-runtime/chunk-W3SILANP.js +24 -0
- package/dist/node-runtime/{chunk-WOVTOV5P.js → chunk-XAUQOKYK.js} +421 -63
- package/dist/node-runtime/{chunk-ECD5L7YI.js → chunk-XSRCAQK2.js} +390 -16
- package/dist/node-runtime/{chunk-PCGNAY2O.js → chunk-ZOIIMEN6.js} +54 -433
- package/dist/node-runtime/{chunk-EDBJNRSM.js → chunk-ZVSORYRM.js} +1 -1
- package/dist/node-runtime/cli-runtime.js +1 -1
- package/dist/node-runtime/{command-L3LAHDIH.js → command-ZURZJDXF.js} +1 -1
- package/dist/node-runtime/{commands-RL5YBW5I.js → commands-BZGSLIP7.js} +4 -2
- package/dist/node-runtime/{customize-XEXL2DGQ.js → customize-LF5VST47.js} +1 -1
- package/dist/node-runtime/{direct-tool-executor-JVDXTO7A.js → direct-tool-executor-BSZDHIYR.js} +7 -4
- package/dist/node-runtime/{export-html-KR26FOUZ.js → export-html-E4DT6ZJQ.js} +1 -1
- package/dist/node-runtime/{gateway-X2TI5X7F.js → gateway-FWHRIBK5.js} +24 -369
- package/dist/node-runtime/index.js +49 -42
- package/dist/node-runtime/{init-NJV2T55N.js → init-DVJUAOUO.js} +4 -2
- package/dist/node-runtime/{interactive-mode-KOM35YF2.js → interactive-mode-BBASNWHN.js} +23 -17
- package/dist/node-runtime/{interactive-view-U6OILKF3.js → interactive-view-N6F4KUIT.js} +3 -5
- package/dist/node-runtime/lunr-computer-use-TJNDAMWM.js +135 -0
- package/dist/node-runtime/{lunr-cron-YJ5UHYRD.js → lunr-cron-J64I72C6.js} +7 -1
- package/dist/node-runtime/main.js +25 -20
- package/dist/node-runtime/{mcp-auth-flow-QIXHW6QN.js → mcp-auth-flow-YL6RWPYG.js} +2 -1
- package/dist/node-runtime/{package-manager-cli-TZZHJCVI.js → package-manager-cli-VMYX4Y2S.js} +10 -7
- package/dist/node-runtime/{pi-intercom-EEMBGQID.js → pi-intercom-NV2LW6X7.js} +108 -87
- package/dist/node-runtime/{pi-mcp-adapter-QFB37AVN.js → pi-mcp-adapter-JLB5YL2F.js} +31 -25
- package/dist/node-runtime/{pi-subagents-7XJ4H53P.js → pi-subagents-WEHV3W7H.js} +1321 -631
- package/dist/node-runtime/{pi-web-access-DPGAVKOA.js → pi-web-access-FN5YC5T6.js} +67 -64
- package/dist/node-runtime/{proxy-modes-HEEFK4KC.js → proxy-modes-OR7ISBXK.js} +7 -4
- package/dist/node-runtime/rpc-entry.js +25 -20
- package/dist/node-runtime/runtime-3SB5ATHQ.js +21 -0
- package/dist/node-runtime/{runtime-bridges-PPHNBFWL.js → runtime-bridges-2VQTLPOZ.js} +3 -5
- package/dist/node-runtime/{session-manager-MQNBYACL.js → session-manager-QEMZBMTM.js} +3 -5
- package/dist/node-runtime/{session-selector-5AZLJS6U.js → session-selector-URVJLOTK.js} +2 -2
- package/dist/node-runtime/{settings-manager-5LF2VQWC.js → settings-manager-3CCU326G.js} +4 -1
- package/dist/node-runtime/{src-Y7JSCK64.js → src-BPQFJR76.js} +27 -7
- package/dist/node-runtime/{subagent-executor-5RNDEPIJ.js → subagent-executor-CXKXQDHH.js} +189 -284
- package/dist/node-runtime/{update-cli-A253SZ7P.js → update-cli-NM7B4CKL.js} +4 -1
- package/dist/node-runtime/workflow-C26QCUTW.js +468 -0
- package/dist/rpc.d.ts +3 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +18 -0
- package/dist/rpc.js.map +1 -0
- package/dist/startup/interactive-view.d.ts.map +1 -1
- package/dist/startup/interactive-view.js +1 -2
- package/dist/startup/interactive-view.js.map +1 -1
- package/docs/computer-use.md +242 -0
- package/docs/development.md +0 -32
- package/docs/features.md +24 -6
- package/docs/interactive-startup.md +10 -3
- package/docs/keybindings.md +5 -3
- package/docs/settings.md +3 -2
- package/docs/terminal-setup.md +1 -1
- package/docs/usage.md +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/hidden-thinking-label.ts +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/install-lock/package-lock.json +3827 -0
- package/install-lock/package.json +18 -0
- package/native/computer-use/LICENSE.md +21 -0
- package/npm-shrinkwrap.json +3808 -0
- package/package.json +16 -10
- package/dist/builtin-extensions/lunr-settings-tools.d.ts +0 -4
- package/dist/builtin-extensions/lunr-settings-tools.d.ts.map +0 -1
- package/dist/builtin-extensions/lunr-settings-tools.js +0 -120
- package/dist/builtin-extensions/lunr-settings-tools.js.map +0 -1
- package/dist/core/settings-tools-bridge.d.ts +0 -35
- package/dist/core/settings-tools-bridge.d.ts.map +0 -1
- package/dist/core/settings-tools-bridge.js +0 -56
- package/dist/core/settings-tools-bridge.js.map +0 -1
- package/dist/node-runtime/chunk-AHSTJBIB.js +0 -64
- package/dist/startup/interactive-shell.d.ts +0 -55
- package/dist/startup/interactive-shell.d.ts.map +0 -1
- package/dist/startup/interactive-shell.js +0 -264
- package/dist/startup/interactive-shell.js.map +0 -1
- package/dist/node-runtime/{chunk-YSKSB3BJ.js → chunk-CH6OL6P2.js} +2 -2
|
@@ -3,38 +3,62 @@ import { randomUUID } from "node:crypto";
|
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { Type } from "typebox";
|
|
6
|
-
import { SUBAGENT_CHILD_AGENT_ENV, SUBAGENT_CHILD_INDEX_ENV, SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV, SUBAGENT_ORCHESTRATOR_TARGET_ENV, SUBAGENT_RUN_ID_ENV, SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV, } from "../runs/shared/pi-args.js";
|
|
7
|
-
import { INTERCOM_DETACH_REQUEST_EVENT, POLL_INTERVAL_MS,
|
|
6
|
+
import { SUBAGENT_CHILD_AGENT_ENV, SUBAGENT_CHILD_INDEX_ENV, SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV, SUBAGENT_ORCHESTRATOR_TARGET_ENV, SUBAGENT_RUN_ID_ENV, SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV, SUBAGENT_SUPERVISOR_SESSION_ID_ENV, } from "../runs/shared/pi-args.js";
|
|
7
|
+
import { INTERCOM_DETACH_REQUEST_EVENT, POLL_INTERVAL_MS, SUBAGENT_CONTROL_EVENT } from "../shared/types.js";
|
|
8
8
|
import { writeAtomicJson } from "../shared/atomic-json.js";
|
|
9
|
-
|
|
9
|
+
import { askRunningAsyncChild, reconcileAsyncQuestion } from "./supervisor-ask.js";
|
|
10
|
+
import { answerSupervisorQuestion, cancelPendingSupervisorQuestionsForOwner, cancelSupervisorQuestion, claimQuestionNotification, formatSupervisorQuestionAnswer, hasOutstandingQuestionForChild, isQuestionWaitActive, listSupervisorChannelDirs, listSupervisorQuestions, markSupervisorQuestionDelivered, outstandingQuestionsForChild, pendingSupervisorQuestionsForDelivery, QUESTIONS_DIR, readSupervisorQuestion, resolveSupervisorChannelDir as resolveQuestionChannelDir, SUBAGENT_QUESTION_EVENT, SUBAGENT_SUPERVISOR_ANSWER_TYPE, SUPERVISOR_CHANNEL_ROOT, supervisorQuestionIsTerminal, supervisorQuestionPublicState, } from "./supervisor-questions.js";
|
|
10
11
|
const REQUESTS_DIR = "requests";
|
|
11
12
|
const REPLIES_DIR = "replies";
|
|
12
13
|
export const NATIVE_SUPERVISOR_TOOL_NAME = "subagent_supervisor";
|
|
14
|
+
export const resolveSupervisorChannelDir = resolveQuestionChannelDir;
|
|
13
15
|
const MAX_MESSAGE_BYTES = 64 * 1024;
|
|
14
16
|
const DEFAULT_ASK_TIMEOUT_MS = 10 * 60 * 1000;
|
|
15
17
|
const CHANNEL_POLL_MS = Math.min(POLL_INTERVAL_MS, 500);
|
|
16
18
|
const STALE_EMPTY_CHANNEL_AGE_MS = 60 * 1000;
|
|
17
19
|
const STALE_EMPTY_CHANNEL_CLEANUP_INTERVAL_MS = 60 * 1000;
|
|
20
|
+
const PARENT_ASK_DESCRIPTION = [
|
|
21
|
+
"Ask a specific running async child, or reply to a child supervisor request.",
|
|
22
|
+
"Ask only when the child owns missing context, the answer changes a concrete next decision, and waiting risks a block or rework.",
|
|
23
|
+
"Use available results first, batch related questions, and keep working while awaiting the answer. Do not use ask for status checks, polling, duplicate queries, or step-by-step supervision. Follow up only when the answer leaves the original decision unresolved.",
|
|
24
|
+
"Returns a question id immediately. The child's explicit answer is delivered separately from the final run result.",
|
|
25
|
+
'Ask: { action: "ask", id: "<runId>", index?: 0, childId?: "...", reason: "<concrete decision>", message: "..." }',
|
|
26
|
+
"Use pending or list to find child requests awaiting your reply; status reports channel availability. Free-form send is unsupported. Asking never revives a child or changes its assignment.",
|
|
27
|
+
'Reply: { action: "reply", replyTo: "<requestId>", message: "..." }',
|
|
28
|
+
].join(" ");
|
|
29
|
+
const CHILD_CONTACT_DESCRIPTION = [
|
|
30
|
+
"Contact the parent/supervisor session for a blocking decision, structured interview, progress update, or reply to a parent question.",
|
|
31
|
+
"For parent questions use action='reply' with replyTo set to the question id. Answer from current findings and uncertainty; do not start extra investigation just to reply. Continue the assigned task after replying.",
|
|
32
|
+
"Do not open a blocking need_decision while a parent question is already outstanding for this child.",
|
|
33
|
+
].join(" ");
|
|
18
34
|
const ContactSupervisorParamsSchema = Type.Object({
|
|
19
|
-
reason: Type.String({ enum: ["need_decision", "interview_request", "progress_update"] }),
|
|
35
|
+
reason: Type.Optional(Type.String({ enum: ["need_decision", "interview_request", "progress_update"] })),
|
|
20
36
|
message: Type.Optional(Type.String()),
|
|
21
37
|
interview: Type.Optional(Type.Unsafe({ type: "object", additionalProperties: true })),
|
|
38
|
+
action: Type.Optional(Type.String({ enum: ["reply"] })),
|
|
39
|
+
replyTo: Type.Optional(Type.String()),
|
|
22
40
|
}, { additionalProperties: false });
|
|
23
41
|
const IntercomParamsSchema = Type.Object({
|
|
24
42
|
action: Type.String({ enum: ["list", "send", "ask", "reply", "pending", "status"] }),
|
|
25
43
|
to: Type.Optional(Type.String()),
|
|
26
44
|
message: Type.Optional(Type.String()),
|
|
27
45
|
replyTo: Type.Optional(Type.String()),
|
|
46
|
+
id: Type.Optional(Type.String({ description: "Async run id for action='ask'." })),
|
|
47
|
+
index: Type.Optional(Type.Integer({ minimum: 0, description: "Zero-based child index for action='ask'. Select index or childId when more than one child is running." })),
|
|
48
|
+
childId: Type.Optional(Type.String({ description: "Private child identity for action='ask'." })),
|
|
49
|
+
reason: Type.Optional(Type.String({ description: "Concrete decision the child's answer will change. Required for action='ask'." })),
|
|
50
|
+
}, { additionalProperties: false });
|
|
51
|
+
const ParentSupervisorParamsSchema = Type.Object({
|
|
52
|
+
...IntercomParamsSchema.properties,
|
|
53
|
+
action: Type.String({ enum: ["list", "ask", "reply", "pending", "status"] }),
|
|
28
54
|
}, { additionalProperties: false });
|
|
29
55
|
function safeSegment(value) {
|
|
30
56
|
return value.trim().replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "unknown";
|
|
31
57
|
}
|
|
32
|
-
export function resolveSupervisorChannelDir(runId, agent, childIndex) {
|
|
33
|
-
return path.join(SUPERVISOR_CHANNEL_ROOT, `${safeSegment(runId)}-${safeSegment(agent)}-${childIndex}`);
|
|
34
|
-
}
|
|
35
58
|
export function ensureSupervisorChannelDir(channelDir) {
|
|
36
59
|
fs.mkdirSync(path.join(channelDir, REQUESTS_DIR), { recursive: true, mode: 0o700 });
|
|
37
60
|
fs.mkdirSync(path.join(channelDir, REPLIES_DIR), { recursive: true, mode: 0o700 });
|
|
61
|
+
fs.mkdirSync(path.join(channelDir, QUESTIONS_DIR), { recursive: true, mode: 0o700 });
|
|
38
62
|
}
|
|
39
63
|
function requestPath(channelDir, requestId) {
|
|
40
64
|
return path.join(channelDir, REQUESTS_DIR, `${safeSegment(requestId)}.json`);
|
|
@@ -61,9 +85,48 @@ function readChildMetadata() {
|
|
|
61
85
|
childIndex: Number(rawIndex),
|
|
62
86
|
orchestratorTarget: readTextEnv(SUBAGENT_ORCHESTRATOR_TARGET_ENV),
|
|
63
87
|
orchestratorSessionId,
|
|
88
|
+
supervisorSessionId: readTextEnv(SUBAGENT_SUPERVISOR_SESSION_ID_ENV),
|
|
64
89
|
childTarget: readTextEnv("PI_SUBAGENT_INTERCOM_SESSION_NAME"),
|
|
65
90
|
};
|
|
66
91
|
}
|
|
92
|
+
function readChildQuestionOwner(metadata = readChildMetadata()) {
|
|
93
|
+
if (!metadata)
|
|
94
|
+
return undefined;
|
|
95
|
+
const readyAt = Number(process.env.PI_SUBAGENT_STEER_READY_AT);
|
|
96
|
+
if (!Number.isFinite(readyAt) || readyAt <= 0)
|
|
97
|
+
return undefined;
|
|
98
|
+
return {
|
|
99
|
+
runId: metadata.runId,
|
|
100
|
+
childIndex: metadata.childIndex,
|
|
101
|
+
childId: metadata.agent,
|
|
102
|
+
pid: process.pid,
|
|
103
|
+
readyAt,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function answerParentQuestion(params) {
|
|
107
|
+
const metadata = readChildMetadata();
|
|
108
|
+
const owner = readChildQuestionOwner(metadata);
|
|
109
|
+
if (!metadata || !owner)
|
|
110
|
+
throw new Error("Native supervisor channel is not available for this subagent.");
|
|
111
|
+
const replyTo = params.replyTo?.trim();
|
|
112
|
+
if (!replyTo)
|
|
113
|
+
throw new Error("action='reply' requires replyTo with the parent question id.");
|
|
114
|
+
const message = params.message?.trim();
|
|
115
|
+
if (!message)
|
|
116
|
+
throw new Error("message is required for supervisor question replies.");
|
|
117
|
+
const question = readSupervisorQuestion(metadata.channelDir, replyTo);
|
|
118
|
+
if (question?.parentSessionId !== (metadata.supervisorSessionId ?? metadata.orchestratorSessionId))
|
|
119
|
+
throw new Error("Question belongs to a different supervisor session.");
|
|
120
|
+
const answered = answerSupervisorQuestion(metadata.channelDir, replyTo, message, owner);
|
|
121
|
+
return {
|
|
122
|
+
content: [{ type: "text", text: `Replied to parent question ${answered.id}. Continue the assigned task.` }],
|
|
123
|
+
details: {
|
|
124
|
+
replyTo: answered.id,
|
|
125
|
+
state: supervisorQuestionPublicState(answered),
|
|
126
|
+
answered: true,
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
67
130
|
function reasonHeading(reason) {
|
|
68
131
|
if (reason === "interview_request")
|
|
69
132
|
return "Subagent requests a structured supervisor interview.";
|
|
@@ -143,9 +206,17 @@ async function waitForReply(channelDir, requestId, deadline, signal) {
|
|
|
143
206
|
throw new Error("Timed out waiting for supervisor reply.");
|
|
144
207
|
}
|
|
145
208
|
async function sendSupervisorRequest(params, signal) {
|
|
209
|
+
if (params.action === "reply" || params.replyTo?.trim()) {
|
|
210
|
+
return answerParentQuestion(params);
|
|
211
|
+
}
|
|
146
212
|
const metadata = readChildMetadata();
|
|
147
213
|
if (!metadata)
|
|
148
214
|
throw new Error("Native supervisor channel is not available for this subagent.");
|
|
215
|
+
if (!params.reason)
|
|
216
|
+
throw new Error("reason is required for supervisor contact.");
|
|
217
|
+
if (params.reason !== "progress_update" && hasOutstandingQuestionForChild(metadata.channelDir, metadata.childIndex, metadata.agent)) {
|
|
218
|
+
throw new Error("A parent question is already outstanding for this child. Answer it with action='reply' before opening a blocking supervisor request.");
|
|
219
|
+
}
|
|
149
220
|
if (params.reason !== "progress_update" && !params.message?.trim() && params.reason !== "interview_request") {
|
|
150
221
|
throw new Error("message is required for supervisor decisions.");
|
|
151
222
|
}
|
|
@@ -166,6 +237,7 @@ async function sendSupervisorRequest(params, signal) {
|
|
|
166
237
|
expectsReply,
|
|
167
238
|
...(metadata.orchestratorTarget ? { orchestratorTarget: metadata.orchestratorTarget } : {}),
|
|
168
239
|
...(metadata.orchestratorSessionId ? { orchestratorSessionId: metadata.orchestratorSessionId } : {}),
|
|
240
|
+
...(metadata.supervisorSessionId ? { supervisorSessionId: metadata.supervisorSessionId } : {}),
|
|
169
241
|
runId: metadata.runId,
|
|
170
242
|
agent: metadata.agent,
|
|
171
243
|
childIndex: metadata.childIndex,
|
|
@@ -176,6 +248,11 @@ async function sendSupervisorRequest(params, signal) {
|
|
|
176
248
|
if (Buffer.byteLength(serialized, "utf-8") > MAX_MESSAGE_BYTES)
|
|
177
249
|
throw new Error("Supervisor request is too large.");
|
|
178
250
|
writeAtomicJson(requestPath(metadata.channelDir, requestId), request);
|
|
251
|
+
if (expectsReply) {
|
|
252
|
+
for (const question of outstandingQuestionsForChild(metadata.channelDir, metadata.childIndex, metadata.agent)) {
|
|
253
|
+
cancelSupervisorQuestion(metadata.channelDir, question.id, "child needs a supervisor decision; reply to its request first");
|
|
254
|
+
}
|
|
255
|
+
}
|
|
179
256
|
if (!expectsReply) {
|
|
180
257
|
return {
|
|
181
258
|
content: [{ type: "text", text: "Supervisor progress update queued." }],
|
|
@@ -218,7 +295,7 @@ export function registerNativeSupervisorClient(pi, options = {}) {
|
|
|
218
295
|
const tool = {
|
|
219
296
|
name: "contact_supervisor",
|
|
220
297
|
label: "Contact Supervisor",
|
|
221
|
-
description:
|
|
298
|
+
description: CHILD_CONTACT_DESCRIPTION,
|
|
222
299
|
parameters: ContactSupervisorParamsSchema,
|
|
223
300
|
execute(_id, params, signal) {
|
|
224
301
|
return sendSupervisorRequest(params, signal);
|
|
@@ -253,6 +330,8 @@ function parseRequestFile(file, channelDir) {
|
|
|
253
330
|
const parsed = JSON.parse(fs.readFileSync(file, "utf-8"));
|
|
254
331
|
if (parsed.type !== "subagent.supervisor.request")
|
|
255
332
|
return undefined;
|
|
333
|
+
if (parsed.supervisorSessionId !== undefined && (typeof parsed.supervisorSessionId !== "string" || !parsed.supervisorSessionId.trim()))
|
|
334
|
+
return undefined;
|
|
256
335
|
if (typeof parsed.id !== "string" || !parsed.id)
|
|
257
336
|
return undefined;
|
|
258
337
|
if (parsed.reason !== "need_decision" && parsed.reason !== "interview_request" && parsed.reason !== "progress_update")
|
|
@@ -267,6 +346,25 @@ function parseRequestFile(file, channelDir) {
|
|
|
267
346
|
return undefined;
|
|
268
347
|
}
|
|
269
348
|
}
|
|
349
|
+
export function hasPendingBlockingSupervisorRequest(runId, sessionId, now = Date.now()) {
|
|
350
|
+
if (!runId)
|
|
351
|
+
return false;
|
|
352
|
+
for (const { channelDir, file } of listRequestFiles()) {
|
|
353
|
+
const request = parseRequestFile(file, channelDir);
|
|
354
|
+
if (!request?.expectsReply)
|
|
355
|
+
continue;
|
|
356
|
+
if (request.runId !== runId)
|
|
357
|
+
continue;
|
|
358
|
+
if (sessionId && (request.supervisorSessionId ?? request.orchestratorSessionId) !== sessionId)
|
|
359
|
+
continue;
|
|
360
|
+
if (fs.existsSync(replyPath(request.channelDir, request.id)))
|
|
361
|
+
continue;
|
|
362
|
+
if (now > requestExpiresAt(request, now))
|
|
363
|
+
continue;
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
270
368
|
function listRequestFiles() {
|
|
271
369
|
let channelEntries;
|
|
272
370
|
try {
|
|
@@ -332,7 +430,8 @@ function removeEmptyDirectory(dir) {
|
|
|
332
430
|
function removeStaleEmptySupervisorChannel(channelDir, nowMs) {
|
|
333
431
|
const requestsDir = path.join(channelDir, REQUESTS_DIR);
|
|
334
432
|
const repliesDir = path.join(channelDir, REPLIES_DIR);
|
|
335
|
-
const
|
|
433
|
+
const questionsPath = path.join(channelDir, QUESTIONS_DIR);
|
|
434
|
+
const newestKnownMtimeMs = Math.max(directoryMtimeMs(channelDir), directoryMtimeMs(requestsDir), directoryMtimeMs(repliesDir), directoryMtimeMs(questionsPath));
|
|
336
435
|
if (nowMs - newestKnownMtimeMs < STALE_EMPTY_CHANNEL_AGE_MS)
|
|
337
436
|
return false;
|
|
338
437
|
const requestEntries = readDirectoryEntries(requestsDir);
|
|
@@ -341,10 +440,15 @@ function removeStaleEmptySupervisorChannel(channelDir, nowMs) {
|
|
|
341
440
|
const replyEntries = readDirectoryEntries(repliesDir);
|
|
342
441
|
if (!replyEntries || replyEntries.length > 0)
|
|
343
442
|
return false;
|
|
443
|
+
const questionEntries = readDirectoryEntries(questionsPath);
|
|
444
|
+
if (!questionEntries || questionEntries.length > 0)
|
|
445
|
+
return false;
|
|
344
446
|
if (!removeEmptyDirectory(requestsDir))
|
|
345
447
|
return false;
|
|
346
448
|
if (!removeEmptyDirectory(repliesDir))
|
|
347
449
|
return false;
|
|
450
|
+
if (!removeEmptyDirectory(questionsPath))
|
|
451
|
+
return false;
|
|
348
452
|
if (!removeEmptyDirectory(channelDir))
|
|
349
453
|
return false;
|
|
350
454
|
return true;
|
|
@@ -384,9 +488,19 @@ function currentContextSessionId(state, ctx) {
|
|
|
384
488
|
}
|
|
385
489
|
return state.currentSessionId ?? undefined;
|
|
386
490
|
}
|
|
491
|
+
function currentSupervisorSessionId(state, ctx) {
|
|
492
|
+
try {
|
|
493
|
+
return ctx.sessionManager.getSessionFile?.() ?? currentContextSessionId(state, ctx);
|
|
494
|
+
}
|
|
495
|
+
catch {
|
|
496
|
+
return state.currentSessionId ?? undefined;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
387
499
|
function requestMatchesContext(request, state, ctx) {
|
|
388
|
-
const currentSessionId =
|
|
389
|
-
|
|
500
|
+
const currentSessionId = request.supervisorSessionId !== undefined
|
|
501
|
+
? currentSupervisorSessionId(state, ctx)
|
|
502
|
+
: currentContextSessionId(state, ctx);
|
|
503
|
+
return Boolean(currentSessionId && (request.supervisorSessionId ?? request.orchestratorSessionId) === currentSessionId);
|
|
390
504
|
}
|
|
391
505
|
function removeRequestFile(file) {
|
|
392
506
|
try {
|
|
@@ -506,10 +620,8 @@ function buildParentIntercomTool(pending, state, name = "intercom") {
|
|
|
506
620
|
return {
|
|
507
621
|
name,
|
|
508
622
|
label: name === "intercom" ? "Intercom" : "Subagent Supervisor",
|
|
509
|
-
description:
|
|
510
|
-
|
|
511
|
-
: "Native pi-subagents supervisor channel. Use reply/pending/status to answer child subagent requests without overriding pi-intercom.",
|
|
512
|
-
parameters: IntercomParamsSchema,
|
|
623
|
+
description: PARENT_ASK_DESCRIPTION,
|
|
624
|
+
parameters: ParentSupervisorParamsSchema,
|
|
513
625
|
async execute(_id, params) {
|
|
514
626
|
refreshPendingRequests(pending, state, state.lastUiContext ?? undefined);
|
|
515
627
|
const input = params;
|
|
@@ -526,13 +638,73 @@ function buildParentIntercomTool(pending, state, name = "intercom") {
|
|
|
526
638
|
pending.delete(request.id);
|
|
527
639
|
return { content: [{ type: "text", text: `Replied to supervisor request ${request.id}.` }], details: { replyTo: request.id, runId: request.runId, agent: request.agent } };
|
|
528
640
|
}
|
|
529
|
-
if (input.action === "
|
|
530
|
-
|
|
641
|
+
if (input.action === "ask") {
|
|
642
|
+
return askRunningAsyncChild({
|
|
643
|
+
params: {
|
|
644
|
+
id: input.id,
|
|
645
|
+
index: input.index,
|
|
646
|
+
childId: input.childId,
|
|
647
|
+
reason: input.reason,
|
|
648
|
+
message: input.message,
|
|
649
|
+
},
|
|
650
|
+
state,
|
|
651
|
+
childRequests: pending.values(),
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
if (input.action === "send") {
|
|
655
|
+
throw new Error("Native pi-subagents intercom does not support free-form send. Use action='ask' for a running async child or action='reply' for a pending child request.");
|
|
531
656
|
}
|
|
532
657
|
throw new Error(`Unsupported intercom action: ${input.action}`);
|
|
533
658
|
},
|
|
534
659
|
};
|
|
535
660
|
}
|
|
661
|
+
function questionMatchesParentContext(question, state, ctx) {
|
|
662
|
+
const sessionId = currentSupervisorSessionId(state, ctx);
|
|
663
|
+
if (!sessionId || question.parentSessionId !== sessionId)
|
|
664
|
+
return false;
|
|
665
|
+
if ((state.sessionGeneration ?? 0) !== question.parentGeneration)
|
|
666
|
+
return false;
|
|
667
|
+
return true;
|
|
668
|
+
}
|
|
669
|
+
function notifyQuestionTerminal(pi, question, channelDir) {
|
|
670
|
+
if (!supervisorQuestionIsTerminal(question) || question.notifiedAt)
|
|
671
|
+
return;
|
|
672
|
+
pi.events?.emit(SUBAGENT_QUESTION_EVENT, {
|
|
673
|
+
questionId: question.id,
|
|
674
|
+
state: supervisorQuestionPublicState(question),
|
|
675
|
+
runId: question.runId,
|
|
676
|
+
});
|
|
677
|
+
if (isQuestionWaitActive(question.id))
|
|
678
|
+
return;
|
|
679
|
+
if (!claimQuestionNotification(channelDir, question.id))
|
|
680
|
+
return;
|
|
681
|
+
const state = supervisorQuestionPublicState(question);
|
|
682
|
+
pi.sendMessage({
|
|
683
|
+
customType: SUBAGENT_SUPERVISOR_ANSWER_TYPE,
|
|
684
|
+
content: formatSupervisorQuestionAnswer(question),
|
|
685
|
+
display: state === "answered",
|
|
686
|
+
details: {
|
|
687
|
+
questionId: question.id,
|
|
688
|
+
state,
|
|
689
|
+
runId: question.runId,
|
|
690
|
+
childIndex: question.childIndex,
|
|
691
|
+
childId: question.childId,
|
|
692
|
+
reason: question.reason,
|
|
693
|
+
answered: state === "answered",
|
|
694
|
+
delivered: Boolean(question.deliveredAt),
|
|
695
|
+
},
|
|
696
|
+
}, { triggerTurn: state === "answered" });
|
|
697
|
+
}
|
|
698
|
+
function pollSupervisorQuestions(pi, state, ctx) {
|
|
699
|
+
for (const channelDir of listSupervisorChannelDirs()) {
|
|
700
|
+
for (const question of listSupervisorQuestions(channelDir)) {
|
|
701
|
+
if (!questionMatchesParentContext(question, state, ctx))
|
|
702
|
+
continue;
|
|
703
|
+
const current = reconcileAsyncQuestion(channelDir, question, state);
|
|
704
|
+
notifyQuestionTerminal(pi, current, channelDir);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}
|
|
536
708
|
export function createNativeSupervisorChannel(pi, state) {
|
|
537
709
|
const pending = new Map();
|
|
538
710
|
const seenFiles = new Set();
|
|
@@ -556,12 +728,31 @@ export function createNativeSupervisorChannel(pi, state) {
|
|
|
556
728
|
// Supervisor delivery must not fail because best-effort temp cleanup failed.
|
|
557
729
|
}
|
|
558
730
|
};
|
|
731
|
+
const cancelOwnedQuestions = (reason) => {
|
|
732
|
+
if (!state.currentSessionId)
|
|
733
|
+
return;
|
|
734
|
+
cancelPendingSupervisorQuestionsForOwner({
|
|
735
|
+
parentSessionId: state.currentSessionId,
|
|
736
|
+
parentGeneration: state.sessionGeneration ?? 0,
|
|
737
|
+
reason,
|
|
738
|
+
});
|
|
739
|
+
};
|
|
740
|
+
const settleRunQuestions = (runId, reason) => {
|
|
741
|
+
if (!state.currentSessionId)
|
|
742
|
+
return;
|
|
743
|
+
cancelPendingSupervisorQuestionsForOwner({
|
|
744
|
+
parentSessionId: state.currentSessionId,
|
|
745
|
+
runId,
|
|
746
|
+
reason,
|
|
747
|
+
});
|
|
748
|
+
};
|
|
559
749
|
const poll = () => {
|
|
560
750
|
cleanupStaleChannelsIfDue();
|
|
561
751
|
const ctx = state.lastUiContext;
|
|
562
752
|
if (!ctx)
|
|
563
753
|
return;
|
|
564
754
|
refreshPendingRequests(pending, state, ctx);
|
|
755
|
+
pollSupervisorQuestions(pi, state, ctx);
|
|
565
756
|
const now = Date.now();
|
|
566
757
|
for (const { channelDir, file } of listRequestFiles()) {
|
|
567
758
|
if (seenFiles.has(file))
|
|
@@ -595,12 +786,23 @@ export function createNativeSupervisorChannel(pi, state) {
|
|
|
595
786
|
},
|
|
596
787
|
});
|
|
597
788
|
if (request.expectsReply) {
|
|
598
|
-
|
|
789
|
+
const job = state.asyncJobs.get(request.runId);
|
|
790
|
+
if (job)
|
|
791
|
+
job.activityState = "needs_attention";
|
|
792
|
+
const events = pi.events;
|
|
793
|
+
events?.emit(INTERCOM_DETACH_REQUEST_EVENT, {
|
|
599
794
|
requestId: request.id,
|
|
600
795
|
runId: request.runId,
|
|
601
796
|
agent: request.agent,
|
|
602
797
|
childIndex: request.childIndex,
|
|
603
798
|
});
|
|
799
|
+
events?.emit(SUBAGENT_CONTROL_EVENT, {
|
|
800
|
+
type: "needs_attention",
|
|
801
|
+
to: "needs_attention",
|
|
802
|
+
runId: request.runId,
|
|
803
|
+
agent: request.agent,
|
|
804
|
+
index: request.childIndex,
|
|
805
|
+
});
|
|
604
806
|
}
|
|
605
807
|
}
|
|
606
808
|
};
|
|
@@ -614,6 +816,7 @@ export function createNativeSupervisorChannel(pi, state) {
|
|
|
614
816
|
poller.unref?.();
|
|
615
817
|
},
|
|
616
818
|
dispose: () => {
|
|
819
|
+
cancelOwnedQuestions("parent supervisor channel disposed");
|
|
617
820
|
if (poller)
|
|
618
821
|
clearInterval(poller);
|
|
619
822
|
poller = undefined;
|
|
@@ -621,6 +824,32 @@ export function createNativeSupervisorChannel(pi, state) {
|
|
|
621
824
|
seenFiles.clear();
|
|
622
825
|
},
|
|
623
826
|
pending,
|
|
827
|
+
cancelOwnedQuestions,
|
|
828
|
+
settleRunQuestions,
|
|
624
829
|
};
|
|
625
830
|
}
|
|
831
|
+
export function isPendingQuestionForCurrentChild(questionId) {
|
|
832
|
+
const metadata = readChildMetadata();
|
|
833
|
+
const owner = readChildQuestionOwner(metadata);
|
|
834
|
+
if (!metadata || !owner)
|
|
835
|
+
return false;
|
|
836
|
+
return pendingSupervisorQuestionsForDelivery(metadata.channelDir, owner).some((question) => question.id === questionId && question.parentSessionId === (metadata.supervisorSessionId ?? metadata.orchestratorSessionId));
|
|
837
|
+
}
|
|
838
|
+
export function markDeliveredSupervisorQuestionFromChild(message) {
|
|
839
|
+
const match = message.match(/Parent question \(([^)\s]+)\)/);
|
|
840
|
+
if (!match?.[1])
|
|
841
|
+
return;
|
|
842
|
+
const metadata = readChildMetadata();
|
|
843
|
+
const owner = readChildQuestionOwner(metadata);
|
|
844
|
+
if (!metadata || !owner)
|
|
845
|
+
return;
|
|
846
|
+
if (!isPendingQuestionForCurrentChild(match[1]))
|
|
847
|
+
return;
|
|
848
|
+
try {
|
|
849
|
+
markSupervisorQuestionDelivered(metadata.channelDir, match[1], owner);
|
|
850
|
+
}
|
|
851
|
+
catch {
|
|
852
|
+
// Delivery markers are best-effort; answer ownership still enforces identity.
|
|
853
|
+
}
|
|
854
|
+
}
|
|
626
855
|
//# sourceMappingURL=native-supervisor-channel.js.map
|