@bastani/atomic 0.9.4-alpha.5 → 0.9.4-alpha.7

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 (202) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/builtin/cursor/CHANGELOG.md +6 -0
  3. package/dist/builtin/cursor/package.json +4 -4
  4. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  5. package/dist/builtin/intercom/package.json +2 -2
  6. package/dist/builtin/mcp/CHANGELOG.md +6 -0
  7. package/dist/builtin/mcp/package.json +4 -4
  8. package/dist/builtin/subagents/CHANGELOG.md +20 -0
  9. package/dist/builtin/subagents/package.json +4 -4
  10. package/dist/builtin/subagents/src/runs/background/async-execution-chain.ts +11 -1
  11. package/dist/builtin/subagents/src/runs/background/async-execution-single.ts +11 -1
  12. package/dist/builtin/subagents/src/runs/background/async-execution-types.ts +2 -0
  13. package/dist/builtin/subagents/src/runs/background/subagent-runner-step.ts +27 -4
  14. package/dist/builtin/subagents/src/runs/background/subagent-runner-streaming.ts +25 -0
  15. package/dist/builtin/subagents/src/runs/foreground/chain-execution-dynamic-step.ts +1 -0
  16. package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-runner.ts +1 -0
  17. package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-step.ts +1 -0
  18. package/dist/builtin/subagents/src/runs/foreground/chain-execution-sequential-step.ts +1 -0
  19. package/dist/builtin/subagents/src/runs/foreground/chain-execution-types.ts +2 -0
  20. package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +3 -1
  21. package/dist/builtin/subagents/src/runs/foreground/execution-attempt.ts +22 -0
  22. package/dist/builtin/subagents/src/runs/foreground/execution-run-sync.ts +15 -5
  23. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +5 -1
  24. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +2 -0
  25. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +4 -1
  26. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +4 -1
  27. package/dist/builtin/subagents/src/runs/shared/attempt-watchdog.ts +126 -0
  28. package/dist/builtin/subagents/src/runs/shared/model-candidate-filter.ts +53 -0
  29. package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +52 -53
  30. package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +2 -0
  31. package/dist/builtin/subagents/src/shared/model-info.ts +16 -0
  32. package/dist/builtin/subagents/src/shared/types-config.ts +2 -0
  33. package/dist/builtin/web-access/CHANGELOG.md +6 -0
  34. package/dist/builtin/web-access/package.json +2 -2
  35. package/dist/builtin/workflows/CHANGELOG.md +12 -0
  36. package/dist/builtin/workflows/package.json +2 -2
  37. package/dist/builtin/workflows/src/runs/shared/model-fallback-failures.ts +34 -4
  38. package/dist/cli/file-processor.d.ts.map +1 -1
  39. package/dist/cli/file-processor.js +13 -25
  40. package/dist/cli/file-processor.js.map +1 -1
  41. package/dist/core/agent-session-extension-bindings.d.ts +2 -0
  42. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  43. package/dist/core/agent-session-extension-bindings.js +11 -3
  44. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  45. package/dist/core/agent-session-methods.d.ts +4 -1
  46. package/dist/core/agent-session-methods.d.ts.map +1 -1
  47. package/dist/core/agent-session-methods.js.map +1 -1
  48. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  49. package/dist/core/agent-session-prompt.js +11 -4
  50. package/dist/core/agent-session-prompt.js.map +1 -1
  51. package/dist/core/agent-session-state.d.ts.map +1 -1
  52. package/dist/core/agent-session-state.js +2 -2
  53. package/dist/core/agent-session-state.js.map +1 -1
  54. package/dist/core/agent-session-tool-hooks.d.ts +7 -1
  55. package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
  56. package/dist/core/agent-session-tool-hooks.js +26 -4
  57. package/dist/core/agent-session-tool-hooks.js.map +1 -1
  58. package/dist/core/agent-session-tree.d.ts.map +1 -1
  59. package/dist/core/agent-session-tree.js +3 -1
  60. package/dist/core/agent-session-tree.js.map +1 -1
  61. package/dist/core/agent-session.d.ts +1 -0
  62. package/dist/core/agent-session.d.ts.map +1 -1
  63. package/dist/core/agent-session.js +1 -0
  64. package/dist/core/agent-session.js.map +1 -1
  65. package/dist/core/copilot-model-catalog.d.ts +25 -74
  66. package/dist/core/copilot-model-catalog.d.ts.map +1 -1
  67. package/dist/core/copilot-model-catalog.js +118 -68
  68. package/dist/core/copilot-model-catalog.js.map +1 -1
  69. package/dist/core/copilot-model-synthesis.d.ts +10 -0
  70. package/dist/core/copilot-model-synthesis.d.ts.map +1 -0
  71. package/dist/core/copilot-model-synthesis.js +89 -0
  72. package/dist/core/copilot-model-synthesis.js.map +1 -0
  73. package/dist/core/extensions/api-types.d.ts +2 -1
  74. package/dist/core/extensions/api-types.d.ts.map +1 -1
  75. package/dist/core/extensions/api-types.js.map +1 -1
  76. package/dist/core/extensions/index.d.ts +1 -1
  77. package/dist/core/extensions/index.d.ts.map +1 -1
  78. package/dist/core/extensions/index.js.map +1 -1
  79. package/dist/core/extensions/loader-core.d.ts.map +1 -1
  80. package/dist/core/extensions/loader-core.js +3 -3
  81. package/dist/core/extensions/loader-core.js.map +1 -1
  82. package/dist/core/extensions/session-events.d.ts +7 -1
  83. package/dist/core/extensions/session-events.d.ts.map +1 -1
  84. package/dist/core/extensions/session-events.js.map +1 -1
  85. package/dist/core/http-dispatcher.d.ts.map +1 -1
  86. package/dist/core/http-dispatcher.js +28 -1
  87. package/dist/core/http-dispatcher.js.map +1 -1
  88. package/dist/core/model-registry-builtins.d.ts.map +1 -1
  89. package/dist/core/model-registry-builtins.js +21 -3
  90. package/dist/core/model-registry-builtins.js.map +1 -1
  91. package/dist/core/model-resolver-defaults.d.ts.map +1 -1
  92. package/dist/core/model-resolver-defaults.js +1 -1
  93. package/dist/core/model-resolver-defaults.js.map +1 -1
  94. package/dist/core/resource-loader-reload.d.ts.map +1 -1
  95. package/dist/core/resource-loader-reload.js +2 -1
  96. package/dist/core/resource-loader-reload.js.map +1 -1
  97. package/dist/core/session-manager-core.d.ts +2 -12
  98. package/dist/core/session-manager-core.d.ts.map +1 -1
  99. package/dist/core/session-manager-core.js +8 -16
  100. package/dist/core/session-manager-core.js.map +1 -1
  101. package/dist/core/settings-manager-resource-accessors.d.ts +1 -0
  102. package/dist/core/settings-manager-resource-accessors.d.ts.map +1 -1
  103. package/dist/core/settings-manager-resource-accessors.js +11 -0
  104. package/dist/core/settings-manager-resource-accessors.js.map +1 -1
  105. package/dist/core/settings-manager-ui-accessors.d.ts +2 -0
  106. package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -1
  107. package/dist/core/settings-manager-ui-accessors.js +9 -0
  108. package/dist/core/settings-manager-ui-accessors.js.map +1 -1
  109. package/dist/core/settings-types.d.ts +2 -0
  110. package/dist/core/settings-types.d.ts.map +1 -1
  111. package/dist/core/settings-types.js.map +1 -1
  112. package/dist/core/timings.d.ts +7 -5
  113. package/dist/core/timings.d.ts.map +1 -1
  114. package/dist/core/timings.js +42 -24
  115. package/dist/core/timings.js.map +1 -1
  116. package/dist/core/tools/read-selectors.d.ts.map +1 -1
  117. package/dist/core/tools/read-selectors.js +19 -1
  118. package/dist/core/tools/read-selectors.js.map +1 -1
  119. package/dist/core/tools/read.d.ts.map +1 -1
  120. package/dist/core/tools/read.js +12 -23
  121. package/dist/core/tools/read.js.map +1 -1
  122. package/dist/index-extensions.d.ts +1 -1
  123. package/dist/index-extensions.d.ts.map +1 -1
  124. package/dist/index-extensions.js.map +1 -1
  125. package/dist/index.d.ts +1 -1
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js.map +1 -1
  128. package/dist/main-session.d.ts.map +1 -1
  129. package/dist/main-session.js +14 -5
  130. package/dist/main-session.js.map +1 -1
  131. package/dist/modes/interactive/components/assistant-message.d.ts +3 -1
  132. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  133. package/dist/modes/interactive/components/assistant-message.js +22 -15
  134. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  135. package/dist/modes/interactive/components/chat-message-renderer.d.ts +1 -0
  136. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  137. package/dist/modes/interactive/components/chat-message-renderer.js +5 -5
  138. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  139. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
  140. package/dist/modes/interactive/components/chat-session-host-rendering.js +1 -0
  141. package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
  142. package/dist/modes/interactive/components/user-message.d.ts +6 -2
  143. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  144. package/dist/modes/interactive/components/user-message.js +16 -5
  145. package/dist/modes/interactive/components/user-message.js.map +1 -1
  146. package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -1
  147. package/dist/modes/interactive/interactive-agent-events.js +1 -1
  148. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  149. package/dist/modes/interactive/interactive-editor-actions.d.ts.map +1 -1
  150. package/dist/modes/interactive/interactive-editor-actions.js +1 -0
  151. package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
  152. package/dist/modes/interactive/interactive-extension-context.d.ts.map +1 -1
  153. package/dist/modes/interactive/interactive-extension-context.js +1 -0
  154. package/dist/modes/interactive/interactive-extension-context.js.map +1 -1
  155. package/dist/modes/interactive/interactive-mode-base.d.ts +1 -0
  156. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  157. package/dist/modes/interactive/interactive-mode-base.js +2 -0
  158. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  159. package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
  160. package/dist/modes/interactive/interactive-model-routing.js +1 -0
  161. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  162. package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
  163. package/dist/modes/interactive/interactive-render-chat.js +4 -3
  164. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  165. package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -1
  166. package/dist/modes/interactive/interactive-session-runtime.js +1 -0
  167. package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
  168. package/dist/modes/rpc/rpc-client.d.ts +28 -51
  169. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  170. package/dist/modes/rpc/rpc-client.js +27 -51
  171. package/dist/modes/rpc/rpc-client.js.map +1 -1
  172. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  173. package/dist/modes/rpc/rpc-command-handler.js +19 -0
  174. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  175. package/dist/modes/rpc/rpc-types.d.ts +26 -0
  176. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  177. package/dist/modes/rpc/rpc-types.js.map +1 -1
  178. package/dist/rpc-entry.d.ts +3 -0
  179. package/dist/rpc-entry.d.ts.map +1 -0
  180. package/dist/rpc-entry.js +12 -0
  181. package/dist/rpc-entry.js.map +1 -0
  182. package/dist/utils/image-convert.d.ts +1 -0
  183. package/dist/utils/image-convert.d.ts.map +1 -1
  184. package/dist/utils/image-convert.js +21 -15
  185. package/dist/utils/image-convert.js.map +1 -1
  186. package/dist/utils/image-process.d.ts +18 -0
  187. package/dist/utils/image-process.d.ts.map +1 -0
  188. package/dist/utils/image-process.js +83 -0
  189. package/dist/utils/image-process.js.map +1 -0
  190. package/dist/utils/mime.d.ts.map +1 -1
  191. package/dist/utils/mime.js +41 -0
  192. package/dist/utils/mime.js.map +1 -1
  193. package/docs/extensions.md +11 -0
  194. package/docs/models.md +3 -3
  195. package/docs/providers.md +1 -1
  196. package/docs/rpc.md +60 -2
  197. package/docs/sdk.md +1 -1
  198. package/docs/settings.md +4 -1
  199. package/docs/subagents.md +6 -0
  200. package/docs/workflows.md +2 -0
  201. package/npm-shrinkwrap.json +138 -140
  202. package/package.json +15 -10
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-model-routing.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-model-routing.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, getAgentDir, findExactModelReferenceMatch, resolveModelScope, ContextWindowSelectorComponent, formatContextWindow, copilotApiBaseUrlFromToken, copilotCatalogCacheHost, copilotCatalogCachePath, fetchCopilotModelCatalog, readCopilotCatalogCache, setActiveCopilotModelCatalog, writeCopilotCatalogCache, ModelSelectorComponent, ScopedModelsSelectorComponent, UserMessageSelectorComponent } from \"./interactive-mode-deps.ts\";\nimport { ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, isAnthropicSubscriptionAuthKey } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.handleModelCommand = async function(this: InteractiveModeBase, searchTerm?: string): Promise<void> {\n if (!searchTerm) {\n this.showModelSelector();\n return;\n }\n\n const model = await this.findExactModelMatch(searchTerm);\n if (model) {\n try {\n await this.session.setModel(model);\n this.footer.invalidate();\n this.updateEditorBorderColor();\n this.showStatus(`Model: ${model.id}`);\n void this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n this.checkDaxnutsEasterEgg(model);\n await this.resumePendingFirstRunOnboardingSeed();\n } catch (error) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n return;\n }\n\n this.showModelSelector(searchTerm);\n };\n\nInteractiveModeBase.prototype.findExactModelMatch = async function(this: InteractiveModeBase, searchTerm: string): Promise<Model<Api> | undefined> {\n const models = await this.getModelCandidates();\n return findExactModelReferenceMatch(searchTerm, models);\n };\n\nInteractiveModeBase.prototype.getModelCandidates = async function(this: InteractiveModeBase): Promise<Model<Api>[]> {\n if (this.session.scopedModels.length > 0) {\n return this.session.scopedModels.map((scoped) => scoped.model);\n }\n\n await this.refreshCopilotModelCatalog();\n this.session.modelRegistry.refresh();\n try {\n return await this.session.modelRegistry.getAvailable();\n } catch {\n return [];\n }\n };\n\nInteractiveModeBase.prototype.refreshCopilotModelCatalog = async function(this: InteractiveModeBase): Promise<void> {\n if (this.copilotCatalogApplied) return;\n if (!this.copilotCatalogInFlight) {\n this.copilotCatalogInFlight = this.loadCopilotModelCatalog();\n }\n try {\n await this.copilotCatalogInFlight;\n } finally {\n this.copilotCatalogInFlight = undefined;\n }\n };\n\nInteractiveModeBase.prototype.loadCopilotModelCatalog = async function(this: InteractiveModeBase): Promise<void> {\n const registry = this.session.modelRegistry;\n // Gate: do nothing unless the user has a Copilot token, including COPILOT_GITHUB_TOKEN env auth.\n try {\n const token = await registry.getApiKeyForProvider(\"github-copilot\");\n if (!token) return;\n const baseUrl = copilotApiBaseUrlFromToken(token);\n const cachePath = copilotCatalogCachePath(getAgentDir());\n let catalog = readCopilotCatalogCache(cachePath, { host: copilotCatalogCacheHost(baseUrl) });\n if (!catalog) {\n catalog = await fetchCopilotModelCatalog({ token, baseUrl });\n writeCopilotCatalogCache(cachePath, baseUrl, catalog);\n }\n setActiveCopilotModelCatalog(catalog);\n registry.refresh();\n this.copilotCatalogApplied = true;\n } catch {\n // Best-effort: leave the active catalog as-is on any failure (offline, auth, parse).\n }\n };\n\nInteractiveModeBase.prototype.updateAvailableProviderCount = async function(this: InteractiveModeBase): Promise<void> {\n const models = await this.getModelCandidates();\n const uniqueProviders = new Set(models.map((m) => m.provider));\n this.footerDataProvider.setAvailableProviderCount(uniqueProviders.size);\n };\n\nInteractiveModeBase.prototype.maybeWarnAboutAnthropicSubscriptionAuth = async function(this: InteractiveModeBase, model: Model<Api> | undefined = this.session.model): Promise<void> {\n if (this.settingsManager.getWarnings().anthropicExtraUsage === false) {\n return;\n }\n if (this.anthropicSubscriptionWarningShown) {\n return;\n }\n if (!model || model.provider !== \"anthropic\") {\n return;\n }\n\n const storedCredential =\n this.session.modelRegistry.authStorage.get(\"anthropic\");\n if (storedCredential?.type === \"oauth\") {\n this.anthropicSubscriptionWarningShown = true;\n this.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING);\n return;\n }\n\n try {\n const apiKey = await this.session.modelRegistry.getApiKeyForProvider(\n model.provider,\n );\n if (!isAnthropicSubscriptionAuthKey(apiKey)) {\n return;\n }\n this.anthropicSubscriptionWarningShown = true;\n this.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING);\n } catch {\n // Ignore auth lookup failures for warning-only checks.\n }\n };\n\nInteractiveModeBase.prototype.showModelSelector = function(this: InteractiveModeBase, initialSearchInput?: string): void {\n this.showSelector((done) => {\n const selector = new ModelSelectorComponent(\n this.ui,\n this.session.model,\n this.settingsManager,\n this.session.modelRegistry,\n this.session.scopedModels,\n async (model) => {\n try {\n await this.session.setModel(model);\n this.footer.invalidate();\n this.updateEditorBorderColor();\n done();\n void this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n this.checkDaxnutsEasterEgg(model);\n if (this.session.supportsContextWindowSelection()) {\n this.showContextWindowSelector(model);\n } else {\n this.showStatus(`Model: ${model.id}`);\n await this.resumePendingFirstRunOnboardingSeed();\n }\n } catch (error) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n initialSearchInput,\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showContextWindowSelector = function(this: InteractiveModeBase, model: Model<Api>): void {\n const availableContextWindows = this.session.getAvailableContextWindows();\n const currentContextWindow =\n this.session.model?.contextWindow ?? availableContextWindows[0] ?? 0;\n this.showSelector((done) => {\n const selector = new ContextWindowSelectorComponent(\n model.name ?? model.id,\n availableContextWindows,\n currentContextWindow,\n async (contextWindow) => {\n try {\n this.session.setContextWindow(contextWindow, {\n persistDefault: true,\n });\n this.footer.invalidate();\n this.usageMeter.invalidate();\n this.updateEditorBorderColor();\n done();\n this.showStatus(\n `Model: ${model.id} \\u00b7 ${formatContextWindow(contextWindow)} context`,\n );\n await this.resumePendingFirstRunOnboardingSeed();\n } catch (error) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.showStatus(`Model: ${model.id}`);\n },\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showModelsSelector = async function(this: InteractiveModeBase): Promise<void> {\n // Get all available models\n this.session.modelRegistry.refresh();\n const allModels = this.session.modelRegistry.getAvailable();\n\n if (allModels.length === 0) {\n this.showStatus(\"No models available\");\n return;\n }\n\n // Check if session has scoped models (from previous session-only changes or CLI --models)\n const sessionScopedModels = this.session.scopedModels;\n const hasSessionScope = sessionScopedModels.length > 0;\n\n // Build enabled model IDs from session state or settings\n let currentEnabledIds: string[] | null = null;\n\n if (hasSessionScope) {\n // Use current session's scoped models\n currentEnabledIds = sessionScopedModels.map(\n (scoped) => `${scoped.model.provider}/${scoped.model.id}`,\n );\n } else {\n // Fall back to settings\n const patterns = this.settingsManager.getEnabledModels();\n if (patterns !== undefined && patterns.length > 0) {\n const scopedModels = await resolveModelScope(\n patterns,\n this.session.modelRegistry,\n );\n currentEnabledIds = scopedModels.map(\n (scoped) => `${scoped.model.provider}/${scoped.model.id}`,\n );\n }\n }\n\n // Helper to update session's scoped models (session-only, no persist)\n const updateSessionModels = async (enabledIds: string[] | null) => {\n currentEnabledIds = enabledIds === null ? null : [...enabledIds];\n if (\n enabledIds &&\n enabledIds.length > 0 &&\n enabledIds.length < allModels.length\n ) {\n const newScopedModels = await resolveModelScope(\n enabledIds,\n this.session.modelRegistry,\n );\n this.session.setScopedModels(\n newScopedModels.map((sm) => ({\n model: sm.model,\n thinkingLevel: sm.thinkingLevel,\n })),\n );\n } else {\n // All enabled or none enabled = no filter\n this.session.setScopedModels([]);\n }\n await this.updateAvailableProviderCount();\n this.setupAutocompleteProvider();\n this.ui.requestRender();\n };\n\n this.showSelector((done) => {\n const selector = new ScopedModelsSelectorComponent(\n {\n allModels,\n enabledModelIds: currentEnabledIds,\n },\n {\n onChange: async (enabledIds) => {\n await updateSessionModels(enabledIds);\n },\n onPersist: (enabledIds) => {\n // Persist to settings\n const newPatterns =\n enabledIds === null || enabledIds.length === allModels.length\n ? undefined // All enabled = clear filter\n : enabledIds;\n this.settingsManager.setEnabledModels(\n newPatterns ? [...newPatterns] : undefined,\n );\n this.showStatus(\"Model selection saved to settings\");\n },\n onCancel: () => {\n done();\n this.ui.requestRender();\n },\n },\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showUserMessageSelector = function(this: InteractiveModeBase): void {\n const userMessages = this.session.getUserMessagesForForking();\n\n if (userMessages.length === 0) {\n this.showStatus(\"No messages to fork from\");\n return;\n }\n\n const initialSelectedId = userMessages[userMessages.length - 1]?.entryId;\n\n this.showSelector((done) => {\n const selector = new UserMessageSelectorComponent(\n userMessages.map((m) => ({ id: m.entryId, text: m.text })),\n async (entryId) => {\n try {\n const result = await this.runtimeHost.fork(entryId);\n if (result.cancelled) {\n done();\n this.ui.requestRender();\n return;\n }\n\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n done();\n this.showStatus(\"Forked to new session\");\n } catch (error: unknown) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n initialSelectedId,\n );\n return { component: selector, focus: selector.getMessageList() };\n });\n };\n"]}
1
+ {"version":3,"file":"interactive-model-routing.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-model-routing.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, getAgentDir, findExactModelReferenceMatch, resolveModelScope, ContextWindowSelectorComponent, formatContextWindow, copilotApiBaseUrlFromToken, copilotCatalogCacheHost, copilotCatalogCachePath, fetchCopilotModelCatalog, readCopilotCatalogCache, setActiveCopilotModelCatalog, writeCopilotCatalogCache, ModelSelectorComponent, ScopedModelsSelectorComponent, UserMessageSelectorComponent } from \"./interactive-mode-deps.ts\";\nimport { ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, isAnthropicSubscriptionAuthKey } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.handleModelCommand = async function(this: InteractiveModeBase, searchTerm?: string): Promise<void> {\n if (!searchTerm) {\n this.showModelSelector();\n return;\n }\n\n const model = await this.findExactModelMatch(searchTerm);\n if (model) {\n try {\n await this.session.setModel(model);\n this.footer.invalidate();\n this.updateEditorBorderColor();\n this.showStatus(`Model: ${model.id}`);\n void this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n this.checkDaxnutsEasterEgg(model);\n await this.resumePendingFirstRunOnboardingSeed();\n } catch (error) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n return;\n }\n\n this.showModelSelector(searchTerm);\n };\n\nInteractiveModeBase.prototype.findExactModelMatch = async function(this: InteractiveModeBase, searchTerm: string): Promise<Model<Api> | undefined> {\n const models = await this.getModelCandidates();\n return findExactModelReferenceMatch(searchTerm, models);\n };\n\nInteractiveModeBase.prototype.getModelCandidates = async function(this: InteractiveModeBase): Promise<Model<Api>[]> {\n if (this.session.scopedModels.length > 0) {\n return this.session.scopedModels.map((scoped) => scoped.model);\n }\n\n await this.refreshCopilotModelCatalog();\n this.session.modelRegistry.refresh();\n try {\n return await this.session.modelRegistry.getAvailable();\n } catch {\n return [];\n }\n };\n\nInteractiveModeBase.prototype.refreshCopilotModelCatalog = async function(this: InteractiveModeBase): Promise<void> {\n if (this.copilotCatalogApplied) return;\n if (!this.copilotCatalogInFlight) {\n this.copilotCatalogInFlight = this.loadCopilotModelCatalog();\n }\n try {\n await this.copilotCatalogInFlight;\n } finally {\n this.copilotCatalogInFlight = undefined;\n }\n };\n\nInteractiveModeBase.prototype.loadCopilotModelCatalog = async function(this: InteractiveModeBase): Promise<void> {\n const registry = this.session.modelRegistry;\n // Gate: do nothing unless the user has a Copilot token, including COPILOT_GITHUB_TOKEN env auth.\n try {\n const token = await registry.getApiKeyForProvider(\"github-copilot\");\n if (!token) return;\n const baseUrl = copilotApiBaseUrlFromToken(token);\n const cachePath = copilotCatalogCachePath(getAgentDir());\n let catalog = readCopilotCatalogCache(cachePath, { host: copilotCatalogCacheHost(baseUrl) });\n if (!catalog) {\n catalog = await fetchCopilotModelCatalog({ token, baseUrl });\n writeCopilotCatalogCache(cachePath, baseUrl, catalog);\n }\n setActiveCopilotModelCatalog(catalog);\n registry.refresh();\n this.session.refreshCurrentModelFromRegistry();\n this.copilotCatalogApplied = true;\n } catch {\n // Best-effort: leave the active catalog as-is on any failure (offline, auth, parse).\n }\n };\n\nInteractiveModeBase.prototype.updateAvailableProviderCount = async function(this: InteractiveModeBase): Promise<void> {\n const models = await this.getModelCandidates();\n const uniqueProviders = new Set(models.map((m) => m.provider));\n this.footerDataProvider.setAvailableProviderCount(uniqueProviders.size);\n };\n\nInteractiveModeBase.prototype.maybeWarnAboutAnthropicSubscriptionAuth = async function(this: InteractiveModeBase, model: Model<Api> | undefined = this.session.model): Promise<void> {\n if (this.settingsManager.getWarnings().anthropicExtraUsage === false) {\n return;\n }\n if (this.anthropicSubscriptionWarningShown) {\n return;\n }\n if (!model || model.provider !== \"anthropic\") {\n return;\n }\n\n const storedCredential =\n this.session.modelRegistry.authStorage.get(\"anthropic\");\n if (storedCredential?.type === \"oauth\") {\n this.anthropicSubscriptionWarningShown = true;\n this.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING);\n return;\n }\n\n try {\n const apiKey = await this.session.modelRegistry.getApiKeyForProvider(\n model.provider,\n );\n if (!isAnthropicSubscriptionAuthKey(apiKey)) {\n return;\n }\n this.anthropicSubscriptionWarningShown = true;\n this.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING);\n } catch {\n // Ignore auth lookup failures for warning-only checks.\n }\n };\n\nInteractiveModeBase.prototype.showModelSelector = function(this: InteractiveModeBase, initialSearchInput?: string): void {\n this.showSelector((done) => {\n const selector = new ModelSelectorComponent(\n this.ui,\n this.session.model,\n this.settingsManager,\n this.session.modelRegistry,\n this.session.scopedModels,\n async (model) => {\n try {\n await this.session.setModel(model);\n this.footer.invalidate();\n this.updateEditorBorderColor();\n done();\n void this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n this.checkDaxnutsEasterEgg(model);\n if (this.session.supportsContextWindowSelection()) {\n this.showContextWindowSelector(model);\n } else {\n this.showStatus(`Model: ${model.id}`);\n await this.resumePendingFirstRunOnboardingSeed();\n }\n } catch (error) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n initialSearchInput,\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showContextWindowSelector = function(this: InteractiveModeBase, model: Model<Api>): void {\n const availableContextWindows = this.session.getAvailableContextWindows();\n const currentContextWindow =\n this.session.model?.contextWindow ?? availableContextWindows[0] ?? 0;\n this.showSelector((done) => {\n const selector = new ContextWindowSelectorComponent(\n model.name ?? model.id,\n availableContextWindows,\n currentContextWindow,\n async (contextWindow) => {\n try {\n this.session.setContextWindow(contextWindow, {\n persistDefault: true,\n });\n this.footer.invalidate();\n this.usageMeter.invalidate();\n this.updateEditorBorderColor();\n done();\n this.showStatus(\n `Model: ${model.id} \\u00b7 ${formatContextWindow(contextWindow)} context`,\n );\n await this.resumePendingFirstRunOnboardingSeed();\n } catch (error) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.showStatus(`Model: ${model.id}`);\n },\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showModelsSelector = async function(this: InteractiveModeBase): Promise<void> {\n // Get all available models\n this.session.modelRegistry.refresh();\n const allModels = this.session.modelRegistry.getAvailable();\n\n if (allModels.length === 0) {\n this.showStatus(\"No models available\");\n return;\n }\n\n // Check if session has scoped models (from previous session-only changes or CLI --models)\n const sessionScopedModels = this.session.scopedModels;\n const hasSessionScope = sessionScopedModels.length > 0;\n\n // Build enabled model IDs from session state or settings\n let currentEnabledIds: string[] | null = null;\n\n if (hasSessionScope) {\n // Use current session's scoped models\n currentEnabledIds = sessionScopedModels.map(\n (scoped) => `${scoped.model.provider}/${scoped.model.id}`,\n );\n } else {\n // Fall back to settings\n const patterns = this.settingsManager.getEnabledModels();\n if (patterns !== undefined && patterns.length > 0) {\n const scopedModels = await resolveModelScope(\n patterns,\n this.session.modelRegistry,\n );\n currentEnabledIds = scopedModels.map(\n (scoped) => `${scoped.model.provider}/${scoped.model.id}`,\n );\n }\n }\n\n // Helper to update session's scoped models (session-only, no persist)\n const updateSessionModels = async (enabledIds: string[] | null) => {\n currentEnabledIds = enabledIds === null ? null : [...enabledIds];\n if (\n enabledIds &&\n enabledIds.length > 0 &&\n enabledIds.length < allModels.length\n ) {\n const newScopedModels = await resolveModelScope(\n enabledIds,\n this.session.modelRegistry,\n );\n this.session.setScopedModels(\n newScopedModels.map((sm) => ({\n model: sm.model,\n thinkingLevel: sm.thinkingLevel,\n })),\n );\n } else {\n // All enabled or none enabled = no filter\n this.session.setScopedModels([]);\n }\n await this.updateAvailableProviderCount();\n this.setupAutocompleteProvider();\n this.ui.requestRender();\n };\n\n this.showSelector((done) => {\n const selector = new ScopedModelsSelectorComponent(\n {\n allModels,\n enabledModelIds: currentEnabledIds,\n },\n {\n onChange: async (enabledIds) => {\n await updateSessionModels(enabledIds);\n },\n onPersist: (enabledIds) => {\n // Persist to settings\n const newPatterns =\n enabledIds === null || enabledIds.length === allModels.length\n ? undefined // All enabled = clear filter\n : enabledIds;\n this.settingsManager.setEnabledModels(\n newPatterns ? [...newPatterns] : undefined,\n );\n this.showStatus(\"Model selection saved to settings\");\n },\n onCancel: () => {\n done();\n this.ui.requestRender();\n },\n },\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showUserMessageSelector = function(this: InteractiveModeBase): void {\n const userMessages = this.session.getUserMessagesForForking();\n\n if (userMessages.length === 0) {\n this.showStatus(\"No messages to fork from\");\n return;\n }\n\n const initialSelectedId = userMessages[userMessages.length - 1]?.entryId;\n\n this.showSelector((done) => {\n const selector = new UserMessageSelectorComponent(\n userMessages.map((m) => ({ id: m.entryId, text: m.text })),\n async (entryId) => {\n try {\n const result = await this.runtimeHost.fork(entryId);\n if (result.cancelled) {\n done();\n this.ui.requestRender();\n return;\n }\n\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n done();\n this.showStatus(\"Forked to new session\");\n } catch (error: unknown) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n initialSelectedId,\n );\n return { component: selector, focus: selector.getMessageList() };\n });\n };\n"]}
@@ -70,6 +70,7 @@ InteractiveModeBase.prototype.loadCopilotModelCatalog = async function () {
70
70
  }
71
71
  setActiveCopilotModelCatalog(catalog);
72
72
  registry.refresh();
73
+ this.session.refreshCurrentModelFromRegistry();
73
74
  this.copilotCatalogApplied = true;
74
75
  }
75
76
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-model-routing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-model-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAwB,WAAW,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AACnc,OAAO,EAAE,mCAAmC,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAEpH,mBAAmB,CAAC,SAAS,CAAC,kBAAkB,GAAG,KAAK,WAAqC,UAAmB;IAC5G,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,OAAO;IACT,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,mBAAmB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,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;YACJ,CAAC;QACH,CAAC,EACD,GAAG,EAAE;YACH,IAAI,EAAE,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;QAC1B,CAAC,EACD,iBAAiB,CAClB,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,cAAc,EAAE,EAAE,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, getAgentDir, findExactModelReferenceMatch, resolveModelScope, ContextWindowSelectorComponent, formatContextWindow, copilotApiBaseUrlFromToken, copilotCatalogCacheHost, copilotCatalogCachePath, fetchCopilotModelCatalog, readCopilotCatalogCache, setActiveCopilotModelCatalog, writeCopilotCatalogCache, ModelSelectorComponent, ScopedModelsSelectorComponent, UserMessageSelectorComponent } from \"./interactive-mode-deps.ts\";\nimport { ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, isAnthropicSubscriptionAuthKey } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.handleModelCommand = async function(this: InteractiveModeBase, searchTerm?: string): Promise<void> {\n if (!searchTerm) {\n this.showModelSelector();\n return;\n }\n\n const model = await this.findExactModelMatch(searchTerm);\n if (model) {\n try {\n await this.session.setModel(model);\n this.footer.invalidate();\n this.updateEditorBorderColor();\n this.showStatus(`Model: ${model.id}`);\n void this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n this.checkDaxnutsEasterEgg(model);\n await this.resumePendingFirstRunOnboardingSeed();\n } catch (error) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n return;\n }\n\n this.showModelSelector(searchTerm);\n };\n\nInteractiveModeBase.prototype.findExactModelMatch = async function(this: InteractiveModeBase, searchTerm: string): Promise<Model<Api> | undefined> {\n const models = await this.getModelCandidates();\n return findExactModelReferenceMatch(searchTerm, models);\n };\n\nInteractiveModeBase.prototype.getModelCandidates = async function(this: InteractiveModeBase): Promise<Model<Api>[]> {\n if (this.session.scopedModels.length > 0) {\n return this.session.scopedModels.map((scoped) => scoped.model);\n }\n\n await this.refreshCopilotModelCatalog();\n this.session.modelRegistry.refresh();\n try {\n return await this.session.modelRegistry.getAvailable();\n } catch {\n return [];\n }\n };\n\nInteractiveModeBase.prototype.refreshCopilotModelCatalog = async function(this: InteractiveModeBase): Promise<void> {\n if (this.copilotCatalogApplied) return;\n if (!this.copilotCatalogInFlight) {\n this.copilotCatalogInFlight = this.loadCopilotModelCatalog();\n }\n try {\n await this.copilotCatalogInFlight;\n } finally {\n this.copilotCatalogInFlight = undefined;\n }\n };\n\nInteractiveModeBase.prototype.loadCopilotModelCatalog = async function(this: InteractiveModeBase): Promise<void> {\n const registry = this.session.modelRegistry;\n // Gate: do nothing unless the user has a Copilot token, including COPILOT_GITHUB_TOKEN env auth.\n try {\n const token = await registry.getApiKeyForProvider(\"github-copilot\");\n if (!token) return;\n const baseUrl = copilotApiBaseUrlFromToken(token);\n const cachePath = copilotCatalogCachePath(getAgentDir());\n let catalog = readCopilotCatalogCache(cachePath, { host: copilotCatalogCacheHost(baseUrl) });\n if (!catalog) {\n catalog = await fetchCopilotModelCatalog({ token, baseUrl });\n writeCopilotCatalogCache(cachePath, baseUrl, catalog);\n }\n setActiveCopilotModelCatalog(catalog);\n registry.refresh();\n this.copilotCatalogApplied = true;\n } catch {\n // Best-effort: leave the active catalog as-is on any failure (offline, auth, parse).\n }\n };\n\nInteractiveModeBase.prototype.updateAvailableProviderCount = async function(this: InteractiveModeBase): Promise<void> {\n const models = await this.getModelCandidates();\n const uniqueProviders = new Set(models.map((m) => m.provider));\n this.footerDataProvider.setAvailableProviderCount(uniqueProviders.size);\n };\n\nInteractiveModeBase.prototype.maybeWarnAboutAnthropicSubscriptionAuth = async function(this: InteractiveModeBase, model: Model<Api> | undefined = this.session.model): Promise<void> {\n if (this.settingsManager.getWarnings().anthropicExtraUsage === false) {\n return;\n }\n if (this.anthropicSubscriptionWarningShown) {\n return;\n }\n if (!model || model.provider !== \"anthropic\") {\n return;\n }\n\n const storedCredential =\n this.session.modelRegistry.authStorage.get(\"anthropic\");\n if (storedCredential?.type === \"oauth\") {\n this.anthropicSubscriptionWarningShown = true;\n this.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING);\n return;\n }\n\n try {\n const apiKey = await this.session.modelRegistry.getApiKeyForProvider(\n model.provider,\n );\n if (!isAnthropicSubscriptionAuthKey(apiKey)) {\n return;\n }\n this.anthropicSubscriptionWarningShown = true;\n this.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING);\n } catch {\n // Ignore auth lookup failures for warning-only checks.\n }\n };\n\nInteractiveModeBase.prototype.showModelSelector = function(this: InteractiveModeBase, initialSearchInput?: string): void {\n this.showSelector((done) => {\n const selector = new ModelSelectorComponent(\n this.ui,\n this.session.model,\n this.settingsManager,\n this.session.modelRegistry,\n this.session.scopedModels,\n async (model) => {\n try {\n await this.session.setModel(model);\n this.footer.invalidate();\n this.updateEditorBorderColor();\n done();\n void this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n this.checkDaxnutsEasterEgg(model);\n if (this.session.supportsContextWindowSelection()) {\n this.showContextWindowSelector(model);\n } else {\n this.showStatus(`Model: ${model.id}`);\n await this.resumePendingFirstRunOnboardingSeed();\n }\n } catch (error) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n initialSearchInput,\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showContextWindowSelector = function(this: InteractiveModeBase, model: Model<Api>): void {\n const availableContextWindows = this.session.getAvailableContextWindows();\n const currentContextWindow =\n this.session.model?.contextWindow ?? availableContextWindows[0] ?? 0;\n this.showSelector((done) => {\n const selector = new ContextWindowSelectorComponent(\n model.name ?? model.id,\n availableContextWindows,\n currentContextWindow,\n async (contextWindow) => {\n try {\n this.session.setContextWindow(contextWindow, {\n persistDefault: true,\n });\n this.footer.invalidate();\n this.usageMeter.invalidate();\n this.updateEditorBorderColor();\n done();\n this.showStatus(\n `Model: ${model.id} \\u00b7 ${formatContextWindow(contextWindow)} context`,\n );\n await this.resumePendingFirstRunOnboardingSeed();\n } catch (error) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.showStatus(`Model: ${model.id}`);\n },\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showModelsSelector = async function(this: InteractiveModeBase): Promise<void> {\n // Get all available models\n this.session.modelRegistry.refresh();\n const allModels = this.session.modelRegistry.getAvailable();\n\n if (allModels.length === 0) {\n this.showStatus(\"No models available\");\n return;\n }\n\n // Check if session has scoped models (from previous session-only changes or CLI --models)\n const sessionScopedModels = this.session.scopedModels;\n const hasSessionScope = sessionScopedModels.length > 0;\n\n // Build enabled model IDs from session state or settings\n let currentEnabledIds: string[] | null = null;\n\n if (hasSessionScope) {\n // Use current session's scoped models\n currentEnabledIds = sessionScopedModels.map(\n (scoped) => `${scoped.model.provider}/${scoped.model.id}`,\n );\n } else {\n // Fall back to settings\n const patterns = this.settingsManager.getEnabledModels();\n if (patterns !== undefined && patterns.length > 0) {\n const scopedModels = await resolveModelScope(\n patterns,\n this.session.modelRegistry,\n );\n currentEnabledIds = scopedModels.map(\n (scoped) => `${scoped.model.provider}/${scoped.model.id}`,\n );\n }\n }\n\n // Helper to update session's scoped models (session-only, no persist)\n const updateSessionModels = async (enabledIds: string[] | null) => {\n currentEnabledIds = enabledIds === null ? null : [...enabledIds];\n if (\n enabledIds &&\n enabledIds.length > 0 &&\n enabledIds.length < allModels.length\n ) {\n const newScopedModels = await resolveModelScope(\n enabledIds,\n this.session.modelRegistry,\n );\n this.session.setScopedModels(\n newScopedModels.map((sm) => ({\n model: sm.model,\n thinkingLevel: sm.thinkingLevel,\n })),\n );\n } else {\n // All enabled or none enabled = no filter\n this.session.setScopedModels([]);\n }\n await this.updateAvailableProviderCount();\n this.setupAutocompleteProvider();\n this.ui.requestRender();\n };\n\n this.showSelector((done) => {\n const selector = new ScopedModelsSelectorComponent(\n {\n allModels,\n enabledModelIds: currentEnabledIds,\n },\n {\n onChange: async (enabledIds) => {\n await updateSessionModels(enabledIds);\n },\n onPersist: (enabledIds) => {\n // Persist to settings\n const newPatterns =\n enabledIds === null || enabledIds.length === allModels.length\n ? undefined // All enabled = clear filter\n : enabledIds;\n this.settingsManager.setEnabledModels(\n newPatterns ? [...newPatterns] : undefined,\n );\n this.showStatus(\"Model selection saved to settings\");\n },\n onCancel: () => {\n done();\n this.ui.requestRender();\n },\n },\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showUserMessageSelector = function(this: InteractiveModeBase): void {\n const userMessages = this.session.getUserMessagesForForking();\n\n if (userMessages.length === 0) {\n this.showStatus(\"No messages to fork from\");\n return;\n }\n\n const initialSelectedId = userMessages[userMessages.length - 1]?.entryId;\n\n this.showSelector((done) => {\n const selector = new UserMessageSelectorComponent(\n userMessages.map((m) => ({ id: m.entryId, text: m.text })),\n async (entryId) => {\n try {\n const result = await this.runtimeHost.fork(entryId);\n if (result.cancelled) {\n done();\n this.ui.requestRender();\n return;\n }\n\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n done();\n this.showStatus(\"Forked to new session\");\n } catch (error: unknown) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n initialSelectedId,\n );\n return { component: selector, focus: selector.getMessageList() };\n });\n };\n"]}
1
+ {"version":3,"file":"interactive-model-routing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-model-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAwB,WAAW,EAAE,4BAA4B,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MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACpD,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;oBACrB,IAAI,EAAE,CAAC;oBACP,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;oBACxB,OAAO;gBACT,CAAC;gBAED,IAAI,CAAC,yBAAyB,EAAE,CAAC;gBACjC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;gBAC/C,IAAI,EAAE,CAAC;gBACP,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACxB,IAAI,EAAE,CAAC;gBACP,IAAI,CAAC,SAAS,CACZ,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;YACJ,CAAC;QACH,CAAC,EACD,GAAG,EAAE;YACH,IAAI,EAAE,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;QAC1B,CAAC,EACD,iBAAiB,CAClB,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,cAAc,EAAE,EAAE,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, getAgentDir, findExactModelReferenceMatch, resolveModelScope, ContextWindowSelectorComponent, formatContextWindow, copilotApiBaseUrlFromToken, copilotCatalogCacheHost, copilotCatalogCachePath, fetchCopilotModelCatalog, readCopilotCatalogCache, setActiveCopilotModelCatalog, writeCopilotCatalogCache, ModelSelectorComponent, ScopedModelsSelectorComponent, UserMessageSelectorComponent } from \"./interactive-mode-deps.ts\";\nimport { ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, isAnthropicSubscriptionAuthKey } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.handleModelCommand = async function(this: InteractiveModeBase, searchTerm?: string): Promise<void> {\n if (!searchTerm) {\n this.showModelSelector();\n return;\n }\n\n const model = await this.findExactModelMatch(searchTerm);\n if (model) {\n try {\n await this.session.setModel(model);\n this.footer.invalidate();\n this.updateEditorBorderColor();\n this.showStatus(`Model: ${model.id}`);\n void this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n this.checkDaxnutsEasterEgg(model);\n await this.resumePendingFirstRunOnboardingSeed();\n } catch (error) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n return;\n }\n\n this.showModelSelector(searchTerm);\n };\n\nInteractiveModeBase.prototype.findExactModelMatch = async function(this: InteractiveModeBase, searchTerm: string): Promise<Model<Api> | undefined> {\n const models = await this.getModelCandidates();\n return findExactModelReferenceMatch(searchTerm, models);\n };\n\nInteractiveModeBase.prototype.getModelCandidates = async function(this: InteractiveModeBase): Promise<Model<Api>[]> {\n if (this.session.scopedModels.length > 0) {\n return this.session.scopedModels.map((scoped) => scoped.model);\n }\n\n await this.refreshCopilotModelCatalog();\n this.session.modelRegistry.refresh();\n try {\n return await this.session.modelRegistry.getAvailable();\n } catch {\n return [];\n }\n };\n\nInteractiveModeBase.prototype.refreshCopilotModelCatalog = async function(this: InteractiveModeBase): Promise<void> {\n if (this.copilotCatalogApplied) return;\n if (!this.copilotCatalogInFlight) {\n this.copilotCatalogInFlight = this.loadCopilotModelCatalog();\n }\n try {\n await this.copilotCatalogInFlight;\n } finally {\n this.copilotCatalogInFlight = undefined;\n }\n };\n\nInteractiveModeBase.prototype.loadCopilotModelCatalog = async function(this: InteractiveModeBase): Promise<void> {\n const registry = this.session.modelRegistry;\n // Gate: do nothing unless the user has a Copilot token, including COPILOT_GITHUB_TOKEN env auth.\n try {\n const token = await registry.getApiKeyForProvider(\"github-copilot\");\n if (!token) return;\n const baseUrl = copilotApiBaseUrlFromToken(token);\n const cachePath = copilotCatalogCachePath(getAgentDir());\n let catalog = readCopilotCatalogCache(cachePath, { host: copilotCatalogCacheHost(baseUrl) });\n if (!catalog) {\n catalog = await fetchCopilotModelCatalog({ token, baseUrl });\n writeCopilotCatalogCache(cachePath, baseUrl, catalog);\n }\n setActiveCopilotModelCatalog(catalog);\n registry.refresh();\n this.session.refreshCurrentModelFromRegistry();\n this.copilotCatalogApplied = true;\n } catch {\n // Best-effort: leave the active catalog as-is on any failure (offline, auth, parse).\n }\n };\n\nInteractiveModeBase.prototype.updateAvailableProviderCount = async function(this: InteractiveModeBase): Promise<void> {\n const models = await this.getModelCandidates();\n const uniqueProviders = new Set(models.map((m) => m.provider));\n this.footerDataProvider.setAvailableProviderCount(uniqueProviders.size);\n };\n\nInteractiveModeBase.prototype.maybeWarnAboutAnthropicSubscriptionAuth = async function(this: InteractiveModeBase, model: Model<Api> | undefined = this.session.model): Promise<void> {\n if (this.settingsManager.getWarnings().anthropicExtraUsage === false) {\n return;\n }\n if (this.anthropicSubscriptionWarningShown) {\n return;\n }\n if (!model || model.provider !== \"anthropic\") {\n return;\n }\n\n const storedCredential =\n this.session.modelRegistry.authStorage.get(\"anthropic\");\n if (storedCredential?.type === \"oauth\") {\n this.anthropicSubscriptionWarningShown = true;\n this.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING);\n return;\n }\n\n try {\n const apiKey = await this.session.modelRegistry.getApiKeyForProvider(\n model.provider,\n );\n if (!isAnthropicSubscriptionAuthKey(apiKey)) {\n return;\n }\n this.anthropicSubscriptionWarningShown = true;\n this.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING);\n } catch {\n // Ignore auth lookup failures for warning-only checks.\n }\n };\n\nInteractiveModeBase.prototype.showModelSelector = function(this: InteractiveModeBase, initialSearchInput?: string): void {\n this.showSelector((done) => {\n const selector = new ModelSelectorComponent(\n this.ui,\n this.session.model,\n this.settingsManager,\n this.session.modelRegistry,\n this.session.scopedModels,\n async (model) => {\n try {\n await this.session.setModel(model);\n this.footer.invalidate();\n this.updateEditorBorderColor();\n done();\n void this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n this.checkDaxnutsEasterEgg(model);\n if (this.session.supportsContextWindowSelection()) {\n this.showContextWindowSelector(model);\n } else {\n this.showStatus(`Model: ${model.id}`);\n await this.resumePendingFirstRunOnboardingSeed();\n }\n } catch (error) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n initialSearchInput,\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showContextWindowSelector = function(this: InteractiveModeBase, model: Model<Api>): void {\n const availableContextWindows = this.session.getAvailableContextWindows();\n const currentContextWindow =\n this.session.model?.contextWindow ?? availableContextWindows[0] ?? 0;\n this.showSelector((done) => {\n const selector = new ContextWindowSelectorComponent(\n model.name ?? model.id,\n availableContextWindows,\n currentContextWindow,\n async (contextWindow) => {\n try {\n this.session.setContextWindow(contextWindow, {\n persistDefault: true,\n });\n this.footer.invalidate();\n this.usageMeter.invalidate();\n this.updateEditorBorderColor();\n done();\n this.showStatus(\n `Model: ${model.id} \\u00b7 ${formatContextWindow(contextWindow)} context`,\n );\n await this.resumePendingFirstRunOnboardingSeed();\n } catch (error) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.showStatus(`Model: ${model.id}`);\n },\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showModelsSelector = async function(this: InteractiveModeBase): Promise<void> {\n // Get all available models\n this.session.modelRegistry.refresh();\n const allModels = this.session.modelRegistry.getAvailable();\n\n if (allModels.length === 0) {\n this.showStatus(\"No models available\");\n return;\n }\n\n // Check if session has scoped models (from previous session-only changes or CLI --models)\n const sessionScopedModels = this.session.scopedModels;\n const hasSessionScope = sessionScopedModels.length > 0;\n\n // Build enabled model IDs from session state or settings\n let currentEnabledIds: string[] | null = null;\n\n if (hasSessionScope) {\n // Use current session's scoped models\n currentEnabledIds = sessionScopedModels.map(\n (scoped) => `${scoped.model.provider}/${scoped.model.id}`,\n );\n } else {\n // Fall back to settings\n const patterns = this.settingsManager.getEnabledModels();\n if (patterns !== undefined && patterns.length > 0) {\n const scopedModels = await resolveModelScope(\n patterns,\n this.session.modelRegistry,\n );\n currentEnabledIds = scopedModels.map(\n (scoped) => `${scoped.model.provider}/${scoped.model.id}`,\n );\n }\n }\n\n // Helper to update session's scoped models (session-only, no persist)\n const updateSessionModels = async (enabledIds: string[] | null) => {\n currentEnabledIds = enabledIds === null ? null : [...enabledIds];\n if (\n enabledIds &&\n enabledIds.length > 0 &&\n enabledIds.length < allModels.length\n ) {\n const newScopedModels = await resolveModelScope(\n enabledIds,\n this.session.modelRegistry,\n );\n this.session.setScopedModels(\n newScopedModels.map((sm) => ({\n model: sm.model,\n thinkingLevel: sm.thinkingLevel,\n })),\n );\n } else {\n // All enabled or none enabled = no filter\n this.session.setScopedModels([]);\n }\n await this.updateAvailableProviderCount();\n this.setupAutocompleteProvider();\n this.ui.requestRender();\n };\n\n this.showSelector((done) => {\n const selector = new ScopedModelsSelectorComponent(\n {\n allModels,\n enabledModelIds: currentEnabledIds,\n },\n {\n onChange: async (enabledIds) => {\n await updateSessionModels(enabledIds);\n },\n onPersist: (enabledIds) => {\n // Persist to settings\n const newPatterns =\n enabledIds === null || enabledIds.length === allModels.length\n ? undefined // All enabled = clear filter\n : enabledIds;\n this.settingsManager.setEnabledModels(\n newPatterns ? [...newPatterns] : undefined,\n );\n this.showStatus(\"Model selection saved to settings\");\n },\n onCancel: () => {\n done();\n this.ui.requestRender();\n },\n },\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showUserMessageSelector = function(this: InteractiveModeBase): void {\n const userMessages = this.session.getUserMessagesForForking();\n\n if (userMessages.length === 0) {\n this.showStatus(\"No messages to fork from\");\n return;\n }\n\n const initialSelectedId = userMessages[userMessages.length - 1]?.entryId;\n\n this.showSelector((done) => {\n const selector = new UserMessageSelectorComponent(\n userMessages.map((m) => ({ id: m.entryId, text: m.text })),\n async (entryId) => {\n try {\n const result = await this.runtimeHost.fork(entryId);\n if (result.cancelled) {\n done();\n this.ui.requestRender();\n return;\n }\n\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n done();\n this.showStatus(\"Forked to new session\");\n } catch (error: unknown) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n initialSelectedId,\n );\n return { component: selector, focus: selector.getMessageList() };\n });\n };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-render-chat.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentMessage, type Component, type ContextCompactionResult, type SessionContext, type TruncationResult, type ChatMessageEntry, type ChatMessageRenderOptions, Spacer, Text, parseSkillBlock, AssistantMessageComponent, BashExecutionComponent, BranchSummaryMessageComponent, chatEntriesFromAgentMessages, renderChatMessageEntry, addChatTranscriptEntry, ContextCompactionSummaryMessageComponent, CustomMessageComponent, SkillInvocationMessageComponent, ToolExecutionComponent, UserMessageComponent, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.showStatus = function(this: InteractiveModeBase, message: string): void {\n const children = this.chatContainer.children;\n const last =\n children.length > 0 ? children[children.length - 1] : undefined;\n const secondLast =\n children.length > 1 ? children[children.length - 2] : undefined;\n\n if (\n last &&\n secondLast &&\n last === this.lastStatusText &&\n secondLast === this.lastStatusSpacer\n ) {\n this.lastStatusText.setText(theme.fg(\"dim\", message));\n this.ui.requestRender();\n return;\n }\n\n const spacer = new Spacer(1);\n const text = new Text(theme.fg(\"dim\", message), 1, 0);\n this.chatContainer.addChild(spacer);\n this.chatContainer.addChild(text);\n this.lastStatusSpacer = spacer;\n this.lastStatusText = text;\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function(this: InteractiveModeBase): ChatMessageRenderOptions {\n return {\n ui: this.ui,\n cwd: this.sessionManager.getCwd(),\n markdownTheme: this.getMarkdownThemeWithSettings(),\n hideThinkingBlock: this.hideThinkingBlock,\n hiddenThinkingLabel: this.hiddenThinkingLabel,\n toolOutputExpanded: this.toolOutputExpanded,\n showImages: this.settingsManager.getShowImages(),\n imageWidthCells: this.settingsManager.getImageWidthCells(),\n getToolDefinition: (toolName) => this.getRegisteredToolDefinition(toolName),\n getCustomMessageRenderer: (customType) =>\n this.session.extensionRunner.getMessageRenderer(customType),\n };\n };\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function(this: InteractiveModeBase, entry: ChatMessageEntry): Component {\n const component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n addChatTranscriptEntry(this.chatContainer, component, entry.role);\n return component;\n };\n\nInteractiveModeBase.prototype.addContextCompactionSummaryToChat = function(this: InteractiveModeBase, result: ContextCompactionResult): void {\n this.chatContainer.addChild(new Spacer(1));\n const component = new ContextCompactionSummaryMessageComponent(\n result,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n };\n\nInteractiveModeBase.prototype.addMessageToChat = function(this: InteractiveModeBase, message: AgentMessage, options?: { populateHistory?: boolean }): void {\n switch (message.role) {\n case \"bashExecution\": {\n const component = new BashExecutionComponent(\n message.command,\n this.ui,\n message.excludeFromContext,\n );\n if (message.output) {\n component.appendOutput(message.output);\n }\n component.setComplete(\n message.exitCode,\n message.cancelled,\n message.truncated\n ? ({ truncated: true } as TruncationResult)\n : undefined,\n message.fullOutputPath,\n );\n this.chatContainer.addChild(component);\n break;\n }\n case \"custom\": {\n if (message.display) {\n const renderer = this.session.extensionRunner.getMessageRenderer(\n message.customType,\n );\n const component = new CustomMessageComponent(\n message,\n renderer,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n }\n break;\n }\n case \"branchSummary\": {\n this.chatContainer.addChild(new Spacer(1));\n const component = new BranchSummaryMessageComponent(\n message,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n break;\n }\n case \"user\": {\n const textContent = this.getUserMessageText(message);\n if (textContent) {\n if (this.chatContainer.children.length > 0) {\n this.chatContainer.addChild(new Spacer(1));\n }\n const skillBlock = parseSkillBlock(textContent);\n if (skillBlock) {\n // Render skill block (collapsible)\n const component = new SkillInvocationMessageComponent(\n skillBlock,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n // Render user message separately if present\n if (skillBlock.userMessage) {\n const userComponent = new UserMessageComponent(\n skillBlock.userMessage,\n this.getMarkdownThemeWithSettings(),\n );\n this.chatContainer.addChild(userComponent);\n }\n } else {\n const userComponent = new UserMessageComponent(\n textContent,\n this.getMarkdownThemeWithSettings(),\n );\n this.chatContainer.addChild(userComponent);\n }\n if (options?.populateHistory) {\n this.editor.addToHistory?.(textContent);\n }\n }\n break;\n }\n case \"assistant\": {\n const assistantComponent = new AssistantMessageComponent(\n message,\n this.hideThinkingBlock,\n this.getMarkdownThemeWithSettings(),\n this.hiddenThinkingLabel,\n );\n this.chatContainer.addChild(assistantComponent);\n break;\n }\n case \"toolResult\": {\n // Tool results are rendered inline with tool calls, handled separately\n break;\n }\n default:\n break;\n }\n };\n\nInteractiveModeBase.prototype.renderSessionContext = function(this: InteractiveModeBase, sessionContext: SessionContext, options: { updateFooter?: boolean; populateHistory?: boolean } = {}): void {\n this.pendingTools.clear();\n\n if (options.updateFooter) {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n }\n\n const entries = chatEntriesFromAgentMessages(sessionContext.messages);\n for (const entry of entries) {\n const component = this.addRenderedChatEntry(entry);\n if (\n entry.kind === \"tool\" &&\n entry.isPartial !== false &&\n component instanceof ToolExecutionComponent\n ) {\n this.pendingTools.set(entry.toolCallId, component);\n }\n if (options.populateHistory && entry.kind === \"user\") {\n this.editor.addToHistory?.(entry.text);\n }\n }\n\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.renderInitialMessages = function(this: InteractiveModeBase): void {\n // Get aligned messages and entries from session context\n const context = this.sessionManager.buildSessionContext();\n this.renderSessionContext(context, {\n updateFooter: true,\n populateHistory: true,\n });\n\n // Show compaction info if session was compacted\n const allEntries = this.sessionManager.getEntries();\n const compactionCount = allEntries.filter(\n (e) => e.type === \"compaction\",\n ).length;\n if (compactionCount > 0) {\n const times =\n compactionCount === 1 ? \"1 time\" : `${compactionCount} times`;\n this.showStatus(`Session compacted ${times}`);\n }\n };\n\nInteractiveModeBase.prototype.getUserInput = async function(this: InteractiveModeBase): Promise<string> {\n const queuedInput = this.pendingUserInputs.shift();\n if (queuedInput !== undefined) {\n return queuedInput;\n }\n\n return new Promise((resolve) => {\n this.onInputCallback = (text: string) => {\n this.onInputCallback = undefined;\n resolve(text);\n };\n });\n };\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n const context = this.sessionManager.buildSessionContext();\n this.renderSessionContext(context);\n };\n"]}
1
+ {"version":3,"file":"interactive-render-chat.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentMessage, type Component, type ContextCompactionResult, type SessionContext, type TruncationResult, type ChatMessageEntry, type ChatMessageRenderOptions, Spacer, Text, parseSkillBlock, AssistantMessageComponent, BashExecutionComponent, BranchSummaryMessageComponent, chatEntriesFromAgentMessages, renderChatMessageEntry, addChatTranscriptEntry, ContextCompactionSummaryMessageComponent, CustomMessageComponent, SkillInvocationMessageComponent, ToolExecutionComponent, UserMessageComponent, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.showStatus = function(this: InteractiveModeBase, message: string): void {\n const children = this.chatContainer.children;\n const last =\n children.length > 0 ? children[children.length - 1] : undefined;\n const secondLast =\n children.length > 1 ? children[children.length - 2] : undefined;\n\n if (\n last &&\n secondLast &&\n last === this.lastStatusText &&\n secondLast === this.lastStatusSpacer\n ) {\n this.lastStatusText.setText(theme.fg(\"dim\", message));\n this.ui.requestRender();\n return;\n }\n\n const spacer = new Spacer(1);\n const text = new Text(theme.fg(\"dim\", message), 1, 0);\n this.chatContainer.addChild(spacer);\n this.chatContainer.addChild(text);\n this.lastStatusSpacer = spacer;\n this.lastStatusText = text;\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function(this: InteractiveModeBase): ChatMessageRenderOptions {\n return {\n ui: this.ui,\n cwd: this.sessionManager.getCwd(),\n markdownTheme: this.getMarkdownThemeWithSettings(),\n hideThinkingBlock: this.hideThinkingBlock,\n hiddenThinkingLabel: this.hiddenThinkingLabel,\n toolOutputExpanded: this.toolOutputExpanded,\n showImages: this.settingsManager.getShowImages(),\n imageWidthCells: this.settingsManager.getImageWidthCells(),\n outputPad: this.outputPad,\n getToolDefinition: (toolName) => this.getRegisteredToolDefinition(toolName),\n getCustomMessageRenderer: (customType) =>\n this.session.extensionRunner.getMessageRenderer(customType),\n };\n };\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function(this: InteractiveModeBase, entry: ChatMessageEntry): Component {\n const component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n addChatTranscriptEntry(this.chatContainer, component, entry.role);\n return component;\n };\n\nInteractiveModeBase.prototype.addContextCompactionSummaryToChat = function(this: InteractiveModeBase, result: ContextCompactionResult): void {\n this.chatContainer.addChild(new Spacer(1));\n const component = new ContextCompactionSummaryMessageComponent(\n result,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n };\n\nInteractiveModeBase.prototype.addMessageToChat = function(this: InteractiveModeBase, message: AgentMessage, options?: { populateHistory?: boolean }): void {\n switch (message.role) {\n case \"bashExecution\": {\n const component = new BashExecutionComponent(\n message.command,\n this.ui,\n message.excludeFromContext,\n );\n if (message.output) {\n component.appendOutput(message.output);\n }\n component.setComplete(\n message.exitCode,\n message.cancelled,\n message.truncated\n ? ({ truncated: true } as TruncationResult)\n : undefined,\n message.fullOutputPath,\n );\n this.chatContainer.addChild(component);\n break;\n }\n case \"custom\": {\n if (message.display) {\n const renderer = this.session.extensionRunner.getMessageRenderer(\n message.customType,\n );\n const component = new CustomMessageComponent(\n message,\n renderer,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n }\n break;\n }\n case \"branchSummary\": {\n this.chatContainer.addChild(new Spacer(1));\n const component = new BranchSummaryMessageComponent(\n message,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n break;\n }\n case \"user\": {\n const textContent = this.getUserMessageText(message);\n if (textContent) {\n if (this.chatContainer.children.length > 0) {\n this.chatContainer.addChild(new Spacer(1));\n }\n const skillBlock = parseSkillBlock(textContent);\n if (skillBlock) {\n // Render skill block (collapsible)\n const component = new SkillInvocationMessageComponent(\n skillBlock,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n // Render user message separately if present\n if (skillBlock.userMessage) {\n const userComponent = new UserMessageComponent(\n skillBlock.userMessage,\n this.getMarkdownThemeWithSettings(),\n this.outputPad,\n );\n this.chatContainer.addChild(userComponent);\n }\n } else {\n const userComponent = new UserMessageComponent(\n textContent,\n this.getMarkdownThemeWithSettings(),\n this.outputPad,\n );\n this.chatContainer.addChild(userComponent);\n }\n if (options?.populateHistory) {\n this.editor.addToHistory?.(textContent);\n }\n }\n break;\n }\n case \"assistant\": {\n const assistantComponent = new AssistantMessageComponent(\n message,\n this.hideThinkingBlock,\n this.getMarkdownThemeWithSettings(),\n this.hiddenThinkingLabel,\n this.outputPad,\n );\n this.chatContainer.addChild(assistantComponent);\n break;\n }\n case \"toolResult\": {\n // Tool results are rendered inline with tool calls, handled separately\n break;\n }\n default:\n break;\n }\n };\n\nInteractiveModeBase.prototype.renderSessionContext = function(this: InteractiveModeBase, sessionContext: SessionContext, options: { updateFooter?: boolean; populateHistory?: boolean } = {}): void {\n this.pendingTools.clear();\n\n if (options.updateFooter) {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n }\n\n const entries = chatEntriesFromAgentMessages(sessionContext.messages);\n for (const entry of entries) {\n const component = this.addRenderedChatEntry(entry);\n if (\n entry.kind === \"tool\" &&\n entry.isPartial !== false &&\n component instanceof ToolExecutionComponent\n ) {\n this.pendingTools.set(entry.toolCallId, component);\n }\n if (options.populateHistory && entry.kind === \"user\") {\n this.editor.addToHistory?.(entry.text);\n }\n }\n\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.renderInitialMessages = function(this: InteractiveModeBase): void {\n // Get aligned messages and entries from session context\n const context = this.sessionManager.buildSessionContext();\n this.renderSessionContext(context, {\n updateFooter: true,\n populateHistory: true,\n });\n\n // Show compaction info if session was compacted\n const allEntries = this.sessionManager.getEntries();\n const compactionCount = allEntries.filter(\n (e) => e.type === \"compaction\",\n ).length;\n if (compactionCount > 0) {\n const times =\n compactionCount === 1 ? \"1 time\" : `${compactionCount} times`;\n this.showStatus(`Session compacted ${times}`);\n }\n };\n\nInteractiveModeBase.prototype.getUserInput = async function(this: InteractiveModeBase): Promise<string> {\n const queuedInput = this.pendingUserInputs.shift();\n if (queuedInput !== undefined) {\n return queuedInput;\n }\n\n return new Promise((resolve) => {\n this.onInputCallback = (text: string) => {\n this.onInputCallback = undefined;\n resolve(text);\n };\n });\n };\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n const context = this.sessionManager.buildSessionContext();\n this.renderSessionContext(context);\n };\n"]}
@@ -30,6 +30,7 @@ InteractiveModeBase.prototype.chatMessageRenderOptions = function () {
30
30
  toolOutputExpanded: this.toolOutputExpanded,
31
31
  showImages: this.settingsManager.getShowImages(),
32
32
  imageWidthCells: this.settingsManager.getImageWidthCells(),
33
+ outputPad: this.outputPad,
33
34
  getToolDefinition: (toolName) => this.getRegisteredToolDefinition(toolName),
34
35
  getCustomMessageRenderer: (customType) => this.session.extensionRunner.getMessageRenderer(customType),
35
36
  };
@@ -88,12 +89,12 @@ InteractiveModeBase.prototype.addMessageToChat = function (message, options) {
88
89
  this.chatContainer.addChild(component);
89
90
  // Render user message separately if present
90
91
  if (skillBlock.userMessage) {
91
- const userComponent = new UserMessageComponent(skillBlock.userMessage, this.getMarkdownThemeWithSettings());
92
+ const userComponent = new UserMessageComponent(skillBlock.userMessage, this.getMarkdownThemeWithSettings(), this.outputPad);
92
93
  this.chatContainer.addChild(userComponent);
93
94
  }
94
95
  }
95
96
  else {
96
- const userComponent = new UserMessageComponent(textContent, this.getMarkdownThemeWithSettings());
97
+ const userComponent = new UserMessageComponent(textContent, this.getMarkdownThemeWithSettings(), this.outputPad);
97
98
  this.chatContainer.addChild(userComponent);
98
99
  }
99
100
  if (options?.populateHistory) {
@@ -103,7 +104,7 @@ InteractiveModeBase.prototype.addMessageToChat = function (message, options) {
103
104
  break;
104
105
  }
105
106
  case "assistant": {
106
- const assistantComponent = new AssistantMessageComponent(message, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel);
107
+ const assistantComponent = new AssistantMessageComponent(message, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel, this.outputPad);
107
108
  this.chatContainer.addChild(assistantComponent);
108
109
  break;
109
110
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-render-chat.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAq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,qBAAqB,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,YAAY,GAAG,KAAK;IAC9C,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;IACnD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,CAAC,eAAe,GAAG,CAAC,IAAY,EAAE,EAAE;YACtC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,uBAAuB,GAAG;IACpD,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,mBAAmB,EAAE,CAAC;IAC1D,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentMessage, type Component, type ContextCompactionResult, type SessionContext, type TruncationResult, type ChatMessageEntry, type ChatMessageRenderOptions, Spacer, Text, parseSkillBlock, AssistantMessageComponent, BashExecutionComponent, BranchSummaryMessageComponent, chatEntriesFromAgentMessages, renderChatMessageEntry, addChatTranscriptEntry, ContextCompactionSummaryMessageComponent, CustomMessageComponent, SkillInvocationMessageComponent, ToolExecutionComponent, UserMessageComponent, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.showStatus = function(this: InteractiveModeBase, message: string): void {\n const children = this.chatContainer.children;\n const last =\n children.length > 0 ? children[children.length - 1] : undefined;\n const secondLast =\n children.length > 1 ? children[children.length - 2] : undefined;\n\n if (\n last &&\n secondLast &&\n last === this.lastStatusText &&\n secondLast === this.lastStatusSpacer\n ) {\n this.lastStatusText.setText(theme.fg(\"dim\", message));\n this.ui.requestRender();\n return;\n }\n\n const spacer = new Spacer(1);\n const text = new Text(theme.fg(\"dim\", message), 1, 0);\n this.chatContainer.addChild(spacer);\n this.chatContainer.addChild(text);\n this.lastStatusSpacer = spacer;\n this.lastStatusText = text;\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function(this: InteractiveModeBase): ChatMessageRenderOptions {\n return {\n ui: this.ui,\n cwd: this.sessionManager.getCwd(),\n markdownTheme: this.getMarkdownThemeWithSettings(),\n hideThinkingBlock: this.hideThinkingBlock,\n hiddenThinkingLabel: this.hiddenThinkingLabel,\n toolOutputExpanded: this.toolOutputExpanded,\n showImages: this.settingsManager.getShowImages(),\n imageWidthCells: this.settingsManager.getImageWidthCells(),\n getToolDefinition: (toolName) => this.getRegisteredToolDefinition(toolName),\n getCustomMessageRenderer: (customType) =>\n this.session.extensionRunner.getMessageRenderer(customType),\n };\n };\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function(this: InteractiveModeBase, entry: ChatMessageEntry): Component {\n const component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n addChatTranscriptEntry(this.chatContainer, component, entry.role);\n return component;\n };\n\nInteractiveModeBase.prototype.addContextCompactionSummaryToChat = function(this: InteractiveModeBase, result: ContextCompactionResult): void {\n this.chatContainer.addChild(new Spacer(1));\n const component = new ContextCompactionSummaryMessageComponent(\n result,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n };\n\nInteractiveModeBase.prototype.addMessageToChat = function(this: InteractiveModeBase, message: AgentMessage, options?: { populateHistory?: boolean }): void {\n switch (message.role) {\n case \"bashExecution\": {\n const component = new BashExecutionComponent(\n message.command,\n this.ui,\n message.excludeFromContext,\n );\n if (message.output) {\n component.appendOutput(message.output);\n }\n component.setComplete(\n message.exitCode,\n message.cancelled,\n message.truncated\n ? ({ truncated: true } as TruncationResult)\n : undefined,\n message.fullOutputPath,\n );\n this.chatContainer.addChild(component);\n break;\n }\n case \"custom\": {\n if (message.display) {\n const renderer = this.session.extensionRunner.getMessageRenderer(\n message.customType,\n );\n const component = new CustomMessageComponent(\n message,\n renderer,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n }\n break;\n }\n case \"branchSummary\": {\n this.chatContainer.addChild(new Spacer(1));\n const component = new BranchSummaryMessageComponent(\n message,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n break;\n }\n case \"user\": {\n const textContent = this.getUserMessageText(message);\n if (textContent) {\n if (this.chatContainer.children.length > 0) {\n this.chatContainer.addChild(new Spacer(1));\n }\n const skillBlock = parseSkillBlock(textContent);\n if (skillBlock) {\n // Render skill block (collapsible)\n const component = new SkillInvocationMessageComponent(\n skillBlock,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n // Render user message separately if present\n if (skillBlock.userMessage) {\n const userComponent = new UserMessageComponent(\n skillBlock.userMessage,\n this.getMarkdownThemeWithSettings(),\n );\n this.chatContainer.addChild(userComponent);\n }\n } else {\n const userComponent = new UserMessageComponent(\n textContent,\n this.getMarkdownThemeWithSettings(),\n );\n this.chatContainer.addChild(userComponent);\n }\n if (options?.populateHistory) {\n this.editor.addToHistory?.(textContent);\n }\n }\n break;\n }\n case \"assistant\": {\n const assistantComponent = new AssistantMessageComponent(\n message,\n this.hideThinkingBlock,\n this.getMarkdownThemeWithSettings(),\n this.hiddenThinkingLabel,\n );\n this.chatContainer.addChild(assistantComponent);\n break;\n }\n case \"toolResult\": {\n // Tool results are rendered inline with tool calls, handled separately\n break;\n }\n default:\n break;\n }\n };\n\nInteractiveModeBase.prototype.renderSessionContext = function(this: InteractiveModeBase, sessionContext: SessionContext, options: { updateFooter?: boolean; populateHistory?: boolean } = {}): void {\n this.pendingTools.clear();\n\n if (options.updateFooter) {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n }\n\n const entries = chatEntriesFromAgentMessages(sessionContext.messages);\n for (const entry of entries) {\n const component = this.addRenderedChatEntry(entry);\n if (\n entry.kind === \"tool\" &&\n entry.isPartial !== false &&\n component instanceof ToolExecutionComponent\n ) {\n this.pendingTools.set(entry.toolCallId, component);\n }\n if (options.populateHistory && entry.kind === \"user\") {\n this.editor.addToHistory?.(entry.text);\n }\n }\n\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.renderInitialMessages = function(this: InteractiveModeBase): void {\n // Get aligned messages and entries from session context\n const context = this.sessionManager.buildSessionContext();\n this.renderSessionContext(context, {\n updateFooter: true,\n populateHistory: true,\n });\n\n // Show compaction info if session was compacted\n const allEntries = this.sessionManager.getEntries();\n const compactionCount = allEntries.filter(\n (e) => e.type === \"compaction\",\n ).length;\n if (compactionCount > 0) {\n const times =\n compactionCount === 1 ? \"1 time\" : `${compactionCount} times`;\n this.showStatus(`Session compacted ${times}`);\n }\n };\n\nInteractiveModeBase.prototype.getUserInput = async function(this: InteractiveModeBase): Promise<string> {\n const queuedInput = this.pendingUserInputs.shift();\n if (queuedInput !== undefined) {\n return queuedInput;\n }\n\n return new Promise((resolve) => {\n this.onInputCallback = (text: string) => {\n this.onInputCallback = undefined;\n resolve(text);\n };\n });\n };\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n const context = this.sessionManager.buildSessionContext();\n this.renderSessionContext(context);\n };\n"]}
1
+ {"version":3,"file":"interactive-render-chat.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAqK,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,yB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AC,CAAC,GAAG,eAAe,QAAQ,CAAC;QAChE,IAAI,CAAC,UAAU,CAAC,qBAAqB,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,YAAY,GAAG,KAAK;IAC9C,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;IACnD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,CAAC,eAAe,GAAG,CAAC,IAAY,EAAE,EAAE;YACtC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,uBAAuB,GAAG;IACpD,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,mBAAmB,EAAE,CAAC;IAC1D,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentMessage, type Component, type ContextCompactionResult, type SessionContext, type TruncationResult, type ChatMessageEntry, type ChatMessageRenderOptions, Spacer, Text, parseSkillBlock, AssistantMessageComponent, BashExecutionComponent, BranchSummaryMessageComponent, chatEntriesFromAgentMessages, renderChatMessageEntry, addChatTranscriptEntry, ContextCompactionSummaryMessageComponent, CustomMessageComponent, SkillInvocationMessageComponent, ToolExecutionComponent, UserMessageComponent, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.showStatus = function(this: InteractiveModeBase, message: string): void {\n const children = this.chatContainer.children;\n const last =\n children.length > 0 ? children[children.length - 1] : undefined;\n const secondLast =\n children.length > 1 ? children[children.length - 2] : undefined;\n\n if (\n last &&\n secondLast &&\n last === this.lastStatusText &&\n secondLast === this.lastStatusSpacer\n ) {\n this.lastStatusText.setText(theme.fg(\"dim\", message));\n this.ui.requestRender();\n return;\n }\n\n const spacer = new Spacer(1);\n const text = new Text(theme.fg(\"dim\", message), 1, 0);\n this.chatContainer.addChild(spacer);\n this.chatContainer.addChild(text);\n this.lastStatusSpacer = spacer;\n this.lastStatusText = text;\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function(this: InteractiveModeBase): ChatMessageRenderOptions {\n return {\n ui: this.ui,\n cwd: this.sessionManager.getCwd(),\n markdownTheme: this.getMarkdownThemeWithSettings(),\n hideThinkingBlock: this.hideThinkingBlock,\n hiddenThinkingLabel: this.hiddenThinkingLabel,\n toolOutputExpanded: this.toolOutputExpanded,\n showImages: this.settingsManager.getShowImages(),\n imageWidthCells: this.settingsManager.getImageWidthCells(),\n outputPad: this.outputPad,\n getToolDefinition: (toolName) => this.getRegisteredToolDefinition(toolName),\n getCustomMessageRenderer: (customType) =>\n this.session.extensionRunner.getMessageRenderer(customType),\n };\n };\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function(this: InteractiveModeBase, entry: ChatMessageEntry): Component {\n const component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n addChatTranscriptEntry(this.chatContainer, component, entry.role);\n return component;\n };\n\nInteractiveModeBase.prototype.addContextCompactionSummaryToChat = function(this: InteractiveModeBase, result: ContextCompactionResult): void {\n this.chatContainer.addChild(new Spacer(1));\n const component = new ContextCompactionSummaryMessageComponent(\n result,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n };\n\nInteractiveModeBase.prototype.addMessageToChat = function(this: InteractiveModeBase, message: AgentMessage, options?: { populateHistory?: boolean }): void {\n switch (message.role) {\n case \"bashExecution\": {\n const component = new BashExecutionComponent(\n message.command,\n this.ui,\n message.excludeFromContext,\n );\n if (message.output) {\n component.appendOutput(message.output);\n }\n component.setComplete(\n message.exitCode,\n message.cancelled,\n message.truncated\n ? ({ truncated: true } as TruncationResult)\n : undefined,\n message.fullOutputPath,\n );\n this.chatContainer.addChild(component);\n break;\n }\n case \"custom\": {\n if (message.display) {\n const renderer = this.session.extensionRunner.getMessageRenderer(\n message.customType,\n );\n const component = new CustomMessageComponent(\n message,\n renderer,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n }\n break;\n }\n case \"branchSummary\": {\n this.chatContainer.addChild(new Spacer(1));\n const component = new BranchSummaryMessageComponent(\n message,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n break;\n }\n case \"user\": {\n const textContent = this.getUserMessageText(message);\n if (textContent) {\n if (this.chatContainer.children.length > 0) {\n this.chatContainer.addChild(new Spacer(1));\n }\n const skillBlock = parseSkillBlock(textContent);\n if (skillBlock) {\n // Render skill block (collapsible)\n const component = new SkillInvocationMessageComponent(\n skillBlock,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n // Render user message separately if present\n if (skillBlock.userMessage) {\n const userComponent = new UserMessageComponent(\n skillBlock.userMessage,\n this.getMarkdownThemeWithSettings(),\n this.outputPad,\n );\n this.chatContainer.addChild(userComponent);\n }\n } else {\n const userComponent = new UserMessageComponent(\n textContent,\n this.getMarkdownThemeWithSettings(),\n this.outputPad,\n );\n this.chatContainer.addChild(userComponent);\n }\n if (options?.populateHistory) {\n this.editor.addToHistory?.(textContent);\n }\n }\n break;\n }\n case \"assistant\": {\n const assistantComponent = new AssistantMessageComponent(\n message,\n this.hideThinkingBlock,\n this.getMarkdownThemeWithSettings(),\n this.hiddenThinkingLabel,\n this.outputPad,\n );\n this.chatContainer.addChild(assistantComponent);\n break;\n }\n case \"toolResult\": {\n // Tool results are rendered inline with tool calls, handled separately\n break;\n }\n default:\n break;\n }\n };\n\nInteractiveModeBase.prototype.renderSessionContext = function(this: InteractiveModeBase, sessionContext: SessionContext, options: { updateFooter?: boolean; populateHistory?: boolean } = {}): void {\n this.pendingTools.clear();\n\n if (options.updateFooter) {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n }\n\n const entries = chatEntriesFromAgentMessages(sessionContext.messages);\n for (const entry of entries) {\n const component = this.addRenderedChatEntry(entry);\n if (\n entry.kind === \"tool\" &&\n entry.isPartial !== false &&\n component instanceof ToolExecutionComponent\n ) {\n this.pendingTools.set(entry.toolCallId, component);\n }\n if (options.populateHistory && entry.kind === \"user\") {\n this.editor.addToHistory?.(entry.text);\n }\n }\n\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.renderInitialMessages = function(this: InteractiveModeBase): void {\n // Get aligned messages and entries from session context\n const context = this.sessionManager.buildSessionContext();\n this.renderSessionContext(context, {\n updateFooter: true,\n populateHistory: true,\n });\n\n // Show compaction info if session was compacted\n const allEntries = this.sessionManager.getEntries();\n const compactionCount = allEntries.filter(\n (e) => e.type === \"compaction\",\n ).length;\n if (compactionCount > 0) {\n const times =\n compactionCount === 1 ? \"1 time\" : `${compactionCount} times`;\n this.showStatus(`Session compacted ${times}`);\n }\n };\n\nInteractiveModeBase.prototype.getUserInput = async function(this: InteractiveModeBase): Promise<string> {\n const queuedInput = this.pendingUserInputs.shift();\n if (queuedInput !== undefined) {\n return queuedInput;\n }\n\n return new Promise((resolve) => {\n this.onInputCallback = (text: string) => {\n this.onInputCallback = undefined;\n resolve(text);\n };\n });\n };\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n const context = this.sessionManager.buildSessionContext();\n this.renderSessionContext(context);\n };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-session-runtime.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-runtime.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentSession, setRegisteredThemes, stopThemeWatcher } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.bindCurrentSessionExtensions = async function(this: InteractiveModeBase): Promise<void> {\n const uiContext = this.createExtensionUIContext();\n await this.session.bindExtensions({\n uiContext,\n mode: \"tui\",\n commandContextActions: {\n waitForIdle: () => this.session.agent.waitForIdle(),\n newSession: async (options) => {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.newSession(options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.ui.requestRender();\n }\n return result;\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to create session\",\n error,\n );\n }\n },\n fork: async (entryId, options) => {\n try {\n const result = await this.runtimeHost.fork(entryId, options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n this.showStatus(\"Forked to new session\");\n }\n return { cancelled: result.cancelled };\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to fork session\",\n error,\n );\n }\n },\n navigateTree: async (targetId, options) => {\n const result = await this.session.navigateTree(targetId, {\n summarize: options?.summarize,\n customInstructions: options?.customInstructions,\n replaceInstructions: options?.replaceInstructions,\n label: options?.label,\n });\n if (result.cancelled) {\n return { cancelled: true };\n }\n\n this.chatContainer.clear();\n this.renderInitialMessages();\n if (result.editorText && !this.editor.getText().trim()) {\n this.editor.setText(result.editorText);\n }\n this.showStatus(\"Navigated to selected point\");\n void this.flushCompactionQueue({ willRetry: false });\n return { cancelled: false };\n },\n switchSession: async (sessionPath, options) => {\n return this.handleResumeSession(sessionPath, options);\n },\n reload: async () => {\n await this.handleReloadCommand();\n },\n },\n shutdownHandler: () => {\n this.shutdownRequested = true;\n if (!this.session.isStreaming) {\n void this.shutdown();\n }\n },\n onError: (error) => {\n this.showExtensionError(error.extensionPath, error.error, error.stack);\n },\n });\n\n setRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n this.setupAutocompleteProvider();\n\n const extensionRunner = this.session.extensionRunner;\n this.setupExtensionShortcuts(extensionRunner);\n this.showLoadedResources({ force: false, showDiagnosticsWhenQuiet: true });\n this.showStartupNoticesIfNeeded();\n };\n\nInteractiveModeBase.prototype.applyRuntimeSettings = function(this: InteractiveModeBase): void {\n this.footer.setSession(this.session);\n this.usageMeter.setSession(this.session);\n this.usageMeter.setAutoCompactEnabled(this.session.autoCompactionEnabled);\n this.footerDataProvider.setCwd(this.sessionManager.getCwd());\n this.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();\n this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());\n this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());\n const editorPaddingX = this.settingsManager.getEditorPaddingX();\n const autocompleteMaxVisible =\n this.settingsManager.getAutocompleteMaxVisible();\n this.defaultEditor.setPaddingX(editorPaddingX);\n this.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);\n if (this.editor !== this.defaultEditor) {\n this.editor.setPaddingX?.(editorPaddingX);\n this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);\n }\n };\n\nInteractiveModeBase.prototype.rebindCurrentSession = async function(this: InteractiveModeBase): Promise<void> {\n this.unsubscribe?.();\n this.unsubscribe = undefined;\n this.applyRuntimeSettings();\n await this.bindCurrentSessionExtensions();\n this.subscribeToAgent();\n await this.updateAvailableProviderCount();\n this.updateEditorBorderColor();\n this.updateTerminalTitle();\n };\n\nInteractiveModeBase.prototype.handleFatalRuntimeError = async function(this: InteractiveModeBase, prefix: string, error: unknown): Promise<never> {\n const message = error instanceof Error ? error.message : String(error);\n this.showError(`${prefix}: ${message}`);\n stopThemeWatcher();\n this.stop();\n process.exit(1);\n };\n\nInteractiveModeBase.prototype.renderCurrentSessionState = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n this.pendingMessagesContainer.clear();\n this.compactionQueuedMessages = [];\n this.streamingComponent = undefined;\n this.streamingMessage = undefined;\n this.pendingTools.clear();\n this.renderInitialMessages();\n };\n\nInteractiveModeBase.prototype.getRegisteredToolDefinition = function(this: InteractiveModeBase, toolName: string): ReturnType<AgentSession[\"getToolDefinition\"]> {\n return this.session.getToolDefinition(toolName);\n };\n"]}
1
+ {"version":3,"file":"interactive-session-runtime.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-runtime.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentSession, setRegisteredThemes, stopThemeWatcher } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.bindCurrentSessionExtensions = async function(this: InteractiveModeBase): Promise<void> {\n const uiContext = this.createExtensionUIContext();\n await this.session.bindExtensions({\n uiContext,\n mode: \"tui\",\n commandContextActions: {\n waitForIdle: () => this.session.agent.waitForIdle(),\n newSession: async (options) => {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.newSession(options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.ui.requestRender();\n }\n return result;\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to create session\",\n error,\n );\n }\n },\n fork: async (entryId, options) => {\n try {\n const result = await this.runtimeHost.fork(entryId, options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n this.showStatus(\"Forked to new session\");\n }\n return { cancelled: result.cancelled };\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to fork session\",\n error,\n );\n }\n },\n navigateTree: async (targetId, options) => {\n const result = await this.session.navigateTree(targetId, {\n summarize: options?.summarize,\n customInstructions: options?.customInstructions,\n replaceInstructions: options?.replaceInstructions,\n label: options?.label,\n });\n if (result.cancelled) {\n return { cancelled: true };\n }\n\n this.chatContainer.clear();\n this.renderInitialMessages();\n if (result.editorText && !this.editor.getText().trim()) {\n this.editor.setText(result.editorText);\n }\n this.showStatus(\"Navigated to selected point\");\n void this.flushCompactionQueue({ willRetry: false });\n return { cancelled: false };\n },\n switchSession: async (sessionPath, options) => {\n return this.handleResumeSession(sessionPath, options);\n },\n reload: async () => {\n await this.handleReloadCommand();\n },\n },\n shutdownHandler: () => {\n this.shutdownRequested = true;\n if (!this.session.isStreaming) {\n void this.shutdown();\n }\n },\n onError: (error) => {\n this.showExtensionError(error.extensionPath, error.error, error.stack);\n },\n });\n\n setRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n this.setupAutocompleteProvider();\n\n const extensionRunner = this.session.extensionRunner;\n this.setupExtensionShortcuts(extensionRunner);\n this.showLoadedResources({ force: false, showDiagnosticsWhenQuiet: true });\n this.showStartupNoticesIfNeeded();\n };\n\nInteractiveModeBase.prototype.applyRuntimeSettings = function(this: InteractiveModeBase): void {\n this.footer.setSession(this.session);\n this.usageMeter.setSession(this.session);\n this.usageMeter.setAutoCompactEnabled(this.session.autoCompactionEnabled);\n this.footerDataProvider.setCwd(this.sessionManager.getCwd());\n this.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();\n this.outputPad = this.settingsManager.getOutputPad();\n this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());\n this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());\n const editorPaddingX = this.settingsManager.getEditorPaddingX();\n const autocompleteMaxVisible =\n this.settingsManager.getAutocompleteMaxVisible();\n this.defaultEditor.setPaddingX(editorPaddingX);\n this.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);\n if (this.editor !== this.defaultEditor) {\n this.editor.setPaddingX?.(editorPaddingX);\n this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);\n }\n };\n\nInteractiveModeBase.prototype.rebindCurrentSession = async function(this: InteractiveModeBase): Promise<void> {\n this.unsubscribe?.();\n this.unsubscribe = undefined;\n this.applyRuntimeSettings();\n await this.bindCurrentSessionExtensions();\n this.subscribeToAgent();\n await this.updateAvailableProviderCount();\n this.updateEditorBorderColor();\n this.updateTerminalTitle();\n };\n\nInteractiveModeBase.prototype.handleFatalRuntimeError = async function(this: InteractiveModeBase, prefix: string, error: unknown): Promise<never> {\n const message = error instanceof Error ? error.message : String(error);\n this.showError(`${prefix}: ${message}`);\n stopThemeWatcher();\n this.stop();\n process.exit(1);\n };\n\nInteractiveModeBase.prototype.renderCurrentSessionState = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n this.pendingMessagesContainer.clear();\n this.compactionQueuedMessages = [];\n this.streamingComponent = undefined;\n this.streamingMessage = undefined;\n this.pendingTools.clear();\n this.renderInitialMessages();\n };\n\nInteractiveModeBase.prototype.getRegisteredToolDefinition = function(this: InteractiveModeBase, toolName: string): ReturnType<AgentSession[\"getToolDefinition\"]> {\n return this.session.getToolDefinition(toolName);\n };\n"]}
@@ -88,6 +88,7 @@ InteractiveModeBase.prototype.applyRuntimeSettings = function () {
88
88
  this.usageMeter.setAutoCompactEnabled(this.session.autoCompactionEnabled);
89
89
  this.footerDataProvider.setCwd(this.sessionManager.getCwd());
90
90
  this.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();
91
+ this.outputPad = this.settingsManager.getOutputPad();
91
92
  this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());
92
93
  this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());
93
94
  const editorPaddingX = this.settingsManager.getEditorPaddingX();
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-session-runtime.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAqB,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEtG,mBAAmB,CAAC,SAAS,CAAC,4BAA4B,GAAG,KAAK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AAC;IAC1C,IAAI,CAAC,uBAAuB,EAAE,CAAC;IAC/B,IAAI,CAAC,mBAAmB,EAAE,CAAC;AAC7B,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,uBAAuB,GAAG,KAAK,WAAqC,MAAc,EAAE,KAAc;IAC5H,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,IAAI,CAAC,SAAS,CAAC,GAAG,MAAM,KAAK,OAAO,EAAE,CAAC,CAAC;IACxC,gBAAgB,EAAE,CAAC;IACnB,IAAI,CAAC,IAAI,EAAE,CAAC;IACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,yBAAyB,GAAG;IACtD,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC3B,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;IACtC,IAAI,CAAC,wBAAwB,GAAG,EAAE,CAAC;IACnC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACpC,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAClC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC1B,IAAI,CAAC,qBAAqB,EAAE,CAAC;AAC/B,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,2BAA2B,GAAG,UAAoC,QAAgB;IAC5G,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentSession, setRegisteredThemes, stopThemeWatcher } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.bindCurrentSessionExtensions = async function(this: InteractiveModeBase): Promise<void> {\n const uiContext = this.createExtensionUIContext();\n await this.session.bindExtensions({\n uiContext,\n mode: \"tui\",\n commandContextActions: {\n waitForIdle: () => this.session.agent.waitForIdle(),\n newSession: async (options) => {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.newSession(options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.ui.requestRender();\n }\n return result;\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to create session\",\n error,\n );\n }\n },\n fork: async (entryId, options) => {\n try {\n const result = await this.runtimeHost.fork(entryId, options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n this.showStatus(\"Forked to new session\");\n }\n return { cancelled: result.cancelled };\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to fork session\",\n error,\n );\n }\n },\n navigateTree: async (targetId, options) => {\n const result = await this.session.navigateTree(targetId, {\n summarize: options?.summarize,\n customInstructions: options?.customInstructions,\n replaceInstructions: options?.replaceInstructions,\n label: options?.label,\n });\n if (result.cancelled) {\n return { cancelled: true };\n }\n\n this.chatContainer.clear();\n this.renderInitialMessages();\n if (result.editorText && !this.editor.getText().trim()) {\n this.editor.setText(result.editorText);\n }\n this.showStatus(\"Navigated to selected point\");\n void this.flushCompactionQueue({ willRetry: false });\n return { cancelled: false };\n },\n switchSession: async (sessionPath, options) => {\n return this.handleResumeSession(sessionPath, options);\n },\n reload: async () => {\n await this.handleReloadCommand();\n },\n },\n shutdownHandler: () => {\n this.shutdownRequested = true;\n if (!this.session.isStreaming) {\n void this.shutdown();\n }\n },\n onError: (error) => {\n this.showExtensionError(error.extensionPath, error.error, error.stack);\n },\n });\n\n setRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n this.setupAutocompleteProvider();\n\n const extensionRunner = this.session.extensionRunner;\n this.setupExtensionShortcuts(extensionRunner);\n this.showLoadedResources({ force: false, showDiagnosticsWhenQuiet: true });\n this.showStartupNoticesIfNeeded();\n };\n\nInteractiveModeBase.prototype.applyRuntimeSettings = function(this: InteractiveModeBase): void {\n this.footer.setSession(this.session);\n this.usageMeter.setSession(this.session);\n this.usageMeter.setAutoCompactEnabled(this.session.autoCompactionEnabled);\n this.footerDataProvider.setCwd(this.sessionManager.getCwd());\n this.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();\n this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());\n this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());\n const editorPaddingX = this.settingsManager.getEditorPaddingX();\n const autocompleteMaxVisible =\n this.settingsManager.getAutocompleteMaxVisible();\n this.defaultEditor.setPaddingX(editorPaddingX);\n this.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);\n if (this.editor !== this.defaultEditor) {\n this.editor.setPaddingX?.(editorPaddingX);\n this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);\n }\n };\n\nInteractiveModeBase.prototype.rebindCurrentSession = async function(this: InteractiveModeBase): Promise<void> {\n this.unsubscribe?.();\n this.unsubscribe = undefined;\n this.applyRuntimeSettings();\n await this.bindCurrentSessionExtensions();\n this.subscribeToAgent();\n await this.updateAvailableProviderCount();\n this.updateEditorBorderColor();\n this.updateTerminalTitle();\n };\n\nInteractiveModeBase.prototype.handleFatalRuntimeError = async function(this: InteractiveModeBase, prefix: string, error: unknown): Promise<never> {\n const message = error instanceof Error ? error.message : String(error);\n this.showError(`${prefix}: ${message}`);\n stopThemeWatcher();\n this.stop();\n process.exit(1);\n };\n\nInteractiveModeBase.prototype.renderCurrentSessionState = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n this.pendingMessagesContainer.clear();\n this.compactionQueuedMessages = [];\n this.streamingComponent = undefined;\n this.streamingMessage = undefined;\n this.pendingTools.clear();\n this.renderInitialMessages();\n };\n\nInteractiveModeBase.prototype.getRegisteredToolDefinition = function(this: InteractiveModeBase, toolName: string): ReturnType<AgentSession[\"getToolDefinition\"]> {\n return this.session.getToolDefinition(toolName);\n };\n"]}
1
+ {"version":3,"file":"interactive-session-runtime.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAqB,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEtG,mBAAmB,CAAC,SAAS,CAAC,4BAA4B,GAAG,KAAK;IAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAClD,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAChC,SAAS;QACT,IAAI,EAAE,KAAK;QACX,qBAAqB,EAAE;YACrB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE;YACnD,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC5B,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBAC1B,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;oBAC7B,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;gBACpC,CAAC;gBACD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;gBAC7B,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;oBAC1D,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;wBACtB,IAAI,CAAC,yBAAyB,EAAE,CAAC;wBACjC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;oBAC1B,CAAC;oBACD,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAAC,OAAO,KAAc,EAAE,CAAC;oBACxB,OAAO,IAAI,CAAC,uBAAuB,CACjC,0BAA0B,EAC1B,KAAK,CACN,CAAC;gBACJ,CAAC;YACH,CA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AAI,CAAC,qBAAqB,EAAE,CAAC;AAC/B,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,2BAA2B,GAAG,UAAoC,QAAgB;IAC5G,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentSession, setRegisteredThemes, stopThemeWatcher } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.bindCurrentSessionExtensions = async function(this: InteractiveModeBase): Promise<void> {\n const uiContext = this.createExtensionUIContext();\n await this.session.bindExtensions({\n uiContext,\n mode: \"tui\",\n commandContextActions: {\n waitForIdle: () => this.session.agent.waitForIdle(),\n newSession: async (options) => {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.newSession(options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.ui.requestRender();\n }\n return result;\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to create session\",\n error,\n );\n }\n },\n fork: async (entryId, options) => {\n try {\n const result = await this.runtimeHost.fork(entryId, options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n this.showStatus(\"Forked to new session\");\n }\n return { cancelled: result.cancelled };\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to fork session\",\n error,\n );\n }\n },\n navigateTree: async (targetId, options) => {\n const result = await this.session.navigateTree(targetId, {\n summarize: options?.summarize,\n customInstructions: options?.customInstructions,\n replaceInstructions: options?.replaceInstructions,\n label: options?.label,\n });\n if (result.cancelled) {\n return { cancelled: true };\n }\n\n this.chatContainer.clear();\n this.renderInitialMessages();\n if (result.editorText && !this.editor.getText().trim()) {\n this.editor.setText(result.editorText);\n }\n this.showStatus(\"Navigated to selected point\");\n void this.flushCompactionQueue({ willRetry: false });\n return { cancelled: false };\n },\n switchSession: async (sessionPath, options) => {\n return this.handleResumeSession(sessionPath, options);\n },\n reload: async () => {\n await this.handleReloadCommand();\n },\n },\n shutdownHandler: () => {\n this.shutdownRequested = true;\n if (!this.session.isStreaming) {\n void this.shutdown();\n }\n },\n onError: (error) => {\n this.showExtensionError(error.extensionPath, error.error, error.stack);\n },\n });\n\n setRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n this.setupAutocompleteProvider();\n\n const extensionRunner = this.session.extensionRunner;\n this.setupExtensionShortcuts(extensionRunner);\n this.showLoadedResources({ force: false, showDiagnosticsWhenQuiet: true });\n this.showStartupNoticesIfNeeded();\n };\n\nInteractiveModeBase.prototype.applyRuntimeSettings = function(this: InteractiveModeBase): void {\n this.footer.setSession(this.session);\n this.usageMeter.setSession(this.session);\n this.usageMeter.setAutoCompactEnabled(this.session.autoCompactionEnabled);\n this.footerDataProvider.setCwd(this.sessionManager.getCwd());\n this.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();\n this.outputPad = this.settingsManager.getOutputPad();\n this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());\n this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());\n const editorPaddingX = this.settingsManager.getEditorPaddingX();\n const autocompleteMaxVisible =\n this.settingsManager.getAutocompleteMaxVisible();\n this.defaultEditor.setPaddingX(editorPaddingX);\n this.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);\n if (this.editor !== this.defaultEditor) {\n this.editor.setPaddingX?.(editorPaddingX);\n this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);\n }\n };\n\nInteractiveModeBase.prototype.rebindCurrentSession = async function(this: InteractiveModeBase): Promise<void> {\n this.unsubscribe?.();\n this.unsubscribe = undefined;\n this.applyRuntimeSettings();\n await this.bindCurrentSessionExtensions();\n this.subscribeToAgent();\n await this.updateAvailableProviderCount();\n this.updateEditorBorderColor();\n this.updateTerminalTitle();\n };\n\nInteractiveModeBase.prototype.handleFatalRuntimeError = async function(this: InteractiveModeBase, prefix: string, error: unknown): Promise<never> {\n const message = error instanceof Error ? error.message : String(error);\n this.showError(`${prefix}: ${message}`);\n stopThemeWatcher();\n this.stop();\n process.exit(1);\n };\n\nInteractiveModeBase.prototype.renderCurrentSessionState = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n this.pendingMessagesContainer.clear();\n this.compactionQueuedMessages = [];\n this.streamingComponent = undefined;\n this.streamingMessage = undefined;\n this.pendingTools.clear();\n this.renderInitialMessages();\n };\n\nInteractiveModeBase.prototype.getRegisteredToolDefinition = function(this: InteractiveModeBase, toolName: string): ReturnType<AgentSession[\"getToolDefinition\"]> {\n return this.session.getToolDefinition(toolName);\n };\n"]}
@@ -8,6 +8,7 @@ import type { ImageContent } from "@earendil-works/pi-ai/compat";
8
8
  import type { SessionStats } from "../../core/agent-session.ts";
9
9
  import type { BashResult } from "../../core/bash-executor.ts";
10
10
  import type { ContextCompactionResult } from "../../core/compaction/index.ts";
11
+ import type { SessionEntry, SessionTreeNode } from "../../core/session-manager.ts";
11
12
  import type { RpcContextWindowInfo, RpcEvent, RpcSessionState, RpcSlashCommand } from "./rpc-types.ts";
12
13
  export type { RpcContextWindowInfo, RpcEvent } from "./rpc-types.ts";
13
14
  export interface RpcClientOptions {
@@ -43,21 +44,13 @@ export declare class RpcClient {
43
44
  private exitError;
44
45
  private options;
45
46
  constructor(options?: RpcClientOptions);
46
- /**
47
- * Start the RPC agent process.
48
- */
47
+ /** Start the RPC agent process. */
49
48
  start(): Promise<void>;
50
- /**
51
- * Stop the RPC agent process.
52
- */
49
+ /** Stop the RPC agent process. */
53
50
  stop(): Promise<void>;
54
- /**
55
- * Subscribe to agent events.
56
- */
51
+ /** Subscribe to agent events. */
57
52
  onEvent(listener: RpcEventListener): () => void;
58
- /**
59
- * Get collected stderr output (useful for debugging).
60
- */
53
+ /** Get collected stderr output (useful for debugging). */
61
54
  getStderr(): string;
62
55
  /**
63
56
  * Send a prompt to the agent.
@@ -65,17 +58,11 @@ export declare class RpcClient {
65
58
  * Use waitForIdle() to wait for completion.
66
59
  */
67
60
  prompt(message: string, images?: ImageContent[]): Promise<void>;
68
- /**
69
- * Queue a steering message to interrupt the agent mid-run.
70
- */
61
+ /** Queue a steering message to interrupt the agent mid-run. */
71
62
  steer(message: string, images?: ImageContent[]): Promise<void>;
72
- /**
73
- * Queue a follow-up message to be processed after the agent finishes.
74
- */
63
+ /** Queue a follow-up message to be processed after the agent finishes. */
75
64
  followUp(message: string, images?: ImageContent[]): Promise<void>;
76
- /**
77
- * Abort current operation.
78
- */
65
+ /** Abort current operation. */
79
66
  abort(): Promise<void>;
80
67
  /**
81
68
  * Start a new session, optionally with parent tracking.
@@ -85,20 +72,14 @@ export declare class RpcClient {
85
72
  newSession(parentSession?: string): Promise<{
86
73
  cancelled: boolean;
87
74
  }>;
88
- /**
89
- * Get current session state.
90
- */
75
+ /** Get current session state. */
91
76
  getState(): Promise<RpcSessionState>;
92
- /**
93
- * Set model by provider and ID.
94
- */
77
+ /** Set model by provider and ID. */
95
78
  setModel(provider: string, modelId: string): Promise<{
96
79
  provider: string;
97
80
  id: string;
98
81
  }>;
99
- /**
100
- * Cycle to next model.
101
- */
82
+ /** Cycle to next model. */
102
83
  cycleModel(): Promise<{
103
84
  model: {
104
85
  provider: string;
@@ -107,17 +88,11 @@ export declare class RpcClient {
107
88
  thinkingLevel: ThinkingLevel;
108
89
  isScoped: boolean;
109
90
  } | null>;
110
- /**
111
- * Get list of available models.
112
- */
91
+ /** Get list of available models. */
113
92
  getAvailableModels(): Promise<ModelInfo[]>;
114
- /**
115
- * Set thinking level.
116
- */
93
+ /** Set thinking level. */
117
94
  setThinkingLevel(level: ThinkingLevel): Promise<void>;
118
- /**
119
- * Cycle thinking level.
120
- */
95
+ /** Cycle thinking level. */
121
96
  cycleThinkingLevel(): Promise<{
122
97
  level: ThinkingLevel;
123
98
  } | null>;
@@ -126,21 +101,13 @@ export declare class RpcClient {
126
101
  * This is a runtime selection and does not persist context-window defaults.
127
102
  */
128
103
  setContextWindow(contextWindow: number | string): Promise<void>;
129
- /**
130
- * Get selectable context-window token budgets for the current model.
131
- */
104
+ /** Get selectable context-window token budgets for the current model. */
132
105
  getAvailableContextWindows(): Promise<RpcContextWindowInfo>;
133
- /**
134
- * Set steering mode.
135
- */
106
+ /** Set steering mode. */
136
107
  setSteeringMode(mode: "all" | "one-at-a-time"): Promise<void>;
137
- /**
138
- * Set follow-up mode.
139
- */
108
+ /** Set follow-up mode. */
140
109
  setFollowUpMode(mode: "all" | "one-at-a-time"): Promise<void>;
141
- /**
142
- * Compact session context with deletion-only verbatim context compaction.
143
- */
110
+ /** Compact session context with deletion-only verbatim context compaction. */
144
111
  compact(): Promise<ContextCompactionResult>;
145
112
  /** @deprecated Use compact() instead. */
146
113
  contextCompact(): Promise<ContextCompactionResult>;
@@ -167,6 +134,16 @@ export declare class RpcClient {
167
134
  entryId: string;
168
135
  text: string;
169
136
  }>>;
137
+ /** Session entries in append order, optionally only those after the `since` entry id. */
138
+ getEntries(since?: string): Promise<{
139
+ entries: SessionEntry[];
140
+ leafId: string | null;
141
+ }>;
142
+ /** The session entry tree. */
143
+ getTree(): Promise<{
144
+ tree: SessionTreeNode[];
145
+ leafId: string | null;
146
+ }>;
170
147
  getLastAssistantText(): Promise<string | null>;
171
148
  setSessionName(name: string): Promise<void>;
172
149
  getMessages(): Promise<AgentMessage[]>;