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.
Files changed (204) hide show
  1. package/dist/resources/extensions/mcp-client/index.js +2 -1
  2. package/package.json +1 -1
  3. package/packages/native/dist/native.d.ts +0 -2
  4. package/packages/native/dist/native.js +0 -2
  5. package/packages/native/src/native.ts +0 -3
  6. package/packages/pi-agent-core/dist/proxy.d.ts +1 -25
  7. package/packages/pi-agent-core/dist/proxy.d.ts.map +1 -1
  8. package/packages/pi-agent-core/dist/proxy.js +1 -1
  9. package/packages/pi-agent-core/dist/proxy.js.map +1 -1
  10. package/packages/pi-agent-core/src/proxy.ts +1 -1
  11. package/packages/pi-ai/dist/api-registry.d.ts +0 -2
  12. package/packages/pi-ai/dist/api-registry.d.ts.map +1 -1
  13. package/packages/pi-ai/dist/api-registry.js +0 -10
  14. package/packages/pi-ai/dist/api-registry.js.map +1 -1
  15. package/packages/pi-ai/dist/providers/anthropic.d.ts +0 -8
  16. package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
  17. package/packages/pi-ai/dist/providers/anthropic.js +1 -1
  18. package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
  19. package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts +0 -1
  20. package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -1
  21. package/packages/pi-ai/dist/providers/github-copilot-headers.js +1 -1
  22. package/packages/pi-ai/dist/providers/github-copilot-headers.js.map +1 -1
  23. package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts +1 -43
  24. package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
  25. package/packages/pi-ai/dist/providers/google-gemini-cli.js +2 -2
  26. package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
  27. package/packages/pi-ai/dist/providers/google-shared.d.ts +0 -4
  28. package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
  29. package/packages/pi-ai/dist/providers/google-shared.js +1 -1
  30. package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
  31. package/packages/pi-ai/dist/providers/register-builtins.d.ts +0 -1
  32. package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
  33. package/packages/pi-ai/dist/providers/register-builtins.js +1 -1
  34. package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -1
  35. package/packages/pi-ai/dist/utils/event-stream.d.ts +0 -2
  36. package/packages/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
  37. package/packages/pi-ai/dist/utils/event-stream.js +0 -4
  38. package/packages/pi-ai/dist/utils/event-stream.js.map +1 -1
  39. package/packages/pi-ai/dist/utils/overflow.d.ts +0 -4
  40. package/packages/pi-ai/dist/utils/overflow.d.ts.map +1 -1
  41. package/packages/pi-ai/dist/utils/overflow.js +0 -6
  42. package/packages/pi-ai/dist/utils/overflow.js.map +1 -1
  43. package/packages/pi-ai/dist/utils/validation.d.ts +0 -8
  44. package/packages/pi-ai/dist/utils/validation.d.ts.map +1 -1
  45. package/packages/pi-ai/dist/utils/validation.js +0 -14
  46. package/packages/pi-ai/dist/utils/validation.js.map +1 -1
  47. package/packages/pi-ai/src/api-registry.ts +0 -12
  48. package/packages/pi-ai/src/providers/anthropic.ts +1 -1
  49. package/packages/pi-ai/src/providers/github-copilot-headers.ts +1 -1
  50. package/packages/pi-ai/src/providers/google-gemini-cli.ts +2 -2
  51. package/packages/pi-ai/src/providers/google-shared.ts +1 -1
  52. package/packages/pi-ai/src/providers/register-builtins.ts +1 -1
  53. package/packages/pi-ai/src/utils/event-stream.ts +0 -5
  54. package/packages/pi-ai/src/utils/overflow.ts +1 -8
  55. package/packages/pi-ai/src/utils/validation.ts +0 -15
  56. package/packages/pi-coding-agent/dist/config.d.ts +0 -9
  57. package/packages/pi-coding-agent/dist/config.d.ts.map +1 -1
  58. package/packages/pi-coding-agent/dist/config.js +4 -8
  59. package/packages/pi-coding-agent/dist/config.js.map +1 -1
  60. package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts +0 -4
  61. package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  62. package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js +1 -1
  63. package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -1
  64. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +0 -5
  65. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  66. package/packages/pi-coding-agent/dist/core/extensions/runner.js +0 -13
  67. package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  68. package/packages/pi-coding-agent/dist/core/keybindings.d.ts +0 -8
  69. package/packages/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
  70. package/packages/pi-coding-agent/dist/core/keybindings.js +2 -2
  71. package/packages/pi-coding-agent/dist/core/keybindings.js.map +1 -1
  72. package/packages/pi-coding-agent/dist/core/lsp/client.d.ts +0 -17
  73. package/packages/pi-coding-agent/dist/core/lsp/client.d.ts.map +1 -1
  74. package/packages/pi-coding-agent/dist/core/lsp/client.js +3 -62
  75. package/packages/pi-coding-agent/dist/core/lsp/client.js.map +1 -1
  76. package/packages/pi-coding-agent/dist/core/lsp/config.d.ts +0 -2
  77. package/packages/pi-coding-agent/dist/core/lsp/config.d.ts.map +1 -1
  78. package/packages/pi-coding-agent/dist/core/lsp/config.js +0 -7
  79. package/packages/pi-coding-agent/dist/core/lsp/config.js.map +1 -1
  80. package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts +0 -5
  81. package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts.map +1 -1
  82. package/packages/pi-coding-agent/dist/core/lsp/edits.js +1 -1
  83. package/packages/pi-coding-agent/dist/core/lsp/edits.js.map +1 -1
  84. package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts +0 -1
  85. package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts.map +1 -1
  86. package/packages/pi-coding-agent/dist/core/lsp/lspmux.js +1 -1
  87. package/packages/pi-coding-agent/dist/core/lsp/lspmux.js.map +1 -1
  88. package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts +1 -6
  89. package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts.map +1 -1
  90. package/packages/pi-coding-agent/dist/core/lsp/utils.js +1 -28
  91. package/packages/pi-coding-agent/dist/core/lsp/utils.js.map +1 -1
  92. package/packages/pi-coding-agent/dist/core/messages.d.ts +0 -8
  93. package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -1
  94. package/packages/pi-coding-agent/dist/core/messages.js +5 -5
  95. package/packages/pi-coding-agent/dist/core/messages.js.map +1 -1
  96. package/packages/pi-coding-agent/dist/core/model-registry.d.ts +0 -3
  97. package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
  98. package/packages/pi-coding-agent/dist/core/model-registry.js +1 -3
  99. package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
  100. package/packages/pi-coding-agent/dist/core/model-resolver.d.ts +1 -26
  101. package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
  102. package/packages/pi-coding-agent/dist/core/model-resolver.js +3 -59
  103. package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  104. package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts +0 -17
  105. package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts.map +1 -1
  106. package/packages/pi-coding-agent/dist/core/prompt-templates.js +2 -2
  107. package/packages/pi-coding-agent/dist/core/prompt-templates.js.map +1 -1
  108. package/packages/pi-coding-agent/dist/core/session-manager.d.ts +0 -4
  109. package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
  110. package/packages/pi-coding-agent/dist/core/session-manager.js +2 -4
  111. package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
  112. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +0 -12
  113. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  114. package/packages/pi-coding-agent/dist/core/settings-manager.js +2 -2
  115. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  116. package/packages/pi-coding-agent/dist/migrations.d.ts +0 -16
  117. package/packages/pi-coding-agent/dist/migrations.d.ts.map +1 -1
  118. package/packages/pi-coding-agent/dist/migrations.js +2 -2
  119. package/packages/pi-coding-agent/dist/migrations.js.map +1 -1
  120. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +0 -2
  121. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  122. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +2 -2
  123. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  124. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +1 -24
  125. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  126. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +50 -512
  127. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  128. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts +71 -0
  129. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -0
  130. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +514 -0
  131. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -0
  132. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +0 -4
  133. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  134. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +0 -7
  135. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  136. package/packages/pi-coding-agent/dist/utils/changelog.d.ts +0 -4
  137. package/packages/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -1
  138. package/packages/pi-coding-agent/dist/utils/changelog.js +1 -1
  139. package/packages/pi-coding-agent/dist/utils/changelog.js.map +1 -1
  140. package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts +0 -1
  141. package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -1
  142. package/packages/pi-coding-agent/dist/utils/clipboard-image.js +1 -1
  143. package/packages/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -1
  144. package/packages/pi-coding-agent/dist/utils/photon.d.ts +0 -19
  145. package/packages/pi-coding-agent/dist/utils/photon.d.ts.map +1 -1
  146. package/packages/pi-coding-agent/dist/utils/photon.js +1 -120
  147. package/packages/pi-coding-agent/dist/utils/photon.js.map +1 -1
  148. package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts +0 -1
  149. package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts.map +1 -1
  150. package/packages/pi-coding-agent/dist/utils/tools-manager.js +1 -1
  151. package/packages/pi-coding-agent/dist/utils/tools-manager.js.map +1 -1
  152. package/packages/pi-coding-agent/src/config.ts +5 -10
  153. package/packages/pi-coding-agent/src/core/export-html/ansi-to-html.ts +1 -1
  154. package/packages/pi-coding-agent/src/core/extensions/runner.ts +0 -13
  155. package/packages/pi-coding-agent/src/core/keybindings.ts +2 -2
  156. package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -73
  157. package/packages/pi-coding-agent/src/core/lsp/config.ts +0 -11
  158. package/packages/pi-coding-agent/src/core/lsp/edits.ts +1 -1
  159. package/packages/pi-coding-agent/src/core/lsp/lspmux.ts +1 -1
  160. package/packages/pi-coding-agent/src/core/lsp/utils.ts +1 -33
  161. package/packages/pi-coding-agent/src/core/messages.ts +5 -5
  162. package/packages/pi-coding-agent/src/core/model-registry.ts +0 -2
  163. package/packages/pi-coding-agent/src/core/model-resolver.ts +3 -77
  164. package/packages/pi-coding-agent/src/core/prompt-templates.ts +2 -2
  165. package/packages/pi-coding-agent/src/core/session-manager.ts +2 -4
  166. package/packages/pi-coding-agent/src/core/settings-manager.ts +2 -2
  167. package/packages/pi-coding-agent/src/migrations.ts +2 -2
  168. package/packages/pi-coding-agent/src/modes/interactive/components/session-selector-search.ts +2 -2
  169. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +50 -561
  170. package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +653 -0
  171. package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +0 -8
  172. package/packages/pi-coding-agent/src/utils/changelog.ts +1 -1
  173. package/packages/pi-coding-agent/src/utils/clipboard-image.ts +1 -1
  174. package/packages/pi-coding-agent/src/utils/photon.ts +0 -137
  175. package/packages/pi-coding-agent/src/utils/tools-manager.ts +1 -1
  176. package/packages/pi-tui/dist/components/editor.d.ts +0 -10
  177. package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
  178. package/packages/pi-tui/dist/components/editor.js +1 -1
  179. package/packages/pi-tui/dist/components/editor.js.map +1 -1
  180. package/packages/pi-tui/dist/overlay-layout.d.ts +55 -0
  181. package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -0
  182. package/packages/pi-tui/dist/overlay-layout.js +288 -0
  183. package/packages/pi-tui/dist/overlay-layout.js.map +1 -0
  184. package/packages/pi-tui/dist/tui.d.ts +0 -22
  185. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  186. package/packages/pi-tui/dist/tui.js +6 -272
  187. package/packages/pi-tui/dist/tui.js.map +1 -1
  188. package/packages/pi-tui/dist/utils.d.ts +0 -7
  189. package/packages/pi-tui/dist/utils.d.ts.map +1 -1
  190. package/packages/pi-tui/dist/utils.js +0 -44
  191. package/packages/pi-tui/dist/utils.js.map +1 -1
  192. package/packages/pi-tui/src/components/editor.ts +1 -1
  193. package/packages/pi-tui/src/overlay-layout.ts +372 -0
  194. package/packages/pi-tui/src/tui.ts +11 -312
  195. package/packages/pi-tui/src/utils.ts +0 -43
  196. package/pkg/dist/core/export-html/ansi-to-html.d.ts +0 -4
  197. package/pkg/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  198. package/pkg/dist/core/export-html/ansi-to-html.js +1 -1
  199. package/pkg/dist/core/export-html/ansi-to-html.js.map +1 -1
  200. package/pkg/dist/modes/interactive/theme/theme.d.ts +0 -4
  201. package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  202. package/pkg/dist/modes/interactive/theme/theme.js +0 -7
  203. package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
  204. package/src/resources/extensions/mcp-client/index.ts +2 -1
@@ -7,11 +7,10 @@ import * as crypto from "node:crypto";
7
7
  import * as fs from "node:fs";
8
8
  import * as os from "node:os";
9
9
  import * as path from "node:path";
10
- import type { AgentMessage, ThinkingLevel } from "@gsd/pi-agent-core";
10
+ import type { AgentMessage } from "@gsd/pi-agent-core";
11
11
  import type { AssistantMessage, ImageContent, Message, Model, OAuthProviderId } from "@gsd/pi-ai";
12
12
  import type {
13
13
  AutocompleteItem,
14
- EditorAction,
15
14
  EditorComponent,
16
15
  EditorTheme,
17
16
  KeyId,
@@ -40,7 +39,6 @@ import {
40
39
  APP_NAME,
41
40
  getAuthPath,
42
41
  getDebugLogPath,
43
- getShareViewerUrl,
44
42
  getUpdateInstruction,
45
43
  VERSION,
46
44
  } from "../../config.js";
@@ -62,10 +60,8 @@ import { type SessionContext, SessionManager } from "../../core/session-manager.
62
60
  import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
63
61
  import type { TruncationResult } from "../../core/tools/truncate.js";
64
62
  import { getChangelogPath, getNewEntries, parseChangelog } from "../../utils/changelog.js";
65
- import { copyToClipboard } from "../../utils/clipboard.js";
66
63
  import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
67
64
  import { ensureTool } from "../../utils/tools-manager.js";
68
- import { ArminComponent } from "./components/armin.js";
69
65
  import { AssistantMessageComponent } from "./components/assistant-message.js";
70
66
  import { BashExecutionComponent } from "./components/bash-execution.js";
71
67
  import { BorderedLoader } from "./components/bordered-loader.js";
@@ -86,12 +82,13 @@ import { OAuthSelectorComponent } from "./components/oauth-selector.js";
86
82
  import { ProviderManagerComponent } from "./components/provider-manager.js";
87
83
  import { ScopedModelsSelectorComponent } from "./components/scoped-models-selector.js";
88
84
  import { SessionSelectorComponent } from "./components/session-selector.js";
89
- import { SelectSubmenu, SettingsSelectorComponent, THINKING_DESCRIPTIONS } from "./components/settings-selector.js";
85
+ import { SettingsSelectorComponent } from "./components/settings-selector.js";
90
86
  import { SkillInvocationMessageComponent } from "./components/skill-invocation-message.js";
91
87
  import { ToolExecutionComponent } from "./components/tool-execution.js";
92
88
  import { TreeSelectorComponent } from "./components/tree-selector.js";
93
89
  import { UserMessageComponent } from "./components/user-message.js";
94
90
  import { UserMessageSelectorComponent } from "./components/user-message-selector.js";
91
+ import { type SlashCommandContext, dispatchSlashCommand, getAppKeyDisplay } from "./slash-command-handlers.js";
95
92
  import {
96
93
  getAvailableThemes,
97
94
  getAvailableThemesWithPaths,
@@ -1980,135 +1977,57 @@ export class InteractiveMode {
1980
1977
  }
1981
1978
  }
1982
1979
 
1980
+ private getSlashCommandContext(): SlashCommandContext {
1981
+ return {
1982
+ session: this.session,
1983
+ ui: this.ui,
1984
+ keybindings: this.keybindings,
1985
+ chatContainer: this.chatContainer,
1986
+ statusContainer: this.statusContainer,
1987
+ editorContainer: this.editorContainer,
1988
+ headerContainer: this.headerContainer,
1989
+ pendingMessagesContainer: this.pendingMessagesContainer,
1990
+ editor: this.editor,
1991
+ defaultEditor: this.defaultEditor,
1992
+ sessionManager: this.sessionManager,
1993
+ settingsManager: this.settingsManager,
1994
+ invalidateFooter: () => this.footer.invalidate(),
1995
+ showStatus: (msg) => this.showStatus(msg),
1996
+ showError: (msg) => this.showError(msg),
1997
+ showWarning: (msg) => this.showWarning(msg),
1998
+ showSelector: (create) => this.showSelector(create),
1999
+ updateEditorBorderColor: () => this.updateEditorBorderColor(),
2000
+ getMarkdownThemeWithSettings: () => this.getMarkdownThemeWithSettings(),
2001
+ requestRender: () => this.ui.requestRender(),
2002
+ updateTerminalTitle: () => this.updateTerminalTitle(),
2003
+ showSettingsSelector: () => this.showSettingsSelector(),
2004
+ showModelsSelector: () => this.showModelsSelector(),
2005
+ handleModelCommand: (searchTerm) => this.handleModelCommand(searchTerm),
2006
+ showUserMessageSelector: () => this.showUserMessageSelector(),
2007
+ showTreeSelector: () => this.showTreeSelector(),
2008
+ showProviderManager: () => this.showProviderManager(),
2009
+ showOAuthSelector: (mode) => this.showOAuthSelector(mode),
2010
+ showSessionSelector: () => this.showSessionSelector(),
2011
+ handleClearCommand: () => this.handleClearCommand(),
2012
+ handleReloadCommand: () => this.handleReloadCommand(),
2013
+ handleDebugCommand: () => this.handleDebugCommand(),
2014
+ shutdown: () => this.shutdown(),
2015
+ executeCompaction: (instructions, isAuto) => this.executeCompaction(instructions, isAuto),
2016
+ };
2017
+ }
2018
+
1983
2019
  private setupEditorSubmitHandler(): void {
1984
2020
  this.defaultEditor.onSubmit = async (text: string) => {
1985
2021
  text = text.trim();
1986
2022
  if (!text) return;
1987
2023
 
1988
- // Handle commands
1989
- if (text === "/settings") {
1990
- this.showSettingsSelector();
1991
- this.editor.setText("");
1992
- return;
1993
- }
1994
- if (text === "/scoped-models") {
1995
- this.editor.setText("");
1996
- await this.showModelsSelector();
1997
- return;
1998
- }
1999
- if (text === "/model" || text.startsWith("/model ")) {
2000
- const searchTerm = text.startsWith("/model ") ? text.slice(7).trim() : undefined;
2001
- this.editor.setText("");
2002
- await this.handleModelCommand(searchTerm);
2003
- return;
2004
- }
2005
- if (text.startsWith("/export")) {
2006
- await this.handleExportCommand(text);
2007
- this.editor.setText("");
2008
- return;
2009
- }
2010
- if (text === "/share") {
2011
- await this.handleShareCommand();
2012
- this.editor.setText("");
2013
- return;
2014
- }
2015
- if (text === "/copy") {
2016
- this.handleCopyCommand();
2017
- this.editor.setText("");
2018
- return;
2019
- }
2020
- if (text === "/name" || text.startsWith("/name ")) {
2021
- this.handleNameCommand(text);
2022
- this.editor.setText("");
2023
- return;
2024
- }
2025
- if (text === "/session") {
2026
- this.handleSessionCommand();
2027
- this.editor.setText("");
2028
- return;
2029
- }
2030
- if (text === "/changelog") {
2031
- this.handleChangelogCommand();
2032
- this.editor.setText("");
2033
- return;
2034
- }
2035
- if (text === "/hotkeys") {
2036
- this.handleHotkeysCommand();
2037
- this.editor.setText("");
2038
- return;
2039
- }
2040
- if (text === "/fork") {
2041
- this.showUserMessageSelector();
2042
- this.editor.setText("");
2043
- return;
2044
- }
2045
- if (text === "/tree") {
2046
- this.showTreeSelector();
2047
- this.editor.setText("");
2048
- return;
2049
- }
2050
- if (text === "/provider") {
2051
- this.showProviderManager();
2052
- this.editor.setText("");
2053
- return;
2054
- }
2055
- if (text === "/login") {
2056
- this.showOAuthSelector("login");
2057
- this.editor.setText("");
2058
- return;
2059
- }
2060
- if (text === "/logout") {
2061
- this.showOAuthSelector("logout");
2062
- this.editor.setText("");
2063
- return;
2064
- }
2065
- if (text === "/new") {
2066
- this.editor.setText("");
2067
- await this.handleClearCommand();
2068
- return;
2069
- }
2070
- if (text === "/compact" || text.startsWith("/compact ")) {
2071
- const customInstructions = text.startsWith("/compact ") ? text.slice(9).trim() : undefined;
2072
- this.editor.setText("");
2073
- await this.handleCompactCommand(customInstructions);
2074
- return;
2075
- }
2076
- if (text === "/reload") {
2077
- this.editor.setText("");
2078
- await this.handleReloadCommand();
2079
- return;
2080
- }
2081
- if (text === "/thinking" || text.startsWith("/thinking ")) {
2082
- const arg = text.startsWith("/thinking ") ? text.slice(10).trim() : undefined;
2083
- this.editor.setText("");
2084
- this.handleThinkingCommand(arg);
2085
- return;
2086
- }
2087
- if (text === "/edit-mode" || text.startsWith("/edit-mode ")) {
2088
- const arg = text.startsWith("/edit-mode ") ? text.slice(11).trim() : undefined;
2089
- this.editor.setText("");
2090
- this.handleEditModeCommand(arg);
2091
- return;
2092
- }
2093
- if (text === "/debug") {
2094
- this.handleDebugCommand();
2095
- this.editor.setText("");
2096
- return;
2097
- }
2098
- if (text === "/arminsayshi") {
2099
- this.handleArminSaysHi();
2100
- this.editor.setText("");
2101
- return;
2102
- }
2103
- if (text === "/resume") {
2104
- this.showSessionSelector();
2105
- this.editor.setText("");
2106
- return;
2107
- }
2108
- if (text === "/quit") {
2109
- this.editor.setText("");
2110
- await this.shutdown();
2111
- return;
2024
+ // Handle slash commands
2025
+ if (text.startsWith("/")) {
2026
+ const handled = await dispatchSlashCommand(text, this.getSlashCommandContext());
2027
+ if (handled) {
2028
+ this.editor.setText("");
2029
+ return;
2030
+ }
2112
2031
  }
2113
2032
 
2114
2033
  // Handle bash command (! for normal, !! for excluded from context)
@@ -2897,78 +2816,6 @@ export class InteractiveMode {
2897
2816
  }
2898
2817
  }
2899
2818
 
2900
- private handleThinkingCommand(arg?: string): void {
2901
- if (!this.session.supportsThinking()) {
2902
- this.showStatus("Current model does not support thinking");
2903
- return;
2904
- }
2905
-
2906
- const availableLevels = this.session.getAvailableThinkingLevels();
2907
-
2908
- if (arg) {
2909
- const level = arg.toLowerCase();
2910
- if (!availableLevels.includes(level as ThinkingLevel)) {
2911
- this.showStatus(`Invalid thinking level "${arg}". Available: ${availableLevels.join(", ")}`);
2912
- return;
2913
- }
2914
- this.session.setThinkingLevel(level as ThinkingLevel);
2915
- this.footer.invalidate();
2916
- this.updateEditorBorderColor();
2917
- this.showStatus(`Thinking level: ${level}`);
2918
- return;
2919
- }
2920
-
2921
- this.showThinkingSelector();
2922
- }
2923
-
2924
- private handleEditModeCommand(arg?: string): void {
2925
- const modes = ["standard", "hashline"] as const;
2926
-
2927
- if (arg) {
2928
- const mode = arg.toLowerCase();
2929
- if (!modes.includes(mode as typeof modes[number])) {
2930
- this.showStatus(`Invalid edit mode "${arg}". Available: standard, hashline`);
2931
- return;
2932
- }
2933
- this.session.setEditMode(mode as "standard" | "hashline");
2934
- this.showStatus(`Edit mode: ${mode}${mode === "hashline" ? " (LINE#ID anchored edits)" : " (text-match edits)"}`);
2935
- return;
2936
- }
2937
-
2938
- // Toggle
2939
- const current = this.session.editMode;
2940
- const next = current === "standard" ? "hashline" : "standard";
2941
- this.session.setEditMode(next);
2942
- this.showStatus(`Edit mode: ${next}${next === "hashline" ? " (LINE#ID anchored edits)" : " (text-match edits)"}`);
2943
- }
2944
-
2945
- private showThinkingSelector(): void {
2946
- const availableLevels = this.session.getAvailableThinkingLevels();
2947
- this.showSelector((done) => {
2948
- const selector = new SelectSubmenu(
2949
- "Thinking Level",
2950
- "Select reasoning depth for thinking-capable models",
2951
- availableLevels.map((level) => ({
2952
- value: level,
2953
- label: level,
2954
- description: THINKING_DESCRIPTIONS[level],
2955
- })),
2956
- this.session.thinkingLevel,
2957
- (value) => {
2958
- this.session.setThinkingLevel(value as ThinkingLevel);
2959
- this.footer.invalidate();
2960
- this.updateEditorBorderColor();
2961
- done();
2962
- this.showStatus(`Thinking level: ${value}`);
2963
- },
2964
- () => {
2965
- done();
2966
- },
2967
- );
2968
- return { component: selector, focus: selector };
2969
- });
2970
- }
2971
-
2972
2819
  private async cycleModel(direction: "forward" | "backward"): Promise<void> {
2973
2820
  try {
2974
2821
  const result = await this.session.cycleModel(direction);
@@ -3159,7 +3006,7 @@ export class InteractiveMode {
3159
3006
  const text = theme.fg("dim", `Follow-up: ${message}`);
3160
3007
  this.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));
3161
3008
  }
3162
- const dequeueHint = this.getAppKeyDisplay("dequeue");
3009
+ const dequeueHint = getAppKeyDisplay(this.keybindings, "dequeue");
3163
3010
  const hintText = theme.fg("dim", `↳ ${dequeueHint} to edit all queued messages`);
3164
3011
  this.pendingMessagesContainer.addChild(new TruncatedText(hintText, 1, 0));
3165
3012
  }
@@ -4191,346 +4038,6 @@ export class InteractiveMode {
4191
4038
  }
4192
4039
  }
4193
4040
 
4194
- private async handleExportCommand(text: string): Promise<void> {
4195
- const parts = text.split(/\s+/);
4196
- const outputPath = parts.length > 1 ? parts[1] : undefined;
4197
-
4198
- try {
4199
- const filePath = await this.session.exportToHtml(outputPath);
4200
- this.showStatus(`Session exported to: ${filePath}`);
4201
- } catch (error: unknown) {
4202
- this.showError(`Failed to export session: ${error instanceof Error ? error.message : "Unknown error"}`);
4203
- }
4204
- }
4205
-
4206
- private async handleShareCommand(): Promise<void> {
4207
- // Check if gh is available and logged in
4208
- try {
4209
- const authResult = spawnSync("gh", ["auth", "status"], { encoding: "utf-8" });
4210
- if (authResult.status !== 0) {
4211
- this.showError("GitHub CLI is not logged in. Run 'gh auth login' first.");
4212
- return;
4213
- }
4214
- } catch {
4215
- this.showError("GitHub CLI (gh) is not installed. Install it from https://cli.github.com/");
4216
- return;
4217
- }
4218
-
4219
- // Export to a temp file
4220
- const tmpFile = path.join(os.tmpdir(), "session.html");
4221
- try {
4222
- await this.session.exportToHtml(tmpFile);
4223
- } catch (error: unknown) {
4224
- this.showError(`Failed to export session: ${error instanceof Error ? error.message : "Unknown error"}`);
4225
- return;
4226
- }
4227
-
4228
- // Show cancellable loader, replacing the editor
4229
- const loader = new BorderedLoader(this.ui, theme, "Creating gist...");
4230
- this.editorContainer.clear();
4231
- this.editorContainer.addChild(loader);
4232
- this.ui.setFocus(loader);
4233
- this.ui.requestRender();
4234
-
4235
- const restoreEditor = () => {
4236
- loader.dispose();
4237
- this.editorContainer.clear();
4238
- this.editorContainer.addChild(this.editor);
4239
- this.ui.setFocus(this.editor);
4240
- try {
4241
- fs.unlinkSync(tmpFile);
4242
- } catch {
4243
- // Ignore cleanup errors
4244
- }
4245
- };
4246
-
4247
- // Create a secret gist asynchronously
4248
- let proc: ReturnType<typeof spawn> | null = null;
4249
-
4250
- loader.onAbort = () => {
4251
- proc?.kill();
4252
- restoreEditor();
4253
- this.showStatus("Share cancelled");
4254
- };
4255
-
4256
- try {
4257
- const result = await new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve) => {
4258
- proc = spawn("gh", ["gist", "create", "--public=false", tmpFile]);
4259
- let stdout = "";
4260
- let stderr = "";
4261
- proc.stdout?.on("data", (data) => {
4262
- stdout += data.toString();
4263
- });
4264
- proc.stderr?.on("data", (data) => {
4265
- stderr += data.toString();
4266
- });
4267
- proc.on("close", (code) => resolve({ stdout, stderr, code }));
4268
- });
4269
-
4270
- if (loader.signal.aborted) return;
4271
-
4272
- restoreEditor();
4273
-
4274
- if (result.code !== 0) {
4275
- const errorMsg = result.stderr?.trim() || "Unknown error";
4276
- this.showError(`Failed to create gist: ${errorMsg}`);
4277
- return;
4278
- }
4279
-
4280
- // Extract gist ID from the URL returned by gh
4281
- // gh returns something like: https://gist.github.com/username/GIST_ID
4282
- const gistUrl = result.stdout?.trim();
4283
- const gistId = gistUrl?.split("/").pop();
4284
- if (!gistId) {
4285
- this.showError("Failed to parse gist ID from gh output");
4286
- return;
4287
- }
4288
-
4289
- // Create the preview URL
4290
- const previewUrl = getShareViewerUrl(gistId);
4291
- this.showStatus(`Share URL: ${previewUrl}\nGist: ${gistUrl}`);
4292
- } catch (error: unknown) {
4293
- if (!loader.signal.aborted) {
4294
- restoreEditor();
4295
- this.showError(`Failed to create gist: ${error instanceof Error ? error.message : "Unknown error"}`);
4296
- }
4297
- }
4298
- }
4299
-
4300
- private handleCopyCommand(): void {
4301
- const text = this.session.getLastAssistantText();
4302
- if (!text) {
4303
- this.showError("No agent messages to copy yet.");
4304
- return;
4305
- }
4306
-
4307
- try {
4308
- copyToClipboard(text);
4309
- this.showStatus("Copied last agent message to clipboard");
4310
- } catch (error) {
4311
- this.showError(error instanceof Error ? error.message : String(error));
4312
- }
4313
- }
4314
-
4315
- private handleNameCommand(text: string): void {
4316
- const name = text.replace(/^\/name\s*/, "").trim();
4317
- if (!name) {
4318
- const currentName = this.sessionManager.getSessionName();
4319
- if (currentName) {
4320
- this.chatContainer.addChild(new Spacer(1));
4321
- this.chatContainer.addChild(new Text(theme.fg("dim", `Session name: ${currentName}`), 1, 0));
4322
- } else {
4323
- this.showWarning("Usage: /name <name>");
4324
- }
4325
- this.ui.requestRender();
4326
- return;
4327
- }
4328
-
4329
- this.sessionManager.appendSessionInfo(name);
4330
- this.updateTerminalTitle();
4331
- this.chatContainer.addChild(new Spacer(1));
4332
- this.chatContainer.addChild(new Text(theme.fg("dim", `Session name set: ${name}`), 1, 0));
4333
- this.ui.requestRender();
4334
- }
4335
-
4336
- private handleSessionCommand(): void {
4337
- const stats = this.session.getSessionStats();
4338
- const sessionName = this.sessionManager.getSessionName();
4339
-
4340
- let info = `${theme.bold("Session Info")}\n\n`;
4341
- if (sessionName) {
4342
- info += `${theme.fg("dim", "Name:")} ${sessionName}\n`;
4343
- }
4344
- info += `${theme.fg("dim", "File:")} ${stats.sessionFile ?? "In-memory"}\n`;
4345
- info += `${theme.fg("dim", "ID:")} ${stats.sessionId}\n\n`;
4346
- info += `${theme.bold("Messages")}\n`;
4347
- info += `${theme.fg("dim", "User:")} ${stats.userMessages}\n`;
4348
- info += `${theme.fg("dim", "Assistant:")} ${stats.assistantMessages}\n`;
4349
- info += `${theme.fg("dim", "Tool Calls:")} ${stats.toolCalls}\n`;
4350
- info += `${theme.fg("dim", "Tool Results:")} ${stats.toolResults}\n`;
4351
- info += `${theme.fg("dim", "Total:")} ${stats.totalMessages}\n\n`;
4352
- info += `${theme.bold("Tokens")}\n`;
4353
- info += `${theme.fg("dim", "Input:")} ${stats.tokens.input.toLocaleString()}\n`;
4354
- info += `${theme.fg("dim", "Output:")} ${stats.tokens.output.toLocaleString()}\n`;
4355
- if (stats.tokens.cacheRead > 0) {
4356
- info += `${theme.fg("dim", "Cache Read:")} ${stats.tokens.cacheRead.toLocaleString()}\n`;
4357
- }
4358
- if (stats.tokens.cacheWrite > 0) {
4359
- info += `${theme.fg("dim", "Cache Write:")} ${stats.tokens.cacheWrite.toLocaleString()}\n`;
4360
- }
4361
- info += `${theme.fg("dim", "Total:")} ${stats.tokens.total.toLocaleString()}\n`;
4362
-
4363
- if (stats.cost > 0) {
4364
- info += `\n${theme.bold("Cost")}\n`;
4365
- info += `${theme.fg("dim", "Total:")} ${stats.cost.toFixed(4)}`;
4366
- }
4367
-
4368
- this.chatContainer.addChild(new Spacer(1));
4369
- this.chatContainer.addChild(new Text(info, 1, 0));
4370
- this.ui.requestRender();
4371
- }
4372
-
4373
- private handleChangelogCommand(): void {
4374
- const changelogPath = getChangelogPath();
4375
- const allEntries = parseChangelog(changelogPath);
4376
-
4377
- const changelogMarkdown =
4378
- allEntries.length > 0
4379
- ? allEntries
4380
- .reverse()
4381
- .map((e) => e.content)
4382
- .join("\n\n")
4383
- : "No changelog entries found.";
4384
-
4385
- this.chatContainer.addChild(new Spacer(1));
4386
- this.chatContainer.addChild(new DynamicBorder());
4387
- this.chatContainer.addChild(new Text(theme.bold(theme.fg("accent", "What's New")), 1, 0));
4388
- this.chatContainer.addChild(new Spacer(1));
4389
- this.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, this.getMarkdownThemeWithSettings()));
4390
- this.chatContainer.addChild(new DynamicBorder());
4391
- this.ui.requestRender();
4392
- }
4393
-
4394
- /**
4395
- * Capitalize keybinding for display (e.g., "ctrl+c" -> "Ctrl+C").
4396
- */
4397
- private capitalizeKey(key: string): string {
4398
- return key
4399
- .split("/")
4400
- .map((k) =>
4401
- k
4402
- .split("+")
4403
- .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
4404
- .join("+"),
4405
- )
4406
- .join("/");
4407
- }
4408
-
4409
- /**
4410
- * Get capitalized display string for an app keybinding action.
4411
- */
4412
- private getAppKeyDisplay(action: AppAction): string {
4413
- return this.capitalizeKey(appKey(this.keybindings, action));
4414
- }
4415
-
4416
- /**
4417
- * Get capitalized display string for an editor keybinding action.
4418
- */
4419
- private getEditorKeyDisplay(action: EditorAction): string {
4420
- return this.capitalizeKey(editorKey(action));
4421
- }
4422
-
4423
- private handleHotkeysCommand(): void {
4424
- // Navigation keybindings
4425
- const cursorWordLeft = this.getEditorKeyDisplay("cursorWordLeft");
4426
- const cursorWordRight = this.getEditorKeyDisplay("cursorWordRight");
4427
- const cursorLineStart = this.getEditorKeyDisplay("cursorLineStart");
4428
- const cursorLineEnd = this.getEditorKeyDisplay("cursorLineEnd");
4429
- const jumpForward = this.getEditorKeyDisplay("jumpForward");
4430
- const jumpBackward = this.getEditorKeyDisplay("jumpBackward");
4431
- const pageUp = this.getEditorKeyDisplay("pageUp");
4432
- const pageDown = this.getEditorKeyDisplay("pageDown");
4433
-
4434
- // Editing keybindings
4435
- const submit = this.getEditorKeyDisplay("submit");
4436
- const newLine = this.getEditorKeyDisplay("newLine");
4437
- const deleteWordBackward = this.getEditorKeyDisplay("deleteWordBackward");
4438
- const deleteWordForward = this.getEditorKeyDisplay("deleteWordForward");
4439
- const deleteToLineStart = this.getEditorKeyDisplay("deleteToLineStart");
4440
- const deleteToLineEnd = this.getEditorKeyDisplay("deleteToLineEnd");
4441
- const yank = this.getEditorKeyDisplay("yank");
4442
- const yankPop = this.getEditorKeyDisplay("yankPop");
4443
- const undo = this.getEditorKeyDisplay("undo");
4444
- const tab = this.getEditorKeyDisplay("tab");
4445
-
4446
- // App keybindings
4447
- const interrupt = this.getAppKeyDisplay("interrupt");
4448
- const clear = this.getAppKeyDisplay("clear");
4449
- const exit = this.getAppKeyDisplay("exit");
4450
- const suspend = this.getAppKeyDisplay("suspend");
4451
- const cycleThinkingLevel = this.getAppKeyDisplay("cycleThinkingLevel");
4452
- const cycleModelForward = this.getAppKeyDisplay("cycleModelForward");
4453
- const selectModel = this.getAppKeyDisplay("selectModel");
4454
- const expandTools = this.getAppKeyDisplay("expandTools");
4455
- const toggleThinking = this.getAppKeyDisplay("toggleThinking");
4456
- const externalEditor = this.getAppKeyDisplay("externalEditor");
4457
- const followUp = this.getAppKeyDisplay("followUp");
4458
- const dequeue = this.getAppKeyDisplay("dequeue");
4459
-
4460
- let hotkeys = `
4461
- **Navigation**
4462
- | Key | Action |
4463
- |-----|--------|
4464
- | \`Arrow keys\` | Move cursor / browse history (Up when empty) |
4465
- | \`${cursorWordLeft}\` / \`${cursorWordRight}\` | Move by word |
4466
- | \`${cursorLineStart}\` | Start of line |
4467
- | \`${cursorLineEnd}\` | End of line |
4468
- | \`${jumpForward}\` | Jump forward to character |
4469
- | \`${jumpBackward}\` | Jump backward to character |
4470
- | \`${pageUp}\` / \`${pageDown}\` | Scroll by page |
4471
-
4472
- **Editing**
4473
- | Key | Action |
4474
- |-----|--------|
4475
- | \`${submit}\` | Send message |
4476
- | \`${newLine}\` | New line${process.platform === "win32" ? " (Ctrl+Enter on Windows Terminal)" : ""} |
4477
- | \`${deleteWordBackward}\` | Delete word backwards |
4478
- | \`${deleteWordForward}\` | Delete word forwards |
4479
- | \`${deleteToLineStart}\` | Delete to start of line |
4480
- | \`${deleteToLineEnd}\` | Delete to end of line |
4481
- | \`${yank}\` | Paste the most-recently-deleted text |
4482
- | \`${yankPop}\` | Cycle through the deleted text after pasting |
4483
- | \`${undo}\` | Undo |
4484
-
4485
- **Other**
4486
- | Key | Action |
4487
- |-----|--------|
4488
- | \`${tab}\` | Path completion / accept autocomplete |
4489
- | \`${interrupt}\` | Cancel autocomplete / abort streaming |
4490
- | \`${clear}\` | Clear editor (first) / exit (second) |
4491
- | \`${exit}\` | Exit (when editor is empty) |
4492
- | \`${suspend}\` | Suspend to background |
4493
- | \`${cycleThinkingLevel}\` | Cycle thinking level |
4494
- | \`${cycleModelForward}\` | Cycle models |
4495
- | \`${selectModel}\` | Open model selector |
4496
- | \`${expandTools}\` | Toggle tool output expansion |
4497
- | \`${toggleThinking}\` | Toggle thinking block visibility |
4498
- | \`${externalEditor}\` | Edit message in external editor |
4499
- | \`${followUp}\` | Queue follow-up message |
4500
- | \`${dequeue}\` | Restore queued messages |
4501
- | \`Ctrl+V\` | Paste image from clipboard |
4502
- | \`/\` | Slash commands |
4503
- | \`!\` | Run bash command |
4504
- | \`!!\` | Run bash command (excluded from context) |
4505
- `;
4506
-
4507
- // Add extension-registered shortcuts
4508
- const extensionRunner = this.session.extensionRunner;
4509
- if (extensionRunner) {
4510
- const shortcuts = extensionRunner.getShortcuts(this.keybindings.getEffectiveConfig());
4511
- if (shortcuts.size > 0) {
4512
- hotkeys += `
4513
- **Extensions**
4514
- | Key | Action |
4515
- |-----|--------|
4516
- `;
4517
- for (const [key, shortcut] of shortcuts) {
4518
- const description = shortcut.description ?? shortcut.extensionPath;
4519
- const keyDisplay = formatKeyForDisplay(key).replace(/\b\w/g, (c) => c.toUpperCase());
4520
- hotkeys += `| \`${keyDisplay}\` | ${description} |\n`;
4521
- }
4522
- }
4523
- }
4524
-
4525
- this.chatContainer.addChild(new Spacer(1));
4526
- this.chatContainer.addChild(new DynamicBorder());
4527
- this.chatContainer.addChild(new Text(theme.bold(theme.fg("accent", "Keyboard Shortcuts")), 1, 0));
4528
- this.chatContainer.addChild(new Spacer(1));
4529
- this.chatContainer.addChild(new Markdown(hotkeys.trim(), 1, 1, this.getMarkdownThemeWithSettings()));
4530
- this.chatContainer.addChild(new DynamicBorder());
4531
- this.ui.requestRender();
4532
- }
4533
-
4534
4041
  private async handleClearCommand(): Promise<void> {
4535
4042
  // Stop loading animation
4536
4043
  if (this.loadingAnimation) {
@@ -4589,12 +4096,6 @@ export class InteractiveMode {
4589
4096
  this.ui.requestRender();
4590
4097
  }
4591
4098
 
4592
- private handleArminSaysHi(): void {
4593
- this.chatContainer.addChild(new Spacer(1));
4594
- this.chatContainer.addChild(new ArminComponent(this.ui));
4595
- this.ui.requestRender();
4596
- }
4597
-
4598
4099
  private handleDaxnuts(): void {
4599
4100
  this.chatContainer.addChild(new Spacer(1));
4600
4101
  this.chatContainer.addChild(new DaxnutsComponent(this.ui));
@@ -4696,18 +4197,6 @@ export class InteractiveMode {
4696
4197
  this.ui.requestRender();
4697
4198
  }
4698
4199
 
4699
- private async handleCompactCommand(customInstructions?: string): Promise<void> {
4700
- const entries = this.sessionManager.getEntries();
4701
- const messageCount = entries.filter((e) => e.type === "message").length;
4702
-
4703
- if (messageCount < 2) {
4704
- this.showWarning("Nothing to compact (no messages yet)");
4705
- return;
4706
- }
4707
-
4708
- await this.executeCompaction(customInstructions, false);
4709
- }
4710
-
4711
4200
  private async executeCompaction(customInstructions?: string, isAuto = false): Promise<CompactionResult | undefined> {
4712
4201
  // Stop loading animation
4713
4202
  if (this.loadingAnimation) {