@bastani/atomic 0.10.0 → 0.10.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/CHANGELOG.md +49 -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/skills/tmux/scripts/wait-for-text.sh +33 -3
  7. package/dist/builtin/web-access/package.json +1 -1
  8. package/dist/core/agent-session-events.d.ts.map +1 -1
  9. package/dist/core/agent-session-events.js +21 -6
  10. package/dist/core/agent-session-events.js.map +1 -1
  11. package/dist/core/lifecycle-timings.d.ts +6 -0
  12. package/dist/core/lifecycle-timings.d.ts.map +1 -1
  13. package/dist/core/lifecycle-timings.js +12 -0
  14. package/dist/core/lifecycle-timings.js.map +1 -1
  15. package/dist/core/queued-message-delivery.d.ts +41 -0
  16. package/dist/core/queued-message-delivery.d.ts.map +1 -0
  17. package/dist/core/queued-message-delivery.js +48 -0
  18. package/dist/core/queued-message-delivery.js.map +1 -0
  19. package/dist/core/storage/node-sqlite-thread.d.ts +64 -0
  20. package/dist/core/storage/node-sqlite-thread.d.ts.map +1 -0
  21. package/dist/core/storage/node-sqlite-thread.js +326 -0
  22. package/dist/core/storage/node-sqlite-thread.js.map +1 -0
  23. package/dist/core/storage/node-sqlite.d.ts.map +1 -1
  24. package/dist/core/storage/node-sqlite.js +230 -104
  25. package/dist/core/storage/node-sqlite.js.map +1 -1
  26. package/dist/core/tasks/agent-panel-source.d.ts +5 -0
  27. package/dist/core/tasks/agent-panel-source.d.ts.map +1 -1
  28. package/dist/core/tasks/agent-panel-source.js +1 -1
  29. package/dist/core/tasks/agent-panel-source.js.map +1 -1
  30. package/dist/modes/interactive/agent-view/agent-view-bridge.d.ts +8 -1
  31. package/dist/modes/interactive/agent-view/agent-view-bridge.d.ts.map +1 -1
  32. package/dist/modes/interactive/agent-view/agent-view-bridge.js.map +1 -1
  33. package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts +11 -5
  34. package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts.map +1 -1
  35. package/dist/modes/interactive/agent-view/agent-view-switcher.js +17 -5
  36. package/dist/modes/interactive/agent-view/agent-view-switcher.js.map +1 -1
  37. package/dist/modes/interactive/agent-view/contracts.d.ts +5 -0
  38. package/dist/modes/interactive/agent-view/contracts.d.ts.map +1 -1
  39. package/dist/modes/interactive/agent-view/contracts.js.map +1 -1
  40. package/dist/modes/interactive/agent-view/install.d.ts.map +1 -1
  41. package/dist/modes/interactive/agent-view/install.js +6 -3
  42. package/dist/modes/interactive/agent-view/install.js.map +1 -1
  43. package/dist/modes/interactive/agent-view/local-port.d.ts +5 -0
  44. package/dist/modes/interactive/agent-view/local-port.d.ts.map +1 -1
  45. package/dist/modes/interactive/agent-view/local-port.js +8 -0
  46. package/dist/modes/interactive/agent-view/local-port.js.map +1 -1
  47. package/dist/modes/interactive/agent-view/remote-port.d.ts +4 -1
  48. package/dist/modes/interactive/agent-view/remote-port.d.ts.map +1 -1
  49. package/dist/modes/interactive/agent-view/remote-port.js +22 -8
  50. package/dist/modes/interactive/agent-view/remote-port.js.map +1 -1
  51. package/dist/modes/interactive/agent-view/transcript-slot.d.ts +9 -0
  52. package/dist/modes/interactive/agent-view/transcript-slot.d.ts.map +1 -1
  53. package/dist/modes/interactive/agent-view/transcript-slot.js +141 -1
  54. package/dist/modes/interactive/agent-view/transcript-slot.js.map +1 -1
  55. package/dist/modes/interactive/components/agent-panel.d.ts +6 -0
  56. package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
  57. package/dist/modes/interactive/components/agent-panel.js +40 -10
  58. package/dist/modes/interactive/components/agent-panel.js.map +1 -1
  59. package/dist/modes/interactive/components/atomic-working-status.d.ts +15 -0
  60. package/dist/modes/interactive/components/atomic-working-status.d.ts.map +1 -1
  61. package/dist/modes/interactive/components/atomic-working-status.js +51 -3
  62. package/dist/modes/interactive/components/atomic-working-status.js.map +1 -1
  63. package/dist/modes/interactive/components/bash-execution.d.ts +2 -0
  64. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  65. package/dist/modes/interactive/components/bash-execution.js +5 -1
  66. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  67. package/dist/modes/interactive/components/branch-summary-message.d.ts +2 -0
  68. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  69. package/dist/modes/interactive/components/branch-summary-message.js +5 -1
  70. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  71. package/dist/modes/interactive/components/chat-message-renderer.d.ts +2 -0
  72. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  73. package/dist/modes/interactive/components/chat-message-renderer.js +17 -6
  74. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  75. package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
  76. package/dist/modes/interactive/components/chat-session-host-events.js +35 -4
  77. package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
  78. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
  79. package/dist/modes/interactive/components/chat-session-host-rendering.js +70 -13
  80. package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
  81. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +7 -0
  82. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
  83. package/dist/modes/interactive/components/chat-session-host-runtime.js +25 -4
  84. package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
  85. package/dist/modes/interactive/components/chat-session-host-state.d.ts +41 -1
  86. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
  87. package/dist/modes/interactive/components/chat-session-host-state.js +24 -3
  88. package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
  89. package/dist/modes/interactive/components/chat-session-host-steering.d.ts.map +1 -1
  90. package/dist/modes/interactive/components/chat-session-host-steering.js +2 -1
  91. package/dist/modes/interactive/components/chat-session-host-steering.js.map +1 -1
  92. package/dist/modes/interactive/components/chat-session-host.d.ts +13 -1
  93. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  94. package/dist/modes/interactive/components/chat-session-host.js +20 -2
  95. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  96. package/dist/modes/interactive/components/chat-transcript.d.ts +15 -0
  97. package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
  98. package/dist/modes/interactive/components/chat-transcript.js +14 -1
  99. package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
  100. package/dist/modes/interactive/components/compaction-boundary-message.d.ts +2 -0
  101. package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
  102. package/dist/modes/interactive/components/compaction-boundary-message.js +5 -1
  103. package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
  104. package/dist/modes/interactive/components/custom-entry.d.ts +2 -0
  105. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  106. package/dist/modes/interactive/components/custom-entry.js +5 -1
  107. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  108. package/dist/modes/interactive/components/custom-message.d.ts +2 -0
  109. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  110. package/dist/modes/interactive/components/custom-message.js +5 -1
  111. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  112. package/dist/modes/interactive/components/model-column.d.ts +96 -0
  113. package/dist/modes/interactive/components/model-column.d.ts.map +1 -0
  114. package/dist/modes/interactive/components/model-column.js +207 -0
  115. package/dist/modes/interactive/components/model-column.js.map +1 -0
  116. package/dist/modes/interactive/components/prompt-slot.d.ts +73 -0
  117. package/dist/modes/interactive/components/prompt-slot.d.ts.map +1 -0
  118. package/dist/modes/interactive/components/prompt-slot.js +201 -0
  119. package/dist/modes/interactive/components/prompt-slot.js.map +1 -0
  120. package/dist/modes/interactive/components/queued-messages-view.d.ts +6 -3
  121. package/dist/modes/interactive/components/queued-messages-view.d.ts.map +1 -1
  122. package/dist/modes/interactive/components/queued-messages-view.js +7 -4
  123. package/dist/modes/interactive/components/queued-messages-view.js.map +1 -1
  124. package/dist/modes/interactive/components/session-selector.d.ts +2 -0
  125. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  126. package/dist/modes/interactive/components/session-selector.js +4 -0
  127. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  128. package/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -0
  129. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  130. package/dist/modes/interactive/components/skill-invocation-message.js +5 -1
  131. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  132. package/dist/modes/interactive/components/task-board.d.ts +12 -3
  133. package/dist/modes/interactive/components/task-board.d.ts.map +1 -1
  134. package/dist/modes/interactive/components/task-board.js +33 -17
  135. package/dist/modes/interactive/components/task-board.js.map +1 -1
  136. package/dist/modes/interactive/components/task-inspector.d.ts +6 -1
  137. package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
  138. package/dist/modes/interactive/components/task-inspector.js +27 -7
  139. package/dist/modes/interactive/components/task-inspector.js.map +1 -1
  140. package/dist/modes/interactive/components/task-row.d.ts +4 -0
  141. package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
  142. package/dist/modes/interactive/components/task-row.js +7 -1
  143. package/dist/modes/interactive/components/task-row.js.map +1 -1
  144. package/dist/modes/interactive/components/task-transcript-page.d.ts +5 -0
  145. package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
  146. package/dist/modes/interactive/components/task-transcript-page.js +25 -0
  147. package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
  148. package/dist/modes/interactive/components/tool-execution.d.ts +7 -0
  149. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  150. package/dist/modes/interactive/components/tool-execution.js +19 -2
  151. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  152. package/dist/modes/interactive/components/tool-group-tracker.d.ts +20 -3
  153. package/dist/modes/interactive/components/tool-group-tracker.d.ts.map +1 -1
  154. package/dist/modes/interactive/components/tool-group-tracker.js +34 -7
  155. package/dist/modes/interactive/components/tool-group-tracker.js.map +1 -1
  156. package/dist/modes/interactive/components/transcript-block-clicks.d.ts +14 -2
  157. package/dist/modes/interactive/components/transcript-block-clicks.d.ts.map +1 -1
  158. package/dist/modes/interactive/components/transcript-block-clicks.js +23 -2
  159. package/dist/modes/interactive/components/transcript-block-clicks.js.map +1 -1
  160. package/dist/modes/interactive/interactive-agent-events.js +10 -2
  161. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  162. package/dist/modes/interactive/interactive-extension-runtime.d.ts +12 -1
  163. package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -1
  164. package/dist/modes/interactive/interactive-extension-runtime.js +37 -5
  165. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  166. package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
  167. package/dist/modes/interactive/interactive-input-handling.js +70 -46
  168. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  169. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  170. package/dist/modes/interactive/interactive-mode-base.js +7 -1
  171. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  172. package/dist/modes/interactive/interactive-prompt-turn.js +17 -9
  173. package/dist/modes/interactive/interactive-prompt-turn.js.map +1 -1
  174. package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
  175. package/dist/modes/interactive/interactive-queueing.js +2 -1
  176. package/dist/modes/interactive/interactive-queueing.js.map +1 -1
  177. package/dist/modes/interactive/interactive-render-chat.d.ts +18 -1
  178. package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
  179. package/dist/modes/interactive/interactive-render-chat.js +90 -10
  180. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  181. package/dist/modes/interactive/interactive-session-routing.js +2 -0
  182. package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
  183. package/dist/modes/interactive/interactive-task-projection.js +2 -2
  184. package/dist/modes/interactive/interactive-task-projection.js.map +1 -1
  185. package/dist/modes/interactive/screen-hold.d.ts +41 -0
  186. package/dist/modes/interactive/screen-hold.d.ts.map +1 -0
  187. package/dist/modes/interactive/screen-hold.js +80 -0
  188. package/dist/modes/interactive/screen-hold.js.map +1 -0
  189. package/dist/modes/interactive/started-run-echo.d.ts +66 -0
  190. package/dist/modes/interactive/started-run-echo.d.ts.map +1 -0
  191. package/dist/modes/interactive/started-run-echo.js +75 -0
  192. package/dist/modes/interactive/started-run-echo.js.map +1 -0
  193. package/dist/modes/interactive-engine/engine-custom-ui.d.ts +1 -0
  194. package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
  195. package/dist/modes/interactive-engine/engine-custom-ui.js +25 -1
  196. package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
  197. package/dist/modes/interactive-engine/engine-quit-intent.d.ts.map +1 -1
  198. package/dist/modes/interactive-engine/engine-quit-intent.js +3 -0
  199. package/dist/modes/interactive-engine/engine-quit-intent.js.map +1 -1
  200. package/dist/modes/interactive-engine/protocol.d.ts +5 -0
  201. package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
  202. package/dist/modes/interactive-engine/protocol.js +7 -1
  203. package/dist/modes/interactive-engine/protocol.js.map +1 -1
  204. package/dist/modes/interactive-engine/remote-component.d.ts +10 -2
  205. package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
  206. package/dist/modes/interactive-engine/remote-component.js +19 -2
  207. package/dist/modes/interactive-engine/remote-component.js.map +1 -1
  208. package/dist/modes/interactive-engine/remote-renderer.d.ts +10 -0
  209. package/dist/modes/interactive-engine/remote-renderer.d.ts.map +1 -1
  210. package/dist/modes/interactive-engine/remote-renderer.js +24 -4
  211. package/dist/modes/interactive-engine/remote-renderer.js.map +1 -1
  212. package/dist/modes/interactive-engine/transcript-frame-layout.d.ts +50 -0
  213. package/dist/modes/interactive-engine/transcript-frame-layout.d.ts.map +1 -0
  214. package/dist/modes/interactive-engine/transcript-frame-layout.js +95 -0
  215. package/dist/modes/interactive-engine/transcript-frame-layout.js.map +1 -0
  216. package/dist/modes/rpc/agent-panel-bridge.d.ts.map +1 -1
  217. package/dist/modes/rpc/agent-panel-bridge.js +16 -0
  218. package/dist/modes/rpc/agent-panel-bridge.js.map +1 -1
  219. package/dist/modes/rpc/agent-view-engine-registry.d.ts.map +1 -1
  220. package/dist/modes/rpc/agent-view-engine-registry.js +36 -1
  221. package/dist/modes/rpc/agent-view-engine-registry.js.map +1 -1
  222. package/dist/modes/rpc/agent-view-rpc-panel.d.ts.map +1 -1
  223. package/dist/modes/rpc/agent-view-rpc-panel.js +5 -1
  224. package/dist/modes/rpc/agent-view-rpc-panel.js.map +1 -1
  225. package/dist/modes/rpc/task-ui-bridge.js +1 -1
  226. package/dist/modes/rpc/task-ui-bridge.js.map +1 -1
  227. package/docs/background-tasks.md +1 -1
  228. package/docs/development.md +2 -0
  229. package/docs/extensions/authoring.md +1 -1
  230. package/docs/keybindings.md +2 -2
  231. package/docs/storage.md +1 -0
  232. package/npm-shrinkwrap.json +49 -49
  233. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"chat-session-host.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAErF,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAuB,0BAA0B,EAAE,MAAM,oCAAoC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I,CAAC,6BAA6B,EAAE;YACzE,eAAe,EAAE,GAAG,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC;YAC7D,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC/C,SAAS,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC;SACjD,CAAC;IACH,CAAC;CACD","sourcesContent":["import type { Component, Focusable, TuiMouseEvent, TuiMouseEventResult } from \"@bastani/atomic-tui\";\nimport type { AgentSessionEvent, CompactionReason } from \"../../../core/agent-session.js\";\nimport { chatReceipt } from \"../../../core/chat-receipts.js\";\nimport { hostNoticeForEvent } from \"../../../core/host-notices.js\";\nimport { repairOrphanToolResults } from \"../../../core/messages.ts\";\nimport { SessionManager } from \"../../../core/session-manager.ts\";\nimport type { PublishedChatActivity } from \"../../../core/session-retry-status.js\";\nimport type { SessionStore } from \"../../../core/storage/session/types.js\";\nimport { lastAssistantAnswer } from \"../../../core/storage/session/window-answer.js\";\nimport type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport { taskClocksFor } from \"../../../core/tasks/live-elapsed.js\";\nimport { getOwnerTaskStore, type OwnerTaskStore, watchOwnerTaskStoreBinding } from \"../../../core/tasks/owner-store.js\";\nimport { type TaskChatPage, taskChatPage } from \"../../../core/tasks/task-chat-records.js\";\nimport { ownerTaskViewSource, type TaskViewSource } from \"../../../core/tasks/task-view-source.js\";\nimport { savedRowKey } from \"../../../core/tasks/transcript-origin.js\";\nimport type { AgentWorkingLine } from \"../agent-view/contracts.ts\";\nimport { chatRecordsChanged, discardChatMount } from \"../chat-reader-records.js\";\nimport { pickWhimsicalWorkingMessage } from \"../whimsical-messages.ts\";\nimport { bindNextChatGroups, isTaskDisplayLine } from \"./chat-message-renderer.ts\";\nimport {\n\tabortChatSessionBash,\n\tabortChatSessionCompaction,\n\tinterruptChatSession,\n\trestoreQueuedMessagesToEditor,\n\trestoreTakenQueuedMessages,\n\tsubmitChatSession,\n} from \"./chat-session-host-actions.ts\";\nimport {\n\tchatSessionEditorAccess,\n\tcreateChatSessionEditor,\n\thandleChatSessionInput,\n\thasChatSessionTransientModal,\n\trecordChatSessionPrompt,\n\tsetChatSessionEditorText,\n} from \"./chat-session-host-editor.ts\";\nimport {\n\tapplyChatSessionAgentEvent,\n\tcompactionStatusMessage,\n\tshowChatSessionModelSwitch,\n\tshowChatSessionRetryWait,\n} from \"./chat-session-host-events.ts\";\nimport {\n\tchatSessionWorkingLine,\n\tchatSessionWorkingMeta,\n\tdropExpandedOverrides,\n\tentryExpands,\n\tentryIsExpanded,\n\trenderChatSessionBody,\n\trenderChatSessionEditor,\n\trenderChatSessionEntry,\n\trenderChatSessionFooter,\n\trenderChatSessionPendingMessages,\n\trenderChatSessionUsage,\n\trenderChatSessionWorkingStatus,\n\trestoreChatSessionTokens,\n\tsetExpandedOverride,\n\ttranscriptCacheKey,\n\ttranscriptEntryName,\n} from \"./chat-session-host-rendering.ts\";\nimport {\n\tdisposeChatSession,\n\tisChatSessionBashRunning,\n\tisChatSessionStreaming,\n\tnotifyChatSessionStatus,\n\treassertChatSessionExternalPromptLifecycle,\n\tsettleChatSessionPromptLifecycle,\n\tstartChatSessionExternalPromptLifecycle,\n\tstartChatSessionWorkingLifecycle,\n\tstopChatSessionWorkingLifecycle,\n\tsyncChatSessionAnimationTick,\n} from \"./chat-session-host-runtime.ts\";\nimport { SavedPageCalls, type SavedPageNeighbours } from \"./chat-session-host-saved-calls.ts\";\nimport { ChatSessionHostState, countableTranscriptLength } from \"./chat-session-host-state.ts\";\nimport { type ChatSteeringTarget, createChatSessionSteering } from \"./chat-session-host-steering.ts\";\nimport type {\n\tAgentSnapshotMessage,\n\tChatSessionHostEntry,\n\tChatSessionHostOpts,\n\tChatSessionInterruptedTurnSnapshot,\n\tChatSessionSubmitMode,\n} from \"./chat-session-host-types.ts\";\nimport { firstRawUserExactText, isChatMessageEntry, syncFirstUserEntry } from \"./chat-session-host-utils.ts\";\nimport type { ChatTranscriptEntryLike } from \"./chat-transcript.js\";\nimport { type ParkedTaskRows, parkedRun } from \"./parked-rows.ts\";\nimport { type RetryWaitEvent, retryWaitFromEvent } from \"./retry-status-line.ts\";\nimport { isSingleLeftClick } from \"./single-click.ts\";\nimport { TaskChatDecoration, taskLineRow } from \"./task-chat-decoration.js\";\nimport { TaskInspector } from \"./task-inspector.js\";\nimport { renderTaskFooter } from \"./task-list.js\";\nimport { pagedNotices } from \"./task-transcript-notices.ts\";\nimport type { TaskTranscriptEnvironment } from \"./task-transcript-page.ts\";\nimport { isClickedGroup } from \"./transcript-block-clicks.ts\";\nimport { type AgentTokenMeterSnapshot, type MeteredRunMessage, runInProgress } from \"./working-run-meter.ts\";\n\nexport interface SavedPageHandle {\n\tvisible(): boolean;\n\tdiscard(): void;\n\tlastRow(): object | undefined;\n}\n\nexport type {\n\tChatSessionHostBashRequest,\n\tChatSessionHostCommands,\n\tChatSessionHostEntry,\n\tChatSessionHostOpts,\n\tChatSessionHostStyle,\n\tChatSessionInterruptedTurnSnapshot,\n\tChatSessionSubmitMode,\n\tChatSessionViewportSettings,\n} from \"./chat-session-host-types.ts\";\n\n/**\n * Retired rows a parked reader keeps, with the reader-only lines that belong to them: a line drawn after one of\n * them, including those just below the last one, stays; any other line belongs to rows read again past an edge.\n */\nfunction withTaskLines(rows: readonly object[], part: readonly object[]): object[] {\n\tif (!part.length) return [];\n\tconst kept = new Set(part.filter((row) => !isTaskDisplayLine(row)));\n\tconst keeps = (line: object, previous: object | undefined) => {\n\t\tconst anchor = taskLineRow(line);\n\t\treturn anchor ? kept.has(anchor) : previous !== undefined && kept.has(previous);\n\t};\n\tconst result: object[] = [];\n\tlet previous: object | undefined;\n\tfor (const row of part) {\n\t\tif (!isTaskDisplayLine(row)) previous = row;\n\t\telse if (!keeps(row, previous)) continue;\n\t\tresult.push(row);\n\t}\n\t// Below the last row, only a line read for one of these rows; a live line there belongs to the newest rows.\n\tfor (let i = rows.indexOf(part.at(-1)!) + 1; i < rows.length; i++) {\n\t\tconst row = rows[i]!;\n\t\tconst anchor = isTaskDisplayLine(row) ? taskLineRow(row) : undefined;\n\t\tif (!anchor || !kept.has(anchor)) break;\n\t\tresult.push(row);\n\t}\n\treturn result;\n}\n\nexport class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike = never> implements Component, Focusable {\n\tfocused = true;\n\n\tprivate readonly state: ChatSessionHostState<TExtraEntry>;\n\t/** The agent this chat steers as the main chat does, when it was given one. */\n\tprivate readonly steering: ChatSteeringTarget | undefined;\n\tprivate taskStore?: OwnerTaskStore;\n\t/** What `/tasks` and the task footer show: the session's task store, or the host's own task source. */\n\tprivate taskSource?: TaskViewSource;\n\tprivate readonly taskRowsInChat: boolean;\n\tprivate unsubscribeTasks?: () => void;\n\tprivate taskSession?: object;\n\tprivate unsubscribeTaskBinding?: () => void;\n\tprivate taskInspector?: TaskInspector;\n\t/** How the last `renderBody` laid out the body: a full-screen task view, or the transcript's rows above a picker. */\n\tprivate bodyLayout: { readonly taskView: true } | { readonly taskView: false; readonly transcriptRows: number } = {\n\t\ttaskView: false,\n\t\ttranscriptRows: Number.POSITIVE_INFINITY,\n\t};\n\tprivate historyHydrated = false;\n\t/** The tool cards shown saved pages cut at their edges. */\n\tprivate readonly savedCalls: SavedPageCalls<TExtraEntry>;\n\tprivate taskDecorations?: TaskChatDecoration;\n\t/** Saved pages shown now: a reader-only line drawn after one of their rows leaves with that page. */\n\tprivate readonly shownSavedPages = new Set<Set<ChatSessionHostEntry<TExtraEntry>>>();\n\tprivate taskPageCapture(page: TaskChatPage | undefined) {\n\t\tif (!page) return undefined;\n\t\tthis.taskDecorations ??= new TaskChatDecoration((row, lines) => {\n\t\t\tfor (const shown of this.shownSavedPages)\n\t\t\t\tif (shown.has(row as ChatSessionHostEntry<TExtraEntry>))\n\t\t\t\t\tfor (const line of lines) shown.add(line as ChatSessionHostEntry<TExtraEntry>);\n\t\t});\n\t\tconst decorations = this.taskDecorations;\n\t\tthis.state.transcriptComponent.onVisibleEntry = (entry) => decorations.observe(entry);\n\t\treturn decorations.capture(this, page, this.state.liveChat, this.state.transcript, () =>\n\t\t\tthis.state.requestRender?.(),\n\t\t);\n\t}\n\tprivate readonly taskTranscriptEnvironment: () => TaskTranscriptEnvironment;\n\n\tconstructor(opts: ChatSessionHostOpts<TExtraEntry>) {\n\t\t// `/tasks` stays a local action owned by the host's `commands.handleSlashCommand`\n\t\t// (see submitChatSession). Hosts that mount the inspector call `openTasks` from\n\t\t// that callback; the host must not intercept it ahead of the owner.\n\t\tthis.taskRowsInChat = opts.taskRowsInChat ?? true;\n\t\t// A task transcript opened from this chat is a chat of its own on the same terminal and settings.\n\t\tthis.taskTranscriptEnvironment = () => ({\n\t\t\tcreateChat: (transcriptOpts) => new ChatSessionHost(transcriptOpts),\n\t\t\ttui: opts.tui,\n\t\t\tkeybindings: opts.keybindings,\n\t\t\teditorTheme: opts.editorTheme,\n\t\t\teditorFactory: opts.editorFactory,\n\t\t\tstyle: opts.style,\n\t\t\tgetChatRenderSettings: opts.getChatRenderSettings,\n\t\t\tfooterData: opts.footerData,\n\t\t\tnotify: (message) => this.showWarning(message),\n\t\t});\n\t\tthis.state = new ChatSessionHostState(opts, {\n\t\t\trenderEntry: (state, entry) => renderChatSessionEntry(state, entry),\n\t\t\ttranscriptCacheKey: (state, entry) => transcriptCacheKey(state, entry),\n\t\t});\n\t\tthis.steering = opts.steering;\n\t\tif (opts.steering) this.state.steeringController = createChatSessionSteering(this.state, opts.steering);\n\t\tthis.savedCalls = new SavedPageCalls(this.state);\n\t\tthis.state.editor = createChatSessionEditor(\n\t\t\tthis.state,\n\t\t\topts.tui,\n\t\t\topts.keybindings,\n\t\t\topts.editorTheme,\n\t\t\topts.editorFactory,\n\t\t\tthis.editorCallbacks(),\n\t\t);\n\t\tif (opts.autocompleteProvider) this.state.editor?.setAutocompleteProvider?.(opts.autocompleteProvider);\n\t\tthis.syncAnimationTick();\n\t\tthis.refreshTaskStore();\n\t}\n\n\topenTasks(id?: string): boolean {\n\t\tconst session = this.state.getAgentSession?.();\n\t\tif (session && !getOwnerTaskStore(session)) session.getAgentTaskHost?.();\n\t\tthis.refreshTaskStore();\n\t\tif (!this.taskSource) {\n\t\t\tthis.showWarning(\"Launched agents and shells will appear here.\");\n\t\t\treturn true;\n\t\t}\n\t\tthis.state.promptSearch = undefined;\n\t\tthis.taskInspector?.dispose();\n\t\tthis.taskInspector = new TaskInspector(\n\t\t\tthis.taskSource,\n\t\t\t() => this.state.requestRender?.(),\n\t\t\t() => this.closeTasks(),\n\t\t\tundefined,\n\t\t\t() => this.taskTranscriptEnvironment(),\n\t\t);\n\t\tthis.taskInspector.open(id as TaskId | undefined);\n\t\tthis.state.requestRender?.();\n\t\treturn true;\n\t}\n\tget hasTaskInspector(): boolean {\n\t\treturn this.taskInspector !== undefined;\n\t}\n\tget hasTransientModal(): boolean {\n\t\treturn hasChatSessionTransientModal(this.state);\n\t}\n\tget taskInspectorFullscreen(): boolean {\n\t\treturn this.taskInspector?.fullscreen === true;\n\t}\n\tcloseTasks(): void {\n\t\tthis.taskInspector?.dispose();\n\t\tthis.taskInspector = undefined;\n\t\tthis.state.requestRender?.();\n\t}\n\t/** Offers input to the open task inspector; false when none is open or it declined the input. */\n\thandleTaskInput(data: string): boolean {\n\t\treturn this.taskInspector?.handleInput(data) === true;\n\t}\n\tappendMessages(messages: readonly AgentSnapshotMessage[], settledTokens?: AgentTokenMeterSnapshot): void {\n\t\tconst hadFirstUser = this.state.seenFirstRawUser;\n\t\tif (!hadFirstUser && messages.length > 0) {\n\t\t\tconst firstUser = firstRawUserExactText(messages);\n\t\t\tif (firstUser.seenUser) {\n\t\t\t\tthis.state.seenFirstRawUser = true;\n\t\t\t\tthis.state.firstUserEntryExactText = firstUser.exactText;\n\t\t\t}\n\t\t}\n\t\tthis.state.liveChat.appendMessages(messages);\n\t\tif (!hadFirstUser && this.state.seenFirstRawUser) {\n\t\t\tsyncFirstUserEntry(this.state);\n\t\t}\n\t\tif (settledTokens) restoreChatSessionTokens(this.state, settledTokens);\n\t}\n\n\t/** Earlier history, shown above every entry while a reader scrolled away from the end keeps their place. */\n\tprependMessages(messages: readonly AgentSnapshotMessage[]): void {\n\t\tthis.prependPage(messages, {});\n\t}\n\n\tprivate prependPage(\n\t\tmessages: readonly AgentSnapshotMessage[],\n\t\tneighbours: SavedPageNeighbours,\n\t): Set<ChatSessionHostEntry<TExtraEntry>> {\n\t\tconst firstUser = firstRawUserExactText(messages);\n\t\tif (firstUser.seenUser) {\n\t\t\tthis.state.seenFirstRawUser = true;\n\t\t\tthis.state.firstUserEntryExactText = firstUser.exactText;\n\t\t}\n\t\tconst previousCount = countableTranscriptLength(this.state);\n\t\tconst before = this.state.transcript.length;\n\t\tconst notices = pagedNotices.get(this);\n\t\tif (notices?.card) this.state.assistantCard = notices.card;\n\t\tbindNextChatGroups(this.state.liveChat, this.taskPageCapture(taskChatPage(this)));\n\t\tthis.state.liveChat.prependMessages(messages);\n\t\t// Entries above the earliest one shown end where it starts: their open calls may have results shown below.\n\t\tconst page = this.savedCalls.show(\n\t\t\tnew Set(this.state.transcript.slice(0, this.state.transcript.length - before)),\n\t\t\tneighbours,\n\t\t\ttrue,\n\t\t);\n\t\tif (firstUser.seenUser || this.state.firstUserEntry === undefined) {\n\t\t\tsyncFirstUserEntry(this.state);\n\t\t}\n\t\tthis.state.newMessages.historyPrepended(countableTranscriptLength(this.state) - previousCount);\n\t\tthis.state.requestRender?.();\n\t\treturn page;\n\t}\n\n\t/**\n\t * Replaces the conversation with `messages`, keeping the host's own extra entries. `before` reads the saved entries\n\t * before them, for result cards whose calls are saved there.\n\t */\n\treplaceMessages(\n\t\tmessages: readonly AgentSnapshotMessage[],\n\t\toptions: { preserveUnread?: boolean; before?: SavedPageNeighbours[\"before\"]; parked?: ParkedTaskRows } = {},\n\t): void {\n\t\tif (options.preserveUnread && this.state.bodyViewport.getScrollFromBottom() > 0) {\n\t\t\tthis.state.newMessages.observe(false, countableTranscriptLength(this.state));\n\t\t}\n\t\tconst firstUser = firstRawUserExactText(messages);\n\t\tthis.state.seenFirstRawUser = firstUser.seenUser;\n\t\tthis.state.firstUserEntryExactText = firstUser.exactText;\n\t\tconst notices = pagedNotices.get(this);\n\t\tif (notices) pagedNotices.set(this.state.transcript, notices);\n\t\tthis.savedCalls.reset();\n\t\tthis.shownSavedPages.clear();\n\t\tthis.taskDecorations?.clear();\n\t\tbindNextChatGroups(this.state.liveChat, this.taskPageCapture(taskChatPage(this)));\n\t\tconst adopted = this.state.replaceTranscriptWindow(messages, options.parked);\n\t\tif (adopted) this.taskDecorations?.adoptRows(adopted);\n\t\tif (options.before) this.savedCalls.show(this.shownWindow(), { before: options.before }, false);\n\t\tsyncFirstUserEntry(this.state);\n\t\tif (options.preserveUnread) this.state.newMessages.replaced(countableTranscriptLength(this.state));\n\t\telse this.state.newMessages.reset();\n\t\tthis.state.requestRender?.();\n\t}\n\n\thasUnplacedWidget(): boolean {\n\t\treturn this.state.hasUnplacedWidget();\n\t}\n\t/** Called once, only if an actually drawn widget lacks a saved occurrence. */\n\tonUnplacedWidget(preserve?: () => void): void {\n\t\tthis.state.onUnplacedWidget = preserve;\n\t}\n\n\t/** Keep painted occurrences when a saved context is replaced; never infer a stored position from text. */\n\tparkedRows(current: number): ParkedTaskRows | undefined {\n\t\tconst { state } = this;\n\t\tif (state.bodyViewport.getScrollFromBottom() === 0) return undefined;\n\t\tconst painted = new Set(state.bodyViewport.paintedSegments(state.transcriptComponent)),\n\t\t\trows: readonly object[] = state.transcript;\n\t\tlet first = -1,\n\t\t\tlast = -1;\n\t\tfor (let i = 0; i < rows.length; i++) {\n\t\t\tif (!painted.has(rows[i])) continue;\n\t\t\tif (first < 0) first = i;\n\t\t\tlast = i;\n\t\t}\n\t\tif (first < 0) return undefined;\n\t\tconst own = new Set<object>(state.extraEntries);\n\t\tconst run = parkedRun(rows, first, last, current, {\n\t\t\tfixed: (row) => own.has(row),\n\t\t\tmessage: (row) => !own.has(row) && \"kind\" in row && !isTaskDisplayLine(row),\n\t\t});\n\t\tif (!run) return undefined;\n\t\tconst adopted = new Map<string, object>();\n\t\tfor (const row of run.adopted) {\n\t\t\tconst key = own.has(row) ? undefined : savedRowKey(row);\n\t\t\tif (key !== undefined && !adopted.has(key)) adopted.set(key, row);\n\t\t}\n\t\tconst retired = run.retired.filter((row) => !own.has(row));\n\t\treturn { rows: withTaskLines(rows, retired), first: run.first, last: run.last, adopted };\n\t}\n\tkeptPage(rows: readonly object[]): SavedPageHandle {\n\t\treturn this.savedPageHandle(new Set(rows) as Set<ChatSessionHostEntry<TExtraEntry>>);\n\t}\n\n\tprivate shownWindow(): Set<ChatSessionHostEntry<TExtraEntry>> {\n\t\tconst { state } = this;\n\t\treturn new Set(state.transcript.filter((e) => !state.extraEntries.includes(e as TExtraEntry)));\n\t}\n\n\t/**\n\t * Own one page displayed by a saved transcript. A page is discarded only after the viewport leaves it. `neighbours`\n\t * read the saved entries around it, one at a time; `after` is present when a later page follows it.\n\t */\n\tshowSavedPage(\n\t\tmessages: readonly AgentSnapshotMessage[],\n\t\tedge: \"latest\" | \"older\" | \"newer\",\n\t\tneighbours: SavedPageNeighbours = {},\n\t\tafter?: object,\n\t): SavedPageHandle {\n\t\tconst { state } = this;\n\t\tconst before = state.transcript.length;\n\t\tconst at = after === undefined ? -1 : state.transcript.indexOf(after as ChatSessionHostEntry<TExtraEntry>) + 1;\n\t\tlet owned: Set<ChatSessionHostEntry<TExtraEntry>>;\n\t\tif (edge === \"older\") owned = this.prependPage(messages, neighbours);\n\t\telse if (edge === \"latest\") {\n\t\t\tthis.replaceMessages(messages);\n\t\t\towned = this.savedCalls.show(this.shownWindow(), neighbours, neighbours.after !== undefined);\n\t\t} else {\n\t\t\tconst count = countableTranscriptLength(state);\n\t\t\tbindNextChatGroups(state.liveChat, this.taskPageCapture(taskChatPage(this)));\n\t\t\tif (at > 0) state.liveChat.insertMessages(at, messages);\n\t\t\telse this.appendMessages(messages);\n\t\t\tconst added = state.transcript.length - before;\n\t\t\towned = this.savedCalls.show(\n\t\t\t\tnew Set(at > 0 ? state.transcript.slice(at, at + added) : state.transcript.slice(before)),\n\t\t\t\tneighbours,\n\t\t\t\tneighbours.after !== undefined,\n\t\t\t);\n\t\t\tstate.newMessages.historyPrepended(countableTranscriptLength(state) - count);\n\t\t}\n\t\treturn this.savedPageHandle(owned);\n\t}\n\tprivate savedPageHandle(owned: Set<ChatSessionHostEntry<TExtraEntry>>): SavedPageHandle {\n\t\tconst { state } = this;\n\t\t// A saved line read later for one of the page's rows joins the page.\n\t\tthis.shownSavedPages.add(owned);\n\t\treturn {\n\t\t\tlastRow: () => state.transcript.findLast((entry) => owned.has(entry)),\n\t\t\tvisible: () => state.bodyViewport.paintsSegments(state.transcriptComponent, owned),\n\t\t\tdiscard: () => {\n\t\t\t\tthis.shownSavedPages.delete(owned);\n\t\t\t\t// The page's reader-only lines and their records leave with it.\n\t\t\t\tthis.taskDecorations?.release(owned);\n\t\t\t\tstate.liveChat.dropSavedEntries(owned);\n\t\t\t\tthis.savedCalls.discard(owned);\n\t\t\t\tstate.releaseRetiredRows();\n\t\t\t\tsyncFirstUserEntry(state);\n\t\t\t\tstate.firstUserEntryExactText = state.firstUserEntry?.text;\n\t\t\t\tstate.seenFirstRawUser = state.firstUserEntry !== undefined;\n\t\t\t\tstate.newMessages.replaced(countableTranscriptLength(state));\n\t\t\t\towned.clear();\n\t\t\t},\n\t\t};\n\t}\n\n\tresetFollowedSession(options?: { readonly preserveWorkedRun?: boolean }): void {\n\t\tif (options?.preserveWorkedRun) {\n\t\t\tif (this.state.workedRun === undefined) {\n\t\t\t\tconst snapshot = chatSessionWorkingMeta(this.state);\n\t\t\t\tif (snapshot !== undefined && !this.state.manualCompactionTakeoverPending) {\n\t\t\t\t\tthis.state.workedRun = { message: this.state.lastWorkingMessage, snapshot };\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthis.state.workedRun = undefined;\n\t\t\tthis.state.interruptedTurnSnapshot = undefined;\n\t\t}\n\t\tthis.state.workingRunMeter.stop();\n\t\tthis.state.retryContinuesRun = false;\n\t\tthis.state.manualCompactionTakeoverPending = false;\n\t\tthis.state.compacting = false;\n\t\tthis.state.compactionStartedAt = undefined;\n\t\tthis.state.sdkBusy = false;\n\t\tthis.state.workingMessage = undefined;\n\t\tthis.state.lastWorkingMessage = undefined;\n\t\tthis.state.seenFirstRawUser = false;\n\t\tthis.state.firstUserEntryExactText = undefined;\n\t\tthis.state.firstUserEntry = undefined;\n\t\tthis.state.statusMessage = \"\";\n\t\tif (this.state.noticeMessage !== this.state.lastWarningMessage) this.state.noticeMessage = \"\";\n\t\tthis.state.pendingSteeringMessages = [];\n\t\tthis.state.pendingFollowUpMessages = [];\n\t\tthis.state.unconfirmedQueuedMessages = [];\n\t\tif (this.steering) {\n\t\t\t// The shown copies and the last listed queue were the previous session's.\n\t\t\tthis.state.steeringController?.dispose();\n\t\t\tthis.state.steeringController = createChatSessionSteering(this.state, this.steering);\n\t\t}\n\t\tthis.state.liveChat.clearPendingTools();\n\t\tthis.state.newMessages.reset();\n\t\tstopChatSessionWorkingLifecycle(this.state);\n\t\tsyncChatSessionAnimationTick(this.state);\n\t}\n\t/**\n\t * Adopt the assistant message a live session is part-way through streaming.\n\t *\n\t * A host mounted mid-turn missed the `message_start` and every delta that\n\t * came before it, and delta-only updates never restate them, so the session's\n\t * in-flight message is the only place that text still exists. Ignored once\n\t * this host is already following a stream of its own.\n\t */\n\thydrateStreamingAssistantMessage(message: AgentSnapshotMessage | undefined): void {\n\t\tif (message === undefined) return;\n\t\tif (this.state.liveChat.hydrateStreamingAssistantMessage(message)) this.state.requestRender?.();\n\t}\n\n\t/**\n\t * Shows a saved conversation. A call in `inFlightToolCallIds` has no result yet because its agent waits for one,\n\t * so it shows as pending, not as interrupted, and the call's own end replaces it with the result.\n\t */\n\tasync loadSession(\n\t\tstore: SessionStore,\n\t\tsessionId: string | undefined,\n\t\tinFlightToolCallIds?: ReadonlySet<string>,\n\t): Promise<boolean> {\n\t\tif (\n\t\t\tthis.historyHydrated ||\n\t\t\tthis.state.transcript.length > this.state.extraEntries.length ||\n\t\t\tsessionId === undefined\n\t\t)\n\t\t\treturn true;\n\t\tlet messages: readonly AgentSnapshotMessage[];\n\t\ttry {\n\t\t\tconst manager = await SessionManager.open(store, sessionId, undefined, { history: \"tail\" });\n\t\t\tmessages = repairOrphanToolResults(manager.buildSessionProjection(\"transcript\").messages, {\n\t\t\t\trepairTrailing: true,\n\t\t\t\t...(inFlightToolCallIds === undefined ? {} : { inFlightToolCallIds }),\n\t\t\t}) as readonly AgentSnapshotMessage[];\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.state.disposed) return false;\n\t\tif (this.historyHydrated || this.state.transcript.length > this.state.extraEntries.length) return true;\n\t\tthis.historyHydrated = true;\n\t\tconst firstUser = firstRawUserExactText(messages);\n\t\tthis.state.seenFirstRawUser = firstUser.seenUser;\n\t\tthis.state.firstUserEntryExactText = firstUser.exactText;\n\t\tconst previousCount = countableTranscriptLength(this.state);\n\t\tconst extras = this.state.transcript.splice(0);\n\t\tthis.state.liveChat.appendMessages(messages);\n\t\tthis.state.transcript.push(...extras);\n\t\tsyncFirstUserEntry(this.state);\n\t\tthis.state.newMessages.historyPrepended(countableTranscriptLength(this.state) - previousCount);\n\t\tthis.state.requestRender?.();\n\t\treturn true;\n\t}\n\n\tappendExtraEntry(entry: TExtraEntry): void {\n\t\tthis.state.extraEntries.push(entry);\n\t\tthis.state.transcript.push(entry);\n\t}\n\n\tentries(): readonly ChatSessionHostEntry<TExtraEntry>[] {\n\t\treturn this.state.transcript;\n\t}\n\n\t/** Tasks outlive tools and turns; only host/session binding grants this read projection. */\n\trefreshTaskStore(): void {\n\t\tconst session = this.state.getAgentSession?.();\n\t\tconst sessionChanged = session !== this.taskSession;\n\t\tif (sessionChanged) {\n\t\t\tthis.unsubscribeTaskBinding?.();\n\t\t\tthis.taskSession = session;\n\t\t\tthis.unsubscribeTaskBinding = session\n\t\t\t\t? watchOwnerTaskStoreBinding(session, () => this.refreshTaskStore())\n\t\t\t\t: undefined;\n\t\t}\n\t\tconst store = session ? getOwnerTaskStore(session) : undefined;\n\t\t// A session in another process has no store here; the host\n\t\t// supplies a source that reads its tasks there.\n\t\tconst source = store ? ownerTaskViewSource(store) : this.state.getTaskSource?.();\n\t\tif (store === this.taskStore && source === this.taskSource) return;\n\t\tthis.closeTasks();\n\t\tthis.unsubscribeTasks?.();\n\t\tthis.taskStore = store;\n\t\tthis.taskSource = source;\n\t\tthis.unsubscribeTasks = undefined;\n\t\tthis.state.liveChat.clearTasks();\n\t\tthis.state.transcriptComponent.invalidate();\n\t\tthis.state.requestRender?.();\n\t\tif (!source) return;\n\t\ttaskClocksFor(source);\n\t\tconst update = () => {\n\t\t\t// Without task rows the transcript shows nothing of the tasks; only the footer repaints.\n\t\t\tif (this.taskRowsInChat) {\n\t\t\t\tthis.state.liveChat.upsertTasks(source.tasks, store);\n\t\t\t\tthis.state.transcriptComponent.invalidate();\n\t\t\t}\n\t\t\tthis.state.requestRender?.();\n\t\t};\n\t\tthis.unsubscribeTasks = source.subscribe(update);\n\t\tupdate();\n\t}\n\t/** A task chat shows reader-only outcomes as rows. Other hosts keep their event/status contract. */\n\tapplyTaskAgentEvent(event: AgentSessionEvent): void {\n\t\tthis.applyAgentEvent(event);\n\t\tconst receipt = chatReceipt(event);\n\t\tif (!receipt) return;\n\t\tchatRecordsChanged(this, receipt);\n\t\tthis.taskDecorations?.live.add(receipt.id);\n\t\tconst line = hostNoticeForEvent(event, this.state.manualCompactionTakeoverPending ? \"manual\" : undefined);\n\t\tif (!line || this.state.disposed) return;\n\t\tif (event.type === \"agent_continue_error\" || event.type === \"compaction_end\") this.state.statusMessage = \"\";\n\t\tthis.state.liveChat.appendTaskLine(line);\n\t\tthis.state.requestRender?.();\n\t}\n\tapplyAgentEvent(event: AgentSessionEvent): boolean {\n\t\tthis.refreshTaskStore();\n\t\treturn applyChatSessionAgentEvent(this.state, event);\n\t}\n\n\thydrateToolExecutionStarts(starts: readonly { readonly toolCallId: string; readonly startedAt: number }[]): void {\n\t\tlet changed = false;\n\t\tfor (const start of starts)\n\t\t\tchanged = this.state.liveChat.markToolExecutionStarted(start.toolCallId, start.startedAt) || changed;\n\t\tif (changed) this.state.requestRender?.();\n\t}\n\n\t/**\n\t * Restore the factual compaction indicator on a host mounted after the\n\t * `compaction_start` it never saw. The label resolves through the same\n\t * mapping the live event path uses, so the two cannot drift.\n\t *\n\t * Branch summaries deliberately do not paint here: their label belongs to\n\t * a retry lifecycle this re-attached host is not inside, and no event exists\n\t * to clear it after the summary finishes. An absent paintable reason is a\n\t * no-op unless this host is actively showing a compaction label, so unrelated\n\t * prompt delivery busy state is preserved.\n\t */\n\thydrateCompactionStatus(reason: CompactionReason | undefined, startedAt?: number): void {\n\t\tconst compactionReason = reason === \"branchSummary\" ? undefined : reason;\n\t\tif (compactionReason === undefined) {\n\t\t\tthis.state.manualCompactionTakeoverPending = false;\n\t\t\tthis.state.compactionStartedAt = undefined;\n\t\t\tif (!this.state.compacting) return;\n\t\t\tthis.state.compacting = false;\n\t\t\tthis.state.statusMessage = \"\";\n\t\t} else {\n\t\t\tthis.state.compacting = true;\n\t\t\tthis.state.compactionStartedAt =\n\t\t\t\tstartedAt ??\n\t\t\t\tthis.state.getAgentSession?.()?.compactionStartedAt ??\n\t\t\t\tthis.state.getChatBoxSession?.()?.compactionStartedAt ??\n\t\t\t\tDate.now();\n\t\t\tthis.state.sdkBusy = true;\n\t\t\tthis.state.statusMessage = compactionStatusMessage(compactionReason);\n\t\t}\n\t\tthis.syncAnimationTick();\n\t\tthis.state.requestRender?.();\n\t}\n\n\t/**\n\t * Show the retry wait of a session this host attached to after its `auto_retry_start`: a session between two\n\t * attempts streams nothing, so a running turn's hydration shows none of it. The wait reads as that event shows it,\n\t * with the details of `retry`, the session's pending `auto_retry_start`, when the session has it, and ends as it\n\t * does, with the next attempt's `agent_start` or the retry's `auto_retry_end`. With the session's messages, the next\n\t * attempt's working line counts from the turn's start, as it does in a chat that saw the turn.\n\t */\n\thydrateRetryWait(messages?: readonly MeteredRunMessage[], turnStartedAt?: number, retry?: RetryWaitEvent): void {\n\t\tif (this.state.disposed) return;\n\t\tconst run = messages === undefined ? undefined : runInProgress(messages);\n\t\tconst startedAt = turnStartedAt ?? run?.startedAt;\n\t\tif (startedAt !== undefined) {\n\t\t\tthis.state.workingRunMeter.awaitRetry(startedAt, run?.settledTokens ?? 0);\n\t\t\tthis.state.retryContinuesRun = true;\n\t\t}\n\t\tshowChatSessionRetryWait(this.state, retry === undefined ? undefined : retryWaitFromEvent(retry));\n\t\tthis.syncAnimationTick();\n\t\tthis.state.requestRender?.();\n\t}\n\n\t/**\n\t * Show the move to a fallback model of a turn whose start (`turnStartedAt`) this host did not see: nothing streams\n\t * until the next model's request, which counts from the turn's start, as it does in a chat that saw the turn. A host\n\t * that saw the turn's failed request keeps its own count. The move ends as `model_fallback_start` shows it does,\n\t * with that request's `agent_start` or the switch's `model_fallback_end`.\n\t */\n\thydrateModelSwitch(turnStartedAt?: number, messages?: readonly MeteredRunMessage[]): void {\n\t\tif (this.state.disposed) return;\n\t\tif (turnStartedAt !== undefined && !this.state.retryContinuesRun) {\n\t\t\tthis.state.workingRunMeter.awaitRetry(turnStartedAt, messages ? runInProgress(messages).settledTokens : 0);\n\t\t\tthis.state.retryContinuesRun = true;\n\t\t}\n\t\tshowChatSessionModelSwitch(this.state);\n\t\tthis.syncAnimationTick();\n\t\tthis.state.requestRender?.();\n\t}\n\n\trender(width: number): string[] {\n\t\treturn this.renderBody(width, 1);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.taskInspector?.invalidate();\n\t\tthis.state.transcriptComponent.invalidate();\n\t\tthis.state.bodyViewport.invalidate();\n\t\tthis.state.editor?.invalidate();\n\t}\n\n\trenderBody(width: number, budget: number): string[] {\n\t\tif (this.taskInspector) {\n\t\t\tif (this.taskInspector.fullscreen) {\n\t\t\t\tthis.bodyLayout = { taskView: true };\n\t\t\t\treturn this.taskInspector.renderViewport(width, budget);\n\t\t\t}\n\t\t\tconst picker = this.taskInspector.renderPicker(width, budget);\n\t\t\tconst remaining = Math.max(0, budget - picker.length);\n\t\t\tconst body = remaining ? renderChatSessionBody(this.state, width, remaining) : [];\n\t\t\tthis.bodyLayout = { taskView: false, transcriptRows: body.length };\n\t\t\treturn [...body, ...Array.from({ length: Math.max(0, remaining - body.length) }, () => \"\"), ...picker];\n\t\t}\n\t\tconst body = renderChatSessionBody(this.state, width, budget);\n\t\tthis.bodyLayout = { taskView: false, transcriptRows: body.length };\n\t\treturn body;\n\t}\n\n\t/**\n\t * Rows the body occupies at `width`, whether or not they are on screen.\n\t *\n\t * Pair with `renderBodyRows` to read the whole transcript, not only the\n\t * window the reader is parked on. Both measure the component stack the last\n\t * `renderBody` installed, so call them after at least one body render.\n\t */\n\tbodyRowCount(width: number): number {\n\t\treturn this.state.bodyViewport.rowCount(width);\n\t}\n\n\t/** Body rows `startRow` (inclusive) to `endRow` (exclusive), unscrolled. */\n\trenderBodyRows(width: number, startRow: number, endRow: number): string[] {\n\t\treturn this.state.bodyViewport.renderRows(width, startRow, endRow);\n\t}\n\n\t/**\n\t * Render a live assistant entry whole, or only its tail (the default).\n\t *\n\t * The tail window keeps a fast-streaming turn cheap for a reader following\n\t * the bottom of the body; it also drops everything above the last 240 lines\n\t * from what `bodyRowCount` and `renderBodyRows` report. Returns whether the\n\t * setting changed, so the caller can invalidate the rows that were rendered\n\t * under the old rule.\n\t */\n\tsetStreamingTailWindowEnabled(enabled: boolean): boolean {\n\t\tif (this.state.streamingTailWindowEnabled === enabled) return false;\n\t\tthis.state.streamingTailWindowEnabled = enabled;\n\t\tthis.invalidate();\n\t\treturn true;\n\t}\n\n\trenderPendingMessages(width: number): string[] {\n\t\treturn renderChatSessionPendingMessages(this.state, width);\n\t}\n\n\trenderWorkingStatus(width: number, published?: PublishedChatActivity): string[] {\n\t\treturn renderChatSessionWorkingStatus(this.state, width, published);\n\t}\n\n\t/** The working line `renderWorkingStatus` draws, as data for a screen that draws it itself. */\n\tworkingLine(published?: PublishedChatActivity): AgentWorkingLine | undefined {\n\t\treturn chatSessionWorkingLine(this.state, published);\n\t}\n\n\trenderUsage(width: number): string[] {\n\t\treturn renderChatSessionUsage(this.state, width);\n\t}\n\n\t/**\n\t * The one row between the chat's working status and its composer: the usage meter, or a blank row when the chat has\n\t * no usage to show, so the status never sits on the composer's top rule and the transcript never runs into it.\n\t */\n\trenderUsageRow(width: number): string[] {\n\t\tconst usage = this.renderUsage(width);\n\t\treturn usage.length > 0 ? usage : [\"\"];\n\t}\n\n\trenderEditor(width: number): string[] {\n\t\treturn renderChatSessionEditor(this.state, width, this.focused);\n\t}\n\n\thasBackgroundTasks(): boolean {\n\t\treturn (this.taskSource?.backgroundTasks.length ?? 0) > 0;\n\t}\n\n\tprivate footerTaskSource(): TaskViewSource | undefined {\n\t\tconst agent = this.state.getAgentSession?.();\n\t\tconst session = agent ?? this.state.getChatBoxSession?.();\n\t\tconst store = session && getOwnerTaskStore(session);\n\t\treturn (\n\t\t\t(agent ? undefined : this.state.getTaskSource?.()) ?? (store ? ownerTaskViewSource(store) : this.taskSource)\n\t\t);\n\t}\n\n\trenderTaskFooter(width: number): string[] {\n\t\tconst source = this.footerTaskSource();\n\t\treturn source ? renderTaskFooter(source, width) : [];\n\t}\n\trenderFooter(width: number, navigationActive = false): string[] {\n\t\tconst footer = renderChatSessionFooter(\n\t\t\tthis.state,\n\t\t\t() => this.footerTaskSource(),\n\t\t\twidth,\n\t\t\tnavigationActive || (this.hasTaskInspector && !this.taskInspectorFullscreen),\n\t\t);\n\t\treturn footer.length ? footer : this.renderTaskFooter(width);\n\t}\n\n\thandleScrollInput(data: string): boolean {\n\t\treturn this.state.bodyViewport.handleInput(data);\n\t}\n\n\thandleInput(data: string): boolean {\n\t\treturn handleChatSessionInput(this.state, data, this.editorCallbacks());\n\t}\n\n\tinterrupt(options?: { restoreQueuedMessages?: boolean }): Promise<void> {\n\t\t// Keep the observed settlement: an async wrapper would orphan rejections from Escape callers.\n\t\treturn interruptChatSession(this.state, options);\n\t}\n\n\tasync submit(mode: ChatSessionSubmitMode = \"auto\", submittedText?: string): Promise<void> {\n\t\tawait submitChatSession(this.state, mode, submittedText);\n\t}\n\n\tisStreaming(): boolean {\n\t\treturn isChatSessionStreaming(this.state);\n\t}\n\n\tisBashRunning(): boolean {\n\t\treturn isChatSessionBashRunning(this.state);\n\t}\n\n\tisEditingBashCommand(): boolean {\n\t\treturn this.state.isBashMode;\n\t}\n\n\tisCompacting(): boolean {\n\t\treturn this.state.compacting;\n\t}\n\n\thasInputText(): boolean {\n\t\treturn this.state.inputBuffer.length > 0;\n\t}\n\n\thasAnimationTick(): boolean {\n\t\treturn this.state.animationTimer !== undefined;\n\t}\n\n\tbodyScrollFromBottom(): number {\n\t\treturn this.state.bodyViewport.getScrollFromBottom();\n\t}\n\n\t/**\n\t * A single click at row `event.y` of the body the last `renderBody` drew: on any row of a block it expands or\n\t * collapses that block, or a group summary and its calls, once the click cannot become a double-click. Expanding\n\t * while the body follows its end holds the view where it is, so the block stays under the pointer.\n\t */\n\thandleBodyClick(event: TuiMouseEvent): TuiMouseEventResult | undefined {\n\t\tif (!isSingleLeftClick(event)) return undefined;\n\t\tconst layout = this.bodyLayout;\n\t\t// A task's transcript the chat shows full-screen takes the click into its own transcript.\n\t\tif (layout.taskView) return this.taskInspector?.handleMouse(event);\n\t\t// While the prompt search or a completion menu owns input, a click on the transcript does nothing.\n\t\tif (event.y >= layout.transcriptRows || hasChatSessionTransientModal(this.state)) return undefined;\n\t\tconst state = this.state;\n\t\tconst hit = state.bodyViewport.componentAtRow(event.y);\n\t\tif (hit === undefined || hit.component !== state.transcriptComponent) return undefined;\n\t\tconst clicked = state.transcriptComponent.clickedEntries(hit.width, hit.row);\n\t\tif (clicked === undefined) return undefined;\n\t\t// The entries are drawn again with the click's expansion.\n\t\tconst expandEntries = (entries: readonly ChatSessionHostEntry<TExtraEntry>[], expand: boolean) => {\n\t\t\tfor (const entry of entries) {\n\t\t\t\tsetExpandedOverride(state, entry, expand);\n\t\t\t\tstate.entryRevisions.set(entry, (state.entryRevisions.get(entry) ?? 0) + 1);\n\t\t\t}\n\t\t\tconst first = state.bodyViewport.firstVisibleRow();\n\t\t\tif (expand && state.bodyViewport.getScrollFromBottom() === 0 && first !== undefined) {\n\t\t\t\tstate.bodyViewport.scrollTo(first);\n\t\t\t}\n\t\t\tstate.requestRender?.();\n\t\t};\n\t\t// The blocks as drawn may be redrawn by the time the click settles, by another click on them among others: the\n\t\t// entries are asked then how they are drawn and whether they change, and a group always changes as its calls\n\t\t// fold or show.\n\t\tconst generation = state.expansionGeneration;\n\t\tconst target = transcriptEntryName(state, clicked.target);\n\t\treturn {\n\t\t\thandled: true,\n\t\t\twhenSingleClick: () => {\n\t\t\t\tif (\n\t\t\t\t\tstate.disposed ||\n\t\t\t\t\tthis.bodyLayout.taskView ||\n\t\t\t\t\tgeneration !== state.expansionGeneration ||\n\t\t\t\t\t(state.getChatRenderSettings?.()?.toolOutputExpanded === true) !== state.expandedOverridesFor\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tconst entry = state.transcript.find((item) => transcriptEntryName(state, item) === target);\n\t\t\t\tif (!entry) return;\n\t\t\t\tconst width = state.bodyViewport.paintedContentWidth;\n\t\t\t\tconst group = state.transcriptComponent.currentClickGroup(width, entry);\n\t\t\t\tconst head = group?.entries[0];\n\t\t\t\tif (group && head && (isClickedGroup(group.blocks) || entryExpands(state, head, width))) {\n\t\t\t\t\texpandEntries(group.entries, !entryIsExpanded(state, head));\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Ctrl+O was pressed: every block follows the tool-output setting again, including those a click set, in this\n\t * chat and in the task transcript it shows.\n\t */\n\ttoolOutputToggled(): void {\n\t\tdropExpandedOverrides(this.state);\n\t\tthis.taskInspector?.toolOutputToggled();\n\t\tthis.invalidate();\n\t}\n\n\t/**\n\t * What the last `renderBody` drew on `row`: the transcript entry there and the row within it, or what the task\n\t * transcript the chat shows drew there. Undefined for rows outside a transcript.\n\t */\n\tbodyRowKey(row: number): string | undefined {\n\t\tconst layout = this.bodyLayout;\n\t\tif (layout.taskView) return this.taskInspector?.paintedRowKey(row);\n\t\tif (row < 0 || row >= layout.transcriptRows) return undefined;\n\t\tconst state = this.state;\n\t\tconst hit = state.bodyViewport.componentAtRow(row);\n\t\tif (hit === undefined || hit.component !== state.transcriptComponent) return undefined;\n\t\tconst drawn = state.transcriptComponent.paintedEntryAt(hit.width, hit.row);\n\t\treturn drawn === undefined\n\t\t\t? undefined\n\t\t\t: `${state.expansionGeneration}:${transcriptEntryName(state, drawn.entry)}#${drawn.row}`;\n\t}\n\n\tbodyMaxScroll(): number {\n\t\treturn this.state.bodyViewport.getMaxScroll();\n\t}\n\n\tinputText(): string {\n\t\treturn this.state.inputBuffer;\n\t}\n\t/** Whether the cursor is at the very start of the prompt, so ← there leaves the chat and keeps what is typed. */\n\tinputCursorAtStart(): boolean {\n\t\tif (this.state.inputBuffer.length === 0) return true;\n\t\tconst cursor = chatSessionEditorAccess(this.state).getCursor?.();\n\t\treturn cursor !== undefined && cursor.line === 0 && cursor.col === 0;\n\t}\n\tsetInputText(text: string): void {\n\t\tsetChatSessionEditorText(this.state, text);\n\t}\n\n\tstatusText(): string {\n\t\treturn this.state.noticeMessage || this.state.statusMessage;\n\t}\n\n\tshowWarning(message: string): void {\n\t\tthis.state.noticeMessage = message;\n\t\tthis.state.lastWarningMessage = message;\n\t\tthis.state.requestRender?.();\n\t}\n\n\tshowStatus(message: string): void {\n\t\tnotifyChatSessionStatus(this.state, message);\n\t}\n\n\tscrollToBottom(): void {\n\t\tthis.state.bodyViewport.scrollToBottom();\n\t}\n\n\t/**\n\t * Park the body with absolute row `row` at the top of its window, clamped\n\t * to the last rendered layout. Used to reveal a search match the reader\n\t * cannot currently see.\n\t */\n\tscrollBodyTo(row: number): void {\n\t\tthis.state.bodyViewport.scrollTo(row);\n\t}\n\n\tsyncAnimationTick(): void {\n\t\tsyncChatSessionAnimationTick(this.state);\n\t}\n\n\tsnapshotInterruptedTurn(): ChatSessionInterruptedTurnSnapshot | undefined {\n\t\tconst snapshot = chatSessionWorkingMeta(this.state);\n\t\tconst now = Date.now();\n\t\tconst startedAt = snapshot !== undefined ? now - snapshot.elapsedMs : undefined;\n\t\tconst settledTokens = snapshot?.tokens ?? 0;\n\t\tconst lastWorkingMessage = this.state.lastWorkingMessage ?? this.state.workingMessage;\n\t\tconst workedRun = snapshot !== undefined ? { message: lastWorkingMessage, snapshot } : this.state.workedRun;\n\t\tif (startedAt === undefined && workedRun === undefined && lastWorkingMessage === undefined) {\n\t\t\treturn this.state.interruptedTurnSnapshot;\n\t\t}\n\t\tif (workedRun !== undefined) {\n\t\t\tthis.state.workedRun = workedRun;\n\t\t}\n\t\tconst captured: ChatSessionInterruptedTurnSnapshot = {\n\t\t\tstartedAt,\n\t\t\tsettledTokens,\n\t\t\tlastWorkingMessage,\n\t\t\tworkedRun,\n\t\t};\n\t\tthis.state.interruptedTurnSnapshot = captured;\n\t\treturn captured;\n\t}\n\n\trestoreInterruptedTurn(\n\t\tinterrupted: ChatSessionInterruptedTurnSnapshot | undefined,\n\t\toptions?: { readonly resumeMeterForAgentEnd?: boolean },\n\t): void {\n\t\tthis.state.interruptedTurnSnapshot = interrupted;\n\t\tif (!interrupted) return;\n\t\tif (options?.resumeMeterForAgentEnd && interrupted.startedAt !== undefined) {\n\t\t\tconst elapsedAtInterrupt = interrupted.workedRun?.snapshot.elapsedMs;\n\t\t\tconst startedAt = elapsedAtInterrupt !== undefined ? Date.now() - elapsedAtInterrupt : interrupted.startedAt;\n\t\t\tthis.state.workingRunMeter.resume(startedAt, interrupted.settledTokens, false);\n\t\t\tif (this.state.lastWorkingMessage === undefined) {\n\t\t\t\tthis.state.lastWorkingMessage = interrupted.lastWorkingMessage;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (interrupted.workedRun !== undefined) {\n\t\t\tthis.state.workedRun = interrupted.workedRun;\n\t\t}\n\t}\n\n\tworkedRunSnapshot(): ChatSessionInterruptedTurnSnapshot[\"workedRun\"] {\n\t\treturn this.state.workedRun;\n\t}\n\n\t/**\n\t * Start Working for an accepted prompt delivered outside this host. Returns the\n\t * lifecycle token to hand back to `settleExternalPromptLifecycle`.\n\t */\n\tbeginExternalPromptLifecycle(): number | undefined {\n\t\treturn startChatSessionExternalPromptLifecycle(this.state);\n\t}\n\n\t/**\n\t * Show the turn a session runs now, read from its `messages` and the answer it `streaming`s. A turn that went on in\n\t * this session after it moved from another model counts from `turnStartedAt`, its first request's start, which\n\t * this session's messages do not hold.\n\t */\n\thydrateRunningTurn(\n\t\tmessages: readonly MeteredRunMessage[],\n\t\tstreaming?: MeteredRunMessage,\n\t\tturnStartedAt?: number,\n\t\trequestSide?: boolean,\n\t): void {\n\t\tif (this.state.disposed) return;\n\t\tif (!this.state.workingLifecycleActive) startChatSessionWorkingLifecycle(this.state);\n\t\tif (this.state.workingRunMeter.snapshot() === undefined) {\n\t\t\tconst run = runInProgress(messages, streaming);\n\t\t\tthis.state.workingRunMeter.resume(\n\t\t\t\tturnStartedAt ?? run.startedAt,\n\t\t\t\trun.settledTokens,\n\t\t\t\trequestSide ?? run.requesting,\n\t\t\t);\n\t\t\tif (streaming !== undefined) this.state.workingRunMeter.streaming(streaming);\n\t\t}\n\t\tif (this.state.workingMessage === undefined) {\n\t\t\tthis.state.workingMessage = pickWhimsicalWorkingMessage();\n\t\t\tthis.state.lastWorkingMessage = this.state.workingMessage;\n\t\t}\n\t\tsyncChatSessionAnimationTick(this.state);\n\t\tthis.state.requestRender?.();\n\t}\n\n\t/**\n\t * Reopen Working for a delivery still active after a temporary overlay — a\n\t * pre-turn compaction — cleared it. Preserves factual status text.\n\t */\n\treassertExternalPromptLifecycle(): number | undefined {\n\t\treturn reassertChatSessionExternalPromptLifecycle(this.state);\n\t}\n\n\t/** Settle a lifecycle from `beginExternalPromptLifecycle`. Stale tokens no-op. */\n\tsettleExternalPromptLifecycle(generation: number | undefined): void {\n\t\tsettleChatSessionPromptLifecycle(this.state, generation);\n\t\tsyncChatSessionAnimationTick(this.state);\n\t\tthis.state.requestRender?.();\n\t}\n\n\tdispose(): void {\n\t\tthis.taskInspector?.dispose();\n\t\tthis.taskInspector = undefined;\n\t\tthis.unsubscribeTasks?.();\n\t\tthis.unsubscribeTasks = undefined;\n\t\tthis.unsubscribeTaskBinding?.();\n\t\tthis.unsubscribeTaskBinding = undefined;\n\t\tthis.taskStore = undefined;\n\t\tthis.taskSource = undefined;\n\t\tthis.taskSession = undefined;\n\t\tdiscardChatMount(this);\n\t\tthis.taskDecorations?.clear();\n\t\tdisposeChatSession(this.state);\n\t}\n\n\trestoreQueuedMessagesToEditor(): boolean {\n\t\treturn restoreQueuedMessagesToEditor(this.state);\n\t}\n\n\t/**\n\t * Put messages already taken back from the agent's queue into the editor, with any the editor held, steering\n\t * messages first and then follow-ups, in front of what is typed. Answers how many came back.\n\t */\n\trestoreTakenQueuedMessages(taken: {\n\t\treadonly steering: readonly string[];\n\t\treadonly followUp: readonly string[];\n\t}): number {\n\t\treturn restoreTakenQueuedMessages(this.state, taken);\n\t}\n\n\t/** What Up recalls in this chat, oldest first, so a chat opened again later can recall it too. */\n\tpromptHistory(): readonly string[] {\n\t\treturn this.state.sentPrompts;\n\t}\n\n\t/** Let Up recall `prompts`, oldest first, as if they had been sent from this chat. */\n\tseedPromptHistory(prompts: readonly string[]): void {\n\t\tfor (const prompt of prompts) recordChatSessionPrompt(this.state, prompt);\n\t}\n\n\t/** Every message the chat lists as queued, per lane, as its queued rows show them. */\n\tqueuedMessages(): { readonly steering: readonly string[]; readonly followUp: readonly string[] } {\n\t\tconst steering = this.state.steeringController;\n\t\tif (steering !== undefined) return steering.allQueued();\n\t\treturn { steering: this.state.pendingSteeringMessages, followUp: this.state.pendingFollowUpMessages };\n\t}\n\n\t/** The text of the last answer the agent finished in this chat, as `/copy` copies it. */\n\tlastAgentMessageText(): string | undefined {\n\t\tconst messages = this.state.transcript.flatMap((entry) =>\n\t\t\tisChatMessageEntry(entry) && entry.kind === \"assistant\" ? [entry.message] : [],\n\t\t);\n\t\treturn lastAssistantAnswer(messages)?.text;\n\t}\n\n\tprivate editorCallbacks(): {\n\t\tsubmit: (mode: \"auto\" | \"followUp\", submittedText?: string) => void | Promise<void>;\n\t\trestoreQueuedMessagesToEditor: () => boolean;\n\t\tabortCompaction: () => void | Promise<void>;\n\t\tinterrupt: (options?: { restoreQueuedMessages?: boolean }) => void | Promise<void>;\n\t\tabortBash: () => void | Promise<void>;\n\t} {\n\t\treturn {\n\t\t\tsubmit: (mode, submittedText) => this.submit(mode, submittedText),\n\t\t\trestoreQueuedMessagesToEditor: () => this.restoreQueuedMessagesToEditor(),\n\t\t\tabortCompaction: () => abortChatSessionCompaction(this.state),\n\t\t\tinterrupt: (options) => this.interrupt(options),\n\t\t\tabortBash: () => abortChatSessionBash(this.state),\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"chat-session-host.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAErF,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAuB,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACxH,OAAO,EAAqB,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAAE,mBAAmB,E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,KAAK,CAAC,iBAAiB,CAAC;IACrC,CAAC;IAED,yFAAyF;IACzF,oBAAoB;QACnB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACxD,kBAAkB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAC9E,CAAC;QACF,OAAO,mBAAmB,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;IAC5C,CAAC;IAEO,eAAe;QAOtB,OAAO;YACN,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC;YACjE,6BAA6B,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,6BAA6B,EAAE;YACzE,eAAe,EAAE,GAAG,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC;YAC7D,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC/C,SAAS,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC;SACjD,CAAC;IACH,CAAC;CACD","sourcesContent":["import type { Component, Focusable, TuiMouseEvent, TuiMouseEventResult } from \"@bastani/atomic-tui\";\nimport type { AgentSessionEvent, CompactionReason } from \"../../../core/agent-session.js\";\nimport { chatReceipt } from \"../../../core/chat-receipts.js\";\nimport { hostNoticeForEvent } from \"../../../core/host-notices.js\";\nimport { repairOrphanToolResults } from \"../../../core/messages.ts\";\nimport { SessionManager } from \"../../../core/session-manager.ts\";\nimport type { PublishedChatActivity } from \"../../../core/session-retry-status.js\";\nimport type { SessionStore } from \"../../../core/storage/session/types.js\";\nimport { lastAssistantAnswer } from \"../../../core/storage/session/window-answer.js\";\nimport type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport { taskClocksFor } from \"../../../core/tasks/live-elapsed.js\";\nimport { getOwnerTaskStore, type OwnerTaskStore, watchOwnerTaskStoreBinding } from \"../../../core/tasks/owner-store.js\";\nimport { type TaskChatPage, taskChatPage } from \"../../../core/tasks/task-chat-records.js\";\nimport { ownerTaskViewSource, type TaskViewSource } from \"../../../core/tasks/task-view-source.js\";\nimport { savedRowKey } from \"../../../core/tasks/transcript-origin.js\";\nimport type { AgentWorkingLine } from \"../agent-view/contracts.ts\";\nimport { chatRecordsChanged, discardChatMount } from \"../chat-reader-records.js\";\nimport { pickWhimsicalWorkingMessage } from \"../whimsical-messages.ts\";\nimport { bindNextChatGroups, isTaskDisplayLine } from \"./chat-message-renderer.ts\";\nimport {\n\tabortChatSessionBash,\n\tabortChatSessionCompaction,\n\tinterruptChatSession,\n\trestoreQueuedMessagesToEditor,\n\trestoreTakenQueuedMessages,\n\tsubmitChatSession,\n} from \"./chat-session-host-actions.ts\";\nimport {\n\tchatSessionEditorAccess,\n\tcreateChatSessionEditor,\n\thandleChatSessionInput,\n\thasChatSessionTransientModal,\n\trecordChatSessionPrompt,\n\tsetChatSessionEditorText,\n} from \"./chat-session-host-editor.ts\";\nimport {\n\tapplyChatSessionAgentEvent,\n\tcompactionStatusMessage,\n\tshowChatSessionModelSwitch,\n\tshowChatSessionRetryWait,\n} from \"./chat-session-host-events.ts\";\nimport {\n\tchatSessionWorkingLine,\n\tchatSessionWorkingMeta,\n\tdropExpandedOverrides,\n\tentryExpands,\n\tentryIsExpanded,\n\trenderChatSessionBody,\n\trenderChatSessionEditor,\n\trenderChatSessionEntry,\n\trenderChatSessionFooter,\n\trenderChatSessionPendingMessages,\n\trenderChatSessionUsage,\n\trenderChatSessionWorkingStatus,\n\trestoreChatSessionTokens,\n\tsetExpandedOverride,\n\ttranscriptCacheKey,\n\ttranscriptEntryName,\n} from \"./chat-session-host-rendering.ts\";\nimport {\n\tdisposeChatSession,\n\tendHeldChatSessionWorkingLifecycle,\n\tisChatSessionBashRunning,\n\tisChatSessionStreaming,\n\tnotifyChatSessionStatus,\n\treassertChatSessionExternalPromptLifecycle,\n\tsettleChatSessionPromptLifecycle,\n\tstartChatSessionExternalPromptLifecycle,\n\tstartChatSessionWorkingLifecycle,\n\tstopChatSessionWorkingLifecycle,\n\tsyncChatSessionAnimationTick,\n} from \"./chat-session-host-runtime.ts\";\nimport { SavedPageCalls, type SavedPageNeighbours } from \"./chat-session-host-saved-calls.ts\";\nimport { ChatSessionHostState, countableTranscriptLength } from \"./chat-session-host-state.ts\";\nimport { type ChatSteeringTarget, createChatSessionSteering } from \"./chat-session-host-steering.ts\";\nimport type {\n\tAgentSnapshotMessage,\n\tChatSessionHostEntry,\n\tChatSessionHostOpts,\n\tChatSessionInterruptedTurnSnapshot,\n\tChatSessionSubmitMode,\n} from \"./chat-session-host-types.ts\";\nimport { firstRawUserExactText, isChatMessageEntry, syncFirstUserEntry } from \"./chat-session-host-utils.ts\";\nimport type { ChatTranscriptEntryLike, PaintedViewportWindow } from \"./chat-transcript.js\";\nimport { type ParkedTaskRows, parkedRun } from \"./parked-rows.ts\";\nimport { type RetryWaitEvent, retryWaitFromEvent } from \"./retry-status-line.ts\";\nimport { isSingleLeftClick } from \"./single-click.ts\";\nimport { TaskChatDecoration, taskLineRow } from \"./task-chat-decoration.js\";\nimport { TaskInspector } from \"./task-inspector.js\";\nimport { renderTaskFooter } from \"./task-list.js\";\nimport { pagedNotices } from \"./task-transcript-notices.ts\";\nimport type { TaskTranscriptEnvironment } from \"./task-transcript-page.ts\";\nimport { isClickedGroup } from \"./transcript-block-clicks.ts\";\nimport { type AgentTokenMeterSnapshot, type MeteredRunMessage, runInProgress } from \"./working-run-meter.ts\";\n\nexport interface SavedPageHandle {\n\tvisible(): boolean;\n\tdiscard(): void;\n\tlastRow(): object | undefined;\n}\n\nexport type {\n\tChatSessionHostBashRequest,\n\tChatSessionHostCommands,\n\tChatSessionHostEntry,\n\tChatSessionHostOpts,\n\tChatSessionHostStyle,\n\tChatSessionInterruptedTurnSnapshot,\n\tChatSessionSubmitMode,\n\tChatSessionViewportSettings,\n} from \"./chat-session-host-types.ts\";\n\n/**\n * Retired rows a parked reader keeps, with the reader-only lines that belong to them: a line drawn after one of\n * them, including those just below the last one, stays; any other line belongs to rows read again past an edge.\n */\nfunction withTaskLines(rows: readonly object[], part: readonly object[]): object[] {\n\tif (!part.length) return [];\n\tconst kept = new Set(part.filter((row) => !isTaskDisplayLine(row)));\n\tconst keeps = (line: object, previous: object | undefined) => {\n\t\tconst anchor = taskLineRow(line);\n\t\treturn anchor ? kept.has(anchor) : previous !== undefined && kept.has(previous);\n\t};\n\tconst result: object[] = [];\n\tlet previous: object | undefined;\n\tfor (const row of part) {\n\t\tif (!isTaskDisplayLine(row)) previous = row;\n\t\telse if (!keeps(row, previous)) continue;\n\t\tresult.push(row);\n\t}\n\t// Below the last row, only a line read for one of these rows; a live line there belongs to the newest rows.\n\tfor (let i = rows.indexOf(part.at(-1)!) + 1; i < rows.length; i++) {\n\t\tconst row = rows[i]!;\n\t\tconst anchor = isTaskDisplayLine(row) ? taskLineRow(row) : undefined;\n\t\tif (!anchor || !kept.has(anchor)) break;\n\t\tresult.push(row);\n\t}\n\treturn result;\n}\n\nexport class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike = never> implements Component, Focusable {\n\tfocused = true;\n\n\tprivate readonly state: ChatSessionHostState<TExtraEntry>;\n\t/** The agent this chat steers as the main chat does, when it was given one. */\n\tprivate readonly steering: ChatSteeringTarget | undefined;\n\tprivate taskStore?: OwnerTaskStore;\n\t/** What `/tasks` and the task footer show: the session's task store, or the host's own task source. */\n\tprivate taskSource?: TaskViewSource;\n\tprivate readonly taskRowsInChat: boolean;\n\tprivate unsubscribeTasks?: () => void;\n\tprivate taskSession?: object;\n\tprivate unsubscribeTaskBinding?: () => void;\n\tprivate taskInspector?: TaskInspector;\n\t/** How the last `renderBody` laid out the body: a full-screen task view, or the transcript's rows above a picker. */\n\tprivate bodyLayout: { readonly taskView: true } | { readonly taskView: false; readonly transcriptRows: number } = {\n\t\ttaskView: false,\n\t\ttranscriptRows: Number.POSITIVE_INFINITY,\n\t};\n\tprivate historyHydrated = false;\n\t/** The tool cards shown saved pages cut at their edges. */\n\tprivate readonly savedCalls: SavedPageCalls<TExtraEntry>;\n\tprivate taskDecorations?: TaskChatDecoration;\n\t/** Saved pages shown now: a reader-only line drawn after one of their rows leaves with that page. */\n\tprivate readonly shownSavedPages = new Set<Set<ChatSessionHostEntry<TExtraEntry>>>();\n\tprivate taskPageCapture(page: TaskChatPage | undefined) {\n\t\tif (!page) return undefined;\n\t\tthis.taskDecorations ??= new TaskChatDecoration((row, lines) => {\n\t\t\tfor (const shown of this.shownSavedPages)\n\t\t\t\tif (shown.has(row as ChatSessionHostEntry<TExtraEntry>))\n\t\t\t\t\tfor (const line of lines) shown.add(line as ChatSessionHostEntry<TExtraEntry>);\n\t\t});\n\t\tconst decorations = this.taskDecorations;\n\t\tthis.state.transcriptComponent.onVisibleEntry = (entry) => decorations.observe(entry);\n\t\treturn decorations.capture(this, page, this.state.liveChat, this.state.transcript, () =>\n\t\t\tthis.state.requestRender?.(),\n\t\t);\n\t}\n\tprivate readonly taskTranscriptEnvironment: () => TaskTranscriptEnvironment;\n\n\tconstructor(opts: ChatSessionHostOpts<TExtraEntry>) {\n\t\t// `/tasks` stays a local action owned by the host's `commands.handleSlashCommand`\n\t\t// (see submitChatSession). Hosts that mount the inspector call `openTasks` from\n\t\t// that callback; the host must not intercept it ahead of the owner.\n\t\tthis.taskRowsInChat = opts.taskRowsInChat ?? true;\n\t\t// A task transcript opened from this chat is a chat of its own on the same terminal and settings.\n\t\tthis.taskTranscriptEnvironment = () => ({\n\t\t\tcreateChat: (transcriptOpts) => new ChatSessionHost(transcriptOpts),\n\t\t\ttui: opts.tui,\n\t\t\tkeybindings: opts.keybindings,\n\t\t\teditorTheme: opts.editorTheme,\n\t\t\teditorFactory: opts.editorFactory,\n\t\t\tstyle: opts.style,\n\t\t\tgetChatRenderSettings: opts.getChatRenderSettings,\n\t\t\tfooterData: opts.footerData,\n\t\t\tnotify: (message) => this.showWarning(message),\n\t\t});\n\t\tthis.state = new ChatSessionHostState(opts, {\n\t\t\trenderEntry: (state, entry) => renderChatSessionEntry(state, entry),\n\t\t\ttranscriptCacheKey: (state, entry) => transcriptCacheKey(state, entry),\n\t\t});\n\t\tthis.steering = opts.steering;\n\t\tif (opts.steering) this.state.steeringController = createChatSessionSteering(this.state, opts.steering);\n\t\tthis.savedCalls = new SavedPageCalls(this.state);\n\t\tthis.state.editor = createChatSessionEditor(\n\t\t\tthis.state,\n\t\t\topts.tui,\n\t\t\topts.keybindings,\n\t\t\topts.editorTheme,\n\t\t\topts.editorFactory,\n\t\t\tthis.editorCallbacks(),\n\t\t);\n\t\tif (opts.autocompleteProvider) this.state.editor?.setAutocompleteProvider?.(opts.autocompleteProvider);\n\t\tthis.syncAnimationTick();\n\t\tthis.refreshTaskStore();\n\t}\n\n\topenTasks(id?: string): boolean {\n\t\tconst session = this.state.getAgentSession?.();\n\t\tif (session && !getOwnerTaskStore(session)) session.getAgentTaskHost?.();\n\t\tthis.refreshTaskStore();\n\t\tif (!this.taskSource) {\n\t\t\tthis.showWarning(\"Launched agents and shells will appear here.\");\n\t\t\treturn true;\n\t\t}\n\t\tthis.state.promptSearch = undefined;\n\t\tthis.taskInspector?.dispose();\n\t\tthis.taskInspector = new TaskInspector(\n\t\t\tthis.taskSource,\n\t\t\t() => this.state.requestRender?.(),\n\t\t\t() => this.closeTasks(),\n\t\t\tundefined,\n\t\t\t() => this.taskTranscriptEnvironment(),\n\t\t);\n\t\tthis.taskInspector.open(id as TaskId | undefined);\n\t\tthis.state.requestRender?.();\n\t\treturn true;\n\t}\n\tget hasTaskInspector(): boolean {\n\t\treturn this.taskInspector !== undefined;\n\t}\n\tget hasTransientModal(): boolean {\n\t\treturn hasChatSessionTransientModal(this.state);\n\t}\n\tget taskInspectorFullscreen(): boolean {\n\t\treturn this.taskInspector?.fullscreen === true;\n\t}\n\tcloseTasks(): void {\n\t\tthis.taskInspector?.dispose();\n\t\tthis.taskInspector = undefined;\n\t\tthis.state.requestRender?.();\n\t}\n\t/** Offers input to the open task inspector; false when none is open or it declined the input. */\n\thandleTaskInput(data: string): boolean {\n\t\treturn this.taskInspector?.handleInput(data) === true;\n\t}\n\tappendMessages(messages: readonly AgentSnapshotMessage[], settledTokens?: AgentTokenMeterSnapshot): void {\n\t\tconst hadFirstUser = this.state.seenFirstRawUser;\n\t\tif (!hadFirstUser && messages.length > 0) {\n\t\t\tconst firstUser = firstRawUserExactText(messages);\n\t\t\tif (firstUser.seenUser) {\n\t\t\t\tthis.state.seenFirstRawUser = true;\n\t\t\t\tthis.state.firstUserEntryExactText = firstUser.exactText;\n\t\t\t}\n\t\t}\n\t\tthis.state.liveChat.appendMessages(messages);\n\t\tif (!hadFirstUser && this.state.seenFirstRawUser) {\n\t\t\tsyncFirstUserEntry(this.state);\n\t\t}\n\t\tif (settledTokens) restoreChatSessionTokens(this.state, settledTokens);\n\t}\n\n\t/** Earlier history, shown above every entry while a reader scrolled away from the end keeps their place. */\n\tprependMessages(messages: readonly AgentSnapshotMessage[]): void {\n\t\tthis.prependPage(messages, {});\n\t}\n\n\tprivate prependPage(\n\t\tmessages: readonly AgentSnapshotMessage[],\n\t\tneighbours: SavedPageNeighbours,\n\t): Set<ChatSessionHostEntry<TExtraEntry>> {\n\t\tconst firstUser = firstRawUserExactText(messages);\n\t\tif (firstUser.seenUser) {\n\t\t\tthis.state.seenFirstRawUser = true;\n\t\t\tthis.state.firstUserEntryExactText = firstUser.exactText;\n\t\t}\n\t\tconst previousCount = countableTranscriptLength(this.state);\n\t\tconst before = this.state.transcript.length;\n\t\tconst notices = pagedNotices.get(this);\n\t\tif (notices?.card) this.state.assistantCard = notices.card;\n\t\tbindNextChatGroups(this.state.liveChat, this.taskPageCapture(taskChatPage(this)));\n\t\tthis.state.liveChat.prependMessages(messages);\n\t\t// Entries above the earliest one shown end where it starts: their open calls may have results shown below.\n\t\tconst page = this.savedCalls.show(\n\t\t\tnew Set(this.state.transcript.slice(0, this.state.transcript.length - before)),\n\t\t\tneighbours,\n\t\t\ttrue,\n\t\t);\n\t\tif (firstUser.seenUser || this.state.firstUserEntry === undefined) {\n\t\t\tsyncFirstUserEntry(this.state);\n\t\t}\n\t\tthis.state.newMessages.historyPrepended(countableTranscriptLength(this.state) - previousCount);\n\t\tthis.state.requestRender?.();\n\t\treturn page;\n\t}\n\n\t/**\n\t * Replaces the conversation with `messages`, keeping the host's own extra entries. `before` reads the saved entries\n\t * before them, for result cards whose calls are saved there.\n\t */\n\treplaceMessages(\n\t\tmessages: readonly AgentSnapshotMessage[],\n\t\toptions: { preserveUnread?: boolean; before?: SavedPageNeighbours[\"before\"]; parked?: ParkedTaskRows } = {},\n\t): void {\n\t\tif (options.preserveUnread && this.state.bodyViewport.getScrollFromBottom() > 0) {\n\t\t\tthis.state.newMessages.observe(false, countableTranscriptLength(this.state));\n\t\t}\n\t\tconst firstUser = firstRawUserExactText(messages);\n\t\tthis.state.seenFirstRawUser = firstUser.seenUser;\n\t\tthis.state.firstUserEntryExactText = firstUser.exactText;\n\t\tconst notices = pagedNotices.get(this);\n\t\tif (notices) pagedNotices.set(this.state.transcript, notices);\n\t\tthis.savedCalls.reset();\n\t\tthis.shownSavedPages.clear();\n\t\tthis.taskDecorations?.clear();\n\t\tbindNextChatGroups(this.state.liveChat, this.taskPageCapture(taskChatPage(this)));\n\t\tconst adopted = this.state.replaceTranscriptWindow(messages, options.parked);\n\t\tif (adopted) this.taskDecorations?.adoptRows(adopted);\n\t\tif (options.before) this.savedCalls.show(this.shownWindow(), { before: options.before }, false);\n\t\tsyncFirstUserEntry(this.state);\n\t\tif (options.preserveUnread) this.state.newMessages.replaced(countableTranscriptLength(this.state));\n\t\telse this.state.newMessages.reset();\n\t\tthis.state.requestRender?.();\n\t}\n\n\thasUnplacedWidget(): boolean {\n\t\treturn this.state.hasUnplacedWidget();\n\t}\n\t/** Called once, only if an actually drawn widget lacks a saved occurrence. */\n\tonUnplacedWidget(preserve?: () => void): void {\n\t\tthis.state.onUnplacedWidget = preserve;\n\t}\n\n\t/** Keep painted occurrences when a saved context is replaced; never infer a stored position from text. */\n\tparkedRows(current: number): ParkedTaskRows | undefined {\n\t\tconst { state } = this;\n\t\tif (state.bodyViewport.getScrollFromBottom() === 0) return undefined;\n\t\tconst painted = new Set(state.bodyViewport.paintedSegments(state.transcriptComponent)),\n\t\t\trows: readonly object[] = state.transcript;\n\t\tlet first = -1,\n\t\t\tlast = -1;\n\t\tfor (let i = 0; i < rows.length; i++) {\n\t\t\tif (!painted.has(rows[i])) continue;\n\t\t\tif (first < 0) first = i;\n\t\t\tlast = i;\n\t\t}\n\t\tif (first < 0) return undefined;\n\t\tconst own = new Set<object>(state.extraEntries);\n\t\tconst run = parkedRun(rows, first, last, current, {\n\t\t\tfixed: (row) => own.has(row),\n\t\t\tmessage: (row) => !own.has(row) && \"kind\" in row && !isTaskDisplayLine(row),\n\t\t});\n\t\tif (!run) return undefined;\n\t\tconst adopted = new Map<string, object>();\n\t\tfor (const row of run.adopted) {\n\t\t\tconst key = own.has(row) ? undefined : savedRowKey(row);\n\t\t\tif (key !== undefined && !adopted.has(key)) adopted.set(key, row);\n\t\t}\n\t\tconst retired = run.retired.filter((row) => !own.has(row));\n\t\treturn { rows: withTaskLines(rows, retired), first: run.first, last: run.last, adopted };\n\t}\n\tkeptPage(rows: readonly object[]): SavedPageHandle {\n\t\treturn this.savedPageHandle(new Set(rows) as Set<ChatSessionHostEntry<TExtraEntry>>);\n\t}\n\n\tprivate shownWindow(): Set<ChatSessionHostEntry<TExtraEntry>> {\n\t\tconst { state } = this;\n\t\treturn new Set(state.transcript.filter((e) => !state.extraEntries.includes(e as TExtraEntry)));\n\t}\n\n\t/**\n\t * Own one page displayed by a saved transcript. A page is discarded only after the viewport leaves it. `neighbours`\n\t * read the saved entries around it, one at a time; `after` is present when a later page follows it.\n\t */\n\tshowSavedPage(\n\t\tmessages: readonly AgentSnapshotMessage[],\n\t\tedge: \"latest\" | \"older\" | \"newer\",\n\t\tneighbours: SavedPageNeighbours = {},\n\t\tafter?: object,\n\t): SavedPageHandle {\n\t\tconst { state } = this;\n\t\tconst before = state.transcript.length;\n\t\tconst at = after === undefined ? -1 : state.transcript.indexOf(after as ChatSessionHostEntry<TExtraEntry>) + 1;\n\t\tlet owned: Set<ChatSessionHostEntry<TExtraEntry>>;\n\t\tif (edge === \"older\") owned = this.prependPage(messages, neighbours);\n\t\telse if (edge === \"latest\") {\n\t\t\tthis.replaceMessages(messages);\n\t\t\towned = this.savedCalls.show(this.shownWindow(), neighbours, neighbours.after !== undefined);\n\t\t} else {\n\t\t\tconst count = countableTranscriptLength(state);\n\t\t\tbindNextChatGroups(state.liveChat, this.taskPageCapture(taskChatPage(this)));\n\t\t\tif (at > 0) state.liveChat.insertMessages(at, messages);\n\t\t\telse this.appendMessages(messages);\n\t\t\tconst added = state.transcript.length - before;\n\t\t\towned = this.savedCalls.show(\n\t\t\t\tnew Set(at > 0 ? state.transcript.slice(at, at + added) : state.transcript.slice(before)),\n\t\t\t\tneighbours,\n\t\t\t\tneighbours.after !== undefined,\n\t\t\t);\n\t\t\tstate.newMessages.historyPrepended(countableTranscriptLength(state) - count);\n\t\t}\n\t\treturn this.savedPageHandle(owned);\n\t}\n\tprivate savedPageHandle(owned: Set<ChatSessionHostEntry<TExtraEntry>>): SavedPageHandle {\n\t\tconst { state } = this;\n\t\t// A saved line read later for one of the page's rows joins the page.\n\t\tthis.shownSavedPages.add(owned);\n\t\treturn {\n\t\t\tlastRow: () => state.transcript.findLast((entry) => owned.has(entry)),\n\t\t\tvisible: () => state.bodyViewport.paintsSegments(state.transcriptComponent, owned),\n\t\t\tdiscard: () => {\n\t\t\t\tthis.shownSavedPages.delete(owned);\n\t\t\t\t// The page's reader-only lines and their records leave with it.\n\t\t\t\tthis.taskDecorations?.release(owned);\n\t\t\t\tstate.liveChat.dropSavedEntries(owned);\n\t\t\t\tthis.savedCalls.discard(owned);\n\t\t\t\tstate.releaseRetiredRows();\n\t\t\t\tsyncFirstUserEntry(state);\n\t\t\t\tstate.firstUserEntryExactText = state.firstUserEntry?.text;\n\t\t\t\tstate.seenFirstRawUser = state.firstUserEntry !== undefined;\n\t\t\t\tstate.newMessages.replaced(countableTranscriptLength(state));\n\t\t\t\towned.clear();\n\t\t\t},\n\t\t};\n\t}\n\n\tresetFollowedSession(options?: { readonly preserveWorkedRun?: boolean }): void {\n\t\tif (options?.preserveWorkedRun) {\n\t\t\tif (this.state.workedRun === undefined) {\n\t\t\t\tconst snapshot = chatSessionWorkingMeta(this.state);\n\t\t\t\tif (snapshot !== undefined && !this.state.manualCompactionTakeoverPending) {\n\t\t\t\t\tthis.state.workedRun = { message: this.state.lastWorkingMessage, snapshot };\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthis.state.workedRun = undefined;\n\t\t\tthis.state.interruptedTurnSnapshot = undefined;\n\t\t}\n\t\tthis.state.workingRunMeter.stop();\n\t\tthis.state.retryContinuesRun = false;\n\t\tthis.state.manualCompactionTakeoverPending = false;\n\t\tthis.state.compacting = false;\n\t\tthis.state.compactionStartedAt = undefined;\n\t\tthis.state.sdkBusy = false;\n\t\tthis.state.workingMessage = undefined;\n\t\tthis.state.lastWorkingMessage = undefined;\n\t\tthis.state.seenFirstRawUser = false;\n\t\tthis.state.firstUserEntryExactText = undefined;\n\t\tthis.state.firstUserEntry = undefined;\n\t\tthis.state.statusMessage = \"\";\n\t\tif (this.state.noticeMessage !== this.state.lastWarningMessage) this.state.noticeMessage = \"\";\n\t\tthis.state.pendingSteeringMessages = [];\n\t\tthis.state.pendingFollowUpMessages = [];\n\t\tthis.state.deliveringQueuedMessages = undefined;\n\t\tthis.state.unconfirmedQueuedMessages = [];\n\t\tif (this.steering) {\n\t\t\t// The shown copies and the last listed queue were the previous session's.\n\t\t\tthis.state.steeringController?.dispose();\n\t\t\tthis.state.steeringController = createChatSessionSteering(this.state, this.steering);\n\t\t}\n\t\tthis.state.liveChat.clearPendingTools();\n\t\tthis.state.newMessages.reset();\n\t\tthis.state.countedTokensShown = undefined;\n\t\tstopChatSessionWorkingLifecycle(this.state);\n\t\tsyncChatSessionAnimationTick(this.state);\n\t}\n\t/**\n\t * Adopt the assistant message a live session is part-way through streaming.\n\t *\n\t * A host mounted mid-turn missed the `message_start` and every delta that\n\t * came before it, and delta-only updates never restate them, so the session's\n\t * in-flight message is the only place that text still exists. Ignored once\n\t * this host is already following a stream of its own.\n\t */\n\thydrateStreamingAssistantMessage(message: AgentSnapshotMessage | undefined): void {\n\t\tif (message === undefined) return;\n\t\tif (this.state.liveChat.hydrateStreamingAssistantMessage(message)) this.state.requestRender?.();\n\t}\n\n\t/**\n\t * Shows a saved conversation. A call in `inFlightToolCallIds` has no result yet because its agent waits for one,\n\t * so it shows as pending, not as interrupted, and the call's own end replaces it with the result.\n\t */\n\tasync loadSession(\n\t\tstore: SessionStore,\n\t\tsessionId: string | undefined,\n\t\tinFlightToolCallIds?: ReadonlySet<string>,\n\t): Promise<boolean> {\n\t\tif (\n\t\t\tthis.historyHydrated ||\n\t\t\tthis.state.transcript.length > this.state.extraEntries.length ||\n\t\t\tsessionId === undefined\n\t\t)\n\t\t\treturn true;\n\t\tlet messages: readonly AgentSnapshotMessage[];\n\t\ttry {\n\t\t\tconst manager = await SessionManager.open(store, sessionId, undefined, { history: \"tail\" });\n\t\t\tmessages = repairOrphanToolResults(manager.buildSessionProjection(\"transcript\").messages, {\n\t\t\t\trepairTrailing: true,\n\t\t\t\t...(inFlightToolCallIds === undefined ? {} : { inFlightToolCallIds }),\n\t\t\t}) as readonly AgentSnapshotMessage[];\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.state.disposed) return false;\n\t\tif (this.historyHydrated || this.state.transcript.length > this.state.extraEntries.length) return true;\n\t\tthis.historyHydrated = true;\n\t\tconst firstUser = firstRawUserExactText(messages);\n\t\tthis.state.seenFirstRawUser = firstUser.seenUser;\n\t\tthis.state.firstUserEntryExactText = firstUser.exactText;\n\t\tconst previousCount = countableTranscriptLength(this.state);\n\t\tconst extras = this.state.transcript.splice(0);\n\t\tthis.state.liveChat.appendMessages(messages);\n\t\tthis.state.transcript.push(...extras);\n\t\tsyncFirstUserEntry(this.state);\n\t\tthis.state.newMessages.historyPrepended(countableTranscriptLength(this.state) - previousCount);\n\t\tthis.state.requestRender?.();\n\t\treturn true;\n\t}\n\n\tappendExtraEntry(entry: TExtraEntry): void {\n\t\tthis.state.extraEntries.push(entry);\n\t\tthis.state.transcript.push(entry);\n\t}\n\n\tentries(): readonly ChatSessionHostEntry<TExtraEntry>[] {\n\t\treturn this.state.transcript;\n\t}\n\n\t/** Tasks outlive tools and turns; only host/session binding grants this read projection. */\n\trefreshTaskStore(): void {\n\t\tconst session = this.state.getAgentSession?.();\n\t\tconst sessionChanged = session !== this.taskSession;\n\t\tif (sessionChanged) {\n\t\t\tthis.unsubscribeTaskBinding?.();\n\t\t\tthis.taskSession = session;\n\t\t\tthis.unsubscribeTaskBinding = session\n\t\t\t\t? watchOwnerTaskStoreBinding(session, () => this.refreshTaskStore())\n\t\t\t\t: undefined;\n\t\t}\n\t\tconst store = session ? getOwnerTaskStore(session) : undefined;\n\t\t// A session in another process has no store here; the host\n\t\t// supplies a source that reads its tasks there.\n\t\tconst source = store ? ownerTaskViewSource(store) : this.state.getTaskSource?.();\n\t\tif (store === this.taskStore && source === this.taskSource) return;\n\t\tthis.closeTasks();\n\t\tthis.unsubscribeTasks?.();\n\t\tthis.taskStore = store;\n\t\tthis.taskSource = source;\n\t\tthis.unsubscribeTasks = undefined;\n\t\tthis.state.liveChat.clearTasks();\n\t\tthis.state.transcriptComponent.invalidate();\n\t\tthis.state.requestRender?.();\n\t\tif (!source) return;\n\t\ttaskClocksFor(source);\n\t\tconst update = () => {\n\t\t\t// Without task rows the transcript shows nothing of the tasks; only the footer repaints.\n\t\t\tif (this.taskRowsInChat) {\n\t\t\t\tthis.state.liveChat.upsertTasks(source.tasks, store);\n\t\t\t\tthis.state.transcriptComponent.invalidate();\n\t\t\t}\n\t\t\tthis.state.requestRender?.();\n\t\t};\n\t\tthis.unsubscribeTasks = source.subscribe(update);\n\t\tupdate();\n\t}\n\t/** A task chat shows reader-only outcomes as rows. Other hosts keep their event/status contract. */\n\tapplyTaskAgentEvent(event: AgentSessionEvent): void {\n\t\tthis.applyAgentEvent(event);\n\t\tconst receipt = chatReceipt(event);\n\t\tif (!receipt) return;\n\t\tchatRecordsChanged(this, receipt);\n\t\tthis.taskDecorations?.live.add(receipt.id);\n\t\tconst line = hostNoticeForEvent(event, this.state.manualCompactionTakeoverPending ? \"manual\" : undefined);\n\t\tif (!line || this.state.disposed) return;\n\t\tif (event.type === \"agent_continue_error\" || event.type === \"compaction_end\") this.state.statusMessage = \"\";\n\t\tthis.state.liveChat.appendTaskLine(line);\n\t\tthis.state.requestRender?.();\n\t}\n\tapplyAgentEvent(event: AgentSessionEvent): boolean {\n\t\tthis.refreshTaskStore();\n\t\treturn applyChatSessionAgentEvent(this.state, event);\n\t}\n\n\thydrateToolExecutionStarts(starts: readonly { readonly toolCallId: string; readonly startedAt: number }[]): void {\n\t\tlet changed = false;\n\t\tfor (const start of starts)\n\t\t\tchanged = this.state.liveChat.markToolExecutionStarted(start.toolCallId, start.startedAt) || changed;\n\t\tif (changed) this.state.requestRender?.();\n\t}\n\n\t/**\n\t * Restore the factual compaction indicator on a host mounted after the\n\t * `compaction_start` it never saw. The label resolves through the same\n\t * mapping the live event path uses, so the two cannot drift.\n\t *\n\t * Branch summaries deliberately do not paint here: their label belongs to\n\t * a retry lifecycle this re-attached host is not inside, and no event exists\n\t * to clear it after the summary finishes. An absent paintable reason is a\n\t * no-op unless this host is actively showing a compaction label, so unrelated\n\t * prompt delivery busy state is preserved.\n\t */\n\thydrateCompactionStatus(reason: CompactionReason | undefined, startedAt?: number): void {\n\t\tconst compactionReason = reason === \"branchSummary\" ? undefined : reason;\n\t\tif (compactionReason === undefined) {\n\t\t\tthis.state.manualCompactionTakeoverPending = false;\n\t\t\tthis.state.compactionStartedAt = undefined;\n\t\t\tif (!this.state.compacting) return;\n\t\t\tthis.state.compacting = false;\n\t\t\tthis.state.statusMessage = \"\";\n\t\t} else {\n\t\t\tthis.state.compacting = true;\n\t\t\tthis.state.compactionStartedAt =\n\t\t\t\tstartedAt ??\n\t\t\t\tthis.state.getAgentSession?.()?.compactionStartedAt ??\n\t\t\t\tthis.state.getChatBoxSession?.()?.compactionStartedAt ??\n\t\t\t\tDate.now();\n\t\t\tthis.state.sdkBusy = true;\n\t\t\tthis.state.statusMessage = compactionStatusMessage(compactionReason);\n\t\t}\n\t\tthis.syncAnimationTick();\n\t\tthis.state.requestRender?.();\n\t}\n\n\t/**\n\t * Show the retry wait of a session this host attached to after its `auto_retry_start`: a session between two\n\t * attempts streams nothing, so a running turn's hydration shows none of it. The wait reads as that event shows it,\n\t * with the details of `retry`, the session's pending `auto_retry_start`, when the session has it, and ends as it\n\t * does, with the next attempt's `agent_start` or the retry's `auto_retry_end`. With the session's messages, the next\n\t * attempt's working line counts from the turn's start, as it does in a chat that saw the turn.\n\t */\n\thydrateRetryWait(messages?: readonly MeteredRunMessage[], turnStartedAt?: number, retry?: RetryWaitEvent): void {\n\t\tif (this.state.disposed) return;\n\t\tconst run = messages === undefined ? undefined : runInProgress(messages);\n\t\tconst startedAt = turnStartedAt ?? run?.startedAt;\n\t\tif (startedAt !== undefined) {\n\t\t\tthis.state.workingRunMeter.awaitRetry(startedAt, run?.settledTokens ?? 0);\n\t\t\tthis.state.retryContinuesRun = true;\n\t\t}\n\t\tshowChatSessionRetryWait(this.state, retry === undefined ? undefined : retryWaitFromEvent(retry));\n\t\tthis.syncAnimationTick();\n\t\tthis.state.requestRender?.();\n\t}\n\n\t/**\n\t * Show the move to a fallback model of a turn whose start (`turnStartedAt`) this host did not see: nothing streams\n\t * until the next model's request, which counts from the turn's start, as it does in a chat that saw the turn. A host\n\t * that saw the turn's failed request keeps its own count. The move ends as `model_fallback_start` shows it does,\n\t * with that request's `agent_start` or the switch's `model_fallback_end`.\n\t */\n\thydrateModelSwitch(turnStartedAt?: number, messages?: readonly MeteredRunMessage[]): void {\n\t\tif (this.state.disposed) return;\n\t\tif (turnStartedAt !== undefined && !this.state.retryContinuesRun) {\n\t\t\tthis.state.workingRunMeter.awaitRetry(turnStartedAt, messages ? runInProgress(messages).settledTokens : 0);\n\t\t\tthis.state.retryContinuesRun = true;\n\t\t}\n\t\tshowChatSessionModelSwitch(this.state);\n\t\tthis.syncAnimationTick();\n\t\tthis.state.requestRender?.();\n\t}\n\n\trender(width: number): string[] {\n\t\treturn this.renderBody(width, 1);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.taskInspector?.invalidate();\n\t\tthis.state.transcriptComponent.invalidate();\n\t\tthis.state.bodyViewport.invalidate();\n\t\tthis.state.editor?.invalidate();\n\t}\n\n\trenderBody(width: number, budget: number): string[] {\n\t\tif (this.taskInspector) {\n\t\t\tif (this.taskInspector.fullscreen) {\n\t\t\t\tthis.bodyLayout = { taskView: true };\n\t\t\t\treturn this.taskInspector.renderViewport(width, budget);\n\t\t\t}\n\t\t\tconst picker = this.taskInspector.renderPicker(width, budget);\n\t\t\tconst remaining = Math.max(0, budget - picker.length);\n\t\t\tconst body = remaining ? renderChatSessionBody(this.state, width, remaining) : [];\n\t\t\tthis.bodyLayout = { taskView: false, transcriptRows: body.length };\n\t\t\treturn [...body, ...Array.from({ length: Math.max(0, remaining - body.length) }, () => \"\"), ...picker];\n\t\t}\n\t\tconst body = renderChatSessionBody(this.state, width, budget);\n\t\tthis.bodyLayout = { taskView: false, transcriptRows: body.length };\n\t\treturn body;\n\t}\n\n\t/** Where the last `renderBody` drew the transcript's rows, when it drew only the transcript. */\n\tbodyWindow(): PaintedViewportWindow | undefined {\n\t\treturn this.taskInspector ? undefined : this.state.bodyViewport.paintedWindow();\n\t}\n\n\t/**\n\t * Rows the body occupies at `width`, whether or not they are on screen.\n\t *\n\t * Pair with `renderBodyRows` to read the whole transcript, not only the\n\t * window the reader is parked on. Both measure the component stack the last\n\t * `renderBody` installed, so call them after at least one body render.\n\t */\n\tbodyRowCount(width: number): number {\n\t\treturn this.state.bodyViewport.rowCount(width);\n\t}\n\n\t/** Body rows `startRow` (inclusive) to `endRow` (exclusive), unscrolled. */\n\trenderBodyRows(width: number, startRow: number, endRow: number): string[] {\n\t\treturn this.state.bodyViewport.renderRows(width, startRow, endRow);\n\t}\n\n\t/**\n\t * Render a live assistant entry whole, or only its tail (the default).\n\t *\n\t * The tail window keeps a fast-streaming turn cheap for a reader following\n\t * the bottom of the body; it also drops everything above the last 240 lines\n\t * from what `bodyRowCount` and `renderBodyRows` report. Returns whether the\n\t * setting changed, so the caller can invalidate the rows that were rendered\n\t * under the old rule.\n\t */\n\tsetStreamingTailWindowEnabled(enabled: boolean): boolean {\n\t\tif (this.state.streamingTailWindowEnabled === enabled) return false;\n\t\tthis.state.streamingTailWindowEnabled = enabled;\n\t\tthis.invalidate();\n\t\treturn true;\n\t}\n\n\trenderPendingMessages(width: number): string[] {\n\t\treturn renderChatSessionPendingMessages(this.state, width);\n\t}\n\n\trenderWorkingStatus(width: number, published?: PublishedChatActivity): string[] {\n\t\treturn renderChatSessionWorkingStatus(this.state, width, published);\n\t}\n\n\t/** The working line `renderWorkingStatus` draws, as data for a screen that draws it itself. */\n\tworkingLine(published?: PublishedChatActivity): AgentWorkingLine | undefined {\n\t\treturn chatSessionWorkingLine(this.state, published);\n\t}\n\n\trenderUsage(width: number): string[] {\n\t\treturn renderChatSessionUsage(this.state, width);\n\t}\n\n\t/**\n\t * The one row between the chat's working status and its composer: the usage meter, or a blank row when the chat has\n\t * no usage to show, so the status never sits on the composer's top rule and the transcript never runs into it.\n\t */\n\trenderUsageRow(width: number): string[] {\n\t\tconst usage = this.renderUsage(width);\n\t\treturn usage.length > 0 ? usage : [\"\"];\n\t}\n\n\trenderEditor(width: number): string[] {\n\t\treturn renderChatSessionEditor(this.state, width, this.focused);\n\t}\n\n\thasBackgroundTasks(): boolean {\n\t\treturn (this.taskSource?.backgroundTasks.length ?? 0) > 0;\n\t}\n\n\tprivate footerTaskSource(): TaskViewSource | undefined {\n\t\tconst agent = this.state.getAgentSession?.();\n\t\tconst session = agent ?? this.state.getChatBoxSession?.();\n\t\tconst store = session && getOwnerTaskStore(session);\n\t\treturn (\n\t\t\t(agent ? undefined : this.state.getTaskSource?.()) ?? (store ? ownerTaskViewSource(store) : this.taskSource)\n\t\t);\n\t}\n\n\trenderTaskFooter(width: number): string[] {\n\t\tconst source = this.footerTaskSource();\n\t\treturn source ? renderTaskFooter(source, width) : [];\n\t}\n\trenderFooter(width: number, navigationActive = false): string[] {\n\t\tconst footer = renderChatSessionFooter(\n\t\t\tthis.state,\n\t\t\t() => this.footerTaskSource(),\n\t\t\twidth,\n\t\t\tnavigationActive || (this.hasTaskInspector && !this.taskInspectorFullscreen),\n\t\t);\n\t\treturn footer.length ? footer : this.renderTaskFooter(width);\n\t}\n\n\thandleScrollInput(data: string): boolean {\n\t\treturn this.state.bodyViewport.handleInput(data);\n\t}\n\n\thandleInput(data: string): boolean {\n\t\treturn handleChatSessionInput(this.state, data, this.editorCallbacks());\n\t}\n\n\tinterrupt(options?: { restoreQueuedMessages?: boolean }): Promise<void> {\n\t\t// Keep the observed settlement: an async wrapper would orphan rejections from Escape callers.\n\t\treturn interruptChatSession(this.state, options);\n\t}\n\n\tasync submit(mode: ChatSessionSubmitMode = \"auto\", submittedText?: string): Promise<void> {\n\t\tawait submitChatSession(this.state, mode, submittedText);\n\t}\n\n\tisStreaming(): boolean {\n\t\treturn isChatSessionStreaming(this.state);\n\t}\n\n\tisBashRunning(): boolean {\n\t\treturn isChatSessionBashRunning(this.state);\n\t}\n\n\tisEditingBashCommand(): boolean {\n\t\treturn this.state.isBashMode;\n\t}\n\n\tisCompacting(): boolean {\n\t\treturn this.state.compacting;\n\t}\n\n\thasInputText(): boolean {\n\t\treturn this.state.inputBuffer.length > 0;\n\t}\n\n\thasAnimationTick(): boolean {\n\t\treturn this.state.animationTimer !== undefined;\n\t}\n\n\tbodyScrollFromBottom(): number {\n\t\treturn this.state.bodyViewport.getScrollFromBottom();\n\t}\n\n\t/**\n\t * A single click at row `event.y` of the body the last `renderBody` drew: on any row of a block it expands or\n\t * collapses that block, or a group summary and its calls, once the click cannot become a double-click. Expanding\n\t * while the body follows its end holds the view where it is, so the block stays under the pointer.\n\t */\n\thandleBodyClick(event: TuiMouseEvent): TuiMouseEventResult | undefined {\n\t\tif (!isSingleLeftClick(event)) return undefined;\n\t\tconst layout = this.bodyLayout;\n\t\t// A task's transcript the chat shows full-screen takes the click into its own transcript.\n\t\tif (layout.taskView) return this.taskInspector?.handleMouse(event);\n\t\t// While the prompt search or a completion menu owns input, a click on the transcript does nothing.\n\t\tif (event.y >= layout.transcriptRows || hasChatSessionTransientModal(this.state)) return undefined;\n\t\tconst state = this.state;\n\t\tconst hit = state.bodyViewport.componentAtRow(event.y);\n\t\tif (hit === undefined || hit.component !== state.transcriptComponent) return undefined;\n\t\tconst clicked = state.transcriptComponent.clickedEntries(hit.width, hit.row);\n\t\tif (clicked === undefined) return undefined;\n\t\t// The entries are drawn again with the click's expansion.\n\t\tconst expandEntries = (entries: readonly ChatSessionHostEntry<TExtraEntry>[], expand: boolean) => {\n\t\t\tfor (const entry of entries) {\n\t\t\t\tsetExpandedOverride(state, entry, expand);\n\t\t\t\tstate.entryRevisions.set(entry, (state.entryRevisions.get(entry) ?? 0) + 1);\n\t\t\t}\n\t\t\tconst first = state.bodyViewport.firstVisibleRow();\n\t\t\tif (expand && state.bodyViewport.getScrollFromBottom() === 0 && first !== undefined) {\n\t\t\t\tstate.bodyViewport.scrollTo(first);\n\t\t\t}\n\t\t\tstate.requestRender?.();\n\t\t};\n\t\t// The blocks as drawn may be redrawn by the time the click settles, by another click on them among others: the\n\t\t// entries are asked then how they are drawn and whether they change, and a group always changes as its calls\n\t\t// fold or show.\n\t\tconst generation = state.expansionGeneration;\n\t\tconst target = transcriptEntryName(state, clicked.target);\n\t\treturn {\n\t\t\thandled: true,\n\t\t\twhenSingleClick: () => {\n\t\t\t\tif (\n\t\t\t\t\tstate.disposed ||\n\t\t\t\t\tthis.bodyLayout.taskView ||\n\t\t\t\t\tgeneration !== state.expansionGeneration ||\n\t\t\t\t\t(state.getChatRenderSettings?.()?.toolOutputExpanded === true) !== state.expandedOverridesFor\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tconst entry = state.transcript.find((item) => transcriptEntryName(state, item) === target);\n\t\t\t\tif (!entry) return;\n\t\t\t\tconst width = state.bodyViewport.paintedContentWidth;\n\t\t\t\tconst group = state.transcriptComponent.currentClickGroup(width, entry);\n\t\t\t\tconst head = group?.entries[0];\n\t\t\t\tif (group && head && (isClickedGroup(group.blocks) || entryExpands(state, head, width))) {\n\t\t\t\t\texpandEntries(group.entries, !entryIsExpanded(state, head));\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Ctrl+O was pressed: every block follows the tool-output setting again, including those a click set, in this\n\t * chat and in the task transcript it shows.\n\t */\n\ttoolOutputToggled(): void {\n\t\tdropExpandedOverrides(this.state);\n\t\tthis.taskInspector?.toolOutputToggled();\n\t\tthis.invalidate();\n\t}\n\n\t/**\n\t * What the last `renderBody` drew on `row`: the transcript entry there and the row within it, or what the task\n\t * transcript the chat shows drew there. Undefined for rows outside a transcript.\n\t */\n\tbodyRowKey(row: number): string | undefined {\n\t\tconst layout = this.bodyLayout;\n\t\tif (layout.taskView) return this.taskInspector?.paintedRowKey(row);\n\t\tif (row < 0 || row >= layout.transcriptRows) return undefined;\n\t\tconst state = this.state;\n\t\tconst hit = state.bodyViewport.componentAtRow(row);\n\t\tif (hit === undefined || hit.component !== state.transcriptComponent) return undefined;\n\t\tconst drawn = state.transcriptComponent.paintedEntryAt(hit.width, hit.row);\n\t\treturn drawn === undefined\n\t\t\t? undefined\n\t\t\t: `${state.expansionGeneration}:${transcriptEntryName(state, drawn.entry)}#${drawn.row}`;\n\t}\n\n\tbodyMaxScroll(): number {\n\t\treturn this.state.bodyViewport.getMaxScroll();\n\t}\n\n\tinputText(): string {\n\t\treturn this.state.inputBuffer;\n\t}\n\t/** Whether the cursor is at the very start of the prompt, so ← there leaves the chat and keeps what is typed. */\n\tinputCursorAtStart(): boolean {\n\t\tif (this.state.inputBuffer.length === 0) return true;\n\t\tconst cursor = chatSessionEditorAccess(this.state).getCursor?.();\n\t\treturn cursor !== undefined && cursor.line === 0 && cursor.col === 0;\n\t}\n\tsetInputText(text: string): void {\n\t\tsetChatSessionEditorText(this.state, text);\n\t}\n\n\tstatusText(): string {\n\t\treturn this.state.noticeMessage || this.state.statusMessage;\n\t}\n\n\tshowWarning(message: string): void {\n\t\tthis.state.noticeMessage = message;\n\t\tthis.state.lastWarningMessage = message;\n\t\tthis.state.requestRender?.();\n\t}\n\n\tshowStatus(message: string): void {\n\t\tnotifyChatSessionStatus(this.state, message);\n\t}\n\n\tscrollToBottom(): void {\n\t\tthis.state.bodyViewport.scrollToBottom();\n\t}\n\n\t/**\n\t * Park the body with absolute row `row` at the top of its window, clamped\n\t * to the last rendered layout. Used to reveal a search match the reader\n\t * cannot currently see.\n\t */\n\tscrollBodyTo(row: number): void {\n\t\tthis.state.bodyViewport.scrollTo(row);\n\t}\n\n\tsyncAnimationTick(): void {\n\t\tsyncChatSessionAnimationTick(this.state);\n\t}\n\n\tsnapshotInterruptedTurn(): ChatSessionInterruptedTurnSnapshot | undefined {\n\t\tconst snapshot = chatSessionWorkingMeta(this.state);\n\t\tconst now = Date.now();\n\t\tconst startedAt = snapshot !== undefined ? now - snapshot.elapsedMs : undefined;\n\t\tconst settledTokens = snapshot?.tokens ?? 0;\n\t\tconst lastWorkingMessage = this.state.lastWorkingMessage ?? this.state.workingMessage;\n\t\tconst workedRun = snapshot !== undefined ? { message: lastWorkingMessage, snapshot } : this.state.workedRun;\n\t\tif (startedAt === undefined && workedRun === undefined && lastWorkingMessage === undefined) {\n\t\t\treturn this.state.interruptedTurnSnapshot;\n\t\t}\n\t\tif (workedRun !== undefined) {\n\t\t\tthis.state.workedRun = workedRun;\n\t\t}\n\t\tconst captured: ChatSessionInterruptedTurnSnapshot = {\n\t\t\tstartedAt,\n\t\t\tsettledTokens,\n\t\t\tlastWorkingMessage,\n\t\t\tworkedRun,\n\t\t};\n\t\tthis.state.interruptedTurnSnapshot = captured;\n\t\treturn captured;\n\t}\n\n\trestoreInterruptedTurn(\n\t\tinterrupted: ChatSessionInterruptedTurnSnapshot | undefined,\n\t\toptions?: { readonly resumeMeterForAgentEnd?: boolean },\n\t): void {\n\t\tthis.state.interruptedTurnSnapshot = interrupted;\n\t\tif (!interrupted) return;\n\t\tif (options?.resumeMeterForAgentEnd && interrupted.startedAt !== undefined) {\n\t\t\tconst elapsedAtInterrupt = interrupted.workedRun?.snapshot.elapsedMs;\n\t\t\tconst startedAt = elapsedAtInterrupt !== undefined ? Date.now() - elapsedAtInterrupt : interrupted.startedAt;\n\t\t\tthis.state.workingRunMeter.resume(startedAt, interrupted.settledTokens, false);\n\t\t\tif (this.state.lastWorkingMessage === undefined) {\n\t\t\t\tthis.state.lastWorkingMessage = interrupted.lastWorkingMessage;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (interrupted.workedRun !== undefined) {\n\t\t\tthis.state.workedRun = interrupted.workedRun;\n\t\t}\n\t}\n\n\tworkedRunSnapshot(): ChatSessionInterruptedTurnSnapshot[\"workedRun\"] {\n\t\treturn this.state.workedRun;\n\t}\n\n\t/**\n\t * Start Working for an accepted prompt delivered outside this host. Returns the\n\t * lifecycle token to hand back to `settleExternalPromptLifecycle`.\n\t */\n\tbeginExternalPromptLifecycle(): number | undefined {\n\t\treturn startChatSessionExternalPromptLifecycle(this.state);\n\t}\n\n\t/**\n\t * Show the turn a session runs now, read from its `messages` and the answer it `streaming`s. A turn that went on in\n\t * this session after it moved from another model counts from `turnStartedAt`, its first request's start, which\n\t * this session's messages do not hold.\n\t */\n\thydrateRunningTurn(\n\t\tmessages: readonly MeteredRunMessage[],\n\t\tstreaming?: MeteredRunMessage,\n\t\tturnStartedAt?: number,\n\t\trequestSide?: boolean,\n\t): void {\n\t\tif (this.state.disposed) return;\n\t\tendHeldChatSessionWorkingLifecycle(this.state);\n\t\tif (this.state.workingLifecycle.kind === \"off\") startChatSessionWorkingLifecycle(this.state);\n\t\tif (this.state.workingRunMeter.snapshot() === undefined) {\n\t\t\tconst run = runInProgress(messages, streaming);\n\t\t\tthis.state.workingRunMeter.resume(\n\t\t\t\tturnStartedAt ?? run.startedAt,\n\t\t\t\trun.settledTokens,\n\t\t\t\trequestSide ?? run.requesting,\n\t\t\t);\n\t\t\tif (streaming !== undefined) this.state.workingRunMeter.streaming(streaming);\n\t\t}\n\t\tif (this.state.workingMessage === undefined) {\n\t\t\tthis.state.workingMessage = pickWhimsicalWorkingMessage();\n\t\t\tthis.state.lastWorkingMessage = this.state.workingMessage;\n\t\t}\n\t\tsyncChatSessionAnimationTick(this.state);\n\t\tthis.state.requestRender?.();\n\t}\n\n\t/**\n\t * Reopen Working for a delivery still active after a temporary overlay — a\n\t * pre-turn compaction — cleared it. Preserves factual status text.\n\t */\n\treassertExternalPromptLifecycle(): number | undefined {\n\t\treturn reassertChatSessionExternalPromptLifecycle(this.state);\n\t}\n\n\t/** Settle a lifecycle from `beginExternalPromptLifecycle`. Stale tokens no-op. */\n\tsettleExternalPromptLifecycle(generation: number | undefined): void {\n\t\tsettleChatSessionPromptLifecycle(this.state, generation);\n\t\tsyncChatSessionAnimationTick(this.state);\n\t\tthis.state.requestRender?.();\n\t}\n\n\tdispose(): void {\n\t\tthis.taskInspector?.dispose();\n\t\tthis.taskInspector = undefined;\n\t\tthis.unsubscribeTasks?.();\n\t\tthis.unsubscribeTasks = undefined;\n\t\tthis.unsubscribeTaskBinding?.();\n\t\tthis.unsubscribeTaskBinding = undefined;\n\t\tthis.taskStore = undefined;\n\t\tthis.taskSource = undefined;\n\t\tthis.taskSession = undefined;\n\t\tdiscardChatMount(this);\n\t\tthis.taskDecorations?.clear();\n\t\tdisposeChatSession(this.state);\n\t}\n\n\trestoreQueuedMessagesToEditor(): boolean {\n\t\treturn restoreQueuedMessagesToEditor(this.state);\n\t}\n\n\t/**\n\t * Put messages already taken back from the agent's queue into the editor, with any the editor held, steering\n\t * messages first and then follow-ups, in front of what is typed. Answers how many came back.\n\t */\n\trestoreTakenQueuedMessages(taken: {\n\t\treadonly steering: readonly string[];\n\t\treadonly followUp: readonly string[];\n\t}): number {\n\t\treturn restoreTakenQueuedMessages(this.state, taken);\n\t}\n\n\t/** What Up recalls in this chat, oldest first, so a chat opened again later can recall it too. */\n\tpromptHistory(): readonly string[] {\n\t\treturn this.state.sentPrompts;\n\t}\n\n\t/** Let Up recall `prompts`, oldest first, as if they had been sent from this chat. */\n\tseedPromptHistory(prompts: readonly string[]): void {\n\t\tfor (const prompt of prompts) recordChatSessionPrompt(this.state, prompt);\n\t}\n\n\t/** Every message the chat lists as queued, per lane, as its queued rows show them. */\n\tqueuedMessages(): { readonly steering: readonly string[]; readonly followUp: readonly string[] } {\n\t\tconst steering = this.state.steeringController;\n\t\tif (steering !== undefined) return steering.allQueued();\n\t\treturn { steering: this.state.pendingSteeringMessages, followUp: this.state.pendingFollowUpMessages };\n\t}\n\n\t/**\n\t * The messages the agent took from its queue whose own row the transcript does not show yet, per lane: the chat\n\t * draws them as queued rows ahead of {@link queuedMessages} until it does.\n\t */\n\tdeliveringMessages(): { readonly steering: readonly string[]; readonly followUp: readonly string[] } {\n\t\treturn { steering: this.state.deliveringTexts(\"steer\"), followUp: this.state.deliveringTexts(\"followUp\") };\n\t}\n\n\t/** How many user messages reached the transcript so far: it grows when a delivered message shows. */\n\tuserMessagesShown(): number {\n\t\treturn this.state.userMessagesShown;\n\t}\n\n\t/** The text of the last answer the agent finished in this chat, as `/copy` copies it. */\n\tlastAgentMessageText(): string | undefined {\n\t\tconst messages = this.state.transcript.flatMap((entry) =>\n\t\t\tisChatMessageEntry(entry) && entry.kind === \"assistant\" ? [entry.message] : [],\n\t\t);\n\t\treturn lastAssistantAnswer(messages)?.text;\n\t}\n\n\tprivate editorCallbacks(): {\n\t\tsubmit: (mode: \"auto\" | \"followUp\", submittedText?: string) => void | Promise<void>;\n\t\trestoreQueuedMessagesToEditor: () => boolean;\n\t\tabortCompaction: () => void | Promise<void>;\n\t\tinterrupt: (options?: { restoreQueuedMessages?: boolean }) => void | Promise<void>;\n\t\tabortBash: () => void | Promise<void>;\n\t} {\n\t\treturn {\n\t\t\tsubmit: (mode, submittedText) => this.submit(mode, submittedText),\n\t\t\trestoreQueuedMessagesToEditor: () => this.restoreQueuedMessagesToEditor(),\n\t\t\tabortCompaction: () => abortChatSessionCompaction(this.state),\n\t\t\tinterrupt: (options) => this.interrupt(options),\n\t\t\tabortBash: () => abortChatSessionBash(this.state),\n\t\t};\n\t}\n}\n"]}
@@ -165,6 +165,19 @@ export interface ScrollableComponentViewportOptions {
165
165
  readonly scrollbarThumbStyle?: (text: string) => string;
166
166
  readonly scrollbarTrackStyle?: (text: string) => string;
167
167
  }
168
+ /** Where a viewport's frame drew the rows of its stack. */
169
+ export interface PaintedViewportWindow {
170
+ /** Rows the frame has. */
171
+ readonly rows: number;
172
+ /** The stack row drawn first. */
173
+ readonly firstRow: number;
174
+ /** Rows the whole stack has, on and off screen. */
175
+ readonly totalRows: number;
176
+ /** Rows at the top of the frame that are not stack rows: the pinned prompt. */
177
+ readonly headRows: number;
178
+ /** Rows at the bottom of the frame that are not stack rows: the jump-to-latest row. */
179
+ readonly footRows: number;
180
+ }
168
181
  export interface WheelReport {
169
182
  readonly direction: -1 | 1;
170
183
  readonly alt: boolean;
@@ -263,6 +276,8 @@ export declare class ScrollableComponentViewport implements Component {
263
276
  get paintedContentWidth(): number;
264
277
  /** The first stack row the last frame drew, for holding the view where it is. */
265
278
  firstVisibleRow(): number | undefined;
279
+ /** Where the last frame drew the stack's rows; undefined before a frame was drawn. */
280
+ paintedWindow(): PaintedViewportWindow | undefined;
266
281
  /** Stop the scrollbar timer and release the last frame's hit-test and anchor state. */
267
282
  dispose(): void;
268
283
  invalidate(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"chat-transcript.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EACd,KAAK,SAAS,EAId,KAAK,mBAAmB,EAKxB,KAAK,gBAAgB,EACrB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,eAAe,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,KAAK,oBAAoB,EAAqC,MAAM,8BAA8B,CAAC;AAG5G;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAC3B,WAAW,GACX,UAAU,GACV,MAAM,GACN,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,CAAC;AAEb,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CAClC;AAED,MAAM,MAAM,sBAAsB,CAAC,MAAM,SAAS,uBAAuB,IAAI,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;AAE1G;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,SAAS,OAAO,EAAE,CAAC;AAEtE,MAAM,MAAM,sBAAsB,CAAC,MAAM,SAAS,uBAAuB,IAAI,CAC5E,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,KACT,2BAA2B,CAAC;AAsCjC;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,iBAAiB;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAA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AAmG;IACnG,OAAO,CAAC,YAAY;IAIpB,2GAA2G;IAC3G,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,gBAAgB;IAKxB,mGAAmG;IACnG,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,iBAAiB;IAkCzB,+GAA+G;IAC/G,OAAO,CAAC,cAAc;CAUtB;AAgHD,qBAAa,iCAAiC,CAAC,MAAM,SAAS,uBAAuB,CAAE,YAAW,SAAS;IAC1G,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;IAC9D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAE7D,YAAY,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,WAAW,EAAE,sBAAsB,CAAC,MAAM,CAAC,EAGlF;IAED,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEjC;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjC;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9B;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,mBAAmB,IAAI,MAAM,CAE5B;IAED,YAAY,IAAI,MAAM,CAErB;IAED,cAAc,IAAI,IAAI,CAErB;CACD;AAED,yGAAyG;AACzG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAYtE"}
1
+ {"version":3,"file":"chat-transcript.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EACd,KAAK,SAAS,EAId,KAAK,mBAAmB,EAKxB,KAAK,gBAAgB,EACrB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,eAAe,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,KAAK,oBAAoB,EAAqC,MAAM,8BAA8B,CAAC;AAG5G;;;;;;G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AAgB;IAKxB,mGAAmG;IACnG,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,iBAAiB;IAkCzB,+GAA+G;IAC/G,OAAO,CAAC,cAAc;CAUtB;AAgHD,qBAAa,iCAAiC,CAAC,MAAM,SAAS,uBAAuB,CAAE,YAAW,SAAS;IAC1G,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;IAC9D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAE7D,YAAY,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,WAAW,EAAE,sBAAsB,CAAC,MAAM,CAAC,EAGlF;IAED,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEjC;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjC;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9B;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,mBAAmB,IAAI,MAAM,CAE5B;IAED,YAAY,IAAI,MAAM,CAErB;IAED,cAAc,IAAI,IAAI,CAErB;CACD;AAED,yGAAyG;AACzG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAYtE"}
@@ -758,7 +758,7 @@ export class ScrollableComponentViewport {
758
758
  : undefined;
759
759
  const pin = pinned === undefined ? [] : [truncateToWidth(pinned, contentWidth, "")];
760
760
  const contentRows = this.visibleRows - indicator.length - pin.length;
761
- this.lastPaint = { start, pinRows: pin.length, contentRows };
761
+ this.lastPaint = { start, pinRows: pin.length, contentRows, rows: this.visibleRows, lineCount };
762
762
  const visible = [
763
763
  ...pin,
764
764
  ...this.renderVisibleRows(componentRows, start, start + contentRows).map(withoutTerminalControl),
@@ -801,6 +801,19 @@ export class ScrollableComponentViewport {
801
801
  firstVisibleRow() {
802
802
  return this.lastPaint?.start;
803
803
  }
804
+ /** Where the last frame drew the stack's rows; undefined before a frame was drawn. */
805
+ paintedWindow() {
806
+ const paint = this.lastPaint;
807
+ if (paint === undefined)
808
+ return undefined;
809
+ return {
810
+ rows: paint.rows,
811
+ firstRow: paint.start,
812
+ totalRows: paint.lineCount,
813
+ headRows: paint.pinRows,
814
+ footRows: paint.rows - paint.pinRows - paint.contentRows,
815
+ };
816
+ }
804
817
  /** Stop the scrollbar timer and release the last frame's hit-test and anchor state. */
805
818
  dispose() {
806
819
  this.lastPaint = undefined;