gsd-pi 2.34.0 → 2.35.0-dev.39eee32
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/dist/cli.js +7 -2
- package/dist/resource-loader.d.ts +1 -1
- package/dist/resource-loader.js +13 -1
- package/dist/resources/extensions/async-jobs/await-tool.js +0 -2
- package/dist/resources/extensions/async-jobs/job-manager.js +0 -6
- package/dist/resources/extensions/bg-shell/output-formatter.js +1 -19
- package/dist/resources/extensions/bg-shell/process-manager.js +0 -4
- package/dist/resources/extensions/bg-shell/types.js +0 -2
- package/dist/resources/extensions/context7/index.js +5 -0
- package/dist/resources/extensions/get-secrets-from-user.js +2 -30
- package/dist/resources/extensions/google-search/index.js +5 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +43 -1
- package/dist/resources/extensions/gsd/auto-loop.js +10 -1
- package/dist/resources/extensions/gsd/auto-recovery.js +35 -0
- package/dist/resources/extensions/gsd/auto-start.js +35 -2
- package/dist/resources/extensions/gsd/auto.js +59 -4
- package/dist/resources/extensions/gsd/changelog.js +162 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +1 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +2 -2
- package/dist/resources/extensions/gsd/commands-inspect.js +10 -3
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +5 -1
- package/dist/resources/extensions/gsd/commands.js +8 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/dist/resources/extensions/gsd/doctor-checks.js +113 -5
- package/dist/resources/extensions/gsd/doctor-environment.js +26 -17
- package/dist/resources/extensions/gsd/doctor-proactive.js +22 -0
- package/dist/resources/extensions/gsd/doctor.js +36 -0
- package/dist/resources/extensions/gsd/files.js +11 -2
- package/dist/resources/extensions/gsd/gitignore.js +54 -7
- package/dist/resources/extensions/gsd/guided-flow.js +5 -3
- package/dist/resources/extensions/gsd/health-widget-core.js +96 -0
- package/dist/resources/extensions/gsd/health-widget.js +97 -46
- package/dist/resources/extensions/gsd/index.js +10 -1
- package/dist/resources/extensions/gsd/migrate-external.js +55 -2
- package/dist/resources/extensions/gsd/milestone-ids.js +3 -2
- package/dist/resources/extensions/gsd/paths.js +74 -7
- package/dist/resources/extensions/gsd/post-unit-hooks.js +4 -1
- package/dist/resources/extensions/gsd/preferences-validation.js +54 -1
- package/dist/resources/extensions/gsd/preferences.js +2 -0
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
- package/dist/resources/extensions/gsd/roadmap-mutations.js +55 -0
- package/dist/resources/extensions/gsd/session-lock.js +26 -2
- package/dist/resources/extensions/gsd/state.js +2 -1
- package/dist/resources/extensions/gsd/templates/plan.md +8 -0
- package/dist/resources/extensions/gsd/worktree-resolver.js +12 -0
- package/dist/resources/extensions/mcp-client/index.js +2 -1
- package/dist/resources/extensions/remote-questions/remote-command.js +2 -22
- package/dist/resources/extensions/shared/mod.js +1 -1
- package/dist/resources/extensions/shared/sanitize.js +30 -0
- package/dist/resources/extensions/subagent/index.js +6 -14
- package/dist/resources/skills/create-gsd-extension/references/events-reference.md +4 -4
- package/package.json +2 -1
- package/packages/native/dist/native.d.ts +0 -2
- package/packages/native/dist/native.js +0 -2
- package/packages/native/src/native.ts +0 -3
- package/packages/pi-agent-core/dist/agent-loop.d.ts +14 -0
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +24 -27
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/agent.d.ts +1 -0
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent.js +11 -22
- package/packages/pi-agent-core/dist/agent.js.map +1 -1
- package/packages/pi-agent-core/dist/proxy.d.ts +1 -25
- package/packages/pi-agent-core/dist/proxy.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/proxy.js +3 -9
- package/packages/pi-agent-core/dist/proxy.js.map +1 -1
- package/packages/pi-agent-core/src/agent-loop.ts +30 -27
- package/packages/pi-agent-core/src/agent.ts +12 -23
- package/packages/pi-agent-core/src/proxy.ts +3 -9
- package/packages/pi-ai/dist/api-registry.d.ts +0 -2
- package/packages/pi-ai/dist/api-registry.d.ts.map +1 -1
- package/packages/pi-ai/dist/api-registry.js +0 -10
- package/packages/pi-ai/dist/api-registry.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts +0 -8
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.js +5 -41
- package/packages/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts +0 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.js +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts +1 -43
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.js +2 -2
- package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.d.ts +0 -4
- package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +10 -73
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.js +9 -80
- package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-shared.d.ts +65 -0
- package/packages/pi-ai/dist/providers/openai-shared.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-shared.js +146 -0
- package/packages/pi-ai/dist/providers/openai-shared.js.map +1 -0
- package/packages/pi-ai/dist/providers/register-builtins.d.ts +0 -1
- package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -1
- package/packages/pi-ai/dist/utils/event-stream.d.ts +0 -2
- package/packages/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/event-stream.js +0 -4
- package/packages/pi-ai/dist/utils/event-stream.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js +7 -135
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js +7 -135
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.d.ts +46 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.js +160 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.js.map +1 -0
- package/packages/pi-ai/dist/utils/overflow.d.ts +0 -4
- package/packages/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/overflow.js +0 -6
- package/packages/pi-ai/dist/utils/overflow.js.map +1 -1
- package/packages/pi-ai/dist/utils/validation.d.ts +0 -8
- package/packages/pi-ai/dist/utils/validation.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/validation.js +0 -14
- package/packages/pi-ai/dist/utils/validation.js.map +1 -1
- package/packages/pi-ai/src/api-registry.ts +0 -12
- package/packages/pi-ai/src/providers/anthropic.ts +1 -1
- package/packages/pi-ai/src/providers/azure-openai-responses.ts +11 -45
- package/packages/pi-ai/src/providers/github-copilot-headers.ts +1 -1
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +2 -2
- package/packages/pi-ai/src/providers/google-shared.ts +1 -1
- package/packages/pi-ai/src/providers/openai-completions.ts +16 -86
- package/packages/pi-ai/src/providers/openai-responses.ts +16 -96
- package/packages/pi-ai/src/providers/openai-shared.ts +193 -0
- package/packages/pi-ai/src/providers/register-builtins.ts +1 -1
- package/packages/pi-ai/src/utils/event-stream.ts +0 -5
- package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +14 -162
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +13 -161
- package/packages/pi-ai/src/utils/oauth/google-oauth-utils.ts +201 -0
- package/packages/pi-ai/src/utils/overflow.ts +1 -8
- package/packages/pi-ai/src/utils/validation.ts +0 -15
- package/packages/pi-coding-agent/dist/config.d.ts +0 -9
- package/packages/pi-coding-agent/dist/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/config.js +4 -8
- package/packages/pi-coding-agent/dist/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +16 -63
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +104 -641
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +4 -35
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js +5 -43
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +11 -69
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts +40 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.js +78 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts +77 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js +331 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts +0 -4
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +2 -2
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +15 -5
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +129 -256
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +49 -42
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js +2 -21
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts +0 -8
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.js +2 -2
- package/packages/pi-coding-agent/dist/core/keybindings.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lock-utils.d.ts +39 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.js +89 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts +0 -17
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/client.js +3 -62
- package/packages/pi-coding-agent/dist/core/lsp/client.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.js +2 -6
- package/packages/pi-coding-agent/dist/core/lsp/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts +0 -5
- package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.js +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/index.js +52 -107
- package/packages/pi-coding-agent/dist/core/lsp/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js +3 -22
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.js +0 -28
- package/packages/pi-coding-agent/dist/core/lsp/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts +1 -6
- package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/utils.js +1 -28
- package/packages/pi-coding-agent/dist/core/lsp/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.d.ts +0 -8
- package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.js +5 -5
- package/packages/pi-coding-agent/dist/core/messages.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +0 -3
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +1 -3
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts +1 -26
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js +3 -59
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.js +2 -4
- package/packages/pi-coding-agent/dist/core/package-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts +0 -17
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/prompt-templates.js +2 -2
- package/packages/pi-coding-agent/dist/core/prompt-templates.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +2 -4
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.js +46 -60
- package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts +87 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.js +295 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts +0 -5
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +5 -32
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +8 -12
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +78 -168
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.js +1 -3
- package/packages/pi-coding-agent/dist/core/skills.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/migrations.d.ts +0 -16
- package/packages/pi-coding-agent/dist/migrations.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/migrations.js +2 -2
- package/packages/pi-coding-agent/dist/migrations.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +0 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +2 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js +9 -26
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +1 -13
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.d.ts +44 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.js +61 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +6 -9
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +1 -24
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +50 -512
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts +71 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +514 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +65 -4
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +6 -23
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +175 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.d.ts +6 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.js +15 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/print-mode.js +2 -30
- package/packages/pi-coding-agent/dist/modes/print-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js +2 -28
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.d.ts +19 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.js +45 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts +0 -4
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/changelog.js +1 -1
- package/packages/pi-coding-agent/dist/utils/changelog.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts +0 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/error.d.ts +5 -0
- package/packages/pi-coding-agent/dist/utils/error.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/error.js +7 -0
- package/packages/pi-coding-agent/dist/utils/error.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/photon.d.ts +0 -19
- package/packages/pi-coding-agent/dist/utils/photon.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/photon.js +1 -120
- package/packages/pi-coding-agent/dist/utils/photon.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts +0 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.js +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/config.ts +5 -10
- package/packages/pi-coding-agent/src/core/agent-session.ts +117 -745
- package/packages/pi-coding-agent/src/core/auth-storage.ts +4 -38
- package/packages/pi-coding-agent/src/core/compaction/branch-summarization.ts +7 -53
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +14 -74
- package/packages/pi-coding-agent/src/core/compaction/utils.ts +100 -0
- package/packages/pi-coding-agent/src/core/compaction-orchestrator.ts +424 -0
- package/packages/pi-coding-agent/src/core/export-html/ansi-to-html.ts +1 -1
- package/packages/pi-coding-agent/src/core/extensions/index.ts +1 -21
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +119 -256
- package/packages/pi-coding-agent/src/core/extensions/types.ts +50 -69
- package/packages/pi-coding-agent/src/core/keybindings.ts +2 -2
- package/packages/pi-coding-agent/src/core/lock-utils.ts +113 -0
- package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -73
- package/packages/pi-coding-agent/src/core/lsp/config.ts +2 -10
- package/packages/pi-coding-agent/src/core/lsp/edits.ts +1 -1
- package/packages/pi-coding-agent/src/core/lsp/index.ts +83 -152
- package/packages/pi-coding-agent/src/core/lsp/lspmux.ts +3 -23
- package/packages/pi-coding-agent/src/core/lsp/types.ts +0 -29
- package/packages/pi-coding-agent/src/core/lsp/utils.ts +1 -33
- package/packages/pi-coding-agent/src/core/messages.ts +5 -5
- package/packages/pi-coding-agent/src/core/model-registry.ts +0 -2
- package/packages/pi-coding-agent/src/core/model-resolver.ts +3 -77
- package/packages/pi-coding-agent/src/core/package-manager.ts +1 -4
- package/packages/pi-coding-agent/src/core/prompt-templates.ts +2 -2
- package/packages/pi-coding-agent/src/core/resource-loader.ts +56 -69
- package/packages/pi-coding-agent/src/core/retry-handler.ts +359 -0
- package/packages/pi-coding-agent/src/core/session-manager.ts +5 -34
- package/packages/pi-coding-agent/src/core/settings-manager.ts +87 -166
- package/packages/pi-coding-agent/src/core/skills.ts +1 -4
- package/packages/pi-coding-agent/src/index.ts +1 -7
- package/packages/pi-coding-agent/src/migrations.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector-search.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector.ts +17 -29
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +1 -13
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-render-utils.ts +81 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-selector.ts +14 -19
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +50 -561
- package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +653 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +7 -26
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +196 -0
- package/packages/pi-coding-agent/src/modes/interactive/utils/shorten-path.ts +14 -0
- package/packages/pi-coding-agent/src/modes/print-mode.ts +2 -30
- package/packages/pi-coding-agent/src/modes/rpc/rpc-mode.ts +2 -28
- package/packages/pi-coding-agent/src/modes/shared/command-context-actions.ts +53 -0
- package/packages/pi-coding-agent/src/utils/changelog.ts +1 -1
- package/packages/pi-coding-agent/src/utils/clipboard-image.ts +1 -1
- package/packages/pi-coding-agent/src/utils/error.ts +6 -0
- package/packages/pi-coding-agent/src/utils/photon.ts +0 -137
- package/packages/pi-coding-agent/src/utils/tools-manager.ts +1 -1
- package/packages/pi-tui/dist/components/editor.d.ts +0 -10
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/editor.js +1 -1
- package/packages/pi-tui/dist/components/editor.js.map +1 -1
- package/packages/pi-tui/dist/components/markdown.d.ts +5 -0
- package/packages/pi-tui/dist/components/markdown.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/markdown.js +25 -31
- package/packages/pi-tui/dist/components/markdown.js.map +1 -1
- package/packages/pi-tui/dist/keys.d.ts +0 -4
- package/packages/pi-tui/dist/keys.d.ts.map +1 -1
- package/packages/pi-tui/dist/keys.js +94 -162
- package/packages/pi-tui/dist/keys.js.map +1 -1
- package/packages/pi-tui/dist/overlay-layout.d.ts +55 -0
- package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -0
- package/packages/pi-tui/dist/overlay-layout.js +288 -0
- package/packages/pi-tui/dist/overlay-layout.js.map +1 -0
- package/packages/pi-tui/dist/tui.d.ts +0 -22
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +6 -272
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/dist/utils.d.ts +0 -7
- package/packages/pi-tui/dist/utils.d.ts.map +1 -1
- package/packages/pi-tui/dist/utils.js +0 -44
- package/packages/pi-tui/dist/utils.js.map +1 -1
- package/packages/pi-tui/src/components/editor.ts +1 -1
- package/packages/pi-tui/src/components/markdown.ts +25 -29
- package/packages/pi-tui/src/keys.ts +94 -173
- package/packages/pi-tui/src/overlay-layout.ts +372 -0
- package/packages/pi-tui/src/tui.ts +11 -312
- package/packages/pi-tui/src/utils.ts +0 -43
- package/pkg/dist/core/export-html/ansi-to-html.d.ts +0 -4
- package/pkg/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/pkg/dist/core/export-html/ansi-to-html.js +1 -1
- package/pkg/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.d.ts +65 -4
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +6 -23
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts +12 -0
- package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -0
- package/pkg/dist/modes/interactive/theme/themes.js +175 -0
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/async-jobs/await-tool.ts +0 -2
- package/src/resources/extensions/async-jobs/job-manager.ts +0 -7
- package/src/resources/extensions/bg-shell/output-formatter.ts +0 -17
- package/src/resources/extensions/bg-shell/process-manager.ts +0 -4
- package/src/resources/extensions/bg-shell/types.ts +0 -12
- package/src/resources/extensions/context7/index.ts +7 -0
- package/src/resources/extensions/get-secrets-from-user.ts +2 -35
- package/src/resources/extensions/google-search/index.ts +7 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +49 -1
- package/src/resources/extensions/gsd/auto-loop.ts +11 -1
- package/src/resources/extensions/gsd/auto-recovery.ts +39 -0
- package/src/resources/extensions/gsd/auto-start.ts +42 -2
- package/src/resources/extensions/gsd/auto.ts +61 -3
- package/src/resources/extensions/gsd/changelog.ts +213 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +1 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +2 -2
- package/src/resources/extensions/gsd/commands-inspect.ts +10 -3
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +5 -1
- package/src/resources/extensions/gsd/commands.ts +9 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/src/resources/extensions/gsd/doctor-checks.ts +107 -5
- package/src/resources/extensions/gsd/doctor-environment.ts +26 -16
- package/src/resources/extensions/gsd/doctor-proactive.ts +24 -0
- package/src/resources/extensions/gsd/doctor-types.ts +9 -1
- package/src/resources/extensions/gsd/doctor.ts +35 -0
- package/src/resources/extensions/gsd/files.ts +12 -2
- package/src/resources/extensions/gsd/gitignore.ts +54 -7
- package/src/resources/extensions/gsd/guided-flow.ts +5 -3
- package/src/resources/extensions/gsd/health-widget-core.ts +129 -0
- package/src/resources/extensions/gsd/health-widget.ts +103 -59
- package/src/resources/extensions/gsd/index.ts +10 -1
- package/src/resources/extensions/gsd/migrate-external.ts +47 -2
- package/src/resources/extensions/gsd/milestone-ids.ts +3 -2
- package/src/resources/extensions/gsd/paths.ts +73 -7
- package/src/resources/extensions/gsd/post-unit-hooks.ts +5 -1
- package/src/resources/extensions/gsd/preferences-validation.ts +54 -1
- package/src/resources/extensions/gsd/preferences.ts +2 -0
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
- package/src/resources/extensions/gsd/roadmap-mutations.ts +66 -0
- package/src/resources/extensions/gsd/session-lock.ts +29 -2
- package/src/resources/extensions/gsd/state.ts +2 -1
- package/src/resources/extensions/gsd/templates/plan.md +8 -0
- package/src/resources/extensions/gsd/tests/commands-inspect-open-db.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/doctor-git.test.ts +98 -2
- package/src/resources/extensions/gsd/tests/doctor-runtime.test.ts +59 -3
- package/src/resources/extensions/gsd/tests/files-loadfile-eisdir.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/gitignore-tracked-gsd.test.ts +214 -0
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +158 -0
- package/src/resources/extensions/gsd/tests/paths.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +40 -2
- package/src/resources/extensions/gsd/tests/queue-reorder-e2e.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/test-utils.ts +165 -0
- package/src/resources/extensions/gsd/tests/validate-directory.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +32 -0
- package/src/resources/extensions/gsd/worktree-resolver.ts +11 -0
- package/src/resources/extensions/mcp-client/index.ts +2 -1
- package/src/resources/extensions/remote-questions/remote-command.ts +2 -23
- package/src/resources/extensions/shared/mod.ts +1 -1
- package/src/resources/extensions/shared/sanitize.ts +36 -0
- package/src/resources/extensions/subagent/index.ts +6 -12
- package/src/resources/skills/create-gsd-extension/references/events-reference.md +4 -4
- package/dist/resources/extensions/shared/wizard-ui.js +0 -478
- package/packages/pi-coding-agent/dist/modes/interactive/theme/dark.json +0 -85
- package/packages/pi-coding-agent/dist/modes/interactive/theme/light.json +0 -84
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -335
- package/packages/pi-coding-agent/src/modes/interactive/theme/dark.json +0 -85
- package/packages/pi-coding-agent/src/modes/interactive/theme/light.json +0 -84
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.json +0 -335
- package/pkg/dist/modes/interactive/theme/dark.json +0 -85
- package/pkg/dist/modes/interactive/theme/light.json +0 -84
- package/pkg/dist/modes/interactive/theme/theme-schema.json +0 -335
- package/src/resources/extensions/shared/wizard-ui.ts +0 -551
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slash command dispatch and handler implementations extracted from InteractiveMode.
|
|
3
|
+
*
|
|
4
|
+
* The `dispatchSlashCommand` function contains the dispatch logic (routing text
|
|
5
|
+
* to handlers), and individual handler functions implement each command.
|
|
6
|
+
*
|
|
7
|
+
* Handlers that are also invoked from keybindings or other subsystems remain on
|
|
8
|
+
* InteractiveMode and are called through the `SlashCommandContext` interface.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import * as fs from "node:fs";
|
|
12
|
+
import * as os from "node:os";
|
|
13
|
+
import * as path from "node:path";
|
|
14
|
+
import type { ThinkingLevel } from "@gsd/pi-agent-core";
|
|
15
|
+
import type {
|
|
16
|
+
EditorAction,
|
|
17
|
+
EditorComponent,
|
|
18
|
+
MarkdownTheme,
|
|
19
|
+
} from "@gsd/pi-tui";
|
|
20
|
+
import {
|
|
21
|
+
type Component,
|
|
22
|
+
Container,
|
|
23
|
+
Markdown,
|
|
24
|
+
Spacer,
|
|
25
|
+
Text,
|
|
26
|
+
} from "@gsd/pi-tui";
|
|
27
|
+
import { spawn, spawnSync } from "child_process";
|
|
28
|
+
import {
|
|
29
|
+
getShareViewerUrl,
|
|
30
|
+
} from "../../config.js";
|
|
31
|
+
import type { AgentSession } from "../../core/agent-session.js";
|
|
32
|
+
import type { AppAction, KeybindingsManager } from "../../core/keybindings.js";
|
|
33
|
+
import type { SessionManager } from "../../core/session-manager.js";
|
|
34
|
+
import type { SettingsManager } from "../../core/settings-manager.js";
|
|
35
|
+
import { copyToClipboard } from "../../utils/clipboard.js";
|
|
36
|
+
import { getChangelogPath, parseChangelog } from "../../utils/changelog.js";
|
|
37
|
+
import { ArminComponent } from "./components/armin.js";
|
|
38
|
+
import { BorderedLoader } from "./components/bordered-loader.js";
|
|
39
|
+
import { DynamicBorder } from "./components/dynamic-border.js";
|
|
40
|
+
import { appKey, editorKey, formatKeyForDisplay } from "./components/keybinding-hints.js";
|
|
41
|
+
import { SelectSubmenu, THINKING_DESCRIPTIONS } from "./components/settings-selector.js";
|
|
42
|
+
import { theme } from "./theme/theme.js";
|
|
43
|
+
|
|
44
|
+
import type { TUI } from "@gsd/pi-tui";
|
|
45
|
+
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Context interface — the subset of InteractiveMode needed by slash commands
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Provides slash command handlers with access to the parts of InteractiveMode
|
|
52
|
+
* they need without coupling them to the entire class.
|
|
53
|
+
*/
|
|
54
|
+
export interface SlashCommandContext {
|
|
55
|
+
// Core objects
|
|
56
|
+
readonly session: AgentSession;
|
|
57
|
+
readonly ui: TUI;
|
|
58
|
+
readonly keybindings: KeybindingsManager;
|
|
59
|
+
|
|
60
|
+
// Containers
|
|
61
|
+
readonly chatContainer: Container;
|
|
62
|
+
readonly statusContainer: Container;
|
|
63
|
+
readonly editorContainer: Container;
|
|
64
|
+
readonly headerContainer: Container;
|
|
65
|
+
readonly pendingMessagesContainer: Container;
|
|
66
|
+
|
|
67
|
+
// Editor
|
|
68
|
+
readonly editor: EditorComponent;
|
|
69
|
+
readonly defaultEditor: EditorComponent & {
|
|
70
|
+
onEscape?: () => void;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// Accessors
|
|
74
|
+
readonly sessionManager: SessionManager;
|
|
75
|
+
readonly settingsManager: SettingsManager;
|
|
76
|
+
|
|
77
|
+
// Footer
|
|
78
|
+
invalidateFooter(): void;
|
|
79
|
+
|
|
80
|
+
// UI helpers
|
|
81
|
+
showStatus(message: string): void;
|
|
82
|
+
showError(message: string): void;
|
|
83
|
+
showWarning(message: string): void;
|
|
84
|
+
showSelector(create: (done: () => void) => { component: Component; focus: Component }): void;
|
|
85
|
+
updateEditorBorderColor(): void;
|
|
86
|
+
getMarkdownThemeWithSettings(): MarkdownTheme;
|
|
87
|
+
requestRender(): void;
|
|
88
|
+
|
|
89
|
+
updateTerminalTitle(): void;
|
|
90
|
+
|
|
91
|
+
// Methods that stay on InteractiveMode (called from both dispatch and keybindings/events)
|
|
92
|
+
showSettingsSelector(): void;
|
|
93
|
+
showModelsSelector(): Promise<void>;
|
|
94
|
+
handleModelCommand(searchTerm?: string): Promise<void>;
|
|
95
|
+
showUserMessageSelector(): void;
|
|
96
|
+
showTreeSelector(): void;
|
|
97
|
+
showProviderManager(): void;
|
|
98
|
+
showOAuthSelector(mode: "login" | "logout"): Promise<void>;
|
|
99
|
+
showSessionSelector(): void;
|
|
100
|
+
handleClearCommand(): Promise<void>;
|
|
101
|
+
handleReloadCommand(): Promise<void>;
|
|
102
|
+
handleDebugCommand(): void;
|
|
103
|
+
shutdown(): Promise<void>;
|
|
104
|
+
|
|
105
|
+
// For compaction
|
|
106
|
+
executeCompaction(customInstructions?: string, isAuto?: boolean): Promise<unknown>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
// Dispatch
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Routes a slash command string to the appropriate handler.
|
|
115
|
+
*
|
|
116
|
+
* @returns `true` if the text was handled as a slash command (caller should
|
|
117
|
+
* not process it further), `false` otherwise.
|
|
118
|
+
*/
|
|
119
|
+
export async function dispatchSlashCommand(
|
|
120
|
+
text: string,
|
|
121
|
+
ctx: SlashCommandContext,
|
|
122
|
+
): Promise<boolean> {
|
|
123
|
+
if (text === "/settings") {
|
|
124
|
+
ctx.showSettingsSelector();
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
if (text === "/scoped-models") {
|
|
128
|
+
await ctx.showModelsSelector();
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
if (text === "/model" || text.startsWith("/model ")) {
|
|
132
|
+
const searchTerm = text.startsWith("/model ") ? text.slice(7).trim() : undefined;
|
|
133
|
+
await ctx.handleModelCommand(searchTerm);
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
if (text.startsWith("/export")) {
|
|
137
|
+
await handleExportCommand(text, ctx);
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
if (text === "/share") {
|
|
141
|
+
await handleShareCommand(ctx);
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
if (text === "/copy") {
|
|
145
|
+
handleCopyCommand(ctx);
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
if (text === "/name" || text.startsWith("/name ")) {
|
|
149
|
+
handleNameCommand(text, ctx);
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
if (text === "/session") {
|
|
153
|
+
handleSessionCommand(ctx);
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
if (text === "/changelog") {
|
|
157
|
+
handleChangelogCommand(ctx);
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
if (text === "/hotkeys") {
|
|
161
|
+
handleHotkeysCommand(ctx);
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
if (text === "/fork") {
|
|
165
|
+
ctx.showUserMessageSelector();
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
if (text === "/tree") {
|
|
169
|
+
ctx.showTreeSelector();
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
if (text === "/provider") {
|
|
173
|
+
ctx.showProviderManager();
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
if (text === "/login") {
|
|
177
|
+
await ctx.showOAuthSelector("login");
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
if (text === "/logout") {
|
|
181
|
+
await ctx.showOAuthSelector("logout");
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
if (text === "/new") {
|
|
185
|
+
await ctx.handleClearCommand();
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
if (text === "/compact" || text.startsWith("/compact ")) {
|
|
189
|
+
const customInstructions = text.startsWith("/compact ") ? text.slice(9).trim() : undefined;
|
|
190
|
+
await handleCompactCommand(customInstructions, ctx);
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
if (text === "/reload") {
|
|
194
|
+
await ctx.handleReloadCommand();
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
if (text === "/thinking" || text.startsWith("/thinking ")) {
|
|
198
|
+
const arg = text.startsWith("/thinking ") ? text.slice(10).trim() : undefined;
|
|
199
|
+
handleThinkingCommand(arg, ctx);
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
if (text === "/edit-mode" || text.startsWith("/edit-mode ")) {
|
|
203
|
+
const arg = text.startsWith("/edit-mode ") ? text.slice(11).trim() : undefined;
|
|
204
|
+
handleEditModeCommand(arg, ctx);
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
if (text === "/debug") {
|
|
208
|
+
ctx.handleDebugCommand();
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
if (text === "/arminsayshi") {
|
|
212
|
+
handleArminSaysHi(ctx);
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
if (text === "/resume") {
|
|
216
|
+
ctx.showSessionSelector();
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
if (text === "/quit") {
|
|
220
|
+
await ctx.shutdown();
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// ---------------------------------------------------------------------------
|
|
228
|
+
// Individual command handlers
|
|
229
|
+
// ---------------------------------------------------------------------------
|
|
230
|
+
|
|
231
|
+
async function handleExportCommand(text: string, ctx: SlashCommandContext): Promise<void> {
|
|
232
|
+
const parts = text.split(/\s+/);
|
|
233
|
+
const outputPath = parts.length > 1 ? parts[1] : undefined;
|
|
234
|
+
|
|
235
|
+
try {
|
|
236
|
+
const filePath = await ctx.session.exportToHtml(outputPath);
|
|
237
|
+
ctx.showStatus(`Session exported to: ${filePath}`);
|
|
238
|
+
} catch (error: unknown) {
|
|
239
|
+
ctx.showError(`Failed to export session: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async function handleShareCommand(ctx: SlashCommandContext): Promise<void> {
|
|
244
|
+
// Check if gh is available and logged in
|
|
245
|
+
try {
|
|
246
|
+
const authResult = spawnSync("gh", ["auth", "status"], { encoding: "utf-8" });
|
|
247
|
+
if (authResult.status !== 0) {
|
|
248
|
+
ctx.showError("GitHub CLI is not logged in. Run 'gh auth login' first.");
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
} catch {
|
|
252
|
+
ctx.showError("GitHub CLI (gh) is not installed. Install it from https://cli.github.com/");
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Export to a temp file
|
|
257
|
+
const tmpFile = path.join(os.tmpdir(), "session.html");
|
|
258
|
+
try {
|
|
259
|
+
await ctx.session.exportToHtml(tmpFile);
|
|
260
|
+
} catch (error: unknown) {
|
|
261
|
+
ctx.showError(`Failed to export session: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Show cancellable loader, replacing the editor
|
|
266
|
+
const loader = new BorderedLoader(ctx.ui, theme, "Creating gist...");
|
|
267
|
+
ctx.editorContainer.clear();
|
|
268
|
+
ctx.editorContainer.addChild(loader);
|
|
269
|
+
ctx.ui.setFocus(loader);
|
|
270
|
+
ctx.requestRender();
|
|
271
|
+
|
|
272
|
+
const restoreEditor = () => {
|
|
273
|
+
loader.dispose();
|
|
274
|
+
ctx.editorContainer.clear();
|
|
275
|
+
ctx.editorContainer.addChild(ctx.editor);
|
|
276
|
+
ctx.ui.setFocus(ctx.editor);
|
|
277
|
+
try {
|
|
278
|
+
fs.unlinkSync(tmpFile);
|
|
279
|
+
} catch {
|
|
280
|
+
// Ignore cleanup errors
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// Create a secret gist asynchronously
|
|
285
|
+
let proc: ReturnType<typeof spawn> | null = null;
|
|
286
|
+
|
|
287
|
+
loader.onAbort = () => {
|
|
288
|
+
proc?.kill();
|
|
289
|
+
restoreEditor();
|
|
290
|
+
ctx.showStatus("Share cancelled");
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
try {
|
|
294
|
+
const result = await new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve) => {
|
|
295
|
+
proc = spawn("gh", ["gist", "create", "--public=false", tmpFile]);
|
|
296
|
+
let stdout = "";
|
|
297
|
+
let stderr = "";
|
|
298
|
+
proc.stdout?.on("data", (data) => {
|
|
299
|
+
stdout += data.toString();
|
|
300
|
+
});
|
|
301
|
+
proc.stderr?.on("data", (data) => {
|
|
302
|
+
stderr += data.toString();
|
|
303
|
+
});
|
|
304
|
+
proc.on("close", (code) => resolve({ stdout, stderr, code }));
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
if (loader.signal.aborted) return;
|
|
308
|
+
|
|
309
|
+
restoreEditor();
|
|
310
|
+
|
|
311
|
+
if (result.code !== 0) {
|
|
312
|
+
const errorMsg = result.stderr?.trim() || "Unknown error";
|
|
313
|
+
ctx.showError(`Failed to create gist: ${errorMsg}`);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// Extract gist ID from the URL returned by gh
|
|
318
|
+
// gh returns something like: https://gist.github.com/username/GIST_ID
|
|
319
|
+
const gistUrl = result.stdout?.trim();
|
|
320
|
+
const gistId = gistUrl?.split("/").pop();
|
|
321
|
+
if (!gistId) {
|
|
322
|
+
ctx.showError("Failed to parse gist ID from gh output");
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Create the preview URL
|
|
327
|
+
const previewUrl = getShareViewerUrl(gistId);
|
|
328
|
+
ctx.showStatus(`Share URL: ${previewUrl}\nGist: ${gistUrl}`);
|
|
329
|
+
} catch (error: unknown) {
|
|
330
|
+
if (!loader.signal.aborted) {
|
|
331
|
+
restoreEditor();
|
|
332
|
+
ctx.showError(`Failed to create gist: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function handleCopyCommand(ctx: SlashCommandContext): void {
|
|
338
|
+
const text = ctx.session.getLastAssistantText();
|
|
339
|
+
if (!text) {
|
|
340
|
+
ctx.showError("No agent messages to copy yet.");
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
try {
|
|
345
|
+
copyToClipboard(text);
|
|
346
|
+
ctx.showStatus("Copied last agent message to clipboard");
|
|
347
|
+
} catch (error) {
|
|
348
|
+
ctx.showError(error instanceof Error ? error.message : String(error));
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function handleNameCommand(text: string, ctx: SlashCommandContext): void {
|
|
353
|
+
const name = text.replace(/^\/name\s*/, "").trim();
|
|
354
|
+
if (!name) {
|
|
355
|
+
const currentName = ctx.sessionManager.getSessionName();
|
|
356
|
+
if (currentName) {
|
|
357
|
+
ctx.chatContainer.addChild(new Spacer(1));
|
|
358
|
+
ctx.chatContainer.addChild(new Text(theme.fg("dim", `Session name: ${currentName}`), 1, 0));
|
|
359
|
+
} else {
|
|
360
|
+
ctx.showWarning("Usage: /name <name>");
|
|
361
|
+
}
|
|
362
|
+
ctx.requestRender();
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
ctx.sessionManager.appendSessionInfo(name);
|
|
367
|
+
ctx.updateTerminalTitle();
|
|
368
|
+
ctx.chatContainer.addChild(new Spacer(1));
|
|
369
|
+
ctx.chatContainer.addChild(new Text(theme.fg("dim", `Session name set: ${name}`), 1, 0));
|
|
370
|
+
ctx.requestRender();
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function handleSessionCommand(ctx: SlashCommandContext): void {
|
|
374
|
+
const stats = ctx.session.getSessionStats();
|
|
375
|
+
const sessionName = ctx.sessionManager.getSessionName();
|
|
376
|
+
|
|
377
|
+
let info = `${theme.bold("Session Info")}\n\n`;
|
|
378
|
+
if (sessionName) {
|
|
379
|
+
info += `${theme.fg("dim", "Name:")} ${sessionName}\n`;
|
|
380
|
+
}
|
|
381
|
+
info += `${theme.fg("dim", "File:")} ${stats.sessionFile ?? "In-memory"}\n`;
|
|
382
|
+
info += `${theme.fg("dim", "ID:")} ${stats.sessionId}\n\n`;
|
|
383
|
+
info += `${theme.bold("Messages")}\n`;
|
|
384
|
+
info += `${theme.fg("dim", "User:")} ${stats.userMessages}\n`;
|
|
385
|
+
info += `${theme.fg("dim", "Assistant:")} ${stats.assistantMessages}\n`;
|
|
386
|
+
info += `${theme.fg("dim", "Tool Calls:")} ${stats.toolCalls}\n`;
|
|
387
|
+
info += `${theme.fg("dim", "Tool Results:")} ${stats.toolResults}\n`;
|
|
388
|
+
info += `${theme.fg("dim", "Total:")} ${stats.totalMessages}\n\n`;
|
|
389
|
+
info += `${theme.bold("Tokens")}\n`;
|
|
390
|
+
info += `${theme.fg("dim", "Input:")} ${stats.tokens.input.toLocaleString()}\n`;
|
|
391
|
+
info += `${theme.fg("dim", "Output:")} ${stats.tokens.output.toLocaleString()}\n`;
|
|
392
|
+
if (stats.tokens.cacheRead > 0) {
|
|
393
|
+
info += `${theme.fg("dim", "Cache Read:")} ${stats.tokens.cacheRead.toLocaleString()}\n`;
|
|
394
|
+
}
|
|
395
|
+
if (stats.tokens.cacheWrite > 0) {
|
|
396
|
+
info += `${theme.fg("dim", "Cache Write:")} ${stats.tokens.cacheWrite.toLocaleString()}\n`;
|
|
397
|
+
}
|
|
398
|
+
info += `${theme.fg("dim", "Total:")} ${stats.tokens.total.toLocaleString()}\n`;
|
|
399
|
+
|
|
400
|
+
if (stats.cost > 0) {
|
|
401
|
+
info += `\n${theme.bold("Cost")}\n`;
|
|
402
|
+
info += `${theme.fg("dim", "Total:")} ${stats.cost.toFixed(4)}`;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
ctx.chatContainer.addChild(new Spacer(1));
|
|
406
|
+
ctx.chatContainer.addChild(new Text(info, 1, 0));
|
|
407
|
+
ctx.requestRender();
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function handleChangelogCommand(ctx: SlashCommandContext): void {
|
|
411
|
+
const changelogPath = getChangelogPath();
|
|
412
|
+
const allEntries = parseChangelog(changelogPath);
|
|
413
|
+
|
|
414
|
+
const changelogMarkdown =
|
|
415
|
+
allEntries.length > 0
|
|
416
|
+
? allEntries
|
|
417
|
+
.reverse()
|
|
418
|
+
.map((e) => e.content)
|
|
419
|
+
.join("\n\n")
|
|
420
|
+
: "No changelog entries found.";
|
|
421
|
+
|
|
422
|
+
ctx.chatContainer.addChild(new Spacer(1));
|
|
423
|
+
ctx.chatContainer.addChild(new DynamicBorder());
|
|
424
|
+
ctx.chatContainer.addChild(new Text(theme.bold(theme.fg("accent", "What's New")), 1, 0));
|
|
425
|
+
ctx.chatContainer.addChild(new Spacer(1));
|
|
426
|
+
ctx.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, ctx.getMarkdownThemeWithSettings()));
|
|
427
|
+
ctx.chatContainer.addChild(new DynamicBorder());
|
|
428
|
+
ctx.requestRender();
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// ---------------------------------------------------------------------------
|
|
432
|
+
// /hotkeys helpers
|
|
433
|
+
// ---------------------------------------------------------------------------
|
|
434
|
+
|
|
435
|
+
export function capitalizeKey(key: string): string {
|
|
436
|
+
return key
|
|
437
|
+
.split("/")
|
|
438
|
+
.map((k) =>
|
|
439
|
+
k
|
|
440
|
+
.split("+")
|
|
441
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
442
|
+
.join("+"),
|
|
443
|
+
)
|
|
444
|
+
.join("/");
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export function getAppKeyDisplay(keybindings: KeybindingsManager, action: AppAction): string {
|
|
448
|
+
return capitalizeKey(appKey(keybindings, action));
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function getEditorKeyDisplay(action: EditorAction): string {
|
|
452
|
+
return capitalizeKey(editorKey(action));
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function handleHotkeysCommand(ctx: SlashCommandContext): void {
|
|
456
|
+
// Navigation keybindings
|
|
457
|
+
const cursorWordLeft = getEditorKeyDisplay("cursorWordLeft");
|
|
458
|
+
const cursorWordRight = getEditorKeyDisplay("cursorWordRight");
|
|
459
|
+
const cursorLineStart = getEditorKeyDisplay("cursorLineStart");
|
|
460
|
+
const cursorLineEnd = getEditorKeyDisplay("cursorLineEnd");
|
|
461
|
+
const jumpForward = getEditorKeyDisplay("jumpForward");
|
|
462
|
+
const jumpBackward = getEditorKeyDisplay("jumpBackward");
|
|
463
|
+
const pageUp = getEditorKeyDisplay("pageUp");
|
|
464
|
+
const pageDown = getEditorKeyDisplay("pageDown");
|
|
465
|
+
|
|
466
|
+
// Editing keybindings
|
|
467
|
+
const submit = getEditorKeyDisplay("submit");
|
|
468
|
+
const newLine = getEditorKeyDisplay("newLine");
|
|
469
|
+
const deleteWordBackward = getEditorKeyDisplay("deleteWordBackward");
|
|
470
|
+
const deleteWordForward = getEditorKeyDisplay("deleteWordForward");
|
|
471
|
+
const deleteToLineStart = getEditorKeyDisplay("deleteToLineStart");
|
|
472
|
+
const deleteToLineEnd = getEditorKeyDisplay("deleteToLineEnd");
|
|
473
|
+
const yank = getEditorKeyDisplay("yank");
|
|
474
|
+
const yankPop = getEditorKeyDisplay("yankPop");
|
|
475
|
+
const undo = getEditorKeyDisplay("undo");
|
|
476
|
+
const tab = getEditorKeyDisplay("tab");
|
|
477
|
+
|
|
478
|
+
// App keybindings
|
|
479
|
+
const interrupt = getAppKeyDisplay(ctx.keybindings, "interrupt");
|
|
480
|
+
const clear = getAppKeyDisplay(ctx.keybindings, "clear");
|
|
481
|
+
const exit = getAppKeyDisplay(ctx.keybindings, "exit");
|
|
482
|
+
const suspend = getAppKeyDisplay(ctx.keybindings, "suspend");
|
|
483
|
+
const cycleThinkingLevel = getAppKeyDisplay(ctx.keybindings, "cycleThinkingLevel");
|
|
484
|
+
const cycleModelForward = getAppKeyDisplay(ctx.keybindings, "cycleModelForward");
|
|
485
|
+
const selectModel = getAppKeyDisplay(ctx.keybindings, "selectModel");
|
|
486
|
+
const expandTools = getAppKeyDisplay(ctx.keybindings, "expandTools");
|
|
487
|
+
const toggleThinking = getAppKeyDisplay(ctx.keybindings, "toggleThinking");
|
|
488
|
+
const externalEditor = getAppKeyDisplay(ctx.keybindings, "externalEditor");
|
|
489
|
+
const followUp = getAppKeyDisplay(ctx.keybindings, "followUp");
|
|
490
|
+
const dequeue = getAppKeyDisplay(ctx.keybindings, "dequeue");
|
|
491
|
+
|
|
492
|
+
let hotkeys = `
|
|
493
|
+
**Navigation**
|
|
494
|
+
| Key | Action |
|
|
495
|
+
|-----|--------|
|
|
496
|
+
| \`Arrow keys\` | Move cursor / browse history (Up when empty) |
|
|
497
|
+
| \`${cursorWordLeft}\` / \`${cursorWordRight}\` | Move by word |
|
|
498
|
+
| \`${cursorLineStart}\` | Start of line |
|
|
499
|
+
| \`${cursorLineEnd}\` | End of line |
|
|
500
|
+
| \`${jumpForward}\` | Jump forward to character |
|
|
501
|
+
| \`${jumpBackward}\` | Jump backward to character |
|
|
502
|
+
| \`${pageUp}\` / \`${pageDown}\` | Scroll by page |
|
|
503
|
+
|
|
504
|
+
**Editing**
|
|
505
|
+
| Key | Action |
|
|
506
|
+
|-----|--------|
|
|
507
|
+
| \`${submit}\` | Send message |
|
|
508
|
+
| \`${newLine}\` | New line${process.platform === "win32" ? " (Ctrl+Enter on Windows Terminal)" : ""} |
|
|
509
|
+
| \`${deleteWordBackward}\` | Delete word backwards |
|
|
510
|
+
| \`${deleteWordForward}\` | Delete word forwards |
|
|
511
|
+
| \`${deleteToLineStart}\` | Delete to start of line |
|
|
512
|
+
| \`${deleteToLineEnd}\` | Delete to end of line |
|
|
513
|
+
| \`${yank}\` | Paste the most-recently-deleted text |
|
|
514
|
+
| \`${yankPop}\` | Cycle through the deleted text after pasting |
|
|
515
|
+
| \`${undo}\` | Undo |
|
|
516
|
+
|
|
517
|
+
**Other**
|
|
518
|
+
| Key | Action |
|
|
519
|
+
|-----|--------|
|
|
520
|
+
| \`${tab}\` | Path completion / accept autocomplete |
|
|
521
|
+
| \`${interrupt}\` | Cancel autocomplete / abort streaming |
|
|
522
|
+
| \`${clear}\` | Clear editor (first) / exit (second) |
|
|
523
|
+
| \`${exit}\` | Exit (when editor is empty) |
|
|
524
|
+
| \`${suspend}\` | Suspend to background |
|
|
525
|
+
| \`${cycleThinkingLevel}\` | Cycle thinking level |
|
|
526
|
+
| \`${cycleModelForward}\` | Cycle models |
|
|
527
|
+
| \`${selectModel}\` | Open model selector |
|
|
528
|
+
| \`${expandTools}\` | Toggle tool output expansion |
|
|
529
|
+
| \`${toggleThinking}\` | Toggle thinking block visibility |
|
|
530
|
+
| \`${externalEditor}\` | Edit message in external editor |
|
|
531
|
+
| \`${followUp}\` | Queue follow-up message |
|
|
532
|
+
| \`${dequeue}\` | Restore queued messages |
|
|
533
|
+
| \`Ctrl+V\` | Paste image from clipboard |
|
|
534
|
+
| \`/\` | Slash commands |
|
|
535
|
+
| \`!\` | Run bash command |
|
|
536
|
+
| \`!!\` | Run bash command (excluded from context) |
|
|
537
|
+
`;
|
|
538
|
+
|
|
539
|
+
// Add extension-registered shortcuts
|
|
540
|
+
const extensionRunner = ctx.session.extensionRunner;
|
|
541
|
+
if (extensionRunner) {
|
|
542
|
+
const shortcuts = extensionRunner.getShortcuts(ctx.keybindings.getEffectiveConfig());
|
|
543
|
+
if (shortcuts.size > 0) {
|
|
544
|
+
hotkeys += `
|
|
545
|
+
**Extensions**
|
|
546
|
+
| Key | Action |
|
|
547
|
+
|-----|--------|
|
|
548
|
+
`;
|
|
549
|
+
for (const [key, shortcut] of shortcuts) {
|
|
550
|
+
const description = shortcut.description ?? shortcut.extensionPath;
|
|
551
|
+
const keyDisplay = formatKeyForDisplay(key).replace(/\b\w/g, (c) => c.toUpperCase());
|
|
552
|
+
hotkeys += `| \`${keyDisplay}\` | ${description} |\n`;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
ctx.chatContainer.addChild(new Spacer(1));
|
|
558
|
+
ctx.chatContainer.addChild(new DynamicBorder());
|
|
559
|
+
ctx.chatContainer.addChild(new Text(theme.bold(theme.fg("accent", "Keyboard Shortcuts")), 1, 0));
|
|
560
|
+
ctx.chatContainer.addChild(new Spacer(1));
|
|
561
|
+
ctx.chatContainer.addChild(new Markdown(hotkeys.trim(), 1, 1, ctx.getMarkdownThemeWithSettings()));
|
|
562
|
+
ctx.chatContainer.addChild(new DynamicBorder());
|
|
563
|
+
ctx.requestRender();
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
async function handleCompactCommand(customInstructions: string | undefined, ctx: SlashCommandContext): Promise<void> {
|
|
567
|
+
const entries = ctx.sessionManager.getEntries();
|
|
568
|
+
const messageCount = entries.filter((e) => e.type === "message").length;
|
|
569
|
+
|
|
570
|
+
if (messageCount < 2) {
|
|
571
|
+
ctx.showWarning("Nothing to compact (no messages yet)");
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
await ctx.executeCompaction(customInstructions, false);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function handleThinkingCommand(arg: string | undefined, ctx: SlashCommandContext): void {
|
|
579
|
+
if (!ctx.session.supportsThinking()) {
|
|
580
|
+
ctx.showStatus("Current model does not support thinking");
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
const availableLevels = ctx.session.getAvailableThinkingLevels();
|
|
585
|
+
|
|
586
|
+
if (arg) {
|
|
587
|
+
const level = arg.toLowerCase();
|
|
588
|
+
if (!availableLevels.includes(level as ThinkingLevel)) {
|
|
589
|
+
ctx.showStatus(`Invalid thinking level "${arg}". Available: ${availableLevels.join(", ")}`);
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
ctx.session.setThinkingLevel(level as ThinkingLevel);
|
|
593
|
+
ctx.invalidateFooter();
|
|
594
|
+
ctx.updateEditorBorderColor();
|
|
595
|
+
ctx.showStatus(`Thinking level: ${level}`);
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
showThinkingSelector(ctx, availableLevels);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function showThinkingSelector(ctx: SlashCommandContext, availableLevels: readonly ThinkingLevel[]): void {
|
|
603
|
+
ctx.showSelector((done) => {
|
|
604
|
+
const selector = new SelectSubmenu(
|
|
605
|
+
"Thinking Level",
|
|
606
|
+
"Select reasoning depth for thinking-capable models",
|
|
607
|
+
availableLevels.map((level) => ({
|
|
608
|
+
value: level,
|
|
609
|
+
label: level,
|
|
610
|
+
description: THINKING_DESCRIPTIONS[level],
|
|
611
|
+
})),
|
|
612
|
+
ctx.session.thinkingLevel,
|
|
613
|
+
(value) => {
|
|
614
|
+
ctx.session.setThinkingLevel(value as ThinkingLevel);
|
|
615
|
+
ctx.invalidateFooter();
|
|
616
|
+
ctx.updateEditorBorderColor();
|
|
617
|
+
done();
|
|
618
|
+
ctx.showStatus(`Thinking level: ${value}`);
|
|
619
|
+
},
|
|
620
|
+
() => {
|
|
621
|
+
done();
|
|
622
|
+
},
|
|
623
|
+
);
|
|
624
|
+
return { component: selector, focus: selector };
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
function handleEditModeCommand(arg: string | undefined, ctx: SlashCommandContext): void {
|
|
629
|
+
const modes = ["standard", "hashline"] as const;
|
|
630
|
+
|
|
631
|
+
if (arg) {
|
|
632
|
+
const mode = arg.toLowerCase();
|
|
633
|
+
if (!modes.includes(mode as typeof modes[number])) {
|
|
634
|
+
ctx.showStatus(`Invalid edit mode "${arg}". Available: standard, hashline`);
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
ctx.session.setEditMode(mode as "standard" | "hashline");
|
|
638
|
+
ctx.showStatus(`Edit mode: ${mode}${mode === "hashline" ? " (LINE#ID anchored edits)" : " (text-match edits)"}`);
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// Toggle
|
|
643
|
+
const current = ctx.session.editMode;
|
|
644
|
+
const next = current === "standard" ? "hashline" : "standard";
|
|
645
|
+
ctx.session.setEditMode(next);
|
|
646
|
+
ctx.showStatus(`Edit mode: ${next}${next === "hashline" ? " (LINE#ID anchored edits)" : " (text-match edits)"}`);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
function handleArminSaysHi(ctx: SlashCommandContext): void {
|
|
650
|
+
ctx.chatContainer.addChild(new Spacer(1));
|
|
651
|
+
ctx.chatContainer.addChild(new ArminComponent(ctx.ui));
|
|
652
|
+
ctx.requestRender();
|
|
653
|
+
}
|