@gajae-code/coding-agent 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8662 -0
- package/README.md +37 -0
- package/dist/types/async/index.d.ts +2 -0
- package/dist/types/async/job-manager.d.ts +101 -0
- package/dist/types/async/support.d.ts +2 -0
- package/dist/types/autoresearch/dashboard.d.ts +4 -0
- package/dist/types/autoresearch/git.d.ts +36 -0
- package/dist/types/autoresearch/helpers.d.ts +24 -0
- package/dist/types/autoresearch/index.d.ts +2 -0
- package/dist/types/autoresearch/state.d.ts +17 -0
- package/dist/types/autoresearch/storage.d.ts +142 -0
- package/dist/types/autoresearch/tools/init-experiment.d.ts +31 -0
- package/dist/types/autoresearch/tools/log-experiment.d.ts +23 -0
- package/dist/types/autoresearch/tools/run-experiment.d.ts +8 -0
- package/dist/types/autoresearch/tools/update-notes.d.ts +12 -0
- package/dist/types/autoresearch/types.d.ts +154 -0
- package/dist/types/capability/context-file.d.ts +17 -0
- package/dist/types/capability/extension-module.d.ts +15 -0
- package/dist/types/capability/extension.d.ts +28 -0
- package/dist/types/capability/fs.d.ts +20 -0
- package/dist/types/capability/hook.d.ts +19 -0
- package/dist/types/capability/index.d.ts +80 -0
- package/dist/types/capability/instruction.d.ts +17 -0
- package/dist/types/capability/mcp.d.ts +45 -0
- package/dist/types/capability/prompt.d.ts +15 -0
- package/dist/types/capability/rule.d.ts +61 -0
- package/dist/types/capability/settings.d.ts +15 -0
- package/dist/types/capability/skill.d.ts +36 -0
- package/dist/types/capability/slash-command.d.ts +17 -0
- package/dist/types/capability/ssh.d.ts +23 -0
- package/dist/types/capability/system-prompt.d.ts +15 -0
- package/dist/types/capability/tool.d.ts +19 -0
- package/dist/types/capability/types.d.ts +154 -0
- package/dist/types/cli/agents-cli.d.ts +12 -0
- package/dist/types/cli/args.d.ts +53 -0
- package/dist/types/cli/auth-broker-cli.d.ts +25 -0
- package/dist/types/cli/auth-gateway-cli.d.ts +18 -0
- package/dist/types/cli/classify-install-target.d.ts +18 -0
- package/dist/types/cli/commands/init-xdg.d.ts +1 -0
- package/dist/types/cli/config-cli.d.ts +22 -0
- package/dist/types/cli/file-processor.d.ts +11 -0
- package/dist/types/cli/grep-cli.d.ts +17 -0
- package/dist/types/cli/initial-message.d.ts +17 -0
- package/dist/types/cli/list-models.d.ts +30 -0
- package/dist/types/cli/plugin-cli.d.ts +32 -0
- package/dist/types/cli/read-cli.d.ts +4 -0
- package/dist/types/cli/session-picker.d.ts +3 -0
- package/dist/types/cli/setup-cli.d.ts +31 -0
- package/dist/types/cli/shell-cli.d.ts +8 -0
- package/dist/types/cli/ssh-cli.d.ts +21 -0
- package/dist/types/cli/stats-cli.d.ts +17 -0
- package/dist/types/cli/update-cli.d.ts +38 -0
- package/dist/types/cli/web-search-cli.d.ts +20 -0
- package/dist/types/cli/worktree-cli.d.ts +26 -0
- package/dist/types/cli.d.ts +3 -0
- package/dist/types/commands/acp.d.ts +12 -0
- package/dist/types/commands/agents.d.ts +34 -0
- package/dist/types/commands/auth-broker.d.ts +54 -0
- package/dist/types/commands/auth-gateway.d.ts +32 -0
- package/dist/types/commands/codex-native-hook.d.ts +6 -0
- package/dist/types/commands/commit.d.ts +27 -0
- package/dist/types/commands/config.d.ts +30 -0
- package/dist/types/commands/deep-interview.d.ts +7 -0
- package/dist/types/commands/gjc-runtime-bridge.d.ts +6 -0
- package/dist/types/commands/grep.d.ts +42 -0
- package/dist/types/commands/launch.d.ts +121 -0
- package/dist/types/commands/plugin.d.ts +52 -0
- package/dist/types/commands/question.d.ts +7 -0
- package/dist/types/commands/ralplan.d.ts +7 -0
- package/dist/types/commands/read.d.ts +15 -0
- package/dist/types/commands/setup.d.ts +48 -0
- package/dist/types/commands/shell.d.ts +21 -0
- package/dist/types/commands/ssh.d.ts +48 -0
- package/dist/types/commands/state.d.ts +7 -0
- package/dist/types/commands/stats.d.ts +25 -0
- package/dist/types/commands/team.d.ts +24 -0
- package/dist/types/commands/ultragoal.d.ts +7 -0
- package/dist/types/commands/update.d.ts +20 -0
- package/dist/types/commands/web-search.d.ts +33 -0
- package/dist/types/commands/worktree.d.ts +34 -0
- package/dist/types/commit/agentic/agent.d.ts +31 -0
- package/dist/types/commit/agentic/fallback.d.ts +5 -0
- package/dist/types/commit/agentic/index.d.ts +2 -0
- package/dist/types/commit/agentic/state.d.ts +58 -0
- package/dist/types/commit/agentic/tools/analyze-file.d.ts +19 -0
- package/dist/types/commit/agentic/tools/git-file-diff.d.ts +10 -0
- package/dist/types/commit/agentic/tools/git-hunk.d.ts +9 -0
- package/dist/types/commit/agentic/tools/git-overview.d.ts +9 -0
- package/dist/types/commit/agentic/tools/index.d.ts +16 -0
- package/dist/types/commit/agentic/tools/propose-changelog.d.ts +28 -0
- package/dist/types/commit/agentic/tools/propose-commit.d.ts +36 -0
- package/dist/types/commit/agentic/tools/recent-commits.d.ts +7 -0
- package/dist/types/commit/agentic/tools/schemas.d.ts +27 -0
- package/dist/types/commit/agentic/tools/split-commit.d.ts +53 -0
- package/dist/types/commit/agentic/topo-sort.d.ts +4 -0
- package/dist/types/commit/agentic/trivial.d.ts +7 -0
- package/dist/types/commit/agentic/validation.d.ts +20 -0
- package/dist/types/commit/analysis/conventional.d.ts +22 -0
- package/dist/types/commit/analysis/index.d.ts +4 -0
- package/dist/types/commit/analysis/scope.d.ts +6 -0
- package/dist/types/commit/analysis/summary.d.ts +19 -0
- package/dist/types/commit/analysis/validation.d.ts +8 -0
- package/dist/types/commit/changelog/detect.d.ts +2 -0
- package/dist/types/commit/changelog/generate.d.ts +30 -0
- package/dist/types/commit/changelog/index.d.ts +30 -0
- package/dist/types/commit/changelog/parse.d.ts +2 -0
- package/dist/types/commit/cli.d.ts +3 -0
- package/dist/types/commit/git/diff.d.ts +5 -0
- package/dist/types/commit/index.d.ts +4 -0
- package/dist/types/commit/map-reduce/index.d.ts +28 -0
- package/dist/types/commit/map-reduce/map-phase.d.ts +17 -0
- package/dist/types/commit/map-reduce/reduce-phase.d.ts +13 -0
- package/dist/types/commit/map-reduce/utils.d.ts +2 -0
- package/dist/types/commit/message.d.ts +2 -0
- package/dist/types/commit/model-selection.d.ts +15 -0
- package/dist/types/commit/pipeline.d.ts +5 -0
- package/dist/types/commit/shared-llm.d.ts +54 -0
- package/dist/types/commit/types.d.ts +78 -0
- package/dist/types/commit/utils/exclusions.d.ts +4 -0
- package/dist/types/commit/utils.d.ts +20 -0
- package/dist/types/config/config-file.d.ts +58 -0
- package/dist/types/config/file-lock.d.ts +6 -0
- package/dist/types/config/keybindings.d.ts +334 -0
- package/dist/types/config/model-equivalence.d.ts +24 -0
- package/dist/types/config/model-registry.d.ts +390 -0
- package/dist/types/config/model-resolver.d.ts +230 -0
- package/dist/types/config/models-config-schema.d.ts +504 -0
- package/dist/types/config/prompt-templates.d.ts +32 -0
- package/dist/types/config/resolve-config-value.d.ts +17 -0
- package/dist/types/config/settings-schema.d.ts +3337 -0
- package/dist/types/config/settings.d.ts +132 -0
- package/dist/types/config/skill-settings-defaults.d.ts +14 -0
- package/dist/types/config.d.ts +66 -0
- package/dist/types/cursor.d.ts +24 -0
- package/dist/types/dap/client.d.ts +38 -0
- package/dist/types/dap/config.d.ts +6 -0
- package/dist/types/dap/index.d.ts +4 -0
- package/dist/types/dap/session.d.ts +108 -0
- package/dist/types/dap/types.d.ts +524 -0
- package/dist/types/debug/index.d.ts +15 -0
- package/dist/types/debug/log-formatting.d.ts +4 -0
- package/dist/types/debug/log-viewer.d.ts +68 -0
- package/dist/types/debug/profiler.d.ts +24 -0
- package/dist/types/debug/raw-sse-buffer.d.ts +44 -0
- package/dist/types/debug/raw-sse.d.ts +16 -0
- package/dist/types/debug/report-bundle.d.ts +55 -0
- package/dist/types/debug/system-info.d.ts +26 -0
- package/dist/types/defaults/gjc-defaults.d.ts +44 -0
- package/dist/types/discovery/agents-md.d.ts +1 -0
- package/dist/types/discovery/agents.d.ts +12 -0
- package/dist/types/discovery/builtin.d.ts +1 -0
- package/dist/types/discovery/claude-plugins.d.ts +1 -0
- package/dist/types/discovery/claude.d.ts +1 -0
- package/dist/types/discovery/cline.d.ts +1 -0
- package/dist/types/discovery/codex.d.ts +1 -0
- package/dist/types/discovery/cursor.d.ts +16 -0
- package/dist/types/discovery/gemini.d.ts +1 -0
- package/dist/types/discovery/github.d.ts +1 -0
- package/dist/types/discovery/helpers.d.ts +268 -0
- package/dist/types/discovery/index.d.ts +48 -0
- package/dist/types/discovery/mcp-json.d.ts +1 -0
- package/dist/types/discovery/opencode.d.ts +1 -0
- package/dist/types/discovery/plugin-dir-roots.d.ts +15 -0
- package/dist/types/discovery/ssh.d.ts +1 -0
- package/dist/types/discovery/substitute-plugin-root.d.ts +5 -0
- package/dist/types/discovery/vscode.d.ts +1 -0
- package/dist/types/discovery/windsurf.d.ts +13 -0
- package/dist/types/edit/apply-patch/index.d.ts +35 -0
- package/dist/types/edit/apply-patch/parser.d.ts +34 -0
- package/dist/types/edit/diff.d.ts +59 -0
- package/dist/types/edit/file-read-cache.d.ts +25 -0
- package/dist/types/edit/index.d.ts +58 -0
- package/dist/types/edit/modes/apply-patch.d.ts +24 -0
- package/dist/types/edit/modes/patch.d.ts +99 -0
- package/dist/types/edit/modes/replace.d.ts +142 -0
- package/dist/types/edit/normalize.d.ts +43 -0
- package/dist/types/edit/notebook.d.ts +23 -0
- package/dist/types/edit/read-file.d.ts +2 -0
- package/dist/types/edit/renderer.d.ts +110 -0
- package/dist/types/edit/streaming.d.ts +66 -0
- package/dist/types/eval/backend.d.ts +40 -0
- package/dist/types/eval/index.d.ts +4 -0
- package/dist/types/eval/js/context-manager.d.ts +24 -0
- package/dist/types/eval/js/executor.d.ts +28 -0
- package/dist/types/eval/js/index.d.ts +10 -0
- package/dist/types/eval/js/shared/helpers.d.ts +38 -0
- package/dist/types/eval/js/shared/indirect-eval.d.ts +14 -0
- package/dist/types/eval/js/shared/prelude.d.ts +1 -0
- package/dist/types/eval/js/shared/rewrite-imports.d.ts +6 -0
- package/dist/types/eval/js/shared/runtime.d.ts +47 -0
- package/dist/types/eval/js/shared/types.d.ts +24 -0
- package/dist/types/eval/js/tool-bridge.d.ts +18 -0
- package/dist/types/eval/js/worker-core.d.ts +5 -0
- package/dist/types/eval/js/worker-entry.d.ts +1 -0
- package/dist/types/eval/js/worker-protocol.d.ts +77 -0
- package/dist/types/eval/py/display.d.ts +25 -0
- package/dist/types/eval/py/executor.d.ts +83 -0
- package/dist/types/eval/py/index.d.ts +10 -0
- package/dist/types/eval/py/kernel.d.ts +61 -0
- package/dist/types/eval/py/prelude.d.ts +1 -0
- package/dist/types/eval/py/runtime.d.ts +21 -0
- package/dist/types/eval/py/tool-bridge.d.ts +20 -0
- package/dist/types/eval/types.d.ts +52 -0
- package/dist/types/exa/factory.d.ts +13 -0
- package/dist/types/exa/index.d.ts +20 -0
- package/dist/types/exa/mcp-client.d.ts +45 -0
- package/dist/types/exa/render.d.ts +19 -0
- package/dist/types/exa/researcher.d.ts +9 -0
- package/dist/types/exa/search.d.ts +9 -0
- package/dist/types/exa/types.d.ts +155 -0
- package/dist/types/exa/websets.d.ts +9 -0
- package/dist/types/exec/bash-executor.d.ts +41 -0
- package/dist/types/exec/exec.d.ts +25 -0
- package/dist/types/exec/idle-timeout-watchdog.d.ts +18 -0
- package/dist/types/exec/non-interactive-env.d.ts +1 -0
- package/dist/types/export/custom-share.d.ts +20 -0
- package/dist/types/export/html/index.d.ts +10 -0
- package/dist/types/export/html/template.generated.d.ts +1 -0
- package/dist/types/export/html/template.macro.d.ts +5 -0
- package/dist/types/export/ttsr.d.ts +44 -0
- package/dist/types/extensibility/custom-commands/bundled/ci-green/index.d.ts +9 -0
- package/dist/types/extensibility/custom-commands/bundled/review/index.d.ts +10 -0
- package/dist/types/extensibility/custom-commands/index.d.ts +2 -0
- package/dist/types/extensibility/custom-commands/loader.d.ts +29 -0
- package/dist/types/extensibility/custom-commands/types.d.ts +106 -0
- package/dist/types/extensibility/custom-tools/index.d.ts +6 -0
- package/dist/types/extensibility/custom-tools/loader.d.ts +69 -0
- package/dist/types/extensibility/custom-tools/types.d.ts +226 -0
- package/dist/types/extensibility/custom-tools/wrapper.d.ts +23 -0
- package/dist/types/extensibility/extensions/compact-handler.d.ts +26 -0
- package/dist/types/extensibility/extensions/get-commands-handler.d.ts +29 -0
- package/dist/types/extensibility/extensions/index.d.ts +8 -0
- package/dist/types/extensibility/extensions/loader.d.ts +43 -0
- package/dist/types/extensibility/extensions/runner.d.ts +134 -0
- package/dist/types/extensibility/extensions/types.d.ts +864 -0
- package/dist/types/extensibility/extensions/wrapper.d.ts +54 -0
- package/dist/types/extensibility/hooks/index.d.ts +5 -0
- package/dist/types/extensibility/hooks/loader.d.ts +89 -0
- package/dist/types/extensibility/hooks/runner.d.ts +126 -0
- package/dist/types/extensibility/hooks/tool-wrapper.d.ts +25 -0
- package/dist/types/extensibility/hooks/types.d.ts +431 -0
- package/dist/types/extensibility/plugins/doctor.d.ts +3 -0
- package/dist/types/extensibility/plugins/git-url.d.ts +34 -0
- package/dist/types/extensibility/plugins/index.d.ts +7 -0
- package/dist/types/extensibility/plugins/installer.d.ts +5 -0
- package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +2 -0
- package/dist/types/extensibility/plugins/loader.d.ts +31 -0
- package/dist/types/extensibility/plugins/manager.d.ts +65 -0
- package/dist/types/extensibility/plugins/marketplace/cache.d.ts +41 -0
- package/dist/types/extensibility/plugins/marketplace/fetcher.d.ts +48 -0
- package/dist/types/extensibility/plugins/marketplace/index.d.ts +6 -0
- package/dist/types/extensibility/plugins/marketplace/manager.d.ts +57 -0
- package/dist/types/extensibility/plugins/marketplace/registry.d.ts +34 -0
- package/dist/types/extensibility/plugins/marketplace/source-resolver.d.ts +28 -0
- package/dist/types/extensibility/plugins/marketplace/types.d.ts +130 -0
- package/dist/types/extensibility/plugins/parser.d.ts +52 -0
- package/dist/types/extensibility/plugins/types.d.ts +149 -0
- package/dist/types/extensibility/shared-events.d.ts +279 -0
- package/dist/types/extensibility/skills.d.ts +74 -0
- package/dist/types/extensibility/slash-commands.d.ts +48 -0
- package/dist/types/extensibility/tool-proxy.d.ts +4 -0
- package/dist/types/extensibility/typebox.d.ts +155 -0
- package/dist/types/extensibility/utils.d.ts +12 -0
- package/dist/types/gjc-runtime/goal-mode-request.d.ts +46 -0
- package/dist/types/gjc-runtime/launch-tmux.d.ts +45 -0
- package/dist/types/gjc-runtime/launch-worktree.d.ts +46 -0
- package/dist/types/gjc-runtime/team-runtime.d.ts +204 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +85 -0
- package/dist/types/goals/index.d.ts +3 -0
- package/dist/types/goals/runtime.d.ts +68 -0
- package/dist/types/goals/state.d.ts +35 -0
- package/dist/types/goals/tools/goal-tool.d.ts +128 -0
- package/dist/types/hashline/anchors.d.ts +20 -0
- package/dist/types/hashline/apply.d.ts +14 -0
- package/dist/types/hashline/constants.d.ts +19 -0
- package/dist/types/hashline/diff-preview.d.ts +2 -0
- package/dist/types/hashline/diff.d.ts +17 -0
- package/dist/types/hashline/execute.d.ts +4 -0
- package/dist/types/hashline/hash.d.ts +123 -0
- package/dist/types/hashline/index.d.ts +13 -0
- package/dist/types/hashline/input.d.ts +11 -0
- package/dist/types/hashline/parser.d.ts +7 -0
- package/dist/types/hashline/prefixes.d.ts +7 -0
- package/dist/types/hashline/recovery.d.ts +27 -0
- package/dist/types/hashline/stream.d.ts +2 -0
- package/dist/types/hashline/types.d.ts +77 -0
- package/dist/types/hindsight/backend.d.ts +13 -0
- package/dist/types/hindsight/bank.d.ts +54 -0
- package/dist/types/hindsight/client.d.ts +224 -0
- package/dist/types/hindsight/config.d.ts +51 -0
- package/dist/types/hindsight/content.d.ts +70 -0
- package/dist/types/hindsight/index.d.ts +8 -0
- package/dist/types/hindsight/mental-models.d.ts +125 -0
- package/dist/types/hindsight/state.d.ts +99 -0
- package/dist/types/hindsight/transcript.d.ts +28 -0
- package/dist/types/hooks/codex-native-hooks-config.d.ts +29 -0
- package/dist/types/hooks/native-skill-hook.d.ts +16 -0
- package/dist/types/hooks/skill-keywords.d.ts +17 -0
- package/dist/types/hooks/skill-state.d.ts +80 -0
- package/dist/types/index.d.ts +33 -0
- package/dist/types/internal-urls/agent-protocol.d.ts +12 -0
- package/dist/types/internal-urls/artifact-protocol.d.ts +6 -0
- package/dist/types/internal-urls/docs-index.generated.d.ts +2 -0
- package/dist/types/internal-urls/gjc-protocol.d.ts +12 -0
- package/dist/types/internal-urls/index.d.ts +20 -0
- package/dist/types/internal-urls/issue-pr-protocol.d.ts +17 -0
- package/dist/types/internal-urls/json-query.d.ts +30 -0
- package/dist/types/internal-urls/local-protocol.d.ts +39 -0
- package/dist/types/internal-urls/mcp-protocol.d.ts +12 -0
- package/dist/types/internal-urls/memory-protocol.d.ts +23 -0
- package/dist/types/internal-urls/parse.d.ts +19 -0
- package/dist/types/internal-urls/registry-helpers.d.ts +10 -0
- package/dist/types/internal-urls/router.d.ts +14 -0
- package/dist/types/internal-urls/rule-protocol.d.ts +6 -0
- package/dist/types/internal-urls/skill-protocol.d.ts +13 -0
- package/dist/types/internal-urls/types.d.ts +105 -0
- package/dist/types/lsp/client.d.ts +65 -0
- package/dist/types/lsp/clients/biome-client.d.ts +16 -0
- package/dist/types/lsp/clients/index.d.ts +19 -0
- package/dist/types/lsp/clients/lsp-linter-client.d.ts +16 -0
- package/dist/types/lsp/clients/swiftlint-client.d.ts +20 -0
- package/dist/types/lsp/config.d.ts +65 -0
- package/dist/types/lsp/edits.d.ts +23 -0
- package/dist/types/lsp/index.d.ts +130 -0
- package/dist/types/lsp/lspmux.d.ts +58 -0
- package/dist/types/lsp/render.d.ts +32 -0
- package/dist/types/lsp/startup-events.d.ts +11 -0
- package/dist/types/lsp/types.d.ts +302 -0
- package/dist/types/lsp/utils.d.ts +108 -0
- package/dist/types/main.d.ts +50 -0
- package/dist/types/memories/index.d.ts +28 -0
- package/dist/types/memories/storage.d.ts +110 -0
- package/dist/types/memory-backend/index.d.ts +4 -0
- package/dist/types/memory-backend/local-backend.d.ts +9 -0
- package/dist/types/memory-backend/off-backend.d.ts +7 -0
- package/dist/types/memory-backend/resolve.d.ts +15 -0
- package/dist/types/memory-backend/types.d.ts +61 -0
- package/dist/types/modes/acp/acp-agent.d.ts +61 -0
- package/dist/types/modes/acp/acp-client-bridge.d.ts +9 -0
- package/dist/types/modes/acp/acp-event-mapper.d.ts +32 -0
- package/dist/types/modes/acp/acp-mode.d.ts +5 -0
- package/dist/types/modes/acp/index.d.ts +2 -0
- package/dist/types/modes/acp/terminal-auth.d.ts +6 -0
- package/dist/types/modes/components/agent-dashboard.d.ts +21 -0
- package/dist/types/modes/components/assistant-message.d.ts +16 -0
- package/dist/types/modes/components/bash-execution.d.ts +29 -0
- package/dist/types/modes/components/bordered-loader.d.ts +11 -0
- package/dist/types/modes/components/branch-summary-message.d.ts +13 -0
- package/dist/types/modes/components/btw-panel.d.ts +16 -0
- package/dist/types/modes/components/compaction-summary-message.d.ts +13 -0
- package/dist/types/modes/components/countdown-timer.d.ts +14 -0
- package/dist/types/modes/components/custom-editor.d.ts +47 -0
- package/dist/types/modes/components/custom-message.d.ts +15 -0
- package/dist/types/modes/components/diff.d.ts +11 -0
- package/dist/types/modes/components/dynamic-border.d.ts +14 -0
- package/dist/types/modes/components/eval-execution.d.ts +23 -0
- package/dist/types/modes/components/execution-shared.d.ts +46 -0
- package/dist/types/modes/components/extensions/extension-dashboard.d.ts +26 -0
- package/dist/types/modes/components/extensions/extension-list.d.ts +39 -0
- package/dist/types/modes/components/extensions/index.d.ts +8 -0
- package/dist/types/modes/components/extensions/inspector-panel.d.ts +8 -0
- package/dist/types/modes/components/extensions/state-manager.d.ts +50 -0
- package/dist/types/modes/components/extensions/types.d.ts +151 -0
- package/dist/types/modes/components/footer.d.ts +30 -0
- package/dist/types/modes/components/history-search.d.ts +7 -0
- package/dist/types/modes/components/hook-editor.d.ts +18 -0
- package/dist/types/modes/components/hook-input.d.ts +15 -0
- package/dist/types/modes/components/hook-message.d.ts +15 -0
- package/dist/types/modes/components/hook-selector.d.ts +23 -0
- package/dist/types/modes/components/index.d.ts +35 -0
- package/dist/types/modes/components/keybinding-hints.d.ts +40 -0
- package/dist/types/modes/components/login-dialog.d.ts +32 -0
- package/dist/types/modes/components/message-frame.d.ts +42 -0
- package/dist/types/modes/components/model-selector.d.ts +26 -0
- package/dist/types/modes/components/oauth-selector.d.ts +14 -0
- package/dist/types/modes/components/plugin-selector.d.ts +26 -0
- package/dist/types/modes/components/plugin-settings.d.ts +66 -0
- package/dist/types/modes/components/provider-onboarding-selector.d.ts +7 -0
- package/dist/types/modes/components/queue-mode-selector.d.ts +9 -0
- package/dist/types/modes/components/read-tool-group.d.ts +30 -0
- package/dist/types/modes/components/runtime-mcp-add-wizard.d.ts +25 -0
- package/dist/types/modes/components/session-observer-overlay.d.ts +11 -0
- package/dist/types/modes/components/session-selector.d.ts +30 -0
- package/dist/types/modes/components/settings-defs.d.ts +50 -0
- package/dist/types/modes/components/settings-selector.d.ts +54 -0
- package/dist/types/modes/components/show-images-selector.d.ts +9 -0
- package/dist/types/modes/components/skill-hud/render.d.ts +2 -0
- package/dist/types/modes/components/skill-message.d.ts +9 -0
- package/dist/types/modes/components/status-line/context-thresholds.d.ts +4 -0
- package/dist/types/modes/components/status-line/git-utils.d.ts +22 -0
- package/dist/types/modes/components/status-line/index.d.ts +4 -0
- package/dist/types/modes/components/status-line/presets.d.ts +3 -0
- package/dist/types/modes/components/status-line/segments.d.ts +5 -0
- package/dist/types/modes/components/status-line/separators.d.ts +3 -0
- package/dist/types/modes/components/status-line/token-rate.d.ts +10 -0
- package/dist/types/modes/components/status-line/types.d.ts +80 -0
- package/dist/types/modes/components/status-line.d.ts +80 -0
- package/dist/types/modes/components/theme-selector.d.ts +10 -0
- package/dist/types/modes/components/thinking-selector.d.ts +10 -0
- package/dist/types/modes/components/todo-reminder.d.ts +13 -0
- package/dist/types/modes/components/tool-execution.d.ts +53 -0
- package/dist/types/modes/components/tree-selector.d.ts +31 -0
- package/dist/types/modes/components/ttsr-notification.d.ts +13 -0
- package/dist/types/modes/components/user-message-selector.d.ts +28 -0
- package/dist/types/modes/components/user-message.d.ts +7 -0
- package/dist/types/modes/components/visual-truncate.d.ts +19 -0
- package/dist/types/modes/components/welcome.d.ts +34 -0
- package/dist/types/modes/controllers/btw-controller.d.ts +10 -0
- package/dist/types/modes/controllers/command-controller-shared.d.ts +47 -0
- package/dist/types/modes/controllers/command-controller.d.ts +36 -0
- package/dist/types/modes/controllers/event-controller.d.ts +12 -0
- package/dist/types/modes/controllers/extension-ui-controller.d.ts +80 -0
- package/dist/types/modes/controllers/input-controller.d.ts +35 -0
- package/dist/types/modes/controllers/runtime-mcp-command-controller.d.ts +10 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +46 -0
- package/dist/types/modes/controllers/ssh-command-controller.d.ts +10 -0
- package/dist/types/modes/controllers/todo-command-controller.d.ts +7 -0
- package/dist/types/modes/emoji-autocomplete.d.ts +16 -0
- package/dist/types/modes/index.d.ts +9 -0
- package/dist/types/modes/interactive-mode.d.ts +271 -0
- package/dist/types/modes/loop-limit.d.ts +22 -0
- package/dist/types/modes/oauth-manual-input.d.ts +8 -0
- package/dist/types/modes/print-mode.d.ts +27 -0
- package/dist/types/modes/prompt-action-autocomplete.d.ts +46 -0
- package/dist/types/modes/rpc/host-tools.d.ts +16 -0
- package/dist/types/modes/rpc/host-uris.d.ts +38 -0
- package/dist/types/modes/rpc/rpc-client.d.ts +249 -0
- package/dist/types/modes/rpc/rpc-mode.d.ts +17 -0
- package/dist/types/modes/rpc/rpc-types.d.ts +586 -0
- package/dist/types/modes/runtime-init.d.ts +21 -0
- package/dist/types/modes/session-observer-registry.d.ts +26 -0
- package/dist/types/modes/shared.d.ts +15 -0
- package/dist/types/modes/theme/defaults/index.d.ts +9559 -0
- package/dist/types/modes/theme/mermaid-cache.d.ts +9 -0
- package/dist/types/modes/theme/shimmer.d.ts +38 -0
- package/dist/types/modes/theme/theme.d.ts +273 -0
- package/dist/types/modes/types.d.ts +278 -0
- package/dist/types/modes/utils/context-usage.d.ts +47 -0
- package/dist/types/modes/utils/hotkeys-markdown.d.ts +5 -0
- package/dist/types/modes/utils/keybinding-matchers.d.ts +10 -0
- package/dist/types/modes/utils/tools-markdown.d.ts +5 -0
- package/dist/types/modes/utils/ui-helpers.d.ts +53 -0
- package/dist/types/plan-mode/approved-plan.d.ts +49 -0
- package/dist/types/plan-mode/state.d.ts +6 -0
- package/dist/types/registry/agent-registry.d.ts +62 -0
- package/dist/types/runtime-mcp/client.d.ts +74 -0
- package/dist/types/runtime-mcp/config-writer.d.ts +53 -0
- package/dist/types/runtime-mcp/config.d.ts +75 -0
- package/dist/types/runtime-mcp/discoverable-tool-metadata.d.ts +7 -0
- package/dist/types/runtime-mcp/index.d.ts +18 -0
- package/dist/types/runtime-mcp/json-rpc.d.ts +22 -0
- package/dist/types/runtime-mcp/loader.d.ts +43 -0
- package/dist/types/runtime-mcp/manager.d.ts +193 -0
- package/dist/types/runtime-mcp/oauth-discovery.d.ts +40 -0
- package/dist/types/runtime-mcp/oauth-flow.d.ts +59 -0
- package/dist/types/runtime-mcp/render.d.ts +25 -0
- package/dist/types/runtime-mcp/smithery-auth.d.ts +16 -0
- package/dist/types/runtime-mcp/smithery-connect.d.ts +38 -0
- package/dist/types/runtime-mcp/smithery-registry.d.ts +51 -0
- package/dist/types/runtime-mcp/tool-bridge.d.ts +86 -0
- package/dist/types/runtime-mcp/tool-cache.d.ts +8 -0
- package/dist/types/runtime-mcp/transports/http.d.ts +36 -0
- package/dist/types/runtime-mcp/transports/index.d.ts +5 -0
- package/dist/types/runtime-mcp/transports/stdio.d.ts +32 -0
- package/dist/types/runtime-mcp/types.d.ts +333 -0
- package/dist/types/sdk.d.ts +216 -0
- package/dist/types/secrets/index.d.ts +9 -0
- package/dist/types/secrets/obfuscator.d.ts +23 -0
- package/dist/types/secrets/regex.d.ts +2 -0
- package/dist/types/session/agent-session.d.ts +930 -0
- package/dist/types/session/agent-storage.d.ts +100 -0
- package/dist/types/session/artifacts.d.ts +61 -0
- package/dist/types/session/auth-broker-config.d.ts +13 -0
- package/dist/types/session/auth-storage.d.ts +6 -0
- package/dist/types/session/blob-store.d.ts +63 -0
- package/dist/types/session/client-bridge.d.ts +88 -0
- package/dist/types/session/history-storage.d.ts +16 -0
- package/dist/types/session/messages.d.ts +162 -0
- package/dist/types/session/session-dump-format.d.ts +22 -0
- package/dist/types/session/session-manager.d.ts +549 -0
- package/dist/types/session/session-storage.d.ts +82 -0
- package/dist/types/session/streaming-output.d.ts +185 -0
- package/dist/types/session/tool-choice-queue.d.ts +78 -0
- package/dist/types/session/yield-queue.d.ts +24 -0
- package/dist/types/setup/model-onboarding-guidance.d.ts +8 -0
- package/dist/types/setup/provider-onboarding.d.ts +28 -0
- package/dist/types/skill-state/active-state.d.ts +50 -0
- package/dist/types/slash-commands/acp-builtins.d.ts +18 -0
- package/dist/types/slash-commands/builtin-registry.d.ts +23 -0
- package/dist/types/slash-commands/helpers/context-report.d.ts +7 -0
- package/dist/types/slash-commands/helpers/format.d.ts +10 -0
- package/dist/types/slash-commands/helpers/mcp.d.ts +3 -0
- package/dist/types/slash-commands/helpers/parse.d.ts +33 -0
- package/dist/types/slash-commands/helpers/ssh.d.ts +3 -0
- package/dist/types/slash-commands/helpers/todo.d.ts +3 -0
- package/dist/types/slash-commands/helpers/usage-report.d.ts +7 -0
- package/dist/types/slash-commands/types.d.ts +118 -0
- package/dist/types/ssh/config-writer.d.ts +49 -0
- package/dist/types/ssh/connection-manager.d.ts +33 -0
- package/dist/types/ssh/ssh-executor.d.ts +37 -0
- package/dist/types/ssh/sshfs-mount.d.ts +6 -0
- package/dist/types/ssh/utils.d.ts +2 -0
- package/dist/types/stt/downloader.d.ts +9 -0
- package/dist/types/stt/index.d.ts +3 -0
- package/dist/types/stt/recorder.d.ts +13 -0
- package/dist/types/stt/setup.d.ts +18 -0
- package/dist/types/stt/stt-controller.d.ts +16 -0
- package/dist/types/stt/transcriber.d.ts +16 -0
- package/dist/types/system-prompt.d.ts +93 -0
- package/dist/types/task/agents.d.ts +28 -0
- package/dist/types/task/commands.d.ts +35 -0
- package/dist/types/task/discovery.d.ts +19 -0
- package/dist/types/task/executor.d.ts +106 -0
- package/dist/types/task/gjc-command.d.ts +7 -0
- package/dist/types/task/index.d.ts +38 -0
- package/dist/types/task/name-generator.d.ts +16 -0
- package/dist/types/task/output-manager.d.ts +36 -0
- package/dist/types/task/parallel.d.ts +34 -0
- package/dist/types/task/render.d.ts +22 -0
- package/dist/types/task/simple-mode.d.ts +8 -0
- package/dist/types/task/subprocess-tool-registry.d.ts +72 -0
- package/dist/types/task/types.d.ts +295 -0
- package/dist/types/task/worktree.d.ts +94 -0
- package/dist/types/thinking.d.ts +30 -0
- package/dist/types/tool-discovery/tool-index.d.ts +112 -0
- package/dist/types/tools/archive-reader.d.ts +40 -0
- package/dist/types/tools/ask.d.ts +109 -0
- package/dist/types/tools/ast-edit.d.ts +77 -0
- package/dist/types/tools/ast-grep.d.ts +69 -0
- package/dist/types/tools/auto-generated-guard.d.ts +17 -0
- package/dist/types/tools/bash-command-fixup.d.ts +11 -0
- package/dist/types/tools/bash-interactive.d.ts +16 -0
- package/dist/types/tools/bash-interceptor.d.ts +24 -0
- package/dist/types/tools/bash-pty-selection.d.ts +7 -0
- package/dist/types/tools/bash-skill-urls.d.ts +31 -0
- package/dist/types/tools/bash.d.ts +130 -0
- package/dist/types/tools/browser/attach.d.ts +34 -0
- package/dist/types/tools/browser/launch.d.ts +62 -0
- package/dist/types/tools/browser/readable.d.ts +17 -0
- package/dist/types/tools/browser/registry.d.ts +42 -0
- package/dist/types/tools/browser/render.d.ts +50 -0
- package/dist/types/tools/browser/tab-protocol.d.ts +144 -0
- package/dist/types/tools/browser/tab-supervisor.d.ts +63 -0
- package/dist/types/tools/browser/tab-worker-entry.d.ts +1 -0
- package/dist/types/tools/browser/tab-worker.d.ts +19 -0
- package/dist/types/tools/browser.d.ts +114 -0
- package/dist/types/tools/calculator.d.ts +76 -0
- package/dist/types/tools/checkpoint.d.ts +63 -0
- package/dist/types/tools/conflict-detect.d.ts +205 -0
- package/dist/types/tools/context.d.ts +19 -0
- package/dist/types/tools/debug.d.ts +209 -0
- package/dist/types/tools/eval.d.ts +108 -0
- package/dist/types/tools/fetch.d.ts +61 -0
- package/dist/types/tools/file-recorder.d.ts +13 -0
- package/dist/types/tools/find.d.ts +95 -0
- package/dist/types/tools/fs-cache-invalidation.d.ts +15 -0
- package/dist/types/tools/gh-format.d.ts +6 -0
- package/dist/types/tools/gh-renderer.d.ts +25 -0
- package/dist/types/tools/gh.d.ts +356 -0
- package/dist/types/tools/github-cache.d.ts +103 -0
- package/dist/types/tools/grouped-file-output.d.ts +36 -0
- package/dist/types/tools/hindsight-recall.d.ts +23 -0
- package/dist/types/tools/hindsight-reflect.d.ts +25 -0
- package/dist/types/tools/hindsight-retain.d.ts +29 -0
- package/dist/types/tools/image-gen.d.ts +78 -0
- package/dist/types/tools/index.d.ts +242 -0
- package/dist/types/tools/inspect-image-renderer.d.ts +26 -0
- package/dist/types/tools/inspect-image.d.ts +31 -0
- package/dist/types/tools/irc.d.ts +79 -0
- package/dist/types/tools/job.d.ts +65 -0
- package/dist/types/tools/json-tree.d.ts +23 -0
- package/dist/types/tools/jtd-to-json-schema.d.ts +29 -0
- package/dist/types/tools/jtd-to-typescript.d.ts +26 -0
- package/dist/types/tools/jtd-utils.d.ts +42 -0
- package/dist/types/tools/list-limit.d.ts +12 -0
- package/dist/types/tools/match-line-format.d.ts +11 -0
- package/dist/types/tools/output-meta.d.ts +204 -0
- package/dist/types/tools/path-utils.d.ts +146 -0
- package/dist/types/tools/plan-mode-guard.d.ts +18 -0
- package/dist/types/tools/read.d.ts +85 -0
- package/dist/types/tools/recipe/index.d.ts +45 -0
- package/dist/types/tools/recipe/render.d.ts +36 -0
- package/dist/types/tools/recipe/runner.d.ts +60 -0
- package/dist/types/tools/recipe/runners/cargo.d.ts +16 -0
- package/dist/types/tools/recipe/runners/index.d.ts +2 -0
- package/dist/types/tools/recipe/runners/just.d.ts +2 -0
- package/dist/types/tools/recipe/runners/make.d.ts +2 -0
- package/dist/types/tools/recipe/runners/pkg.d.ts +2 -0
- package/dist/types/tools/recipe/runners/task.d.ts +2 -0
- package/dist/types/tools/render-mermaid.d.ts +37 -0
- package/dist/types/tools/render-utils.d.ts +158 -0
- package/dist/types/tools/renderers.d.ts +26 -0
- package/dist/types/tools/resolve.d.ts +90 -0
- package/dist/types/tools/review.d.ts +63 -0
- package/dist/types/tools/search-tool-bm25.d.ts +65 -0
- package/dist/types/tools/search.d.ts +93 -0
- package/dist/types/tools/sqlite-reader.d.ts +93 -0
- package/dist/types/tools/ssh.d.ts +67 -0
- package/dist/types/tools/subagent.d.ts +58 -0
- package/dist/types/tools/todo-write.d.ts +120 -0
- package/dist/types/tools/tool-errors.d.ts +33 -0
- package/dist/types/tools/tool-result.d.ts +30 -0
- package/dist/types/tools/tool-timeouts.d.ts +51 -0
- package/dist/types/tools/vim.d.ts +58 -0
- package/dist/types/tools/write.d.ts +59 -0
- package/dist/types/tools/yield.d.ts +25 -0
- package/dist/types/tui/code-cell.d.ts +32 -0
- package/dist/types/tui/file-list.d.ts +22 -0
- package/dist/types/tui/hyperlink.d.ts +42 -0
- package/dist/types/tui/index.d.ts +11 -0
- package/dist/types/tui/output-block.d.ts +28 -0
- package/dist/types/tui/status-line.d.ts +18 -0
- package/dist/types/tui/tree-list.d.ts +19 -0
- package/dist/types/tui/types.d.ts +13 -0
- package/dist/types/tui/utils.d.ts +36 -0
- package/dist/types/utils/changelog.d.ts +20 -0
- package/dist/types/utils/clipboard.d.ts +22 -0
- package/dist/types/utils/command-args.d.ts +9 -0
- package/dist/types/utils/commit-message-generator.d.ts +7 -0
- package/dist/types/utils/edit-mode.d.ts +13 -0
- package/dist/types/utils/event-bus.d.ts +6 -0
- package/dist/types/utils/external-editor.d.ts +17 -0
- package/dist/types/utils/file-display-mode.d.ts +27 -0
- package/dist/types/utils/file-mentions.d.ts +11 -0
- package/dist/types/utils/git.d.ts +361 -0
- package/dist/types/utils/image-loading.d.ts +26 -0
- package/dist/types/utils/image-resize.d.ts +39 -0
- package/dist/types/utils/lang-from-path.d.ts +8 -0
- package/dist/types/utils/markit.d.ts +7 -0
- package/dist/types/utils/open.d.ts +2 -0
- package/dist/types/utils/session-color.d.ts +10 -0
- package/dist/types/utils/shell-snapshot.d.ts +5 -0
- package/dist/types/utils/sixel.d.ts +21 -0
- package/dist/types/utils/title-generator.d.ts +31 -0
- package/dist/types/utils/tool-choice.d.ts +7 -0
- package/dist/types/utils/tools-manager.d.ts +9 -0
- package/dist/types/vim/buffer.d.ts +41 -0
- package/dist/types/vim/commands.d.ts +6 -0
- package/dist/types/vim/engine.d.ts +47 -0
- package/dist/types/vim/parser.d.ts +3 -0
- package/dist/types/vim/render.d.ts +25 -0
- package/dist/types/vim/types.d.ts +182 -0
- package/dist/types/web/kagi.d.ts +23 -0
- package/dist/types/web/parallel.d.ts +58 -0
- package/dist/types/web/scrapers/artifacthub.d.ts +6 -0
- package/dist/types/web/scrapers/arxiv.d.ts +5 -0
- package/dist/types/web/scrapers/aur.d.ts +5 -0
- package/dist/types/web/scrapers/biorxiv.d.ts +5 -0
- package/dist/types/web/scrapers/bluesky.d.ts +5 -0
- package/dist/types/web/scrapers/brew.d.ts +5 -0
- package/dist/types/web/scrapers/cheatsh.d.ts +8 -0
- package/dist/types/web/scrapers/chocolatey.d.ts +5 -0
- package/dist/types/web/scrapers/choosealicense.d.ts +2 -0
- package/dist/types/web/scrapers/cisa-kev.d.ts +5 -0
- package/dist/types/web/scrapers/clojars.d.ts +5 -0
- package/dist/types/web/scrapers/coingecko.d.ts +5 -0
- package/dist/types/web/scrapers/crates-io.d.ts +5 -0
- package/dist/types/web/scrapers/crossref.d.ts +2 -0
- package/dist/types/web/scrapers/devto.d.ts +5 -0
- package/dist/types/web/scrapers/discogs.d.ts +8 -0
- package/dist/types/web/scrapers/discourse.d.ts +5 -0
- package/dist/types/web/scrapers/dockerhub.d.ts +5 -0
- package/dist/types/web/scrapers/docs-rs.d.ts +2 -0
- package/dist/types/web/scrapers/fdroid.d.ts +5 -0
- package/dist/types/web/scrapers/firefox-addons.d.ts +2 -0
- package/dist/types/web/scrapers/flathub.d.ts +2 -0
- package/dist/types/web/scrapers/github-gist.d.ts +5 -0
- package/dist/types/web/scrapers/github.d.ts +12 -0
- package/dist/types/web/scrapers/gitlab.d.ts +5 -0
- package/dist/types/web/scrapers/go-pkg.d.ts +5 -0
- package/dist/types/web/scrapers/hackage.d.ts +5 -0
- package/dist/types/web/scrapers/hackernews.d.ts +2 -0
- package/dist/types/web/scrapers/hex.d.ts +5 -0
- package/dist/types/web/scrapers/huggingface.d.ts +2 -0
- package/dist/types/web/scrapers/iacr.d.ts +5 -0
- package/dist/types/web/scrapers/index.d.ts +84 -0
- package/dist/types/web/scrapers/jetbrains-marketplace.d.ts +2 -0
- package/dist/types/web/scrapers/lemmy.d.ts +2 -0
- package/dist/types/web/scrapers/lobsters.d.ts +5 -0
- package/dist/types/web/scrapers/mastodon.d.ts +5 -0
- package/dist/types/web/scrapers/maven.d.ts +6 -0
- package/dist/types/web/scrapers/mdn.d.ts +2 -0
- package/dist/types/web/scrapers/metacpan.d.ts +5 -0
- package/dist/types/web/scrapers/musicbrainz.d.ts +5 -0
- package/dist/types/web/scrapers/npm.d.ts +5 -0
- package/dist/types/web/scrapers/nuget.d.ts +5 -0
- package/dist/types/web/scrapers/nvd.d.ts +5 -0
- package/dist/types/web/scrapers/ollama.d.ts +2 -0
- package/dist/types/web/scrapers/open-vsx.d.ts +5 -0
- package/dist/types/web/scrapers/opencorporates.d.ts +5 -0
- package/dist/types/web/scrapers/openlibrary.d.ts +5 -0
- package/dist/types/web/scrapers/orcid.d.ts +5 -0
- package/dist/types/web/scrapers/osv.d.ts +5 -0
- package/dist/types/web/scrapers/packagist.d.ts +5 -0
- package/dist/types/web/scrapers/pub-dev.d.ts +5 -0
- package/dist/types/web/scrapers/pubmed.d.ts +5 -0
- package/dist/types/web/scrapers/pypi.d.ts +5 -0
- package/dist/types/web/scrapers/rawg.d.ts +2 -0
- package/dist/types/web/scrapers/readthedocs.d.ts +2 -0
- package/dist/types/web/scrapers/reddit.d.ts +5 -0
- package/dist/types/web/scrapers/repology.d.ts +5 -0
- package/dist/types/web/scrapers/rfc.d.ts +5 -0
- package/dist/types/web/scrapers/rubygems.d.ts +5 -0
- package/dist/types/web/scrapers/searchcode.d.ts +2 -0
- package/dist/types/web/scrapers/sec-edgar.d.ts +5 -0
- package/dist/types/web/scrapers/semantic-scholar.d.ts +2 -0
- package/dist/types/web/scrapers/snapcraft.d.ts +2 -0
- package/dist/types/web/scrapers/sourcegraph.d.ts +2 -0
- package/dist/types/web/scrapers/spdx.d.ts +5 -0
- package/dist/types/web/scrapers/spotify.d.ts +8 -0
- package/dist/types/web/scrapers/stackoverflow.d.ts +6 -0
- package/dist/types/web/scrapers/terraform.d.ts +5 -0
- package/dist/types/web/scrapers/tldr.d.ts +7 -0
- package/dist/types/web/scrapers/twitter.d.ts +5 -0
- package/dist/types/web/scrapers/types.d.ts +78 -0
- package/dist/types/web/scrapers/utils.d.ts +26 -0
- package/dist/types/web/scrapers/vimeo.d.ts +5 -0
- package/dist/types/web/scrapers/vscode-marketplace.d.ts +5 -0
- package/dist/types/web/scrapers/w3c.d.ts +2 -0
- package/dist/types/web/scrapers/wikidata.d.ts +5 -0
- package/dist/types/web/scrapers/wikipedia.d.ts +5 -0
- package/dist/types/web/scrapers/youtube.d.ts +5 -0
- package/dist/types/web/search/index.d.ts +84 -0
- package/dist/types/web/search/provider.d.ts +21 -0
- package/dist/types/web/search/providers/anthropic.d.ts +32 -0
- package/dist/types/web/search/providers/base.d.ts +67 -0
- package/dist/types/web/search/providers/brave.d.ts +27 -0
- package/dist/types/web/search/providers/codex.d.ts +35 -0
- package/dist/types/web/search/providers/exa.d.ts +52 -0
- package/dist/types/web/search/providers/gemini.d.ts +57 -0
- package/dist/types/web/search/providers/jina.d.ts +26 -0
- package/dist/types/web/search/providers/kagi.d.ts +24 -0
- package/dist/types/web/search/providers/kimi.d.ts +27 -0
- package/dist/types/web/search/providers/parallel.d.ts +15 -0
- package/dist/types/web/search/providers/perplexity.d.ts +38 -0
- package/dist/types/web/search/providers/searxng.d.ts +44 -0
- package/dist/types/web/search/providers/synthetic.d.ts +21 -0
- package/dist/types/web/search/providers/tavily.d.ts +29 -0
- package/dist/types/web/search/providers/utils.d.ts +52 -0
- package/dist/types/web/search/providers/zai.d.ts +28 -0
- package/dist/types/web/search/render.d.ts +35 -0
- package/dist/types/web/search/types.d.ts +344 -0
- package/dist/types/web/search/utils.d.ts +4 -0
- package/dist/types/workspace-tree.d.ts +42 -0
- package/examples/README.md +21 -0
- package/examples/custom-tools/README.md +104 -0
- package/examples/custom-tools/hello/index.ts +20 -0
- package/examples/extensions/README.md +141 -0
- package/examples/extensions/api-demo.ts +79 -0
- package/examples/extensions/chalk-logger.ts +25 -0
- package/examples/extensions/hello.ts +31 -0
- package/examples/extensions/pirate.ts +43 -0
- package/examples/extensions/plan-mode.ts +549 -0
- package/examples/extensions/reload-runtime.ts +38 -0
- package/examples/extensions/tools.ts +144 -0
- package/examples/extensions/with-deps/index.ts +36 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +16 -0
- package/examples/hooks/README.md +56 -0
- package/examples/hooks/auto-commit-on-exit.ts +48 -0
- package/examples/hooks/confirm-destructive.ts +58 -0
- package/examples/hooks/custom-compaction.ts +115 -0
- package/examples/hooks/dirty-repo-guard.ts +51 -0
- package/examples/hooks/file-trigger.ts +40 -0
- package/examples/hooks/git-checkpoint.ts +52 -0
- package/examples/hooks/handoff.ts +149 -0
- package/examples/hooks/permission-gate.ts +33 -0
- package/examples/hooks/protected-paths.ts +29 -0
- package/examples/hooks/qna.ts +118 -0
- package/examples/hooks/status-line.ts +39 -0
- package/examples/sdk/01-minimal.ts +21 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +46 -0
- package/examples/sdk/04-skills.ts +43 -0
- package/examples/sdk/06-extensions.ts +82 -0
- package/examples/sdk/06-hooks.ts +61 -0
- package/examples/sdk/07-context-files.ts +35 -0
- package/examples/sdk/08-prompt-templates.ts +41 -0
- package/examples/sdk/08-slash-commands.ts +46 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +54 -0
- package/examples/sdk/11-sessions.ts +47 -0
- package/examples/sdk/README.md +172 -0
- package/package.json +533 -0
- package/scripts/build-binary.ts +77 -0
- package/scripts/format-prompts.ts +68 -0
- package/scripts/generate-docs-index.ts +71 -0
- package/scripts/generate-template.ts +33 -0
- package/src/async/index.ts +2 -0
- package/src/async/job-manager.ts +586 -0
- package/src/async/support.ts +6 -0
- package/src/autoresearch/command-resume.md +14 -0
- package/src/autoresearch/dashboard.ts +446 -0
- package/src/autoresearch/git.ts +319 -0
- package/src/autoresearch/helpers.ts +218 -0
- package/src/autoresearch/index.ts +536 -0
- package/src/autoresearch/prompt-setup.md +43 -0
- package/src/autoresearch/prompt.md +103 -0
- package/src/autoresearch/resume-message.md +10 -0
- package/src/autoresearch/state.ts +273 -0
- package/src/autoresearch/storage.ts +699 -0
- package/src/autoresearch/tools/init-experiment.ts +272 -0
- package/src/autoresearch/tools/log-experiment.ts +524 -0
- package/src/autoresearch/tools/run-experiment.ts +475 -0
- package/src/autoresearch/tools/update-notes.ts +109 -0
- package/src/autoresearch/types.ts +168 -0
- package/src/bun-imports.d.ts +28 -0
- package/src/capability/context-file.ts +44 -0
- package/src/capability/extension-module.ts +34 -0
- package/src/capability/extension.ts +47 -0
- package/src/capability/fs.ts +107 -0
- package/src/capability/hook.ts +40 -0
- package/src/capability/index.ts +436 -0
- package/src/capability/instruction.ts +37 -0
- package/src/capability/mcp.ts +74 -0
- package/src/capability/prompt.ts +35 -0
- package/src/capability/rule.ts +244 -0
- package/src/capability/settings.ts +34 -0
- package/src/capability/skill.ts +56 -0
- package/src/capability/slash-command.ts +40 -0
- package/src/capability/ssh.ts +41 -0
- package/src/capability/system-prompt.ts +34 -0
- package/src/capability/tool.ts +38 -0
- package/src/capability/types.ts +168 -0
- package/src/cli/agents-cli.ts +138 -0
- package/src/cli/args.ts +269 -0
- package/src/cli/auth-broker-cli.ts +746 -0
- package/src/cli/auth-gateway-cli.ts +411 -0
- package/src/cli/classify-install-target.ts +50 -0
- package/src/cli/commands/init-xdg.ts +27 -0
- package/src/cli/config-cli.ts +418 -0
- package/src/cli/file-processor.ts +123 -0
- package/src/cli/grep-cli.ts +160 -0
- package/src/cli/initial-message.ts +58 -0
- package/src/cli/list-models.ts +194 -0
- package/src/cli/plugin-cli.ts +942 -0
- package/src/cli/read-cli.ts +57 -0
- package/src/cli/session-picker.ts +52 -0
- package/src/cli/setup-cli.ts +433 -0
- package/src/cli/shell-cli.ts +176 -0
- package/src/cli/ssh-cli.ts +179 -0
- package/src/cli/stats-cli.ts +238 -0
- package/src/cli/update-cli.ts +408 -0
- package/src/cli/web-search-cli.ts +133 -0
- package/src/cli/worktree-cli.ts +291 -0
- package/src/cli.ts +99 -0
- package/src/commands/acp.ts +24 -0
- package/src/commands/agents.ts +57 -0
- package/src/commands/auth-broker.ts +96 -0
- package/src/commands/auth-gateway.ts +63 -0
- package/src/commands/codex-native-hook.ts +11 -0
- package/src/commands/commit.ts +46 -0
- package/src/commands/config.ts +51 -0
- package/src/commands/deep-interview.ts +12 -0
- package/src/commands/gjc-runtime-bridge.ts +81 -0
- package/src/commands/grep.ts +48 -0
- package/src/commands/launch.ts +161 -0
- package/src/commands/plugin.ts +78 -0
- package/src/commands/question.ts +12 -0
- package/src/commands/ralplan.ts +12 -0
- package/src/commands/read.ts +35 -0
- package/src/commands/setup.ts +52 -0
- package/src/commands/shell.ts +29 -0
- package/src/commands/ssh.ts +60 -0
- package/src/commands/state.ts +12 -0
- package/src/commands/stats.ts +29 -0
- package/src/commands/team.ts +130 -0
- package/src/commands/ultragoal.ts +32 -0
- package/src/commands/update.ts +21 -0
- package/src/commands/web-search.ts +42 -0
- package/src/commands/worktree.ts +56 -0
- package/src/commit/agentic/agent.ts +316 -0
- package/src/commit/agentic/fallback.ts +96 -0
- package/src/commit/agentic/index.ts +355 -0
- package/src/commit/agentic/prompts/analyze-file.md +22 -0
- package/src/commit/agentic/prompts/session-user.md +25 -0
- package/src/commit/agentic/prompts/split-confirm.md +1 -0
- package/src/commit/agentic/prompts/system.md +38 -0
- package/src/commit/agentic/state.ts +60 -0
- package/src/commit/agentic/tools/analyze-file.ts +127 -0
- package/src/commit/agentic/tools/git-file-diff.ts +191 -0
- package/src/commit/agentic/tools/git-hunk.ts +50 -0
- package/src/commit/agentic/tools/git-overview.ts +81 -0
- package/src/commit/agentic/tools/index.ts +54 -0
- package/src/commit/agentic/tools/propose-changelog.ts +144 -0
- package/src/commit/agentic/tools/propose-commit.ts +109 -0
- package/src/commit/agentic/tools/recent-commits.ts +81 -0
- package/src/commit/agentic/tools/schemas.ts +23 -0
- package/src/commit/agentic/tools/split-commit.ts +238 -0
- package/src/commit/agentic/topo-sort.ts +44 -0
- package/src/commit/agentic/trivial.ts +51 -0
- package/src/commit/agentic/validation.ts +183 -0
- package/src/commit/analysis/conventional.ts +64 -0
- package/src/commit/analysis/index.ts +4 -0
- package/src/commit/analysis/scope.ts +242 -0
- package/src/commit/analysis/summary.ts +105 -0
- package/src/commit/analysis/validation.ts +66 -0
- package/src/commit/changelog/detect.ts +40 -0
- package/src/commit/changelog/generate.ts +97 -0
- package/src/commit/changelog/index.ts +234 -0
- package/src/commit/changelog/parse.ts +44 -0
- package/src/commit/cli.ts +85 -0
- package/src/commit/git/diff.ts +148 -0
- package/src/commit/index.ts +5 -0
- package/src/commit/map-reduce/index.ts +69 -0
- package/src/commit/map-reduce/map-phase.ts +193 -0
- package/src/commit/map-reduce/reduce-phase.ts +49 -0
- package/src/commit/map-reduce/utils.ts +9 -0
- package/src/commit/message.ts +11 -0
- package/src/commit/model-selection.ts +66 -0
- package/src/commit/pipeline.ts +243 -0
- package/src/commit/prompts/analysis-system.md +148 -0
- package/src/commit/prompts/analysis-user.md +38 -0
- package/src/commit/prompts/changelog-system.md +50 -0
- package/src/commit/prompts/changelog-user.md +18 -0
- package/src/commit/prompts/file-observer-system.md +24 -0
- package/src/commit/prompts/file-observer-user.md +8 -0
- package/src/commit/prompts/reduce-system.md +50 -0
- package/src/commit/prompts/reduce-user.md +17 -0
- package/src/commit/prompts/summary-retry.md +3 -0
- package/src/commit/prompts/summary-system.md +38 -0
- package/src/commit/prompts/summary-user.md +13 -0
- package/src/commit/prompts/types-description.md +2 -0
- package/src/commit/shared-llm.ts +77 -0
- package/src/commit/types.ts +118 -0
- package/src/commit/utils/exclusions.ts +42 -0
- package/src/commit/utils.ts +58 -0
- package/src/config/config-file.ts +232 -0
- package/src/config/file-lock.ts +121 -0
- package/src/config/keybindings.ts +493 -0
- package/src/config/mcp-schema.json +230 -0
- package/src/config/model-equivalence.ts +811 -0
- package/src/config/model-registry.ts +2384 -0
- package/src/config/model-resolver.ts +1398 -0
- package/src/config/models-config-schema.ts +175 -0
- package/src/config/prompt-templates.ts +310 -0
- package/src/config/resolve-config-value.ts +94 -0
- package/src/config/settings-schema.ts +2939 -0
- package/src/config/settings.ts +919 -0
- package/src/config/skill-settings-defaults.ts +27 -0
- package/src/config.ts +212 -0
- package/src/cursor.ts +350 -0
- package/src/dap/client.ts +675 -0
- package/src/dap/config.ts +150 -0
- package/src/dap/defaults.json +211 -0
- package/src/dap/index.ts +4 -0
- package/src/dap/session.ts +1306 -0
- package/src/dap/types.ts +600 -0
- package/src/debug/index.ts +459 -0
- package/src/debug/log-formatting.ts +58 -0
- package/src/debug/log-viewer.ts +908 -0
- package/src/debug/profiler.ts +162 -0
- package/src/debug/raw-sse-buffer.ts +270 -0
- package/src/debug/raw-sse.ts +213 -0
- package/src/debug/report-bundle.ts +365 -0
- package/src/debug/system-info.ts +111 -0
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +795 -0
- package/src/defaults/gjc/skills/ralplan/SKILL.md +142 -0
- package/src/defaults/gjc/skills/team/SKILL.md +373 -0
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +176 -0
- package/src/defaults/gjc-defaults.ts +151 -0
- package/src/discovery/agents-md.ts +67 -0
- package/src/discovery/agents.ts +230 -0
- package/src/discovery/builtin.ts +932 -0
- package/src/discovery/claude-plugins.ts +387 -0
- package/src/discovery/claude.ts +313 -0
- package/src/discovery/cline.ts +83 -0
- package/src/discovery/codex.ts +330 -0
- package/src/discovery/cursor.ts +220 -0
- package/src/discovery/gemini.ts +383 -0
- package/src/discovery/github.ts +118 -0
- package/src/discovery/helpers.ts +964 -0
- package/src/discovery/index.ts +76 -0
- package/src/discovery/mcp-json.ts +171 -0
- package/src/discovery/opencode.ts +398 -0
- package/src/discovery/plugin-dir-roots.ts +28 -0
- package/src/discovery/ssh.ts +153 -0
- package/src/discovery/substitute-plugin-root.ts +29 -0
- package/src/discovery/vscode.ts +105 -0
- package/src/discovery/windsurf.ts +147 -0
- package/src/edit/apply-patch/index.ts +87 -0
- package/src/edit/apply-patch/parser.ts +174 -0
- package/src/edit/diff.ts +810 -0
- package/src/edit/file-read-cache.ts +95 -0
- package/src/edit/index.ts +528 -0
- package/src/edit/modes/apply-patch.lark +19 -0
- package/src/edit/modes/apply-patch.ts +53 -0
- package/src/edit/modes/patch.ts +1835 -0
- package/src/edit/modes/replace.ts +1103 -0
- package/src/edit/normalize.ts +375 -0
- package/src/edit/notebook.ts +222 -0
- package/src/edit/read-file.ts +25 -0
- package/src/edit/renderer.ts +683 -0
- package/src/edit/streaming.ts +561 -0
- package/src/eval/backend.ts +43 -0
- package/src/eval/index.ts +4 -0
- package/src/eval/js/context-manager.ts +414 -0
- package/src/eval/js/executor.ts +134 -0
- package/src/eval/js/index.ts +46 -0
- package/src/eval/js/shared/helpers.ts +237 -0
- package/src/eval/js/shared/indirect-eval.ts +30 -0
- package/src/eval/js/shared/prelude.ts +2 -0
- package/src/eval/js/shared/prelude.txt +70 -0
- package/src/eval/js/shared/rewrite-imports.ts +416 -0
- package/src/eval/js/shared/runtime.ts +301 -0
- package/src/eval/js/shared/types.ts +18 -0
- package/src/eval/js/tool-bridge.ts +144 -0
- package/src/eval/js/worker-core.ts +146 -0
- package/src/eval/js/worker-entry.ts +24 -0
- package/src/eval/js/worker-protocol.ts +41 -0
- package/src/eval/py/display.ts +71 -0
- package/src/eval/py/executor.ts +602 -0
- package/src/eval/py/index.ts +58 -0
- package/src/eval/py/kernel.ts +668 -0
- package/src/eval/py/prelude.py +462 -0
- package/src/eval/py/prelude.ts +3 -0
- package/src/eval/py/runner.py +910 -0
- package/src/eval/py/runtime.ts +210 -0
- package/src/eval/py/tool-bridge.ts +137 -0
- package/src/eval/types.ts +48 -0
- package/src/exa/factory.ts +60 -0
- package/src/exa/index.ts +27 -0
- package/src/exa/mcp-client.ts +364 -0
- package/src/exa/render.ts +244 -0
- package/src/exa/researcher.ts +36 -0
- package/src/exa/search.ts +47 -0
- package/src/exa/types.ts +166 -0
- package/src/exa/websets.ts +248 -0
- package/src/exec/bash-executor.ts +309 -0
- package/src/exec/exec.ts +53 -0
- package/src/exec/idle-timeout-watchdog.ts +126 -0
- package/src/exec/non-interactive-env.ts +48 -0
- package/src/export/custom-share.ts +65 -0
- package/src/export/html/index.ts +164 -0
- package/src/export/html/template.css +1060 -0
- package/src/export/html/template.generated.ts +2 -0
- package/src/export/html/template.html +47 -0
- package/src/export/html/template.js +2268 -0
- package/src/export/html/template.macro.ts +25 -0
- package/src/export/html/vendor/highlight.min.js +1213 -0
- package/src/export/html/vendor/marked.min.js +6 -0
- package/src/export/ttsr.ts +434 -0
- package/src/extensibility/custom-commands/bundled/ci-green/index.ts +25 -0
- package/src/extensibility/custom-commands/bundled/review/index.ts +456 -0
- package/src/extensibility/custom-commands/index.ts +2 -0
- package/src/extensibility/custom-commands/loader.ts +238 -0
- package/src/extensibility/custom-commands/types.ts +113 -0
- package/src/extensibility/custom-tools/index.ts +7 -0
- package/src/extensibility/custom-tools/loader.ts +245 -0
- package/src/extensibility/custom-tools/types.ts +254 -0
- package/src/extensibility/custom-tools/wrapper.ts +47 -0
- package/src/extensibility/extensions/compact-handler.ts +40 -0
- package/src/extensibility/extensions/get-commands-handler.ts +80 -0
- package/src/extensibility/extensions/index.ts +15 -0
- package/src/extensibility/extensions/loader.ts +545 -0
- package/src/extensibility/extensions/runner.ts +900 -0
- package/src/extensibility/extensions/types.ts +1259 -0
- package/src/extensibility/extensions/wrapper.ts +189 -0
- package/src/extensibility/hooks/index.ts +5 -0
- package/src/extensibility/hooks/loader.ts +257 -0
- package/src/extensibility/hooks/runner.ts +425 -0
- package/src/extensibility/hooks/tool-wrapper.ts +107 -0
- package/src/extensibility/hooks/types.ts +599 -0
- package/src/extensibility/plugins/doctor.ts +66 -0
- package/src/extensibility/plugins/git-url.ts +281 -0
- package/src/extensibility/plugins/index.ts +9 -0
- package/src/extensibility/plugins/installer.ts +192 -0
- package/src/extensibility/plugins/legacy-pi-compat.ts +336 -0
- package/src/extensibility/plugins/loader.ts +288 -0
- package/src/extensibility/plugins/manager.ts +731 -0
- package/src/extensibility/plugins/marketplace/cache.ts +136 -0
- package/src/extensibility/plugins/marketplace/fetcher.ts +317 -0
- package/src/extensibility/plugins/marketplace/index.ts +6 -0
- package/src/extensibility/plugins/marketplace/manager.ts +770 -0
- package/src/extensibility/plugins/marketplace/registry.ts +196 -0
- package/src/extensibility/plugins/marketplace/source-resolver.ts +147 -0
- package/src/extensibility/plugins/marketplace/types.ts +191 -0
- package/src/extensibility/plugins/parser.ts +105 -0
- package/src/extensibility/plugins/types.ts +194 -0
- package/src/extensibility/shared-events.ts +343 -0
- package/src/extensibility/skills.ts +391 -0
- package/src/extensibility/slash-commands.ts +227 -0
- package/src/extensibility/tool-proxy.ts +25 -0
- package/src/extensibility/typebox.ts +418 -0
- package/src/extensibility/utils.ts +44 -0
- package/src/gjc-runtime/goal-mode-request.ts +212 -0
- package/src/gjc-runtime/launch-tmux.ts +162 -0
- package/src/gjc-runtime/launch-worktree.ts +291 -0
- package/src/gjc-runtime/team-runtime.ts +2025 -0
- package/src/gjc-runtime/ultragoal-runtime.ts +564 -0
- package/src/goals/index.ts +3 -0
- package/src/goals/runtime.ts +524 -0
- package/src/goals/state.ts +37 -0
- package/src/goals/tools/goal-tool.ts +371 -0
- package/src/hashline/anchors.ts +113 -0
- package/src/hashline/apply.ts +737 -0
- package/src/hashline/bigrams.json +649 -0
- package/src/hashline/constants.ts +25 -0
- package/src/hashline/diff-preview.ts +43 -0
- package/src/hashline/diff.ts +56 -0
- package/src/hashline/execute.ts +267 -0
- package/src/hashline/grammar.lark +21 -0
- package/src/hashline/hash.ts +173 -0
- package/src/hashline/index.ts +13 -0
- package/src/hashline/input.ts +130 -0
- package/src/hashline/parser.ts +246 -0
- package/src/hashline/prefixes.ts +101 -0
- package/src/hashline/recovery.ts +113 -0
- package/src/hashline/stream.ts +123 -0
- package/src/hashline/types.ts +68 -0
- package/src/hindsight/backend.ts +205 -0
- package/src/hindsight/bank.ts +131 -0
- package/src/hindsight/client.ts +598 -0
- package/src/hindsight/config.ts +175 -0
- package/src/hindsight/content.ts +210 -0
- package/src/hindsight/index.ts +8 -0
- package/src/hindsight/mental-models.ts +382 -0
- package/src/hindsight/seeds.json +32 -0
- package/src/hindsight/state.ts +469 -0
- package/src/hindsight/transcript.ts +71 -0
- package/src/hooks/codex-native-hooks-config.ts +143 -0
- package/src/hooks/native-skill-hook.ts +279 -0
- package/src/hooks/skill-keywords.ts +86 -0
- package/src/hooks/skill-state.ts +416 -0
- package/src/index.ts +56 -0
- package/src/internal-urls/agent-protocol.ts +129 -0
- package/src/internal-urls/artifact-protocol.ts +80 -0
- package/src/internal-urls/docs-index.generated.ts +81 -0
- package/src/internal-urls/gjc-protocol.ts +83 -0
- package/src/internal-urls/index.ts +21 -0
- package/src/internal-urls/issue-pr-protocol.ts +577 -0
- package/src/internal-urls/json-query.ts +126 -0
- package/src/internal-urls/local-protocol.ts +249 -0
- package/src/internal-urls/mcp-protocol.ts +151 -0
- package/src/internal-urls/memory-protocol.ts +164 -0
- package/src/internal-urls/parse.ts +72 -0
- package/src/internal-urls/registry-helpers.ts +25 -0
- package/src/internal-urls/router.ts +78 -0
- package/src/internal-urls/rule-protocol.ts +38 -0
- package/src/internal-urls/skill-protocol.ts +103 -0
- package/src/internal-urls/types.ts +110 -0
- package/src/lsp/client.ts +951 -0
- package/src/lsp/clients/biome-client.ts +202 -0
- package/src/lsp/clients/index.ts +50 -0
- package/src/lsp/clients/lsp-linter-client.ts +93 -0
- package/src/lsp/clients/swiftlint-client.ts +120 -0
- package/src/lsp/config.ts +492 -0
- package/src/lsp/defaults.json +493 -0
- package/src/lsp/edits.ts +166 -0
- package/src/lsp/index.ts +2282 -0
- package/src/lsp/lspmux.ts +233 -0
- package/src/lsp/render.ts +692 -0
- package/src/lsp/startup-events.ts +13 -0
- package/src/lsp/types.ts +443 -0
- package/src/lsp/utils.ts +678 -0
- package/src/main.ts +961 -0
- package/src/memories/index.ts +1135 -0
- package/src/memories/storage.ts +577 -0
- package/src/memory-backend/index.ts +4 -0
- package/src/memory-backend/local-backend.ts +30 -0
- package/src/memory-backend/off-backend.ts +16 -0
- package/src/memory-backend/resolve.ts +24 -0
- package/src/memory-backend/types.ts +79 -0
- package/src/modes/acp/acp-agent.ts +2170 -0
- package/src/modes/acp/acp-client-bridge.ts +154 -0
- package/src/modes/acp/acp-event-mapper.ts +879 -0
- package/src/modes/acp/acp-mode.ts +23 -0
- package/src/modes/acp/index.ts +2 -0
- package/src/modes/acp/terminal-auth.ts +37 -0
- package/src/modes/components/agent-dashboard.ts +1120 -0
- package/src/modes/components/assistant-message.ts +231 -0
- package/src/modes/components/bash-execution.ts +228 -0
- package/src/modes/components/bordered-loader.ts +41 -0
- package/src/modes/components/branch-summary-message.ts +45 -0
- package/src/modes/components/btw-panel.ts +104 -0
- package/src/modes/components/compaction-summary-message.ts +51 -0
- package/src/modes/components/countdown-timer.ts +75 -0
- package/src/modes/components/custom-editor.ts +237 -0
- package/src/modes/components/custom-message.ts +65 -0
- package/src/modes/components/diff.ts +266 -0
- package/src/modes/components/dynamic-border.ts +25 -0
- package/src/modes/components/eval-execution.ts +164 -0
- package/src/modes/components/execution-shared.ts +102 -0
- package/src/modes/components/extensions/extension-dashboard.ts +350 -0
- package/src/modes/components/extensions/extension-list.ts +492 -0
- package/src/modes/components/extensions/index.ts +9 -0
- package/src/modes/components/extensions/inspector-panel.ts +317 -0
- package/src/modes/components/extensions/state-manager.ts +628 -0
- package/src/modes/components/extensions/types.ts +191 -0
- package/src/modes/components/footer.ts +270 -0
- package/src/modes/components/history-search.ts +158 -0
- package/src/modes/components/hook-editor.ts +151 -0
- package/src/modes/components/hook-input.ts +79 -0
- package/src/modes/components/hook-message.ts +68 -0
- package/src/modes/components/hook-selector.ts +190 -0
- package/src/modes/components/index.ts +36 -0
- package/src/modes/components/keybinding-hints.ts +65 -0
- package/src/modes/components/login-dialog.ts +164 -0
- package/src/modes/components/message-frame.ts +88 -0
- package/src/modes/components/model-selector.ts +794 -0
- package/src/modes/components/oauth-selector.ts +248 -0
- package/src/modes/components/plugin-selector.ts +95 -0
- package/src/modes/components/plugin-settings.ts +488 -0
- package/src/modes/components/provider-onboarding-selector.ts +88 -0
- package/src/modes/components/queue-mode-selector.ts +56 -0
- package/src/modes/components/read-tool-group.ts +267 -0
- package/src/modes/components/runtime-mcp-add-wizard.ts +1341 -0
- package/src/modes/components/session-observer-overlay.ts +839 -0
- package/src/modes/components/session-selector.ts +343 -0
- package/src/modes/components/settings-defs.ts +175 -0
- package/src/modes/components/settings-selector.ts +635 -0
- package/src/modes/components/show-images-selector.ts +45 -0
- package/src/modes/components/skill-hud/render.ts +47 -0
- package/src/modes/components/skill-message.ts +90 -0
- package/src/modes/components/status-line/context-thresholds.ts +68 -0
- package/src/modes/components/status-line/git-utils.ts +42 -0
- package/src/modes/components/status-line/index.ts +4 -0
- package/src/modes/components/status-line/presets.ts +105 -0
- package/src/modes/components/status-line/segments.ts +560 -0
- package/src/modes/components/status-line/separators.ts +55 -0
- package/src/modes/components/status-line/token-rate.ts +66 -0
- package/src/modes/components/status-line/types.ts +93 -0
- package/src/modes/components/status-line.ts +839 -0
- package/src/modes/components/theme-selector.ts +63 -0
- package/src/modes/components/thinking-selector.ts +52 -0
- package/src/modes/components/todo-reminder.ts +40 -0
- package/src/modes/components/tool-execution.ts +830 -0
- package/src/modes/components/tree-selector.ts +930 -0
- package/src/modes/components/ttsr-notification.ts +80 -0
- package/src/modes/components/user-message-selector.ts +141 -0
- package/src/modes/components/user-message.ts +51 -0
- package/src/modes/components/visual-truncate.ts +63 -0
- package/src/modes/components/welcome.ts +389 -0
- package/src/modes/controllers/btw-controller.ts +105 -0
- package/src/modes/controllers/command-controller-shared.ts +108 -0
- package/src/modes/controllers/command-controller.ts +1630 -0
- package/src/modes/controllers/event-controller.ts +786 -0
- package/src/modes/controllers/extension-ui-controller.ts +927 -0
- package/src/modes/controllers/input-controller.ts +858 -0
- package/src/modes/controllers/runtime-mcp-command-controller.ts +1934 -0
- package/src/modes/controllers/selector-controller.ts +1039 -0
- package/src/modes/controllers/ssh-command-controller.ts +384 -0
- package/src/modes/controllers/todo-command-controller.ts +485 -0
- package/src/modes/data/emojis.json +1 -0
- package/src/modes/emoji-autocomplete.ts +285 -0
- package/src/modes/index.ts +34 -0
- package/src/modes/interactive-mode.ts +2756 -0
- package/src/modes/loop-limit.ts +140 -0
- package/src/modes/oauth-manual-input.ts +42 -0
- package/src/modes/print-mode.ts +121 -0
- package/src/modes/prompt-action-autocomplete.ts +345 -0
- package/src/modes/rpc/host-tools.ts +186 -0
- package/src/modes/rpc/host-uris.ts +235 -0
- package/src/modes/rpc/rpc-client.ts +810 -0
- package/src/modes/rpc/rpc-mode.ts +851 -0
- package/src/modes/rpc/rpc-types.ts +378 -0
- package/src/modes/runtime-init.ts +116 -0
- package/src/modes/session-observer-registry.ts +146 -0
- package/src/modes/shared.ts +55 -0
- package/src/modes/theme/dark.json +95 -0
- package/src/modes/theme/defaults/alabaster.json +93 -0
- package/src/modes/theme/defaults/amethyst.json +96 -0
- package/src/modes/theme/defaults/anthracite.json +93 -0
- package/src/modes/theme/defaults/basalt.json +91 -0
- package/src/modes/theme/defaults/birch.json +95 -0
- package/src/modes/theme/defaults/dark-abyss.json +91 -0
- package/src/modes/theme/defaults/dark-arctic.json +104 -0
- package/src/modes/theme/defaults/dark-aurora.json +95 -0
- package/src/modes/theme/defaults/dark-catppuccin.json +107 -0
- package/src/modes/theme/defaults/dark-cavern.json +91 -0
- package/src/modes/theme/defaults/dark-copper.json +95 -0
- package/src/modes/theme/defaults/dark-cosmos.json +90 -0
- package/src/modes/theme/defaults/dark-cyberpunk.json +102 -0
- package/src/modes/theme/defaults/dark-dracula.json +98 -0
- package/src/modes/theme/defaults/dark-eclipse.json +91 -0
- package/src/modes/theme/defaults/dark-ember.json +95 -0
- package/src/modes/theme/defaults/dark-equinox.json +90 -0
- package/src/modes/theme/defaults/dark-forest.json +96 -0
- package/src/modes/theme/defaults/dark-github.json +105 -0
- package/src/modes/theme/defaults/dark-gruvbox.json +112 -0
- package/src/modes/theme/defaults/dark-lavender.json +95 -0
- package/src/modes/theme/defaults/dark-lunar.json +89 -0
- package/src/modes/theme/defaults/dark-midnight.json +95 -0
- package/src/modes/theme/defaults/dark-monochrome.json +94 -0
- package/src/modes/theme/defaults/dark-monokai.json +98 -0
- package/src/modes/theme/defaults/dark-nebula.json +90 -0
- package/src/modes/theme/defaults/dark-nord.json +97 -0
- package/src/modes/theme/defaults/dark-ocean.json +101 -0
- package/src/modes/theme/defaults/dark-one.json +100 -0
- package/src/modes/theme/defaults/dark-poimandres.json +142 -0
- package/src/modes/theme/defaults/dark-rainforest.json +91 -0
- package/src/modes/theme/defaults/dark-reef.json +91 -0
- package/src/modes/theme/defaults/dark-retro.json +92 -0
- package/src/modes/theme/defaults/dark-rose-pine.json +96 -0
- package/src/modes/theme/defaults/dark-sakura.json +95 -0
- package/src/modes/theme/defaults/dark-slate.json +95 -0
- package/src/modes/theme/defaults/dark-solarized.json +97 -0
- package/src/modes/theme/defaults/dark-solstice.json +90 -0
- package/src/modes/theme/defaults/dark-starfall.json +91 -0
- package/src/modes/theme/defaults/dark-sunset.json +99 -0
- package/src/modes/theme/defaults/dark-swamp.json +90 -0
- package/src/modes/theme/defaults/dark-synthwave.json +103 -0
- package/src/modes/theme/defaults/dark-taiga.json +91 -0
- package/src/modes/theme/defaults/dark-terminal.json +95 -0
- package/src/modes/theme/defaults/dark-tokyo-night.json +101 -0
- package/src/modes/theme/defaults/dark-tundra.json +91 -0
- package/src/modes/theme/defaults/dark-twilight.json +91 -0
- package/src/modes/theme/defaults/dark-volcanic.json +91 -0
- package/src/modes/theme/defaults/graphite.json +92 -0
- package/src/modes/theme/defaults/index.ts +201 -0
- package/src/modes/theme/defaults/light-arctic.json +107 -0
- package/src/modes/theme/defaults/light-aurora-day.json +91 -0
- package/src/modes/theme/defaults/light-canyon.json +91 -0
- package/src/modes/theme/defaults/light-catppuccin.json +106 -0
- package/src/modes/theme/defaults/light-cirrus.json +90 -0
- package/src/modes/theme/defaults/light-coral.json +95 -0
- package/src/modes/theme/defaults/light-cyberpunk.json +96 -0
- package/src/modes/theme/defaults/light-dawn.json +90 -0
- package/src/modes/theme/defaults/light-dunes.json +91 -0
- package/src/modes/theme/defaults/light-eucalyptus.json +95 -0
- package/src/modes/theme/defaults/light-forest.json +100 -0
- package/src/modes/theme/defaults/light-frost.json +95 -0
- package/src/modes/theme/defaults/light-github.json +115 -0
- package/src/modes/theme/defaults/light-glacier.json +91 -0
- package/src/modes/theme/defaults/light-gruvbox.json +108 -0
- package/src/modes/theme/defaults/light-haze.json +90 -0
- package/src/modes/theme/defaults/light-honeycomb.json +95 -0
- package/src/modes/theme/defaults/light-lagoon.json +91 -0
- package/src/modes/theme/defaults/light-lavender.json +95 -0
- package/src/modes/theme/defaults/light-meadow.json +91 -0
- package/src/modes/theme/defaults/light-mint.json +95 -0
- package/src/modes/theme/defaults/light-monochrome.json +101 -0
- package/src/modes/theme/defaults/light-ocean.json +99 -0
- package/src/modes/theme/defaults/light-one.json +99 -0
- package/src/modes/theme/defaults/light-opal.json +91 -0
- package/src/modes/theme/defaults/light-orchard.json +91 -0
- package/src/modes/theme/defaults/light-paper.json +95 -0
- package/src/modes/theme/defaults/light-poimandres.json +142 -0
- package/src/modes/theme/defaults/light-prism.json +90 -0
- package/src/modes/theme/defaults/light-retro.json +98 -0
- package/src/modes/theme/defaults/light-sand.json +95 -0
- package/src/modes/theme/defaults/light-savanna.json +91 -0
- package/src/modes/theme/defaults/light-solarized.json +102 -0
- package/src/modes/theme/defaults/light-soleil.json +90 -0
- package/src/modes/theme/defaults/light-sunset.json +99 -0
- package/src/modes/theme/defaults/light-synthwave.json +98 -0
- package/src/modes/theme/defaults/light-tokyo-night.json +111 -0
- package/src/modes/theme/defaults/light-wetland.json +91 -0
- package/src/modes/theme/defaults/light-zenith.json +89 -0
- package/src/modes/theme/defaults/limestone.json +94 -0
- package/src/modes/theme/defaults/mahogany.json +97 -0
- package/src/modes/theme/defaults/marble.json +93 -0
- package/src/modes/theme/defaults/obsidian.json +91 -0
- package/src/modes/theme/defaults/onyx.json +91 -0
- package/src/modes/theme/defaults/pearl.json +93 -0
- package/src/modes/theme/defaults/porcelain.json +91 -0
- package/src/modes/theme/defaults/quartz.json +96 -0
- package/src/modes/theme/defaults/red-claw.json +123 -0
- package/src/modes/theme/defaults/sandstone.json +95 -0
- package/src/modes/theme/defaults/titanium.json +90 -0
- package/src/modes/theme/light.json +93 -0
- package/src/modes/theme/mermaid-cache.ts +29 -0
- package/src/modes/theme/shimmer.ts +219 -0
- package/src/modes/theme/theme-schema.json +429 -0
- package/src/modes/theme/theme.ts +2413 -0
- package/src/modes/types.ts +313 -0
- package/src/modes/utils/context-usage.ts +335 -0
- package/src/modes/utils/hotkeys-markdown.ts +59 -0
- package/src/modes/utils/keybinding-matchers.ts +30 -0
- package/src/modes/utils/tools-markdown.ts +27 -0
- package/src/modes/utils/ui-helpers.ts +741 -0
- package/src/plan-mode/approved-plan.ts +163 -0
- package/src/plan-mode/state.ts +6 -0
- package/src/priority.json +37 -0
- package/src/prompts/agents/architect.md +79 -0
- package/src/prompts/agents/critic.md +55 -0
- package/src/prompts/agents/executor.md +45 -0
- package/src/prompts/agents/explore.md +58 -0
- package/src/prompts/agents/frontmatter.md +12 -0
- package/src/prompts/agents/init.md +34 -0
- package/src/prompts/agents/plan.md +49 -0
- package/src/prompts/agents/planner.md +49 -0
- package/src/prompts/agents/reviewer.md +141 -0
- package/src/prompts/agents/task.md +16 -0
- package/src/prompts/ci-green-request.md +36 -0
- package/src/prompts/commands/orchestrate.md +49 -0
- package/src/prompts/goals/goal-budget-limit.md +16 -0
- package/src/prompts/goals/goal-continuation.md +28 -0
- package/src/prompts/goals/goal-mode-active.md +23 -0
- package/src/prompts/memories/consolidation.md +30 -0
- package/src/prompts/memories/read-path.md +11 -0
- package/src/prompts/memories/stage_one_input.md +6 -0
- package/src/prompts/memories/stage_one_system.md +21 -0
- package/src/prompts/review-request.md +70 -0
- package/src/prompts/system/agent-creation-architect.md +75 -0
- package/src/prompts/system/agent-creation-user.md +6 -0
- package/src/prompts/system/auto-continue.md +1 -0
- package/src/prompts/system/btw-user.md +8 -0
- package/src/prompts/system/commit-message-system.md +2 -0
- package/src/prompts/system/custom-system-prompt.md +64 -0
- package/src/prompts/system/eager-todo.md +13 -0
- package/src/prompts/system/irc-incoming.md +8 -0
- package/src/prompts/system/plan-mode-active.md +116 -0
- package/src/prompts/system/plan-mode-approved.md +28 -0
- package/src/prompts/system/plan-mode-compact-instructions.md +16 -0
- package/src/prompts/system/plan-mode-reference.md +14 -0
- package/src/prompts/system/plan-mode-subagent.md +34 -0
- package/src/prompts/system/plan-mode-tool-decision-reminder.md +9 -0
- package/src/prompts/system/project-prompt.md +46 -0
- package/src/prompts/system/subagent-system-prompt.md +54 -0
- package/src/prompts/system/subagent-user-prompt.md +3 -0
- package/src/prompts/system/subagent-yield-reminder.md +12 -0
- package/src/prompts/system/system-prompt.md +267 -0
- package/src/prompts/system/title-system.md +2 -0
- package/src/prompts/system/ttsr-interrupt.md +7 -0
- package/src/prompts/system/ttsr-tool-reminder.md +5 -0
- package/src/prompts/system/web-search.md +25 -0
- package/src/prompts/tools/apply-patch.md +65 -0
- package/src/prompts/tools/ask.md +29 -0
- package/src/prompts/tools/ast-edit.md +39 -0
- package/src/prompts/tools/ast-grep.md +42 -0
- package/src/prompts/tools/async-result.md +8 -0
- package/src/prompts/tools/bash.md +39 -0
- package/src/prompts/tools/browser.md +70 -0
- package/src/prompts/tools/calculator.md +10 -0
- package/src/prompts/tools/checkpoint.md +16 -0
- package/src/prompts/tools/create-goal.md +3 -0
- package/src/prompts/tools/debug.md +33 -0
- package/src/prompts/tools/eval.md +75 -0
- package/src/prompts/tools/find.md +34 -0
- package/src/prompts/tools/get-goal.md +3 -0
- package/src/prompts/tools/github.md +20 -0
- package/src/prompts/tools/goal.md +18 -0
- package/src/prompts/tools/hashline.md +130 -0
- package/src/prompts/tools/image-gen.md +7 -0
- package/src/prompts/tools/inspect-image-system.md +20 -0
- package/src/prompts/tools/inspect-image.md +32 -0
- package/src/prompts/tools/irc.md +49 -0
- package/src/prompts/tools/job.md +19 -0
- package/src/prompts/tools/lsp.md +42 -0
- package/src/prompts/tools/patch.md +70 -0
- package/src/prompts/tools/read.md +82 -0
- package/src/prompts/tools/recall.md +5 -0
- package/src/prompts/tools/recipe.md +16 -0
- package/src/prompts/tools/reflect.md +5 -0
- package/src/prompts/tools/render-mermaid.md +9 -0
- package/src/prompts/tools/replace.md +36 -0
- package/src/prompts/tools/resolve.md +9 -0
- package/src/prompts/tools/retain.md +6 -0
- package/src/prompts/tools/rewind.md +13 -0
- package/src/prompts/tools/search-tool-bm25.md +33 -0
- package/src/prompts/tools/search.md +25 -0
- package/src/prompts/tools/ssh.md +35 -0
- package/src/prompts/tools/subagent.md +21 -0
- package/src/prompts/tools/task-summary.md +28 -0
- package/src/prompts/tools/task.md +79 -0
- package/src/prompts/tools/todo-write.md +50 -0
- package/src/prompts/tools/update-goal.md +3 -0
- package/src/prompts/tools/vim.md +98 -0
- package/src/prompts/tools/web-search.md +10 -0
- package/src/prompts/tools/write.md +14 -0
- package/src/registry/agent-registry.ts +140 -0
- package/src/runtime-mcp/client.ts +482 -0
- package/src/runtime-mcp/config-writer.ts +225 -0
- package/src/runtime-mcp/config.ts +365 -0
- package/src/runtime-mcp/discoverable-tool-metadata.ts +25 -0
- package/src/runtime-mcp/index.ts +29 -0
- package/src/runtime-mcp/json-rpc.ts +84 -0
- package/src/runtime-mcp/loader.ts +124 -0
- package/src/runtime-mcp/manager.ts +1172 -0
- package/src/runtime-mcp/oauth-discovery.ts +349 -0
- package/src/runtime-mcp/oauth-flow.ts +407 -0
- package/src/runtime-mcp/render.ts +123 -0
- package/src/runtime-mcp/smithery-auth.ts +104 -0
- package/src/runtime-mcp/smithery-connect.ts +145 -0
- package/src/runtime-mcp/smithery-registry.ts +477 -0
- package/src/runtime-mcp/tool-bridge.ts +416 -0
- package/src/runtime-mcp/tool-cache.ts +117 -0
- package/src/runtime-mcp/transports/http.ts +477 -0
- package/src/runtime-mcp/transports/index.ts +6 -0
- package/src/runtime-mcp/transports/stdio.ts +325 -0
- package/src/runtime-mcp/types.ts +423 -0
- package/src/sdk.ts +2064 -0
- package/src/secrets/index.ts +116 -0
- package/src/secrets/obfuscator.ts +277 -0
- package/src/secrets/regex.ts +21 -0
- package/src/session/agent-session.ts +8794 -0
- package/src/session/agent-storage.ts +466 -0
- package/src/session/artifacts.ts +135 -0
- package/src/session/auth-broker-config.ts +102 -0
- package/src/session/auth-storage.ts +23 -0
- package/src/session/blob-store.ts +168 -0
- package/src/session/client-bridge.ts +85 -0
- package/src/session/history-storage.ts +311 -0
- package/src/session/messages.ts +403 -0
- package/src/session/session-dump-format.ts +209 -0
- package/src/session/session-manager.ts +3333 -0
- package/src/session/session-storage.ts +389 -0
- package/src/session/streaming-output.ts +1093 -0
- package/src/session/tool-choice-queue.ts +213 -0
- package/src/session/yield-queue.ts +155 -0
- package/src/setup/model-onboarding-guidance.ts +36 -0
- package/src/setup/provider-onboarding.ts +195 -0
- package/src/skill-state/active-state.ts +272 -0
- package/src/slash-commands/acp-builtins.ts +46 -0
- package/src/slash-commands/builtin-registry.ts +955 -0
- package/src/slash-commands/helpers/context-report.ts +39 -0
- package/src/slash-commands/helpers/format.ts +46 -0
- package/src/slash-commands/helpers/mcp.ts +532 -0
- package/src/slash-commands/helpers/parse.ts +85 -0
- package/src/slash-commands/helpers/ssh.ts +195 -0
- package/src/slash-commands/helpers/todo.ts +279 -0
- package/src/slash-commands/helpers/usage-report.ts +91 -0
- package/src/slash-commands/types.ts +125 -0
- package/src/ssh/config-writer.ts +183 -0
- package/src/ssh/connection-manager.ts +482 -0
- package/src/ssh/ssh-executor.ts +133 -0
- package/src/ssh/sshfs-mount.ts +140 -0
- package/src/ssh/utils.ts +8 -0
- package/src/stt/downloader.ts +71 -0
- package/src/stt/index.ts +3 -0
- package/src/stt/recorder.ts +351 -0
- package/src/stt/setup.ts +52 -0
- package/src/stt/stt-controller.ts +160 -0
- package/src/stt/transcribe.py +70 -0
- package/src/stt/transcriber.ts +91 -0
- package/src/system-prompt.ts +581 -0
- package/src/task/agents.ts +162 -0
- package/src/task/commands.ts +135 -0
- package/src/task/discovery.ts +130 -0
- package/src/task/executor.ts +1564 -0
- package/src/task/gjc-command.ts +26 -0
- package/src/task/index.ts +1366 -0
- package/src/task/name-generator.ts +1577 -0
- package/src/task/output-manager.ts +107 -0
- package/src/task/parallel.ts +116 -0
- package/src/task/render.ts +1136 -0
- package/src/task/simple-mode.ts +27 -0
- package/src/task/subprocess-tool-registry.ts +88 -0
- package/src/task/types.ts +315 -0
- package/src/task/worktree.ts +506 -0
- package/src/thinking.ts +87 -0
- package/src/tool-discovery/tool-index.ts +400 -0
- package/src/tools/archive-reader.ts +321 -0
- package/src/tools/ask.ts +790 -0
- package/src/tools/ast-edit.ts +542 -0
- package/src/tools/ast-grep.ts +423 -0
- package/src/tools/auto-generated-guard.ts +305 -0
- package/src/tools/bash-command-fixup.ts +37 -0
- package/src/tools/bash-interactive.ts +388 -0
- package/src/tools/bash-interceptor.ts +67 -0
- package/src/tools/bash-pty-selection.ts +14 -0
- package/src/tools/bash-skill-urls.ts +248 -0
- package/src/tools/bash.ts +1061 -0
- package/src/tools/browser/attach.ts +175 -0
- package/src/tools/browser/launch.ts +651 -0
- package/src/tools/browser/readable.ts +95 -0
- package/src/tools/browser/registry.ts +194 -0
- package/src/tools/browser/render.ts +212 -0
- package/src/tools/browser/tab-protocol.ts +105 -0
- package/src/tools/browser/tab-supervisor.ts +577 -0
- package/src/tools/browser/tab-worker-entry.ts +21 -0
- package/src/tools/browser/tab-worker.ts +1054 -0
- package/src/tools/browser.ts +301 -0
- package/src/tools/calculator.ts +540 -0
- package/src/tools/checkpoint.ts +134 -0
- package/src/tools/conflict-detect.ts +672 -0
- package/src/tools/context.ts +39 -0
- package/src/tools/debug.ts +1014 -0
- package/src/tools/eval.ts +1101 -0
- package/src/tools/fetch.ts +1482 -0
- package/src/tools/file-recorder.ts +35 -0
- package/src/tools/find.ts +540 -0
- package/src/tools/fs-cache-invalidation.ts +28 -0
- package/src/tools/gh-format.ts +12 -0
- package/src/tools/gh-renderer.ts +428 -0
- package/src/tools/gh.ts +3499 -0
- package/src/tools/github-cache.ts +548 -0
- package/src/tools/grouped-file-output.ts +96 -0
- package/src/tools/hindsight-recall.ts +68 -0
- package/src/tools/hindsight-reflect.ts +57 -0
- package/src/tools/hindsight-retain.ts +56 -0
- package/src/tools/image-gen.ts +1248 -0
- package/src/tools/index.ts +519 -0
- package/src/tools/inspect-image-renderer.ts +103 -0
- package/src/tools/inspect-image.ts +165 -0
- package/src/tools/irc.ts +239 -0
- package/src/tools/job.ts +520 -0
- package/src/tools/json-tree.ts +243 -0
- package/src/tools/jtd-to-json-schema.ts +219 -0
- package/src/tools/jtd-to-typescript.ts +136 -0
- package/src/tools/jtd-utils.ts +102 -0
- package/src/tools/list-limit.ts +40 -0
- package/src/tools/match-line-format.ts +22 -0
- package/src/tools/output-meta.ts +754 -0
- package/src/tools/path-utils.ts +739 -0
- package/src/tools/plan-mode-guard.ts +68 -0
- package/src/tools/puppeteer/00_stealth_tampering.txt +63 -0
- package/src/tools/puppeteer/01_stealth_activity.txt +20 -0
- package/src/tools/puppeteer/02_stealth_hairline.txt +11 -0
- package/src/tools/puppeteer/03_stealth_botd.txt +384 -0
- package/src/tools/puppeteer/04_stealth_iframe.txt +81 -0
- package/src/tools/puppeteer/05_stealth_webgl.txt +75 -0
- package/src/tools/puppeteer/06_stealth_screen.txt +72 -0
- package/src/tools/puppeteer/07_stealth_fonts.txt +97 -0
- package/src/tools/puppeteer/08_stealth_audio.txt +51 -0
- package/src/tools/puppeteer/09_stealth_locale.txt +46 -0
- package/src/tools/puppeteer/10_stealth_plugins.txt +206 -0
- package/src/tools/puppeteer/11_stealth_hardware.txt +8 -0
- package/src/tools/puppeteer/12_stealth_codecs.txt +40 -0
- package/src/tools/puppeteer/13_stealth_worker.txt +74 -0
- package/src/tools/read.ts +2332 -0
- package/src/tools/recipe/index.ts +80 -0
- package/src/tools/recipe/render.ts +19 -0
- package/src/tools/recipe/runner.ts +219 -0
- package/src/tools/recipe/runners/cargo.ts +131 -0
- package/src/tools/recipe/runners/index.ts +8 -0
- package/src/tools/recipe/runners/just.ts +73 -0
- package/src/tools/recipe/runners/make.ts +101 -0
- package/src/tools/recipe/runners/pkg.ts +167 -0
- package/src/tools/recipe/runners/task.ts +72 -0
- package/src/tools/render-mermaid.ts +68 -0
- package/src/tools/render-utils.ts +774 -0
- package/src/tools/renderers.ts +75 -0
- package/src/tools/resolve.ts +258 -0
- package/src/tools/review.ts +252 -0
- package/src/tools/search-tool-bm25.ts +360 -0
- package/src/tools/search.ts +786 -0
- package/src/tools/sqlite-reader.ts +736 -0
- package/src/tools/ssh.ts +310 -0
- package/src/tools/subagent.ts +312 -0
- package/src/tools/todo-write.ts +695 -0
- package/src/tools/tool-errors.ts +62 -0
- package/src/tools/tool-result.ts +86 -0
- package/src/tools/tool-timeouts.ts +30 -0
- package/src/tools/vim.ts +949 -0
- package/src/tools/write.ts +953 -0
- package/src/tools/yield.ts +268 -0
- package/src/tui/code-cell.ts +201 -0
- package/src/tui/file-list.ts +55 -0
- package/src/tui/hyperlink.ts +126 -0
- package/src/tui/index.ts +12 -0
- package/src/tui/output-block.ts +150 -0
- package/src/tui/status-line.ts +39 -0
- package/src/tui/tree-list.ts +84 -0
- package/src/tui/types.ts +15 -0
- package/src/tui/utils.ts +103 -0
- package/src/utils/changelog.ts +98 -0
- package/src/utils/clipboard.ts +156 -0
- package/src/utils/command-args.ts +76 -0
- package/src/utils/commit-message-generator.ts +142 -0
- package/src/utils/edit-mode.ts +42 -0
- package/src/utils/event-bus.ts +33 -0
- package/src/utils/external-editor.ts +65 -0
- package/src/utils/file-display-mode.ts +45 -0
- package/src/utils/file-mentions.ts +376 -0
- package/src/utils/git.ts +1536 -0
- package/src/utils/image-loading.ts +102 -0
- package/src/utils/image-resize.ts +309 -0
- package/src/utils/lang-from-path.ts +239 -0
- package/src/utils/markit.ts +89 -0
- package/src/utils/open.ts +20 -0
- package/src/utils/session-color.ts +43 -0
- package/src/utils/shell-snapshot.ts +187 -0
- package/src/utils/sixel.ts +69 -0
- package/src/utils/title-generator.ts +223 -0
- package/src/utils/tool-choice.ts +33 -0
- package/src/utils/tools-manager.ts +363 -0
- package/src/vim/buffer.ts +309 -0
- package/src/vim/commands.ts +382 -0
- package/src/vim/engine.ts +2409 -0
- package/src/vim/parser.ts +134 -0
- package/src/vim/render.ts +252 -0
- package/src/vim/types.ts +197 -0
- package/src/web/kagi.ts +183 -0
- package/src/web/parallel.ts +349 -0
- package/src/web/scrapers/artifacthub.ts +207 -0
- package/src/web/scrapers/arxiv.ts +83 -0
- package/src/web/scrapers/aur.ts +162 -0
- package/src/web/scrapers/biorxiv.ts +133 -0
- package/src/web/scrapers/bluesky.ts +262 -0
- package/src/web/scrapers/brew.ts +172 -0
- package/src/web/scrapers/cheatsh.ts +68 -0
- package/src/web/scrapers/chocolatey.ts +196 -0
- package/src/web/scrapers/choosealicense.ts +95 -0
- package/src/web/scrapers/cisa-kev.ts +87 -0
- package/src/web/scrapers/clojars.ts +154 -0
- package/src/web/scrapers/coingecko.ts +177 -0
- package/src/web/scrapers/crates-io.ts +97 -0
- package/src/web/scrapers/crossref.ts +136 -0
- package/src/web/scrapers/devto.ts +147 -0
- package/src/web/scrapers/discogs.ts +306 -0
- package/src/web/scrapers/discourse.ts +197 -0
- package/src/web/scrapers/dockerhub.ts +138 -0
- package/src/web/scrapers/docs-rs.ts +653 -0
- package/src/web/scrapers/fdroid.ts +134 -0
- package/src/web/scrapers/firefox-addons.ts +191 -0
- package/src/web/scrapers/flathub.ts +223 -0
- package/src/web/scrapers/github-gist.ts +58 -0
- package/src/web/scrapers/github.ts +452 -0
- package/src/web/scrapers/gitlab.ts +401 -0
- package/src/web/scrapers/go-pkg.ts +266 -0
- package/src/web/scrapers/hackage.ts +140 -0
- package/src/web/scrapers/hackernews.ts +189 -0
- package/src/web/scrapers/hex.ts +105 -0
- package/src/web/scrapers/huggingface.ts +321 -0
- package/src/web/scrapers/iacr.ts +89 -0
- package/src/web/scrapers/index.ts +252 -0
- package/src/web/scrapers/jetbrains-marketplace.ts +159 -0
- package/src/web/scrapers/lemmy.ts +203 -0
- package/src/web/scrapers/lobsters.ts +175 -0
- package/src/web/scrapers/mastodon.ts +292 -0
- package/src/web/scrapers/maven.ts +138 -0
- package/src/web/scrapers/mdn.ts +173 -0
- package/src/web/scrapers/metacpan.ts +222 -0
- package/src/web/scrapers/musicbrainz.ts +250 -0
- package/src/web/scrapers/npm.ts +98 -0
- package/src/web/scrapers/nuget.ts +183 -0
- package/src/web/scrapers/nvd.ts +222 -0
- package/src/web/scrapers/ollama.ts +239 -0
- package/src/web/scrapers/open-vsx.ts +106 -0
- package/src/web/scrapers/opencorporates.ts +292 -0
- package/src/web/scrapers/openlibrary.ts +336 -0
- package/src/web/scrapers/orcid.ts +286 -0
- package/src/web/scrapers/osv.ts +176 -0
- package/src/web/scrapers/packagist.ts +160 -0
- package/src/web/scrapers/pub-dev.ts +143 -0
- package/src/web/scrapers/pubmed.ts +211 -0
- package/src/web/scrapers/pypi.ts +112 -0
- package/src/web/scrapers/rawg.ts +110 -0
- package/src/web/scrapers/readthedocs.ts +120 -0
- package/src/web/scrapers/reddit.ts +95 -0
- package/src/web/scrapers/repology.ts +251 -0
- package/src/web/scrapers/rfc.ts +201 -0
- package/src/web/scrapers/rubygems.ts +103 -0
- package/src/web/scrapers/searchcode.ts +189 -0
- package/src/web/scrapers/sec-edgar.ts +261 -0
- package/src/web/scrapers/semantic-scholar.ts +171 -0
- package/src/web/scrapers/snapcraft.ts +187 -0
- package/src/web/scrapers/sourcegraph.ts +336 -0
- package/src/web/scrapers/spdx.ts +108 -0
- package/src/web/scrapers/spotify.ts +198 -0
- package/src/web/scrapers/stackoverflow.ts +120 -0
- package/src/web/scrapers/terraform.ts +277 -0
- package/src/web/scrapers/tldr.ts +47 -0
- package/src/web/scrapers/twitter.ts +93 -0
- package/src/web/scrapers/types.ts +318 -0
- package/src/web/scrapers/utils.ts +109 -0
- package/src/web/scrapers/vimeo.ts +133 -0
- package/src/web/scrapers/vscode-marketplace.ts +187 -0
- package/src/web/scrapers/w3c.ts +156 -0
- package/src/web/scrapers/wikidata.ts +344 -0
- package/src/web/scrapers/wikipedia.ts +84 -0
- package/src/web/scrapers/youtube.ts +319 -0
- package/src/web/search/index.ts +288 -0
- package/src/web/search/provider.ts +173 -0
- package/src/web/search/providers/anthropic.ts +302 -0
- package/src/web/search/providers/base.ts +71 -0
- package/src/web/search/providers/brave.ts +149 -0
- package/src/web/search/providers/codex.ts +556 -0
- package/src/web/search/providers/exa.ts +193 -0
- package/src/web/search/providers/gemini.ts +455 -0
- package/src/web/search/providers/jina.ts +101 -0
- package/src/web/search/providers/kagi.ts +75 -0
- package/src/web/search/providers/kimi.ts +171 -0
- package/src/web/search/providers/parallel.ts +210 -0
- package/src/web/search/providers/perplexity.ts +575 -0
- package/src/web/search/providers/searxng.ts +309 -0
- package/src/web/search/providers/synthetic.ts +108 -0
- package/src/web/search/providers/tavily.ts +173 -0
- package/src/web/search/providers/utils.ts +128 -0
- package/src/web/search/providers/zai.ts +320 -0
- package/src/web/search/render.ts +299 -0
- package/src/web/search/types.ts +436 -0
- package/src/web/search/utils.ts +17 -0
- package/src/workspace-tree.ts +286 -0
|
@@ -0,0 +1,2756 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive mode for the coding agent.
|
|
3
|
+
* Handles TUI rendering and user interaction, delegating business logic to AgentSession.
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from "node:fs/promises";
|
|
6
|
+
import * as path from "node:path";
|
|
7
|
+
import { type Agent, type AgentMessage, type AgentToolResult, ThinkingLevel } from "@gajae-code/agent-core";
|
|
8
|
+
import type { CompactionOutcome } from "@gajae-code/agent-core/compaction";
|
|
9
|
+
import {
|
|
10
|
+
type AssistantMessage,
|
|
11
|
+
type ImageContent,
|
|
12
|
+
type Message,
|
|
13
|
+
type Model,
|
|
14
|
+
modelsAreEqual,
|
|
15
|
+
type UsageReport,
|
|
16
|
+
} from "@gajae-code/ai";
|
|
17
|
+
import type { Component, EditorTheme, SlashCommand } from "@gajae-code/tui";
|
|
18
|
+
import {
|
|
19
|
+
Container,
|
|
20
|
+
clearRenderCache,
|
|
21
|
+
Loader,
|
|
22
|
+
Markdown,
|
|
23
|
+
ProcessTerminal,
|
|
24
|
+
Spacer,
|
|
25
|
+
Text,
|
|
26
|
+
TUI,
|
|
27
|
+
visibleWidth,
|
|
28
|
+
} from "@gajae-code/tui";
|
|
29
|
+
import { APP_NAME, adjustHsv, getProjectDir, hsvToRgb, isEnoent, logger, postmortem, prompt } from "@gajae-code/utils";
|
|
30
|
+
import chalk from "chalk";
|
|
31
|
+
import { KeybindingsManager } from "../config/keybindings";
|
|
32
|
+
import { isSettingsInitialized, type Settings, settings } from "../config/settings";
|
|
33
|
+
import type {
|
|
34
|
+
ExtensionUIContext,
|
|
35
|
+
ExtensionUIDialogOptions,
|
|
36
|
+
ExtensionWidgetContent,
|
|
37
|
+
ExtensionWidgetOptions,
|
|
38
|
+
} from "../extensibility/extensions";
|
|
39
|
+
import type { CompactOptions } from "../extensibility/extensions/types";
|
|
40
|
+
import { resolveSkillSlashCommands, type Skill } from "../extensibility/skills";
|
|
41
|
+
import { BUILTIN_SLASH_COMMANDS, loadSlashCommands } from "../extensibility/slash-commands";
|
|
42
|
+
import { consumePendingGoalModeRequest } from "../gjc-runtime/goal-mode-request";
|
|
43
|
+
import type { Goal, GoalModeState } from "../goals/state";
|
|
44
|
+
import { resolveLocalUrlToPath } from "../internal-urls";
|
|
45
|
+
import { LSP_STARTUP_EVENT_CHANNEL, type LspStartupEvent } from "../lsp/startup-events";
|
|
46
|
+
import {
|
|
47
|
+
humanizePlanTitle,
|
|
48
|
+
type PlanApprovalDetails,
|
|
49
|
+
renameApprovedPlanFile,
|
|
50
|
+
resolvePlanTitle,
|
|
51
|
+
} from "../plan-mode/approved-plan";
|
|
52
|
+
import planModeApprovedPrompt from "../prompts/system/plan-mode-approved.md" with { type: "text" };
|
|
53
|
+
import planModeCompactInstructionsPrompt from "../prompts/system/plan-mode-compact-instructions.md" with {
|
|
54
|
+
type: "text",
|
|
55
|
+
};
|
|
56
|
+
import type { AgentSession, AgentSessionEvent } from "../session/agent-session";
|
|
57
|
+
import { HistoryStorage } from "../session/history-storage";
|
|
58
|
+
import type { SessionContext, SessionManager } from "../session/session-manager";
|
|
59
|
+
import { getRecentSessions } from "../session/session-manager";
|
|
60
|
+
import { formatDuration } from "../slash-commands/helpers/format";
|
|
61
|
+
import { STTController, type SttState } from "../stt";
|
|
62
|
+
import type { LspStartupServerInfo } from "../tools";
|
|
63
|
+
import { normalizeLocalScheme } from "../tools/path-utils";
|
|
64
|
+
import { type ResolveToolDetails, runResolveInvocation } from "../tools/resolve";
|
|
65
|
+
import { formatPhaseDisplayName } from "../tools/todo-write";
|
|
66
|
+
import { ToolError } from "../tools/tool-errors";
|
|
67
|
+
import type { EventBus } from "../utils/event-bus";
|
|
68
|
+
import { getEditorCommand, openInEditor } from "../utils/external-editor";
|
|
69
|
+
import { getSessionAccentAnsi, getSessionAccentHex } from "../utils/session-color";
|
|
70
|
+
import { popTerminalTitle, pushTerminalTitle, setSessionTerminalTitle } from "../utils/title-generator";
|
|
71
|
+
import type { AssistantMessageComponent } from "./components/assistant-message";
|
|
72
|
+
import type { BashExecutionComponent } from "./components/bash-execution";
|
|
73
|
+
import { CustomEditor } from "./components/custom-editor";
|
|
74
|
+
import { DynamicBorder } from "./components/dynamic-border";
|
|
75
|
+
import type { EvalExecutionComponent } from "./components/eval-execution";
|
|
76
|
+
import type { HookEditorComponent } from "./components/hook-editor";
|
|
77
|
+
import type { HookInputComponent } from "./components/hook-input";
|
|
78
|
+
import type { HookSelectorComponent } from "./components/hook-selector";
|
|
79
|
+
import { StatusLineComponent } from "./components/status-line";
|
|
80
|
+
import type { ToolExecutionHandle } from "./components/tool-execution";
|
|
81
|
+
import { WelcomeComponent, type LspServerInfo as WelcomeLspServerInfo } from "./components/welcome";
|
|
82
|
+
import { BtwController } from "./controllers/btw-controller";
|
|
83
|
+
import { CommandController } from "./controllers/command-controller";
|
|
84
|
+
import { EventController } from "./controllers/event-controller";
|
|
85
|
+
import { ExtensionUiController } from "./controllers/extension-ui-controller";
|
|
86
|
+
import { InputController } from "./controllers/input-controller";
|
|
87
|
+
import { SelectorController } from "./controllers/selector-controller";
|
|
88
|
+
import { SSHCommandController } from "./controllers/ssh-command-controller";
|
|
89
|
+
import { TodoCommandController } from "./controllers/todo-command-controller";
|
|
90
|
+
import {
|
|
91
|
+
consumeLoopLimitIteration,
|
|
92
|
+
createLoopLimitRuntime,
|
|
93
|
+
describeLoopLimit,
|
|
94
|
+
describeLoopLimitRuntime,
|
|
95
|
+
isLoopDurationExpired,
|
|
96
|
+
type LoopLimitRuntime,
|
|
97
|
+
parseLoopLimitArgs,
|
|
98
|
+
} from "./loop-limit";
|
|
99
|
+
import { OAuthManualInputManager } from "./oauth-manual-input";
|
|
100
|
+
import { SessionObserverRegistry } from "./session-observer-registry";
|
|
101
|
+
import { interruptHint } from "./shared";
|
|
102
|
+
import { type ShimmerPalette, shimmerSegments, shimmerText } from "./theme/shimmer";
|
|
103
|
+
import type { Theme } from "./theme/theme";
|
|
104
|
+
import {
|
|
105
|
+
getEditorTheme,
|
|
106
|
+
getMarkdownTheme,
|
|
107
|
+
getSymbolTheme,
|
|
108
|
+
onTerminalAppearanceChange,
|
|
109
|
+
onThemeChange,
|
|
110
|
+
theme,
|
|
111
|
+
} from "./theme/theme";
|
|
112
|
+
import type { CompactionQueuedMessage, InteractiveModeContext, SubmittedUserInput, TodoItem, TodoPhase } from "./types";
|
|
113
|
+
import { UiHelpers } from "./utils/ui-helpers";
|
|
114
|
+
|
|
115
|
+
const INTERACTIVE_ABORT_CLEANUP_TIMEOUT_MS = 5_000;
|
|
116
|
+
|
|
117
|
+
const HINT_SHIMMER_PALETTE: ShimmerPalette = {
|
|
118
|
+
low: "dim",
|
|
119
|
+
mid: "muted",
|
|
120
|
+
high: "borderAccent",
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
function configureDefaultComposerChrome(editor: CustomEditor): void {
|
|
124
|
+
editor.setBorderVisible(false);
|
|
125
|
+
editor.setPromptGutter(`${theme.fg("accent", "›")} `);
|
|
126
|
+
editor.setPaddingX(1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
interface WorkingMessageAccent {
|
|
130
|
+
main: string;
|
|
131
|
+
dim: string;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function renderWorkingMessage(message: string, accent?: WorkingMessageAccent): string {
|
|
135
|
+
const palette = accent
|
|
136
|
+
? ({
|
|
137
|
+
low: "dim",
|
|
138
|
+
mid: { ansi: accent.main },
|
|
139
|
+
high: { ansi: accent.main },
|
|
140
|
+
bold: true,
|
|
141
|
+
} satisfies ShimmerPalette)
|
|
142
|
+
: undefined;
|
|
143
|
+
const hint = interruptHint();
|
|
144
|
+
if (!message.endsWith(hint)) return shimmerText(message, theme, palette);
|
|
145
|
+
const header = message.slice(0, -hint.length);
|
|
146
|
+
const hintPalette = accent
|
|
147
|
+
? ({
|
|
148
|
+
low: "dim",
|
|
149
|
+
mid: { ansi: accent.dim },
|
|
150
|
+
high: { ansi: accent.dim },
|
|
151
|
+
} satisfies ShimmerPalette)
|
|
152
|
+
: HINT_SHIMMER_PALETTE;
|
|
153
|
+
return shimmerSegments(
|
|
154
|
+
[
|
|
155
|
+
{ text: header, palette },
|
|
156
|
+
{ text: hint, palette: hintPalette },
|
|
157
|
+
],
|
|
158
|
+
theme,
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const EDITOR_MAX_HEIGHT_MIN = 6;
|
|
163
|
+
const EDITOR_MAX_HEIGHT_MAX = 18;
|
|
164
|
+
const EDITOR_RESERVED_ROWS = 12;
|
|
165
|
+
const EDITOR_FALLBACK_ROWS = 24;
|
|
166
|
+
|
|
167
|
+
const HUD_NOTE_SUP_DIGITS: Record<string, string> = {
|
|
168
|
+
"0": "\u2070",
|
|
169
|
+
"1": "\u00b9",
|
|
170
|
+
"2": "\u00b2",
|
|
171
|
+
"3": "\u00b3",
|
|
172
|
+
"4": "\u2074",
|
|
173
|
+
"5": "\u2075",
|
|
174
|
+
"6": "\u2076",
|
|
175
|
+
"7": "\u2077",
|
|
176
|
+
"8": "\u2078",
|
|
177
|
+
"9": "\u2079",
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
function formatHudNoteMarker(count: number): string {
|
|
181
|
+
if (count <= 0) return "";
|
|
182
|
+
const sub = String(count)
|
|
183
|
+
.split("")
|
|
184
|
+
.map(d => HUD_NOTE_SUP_DIGITS[d] ?? d)
|
|
185
|
+
.join("");
|
|
186
|
+
return theme.fg("dim", chalk.italic(` \u207a${sub}`));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
type GoalSubcommand = "set" | "show" | "pause" | "resume" | "drop" | "budget";
|
|
190
|
+
|
|
191
|
+
const GOAL_SUBCOMMANDS = new Set<GoalSubcommand>(["set", "show", "pause", "resume", "drop", "budget"]);
|
|
192
|
+
|
|
193
|
+
function parseGoalSubcommand(args: string): { sub: GoalSubcommand | undefined; rest: string } {
|
|
194
|
+
const trimmed = args.trim();
|
|
195
|
+
if (!trimmed) return { sub: undefined, rest: "" };
|
|
196
|
+
const match = /^(\S+)(?:\s+([\s\S]*))?$/.exec(trimmed);
|
|
197
|
+
if (!match) return { sub: undefined, rest: trimmed };
|
|
198
|
+
const first = match[1].toLowerCase();
|
|
199
|
+
if (GOAL_SUBCOMMANDS.has(first as GoalSubcommand)) {
|
|
200
|
+
return { sub: first as GoalSubcommand, rest: match[2]?.trim() ?? "" };
|
|
201
|
+
}
|
|
202
|
+
return { sub: undefined, rest: trimmed };
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** Options for creating an InteractiveMode instance (for future API use) */
|
|
206
|
+
export interface InteractiveModeOptions {
|
|
207
|
+
/** Providers that were migrated during startup */
|
|
208
|
+
migratedProviders?: string[];
|
|
209
|
+
/** Warning message if model fallback occurred */
|
|
210
|
+
modelFallbackMessage?: string;
|
|
211
|
+
/** Initial message to send */
|
|
212
|
+
initialMessage?: string;
|
|
213
|
+
/** Initial images to include with the message */
|
|
214
|
+
initialImages?: ImageContent[];
|
|
215
|
+
/** Additional initial messages to queue */
|
|
216
|
+
initialMessages?: string[];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export class InteractiveMode implements InteractiveModeContext {
|
|
220
|
+
session: AgentSession;
|
|
221
|
+
sessionManager: SessionManager;
|
|
222
|
+
settings: Settings;
|
|
223
|
+
keybindings: KeybindingsManager;
|
|
224
|
+
agent: Agent;
|
|
225
|
+
historyStorage?: HistoryStorage;
|
|
226
|
+
|
|
227
|
+
ui: TUI;
|
|
228
|
+
chatContainer: Container;
|
|
229
|
+
pendingMessagesContainer: Container;
|
|
230
|
+
statusContainer: Container;
|
|
231
|
+
todoContainer: Container;
|
|
232
|
+
btwContainer: Container;
|
|
233
|
+
editor: CustomEditor;
|
|
234
|
+
editorContainer: Container;
|
|
235
|
+
hookWidgetContainerAbove: Container;
|
|
236
|
+
hookWidgetContainerBelow: Container;
|
|
237
|
+
statusLine: StatusLineComponent;
|
|
238
|
+
|
|
239
|
+
isInitialized = false;
|
|
240
|
+
isBackgrounded = false;
|
|
241
|
+
isBashMode = false;
|
|
242
|
+
toolOutputExpanded = false;
|
|
243
|
+
todoExpanded = false;
|
|
244
|
+
planModeEnabled = false;
|
|
245
|
+
planModePaused = false;
|
|
246
|
+
goalModeEnabled = false;
|
|
247
|
+
goalModePaused = false;
|
|
248
|
+
planModePlanFilePath: string | undefined = undefined;
|
|
249
|
+
loopModeEnabled = false;
|
|
250
|
+
loopPrompt: string | undefined = undefined;
|
|
251
|
+
loopLimit: LoopLimitRuntime | undefined = undefined;
|
|
252
|
+
#loopAutoSubmitTimer: NodeJS.Timeout | undefined;
|
|
253
|
+
todoPhases: TodoPhase[] = [];
|
|
254
|
+
hideThinkingBlock = false;
|
|
255
|
+
pendingImages: ImageContent[] = [];
|
|
256
|
+
compactionQueuedMessages: CompactionQueuedMessage[] = [];
|
|
257
|
+
pendingTools = new Map<string, ToolExecutionHandle>();
|
|
258
|
+
pendingBashComponents: BashExecutionComponent[] = [];
|
|
259
|
+
bashComponent: BashExecutionComponent | undefined = undefined;
|
|
260
|
+
pendingPythonComponents: EvalExecutionComponent[] = [];
|
|
261
|
+
pythonComponent: EvalExecutionComponent | undefined = undefined;
|
|
262
|
+
isPythonMode = false;
|
|
263
|
+
streamingComponent: AssistantMessageComponent | undefined = undefined;
|
|
264
|
+
streamingMessage: AssistantMessage | undefined = undefined;
|
|
265
|
+
loadingAnimation: Loader | undefined = undefined;
|
|
266
|
+
autoCompactionLoader: Loader | undefined = undefined;
|
|
267
|
+
retryLoader: Loader | undefined = undefined;
|
|
268
|
+
#pendingWorkingMessage: string | undefined;
|
|
269
|
+
get #defaultWorkingMessage(): string {
|
|
270
|
+
return `Working…${interruptHint()}`;
|
|
271
|
+
}
|
|
272
|
+
autoCompactionEscapeHandler?: () => void;
|
|
273
|
+
retryEscapeHandler?: () => void;
|
|
274
|
+
unsubscribe?: () => void;
|
|
275
|
+
onInputCallback?: (input: SubmittedUserInput) => void;
|
|
276
|
+
optimisticUserMessageSignature: string | undefined = undefined;
|
|
277
|
+
locallySubmittedUserSignatures: Set<string> = new Set();
|
|
278
|
+
#pendingSubmittedInput: SubmittedUserInput | undefined;
|
|
279
|
+
#pendingSubmissionDispose: (() => void) | undefined;
|
|
280
|
+
lastSigintTime = 0;
|
|
281
|
+
lastEscapeTime = 0;
|
|
282
|
+
shutdownRequested = false;
|
|
283
|
+
#isShuttingDown = false;
|
|
284
|
+
hookSelector: HookSelectorComponent | undefined = undefined;
|
|
285
|
+
hookInput: HookInputComponent | undefined = undefined;
|
|
286
|
+
hookEditor: HookEditorComponent | undefined = undefined;
|
|
287
|
+
lastStatusSpacer: Spacer | undefined = undefined;
|
|
288
|
+
lastStatusText: Text | undefined = undefined;
|
|
289
|
+
fileSlashCommands: Set<string> = new Set();
|
|
290
|
+
skillCommands: Map<string, Skill> = new Map();
|
|
291
|
+
oauthManualInput: OAuthManualInputManager = new OAuthManualInputManager();
|
|
292
|
+
|
|
293
|
+
#baseSlashCommands: SlashCommand[] = [];
|
|
294
|
+
#baseReservedSlashCommandNames: Set<string> = new Set();
|
|
295
|
+
#cleanupUnsubscribe?: () => void;
|
|
296
|
+
readonly #version: string;
|
|
297
|
+
readonly #changelogMarkdown: string | undefined;
|
|
298
|
+
#planModePreviousTools: string[] | undefined;
|
|
299
|
+
#goalModePreviousTools: string[] | undefined;
|
|
300
|
+
#goalContinuationTimer: NodeJS.Timeout | undefined;
|
|
301
|
+
#goalTurnHadToolCalls = false;
|
|
302
|
+
#goalContinuationTurnInFlight = false;
|
|
303
|
+
#goalSuppressNextContinuation = false;
|
|
304
|
+
#planModePreviousModelState: { model: Model; thinkingLevel?: ThinkingLevel } | undefined;
|
|
305
|
+
#pendingModelSwitch: { model: Model; thinkingLevel?: ThinkingLevel } | undefined;
|
|
306
|
+
#planModeHasEntered = false;
|
|
307
|
+
#planReviewContainer: Container | undefined;
|
|
308
|
+
readonly lspServers: LspStartupServerInfo[] | undefined = undefined;
|
|
309
|
+
mcpManager?: import("../runtime-mcp").MCPManager;
|
|
310
|
+
readonly #toolUiContextSetter: (uiContext: ExtensionUIContext, hasUI: boolean) => void;
|
|
311
|
+
|
|
312
|
+
readonly #btwController: BtwController;
|
|
313
|
+
readonly #commandController: CommandController;
|
|
314
|
+
readonly #todoCommandController: TodoCommandController;
|
|
315
|
+
readonly #eventController: EventController;
|
|
316
|
+
readonly #extensionUiController: ExtensionUiController;
|
|
317
|
+
readonly #inputController: InputController;
|
|
318
|
+
readonly #selectorController: SelectorController;
|
|
319
|
+
readonly #uiHelpers: UiHelpers;
|
|
320
|
+
#sttController: STTController | undefined;
|
|
321
|
+
#voiceAnimationInterval: NodeJS.Timeout | undefined;
|
|
322
|
+
#voiceHue = 0;
|
|
323
|
+
#voicePreviousShowHardwareCursor: boolean | null = null;
|
|
324
|
+
#voicePreviousUseTerminalCursor: boolean | null = null;
|
|
325
|
+
#resizeHandler?: () => void;
|
|
326
|
+
#observerRegistry: SessionObserverRegistry;
|
|
327
|
+
#eventBus?: EventBus;
|
|
328
|
+
#eventBusUnsubscribers: Array<() => void> = [];
|
|
329
|
+
#welcomeComponent?: WelcomeComponent;
|
|
330
|
+
|
|
331
|
+
constructor(
|
|
332
|
+
session: AgentSession,
|
|
333
|
+
version: string,
|
|
334
|
+
changelogMarkdown: string | undefined = undefined,
|
|
335
|
+
setToolUIContext: (uiContext: ExtensionUIContext, hasUI: boolean) => void = () => {},
|
|
336
|
+
lspServers: LspStartupServerInfo[] | undefined = undefined,
|
|
337
|
+
mcpManager?: import("../runtime-mcp").MCPManager,
|
|
338
|
+
eventBus?: EventBus,
|
|
339
|
+
) {
|
|
340
|
+
this.session = session;
|
|
341
|
+
this.sessionManager = session.sessionManager;
|
|
342
|
+
this.settings = session.settings;
|
|
343
|
+
this.keybindings = KeybindingsManager.inMemory();
|
|
344
|
+
this.agent = session.agent;
|
|
345
|
+
this.#version = version;
|
|
346
|
+
this.#changelogMarkdown = changelogMarkdown;
|
|
347
|
+
this.#toolUiContextSetter = setToolUIContext;
|
|
348
|
+
this.lspServers = lspServers;
|
|
349
|
+
this.mcpManager = mcpManager;
|
|
350
|
+
this.#eventBus = eventBus;
|
|
351
|
+
if (eventBus) {
|
|
352
|
+
this.#eventBusUnsubscribers.push(
|
|
353
|
+
eventBus.on(LSP_STARTUP_EVENT_CHANNEL, data => {
|
|
354
|
+
this.#handleLspStartupEvent(data as LspStartupEvent);
|
|
355
|
+
}),
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
this.ui = new TUI(new ProcessTerminal(), settings.get("showHardwareCursor"));
|
|
360
|
+
this.ui.setClearOnShrink(settings.get("clearOnShrink"));
|
|
361
|
+
this.chatContainer = new Container();
|
|
362
|
+
this.pendingMessagesContainer = new Container();
|
|
363
|
+
this.statusContainer = new Container();
|
|
364
|
+
this.todoContainer = new Container();
|
|
365
|
+
this.btwContainer = new Container();
|
|
366
|
+
this.editor = new CustomEditor(getEditorTheme());
|
|
367
|
+
configureDefaultComposerChrome(this.editor);
|
|
368
|
+
this.editor.setUseTerminalCursor(this.ui.getShowHardwareCursor());
|
|
369
|
+
this.editor.setAutocompleteMaxVisible(settings.get("autocompleteMaxVisible"));
|
|
370
|
+
this.editor.onAutocompleteCancel = () => {
|
|
371
|
+
this.ui.requestRender(true);
|
|
372
|
+
};
|
|
373
|
+
this.editor.onAutocompleteUpdate = () => {
|
|
374
|
+
this.ui.requestRender();
|
|
375
|
+
};
|
|
376
|
+
this.#syncEditorMaxHeight();
|
|
377
|
+
this.#resizeHandler = () => {
|
|
378
|
+
this.#syncEditorMaxHeight();
|
|
379
|
+
this.updateEditorTopBorder();
|
|
380
|
+
};
|
|
381
|
+
process.stdout.on("resize", this.#resizeHandler);
|
|
382
|
+
try {
|
|
383
|
+
this.historyStorage = HistoryStorage.open();
|
|
384
|
+
this.editor.setHistoryStorage(this.historyStorage);
|
|
385
|
+
} catch (error) {
|
|
386
|
+
logger.warn("History storage unavailable", { error: String(error) });
|
|
387
|
+
}
|
|
388
|
+
this.hookWidgetContainerAbove = new Container();
|
|
389
|
+
this.hookWidgetContainerAbove.addChild(new Spacer(1));
|
|
390
|
+
this.hookWidgetContainerBelow = new Container();
|
|
391
|
+
this.editorContainer = new Container();
|
|
392
|
+
this.editorContainer.addChild(this.editor);
|
|
393
|
+
this.statusLine = new StatusLineComponent(session);
|
|
394
|
+
this.statusLine.setAutoCompactEnabled(session.autoCompactionEnabled);
|
|
395
|
+
|
|
396
|
+
this.hideThinkingBlock = settings.get("hideThinkingBlock");
|
|
397
|
+
|
|
398
|
+
const builtinCommandNames = new Set(BUILTIN_SLASH_COMMANDS.map(c => c.name));
|
|
399
|
+
const hookCommands: SlashCommand[] = (
|
|
400
|
+
this.session.extensionRunner?.getRegisteredCommands(builtinCommandNames) ?? []
|
|
401
|
+
).map(cmd => ({
|
|
402
|
+
name: cmd.name,
|
|
403
|
+
description: cmd.description ?? "(hook command)",
|
|
404
|
+
getArgumentCompletions: cmd.getArgumentCompletions,
|
|
405
|
+
}));
|
|
406
|
+
|
|
407
|
+
// Convert custom commands (TypeScript) to SlashCommand format
|
|
408
|
+
const customCommands: SlashCommand[] = this.session.customCommands.map(loaded => ({
|
|
409
|
+
name: loaded.command.name,
|
|
410
|
+
description: `${loaded.command.description} (${loaded.source})`,
|
|
411
|
+
}));
|
|
412
|
+
|
|
413
|
+
this.#baseSlashCommands = [...BUILTIN_SLASH_COMMANDS, ...hookCommands, ...customCommands];
|
|
414
|
+
this.#baseReservedSlashCommandNames = new Set(this.#baseSlashCommands.map(command => command.name));
|
|
415
|
+
this.#rebuildSkillSlashCommands();
|
|
416
|
+
|
|
417
|
+
this.#uiHelpers = new UiHelpers(this);
|
|
418
|
+
this.#btwController = new BtwController(this);
|
|
419
|
+
this.#extensionUiController = new ExtensionUiController(this);
|
|
420
|
+
this.#eventController = new EventController(this);
|
|
421
|
+
this.#commandController = new CommandController(this);
|
|
422
|
+
this.#todoCommandController = new TodoCommandController(this);
|
|
423
|
+
this.#selectorController = new SelectorController(this);
|
|
424
|
+
this.#inputController = new InputController(this);
|
|
425
|
+
this.#observerRegistry = new SessionObserverRegistry();
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
async init(): Promise<void> {
|
|
429
|
+
if (this.isInitialized) return;
|
|
430
|
+
|
|
431
|
+
this.keybindings = logger.time("InteractiveMode.init:keybindings", () => KeybindingsManager.create());
|
|
432
|
+
|
|
433
|
+
// Register session manager flush for signal handlers (SIGINT, SIGTERM, SIGHUP)
|
|
434
|
+
this.#cleanupUnsubscribe = postmortem.register("session-manager-flush", () => this.sessionManager.flush());
|
|
435
|
+
|
|
436
|
+
await logger.time(
|
|
437
|
+
"InteractiveMode.init:slashCommands",
|
|
438
|
+
this.refreshSlashCommandState.bind(this),
|
|
439
|
+
getProjectDir(),
|
|
440
|
+
);
|
|
441
|
+
|
|
442
|
+
// Get current model info for welcome screen
|
|
443
|
+
const modelName = this.session.model?.name ?? "Unknown";
|
|
444
|
+
const providerName = this.session.model?.provider ?? "Unknown";
|
|
445
|
+
|
|
446
|
+
// Get recent sessions
|
|
447
|
+
const recentSessions = await logger.time("InteractiveMode.init:recentSessions", () =>
|
|
448
|
+
getRecentSessions(this.sessionManager.getSessionDir()).then(sessions =>
|
|
449
|
+
sessions.map(s => ({
|
|
450
|
+
name: s.name,
|
|
451
|
+
timeAgo: s.timeAgo,
|
|
452
|
+
})),
|
|
453
|
+
),
|
|
454
|
+
);
|
|
455
|
+
|
|
456
|
+
const startupQuiet = settings.get("startup.quiet");
|
|
457
|
+
this.#welcomeComponent = undefined;
|
|
458
|
+
|
|
459
|
+
for (const warning of this.session.configWarnings) {
|
|
460
|
+
this.ui.addChild(new Text(theme.fg("warning", `Warning: ${warning}`), 1, 0));
|
|
461
|
+
this.ui.addChild(new Spacer(1));
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if (!startupQuiet) {
|
|
465
|
+
// Add welcome header
|
|
466
|
+
this.#welcomeComponent = new WelcomeComponent(
|
|
467
|
+
this.#version,
|
|
468
|
+
modelName,
|
|
469
|
+
providerName,
|
|
470
|
+
recentSessions,
|
|
471
|
+
this.#getWelcomeLspServers(),
|
|
472
|
+
);
|
|
473
|
+
|
|
474
|
+
// Setup UI layout
|
|
475
|
+
this.ui.addChild(new Spacer(1));
|
|
476
|
+
this.ui.addChild(this.#welcomeComponent);
|
|
477
|
+
this.ui.addChild(new Spacer(1));
|
|
478
|
+
this.#welcomeComponent.playIntro(() => this.ui.requestRender());
|
|
479
|
+
|
|
480
|
+
// Add changelog if provided
|
|
481
|
+
if (this.#changelogMarkdown) {
|
|
482
|
+
this.ui.addChild(new DynamicBorder());
|
|
483
|
+
if (settings.get("collapseChangelog")) {
|
|
484
|
+
const versionMatch = this.#changelogMarkdown.match(/##\s+\[?(\d+\.\d+\.\d+)\]?/);
|
|
485
|
+
const latestVersion = versionMatch ? versionMatch[1] : this.#version;
|
|
486
|
+
const condensedText = `Updated to v${latestVersion}. Use ${theme.bold("/changelog")} to view full changelog.`;
|
|
487
|
+
this.ui.addChild(new Text(condensedText, 1, 0));
|
|
488
|
+
} else {
|
|
489
|
+
this.ui.addChild(new Text(theme.bold(theme.fg("accent", "What's New")), 1, 0));
|
|
490
|
+
this.ui.addChild(new Spacer(1));
|
|
491
|
+
this.ui.addChild(new Markdown(this.#changelogMarkdown.trim(), 1, 0, getMarkdownTheme()));
|
|
492
|
+
this.ui.addChild(new Spacer(1));
|
|
493
|
+
}
|
|
494
|
+
this.ui.addChild(new DynamicBorder());
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
this.ui.addChild(this.chatContainer);
|
|
499
|
+
this.ui.addChild(this.pendingMessagesContainer);
|
|
500
|
+
this.ui.addChild(this.statusContainer);
|
|
501
|
+
this.ui.addChild(this.todoContainer);
|
|
502
|
+
this.ui.addChild(this.btwContainer);
|
|
503
|
+
this.ui.addChild(this.statusLine); // Main status rail + hook statuses; composer stays borderless.
|
|
504
|
+
this.ui.addChild(this.hookWidgetContainerAbove);
|
|
505
|
+
this.ui.addChild(this.editorContainer);
|
|
506
|
+
this.ui.addChild(this.hookWidgetContainerBelow);
|
|
507
|
+
this.ui.setFocus(this.editor);
|
|
508
|
+
|
|
509
|
+
this.#inputController.setupKeyHandlers();
|
|
510
|
+
this.#inputController.setupEditorSubmitHandler();
|
|
511
|
+
|
|
512
|
+
// Wire observer registry to EventBus
|
|
513
|
+
if (this.#eventBus) {
|
|
514
|
+
this.#observerRegistry.subscribeToEventBus(this.#eventBus);
|
|
515
|
+
}
|
|
516
|
+
this.#observerRegistry.setMainSession(this.sessionManager.getSessionFile() ?? undefined);
|
|
517
|
+
this.#observerRegistry.onChange(() => {
|
|
518
|
+
this.statusLine.setSubagentCount(this.#observerRegistry.getActiveSubagentCount());
|
|
519
|
+
this.ui.requestRender();
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
// Load initial todos
|
|
523
|
+
await this.#loadTodoList();
|
|
524
|
+
|
|
525
|
+
// Start the UI
|
|
526
|
+
this.ui.start();
|
|
527
|
+
pushTerminalTitle();
|
|
528
|
+
setSessionTerminalTitle(this.sessionManager.getSessionName(), this.sessionManager.getCwd());
|
|
529
|
+
this.updateEditorBorderColor();
|
|
530
|
+
this.#syncEditorMaxHeight();
|
|
531
|
+
this.isInitialized = true;
|
|
532
|
+
this.ui.requestRender(true);
|
|
533
|
+
|
|
534
|
+
// Initialize hooks with TUI-based UI context
|
|
535
|
+
await this.initHooksAndCustomTools();
|
|
536
|
+
|
|
537
|
+
// Restore mode from session (e.g. plan mode on resume)
|
|
538
|
+
await this.#restoreModeFromSession();
|
|
539
|
+
|
|
540
|
+
// Restore unsent editor draft from previous session shutdown (Ctrl+D).
|
|
541
|
+
// One-shot: consumeDraft removes the sidecar after read so the next
|
|
542
|
+
// resume does not re-restore the same text.
|
|
543
|
+
try {
|
|
544
|
+
const draft = await this.sessionManager.consumeDraft();
|
|
545
|
+
if (draft && !this.editor.getText()) {
|
|
546
|
+
this.editor.setText(draft);
|
|
547
|
+
this.updateEditorBorderColor();
|
|
548
|
+
this.ui.requestRender();
|
|
549
|
+
}
|
|
550
|
+
} catch (err) {
|
|
551
|
+
logger.warn("Failed to restore session draft", { error: String(err) });
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// Subscribe to agent events
|
|
555
|
+
this.#subscribeToAgent();
|
|
556
|
+
|
|
557
|
+
this.#eventBusUnsubscribers.push(
|
|
558
|
+
this.session.subscribe(event => {
|
|
559
|
+
void this.#handleGoalSessionEvent(event);
|
|
560
|
+
}),
|
|
561
|
+
);
|
|
562
|
+
// Set up theme file watcher
|
|
563
|
+
onThemeChange(() => {
|
|
564
|
+
clearRenderCache();
|
|
565
|
+
configureDefaultComposerChrome(this.editor);
|
|
566
|
+
this.ui.invalidate();
|
|
567
|
+
this.updateEditorBorderColor();
|
|
568
|
+
this.ui.requestRender();
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
// Subscribe to terminal dark/light appearance changes.
|
|
572
|
+
// The terminal queries background color via OSC 11 at startup and on
|
|
573
|
+
// Mode 2031 notifications, computing luminance to detect dark/light.
|
|
574
|
+
this.ui.terminal.onAppearanceChange(mode => {
|
|
575
|
+
onTerminalAppearanceChange(mode);
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
// Set up git branch watcher
|
|
579
|
+
this.statusLine.watchBranch(() => {
|
|
580
|
+
this.updateEditorTopBorder();
|
|
581
|
+
this.ui.requestRender();
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
// Initial top border update
|
|
585
|
+
this.updateEditorTopBorder();
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/** Reload slash commands and autocomplete for the provided working directory. */
|
|
589
|
+
async refreshSlashCommandState(cwd?: string): Promise<void> {
|
|
590
|
+
const basePath = cwd ?? this.sessionManager.getCwd();
|
|
591
|
+
const fileCommands = await loadSlashCommands({ cwd: basePath });
|
|
592
|
+
const fileCommandNames = new Set(fileCommands.map(cmd => cmd.name));
|
|
593
|
+
this.fileSlashCommands = fileCommandNames;
|
|
594
|
+
const fileSlashCommands: SlashCommand[] = fileCommands.map(cmd => ({
|
|
595
|
+
name: cmd.name,
|
|
596
|
+
description: cmd.description,
|
|
597
|
+
}));
|
|
598
|
+
const skillCommands = this.#rebuildSkillSlashCommands(fileCommandNames);
|
|
599
|
+
const slashCommands = [...this.#baseSlashCommands, ...skillCommands];
|
|
600
|
+
const autocompleteProvider = this.#inputController.createAutocompleteProvider(
|
|
601
|
+
[...slashCommands, ...fileSlashCommands],
|
|
602
|
+
basePath,
|
|
603
|
+
);
|
|
604
|
+
this.editor.setAutocompleteProvider(autocompleteProvider);
|
|
605
|
+
this.session.setSlashCommands(fileCommands);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
#rebuildSkillSlashCommands(fileCommandNames: ReadonlySet<string> = new Set()): SlashCommand[] {
|
|
609
|
+
this.skillCommands.clear();
|
|
610
|
+
if (!settings.get("skills.enableSkillCommands")) {
|
|
611
|
+
return [];
|
|
612
|
+
}
|
|
613
|
+
const reservedDirectCommandNames = new Set([
|
|
614
|
+
...this.#baseReservedSlashCommandNames,
|
|
615
|
+
...Array.from(fileCommandNames),
|
|
616
|
+
]);
|
|
617
|
+
const resolvedCommands = resolveSkillSlashCommands(this.session.skills, reservedDirectCommandNames);
|
|
618
|
+
for (const command of resolvedCommands) {
|
|
619
|
+
this.skillCommands.set(command.name, command.skill);
|
|
620
|
+
}
|
|
621
|
+
return resolvedCommands.map(command => ({ name: command.name, description: command.description }));
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
async getUserInput(): Promise<SubmittedUserInput> {
|
|
625
|
+
if (this.session.getGoalModeState()?.mode === "exiting") {
|
|
626
|
+
await this.#exitGoalMode({ reason: "completed", silent: true });
|
|
627
|
+
}
|
|
628
|
+
const { promise, resolve } = Promise.withResolvers<SubmittedUserInput>();
|
|
629
|
+
this.onInputCallback = input => {
|
|
630
|
+
this.onInputCallback = undefined;
|
|
631
|
+
resolve(input);
|
|
632
|
+
};
|
|
633
|
+
this.#scheduleLoopAutoSubmit();
|
|
634
|
+
this.#scheduleGoalContinuation();
|
|
635
|
+
return promise;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
#scheduleLoopAutoSubmit(): void {
|
|
639
|
+
this.#cancelLoopAutoSubmit();
|
|
640
|
+
if (!this.loopModeEnabled || !this.loopPrompt) return;
|
|
641
|
+
const prompt = this.loopPrompt;
|
|
642
|
+
const loopAction = settings.get("loop.mode");
|
|
643
|
+
this.#deferLoopAutoSubmit(() => {
|
|
644
|
+
void this.#runLoopIteration(loopAction, prompt);
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
#deferLoopAutoSubmit(callback: () => void): void {
|
|
649
|
+
// Brief delay so the user has a chance to press Esc between iterations.
|
|
650
|
+
this.#loopAutoSubmitTimer = setTimeout(() => {
|
|
651
|
+
this.#loopAutoSubmitTimer = undefined;
|
|
652
|
+
if (!this.loopModeEnabled || !this.onInputCallback) return;
|
|
653
|
+
callback();
|
|
654
|
+
}, 800);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
#cancelLoopAutoSubmit(): void {
|
|
658
|
+
if (this.#loopAutoSubmitTimer) {
|
|
659
|
+
clearTimeout(this.#loopAutoSubmitTimer);
|
|
660
|
+
this.#loopAutoSubmitTimer = undefined;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
#scheduleGoalContinuation(): void {
|
|
665
|
+
this.#cancelGoalContinuation();
|
|
666
|
+
if (this.loopModeEnabled) return;
|
|
667
|
+
if (!this.onInputCallback) return;
|
|
668
|
+
if (!this.session.settings.get("goal.continuationModes").includes("interactive")) return;
|
|
669
|
+
if (this.planModeEnabled || this.planModePaused) return;
|
|
670
|
+
if (!this.goalModeEnabled || this.goalModePaused) return;
|
|
671
|
+
if (this.#goalSuppressNextContinuation) return;
|
|
672
|
+
if (this.#pendingSubmittedInput) return;
|
|
673
|
+
if (this.editor.getText().trim().length > 0) return;
|
|
674
|
+
if ((this.pendingImages?.length ?? 0) > 0) return;
|
|
675
|
+
const state = this.session.getGoalModeState();
|
|
676
|
+
if (!state?.enabled || state.goal.status !== "active") return;
|
|
677
|
+
const prompt = this.session.goalRuntime.buildContinuationPrompt();
|
|
678
|
+
if (!prompt) return;
|
|
679
|
+
this.#goalContinuationTimer = setTimeout(() => {
|
|
680
|
+
this.#goalContinuationTimer = undefined;
|
|
681
|
+
if (!this.onInputCallback) return;
|
|
682
|
+
if (!this.goalModeEnabled || this.goalModePaused) return;
|
|
683
|
+
if (this.#pendingSubmittedInput) return;
|
|
684
|
+
if (this.editor.getText().trim().length > 0) return;
|
|
685
|
+
if ((this.pendingImages?.length ?? 0) > 0) return;
|
|
686
|
+
const latestState = this.session.getGoalModeState();
|
|
687
|
+
if (!latestState?.enabled || latestState.goal.status !== "active") return;
|
|
688
|
+
this.#goalContinuationTurnInFlight = true;
|
|
689
|
+
this.onInputCallback(
|
|
690
|
+
this.startPendingSubmission({
|
|
691
|
+
text: prompt,
|
|
692
|
+
customType: "goal-continuation",
|
|
693
|
+
display: false,
|
|
694
|
+
}),
|
|
695
|
+
);
|
|
696
|
+
}, 800);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
#cancelGoalContinuation(): void {
|
|
700
|
+
if (this.#goalContinuationTimer) {
|
|
701
|
+
clearTimeout(this.#goalContinuationTimer);
|
|
702
|
+
this.#goalContinuationTimer = undefined;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
#isLoopAutoSubmitBlocked(): boolean {
|
|
707
|
+
return this.session.isStreaming || this.session.isCompacting || this.session.hasPostPromptWork;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
#submitLoopPromptWhenReady(prompt: string): void {
|
|
711
|
+
if (!this.loopModeEnabled || this.loopPrompt !== prompt || !this.onInputCallback) return;
|
|
712
|
+
if (isLoopDurationExpired(this.loopLimit)) {
|
|
713
|
+
this.disableLoopMode("Loop time limit reached. Loop mode disabled.");
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
if (this.#isLoopAutoSubmitBlocked()) {
|
|
717
|
+
this.#deferLoopAutoSubmit(() => this.#submitLoopPromptWhenReady(prompt));
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
this.onInputCallback(this.startPendingSubmission({ text: prompt }));
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
async #runLoopIteration(action: "prompt" | "compact" | "reset", prompt: string): Promise<void> {
|
|
724
|
+
if (!this.loopModeEnabled || this.loopPrompt !== prompt || !this.onInputCallback) return;
|
|
725
|
+
if (this.#isLoopAutoSubmitBlocked()) {
|
|
726
|
+
this.#deferLoopAutoSubmit(() => {
|
|
727
|
+
void this.#runLoopIteration(action, prompt);
|
|
728
|
+
});
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
if (!consumeLoopLimitIteration(this.loopLimit)) {
|
|
733
|
+
this.disableLoopMode("Loop limit reached. Loop mode disabled.");
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
if (action === "compact") {
|
|
738
|
+
await this.handleCompactCommand();
|
|
739
|
+
} else if (action === "reset") {
|
|
740
|
+
await this.handleClearCommand();
|
|
741
|
+
}
|
|
742
|
+
this.#submitLoopPromptWhenReady(prompt);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
disableLoopMode(message = "Loop mode disabled."): void {
|
|
746
|
+
const wasEnabled = this.loopModeEnabled;
|
|
747
|
+
this.loopModeEnabled = false;
|
|
748
|
+
this.loopPrompt = undefined;
|
|
749
|
+
this.loopLimit = undefined;
|
|
750
|
+
this.#cancelLoopAutoSubmit();
|
|
751
|
+
this.statusLine.setLoopModeStatus(undefined);
|
|
752
|
+
this.updateEditorTopBorder();
|
|
753
|
+
this.ui.requestRender();
|
|
754
|
+
if (wasEnabled) {
|
|
755
|
+
this.showStatus(message);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Pause the loop without exiting it: drops the captured prompt and any
|
|
761
|
+
* pending auto-resubmit. Loop mode stays enabled — the next prompt the
|
|
762
|
+
* user submits becomes the new loop prompt and resumes iteration.
|
|
763
|
+
*/
|
|
764
|
+
pauseLoop(): void {
|
|
765
|
+
this.loopPrompt = undefined;
|
|
766
|
+
this.#cancelLoopAutoSubmit();
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
async handleLoopCommand(args = ""): Promise<void> {
|
|
770
|
+
if (this.loopModeEnabled) {
|
|
771
|
+
this.disableLoopMode();
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
const parsedLimit = parseLoopLimitArgs(args);
|
|
775
|
+
if (typeof parsedLimit === "string") {
|
|
776
|
+
this.showError(parsedLimit);
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
this.loopModeEnabled = true;
|
|
780
|
+
this.loopPrompt = undefined;
|
|
781
|
+
this.loopLimit = createLoopLimitRuntime(parsedLimit);
|
|
782
|
+
this.statusLine.setLoopModeStatus({ enabled: true });
|
|
783
|
+
this.updateEditorTopBorder();
|
|
784
|
+
this.ui.requestRender();
|
|
785
|
+
const limitSuffix = parsedLimit ? ` Limited to ${describeLoopLimit(parsedLimit)}.` : "";
|
|
786
|
+
const remainingSuffix = this.loopLimit ? ` ${describeLoopLimitRuntime(this.loopLimit)}.` : "";
|
|
787
|
+
this.showStatus(
|
|
788
|
+
`Loop mode enabled.${limitSuffix}${remainingSuffix} Your next prompt will repeat after each turn. Esc cancels the current iteration; /loop again to disable.`,
|
|
789
|
+
);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
recordLocalSubmission(text: string, imageCount = 0): () => void {
|
|
793
|
+
if (this.isKnownSlashCommand(text)) {
|
|
794
|
+
return () => {};
|
|
795
|
+
}
|
|
796
|
+
const signature = `${text}\u0000${imageCount}`;
|
|
797
|
+
this.locallySubmittedUserSignatures.add(signature);
|
|
798
|
+
let disposed = false;
|
|
799
|
+
return () => {
|
|
800
|
+
if (disposed) return;
|
|
801
|
+
disposed = true;
|
|
802
|
+
this.locallySubmittedUserSignatures.delete(signature);
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
async withLocalSubmission<T>(text: string, fn: () => Promise<T>, options?: { imageCount?: number }): Promise<T> {
|
|
807
|
+
const dispose = this.recordLocalSubmission(text, options?.imageCount ?? 0);
|
|
808
|
+
try {
|
|
809
|
+
return await fn();
|
|
810
|
+
} catch (err) {
|
|
811
|
+
dispose();
|
|
812
|
+
throw err;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
startPendingSubmission(input: {
|
|
817
|
+
text: string;
|
|
818
|
+
images?: ImageContent[];
|
|
819
|
+
customType?: string;
|
|
820
|
+
display?: boolean;
|
|
821
|
+
}): SubmittedUserInput {
|
|
822
|
+
const submission: SubmittedUserInput = {
|
|
823
|
+
text: input.text,
|
|
824
|
+
images: input.images,
|
|
825
|
+
customType: input.customType,
|
|
826
|
+
display: input.display,
|
|
827
|
+
cancelled: false,
|
|
828
|
+
started: false,
|
|
829
|
+
};
|
|
830
|
+
this.#pendingSubmittedInput = submission;
|
|
831
|
+
if (!submission.customType) {
|
|
832
|
+
this.#resetGoalContinuationSuppression();
|
|
833
|
+
const imageCount = submission.images?.length ?? 0;
|
|
834
|
+
this.optimisticUserMessageSignature = `${submission.text}\u0000${imageCount}`;
|
|
835
|
+
this.#pendingSubmissionDispose = this.recordLocalSubmission(submission.text, imageCount);
|
|
836
|
+
this.addMessageToChat({
|
|
837
|
+
role: "user",
|
|
838
|
+
content: [{ type: "text", text: submission.text }, ...(submission.images ?? [])],
|
|
839
|
+
attribution: "user",
|
|
840
|
+
timestamp: Date.now(),
|
|
841
|
+
});
|
|
842
|
+
} else {
|
|
843
|
+
this.optimisticUserMessageSignature = undefined;
|
|
844
|
+
this.#pendingSubmissionDispose = undefined;
|
|
845
|
+
}
|
|
846
|
+
this.editor.setText("");
|
|
847
|
+
this.ensureLoadingAnimation();
|
|
848
|
+
this.ui.requestRender();
|
|
849
|
+
return submission;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
cancelPendingSubmission(): boolean {
|
|
853
|
+
const submission = this.#pendingSubmittedInput;
|
|
854
|
+
if (!submission || submission.started) {
|
|
855
|
+
return false;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
submission.cancelled = true;
|
|
859
|
+
this.#pendingSubmittedInput = undefined;
|
|
860
|
+
this.optimisticUserMessageSignature = undefined;
|
|
861
|
+
this.#pendingSubmissionDispose?.();
|
|
862
|
+
this.#pendingSubmissionDispose = undefined;
|
|
863
|
+
this.#pendingWorkingMessage = undefined;
|
|
864
|
+
if (submission.customType === "goal-continuation") {
|
|
865
|
+
this.#goalContinuationTurnInFlight = false;
|
|
866
|
+
}
|
|
867
|
+
if (this.loadingAnimation) {
|
|
868
|
+
this.loadingAnimation.stop();
|
|
869
|
+
this.loadingAnimation = undefined;
|
|
870
|
+
this.statusContainer.clear();
|
|
871
|
+
}
|
|
872
|
+
if (!submission.customType) {
|
|
873
|
+
this.pendingImages = submission.images ? [...submission.images] : [];
|
|
874
|
+
this.rebuildChatFromMessages();
|
|
875
|
+
this.editor.setText(submission.text);
|
|
876
|
+
}
|
|
877
|
+
this.updateEditorBorderColor();
|
|
878
|
+
this.ui.requestRender();
|
|
879
|
+
return true;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
markPendingSubmissionStarted(input: SubmittedUserInput): boolean {
|
|
883
|
+
if (this.#pendingSubmittedInput !== input || input.cancelled) {
|
|
884
|
+
return false;
|
|
885
|
+
}
|
|
886
|
+
input.started = true;
|
|
887
|
+
return true;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
finishPendingSubmission(input: SubmittedUserInput): void {
|
|
891
|
+
const wasPendingSubmission = this.#pendingSubmittedInput === input;
|
|
892
|
+
const pendingSubmissionDispose = this.#pendingSubmissionDispose;
|
|
893
|
+
if (wasPendingSubmission) {
|
|
894
|
+
this.#pendingSubmittedInput = undefined;
|
|
895
|
+
this.#pendingSubmissionDispose = undefined;
|
|
896
|
+
}
|
|
897
|
+
if (input.customType === "goal-continuation") {
|
|
898
|
+
this.#goalContinuationTurnInFlight = false;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
if (wasPendingSubmission && !this.session.isStreaming && !this.streamingComponent) {
|
|
902
|
+
this.optimisticUserMessageSignature = undefined;
|
|
903
|
+
pendingSubmissionDispose?.();
|
|
904
|
+
this.#pendingWorkingMessage = undefined;
|
|
905
|
+
if (this.loadingAnimation) {
|
|
906
|
+
this.loadingAnimation.stop();
|
|
907
|
+
this.loadingAnimation = undefined;
|
|
908
|
+
this.statusContainer.clear();
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
#computeEditorMaxHeight(): number {
|
|
914
|
+
const rows = this.ui.terminal.rows;
|
|
915
|
+
const terminalRows = Number.isFinite(rows) && rows > 0 ? rows : EDITOR_FALLBACK_ROWS;
|
|
916
|
+
const maxHeight = terminalRows - EDITOR_RESERVED_ROWS;
|
|
917
|
+
return Math.max(EDITOR_MAX_HEIGHT_MIN, Math.min(EDITOR_MAX_HEIGHT_MAX, maxHeight));
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
#syncEditorMaxHeight(): void {
|
|
921
|
+
this.editor.setMaxHeight(this.#computeEditorMaxHeight());
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
updateEditorBorderColor(): void {
|
|
925
|
+
if (this.isBashMode) {
|
|
926
|
+
this.editor.borderColor = theme.getBashModeBorderColor();
|
|
927
|
+
} else if (this.isPythonMode) {
|
|
928
|
+
this.editor.borderColor = theme.getPythonModeBorderColor();
|
|
929
|
+
} else {
|
|
930
|
+
const accentEnabled = !isSettingsInitialized() || settings.get("statusLine.sessionAccent") !== false;
|
|
931
|
+
const sessionName = accentEnabled ? this.sessionManager.getSessionName() : undefined;
|
|
932
|
+
const hex = sessionName ? getSessionAccentHex(sessionName) : undefined;
|
|
933
|
+
const ansi = getSessionAccentAnsi(hex);
|
|
934
|
+
if (ansi) {
|
|
935
|
+
this.editor.borderColor = (str: string) => `${ansi}${str}\x1b[39m`;
|
|
936
|
+
} else {
|
|
937
|
+
const level = this.session.thinkingLevel ?? ThinkingLevel.Off;
|
|
938
|
+
this.editor.borderColor = theme.getThinkingBorderColor(level);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
this.updateEditorTopBorder();
|
|
942
|
+
this.ui.requestRender();
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
updateEditorTopBorder(): void {
|
|
946
|
+
// The opencode-style composer is intentionally borderless. Keep status-line
|
|
947
|
+
// rendering out of the input area so the prompt remains a simple gutter + body.
|
|
948
|
+
this.editor.setTopBorder(undefined);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
rebuildChatFromMessages(): void {
|
|
952
|
+
this.chatContainer.clear();
|
|
953
|
+
const context = this.session.buildDisplaySessionContext();
|
|
954
|
+
this.renderSessionContext(context);
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
#formatTodoLine(todo: TodoItem, prefix: string): string {
|
|
958
|
+
const checkbox = theme.checkbox;
|
|
959
|
+
const marker = formatHudNoteMarker(todo.notes?.length ?? 0);
|
|
960
|
+
switch (todo.status) {
|
|
961
|
+
case "completed":
|
|
962
|
+
return theme.fg("success", `${prefix}${checkbox.checked} ${chalk.strikethrough(todo.content)}`) + marker;
|
|
963
|
+
case "in_progress":
|
|
964
|
+
return theme.fg("accent", `${prefix}${checkbox.unchecked} ${todo.content}`) + marker;
|
|
965
|
+
case "abandoned":
|
|
966
|
+
return theme.fg("error", `${prefix}${checkbox.unchecked} ${chalk.strikethrough(todo.content)}`) + marker;
|
|
967
|
+
default:
|
|
968
|
+
return theme.fg("dim", `${prefix}${checkbox.unchecked} ${todo.content}`) + marker;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
#getActivePhase(phases: TodoPhase[]): TodoPhase | undefined {
|
|
973
|
+
const nonEmpty = phases.filter(phase => phase.tasks.length > 0);
|
|
974
|
+
const active = nonEmpty.find(phase =>
|
|
975
|
+
phase.tasks.some(task => task.status === "pending" || task.status === "in_progress"),
|
|
976
|
+
);
|
|
977
|
+
return active ?? nonEmpty[nonEmpty.length - 1];
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
#renderTodoList(): void {
|
|
981
|
+
this.todoContainer.clear();
|
|
982
|
+
const phases = this.todoPhases.filter(phase => phase.tasks.length > 0);
|
|
983
|
+
if (phases.length === 0) {
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
const indent = " ";
|
|
988
|
+
const hook = theme.tree.hook;
|
|
989
|
+
const lines = ["", indent + theme.bold(theme.fg("accent", "Todos"))];
|
|
990
|
+
|
|
991
|
+
if (!this.todoExpanded) {
|
|
992
|
+
const activeIdx = phases.indexOf(this.#getActivePhase(phases) ?? phases[0]);
|
|
993
|
+
const activePhase = phases[activeIdx];
|
|
994
|
+
if (!activePhase) return;
|
|
995
|
+
lines.push(
|
|
996
|
+
`${indent}${theme.fg("accent", `${hook} ${formatPhaseDisplayName(activePhase.name, activeIdx + 1)}`)}`,
|
|
997
|
+
);
|
|
998
|
+
const visibleTasks = activePhase.tasks.slice(0, 5);
|
|
999
|
+
visibleTasks.forEach((todo, index) => {
|
|
1000
|
+
const prefix = `${indent}${index === 0 ? hook : " "} `;
|
|
1001
|
+
lines.push(this.#formatTodoLine(todo, prefix));
|
|
1002
|
+
});
|
|
1003
|
+
if (visibleTasks.length < activePhase.tasks.length) {
|
|
1004
|
+
const remaining = activePhase.tasks.length - visibleTasks.length;
|
|
1005
|
+
lines.push(theme.fg("muted", `${indent} ${hook} +${remaining} more`));
|
|
1006
|
+
}
|
|
1007
|
+
this.todoContainer.addChild(new Text(lines.join("\n"), 1, 0));
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
phases.forEach((phase, phaseIndex) => {
|
|
1012
|
+
lines.push(`${indent}${theme.fg("accent", `${hook} ${formatPhaseDisplayName(phase.name, phaseIndex + 1)}`)}`);
|
|
1013
|
+
phase.tasks.forEach((todo, index) => {
|
|
1014
|
+
const prefix = `${indent}${index === 0 ? hook : " "} `;
|
|
1015
|
+
lines.push(this.#formatTodoLine(todo, prefix));
|
|
1016
|
+
});
|
|
1017
|
+
});
|
|
1018
|
+
|
|
1019
|
+
this.todoContainer.addChild(new Text(lines.join("\n"), 1, 0));
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
async #loadTodoList(): Promise<void> {
|
|
1023
|
+
this.todoPhases = this.session.getTodoPhases();
|
|
1024
|
+
this.#renderTodoList();
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
async #getPlanFilePath(): Promise<string> {
|
|
1028
|
+
return "local://PLAN.md";
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
#resolvePlanFilePath(planFilePath: string): string {
|
|
1032
|
+
if (planFilePath.startsWith("local:")) {
|
|
1033
|
+
const normalized = normalizeLocalScheme(planFilePath);
|
|
1034
|
+
return resolveLocalUrlToPath(normalized, {
|
|
1035
|
+
getArtifactsDir: () => this.sessionManager.getArtifactsDir(),
|
|
1036
|
+
getSessionId: () => this.sessionManager.getSessionId(),
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
return path.resolve(this.sessionManager.getCwd(), planFilePath);
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
#updatePlanModeStatus(): void {
|
|
1043
|
+
const status =
|
|
1044
|
+
this.planModeEnabled || this.planModePaused
|
|
1045
|
+
? {
|
|
1046
|
+
enabled: this.planModeEnabled,
|
|
1047
|
+
paused: this.planModePaused,
|
|
1048
|
+
}
|
|
1049
|
+
: undefined;
|
|
1050
|
+
this.statusLine.setPlanModeStatus(status);
|
|
1051
|
+
this.updateEditorTopBorder();
|
|
1052
|
+
this.ui.requestRender();
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
#updateGoalModeStatus(): void {
|
|
1056
|
+
const status =
|
|
1057
|
+
this.goalModeEnabled || this.goalModePaused
|
|
1058
|
+
? { enabled: this.goalModeEnabled, paused: this.goalModePaused }
|
|
1059
|
+
: undefined;
|
|
1060
|
+
this.statusLine.setGoalModeStatus(status);
|
|
1061
|
+
this.updateEditorTopBorder();
|
|
1062
|
+
this.ui.requestRender();
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
#resetGoalContinuationSuppression(): void {
|
|
1066
|
+
this.#goalSuppressNextContinuation = false;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
#getPausedGoalState(): GoalModeState | undefined {
|
|
1070
|
+
const state = this.session.getGoalModeState();
|
|
1071
|
+
if (!state?.goal || state.enabled || state.goal.status !== "paused") {
|
|
1072
|
+
return undefined;
|
|
1073
|
+
}
|
|
1074
|
+
return state;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
#goalFromModeData(modeData: SessionContext["modeData"]): Goal | undefined {
|
|
1078
|
+
const goal = modeData?.goal;
|
|
1079
|
+
if (!goal || typeof goal !== "object") return undefined;
|
|
1080
|
+
const value = goal as Record<string, unknown>;
|
|
1081
|
+
if (
|
|
1082
|
+
typeof value.id !== "string" ||
|
|
1083
|
+
typeof value.objective !== "string" ||
|
|
1084
|
+
typeof value.status !== "string" ||
|
|
1085
|
+
typeof value.tokensUsed !== "number" ||
|
|
1086
|
+
typeof value.timeUsedSeconds !== "number" ||
|
|
1087
|
+
typeof value.createdAt !== "number" ||
|
|
1088
|
+
typeof value.updatedAt !== "number"
|
|
1089
|
+
) {
|
|
1090
|
+
return undefined;
|
|
1091
|
+
}
|
|
1092
|
+
return {
|
|
1093
|
+
id: value.id,
|
|
1094
|
+
objective: value.objective,
|
|
1095
|
+
status: value.status as Goal["status"],
|
|
1096
|
+
tokenBudget: typeof value.tokenBudget === "number" ? value.tokenBudget : undefined,
|
|
1097
|
+
tokensUsed: value.tokensUsed,
|
|
1098
|
+
timeUsedSeconds: value.timeUsedSeconds,
|
|
1099
|
+
createdAt: value.createdAt,
|
|
1100
|
+
updatedAt: value.updatedAt,
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
async #handleGoalSessionEvent(event: AgentSessionEvent): Promise<void> {
|
|
1105
|
+
if (event.type === "agent_start") {
|
|
1106
|
+
this.#goalTurnHadToolCalls = false;
|
|
1107
|
+
this.#cancelGoalContinuation();
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
if (event.type === "tool_execution_start") {
|
|
1111
|
+
this.#goalTurnHadToolCalls = true;
|
|
1112
|
+
if (!this.#goalContinuationTurnInFlight) {
|
|
1113
|
+
this.#resetGoalContinuationSuppression();
|
|
1114
|
+
}
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
if (event.type === "message_start" && event.message.role === "user" && !event.message.synthetic) {
|
|
1118
|
+
this.#resetGoalContinuationSuppression();
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
if (event.type === "goal_updated") {
|
|
1122
|
+
// Handle drop before clearing goalModeEnabled so #exitGoalMode can
|
|
1123
|
+
// still restore the previous tool set while the flag is true.
|
|
1124
|
+
if (event.state?.goal?.status === "dropped") {
|
|
1125
|
+
await this.#exitGoalMode({ reason: "dropped", silent: true });
|
|
1126
|
+
return;
|
|
1127
|
+
}
|
|
1128
|
+
if (event.state?.enabled === true && !this.#goalModePreviousTools) {
|
|
1129
|
+
this.#goalModePreviousTools = this.session.getActiveToolNames().filter(name => name !== "goal");
|
|
1130
|
+
}
|
|
1131
|
+
this.goalModeEnabled = event.state?.enabled === true;
|
|
1132
|
+
this.goalModePaused = event.state?.enabled !== true && event.state?.goal?.status === "paused";
|
|
1133
|
+
if (!event.state?.enabled) {
|
|
1134
|
+
this.#cancelGoalContinuation();
|
|
1135
|
+
}
|
|
1136
|
+
this.#updateGoalModeStatus();
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
if (event.type !== "agent_end") {
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
if (this.#goalContinuationTurnInFlight) {
|
|
1143
|
+
this.#goalSuppressNextContinuation = !this.#goalTurnHadToolCalls;
|
|
1144
|
+
this.#goalContinuationTurnInFlight = false;
|
|
1145
|
+
}
|
|
1146
|
+
if (this.session.getGoalModeState()?.mode === "exiting") {
|
|
1147
|
+
await this.#exitGoalMode({ reason: "completed", silent: true });
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
this.#scheduleGoalContinuation();
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
async #applyPlanModeModel(): Promise<void> {
|
|
1154
|
+
const resolved = this.session.resolveRoleModelWithThinking("plan");
|
|
1155
|
+
if (!resolved.model) return;
|
|
1156
|
+
|
|
1157
|
+
const currentModel = this.session.model;
|
|
1158
|
+
const sameModel = modelsAreEqual(currentModel, resolved.model);
|
|
1159
|
+
const planThinkingLevel = resolved.explicitThinkingLevel ? resolved.thinkingLevel : undefined;
|
|
1160
|
+
|
|
1161
|
+
this.#planModePreviousModelState = currentModel
|
|
1162
|
+
? { model: currentModel, thinkingLevel: this.session.thinkingLevel }
|
|
1163
|
+
: undefined;
|
|
1164
|
+
|
|
1165
|
+
if (!sameModel) {
|
|
1166
|
+
if (this.session.isStreaming) {
|
|
1167
|
+
this.#pendingModelSwitch = { model: resolved.model, thinkingLevel: planThinkingLevel };
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
try {
|
|
1171
|
+
await this.session.setModelTemporary(resolved.model, planThinkingLevel);
|
|
1172
|
+
} catch (error) {
|
|
1173
|
+
this.showWarning(
|
|
1174
|
+
`Failed to switch to plan model for plan mode: ${error instanceof Error ? error.message : String(error)}`,
|
|
1175
|
+
);
|
|
1176
|
+
}
|
|
1177
|
+
} else if (planThinkingLevel) {
|
|
1178
|
+
this.session.setThinkingLevel(planThinkingLevel);
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/** Apply any deferred model switch after the current stream ends. */
|
|
1183
|
+
async flushPendingModelSwitch(): Promise<void> {
|
|
1184
|
+
const pending = this.#pendingModelSwitch;
|
|
1185
|
+
if (!pending) return;
|
|
1186
|
+
this.#pendingModelSwitch = undefined;
|
|
1187
|
+
try {
|
|
1188
|
+
await this.session.setModelTemporary(pending.model, pending.thinkingLevel);
|
|
1189
|
+
} catch (error) {
|
|
1190
|
+
this.showWarning(
|
|
1191
|
+
`Failed to switch model after streaming: ${error instanceof Error ? error.message : String(error)}`,
|
|
1192
|
+
);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
/** Restore mode state from session entries on resume (e.g. plan mode). */
|
|
1197
|
+
async #restoreModeFromSession(): Promise<void> {
|
|
1198
|
+
const sessionContext = this.sessionManager.buildSessionContext();
|
|
1199
|
+
const goalEnabled = this.session.settings.get("goal.enabled");
|
|
1200
|
+
if (!goalEnabled && (sessionContext.mode === "goal" || sessionContext.mode === "goal_paused")) {
|
|
1201
|
+
this.sessionManager.appendModeChange("none");
|
|
1202
|
+
return;
|
|
1203
|
+
}
|
|
1204
|
+
if (sessionContext.mode === "goal" || sessionContext.mode === "goal_paused") {
|
|
1205
|
+
const goal = this.#goalFromModeData(sessionContext.modeData);
|
|
1206
|
+
if (!goal) {
|
|
1207
|
+
this.sessionManager.appendModeChange("none");
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
this.session.setGoalModeState({
|
|
1211
|
+
enabled: sessionContext.mode === "goal",
|
|
1212
|
+
mode: "active",
|
|
1213
|
+
goal,
|
|
1214
|
+
});
|
|
1215
|
+
const restored = await this.session.goalRuntime.onThreadResumed();
|
|
1216
|
+
this.goalModeEnabled = restored?.enabled === true;
|
|
1217
|
+
this.goalModePaused = restored?.enabled !== true && restored?.goal.status === "paused";
|
|
1218
|
+
// sdk.ts excludes "goal" from the initial active tool set unconditionally.
|
|
1219
|
+
// Re-add it now so the agent can call resume, complete, or drop on this goal.
|
|
1220
|
+
if (restored?.goal) {
|
|
1221
|
+
const previousTools = this.session.getActiveToolNames().filter(name => name !== "goal");
|
|
1222
|
+
this.#goalModePreviousTools = previousTools;
|
|
1223
|
+
await this.session.setActiveToolsByName([...new Set([...previousTools, "goal"])]);
|
|
1224
|
+
}
|
|
1225
|
+
this.#updateGoalModeStatus();
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1228
|
+
const pendingGoal = goalEnabled ? await consumePendingGoalModeRequest(this.sessionManager.getCwd()) : null;
|
|
1229
|
+
if (pendingGoal) {
|
|
1230
|
+
await this.#enterGoalMode({ objective: pendingGoal.objective, silent: true });
|
|
1231
|
+
this.#scheduleGoalContinuation();
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
if (!this.session.settings.get("plan.enabled")) {
|
|
1235
|
+
// Clear stale plan/plan_paused mode so re-enabling the setting
|
|
1236
|
+
// later doesn't unexpectedly restore an old plan session.
|
|
1237
|
+
if (sessionContext.mode === "plan" || sessionContext.mode === "plan_paused") {
|
|
1238
|
+
this.sessionManager.appendModeChange("none");
|
|
1239
|
+
}
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
if (sessionContext.mode === "plan") {
|
|
1243
|
+
const planFilePath = sessionContext.modeData?.planFilePath as string | undefined;
|
|
1244
|
+
await this.#enterPlanMode({ planFilePath });
|
|
1245
|
+
} else if (sessionContext.mode === "plan_paused") {
|
|
1246
|
+
this.planModePaused = true;
|
|
1247
|
+
this.#planModeHasEntered = true;
|
|
1248
|
+
this.#updatePlanModeStatus();
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
async #enterPlanMode(options?: { planFilePath?: string; workflow?: "parallel" | "iterative" }): Promise<void> {
|
|
1253
|
+
if (this.planModeEnabled) {
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1256
|
+
if (this.goalModeEnabled || this.goalModePaused) {
|
|
1257
|
+
this.showWarning("Exit goal mode first.");
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
this.planModePaused = false;
|
|
1262
|
+
|
|
1263
|
+
const planFilePath = options?.planFilePath ?? (await this.#getPlanFilePath());
|
|
1264
|
+
const previousTools = this.session.getActiveToolNames();
|
|
1265
|
+
const hasResolveTool = this.session.getToolByName("resolve") !== undefined;
|
|
1266
|
+
const planTools = hasResolveTool ? [...previousTools, "resolve"] : previousTools;
|
|
1267
|
+
const uniquePlanTools = [...new Set(planTools)];
|
|
1268
|
+
|
|
1269
|
+
this.#planModePreviousTools = previousTools;
|
|
1270
|
+
this.planModePlanFilePath = planFilePath;
|
|
1271
|
+
this.planModeEnabled = true;
|
|
1272
|
+
|
|
1273
|
+
await this.session.setActiveToolsByName(uniquePlanTools);
|
|
1274
|
+
this.session.setPlanModeState({
|
|
1275
|
+
enabled: true,
|
|
1276
|
+
planFilePath,
|
|
1277
|
+
workflow: options?.workflow ?? "parallel",
|
|
1278
|
+
reentry: this.#planModeHasEntered,
|
|
1279
|
+
});
|
|
1280
|
+
this.session.setStandingResolveHandler?.(input => this.#runPlanApprovalResolve(input));
|
|
1281
|
+
if (this.session.isStreaming) {
|
|
1282
|
+
await this.session.sendPlanModeContext({ deliverAs: "steer" });
|
|
1283
|
+
}
|
|
1284
|
+
this.#planModeHasEntered = true;
|
|
1285
|
+
await this.#applyPlanModeModel();
|
|
1286
|
+
this.#updatePlanModeStatus();
|
|
1287
|
+
this.sessionManager.appendModeChange("plan", { planFilePath });
|
|
1288
|
+
this.showStatus(`Plan mode enabled. Plan file: ${planFilePath}`);
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
/** Standing resolve dispatcher registered while plan mode is active. The agent
|
|
1292
|
+
* submits the finalized plan by calling `resolve { action: "apply", extra: { title } }`;
|
|
1293
|
+
* this handler validates the plan file exists, normalizes the title, and shapes the
|
|
1294
|
+
* payload that `event-controller` forwards to `handlePlanApproval`. */
|
|
1295
|
+
#runPlanApprovalResolve(input: unknown): Promise<AgentToolResult<ResolveToolDetails>> {
|
|
1296
|
+
return runResolveInvocation(input as Parameters<typeof runResolveInvocation>[0], {
|
|
1297
|
+
sourceToolName: "plan_approval",
|
|
1298
|
+
label: "Plan ready for approval",
|
|
1299
|
+
apply: async (_reason, extra) => {
|
|
1300
|
+
const state = this.session.getPlanModeState?.();
|
|
1301
|
+
if (!state?.enabled) {
|
|
1302
|
+
throw new ToolError("Plan mode is not active.");
|
|
1303
|
+
}
|
|
1304
|
+
const planFilePath = state.planFilePath;
|
|
1305
|
+
const planContent = await this.#readPlanFile(planFilePath);
|
|
1306
|
+
if (planContent === null) {
|
|
1307
|
+
throw new ToolError(
|
|
1308
|
+
`Plan file not found at ${planFilePath}. Write the finalized plan to ${planFilePath} before requesting approval.`,
|
|
1309
|
+
);
|
|
1310
|
+
}
|
|
1311
|
+
const normalized = resolvePlanTitle({
|
|
1312
|
+
suppliedTitle: extra?.title,
|
|
1313
|
+
planContent,
|
|
1314
|
+
planFilePath,
|
|
1315
|
+
});
|
|
1316
|
+
const details: PlanApprovalDetails = {
|
|
1317
|
+
planFilePath,
|
|
1318
|
+
finalPlanFilePath: `local://${normalized.fileName}`,
|
|
1319
|
+
title: normalized.title,
|
|
1320
|
+
planExists: true,
|
|
1321
|
+
};
|
|
1322
|
+
return {
|
|
1323
|
+
content: [{ type: "text" as const, text: "Plan ready for approval." }],
|
|
1324
|
+
details,
|
|
1325
|
+
};
|
|
1326
|
+
},
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
async #exitPlanMode(options?: { silent?: boolean; paused?: boolean }): Promise<void> {
|
|
1331
|
+
if (!this.planModeEnabled) {
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
const previousTools = this.#planModePreviousTools;
|
|
1336
|
+
if (previousTools && previousTools.length > 0) {
|
|
1337
|
+
await this.session.setActiveToolsByName(previousTools);
|
|
1338
|
+
}
|
|
1339
|
+
if (this.#planModePreviousModelState) {
|
|
1340
|
+
const prev = this.#planModePreviousModelState;
|
|
1341
|
+
if (modelsAreEqual(this.session.model, prev.model)) {
|
|
1342
|
+
// Same model — only thinking level may differ. Avoid setModelTemporary()
|
|
1343
|
+
// which would reset provider-side sessions (openai-responses/OpenAI code backend) and
|
|
1344
|
+
// break conversation continuity.
|
|
1345
|
+
this.session.setThinkingLevel(prev.thinkingLevel);
|
|
1346
|
+
} else if (this.session.isStreaming) {
|
|
1347
|
+
this.#pendingModelSwitch = { model: prev.model, thinkingLevel: prev.thinkingLevel };
|
|
1348
|
+
} else {
|
|
1349
|
+
await this.session.setModelTemporary(prev.model, prev.thinkingLevel);
|
|
1350
|
+
}
|
|
1351
|
+
// If #applyPlanModeModel queued a deferred switch to the plan-role model
|
|
1352
|
+
// (because the session was streaming on entry), drop it now: we are
|
|
1353
|
+
// leaving plan mode, so flushing it on the next agent_end would land the
|
|
1354
|
+
// session on the plan-role model after the user has exited plan mode
|
|
1355
|
+
// (issue #816). Only clear when the pending target matches the plan-role
|
|
1356
|
+
// model — leave any unrelated user-queued switch intact.
|
|
1357
|
+
const pending = this.#pendingModelSwitch;
|
|
1358
|
+
if (pending) {
|
|
1359
|
+
const planResolution = this.session.resolveRoleModelWithThinking("plan");
|
|
1360
|
+
if (planResolution.model && modelsAreEqual(pending.model, planResolution.model)) {
|
|
1361
|
+
this.#pendingModelSwitch = undefined;
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
this.session.setStandingResolveHandler?.(null);
|
|
1366
|
+
this.session.setPlanModeState(undefined);
|
|
1367
|
+
this.planModeEnabled = false;
|
|
1368
|
+
this.planModePaused = options?.paused ?? false;
|
|
1369
|
+
this.planModePlanFilePath = undefined;
|
|
1370
|
+
this.#planModePreviousTools = undefined;
|
|
1371
|
+
this.#planModePreviousModelState = undefined;
|
|
1372
|
+
this.#updatePlanModeStatus();
|
|
1373
|
+
const paused = options?.paused ?? false;
|
|
1374
|
+
this.sessionManager.appendModeChange(paused ? "plan_paused" : "none");
|
|
1375
|
+
if (!options?.silent) {
|
|
1376
|
+
this.showStatus(paused ? "Plan mode paused." : "Plan mode disabled.");
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
async #enterGoalMode(options: { objective?: string; resume?: boolean; silent?: boolean }): Promise<void> {
|
|
1381
|
+
if (this.goalModeEnabled) {
|
|
1382
|
+
return;
|
|
1383
|
+
}
|
|
1384
|
+
if (this.planModeEnabled || this.planModePaused) {
|
|
1385
|
+
this.showWarning("Exit plan mode first.");
|
|
1386
|
+
return;
|
|
1387
|
+
}
|
|
1388
|
+
const previousTools = this.session.getActiveToolNames().filter(name => name !== "goal");
|
|
1389
|
+
const goalTools = [...new Set([...previousTools, "goal"])];
|
|
1390
|
+
this.#goalModePreviousTools = previousTools;
|
|
1391
|
+
this.goalModePaused = false;
|
|
1392
|
+
const state = options.resume
|
|
1393
|
+
? await this.session.goalRuntime.resumeGoal()
|
|
1394
|
+
: await this.session.goalRuntime.createGoal({ objective: options.objective ?? "" });
|
|
1395
|
+
await this.session.setActiveToolsByName(goalTools);
|
|
1396
|
+
this.session.setGoalModeState(state);
|
|
1397
|
+
this.goalModeEnabled = true;
|
|
1398
|
+
this.#resetGoalContinuationSuppression();
|
|
1399
|
+
this.#updateGoalModeStatus();
|
|
1400
|
+
if (this.session.isStreaming) {
|
|
1401
|
+
await this.session.sendGoalModeContext({ deliverAs: "steer" });
|
|
1402
|
+
}
|
|
1403
|
+
if (!options.silent) {
|
|
1404
|
+
this.showStatus(options.resume ? "Goal mode resumed." : "Goal mode enabled.");
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
async #exitGoalMode(options?: {
|
|
1409
|
+
silent?: boolean;
|
|
1410
|
+
paused?: boolean;
|
|
1411
|
+
reason?: "completed" | "paused" | "dropped";
|
|
1412
|
+
}): Promise<void> {
|
|
1413
|
+
const previousTools = this.#goalModePreviousTools;
|
|
1414
|
+
if (this.goalModeEnabled && previousTools) {
|
|
1415
|
+
await this.session.setActiveToolsByName(previousTools);
|
|
1416
|
+
}
|
|
1417
|
+
const currentState = this.session.getGoalModeState();
|
|
1418
|
+
if (options?.reason === "completed") {
|
|
1419
|
+
this.session.setGoalModeState(undefined);
|
|
1420
|
+
this.sessionManager.appendModeChange("none");
|
|
1421
|
+
this.sessionManager.appendCustomEntry("goal-completed", {
|
|
1422
|
+
objective: currentState?.goal?.objective,
|
|
1423
|
+
tokensUsed: currentState?.goal?.tokensUsed,
|
|
1424
|
+
tokenBudget: currentState?.goal?.tokenBudget,
|
|
1425
|
+
timeUsedSeconds: currentState?.goal?.timeUsedSeconds,
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
this.goalModeEnabled = false;
|
|
1429
|
+
this.goalModePaused = options?.paused ?? false;
|
|
1430
|
+
this.#goalModePreviousTools = undefined;
|
|
1431
|
+
this.#goalContinuationTurnInFlight = false;
|
|
1432
|
+
this.#cancelGoalContinuation();
|
|
1433
|
+
this.#updateGoalModeStatus();
|
|
1434
|
+
if (!options?.silent) {
|
|
1435
|
+
if (options?.reason === "completed") {
|
|
1436
|
+
this.showStatus("Goal mode completed.");
|
|
1437
|
+
} else if (options?.reason === "dropped") {
|
|
1438
|
+
this.showStatus("Goal dropped.");
|
|
1439
|
+
} else if (options?.paused) {
|
|
1440
|
+
this.showStatus("Goal mode paused.");
|
|
1441
|
+
} else {
|
|
1442
|
+
this.showStatus("Goal mode disabled.");
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
async #readPlanFile(planFilePath: string): Promise<string | null> {
|
|
1448
|
+
const resolvedPath = this.#resolvePlanFilePath(planFilePath);
|
|
1449
|
+
try {
|
|
1450
|
+
return await Bun.file(resolvedPath).text();
|
|
1451
|
+
} catch (error) {
|
|
1452
|
+
if (isEnoent(error)) {
|
|
1453
|
+
return null;
|
|
1454
|
+
}
|
|
1455
|
+
throw error;
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
#renderPlanPreview(planContent: string, options?: { append?: boolean }): void {
|
|
1460
|
+
const existingContainer = this.#planReviewContainer;
|
|
1461
|
+
const replaceExisting = options?.append !== true && existingContainer !== undefined;
|
|
1462
|
+
const planReviewContainer = replaceExisting ? existingContainer : new Container();
|
|
1463
|
+
planReviewContainer.clear();
|
|
1464
|
+
planReviewContainer.addChild(new Spacer(1));
|
|
1465
|
+
planReviewContainer.addChild(new DynamicBorder());
|
|
1466
|
+
planReviewContainer.addChild(new Text(theme.bold(theme.fg("accent", "Plan Review")), 1, 1));
|
|
1467
|
+
planReviewContainer.addChild(new Spacer(1));
|
|
1468
|
+
planReviewContainer.addChild(new Markdown(planContent, 1, 1, getMarkdownTheme()));
|
|
1469
|
+
planReviewContainer.addChild(new DynamicBorder());
|
|
1470
|
+
if (!replaceExisting) {
|
|
1471
|
+
this.chatContainer.addChild(planReviewContainer);
|
|
1472
|
+
}
|
|
1473
|
+
this.#planReviewContainer = planReviewContainer;
|
|
1474
|
+
this.ui.requestRender();
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
#getEditorTerminalPath(): string | null {
|
|
1478
|
+
if (process.platform === "win32") {
|
|
1479
|
+
return null;
|
|
1480
|
+
}
|
|
1481
|
+
return "/dev/tty";
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
async #openEditorTerminalHandle(): Promise<fs.FileHandle | null> {
|
|
1485
|
+
const terminalPath = this.#getEditorTerminalPath();
|
|
1486
|
+
if (!terminalPath) {
|
|
1487
|
+
return null;
|
|
1488
|
+
}
|
|
1489
|
+
try {
|
|
1490
|
+
return await fs.open(terminalPath, "r+");
|
|
1491
|
+
} catch {
|
|
1492
|
+
return null;
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
#getPlanReviewHelpText(): string {
|
|
1497
|
+
const externalEditorKey = this.keybindings.getDisplayString("app.editor.external");
|
|
1498
|
+
if (!externalEditorKey) {
|
|
1499
|
+
return "up/down navigate enter select esc cancel";
|
|
1500
|
+
}
|
|
1501
|
+
return `up/down navigate enter select ${externalEditorKey.toLowerCase()} open in editor esc cancel`;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
async #openPlanInExternalEditor(planFilePath: string): Promise<void> {
|
|
1505
|
+
const editorCmd = getEditorCommand();
|
|
1506
|
+
if (!editorCmd) {
|
|
1507
|
+
this.showWarning("No editor configured. Set $VISUAL or $EDITOR environment variable.");
|
|
1508
|
+
return;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
const resolvedPath = this.#resolvePlanFilePath(planFilePath);
|
|
1512
|
+
let currentText: string;
|
|
1513
|
+
try {
|
|
1514
|
+
currentText = await Bun.file(resolvedPath).text();
|
|
1515
|
+
} catch (error) {
|
|
1516
|
+
if (isEnoent(error)) {
|
|
1517
|
+
this.showError(`Plan file not found at ${planFilePath}`);
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
this.showWarning(`Failed to open external editor: ${error instanceof Error ? error.message : String(error)}`);
|
|
1521
|
+
return;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
let ttyHandle: fs.FileHandle | null = null;
|
|
1525
|
+
try {
|
|
1526
|
+
ttyHandle = await this.#openEditorTerminalHandle();
|
|
1527
|
+
this.ui.stop();
|
|
1528
|
+
|
|
1529
|
+
const stdio: [number | "inherit", number | "inherit", number | "inherit"] = ttyHandle
|
|
1530
|
+
? [ttyHandle.fd, ttyHandle.fd, ttyHandle.fd]
|
|
1531
|
+
: ["inherit", "inherit", "inherit"];
|
|
1532
|
+
|
|
1533
|
+
const result = await openInEditor(editorCmd, currentText, {
|
|
1534
|
+
extension: path.extname(resolvedPath) || ".md",
|
|
1535
|
+
stdio,
|
|
1536
|
+
trimTrailingNewline: false,
|
|
1537
|
+
});
|
|
1538
|
+
if (result !== null) {
|
|
1539
|
+
await Bun.write(resolvedPath, result);
|
|
1540
|
+
this.#renderPlanPreview(result);
|
|
1541
|
+
this.showStatus("Plan updated in external editor.");
|
|
1542
|
+
}
|
|
1543
|
+
} catch (error) {
|
|
1544
|
+
this.showWarning(`Failed to open external editor: ${error instanceof Error ? error.message : String(error)}`);
|
|
1545
|
+
} finally {
|
|
1546
|
+
if (ttyHandle) {
|
|
1547
|
+
await ttyHandle.close();
|
|
1548
|
+
}
|
|
1549
|
+
this.ui.start();
|
|
1550
|
+
this.ui.requestRender(true);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
async #approvePlan(
|
|
1555
|
+
planContent: string,
|
|
1556
|
+
options: {
|
|
1557
|
+
planFilePath: string;
|
|
1558
|
+
finalPlanFilePath: string;
|
|
1559
|
+
title: string;
|
|
1560
|
+
preserveContext?: boolean;
|
|
1561
|
+
compactBeforeExecute?: boolean;
|
|
1562
|
+
},
|
|
1563
|
+
): Promise<void> {
|
|
1564
|
+
await renameApprovedPlanFile({
|
|
1565
|
+
planFilePath: options.planFilePath,
|
|
1566
|
+
finalPlanFilePath: options.finalPlanFilePath,
|
|
1567
|
+
getArtifactsDir: () => this.sessionManager.getArtifactsDir(),
|
|
1568
|
+
getSessionId: () => this.sessionManager.getSessionId(),
|
|
1569
|
+
});
|
|
1570
|
+
const previousTools = this.#planModePreviousTools ?? this.session.getActiveToolNames();
|
|
1571
|
+
|
|
1572
|
+
// Mark the pending abort caused by the plan-mode → compaction transition as
|
|
1573
|
+
// silent BEFORE #exitPlanMode raises it. The `finally` below clears the
|
|
1574
|
+
// flag on every terminal compaction outcome (ok / cancelled / failed /
|
|
1575
|
+
// throw) so a leaked flag cannot silence a later unrelated abort.
|
|
1576
|
+
// Branchless mark+clear when !compactBeforeExecute: mark is gated; clear
|
|
1577
|
+
// is unconditional and idempotent.
|
|
1578
|
+
if (options.compactBeforeExecute) {
|
|
1579
|
+
this.session.markPlanCompactAbortPending();
|
|
1580
|
+
}
|
|
1581
|
+
let compactOutcome: CompactionOutcome | undefined;
|
|
1582
|
+
try {
|
|
1583
|
+
await this.#exitPlanMode({ silent: true, paused: false });
|
|
1584
|
+
|
|
1585
|
+
if (!options.preserveContext) {
|
|
1586
|
+
await this.handleClearCommand();
|
|
1587
|
+
// The new session has a fresh local:// root — persist the approved plan there
|
|
1588
|
+
// so `local://<title>.md` resolves correctly in the execution session.
|
|
1589
|
+
const newLocalPath = resolveLocalUrlToPath(options.finalPlanFilePath, {
|
|
1590
|
+
getArtifactsDir: () => this.sessionManager.getArtifactsDir(),
|
|
1591
|
+
getSessionId: () => this.sessionManager.getSessionId(),
|
|
1592
|
+
});
|
|
1593
|
+
await Bun.write(newLocalPath, planContent);
|
|
1594
|
+
} else if (options.compactBeforeExecute) {
|
|
1595
|
+
// Distill the plan-mode transcript before the execution turn is queued so
|
|
1596
|
+
// the plan-approved synthetic prompt lands as a fresh cache anchor.
|
|
1597
|
+
// Outcome is consumed after tool-restoration and plan-reference-path
|
|
1598
|
+
// bookkeeping below; `markPlanReferenceSent` is intentionally deferred
|
|
1599
|
+
// past the cancel guard — see the comment at the cancel branch.
|
|
1600
|
+
// Cancellation skips the synthetic-prompt dispatch (operator's explicit
|
|
1601
|
+
// abort is honored); failure proceeds best-effort — approval intent stands.
|
|
1602
|
+
const compactionPrompt = prompt.render(planModeCompactInstructionsPrompt, {
|
|
1603
|
+
planFilePath: options.finalPlanFilePath,
|
|
1604
|
+
});
|
|
1605
|
+
// Pin the plan reference path BEFORE compaction so any user messages
|
|
1606
|
+
// queued during the compaction await (which `handleCompactCommand`
|
|
1607
|
+
// flushes via `flushCompactionQueue` before returning) see the
|
|
1608
|
+
// approved plan in `#buildPlanReferenceMessage`. Reassignment after
|
|
1609
|
+
// the try/finally is idempotent and kept for the !compactBeforeExecute
|
|
1610
|
+
// branch.
|
|
1611
|
+
this.session.setPlanReferencePath(options.finalPlanFilePath);
|
|
1612
|
+
compactOutcome = await this.handleCompactCommand(compactionPrompt);
|
|
1613
|
+
}
|
|
1614
|
+
} finally {
|
|
1615
|
+
// Unconditional clear. Idempotent: a no-op when the flag was never set
|
|
1616
|
+
// (i.e., the !compactBeforeExecute branch), and a no-op when the flag
|
|
1617
|
+
// was already consumed by AgentSession.#handleAgentEvent's aborted
|
|
1618
|
+
// message_end stamping. Guarantees the flag is dead at every exit.
|
|
1619
|
+
this.session.clearPlanCompactAbortPending();
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
// Tool restoration runs on every path — the plan mode tools must be
|
|
1623
|
+
// retired regardless of whether the synthetic prompt fires.
|
|
1624
|
+
if (previousTools.length > 0) {
|
|
1625
|
+
await this.session.setActiveToolsByName(previousTools);
|
|
1626
|
+
}
|
|
1627
|
+
this.session.setPlanReferencePath(options.finalPlanFilePath);
|
|
1628
|
+
|
|
1629
|
+
if (compactOutcome === "cancelled") {
|
|
1630
|
+
// Explicit abort: honor it. `executeCompaction` already surfaced
|
|
1631
|
+
// `showError("Compaction cancelled")` to the operator; we add the
|
|
1632
|
+
// deferred-dispatch warning and exit. `markPlanReferenceSent` is
|
|
1633
|
+
// intentionally skipped here: `#planReferenceSent` stays false, so
|
|
1634
|
+
// `AgentSession.#buildPlanReferenceMessage` will inject the plan
|
|
1635
|
+
// reference on the operator's next `prompt()` call. If we marked it
|
|
1636
|
+
// sent here, the executor's first turn would have no plan context.
|
|
1637
|
+
this.showWarning(
|
|
1638
|
+
"Plan approved, but compaction was cancelled — execution not dispatched. Submit a turn to continue.",
|
|
1639
|
+
);
|
|
1640
|
+
return;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
// Approved plans land in a fresh (or compacted) session whose first user-visible
|
|
1644
|
+
// turn is the synthetic plan-approved prompt — that path bypasses the
|
|
1645
|
+
// input-controller's title generation. Seed an auto-name from the plan title
|
|
1646
|
+
// so the session is not left unnamed. `setSessionName("auto")` is a no-op
|
|
1647
|
+
// when the user has already chosen a name (preserveContext paths).
|
|
1648
|
+
const seededName = humanizePlanTitle(options.title);
|
|
1649
|
+
if (seededName && !this.sessionManager.getSessionName()) {
|
|
1650
|
+
const applied = await this.sessionManager.setSessionName(seededName, "auto");
|
|
1651
|
+
if (applied) {
|
|
1652
|
+
setSessionTerminalTitle(this.sessionManager.getSessionName(), this.sessionManager.getCwd());
|
|
1653
|
+
this.updateEditorBorderColor();
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
// markPlanReferenceSent fires only on the dispatch path so the synthetic
|
|
1658
|
+
// plan-approved prompt is the source of the reference injection.
|
|
1659
|
+
this.session.markPlanReferenceSent();
|
|
1660
|
+
const planModePrompt = prompt.render(planModeApprovedPrompt, {
|
|
1661
|
+
planContent,
|
|
1662
|
+
finalPlanFilePath: options.finalPlanFilePath,
|
|
1663
|
+
contextPreserved: options.preserveContext === true,
|
|
1664
|
+
});
|
|
1665
|
+
await this.session.prompt(planModePrompt, { synthetic: true });
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
async handlePlanModeCommand(initialPrompt?: string): Promise<void> {
|
|
1669
|
+
if (this.goalModeEnabled || this.goalModePaused) {
|
|
1670
|
+
this.showWarning("Exit goal mode first.");
|
|
1671
|
+
return;
|
|
1672
|
+
}
|
|
1673
|
+
if (this.planModeEnabled) {
|
|
1674
|
+
const confirmed = await this.showHookConfirm(
|
|
1675
|
+
"Exit plan mode?",
|
|
1676
|
+
"This exits plan mode without approving a plan.",
|
|
1677
|
+
);
|
|
1678
|
+
if (!confirmed) return;
|
|
1679
|
+
await this.#exitPlanMode({ paused: true });
|
|
1680
|
+
return;
|
|
1681
|
+
}
|
|
1682
|
+
if (!this.session.settings.get("plan.enabled")) {
|
|
1683
|
+
this.showWarning("Plan mode is disabled. Enable it in settings (plan.enabled).");
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
await this.#enterPlanMode();
|
|
1687
|
+
if (initialPrompt && this.onInputCallback) {
|
|
1688
|
+
this.onInputCallback(this.startPendingSubmission({ text: initialPrompt }));
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
async #handleGoalBudgetCommand(rawBudget: string): Promise<void> {
|
|
1693
|
+
const state = this.session.getGoalModeState();
|
|
1694
|
+
if (!this.goalModeEnabled || !state?.enabled) {
|
|
1695
|
+
this.showWarning("No active goal.");
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
if (state.goal.status === "complete") {
|
|
1699
|
+
this.showStatus("Goal is already complete.");
|
|
1700
|
+
return;
|
|
1701
|
+
}
|
|
1702
|
+
const trimmed = rawBudget.trim().toLowerCase();
|
|
1703
|
+
let nextBudget: number | undefined;
|
|
1704
|
+
if (trimmed !== "off") {
|
|
1705
|
+
const parsed = Number.parseInt(trimmed, 10);
|
|
1706
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
1707
|
+
this.showError("Goal budget must be a positive integer or `off`.");
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
nextBudget = parsed;
|
|
1711
|
+
}
|
|
1712
|
+
await this.session.goalRuntime.onBudgetMutated(nextBudget);
|
|
1713
|
+
this.#resetGoalContinuationSuppression();
|
|
1714
|
+
this.#scheduleGoalContinuation();
|
|
1715
|
+
this.showStatus(nextBudget === undefined ? "Goal budget cleared." : `Goal budget set to ${nextBudget}.`);
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
async handleGoalModeCommand(rest?: string): Promise<void> {
|
|
1719
|
+
try {
|
|
1720
|
+
if (this.planModeEnabled || this.planModePaused) {
|
|
1721
|
+
this.showWarning("Exit plan mode first.");
|
|
1722
|
+
return;
|
|
1723
|
+
}
|
|
1724
|
+
if (!this.session.settings.get("goal.enabled")) {
|
|
1725
|
+
this.showWarning("Goal mode is disabled. Enable it in settings (goal.enabled).");
|
|
1726
|
+
return;
|
|
1727
|
+
}
|
|
1728
|
+
const { sub, rest: subRest } = parseGoalSubcommand(rest ?? "");
|
|
1729
|
+
if (sub) {
|
|
1730
|
+
await this.#dispatchGoalSubcommand(sub, subRest);
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
if (this.goalModeEnabled) {
|
|
1734
|
+
if (subRest) {
|
|
1735
|
+
this.showStatus("Goal mode is already active. Use /goal to manage it, or /goal drop to start over.");
|
|
1736
|
+
return;
|
|
1737
|
+
}
|
|
1738
|
+
await this.#openGoalMenu("active");
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1741
|
+
const pausedState = this.#getPausedGoalState();
|
|
1742
|
+
if (pausedState) {
|
|
1743
|
+
if (subRest) {
|
|
1744
|
+
this.showWarning("Resume the current goal first, or drop it before setting a new objective.");
|
|
1745
|
+
return;
|
|
1746
|
+
}
|
|
1747
|
+
await this.#openGoalMenu("paused");
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
if (subRest) {
|
|
1751
|
+
await this.#startGoalFromObjective(subRest);
|
|
1752
|
+
return;
|
|
1753
|
+
}
|
|
1754
|
+
const objective = (
|
|
1755
|
+
await this.showHookEditor("Goal objective", undefined, undefined, { promptStyle: true })
|
|
1756
|
+
)?.trim();
|
|
1757
|
+
if (!objective) return;
|
|
1758
|
+
await this.#startGoalFromObjective(objective);
|
|
1759
|
+
} catch (error) {
|
|
1760
|
+
this.showError(error instanceof Error ? error.message : String(error));
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
async #dispatchGoalSubcommand(sub: GoalSubcommand, rest: string): Promise<void> {
|
|
1765
|
+
switch (sub) {
|
|
1766
|
+
case "set":
|
|
1767
|
+
await this.#handleGoalSetSubcommand(rest);
|
|
1768
|
+
return;
|
|
1769
|
+
case "show":
|
|
1770
|
+
this.#showGoalDetails();
|
|
1771
|
+
return;
|
|
1772
|
+
case "pause":
|
|
1773
|
+
await this.#pauseGoalAction();
|
|
1774
|
+
return;
|
|
1775
|
+
case "resume":
|
|
1776
|
+
await this.#resumeGoalAction();
|
|
1777
|
+
return;
|
|
1778
|
+
case "drop":
|
|
1779
|
+
await this.#confirmAndDropGoal();
|
|
1780
|
+
return;
|
|
1781
|
+
case "budget":
|
|
1782
|
+
if (!this.goalModeEnabled) {
|
|
1783
|
+
this.showWarning(
|
|
1784
|
+
this.#getPausedGoalState() ? "Resume the goal before adjusting the budget." : "No active goal.",
|
|
1785
|
+
);
|
|
1786
|
+
return;
|
|
1787
|
+
}
|
|
1788
|
+
if (!rest) {
|
|
1789
|
+
await this.#promptGoalBudgetEdit();
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
await this.#handleGoalBudgetCommand(rest);
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
async #openGoalMenu(state: "active" | "paused"): Promise<void> {
|
|
1798
|
+
const goal = this.session.getGoalModeState()?.goal;
|
|
1799
|
+
if (!goal) return;
|
|
1800
|
+
const summary = goal.objective.length > 48 ? `${goal.objective.slice(0, 47)}…` : goal.objective;
|
|
1801
|
+
const title = state === "active" ? `Goal: ${summary} (${goal.status})` : `Goal paused: ${summary}`;
|
|
1802
|
+
const items =
|
|
1803
|
+
state === "active"
|
|
1804
|
+
? ["Show details", "Adjust budget…", "Pause", "Drop"]
|
|
1805
|
+
: ["Resume", "Show details", "Adjust budget…", "Drop"];
|
|
1806
|
+
const choice = await this.showHookSelector(title, items);
|
|
1807
|
+
if (!choice) return;
|
|
1808
|
+
switch (choice) {
|
|
1809
|
+
case "Show details":
|
|
1810
|
+
this.#showGoalDetails();
|
|
1811
|
+
return;
|
|
1812
|
+
case "Adjust budget…":
|
|
1813
|
+
await this.#promptGoalBudgetEdit();
|
|
1814
|
+
return;
|
|
1815
|
+
case "Pause":
|
|
1816
|
+
await this.#pauseGoalAction();
|
|
1817
|
+
return;
|
|
1818
|
+
case "Resume":
|
|
1819
|
+
await this.#resumeGoalAction();
|
|
1820
|
+
return;
|
|
1821
|
+
case "Drop":
|
|
1822
|
+
await this.#confirmAndDropGoal();
|
|
1823
|
+
return;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
#showGoalDetails(): void {
|
|
1828
|
+
const state = this.session.getGoalModeState();
|
|
1829
|
+
const goal = state?.goal;
|
|
1830
|
+
if (!goal) {
|
|
1831
|
+
this.showStatus("No goal set.");
|
|
1832
|
+
return;
|
|
1833
|
+
}
|
|
1834
|
+
const used = goal.tokensUsed.toLocaleString();
|
|
1835
|
+
const budgetLine =
|
|
1836
|
+
goal.tokenBudget !== undefined
|
|
1837
|
+
? `${used} / ${goal.tokenBudget.toLocaleString()} (${Math.max(0, goal.tokenBudget - goal.tokensUsed).toLocaleString()} left)`
|
|
1838
|
+
: `${used} (no budget)`;
|
|
1839
|
+
const lines = [
|
|
1840
|
+
`Objective: ${goal.objective}`,
|
|
1841
|
+
`Status: ${goal.status}${state?.enabled ? "" : " (paused)"}`,
|
|
1842
|
+
`Tokens: ${budgetLine}`,
|
|
1843
|
+
`Time spent: ${formatDuration(goal.timeUsedSeconds * 1000)}`,
|
|
1844
|
+
];
|
|
1845
|
+
this.showStatus(lines.join("\n"));
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
async #promptGoalBudgetEdit(): Promise<void> {
|
|
1849
|
+
const goal = this.session.getGoalModeState()?.goal;
|
|
1850
|
+
const prefill = goal?.tokenBudget !== undefined ? String(goal.tokenBudget) : "";
|
|
1851
|
+
const input = (
|
|
1852
|
+
await this.showHookEditor("Goal budget (number, `off`, or empty to cancel)", prefill, undefined, {
|
|
1853
|
+
promptStyle: true,
|
|
1854
|
+
})
|
|
1855
|
+
)?.trim();
|
|
1856
|
+
if (!input) return;
|
|
1857
|
+
await this.#handleGoalBudgetCommand(input);
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
async #pauseGoalAction(): Promise<void> {
|
|
1861
|
+
if (!this.goalModeEnabled) {
|
|
1862
|
+
this.showWarning("No active goal to pause.");
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
await this.session.goalRuntime.pauseGoal();
|
|
1866
|
+
await this.#exitGoalMode({ paused: true, reason: "paused" });
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
async #resumeGoalAction(): Promise<void> {
|
|
1870
|
+
if (!this.#getPausedGoalState()) {
|
|
1871
|
+
this.showWarning("No paused goal to resume.");
|
|
1872
|
+
return;
|
|
1873
|
+
}
|
|
1874
|
+
await this.#enterGoalMode({ resume: true, silent: true });
|
|
1875
|
+
this.showStatus("Goal mode resumed.");
|
|
1876
|
+
this.#scheduleGoalContinuation();
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
async #confirmAndDropGoal(): Promise<void> {
|
|
1880
|
+
if (!this.goalModeEnabled && !this.#getPausedGoalState()) {
|
|
1881
|
+
this.showWarning("No goal to drop.");
|
|
1882
|
+
return;
|
|
1883
|
+
}
|
|
1884
|
+
const confirmed = await this.showHookConfirm(
|
|
1885
|
+
"Drop goal?",
|
|
1886
|
+
"This removes the goal record. Accumulated usage stays in the session log.",
|
|
1887
|
+
);
|
|
1888
|
+
if (!confirmed) return;
|
|
1889
|
+
await this.session.goalRuntime.dropGoal();
|
|
1890
|
+
await this.#exitGoalMode({ reason: "dropped" });
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
async #startGoalFromObjective(objective: string): Promise<void> {
|
|
1894
|
+
await this.#enterGoalMode({ objective, silent: true });
|
|
1895
|
+
this.#resetGoalContinuationSuppression();
|
|
1896
|
+
if (this.onInputCallback) {
|
|
1897
|
+
this.onInputCallback(this.startPendingSubmission({ text: objective }));
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
async #replaceGoalFromObjective(objective: string): Promise<void> {
|
|
1902
|
+
const state = await this.session.goalRuntime.replaceGoal({ objective });
|
|
1903
|
+
this.session.setGoalModeState(state);
|
|
1904
|
+
this.goalModeEnabled = true;
|
|
1905
|
+
this.goalModePaused = false;
|
|
1906
|
+
this.#resetGoalContinuationSuppression();
|
|
1907
|
+
this.#updateGoalModeStatus();
|
|
1908
|
+
if (this.session.isStreaming) {
|
|
1909
|
+
await this.session.sendGoalModeContext({ deliverAs: "steer" });
|
|
1910
|
+
}
|
|
1911
|
+
if (this.onInputCallback) {
|
|
1912
|
+
this.onInputCallback(this.startPendingSubmission({ text: objective }));
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
async #handleGoalSetSubcommand(rest: string): Promise<void> {
|
|
1917
|
+
if (!this.goalModeEnabled && this.#getPausedGoalState()) {
|
|
1918
|
+
this.showWarning("Resume the current goal first, or drop it before setting a new objective.");
|
|
1919
|
+
return;
|
|
1920
|
+
}
|
|
1921
|
+
const objective = rest.trim()
|
|
1922
|
+
? rest.trim()
|
|
1923
|
+
: (await this.showHookEditor("Goal objective", undefined, undefined, { promptStyle: true }))?.trim();
|
|
1924
|
+
if (!objective) return;
|
|
1925
|
+
if (this.goalModeEnabled) {
|
|
1926
|
+
await this.#replaceGoalFromObjective(objective);
|
|
1927
|
+
return;
|
|
1928
|
+
}
|
|
1929
|
+
await this.#startGoalFromObjective(objective);
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
async handlePlanApproval(details: PlanApprovalDetails): Promise<void> {
|
|
1933
|
+
if (!this.planModeEnabled) {
|
|
1934
|
+
this.showWarning("Plan mode is not active.");
|
|
1935
|
+
return;
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
// Abort the agent to prevent it from continuing (e.g., re-submitting the
|
|
1939
|
+
// plan) while the popup is showing. The event listener fires asynchronously
|
|
1940
|
+
// (agent's #emit is fire-and-forget), so without this the model sees
|
|
1941
|
+
// "Plan ready for approval." and immediately re-invokes `resolve` in a loop.
|
|
1942
|
+
await this.session.abort({ timeoutMs: INTERACTIVE_ABORT_CLEANUP_TIMEOUT_MS });
|
|
1943
|
+
|
|
1944
|
+
const planFilePath = details.planFilePath || this.planModePlanFilePath || (await this.#getPlanFilePath());
|
|
1945
|
+
this.planModePlanFilePath = planFilePath;
|
|
1946
|
+
const planContent = await this.#readPlanFile(planFilePath);
|
|
1947
|
+
if (!planContent) {
|
|
1948
|
+
this.showError(`Plan file not found at ${planFilePath}`);
|
|
1949
|
+
return;
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
this.#renderPlanPreview(planContent, { append: true });
|
|
1953
|
+
const choice = await this.showHookSelector(
|
|
1954
|
+
"Plan mode - next step",
|
|
1955
|
+
["Approve and execute", "Approve and compact context", "Approve and keep context", "Refine plan"],
|
|
1956
|
+
{
|
|
1957
|
+
helpText: this.#getPlanReviewHelpText(),
|
|
1958
|
+
onExternalEditor: () => void this.#openPlanInExternalEditor(planFilePath),
|
|
1959
|
+
},
|
|
1960
|
+
);
|
|
1961
|
+
|
|
1962
|
+
if (
|
|
1963
|
+
choice === "Approve and execute" ||
|
|
1964
|
+
choice === "Approve and compact context" ||
|
|
1965
|
+
choice === "Approve and keep context"
|
|
1966
|
+
) {
|
|
1967
|
+
const finalPlanFilePath = details.finalPlanFilePath || planFilePath;
|
|
1968
|
+
try {
|
|
1969
|
+
const latestPlanContent = await this.#readPlanFile(planFilePath);
|
|
1970
|
+
if (!latestPlanContent) {
|
|
1971
|
+
this.showError(`Plan file not found at ${planFilePath}`);
|
|
1972
|
+
return;
|
|
1973
|
+
}
|
|
1974
|
+
await this.#approvePlan(latestPlanContent, {
|
|
1975
|
+
planFilePath,
|
|
1976
|
+
finalPlanFilePath,
|
|
1977
|
+
title: details.title,
|
|
1978
|
+
preserveContext: choice !== "Approve and execute",
|
|
1979
|
+
compactBeforeExecute: choice === "Approve and compact context",
|
|
1980
|
+
});
|
|
1981
|
+
} catch (error) {
|
|
1982
|
+
this.showError(
|
|
1983
|
+
`Failed to finalize approved plan: ${error instanceof Error ? error.message : String(error)}`,
|
|
1984
|
+
);
|
|
1985
|
+
}
|
|
1986
|
+
return;
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
stop(): void {
|
|
1991
|
+
if (this.loadingAnimation) {
|
|
1992
|
+
this.loadingAnimation.stop();
|
|
1993
|
+
this.loadingAnimation = undefined;
|
|
1994
|
+
}
|
|
1995
|
+
this.#cleanupMicAnimation();
|
|
1996
|
+
this.#cancelGoalContinuation();
|
|
1997
|
+
if (this.#sttController) {
|
|
1998
|
+
this.#sttController.dispose();
|
|
1999
|
+
this.#sttController = undefined;
|
|
2000
|
+
}
|
|
2001
|
+
this.#extensionUiController.clearExtensionTerminalInputListeners();
|
|
2002
|
+
this.#extensionUiController.clearHookWidgets();
|
|
2003
|
+
for (const unsubscribe of this.#eventBusUnsubscribers) {
|
|
2004
|
+
unsubscribe();
|
|
2005
|
+
}
|
|
2006
|
+
this.#eventBusUnsubscribers = [];
|
|
2007
|
+
this.#observerRegistry.dispose();
|
|
2008
|
+
this.#eventController.dispose();
|
|
2009
|
+
this.statusLine.dispose();
|
|
2010
|
+
if (this.#resizeHandler) {
|
|
2011
|
+
process.stdout.removeListener("resize", this.#resizeHandler);
|
|
2012
|
+
this.#resizeHandler = undefined;
|
|
2013
|
+
}
|
|
2014
|
+
if (this.unsubscribe) {
|
|
2015
|
+
this.unsubscribe();
|
|
2016
|
+
}
|
|
2017
|
+
if (this.#cleanupUnsubscribe) {
|
|
2018
|
+
this.#cleanupUnsubscribe();
|
|
2019
|
+
}
|
|
2020
|
+
if (this.isInitialized) {
|
|
2021
|
+
this.ui.stop();
|
|
2022
|
+
this.isInitialized = false;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
async shutdown(): Promise<void> {
|
|
2027
|
+
if (this.#isShuttingDown) return;
|
|
2028
|
+
this.#isShuttingDown = true;
|
|
2029
|
+
|
|
2030
|
+
// Snapshot the editor before any teardown empties it. Persisting the draft
|
|
2031
|
+
// here covers Ctrl+D shutdown with non-empty text; for /exit the editor is
|
|
2032
|
+
// already cleared so saveDraft("") just removes any stale sidecar.
|
|
2033
|
+
const draftText = this.editor.getText();
|
|
2034
|
+
|
|
2035
|
+
// Flush pending session writes before shutdown
|
|
2036
|
+
await this.sessionManager.flush();
|
|
2037
|
+
try {
|
|
2038
|
+
await this.sessionManager.saveDraft(draftText);
|
|
2039
|
+
} catch (err) {
|
|
2040
|
+
logger.warn("Failed to save session draft", { error: String(err) });
|
|
2041
|
+
}
|
|
2042
|
+
this.#btwController.dispose();
|
|
2043
|
+
|
|
2044
|
+
// Emit shutdown event to hooks
|
|
2045
|
+
await this.session.dispose();
|
|
2046
|
+
|
|
2047
|
+
if (this.isInitialized) {
|
|
2048
|
+
this.ui.requestRender(true);
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
// Wait for any pending renders to complete
|
|
2052
|
+
// requestRender() uses process.nextTick(), so we wait one tick
|
|
2053
|
+
await new Promise(resolve => process.nextTick(resolve));
|
|
2054
|
+
|
|
2055
|
+
// Drain any in-flight Kitty key release events before stopping.
|
|
2056
|
+
// This prevents escape sequences from leaking to the parent shell over slow SSH.
|
|
2057
|
+
await this.ui.terminal.drainInput(1000);
|
|
2058
|
+
popTerminalTitle();
|
|
2059
|
+
this.stop();
|
|
2060
|
+
|
|
2061
|
+
// Print resumption hint if this is a persisted session
|
|
2062
|
+
const sessionId = this.sessionManager.getSessionId();
|
|
2063
|
+
const sessionFile = this.sessionManager.getSessionFile();
|
|
2064
|
+
if (sessionId && sessionFile) {
|
|
2065
|
+
process.stderr.write(`\n${chalk.dim(`Resume this session with ${APP_NAME} --resume ${sessionId}`)}\n`);
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
await postmortem.quit(0);
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
async checkShutdownRequested(): Promise<void> {
|
|
2072
|
+
if (!this.shutdownRequested) return;
|
|
2073
|
+
await this.shutdown();
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
// Extension UI integration
|
|
2077
|
+
setToolUIContext(uiContext: ExtensionUIContext, hasUI: boolean): void {
|
|
2078
|
+
this.#toolUiContextSetter(uiContext, hasUI);
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
initializeHookRunner(uiContext: ExtensionUIContext, hasUI: boolean): void {
|
|
2082
|
+
this.#extensionUiController.initializeHookRunner(uiContext, hasUI);
|
|
2083
|
+
}
|
|
2084
|
+
createBackgroundUiContext(): ExtensionUIContext {
|
|
2085
|
+
return this.#extensionUiController.createBackgroundUiContext();
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
setEditorComponent(
|
|
2089
|
+
factory: ((tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager) => CustomEditor) | undefined,
|
|
2090
|
+
): void {
|
|
2091
|
+
const previousEditor = this.editor;
|
|
2092
|
+
const previousText = previousEditor.getText();
|
|
2093
|
+
const nextEditor = factory
|
|
2094
|
+
? factory(this.ui, getEditorTheme(), this.keybindings)
|
|
2095
|
+
: new CustomEditor(getEditorTheme());
|
|
2096
|
+
|
|
2097
|
+
configureDefaultComposerChrome(nextEditor);
|
|
2098
|
+
nextEditor.setUseTerminalCursor(this.ui.getShowHardwareCursor());
|
|
2099
|
+
nextEditor.setAutocompleteMaxVisible(this.settings.get("autocompleteMaxVisible"));
|
|
2100
|
+
nextEditor.onAutocompleteCancel = () => {
|
|
2101
|
+
this.ui.requestRender(true);
|
|
2102
|
+
};
|
|
2103
|
+
nextEditor.onAutocompleteUpdate = () => {
|
|
2104
|
+
this.ui.requestRender();
|
|
2105
|
+
};
|
|
2106
|
+
nextEditor.setMaxHeight(this.#computeEditorMaxHeight());
|
|
2107
|
+
if (this.historyStorage) {
|
|
2108
|
+
nextEditor.setHistoryStorage(this.historyStorage);
|
|
2109
|
+
}
|
|
2110
|
+
nextEditor.setText(previousText);
|
|
2111
|
+
|
|
2112
|
+
this.editorContainer.clear();
|
|
2113
|
+
this.editor = nextEditor;
|
|
2114
|
+
this.editorContainer.addChild(nextEditor);
|
|
2115
|
+
this.ui.setFocus(nextEditor);
|
|
2116
|
+
|
|
2117
|
+
this.#inputController.setupKeyHandlers();
|
|
2118
|
+
this.#inputController.setupEditorSubmitHandler();
|
|
2119
|
+
|
|
2120
|
+
void this.refreshSlashCommandState().catch(error => {
|
|
2121
|
+
logger.warn("Failed to refresh slash command state for custom editor", { error: String(error) });
|
|
2122
|
+
});
|
|
2123
|
+
|
|
2124
|
+
this.updateEditorBorderColor();
|
|
2125
|
+
this.updateEditorTopBorder();
|
|
2126
|
+
this.ui.requestRender();
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
// Event handling
|
|
2130
|
+
async handleBackgroundEvent(event: AgentSessionEvent): Promise<void> {
|
|
2131
|
+
await this.#eventController.handleBackgroundEvent(event);
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
// UI helpers
|
|
2135
|
+
showStatus(message: string, options?: { dim?: boolean }): void {
|
|
2136
|
+
this.#uiHelpers.showStatus(message, options);
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
showError(message: string): void {
|
|
2140
|
+
this.#pendingSubmittedInput = undefined;
|
|
2141
|
+
this.optimisticUserMessageSignature = undefined;
|
|
2142
|
+
this.#pendingSubmissionDispose?.();
|
|
2143
|
+
this.#pendingSubmissionDispose = undefined;
|
|
2144
|
+
this.#pendingWorkingMessage = undefined;
|
|
2145
|
+
if (this.loadingAnimation) {
|
|
2146
|
+
this.loadingAnimation.stop();
|
|
2147
|
+
this.loadingAnimation = undefined;
|
|
2148
|
+
this.statusContainer.clear();
|
|
2149
|
+
}
|
|
2150
|
+
this.#uiHelpers.showError(message);
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
showWarning(message: string): void {
|
|
2154
|
+
this.#uiHelpers.showWarning(message);
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
#handleLspStartupEvent(event: LspStartupEvent): void {
|
|
2158
|
+
this.#updateWelcomeLspServers();
|
|
2159
|
+
|
|
2160
|
+
if (event.type === "failed") {
|
|
2161
|
+
this.showWarning(`LSP startup failed: ${event.error}. It will retry lazily on write.`);
|
|
2162
|
+
return;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
const failedServers = event.servers.filter(server => server.status === "error");
|
|
2166
|
+
|
|
2167
|
+
if (failedServers.length === 1) {
|
|
2168
|
+
const failedServer = failedServers[0];
|
|
2169
|
+
const detail = failedServer.error ? `: ${failedServer.error}` : "";
|
|
2170
|
+
this.showWarning(`LSP startup failed for ${failedServer.name}${detail}. It will retry lazily on write.`);
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
if (failedServers.length > 1) {
|
|
2175
|
+
const failedNames = failedServers.map(server => server.name).join(", ");
|
|
2176
|
+
this.showWarning(`LSP startup failed for ${failedNames}. It will retry lazily on write.`);
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
#getWelcomeLspServers(): WelcomeLspServerInfo[] {
|
|
2181
|
+
return (
|
|
2182
|
+
this.lspServers?.map(server => ({
|
|
2183
|
+
name: server.name,
|
|
2184
|
+
status: server.status,
|
|
2185
|
+
fileTypes: server.fileTypes,
|
|
2186
|
+
})) ?? []
|
|
2187
|
+
);
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
#updateWelcomeLspServers(): void {
|
|
2191
|
+
if (!this.#welcomeComponent) {
|
|
2192
|
+
return;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
this.#welcomeComponent.setLspServers(this.#getWelcomeLspServers());
|
|
2196
|
+
this.ui.requestRender();
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
#getWorkingMessageAccent(): WorkingMessageAccent | undefined {
|
|
2200
|
+
const accentEnabled = !isSettingsInitialized() || settings.get("statusLine.sessionAccent") !== false;
|
|
2201
|
+
const sessionName = accentEnabled ? this.sessionManager.getSessionName() : undefined;
|
|
2202
|
+
if (!sessionName) return undefined;
|
|
2203
|
+
const hex = getSessionAccentHex(sessionName);
|
|
2204
|
+
const main = getSessionAccentAnsi(hex);
|
|
2205
|
+
const dim = getSessionAccentAnsi(adjustHsv(hex, { s: 0.55, v: 0.65 }));
|
|
2206
|
+
return main && dim ? { main, dim } : undefined;
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
ensureLoadingAnimation(): void {
|
|
2210
|
+
if (!this.loadingAnimation) {
|
|
2211
|
+
this.statusContainer.clear();
|
|
2212
|
+
this.loadingAnimation = new Loader(
|
|
2213
|
+
this.ui,
|
|
2214
|
+
spinner => {
|
|
2215
|
+
const accent = this.#getWorkingMessageAccent();
|
|
2216
|
+
return accent ? `${accent.main}${spinner}\x1b[39m` : theme.fg("accent", spinner);
|
|
2217
|
+
},
|
|
2218
|
+
message => renderWorkingMessage(message, this.#getWorkingMessageAccent()),
|
|
2219
|
+
this.#defaultWorkingMessage,
|
|
2220
|
+
getSymbolTheme().spinnerFrames,
|
|
2221
|
+
);
|
|
2222
|
+
this.statusContainer.addChild(this.loadingAnimation);
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
this.applyPendingWorkingMessage();
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
setWorkingMessage(message?: string): void {
|
|
2229
|
+
if (message === undefined) {
|
|
2230
|
+
this.#pendingWorkingMessage = undefined;
|
|
2231
|
+
if (this.loadingAnimation) {
|
|
2232
|
+
this.loadingAnimation.setMessage(this.#defaultWorkingMessage);
|
|
2233
|
+
}
|
|
2234
|
+
return;
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
if (this.loadingAnimation) {
|
|
2238
|
+
this.loadingAnimation.setMessage(message);
|
|
2239
|
+
return;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
this.#pendingWorkingMessage = message;
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
applyPendingWorkingMessage(): void {
|
|
2246
|
+
if (this.#pendingWorkingMessage === undefined) {
|
|
2247
|
+
return;
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
const message = this.#pendingWorkingMessage;
|
|
2251
|
+
this.#pendingWorkingMessage = undefined;
|
|
2252
|
+
this.setWorkingMessage(message);
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
showNewVersionNotification(newVersion: string): void {
|
|
2256
|
+
this.#uiHelpers.showNewVersionNotification(newVersion);
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
clearEditor(): void {
|
|
2260
|
+
this.#uiHelpers.clearEditor();
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
updatePendingMessagesDisplay(): void {
|
|
2264
|
+
this.#uiHelpers.updatePendingMessagesDisplay();
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
queueCompactionMessage(text: string, mode: "steer" | "followUp"): void {
|
|
2268
|
+
this.#uiHelpers.queueCompactionMessage(text, mode);
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
flushCompactionQueue(options?: { willRetry?: boolean }): Promise<void> {
|
|
2272
|
+
return this.#uiHelpers.flushCompactionQueue(options);
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
flushPendingBashComponents(): void {
|
|
2276
|
+
this.#uiHelpers.flushPendingBashComponents();
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
isKnownSlashCommand(text: string): boolean {
|
|
2280
|
+
return this.#uiHelpers.isKnownSlashCommand(text);
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
addMessageToChat(message: AgentMessage, options?: { populateHistory?: boolean }): Component[] {
|
|
2284
|
+
return this.#uiHelpers.addMessageToChat(message, options);
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
renderSessionContext(
|
|
2288
|
+
sessionContext: SessionContext,
|
|
2289
|
+
options?: { updateFooter?: boolean; populateHistory?: boolean },
|
|
2290
|
+
): void {
|
|
2291
|
+
this.#uiHelpers.renderSessionContext(sessionContext, options);
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
renderInitialMessages(prebuiltContext?: SessionContext, options?: { preserveExistingChat?: boolean }): void {
|
|
2295
|
+
this.#uiHelpers.renderInitialMessages(prebuiltContext, options);
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
getUserMessageText(message: Message): string {
|
|
2299
|
+
return this.#uiHelpers.getUserMessageText(message);
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
findLastAssistantMessage(): AssistantMessage | undefined {
|
|
2303
|
+
return this.#uiHelpers.findLastAssistantMessage();
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
extractAssistantText(message: AssistantMessage): string {
|
|
2307
|
+
return this.#uiHelpers.extractAssistantText(message);
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
// Command handling
|
|
2311
|
+
handleExportCommand(text: string): Promise<void> {
|
|
2312
|
+
return this.#commandController.handleExportCommand(text);
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
handleDumpCommand() {
|
|
2316
|
+
return this.#commandController.handleDumpCommand();
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
handleDebugTranscriptCommand(): Promise<void> {
|
|
2320
|
+
return this.#commandController.handleDebugTranscriptCommand();
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
handleShareCommand(): Promise<void> {
|
|
2324
|
+
return this.#commandController.handleShareCommand();
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
handleCopyCommand(sub?: string) {
|
|
2328
|
+
return this.#commandController.handleCopyCommand(sub);
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
handleTodoCommand(args: string): Promise<void> {
|
|
2332
|
+
return this.#todoCommandController.handleTodoCommand(args);
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
handleSessionCommand(): Promise<void> {
|
|
2336
|
+
return this.#commandController.handleSessionCommand();
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
handleJobsCommand(): Promise<void> {
|
|
2340
|
+
return this.#commandController.handleJobsCommand();
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
handleUsageCommand(reports?: UsageReport[] | null): Promise<void> {
|
|
2344
|
+
return this.#commandController.handleUsageCommand(reports);
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
async handleChangelogCommand(showFull = false): Promise<void> {
|
|
2348
|
+
await this.#commandController.handleChangelogCommand(showFull);
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
handleHotkeysCommand(): void {
|
|
2352
|
+
this.#commandController.handleHotkeysCommand();
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
handleToolsCommand(): void {
|
|
2356
|
+
this.#commandController.handleToolsCommand();
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
handleContextCommand(): void {
|
|
2360
|
+
this.#commandController.handleContextCommand();
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
#prepareSessionSwitch(): void {
|
|
2364
|
+
this.#btwController.dispose();
|
|
2365
|
+
this.#extensionUiController.clearExtensionTerminalInputListeners();
|
|
2366
|
+
this.#planReviewContainer = undefined;
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
handleClearCommand(): Promise<void> {
|
|
2370
|
+
this.#prepareSessionSwitch();
|
|
2371
|
+
return this.#commandController.handleClearCommand();
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2374
|
+
handleDropCommand(): Promise<void> {
|
|
2375
|
+
this.#prepareSessionSwitch();
|
|
2376
|
+
return this.#commandController.handleDropCommand();
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
handleForkCommand(): Promise<void> {
|
|
2380
|
+
this.#btwController.dispose();
|
|
2381
|
+
return this.#commandController.handleForkCommand();
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
handleMoveCommand(targetPath: string): Promise<void> {
|
|
2385
|
+
return this.#commandController.handleMoveCommand(targetPath);
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
handleRenameCommand(title: string): Promise<void> {
|
|
2389
|
+
return this.#commandController.handleRenameCommand(title);
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
handleMemoryCommand(text: string): Promise<void> {
|
|
2393
|
+
return this.#commandController.handleMemoryCommand(text);
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
async handleSTTToggle(): Promise<void> {
|
|
2397
|
+
if (!settings.get("stt.enabled")) {
|
|
2398
|
+
this.showWarning("Speech-to-text is disabled. Enable it in settings: stt.enabled");
|
|
2399
|
+
return;
|
|
2400
|
+
}
|
|
2401
|
+
if (!this.#sttController) {
|
|
2402
|
+
this.#sttController = new STTController();
|
|
2403
|
+
}
|
|
2404
|
+
await this.#sttController.toggle(this.editor, {
|
|
2405
|
+
showWarning: (msg: string) => this.showWarning(msg),
|
|
2406
|
+
showStatus: (msg: string) => this.showStatus(msg),
|
|
2407
|
+
onStateChange: (state: SttState) => {
|
|
2408
|
+
if (state === "recording") {
|
|
2409
|
+
this.#voicePreviousShowHardwareCursor = this.ui.getShowHardwareCursor();
|
|
2410
|
+
this.#voicePreviousUseTerminalCursor = this.editor.getUseTerminalCursor();
|
|
2411
|
+
this.ui.setShowHardwareCursor(false);
|
|
2412
|
+
this.editor.setUseTerminalCursor(false);
|
|
2413
|
+
this.#startMicAnimation();
|
|
2414
|
+
} else if (state === "transcribing") {
|
|
2415
|
+
this.#stopMicAnimation();
|
|
2416
|
+
this.#setMicCursor({ r: 200, g: 200, b: 200 });
|
|
2417
|
+
} else {
|
|
2418
|
+
this.#cleanupMicAnimation();
|
|
2419
|
+
}
|
|
2420
|
+
this.updateEditorTopBorder();
|
|
2421
|
+
this.ui.requestRender();
|
|
2422
|
+
},
|
|
2423
|
+
});
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
#setMicCursor(color: { r: number; g: number; b: number }): void {
|
|
2427
|
+
this.editor.cursorOverride = `\x1b[38;2;${color.r};${color.g};${color.b}m${theme.icon.mic}\x1b[0m`;
|
|
2428
|
+
// Theme symbols can be wide (for example, 🎤), so measure the rendered override.
|
|
2429
|
+
this.editor.cursorOverrideWidth = visibleWidth(this.editor.cursorOverride);
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
#updateMicIcon(): void {
|
|
2433
|
+
const { r, g, b } = hsvToRgb({ h: this.#voiceHue, s: 0.9, v: 1.0 });
|
|
2434
|
+
this.#setMicCursor({ r, g, b });
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
#startMicAnimation(): void {
|
|
2438
|
+
if (this.#voiceAnimationInterval) return;
|
|
2439
|
+
this.#voiceHue = 0;
|
|
2440
|
+
this.#updateMicIcon();
|
|
2441
|
+
this.#voiceAnimationInterval = setInterval(() => {
|
|
2442
|
+
this.#voiceHue = (this.#voiceHue + 8) % 360;
|
|
2443
|
+
this.#updateMicIcon();
|
|
2444
|
+
this.ui.requestRender();
|
|
2445
|
+
}, 60);
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
#stopMicAnimation(): void {
|
|
2449
|
+
if (this.#voiceAnimationInterval) {
|
|
2450
|
+
clearInterval(this.#voiceAnimationInterval);
|
|
2451
|
+
this.#voiceAnimationInterval = undefined;
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
#cleanupMicAnimation(): void {
|
|
2456
|
+
if (this.#voiceAnimationInterval) {
|
|
2457
|
+
clearInterval(this.#voiceAnimationInterval);
|
|
2458
|
+
this.#voiceAnimationInterval = undefined;
|
|
2459
|
+
}
|
|
2460
|
+
this.editor.cursorOverride = undefined;
|
|
2461
|
+
this.editor.cursorOverrideWidth = undefined;
|
|
2462
|
+
if (this.#voicePreviousShowHardwareCursor !== null) {
|
|
2463
|
+
this.ui.setShowHardwareCursor(this.#voicePreviousShowHardwareCursor);
|
|
2464
|
+
this.#voicePreviousShowHardwareCursor = null;
|
|
2465
|
+
}
|
|
2466
|
+
if (this.#voicePreviousUseTerminalCursor !== null) {
|
|
2467
|
+
this.editor.setUseTerminalCursor(this.#voicePreviousUseTerminalCursor);
|
|
2468
|
+
this.#voicePreviousUseTerminalCursor = null;
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
showDebugSelector(): void {
|
|
2473
|
+
this.#selectorController.showDebugSelector();
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
showSessionObserver(): void {
|
|
2477
|
+
const sessions = this.#observerRegistry.getSessions();
|
|
2478
|
+
if (sessions.length <= 1) {
|
|
2479
|
+
this.showStatus("No active subagent sessions");
|
|
2480
|
+
return;
|
|
2481
|
+
}
|
|
2482
|
+
this.#selectorController.showSessionObserver(this.#observerRegistry);
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
resetObserverRegistry(): void {
|
|
2486
|
+
this.#observerRegistry.resetSessions();
|
|
2487
|
+
this.#observerRegistry.setMainSession(this.sessionManager.getSessionFile() ?? undefined);
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
handleBashCommand(command: string, excludeFromContext?: boolean): Promise<void> {
|
|
2491
|
+
return this.#commandController.handleBashCommand(command, excludeFromContext);
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
handlePythonCommand(code: string, excludeFromContext?: boolean): Promise<void> {
|
|
2495
|
+
return this.#commandController.handlePythonCommand(code, excludeFromContext);
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
async handleMCPCommand(_text: string): Promise<void> {
|
|
2499
|
+
this.showWarning(`MCP commands are not available in ${APP_NAME}.`);
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
async handleSSHCommand(text: string): Promise<void> {
|
|
2503
|
+
const controller = new SSHCommandController(this);
|
|
2504
|
+
await controller.handle(text);
|
|
2505
|
+
}
|
|
2506
|
+
|
|
2507
|
+
handleCompactCommand(customInstructions?: string): Promise<CompactionOutcome> {
|
|
2508
|
+
return this.#commandController.handleCompactCommand(customInstructions);
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
handleHandoffCommand(customInstructions?: string): Promise<void> {
|
|
2512
|
+
return this.#commandController.handleHandoffCommand(customInstructions);
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
executeCompaction(
|
|
2516
|
+
customInstructionsOrOptions?: string | CompactOptions,
|
|
2517
|
+
isAuto?: boolean,
|
|
2518
|
+
): Promise<CompactionOutcome> {
|
|
2519
|
+
return this.#commandController.executeCompaction(customInstructionsOrOptions, isAuto);
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
openInBrowser(urlOrPath: string): void {
|
|
2523
|
+
this.#commandController.openInBrowser(urlOrPath);
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
// Selector handling
|
|
2527
|
+
showSettingsSelector(): void {
|
|
2528
|
+
this.#selectorController.showSettingsSelector();
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
showHistorySearch(): void {
|
|
2532
|
+
this.#selectorController.showHistorySearch();
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
showExtensionsDashboard(): void {
|
|
2536
|
+
void this.#selectorController.showExtensionsDashboard();
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
showAgentsDashboard(): void {
|
|
2540
|
+
void this.#selectorController.showAgentsDashboard();
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
showModelSelector(options?: { temporaryOnly?: boolean }): void {
|
|
2544
|
+
this.#selectorController.showModelSelector(options);
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
showProviderOnboarding(): void {
|
|
2548
|
+
this.#selectorController.showProviderOnboarding();
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
showPluginSelector(mode?: "install" | "uninstall"): void {
|
|
2552
|
+
void this.#selectorController.showPluginSelector(mode);
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
showUserMessageSelector(): void {
|
|
2556
|
+
this.#selectorController.showUserMessageSelector();
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
showTreeSelector(): void {
|
|
2560
|
+
this.#selectorController.showTreeSelector();
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
showSessionSelector(): void {
|
|
2564
|
+
this.#selectorController.showSessionSelector();
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
handleResumeSession(sessionPath: string): Promise<void> {
|
|
2568
|
+
this.#btwController.dispose();
|
|
2569
|
+
this.resetObserverRegistry();
|
|
2570
|
+
return this.#selectorController.handleResumeSession(sessionPath);
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
handleSessionDeleteCommand(): Promise<void> {
|
|
2574
|
+
return this.#selectorController.handleSessionDeleteCommand();
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
showOAuthSelector(mode: "login" | "logout", providerId?: string): Promise<void> {
|
|
2578
|
+
return this.#selectorController.showOAuthSelector(mode, providerId);
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
showHookConfirm(title: string, message: string): Promise<boolean> {
|
|
2582
|
+
return this.#extensionUiController.showHookConfirm(title, message);
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
// Input handling
|
|
2586
|
+
handleCtrlC(): void {
|
|
2587
|
+
this.#inputController.handleCtrlC();
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
handleCtrlD(): void {
|
|
2591
|
+
this.#inputController.handleCtrlD();
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
handleCtrlZ(): void {
|
|
2595
|
+
this.#inputController.handleCtrlZ();
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
handleDequeue(): void {
|
|
2599
|
+
this.#inputController.handleDequeue();
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
handleBackgroundCommand(): void {
|
|
2603
|
+
this.#inputController.handleBackgroundCommand();
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
handleImagePaste(): Promise<boolean> {
|
|
2607
|
+
return this.#inputController.handleImagePaste();
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
handleBtwCommand(question: string): Promise<void> {
|
|
2611
|
+
return this.#btwController.start(question);
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
hasActiveBtw(): boolean {
|
|
2615
|
+
return this.#btwController.hasActiveRequest();
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
handleBtwEscape(): boolean {
|
|
2619
|
+
return this.#btwController.handleEscape();
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2622
|
+
cycleThinkingLevel(): void {
|
|
2623
|
+
this.#inputController.cycleThinkingLevel();
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
cycleRoleModel(options?: { temporary?: boolean }): Promise<void> {
|
|
2627
|
+
return this.#inputController.cycleRoleModel(options);
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
toggleToolOutputExpansion(): void {
|
|
2631
|
+
this.#inputController.toggleToolOutputExpansion();
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
setToolsExpanded(expanded: boolean): void {
|
|
2635
|
+
this.#inputController.setToolsExpanded(expanded);
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
toggleThinkingBlockVisibility(): void {
|
|
2639
|
+
this.#inputController.toggleThinkingBlockVisibility();
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
toggleTodoExpansion(): void {
|
|
2643
|
+
this.todoExpanded = !this.todoExpanded;
|
|
2644
|
+
this.#renderTodoList();
|
|
2645
|
+
this.ui.requestRender();
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
setTodos(todos: TodoItem[] | TodoPhase[]): void {
|
|
2649
|
+
if (todos.length > 0 && "tasks" in todos[0]) {
|
|
2650
|
+
this.todoPhases = todos as TodoPhase[];
|
|
2651
|
+
} else {
|
|
2652
|
+
this.todoPhases = [
|
|
2653
|
+
{
|
|
2654
|
+
name: "Todos",
|
|
2655
|
+
tasks: todos as TodoItem[],
|
|
2656
|
+
},
|
|
2657
|
+
];
|
|
2658
|
+
}
|
|
2659
|
+
this.#renderTodoList();
|
|
2660
|
+
this.ui.requestRender();
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
async reloadTodos(): Promise<void> {
|
|
2664
|
+
await this.#loadTodoList();
|
|
2665
|
+
this.ui.requestRender();
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2668
|
+
openExternalEditor(): void {
|
|
2669
|
+
this.#inputController.openExternalEditor();
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
registerExtensionShortcuts(): void {
|
|
2673
|
+
this.#inputController.registerExtensionShortcuts();
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2676
|
+
// Hook UI methods
|
|
2677
|
+
initHooksAndCustomTools(): Promise<void> {
|
|
2678
|
+
return this.#extensionUiController.initHooksAndCustomTools();
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
emitCustomToolSessionEvent(
|
|
2682
|
+
reason: "start" | "switch" | "branch" | "tree" | "shutdown",
|
|
2683
|
+
previousSessionFile?: string,
|
|
2684
|
+
): Promise<void> {
|
|
2685
|
+
return this.#extensionUiController.emitCustomToolSessionEvent(reason, previousSessionFile);
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
setHookWidget(key: string, content: ExtensionWidgetContent, options?: ExtensionWidgetOptions): void {
|
|
2689
|
+
this.#extensionUiController.setHookWidget(key, content, options);
|
|
2690
|
+
}
|
|
2691
|
+
|
|
2692
|
+
setHookStatus(key: string, text: string | undefined): void {
|
|
2693
|
+
this.#extensionUiController.setHookStatus(key, text);
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
showHookSelector(
|
|
2697
|
+
title: string,
|
|
2698
|
+
options: string[],
|
|
2699
|
+
dialogOptions?: ExtensionUIDialogOptions,
|
|
2700
|
+
): Promise<string | undefined> {
|
|
2701
|
+
return this.#extensionUiController.showHookSelector(title, options, dialogOptions);
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2704
|
+
hideHookSelector(): void {
|
|
2705
|
+
this.#extensionUiController.hideHookSelector();
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
showHookInput(title: string, placeholder?: string): Promise<string | undefined> {
|
|
2709
|
+
return this.#extensionUiController.showHookInput(title, placeholder);
|
|
2710
|
+
}
|
|
2711
|
+
|
|
2712
|
+
hideHookInput(): void {
|
|
2713
|
+
this.#extensionUiController.hideHookInput();
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
showHookEditor(
|
|
2717
|
+
title: string,
|
|
2718
|
+
prefill?: string,
|
|
2719
|
+
dialogOptions?: ExtensionUIDialogOptions,
|
|
2720
|
+
editorOptions?: { promptStyle?: boolean },
|
|
2721
|
+
): Promise<string | undefined> {
|
|
2722
|
+
return this.#extensionUiController.showHookEditor(title, prefill, dialogOptions, editorOptions);
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
hideHookEditor(): void {
|
|
2726
|
+
this.#extensionUiController.hideHookEditor();
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
showHookNotify(message: string, type?: "info" | "warning" | "error"): void {
|
|
2730
|
+
this.#extensionUiController.showHookNotify(message, type);
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
showHookCustom<T>(
|
|
2734
|
+
factory: (
|
|
2735
|
+
tui: TUI,
|
|
2736
|
+
theme: Theme,
|
|
2737
|
+
keybindings: KeybindingsManager,
|
|
2738
|
+
done: (result: T) => void,
|
|
2739
|
+
) => (Component & { dispose?(): void }) | Promise<Component & { dispose?(): void }>,
|
|
2740
|
+
options?: { overlay?: boolean },
|
|
2741
|
+
): Promise<T> {
|
|
2742
|
+
return this.#extensionUiController.showHookCustom(factory, options);
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
showExtensionError(extensionPath: string, error: string): void {
|
|
2746
|
+
this.#extensionUiController.showExtensionError(extensionPath, error);
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
showToolError(toolName: string, error: string): void {
|
|
2750
|
+
this.#extensionUiController.showToolError(toolName, error);
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
#subscribeToAgent(): void {
|
|
2754
|
+
this.#eventController.subscribeToAgent();
|
|
2755
|
+
}
|
|
2756
|
+
}
|