@bastani/atomic 0.9.14-alpha.4 → 0.9.14-alpha.6

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 (141) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/builtin/intercom/package.json +1 -1
  3. package/dist/builtin/mcp/package.json +1 -1
  4. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  5. package/dist/builtin/subagents/package.json +1 -1
  6. package/dist/builtin/subagents/src/extension/schemas.ts +5 -0
  7. package/dist/builtin/subagents/src/runs/shared/long-running-guard.ts +3 -1
  8. package/dist/builtin/subagents/src/runs/shared/progress-trend.ts +69 -0
  9. package/dist/builtin/subagents/src/runs/shared/subagent-control.ts +12 -1
  10. package/dist/builtin/subagents/src/shared/types-results.ts +2 -0
  11. package/dist/builtin/web-access/package.json +1 -1
  12. package/dist/builtin/workflows/CHANGELOG.md +47 -1
  13. package/dist/builtin/workflows/README.md +6 -5
  14. package/dist/builtin/workflows/builtin/adversarial-verification-prompts.ts +13 -5
  15. package/dist/builtin/workflows/builtin/adversarial-verification-runner.ts +376 -89
  16. package/dist/builtin/workflows/builtin/adversarial-verification.d.ts +30 -6
  17. package/dist/builtin/workflows/builtin/adversarial-verification.ts +14 -9
  18. package/dist/builtin/workflows/builtin/generate-and-filter-prompts.ts +26 -3
  19. package/dist/builtin/workflows/builtin/generate-and-filter-runner.ts +18 -14
  20. package/dist/builtin/workflows/builtin/goal-artifacts.ts +9 -8
  21. package/dist/builtin/workflows/builtin/goal-convergence.ts +87 -0
  22. package/dist/builtin/workflows/builtin/goal-ledger.ts +4 -0
  23. package/dist/builtin/workflows/builtin/goal-prompts.ts +2 -0
  24. package/dist/builtin/workflows/builtin/goal-reducer.ts +6 -1
  25. package/dist/builtin/workflows/builtin/goal-reverify.ts +305 -0
  26. package/dist/builtin/workflows/builtin/goal-runner.ts +75 -10
  27. package/dist/builtin/workflows/builtin/goal-schemas.ts +7 -0
  28. package/dist/builtin/workflows/builtin/goal-types.ts +6 -0
  29. package/dist/builtin/workflows/builtin/loop-until-done-runner.ts +94 -6
  30. package/dist/builtin/workflows/builtin/loop-until-done.d.ts +8 -0
  31. package/dist/builtin/workflows/builtin/loop-until-done.ts +15 -0
  32. package/dist/builtin/workflows/builtin/progress-scoring.ts +230 -0
  33. package/dist/builtin/workflows/builtin/ralph-core.ts +11 -0
  34. package/dist/builtin/workflows/builtin/ralph-review-gate.ts +1 -0
  35. package/dist/builtin/workflows/builtin/ralph-reviewer-prompt.ts +2 -0
  36. package/dist/builtin/workflows/builtin/ralph-runner.ts +60 -10
  37. package/dist/builtin/workflows/builtin/selection-math.ts +156 -0
  38. package/dist/builtin/workflows/builtin/shared-prompts.ts +5 -0
  39. package/dist/builtin/workflows/builtin/tournament-prompts.ts +57 -75
  40. package/dist/builtin/workflows/builtin/tournament-runner.ts +384 -178
  41. package/dist/builtin/workflows/builtin/tournament.d.ts +46 -17
  42. package/dist/builtin/workflows/builtin/tournament.ts +66 -32
  43. package/dist/builtin/workflows/builtin/verification-criteria.ts +330 -0
  44. package/dist/builtin/workflows/builtin/verification-prompts.ts +206 -0
  45. package/dist/builtin/workflows/builtin/verification-usage.ts +44 -0
  46. package/dist/builtin/workflows/package.json +1 -1
  47. package/dist/builtin/workflows/skills/create-spec/SKILL.md +90 -30
  48. package/dist/builtin/workflows/skills/show-me/LICENSE.txt +21 -0
  49. package/dist/builtin/workflows/skills/show-me/SKILL.md +143 -0
  50. package/dist/builtin/workflows/src/authoring/workflow.ts +8 -0
  51. package/dist/builtin/workflows/src/authoring.d.ts +1 -1
  52. package/dist/builtin/workflows/src/durable/completed-catalog.ts +5 -2
  53. package/dist/builtin/workflows/src/durable/dbos-envelope.ts +1 -1
  54. package/dist/builtin/workflows/src/durable/resume-eligibility.ts +5 -3
  55. package/dist/builtin/workflows/src/durable/run-timing.ts +41 -10
  56. package/dist/builtin/workflows/src/durable/tool-primitive.ts +24 -2
  57. package/dist/builtin/workflows/src/engine/options.ts +1 -0
  58. package/dist/builtin/workflows/src/engine/primitives/workflow.ts +12 -3
  59. package/dist/builtin/workflows/src/engine/run-budget.ts +308 -0
  60. package/dist/builtin/workflows/src/engine/run-returned-status.ts +8 -0
  61. package/dist/builtin/workflows/src/engine/run-tool-node-lifecycle.ts +6 -0
  62. package/dist/builtin/workflows/src/engine/run.ts +124 -2
  63. package/dist/builtin/workflows/src/engine/runtime.ts +9 -0
  64. package/dist/builtin/workflows/src/extension/config-file-loader.ts +6 -0
  65. package/dist/builtin/workflows/src/extension/config-loader.ts +24 -1
  66. package/dist/builtin/workflows/src/extension/dispatcher.ts +6 -5
  67. package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +2 -0
  68. package/dist/builtin/workflows/src/extension/index.bundle.mjs +2975 -843
  69. package/dist/builtin/workflows/src/extension/lifecycle-notifications.ts +51 -4
  70. package/dist/builtin/workflows/src/extension/public-types.ts +3 -1
  71. package/dist/builtin/workflows/src/extension/runtime-durable-resume.ts +7 -1
  72. package/dist/builtin/workflows/src/extension/runtime.ts +22 -10
  73. package/dist/builtin/workflows/src/extension/workflow-module-loader.ts +5 -0
  74. package/dist/builtin/workflows/src/extension/workflow-prompts.ts +1 -0
  75. package/dist/builtin/workflows/src/extension/workflow-schema.ts +16 -0
  76. package/dist/builtin/workflows/src/extension/workflow-status-summary.ts +44 -1
  77. package/dist/builtin/workflows/src/extension/workflow-tool-content.ts +10 -1
  78. package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +21 -9
  79. package/dist/builtin/workflows/src/runs/foreground/executor-continuation.ts +14 -0
  80. package/dist/builtin/workflows/src/runs/foreground/executor-lifecycle.ts +15 -4
  81. package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +62 -5
  82. package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +4 -0
  83. package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +2 -0
  84. package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +3 -1
  85. package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +10 -1
  86. package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +1 -0
  87. package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +1 -0
  88. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +7 -0
  89. package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +7 -0
  90. package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +1 -0
  91. package/dist/builtin/workflows/src/shared/budget-meter.ts +34 -0
  92. package/dist/builtin/workflows/src/shared/budget.d.ts +67 -0
  93. package/dist/builtin/workflows/src/shared/budget.ts +127 -0
  94. package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +92 -8
  95. package/dist/builtin/workflows/src/shared/persistence-restore.ts +11 -1
  96. package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +15 -3
  97. package/dist/builtin/workflows/src/shared/returned-run-status.ts +35 -2
  98. package/dist/builtin/workflows/src/shared/store-public-types.ts +4 -1
  99. package/dist/builtin/workflows/src/shared/store-run-methods.ts +8 -1
  100. package/dist/builtin/workflows/src/shared/store-stage-methods.ts +1 -0
  101. package/dist/builtin/workflows/src/shared/store-types.ts +24 -0
  102. package/dist/builtin/workflows/src/shared/types.ts +3 -0
  103. package/dist/builtin/workflows/src/shared/workflow-artifacts.ts +1 -0
  104. package/dist/builtin/workflows/src/shared/workflow-authoring-types.d.ts +3 -0
  105. package/dist/builtin/workflows/src/shared/workflow-authoring-types.ts +3 -0
  106. package/dist/core/atomic-guide-command.d.ts.map +1 -1
  107. package/dist/core/atomic-guide-command.js +1 -0
  108. package/dist/core/atomic-guide-command.js.map +1 -1
  109. package/dist/core/extensions/ui-types.d.ts +13 -3
  110. package/dist/core/extensions/ui-types.d.ts.map +1 -1
  111. package/dist/core/extensions/ui-types.js +15 -3
  112. package/dist/core/extensions/ui-types.js.map +1 -1
  113. package/dist/core/slash-commands.d.ts.map +1 -1
  114. package/dist/core/slash-commands.js +33 -3
  115. package/dist/core/slash-commands.js.map +1 -1
  116. package/dist/main-deferred-startup.d.ts.map +1 -1
  117. package/dist/main-deferred-startup.js +6 -2
  118. package/dist/main-deferred-startup.js.map +1 -1
  119. package/dist/modes/interactive/interactive-startup.js +4 -0
  120. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  121. package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
  122. package/dist/modes/interactive/interactive-tui.js +19 -1
  123. package/dist/modes/interactive/interactive-tui.js.map +1 -1
  124. package/dist/modes/interactive-engine/isolated-runtime.d.ts +7 -0
  125. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  126. package/dist/modes/interactive-engine/isolated-runtime.js +94 -37
  127. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  128. package/dist/modes/rpc/rpc-client.d.ts +1 -0
  129. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  130. package/dist/modes/rpc/rpc-client.js +15 -2
  131. package/dist/modes/rpc/rpc-client.js.map +1 -1
  132. package/dist/modes/rpc/rpc-input-scheduler.d.ts +3 -2
  133. package/dist/modes/rpc/rpc-input-scheduler.d.ts.map +1 -1
  134. package/dist/modes/rpc/rpc-input-scheduler.js +5 -2
  135. package/dist/modes/rpc/rpc-input-scheduler.js.map +1 -1
  136. package/docs/extensions.md +1 -1
  137. package/docs/quickstart.md +1 -0
  138. package/docs/skills.md +4 -0
  139. package/docs/workflows.md +74 -10
  140. package/npm-shrinkwrap.json +29 -29
  141. package/package.json +2 -2
@@ -161,6 +161,8 @@ InteractiveModeBase.prototype.init = async function () {
161
161
  // Start UI before extension/session work; fd/rg readiness and git watching move after first paint.
162
162
  this.ui.start();
163
163
  await waitForInteractiveEngineBound(this.runtimeHost);
164
+ if (this.isShuttingDown)
165
+ return;
164
166
  recordTimeSinceReset("time-to-first-frame");
165
167
  this.footerDataProvider.onBranchChange(() => {
166
168
  this.ui.requestRender();
@@ -219,6 +221,8 @@ InteractiveModeBase.prototype.updateTerminalTitle = function () {
219
221
  };
220
222
  InteractiveModeBase.prototype.run = async function () {
221
223
  await this.init();
224
+ if (this.isShuttingDown)
225
+ return;
222
226
  if (shouldRefreshCatalogsOnStartup())
223
227
  void refreshCatalogsAfterTuiStartup(this);
224
228
  setTimeout(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-startup.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EACN,wCAAwC,EACxC,6BAA6B,GAC7B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,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,6BAA6B,EAC7B,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,yBAAyB,EACzB,QAAQ,EAER,uBAAuB,EACvB,aAAa,EACb,EAAE,EACF,cAAc,EACd,IAAI,EACJ,oBAAoB,EACpB,MAAM,EACN,wBAAwB,EACxB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,OAAO,EACP,YAAY,GACZ,MAAM,4BAA4B,CAA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,CAAC;QACvF,CAAC,CAAC,EAAE,CAAC;IACN,OAAO,sBAAsB,CAC5B,SAAS,EACT,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CACvD,CAAC;AACH,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,sBAAsB,GAAG,UAAqC,GAAG,GAAG,CAAC;IAClG,OAAO,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC,CAAC;AACpF,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,wBAAwB,GAAG;IACxD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,kBAAkB,CAAC;AACxD,CAAC,CAAC","sourcesContent":["import { ScrollView, VStack } from \"@earendil-works/pi-tui\";\nimport { isOfflineModeEnabled } from \"../../core/package-manager-env.ts\";\nimport { createChildProcessEnvironment } from \"../../utils/child-process.ts\";\nimport type { ToolStatus } from \"../../utils/tools-manager.ts\";\nimport {\n\tonInteractiveEngineRemoteCommandsChanged,\n\twaitForInteractiveEngineBound,\n} from \"../interactive-engine/extension-ui-bridge.ts\";\nimport { renderAtomicAssemblyBanner, renderStartupManifesto } from \"./components/atomic-banner.ts\";\nimport { StartupIdentityComponent } from \"./components/startup-identity.ts\";\nimport { TranscriptFollowIndicator } from \"./components/transcript-follow-indicator.ts\";\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\tformatCodexFastModeModelLabel,\n\tgetAgentDir,\n\tgetChangelogPath,\n\tgetCwdRelativePath,\n\tgetEntriesForVersion,\n\tgetEnvValue,\n\tgetMarkdownTheme,\n\tgetNewEntries,\n\tgetPiUserAgent,\n\tisInstallTelemetryEnabled,\n\tMarkdown,\n\ttype MarkdownTheme,\n\tnormalizeChangelogLinks,\n\tonThemeChange,\n\tos,\n\tparseChangelog,\n\tpath,\n\trecordTimeSinceReset,\n\tSpacer,\n\tshouldApplyCodexFastMode,\n\tspawn,\n\tText,\n\ttheme,\n\tVERSION,\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 { restoreTerminalTitleAfterPackageCheck } from \"./interactive-terminal-title.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\nInteractiveModeBase.prototype.showStartupNoticesIfNeeded = function (\n\tthis: InteractiveModeBase,\n\ttargetContainer: Container = this.chatContainer,\n): void {\n\tif (this.startupNoticesShown) {\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 Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0));\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t\ttargetContainer.addChild(new Markdown(changelogMarkdown.trim(), 1, 0, this.getMarkdownThemeWithSettings()));\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 and rg 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\treturn Promise.all([ensureTool(\"fd\", reportStatus), ensureTool(\"rg\", reportStatus)])\n\t\t.then(([fdPath]) => {\n\t\t\tthis.fdPath = fdPath;\n\t\t\tthis.setupAutocompleteProvider();\n\t\t})\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 Text(theme.fg(color, message), 1, 0));\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.init = async function (this: InteractiveModeBase): Promise<void> {\n\tif (this.isInitialized) return;\n\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\tscrollbarStyle: (text) => theme.bg(\"scrollbarThumb\", text),\n\t});\n\tconst transcriptFollowIndicator = new TranscriptFollowIndicator({\n\t\tisFollowing: () => this.transcriptScrollView?.isFollowingEnd ?? true,\n\t\tkeyLabel: () => this.getEditorKeyDisplay(\"tui.altScreen.bottom\"),\n\t});\n\tconst dock = new VStack([\n\t\t{ component: transcriptFollowIndicator, shrink: 1, minSize: 0 },\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.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\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 UI before extension/session work; fd/rg readiness and git watching move after first paint.\n\tthis.ui.start();\n\tawait waitForInteractiveEngineBound(this.runtimeHost);\n\trecordTimeSinceReset(\"time-to-first-frame\");\n\tthis.footerDataProvider.onBranchChange(() => {\n\t\tthis.ui.requestRender();\n\t});\n\tthis.isInitialized = true;\n\n\tawait this.themeController.applyFromSettings();\n\n\t// Add the quiet startup identity unless silenced.\n\tif (this.options.verbose || !this.settingsManager.getQuietStartup()) {\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.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\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\tif (sessionName) {\n\t\tthis.ui.terminal.setTitle(`${APP_TITLE} - ${sessionName} - ${cwdBasename}`);\n\t} else {\n\t\tthis.ui.terminal.setTitle(`${APP_TITLE} - ${cwdBasename}`);\n\t}\n};\n\nInteractiveModeBase.prototype.run = async function (this: InteractiveModeBase): Promise<void> {\n\tawait this.init();\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, initialMessage, initialImages, initialMessages } = this.options;\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\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.map((e) => normalizeChangelogLinks(e.content, e)).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(`https://pi.dev/api/report-install?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\tconst home = os.homedir();\n\tlet result = p;\n\n\t// Replace home directory with ~\n\tif (result.startsWith(home)) {\n\t\tresult = `~${result.slice(home.length)}`;\n\t}\n\n\treturn result;\n};\n\nInteractiveModeBase.prototype.formatExtensionDisplayPath = function (this: InteractiveModeBase, path: string): string {\n\tlet result = this.formatDisplayPath(path);\n\tresult = result.replace(/\\/index\\.ts$/, \"\").replace(/\\/index\\.js$/, \"\");\n\treturn result;\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\tlet modelLabel = model?.id ?? \"no-model\";\n\n\tif (model?.reasoning) {\n\t\tmodelLabel = `${modelLabel} ${this.session.thinkingLevel || \"off\"}`;\n\t}\n\n\tif (!model) {\n\t\treturn modelLabel;\n\t}\n\n\tconst fastModeEnabled = shouldApplyCodexFastMode(\n\t\tmodel,\n\t\tthis.session.settingsManager.getCodexFastModeSettings(),\n\t\tthis.session.orchestrationContext,\n\t);\n\treturn formatCodexFastModeModelLabel(modelLabel, fastModeEnabled);\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 title = `${theme.bold(fg(\"text\", appLabel))} ${fg(\"muted\", `v${this.version}`)}`;\n\tconst model = this.session.state.model;\n\tconst provider = model ? fg(\"dim\", `(${model.provider})`) : fg(\"dim\", \"(no-provider)\");\n\tconst modelLine = `${provider} ${fg(\"muted\", this.getStartupModelLabel())}`;\n\tconst markLines = 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"]}
1
+ {"version":3,"file":"interactive-startup.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EACN,wCAAwC,EACxC,6BAA6B,GAC7B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EACN,QAAQ,EACR,SA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AAE,CAAC;IAC5E,MAAM,SAAS,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;IACnD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,QAAQ,GAAG,SAAS,CAAC,CAAC;IAC/E,MAAM,SAAS,GAAG,QAAQ;QACzB,CAAC,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACvF,CAAC,CAAC,EAAE,CAAC;IACN,OAAO,sBAAsB,CAC5B,SAAS,EACT,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CACvD,CAAC;AACH,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,sBAAsB,GAAG,UAAqC,GAAG,GAAG,CAAC;IAClG,OAAO,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC,CAAC;AACpF,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,wBAAwB,GAAG;IACxD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,kBAAkB,CAAC;AACxD,CAAC,CAAC","sourcesContent":["import { ScrollView, VStack } from \"@earendil-works/pi-tui\";\nimport { isOfflineModeEnabled } from \"../../core/package-manager-env.ts\";\nimport { createChildProcessEnvironment } from \"../../utils/child-process.ts\";\nimport type { ToolStatus } from \"../../utils/tools-manager.ts\";\nimport {\n\tonInteractiveEngineRemoteCommandsChanged,\n\twaitForInteractiveEngineBound,\n} from \"../interactive-engine/extension-ui-bridge.ts\";\nimport { renderAtomicAssemblyBanner, renderStartupManifesto } from \"./components/atomic-banner.ts\";\nimport { StartupIdentityComponent } from \"./components/startup-identity.ts\";\nimport { TranscriptFollowIndicator } from \"./components/transcript-follow-indicator.ts\";\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\tformatCodexFastModeModelLabel,\n\tgetAgentDir,\n\tgetChangelogPath,\n\tgetCwdRelativePath,\n\tgetEntriesForVersion,\n\tgetEnvValue,\n\tgetMarkdownTheme,\n\tgetNewEntries,\n\tgetPiUserAgent,\n\tisInstallTelemetryEnabled,\n\tMarkdown,\n\ttype MarkdownTheme,\n\tnormalizeChangelogLinks,\n\tonThemeChange,\n\tos,\n\tparseChangelog,\n\tpath,\n\trecordTimeSinceReset,\n\tSpacer,\n\tshouldApplyCodexFastMode,\n\tspawn,\n\tText,\n\ttheme,\n\tVERSION,\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 { restoreTerminalTitleAfterPackageCheck } from \"./interactive-terminal-title.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\nInteractiveModeBase.prototype.showStartupNoticesIfNeeded = function (\n\tthis: InteractiveModeBase,\n\ttargetContainer: Container = this.chatContainer,\n): void {\n\tif (this.startupNoticesShown) {\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 Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0));\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t\ttargetContainer.addChild(new Markdown(changelogMarkdown.trim(), 1, 0, this.getMarkdownThemeWithSettings()));\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 and rg 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\treturn Promise.all([ensureTool(\"fd\", reportStatus), ensureTool(\"rg\", reportStatus)])\n\t\t.then(([fdPath]) => {\n\t\t\tthis.fdPath = fdPath;\n\t\t\tthis.setupAutocompleteProvider();\n\t\t})\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 Text(theme.fg(color, message), 1, 0));\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.init = async function (this: InteractiveModeBase): Promise<void> {\n\tif (this.isInitialized) return;\n\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\tscrollbarStyle: (text) => theme.bg(\"scrollbarThumb\", text),\n\t});\n\tconst transcriptFollowIndicator = new TranscriptFollowIndicator({\n\t\tisFollowing: () => this.transcriptScrollView?.isFollowingEnd ?? true,\n\t\tkeyLabel: () => this.getEditorKeyDisplay(\"tui.altScreen.bottom\"),\n\t});\n\tconst dock = new VStack([\n\t\t{ component: transcriptFollowIndicator, shrink: 1, minSize: 0 },\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.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\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 UI before extension/session work; fd/rg readiness and git watching move after first paint.\n\tthis.ui.start();\n\tawait waitForInteractiveEngineBound(this.runtimeHost);\n\tif (this.isShuttingDown) return;\n\trecordTimeSinceReset(\"time-to-first-frame\");\n\tthis.footerDataProvider.onBranchChange(() => {\n\t\tthis.ui.requestRender();\n\t});\n\tthis.isInitialized = true;\n\n\tawait this.themeController.applyFromSettings();\n\n\t// Add the quiet startup identity unless silenced.\n\tif (this.options.verbose || !this.settingsManager.getQuietStartup()) {\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.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\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\tif (sessionName) {\n\t\tthis.ui.terminal.setTitle(`${APP_TITLE} - ${sessionName} - ${cwdBasename}`);\n\t} else {\n\t\tthis.ui.terminal.setTitle(`${APP_TITLE} - ${cwdBasename}`);\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, initialMessage, initialImages, initialMessages } = this.options;\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\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.map((e) => normalizeChangelogLinks(e.content, e)).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(`https://pi.dev/api/report-install?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\tconst home = os.homedir();\n\tlet result = p;\n\n\t// Replace home directory with ~\n\tif (result.startsWith(home)) {\n\t\tresult = `~${result.slice(home.length)}`;\n\t}\n\n\treturn result;\n};\n\nInteractiveModeBase.prototype.formatExtensionDisplayPath = function (this: InteractiveModeBase, path: string): string {\n\tlet result = this.formatDisplayPath(path);\n\tresult = result.replace(/\\/index\\.ts$/, \"\").replace(/\\/index\\.js$/, \"\");\n\treturn result;\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\tlet modelLabel = model?.id ?? \"no-model\";\n\n\tif (model?.reasoning) {\n\t\tmodelLabel = `${modelLabel} ${this.session.thinkingLevel || \"off\"}`;\n\t}\n\n\tif (!model) {\n\t\treturn modelLabel;\n\t}\n\n\tconst fastModeEnabled = shouldApplyCodexFastMode(\n\t\tmodel,\n\t\tthis.session.settingsManager.getCodexFastModeSettings(),\n\t\tthis.session.orchestrationContext,\n\t);\n\treturn formatCodexFastModeModelLabel(modelLabel, fastModeEnabled);\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 title = `${theme.bold(fg(\"text\", appLabel))} ${fg(\"muted\", `v${this.version}`)}`;\n\tconst model = this.session.state.model;\n\tconst provider = model ? fg(\"dim\", `(${model.provider})`) : fg(\"dim\", \"(no-provider)\");\n\tconst modelLine = `${provider} ${fg(\"muted\", this.getStartupModelLabel())}`;\n\tconst markLines = 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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-tui.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-tui.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,K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AAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CASnF;AAED,6EAA6E;AAC7E,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,CA4BpE"}
@@ -1,4 +1,5 @@
1
1
  import { isKeyRelease, ProcessTerminal, TuiAltScreen, TuiMainScreen, } from "@earendil-works/pi-tui";
2
+ import { stripOverlayActiveRowMarker } from "../../core/extensions/ui-types.js";
2
3
  import { copyToClipboard } from "../../utils/clipboard.js";
3
4
  import { openBrowser } from "../../utils/open-browser.js";
4
5
  import { TRANSCRIPT_JUMP_TO_END_URL } from "./components/transcript-follow-indicator.js";
@@ -185,6 +186,17 @@ class AtomicTuiAltScreen extends TuiAltScreen {
185
186
  const deferToOverlay = deferral.shouldDeferViewportInputToOverlay?.bind(this);
186
187
  deferral.shouldDeferViewportInputToOverlay = () => !viewportInputReplays.has(this) && deferToOverlay?.() === true;
187
188
  }
189
+ /**
190
+ * Last stop before pi-tui turns the composited screen into bytes, and where
191
+ * it already removes its own `CURSOR_MARKER`. Every component tree that this
192
+ * renderer paints converges here, so one strip covers the overlay, inline,
193
+ * widget, and workflows stage-chat mounts at once — including hosts that
194
+ * never call `ReservedBottomOverlay.takeActiveRow`. The mark is zero-width,
195
+ * so removing it after cursor extraction cannot move a column.
196
+ */
197
+ applyLineResets(lines) {
198
+ return stripOverlayActiveRowMarker(super.applyLineResets(lines));
199
+ }
188
200
  /**
189
201
  * Keep pi-tui's private predicate as the fallback for its single-report
190
202
  * grammar. Injected terminals can deliver coalesced reports, so parse those
@@ -394,6 +406,12 @@ export function createFullscreenTui(options) {
394
406
  copySelection: options.copySelection ?? copySelectionToHostClipboard,
395
407
  }, options.shouldHandleViewportInput, options.onOverlayUnhandledInput);
396
408
  }
409
+ /** Main-screen fallback renderer, carrying the same central mark strip as the fullscreen one. */
410
+ class AtomicTuiMainScreen extends TuiMainScreen {
411
+ applyLineResets(lines) {
412
+ return stripOverlayActiveRowMarker(super.applyLineResets(lines));
413
+ }
414
+ }
397
415
  /** Creates the fullscreen renderer for interactive TTY sessions. */
398
416
  export function createInteractiveTui(options) {
399
417
  const usesInjectedTerminal = options.terminal !== undefined;
@@ -401,7 +419,7 @@ export function createInteractiveTui(options) {
401
419
  if (!shouldUseFullscreenTui(usesInjectedTerminal)) {
402
420
  // The normal CLI never reaches the interactive mode without a TTY. Keep a
403
421
  // main-screen renderer for internal harnesses and guarded fallback paths.
404
- return new TuiMainScreen(terminal, options.showHardwareCursor, options.logDirectory);
422
+ return new AtomicTuiMainScreen(terminal, options.showHardwareCursor, options.logDirectory);
405
423
  }
406
424
  return createFullscreenTui({ ...options, terminal });
407
425
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-tui.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-tui.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,YAAY,EACZ,eAAe,EAGf,YAAY,EAEZ,aAAa,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AA0CzF,MAAM,UAAU,gBAAgB,CAAC,GAAQ,EAAE,SAAoB;IAC9D,MAAM,SAAS,GAAG,GAA8C,CAAC;IACjE,OAAO,CACN,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAC9G,CAAC;AACH,CAAC;AACD,MAAM,UAAU,iBAAiB,CAAC,GAAmB;IACpD,MAAM,OAAO,GAAG,GAAG,CAAC,mBAAmB,EAAE,CAAC;IAC1C,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,MAAM,SAAS,GAAG,G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AAC;AACJ,CAAC","sourcesContent":["import {\n\ttype Component,\n\tisKeyRelease,\n\tProcessTerminal,\n\ttype Terminal,\n\ttype TUI,\n\tTuiAltScreen,\n\ttype TuiInputListener,\n\tTuiMainScreen,\n} from \"@earendil-works/pi-tui\";\nimport { copyToClipboard } from \"../../utils/clipboard.ts\";\nimport { openBrowser } from \"../../utils/open-browser.ts\";\nimport { TRANSCRIPT_JUMP_TO_END_URL } from \"./components/transcript-follow-indicator.ts\";\n\ninterface TuiOverlayEntry {\n\tcomponent: Component;\n\tpreFocus: Component | null;\n}\n\ninterface InternalUiActionOverlay extends Component {\n\thandlesInternalUiAction?: boolean;\n}\n\ntype TuiOverlayFocusRestore =\n\t| { status: \"inactive\" }\n\t| { status: \"eligible\"; overlay: TuiOverlayEntry }\n\t| {\n\t\t\tstatus: \"blocked\";\n\t\t\toverlay: TuiOverlayEntry;\n\t\t\tblockedBy: Component;\n\t\t\tresume: { status: \"restore-overlay\" } | { status: \"focus-target\"; target: Component | null };\n\t };\n\ninterface TuiOverlayInternals {\n\toverlayStack: TuiOverlayEntry[];\n\tisOverlayVisible(entry: TuiOverlayEntry): boolean;\n\tgetTopmostVisibleOverlay(): TuiOverlayEntry | undefined;\n\tsetFocusInternal(options: { component: Component | null; overlayFocusRestore: \"preserve\" }): void;\n\tgetVisibleOverlayFocusRestore(): TuiOverlayFocusRestore;\n\tclearOverlayFocusRestore(): void;\n\trequestImmediateRender(): void;\n}\n/** pi-tui 0.84.2 keeps this canonical mouse predicate private (tui-alt-screen.d.ts:114). */\ninterface TuiAltScreenMouseInternals {\n\tisMouseSequence(data: string): boolean;\n}\n\n/** pi-tui 0.84.2 keeps its overlay-deferral predicate private (tui-alt-screen.d.ts:84). */\ninterface TuiAltScreenViewportDeferral {\n\tshouldDeferViewportInputToOverlay?(): boolean;\n}\n\nexport type InteractiveTui = TuiMainScreen | TuiAltScreen;\n\nexport function isOverlayMounted(tui: TUI, component: Component): boolean {\n\tconst internals = tui as unknown as Partial<TuiOverlayInternals>;\n\treturn (\n\t\tArray.isArray(internals.overlayStack) && internals.overlayStack.some((entry) => entry.component === component)\n\t);\n}\nexport function getFocusedOverlay(tui: InteractiveTui): Component | undefined {\n\tconst focused = tui.getFocusedComponent();\n\tif (!focused) return undefined;\n\tconst internals = tui as unknown as Partial<TuiOverlayInternals>;\n\tif (!Array.isArray(internals.overlayStack) || typeof internals.isOverlayVisible !== \"function\") return undefined;\n\tconst entry = internals.overlayStack.find((candidate) => candidate.component === focused);\n\treturn entry && internals.isOverlayVisible(entry) ? focused : undefined;\n}\n\nexport function handleFocusedOverlayInternalUiAction(tui: InteractiveTui, url: string): InternalUiActionResult {\n\tconst overlay = getFocusedOverlay(tui);\n\tif (!overlay || (overlay as InternalUiActionOverlay).handlesInternalUiAction !== true) return undefined;\n\tconst handleInput = overlay.handleInput as\n\t\t| ((data: string) => boolean | undefined | Promise<boolean | undefined>)\n\t\t| undefined;\n\treturn handleInput?.call(overlay, url);\n}\n\nexport type InternalUiActionResult = boolean | undefined | Promise<boolean | undefined>;\n\nexport interface InteractiveTuiOptions {\n\tshowHardwareCursor: boolean;\n\tlogDirectory: string;\n\tterminal?: Terminal;\n\tonRightClickPaste?: () => void;\n\tonOverlayInternalUiAction?: (url: string) => InternalUiActionResult;\n\tonInternalUiAction?: (url: string) => InternalUiActionResult;\n\t/**\n\t * Return false to let a focused overlay receive viewport input first.\n\t * Mouse input is deferred only while the focused component belongs to an\n\t * overlay; non-overlay focus keeps pi-tui's transcript selection path.\n\t */\n\tshouldHandleViewportInput?: (\n\t\tdata: string,\n\t\tisMouseInput: boolean,\n\t\tfocusedIsOverlay: boolean,\n\t\t_focusedIsViewportSearch: boolean,\n\t) => boolean;\n\t/** Handle an unconsumed overlay input before replaying it to the viewport. */\n\tonOverlayUnhandledInput?: (data: string) => boolean;\n\t/**\n\t * Copy selected text to the system clipboard; resolve false when the host\n\t * clipboard never received it. Defaults to Atomic's `copyToClipboard` with\n\t * its platform fallbacks, so pi-tui flashes \"Copy failed\" on a terminal\n\t * whose clipboard stayed untouched (upstream #8110) instead of the old\n\t * unconditional \"Copied!\". Injectable so hosts and tests observe the write.\n\t */\n\tcopySelection?: (text: string) => Promise<boolean>;\n}\n\n/** The default selection-copy route: Atomic's host clipboard write. */\nasync function copySelectionToHostClipboard(text: string): Promise<boolean> {\n\ttry {\n\t\tawait copyToClipboard(text);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport interface UrlActivationHandlers {\n\tonOverlayInternalUiAction?: (url: string) => InternalUiActionResult;\n\tonInternalUiAction?: (url: string) => InternalUiActionResult;\n\topenUrl: (url: string) => void;\n}\n\nfunction fallbackInternalUiAction(url: string, handlers: UrlActivationHandlers): void {\n\thandlers.onInternalUiAction?.(url);\n}\n\nfunction routeInternalUiAction(url: string, handlers: UrlActivationHandlers): void {\n\tlet result: InternalUiActionResult;\n\ttry {\n\t\tresult = handlers.onOverlayInternalUiAction?.(url);\n\t} catch {\n\t\tfallbackInternalUiAction(url, handlers);\n\t\treturn;\n\t}\n\tif (result instanceof Promise) {\n\t\tvoid result.then(\n\t\t\t(handled) => {\n\t\t\t\tif (handled !== true) fallbackInternalUiAction(url, handlers);\n\t\t\t},\n\t\t\t() => fallbackInternalUiAction(url, handlers),\n\t\t);\n\t\treturn;\n\t}\n\tif (result !== true) fallbackInternalUiAction(url, handlers);\n}\n\n/** Route OSC 8 activation without allowing unknown internal URLs to escape to a browser. */\nexport function handleUrlActivation(url: string, handlers: UrlActivationHandlers): void {\n\tconst internalUiScheme = \"atomic-ui:\";\n\tif (url.slice(0, internalUiScheme.length).toLowerCase() === internalUiScheme) {\n\t\tconst schemeEnd = url.indexOf(\":\");\n\t\tconst normalizedInternalUrl = `${url.slice(0, schemeEnd).toLowerCase()}${url.slice(schemeEnd)}`;\n\t\t// Forward the normalized URL: overlay-side matching is exact, so a\n\t\t// mixed-case scheme must not reach an overlay as an unrecognized string.\n\t\tif (normalizedInternalUrl === TRANSCRIPT_JUMP_TO_END_URL) routeInternalUiAction(normalizedInternalUrl, handlers);\n\t\treturn;\n\t}\n\n\thandlers.openUrl(url);\n}\n\nconst viewportInputListeners = new WeakSet<AtomicTuiAltScreen>();\n\ntype ViewportInputGate = (\n\tdata: string,\n\tisMouseInput: boolean,\n\tfocusedIsOverlay: boolean,\n\t_focusedIsViewportSearch: boolean,\n) => boolean;\n\nconst viewportInputGates = new WeakMap<AtomicTuiAltScreen, ViewportInputGate>();\nconst overlayUnhandledInputHandlers = new WeakMap<AtomicTuiAltScreen, (data: string) => boolean>();\n/** Instances currently replaying overlay-declined input into pi-tui's viewport listener. */\nconst viewportInputReplays = new WeakSet<AtomicTuiAltScreen>();\ninterface ViewportInputSubscription {\n\tviewportUnsubscribe: () => void;\n\trouteListener: TuiInputListener;\n\trouteUnsubscribe: () => void;\n}\n\nconst viewportInputSubscriptions = new WeakMap<AtomicTuiAltScreen, ViewportInputSubscription>();\n\n/** A complete SGR or X10 mouse report extracted from an input chunk. */\ninterface ParsedMouseSequence {\n\treadonly data: string;\n\treadonly button: number;\n\treadonly isRelease: boolean;\n}\n\nconst SGR_MOUSE_SEQUENCE = /^\\x1b\\[<(\\d+);\\d+;\\d+([Mm])/;\nconst LEFT_MOUSE_MODIFIER_MASK = 4 | 8 | 16;\n\nfunction parseMouseSequences(data: string): ParsedMouseSequence[] | undefined {\n\tif (data.length === 0) return undefined;\n\tconst sequences: ParsedMouseSequence[] = [];\n\tlet offset = 0;\n\twhile (offset < data.length) {\n\t\tconst remaining = data.slice(offset);\n\t\tconst sgr = SGR_MOUSE_SEQUENCE.exec(remaining);\n\t\tif (sgr) {\n\t\t\tconst sequence = sgr[0]!;\n\t\t\tsequences.push({ data: sequence, button: Number.parseInt(sgr[1]!, 10), isRelease: sgr[2] === \"m\" });\n\t\t\toffset += sequence.length;\n\t\t\tcontinue;\n\t\t}\n\t\tif (remaining.startsWith(\"\\x1b[M\") && remaining.length >= 6) {\n\t\t\tconst sequence = remaining.slice(0, 6);\n\t\t\tsequences.push({ data: sequence, button: sequence.charCodeAt(3) - 32, isRelease: false });\n\t\t\toffset += 6;\n\t\t\tcontinue;\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn sequences;\n}\n\n/** Whether every report in a mouse chunk is a vertical wheel event. */\nexport function isMouseWheelInput(data: string): boolean {\n\tconst sequences = parseMouseSequences(data);\n\treturn (\n\t\tsequences !== undefined &&\n\t\tsequences.length > 0 &&\n\t\tsequences.every(({ button }) => {\n\t\t\tconst direction = button & 3;\n\t\t\treturn (button & 64) !== 0 && (direction === 0 || direction === 1);\n\t\t})\n\t);\n}\n\nfunction isLeftMouseButton(sequence: ParsedMouseSequence): boolean {\n\tconst { button } = sequence;\n\tif ((button & 64) !== 0) return false;\n\tconst held = button & 3;\n\t// A release carries no button identity on the terminals upstream #7963\n\t// describes: they report the generic SGR code 3 rather than 0. pi-tui 0.84.2\n\t// ends a selection on `release && (button & 3) === 3`\n\t// (`dist/tui-alt-screen.js:796`), so a release Atomic drops here leaves the\n\t// press it already forwarded open — the selection never closes and the OSC 8\n\t// link under the press never activates. Shift, Meta/Option, and Ctrl are\n\t// application-bypass gestures on press and motion, but a release can retain\n\t// those bits and still has to close a selection.\n\tif (sequence.isRelease) return held === 0 || held === 3;\n\treturn held === 0 && (button & LEFT_MOUSE_MODIFIER_MASK) === 0;\n}\n\n/** Whether a mouse chunk contains a left-button selection gesture. */\nfunction isLeftMouseSequence(data: string): boolean {\n\treturn parseMouseSequences(data)?.some((sequence) => isLeftMouseButton(sequence)) ?? false;\n}\n\n/**\n * Replay a chunk one report at a time because pi-tui parses one report per\n * call. Only a chunk whose every byte is a mouse report is split; anything else\n * is replayed verbatim.\n *\n * **Probe, pi 0.84.2 (upstream `2a95ef70`, `06ed8716`):** neither the\n * lone-ESC timeout scope nor the split-`Alt+Enter` reassembly is affected by\n * this replay. Both land in `StdinBuffer`/`ProcessTerminal`\n * (`dist/stdin-buffer.js:process`, `dist/terminal.js:48`), which assemble\n * complete sequences before any listener runs; Atomic builds pi-tui's own\n * `ProcessTerminal` in `createFullscreenTui`/`createInteractiveTui` below and\n * overrides neither the buffer nor its escape timeout. A reassembled `\\x1b` or\n * `\\x1b\\r` reaches this function as one chunk, fails `parseMouseSequences`, and\n * is handed on unsplit — so a viewport action bound to `escape` or `alt+enter`\n * still matches after a decline.\n * Outcome: no breakage, no fix needed — covered by the replay probes in\n * `test/pi-0.84.2-overlay-viewport-deferral.test.ts`.\n */\nfunction replayMouseInput(viewportListener: TuiInputListener, data: string): void {\n\tconst sequences = parseMouseSequences(data);\n\tif (!sequences) {\n\t\tviewportListener(data);\n\t\treturn;\n\t}\n\tfor (const sequence of sequences) viewportListener(sequence.data);\n}\n\n/**\n * The first `addInputListener` call is load-bearing: pi-tui 0.84.2 registers\n * its viewport listener from `TuiAltScreen`'s constructor\n * (`dist/tui-alt-screen.js:85`). Keep the viewport wrapper first so mouse,\n * selection, and focus cleanup retain pi-tui's ordering. Put the focused-input\n * route last so application listeners still receive deferred viewport keys.\n */\nclass AtomicTuiAltScreen extends TuiAltScreen {\n\tconstructor(\n\t\tterminal: Terminal,\n\t\tshowHardwareCursor: boolean,\n\t\tlogDirectory: string,\n\t\toptions: ConstructorParameters<typeof TuiAltScreen>[3],\n\t\tviewportInputGate?: ViewportInputGate,\n\t\tonOverlayUnhandledInput?: (data: string) => boolean,\n\t) {\n\t\tsuper(terminal, showHardwareCursor, logDirectory, options);\n\t\tif (viewportInputGate) viewportInputGates.set(this, viewportInputGate);\n\t\tif (onOverlayUnhandledInput) overlayUnhandledInputHandlers.set(this, onOverlayUnhandledInput);\n\t\t// pi-tui 0.84.2 added `shouldDeferViewportInputToOverlay()`, which drops\n\t\t// viewport keys and wheel reports while an overlay holds focus (upstream\n\t\t// #7894). Atomic's gate offers that input to the focused overlay first and\n\t\t// replays only what the overlay declined (#2378 / PR #2381); pi-tui then\n\t\t// defers the replay a second time and the transcript freezes behind an\n\t\t// open dialog. Suppress the native answer for the replay alone. Input the\n\t\t// gate never routed through the overlay keeps pi-tui's routing and its\n\t\t// own deferral.\n\t\tconst deferral = this as unknown as TuiAltScreenViewportDeferral;\n\t\tconst deferToOverlay = deferral.shouldDeferViewportInputToOverlay?.bind(this);\n\t\tdeferral.shouldDeferViewportInputToOverlay = () => !viewportInputReplays.has(this) && deferToOverlay?.() === true;\n\t}\n\n\t/**\n\t * Keep pi-tui's private predicate as the fallback for its single-report\n\t * grammar. Injected terminals can deliver coalesced reports, so parse those\n\t * chunks locally before asking pi-tui about an unparsed value.\n\t */\n\tprivate isPiTuiMouseSequence(data: string): boolean {\n\t\tif (parseMouseSequences(data)) return true;\n\t\tconst predicate = (this as unknown as Partial<TuiAltScreenMouseInternals>).isMouseSequence;\n\t\treturn typeof predicate === \"function\" ? predicate.call(this, data) : false;\n\t}\n\n\tprivate isFocusedOverlay(): boolean {\n\t\tconst tui = this as unknown as TuiOverlayInternals;\n\t\treturn tui.overlayStack.some((entry) => entry.component === this.getFocusedComponent());\n\t}\n\n\toverride addInputListener(listener: TuiInputListener): () => void {\n\t\tif (!viewportInputListeners.has(this)) {\n\t\t\tviewportInputListeners.add(this);\n\t\t\tconst subscription: ViewportInputSubscription = {\n\t\t\t\tviewportUnsubscribe: () => {},\n\t\t\t\trouteListener: (data) => this.routeViewportInput(listener, data),\n\t\t\t\trouteUnsubscribe: () => {},\n\t\t\t};\n\t\t\tviewportInputSubscriptions.set(this, subscription);\n\t\t\tsubscription.viewportUnsubscribe = super.addInputListener((data) => {\n\t\t\t\tconst gate = viewportInputGates.get(this);\n\t\t\t\tconst isMouseInput = gate ? this.isPiTuiMouseSequence(data) : false;\n\t\t\t\tif (gate && !gate(data, isMouseInput, this.isFocusedOverlay(), false)) return undefined;\n\t\t\t\treturn listener(data);\n\t\t\t});\n\t\t\tsubscription.routeUnsubscribe = super.addInputListener(subscription.routeListener);\n\t\t\treturn () => {\n\t\t\t\tsubscription.viewportUnsubscribe();\n\t\t\t\tsubscription.routeUnsubscribe();\n\t\t\t\tviewportInputSubscriptions.delete(this);\n\t\t\t\tviewportInputListeners.delete(this);\n\t\t\t};\n\t\t}\n\n\t\tconst subscription = viewportInputSubscriptions.get(this);\n\t\tif (!subscription) return super.addInputListener(listener);\n\t\tsubscription.routeUnsubscribe();\n\t\tconst unsubscribe = super.addInputListener(listener);\n\t\tsubscription.routeUnsubscribe = super.addInputListener(subscription.routeListener);\n\t\treturn unsubscribe;\n\t}\n\n\tprivate repairOverlayFocus(): void {\n\t\tconst tui = this as unknown as TuiOverlayInternals;\n\t\tconst focused = this.getFocusedComponent();\n\t\tconst focusedOverlay = tui.overlayStack.find((entry) => entry.component === focused);\n\t\tif (focusedOverlay && !tui.isOverlayVisible(focusedOverlay)) {\n\t\t\tconst topVisible = tui.getTopmostVisibleOverlay();\n\t\t\tif (topVisible) {\n\t\t\t\tthis.setFocus(topVisible.component);\n\t\t\t} else {\n\t\t\t\ttui.setFocusInternal({ component: focusedOverlay.preFocus, overlayFocusRestore: \"preserve\" });\n\t\t\t}\n\t\t}\n\n\t\tconst focusIsOverlay = tui.overlayStack.some((entry) => entry.component === this.getFocusedComponent());\n\t\tif (focusIsOverlay) return;\n\n\t\tconst restoreState = tui.getVisibleOverlayFocusRestore();\n\t\tif (restoreState.status === \"eligible\") {\n\t\t\tthis.setFocus(restoreState.overlay.component);\n\t\t} else if (restoreState.status === \"blocked\" && restoreState.blockedBy !== this.getFocusedComponent()) {\n\t\t\tif (restoreState.resume.status === \"restore-overlay\") {\n\t\t\t\tthis.setFocus(restoreState.overlay.component);\n\t\t\t} else {\n\t\t\t\ttui.clearOverlayFocusRestore();\n\t\t\t\tthis.setFocus(restoreState.resume.target);\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Keep pi-tui's selection state in sync while an overlay handles a left gesture. */\n\tprivate forwardSelectionMouseInput(viewportListener: TuiInputListener, data: string, focused: Component): void {\n\t\tif (this.getFocusedComponent() !== focused || !isLeftMouseSequence(data)) return;\n\t\tfor (const sequence of parseMouseSequences(data) ?? []) {\n\t\t\tif (isLeftMouseButton(sequence)) viewportListener(sequence.data);\n\t\t}\n\t}\n\t/**\n\t * Replay input the focused overlay declined. pi-tui's native overlay\n\t * deferral is suppressed for the duration, because this chunk has already\n\t * been offered to the overlay it would defer to.\n\t */\n\tprivate replayViewportInput(viewportListener: TuiInputListener, data: string): void {\n\t\tviewportInputReplays.add(this);\n\t\ttry {\n\t\t\treplayMouseInput(viewportListener, data);\n\t\t} finally {\n\t\t\tviewportInputReplays.delete(this);\n\t\t}\n\t}\n\t/** Dispatch a declined chunk to the host action the gated route owns. */\n\tprivate handleOverlayUnhandledInput(data: string, focused: Component | null): boolean {\n\t\tif (this.getFocusedComponent() !== focused || !this.isFocusedOverlay()) return false;\n\t\treturn overlayUnhandledInputHandlers.get(this)?.(data) === true;\n\t}\n\n\t/**\n\t * Finish a chunk a focused overlay's asynchronous handler declined.\n\t *\n\t * Every settled result other than `true` is a decline. The component\n\t * contract is `boolean | undefined | Promise<boolean | undefined>`\n\t * (`ExtensionCustomComponent`), and both `docs/tui.md` and\n\t * `docs/extensions.md` document `false` *and* `undefined` as viewport\n\t * fallthrough, so a promise resolving `undefined` has to replay exactly like\n\t * one resolving `false` — matching only literal `false` consumed the key and\n\t * froze the transcript. A rejection is a decline for the same reason: the\n\t * overlay produced no answer.\n\t *\n\t * The focus guard stays: input that moved focus while the promise was\n\t * pending belongs to whatever holds focus now, not to the transcript.\n\t */\n\tprivate declineAsyncViewportInput(viewportListener: TuiInputListener, data: string, focused: Component): void {\n\t\tif (this.getFocusedComponent() !== focused) return;\n\t\tif (this.handleOverlayUnhandledInput(data, focused)) {\n\t\t\t(this as unknown as TuiOverlayInternals).requestImmediateRender();\n\t\t\treturn;\n\t\t}\n\t\tthis.replayViewportInput(viewportListener, data);\n\t}\n\n\tprivate routeViewportInput(viewportListener: TuiInputListener, data: string): ReturnType<TuiInputListener> {\n\t\tconst gate = viewportInputGates.get(this);\n\t\tconst isMouseInput = gate ? this.isPiTuiMouseSequence(data) : false;\n\t\tif (!gate || gate(data, isMouseInput, this.isFocusedOverlay(), false)) return undefined;\n\n\t\t// Returning `consume` below skips pi-tui's post-listener phase. Mirror its\n\t\t// overlay-focus repair before reading the focused component so a resize\n\t\t// cannot send a gated key to an invisible overlay.\n\t\tthis.repairOverlayFocus();\n\t\tconst focused = this.getFocusedComponent();\n\t\tconst tui = this as unknown as TuiOverlayInternals;\n\t\tif (focused?.handleInput && (!isKeyRelease(data) || focused.wantsKeyRelease === true)) {\n\t\t\tconst handleInput = focused.handleInput as (\n\t\t\t\tdata: string,\n\t\t\t) => boolean | undefined | Promise<boolean | undefined>;\n\t\t\tconst result = handleInput.call(focused, data);\n\t\t\tif (result instanceof Promise) {\n\t\t\t\tvoid result.then(\n\t\t\t\t\t(handled) => {\n\t\t\t\t\t\tif (handled === true) {\n\t\t\t\t\t\t\tthis.forwardSelectionMouseInput(viewportListener, data, focused);\n\t\t\t\t\t\t\ttui.requestImmediateRender();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.declineAsyncViewportInput(viewportListener, data, focused);\n\t\t\t\t\t},\n\t\t\t\t\t() => this.declineAsyncViewportInput(viewportListener, data, focused),\n\t\t\t\t);\n\t\t\t\treturn { consume: true };\n\t\t\t}\n\t\t\tif (result === true) {\n\t\t\t\tthis.forwardSelectionMouseInput(viewportListener, data, focused);\n\t\t\t\ttui.requestImmediateRender();\n\t\t\t\treturn { consume: true };\n\t\t\t}\n\t\t}\n\n\t\tif (this.handleOverlayUnhandledInput(data, focused)) {\n\t\t\ttui.requestImmediateRender();\n\t\t\treturn { consume: true };\n\t\t}\n\t\tthis.replayViewportInput(viewportListener, data);\n\t\treturn { consume: true };\n\t}\n}\n\n/**\n * CI detection follows the convention CI providers actually use: the variable\n * is SET AND NONEMPTY, with any value. GitHub Actions sets `CI=true`, but\n * other providers and users export arbitrary values (`CI=github-actions`,\n * `CI=circleci`); an allowlist of truthy spellings let those reach the\n * alternate screen and write escape sequences into CI logs (Greptile P1 on\n * PR #2308). Only explicit opt-outs (`0`, `false`, empty) read as not-CI.\n */\nfunction isCiEnvironment(value: string | undefined): boolean {\n\tif (value === undefined) return false;\n\tconst normalized = value.trim().toLowerCase();\n\treturn normalized !== \"\" && normalized !== \"0\" && normalized !== \"false\";\n}\n\nfunction shouldUseFullscreenTui(usesInjectedTerminal: boolean): boolean {\n\tif (process.env.TERM?.toLowerCase() === \"dumb\") return false;\n\tif (usesInjectedTerminal) return true;\n\treturn process.stdin.isTTY === true && process.stdout.isTTY === true && !isCiEnvironment(process.env.CI);\n}\n\n/**\n * Build Atomic's fullscreen renderer, `viewportInputGate` included, without\n * consulting the environment. `createInteractiveTui` calls this whenever\n * fullscreen applies; fixtures that assert fullscreen behavior call it\n * directly, because `shouldUseFullscreenTui` returns the main-screen fallback\n * under `TERM=dumb` even for an injected terminal and would otherwise hand\n * those tests a renderer with no layout and no gate.\n */\nexport function createFullscreenTui(options: InteractiveTuiOptions): TuiAltScreen {\n\treturn new AtomicTuiAltScreen(\n\t\toptions.terminal ?? new ProcessTerminal(),\n\t\toptions.showHardwareCursor,\n\t\toptions.logDirectory,\n\t\t{\n\t\t\topenUrl: (url) =>\n\t\t\t\thandleUrlActivation(url, {\n\t\t\t\t\tonOverlayInternalUiAction: options.onOverlayInternalUiAction,\n\t\t\t\t\tonInternalUiAction: options.onInternalUiAction,\n\t\t\t\t\topenUrl: openBrowser,\n\t\t\t\t}),\n\t\t\tonRightClickPaste: options.onRightClickPaste,\n\t\t\tcopySelection: options.copySelection ?? copySelectionToHostClipboard,\n\t\t},\n\t\toptions.shouldHandleViewportInput,\n\t\toptions.onOverlayUnhandledInput,\n\t);\n}\n\n/** Creates the fullscreen renderer for interactive TTY sessions. */\nexport function createInteractiveTui(options: InteractiveTuiOptions): InteractiveTui {\n\tconst usesInjectedTerminal = options.terminal !== undefined;\n\tconst terminal = options.terminal ?? new ProcessTerminal();\n\tif (!shouldUseFullscreenTui(usesInjectedTerminal)) {\n\t\t// The normal CLI never reaches the interactive mode without a TTY. Keep a\n\t\t// main-screen renderer for internal harnesses and guarded fallback paths.\n\t\treturn new TuiMainScreen(terminal, options.showHardwareCursor, options.logDirectory);\n\t}\n\treturn createFullscreenTui({ ...options, terminal });\n}\n\n/** Keeps existing components pointed at the renderer selected at runtime. */\nexport function createInteractiveTuiReference(getTui: () => TUI): TUI {\n\treturn new Proxy({} as TUI, {\n\t\tget: (_target, property) => {\n\t\t\tconst tui = getTui();\n\t\t\tconst value = Reflect.get(tui, property, tui);\n\t\t\tif (typeof value !== \"function\") return value;\n\t\t\tlet methodTui = tui;\n\t\t\tlet method = value;\n\t\t\treturn (...args: unknown[]) => {\n\t\t\t\tconst currentTui = getTui();\n\t\t\t\tif (currentTui !== methodTui) {\n\t\t\t\t\tconst currentMethod = Reflect.get(currentTui, property, currentTui);\n\t\t\t\t\tif (typeof currentMethod !== \"function\") {\n\t\t\t\t\t\tthrow new TypeError(`TUI property ${String(property)} is not callable`);\n\t\t\t\t\t}\n\t\t\t\t\tmethodTui = currentTui;\n\t\t\t\t\tmethod = currentMethod;\n\t\t\t\t}\n\t\t\t\treturn Reflect.apply(method, methodTui, args);\n\t\t\t};\n\t\t},\n\t\tset: (_target, property, value) => {\n\t\t\tconst tui = getTui();\n\t\t\treturn Reflect.set(tui, property, value, tui);\n\t\t},\n\t\thas: (_target, property) => Reflect.has(getTui(), property),\n\t\tgetPrototypeOf: () => Reflect.getPrototypeOf(getTui()),\n\t});\n}\n"]}
1
+ {"version":3,"file":"interactive-tui.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-tui.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,YAAY,EACZ,eAAe,EAGf,YAAY,EAEZ,aAAa,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,6BA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AG,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;oBACpE,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE,CAAC;wBACzC,MAAM,IAAI,SAAS,CAAC,gBAAgB,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;oBACzE,CAAC;oBACD,SAAS,GAAG,UAAU,CAAC;oBACvB,MAAM,GAAG,aAAa,CAAC;gBACxB,CAAC;gBACD,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;YAC/C,CAAC,CAAC;QACH,CAAC;QACD,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;YACjC,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;YACrB,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAC/C,CAAC;QACD,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC;QAC3D,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;KACtD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n\ttype Component,\n\tisKeyRelease,\n\tProcessTerminal,\n\ttype Terminal,\n\ttype TUI,\n\tTuiAltScreen,\n\ttype TuiInputListener,\n\tTuiMainScreen,\n} from \"@earendil-works/pi-tui\";\nimport { stripOverlayActiveRowMarker } from \"../../core/extensions/ui-types.ts\";\nimport { copyToClipboard } from \"../../utils/clipboard.ts\";\nimport { openBrowser } from \"../../utils/open-browser.ts\";\nimport { TRANSCRIPT_JUMP_TO_END_URL } from \"./components/transcript-follow-indicator.ts\";\n\ninterface TuiOverlayEntry {\n\tcomponent: Component;\n\tpreFocus: Component | null;\n}\n\ninterface InternalUiActionOverlay extends Component {\n\thandlesInternalUiAction?: boolean;\n}\n\ntype TuiOverlayFocusRestore =\n\t| { status: \"inactive\" }\n\t| { status: \"eligible\"; overlay: TuiOverlayEntry }\n\t| {\n\t\t\tstatus: \"blocked\";\n\t\t\toverlay: TuiOverlayEntry;\n\t\t\tblockedBy: Component;\n\t\t\tresume: { status: \"restore-overlay\" } | { status: \"focus-target\"; target: Component | null };\n\t };\n\ninterface TuiOverlayInternals {\n\toverlayStack: TuiOverlayEntry[];\n\tisOverlayVisible(entry: TuiOverlayEntry): boolean;\n\tgetTopmostVisibleOverlay(): TuiOverlayEntry | undefined;\n\tsetFocusInternal(options: { component: Component | null; overlayFocusRestore: \"preserve\" }): void;\n\tgetVisibleOverlayFocusRestore(): TuiOverlayFocusRestore;\n\tclearOverlayFocusRestore(): void;\n\trequestImmediateRender(): void;\n}\n/** pi-tui 0.84.2 keeps this canonical mouse predicate private (tui-alt-screen.d.ts:114). */\ninterface TuiAltScreenMouseInternals {\n\tisMouseSequence(data: string): boolean;\n}\n\n/** pi-tui 0.84.2 keeps its overlay-deferral predicate private (tui-alt-screen.d.ts:84). */\ninterface TuiAltScreenViewportDeferral {\n\tshouldDeferViewportInputToOverlay?(): boolean;\n}\n\nexport type InteractiveTui = TuiMainScreen | TuiAltScreen;\n\nexport function isOverlayMounted(tui: TUI, component: Component): boolean {\n\tconst internals = tui as unknown as Partial<TuiOverlayInternals>;\n\treturn (\n\t\tArray.isArray(internals.overlayStack) && internals.overlayStack.some((entry) => entry.component === component)\n\t);\n}\nexport function getFocusedOverlay(tui: InteractiveTui): Component | undefined {\n\tconst focused = tui.getFocusedComponent();\n\tif (!focused) return undefined;\n\tconst internals = tui as unknown as Partial<TuiOverlayInternals>;\n\tif (!Array.isArray(internals.overlayStack) || typeof internals.isOverlayVisible !== \"function\") return undefined;\n\tconst entry = internals.overlayStack.find((candidate) => candidate.component === focused);\n\treturn entry && internals.isOverlayVisible(entry) ? focused : undefined;\n}\n\nexport function handleFocusedOverlayInternalUiAction(tui: InteractiveTui, url: string): InternalUiActionResult {\n\tconst overlay = getFocusedOverlay(tui);\n\tif (!overlay || (overlay as InternalUiActionOverlay).handlesInternalUiAction !== true) return undefined;\n\tconst handleInput = overlay.handleInput as\n\t\t| ((data: string) => boolean | undefined | Promise<boolean | undefined>)\n\t\t| undefined;\n\treturn handleInput?.call(overlay, url);\n}\n\nexport type InternalUiActionResult = boolean | undefined | Promise<boolean | undefined>;\n\nexport interface InteractiveTuiOptions {\n\tshowHardwareCursor: boolean;\n\tlogDirectory: string;\n\tterminal?: Terminal;\n\tonRightClickPaste?: () => void;\n\tonOverlayInternalUiAction?: (url: string) => InternalUiActionResult;\n\tonInternalUiAction?: (url: string) => InternalUiActionResult;\n\t/**\n\t * Return false to let a focused overlay receive viewport input first.\n\t * Mouse input is deferred only while the focused component belongs to an\n\t * overlay; non-overlay focus keeps pi-tui's transcript selection path.\n\t */\n\tshouldHandleViewportInput?: (\n\t\tdata: string,\n\t\tisMouseInput: boolean,\n\t\tfocusedIsOverlay: boolean,\n\t\t_focusedIsViewportSearch: boolean,\n\t) => boolean;\n\t/** Handle an unconsumed overlay input before replaying it to the viewport. */\n\tonOverlayUnhandledInput?: (data: string) => boolean;\n\t/**\n\t * Copy selected text to the system clipboard; resolve false when the host\n\t * clipboard never received it. Defaults to Atomic's `copyToClipboard` with\n\t * its platform fallbacks, so pi-tui flashes \"Copy failed\" on a terminal\n\t * whose clipboard stayed untouched (upstream #8110) instead of the old\n\t * unconditional \"Copied!\". Injectable so hosts and tests observe the write.\n\t */\n\tcopySelection?: (text: string) => Promise<boolean>;\n}\n\n/** The default selection-copy route: Atomic's host clipboard write. */\nasync function copySelectionToHostClipboard(text: string): Promise<boolean> {\n\ttry {\n\t\tawait copyToClipboard(text);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport interface UrlActivationHandlers {\n\tonOverlayInternalUiAction?: (url: string) => InternalUiActionResult;\n\tonInternalUiAction?: (url: string) => InternalUiActionResult;\n\topenUrl: (url: string) => void;\n}\n\nfunction fallbackInternalUiAction(url: string, handlers: UrlActivationHandlers): void {\n\thandlers.onInternalUiAction?.(url);\n}\n\nfunction routeInternalUiAction(url: string, handlers: UrlActivationHandlers): void {\n\tlet result: InternalUiActionResult;\n\ttry {\n\t\tresult = handlers.onOverlayInternalUiAction?.(url);\n\t} catch {\n\t\tfallbackInternalUiAction(url, handlers);\n\t\treturn;\n\t}\n\tif (result instanceof Promise) {\n\t\tvoid result.then(\n\t\t\t(handled) => {\n\t\t\t\tif (handled !== true) fallbackInternalUiAction(url, handlers);\n\t\t\t},\n\t\t\t() => fallbackInternalUiAction(url, handlers),\n\t\t);\n\t\treturn;\n\t}\n\tif (result !== true) fallbackInternalUiAction(url, handlers);\n}\n\n/** Route OSC 8 activation without allowing unknown internal URLs to escape to a browser. */\nexport function handleUrlActivation(url: string, handlers: UrlActivationHandlers): void {\n\tconst internalUiScheme = \"atomic-ui:\";\n\tif (url.slice(0, internalUiScheme.length).toLowerCase() === internalUiScheme) {\n\t\tconst schemeEnd = url.indexOf(\":\");\n\t\tconst normalizedInternalUrl = `${url.slice(0, schemeEnd).toLowerCase()}${url.slice(schemeEnd)}`;\n\t\t// Forward the normalized URL: overlay-side matching is exact, so a\n\t\t// mixed-case scheme must not reach an overlay as an unrecognized string.\n\t\tif (normalizedInternalUrl === TRANSCRIPT_JUMP_TO_END_URL) routeInternalUiAction(normalizedInternalUrl, handlers);\n\t\treturn;\n\t}\n\n\thandlers.openUrl(url);\n}\n\nconst viewportInputListeners = new WeakSet<AtomicTuiAltScreen>();\n\ntype ViewportInputGate = (\n\tdata: string,\n\tisMouseInput: boolean,\n\tfocusedIsOverlay: boolean,\n\t_focusedIsViewportSearch: boolean,\n) => boolean;\n\nconst viewportInputGates = new WeakMap<AtomicTuiAltScreen, ViewportInputGate>();\nconst overlayUnhandledInputHandlers = new WeakMap<AtomicTuiAltScreen, (data: string) => boolean>();\n/** Instances currently replaying overlay-declined input into pi-tui's viewport listener. */\nconst viewportInputReplays = new WeakSet<AtomicTuiAltScreen>();\ninterface ViewportInputSubscription {\n\tviewportUnsubscribe: () => void;\n\trouteListener: TuiInputListener;\n\trouteUnsubscribe: () => void;\n}\n\nconst viewportInputSubscriptions = new WeakMap<AtomicTuiAltScreen, ViewportInputSubscription>();\n\n/** A complete SGR or X10 mouse report extracted from an input chunk. */\ninterface ParsedMouseSequence {\n\treadonly data: string;\n\treadonly button: number;\n\treadonly isRelease: boolean;\n}\n\nconst SGR_MOUSE_SEQUENCE = /^\\x1b\\[<(\\d+);\\d+;\\d+([Mm])/;\nconst LEFT_MOUSE_MODIFIER_MASK = 4 | 8 | 16;\n\nfunction parseMouseSequences(data: string): ParsedMouseSequence[] | undefined {\n\tif (data.length === 0) return undefined;\n\tconst sequences: ParsedMouseSequence[] = [];\n\tlet offset = 0;\n\twhile (offset < data.length) {\n\t\tconst remaining = data.slice(offset);\n\t\tconst sgr = SGR_MOUSE_SEQUENCE.exec(remaining);\n\t\tif (sgr) {\n\t\t\tconst sequence = sgr[0]!;\n\t\t\tsequences.push({ data: sequence, button: Number.parseInt(sgr[1]!, 10), isRelease: sgr[2] === \"m\" });\n\t\t\toffset += sequence.length;\n\t\t\tcontinue;\n\t\t}\n\t\tif (remaining.startsWith(\"\\x1b[M\") && remaining.length >= 6) {\n\t\t\tconst sequence = remaining.slice(0, 6);\n\t\t\tsequences.push({ data: sequence, button: sequence.charCodeAt(3) - 32, isRelease: false });\n\t\t\toffset += 6;\n\t\t\tcontinue;\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn sequences;\n}\n\n/** Whether every report in a mouse chunk is a vertical wheel event. */\nexport function isMouseWheelInput(data: string): boolean {\n\tconst sequences = parseMouseSequences(data);\n\treturn (\n\t\tsequences !== undefined &&\n\t\tsequences.length > 0 &&\n\t\tsequences.every(({ button }) => {\n\t\t\tconst direction = button & 3;\n\t\t\treturn (button & 64) !== 0 && (direction === 0 || direction === 1);\n\t\t})\n\t);\n}\n\nfunction isLeftMouseButton(sequence: ParsedMouseSequence): boolean {\n\tconst { button } = sequence;\n\tif ((button & 64) !== 0) return false;\n\tconst held = button & 3;\n\t// A release carries no button identity on the terminals upstream #7963\n\t// describes: they report the generic SGR code 3 rather than 0. pi-tui 0.84.2\n\t// ends a selection on `release && (button & 3) === 3`\n\t// (`dist/tui-alt-screen.js:796`), so a release Atomic drops here leaves the\n\t// press it already forwarded open — the selection never closes and the OSC 8\n\t// link under the press never activates. Shift, Meta/Option, and Ctrl are\n\t// application-bypass gestures on press and motion, but a release can retain\n\t// those bits and still has to close a selection.\n\tif (sequence.isRelease) return held === 0 || held === 3;\n\treturn held === 0 && (button & LEFT_MOUSE_MODIFIER_MASK) === 0;\n}\n\n/** Whether a mouse chunk contains a left-button selection gesture. */\nfunction isLeftMouseSequence(data: string): boolean {\n\treturn parseMouseSequences(data)?.some((sequence) => isLeftMouseButton(sequence)) ?? false;\n}\n\n/**\n * Replay a chunk one report at a time because pi-tui parses one report per\n * call. Only a chunk whose every byte is a mouse report is split; anything else\n * is replayed verbatim.\n *\n * **Probe, pi 0.84.2 (upstream `2a95ef70`, `06ed8716`):** neither the\n * lone-ESC timeout scope nor the split-`Alt+Enter` reassembly is affected by\n * this replay. Both land in `StdinBuffer`/`ProcessTerminal`\n * (`dist/stdin-buffer.js:process`, `dist/terminal.js:48`), which assemble\n * complete sequences before any listener runs; Atomic builds pi-tui's own\n * `ProcessTerminal` in `createFullscreenTui`/`createInteractiveTui` below and\n * overrides neither the buffer nor its escape timeout. A reassembled `\\x1b` or\n * `\\x1b\\r` reaches this function as one chunk, fails `parseMouseSequences`, and\n * is handed on unsplit — so a viewport action bound to `escape` or `alt+enter`\n * still matches after a decline.\n * Outcome: no breakage, no fix needed — covered by the replay probes in\n * `test/pi-0.84.2-overlay-viewport-deferral.test.ts`.\n */\nfunction replayMouseInput(viewportListener: TuiInputListener, data: string): void {\n\tconst sequences = parseMouseSequences(data);\n\tif (!sequences) {\n\t\tviewportListener(data);\n\t\treturn;\n\t}\n\tfor (const sequence of sequences) viewportListener(sequence.data);\n}\n\n/**\n * The first `addInputListener` call is load-bearing: pi-tui 0.84.2 registers\n * its viewport listener from `TuiAltScreen`'s constructor\n * (`dist/tui-alt-screen.js:85`). Keep the viewport wrapper first so mouse,\n * selection, and focus cleanup retain pi-tui's ordering. Put the focused-input\n * route last so application listeners still receive deferred viewport keys.\n */\nclass AtomicTuiAltScreen extends TuiAltScreen {\n\tconstructor(\n\t\tterminal: Terminal,\n\t\tshowHardwareCursor: boolean,\n\t\tlogDirectory: string,\n\t\toptions: ConstructorParameters<typeof TuiAltScreen>[3],\n\t\tviewportInputGate?: ViewportInputGate,\n\t\tonOverlayUnhandledInput?: (data: string) => boolean,\n\t) {\n\t\tsuper(terminal, showHardwareCursor, logDirectory, options);\n\t\tif (viewportInputGate) viewportInputGates.set(this, viewportInputGate);\n\t\tif (onOverlayUnhandledInput) overlayUnhandledInputHandlers.set(this, onOverlayUnhandledInput);\n\t\t// pi-tui 0.84.2 added `shouldDeferViewportInputToOverlay()`, which drops\n\t\t// viewport keys and wheel reports while an overlay holds focus (upstream\n\t\t// #7894). Atomic's gate offers that input to the focused overlay first and\n\t\t// replays only what the overlay declined (#2378 / PR #2381); pi-tui then\n\t\t// defers the replay a second time and the transcript freezes behind an\n\t\t// open dialog. Suppress the native answer for the replay alone. Input the\n\t\t// gate never routed through the overlay keeps pi-tui's routing and its\n\t\t// own deferral.\n\t\tconst deferral = this as unknown as TuiAltScreenViewportDeferral;\n\t\tconst deferToOverlay = deferral.shouldDeferViewportInputToOverlay?.bind(this);\n\t\tdeferral.shouldDeferViewportInputToOverlay = () => !viewportInputReplays.has(this) && deferToOverlay?.() === true;\n\t}\n\n\t/**\n\t * Last stop before pi-tui turns the composited screen into bytes, and where\n\t * it already removes its own `CURSOR_MARKER`. Every component tree that this\n\t * renderer paints converges here, so one strip covers the overlay, inline,\n\t * widget, and workflows stage-chat mounts at once — including hosts that\n\t * never call `ReservedBottomOverlay.takeActiveRow`. The mark is zero-width,\n\t * so removing it after cursor extraction cannot move a column.\n\t */\n\tprotected override applyLineResets(lines: string[]): string[] {\n\t\treturn stripOverlayActiveRowMarker(super.applyLineResets(lines));\n\t}\n\n\t/**\n\t * Keep pi-tui's private predicate as the fallback for its single-report\n\t * grammar. Injected terminals can deliver coalesced reports, so parse those\n\t * chunks locally before asking pi-tui about an unparsed value.\n\t */\n\tprivate isPiTuiMouseSequence(data: string): boolean {\n\t\tif (parseMouseSequences(data)) return true;\n\t\tconst predicate = (this as unknown as Partial<TuiAltScreenMouseInternals>).isMouseSequence;\n\t\treturn typeof predicate === \"function\" ? predicate.call(this, data) : false;\n\t}\n\n\tprivate isFocusedOverlay(): boolean {\n\t\tconst tui = this as unknown as TuiOverlayInternals;\n\t\treturn tui.overlayStack.some((entry) => entry.component === this.getFocusedComponent());\n\t}\n\n\toverride addInputListener(listener: TuiInputListener): () => void {\n\t\tif (!viewportInputListeners.has(this)) {\n\t\t\tviewportInputListeners.add(this);\n\t\t\tconst subscription: ViewportInputSubscription = {\n\t\t\t\tviewportUnsubscribe: () => {},\n\t\t\t\trouteListener: (data) => this.routeViewportInput(listener, data),\n\t\t\t\trouteUnsubscribe: () => {},\n\t\t\t};\n\t\t\tviewportInputSubscriptions.set(this, subscription);\n\t\t\tsubscription.viewportUnsubscribe = super.addInputListener((data) => {\n\t\t\t\tconst gate = viewportInputGates.get(this);\n\t\t\t\tconst isMouseInput = gate ? this.isPiTuiMouseSequence(data) : false;\n\t\t\t\tif (gate && !gate(data, isMouseInput, this.isFocusedOverlay(), false)) return undefined;\n\t\t\t\treturn listener(data);\n\t\t\t});\n\t\t\tsubscription.routeUnsubscribe = super.addInputListener(subscription.routeListener);\n\t\t\treturn () => {\n\t\t\t\tsubscription.viewportUnsubscribe();\n\t\t\t\tsubscription.routeUnsubscribe();\n\t\t\t\tviewportInputSubscriptions.delete(this);\n\t\t\t\tviewportInputListeners.delete(this);\n\t\t\t};\n\t\t}\n\n\t\tconst subscription = viewportInputSubscriptions.get(this);\n\t\tif (!subscription) return super.addInputListener(listener);\n\t\tsubscription.routeUnsubscribe();\n\t\tconst unsubscribe = super.addInputListener(listener);\n\t\tsubscription.routeUnsubscribe = super.addInputListener(subscription.routeListener);\n\t\treturn unsubscribe;\n\t}\n\n\tprivate repairOverlayFocus(): void {\n\t\tconst tui = this as unknown as TuiOverlayInternals;\n\t\tconst focused = this.getFocusedComponent();\n\t\tconst focusedOverlay = tui.overlayStack.find((entry) => entry.component === focused);\n\t\tif (focusedOverlay && !tui.isOverlayVisible(focusedOverlay)) {\n\t\t\tconst topVisible = tui.getTopmostVisibleOverlay();\n\t\t\tif (topVisible) {\n\t\t\t\tthis.setFocus(topVisible.component);\n\t\t\t} else {\n\t\t\t\ttui.setFocusInternal({ component: focusedOverlay.preFocus, overlayFocusRestore: \"preserve\" });\n\t\t\t}\n\t\t}\n\n\t\tconst focusIsOverlay = tui.overlayStack.some((entry) => entry.component === this.getFocusedComponent());\n\t\tif (focusIsOverlay) return;\n\n\t\tconst restoreState = tui.getVisibleOverlayFocusRestore();\n\t\tif (restoreState.status === \"eligible\") {\n\t\t\tthis.setFocus(restoreState.overlay.component);\n\t\t} else if (restoreState.status === \"blocked\" && restoreState.blockedBy !== this.getFocusedComponent()) {\n\t\t\tif (restoreState.resume.status === \"restore-overlay\") {\n\t\t\t\tthis.setFocus(restoreState.overlay.component);\n\t\t\t} else {\n\t\t\t\ttui.clearOverlayFocusRestore();\n\t\t\t\tthis.setFocus(restoreState.resume.target);\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Keep pi-tui's selection state in sync while an overlay handles a left gesture. */\n\tprivate forwardSelectionMouseInput(viewportListener: TuiInputListener, data: string, focused: Component): void {\n\t\tif (this.getFocusedComponent() !== focused || !isLeftMouseSequence(data)) return;\n\t\tfor (const sequence of parseMouseSequences(data) ?? []) {\n\t\t\tif (isLeftMouseButton(sequence)) viewportListener(sequence.data);\n\t\t}\n\t}\n\t/**\n\t * Replay input the focused overlay declined. pi-tui's native overlay\n\t * deferral is suppressed for the duration, because this chunk has already\n\t * been offered to the overlay it would defer to.\n\t */\n\tprivate replayViewportInput(viewportListener: TuiInputListener, data: string): void {\n\t\tviewportInputReplays.add(this);\n\t\ttry {\n\t\t\treplayMouseInput(viewportListener, data);\n\t\t} finally {\n\t\t\tviewportInputReplays.delete(this);\n\t\t}\n\t}\n\t/** Dispatch a declined chunk to the host action the gated route owns. */\n\tprivate handleOverlayUnhandledInput(data: string, focused: Component | null): boolean {\n\t\tif (this.getFocusedComponent() !== focused || !this.isFocusedOverlay()) return false;\n\t\treturn overlayUnhandledInputHandlers.get(this)?.(data) === true;\n\t}\n\n\t/**\n\t * Finish a chunk a focused overlay's asynchronous handler declined.\n\t *\n\t * Every settled result other than `true` is a decline. The component\n\t * contract is `boolean | undefined | Promise<boolean | undefined>`\n\t * (`ExtensionCustomComponent`), and both `docs/tui.md` and\n\t * `docs/extensions.md` document `false` *and* `undefined` as viewport\n\t * fallthrough, so a promise resolving `undefined` has to replay exactly like\n\t * one resolving `false` — matching only literal `false` consumed the key and\n\t * froze the transcript. A rejection is a decline for the same reason: the\n\t * overlay produced no answer.\n\t *\n\t * The focus guard stays: input that moved focus while the promise was\n\t * pending belongs to whatever holds focus now, not to the transcript.\n\t */\n\tprivate declineAsyncViewportInput(viewportListener: TuiInputListener, data: string, focused: Component): void {\n\t\tif (this.getFocusedComponent() !== focused) return;\n\t\tif (this.handleOverlayUnhandledInput(data, focused)) {\n\t\t\t(this as unknown as TuiOverlayInternals).requestImmediateRender();\n\t\t\treturn;\n\t\t}\n\t\tthis.replayViewportInput(viewportListener, data);\n\t}\n\n\tprivate routeViewportInput(viewportListener: TuiInputListener, data: string): ReturnType<TuiInputListener> {\n\t\tconst gate = viewportInputGates.get(this);\n\t\tconst isMouseInput = gate ? this.isPiTuiMouseSequence(data) : false;\n\t\tif (!gate || gate(data, isMouseInput, this.isFocusedOverlay(), false)) return undefined;\n\n\t\t// Returning `consume` below skips pi-tui's post-listener phase. Mirror its\n\t\t// overlay-focus repair before reading the focused component so a resize\n\t\t// cannot send a gated key to an invisible overlay.\n\t\tthis.repairOverlayFocus();\n\t\tconst focused = this.getFocusedComponent();\n\t\tconst tui = this as unknown as TuiOverlayInternals;\n\t\tif (focused?.handleInput && (!isKeyRelease(data) || focused.wantsKeyRelease === true)) {\n\t\t\tconst handleInput = focused.handleInput as (\n\t\t\t\tdata: string,\n\t\t\t) => boolean | undefined | Promise<boolean | undefined>;\n\t\t\tconst result = handleInput.call(focused, data);\n\t\t\tif (result instanceof Promise) {\n\t\t\t\tvoid result.then(\n\t\t\t\t\t(handled) => {\n\t\t\t\t\t\tif (handled === true) {\n\t\t\t\t\t\t\tthis.forwardSelectionMouseInput(viewportListener, data, focused);\n\t\t\t\t\t\t\ttui.requestImmediateRender();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.declineAsyncViewportInput(viewportListener, data, focused);\n\t\t\t\t\t},\n\t\t\t\t\t() => this.declineAsyncViewportInput(viewportListener, data, focused),\n\t\t\t\t);\n\t\t\t\treturn { consume: true };\n\t\t\t}\n\t\t\tif (result === true) {\n\t\t\t\tthis.forwardSelectionMouseInput(viewportListener, data, focused);\n\t\t\t\ttui.requestImmediateRender();\n\t\t\t\treturn { consume: true };\n\t\t\t}\n\t\t}\n\n\t\tif (this.handleOverlayUnhandledInput(data, focused)) {\n\t\t\ttui.requestImmediateRender();\n\t\t\treturn { consume: true };\n\t\t}\n\t\tthis.replayViewportInput(viewportListener, data);\n\t\treturn { consume: true };\n\t}\n}\n\n/**\n * CI detection follows the convention CI providers actually use: the variable\n * is SET AND NONEMPTY, with any value. GitHub Actions sets `CI=true`, but\n * other providers and users export arbitrary values (`CI=github-actions`,\n * `CI=circleci`); an allowlist of truthy spellings let those reach the\n * alternate screen and write escape sequences into CI logs (Greptile P1 on\n * PR #2308). Only explicit opt-outs (`0`, `false`, empty) read as not-CI.\n */\nfunction isCiEnvironment(value: string | undefined): boolean {\n\tif (value === undefined) return false;\n\tconst normalized = value.trim().toLowerCase();\n\treturn normalized !== \"\" && normalized !== \"0\" && normalized !== \"false\";\n}\n\nfunction shouldUseFullscreenTui(usesInjectedTerminal: boolean): boolean {\n\tif (process.env.TERM?.toLowerCase() === \"dumb\") return false;\n\tif (usesInjectedTerminal) return true;\n\treturn process.stdin.isTTY === true && process.stdout.isTTY === true && !isCiEnvironment(process.env.CI);\n}\n\n/**\n * Build Atomic's fullscreen renderer, `viewportInputGate` included, without\n * consulting the environment. `createInteractiveTui` calls this whenever\n * fullscreen applies; fixtures that assert fullscreen behavior call it\n * directly, because `shouldUseFullscreenTui` returns the main-screen fallback\n * under `TERM=dumb` even for an injected terminal and would otherwise hand\n * those tests a renderer with no layout and no gate.\n */\nexport function createFullscreenTui(options: InteractiveTuiOptions): TuiAltScreen {\n\treturn new AtomicTuiAltScreen(\n\t\toptions.terminal ?? new ProcessTerminal(),\n\t\toptions.showHardwareCursor,\n\t\toptions.logDirectory,\n\t\t{\n\t\t\topenUrl: (url) =>\n\t\t\t\thandleUrlActivation(url, {\n\t\t\t\t\tonOverlayInternalUiAction: options.onOverlayInternalUiAction,\n\t\t\t\t\tonInternalUiAction: options.onInternalUiAction,\n\t\t\t\t\topenUrl: openBrowser,\n\t\t\t\t}),\n\t\t\tonRightClickPaste: options.onRightClickPaste,\n\t\t\tcopySelection: options.copySelection ?? copySelectionToHostClipboard,\n\t\t},\n\t\toptions.shouldHandleViewportInput,\n\t\toptions.onOverlayUnhandledInput,\n\t);\n}\n\n/** Main-screen fallback renderer, carrying the same central mark strip as the fullscreen one. */\nclass AtomicTuiMainScreen extends TuiMainScreen {\n\tprotected override applyLineResets(lines: string[]): string[] {\n\t\treturn stripOverlayActiveRowMarker(super.applyLineResets(lines));\n\t}\n}\n\n/** Creates the fullscreen renderer for interactive TTY sessions. */\nexport function createInteractiveTui(options: InteractiveTuiOptions): InteractiveTui {\n\tconst usesInjectedTerminal = options.terminal !== undefined;\n\tconst terminal = options.terminal ?? new ProcessTerminal();\n\tif (!shouldUseFullscreenTui(usesInjectedTerminal)) {\n\t\t// The normal CLI never reaches the interactive mode without a TTY. Keep a\n\t\t// main-screen renderer for internal harnesses and guarded fallback paths.\n\t\treturn new AtomicTuiMainScreen(terminal, options.showHardwareCursor, options.logDirectory);\n\t}\n\treturn createFullscreenTui({ ...options, terminal });\n}\n\n/** Keeps existing components pointed at the renderer selected at runtime. */\nexport function createInteractiveTuiReference(getTui: () => TUI): TUI {\n\treturn new Proxy({} as TUI, {\n\t\tget: (_target, property) => {\n\t\t\tconst tui = getTui();\n\t\t\tconst value = Reflect.get(tui, property, tui);\n\t\t\tif (typeof value !== \"function\") return value;\n\t\t\tlet methodTui = tui;\n\t\t\tlet method = value;\n\t\t\treturn (...args: unknown[]) => {\n\t\t\t\tconst currentTui = getTui();\n\t\t\t\tif (currentTui !== methodTui) {\n\t\t\t\t\tconst currentMethod = Reflect.get(currentTui, property, currentTui);\n\t\t\t\t\tif (typeof currentMethod !== \"function\") {\n\t\t\t\t\t\tthrow new TypeError(`TUI property ${String(property)} is not callable`);\n\t\t\t\t\t}\n\t\t\t\t\tmethodTui = currentTui;\n\t\t\t\t\tmethod = currentMethod;\n\t\t\t\t}\n\t\t\t\treturn Reflect.apply(method, methodTui, args);\n\t\t\t};\n\t\t},\n\t\tset: (_target, property, value) => {\n\t\t\tconst tui = getTui();\n\t\t\treturn Reflect.set(tui, property, value, tui);\n\t\t},\n\t\thas: (_target, property) => Reflect.has(getTui(), property),\n\t\tgetPrototypeOf: () => Reflect.getPrototypeOf(getTui()),\n\t});\n}\n"]}
@@ -25,6 +25,10 @@ export declare class IsolatedInteractiveRuntime extends AgentSessionRuntime {
25
25
  private readonly activeBashRequestIds;
26
26
  private steeringMessages;
27
27
  private followUpMessages;
28
+ /** Bumped by every authoritative queue_update. */
29
+ private queueUpdateGeneration;
30
+ /** Clears started before the next queue_update share one rollback snapshot. */
31
+ private pendingQueueClear;
28
32
  private engineCallbackActive;
29
33
  private readonly queuePause;
30
34
  private autoCompactionEnabled;
@@ -33,6 +37,8 @@ export declare class IsolatedInteractiveRuntime extends AgentSessionRuntime {
33
37
  private remoteSessionFile;
34
38
  private readonly health;
35
39
  private readonly remoteCommands;
40
+ private disposed;
41
+ private disposePromise;
36
42
  private readonly remoteModelCatalog;
37
43
  private resourceOverlaps;
38
44
  constructor(localRuntime: AgentSessionRuntime, createRuntime: CreateAgentSessionRuntimeFactory, client: RpcClient);
@@ -108,6 +114,7 @@ export declare class IsolatedInteractiveRuntime extends AgentSessionRuntime {
108
114
  */
109
115
  private abortAndRecover;
110
116
  private dispatchBestEffort;
117
+ private settleQueueClear;
111
118
  private resetUnpersistedSessionView;
112
119
  private patchSessionManager;
113
120
  private refreshSessionView;
@@ -1 +1 @@
1
- {"version":3,"file":"isolated-runtime.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive-engine/isolated-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,KAAK,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AAEjH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EACX,mBAAmB,EAEnB,qBAAqB,EACrB,sBAAsB,EAEtB,eAAe,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,KAAK,wBAAwB,EAA0B,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,KAAK,yBAAyB,EAA8B,MAAM,oBAAoB,CAAC;AAChG,OAAO,KAAK,EAAE,qBAAqB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