@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,7 +3,7 @@ import { randomUUID } from "crypto";
|
|
|
3
3
|
import { Type } from "typebox";
|
|
4
4
|
import { Text } from "@ashx-j/lunr-tui";
|
|
5
5
|
import { IntercomClient } from "./broker/client.js";
|
|
6
|
-
import { spawnBrokerIfNeeded } from "./broker/spawn.js";
|
|
6
|
+
import { isNativeSupervisorChannelActive, spawnBrokerIfNeeded } from "./broker/spawn.js";
|
|
7
7
|
import { SessionListOverlay } from "./ui/session-list.js";
|
|
8
8
|
import { ComposeOverlay } from "./ui/compose.js";
|
|
9
9
|
import { InlineMessageComponent } from "./ui/inline-message.js";
|
|
@@ -310,7 +310,8 @@ function parseSubagentIntercomPayload(payload) {
|
|
|
310
310
|
return null;
|
|
311
311
|
}
|
|
312
312
|
const requestId = typeof record.requestId === "string" ? record.requestId : undefined;
|
|
313
|
-
|
|
313
|
+
const ownerNotificationSessionId = typeof record.ownerNotificationSessionId === "string" ? record.ownerNotificationSessionId : undefined;
|
|
314
|
+
return { to: record.to, message: record.message, ...(requestId ? { requestId } : {}), ...(ownerNotificationSessionId ? { ownerNotificationSessionId } : {}) };
|
|
314
315
|
}
|
|
315
316
|
function resolveIntercomPresenceName(sessionName, sessionId) {
|
|
316
317
|
const trimmedName = sessionName?.trim();
|
|
@@ -875,6 +876,9 @@ export default function piIntercomExtension(pi) {
|
|
|
875
876
|
agentRunning = false;
|
|
876
877
|
activeTools.clear();
|
|
877
878
|
startNamePoll();
|
|
879
|
+
if (isNativeSupervisorChannelActive()) {
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
878
882
|
const startupGeneration = runtimeGeneration;
|
|
879
883
|
startupConnectTimer = setTimeout(() => {
|
|
880
884
|
startupConnectTimer = null;
|
|
@@ -899,67 +903,70 @@ export default function piIntercomExtension(pi) {
|
|
|
899
903
|
...(error ? { error: getErrorMessage(error) } : {}),
|
|
900
904
|
});
|
|
901
905
|
}
|
|
906
|
+
const resultDeliveries = new Map();
|
|
907
|
+
const acknowledgedResults = [];
|
|
902
908
|
function relaySubagentIntercomPayload(payload, options) {
|
|
903
909
|
const parsed = parseSubagentIntercomPayload(payload);
|
|
904
910
|
if (!parsed)
|
|
905
911
|
return;
|
|
906
912
|
const relayGeneration = runtimeGeneration;
|
|
907
|
-
|
|
908
|
-
const
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
if (currentSessionTargetMatches(parsed.to)) {
|
|
913
|
-
deliverLocalSubagentRelayMessage(options.sender, options.status, parsed.message);
|
|
914
|
-
if (options.acknowledge)
|
|
915
|
-
emitResultDelivery(parsed.requestId, true);
|
|
916
|
-
return;
|
|
917
|
-
}
|
|
918
|
-
let activeClient;
|
|
919
|
-
let target;
|
|
920
|
-
try {
|
|
921
|
-
activeClient = await ensureConnected("background");
|
|
922
|
-
target = await resolveSessionTarget(activeClient, parsed.to) ?? parsed.to;
|
|
923
|
-
}
|
|
924
|
-
catch (error) {
|
|
925
|
-
if (!relayStillLive())
|
|
926
|
-
return;
|
|
927
|
-
recordSubagentDeliveryError(options.errorEntryType, parsed.to, parsed.message, error);
|
|
928
|
-
if (options.acknowledge)
|
|
929
|
-
emitResultDelivery(parsed.requestId, false, error);
|
|
930
|
-
return;
|
|
931
|
-
}
|
|
932
|
-
if (!relayStillLive()) {
|
|
933
|
-
return;
|
|
934
|
-
}
|
|
935
|
-
if (currentSessionTargetMatches(parsed.to, target, activeClient)) {
|
|
936
|
-
deliverLocalSubagentRelayMessage(options.sender, options.status, parsed.message);
|
|
937
|
-
if (options.acknowledge)
|
|
938
|
-
emitResultDelivery(parsed.requestId, true);
|
|
913
|
+
const deliverLocal = () => {
|
|
914
|
+
const ctx = getLiveContext(runtimeContext, relayGeneration);
|
|
915
|
+
const ownerSessionId = ctx?.sessionManager.getSessionFile?.() ?? ctx?.sessionManager.getSessionId();
|
|
916
|
+
// The owner already receives subagent-notify; keep the relay ACK without another model message.
|
|
917
|
+
if (options.sender === "subagent-result" && ownerSessionId && parsed.ownerNotificationSessionId === ownerSessionId)
|
|
939
918
|
return;
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
if (
|
|
949
|
-
|
|
950
|
-
|
|
919
|
+
deliverLocalSubagentRelayMessage(options.sender, options.status, parsed.message);
|
|
920
|
+
};
|
|
921
|
+
const key = options.acknowledge && parsed.requestId ? `${relayGeneration}:${parsed.requestId}` : undefined;
|
|
922
|
+
let delivery = key ? resultDeliveries.get(key) : undefined;
|
|
923
|
+
if (!delivery) {
|
|
924
|
+
delivery = (async () => {
|
|
925
|
+
const relayStillLive = () => !runtimeStarted || Boolean(getLiveContext(runtimeContext, relayGeneration));
|
|
926
|
+
try {
|
|
927
|
+
if (!relayStillLive())
|
|
928
|
+
return false;
|
|
929
|
+
if (currentSessionTargetMatches(parsed.to)) {
|
|
930
|
+
deliverLocal();
|
|
931
|
+
return true;
|
|
932
|
+
}
|
|
933
|
+
const activeClient = await ensureConnected("background");
|
|
934
|
+
const target = await resolveSessionTarget(activeClient, parsed.to) ?? parsed.to;
|
|
935
|
+
if (!relayStillLive())
|
|
936
|
+
return false;
|
|
937
|
+
if (currentSessionTargetMatches(parsed.to, target, activeClient)) {
|
|
938
|
+
deliverLocal();
|
|
939
|
+
return true;
|
|
940
|
+
}
|
|
941
|
+
const result = await activeClient.send(target, { text: parsed.message });
|
|
942
|
+
if (!result.delivered)
|
|
943
|
+
throw new Error(result.reason ?? "Session may not exist or has disconnected.");
|
|
944
|
+
return true;
|
|
951
945
|
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
946
|
+
catch (error) {
|
|
947
|
+
if (relayStillLive())
|
|
948
|
+
recordSubagentDeliveryError(options.errorEntryType, parsed.to, parsed.message, error);
|
|
949
|
+
return false;
|
|
950
|
+
}
|
|
951
|
+
})();
|
|
952
|
+
if (key) {
|
|
953
|
+
resultDeliveries.set(key, delivery);
|
|
954
|
+
void delivery.then((delivered) => {
|
|
955
|
+
if (!delivered) {
|
|
956
|
+
if (resultDeliveries.get(key) === delivery)
|
|
957
|
+
resultDeliveries.delete(key);
|
|
958
|
+
return;
|
|
959
|
+
}
|
|
960
|
+
acknowledgedResults.push(key);
|
|
961
|
+
while (acknowledgedResults.length > 1024)
|
|
962
|
+
resultDeliveries.delete(acknowledgedResults.shift());
|
|
963
|
+
});
|
|
961
964
|
}
|
|
962
|
-
}
|
|
965
|
+
}
|
|
966
|
+
void delivery.then((delivered) => {
|
|
967
|
+
if (options.acknowledge)
|
|
968
|
+
emitResultDelivery(parsed.requestId, delivered);
|
|
969
|
+
});
|
|
963
970
|
}
|
|
964
971
|
const unsubscribeSubagentControlIntercom = pi.events.on(SUBAGENT_CONTROL_INTERCOM_EVENT, (payload) => {
|
|
965
972
|
relaySubagentIntercomPayload(payload, {
|
|
@@ -1100,7 +1107,8 @@ export default function piIntercomExtension(pi) {
|
|
|
1100
1107
|
}
|
|
1101
1108
|
});
|
|
1102
1109
|
const childOrchestratorMetadata = readChildOrchestratorMetadata();
|
|
1103
|
-
|
|
1110
|
+
const nativeSupervisorChannel = isNativeSupervisorChannelActive();
|
|
1111
|
+
if (childOrchestratorMetadata && !nativeSupervisorChannel) {
|
|
1104
1112
|
pi.registerTool({
|
|
1105
1113
|
name: "contact_supervisor",
|
|
1106
1114
|
label: "Contact Supervisor",
|
|
@@ -1361,10 +1369,11 @@ export default function piIntercomExtension(pi) {
|
|
|
1361
1369
|
},
|
|
1362
1370
|
});
|
|
1363
1371
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1372
|
+
if (!nativeSupervisorChannel)
|
|
1373
|
+
pi.registerTool({
|
|
1374
|
+
name: "intercom",
|
|
1375
|
+
label: "Intercom",
|
|
1376
|
+
description: `Send a message to another pi session running on this machine.
|
|
1368
1377
|
Use this to communicate findings, request help, or coordinate work with other sessions.
|
|
1369
1378
|
|
|
1370
1379
|
Usage:
|
|
@@ -1374,158 +1383,131 @@ Usage:
|
|
|
1374
1383
|
intercom({ action: "reply", message: "..." }) → Reply to the active/single pending ask
|
|
1375
1384
|
intercom({ action: "pending" }) → List unresolved inbound asks
|
|
1376
1385
|
intercom({ action: "status" }) → Show connection status`,
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1386
|
+
promptSnippet: "Use to coordinate with other local pi sessions: list peers, send updates, ask for help, or check intercom connectivity.",
|
|
1387
|
+
parameters: Type.Object({
|
|
1388
|
+
action: StringEnum(["list", "send", "ask", "reply", "pending", "status"], {
|
|
1389
|
+
description: "Action: 'list', 'send', 'ask', 'reply', 'pending', or 'status'",
|
|
1390
|
+
}),
|
|
1391
|
+
to: Type.Optional(Type.String({
|
|
1392
|
+
description: "Target session name or ID (for 'send', 'ask', or disambiguating 'reply')",
|
|
1393
|
+
})),
|
|
1394
|
+
message: Type.Optional(Type.String({
|
|
1395
|
+
description: "Message to send (for 'send', 'ask', or 'reply' action)",
|
|
1396
|
+
})),
|
|
1397
|
+
attachments: Type.Optional(Type.Array(Type.Object({
|
|
1398
|
+
type: StringEnum(["file", "snippet", "context"]),
|
|
1399
|
+
name: Type.String(),
|
|
1400
|
+
content: Type.String(),
|
|
1401
|
+
language: Type.Optional(Type.String()),
|
|
1402
|
+
}))),
|
|
1403
|
+
replyTo: Type.Optional(Type.String({
|
|
1404
|
+
description: "Message ID to reply to (for threading or responding to an 'ask')",
|
|
1405
|
+
})),
|
|
1381
1406
|
}),
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
if (!currentSession) {
|
|
1407
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
1408
|
+
let connectedClient;
|
|
1409
|
+
try {
|
|
1410
|
+
connectedClient = await ensureConnected("tool");
|
|
1411
|
+
}
|
|
1412
|
+
catch (error) {
|
|
1413
|
+
return {
|
|
1414
|
+
content: [{ type: "text", text: `Intercom not connected: ${getErrorMessage(error)}` }],
|
|
1415
|
+
details: { error: true },
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
syncPresenceIdentity(ctx.sessionManager.getSessionId());
|
|
1419
|
+
const { action, to, message, attachments, replyTo } = params;
|
|
1420
|
+
switch (action) {
|
|
1421
|
+
case "list": {
|
|
1422
|
+
try {
|
|
1423
|
+
const mySessionId = connectedClient.sessionId;
|
|
1424
|
+
const sessions = await connectedClient.listSessions();
|
|
1425
|
+
const currentSession = sessions.find(s => s.id === mySessionId);
|
|
1426
|
+
const otherSessions = sessions.filter(s => s.id !== mySessionId);
|
|
1427
|
+
if (!currentSession) {
|
|
1428
|
+
return {
|
|
1429
|
+
content: [{ type: "text", text: "Current session is missing from intercom session list." }],
|
|
1430
|
+
details: { error: true },
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1433
|
+
const currentSection = `**Current session:**\n${formatSessionListRow(currentSession, currentSession.cwd, true)}`;
|
|
1434
|
+
const otherSection = otherSessions.length === 0
|
|
1435
|
+
? "**Other sessions:**\nNo other sessions connected."
|
|
1436
|
+
: `**Other sessions:**\n${otherSessions.map(s => formatSessionListRow(s, currentSession.cwd, false)).join("\n")}`;
|
|
1437
|
+
return {
|
|
1438
|
+
content: [{ type: "text", text: `${currentSection}\n\n${otherSection}` }],
|
|
1439
|
+
details: {},
|
|
1440
|
+
};
|
|
1441
|
+
}
|
|
1442
|
+
catch (error) {
|
|
1419
1443
|
return {
|
|
1420
|
-
content: [{ type: "text", text:
|
|
1444
|
+
content: [{ type: "text", text: `Failed to list sessions: ${getErrorMessage(error)}` }],
|
|
1421
1445
|
details: { error: true },
|
|
1422
1446
|
};
|
|
1423
1447
|
}
|
|
1424
|
-
const currentSection = `**Current session:**\n${formatSessionListRow(currentSession, currentSession.cwd, true)}`;
|
|
1425
|
-
const otherSection = otherSessions.length === 0
|
|
1426
|
-
? "**Other sessions:**\nNo other sessions connected."
|
|
1427
|
-
: `**Other sessions:**\n${otherSessions.map(s => formatSessionListRow(s, currentSession.cwd, false)).join("\n")}`;
|
|
1428
|
-
return {
|
|
1429
|
-
content: [{ type: "text", text: `${currentSection}\n\n${otherSection}` }],
|
|
1430
|
-
details: {},
|
|
1431
|
-
};
|
|
1432
|
-
}
|
|
1433
|
-
catch (error) {
|
|
1434
|
-
return {
|
|
1435
|
-
content: [{ type: "text", text: `Failed to list sessions: ${getErrorMessage(error)}` }],
|
|
1436
|
-
details: { error: true },
|
|
1437
|
-
};
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
case "send": {
|
|
1441
|
-
if (!to || !message) {
|
|
1442
|
-
return {
|
|
1443
|
-
content: [{ type: "text", text: "Missing 'to' or 'message' parameter" }],
|
|
1444
|
-
details: { error: true },
|
|
1445
|
-
};
|
|
1446
1448
|
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
if (sendTo === connectedClient.sessionId) {
|
|
1449
|
+
case "send": {
|
|
1450
|
+
if (!to || !message) {
|
|
1450
1451
|
return {
|
|
1451
|
-
content: [{ type: "text", text: "
|
|
1452
|
+
content: [{ type: "text", text: "Missing 'to' or 'message' parameter" }],
|
|
1452
1453
|
details: { error: true },
|
|
1453
1454
|
};
|
|
1454
1455
|
}
|
|
1455
|
-
|
|
1456
|
-
const
|
|
1457
|
-
|
|
1458
|
-
if (!confirmed) {
|
|
1456
|
+
try {
|
|
1457
|
+
const sendTo = await resolveSessionTarget(connectedClient, to) ?? to;
|
|
1458
|
+
if (sendTo === connectedClient.sessionId) {
|
|
1459
1459
|
return {
|
|
1460
|
-
content: [{ type: "text", text: "
|
|
1461
|
-
details: {},
|
|
1460
|
+
content: [{ type: "text", text: "Cannot message the current session" }],
|
|
1461
|
+
details: { error: true },
|
|
1462
1462
|
};
|
|
1463
1463
|
}
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1464
|
+
if (!replyTo && config.confirmSend && ctx.hasUI) {
|
|
1465
|
+
const attachmentText = attachments?.length ? formatAttachments(attachments) : "";
|
|
1466
|
+
const confirmed = await ctx.ui.confirm("Send Message", `Send to "${to}":\n\n${message}${attachmentText}`);
|
|
1467
|
+
if (!confirmed) {
|
|
1468
|
+
return {
|
|
1469
|
+
content: [{ type: "text", text: "Message cancelled by user" }],
|
|
1470
|
+
details: {},
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
const result = await connectedClient.send(sendTo, {
|
|
1475
|
+
text: message,
|
|
1476
|
+
attachments,
|
|
1477
|
+
replyTo,
|
|
1478
|
+
});
|
|
1479
|
+
if (!result.delivered) {
|
|
1480
|
+
const errorText = result.reason ?? "Session may not exist or has disconnected.";
|
|
1481
|
+
return {
|
|
1482
|
+
content: [{ type: "text", text: `Message to "${to}" was not delivered: ${errorText}` }],
|
|
1483
|
+
details: { messageId: result.id, delivered: false, reason: result.reason },
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
pi.appendEntry("intercom_sent", {
|
|
1487
|
+
to,
|
|
1488
|
+
message: { text: message, attachments, replyTo },
|
|
1489
|
+
messageId: result.id,
|
|
1490
|
+
timestamp: Date.now(),
|
|
1491
|
+
});
|
|
1492
|
+
if (replyTo) {
|
|
1493
|
+
replyTracker.markReplied(replyTo);
|
|
1494
|
+
}
|
|
1472
1495
|
return {
|
|
1473
|
-
content: [{ type: "text", text: `Message to
|
|
1474
|
-
details: { messageId: result.id, delivered:
|
|
1496
|
+
content: [{ type: "text", text: `Message sent to ${to}` }],
|
|
1497
|
+
details: { messageId: result.id, delivered: true },
|
|
1475
1498
|
};
|
|
1476
1499
|
}
|
|
1477
|
-
|
|
1478
|
-
to,
|
|
1479
|
-
message: { text: message, attachments, replyTo },
|
|
1480
|
-
messageId: result.id,
|
|
1481
|
-
timestamp: Date.now(),
|
|
1482
|
-
});
|
|
1483
|
-
if (replyTo) {
|
|
1484
|
-
replyTracker.markReplied(replyTo);
|
|
1485
|
-
}
|
|
1486
|
-
return {
|
|
1487
|
-
content: [{ type: "text", text: `Message sent to ${to}` }],
|
|
1488
|
-
details: { messageId: result.id, delivered: true },
|
|
1489
|
-
};
|
|
1490
|
-
}
|
|
1491
|
-
catch (error) {
|
|
1492
|
-
return {
|
|
1493
|
-
content: [{ type: "text", text: `Failed to send: ${getErrorMessage(error)}` }],
|
|
1494
|
-
details: { error: true },
|
|
1495
|
-
};
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
case "ask": {
|
|
1499
|
-
if (!to || !message) {
|
|
1500
|
-
return {
|
|
1501
|
-
content: [{ type: "text", text: "Missing 'to' or 'message' parameter" }],
|
|
1502
|
-
details: { error: true },
|
|
1503
|
-
};
|
|
1504
|
-
}
|
|
1505
|
-
if (replyWaiter) {
|
|
1506
|
-
return {
|
|
1507
|
-
content: [{ type: "text", text: "Already waiting for a reply" }],
|
|
1508
|
-
details: { error: true },
|
|
1509
|
-
};
|
|
1510
|
-
}
|
|
1511
|
-
if (_signal?.aborted) {
|
|
1512
|
-
return {
|
|
1513
|
-
content: [{ type: "text", text: "Cancelled" }],
|
|
1514
|
-
details: { error: true },
|
|
1515
|
-
};
|
|
1516
|
-
}
|
|
1517
|
-
let replyPromise = null;
|
|
1518
|
-
try {
|
|
1519
|
-
const sendTo = await resolveSessionTarget(connectedClient, to) ?? to;
|
|
1520
|
-
if (_signal?.aborted) {
|
|
1500
|
+
catch (error) {
|
|
1521
1501
|
return {
|
|
1522
|
-
content: [{ type: "text", text:
|
|
1502
|
+
content: [{ type: "text", text: `Failed to send: ${getErrorMessage(error)}` }],
|
|
1523
1503
|
details: { error: true },
|
|
1524
1504
|
};
|
|
1525
1505
|
}
|
|
1526
|
-
|
|
1506
|
+
}
|
|
1507
|
+
case "ask": {
|
|
1508
|
+
if (!to || !message) {
|
|
1527
1509
|
return {
|
|
1528
|
-
content: [{ type: "text", text: "
|
|
1510
|
+
content: [{ type: "text", text: "Missing 'to' or 'message' parameter" }],
|
|
1529
1511
|
details: { error: true },
|
|
1530
1512
|
};
|
|
1531
1513
|
}
|
|
@@ -1535,198 +1517,225 @@ Usage:
|
|
|
1535
1517
|
details: { error: true },
|
|
1536
1518
|
};
|
|
1537
1519
|
}
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1520
|
+
if (_signal?.aborted) {
|
|
1521
|
+
return {
|
|
1522
|
+
content: [{ type: "text", text: "Cancelled" }],
|
|
1523
|
+
details: { error: true },
|
|
1524
|
+
};
|
|
1525
|
+
}
|
|
1526
|
+
let replyPromise = null;
|
|
1527
|
+
try {
|
|
1528
|
+
const sendTo = await resolveSessionTarget(connectedClient, to) ?? to;
|
|
1529
|
+
if (_signal?.aborted) {
|
|
1530
|
+
return {
|
|
1531
|
+
content: [{ type: "text", text: "Cancelled" }],
|
|
1532
|
+
details: { error: true },
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
if (sendTo === connectedClient.sessionId) {
|
|
1536
|
+
return {
|
|
1537
|
+
content: [{ type: "text", text: "Cannot message the current session" }],
|
|
1538
|
+
details: { error: true },
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
if (replyWaiter) {
|
|
1542
|
+
return {
|
|
1543
|
+
content: [{ type: "text", text: "Already waiting for a reply" }],
|
|
1544
|
+
details: { error: true },
|
|
1545
|
+
};
|
|
1546
|
+
}
|
|
1547
|
+
const questionId = randomUUID();
|
|
1548
|
+
replyPromise = waitForReply(sendTo, questionId, _signal, () => connectedClient.cancelAsk(questionId));
|
|
1549
|
+
replyPromise.catch(() => undefined);
|
|
1550
|
+
const sendResult = await connectedClient.send(sendTo, {
|
|
1551
|
+
messageId: questionId,
|
|
1552
|
+
text: message,
|
|
1553
|
+
attachments,
|
|
1554
|
+
replyTo,
|
|
1555
|
+
expectsReply: true,
|
|
1556
|
+
});
|
|
1557
|
+
if (!sendResult.delivered) {
|
|
1558
|
+
const errorText = sendResult.reason ?? "Session may not exist or has disconnected.";
|
|
1559
|
+
rejectReplyWaiter(new Error(`Message to "${to}" was not delivered: ${errorText}`));
|
|
1560
|
+
if (replyPromise) {
|
|
1561
|
+
try {
|
|
1562
|
+
await replyPromise;
|
|
1563
|
+
}
|
|
1564
|
+
catch {
|
|
1565
|
+
// The waiter was already rejected above. Keep the delivery failure as the only error here.
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
return {
|
|
1569
|
+
content: [{ type: "text", text: `Message to "${to}" was not delivered: ${errorText}` }],
|
|
1570
|
+
details: { error: true },
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
pi.appendEntry("intercom_sent", {
|
|
1574
|
+
to,
|
|
1575
|
+
message: { text: message, attachments, replyTo },
|
|
1576
|
+
messageId: sendResult.id,
|
|
1577
|
+
timestamp: Date.now(),
|
|
1578
|
+
});
|
|
1579
|
+
const replyMessage = await replyPromise;
|
|
1580
|
+
const replyText = replyMessage.content.text;
|
|
1581
|
+
const replyAttachments = replyMessage.content.attachments?.length
|
|
1582
|
+
? formatAttachments(replyMessage.content.attachments)
|
|
1583
|
+
: "";
|
|
1584
|
+
pi.appendEntry("intercom_received", {
|
|
1585
|
+
from: to,
|
|
1586
|
+
message: { text: replyText, attachments: replyMessage.content.attachments },
|
|
1587
|
+
messageId: replyMessage.id,
|
|
1588
|
+
timestamp: replyMessage.timestamp,
|
|
1589
|
+
});
|
|
1590
|
+
return {
|
|
1591
|
+
content: [{ type: "text", text: `**Reply from ${to}:**\n${replyText}${replyAttachments}` }],
|
|
1592
|
+
details: {},
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
catch (error) {
|
|
1596
|
+
rejectReplyWaiter(toError(error));
|
|
1551
1597
|
if (replyPromise) {
|
|
1552
1598
|
try {
|
|
1553
1599
|
await replyPromise;
|
|
1554
1600
|
}
|
|
1555
1601
|
catch {
|
|
1556
|
-
// The waiter
|
|
1602
|
+
// The waiter is cleanup-only on this path. The real failure is the one from the outer catch.
|
|
1557
1603
|
}
|
|
1558
1604
|
}
|
|
1559
1605
|
return {
|
|
1560
|
-
content: [{ type: "text", text: `
|
|
1606
|
+
content: [{ type: "text", text: `Failed: ${getErrorMessage(error)}` }],
|
|
1561
1607
|
details: { error: true },
|
|
1562
1608
|
};
|
|
1563
1609
|
}
|
|
1564
|
-
pi.appendEntry("intercom_sent", {
|
|
1565
|
-
to,
|
|
1566
|
-
message: { text: message, attachments, replyTo },
|
|
1567
|
-
messageId: sendResult.id,
|
|
1568
|
-
timestamp: Date.now(),
|
|
1569
|
-
});
|
|
1570
|
-
const replyMessage = await replyPromise;
|
|
1571
|
-
const replyText = replyMessage.content.text;
|
|
1572
|
-
const replyAttachments = replyMessage.content.attachments?.length
|
|
1573
|
-
? formatAttachments(replyMessage.content.attachments)
|
|
1574
|
-
: "";
|
|
1575
|
-
pi.appendEntry("intercom_received", {
|
|
1576
|
-
from: to,
|
|
1577
|
-
message: { text: replyText, attachments: replyMessage.content.attachments },
|
|
1578
|
-
messageId: replyMessage.id,
|
|
1579
|
-
timestamp: replyMessage.timestamp,
|
|
1580
|
-
});
|
|
1581
|
-
return {
|
|
1582
|
-
content: [{ type: "text", text: `**Reply from ${to}:**\n${replyText}${replyAttachments}` }],
|
|
1583
|
-
details: {},
|
|
1584
|
-
};
|
|
1585
1610
|
}
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1611
|
+
case "reply": {
|
|
1612
|
+
if (!message) {
|
|
1613
|
+
return {
|
|
1614
|
+
content: [{ type: "text", text: "Missing 'message' parameter" }],
|
|
1615
|
+
details: { error: true },
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
try {
|
|
1619
|
+
const target = replyTracker.resolveReplyTarget({ to, replyTo });
|
|
1620
|
+
if (target.from.id === connectedClient.sessionId) {
|
|
1621
|
+
return {
|
|
1622
|
+
content: [{ type: "text", text: "Cannot message the current session" }],
|
|
1623
|
+
details: { error: true },
|
|
1624
|
+
};
|
|
1591
1625
|
}
|
|
1592
|
-
|
|
1593
|
-
|
|
1626
|
+
const result = await connectedClient.send(target.from.id, {
|
|
1627
|
+
text: message,
|
|
1628
|
+
replyTo: target.message.id,
|
|
1629
|
+
});
|
|
1630
|
+
if (!result.delivered) {
|
|
1631
|
+
const errorText = result.reason ?? "Session may not exist or has disconnected.";
|
|
1632
|
+
if (result.reason === "Session not found") {
|
|
1633
|
+
replyTracker.dismissPendingAsk(target.message.id);
|
|
1634
|
+
}
|
|
1635
|
+
return {
|
|
1636
|
+
content: [{ type: "text", text: `Reply to "${target.from.name || target.from.id}" was not delivered: ${errorText}` }],
|
|
1637
|
+
details: { messageId: result.id, delivered: false, reason: result.reason },
|
|
1638
|
+
};
|
|
1594
1639
|
}
|
|
1640
|
+
replyTracker.markReplied(target.message.id);
|
|
1641
|
+
pi.appendEntry("intercom_sent", {
|
|
1642
|
+
to: target.from.name || target.from.id,
|
|
1643
|
+
message: { text: message, replyTo: target.message.id },
|
|
1644
|
+
messageId: result.id,
|
|
1645
|
+
timestamp: Date.now(),
|
|
1646
|
+
});
|
|
1647
|
+
return {
|
|
1648
|
+
content: [{ type: "text", text: `Reply sent to ${target.from.name || target.from.id}` }],
|
|
1649
|
+
details: { messageId: result.id, delivered: true, replyTo: target.message.id },
|
|
1650
|
+
};
|
|
1595
1651
|
}
|
|
1596
|
-
|
|
1597
|
-
content: [{ type: "text", text: `Failed: ${getErrorMessage(error)}` }],
|
|
1598
|
-
details: { error: true },
|
|
1599
|
-
};
|
|
1600
|
-
}
|
|
1601
|
-
}
|
|
1602
|
-
case "reply": {
|
|
1603
|
-
if (!message) {
|
|
1604
|
-
return {
|
|
1605
|
-
content: [{ type: "text", text: "Missing 'message' parameter" }],
|
|
1606
|
-
details: { error: true },
|
|
1607
|
-
};
|
|
1608
|
-
}
|
|
1609
|
-
try {
|
|
1610
|
-
const target = replyTracker.resolveReplyTarget({ to, replyTo });
|
|
1611
|
-
if (target.from.id === connectedClient.sessionId) {
|
|
1652
|
+
catch (error) {
|
|
1612
1653
|
return {
|
|
1613
|
-
content: [{ type: "text", text:
|
|
1654
|
+
content: [{ type: "text", text: `Failed to reply: ${getErrorMessage(error)}` }],
|
|
1614
1655
|
details: { error: true },
|
|
1615
1656
|
};
|
|
1616
1657
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
if (!result.delivered) {
|
|
1622
|
-
const errorText = result.reason ?? "Session may not exist or has disconnected.";
|
|
1623
|
-
if (result.reason === "Session not found") {
|
|
1624
|
-
replyTracker.dismissPendingAsk(target.message.id);
|
|
1625
|
-
}
|
|
1658
|
+
}
|
|
1659
|
+
case "pending": {
|
|
1660
|
+
const pendingAsks = replyTracker.listPending();
|
|
1661
|
+
if (pendingAsks.length === 0) {
|
|
1626
1662
|
return {
|
|
1627
|
-
content: [{ type: "text", text:
|
|
1628
|
-
details: {
|
|
1663
|
+
content: [{ type: "text", text: "No unresolved inbound asks." }],
|
|
1664
|
+
details: {},
|
|
1629
1665
|
};
|
|
1630
1666
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
timestamp: Date.now(),
|
|
1667
|
+
const now = Date.now();
|
|
1668
|
+
const lines = pendingAsks.map(({ from, message, receivedAt }) => {
|
|
1669
|
+
const preview = message.content.text.replace(/\s+/g, " ").slice(0, 80);
|
|
1670
|
+
const elapsedSeconds = Math.max(0, Math.floor((now - receivedAt) / 1000));
|
|
1671
|
+
return `- ${from.name || from.id} · ${message.id} · ${elapsedSeconds}s ago · ${preview}`;
|
|
1637
1672
|
});
|
|
1638
1673
|
return {
|
|
1639
|
-
content: [{ type: "text", text:
|
|
1640
|
-
details: { messageId: result.id, delivered: true, replyTo: target.message.id },
|
|
1641
|
-
};
|
|
1642
|
-
}
|
|
1643
|
-
catch (error) {
|
|
1644
|
-
return {
|
|
1645
|
-
content: [{ type: "text", text: `Failed to reply: ${getErrorMessage(error)}` }],
|
|
1646
|
-
details: { error: true },
|
|
1647
|
-
};
|
|
1648
|
-
}
|
|
1649
|
-
}
|
|
1650
|
-
case "pending": {
|
|
1651
|
-
const pendingAsks = replyTracker.listPending();
|
|
1652
|
-
if (pendingAsks.length === 0) {
|
|
1653
|
-
return {
|
|
1654
|
-
content: [{ type: "text", text: "No unresolved inbound asks." }],
|
|
1674
|
+
content: [{ type: "text", text: `**Pending asks:**\n${lines.join("\n")}` }],
|
|
1655
1675
|
details: {},
|
|
1656
1676
|
};
|
|
1657
1677
|
}
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
text: `**Intercom Status:**\nConnected: Yes\nSession ID: ${mySessionId}\nActive sessions: ${sessions.length}`,
|
|
1677
|
-
}],
|
|
1678
|
-
details: {},
|
|
1679
|
-
};
|
|
1678
|
+
case "status": {
|
|
1679
|
+
try {
|
|
1680
|
+
const mySessionId = connectedClient.sessionId;
|
|
1681
|
+
const sessions = await connectedClient.listSessions();
|
|
1682
|
+
return {
|
|
1683
|
+
content: [{
|
|
1684
|
+
type: "text",
|
|
1685
|
+
text: `**Intercom Status:**\nConnected: Yes\nSession ID: ${mySessionId}\nActive sessions: ${sessions.length}`,
|
|
1686
|
+
}],
|
|
1687
|
+
details: {},
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
catch (error) {
|
|
1691
|
+
return {
|
|
1692
|
+
content: [{ type: "text", text: `Failed to get status: ${getErrorMessage(error)}` }],
|
|
1693
|
+
details: { error: true },
|
|
1694
|
+
};
|
|
1695
|
+
}
|
|
1680
1696
|
}
|
|
1681
|
-
|
|
1697
|
+
default:
|
|
1682
1698
|
return {
|
|
1683
|
-
content: [{ type: "text", text: `
|
|
1699
|
+
content: [{ type: "text", text: `Unknown action: ${action}` }],
|
|
1684
1700
|
details: { error: true },
|
|
1685
1701
|
};
|
|
1686
|
-
}
|
|
1687
1702
|
}
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
if (details?.reason && context.expanded) {
|
|
1725
|
-
text += "\n" + theme.fg("dim", `Reason: ${details.reason}`);
|
|
1726
|
-
}
|
|
1727
|
-
return new Text(text, 0, 0);
|
|
1728
|
-
},
|
|
1729
|
-
});
|
|
1703
|
+
},
|
|
1704
|
+
renderCall(args, theme) {
|
|
1705
|
+
const action = typeof args.action === "string" ? args.action : "intercom";
|
|
1706
|
+
const target = typeof args.to === "string" && args.to.trim() ? args.to.trim() : undefined;
|
|
1707
|
+
const messagePreview = previewText(args.message, 96);
|
|
1708
|
+
const attachmentCount = Array.isArray(args.attachments) ? args.attachments.length : 0;
|
|
1709
|
+
let text = theme.fg("toolTitle", theme.bold("intercom "));
|
|
1710
|
+
text += theme.fg(action === "ask" ? "warning" : action === "reply" ? "success" : "accent", action);
|
|
1711
|
+
if (target) {
|
|
1712
|
+
text += " " + theme.fg("muted", "→") + " " + theme.fg("accent", target);
|
|
1713
|
+
}
|
|
1714
|
+
if (attachmentCount > 0) {
|
|
1715
|
+
text += " " + theme.fg("dim", `(${attachmentCount} attachment${attachmentCount === 1 ? "" : "s"})`);
|
|
1716
|
+
}
|
|
1717
|
+
if (messagePreview) {
|
|
1718
|
+
text += "\n " + theme.fg("dim", messagePreview);
|
|
1719
|
+
}
|
|
1720
|
+
return new Text(text, 0, 0);
|
|
1721
|
+
},
|
|
1722
|
+
renderResult(result, { isPartial }, theme, context) {
|
|
1723
|
+
if (isPartial) {
|
|
1724
|
+
return new Text(theme.fg("warning", "Intercom working..."), 0, 0);
|
|
1725
|
+
}
|
|
1726
|
+
const details = result.details;
|
|
1727
|
+
const failed = Boolean(context.isError || details?.error === true || details?.delivered === false);
|
|
1728
|
+
let text = failed ? theme.fg("error", "✗ ") : theme.fg("success", "✓ ");
|
|
1729
|
+
text += theme.fg(failed ? "error" : "text", firstTextContent(result));
|
|
1730
|
+
if (details?.messageId && !context.expanded) {
|
|
1731
|
+
text += theme.fg("dim", ` (${details.messageId.slice(0, 8)})`);
|
|
1732
|
+
}
|
|
1733
|
+
if (details?.reason && context.expanded) {
|
|
1734
|
+
text += "\n" + theme.fg("dim", `Reason: ${details.reason}`);
|
|
1735
|
+
}
|
|
1736
|
+
return new Text(text, 0, 0);
|
|
1737
|
+
},
|
|
1738
|
+
});
|
|
1730
1739
|
async function openIntercomOverlay(ctx) {
|
|
1731
1740
|
const overlayGeneration = runtimeGeneration;
|
|
1732
1741
|
const liveContext = getLiveContext(ctx, overlayGeneration);
|