@ashx-j/lunr 0.2.20 → 0.2.22
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 +14 -2
- package/README.md +20 -4
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +1 -0
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/lunr-browser.d.ts +3 -0
- package/dist/builtin-extensions/lunr-browser.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-browser.js +56 -0
- package/dist/builtin-extensions/lunr-browser.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 +24 -7
- package/dist/builtin-extensions/lunr-todos.js.map +1 -1
- package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-intercom/broker/spawn.js +30 -21
- 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 +15 -3
- package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js +5 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.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 -7
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +78 -31
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +2 -2
- 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 +6 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/communication.d.ts +17 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/communication.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/communication.js +45 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/communication.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js +4 -11
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts +5 -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 +186 -58
- 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.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js +5 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js +3 -2
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +2 -0
- 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 +4 -3
- 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 +2 -0
- 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/auto-drain.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js +2 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts +6 -2
- 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 +23 -1
- 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.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js +1 -0
- 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 +1 -0
- 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 +2 -0
- 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.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.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/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 +9 -9
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.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/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 +5 -0
- 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-control.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js +3 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.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 +1 -1
- 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/types.d.ts +6 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +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 +4 -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 +22 -23
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts +18 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/communication.js +47 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/communication.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +237 -374
- package/dist/builtin-extensions/pi-subagents/src/tui/render.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 +11 -7
- package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +2 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/install-cli.d.ts.map +1 -1
- package/dist/cli/install-cli.js +15 -45
- package/dist/cli/install-cli.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +9 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +126 -29
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +3 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +20 -2
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/browser/network.d.ts +9 -0
- package/dist/core/browser/network.d.ts.map +1 -0
- package/dist/core/browser/network.js +146 -0
- package/dist/core/browser/network.js.map +1 -0
- package/dist/core/browser/runtime.d.ts +24 -0
- package/dist/core/browser/runtime.d.ts.map +1 -0
- package/dist/core/browser/runtime.js +289 -0
- package/dist/core/browser/runtime.js.map +1 -0
- package/dist/core/browser/schema.d.ts +16 -0
- package/dist/core/browser/schema.d.ts.map +1 -0
- package/dist/core/browser/schema.js +36 -0
- package/dist/core/browser/schema.js.map +1 -0
- package/dist/core/browser/settings.d.ts +8 -0
- package/dist/core/browser/settings.d.ts.map +1 -0
- package/dist/core/browser/settings.js +30 -0
- package/dist/core/browser/settings.js.map +1 -0
- package/dist/core/browser/setup.d.ts +2 -0
- package/dist/core/browser/setup.d.ts.map +1 -0
- package/dist/core/browser/setup.js +16 -0
- package/dist/core/browser/setup.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 +17 -13
- package/dist/core/customize.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +1 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +1 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/install-features.d.ts.map +1 -1
- package/dist/core/install-features.js +10 -8
- package/dist/core/install-features.js.map +1 -1
- package/dist/core/memory-cap.d.ts.map +1 -1
- package/dist/core/memory-cap.js +5 -3
- package/dist/core/memory-cap.js.map +1 -1
- package/dist/core/model-tiers.d.ts.map +1 -1
- package/dist/core/model-tiers.js +9 -6
- package/dist/core/model-tiers.js.map +1 -1
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +9 -0
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +3 -0
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/process-registry.d.ts.map +1 -1
- package/dist/core/process-registry.js +6 -4
- package/dist/core/process-registry.js.map +1 -1
- package/dist/core/runtime-scope.d.ts +11 -0
- package/dist/core/runtime-scope.d.ts.map +1 -0
- package/dist/core/runtime-scope.js +3 -0
- package/dist/core/runtime-scope.js.map +1 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +13 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-handoff.d.ts +35 -0
- package/dist/core/session-handoff.d.ts.map +1 -0
- package/dist/core/session-handoff.js +214 -0
- package/dist/core/session-handoff.js.map +1 -0
- package/dist/core/session-manager.d.ts +20 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +184 -22
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-ownership.d.ts +28 -0
- package/dist/core/session-ownership.d.ts.map +1 -0
- package/dist/core/session-ownership.js +138 -0
- package/dist/core/session-ownership.js.map +1 -0
- package/dist/core/session-retention.d.ts.map +1 -1
- package/dist/core/session-retention.js +11 -2
- package/dist/core/session-retention.js.map +1 -1
- package/dist/core/settings-manager.d.ts +11 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +29 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +2 -0
- package/dist/core/slash-commands.js.map +1 -1
- 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/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +5 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/todo-settings.d.ts +5 -0
- package/dist/core/todo-settings.d.ts.map +1 -0
- package/dist/core/todo-settings.js +7 -0
- package/dist/core/todo-settings.js.map +1 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +4 -4
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +5 -3
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +4 -4
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +4 -4
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +4 -4
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +4 -4
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +11 -2
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +31 -4
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +4 -4
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/usage-service.d.ts.map +1 -1
- package/dist/core/usage-service.js +5 -3
- package/dist/core/usage-service.js.map +1 -1
- package/dist/gateway/adapters/discord.d.ts +12 -1
- package/dist/gateway/adapters/discord.d.ts.map +1 -1
- package/dist/gateway/adapters/discord.js +112 -17
- package/dist/gateway/adapters/discord.js.map +1 -1
- package/dist/gateway/adapters/telegram.d.ts +4 -2
- package/dist/gateway/adapters/telegram.d.ts.map +1 -1
- package/dist/gateway/adapters/telegram.js +34 -11
- package/dist/gateway/adapters/telegram.js.map +1 -1
- package/dist/gateway/agent-bridge.d.ts +14 -3
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +252 -60
- package/dist/gateway/agent-bridge.js.map +1 -1
- package/dist/gateway/approval.d.ts +1 -0
- package/dist/gateway/approval.d.ts.map +1 -1
- package/dist/gateway/approval.js +60 -18
- package/dist/gateway/approval.js.map +1 -1
- package/dist/gateway/authz.d.ts +2 -0
- package/dist/gateway/authz.d.ts.map +1 -1
- package/dist/gateway/authz.js +13 -0
- package/dist/gateway/authz.js.map +1 -1
- package/dist/gateway/buttons.d.ts +3 -1
- package/dist/gateway/buttons.d.ts.map +1 -1
- package/dist/gateway/buttons.js +18 -3
- package/dist/gateway/buttons.js.map +1 -1
- package/dist/gateway/command.d.ts.map +1 -1
- package/dist/gateway/command.js +49 -4
- package/dist/gateway/command.js.map +1 -1
- package/dist/gateway/commands.d.ts.map +1 -1
- package/dist/gateway/commands.js +18 -3
- package/dist/gateway/commands.js.map +1 -1
- package/dist/gateway/config.d.ts +5 -0
- package/dist/gateway/config.d.ts.map +1 -1
- package/dist/gateway/config.js +5 -0
- package/dist/gateway/config.js.map +1 -1
- package/dist/gateway/conversations.d.ts +14 -0
- package/dist/gateway/conversations.d.ts.map +1 -0
- package/dist/gateway/conversations.js +30 -0
- package/dist/gateway/conversations.js.map +1 -0
- package/dist/gateway/download.d.ts +2 -0
- package/dist/gateway/download.d.ts.map +1 -0
- package/dist/gateway/download.js +36 -0
- package/dist/gateway/download.js.map +1 -0
- package/dist/gateway/index.d.ts.map +1 -1
- package/dist/gateway/index.js +85 -26
- package/dist/gateway/index.js.map +1 -1
- package/dist/gateway/mobile-commands.d.ts +24 -0
- package/dist/gateway/mobile-commands.d.ts.map +1 -0
- package/dist/gateway/mobile-commands.js +422 -0
- package/dist/gateway/mobile-commands.js.map +1 -0
- package/dist/gateway/presenter.d.ts +16 -0
- package/dist/gateway/presenter.d.ts.map +1 -0
- package/dist/gateway/presenter.js +210 -0
- package/dist/gateway/presenter.js.map +1 -0
- package/dist/gateway/router.d.ts +1 -0
- package/dist/gateway/router.d.ts.map +1 -1
- package/dist/gateway/router.js +32 -3
- package/dist/gateway/router.js.map +1 -1
- package/dist/gateway/service.d.ts +46 -0
- package/dist/gateway/service.d.ts.map +1 -0
- package/dist/gateway/service.js +395 -0
- package/dist/gateway/service.js.map +1 -0
- package/dist/gateway/setup.d.ts +4 -0
- package/dist/gateway/setup.d.ts.map +1 -0
- package/dist/gateway/setup.js +146 -0
- package/dist/gateway/setup.js.map +1 -0
- package/dist/gateway/types.d.ts +4 -2
- package/dist/gateway/types.d.ts.map +1 -1
- package/dist/gateway/types.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +11 -2
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +53 -16
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/copyable-text.d.ts +31 -0
- package/dist/modes/interactive/components/copyable-text.d.ts.map +1 -0
- package/dist/modes/interactive/components/copyable-text.js +165 -0
- package/dist/modes/interactive/components/copyable-text.js.map +1 -0
- package/dist/modes/interactive/components/custom-entry.d.ts +1 -0
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +8 -0
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +8 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +16 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +9 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +111 -1
- package/dist/modes/interactive/components/settings-selector.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 +3 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +166 -29
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/node-runtime/agent-session-services-NQ6GKOIK.js +49 -0
- package/dist/node-runtime/{builtin-extensions-X4JMM4ZS.js → builtin-extensions-GVC6IFDU.js} +6 -4
- package/dist/node-runtime/{chunk-LTYWTR3V.js → chunk-2MI5OPMN.js} +17 -2
- package/dist/node-runtime/{chunk-W3CVH5RX.js → chunk-2TKODGBZ.js} +11 -6
- package/dist/node-runtime/chunk-4EULYYR4.js +62 -0
- package/dist/node-runtime/chunk-5BNJ4JUH.js +672 -0
- package/dist/node-runtime/{chunk-6N22HULO.js → chunk-5D7LC2ZQ.js} +7 -2
- package/dist/node-runtime/chunk-5ZH3ZFIZ.js +308 -0
- package/dist/node-runtime/{chunk-KBKMCJDU.js → chunk-5ZQXRPMC.js} +19 -4
- package/dist/node-runtime/{chunk-6KDIOJL3.js → chunk-6427XAWG.js} +3 -3
- package/dist/node-runtime/{chunk-BOHIDQT4.js → chunk-6B2POMK7.js} +1 -1
- package/dist/node-runtime/{chunk-RNBHABBA.js → chunk-7QWNYZDI.js} +7 -0
- package/dist/node-runtime/chunk-AZJHNQKQ.js +205 -0
- package/dist/node-runtime/chunk-BFNXONG3.js +521 -0
- package/dist/node-runtime/{chunk-IRPJXI6U.js → chunk-BX2RB477.js} +1 -1
- package/dist/node-runtime/chunk-CCCN2UCX.js +14 -0
- package/dist/node-runtime/{chunk-25I2BHAA.js → chunk-CSUZVNYE.js} +1 -1
- package/dist/node-runtime/{chunk-QZMODZQ2.js → chunk-E24EO34J.js} +2 -1
- package/dist/node-runtime/{chunk-QKFMBRAL.js → chunk-EQ63ANHL.js} +508 -140
- package/dist/node-runtime/{chunk-ELWEXVO5.js → chunk-GJSAD4AB.js} +216 -201
- package/dist/node-runtime/{chunk-AOFXZQKA.js → chunk-GMHJCCEN.js} +8 -8
- package/dist/node-runtime/{chunk-DDWHZ633.js → chunk-GNN7H3B7.js} +1 -1
- package/dist/node-runtime/chunk-GS66LV4M.js +2830 -0
- package/dist/node-runtime/{chunk-6BEIBLQ3.js → chunk-H3XF4UVQ.js} +1 -1
- package/dist/node-runtime/chunk-H4K3JDRB.js +47 -0
- package/dist/node-runtime/{chunk-AROOY4BB.js → chunk-HTFRRDSF.js} +2 -7
- package/dist/node-runtime/chunk-IMLCWLPI.js +9 -0
- package/dist/node-runtime/{chunk-4CSFRBCN.js → chunk-IQIEU7SB.js} +9 -674
- package/dist/node-runtime/{chunk-OPEK5RRY.js → chunk-IVXYUAJE.js} +1 -1
- package/dist/node-runtime/{chunk-AL2FMKKM.js → chunk-IWOWXRWU.js} +58 -48
- package/dist/node-runtime/chunk-KKUTQQV7.js +144 -0
- package/dist/node-runtime/chunk-LISUTZS3.js +19 -0
- package/dist/node-runtime/{chunk-K3646JTM.js → chunk-LMBNLFXQ.js} +25 -314
- package/dist/node-runtime/{chunk-7NBZ5P7I.js → chunk-NAY6UUQZ.js} +1 -1
- package/dist/node-runtime/chunk-OAR4TYZE.js +146 -0
- package/dist/node-runtime/{chunk-STERBGUB.js → chunk-OFKSVRV7.js} +2 -2
- package/dist/node-runtime/{chunk-JZQ7F36T.js → chunk-ORH324EP.js} +19 -3
- package/dist/node-runtime/{chunk-2SJB2AWP.js → chunk-PC2Z5TKZ.js} +3 -3
- package/dist/node-runtime/{chunk-46ECNOLF.js → chunk-QDGKKKUM.js} +97 -162
- package/dist/node-runtime/chunk-R3K2F5GI.js +122 -0
- package/dist/node-runtime/chunk-RMQZU2YU.js +117 -0
- package/dist/node-runtime/{chunk-JYNNB7DU.js → chunk-TDL7UWJ7.js} +283 -2999
- package/dist/node-runtime/{chunk-G6LRAP36.js → chunk-TQGPP4SC.js} +1 -1
- package/dist/node-runtime/chunk-UAEOTO52.js +119 -0
- package/dist/node-runtime/{chunk-4DJ6HEGH.js → chunk-UAFLNHSH.js} +18 -14
- package/dist/node-runtime/{chunk-AY6CAJSL.js → chunk-UJOCPOMX.js} +6 -3
- package/dist/node-runtime/chunk-UP2XBVH5.js +40 -0
- package/dist/node-runtime/{chunk-WJVFOIB5.js → chunk-UQUCFAJ3.js} +1 -1
- package/dist/node-runtime/chunk-URD2SLIT.js +1019 -0
- package/dist/node-runtime/chunk-US544NN6.js +13 -0
- package/dist/node-runtime/chunk-UWPJL22I.js +341 -0
- package/dist/node-runtime/chunk-V2A7CEXK.js +355 -0
- package/dist/node-runtime/chunk-VJPTNWAP.js +708 -0
- package/dist/node-runtime/{chunk-WKDK4C5P.js → chunk-VSSXXL36.js} +38 -164
- package/dist/node-runtime/{chunk-4I23VTC4.js → chunk-VWCE2HSZ.js} +21 -124
- package/dist/node-runtime/{chunk-CBGB57XT.js → chunk-WADV2VDS.js} +32 -1014
- package/dist/node-runtime/{chunk-GKLEQ3I4.js → chunk-XLTL257W.js} +126 -27
- package/dist/node-runtime/chunk-YPHAIRZT.js +10 -0
- package/dist/node-runtime/cli-runtime.js +2 -2
- package/dist/node-runtime/command-3JHHXOPX.js +45 -0
- package/dist/node-runtime/commands-2JVNFGMQ.js +36 -0
- package/dist/node-runtime/{commands-MV5KOZ64.js → commands-KAMO2T6P.js} +10 -10
- package/dist/node-runtime/config-RORQUQFG.js +20 -0
- package/dist/node-runtime/{customize-XEXL2DGQ.js → customize-VFJV3U6A.js} +2 -1
- package/dist/node-runtime/{direct-tool-executor-BK7CLEBX.js → direct-tool-executor-YAVOLDFY.js} +8 -8
- package/dist/node-runtime/{export-html-TEXVV5RP.js → export-html-KBFVV63J.js} +4 -3
- package/dist/node-runtime/{extension-input-O4HSAEM4.js → extension-input-K24TVKVW.js} +4 -4
- package/dist/node-runtime/{extension-selector-X5FCX43D.js → extension-selector-SPNF7EDR.js} +4 -4
- package/dist/node-runtime/{extract-XLQSJN4V.js → extract-EQJE7FZZ.js} +2 -2
- package/dist/node-runtime/{gateway-L4ANRTVE.js → gateway-VFO6SFKK.js} +275 -994
- package/dist/node-runtime/{gemini-search-U7SUMPQA.js → gemini-search-35OCRFLN.js} +1 -1
- package/dist/node-runtime/{gemini-url-context-PXWCBQHK.js → gemini-url-context-UQY3PHHW.js} +2 -2
- package/dist/node-runtime/index.js +105 -64
- package/dist/node-runtime/{init-3C7Z24OI.js → init-X2LIUB2H.js} +3 -3
- package/dist/node-runtime/{install-cli-EXMJQESX.js → install-cli-C3CF7O7N.js} +21 -82
- package/dist/node-runtime/interactive-mode-LOM6AIF6.js +72 -0
- package/dist/node-runtime/{interactive-view-ILS6TAN5.js → interactive-view-IDSCPPK7.js} +8 -8
- package/dist/node-runtime/lunr-browser-YNW7FTYX.js +87 -0
- package/dist/node-runtime/{lunr-cron-NNYTWTGF.js → lunr-cron-BKHGNBKT.js} +19 -5
- package/dist/node-runtime/main.js +45 -30
- package/dist/node-runtime/{memory-cap-3S4XRLNP.js → memory-cap-EL3KL4JJ.js} +2 -1
- package/dist/node-runtime/mobile-commands-HMP25WBC.js +32 -0
- package/dist/node-runtime/model-runtime-PLQKAG4B.js +16 -0
- package/dist/node-runtime/{model-tiers-NJLHUEGK.js → model-tiers-OU3U5CZG.js} +2 -1
- package/dist/node-runtime/{package-manager-cli-7RKSZGEN.js → package-manager-cli-VCK4E2RC.js} +23 -15
- package/dist/node-runtime/{pi-intercom-DDQMRNPJ.js → pi-intercom-HBPK5HSJ.js} +38 -34
- package/dist/node-runtime/{pi-mcp-adapter-GUFZWW54.js → pi-mcp-adapter-E6WULBKF.js} +4 -4
- package/dist/node-runtime/{pi-subagents-T5WMMLBB.js → pi-subagents-FEUDLJOE.js} +476 -412
- package/dist/node-runtime/{pi-web-access-2CQGFLT2.js → pi-web-access-WTGMNZ32.js} +15 -15
- package/dist/node-runtime/process-registry-4FAKZQOL.js +31 -0
- package/dist/node-runtime/{proxy-modes-V6YVFH3C.js → proxy-modes-OSQCWRBI.js} +9 -9
- package/dist/node-runtime/rpc-entry.js +46 -31
- package/dist/node-runtime/{rpc-mode-W5ZTLTMZ.js → rpc-mode-P5ODXPEG.js} +2 -2
- package/dist/node-runtime/runtime-4VA6JKNF.js +373 -0
- package/dist/node-runtime/{runtime-bridges-NJQERQ72.js → runtime-bridges-3XUQ46XW.js} +6 -5
- package/dist/node-runtime/service-ISSP6VHE.js +36 -0
- package/dist/node-runtime/session-handoff-HC7R5E24.js +33 -0
- package/dist/node-runtime/{session-manager-E7AREDTV.js → session-manager-CFN4UFM2.js} +2 -1
- package/dist/node-runtime/{session-selector-FJ7M2AIX.js → session-selector-LHRMJOKT.js} +5 -4
- package/dist/node-runtime/{settings-manager-GHPTUN7R.js → settings-manager-UUZ6NUXI.js} +8 -2
- package/dist/node-runtime/setup-JBKOLJ6F.js +18 -0
- package/dist/node-runtime/setup-NRXVZBLJ.js +155 -0
- package/dist/node-runtime/{subagent-executor-SRFC26SJ.js → subagent-executor-MLUMBWCP.js} +35 -63
- package/dist/node-runtime/theme-U7IGOA7O.js +68 -0
- package/dist/node-runtime/trust-manager-MMISNCYO.js +17 -0
- package/dist/node-runtime/{update-cli-L3JIBH2U.js → update-cli-4TP25CNW.js} +8 -2
- package/dist/node-runtime/usage-service-LFB2SWYV.js +37 -0
- package/dist/node-runtime/{video-extract-OYT5WKS5.js → video-extract-OOZHR7SU.js} +2 -2
- package/dist/node-runtime/{youtube-extract-TQYKGFGS.js → youtube-extract-FNPAUNHU.js} +6 -6
- package/docs/browser.md +86 -0
- package/docs/extensions.md +2 -0
- package/docs/features.md +99 -17
- package/docs/interactive-startup.md +2 -1
- package/docs/sessions.md +10 -0
- package/docs/settings.md +3 -1
- package/docs/tui.md +2 -0
- package/docs/usage.md +16 -0
- 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/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/package.json +7 -4
- package/scripts/install-browser.mjs +20 -0
- package/dist/node-runtime/agent-session-services-75JKASCW.js +0 -36
- package/dist/node-runtime/chunk-HQCKFM2O.js +0 -56
- package/dist/node-runtime/command-RBTRL55A.js +0 -13
- package/dist/node-runtime/interactive-mode-HPUNH7SV.js +0 -57
- package/dist/node-runtime/{chunk-UWQYRSYQ.js → chunk-YJMMG7C6.js} +25 -25
- package/dist/node-runtime/{mcp-panel-IIGMXQGP.js → mcp-panel-KTTFXJZ4.js} +3 -3
- package/dist/node-runtime/{src-BPQFJR76.js → src-IVPNZ2BX.js} +9 -9
|
@@ -3,11 +3,15 @@ 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, SUBAGENT_CONTROL_EVENT } from "../shared/types.js";
|
|
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 { ASYNC_DIR, 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 {
|
|
10
|
+
import { CHILD_DESCRIPTION_ENV, SUPERVISOR_PROGRESS_TYPE, SUPERVISOR_PROTOCOL_VERSION, SUPERVISOR_REQUEST_TYPE, legacySupervisorBody, readCommunication, resolveCommunicationPeer, supervisorProtocolAvailable } from "./communication.js";
|
|
11
|
+
import { renderCommunicationCall, renderCommunicationCard, renderCommunicationResult } from "../tui/communication.js";
|
|
12
|
+
import { stopRequestPath } from "../runs/background/control-channel.js";
|
|
13
|
+
import { readStatus } from "../shared/utils.js";
|
|
14
|
+
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";
|
|
11
15
|
const REQUESTS_DIR = "requests";
|
|
12
16
|
const REPLIES_DIR = "replies";
|
|
13
17
|
export const NATIVE_SUPERVISOR_TOOL_NAME = "subagent_supervisor";
|
|
@@ -27,12 +31,14 @@ const PARENT_ASK_DESCRIPTION = [
|
|
|
27
31
|
'Reply: { action: "reply", replyTo: "<requestId>", message: "..." }',
|
|
28
32
|
].join(" ");
|
|
29
33
|
const CHILD_CONTACT_DESCRIPTION = [
|
|
30
|
-
"Contact the
|
|
34
|
+
"Contact the supervisor for decisions outside your assigned authority, safety concerns, or blockers. Make reversible implementation choices within your scope yourself.",
|
|
35
|
+
"need_decision/interview_request wait for a reply: state the blocked decision, evidence, and recommended choice. Consolidate related questions; continue independent work before opening a blocking request.",
|
|
36
|
+
"Return one self-contained final report with outcomes, verification, blockers, and artifact paths; the runtime delivers it. Routine work already appears in activity indicators.",
|
|
31
37
|
"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
38
|
"Do not open a blocking need_decision while a parent question is already outstanding for this child.",
|
|
33
39
|
].join(" ");
|
|
34
40
|
const ContactSupervisorParamsSchema = Type.Object({
|
|
35
|
-
reason: Type.Optional(Type.String({ enum: ["need_decision", "interview_request", "progress_update"] })),
|
|
41
|
+
reason: Type.Optional(Type.String({ enum: ["need_decision", "interview_request", "progress_update", "handoff"] })),
|
|
36
42
|
message: Type.Optional(Type.String()),
|
|
37
43
|
interview: Type.Optional(Type.Unsafe({ type: "object", additionalProperties: true })),
|
|
38
44
|
action: Type.Optional(Type.String({ enum: ["reply"] })),
|
|
@@ -85,7 +91,9 @@ function readChildMetadata() {
|
|
|
85
91
|
childIndex: Number(rawIndex),
|
|
86
92
|
orchestratorTarget: readTextEnv(SUBAGENT_ORCHESTRATOR_TARGET_ENV),
|
|
87
93
|
orchestratorSessionId,
|
|
94
|
+
supervisorSessionId: readTextEnv(SUBAGENT_SUPERVISOR_SESSION_ID_ENV),
|
|
88
95
|
childTarget: readTextEnv("PI_SUBAGENT_INTERCOM_SESSION_NAME"),
|
|
96
|
+
description: readTextEnv(CHILD_DESCRIPTION_ENV),
|
|
89
97
|
};
|
|
90
98
|
}
|
|
91
99
|
function readChildQuestionOwner(metadata = readChildMetadata()) {
|
|
@@ -113,6 +121,9 @@ function answerParentQuestion(params) {
|
|
|
113
121
|
const message = params.message?.trim();
|
|
114
122
|
if (!message)
|
|
115
123
|
throw new Error("message is required for supervisor question replies.");
|
|
124
|
+
const question = readSupervisorQuestion(metadata.channelDir, replyTo);
|
|
125
|
+
if (question?.parentSessionId !== (metadata.supervisorSessionId ?? metadata.orchestratorSessionId))
|
|
126
|
+
throw new Error("Question belongs to a different supervisor session.");
|
|
116
127
|
const answered = answerSupervisorQuestion(metadata.channelDir, replyTo, message, owner);
|
|
117
128
|
return {
|
|
118
129
|
content: [{ type: "text", text: `Replied to parent question ${answered.id}. Continue the assigned task.` }],
|
|
@@ -120,10 +131,13 @@ function answerParentQuestion(params) {
|
|
|
120
131
|
replyTo: answered.id,
|
|
121
132
|
state: supervisorQuestionPublicState(answered),
|
|
122
133
|
answered: true,
|
|
134
|
+
communication: { direction: "to", peer: "Supervisor", kind: "reply", message },
|
|
123
135
|
},
|
|
124
136
|
};
|
|
125
137
|
}
|
|
126
138
|
function reasonHeading(reason) {
|
|
139
|
+
if (reason === "handoff")
|
|
140
|
+
return "Subagent dependency handoff.";
|
|
127
141
|
if (reason === "interview_request")
|
|
128
142
|
return "Subagent requests a structured supervisor interview.";
|
|
129
143
|
if (reason === "progress_update")
|
|
@@ -149,6 +163,39 @@ function formatChildMessage(input) {
|
|
|
149
163
|
}
|
|
150
164
|
return lines.join("\n").trimEnd();
|
|
151
165
|
}
|
|
166
|
+
function communicationKind(reason) {
|
|
167
|
+
return reason === "progress_update" ? "progress" : reason === "handoff" ? "handoff" : reason === "interview_request" ? "interview" : "request";
|
|
168
|
+
}
|
|
169
|
+
function communicationBody(message, interview, protocolVersion) {
|
|
170
|
+
const body = protocolVersion === SUPERVISOR_PROTOCOL_VERSION ? message : legacySupervisorBody(message);
|
|
171
|
+
return interview !== undefined && protocolVersion === SUPERVISOR_PROTOCOL_VERSION ? `${body}\n\n${JSON.stringify(interview, null, 2)}` : body;
|
|
172
|
+
}
|
|
173
|
+
function requestCommunication(request, state) {
|
|
174
|
+
return {
|
|
175
|
+
direction: "from",
|
|
176
|
+
peer: resolveCommunicationPeer(state, request.runId, request.childIndex, request.agent, request.description),
|
|
177
|
+
message: communicationBody(request.message, request.interview, request.protocolVersion),
|
|
178
|
+
kind: communicationKind(request.reason),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
export function registerSupervisorRenderers(pi, state) {
|
|
182
|
+
for (const customType of [SUPERVISOR_REQUEST_TYPE, SUBAGENT_SUPERVISOR_ANSWER_TYPE]) {
|
|
183
|
+
pi.registerMessageRenderer(customType, (message, options, theme) => {
|
|
184
|
+
const details = message.details;
|
|
185
|
+
const communication = readCommunication(details?.communication) ?? {
|
|
186
|
+
direction: "from",
|
|
187
|
+
peer: details?.runId ? resolveCommunicationPeer(state, details.runId, details.childIndex ?? 0, details.childId ?? details.agent) : "Subagent",
|
|
188
|
+
message: legacySupervisorBody(typeof message.content === "string" ? message.content : message.content.filter((part) => part.type === "text").map((part) => part.text).join("\n")),
|
|
189
|
+
kind: customType === SUBAGENT_SUPERVISOR_ANSWER_TYPE ? "answer" : communicationKind(details?.reason),
|
|
190
|
+
};
|
|
191
|
+
return renderCommunicationCard(communication, options.expanded, theme);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
pi.registerEntryRenderer(SUPERVISOR_PROGRESS_TYPE, (entry, options, theme) => {
|
|
195
|
+
const communication = readCommunication(entry.data?.communication);
|
|
196
|
+
return communication ? renderCommunicationCard(communication, options.expanded, theme) : undefined;
|
|
197
|
+
});
|
|
198
|
+
}
|
|
152
199
|
function parseStructuredReply(message) {
|
|
153
200
|
const trimmed = message.trim();
|
|
154
201
|
const fenced = trimmed.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i)?.[1]?.trim();
|
|
@@ -210,21 +257,29 @@ async function sendSupervisorRequest(params, signal) {
|
|
|
210
257
|
throw new Error("Native supervisor channel is not available for this subagent.");
|
|
211
258
|
if (!params.reason)
|
|
212
259
|
throw new Error("reason is required for supervisor contact.");
|
|
213
|
-
if (
|
|
260
|
+
if (signal?.aborted)
|
|
261
|
+
throw new Error("Supervisor request cancelled.");
|
|
262
|
+
const protocolVersion = supervisorProtocolAvailable() ? SUPERVISOR_PROTOCOL_VERSION : undefined;
|
|
263
|
+
if (params.reason === "handoff" && !protocolVersion)
|
|
264
|
+
throw new Error("This supervisor uses the legacy protocol. Send actionable findings with progress_update instead.");
|
|
265
|
+
const expectsReply = params.reason === "need_decision" || params.reason === "interview_request";
|
|
266
|
+
if (expectsReply && hasOutstandingQuestionForChild(metadata.channelDir, metadata.childIndex, metadata.agent)) {
|
|
214
267
|
throw new Error("A parent question is already outstanding for this child. Answer it with action='reply' before opening a blocking supervisor request.");
|
|
215
268
|
}
|
|
216
|
-
if (
|
|
217
|
-
throw new Error("message is required for supervisor
|
|
269
|
+
if (!params.message?.trim() && params.reason !== "interview_request") {
|
|
270
|
+
throw new Error("message is required for supervisor contact.");
|
|
218
271
|
}
|
|
219
272
|
ensureSupervisorChannelDir(metadata.channelDir);
|
|
220
273
|
const requestId = randomUUID();
|
|
221
|
-
const expectsReply = params.reason !== "progress_update";
|
|
222
274
|
const createdAt = Date.now();
|
|
223
275
|
const replyDeadline = createdAt + askTimeoutMs();
|
|
224
276
|
const expiresAt = expectsReply ? replyDeadline : undefined;
|
|
225
|
-
const message = formatChildMessage({ ...metadata, reason: params.reason, message: params.message, interview: params.interview });
|
|
277
|
+
const message = protocolVersion ? params.message?.trim() || "Structured supervisor input requested." : formatChildMessage({ ...metadata, reason: params.reason, message: params.message, interview: params.interview });
|
|
278
|
+
const communication = { direction: "to", peer: "Supervisor", kind: communicationKind(params.reason), message: communicationBody(message, params.interview, protocolVersion) };
|
|
226
279
|
const request = {
|
|
227
280
|
type: "subagent.supervisor.request",
|
|
281
|
+
...(protocolVersion ? { protocolVersion } : {}),
|
|
282
|
+
...(metadata.description ? { description: metadata.description } : {}),
|
|
228
283
|
id: requestId,
|
|
229
284
|
createdAt,
|
|
230
285
|
...(expiresAt !== undefined ? { expiresAt } : {}),
|
|
@@ -233,6 +288,7 @@ async function sendSupervisorRequest(params, signal) {
|
|
|
233
288
|
expectsReply,
|
|
234
289
|
...(metadata.orchestratorTarget ? { orchestratorTarget: metadata.orchestratorTarget } : {}),
|
|
235
290
|
...(metadata.orchestratorSessionId ? { orchestratorSessionId: metadata.orchestratorSessionId } : {}),
|
|
291
|
+
...(metadata.supervisorSessionId ? { supervisorSessionId: metadata.supervisorSessionId } : {}),
|
|
236
292
|
runId: metadata.runId,
|
|
237
293
|
agent: metadata.agent,
|
|
238
294
|
childIndex: metadata.childIndex,
|
|
@@ -250,13 +306,13 @@ async function sendSupervisorRequest(params, signal) {
|
|
|
250
306
|
}
|
|
251
307
|
if (!expectsReply) {
|
|
252
308
|
return {
|
|
253
|
-
content: [{ type: "text", text: "Supervisor progress update queued." }],
|
|
254
|
-
details: {
|
|
309
|
+
content: [{ type: "text", text: params.reason === "handoff" ? "Dependency handoff queued. Continue independent work." : protocolVersion ? "Progress recorded for the UI only; the supervisor model will not receive it." : "Supervisor progress update queued." }],
|
|
310
|
+
details: { queued: true, requestId, reason: params.reason, communication },
|
|
255
311
|
};
|
|
256
312
|
}
|
|
257
313
|
try {
|
|
258
314
|
const reply = await waitForReply(metadata.channelDir, requestId, replyDeadline, signal);
|
|
259
|
-
const details = { requestId, reason: params.reason };
|
|
315
|
+
const details = { requestId, reason: params.reason, communication, response: reply.message };
|
|
260
316
|
if (params.reason === "interview_request") {
|
|
261
317
|
const structured = parseStructuredReply(reply.message);
|
|
262
318
|
if (structured.error)
|
|
@@ -290,8 +346,16 @@ export function registerNativeSupervisorClient(pi, options = {}) {
|
|
|
290
346
|
const tool = {
|
|
291
347
|
name: "contact_supervisor",
|
|
292
348
|
label: "Contact Supervisor",
|
|
293
|
-
description: CHILD_CONTACT_DESCRIPTION
|
|
294
|
-
|
|
349
|
+
description: `${CHILD_CONTACT_DESCRIPTION} ${supervisorProtocolAvailable()
|
|
350
|
+
? "handoff delivers actionable dependency findings or corrections without waiting: state what changes and consolidate evidence or reference one artifact. progress_update is UI-only and never reaches the supervisor model."
|
|
351
|
+
: "This legacy supervisor delivers progress_update to its model. Reserve it for actionable dependency findings or corrections."}`,
|
|
352
|
+
parameters: supervisorProtocolAvailable() ? ContactSupervisorParamsSchema : Type.Object({ ...ContactSupervisorParamsSchema.properties, reason: Type.Optional(Type.String({ enum: ["need_decision", "interview_request", "progress_update"] })) }, { additionalProperties: false }),
|
|
353
|
+
renderCall(args, theme, context) {
|
|
354
|
+
return renderCommunicationCall("contact_supervisor", args, theme, context, { direction: "to", peer: "Supervisor", kind: args.action === "reply" ? "reply" : communicationKind(args.reason), message: communicationBody(args.message ?? "", args.interview, SUPERVISOR_PROTOCOL_VERSION) });
|
|
355
|
+
},
|
|
356
|
+
renderResult(result, options, theme, context) {
|
|
357
|
+
return renderCommunicationResult(result.content, result.details, options.expanded, context.isError, theme);
|
|
358
|
+
},
|
|
295
359
|
execute(_id, params, signal) {
|
|
296
360
|
return sendSupervisorRequest(params, signal);
|
|
297
361
|
},
|
|
@@ -302,8 +366,14 @@ export function registerNativeSupervisorClient(pi, options = {}) {
|
|
|
302
366
|
const tool = {
|
|
303
367
|
name: "intercom",
|
|
304
368
|
label: "Intercom",
|
|
305
|
-
description: "
|
|
369
|
+
description: "Supervisor-only fallback; sibling discovery and sibling messaging are unavailable. Use contact_supervisor for decisions, replies, and dependency handoffs. list reports no sibling sessions; ask blocks for a supervisor decision; send is progress only.",
|
|
306
370
|
parameters: IntercomParamsSchema,
|
|
371
|
+
renderCall(args, theme, context) {
|
|
372
|
+
return renderCommunicationCall("intercom", args, theme, context, args.message ? { direction: "to", peer: "Supervisor", kind: args.action === "ask" ? "request" : "progress", message: args.message } : undefined);
|
|
373
|
+
},
|
|
374
|
+
renderResult(result, options, theme, context) {
|
|
375
|
+
return renderCommunicationResult(result.content, result.details, options.expanded, context.isError, theme);
|
|
376
|
+
},
|
|
307
377
|
async execute(_id, params, signal) {
|
|
308
378
|
const action = params.action;
|
|
309
379
|
if (action === "status")
|
|
@@ -325,9 +395,19 @@ function parseRequestFile(file, channelDir) {
|
|
|
325
395
|
const parsed = JSON.parse(fs.readFileSync(file, "utf-8"));
|
|
326
396
|
if (parsed.type !== "subagent.supervisor.request")
|
|
327
397
|
return undefined;
|
|
398
|
+
if (parsed.supervisorSessionId !== undefined && (typeof parsed.supervisorSessionId !== "string" || !parsed.supervisorSessionId.trim()))
|
|
399
|
+
return undefined;
|
|
328
400
|
if (typeof parsed.id !== "string" || !parsed.id)
|
|
329
401
|
return undefined;
|
|
330
|
-
if (parsed.reason !== "need_decision" && parsed.reason !== "interview_request" && parsed.reason !== "progress_update")
|
|
402
|
+
if (parsed.reason !== "need_decision" && parsed.reason !== "interview_request" && parsed.reason !== "progress_update" && parsed.reason !== "handoff")
|
|
403
|
+
return undefined;
|
|
404
|
+
if (parsed.protocolVersion !== undefined && parsed.protocolVersion !== SUPERVISOR_PROTOCOL_VERSION)
|
|
405
|
+
return undefined;
|
|
406
|
+
if (parsed.protocolVersion === SUPERVISOR_PROTOCOL_VERSION && parsed.expectsReply !== (parsed.reason === "need_decision" || parsed.reason === "interview_request"))
|
|
407
|
+
return undefined;
|
|
408
|
+
if (parsed.reason === "handoff" && parsed.protocolVersion !== SUPERVISOR_PROTOCOL_VERSION)
|
|
409
|
+
return undefined;
|
|
410
|
+
if (parsed.description !== undefined && typeof parsed.description !== "string")
|
|
331
411
|
return undefined;
|
|
332
412
|
if (typeof parsed.message !== "string" || !parsed.message)
|
|
333
413
|
return undefined;
|
|
@@ -348,7 +428,7 @@ export function hasPendingBlockingSupervisorRequest(runId, sessionId, now = Date
|
|
|
348
428
|
continue;
|
|
349
429
|
if (request.runId !== runId)
|
|
350
430
|
continue;
|
|
351
|
-
if (sessionId && request.
|
|
431
|
+
if (sessionId && (request.supervisorSessionId ?? request.orchestratorSessionId) !== sessionId)
|
|
352
432
|
continue;
|
|
353
433
|
if (fs.existsSync(replyPath(request.channelDir, request.id)))
|
|
354
434
|
continue;
|
|
@@ -481,9 +561,19 @@ function currentContextSessionId(state, ctx) {
|
|
|
481
561
|
}
|
|
482
562
|
return state.currentSessionId ?? undefined;
|
|
483
563
|
}
|
|
564
|
+
function currentSupervisorSessionId(state, ctx) {
|
|
565
|
+
try {
|
|
566
|
+
return ctx.sessionManager.getSessionFile?.() ?? currentContextSessionId(state, ctx);
|
|
567
|
+
}
|
|
568
|
+
catch {
|
|
569
|
+
return state.currentSessionId ?? undefined;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
484
572
|
function requestMatchesContext(request, state, ctx) {
|
|
485
|
-
const currentSessionId =
|
|
486
|
-
|
|
573
|
+
const currentSessionId = request.supervisorSessionId !== undefined
|
|
574
|
+
? currentSupervisorSessionId(state, ctx)
|
|
575
|
+
: currentContextSessionId(state, ctx);
|
|
576
|
+
return Boolean(currentSessionId && (request.supervisorSessionId ?? request.orchestratorSessionId) === currentSessionId);
|
|
487
577
|
}
|
|
488
578
|
function removeRequestFile(file) {
|
|
489
579
|
try {
|
|
@@ -499,21 +589,24 @@ function requestExpiresAt(request, now) {
|
|
|
499
589
|
return expiresAt;
|
|
500
590
|
return Number.isFinite(request.createdAt) ? request.createdAt + askTimeoutMs() : now;
|
|
501
591
|
}
|
|
502
|
-
function
|
|
592
|
+
function requestRunState(request, state) {
|
|
503
593
|
if (state.foregroundControls.has(request.runId))
|
|
504
|
-
return
|
|
594
|
+
return "active";
|
|
505
595
|
const foregroundRun = state.foregroundRuns?.get(request.runId);
|
|
506
596
|
const foregroundChild = foregroundRun?.children.find((child) => child.index === request.childIndex && child.agent === request.agent)
|
|
507
597
|
?? foregroundRun?.children[request.childIndex];
|
|
508
598
|
if (foregroundChild)
|
|
509
|
-
return foregroundChild.status
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
599
|
+
return foregroundChild.status === "stopped" ? "stopped" : foregroundChild.status === "detached" ? "active" : "inactive";
|
|
600
|
+
const job = state.asyncJobs.get(request.runId) ?? state.fleetJobs?.get(request.runId);
|
|
601
|
+
const asyncDir = job?.asyncDir ?? path.join(ASYNC_DIR, safeSegment(request.runId));
|
|
602
|
+
const status = readStatus(asyncDir);
|
|
603
|
+
const runStatus = status?.state ?? job?.status;
|
|
604
|
+
const stepStatus = (status?.steps ?? job?.steps)?.[request.childIndex]?.status;
|
|
605
|
+
if (fs.existsSync(stopRequestPath(asyncDir)) || runStatus === "stopped" || job?.status === "stopped" || status?.stopped || stepStatus === "stopped")
|
|
606
|
+
return "stopped";
|
|
607
|
+
if (["complete", "failed", "paused"].includes(runStatus ?? "") || ["complete", "completed", "failed", "paused"].includes(stepStatus ?? ""))
|
|
608
|
+
return "inactive";
|
|
609
|
+
return "active";
|
|
517
610
|
}
|
|
518
611
|
function requestLifecycle(request, state, ctx, now) {
|
|
519
612
|
if (ctx && !requestMatchesContext(request, state, ctx))
|
|
@@ -524,7 +617,8 @@ function requestLifecycle(request, state, ctx, now) {
|
|
|
524
617
|
return "resolved";
|
|
525
618
|
if (request.expectsReply && now > requestExpiresAt(request, now))
|
|
526
619
|
return "expired";
|
|
527
|
-
|
|
620
|
+
const runState = requestRunState(request, state);
|
|
621
|
+
if (runState === "stopped" || (request.expectsReply && runState === "inactive"))
|
|
528
622
|
return "inactive";
|
|
529
623
|
return "pending";
|
|
530
624
|
}
|
|
@@ -546,8 +640,10 @@ function formatPendingLine(request) {
|
|
|
546
640
|
const replyHint = request.expectsReply ? ` Reply: ${NATIVE_SUPERVISOR_TOOL_NAME}({ action: "reply", replyTo: "${request.id}", message: "..." })` : "";
|
|
547
641
|
return `- ${request.id}: ${request.agent} [${request.runId}#${request.childIndex}] ${request.reason}.${replyHint}`;
|
|
548
642
|
}
|
|
549
|
-
function requestVisibleText(request) {
|
|
550
|
-
const lines = [
|
|
643
|
+
function requestVisibleText(request, communication) {
|
|
644
|
+
const lines = [`From: ${communication.peer}`, "", communication.message];
|
|
645
|
+
if (request.reason === "interview_request")
|
|
646
|
+
lines.push("", "Reply with JSON matching the requested interview shape.");
|
|
551
647
|
if (request.expectsReply) {
|
|
552
648
|
lines.push("", `Reply with: ${NATIVE_SUPERVISOR_TOOL_NAME}({ action: "reply", replyTo: "${request.id}", message: "..." })`);
|
|
553
649
|
}
|
|
@@ -605,6 +701,14 @@ function buildParentIntercomTool(pending, state, name = "intercom") {
|
|
|
605
701
|
label: name === "intercom" ? "Intercom" : "Subagent Supervisor",
|
|
606
702
|
description: PARENT_ASK_DESCRIPTION,
|
|
607
703
|
parameters: ParentSupervisorParamsSchema,
|
|
704
|
+
renderCall(args, theme, context) {
|
|
705
|
+
const request = args.action === "reply" ? pending.get(args.replyTo) : undefined;
|
|
706
|
+
const peer = request ? requestCommunication(request, state).peer : args.id ? resolveCommunicationPeer(state, args.id, args.index ?? 0, args.childId) : "Subagent";
|
|
707
|
+
return renderCommunicationCall(name, args, theme, context, args.message ? { direction: "to", peer, message: args.message, kind: args.action === "ask" ? "question" : "reply" } : undefined);
|
|
708
|
+
},
|
|
709
|
+
renderResult(result, options, theme, context) {
|
|
710
|
+
return renderCommunicationResult(result.content, result.details, options.expanded, context.isError, theme);
|
|
711
|
+
},
|
|
608
712
|
async execute(_id, params) {
|
|
609
713
|
refreshPendingRequests(pending, state, state.lastUiContext ?? undefined);
|
|
610
714
|
const input = params;
|
|
@@ -619,7 +723,7 @@ function buildParentIntercomTool(pending, state, name = "intercom") {
|
|
|
619
723
|
const request = resolvePendingRequest(pending, input);
|
|
620
724
|
writeReply(request, input.message ?? "");
|
|
621
725
|
pending.delete(request.id);
|
|
622
|
-
return { content: [{ type: "text", text: `Replied to
|
|
726
|
+
return { content: [{ type: "text", text: `Replied to ${requestCommunication(request, state).peer}.` }], details: { replyTo: request.id, runId: request.runId, agent: request.agent, communication: { ...requestCommunication(request, state), direction: "to", kind: "reply", message: input.message } } };
|
|
623
727
|
}
|
|
624
728
|
if (input.action === "ask") {
|
|
625
729
|
return askRunningAsyncChild({
|
|
@@ -642,14 +746,14 @@ function buildParentIntercomTool(pending, state, name = "intercom") {
|
|
|
642
746
|
};
|
|
643
747
|
}
|
|
644
748
|
function questionMatchesParentContext(question, state, ctx) {
|
|
645
|
-
const sessionId =
|
|
749
|
+
const sessionId = currentSupervisorSessionId(state, ctx);
|
|
646
750
|
if (!sessionId || question.parentSessionId !== sessionId)
|
|
647
751
|
return false;
|
|
648
752
|
if ((state.sessionGeneration ?? 0) !== question.parentGeneration)
|
|
649
753
|
return false;
|
|
650
754
|
return true;
|
|
651
755
|
}
|
|
652
|
-
function notifyQuestionTerminal(pi, question, channelDir) {
|
|
756
|
+
function notifyQuestionTerminal(pi, question, channelDir, state) {
|
|
653
757
|
if (!supervisorQuestionIsTerminal(question) || question.notifiedAt)
|
|
654
758
|
return;
|
|
655
759
|
pi.events?.emit(SUBAGENT_QUESTION_EVENT, {
|
|
@@ -661,22 +765,24 @@ function notifyQuestionTerminal(pi, question, channelDir) {
|
|
|
661
765
|
return;
|
|
662
766
|
if (!claimQuestionNotification(channelDir, question.id))
|
|
663
767
|
return;
|
|
664
|
-
const
|
|
768
|
+
const outcome = supervisorQuestionPublicState(question);
|
|
769
|
+
const communication = { direction: "from", peer: question.childDescription ?? resolveCommunicationPeer(state, question.runId, question.childIndex, question.childId), message: question.answer ?? question.cancelReason ?? outcome, kind: "answer" };
|
|
665
770
|
pi.sendMessage({
|
|
666
771
|
customType: SUBAGENT_SUPERVISOR_ANSWER_TYPE,
|
|
667
772
|
content: formatSupervisorQuestionAnswer(question),
|
|
668
|
-
display:
|
|
773
|
+
display: outcome === "answered",
|
|
669
774
|
details: {
|
|
670
775
|
questionId: question.id,
|
|
671
|
-
state,
|
|
776
|
+
state: outcome,
|
|
777
|
+
communication,
|
|
672
778
|
runId: question.runId,
|
|
673
779
|
childIndex: question.childIndex,
|
|
674
780
|
childId: question.childId,
|
|
675
781
|
reason: question.reason,
|
|
676
|
-
answered:
|
|
782
|
+
answered: outcome === "answered",
|
|
677
783
|
delivered: Boolean(question.deliveredAt),
|
|
678
784
|
},
|
|
679
|
-
}, { triggerTurn:
|
|
785
|
+
}, { triggerTurn: outcome === "answered" });
|
|
680
786
|
}
|
|
681
787
|
function pollSupervisorQuestions(pi, state, ctx) {
|
|
682
788
|
for (const channelDir of listSupervisorChannelDirs()) {
|
|
@@ -684,13 +790,14 @@ function pollSupervisorQuestions(pi, state, ctx) {
|
|
|
684
790
|
if (!questionMatchesParentContext(question, state, ctx))
|
|
685
791
|
continue;
|
|
686
792
|
const current = reconcileAsyncQuestion(channelDir, question, state);
|
|
687
|
-
notifyQuestionTerminal(pi, current, channelDir);
|
|
793
|
+
notifyQuestionTerminal(pi, current, channelDir, state);
|
|
688
794
|
}
|
|
689
795
|
}
|
|
690
796
|
}
|
|
691
797
|
export function createNativeSupervisorChannel(pi, state) {
|
|
692
798
|
const pending = new Map();
|
|
693
799
|
const seenFiles = new Set();
|
|
800
|
+
const deliveredRequests = new Set();
|
|
694
801
|
let poller;
|
|
695
802
|
let lastStaleCleanupAt = 0;
|
|
696
803
|
const registerParentTools = () => {
|
|
@@ -749,25 +856,37 @@ export function createNativeSupervisorChannel(pi, state) {
|
|
|
749
856
|
cleanupRequestLifecycle(request, lifecycle);
|
|
750
857
|
continue;
|
|
751
858
|
}
|
|
752
|
-
seenFiles.add(file);
|
|
753
859
|
if (request.expectsReply)
|
|
754
860
|
pending.set(request.id, request);
|
|
861
|
+
if (deliveredRequests.has(request.id)) {
|
|
862
|
+
seenFiles.add(file);
|
|
863
|
+
continue;
|
|
864
|
+
}
|
|
865
|
+
const communication = requestCommunication(request, state);
|
|
866
|
+
const details = {
|
|
867
|
+
id: request.id,
|
|
868
|
+
reason: request.reason,
|
|
869
|
+
expectsReply: request.expectsReply,
|
|
870
|
+
runId: request.runId,
|
|
871
|
+
agent: request.agent,
|
|
872
|
+
childIndex: request.childIndex,
|
|
873
|
+
communication,
|
|
874
|
+
};
|
|
875
|
+
if (request.reason === "progress_update" && request.protocolVersion === SUPERVISOR_PROTOCOL_VERSION) {
|
|
876
|
+
pi.appendEntry(SUPERVISOR_PROGRESS_TYPE, details);
|
|
877
|
+
}
|
|
755
878
|
else {
|
|
756
|
-
|
|
879
|
+
pi.sendMessage({
|
|
880
|
+
customType: SUPERVISOR_REQUEST_TYPE,
|
|
881
|
+
content: requestVisibleText(request, communication),
|
|
882
|
+
display: true,
|
|
883
|
+
details,
|
|
884
|
+
}, { triggerTurn: request.expectsReply || request.reason === "handoff" });
|
|
757
885
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
details: {
|
|
763
|
-
id: request.id,
|
|
764
|
-
reason: request.reason,
|
|
765
|
-
expectsReply: request.expectsReply,
|
|
766
|
-
runId: request.runId,
|
|
767
|
-
agent: request.agent,
|
|
768
|
-
childIndex: request.childIndex,
|
|
769
|
-
},
|
|
770
|
-
});
|
|
886
|
+
deliveredRequests.add(request.id);
|
|
887
|
+
seenFiles.add(file);
|
|
888
|
+
if (!request.expectsReply)
|
|
889
|
+
removeRequestFile(request.requestFile);
|
|
771
890
|
if (request.expectsReply) {
|
|
772
891
|
const job = state.asyncJobs.get(request.runId);
|
|
773
892
|
if (job)
|
|
@@ -794,6 +913,12 @@ export function createNativeSupervisorChannel(pi, state) {
|
|
|
794
913
|
if (poller)
|
|
795
914
|
return;
|
|
796
915
|
registerParentTools();
|
|
916
|
+
for (const entry of state.lastUiContext?.sessionManager.getBranch?.() ?? []) {
|
|
917
|
+
const data = entry.type === "custom_message" && entry.customType === SUPERVISOR_REQUEST_TYPE ? entry.details
|
|
918
|
+
: entry.type === "custom" && entry.customType === SUPERVISOR_PROGRESS_TYPE ? entry.data : undefined;
|
|
919
|
+
if (data && typeof data === "object" && "id" in data && typeof data.id === "string")
|
|
920
|
+
deliveredRequests.add(data.id);
|
|
921
|
+
}
|
|
797
922
|
poll();
|
|
798
923
|
poller = setInterval(poll, CHANNEL_POLL_MS);
|
|
799
924
|
poller.unref?.();
|
|
@@ -805,6 +930,7 @@ export function createNativeSupervisorChannel(pi, state) {
|
|
|
805
930
|
poller = undefined;
|
|
806
931
|
pending.clear();
|
|
807
932
|
seenFiles.clear();
|
|
933
|
+
deliveredRequests.clear();
|
|
808
934
|
},
|
|
809
935
|
pending,
|
|
810
936
|
cancelOwnedQuestions,
|
|
@@ -816,7 +942,7 @@ export function isPendingQuestionForCurrentChild(questionId) {
|
|
|
816
942
|
const owner = readChildQuestionOwner(metadata);
|
|
817
943
|
if (!metadata || !owner)
|
|
818
944
|
return false;
|
|
819
|
-
return pendingSupervisorQuestionsForDelivery(metadata.channelDir, owner).some((question) => question.id === questionId && question.parentSessionId === metadata.orchestratorSessionId);
|
|
945
|
+
return pendingSupervisorQuestionsForDelivery(metadata.channelDir, owner).some((question) => question.id === questionId && question.parentSessionId === (metadata.supervisorSessionId ?? metadata.orchestratorSessionId));
|
|
820
946
|
}
|
|
821
947
|
export function markDeliveredSupervisorQuestionFromChild(message) {
|
|
822
948
|
const match = message.match(/Parent question \(([^)\s]+)\)/);
|
|
@@ -826,6 +952,8 @@ export function markDeliveredSupervisorQuestionFromChild(message) {
|
|
|
826
952
|
const owner = readChildQuestionOwner(metadata);
|
|
827
953
|
if (!metadata || !owner)
|
|
828
954
|
return;
|
|
955
|
+
if (!isPendingQuestionForCurrentChild(match[1]))
|
|
956
|
+
return;
|
|
829
957
|
try {
|
|
830
958
|
markSupervisorQuestionDelivered(metadata.channelDir, match[1], owner);
|
|
831
959
|
}
|