@bastani/atomic 0.9.16-alpha.9 → 0.9.16
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 +120 -0
- package/README.md +4 -4
- package/dist/builtin/intercom/CHANGELOG.md +42 -0
- package/dist/builtin/intercom/README.md +18 -17
- package/dist/builtin/intercom/broker/broker.ts +43 -18
- package/dist/builtin/intercom/broker/client.ts +138 -7
- package/dist/builtin/intercom/broker/group-isolation.ts +3 -3
- package/dist/builtin/intercom/broker/group-membership.ts +55 -0
- package/dist/builtin/intercom/broker/presence-handler.ts +62 -50
- package/dist/builtin/intercom/broker/send-handler.ts +2 -3
- package/dist/builtin/intercom/group.ts +40 -0
- package/dist/builtin/intercom/index.bundle.mjs +490 -183
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/intercom/skills/intercom/SKILL.md +16 -10
- package/dist/builtin/intercom/types.ts +24 -2
- package/dist/builtin/mcp/index.bundle.mjs +202 -52
- package/dist/builtin/mcp/package.json +2 -2
- package/dist/builtin/subagents/CHANGELOG.md +51 -0
- package/dist/builtin/subagents/README.md +3 -3
- package/dist/builtin/subagents/agents/code-simplifier.md +1 -1
- package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-locator.md +1 -1
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +1 -1
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-locator.md +1 -1
- package/dist/builtin/subagents/agents/debugger.md +1 -1
- package/dist/builtin/subagents/agents/worker.md +1 -1
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +422 -140
- package/dist/builtin/web-access/index.bundle.mjs +202 -52
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +70 -0
- package/dist/builtin/workflows/README.md +2 -2
- package/dist/builtin/workflows/builtin/{chunk-h5e65g7g.js → chunk-3y1hmzw6.js} +36 -6
- package/dist/builtin/workflows/builtin/{chunk-nqr34qp3.js → chunk-6rbajjf5.js} +7 -1
- package/dist/builtin/workflows/builtin/{chunk-qe6bfpbd.js → chunk-bz1c9732.js} +15 -3
- package/dist/builtin/workflows/builtin/{chunk-8v8wmb7z.js → chunk-dattsgxg.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-17zk6ffd.js → chunk-gdx0avpx.js} +355 -67
- package/dist/builtin/workflows/builtin/{chunk-rbnj9621.js → chunk-w9c7rkrk.js} +1 -1
- package/dist/builtin/workflows/builtin/goal.js +3 -3
- package/dist/builtin/workflows/builtin/index.js +5 -5
- package/dist/builtin/workflows/builtin/open-claude-design.js +2 -2
- package/dist/builtin/workflows/builtin/ralph.js +3 -3
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +531 -143
- package/dist/builtin/workflows/src/index.js +212 -72
- package/dist/cli/args.js +6 -6
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +2 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/session-picker.d.ts +2 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +3 -2
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +2 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +1 -0
- 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-post-tool-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.js +3 -6
- package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +3 -1
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +6 -3
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +7 -5
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +37 -23
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +9 -2
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/builtin-packages.d.ts +4 -0
- package/dist/core/builtin-packages.d.ts.map +1 -1
- package/dist/core/builtin-packages.js +22 -1
- package/dist/core/builtin-packages.js.map +1 -1
- package/dist/core/callback-activity.d.ts.map +1 -1
- package/dist/core/callback-activity.js +6 -3
- package/dist/core/callback-activity.js.map +1 -1
- package/dist/core/extensions/loader-core.d.ts +1 -0
- package/dist/core/extensions/loader-core.d.ts.map +1 -1
- package/dist/core/extensions/loader-core.js +11 -1
- package/dist/core/extensions/loader-core.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner-registries.d.ts.map +1 -1
- package/dist/core/extensions/runner-registries.js +9 -4
- package/dist/core/extensions/runner-registries.js.map +1 -1
- package/dist/core/extensions/runner-shortcuts.d.ts.map +1 -1
- package/dist/core/extensions/runner-shortcuts.js +1 -0
- package/dist/core/extensions/runner-shortcuts.js.map +1 -1
- package/dist/core/keybindings.d.ts +5 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +4 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mandatory-resource-loader.d.ts +6 -0
- package/dist/core/mandatory-resource-loader.d.ts.map +1 -0
- package/dist/core/mandatory-resource-loader.js +94 -0
- package/dist/core/mandatory-resource-loader.js.map +1 -0
- package/dist/core/mandatory-runtime-tools.d.ts +10 -0
- package/dist/core/mandatory-runtime-tools.d.ts.map +1 -0
- package/dist/core/mandatory-runtime-tools.js +31 -0
- package/dist/core/mandatory-runtime-tools.js.map +1 -0
- package/dist/core/model-resolver-defaults.js +1 -1
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +24 -13
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +2 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager-ui-accessors.d.ts +4 -1
- package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-ui-accessors.js +22 -0
- package/dist/core/settings-manager-ui-accessors.js.map +1 -1
- package/dist/core/settings-types.d.ts +4 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +3 -2
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +6 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/fast-mode-selector.js +2 -2
- package/dist/modes/interactive/components/fast-mode-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.js +3 -0
- package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.js +7 -0
- package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +2 -1
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +1 -0
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +3 -0
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +15 -1
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +6 -1
- 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-selectors.js +6 -1
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +3 -0
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +7 -12
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-tui.d.ts +1 -0
- package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-tui.js +16 -0
- package/dist/modes/interactive/interactive-tui.js.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +2 -0
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/docs/compaction.md +1 -1
- package/docs/environment-variables.md +2 -0
- package/docs/extensions.md +1 -1
- package/docs/intercom.md +29 -24
- package/docs/keybindings.md +5 -2
- package/docs/packages.md +1 -1
- package/docs/providers.md +2 -2
- package/docs/sdk.md +9 -7
- package/docs/settings.md +9 -3
- package/docs/subagents.md +2 -2
- package/docs/usage.md +7 -6
- package/docs/workflows.md +11 -7
- package/npm-shrinkwrap.json +59 -77
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-session-runtime.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAqB,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEtG,mBAAmB,CAAC,SAAS,CAAC,4BAA4B,GAAG,KAAK;IACjE,MAAM,SAAS,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAClD,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QACjC,SAAS;QACT,IAAI,EAAE,KAAK;QACX,qBAAqB,EAAE;YACtB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE;YACnD,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC7B,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBAC3B,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;oBAC7B,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;gBACnC,CAAC;gBACD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;gBAC7B,IAAI,CAAC;oBACJ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;oBAC1D,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;wBACvB,IAAI,CAAC,yBAAyB,EAAE,CAAC;wBACjC,IAAI,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K,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,IAAI,CAAC,SAAS,CAAC,GAAG,MAAM,KAAK,OAAO,EAAE,CAAC,CAAC;IACxC,gBAAgB,EAAE,CAAC;IACnB,yEAAyE;IACzE,2EAA2E;IAC3E,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,yBAAyB,GAAG;IACzD,IAAI,CAAC,2BAA2B,EAAE,CAAC;IACnC,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC;IACtC,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAClC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;IAChC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC3B,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;IACtC,IAAI,CAAC,wBAAwB,GAAG,EAAE,CAAC;IACnC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACpC,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAClC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC1B,IAAI,CAAC,qBAAqB,EAAE,CAAC;AAC9B,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,2BAA2B,GAAG,UAE3D,QAAgB;IAEhB,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACjD,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentSession, setRegisteredThemes, stopThemeWatcher } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.bindCurrentSessionExtensions = async function (this: InteractiveModeBase): Promise<void> {\n\tconst uiContext = this.createExtensionUIContext();\n\tawait this.session.bindExtensions({\n\t\tuiContext,\n\t\tmode: \"tui\",\n\t\tcommandContextActions: {\n\t\t\twaitForIdle: () => this.session.agent.waitForIdle(),\n\t\t\tnewSession: async (options) => {\n\t\t\t\tif (this.loadingAnimation) {\n\t\t\t\t\tthis.loadingAnimation.stop();\n\t\t\t\t\tthis.loadingAnimation = undefined;\n\t\t\t\t}\n\t\t\t\tthis.statusContainer.clear();\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await this.runtimeHost.newSession(options);\n\t\t\t\t\tif (!result.cancelled) {\n\t\t\t\t\t\tthis.renderCurrentSessionState();\n\t\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t\t}\n\t\t\t\t\treturn result;\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\treturn this.handleFatalRuntimeError(\"Failed to create session\", error);\n\t\t\t\t}\n\t\t\t},\n\t\t\tfork: async (entryId, options) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await this.runtimeHost.fork(entryId, options);\n\t\t\t\t\tif (!result.cancelled) {\n\t\t\t\t\t\tthis.renderCurrentSessionState();\n\t\t\t\t\t\tthis.editor.setText(result.selectedText ?? \"\");\n\t\t\t\t\t\tthis.showStatus(\"Forked to new session\");\n\t\t\t\t\t}\n\t\t\t\t\treturn { cancelled: result.cancelled };\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\treturn this.handleFatalRuntimeError(\"Failed to fork session\", error);\n\t\t\t\t}\n\t\t\t},\n\t\t\tnavigateTree: async (targetId, options) => {\n\t\t\t\tconst result = await this.session.navigateTree(targetId, {\n\t\t\t\t\tsummarize: options?.summarize,\n\t\t\t\t\tcustomInstructions: options?.customInstructions,\n\t\t\t\t\treplaceInstructions: options?.replaceInstructions,\n\t\t\t\t\tlabel: options?.label,\n\t\t\t\t});\n\t\t\t\tif (result.cancelled) {\n\t\t\t\t\treturn { cancelled: true };\n\t\t\t\t}\n\n\t\t\t\tthis.chatContainer.clear();\n\t\t\t\tthis.renderInitialMessages();\n\t\t\t\tif (result.editorText && !this.editor.getText().trim()) {\n\t\t\t\t\tthis.editor.setText(result.editorText);\n\t\t\t\t}\n\t\t\t\tthis.showStatus(\"Navigated to selected point\");\n\t\t\t\tvoid this.flushCompactionQueue({ willRetry: false });\n\t\t\t\treturn { cancelled: false };\n\t\t\t},\n\t\t\tswitchSession: async (sessionPath, options) => {\n\t\t\t\treturn this.handleResumeSession(sessionPath, options);\n\t\t\t},\n\t\t\treload: async () => {\n\t\t\t\tawait this.handleReloadCommand();\n\t\t\t},\n\t\t},\n\t\tshutdownHandler: () => {\n\t\t\tthis.shutdownRequested = true;\n\t\t\tif (!this.session.isStreaming) {\n\t\t\t\tvoid this.shutdown();\n\t\t\t}\n\t\t},\n\t\tonError: (error) => {\n\t\t\tthis.showExtensionError(error.extensionPath, error.error, error.stack);\n\t\t},\n\t});\n\n\tsetRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n\tthis.setupAutocompleteProvider();\n\n\tconst extensionRunner = this.session.extensionRunner;\n\tthis.setupExtensionShortcuts(extensionRunner);\n\tif (!this.deferredStartupPending && !this.initialStartupBinding) {\n\t\tthis.showLoadedResources({ force: true, showDiagnosticsWhenQuiet: true });\n\t\tthis.showStartupNoticesIfNeeded();\n\t}\n};\n\nInteractiveModeBase.prototype.applyRuntimeSettings = function (this: InteractiveModeBase): void {\n\tthis.transcriptScrollView?.setScrollbar(this.settingsManager.getFullscreenScrollbar());\n\tthis.footer.setSession(this.session);\n\tthis.usageMeter.setSession(this.session);\n\tthis.usageMeter.setAutoCompactEnabled(this.session.autoCompactionEnabled);\n\tthis.footerDataProvider.setCwd(this.sessionManager.getCwd());\n\tthis.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();\n\tthis.outputPad = this.settingsManager.getOutputPad();\n\tthis.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());\n\tthis.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());\n\tconst editorPaddingX = this.settingsManager.getEditorPaddingX();\n\tconst autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();\n\tthis.defaultEditor.setPaddingX(editorPaddingX);\n\tthis.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);\n\tif (this.editor !== this.defaultEditor) {\n\t\tthis.editor.setPaddingX?.(editorPaddingX);\n\t\tthis.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);\n\t}\n};\n\nInteractiveModeBase.prototype.rebindCurrentSession = async function (this: InteractiveModeBase): Promise<void> {\n\t// The session this rebind was started for. Binding extensions is async, and a\n\t// session replacement (startup switch, /new, resume) can install a different\n\t// session and start its own rebind while this one is still awaiting. Without\n\t// the guard below both rebinds call subscribeToAgent() and every agent event\n\t// is rendered twice.\n\tconst session = this.session;\n\n\tthis.unsubscribe?.();\n\tthis.unsubscribe = undefined;\n\tthis.applyRuntimeSettings();\n\tawait this.bindCurrentSessionExtensions();\n\n\tif (this.session !== session) {\n\t\t// A newer rebind owns the current session; it subscribes and finishes the\n\t\t// remaining runtime updates itself.\n\t\treturn;\n\t}\n\n\tthis.subscribeToAgent();\n\tawait this.updateAvailableProviderCount();\n\tthis.updateEditorBorderColor();\n\tthis.updateTerminalTitle();\n};\n\nInteractiveModeBase.prototype.handleFatalRuntimeError = async function (\n\tthis: InteractiveModeBase,\n\tprefix: string,\n\terror: unknown,\n): Promise<never> {\n\tconst message = error instanceof Error ? error.message : String(error);\n\tthis.showError(`${prefix}: ${message}`);\n\tstopThemeWatcher();\n\t// A fatal exit keeps the transcript visible: the error the user just saw\n\t// must remain on screen after the process dies, whatever the setting says.\n\tthis.stop(\"transcript\");\n\tprocess.exit(1);\n};\n\nInteractiveModeBase.prototype.renderCurrentSessionState = function (this: InteractiveModeBase): void {\n\tthis.managedToolStatusGeneration++;\n\tthis.managedToolStatusStarted = false;\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tthis.chatContainer.clear();\n\tthis.pendingMessagesContainer.clear();\n\tthis.compactionQueuedMessages = [];\n\tthis.streamingComponent = undefined;\n\tthis.streamingMessage = undefined;\n\tthis.pendingTools.clear();\n\tthis.renderInitialMessages();\n};\n\nInteractiveModeBase.prototype.getRegisteredToolDefinition = function (\n\tthis: InteractiveModeBase,\n\ttoolName: string,\n): ReturnType<AgentSession[\"getToolDefinition\"]> {\n\treturn this.session.getToolDefinition(toolName);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-session-runtime.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAqB,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEtG,mBAAmB,CAAC,SAAS,CAAC,4BAA4B,GAAG,KAAK;IACjE,MAAM,SAAS,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAClD,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QACjC,SAAS;QACT,IAAI,EAAE,KAAK;QACX,qBAAqB,EAAE;YACtB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE;YACnD,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC7B,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBAC3B,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;oBAC7B,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;gBACnC,CAAC;gBACD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;gBAC7B,IAAI,CAAC;oBACJ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;oBAC1D,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;wBACvB,IAAI,C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ourcesContent":["import { setCapabilityOverrides } from \"@earendil-works/pi-tui\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentSession, setRegisteredThemes, stopThemeWatcher } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.bindCurrentSessionExtensions = async function (this: InteractiveModeBase): Promise<void> {\n\tconst uiContext = this.createExtensionUIContext();\n\tawait this.session.bindExtensions({\n\t\tuiContext,\n\t\tmode: \"tui\",\n\t\tcommandContextActions: {\n\t\t\twaitForIdle: () => this.session.agent.waitForIdle(),\n\t\t\tnewSession: async (options) => {\n\t\t\t\tif (this.loadingAnimation) {\n\t\t\t\t\tthis.loadingAnimation.stop();\n\t\t\t\t\tthis.loadingAnimation = undefined;\n\t\t\t\t}\n\t\t\t\tthis.statusContainer.clear();\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await this.runtimeHost.newSession(options);\n\t\t\t\t\tif (!result.cancelled) {\n\t\t\t\t\t\tthis.renderCurrentSessionState();\n\t\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t\t}\n\t\t\t\t\treturn result;\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\treturn this.handleFatalRuntimeError(\"Failed to create session\", error);\n\t\t\t\t}\n\t\t\t},\n\t\t\tfork: async (entryId, options) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await this.runtimeHost.fork(entryId, options);\n\t\t\t\t\tif (!result.cancelled) {\n\t\t\t\t\t\tthis.renderCurrentSessionState();\n\t\t\t\t\t\tthis.editor.setText(result.selectedText ?? \"\");\n\t\t\t\t\t\tthis.showStatus(\"Forked to new session\");\n\t\t\t\t\t}\n\t\t\t\t\treturn { cancelled: result.cancelled };\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\treturn this.handleFatalRuntimeError(\"Failed to fork session\", error);\n\t\t\t\t}\n\t\t\t},\n\t\t\tnavigateTree: async (targetId, options) => {\n\t\t\t\tconst result = await this.session.navigateTree(targetId, {\n\t\t\t\t\tsummarize: options?.summarize,\n\t\t\t\t\tcustomInstructions: options?.customInstructions,\n\t\t\t\t\treplaceInstructions: options?.replaceInstructions,\n\t\t\t\t\tlabel: options?.label,\n\t\t\t\t});\n\t\t\t\tif (result.cancelled) {\n\t\t\t\t\treturn { cancelled: true };\n\t\t\t\t}\n\n\t\t\t\tthis.chatContainer.clear();\n\t\t\t\tthis.renderInitialMessages();\n\t\t\t\tif (result.editorText && !this.editor.getText().trim()) {\n\t\t\t\t\tthis.editor.setText(result.editorText);\n\t\t\t\t}\n\t\t\t\tthis.showStatus(\"Navigated to selected point\");\n\t\t\t\tvoid this.flushCompactionQueue({ willRetry: false });\n\t\t\t\treturn { cancelled: false };\n\t\t\t},\n\t\t\tswitchSession: async (sessionPath, options) => {\n\t\t\t\treturn this.handleResumeSession(sessionPath, options);\n\t\t\t},\n\t\t\treload: async () => {\n\t\t\t\tawait this.handleReloadCommand();\n\t\t\t},\n\t\t},\n\t\tshutdownHandler: () => {\n\t\t\tthis.shutdownRequested = true;\n\t\t\tif (!this.session.isStreaming) {\n\t\t\t\tvoid this.shutdown();\n\t\t\t}\n\t\t},\n\t\tonError: (error) => {\n\t\t\tthis.showExtensionError(error.extensionPath, error.error, error.stack);\n\t\t},\n\t});\n\n\tsetRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n\tthis.setupAutocompleteProvider();\n\n\tconst extensionRunner = this.session.extensionRunner;\n\tthis.setupExtensionShortcuts(extensionRunner);\n\tif (!this.deferredStartupPending && !this.initialStartupBinding) {\n\t\tthis.showLoadedResources({ force: true, showDiagnosticsWhenQuiet: true });\n\t\tthis.showStartupNoticesIfNeeded();\n\t}\n};\n\nInteractiveModeBase.prototype.applyRuntimeSettings = function (this: InteractiveModeBase): void {\n\tsetCapabilityOverrides(this.settingsManager.getTerminalCapabilityOverrides());\n\tthis.setFullscreenCopyOnSelect(this.settingsManager.getFullscreenCopyOnSelect());\n\tthis.transcriptScrollView?.setScrollbar(this.settingsManager.getFullscreenScrollbar());\n\tthis.footer.setSession(this.session);\n\tthis.usageMeter.setSession(this.session);\n\tthis.usageMeter.setAutoCompactEnabled(this.session.autoCompactionEnabled);\n\tthis.footerDataProvider.setCwd(this.sessionManager.getCwd());\n\tthis.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();\n\tthis.outputPad = this.settingsManager.getOutputPad();\n\tthis.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());\n\tthis.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());\n\tconst editorPaddingX = this.settingsManager.getEditorPaddingX();\n\tconst autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();\n\tthis.defaultEditor.setPaddingX(editorPaddingX);\n\tthis.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);\n\tif (this.editor !== this.defaultEditor) {\n\t\tthis.editor.setPaddingX?.(editorPaddingX);\n\t\tthis.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);\n\t}\n};\n\nInteractiveModeBase.prototype.rebindCurrentSession = async function (this: InteractiveModeBase): Promise<void> {\n\t// The session this rebind was started for. Binding extensions is async, and a\n\t// session replacement (startup switch, /new, resume) can install a different\n\t// session and start its own rebind while this one is still awaiting. Without\n\t// the guard below both rebinds call subscribeToAgent() and every agent event\n\t// is rendered twice.\n\tconst session = this.session;\n\n\tthis.unsubscribe?.();\n\tthis.unsubscribe = undefined;\n\tthis.applyRuntimeSettings();\n\tawait this.bindCurrentSessionExtensions();\n\n\tif (this.session !== session) {\n\t\t// A newer rebind owns the current session; it subscribes and finishes the\n\t\t// remaining runtime updates itself.\n\t\treturn;\n\t}\n\n\tthis.subscribeToAgent();\n\tawait this.updateAvailableProviderCount();\n\tthis.updateEditorBorderColor();\n\tthis.updateTerminalTitle();\n};\n\nInteractiveModeBase.prototype.handleFatalRuntimeError = async function (\n\tthis: InteractiveModeBase,\n\tprefix: string,\n\terror: unknown,\n): Promise<never> {\n\tconst message = error instanceof Error ? error.message : String(error);\n\tthis.showError(`${prefix}: ${message}`);\n\tstopThemeWatcher();\n\t// A fatal exit keeps the transcript visible: the error the user just saw\n\t// must remain on screen after the process dies, whatever the setting says.\n\tthis.stop(\"transcript\");\n\tprocess.exit(1);\n};\n\nInteractiveModeBase.prototype.renderCurrentSessionState = function (this: InteractiveModeBase): void {\n\tthis.managedToolStatusGeneration++;\n\tthis.managedToolStatusStarted = false;\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tthis.chatContainer.clear();\n\tthis.pendingMessagesContainer.clear();\n\tthis.compactionQueuedMessages = [];\n\tthis.streamingComponent = undefined;\n\tthis.streamingMessage = undefined;\n\tthis.pendingTools.clear();\n\tthis.renderInitialMessages();\n};\n\nInteractiveModeBase.prototype.getRegisteredToolDefinition = function (\n\tthis: InteractiveModeBase,\n\ttoolName: string,\n): ReturnType<AgentSession[\"getToolDefinition\"]> {\n\treturn this.session.getToolDefinition(toolName);\n};\n"]}
|
|
@@ -44,18 +44,8 @@ InteractiveModeBase.prototype.handleReloadCommand = async function () {
|
|
|
44
44
|
activeHeader.setExpanded(this.toolOutputExpanded);
|
|
45
45
|
}
|
|
46
46
|
setRegisteredThemes(this.session.resourceLoader.getThemes().themes);
|
|
47
|
-
this.
|
|
47
|
+
this.applyRuntimeSettings();
|
|
48
48
|
await this.themeController.applyFromSettings();
|
|
49
|
-
const editorPaddingX = this.settingsManager.getEditorPaddingX();
|
|
50
|
-
const autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();
|
|
51
|
-
this.defaultEditor.setPaddingX(editorPaddingX);
|
|
52
|
-
this.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);
|
|
53
|
-
if (this.editor !== this.defaultEditor) {
|
|
54
|
-
this.editor.setPaddingX?.(editorPaddingX);
|
|
55
|
-
this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);
|
|
56
|
-
}
|
|
57
|
-
this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());
|
|
58
|
-
this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());
|
|
59
49
|
this.setupAutocompleteProvider();
|
|
60
50
|
const runner = this.session.extensionRunner;
|
|
61
51
|
this.setupExtensionShortcuts(runner);
|
|
@@ -265,7 +255,12 @@ InteractiveModeBase.prototype.handleShareCommand = async function () {
|
|
|
265
255
|
}
|
|
266
256
|
}
|
|
267
257
|
};
|
|
268
|
-
InteractiveModeBase.prototype.handleCopyCommand = async function () {
|
|
258
|
+
InteractiveModeBase.prototype.handleCopyCommand = async function (options = {}) {
|
|
259
|
+
if (options.preferSelection && this.getFullscreenCopyOnSelect() === false) {
|
|
260
|
+
const selectionCopied = await this.copyActiveFullscreenSelection();
|
|
261
|
+
if (selectionCopied !== undefined)
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
269
264
|
const text = this.session.getLastAssistantText();
|
|
270
265
|
if (!text) {
|
|
271
266
|
this.showError("No agent messages to copy yet.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-slash-commands.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-slash-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EACN,cAAc,EAEd,SAAS,EACT,eAAe,EACf,aAAa,EACb,EAAE,EACF,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,sBAAsB,EACtB,uBAAuB,EACvB,EAAE,EACF,cAAc,EACd,IAAI,EACJ,8BAA8B,EAC9B,MAAM,EACN,mBAAmB,EACnB,KAAK,EACL,SAAS,EACT,IAAI,EACJ,KAAK,GACL,MAAM,4BAA4B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C,aAAa,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,iBAAiB,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,4BAA4B,EAAE,CAAC,CAAC,CAAC;IACxG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;IACjD,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;AACzB,CAAC,CAAC","sourcesContent":["import { computeCacheWaste } from \"../../core/cache-stats.ts\";\nimport { getUsageCostBreakdown } from \"../../core/usage-totals.ts\";\nimport { createChildProcessEnvironment } from \"../../utils/child-process.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\tBorderedLoader,\n\ttype Component,\n\tContainer,\n\tcopyToClipboard,\n\tDynamicBorder,\n\tfs,\n\tgetChangelogPath,\n\tgetShareViewerUrl,\n\thyperlink,\n\tMarkdown,\n\tMissingSessionCwdError,\n\tnormalizeChangelogLinks,\n\tos,\n\tparseChangelog,\n\tpath,\n\tSessionImportFileNotFoundError,\n\tSpacer,\n\tsetRegisteredThemes,\n\tspawn,\n\tspawnSync,\n\tText,\n\ttheme,\n} from \"./interactive-mode-deps.ts\";\nimport { isExpandable } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.handleReloadCommand = async function (this: InteractiveModeBase): Promise<void> {\n\tif (this.session.isStreaming) {\n\t\tthis.showWarning(\"Wait for the current response to finish before reloading.\");\n\t\treturn;\n\t}\n\tif (this.compactionActive) {\n\t\tthis.showWarning(\"Wait for compaction to finish before reloading.\");\n\t\treturn;\n\t}\n\n\tthis.resetExtensionUI();\n\n\tconst reloadBox = new Container();\n\tconst borderColor = (s: string) => theme.fg(\"border\", s);\n\treloadBox.addChild(new DynamicBorder(borderColor));\n\treloadBox.addChild(new Spacer(1));\n\treloadBox.addChild(\n\t\tnew Text(theme.fg(\"muted\", \"Reloading keybindings, extensions, skills, prompts, themes...\"), 1, 0),\n\t);\n\treloadBox.addChild(new Spacer(1));\n\treloadBox.addChild(new DynamicBorder(borderColor));\n\n\tconst previousEditor = this.editor;\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(reloadBox);\n\tthis.ui.setFocus(reloadBox);\n\tthis.ui.requestRender(true);\n\tawait new Promise((resolve) => process.nextTick(resolve));\n\n\tconst dismissReloadBox = (editor: Component) => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(editor);\n\t\tthis.ui.setFocus(editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\ttry {\n\t\tif (this.runtimeHost instanceof IsolatedInteractiveRuntime) await this.session.reload();\n\t\telse await this.reloadCoordinator.reload(this.session);\n\t\tconst activeHeader = this.customHeader ?? this.builtInHeader;\n\t\tif (isExpandable(activeHeader)) {\n\t\t\tactiveHeader.setExpanded(this.toolOutputExpanded);\n\t\t}\n\t\tsetRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n\t\tthis.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();\n\t\tawait this.themeController.applyFromSettings();\n\t\tconst editorPaddingX = this.settingsManager.getEditorPaddingX();\n\t\tconst autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();\n\t\tthis.defaultEditor.setPaddingX(editorPaddingX);\n\t\tthis.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);\n\t\tif (this.editor !== this.defaultEditor) {\n\t\t\tthis.editor.setPaddingX?.(editorPaddingX);\n\t\t\tthis.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);\n\t\t}\n\t\tthis.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());\n\t\tthis.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());\n\t\tthis.setupAutocompleteProvider();\n\t\tconst runner = this.session.extensionRunner;\n\t\tthis.setupExtensionShortcuts(runner);\n\t\tthis.rebuildChatFromMessages({ resetStartupDisclosure: true });\n\t\tdismissReloadBox(this.editor as Component);\n\t\tconst savedImplicitProjectTrust = this.maybeSaveImplicitProjectTrustAfterReload();\n\t\tthis.showLoadedResources({\n\t\t\tforce: false,\n\t\t\tshowDiagnosticsWhenQuiet: true,\n\t\t});\n\t\tif (savedImplicitProjectTrust) {\n\t\t\tthis.showStatus(\"Saved project trust for future sessions\");\n\t\t}\n\t\tconst modelsJsonError = this.session.modelRuntime.getError();\n\t\tif (modelsJsonError) {\n\t\t\tthis.showError(`models.json error: ${modelsJsonError}`);\n\t\t}\n\t\tthis.showStatus(\"Reloaded keybindings, extensions, skills, prompts, themes\");\n\t} catch (error) {\n\t\tdismissReloadBox(previousEditor as Component);\n\t\tthis.showError(`Reload failed: ${error instanceof Error ? error.message : String(error)}`);\n\t}\n};\n\nInteractiveModeBase.prototype.handleExportCommand = async function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): Promise<void> {\n\tconst outputPath = this.getPathCommandArgument(text, \"/export\");\n\n\ttry {\n\t\tif (outputPath?.endsWith(\".jsonl\")) {\n\t\t\tconst filePath = this.session.exportToJsonl(outputPath);\n\t\t\tthis.showStatus(`Session exported to: ${filePath}`);\n\t\t} else {\n\t\t\tconst filePath = await this.session.exportToHtml(outputPath, { themeName: theme.name });\n\t\t\tthis.showStatus(`Session exported to: ${filePath}`);\n\t\t}\n\t} catch (error: unknown) {\n\t\tthis.showError(`Failed to export session: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t}\n};\n\nInteractiveModeBase.prototype.getPathCommandArgument = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n\tcommand: \"/export\" | \"/import\",\n): string | undefined {\n\tif (text === command) {\n\t\treturn undefined;\n\t}\n\tif (!text.startsWith(`${command} `)) {\n\t\treturn undefined;\n\t}\n\n\tconst argsString = text.slice(command.length + 1).trimStart();\n\tif (!argsString) {\n\t\treturn undefined;\n\t}\n\n\tconst firstChar = argsString[0];\n\tif (firstChar === '\"' || firstChar === \"'\") {\n\t\tconst closingQuoteIndex = argsString.indexOf(firstChar, 1);\n\t\tif (closingQuoteIndex < 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn argsString.slice(1, closingQuoteIndex);\n\t}\n\n\tconst firstWhitespaceIndex = argsString.search(/\\s/);\n\tif (firstWhitespaceIndex < 0) {\n\t\treturn argsString;\n\t}\n\treturn argsString.slice(0, firstWhitespaceIndex);\n};\n\nInteractiveModeBase.prototype.handleImportCommand = async function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): Promise<void> {\n\tconst inputPath = this.getPathCommandArgument(text, \"/import\");\n\tif (!inputPath) {\n\t\tthis.showError(\"Usage: /import <path.jsonl>\");\n\t\treturn;\n\t}\n\n\tconst confirmed = await this.showExtensionConfirm(\"Import session\", `Replace current session with ${inputPath}?`);\n\tif (!confirmed) {\n\t\tthis.showStatus(\"Import cancelled\");\n\t\treturn;\n\t}\n\n\tconst finishSuccessfulImport = () => {\n\t\tthis.renderCurrentSessionState();\n\t\tif (this.firstRunNoticeVisible) {\n\t\t\tthis.clearFirstRunOnboardingUi();\n\t\t}\n\t\tthis.showStatus(`Session imported from: ${inputPath}`);\n\t};\n\n\ttry {\n\t\tif (this.loadingAnimation) {\n\t\t\tthis.loadingAnimation.stop();\n\t\t\tthis.loadingAnimation = undefined;\n\t\t}\n\t\tthis.statusContainer.clear();\n\t\tconst result = await this.runtimeHost.importFromJsonl(inputPath);\n\t\tif (result.cancelled) {\n\t\t\tthis.showStatus(\"Import cancelled\");\n\t\t\treturn;\n\t\t}\n\t\tfinishSuccessfulImport();\n\t} catch (error: unknown) {\n\t\tif (error instanceof MissingSessionCwdError) {\n\t\t\tconst selectedCwd = await this.promptForMissingSessionCwd(error);\n\t\t\tif (!selectedCwd) {\n\t\t\t\tthis.showStatus(\"Import cancelled\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst result = await this.runtimeHost.importFromJsonl(inputPath, selectedCwd);\n\t\t\tif (result.cancelled) {\n\t\t\t\tthis.showStatus(\"Import cancelled\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfinishSuccessfulImport();\n\t\t\treturn;\n\t\t}\n\t\tif (error instanceof SessionImportFileNotFoundError) {\n\t\t\tthis.showError(`Failed to import session: ${error.message}`);\n\t\t\treturn;\n\t\t}\n\t\tawait this.handleFatalRuntimeError(\"Failed to import session\", error);\n\t}\n};\n\nInteractiveModeBase.prototype.handleShareCommand = async function (this: InteractiveModeBase): Promise<void> {\n\t// Check if gh is available and logged in\n\ttry {\n\t\tconst authResult = spawnSync(\"gh\", [\"auth\", \"status\"], {\n\t\t\tencoding: \"utf-8\",\n\t\t\tenv: createChildProcessEnvironment(),\n\t\t});\n\t\tif (authResult.status !== 0) {\n\t\t\tthis.showError(\"GitHub CLI is not logged in. Run 'gh auth login' first.\");\n\t\t\treturn;\n\t\t}\n\t} catch {\n\t\tthis.showError(\"GitHub CLI (gh) is not installed. Install it from https://cli.github.com/\");\n\t\treturn;\n\t}\n\n\t// Share an export-only JSONL copy carrying context for the viewer. The\n\t// persisted session is not mutated.\n\tconst tmpFile = path.join(os.tmpdir(), \"session.jsonl\");\n\ttry {\n\t\tthis.session.exportToJsonl(tmpFile, { includeShareContext: true });\n\t} catch (error: unknown) {\n\t\tthis.showError(`Failed to export session: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\treturn;\n\t}\n\n\t// Show cancellable loader, replacing the editor\n\tconst loader = new BorderedLoader(this.ui, theme, \"Creating gist...\");\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(loader);\n\tthis.ui.setFocus(loader);\n\tthis.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tloader.dispose();\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\ttry {\n\t\t\tfs.unlinkSync(tmpFile);\n\t\t} catch {\n\t\t\t// Ignore cleanup errors\n\t\t}\n\t};\n\n\t// Create a secret gist asynchronously\n\tlet proc: ReturnType<typeof spawn> | null = null;\n\n\tloader.onAbort = () => {\n\t\tproc?.kill();\n\t\trestoreEditor();\n\t\tthis.showStatus(\"Share cancelled\");\n\t};\n\n\ttry {\n\t\tconst result = await new Promise<{\n\t\t\tstdout: string;\n\t\t\tstderr: string;\n\t\t\tcode: number | null;\n\t\t}>((resolve) => {\n\t\t\tproc = spawn(\"gh\", [\"gist\", \"create\", \"--public=false\", tmpFile], { env: createChildProcessEnvironment() });\n\t\t\tlet stdout = \"\";\n\t\t\tlet stderr = \"\";\n\t\t\tproc.stdout?.on(\"data\", (data) => {\n\t\t\t\tstdout += data.toString();\n\t\t\t});\n\t\t\tproc.stderr?.on(\"data\", (data) => {\n\t\t\t\tstderr += data.toString();\n\t\t\t});\n\t\t\tproc.on(\"close\", (code) => resolve({ stdout, stderr, code }));\n\t\t});\n\n\t\tif (loader.signal.aborted) return;\n\n\t\trestoreEditor();\n\n\t\tif (result.code !== 0) {\n\t\t\tconst errorMsg = result.stderr?.trim() || \"Unknown error\";\n\t\t\tthis.showError(`Failed to create gist: ${errorMsg}`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Extract gist ID from the URL returned by gh\n\t\t// gh returns something like: https://gist.github.com/username/GIST_ID\n\t\tconst gistUrl = result.stdout?.trim();\n\t\tconst gistId = gistUrl?.split(\"/\").pop();\n\t\tif (!gistId) {\n\t\t\tthis.showError(\"Failed to parse gist ID from gh output\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Create the preview URL\n\t\tconst previewUrl = getShareViewerUrl(gistId);\n\t\tthis.showStatus(`Share URL: ${hyperlink(previewUrl, previewUrl)}\\nGist: ${hyperlink(gistUrl, gistUrl)}`);\n\t} catch (error: unknown) {\n\t\tif (!loader.signal.aborted) {\n\t\t\trestoreEditor();\n\t\t\tthis.showError(`Failed to create gist: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.handleCopyCommand = async function (this: InteractiveModeBase): Promise<void> {\n\tconst text = this.session.getLastAssistantText();\n\tif (!text) {\n\t\tthis.showError(\"No agent messages to copy yet.\");\n\t\treturn;\n\t}\n\n\ttry {\n\t\tawait copyToClipboard(text);\n\t\tthis.showStatus(\"Copied last agent message to clipboard\");\n\t} catch (error) {\n\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t}\n};\n\nInteractiveModeBase.prototype.handleNameCommand = function (this: InteractiveModeBase, text: string): void {\n\tconst name = text.replace(/^\\/name\\s*/, \"\").trim();\n\tif (!name) {\n\t\tconst currentName = this.sessionManager.getSessionName();\n\t\tif (currentName) {\n\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\tthis.chatContainer.addChild(new Text(theme.fg(\"dim\", `Session name: ${currentName}`), 1, 0));\n\t\t} else {\n\t\t\tthis.showWarning(\"Usage: /name <name>\");\n\t\t}\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\n\tthis.session.setSessionName(name);\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new Text(theme.fg(\"dim\", `Session name set: ${name}`), 1, 0));\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleSessionCommand = function (this: InteractiveModeBase): void {\n\tconst stats = this.session.getSessionStats();\n\tconst sessionName = this.sessionManager.getSessionName();\n\n\tlet info = `${theme.bold(\"Session Info\")}\\n\\n`;\n\tif (sessionName) {\n\t\tinfo += `${theme.fg(\"dim\", \"Name:\")} ${sessionName}\\n`;\n\t}\n\tinfo += `${theme.fg(\"dim\", \"File:\")} ${stats.sessionFile ?? \"In-memory\"}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"ID:\")} ${stats.sessionId}\\n\\n`;\n\tinfo += `${theme.bold(\"Messages\")}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"User:\")} ${stats.userMessages}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Assistant:\")} ${stats.assistantMessages}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Tool Calls:\")} ${stats.toolCalls}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Tool Results:\")} ${stats.toolResults}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.totalMessages}\\n\\n`;\n\tinfo += `${theme.bold(\"Tokens\")}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Input:\")} ${stats.tokens.input.toLocaleString()}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Output:\")} ${stats.tokens.output.toLocaleString()}\\n`;\n\tif (stats.tokens.cacheRead > 0) {\n\t\tinfo += `${theme.fg(\"dim\", \"Cache Read:\")} ${stats.tokens.cacheRead.toLocaleString()}\\n`;\n\t}\n\tif (stats.tokens.cacheWrite > 0) {\n\t\tinfo += `${theme.fg(\"dim\", \"Cache Write:\")} ${stats.tokens.cacheWrite.toLocaleString()}\\n`;\n\t}\n\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.tokens.total.toLocaleString()}\\n`;\n\tconst entries = this.sessionManager.getEntries();\n\tconst assistantEntries = entries.filter((entry) => entry.type === \"message\" && entry.message.role === \"assistant\");\n\tconst promptTokens = assistantEntries.reduce(\n\t\t(sum, entry) =>\n\t\t\tsum +\n\t\t\t(entry.type === \"message\" && entry.message.role === \"assistant\"\n\t\t\t\t? entry.message.usage.input + entry.message.usage.cacheRead + entry.message.usage.cacheWrite\n\t\t\t\t: 0),\n\t\t0,\n\t);\n\tconst cacheRead = assistantEntries.reduce(\n\t\t(sum, entry) =>\n\t\t\tsum + (entry.type === \"message\" && entry.message.role === \"assistant\" ? entry.message.usage.cacheRead : 0),\n\t\t0,\n\t);\n\tif (promptTokens > 0)\n\t\tinfo += `${theme.fg(\"dim\", \"Cache Hit Rate:\")} ${((cacheRead / promptTokens) * 100).toFixed(1)}%\\n`;\n\tconst waste = computeCacheWaste(entries, {\n\t\tgetModel: (provider, model) => this.session.modelRuntime.getModel(provider, model),\n\t});\n\tif (waste.missCount > 0)\n\t\tinfo += `${theme.fg(\"dim\", \"Wasted Cache Cost:\")} $${waste.missedCost.toFixed(4)} (${waste.missCount} misses)\\n`;\n\n\tif (stats.cost > 0) {\n\t\tinfo += `\\n${theme.bold(\"Cost\")}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.cost.toFixed(4)}`;\n\t\tfor (const item of getUsageCostBreakdown(entries)) {\n\t\t\tinfo += `\\n${theme.fg(\"dim\", `${item.key}:`)} $${item.cost.toFixed(4)}`;\n\t\t}\n\t}\n\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new Text(info, 1, 0));\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleChangelogCommand = function (this: InteractiveModeBase): void {\n\tconst changelogPath = getChangelogPath();\n\tconst allEntries = parseChangelog(changelogPath);\n\n\tconst changelogMarkdown =\n\t\tallEntries.length > 0\n\t\t\t? allEntries\n\t\t\t\t\t.reverse()\n\t\t\t\t\t.map((e) => normalizeChangelogLinks(e.content, e))\n\t\t\t\t\t.join(\"\\n\\n\")\n\t\t\t: \"No changelog entries found.\";\n\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new DynamicBorder());\n\tthis.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0));\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, this.getMarkdownThemeWithSettings()));\n\tthis.chatContainer.addChild(new DynamicBorder());\n\tthis.ui.requestRender();\n};\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-slash-commands.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-slash-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,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,CAAC,CAAC,CAAC;IAC3C,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,iBAAiB,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,4BAA4B,EAAE,CAAC,CAAC,CAAC;IACxG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;IACjD,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;AACzB,CAAC,CAAC","sourcesContent":["import { computeCacheWaste } from \"../../core/cache-stats.ts\";\nimport { getUsageCostBreakdown } from \"../../core/usage-totals.ts\";\nimport { createChildProcessEnvironment } from \"../../utils/child-process.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\tBorderedLoader,\n\ttype Component,\n\tContainer,\n\tcopyToClipboard,\n\tDynamicBorder,\n\tfs,\n\tgetChangelogPath,\n\tgetShareViewerUrl,\n\thyperlink,\n\tMarkdown,\n\tMissingSessionCwdError,\n\tnormalizeChangelogLinks,\n\tos,\n\tparseChangelog,\n\tpath,\n\tSessionImportFileNotFoundError,\n\tSpacer,\n\tsetRegisteredThemes,\n\tspawn,\n\tspawnSync,\n\tText,\n\ttheme,\n} from \"./interactive-mode-deps.ts\";\nimport { isExpandable } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.handleReloadCommand = async function (this: InteractiveModeBase): Promise<void> {\n\tif (this.session.isStreaming) {\n\t\tthis.showWarning(\"Wait for the current response to finish before reloading.\");\n\t\treturn;\n\t}\n\tif (this.compactionActive) {\n\t\tthis.showWarning(\"Wait for compaction to finish before reloading.\");\n\t\treturn;\n\t}\n\n\tthis.resetExtensionUI();\n\n\tconst reloadBox = new Container();\n\tconst borderColor = (s: string) => theme.fg(\"border\", s);\n\treloadBox.addChild(new DynamicBorder(borderColor));\n\treloadBox.addChild(new Spacer(1));\n\treloadBox.addChild(\n\t\tnew Text(theme.fg(\"muted\", \"Reloading keybindings, extensions, skills, prompts, themes...\"), 1, 0),\n\t);\n\treloadBox.addChild(new Spacer(1));\n\treloadBox.addChild(new DynamicBorder(borderColor));\n\n\tconst previousEditor = this.editor;\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(reloadBox);\n\tthis.ui.setFocus(reloadBox);\n\tthis.ui.requestRender(true);\n\tawait new Promise((resolve) => process.nextTick(resolve));\n\n\tconst dismissReloadBox = (editor: Component) => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(editor);\n\t\tthis.ui.setFocus(editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\ttry {\n\t\tif (this.runtimeHost instanceof IsolatedInteractiveRuntime) await this.session.reload();\n\t\telse await this.reloadCoordinator.reload(this.session);\n\t\tconst activeHeader = this.customHeader ?? this.builtInHeader;\n\t\tif (isExpandable(activeHeader)) {\n\t\t\tactiveHeader.setExpanded(this.toolOutputExpanded);\n\t\t}\n\t\tsetRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n\t\tthis.applyRuntimeSettings();\n\t\tawait this.themeController.applyFromSettings();\n\t\tthis.setupAutocompleteProvider();\n\t\tconst runner = this.session.extensionRunner;\n\t\tthis.setupExtensionShortcuts(runner);\n\t\tthis.rebuildChatFromMessages({ resetStartupDisclosure: true });\n\t\tdismissReloadBox(this.editor as Component);\n\t\tconst savedImplicitProjectTrust = this.maybeSaveImplicitProjectTrustAfterReload();\n\t\tthis.showLoadedResources({\n\t\t\tforce: false,\n\t\t\tshowDiagnosticsWhenQuiet: true,\n\t\t});\n\t\tif (savedImplicitProjectTrust) {\n\t\t\tthis.showStatus(\"Saved project trust for future sessions\");\n\t\t}\n\t\tconst modelsJsonError = this.session.modelRuntime.getError();\n\t\tif (modelsJsonError) {\n\t\t\tthis.showError(`models.json error: ${modelsJsonError}`);\n\t\t}\n\t\tthis.showStatus(\"Reloaded keybindings, extensions, skills, prompts, themes\");\n\t} catch (error) {\n\t\tdismissReloadBox(previousEditor as Component);\n\t\tthis.showError(`Reload failed: ${error instanceof Error ? error.message : String(error)}`);\n\t}\n};\n\nInteractiveModeBase.prototype.handleExportCommand = async function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): Promise<void> {\n\tconst outputPath = this.getPathCommandArgument(text, \"/export\");\n\n\ttry {\n\t\tif (outputPath?.endsWith(\".jsonl\")) {\n\t\t\tconst filePath = this.session.exportToJsonl(outputPath);\n\t\t\tthis.showStatus(`Session exported to: ${filePath}`);\n\t\t} else {\n\t\t\tconst filePath = await this.session.exportToHtml(outputPath, { themeName: theme.name });\n\t\t\tthis.showStatus(`Session exported to: ${filePath}`);\n\t\t}\n\t} catch (error: unknown) {\n\t\tthis.showError(`Failed to export session: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t}\n};\n\nInteractiveModeBase.prototype.getPathCommandArgument = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n\tcommand: \"/export\" | \"/import\",\n): string | undefined {\n\tif (text === command) {\n\t\treturn undefined;\n\t}\n\tif (!text.startsWith(`${command} `)) {\n\t\treturn undefined;\n\t}\n\n\tconst argsString = text.slice(command.length + 1).trimStart();\n\tif (!argsString) {\n\t\treturn undefined;\n\t}\n\n\tconst firstChar = argsString[0];\n\tif (firstChar === '\"' || firstChar === \"'\") {\n\t\tconst closingQuoteIndex = argsString.indexOf(firstChar, 1);\n\t\tif (closingQuoteIndex < 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn argsString.slice(1, closingQuoteIndex);\n\t}\n\n\tconst firstWhitespaceIndex = argsString.search(/\\s/);\n\tif (firstWhitespaceIndex < 0) {\n\t\treturn argsString;\n\t}\n\treturn argsString.slice(0, firstWhitespaceIndex);\n};\n\nInteractiveModeBase.prototype.handleImportCommand = async function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): Promise<void> {\n\tconst inputPath = this.getPathCommandArgument(text, \"/import\");\n\tif (!inputPath) {\n\t\tthis.showError(\"Usage: /import <path.jsonl>\");\n\t\treturn;\n\t}\n\n\tconst confirmed = await this.showExtensionConfirm(\"Import session\", `Replace current session with ${inputPath}?`);\n\tif (!confirmed) {\n\t\tthis.showStatus(\"Import cancelled\");\n\t\treturn;\n\t}\n\n\tconst finishSuccessfulImport = () => {\n\t\tthis.renderCurrentSessionState();\n\t\tif (this.firstRunNoticeVisible) {\n\t\t\tthis.clearFirstRunOnboardingUi();\n\t\t}\n\t\tthis.showStatus(`Session imported from: ${inputPath}`);\n\t};\n\n\ttry {\n\t\tif (this.loadingAnimation) {\n\t\t\tthis.loadingAnimation.stop();\n\t\t\tthis.loadingAnimation = undefined;\n\t\t}\n\t\tthis.statusContainer.clear();\n\t\tconst result = await this.runtimeHost.importFromJsonl(inputPath);\n\t\tif (result.cancelled) {\n\t\t\tthis.showStatus(\"Import cancelled\");\n\t\t\treturn;\n\t\t}\n\t\tfinishSuccessfulImport();\n\t} catch (error: unknown) {\n\t\tif (error instanceof MissingSessionCwdError) {\n\t\t\tconst selectedCwd = await this.promptForMissingSessionCwd(error);\n\t\t\tif (!selectedCwd) {\n\t\t\t\tthis.showStatus(\"Import cancelled\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst result = await this.runtimeHost.importFromJsonl(inputPath, selectedCwd);\n\t\t\tif (result.cancelled) {\n\t\t\t\tthis.showStatus(\"Import cancelled\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfinishSuccessfulImport();\n\t\t\treturn;\n\t\t}\n\t\tif (error instanceof SessionImportFileNotFoundError) {\n\t\t\tthis.showError(`Failed to import session: ${error.message}`);\n\t\t\treturn;\n\t\t}\n\t\tawait this.handleFatalRuntimeError(\"Failed to import session\", error);\n\t}\n};\n\nInteractiveModeBase.prototype.handleShareCommand = async function (this: InteractiveModeBase): Promise<void> {\n\t// Check if gh is available and logged in\n\ttry {\n\t\tconst authResult = spawnSync(\"gh\", [\"auth\", \"status\"], {\n\t\t\tencoding: \"utf-8\",\n\t\t\tenv: createChildProcessEnvironment(),\n\t\t});\n\t\tif (authResult.status !== 0) {\n\t\t\tthis.showError(\"GitHub CLI is not logged in. Run 'gh auth login' first.\");\n\t\t\treturn;\n\t\t}\n\t} catch {\n\t\tthis.showError(\"GitHub CLI (gh) is not installed. Install it from https://cli.github.com/\");\n\t\treturn;\n\t}\n\n\t// Share an export-only JSONL copy carrying context for the viewer. The\n\t// persisted session is not mutated.\n\tconst tmpFile = path.join(os.tmpdir(), \"session.jsonl\");\n\ttry {\n\t\tthis.session.exportToJsonl(tmpFile, { includeShareContext: true });\n\t} catch (error: unknown) {\n\t\tthis.showError(`Failed to export session: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\treturn;\n\t}\n\n\t// Show cancellable loader, replacing the editor\n\tconst loader = new BorderedLoader(this.ui, theme, \"Creating gist...\");\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(loader);\n\tthis.ui.setFocus(loader);\n\tthis.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tloader.dispose();\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\ttry {\n\t\t\tfs.unlinkSync(tmpFile);\n\t\t} catch {\n\t\t\t// Ignore cleanup errors\n\t\t}\n\t};\n\n\t// Create a secret gist asynchronously\n\tlet proc: ReturnType<typeof spawn> | null = null;\n\n\tloader.onAbort = () => {\n\t\tproc?.kill();\n\t\trestoreEditor();\n\t\tthis.showStatus(\"Share cancelled\");\n\t};\n\n\ttry {\n\t\tconst result = await new Promise<{\n\t\t\tstdout: string;\n\t\t\tstderr: string;\n\t\t\tcode: number | null;\n\t\t}>((resolve) => {\n\t\t\tproc = spawn(\"gh\", [\"gist\", \"create\", \"--public=false\", tmpFile], { env: createChildProcessEnvironment() });\n\t\t\tlet stdout = \"\";\n\t\t\tlet stderr = \"\";\n\t\t\tproc.stdout?.on(\"data\", (data) => {\n\t\t\t\tstdout += data.toString();\n\t\t\t});\n\t\t\tproc.stderr?.on(\"data\", (data) => {\n\t\t\t\tstderr += data.toString();\n\t\t\t});\n\t\t\tproc.on(\"close\", (code) => resolve({ stdout, stderr, code }));\n\t\t});\n\n\t\tif (loader.signal.aborted) return;\n\n\t\trestoreEditor();\n\n\t\tif (result.code !== 0) {\n\t\t\tconst errorMsg = result.stderr?.trim() || \"Unknown error\";\n\t\t\tthis.showError(`Failed to create gist: ${errorMsg}`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Extract gist ID from the URL returned by gh\n\t\t// gh returns something like: https://gist.github.com/username/GIST_ID\n\t\tconst gistUrl = result.stdout?.trim();\n\t\tconst gistId = gistUrl?.split(\"/\").pop();\n\t\tif (!gistId) {\n\t\t\tthis.showError(\"Failed to parse gist ID from gh output\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Create the preview URL\n\t\tconst previewUrl = getShareViewerUrl(gistId);\n\t\tthis.showStatus(`Share URL: ${hyperlink(previewUrl, previewUrl)}\\nGist: ${hyperlink(gistUrl, gistUrl)}`);\n\t} catch (error: unknown) {\n\t\tif (!loader.signal.aborted) {\n\t\t\trestoreEditor();\n\t\t\tthis.showError(`Failed to create gist: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.handleCopyCommand = async function (\n\tthis: InteractiveModeBase,\n\toptions: { preferSelection?: boolean } = {},\n): Promise<void> {\n\tif (options.preferSelection && this.getFullscreenCopyOnSelect() === false) {\n\t\tconst selectionCopied = await this.copyActiveFullscreenSelection();\n\t\tif (selectionCopied !== undefined) return;\n\t}\n\n\tconst text = this.session.getLastAssistantText();\n\tif (!text) {\n\t\tthis.showError(\"No agent messages to copy yet.\");\n\t\treturn;\n\t}\n\n\ttry {\n\t\tawait copyToClipboard(text);\n\t\tthis.showStatus(\"Copied last agent message to clipboard\");\n\t} catch (error) {\n\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t}\n};\n\nInteractiveModeBase.prototype.handleNameCommand = function (this: InteractiveModeBase, text: string): void {\n\tconst name = text.replace(/^\\/name\\s*/, \"\").trim();\n\tif (!name) {\n\t\tconst currentName = this.sessionManager.getSessionName();\n\t\tif (currentName) {\n\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\tthis.chatContainer.addChild(new Text(theme.fg(\"dim\", `Session name: ${currentName}`), 1, 0));\n\t\t} else {\n\t\t\tthis.showWarning(\"Usage: /name <name>\");\n\t\t}\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\n\tthis.session.setSessionName(name);\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new Text(theme.fg(\"dim\", `Session name set: ${name}`), 1, 0));\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleSessionCommand = function (this: InteractiveModeBase): void {\n\tconst stats = this.session.getSessionStats();\n\tconst sessionName = this.sessionManager.getSessionName();\n\n\tlet info = `${theme.bold(\"Session Info\")}\\n\\n`;\n\tif (sessionName) {\n\t\tinfo += `${theme.fg(\"dim\", \"Name:\")} ${sessionName}\\n`;\n\t}\n\tinfo += `${theme.fg(\"dim\", \"File:\")} ${stats.sessionFile ?? \"In-memory\"}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"ID:\")} ${stats.sessionId}\\n\\n`;\n\tinfo += `${theme.bold(\"Messages\")}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"User:\")} ${stats.userMessages}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Assistant:\")} ${stats.assistantMessages}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Tool Calls:\")} ${stats.toolCalls}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Tool Results:\")} ${stats.toolResults}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.totalMessages}\\n\\n`;\n\tinfo += `${theme.bold(\"Tokens\")}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Input:\")} ${stats.tokens.input.toLocaleString()}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Output:\")} ${stats.tokens.output.toLocaleString()}\\n`;\n\tif (stats.tokens.cacheRead > 0) {\n\t\tinfo += `${theme.fg(\"dim\", \"Cache Read:\")} ${stats.tokens.cacheRead.toLocaleString()}\\n`;\n\t}\n\tif (stats.tokens.cacheWrite > 0) {\n\t\tinfo += `${theme.fg(\"dim\", \"Cache Write:\")} ${stats.tokens.cacheWrite.toLocaleString()}\\n`;\n\t}\n\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.tokens.total.toLocaleString()}\\n`;\n\tconst entries = this.sessionManager.getEntries();\n\tconst assistantEntries = entries.filter((entry) => entry.type === \"message\" && entry.message.role === \"assistant\");\n\tconst promptTokens = assistantEntries.reduce(\n\t\t(sum, entry) =>\n\t\t\tsum +\n\t\t\t(entry.type === \"message\" && entry.message.role === \"assistant\"\n\t\t\t\t? entry.message.usage.input + entry.message.usage.cacheRead + entry.message.usage.cacheWrite\n\t\t\t\t: 0),\n\t\t0,\n\t);\n\tconst cacheRead = assistantEntries.reduce(\n\t\t(sum, entry) =>\n\t\t\tsum + (entry.type === \"message\" && entry.message.role === \"assistant\" ? entry.message.usage.cacheRead : 0),\n\t\t0,\n\t);\n\tif (promptTokens > 0)\n\t\tinfo += `${theme.fg(\"dim\", \"Cache Hit Rate:\")} ${((cacheRead / promptTokens) * 100).toFixed(1)}%\\n`;\n\tconst waste = computeCacheWaste(entries, {\n\t\tgetModel: (provider, model) => this.session.modelRuntime.getModel(provider, model),\n\t});\n\tif (waste.missCount > 0)\n\t\tinfo += `${theme.fg(\"dim\", \"Wasted Cache Cost:\")} $${waste.missedCost.toFixed(4)} (${waste.missCount} misses)\\n`;\n\n\tif (stats.cost > 0) {\n\t\tinfo += `\\n${theme.bold(\"Cost\")}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.cost.toFixed(4)}`;\n\t\tfor (const item of getUsageCostBreakdown(entries)) {\n\t\t\tinfo += `\\n${theme.fg(\"dim\", `${item.key}:`)} $${item.cost.toFixed(4)}`;\n\t\t}\n\t}\n\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new Text(info, 1, 0));\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleChangelogCommand = function (this: InteractiveModeBase): void {\n\tconst changelogPath = getChangelogPath();\n\tconst allEntries = parseChangelog(changelogPath);\n\n\tconst changelogMarkdown =\n\t\tallEntries.length > 0\n\t\t\t? allEntries\n\t\t\t\t\t.reverse()\n\t\t\t\t\t.map((e) => normalizeChangelogLinks(e.content, e))\n\t\t\t\t\t.join(\"\\n\\n\")\n\t\t\t: \"No changelog entries found.\";\n\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new DynamicBorder());\n\tthis.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0));\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, this.getMarkdownThemeWithSettings()));\n\tthis.chatContainer.addChild(new DynamicBorder());\n\tthis.ui.requestRender();\n};\n"]}
|
|
@@ -8,6 +8,7 @@ export interface InteractiveTuiOptions {
|
|
|
8
8
|
showHardwareCursor: boolean;
|
|
9
9
|
logDirectory: string;
|
|
10
10
|
terminal?: Terminal;
|
|
11
|
+
copyOnSelect?: boolean;
|
|
11
12
|
onRightClickPaste?: () => void;
|
|
12
13
|
onOverlayInternalUiAction?: (url: string) => InternalUiActionResult;
|
|
13
14
|
onInternalUiAction?: (url: string) => InternalUiActionResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-tui.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-tui.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EAGd,KAAK,QAAQ,EACb,KAAK,GAAG,EACR,YAAY,EAEZ,aAAa,EACb,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"interactive-tui.d.ts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IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACnD;AAYD,MAAM,WAAW,qBAAqB;IACrC,yBAAyB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,sBAAsB,CAAC;IACpE,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,sBAAsB,CAAC;IAC7D,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B;AA0BD,4FAA4F;AAC5F,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAYtF;AA2DD,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUvD;AA4SD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,YAAY,CAmBhF;AASD,oEAAoE;AACpE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CASnF;AAED,6EAA6E;AAC7E,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,CA4BpE"}
|
|
@@ -75,6 +75,8 @@ const viewportInputGates = new WeakMap();
|
|
|
75
75
|
const overlayUnhandledInputHandlers = new WeakMap();
|
|
76
76
|
/** Instances currently replaying overlay-declined input into pi-tui's viewport listener. */
|
|
77
77
|
const viewportInputReplays = new WeakSet();
|
|
78
|
+
/** Selections begun over Atomic overlays must never trigger or survive into main-chat clipboard actions. */
|
|
79
|
+
const overlayOwnedSelections = new WeakSet();
|
|
78
80
|
const viewportInputSubscriptions = new WeakMap();
|
|
79
81
|
const SGR_MOUSE_SEQUENCE = /^\x1b\[<(\d+);\d+;\d+([Mm])/;
|
|
80
82
|
const LEFT_MOUSE_MODIFIER_MASK = 4 | 8 | 16;
|
|
@@ -195,8 +197,20 @@ class AtomicTuiAltScreen extends TuiAltScreen {
|
|
|
195
197
|
* so removing it after cursor extraction cannot move a column.
|
|
196
198
|
*/
|
|
197
199
|
applyLineResets(lines) {
|
|
200
|
+
if (overlayOwnedSelections.has(this) && !this.isFocusedOverlay())
|
|
201
|
+
this.clearOverlayOwnedSelection();
|
|
198
202
|
return stripOverlayActiveRowMarker(super.applyLineResets(lines));
|
|
199
203
|
}
|
|
204
|
+
clearOverlayOwnedSelection() {
|
|
205
|
+
const selection = this;
|
|
206
|
+
selection.selectionAnchor = undefined;
|
|
207
|
+
selection.selectionFocus = undefined;
|
|
208
|
+
selection.selectionInitialRange = undefined;
|
|
209
|
+
selection.selectionPressActive = false;
|
|
210
|
+
selection.selectionDragged = false;
|
|
211
|
+
selection.lastClick = undefined;
|
|
212
|
+
overlayOwnedSelections.delete(this);
|
|
213
|
+
}
|
|
200
214
|
/**
|
|
201
215
|
* Keep pi-tui's private predicate as the fallback for its single-report
|
|
202
216
|
* grammar. Injected terminals can deliver coalesced reports, so parse those
|
|
@@ -282,6 +296,7 @@ class AtomicTuiAltScreen extends TuiAltScreen {
|
|
|
282
296
|
if (isLeftMouseButton(sequence))
|
|
283
297
|
viewportListener(sequence.data);
|
|
284
298
|
}
|
|
299
|
+
overlayOwnedSelections.add(this);
|
|
285
300
|
}
|
|
286
301
|
/**
|
|
287
302
|
* Replay input the focused overlay declined. pi-tui's native overlay
|
|
@@ -403,6 +418,7 @@ export function createFullscreenTui(options) {
|
|
|
403
418
|
openUrl: openBrowser,
|
|
404
419
|
}),
|
|
405
420
|
onRightClickPaste: options.onRightClickPaste,
|
|
421
|
+
copyOnSelect: options.copyOnSelect,
|
|
406
422
|
copySelection: options.copySelection ?? copySelectionToHostClipboard,
|
|
407
423
|
}, options.shouldHandleViewportInput, options.onOverlayUnhandledInput);
|
|
408
424
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-tui.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-tui.ts"],"names":[],"mappings":"AAAA,OAAO,E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AI,SAAS,GAAG,GAAG,CAAC;YACpB,IAAI,MAAM,GAAG,KAAK,CAAC;YACnB,OAAO,CAAC,GAAG,IAAe,EAAE,EAAE;gBAC7B,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;gBAC5B,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;oBAC9B,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;oBACpE,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE,CAAC;wBACzC,MAAM,IAAI,SAAS,CAAC,gBAAgB,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;oBACzE,CAAC;oBACD,SAAS,GAAG,UAAU,CAAC;oBACvB,MAAM,GAAG,aAAa,CAAC;gBACxB,CAAC;gBACD,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;YAC/C,CAAC,CAAC;QACH,CAAC;QACD,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;YACjC,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;YACrB,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAC/C,CAAC;QACD,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC;QAC3D,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;KACtD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n\ttype Component,\n\tisKeyRelease,\n\tProcessTerminal,\n\ttype Terminal,\n\ttype TUI,\n\tTuiAltScreen,\n\ttype TuiInputListener,\n\tTuiMainScreen,\n} from \"@earendil-works/pi-tui\";\nimport { stripOverlayActiveRowMarker } from \"../../core/extensions/ui-types.ts\";\nimport { copyToClipboard } from \"../../utils/clipboard.ts\";\nimport { openBrowser } from \"../../utils/open-browser.ts\";\nimport { TRANSCRIPT_JUMP_TO_END_URL } from \"./components/transcript-follow-indicator.ts\";\n\ninterface TuiOverlayEntry {\n\tcomponent: Component;\n\tpreFocus: Component | null;\n}\n\ninterface InternalUiActionOverlay extends Component {\n\thandlesInternalUiAction?: boolean;\n}\n\ntype TuiOverlayFocusRestore =\n\t| { status: \"inactive\" }\n\t| { status: \"eligible\"; overlay: TuiOverlayEntry }\n\t| {\n\t\t\tstatus: \"blocked\";\n\t\t\toverlay: TuiOverlayEntry;\n\t\t\tblockedBy: Component;\n\t\t\tresume: { status: \"restore-overlay\" } | { status: \"focus-target\"; target: Component | null };\n\t };\n\ninterface TuiOverlayInternals {\n\toverlayStack: TuiOverlayEntry[];\n\tisOverlayVisible(entry: TuiOverlayEntry): boolean;\n\tgetTopmostVisibleOverlay(): TuiOverlayEntry | undefined;\n\tsetFocusInternal(options: { component: Component | null; overlayFocusRestore: \"preserve\" }): void;\n\tgetVisibleOverlayFocusRestore(): TuiOverlayFocusRestore;\n\tclearOverlayFocusRestore(): void;\n\trequestImmediateRender(): void;\n}\n/** pi-tui 0.84.2 keeps this canonical mouse predicate private (tui-alt-screen.d.ts:114). */\ninterface TuiAltScreenMouseInternals {\n\tisMouseSequence(data: string): boolean;\n}\n\n/** pi-tui 0.84.2 keeps its overlay-deferral predicate private (tui-alt-screen.d.ts:84). */\ninterface TuiAltScreenViewportDeferral {\n\tshouldDeferViewportInputToOverlay?(): boolean;\n}\n\nexport type InteractiveTui = TuiMainScreen | TuiAltScreen;\n\nexport function isOverlayMounted(tui: TUI, component: Component): boolean {\n\tconst internals = tui as unknown as Partial<TuiOverlayInternals>;\n\treturn (\n\t\tArray.isArray(internals.overlayStack) && internals.overlayStack.some((entry) => entry.component === component)\n\t);\n}\nexport function getFocusedOverlay(tui: InteractiveTui): Component | undefined {\n\tconst focused = tui.getFocusedComponent();\n\tif (!focused) return undefined;\n\tconst internals = tui as unknown as Partial<TuiOverlayInternals>;\n\tif (!Array.isArray(internals.overlayStack) || typeof internals.isOverlayVisible !== \"function\") return undefined;\n\tconst entry = internals.overlayStack.find((candidate) => candidate.component === focused);\n\treturn entry && internals.isOverlayVisible(entry) ? focused : undefined;\n}\n\nexport function handleFocusedOverlayInternalUiAction(tui: InteractiveTui, url: string): InternalUiActionResult {\n\tconst overlay = getFocusedOverlay(tui);\n\tif (!overlay || (overlay as InternalUiActionOverlay).handlesInternalUiAction !== true) return undefined;\n\tconst handleInput = overlay.handleInput as\n\t\t| ((data: string) => boolean | undefined | Promise<boolean | undefined>)\n\t\t| undefined;\n\treturn handleInput?.call(overlay, url);\n}\n\nexport type InternalUiActionResult = boolean | undefined | Promise<boolean | undefined>;\n\nexport interface InteractiveTuiOptions {\n\tshowHardwareCursor: boolean;\n\tlogDirectory: string;\n\tterminal?: Terminal;\n\tonRightClickPaste?: () => void;\n\tonOverlayInternalUiAction?: (url: string) => InternalUiActionResult;\n\tonInternalUiAction?: (url: string) => InternalUiActionResult;\n\t/**\n\t * Return false to let a focused overlay receive viewport input first.\n\t * Mouse input is deferred only while the focused component belongs to an\n\t * overlay; non-overlay focus keeps pi-tui's transcript selection path.\n\t */\n\tshouldHandleViewportInput?: (\n\t\tdata: string,\n\t\tisMouseInput: boolean,\n\t\tfocusedIsOverlay: boolean,\n\t\t_focusedIsViewportSearch: boolean,\n\t) => boolean;\n\t/** Handle an unconsumed overlay input before replaying it to the viewport. */\n\tonOverlayUnhandledInput?: (data: string) => boolean;\n\t/**\n\t * Copy selected text to the system clipboard; resolve false when the host\n\t * clipboard never received it. Defaults to Atomic's `copyToClipboard` with\n\t * its platform fallbacks, so pi-tui flashes \"Copy failed\" on a terminal\n\t * whose clipboard stayed untouched (upstream #8110) instead of the old\n\t * unconditional \"Copied!\". Injectable so hosts and tests observe the write.\n\t */\n\tcopySelection?: (text: string) => Promise<boolean>;\n}\n\n/** The default selection-copy route: Atomic's host clipboard write. */\nasync function copySelectionToHostClipboard(text: string): Promise<boolean> {\n\ttry {\n\t\tawait copyToClipboard(text);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport interface UrlActivationHandlers {\n\tonOverlayInternalUiAction?: (url: string) => InternalUiActionResult;\n\tonInternalUiAction?: (url: string) => InternalUiActionResult;\n\topenUrl: (url: string) => void;\n}\n\nfunction fallbackInternalUiAction(url: string, handlers: UrlActivationHandlers): void {\n\thandlers.onInternalUiAction?.(url);\n}\n\nfunction routeInternalUiAction(url: string, handlers: UrlActivationHandlers): void {\n\tlet result: InternalUiActionResult;\n\ttry {\n\t\tresult = handlers.onOverlayInternalUiAction?.(url);\n\t} catch {\n\t\tfallbackInternalUiAction(url, handlers);\n\t\treturn;\n\t}\n\tif (result instanceof Promise) {\n\t\tvoid result.then(\n\t\t\t(handled) => {\n\t\t\t\tif (handled !== true) fallbackInternalUiAction(url, handlers);\n\t\t\t},\n\t\t\t() => fallbackInternalUiAction(url, handlers),\n\t\t);\n\t\treturn;\n\t}\n\tif (result !== true) fallbackInternalUiAction(url, handlers);\n}\n\n/** Route OSC 8 activation without allowing unknown internal URLs to escape to a browser. */\nexport function handleUrlActivation(url: string, handlers: UrlActivationHandlers): void {\n\tconst internalUiScheme = \"atomic-ui:\";\n\tif (url.slice(0, internalUiScheme.length).toLowerCase() === internalUiScheme) {\n\t\tconst schemeEnd = url.indexOf(\":\");\n\t\tconst normalizedInternalUrl = `${url.slice(0, schemeEnd).toLowerCase()}${url.slice(schemeEnd)}`;\n\t\t// Forward the normalized URL: overlay-side matching is exact, so a\n\t\t// mixed-case scheme must not reach an overlay as an unrecognized string.\n\t\tif (normalizedInternalUrl === TRANSCRIPT_JUMP_TO_END_URL) routeInternalUiAction(normalizedInternalUrl, handlers);\n\t\treturn;\n\t}\n\n\thandlers.openUrl(url);\n}\n\nconst viewportInputListeners = new WeakSet<AtomicTuiAltScreen>();\n\ntype ViewportInputGate = (\n\tdata: string,\n\tisMouseInput: boolean,\n\tfocusedIsOverlay: boolean,\n\t_focusedIsViewportSearch: boolean,\n) => boolean;\n\nconst viewportInputGates = new WeakMap<AtomicTuiAltScreen, ViewportInputGate>();\nconst overlayUnhandledInputHandlers = new WeakMap<AtomicTuiAltScreen, (data: string) => boolean>();\n/** Instances currently replaying overlay-declined input into pi-tui's viewport listener. */\nconst viewportInputReplays = new WeakSet<AtomicTuiAltScreen>();\ninterface ViewportInputSubscription {\n\tviewportUnsubscribe: () => void;\n\trouteListener: TuiInputListener;\n\trouteUnsubscribe: () => void;\n}\n\nconst viewportInputSubscriptions = new WeakMap<AtomicTuiAltScreen, ViewportInputSubscription>();\n\n/** A complete SGR or X10 mouse report extracted from an input chunk. */\ninterface ParsedMouseSequence {\n\treadonly data: string;\n\treadonly button: number;\n\treadonly isRelease: boolean;\n}\n\nconst SGR_MOUSE_SEQUENCE = /^\\x1b\\[<(\\d+);\\d+;\\d+([Mm])/;\nconst LEFT_MOUSE_MODIFIER_MASK = 4 | 8 | 16;\n\nfunction parseMouseSequences(data: string): ParsedMouseSequence[] | undefined {\n\tif (data.length === 0) return undefined;\n\tconst sequences: ParsedMouseSequence[] = [];\n\tlet offset = 0;\n\twhile (offset < data.length) {\n\t\tconst remaining = data.slice(offset);\n\t\tconst sgr = SGR_MOUSE_SEQUENCE.exec(remaining);\n\t\tif (sgr) {\n\t\t\tconst sequence = sgr[0]!;\n\t\t\tsequences.push({ data: sequence, button: Number.parseInt(sgr[1]!, 10), isRelease: sgr[2] === \"m\" });\n\t\t\toffset += sequence.length;\n\t\t\tcontinue;\n\t\t}\n\t\tif (remaining.startsWith(\"\\x1b[M\") && remaining.length >= 6) {\n\t\t\tconst sequence = remaining.slice(0, 6);\n\t\t\tsequences.push({ data: sequence, button: sequence.charCodeAt(3) - 32, isRelease: false });\n\t\t\toffset += 6;\n\t\t\tcontinue;\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn sequences;\n}\n\n/** Whether every report in a mouse chunk is a vertical wheel event. */\nexport function isMouseWheelInput(data: string): boolean {\n\tconst sequences = parseMouseSequences(data);\n\treturn (\n\t\tsequences !== undefined &&\n\t\tsequences.length > 0 &&\n\t\tsequences.every(({ button }) => {\n\t\t\tconst direction = button & 3;\n\t\t\treturn (button & 64) !== 0 && (direction === 0 || direction === 1);\n\t\t})\n\t);\n}\n\nfunction isLeftMouseButton(sequence: ParsedMouseSequence): boolean {\n\tconst { button } = sequence;\n\tif ((button & 64) !== 0) return false;\n\tconst held = button & 3;\n\t// A release carries no button identity on the terminals upstream #7963\n\t// describes: they report the generic SGR code 3 rather than 0. pi-tui 0.84.2\n\t// ends a selection on `release && (button & 3) === 3`\n\t// (`dist/tui-alt-screen.js:796`), so a release Atomic drops here leaves the\n\t// press it already forwarded open — the selection never closes and the OSC 8\n\t// link under the press never activates. Shift, Meta/Option, and Ctrl are\n\t// application-bypass gestures on press and motion, but a release can retain\n\t// those bits and still has to close a selection.\n\tif (sequence.isRelease) return held === 0 || held === 3;\n\treturn held === 0 && (button & LEFT_MOUSE_MODIFIER_MASK) === 0;\n}\n\n/** Whether a mouse chunk contains a left-button selection gesture. */\nfunction isLeftMouseSequence(data: string): boolean {\n\treturn parseMouseSequences(data)?.some((sequence) => isLeftMouseButton(sequence)) ?? false;\n}\n\n/**\n * Replay a chunk one report at a time because pi-tui parses one report per\n * call. Only a chunk whose every byte is a mouse report is split; anything else\n * is replayed verbatim.\n *\n * **Probe, pi 0.84.2 (upstream `2a95ef70`, `06ed8716`):** neither the\n * lone-ESC timeout scope nor the split-`Alt+Enter` reassembly is affected by\n * this replay. Both land in `StdinBuffer`/`ProcessTerminal`\n * (`dist/stdin-buffer.js:process`, `dist/terminal.js:48`), which assemble\n * complete sequences before any listener runs; Atomic builds pi-tui's own\n * `ProcessTerminal` in `createFullscreenTui`/`createInteractiveTui` below and\n * overrides neither the buffer nor its escape timeout. A reassembled `\\x1b` or\n * `\\x1b\\r` reaches this function as one chunk, fails `parseMouseSequences`, and\n * is handed on unsplit — so a viewport action bound to `escape` or `alt+enter`\n * still matches after a decline.\n * Outcome: no breakage, no fix needed — covered by the replay probes in\n * `test/pi-0.84.2-overlay-viewport-deferral.test.ts`.\n */\nfunction replayMouseInput(viewportListener: TuiInputListener, data: string): void {\n\tconst sequences = parseMouseSequences(data);\n\tif (!sequences) {\n\t\tviewportListener(data);\n\t\treturn;\n\t}\n\tfor (const sequence of sequences) viewportListener(sequence.data);\n}\n\n/**\n * The first `addInputListener` call is load-bearing: pi-tui 0.84.2 registers\n * its viewport listener from `TuiAltScreen`'s constructor\n * (`dist/tui-alt-screen.js:85`). Keep the viewport wrapper first so mouse,\n * selection, and focus cleanup retain pi-tui's ordering. Put the focused-input\n * route last so application listeners still receive deferred viewport keys.\n */\nclass AtomicTuiAltScreen extends TuiAltScreen {\n\tconstructor(\n\t\tterminal: Terminal,\n\t\tshowHardwareCursor: boolean,\n\t\tlogDirectory: string,\n\t\toptions: ConstructorParameters<typeof TuiAltScreen>[3],\n\t\tviewportInputGate?: ViewportInputGate,\n\t\tonOverlayUnhandledInput?: (data: string) => boolean,\n\t) {\n\t\tsuper(terminal, showHardwareCursor, logDirectory, options);\n\t\tif (viewportInputGate) viewportInputGates.set(this, viewportInputGate);\n\t\tif (onOverlayUnhandledInput) overlayUnhandledInputHandlers.set(this, onOverlayUnhandledInput);\n\t\t// pi-tui 0.84.2 added `shouldDeferViewportInputToOverlay()`, which drops\n\t\t// viewport keys and wheel reports while an overlay holds focus (upstream\n\t\t// #7894). Atomic's gate offers that input to the focused overlay first and\n\t\t// replays only what the overlay declined (#2378 / PR #2381); pi-tui then\n\t\t// defers the replay a second time and the transcript freezes behind an\n\t\t// open dialog. Suppress the native answer for the replay alone. Input the\n\t\t// gate never routed through the overlay keeps pi-tui's routing and its\n\t\t// own deferral.\n\t\tconst deferral = this as unknown as TuiAltScreenViewportDeferral;\n\t\tconst deferToOverlay = deferral.shouldDeferViewportInputToOverlay?.bind(this);\n\t\tdeferral.shouldDeferViewportInputToOverlay = () => !viewportInputReplays.has(this) && deferToOverlay?.() === true;\n\t}\n\n\t/**\n\t * Last stop before pi-tui turns the composited screen into bytes, and where\n\t * it already removes its own `CURSOR_MARKER`. Every component tree that this\n\t * renderer paints converges here, so one strip covers the overlay, inline,\n\t * widget, and workflows stage-chat mounts at once — including hosts that\n\t * never call `ReservedBottomOverlay.takeActiveRow`. The mark is zero-width,\n\t * so removing it after cursor extraction cannot move a column.\n\t */\n\tprotected override applyLineResets(lines: string[]): string[] {\n\t\treturn stripOverlayActiveRowMarker(super.applyLineResets(lines));\n\t}\n\n\t/**\n\t * Keep pi-tui's private predicate as the fallback for its single-report\n\t * grammar. Injected terminals can deliver coalesced reports, so parse those\n\t * chunks locally before asking pi-tui about an unparsed value.\n\t */\n\tprivate isPiTuiMouseSequence(data: string): boolean {\n\t\tif (parseMouseSequences(data)) return true;\n\t\tconst predicate = (this as unknown as Partial<TuiAltScreenMouseInternals>).isMouseSequence;\n\t\treturn typeof predicate === \"function\" ? predicate.call(this, data) : false;\n\t}\n\n\tprivate isFocusedOverlay(): boolean {\n\t\tconst tui = this as unknown as TuiOverlayInternals;\n\t\treturn tui.overlayStack.some((entry) => entry.component === this.getFocusedComponent());\n\t}\n\n\toverride addInputListener(listener: TuiInputListener): () => void {\n\t\tif (!viewportInputListeners.has(this)) {\n\t\t\tviewportInputListeners.add(this);\n\t\t\tconst subscription: ViewportInputSubscription = {\n\t\t\t\tviewportUnsubscribe: () => {},\n\t\t\t\trouteListener: (data) => this.routeViewportInput(listener, data),\n\t\t\t\trouteUnsubscribe: () => {},\n\t\t\t};\n\t\t\tviewportInputSubscriptions.set(this, subscription);\n\t\t\tsubscription.viewportUnsubscribe = super.addInputListener((data) => {\n\t\t\t\tconst gate = viewportInputGates.get(this);\n\t\t\t\tconst isMouseInput = gate ? this.isPiTuiMouseSequence(data) : false;\n\t\t\t\tif (gate && !gate(data, isMouseInput, this.isFocusedOverlay(), false)) return undefined;\n\t\t\t\treturn listener(data);\n\t\t\t});\n\t\t\tsubscription.routeUnsubscribe = super.addInputListener(subscription.routeListener);\n\t\t\treturn () => {\n\t\t\t\tsubscription.viewportUnsubscribe();\n\t\t\t\tsubscription.routeUnsubscribe();\n\t\t\t\tviewportInputSubscriptions.delete(this);\n\t\t\t\tviewportInputListeners.delete(this);\n\t\t\t};\n\t\t}\n\n\t\tconst subscription = viewportInputSubscriptions.get(this);\n\t\tif (!subscription) return super.addInputListener(listener);\n\t\tsubscription.routeUnsubscribe();\n\t\tconst unsubscribe = super.addInputListener(listener);\n\t\tsubscription.routeUnsubscribe = super.addInputListener(subscription.routeListener);\n\t\treturn unsubscribe;\n\t}\n\n\tprivate repairOverlayFocus(): void {\n\t\tconst tui = this as unknown as TuiOverlayInternals;\n\t\tconst focused = this.getFocusedComponent();\n\t\tconst focusedOverlay = tui.overlayStack.find((entry) => entry.component === focused);\n\t\tif (focusedOverlay && !tui.isOverlayVisible(focusedOverlay)) {\n\t\t\tconst topVisible = tui.getTopmostVisibleOverlay();\n\t\t\tif (topVisible) {\n\t\t\t\tthis.setFocus(topVisible.component);\n\t\t\t} else {\n\t\t\t\ttui.setFocusInternal({ component: focusedOverlay.preFocus, overlayFocusRestore: \"preserve\" });\n\t\t\t}\n\t\t}\n\n\t\tconst focusIsOverlay = tui.overlayStack.some((entry) => entry.component === this.getFocusedComponent());\n\t\tif (focusIsOverlay) return;\n\n\t\tconst restoreState = tui.getVisibleOverlayFocusRestore();\n\t\tif (restoreState.status === \"eligible\") {\n\t\t\tthis.setFocus(restoreState.overlay.component);\n\t\t} else if (restoreState.status === \"blocked\" && restoreState.blockedBy !== this.getFocusedComponent()) {\n\t\t\tif (restoreState.resume.status === \"restore-overlay\") {\n\t\t\t\tthis.setFocus(restoreState.overlay.component);\n\t\t\t} else {\n\t\t\t\ttui.clearOverlayFocusRestore();\n\t\t\t\tthis.setFocus(restoreState.resume.target);\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Keep pi-tui's selection state in sync while an overlay handles a left gesture. */\n\tprivate forwardSelectionMouseInput(viewportListener: TuiInputListener, data: string, focused: Component): void {\n\t\tif (this.getFocusedComponent() !== focused || !isLeftMouseSequence(data)) return;\n\t\tfor (const sequence of parseMouseSequences(data) ?? []) {\n\t\t\tif (isLeftMouseButton(sequence)) viewportListener(sequence.data);\n\t\t}\n\t}\n\t/**\n\t * Replay input the focused overlay declined. pi-tui's native overlay\n\t * deferral is suppressed for the duration, because this chunk has already\n\t * been offered to the overlay it would defer to.\n\t */\n\tprivate replayViewportInput(viewportListener: TuiInputListener, data: string): void {\n\t\tviewportInputReplays.add(this);\n\t\ttry {\n\t\t\treplayMouseInput(viewportListener, data);\n\t\t} finally {\n\t\t\tviewportInputReplays.delete(this);\n\t\t}\n\t}\n\t/** Dispatch a declined chunk to the host action the gated route owns. */\n\tprivate handleOverlayUnhandledInput(data: string, focused: Component | null): boolean {\n\t\tif (this.getFocusedComponent() !== focused || !this.isFocusedOverlay()) return false;\n\t\treturn overlayUnhandledInputHandlers.get(this)?.(data) === true;\n\t}\n\n\t/**\n\t * Finish a chunk a focused overlay's asynchronous handler declined.\n\t *\n\t * Every settled result other than `true` is a decline. The component\n\t * contract is `boolean | undefined | Promise<boolean | undefined>`\n\t * (`ExtensionCustomComponent`), and both `docs/tui.md` and\n\t * `docs/extensions.md` document `false` *and* `undefined` as viewport\n\t * fallthrough, so a promise resolving `undefined` has to replay exactly like\n\t * one resolving `false` — matching only literal `false` consumed the key and\n\t * froze the transcript. A rejection is a decline for the same reason: the\n\t * overlay produced no answer.\n\t *\n\t * The focus guard stays: input that moved focus while the promise was\n\t * pending belongs to whatever holds focus now, not to the transcript.\n\t */\n\tprivate declineAsyncViewportInput(viewportListener: TuiInputListener, data: string, focused: Component): void {\n\t\tif (this.getFocusedComponent() !== focused) return;\n\t\tif (this.handleOverlayUnhandledInput(data, focused)) {\n\t\t\t(this as unknown as TuiOverlayInternals).requestImmediateRender();\n\t\t\treturn;\n\t\t}\n\t\tthis.replayViewportInput(viewportListener, data);\n\t}\n\n\tprivate routeViewportInput(viewportListener: TuiInputListener, data: string): ReturnType<TuiInputListener> {\n\t\tconst gate = viewportInputGates.get(this);\n\t\tconst isMouseInput = gate ? this.isPiTuiMouseSequence(data) : false;\n\t\tif (!gate || gate(data, isMouseInput, this.isFocusedOverlay(), false)) return undefined;\n\n\t\t// Returning `consume` below skips pi-tui's post-listener phase. Mirror its\n\t\t// overlay-focus repair before reading the focused component so a resize\n\t\t// cannot send a gated key to an invisible overlay.\n\t\tthis.repairOverlayFocus();\n\t\tconst focused = this.getFocusedComponent();\n\t\tconst tui = this as unknown as TuiOverlayInternals;\n\t\tif (focused?.handleInput && (!isKeyRelease(data) || focused.wantsKeyRelease === true)) {\n\t\t\tconst handleInput = focused.handleInput as (\n\t\t\t\tdata: string,\n\t\t\t) => boolean | undefined | Promise<boolean | undefined>;\n\t\t\tconst result = handleInput.call(focused, data);\n\t\t\tif (result instanceof Promise) {\n\t\t\t\tvoid result.then(\n\t\t\t\t\t(handled) => {\n\t\t\t\t\t\tif (handled === true) {\n\t\t\t\t\t\t\tthis.forwardSelectionMouseInput(viewportListener, data, focused);\n\t\t\t\t\t\t\ttui.requestImmediateRender();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.declineAsyncViewportInput(viewportListener, data, focused);\n\t\t\t\t\t},\n\t\t\t\t\t() => this.declineAsyncViewportInput(viewportListener, data, focused),\n\t\t\t\t);\n\t\t\t\treturn { consume: true };\n\t\t\t}\n\t\t\tif (result === true) {\n\t\t\t\tthis.forwardSelectionMouseInput(viewportListener, data, focused);\n\t\t\t\ttui.requestImmediateRender();\n\t\t\t\treturn { consume: true };\n\t\t\t}\n\t\t}\n\n\t\tif (this.handleOverlayUnhandledInput(data, focused)) {\n\t\t\ttui.requestImmediateRender();\n\t\t\treturn { consume: true };\n\t\t}\n\t\tthis.replayViewportInput(viewportListener, data);\n\t\treturn { consume: true };\n\t}\n}\n\n/**\n * CI detection follows the convention CI providers actually use: the variable\n * is SET AND NONEMPTY, with any value. GitHub Actions sets `CI=true`, but\n * other providers and users export arbitrary values (`CI=github-actions`,\n * `CI=circleci`); an allowlist of truthy spellings let those reach the\n * alternate screen and write escape sequences into CI logs (Greptile P1 on\n * PR #2308). Only explicit opt-outs (`0`, `false`, empty) read as not-CI.\n */\nfunction isCiEnvironment(value: string | undefined): boolean {\n\tif (value === undefined) return false;\n\tconst normalized = value.trim().toLowerCase();\n\treturn normalized !== \"\" && normalized !== \"0\" && normalized !== \"false\";\n}\n\nfunction shouldUseFullscreenTui(usesInjectedTerminal: boolean): boolean {\n\tif (process.env.TERM?.toLowerCase() === \"dumb\") return false;\n\tif (usesInjectedTerminal) return true;\n\treturn process.stdin.isTTY === true && process.stdout.isTTY === true && !isCiEnvironment(process.env.CI);\n}\n\n/**\n * Build Atomic's fullscreen renderer, `viewportInputGate` included, without\n * consulting the environment. `createInteractiveTui` calls this whenever\n * fullscreen applies; fixtures that assert fullscreen behavior call it\n * directly, because `shouldUseFullscreenTui` returns the main-screen fallback\n * under `TERM=dumb` even for an injected terminal and would otherwise hand\n * those tests a renderer with no layout and no gate.\n */\nexport function createFullscreenTui(options: InteractiveTuiOptions): TuiAltScreen {\n\treturn new AtomicTuiAltScreen(\n\t\toptions.terminal ?? new ProcessTerminal(),\n\t\toptions.showHardwareCursor,\n\t\toptions.logDirectory,\n\t\t{\n\t\t\topenUrl: (url) =>\n\t\t\t\thandleUrlActivation(url, {\n\t\t\t\t\tonOverlayInternalUiAction: options.onOverlayInternalUiAction,\n\t\t\t\t\tonInternalUiAction: options.onInternalUiAction,\n\t\t\t\t\topenUrl: openBrowser,\n\t\t\t\t}),\n\t\t\tonRightClickPaste: options.onRightClickPaste,\n\t\t\tcopySelection: options.copySelection ?? copySelectionToHostClipboard,\n\t\t},\n\t\toptions.shouldHandleViewportInput,\n\t\toptions.onOverlayUnhandledInput,\n\t);\n}\n\n/** Main-screen fallback renderer, carrying the same central mark strip as the fullscreen one. */\nclass AtomicTuiMainScreen extends TuiMainScreen {\n\tprotected override applyLineResets(lines: string[]): string[] {\n\t\treturn stripOverlayActiveRowMarker(super.applyLineResets(lines));\n\t}\n}\n\n/** Creates the fullscreen renderer for interactive TTY sessions. */\nexport function createInteractiveTui(options: InteractiveTuiOptions): InteractiveTui {\n\tconst usesInjectedTerminal = options.terminal !== undefined;\n\tconst terminal = options.terminal ?? new ProcessTerminal();\n\tif (!shouldUseFullscreenTui(usesInjectedTerminal)) {\n\t\t// The normal CLI never reaches the interactive mode without a TTY. Keep a\n\t\t// main-screen renderer for internal harnesses and guarded fallback paths.\n\t\treturn new AtomicTuiMainScreen(terminal, options.showHardwareCursor, options.logDirectory);\n\t}\n\treturn createFullscreenTui({ ...options, terminal });\n}\n\n/** Keeps existing components pointed at the renderer selected at runtime. */\nexport function createInteractiveTuiReference(getTui: () => TUI): TUI {\n\treturn new Proxy({} as TUI, {\n\t\tget: (_target, property) => {\n\t\t\tconst tui = getTui();\n\t\t\tconst value = Reflect.get(tui, property, tui);\n\t\t\tif (typeof value !== \"function\") return value;\n\t\t\tlet methodTui = tui;\n\t\t\tlet method = value;\n\t\t\treturn (...args: unknown[]) => {\n\t\t\t\tconst currentTui = getTui();\n\t\t\t\tif (currentTui !== methodTui) {\n\t\t\t\t\tconst currentMethod = Reflect.get(currentTui, property, currentTui);\n\t\t\t\t\tif (typeof currentMethod !== \"function\") {\n\t\t\t\t\t\tthrow new TypeError(`TUI property ${String(property)} is not callable`);\n\t\t\t\t\t}\n\t\t\t\t\tmethodTui = currentTui;\n\t\t\t\t\tmethod = currentMethod;\n\t\t\t\t}\n\t\t\t\treturn Reflect.apply(method, methodTui, args);\n\t\t\t};\n\t\t},\n\t\tset: (_target, property, value) => {\n\t\t\tconst tui = getTui();\n\t\t\treturn Reflect.set(tui, property, value, tui);\n\t\t},\n\t\thas: (_target, property) => Reflect.has(getTui(), property),\n\t\tgetPrototypeOf: () => Reflect.getPrototypeOf(getTui()),\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,UAAU,CAAC;oBACvB,MAAM,GAAG,aAAa,CAAC;gBACxB,CAAC;gBACD,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;YAC/C,CAAC,CAAC;QACH,CAAC;QACD,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;YACjC,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;YACrB,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAC/C,CAAC;QACD,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC;QAC3D,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;KACtD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n\ttype Component,\n\tisKeyRelease,\n\tProcessTerminal,\n\ttype Terminal,\n\ttype TUI,\n\tTuiAltScreen,\n\ttype TuiInputListener,\n\tTuiMainScreen,\n} from \"@earendil-works/pi-tui\";\nimport { stripOverlayActiveRowMarker } from \"../../core/extensions/ui-types.ts\";\nimport { copyToClipboard } from \"../../utils/clipboard.ts\";\nimport { openBrowser } from \"../../utils/open-browser.ts\";\nimport { TRANSCRIPT_JUMP_TO_END_URL } from \"./components/transcript-follow-indicator.ts\";\n\ninterface TuiOverlayEntry {\n\tcomponent: Component;\n\tpreFocus: Component | null;\n}\n\ninterface InternalUiActionOverlay extends Component {\n\thandlesInternalUiAction?: boolean;\n}\n\ntype TuiOverlayFocusRestore =\n\t| { status: \"inactive\" }\n\t| { status: \"eligible\"; overlay: TuiOverlayEntry }\n\t| {\n\t\t\tstatus: \"blocked\";\n\t\t\toverlay: TuiOverlayEntry;\n\t\t\tblockedBy: Component;\n\t\t\tresume: { status: \"restore-overlay\" } | { status: \"focus-target\"; target: Component | null };\n\t };\n\ninterface TuiOverlayInternals {\n\toverlayStack: TuiOverlayEntry[];\n\tisOverlayVisible(entry: TuiOverlayEntry): boolean;\n\tgetTopmostVisibleOverlay(): TuiOverlayEntry | undefined;\n\tsetFocusInternal(options: { component: Component | null; overlayFocusRestore: \"preserve\" }): void;\n\tgetVisibleOverlayFocusRestore(): TuiOverlayFocusRestore;\n\tclearOverlayFocusRestore(): void;\n\trequestImmediateRender(): void;\n}\n/** pi-tui 0.84.2 keeps this canonical mouse predicate private (tui-alt-screen.d.ts:114). */\ninterface TuiAltScreenMouseInternals {\n\tisMouseSequence(data: string): boolean;\n}\n\n/** pi-tui 0.84.2 keeps its overlay-deferral predicate private (tui-alt-screen.d.ts:84). */\ninterface TuiAltScreenViewportDeferral {\n\tshouldDeferViewportInputToOverlay?(): boolean;\n}\n\ninterface TuiAltScreenSelectionInternals {\n\tselectionAnchor?: unknown;\n\tselectionFocus?: unknown;\n\tselectionInitialRange?: unknown;\n\tselectionPressActive: boolean;\n\tselectionDragged: boolean;\n\tlastClick?: unknown;\n}\n\nexport type InteractiveTui = TuiMainScreen | TuiAltScreen;\n\nexport function isOverlayMounted(tui: TUI, component: Component): boolean {\n\tconst internals = tui as unknown as Partial<TuiOverlayInternals>;\n\treturn (\n\t\tArray.isArray(internals.overlayStack) && internals.overlayStack.some((entry) => entry.component === component)\n\t);\n}\nexport function getFocusedOverlay(tui: InteractiveTui): Component | undefined {\n\tconst focused = tui.getFocusedComponent();\n\tif (!focused) return undefined;\n\tconst internals = tui as unknown as Partial<TuiOverlayInternals>;\n\tif (!Array.isArray(internals.overlayStack) || typeof internals.isOverlayVisible !== \"function\") return undefined;\n\tconst entry = internals.overlayStack.find((candidate) => candidate.component === focused);\n\treturn entry && internals.isOverlayVisible(entry) ? focused : undefined;\n}\n\nexport function handleFocusedOverlayInternalUiAction(tui: InteractiveTui, url: string): InternalUiActionResult {\n\tconst overlay = getFocusedOverlay(tui);\n\tif (!overlay || (overlay as InternalUiActionOverlay).handlesInternalUiAction !== true) return undefined;\n\tconst handleInput = overlay.handleInput as\n\t\t| ((data: string) => boolean | undefined | Promise<boolean | undefined>)\n\t\t| undefined;\n\treturn handleInput?.call(overlay, url);\n}\n\nexport type InternalUiActionResult = boolean | undefined | Promise<boolean | undefined>;\n\nexport interface InteractiveTuiOptions {\n\tshowHardwareCursor: boolean;\n\tlogDirectory: string;\n\tterminal?: Terminal;\n\tcopyOnSelect?: boolean;\n\tonRightClickPaste?: () => void;\n\tonOverlayInternalUiAction?: (url: string) => InternalUiActionResult;\n\tonInternalUiAction?: (url: string) => InternalUiActionResult;\n\t/**\n\t * Return false to let a focused overlay receive viewport input first.\n\t * Mouse input is deferred only while the focused component belongs to an\n\t * overlay; non-overlay focus keeps pi-tui's transcript selection path.\n\t */\n\tshouldHandleViewportInput?: (\n\t\tdata: string,\n\t\tisMouseInput: boolean,\n\t\tfocusedIsOverlay: boolean,\n\t\t_focusedIsViewportSearch: boolean,\n\t) => boolean;\n\t/** Handle an unconsumed overlay input before replaying it to the viewport. */\n\tonOverlayUnhandledInput?: (data: string) => boolean;\n\t/**\n\t * Copy selected text to the system clipboard; resolve false when the host\n\t * clipboard never received it. Defaults to Atomic's `copyToClipboard` with\n\t * its platform fallbacks, so pi-tui flashes \"Copy failed\" on a terminal\n\t * whose clipboard stayed untouched (upstream #8110) instead of the old\n\t * unconditional \"Copied!\". Injectable so hosts and tests observe the write.\n\t */\n\tcopySelection?: (text: string) => Promise<boolean>;\n}\n\n/** The default selection-copy route: Atomic's host clipboard write. */\nasync function copySelectionToHostClipboard(text: string): Promise<boolean> {\n\ttry {\n\t\tawait copyToClipboard(text);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport interface UrlActivationHandlers {\n\tonOverlayInternalUiAction?: (url: string) => InternalUiActionResult;\n\tonInternalUiAction?: (url: string) => InternalUiActionResult;\n\topenUrl: (url: string) => void;\n}\n\nfunction fallbackInternalUiAction(url: string, handlers: UrlActivationHandlers): void {\n\thandlers.onInternalUiAction?.(url);\n}\n\nfunction routeInternalUiAction(url: string, handlers: UrlActivationHandlers): void {\n\tlet result: InternalUiActionResult;\n\ttry {\n\t\tresult = handlers.onOverlayInternalUiAction?.(url);\n\t} catch {\n\t\tfallbackInternalUiAction(url, handlers);\n\t\treturn;\n\t}\n\tif (result instanceof Promise) {\n\t\tvoid result.then(\n\t\t\t(handled) => {\n\t\t\t\tif (handled !== true) fallbackInternalUiAction(url, handlers);\n\t\t\t},\n\t\t\t() => fallbackInternalUiAction(url, handlers),\n\t\t);\n\t\treturn;\n\t}\n\tif (result !== true) fallbackInternalUiAction(url, handlers);\n}\n\n/** Route OSC 8 activation without allowing unknown internal URLs to escape to a browser. */\nexport function handleUrlActivation(url: string, handlers: UrlActivationHandlers): void {\n\tconst internalUiScheme = \"atomic-ui:\";\n\tif (url.slice(0, internalUiScheme.length).toLowerCase() === internalUiScheme) {\n\t\tconst schemeEnd = url.indexOf(\":\");\n\t\tconst normalizedInternalUrl = `${url.slice(0, schemeEnd).toLowerCase()}${url.slice(schemeEnd)}`;\n\t\t// Forward the normalized URL: overlay-side matching is exact, so a\n\t\t// mixed-case scheme must not reach an overlay as an unrecognized string.\n\t\tif (normalizedInternalUrl === TRANSCRIPT_JUMP_TO_END_URL) routeInternalUiAction(normalizedInternalUrl, handlers);\n\t\treturn;\n\t}\n\n\thandlers.openUrl(url);\n}\n\nconst viewportInputListeners = new WeakSet<AtomicTuiAltScreen>();\n\ntype ViewportInputGate = (\n\tdata: string,\n\tisMouseInput: boolean,\n\tfocusedIsOverlay: boolean,\n\t_focusedIsViewportSearch: boolean,\n) => boolean;\n\nconst viewportInputGates = new WeakMap<AtomicTuiAltScreen, ViewportInputGate>();\nconst overlayUnhandledInputHandlers = new WeakMap<AtomicTuiAltScreen, (data: string) => boolean>();\n/** Instances currently replaying overlay-declined input into pi-tui's viewport listener. */\nconst viewportInputReplays = new WeakSet<AtomicTuiAltScreen>();\n/** Selections begun over Atomic overlays must never trigger or survive into main-chat clipboard actions. */\nconst overlayOwnedSelections = new WeakSet<AtomicTuiAltScreen>();\ninterface ViewportInputSubscription {\n\tviewportUnsubscribe: () => void;\n\trouteListener: TuiInputListener;\n\trouteUnsubscribe: () => void;\n}\n\nconst viewportInputSubscriptions = new WeakMap<AtomicTuiAltScreen, ViewportInputSubscription>();\n\n/** A complete SGR or X10 mouse report extracted from an input chunk. */\ninterface ParsedMouseSequence {\n\treadonly data: string;\n\treadonly button: number;\n\treadonly isRelease: boolean;\n}\n\nconst SGR_MOUSE_SEQUENCE = /^\\x1b\\[<(\\d+);\\d+;\\d+([Mm])/;\nconst LEFT_MOUSE_MODIFIER_MASK = 4 | 8 | 16;\n\nfunction parseMouseSequences(data: string): ParsedMouseSequence[] | undefined {\n\tif (data.length === 0) return undefined;\n\tconst sequences: ParsedMouseSequence[] = [];\n\tlet offset = 0;\n\twhile (offset < data.length) {\n\t\tconst remaining = data.slice(offset);\n\t\tconst sgr = SGR_MOUSE_SEQUENCE.exec(remaining);\n\t\tif (sgr) {\n\t\t\tconst sequence = sgr[0]!;\n\t\t\tsequences.push({ data: sequence, button: Number.parseInt(sgr[1]!, 10), isRelease: sgr[2] === \"m\" });\n\t\t\toffset += sequence.length;\n\t\t\tcontinue;\n\t\t}\n\t\tif (remaining.startsWith(\"\\x1b[M\") && remaining.length >= 6) {\n\t\t\tconst sequence = remaining.slice(0, 6);\n\t\t\tsequences.push({ data: sequence, button: sequence.charCodeAt(3) - 32, isRelease: false });\n\t\t\toffset += 6;\n\t\t\tcontinue;\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn sequences;\n}\n\n/** Whether every report in a mouse chunk is a vertical wheel event. */\nexport function isMouseWheelInput(data: string): boolean {\n\tconst sequences = parseMouseSequences(data);\n\treturn (\n\t\tsequences !== undefined &&\n\t\tsequences.length > 0 &&\n\t\tsequences.every(({ button }) => {\n\t\t\tconst direction = button & 3;\n\t\t\treturn (button & 64) !== 0 && (direction === 0 || direction === 1);\n\t\t})\n\t);\n}\n\nfunction isLeftMouseButton(sequence: ParsedMouseSequence): boolean {\n\tconst { button } = sequence;\n\tif ((button & 64) !== 0) return false;\n\tconst held = button & 3;\n\t// A release carries no button identity on the terminals upstream #7963\n\t// describes: they report the generic SGR code 3 rather than 0. pi-tui 0.84.2\n\t// ends a selection on `release && (button & 3) === 3`\n\t// (`dist/tui-alt-screen.js:796`), so a release Atomic drops here leaves the\n\t// press it already forwarded open — the selection never closes and the OSC 8\n\t// link under the press never activates. Shift, Meta/Option, and Ctrl are\n\t// application-bypass gestures on press and motion, but a release can retain\n\t// those bits and still has to close a selection.\n\tif (sequence.isRelease) return held === 0 || held === 3;\n\treturn held === 0 && (button & LEFT_MOUSE_MODIFIER_MASK) === 0;\n}\n\n/** Whether a mouse chunk contains a left-button selection gesture. */\nfunction isLeftMouseSequence(data: string): boolean {\n\treturn parseMouseSequences(data)?.some((sequence) => isLeftMouseButton(sequence)) ?? false;\n}\n\n/**\n * Replay a chunk one report at a time because pi-tui parses one report per\n * call. Only a chunk whose every byte is a mouse report is split; anything else\n * is replayed verbatim.\n *\n * **Probe, pi 0.84.2 (upstream `2a95ef70`, `06ed8716`):** neither the\n * lone-ESC timeout scope nor the split-`Alt+Enter` reassembly is affected by\n * this replay. Both land in `StdinBuffer`/`ProcessTerminal`\n * (`dist/stdin-buffer.js:process`, `dist/terminal.js:48`), which assemble\n * complete sequences before any listener runs; Atomic builds pi-tui's own\n * `ProcessTerminal` in `createFullscreenTui`/`createInteractiveTui` below and\n * overrides neither the buffer nor its escape timeout. A reassembled `\\x1b` or\n * `\\x1b\\r` reaches this function as one chunk, fails `parseMouseSequences`, and\n * is handed on unsplit — so a viewport action bound to `escape` or `alt+enter`\n * still matches after a decline.\n * Outcome: no breakage, no fix needed — covered by the replay probes in\n * `test/pi-0.84.2-overlay-viewport-deferral.test.ts`.\n */\nfunction replayMouseInput(viewportListener: TuiInputListener, data: string): void {\n\tconst sequences = parseMouseSequences(data);\n\tif (!sequences) {\n\t\tviewportListener(data);\n\t\treturn;\n\t}\n\tfor (const sequence of sequences) viewportListener(sequence.data);\n}\n\n/**\n * The first `addInputListener` call is load-bearing: pi-tui 0.84.2 registers\n * its viewport listener from `TuiAltScreen`'s constructor\n * (`dist/tui-alt-screen.js:85`). Keep the viewport wrapper first so mouse,\n * selection, and focus cleanup retain pi-tui's ordering. Put the focused-input\n * route last so application listeners still receive deferred viewport keys.\n */\nclass AtomicTuiAltScreen extends TuiAltScreen {\n\tconstructor(\n\t\tterminal: Terminal,\n\t\tshowHardwareCursor: boolean,\n\t\tlogDirectory: string,\n\t\toptions: ConstructorParameters<typeof TuiAltScreen>[3],\n\t\tviewportInputGate?: ViewportInputGate,\n\t\tonOverlayUnhandledInput?: (data: string) => boolean,\n\t) {\n\t\tsuper(terminal, showHardwareCursor, logDirectory, options);\n\t\tif (viewportInputGate) viewportInputGates.set(this, viewportInputGate);\n\t\tif (onOverlayUnhandledInput) overlayUnhandledInputHandlers.set(this, onOverlayUnhandledInput);\n\t\t// pi-tui 0.84.2 added `shouldDeferViewportInputToOverlay()`, which drops\n\t\t// viewport keys and wheel reports while an overlay holds focus (upstream\n\t\t// #7894). Atomic's gate offers that input to the focused overlay first and\n\t\t// replays only what the overlay declined (#2378 / PR #2381); pi-tui then\n\t\t// defers the replay a second time and the transcript freezes behind an\n\t\t// open dialog. Suppress the native answer for the replay alone. Input the\n\t\t// gate never routed through the overlay keeps pi-tui's routing and its\n\t\t// own deferral.\n\t\tconst deferral = this as unknown as TuiAltScreenViewportDeferral;\n\t\tconst deferToOverlay = deferral.shouldDeferViewportInputToOverlay?.bind(this);\n\t\tdeferral.shouldDeferViewportInputToOverlay = () => !viewportInputReplays.has(this) && deferToOverlay?.() === true;\n\t}\n\n\t/**\n\t * Last stop before pi-tui turns the composited screen into bytes, and where\n\t * it already removes its own `CURSOR_MARKER`. Every component tree that this\n\t * renderer paints converges here, so one strip covers the overlay, inline,\n\t * widget, and workflows stage-chat mounts at once — including hosts that\n\t * never call `ReservedBottomOverlay.takeActiveRow`. The mark is zero-width,\n\t * so removing it after cursor extraction cannot move a column.\n\t */\n\tprotected override applyLineResets(lines: string[]): string[] {\n\t\tif (overlayOwnedSelections.has(this) && !this.isFocusedOverlay()) this.clearOverlayOwnedSelection();\n\t\treturn stripOverlayActiveRowMarker(super.applyLineResets(lines));\n\t}\n\n\tprivate clearOverlayOwnedSelection(): void {\n\t\tconst selection = this as unknown as TuiAltScreenSelectionInternals;\n\t\tselection.selectionAnchor = undefined;\n\t\tselection.selectionFocus = undefined;\n\t\tselection.selectionInitialRange = undefined;\n\t\tselection.selectionPressActive = false;\n\t\tselection.selectionDragged = false;\n\t\tselection.lastClick = undefined;\n\t\toverlayOwnedSelections.delete(this);\n\t}\n\n\t/**\n\t * Keep pi-tui's private predicate as the fallback for its single-report\n\t * grammar. Injected terminals can deliver coalesced reports, so parse those\n\t * chunks locally before asking pi-tui about an unparsed value.\n\t */\n\tprivate isPiTuiMouseSequence(data: string): boolean {\n\t\tif (parseMouseSequences(data)) return true;\n\t\tconst predicate = (this as unknown as Partial<TuiAltScreenMouseInternals>).isMouseSequence;\n\t\treturn typeof predicate === \"function\" ? predicate.call(this, data) : false;\n\t}\n\n\tprivate isFocusedOverlay(): boolean {\n\t\tconst tui = this as unknown as TuiOverlayInternals;\n\t\treturn tui.overlayStack.some((entry) => entry.component === this.getFocusedComponent());\n\t}\n\n\toverride addInputListener(listener: TuiInputListener): () => void {\n\t\tif (!viewportInputListeners.has(this)) {\n\t\t\tviewportInputListeners.add(this);\n\t\t\tconst subscription: ViewportInputSubscription = {\n\t\t\t\tviewportUnsubscribe: () => {},\n\t\t\t\trouteListener: (data) => this.routeViewportInput(listener, data),\n\t\t\t\trouteUnsubscribe: () => {},\n\t\t\t};\n\t\t\tviewportInputSubscriptions.set(this, subscription);\n\t\t\tsubscription.viewportUnsubscribe = super.addInputListener((data) => {\n\t\t\t\tconst gate = viewportInputGates.get(this);\n\t\t\t\tconst isMouseInput = gate ? this.isPiTuiMouseSequence(data) : false;\n\t\t\t\tif (gate && !gate(data, isMouseInput, this.isFocusedOverlay(), false)) return undefined;\n\t\t\t\treturn listener(data);\n\t\t\t});\n\t\t\tsubscription.routeUnsubscribe = super.addInputListener(subscription.routeListener);\n\t\t\treturn () => {\n\t\t\t\tsubscription.viewportUnsubscribe();\n\t\t\t\tsubscription.routeUnsubscribe();\n\t\t\t\tviewportInputSubscriptions.delete(this);\n\t\t\t\tviewportInputListeners.delete(this);\n\t\t\t};\n\t\t}\n\n\t\tconst subscription = viewportInputSubscriptions.get(this);\n\t\tif (!subscription) return super.addInputListener(listener);\n\t\tsubscription.routeUnsubscribe();\n\t\tconst unsubscribe = super.addInputListener(listener);\n\t\tsubscription.routeUnsubscribe = super.addInputListener(subscription.routeListener);\n\t\treturn unsubscribe;\n\t}\n\n\tprivate repairOverlayFocus(): void {\n\t\tconst tui = this as unknown as TuiOverlayInternals;\n\t\tconst focused = this.getFocusedComponent();\n\t\tconst focusedOverlay = tui.overlayStack.find((entry) => entry.component === focused);\n\t\tif (focusedOverlay && !tui.isOverlayVisible(focusedOverlay)) {\n\t\t\tconst topVisible = tui.getTopmostVisibleOverlay();\n\t\t\tif (topVisible) {\n\t\t\t\tthis.setFocus(topVisible.component);\n\t\t\t} else {\n\t\t\t\ttui.setFocusInternal({ component: focusedOverlay.preFocus, overlayFocusRestore: \"preserve\" });\n\t\t\t}\n\t\t}\n\n\t\tconst focusIsOverlay = tui.overlayStack.some((entry) => entry.component === this.getFocusedComponent());\n\t\tif (focusIsOverlay) return;\n\n\t\tconst restoreState = tui.getVisibleOverlayFocusRestore();\n\t\tif (restoreState.status === \"eligible\") {\n\t\t\tthis.setFocus(restoreState.overlay.component);\n\t\t} else if (restoreState.status === \"blocked\" && restoreState.blockedBy !== this.getFocusedComponent()) {\n\t\t\tif (restoreState.resume.status === \"restore-overlay\") {\n\t\t\t\tthis.setFocus(restoreState.overlay.component);\n\t\t\t} else {\n\t\t\t\ttui.clearOverlayFocusRestore();\n\t\t\t\tthis.setFocus(restoreState.resume.target);\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Keep pi-tui's selection state in sync while an overlay handles a left gesture. */\n\tprivate forwardSelectionMouseInput(viewportListener: TuiInputListener, data: string, focused: Component): void {\n\t\tif (this.getFocusedComponent() !== focused || !isLeftMouseSequence(data)) return;\n\t\tfor (const sequence of parseMouseSequences(data) ?? []) {\n\t\t\tif (isLeftMouseButton(sequence)) viewportListener(sequence.data);\n\t\t}\n\t\toverlayOwnedSelections.add(this);\n\t}\n\t/**\n\t * Replay input the focused overlay declined. pi-tui's native overlay\n\t * deferral is suppressed for the duration, because this chunk has already\n\t * been offered to the overlay it would defer to.\n\t */\n\tprivate replayViewportInput(viewportListener: TuiInputListener, data: string): void {\n\t\tviewportInputReplays.add(this);\n\t\ttry {\n\t\t\treplayMouseInput(viewportListener, data);\n\t\t} finally {\n\t\t\tviewportInputReplays.delete(this);\n\t\t}\n\t}\n\t/** Dispatch a declined chunk to the host action the gated route owns. */\n\tprivate handleOverlayUnhandledInput(data: string, focused: Component | null): boolean {\n\t\tif (this.getFocusedComponent() !== focused || !this.isFocusedOverlay()) return false;\n\t\treturn overlayUnhandledInputHandlers.get(this)?.(data) === true;\n\t}\n\n\t/**\n\t * Finish a chunk a focused overlay's asynchronous handler declined.\n\t *\n\t * Every settled result other than `true` is a decline. The component\n\t * contract is `boolean | undefined | Promise<boolean | undefined>`\n\t * (`ExtensionCustomComponent`), and both `docs/tui.md` and\n\t * `docs/extensions.md` document `false` *and* `undefined` as viewport\n\t * fallthrough, so a promise resolving `undefined` has to replay exactly like\n\t * one resolving `false` — matching only literal `false` consumed the key and\n\t * froze the transcript. A rejection is a decline for the same reason: the\n\t * overlay produced no answer.\n\t *\n\t * The focus guard stays: input that moved focus while the promise was\n\t * pending belongs to whatever holds focus now, not to the transcript.\n\t */\n\tprivate declineAsyncViewportInput(viewportListener: TuiInputListener, data: string, focused: Component): void {\n\t\tif (this.getFocusedComponent() !== focused) return;\n\t\tif (this.handleOverlayUnhandledInput(data, focused)) {\n\t\t\t(this as unknown as TuiOverlayInternals).requestImmediateRender();\n\t\t\treturn;\n\t\t}\n\t\tthis.replayViewportInput(viewportListener, data);\n\t}\n\n\tprivate routeViewportInput(viewportListener: TuiInputListener, data: string): ReturnType<TuiInputListener> {\n\t\tconst gate = viewportInputGates.get(this);\n\t\tconst isMouseInput = gate ? this.isPiTuiMouseSequence(data) : false;\n\t\tif (!gate || gate(data, isMouseInput, this.isFocusedOverlay(), false)) return undefined;\n\n\t\t// Returning `consume` below skips pi-tui's post-listener phase. Mirror its\n\t\t// overlay-focus repair before reading the focused component so a resize\n\t\t// cannot send a gated key to an invisible overlay.\n\t\tthis.repairOverlayFocus();\n\t\tconst focused = this.getFocusedComponent();\n\t\tconst tui = this as unknown as TuiOverlayInternals;\n\t\tif (focused?.handleInput && (!isKeyRelease(data) || focused.wantsKeyRelease === true)) {\n\t\t\tconst handleInput = focused.handleInput as (\n\t\t\t\tdata: string,\n\t\t\t) => boolean | undefined | Promise<boolean | undefined>;\n\t\t\tconst result = handleInput.call(focused, data);\n\t\t\tif (result instanceof Promise) {\n\t\t\t\tvoid result.then(\n\t\t\t\t\t(handled) => {\n\t\t\t\t\t\tif (handled === true) {\n\t\t\t\t\t\t\tthis.forwardSelectionMouseInput(viewportListener, data, focused);\n\t\t\t\t\t\t\ttui.requestImmediateRender();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.declineAsyncViewportInput(viewportListener, data, focused);\n\t\t\t\t\t},\n\t\t\t\t\t() => this.declineAsyncViewportInput(viewportListener, data, focused),\n\t\t\t\t);\n\t\t\t\treturn { consume: true };\n\t\t\t}\n\t\t\tif (result === true) {\n\t\t\t\tthis.forwardSelectionMouseInput(viewportListener, data, focused);\n\t\t\t\ttui.requestImmediateRender();\n\t\t\t\treturn { consume: true };\n\t\t\t}\n\t\t}\n\n\t\tif (this.handleOverlayUnhandledInput(data, focused)) {\n\t\t\ttui.requestImmediateRender();\n\t\t\treturn { consume: true };\n\t\t}\n\t\tthis.replayViewportInput(viewportListener, data);\n\t\treturn { consume: true };\n\t}\n}\n\n/**\n * CI detection follows the convention CI providers actually use: the variable\n * is SET AND NONEMPTY, with any value. GitHub Actions sets `CI=true`, but\n * other providers and users export arbitrary values (`CI=github-actions`,\n * `CI=circleci`); an allowlist of truthy spellings let those reach the\n * alternate screen and write escape sequences into CI logs (Greptile P1 on\n * PR #2308). Only explicit opt-outs (`0`, `false`, empty) read as not-CI.\n */\nfunction isCiEnvironment(value: string | undefined): boolean {\n\tif (value === undefined) return false;\n\tconst normalized = value.trim().toLowerCase();\n\treturn normalized !== \"\" && normalized !== \"0\" && normalized !== \"false\";\n}\n\nfunction shouldUseFullscreenTui(usesInjectedTerminal: boolean): boolean {\n\tif (process.env.TERM?.toLowerCase() === \"dumb\") return false;\n\tif (usesInjectedTerminal) return true;\n\treturn process.stdin.isTTY === true && process.stdout.isTTY === true && !isCiEnvironment(process.env.CI);\n}\n\n/**\n * Build Atomic's fullscreen renderer, `viewportInputGate` included, without\n * consulting the environment. `createInteractiveTui` calls this whenever\n * fullscreen applies; fixtures that assert fullscreen behavior call it\n * directly, because `shouldUseFullscreenTui` returns the main-screen fallback\n * under `TERM=dumb` even for an injected terminal and would otherwise hand\n * those tests a renderer with no layout and no gate.\n */\nexport function createFullscreenTui(options: InteractiveTuiOptions): TuiAltScreen {\n\treturn new AtomicTuiAltScreen(\n\t\toptions.terminal ?? new ProcessTerminal(),\n\t\toptions.showHardwareCursor,\n\t\toptions.logDirectory,\n\t\t{\n\t\t\topenUrl: (url) =>\n\t\t\t\thandleUrlActivation(url, {\n\t\t\t\t\tonOverlayInternalUiAction: options.onOverlayInternalUiAction,\n\t\t\t\t\tonInternalUiAction: options.onInternalUiAction,\n\t\t\t\t\topenUrl: openBrowser,\n\t\t\t\t}),\n\t\t\tonRightClickPaste: options.onRightClickPaste,\n\t\t\tcopyOnSelect: options.copyOnSelect,\n\t\t\tcopySelection: options.copySelection ?? copySelectionToHostClipboard,\n\t\t},\n\t\toptions.shouldHandleViewportInput,\n\t\toptions.onOverlayUnhandledInput,\n\t);\n}\n\n/** Main-screen fallback renderer, carrying the same central mark strip as the fullscreen one. */\nclass AtomicTuiMainScreen extends TuiMainScreen {\n\tprotected override applyLineResets(lines: string[]): string[] {\n\t\treturn stripOverlayActiveRowMarker(super.applyLineResets(lines));\n\t}\n}\n\n/** Creates the fullscreen renderer for interactive TTY sessions. */\nexport function createInteractiveTui(options: InteractiveTuiOptions): InteractiveTui {\n\tconst usesInjectedTerminal = options.terminal !== undefined;\n\tconst terminal = options.terminal ?? new ProcessTerminal();\n\tif (!shouldUseFullscreenTui(usesInjectedTerminal)) {\n\t\t// The normal CLI never reaches the interactive mode without a TTY. Keep a\n\t\t// main-screen renderer for internal harnesses and guarded fallback paths.\n\t\treturn new AtomicTuiMainScreen(terminal, options.showHardwareCursor, options.logDirectory);\n\t}\n\treturn createFullscreenTui({ ...options, terminal });\n}\n\n/** Keeps existing components pointed at the renderer selected at runtime. */\nexport function createInteractiveTuiReference(getTui: () => TUI): TUI {\n\treturn new Proxy({} as TUI, {\n\t\tget: (_target, property) => {\n\t\t\tconst tui = getTui();\n\t\t\tconst value = Reflect.get(tui, property, tui);\n\t\t\tif (typeof value !== \"function\") return value;\n\t\t\tlet methodTui = tui;\n\t\t\tlet method = value;\n\t\t\treturn (...args: unknown[]) => {\n\t\t\t\tconst currentTui = getTui();\n\t\t\t\tif (currentTui !== methodTui) {\n\t\t\t\t\tconst currentMethod = Reflect.get(currentTui, property, currentTui);\n\t\t\t\t\tif (typeof currentMethod !== \"function\") {\n\t\t\t\t\t\tthrow new TypeError(`TUI property ${String(property)} is not callable`);\n\t\t\t\t\t}\n\t\t\t\t\tmethodTui = currentTui;\n\t\t\t\t\tmethod = currentMethod;\n\t\t\t\t}\n\t\t\t\treturn Reflect.apply(method, methodTui, args);\n\t\t\t};\n\t\t},\n\t\tset: (_target, property, value) => {\n\t\t\tconst tui = getTui();\n\t\t\treturn Reflect.set(tui, property, value, tui);\n\t\t},\n\t\thas: (_target, property) => Reflect.has(getTui(), property),\n\t\tgetPrototypeOf: () => Reflect.getPrototypeOf(getTui()),\n\t});\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-session-binding.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-session-binding.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rpc-session-binding.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-session-binding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAG/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAEjG,OAAO,EAA+B,KAAK,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACtG,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,UAAU,wBAAwB;IACjC,WAAW,EAAE,mBAAmB,CAAC;IACjC,MAAM,EAAE,SAAS,CAAC;IAClB,wBAAwB,EAAE,2BAA2B,CAAC;IACtD,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,aAAa,CAAC,EAAE,0BAA0B,CAAC;IAC3C,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,4BAA4B,CAAC,YAAY,CAAC,CAAC;CAC/D;AAED,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,uBAAuB,CAAC,CAAa;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAsB;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA8B;IACvE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoC;IAC7D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAChE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAyC;IACvE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqC;IAC/D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAa;IAC7C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAyD;IAE3F,OAAO,CAAC,kBAAkB,CAAiC;IAC3D,YAAY,EACX,WAAW,EACX,MAAM,EACN,wBAAwB,EACxB,eAAe,EACf,QAAQ,EACR,aAAa,EACb,aAAa,EACb,SAAS,EACT,iBAAiB,GACjB,EAAE,wBAAwB,EAW1B;IAED,IAAI,cAAc,IAAI,YAAY,CAEjC;IAEK,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAkFnC;IAED,oBAAoB,IAAI,IAAI,CAO3B;CACD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setCapabilityOverrides } from "@earendil-works/pi-tui";
|
|
1
2
|
import { FooterDataProvider } from "../../core/footer-data-provider.js";
|
|
2
3
|
import { waitForRawStdoutBackpressure } from "../../core/output-guard.js";
|
|
3
4
|
import { toJsonEvent } from "../json-event.js";
|
|
@@ -22,6 +23,7 @@ export class RpcSessionBinding {
|
|
|
22
23
|
this.session = this.runtimeHost.session;
|
|
23
24
|
this.disposeSubscriptions();
|
|
24
25
|
const session = this.session;
|
|
26
|
+
setCapabilityOverrides(session.settingsManager.getTerminalCapabilityOverrides());
|
|
25
27
|
this.renderService?.bindSession(session);
|
|
26
28
|
this.footerDataProvider = new FooterDataProvider(session.sessionManager.getCwd());
|
|
27
29
|
// Seed the provider count from the current catalog snapshot, mirroring
|