@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
|
@@ -0,0 +1,672 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
theme
|
|
4
|
+
} from "./chunk-7QWNYZDI.js";
|
|
5
|
+
|
|
6
|
+
// packages/coding-agent/dist/core/extensions/runner.js
|
|
7
|
+
var RESERVED_KEYBINDINGS_FOR_EXTENSION_CONFLICTS = [
|
|
8
|
+
"app.interrupt",
|
|
9
|
+
"app.clear",
|
|
10
|
+
"app.exit",
|
|
11
|
+
"app.suspend",
|
|
12
|
+
"app.thinking.cycle",
|
|
13
|
+
"app.mode.cycle",
|
|
14
|
+
"app.model.cycleForward",
|
|
15
|
+
"app.model.cycleBackward",
|
|
16
|
+
"app.model.select",
|
|
17
|
+
"app.tools.expand",
|
|
18
|
+
"app.thinking.toggle",
|
|
19
|
+
"app.editor.external",
|
|
20
|
+
"app.message.copy",
|
|
21
|
+
"app.message.followUp",
|
|
22
|
+
"tui.input.submit",
|
|
23
|
+
"tui.select.confirm",
|
|
24
|
+
"tui.select.cancel",
|
|
25
|
+
"tui.input.copy",
|
|
26
|
+
"tui.editor.deleteToLineEnd"
|
|
27
|
+
], buildBuiltinKeybindings = (resolvedKeybindings) => {
|
|
28
|
+
let builtinKeybindings = {};
|
|
29
|
+
for (let [keybinding, keys] of Object.entries(resolvedKeybindings)) {
|
|
30
|
+
if (keys === void 0)
|
|
31
|
+
continue;
|
|
32
|
+
let keyList = Array.isArray(keys) ? keys : [keys], restrictOverride = RESERVED_KEYBINDINGS_FOR_EXTENSION_CONFLICTS.includes(keybinding);
|
|
33
|
+
for (let key of keyList) {
|
|
34
|
+
let normalizedKey = key.toLowerCase();
|
|
35
|
+
builtinKeybindings[normalizedKey]?.restrictOverride && !restrictOverride || (builtinKeybindings[normalizedKey] = {
|
|
36
|
+
keybinding,
|
|
37
|
+
restrictOverride
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return builtinKeybindings;
|
|
42
|
+
};
|
|
43
|
+
async function emitSessionShutdownEvent(extensionRunner, event) {
|
|
44
|
+
return extensionRunner.hasHandlers("session_shutdown") ? (await extensionRunner.emit(event), !0) : !1;
|
|
45
|
+
}
|
|
46
|
+
async function emitProjectTrustEvent(extensionsResult, event, ctx) {
|
|
47
|
+
let errors = [];
|
|
48
|
+
for (let ext of extensionsResult.extensions) {
|
|
49
|
+
let handlers = ext.handlers.get("project_trust");
|
|
50
|
+
if (!(!handlers || handlers.length === 0))
|
|
51
|
+
for (let handler of handlers)
|
|
52
|
+
try {
|
|
53
|
+
let handlerResult = await handler(event, ctx);
|
|
54
|
+
if (handlerResult.trusted === "undecided")
|
|
55
|
+
continue;
|
|
56
|
+
return { result: handlerResult, errors };
|
|
57
|
+
} catch (error) {
|
|
58
|
+
errors.push({
|
|
59
|
+
extensionPath: ext.path,
|
|
60
|
+
event: event.type,
|
|
61
|
+
error: error instanceof Error ? error.message : String(error),
|
|
62
|
+
stack: error instanceof Error ? error.stack : void 0
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return { errors };
|
|
67
|
+
}
|
|
68
|
+
var noOpUIContext = {
|
|
69
|
+
select: async () => {
|
|
70
|
+
},
|
|
71
|
+
confirm: async () => !1,
|
|
72
|
+
input: async () => {
|
|
73
|
+
},
|
|
74
|
+
notify: () => {
|
|
75
|
+
},
|
|
76
|
+
onTerminalInput: () => () => {
|
|
77
|
+
},
|
|
78
|
+
setStatus: () => {
|
|
79
|
+
},
|
|
80
|
+
setWorkingMessage: () => {
|
|
81
|
+
},
|
|
82
|
+
setWorkingVisible: () => {
|
|
83
|
+
},
|
|
84
|
+
setWorkingIndicator: () => {
|
|
85
|
+
},
|
|
86
|
+
setHiddenThinkingLabel: () => {
|
|
87
|
+
},
|
|
88
|
+
setWidget: () => {
|
|
89
|
+
},
|
|
90
|
+
setFooter: () => {
|
|
91
|
+
},
|
|
92
|
+
setHeader: () => {
|
|
93
|
+
},
|
|
94
|
+
setTitle: () => {
|
|
95
|
+
},
|
|
96
|
+
custom: async () => {
|
|
97
|
+
},
|
|
98
|
+
pasteToEditor: () => {
|
|
99
|
+
},
|
|
100
|
+
setEditorText: () => {
|
|
101
|
+
},
|
|
102
|
+
getEditorText: () => "",
|
|
103
|
+
editor: async () => {
|
|
104
|
+
},
|
|
105
|
+
addAutocompleteProvider: () => {
|
|
106
|
+
},
|
|
107
|
+
setEditorComponent: () => {
|
|
108
|
+
},
|
|
109
|
+
getEditorComponent: () => {
|
|
110
|
+
},
|
|
111
|
+
get theme() {
|
|
112
|
+
return theme;
|
|
113
|
+
},
|
|
114
|
+
getAllThemes: () => [],
|
|
115
|
+
getTheme: () => {
|
|
116
|
+
},
|
|
117
|
+
setTheme: (_theme) => ({ success: !1, error: "UI not available" }),
|
|
118
|
+
getToolsExpanded: () => !1,
|
|
119
|
+
setToolsExpanded: () => {
|
|
120
|
+
}
|
|
121
|
+
}, ExtensionRunner = class {
|
|
122
|
+
extensions;
|
|
123
|
+
runtime;
|
|
124
|
+
uiContext;
|
|
125
|
+
mode = "print";
|
|
126
|
+
cwd;
|
|
127
|
+
sessionManager;
|
|
128
|
+
modelRegistry;
|
|
129
|
+
errorListeners = /* @__PURE__ */ new Set();
|
|
130
|
+
getModel = () => {
|
|
131
|
+
};
|
|
132
|
+
isIdleFn = () => !0;
|
|
133
|
+
isProjectTrustedFn = () => !0;
|
|
134
|
+
getSignalFn = () => {
|
|
135
|
+
};
|
|
136
|
+
waitForIdleFn = async () => {
|
|
137
|
+
};
|
|
138
|
+
abortFn = () => {
|
|
139
|
+
};
|
|
140
|
+
hasPendingMessagesFn = () => !1;
|
|
141
|
+
getContextUsageFn = () => {
|
|
142
|
+
};
|
|
143
|
+
compactFn = () => {
|
|
144
|
+
};
|
|
145
|
+
getSystemPromptFn = () => "";
|
|
146
|
+
getSystemPromptOptionsFn = () => ({ cwd: this.cwd });
|
|
147
|
+
newSessionHandler = async () => ({ cancelled: !1 });
|
|
148
|
+
forkHandler = async () => ({ cancelled: !1 });
|
|
149
|
+
navigateTreeHandler = async () => ({ cancelled: !1 });
|
|
150
|
+
switchSessionHandler = async () => ({ cancelled: !1 });
|
|
151
|
+
reloadHandler = async () => {
|
|
152
|
+
};
|
|
153
|
+
shutdownHandler = () => {
|
|
154
|
+
};
|
|
155
|
+
shortcutDiagnostics = [];
|
|
156
|
+
commandDiagnostics = [];
|
|
157
|
+
staleMessage;
|
|
158
|
+
constructor(extensions, runtime, cwd, sessionManager, modelRegistry) {
|
|
159
|
+
this.extensions = extensions, this.runtime = runtime, this.uiContext = noOpUIContext, this.cwd = cwd, this.sessionManager = sessionManager, this.modelRegistry = modelRegistry;
|
|
160
|
+
}
|
|
161
|
+
bindCore(actions, contextActions, providerActions) {
|
|
162
|
+
this.runtime.sendMessage = actions.sendMessage, this.runtime.sendUserMessage = actions.sendUserMessage, this.runtime.appendEntry = actions.appendEntry, this.runtime.setSessionName = actions.setSessionName, this.runtime.getSessionName = actions.getSessionName, this.runtime.setLabel = actions.setLabel, this.runtime.getActiveTools = actions.getActiveTools, this.runtime.getAllTools = actions.getAllTools, this.runtime.setActiveTools = actions.setActiveTools, this.runtime.refreshTools = actions.refreshTools, this.runtime.getCommands = actions.getCommands, this.runtime.setModel = actions.setModel, this.runtime.getThinkingLevel = actions.getThinkingLevel, this.runtime.setThinkingLevel = actions.setThinkingLevel, this.getModel = contextActions.getModel, this.isIdleFn = contextActions.isIdle, this.isProjectTrustedFn = contextActions.isProjectTrusted, this.getSignalFn = contextActions.getSignal, this.abortFn = contextActions.abort, this.hasPendingMessagesFn = contextActions.hasPendingMessages, this.shutdownHandler = contextActions.shutdown, this.getContextUsageFn = contextActions.getContextUsage, this.compactFn = contextActions.compact, this.getSystemPromptFn = contextActions.getSystemPrompt, this.getSystemPromptOptionsFn = contextActions.getSystemPromptOptions ?? (() => ({ cwd: this.cwd }));
|
|
163
|
+
for (let { name, config, extensionPath } of this.runtime.pendingProviderRegistrations)
|
|
164
|
+
try {
|
|
165
|
+
providerActions?.registerProvider ? providerActions.registerProvider(name, config) : this.modelRegistry.registerProvider(name, config);
|
|
166
|
+
} catch (err) {
|
|
167
|
+
this.emitError({
|
|
168
|
+
extensionPath,
|
|
169
|
+
event: "register_provider",
|
|
170
|
+
error: err instanceof Error ? err.message : String(err),
|
|
171
|
+
stack: err instanceof Error ? err.stack : void 0
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
this.runtime.pendingProviderRegistrations = [], this.runtime.registerProvider = (name, config) => {
|
|
175
|
+
if (providerActions?.registerProvider) {
|
|
176
|
+
providerActions.registerProvider(name, config);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
this.modelRegistry.registerProvider(name, config);
|
|
180
|
+
}, this.runtime.unregisterProvider = (name) => {
|
|
181
|
+
if (providerActions?.unregisterProvider) {
|
|
182
|
+
providerActions.unregisterProvider(name);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
this.modelRegistry.unregisterProvider(name);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
bindCommandContext(actions) {
|
|
189
|
+
if (actions) {
|
|
190
|
+
this.waitForIdleFn = actions.waitForIdle, this.newSessionHandler = actions.newSession, this.forkHandler = actions.fork, this.navigateTreeHandler = actions.navigateTree, this.switchSessionHandler = actions.switchSession, this.reloadHandler = actions.reload;
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
this.waitForIdleFn = async () => {
|
|
194
|
+
}, this.newSessionHandler = async () => ({ cancelled: !1 }), this.forkHandler = async () => ({ cancelled: !1 }), this.navigateTreeHandler = async () => ({ cancelled: !1 }), this.switchSessionHandler = async () => ({ cancelled: !1 }), this.reloadHandler = async () => {
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
setUIContext(uiContext, mode = "print") {
|
|
198
|
+
this.uiContext = uiContext ?? noOpUIContext, this.mode = mode;
|
|
199
|
+
}
|
|
200
|
+
getUIContext() {
|
|
201
|
+
return this.uiContext;
|
|
202
|
+
}
|
|
203
|
+
hasUI() {
|
|
204
|
+
return this.uiContext !== noOpUIContext;
|
|
205
|
+
}
|
|
206
|
+
getExtensionPaths() {
|
|
207
|
+
return this.extensions.map((e) => e.path);
|
|
208
|
+
}
|
|
209
|
+
/** Append already-loaded extensions to this runner. Bindings stay on the existing runtime. */
|
|
210
|
+
appendExtensions(extensions) {
|
|
211
|
+
let existing = new Set(this.extensions), existingPaths = new Set(this.extensions.map((extension) => extension.path));
|
|
212
|
+
for (let extension of extensions)
|
|
213
|
+
existing.has(extension) || existingPaths.has(extension.path) || (this.extensions.push(extension), existing.add(extension), existingPaths.add(extension.path));
|
|
214
|
+
}
|
|
215
|
+
/** Get all registered tools from all extensions (first registration per name wins). */
|
|
216
|
+
getAllRegisteredTools() {
|
|
217
|
+
let toolsByName = /* @__PURE__ */ new Map();
|
|
218
|
+
for (let ext of this.extensions)
|
|
219
|
+
for (let tool of ext.tools.values())
|
|
220
|
+
toolsByName.has(tool.definition.name) || toolsByName.set(tool.definition.name, tool);
|
|
221
|
+
return Array.from(toolsByName.values());
|
|
222
|
+
}
|
|
223
|
+
/** Get a tool definition by name. Returns undefined if not found. */
|
|
224
|
+
getToolDefinition(toolName) {
|
|
225
|
+
for (let ext of this.extensions) {
|
|
226
|
+
let tool = ext.tools.get(toolName);
|
|
227
|
+
if (tool)
|
|
228
|
+
return tool.definition;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
getFlags() {
|
|
232
|
+
let allFlags = /* @__PURE__ */ new Map();
|
|
233
|
+
for (let ext of this.extensions)
|
|
234
|
+
for (let [name, flag] of ext.flags)
|
|
235
|
+
allFlags.has(name) || allFlags.set(name, flag);
|
|
236
|
+
return allFlags;
|
|
237
|
+
}
|
|
238
|
+
setFlagValue(name, value) {
|
|
239
|
+
this.runtime.flagValues.set(name, value);
|
|
240
|
+
}
|
|
241
|
+
getFlagValues() {
|
|
242
|
+
return new Map(this.runtime.flagValues);
|
|
243
|
+
}
|
|
244
|
+
getShortcuts(resolvedKeybindings) {
|
|
245
|
+
this.shortcutDiagnostics = [];
|
|
246
|
+
let builtinKeybindings = buildBuiltinKeybindings(resolvedKeybindings), extensionShortcuts = /* @__PURE__ */ new Map(), addDiagnostic = (message, extensionPath) => {
|
|
247
|
+
this.shortcutDiagnostics.push({ type: "warning", message, path: extensionPath }), this.hasUI() || console.warn(message);
|
|
248
|
+
};
|
|
249
|
+
for (let ext of this.extensions)
|
|
250
|
+
for (let [key, shortcut] of ext.shortcuts) {
|
|
251
|
+
let normalizedKey = key.toLowerCase(), builtInKeybinding = builtinKeybindings[normalizedKey];
|
|
252
|
+
if (builtInKeybinding?.restrictOverride === !0) {
|
|
253
|
+
addDiagnostic(`Extension shortcut '${key}' from ${shortcut.extensionPath} conflicts with built-in shortcut. Skipping.`, shortcut.extensionPath);
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
builtInKeybinding?.restrictOverride === !1 && addDiagnostic(`Extension shortcut conflict: '${key}' is built-in shortcut for ${builtInKeybinding.keybinding} and ${shortcut.extensionPath}. Using ${shortcut.extensionPath}.`, shortcut.extensionPath);
|
|
257
|
+
let existingExtensionShortcut = extensionShortcuts.get(normalizedKey);
|
|
258
|
+
existingExtensionShortcut && addDiagnostic(`Extension shortcut conflict: '${key}' registered by both ${existingExtensionShortcut.extensionPath} and ${shortcut.extensionPath}. Using ${shortcut.extensionPath}.`, shortcut.extensionPath), extensionShortcuts.set(normalizedKey, shortcut);
|
|
259
|
+
}
|
|
260
|
+
return extensionShortcuts;
|
|
261
|
+
}
|
|
262
|
+
getShortcutDiagnostics() {
|
|
263
|
+
return this.shortcutDiagnostics;
|
|
264
|
+
}
|
|
265
|
+
invalidate(message = "This extension ctx is stale after session replacement or reload. Do not use a captured pi or command ctx after ctx.newSession(), ctx.fork(), ctx.switchSession(), or ctx.reload(). For newSession, fork, and switchSession, move post-replacement work into withSession and use the ctx passed to withSession. For reload, do not use the old ctx after await ctx.reload().") {
|
|
266
|
+
this.staleMessage || (this.staleMessage = message, this.runtime.invalidate(message));
|
|
267
|
+
}
|
|
268
|
+
assertActive() {
|
|
269
|
+
if (this.staleMessage)
|
|
270
|
+
throw new Error(this.staleMessage);
|
|
271
|
+
}
|
|
272
|
+
onError(listener) {
|
|
273
|
+
return this.errorListeners.add(listener), () => this.errorListeners.delete(listener);
|
|
274
|
+
}
|
|
275
|
+
emitError(error) {
|
|
276
|
+
for (let listener of this.errorListeners)
|
|
277
|
+
listener(error);
|
|
278
|
+
}
|
|
279
|
+
hasHandlers(eventType) {
|
|
280
|
+
for (let ext of this.extensions) {
|
|
281
|
+
let handlers = ext.handlers.get(eventType);
|
|
282
|
+
if (handlers && handlers.length > 0)
|
|
283
|
+
return !0;
|
|
284
|
+
}
|
|
285
|
+
return !1;
|
|
286
|
+
}
|
|
287
|
+
getMessageRenderer(customType) {
|
|
288
|
+
for (let ext of this.extensions) {
|
|
289
|
+
let renderer = ext.messageRenderers.get(customType);
|
|
290
|
+
if (renderer)
|
|
291
|
+
return renderer;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
getEntryRenderer(customType) {
|
|
295
|
+
for (let ext of this.extensions) {
|
|
296
|
+
let renderer = ext.entryRenderers?.get(customType);
|
|
297
|
+
if (renderer)
|
|
298
|
+
return renderer;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
resolveRegisteredCommands() {
|
|
302
|
+
let commands = [], counts = /* @__PURE__ */ new Map();
|
|
303
|
+
for (let ext of this.extensions)
|
|
304
|
+
for (let command of ext.commands.values())
|
|
305
|
+
commands.push(command), counts.set(command.name, (counts.get(command.name) ?? 0) + 1);
|
|
306
|
+
let seen = /* @__PURE__ */ new Map(), takenInvocationNames = /* @__PURE__ */ new Set();
|
|
307
|
+
return commands.map((command) => {
|
|
308
|
+
let occurrence = (seen.get(command.name) ?? 0) + 1;
|
|
309
|
+
seen.set(command.name, occurrence);
|
|
310
|
+
let invocationName = (counts.get(command.name) ?? 0) > 1 ? `${command.name}:${occurrence}` : command.name;
|
|
311
|
+
if (takenInvocationNames.has(invocationName)) {
|
|
312
|
+
let suffix = occurrence;
|
|
313
|
+
do
|
|
314
|
+
suffix++, invocationName = `${command.name}:${suffix}`;
|
|
315
|
+
while (takenInvocationNames.has(invocationName));
|
|
316
|
+
}
|
|
317
|
+
return takenInvocationNames.add(invocationName), {
|
|
318
|
+
...command,
|
|
319
|
+
invocationName
|
|
320
|
+
};
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
getModelRegistry() {
|
|
324
|
+
return this.modelRegistry;
|
|
325
|
+
}
|
|
326
|
+
getRegisteredCommands() {
|
|
327
|
+
return this.commandDiagnostics = [], this.resolveRegisteredCommands();
|
|
328
|
+
}
|
|
329
|
+
getCommandDiagnostics() {
|
|
330
|
+
return this.commandDiagnostics;
|
|
331
|
+
}
|
|
332
|
+
getCommand(name) {
|
|
333
|
+
return this.resolveRegisteredCommands().find((command) => command.invocationName === name);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Request a graceful shutdown. Called by extension tools and event handlers.
|
|
337
|
+
* The actual shutdown behavior is provided by the mode via bindExtensions().
|
|
338
|
+
*/
|
|
339
|
+
shutdown() {
|
|
340
|
+
this.shutdownHandler();
|
|
341
|
+
}
|
|
342
|
+
getActiveTools() {
|
|
343
|
+
return this.assertActive(), this.runtime.getActiveTools();
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Create an ExtensionContext for use in event handlers and tool execution.
|
|
347
|
+
* Context values are resolved at call time, so changes via bindCore/bindUI are reflected.
|
|
348
|
+
*/
|
|
349
|
+
createContext() {
|
|
350
|
+
let runner = this, getModel = this.getModel;
|
|
351
|
+
return {
|
|
352
|
+
get ui() {
|
|
353
|
+
return runner.assertActive(), runner.uiContext;
|
|
354
|
+
},
|
|
355
|
+
get mode() {
|
|
356
|
+
return runner.assertActive(), runner.mode;
|
|
357
|
+
},
|
|
358
|
+
get hasUI() {
|
|
359
|
+
return runner.assertActive(), runner.hasUI();
|
|
360
|
+
},
|
|
361
|
+
get cwd() {
|
|
362
|
+
return runner.assertActive(), runner.cwd;
|
|
363
|
+
},
|
|
364
|
+
get sessionManager() {
|
|
365
|
+
return runner.assertActive(), runner.sessionManager;
|
|
366
|
+
},
|
|
367
|
+
get modelRegistry() {
|
|
368
|
+
return runner.assertActive(), runner.modelRegistry;
|
|
369
|
+
},
|
|
370
|
+
get model() {
|
|
371
|
+
return runner.assertActive(), getModel();
|
|
372
|
+
},
|
|
373
|
+
isIdle: () => (runner.assertActive(), runner.isIdleFn()),
|
|
374
|
+
isProjectTrusted: () => (runner.assertActive(), runner.isProjectTrustedFn()),
|
|
375
|
+
get signal() {
|
|
376
|
+
return runner.assertActive(), runner.getSignalFn();
|
|
377
|
+
},
|
|
378
|
+
abort: () => {
|
|
379
|
+
runner.assertActive(), runner.abortFn();
|
|
380
|
+
},
|
|
381
|
+
hasPendingMessages: () => (runner.assertActive(), runner.hasPendingMessagesFn()),
|
|
382
|
+
shutdown: () => {
|
|
383
|
+
runner.assertActive(), runner.shutdownHandler();
|
|
384
|
+
},
|
|
385
|
+
getContextUsage: () => (runner.assertActive(), runner.getContextUsageFn()),
|
|
386
|
+
compact: (options) => {
|
|
387
|
+
runner.assertActive(), runner.compactFn(options);
|
|
388
|
+
},
|
|
389
|
+
getSystemPrompt: () => (runner.assertActive(), runner.getSystemPromptFn())
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
createCommandContext() {
|
|
393
|
+
let context = Object.defineProperties({}, Object.getOwnPropertyDescriptors(this.createContext()));
|
|
394
|
+
return context.getSystemPromptOptions = () => (this.assertActive(), this.getSystemPromptOptionsFn()), context.waitForIdle = () => (this.assertActive(), this.waitForIdleFn()), context.newSession = (options) => (this.assertActive(), this.newSessionHandler(options)), context.fork = (entryId, options) => (this.assertActive(), this.forkHandler(entryId, options)), context.navigateTree = (targetId, options) => (this.assertActive(), this.navigateTreeHandler(targetId, options)), context.switchSession = (sessionPath, options) => (this.assertActive(), this.switchSessionHandler(sessionPath, options)), context.reload = () => (this.assertActive(), this.reloadHandler()), context;
|
|
395
|
+
}
|
|
396
|
+
isSessionBeforeEvent(event) {
|
|
397
|
+
return event.type === "session_before_switch" || event.type === "session_before_fork" || event.type === "session_before_compact" || event.type === "session_before_tree";
|
|
398
|
+
}
|
|
399
|
+
async emit(event) {
|
|
400
|
+
let ctx = this.createContext(), result;
|
|
401
|
+
for (let ext of this.extensions) {
|
|
402
|
+
let handlers = ext.handlers.get(event.type);
|
|
403
|
+
if (!(!handlers || handlers.length === 0))
|
|
404
|
+
for (let handler of handlers)
|
|
405
|
+
try {
|
|
406
|
+
let handlerResult = await handler(event, ctx);
|
|
407
|
+
if (this.isSessionBeforeEvent(event) && handlerResult && (result = handlerResult, result.cancel))
|
|
408
|
+
return result;
|
|
409
|
+
} catch (err) {
|
|
410
|
+
let message = err instanceof Error ? err.message : String(err), stack = err instanceof Error ? err.stack : void 0;
|
|
411
|
+
this.emitError({
|
|
412
|
+
extensionPath: ext.path,
|
|
413
|
+
event: event.type,
|
|
414
|
+
error: message,
|
|
415
|
+
stack
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return result;
|
|
420
|
+
}
|
|
421
|
+
async emitMessageEnd(event) {
|
|
422
|
+
let ctx = this.createContext(), currentMessage = event.message, modified = !1;
|
|
423
|
+
for (let ext of this.extensions) {
|
|
424
|
+
let handlers = ext.handlers.get("message_end");
|
|
425
|
+
if (!(!handlers || handlers.length === 0))
|
|
426
|
+
for (let handler of handlers)
|
|
427
|
+
try {
|
|
428
|
+
let currentEvent = { ...event, message: currentMessage }, handlerResult = await handler(currentEvent, ctx);
|
|
429
|
+
if (!handlerResult?.message)
|
|
430
|
+
continue;
|
|
431
|
+
if (handlerResult.message.role !== currentMessage.role) {
|
|
432
|
+
this.emitError({
|
|
433
|
+
extensionPath: ext.path,
|
|
434
|
+
event: "message_end",
|
|
435
|
+
error: "message_end handlers must return a message with the same role"
|
|
436
|
+
});
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
currentMessage = handlerResult.message, modified = !0;
|
|
440
|
+
} catch (err) {
|
|
441
|
+
let message = err instanceof Error ? err.message : String(err), stack = err instanceof Error ? err.stack : void 0;
|
|
442
|
+
this.emitError({
|
|
443
|
+
extensionPath: ext.path,
|
|
444
|
+
event: "message_end",
|
|
445
|
+
error: message,
|
|
446
|
+
stack
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return modified ? currentMessage : void 0;
|
|
451
|
+
}
|
|
452
|
+
async emitToolResult(event) {
|
|
453
|
+
let ctx = this.createContext(), currentEvent = { ...event }, modified = !1;
|
|
454
|
+
for (let ext of this.extensions) {
|
|
455
|
+
let handlers = ext.handlers.get("tool_result");
|
|
456
|
+
if (!(!handlers || handlers.length === 0))
|
|
457
|
+
for (let handler of handlers)
|
|
458
|
+
try {
|
|
459
|
+
let handlerResult = await handler(currentEvent, ctx);
|
|
460
|
+
if (!handlerResult)
|
|
461
|
+
continue;
|
|
462
|
+
handlerResult.content !== void 0 && (currentEvent.content = handlerResult.content, modified = !0), handlerResult.details !== void 0 && (currentEvent.details = handlerResult.details, modified = !0), handlerResult.isError !== void 0 && (currentEvent.isError = handlerResult.isError, modified = !0);
|
|
463
|
+
} catch (err) {
|
|
464
|
+
let message = err instanceof Error ? err.message : String(err), stack = err instanceof Error ? err.stack : void 0;
|
|
465
|
+
this.emitError({
|
|
466
|
+
extensionPath: ext.path,
|
|
467
|
+
event: "tool_result",
|
|
468
|
+
error: message,
|
|
469
|
+
stack
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
if (modified)
|
|
474
|
+
return {
|
|
475
|
+
content: currentEvent.content,
|
|
476
|
+
details: currentEvent.details,
|
|
477
|
+
isError: currentEvent.isError
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
async emitToolCall(event) {
|
|
481
|
+
let ctx = this.createContext(), result;
|
|
482
|
+
for (let ext of this.extensions) {
|
|
483
|
+
let handlers = ext.handlers.get("tool_call");
|
|
484
|
+
if (!(!handlers || handlers.length === 0))
|
|
485
|
+
for (let handler of handlers) {
|
|
486
|
+
let handlerResult = await handler(event, ctx);
|
|
487
|
+
if (handlerResult && (result = handlerResult, result.block))
|
|
488
|
+
return result;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return result;
|
|
492
|
+
}
|
|
493
|
+
async emitUserBash(event) {
|
|
494
|
+
let ctx = this.createContext();
|
|
495
|
+
for (let ext of this.extensions) {
|
|
496
|
+
let handlers = ext.handlers.get("user_bash");
|
|
497
|
+
if (!(!handlers || handlers.length === 0))
|
|
498
|
+
for (let handler of handlers)
|
|
499
|
+
try {
|
|
500
|
+
let handlerResult = await handler(event, ctx);
|
|
501
|
+
if (handlerResult)
|
|
502
|
+
return handlerResult;
|
|
503
|
+
} catch (err) {
|
|
504
|
+
let message = err instanceof Error ? err.message : String(err), stack = err instanceof Error ? err.stack : void 0;
|
|
505
|
+
this.emitError({
|
|
506
|
+
extensionPath: ext.path,
|
|
507
|
+
event: "user_bash",
|
|
508
|
+
error: message,
|
|
509
|
+
stack
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
async emitContext(messages) {
|
|
515
|
+
let ctx = this.createContext(), currentMessages = structuredClone(messages);
|
|
516
|
+
for (let ext of this.extensions) {
|
|
517
|
+
let handlers = ext.handlers.get("context");
|
|
518
|
+
if (!(!handlers || handlers.length === 0))
|
|
519
|
+
for (let handler of handlers)
|
|
520
|
+
try {
|
|
521
|
+
let handlerResult = await handler({ type: "context", messages: currentMessages }, ctx);
|
|
522
|
+
handlerResult && handlerResult.messages && (currentMessages = handlerResult.messages);
|
|
523
|
+
} catch (err) {
|
|
524
|
+
let message = err instanceof Error ? err.message : String(err), stack = err instanceof Error ? err.stack : void 0;
|
|
525
|
+
this.emitError({
|
|
526
|
+
extensionPath: ext.path,
|
|
527
|
+
event: "context",
|
|
528
|
+
error: message,
|
|
529
|
+
stack
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
return currentMessages;
|
|
534
|
+
}
|
|
535
|
+
async emitBeforeProviderRequest(payload) {
|
|
536
|
+
let ctx = this.createContext(), currentPayload = payload;
|
|
537
|
+
for (let ext of this.extensions) {
|
|
538
|
+
let handlers = ext.handlers.get("before_provider_request");
|
|
539
|
+
if (!(!handlers || handlers.length === 0))
|
|
540
|
+
for (let handler of handlers)
|
|
541
|
+
try {
|
|
542
|
+
let handlerResult = await handler({
|
|
543
|
+
type: "before_provider_request",
|
|
544
|
+
payload: currentPayload
|
|
545
|
+
}, ctx);
|
|
546
|
+
handlerResult !== void 0 && (currentPayload = handlerResult);
|
|
547
|
+
} catch (err) {
|
|
548
|
+
let message = err instanceof Error ? err.message : String(err), stack = err instanceof Error ? err.stack : void 0;
|
|
549
|
+
this.emitError({
|
|
550
|
+
extensionPath: ext.path,
|
|
551
|
+
event: "before_provider_request",
|
|
552
|
+
error: message,
|
|
553
|
+
stack
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
return currentPayload;
|
|
558
|
+
}
|
|
559
|
+
async emitBeforeProviderHeaders(headers) {
|
|
560
|
+
let ctx = this.createContext();
|
|
561
|
+
for (let ext of this.extensions) {
|
|
562
|
+
let handlers = ext.handlers.get("before_provider_headers");
|
|
563
|
+
if (!(!handlers || handlers.length === 0))
|
|
564
|
+
for (let handler of handlers)
|
|
565
|
+
try {
|
|
566
|
+
await handler({
|
|
567
|
+
type: "before_provider_headers",
|
|
568
|
+
headers
|
|
569
|
+
}, ctx);
|
|
570
|
+
} catch (err) {
|
|
571
|
+
let message = err instanceof Error ? err.message : String(err), stack = err instanceof Error ? err.stack : void 0;
|
|
572
|
+
this.emitError({
|
|
573
|
+
extensionPath: ext.path,
|
|
574
|
+
event: "before_provider_headers",
|
|
575
|
+
error: message,
|
|
576
|
+
stack
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
return headers;
|
|
581
|
+
}
|
|
582
|
+
async emitBeforeAgentStart(prompt, images, systemPrompt, systemPromptOptions) {
|
|
583
|
+
let currentSystemPrompt = systemPrompt, ctx = Object.defineProperties({}, Object.getOwnPropertyDescriptors(this.createContext()));
|
|
584
|
+
ctx.getSystemPrompt = () => (this.assertActive(), currentSystemPrompt);
|
|
585
|
+
let messages = [], systemPromptModified = !1;
|
|
586
|
+
for (let ext of this.extensions) {
|
|
587
|
+
let handlers = ext.handlers.get("before_agent_start");
|
|
588
|
+
if (!(!handlers || handlers.length === 0))
|
|
589
|
+
for (let handler of handlers)
|
|
590
|
+
try {
|
|
591
|
+
let handlerResult = await handler({
|
|
592
|
+
type: "before_agent_start",
|
|
593
|
+
prompt,
|
|
594
|
+
images,
|
|
595
|
+
systemPrompt: currentSystemPrompt,
|
|
596
|
+
systemPromptOptions
|
|
597
|
+
}, ctx);
|
|
598
|
+
if (handlerResult) {
|
|
599
|
+
let result = handlerResult;
|
|
600
|
+
result.message && messages.push(result.message), result.systemPrompt !== void 0 && (currentSystemPrompt = result.systemPrompt, systemPromptModified = !0);
|
|
601
|
+
}
|
|
602
|
+
} catch (err) {
|
|
603
|
+
let message = err instanceof Error ? err.message : String(err), stack = err instanceof Error ? err.stack : void 0;
|
|
604
|
+
this.emitError({
|
|
605
|
+
extensionPath: ext.path,
|
|
606
|
+
event: "before_agent_start",
|
|
607
|
+
error: message,
|
|
608
|
+
stack
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
if (messages.length > 0 || systemPromptModified)
|
|
613
|
+
return {
|
|
614
|
+
messages: messages.length > 0 ? messages : void 0,
|
|
615
|
+
systemPrompt: systemPromptModified ? currentSystemPrompt : void 0
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
async emitResourcesDiscover(cwd, reason) {
|
|
619
|
+
let ctx = this.createContext(), skillPaths = [], promptPaths = [], themePaths = [];
|
|
620
|
+
for (let ext of this.extensions) {
|
|
621
|
+
let handlers = ext.handlers.get("resources_discover");
|
|
622
|
+
if (!(!handlers || handlers.length === 0))
|
|
623
|
+
for (let handler of handlers)
|
|
624
|
+
try {
|
|
625
|
+
let result = await handler({ type: "resources_discover", cwd, reason }, ctx);
|
|
626
|
+
result?.skillPaths?.length && skillPaths.push(...result.skillPaths.map((path) => ({ path, extensionPath: ext.path }))), result?.promptPaths?.length && promptPaths.push(...result.promptPaths.map((path) => ({ path, extensionPath: ext.path }))), result?.themePaths?.length && themePaths.push(...result.themePaths.map((path) => ({ path, extensionPath: ext.path })));
|
|
627
|
+
} catch (err) {
|
|
628
|
+
let message = err instanceof Error ? err.message : String(err), stack = err instanceof Error ? err.stack : void 0;
|
|
629
|
+
this.emitError({
|
|
630
|
+
extensionPath: ext.path,
|
|
631
|
+
event: "resources_discover",
|
|
632
|
+
error: message,
|
|
633
|
+
stack
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return { skillPaths, promptPaths, themePaths };
|
|
638
|
+
}
|
|
639
|
+
/** Emit input event. Transforms chain, "handled" short-circuits. */
|
|
640
|
+
async emitInput(text, images, source, streamingBehavior) {
|
|
641
|
+
let ctx = this.createContext(), currentText = text, currentImages = images;
|
|
642
|
+
for (let ext of this.extensions)
|
|
643
|
+
for (let handler of ext.handlers.get("input") ?? [])
|
|
644
|
+
try {
|
|
645
|
+
let result = await handler({
|
|
646
|
+
type: "input",
|
|
647
|
+
text: currentText,
|
|
648
|
+
images: currentImages,
|
|
649
|
+
source,
|
|
650
|
+
streamingBehavior
|
|
651
|
+
}, ctx);
|
|
652
|
+
if (result?.action === "handled")
|
|
653
|
+
return result;
|
|
654
|
+
result?.action === "transform" && (currentText = result.text, currentImages = result.images ?? currentImages);
|
|
655
|
+
} catch (err) {
|
|
656
|
+
this.emitError({
|
|
657
|
+
extensionPath: ext.path,
|
|
658
|
+
event: "input",
|
|
659
|
+
error: err instanceof Error ? err.message : String(err),
|
|
660
|
+
stack: err instanceof Error ? err.stack : void 0
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
return currentText !== text || currentImages !== images ? { action: "transform", text: currentText, images: currentImages } : { action: "continue" };
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
export {
|
|
668
|
+
emitSessionShutdownEvent,
|
|
669
|
+
emitProjectTrustEvent,
|
|
670
|
+
noOpUIContext,
|
|
671
|
+
ExtensionRunner
|
|
672
|
+
};
|