gsd-pi 2.34.0-dev.bbb5216 → 2.34.0-dev.ed0bfbf
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/resources/extensions/mcp-client/index.js +2 -1
- package/package.json +1 -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/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 +1 -1
- package/packages/pi-agent-core/dist/proxy.js.map +1 -1
- package/packages/pi-agent-core/src/proxy.ts +1 -1
- 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/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/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/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/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/register-builtins.ts +1 -1
- package/packages/pi-ai/src/utils/event-stream.ts +0 -5
- 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/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/runner.d.ts +0 -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 +0 -13
- package/packages/pi-coding-agent/dist/core/extensions/runner.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/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 +0 -2
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.js +0 -7
- 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/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 +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.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/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/session-manager.d.ts +0 -4
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +2 -4
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +0 -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 +2 -2
- package/packages/pi-coding-agent/dist/core/settings-manager.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/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 +0 -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 +0 -7
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
- 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/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/src/config.ts +5 -10
- package/packages/pi-coding-agent/src/core/export-html/ansi-to-html.ts +1 -1
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +0 -13
- package/packages/pi-coding-agent/src/core/keybindings.ts +2 -2
- package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -73
- package/packages/pi-coding-agent/src/core/lsp/config.ts +0 -11
- package/packages/pi-coding-agent/src/core/lsp/edits.ts +1 -1
- package/packages/pi-coding-agent/src/core/lsp/lspmux.ts +1 -1
- 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/prompt-templates.ts +2 -2
- package/packages/pi-coding-agent/src/core/session-manager.ts +2 -4
- package/packages/pi-coding-agent/src/core/settings-manager.ts +2 -2
- 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/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 +0 -8
- 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/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/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/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 +0 -4
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +0 -7
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
- package/src/resources/extensions/mcp-client/index.ts +2 -1
|
@@ -8,7 +8,7 @@ import * as os from "node:os";
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import { CombinedAutocompleteProvider, Container, fuzzyFilter, Loader, Markdown, matchesKey, ProcessTerminal, Spacer, Text, TruncatedText, TUI, visibleWidth, } from "@gsd/pi-tui";
|
|
10
10
|
import { spawn, spawnSync } from "child_process";
|
|
11
|
-
import { APP_NAME, getAuthPath, getDebugLogPath,
|
|
11
|
+
import { APP_NAME, getAuthPath, getDebugLogPath, getUpdateInstruction, VERSION, } from "../../config.js";
|
|
12
12
|
import { parseSkillBlock } from "../../core/agent-session.js";
|
|
13
13
|
import { FooterDataProvider } from "../../core/footer-data-provider.js";
|
|
14
14
|
import { KeybindingsManager } from "../../core/keybindings.js";
|
|
@@ -17,10 +17,8 @@ import { resolveModelScope } from "../../core/model-resolver.js";
|
|
|
17
17
|
import { SessionManager } from "../../core/session-manager.js";
|
|
18
18
|
import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
|
|
19
19
|
import { getChangelogPath, getNewEntries, parseChangelog } from "../../utils/changelog.js";
|
|
20
|
-
import { copyToClipboard } from "../../utils/clipboard.js";
|
|
21
20
|
import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
|
|
22
21
|
import { ensureTool } from "../../utils/tools-manager.js";
|
|
23
|
-
import { ArminComponent } from "./components/armin.js";
|
|
24
22
|
import { AssistantMessageComponent } from "./components/assistant-message.js";
|
|
25
23
|
import { BashExecutionComponent } from "./components/bash-execution.js";
|
|
26
24
|
import { BorderedLoader } from "./components/bordered-loader.js";
|
|
@@ -34,19 +32,20 @@ import { ExtensionEditorComponent } from "./components/extension-editor.js";
|
|
|
34
32
|
import { ExtensionInputComponent } from "./components/extension-input.js";
|
|
35
33
|
import { ExtensionSelectorComponent } from "./components/extension-selector.js";
|
|
36
34
|
import { FooterComponent } from "./components/footer.js";
|
|
37
|
-
import { appKey, appKeyHint,
|
|
35
|
+
import { appKey, appKeyHint, keyHint, rawKeyHint } from "./components/keybinding-hints.js";
|
|
38
36
|
import { LoginDialogComponent } from "./components/login-dialog.js";
|
|
39
37
|
import { ModelSelectorComponent } from "./components/model-selector.js";
|
|
40
38
|
import { OAuthSelectorComponent } from "./components/oauth-selector.js";
|
|
41
39
|
import { ProviderManagerComponent } from "./components/provider-manager.js";
|
|
42
40
|
import { ScopedModelsSelectorComponent } from "./components/scoped-models-selector.js";
|
|
43
41
|
import { SessionSelectorComponent } from "./components/session-selector.js";
|
|
44
|
-
import {
|
|
42
|
+
import { SettingsSelectorComponent } from "./components/settings-selector.js";
|
|
45
43
|
import { SkillInvocationMessageComponent } from "./components/skill-invocation-message.js";
|
|
46
44
|
import { ToolExecutionComponent } from "./components/tool-execution.js";
|
|
47
45
|
import { TreeSelectorComponent } from "./components/tree-selector.js";
|
|
48
46
|
import { UserMessageComponent } from "./components/user-message.js";
|
|
49
47
|
import { UserMessageSelectorComponent } from "./components/user-message-selector.js";
|
|
48
|
+
import { dispatchSlashCommand, getAppKeyDisplay } from "./slash-command-handlers.js";
|
|
50
49
|
import { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, initTheme, onThemeChange, setRegisteredThemes, setTheme, setThemeInstance, Theme, theme, } from "./theme/theme.js";
|
|
51
50
|
function isExpandable(obj) {
|
|
52
51
|
return typeof obj === "object" && obj !== null && "setExpanded" in obj && typeof obj.setExpanded === "function";
|
|
@@ -1590,135 +1589,56 @@ export class InteractiveMode {
|
|
|
1590
1589
|
// Silently ignore clipboard errors (may not have permission, etc.)
|
|
1591
1590
|
}
|
|
1592
1591
|
}
|
|
1592
|
+
getSlashCommandContext() {
|
|
1593
|
+
return {
|
|
1594
|
+
session: this.session,
|
|
1595
|
+
ui: this.ui,
|
|
1596
|
+
keybindings: this.keybindings,
|
|
1597
|
+
chatContainer: this.chatContainer,
|
|
1598
|
+
statusContainer: this.statusContainer,
|
|
1599
|
+
editorContainer: this.editorContainer,
|
|
1600
|
+
headerContainer: this.headerContainer,
|
|
1601
|
+
pendingMessagesContainer: this.pendingMessagesContainer,
|
|
1602
|
+
editor: this.editor,
|
|
1603
|
+
defaultEditor: this.defaultEditor,
|
|
1604
|
+
sessionManager: this.sessionManager,
|
|
1605
|
+
settingsManager: this.settingsManager,
|
|
1606
|
+
invalidateFooter: () => this.footer.invalidate(),
|
|
1607
|
+
showStatus: (msg) => this.showStatus(msg),
|
|
1608
|
+
showError: (msg) => this.showError(msg),
|
|
1609
|
+
showWarning: (msg) => this.showWarning(msg),
|
|
1610
|
+
showSelector: (create) => this.showSelector(create),
|
|
1611
|
+
updateEditorBorderColor: () => this.updateEditorBorderColor(),
|
|
1612
|
+
getMarkdownThemeWithSettings: () => this.getMarkdownThemeWithSettings(),
|
|
1613
|
+
requestRender: () => this.ui.requestRender(),
|
|
1614
|
+
updateTerminalTitle: () => this.updateTerminalTitle(),
|
|
1615
|
+
showSettingsSelector: () => this.showSettingsSelector(),
|
|
1616
|
+
showModelsSelector: () => this.showModelsSelector(),
|
|
1617
|
+
handleModelCommand: (searchTerm) => this.handleModelCommand(searchTerm),
|
|
1618
|
+
showUserMessageSelector: () => this.showUserMessageSelector(),
|
|
1619
|
+
showTreeSelector: () => this.showTreeSelector(),
|
|
1620
|
+
showProviderManager: () => this.showProviderManager(),
|
|
1621
|
+
showOAuthSelector: (mode) => this.showOAuthSelector(mode),
|
|
1622
|
+
showSessionSelector: () => this.showSessionSelector(),
|
|
1623
|
+
handleClearCommand: () => this.handleClearCommand(),
|
|
1624
|
+
handleReloadCommand: () => this.handleReloadCommand(),
|
|
1625
|
+
handleDebugCommand: () => this.handleDebugCommand(),
|
|
1626
|
+
shutdown: () => this.shutdown(),
|
|
1627
|
+
executeCompaction: (instructions, isAuto) => this.executeCompaction(instructions, isAuto),
|
|
1628
|
+
};
|
|
1629
|
+
}
|
|
1593
1630
|
setupEditorSubmitHandler() {
|
|
1594
1631
|
this.defaultEditor.onSubmit = async (text) => {
|
|
1595
1632
|
text = text.trim();
|
|
1596
1633
|
if (!text)
|
|
1597
1634
|
return;
|
|
1598
|
-
// Handle commands
|
|
1599
|
-
if (text
|
|
1600
|
-
this.
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
this.editor.setText("");
|
|
1606
|
-
await this.showModelsSelector();
|
|
1607
|
-
return;
|
|
1608
|
-
}
|
|
1609
|
-
if (text === "/model" || text.startsWith("/model ")) {
|
|
1610
|
-
const searchTerm = text.startsWith("/model ") ? text.slice(7).trim() : undefined;
|
|
1611
|
-
this.editor.setText("");
|
|
1612
|
-
await this.handleModelCommand(searchTerm);
|
|
1613
|
-
return;
|
|
1614
|
-
}
|
|
1615
|
-
if (text.startsWith("/export")) {
|
|
1616
|
-
await this.handleExportCommand(text);
|
|
1617
|
-
this.editor.setText("");
|
|
1618
|
-
return;
|
|
1619
|
-
}
|
|
1620
|
-
if (text === "/share") {
|
|
1621
|
-
await this.handleShareCommand();
|
|
1622
|
-
this.editor.setText("");
|
|
1623
|
-
return;
|
|
1624
|
-
}
|
|
1625
|
-
if (text === "/copy") {
|
|
1626
|
-
this.handleCopyCommand();
|
|
1627
|
-
this.editor.setText("");
|
|
1628
|
-
return;
|
|
1629
|
-
}
|
|
1630
|
-
if (text === "/name" || text.startsWith("/name ")) {
|
|
1631
|
-
this.handleNameCommand(text);
|
|
1632
|
-
this.editor.setText("");
|
|
1633
|
-
return;
|
|
1634
|
-
}
|
|
1635
|
-
if (text === "/session") {
|
|
1636
|
-
this.handleSessionCommand();
|
|
1637
|
-
this.editor.setText("");
|
|
1638
|
-
return;
|
|
1639
|
-
}
|
|
1640
|
-
if (text === "/changelog") {
|
|
1641
|
-
this.handleChangelogCommand();
|
|
1642
|
-
this.editor.setText("");
|
|
1643
|
-
return;
|
|
1644
|
-
}
|
|
1645
|
-
if (text === "/hotkeys") {
|
|
1646
|
-
this.handleHotkeysCommand();
|
|
1647
|
-
this.editor.setText("");
|
|
1648
|
-
return;
|
|
1649
|
-
}
|
|
1650
|
-
if (text === "/fork") {
|
|
1651
|
-
this.showUserMessageSelector();
|
|
1652
|
-
this.editor.setText("");
|
|
1653
|
-
return;
|
|
1654
|
-
}
|
|
1655
|
-
if (text === "/tree") {
|
|
1656
|
-
this.showTreeSelector();
|
|
1657
|
-
this.editor.setText("");
|
|
1658
|
-
return;
|
|
1659
|
-
}
|
|
1660
|
-
if (text === "/provider") {
|
|
1661
|
-
this.showProviderManager();
|
|
1662
|
-
this.editor.setText("");
|
|
1663
|
-
return;
|
|
1664
|
-
}
|
|
1665
|
-
if (text === "/login") {
|
|
1666
|
-
this.showOAuthSelector("login");
|
|
1667
|
-
this.editor.setText("");
|
|
1668
|
-
return;
|
|
1669
|
-
}
|
|
1670
|
-
if (text === "/logout") {
|
|
1671
|
-
this.showOAuthSelector("logout");
|
|
1672
|
-
this.editor.setText("");
|
|
1673
|
-
return;
|
|
1674
|
-
}
|
|
1675
|
-
if (text === "/new") {
|
|
1676
|
-
this.editor.setText("");
|
|
1677
|
-
await this.handleClearCommand();
|
|
1678
|
-
return;
|
|
1679
|
-
}
|
|
1680
|
-
if (text === "/compact" || text.startsWith("/compact ")) {
|
|
1681
|
-
const customInstructions = text.startsWith("/compact ") ? text.slice(9).trim() : undefined;
|
|
1682
|
-
this.editor.setText("");
|
|
1683
|
-
await this.handleCompactCommand(customInstructions);
|
|
1684
|
-
return;
|
|
1685
|
-
}
|
|
1686
|
-
if (text === "/reload") {
|
|
1687
|
-
this.editor.setText("");
|
|
1688
|
-
await this.handleReloadCommand();
|
|
1689
|
-
return;
|
|
1690
|
-
}
|
|
1691
|
-
if (text === "/thinking" || text.startsWith("/thinking ")) {
|
|
1692
|
-
const arg = text.startsWith("/thinking ") ? text.slice(10).trim() : undefined;
|
|
1693
|
-
this.editor.setText("");
|
|
1694
|
-
this.handleThinkingCommand(arg);
|
|
1695
|
-
return;
|
|
1696
|
-
}
|
|
1697
|
-
if (text === "/edit-mode" || text.startsWith("/edit-mode ")) {
|
|
1698
|
-
const arg = text.startsWith("/edit-mode ") ? text.slice(11).trim() : undefined;
|
|
1699
|
-
this.editor.setText("");
|
|
1700
|
-
this.handleEditModeCommand(arg);
|
|
1701
|
-
return;
|
|
1702
|
-
}
|
|
1703
|
-
if (text === "/debug") {
|
|
1704
|
-
this.handleDebugCommand();
|
|
1705
|
-
this.editor.setText("");
|
|
1706
|
-
return;
|
|
1707
|
-
}
|
|
1708
|
-
if (text === "/arminsayshi") {
|
|
1709
|
-
this.handleArminSaysHi();
|
|
1710
|
-
this.editor.setText("");
|
|
1711
|
-
return;
|
|
1712
|
-
}
|
|
1713
|
-
if (text === "/resume") {
|
|
1714
|
-
this.showSessionSelector();
|
|
1715
|
-
this.editor.setText("");
|
|
1716
|
-
return;
|
|
1717
|
-
}
|
|
1718
|
-
if (text === "/quit") {
|
|
1719
|
-
this.editor.setText("");
|
|
1720
|
-
await this.shutdown();
|
|
1721
|
-
return;
|
|
1635
|
+
// Handle slash commands
|
|
1636
|
+
if (text.startsWith("/")) {
|
|
1637
|
+
const handled = await dispatchSlashCommand(text, this.getSlashCommandContext());
|
|
1638
|
+
if (handled) {
|
|
1639
|
+
this.editor.setText("");
|
|
1640
|
+
return;
|
|
1641
|
+
}
|
|
1722
1642
|
}
|
|
1723
1643
|
// Handle bash command (! for normal, !! for excluded from context)
|
|
1724
1644
|
if (text.startsWith("!")) {
|
|
@@ -2395,63 +2315,6 @@ export class InteractiveMode {
|
|
|
2395
2315
|
this.showStatus(`Thinking level: ${newLevel}`);
|
|
2396
2316
|
}
|
|
2397
2317
|
}
|
|
2398
|
-
handleThinkingCommand(arg) {
|
|
2399
|
-
if (!this.session.supportsThinking()) {
|
|
2400
|
-
this.showStatus("Current model does not support thinking");
|
|
2401
|
-
return;
|
|
2402
|
-
}
|
|
2403
|
-
const availableLevels = this.session.getAvailableThinkingLevels();
|
|
2404
|
-
if (arg) {
|
|
2405
|
-
const level = arg.toLowerCase();
|
|
2406
|
-
if (!availableLevels.includes(level)) {
|
|
2407
|
-
this.showStatus(`Invalid thinking level "${arg}". Available: ${availableLevels.join(", ")}`);
|
|
2408
|
-
return;
|
|
2409
|
-
}
|
|
2410
|
-
this.session.setThinkingLevel(level);
|
|
2411
|
-
this.footer.invalidate();
|
|
2412
|
-
this.updateEditorBorderColor();
|
|
2413
|
-
this.showStatus(`Thinking level: ${level}`);
|
|
2414
|
-
return;
|
|
2415
|
-
}
|
|
2416
|
-
this.showThinkingSelector();
|
|
2417
|
-
}
|
|
2418
|
-
handleEditModeCommand(arg) {
|
|
2419
|
-
const modes = ["standard", "hashline"];
|
|
2420
|
-
if (arg) {
|
|
2421
|
-
const mode = arg.toLowerCase();
|
|
2422
|
-
if (!modes.includes(mode)) {
|
|
2423
|
-
this.showStatus(`Invalid edit mode "${arg}". Available: standard, hashline`);
|
|
2424
|
-
return;
|
|
2425
|
-
}
|
|
2426
|
-
this.session.setEditMode(mode);
|
|
2427
|
-
this.showStatus(`Edit mode: ${mode}${mode === "hashline" ? " (LINE#ID anchored edits)" : " (text-match edits)"}`);
|
|
2428
|
-
return;
|
|
2429
|
-
}
|
|
2430
|
-
// Toggle
|
|
2431
|
-
const current = this.session.editMode;
|
|
2432
|
-
const next = current === "standard" ? "hashline" : "standard";
|
|
2433
|
-
this.session.setEditMode(next);
|
|
2434
|
-
this.showStatus(`Edit mode: ${next}${next === "hashline" ? " (LINE#ID anchored edits)" : " (text-match edits)"}`);
|
|
2435
|
-
}
|
|
2436
|
-
showThinkingSelector() {
|
|
2437
|
-
const availableLevels = this.session.getAvailableThinkingLevels();
|
|
2438
|
-
this.showSelector((done) => {
|
|
2439
|
-
const selector = new SelectSubmenu("Thinking Level", "Select reasoning depth for thinking-capable models", availableLevels.map((level) => ({
|
|
2440
|
-
value: level,
|
|
2441
|
-
label: level,
|
|
2442
|
-
description: THINKING_DESCRIPTIONS[level],
|
|
2443
|
-
})), this.session.thinkingLevel, (value) => {
|
|
2444
|
-
this.session.setThinkingLevel(value);
|
|
2445
|
-
this.footer.invalidate();
|
|
2446
|
-
this.updateEditorBorderColor();
|
|
2447
|
-
done();
|
|
2448
|
-
this.showStatus(`Thinking level: ${value}`);
|
|
2449
|
-
}, () => {
|
|
2450
|
-
done();
|
|
2451
|
-
});
|
|
2452
|
-
return { component: selector, focus: selector };
|
|
2453
|
-
});
|
|
2454
|
-
}
|
|
2455
2318
|
async cycleModel(direction) {
|
|
2456
2319
|
try {
|
|
2457
2320
|
const result = await this.session.cycleModel(direction);
|
|
@@ -2613,7 +2476,7 @@ export class InteractiveMode {
|
|
|
2613
2476
|
const text = theme.fg("dim", `Follow-up: ${message}`);
|
|
2614
2477
|
this.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));
|
|
2615
2478
|
}
|
|
2616
|
-
const dequeueHint = this.
|
|
2479
|
+
const dequeueHint = getAppKeyDisplay(this.keybindings, "dequeue");
|
|
2617
2480
|
const hintText = theme.fg("dim", `↳ ${dequeueHint} to edit all queued messages`);
|
|
2618
2481
|
this.pendingMessagesContainer.addChild(new TruncatedText(hintText, 1, 0));
|
|
2619
2482
|
}
|
|
@@ -3519,317 +3382,6 @@ export class InteractiveMode {
|
|
|
3519
3382
|
this.showError(`Reload failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
3520
3383
|
}
|
|
3521
3384
|
}
|
|
3522
|
-
async handleExportCommand(text) {
|
|
3523
|
-
const parts = text.split(/\s+/);
|
|
3524
|
-
const outputPath = parts.length > 1 ? parts[1] : undefined;
|
|
3525
|
-
try {
|
|
3526
|
-
const filePath = await this.session.exportToHtml(outputPath);
|
|
3527
|
-
this.showStatus(`Session exported to: ${filePath}`);
|
|
3528
|
-
}
|
|
3529
|
-
catch (error) {
|
|
3530
|
-
this.showError(`Failed to export session: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
3531
|
-
}
|
|
3532
|
-
}
|
|
3533
|
-
async handleShareCommand() {
|
|
3534
|
-
// Check if gh is available and logged in
|
|
3535
|
-
try {
|
|
3536
|
-
const authResult = spawnSync("gh", ["auth", "status"], { encoding: "utf-8" });
|
|
3537
|
-
if (authResult.status !== 0) {
|
|
3538
|
-
this.showError("GitHub CLI is not logged in. Run 'gh auth login' first.");
|
|
3539
|
-
return;
|
|
3540
|
-
}
|
|
3541
|
-
}
|
|
3542
|
-
catch {
|
|
3543
|
-
this.showError("GitHub CLI (gh) is not installed. Install it from https://cli.github.com/");
|
|
3544
|
-
return;
|
|
3545
|
-
}
|
|
3546
|
-
// Export to a temp file
|
|
3547
|
-
const tmpFile = path.join(os.tmpdir(), "session.html");
|
|
3548
|
-
try {
|
|
3549
|
-
await this.session.exportToHtml(tmpFile);
|
|
3550
|
-
}
|
|
3551
|
-
catch (error) {
|
|
3552
|
-
this.showError(`Failed to export session: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
3553
|
-
return;
|
|
3554
|
-
}
|
|
3555
|
-
// Show cancellable loader, replacing the editor
|
|
3556
|
-
const loader = new BorderedLoader(this.ui, theme, "Creating gist...");
|
|
3557
|
-
this.editorContainer.clear();
|
|
3558
|
-
this.editorContainer.addChild(loader);
|
|
3559
|
-
this.ui.setFocus(loader);
|
|
3560
|
-
this.ui.requestRender();
|
|
3561
|
-
const restoreEditor = () => {
|
|
3562
|
-
loader.dispose();
|
|
3563
|
-
this.editorContainer.clear();
|
|
3564
|
-
this.editorContainer.addChild(this.editor);
|
|
3565
|
-
this.ui.setFocus(this.editor);
|
|
3566
|
-
try {
|
|
3567
|
-
fs.unlinkSync(tmpFile);
|
|
3568
|
-
}
|
|
3569
|
-
catch {
|
|
3570
|
-
// Ignore cleanup errors
|
|
3571
|
-
}
|
|
3572
|
-
};
|
|
3573
|
-
// Create a secret gist asynchronously
|
|
3574
|
-
let proc = null;
|
|
3575
|
-
loader.onAbort = () => {
|
|
3576
|
-
proc?.kill();
|
|
3577
|
-
restoreEditor();
|
|
3578
|
-
this.showStatus("Share cancelled");
|
|
3579
|
-
};
|
|
3580
|
-
try {
|
|
3581
|
-
const result = await new Promise((resolve) => {
|
|
3582
|
-
proc = spawn("gh", ["gist", "create", "--public=false", tmpFile]);
|
|
3583
|
-
let stdout = "";
|
|
3584
|
-
let stderr = "";
|
|
3585
|
-
proc.stdout?.on("data", (data) => {
|
|
3586
|
-
stdout += data.toString();
|
|
3587
|
-
});
|
|
3588
|
-
proc.stderr?.on("data", (data) => {
|
|
3589
|
-
stderr += data.toString();
|
|
3590
|
-
});
|
|
3591
|
-
proc.on("close", (code) => resolve({ stdout, stderr, code }));
|
|
3592
|
-
});
|
|
3593
|
-
if (loader.signal.aborted)
|
|
3594
|
-
return;
|
|
3595
|
-
restoreEditor();
|
|
3596
|
-
if (result.code !== 0) {
|
|
3597
|
-
const errorMsg = result.stderr?.trim() || "Unknown error";
|
|
3598
|
-
this.showError(`Failed to create gist: ${errorMsg}`);
|
|
3599
|
-
return;
|
|
3600
|
-
}
|
|
3601
|
-
// Extract gist ID from the URL returned by gh
|
|
3602
|
-
// gh returns something like: https://gist.github.com/username/GIST_ID
|
|
3603
|
-
const gistUrl = result.stdout?.trim();
|
|
3604
|
-
const gistId = gistUrl?.split("/").pop();
|
|
3605
|
-
if (!gistId) {
|
|
3606
|
-
this.showError("Failed to parse gist ID from gh output");
|
|
3607
|
-
return;
|
|
3608
|
-
}
|
|
3609
|
-
// Create the preview URL
|
|
3610
|
-
const previewUrl = getShareViewerUrl(gistId);
|
|
3611
|
-
this.showStatus(`Share URL: ${previewUrl}\nGist: ${gistUrl}`);
|
|
3612
|
-
}
|
|
3613
|
-
catch (error) {
|
|
3614
|
-
if (!loader.signal.aborted) {
|
|
3615
|
-
restoreEditor();
|
|
3616
|
-
this.showError(`Failed to create gist: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
3617
|
-
}
|
|
3618
|
-
}
|
|
3619
|
-
}
|
|
3620
|
-
handleCopyCommand() {
|
|
3621
|
-
const text = this.session.getLastAssistantText();
|
|
3622
|
-
if (!text) {
|
|
3623
|
-
this.showError("No agent messages to copy yet.");
|
|
3624
|
-
return;
|
|
3625
|
-
}
|
|
3626
|
-
try {
|
|
3627
|
-
copyToClipboard(text);
|
|
3628
|
-
this.showStatus("Copied last agent message to clipboard");
|
|
3629
|
-
}
|
|
3630
|
-
catch (error) {
|
|
3631
|
-
this.showError(error instanceof Error ? error.message : String(error));
|
|
3632
|
-
}
|
|
3633
|
-
}
|
|
3634
|
-
handleNameCommand(text) {
|
|
3635
|
-
const name = text.replace(/^\/name\s*/, "").trim();
|
|
3636
|
-
if (!name) {
|
|
3637
|
-
const currentName = this.sessionManager.getSessionName();
|
|
3638
|
-
if (currentName) {
|
|
3639
|
-
this.chatContainer.addChild(new Spacer(1));
|
|
3640
|
-
this.chatContainer.addChild(new Text(theme.fg("dim", `Session name: ${currentName}`), 1, 0));
|
|
3641
|
-
}
|
|
3642
|
-
else {
|
|
3643
|
-
this.showWarning("Usage: /name <name>");
|
|
3644
|
-
}
|
|
3645
|
-
this.ui.requestRender();
|
|
3646
|
-
return;
|
|
3647
|
-
}
|
|
3648
|
-
this.sessionManager.appendSessionInfo(name);
|
|
3649
|
-
this.updateTerminalTitle();
|
|
3650
|
-
this.chatContainer.addChild(new Spacer(1));
|
|
3651
|
-
this.chatContainer.addChild(new Text(theme.fg("dim", `Session name set: ${name}`), 1, 0));
|
|
3652
|
-
this.ui.requestRender();
|
|
3653
|
-
}
|
|
3654
|
-
handleSessionCommand() {
|
|
3655
|
-
const stats = this.session.getSessionStats();
|
|
3656
|
-
const sessionName = this.sessionManager.getSessionName();
|
|
3657
|
-
let info = `${theme.bold("Session Info")}\n\n`;
|
|
3658
|
-
if (sessionName) {
|
|
3659
|
-
info += `${theme.fg("dim", "Name:")} ${sessionName}\n`;
|
|
3660
|
-
}
|
|
3661
|
-
info += `${theme.fg("dim", "File:")} ${stats.sessionFile ?? "In-memory"}\n`;
|
|
3662
|
-
info += `${theme.fg("dim", "ID:")} ${stats.sessionId}\n\n`;
|
|
3663
|
-
info += `${theme.bold("Messages")}\n`;
|
|
3664
|
-
info += `${theme.fg("dim", "User:")} ${stats.userMessages}\n`;
|
|
3665
|
-
info += `${theme.fg("dim", "Assistant:")} ${stats.assistantMessages}\n`;
|
|
3666
|
-
info += `${theme.fg("dim", "Tool Calls:")} ${stats.toolCalls}\n`;
|
|
3667
|
-
info += `${theme.fg("dim", "Tool Results:")} ${stats.toolResults}\n`;
|
|
3668
|
-
info += `${theme.fg("dim", "Total:")} ${stats.totalMessages}\n\n`;
|
|
3669
|
-
info += `${theme.bold("Tokens")}\n`;
|
|
3670
|
-
info += `${theme.fg("dim", "Input:")} ${stats.tokens.input.toLocaleString()}\n`;
|
|
3671
|
-
info += `${theme.fg("dim", "Output:")} ${stats.tokens.output.toLocaleString()}\n`;
|
|
3672
|
-
if (stats.tokens.cacheRead > 0) {
|
|
3673
|
-
info += `${theme.fg("dim", "Cache Read:")} ${stats.tokens.cacheRead.toLocaleString()}\n`;
|
|
3674
|
-
}
|
|
3675
|
-
if (stats.tokens.cacheWrite > 0) {
|
|
3676
|
-
info += `${theme.fg("dim", "Cache Write:")} ${stats.tokens.cacheWrite.toLocaleString()}\n`;
|
|
3677
|
-
}
|
|
3678
|
-
info += `${theme.fg("dim", "Total:")} ${stats.tokens.total.toLocaleString()}\n`;
|
|
3679
|
-
if (stats.cost > 0) {
|
|
3680
|
-
info += `\n${theme.bold("Cost")}\n`;
|
|
3681
|
-
info += `${theme.fg("dim", "Total:")} ${stats.cost.toFixed(4)}`;
|
|
3682
|
-
}
|
|
3683
|
-
this.chatContainer.addChild(new Spacer(1));
|
|
3684
|
-
this.chatContainer.addChild(new Text(info, 1, 0));
|
|
3685
|
-
this.ui.requestRender();
|
|
3686
|
-
}
|
|
3687
|
-
handleChangelogCommand() {
|
|
3688
|
-
const changelogPath = getChangelogPath();
|
|
3689
|
-
const allEntries = parseChangelog(changelogPath);
|
|
3690
|
-
const changelogMarkdown = allEntries.length > 0
|
|
3691
|
-
? allEntries
|
|
3692
|
-
.reverse()
|
|
3693
|
-
.map((e) => e.content)
|
|
3694
|
-
.join("\n\n")
|
|
3695
|
-
: "No changelog entries found.";
|
|
3696
|
-
this.chatContainer.addChild(new Spacer(1));
|
|
3697
|
-
this.chatContainer.addChild(new DynamicBorder());
|
|
3698
|
-
this.chatContainer.addChild(new Text(theme.bold(theme.fg("accent", "What's New")), 1, 0));
|
|
3699
|
-
this.chatContainer.addChild(new Spacer(1));
|
|
3700
|
-
this.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, this.getMarkdownThemeWithSettings()));
|
|
3701
|
-
this.chatContainer.addChild(new DynamicBorder());
|
|
3702
|
-
this.ui.requestRender();
|
|
3703
|
-
}
|
|
3704
|
-
/**
|
|
3705
|
-
* Capitalize keybinding for display (e.g., "ctrl+c" -> "Ctrl+C").
|
|
3706
|
-
*/
|
|
3707
|
-
capitalizeKey(key) {
|
|
3708
|
-
return key
|
|
3709
|
-
.split("/")
|
|
3710
|
-
.map((k) => k
|
|
3711
|
-
.split("+")
|
|
3712
|
-
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
3713
|
-
.join("+"))
|
|
3714
|
-
.join("/");
|
|
3715
|
-
}
|
|
3716
|
-
/**
|
|
3717
|
-
* Get capitalized display string for an app keybinding action.
|
|
3718
|
-
*/
|
|
3719
|
-
getAppKeyDisplay(action) {
|
|
3720
|
-
return this.capitalizeKey(appKey(this.keybindings, action));
|
|
3721
|
-
}
|
|
3722
|
-
/**
|
|
3723
|
-
* Get capitalized display string for an editor keybinding action.
|
|
3724
|
-
*/
|
|
3725
|
-
getEditorKeyDisplay(action) {
|
|
3726
|
-
return this.capitalizeKey(editorKey(action));
|
|
3727
|
-
}
|
|
3728
|
-
handleHotkeysCommand() {
|
|
3729
|
-
// Navigation keybindings
|
|
3730
|
-
const cursorWordLeft = this.getEditorKeyDisplay("cursorWordLeft");
|
|
3731
|
-
const cursorWordRight = this.getEditorKeyDisplay("cursorWordRight");
|
|
3732
|
-
const cursorLineStart = this.getEditorKeyDisplay("cursorLineStart");
|
|
3733
|
-
const cursorLineEnd = this.getEditorKeyDisplay("cursorLineEnd");
|
|
3734
|
-
const jumpForward = this.getEditorKeyDisplay("jumpForward");
|
|
3735
|
-
const jumpBackward = this.getEditorKeyDisplay("jumpBackward");
|
|
3736
|
-
const pageUp = this.getEditorKeyDisplay("pageUp");
|
|
3737
|
-
const pageDown = this.getEditorKeyDisplay("pageDown");
|
|
3738
|
-
// Editing keybindings
|
|
3739
|
-
const submit = this.getEditorKeyDisplay("submit");
|
|
3740
|
-
const newLine = this.getEditorKeyDisplay("newLine");
|
|
3741
|
-
const deleteWordBackward = this.getEditorKeyDisplay("deleteWordBackward");
|
|
3742
|
-
const deleteWordForward = this.getEditorKeyDisplay("deleteWordForward");
|
|
3743
|
-
const deleteToLineStart = this.getEditorKeyDisplay("deleteToLineStart");
|
|
3744
|
-
const deleteToLineEnd = this.getEditorKeyDisplay("deleteToLineEnd");
|
|
3745
|
-
const yank = this.getEditorKeyDisplay("yank");
|
|
3746
|
-
const yankPop = this.getEditorKeyDisplay("yankPop");
|
|
3747
|
-
const undo = this.getEditorKeyDisplay("undo");
|
|
3748
|
-
const tab = this.getEditorKeyDisplay("tab");
|
|
3749
|
-
// App keybindings
|
|
3750
|
-
const interrupt = this.getAppKeyDisplay("interrupt");
|
|
3751
|
-
const clear = this.getAppKeyDisplay("clear");
|
|
3752
|
-
const exit = this.getAppKeyDisplay("exit");
|
|
3753
|
-
const suspend = this.getAppKeyDisplay("suspend");
|
|
3754
|
-
const cycleThinkingLevel = this.getAppKeyDisplay("cycleThinkingLevel");
|
|
3755
|
-
const cycleModelForward = this.getAppKeyDisplay("cycleModelForward");
|
|
3756
|
-
const selectModel = this.getAppKeyDisplay("selectModel");
|
|
3757
|
-
const expandTools = this.getAppKeyDisplay("expandTools");
|
|
3758
|
-
const toggleThinking = this.getAppKeyDisplay("toggleThinking");
|
|
3759
|
-
const externalEditor = this.getAppKeyDisplay("externalEditor");
|
|
3760
|
-
const followUp = this.getAppKeyDisplay("followUp");
|
|
3761
|
-
const dequeue = this.getAppKeyDisplay("dequeue");
|
|
3762
|
-
let hotkeys = `
|
|
3763
|
-
**Navigation**
|
|
3764
|
-
| Key | Action |
|
|
3765
|
-
|-----|--------|
|
|
3766
|
-
| \`Arrow keys\` | Move cursor / browse history (Up when empty) |
|
|
3767
|
-
| \`${cursorWordLeft}\` / \`${cursorWordRight}\` | Move by word |
|
|
3768
|
-
| \`${cursorLineStart}\` | Start of line |
|
|
3769
|
-
| \`${cursorLineEnd}\` | End of line |
|
|
3770
|
-
| \`${jumpForward}\` | Jump forward to character |
|
|
3771
|
-
| \`${jumpBackward}\` | Jump backward to character |
|
|
3772
|
-
| \`${pageUp}\` / \`${pageDown}\` | Scroll by page |
|
|
3773
|
-
|
|
3774
|
-
**Editing**
|
|
3775
|
-
| Key | Action |
|
|
3776
|
-
|-----|--------|
|
|
3777
|
-
| \`${submit}\` | Send message |
|
|
3778
|
-
| \`${newLine}\` | New line${process.platform === "win32" ? " (Ctrl+Enter on Windows Terminal)" : ""} |
|
|
3779
|
-
| \`${deleteWordBackward}\` | Delete word backwards |
|
|
3780
|
-
| \`${deleteWordForward}\` | Delete word forwards |
|
|
3781
|
-
| \`${deleteToLineStart}\` | Delete to start of line |
|
|
3782
|
-
| \`${deleteToLineEnd}\` | Delete to end of line |
|
|
3783
|
-
| \`${yank}\` | Paste the most-recently-deleted text |
|
|
3784
|
-
| \`${yankPop}\` | Cycle through the deleted text after pasting |
|
|
3785
|
-
| \`${undo}\` | Undo |
|
|
3786
|
-
|
|
3787
|
-
**Other**
|
|
3788
|
-
| Key | Action |
|
|
3789
|
-
|-----|--------|
|
|
3790
|
-
| \`${tab}\` | Path completion / accept autocomplete |
|
|
3791
|
-
| \`${interrupt}\` | Cancel autocomplete / abort streaming |
|
|
3792
|
-
| \`${clear}\` | Clear editor (first) / exit (second) |
|
|
3793
|
-
| \`${exit}\` | Exit (when editor is empty) |
|
|
3794
|
-
| \`${suspend}\` | Suspend to background |
|
|
3795
|
-
| \`${cycleThinkingLevel}\` | Cycle thinking level |
|
|
3796
|
-
| \`${cycleModelForward}\` | Cycle models |
|
|
3797
|
-
| \`${selectModel}\` | Open model selector |
|
|
3798
|
-
| \`${expandTools}\` | Toggle tool output expansion |
|
|
3799
|
-
| \`${toggleThinking}\` | Toggle thinking block visibility |
|
|
3800
|
-
| \`${externalEditor}\` | Edit message in external editor |
|
|
3801
|
-
| \`${followUp}\` | Queue follow-up message |
|
|
3802
|
-
| \`${dequeue}\` | Restore queued messages |
|
|
3803
|
-
| \`Ctrl+V\` | Paste image from clipboard |
|
|
3804
|
-
| \`/\` | Slash commands |
|
|
3805
|
-
| \`!\` | Run bash command |
|
|
3806
|
-
| \`!!\` | Run bash command (excluded from context) |
|
|
3807
|
-
`;
|
|
3808
|
-
// Add extension-registered shortcuts
|
|
3809
|
-
const extensionRunner = this.session.extensionRunner;
|
|
3810
|
-
if (extensionRunner) {
|
|
3811
|
-
const shortcuts = extensionRunner.getShortcuts(this.keybindings.getEffectiveConfig());
|
|
3812
|
-
if (shortcuts.size > 0) {
|
|
3813
|
-
hotkeys += `
|
|
3814
|
-
**Extensions**
|
|
3815
|
-
| Key | Action |
|
|
3816
|
-
|-----|--------|
|
|
3817
|
-
`;
|
|
3818
|
-
for (const [key, shortcut] of shortcuts) {
|
|
3819
|
-
const description = shortcut.description ?? shortcut.extensionPath;
|
|
3820
|
-
const keyDisplay = formatKeyForDisplay(key).replace(/\b\w/g, (c) => c.toUpperCase());
|
|
3821
|
-
hotkeys += `| \`${keyDisplay}\` | ${description} |\n`;
|
|
3822
|
-
}
|
|
3823
|
-
}
|
|
3824
|
-
}
|
|
3825
|
-
this.chatContainer.addChild(new Spacer(1));
|
|
3826
|
-
this.chatContainer.addChild(new DynamicBorder());
|
|
3827
|
-
this.chatContainer.addChild(new Text(theme.bold(theme.fg("accent", "Keyboard Shortcuts")), 1, 0));
|
|
3828
|
-
this.chatContainer.addChild(new Spacer(1));
|
|
3829
|
-
this.chatContainer.addChild(new Markdown(hotkeys.trim(), 1, 1, this.getMarkdownThemeWithSettings()));
|
|
3830
|
-
this.chatContainer.addChild(new DynamicBorder());
|
|
3831
|
-
this.ui.requestRender();
|
|
3832
|
-
}
|
|
3833
3385
|
async handleClearCommand() {
|
|
3834
3386
|
// Stop loading animation
|
|
3835
3387
|
if (this.loadingAnimation) {
|
|
@@ -3878,11 +3430,6 @@ export class InteractiveMode {
|
|
|
3878
3430
|
this.chatContainer.addChild(new Text(`${theme.fg("accent", "✓ Debug log written")}\n${theme.fg("muted", debugLogPath)}`, 1, 1));
|
|
3879
3431
|
this.ui.requestRender();
|
|
3880
3432
|
}
|
|
3881
|
-
handleArminSaysHi() {
|
|
3882
|
-
this.chatContainer.addChild(new Spacer(1));
|
|
3883
|
-
this.chatContainer.addChild(new ArminComponent(this.ui));
|
|
3884
|
-
this.ui.requestRender();
|
|
3885
|
-
}
|
|
3886
3433
|
handleDaxnuts() {
|
|
3887
3434
|
this.chatContainer.addChild(new Spacer(1));
|
|
3888
3435
|
this.chatContainer.addChild(new DaxnutsComponent(this.ui));
|
|
@@ -3960,15 +3507,6 @@ export class InteractiveMode {
|
|
|
3960
3507
|
this.bashComponent = undefined;
|
|
3961
3508
|
this.ui.requestRender();
|
|
3962
3509
|
}
|
|
3963
|
-
async handleCompactCommand(customInstructions) {
|
|
3964
|
-
const entries = this.sessionManager.getEntries();
|
|
3965
|
-
const messageCount = entries.filter((e) => e.type === "message").length;
|
|
3966
|
-
if (messageCount < 2) {
|
|
3967
|
-
this.showWarning("Nothing to compact (no messages yet)");
|
|
3968
|
-
return;
|
|
3969
|
-
}
|
|
3970
|
-
await this.executeCompaction(customInstructions, false);
|
|
3971
|
-
}
|
|
3972
3510
|
async executeCompaction(customInstructions, isAuto = false) {
|
|
3973
3511
|
// Stop loading animation
|
|
3974
3512
|
if (this.loadingAnimation) {
|