@bastani/atomic 0.9.5-alpha.6 → 0.9.5-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -2
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +17 -0
- package/dist/builtin/intercom/README.md +27 -21
- package/dist/builtin/intercom/broker/broker.ts +3 -6
- package/dist/builtin/intercom/broker/paths.ts +42 -5
- package/dist/builtin/intercom/broker/spawn.ts +78 -10
- package/dist/builtin/intercom/config.ts +6 -3
- package/dist/builtin/intercom/contact-supervisor-tool.ts +6 -4
- package/dist/builtin/intercom/index-heavy.ts +1 -1
- package/dist/builtin/intercom/index.ts +162 -130
- package/dist/builtin/intercom/intercom-tool.ts +9 -3
- package/dist/builtin/intercom/package.json +10 -1
- package/dist/builtin/intercom/result-renderers.ts +1 -1
- package/dist/builtin/intercom/ui/compose.ts +2 -2
- package/dist/builtin/intercom/ui/inline-message.ts +2 -2
- package/dist/builtin/intercom/ui/session-list.ts +2 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/tui/render-event-formatting.ts +15 -48
- package/dist/builtin/subagents/src/tui/render-layout.ts +9 -0
- package/dist/builtin/subagents/src/tui/render-widget-graph.ts +27 -25
- package/dist/builtin/subagents/src/tui/render-widget.ts +46 -69
- package/dist/builtin/subagents/src/tui/render.ts +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +11 -0
- package/dist/builtin/workflows/README.md +3 -1
- package/dist/builtin/workflows/builtin/goal-artifacts.ts +3 -1
- package/dist/builtin/workflows/builtin/goal-prompts.ts +23 -2
- package/dist/builtin/workflows/builtin/goal-reducer.ts +21 -0
- package/dist/builtin/workflows/builtin/goal-review.ts +60 -6
- package/dist/builtin/workflows/builtin/goal-runner.ts +32 -21
- package/dist/builtin/workflows/builtin/goal-types.ts +7 -1
- package/dist/builtin/workflows/builtin/ralph-core.ts +52 -4
- package/dist/builtin/workflows/builtin/ralph-review-gate.ts +10 -3
- package/dist/builtin/workflows/builtin/ralph-reviewer-prompt.ts +23 -2
- package/dist/builtin/workflows/builtin/ralph-runner.ts +38 -16
- package/dist/builtin/workflows/builtin/review-convergence.ts +111 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/skills/create-spec/SKILL.md +2 -0
- package/dist/builtin/workflows/src/durable/child-primitive.ts +12 -8
- package/dist/builtin/workflows/src/durable/dbos-backend.ts +47 -2
- package/dist/builtin/workflows/src/durable/dbos-envelope.ts +28 -0
- package/dist/builtin/workflows/src/durable/stage-primitive.ts +165 -27
- package/dist/builtin/workflows/src/durable/types.ts +14 -1
- package/dist/builtin/workflows/src/engine/run.ts +12 -13
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +2 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-continuation.ts +13 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +18 -19
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-unresolved-overflow.ts +38 -0
- package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +18 -1
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +23 -5
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +4 -0
- package/dist/bun/internal-intercom-broker.d.ts +6 -0
- package/dist/bun/internal-intercom-broker.d.ts.map +1 -0
- package/dist/bun/internal-intercom-broker.js +39 -0
- package/dist/bun/internal-intercom-broker.js.map +1 -0
- package/dist/bun/split-loader.d.ts +2 -0
- package/dist/bun/split-loader.d.ts.map +1 -0
- package/dist/bun/split-loader.js +50 -0
- package/dist/bun/split-loader.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -4
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts +7 -7
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +62 -16
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +3 -1
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +1 -1
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +10 -4
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-models.d.ts +2 -2
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +1 -0
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts +2 -0
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +152 -4
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +15 -1
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +4 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +4 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/builtin-packages.d.ts.map +1 -1
- package/dist/core/builtin-packages.js +8 -4
- package/dist/core/builtin-packages.js.map +1 -1
- package/dist/core/compaction/context-compaction-runner.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction-runner.js +36 -20
- package/dist/core/compaction/context-compaction-runner.js.map +1 -1
- package/dist/core/copilot-anthropic-sse-repair.d.ts +23 -0
- package/dist/core/copilot-anthropic-sse-repair.d.ts.map +1 -0
- package/dist/core/copilot-anthropic-sse-repair.js +340 -0
- package/dist/core/copilot-anthropic-sse-repair.js.map +1 -0
- package/dist/core/copilot-gemini-reasoning.d.ts +16 -8
- package/dist/core/copilot-gemini-reasoning.d.ts.map +1 -1
- package/dist/core/copilot-gemini-reasoning.js +27 -22
- package/dist/core/copilot-gemini-reasoning.js.map +1 -1
- package/dist/core/copilot-hosts.d.ts +12 -0
- package/dist/core/copilot-hosts.d.ts.map +1 -0
- package/dist/core/copilot-hosts.js +33 -0
- package/dist/core/copilot-hosts.js.map +1 -0
- package/dist/core/copilot-model-catalog.d.ts.map +1 -1
- package/dist/core/copilot-model-catalog.js +3 -2
- package/dist/core/copilot-model-catalog.js.map +1 -1
- package/dist/core/extensions/agent-events.d.ts +1 -1
- package/dist/core/extensions/agent-events.d.ts.map +1 -1
- package/dist/core/extensions/agent-events.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +8 -3
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +5 -5
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/openai-responses-payload-sanitizer.d.ts +6 -0
- package/dist/core/openai-responses-payload-sanitizer.d.ts.map +1 -0
- package/dist/core/openai-responses-payload-sanitizer.js +59 -0
- package/dist/core/openai-responses-payload-sanitizer.js.map +1 -0
- package/dist/core/package-manager-auto-resources.d.ts +2 -2
- package/dist/core/package-manager-auto-resources.d.ts.map +1 -1
- package/dist/core/package-manager-auto-resources.js +32 -52
- package/dist/core/package-manager-auto-resources.js.map +1 -1
- package/dist/core/package-manager-resolver.d.ts.map +1 -1
- package/dist/core/package-manager-resolver.js +23 -14
- package/dist/core/package-manager-resolver.js.map +1 -1
- package/dist/core/package-manager-resource-collector.d.ts +3 -3
- package/dist/core/package-manager-resource-collector.d.ts.map +1 -1
- package/dist/core/package-manager-resource-collector.js +76 -73
- package/dist/core/package-manager-resource-collector.js.map +1 -1
- package/dist/core/package-manager-resource-files.d.ts +9 -8
- package/dist/core/package-manager-resource-files.d.ts.map +1 -1
- package/dist/core/package-manager-resource-files.js +92 -81
- package/dist/core/package-manager-resource-files.js.map +1 -1
- package/dist/core/prompt-templates-async.d.ts +3 -0
- package/dist/core/prompt-templates-async.d.ts.map +1 -0
- package/dist/core/prompt-templates-async.js +118 -0
- package/dist/core/prompt-templates-async.js.map +1 -0
- package/dist/core/provider-context-usage.d.ts +11 -0
- package/dist/core/provider-context-usage.d.ts.map +1 -0
- package/dist/core/provider-context-usage.js +58 -0
- package/dist/core/provider-context-usage.js.map +1 -0
- package/dist/core/resource-loader-assets.d.ts +3 -3
- package/dist/core/resource-loader-assets.d.ts.map +1 -1
- package/dist/core/resource-loader-assets.js +66 -83
- package/dist/core/resource-loader-assets.js.map +1 -1
- package/dist/core/resource-loader-core.d.ts +1 -1
- package/dist/core/resource-loader-core.d.ts.map +1 -1
- package/dist/core/resource-loader-core.js +5 -5
- package/dist/core/resource-loader-core.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +43 -7
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +7 -1
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/dist/core/sdk-types.d.ts +2 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +7 -4
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +1 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +6 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-types.d.ts +1 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/skills-async.d.ts +3 -0
- package/dist/core/skills-async.d.ts.map +1 -0
- package/dist/core/skills-async.js +269 -0
- package/dist/core/skills-async.js.map +1 -0
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/main-deferred-startup.d.ts +14 -0
- package/dist/main-deferred-startup.d.ts.map +1 -1
- package/dist/main-deferred-startup.js +23 -0
- package/dist/main-deferred-startup.js.map +1 -1
- package/dist/main-early-input.d.ts +41 -0
- package/dist/main-early-input.d.ts.map +1 -0
- package/dist/main-early-input.js +147 -0
- package/dist/main-early-input.js.map +1 -0
- package/dist/main.d.ts +0 -6
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +23 -17
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +15 -0
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +34 -1
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts +6 -0
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +27 -13
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.js +13 -13
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +16 -0
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +324 -178
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +14 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +41 -0
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +22 -6
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +3 -3
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-onboarding.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-onboarding.js +1 -0
- package/dist/modes/interactive/interactive-onboarding.js.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js +43 -6
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +78 -9
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.js +3 -2
- package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.js +10 -8
- package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +65 -53
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.d.ts +1 -0
- package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.js +3 -0
- package/dist/modes/interactive/theme/theme-loading.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -1
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/utils/module-require.d.ts +11 -0
- package/dist/utils/module-require.d.ts.map +1 -1
- package/dist/utils/module-require.js +14 -1
- package/dist/utils/module-require.js.map +1 -1
- package/dist/utils/split-launcher.d.ts +38 -0
- package/dist/utils/split-launcher.d.ts.map +1 -0
- package/dist/utils/split-launcher.js +63 -0
- package/dist/utils/split-launcher.js.map +1 -0
- package/docs/compaction.md +7 -0
- package/docs/json.md +3 -1
- package/docs/keybindings.md +2 -2
- package/docs/providers.md +2 -1
- package/docs/rpc.md +3 -1
- package/docs/settings.md +28 -2
- package/docs/terminal-setup.md +4 -0
- package/docs/usage.md +3 -3
- package/docs/workflows.md +13 -3
- package/npm-shrinkwrap.json +513 -23
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-deferred-startup.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-deferred-startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,gCAA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gB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;AACH,CAAC;AAEH;;;;GAIG;AACH,mBAAmB,CAAC,SAAS,CAAC,yBAAyB,GAAG,KAAK;IAC3D,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;IAC1D,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IACD,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,mBAAmB,EAAE,CAAC,KAAK,CAAC;IACnE,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,aAAa,GAAG,MAAM,0BAA0B,CACpD,UAAU,CAAC,QAAQ,EACnB,UAAU,CAAC,OAAO,EAClB,IAAI,CAAC,OAAO,CAAC,aAAa,CAC3B,CAAC;QACF,IAAI,aAAa,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,aAAa,CAAC,EAAE,CAAC;YACjF,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;YAC3C,OAAO;QACT,CAAC;IACH,CAAC;IACD,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;AACpC,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { modelsAreEqual } from \"@earendil-works/pi-ai/compat\";\nimport { recordTimeSinceReset, resolveModelScopeWithDiagnostics, resolveSavedModelReference, setRegisteredThemes, Text, theme } from \"./interactive-mode-deps.ts\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\n\n/**\n * Finishes a startup where extension loading was deferred so the TUI could\n * paint immediately. Loads extension code via session.reload(), then applies\n * the same post-load UI wiring as /reload and discloses loaded resources.\n */\nInteractiveModeBase.prototype.completeDeferredStartup = async function(this: InteractiveModeBase): Promise<void> {\n const loadingIndicator = new Text(theme.fg(\"dim\", \"Loading extensions, skills, prompts, themes...\"), 1, 0);\n this.chatContainer.addChild(loadingIndicator);\n this.ui.requestRender();\n await yieldToEventLoop();\n\n try {\n await this.session.reload({ reason: \"startup\" });\n } catch (error) {\n this.chatContainer.removeChild(loadingIndicator);\n this.deferredStartupPending = false;\n this.showError(\n `Extension loading failed: ${error instanceof Error ? error.message : String(error)}`,\n );\n return;\n }\n\n this.chatContainer.removeChild(loadingIndicator);\n this.deferredStartupPending = false;\n recordTimeSinceReset(\"deferred-extension-load\");\n\n setRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n await this.themeController.applyFromSettings();\n this.setupAutocompleteProvider();\n this.setupExtensionShortcuts(this.session.extensionRunner);\n await applyDeferredModelScope(this);\n await this.retryDeferredModelRestore();\n this.showLoadedResources({ force: false, showDiagnosticsWhenQuiet: true });\n this.showStartupNoticesIfNeeded();\n\n const modelsJsonError = this.session.modelRegistry.getError();\n if (modelsJsonError) {\n this.showError(`models.json error: ${modelsJsonError}`);\n }\n void this.updateAvailableProviderCount().catch(() => {});\n this.updateEditorBorderColor();\n this.ui.requestRender();\n };\n\nexport async function applyDeferredModelScope(mode: InteractiveModeBase): Promise<void> {\n const patterns = mode.options.deferredModelScopePatterns;\n if (!patterns || patterns.length === 0) {\n return;\n }\n\n const { scopedModels, diagnostics } = await resolveModelScopeWithDiagnostics(patterns, mode.session.modelRegistry);\n for (const diagnostic of diagnostics) {\n mode.showWarning(diagnostic.message);\n }\n mode.session.setScopedModels(scopedModels);\n\n if (mode.sessionManager.buildSessionContext().messages.length > 0 || scopedModels.length === 0) {\n return;\n }\n\n const currentModel = mode.session.model;\n if (currentModel && scopedModels.some((scoped) => modelsAreEqual(scoped.model, currentModel))) {\n return;\n }\n\n const savedProvider = mode.settingsManager.getDefaultProvider();\n const savedModelId = mode.settingsManager.getDefaultModel();\n const savedModel = savedProvider && savedModelId ? mode.session.modelRegistry.find(savedProvider, savedModelId) : undefined;\n const preferred = savedModel ? scopedModels.find((scoped) => modelsAreEqual(scoped.model, savedModel)) : undefined;\n const nextScopedModel = preferred ?? scopedModels[0];\n if (mode.session.modelRegistry.hasConfiguredAuth(nextScopedModel.model)) {\n await mode.session.setModel(nextScopedModel.model);\n if (nextScopedModel.thinkingLevel && !mode.options.deferredModelScopePreserveThinking) {\n mode.session.setThinkingLevel(nextScopedModel.thinkingLevel);\n }\n }\n }\n\n/**\n * A session model saved with an extension-registered provider cannot resolve\n * until extensions load; retry the restore now and only surface the fallback\n * warning if it still fails.\n */\nInteractiveModeBase.prototype.retryDeferredModelRestore = async function(this: InteractiveModeBase): Promise<void> {\n const fallbackMessage = this.options.modelFallbackMessage;\n if (!fallbackMessage) {\n return;\n }\n const savedModel = this.sessionManager.buildSessionContext().model;\n if (savedModel) {\n const restoredModel = await resolveSavedModelReference(\n savedModel.provider,\n savedModel.modelId,\n this.session.modelRegistry,\n );\n if (restoredModel && this.session.modelRegistry.hasConfiguredAuth(restoredModel)) {\n await this.session.setModel(restoredModel);\n return;\n }\n }\n this.showWarning(fallbackMessage);\n };\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-deferred-startup.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-deferred-startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAkB,oBAAoB,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAQrK,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAAC,IAAyB;IACzE,IAAI,CAAC,IAAI,CAAC,sBAAsB,IAAI,CAAC,IAAI,CAAC,sBAAsB;QAAE,OAAO;IACzE,IAAI,CAAC,sBAAsB,KAAK,IAAI,CAAC,uBAAuB,EAAE,CAAC;IAC/D,MAAM,IAAI,CAAC,sBAAsB,CAAC;AACpC,CAAC;AAEH,mBAAmB,CAAC,SAAS,CAAC,6BAA6B,GAAG,KAAK;IAC/D,MAAM,6BAA6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EAAE,CAAC;YACtF,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;AACH,CAAC;AAEH;;;;GAIG;AACH,mBAAmB,CAAC,SAAS,CAAC,yBAAyB,GAAG,KAAK,WAAqC,eAA2B;IAC3H,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;IAC1D,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IACD,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,mBAAmB,EAAE,CAAC,KAAK,CAAC;IACnE,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,aAAa,GAAG,MAAM,0BAA0B,CACpD,UAAU,CAAC,QAAQ,EACnB,UAAU,CAAC,OAAO,EAClB,IAAI,CAAC,OAAO,CAAC,aAAa,CAC3B,CAAC;QACF,IAAI,aAAa,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,aAAa,CAAC,EAAE,CAAC;YACjF,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;YAC3C,OAAO;QACT,CAAC;IACH,CAAC;IACD,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;AACrD,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { modelsAreEqual } from \"@earendil-works/pi-ai/compat\";\nimport { type Container, recordTimeSinceReset, resolveModelScopeWithDiagnostics, resolveSavedModelReference, setRegisteredThemes } from \"./interactive-mode-deps.ts\";\n\nexport interface DeferredStartupMode {\n deferredStartupPending: boolean;\n deferredStartupPromise: Promise<void> | undefined;\n completeDeferredStartup(): Promise<void>;\n }\n\nexport async function ensureDeferredStartupComplete(mode: DeferredStartupMode): Promise<void> {\n if (!mode.deferredStartupPending && !mode.deferredStartupPromise) return;\n mode.deferredStartupPromise ??= mode.completeDeferredStartup();\n await mode.deferredStartupPromise;\n }\n\nInteractiveModeBase.prototype.ensureDeferredStartupComplete = async function(this: InteractiveModeBase): Promise<void> {\n await ensureDeferredStartupComplete(this);\n };\n\n/**\n * Finishes a startup where extension loading was deferred so the TUI could\n * paint immediately. Loads extension code via session.reload(), then applies\n * the same post-load UI wiring as /reload and discloses loaded resources.\n */\nInteractiveModeBase.prototype.completeDeferredStartup = async function(this: InteractiveModeBase): Promise<void> {\n\ttry {\n\t\tawait this.bindCurrentSessionExtensions();\n\t\tawait this.session.reload({ reason: \"startup\" });\n\t} catch (error) {\n\t\tthis.stopWorkingLoader();\n this.deferredStartupPending = false;\n this.showError(\n `Extension loading failed: ${error instanceof Error ? error.message : String(error)}`,\n );\n // The RESOURCES disclosure will not render; surface the held warning.\n void this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, this.startupNoticesContainer);\n return;\n }\n\n\tthis.stopWorkingLoader();\n\tthis.deferredStartupPending = false;\n recordTimeSinceReset(\"deferred-extension-load\");\n\n setRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n await this.themeController.applyFromSettings();\n this.setupAutocompleteProvider();\n this.setupExtensionShortcuts(this.session.extensionRunner);\n await applyDeferredModelScope(this);\n await this.retryDeferredModelRestore(this.startupNoticesContainer);\n\tif (this.deferLoadedResourcesDisclosureUntilAgentEnd) {\n\t\tthis.pendingLoadedResourcesDisclosure = true;\n\t} else {\n\t\tthis.showLoadedResources({ force: true, showDiagnosticsWhenQuiet: true, targetContainer: this.startupNoticesContainer });\n\t\t// Keep the subscription warning after the RESOURCES disclosure.\n\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, this.startupNoticesContainer);\n\t}\n\tthis.showStartupNoticesIfNeeded(this.startupNoticesContainer);\n const modelsJsonError = this.session.modelRegistry.getError();\n if (modelsJsonError) {\n this.showError(`models.json error: ${modelsJsonError}`);\n }\n void this.updateAvailableProviderCount().catch(() => {});\n this.updateEditorBorderColor();\n this.ui.requestRender();\n };\n\nexport async function applyDeferredModelScope(mode: InteractiveModeBase): Promise<void> {\n const patterns = mode.options.deferredModelScopePatterns;\n if (!patterns || patterns.length === 0) {\n return;\n }\n\n const { scopedModels, diagnostics } = await resolveModelScopeWithDiagnostics(patterns, mode.session.modelRegistry);\n for (const diagnostic of diagnostics) {\n mode.showWarning(diagnostic.message);\n }\n mode.session.setScopedModels(scopedModels);\n\n if (mode.sessionManager.buildSessionContext().messages.length > 0 || scopedModels.length === 0) {\n return;\n }\n\n const currentModel = mode.session.model;\n if (currentModel && scopedModels.some((scoped) => modelsAreEqual(scoped.model, currentModel))) {\n return;\n }\n\n const savedProvider = mode.settingsManager.getDefaultProvider();\n const savedModelId = mode.settingsManager.getDefaultModel();\n const savedModel = savedProvider && savedModelId ? mode.session.modelRegistry.find(savedProvider, savedModelId) : undefined;\n const preferred = savedModel ? scopedModels.find((scoped) => modelsAreEqual(scoped.model, savedModel)) : undefined;\n const nextScopedModel = preferred ?? scopedModels[0];\n if (mode.session.modelRegistry.hasConfiguredAuth(nextScopedModel.model)) {\n await mode.session.setModel(nextScopedModel.model);\n if (nextScopedModel.thinkingLevel && !mode.options.deferredModelScopePreserveThinking) {\n mode.session.setThinkingLevel(nextScopedModel.thinkingLevel);\n }\n }\n }\n\n/**\n * A session model saved with an extension-registered provider cannot resolve\n * until extensions load; retry the restore now and only surface the fallback\n * warning if it still fails.\n */\nInteractiveModeBase.prototype.retryDeferredModelRestore = async function(this: InteractiveModeBase, targetContainer?: Container): Promise<void> {\n const fallbackMessage = this.options.modelFallbackMessage;\n if (!fallbackMessage) {\n return;\n }\n const savedModel = this.sessionManager.buildSessionContext().model;\n if (savedModel) {\n const restoredModel = await resolveSavedModelReference(\n savedModel.provider,\n savedModel.modelId,\n this.session.modelRegistry,\n );\n if (restoredModel && this.session.modelRegistry.hasConfiguredAuth(restoredModel)) {\n await this.session.setModel(restoredModel);\n return;\n }\n }\n this.showWarning(fallbackMessage, targetContainer);\n };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-editor-actions.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-editor-actions.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { getCapabilities, hyperlink, Spacer, Text, APP_NAME, CHANGELOG_URL, openExternalEditorForText, DynamicBorder, theme } from \"./interactive-mode-deps.ts\";\nimport { ExpandableText, isExpandable } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.refreshBuiltInHeader = function(this: InteractiveModeBase): void {\n if (this.builtInHeader instanceof ExpandableText) {\n this.builtInHeader.refresh();\n }\n };\n\nInteractiveModeBase.prototype.updateEditorBorderColor = function(this: InteractiveModeBase): void {\n if (this.isBashMode) {\n this.editor.borderColor = theme.getBashModeBorderColor();\n } else {\n const level = this.session.thinkingLevel || \"off\";\n this.editor.borderColor = theme.getThinkingBorderColor(level);\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.cycleThinkingLevel = function(this: InteractiveModeBase): void {\n const newLevel = this.session.cycleThinkingLevel();\n if (newLevel === undefined) {\n this.showStatus(\"Current model does not support thinking\");\n } else {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n this.showStatus(`Thinking level: ${newLevel}`);\n }\n };\n\nInteractiveModeBase.prototype.cycleModel = async function(this: InteractiveModeBase, direction: \"forward\" | \"backward\"): Promise<void> {\n try {\n const result = await this.session.cycleModel(direction);\n if (result === undefined) {\n const msg =\n this.session.scopedModels.length > 0\n ? \"Only one model in scope\"\n : \"Only one model available\";\n this.showStatus(msg);\n } else {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n const thinkingStr =\n result.model.reasoning && result.thinkingLevel !== \"off\"\n ? ` (thinking: ${result.thinkingLevel})`\n : \"\";\n this.showStatus(\n `Switched to ${result.model.name || result.model.id}${thinkingStr}`,\n );\n void this.maybeWarnAboutAnthropicSubscriptionAuth(result.model);\n }\n } catch (error) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n };\n\nInteractiveModeBase.prototype.toggleToolOutputExpansion = function(this: InteractiveModeBase): void {\n this.setToolsExpanded(!this.toolOutputExpanded);\n };\n\nInteractiveModeBase.prototype.setToolsExpanded = function(this: InteractiveModeBase, expanded: boolean): void {\n this.toolOutputExpanded = expanded;\n const activeHeader = this.customHeader ?? this.builtInHeader;\n if (isExpandable(activeHeader)) {\n activeHeader.setExpanded(expanded);\n }\n for (const child of this.chatContainer.children) {\n if (isExpandable(child)) {\n child.setExpanded(expanded);\n }\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.toggleThinkingBlockVisibility = function(this: InteractiveModeBase): void {\n this.hideThinkingBlock = !this.hideThinkingBlock;\n this.settingsManager.setHideThinkingBlock(this.hideThinkingBlock);\n\n // Rebuild chat from session messages\n this.chatContainer.clear();\n this.rebuildChatFromMessages();\n\n // If streaming, re-add the streaming component with updated visibility and re-render\n if (this.streamingComponent && this.streamingMessage) {\n this.streamingComponent.setHideThinkingBlock(this.hideThinkingBlock);\n this.streamingComponent.updateContent(this.streamingMessage);\n this.chatContainer.addChild(this.streamingComponent);\n }\n\n this.showStatus(\n `Thinking blocks: ${this.hideThinkingBlock ? \"hidden\" : \"visible\"}`,\n );\n };\n\nInteractiveModeBase.prototype.openExternalEditor = function(this: InteractiveModeBase): void {\n const currentText = this.editor.getExpandedText?.() ?? this.editor.getText();\n const updated = openExternalEditorForText(currentText, this.ui, {\n editorCommand: this.settingsManager.getExternalEditorCommand(),\n showWarning: (message) => this.showWarning(message),\n });\n if (updated !== undefined) this.editor.setText(updated);\n };\n\nInteractiveModeBase.prototype.clearEditor = function(this: InteractiveModeBase): void {\n this.editor.setText(\"\");\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showError = function(this: InteractiveModeBase, errorMessage: string): void {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Text(theme.fg(\"error\", `Error: ${errorMessage}`), 1, 0),\n );\n this.chatContainer.addChild(new Spacer(1));\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showWarning = function(this: InteractiveModeBase, warningMessage: string): void {\n
|
|
1
|
+
{"version":3,"file":"interactive-editor-actions.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-editor-actions.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { getCapabilities, hyperlink, Spacer, Text, APP_NAME, CHANGELOG_URL, openExternalEditorForText, DynamicBorder, theme } from \"./interactive-mode-deps.ts\";\nimport { ExpandableText, isExpandable } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.refreshBuiltInHeader = function(this: InteractiveModeBase): void {\n if (this.builtInHeader instanceof ExpandableText) {\n this.builtInHeader.refresh();\n }\n };\n\nInteractiveModeBase.prototype.updateEditorBorderColor = function(this: InteractiveModeBase): void {\n if (this.isBashMode) {\n this.editor.borderColor = theme.getBashModeBorderColor();\n } else {\n const level = this.session.thinkingLevel || \"off\";\n this.editor.borderColor = theme.getThinkingBorderColor(level);\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.cycleThinkingLevel = function(this: InteractiveModeBase): void {\n const newLevel = this.session.cycleThinkingLevel();\n if (newLevel === undefined) {\n this.showStatus(\"Current model does not support thinking\");\n } else {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n this.showStatus(`Thinking level: ${newLevel}`);\n }\n };\n\nInteractiveModeBase.prototype.cycleModel = async function(this: InteractiveModeBase, direction: \"forward\" | \"backward\"): Promise<void> {\n try {\n const result = await this.session.cycleModel(direction);\n if (result === undefined) {\n const msg =\n this.session.scopedModels.length > 0\n ? \"Only one model in scope\"\n : \"Only one model available\";\n this.showStatus(msg);\n } else {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n const thinkingStr =\n result.model.reasoning && result.thinkingLevel !== \"off\"\n ? ` (thinking: ${result.thinkingLevel})`\n : \"\";\n this.showStatus(\n `Switched to ${result.model.name || result.model.id}${thinkingStr}`,\n );\n void this.maybeWarnAboutAnthropicSubscriptionAuth(result.model);\n }\n } catch (error) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n };\n\nInteractiveModeBase.prototype.toggleToolOutputExpansion = function(this: InteractiveModeBase): void {\n this.setToolsExpanded(!this.toolOutputExpanded);\n };\n\nInteractiveModeBase.prototype.setToolsExpanded = function(this: InteractiveModeBase, expanded: boolean): void {\n this.toolOutputExpanded = expanded;\n const activeHeader = this.customHeader ?? this.builtInHeader;\n if (isExpandable(activeHeader)) {\n activeHeader.setExpanded(expanded);\n }\n for (const child of this.chatContainer.children) {\n if (isExpandable(child)) {\n child.setExpanded(expanded);\n }\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.toggleThinkingBlockVisibility = function(this: InteractiveModeBase): void {\n this.hideThinkingBlock = !this.hideThinkingBlock;\n this.settingsManager.setHideThinkingBlock(this.hideThinkingBlock);\n\n // Rebuild chat from session messages\n this.chatContainer.clear();\n this.rebuildChatFromMessages();\n\n // If streaming, re-add the streaming component with updated visibility and re-render\n if (this.streamingComponent && this.streamingMessage) {\n this.streamingComponent.setHideThinkingBlock(this.hideThinkingBlock);\n this.streamingComponent.updateContent(this.streamingMessage);\n this.chatContainer.addChild(this.streamingComponent);\n }\n\n this.showStatus(\n `Thinking blocks: ${this.hideThinkingBlock ? \"hidden\" : \"visible\"}`,\n );\n };\n\nInteractiveModeBase.prototype.openExternalEditor = function(this: InteractiveModeBase): void {\n const currentText = this.editor.getExpandedText?.() ?? this.editor.getText();\n const updated = openExternalEditorForText(currentText, this.ui, {\n editorCommand: this.settingsManager.getExternalEditorCommand(),\n showWarning: (message) => this.showWarning(message),\n });\n if (updated !== undefined) this.editor.setText(updated);\n };\n\nInteractiveModeBase.prototype.clearEditor = function(this: InteractiveModeBase): void {\n this.editor.setText(\"\");\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showError = function(this: InteractiveModeBase, errorMessage: string): void {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Text(theme.fg(\"error\", `Error: ${errorMessage}`), 1, 0),\n );\n this.chatContainer.addChild(new Spacer(1));\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showWarning = function(this: InteractiveModeBase, warningMessage: string, targetContainer = this.chatContainer): void {\n targetContainer.addChild(new Spacer(1));\n targetContainer.addChild(\n new Text(theme.fg(\"warning\", `Warning: ${warningMessage}`), 1, 0),\n );\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showNewVersionNotification = function(this: InteractiveModeBase, newVersion: string, targetContainer = this.chatContainer): void {\n const action = theme.fg(\"accent\", `${APP_NAME} update`);\n const updateInstruction =\n theme.fg(\"muted\", `New version ${newVersion} is available. Run `) +\n action;\n const changelogLine = CHANGELOG_URL\n ? `\\n${theme.fg(\"muted\", \"Changelog: \")}${\n getCapabilities().hyperlinks\n ? hyperlink(theme.fg(\"accent\", \"open changelog\"), CHANGELOG_URL)\n : theme.fg(\"accent\", CHANGELOG_URL)\n }`\n : \"\";\n\n targetContainer.addChild(new Spacer(1));\n targetContainer.addChild(\n new DynamicBorder((text) => theme.fg(\"warning\", text)),\n );\n targetContainer.addChild(\n new Text(\n `${theme.bold(theme.fg(\"warning\", \"Update Available\"))}\\n${updateInstruction}${changelogLine}`,\n 1,\n 0,\n ),\n );\n targetContainer.addChild(\n new DynamicBorder((text) => theme.fg(\"warning\", text)),\n );\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showPackageUpdateNotification = function(this: InteractiveModeBase, packages: string[], targetContainer = this.chatContainer): void {\n const action = theme.fg(\"accent\", `${APP_NAME} update --extensions`);\n const updateInstruction =\n theme.fg(\"muted\", \"Package updates are available. Run \") + action;\n const packageLines = packages.map((pkg) => `- ${pkg}`).join(\"\\n\");\n\n targetContainer.addChild(new Spacer(1));\n targetContainer.addChild(\n new DynamicBorder((text) => theme.fg(\"warning\", text)),\n );\n targetContainer.addChild(\n new Text(\n `${theme.bold(theme.fg(\"warning\", \"Package Updates Available\"))}\\n${updateInstruction}\\n${theme.fg(\"muted\", \"Packages:\")}\\n${packageLines}`,\n 1,\n 0,\n ),\n );\n targetContainer.addChild(\n new DynamicBorder((text) => theme.fg(\"warning\", text)),\n );\n this.ui.requestRender();\n };\n"]}
|
|
@@ -99,12 +99,12 @@ InteractiveModeBase.prototype.showError = function (errorMessage) {
|
|
|
99
99
|
this.chatContainer.addChild(new Spacer(1));
|
|
100
100
|
this.ui.requestRender();
|
|
101
101
|
};
|
|
102
|
-
InteractiveModeBase.prototype.showWarning = function (warningMessage) {
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
InteractiveModeBase.prototype.showWarning = function (warningMessage, targetContainer = this.chatContainer) {
|
|
103
|
+
targetContainer.addChild(new Spacer(1));
|
|
104
|
+
targetContainer.addChild(new Text(theme.fg("warning", `Warning: ${warningMessage}`), 1, 0));
|
|
105
105
|
this.ui.requestRender();
|
|
106
106
|
};
|
|
107
|
-
InteractiveModeBase.prototype.showNewVersionNotification = function (newVersion) {
|
|
107
|
+
InteractiveModeBase.prototype.showNewVersionNotification = function (newVersion, targetContainer = this.chatContainer) {
|
|
108
108
|
const action = theme.fg("accent", `${APP_NAME} update`);
|
|
109
109
|
const updateInstruction = theme.fg("muted", `New version ${newVersion} is available. Run `) +
|
|
110
110
|
action;
|
|
@@ -113,20 +113,20 @@ InteractiveModeBase.prototype.showNewVersionNotification = function (newVersion)
|
|
|
113
113
|
? hyperlink(theme.fg("accent", "open changelog"), CHANGELOG_URL)
|
|
114
114
|
: theme.fg("accent", CHANGELOG_URL)}`
|
|
115
115
|
: "";
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
targetContainer.addChild(new Spacer(1));
|
|
117
|
+
targetContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
|
|
118
|
+
targetContainer.addChild(new Text(`${theme.bold(theme.fg("warning", "Update Available"))}\n${updateInstruction}${changelogLine}`, 1, 0));
|
|
119
|
+
targetContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
|
|
120
120
|
this.ui.requestRender();
|
|
121
121
|
};
|
|
122
|
-
InteractiveModeBase.prototype.showPackageUpdateNotification = function (packages) {
|
|
122
|
+
InteractiveModeBase.prototype.showPackageUpdateNotification = function (packages, targetContainer = this.chatContainer) {
|
|
123
123
|
const action = theme.fg("accent", `${APP_NAME} update --extensions`);
|
|
124
124
|
const updateInstruction = theme.fg("muted", "Package updates are available. Run ") + action;
|
|
125
125
|
const packageLines = packages.map((pkg) => `- ${pkg}`).join("\n");
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
targetContainer.addChild(new Spacer(1));
|
|
127
|
+
targetContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
|
|
128
|
+
targetContainer.addChild(new Text(`${theme.bold(theme.fg("warning", "Package Updates Available"))}\n${updateInstruction}\n${theme.fg("muted", "Packages:")}\n${packageLines}`, 1, 0));
|
|
129
|
+
targetContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
|
|
130
130
|
this.ui.requestRender();
|
|
131
131
|
};
|
|
132
132
|
//# sourceMappingURL=interactive-editor-actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-editor-actions.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-editor-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,yBAAyB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAChK,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7E,mBAAmB,CAAC,SAAS,CAAC,oBAAoB,GAAG;IACjD,IAAI,IAAI,CAAC,aAAa,YAAY,cAAc,EAAE,CA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AAC;AAC1B,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { getCapabilities, hyperlink, Spacer, Text, APP_NAME, CHANGELOG_URL, openExternalEditorForText, DynamicBorder, theme } from \"./interactive-mode-deps.ts\";\nimport { ExpandableText, isExpandable } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.refreshBuiltInHeader = function(this: InteractiveModeBase): void {\n if (this.builtInHeader instanceof ExpandableText) {\n this.builtInHeader.refresh();\n }\n };\n\nInteractiveModeBase.prototype.updateEditorBorderColor = function(this: InteractiveModeBase): void {\n if (this.isBashMode) {\n this.editor.borderColor = theme.getBashModeBorderColor();\n } else {\n const level = this.session.thinkingLevel || \"off\";\n this.editor.borderColor = theme.getThinkingBorderColor(level);\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.cycleThinkingLevel = function(this: InteractiveModeBase): void {\n const newLevel = this.session.cycleThinkingLevel();\n if (newLevel === undefined) {\n this.showStatus(\"Current model does not support thinking\");\n } else {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n this.showStatus(`Thinking level: ${newLevel}`);\n }\n };\n\nInteractiveModeBase.prototype.cycleModel = async function(this: InteractiveModeBase, direction: \"forward\" | \"backward\"): Promise<void> {\n try {\n const result = await this.session.cycleModel(direction);\n if (result === undefined) {\n const msg =\n this.session.scopedModels.length > 0\n ? \"Only one model in scope\"\n : \"Only one model available\";\n this.showStatus(msg);\n } else {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n const thinkingStr =\n result.model.reasoning && result.thinkingLevel !== \"off\"\n ? ` (thinking: ${result.thinkingLevel})`\n : \"\";\n this.showStatus(\n `Switched to ${result.model.name || result.model.id}${thinkingStr}`,\n );\n void this.maybeWarnAboutAnthropicSubscriptionAuth(result.model);\n }\n } catch (error) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n };\n\nInteractiveModeBase.prototype.toggleToolOutputExpansion = function(this: InteractiveModeBase): void {\n this.setToolsExpanded(!this.toolOutputExpanded);\n };\n\nInteractiveModeBase.prototype.setToolsExpanded = function(this: InteractiveModeBase, expanded: boolean): void {\n this.toolOutputExpanded = expanded;\n const activeHeader = this.customHeader ?? this.builtInHeader;\n if (isExpandable(activeHeader)) {\n activeHeader.setExpanded(expanded);\n }\n for (const child of this.chatContainer.children) {\n if (isExpandable(child)) {\n child.setExpanded(expanded);\n }\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.toggleThinkingBlockVisibility = function(this: InteractiveModeBase): void {\n this.hideThinkingBlock = !this.hideThinkingBlock;\n this.settingsManager.setHideThinkingBlock(this.hideThinkingBlock);\n\n // Rebuild chat from session messages\n this.chatContainer.clear();\n this.rebuildChatFromMessages();\n\n // If streaming, re-add the streaming component with updated visibility and re-render\n if (this.streamingComponent && this.streamingMessage) {\n this.streamingComponent.setHideThinkingBlock(this.hideThinkingBlock);\n this.streamingComponent.updateContent(this.streamingMessage);\n this.chatContainer.addChild(this.streamingComponent);\n }\n\n this.showStatus(\n `Thinking blocks: ${this.hideThinkingBlock ? \"hidden\" : \"visible\"}`,\n );\n };\n\nInteractiveModeBase.prototype.openExternalEditor = function(this: InteractiveModeBase): void {\n const currentText = this.editor.getExpandedText?.() ?? this.editor.getText();\n const updated = openExternalEditorForText(currentText, this.ui, {\n editorCommand: this.settingsManager.getExternalEditorCommand(),\n showWarning: (message) => this.showWarning(message),\n });\n if (updated !== undefined) this.editor.setText(updated);\n };\n\nInteractiveModeBase.prototype.clearEditor = function(this: InteractiveModeBase): void {\n this.editor.setText(\"\");\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showError = function(this: InteractiveModeBase, errorMessage: string): void {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Text(theme.fg(\"error\", `Error: ${errorMessage}`), 1, 0),\n );\n this.chatContainer.addChild(new Spacer(1));\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showWarning = function(this: InteractiveModeBase, warningMessage: string): void {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Text(theme.fg(\"warning\", `Warning: ${warningMessage}`), 1, 0),\n );\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showNewVersionNotification = function(this: InteractiveModeBase, newVersion: string): void {\n const action = theme.fg(\"accent\", `${APP_NAME} update`);\n const updateInstruction =\n theme.fg(\"muted\", `New version ${newVersion} is available. Run `) +\n action;\n const changelogLine = CHANGELOG_URL\n ? `\\n${theme.fg(\"muted\", \"Changelog: \")}${\n getCapabilities().hyperlinks\n ? hyperlink(theme.fg(\"accent\", \"open changelog\"), CHANGELOG_URL)\n : theme.fg(\"accent\", CHANGELOG_URL)\n }`\n : \"\";\n\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new DynamicBorder((text) => theme.fg(\"warning\", text)),\n );\n this.chatContainer.addChild(\n new Text(\n `${theme.bold(theme.fg(\"warning\", \"Update Available\"))}\\n${updateInstruction}${changelogLine}`,\n 1,\n 0,\n ),\n );\n this.chatContainer.addChild(\n new DynamicBorder((text) => theme.fg(\"warning\", text)),\n );\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showPackageUpdateNotification = function(this: InteractiveModeBase, packages: string[]): void {\n const action = theme.fg(\"accent\", `${APP_NAME} update --extensions`);\n const updateInstruction =\n theme.fg(\"muted\", \"Package updates are available. Run \") + action;\n const packageLines = packages.map((pkg) => `- ${pkg}`).join(\"\\n\");\n\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new DynamicBorder((text) => theme.fg(\"warning\", text)),\n );\n this.chatContainer.addChild(\n new Text(\n `${theme.bold(theme.fg(\"warning\", \"Package Updates Available\"))}\\n${updateInstruction}\\n${theme.fg(\"muted\", \"Packages:\")}\\n${packageLines}`,\n 1,\n 0,\n ),\n );\n this.chatContainer.addChild(\n new DynamicBorder((text) => theme.fg(\"warning\", text)),\n );\n this.ui.requestRender();\n };\n"]}
|
|
1
|
+
{"version":3,"file":"interact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CACtB,IAAI,IAAI,CACN,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC,KAAK,iBAAiB,KAAK,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,YAAY,EAAE,EAC3I,CAAC,EACD,CAAC,CACF,CACF,CAAC;IACF,eAAe,CAAC,QAAQ,CACtB,IAAI,aAAa,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CACvD,CAAC;IACF,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;AAC1B,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { getCapabilities, hyperlink, Spacer, Text, APP_NAME, CHANGELOG_URL, openExternalEditorForText, DynamicBorder, theme } from \"./interactive-mode-deps.ts\";\nimport { ExpandableText, isExpandable } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.refreshBuiltInHeader = function(this: InteractiveModeBase): void {\n if (this.builtInHeader instanceof ExpandableText) {\n this.builtInHeader.refresh();\n }\n };\n\nInteractiveModeBase.prototype.updateEditorBorderColor = function(this: InteractiveModeBase): void {\n if (this.isBashMode) {\n this.editor.borderColor = theme.getBashModeBorderColor();\n } else {\n const level = this.session.thinkingLevel || \"off\";\n this.editor.borderColor = theme.getThinkingBorderColor(level);\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.cycleThinkingLevel = function(this: InteractiveModeBase): void {\n const newLevel = this.session.cycleThinkingLevel();\n if (newLevel === undefined) {\n this.showStatus(\"Current model does not support thinking\");\n } else {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n this.showStatus(`Thinking level: ${newLevel}`);\n }\n };\n\nInteractiveModeBase.prototype.cycleModel = async function(this: InteractiveModeBase, direction: \"forward\" | \"backward\"): Promise<void> {\n try {\n const result = await this.session.cycleModel(direction);\n if (result === undefined) {\n const msg =\n this.session.scopedModels.length > 0\n ? \"Only one model in scope\"\n : \"Only one model available\";\n this.showStatus(msg);\n } else {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n const thinkingStr =\n result.model.reasoning && result.thinkingLevel !== \"off\"\n ? ` (thinking: ${result.thinkingLevel})`\n : \"\";\n this.showStatus(\n `Switched to ${result.model.name || result.model.id}${thinkingStr}`,\n );\n void this.maybeWarnAboutAnthropicSubscriptionAuth(result.model);\n }\n } catch (error) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n };\n\nInteractiveModeBase.prototype.toggleToolOutputExpansion = function(this: InteractiveModeBase): void {\n this.setToolsExpanded(!this.toolOutputExpanded);\n };\n\nInteractiveModeBase.prototype.setToolsExpanded = function(this: InteractiveModeBase, expanded: boolean): void {\n this.toolOutputExpanded = expanded;\n const activeHeader = this.customHeader ?? this.builtInHeader;\n if (isExpandable(activeHeader)) {\n activeHeader.setExpanded(expanded);\n }\n for (const child of this.chatContainer.children) {\n if (isExpandable(child)) {\n child.setExpanded(expanded);\n }\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.toggleThinkingBlockVisibility = function(this: InteractiveModeBase): void {\n this.hideThinkingBlock = !this.hideThinkingBlock;\n this.settingsManager.setHideThinkingBlock(this.hideThinkingBlock);\n\n // Rebuild chat from session messages\n this.chatContainer.clear();\n this.rebuildChatFromMessages();\n\n // If streaming, re-add the streaming component with updated visibility and re-render\n if (this.streamingComponent && this.streamingMessage) {\n this.streamingComponent.setHideThinkingBlock(this.hideThinkingBlock);\n this.streamingComponent.updateContent(this.streamingMessage);\n this.chatContainer.addChild(this.streamingComponent);\n }\n\n this.showStatus(\n `Thinking blocks: ${this.hideThinkingBlock ? \"hidden\" : \"visible\"}`,\n );\n };\n\nInteractiveModeBase.prototype.openExternalEditor = function(this: InteractiveModeBase): void {\n const currentText = this.editor.getExpandedText?.() ?? this.editor.getText();\n const updated = openExternalEditorForText(currentText, this.ui, {\n editorCommand: this.settingsManager.getExternalEditorCommand(),\n showWarning: (message) => this.showWarning(message),\n });\n if (updated !== undefined) this.editor.setText(updated);\n };\n\nInteractiveModeBase.prototype.clearEditor = function(this: InteractiveModeBase): void {\n this.editor.setText(\"\");\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showError = function(this: InteractiveModeBase, errorMessage: string): void {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Text(theme.fg(\"error\", `Error: ${errorMessage}`), 1, 0),\n );\n this.chatContainer.addChild(new Spacer(1));\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showWarning = function(this: InteractiveModeBase, warningMessage: string, targetContainer = this.chatContainer): void {\n targetContainer.addChild(new Spacer(1));\n targetContainer.addChild(\n new Text(theme.fg(\"warning\", `Warning: ${warningMessage}`), 1, 0),\n );\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showNewVersionNotification = function(this: InteractiveModeBase, newVersion: string, targetContainer = this.chatContainer): void {\n const action = theme.fg(\"accent\", `${APP_NAME} update`);\n const updateInstruction =\n theme.fg(\"muted\", `New version ${newVersion} is available. Run `) +\n action;\n const changelogLine = CHANGELOG_URL\n ? `\\n${theme.fg(\"muted\", \"Changelog: \")}${\n getCapabilities().hyperlinks\n ? hyperlink(theme.fg(\"accent\", \"open changelog\"), CHANGELOG_URL)\n : theme.fg(\"accent\", CHANGELOG_URL)\n }`\n : \"\";\n\n targetContainer.addChild(new Spacer(1));\n targetContainer.addChild(\n new DynamicBorder((text) => theme.fg(\"warning\", text)),\n );\n targetContainer.addChild(\n new Text(\n `${theme.bold(theme.fg(\"warning\", \"Update Available\"))}\\n${updateInstruction}${changelogLine}`,\n 1,\n 0,\n ),\n );\n targetContainer.addChild(\n new DynamicBorder((text) => theme.fg(\"warning\", text)),\n );\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showPackageUpdateNotification = function(this: InteractiveModeBase, packages: string[], targetContainer = this.chatContainer): void {\n const action = theme.fg(\"accent\", `${APP_NAME} update --extensions`);\n const updateInstruction =\n theme.fg(\"muted\", \"Package updates are available. Run \") + action;\n const packageLines = packages.map((pkg) => `- ${pkg}`).join(\"\\n\");\n\n targetContainer.addChild(new Spacer(1));\n targetContainer.addChild(\n new DynamicBorder((text) => theme.fg(\"warning\", text)),\n );\n targetContainer.addChild(\n new Text(\n `${theme.bold(theme.fg(\"warning\", \"Package Updates Available\"))}\\n${updateInstruction}\\n${theme.fg(\"muted\", \"Packages:\")}\\n${packageLines}`,\n 1,\n 0,\n ),\n );\n targetContainer.addChild(\n new DynamicBorder((text) => theme.fg(\"warning\", text)),\n );\n this.ui.requestRender();\n };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-extension-runtime.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-extension-runtime.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type KeyId, type Component, type LoaderIndicatorOptions, type ExtensionContext, type ExtensionRunner, type ExtensionWidgetOptions, Container, Loader, matchesKey, Text, TUI, AssistantMessageComponent, keyText, Theme, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.setupExtensionShortcuts = function(this: InteractiveModeBase, extensionRunner: ExtensionRunner): void {\n const shortcuts = extensionRunner.getShortcuts(\n this.keybindings.getEffectiveConfig(),\n );\n if (shortcuts.size === 0) return;\n\n // Create a context for shortcut handlers\n const createContext = (): ExtensionContext => ({\n ui: this.createExtensionUIContext(),\n mode: \"tui\",\n hasUI: true,\n cwd: this.sessionManager.getCwd(),\n sessionManager: this.sessionManager,\n modelRegistry: this.session.modelRegistry,\n model: this.session.model,\n isIdle: () => !this.session.isStreaming,\n isProjectTrusted: () => this.session.settingsManager.isProjectTrusted(),\n signal: this.session.agent.signal,\n abort: () => this.session.abort(),\n hasPendingMessages: () => this.session.pendingMessageCount > 0,\n shutdown: () => {\n this.shutdownRequested = true;\n },\n getContextUsage: () => this.session.getContextUsage(),\n compact: (options) => {\n void (async () => {\n try {\n const result = await this.session.compact();\n options?.onComplete?.(result);\n } catch (error) {\n const err =\n error instanceof Error ? error : new Error(String(error));\n options?.onError?.(err);\n }\n })();\n },\n getSystemPrompt: () => this.session.systemPrompt,\n });\n\n // Set up the extension shortcut handler on the default editor\n this.defaultEditor.onExtensionShortcut = (data: string) => {\n for (const [shortcutStr, shortcut] of shortcuts) {\n // Cast to KeyId - extension shortcuts use the same format\n if (matchesKey(data, shortcutStr as KeyId)) {\n // Run handler async, don't block input\n Promise.resolve(shortcut.handler(createContext())).catch((err) => {\n this.showError(\n `Shortcut handler error: ${err instanceof Error ? err.message : String(err)}`,\n );\n });\n return true;\n }\n }\n return false;\n };\n };\n\nInteractiveModeBase.prototype.setExtensionStatus = function(this: InteractiveModeBase, key: string, text: string | undefined): void {\n this.footerDataProvider.setExtensionStatus(key, text);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.getWorkingLoaderMessage = function(this: InteractiveModeBase): string {\n return this.workingMessage ?? this.defaultWorkingMessage;\n };\n\nInteractiveModeBase.prototype.createWorkingLoader = function(this: InteractiveModeBase): Loader {\n return new Loader(\n this.ui,\n (spinner) => theme.fg(\"accent\", spinner),\n (text) => theme.fg(\"muted\", text),\n this.getWorkingLoaderMessage(),\n this.workingIndicatorOptions,\n );\n };\n\nInteractiveModeBase.prototype.stopWorkingLoader = function(this: InteractiveModeBase): void {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n };\n\nInteractiveModeBase.prototype.setWorkingVisible = function(this: InteractiveModeBase, visible: boolean): void {\n this.workingVisible = visible;\n if (!visible) {\n this.stopWorkingLoader();\n this.ui.requestRender();\n return;\n }\n if (this.session.isStreaming && !this.loadingAnimation) {\n this.statusContainer.clear();\n this.loadingAnimation = this.createWorkingLoader();\n this.statusContainer.addChild(this.loadingAnimation);\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setWorkingIndicator = function(this: InteractiveModeBase, options?: LoaderIndicatorOptions): void {\n this.workingIndicatorOptions = options;\n this.loadingAnimation?.setIndicator(options);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setHiddenThinkingLabel = function(this: InteractiveModeBase, label?: string): void {\n this.hiddenThinkingLabel = label ?? this.defaultHiddenThinkingLabel;\n for (const child of this.chatContainer.children) {\n if (child instanceof AssistantMessageComponent) {\n child.setHiddenThinkingLabel(this.hiddenThinkingLabel);\n }\n }\n if (this.streamingComponent) {\n this.streamingComponent.setHiddenThinkingLabel(this.hiddenThinkingLabel);\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setExtensionWidget = function(this: InteractiveModeBase, key: string, content:\n | string[]\n | ((tui: TUI, thm: Theme) => Component & { dispose?(): void })\n | undefined, options?: ExtensionWidgetOptions): void {\n const placement = options?.placement ?? \"aboveEditor\";\n const removeExisting = (\n map: Map<string, Component & { dispose?(): void }>,\n ) => {\n const existing = map.get(key);\n if (existing?.dispose) existing.dispose();\n map.delete(key);\n };\n\n removeExisting(this.extensionWidgetsAbove);\n removeExisting(this.extensionWidgetsBelow);\n\n if (content === undefined) {\n this.renderWidgets();\n return;\n }\n\n let component: Component & { dispose?(): void };\n\n if (Array.isArray(content)) {\n // Wrap string array in a Container with Text components\n const container = new Container();\n for (const line of content.slice(0, InteractiveModeBase.MAX_WIDGET_LINES)) {\n container.addChild(new Text(line, 1, 0));\n }\n if (content.length > InteractiveModeBase.MAX_WIDGET_LINES) {\n container.addChild(\n new Text(theme.fg(\"muted\", \"... (widget truncated)\"), 1, 0),\n );\n }\n component = container;\n } else {\n // Factory function - create component\n component = content(this.ui, theme);\n }\n\n const targetMap =\n placement === \"belowEditor\"\n ? this.extensionWidgetsBelow\n : this.extensionWidgetsAbove;\n targetMap.set(key, component);\n this.renderWidgets();\n };\n\nInteractiveModeBase.prototype.clearExtensionWidgets = function(this: InteractiveModeBase): void {\n for (const widget of this.extensionWidgetsAbove.values()) {\n widget.dispose?.();\n }\n for (const widget of this.extensionWidgetsBelow.values()) {\n widget.dispose?.();\n }\n this.extensionWidgetsAbove.clear();\n this.extensionWidgetsBelow.clear();\n this.renderWidgets();\n };\n\nInteractiveModeBase.prototype.resetExtensionUI = function(this: InteractiveModeBase): void {\n if (this.extensionSelector) {\n this.hideExtensionSelector();\n }\n if (this.extensionInput) {\n this.hideExtensionInput();\n }\n if (this.extensionEditor) {\n this.hideExtensionEditor();\n }\n this.ui.hideOverlay();\n this.clearExtensionTerminalInputListeners();\n this.setExtensionFooter(undefined);\n this.setExtensionHeader(undefined);\n this.clearExtensionWidgets();\n this.footerDataProvider.clearExtensionStatuses();\n this.footer.invalidate();\n this.autocompleteProviderWrappers = [];\n this.setCustomEditorComponent(undefined);\n this.setupAutocompleteProvider();\n this.defaultEditor.onExtensionShortcut = undefined;\n this.updateTerminalTitle();\n this.workingMessage = undefined;\n this.workingVisible = true;\n this.setWorkingIndicator();\n if (this.loadingAnimation) {\n this.loadingAnimation.setMessage(\n `${this.defaultWorkingMessage} (${keyText(\"app.interrupt\")} Interrupt)`,\n );\n }\n this.setHiddenThinkingLabel();\n };\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-extension-runtime.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-extension-runtime.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type KeyId, type Component, type LoaderIndicatorOptions, type ExtensionContext, type ExtensionRunner, type ExtensionWidgetOptions, Container, Loader, matchesKey, Text, TUI, AssistantMessageComponent, keyText, Theme, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.setupExtensionShortcuts = function(this: InteractiveModeBase, extensionRunner: ExtensionRunner): void {\n const shortcuts = extensionRunner.getShortcuts(\n this.keybindings.getEffectiveConfig(),\n );\n if (shortcuts.size === 0) return;\n\n // Create a context for shortcut handlers\n const createContext = (): ExtensionContext => ({\n ui: this.createExtensionUIContext(),\n mode: \"tui\",\n hasUI: true,\n cwd: this.sessionManager.getCwd(),\n sessionManager: this.sessionManager,\n modelRegistry: this.session.modelRegistry,\n model: this.session.model,\n isIdle: () => !this.session.isStreaming,\n isProjectTrusted: () => this.session.settingsManager.isProjectTrusted(),\n signal: this.session.agent.signal,\n abort: () => this.session.abort(),\n hasPendingMessages: () => this.session.pendingMessageCount > 0,\n shutdown: () => {\n this.shutdownRequested = true;\n },\n getContextUsage: () => this.session.getContextUsage(),\n compact: (options) => {\n void (async () => {\n try {\n const result = await this.session.compact();\n options?.onComplete?.(result);\n } catch (error) {\n const err =\n error instanceof Error ? error : new Error(String(error));\n options?.onError?.(err);\n }\n })();\n },\n getSystemPrompt: () => this.session.systemPrompt,\n });\n\n // Set up the extension shortcut handler on the default editor\n this.defaultEditor.onExtensionShortcut = (data: string) => {\n for (const [shortcutStr, shortcut] of shortcuts) {\n // Cast to KeyId - extension shortcuts use the same format\n if (matchesKey(data, shortcutStr as KeyId)) {\n // Run handler async, don't block input\n Promise.resolve(shortcut.handler(createContext())).catch((err) => {\n this.showError(\n `Shortcut handler error: ${err instanceof Error ? err.message : String(err)}`,\n );\n });\n return true;\n }\n }\n return false;\n };\n };\n\nInteractiveModeBase.prototype.setExtensionStatus = function(this: InteractiveModeBase, key: string, text: string | undefined): void {\n this.footerDataProvider.setExtensionStatus(key, text);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.getWorkingLoaderMessage = function(this: InteractiveModeBase): string {\n return this.workingMessage ?? this.defaultWorkingMessage;\n };\n\nInteractiveModeBase.prototype.createWorkingLoader = function(this: InteractiveModeBase): Loader {\n return new Loader(\n this.ui,\n (spinner) => theme.fg(\"accent\", spinner),\n (text) => theme.fg(\"muted\", text),\n this.getWorkingLoaderMessage(),\n this.workingIndicatorOptions,\n );\n };\n\nInteractiveModeBase.prototype.stopWorkingLoader = function(this: InteractiveModeBase): void {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n };\n\nInteractiveModeBase.prototype.showWorkingLoaderNow = function(this: InteractiveModeBase): void {\n // Mount the working spinner immediately, regardless of streaming state, so\n // there is no visible gap between submitting a prompt and the agent turn\n // actually starting. Prompt preflight (extension input hooks, template/skill\n // expansion, auth and compaction checks, deferred startup) runs before the\n // agent emits `agent_start`, which is otherwise the only place the loader is\n // created. Respect `workingVisible` so extensions can still suppress it.\n if (!this.workingVisible || this.loadingAnimation) {\n this.ui.requestRender();\n return;\n }\n this.statusContainer.clear();\n this.loadingAnimation = this.createWorkingLoader();\n this.statusContainer.addChild(this.loadingAnimation);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setWorkingVisible = function(this: InteractiveModeBase, visible: boolean): void {\n this.workingVisible = visible;\n if (!visible) {\n this.stopWorkingLoader();\n this.ui.requestRender();\n return;\n }\n if (this.session.isStreaming && !this.loadingAnimation) {\n this.statusContainer.clear();\n this.loadingAnimation = this.createWorkingLoader();\n this.statusContainer.addChild(this.loadingAnimation);\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setWorkingIndicator = function(this: InteractiveModeBase, options?: LoaderIndicatorOptions): void {\n this.workingIndicatorOptions = options;\n this.loadingAnimation?.setIndicator(options);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setHiddenThinkingLabel = function(this: InteractiveModeBase, label?: string): void {\n this.hiddenThinkingLabel = label ?? this.defaultHiddenThinkingLabel;\n for (const child of this.chatContainer.children) {\n if (child instanceof AssistantMessageComponent) {\n child.setHiddenThinkingLabel(this.hiddenThinkingLabel);\n }\n }\n if (this.streamingComponent) {\n this.streamingComponent.setHiddenThinkingLabel(this.hiddenThinkingLabel);\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setExtensionWidget = function(this: InteractiveModeBase, key: string, content:\n | string[]\n | ((tui: TUI, thm: Theme) => Component & { dispose?(): void })\n | undefined, options?: ExtensionWidgetOptions): void {\n const placement = options?.placement ?? \"aboveEditor\";\n const removeExisting = (\n map: Map<string, Component & { dispose?(): void }>,\n ) => {\n const existing = map.get(key);\n if (existing?.dispose) existing.dispose();\n map.delete(key);\n };\n\n removeExisting(this.extensionWidgetsAbove);\n removeExisting(this.extensionWidgetsBelow);\n\n if (content === undefined) {\n this.renderWidgets();\n return;\n }\n\n let component: Component & { dispose?(): void };\n\n if (Array.isArray(content)) {\n // Wrap string array in a Container with Text components\n const container = new Container();\n for (const line of content.slice(0, InteractiveModeBase.MAX_WIDGET_LINES)) {\n container.addChild(new Text(line, 1, 0));\n }\n if (content.length > InteractiveModeBase.MAX_WIDGET_LINES) {\n container.addChild(\n new Text(theme.fg(\"muted\", \"... (widget truncated)\"), 1, 0),\n );\n }\n component = container;\n } else {\n // Factory function - create component\n component = content(this.ui, theme);\n }\n\n const targetMap =\n placement === \"belowEditor\"\n ? this.extensionWidgetsBelow\n : this.extensionWidgetsAbove;\n targetMap.set(key, component);\n this.renderWidgets();\n };\n\nInteractiveModeBase.prototype.clearExtensionWidgets = function(this: InteractiveModeBase): void {\n for (const widget of this.extensionWidgetsAbove.values()) {\n widget.dispose?.();\n }\n for (const widget of this.extensionWidgetsBelow.values()) {\n widget.dispose?.();\n }\n this.extensionWidgetsAbove.clear();\n this.extensionWidgetsBelow.clear();\n this.renderWidgets();\n };\n\nInteractiveModeBase.prototype.resetExtensionUI = function(this: InteractiveModeBase): void {\n if (this.extensionSelector) {\n this.hideExtensionSelector();\n }\n if (this.extensionInput) {\n this.hideExtensionInput();\n }\n if (this.extensionEditor) {\n this.hideExtensionEditor();\n }\n this.ui.hideOverlay();\n this.clearExtensionTerminalInputListeners();\n this.setExtensionFooter(undefined);\n this.setExtensionHeader(undefined);\n this.clearExtensionWidgets();\n this.footerDataProvider.clearExtensionStatuses();\n this.footer.invalidate();\n this.autocompleteProviderWrappers = [];\n this.setCustomEditorComponent(undefined);\n this.setupAutocompleteProvider();\n this.defaultEditor.onExtensionShortcut = undefined;\n this.updateTerminalTitle();\n this.workingMessage = undefined;\n this.workingVisible = true;\n this.setWorkingIndicator();\n if (this.loadingAnimation) {\n this.loadingAnimation.setMessage(\n `${this.defaultWorkingMessage} (${keyText(\"app.interrupt\")} Interrupt)`,\n );\n }\n this.setHiddenThinkingLabel();\n };\n"]}
|
|
@@ -68,6 +68,22 @@ InteractiveModeBase.prototype.stopWorkingLoader = function () {
|
|
|
68
68
|
}
|
|
69
69
|
this.statusContainer.clear();
|
|
70
70
|
};
|
|
71
|
+
InteractiveModeBase.prototype.showWorkingLoaderNow = function () {
|
|
72
|
+
// Mount the working spinner immediately, regardless of streaming state, so
|
|
73
|
+
// there is no visible gap between submitting a prompt and the agent turn
|
|
74
|
+
// actually starting. Prompt preflight (extension input hooks, template/skill
|
|
75
|
+
// expansion, auth and compaction checks, deferred startup) runs before the
|
|
76
|
+
// agent emits `agent_start`, which is otherwise the only place the loader is
|
|
77
|
+
// created. Respect `workingVisible` so extensions can still suppress it.
|
|
78
|
+
if (!this.workingVisible || this.loadingAnimation) {
|
|
79
|
+
this.ui.requestRender();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.statusContainer.clear();
|
|
83
|
+
this.loadingAnimation = this.createWorkingLoader();
|
|
84
|
+
this.statusContainer.addChild(this.loadingAnimation);
|
|
85
|
+
this.ui.requestRender();
|
|
86
|
+
};
|
|
71
87
|
InteractiveModeBase.prototype.setWorkingVisible = function (visible) {
|
|
72
88
|
this.workingVisible = visible;
|
|
73
89
|
if (!visible) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-extension-runtime.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-extension-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAqI,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAO,yBAAyB,EAAE,OAAO,EAAS,KAAK,EAAE,MAAM,4BAA4B,C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IACjD,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IACzB,IAAI,CAAC,4BAA4B,GAAG,EAAE,CAAC;IACvC,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC;IACzC,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACjC,IAAI,CAAC,aAAa,CAAC,mBAAmB,GAAG,SAAS,CAAC;IACnD,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC3B,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;IAChC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC3B,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC3B,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAC9B,GAAG,IAAI,CAAC,qBAAqB,KAAK,OAAO,CAAC,eAAe,CAAC,aAAa,CACxE,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,sBAAsB,EAAE,CAAC;AAChC,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type KeyId, type Component, type LoaderIndicatorOptions, type ExtensionContext, type ExtensionRunner, type ExtensionWidgetOptions, Container, Loader, matchesKey, Text, TUI, AssistantMessageComponent, keyText, Theme, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.setupExtensionShortcuts = function(this: InteractiveModeBase, extensionRunner: ExtensionRunner): void {\n const shortcuts = extensionRunner.getShortcuts(\n this.keybindings.getEffectiveConfig(),\n );\n if (shortcuts.size === 0) return;\n\n // Create a context for shortcut handlers\n const createContext = (): ExtensionContext => ({\n ui: this.createExtensionUIContext(),\n mode: \"tui\",\n hasUI: true,\n cwd: this.sessionManager.getCwd(),\n sessionManager: this.sessionManager,\n modelRegistry: this.session.modelRegistry,\n model: this.session.model,\n isIdle: () => !this.session.isStreaming,\n isProjectTrusted: () => this.session.settingsManager.isProjectTrusted(),\n signal: this.session.agent.signal,\n abort: () => this.session.abort(),\n hasPendingMessages: () => this.session.pendingMessageCount > 0,\n shutdown: () => {\n this.shutdownRequested = true;\n },\n getContextUsage: () => this.session.getContextUsage(),\n compact: (options) => {\n void (async () => {\n try {\n const result = await this.session.compact();\n options?.onComplete?.(result);\n } catch (error) {\n const err =\n error instanceof Error ? error : new Error(String(error));\n options?.onError?.(err);\n }\n })();\n },\n getSystemPrompt: () => this.session.systemPrompt,\n });\n\n // Set up the extension shortcut handler on the default editor\n this.defaultEditor.onExtensionShortcut = (data: string) => {\n for (const [shortcutStr, shortcut] of shortcuts) {\n // Cast to KeyId - extension shortcuts use the same format\n if (matchesKey(data, shortcutStr as KeyId)) {\n // Run handler async, don't block input\n Promise.resolve(shortcut.handler(createContext())).catch((err) => {\n this.showError(\n `Shortcut handler error: ${err instanceof Error ? err.message : String(err)}`,\n );\n });\n return true;\n }\n }\n return false;\n };\n };\n\nInteractiveModeBase.prototype.setExtensionStatus = function(this: InteractiveModeBase, key: string, text: string | undefined): void {\n this.footerDataProvider.setExtensionStatus(key, text);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.getWorkingLoaderMessage = function(this: InteractiveModeBase): string {\n return this.workingMessage ?? this.defaultWorkingMessage;\n };\n\nInteractiveModeBase.prototype.createWorkingLoader = function(this: InteractiveModeBase): Loader {\n return new Loader(\n this.ui,\n (spinner) => theme.fg(\"accent\", spinner),\n (text) => theme.fg(\"muted\", text),\n this.getWorkingLoaderMessage(),\n this.workingIndicatorOptions,\n );\n };\n\nInteractiveModeBase.prototype.stopWorkingLoader = function(this: InteractiveModeBase): void {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n };\n\nInteractiveModeBase.prototype.setWorkingVisible = function(this: InteractiveModeBase, visible: boolean): void {\n this.workingVisible = visible;\n if (!visible) {\n this.stopWorkingLoader();\n this.ui.requestRender();\n return;\n }\n if (this.session.isStreaming && !this.loadingAnimation) {\n this.statusContainer.clear();\n this.loadingAnimation = this.createWorkingLoader();\n this.statusContainer.addChild(this.loadingAnimation);\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setWorkingIndicator = function(this: InteractiveModeBase, options?: LoaderIndicatorOptions): void {\n this.workingIndicatorOptions = options;\n this.loadingAnimation?.setIndicator(options);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setHiddenThinkingLabel = function(this: InteractiveModeBase, label?: string): void {\n this.hiddenThinkingLabel = label ?? this.defaultHiddenThinkingLabel;\n for (const child of this.chatContainer.children) {\n if (child instanceof AssistantMessageComponent) {\n child.setHiddenThinkingLabel(this.hiddenThinkingLabel);\n }\n }\n if (this.streamingComponent) {\n this.streamingComponent.setHiddenThinkingLabel(this.hiddenThinkingLabel);\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setExtensionWidget = function(this: InteractiveModeBase, key: string, content:\n | string[]\n | ((tui: TUI, thm: Theme) => Component & { dispose?(): void })\n | undefined, options?: ExtensionWidgetOptions): void {\n const placement = options?.placement ?? \"aboveEditor\";\n const removeExisting = (\n map: Map<string, Component & { dispose?(): void }>,\n ) => {\n const existing = map.get(key);\n if (existing?.dispose) existing.dispose();\n map.delete(key);\n };\n\n removeExisting(this.extensionWidgetsAbove);\n removeExisting(this.extensionWidgetsBelow);\n\n if (content === undefined) {\n this.renderWidgets();\n return;\n }\n\n let component: Component & { dispose?(): void };\n\n if (Array.isArray(content)) {\n // Wrap string array in a Container with Text components\n const container = new Container();\n for (const line of content.slice(0, InteractiveModeBase.MAX_WIDGET_LINES)) {\n container.addChild(new Text(line, 1, 0));\n }\n if (content.length > InteractiveModeBase.MAX_WIDGET_LINES) {\n container.addChild(\n new Text(theme.fg(\"muted\", \"... (widget truncated)\"), 1, 0),\n );\n }\n component = container;\n } else {\n // Factory function - create component\n component = content(this.ui, theme);\n }\n\n const targetMap =\n placement === \"belowEditor\"\n ? this.extensionWidgetsBelow\n : this.extensionWidgetsAbove;\n targetMap.set(key, component);\n this.renderWidgets();\n };\n\nInteractiveModeBase.prototype.clearExtensionWidgets = function(this: InteractiveModeBase): void {\n for (const widget of this.extensionWidgetsAbove.values()) {\n widget.dispose?.();\n }\n for (const widget of this.extensionWidgetsBelow.values()) {\n widget.dispose?.();\n }\n this.extensionWidgetsAbove.clear();\n this.extensionWidgetsBelow.clear();\n this.renderWidgets();\n };\n\nInteractiveModeBase.prototype.resetExtensionUI = function(this: InteractiveModeBase): void {\n if (this.extensionSelector) {\n this.hideExtensionSelector();\n }\n if (this.extensionInput) {\n this.hideExtensionInput();\n }\n if (this.extensionEditor) {\n this.hideExtensionEditor();\n }\n this.ui.hideOverlay();\n this.clearExtensionTerminalInputListeners();\n this.setExtensionFooter(undefined);\n this.setExtensionHeader(undefined);\n this.clearExtensionWidgets();\n this.footerDataProvider.clearExtensionStatuses();\n this.footer.invalidate();\n this.autocompleteProviderWrappers = [];\n this.setCustomEditorComponent(undefined);\n this.setupAutocompleteProvider();\n this.defaultEditor.onExtensionShortcut = undefined;\n this.updateTerminalTitle();\n this.workingMessage = undefined;\n this.workingVisible = true;\n this.setWorkingIndicator();\n if (this.loadingAnimation) {\n this.loadingAnimation.setMessage(\n `${this.defaultWorkingMessage} (${keyText(\"app.interrupt\")} Interrupt)`,\n );\n }\n this.setHiddenThinkingLabel();\n };\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-extension-runtime.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-extension-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAqI,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAO,yBAAyB,EAAE,OAAO,EAAS,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAE3Q,mBAAmB,CAAC,SAAS,CAAC,uBAAuB,GAAG,UAAoC,eAAgC;IACxH,MAAM,SAAS,GAAG,eAAe,CAAC,YAAY,CAC5C,IAAI,CAAC,W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AC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IACD,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QACzB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IACD,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;IACtB,IAAI,CAAC,oCAAoC,EAAE,CAAC;IAC5C,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC7B,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,EAAE,CAAC;IACjD,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IACzB,IAAI,CAAC,4BAA4B,GAAG,EAAE,CAAC;IACvC,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC;IACzC,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACjC,IAAI,CAAC,aAAa,CAAC,mBAAmB,GAAG,SAAS,CAAC;IACnD,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC3B,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;IAChC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC3B,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC3B,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAC9B,GAAG,IAAI,CAAC,qBAAqB,KAAK,OAAO,CAAC,eAAe,CAAC,aAAa,CACxE,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,sBAAsB,EAAE,CAAC;AAChC,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type KeyId, type Component, type LoaderIndicatorOptions, type ExtensionContext, type ExtensionRunner, type ExtensionWidgetOptions, Container, Loader, matchesKey, Text, TUI, AssistantMessageComponent, keyText, Theme, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.setupExtensionShortcuts = function(this: InteractiveModeBase, extensionRunner: ExtensionRunner): void {\n const shortcuts = extensionRunner.getShortcuts(\n this.keybindings.getEffectiveConfig(),\n );\n if (shortcuts.size === 0) return;\n\n // Create a context for shortcut handlers\n const createContext = (): ExtensionContext => ({\n ui: this.createExtensionUIContext(),\n mode: \"tui\",\n hasUI: true,\n cwd: this.sessionManager.getCwd(),\n sessionManager: this.sessionManager,\n modelRegistry: this.session.modelRegistry,\n model: this.session.model,\n isIdle: () => !this.session.isStreaming,\n isProjectTrusted: () => this.session.settingsManager.isProjectTrusted(),\n signal: this.session.agent.signal,\n abort: () => this.session.abort(),\n hasPendingMessages: () => this.session.pendingMessageCount > 0,\n shutdown: () => {\n this.shutdownRequested = true;\n },\n getContextUsage: () => this.session.getContextUsage(),\n compact: (options) => {\n void (async () => {\n try {\n const result = await this.session.compact();\n options?.onComplete?.(result);\n } catch (error) {\n const err =\n error instanceof Error ? error : new Error(String(error));\n options?.onError?.(err);\n }\n })();\n },\n getSystemPrompt: () => this.session.systemPrompt,\n });\n\n // Set up the extension shortcut handler on the default editor\n this.defaultEditor.onExtensionShortcut = (data: string) => {\n for (const [shortcutStr, shortcut] of shortcuts) {\n // Cast to KeyId - extension shortcuts use the same format\n if (matchesKey(data, shortcutStr as KeyId)) {\n // Run handler async, don't block input\n Promise.resolve(shortcut.handler(createContext())).catch((err) => {\n this.showError(\n `Shortcut handler error: ${err instanceof Error ? err.message : String(err)}`,\n );\n });\n return true;\n }\n }\n return false;\n };\n };\n\nInteractiveModeBase.prototype.setExtensionStatus = function(this: InteractiveModeBase, key: string, text: string | undefined): void {\n this.footerDataProvider.setExtensionStatus(key, text);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.getWorkingLoaderMessage = function(this: InteractiveModeBase): string {\n return this.workingMessage ?? this.defaultWorkingMessage;\n };\n\nInteractiveModeBase.prototype.createWorkingLoader = function(this: InteractiveModeBase): Loader {\n return new Loader(\n this.ui,\n (spinner) => theme.fg(\"accent\", spinner),\n (text) => theme.fg(\"muted\", text),\n this.getWorkingLoaderMessage(),\n this.workingIndicatorOptions,\n );\n };\n\nInteractiveModeBase.prototype.stopWorkingLoader = function(this: InteractiveModeBase): void {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n };\n\nInteractiveModeBase.prototype.showWorkingLoaderNow = function(this: InteractiveModeBase): void {\n // Mount the working spinner immediately, regardless of streaming state, so\n // there is no visible gap between submitting a prompt and the agent turn\n // actually starting. Prompt preflight (extension input hooks, template/skill\n // expansion, auth and compaction checks, deferred startup) runs before the\n // agent emits `agent_start`, which is otherwise the only place the loader is\n // created. Respect `workingVisible` so extensions can still suppress it.\n if (!this.workingVisible || this.loadingAnimation) {\n this.ui.requestRender();\n return;\n }\n this.statusContainer.clear();\n this.loadingAnimation = this.createWorkingLoader();\n this.statusContainer.addChild(this.loadingAnimation);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setWorkingVisible = function(this: InteractiveModeBase, visible: boolean): void {\n this.workingVisible = visible;\n if (!visible) {\n this.stopWorkingLoader();\n this.ui.requestRender();\n return;\n }\n if (this.session.isStreaming && !this.loadingAnimation) {\n this.statusContainer.clear();\n this.loadingAnimation = this.createWorkingLoader();\n this.statusContainer.addChild(this.loadingAnimation);\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setWorkingIndicator = function(this: InteractiveModeBase, options?: LoaderIndicatorOptions): void {\n this.workingIndicatorOptions = options;\n this.loadingAnimation?.setIndicator(options);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setHiddenThinkingLabel = function(this: InteractiveModeBase, label?: string): void {\n this.hiddenThinkingLabel = label ?? this.defaultHiddenThinkingLabel;\n for (const child of this.chatContainer.children) {\n if (child instanceof AssistantMessageComponent) {\n child.setHiddenThinkingLabel(this.hiddenThinkingLabel);\n }\n }\n if (this.streamingComponent) {\n this.streamingComponent.setHiddenThinkingLabel(this.hiddenThinkingLabel);\n }\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.setExtensionWidget = function(this: InteractiveModeBase, key: string, content:\n | string[]\n | ((tui: TUI, thm: Theme) => Component & { dispose?(): void })\n | undefined, options?: ExtensionWidgetOptions): void {\n const placement = options?.placement ?? \"aboveEditor\";\n const removeExisting = (\n map: Map<string, Component & { dispose?(): void }>,\n ) => {\n const existing = map.get(key);\n if (existing?.dispose) existing.dispose();\n map.delete(key);\n };\n\n removeExisting(this.extensionWidgetsAbove);\n removeExisting(this.extensionWidgetsBelow);\n\n if (content === undefined) {\n this.renderWidgets();\n return;\n }\n\n let component: Component & { dispose?(): void };\n\n if (Array.isArray(content)) {\n // Wrap string array in a Container with Text components\n const container = new Container();\n for (const line of content.slice(0, InteractiveModeBase.MAX_WIDGET_LINES)) {\n container.addChild(new Text(line, 1, 0));\n }\n if (content.length > InteractiveModeBase.MAX_WIDGET_LINES) {\n container.addChild(\n new Text(theme.fg(\"muted\", \"... (widget truncated)\"), 1, 0),\n );\n }\n component = container;\n } else {\n // Factory function - create component\n component = content(this.ui, theme);\n }\n\n const targetMap =\n placement === \"belowEditor\"\n ? this.extensionWidgetsBelow\n : this.extensionWidgetsAbove;\n targetMap.set(key, component);\n this.renderWidgets();\n };\n\nInteractiveModeBase.prototype.clearExtensionWidgets = function(this: InteractiveModeBase): void {\n for (const widget of this.extensionWidgetsAbove.values()) {\n widget.dispose?.();\n }\n for (const widget of this.extensionWidgetsBelow.values()) {\n widget.dispose?.();\n }\n this.extensionWidgetsAbove.clear();\n this.extensionWidgetsBelow.clear();\n this.renderWidgets();\n };\n\nInteractiveModeBase.prototype.resetExtensionUI = function(this: InteractiveModeBase): void {\n if (this.extensionSelector) {\n this.hideExtensionSelector();\n }\n if (this.extensionInput) {\n this.hideExtensionInput();\n }\n if (this.extensionEditor) {\n this.hideExtensionEditor();\n }\n this.ui.hideOverlay();\n this.clearExtensionTerminalInputListeners();\n this.setExtensionFooter(undefined);\n this.setExtensionHeader(undefined);\n this.clearExtensionWidgets();\n this.footerDataProvider.clearExtensionStatuses();\n this.footer.invalidate();\n this.autocompleteProviderWrappers = [];\n this.setCustomEditorComponent(undefined);\n this.setupAutocompleteProvider();\n this.defaultEditor.onExtensionShortcut = undefined;\n this.updateTerminalTitle();\n this.workingMessage = undefined;\n this.workingVisible = true;\n this.setWorkingIndicator();\n if (this.loadingAnimation) {\n this.loadingAnimation.setMessage(\n `${this.defaultWorkingMessage} (${keyText(\"app.interrupt\")} Interrupt)`,\n );\n }\n this.setHiddenThinkingLabel();\n };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-input-handling.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-input-handling.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { pasteClipboardImageToEditor } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.setupKeyHandlers = function(this: InteractiveModeBase): void {\n // Set up handlers on defaultEditor - they use this.editor for text access\n // so they work correctly regardless of which editor is active\n this.defaultEditor.onEscape = () => {\n if (this.session.isStreaming) {\n this.restoreQueuedMessagesToEditor({ abort: true });\n } else if (this.session.isBashRunning) {\n this.session.abortBash();\n } else if (this.isBashMode) {\n this.editor.setText(\"\");\n this.isBashMode = false;\n this.updateEditorBorderColor();\n } else if (!this.editor.getText().trim()) {\n // Double-escape with empty editor triggers /tree, /fork, or nothing based on setting\n const action = this.settingsManager.getDoubleEscapeAction();\n if (action !== \"none\") {\n const now = Date.now();\n if (now - this.lastEscapeTime < 500) {\n if (action === \"tree\") {\n this.showTreeSelector();\n } else {\n this.showUserMessageSelector();\n }\n this.lastEscapeTime = 0;\n } else {\n this.lastEscapeTime = now;\n }\n }\n }\n };\n\n // Register app action handlers\n this.defaultEditor.onAction(\"app.clear\", () => this.handleCtrlC());\n this.defaultEditor.onCtrlD = () => this.handleCtrlD();\n this.defaultEditor.onAction(\"app.suspend\", () => this.handleCtrlZ());\n this.defaultEditor.onAction(\"app.thinking.cycle\", () =>\n this.cycleThinkingLevel(),\n );\n this.defaultEditor.onAction(\"app.model.cycleForward\", () =>\n this.cycleModel(\"forward\"),\n );\n this.defaultEditor.onAction(\"app.model.cycleBackward\", () =>\n this.cycleModel(\"backward\"),\n );\n\n // Global debug handler on TUI (works regardless of focus)\n this.ui.onDebug = () => this.handleDebugCommand();\n this.defaultEditor.onAction(\"app.model.select\", () =>\n this.showModelSelector(),\n );\n this.defaultEditor.onAction(\"app.tools.expand\", () =>\n this.toggleToolOutputExpansion(),\n );\n this.defaultEditor.onAction(\"app.thinking.toggle\", () =>\n this.toggleThinkingBlockVisibility(),\n );\n this.defaultEditor.onAction(\"app.editor.external\", () =>\n this.openExternalEditor(),\n );\n this.defaultEditor.onAction(\"app.message.followUp\", () =>\n this.handleFollowUp(),\n );\n this.defaultEditor.onAction(\"app.message.dequeue\", () =>\n this.handleDequeue(),\n );\n this.defaultEditor.onAction(\"app.session.new\", () =>\n this.handleClearCommand(),\n );\n this.defaultEditor.onAction(\"app.session.tree\", () =>\n this.showTreeSelector(),\n );\n this.defaultEditor.onAction(\"app.session.fork\", () =>\n this.showUserMessageSelector(),\n );\n this.defaultEditor.onAction(\"app.session.resume\", () =>\n this.showSessionSelector(),\n );\n\n this.defaultEditor.onChange = (text: string) => {\n const wasBashMode = this.isBashMode;\n this.isBashMode = text.trimStart().startsWith(\"!\");\n if (wasBashMode !== this.isBashMode) {\n this.updateEditorBorderColor();\n }\n };\n\n // Handle clipboard image paste (triggered on Ctrl+V)\n this.defaultEditor.onPasteImage = () => {\n this.handleClipboardImagePaste();\n };\n };\n\nInteractiveModeBase.prototype.handleClipboardImagePaste = async function(this: InteractiveModeBase): Promise<void> {\n await pasteClipboardImageToEditor(this.editor, () => this.ui.requestRender(), {\n showWarning: (message) => this.showWarning(message),\n });\n };\n\nInteractiveModeBase.prototype.setupEditorSubmitHandler = function(this: InteractiveModeBase): void {\n this.defaultEditor.onSubmit = async (text: string) => {\n text = text.trim();\n if (!text) return;\n\n // Handle commands\n if (text === \"/settings\") {\n this.showSettingsSelector();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/fast\") {\n this.editor.setText(\"\");\n this.showFastModeSelector();\n return;\n }\n if (text === \"/scoped-models\") {\n this.editor.setText(\"\");\n await this.showModelsSelector();\n return;\n }\n if (text === \"/model\" || text.startsWith(\"/model \")) {\n const searchTerm = text.startsWith(\"/model \")\n ? text.slice(7).trim()\n : undefined;\n this.editor.setText(\"\");\n await this.handleModelCommand(searchTerm);\n return;\n }\n if (text === \"/export\" || text.startsWith(\"/export \")) {\n await this.handleExportCommand(text);\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/import\" || text.startsWith(\"/import \")) {\n await this.handleImportCommand(text);\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/share\") {\n await this.handleShareCommand();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/copy\") {\n await this.handleCopyCommand();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/name\" || text.startsWith(\"/name \")) {\n this.handleNameCommand(text);\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/session\") {\n this.handleSessionCommand();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/changelog\") {\n this.handleChangelogCommand();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/atomic\" || text.startsWith(\"/atomic \")) {\n this.editor.setText(\"\");\n await this.session.prompt(text);\n return;\n }\n if (text === \"/hotkeys\") {\n this.handleHotkeysCommand();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/fork\") {\n this.showUserMessageSelector();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/clone\") {\n this.editor.setText(\"\");\n await this.handleCloneCommand();\n return;\n }\n if (text === \"/tree\") {\n this.showTreeSelector();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/trust\") {\n this.showTrustSelector();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/login\") {\n this.showOAuthSelector(\"login\");\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/logout\") {\n this.showOAuthSelector(\"logout\");\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/new\") {\n this.editor.setText(\"\");\n await this.handleClearCommand();\n return;\n }\n if (/^\\/compact(?:\\s|$)/.test(text)) {\n this.editor.setText(\"\");\n if (text !== \"/compact\") {\n this.showWarning(\"Usage: /compact\");\n return;\n }\n await this.handleCompactCommand();\n return;\n }\n if (text === \"/reload\") {\n this.editor.setText(\"\");\n await this.handleReloadCommand();\n return;\n }\n if (text === \"/debug\") {\n this.handleDebugCommand();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/arminsayshi\") {\n this.handleArminSaysHi();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/dementedelves\") {\n this.handleDementedDelves();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/resume\") {\n this.showSessionSelector();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/quit\" || text === \"/exit\") {\n this.editor.setText(\"\");\n await this.shutdown();\n return;\n }\n\n // Handle bash command (! for normal, !! for excluded from context)\n if (text.startsWith(\"!\")) {\n const isExcluded = text.startsWith(\"!!\");\n const command = isExcluded\n ? text.slice(2).trim()\n : text.slice(1).trim();\n if (command) {\n if (this.session.isBashRunning) {\n this.showWarning(\n \"A bash command is already running. esc cancel first.\",\n );\n this.editor.setText(text);\n return;\n }\n this.editor.addToHistory?.(text);\n await this.handleBashCommand(command, isExcluded);\n this.isBashMode = false;\n this.updateEditorBorderColor();\n return;\n }\n }\n\n // Queue input during compaction (extension commands execute immediately)\n if (this.session.isCompacting) {\n if (this.isExtensionCommand(text)) {\n this.editor.addToHistory?.(text);\n this.editor.setText(\"\");\n await this.session.prompt(text);\n } else {\n this.queueCompactionMessage(text, \"steer\");\n }\n return;\n }\n\n // If streaming, use prompt() with steer behavior\n // This handles extension commands (execute immediately), prompt template expansion, and queueing\n if (this.session.isStreaming) {\n this.editor.addToHistory?.(text);\n this.editor.setText(\"\");\n await this.session.prompt(text, { streamingBehavior: \"steer\" });\n this.updatePendingMessagesDisplay();\n this.ui.requestRender();\n return;\n }\n\n // Normal message submission\n // First, move any pending bash components to chat\n this.flushPendingBashComponents();\n\n if (this.onInputCallback) {\n this.onInputCallback(text);\n } else {\n this.pendingUserInputs.push(text);\n }\n this.editor.addToHistory?.(text);\n };\n };\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-input-handling.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-input-handling.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase, seedStartupInput } from \"./interactive-mode-base.ts\";\nimport { pasteClipboardImageToEditor } from \"./interactive-mode-deps.ts\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\n\nInteractiveModeBase.prototype.runUserPromptTurn = async function(this: InteractiveModeBase, userInput: string): Promise<void> {\n // Show the working spinner immediately on submit so there is no visible gap\n // while prompt preflight runs before the agent emits `agent_start`.\n this.showWorkingLoaderNow();\n if (this.deferredStartupPending) {\n this.deferLoadedResourcesDisclosureUntilAgentEnd = true;\n }\n // Yield once so the freshly-mounted spinner paints before synchronous\n // preflight work can block the event loop.\n await yieldToEventLoop();\n try {\n await this.ensureDeferredStartupComplete();\n await this.session.prompt(userInput);\n this.deferLoadedResourcesDisclosureUntilAgentEnd = false;\n if (this.pendingLoadedResourcesDisclosure) {\n this.pendingLoadedResourcesDisclosure = false;\n this.showLoadedResources({ force: true, showDiagnosticsWhenQuiet: true, targetContainer: this.startupNoticesContainer });\n void this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, this.startupNoticesContainer);\n }\n } catch (error: unknown) {\n this.deferLoadedResourcesDisclosureUntilAgentEnd = false;\n this.discardDeferredRenderedUserInput(userInput);\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n } finally {\n // A submission that resolves without starting an agent turn (e.g. an\n // extension slash-command) never emits `agent_end`, so clear the\n // pre-shown spinner here when idle to avoid a lingering indicator.\n if (!this.session.isStreaming) {\n this.stopWorkingLoader();\n }\n }\n };\n\nInteractiveModeBase.prototype.setupKeyHandlers = function(this: InteractiveModeBase): void {\n this.ui.addInputListener((data) => {\n if (!this.keybindings.matches(data, \"app.clear\")) return undefined;\n if (this.ui.hasOverlay()) return undefined;\n this.handleCtrlC();\n this.ui.requestRender();\n return { consume: true };\n });\n\n // Set up handlers on defaultEditor - they use this.editor for text access\n // so they work correctly regardless of which editor is active\n this.defaultEditor.onEscape = () => {\n if (this.session.isStreaming) {\n this.restoreQueuedMessagesToEditor({ abort: true });\n } else if (this.session.isBashRunning) {\n this.session.abortBash();\n } else if (this.isBashMode) {\n this.editor.setText(\"\");\n this.isBashMode = false;\n this.updateEditorBorderColor();\n } else if (!this.editor.getText().trim()) {\n // Double-escape with empty editor triggers /tree, /fork, or nothing based on setting\n const action = this.settingsManager.getDoubleEscapeAction();\n if (action !== \"none\") {\n const now = Date.now();\n if (now - this.lastEscapeTime < 500) {\n if (action === \"tree\") {\n this.showTreeSelector();\n } else {\n this.showUserMessageSelector();\n }\n this.lastEscapeTime = 0;\n } else {\n this.lastEscapeTime = now;\n }\n }\n }\n };\n\n // Register app action handlers\n this.defaultEditor.onAction(\"app.clear\", () => this.handleCtrlC());\n this.defaultEditor.onCtrlD = () => this.handleCtrlD();\n this.defaultEditor.onAction(\"app.suspend\", () => this.handleCtrlZ());\n this.defaultEditor.onAction(\"app.thinking.cycle\", () =>\n this.cycleThinkingLevel(),\n );\n this.defaultEditor.onAction(\"app.model.cycleForward\", () =>\n this.cycleModel(\"forward\"),\n );\n this.defaultEditor.onAction(\"app.model.cycleBackward\", () =>\n this.cycleModel(\"backward\"),\n );\n\n // Global debug handler on TUI (works regardless of focus)\n this.ui.onDebug = () => this.handleDebugCommand();\n this.defaultEditor.onAction(\"app.model.select\", () =>\n this.showModelSelector(),\n );\n this.defaultEditor.onAction(\"app.tools.expand\", () =>\n this.toggleToolOutputExpansion(),\n );\n this.defaultEditor.onAction(\"app.thinking.toggle\", () =>\n this.toggleThinkingBlockVisibility(),\n );\n this.defaultEditor.onAction(\"app.editor.external\", () =>\n this.openExternalEditor(),\n );\n this.defaultEditor.onAction(\"app.message.followUp\", () =>\n this.handleFollowUp(),\n );\n this.defaultEditor.onAction(\"app.message.dequeue\", () =>\n this.handleDequeue(),\n );\n this.defaultEditor.onAction(\"app.session.new\", () =>\n this.handleClearCommand(),\n );\n this.defaultEditor.onAction(\"app.session.tree\", () =>\n this.showTreeSelector(),\n );\n this.defaultEditor.onAction(\"app.session.fork\", () =>\n this.showUserMessageSelector(),\n );\n this.defaultEditor.onAction(\"app.session.resume\", () =>\n this.showSessionSelector(),\n );\n\n this.defaultEditor.onChange = (text: string) => {\n const wasBashMode = this.isBashMode;\n this.isBashMode = text.trimStart().startsWith(\"!\");\n if (wasBashMode !== this.isBashMode) {\n this.updateEditorBorderColor();\n }\n };\n\n // Handle clipboard image paste (triggered on Ctrl+V)\n this.defaultEditor.onPasteImage = () => {\n this.handleClipboardImagePaste();\n };\n };\n\nInteractiveModeBase.prototype.handleClipboardImagePaste = async function(this: InteractiveModeBase): Promise<void> {\n await pasteClipboardImageToEditor(this.editor, () => this.ui.requestRender(), {\n showWarning: (message) => this.showWarning(message),\n });\n };\n\nInteractiveModeBase.prototype.deliverStartupReplayPrompt = function(this: InteractiveModeBase, text: string): void {\n if (this.onInputCallback) {\n if (!text.startsWith(\"/\")) {\n this.renderDeferredUserInput(text);\n }\n const callback = this.onInputCallback;\n this.onInputCallback = undefined;\n callback(text);\n } else {\n this.pendingUserInputs.push(text);\n }\n };\n\nInteractiveModeBase.prototype.recoverCookedStartupInput = function(this: InteractiveModeBase): boolean {\n if (this.startupCookedInputRecovered || this.pendingUserInputs.length > 0) return true;\n const text = this.editor.getText();\n const cookedLines = text.split(/\\r?\\n/).map((line) => line.trim()).filter(Boolean);\n const isCommandLike = (line: string | undefined) =>\n line !== undefined && (line.startsWith(\"/\") || line.startsWith(\"!\"));\n const singleCommandLike = cookedLines.length === 1 && isCommandLike(cookedLines[0]);\n if (cookedLines.length < 2 && !singleCommandLike) return false;\n\n this.startupCookedInputRecovered = true;\n const activeInput = this.startupReplayActiveInput?.trim();\n let draftText = \"\";\n let submissions = cookedLines;\n if (\n activeInput === undefined &&\n cookedLines.length > 1 &&\n !isCommandLike(cookedLines[cookedLines.length - 1]) &&\n (!isCommandLike(cookedLines[0]) || cookedLines.length > 2)\n ) {\n draftText = cookedLines[cookedLines.length - 1] ?? \"\";\n submissions = cookedLines.slice(0, -1);\n } else if (activeInput && cookedLines.length > 1 && !isCommandLike(cookedLines[cookedLines.length - 1])) {\n draftText = cookedLines[cookedLines.length - 1] ?? \"\";\n submissions = cookedLines.slice(0, -1);\n }\n if (submissions.length === 0) return true;\n\n if (activeInput) {\n const queuedSubmissions =\n submissions[0] === activeInput ? submissions.slice(1) : submissions;\n this.editor.setText(draftText);\n this.startupReplayInputs.push(...queuedSubmissions);\n return true;\n }\n\n this.editor.setText(\"\");\n seedStartupInput(this.pendingUserInputs, this.editor, { text: draftText, submissions }, this.startupReplayInputs, (draft) => {\n this.startupDraftText = draft;\n }, (active) => {\n this.startupReplayActiveInput = active;\n });\n return true;\n };\n\nInteractiveModeBase.prototype.drainStartupReplayCommands = async function(this: InteractiveModeBase): Promise<void> {\n while (this.pendingUserInputs.length === 0 && this.startupReplayActiveInput) {\n const activeInput = this.startupReplayActiveInput;\n await this.defaultEditor.onSubmit?.(activeInput);\n if (this.editor.getText().trim() === activeInput.trim()) {\n this.editor.setText(\"\");\n }\n if (this.startupReplayActiveInput?.trim() === activeInput.trim()) break;\n }\n };\n\nInteractiveModeBase.prototype.advanceStartupInputReplay = function(this: InteractiveModeBase, submittedText: string): void {\n if (this.startupReplayActiveInput?.trim() !== submittedText.trim()) return;\n this.startupReplayActiveInput = undefined;\n\n while (this.startupReplayInputs.length > 0) {\n const nextInput = this.startupReplayInputs.shift();\n if (nextInput === undefined) break;\n const trimmed = nextInput.trimStart();\n if (trimmed.startsWith(\"/\") || trimmed.startsWith(\"!\")) {\n this.startupReplayActiveInput = nextInput.trim();\n this.editor.setText(this.startupReplayActiveInput);\n this.ui.requestRender();\n return;\n }\n this.deliverStartupReplayPrompt(nextInput);\n }\n\n if (this.startupDraftText !== undefined) {\n this.editor.setText(this.startupDraftText);\n this.startupDraftText = undefined;\n this.ui.requestRender();\n }\n };\n\nInteractiveModeBase.prototype.setupEditorSubmitHandler = function(this: InteractiveModeBase): void {\n this.defaultEditor.onSubmit = async (text: string) => {\n text = text.trim();\n if (!text) return;\n\n if (this.startupReplayActiveInput && this.startupReplayActiveInput.trim() !== text.trim()) {\n this.startupReplayInputs.push(text);\n this.editor.addToHistory?.(text);\n this.editor.setText(\"\");\n return;\n }\n try {\n\n // Handle commands\n if (text === \"/settings\") {\n this.showSettingsSelector();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/fast\") {\n this.editor.setText(\"\");\n this.showFastModeSelector();\n return;\n }\n if (text === \"/scoped-models\") {\n this.editor.setText(\"\");\n await this.showModelsSelector();\n return;\n }\n if (text === \"/model\" || text.startsWith(\"/model \")) {\n const searchTerm = text.startsWith(\"/model \")\n ? text.slice(7).trim()\n : undefined;\n this.editor.setText(\"\");\n await this.handleModelCommand(searchTerm);\n return;\n }\n if (text === \"/export\" || text.startsWith(\"/export \")) {\n await this.handleExportCommand(text);\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/import\" || text.startsWith(\"/import \")) {\n await this.handleImportCommand(text);\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/share\") {\n await this.handleShareCommand();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/copy\") {\n await this.handleCopyCommand();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/name\" || text.startsWith(\"/name \")) {\n this.handleNameCommand(text);\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/session\") {\n this.handleSessionCommand();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/changelog\") {\n this.handleChangelogCommand();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/atomic\" || text.startsWith(\"/atomic \")) {\n this.editor.setText(\"\");\n await this.session.prompt(text);\n return;\n }\n if (text === \"/hotkeys\") {\n this.handleHotkeysCommand();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/fork\") {\n this.showUserMessageSelector();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/clone\") {\n this.editor.setText(\"\");\n await this.handleCloneCommand();\n return;\n }\n if (text === \"/tree\") {\n this.showTreeSelector();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/trust\") {\n this.showTrustSelector();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/login\") {\n this.showOAuthSelector(\"login\");\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/logout\") {\n this.showOAuthSelector(\"logout\");\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/new\") {\n this.editor.setText(\"\");\n await this.handleClearCommand();\n return;\n }\n if (/^\\/compact(?:\\s|$)/.test(text)) {\n this.editor.setText(\"\");\n if (text !== \"/compact\") {\n this.showWarning(\"Usage: /compact\");\n return;\n }\n await this.handleCompactCommand();\n return;\n }\n if (text === \"/reload\") {\n this.editor.setText(\"\");\n await this.handleReloadCommand();\n return;\n }\n if (text === \"/debug\") {\n this.handleDebugCommand();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/arminsayshi\") {\n this.handleArminSaysHi();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/dementedelves\") {\n this.handleDementedDelves();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/resume\") {\n this.showSessionSelector();\n this.editor.setText(\"\");\n return;\n }\n if (text === \"/quit\" || text === \"/exit\") {\n this.editor.setText(\"\");\n await this.shutdown();\n return;\n }\n\n // Handle bash command (! for normal, !! for excluded from context)\n if (text.startsWith(\"!\")) {\n const isExcluded = text.startsWith(\"!!\");\n const command = isExcluded\n ? text.slice(2).trim()\n : text.slice(1).trim();\n if (command) {\n if (this.session.isBashRunning) {\n this.showWarning(\n \"A bash command is already running. esc cancel first.\",\n );\n this.editor.setText(text);\n return;\n }\n this.editor.addToHistory?.(text);\n await this.handleBashCommand(command, isExcluded);\n this.isBashMode = false;\n this.updateEditorBorderColor();\n return;\n }\n }\n\n // Queue input during compaction (extension commands execute immediately)\n if (this.session.isCompacting) {\n if (this.isExtensionCommand(text)) {\n this.editor.addToHistory?.(text);\n this.editor.setText(\"\");\n await this.session.prompt(text);\n } else {\n this.queueCompactionMessage(text, \"steer\");\n }\n return;\n }\n\n // If streaming, use prompt() with steer behavior\n // This handles extension commands (execute immediately), prompt template expansion, and queueing\n if (this.session.isStreaming) {\n this.editor.addToHistory?.(text);\n this.editor.setText(\"\");\n await this.session.prompt(text, { streamingBehavior: \"steer\" });\n this.updatePendingMessagesDisplay();\n this.ui.requestRender();\n return;\n }\n\n // Normal message submission\n // First, move any pending bash components to chat\n this.flushPendingBashComponents();\n\n if (this.onInputCallback) {\n if (!text.startsWith(\"/\")) {\n this.renderDeferredUserInput(text);\n }\n this.onInputCallback(text);\n } else {\n this.pendingUserInputs.push(text);\n }\n this.editor.addToHistory?.(text);\n } finally {\n this.advanceStartupInputReplay?.(text);\n }\n };\n };\n"]}
|