@gajae-code/coding-agent 0.11.1 → 0.11.2
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 +54 -0
- package/dist/types/cli/config-cli.d.ts +11 -1
- package/dist/types/cli/notify-cli.d.ts +1 -0
- package/dist/types/cli/session-picker.d.ts +2 -1
- package/dist/types/cli/setup-cli.d.ts +1 -1
- package/dist/types/commands/mcp-serve.d.ts +33 -0
- package/dist/types/commands/mcp.d.ts +1 -1
- package/dist/types/commands/notify.d.ts +0 -2
- package/dist/types/commands/sdk.d.ts +1 -1
- package/dist/types/config/atomic-yaml-patch.d.ts +18 -0
- package/dist/types/config/file-lock.d.ts +14 -4
- package/dist/types/config/keybindings.d.ts +42 -1
- package/dist/types/config/model-auth.d.ts +3 -0
- package/dist/types/config/model-bindings-applier.d.ts +13 -0
- package/dist/types/config/model-discovery-manager.d.ts +49 -0
- package/dist/types/config/model-equivalence.d.ts +20 -0
- package/dist/types/config/model-registry.d.ts +16 -15
- package/dist/types/config/model-resolver.d.ts +28 -18
- package/dist/types/config/models-config-schema.d.ts +11 -0
- package/dist/types/config/settings-schema.d.ts +56 -1
- package/dist/types/config/settings.d.ts +14 -11
- package/dist/types/coordinator-mcp/policy.d.ts +5 -0
- package/dist/types/coordinator-mcp/question-gate-codec.d.ts +129 -0
- package/dist/types/coordinator-mcp/question-state.d.ts +356 -0
- package/dist/types/coordinator-mcp/server.d.ts +4 -0
- package/dist/types/discovery/helpers.d.ts +0 -6
- package/dist/types/edit/index.d.ts +3 -0
- package/dist/types/eval/py/env.d.ts +9 -0
- package/dist/types/extensibility/extensions/loader.d.ts +2 -1
- package/dist/types/extensibility/extensions/runner.d.ts +2 -2
- package/dist/types/extensibility/extensions/types.d.ts +34 -3
- package/dist/types/extensibility/hooks/runner.d.ts +1 -1
- package/dist/types/extensibility/shared-events.d.ts +2 -0
- package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +10 -1
- package/dist/types/gjc-runtime/deep-interview-state.d.ts +44 -0
- package/dist/types/gjc-runtime/goal-mode-request.d.ts +11 -1
- package/dist/types/gjc-runtime/launch-worktree.d.ts +4 -2
- package/dist/types/gjc-runtime/linux-proc.d.ts +29 -0
- package/dist/types/gjc-runtime/session-resolution.d.ts +2 -2
- package/dist/types/gjc-runtime/state-migrations.d.ts +1 -1
- package/dist/types/gjc-runtime/state-writer.d.ts +2 -1
- package/dist/types/gjc-runtime/team-launch.d.ts +59 -0
- package/dist/types/gjc-runtime/team-notify.d.ts +45 -0
- package/dist/types/gjc-runtime/team-runtime.d.ts +29 -121
- package/dist/types/gjc-runtime/team-store.d.ts +160 -0
- package/dist/types/gjc-runtime/team-workers.d.ts +78 -0
- package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +8 -0
- package/dist/types/gjc-runtime/ultragoal-change-set.d.ts +13 -0
- package/dist/types/gjc-runtime/ultragoal-evidence.d.ts +38 -0
- package/dist/types/gjc-runtime/ultragoal-guard.d.ts +7 -0
- package/dist/types/gjc-runtime/ultragoal-pipeline.d.ts +23 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +55 -33
- package/dist/types/gjc-runtime/workflow-cli-common.d.ts +8 -0
- package/dist/types/gjc-runtime/workflow-manifest.d.ts +3 -0
- package/dist/types/goals/continuation-timeout-guard.d.ts +22 -0
- package/dist/types/goals/runtime.d.ts +1 -0
- package/dist/types/goals/state.d.ts +8 -0
- package/dist/types/harness-control-plane/lifecycle-reconciliation.d.ts +17 -0
- package/dist/types/harness-control-plane/phase-rollup.d.ts +4 -7
- package/dist/types/harness-control-plane/receipt-ingest.d.ts +5 -0
- package/dist/types/harness-control-plane/receipt-spool.d.ts +4 -0
- package/dist/types/hindsight/state.d.ts +11 -4
- package/dist/types/lsp/lspmux.d.ts +5 -3
- package/dist/types/lsp/path-trust.d.ts +1 -0
- package/dist/types/main.d.ts +3 -2
- package/dist/types/memories/storage.d.ts +1 -0
- package/dist/types/modes/action-registry.d.ts +29 -0
- package/dist/types/modes/components/chrome.d.ts +14 -0
- package/dist/types/modes/components/command-palette.d.ts +27 -0
- package/dist/types/modes/components/custom-provider-wizard.d.ts +1 -0
- package/dist/types/modes/components/index.d.ts +2 -1
- package/dist/types/modes/components/pet-selector.d.ts +1 -1
- package/dist/types/modes/components/plan-preview-overlay.d.ts +43 -0
- package/dist/types/modes/components/queue-mode-selector.d.ts +1 -1
- package/dist/types/modes/components/queue-pane.d.ts +12 -0
- package/dist/types/modes/components/read-tool-group.d.ts +6 -0
- package/dist/types/modes/components/session-observer-overlay.d.ts +3 -4
- package/dist/types/modes/components/sessions-dashboard.d.ts +32 -0
- package/dist/types/modes/components/settings-selector.d.ts +1 -1
- package/dist/types/modes/components/show-images-selector.d.ts +1 -1
- package/dist/types/modes/components/status-line/types.d.ts +1 -1
- package/dist/types/modes/components/status-line.d.ts +1 -94
- package/dist/types/modes/components/tasks-pane.d.ts +15 -0
- package/dist/types/modes/components/theme-selector.d.ts +1 -1
- package/dist/types/modes/components/tool-execution.d.ts +15 -0
- package/dist/types/modes/components/tool-status-header.d.ts +111 -0
- package/dist/types/modes/components/transcript-viewer-overlay.d.ts +42 -0
- package/dist/types/modes/controllers/goal-mode-controller.d.ts +62 -0
- package/dist/types/modes/controllers/input-controller.d.ts +8 -1
- package/dist/types/modes/controllers/mode-gate.d.ts +8 -0
- package/dist/types/modes/controllers/plan-mode-controller.d.ts +65 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +15 -3
- package/dist/types/modes/controllers/stt-controller.d.ts +26 -0
- package/dist/types/modes/interactive-mode.d.ts +19 -17
- package/dist/types/modes/jobs-observer.d.ts +2 -0
- package/dist/types/modes/shared/agent-wire/deep-interview-gate.d.ts +4 -11
- package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +20 -2
- package/dist/types/modes/shared/agent-wire/workflow-gate-types.d.ts +31 -0
- package/dist/types/modes/tasks-aggregator.d.ts +39 -0
- package/dist/types/modes/transcript-item-registry.d.ts +60 -0
- package/dist/types/modes/types.d.ts +20 -13
- package/dist/types/modes/utils/ui-helpers.d.ts +2 -2
- package/dist/types/runtime-mcp/manager.d.ts +1 -1
- package/dist/types/sdk/broker/broker.d.ts +78 -12
- package/dist/types/sdk/broker/lifecycle-codec.d.ts +4 -0
- package/dist/types/sdk/broker/lifecycle-ledger.d.ts +15 -1
- package/dist/types/sdk/broker/lifecycle.d.ts +6 -2
- package/dist/types/sdk/broker/process-incarnation.d.ts +2 -0
- package/dist/types/sdk/broker/session-index.d.ts +0 -1
- package/dist/types/sdk/broker/state-version.d.ts +2 -0
- package/dist/types/sdk/bus/chat-effect-journal.d.ts +1 -0
- package/dist/types/sdk/bus/config-commands.d.ts +1 -1
- package/dist/types/sdk/bus/config.d.ts +11 -0
- package/dist/types/sdk/bus/daemon-paths.d.ts +1 -0
- package/dist/types/sdk/bus/html-format.d.ts +3 -2
- package/dist/types/sdk/bus/index.d.ts +27 -0
- package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +4 -0
- package/dist/types/sdk/bus/notification-service.d.ts +20 -0
- package/dist/types/sdk/bus/rate-limit-pool.d.ts +13 -2
- package/dist/types/sdk/bus/recent-activity.d.ts +21 -12
- package/dist/types/sdk/bus/rich-document.d.ts +7 -0
- package/dist/types/sdk/bus/rich-render.d.ts +18 -41
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +9 -4
- package/dist/types/sdk/bus/telegram-daemon.d.ts +46 -3
- package/dist/types/sdk/bus/threaded-inbound.d.ts +1 -1
- package/dist/types/sdk/bus/threaded-render.d.ts +13 -0
- package/dist/types/sdk/bus/topic-registry.d.ts +24 -2
- package/dist/types/sdk/host/control/operations.d.ts +1 -1
- package/dist/types/sdk/host/host.d.ts +2 -0
- package/dist/types/sdk/index.d.ts +1 -0
- package/dist/types/sdk/session-directory.d.ts +56 -0
- package/dist/types/session/agent-session.d.ts +82 -47
- package/dist/types/session/agent-storage.d.ts +7 -0
- package/dist/types/session/fallback-chain-controller.d.ts +10 -2
- package/dist/types/session/internal/managed-session-scope.d.ts +102 -0
- package/dist/types/session/internal/managed-session-storage.d.ts +38 -0
- package/dist/types/session/messages.d.ts +16 -0
- package/dist/types/session/session-manager-internal.d.ts +14 -0
- package/dist/types/session/session-manager.d.ts +82 -12
- package/dist/types/session/session-storage.d.ts +43 -3
- package/dist/types/session/volatile-context-pruning.d.ts +15 -0
- package/dist/types/skill-state/{deep-interview-mutation-guard.d.ts → workflow-mutation-guard.d.ts} +24 -8
- package/dist/types/skill-state/workflow-state-contract.d.ts +1 -3
- package/dist/types/slash-commands/builtin-registry.d.ts +4 -1
- package/dist/types/system-prompt.d.ts +2 -11
- package/dist/types/task/executor.d.ts +3 -1
- package/dist/types/thinking.d.ts +7 -0
- package/dist/types/tool-discovery/tool-index.d.ts +1 -50
- package/dist/types/tools/ask.d.ts +64 -2
- package/dist/types/tools/bash.d.ts +3 -0
- package/dist/types/tools/browser/dead-tab-recovery.d.ts +24 -0
- package/dist/types/tools/browser/tab-supervisor.d.ts +21 -0
- package/dist/types/tools/cron.d.ts +2 -0
- package/dist/types/tools/fetch.d.ts +1 -0
- package/dist/types/tools/index.d.ts +30 -15
- package/dist/types/tools/output-meta.d.ts +1 -0
- package/dist/types/tools/read.d.ts +3 -0
- package/dist/types/tools/search-tool-bm25.d.ts +3 -4
- package/dist/types/utils/event-bus.d.ts +1 -1
- package/dist/types/web/search/index.d.ts +3 -1
- package/package.json +21 -9
- package/scripts/build-sdk-package-smoke.ts +34 -1
- package/scripts/generate-hotkeys-docs.ts +74 -0
- package/scripts/generate-sdk-operation-inventory.ts +64 -20
- package/scripts/verify-gjc-sdk-canonicalization.ts +182 -2
- package/src/async/job-manager.ts +49 -6
- package/src/cli/config-cli.ts +75 -2
- package/src/cli/notify-cli.ts +92 -26
- package/src/cli/session-picker.ts +20 -3
- package/src/cli/setup-cli.ts +1 -1
- package/src/cli.ts +1 -1
- package/src/commands/config.ts +1 -1
- package/src/commands/harness.ts +34 -106
- package/src/commands/launch.ts +6 -4
- package/src/commands/mcp-serve.ts +85 -8
- package/src/commands/mcp.ts +2 -2
- package/src/commands/notify.ts +8 -4
- package/src/commands/sdk.ts +61 -40
- package/src/commands/ultragoal.ts +4 -1
- package/src/config/atomic-yaml-patch.ts +80 -13
- package/src/config/file-lock.ts +105 -43
- package/src/config/keybindings.ts +64 -20
- package/src/config/model-auth.ts +9 -0
- package/src/config/model-bindings-applier.ts +139 -0
- package/src/config/model-discovery-manager.ts +224 -0
- package/src/config/model-equivalence.ts +66 -0
- package/src/config/model-registry.ts +169 -302
- package/src/config/model-resolver.ts +361 -369
- package/src/config/models-config-schema.ts +5 -4
- package/src/config/settings-schema.ts +159 -2
- package/src/config/settings.ts +458 -482
- package/src/coordinator-mcp/policy.ts +76 -11
- package/src/coordinator-mcp/question-gate-codec.ts +274 -0
- package/src/coordinator-mcp/question-state.ts +778 -0
- package/src/coordinator-mcp/server.ts +1702 -238
- package/src/debug/index.ts +1 -1
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +13 -1
- package/src/defaults/gjc/skills/team/SKILL.md +16 -0
- package/src/discovery/helpers.ts +1 -50
- package/src/edit/index.ts +64 -0
- package/src/eval/py/env.ts +26 -0
- package/src/eval/py/kernel.ts +5 -3
- package/src/extensibility/extensions/loader.ts +9 -1
- package/src/extensibility/extensions/runner.ts +12 -3
- package/src/extensibility/extensions/types.ts +39 -1
- package/src/extensibility/gjc-plugins/installer.ts +16 -16
- package/src/extensibility/hooks/runner.ts +2 -2
- package/src/extensibility/runtime-skill-discovery.ts +33 -13
- package/src/extensibility/shared-events.ts +2 -0
- package/src/gjc-runtime/deep-interview-recorder.ts +63 -3
- package/src/gjc-runtime/deep-interview-runtime.ts +76 -27
- package/src/gjc-runtime/deep-interview-state.ts +317 -5
- package/src/gjc-runtime/goal-mode-request.ts +55 -8
- package/src/gjc-runtime/launch-tmux.ts +2 -5
- package/src/gjc-runtime/launch-worktree.ts +5 -5
- package/src/gjc-runtime/linux-proc.ts +71 -0
- package/src/gjc-runtime/ralplan-runtime.ts +74 -90
- package/src/gjc-runtime/session-resolution.ts +18 -3
- package/src/gjc-runtime/session-state-sidecar.ts +6 -107
- package/src/gjc-runtime/state-migrations.ts +1 -1
- package/src/gjc-runtime/state-runtime.ts +320 -249
- package/src/gjc-runtime/state-writer.ts +36 -40
- package/src/gjc-runtime/team-launch.ts +319 -0
- package/src/gjc-runtime/team-notify.ts +326 -0
- package/src/gjc-runtime/team-runtime.ts +1099 -1482
- package/src/gjc-runtime/team-store.ts +828 -0
- package/src/gjc-runtime/team-workers.ts +962 -0
- package/src/gjc-runtime/tmux-owner-isolation-cli.ts +2 -11
- package/src/gjc-runtime/tmux-owner-isolation.ts +14 -9
- package/src/gjc-runtime/tmux-sessions.ts +4 -21
- package/src/gjc-runtime/ultragoal-change-set.ts +172 -0
- package/src/gjc-runtime/ultragoal-evidence.ts +874 -0
- package/src/gjc-runtime/ultragoal-guard.ts +29 -5
- package/src/gjc-runtime/ultragoal-pipeline.ts +306 -0
- package/src/gjc-runtime/ultragoal-runtime.ts +84 -1311
- package/src/gjc-runtime/workflow-cli-common.ts +30 -0
- package/src/gjc-runtime/workflow-manifest.generated.json +58 -0
- package/src/gjc-runtime/workflow-manifest.ts +18 -0
- package/src/goals/continuation-timeout-guard.ts +79 -0
- package/src/goals/runtime.ts +7 -5
- package/src/goals/state.ts +18 -0
- package/src/harness-control-plane/lifecycle-reconciliation.ts +64 -0
- package/src/harness-control-plane/phase-rollup.ts +4 -7
- package/src/harness-control-plane/receipt-ingest.ts +5 -0
- package/src/harness-control-plane/receipt-spool.ts +51 -7
- package/src/harness-control-plane/session-lease.ts +12 -130
- package/src/hindsight/backend.ts +26 -27
- package/src/hindsight/state.ts +101 -32
- package/src/hooks/skill-state.ts +17 -11
- package/src/internal-urls/docs-index.generated.ts +21 -18
- package/src/lsp/client.ts +1 -1
- package/src/lsp/config.ts +145 -26
- package/src/lsp/index.ts +1 -1
- package/src/lsp/lspmux.ts +39 -10
- package/src/lsp/path-trust.ts +81 -0
- package/src/main.ts +28 -8
- package/src/memories/index.ts +1 -0
- package/src/memories/storage.ts +6 -2
- package/src/modes/action-registry.ts +165 -0
- package/src/modes/components/chrome.ts +40 -0
- package/src/modes/components/command-palette.ts +168 -0
- package/src/modes/components/custom-editor.ts +1 -1
- package/src/modes/components/custom-provider-wizard.ts +51 -14
- package/src/modes/components/index.ts +2 -1
- package/src/modes/components/pet-selector.ts +11 -17
- package/src/modes/components/plan-preview-overlay.ts +295 -0
- package/src/modes/components/queue-mode-selector.ts +10 -27
- package/src/modes/components/queue-pane.ts +79 -0
- package/src/modes/components/read-tool-group.ts +13 -0
- package/src/modes/components/session-observer-overlay.ts +207 -772
- package/src/modes/components/sessions-dashboard.ts +181 -0
- package/src/modes/components/settings-selector.ts +1 -1
- package/src/modes/components/show-images-selector.ts +10 -24
- package/src/modes/components/status-line/types.ts +1 -1
- package/src/modes/components/status-line.ts +1 -969
- package/src/modes/components/tasks-pane.ts +73 -0
- package/src/modes/components/theme-selector.ts +11 -31
- package/src/modes/components/tool-execution.ts +22 -0
- package/src/modes/components/tool-status-header.ts +1056 -0
- package/src/modes/components/transcript-viewer-overlay.ts +384 -0
- package/src/modes/controllers/btw-controller.ts +1 -0
- package/src/modes/controllers/event-controller.ts +3 -2
- package/src/modes/controllers/extension-ui-controller.ts +24 -1
- package/src/modes/controllers/goal-mode-controller.ts +474 -0
- package/src/modes/controllers/input-controller.ts +764 -229
- package/src/modes/controllers/mode-gate.ts +24 -0
- package/src/modes/controllers/plan-mode-controller.ts +517 -0
- package/src/modes/controllers/selector-controller.ts +225 -10
- package/src/modes/controllers/stt-controller.ts +125 -0
- package/src/modes/interactive-mode.ts +289 -1150
- package/src/modes/jobs-observer.ts +3 -0
- package/src/modes/runtime-init.ts +8 -0
- package/src/modes/shared/agent-wire/deep-interview-gate.ts +31 -106
- package/src/modes/shared/agent-wire/workflow-gate-broker.ts +71 -16
- package/src/modes/shared/agent-wire/workflow-gate-types.ts +177 -0
- package/src/modes/tasks-aggregator.ts +199 -0
- package/src/modes/transcript-item-registry.ts +229 -0
- package/src/modes/types.ts +45 -18
- package/src/modes/utils/ui-helpers.ts +17 -9
- package/src/prompts/agent-fragments/ralplan-persistence.md +6 -0
- package/src/prompts/agent-fragments/restricted-bash.md +1 -0
- package/src/prompts/agents/architect.md +2 -8
- package/src/prompts/agents/critic.md +2 -8
- package/src/prompts/agents/executor.md +3 -0
- package/src/prompts/agents/planner.md +4 -12
- package/src/prompts/system/custom-system-prompt.md +1 -23
- package/src/prompts/system/plan-mode-approved.md +8 -0
- package/src/prompts/system/system-prompt.md +17 -96
- package/src/prompts/tools/bash.md +4 -4
- package/src/prompts/tools/browser.md +15 -52
- package/src/prompts/tools/find.md +2 -2
- package/src/prompts/tools/hashline.md +13 -55
- package/src/prompts/tools/read.md +3 -6
- package/src/prompts/tools/search-tool-bm25.md +0 -2
- package/src/prompts/tools/search.md +2 -4
- package/src/prompts/tools/skill-discovery.md +1 -2
- package/src/prompts/tools/task.md +1 -1
- package/src/runtime-mcp/manager.ts +1 -1
- package/src/sdk/broker/broker.ts +206 -78
- package/src/sdk/broker/discovery.ts +1 -1
- package/src/sdk/broker/ensure.ts +3 -1
- package/src/sdk/broker/lifecycle-codec.ts +11 -0
- package/src/sdk/broker/lifecycle-ledger.ts +371 -74
- package/src/sdk/broker/lifecycle.ts +1399 -142
- package/src/sdk/broker/process-incarnation.ts +5 -13
- package/src/sdk/broker/session-index.ts +145 -56
- package/src/sdk/broker/state-version.ts +21 -0
- package/src/sdk/broker/transport.ts +1 -1
- package/src/sdk/bus/chat-daemon-cli.ts +2 -0
- package/src/sdk/bus/chat-daemon-control.ts +8 -28
- package/src/sdk/bus/chat-effect-journal.ts +10 -2
- package/src/sdk/bus/config-commands.ts +5 -4
- package/src/sdk/bus/config.ts +98 -0
- package/src/sdk/bus/conversation-store.ts +5 -29
- package/src/sdk/bus/daemon-paths.ts +2 -0
- package/src/sdk/bus/html-format.ts +20 -3
- package/src/sdk/bus/index.ts +778 -93
- package/src/sdk/bus/lifecycle-control-runtime.ts +91 -33
- package/src/sdk/bus/natives-augment.d.ts +26 -1
- package/src/sdk/bus/notification-service.ts +168 -20
- package/src/sdk/bus/rate-limit-pool.ts +58 -14
- package/src/sdk/bus/recent-activity.ts +188 -74
- package/src/sdk/bus/rich-document.ts +258 -0
- package/src/sdk/bus/rich-render.ts +62 -70
- package/src/sdk/bus/telegram-daemon-cli.ts +15 -59
- package/src/sdk/bus/telegram-daemon-contract.ts +9 -4
- package/src/sdk/bus/telegram-daemon.ts +1389 -237
- package/src/sdk/bus/threaded-inbound.ts +8 -3
- package/src/sdk/bus/threaded-render.ts +57 -1
- package/src/sdk/bus/topic-registry.ts +120 -13
- package/src/sdk/host/control/dispatch.ts +14 -2
- package/src/sdk/host/control/operations.ts +6 -1
- package/src/sdk/host/host.ts +31 -1
- package/src/sdk/host/query/handlers.ts +20 -22
- package/src/sdk/host/query/revision-store.ts +80 -57
- package/src/sdk/index.ts +1 -0
- package/src/sdk/protocol/operation-inventory.generated.json +943 -1907
- package/src/sdk/session-directory.ts +141 -0
- package/src/sdk/session.ts +458 -479
- package/src/session/agent-session.ts +1700 -583
- package/src/session/agent-storage.ts +18 -0
- package/src/session/cache-economics.ts +25 -8
- package/src/session/fallback-chain-controller.ts +53 -3
- package/src/session/internal/managed-session-scope.ts +2226 -0
- package/src/session/internal/managed-session-storage.ts +453 -0
- package/src/session/messages.ts +91 -2
- package/src/session/session-manager-internal.ts +33 -0
- package/src/session/session-manager.ts +1112 -333
- package/src/session/session-storage.ts +444 -39
- package/src/session/volatile-context-pruning.ts +78 -0
- package/src/setup/credential-auto-import.ts +2 -1
- package/src/setup/hermes/templates/operator-instructions.v1.md +1 -1
- package/src/setup/provider-onboarding.ts +36 -61
- package/src/setup/provider-presets.json +5 -0
- package/src/skill-state/active-state.ts +3 -13
- package/src/skill-state/{deep-interview-mutation-guard.ts → workflow-mutation-guard.ts} +47 -29
- package/src/skill-state/workflow-state-contract.ts +6 -41
- package/src/slash-commands/builtin-registry.ts +46 -11
- package/src/system-prompt.ts +37 -44
- package/src/task/agents.ts +19 -1
- package/src/task/executor.ts +90 -6
- package/src/task/index.ts +36 -21
- package/src/thinking.ts +21 -6
- package/src/tool-discovery/tool-index.ts +2 -134
- package/src/tools/ask.ts +157 -21
- package/src/tools/ast-edit.ts +1 -1
- package/src/tools/bash.ts +38 -0
- package/src/tools/browser/dead-tab-recovery.ts +78 -0
- package/src/tools/browser/tab-supervisor.ts +282 -36
- package/src/tools/computer.ts +10 -3
- package/src/tools/cron.ts +30 -16
- package/src/tools/eval.ts +1 -2
- package/src/tools/fetch.ts +11 -4
- package/src/tools/index.ts +76 -24
- package/src/tools/output-meta.ts +13 -5
- package/src/tools/read.ts +37 -1
- package/src/tools/resource-gc.ts +2 -2
- package/src/tools/search-tool-bm25.ts +11 -74
- package/src/utils/event-bus.ts +9 -4
- package/src/web/search/index.ts +3 -3
- package/dist/types/discovery/plugin-dir-roots.d.ts +0 -15
- package/dist/types/runtime-mcp/discoverable-tool-metadata.d.ts +0 -7
- package/src/discovery/plugin-dir-roots.ts +0 -28
- package/src/runtime-mcp/discoverable-tool-metadata.ts +0 -25
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Container,
|
|
3
|
+
Markdown,
|
|
4
|
+
type MarkdownTheme,
|
|
5
|
+
type MouseEvent,
|
|
6
|
+
matchesKey,
|
|
7
|
+
truncateToWidth,
|
|
8
|
+
wrapTextWithAnsi,
|
|
9
|
+
} from "@gajae-code/tui";
|
|
10
|
+
import { sanitizeText } from "@gajae-code/utils";
|
|
11
|
+
import { getMarkdownTheme, theme } from "../theme/theme";
|
|
12
|
+
import type { TranscriptItemRegistry, TranscriptSourcePayload } from "../transcript-item-registry";
|
|
13
|
+
import { DynamicBorder } from "./dynamic-border";
|
|
14
|
+
|
|
15
|
+
const INDENT = " ";
|
|
16
|
+
const PAGE_SIZE = 15;
|
|
17
|
+
const PREVIEW_LINES = 4;
|
|
18
|
+
|
|
19
|
+
export type TranscriptViewerEntry = {
|
|
20
|
+
id: string;
|
|
21
|
+
kind: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
payload: TranscriptSourcePayload;
|
|
24
|
+
copyable?: boolean;
|
|
25
|
+
foldable?: boolean;
|
|
26
|
+
rawViewable?: boolean;
|
|
27
|
+
getDisplayText?: (expanded: boolean) => string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type TranscriptViewerOverlayOptions = {
|
|
31
|
+
title?: string;
|
|
32
|
+
getEntries: () => readonly TranscriptViewerEntry[];
|
|
33
|
+
onClose: () => void;
|
|
34
|
+
requestRender?: () => void;
|
|
35
|
+
copyToClipboard?: (text: string) => void;
|
|
36
|
+
onError?: (message: string) => void;
|
|
37
|
+
enterExpands?: boolean;
|
|
38
|
+
initialSelection?: "first" | "latest";
|
|
39
|
+
followTail?: boolean;
|
|
40
|
+
getHeaderLines?: () => readonly string[];
|
|
41
|
+
getFooterLines?: () => readonly string[];
|
|
42
|
+
maxExpandedLines?: number;
|
|
43
|
+
footerControls?: string;
|
|
44
|
+
getEntryText?: (entry: TranscriptViewerEntry, expanded: boolean) => string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
type RenderedEntry = { lineStart: number; lineCount: number };
|
|
48
|
+
|
|
49
|
+
/** Message-agnostic, modal transcript browser over resolved projection entries. */
|
|
50
|
+
export class TranscriptViewerOverlay extends Container {
|
|
51
|
+
#options: TranscriptViewerOverlayOptions;
|
|
52
|
+
#entries: readonly TranscriptViewerEntry[] = [];
|
|
53
|
+
#renderedEntries: RenderedEntry[] = [];
|
|
54
|
+
#expanded = new Set<string>();
|
|
55
|
+
#raw = new Set<string>();
|
|
56
|
+
#selected = 0;
|
|
57
|
+
#scrollOffset = 0;
|
|
58
|
+
#viewportHeight = 20;
|
|
59
|
+
#lines: string[] = [];
|
|
60
|
+
#fullscreen = false;
|
|
61
|
+
#mdTheme: MarkdownTheme = getMarkdownTheme();
|
|
62
|
+
#width = 80;
|
|
63
|
+
#initialized = false;
|
|
64
|
+
#contentOrigin = 3;
|
|
65
|
+
#followTailPending = false;
|
|
66
|
+
#skipFollowTailOnce = false;
|
|
67
|
+
#followTailActive = false;
|
|
68
|
+
|
|
69
|
+
constructor(options: TranscriptViewerOverlayOptions) {
|
|
70
|
+
super();
|
|
71
|
+
this.#options = options;
|
|
72
|
+
this.#followTailActive = options.followTail === true;
|
|
73
|
+
this.refresh();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
get selectedEntryId(): string | undefined {
|
|
77
|
+
return this.#entries[this.#selected]?.id;
|
|
78
|
+
}
|
|
79
|
+
get isFullscreen(): boolean {
|
|
80
|
+
return this.#fullscreen;
|
|
81
|
+
}
|
|
82
|
+
refresh(identityMap?: ReadonlyMap<string, string>): void {
|
|
83
|
+
const previous = this.selectedEntryId;
|
|
84
|
+
const previousPosition = this.#selected;
|
|
85
|
+
const reconciledPrevious = previous ? (identityMap?.get(previous) ?? previous) : undefined;
|
|
86
|
+
const wasAtTail = this.#selected >= this.#entries.length - 1;
|
|
87
|
+
this.#entries = this.#options.getEntries();
|
|
88
|
+
const reconciledIndex = reconciledPrevious
|
|
89
|
+
? this.#entries.findIndex(entry => entry.id === reconciledPrevious)
|
|
90
|
+
: -1;
|
|
91
|
+
if (this.#options.initialSelection === "latest" && !this.#initialized)
|
|
92
|
+
this.#selected = Math.max(0, this.#entries.length - 1);
|
|
93
|
+
else if (reconciledIndex >= 0) this.#selected = reconciledIndex;
|
|
94
|
+
else this.#selected = Math.min(previousPosition, Math.max(0, this.#entries.length - 1));
|
|
95
|
+
this.#followTailPending = Boolean(
|
|
96
|
+
this.#followTailActive && !this.#skipFollowTailOnce && (wasAtTail || !this.#initialized),
|
|
97
|
+
);
|
|
98
|
+
if (this.#initialized && this.#followTailActive && wasAtTail && !this.#skipFollowTailOnce)
|
|
99
|
+
this.#selected = Math.max(0, this.#entries.length - 1);
|
|
100
|
+
this.#skipFollowTailOnce = false;
|
|
101
|
+
this.#initialized = true;
|
|
102
|
+
this.#rebuild();
|
|
103
|
+
}
|
|
104
|
+
override render(width: number): string[] {
|
|
105
|
+
this.#width = Math.max(1, width);
|
|
106
|
+
this.refresh();
|
|
107
|
+
const defaultHeader = this.#fullscreen
|
|
108
|
+
? [theme.fg("accent", "Transcript block")]
|
|
109
|
+
: [theme.fg("accent", sanitizeText(this.#options.title ?? "Transcript"))];
|
|
110
|
+
const header = this.#fullscreen
|
|
111
|
+
? defaultHeader
|
|
112
|
+
: [...defaultHeader, ...(this.#options.getHeaderLines?.() ?? []).map(sanitizeText)];
|
|
113
|
+
const defaultFooter = this.#fullscreen
|
|
114
|
+
? [theme.fg("dim", "Esc:back j/k:scroll PgUp/PgDn:page")]
|
|
115
|
+
: [
|
|
116
|
+
theme.fg(
|
|
117
|
+
"dim",
|
|
118
|
+
sanitizeText(
|
|
119
|
+
this.#options.footerControls ??
|
|
120
|
+
"j/k:select Space:expand Enter:fullscreen y:copy Y:metadata r:raw g/G:top/bottom Esc:close",
|
|
121
|
+
),
|
|
122
|
+
),
|
|
123
|
+
];
|
|
124
|
+
const scrollRange =
|
|
125
|
+
this.#lines.length > this.#viewportHeight
|
|
126
|
+
? theme.fg(
|
|
127
|
+
"dim",
|
|
128
|
+
`[${this.#scrollOffset + 1}-${Math.min(this.#scrollOffset + this.#viewportHeight, this.#lines.length)}/${this.#lines.length}]`,
|
|
129
|
+
)
|
|
130
|
+
: "";
|
|
131
|
+
const footer = this.#fullscreen
|
|
132
|
+
? defaultFooter
|
|
133
|
+
: [...(this.#options.getFooterLines?.() ?? []).map(sanitizeText), scrollRange, ...defaultFooter].filter(
|
|
134
|
+
Boolean,
|
|
135
|
+
);
|
|
136
|
+
this.#viewportHeight = Math.max(5, (process.stdout.rows || 40) - header.length - footer.length - 5);
|
|
137
|
+
this.#contentOrigin = header.length + 2;
|
|
138
|
+
const maxScroll = Math.max(0, this.#lines.length - this.#viewportHeight);
|
|
139
|
+
if (this.#followTailPending) {
|
|
140
|
+
this.#scrollOffset = maxScroll;
|
|
141
|
+
this.#followTailPending = false;
|
|
142
|
+
}
|
|
143
|
+
this.#scrollOffset = Math.max(0, Math.min(this.#scrollOffset, maxScroll));
|
|
144
|
+
const visible = this.#lines.slice(this.#scrollOffset, this.#scrollOffset + this.#viewportHeight);
|
|
145
|
+
const lines = [
|
|
146
|
+
...new DynamicBorder().render(this.#width),
|
|
147
|
+
...header.map(line => ` ${line}`),
|
|
148
|
+
...new DynamicBorder().render(this.#width),
|
|
149
|
+
];
|
|
150
|
+
lines.push(...visible.map(line => ` ${line}`));
|
|
151
|
+
for (let i = visible.length; i < this.#viewportHeight; i++) lines.push("");
|
|
152
|
+
lines.push("", ...footer.map(line => ` ${line}`), ...new DynamicBorder().render(this.#width));
|
|
153
|
+
return lines.map(line => truncateToWidth(line, this.#width));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
handleMouse(event: MouseEvent): void {
|
|
157
|
+
if (event.kind !== "click" || this.#fullscreen) return;
|
|
158
|
+
// Render has a border, header, and border before the first viewport row.
|
|
159
|
+
const contentLine = this.#scrollOffset + (event.localY ?? event.y) - this.#contentOrigin;
|
|
160
|
+
const index = this.#renderedEntries.findIndex(
|
|
161
|
+
entry => contentLine >= entry.lineStart && contentLine < entry.lineStart + entry.lineCount,
|
|
162
|
+
);
|
|
163
|
+
if (index < 0) return;
|
|
164
|
+
this.#followTailActive = false;
|
|
165
|
+
this.#selected = index;
|
|
166
|
+
this.#move(0);
|
|
167
|
+
this.#requestRender();
|
|
168
|
+
}
|
|
169
|
+
handleInput(keyData: string): void {
|
|
170
|
+
if (matchesKey(keyData, "escape")) {
|
|
171
|
+
if (this.#fullscreen) {
|
|
172
|
+
this.#fullscreen = false;
|
|
173
|
+
this.#scrollOffset = 0;
|
|
174
|
+
this.#requestRender();
|
|
175
|
+
} else this.#options.onClose();
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (this.#fullscreen) {
|
|
179
|
+
this.#scroll(keyData);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const count = this.#entries.length;
|
|
183
|
+
if (keyData === "j" || matchesKey(keyData, "down")) {
|
|
184
|
+
this.#move(1);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (keyData === "k" || matchesKey(keyData, "up")) {
|
|
188
|
+
this.#move(-1);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (matchesKey(keyData, "pageDown")) {
|
|
192
|
+
this.#page(1);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (matchesKey(keyData, "pageUp")) {
|
|
196
|
+
this.#page(-1);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (keyData === "g") {
|
|
200
|
+
this.#followTailActive = false;
|
|
201
|
+
this.#followTailPending = false;
|
|
202
|
+
this.#selected = 0;
|
|
203
|
+
this.#scrollOffset = 0;
|
|
204
|
+
this.#requestRender();
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (keyData === "G") {
|
|
208
|
+
this.#followTailActive = true;
|
|
209
|
+
this.#followTailPending = true;
|
|
210
|
+
this.#selected = Math.max(0, count - 1);
|
|
211
|
+
this.#scrollOffset = this.#lines.length;
|
|
212
|
+
this.#requestRender();
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (keyData === " " || (this.#options.enterExpands && (matchesKey(keyData, "enter") || keyData === "\r"))) {
|
|
216
|
+
this.#toggleExpand();
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (!this.#options.enterExpands && (matchesKey(keyData, "enter") || keyData === "\r")) {
|
|
220
|
+
this.#followTailActive = false;
|
|
221
|
+
this.#fullscreen = true;
|
|
222
|
+
this.#scrollOffset = 0;
|
|
223
|
+
this.#requestRender();
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (keyData === "y") {
|
|
227
|
+
this.#copy(false);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (keyData === "Y") {
|
|
231
|
+
this.#copy(true);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (keyData === "r") {
|
|
235
|
+
const entry = this.#entries[this.#selected];
|
|
236
|
+
if (entry?.rawViewable !== false) {
|
|
237
|
+
this.#raw.has(entry.id) ? this.#raw.delete(entry.id) : this.#raw.add(entry.id);
|
|
238
|
+
this.#requestRender();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
#scroll(keyData: string): void {
|
|
244
|
+
this.#followTailActive = false;
|
|
245
|
+
this.#followTailPending = false;
|
|
246
|
+
if (keyData === "j" || matchesKey(keyData, "down") || matchesKey(keyData, "pageDown"))
|
|
247
|
+
this.#scrollOffset += PAGE_SIZE;
|
|
248
|
+
if (keyData === "k" || matchesKey(keyData, "up") || matchesKey(keyData, "pageUp"))
|
|
249
|
+
this.#scrollOffset -= PAGE_SIZE;
|
|
250
|
+
this.#requestRender();
|
|
251
|
+
}
|
|
252
|
+
#move(delta: number): void {
|
|
253
|
+
this.#selected = Math.max(0, Math.min(this.#selected + delta, this.#entries.length - 1));
|
|
254
|
+
if (delta !== 0) {
|
|
255
|
+
this.#followTailActive = false;
|
|
256
|
+
this.#followTailPending = false;
|
|
257
|
+
}
|
|
258
|
+
this.#rebuild();
|
|
259
|
+
const entry = this.#renderedEntries[this.#selected];
|
|
260
|
+
if (entry) {
|
|
261
|
+
const entryBottom = entry.lineStart + entry.lineCount;
|
|
262
|
+
if (entry.lineCount >= this.#viewportHeight) {
|
|
263
|
+
if (this.#scrollOffset + this.#viewportHeight <= entry.lineStart)
|
|
264
|
+
this.#scrollOffset = Math.max(0, entry.lineStart - 1);
|
|
265
|
+
else if (this.#scrollOffset >= entryBottom)
|
|
266
|
+
this.#scrollOffset = Math.max(0, entryBottom - this.#viewportHeight);
|
|
267
|
+
} else {
|
|
268
|
+
if (entry.lineStart < this.#scrollOffset) this.#scrollOffset = Math.max(0, entry.lineStart - 1);
|
|
269
|
+
if (entryBottom > this.#scrollOffset + this.#viewportHeight)
|
|
270
|
+
this.#scrollOffset = Math.max(0, entryBottom - this.#viewportHeight + 1);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
this.#requestRender();
|
|
274
|
+
}
|
|
275
|
+
#page(direction: 1 | -1): void {
|
|
276
|
+
this.#followTailActive = false;
|
|
277
|
+
this.#followTailPending = false;
|
|
278
|
+
this.#selected = Math.max(0, Math.min(this.#selected + direction * 5, this.#entries.length - 1));
|
|
279
|
+
this.#scrollOffset += direction * PAGE_SIZE;
|
|
280
|
+
this.#requestRender();
|
|
281
|
+
}
|
|
282
|
+
#toggleExpand(): void {
|
|
283
|
+
this.#followTailActive = false;
|
|
284
|
+
const entry = this.#entries[this.#selected];
|
|
285
|
+
if (!entry || entry.foldable === false) return;
|
|
286
|
+
const expanding = !this.#expanded.has(entry.id);
|
|
287
|
+
if (expanding) this.#expanded.add(entry.id);
|
|
288
|
+
else this.#expanded.delete(entry.id);
|
|
289
|
+
this.#rebuild();
|
|
290
|
+
if (expanding) {
|
|
291
|
+
this.#scrollOffset = this.#renderedEntries[this.#selected]?.lineStart ?? 0;
|
|
292
|
+
this.#skipFollowTailOnce = true;
|
|
293
|
+
}
|
|
294
|
+
this.#requestRender();
|
|
295
|
+
}
|
|
296
|
+
resetSourceState(): void {
|
|
297
|
+
this.#expanded.clear();
|
|
298
|
+
this.#raw.clear();
|
|
299
|
+
this.#scrollOffset = 0;
|
|
300
|
+
this.#initialized = false;
|
|
301
|
+
this.#fullscreen = false;
|
|
302
|
+
this.#skipFollowTailOnce = false;
|
|
303
|
+
this.#followTailPending = false;
|
|
304
|
+
this.#followTailActive = this.#options.followTail === true;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
#copy(metadata: boolean): void {
|
|
308
|
+
const entry = this.#entries[this.#selected];
|
|
309
|
+
if (!entry || entry.copyable === false) return;
|
|
310
|
+
try {
|
|
311
|
+
this.#options.copyToClipboard?.(
|
|
312
|
+
metadata ? JSON.stringify(entry.payload.metadata, null, 2) : entry.payload.text,
|
|
313
|
+
);
|
|
314
|
+
} catch {
|
|
315
|
+
this.#options.onError?.("Failed to copy transcript entry to clipboard.");
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
#requestRender(): void {
|
|
319
|
+
this.#options.requestRender?.();
|
|
320
|
+
}
|
|
321
|
+
#rebuild(): void {
|
|
322
|
+
const lines: string[] = [];
|
|
323
|
+
this.#renderedEntries = [];
|
|
324
|
+
const display = this.#fullscreen ? this.#entries.slice(this.#selected, this.#selected + 1) : this.#entries;
|
|
325
|
+
const contentWidth = Math.max(1, this.#width - INDENT.length - 1);
|
|
326
|
+
for (const entry of display) {
|
|
327
|
+
const start = lines.length;
|
|
328
|
+
const selected = entry.id === this.selectedEntryId;
|
|
329
|
+
const expanded = this.#fullscreen || this.#expanded.has(entry.id);
|
|
330
|
+
const raw = this.#raw.has(entry.id);
|
|
331
|
+
lines.push("");
|
|
332
|
+
lines.push(
|
|
333
|
+
`${selected ? theme.fg("accent", "▶") : " "} ${theme.fg("muted", `[${sanitizeText(entry.label ?? entry.kind)}]`)}`,
|
|
334
|
+
);
|
|
335
|
+
const text = sanitizeText(
|
|
336
|
+
(raw
|
|
337
|
+
? entry.payload.text
|
|
338
|
+
: (this.#options.getEntryText?.(entry, expanded) ??
|
|
339
|
+
entry.getDisplayText?.(expanded) ??
|
|
340
|
+
entry.payload.text)
|
|
341
|
+
).trim(),
|
|
342
|
+
);
|
|
343
|
+
if (raw)
|
|
344
|
+
for (const line of text.split("\n"))
|
|
345
|
+
for (const wrapped of wrapTextWithAnsi(line, contentWidth)) lines.push(`${INDENT}${wrapped}`);
|
|
346
|
+
else if (expanded) {
|
|
347
|
+
const rendered = this.#markdown(text, contentWidth);
|
|
348
|
+
const limit = this.#options.maxExpandedLines ?? Number.POSITIVE_INFINITY;
|
|
349
|
+
lines.push(...rendered.slice(0, limit));
|
|
350
|
+
if (rendered.length > limit)
|
|
351
|
+
lines.push(`${INDENT}${theme.fg("dim", `... ${rendered.length - limit} more lines`)}`);
|
|
352
|
+
} else {
|
|
353
|
+
const preview = text.split("\n").slice(0, PREVIEW_LINES);
|
|
354
|
+
for (const line of preview) lines.push(`${INDENT}${truncateToWidth(line, contentWidth)}`);
|
|
355
|
+
if (text.split("\n").length > PREVIEW_LINES) lines.push(`${INDENT}${theme.fg("dim", "... more (Space)")}`);
|
|
356
|
+
}
|
|
357
|
+
this.#renderedEntries.push({ lineStart: start, lineCount: lines.length - start });
|
|
358
|
+
}
|
|
359
|
+
this.#lines = lines.length ? lines : [theme.fg("dim", "No transcript entries yet.")];
|
|
360
|
+
}
|
|
361
|
+
#markdown(text: string, width: number): string[] {
|
|
362
|
+
return new Markdown(text, 0, 0, this.#mdTheme).render(width).map(line => `${INDENT}${line.trimEnd()}`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/** Main-session adapter over the registry's canonical payload resolver. */
|
|
367
|
+
export function transcriptViewerEntries(registry: TranscriptItemRegistry): TranscriptViewerEntry[] {
|
|
368
|
+
return registry.items().flatMap(item => {
|
|
369
|
+
const payload = registry.resolveSourcePayload(item.id);
|
|
370
|
+
if (!payload) return [];
|
|
371
|
+
const capabilities = registry.capabilities(item.id);
|
|
372
|
+
const label =
|
|
373
|
+
item.kind === "assistant-text"
|
|
374
|
+
? "Response"
|
|
375
|
+
: item.kind === "assistant-thinking"
|
|
376
|
+
? "Thinking"
|
|
377
|
+
: item.kind === "tool"
|
|
378
|
+
? "Tool"
|
|
379
|
+
: item.kind === "user"
|
|
380
|
+
? "User"
|
|
381
|
+
: item.kind;
|
|
382
|
+
return [{ id: item.id, kind: item.kind, label, payload, ...capabilities }];
|
|
383
|
+
});
|
|
384
|
+
}
|
|
@@ -59,6 +59,7 @@ export class BtwController {
|
|
|
59
59
|
try {
|
|
60
60
|
const promptText = prompt.render(btwUserPrompt, { question: request.question });
|
|
61
61
|
const { replyText } = await this.ctx.session.runEphemeralTurn({
|
|
62
|
+
purpose: "btw",
|
|
62
63
|
promptText,
|
|
63
64
|
onTextDelta: delta => {
|
|
64
65
|
if (this.#isActiveRequest(request)) {
|
|
@@ -238,6 +238,7 @@ export class EventController {
|
|
|
238
238
|
|
|
239
239
|
const run = this.#handlers[event.type] as (e: AgentSessionEvent) => Promise<void>;
|
|
240
240
|
await run(event);
|
|
241
|
+
if (this.ctx.isTranscriptViewerOpen?.()) this.ctx.refreshTranscriptViewer?.();
|
|
241
242
|
}
|
|
242
243
|
|
|
243
244
|
async #handleAgentStart(_event: Extract<AgentSessionEvent, { type: "agent_start" }>): Promise<void> {
|
|
@@ -802,7 +803,7 @@ export class EventController {
|
|
|
802
803
|
if (details?.sourceToolName === "plan_approval" && details.action === "apply") {
|
|
803
804
|
const planDetails = details.sourceResultDetails as PlanApprovalDetails | undefined;
|
|
804
805
|
if (planDetails) {
|
|
805
|
-
await this.ctx.
|
|
806
|
+
await this.ctx.planModeController.handleApproval(planDetails);
|
|
806
807
|
}
|
|
807
808
|
}
|
|
808
809
|
}
|
|
@@ -819,7 +820,7 @@ export class EventController {
|
|
|
819
820
|
this.ctx.streamingComponent = undefined;
|
|
820
821
|
this.ctx.streamingMessage = undefined;
|
|
821
822
|
}
|
|
822
|
-
await this.ctx.flushPendingModelSwitch();
|
|
823
|
+
await this.ctx.planModeController.flushPendingModelSwitch();
|
|
823
824
|
for (const toolCallId of Array.from(this.ctx.pendingTools.keys())) {
|
|
824
825
|
if (!this.#backgroundToolCallIds.has(toolCallId)) {
|
|
825
826
|
this.ctx.pendingTools.delete(toolCallId);
|
|
@@ -23,6 +23,7 @@ import { HookInputComponent } from "../../modes/components/hook-input";
|
|
|
23
23
|
import { HookSelectorComponent } from "../../modes/components/hook-selector";
|
|
24
24
|
import { getAvailableThemesWithPaths, getThemeByName, setTheme, type Theme, theme } from "../../modes/theme/theme";
|
|
25
25
|
import type { InteractiveModeContext } from "../../modes/types";
|
|
26
|
+
import { createReadonlySessionManager } from "../../session/session-manager";
|
|
26
27
|
import { parseThinkingLevel } from "../../thinking";
|
|
27
28
|
import type { TodoPhase } from "../../tools/todo-write";
|
|
28
29
|
import { setSessionTerminalTitle, setTerminalTitle } from "../../utils/title-generator";
|
|
@@ -356,6 +357,10 @@ export class ExtensionUiController {
|
|
|
356
357
|
},
|
|
357
358
|
getActiveTools: () => this.ctx.session.getActiveToolNames(),
|
|
358
359
|
getAllTools: () => this.ctx.session.getAllToolNames(),
|
|
360
|
+
resolveTool: name => {
|
|
361
|
+
const tool = this.ctx.session.getToolByName(name);
|
|
362
|
+
return tool ? { safeSummary: tool.safeSummary, safeSummaryFields: tool.safeSummaryFields } : undefined;
|
|
363
|
+
},
|
|
359
364
|
setActiveTools: toolNames => this.ctx.session.setActiveToolsByName(toolNames),
|
|
360
365
|
setModel: async model => {
|
|
361
366
|
const key = await this.ctx.session.modelRegistry.getApiKey(model);
|
|
@@ -392,6 +397,10 @@ export class ExtensionUiController {
|
|
|
392
397
|
getQueuedMessages: () => this.ctx.session.getQueuedMessageEntries(),
|
|
393
398
|
getActiveTools: () => this.ctx.session.getActiveToolNames(),
|
|
394
399
|
getAllTools: () => this.ctx.session.getAllToolNames(),
|
|
400
|
+
resolveTool: name => {
|
|
401
|
+
const tool = this.ctx.session.getToolByName(name);
|
|
402
|
+
return tool ? { safeSummary: tool.safeSummary, safeSummaryFields: tool.safeSummaryFields } : undefined;
|
|
403
|
+
},
|
|
395
404
|
|
|
396
405
|
shutdown: () => {
|
|
397
406
|
// Defer the actual teardown to the main loop, which calls
|
|
@@ -650,6 +659,10 @@ export class ExtensionUiController {
|
|
|
650
659
|
},
|
|
651
660
|
getActiveTools: () => this.ctx.session.getActiveToolNames(),
|
|
652
661
|
getAllTools: () => this.ctx.session.getAllToolNames(),
|
|
662
|
+
resolveTool: name => {
|
|
663
|
+
const tool = this.ctx.session.getToolByName(name);
|
|
664
|
+
return tool ? { safeSummary: tool.safeSummary, safeSummaryFields: tool.safeSummaryFields } : undefined;
|
|
665
|
+
},
|
|
653
666
|
setActiveTools: toolNames => this.ctx.session.setActiveToolsByName(toolNames),
|
|
654
667
|
setModel: async model => {
|
|
655
668
|
const key = await this.ctx.session.modelRegistry.getApiKey(model);
|
|
@@ -686,6 +699,10 @@ export class ExtensionUiController {
|
|
|
686
699
|
getQueuedMessages: () => this.ctx.session.getQueuedMessageEntries(),
|
|
687
700
|
getActiveTools: () => this.ctx.session.getActiveToolNames(),
|
|
688
701
|
getAllTools: () => this.ctx.session.getAllToolNames(),
|
|
702
|
+
resolveTool: name => {
|
|
703
|
+
const tool = this.ctx.session.getToolByName(name);
|
|
704
|
+
return tool ? { safeSummary: tool.safeSummary, safeSummaryFields: tool.safeSummaryFields } : undefined;
|
|
705
|
+
},
|
|
689
706
|
|
|
690
707
|
shutdown: () => {
|
|
691
708
|
// Defer the actual teardown to the main loop, which calls
|
|
@@ -892,7 +909,7 @@ export class ExtensionUiController {
|
|
|
892
909
|
compact: instructionsOrOptions => this.#compactSession(instructionsOrOptions),
|
|
893
910
|
hasUI: !this.ctx.isBackgrounded,
|
|
894
911
|
cwd: this.ctx.sessionManager.getCwd(),
|
|
895
|
-
sessionManager: this.ctx.session.sessionManager,
|
|
912
|
+
sessionManager: createReadonlySessionManager(this.ctx.session.sessionManager),
|
|
896
913
|
modelRegistry: this.ctx.session.modelRegistry,
|
|
897
914
|
model: this.ctx.session.model,
|
|
898
915
|
isIdle: () => !this.ctx.session.isStreaming,
|
|
@@ -905,6 +922,12 @@ export class ExtensionUiController {
|
|
|
905
922
|
getQueuedMessages: () => this.ctx.session.getQueuedMessageEntries(),
|
|
906
923
|
getActiveTools: () => this.ctx.session.getActiveToolNames(),
|
|
907
924
|
getAllTools: () => this.ctx.session.getAllToolNames(),
|
|
925
|
+
resolveTool: name => {
|
|
926
|
+
const tool = this.ctx.session.getToolByName(name);
|
|
927
|
+
return tool
|
|
928
|
+
? { safeSummary: tool.safeSummary, safeSummaryFields: tool.safeSummaryFields }
|
|
929
|
+
: undefined;
|
|
930
|
+
},
|
|
908
931
|
hasQueuedMessages: () => this.ctx.session.queuedMessageCount > 0,
|
|
909
932
|
abort: () => {
|
|
910
933
|
this.ctx.session.abort();
|