@bastani/atomic 0.10.0-alpha.1 → 0.10.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 (234) hide show
  1. package/CHANGELOG.md +260 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +22 -0
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/mcp/package.json +1 -1
  5. package/dist/builtin/subagents/CHANGELOG.md +41 -0
  6. package/dist/builtin/subagents/package.json +1 -1
  7. package/dist/builtin/subagents/skills/tmux/scripts/wait-for-text.sh +33 -3
  8. package/dist/builtin/web-access/package.json +1 -1
  9. package/dist/core/agent-session-events.d.ts.map +1 -1
  10. package/dist/core/agent-session-events.js +21 -6
  11. package/dist/core/agent-session-events.js.map +1 -1
  12. package/dist/core/lifecycle-timings.d.ts +6 -0
  13. package/dist/core/lifecycle-timings.d.ts.map +1 -1
  14. package/dist/core/lifecycle-timings.js +12 -0
  15. package/dist/core/lifecycle-timings.js.map +1 -1
  16. package/dist/core/queued-message-delivery.d.ts +41 -0
  17. package/dist/core/queued-message-delivery.d.ts.map +1 -0
  18. package/dist/core/queued-message-delivery.js +48 -0
  19. package/dist/core/queued-message-delivery.js.map +1 -0
  20. package/dist/core/storage/node-sqlite-thread.d.ts +64 -0
  21. package/dist/core/storage/node-sqlite-thread.d.ts.map +1 -0
  22. package/dist/core/storage/node-sqlite-thread.js +326 -0
  23. package/dist/core/storage/node-sqlite-thread.js.map +1 -0
  24. package/dist/core/storage/node-sqlite.d.ts.map +1 -1
  25. package/dist/core/storage/node-sqlite.js +230 -104
  26. package/dist/core/storage/node-sqlite.js.map +1 -1
  27. package/dist/core/tasks/agent-panel-source.d.ts +5 -0
  28. package/dist/core/tasks/agent-panel-source.d.ts.map +1 -1
  29. package/dist/core/tasks/agent-panel-source.js +1 -1
  30. package/dist/core/tasks/agent-panel-source.js.map +1 -1
  31. package/dist/modes/interactive/agent-view/agent-view-bridge.d.ts +8 -1
  32. package/dist/modes/interactive/agent-view/agent-view-bridge.d.ts.map +1 -1
  33. package/dist/modes/interactive/agent-view/agent-view-bridge.js.map +1 -1
  34. package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts +11 -5
  35. package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts.map +1 -1
  36. package/dist/modes/interactive/agent-view/agent-view-switcher.js +17 -5
  37. package/dist/modes/interactive/agent-view/agent-view-switcher.js.map +1 -1
  38. package/dist/modes/interactive/agent-view/contracts.d.ts +5 -0
  39. package/dist/modes/interactive/agent-view/contracts.d.ts.map +1 -1
  40. package/dist/modes/interactive/agent-view/contracts.js.map +1 -1
  41. package/dist/modes/interactive/agent-view/install.d.ts.map +1 -1
  42. package/dist/modes/interactive/agent-view/install.js +6 -3
  43. package/dist/modes/interactive/agent-view/install.js.map +1 -1
  44. package/dist/modes/interactive/agent-view/local-port.d.ts +5 -0
  45. package/dist/modes/interactive/agent-view/local-port.d.ts.map +1 -1
  46. package/dist/modes/interactive/agent-view/local-port.js +8 -0
  47. package/dist/modes/interactive/agent-view/local-port.js.map +1 -1
  48. package/dist/modes/interactive/agent-view/remote-port.d.ts +4 -1
  49. package/dist/modes/interactive/agent-view/remote-port.d.ts.map +1 -1
  50. package/dist/modes/interactive/agent-view/remote-port.js +22 -8
  51. package/dist/modes/interactive/agent-view/remote-port.js.map +1 -1
  52. package/dist/modes/interactive/agent-view/transcript-slot.d.ts +9 -0
  53. package/dist/modes/interactive/agent-view/transcript-slot.d.ts.map +1 -1
  54. package/dist/modes/interactive/agent-view/transcript-slot.js +141 -1
  55. package/dist/modes/interactive/agent-view/transcript-slot.js.map +1 -1
  56. package/dist/modes/interactive/components/agent-panel.d.ts +6 -0
  57. package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
  58. package/dist/modes/interactive/components/agent-panel.js +40 -10
  59. package/dist/modes/interactive/components/agent-panel.js.map +1 -1
  60. package/dist/modes/interactive/components/atomic-working-status.d.ts +15 -0
  61. package/dist/modes/interactive/components/atomic-working-status.d.ts.map +1 -1
  62. package/dist/modes/interactive/components/atomic-working-status.js +51 -3
  63. package/dist/modes/interactive/components/atomic-working-status.js.map +1 -1
  64. package/dist/modes/interactive/components/bash-execution.d.ts +2 -0
  65. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  66. package/dist/modes/interactive/components/bash-execution.js +5 -1
  67. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  68. package/dist/modes/interactive/components/branch-summary-message.d.ts +2 -0
  69. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  70. package/dist/modes/interactive/components/branch-summary-message.js +5 -1
  71. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  72. package/dist/modes/interactive/components/chat-message-renderer.d.ts +2 -0
  73. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  74. package/dist/modes/interactive/components/chat-message-renderer.js +17 -6
  75. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  76. package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
  77. package/dist/modes/interactive/components/chat-session-host-events.js +35 -4
  78. package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
  79. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
  80. package/dist/modes/interactive/components/chat-session-host-rendering.js +70 -13
  81. package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
  82. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +7 -0
  83. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
  84. package/dist/modes/interactive/components/chat-session-host-runtime.js +25 -4
  85. package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
  86. package/dist/modes/interactive/components/chat-session-host-state.d.ts +41 -1
  87. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
  88. package/dist/modes/interactive/components/chat-session-host-state.js +24 -3
  89. package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
  90. package/dist/modes/interactive/components/chat-session-host-steering.d.ts.map +1 -1
  91. package/dist/modes/interactive/components/chat-session-host-steering.js +2 -1
  92. package/dist/modes/interactive/components/chat-session-host-steering.js.map +1 -1
  93. package/dist/modes/interactive/components/chat-session-host.d.ts +13 -1
  94. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  95. package/dist/modes/interactive/components/chat-session-host.js +20 -2
  96. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  97. package/dist/modes/interactive/components/chat-transcript.d.ts +15 -0
  98. package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
  99. package/dist/modes/interactive/components/chat-transcript.js +14 -1
  100. package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
  101. package/dist/modes/interactive/components/compaction-boundary-message.d.ts +2 -0
  102. package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
  103. package/dist/modes/interactive/components/compaction-boundary-message.js +5 -1
  104. package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
  105. package/dist/modes/interactive/components/custom-entry.d.ts +2 -0
  106. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  107. package/dist/modes/interactive/components/custom-entry.js +5 -1
  108. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  109. package/dist/modes/interactive/components/custom-message.d.ts +2 -0
  110. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  111. package/dist/modes/interactive/components/custom-message.js +5 -1
  112. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  113. package/dist/modes/interactive/components/model-column.d.ts +96 -0
  114. package/dist/modes/interactive/components/model-column.d.ts.map +1 -0
  115. package/dist/modes/interactive/components/model-column.js +207 -0
  116. package/dist/modes/interactive/components/model-column.js.map +1 -0
  117. package/dist/modes/interactive/components/prompt-slot.d.ts +73 -0
  118. package/dist/modes/interactive/components/prompt-slot.d.ts.map +1 -0
  119. package/dist/modes/interactive/components/prompt-slot.js +201 -0
  120. package/dist/modes/interactive/components/prompt-slot.js.map +1 -0
  121. package/dist/modes/interactive/components/queued-messages-view.d.ts +6 -3
  122. package/dist/modes/interactive/components/queued-messages-view.d.ts.map +1 -1
  123. package/dist/modes/interactive/components/queued-messages-view.js +7 -4
  124. package/dist/modes/interactive/components/queued-messages-view.js.map +1 -1
  125. package/dist/modes/interactive/components/session-selector.d.ts +2 -0
  126. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  127. package/dist/modes/interactive/components/session-selector.js +4 -0
  128. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  129. package/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -0
  130. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  131. package/dist/modes/interactive/components/skill-invocation-message.js +5 -1
  132. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  133. package/dist/modes/interactive/components/task-board.d.ts +12 -3
  134. package/dist/modes/interactive/components/task-board.d.ts.map +1 -1
  135. package/dist/modes/interactive/components/task-board.js +33 -17
  136. package/dist/modes/interactive/components/task-board.js.map +1 -1
  137. package/dist/modes/interactive/components/task-inspector.d.ts +6 -1
  138. package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
  139. package/dist/modes/interactive/components/task-inspector.js +27 -7
  140. package/dist/modes/interactive/components/task-inspector.js.map +1 -1
  141. package/dist/modes/interactive/components/task-row.d.ts +4 -0
  142. package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
  143. package/dist/modes/interactive/components/task-row.js +7 -1
  144. package/dist/modes/interactive/components/task-row.js.map +1 -1
  145. package/dist/modes/interactive/components/task-transcript-page.d.ts +5 -0
  146. package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
  147. package/dist/modes/interactive/components/task-transcript-page.js +25 -0
  148. package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
  149. package/dist/modes/interactive/components/tool-execution.d.ts +7 -0
  150. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  151. package/dist/modes/interactive/components/tool-execution.js +19 -2
  152. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  153. package/dist/modes/interactive/components/tool-group-tracker.d.ts +20 -3
  154. package/dist/modes/interactive/components/tool-group-tracker.d.ts.map +1 -1
  155. package/dist/modes/interactive/components/tool-group-tracker.js +34 -7
  156. package/dist/modes/interactive/components/tool-group-tracker.js.map +1 -1
  157. package/dist/modes/interactive/components/transcript-block-clicks.d.ts +14 -2
  158. package/dist/modes/interactive/components/transcript-block-clicks.d.ts.map +1 -1
  159. package/dist/modes/interactive/components/transcript-block-clicks.js +23 -2
  160. package/dist/modes/interactive/components/transcript-block-clicks.js.map +1 -1
  161. package/dist/modes/interactive/interactive-agent-events.js +10 -2
  162. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  163. package/dist/modes/interactive/interactive-extension-runtime.d.ts +12 -1
  164. package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -1
  165. package/dist/modes/interactive/interactive-extension-runtime.js +37 -5
  166. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  167. package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
  168. package/dist/modes/interactive/interactive-input-handling.js +70 -46
  169. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  170. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  171. package/dist/modes/interactive/interactive-mode-base.js +7 -1
  172. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  173. package/dist/modes/interactive/interactive-prompt-turn.js +17 -9
  174. package/dist/modes/interactive/interactive-prompt-turn.js.map +1 -1
  175. package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
  176. package/dist/modes/interactive/interactive-queueing.js +2 -1
  177. package/dist/modes/interactive/interactive-queueing.js.map +1 -1
  178. package/dist/modes/interactive/interactive-render-chat.d.ts +18 -1
  179. package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
  180. package/dist/modes/interactive/interactive-render-chat.js +90 -10
  181. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  182. package/dist/modes/interactive/interactive-session-routing.js +2 -0
  183. package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
  184. package/dist/modes/interactive/interactive-task-projection.js +2 -2
  185. package/dist/modes/interactive/interactive-task-projection.js.map +1 -1
  186. package/dist/modes/interactive/screen-hold.d.ts +41 -0
  187. package/dist/modes/interactive/screen-hold.d.ts.map +1 -0
  188. package/dist/modes/interactive/screen-hold.js +80 -0
  189. package/dist/modes/interactive/screen-hold.js.map +1 -0
  190. package/dist/modes/interactive/started-run-echo.d.ts +66 -0
  191. package/dist/modes/interactive/started-run-echo.d.ts.map +1 -0
  192. package/dist/modes/interactive/started-run-echo.js +75 -0
  193. package/dist/modes/interactive/started-run-echo.js.map +1 -0
  194. package/dist/modes/interactive-engine/engine-custom-ui.d.ts +1 -0
  195. package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
  196. package/dist/modes/interactive-engine/engine-custom-ui.js +25 -1
  197. package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
  198. package/dist/modes/interactive-engine/engine-quit-intent.d.ts.map +1 -1
  199. package/dist/modes/interactive-engine/engine-quit-intent.js +3 -0
  200. package/dist/modes/interactive-engine/engine-quit-intent.js.map +1 -1
  201. package/dist/modes/interactive-engine/protocol.d.ts +5 -0
  202. package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
  203. package/dist/modes/interactive-engine/protocol.js +7 -1
  204. package/dist/modes/interactive-engine/protocol.js.map +1 -1
  205. package/dist/modes/interactive-engine/remote-component.d.ts +10 -2
  206. package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
  207. package/dist/modes/interactive-engine/remote-component.js +19 -2
  208. package/dist/modes/interactive-engine/remote-component.js.map +1 -1
  209. package/dist/modes/interactive-engine/remote-renderer.d.ts +10 -0
  210. package/dist/modes/interactive-engine/remote-renderer.d.ts.map +1 -1
  211. package/dist/modes/interactive-engine/remote-renderer.js +24 -4
  212. package/dist/modes/interactive-engine/remote-renderer.js.map +1 -1
  213. package/dist/modes/interactive-engine/transcript-frame-layout.d.ts +50 -0
  214. package/dist/modes/interactive-engine/transcript-frame-layout.d.ts.map +1 -0
  215. package/dist/modes/interactive-engine/transcript-frame-layout.js +95 -0
  216. package/dist/modes/interactive-engine/transcript-frame-layout.js.map +1 -0
  217. package/dist/modes/rpc/agent-panel-bridge.d.ts.map +1 -1
  218. package/dist/modes/rpc/agent-panel-bridge.js +16 -0
  219. package/dist/modes/rpc/agent-panel-bridge.js.map +1 -1
  220. package/dist/modes/rpc/agent-view-engine-registry.d.ts.map +1 -1
  221. package/dist/modes/rpc/agent-view-engine-registry.js +36 -1
  222. package/dist/modes/rpc/agent-view-engine-registry.js.map +1 -1
  223. package/dist/modes/rpc/agent-view-rpc-panel.d.ts.map +1 -1
  224. package/dist/modes/rpc/agent-view-rpc-panel.js +5 -1
  225. package/dist/modes/rpc/agent-view-rpc-panel.js.map +1 -1
  226. package/dist/modes/rpc/task-ui-bridge.js +1 -1
  227. package/dist/modes/rpc/task-ui-bridge.js.map +1 -1
  228. package/docs/background-tasks.md +1 -1
  229. package/docs/development.md +2 -0
  230. package/docs/extensions/authoring.md +1 -1
  231. package/docs/keybindings.md +2 -2
  232. package/docs/storage.md +1 -0
  233. package/npm-shrinkwrap.json +49 -49
  234. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-render-chat.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAA8B,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACN,mBAAmB,EACnB,cAAc,EACd,0BAA0B,EAC1B,qBAAqB,GAGrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,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AO,CAAC,OAA4C,CAAC;IACrE,IAAI,OAAO,EAAE,QAAQ,KAAK,gBAAgB;QAAE,OAAO,KAAK,CAAC;IACzD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;QAC7C,CAAC,CAAC,OAAO,CAAC,OAAO;aACd,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC;aACxC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;aAC1B,IAAI,CAAC,IAAI,CAAC;QACb,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACnB,OAAO,6BAA6B,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,aAAa,CAAC;AACxE,CAAC","sourcesContent":["import { isProxy } from \"node:util/types\";\nimport type { AssistantMessage, Usage } from \"@bastani/atomic-ai/compat\";\nimport { type HistoryLeaf, type TUI, WindowedContainer } from \"@bastani/atomic-tui\";\nimport { CONFIG_DIR_NAME } from \"../../config.js\";\nimport {\n\tadvanceCacheHistory,\n\tcacheMissAfter,\n\tcreateCacheMissModelSource,\n\tformatCacheMissNotice,\n\ttype ModelPriceSource,\n\ttype PreviousRequest,\n} from \"../../core/cache-stats.ts\";\nimport { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { isVerbatimCompactionMessage, stripVerbatimCompactionPrefix } from \"../../core/messages.ts\";\nimport { projectTrustWarningVisible } from \"../../core/project-trust-state.ts\";\nimport { serviceTierWarnings } from \"../../core/service-tier-warnings.ts\";\nimport type { CustomEntry } from \"../../core/session-manager.ts\";\nimport { buildContextEntries, type SessionEntry } from \"../../core/session-manager.ts\";\nimport { sessionEntryToDisplayMessages } from \"../../core/session-manager-history.ts\";\nimport { getOwnerTaskStore } from \"../../core/tasks/owner-store.js\";\nimport { ReopenedCompletionHeaders } from \"../../core/tasks/reopened-completion.js\";\nimport { taskTranscriptSource } from \"../../core/tasks/supervisor.js\";\nimport { readTaskCompletionHistory } from \"../../core/tasks/task-completion-history.js\";\nimport {\n\tcarryRowSource,\n\tnoteRowSource,\n\tnoteSavedSeq,\n\tsavedRowKey,\n\tsavedSeqOf,\n} from \"../../core/tasks/transcript-origin.js\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.js\";\nimport {\n\tdisposeRemoteRenderers,\n\tRemoteCustomMessageComponent,\n\tRemoteToolExecutionComponent,\n} from \"../interactive-engine/remote-renderer.ts\";\nimport { appendBoundedStderr } from \"../rpc/rpc-client-process.js\";\nimport { messageComponents, statusComponents } from \"./chat-message-count.ts\";\nimport { bindChatLayout, ChatReaderLayout, chatDecorationRow } from \"./chat-reader-layout.js\";\nimport {\n\tCHAT_RECORD_FIRST_PAINT_MS,\n\ttype ChatPageDecorations,\n\treadMountedAnchors,\n\tretainChatRecords,\n\tsessionChatMount,\n} from \"./chat-reader-records.js\";\nimport { addMainPromptHistory } from \"./components/agent-prompt-history.ts\";\nimport {\n\tapplyToolEntryState,\n\tcallsAwaitingLaterResults,\n\tisResultWithoutCall,\n} from \"./components/chat-message-renderer.ts\";\nimport { CustomEntryComponent } from \"./components/custom-entry.ts\";\nimport type { NewMessageCounter } from \"./components/jump-to-latest.ts\";\nimport { createMarkdownTransform } from \"./components/markdown-transform.ts\";\nimport { createMermaidMarkdownTransformer } from \"./components/mermaid.ts\";\nimport { ThemedText } from \"./components/themed-text.js\";\nimport type { ToolGroupRole } from \"./components/tool-block.ts\";\nimport { assistantCallBreaks, type ToolGroupMemberState, ToolGroupTracker } from \"./components/tool-group-tracker.ts\";\nimport { appendNewChildrenBeforeAttachedChild } from \"./interactive-child-ordering.ts\";\nimport { countChatMessages, InteractiveModeBase, isChatMessageComponent } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AgentMessage,\n\tAPP_NAME,\n\tAssistantMessageComponent,\n\taddChatTranscriptEntry,\n\tBashExecutionComponent,\n\tBranchSummaryMessageComponent,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tCompactionBoundaryMessageComponent,\n\ttype Component,\n\tContainer,\n\tCustomMessageComponent,\n\tchatEntriesFromAgentMessages,\n\tgetChangelogPath,\n\thasTrustRequiringProjectResourcesAsync,\n\tMarkdown,\n\ttype Message,\n\ttype PersistedMessageMeta,\n\tparseSkillBlock,\n\tpreloadChangelog,\n\trecordTimeSinceReset,\n\trenderChatMessageEntry,\n\ttype SessionContext,\n\tSkillInvocationMessageComponent,\n\tSpacer,\n\tText,\n\tToolExecutionComponent,\n\ttype TruncationResult,\n\ttheme,\n\tUserMessageComponent,\n\ttype VerbatimCompactionResult,\n} from \"./interactive-mode-deps.ts\";\nimport {\n\tholdCompactionWidgets,\n\tinstallSavedChatHistory,\n\tnoteShownContext,\n\ttype ParkedViewport,\n\tparkViewport,\n\treleaseSavedChatHistory,\n\ttype SavedCopyDraw,\n\ttype SavedPageEarlier,\n\ttype SavedPageRecords,\n\ttype SavedRendererInstances,\n\tstoredWidget,\n\twidgetKey,\n} from \"./interactive-saved-chat-history.js\";\nimport { followChosenExpansion, SavedPageCallsBuilder } from \"./interactive-saved-tool-calls.ts\";\nimport { StartupChatContainer, trackChatHistoryBuild } from \"./interactive-startup-chat-container.ts\";\nimport type { InteractiveSubmission } from \"./interactive-submission.ts\";\nimport { refreshInteractiveTasks } from \"./interactive-task-projection.js\";\n\nfunction countDroppedThinkingBlocks(message: AssistantMessage): number {\n\treturn (message.diagnostics ?? []).reduce((count, diagnostic) => {\n\t\tif (diagnostic.type !== \"anthropic_input_transformations\") return count;\n\t\tconst dropped = diagnostic.details?.droppedBlockCount;\n\t\treturn count + (typeof dropped === \"number\" && dropped > 0 ? dropped : 0);\n\t}, 0);\n}\n\nfunction addServiceTierWarnings(mode: InteractiveModeBase, message: AssistantMessage): void {\n\tfor (const warning of serviceTierWarnings(message)) {\n\t\tmode.chatContainer.addChild(new Spacer(1));\n\t\tmode.chatContainer.addChild(new Text(theme.fg(\"warning\", `Warning: ${warning}`), 1, 0));\n\t}\n}\n\nInteractiveModeBase.prototype.maybeShowAssistantDiagnostics = function (\n\tthis: InteractiveModeBase,\n\tmessage: AssistantMessage,\n): void {\n\taddServiceTierWarnings(this, message);\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\n\tconst count = countDroppedThinkingBlocks(message);\n\tif (count === 0) return;\n\tlet previousCount = 0;\n\t// The local host has already committed this occurrence; the isolated mirror may still end at its predecessor.\n\tconst publishing = this.session?.publishingReplyId?.(message);\n\tconst branch = this.sessionManager.getBranch();\n\tfor (let i = branch.length - 1; i >= 0; i--) {\n\t\tconst entry = branch[i];\n\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\" && entry.id !== publishing) {\n\t\t\tpreviousCount = countDroppedThinkingBlocks(entry.message);\n\t\t\tbreak;\n\t\t}\n\t}\n\taddThinkingDrop(this, count, previousCount);\n};\n\nfunction addThinkingDrop(mode: InteractiveModeBase, count: number, previousCount: number): void {\n\tif (count <= previousCount) return;\n\tconst noun = count === 1 ? \"thinking block\" : \"thinking blocks\";\n\tmode.chatContainer.addChild(new Spacer(1));\n\tmode.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `Anthropic dropped ${count} ${noun} (details in session)`), 1, 0),\n\t);\n}\n\n// Weak keys leave cleared/rebuilt transcripts collectible without separate lifecycle state.\n// Only persistent diagnostic statuses participate; ordinary chat/status is never evicted.\nconst diagnosticStatuses = new WeakMap<Component, { spacer: Spacer; bytes: number }>();\nconst MAX_DIAGNOSTIC_STATUSES = 64;\nconst MAX_DIAGNOSTIC_HISTORY_BYTES = 256 * 1024;\n\nInteractiveModeBase.prototype.showStatus = function (\n\tthis: InteractiveModeBase,\n\tmessage: string,\n\tpersist = false,\n): void {\n\tconst children = this.chatContainer.children;\n\tconst last = children.length > 0 ? children[children.length - 1] : undefined;\n\tconst secondLast = children.length > 1 ? children[children.length - 2] : undefined;\n\n\tif (!persist && last && secondLast && last === this.lastStatusText && secondLast === this.lastStatusSpacer) {\n\t\tthis.lastStatusText.setText(theme.fg(\"dim\", message));\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\n\tif (persist) message = appendBoundedStderr(\"\", message);\n\tconst spacer = new Spacer(1);\n\tconst text = new Text(theme.fg(\"dim\", message), 1, 0);\n\tstatusComponents.add(text);\n\tthis.chatContainer.addChild(spacer);\n\tthis.chatContainer.addChild(text);\n\tthis.lastStatusSpacer = persist ? undefined : spacer;\n\tthis.lastStatusText = persist ? undefined : text;\n\tif (persist) {\n\t\tdiagnosticStatuses.set(text, { spacer, bytes: Buffer.byteLength(message) });\n\t\tlet count = 0;\n\t\tlet bytes = 0;\n\t\tfor (const child of [...children].reverse()) {\n\t\t\tconst diagnostic = diagnosticStatuses.get(child);\n\t\t\tif (!diagnostic) continue;\n\t\t\tcount++;\n\t\t\tbytes += diagnostic.bytes;\n\t\t\tif (count > MAX_DIAGNOSTIC_STATUSES || bytes > MAX_DIAGNOSTIC_HISTORY_BYTES) {\n\t\t\t\tthis.chatContainer.removeChild(child);\n\t\t\t\tthis.chatContainer.removeChild(diagnostic.spacer);\n\t\t\t}\n\t\t}\n\t}\n\tthis.ui.requestRender();\n};\n\nconst echoReadEpochs = new WeakMap<Component[], number>();\n\ninterface GroupedToolComponent {\n\tsetGroupRole(role: ToolGroupRole): void;\n}\ninterface MainToolGrouping {\n\treadonly tracker: ToolGroupTracker;\n\treadonly starts: Map<string, number>;\n\tlastMember: Component | undefined;\n\tcarriedBreak: boolean;\n}\nconst mainToolGroupings = new WeakMap<InteractiveModeBase, MainToolGrouping>();\n\nfunction mainToolGrouping(mode: InteractiveModeBase): MainToolGrouping {\n\tlet grouping = mainToolGroupings.get(mode);\n\tif (grouping === undefined) {\n\t\tgrouping = {\n\t\t\ttracker: new ToolGroupTracker({ groupBash: false }),\n\t\t\tstarts: new Map(),\n\t\t\tlastMember: undefined,\n\t\t\tcarriedBreak: false,\n\t\t};\n\t\tmainToolGroupings.set(mode, grouping);\n\t}\n\treturn grouping;\n}\n\nfunction isGroupedToolComponent(component: Component): component is Component & GroupedToolComponent {\n\treturn \"setGroupRole\" in component && typeof component.setGroupRole === \"function\";\n}\n\nfunction hasRowsSinceLastMember(\n\tcontainer: Component & { children: Component[] },\n\tlast: Component,\n\tcurrent: Component,\n): boolean {\n\tfor (let index = container.children.length - 1; index >= 0; index -= 1) {\n\t\tconst child = container.children[index];\n\t\tif (child === last) return false;\n\t\tif (child !== current && !(child instanceof AssistantMessageComponent)) return true;\n\t}\n\treturn true;\n}\n\nexport function breakMainToolGroup(mode: InteractiveModeBase): void {\n\tconst grouping = mainToolGrouping(mode);\n\tgrouping.tracker.break();\n\tgrouping.lastMember = undefined;\n\tgrouping.carriedBreak = false;\n}\n\nfunction resetMainToolGroup(mode: InteractiveModeBase): void {\n\tconst grouping = mainToolGrouping(mode);\n\tgrouping.tracker.reset();\n\tgrouping.lastMember = undefined;\n\tgrouping.carriedBreak = false;\n}\n\nexport function endMainToolTurn(mode: InteractiveModeBase): void {\n\tresetMainToolGroup(mode);\n\tmainToolGrouping(mode).starts.clear();\n}\n\nexport function mainToolCallBreaks(mode: InteractiveModeBase, message: AssistantMessage): ReadonlySet<string> {\n\treturn assistantCallBreaks(message.content, mainToolGrouping(mode).carriedBreak).breakBefore;\n}\n\nexport function endMainAssistantMessage(mode: InteractiveModeBase, message: AssistantMessage): void {\n\tconst grouping = mainToolGrouping(mode);\n\tgrouping.carriedBreak = assistantCallBreaks(message.content, grouping.carriedBreak).trailing;\n}\n\nexport function trackMainToolComponent(\n\tmode: InteractiveModeBase,\n\ttoolCallId: string,\n\ttoolName: string,\n\tcomponent: Component & GroupedToolComponent,\n\tbreakBefore = false,\n): void {\n\tconst grouping = mainToolGrouping(mode);\n\tif (\n\t\tbreakBefore ||\n\t\t(grouping.lastMember !== undefined && hasRowsSinceLastMember(mode.chatContainer, grouping.lastMember, component))\n\t)\n\t\tgrouping.tracker.break();\n\tgrouping.tracker.append(toolCallId, toolName, \"pending\", (role) => component.setGroupRole(role));\n\tgrouping.lastMember = component;\n}\n\nexport function settleMainTool(mode: InteractiveModeBase, toolCallId: string, state: ToolGroupMemberState): void {\n\tconst grouping = mainToolGrouping(mode);\n\tgrouping.tracker.settle(toolCallId, state);\n\tif (state !== \"pending\") grouping.starts.delete(toolCallId);\n}\n\nexport function observeMainToolStart(mode: InteractiveModeBase, toolCallId: string): number {\n\tconst starts = mainToolGrouping(mode).starts;\n\tconst startedAt = starts.get(toolCallId) ?? Date.now();\n\tstarts.set(toolCallId, startedAt);\n\treturn startedAt;\n}\n\nfunction renderGroupedChatEntries(\n\tmode: InteractiveModeBase,\n\tentries: readonly ChatMessageEntry[],\n\tonEntry: (entry: ChatMessageEntry, component: Component) => void,\n): void {\n\tconst grouping = mainToolGrouping(mode);\n\tfor (const entry of entries) {\n\t\tif (entry.kind === \"tool\" && entry.isPartial !== false) {\n\t\t\tconst startedAt = grouping.starts.get(entry.toolCallId);\n\t\t\tif (startedAt !== undefined) {\n\t\t\t\tentry.executionStarted = true;\n\t\t\t\tentry.startedAt = startedAt;\n\t\t\t\tentry.argsComplete = true;\n\t\t\t}\n\t\t}\n\t\tif (entry.kind === \"assistant\")\n\t\t\tgrouping.carriedBreak = assistantCallBreaks(entry.message.content, grouping.carriedBreak).trailing;\n\t\telse if (entry.kind !== \"tool\") grouping.carriedBreak = false;\n\t\tconst component = mode.addRenderedChatEntry(entry);\n\t\tif (entry.kind === \"tool\" && isGroupedToolComponent(component)) {\n\t\t\tgrouping.tracker.bind(entry.toolCallId, (role) => {\n\t\t\t\tentry.groupRole = role;\n\t\t\t\tcomponent.setGroupRole(role);\n\t\t\t});\n\t\t\tgrouping.lastMember = component;\n\t\t}\n\t\tonEntry(entry, component);\n\t}\n}\n\nInteractiveModeBase.prototype.renderDeferredUserInput = function (this: InteractiveModeBase, text: string): void {\n\tthis.deferredRenderedUserInputs.push(text);\n\tconst startIndex = this.chatContainer.children.length;\n\tthis.addMessageToChat({ role: \"user\", content: text } as AgentMessage);\n\tconst renderedComponents = this.chatContainer.children.slice(startIndex);\n\tconst epoch = (this.ui as AltScreenMessageCounterHost).newMessages?.epoch;\n\tif (epoch !== undefined) echoReadEpochs.set(renderedComponents, epoch);\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text) ?? [];\n\ttrackedComponents.push(renderedComponents);\n\tthis.deferredRenderedUserInputComponents.set(text, trackedComponents);\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.consumeDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): boolean {\n\tconst index = this.deferredRenderedUserInputs.indexOf(text);\n\tif (index === -1) return false;\n\tthis.deferredRenderedUserInputs.splice(index, 1);\n\tif (this.startedDeferredUserInput === text) this.startedDeferredUserInput = undefined;\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n\ttrackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tthis.deferredRenderedUserInputComponents.delete(text);\n\t}\n\treturn true;\n};\n\nfunction forgetDeferredEcho(mode: InteractiveModeBase, text: string): Component[] | undefined {\n\tconst index = mode.deferredRenderedUserInputs.indexOf(text);\n\tif (index !== -1) {\n\t\tmode.deferredRenderedUserInputs.splice(index, 1);\n\t\tif (mode.startedDeferredUserInput === text) mode.startedDeferredUserInput = undefined;\n\t}\n\tconst trackedComponents = mode.deferredRenderedUserInputComponents.get(text);\n\tconst components = trackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tmode.deferredRenderedUserInputComponents.delete(text);\n\t}\n\treturn components;\n}\n\nfunction takeDeferredEchoes(mode: InteractiveModeBase): Array<{ text: string; epoch: number | undefined }> {\n\tconst occurrences = new Map<string, number>();\n\tconst echoes = mode.deferredRenderedUserInputs.map((text) => {\n\t\tconst occurrence = occurrences.get(text) ?? 0;\n\t\toccurrences.set(text, occurrence + 1);\n\t\tconst components = mode.deferredRenderedUserInputComponents.get(text)?.[occurrence];\n\t\treturn { text, epoch: components ? echoReadEpochs.get(components) : undefined };\n\t});\n\tmode.deferredRenderedUserInputs = [];\n\tmode.deferredRenderedUserInputComponents.clear();\n\treturn echoes;\n}\n\nfunction restoreDeferredEchoes(\n\tmode: InteractiveModeBase,\n\techoes: ReadonlyArray<{ text: string; epoch: number | undefined }>,\n): void {\n\tfor (const { text, epoch } of echoes) {\n\t\tmode.renderDeferredUserInput(text);\n\t\tconst tracked = mode.deferredRenderedUserInputComponents.get(text);\n\t\tconst components = tracked?.[tracked.length - 1];\n\t\tif (components && epoch !== undefined) echoReadEpochs.set(components, epoch);\n\t}\n}\n\nInteractiveModeBase.prototype.discardDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): void {\n\tconst componentsToRemove = forgetDeferredEcho(this, text);\n\tif (!componentsToRemove) return;\n\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\tconst following = renderer.isFollowingOutput !== false;\n\tconst countedBefore = countChatMessages(this.chatContainer);\n\tif (!following) renderer.newMessages?.observe(false, countedBefore);\n\tfor (const component of componentsToRemove) this.chatContainer.removeChild(component);\n\tconst counted = countChatMessages(this.chatContainer);\n\tconst counter = renderer.newMessages;\n\tif (!following && counter && echoReadEpochs.get(componentsToRemove) === counter.epoch) {\n\t\tcounter.retract(countedBefore - counted);\n\t}\n\tcounter?.observe(following, counted);\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\n/**\n * The session started a run for a submission this host echoed as `text`. The run begins with the submission's message,\n * as sent: an `input` hook may have rewritten it, so its `message_start` need not match the echo (#4277). An engine's\n * answer can reach the host after that `message_start`, which the session then showed itself (#4272): if it showed any\n * message of its own since `shownBefore`, the echo goes. Otherwise the session's next message that matches no echo\n * takes the echo's place. A run starts only after the one before it showed its message, so an earlier run still\n * waiting here never got to show it, and its echo stays as it is.\n */\nInteractiveModeBase.prototype.expectStartedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n\tshownBefore: number,\n): void {\n\tif (!this.deferredRenderedUserInputs.includes(text)) return;\n\tif (this.userMessagesShownBySession !== shownBefore) this.discardDeferredRenderedUserInput(text);\n\telse this.startedDeferredUserInput = text;\n};\n\n/** Show a user message from the session: in place of its echo, or of the echo of the run it started, or as new. */\nInteractiveModeBase.prototype.showSessionUserMessage = function (this: InteractiveModeBase, message: Message): void {\n\tconst text = this.getUserMessageText(message);\n\tconst echo = this.deferredRenderedUserInputComponents?.get(text)?.[0];\n\tif (this.consumeDeferredRenderedUserInput(text)) {\n\t\t// The echo stays as the session's message: its rows are that message's rows.\n\t\tfor (const component of echo ?? []) noteRowSource(component, { message, part: 0 });\n\t\treturn;\n\t}\n\tconst started = this.startedDeferredUserInput;\n\tif (started !== undefined) {\n\t\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\t\tconst following = renderer.isFollowingOutput !== false;\n\t\tconst countedBefore = countChatMessages(this.chatContainer);\n\t\trenderer.newMessages?.observe(following, countedBefore);\n\t\tconst echo = forgetDeferredEcho(this, started);\n\t\tappendNewChildrenBeforeAttachedChild(this.chatContainer, echo?.[0], () => this.addMessageToChat(message));\n\t\tfor (const component of echo ?? []) this.chatContainer.removeChild(component);\n\t\tconst counted = countChatMessages(this.chatContainer);\n\t\tconst counter = renderer.newMessages;\n\t\tif (!following && counter && echo && echoReadEpochs.get(echo) === counter.epoch) {\n\t\t\tcounter.retract(countedBefore - counted);\n\t\t}\n\t\tcounter?.replaced(counted);\n\t\tthis.updatePendingMessagesDisplay();\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\tthis.userMessagesShownBySession += 1;\n\tthis.addMessageToChat(message);\n};\n\nInteractiveModeBase.prototype.getMarkdownTransformers = function (this: InteractiveModeBase) {\n\tconst mode = this.settingsManager.getMermaidRenderingMode();\n\tconst withheld =\n\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime &&\n\t\tthis.runtimeHost.isProjectTrustPending() &&\n\t\t!this.settingsManager.isProjectTrusted();\n\tif (this.mermaidMarkdownTransformerMode !== mode || withheld !== (this.mermaidTransformerWithheldProject === true)) {\n\t\tthis.mermaidMarkdownTransformerMode = mode;\n\t\tthis.mermaidTransformerWithheldProject = withheld;\n\t\tconst edit = this.mermaidUserEdit;\n\t\tthis.mermaidMarkdownTransformer = createMermaidMarkdownTransformer({\n\t\t\t// Invalidating a message for a redraw isn't permission to replace a mounted diagram with source text.\n\t\t\t// The user's own subsequent rendering choice, unlike approval, still applies to visible messages.\n\t\t\tgetMode: () =>\n\t\t\t\twithheld && edit === this.mermaidUserEdit ? mode : this.settingsManager.getMermaidRenderingMode(),\n\t\t\ttheme,\n\t\t});\n\t}\n\tconst extensionTransformers =\n\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t? []\n\t\t\t: this.session.extensionRunner.getMarkdownTransformers();\n\treturn [this.mermaidMarkdownTransformer, ...extensionTransformers];\n};\n\n/**\n * Markdown of a changelog that runs the Markdown transformers registered for the `changelog` type. Transformers are\n * looked up on each render, so a notice shown before deferred extensions load uses them once it is invalidated.\n */\nInteractiveModeBase.prototype.createChangelogMarkdown = function (\n\tthis: InteractiveModeBase,\n\tmarkdown: string,\n\tpaddingX: number,\n\tpaddingY: number,\n): Markdown {\n\treturn new Markdown(markdown, paddingX, paddingY, this.getMarkdownThemeWithSettings(), undefined, {\n\t\ttransform: (text, width) =>\n\t\t\tcreateMarkdownTransform(\"changelog\", () => false, this.getMarkdownTransformers())(text, width),\n\t});\n};\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function (\n\tthis: InteractiveModeBase,\n): ChatMessageRenderOptions {\n\tconst isolated = this.runtimeHost instanceof IsolatedInteractiveRuntime;\n\treturn {\n\t\tui: this.ui,\n\t\tcwd: this.sessionManager.getCwd(),\n\t\tmarkdownTheme: this.getMarkdownThemeWithSettings(),\n\t\thideThinkingBlock: this.hideThinkingBlock,\n\t\thiddenThinkingLabel: this.hiddenThinkingLabel,\n\t\ttoolOutputExpanded: this.toolOutputExpanded,\n\t\tshowImages: this.settingsManager.getShowImages(),\n\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\toutputPad: this.outputPad,\n\t\trenderLatex: this.settingsManager.getLatexRenderingEnabled(),\n\t\tmarkdownTransformers: this.getMarkdownTransformers(),\n\t\tgetToolDefinition: isolated ? undefined : (toolName) => this.getRegisteredToolDefinition(toolName),\n\t\tgetTaskRecord: isolated ? undefined : (taskId) => getOwnerTaskStore(this.session)?.getTask(taskId),\n\t\thasTaskTranscript: isolated\n\t\t\t? undefined\n\t\t\t: (taskId) => {\n\t\t\t\t\tconst lease = getOwnerTaskStore(this.session)?.resolveTask(taskId);\n\t\t\t\t\treturn lease?.ok ? taskTranscriptSource(lease.value).ok : false;\n\t\t\t\t},\n\t\tloadTaskTranscript: isolated\n\t\t\t? undefined\n\t\t\t: async (taskId, options) => {\n\t\t\t\t\tconst lease = getOwnerTaskStore(this.session)?.resolveTask(taskId);\n\t\t\t\t\treturn lease?.ok ? readTaskCompletionHistory(lease.value, options?.signal) : undefined;\n\t\t\t\t},\n\t\tgetCustomMessageRenderer: isolated\n\t\t\t? undefined\n\t\t\t: (customType) => this.session.extensionRunner.getMessageRenderer(customType),\n\t\tcreateToolComponent: isolated\n\t\t\t? (entry, context) => {\n\t\t\t\t\tconst component = new RemoteToolExecutionComponent(\n\t\t\t\t\t\tentry.toolName,\n\t\t\t\t\t\tentry.toolCallId,\n\t\t\t\t\t\tentry.args,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tshowImages: context?.showImages ?? this.settingsManager.getShowImages(),\n\t\t\t\t\t\t\timageWidthCells: context?.imageWidthCells ?? this.settingsManager.getImageWidthCells(),\n\t\t\t\t\t\t\toutputPad: context?.outputPad ?? this.outputPad,\n\t\t\t\t\t\t\trendererTaskId: entry.rendererTaskId,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\tcontext?.requestRender ?? (() => this.ui.requestRender()),\n\t\t\t\t\t);\n\t\t\t\t\tapplyToolEntryState(component, entry, context?.expanded ?? this.toolOutputExpanded);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tcreateCustomMessageComponent: isolated\n\t\t\t? (message, context) => {\n\t\t\t\t\tconst component = new RemoteCustomMessageComponent(\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\tcontext?.requestRender ?? (() => this.ui.requestRender()),\n\t\t\t\t\t\tcontext?.outputPad ?? this.outputPad,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(context?.expanded ?? this.toolOutputExpanded);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n};\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function (\n\tthis: InteractiveModeBase,\n\tentry: ChatMessageEntry,\n): Component {\n\tconst component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n\tcarryRowSource(entry, component);\n\tif (entry.kind !== \"system\" && !(entry.kind === \"custom\" && isVerbatimCompactionMessage(entry.message))) {\n\t\tmessageComponents.add(component);\n\t}\n\taddChatTranscriptEntry(this.chatContainer, component, entry.role);\n\treturn component;\n};\n\nInteractiveModeBase.prototype.addCompactionBoundaryToChat = function (\n\tthis: InteractiveModeBase,\n\tresult: VerbatimCompactionResult,\n): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tconst component = new CompactionBoundaryMessageComponent(result, this.outputPad);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tthis.chatContainer.addChild(component);\n};\n\nInteractiveModeBase.prototype.addCompactionCostNotice = function (\n\tthis: InteractiveModeBase,\n\tkind: \"compaction\" | \"branch_summary\",\n\tusage: Usage,\n): void {\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\tconst tokens = usage.input + usage.output + usage.cacheRead + usage.cacheWrite;\n\tconst cost = usage.cost.total >= 0.01 ? ` (~$${usage.cost.total.toFixed(2)})` : \"\";\n\tconst label = kind === \"compaction\" ? \"Compaction\" : \"Branch summary\";\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `${label}: ${tokens.toLocaleString()} tokens billed${cost}`), 1, 0),\n\t);\n};\n\nInteractiveModeBase.prototype.addCustomEntryToChat = function (this: InteractiveModeBase, entry: CustomEntry): void {\n\tconst renderer = this.session.extensionRunner.getEntryRenderer(entry.customType);\n\tif (!renderer) return;\n\tconst runner = this.session.extensionRunner;\n\tconst component = new CustomEntryComponent(\n\t\tentry,\n\t\t(...args) => runner.renderEntry(entry.customType, ...args),\n\t\tthis.outputPad,\n\t);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tif (!component.hasContent()) return;\n\tmessageComponents.add(component);\n\tconst seq = this.sessionManager.getEntrySeq?.(entry.id);\n\tif (seq !== undefined) noteSavedSeq(entry, seq);\n\tnoteRowSource(component, { message: entry, part: 0 });\n\tconst streamingIndex = this.streamingComponent ? this.chatContainer.children.indexOf(this.streamingComponent) : -1;\n\tif (streamingIndex >= 0) this.chatContainer.children.splice(streamingIndex, 0, component);\n\telse this.chatContainer.addChild(component);\n};\n\ntype AltScreenMessageCounterHost = TUI & {\n\tisFollowingOutput?: boolean;\n\tnewMessages?: NewMessageCounter;\n};\n\nInteractiveModeBase.prototype.addMessageToChat = function (\n\tthis: InteractiveModeBase,\n\tmessage: AgentMessage,\n\toptions?: { populateHistory?: boolean },\n): void {\n\tconst markdownTransformers = this.getMarkdownTransformers();\n\tswitch (message.role) {\n\t\tcase \"bashExecution\": {\n\t\t\tconst component = new BashExecutionComponent(\n\t\t\t\tmessage.command,\n\t\t\t\tthis.ui,\n\t\t\t\tmessage.excludeFromContext,\n\t\t\t\tthis.outputPad,\n\t\t\t);\n\t\t\tif (message.output) {\n\t\t\t\tcomponent.appendOutput(message.output);\n\t\t\t}\n\t\t\tcomponent.setComplete(\n\t\t\t\tmessage.exitCode,\n\t\t\t\tmessage.cancelled,\n\t\t\t\tmessage.truncated ? ({ truncated: true } as TruncationResult) : undefined,\n\t\t\t\tmessage.fullOutputPath,\n\t\t\t);\n\t\t\tmessageComponents.add(component);\n\t\t\tnoteRowSource(component, { message, part: 0 });\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"custom\": {\n\t\t\tif (message.display) {\n\t\t\t\tconst component =\n\t\t\t\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t\t\t\t? new RemoteCustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.runtimeHost,\n\t\t\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: new CustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.session.extensionRunner.getMessageRenderer(message.customType),\n\t\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\thasTranscript: (taskId) => {\n\t\t\t\t\t\t\t\t\t\tconst lease = getOwnerTaskStore(this.session)?.resolveTask(taskId);\n\t\t\t\t\t\t\t\t\t\treturn lease?.ok ? taskTranscriptSource(lease.value).ok : false;\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tloadTranscript: async (taskId, options) => {\n\t\t\t\t\t\t\t\t\t\tconst lease = getOwnerTaskStore(this.session)?.resolveTask(taskId);\n\t\t\t\t\t\t\t\t\t\treturn lease?.ok ? readTaskCompletionHistory(lease.value, options?.signal) : undefined;\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tgetToolDefinition: (toolName) => this.getRegisteredToolDefinition(toolName),\n\t\t\t\t\t\t\t\t\tcwd: this.sessionManager.getCwd(),\n\t\t\t\t\t\t\t\t\trequestRender: () => this.ui.requestRender(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\tmessageComponents.add(component);\n\t\t\t\tnoteRowSource(component, { message, part: 0 });\n\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"branchSummary\": {\n\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\tconst component = new BranchSummaryMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t);\n\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\tmessageComponents.add(component);\n\t\t\tnoteRowSource(component, { message, part: 0 });\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"user\": {\n\t\t\tconst textContent = this.getUserMessageText(message);\n\t\t\tif (textContent) {\n\t\t\t\tif (this.chatContainer.children.length > 0) {\n\t\t\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\t\t}\n\t\t\t\tconst skillBlock = parseSkillBlock(textContent);\n\t\t\t\tif (skillBlock) {\n\t\t\t\t\t// Render skill block (collapsible)\n\t\t\t\t\tconst component = new SkillInvocationMessageComponent(\n\t\t\t\t\t\tskillBlock,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tif (!skillBlock.userMessage) messageComponents.add(component);\n\t\t\t\t\tnoteRowSource(component, { message, part: 0 });\n\t\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t\t\t// Render user message separately if present\n\t\t\t\t\tif (skillBlock.userMessage) {\n\t\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\t\tskillBlock.userMessage,\n\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tmessageComponents.add(userComponent);\n\t\t\t\t\t\tnoteRowSource(userComponent, { message, part: 0 });\n\t\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\ttextContent,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t);\n\t\t\t\t\tmessageComponents.add(userComponent);\n\t\t\t\t\tnoteRowSource(userComponent, { message, part: 0 });\n\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t}\n\t\t\t\tif (options?.populateHistory) {\n\t\t\t\t\taddMainPromptHistory(this.editor, textContent);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"assistant\": {\n\t\t\tconst assistantComponent = new AssistantMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.hideThinkingBlock,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.hiddenThinkingLabel,\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t\tfalse,\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t);\n\t\t\tmessageComponents.add(assistantComponent);\n\t\t\tnoteRowSource(assistantComponent, { message, part: 0 });\n\t\t\tthis.chatContainer.addChild(assistantComponent);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"toolResult\": {\n\t\t\t// Tool results are rendered inline with tool calls, handled separately\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tbreak;\n\t}\n};\n\nInteractiveModeBase.prototype.renderSessionContext = function (\n\tthis: InteractiveModeBase,\n\tsessionContext: SessionContext,\n\toptions: { updateFooter?: boolean; populateHistory?: boolean } = {},\n): void {\n\tthis.pendingTools.clear();\n\tconst pendingEchoes = takeDeferredEchoes(this);\n\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\n\tconst grouping = mainToolGrouping(this);\n\tresetMainToolGroup(this);\n\tconst entries = chatEntriesFromAgentMessages(sessionContext.messages, undefined, { tracker: grouping.tracker });\n\trenderGroupedChatEntries(this, entries, (entry, component) => {\n\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t}\n\t\tif (options.populateHistory && entry.kind === \"user\") {\n\t\t\taddMainPromptHistory(this.editor, entry.text);\n\t\t}\n\t});\n\n\trestoreDeferredEchoes(this, pendingEchoes);\n\n\tthis.ui.requestRender();\n};\n\ninterface ReplyNotices {\n\tmessage: AssistantMessage;\n\tpreviousReply: AssistantMessage | undefined;\n\tpreviousRequest: PreviousRequest | undefined;\n\tmodels: ModelPriceSource;\n\tsummarizedParent?: string;\n\t/** On a saved page: the dropped thinking blocks of the reply read before the page, unknown when none was. */\n\tearlier?: { readonly drops: number | undefined };\n\trepeated?: {\n\t\toccurrences: ReplyNotices[];\n\t\tresolved?: true;\n\t\towner?: ReplyNotices;\n\t\tmiss?: ReturnType<typeof cacheMissAfter>;\n\t};\n}\n\nfunction missForOccurrence(notes: ReplyNotices): ReturnType<typeof cacheMissAfter> {\n\tconst group = notes.repeated;\n\tif (!group) return cacheMissAfter(notes.previousRequest, notes.message, notes.models);\n\t// The cache statistics fold records the last miss for each saved object. Retain its exact occurrence,\n\t// even when a later occurrence of that same object wasn't a miss. Distinct equal objects remain distinct.\n\tif (!group.resolved) {\n\t\tgroup.resolved = true;\n\t\tfor (let i = group.occurrences.length - 1; i >= 0; i--) {\n\t\t\tconst candidate = group.occurrences[i]!;\n\t\t\tconst miss = cacheMissAfter(candidate.previousRequest, candidate.message, candidate.models);\n\t\t\tif (miss) {\n\t\t\t\tgroup.owner = candidate;\n\t\t\t\tgroup.miss = miss;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn group.owner === notes ? group.miss : undefined;\n}\n\nfunction precedingDropCount(mode: InteractiveModeBase, notes: ReplyNotices): number | undefined {\n\tif (notes.previousReply) return countDroppedThinkingBlocks(notes.previousReply);\n\tif (notes.earlier) return notes.earlier.drops;\n\t// The provider's cumulative count does not start over at a summary. Only the first visible reply can\n\t// need an omitted predecessor. Do not fetch old message bodies or guess when a tail-only reader lacks it.\n\tlet id = notes.summarizedParent;\n\tif (id === undefined) return 0;\n\tconst seen = new Set<string>();\n\twhile (!seen.has(id)) {\n\t\tseen.add(id);\n\t\tconst entry = mode.sessionManager?.getEntry(id);\n\t\tif (!entry) return undefined;\n\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\")\n\t\t\treturn countDroppedThinkingBlocks(entry.message);\n\t\tif (!entry.parentId) return 0;\n\t\tid = entry.parentId;\n\t}\n\treturn undefined;\n}\n\nfunction paintReplyNotices(mode: InteractiveModeBase, notes: ReplyNotices): void {\n\tconst { message } = notes;\n\tif (message.stopReason !== \"aborted\" && message.stopReason !== \"error\") {\n\t\tconst count = countDroppedThinkingBlocks(message);\n\t\tif (count > 0) {\n\t\t\tconst previous = precedingDropCount(mode, notes);\n\t\t\tif (previous !== undefined) addThinkingDrop(mode, count, previous);\n\t\t}\n\t}\n\tconst miss = missForOccurrence(notes);\n\tif (miss) mode.chatContainer.addChild(new Text(theme.fg(\"warning\", formatCacheMissNotice(miss)), 1, 0));\n}\n\ntype TranscriptStep =\n\t| { readonly kind: \"entry\"; readonly entry: ChatMessageEntry; readonly notices?: ReplyNotices }\n\t| { readonly kind: \"custom\"; readonly entry: CustomEntry }\n\t| {\n\t\t\treadonly kind: \"cost\";\n\t\t\treadonly type: \"compaction\" | \"branch_summary\";\n\t\t\treadonly usage: Usage;\n\t\t\t/** The saved entry whose cost this is, on a saved page. */\n\t\t\treadonly seq?: number;\n\t };\n\nconst TAIL_STEPS = 128;\nconst HISTORY_SLICE_BUDGET_MS = 8;\nconst HISTORY_SLICE_STEPS = 24;\n\n/**\n * Where a saved page's replies start from, as the whole chat reaches them: the request and the dropped thinking of\n * the entries read right before the page. Without a reply among them or the start of the branch, the count is unknown.\n */\nfunction earlierReplies(earlier: SavedPageEarlier | undefined): {\n\trequest: PreviousRequest | undefined;\n\tdrops: number | undefined;\n} {\n\tlet request: PreviousRequest | undefined;\n\tlet drops = earlier?.root ? 0 : undefined;\n\tfor (const entry of earlier?.entries ?? []) {\n\t\trequest = advanceCacheHistory(request, entry);\n\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\")\n\t\t\tdrops = countDroppedThinkingBlocks(entry.message);\n\t}\n\treturn { request, drops };\n}\n\nfunction planTranscript(\n\tmode: InteractiveModeBase,\n\tsessionEntries: SessionEntry[],\n\toptions: {\n\t\tpopulateHistory?: boolean;\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\tsaved?: { seqs: Map<SessionEntry, number>; owners: WeakMap<object, string>; earlier?: SavedPageEarlier };\n\t},\n\tlayout?: ChatReaderLayout,\n): TranscriptStep[] {\n\tconst steps: TranscriptStep[] = [];\n\tconst grouping: MainToolGrouping = options.saved\n\t\t? {\n\t\t\t\ttracker: new ToolGroupTracker({ groupBash: false }),\n\t\t\t\tstarts: new Map(),\n\t\t\t\tlastMember: undefined,\n\t\t\t\tcarriedBreak: false,\n\t\t\t}\n\t\t: mainToolGrouping(mode);\n\tif (!options.saved) resetMainToolGroup(mode);\n\tlet messageBuffer: AgentMessage[] = [];\n\tconst sources = layout ? ([] as string[]) : undefined;\n\tconst messageMeta = new Map<AgentMessage, PersistedMessageMeta>();\n\tconst messageSeq = options.saved ? new Map<AgentMessage, number>() : undefined;\n\tconst models = mode.settingsManager.getShowCacheMissNotices()\n\t\t? createCacheMissModelSource(mode.session.modelRuntime)\n\t\t: undefined;\n\t// A saved page goes on from the entries read right before it, as the whole chat goes on from them.\n\tconst earlier = options.saved && models ? earlierReplies(options.saved.earlier) : undefined;\n\tlet previousRequest: PreviousRequest | undefined = earlier?.request;\n\tlet previousReply: AssistantMessage | undefined;\n\tconst replyGroups: ReplyNotices[] = [];\n\tlet firstMessage = true;\n\tconst firstOccurrence = models && new WeakMap<AssistantMessage, ReplyNotices>();\n\tconst boundary = sessionEntries[0];\n\tconst firstParent = sessionEntries[1]?.parentId;\n\tconst summarizedParent =\n\t\tboundary?.type === \"compaction\"\n\t\t\t? ((firstParent === boundary.id ? boundary.parentId : firstParent) ?? undefined)\n\t\t\t: undefined;\n\tconst flushMessages = (): void => {\n\t\tif (options.suppressCompactionBoundary && firstMessage) {\n\t\t\t// A boundary replays after the system prompt it recorded, so the boundary is the first non-system message.\n\t\t\tconst boundaryIndex = messageBuffer.findIndex((message) => message.role !== \"system\");\n\t\t\tif (isSynthesizedCompactionBoundary(messageBuffer[boundaryIndex], options.suppressCompactionBoundary)) {\n\t\t\t\tmessageBuffer = messageBuffer.filter((_, index) => index !== boundaryIndex);\n\t\t\t\tsources?.splice(boundaryIndex, 1);\n\t\t\t}\n\t\t}\n\t\tfirstMessage = false;\n\t\tif (options.saved) grouping.tracker.break();\n\t\telse breakMainToolGroup(mode);\n\t\tconst saved = options.saved;\n\t\t// Pair by occurrence, not by message identity: an SDK caller can append the very same object twice.\n\t\tlet occurrence = 0;\n\t\tconst groups = replyGroups.length ? new Map<ChatMessageEntry, ReplyNotices>() : undefined;\n\t\tlet source = 0;\n\t\tconst entries = chatEntriesFromAgentMessages(messageBuffer, messageMeta, {\n\t\t\ttracker: grouping.tracker,\n\t\t\t...(saved && messageSeq\n\t\t\t\t? {\n\t\t\t\t\t\tonSourceRow: (e: ChatMessageEntry, message: AgentMessage, block: number) =>\n\t\t\t\t\t\t\tsaved.owners.set(e, `${messageSeq.get(message)}:${block}`),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\tonMessageGroup: layout && sources ? (row) => layout.bind(sources[source++]!, row) : undefined,\n\t\t\tonAssistantGroup: groups && ((lastRow) => groups.set(lastRow, replyGroups[occurrence++]!)),\n\t\t});\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.kind === \"tool\" && entry.isPartial !== false) {\n\t\t\t\tconst startedAt = grouping.starts.get(entry.toolCallId);\n\t\t\t\tif (startedAt !== undefined) {\n\t\t\t\t\tentry.executionStarted = true;\n\t\t\t\t\tentry.startedAt = startedAt;\n\t\t\t\t\tentry.argsComplete = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (entry.kind === \"assistant\")\n\t\t\t\tgrouping.carriedBreak = assistantCallBreaks(entry.message.content, grouping.carriedBreak).trailing;\n\t\t\telse if (entry.kind !== \"tool\") grouping.carriedBreak = false;\n\t\t\tsteps.push({ kind: \"entry\", entry, notices: groups?.get(entry) });\n\t\t\tif (options.populateHistory && entry.kind === \"user\") addMainPromptHistory(mode.editor, entry.text);\n\t\t}\n\t\treplyGroups.length = 0;\n\t\tif (sources) sources.length = 0;\n\t\tmessageBuffer = [];\n\t};\n\tconst headers = new ReopenedCompletionHeaders(\n\t\t() => ({\n\t\t\tentries: mode.sessionManager.getBranch(),\n\t\t\trecovery: mode.sessionManager.getSessionRecoveryState(),\n\t\t}),\n\t\tisProxy,\n\t);\n\tfor (const entry of sessionEntries) {\n\t\tif (entry.type === \"custom\") {\n\t\t\t// An unrendered record between a tool call and its result must not split them into two cards.\n\t\t\tif (!mode.session.extensionRunner.getEntryRenderer(entry.customType)) continue;\n\t\t\tconst seq = options.saved ? options.saved.seqs.get(entry) : mode.sessionManager?.getEntrySeq?.(entry.id);\n\t\t\tif (seq !== undefined) noteSavedSeq(entry, seq);\n\t\t\tflushMessages();\n\t\t\tif (options.saved) options.saved.owners.set(entry, `${options.saved.seqs.get(entry)}:entry`);\n\t\t\tsteps.push({ kind: \"custom\", entry });\n\t\t\tlayout?.bind(entry.id, entry);\n\t\t} else {\n\t\t\tconst messages = sessionEntryToDisplayMessages(entry, headers);\n\t\t\tconst seq = options.saved ? options.saved.seqs.get(entry) : mode.sessionManager?.getEntrySeq?.(entry.id);\n\t\t\tfor (const message of messages) {\n\t\t\t\tsources?.push(entry.id);\n\t\t\t\tmessageMeta.set(message, { id: entry.id, timestamp: entry.timestamp });\n\t\t\t\tif (seq !== undefined) noteSavedSeq(message, seq);\n\t\t\t\tif (options.saved) messageSeq?.set(message, options.saved.seqs.get(entry)!);\n\t\t\t\tif (models && firstOccurrence && message.role === \"assistant\") {\n\t\t\t\t\tconst notes: ReplyNotices = {\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tpreviousReply,\n\t\t\t\t\t\tsummarizedParent,\n\t\t\t\t\t\tpreviousRequest,\n\t\t\t\t\t\tmodels,\n\t\t\t\t\t\t...(earlier ? { earlier } : {}),\n\t\t\t\t\t};\n\t\t\t\t\tconst saved = entry.type === \"message\" && entry.message.role === \"assistant\" ? entry.message : message;\n\t\t\t\t\tconst first = firstOccurrence.get(saved);\n\t\t\t\t\tif (first) {\n\t\t\t\t\t\tnotes.repeated = first.repeated ??= { occurrences: [first] };\n\t\t\t\t\t\tnotes.repeated.occurrences.push(notes);\n\t\t\t\t\t} else firstOccurrence.set(saved, notes);\n\t\t\t\t\treplyGroups.push(notes);\n\t\t\t\t\tpreviousReply = message;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (models) previousRequest = advanceCacheHistory(previousRequest, entry);\n\t\t\tmessageBuffer.push(...messages);\n\t\t\tif ((entry.type === \"compaction\" || entry.type === \"branch_summary\") && entry.usage) {\n\t\t\t\tflushMessages();\n\t\t\t\tconst suppressedLiveBoundary =\n\t\t\t\t\tentry.type === \"compaction\" &&\n\t\t\t\t\toptions.suppressCompactionBoundary !== undefined &&\n\t\t\t\t\tentry.summary === options.suppressCompactionBoundary.compactedText &&\n\t\t\t\t\tentry.tokensBefore === options.suppressCompactionBoundary.tokensBefore;\n\t\t\t\tconst seq = options.saved?.seqs.get(entry);\n\t\t\t\tif (!suppressedLiveBoundary) {\n\t\t\t\t\tconst cost: TranscriptStep = {\n\t\t\t\t\t\tkind: \"cost\",\n\t\t\t\t\t\ttype: entry.type,\n\t\t\t\t\t\tusage: entry.usage,\n\t\t\t\t\t\t...(seq === undefined ? {} : { seq }),\n\t\t\t\t\t};\n\t\t\t\t\tsteps.push(cost);\n\t\t\t\t\tlayout?.extendGroup(entry.id, cost);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tflushMessages();\n\treturn steps;\n}\n\n/** The rows a parked reader sees of entries a new context keeps, while that context is being drawn. */\nconst adoptions = new WeakMap<InteractiveModeBase, ParkedViewport & { inserted: boolean }>();\n\nfunction stepKey(step: TranscriptStep): string | undefined {\n\tif (step.kind === \"entry\") return savedRowKey(step.entry);\n\t// A custom entry draws one row, from the entry itself.\n\tconst seq = step.kind === \"custom\" ? savedSeqOf(step.entry) : undefined;\n\treturn seq === undefined ? undefined : `${seq}:0`;\n}\n\n/** A kept entry the reader sees keeps its drawn rows: the first such step puts them all where it belongs. */\nfunction adoptStep(mode: InteractiveModeBase, step: TranscriptStep): Component | undefined {\n\tconst adoption = adoptions.get(mode);\n\tconst key = adoption && stepKey(step);\n\tconst component = key === undefined ? undefined : adoption?.keys.get(key);\n\tif (!adoption || !component) return undefined;\n\tif (!adoption.inserted) {\n\t\tfor (const row of adoption.adopted) mode.chatContainer.addChild(row);\n\t\tadoption.inserted = true;\n\t}\n\treturn component;\n}\n\nfunction addTranscriptStep(mode: InteractiveModeBase, step: TranscriptStep, latest = true, saved = false): void {\n\tconst adopted = saved ? undefined : adoptStep(mode, step);\n\tif (step.kind === \"custom\") {\n\t\tif (!adopted) {\n\t\t\tconst seq = savedSeqOf(step.entry);\n\t\t\tconst kept = saved || seq === undefined ? undefined : storedWidget(mode, `${seq}:entry`);\n\t\t\tif (kept) mode.chatContainer.addChild(kept);\n\t\t\telse mode.addCustomEntryToChat(step.entry);\n\t\t}\n\t\treturn;\n\t}\n\tif (step.kind === \"cost\") {\n\t\tmode.addCompactionCostNotice(step.type, step.usage);\n\t\treturn;\n\t}\n\tconst { entry } = step;\n\tconst kept = saved || adopted ? undefined : storedWidget(mode, widgetKey(entry));\n\tif (kept) addChatTranscriptEntry(mode.chatContainer, kept, entry.role);\n\tconst component = adopted ?? kept ?? mode.addRenderedChatEntry(entry);\n\tif (!saved && entry.kind === \"tool\" && isGroupedToolComponent(component)) {\n\t\tconst grouping = mainToolGrouping(mode);\n\t\tgrouping.tracker.bind(entry.toolCallId, (role) => {\n\t\t\tentry.groupRole = role;\n\t\t\tcomponent.setGroupRole(role);\n\t\t});\n\t\tif (latest) grouping.lastMember = component;\n\t}\n\tif (entry.kind === \"assistant\" && !adopted) addServiceTierWarnings(mode, entry.message);\n\tif (step.notices && !adopted) paintReplyNotices(mode, step.notices);\n\tif (!saved && entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\tmode.pendingTools.set(entry.toolCallId, component);\n\t}\n}\n\n/** A cost notice follows every row of its saved entry. */\nconst COST_BLOCK = Number.MAX_SAFE_INTEGER;\n\n/** The saved entry and sub-block of a saved row key (`seq:block`, `seq:entry` or `seq:cost`). */\nfunction savedLeaf(key: string): { seq: number; block: number } {\n\tconst [seq, block] = key.split(\":\");\n\treturn { seq: Number(seq), block: block === \"entry\" ? 0 : block === \"cost\" ? COST_BLOCK : Number(block) };\n}\n\n/**\n * Render an archived page on its own. Never register historical tools as pending in the live turn. When a later page\n * follows (`adjacent.newer`), calls the page ends with wait for it: their results start that page.\n *\n * With `copy`, the rows are drawn for a copy, not mounted: each row's saved position is noted there instead of\n * keeping its renderer, a kept instance is reused as it is, the page joins no mounted page, and the reads its edge\n * cards need are left in `copy.settled`. Mounted, a card whose call and result fall on different pages is marked\n * provisional: what it shows depends on the pages mounted, so a selection draws its entry again for a copy.\n */\nfunction savedChatComponents(\n\tmode: InteractiveModeBase,\n\tentries: SessionEntry[],\n\tseqs: number[],\n\texceptions: SavedRendererInstances,\n\tadjacent: { readonly older?: string; readonly newer?: string } | undefined,\n\tcopy?: SavedCopyDraw,\n\trecords?: SavedPageRecords,\n\tearlier?: SavedPageEarlier,\n): Component[] {\n\tconst scratch = new Container();\n\t// Each page draws after earlier rows, as the whole transcript does: its first message keeps its spacing.\n\tscratch.addChild(new Spacer(0));\n\tconst chat = mode.chatContainer;\n\ttry {\n\t\tmode.chatContainer = scratch;\n\t\tconst saved = {\n\t\t\tseqs: new Map(entries.map((e, i) => [e, seqs[i]!])),\n\t\t\towners: new WeakMap<object, string>(),\n\t\t\tearlier,\n\t\t};\n\t\t// The page's saved lines go where the whole chat draws them: after the last row of their entry's group.\n\t\tconst layout = records ? new ChatReaderLayout(entries, scratch, { root: records.root }) : undefined;\n\t\tconst steps = planTranscript(mode, entries, { saved }, layout);\n\t\t/** Each drawn row's saved leaf, for the saved lines drawn after it. */\n\t\tconst leaves = new Map<Component, HistoryLeaf>();\n\t\tconst held = new Set(\n\t\t\tadjacent?.newer || copy?.edges.newer\n\t\t\t\t? callsAwaitingLaterResults(steps.flatMap((step) => (step.kind === \"entry\" ? [step.entry] : [])))\n\t\t\t\t: [],\n\t\t);\n\t\tconst calls = new SavedPageCallsBuilder(mode, chat, seqs, exceptions, copy !== undefined);\n\t\tconst mark = (components: readonly Component[], key: string, provisional: boolean) => {\n\t\t\tconst { seq, block } = savedLeaf(key);\n\t\t\tfor (let part = 0; part < components.length; part++)\n\t\t\t\tleaves.set(components[part]!, { source: exceptions.source, seq, block, part });\n\t\t\tfor (let part = 0; part < components.length; part++)\n\t\t\t\tif (copy) copy.positions.set(components[part]!, { source: exceptions.source, seq, block, part });\n\t\t\t\telse\n\t\t\t\t\tWindowedContainer.markHistoryComponent(\n\t\t\t\t\t\tcomponents[part]!,\n\t\t\t\t\t\texceptions.source,\n\t\t\t\t\t\tseq,\n\t\t\t\t\t\tblock,\n\t\t\t\t\t\tpart,\n\t\t\t\t\t\tprovisional,\n\t\t\t\t\t);\n\t\t};\n\t\tfor (const step of steps) {\n\t\t\tconst key =\n\t\t\t\tstep.kind !== \"cost\"\n\t\t\t\t\t? saved.owners.get(step.entry)\n\t\t\t\t\t: step.seq === undefined\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: `${step.seq}:cost`;\n\t\t\tconst index = scratch.children.length;\n\t\t\tif (step.kind === \"entry\" && step.entry.kind === \"tool\" && held.has(step.entry)) {\n\t\t\t\tconst slot = calls.hold(step.entry, key);\n\t\t\t\tscratch.addChild(slot);\n\t\t\t\tif (key) mark([slot], key, true);\n\t\t\t\tlayout?.paint(step.entry, scratch, index);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst kept = key && (copy ? exceptions.peek(key) : exceptions.get(key));\n\t\t\tif (kept) for (const component of kept) scratch.addChild(component);\n\t\t\telse addTranscriptStep(mode, step, false, true);\n\t\t\tlayout?.paint(step.kind === \"cost\" ? step : step.entry, scratch, index);\n\t\t\tconst drawn = scratch.children.slice(index);\n\t\t\tif (key) {\n\t\t\t\tconst { seq, block } = savedLeaf(key);\n\t\t\t\tfor (let part = 0; part < drawn.length; part++)\n\t\t\t\t\tleaves.set(drawn[part]!, { source: exceptions.source, seq, block, part });\n\t\t\t}\n\t\t\tconst alone = step.kind === \"entry\" && step.entry.kind === \"tool\" && isResultWithoutCall(step.entry);\n\t\t\tif (key) {\n\t\t\t\tif (!copy && !kept) exceptions.remember(key, drawn, savedLeaf(key));\n\t\t\t\tif (copy || alone) {\n\t\t\t\t\t// The widget is owned by its saved result, but the document places a paired card at its call.\n\t\t\t\t\tconst at =\n\t\t\t\t\t\tcopy && step.kind === \"entry\" && step.entry.kind === \"tool\" ? savedRowKey(step.entry) : undefined;\n\t\t\t\t\tmark(drawn, at ?? key, alone);\n\t\t\t\t}\n\t\t\t\tfollowChosenExpansion(mode, exceptions, key, drawn);\n\t\t\t}\n\t\t\tif (step.kind !== \"entry\") continue;\n\t\t\tif (key && alone && step.entry.kind === \"tool\")\n\t\t\t\tcalls.drewResult(\n\t\t\t\t\tstep.entry,\n\t\t\t\t\tdrawn,\n\t\t\t\t\tkey,\n\t\t\t\t\tcopy\n\t\t\t\t\t\t? () => {\n\t\t\t\t\t\t\t\tfor (const child of drawn) copy.positions.delete(child);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: undefined,\n\t\t\t\t);\n\t\t\tcalls.drew(step.entry);\n\t\t}\n\t\tif (layout && records) {\n\t\t\tlayout.apply(scratch, records.data);\n\t\t\tmarkRecordRows(scratch.children, leaves, (row, leaf) => {\n\t\t\t\tif (copy) copy.positions.set(row, leaf);\n\t\t\t\telse WindowedContainer.markHistoryComponent(row, leaf.source, leaf.seq, leaf.block, leaf.part);\n\t\t\t});\n\t\t}\n\t\tconst page = scratch.children.slice(1);\n\t\tif (copy) copy.settled = calls.settle(mode.sessionManager, copy.edges, copy.alive);\n\t\telse if (page.length > 0) page.unshift(calls.finish(mode.sessionManager, adjacent));\n\t\treturn page;\n\t} finally {\n\t\tmode.chatContainer = chat;\n\t}\n}\n\n/**\n * Give each saved line of a page the saved leaf right after the row it follows, so a selection or a copy places it\n * where the page shows it. A line ahead of every row of the page goes just before the first one.\n */\nfunction markRecordRows(\n\trows: readonly Component[],\n\tleaves: ReadonlyMap<Component, HistoryLeaf>,\n\tmark: (row: Component, leaf: HistoryLeaf) => void,\n): void {\n\tlet previous: HistoryLeaf | undefined;\n\tlet leading: Component[] = [];\n\tfor (const row of rows) {\n\t\tconst leaf = leaves.get(row);\n\t\tif (leaf) {\n\t\t\tfor (let i = 0; i < leading.length; i++) mark(leading[i]!, { ...leaf, part: leaf.part - leading.length + i });\n\t\t\tleading = [];\n\t\t\tprevious = leaf;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!chatDecorationRow(row)) continue;\n\t\tif (!previous) {\n\t\t\tleading.push(row);\n\t\t\tcontinue;\n\t\t}\n\t\tprevious = { ...previous, part: previous.part + 1 };\n\t\tmark(row, previous);\n\t}\n}\n\nfunction buildHistoryInSlices(\n\tmode: InteractiveModeBase,\n\thistory: readonly TranscriptStep[],\n\tend: Component,\n\tlayout?: WeakRef<ChatReaderLayout>,\n): void {\n\tconst chat = mode.chatContainer;\n\tlet remaining = history.length;\n\tlet before = end;\n\tconst build = (budgetMs: number, maxSteps: number): boolean => {\n\t\tconst at = chat.children.indexOf(before);\n\t\tif (at < 0 || remaining === 0) return false;\n\t\tconst deadline = performance.now() + budgetMs;\n\t\tconst built: Component[][] = [];\n\t\tconst preceding = new Spacer(0);\n\t\tconst scratch = new Container();\n\t\tmode.chatContainer = scratch;\n\t\ttry {\n\t\t\tfor (let steps = 0; remaining > 0 && steps < maxSteps; steps++) {\n\t\t\t\tscratch.children = [preceding];\n\t\t\t\tconst step = history[--remaining]!;\n\t\t\t\taddTranscriptStep(mode, step, false);\n\t\t\t\tlayout?.deref()?.paint(step.kind === \"cost\" ? step : step.entry, scratch, 1);\n\t\t\t\tbuilt.push(scratch.children.slice(1));\n\t\t\t\tif (performance.now() >= deadline) break;\n\t\t\t}\n\t\t} finally {\n\t\t\tmode.chatContainer = chat;\n\t\t}\n\t\tconst components = built.reverse().flat();\n\t\tif (components.length > 0) {\n\t\t\tif (chat instanceof StartupChatContainer) chat.insertChildren(at, components);\n\t\t\telse chat.children.splice(at, 0, ...components);\n\t\t\tbefore = components[0]!;\n\t\t\tconst messages = components.filter(isChatMessageComponent).length;\n\t\t\tif (messages > 0) (mode.ui as AltScreenMessageCounterHost).newMessages?.historyPrepended(messages);\n\t\t\tmode.ui.requestRender();\n\t\t}\n\t\tif (remaining > 0) return true;\n\t\tchat.removeChild(end);\n\t\treturn false;\n\t};\n\tconst tracked = trackChatHistoryBuild(chat, () => {\n\t\tbuild(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);\n\t\ttracked.done();\n\t});\n\tconst slice = (): void => {\n\t\tif (build(HISTORY_SLICE_BUDGET_MS, HISTORY_SLICE_STEPS)) setImmediate(slice);\n\t\telse tracked.done();\n\t};\n\tsetImmediate(slice);\n}\n\nInteractiveModeBase.prototype.renderSessionEntries = function (\n\tthis: InteractiveModeBase,\n\tsessionEntries: SessionEntry[],\n\toptions: {\n\t\tupdateFooter?: boolean;\n\t\tpopulateHistory?: boolean;\n\t\tpreserveViewportInput?: boolean;\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\t/** @internal The rows a reader parked above the end sees, taken out of the chat this replaces. */\n\t\tparked?: ParkedViewport;\n\t} = {},\n): void {\n\tif (!options.preserveViewportInput && !options.parked) this.resetTranscriptSelection();\n\tthis.pendingTools.clear();\n\tconst pendingEchoes = takeDeferredEchoes(this);\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\tconst parked = options.parked;\n\tinstallSavedChatHistory(this, sessionEntries, savedChatComponents, parked?.parked);\n\tnoteShownContext(this, sessionEntries);\n\tconst chat = this.chatContainer;\n\tconst regular = this.ui.mode !== \"fullscreen\";\n\tconst mount = sessionChatMount(this, this.sessionManager);\n\tlet layout = mount ? new ChatReaderLayout(sessionEntries, chat) : undefined;\n\tif (layout) bindChatLayout(this, layout);\n\t// Saved lines a parked reader still sees stay in their rows; this drawing does not show them twice.\n\tif (layout && parked?.shownRecords) layout.keepShown(parked.shownRecords);\n\tconst steps = planTranscript(this, sessionEntries, options, layout);\n\t// Only the drawn context's saved lines stay resident; a saved page reads its own with its rows.\n\tif (mount && layout) retainChatRecords(mount, layout.anchors());\n\tlet tailStart = this.ui.mode === \"fullscreen\" ? Math.max(0, steps.length - TAIL_STEPS) : 0;\n\tif (parked?.keys.size) {\n\t\t// The reader's kept rows are drawn now, in place, so the first frame shows them where they were.\n\t\tconst adopted = steps.findIndex((step) => {\n\t\t\tconst key = stepKey(step);\n\t\t\treturn key !== undefined && parked.keys.has(key);\n\t\t});\n\t\tif (adopted >= 0) {\n\t\t\ttailStart = Math.min(tailStart, adopted);\n\t\t\tadoptions.set(this, { ...parked, inserted: false });\n\t\t}\n\t}\n\tif (tailStart > 0) {\n\t\tconst historyEnd = new Spacer(0);\n\t\tthis.chatContainer.addChild(historyEnd);\n\t\tbuildHistoryInSlices(this, steps.slice(0, tailStart), historyEnd, layout && new WeakRef(layout));\n\t}\n\tconst adoption = adoptions.get(this);\n\ttry {\n\t\tfor (let index = tailStart; index < steps.length; index++) {\n\t\t\tconst step = steps[index]!;\n\t\t\tconst key = adoption && stepKey(step);\n\t\t\tconst start = chat.children.length;\n\t\t\taddTranscriptStep(this, step);\n\t\t\t// An adopted row is where the reader saw it, with the saved lines drawn after it then.\n\t\t\tif (key === undefined || !adoption?.keys.has(key))\n\t\t\t\tlayout?.paint(step.kind === \"cost\" ? step : step.entry, chat, start);\n\t\t}\n\t} finally {\n\t\tadoptions.delete(this);\n\t\tconst unused = [...(adoption?.inserted ? [] : (parked?.adopted ?? [])), ...(parked?.parked?.rows ?? [])].filter(\n\t\t\t(row) => !this.chatContainer.children.includes(row),\n\t\t);\n\t\tdisposeRemoteRenderers(unused);\n\t}\n\tif (mount && layout) {\n\t\tif (!regular && chat instanceof StartupChatContainer) {\n\t\t\tlayout.observeWindowWhenPresent(chat, mount, () => this.ui.requestRender());\n\t\t} else {\n\t\t\tconst page = readMountedAnchors(mount, () => layout?.anchors() ?? []);\n\t\t\tconst apply = (data?: ChatPageDecorations) => {\n\t\t\t\tconst changed = data !== undefined && layout?.apply(chat, data) === true;\n\t\t\t\tlayout = undefined;\n\t\t\t\treturn changed;\n\t\t\t};\n\t\t\t// The main-screen renderer writes the rows into the one frame it may hold for them; nothing renders again.\n\t\t\tif (chat instanceof StartupChatContainer)\n\t\t\t\tchat.awaitChatRecords(page, apply, this.ui, CHAT_RECORD_FIRST_PAINT_MS);\n\t\t\telse\n\t\t\t\tvoid page.then((data) => {\n\t\t\t\t\tif (apply(data)) this.ui.requestRender();\n\t\t\t\t});\n\t\t}\n\t}\n\trestoreDeferredEchoes(this, pendingEchoes);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.attachStartupNoticesContainer = function (\n\tthis: InteractiveModeBase,\n\toptions: { resetDetached?: boolean } = {},\n): void {\n\tconst disclosureIndex = this.chatContainer.children.indexOf(this.resourceDisclosureContainer);\n\tconst noticesIndex = this.chatContainer.children.indexOf(this.startupNoticesContainer);\n\tif (disclosureIndex >= 0 && noticesIndex >= 0) return;\n\tif (disclosureIndex < 0) {\n\t\tif (options.resetDetached) this.resourceDisclosureContainer.clear();\n\t\tif (noticesIndex >= 0) this.chatContainer.children.splice(noticesIndex, 0, this.resourceDisclosureContainer);\n\t\telse this.chatContainer.addChild(this.resourceDisclosureContainer);\n\t}\n\tif (noticesIndex < 0) {\n\t\tif (options.resetDetached) this.startupNoticesContainer.clear();\n\t\tthis.chatContainer.addChild(this.startupNoticesContainer);\n\t}\n};\n\nconst renderedSessionIds = new WeakMap<InteractiveModeBase, string>();\nconst nativeHistoryHints = new WeakMap<Container, Component>();\n\n/** The terminal owns scrollback in regular mode: a resumed window cannot paint rows it never printed. */\nfunction showNativeHistoryHint(mode: InteractiveModeBase): void {\n\tconst notices = mode.startupNoticesContainer;\n\tconst previous = nativeHistoryHints.get(notices);\n\tif (mode.ui.mode !== \"regular\" || !mode.sessionManager.getOmittedHistoryTotals?.()?.totalMessages) {\n\t\tif (previous) notices.removeChild(previous);\n\t\treturn;\n\t}\n\tconst hint =\n\t\tprevious ??\n\t\tnew ThemedText(\n\t\t\t() =>\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"dim\",\n\t\t\t\t\t\"Older messages: use terminal scrollback, ask the agent to read history://, or use /export.\",\n\t\t\t\t),\n\t\t\t1,\n\t\t\t0,\n\t\t);\n\tif (!previous) nativeHistoryHints.set(notices, hint);\n\tif (!notices.children.includes(hint)) notices.addChild(hint);\n}\n\nexport function clearChatForRerender(mode: InteractiveModeBase): void {\n\treleaseSavedChatHistory(mode);\n\tconst renderer = mode.ui as AltScreenMessageCounterHost;\n\tif (mode.chatContainer.children.length > 0) {\n\t\trenderer.newMessages?.observe(renderer.isFollowingOutput !== false, countChatMessages(mode.chatContainer));\n\t}\n\tmode.chatContainer.clear();\n}\n\nInteractiveModeBase.prototype.renderInitialMessages = function (this: InteractiveModeBase): void {\n\tconst sessionId = this.sessionManager.getSessionId();\n\tconst previousSessionId = renderedSessionIds.get(this);\n\trenderedSessionIds.set(this, sessionId);\n\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\tif (previousSessionId !== sessionId) renderer.newMessages?.reset();\n\tthis.attachStartupNoticesContainer({ resetDetached: true });\n\tshowNativeHistoryHint(this);\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { updateFooter: true, populateHistory: true });\n\trenderProjectTrustWarningIfNeeded(this);\n\trefreshInteractiveTasks(this);\n\tif (previousSessionId === sessionId) {\n\t\trenderer.newMessages?.replaced(countChatMessages(this.chatContainer));\n\t}\n};\n\n/**\n * Says that the session's project is untrusted, for as long as it is. It reads the trust when the chat paints: an\n * isolated interactive host learns its engine's decision after the chat was drawn, and a decision that is still to be\n * made is neither trusted nor untrusted.\n */\nclass ProjectTrustWarning implements Component {\n\tprivate readonly visible: () => boolean;\n\tprivate readonly lines: Component[];\n\n\tconstructor(visible: () => boolean, separated: boolean) {\n\t\tthis.visible = visible;\n\t\tconst text = new ThemedText(\n\t\t\t() =>\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"warning\",\n\t\t\t\t\t`This project is not trusted. Project ${CONFIG_DIR_NAME} resources and packages are ignored. Use /trust to save a trust decision, then restart ${APP_NAME}.`,\n\t\t\t\t),\n\t\t\t1,\n\t\t\t0,\n\t\t);\n\t\tthis.lines = separated ? [new Spacer(1), text] : [text];\n\t}\n\n\trender(width: number): string[] {\n\t\treturn this.visible() ? this.lines.flatMap((line) => line.render(width)) : [];\n\t}\n\n\tinvalidate(): void {\n\t\tfor (const line of this.lines) line.invalidate();\n\t}\n}\n\n/** The chat slot of the warning a mode last drew, while the chat still holds it. */\nconst projectTrustWarningSlots = new WeakMap<InteractiveModeBase, Container>();\n\nfunction projectTrustWarningShows(mode: InteractiveModeBase, requiresTrust: boolean): boolean {\n\treturn projectTrustWarningVisible({\n\t\ttrusted: mode.settingsManager.isProjectTrusted(),\n\t\tpending: mode.runtimeHost?.isProjectTrustPending?.() === true,\n\t\trequiresTrust,\n\t});\n}\n\n/**\n * Adds the warning at the end of the chat when the session's project is untrusted and has resources that need trust.\n * A trusted session, or one whose decision is still to be made, gets none here: refreshProjectTrustWarning adds it if\n * the decision turns out untrusted.\n */\nfunction renderProjectTrustWarningIfNeeded(mode: InteractiveModeBase): void {\n\tif (!projectTrustWarningShows(mode, true)) return;\n\tconst chat = mode.chatContainer;\n\tconst separated = chat.children.length > 0;\n\tconst slot = new Container();\n\tchat.addChild(slot);\n\tprojectTrustWarningSlots.set(mode, slot);\n\tconst settle = (requiresTrust: boolean) => {\n\t\tif (!chat.children.includes(slot)) return;\n\t\tif (!requiresTrust) {\n\t\t\tchat.removeChild(slot);\n\t\t\treturn;\n\t\t}\n\t\tslot.addChild(new ProjectTrustWarning(() => projectTrustWarningShows(mode, true), separated));\n\t\tmode.ui.requestRender();\n\t};\n\tvoid hasTrustRequiringProjectResourcesAsync(mode.sessionManager.getCwd()).then(settle, () => settle(false));\n}\n\nInteractiveModeBase.prototype.appendProjectTrustWarning = function (this: InteractiveModeBase): void {\n\trenderProjectTrustWarningIfNeeded(this);\n};\n\nInteractiveModeBase.prototype.refreshProjectTrustWarning = function (this: InteractiveModeBase): void {\n\t// Before the chat shows this session, its own drawing adds the warning.\n\tif (renderedSessionIds.get(this) !== this.sessionManager.getSessionId()) return;\n\tconst slot = projectTrustWarningSlots.get(this);\n\tif (slot && this.chatContainer.children.includes(slot)) {\n\t\t// The warning in the chat reads the trust when it paints.\n\t\tthis.chatContainer.invalidate();\n\t} else {\n\t\trenderProjectTrustWarningIfNeeded(this);\n\t}\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.getUserInput = async function (\n\tthis: InteractiveModeBase,\n): Promise<InteractiveSubmission> {\n\twhile (true) {\n\t\tconst queuedInput = this.pendingUserInputs.shift();\n\t\tif (queuedInput !== undefined) {\n\t\t\treturn queuedInput;\n\t\t}\n\n\t\tif (this.startupReplayActiveInput) {\n\t\t\tawait this.drainStartupReplayCommands();\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.onInputCallback = (submission: InteractiveSubmission) => {\n\t\t\t\tthis.onInputCallback = undefined;\n\t\t\t\tresolve(submission);\n\t\t\t};\n\t\t\tif (!this.inputHandlerReadyRecorded) {\n\t\t\t\tthis.inputHandlerReadyRecorded = true;\n\t\t\t\trecordTimeSinceReset(\"interactive-input-handler-ready\");\n\t\t\t\tmarkLifecycleTiming(\"interactive-input-handler-ready\");\n\t\t\t\tvoid (async () => {\n\t\t\t\t\tawait yieldToEventLoop();\n\t\t\t\t\tthis.footerDataProvider.startGitWatcher();\n\t\t\t\t\t// pi parity: the changelog/first-run notices need nothing from\n\t\t\t\t\t// extensions — render them right after the input handler is ready\n\t\t\t\t\t// instead of gating them behind the deferred extension reload (or,\n\t\t\t\t\t// when the user types immediately, behind the whole agent turn).\n\t\t\t\t\tawait preloadChangelog(getChangelogPath());\n\t\t\t\t\tthis.showStartupNoticesIfNeeded(this.startupNoticesContainer);\n\t\t\t\t\tif (this.deferredStartupPending) {\n\t\t\t\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t\t\t\t}\n\t\t\t\t})().catch((error) => {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tconsole.error(`Deferred input-readiness startup task failed: ${message}`);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n};\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function (\n\tthis: InteractiveModeBase,\n\toptions: {\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\tresetStartupDisclosure?: boolean;\n\t\tpreserveViewportInput?: boolean;\n\t} = {},\n): void {\n\t// Generic rebuilds keep the same session: pending fd/rg callbacks still own\n\t// this transcript. Full session replacements invalidate their generation in\n\t// renderCurrentSessionState() before rebuilding the replacement transcript.\n\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\tthis.managedToolStatusStarted = false;\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\t// Count what arrived unread before the rows the reader sees leave the chat with the rest.\n\tif (this.chatContainer.children.length > 0) {\n\t\trenderer.newMessages?.observe(renderer.isFollowingOutput !== false, countChatMessages(this.chatContainer));\n\t}\n\t// A compaction while the reader is above the end keeps what they see, their selection and their place.\n\tconst parked = parkViewport(this, entries);\n\tholdCompactionWidgets(this, entries, parked);\n\tclearChatForRerender(this);\n\tif (options.resetStartupDisclosure) this.resourceDisclosureContainer.clear();\n\tthis.attachStartupNoticesContainer();\n\tshowNativeHistoryHint(this);\n\tthis.renderSessionEntries(entries, parked ? { ...options, parked } : options);\n\t// A caller that suppresses the persisted boundary appends the live one, then the warning (appendProjectTrustWarning).\n\tif (!options.suppressCompactionBoundary) renderProjectTrustWarningIfNeeded(this);\n\trenderer.newMessages?.replaced(countChatMessages(this.chatContainer));\n};\n\nfunction isSynthesizedCompactionBoundary(message: AgentMessage | undefined, result: VerbatimCompactionResult): boolean {\n\tif (message?.role !== \"custom\" || message.customType !== \"compaction\" || !message.display) return false;\n\tconst details = message.details as { strategy?: string } | undefined;\n\tif (details?.strategy !== \"verbatim-lines\") return false;\n\tconst content = Array.isArray(message.content)\n\t\t? message.content\n\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t.map((block) => block.text)\n\t\t\t\t.join(\"\\n\")\n\t\t: message.content;\n\treturn stripVerbatimCompactionPrefix(content) === result.compactedText;\n}\n"]}
1
+ {"version":3,"file":"interactive-render-chat.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAA8B,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACN,mBAAmB,EACnB,cAAc,EACd,0BAA0B,EAC1B,qBAAqB,GAGrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACpG,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAqB,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACN,cAAc,EACd,aAAa,EACb,YAAY,EACZ,WAAW,EACX,UAAU,G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;IACzD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;QAC7C,CAAC,CAAC,OAAO,CAAC,OAAO;aACd,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC;aACxC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;aAC1B,IAAI,CAAC,IAAI,CAAC;QACb,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACnB,OAAO,6BAA6B,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,aAAa,CAAC;AACxE,CAAC","sourcesContent":["import { isProxy } from \"node:util/types\";\nimport type { AssistantMessage, Usage } from \"@bastani/atomic-ai/compat\";\nimport { type HistoryLeaf, type TUI, WindowedContainer } from \"@bastani/atomic-tui\";\nimport { CONFIG_DIR_NAME } from \"../../config.js\";\nimport {\n\tadvanceCacheHistory,\n\tcacheMissAfter,\n\tcreateCacheMissModelSource,\n\tformatCacheMissNotice,\n\ttype ModelPriceSource,\n\ttype PreviousRequest,\n} from \"../../core/cache-stats.ts\";\nimport { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { isVerbatimCompactionMessage, stripVerbatimCompactionPrefix } from \"../../core/messages.ts\";\nimport { projectTrustWarningVisible } from \"../../core/project-trust-state.ts\";\nimport { serviceTierWarnings } from \"../../core/service-tier-warnings.ts\";\nimport type { CustomEntry } from \"../../core/session-manager.ts\";\nimport { buildContextEntries, type SessionEntry } from \"../../core/session-manager.ts\";\nimport { sessionEntryToDisplayMessages } from \"../../core/session-manager-history.ts\";\nimport { getOwnerTaskStore } from \"../../core/tasks/owner-store.js\";\nimport { ReopenedCompletionHeaders } from \"../../core/tasks/reopened-completion.js\";\nimport { taskTranscriptSource } from \"../../core/tasks/supervisor.js\";\nimport { readTaskCompletionHistory } from \"../../core/tasks/task-completion-history.js\";\nimport {\n\tcarryRowSource,\n\tnoteRowSource,\n\tnoteSavedSeq,\n\tsavedRowKey,\n\tsavedSeqOf,\n} from \"../../core/tasks/transcript-origin.js\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.js\";\nimport {\n\tdisposeRemoteRenderers,\n\tRemoteCustomMessageComponent,\n\tRemoteToolExecutionComponent,\n} from \"../interactive-engine/remote-renderer.ts\";\nimport { appendBoundedStderr } from \"../rpc/rpc-client-process.js\";\nimport { messageComponents, statusComponents } from \"./chat-message-count.ts\";\nimport { bindChatLayout, ChatReaderLayout, chatDecorationRow } from \"./chat-reader-layout.js\";\nimport {\n\tCHAT_RECORD_FIRST_PAINT_MS,\n\ttype ChatPageDecorations,\n\treadMountedAnchors,\n\tretainChatRecords,\n\tsessionChatMount,\n} from \"./chat-reader-records.js\";\nimport { addMainPromptHistory } from \"./components/agent-prompt-history.ts\";\nimport {\n\tapplyToolEntryState,\n\tcallsAwaitingLaterResults,\n\tisResultWithoutCall,\n} from \"./components/chat-message-renderer.ts\";\nimport { CustomEntryComponent } from \"./components/custom-entry.ts\";\nimport type { NewMessageCounter } from \"./components/jump-to-latest.ts\";\nimport { createMarkdownTransform } from \"./components/markdown-transform.ts\";\nimport { createMermaidMarkdownTransformer } from \"./components/mermaid.ts\";\nimport { ThemedText } from \"./components/themed-text.js\";\nimport type { ToolGroupRole } from \"./components/tool-block.ts\";\nimport {\n\tassistantCallBreaks,\n\ttype ToolGroupHead,\n\ttype ToolGroupMemberState,\n\ttype ToolGroupRoleSink,\n\tToolGroupTracker,\n} from \"./components/tool-group-tracker.ts\";\nimport { isClickExpandableBlock } from \"./components/transcript-block-clicks.ts\";\nimport { appendNewChildrenBeforeAttachedChild } from \"./interactive-child-ordering.ts\";\nimport { countChatMessages, InteractiveModeBase, isChatMessageComponent } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AgentMessage,\n\tAPP_NAME,\n\tAssistantMessageComponent,\n\taddChatTranscriptEntry,\n\tBashExecutionComponent,\n\tBranchSummaryMessageComponent,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tCompactionBoundaryMessageComponent,\n\ttype Component,\n\tContainer,\n\tCustomMessageComponent,\n\tchatEntriesFromAgentMessages,\n\tgetChangelogPath,\n\thasTrustRequiringProjectResourcesAsync,\n\tMarkdown,\n\ttype Message,\n\ttype PersistedMessageMeta,\n\tparseSkillBlock,\n\tpreloadChangelog,\n\trecordTimeSinceReset,\n\trenderChatMessageEntry,\n\ttype SessionContext,\n\tSkillInvocationMessageComponent,\n\tSpacer,\n\tText,\n\tToolExecutionComponent,\n\ttype TruncationResult,\n\ttheme,\n\tUserMessageComponent,\n\ttype VerbatimCompactionResult,\n} from \"./interactive-mode-deps.ts\";\nimport {\n\tholdCompactionWidgets,\n\tinstallSavedChatHistory,\n\tnoteShownContext,\n\ttype ParkedViewport,\n\tparkViewport,\n\treleaseSavedChatHistory,\n\ttype SavedCopyDraw,\n\ttype SavedPageEarlier,\n\ttype SavedPageRecords,\n\ttype SavedRendererInstances,\n\tstoredWidget,\n\twidgetKey,\n} from \"./interactive-saved-chat-history.js\";\nimport { followChosenExpansion, SavedPageCallsBuilder } from \"./interactive-saved-tool-calls.ts\";\nimport { StartupChatContainer, trackChatHistoryBuild } from \"./interactive-startup-chat-container.ts\";\nimport type { InteractiveSubmission } from \"./interactive-submission.ts\";\nimport { refreshInteractiveTasks } from \"./interactive-task-projection.js\";\nimport {\n\tnextStartedRunEcho,\n\tSTARTED_RUN_ECHO_SENT,\n\ttype StartedRunEchoEvent,\n\tstartedRunEchoEvent,\n} from \"./started-run-echo.ts\";\n\nfunction countDroppedThinkingBlocks(message: AssistantMessage): number {\n\treturn (message.diagnostics ?? []).reduce((count, diagnostic) => {\n\t\tif (diagnostic.type !== \"anthropic_input_transformations\") return count;\n\t\tconst dropped = diagnostic.details?.droppedBlockCount;\n\t\treturn count + (typeof dropped === \"number\" && dropped > 0 ? dropped : 0);\n\t}, 0);\n}\n\nfunction addServiceTierWarnings(mode: InteractiveModeBase, message: AssistantMessage): void {\n\tfor (const warning of serviceTierWarnings(message)) {\n\t\tmode.chatContainer.addChild(new Spacer(1));\n\t\tmode.chatContainer.addChild(new Text(theme.fg(\"warning\", `Warning: ${warning}`), 1, 0));\n\t}\n}\n\nInteractiveModeBase.prototype.maybeShowAssistantDiagnostics = function (\n\tthis: InteractiveModeBase,\n\tmessage: AssistantMessage,\n): void {\n\taddServiceTierWarnings(this, message);\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\n\tconst count = countDroppedThinkingBlocks(message);\n\tif (count === 0) return;\n\tlet previousCount = 0;\n\t// The local host has already committed this occurrence; the isolated mirror may still end at its predecessor.\n\tconst publishing = this.session?.publishingReplyId?.(message);\n\tconst branch = this.sessionManager.getBranch();\n\tfor (let i = branch.length - 1; i >= 0; i--) {\n\t\tconst entry = branch[i];\n\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\" && entry.id !== publishing) {\n\t\t\tpreviousCount = countDroppedThinkingBlocks(entry.message);\n\t\t\tbreak;\n\t\t}\n\t}\n\taddThinkingDrop(this, count, previousCount);\n};\n\nfunction addThinkingDrop(mode: InteractiveModeBase, count: number, previousCount: number): void {\n\tif (count <= previousCount) return;\n\tconst noun = count === 1 ? \"thinking block\" : \"thinking blocks\";\n\tmode.chatContainer.addChild(new Spacer(1));\n\tmode.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `Anthropic dropped ${count} ${noun} (details in session)`), 1, 0),\n\t);\n}\n\n// Weak keys leave cleared/rebuilt transcripts collectible without separate lifecycle state.\n// Only persistent diagnostic statuses participate; ordinary chat/status is never evicted.\nconst diagnosticStatuses = new WeakMap<Component, { spacer: Spacer; bytes: number }>();\nconst MAX_DIAGNOSTIC_STATUSES = 64;\nconst MAX_DIAGNOSTIC_HISTORY_BYTES = 256 * 1024;\n\nInteractiveModeBase.prototype.showStatus = function (\n\tthis: InteractiveModeBase,\n\tmessage: string,\n\tpersist = false,\n): void {\n\tconst children = this.chatContainer.children;\n\tconst last = children.length > 0 ? children[children.length - 1] : undefined;\n\tconst secondLast = children.length > 1 ? children[children.length - 2] : undefined;\n\n\tif (!persist && last && secondLast && last === this.lastStatusText && secondLast === this.lastStatusSpacer) {\n\t\tthis.lastStatusText.setText(theme.fg(\"dim\", message));\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\n\tif (persist) message = appendBoundedStderr(\"\", message);\n\tconst spacer = new Spacer(1);\n\tconst text = new Text(theme.fg(\"dim\", message), 1, 0);\n\tstatusComponents.add(text);\n\tthis.chatContainer.addChild(spacer);\n\tthis.chatContainer.addChild(text);\n\tthis.lastStatusSpacer = persist ? undefined : spacer;\n\tthis.lastStatusText = persist ? undefined : text;\n\tif (persist) {\n\t\tdiagnosticStatuses.set(text, { spacer, bytes: Buffer.byteLength(message) });\n\t\tlet count = 0;\n\t\tlet bytes = 0;\n\t\tfor (const child of [...children].reverse()) {\n\t\t\tconst diagnostic = diagnosticStatuses.get(child);\n\t\t\tif (!diagnostic) continue;\n\t\t\tcount++;\n\t\t\tbytes += diagnostic.bytes;\n\t\t\tif (count > MAX_DIAGNOSTIC_STATUSES || bytes > MAX_DIAGNOSTIC_HISTORY_BYTES) {\n\t\t\t\tthis.chatContainer.removeChild(child);\n\t\t\t\tthis.chatContainer.removeChild(diagnostic.spacer);\n\t\t\t}\n\t\t}\n\t}\n\tthis.ui.requestRender();\n};\n\nconst echoReadEpochs = new WeakMap<Component[], number>();\n\ninterface GroupedToolComponent {\n\tsetGroupRole(role: ToolGroupRole): void;\n\tsetGroupHead?(head: ToolGroupHead | undefined): void;\n}\n\n/**\n * Gives `component`, and `entry` when the row draws one, its place in a group of calls. A call folded into a group is\n * told the group's first row too, without keeping it alive, so that it is drawn on its own while a click has left\n * the two at different expansions.\n */\nfunction groupedRowSink(component: GroupedToolComponent, entry?: { groupRole?: ToolGroupRole }): ToolGroupRoleSink {\n\treturn (role, head) => {\n\t\tif (entry) entry.groupRole = role;\n\t\tcomponent.setGroupRole(role);\n\t\tconst headRow = head as Component | undefined;\n\t\tif (role.kind !== \"hidden\" || !isClickExpandableBlock(headRow)) {\n\t\t\tcomponent.setGroupHead?.(undefined);\n\t\t\treturn;\n\t\t}\n\t\tconst row = new WeakRef(headRow);\n\t\tcomponent.setGroupHead?.({ isExpanded: () => row.deref()?.isExpanded() });\n\t};\n}\ninterface MainToolGrouping {\n\treadonly tracker: ToolGroupTracker;\n\treadonly starts: Map<string, number>;\n\tlastMember: Component | undefined;\n\tcarriedBreak: boolean;\n}\nconst mainToolGroupings = new WeakMap<InteractiveModeBase, MainToolGrouping>();\n\nfunction mainToolGrouping(mode: InteractiveModeBase): MainToolGrouping {\n\tlet grouping = mainToolGroupings.get(mode);\n\tif (grouping === undefined) {\n\t\tgrouping = {\n\t\t\ttracker: new ToolGroupTracker({ groupBash: false }),\n\t\t\tstarts: new Map(),\n\t\t\tlastMember: undefined,\n\t\t\tcarriedBreak: false,\n\t\t};\n\t\tmainToolGroupings.set(mode, grouping);\n\t}\n\treturn grouping;\n}\n\nfunction isGroupedToolComponent(component: Component): component is Component & GroupedToolComponent {\n\treturn \"setGroupRole\" in component && typeof component.setGroupRole === \"function\";\n}\n\nfunction hasRowsSinceLastMember(\n\tcontainer: Component & { children: Component[] },\n\tlast: Component,\n\tcurrent: Component,\n): boolean {\n\tfor (let index = container.children.length - 1; index >= 0; index -= 1) {\n\t\tconst child = container.children[index];\n\t\tif (child === last) return false;\n\t\tif (child !== current && !(child instanceof AssistantMessageComponent)) return true;\n\t}\n\treturn true;\n}\n\nexport function breakMainToolGroup(mode: InteractiveModeBase): void {\n\tconst grouping = mainToolGrouping(mode);\n\tgrouping.tracker.break();\n\tgrouping.lastMember = undefined;\n\tgrouping.carriedBreak = false;\n}\n\nfunction resetMainToolGroup(mode: InteractiveModeBase): void {\n\tconst grouping = mainToolGrouping(mode);\n\tgrouping.tracker.reset();\n\tgrouping.lastMember = undefined;\n\tgrouping.carriedBreak = false;\n}\n\nexport function endMainToolTurn(mode: InteractiveModeBase): void {\n\tresetMainToolGroup(mode);\n\tmainToolGrouping(mode).starts.clear();\n}\n\nexport function mainToolCallBreaks(mode: InteractiveModeBase, message: AssistantMessage): ReadonlySet<string> {\n\treturn assistantCallBreaks(message.content, mainToolGrouping(mode).carriedBreak).breakBefore;\n}\n\nexport function endMainAssistantMessage(mode: InteractiveModeBase, message: AssistantMessage): void {\n\tconst grouping = mainToolGrouping(mode);\n\tgrouping.carriedBreak = assistantCallBreaks(message.content, grouping.carriedBreak).trailing;\n}\n\nexport function trackMainToolComponent(\n\tmode: InteractiveModeBase,\n\ttoolCallId: string,\n\ttoolName: string,\n\tcomponent: Component & GroupedToolComponent,\n\tbreakBefore = false,\n): void {\n\tconst grouping = mainToolGrouping(mode);\n\tif (\n\t\tbreakBefore ||\n\t\t(grouping.lastMember !== undefined && hasRowsSinceLastMember(mode.chatContainer, grouping.lastMember, component))\n\t)\n\t\tgrouping.tracker.break();\n\tgrouping.tracker.append(toolCallId, toolName, \"pending\", groupedRowSink(component), component);\n\tgrouping.lastMember = component;\n}\n\nexport function settleMainTool(mode: InteractiveModeBase, toolCallId: string, state: ToolGroupMemberState): void {\n\tconst grouping = mainToolGrouping(mode);\n\tgrouping.tracker.settle(toolCallId, state);\n\tif (state !== \"pending\") grouping.starts.delete(toolCallId);\n}\n\nexport function observeMainToolStart(mode: InteractiveModeBase, toolCallId: string): number {\n\tconst starts = mainToolGrouping(mode).starts;\n\tconst startedAt = starts.get(toolCallId) ?? Date.now();\n\tstarts.set(toolCallId, startedAt);\n\treturn startedAt;\n}\n\nfunction renderGroupedChatEntries(\n\tmode: InteractiveModeBase,\n\tentries: readonly ChatMessageEntry[],\n\tonEntry: (entry: ChatMessageEntry, component: Component) => void,\n): void {\n\tconst grouping = mainToolGrouping(mode);\n\tfor (const entry of entries) {\n\t\tif (entry.kind === \"tool\" && entry.isPartial !== false) {\n\t\t\tconst startedAt = grouping.starts.get(entry.toolCallId);\n\t\t\tif (startedAt !== undefined) {\n\t\t\t\tentry.executionStarted = true;\n\t\t\t\tentry.startedAt = startedAt;\n\t\t\t\tentry.argsComplete = true;\n\t\t\t}\n\t\t}\n\t\tif (entry.kind === \"assistant\")\n\t\t\tgrouping.carriedBreak = assistantCallBreaks(entry.message.content, grouping.carriedBreak).trailing;\n\t\telse if (entry.kind !== \"tool\") grouping.carriedBreak = false;\n\t\tconst component = mode.addRenderedChatEntry(entry);\n\t\tif (entry.kind === \"tool\" && isGroupedToolComponent(component)) {\n\t\t\tgrouping.tracker.bind(entry.toolCallId, groupedRowSink(component, entry), component);\n\t\t\tgrouping.lastMember = component;\n\t\t}\n\t\tonEntry(entry, component);\n\t}\n}\n\nInteractiveModeBase.prototype.renderDeferredUserInput = function (this: InteractiveModeBase, text: string): void {\n\tthis.deferredRenderedUserInputs.push(text);\n\tconst startIndex = this.chatContainer.children.length;\n\tthis.addMessageToChat({ role: \"user\", content: text } as AgentMessage);\n\tconst renderedComponents = this.chatContainer.children.slice(startIndex);\n\tconst epoch = (this.ui as AltScreenMessageCounterHost).newMessages?.epoch;\n\tif (epoch !== undefined) echoReadEpochs.set(renderedComponents, epoch);\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text) ?? [];\n\ttrackedComponents.push(renderedComponents);\n\tthis.deferredRenderedUserInputComponents.set(text, trackedComponents);\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.consumeDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): boolean {\n\tconst index = this.deferredRenderedUserInputs.indexOf(text);\n\tif (index === -1) return false;\n\tthis.deferredRenderedUserInputs.splice(index, 1);\n\tif (this.startedDeferredUserInput === text) this.startedDeferredUserInput = undefined;\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n\ttrackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tthis.deferredRenderedUserInputComponents.delete(text);\n\t}\n\treturn true;\n};\n\nfunction forgetDeferredEcho(mode: InteractiveModeBase, text: string): Component[] | undefined {\n\tconst index = mode.deferredRenderedUserInputs.indexOf(text);\n\tif (index !== -1) {\n\t\tmode.deferredRenderedUserInputs.splice(index, 1);\n\t\tif (mode.startedDeferredUserInput === text) mode.startedDeferredUserInput = undefined;\n\t}\n\tconst trackedComponents = mode.deferredRenderedUserInputComponents.get(text);\n\tconst components = trackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tmode.deferredRenderedUserInputComponents.delete(text);\n\t}\n\treturn components;\n}\n\nfunction takeDeferredEchoes(mode: InteractiveModeBase): Array<{ text: string; epoch: number | undefined }> {\n\tconst occurrences = new Map<string, number>();\n\tconst echoes = mode.deferredRenderedUserInputs.map((text) => {\n\t\tconst occurrence = occurrences.get(text) ?? 0;\n\t\toccurrences.set(text, occurrence + 1);\n\t\tconst components = mode.deferredRenderedUserInputComponents.get(text)?.[occurrence];\n\t\treturn { text, epoch: components ? echoReadEpochs.get(components) : undefined };\n\t});\n\tmode.deferredRenderedUserInputs = [];\n\tmode.deferredRenderedUserInputComponents.clear();\n\treturn echoes;\n}\n\nfunction restoreDeferredEchoes(\n\tmode: InteractiveModeBase,\n\techoes: ReadonlyArray<{ text: string; epoch: number | undefined }>,\n): void {\n\tfor (const { text, epoch } of echoes) {\n\t\tmode.renderDeferredUserInput(text);\n\t\tconst tracked = mode.deferredRenderedUserInputComponents.get(text);\n\t\tconst components = tracked?.[tracked.length - 1];\n\t\tif (components && epoch !== undefined) echoReadEpochs.set(components, epoch);\n\t}\n}\n\nInteractiveModeBase.prototype.discardDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): void {\n\tconst componentsToRemove = forgetDeferredEcho(this, text);\n\tif (!componentsToRemove) return;\n\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\tconst following = renderer.isFollowingOutput !== false;\n\tconst countedBefore = countChatMessages(this.chatContainer);\n\tif (!following) renderer.newMessages?.observe(false, countedBefore);\n\tfor (const component of componentsToRemove) this.chatContainer.removeChild(component);\n\tconst counted = countChatMessages(this.chatContainer);\n\tconst counter = renderer.newMessages;\n\tif (!following && counter && echoReadEpochs.get(componentsToRemove) === counter.epoch) {\n\t\tcounter.retract(countedBefore - counted);\n\t}\n\tcounter?.observe(following, counted);\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\n/**\n * The session started a run for a submission this host echoed as `text`. The run begins with the submission's message,\n * as sent: an `input` hook may have rewritten it, so its `message_start` need not match the echo (#4277). An engine's\n * answer can reach the host after that `message_start`, which the session then showed itself (#4272): if it showed any\n * message of its own since `shownBefore`, the echo goes. Otherwise the session's next message that matches no echo\n * takes the echo's place. A run starts only after the one before it showed its message, so an earlier run still\n * waiting here never got to show it, and its echo stays as it is.\n */\nInteractiveModeBase.prototype.expectStartedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n\tshownBefore: number,\n): void {\n\tif (!this.deferredRenderedUserInputs.includes(text)) return;\n\tif (this.userMessagesShownBySession !== shownBefore) this.discardDeferredRenderedUserInput(text);\n\telse this.startedDeferredUserInput = text;\n};\n\n/** Follows one sent message's echo through `StartedRunEcho` (see there). */\nexport interface StartedRunEchoFollower {\n\t/** The session answered the prompt: `started` when it started a run for this message. */\n\tanswer(started: boolean): void;\n\t/** The send ended without a run to wait for (failed, or not sent): stop following, leaving the echo alone. */\n\tclose(): void;\n}\n\n/**\n * Follow the echo of `text` from just before it is sent until the run it started shows the message (the echo stays as\n * that message) or gets past it without one (the echo goes, #5135), whichever order the answer and the run's events\n * arrive in. A run that settles or loses its engine before it starts drops the echo, and the working row the send\n * showed when `sendShowsWorkingRow`, as the answer alone used to.\n */\nexport function followStartedRunEcho(\n\tmode: InteractiveModeBase,\n\ttext: string,\n\toptions: { readonly sendShowsWorkingRow: boolean },\n): StartedRunEchoFollower {\n\tlet state = STARTED_RUN_ECHO_SENT;\n\tconst stops: Array<() => void> = [];\n\tconst stop = (): void => {\n\t\tfor (const release of stops.splice(0)) release();\n\t};\n\tlet watchingEngine = false;\n\tconst apply = (event: StartedRunEchoEvent): void => {\n\t\tif (state.kind === \"settled\") return;\n\t\tstate = nextStartedRunEcho(state, event);\n\t\tif (state.kind === \"awaiting-run-message\" && !watchingEngine) {\n\t\t\t// Only a run answered as started waits on its engine, and is lost with it.\n\t\t\twatchingEngine = true;\n\t\t\tconst runtime = mode.runtimeHost;\n\t\t\tif (runtime instanceof IsolatedInteractiveRuntime)\n\t\t\t\tstops.push(runtime.onGenerationEnded(() => apply({ type: \"lost\" })));\n\t\t}\n\t\tif (state.kind !== \"settled\") return;\n\t\tstop();\n\t\tif (state.echo === \"left\") return;\n\t\tif (mode.deferredRenderedUserInputs?.includes(text) === true) mode.discardDeferredRenderedUserInput(text);\n\t\t// What the send's own end does when no run started: the working row it showed has no run to end it.\n\t\tif (\n\t\t\tstate.echo === \"never-ran\" &&\n\t\t\toptions.sendShowsWorkingRow &&\n\t\t\t!mode.session.isStreaming &&\n\t\t\tmode.workingRunMeter.snapshot() === undefined\n\t\t) {\n\t\t\tmode.workingRunMeter.stop();\n\t\t\tmode.stopWorkingLoader();\n\t\t}\n\t};\n\t// A run the host saw start and not settle before the send ends before this message's run can start: until it\n\t// settles, its events are not this run's. A user message shown meanwhile still counts, as it always did.\n\tlet earlierRun = mode.session.turnStartedAt !== undefined;\n\tstops.push(\n\t\tmode.session.subscribe((event) => {\n\t\t\tif (earlierRun && (event.type === \"agent_settled\" || event.type === \"session_released\")) {\n\t\t\t\tearlierRun = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst echoEvent = startedRunEchoEvent(event);\n\t\t\tif (echoEvent && (!earlierRun || echoEvent.type === \"user-message\")) apply(echoEvent);\n\t\t}),\n\t);\n\treturn {\n\t\tanswer: (started) => {\n\t\t\t// Everything of an earlier run came before this answer.\n\t\t\tearlierRun = false;\n\t\t\tapply({ type: \"answer\", started });\n\t\t},\n\t\tclose: () => {\n\t\t\tif (state.kind === \"awaiting-answer\") stop();\n\t\t},\n\t};\n}\n\n/** Show a user message from the session: in place of its echo, or of the echo of the run it started, or as new. */\nInteractiveModeBase.prototype.showSessionUserMessage = function (this: InteractiveModeBase, message: Message): void {\n\tconst text = this.getUserMessageText(message);\n\tconst echo = this.deferredRenderedUserInputComponents?.get(text)?.[0];\n\tif (this.consumeDeferredRenderedUserInput(text)) {\n\t\t// The echo stays as the session's message: its rows are that message's rows.\n\t\tfor (const component of echo ?? []) noteRowSource(component, { message, part: 0 });\n\t\treturn;\n\t}\n\tconst started = this.startedDeferredUserInput;\n\tif (started !== undefined) {\n\t\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\t\tconst following = renderer.isFollowingOutput !== false;\n\t\tconst countedBefore = countChatMessages(this.chatContainer);\n\t\trenderer.newMessages?.observe(following, countedBefore);\n\t\tconst echo = forgetDeferredEcho(this, started);\n\t\tappendNewChildrenBeforeAttachedChild(this.chatContainer, echo?.[0], () => this.addMessageToChat(message));\n\t\tfor (const component of echo ?? []) this.chatContainer.removeChild(component);\n\t\tconst counted = countChatMessages(this.chatContainer);\n\t\tconst counter = renderer.newMessages;\n\t\tif (!following && counter && echo && echoReadEpochs.get(echo) === counter.epoch) {\n\t\t\tcounter.retract(countedBefore - counted);\n\t\t}\n\t\tcounter?.replaced(counted);\n\t\tthis.updatePendingMessagesDisplay();\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\tthis.userMessagesShownBySession += 1;\n\tthis.addMessageToChat(message);\n};\n\nInteractiveModeBase.prototype.getMarkdownTransformers = function (this: InteractiveModeBase) {\n\tconst mode = this.settingsManager.getMermaidRenderingMode();\n\tconst withheld =\n\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime &&\n\t\tthis.runtimeHost.isProjectTrustPending() &&\n\t\t!this.settingsManager.isProjectTrusted();\n\tif (this.mermaidMarkdownTransformerMode !== mode || withheld !== (this.mermaidTransformerWithheldProject === true)) {\n\t\tthis.mermaidMarkdownTransformerMode = mode;\n\t\tthis.mermaidTransformerWithheldProject = withheld;\n\t\tconst edit = this.mermaidUserEdit;\n\t\tthis.mermaidMarkdownTransformer = createMermaidMarkdownTransformer({\n\t\t\t// Invalidating a message for a redraw isn't permission to replace a mounted diagram with source text.\n\t\t\t// The user's own subsequent rendering choice, unlike approval, still applies to visible messages.\n\t\t\tgetMode: () =>\n\t\t\t\twithheld && edit === this.mermaidUserEdit ? mode : this.settingsManager.getMermaidRenderingMode(),\n\t\t\ttheme,\n\t\t});\n\t}\n\tconst extensionTransformers =\n\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t? []\n\t\t\t: this.session.extensionRunner.getMarkdownTransformers();\n\treturn [this.mermaidMarkdownTransformer, ...extensionTransformers];\n};\n\n/**\n * Markdown of a changelog that runs the Markdown transformers registered for the `changelog` type. Transformers are\n * looked up on each render, so a notice shown before deferred extensions load uses them once it is invalidated.\n */\nInteractiveModeBase.prototype.createChangelogMarkdown = function (\n\tthis: InteractiveModeBase,\n\tmarkdown: string,\n\tpaddingX: number,\n\tpaddingY: number,\n): Markdown {\n\treturn new Markdown(markdown, paddingX, paddingY, this.getMarkdownThemeWithSettings(), undefined, {\n\t\ttransform: (text, width) =>\n\t\t\tcreateMarkdownTransform(\"changelog\", () => false, this.getMarkdownTransformers())(text, width),\n\t});\n};\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function (\n\tthis: InteractiveModeBase,\n): ChatMessageRenderOptions {\n\tconst isolated = this.runtimeHost instanceof IsolatedInteractiveRuntime;\n\treturn {\n\t\tui: this.ui,\n\t\tcwd: this.sessionManager.getCwd(),\n\t\tmarkdownTheme: this.getMarkdownThemeWithSettings(),\n\t\thideThinkingBlock: this.hideThinkingBlock,\n\t\thiddenThinkingLabel: this.hiddenThinkingLabel,\n\t\ttoolOutputExpanded: this.toolOutputExpanded,\n\t\tshowImages: this.settingsManager.getShowImages(),\n\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\toutputPad: this.outputPad,\n\t\trenderLatex: this.settingsManager.getLatexRenderingEnabled(),\n\t\tmarkdownTransformers: this.getMarkdownTransformers(),\n\t\tgetToolDefinition: isolated ? undefined : (toolName) => this.getRegisteredToolDefinition(toolName),\n\t\tgetTaskRecord: isolated ? undefined : (taskId) => getOwnerTaskStore(this.session)?.getTask(taskId),\n\t\thasTaskTranscript: isolated\n\t\t\t? undefined\n\t\t\t: (taskId) => {\n\t\t\t\t\tconst lease = getOwnerTaskStore(this.session)?.resolveTask(taskId);\n\t\t\t\t\treturn lease?.ok ? taskTranscriptSource(lease.value).ok : false;\n\t\t\t\t},\n\t\tloadTaskTranscript: isolated\n\t\t\t? undefined\n\t\t\t: async (taskId, options) => {\n\t\t\t\t\tconst lease = getOwnerTaskStore(this.session)?.resolveTask(taskId);\n\t\t\t\t\treturn lease?.ok ? readTaskCompletionHistory(lease.value, options?.signal) : undefined;\n\t\t\t\t},\n\t\tgetCustomMessageRenderer: isolated\n\t\t\t? undefined\n\t\t\t: (customType) => this.session.extensionRunner.getMessageRenderer(customType),\n\t\tcreateToolComponent: isolated\n\t\t\t? (entry, context) => {\n\t\t\t\t\tconst component = new RemoteToolExecutionComponent(\n\t\t\t\t\t\tentry.toolName,\n\t\t\t\t\t\tentry.toolCallId,\n\t\t\t\t\t\tentry.args,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tshowImages: context?.showImages ?? this.settingsManager.getShowImages(),\n\t\t\t\t\t\t\timageWidthCells: context?.imageWidthCells ?? this.settingsManager.getImageWidthCells(),\n\t\t\t\t\t\t\toutputPad: context?.outputPad ?? this.outputPad,\n\t\t\t\t\t\t\trendererTaskId: entry.rendererTaskId,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\tcontext?.requestRender ?? (() => this.ui.requestRender()),\n\t\t\t\t\t);\n\t\t\t\t\tapplyToolEntryState(component, entry, context?.expanded ?? this.toolOutputExpanded);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tcreateCustomMessageComponent: isolated\n\t\t\t? (message, context) => {\n\t\t\t\t\tconst component = new RemoteCustomMessageComponent(\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\tcontext?.requestRender ?? (() => this.ui.requestRender()),\n\t\t\t\t\t\tcontext?.outputPad ?? this.outputPad,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(context?.expanded ?? this.toolOutputExpanded);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n};\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function (\n\tthis: InteractiveModeBase,\n\tentry: ChatMessageEntry,\n): Component {\n\tconst component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n\tcarryRowSource(entry, component);\n\tif (entry.kind !== \"system\" && !(entry.kind === \"custom\" && isVerbatimCompactionMessage(entry.message))) {\n\t\tmessageComponents.add(component);\n\t}\n\taddChatTranscriptEntry(this.chatContainer, component, entry.role);\n\treturn component;\n};\n\nInteractiveModeBase.prototype.addCompactionBoundaryToChat = function (\n\tthis: InteractiveModeBase,\n\tresult: VerbatimCompactionResult,\n): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tconst component = new CompactionBoundaryMessageComponent(result, this.outputPad);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tthis.chatContainer.addChild(component);\n};\n\nInteractiveModeBase.prototype.addCompactionCostNotice = function (\n\tthis: InteractiveModeBase,\n\tkind: \"compaction\" | \"branch_summary\",\n\tusage: Usage,\n): void {\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\tconst tokens = usage.input + usage.output + usage.cacheRead + usage.cacheWrite;\n\tconst cost = usage.cost.total >= 0.01 ? ` (~$${usage.cost.total.toFixed(2)})` : \"\";\n\tconst label = kind === \"compaction\" ? \"Compaction\" : \"Branch summary\";\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `${label}: ${tokens.toLocaleString()} tokens billed${cost}`), 1, 0),\n\t);\n};\n\nInteractiveModeBase.prototype.addCustomEntryToChat = function (this: InteractiveModeBase, entry: CustomEntry): void {\n\tconst renderer = this.session.extensionRunner.getEntryRenderer(entry.customType);\n\tif (!renderer) return;\n\tconst runner = this.session.extensionRunner;\n\tconst component = new CustomEntryComponent(\n\t\tentry,\n\t\t(...args) => runner.renderEntry(entry.customType, ...args),\n\t\tthis.outputPad,\n\t);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tif (!component.hasContent()) return;\n\tmessageComponents.add(component);\n\tconst seq = this.sessionManager.getEntrySeq?.(entry.id);\n\tif (seq !== undefined) noteSavedSeq(entry, seq);\n\tnoteRowSource(component, { message: entry, part: 0 });\n\tconst streamingIndex = this.streamingComponent ? this.chatContainer.children.indexOf(this.streamingComponent) : -1;\n\tif (streamingIndex >= 0) this.chatContainer.children.splice(streamingIndex, 0, component);\n\telse this.chatContainer.addChild(component);\n};\n\ntype AltScreenMessageCounterHost = TUI & {\n\tisFollowingOutput?: boolean;\n\tnewMessages?: NewMessageCounter;\n};\n\nInteractiveModeBase.prototype.addMessageToChat = function (\n\tthis: InteractiveModeBase,\n\tmessage: AgentMessage,\n\toptions?: { populateHistory?: boolean },\n): void {\n\tconst markdownTransformers = this.getMarkdownTransformers();\n\tswitch (message.role) {\n\t\tcase \"bashExecution\": {\n\t\t\tconst component = new BashExecutionComponent(\n\t\t\t\tmessage.command,\n\t\t\t\tthis.ui,\n\t\t\t\tmessage.excludeFromContext,\n\t\t\t\tthis.outputPad,\n\t\t\t);\n\t\t\tif (message.output) {\n\t\t\t\tcomponent.appendOutput(message.output);\n\t\t\t}\n\t\t\tcomponent.setComplete(\n\t\t\t\tmessage.exitCode,\n\t\t\t\tmessage.cancelled,\n\t\t\t\tmessage.truncated ? ({ truncated: true } as TruncationResult) : undefined,\n\t\t\t\tmessage.fullOutputPath,\n\t\t\t);\n\t\t\tmessageComponents.add(component);\n\t\t\tnoteRowSource(component, { message, part: 0 });\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"custom\": {\n\t\t\tif (message.display) {\n\t\t\t\tconst component =\n\t\t\t\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t\t\t\t? new RemoteCustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.runtimeHost,\n\t\t\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: new CustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.session.extensionRunner.getMessageRenderer(message.customType),\n\t\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\thasTranscript: (taskId) => {\n\t\t\t\t\t\t\t\t\t\tconst lease = getOwnerTaskStore(this.session)?.resolveTask(taskId);\n\t\t\t\t\t\t\t\t\t\treturn lease?.ok ? taskTranscriptSource(lease.value).ok : false;\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tloadTranscript: async (taskId, options) => {\n\t\t\t\t\t\t\t\t\t\tconst lease = getOwnerTaskStore(this.session)?.resolveTask(taskId);\n\t\t\t\t\t\t\t\t\t\treturn lease?.ok ? readTaskCompletionHistory(lease.value, options?.signal) : undefined;\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tgetToolDefinition: (toolName) => this.getRegisteredToolDefinition(toolName),\n\t\t\t\t\t\t\t\t\tcwd: this.sessionManager.getCwd(),\n\t\t\t\t\t\t\t\t\trequestRender: () => this.ui.requestRender(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\tmessageComponents.add(component);\n\t\t\t\tnoteRowSource(component, { message, part: 0 });\n\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"branchSummary\": {\n\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\tconst component = new BranchSummaryMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t);\n\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\tmessageComponents.add(component);\n\t\t\tnoteRowSource(component, { message, part: 0 });\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"user\": {\n\t\t\tconst textContent = this.getUserMessageText(message);\n\t\t\tif (textContent) {\n\t\t\t\tif (this.chatContainer.children.length > 0) {\n\t\t\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\t\t}\n\t\t\t\tconst skillBlock = parseSkillBlock(textContent);\n\t\t\t\tif (skillBlock) {\n\t\t\t\t\t// Render skill block (collapsible)\n\t\t\t\t\tconst component = new SkillInvocationMessageComponent(\n\t\t\t\t\t\tskillBlock,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tif (!skillBlock.userMessage) messageComponents.add(component);\n\t\t\t\t\tnoteRowSource(component, { message, part: 0 });\n\t\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t\t\t// Render user message separately if present\n\t\t\t\t\tif (skillBlock.userMessage) {\n\t\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\t\tskillBlock.userMessage,\n\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tmessageComponents.add(userComponent);\n\t\t\t\t\t\tnoteRowSource(userComponent, { message, part: 0 });\n\t\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\ttextContent,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t);\n\t\t\t\t\tmessageComponents.add(userComponent);\n\t\t\t\t\tnoteRowSource(userComponent, { message, part: 0 });\n\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t}\n\t\t\t\tif (options?.populateHistory) {\n\t\t\t\t\taddMainPromptHistory(this.editor, textContent);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"assistant\": {\n\t\t\tconst assistantComponent = new AssistantMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.hideThinkingBlock,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.hiddenThinkingLabel,\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t\tfalse,\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t);\n\t\t\tmessageComponents.add(assistantComponent);\n\t\t\tnoteRowSource(assistantComponent, { message, part: 0 });\n\t\t\tthis.chatContainer.addChild(assistantComponent);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"toolResult\": {\n\t\t\t// Tool results are rendered inline with tool calls, handled separately\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tbreak;\n\t}\n};\n\nInteractiveModeBase.prototype.renderSessionContext = function (\n\tthis: InteractiveModeBase,\n\tsessionContext: SessionContext,\n\toptions: { updateFooter?: boolean; populateHistory?: boolean } = {},\n): void {\n\tthis.pendingTools.clear();\n\tconst pendingEchoes = takeDeferredEchoes(this);\n\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\n\tconst grouping = mainToolGrouping(this);\n\tresetMainToolGroup(this);\n\tconst entries = chatEntriesFromAgentMessages(sessionContext.messages, undefined, { tracker: grouping.tracker });\n\trenderGroupedChatEntries(this, entries, (entry, component) => {\n\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t}\n\t\tif (options.populateHistory && entry.kind === \"user\") {\n\t\t\taddMainPromptHistory(this.editor, entry.text);\n\t\t}\n\t});\n\n\trestoreDeferredEchoes(this, pendingEchoes);\n\n\tthis.ui.requestRender();\n};\n\ninterface ReplyNotices {\n\tmessage: AssistantMessage;\n\tpreviousReply: AssistantMessage | undefined;\n\tpreviousRequest: PreviousRequest | undefined;\n\tmodels: ModelPriceSource;\n\tsummarizedParent?: string;\n\t/** On a saved page: the dropped thinking blocks of the reply read before the page, unknown when none was. */\n\tearlier?: { readonly drops: number | undefined };\n\trepeated?: {\n\t\toccurrences: ReplyNotices[];\n\t\tresolved?: true;\n\t\towner?: ReplyNotices;\n\t\tmiss?: ReturnType<typeof cacheMissAfter>;\n\t};\n}\n\nfunction missForOccurrence(notes: ReplyNotices): ReturnType<typeof cacheMissAfter> {\n\tconst group = notes.repeated;\n\tif (!group) return cacheMissAfter(notes.previousRequest, notes.message, notes.models);\n\t// The cache statistics fold records the last miss for each saved object. Retain its exact occurrence,\n\t// even when a later occurrence of that same object wasn't a miss. Distinct equal objects remain distinct.\n\tif (!group.resolved) {\n\t\tgroup.resolved = true;\n\t\tfor (let i = group.occurrences.length - 1; i >= 0; i--) {\n\t\t\tconst candidate = group.occurrences[i]!;\n\t\t\tconst miss = cacheMissAfter(candidate.previousRequest, candidate.message, candidate.models);\n\t\t\tif (miss) {\n\t\t\t\tgroup.owner = candidate;\n\t\t\t\tgroup.miss = miss;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn group.owner === notes ? group.miss : undefined;\n}\n\nfunction precedingDropCount(mode: InteractiveModeBase, notes: ReplyNotices): number | undefined {\n\tif (notes.previousReply) return countDroppedThinkingBlocks(notes.previousReply);\n\tif (notes.earlier) return notes.earlier.drops;\n\t// The provider's cumulative count does not start over at a summary. Only the first visible reply can\n\t// need an omitted predecessor. Do not fetch old message bodies or guess when a tail-only reader lacks it.\n\tlet id = notes.summarizedParent;\n\tif (id === undefined) return 0;\n\tconst seen = new Set<string>();\n\twhile (!seen.has(id)) {\n\t\tseen.add(id);\n\t\tconst entry = mode.sessionManager?.getEntry(id);\n\t\tif (!entry) return undefined;\n\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\")\n\t\t\treturn countDroppedThinkingBlocks(entry.message);\n\t\tif (!entry.parentId) return 0;\n\t\tid = entry.parentId;\n\t}\n\treturn undefined;\n}\n\nfunction paintReplyNotices(mode: InteractiveModeBase, notes: ReplyNotices): void {\n\tconst { message } = notes;\n\tif (message.stopReason !== \"aborted\" && message.stopReason !== \"error\") {\n\t\tconst count = countDroppedThinkingBlocks(message);\n\t\tif (count > 0) {\n\t\t\tconst previous = precedingDropCount(mode, notes);\n\t\t\tif (previous !== undefined) addThinkingDrop(mode, count, previous);\n\t\t}\n\t}\n\tconst miss = missForOccurrence(notes);\n\tif (miss) mode.chatContainer.addChild(new Text(theme.fg(\"warning\", formatCacheMissNotice(miss)), 1, 0));\n}\n\ntype TranscriptStep =\n\t| { readonly kind: \"entry\"; readonly entry: ChatMessageEntry; readonly notices?: ReplyNotices }\n\t| { readonly kind: \"custom\"; readonly entry: CustomEntry }\n\t| {\n\t\t\treadonly kind: \"cost\";\n\t\t\treadonly type: \"compaction\" | \"branch_summary\";\n\t\t\treadonly usage: Usage;\n\t\t\t/** The saved entry whose cost this is, on a saved page. */\n\t\t\treadonly seq?: number;\n\t };\n\nconst TAIL_STEPS = 128;\nconst HISTORY_SLICE_BUDGET_MS = 8;\nconst HISTORY_SLICE_STEPS = 24;\n\n/**\n * Where a saved page's replies start from, as the whole chat reaches them: the request and the dropped thinking of\n * the entries read right before the page. Without a reply among them or the start of the branch, the count is unknown.\n */\nfunction earlierReplies(earlier: SavedPageEarlier | undefined): {\n\trequest: PreviousRequest | undefined;\n\tdrops: number | undefined;\n} {\n\tlet request: PreviousRequest | undefined;\n\tlet drops = earlier?.root ? 0 : undefined;\n\tfor (const entry of earlier?.entries ?? []) {\n\t\trequest = advanceCacheHistory(request, entry);\n\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\")\n\t\t\tdrops = countDroppedThinkingBlocks(entry.message);\n\t}\n\treturn { request, drops };\n}\n\nfunction planTranscript(\n\tmode: InteractiveModeBase,\n\tsessionEntries: SessionEntry[],\n\toptions: {\n\t\tpopulateHistory?: boolean;\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\tsaved?: { seqs: Map<SessionEntry, number>; owners: WeakMap<object, string>; earlier?: SavedPageEarlier };\n\t},\n\tlayout?: ChatReaderLayout,\n): TranscriptStep[] {\n\tconst steps: TranscriptStep[] = [];\n\tconst grouping: MainToolGrouping = options.saved\n\t\t? {\n\t\t\t\ttracker: new ToolGroupTracker({ groupBash: false }),\n\t\t\t\tstarts: new Map(),\n\t\t\t\tlastMember: undefined,\n\t\t\t\tcarriedBreak: false,\n\t\t\t}\n\t\t: mainToolGrouping(mode);\n\tif (!options.saved) resetMainToolGroup(mode);\n\tlet messageBuffer: AgentMessage[] = [];\n\tconst sources = layout ? ([] as string[]) : undefined;\n\tconst messageMeta = new Map<AgentMessage, PersistedMessageMeta>();\n\tconst messageSeq = options.saved ? new Map<AgentMessage, number>() : undefined;\n\tconst models = mode.settingsManager.getShowCacheMissNotices()\n\t\t? createCacheMissModelSource(mode.session.modelRuntime)\n\t\t: undefined;\n\t// A saved page goes on from the entries read right before it, as the whole chat goes on from them.\n\tconst earlier = options.saved && models ? earlierReplies(options.saved.earlier) : undefined;\n\tlet previousRequest: PreviousRequest | undefined = earlier?.request;\n\tlet previousReply: AssistantMessage | undefined;\n\tconst replyGroups: ReplyNotices[] = [];\n\tlet firstMessage = true;\n\tconst firstOccurrence = models && new WeakMap<AssistantMessage, ReplyNotices>();\n\tconst boundary = sessionEntries[0];\n\tconst firstParent = sessionEntries[1]?.parentId;\n\tconst summarizedParent =\n\t\tboundary?.type === \"compaction\"\n\t\t\t? ((firstParent === boundary.id ? boundary.parentId : firstParent) ?? undefined)\n\t\t\t: undefined;\n\tconst flushMessages = (): void => {\n\t\tif (options.suppressCompactionBoundary && firstMessage) {\n\t\t\t// A boundary replays after the system prompt it recorded, so the boundary is the first non-system message.\n\t\t\tconst boundaryIndex = messageBuffer.findIndex((message) => message.role !== \"system\");\n\t\t\tif (isSynthesizedCompactionBoundary(messageBuffer[boundaryIndex], options.suppressCompactionBoundary)) {\n\t\t\t\tmessageBuffer = messageBuffer.filter((_, index) => index !== boundaryIndex);\n\t\t\t\tsources?.splice(boundaryIndex, 1);\n\t\t\t}\n\t\t}\n\t\tfirstMessage = false;\n\t\tif (options.saved) grouping.tracker.break();\n\t\telse breakMainToolGroup(mode);\n\t\tconst saved = options.saved;\n\t\t// Pair by occurrence, not by message identity: an SDK caller can append the very same object twice.\n\t\tlet occurrence = 0;\n\t\tconst groups = replyGroups.length ? new Map<ChatMessageEntry, ReplyNotices>() : undefined;\n\t\tlet source = 0;\n\t\tconst entries = chatEntriesFromAgentMessages(messageBuffer, messageMeta, {\n\t\t\ttracker: grouping.tracker,\n\t\t\t...(saved && messageSeq\n\t\t\t\t? {\n\t\t\t\t\t\tonSourceRow: (e: ChatMessageEntry, message: AgentMessage, block: number) =>\n\t\t\t\t\t\t\tsaved.owners.set(e, `${messageSeq.get(message)}:${block}`),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\tonMessageGroup: layout && sources ? (row) => layout.bind(sources[source++]!, row) : undefined,\n\t\t\tonAssistantGroup: groups && ((lastRow) => groups.set(lastRow, replyGroups[occurrence++]!)),\n\t\t});\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.kind === \"tool\" && entry.isPartial !== false) {\n\t\t\t\tconst startedAt = grouping.starts.get(entry.toolCallId);\n\t\t\t\tif (startedAt !== undefined) {\n\t\t\t\t\tentry.executionStarted = true;\n\t\t\t\t\tentry.startedAt = startedAt;\n\t\t\t\t\tentry.argsComplete = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (entry.kind === \"assistant\")\n\t\t\t\tgrouping.carriedBreak = assistantCallBreaks(entry.message.content, grouping.carriedBreak).trailing;\n\t\t\telse if (entry.kind !== \"tool\") grouping.carriedBreak = false;\n\t\t\tsteps.push({ kind: \"entry\", entry, notices: groups?.get(entry) });\n\t\t\tif (options.populateHistory && entry.kind === \"user\") addMainPromptHistory(mode.editor, entry.text);\n\t\t}\n\t\treplyGroups.length = 0;\n\t\tif (sources) sources.length = 0;\n\t\tmessageBuffer = [];\n\t};\n\tconst headers = new ReopenedCompletionHeaders(\n\t\t() => ({\n\t\t\tentries: mode.sessionManager.getBranch(),\n\t\t\trecovery: mode.sessionManager.getSessionRecoveryState(),\n\t\t}),\n\t\tisProxy,\n\t);\n\tfor (const entry of sessionEntries) {\n\t\tif (entry.type === \"custom\") {\n\t\t\t// An unrendered record between a tool call and its result must not split them into two cards.\n\t\t\tif (!mode.session.extensionRunner.getEntryRenderer(entry.customType)) continue;\n\t\t\tconst seq = options.saved ? options.saved.seqs.get(entry) : mode.sessionManager?.getEntrySeq?.(entry.id);\n\t\t\tif (seq !== undefined) noteSavedSeq(entry, seq);\n\t\t\tflushMessages();\n\t\t\tif (options.saved) options.saved.owners.set(entry, `${options.saved.seqs.get(entry)}:entry`);\n\t\t\tsteps.push({ kind: \"custom\", entry });\n\t\t\tlayout?.bind(entry.id, entry);\n\t\t} else {\n\t\t\tconst messages = sessionEntryToDisplayMessages(entry, headers);\n\t\t\tconst seq = options.saved ? options.saved.seqs.get(entry) : mode.sessionManager?.getEntrySeq?.(entry.id);\n\t\t\tfor (const message of messages) {\n\t\t\t\tsources?.push(entry.id);\n\t\t\t\tmessageMeta.set(message, { id: entry.id, timestamp: entry.timestamp });\n\t\t\t\tif (seq !== undefined) noteSavedSeq(message, seq);\n\t\t\t\tif (options.saved) messageSeq?.set(message, options.saved.seqs.get(entry)!);\n\t\t\t\tif (models && firstOccurrence && message.role === \"assistant\") {\n\t\t\t\t\tconst notes: ReplyNotices = {\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tpreviousReply,\n\t\t\t\t\t\tsummarizedParent,\n\t\t\t\t\t\tpreviousRequest,\n\t\t\t\t\t\tmodels,\n\t\t\t\t\t\t...(earlier ? { earlier } : {}),\n\t\t\t\t\t};\n\t\t\t\t\tconst saved = entry.type === \"message\" && entry.message.role === \"assistant\" ? entry.message : message;\n\t\t\t\t\tconst first = firstOccurrence.get(saved);\n\t\t\t\t\tif (first) {\n\t\t\t\t\t\tnotes.repeated = first.repeated ??= { occurrences: [first] };\n\t\t\t\t\t\tnotes.repeated.occurrences.push(notes);\n\t\t\t\t\t} else firstOccurrence.set(saved, notes);\n\t\t\t\t\treplyGroups.push(notes);\n\t\t\t\t\tpreviousReply = message;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (models) previousRequest = advanceCacheHistory(previousRequest, entry);\n\t\t\tmessageBuffer.push(...messages);\n\t\t\tif ((entry.type === \"compaction\" || entry.type === \"branch_summary\") && entry.usage) {\n\t\t\t\tflushMessages();\n\t\t\t\tconst suppressedLiveBoundary =\n\t\t\t\t\tentry.type === \"compaction\" &&\n\t\t\t\t\toptions.suppressCompactionBoundary !== undefined &&\n\t\t\t\t\tentry.summary === options.suppressCompactionBoundary.compactedText &&\n\t\t\t\t\tentry.tokensBefore === options.suppressCompactionBoundary.tokensBefore;\n\t\t\t\tconst seq = options.saved?.seqs.get(entry);\n\t\t\t\tif (!suppressedLiveBoundary) {\n\t\t\t\t\tconst cost: TranscriptStep = {\n\t\t\t\t\t\tkind: \"cost\",\n\t\t\t\t\t\ttype: entry.type,\n\t\t\t\t\t\tusage: entry.usage,\n\t\t\t\t\t\t...(seq === undefined ? {} : { seq }),\n\t\t\t\t\t};\n\t\t\t\t\tsteps.push(cost);\n\t\t\t\t\tlayout?.extendGroup(entry.id, cost);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tflushMessages();\n\treturn steps;\n}\n\n/** The rows a parked reader sees of entries a new context keeps, while that context is being drawn. */\nconst adoptions = new WeakMap<InteractiveModeBase, ParkedViewport & { inserted: boolean }>();\n\nfunction stepKey(step: TranscriptStep): string | undefined {\n\tif (step.kind === \"entry\") return savedRowKey(step.entry);\n\t// A custom entry draws one row, from the entry itself.\n\tconst seq = step.kind === \"custom\" ? savedSeqOf(step.entry) : undefined;\n\treturn seq === undefined ? undefined : `${seq}:0`;\n}\n\n/** A kept entry the reader sees keeps its drawn rows: the first such step puts them all where it belongs. */\nfunction adoptStep(mode: InteractiveModeBase, step: TranscriptStep): Component | undefined {\n\tconst adoption = adoptions.get(mode);\n\tconst key = adoption && stepKey(step);\n\tconst component = key === undefined ? undefined : adoption?.keys.get(key);\n\tif (!adoption || !component) return undefined;\n\tif (!adoption.inserted) {\n\t\tfor (const row of adoption.adopted) mode.chatContainer.addChild(row);\n\t\tadoption.inserted = true;\n\t}\n\treturn component;\n}\n\nfunction addTranscriptStep(mode: InteractiveModeBase, step: TranscriptStep, latest = true, saved = false): void {\n\tconst adopted = saved ? undefined : adoptStep(mode, step);\n\tif (step.kind === \"custom\") {\n\t\tif (!adopted) {\n\t\t\tconst seq = savedSeqOf(step.entry);\n\t\t\tconst kept = saved || seq === undefined ? undefined : storedWidget(mode, `${seq}:entry`);\n\t\t\tif (kept) mode.chatContainer.addChild(kept);\n\t\t\telse mode.addCustomEntryToChat(step.entry);\n\t\t}\n\t\treturn;\n\t}\n\tif (step.kind === \"cost\") {\n\t\tmode.addCompactionCostNotice(step.type, step.usage);\n\t\treturn;\n\t}\n\tconst { entry } = step;\n\tconst kept = saved || adopted ? undefined : storedWidget(mode, widgetKey(entry));\n\tif (kept) addChatTranscriptEntry(mode.chatContainer, kept, entry.role);\n\tconst component = adopted ?? kept ?? mode.addRenderedChatEntry(entry);\n\tif (!saved && entry.kind === \"tool\" && isGroupedToolComponent(component)) {\n\t\tconst grouping = mainToolGrouping(mode);\n\t\tgrouping.tracker.bind(entry.toolCallId, groupedRowSink(component, entry), component);\n\t\tif (latest) grouping.lastMember = component;\n\t}\n\tif (entry.kind === \"assistant\" && !adopted) addServiceTierWarnings(mode, entry.message);\n\tif (step.notices && !adopted) paintReplyNotices(mode, step.notices);\n\tif (!saved && entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\tmode.pendingTools.set(entry.toolCallId, component);\n\t}\n}\n\n/** A cost notice follows every row of its saved entry. */\nconst COST_BLOCK = Number.MAX_SAFE_INTEGER;\n\n/** The saved entry and sub-block of a saved row key (`seq:block`, `seq:entry` or `seq:cost`). */\nfunction savedLeaf(key: string): { seq: number; block: number } {\n\tconst [seq, block] = key.split(\":\");\n\treturn { seq: Number(seq), block: block === \"entry\" ? 0 : block === \"cost\" ? COST_BLOCK : Number(block) };\n}\n\n/**\n * Render an archived page on its own. Never register historical tools as pending in the live turn. When a later page\n * follows (`adjacent.newer`), calls the page ends with wait for it: their results start that page.\n *\n * With `copy`, the rows are drawn for a copy, not mounted: each row's saved position is noted there instead of\n * keeping its renderer, a kept instance is reused as it is, the page joins no mounted page, and the reads its edge\n * cards need are left in `copy.settled`. Mounted, a card whose call and result fall on different pages is marked\n * provisional: what it shows depends on the pages mounted, so a selection draws its entry again for a copy.\n */\nfunction savedChatComponents(\n\tmode: InteractiveModeBase,\n\tentries: SessionEntry[],\n\tseqs: number[],\n\texceptions: SavedRendererInstances,\n\tadjacent: { readonly older?: string; readonly newer?: string } | undefined,\n\tcopy?: SavedCopyDraw,\n\trecords?: SavedPageRecords,\n\tearlier?: SavedPageEarlier,\n): Component[] {\n\tconst scratch = new Container();\n\t// Each page draws after earlier rows, as the whole transcript does: its first message keeps its spacing.\n\tscratch.addChild(new Spacer(0));\n\tconst chat = mode.chatContainer;\n\ttry {\n\t\tmode.chatContainer = scratch;\n\t\tconst saved = {\n\t\t\tseqs: new Map(entries.map((e, i) => [e, seqs[i]!])),\n\t\t\towners: new WeakMap<object, string>(),\n\t\t\tearlier,\n\t\t};\n\t\t// The page's saved lines go where the whole chat draws them: after the last row of their entry's group.\n\t\tconst layout = records ? new ChatReaderLayout(entries, scratch, { root: records.root }) : undefined;\n\t\tconst steps = planTranscript(mode, entries, { saved }, layout);\n\t\t/** Each drawn row's saved leaf, for the saved lines drawn after it. */\n\t\tconst leaves = new Map<Component, HistoryLeaf>();\n\t\tconst held = new Set(\n\t\t\tadjacent?.newer || copy?.edges.newer\n\t\t\t\t? callsAwaitingLaterResults(steps.flatMap((step) => (step.kind === \"entry\" ? [step.entry] : [])))\n\t\t\t\t: [],\n\t\t);\n\t\tconst calls = new SavedPageCallsBuilder(mode, chat, seqs, exceptions, copy !== undefined);\n\t\tconst mark = (components: readonly Component[], key: string, provisional: boolean) => {\n\t\t\tconst { seq, block } = savedLeaf(key);\n\t\t\tfor (let part = 0; part < components.length; part++)\n\t\t\t\tleaves.set(components[part]!, { source: exceptions.source, seq, block, part });\n\t\t\tfor (let part = 0; part < components.length; part++)\n\t\t\t\tif (copy) copy.positions.set(components[part]!, { source: exceptions.source, seq, block, part });\n\t\t\t\telse\n\t\t\t\t\tWindowedContainer.markHistoryComponent(\n\t\t\t\t\t\tcomponents[part]!,\n\t\t\t\t\t\texceptions.source,\n\t\t\t\t\t\tseq,\n\t\t\t\t\t\tblock,\n\t\t\t\t\t\tpart,\n\t\t\t\t\t\tprovisional,\n\t\t\t\t\t);\n\t\t};\n\t\tfor (const step of steps) {\n\t\t\tconst key =\n\t\t\t\tstep.kind !== \"cost\"\n\t\t\t\t\t? saved.owners.get(step.entry)\n\t\t\t\t\t: step.seq === undefined\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: `${step.seq}:cost`;\n\t\t\tconst index = scratch.children.length;\n\t\t\tif (step.kind === \"entry\" && step.entry.kind === \"tool\" && held.has(step.entry)) {\n\t\t\t\tconst slot = calls.hold(step.entry, key);\n\t\t\t\tscratch.addChild(slot);\n\t\t\t\tif (key) mark([slot], key, true);\n\t\t\t\tlayout?.paint(step.entry, scratch, index);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst kept = key && (copy ? exceptions.peek(key) : exceptions.get(key));\n\t\t\tif (kept) for (const component of kept) scratch.addChild(component);\n\t\t\telse addTranscriptStep(mode, step, false, true);\n\t\t\tlayout?.paint(step.kind === \"cost\" ? step : step.entry, scratch, index);\n\t\t\tconst drawn = scratch.children.slice(index);\n\t\t\tif (key) {\n\t\t\t\tconst { seq, block } = savedLeaf(key);\n\t\t\t\tfor (let part = 0; part < drawn.length; part++)\n\t\t\t\t\tleaves.set(drawn[part]!, { source: exceptions.source, seq, block, part });\n\t\t\t}\n\t\t\tconst alone = step.kind === \"entry\" && step.entry.kind === \"tool\" && isResultWithoutCall(step.entry);\n\t\t\tif (key) {\n\t\t\t\tif (!copy && !kept) exceptions.remember(key, drawn, savedLeaf(key));\n\t\t\t\tif (copy || alone) {\n\t\t\t\t\t// The widget is owned by its saved result, but the document places a paired card at its call.\n\t\t\t\t\tconst at =\n\t\t\t\t\t\tcopy && step.kind === \"entry\" && step.entry.kind === \"tool\" ? savedRowKey(step.entry) : undefined;\n\t\t\t\t\tmark(drawn, at ?? key, alone);\n\t\t\t\t}\n\t\t\t\tfollowChosenExpansion(mode, exceptions, key, drawn);\n\t\t\t}\n\t\t\tif (step.kind !== \"entry\") continue;\n\t\t\tif (key && alone && step.entry.kind === \"tool\")\n\t\t\t\tcalls.drewResult(\n\t\t\t\t\tstep.entry,\n\t\t\t\t\tdrawn,\n\t\t\t\t\tkey,\n\t\t\t\t\tcopy\n\t\t\t\t\t\t? () => {\n\t\t\t\t\t\t\t\tfor (const child of drawn) copy.positions.delete(child);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: undefined,\n\t\t\t\t);\n\t\t\tcalls.drew(step.entry);\n\t\t}\n\t\tif (layout && records) {\n\t\t\tlayout.apply(scratch, records.data);\n\t\t\tmarkRecordRows(scratch.children, leaves, (row, leaf) => {\n\t\t\t\tif (copy) copy.positions.set(row, leaf);\n\t\t\t\telse WindowedContainer.markHistoryComponent(row, leaf.source, leaf.seq, leaf.block, leaf.part);\n\t\t\t});\n\t\t}\n\t\tconst page = scratch.children.slice(1);\n\t\tif (copy) copy.settled = calls.settle(mode.sessionManager, copy.edges, copy.alive);\n\t\telse if (page.length > 0) page.unshift(calls.finish(mode.sessionManager, adjacent));\n\t\treturn page;\n\t} finally {\n\t\tmode.chatContainer = chat;\n\t}\n}\n\n/**\n * Give each saved line of a page the saved leaf right after the row it follows, so a selection or a copy places it\n * where the page shows it. A line ahead of every row of the page goes just before the first one.\n */\nfunction markRecordRows(\n\trows: readonly Component[],\n\tleaves: ReadonlyMap<Component, HistoryLeaf>,\n\tmark: (row: Component, leaf: HistoryLeaf) => void,\n): void {\n\tlet previous: HistoryLeaf | undefined;\n\tlet leading: Component[] = [];\n\tfor (const row of rows) {\n\t\tconst leaf = leaves.get(row);\n\t\tif (leaf) {\n\t\t\tfor (let i = 0; i < leading.length; i++) mark(leading[i]!, { ...leaf, part: leaf.part - leading.length + i });\n\t\t\tleading = [];\n\t\t\tprevious = leaf;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!chatDecorationRow(row)) continue;\n\t\tif (!previous) {\n\t\t\tleading.push(row);\n\t\t\tcontinue;\n\t\t}\n\t\tprevious = { ...previous, part: previous.part + 1 };\n\t\tmark(row, previous);\n\t}\n}\n\nfunction buildHistoryInSlices(\n\tmode: InteractiveModeBase,\n\thistory: readonly TranscriptStep[],\n\tend: Component,\n\tlayout?: WeakRef<ChatReaderLayout>,\n): void {\n\tconst chat = mode.chatContainer;\n\tlet remaining = history.length;\n\tlet before = end;\n\tconst build = (budgetMs: number, maxSteps: number): boolean => {\n\t\tconst at = chat.children.indexOf(before);\n\t\tif (at < 0 || remaining === 0) return false;\n\t\tconst deadline = performance.now() + budgetMs;\n\t\tconst built: Component[][] = [];\n\t\tconst preceding = new Spacer(0);\n\t\tconst scratch = new Container();\n\t\tmode.chatContainer = scratch;\n\t\ttry {\n\t\t\tfor (let steps = 0; remaining > 0 && steps < maxSteps; steps++) {\n\t\t\t\tscratch.children = [preceding];\n\t\t\t\tconst step = history[--remaining]!;\n\t\t\t\taddTranscriptStep(mode, step, false);\n\t\t\t\tlayout?.deref()?.paint(step.kind === \"cost\" ? step : step.entry, scratch, 1);\n\t\t\t\tbuilt.push(scratch.children.slice(1));\n\t\t\t\tif (performance.now() >= deadline) break;\n\t\t\t}\n\t\t} finally {\n\t\t\tmode.chatContainer = chat;\n\t\t}\n\t\tconst components = built.reverse().flat();\n\t\tif (components.length > 0) {\n\t\t\tif (chat instanceof StartupChatContainer) chat.insertChildren(at, components);\n\t\t\telse chat.children.splice(at, 0, ...components);\n\t\t\tbefore = components[0]!;\n\t\t\tconst messages = components.filter(isChatMessageComponent).length;\n\t\t\tif (messages > 0) (mode.ui as AltScreenMessageCounterHost).newMessages?.historyPrepended(messages);\n\t\t\tmode.ui.requestRender();\n\t\t}\n\t\tif (remaining > 0) return true;\n\t\tchat.removeChild(end);\n\t\treturn false;\n\t};\n\tconst tracked = trackChatHistoryBuild(chat, () => {\n\t\tbuild(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);\n\t\ttracked.done();\n\t});\n\tconst slice = (): void => {\n\t\tif (build(HISTORY_SLICE_BUDGET_MS, HISTORY_SLICE_STEPS)) setImmediate(slice);\n\t\telse tracked.done();\n\t};\n\tsetImmediate(slice);\n}\n\nInteractiveModeBase.prototype.renderSessionEntries = function (\n\tthis: InteractiveModeBase,\n\tsessionEntries: SessionEntry[],\n\toptions: {\n\t\tupdateFooter?: boolean;\n\t\tpopulateHistory?: boolean;\n\t\tpreserveViewportInput?: boolean;\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\t/** @internal The rows a reader parked above the end sees, taken out of the chat this replaces. */\n\t\tparked?: ParkedViewport;\n\t} = {},\n): void {\n\tif (!options.preserveViewportInput && !options.parked) this.resetTranscriptSelection();\n\tthis.pendingTools.clear();\n\tconst pendingEchoes = takeDeferredEchoes(this);\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\tconst parked = options.parked;\n\tinstallSavedChatHistory(this, sessionEntries, savedChatComponents, parked?.parked);\n\tnoteShownContext(this, sessionEntries);\n\tconst chat = this.chatContainer;\n\tconst regular = this.ui.mode !== \"fullscreen\";\n\tconst mount = sessionChatMount(this, this.sessionManager);\n\tlet layout = mount ? new ChatReaderLayout(sessionEntries, chat) : undefined;\n\tif (layout) bindChatLayout(this, layout);\n\t// Saved lines a parked reader still sees stay in their rows; this drawing does not show them twice.\n\tif (layout && parked?.shownRecords) layout.keepShown(parked.shownRecords);\n\tconst steps = planTranscript(this, sessionEntries, options, layout);\n\t// Only the drawn context's saved lines stay resident; a saved page reads its own with its rows.\n\tif (mount && layout) retainChatRecords(mount, layout.anchors());\n\tlet tailStart = this.ui.mode === \"fullscreen\" ? Math.max(0, steps.length - TAIL_STEPS) : 0;\n\tif (parked?.keys.size) {\n\t\t// The reader's kept rows are drawn now, in place, so the first frame shows them where they were.\n\t\tconst adopted = steps.findIndex((step) => {\n\t\t\tconst key = stepKey(step);\n\t\t\treturn key !== undefined && parked.keys.has(key);\n\t\t});\n\t\tif (adopted >= 0) {\n\t\t\ttailStart = Math.min(tailStart, adopted);\n\t\t\tadoptions.set(this, { ...parked, inserted: false });\n\t\t}\n\t}\n\tif (tailStart > 0) {\n\t\tconst historyEnd = new Spacer(0);\n\t\tthis.chatContainer.addChild(historyEnd);\n\t\tbuildHistoryInSlices(this, steps.slice(0, tailStart), historyEnd, layout && new WeakRef(layout));\n\t}\n\tconst adoption = adoptions.get(this);\n\ttry {\n\t\tfor (let index = tailStart; index < steps.length; index++) {\n\t\t\tconst step = steps[index]!;\n\t\t\tconst key = adoption && stepKey(step);\n\t\t\tconst start = chat.children.length;\n\t\t\taddTranscriptStep(this, step);\n\t\t\t// An adopted row is where the reader saw it, with the saved lines drawn after it then.\n\t\t\tif (key === undefined || !adoption?.keys.has(key))\n\t\t\t\tlayout?.paint(step.kind === \"cost\" ? step : step.entry, chat, start);\n\t\t}\n\t} finally {\n\t\tadoptions.delete(this);\n\t\tconst unused = [...(adoption?.inserted ? [] : (parked?.adopted ?? [])), ...(parked?.parked?.rows ?? [])].filter(\n\t\t\t(row) => !this.chatContainer.children.includes(row),\n\t\t);\n\t\tdisposeRemoteRenderers(unused);\n\t}\n\tif (mount && layout) {\n\t\tif (!regular && chat instanceof StartupChatContainer) {\n\t\t\tlayout.observeWindowWhenPresent(chat, mount, () => this.ui.requestRender());\n\t\t} else {\n\t\t\tconst page = readMountedAnchors(mount, () => layout?.anchors() ?? []);\n\t\t\tconst apply = (data?: ChatPageDecorations) => {\n\t\t\t\tconst changed = data !== undefined && layout?.apply(chat, data) === true;\n\t\t\t\tlayout = undefined;\n\t\t\t\treturn changed;\n\t\t\t};\n\t\t\t// The main-screen renderer writes the rows into the one frame it may hold for them; nothing renders again.\n\t\t\tif (chat instanceof StartupChatContainer)\n\t\t\t\tchat.awaitChatRecords(page, apply, this.ui, CHAT_RECORD_FIRST_PAINT_MS);\n\t\t\telse\n\t\t\t\tvoid page.then((data) => {\n\t\t\t\t\tif (apply(data)) this.ui.requestRender();\n\t\t\t\t});\n\t\t}\n\t}\n\trestoreDeferredEchoes(this, pendingEchoes);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.attachStartupNoticesContainer = function (\n\tthis: InteractiveModeBase,\n\toptions: { resetDetached?: boolean } = {},\n): void {\n\tconst disclosureIndex = this.chatContainer.children.indexOf(this.resourceDisclosureContainer);\n\tconst noticesIndex = this.chatContainer.children.indexOf(this.startupNoticesContainer);\n\tif (disclosureIndex >= 0 && noticesIndex >= 0) return;\n\tif (disclosureIndex < 0) {\n\t\tif (options.resetDetached) this.resourceDisclosureContainer.clear();\n\t\tif (noticesIndex >= 0) this.chatContainer.children.splice(noticesIndex, 0, this.resourceDisclosureContainer);\n\t\telse this.chatContainer.addChild(this.resourceDisclosureContainer);\n\t}\n\tif (noticesIndex < 0) {\n\t\tif (options.resetDetached) this.startupNoticesContainer.clear();\n\t\tthis.chatContainer.addChild(this.startupNoticesContainer);\n\t}\n};\n\nconst renderedSessionIds = new WeakMap<InteractiveModeBase, string>();\nconst nativeHistoryHints = new WeakMap<Container, Component>();\n\n/** The terminal owns scrollback in regular mode: a resumed window cannot paint rows it never printed. */\nfunction showNativeHistoryHint(mode: InteractiveModeBase): void {\n\tconst notices = mode.startupNoticesContainer;\n\tconst previous = nativeHistoryHints.get(notices);\n\tif (mode.ui.mode !== \"regular\" || !mode.sessionManager.getOmittedHistoryTotals?.()?.totalMessages) {\n\t\tif (previous) notices.removeChild(previous);\n\t\treturn;\n\t}\n\tconst hint =\n\t\tprevious ??\n\t\tnew ThemedText(\n\t\t\t() =>\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"dim\",\n\t\t\t\t\t\"Older messages: use terminal scrollback, ask the agent to read history://, or use /export.\",\n\t\t\t\t),\n\t\t\t1,\n\t\t\t0,\n\t\t);\n\tif (!previous) nativeHistoryHints.set(notices, hint);\n\tif (!notices.children.includes(hint)) notices.addChild(hint);\n}\n\nexport function clearChatForRerender(mode: InteractiveModeBase): void {\n\treleaseSavedChatHistory(mode);\n\tconst renderer = mode.ui as AltScreenMessageCounterHost;\n\tif (mode.chatContainer.children.length > 0) {\n\t\trenderer.newMessages?.observe(renderer.isFollowingOutput !== false, countChatMessages(mode.chatContainer));\n\t}\n\tmode.chatContainer.clear();\n}\n\nInteractiveModeBase.prototype.renderInitialMessages = function (this: InteractiveModeBase): void {\n\tconst sessionId = this.sessionManager.getSessionId();\n\tconst previousSessionId = renderedSessionIds.get(this);\n\trenderedSessionIds.set(this, sessionId);\n\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\tif (previousSessionId !== sessionId) renderer.newMessages?.reset();\n\tthis.attachStartupNoticesContainer({ resetDetached: true });\n\tshowNativeHistoryHint(this);\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { updateFooter: true, populateHistory: true });\n\trenderProjectTrustWarningIfNeeded(this);\n\trefreshInteractiveTasks(this);\n\tif (previousSessionId === sessionId) {\n\t\trenderer.newMessages?.replaced(countChatMessages(this.chatContainer));\n\t}\n};\n\n/**\n * Says that the session's project is untrusted, for as long as it is. It reads the trust when the chat paints: an\n * isolated interactive host learns its engine's decision after the chat was drawn, and a decision that is still to be\n * made is neither trusted nor untrusted.\n */\nclass ProjectTrustWarning implements Component {\n\tprivate readonly visible: () => boolean;\n\tprivate readonly lines: Component[];\n\n\tconstructor(visible: () => boolean, separated: boolean) {\n\t\tthis.visible = visible;\n\t\tconst text = new ThemedText(\n\t\t\t() =>\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"warning\",\n\t\t\t\t\t`This project is not trusted. Project ${CONFIG_DIR_NAME} resources and packages are ignored. Use /trust to save a trust decision, then restart ${APP_NAME}.`,\n\t\t\t\t),\n\t\t\t1,\n\t\t\t0,\n\t\t);\n\t\tthis.lines = separated ? [new Spacer(1), text] : [text];\n\t}\n\n\trender(width: number): string[] {\n\t\treturn this.visible() ? this.lines.flatMap((line) => line.render(width)) : [];\n\t}\n\n\tinvalidate(): void {\n\t\tfor (const line of this.lines) line.invalidate();\n\t}\n}\n\n/** The chat slot of the warning a mode last drew, while the chat still holds it. */\nconst projectTrustWarningSlots = new WeakMap<InteractiveModeBase, Container>();\n\nfunction projectTrustWarningShows(mode: InteractiveModeBase, requiresTrust: boolean): boolean {\n\treturn projectTrustWarningVisible({\n\t\ttrusted: mode.settingsManager.isProjectTrusted(),\n\t\tpending: mode.runtimeHost?.isProjectTrustPending?.() === true,\n\t\trequiresTrust,\n\t});\n}\n\n/**\n * Adds the warning at the end of the chat when the session's project is untrusted and has resources that need trust.\n * A trusted session, or one whose decision is still to be made, gets none here: refreshProjectTrustWarning adds it if\n * the decision turns out untrusted.\n */\nfunction renderProjectTrustWarningIfNeeded(mode: InteractiveModeBase): void {\n\tif (!projectTrustWarningShows(mode, true)) return;\n\tconst chat = mode.chatContainer;\n\tconst separated = chat.children.length > 0;\n\tconst slot = new Container();\n\tchat.addChild(slot);\n\tprojectTrustWarningSlots.set(mode, slot);\n\tconst settle = (requiresTrust: boolean) => {\n\t\tif (!chat.children.includes(slot)) return;\n\t\tif (!requiresTrust) {\n\t\t\tchat.removeChild(slot);\n\t\t\treturn;\n\t\t}\n\t\tslot.addChild(new ProjectTrustWarning(() => projectTrustWarningShows(mode, true), separated));\n\t\tmode.ui.requestRender();\n\t};\n\tvoid hasTrustRequiringProjectResourcesAsync(mode.sessionManager.getCwd()).then(settle, () => settle(false));\n}\n\nInteractiveModeBase.prototype.appendProjectTrustWarning = function (this: InteractiveModeBase): void {\n\trenderProjectTrustWarningIfNeeded(this);\n};\n\nInteractiveModeBase.prototype.refreshProjectTrustWarning = function (this: InteractiveModeBase): void {\n\t// Before the chat shows this session, its own drawing adds the warning.\n\tif (renderedSessionIds.get(this) !== this.sessionManager.getSessionId()) return;\n\tconst slot = projectTrustWarningSlots.get(this);\n\tif (slot && this.chatContainer.children.includes(slot)) {\n\t\t// The warning in the chat reads the trust when it paints.\n\t\tthis.chatContainer.invalidate();\n\t} else {\n\t\trenderProjectTrustWarningIfNeeded(this);\n\t}\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.getUserInput = async function (\n\tthis: InteractiveModeBase,\n): Promise<InteractiveSubmission> {\n\twhile (true) {\n\t\tconst queuedInput = this.pendingUserInputs.shift();\n\t\tif (queuedInput !== undefined) {\n\t\t\treturn queuedInput;\n\t\t}\n\n\t\tif (this.startupReplayActiveInput) {\n\t\t\tawait this.drainStartupReplayCommands();\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.onInputCallback = (submission: InteractiveSubmission) => {\n\t\t\t\tthis.onInputCallback = undefined;\n\t\t\t\tresolve(submission);\n\t\t\t};\n\t\t\tif (!this.inputHandlerReadyRecorded) {\n\t\t\t\tthis.inputHandlerReadyRecorded = true;\n\t\t\t\trecordTimeSinceReset(\"interactive-input-handler-ready\");\n\t\t\t\tmarkLifecycleTiming(\"interactive-input-handler-ready\");\n\t\t\t\tvoid (async () => {\n\t\t\t\t\tawait yieldToEventLoop();\n\t\t\t\t\tthis.footerDataProvider.startGitWatcher();\n\t\t\t\t\t// pi parity: the changelog/first-run notices need nothing from\n\t\t\t\t\t// extensions — render them right after the input handler is ready\n\t\t\t\t\t// instead of gating them behind the deferred extension reload (or,\n\t\t\t\t\t// when the user types immediately, behind the whole agent turn).\n\t\t\t\t\tawait preloadChangelog(getChangelogPath());\n\t\t\t\t\tthis.showStartupNoticesIfNeeded(this.startupNoticesContainer);\n\t\t\t\t\tif (this.deferredStartupPending) {\n\t\t\t\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t\t\t\t}\n\t\t\t\t})().catch((error) => {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tconsole.error(`Deferred input-readiness startup task failed: ${message}`);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n};\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function (\n\tthis: InteractiveModeBase,\n\toptions: {\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\tresetStartupDisclosure?: boolean;\n\t\tpreserveViewportInput?: boolean;\n\t} = {},\n): void {\n\t// Generic rebuilds keep the same session: pending fd/rg callbacks still own\n\t// this transcript. Full session replacements invalidate their generation in\n\t// renderCurrentSessionState() before rebuilding the replacement transcript.\n\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\tthis.managedToolStatusStarted = false;\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\t// Count what arrived unread before the rows the reader sees leave the chat with the rest.\n\tif (this.chatContainer.children.length > 0) {\n\t\trenderer.newMessages?.observe(renderer.isFollowingOutput !== false, countChatMessages(this.chatContainer));\n\t}\n\t// A compaction while the reader is above the end keeps what they see, their selection and their place.\n\tconst parked = parkViewport(this, entries);\n\tholdCompactionWidgets(this, entries, parked);\n\tclearChatForRerender(this);\n\tif (options.resetStartupDisclosure) this.resourceDisclosureContainer.clear();\n\tthis.attachStartupNoticesContainer();\n\tshowNativeHistoryHint(this);\n\tthis.renderSessionEntries(entries, parked ? { ...options, parked } : options);\n\t// A caller that suppresses the persisted boundary appends the live one, then the warning (appendProjectTrustWarning).\n\tif (!options.suppressCompactionBoundary) renderProjectTrustWarningIfNeeded(this);\n\trenderer.newMessages?.replaced(countChatMessages(this.chatContainer));\n};\n\nfunction isSynthesizedCompactionBoundary(message: AgentMessage | undefined, result: VerbatimCompactionResult): boolean {\n\tif (message?.role !== \"custom\" || message.customType !== \"compaction\" || !message.display) return false;\n\tconst details = message.details as { strategy?: string } | undefined;\n\tif (details?.strategy !== \"verbatim-lines\") return false;\n\tconst content = Array.isArray(message.content)\n\t\t? message.content\n\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t.map((block) => block.text)\n\t\t\t\t.join(\"\\n\")\n\t\t: message.content;\n\treturn stripVerbatimCompactionPrefix(content) === result.compactedText;\n}\n"]}