@bastani/atomic 0.9.78 → 0.9.79-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +12 -0
  3. package/dist/builtin/intercom/broker/broker.ts +198 -72
  4. package/dist/builtin/intercom/broker/client-message-validation.ts +38 -0
  5. package/dist/builtin/intercom/broker/client.ts +150 -11
  6. package/dist/builtin/intercom/broker/delivery-failure-reason.ts +1 -0
  7. package/dist/builtin/intercom/broker/departed-children.ts +23 -0
  8. package/dist/builtin/intercom/broker/hosted-session-errors.ts +188 -0
  9. package/dist/builtin/intercom/broker/hosted-sessions.ts +113 -0
  10. package/dist/builtin/intercom/broker/multinode-router.ts +7 -2
  11. package/dist/builtin/intercom/broker/presence-handler.ts +2 -1
  12. package/dist/builtin/intercom/broker/protocol-version.ts +6 -1
  13. package/dist/builtin/intercom/broker/recipient-gone-errors.ts +46 -5
  14. package/dist/builtin/intercom/broker/released-reply-errors.ts +1 -1
  15. package/dist/builtin/intercom/broker/send-handler.ts +19 -3
  16. package/dist/builtin/intercom/broker/socket-writes.ts +20 -1
  17. package/dist/builtin/intercom/hosted-session-timeout-error.ts +59 -0
  18. package/dist/builtin/intercom/index.bundle.mjs +634 -125
  19. package/dist/builtin/intercom/package.json +1 -1
  20. package/dist/builtin/intercom/types.ts +41 -3
  21. package/dist/builtin/mcp/package.json +1 -1
  22. package/dist/builtin/subagents/CHANGELOG.md +8 -0
  23. package/dist/builtin/subagents/package.json +1 -1
  24. package/dist/builtin/subagents/src/extension/index.bundle.mjs +90 -34
  25. package/dist/builtin/web-access/package.json +1 -1
  26. package/dist/builtin/workflows/CHANGELOG.md +9 -0
  27. package/dist/builtin/workflows/builtin/{chunk-89we7r4p.js → chunk-5hrzxynt.js} +1 -1
  28. package/dist/builtin/workflows/builtin/{chunk-8yfssw01.js → chunk-m56qhe4b.js} +1 -1
  29. package/dist/builtin/workflows/builtin/{chunk-wh2p4qjg.js → chunk-x8m4t2jy.js} +182 -33
  30. package/dist/builtin/workflows/builtin/goal.js +2 -2
  31. package/dist/builtin/workflows/builtin/index.js +3 -3
  32. package/dist/builtin/workflows/builtin/ralph.js +2 -2
  33. package/dist/builtin/workflows/package.json +1 -1
  34. package/dist/builtin/workflows/src/extension/index.bundle.mjs +1243 -230
  35. package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +854 -170
  36. package/dist/builtin/workflows/src/index.js +854 -170
  37. package/dist/builtin/workflows/src/local-worker-entry.mjs +854 -170
  38. package/dist/cli/startup-progress.d.ts +30 -0
  39. package/dist/cli/startup-progress.d.ts.map +1 -0
  40. package/dist/cli/startup-progress.js +78 -0
  41. package/dist/cli/startup-progress.js.map +1 -0
  42. package/dist/core/agent-session-events.d.ts.map +1 -1
  43. package/dist/core/agent-session-events.js +3 -0
  44. package/dist/core/agent-session-events.js.map +1 -1
  45. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  46. package/dist/core/agent-session-extension-bindings.js +2 -0
  47. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  48. package/dist/core/agent-session-methods.d.ts +2 -0
  49. package/dist/core/agent-session-methods.d.ts.map +1 -1
  50. package/dist/core/agent-session-methods.js.map +1 -1
  51. package/dist/core/agent-session-state.d.ts +12 -4
  52. package/dist/core/agent-session-state.d.ts.map +1 -1
  53. package/dist/core/agent-session-state.js +82 -15
  54. package/dist/core/agent-session-state.js.map +1 -1
  55. package/dist/core/agent-session.d.ts +3 -0
  56. package/dist/core/agent-session.d.ts.map +1 -1
  57. package/dist/core/agent-session.js +3 -0
  58. package/dist/core/agent-session.js.map +1 -1
  59. package/dist/core/builtin-resource-loader.d.ts.map +1 -1
  60. package/dist/core/builtin-resource-loader.js +3 -0
  61. package/dist/core/builtin-resource-loader.js.map +1 -1
  62. package/dist/core/debug.d.ts +2 -0
  63. package/dist/core/debug.d.ts.map +1 -1
  64. package/dist/core/debug.js +13 -0
  65. package/dist/core/debug.js.map +1 -1
  66. package/dist/core/export-html/ansi-to-html.d.ts +5 -0
  67. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  68. package/dist/core/export-html/ansi-to-html.js +57 -20
  69. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  70. package/dist/core/export-html/template.js +1 -1
  71. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  72. package/dist/core/export-html/tool-renderer.js +2 -3
  73. package/dist/core/export-html/tool-renderer.js.map +1 -1
  74. package/dist/core/extensions/workflow-activity-hub.d.ts +7 -0
  75. package/dist/core/extensions/workflow-activity-hub.d.ts.map +1 -1
  76. package/dist/core/extensions/workflow-activity-hub.js +104 -6
  77. package/dist/core/extensions/workflow-activity-hub.js.map +1 -1
  78. package/dist/core/keybindings.d.ts +0 -8
  79. package/dist/core/keybindings.d.ts.map +1 -1
  80. package/dist/core/keybindings.js +0 -1
  81. package/dist/core/keybindings.js.map +1 -1
  82. package/dist/core/mandatory-resource-loader.d.ts.map +1 -1
  83. package/dist/core/mandatory-resource-loader.js +3 -0
  84. package/dist/core/mandatory-resource-loader.js.map +1 -1
  85. package/dist/core/resume/session-resume.d.ts +7 -1
  86. package/dist/core/resume/session-resume.d.ts.map +1 -1
  87. package/dist/core/resume/session-resume.js +136 -16
  88. package/dist/core/resume/session-resume.js.map +1 -1
  89. package/dist/core/session-history-index.d.ts +31 -0
  90. package/dist/core/session-history-index.d.ts.map +1 -0
  91. package/dist/core/session-history-index.js +82 -0
  92. package/dist/core/session-history-index.js.map +1 -0
  93. package/dist/core/session-manager-core.d.ts +3 -0
  94. package/dist/core/session-manager-core.d.ts.map +1 -1
  95. package/dist/core/session-manager-core.js +22 -17
  96. package/dist/core/session-manager-core.js.map +1 -1
  97. package/dist/core/session-manager-history.d.ts +3 -3
  98. package/dist/core/session-manager-history.d.ts.map +1 -1
  99. package/dist/core/session-manager-history.js +6 -5
  100. package/dist/core/session-manager-history.js.map +1 -1
  101. package/dist/core/storage/session/history-load-observer.d.ts +11 -0
  102. package/dist/core/storage/session/history-load-observer.d.ts.map +1 -0
  103. package/dist/core/storage/session/history-load-observer.js +25 -0
  104. package/dist/core/storage/session/history-load-observer.js.map +1 -0
  105. package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
  106. package/dist/core/storage/session/sql-session-store.js +6 -0
  107. package/dist/core/storage/session/sql-session-store.js.map +1 -1
  108. package/dist/core/tool-deactivation.d.ts +11 -0
  109. package/dist/core/tool-deactivation.d.ts.map +1 -0
  110. package/dist/core/tool-deactivation.js +13 -0
  111. package/dist/core/tool-deactivation.js.map +1 -0
  112. package/dist/core/tool-status.d.ts +6 -1
  113. package/dist/core/tool-status.d.ts.map +1 -1
  114. package/dist/core/tool-status.js +11 -3
  115. package/dist/core/tool-status.js.map +1 -1
  116. package/dist/extensions/llama/errors.js +1 -1
  117. package/dist/extensions/llama/errors.js.map +1 -1
  118. package/dist/extensions/llama/provider.d.ts +1 -1
  119. package/dist/extensions/llama/provider.js +1 -1
  120. package/dist/extensions/llama/provider.js.map +1 -1
  121. package/dist/main-session.d.ts +14 -2
  122. package/dist/main-session.d.ts.map +1 -1
  123. package/dist/main-session.js +42 -9
  124. package/dist/main-session.js.map +1 -1
  125. package/dist/main.d.ts.map +1 -1
  126. package/dist/main.js +4 -2
  127. package/dist/main.js.map +1 -1
  128. package/dist/modes/interactive/components/assistant-message.d.ts +6 -0
  129. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  130. package/dist/modes/interactive/components/assistant-message.js +13 -4
  131. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  132. package/dist/modes/interactive/components/task-detail.d.ts +1 -1
  133. package/dist/modes/interactive/components/task-detail.d.ts.map +1 -1
  134. package/dist/modes/interactive/components/task-detail.js +1 -3
  135. package/dist/modes/interactive/components/task-detail.js.map +1 -1
  136. package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
  137. package/dist/modes/interactive/components/task-inspector.js +1 -7
  138. package/dist/modes/interactive/components/task-inspector.js.map +1 -1
  139. package/dist/modes/interactive/components/task-navigation.d.ts +0 -1
  140. package/dist/modes/interactive/components/task-navigation.d.ts.map +1 -1
  141. package/dist/modes/interactive/components/task-navigation.js +1 -3
  142. package/dist/modes/interactive/components/task-navigation.js.map +1 -1
  143. package/dist/modes/interactive/interactive-agent-events.js +5 -9
  144. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  145. package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
  146. package/dist/modes/interactive/interactive-deferred-startup.js +8 -5
  147. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  148. package/dist/modes/interactive/interactive-process-lifecycle.js +16 -10
  149. package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
  150. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
  151. package/dist/modes/interactive/interactive-startup.js +2 -0
  152. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  153. package/dist/modes/interactive/interactive-unavailable-tools.d.ts +20 -0
  154. package/dist/modes/interactive/interactive-unavailable-tools.d.ts.map +1 -0
  155. package/dist/modes/interactive/interactive-unavailable-tools.js +40 -0
  156. package/dist/modes/interactive/interactive-unavailable-tools.js.map +1 -0
  157. package/dist/modes/interactive-engine/remote-component.js +1 -1
  158. package/dist/modes/interactive-engine/remote-component.js.map +1 -1
  159. package/docs/background-tasks.md +1 -1
  160. package/docs/extensions/api-reference.md +1 -1
  161. package/docs/extensions/events.md +2 -0
  162. package/docs/intercom/operations.md +2 -2
  163. package/docs/intercom/reference.md +12 -1
  164. package/docs/keybindings.md +2 -3
  165. package/docs/llama-cpp.md +9 -10
  166. package/docs/models/reference.md +1 -1
  167. package/docs/models-configuration.md +1 -1
  168. package/docs/sessions.md +6 -2
  169. package/docs/subagents.md +3 -1
  170. package/docs/usage.md +1 -1
  171. package/docs/workflows/operations.md +2 -2
  172. package/docs/worktree-snapshots.md +3 -1
  173. package/npm-shrinkwrap.json +32 -32
  174. package/package.json +4 -4
  175. package/schemas/keybindings.schema.json +0 -4
  176. package/schemas/models.schema.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-startup.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EACN,wCAAwC,EACxC,4CAA4C,EAC5C,sCAAsC,EACtC,6BAA6B,GAC7B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,cAAc,EACd,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EACN,QAAQ,EACR,SAAS,EAET,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,WAAW,EACX,UAAU,EACV,WAAW,EACX,sBAAsB,EACtB,gBAAgB,E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,EAAE,KAAK,IAAI,CAAC;AACzF,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,wBAAwB,GAAG;IACxD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,KAAK,KAAK,CAAC;AAC1F,CAAC,CAAC","sourcesContent":["import { replaceControlCharacters, ScrollView, VStack } from \"@earendil-works/pi-tui\";\nimport { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { formatModelLabel } from \"../../core/model-label.ts\";\nimport { isOfflineModeEnabled } from \"../../core/package-manager-env.ts\";\nimport { createChildProcessEnvironment } from \"../../utils/child-process.ts\";\nimport { ensurePngTranscoder } from \"../../utils/image-convert.ts\";\nimport { setMarkitDiagnosticSink } from \"../../utils/markit.js\";\nimport { shortenHomePath } from \"../../utils/paths.ts\";\nimport type { ToolStatus } from \"../../utils/tools-manager.ts\";\nimport { renderDiagnosticStatus } from \"../interactive-engine/engine-diagnostic-view.js\";\nimport {\n\tonInteractiveEngineRemoteCommandsChanged,\n\tonInteractiveEngineResourceExtensionsChanged,\n\tonInteractiveEngineSessionStatsChanged,\n\twaitForInteractiveEngineBound,\n} from \"../interactive-engine/extension-ui-bridge.ts\";\nimport {\n\tatomicWordmark,\n\trenderAtomicAssemblyBanner,\n\trenderStartupManifesto,\n\tsupportsAtomicBanner,\n} from \"./components/atomic-banner.ts\";\nimport { StartupIdentityComponent } from \"./components/startup-identity.ts\";\nimport { ThemedText } from \"./components/themed-text.js\";\nimport { bindInitialEagerSession } from \"./interactive-initial-session-binding.ts\";\nimport { InteractiveModeBase, seedStartupInput } from \"./interactive-mode-base.ts\";\nimport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\ttype Container,\n\tcheckForNewPiVersion,\n\tcomposeStartupIdentity,\n\tDefaultPackageManager,\n\tDynamicBorder,\n\tENV_OFFLINE,\n\tensureTool,\n\tgetAgentDir,\n\tgetChangelogHighlights,\n\tgetChangelogPath,\n\tgetCwdRelativePath,\n\tgetEntriesForVersion,\n\tgetEnvValue,\n\tgetMarkdownTheme,\n\tgetNewEntries,\n\tgetPiUserAgent,\n\tisInstallTelemetryEnabled,\n\ttype MarkdownTheme,\n\tnormalizeChangelogLinks,\n\tonThemeChange,\n\tparseChangelog,\n\tpath,\n\trecordTimeSinceReset,\n\tSpacer,\n\tspawn,\n\tText,\n\ttheme,\n\tVERSION,\n\tVERSION_ADOPTION_ENDPOINT,\n\tvisibleWidth,\n} from \"./interactive-mode-deps.ts\";\nimport {\n\trefreshCatalogsAfterTuiStartup,\n\tupdateProviderCountFromSnapshot,\n} from \"./interactive-model-catalog-startup.ts\";\nimport { ONBOARDING_COPY } from \"./interactive-onboarding.ts\";\nimport { holdTuiForStartupTrust } from \"./interactive-startup-trust.ts\";\nimport { restoreTerminalTitleAfterPackageCheck } from \"./interactive-terminal-title.ts\";\nimport { showSessionNotices } from \"./session-notices.ts\";\n\nexport const shouldRefreshCatalogsOnStartup = (): boolean => !isOfflineModeEnabled();\n\nfunction prepareStartupNotices(mode: InteractiveModeBase): void {\n\tif (mode.startupNoticesPrepared) return;\n\tmode.startupNoticesPrepared = true;\n\tmode.hadLastChangelogVersionAtStartup = Boolean(mode.settingsManager.getLastChangelogVersion?.());\n\tif (mode.changelogMarkdown === undefined) {\n\t\tmode.changelogMarkdown = mode.getChangelogForDisplay?.();\n\t}\n\tmode.initializeFirstRunOnboardingMarkers?.();\n\tif (!mode.firstRunNoticeVisible) {\n\t\tmode.firstRunNoticeVisible = mode.isFirstRunOnboardingEligible?.() ?? false;\n\t}\n}\n\n/**\n * Show non-fatal model-catalog warnings — today, a derived `-fast` variant suppressed because\n * something already owns that exact model ID.\n *\n * Called unconditionally at startup and again after deferred extension loading, because an extension\n * provider can introduce a collision that did not exist at startup. The last reported text is kept so\n * the second read only speaks when the diagnostic set actually changed.\n */\nInteractiveModeBase.prototype.reportModelCatalogWarning = function (\n\tthis: InteractiveModeBase,\n\ttargetContainer: Container = this.chatContainer,\n): void {\n\tconst warning = this.session.modelRuntime.getWarning?.();\n\tif (!warning || warning === this.reportedModelCatalogWarning) {\n\t\treturn;\n\t}\n\tthis.reportedModelCatalogWarning = warning;\n\tthis.showWarning(warning, targetContainer);\n};\n\nInteractiveModeBase.prototype.showStartupNoticesIfNeeded = function (\n\tthis: InteractiveModeBase,\n\ttargetContainer: Container = this.chatContainer,\n): void {\n\tif (this.startupNoticesShown) {\n\t\t// Deferred startup asks again after extensions load: redraw What's New with their transformers, don't repeat it.\n\t\tthis.startupChangelogComponent?.invalidate();\n\t\treturn;\n\t}\n\tprepareStartupNotices(this);\n\tthis.startupNoticesShown = true;\n\n\tconst changelogMarkdown = this.changelogMarkdown;\n\tif (!changelogMarkdown && !this.firstRunNoticeVisible) {\n\t\treturn;\n\t}\n\n\tif (changelogMarkdown) {\n\t\tif (targetContainer.children.length > 0) {\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t}\n\t\ttargetContainer.addChild(new DynamicBorder());\n\t\tif (this.settingsManager.getCollapseChangelog()) {\n\t\t\tconst versionMatch = changelogMarkdown.match(\n\t\t\t\t/##\\s+\\[?((?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:alpha\\.)?(?:0|[1-9]\\d*))?)\\]?/,\n\t\t\t);\n\t\t\tconst latestVersion = versionMatch ? versionMatch[1] : this.version;\n\t\t\tconst condensedText = `Updated to v${latestVersion}. Use ${theme.bold(\"/changelog\")} to view full changelog.`;\n\t\t\ttargetContainer.addChild(new Text(condensedText, 1, 0));\n\t\t} else {\n\t\t\ttargetContainer.addChild(new ThemedText(() => theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0));\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t\tthis.startupChangelogComponent = this.createChangelogMarkdown(changelogMarkdown.trim(), 1, 0);\n\t\t\ttargetContainer.addChild(this.startupChangelogComponent);\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t}\n\t\ttargetContainer.addChild(new DynamicBorder());\n\t}\n\n\tif (this.firstRunNoticeVisible) {\n\t\tthis.firstRunOnboardingNoticeComponents = [];\n\t\tif (targetContainer.children.length > 0) {\n\t\t\tthis.firstRunOnboardingNoticeComponents.push(new Spacer(1));\n\t\t}\n\t\tthis.firstRunOnboardingNoticeComponents.push(\n\t\t\tnew DynamicBorder(),\n\t\t\tnew Text(ONBOARDING_COPY, 1, 0),\n\t\t\tnew DynamicBorder(),\n\t\t\tnew Spacer(1),\n\t\t);\n\t\tfor (const component of this.firstRunOnboardingNoticeComponents) {\n\t\t\ttargetContainer.addChild(component);\n\t\t}\n\t\t// Mark completion only after queueing the notice in the chat canvas so\n\t\t// launches that skip rendering retry the first-run notice next time.\n\t\tthis.settingsManager.setOnboardedVersion(this.version);\n\t}\n\n\tthis.ui.requestRender();\n};\n\n/** Bring fd, rg, and git to readiness, reporting progress into the transcript. */\nInteractiveModeBase.prototype.ensureManagedToolsReady = function (this: InteractiveModeBase): Promise<void> {\n\tconst statusGeneration = ++this.managedToolStatusGeneration;\n\tconst reportStatus = (status: ToolStatus): void => {\n\t\tif (this.managedToolStatusGeneration === statusGeneration) this.showManagedToolStatus(status);\n\t};\n\t// Autocomplete needs only fd, so a slow rg or git download never delays it.\n\tconst fdReady = ensureTool(\"fd\", reportStatus).then((fdPath) => {\n\t\tthis.fdPath = fdPath;\n\t\tthis.setupAutocompleteProvider();\n\t});\n\treturn Promise.all([fdReady, ensureTool(\"rg\", reportStatus), ensureTool(\"git\", reportStatus)])\n\t\t.then(() => undefined)\n\t\t.catch((error) => {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treportStatus({ type: \"warning\", message: `Tool readiness check failed: ${message}` });\n\t\t});\n};\n\n/** Show a managed-tool status update in the chat, never on the console. */\nInteractiveModeBase.prototype.showManagedToolStatus = function (this: InteractiveModeBase, status: ToolStatus): void {\n\tif (!this.managedToolStatusStarted) {\n\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\tthis.managedToolStatusStarted = true;\n\t}\n\tconst message = status.type === \"warning\" ? `Warning: ${status.message}` : status.message;\n\tconst color = status.type === \"warning\" ? \"warning\" : \"dim\";\n\tthis.chatContainer.addChild(new ThemedText(() => theme.fg(color, message), 1, 0));\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tthis.ui.requestRender();\n};\n\nexport function attachInteractiveEngineResourceExtensionRefresh(mode: InteractiveModeBase): () => void {\n\treturn onInteractiveEngineResourceExtensionsChanged(mode.runtimeHost, () => {\n\t\tmode.chatContainer.invalidate();\n\t\tmode.ui.requestRender();\n\t\tif (mode.resourceDisclosureContainer.children.length === 0) return;\n\t\tmode.showLoadedResources({\n\t\t\tforce: true,\n\t\t\tshowDiagnosticsWhenQuiet: true,\n\t\t\ttargetContainer: mode.resourceDisclosureContainer,\n\t\t});\n\t});\n}\n\nInteractiveModeBase.prototype.init = async function (this: InteractiveModeBase): Promise<void> {\n\tif (this.isInitialized) return;\n\n\tif (this.options.holdTuiForStartupTrust) await holdTuiForStartupTrust(this);\n\tthis.registerSignalHandlers();\n\n\t// Keep the transcript in its own viewport and reserve the bottom chrome in a\n\t// fixed dock for the fullscreen renderer. The same components also feed the\n\t// internal main-screen fallback used for guarded terminal paths.\n\tthis.renderWidgets(); // Initialize with default spacer\n\tthis.transcriptScrollView = new ScrollView(this.documentContainer, {\n\t\tfollow: \"end\",\n\t\tprimary: true,\n\t\toverscroll: \"chain\",\n\t\tscrollbar: this.settingsManager.getFullscreenScrollbar(),\n\t\tscrollbarThumbStyle: (text) => theme.bg(\"scrollbarThumb\", text),\n\t});\n\tconst dock = new VStack([\n\t\t{ component: this.pendingMessagesContainer, shrink: 1, minSize: 0 },\n\t\t{ component: this.statusContainer, shrink: 1, minSize: 0 },\n\t\t{ component: this.widgetContainerAbove, shrink: 1, minSize: 0 },\n\t\t{ component: this.usageMeter, shrink: 1, minSize: 1 },\n\t\t{ component: this.editorContainer, shrink: 1, minSize: 3 },\n\t\t{ component: this.footerContainer, shrink: 1, minSize: 1 },\n\t\t// Keep widgetContainerBelow after the footer for #1109's stable dock order.\n\t\t{ component: this.widgetContainerBelow, shrink: 1, minSize: 0 },\n\t]);\n\tthis.fullscreenLayoutRoot = new VStack([\n\t\t{ component: this.transcriptScrollView, basis: 0, grow: 1, shrink: 1, minSize: 1 },\n\t\t{ component: dock, basis: \"auto\", grow: 0, shrink: 1, minSize: 1 },\n\t]);\n\tthis.mountInteractiveTui(this.ui, [\n\t\tthis.documentContainer,\n\t\tthis.pendingMessagesContainer,\n\t\tthis.statusContainer,\n\t\tthis.widgetContainerAbove,\n\t\tthis.usageMeter,\n\t\tthis.editorContainer,\n\t\tthis.footerContainer,\n\t\tthis.widgetContainerBelow,\n\t]);\n\tthis.ui.setFocus(this.extensionDialogs.at(-1)?.component ?? this.editor);\n\n\tthis.setupKeyHandlers();\n\tthis.setupEditorSubmitHandler();\n\t// Rebuild autocomplete whenever the engine child's command catalog arrives or\n\t// changes (initial bind, engine restart, reload, new/resume/fork). Subscribed\n\t// before bind so the first async catalog fetch can never be missed. No-op when\n\t// the host is not isolated.\n\tonInteractiveEngineRemoteCommandsChanged(this.runtimeHost, () => {\n\t\tthis.setupAutocompleteProvider();\n\t});\n\tattachInteractiveEngineResourceExtensionRefresh(this);\n\t// Engine stats can land after the last event of a run; repaint so the idle footer shows them.\n\tonInteractiveEngineSessionStatsChanged(this.runtimeHost, () => {\n\t\tthis.ui.requestRender();\n\t});\n\n\tseedStartupInput(\n\t\tthis.pendingUserInputs,\n\t\tthis.defaultEditor,\n\t\tthis.options.startupInputCapture?.consume(),\n\t\tthis.startupReplayInputs,\n\t\t(text) => {\n\t\t\tthis.startupDraftText = text;\n\t\t},\n\t\t(text) => {\n\t\t\tthis.startupReplayActiveInput = text;\n\t\t},\n\t);\n\n\t// Start and paint the host-owned TUI before waiting for the isolated engine.\n\t// The editor remains local and responsive; session binding and provider work\n\t// still stay behind the engine-bound gate below.\n\tmarkLifecycleTiming(\"tui-start\");\n\tthis.ui.start();\n\tthis.programStatus.report();\n\tensurePngTranscoder(() => {\n\t\tthis.ui.invalidate();\n\t\tthis.ui.requestRender();\n\t});\n\tthis.disposeMarkitDiagnosticSink = setMarkitDiagnosticSink((message) => renderDiagnosticStatus(message, this));\n\tthis.footerDataProvider.onBranchChange(() => {\n\t\tthis.ui.requestRender();\n\t});\n\n\tawait this.themeController.applyFromSettings();\n\n\t// Add the quiet startup identity unless silenced.\n\tif (this.shouldShowStartupHeader()) {\n\t\tthis.builtInHeader = new StartupIdentityComponent(this.ui, (width, state) =>\n\t\t\tthis.getStartupIdentityText(width, state.gap, state.manifestoPhase),\n\t\t);\n\n\t\tthis.headerContainer.addChild(new Spacer(1));\n\t\tthis.headerContainer.addChild(this.builtInHeader);\n\t\tthis.headerContainer.addChild(new Spacer(1));\n\t} else {\n\t\t// Minimal header when silenced\n\t\tthis.builtInHeader = new Text(\"\", 0, 0);\n\t\tthis.headerContainer.addChild(this.builtInHeader);\n\t}\n\tthis.showFullscreenModelScopeNotice();\n\tmarkLifecycleTiming(\"header-mounted\");\n\tthis.ui.requestRender();\n\t// This legacy mark now means the first requested identity frame. The settled\n\t// animation frame remains the external benchmark's startup-complete mark.\n\trecordTimeSinceReset(\"time-to-first-frame\");\n\n\tawait waitForInteractiveEngineBound(this.runtimeHost);\n\tif (this.isShuttingDown) return;\n\tthis.isInitialized = true;\n\t// The isolated engine may have replaced the preliminary model/provider view.\n\tthis.ui.requestRender();\n\n\t// fd/rg readiness runs after first paint so slow downloads never make\n\t// startup appear frozen. Progress reports land in the transcript: a console\n\t// write here lands in the alternate screen and corrupts the frame.\n\tvoid this.ensureManagedToolsReady();\n\n\t// When startup resources are deferred, keep the already-painted editor responsive.\n\t// Extension UI bindings are installed at the deferred reload boundary, not here,\n\t// so no post-paint resource work can block visible typing.\n\tif (this.deferredStartupPending) {\n\t\tthis.applyRuntimeSettings();\n\t\tthis.subscribeToAgent();\n\t\tthis.updateEditorBorderColor();\n\t\tthis.updateTerminalTitle();\n\t} else {\n\t\tawait bindInitialEagerSession(this);\n\t}\n\n\tthis.attachStartupNoticesContainer();\n\t// Render initial messages AFTER the initial session binding is in place.\n\tthis.renderInitialMessages();\n\tif (!this.deferredStartupPending) this.startSessionRecovery(\"startup\");\n\t// Set up theme file watcher\n\tonThemeChange(() => {\n\t\tthis.ui.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t\tthis.ui.requestRender();\n\t});\n\n\tupdateProviderCountFromSnapshot(this);\n};\n\nInteractiveModeBase.prototype.updateTerminalTitle = function (this: InteractiveModeBase): void {\n\tconst cwdBasename = path.basename(this.sessionManager.getCwd());\n\tconst sessionName = this.sessionManager.getSessionName();\n\t// Session names come from session files: a BEL or ESC in the title would end the OSC title sequence early and send\n\t// the rest to the terminal as escape sequences.\n\tconst title = sessionName ? `${APP_TITLE} - ${sessionName} - ${cwdBasename}` : `${APP_TITLE} - ${cwdBasename}`;\n\tthis.ui.terminal.setTitle(replaceControlCharacters(title));\n};\n\n/**\n * Shows how a resumed session's checkout was prepared with the startup notices, which survive the chat rebuild that\n * follows deferred startup.\n */\nexport function showResumeNotices(\n\tmode: Pick<InteractiveModeBase, \"startupNoticesContainer\" | \"showWarning\">,\n\tnotices: readonly { readonly type: \"info\" | \"warning\"; readonly message: string }[] | undefined,\n): void {\n\tfor (const notice of notices ?? []) {\n\t\tif (notice.type === \"warning\") mode.showWarning(notice.message, mode.startupNoticesContainer);\n\t\telse {\n\t\t\tmode.startupNoticesContainer.addChild(new Spacer(1));\n\t\t\tmode.startupNoticesContainer.addChild(new Text(theme.fg(\"dim\", notice.message), 1, 0));\n\t\t}\n\t}\n}\n\nInteractiveModeBase.prototype.run = async function (this: InteractiveModeBase): Promise<void> {\n\tawait this.init();\n\tif (this.isShuttingDown) return;\n\n\tif (shouldRefreshCatalogsOnStartup()) void refreshCatalogsAfterTuiStartup(this);\n\n\tsetTimeout(() => {\n\t\tconst startupNoticesContainer = this.startupNoticesContainer;\n\t\tcheckForNewPiVersion(this.version).then((newVersion) => {\n\t\t\tif (newVersion) this.showNewVersionNotification(newVersion, startupNoticesContainer);\n\t\t});\n\t\trestoreTerminalTitleAfterPackageCheck(this.checkForPackageUpdates(), {\n\t\t\tinitialized: () => this.isInitialized,\n\t\t\trestore: () => this.updateTerminalTitle(),\n\t\t}).then((updates) => {\n\t\t\tif (updates.length > 0) this.showPackageUpdateNotification(updates, startupNoticesContainer);\n\t\t});\n\t\tthis.checkTmuxKeyboardSetup().then((warning) => {\n\t\t\tif (warning) this.showWarning(warning, startupNoticesContainer);\n\t\t});\n\t\t// Deferred startup releases chat output immediately after rendering the\n\t\t// disclosure, so wait only while that startup work remains in flight.\n\t\tif (!this.deferredStartupPending && !this.deferredStartupPromise) {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, startupNoticesContainer);\n\t\t}\n\t}, 500);\n\n\t// Show startup warnings\n\tconst { migratedProviders, startupDiagnostics, resumeNotices, initialMessage, initialImages, initialMessages } =\n\t\tthis.options;\n\n\tshowSessionNotices(this, startupDiagnostics);\n\tshowResumeNotices(this, resumeNotices);\n\n\tif (migratedProviders && migratedProviders.length > 0) {\n\t\tthis.showWarning(`Migrated credentials to auth.json: ${migratedProviders.join(\", \")}`);\n\t}\n\n\tconst modelsJsonError = this.session.modelRuntime.getError();\n\tif (modelsJsonError) {\n\t\tthis.showError(`models.json error: ${modelsJsonError}`);\n\t}\n\n\tconst modelFallbackMessage = this.runtimeHost.modelFallbackMessage;\n\tif (modelFallbackMessage && !this.deferredStartupPending) {\n\t\tthis.showWarning(modelFallbackMessage, this.startupNoticesContainer);\n\t}\n\n\t// CLI-provided startup prompts need extension tools/resources; wait before sending them,\n\t// but do not block the normal no-prompt input loop from becoming ready.\n\tif (this.deferredStartupPending && (initialMessage || (initialMessages && initialMessages.length > 0))) {\n\t\tawait this.ensureDeferredStartupComplete();\n\t}\n\n\t// Process initial messages\n\tif (initialMessage) {\n\t\ttry {\n\t\t\tawait this.session.prompt(initialMessage, { images: initialImages });\n\t\t} catch (error: unknown) {\n\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\tthis.showError(errorMessage);\n\t\t}\n\t}\n\n\tif (initialMessages) {\n\t\tfor (const message of initialMessages) {\n\t\t\ttry {\n\t\t\t\tawait this.session.prompt(message);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\t\tthis.showError(errorMessage);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Main interactive loop\n\twhile (true) {\n\t\tconst userInput = await this.getUserInput();\n\t\tawait this.runUserPromptTurn(userInput);\n\t}\n};\n\nInteractiveModeBase.prototype.checkForPackageUpdates = async function (this: InteractiveModeBase): Promise<string[]> {\n\tif (getEnvValue(ENV_OFFLINE)) {\n\t\treturn [];\n\t}\n\n\ttry {\n\t\tconst packageManager = new DefaultPackageManager({\n\t\t\tcwd: this.sessionManager.getCwd(),\n\t\t\tagentDir: getAgentDir(),\n\t\t\tsettingsManager: this.settingsManager,\n\t\t});\n\t\tconst updates = await packageManager.checkForAvailableUpdates();\n\t\treturn updates.map((update) => update.displayName);\n\t} catch {\n\t\treturn [];\n\t}\n};\n\nInteractiveModeBase.prototype.checkTmuxKeyboardSetup = async function (\n\tthis: InteractiveModeBase,\n): Promise<string | undefined> {\n\tif (!process.env.TMUX) return undefined;\n\n\tconst runTmuxShow = (option: string): Promise<string | undefined> => {\n\t\treturn new Promise((resolve) => {\n\t\t\tconst proc = spawn(\"tmux\", [\"show\", \"-gv\", option], {\n\t\t\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\t\t\tenv: createChildProcessEnvironment(),\n\t\t\t});\n\t\t\tlet stdout = \"\";\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tproc.kill();\n\t\t\t\tresolve(undefined);\n\t\t\t}, 2000);\n\n\t\t\tproc.stdout?.on(\"data\", (data) => {\n\t\t\t\tstdout += data.toString();\n\t\t\t});\n\t\t\tproc.on(\"error\", () => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(undefined);\n\t\t\t});\n\t\t\tproc.on(\"close\", (code) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(code === 0 ? stdout.trim() : undefined);\n\t\t\t});\n\t\t});\n\t};\n\n\tconst [extendedKeys, extendedKeysFormat] = await Promise.all([\n\t\trunTmuxShow(\"extended-keys\"),\n\t\trunTmuxShow(\"extended-keys-format\"),\n\t]);\n\n\t// If we couldn't query tmux (timeout, sandbox, etc.), don't warn\n\tif (extendedKeys === undefined) return undefined;\n\n\tif (extendedKeys !== \"on\" && extendedKeys !== \"always\") {\n\t\treturn \"tmux extended-keys is off. Modified enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.\";\n\t}\n\n\tif (extendedKeysFormat === \"xterm\") {\n\t\treturn `tmux extended-keys-format is xterm. ${APP_TITLE} works best with csi-u. Add \\`set -g extended-keys-format csi-u\\` to ~/.tmux.conf and restart tmux.`;\n\t}\n\n\treturn undefined;\n};\n\nconst FULL_CHANGELOG_HINT = \"Run `/changelog` for the full list of changes.\";\n\nInteractiveModeBase.prototype.getChangelogForDisplay = function (this: InteractiveModeBase): string | undefined {\n\t// Skip changelog for resumed/continued sessions (already have messages)\n\tif (this.session.state.messages.length > 0) {\n\t\treturn undefined;\n\t}\n\n\tconst lastVersion = this.settingsManager.getLastChangelogVersion();\n\tconst changelogPath = getChangelogPath();\n\tconst entries = parseChangelog(changelogPath);\n\n\tif (!lastVersion) {\n\t\t// Fresh install - record the version, send telemetry, don't show changelog\n\t\tthis.settingsManager.setLastChangelogVersion(VERSION);\n\t\tthis.reportInstallTelemetry(VERSION);\n\t\treturn undefined;\n\t}\n\n\tconst newEntries = getNewEntries(entries, lastVersion, VERSION);\n\tconst currentEntries = getEntriesForVersion(newEntries, VERSION);\n\tif (currentEntries.length > 0) {\n\t\tthis.settingsManager.setLastChangelogVersion(VERSION);\n\t\tthis.reportInstallTelemetry(VERSION);\n\t\treturn currentEntries\n\t\t\t.map((e) => {\n\t\t\t\tconst highlights = getChangelogHighlights(e);\n\t\t\t\tif (!highlights) return normalizeChangelogLinks(e.content, e);\n\t\t\t\tconst [heading] = e.content.split(\"\\n\");\n\t\t\t\treturn normalizeChangelogLinks(`${heading}\\n\\n${highlights}\\n\\n${FULL_CHANGELOG_HINT}`, e);\n\t\t\t})\n\t\t\t.join(\"\\n\\n\");\n\t}\n\n\treturn undefined;\n};\n\nInteractiveModeBase.prototype.reportInstallTelemetry = function (this: InteractiveModeBase, version: string): void {\n\tif (getEnvValue(ENV_OFFLINE)) {\n\t\treturn;\n\t}\n\n\tif (!isInstallTelemetryEnabled(this.settingsManager)) {\n\t\treturn;\n\t}\n\n\tvoid fetch(`${VERSION_ADOPTION_ENDPOINT}?version=${encodeURIComponent(version)}`, {\n\t\theaders: {\n\t\t\t\"User-Agent\": getPiUserAgent(version),\n\t\t},\n\t\tsignal: AbortSignal.timeout(5000),\n\t})\n\t\t.then(() => undefined)\n\t\t.catch(() => undefined);\n};\n\nInteractiveModeBase.prototype.getMarkdownThemeWithSettings = function (this: InteractiveModeBase): MarkdownTheme {\n\treturn {\n\t\t...getMarkdownTheme(),\n\t\tcodeBlockIndent: this.settingsManager.getCodeBlockIndent(),\n\t};\n};\n\nInteractiveModeBase.prototype.formatDisplayPath = function (this: InteractiveModeBase, p: string): string {\n\treturn shortenHomePath(p);\n};\n\nInteractiveModeBase.prototype.formatExtensionDisplayPath = function (this: InteractiveModeBase, path: string): string {\n\treturn this.formatDisplayPath(path).replace(/[\\\\/]index\\.(?:ts|js)$/, \"\");\n};\n\nInteractiveModeBase.prototype.formatContextPath = function (this: InteractiveModeBase, p: string): string {\n\tconst cwd = path.resolve(this.sessionManager.getCwd());\n\tconst absolutePath = path.isAbsolute(p) ? path.resolve(p) : path.resolve(cwd, p);\n\tconst relativePath = getCwdRelativePath(absolutePath, cwd);\n\tif (relativePath !== undefined) {\n\t\treturn relativePath;\n\t}\n\n\treturn this.formatDisplayPath(absolutePath);\n};\n\nInteractiveModeBase.prototype.getStartupModelLabel = function (this: InteractiveModeBase): string {\n\tconst model = this.session.state.model;\n\treturn model ? formatModelLabel(model, { thinkingLevel: this.session.thinkingLevel || \"off\" }) : \"no-model\";\n};\n\nInteractiveModeBase.prototype.getStartupIdentityText = function (\n\tthis: InteractiveModeBase,\n\tmaxWidth?: number,\n\tgap = 0,\n\tmanifestoPhase = 4,\n): string {\n\tconst appLabel = APP_NAME.length > 0 ? `${APP_NAME[0]!.toUpperCase()}${APP_NAME.slice(1)}` : \"Atomic\";\n\tconst noColor = process.env.NO_COLOR !== undefined;\n\tconst fg = (role: \"text\" | \"muted\" | \"dim\", text: string): string => (noColor ? text : theme.fg(role, text));\n\tconst showMark = supportsAtomicBanner();\n\tconst wordmark = showMark ? \"\" : `${atomicWordmark()} `;\n\tconst title = `${wordmark}${theme.bold(fg(\"text\", appLabel))} ${fg(\"muted\", `v${this.version}`)}`;\n\tconst modelLine = fg(\"muted\", this.getStartupModelLabel());\n\tconst markLines = showMark ? this.getAtomicAnsiMarkLines(gap) : [];\n\tconst markWidth = Math.max(0, ...markLines.map(visibleWidth));\n\tconst showMeta = gap === 0 || (maxWidth !== undefined && maxWidth < markWidth);\n\tconst metaLines = showMeta\n\t\t? [title, modelLine, fg(\"muted\", this.formatDisplayPath(this.sessionManager.getCwd()))]\n\t\t: [];\n\treturn composeStartupIdentity(\n\t\tmarkLines,\n\t\tmetaLines,\n\t\tmaxWidth,\n\t\tgap === 0 ? renderStartupManifesto(manifestoPhase) : [],\n\t);\n};\n\nInteractiveModeBase.prototype.getAtomicAnsiMarkLines = function (this: InteractiveModeBase, gap = 0): string[] {\n\treturn renderAtomicAssemblyBanner(gap, theme, this.session.thinkingLevel || \"off\");\n};\n\nInteractiveModeBase.prototype.getStartupExpansionState = function (this: InteractiveModeBase): boolean {\n\treturn this.options.verbose || this.toolOutputExpanded;\n};\n\n/**\n * Fullscreen paints on the alternate screen, so the \"Model scope\" line cannot be printed to stdout there\n * (it would stay in the shell after exit); it goes below the header instead (upstream #11508).\n */\nInteractiveModeBase.prototype.showFullscreenModelScopeNotice = function (this: InteractiveModeBase): void {\n\tconst notice = this.options.modelScopeNotice;\n\tif (!notice || !this.usesFullscreenRenderer) return;\n\tthis.headerContainer.addChild(new ThemedText(() => theme.fg(\"dim\", notice), 1, 0));\n\tthis.headerContainer.addChild(new Spacer(1));\n};\n\nInteractiveModeBase.prototype.shouldShowStartupHeader = function (this: InteractiveModeBase): boolean {\n\treturn this.options.verbose === true || this.settingsManager.getQuietStartup() !== true;\n};\n\nInteractiveModeBase.prototype.shouldShowStartupDetails = function (this: InteractiveModeBase): boolean {\n\treturn this.options.verbose === true || this.settingsManager.getQuietStartup() === false;\n};\n"]}
1
+ {"version":3,"file":"interactive-startup.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EACN,wCAAwC,EACxC,4CAA4C,EAC5C,sCAAsC,EACtC,6BAA6B,GAC7B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,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GAAG;IAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;IAC7C,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,sBAAsB;QAAE,OAAO;IACpD,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnF,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,uBAAuB,GAAG;IACvD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,KAAK,IAAI,CAAC;AACzF,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,wBAAwB,GAAG;IACxD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,KAAK,KAAK,CAAC;AAC1F,CAAC,CAAC","sourcesContent":["import { replaceControlCharacters, ScrollView, VStack } from \"@earendil-works/pi-tui\";\nimport { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { formatModelLabel } from \"../../core/model-label.ts\";\nimport { isOfflineModeEnabled } from \"../../core/package-manager-env.ts\";\nimport { createChildProcessEnvironment } from \"../../utils/child-process.ts\";\nimport { ensurePngTranscoder } from \"../../utils/image-convert.ts\";\nimport { setMarkitDiagnosticSink } from \"../../utils/markit.js\";\nimport { shortenHomePath } from \"../../utils/paths.ts\";\nimport type { ToolStatus } from \"../../utils/tools-manager.ts\";\nimport { renderDiagnosticStatus } from \"../interactive-engine/engine-diagnostic-view.js\";\nimport {\n\tonInteractiveEngineRemoteCommandsChanged,\n\tonInteractiveEngineResourceExtensionsChanged,\n\tonInteractiveEngineSessionStatsChanged,\n\twaitForInteractiveEngineBound,\n} from \"../interactive-engine/extension-ui-bridge.ts\";\nimport {\n\tatomicWordmark,\n\trenderAtomicAssemblyBanner,\n\trenderStartupManifesto,\n\tsupportsAtomicBanner,\n} from \"./components/atomic-banner.ts\";\nimport { StartupIdentityComponent } from \"./components/startup-identity.ts\";\nimport { ThemedText } from \"./components/themed-text.js\";\nimport { bindInitialEagerSession } from \"./interactive-initial-session-binding.ts\";\nimport { InteractiveModeBase, seedStartupInput } from \"./interactive-mode-base.ts\";\nimport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\ttype Container,\n\tcheckForNewPiVersion,\n\tcomposeStartupIdentity,\n\tDefaultPackageManager,\n\tDynamicBorder,\n\tENV_OFFLINE,\n\tensureTool,\n\tgetAgentDir,\n\tgetChangelogHighlights,\n\tgetChangelogPath,\n\tgetCwdRelativePath,\n\tgetEntriesForVersion,\n\tgetEnvValue,\n\tgetMarkdownTheme,\n\tgetNewEntries,\n\tgetPiUserAgent,\n\tisInstallTelemetryEnabled,\n\ttype MarkdownTheme,\n\tnormalizeChangelogLinks,\n\tonThemeChange,\n\tparseChangelog,\n\tpath,\n\trecordTimeSinceReset,\n\tSpacer,\n\tspawn,\n\tText,\n\ttheme,\n\tVERSION,\n\tVERSION_ADOPTION_ENDPOINT,\n\tvisibleWidth,\n} from \"./interactive-mode-deps.ts\";\nimport {\n\trefreshCatalogsAfterTuiStartup,\n\tupdateProviderCountFromSnapshot,\n} from \"./interactive-model-catalog-startup.ts\";\nimport { ONBOARDING_COPY } from \"./interactive-onboarding.ts\";\nimport { holdTuiForStartupTrust } from \"./interactive-startup-trust.ts\";\nimport { restoreTerminalTitleAfterPackageCheck } from \"./interactive-terminal-title.ts\";\nimport { reportUnavailableTools } from \"./interactive-unavailable-tools.ts\";\nimport { showSessionNotices } from \"./session-notices.ts\";\n\nexport const shouldRefreshCatalogsOnStartup = (): boolean => !isOfflineModeEnabled();\n\nfunction prepareStartupNotices(mode: InteractiveModeBase): void {\n\tif (mode.startupNoticesPrepared) return;\n\tmode.startupNoticesPrepared = true;\n\tmode.hadLastChangelogVersionAtStartup = Boolean(mode.settingsManager.getLastChangelogVersion?.());\n\tif (mode.changelogMarkdown === undefined) {\n\t\tmode.changelogMarkdown = mode.getChangelogForDisplay?.();\n\t}\n\tmode.initializeFirstRunOnboardingMarkers?.();\n\tif (!mode.firstRunNoticeVisible) {\n\t\tmode.firstRunNoticeVisible = mode.isFirstRunOnboardingEligible?.() ?? false;\n\t}\n}\n\n/**\n * Show non-fatal model-catalog warnings — today, a derived `-fast` variant suppressed because\n * something already owns that exact model ID.\n *\n * Called unconditionally at startup and again after deferred extension loading, because an extension\n * provider can introduce a collision that did not exist at startup. The last reported text is kept so\n * the second read only speaks when the diagnostic set actually changed.\n */\nInteractiveModeBase.prototype.reportModelCatalogWarning = function (\n\tthis: InteractiveModeBase,\n\ttargetContainer: Container = this.chatContainer,\n): void {\n\tconst warning = this.session.modelRuntime.getWarning?.();\n\tif (!warning || warning === this.reportedModelCatalogWarning) {\n\t\treturn;\n\t}\n\tthis.reportedModelCatalogWarning = warning;\n\tthis.showWarning(warning, targetContainer);\n};\n\nInteractiveModeBase.prototype.showStartupNoticesIfNeeded = function (\n\tthis: InteractiveModeBase,\n\ttargetContainer: Container = this.chatContainer,\n): void {\n\tif (this.startupNoticesShown) {\n\t\t// Deferred startup asks again after extensions load: redraw What's New with their transformers, don't repeat it.\n\t\tthis.startupChangelogComponent?.invalidate();\n\t\treturn;\n\t}\n\tprepareStartupNotices(this);\n\tthis.startupNoticesShown = true;\n\n\tconst changelogMarkdown = this.changelogMarkdown;\n\tif (!changelogMarkdown && !this.firstRunNoticeVisible) {\n\t\treturn;\n\t}\n\n\tif (changelogMarkdown) {\n\t\tif (targetContainer.children.length > 0) {\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t}\n\t\ttargetContainer.addChild(new DynamicBorder());\n\t\tif (this.settingsManager.getCollapseChangelog()) {\n\t\t\tconst versionMatch = changelogMarkdown.match(\n\t\t\t\t/##\\s+\\[?((?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:alpha\\.)?(?:0|[1-9]\\d*))?)\\]?/,\n\t\t\t);\n\t\t\tconst latestVersion = versionMatch ? versionMatch[1] : this.version;\n\t\t\tconst condensedText = `Updated to v${latestVersion}. Use ${theme.bold(\"/changelog\")} to view full changelog.`;\n\t\t\ttargetContainer.addChild(new Text(condensedText, 1, 0));\n\t\t} else {\n\t\t\ttargetContainer.addChild(new ThemedText(() => theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0));\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t\tthis.startupChangelogComponent = this.createChangelogMarkdown(changelogMarkdown.trim(), 1, 0);\n\t\t\ttargetContainer.addChild(this.startupChangelogComponent);\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t}\n\t\ttargetContainer.addChild(new DynamicBorder());\n\t}\n\n\tif (this.firstRunNoticeVisible) {\n\t\tthis.firstRunOnboardingNoticeComponents = [];\n\t\tif (targetContainer.children.length > 0) {\n\t\t\tthis.firstRunOnboardingNoticeComponents.push(new Spacer(1));\n\t\t}\n\t\tthis.firstRunOnboardingNoticeComponents.push(\n\t\t\tnew DynamicBorder(),\n\t\t\tnew Text(ONBOARDING_COPY, 1, 0),\n\t\t\tnew DynamicBorder(),\n\t\t\tnew Spacer(1),\n\t\t);\n\t\tfor (const component of this.firstRunOnboardingNoticeComponents) {\n\t\t\ttargetContainer.addChild(component);\n\t\t}\n\t\t// Mark completion only after queueing the notice in the chat canvas so\n\t\t// launches that skip rendering retry the first-run notice next time.\n\t\tthis.settingsManager.setOnboardedVersion(this.version);\n\t}\n\n\tthis.ui.requestRender();\n};\n\n/** Bring fd, rg, and git to readiness, reporting progress into the transcript. */\nInteractiveModeBase.prototype.ensureManagedToolsReady = function (this: InteractiveModeBase): Promise<void> {\n\tconst statusGeneration = ++this.managedToolStatusGeneration;\n\tconst reportStatus = (status: ToolStatus): void => {\n\t\tif (this.managedToolStatusGeneration === statusGeneration) this.showManagedToolStatus(status);\n\t};\n\t// Autocomplete needs only fd, so a slow rg or git download never delays it.\n\tconst fdReady = ensureTool(\"fd\", reportStatus).then((fdPath) => {\n\t\tthis.fdPath = fdPath;\n\t\tthis.setupAutocompleteProvider();\n\t});\n\treturn Promise.all([fdReady, ensureTool(\"rg\", reportStatus), ensureTool(\"git\", reportStatus)])\n\t\t.then(() => undefined)\n\t\t.catch((error) => {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treportStatus({ type: \"warning\", message: `Tool readiness check failed: ${message}` });\n\t\t});\n};\n\n/** Show a managed-tool status update in the chat, never on the console. */\nInteractiveModeBase.prototype.showManagedToolStatus = function (this: InteractiveModeBase, status: ToolStatus): void {\n\tif (!this.managedToolStatusStarted) {\n\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\tthis.managedToolStatusStarted = true;\n\t}\n\tconst message = status.type === \"warning\" ? `Warning: ${status.message}` : status.message;\n\tconst color = status.type === \"warning\" ? \"warning\" : \"dim\";\n\tthis.chatContainer.addChild(new ThemedText(() => theme.fg(color, message), 1, 0));\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tthis.ui.requestRender();\n};\n\nexport function attachInteractiveEngineResourceExtensionRefresh(mode: InteractiveModeBase): () => void {\n\treturn onInteractiveEngineResourceExtensionsChanged(mode.runtimeHost, () => {\n\t\tmode.chatContainer.invalidate();\n\t\tmode.ui.requestRender();\n\t\tif (mode.resourceDisclosureContainer.children.length === 0) return;\n\t\tmode.showLoadedResources({\n\t\t\tforce: true,\n\t\t\tshowDiagnosticsWhenQuiet: true,\n\t\t\ttargetContainer: mode.resourceDisclosureContainer,\n\t\t});\n\t});\n}\n\nInteractiveModeBase.prototype.init = async function (this: InteractiveModeBase): Promise<void> {\n\tif (this.isInitialized) return;\n\n\tif (this.options.holdTuiForStartupTrust) await holdTuiForStartupTrust(this);\n\tthis.registerSignalHandlers();\n\n\t// Keep the transcript in its own viewport and reserve the bottom chrome in a\n\t// fixed dock for the fullscreen renderer. The same components also feed the\n\t// internal main-screen fallback used for guarded terminal paths.\n\tthis.renderWidgets(); // Initialize with default spacer\n\tthis.transcriptScrollView = new ScrollView(this.documentContainer, {\n\t\tfollow: \"end\",\n\t\tprimary: true,\n\t\toverscroll: \"chain\",\n\t\tscrollbar: this.settingsManager.getFullscreenScrollbar(),\n\t\tscrollbarThumbStyle: (text) => theme.bg(\"scrollbarThumb\", text),\n\t});\n\tconst dock = new VStack([\n\t\t{ component: this.pendingMessagesContainer, shrink: 1, minSize: 0 },\n\t\t{ component: this.statusContainer, shrink: 1, minSize: 0 },\n\t\t{ component: this.widgetContainerAbove, shrink: 1, minSize: 0 },\n\t\t{ component: this.usageMeter, shrink: 1, minSize: 1 },\n\t\t{ component: this.editorContainer, shrink: 1, minSize: 3 },\n\t\t{ component: this.footerContainer, shrink: 1, minSize: 1 },\n\t\t// Keep widgetContainerBelow after the footer for #1109's stable dock order.\n\t\t{ component: this.widgetContainerBelow, shrink: 1, minSize: 0 },\n\t]);\n\tthis.fullscreenLayoutRoot = new VStack([\n\t\t{ component: this.transcriptScrollView, basis: 0, grow: 1, shrink: 1, minSize: 1 },\n\t\t{ component: dock, basis: \"auto\", grow: 0, shrink: 1, minSize: 1 },\n\t]);\n\tthis.mountInteractiveTui(this.ui, [\n\t\tthis.documentContainer,\n\t\tthis.pendingMessagesContainer,\n\t\tthis.statusContainer,\n\t\tthis.widgetContainerAbove,\n\t\tthis.usageMeter,\n\t\tthis.editorContainer,\n\t\tthis.footerContainer,\n\t\tthis.widgetContainerBelow,\n\t]);\n\tthis.ui.setFocus(this.extensionDialogs.at(-1)?.component ?? this.editor);\n\n\tthis.setupKeyHandlers();\n\tthis.setupEditorSubmitHandler();\n\t// Rebuild autocomplete whenever the engine child's command catalog arrives or\n\t// changes (initial bind, engine restart, reload, new/resume/fork). Subscribed\n\t// before bind so the first async catalog fetch can never be missed. No-op when\n\t// the host is not isolated.\n\tonInteractiveEngineRemoteCommandsChanged(this.runtimeHost, () => {\n\t\tthis.setupAutocompleteProvider();\n\t});\n\tattachInteractiveEngineResourceExtensionRefresh(this);\n\t// Engine stats can land after the last event of a run; repaint so the idle footer shows them.\n\tonInteractiveEngineSessionStatsChanged(this.runtimeHost, () => {\n\t\tthis.ui.requestRender();\n\t});\n\n\tseedStartupInput(\n\t\tthis.pendingUserInputs,\n\t\tthis.defaultEditor,\n\t\tthis.options.startupInputCapture?.consume(),\n\t\tthis.startupReplayInputs,\n\t\t(text) => {\n\t\t\tthis.startupDraftText = text;\n\t\t},\n\t\t(text) => {\n\t\t\tthis.startupReplayActiveInput = text;\n\t\t},\n\t);\n\n\t// Start and paint the host-owned TUI before waiting for the isolated engine.\n\t// The editor remains local and responsive; session binding and provider work\n\t// still stay behind the engine-bound gate below.\n\tmarkLifecycleTiming(\"tui-start\");\n\tthis.ui.start();\n\tthis.programStatus.report();\n\tensurePngTranscoder(() => {\n\t\tthis.ui.invalidate();\n\t\tthis.ui.requestRender();\n\t});\n\tthis.disposeMarkitDiagnosticSink = setMarkitDiagnosticSink((message) => renderDiagnosticStatus(message, this));\n\tthis.footerDataProvider.onBranchChange(() => {\n\t\tthis.ui.requestRender();\n\t});\n\n\tawait this.themeController.applyFromSettings();\n\n\t// Add the quiet startup identity unless silenced.\n\tif (this.shouldShowStartupHeader()) {\n\t\tthis.builtInHeader = new StartupIdentityComponent(this.ui, (width, state) =>\n\t\t\tthis.getStartupIdentityText(width, state.gap, state.manifestoPhase),\n\t\t);\n\n\t\tthis.headerContainer.addChild(new Spacer(1));\n\t\tthis.headerContainer.addChild(this.builtInHeader);\n\t\tthis.headerContainer.addChild(new Spacer(1));\n\t} else {\n\t\t// Minimal header when silenced\n\t\tthis.builtInHeader = new Text(\"\", 0, 0);\n\t\tthis.headerContainer.addChild(this.builtInHeader);\n\t}\n\tthis.showFullscreenModelScopeNotice();\n\tmarkLifecycleTiming(\"header-mounted\");\n\tthis.ui.requestRender();\n\t// This legacy mark now means the first requested identity frame. The settled\n\t// animation frame remains the external benchmark's startup-complete mark.\n\trecordTimeSinceReset(\"time-to-first-frame\");\n\n\tawait waitForInteractiveEngineBound(this.runtimeHost);\n\tif (this.isShuttingDown) return;\n\tthis.isInitialized = true;\n\t// The isolated engine may have replaced the preliminary model/provider view.\n\tthis.ui.requestRender();\n\n\t// fd/rg readiness runs after first paint so slow downloads never make\n\t// startup appear frozen. Progress reports land in the transcript: a console\n\t// write here lands in the alternate screen and corrupts the frame.\n\tvoid this.ensureManagedToolsReady();\n\n\t// When startup resources are deferred, keep the already-painted editor responsive.\n\t// Extension UI bindings are installed at the deferred reload boundary, not here,\n\t// so no post-paint resource work can block visible typing.\n\tif (this.deferredStartupPending) {\n\t\tthis.applyRuntimeSettings();\n\t\tthis.subscribeToAgent();\n\t\tthis.updateEditorBorderColor();\n\t\tthis.updateTerminalTitle();\n\t} else {\n\t\tawait bindInitialEagerSession(this);\n\t\tvoid reportUnavailableTools(this);\n\t}\n\n\tthis.attachStartupNoticesContainer();\n\t// Render initial messages AFTER the initial session binding is in place.\n\tthis.renderInitialMessages();\n\tif (!this.deferredStartupPending) this.startSessionRecovery(\"startup\");\n\t// Set up theme file watcher\n\tonThemeChange(() => {\n\t\tthis.ui.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t\tthis.ui.requestRender();\n\t});\n\n\tupdateProviderCountFromSnapshot(this);\n};\n\nInteractiveModeBase.prototype.updateTerminalTitle = function (this: InteractiveModeBase): void {\n\tconst cwdBasename = path.basename(this.sessionManager.getCwd());\n\tconst sessionName = this.sessionManager.getSessionName();\n\t// Session names come from session files: a BEL or ESC in the title would end the OSC title sequence early and send\n\t// the rest to the terminal as escape sequences.\n\tconst title = sessionName ? `${APP_TITLE} - ${sessionName} - ${cwdBasename}` : `${APP_TITLE} - ${cwdBasename}`;\n\tthis.ui.terminal.setTitle(replaceControlCharacters(title));\n};\n\n/**\n * Shows how a resumed session's checkout was prepared with the startup notices, which survive the chat rebuild that\n * follows deferred startup.\n */\nexport function showResumeNotices(\n\tmode: Pick<InteractiveModeBase, \"startupNoticesContainer\" | \"showWarning\">,\n\tnotices: readonly { readonly type: \"info\" | \"warning\"; readonly message: string }[] | undefined,\n): void {\n\tfor (const notice of notices ?? []) {\n\t\tif (notice.type === \"warning\") mode.showWarning(notice.message, mode.startupNoticesContainer);\n\t\telse {\n\t\t\tmode.startupNoticesContainer.addChild(new Spacer(1));\n\t\t\tmode.startupNoticesContainer.addChild(new Text(theme.fg(\"dim\", notice.message), 1, 0));\n\t\t}\n\t}\n}\n\nInteractiveModeBase.prototype.run = async function (this: InteractiveModeBase): Promise<void> {\n\tawait this.init();\n\tif (this.isShuttingDown) return;\n\n\tif (shouldRefreshCatalogsOnStartup()) void refreshCatalogsAfterTuiStartup(this);\n\n\tsetTimeout(() => {\n\t\tconst startupNoticesContainer = this.startupNoticesContainer;\n\t\tcheckForNewPiVersion(this.version).then((newVersion) => {\n\t\t\tif (newVersion) this.showNewVersionNotification(newVersion, startupNoticesContainer);\n\t\t});\n\t\trestoreTerminalTitleAfterPackageCheck(this.checkForPackageUpdates(), {\n\t\t\tinitialized: () => this.isInitialized,\n\t\t\trestore: () => this.updateTerminalTitle(),\n\t\t}).then((updates) => {\n\t\t\tif (updates.length > 0) this.showPackageUpdateNotification(updates, startupNoticesContainer);\n\t\t});\n\t\tthis.checkTmuxKeyboardSetup().then((warning) => {\n\t\t\tif (warning) this.showWarning(warning, startupNoticesContainer);\n\t\t});\n\t\t// Deferred startup releases chat output immediately after rendering the\n\t\t// disclosure, so wait only while that startup work remains in flight.\n\t\tif (!this.deferredStartupPending && !this.deferredStartupPromise) {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, startupNoticesContainer);\n\t\t}\n\t}, 500);\n\n\t// Show startup warnings\n\tconst { migratedProviders, startupDiagnostics, resumeNotices, initialMessage, initialImages, initialMessages } =\n\t\tthis.options;\n\n\tshowSessionNotices(this, startupDiagnostics);\n\tshowResumeNotices(this, resumeNotices);\n\n\tif (migratedProviders && migratedProviders.length > 0) {\n\t\tthis.showWarning(`Migrated credentials to auth.json: ${migratedProviders.join(\", \")}`);\n\t}\n\n\tconst modelsJsonError = this.session.modelRuntime.getError();\n\tif (modelsJsonError) {\n\t\tthis.showError(`models.json error: ${modelsJsonError}`);\n\t}\n\n\tconst modelFallbackMessage = this.runtimeHost.modelFallbackMessage;\n\tif (modelFallbackMessage && !this.deferredStartupPending) {\n\t\tthis.showWarning(modelFallbackMessage, this.startupNoticesContainer);\n\t}\n\n\t// CLI-provided startup prompts need extension tools/resources; wait before sending them,\n\t// but do not block the normal no-prompt input loop from becoming ready.\n\tif (this.deferredStartupPending && (initialMessage || (initialMessages && initialMessages.length > 0))) {\n\t\tawait this.ensureDeferredStartupComplete();\n\t}\n\n\t// Process initial messages\n\tif (initialMessage) {\n\t\ttry {\n\t\t\tawait this.session.prompt(initialMessage, { images: initialImages });\n\t\t} catch (error: unknown) {\n\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\tthis.showError(errorMessage);\n\t\t}\n\t}\n\n\tif (initialMessages) {\n\t\tfor (const message of initialMessages) {\n\t\t\ttry {\n\t\t\t\tawait this.session.prompt(message);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\t\tthis.showError(errorMessage);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Main interactive loop\n\twhile (true) {\n\t\tconst userInput = await this.getUserInput();\n\t\tawait this.runUserPromptTurn(userInput);\n\t}\n};\n\nInteractiveModeBase.prototype.checkForPackageUpdates = async function (this: InteractiveModeBase): Promise<string[]> {\n\tif (getEnvValue(ENV_OFFLINE)) {\n\t\treturn [];\n\t}\n\n\ttry {\n\t\tconst packageManager = new DefaultPackageManager({\n\t\t\tcwd: this.sessionManager.getCwd(),\n\t\t\tagentDir: getAgentDir(),\n\t\t\tsettingsManager: this.settingsManager,\n\t\t});\n\t\tconst updates = await packageManager.checkForAvailableUpdates();\n\t\treturn updates.map((update) => update.displayName);\n\t} catch {\n\t\treturn [];\n\t}\n};\n\nInteractiveModeBase.prototype.checkTmuxKeyboardSetup = async function (\n\tthis: InteractiveModeBase,\n): Promise<string | undefined> {\n\tif (!process.env.TMUX) return undefined;\n\n\tconst runTmuxShow = (option: string): Promise<string | undefined> => {\n\t\treturn new Promise((resolve) => {\n\t\t\tconst proc = spawn(\"tmux\", [\"show\", \"-gv\", option], {\n\t\t\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\t\t\tenv: createChildProcessEnvironment(),\n\t\t\t});\n\t\t\tlet stdout = \"\";\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tproc.kill();\n\t\t\t\tresolve(undefined);\n\t\t\t}, 2000);\n\n\t\t\tproc.stdout?.on(\"data\", (data) => {\n\t\t\t\tstdout += data.toString();\n\t\t\t});\n\t\t\tproc.on(\"error\", () => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(undefined);\n\t\t\t});\n\t\t\tproc.on(\"close\", (code) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(code === 0 ? stdout.trim() : undefined);\n\t\t\t});\n\t\t});\n\t};\n\n\tconst [extendedKeys, extendedKeysFormat] = await Promise.all([\n\t\trunTmuxShow(\"extended-keys\"),\n\t\trunTmuxShow(\"extended-keys-format\"),\n\t]);\n\n\t// If we couldn't query tmux (timeout, sandbox, etc.), don't warn\n\tif (extendedKeys === undefined) return undefined;\n\n\tif (extendedKeys !== \"on\" && extendedKeys !== \"always\") {\n\t\treturn \"tmux extended-keys is off. Modified enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.\";\n\t}\n\n\tif (extendedKeysFormat === \"xterm\") {\n\t\treturn `tmux extended-keys-format is xterm. ${APP_TITLE} works best with csi-u. Add \\`set -g extended-keys-format csi-u\\` to ~/.tmux.conf and restart tmux.`;\n\t}\n\n\treturn undefined;\n};\n\nconst FULL_CHANGELOG_HINT = \"Run `/changelog` for the full list of changes.\";\n\nInteractiveModeBase.prototype.getChangelogForDisplay = function (this: InteractiveModeBase): string | undefined {\n\t// Skip changelog for resumed/continued sessions (already have messages)\n\tif (this.session.state.messages.length > 0) {\n\t\treturn undefined;\n\t}\n\n\tconst lastVersion = this.settingsManager.getLastChangelogVersion();\n\tconst changelogPath = getChangelogPath();\n\tconst entries = parseChangelog(changelogPath);\n\n\tif (!lastVersion) {\n\t\t// Fresh install - record the version, send telemetry, don't show changelog\n\t\tthis.settingsManager.setLastChangelogVersion(VERSION);\n\t\tthis.reportInstallTelemetry(VERSION);\n\t\treturn undefined;\n\t}\n\n\tconst newEntries = getNewEntries(entries, lastVersion, VERSION);\n\tconst currentEntries = getEntriesForVersion(newEntries, VERSION);\n\tif (currentEntries.length > 0) {\n\t\tthis.settingsManager.setLastChangelogVersion(VERSION);\n\t\tthis.reportInstallTelemetry(VERSION);\n\t\treturn currentEntries\n\t\t\t.map((e) => {\n\t\t\t\tconst highlights = getChangelogHighlights(e);\n\t\t\t\tif (!highlights) return normalizeChangelogLinks(e.content, e);\n\t\t\t\tconst [heading] = e.content.split(\"\\n\");\n\t\t\t\treturn normalizeChangelogLinks(`${heading}\\n\\n${highlights}\\n\\n${FULL_CHANGELOG_HINT}`, e);\n\t\t\t})\n\t\t\t.join(\"\\n\\n\");\n\t}\n\n\treturn undefined;\n};\n\nInteractiveModeBase.prototype.reportInstallTelemetry = function (this: InteractiveModeBase, version: string): void {\n\tif (getEnvValue(ENV_OFFLINE)) {\n\t\treturn;\n\t}\n\n\tif (!isInstallTelemetryEnabled(this.settingsManager)) {\n\t\treturn;\n\t}\n\n\tvoid fetch(`${VERSION_ADOPTION_ENDPOINT}?version=${encodeURIComponent(version)}`, {\n\t\theaders: {\n\t\t\t\"User-Agent\": getPiUserAgent(version),\n\t\t},\n\t\tsignal: AbortSignal.timeout(5000),\n\t})\n\t\t.then(() => undefined)\n\t\t.catch(() => undefined);\n};\n\nInteractiveModeBase.prototype.getMarkdownThemeWithSettings = function (this: InteractiveModeBase): MarkdownTheme {\n\treturn {\n\t\t...getMarkdownTheme(),\n\t\tcodeBlockIndent: this.settingsManager.getCodeBlockIndent(),\n\t};\n};\n\nInteractiveModeBase.prototype.formatDisplayPath = function (this: InteractiveModeBase, p: string): string {\n\treturn shortenHomePath(p);\n};\n\nInteractiveModeBase.prototype.formatExtensionDisplayPath = function (this: InteractiveModeBase, path: string): string {\n\treturn this.formatDisplayPath(path).replace(/[\\\\/]index\\.(?:ts|js)$/, \"\");\n};\n\nInteractiveModeBase.prototype.formatContextPath = function (this: InteractiveModeBase, p: string): string {\n\tconst cwd = path.resolve(this.sessionManager.getCwd());\n\tconst absolutePath = path.isAbsolute(p) ? path.resolve(p) : path.resolve(cwd, p);\n\tconst relativePath = getCwdRelativePath(absolutePath, cwd);\n\tif (relativePath !== undefined) {\n\t\treturn relativePath;\n\t}\n\n\treturn this.formatDisplayPath(absolutePath);\n};\n\nInteractiveModeBase.prototype.getStartupModelLabel = function (this: InteractiveModeBase): string {\n\tconst model = this.session.state.model;\n\treturn model ? formatModelLabel(model, { thinkingLevel: this.session.thinkingLevel || \"off\" }) : \"no-model\";\n};\n\nInteractiveModeBase.prototype.getStartupIdentityText = function (\n\tthis: InteractiveModeBase,\n\tmaxWidth?: number,\n\tgap = 0,\n\tmanifestoPhase = 4,\n): string {\n\tconst appLabel = APP_NAME.length > 0 ? `${APP_NAME[0]!.toUpperCase()}${APP_NAME.slice(1)}` : \"Atomic\";\n\tconst noColor = process.env.NO_COLOR !== undefined;\n\tconst fg = (role: \"text\" | \"muted\" | \"dim\", text: string): string => (noColor ? text : theme.fg(role, text));\n\tconst showMark = supportsAtomicBanner();\n\tconst wordmark = showMark ? \"\" : `${atomicWordmark()} `;\n\tconst title = `${wordmark}${theme.bold(fg(\"text\", appLabel))} ${fg(\"muted\", `v${this.version}`)}`;\n\tconst modelLine = fg(\"muted\", this.getStartupModelLabel());\n\tconst markLines = showMark ? this.getAtomicAnsiMarkLines(gap) : [];\n\tconst markWidth = Math.max(0, ...markLines.map(visibleWidth));\n\tconst showMeta = gap === 0 || (maxWidth !== undefined && maxWidth < markWidth);\n\tconst metaLines = showMeta\n\t\t? [title, modelLine, fg(\"muted\", this.formatDisplayPath(this.sessionManager.getCwd()))]\n\t\t: [];\n\treturn composeStartupIdentity(\n\t\tmarkLines,\n\t\tmetaLines,\n\t\tmaxWidth,\n\t\tgap === 0 ? renderStartupManifesto(manifestoPhase) : [],\n\t);\n};\n\nInteractiveModeBase.prototype.getAtomicAnsiMarkLines = function (this: InteractiveModeBase, gap = 0): string[] {\n\treturn renderAtomicAssemblyBanner(gap, theme, this.session.thinkingLevel || \"off\");\n};\n\nInteractiveModeBase.prototype.getStartupExpansionState = function (this: InteractiveModeBase): boolean {\n\treturn this.options.verbose || this.toolOutputExpanded;\n};\n\n/**\n * Fullscreen paints on the alternate screen, so the \"Model scope\" line cannot be printed to stdout there\n * (it would stay in the shell after exit); it goes below the header instead (upstream #11508).\n */\nInteractiveModeBase.prototype.showFullscreenModelScopeNotice = function (this: InteractiveModeBase): void {\n\tconst notice = this.options.modelScopeNotice;\n\tif (!notice || !this.usesFullscreenRenderer) return;\n\tthis.headerContainer.addChild(new ThemedText(() => theme.fg(\"dim\", notice), 1, 0));\n\tthis.headerContainer.addChild(new Spacer(1));\n};\n\nInteractiveModeBase.prototype.shouldShowStartupHeader = function (this: InteractiveModeBase): boolean {\n\treturn this.options.verbose === true || this.settingsManager.getQuietStartup() !== true;\n};\n\nInteractiveModeBase.prototype.shouldShowStartupDetails = function (this: InteractiveModeBase): boolean {\n\treturn this.options.verbose === true || this.settingsManager.getQuietStartup() === false;\n};\n"]}
@@ -0,0 +1,20 @@
1
+ import type { ToolStatusReport } from "../../core/tool-status.js";
2
+ import type { InteractiveModeBase } from "./interactive-mode-base.ts";
3
+ export interface UnavailableToolsNoticeMode {
4
+ readonly runtimeHost?: InteractiveModeBase["runtimeHost"];
5
+ readonly session: Pick<InteractiveModeBase["session"], "getToolStatus">;
6
+ readonly startupNoticesContainer: InteractiveModeBase["startupNoticesContainer"];
7
+ showWarning(message: string, targetContainer?: InteractiveModeBase["startupNoticesContainer"]): void;
8
+ }
9
+ export declare function formatUnavailableToolsNotice(report: Pick<ToolStatusReport, "missing">): string | undefined;
10
+ /**
11
+ * Once startup has loaded extensions, name every selected tool, and every tool the session's history records as
12
+ * active, that nothing registered, so a tool never goes missing silently after a resume (#4660).
13
+ */
14
+ export declare function showUnavailableToolsNotice(mode: UnavailableToolsNoticeMode): Promise<void>;
15
+ /**
16
+ * Shows the notice and never fails startup: the notice only helps, so a status that cannot be read leaves the session
17
+ * as it is, with its tools, and what follows startup still runs. The reason goes to the debug log (#4660).
18
+ */
19
+ export declare function reportUnavailableTools(mode: UnavailableToolsNoticeMode): Promise<void>;
20
+ //# sourceMappingURL=interactive-unavailable-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive-unavailable-tools.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-unavailable-tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAC1D,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC,CAAC;IACxE,QAAQ,CAAC,uBAAuB,EAAE,mBAAmB,CAAC,yBAAyB,CAAC,CAAC;IACjF,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,mBAAmB,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAC;CACrG;AAWD,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAK1G;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhG;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAM5F"}
@@ -0,0 +1,40 @@
1
+ import { failureDebugFields, reportDebug } from "../../core/debug.js";
2
+ import { IsolatedInteractiveRuntime } from "../interactive-engine/isolated-runtime.js";
3
+ async function readStartupToolStatus(mode) {
4
+ const host = mode.runtimeHost;
5
+ if (!(host instanceof IsolatedInteractiveRuntime))
6
+ return mode.session.getToolStatus();
7
+ // The runtime reports a failed resource load as its own diagnostic; the tools that failure left missing are
8
+ // reported from the status read after it.
9
+ await host.waitUntilResourcesReady().catch(() => undefined);
10
+ return host.getToolStatus();
11
+ }
12
+ export function formatUnavailableToolsNotice(report) {
13
+ const names = report.missing.map((tool) => tool.name);
14
+ if (names.length === 0)
15
+ return undefined;
16
+ const subject = names.length === 1 ? "A tool this session was using isn't" : "Tools this session was using aren't";
17
+ return `${subject} available right now: ${names.join(", ")}. /tools shows why; /reload retries once that is fixed.`;
18
+ }
19
+ /**
20
+ * Once startup has loaded extensions, name every selected tool, and every tool the session's history records as
21
+ * active, that nothing registered, so a tool never goes missing silently after a resume (#4660).
22
+ */
23
+ export async function showUnavailableToolsNotice(mode) {
24
+ const notice = formatUnavailableToolsNotice(await readStartupToolStatus(mode));
25
+ if (notice)
26
+ mode.showWarning(notice, mode.startupNoticesContainer);
27
+ }
28
+ /**
29
+ * Shows the notice and never fails startup: the notice only helps, so a status that cannot be read leaves the session
30
+ * as it is, with its tools, and what follows startup still runs. The reason goes to the debug log (#4660).
31
+ */
32
+ export async function reportUnavailableTools(mode) {
33
+ try {
34
+ await showUnavailableToolsNotice(mode);
35
+ }
36
+ catch (error) {
37
+ reportDebug("storage", "startup-tool-status-unreadable", failureDebugFields(error));
38
+ }
39
+ }
40
+ //# sourceMappingURL=interactive-unavailable-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive-unavailable-tools.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-unavailable-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAUvF,KAAK,UAAU,qBAAqB,CAAC,IAAgC;IACpE,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;IAC9B,IAAI,CAAC,CAAC,IAAI,YAAY,0BAA0B,CAAC;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACvF,4GAA4G;IAC5G,0CAA0C;IAC1C,MAAM,IAAI,CAAC,uBAAuB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC5D,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,MAAyC;IACrF,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACzC,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,qCAAqC,CAAC;IACnH,OAAO,GAAG,OAAO,yBAAyB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,yDAAyD,CAAC;AACrH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,IAAgC;IAChF,MAAM,MAAM,GAAG,4BAA4B,CAAC,MAAM,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/E,IAAI,MAAM;QAAE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACpE,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,IAAgC;IAC5E,IAAI,CAAC;QACJ,MAAM,0BAA0B,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,WAAW,CAAC,SAAS,EAAE,gCAAgC,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACrF,CAAC;AACF,CAAC","sourcesContent":["import { failureDebugFields, reportDebug } from \"../../core/debug.ts\";\nimport type { ToolStatusReport } from \"../../core/tool-status.js\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.js\";\nimport type { InteractiveModeBase } from \"./interactive-mode-base.ts\";\n\nexport interface UnavailableToolsNoticeMode {\n\treadonly runtimeHost?: InteractiveModeBase[\"runtimeHost\"];\n\treadonly session: Pick<InteractiveModeBase[\"session\"], \"getToolStatus\">;\n\treadonly startupNoticesContainer: InteractiveModeBase[\"startupNoticesContainer\"];\n\tshowWarning(message: string, targetContainer?: InteractiveModeBase[\"startupNoticesContainer\"]): void;\n}\n\nasync function readStartupToolStatus(mode: UnavailableToolsNoticeMode): Promise<ToolStatusReport> {\n\tconst host = mode.runtimeHost;\n\tif (!(host instanceof IsolatedInteractiveRuntime)) return mode.session.getToolStatus();\n\t// The runtime reports a failed resource load as its own diagnostic; the tools that failure left missing are\n\t// reported from the status read after it.\n\tawait host.waitUntilResourcesReady().catch(() => undefined);\n\treturn host.getToolStatus();\n}\n\nexport function formatUnavailableToolsNotice(report: Pick<ToolStatusReport, \"missing\">): string | undefined {\n\tconst names = report.missing.map((tool) => tool.name);\n\tif (names.length === 0) return undefined;\n\tconst subject = names.length === 1 ? \"A tool this session was using isn't\" : \"Tools this session was using aren't\";\n\treturn `${subject} available right now: ${names.join(\", \")}. /tools shows why; /reload retries once that is fixed.`;\n}\n\n/**\n * Once startup has loaded extensions, name every selected tool, and every tool the session's history records as\n * active, that nothing registered, so a tool never goes missing silently after a resume (#4660).\n */\nexport async function showUnavailableToolsNotice(mode: UnavailableToolsNoticeMode): Promise<void> {\n\tconst notice = formatUnavailableToolsNotice(await readStartupToolStatus(mode));\n\tif (notice) mode.showWarning(notice, mode.startupNoticesContainer);\n}\n\n/**\n * Shows the notice and never fails startup: the notice only helps, so a status that cannot be read leaves the session\n * as it is, with its tools, and what follows startup still runs. The reason goes to the debug log (#4660).\n */\nexport async function reportUnavailableTools(mode: UnavailableToolsNoticeMode): Promise<void> {\n\ttry {\n\t\tawait showUnavailableToolsNotice(mode);\n\t} catch (error) {\n\t\treportDebug(\"storage\", \"startup-tool-status-unreadable\", failureDebugFields(error));\n\t}\n}\n"]}
@@ -17,7 +17,7 @@ class RemoteComponent {
17
17
  }
18
18
  wantsKeyRelease = true;
19
19
  handlesInternalUiAction;
20
- lines = ["Loading remote component…"];
20
+ lines = [];
21
21
  width = 0;
22
22
  rows = 0;
23
23
  requestId = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"remote-component.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/remote-component.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAS3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAsBvE;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAOjD,MAAM,eAAe;IACZ,aAAa,CAAkC;IACvD,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;IACD,QAA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,MAAM;gBACV,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBACvB,MAAM;YACP,KAAK,MAAM;gBACV,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACxB,MAAM;YACP,KAAK,SAAS;gBACb,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,MAAM;QACR,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { Component, OverlayHandle, OverlayOptions, TUI } from \"@earendil-works/pi-tui\";\nimport type { ExtensionUIContext } from \"../../core/extensions/index.js\";\nimport type { WidgetScrollRequest, WidgetScrollState } from \"../../core/extensions/ui-types.js\";\nimport { copyToClipboard } from \"../../utils/clipboard.js\";\nimport type { IsolatedInteractiveRuntime } from \"./isolated-runtime.js\";\nimport type {\n\tEngineBlockedStatus,\n\tEngineHostRenderSettings,\n\tInteractiveEngineMessage,\n\tJsonValue,\n\tSerializableOverlayOptions,\n} from \"./protocol.ts\";\nimport { RemoteFrameWidthClamp } from \"./remote-frame-clamp.ts\";\nimport { TerminalModeController } from \"./terminal-mode-controller.ts\";\n\nexport type RemoteComponentRuntime = Pick<\n\tIsolatedInteractiveRuntime,\n\t\"onEngineMessage\" | \"onGenerationEnded\" | \"sendEngineCommand\"\n>;\n\nexport type RemoteComponentUI = Pick<ExtensionUIContext, \"custom\" | \"requestRender\" | \"setWidget\" | \"onWidgetRelease\">;\n\ninterface MountedRemoteComponent {\n\tcomponent: RemoteComponent;\n\tdone: (result: JsonValue | undefined) => void;\n\tengineDone: boolean;\n\t/** The extension declared that this component binds Ctrl+C itself. */\n\thandlesCtrlC: boolean;\n\t/** The extension declared that this component claims internal UI actions. */\n\thandlesInternalUiAction: boolean;\n\thandle?: OverlayHandle;\n\twidgetKey?: string;\n\tunsubscribeWidgetRelease?: () => void;\n}\n\n/**\n * A stalled engine must not make fullscreen input wait forever. A timed-out\n * reply is treated as unhandled and lets the viewport process the key.\n */\nexport const REMOTE_INPUT_REPLY_TIMEOUT_MS = 250;\n\ninterface PendingInput {\n\tresolve: (handled: boolean | undefined) => void;\n\ttimer: ReturnType<typeof setTimeout>;\n}\n\nclass RemoteComponent implements Component {\n\tprivate scrollRequest: WidgetScrollRequest | undefined;\n\tgetScrollRequest(): WidgetScrollRequest | undefined {\n\t\treturn this.scrollRequest;\n\t}\n\tonScroll(state: WidgetScrollState): void {\n\t\tif (!this.disposed)\n\t\t\tthis.runtime.sendEngineCommand({ type: \"engine_custom_scroll\", componentId: this.componentId, state });\n\t}\n\twantsKeyRelease = true;\n\treadonly handlesInternalUiAction: boolean;\n\tprivate lines = [\"Loading remote component…\"];\n\tprivate width = 0;\n\tprivate rows = 0;\n\tprivate requestId = 0;\n\tprivate inputRequestId = 0;\n\tprivate appliedRequestId = 0;\n\tprivate dirty = true;\n\tprivate disposed = false;\n\tprivate readonly pendingInputs = new Map<number, PendingInput>();\n\tprivate readonly frameClamp = new RemoteFrameWidthClamp();\n\n\tprivate readonly componentId: string;\n\tprivate readonly runtime: RemoteComponentRuntime;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly getRows: () => number;\n\tprivate readonly getRenderSettings: () => EngineHostRenderSettings | undefined;\n\tprivate renderSettingsKey = \"\";\n\n\tconstructor(\n\t\tcomponentId: string,\n\t\truntime: RemoteComponentRuntime,\n\t\trequestRender: () => void,\n\t\tgetRows: () => number,\n\t\thandlesInternalUiAction = false,\n\t\tgetRenderSettings: () => EngineHostRenderSettings | undefined = () => undefined,\n\t) {\n\t\tthis.componentId = componentId;\n\t\tthis.runtime = runtime;\n\t\tthis.requestRender = requestRender;\n\t\tthis.getRows = getRows;\n\t\tthis.handlesInternalUiAction = handlesInternalUiAction;\n\t\tthis.getRenderSettings = getRenderSettings;\n\t}\n\n\trender(width: number): string[] {\n\t\tconst rows = this.getRows();\n\t\tconst renderSettings = this.getRenderSettings();\n\t\tconst renderSettingsKey =\n\t\t\trenderSettings === undefined\n\t\t\t\t? \"\"\n\t\t\t\t: `${renderSettings.hideThinkingBlock}|${renderSettings.toolOutputExpanded}|${renderSettings.fullscreenScrollbar}|${renderSettings.fullscreenWheelScrollLines}`;\n\t\tif (\n\t\t\t!this.disposed &&\n\t\t\t(this.dirty || width !== this.width || rows !== this.rows || renderSettingsKey !== this.renderSettingsKey)\n\t\t) {\n\t\t\tthis.width = width;\n\t\t\tthis.rows = rows;\n\t\t\tthis.renderSettingsKey = renderSettingsKey;\n\t\t\tthis.dirty = false;\n\t\t\tthis.runtime.sendEngineCommand({\n\t\t\t\ttype: \"engine_custom_render\",\n\t\t\t\tcomponentId: this.componentId,\n\t\t\t\trequestId: ++this.requestId,\n\t\t\t\twidth,\n\t\t\t\trows,\n\t\t\t\t...(renderSettings === undefined ? {} : { renderSettings }),\n\t\t\t});\n\t\t}\n\t\t// The engine child re-renders asynchronously; until the fresh frame\n\t\t// arrives, the previous frame may be wrapped for an older terminal\n\t\t// width. Clamp so a resize never replays overflowing lines (pi-tui\n\t\t// crashes on any rendered line wider than the terminal).\n\t\treturn this.frameClamp.clamp(this.lines, width);\n\t}\n\n\thandleInput(data: string): Promise<boolean | undefined> {\n\t\tif (this.disposed) return Promise.resolve(undefined);\n\t\tconst requestId = ++this.inputRequestId;\n\t\tconst result = new Promise<boolean | undefined>((resolve) => {\n\t\t\tconst timer = setTimeout(() => this.resolveInput(requestId, false), REMOTE_INPUT_REPLY_TIMEOUT_MS);\n\t\t\ttimer.unref?.();\n\t\t\tthis.pendingInputs.set(requestId, { resolve, timer });\n\t\t});\n\t\ttry {\n\t\t\tthis.runtime.sendEngineCommand({\n\t\t\t\ttype: \"engine_custom_input\",\n\t\t\t\tcomponentId: this.componentId,\n\t\t\t\trequestId,\n\t\t\t\tdata,\n\t\t\t});\n\t\t} catch {\n\t\t\tthis.resolveInput(requestId, false);\n\t\t}\n\t\t// Engine commands are delivered in order, so a frame requested now is\n\t\t// rendered by the child only AFTER it has applied this input. Pipelining\n\t\t// the request keeps keypress latency at a single round trip and repaints\n\t\t// components that never self-invalidate, instead of waiting for a\n\t\t// child-side invalidate (or an unrelated refresh) to trigger a frame.\n\t\tthis.dirty = true;\n\t\tthis.requestRender();\n\t\treturn result;\n\t}\n\n\tresolveInput(requestId: number, handled: boolean | undefined): void {\n\t\tconst pending = this.pendingInputs.get(requestId);\n\t\tif (!pending) return;\n\t\tthis.pendingInputs.delete(requestId);\n\t\tclearTimeout(pending.timer);\n\t\tpending.resolve(handled);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.dirty = true;\n\t}\n\n\tapplyFrame(requestId: number, lines: string[], scrollRequest?: WidgetScrollRequest): void {\n\t\tif (this.disposed || requestId < this.appliedRequestId) return;\n\t\tthis.appliedRequestId = requestId;\n\t\tthis.lines = lines;\n\t\tthis.scrollRequest = scrollRequest;\n\t\tthis.requestRender();\n\t}\n\n\trequestRemoteRender(): void {\n\t\tif (this.disposed) return;\n\t\tthis.dirty = true;\n\t\tthis.requestRender();\n\t}\n\n\t/**\n\t * Tear the proxy down. `notifyEngine` must be false once the writer no longer\n\t * points at the generation that owns this component: component IDs restart at\n\t * `remote_component_1` for every child, so a late dispose would address an\n\t * unrelated component in the replacement engine.\n\t */\n\tdispose(notifyEngine = true): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\tfor (const requestId of [...this.pendingInputs.keys()]) this.resolveInput(requestId, undefined);\n\t\tif (notifyEngine)\n\t\t\tthis.runtime.sendEngineCommand({ type: \"engine_custom_dispose\", componentId: this.componentId });\n\t}\n}\n\nfunction overlayOptions(options: SerializableOverlayOptions | undefined): OverlayOptions | undefined {\n\treturn options as OverlayOptions | undefined;\n}\n\n/**\n * Resolve the real host terminal from the pi-tui TUI handed to the overlay\n * factory. Optional: some hosts / test seams do not surface `tui.terminal`, in\n * which case terminal-mode controls harmlessly no-op.\n */\nfunction hostTerminal(tui: TUI): { write(data: string): void } {\n\tconst terminal = (tui as { terminal?: { write?(data: string): void } }).terminal;\n\treturn typeof terminal?.write === \"function\" ? (terminal as { write(data: string): void }) : { write: () => {} };\n}\n\nexport interface TuiRendererLifecycle {\n\tisFullscreen(): boolean;\n\tonRendererReplaced(listener: () => void): () => void;\n\t/** What the host's own chat shows; transcripts the engine paints in its overlays and widgets follow it. */\n\tchatRenderSettings?(): EngineHostRenderSettings;\n}\n\nexport class RemoteComponentController {\n\tprivate readonly mounted = new Map<string, MountedRemoteComponent>();\n\tprivate readonly unsubscribe: () => void;\n\tprivate readonly unsubscribeGenerationEnded: () => void;\n\tprivate readonly terminalModes: TerminalModeController;\n\tprivate readonly unsubscribeTuiRendererReplaced: () => void;\n\n\tprivate readonly runtime: RemoteComponentRuntime;\n\tprivate readonly ui: RemoteComponentUI;\n\tprivate readonly copyText: (text: string) => Promise<void>;\n\tprivate readonly tuiRendererLifecycle: TuiRendererLifecycle;\n\n\tconstructor(\n\t\truntime: RemoteComponentRuntime,\n\t\tui: RemoteComponentUI,\n\t\ttuiRendererLifecycle: TuiRendererLifecycle,\n\t\tcopyText: (text: string) => Promise<void> = copyToClipboard,\n\t) {\n\t\tthis.runtime = runtime;\n\t\tthis.ui = ui;\n\t\tthis.copyText = copyText;\n\t\tthis.tuiRendererLifecycle = tuiRendererLifecycle;\n\t\tthis.terminalModes = new TerminalModeController(() => tuiRendererLifecycle.isFullscreen());\n\t\tthis.unsubscribeTuiRendererReplaced = tuiRendererLifecycle.onRendererReplaced(() =>\n\t\t\tthis.terminalModes.rebindTui(),\n\t\t);\n\t\tthis.unsubscribe = runtime.onEngineMessage((message) => this.handleMessage(message));\n\t\t// Teardown is driven by engine death rather than the NEXT generation's\n\t\t// `engine_ready`, so a crash with no restart, or a hung/failed restart,\n\t\t// still releases the host editor, focus, and inline-custom-UI depth.\n\t\tthis.unsubscribeGenerationEnded = runtime.onGenerationEnded(() => this.disposeAll(\"generation-lost\"));\n\t}\n\n\tdispose(): void {\n\t\tthis.unsubscribeTuiRendererReplaced();\n\t\tthis.unsubscribe();\n\t\tthis.unsubscribeGenerationEnded();\n\t\tthis.disposeAll(\"host-shutdown\");\n\t}\n\n\t/** The remote overlay proxy that currently holds focus (see remote-input-ownership.ts). */\n\tfocusedRemoteOverlay(): unknown {\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.handle?.isFocused() === true) return record.component;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** `component` itself when it is one of this generation's live non-widget proxies. */\n\tremoteProxyOwner(component: unknown): unknown {\n\t\tif (!(component instanceof RemoteComponent)) return undefined;\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.component === component) return record.widgetKey === undefined ? component : undefined;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** True when the extension that mounted `component` declared it binds Ctrl+C. */\n\tremoteProxyHandlesCtrlC(component: unknown): boolean {\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.component === component) return record.handlesCtrlC;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Close exactly one live proxy through the ordinary host close path.\n\t *\n\t * The host escape from a component that traps Ctrl+C, and deliberately not\n\t * `disposeAll()`: that is generation-death teardown, which would also close\n\t * unrelated nested components and suppress the child notification. Here the\n\t * record stays registered while `done` runs, so `showExtensionCustom()`\n\t * hides this overlay (or remounts the editor) and its finalizer disposes the\n\t * proxy normally — which tells the healthy child to resolve its own\n\t * `ui.custom()` promise with `undefined`, exactly like a user cancel.\n\t */\n\tdismissRemoteProxy(component: unknown): boolean {\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.component !== component || record.widgetKey !== undefined) continue;\n\t\t\trecord.done(undefined);\n\t\t\tthis.ui.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate releaseWidget(widgetKey: string): void {\n\t\tfor (const [componentId, record] of this.mounted) {\n\t\t\tif (record.widgetKey !== widgetKey) continue;\n\t\t\tthis.mounted.delete(componentId);\n\t\t\trecord.unsubscribeWidgetRelease?.();\n\t\t\trecord.unsubscribeWidgetRelease = undefined;\n\t\t\tthis.terminalModes.onUnmount(componentId);\n\t\t}\n\t}\n\t/**\n\t * Close every mounted component.\n\t *\n\t * `\"generation-lost\"` closes through the real host close path: it hides the\n\t * overlay or remounts the editor into `editorContainer`, restores the saved\n\t * draft and focus, releases `blockingInlineCustomUiDepth`, and resolves the\n\t * extension's `ui.custom()` promise. Records are removed BEFORE each `done`\n\t * runs so the settlement path cannot re-enter the controller, and proxy\n\t * disposal is local-only because the writer already points at a replacement\n\t * child whose component IDs restart at `remote_component_1`.\n\t *\n\t * Order is newest-first, matching the TUI's overlay stack. Closing oldest\n\t * first would let an overlay mounted above an inline proxy restore focus to\n\t * that inline proxy after it had already been disposed.\n\t *\n\t * `\"host-shutdown\"` notifies the still-live engine child instead and leaves\n\t * host mounts alone: the TUI is already stopping and must not repaint.\n\t */\n\tprivate disposeAll(reason: \"generation-lost\" | \"host-shutdown\"): void {\n\t\tconst records = [...this.mounted.entries()].reverse();\n\t\tthis.mounted.clear();\n\t\tfor (const [componentId, record] of records) {\n\t\t\tthis.terminalModes.onUnmount(componentId);\n\t\t\trecord.unsubscribeWidgetRelease?.();\n\t\t\trecord.component.dispose(reason === \"host-shutdown\" && !record.engineDone);\n\t\t\tif (record.widgetKey) this.ui.setWidget(record.widgetKey, undefined);\n\t\t\telse if (reason === \"generation-lost\") record.done(undefined);\n\t\t}\n\t\tthis.terminalModes.resetAll();\n\t\tif (reason === \"generation-lost\" && records.length > 0) this.ui.requestRender();\n\t}\n\n\tprivate handleMessage(message: InteractiveEngineMessage): void {\n\t\tswitch (message.type) {\n\t\t\tcase \"engine_ready\":\n\t\t\t\t// Idempotent fallback for a generation replacement whose death event\n\t\t\t\t// was already handled: stale records must be gone before the new child\n\t\t\t\t// can reuse `remote_component_1`, and any terminal modes the dead\n\t\t\t\t// generation left on are reset here too.\n\t\t\t\tthis.disposeAll(\"generation-lost\");\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_open\":\n\t\t\t\tthis.open(\n\t\t\t\t\tmessage.componentId,\n\t\t\t\t\tmessage.overlay,\n\t\t\t\t\tmessage.deferInlineCustomUiFocus,\n\t\t\t\t\tmessage.overlayOptions,\n\t\t\t\t\tmessage.widgetKey,\n\t\t\t\t\tmessage.widgetPlacement,\n\t\t\t\t\tmessage.handlesCtrlC === true,\n\t\t\t\t\tmessage.handlesInternalUiAction === true,\n\t\t\t\t\tmessage.reserveTranscriptRows === true,\n\t\t\t\t\tmessage.purpose,\n\t\t\t\t\tmessage.widgetScroll,\n\t\t\t\t\tmessage.blocked,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_close\":\n\t\t\t\tthis.close(message.componentId);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_frame\":\n\t\t\t\tthis.mounted\n\t\t\t\t\t.get(message.componentId)\n\t\t\t\t\t?.component.applyFrame(message.requestId, message.lines, message.scrollRequest);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_input_result\":\n\t\t\t\tthis.mounted.get(message.componentId)?.component.resolveInput(message.requestId, message.handled);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_invalidate\":\n\t\t\t\tthis.mounted.get(message.componentId)?.component.requestRemoteRender();\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_copy\":\n\t\t\t\tvoid (async () => {\n\t\t\t\t\tlet error: string | undefined;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (!this.mounted.has(message.componentId)) throw new Error(\"Sign-in screen is no longer open\");\n\t\t\t\t\t\tawait this.copyText(message.text);\n\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\terror = cause instanceof Error ? cause.message : String(cause);\n\t\t\t\t\t}\n\t\t\t\t\tthis.runtime.sendEngineCommand({\n\t\t\t\t\t\ttype: \"engine_custom_copy_result\",\n\t\t\t\t\t\tcomponentId: message.componentId,\n\t\t\t\t\t\trequestId: message.requestId,\n\t\t\t\t\t\terror,\n\t\t\t\t\t});\n\t\t\t\t})();\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_terminal\":\n\t\t\t\tthis.terminalModes.applyControl(message.componentId, message.control);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_done\": {\n\t\t\t\tconst record = this.mounted.get(message.componentId);\n\t\t\t\tif (record) {\n\t\t\t\t\trecord.engineDone = true;\n\t\t\t\t\trecord.done(message.result);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"engine_custom_control\":\n\t\t\t\tthis.control(message.componentId, message.action);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tprivate open(\n\t\tcomponentId: string,\n\t\toverlay: boolean,\n\t\tdeferInlineCustomUiFocus: boolean | undefined,\n\t\toptions: SerializableOverlayOptions | undefined,\n\t\twidgetKey?: string,\n\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\",\n\t\thandlesCtrlC = false,\n\t\thandlesInternalUiAction = false,\n\t\treserveTranscriptRows = false,\n\t\tpurpose?: \"prompt\" | \"navigation\",\n\t\twidgetScroll?: { maxHeight: number; maxHeightFraction?: number },\n\t\tblocked?: EngineBlockedStatus,\n\t): void {\n\t\tif (this.mounted.has(componentId)) return;\n\t\tif (widgetKey) {\n\t\t\tlet getRows = () => 24;\n\t\t\tconst component = new RemoteComponent(\n\t\t\t\tcomponentId,\n\t\t\t\tthis.runtime,\n\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t() => getRows(),\n\t\t\t\thandlesInternalUiAction,\n\t\t\t\t() => this.tuiRendererLifecycle.chatRenderSettings?.(),\n\t\t\t);\n\t\t\tconst unsubscribeWidgetRelease = this.ui.onWidgetRelease?.(widgetKey, () => this.releaseWidget(widgetKey));\n\t\t\tthis.mounted.set(componentId, {\n\t\t\t\tcomponent,\n\t\t\t\tdone: () => {},\n\t\t\t\tengineDone: false,\n\t\t\t\thandlesCtrlC,\n\t\t\t\thandlesInternalUiAction,\n\t\t\t\twidgetKey,\n\t\t\t\tunsubscribeWidgetRelease,\n\t\t\t});\n\t\t\tthis.ui.setWidget(\n\t\t\t\twidgetKey,\n\t\t\t\t(tui) => {\n\t\t\t\t\tgetRows = () => tui.terminal.rows;\n\t\t\t\t\treturn component;\n\t\t\t\t},\n\t\t\t\t{ placement: widgetPlacement, ...(widgetScroll ? { scroll: widgetScroll } : {}) },\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tlet mounted: MountedRemoteComponent | undefined;\n\t\tvoid this.ui\n\t\t\t.custom<JsonValue | undefined>(\n\t\t\t\t(tui, _theme, _keybindings, done) => {\n\t\t\t\t\tconst component = new RemoteComponent(\n\t\t\t\t\t\tcomponentId,\n\t\t\t\t\t\tthis.runtime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t() => tui.terminal.rows,\n\t\t\t\t\t\thandlesInternalUiAction,\n\t\t\t\t\t\t() => this.tuiRendererLifecycle.chatRenderSettings?.(),\n\t\t\t\t\t);\n\t\t\t\t\tmounted = { component, done, engineDone: false, handlesCtrlC, handlesInternalUiAction };\n\t\t\t\t\tthis.mounted.set(componentId, mounted);\n\t\t\t\t\t// Bind this component to the real host terminal so a buffered\n\t\t\t\t\t// autowrap control emitted before the mount frame applies to the host TTY.\n\t\t\t\t\tthis.terminalModes.onMount(componentId, hostTerminal(tui));\n\t\t\t\t\treturn component;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\toverlay,\n\t\t\t\t\tpurpose,\n\t\t\t\t\tdeferInlineCustomUiFocus,\n\t\t\t\t\thandlesInternalUiAction,\n\t\t\t\t\treserveTranscriptRows,\n\t\t\t\t\toverlayOptions: overlayOptions(options),\n\t\t\t\t\tblocked,\n\t\t\t\t\tonHandle: (handle) => {\n\t\t\t\t\t\tif (mounted) mounted.handle = handle;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\t\t\t.catch(() => undefined)\n\t\t\t.finally(() => {\n\t\t\t\tthis.terminalModes.onUnmount(componentId);\n\t\t\t\tconst record = this.mounted.get(componentId);\n\t\t\t\tif (!record) return;\n\t\t\t\tthis.mounted.delete(componentId);\n\t\t\t\tif (record.engineDone) record.component.dispose(false);\n\t\t\t\telse record.component.dispose();\n\t\t\t});\n\t}\n\n\tprivate close(componentId: string): void {\n\t\tconst record = this.mounted.get(componentId);\n\t\tif (!record) return;\n\t\tthis.terminalModes.onUnmount(componentId);\n\t\tthis.mounted.delete(componentId);\n\t\trecord.unsubscribeWidgetRelease?.();\n\t\tif (record.widgetKey) this.ui.setWidget(record.widgetKey, undefined);\n\t\trecord.component.dispose();\n\t}\n\n\tprivate control(componentId: string, action: \"focus\" | \"hide\" | \"show\" | \"unfocus\"): void {\n\t\tconst handle = this.mounted.get(componentId)?.handle;\n\t\tif (!handle) return;\n\t\tswitch (action) {\n\t\t\tcase \"focus\":\n\t\t\t\thandle.focus();\n\t\t\t\tbreak;\n\t\t\tcase \"hide\":\n\t\t\t\thandle.setHidden(true);\n\t\t\t\tbreak;\n\t\t\tcase \"show\":\n\t\t\t\thandle.setHidden(false);\n\t\t\t\tbreak;\n\t\t\tcase \"unfocus\":\n\t\t\t\thandle.unfocus();\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"remote-component.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/remote-component.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAS3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAsBvE;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAOjD,MAAM,eAAe;IACZ,aAAa,CAAkC;IACvD,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;IACD,QAAQ,CAAC,KAAwB;QAChC,IAAI,CAAC,IAAI,CAAC,QAAQ;YACjB,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK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,EAAE,CAAC;gBACjB,MAAM;QACR,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { Component, OverlayHandle, OverlayOptions, TUI } from \"@earendil-works/pi-tui\";\nimport type { ExtensionUIContext } from \"../../core/extensions/index.js\";\nimport type { WidgetScrollRequest, WidgetScrollState } from \"../../core/extensions/ui-types.js\";\nimport { copyToClipboard } from \"../../utils/clipboard.js\";\nimport type { IsolatedInteractiveRuntime } from \"./isolated-runtime.js\";\nimport type {\n\tEngineBlockedStatus,\n\tEngineHostRenderSettings,\n\tInteractiveEngineMessage,\n\tJsonValue,\n\tSerializableOverlayOptions,\n} from \"./protocol.ts\";\nimport { RemoteFrameWidthClamp } from \"./remote-frame-clamp.ts\";\nimport { TerminalModeController } from \"./terminal-mode-controller.ts\";\n\nexport type RemoteComponentRuntime = Pick<\n\tIsolatedInteractiveRuntime,\n\t\"onEngineMessage\" | \"onGenerationEnded\" | \"sendEngineCommand\"\n>;\n\nexport type RemoteComponentUI = Pick<ExtensionUIContext, \"custom\" | \"requestRender\" | \"setWidget\" | \"onWidgetRelease\">;\n\ninterface MountedRemoteComponent {\n\tcomponent: RemoteComponent;\n\tdone: (result: JsonValue | undefined) => void;\n\tengineDone: boolean;\n\t/** The extension declared that this component binds Ctrl+C itself. */\n\thandlesCtrlC: boolean;\n\t/** The extension declared that this component claims internal UI actions. */\n\thandlesInternalUiAction: boolean;\n\thandle?: OverlayHandle;\n\twidgetKey?: string;\n\tunsubscribeWidgetRelease?: () => void;\n}\n\n/**\n * A stalled engine must not make fullscreen input wait forever. A timed-out\n * reply is treated as unhandled and lets the viewport process the key.\n */\nexport const REMOTE_INPUT_REPLY_TIMEOUT_MS = 250;\n\ninterface PendingInput {\n\tresolve: (handled: boolean | undefined) => void;\n\ttimer: ReturnType<typeof setTimeout>;\n}\n\nclass RemoteComponent implements Component {\n\tprivate scrollRequest: WidgetScrollRequest | undefined;\n\tgetScrollRequest(): WidgetScrollRequest | undefined {\n\t\treturn this.scrollRequest;\n\t}\n\tonScroll(state: WidgetScrollState): void {\n\t\tif (!this.disposed)\n\t\t\tthis.runtime.sendEngineCommand({ type: \"engine_custom_scroll\", componentId: this.componentId, state });\n\t}\n\twantsKeyRelease = true;\n\treadonly handlesInternalUiAction: boolean;\n\tprivate lines: string[] = [];\n\tprivate width = 0;\n\tprivate rows = 0;\n\tprivate requestId = 0;\n\tprivate inputRequestId = 0;\n\tprivate appliedRequestId = 0;\n\tprivate dirty = true;\n\tprivate disposed = false;\n\tprivate readonly pendingInputs = new Map<number, PendingInput>();\n\tprivate readonly frameClamp = new RemoteFrameWidthClamp();\n\n\tprivate readonly componentId: string;\n\tprivate readonly runtime: RemoteComponentRuntime;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly getRows: () => number;\n\tprivate readonly getRenderSettings: () => EngineHostRenderSettings | undefined;\n\tprivate renderSettingsKey = \"\";\n\n\tconstructor(\n\t\tcomponentId: string,\n\t\truntime: RemoteComponentRuntime,\n\t\trequestRender: () => void,\n\t\tgetRows: () => number,\n\t\thandlesInternalUiAction = false,\n\t\tgetRenderSettings: () => EngineHostRenderSettings | undefined = () => undefined,\n\t) {\n\t\tthis.componentId = componentId;\n\t\tthis.runtime = runtime;\n\t\tthis.requestRender = requestRender;\n\t\tthis.getRows = getRows;\n\t\tthis.handlesInternalUiAction = handlesInternalUiAction;\n\t\tthis.getRenderSettings = getRenderSettings;\n\t}\n\n\trender(width: number): string[] {\n\t\tconst rows = this.getRows();\n\t\tconst renderSettings = this.getRenderSettings();\n\t\tconst renderSettingsKey =\n\t\t\trenderSettings === undefined\n\t\t\t\t? \"\"\n\t\t\t\t: `${renderSettings.hideThinkingBlock}|${renderSettings.toolOutputExpanded}|${renderSettings.fullscreenScrollbar}|${renderSettings.fullscreenWheelScrollLines}`;\n\t\tif (\n\t\t\t!this.disposed &&\n\t\t\t(this.dirty || width !== this.width || rows !== this.rows || renderSettingsKey !== this.renderSettingsKey)\n\t\t) {\n\t\t\tthis.width = width;\n\t\t\tthis.rows = rows;\n\t\t\tthis.renderSettingsKey = renderSettingsKey;\n\t\t\tthis.dirty = false;\n\t\t\tthis.runtime.sendEngineCommand({\n\t\t\t\ttype: \"engine_custom_render\",\n\t\t\t\tcomponentId: this.componentId,\n\t\t\t\trequestId: ++this.requestId,\n\t\t\t\twidth,\n\t\t\t\trows,\n\t\t\t\t...(renderSettings === undefined ? {} : { renderSettings }),\n\t\t\t});\n\t\t}\n\t\t// The engine child re-renders asynchronously; until the fresh frame\n\t\t// arrives, the previous frame may be wrapped for an older terminal\n\t\t// width. Clamp so a resize never replays overflowing lines (pi-tui\n\t\t// crashes on any rendered line wider than the terminal).\n\t\treturn this.frameClamp.clamp(this.lines, width);\n\t}\n\n\thandleInput(data: string): Promise<boolean | undefined> {\n\t\tif (this.disposed) return Promise.resolve(undefined);\n\t\tconst requestId = ++this.inputRequestId;\n\t\tconst result = new Promise<boolean | undefined>((resolve) => {\n\t\t\tconst timer = setTimeout(() => this.resolveInput(requestId, false), REMOTE_INPUT_REPLY_TIMEOUT_MS);\n\t\t\ttimer.unref?.();\n\t\t\tthis.pendingInputs.set(requestId, { resolve, timer });\n\t\t});\n\t\ttry {\n\t\t\tthis.runtime.sendEngineCommand({\n\t\t\t\ttype: \"engine_custom_input\",\n\t\t\t\tcomponentId: this.componentId,\n\t\t\t\trequestId,\n\t\t\t\tdata,\n\t\t\t});\n\t\t} catch {\n\t\t\tthis.resolveInput(requestId, false);\n\t\t}\n\t\t// Engine commands are delivered in order, so a frame requested now is\n\t\t// rendered by the child only AFTER it has applied this input. Pipelining\n\t\t// the request keeps keypress latency at a single round trip and repaints\n\t\t// components that never self-invalidate, instead of waiting for a\n\t\t// child-side invalidate (or an unrelated refresh) to trigger a frame.\n\t\tthis.dirty = true;\n\t\tthis.requestRender();\n\t\treturn result;\n\t}\n\n\tresolveInput(requestId: number, handled: boolean | undefined): void {\n\t\tconst pending = this.pendingInputs.get(requestId);\n\t\tif (!pending) return;\n\t\tthis.pendingInputs.delete(requestId);\n\t\tclearTimeout(pending.timer);\n\t\tpending.resolve(handled);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.dirty = true;\n\t}\n\n\tapplyFrame(requestId: number, lines: string[], scrollRequest?: WidgetScrollRequest): void {\n\t\tif (this.disposed || requestId < this.appliedRequestId) return;\n\t\tthis.appliedRequestId = requestId;\n\t\tthis.lines = lines;\n\t\tthis.scrollRequest = scrollRequest;\n\t\tthis.requestRender();\n\t}\n\n\trequestRemoteRender(): void {\n\t\tif (this.disposed) return;\n\t\tthis.dirty = true;\n\t\tthis.requestRender();\n\t}\n\n\t/**\n\t * Tear the proxy down. `notifyEngine` must be false once the writer no longer\n\t * points at the generation that owns this component: component IDs restart at\n\t * `remote_component_1` for every child, so a late dispose would address an\n\t * unrelated component in the replacement engine.\n\t */\n\tdispose(notifyEngine = true): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\tfor (const requestId of [...this.pendingInputs.keys()]) this.resolveInput(requestId, undefined);\n\t\tif (notifyEngine)\n\t\t\tthis.runtime.sendEngineCommand({ type: \"engine_custom_dispose\", componentId: this.componentId });\n\t}\n}\n\nfunction overlayOptions(options: SerializableOverlayOptions | undefined): OverlayOptions | undefined {\n\treturn options as OverlayOptions | undefined;\n}\n\n/**\n * Resolve the real host terminal from the pi-tui TUI handed to the overlay\n * factory. Optional: some hosts / test seams do not surface `tui.terminal`, in\n * which case terminal-mode controls harmlessly no-op.\n */\nfunction hostTerminal(tui: TUI): { write(data: string): void } {\n\tconst terminal = (tui as { terminal?: { write?(data: string): void } }).terminal;\n\treturn typeof terminal?.write === \"function\" ? (terminal as { write(data: string): void }) : { write: () => {} };\n}\n\nexport interface TuiRendererLifecycle {\n\tisFullscreen(): boolean;\n\tonRendererReplaced(listener: () => void): () => void;\n\t/** What the host's own chat shows; transcripts the engine paints in its overlays and widgets follow it. */\n\tchatRenderSettings?(): EngineHostRenderSettings;\n}\n\nexport class RemoteComponentController {\n\tprivate readonly mounted = new Map<string, MountedRemoteComponent>();\n\tprivate readonly unsubscribe: () => void;\n\tprivate readonly unsubscribeGenerationEnded: () => void;\n\tprivate readonly terminalModes: TerminalModeController;\n\tprivate readonly unsubscribeTuiRendererReplaced: () => void;\n\n\tprivate readonly runtime: RemoteComponentRuntime;\n\tprivate readonly ui: RemoteComponentUI;\n\tprivate readonly copyText: (text: string) => Promise<void>;\n\tprivate readonly tuiRendererLifecycle: TuiRendererLifecycle;\n\n\tconstructor(\n\t\truntime: RemoteComponentRuntime,\n\t\tui: RemoteComponentUI,\n\t\ttuiRendererLifecycle: TuiRendererLifecycle,\n\t\tcopyText: (text: string) => Promise<void> = copyToClipboard,\n\t) {\n\t\tthis.runtime = runtime;\n\t\tthis.ui = ui;\n\t\tthis.copyText = copyText;\n\t\tthis.tuiRendererLifecycle = tuiRendererLifecycle;\n\t\tthis.terminalModes = new TerminalModeController(() => tuiRendererLifecycle.isFullscreen());\n\t\tthis.unsubscribeTuiRendererReplaced = tuiRendererLifecycle.onRendererReplaced(() =>\n\t\t\tthis.terminalModes.rebindTui(),\n\t\t);\n\t\tthis.unsubscribe = runtime.onEngineMessage((message) => this.handleMessage(message));\n\t\t// Teardown is driven by engine death rather than the NEXT generation's\n\t\t// `engine_ready`, so a crash with no restart, or a hung/failed restart,\n\t\t// still releases the host editor, focus, and inline-custom-UI depth.\n\t\tthis.unsubscribeGenerationEnded = runtime.onGenerationEnded(() => this.disposeAll(\"generation-lost\"));\n\t}\n\n\tdispose(): void {\n\t\tthis.unsubscribeTuiRendererReplaced();\n\t\tthis.unsubscribe();\n\t\tthis.unsubscribeGenerationEnded();\n\t\tthis.disposeAll(\"host-shutdown\");\n\t}\n\n\t/** The remote overlay proxy that currently holds focus (see remote-input-ownership.ts). */\n\tfocusedRemoteOverlay(): unknown {\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.handle?.isFocused() === true) return record.component;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** `component` itself when it is one of this generation's live non-widget proxies. */\n\tremoteProxyOwner(component: unknown): unknown {\n\t\tif (!(component instanceof RemoteComponent)) return undefined;\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.component === component) return record.widgetKey === undefined ? component : undefined;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** True when the extension that mounted `component` declared it binds Ctrl+C. */\n\tremoteProxyHandlesCtrlC(component: unknown): boolean {\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.component === component) return record.handlesCtrlC;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Close exactly one live proxy through the ordinary host close path.\n\t *\n\t * The host escape from a component that traps Ctrl+C, and deliberately not\n\t * `disposeAll()`: that is generation-death teardown, which would also close\n\t * unrelated nested components and suppress the child notification. Here the\n\t * record stays registered while `done` runs, so `showExtensionCustom()`\n\t * hides this overlay (or remounts the editor) and its finalizer disposes the\n\t * proxy normally — which tells the healthy child to resolve its own\n\t * `ui.custom()` promise with `undefined`, exactly like a user cancel.\n\t */\n\tdismissRemoteProxy(component: unknown): boolean {\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.component !== component || record.widgetKey !== undefined) continue;\n\t\t\trecord.done(undefined);\n\t\t\tthis.ui.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate releaseWidget(widgetKey: string): void {\n\t\tfor (const [componentId, record] of this.mounted) {\n\t\t\tif (record.widgetKey !== widgetKey) continue;\n\t\t\tthis.mounted.delete(componentId);\n\t\t\trecord.unsubscribeWidgetRelease?.();\n\t\t\trecord.unsubscribeWidgetRelease = undefined;\n\t\t\tthis.terminalModes.onUnmount(componentId);\n\t\t}\n\t}\n\t/**\n\t * Close every mounted component.\n\t *\n\t * `\"generation-lost\"` closes through the real host close path: it hides the\n\t * overlay or remounts the editor into `editorContainer`, restores the saved\n\t * draft and focus, releases `blockingInlineCustomUiDepth`, and resolves the\n\t * extension's `ui.custom()` promise. Records are removed BEFORE each `done`\n\t * runs so the settlement path cannot re-enter the controller, and proxy\n\t * disposal is local-only because the writer already points at a replacement\n\t * child whose component IDs restart at `remote_component_1`.\n\t *\n\t * Order is newest-first, matching the TUI's overlay stack. Closing oldest\n\t * first would let an overlay mounted above an inline proxy restore focus to\n\t * that inline proxy after it had already been disposed.\n\t *\n\t * `\"host-shutdown\"` notifies the still-live engine child instead and leaves\n\t * host mounts alone: the TUI is already stopping and must not repaint.\n\t */\n\tprivate disposeAll(reason: \"generation-lost\" | \"host-shutdown\"): void {\n\t\tconst records = [...this.mounted.entries()].reverse();\n\t\tthis.mounted.clear();\n\t\tfor (const [componentId, record] of records) {\n\t\t\tthis.terminalModes.onUnmount(componentId);\n\t\t\trecord.unsubscribeWidgetRelease?.();\n\t\t\trecord.component.dispose(reason === \"host-shutdown\" && !record.engineDone);\n\t\t\tif (record.widgetKey) this.ui.setWidget(record.widgetKey, undefined);\n\t\t\telse if (reason === \"generation-lost\") record.done(undefined);\n\t\t}\n\t\tthis.terminalModes.resetAll();\n\t\tif (reason === \"generation-lost\" && records.length > 0) this.ui.requestRender();\n\t}\n\n\tprivate handleMessage(message: InteractiveEngineMessage): void {\n\t\tswitch (message.type) {\n\t\t\tcase \"engine_ready\":\n\t\t\t\t// Idempotent fallback for a generation replacement whose death event\n\t\t\t\t// was already handled: stale records must be gone before the new child\n\t\t\t\t// can reuse `remote_component_1`, and any terminal modes the dead\n\t\t\t\t// generation left on are reset here too.\n\t\t\t\tthis.disposeAll(\"generation-lost\");\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_open\":\n\t\t\t\tthis.open(\n\t\t\t\t\tmessage.componentId,\n\t\t\t\t\tmessage.overlay,\n\t\t\t\t\tmessage.deferInlineCustomUiFocus,\n\t\t\t\t\tmessage.overlayOptions,\n\t\t\t\t\tmessage.widgetKey,\n\t\t\t\t\tmessage.widgetPlacement,\n\t\t\t\t\tmessage.handlesCtrlC === true,\n\t\t\t\t\tmessage.handlesInternalUiAction === true,\n\t\t\t\t\tmessage.reserveTranscriptRows === true,\n\t\t\t\t\tmessage.purpose,\n\t\t\t\t\tmessage.widgetScroll,\n\t\t\t\t\tmessage.blocked,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_close\":\n\t\t\t\tthis.close(message.componentId);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_frame\":\n\t\t\t\tthis.mounted\n\t\t\t\t\t.get(message.componentId)\n\t\t\t\t\t?.component.applyFrame(message.requestId, message.lines, message.scrollRequest);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_input_result\":\n\t\t\t\tthis.mounted.get(message.componentId)?.component.resolveInput(message.requestId, message.handled);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_invalidate\":\n\t\t\t\tthis.mounted.get(message.componentId)?.component.requestRemoteRender();\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_copy\":\n\t\t\t\tvoid (async () => {\n\t\t\t\t\tlet error: string | undefined;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (!this.mounted.has(message.componentId)) throw new Error(\"Sign-in screen is no longer open\");\n\t\t\t\t\t\tawait this.copyText(message.text);\n\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\terror = cause instanceof Error ? cause.message : String(cause);\n\t\t\t\t\t}\n\t\t\t\t\tthis.runtime.sendEngineCommand({\n\t\t\t\t\t\ttype: \"engine_custom_copy_result\",\n\t\t\t\t\t\tcomponentId: message.componentId,\n\t\t\t\t\t\trequestId: message.requestId,\n\t\t\t\t\t\terror,\n\t\t\t\t\t});\n\t\t\t\t})();\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_terminal\":\n\t\t\t\tthis.terminalModes.applyControl(message.componentId, message.control);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_done\": {\n\t\t\t\tconst record = this.mounted.get(message.componentId);\n\t\t\t\tif (record) {\n\t\t\t\t\trecord.engineDone = true;\n\t\t\t\t\trecord.done(message.result);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"engine_custom_control\":\n\t\t\t\tthis.control(message.componentId, message.action);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tprivate open(\n\t\tcomponentId: string,\n\t\toverlay: boolean,\n\t\tdeferInlineCustomUiFocus: boolean | undefined,\n\t\toptions: SerializableOverlayOptions | undefined,\n\t\twidgetKey?: string,\n\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\",\n\t\thandlesCtrlC = false,\n\t\thandlesInternalUiAction = false,\n\t\treserveTranscriptRows = false,\n\t\tpurpose?: \"prompt\" | \"navigation\",\n\t\twidgetScroll?: { maxHeight: number; maxHeightFraction?: number },\n\t\tblocked?: EngineBlockedStatus,\n\t): void {\n\t\tif (this.mounted.has(componentId)) return;\n\t\tif (widgetKey) {\n\t\t\tlet getRows = () => 24;\n\t\t\tconst component = new RemoteComponent(\n\t\t\t\tcomponentId,\n\t\t\t\tthis.runtime,\n\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t() => getRows(),\n\t\t\t\thandlesInternalUiAction,\n\t\t\t\t() => this.tuiRendererLifecycle.chatRenderSettings?.(),\n\t\t\t);\n\t\t\tconst unsubscribeWidgetRelease = this.ui.onWidgetRelease?.(widgetKey, () => this.releaseWidget(widgetKey));\n\t\t\tthis.mounted.set(componentId, {\n\t\t\t\tcomponent,\n\t\t\t\tdone: () => {},\n\t\t\t\tengineDone: false,\n\t\t\t\thandlesCtrlC,\n\t\t\t\thandlesInternalUiAction,\n\t\t\t\twidgetKey,\n\t\t\t\tunsubscribeWidgetRelease,\n\t\t\t});\n\t\t\tthis.ui.setWidget(\n\t\t\t\twidgetKey,\n\t\t\t\t(tui) => {\n\t\t\t\t\tgetRows = () => tui.terminal.rows;\n\t\t\t\t\treturn component;\n\t\t\t\t},\n\t\t\t\t{ placement: widgetPlacement, ...(widgetScroll ? { scroll: widgetScroll } : {}) },\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tlet mounted: MountedRemoteComponent | undefined;\n\t\tvoid this.ui\n\t\t\t.custom<JsonValue | undefined>(\n\t\t\t\t(tui, _theme, _keybindings, done) => {\n\t\t\t\t\tconst component = new RemoteComponent(\n\t\t\t\t\t\tcomponentId,\n\t\t\t\t\t\tthis.runtime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t() => tui.terminal.rows,\n\t\t\t\t\t\thandlesInternalUiAction,\n\t\t\t\t\t\t() => this.tuiRendererLifecycle.chatRenderSettings?.(),\n\t\t\t\t\t);\n\t\t\t\t\tmounted = { component, done, engineDone: false, handlesCtrlC, handlesInternalUiAction };\n\t\t\t\t\tthis.mounted.set(componentId, mounted);\n\t\t\t\t\t// Bind this component to the real host terminal so a buffered\n\t\t\t\t\t// autowrap control emitted before the mount frame applies to the host TTY.\n\t\t\t\t\tthis.terminalModes.onMount(componentId, hostTerminal(tui));\n\t\t\t\t\treturn component;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\toverlay,\n\t\t\t\t\tpurpose,\n\t\t\t\t\tdeferInlineCustomUiFocus,\n\t\t\t\t\thandlesInternalUiAction,\n\t\t\t\t\treserveTranscriptRows,\n\t\t\t\t\toverlayOptions: overlayOptions(options),\n\t\t\t\t\tblocked,\n\t\t\t\t\tonHandle: (handle) => {\n\t\t\t\t\t\tif (mounted) mounted.handle = handle;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\t\t\t.catch(() => undefined)\n\t\t\t.finally(() => {\n\t\t\t\tthis.terminalModes.onUnmount(componentId);\n\t\t\t\tconst record = this.mounted.get(componentId);\n\t\t\t\tif (!record) return;\n\t\t\t\tthis.mounted.delete(componentId);\n\t\t\t\tif (record.engineDone) record.component.dispose(false);\n\t\t\t\telse record.component.dispose();\n\t\t\t});\n\t}\n\n\tprivate close(componentId: string): void {\n\t\tconst record = this.mounted.get(componentId);\n\t\tif (!record) return;\n\t\tthis.terminalModes.onUnmount(componentId);\n\t\tthis.mounted.delete(componentId);\n\t\trecord.unsubscribeWidgetRelease?.();\n\t\tif (record.widgetKey) this.ui.setWidget(record.widgetKey, undefined);\n\t\trecord.component.dispose();\n\t}\n\n\tprivate control(componentId: string, action: \"focus\" | \"hide\" | \"show\" | \"unfocus\"): void {\n\t\tconst handle = this.mounted.get(componentId)?.handle;\n\t\tif (!handle) return;\n\t\tswitch (action) {\n\t\t\tcase \"focus\":\n\t\t\t\thandle.focus();\n\t\t\t\tbreak;\n\t\t\tcase \"hide\":\n\t\t\t\thandle.setHidden(true);\n\t\t\t\tbreak;\n\t\t\tcase \"show\":\n\t\t\t\thandle.setHidden(false);\n\t\t\t\tbreak;\n\t\t\tcase \"unfocus\":\n\t\t\t\thandle.unfocus();\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n"]}
@@ -246,7 +246,7 @@ Shell details show the command, available exit information, and a bounded output
246
246
  | Failed | Execution ended with an error. Details retain the error message. |
247
247
  | Stopped | Execution was cancelled. Completed work is not undone. |
248
248
 
249
- Completed, failed, and stopped tasks retain inspection but do not offer execution controls. **Foreground wait** observes a running task; it does not transfer ownership or create a second execution.
249
+ Completed, failed, and stopped tasks retain inspection but do not offer execution controls.
250
250
 
251
251
  ## Background shells
252
252
 
@@ -1080,7 +1080,7 @@ await pi.registerProvider("local-server", {
1080
1080
  const baseUrl = await prompt({
1081
1081
  type: "text",
1082
1082
  message: "Server URL",
1083
- placeholder: "http://localhost:8080"
1083
+ placeholder: "http://localhost:9931"
1084
1084
  });
1085
1085
  if (signal.aborted) throw new Error("Login cancelled");
1086
1086
  return { type: "api_key", env: { LOCAL_SERVER_URL: baseUrl } };
@@ -863,6 +863,8 @@ Run control actions describe the caller's request: an already-aborted caller sig
863
863
 
864
864
  Use `ctx.observeWorkflowActivity` for status consumers. Registration captures a snapshot atomically with attaching the observer. Delivery is asynchronous, snapshot first, then FIFO updates. Each callback finishes before the next callback for that observer starts; a slow observer does not delay the publisher or other observers.
865
865
 
866
+ Each frame and each `workflow_activity_changed` event has its own copy of the root, its `graph` and the graph's `nodes` array. The nodes themselves are deep-frozen and shared between frames and observers, so changing one throws in strict mode: copy a node (`{ ...node }`) before changing it.
867
+
866
868
  ```typescript
867
869
  import type { ExtensionAPI, WorkflowActivitySubscription, WorkflowRootActivity } from "@bastani/atomic";
868
870
 
@@ -79,13 +79,13 @@ It belongs to the `IntercomBrokerError` family. Both classes are exported from `
79
79
 
80
80
  ### Upgrading Atomic with sessions running
81
81
 
82
- Sessions on one machine share one broker, and it keeps running after the Atomic that started it is replaced. Each broker reports the range of Intercom protocol versions it accepts (`atomic intercom status` shows it as `Protocol:`); a broker from Atomic 0.9.71 or earlier reports none and speaks protocol 1. This version speaks protocols 1 to 2.
82
+ Sessions on one machine share one broker, and it keeps running after the Atomic that started it is replaced. Each broker reports the range of Intercom protocol versions it accepts (`atomic intercom status` shows it as `Protocol:`); a broker from Atomic 0.9.71 or earlier reports none and speaks protocol 1. This version speaks protocols 1 to 3.
83
83
 
84
84
  - **A session of a newer version replaces an older broker.** When a session starts and finds a broker whose range this version covers, it asks that broker to shut down, waits for its process to exit, and starts its own broker in its place. It waits up to a minute: on Windows an older broker can take about 30 seconds to exit while sessions are connected. Until the successor answers, sessions of either version wait for it instead of starting a broker of their own. Sessions of the older version reconnect to it as they do after any broker restart, keep their session IDs, and keep exchanging messages with sessions of the new version. Sessions starting together replace the broker once.
85
85
  - **A broker that cannot be replaced is used on this machine only.** If the older broker does not stop, reads another shared storage selection than a broker started by this session would, or shares no protocol version with this one, the session leaves it running and registers as an older session would. With no multi-node storage configured, it shows one warning and continues on this machine. With multi-node storage selected, or when the older broker routes across machines, the session is refused with `IntercomRoutingUnavailableError` instead, because it cannot verify how the broker routes. In both cases `atomic intercom restart` replaces the broker.
86
86
  - **Installers and `atomic update` finish by running `atomic intercom upgrade`** when the version they installed has it. It stops an older broker that has no session connected, so the next session starts the new one, and otherwise leaves the broker to the next session of the new version. It is safe to run at any time.
87
87
 
88
- While a session uses an older broker, requests that need a newer protocol, such as keeping a released subagent addressable, fail before anything is sent:
88
+ While a session uses an older broker, requests that need a newer protocol, such as keeping a released subagent or a released workflow stage addressable, fail before anything is sent:
89
89
 
90
90
  | Class | `code` | When it happens | Fields | What to do |
91
91
  | --- | --- | --- | --- | --- |
@@ -149,6 +149,16 @@ SDK integrations can import these classes, their guards, `IntercomReleasedChildE
149
149
  | `ReleasedChildReservationError` | `invalid_frame`, `invalid_child_name`, `invalid_alias`, `too_many_aliases`, `invalid_group` | The request is malformed: 1–500 children per frame, a non-empty name other than `*`, at most 4 session-id aliases, and a string group. | Fix the named child and send the request again. |
150
150
  | `UnknownReleasedChildError` | `unknown_released_child` | A wake acknowledgement names a child that no session has reserved. | Reserve the child first. |
151
151
 
152
+ A session can host lightweight sessions on its own broker connection with `IntercomClient.hostSessions`: each is listed and addressed like a connected session, messages for it arrive as `hosted_message` events, and `send(to, { hostedSender })` sends as it. Atomic uses this for released workflow stages. Requests are refused with these typed errors; each carries `code`, `key` or `sessionId` naming the item when one caused it, a `hint`, and `retryable: false`. Check `isIntercomHostedSessionError` or the class, never the message. SDK integrations can import them with `serializeIntercomHostedSessionError` / `rehydrateIntercomHostedSessionError` from `@bastani/intercom`.
153
+
154
+ | Class | `code` | When | What to do |
155
+ | --- | --- | --- | --- |
156
+ | `HostedSessionRequestError` | `invalid_hosted_frame` | The request is malformed: 1–500 sessions per frame under distinct non-empty keys, or 1–500 session ids to remove. Nothing in it took effect. | Fix the request and send it again. |
157
+ | `HostedSessionRequestError` | `invalid_hosted_session` | A hosted session has no name, is not a valid agent registration, or has a malformed return address or live workflow-stage route. Nothing in its request took effect. | Fix the named item and send the request again. |
158
+ | `NotHostedSessionError` | `not_hosted_by_connection` | A send names a `hostedSender`, or a removal names a session, that this connection does not host. A refused send's result has this `reasonCode` and the error in `error`. | Send from, or remove through, the connection that hosts the session; after a reconnect, host it again. |
159
+
160
+ A hosting request the broker does not answer within 5 seconds fails with `IntercomHostedSessionTimeoutError` (`code` `hosted_session_timeout`, `phase` `"hosted-session-request"`, `requestType`, `sessionCount`, `timeoutMs`, `elapsedMs`, `hint`, `retryable: true`; `cause` is the failed health check when the broker stopped answering altogether). Released stages that need hosting again are hosted on the next connection. A hosting request a broker below protocol 3 refuses fails with `IntercomBrokerProtocolError`, which is not retried: replace the broker with `atomic intercom restart`. Failures of the background reconnect are recorded in the debug log, and it stops after 30 attempts in a row until the next released stage is adopted.
161
+
152
162
  With [multi-node routing](/intercom/operations#running-intercom-across-machines) on, a child reserved through one broker stays with its owner. A reservation that another session makes for it through a different broker is withdrawn as soon as the shared store refuses it.
153
163
 
154
164
  ### Subagents with no live session
@@ -165,6 +175,7 @@ The send result's `error` is an `IntercomRecipientGoneError` and `reasonCode` is
165
175
  | `SubagentRecipientEndedError` | `recipient_cancelled` | The subagent was cancelled for good, or its workflow stage ended. | `false` | Launch a fresh subagent if its work is still needed. |
166
176
  | `SubagentRecipientDisconnectedError` | `recipient_disconnected` | The subagent disconnected, did not reconnect within 20 seconds, and its launching session did not say why. | `true` | Check `subagent({ action: "status" })` in its launching session, or try again shortly. |
167
177
  | `SubagentRecipientOwnerSuspendedError` | `recipient_owner_suspended` | The subagent is released and the session that launched it, which wakes it, is suspended or disconnected; the send waited 20 seconds, or could not wait. | `true` | Try again once that session is back, or send to its workflow stage target (`workflow:<rootRunId>/<stage>`), which queues the message until the stage reopens. |
178
+ | `StageRecipientReleasedError` | `recipient_stage_released` | A send or ask names a released workflow stage whose hosted peer is gone: its host connection removed it or closed, and it is not hosted again. The message reads `Workflow stage "<name>" …`. | `false` | Send to its workflow stage target (`workflow:<rootRunId>/<stage>`), which reaches the stage's current session or queues until it reopens, or resume the run. |
168
179
 
169
180
  A launching session reports at most 500 subagents per request; a malformed report is refused with the `ReleasedChildReservationError` codes above, and a report naming a subagent another session owns with `not_owner`.
170
181
 
@@ -236,6 +247,6 @@ Config validation is strict: every field is checked, and if the file is not vali
236
247
 
237
248
  Intercom publishes live session status automatically: sessions register as `idle`, switch to `thinking` while the agent is running, show `tool:<name>` during tool execution, and return to `idle` on completion. A configured `status` is appended as context instead of replacing the lifecycle status.
238
249
 
239
- Activity is not reply capability. Session rows include `replyCapability: live` or `terminal` when the host supplies it; terminal noninteractive children cannot answer asks even if activity says `idle`. Closed workflow generations show `closed · reply: post-mortem only` when a late-message router is present, or `closed · reply: unavailable` without one. Post-mortem routing still validates the retained conversation and can return a bounded error if it is unavailable; it never resumes workflow execution. Missing capability metadata is not a guarantee that an ask can succeed. A completed workflow stage released from memory keeps a listing with the same status for as long as the session that ran the workflow is open; an ask to it reopens the saved conversation for one turn and returns that turn's final answer, and a plain send reaches the session that ran the workflow. Invocation/subgroup visibility and stale-ID rejection are unchanged.
250
+ Activity is not reply capability. Session rows include `replyCapability: live` or `terminal` when the host supplies it; terminal noninteractive children cannot answer asks even if activity says `idle`. Closed workflow generations show `closed · reply: post-mortem only` when a late-message router is present, or `closed · reply: unavailable` without one. Post-mortem routing still validates the retained conversation and can return a bounded error if it is unavailable; it never resumes workflow execution. Missing capability metadata is not a guarantee that an ask can succeed. A completed workflow stage released from memory keeps a listing with the same status for as long as the session that ran the workflow is open; an ask to it reopens the saved conversation for one turn and returns that turn's final answer, and a plain send reaches the session that ran the workflow. If that session loses its broker connection, these listings return when it reconnects. While it is gone, a send or ask to the stage's name or session ID fails with `StageRecipientReleasedError` (`recipient_stage_released`), which names the stage's `workflow:` target to send to instead; if the broker itself restarted and knows nothing of the stage, it fails as one to an unknown session. A client below broker protocol 3 gets only the plain reason text of that refusal. Invocation/subgroup visibility and stale-ID rejection are unchanged.
240
251
 
241
252
  For a retained post-mortem conversation, use its exact Intercom session ID or the previously listed canonical stage path, including its final-stage-name variant. Alternate materialized run-ID paths resolve active stages through the workflow owner; they are not retained aliases after the stage completes. A stage marked `reply: unavailable` rejects an ask with guidance to contact a live stage or start new work with explicit context.