zidane-ui 9.2.3 → 9.4.0

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 (354) hide show
  1. package/dist/adapters/live.d.ts +8 -0
  2. package/dist/adapters/live.js +19 -8
  3. package/dist/adapters/server-composer-host.js +22 -9
  4. package/dist/adapters/server-git-host.js +5 -2
  5. package/dist/adapters/server-host.js +158 -27
  6. package/dist/adapters/server-machines-host.js +7 -0
  7. package/dist/adapters/server-media.d.ts +9 -1
  8. package/dist/adapters/server-media.js +14 -1
  9. package/dist/adapters/server-session-host.js +49 -0
  10. package/dist/adapters/server-settings-sections.js +4 -1
  11. package/dist/adapters/sse-host.js +3 -0
  12. package/dist/adapters/sse-protocol.d.ts +10 -0
  13. package/dist/appearance/ZoomIndicator.js +5 -8
  14. package/dist/chat/HostTranscript.d.ts +0 -12
  15. package/dist/chat/HostTranscript.js +20 -1
  16. package/dist/chat/SessionStreamsProvider.d.ts +9 -1
  17. package/dist/chat/SessionStreamsProvider.js +11 -2
  18. package/dist/chat/Transcript.d.ts +21 -11
  19. package/dist/chat/Transcript.js +346 -161
  20. package/dist/chat/composer/ModelOptionsPicker.js +6 -2
  21. package/dist/chat/composer/ModelPicker.d.ts +1 -1
  22. package/dist/chat/composer/PlacePicker.d.ts +3 -1
  23. package/dist/chat/composer/PlacePicker.js +5 -1
  24. package/dist/chat/composer/use-draft-target.js +15 -3
  25. package/dist/chat/headless/block-runs.js +26 -1
  26. package/dist/chat/headless/chip-views.js +1 -1
  27. package/dist/chat/headless/draft-target.d.ts +28 -1
  28. package/dist/chat/headless/draft-target.js +22 -1
  29. package/dist/chat/headless/host.d.ts +43 -7
  30. package/dist/chat/headless/hosts.d.ts +4 -0
  31. package/dist/chat/headless/index.d.ts +27 -26
  32. package/dist/chat/headless/index.js +15 -14
  33. package/dist/chat/headless/labels.d.ts +17 -0
  34. package/dist/chat/headless/labels.js +17 -0
  35. package/dist/chat/headless/markdown-chunks.d.ts +2 -1
  36. package/dist/chat/headless/markdown-chunks.js +12 -20
  37. package/dist/chat/headless/markdown-scan.d.ts +64 -0
  38. package/dist/chat/headless/markdown-scan.js +119 -0
  39. package/dist/chat/headless/markdown-stream.d.ts +64 -0
  40. package/dist/chat/headless/markdown-stream.js +143 -0
  41. package/dist/chat/headless/output-pager.d.ts +68 -0
  42. package/dist/chat/headless/output-pager.js +113 -0
  43. package/dist/chat/headless/prompt-origin.d.ts +2 -0
  44. package/dist/chat/headless/prompt-origin.js +6 -2
  45. package/dist/chat/headless/session-list.d.ts +10 -0
  46. package/dist/chat/headless/sidebar/activity.d.ts +14 -0
  47. package/dist/chat/headless/sidebar/activity.js +32 -0
  48. package/dist/chat/headless/sidebar/directory.d.ts +19 -2
  49. package/dist/chat/headless/sidebar/directory.js +19 -51
  50. package/dist/chat/headless/sidebar/environment.d.ts +15 -4
  51. package/dist/chat/headless/sidebar/environment.js +27 -9
  52. package/dist/chat/headless/sidebar/index.d.ts +2 -2
  53. package/dist/chat/headless/sidebar/index.js +2 -2
  54. package/dist/chat/headless/sidebar/labels.d.ts +19 -2
  55. package/dist/chat/headless/sidebar/labels.js +8 -1
  56. package/dist/chat/headless/sidebar/prewarm.d.ts +68 -0
  57. package/dist/chat/headless/sidebar/prewarm.js +114 -0
  58. package/dist/chat/headless/streams/actions.d.ts +4 -2
  59. package/dist/chat/headless/streams/actions.js +2 -1
  60. package/dist/chat/headless/streams/event-bytes.d.ts +17 -0
  61. package/dist/chat/headless/streams/event-bytes.js +46 -0
  62. package/dist/chat/headless/streams/live-events.d.ts +25 -1
  63. package/dist/chat/headless/streams/live-events.js +53 -2
  64. package/dist/chat/headless/streams/selectors.d.ts +3 -0
  65. package/dist/chat/headless/streams/selectors.js +8 -1
  66. package/dist/chat/headless/streams/session-streams.d.ts +15 -3
  67. package/dist/chat/headless/streams/session-streams.js +31 -3
  68. package/dist/chat/headless/streams/store.d.ts +45 -6
  69. package/dist/chat/headless/streams/store.js +85 -31
  70. package/dist/chat/headless/streams/transcript-map.d.ts +57 -0
  71. package/dist/chat/headless/streams/transcript-map.js +85 -0
  72. package/dist/chat/headless/streams/transcript.d.ts +4 -2
  73. package/dist/chat/headless/streams/transcript.js +19 -7
  74. package/dist/chat/headless/streams/types.d.ts +2 -1
  75. package/dist/chat/headless/transcript/batch.js +5 -1
  76. package/dist/chat/headless/transcript/blob-media.d.ts +15 -0
  77. package/dist/chat/headless/transcript/blob-media.js +23 -0
  78. package/dist/chat/headless/transcript/collapse.d.ts +10 -0
  79. package/dist/chat/headless/transcript/collapse.js +35 -6
  80. package/dist/chat/headless/transcript/derive.d.ts +98 -0
  81. package/dist/chat/headless/transcript/derive.js +89 -0
  82. package/dist/chat/headless/transcript/exchange-media.d.ts +3 -1
  83. package/dist/chat/headless/transcript/exchange-media.js +8 -5
  84. package/dist/chat/headless/transcript/fold-attachments.d.ts +2 -0
  85. package/dist/chat/headless/transcript/fold-attachments.js +3 -2
  86. package/dist/chat/headless/transcript/fold.d.ts +2 -1
  87. package/dist/chat/headless/transcript/fold.js +16 -6
  88. package/dist/chat/headless/transcript/incremental.d.ts +53 -0
  89. package/dist/chat/headless/transcript/incremental.js +181 -0
  90. package/dist/chat/headless/transcript/index.d.ts +2 -2
  91. package/dist/chat/headless/transcript/index.js +2 -2
  92. package/dist/chat/headless/transcript/nesting.js +2 -1
  93. package/dist/chat/headless/transcript/rail.d.ts +50 -1
  94. package/dist/chat/headless/transcript/rail.js +165 -23
  95. package/dist/chat/headless/transcript/rows.d.ts +5 -1
  96. package/dist/chat/headless/transcript/run-failures.js +2 -1
  97. package/dist/chat/headless/transcript/seams.d.ts +78 -0
  98. package/dist/chat/headless/transcript/seams.js +116 -0
  99. package/dist/chat/headless/transcript/tool-media.d.ts +6 -7
  100. package/dist/chat/headless/transcript/tool-media.js +27 -9
  101. package/dist/chat/index.d.ts +9 -8
  102. package/dist/chat/index.js +18 -17
  103. package/dist/chat/sidebar/ProjectIcon.js +1 -1
  104. package/dist/chat/sidebar/RowChips.js +2 -2
  105. package/dist/chat/sidebar/SessionSidebar.d.ts +6 -0
  106. package/dist/chat/sidebar/SessionSidebar.js +23 -16
  107. package/dist/chat/sidebar/SidebarFilterMenu.js +0 -1
  108. package/dist/chat/sidebar/SidebarFold.js +17 -16
  109. package/dist/chat/sidebar/SidebarFooter.d.ts +8 -5
  110. package/dist/chat/sidebar/SidebarFooter.js +6 -6
  111. package/dist/chat/sidebar/SidebarSessionRow.d.ts +7 -1
  112. package/dist/chat/sidebar/SidebarSessionRow.js +11 -8
  113. package/dist/chat/sidebar/session-menu.d.ts +4 -0
  114. package/dist/chat/sidebar/session-menu.js +14 -2
  115. package/dist/chat/sidebar/sidebar-live.js +28 -4
  116. package/dist/chat/sidebar/useInboxRows.js +6 -6
  117. package/dist/chat/sidebar/useInboxTriage.js +50 -47
  118. package/dist/chat/sidebar/useSessionSearch.js +19 -18
  119. package/dist/chat/testing/contract.d.ts +5 -3
  120. package/dist/chat/testing/contract.js +66 -1
  121. package/dist/chat/transcript/DiffLines.d.ts +6 -1
  122. package/dist/chat/transcript/DiffLines.js +35 -20
  123. package/dist/chat/transcript/EditDiffBlock.d.ts +5 -1
  124. package/dist/chat/transcript/EditDiffBlock.js +89 -30
  125. package/dist/chat/transcript/FileChip.js +28 -0
  126. package/dist/chat/transcript/LazyRow.d.ts +40 -40
  127. package/dist/chat/transcript/LazyRow.js +100 -149
  128. package/dist/chat/transcript/MermaidDiagram.js +2 -1
  129. package/dist/chat/transcript/PromptEcho.js +3 -11
  130. package/dist/chat/transcript/SessionChip.d.ts +11 -0
  131. package/dist/chat/transcript/SessionChip.js +34 -0
  132. package/dist/chat/transcript/SubagentBlock.js +3 -2
  133. package/dist/chat/transcript/TranscriptRail.d.ts +25 -2
  134. package/dist/chat/transcript/TranscriptRail.js +175 -17
  135. package/dist/chat/transcript/TranscriptRow.d.ts +4 -7
  136. package/dist/chat/transcript/TranscriptRow.js +4 -3
  137. package/dist/chat/transcript/actions.d.ts +37 -1
  138. package/dist/chat/transcript/actions.js +27 -1
  139. package/dist/chat/transcript/chip-details.d.ts +11 -0
  140. package/dist/chat/transcript/chip-details.js +17 -1
  141. package/dist/chat/transcript/clipped-output.d.ts +58 -0
  142. package/dist/chat/transcript/clipped-output.js +131 -0
  143. package/dist/chat/transcript/fold-attachments.js +10 -5
  144. package/dist/chat/transcript/fold-worker.js +5 -3
  145. package/dist/chat/transcript/fold.js +13 -4
  146. package/dist/chat/transcript/index.d.ts +11 -10
  147. package/dist/chat/transcript/index.js +10 -9
  148. package/dist/chat/transcript/markdown-cache.d.ts +17 -2
  149. package/dist/chat/transcript/markdown-cache.js +48 -4
  150. package/dist/chat/transcript/markdown.js +110 -55
  151. package/dist/chat/transcript/media-gallery.d.ts +3 -2
  152. package/dist/chat/transcript/media-gallery.js +19 -19
  153. package/dist/chat/transcript/messages.js +5 -4
  154. package/dist/chat/transcript/notices.js +2 -1
  155. package/dist/chat/transcript/prompt.d.ts +1 -1
  156. package/dist/chat/transcript/prompt.js +6 -4
  157. package/dist/chat/transcript/prose.js +2 -1
  158. package/dist/chat/transcript/root-items.d.ts +96 -0
  159. package/dist/chat/transcript/root-items.js +180 -0
  160. package/dist/chat/transcript/row-mount.d.ts +184 -0
  161. package/dist/chat/transcript/row-mount.js +532 -0
  162. package/dist/chat/transcript/row-parking.d.ts +152 -0
  163. package/dist/chat/transcript/row-parking.js +171 -0
  164. package/dist/chat/transcript/row-ui-state.d.ts +37 -0
  165. package/dist/chat/transcript/row-ui-state.js +53 -0
  166. package/dist/chat/transcript/run-rows.js +3 -2
  167. package/dist/chat/transcript/script-input.d.ts +1 -1
  168. package/dist/chat/transcript/tasks.js +3 -2
  169. package/dist/chat/transcript/tool-media.d.ts +4 -2
  170. package/dist/chat/transcript/tool-media.js +15 -7
  171. package/dist/chat/transcript/tool-parts.d.ts +27 -4
  172. package/dist/chat/transcript/tool-parts.js +31 -6
  173. package/dist/chat/transcript/tool-payload.js +26 -11
  174. package/dist/chat/transcript/tool-row.d.ts +2 -1
  175. package/dist/chat/transcript/tool-row.js +38 -19
  176. package/dist/chat/transcript/use-transcript-rows.d.ts +25 -8
  177. package/dist/chat/transcript/use-transcript-rows.js +28 -46
  178. package/dist/chat/transcript/useHistoryBackfill.d.ts +42 -0
  179. package/dist/chat/transcript/useHistoryBackfill.js +170 -0
  180. package/dist/chat/transcript/useStickToBottom.js +2 -3
  181. package/dist/chat/transcript/useTranscriptFind.js +2 -4
  182. package/dist/chat/transcript/useTranscriptScroll.d.ts +7 -4
  183. package/dist/chat/transcript/useTranscriptScroll.js +12 -1
  184. package/dist/chat/transcript/useTranscriptSearch.d.ts +2 -2
  185. package/dist/chat/transcript/useTranscriptSearch.js +35 -19
  186. package/dist/chat/transcript/useTranscriptSelectionCopy.d.ts +5 -5
  187. package/dist/chat/transcript/useTranscriptSelectionCopy.js +28 -7
  188. package/dist/chat/transcript/view-scope.d.ts +26 -6
  189. package/dist/chat/transcript/view-scope.js +106 -20
  190. package/dist/code/editor/FileTree.d.ts +2 -0
  191. package/dist/code/editor/FileTree.js +1 -1
  192. package/dist/code/editor/FileView.js +16 -25
  193. package/dist/code/editor/find/useFind.js +17 -17
  194. package/dist/code/editor/useCodeDocument.js +22 -19
  195. package/dist/code/editor/useDetachCleanup.js +4 -3
  196. package/dist/code/use-highlighted-html.js +12 -13
  197. package/dist/components/IconButton.d.ts +3 -1
  198. package/dist/components/IconButton.js +7 -2
  199. package/dist/components/IconButtonTip.d.ts +3 -1
  200. package/dist/components/IconButtonTip.js +2 -1
  201. package/dist/components/RowActionsMenu.js +7 -14
  202. package/dist/components/Tooltip.d.ts +4 -1
  203. package/dist/components/Tooltip.js +8 -6
  204. package/dist/components/assign-ref.d.ts +8 -0
  205. package/dist/components/assign-ref.js +12 -0
  206. package/dist/components/floating/FloatingSurface.js +2 -2
  207. package/dist/components/floating/HoverCard.js +32 -14
  208. package/dist/components/floating/Popover.js +4 -7
  209. package/dist/components/floating/useAnchoredPosition.d.ts +5 -3
  210. package/dist/components/floating/useAnchoredPosition.js +7 -7
  211. package/dist/components/object-key.d.ts +7 -0
  212. package/dist/components/object-key.js +18 -0
  213. package/dist/components/palette/PaletteList.js +2 -7
  214. package/dist/components/tooltip-arming.d.ts +3 -0
  215. package/dist/components/tooltip-arming.js +8 -1
  216. package/dist/core.css +3 -3
  217. package/dist/dist/{index-E1Z0aPmi.d.ts → index-BheVJOLc.d.ts} +3 -1
  218. package/dist/dist/index.d.ts +2 -2
  219. package/dist/files/FilesTab.js +0 -1
  220. package/dist/files/TreeColumn.d.ts +2 -4
  221. package/dist/files/TreeColumn.js +0 -5
  222. package/dist/files/headless/host.d.ts +3 -7
  223. package/dist/files/headless/labels.d.ts +0 -1
  224. package/dist/files/headless/labels.js +0 -1
  225. package/dist/files/headless/workspace-diff.js +1 -1
  226. package/dist/files/useCodeReview.js +1 -3
  227. package/dist/files/useFilesDiagnostics.d.ts +1 -1
  228. package/dist/files/useFilesDiagnostics.js +4 -11
  229. package/dist/files/useOpenFiles.js +9 -12
  230. package/dist/files/useWorkspace.d.ts +5 -7
  231. package/dist/files/useWorkspace.js +4 -15
  232. package/dist/git/GitBar.js +5 -3
  233. package/dist/git/MoveSessionDialog.d.ts +18 -8
  234. package/dist/git/MoveSessionDialog.js +32 -53
  235. package/dist/git/MoveToDialog.d.ts +61 -0
  236. package/dist/git/MoveToDialog.js +240 -0
  237. package/dist/git/SandboxManager.js +9 -4
  238. package/dist/git/SyncChip.js +11 -4
  239. package/dist/git/TeleportSessionDialog.d.ts +69 -0
  240. package/dist/git/TeleportSessionDialog.js +440 -0
  241. package/dist/git/headless/host.d.ts +14 -0
  242. package/dist/git/headless/index.d.ts +2 -1
  243. package/dist/git/headless/index.js +2 -1
  244. package/dist/git/headless/labels.d.ts +44 -1
  245. package/dist/git/headless/labels.js +50 -0
  246. package/dist/git/headless/sandboxes.d.ts +1 -1
  247. package/dist/git/headless/sandboxes.js +4 -3
  248. package/dist/git/headless/teleport.d.ts +76 -0
  249. package/dist/git/headless/teleport.js +19 -0
  250. package/dist/git/index.d.ts +4 -2
  251. package/dist/git/index.js +4 -2
  252. package/dist/git/useEnvironmentChoices.d.ts +5 -2
  253. package/dist/git/useEnvironmentChoices.js +12 -4
  254. package/dist/hooks/useLatest.d.ts +8 -0
  255. package/dist/hooks/useLatest.js +17 -0
  256. package/dist/hooks/useMinuteTick.d.ts +6 -2
  257. package/dist/hooks/useMinuteTick.js +12 -6
  258. package/dist/hooks/useNearViewport.js +11 -8
  259. package/dist/index.d.ts +3 -2
  260. package/dist/index.js +2 -1
  261. package/dist/keybindings/KeybindingsProvider.js +3 -4
  262. package/dist/keybindings/headless/catalog.d.ts +1 -1
  263. package/dist/keybindings/headless/catalog.js +18 -0
  264. package/dist/machines/AddServerForm.js +55 -3
  265. package/dist/machines/Banners.d.ts +2 -2
  266. package/dist/machines/Banners.js +3 -3
  267. package/dist/machines/DaemonMenu.js +1 -3
  268. package/dist/machines/HostsSection.js +5 -1
  269. package/dist/machines/OrganizationPanel.d.ts +25 -0
  270. package/dist/machines/OrganizationPanel.js +266 -0
  271. package/dist/machines/PersonalLayerPanel.d.ts +32 -0
  272. package/dist/machines/PersonalLayerPanel.js +360 -0
  273. package/dist/machines/headless/fixture-host.d.ts +10 -0
  274. package/dist/machines/headless/fixture-host.js +44 -0
  275. package/dist/machines/headless/host.d.ts +21 -1
  276. package/dist/machines/headless/index.d.ts +3 -1
  277. package/dist/machines/headless/index.js +3 -1
  278. package/dist/machines/headless/labels.d.ts +55 -0
  279. package/dist/machines/headless/labels.js +58 -1
  280. package/dist/machines/headless/layer.d.ts +64 -0
  281. package/dist/machines/headless/layer.js +56 -0
  282. package/dist/machines/headless/organization.d.ts +38 -0
  283. package/dist/machines/headless/organization.js +44 -0
  284. package/dist/machines/index.d.ts +3 -1
  285. package/dist/machines/index.js +3 -1
  286. package/dist/machines/testing/contract.d.ts +25 -1
  287. package/dist/machines/testing/contract.js +97 -1
  288. package/dist/motion/grow.js +12 -13
  289. package/dist/motion/swap.js +2 -5
  290. package/dist/motion/use-flip-list.d.ts +14 -0
  291. package/dist/motion/use-flip-list.js +17 -12
  292. package/dist/palette/headless/app-sources.js +37 -0
  293. package/dist/palette/headless/labels.js +3 -0
  294. package/dist/server/sse-handler.js +25 -2
  295. package/dist/session/DiffFileTree.js +1 -4
  296. package/dist/session/OpenSessionsDialog.d.ts +46 -0
  297. package/dist/session/OpenSessionsDialog.js +170 -0
  298. package/dist/session/PlanTracker.js +1 -2
  299. package/dist/session/ProjectHome.js +10 -9
  300. package/dist/session/RemindersPanel.js +10 -12
  301. package/dist/session/SecretsPanel.js +2 -1
  302. package/dist/session/SessionHeader.js +1 -0
  303. package/dist/session/SessionPeopleStack.d.ts +23 -0
  304. package/dist/session/SessionPeopleStack.js +65 -0
  305. package/dist/session/SessionPlaceMenu.js +5 -4
  306. package/dist/session/ShareSessionDialog.d.ts +32 -0
  307. package/dist/session/ShareSessionDialog.js +342 -0
  308. package/dist/session/TypingLine.d.ts +22 -0
  309. package/dist/session/TypingLine.js +31 -0
  310. package/dist/session/headless/host.d.ts +40 -1
  311. package/dist/session/headless/index.d.ts +4 -2
  312. package/dist/session/headless/index.js +3 -1
  313. package/dist/session/headless/labels.d.ts +49 -0
  314. package/dist/session/headless/labels.js +56 -0
  315. package/dist/session/headless/people.d.ts +29 -0
  316. package/dist/session/headless/people.js +53 -0
  317. package/dist/session/headless/place.d.ts +5 -0
  318. package/dist/session/headless/place.js +5 -1
  319. package/dist/session/headless/typing.d.ts +37 -0
  320. package/dist/session/headless/typing.js +60 -0
  321. package/dist/session/index.d.ts +5 -1
  322. package/dist/session/index.js +5 -1
  323. package/dist/settings/headless/fixture-performance.js +4 -2
  324. package/dist/settings/headless/performance.d.ts +4 -0
  325. package/dist/settings/headless/search.d.ts +1 -1
  326. package/dist/settings/headless/sections-host.d.ts +7 -2
  327. package/dist/settings/section.d.ts +15 -3
  328. package/dist/settings/section.js +15 -3
  329. package/dist/settings/sections/environments/EnvironmentsSection.js +30 -6
  330. package/dist/settings/sections/keybindings/labels.d.ts +3 -0
  331. package/dist/settings/sections/keybindings/labels.js +3 -0
  332. package/dist/settings/sections/keybindings/rows.js +12 -0
  333. package/dist/settings/sections/logs/LogsSection.js +5 -8
  334. package/dist/settings/sections/performance/PerformanceSection.js +8 -1
  335. package/dist/settings/sections/performance/labels.d.ts +2 -0
  336. package/dist/settings/sections/performance/labels.js +2 -0
  337. package/dist/styles.css +65 -9
  338. package/dist/terminal/HostTerminalSurface.js +28 -30
  339. package/dist/terminal/TerminalPanel.js +4 -12
  340. package/dist/terminal/TerminalProvider.d.ts +10 -2
  341. package/dist/terminal/TerminalProvider.js +10 -2
  342. package/dist/terminal/headless/labels.d.ts +0 -1
  343. package/dist/terminal/headless/labels.js +1 -2
  344. package/dist/terminal/headless/store.js +5 -1
  345. package/dist/views/headless/answers.d.ts +8 -2
  346. package/dist/views/headless/answers.js +58 -1
  347. package/dist/views/headless/placement.d.ts +78 -0
  348. package/dist/views/headless/placement.js +154 -44
  349. package/dist/workspace/LayoutBudget.js +1 -7
  350. package/package.json +2 -2
  351. package/src/styles/chat.css +3 -1
  352. package/src/styles/palette.css +3 -3
  353. package/src/styles/transcript.css +50 -5
  354. /package/dist/dist/{index-De9AbmxS.d.ts → index-ttmMvjgM.d.ts} +0 -0
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Paging through a tool result the host clipped for the wire: a pure model
3
+ * of what is loaded (the text from the start, the whole length), read one
4
+ * range at a time through the host (`ChatHost.toolOutputRange`). "Load full
5
+ * output" reads the first page, "Load more" the next one, "Load all" the
6
+ * rest, a few pages at a time and appended in order. Sizes and offsets are
7
+ * UTF-16 code units, as `ToolResultSlice` counts them.
8
+ */
9
+ import { Readable } from "./store.js";
10
+ import { ToolResultSlice } from "zidane/chat";
11
+ /** UTF-16 code units in one page of a clipped tool result: what "Load full output" and "Load more" each read. */
12
+ export declare const TOOL_OUTPUT_PAGE_SIZE = 65536;
13
+ /** A range of a tool result's text, in UTF-16 code units. */
14
+ export interface ToolOutputRange {
15
+ /** Where the range starts. */
16
+ offset: number;
17
+ /** How many code units it covers. */
18
+ length: number;
19
+ }
20
+ /** Reads one range of a call's result: `null` when the host holds no result for the call. */
21
+ export type ToolOutputRangeReader = (range: ToolOutputRange) => Promise<ToolResultSlice | null>;
22
+ /** What a {@link ToolOutputPager} has loaded. */
23
+ export interface ToolOutputPagerState {
24
+ /** The text loaded so far, from the start of the result. */
25
+ text: string;
26
+ /** The whole result's length; `null` until the first page answered. */
27
+ total: number | null;
28
+ /** The host holds no result for the call: the clipped preview stays. */
29
+ missing: boolean;
30
+ /** A read is in flight. */
31
+ loading: boolean;
32
+ /** The last read's failure, raw (the UI words it through labels); `null` when it succeeded. */
33
+ error: string | null;
34
+ }
35
+ /** A clipped result's pages, loaded on demand. */
36
+ export interface ToolOutputPager extends Readable<ToolOutputPagerState> {
37
+ /** Reads the next page (the first one on the first call). No-op while a read runs or once all is loaded. */
38
+ loadMore: () => Promise<void>;
39
+ /** Reads every page still missing, appended in order. No-op while a read runs or once all is loaded. */
40
+ loadAll: () => Promise<void>;
41
+ }
42
+ /** Options of {@link createToolOutputPager}. */
43
+ export interface ToolOutputPagerOptions {
44
+ /** Code units per page. Default {@link TOOL_OUTPUT_PAGE_SIZE}. */
45
+ pageSize?: number;
46
+ /** Pages "Load all" reads at once. Default 4. */
47
+ parallel?: number;
48
+ }
49
+ /**
50
+ * Whether every page of the result is loaded.
51
+ *
52
+ * @param state - The pager's state.
53
+ */
54
+ export declare function toolOutputPagerDone(state: ToolOutputPagerState): boolean;
55
+ /**
56
+ * A range of a whole text, as a host that holds the text whole answers it (a server too old for ranges).
57
+ *
58
+ * @param text - The whole result.
59
+ * @param range - The range asked.
60
+ */
61
+ export declare function sliceToolOutput(text: string, range: ToolOutputRange): ToolResultSlice;
62
+ /**
63
+ * A pager over one call's result.
64
+ *
65
+ * @param read - Reads a range of the result (the host's `toolOutputRange`, bound to the call).
66
+ * @param options - Page size and how many pages "Load all" reads at once.
67
+ */
68
+ export declare function createToolOutputPager(read: ToolOutputRangeReader, options?: ToolOutputPagerOptions): ToolOutputPager;
@@ -0,0 +1,113 @@
1
+ import { writable } from "./store.js";
2
+ // src/chat/headless/output-pager.ts
3
+ /** UTF-16 code units in one page of a clipped tool result: what "Load full output" and "Load more" each read. */
4
+ const TOOL_OUTPUT_PAGE_SIZE = 65536;
5
+ /** Pages "Load all" reads at once. */
6
+ const PARALLEL_PAGES = 4;
7
+ /**
8
+ * Whether every page of the result is loaded.
9
+ *
10
+ * @param state - The pager's state.
11
+ */
12
+ function toolOutputPagerDone(state) {
13
+ return state.missing || state.total !== null && state.text.length >= state.total;
14
+ }
15
+ /**
16
+ * A range of a whole text, as a host that holds the text whole answers it (a server too old for ranges).
17
+ *
18
+ * @param text - The whole result.
19
+ * @param range - The range asked.
20
+ */
21
+ function sliceToolOutput(text, range) {
22
+ const offset = Math.min(Math.max(0, Math.floor(range.offset)), text.length);
23
+ return {
24
+ text: text.slice(offset, offset + Math.max(0, Math.floor(range.length))),
25
+ offset,
26
+ total: text.length
27
+ };
28
+ }
29
+ const INITIAL = {
30
+ text: "",
31
+ total: null,
32
+ missing: false,
33
+ loading: false,
34
+ error: null
35
+ };
36
+ /**
37
+ * A pager over one call's result.
38
+ *
39
+ * @param read - Reads a range of the result (the host's `toolOutputRange`, bound to the call).
40
+ * @param options - Page size and how many pages "Load all" reads at once.
41
+ */
42
+ function createToolOutputPager(read, options = {}) {
43
+ const pageSize = Math.max(1, options.pageSize ?? 65536);
44
+ const parallel = Math.max(1, options.parallel ?? PARALLEL_PAGES);
45
+ const state = writable(INITIAL);
46
+ /** Reads up to `pages` pages from the end of what is loaded. */
47
+ const run = async (pages) => {
48
+ const start = state.get();
49
+ if (start.loading || toolOutputPagerDone(start)) return;
50
+ let { text, total } = start;
51
+ let missing = false;
52
+ let error = null;
53
+ state.set({
54
+ ...start,
55
+ loading: true,
56
+ error: null
57
+ });
58
+ let left = pages;
59
+ while (left > 0 && error === null && !missing && (total === null || text.length < total)) {
60
+ const count = total === null ? 1 : Math.min(left, parallel, Math.ceil((total - text.length) / pageSize));
61
+ const from = text.length;
62
+ const reads = await Promise.allSettled(Array.from({ length: count }, (_, i) => read({
63
+ offset: from + i * pageSize,
64
+ length: pageSize
65
+ })));
66
+ left -= count;
67
+ for (const answer of reads) {
68
+ const appended = text.length > from;
69
+ if (answer.status === "rejected") {
70
+ error = answer.reason instanceof Error ? answer.reason.message : String(answer.reason);
71
+ break;
72
+ }
73
+ const slice = answer.value;
74
+ if (slice === null) {
75
+ missing = text.length === 0;
76
+ if (!missing) error = `no result past ${text.length}`;
77
+ break;
78
+ }
79
+ if (slice.offset !== text.length) {
80
+ if (!appended) error = `slice at ${slice.offset}, asked ${text.length}`;
81
+ break;
82
+ }
83
+ if (slice.text.length === 0 && slice.offset < slice.total) {
84
+ error = `empty slice at ${slice.offset} of ${slice.total}`;
85
+ break;
86
+ }
87
+ text += slice.text;
88
+ total = slice.total;
89
+ }
90
+ if (left > 0) state.set({
91
+ text,
92
+ total,
93
+ missing,
94
+ loading: true,
95
+ error
96
+ });
97
+ }
98
+ state.set({
99
+ text,
100
+ total: missing ? 0 : total,
101
+ missing,
102
+ loading: false,
103
+ error
104
+ });
105
+ };
106
+ return {
107
+ get: state.get,
108
+ subscribe: state.subscribe,
109
+ loadMore: () => run(1),
110
+ loadAll: () => run(Number.POSITIVE_INFINITY)
111
+ };
112
+ }
113
+ export { TOOL_OUTPUT_PAGE_SIZE, createToolOutputPager, sliceToolOutput, toolOutputPagerDone };
@@ -105,6 +105,8 @@ export declare function promptOriginWire(origin: PromptOrigin): PromptOriginWire
105
105
  * @param origin - The prompt's origin.
106
106
  * @param labels - The label words.
107
107
  */
108
+ /** The source of a message a member of a shared session sent (organization mode, the server's access policy). */
109
+ export declare const ORGANIZATION_ORIGIN_SOURCE = "organization";
108
110
  export declare function promptOriginLabel(origin: PromptOrigin, labels: PromptOriginLabels): string;
109
111
  /**
110
112
  * The icon class drawn before the label, or `undefined` for none: the alarm the
@@ -109,9 +109,13 @@ function viewOriginOf(raw) {
109
109
  * @param origin - The prompt's origin.
110
110
  * @param labels - The label words.
111
111
  */
112
+ /** The source of a message a member of a shared session sent (organization mode, the server's access policy). */
113
+ const ORGANIZATION_ORIGIN_SOURCE = "organization";
112
114
  function promptOriginLabel(origin, labels) {
113
115
  switch (origin.kind) {
114
- case "signal": return labels.promptOriginSender(origin.sender?.name || origin.sender?.id || labels.promptOriginSomeone, origin.source);
116
+ case "signal":
117
+ if (origin.source === "organization") return origin.sender?.name || origin.sender?.id || labels.promptOriginSomeone;
118
+ return labels.promptOriginSender(origin.sender?.name || origin.sender?.id || labels.promptOriginSomeone, origin.source);
115
119
  case "user":
116
120
  if (origin.source === "mcp-app") return labels.promptOriginMcpApp;
117
121
  return origin.view ? labels.promptOriginView : labels.promptOriginVia(origin.source);
@@ -127,4 +131,4 @@ function promptOriginLabel(origin, labels) {
127
131
  function promptOriginIcon(origin) {
128
132
  return origin.kind === "event" && origin.source === "schedule" ? "i-ph-alarm" : void 0;
129
133
  }
130
- export { MCP_APP_ORIGIN_SOURCE, PROMPT_ORIGIN_LABELS, SCHEDULE_ORIGIN_SOURCE, promptOriginIcon, promptOriginLabel, promptOriginOf, promptOriginWire };
134
+ export { MCP_APP_ORIGIN_SOURCE, ORGANIZATION_ORIGIN_SOURCE, PROMPT_ORIGIN_LABELS, SCHEDULE_ORIGIN_SOURCE, promptOriginIcon, promptOriginLabel, promptOriginOf, promptOriginWire };
@@ -247,6 +247,16 @@ export declare function dateBucket(at: number, now: number, labels?: {
247
247
  modelVerdictTitle: (approved: boolean, model: string, confidence: string | null) => string;
248
248
  loadFullOutput: string;
249
249
  loadingFullOutput: string;
250
+ loadMoreOutput: string;
251
+ loadAllOutput: string;
252
+ loadingOutput: string;
253
+ outputLoaded: (loaded: string, total: string) => string;
254
+ outputLoadFailed: string;
255
+ loadFullInput: string;
256
+ loadingFullInput: string;
257
+ loadFullDiff: string;
258
+ loadingFullDiff: string;
259
+ diffNotShown: (hunks: number, size: string) => string;
250
260
  showOutput: string;
251
261
  inputCaption: string;
252
262
  outputCaption: string;
@@ -7,6 +7,11 @@
7
7
  *
8
8
  * Subagent events are left out: the parent's own call that spawned them
9
9
  * (still running) is what the row says.
10
+ *
11
+ * A window gets the transcript stream only of the sessions it shows or keeps
12
+ * warm (`sessions.subscribe`). For the others, the running tools come from
13
+ * the session's work list (`work:snapshot`, sent to every window), named by
14
+ * the tool alone.
10
15
  */
11
16
  import { SidebarLabels } from "./labels.js";
12
17
  import { StreamEvent } from "zidane/chat";
@@ -38,6 +43,15 @@ export type SessionActivitySignal = {
38
43
  kind: 'stream:retry:cleared';
39
44
  sessionId: string;
40
45
  source: string;
46
+ } | {
47
+ kind: 'work:snapshot';
48
+ sessionId: string;
49
+ items: readonly {
50
+ kind: string;
51
+ id: string;
52
+ label: string;
53
+ childId?: string;
54
+ }[];
41
55
  } | {
42
56
  kind: 'event';
43
57
  sessionId: string;
@@ -22,6 +22,37 @@ const THINKING = {
22
22
  phase: "thinking",
23
23
  run: true
24
24
  };
25
+ /** A tool named by its name alone (a work list item), as the row words it. */
26
+ function toolByName(callId, name) {
27
+ const overview = toolOverview({
28
+ name,
29
+ displayName: displayNameFor(name, {}),
30
+ ok: null
31
+ });
32
+ return {
33
+ callId,
34
+ label: overview.label,
35
+ ...overview.title ? { title: overview.title } : {}
36
+ };
37
+ }
38
+ /**
39
+ * The running tools as the session's work list has them. A tool the stream
40
+ * already named keeps its words (they read its input); a new one is named by
41
+ * the tool alone. Background tasks and subagents' calls are left out.
42
+ */
43
+ function reduceWorkSnapshot(prev, items) {
44
+ const running = items.filter((item) => item.kind === "tool" && item.childId === void 0);
45
+ const before = prev?.tools ?? [];
46
+ if (running.length === before.length && running.every((item, i) => before[i].callId === item.id)) return prev;
47
+ if (!prev && running.length === 0) return prev;
48
+ const tools = running.map((item) => before.find((t) => t.callId === item.id) ?? toolByName(item.id, item.label));
49
+ const phase = prev?.phase === "compacting" || prev?.phase === "retrying" ? prev.phase : "thinking";
50
+ return {
51
+ tools,
52
+ phase: tools.length === 0 && prev ? prev.phase : phase,
53
+ run: prev?.run ?? true
54
+ };
55
+ }
25
56
  /**
26
57
  * The next activity after `signal`; the same object when nothing a row shows changed, `null` once the run ended.
27
58
  *
@@ -52,6 +83,7 @@ function reduceActivity(prev, signal) {
52
83
  ...prev,
53
84
  phase: "thinking"
54
85
  } : prev;
86
+ case "work:snapshot": return reduceWorkSnapshot(prev, signal.items);
55
87
  case "event": {
56
88
  const event = signal.event;
57
89
  if (event.childId) return prev;
@@ -19,7 +19,8 @@
19
19
  * switch drops every stream, unless the runtime comes back as the same
20
20
  * process. After a reconnect (runtime or the open session's server), the
21
21
  * windows on screen climb the reconnect ladder (`streams.resync`).
22
- * - Prewarm: the transcripts around the open session load in idle time.
22
+ * - Prewarm: the transcripts around the open session load in idle time,
23
+ * when the open session or the order around it changes (`prewarm.ts`).
23
24
  * - Spaces: the shown space (kept by the views store), the slide direction of
24
25
  * the last switch, following the open session to its space, and reopening
25
26
  * the conversation last open in a space when switching back to it.
@@ -39,6 +40,7 @@
39
40
  * keeps its own branded session keys.
40
41
  */
41
42
  import { Readable } from "../store.js";
43
+ import { SidebarLabels } from "./labels.js";
42
44
  import { SessionNotificationStore } from "./notifications.js";
43
45
  import { SidebarContributions, SidebarSpace } from "./query.js";
44
46
  import { SessionActivityFilter, SessionArchiveFilter, SidebarListSession } from "./types.js";
@@ -66,9 +68,15 @@ export type SessionRowChange<S extends {
66
68
  op: 'create' | 'update';
67
69
  sessionId: S['id'];
68
70
  row?: S;
69
- } | {
71
+ } |
72
+ /** `movedTo`: it was teleported (docs/TELEPORT.md): to `sessionId` when the app knows that host, else to the host named. */
73
+ {
70
74
  op: 'delete';
71
75
  sessionId: S['id'];
76
+ movedTo?: {
77
+ sessionId?: S['id'];
78
+ hostName: string;
79
+ };
72
80
  };
73
81
  /** What deleting a session did with its environment. */
74
82
  export type SessionRemoval = {
@@ -126,6 +134,8 @@ export interface SessionDirectoryStreams<K extends string, P> {
126
134
  resync: (sessionId: K) => void;
127
135
  /** Drop every cached transcript except these. */
128
136
  evictExcept: (keep: ReadonlySet<K>) => void;
137
+ /** About how many bytes the session's cached rows hold: prewarm keeps its window within a byte budget. */
138
+ eventBytes?: (sessionId: K) => number;
129
139
  /** Drop every stream (a runtime switch). */
130
140
  dropAll: () => void;
131
141
  /** Drop one session's stream (deleted). */
@@ -172,6 +182,8 @@ export interface DirectorySettings {
172
182
  }
173
183
  /** Options of {@link createSessionDirectory}: the ports it reads and acts through. */
174
184
  export interface SessionDirectoryOptions<S extends SidebarListSession, P, C = unknown> {
185
+ /** The words it shows itself (the notice of a session that moved to a host this app does not know). */
186
+ labels?: Pick<SidebarLabels, 'sessionMovedTo'>;
175
187
  /** The sessions transport (`ChatHost.sessions`). */
176
188
  sessions: SessionDirectorySource<S, C>;
177
189
  /** The stream store it keeps in step. */
@@ -220,6 +232,11 @@ export interface SessionDirectoryOptions<S extends SidebarListSession, P, C = un
220
232
  pinned?: () => Iterable<S['id']>;
221
233
  /** A window that only ever shows this session (its other sessions are never opened). */
222
234
  pinnedSession?: S['id'] | null;
235
+ /** Prewarm's settle delay and byte budget (`prewarm.ts`). */
236
+ prewarm?: {
237
+ delayMs?: number;
238
+ maxBytes?: number;
239
+ };
223
240
  /** Schedules prewarm reads; defaults to `requestIdleCallback` with a timer fallback. */
224
241
  idle?: {
225
242
  request: (run: () => void) => number;
@@ -1,6 +1,8 @@
1
1
  import { constant, writable } from "../store.js";
2
2
  import { applyInboxPatch, nextWakeAt } from "./inbox-state.js";
3
+ import { DEFAULT_SIDEBAR_LABELS } from "./labels.js";
3
4
  import { createNotificationStore } from "./notifications.js";
5
+ import { createPrewarmer } from "./prewarm.js";
4
6
  import { NO_SIDEBAR_CONTRIBUTIONS, filterQueryOf, filtersForSpace, mergeSidebarSpaces, resolveGrouping, resolveSort, spaceMembership, switcherSpaces } from "./query.js";
5
7
  import { isProjectMember } from "./rows.js";
6
8
  import { VIEW_CHOICE } from "./types.js";
@@ -16,8 +18,6 @@ function withInboxFields(row, fields) {
16
18
  else next[key] = fields[key];
17
19
  return next;
18
20
  }
19
- const PREWARM_FULL_THRESHOLD = 12;
20
- const PREWARM_WINDOW_RADIUS = 6;
21
21
  /** The activity axis as a relative `updatedAt` bound, for a saved view's query. */
22
22
  const ACTIVITY_BOUND = {
23
23
  "1d": "-1d",
@@ -232,51 +232,13 @@ function createSessionDirectory(options) {
232
232
  patch({ hostNotice: null });
233
233
  }
234
234
  };
235
- let stopPrewarm = null;
236
- const prewarm = () => {
237
- stopPrewarm?.();
238
- stopPrewarm = null;
239
- const { allSessions: raw, activeSessionId } = state.get();
240
- if (raw.length === 0) return;
241
- let candidates;
242
- if (raw.length <= PREWARM_FULL_THRESHOLD) candidates = raw;
243
- else {
244
- const anchor = activeSessionId ? raw.findIndex((s) => s.id === activeSessionId) : -1;
245
- const center = anchor === -1 ? 0 : anchor;
246
- const start = Math.max(0, center - PREWARM_WINDOW_RADIUS);
247
- const end = Math.min(raw.length, center + PREWARM_WINDOW_RADIUS + 1);
248
- candidates = raw.slice(start, end);
249
- }
250
- const keep = new Set(candidates.map((s) => s.id));
251
- if (activeSessionId) keep.add(activeSessionId);
252
- for (const key of options.pinned?.() ?? []) keep.add(key);
253
- streams.evictExcept(keep);
254
- const targets = candidates.filter((session) => !streams.hasEvents(session.id));
255
- if (targets.length === 0) return;
256
- let cancelled = false;
257
- let handle;
258
- const pump = (index) => {
259
- if (cancelled || index >= targets.length) return;
260
- handle = idle.request(() => {
261
- if (cancelled) return;
262
- const session = targets[index];
263
- const next = () => pump(index + 1);
264
- if (streams.hasEvents(session.id)) {
265
- next();
266
- return;
267
- }
268
- options.loadEvents(session.id, { prewarm: true }).then((events) => {
269
- if (cancelled) return;
270
- if (!streams.hasEvents(session.id)) streams.setEventsPage(session.id, events);
271
- }).catch(() => {}).finally(next);
272
- });
273
- };
274
- pump(0);
275
- stopPrewarm = () => {
276
- cancelled = true;
277
- if (handle !== void 0) idle.cancel(handle);
278
- };
279
- };
235
+ const prewarmer = createPrewarmer({
236
+ streams,
237
+ loadEvents: options.loadEvents,
238
+ idle,
239
+ ...options.pinned ? { pinned: options.pinned } : {},
240
+ ...options.prewarm
241
+ });
280
242
  /** `direction`: the way the list slides; by default the switcher's order (a wrapping step overrides it). */
281
243
  const showSpace = (spaceId, direction) => {
282
244
  const { spaces, switcherSpaces: order, activeSpace, allSessions, activeSessionId, spacesOn } = state.get();
@@ -353,7 +315,7 @@ function createSessionDirectory(options) {
353
315
  lastRows = allSessions;
354
316
  lastActive = activeSessionId;
355
317
  reconcile();
356
- prewarm();
318
+ prewarmer.update(allSessions, activeSessionId);
357
319
  }));
358
320
  offs.push(options.settings.subscribe(reconcile));
359
321
  offs.push(views.space.subscribe(reconcile));
@@ -512,7 +474,14 @@ function createSessionDirectory(options) {
512
474
  }
513
475
  refresh();
514
476
  }));
515
- if (sessions.onChanged) offs.push(sessions.onChanged(applyChange));
477
+ if (sessions.onChanged) offs.push(sessions.onChanged((change) => {
478
+ if (change.op === "delete" && change.movedTo && state.get().activeSessionId === change.sessionId) {
479
+ const to = change.movedTo.sessionId;
480
+ setActive(to ?? null);
481
+ if (!to) patch({ hostNotice: (options.labels?.sessionMovedTo ?? DEFAULT_SIDEBAR_LABELS.sessionMovedTo)(change.movedTo.hostName) });
482
+ }
483
+ applyChange(change);
484
+ }));
516
485
  let wakeTimer;
517
486
  let wakeAt;
518
487
  const armWake = () => {
@@ -546,8 +515,7 @@ function createSessionDirectory(options) {
546
515
  return () => {
547
516
  for (const off of offs.splice(0).reverse()) off();
548
517
  followContributions = null;
549
- stopPrewarm?.();
550
- stopPrewarm = null;
518
+ prewarmer.stop();
551
519
  };
552
520
  },
553
521
  refresh,
@@ -6,18 +6,29 @@
6
6
  import { SidebarLabels } from "./labels.js";
7
7
  import { SessionEnvironmentSummary } from "zidane/chat";
8
8
  /**
9
- * Whether the session runs in a sandbox on a provider's machines, deleted with the session.
9
+ * Whether the session runs in a sandbox its provider lists (E2B, Daytona, an extension's), deleted with the
10
+ * session, and paused or deleted on its own.
10
11
  *
11
12
  * @param environment - The session's environment, if any.
12
13
  */
13
14
  export declare function runsInRemoteSandbox(environment: SessionEnvironmentSummary | undefined): boolean;
14
15
  /**
15
- * An environment kind's display name: a built-in kind's name, a machine's kind as `Local @ laptop`, else the id.
16
+ * An environment kind's display name: a built-in kind's name, a machine's kind as `Local @ laptop`, an
17
+ * extension's kind by the name its provider gave (`named`), else by its extension (`devsandboxes:sandbox` →
18
+ * `devsandboxes`).
16
19
  *
17
- * @param kind - The kind (`worktree`, `local@laptop`, an extension's id).
20
+ * @param kind - The kind (`worktree`, `local@laptop`, an extension's `<extension>:<name>`).
18
21
  * @param labels - The sidebar labels.
22
+ * @param named - The provider's label, when the session's environment recorded it.
19
23
  */
20
- export declare function environmentKindLabel(kind: string, labels: Pick<SidebarLabels, 'environmentKinds' | 'environmentOnMachine'>): string;
24
+ export declare function environmentKindLabel(kind: string, labels: Pick<SidebarLabels, 'environmentKinds' | 'environmentOnMachine'>, named?: string): string;
25
+ /**
26
+ * A session environment's display name ({@link environmentKindLabel} with the name it recorded).
27
+ *
28
+ * @param environment - The session's environment.
29
+ * @param labels - The sidebar labels.
30
+ */
31
+ export declare function environmentLabel(environment: Pick<SessionEnvironmentSummary, 'kind' | 'label'>, labels: Pick<SidebarLabels, 'environmentKinds' | 'environmentOnMachine'>): string;
21
32
  /**
22
33
  * Where a session runs, in one line: tooltips and screen readers. Its state is the header dot's
23
34
  * (`sessionPlaceTone`), so a row and the header agree: reconnecting is not a failure, and an
@@ -4,23 +4,38 @@ import { parseMachineKind } from "zidane/chat/pure";
4
4
  /** Kinds whose work lives in a remote sandbox: deleting the session deletes it. */
5
5
  const REMOTE_KINDS = /* @__PURE__ */ new Set(["e2b", "daytona"]);
6
6
  /**
7
- * Whether the session runs in a sandbox on a provider's machines, deleted with the session.
7
+ * Whether the session runs in a sandbox its provider lists (E2B, Daytona, an extension's), deleted with the
8
+ * session, and paused or deleted on its own.
8
9
  *
9
10
  * @param environment - The session's environment, if any.
10
11
  */
11
12
  function runsInRemoteSandbox(environment) {
12
- return environment !== void 0 && REMOTE_KINDS.has(environment.kind);
13
+ return environment !== void 0 && (environment.sandbox === true || REMOTE_KINDS.has(environment.kind));
13
14
  }
14
15
  /**
15
- * An environment kind's display name: a built-in kind's name, a machine's kind as `Local @ laptop`, else the id.
16
+ * An environment kind's display name: a built-in kind's name, a machine's kind as `Local @ laptop`, an
17
+ * extension's kind by the name its provider gave (`named`), else by its extension (`devsandboxes:sandbox` →
18
+ * `devsandboxes`).
16
19
  *
17
- * @param kind - The kind (`worktree`, `local@laptop`, an extension's id).
20
+ * @param kind - The kind (`worktree`, `local@laptop`, an extension's `<extension>:<name>`).
18
21
  * @param labels - The sidebar labels.
22
+ * @param named - The provider's label, when the session's environment recorded it.
19
23
  */
20
- function environmentKindLabel(kind, labels) {
24
+ function environmentKindLabel(kind, labels, named) {
21
25
  const machine = parseMachineKind(kind);
22
26
  if (machine) return labels.environmentOnMachine(labels.environmentKinds[machine.base] ?? machine.base, machine.name);
23
- return labels.environmentKinds[kind] ?? kind;
27
+ if (labels.environmentKinds[kind]) return labels.environmentKinds[kind];
28
+ const at = kind.indexOf(":");
29
+ return named || (at > 0 ? kind.slice(0, at) : kind);
30
+ }
31
+ /**
32
+ * A session environment's display name ({@link environmentKindLabel} with the name it recorded).
33
+ *
34
+ * @param environment - The session's environment.
35
+ * @param labels - The sidebar labels.
36
+ */
37
+ function environmentLabel(environment, labels) {
38
+ return environmentKindLabel(environment.kind, labels, environment.label);
24
39
  }
25
40
  /**
26
41
  * Where a session runs, in one line: tooltips and screen readers. Its state is the header dot's
@@ -32,7 +47,7 @@ function environmentKindLabel(kind, labels) {
32
47
  * @param now - The current time, epoch ms (a reconnect window that passed reads as failed).
33
48
  */
34
49
  function environmentSummaryText(environment, labels, now = Date.now()) {
35
- const label = environmentKindLabel(environment.kind, labels);
50
+ const label = environmentLabel(environment, labels);
36
51
  const where = environment.branch ? labels.environmentOnBranch(label, environment.branch) : label;
37
52
  if (environment.state === "provisioning") {
38
53
  const step = environment.progress?.steps.find((s) => s.id === environment.progress?.step);
@@ -43,6 +58,9 @@ function environmentSummaryText(environment, labels, now = Date.now()) {
43
58
  if (environment.state === "failed" && environment.failure === "lost") return labels.environmentGone(where, environment.error);
44
59
  if (environment.state === "failed" && environment.failure === "unreachable") return labels.environmentNotAnswering(where, environment.error);
45
60
  if (environment.state === "failed") return labels.environmentSetupFailed(where, environment.error);
61
+ if (environment.busy?.what === "pausing") return labels.environmentPausing(where);
62
+ if (environment.busy?.what === "deleting") return labels.environmentDeletingSandbox(where);
63
+ if (environment.busy?.what === "action") return labels.environmentRunningAction(where, environment.busy.label);
46
64
  if (environment.resuming) return labels.environmentResuming(where);
47
65
  if (environment.suspended) return labels.environmentPaused(where);
48
66
  return where;
@@ -58,8 +76,8 @@ function deleteSessionPrompt(title, environment, labels) {
58
76
  const question = labels.deleteSessionQuestion(title);
59
77
  if (environment && runsInRemoteSandbox(environment)) return {
60
78
  question,
61
- detail: labels.deleteSessionSandbox(environmentKindLabel(environment.kind, labels))
79
+ detail: labels.deleteSessionSandbox(environmentLabel(environment, labels))
62
80
  };
63
81
  return { question };
64
82
  }
65
- export { deleteSessionPrompt, environmentKindLabel, environmentSummaryText, runsInRemoteSandbox };
83
+ export { deleteSessionPrompt, environmentKindLabel, environmentLabel, environmentSummaryText, runsInRemoteSandbox };
@@ -3,7 +3,7 @@ import { SessionBadgesEntry, SessionBadgesSource, SessionBadgesStore, createSess
3
3
  import { CompactionProgress, CompactionProgressStore, CompactionSignal, createCompactionProgress, reduceCompaction } from "./compaction.js";
4
4
  import { DirectoryServer, DirectorySettings, ProjectInSpace, RuntimeNow, RuntimeOrigin, SessionDirectory, SessionDirectoryOptions, SessionDirectorySource, SessionDirectoryState, SessionDirectoryStreams, SessionRef, SessionRemoval, SessionRowChange, availableProjectsOf, createSessionDirectory, filterDirectorySessions, projectKeyOf, sessionRefsOf } from "./directory.js";
5
5
  import { DotStateInput, SidebarDotState, deriveDotState } from "./dot-state.js";
6
- import { deleteSessionPrompt, environmentKindLabel, environmentSummaryText, runsInRemoteSandbox } from "./environment.js";
6
+ import { deleteSessionPrompt, environmentKindLabel, environmentLabel, environmentSummaryText, runsInRemoteSandbox } from "./environment.js";
7
7
  import { RunEstimatesRow, RunEstimatesSignal, RunEstimatesStore, createRunEstimates, pickRunEstimate } from "./estimates.js";
8
8
  import { SESSION_HISTORY_LIMIT, SessionHistory, SessionHistoryDirection, SessionHistoryOptions, SessionHistoryPage, SessionHistoryState, SessionHistoryStore, createSessionHistory, parseSessionHistory } from "./history.js";
9
9
  import { SessionWindowMode, SidebarEnvironmentHost, SidebarHost } from "./host.js";
@@ -18,4 +18,4 @@ import { AGENT_GROUPING, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, SidebarContrib
18
18
  import { BuildQuerySidebarRowsOptions, BuildSidebarRowsOptions, CHATS_BUCKET, SidebarListRow, SidebarNode, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, groupsByFolder, isProjectMember, itemRows, nestSidebarRows, partitionMainSession, projectPathOf, repoGroups } from "./rows.js";
19
19
  import { SessionActivityFilter, SessionArchiveFilter, SidebarExtensionView, SidebarGroupBy, SidebarInboxGroupBy, SidebarLayout, SidebarListSession, SidebarOrigin, SidebarSortBy, SidebarView, VIEW_CHOICE } from "./types.js";
20
20
  import { DEFAULT_SIDEBAR_VIEW, DEFAULT_SIDEBAR_VIEW_DEFAULTS, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, SidebarLastSessions, SidebarViewDefaults, SidebarViewMap, SidebarViewPicks, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, createSidebarViews, defaultSidebarLayout, parseSidebarView, parseSidebarViewPicks, parseSwitcherPrefs, readSidebarViews, resolveSidebarView, sidebarLayoutOf, sidebarViewDefaults } from "./view.js";
21
- export { AGENT_GROUPING, BuildQuerySidebarRowsOptions, BuildSidebarRowsOptions, CHATS_BUCKET, COMMON_EMOJI, CompactionProgress, CompactionProgressStore, CompactionSignal, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SIDEBAR_VIEW_DEFAULTS, DEFAULT_SWITCHER_PREFS, DirectoryServer, DirectorySettings, DotStateInput, INBOX_EARLIER_AFTER_MS, INBOX_PAGE, INBOX_PAGE_MORE, INBOX_RUN_HOLD_MS, INBOX_SHELVES, INBOX_SHELVES_FOLDED, INBOX_SHELVES_KEY, InboxRow, InboxRowsOptions, InboxSection, InboxShelfId, InboxUrgency, MAIN_SESSION_ICON_KEY, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_ICONS_KEY, PinsBySpace, ProjectIcon, ProjectIconMap, ProjectInSpace, RunEstimatesRow, RunEstimatesSignal, RunEstimatesStore, RuntimeNow, RuntimeOrigin, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, SessionActivity, SessionActivityFilter, SessionActivitySignal, SessionActivityStore, SessionArchiveFilter, SessionBadgesEntry, SessionBadgesSource, SessionBadgesStore, SessionDirectory, SessionDirectoryOptions, SessionDirectorySource, SessionDirectoryState, SessionDirectoryStreams, SessionHistory, SessionHistoryDirection, SessionHistoryOptions, SessionHistoryPage, SessionHistoryState, SessionHistoryStore, type SessionInboxFields, type SessionInboxPatch, SessionNotification, SessionNotificationStore, SessionRef, SessionRemoval, SessionRowChange, SessionWindowMode, SidebarContributionStores, SidebarContributions, SidebarDotState, SidebarEnvironmentHost, SidebarExtensionView, SidebarGroupBy, SidebarGrouping, SidebarHost, SidebarInboxGroupBy, SidebarItemEntry, SidebarLabels, SidebarLastSessions, type SidebarLayout, SidebarListRow, SidebarListSession, SidebarNode, SidebarOrigin, SidebarQueryLayer, SidebarRowChip, SidebarRowDecoration, SidebarSortBy, SidebarSpace, SidebarView, SidebarViewDefaults, SidebarViewMap, SidebarViewPicks, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, VIEW_CHOICE, activityLabel, applyInboxPatch, availableProjectsOf, buildHostSidebarRows, buildInboxRows, buildQuerySidebarRows, buildSidebarRows, claimChildSessions, clearedViewFilters, compareInboxSection, createCompactionProgress, createDecorator, createNotificationStore, createRunEstimates, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSidebarViews, defaultSidebarLayout, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, inboxDockStart, inboxEarlierAfterMs, inboxFolderOf, inboxSectionOf, inboxSessionOrder, isProjectIcon, isProjectMember, isSettled, isSnoozed, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextInboxChangeAt, nextSavedViewName, nextWakeAt, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSidebarViewPicks, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, projectKeyOf, projectPathOf, readSidebarViews, reduceActivity, reduceCompaction, repoGroups, resolveGrouping, resolveSidebarView, resolveSort, runsInRemoteSandbox, sessionRefsOf, sidebarContributionsOf, sidebarLayoutOf, sidebarViewDefaults, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn, withPinnedProject };
21
+ export { AGENT_GROUPING, BuildQuerySidebarRowsOptions, BuildSidebarRowsOptions, CHATS_BUCKET, COMMON_EMOJI, CompactionProgress, CompactionProgressStore, CompactionSignal, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SIDEBAR_VIEW_DEFAULTS, DEFAULT_SWITCHER_PREFS, DirectoryServer, DirectorySettings, DotStateInput, INBOX_EARLIER_AFTER_MS, INBOX_PAGE, INBOX_PAGE_MORE, INBOX_RUN_HOLD_MS, INBOX_SHELVES, INBOX_SHELVES_FOLDED, INBOX_SHELVES_KEY, InboxRow, InboxRowsOptions, InboxSection, InboxShelfId, InboxUrgency, MAIN_SESSION_ICON_KEY, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_ICONS_KEY, PinsBySpace, ProjectIcon, ProjectIconMap, ProjectInSpace, RunEstimatesRow, RunEstimatesSignal, RunEstimatesStore, RuntimeNow, RuntimeOrigin, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, SessionActivity, SessionActivityFilter, SessionActivitySignal, SessionActivityStore, SessionArchiveFilter, SessionBadgesEntry, SessionBadgesSource, SessionBadgesStore, SessionDirectory, SessionDirectoryOptions, SessionDirectorySource, SessionDirectoryState, SessionDirectoryStreams, SessionHistory, SessionHistoryDirection, SessionHistoryOptions, SessionHistoryPage, SessionHistoryState, SessionHistoryStore, type SessionInboxFields, type SessionInboxPatch, SessionNotification, SessionNotificationStore, SessionRef, SessionRemoval, SessionRowChange, SessionWindowMode, SidebarContributionStores, SidebarContributions, SidebarDotState, SidebarEnvironmentHost, SidebarExtensionView, SidebarGroupBy, SidebarGrouping, SidebarHost, SidebarInboxGroupBy, SidebarItemEntry, SidebarLabels, SidebarLastSessions, type SidebarLayout, SidebarListRow, SidebarListSession, SidebarNode, SidebarOrigin, SidebarQueryLayer, SidebarRowChip, SidebarRowDecoration, SidebarSortBy, SidebarSpace, SidebarView, SidebarViewDefaults, SidebarViewMap, SidebarViewPicks, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, VIEW_CHOICE, activityLabel, applyInboxPatch, availableProjectsOf, buildHostSidebarRows, buildInboxRows, buildQuerySidebarRows, buildSidebarRows, claimChildSessions, clearedViewFilters, compareInboxSection, createCompactionProgress, createDecorator, createNotificationStore, createRunEstimates, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSidebarViews, defaultSidebarLayout, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, inboxDockStart, inboxEarlierAfterMs, inboxFolderOf, inboxSectionOf, inboxSessionOrder, isProjectIcon, isProjectMember, isSettled, isSnoozed, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextInboxChangeAt, nextSavedViewName, nextWakeAt, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSidebarViewPicks, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, projectKeyOf, projectPathOf, readSidebarViews, reduceActivity, reduceCompaction, repoGroups, resolveGrouping, resolveSidebarView, resolveSort, runsInRemoteSandbox, sessionRefsOf, sidebarContributionsOf, sidebarLayoutOf, sidebarViewDefaults, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn, withPinnedProject };
@@ -3,7 +3,7 @@ import { createSessionBadges } from "./badges.js";
3
3
  import { createCompactionProgress, reduceCompaction } from "./compaction.js";
4
4
  import { availableProjectsOf, createSessionDirectory, filterDirectorySessions, projectKeyOf, sessionRefsOf } from "./directory.js";
5
5
  import { deriveDotState } from "./dot-state.js";
6
- import { deleteSessionPrompt, environmentKindLabel, environmentSummaryText, runsInRemoteSandbox } from "./environment.js";
6
+ import { deleteSessionPrompt, environmentKindLabel, environmentLabel, environmentSummaryText, runsInRemoteSandbox } from "./environment.js";
7
7
  import { createRunEstimates, pickRunEstimate } from "./estimates.js";
8
8
  import { SESSION_HISTORY_LIMIT, createSessionHistory, parseSessionHistory } from "./history.js";
9
9
  import { INBOX_EARLIER_AFTER_MS, INBOX_PAGE, INBOX_PAGE_MORE, INBOX_RUN_HOLD_MS, INBOX_SHELVES, INBOX_SHELVES_FOLDED, INBOX_SHELVES_KEY, buildInboxRows, compareInboxSection, inboxDockStart, inboxEarlierAfterMs, inboxFolderOf, inboxSectionOf, inboxSessionOrder, nextInboxChangeAt } from "./inbox.js";
@@ -17,4 +17,4 @@ import { AGENT_GROUPING, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, claimChildSess
17
17
  import { CHATS_BUCKET, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, groupsByFolder, isProjectMember, itemRows, nestSidebarRows, partitionMainSession, projectPathOf, repoGroups } from "./rows.js";
18
18
  import { VIEW_CHOICE } from "./types.js";
19
19
  import { DEFAULT_SIDEBAR_VIEW, DEFAULT_SIDEBAR_VIEW_DEFAULTS, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, createSidebarViews, defaultSidebarLayout, parseSidebarView, parseSidebarViewPicks, parseSwitcherPrefs, readSidebarViews, resolveSidebarView, sidebarLayoutOf, sidebarViewDefaults } from "./view.js";
20
- export { AGENT_GROUPING, CHATS_BUCKET, COMMON_EMOJI, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SIDEBAR_VIEW_DEFAULTS, DEFAULT_SWITCHER_PREFS, INBOX_EARLIER_AFTER_MS, INBOX_PAGE, INBOX_PAGE_MORE, INBOX_RUN_HOLD_MS, INBOX_SHELVES, INBOX_SHELVES_FOLDED, INBOX_SHELVES_KEY, MAIN_SESSION_ICON_KEY, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_ICONS_KEY, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, VIEW_CHOICE, activityLabel, applyInboxPatch, availableProjectsOf, buildHostSidebarRows, buildInboxRows, buildQuerySidebarRows, buildSidebarRows, claimChildSessions, clearedViewFilters, compareInboxSection, createCompactionProgress, createDecorator, createNotificationStore, createRunEstimates, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSidebarViews, defaultSidebarLayout, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, inboxDockStart, inboxEarlierAfterMs, inboxFolderOf, inboxSectionOf, inboxSessionOrder, isProjectIcon, isProjectMember, isSettled, isSnoozed, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextInboxChangeAt, nextSavedViewName, nextWakeAt, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSidebarViewPicks, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, projectKeyOf, projectPathOf, readSidebarViews, reduceActivity, reduceCompaction, repoGroups, resolveGrouping, resolveSidebarView, resolveSort, runsInRemoteSandbox, sessionRefsOf, sidebarContributionsOf, sidebarLayoutOf, sidebarViewDefaults, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn, withPinnedProject };
20
+ export { AGENT_GROUPING, CHATS_BUCKET, COMMON_EMOJI, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SIDEBAR_VIEW_DEFAULTS, DEFAULT_SWITCHER_PREFS, INBOX_EARLIER_AFTER_MS, INBOX_PAGE, INBOX_PAGE_MORE, INBOX_RUN_HOLD_MS, INBOX_SHELVES, INBOX_SHELVES_FOLDED, INBOX_SHELVES_KEY, MAIN_SESSION_ICON_KEY, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_ICONS_KEY, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, VIEW_CHOICE, activityLabel, applyInboxPatch, availableProjectsOf, buildHostSidebarRows, buildInboxRows, buildQuerySidebarRows, buildSidebarRows, claimChildSessions, clearedViewFilters, compareInboxSection, createCompactionProgress, createDecorator, createNotificationStore, createRunEstimates, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSidebarViews, defaultSidebarLayout, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, inboxDockStart, inboxEarlierAfterMs, inboxFolderOf, inboxSectionOf, inboxSessionOrder, isProjectIcon, isProjectMember, isSettled, isSnoozed, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextInboxChangeAt, nextSavedViewName, nextWakeAt, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSidebarViewPicks, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, projectKeyOf, projectPathOf, readSidebarViews, reduceActivity, reduceCompaction, repoGroups, resolveGrouping, resolveSidebarView, resolveSort, runsInRemoteSandbox, sessionRefsOf, sidebarContributionsOf, sidebarLayoutOf, sidebarViewDefaults, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn, withPinnedProject };