zidane-ui 9.2.2 → 9.3.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 (320) hide show
  1. package/dist/adapters/browser-keybindings-host.js +3 -1
  2. package/dist/adapters/live.d.ts +6 -0
  3. package/dist/adapters/live.js +16 -8
  4. package/dist/adapters/server-composer-host.js +22 -9
  5. package/dist/adapters/server-host.js +143 -18
  6. package/dist/adapters/server-media.d.ts +9 -1
  7. package/dist/adapters/server-media.js +14 -1
  8. package/dist/adapters/server-settings-host.js +30 -3
  9. package/dist/adapters/server-settings-sections.js +23 -1
  10. package/dist/adapters/server-sidebar-host.d.ts +3 -1
  11. package/dist/adapters/server-sidebar-host.js +10 -1
  12. package/dist/app/ModalProvider.js +1 -1
  13. package/dist/approvals/ApprovalShell.js +1 -1
  14. package/dist/chat/DaemonOrb.d.ts +29 -1
  15. package/dist/chat/DaemonOrb.js +25 -12
  16. package/dist/chat/HostTranscript.d.ts +0 -12
  17. package/dist/chat/HostTranscript.js +6 -1
  18. package/dist/chat/SessionStreamsProvider.d.ts +8 -0
  19. package/dist/chat/SessionStreamsProvider.js +11 -2
  20. package/dist/chat/StatusDot.js +8 -2
  21. package/dist/chat/Transcript.d.ts +20 -11
  22. package/dist/chat/Transcript.js +335 -162
  23. package/dist/chat/composer/ComposerEditor.js +1 -1
  24. package/dist/chat/headless/host.d.ts +43 -7
  25. package/dist/chat/headless/index.d.ts +8 -6
  26. package/dist/chat/headless/index.js +11 -9
  27. package/dist/chat/headless/labels.d.ts +30 -0
  28. package/dist/chat/headless/labels.js +29 -0
  29. package/dist/chat/headless/markdown-chunks.d.ts +2 -1
  30. package/dist/chat/headless/markdown-chunks.js +12 -20
  31. package/dist/chat/headless/markdown-scan.d.ts +66 -0
  32. package/dist/chat/headless/markdown-scan.js +124 -0
  33. package/dist/chat/headless/markdown-stream.d.ts +64 -0
  34. package/dist/chat/headless/markdown-stream.js +143 -0
  35. package/dist/chat/headless/output-pager.d.ts +68 -0
  36. package/dist/chat/headless/output-pager.js +113 -0
  37. package/dist/chat/headless/session-list.d.ts +20 -0
  38. package/dist/chat/headless/sidebar/activity.d.ts +14 -0
  39. package/dist/chat/headless/sidebar/activity.js +32 -0
  40. package/dist/chat/headless/sidebar/directory.d.ts +17 -2
  41. package/dist/chat/headless/sidebar/directory.js +50 -54
  42. package/dist/chat/headless/sidebar/environment.d.ts +5 -2
  43. package/dist/chat/headless/sidebar/environment.js +11 -2
  44. package/dist/chat/headless/sidebar/host.d.ts +15 -0
  45. package/dist/chat/headless/sidebar/inbox.d.ts +12 -3
  46. package/dist/chat/headless/sidebar/inbox.js +18 -9
  47. package/dist/chat/headless/sidebar/index.d.ts +2 -2
  48. package/dist/chat/headless/sidebar/index.js +2 -2
  49. package/dist/chat/headless/sidebar/labels.d.ts +38 -2
  50. package/dist/chat/headless/sidebar/labels.js +16 -0
  51. package/dist/chat/headless/sidebar/prewarm.d.ts +68 -0
  52. package/dist/chat/headless/sidebar/prewarm.js +114 -0
  53. package/dist/chat/headless/streams/actions.d.ts +2 -0
  54. package/dist/chat/headless/streams/actions.js +1 -0
  55. package/dist/chat/headless/streams/event-bytes.d.ts +6 -0
  56. package/dist/chat/headless/streams/event-bytes.js +34 -0
  57. package/dist/chat/headless/streams/live-events.d.ts +25 -1
  58. package/dist/chat/headless/streams/live-events.js +53 -2
  59. package/dist/chat/headless/streams/selectors.d.ts +3 -0
  60. package/dist/chat/headless/streams/selectors.js +8 -1
  61. package/dist/chat/headless/streams/session-streams.d.ts +15 -3
  62. package/dist/chat/headless/streams/session-streams.js +31 -3
  63. package/dist/chat/headless/streams/store.d.ts +24 -1
  64. package/dist/chat/headless/streams/store.js +51 -26
  65. package/dist/chat/headless/streams/transcript-map.d.ts +57 -0
  66. package/dist/chat/headless/streams/transcript-map.js +88 -0
  67. package/dist/chat/headless/streams/transcript.d.ts +4 -2
  68. package/dist/chat/headless/streams/transcript.js +19 -7
  69. package/dist/chat/headless/transcript/batch.js +5 -1
  70. package/dist/chat/headless/transcript/blob-media.d.ts +15 -0
  71. package/dist/chat/headless/transcript/blob-media.js +23 -0
  72. package/dist/chat/headless/transcript/collapse.d.ts +10 -0
  73. package/dist/chat/headless/transcript/collapse.js +32 -6
  74. package/dist/chat/headless/transcript/derive.d.ts +98 -0
  75. package/dist/chat/headless/transcript/derive.js +89 -0
  76. package/dist/chat/headless/transcript/exchange-media.d.ts +3 -1
  77. package/dist/chat/headless/transcript/exchange-media.js +8 -5
  78. package/dist/chat/headless/transcript/fold-actions.d.ts +8 -3
  79. package/dist/chat/headless/transcript/fold-actions.js +16 -0
  80. package/dist/chat/headless/transcript/fold-attachments.d.ts +2 -0
  81. package/dist/chat/headless/transcript/fold-attachments.js +3 -2
  82. package/dist/chat/headless/transcript/fold.d.ts +4 -2
  83. package/dist/chat/headless/transcript/fold.js +37 -7
  84. package/dist/chat/headless/transcript/incremental.d.ts +53 -0
  85. package/dist/chat/headless/transcript/incremental.js +181 -0
  86. package/dist/chat/headless/transcript/index.d.ts +2 -1
  87. package/dist/chat/headless/transcript/index.js +2 -1
  88. package/dist/chat/headless/transcript/nesting.js +2 -1
  89. package/dist/chat/headless/transcript/rail.d.ts +142 -0
  90. package/dist/chat/headless/transcript/rail.js +290 -0
  91. package/dist/chat/headless/transcript/rows.d.ts +11 -1
  92. package/dist/chat/headless/transcript/run-failures.d.ts +4 -0
  93. package/dist/chat/headless/transcript/run-failures.js +31 -2
  94. package/dist/chat/headless/transcript/seams.d.ts +78 -0
  95. package/dist/chat/headless/transcript/seams.js +116 -0
  96. package/dist/chat/headless/transcript/tool-media.d.ts +6 -7
  97. package/dist/chat/headless/transcript/tool-media.js +27 -9
  98. package/dist/chat/headless/transcript-labels.d.ts +1 -0
  99. package/dist/chat/headless/turn-labels.d.ts +1 -0
  100. package/dist/chat/headless/turn-labels.js +2 -1
  101. package/dist/chat/index.d.ts +10 -8
  102. package/dist/chat/index.js +9 -7
  103. package/dist/chat/interactions/ElicitationCard.js +1 -1
  104. package/dist/chat/interactions/InteractionCard.js +1 -1
  105. package/dist/chat/interactions/PlanCard.js +3 -3
  106. package/dist/chat/interactions/QuestionField.js +4 -4
  107. package/dist/chat/interactions/QuestionForm.js +3 -3
  108. package/dist/chat/interactions/SecretInput.js +1 -1
  109. package/dist/chat/sidebar/ProjectIcon.d.ts +1 -1
  110. package/dist/chat/sidebar/ProjectIcon.js +1 -1
  111. package/dist/chat/sidebar/RowChips.d.ts +3 -2
  112. package/dist/chat/sidebar/RowChips.js +6 -3
  113. package/dist/chat/sidebar/SessionSidebar.js +13 -14
  114. package/dist/chat/sidebar/SidebarFooter.d.ts +8 -5
  115. package/dist/chat/sidebar/SidebarFooter.js +6 -6
  116. package/dist/chat/sidebar/SidebarFrame.d.ts +2 -0
  117. package/dist/chat/sidebar/SidebarFrame.js +5 -2
  118. package/dist/chat/sidebar/SidebarSessionRow.d.ts +3 -1
  119. package/dist/chat/sidebar/SidebarSessionRow.js +3 -1
  120. package/dist/chat/sidebar/SpacesSection.d.ts +20 -1
  121. package/dist/chat/sidebar/SpacesSection.js +34 -13
  122. package/dist/chat/sidebar/index.d.ts +2 -2
  123. package/dist/chat/sidebar/session-menu.d.ts +11 -2
  124. package/dist/chat/sidebar/session-menu.js +50 -5
  125. package/dist/chat/sidebar/sidebar-live.js +1 -1
  126. package/dist/chat/sidebar/useInboxRows.js +43 -2
  127. package/dist/chat/sidebar/useInboxTriage.js +19 -14
  128. package/dist/chat/testing/contract.d.ts +5 -3
  129. package/dist/chat/testing/contract.js +66 -1
  130. package/dist/chat/testing/fixture-sidebar-host.d.ts +7 -1
  131. package/dist/chat/testing/fixture-sidebar-host.js +12 -0
  132. package/dist/chat/testing/sidebar.contract.d.ts +6 -0
  133. package/dist/chat/testing/sidebar.contract.js +24 -0
  134. package/dist/chat/transcript/DiffLines.d.ts +6 -1
  135. package/dist/chat/transcript/DiffLines.js +35 -20
  136. package/dist/chat/transcript/EditDiffBlock.d.ts +5 -1
  137. package/dist/chat/transcript/EditDiffBlock.js +89 -30
  138. package/dist/chat/transcript/InteractionToolBody.js +1 -1
  139. package/dist/chat/transcript/LazyRow.d.ts +40 -40
  140. package/dist/chat/transcript/LazyRow.js +101 -149
  141. package/dist/chat/transcript/MermaidDiagram.js +2 -1
  142. package/dist/chat/transcript/SelectCursor.d.ts +11 -1
  143. package/dist/chat/transcript/SelectCursor.js +10 -5
  144. package/dist/chat/transcript/SubagentBlock.js +3 -2
  145. package/dist/chat/transcript/TranscriptRail.d.ts +109 -0
  146. package/dist/chat/transcript/TranscriptRail.js +579 -0
  147. package/dist/chat/transcript/TranscriptRow.d.ts +4 -7
  148. package/dist/chat/transcript/TranscriptRow.js +9 -5
  149. package/dist/chat/transcript/actions.d.ts +43 -3
  150. package/dist/chat/transcript/actions.js +27 -1
  151. package/dist/chat/transcript/clipped-output.d.ts +58 -0
  152. package/dist/chat/transcript/clipped-output.js +131 -0
  153. package/dist/chat/transcript/fold-attachments.js +10 -5
  154. package/dist/chat/transcript/fold-worker.js +3 -2
  155. package/dist/chat/transcript/fold.js +21 -2
  156. package/dist/chat/transcript/index.d.ts +11 -9
  157. package/dist/chat/transcript/index.js +10 -8
  158. package/dist/chat/transcript/markdown-cache.d.ts +7 -1
  159. package/dist/chat/transcript/markdown-cache.js +12 -1
  160. package/dist/chat/transcript/markdown.js +116 -54
  161. package/dist/chat/transcript/media-gallery.d.ts +3 -2
  162. package/dist/chat/transcript/media-gallery.js +10 -7
  163. package/dist/chat/transcript/notices.d.ts +23 -1
  164. package/dist/chat/transcript/notices.js +110 -28
  165. package/dist/chat/transcript/prompt.js +6 -4
  166. package/dist/chat/transcript/prose.js +3 -1
  167. package/dist/chat/transcript/receipt-parts.d.ts +22 -0
  168. package/dist/chat/transcript/receipt-parts.js +87 -0
  169. package/dist/chat/transcript/root-items.d.ts +96 -0
  170. package/dist/chat/transcript/root-items.js +180 -0
  171. package/dist/chat/transcript/row-mount.d.ts +165 -0
  172. package/dist/chat/transcript/row-mount.js +498 -0
  173. package/dist/chat/transcript/row-parking.d.ts +125 -0
  174. package/dist/chat/transcript/row-parking.js +135 -0
  175. package/dist/chat/transcript/row-ui-state.d.ts +37 -0
  176. package/dist/chat/transcript/row-ui-state.js +53 -0
  177. package/dist/chat/transcript/run-rows.js +6 -78
  178. package/dist/chat/transcript/script-input.d.ts +1 -1
  179. package/dist/chat/transcript/scroll-clamp.js +1 -1
  180. package/dist/chat/transcript/tasks.js +3 -2
  181. package/dist/chat/transcript/tool-media.d.ts +4 -2
  182. package/dist/chat/transcript/tool-media.js +15 -7
  183. package/dist/chat/transcript/tool-parts.d.ts +27 -4
  184. package/dist/chat/transcript/tool-parts.js +31 -5
  185. package/dist/chat/transcript/tool-payload.js +26 -11
  186. package/dist/chat/transcript/tool-row.d.ts +2 -1
  187. package/dist/chat/transcript/tool-row.js +38 -19
  188. package/dist/chat/transcript/use-transcript-rows.d.ts +24 -7
  189. package/dist/chat/transcript/use-transcript-rows.js +28 -46
  190. package/dist/chat/transcript/useSettledReveal.js +15 -3
  191. package/dist/chat/transcript/useStickToBottom.js +4 -4
  192. package/dist/chat/transcript/useTranscriptSearch.js +30 -14
  193. package/dist/chat/transcript/view-scope.d.ts +26 -6
  194. package/dist/chat/transcript/view-scope.js +106 -20
  195. package/dist/components/ChoiceCards.js +1 -1
  196. package/dist/components/ConfirmDialog.js +1 -1
  197. package/dist/components/CopyValue.d.ts +33 -0
  198. package/dist/components/CopyValue.js +54 -0
  199. package/dist/components/Form.js +1 -1
  200. package/dist/components/HowItWorks.js +1 -1
  201. package/dist/components/Menu.js +1 -1
  202. package/dist/components/StepFrame.js +2 -2
  203. package/dist/components/SwatchPicker.js +1 -1
  204. package/dist/components/ToggleCard.js +1 -1
  205. package/dist/components/floating/HoverCard.js +2 -3
  206. package/dist/components/floating/hover-delay.d.ts +4 -0
  207. package/dist/components/floating/hover-delay.js +6 -0
  208. package/dist/core.css +14 -12
  209. package/dist/dist/{index-Betz0OWq.d.ts → index-C6-t1SS9.d.ts} +21 -2
  210. package/dist/dist/index-De9AbmxS.d.ts +1 -0
  211. package/dist/dist/index.d.ts +5 -5
  212. package/dist/dist/sandbox-CSUihARm.d.ts +2 -0
  213. package/dist/dist/{timeout-CyU7HLyz.d.ts → timeout-CmTx6V9y.d.ts} +1 -0
  214. package/dist/extensions/ExtensionDialogHost.js +1 -1
  215. package/dist/files/TreeColumn.js +3 -1
  216. package/dist/files/headless/host.d.ts +2 -2
  217. package/dist/git/ImportRepoDialog.js +1 -1
  218. package/dist/git/MoveSessionDialog.js +2 -2
  219. package/dist/git/SandboxManager.d.ts +42 -0
  220. package/dist/git/SandboxManager.js +297 -0
  221. package/dist/git/SyncChip.js +1 -1
  222. package/dist/git/headless/index.d.ts +2 -1
  223. package/dist/git/headless/index.js +2 -1
  224. package/dist/git/headless/labels.d.ts +29 -0
  225. package/dist/git/headless/labels.js +34 -1
  226. package/dist/git/headless/sandboxes.d.ts +43 -0
  227. package/dist/git/headless/sandboxes.js +52 -0
  228. package/dist/git/index.d.ts +2 -1
  229. package/dist/git/index.js +2 -1
  230. package/dist/index.d.ts +2 -1
  231. package/dist/index.js +2 -1
  232. package/dist/keybindings/headless/catalog.d.ts +1 -1
  233. package/dist/keybindings/headless/catalog.js +12 -0
  234. package/dist/machines/HostsSection.d.ts +1 -1
  235. package/dist/machines/headless/labels.js +2 -2
  236. package/dist/motion/flip-list.js +3 -10
  237. package/dist/motion/presence.d.ts +10 -0
  238. package/dist/motion/presence.js +20 -1
  239. package/dist/motion/swap.d.ts +8 -2
  240. package/dist/motion/swap.js +5 -2
  241. package/dist/onboarding/conversation.js +27 -15
  242. package/dist/onboarding/demos/how-it-works.js +1 -1
  243. package/dist/onboarding/skills/parts.js +4 -4
  244. package/dist/onboarding/sources/SourceBrowser.js +1 -1
  245. package/dist/onboarding/steps/ReadyStep.js +1 -1
  246. package/dist/onboarding/steps/connect/KeyForm.js +1 -1
  247. package/dist/palette/headless/app-sources.js +20 -0
  248. package/dist/palette/headless/labels.js +2 -0
  249. package/dist/session/PlanTracker.js +3 -3
  250. package/dist/session/SecretsPanel.js +1 -1
  251. package/dist/session/SessionHeader.d.ts +18 -6
  252. package/dist/session/SessionHeader.js +68 -12
  253. package/dist/session/SessionPlaceMenu.d.ts +35 -0
  254. package/dist/session/SessionPlaceMenu.js +299 -0
  255. package/dist/session/SessionShell.js +1 -1
  256. package/dist/session/TurnDetailsDialog.js +1 -1
  257. package/dist/session/headless/index.d.ts +2 -1
  258. package/dist/session/headless/index.js +2 -1
  259. package/dist/session/headless/labels.d.ts +73 -0
  260. package/dist/session/headless/labels.js +73 -0
  261. package/dist/session/headless/place.d.ts +49 -0
  262. package/dist/session/headless/place.js +57 -0
  263. package/dist/session/index.d.ts +2 -1
  264. package/dist/session/index.js +2 -1
  265. package/dist/settings/ConversationPresetsCard.js +1 -1
  266. package/dist/settings/SettingCard.js +2 -2
  267. package/dist/settings/SettingsRowsPage.js +1 -1
  268. package/dist/settings/headless/fixture-performance.js +4 -2
  269. package/dist/settings/headless/fixture-sections.js +7 -0
  270. package/dist/settings/headless/labels.d.ts +1 -1
  271. package/dist/settings/headless/labels.js +1 -1
  272. package/dist/settings/headless/layout.d.ts +4 -4
  273. package/dist/settings/headless/layout.js +1 -1
  274. package/dist/settings/headless/performance.d.ts +4 -0
  275. package/dist/settings/headless/search.d.ts +2 -2
  276. package/dist/settings/headless/sections-host.d.ts +20 -2
  277. package/dist/settings/sections/claude-import/ClaudeImportDialog.js +1 -1
  278. package/dist/settings/sections/enabled-list/EnabledListSection.js +2 -2
  279. package/dist/settings/sections/environments/EnvironmentsSection.d.ts +9 -3
  280. package/dist/settings/sections/environments/EnvironmentsSection.js +292 -52
  281. package/dist/settings/sections/environments/labels.d.ts +15 -0
  282. package/dist/settings/sections/environments/labels.js +18 -3
  283. package/dist/settings/sections/extensions/ChangeOriginDialog.js +1 -1
  284. package/dist/settings/sections/extensions/ExtensionSourceBrowser.js +1 -1
  285. package/dist/settings/sections/extensions/ExtensionsSection.d.ts +3 -2
  286. package/dist/settings/sections/extensions/ExtensionsSection.js +9 -3
  287. package/dist/settings/sections/host-catalog/HostCatalogSection.js +15 -5
  288. package/dist/settings/sections/keybindings/labels.d.ts +2 -0
  289. package/dist/settings/sections/keybindings/labels.js +2 -0
  290. package/dist/settings/sections/keybindings/rows.js +8 -0
  291. package/dist/settings/sections/models/SpacesDefaultsSection.d.ts +7 -3
  292. package/dist/settings/sections/models/SpacesDefaultsSection.js +11 -5
  293. package/dist/settings/sections/performance/PerformanceSection.js +8 -1
  294. package/dist/settings/sections/performance/labels.d.ts +2 -0
  295. package/dist/settings/sections/performance/labels.js +2 -0
  296. package/dist/settings/sections/skills/SkillGroups.js +1 -1
  297. package/dist/settings/server-app.d.ts +4 -2
  298. package/dist/settings/server-app.js +7 -3
  299. package/dist/settings/testing/sections.contract.d.ts +7 -1
  300. package/dist/settings/testing/sections.contract.js +37 -0
  301. package/dist/styles.css +243 -19
  302. package/dist/terminal/TerminalDrawer.js +3 -1
  303. package/dist/views/headless/answers.d.ts +8 -2
  304. package/dist/views/headless/answers.js +58 -1
  305. package/dist/views/headless/placement.d.ts +78 -0
  306. package/dist/views/headless/placement.js +154 -44
  307. package/dist/workspace/SidePanel.js +3 -1
  308. package/package.json +2 -2
  309. package/src/styles/base.css +13 -0
  310. package/src/styles/chat.css +30 -0
  311. package/src/styles/components.css +0 -10
  312. package/src/styles/files.css +5 -0
  313. package/src/styles/sidebar.css +29 -7
  314. package/src/styles/terminal.css +6 -0
  315. package/src/styles/tokens.css +5 -0
  316. package/src/styles/transcript.css +138 -0
  317. package/src/styles/workspace.css +6 -0
  318. package/dist/dist/index-QcFzZlao.d.ts +0 -1
  319. package/dist/dist/sandbox-D0zsW8I1.d.ts +0 -2
  320. /package/dist/dist/{types-_Dtoq_No.d.ts → execution-failure-SREfl-EZ.d.ts} +0 -0
@@ -21,7 +21,9 @@ const OTHER_BROWSER_DEFAULTS = {
21
21
  navigateForward: "alt+right",
22
22
  tabNext: "ctrl+alt+right",
23
23
  tabPrev: "ctrl+alt+left",
24
- toggleTerminal: "ctrl+`"
24
+ toggleTerminal: "ctrl+`",
25
+ previousPrompt: "alt+[",
26
+ nextPrompt: "alt+]"
25
27
  };
26
28
  /**
27
29
  * The chords a browser page receives, for the actions whose catalog chord it doesn't.
@@ -13,6 +13,12 @@
13
13
  * notifications go out at once (the store batches transcript events per
14
14
  * frame), a run's end neither appends an error row nor drops pending echoes,
15
15
  * and long messages split at the reducer's default size.
16
+ *
17
+ * Every write that follows the stream goes through the store's transcript
18
+ * reducers (a delta copies the open exchange, a run's end finishes the
19
+ * exchanges still live), and a transcript's state carries the store's
20
+ * transcript (`TranscriptState.transcript`): no write or read of the
21
+ * stream makes a whole-session array.
16
22
  */
17
23
  import { ChatAttachment, ChatEvent, ChatInteraction, ChatSession, ChatSessionStatus, Transcript, TranscriptState } from "../chat/headless/host.js";
18
24
  import { Readable, Writable } from "../chat/headless/store.js";
@@ -1,7 +1,8 @@
1
1
  import { writable } from "../chat/headless/store.js";
2
- import { applyLiveEvent, finishLive } from "../chat/headless/streams/live-events.js";
2
+ import { applyLiveEvent, finishLive, finishLiveTranscript } from "../chat/headless/streams/live-events.js";
3
3
  import { SessionStreamStore } from "../chat/headless/streams/store.js";
4
4
  import { transcriptSnapshot } from "../chat/headless/streams/transcript.js";
5
+ import { transcriptOfArray } from "zidane/chat/pure";
5
6
  // src/adapters/live.ts
6
7
  /** Closed sessions whose windows stay, most recent first: the desktop's prewarm window (`sidebar/directory.ts`) less the open one. */
7
8
  const RECENT_KEPT = 12;
@@ -108,7 +109,9 @@ function createLiveState(options = {}) {
108
109
  const t = transcript(sessionId);
109
110
  t.echoes = [];
110
111
  t.state.set((s) => ({
111
- ...s,
112
+ running: s.running,
113
+ hasEarlier: s.hasEarlier,
114
+ loadingEarlier: s.loadingEarlier,
112
115
  ...patch,
113
116
  events: [...events],
114
117
  hydrated: true
@@ -135,11 +138,14 @@ function createLiveState(options = {}) {
135
138
  store.appendUserPrompt(sessionId, text, void 0, attachments ?? []);
136
139
  },
137
140
  setRunning(sessionId, running, status) {
138
- transcript(sessionId).state.set((s) => s.running === running ? s : {
139
- ...s,
140
- running,
141
- events: running ? s.events : finishLive(s.events)
142
- });
141
+ transcript(sessionId);
142
+ if (store.getRunningSnapshot(sessionId) !== running) {
143
+ const prior = store.getTranscriptSnapshot(sessionId);
144
+ store.write(sessionId, {
145
+ running,
146
+ ...!running && prior ? { transcript: finishLiveTranscript(prior) } : {}
147
+ });
148
+ }
143
149
  patchSession(sessionId, {
144
150
  status: status ?? (running ? "running" : "completed"),
145
151
  updatedAt: Date.now()
@@ -185,8 +191,10 @@ function transcriptState(store, sessionId) {
185
191
  const prev = get();
186
192
  const resolved = typeof next === "function" ? next(prev) : next;
187
193
  if (Object.is(resolved, prev)) return;
194
+ const kept = resolved.transcript === prev.transcript;
195
+ const events = resolved.transcript && !kept ? { transcript: resolved.transcript } : (prev.transcript ? transcriptOfArray(resolved.events) !== prev.transcript : resolved.events !== prev.events) ? { events: resolved.events } : null;
188
196
  store.write(sessionId, {
189
- ...resolved.events !== prev.events ? { events: resolved.events } : {},
197
+ ...events,
190
198
  running: resolved.running,
191
199
  page: resolved.hydrated ? {
192
200
  firstSeq: store.getPageSnapshot(sessionId).firstSeq,
@@ -1,7 +1,7 @@
1
1
  import { createResourceStore, readableResource } from "../app/headless/resource.js";
2
2
  import { createModelPickerPrefs } from "../chat/headless/composer/model-picker-prefs.js";
3
3
  import { createRunMeter } from "../chat/headless/composer/run-meter.js";
4
- import { fmtTokens, formatCostLabel } from "zidane/chat/pure";
4
+ import { createDraftAttachmentCodec, fmtTokens, formatCostLabel } from "zidane/chat/pure";
5
5
  // src/adapters/server-composer-host.ts
6
6
  /** A resource's data seen through `map`; each snapshot maps once, so readers see a stable value. */
7
7
  function mapped(resource, map) {
@@ -116,6 +116,11 @@ function createServerComposerHost(options) {
116
116
  return () => void listeners.delete(filtered);
117
117
  };
118
118
  let seq = 0;
119
+ /** Draft attachments are chips on the wire: each file's bytes go up or come down once. */
120
+ const draftFiles = createDraftAttachmentCodec({
121
+ put: (file) => client.call("attachments.put", file),
122
+ get: (hash) => client.call("attachments.get", { hash })
123
+ });
119
124
  /** Each session's fields a `#` reference shows: a row change that moves none of them (a write to its history, a run) reads nothing again. */
120
125
  const chatKeys = /* @__PURE__ */ new Map();
121
126
  const chatsMoved = (signal) => {
@@ -191,7 +196,13 @@ function createServerComposerHost(options) {
191
196
  };
192
197
  return {
193
198
  drafts: {
194
- get: async (sessionId) => client.call("drafts.get", { sessionId }),
199
+ get: async (sessionId) => {
200
+ const { attachments, ...draft } = await client.call("drafts.get", { sessionId });
201
+ return attachments?.length ? {
202
+ ...draft,
203
+ attachments: await draftFiles.toFiles(attachments)
204
+ } : draft;
205
+ },
195
206
  set: async (sessionId, text, shell) => {
196
207
  await client.call("drafts.set", {
197
208
  sessionId,
@@ -199,21 +210,23 @@ function createServerComposerHost(options) {
199
210
  ...shell !== void 0 ? { shell } : {}
200
211
  });
201
212
  },
202
- setAttachments: async (sessionId, attachments) => {
213
+ setAttachments: (sessionId, attachments) => draftFiles.inOrder(`published:${sessionId}`, async () => {
203
214
  await client.call("drafts.setAttachments", {
204
215
  sessionId,
205
- attachments
216
+ attachments: await draftFiles.toChips(attachments)
206
217
  });
207
- },
218
+ }),
208
219
  onChanged: (listener) => on(["draft:changed"], ({ sessionId, text, shell }) => listener({
209
220
  sessionId,
210
221
  text,
211
222
  ...shell !== void 0 ? { shell } : {}
212
223
  })),
213
- onAttachmentsChanged: (listener) => on(["draft:attachments"], ({ sessionId, attachments }) => listener({
214
- sessionId,
215
- attachments
216
- }))
224
+ onAttachmentsChanged: (listener) => on(["draft:attachments"], ({ sessionId, attachments }) => {
225
+ draftFiles.inOrder(`received:${sessionId}`, () => draftFiles.toFiles(attachments)).then((files) => listener({
226
+ sessionId,
227
+ attachments: files
228
+ }), () => void 0);
229
+ })
217
230
  },
218
231
  completions: {
219
232
  ...client.can("files.list") ? { files: async (root) => root ? resources.fetch(filesSpec(root)) : [] } : {},
@@ -1,10 +1,12 @@
1
+ import { sliceToolOutput } from "../chat/headless/output-pager.js";
1
2
  import { promptOriginWire } from "../chat/headless/prompt-origin.js";
2
3
  import { wireOriginal } from "../chat/headless/send-flow.js";
3
4
  import { applyInboxPatch } from "../chat/headless/sidebar/inbox-state.js";
4
5
  import { writable } from "../chat/headless/store.js";
6
+ import "../chat/headless/streams/session-streams.js";
5
7
  import { createLiveState } from "./live.js";
6
8
  import { createServerClient } from "./server-client.js";
7
- import { mediaTicketOf, messageMediaAddress } from "./server-media.js";
9
+ import { blobMediaAddress, mediaTicketOf, messageMediaAddress } from "./server-media.js";
8
10
  import { createServerTranscriptMembers } from "./server-transcript-members.js";
9
11
  import { climbReconnectLadder, createRecentChanges, cursorValid, messageMediaOf } from "zidane/chat/pure";
10
12
  // src/adapters/server-host.ts
@@ -100,12 +102,27 @@ function createServerHost(options) {
100
102
  /** A session's signals that arrive while its reconnect ladder runs (`resume`), applied after what it brings. */
101
103
  const resuming = /* @__PURE__ */ new Map();
102
104
  const models = writable([]);
105
+ let subscribing = Promise.resolve();
106
+ /** The watched sessions whose run in flight the host can replay, as of the last subscription (`runReplay`). */
107
+ let runsInFlight = /* @__PURE__ */ new Set();
108
+ const syncSubscriptions = () => {
109
+ subscribing = subscribing.then(() => client.call("sessions.subscribe", { sessionIds: [...watched] }).then((result) => {
110
+ runsInFlight = new Set(result?.running ?? []);
111
+ }, onError));
112
+ return subscribing;
113
+ };
103
114
  const state = createLiveState({
104
115
  onOpen: (sessionId) => {
105
116
  watched.add(sessionId);
106
- if (client.hello()) hydrate(sessionId).catch(onError);
117
+ if (client.hello()) {
118
+ syncSubscriptions();
119
+ hydrate(sessionId).catch(onError);
120
+ }
121
+ },
122
+ onClose: (sessionId) => {
123
+ watched.delete(sessionId);
124
+ if (client.hello()) syncSubscriptions();
107
125
  },
108
- onClose: (sessionId) => watched.delete(sessionId),
109
126
  evict: true
110
127
  });
111
128
  /** The changes applied while the list is read again. They are newer than its answer (`createRecentChanges`). */
@@ -178,10 +195,10 @@ function createServerHost(options) {
178
195
  case "history:changed": if (watched.has(signal.sessionId) && state.applyHistory(signal.sessionId, signal)) reread(signal.sessionId);
179
196
  }
180
197
  };
181
- const loadPage = async (sessionId, before) => {
198
+ const loadPage = async (sessionId, before, limit = PAGE_TURNS) => {
182
199
  return client.call("sessions.loadEvents", {
183
200
  sessionId,
184
- limit: PAGE_TURNS,
201
+ limit,
185
202
  ...before !== void 0 ? { before } : {}
186
203
  });
187
204
  };
@@ -189,27 +206,72 @@ function createServerHost(options) {
189
206
  const buffered = [];
190
207
  hydrating.set(sessionId, buffered);
191
208
  let stale = false;
209
+ let replay = [];
192
210
  try {
211
+ await subscribing;
212
+ const run = runReplay(sessionId);
193
213
  const page = await loadPage(sessionId);
194
214
  const running = await client.call("chat.isRunning", { sessionId });
195
215
  stale = !state.hydrate(sessionId, page.events, {
196
216
  running,
197
217
  hasEarlier: page.cursor !== void 0
198
218
  }, page.pos, page.historyId);
199
- if (!stale) cursors.set(sessionId, {
200
- before: page.cursor,
201
- ...page.pos !== void 0 ? { pos: page.pos } : {},
202
- ...page.pos !== void 0 && page.historyId !== void 0 ? { historyId: page.historyId } : {}
203
- });
219
+ if (!stale) {
220
+ cursors.set(sessionId, {
221
+ before: page.cursor,
222
+ ...page.pos !== void 0 ? { pos: page.pos } : {},
223
+ ...page.pos !== void 0 && page.historyId !== void 0 ? { historyId: page.historyId } : {}
224
+ });
225
+ replay = await run;
226
+ }
204
227
  } finally {
205
228
  if (hydrating.get(sessionId) === buffered) hydrating.delete(sessionId);
206
- for (const { signal, meta } of buffered) onSignal(signal, meta);
229
+ for (const { signal, meta } of inSeqOrder(replay, buffered)) onSignal(signal, meta);
207
230
  }
208
231
  if (stale && attempts > 1) return hydrate(sessionId, attempts - 1);
209
232
  const interactions = await client.call("interactions.list", { sessionId });
210
233
  for (const i of state.pending(sessionId).get()) state.resolveInteraction(i.requestId);
211
234
  for (const i of interactions) state.addInteraction(sessionId, i.request);
212
235
  }
236
+ /** `replay` and `buffered` merged by number, each number once (the replay's copy); an unnumbered signal keeps its place. */
237
+ function inSeqOrder(replay, buffered) {
238
+ const replayed = new Set(replay.map((entry) => entry.seq));
239
+ const out = [];
240
+ let next = 0;
241
+ for (const entry of buffered) {
242
+ if (entry.meta !== void 0) {
243
+ while (next < replay.length && replay[next].seq <= entry.meta.seq) out.push({
244
+ signal: replay[next].signal,
245
+ meta: { seq: replay[next++].seq }
246
+ });
247
+ if (replayed.has(entry.meta.seq)) continue;
248
+ }
249
+ out.push(entry);
250
+ }
251
+ for (; next < replay.length; next++) out.push({
252
+ signal: replay[next].signal,
253
+ meta: { seq: replay[next].seq }
254
+ });
255
+ return out;
256
+ }
257
+ /**
258
+ * What the session's run in flight streamed and did not save yet
259
+ * (`sessions.resume` with `run`): the text of the step in flight, which the
260
+ * page a window reads cannot hold. Its transcript events only, by number.
261
+ * Asked only for a session the subscription answered as running. Empty when
262
+ * no run is in flight, or the server has none to give.
263
+ */
264
+ async function runReplay(sessionId) {
265
+ const from = client.hello()?.signalEpoch;
266
+ if (from === void 0 || !runsInFlight.has(sessionId)) return [];
267
+ const result = await client.call("sessions.resume", {
268
+ sessionId,
269
+ epoch: from,
270
+ afterSeq: -1,
271
+ run: true
272
+ }).catch(() => null);
273
+ return result?.ok && typeof result.through === "number" ? result.signals.filter((entry) => entry.signal.kind === "event") : [];
274
+ }
213
275
  /**
214
276
  * Reads a transcript again for a signal (a rewrite, a missed write, a run's end). One such read per session is in
215
277
  * flight. A read asked for while another runs is made when the first ends, if the first did not bring the window up
@@ -249,6 +311,7 @@ function createServerHost(options) {
249
311
  for (const { signal, meta } of held) if (meta === void 0 || meta.seq > replayedTo) onSignal(signal, meta);
250
312
  }
251
313
  };
314
+ await subscribing;
252
315
  const outcome = await climbReconnectLadder(bookmark, {
253
316
  resume: async (from, afterSeq) => {
254
317
  const result = await client.call("sessions.resume", {
@@ -295,24 +358,25 @@ function createServerHost(options) {
295
358
  }
296
359
  await hydrate(sessionId);
297
360
  };
298
- const loadEarlier = async (sessionId) => {
361
+ /** Splices the page before the window in; `true` when it did. `limit`: its turns (default a page's). */
362
+ const loadEarlier = async (sessionId, limit) => {
299
363
  const cursor = cursors.get(sessionId);
300
364
  const before = cursor?.before;
301
365
  const t = state.transcript(sessionId).state;
302
- if (before === void 0 || t.get().loadingEarlier) return;
366
+ if (before === void 0 || t.get().loadingEarlier) return false;
303
367
  t.set((s) => ({
304
368
  ...s,
305
369
  loadingEarlier: true
306
370
  }));
307
371
  try {
308
- const page = await loadPage(sessionId, before);
372
+ const page = await loadPage(sessionId, before, limit);
309
373
  if (!cursorValid(cursor?.pos, page, cursor?.historyId)) {
310
374
  t.set((s) => ({
311
375
  ...s,
312
376
  loadingEarlier: false
313
377
  }));
314
378
  await hydrate(sessionId);
315
- return;
379
+ return false;
316
380
  }
317
381
  cursors.set(sessionId, {
318
382
  before: page.cursor,
@@ -325,14 +389,40 @@ function createServerHost(options) {
325
389
  hasEarlier: page.cursor !== void 0,
326
390
  loadingEarlier: false
327
391
  }));
392
+ return true;
328
393
  } catch (error) {
329
394
  t.set((s) => ({
330
395
  ...s,
331
396
  loadingEarlier: false
332
397
  }));
333
398
  onError(error);
399
+ return false;
334
400
  }
335
401
  };
402
+ /** Loads the earlier pages up to turn position `index`, the gap at once (`Transcript.loadThrough`). */
403
+ const loadThrough = async (sessionId, index) => {
404
+ for (;;) {
405
+ const before = cursors.get(sessionId)?.before;
406
+ if (before === void 0 || before <= index) return before === void 0 ? state.transcript(sessionId).state.get().hydrated : true;
407
+ if (!await loadEarlier(sessionId, Math.min(before - index, 1e3))) return false;
408
+ }
409
+ };
410
+ /** The prompt outline (`sessions.loadEvents` with `outline`); `null` from a server from before it. */
411
+ const outline = async (sessionId) => {
412
+ const page = await client.call("sessions.loadEvents", {
413
+ sessionId,
414
+ outline: true,
415
+ limit: 1
416
+ });
417
+ return page.outline ? {
418
+ prompts: page.outline,
419
+ ...page.pos !== void 0 ? { pos: page.pos } : {},
420
+ ...page.floor !== void 0 ? { floor: page.floor } : {},
421
+ ...page.historyId !== void 0 ? { historyId: page.historyId } : {}
422
+ } : null;
423
+ };
424
+ /** Each session's transcript, one object per readable the state holds (readers memo on it; an evicted one goes with it). */
425
+ const transcripts = /* @__PURE__ */ new WeakMap();
336
426
  const refresh = async () => {
337
427
  const reading = listChanges.begin();
338
428
  try {
@@ -370,6 +460,7 @@ function createServerHost(options) {
370
460
  if (epoch === void 0 || hello.signalEpoch !== epoch) seqs.clear();
371
461
  epoch = hello.signalEpoch;
372
462
  loadModels().catch(onError);
463
+ if (watched.size > 0) syncSubscriptions();
373
464
  if (!reconnected) return;
374
465
  refresh().catch(onError);
375
466
  for (const bookmark of bookmarks) resume(bookmark.sessionId, bookmark).catch(onError);
@@ -517,7 +608,19 @@ function createServerHost(options) {
517
608
  setSpace: (spaceId) => client.call("sidebar.setSpace", { spaceId })
518
609
  } } : {}
519
610
  },
520
- transcript: (sessionId) => state.readable(sessionId, { loadEarlier: () => void loadEarlier(sessionId) }),
611
+ transcript: (sessionId) => {
612
+ const readable = state.readable(sessionId, { loadEarlier: () => void loadEarlier(sessionId) });
613
+ let transcript = transcripts.get(readable);
614
+ if (!transcript) {
615
+ transcript = {
616
+ ...readable,
617
+ loadThrough: (index) => loadThrough(sessionId, index),
618
+ outline: () => outline(sessionId)
619
+ };
620
+ transcripts.set(readable, transcript);
621
+ }
622
+ return transcript;
623
+ },
521
624
  async send({ sessionId, prompt, attachments, model, thinking, activatedSkills, echo, keepDraft, delivery, origin, literal }) {
522
625
  if (echo !== false && !delivery) state.echoPrompt(sessionId, prompt, attachments?.map(({ original: _original, ...a }) => a));
523
626
  await applyChoice(sessionId, model, thinking);
@@ -582,9 +685,27 @@ function createServerHost(options) {
582
685
  }
583
686
  },
584
687
  models,
585
- toolOutput: (sessionId, callId) => client.call("sessions.getToolResult", {
688
+ toolOutput: async (sessionId, callId) => {
689
+ const text = await client.call("sessions.getToolResult", {
690
+ sessionId,
691
+ callId
692
+ });
693
+ return typeof text === "string" ? text : null;
694
+ },
695
+ toolOutputRange: async (sessionId, callId, range, turnId) => {
696
+ const answer = await client.call("sessions.getToolResult", {
697
+ sessionId,
698
+ callId,
699
+ range,
700
+ ...turnId ? { turnId } : {}
701
+ });
702
+ if (answer === null || answer === void 0) return null;
703
+ return typeof answer === "string" ? sliceToolOutput(answer, range) : answer;
704
+ },
705
+ toolCall: (sessionId, callId, turnId) => client.call("sessions.getToolCall", {
586
706
  sessionId,
587
- callId
707
+ callId,
708
+ ...turnId ? { turnId } : {}
588
709
  }),
589
710
  messageMediaUrl(sessionId, src) {
590
711
  const media = messageMediaOf(src);
@@ -594,6 +715,10 @@ function createServerHost(options) {
594
715
  const cwd = folders.get(sessionId);
595
716
  return ticket && cwd !== void 0 ? messageMediaAddress(ticket, cwd, src) : void 0;
596
717
  },
718
+ blobMediaUrl(hash) {
719
+ const ticket = mediaTicketOf(client);
720
+ return ticket ? blobMediaAddress(ticket, hash) : void 0;
721
+ },
597
722
  cancelTool(sessionId, callId) {
598
723
  client.call("chat.cancelWork", {
599
724
  sessionId,
@@ -19,4 +19,12 @@ export declare function mediaTicketOf(client: ServerClient): string | null;
19
19
  * @param cwd - The session's folder.
20
20
  * @param src - The `src` as the message wrote it.
21
21
  */
22
- export declare function messageMediaAddress(ticket: string, cwd: string, src: string): string;
22
+ export declare function messageMediaAddress(ticket: string, cwd: string, src: string): string;
23
+ /**
24
+ * Where a medium the server's session store holds by hash loads from: the
25
+ * same address for the same bytes, which the server marks immutable.
26
+ *
27
+ * @param ticket - The client's media ticket.
28
+ * @param hash - The blob's hash.
29
+ */
30
+ export declare function blobMediaAddress(ticket: string, hash: string): string;
@@ -35,4 +35,17 @@ function messageMediaAddress(ticket, cwd, src) {
35
35
  src
36
36
  })}`;
37
37
  }
38
- export { mediaTicketOf, messageMediaAddress };
38
+ /**
39
+ * Where a medium the server's session store holds by hash loads from: the
40
+ * same address for the same bytes, which the server marks immutable.
41
+ *
42
+ * @param ticket - The client's media ticket.
43
+ * @param hash - The blob's hash.
44
+ */
45
+ function blobMediaAddress(ticket, hash) {
46
+ return `${SERVER_MEDIA_PATH}?${new URLSearchParams({
47
+ ticket,
48
+ blob: hash
49
+ })}`;
50
+ }
51
+ export { blobMediaAddress, mediaTicketOf, messageMediaAddress };
@@ -1,10 +1,11 @@
1
1
  import { writable } from "../chat/headless/store.js";
2
- import { DEFAULT_SETTINGS } from "../settings/headless/catalog.js";
2
+ import { DEFAULT_SETTINGS as DEFAULT_SETTINGS$1 } from "../settings/headless/catalog.js";
3
3
  import { closableClient } from "./closable-client.js";
4
4
  import { serverSettingsAccounts } from "./server-settings-accounts.js";
5
5
  import { serverSettingsModels } from "./server-settings-models.js";
6
6
  import { serverSettingsPerformance } from "./server-settings-performance.js";
7
7
  import { serverSettingsSections } from "./server-settings-sections.js";
8
+ import { spaceOps, spacesStateOf } from "zidane/chat/pure";
8
9
  import { ServerConnectionError } from "zidane/ipc/browser";
9
10
  // src/adapters/server-settings-host.ts
10
11
  function errorOf(error) {
@@ -30,7 +31,7 @@ function createServerSettingsHost(options) {
30
31
  return {
31
32
  status: "ready",
32
33
  values: {
33
- ...DEFAULT_SETTINGS,
34
+ ...DEFAULT_SETTINGS$1,
34
35
  ...local ? local.merge(values) : values
35
36
  }
36
37
  };
@@ -80,6 +81,27 @@ function createServerSettingsHost(options) {
80
81
  const next = client.can("settings.set");
81
82
  if (writableStore.get() !== next) writableStore.set(next);
82
83
  });
84
+ /** `patch` without its spaces part, once that part is written with `spaces.*` (a server that offers them). */
85
+ const writeSpaces = async (patch) => {
86
+ if (!("spaceList" in patch) && !("spaces" in patch) || !client.can("spaces.upsert") || !server) return patch;
87
+ const { spaceList, spaces, ...rest } = patch;
88
+ const before = spacesStateOf(server);
89
+ const ops = spaceOps(before, spacesStateOf({
90
+ spaces: "spaces" in patch ? spaces : server.spaces,
91
+ spaceList: "spaceList" in patch ? spaceList : server.spaceList
92
+ }));
93
+ for (const op of ops) if (op.kind === "upsert") await client.call("spaces.upsert", {
94
+ space: op.space,
95
+ index: op.index
96
+ });
97
+ else if (op.kind === "remove") await client.call("spaces.remove", { spaceId: op.spaceId });
98
+ else if (op.kind === "move") await client.call("spaces.move", {
99
+ spaceId: op.spaceId,
100
+ index: op.index
101
+ });
102
+ else await client.call("spaces.setEnabled", { enabled: op.enabled });
103
+ return rest;
104
+ };
83
105
  const update = async (patch) => {
84
106
  const current = document.get();
85
107
  if (current.status === "ready") document.set({
@@ -105,7 +127,12 @@ function createServerSettingsHost(options) {
105
127
  }
106
128
  generation += 1;
107
129
  try {
108
- const values = await client.call("settings.set", { patch: host });
130
+ const rest = await writeSpaces(host);
131
+ if (Object.keys(rest).length === 0) {
132
+ await refresh();
133
+ return;
134
+ }
135
+ const values = await client.call("settings.set", { patch: rest });
109
136
  generation += 1;
110
137
  document.set(ready(values));
111
138
  } catch (error) {
@@ -50,6 +50,9 @@ function serverSettingsSections(client) {
50
50
  const browse = (input) => call("extensions.browse", { source: input });
51
51
  const extensions = {
52
52
  list: async (cwd) => (await call("catalog.extensions", cwd ? { cwd } : {})).extensions,
53
+ subscribe: (_cwd, onChange) => client.onSignal((signal) => {
54
+ if (signal.kind === "catalog:changed" && signal.catalog === "extensions") onChange();
55
+ }),
53
56
  configSchema: extensionsResource((cwd) => call("extensions.configSchema", { cwd })),
54
57
  actions: extensionsResource((cwd) => call("extensions.actions", { cwd })),
55
58
  actionStatuses: (cwd) => call("extensions.actionStatuses", { cwd }),
@@ -124,7 +127,26 @@ function serverSettingsSections(client) {
124
127
  update: async (change) => {
125
128
  await call("environments.update", change);
126
129
  },
127
- verify: (kind) => call("environments.verify", { kind })
130
+ verify: (kind) => call("environments.verify", { kind }),
131
+ ...client.can("environments.fieldChoices") ? { fieldChoices: (kind, key) => call("environments.fieldChoices", {
132
+ kind,
133
+ key
134
+ }) } : {},
135
+ ...client.can("environments.sandboxes") ? {
136
+ sandboxes: (kind) => call("environments.sandboxes", { kind }),
137
+ pauseSandbox: async (kind, sandboxId) => {
138
+ await call("environments.pauseSandbox", {
139
+ kind,
140
+ sandboxId
141
+ });
142
+ },
143
+ deleteSandbox: async (kind, sandboxId) => {
144
+ await call("environments.deleteSandbox", {
145
+ kind,
146
+ sandboxId
147
+ });
148
+ }
149
+ } : {}
128
150
  },
129
151
  instructions: {
130
152
  segments: (sessionId) => call("sessions.contextSegments", { sessionId }),
@@ -2,7 +2,9 @@
2
2
  * A `SidebarHost` on a running zidane-server: when the handshake lists
3
3
  * `sessions.environmentActions`, a session's environment commands
4
4
  * (`sessions.environmentActions`, `sessions.runEnvironmentAction`) and
5
- * setting a failed environment up again (`sessions.retryEnvironment`), and,
5
+ * setting a failed environment up again (`sessions.retryEnvironment`), waking
6
+ * a paused one when the handshake lists `sessions.wakeEnvironment`, pausing one and deleting its sandbox when
7
+ * it lists `sessions.pauseEnvironment` and `sessions.deleteEnvironment`, and,
6
8
  * when the handshake lists it, the rows' badges (`artifacts.badges`, read again on a session's `artifact:recorded` /
7
9
  * `artifact:changed` and on `catalog:changed` for extensions).
8
10
  *
@@ -16,7 +16,16 @@ function createServerSidebarHost(options) {
16
16
  }),
17
17
  retry: async (sessionId) => {
18
18
  await client.call("sessions.retryEnvironment", { sessionId });
19
- }
19
+ },
20
+ ...client.can("sessions.wakeEnvironment") ? { wake: async (sessionId) => {
21
+ await client.call("sessions.wakeEnvironment", { sessionId });
22
+ } } : {},
23
+ ...client.can("sessions.pauseEnvironment") ? { pause: async (sessionId) => {
24
+ await client.call("sessions.pauseEnvironment", { sessionId });
25
+ } } : {},
26
+ ...client.can("sessions.deleteEnvironment") ? { remove: async (sessionId) => {
27
+ await client.call("sessions.deleteEnvironment", { sessionId });
28
+ } } : {}
20
29
  } } : {},
21
30
  ...client.can("artifacts.badges") ? { badges: {
22
31
  read: (sessionIds) => client.call("artifacts.badges", { sessionIds: [...sessionIds] }),
@@ -358,7 +358,7 @@ function ModalShell({ title, description, onClose, onBack, footer, actions, chil
358
358
  className: "text-sm font-semibold text-[var(--zg-text)] m-0 zg-balance",
359
359
  children: title
360
360
  }), description && /* @__PURE__ */ jsx("p", {
361
- className: "text-xs text-[var(--zg-text-muted)] mt-0.5 m-0 zg-pretty",
361
+ className: "text-xs text-[var(--zg-text-muted)] mt-0.5 m-0",
362
362
  children: description
363
363
  })]
364
364
  }),
@@ -26,7 +26,7 @@ function ApprovalShell({ title, description, onClose, footer, children, classNam
26
26
  className: "text-sm font-semibold text-[var(--zg-text)] m-0 zg-balance",
27
27
  children: title
28
28
  }), description && /* @__PURE__ */ jsx("p", {
29
- className: "text-xs text-[var(--zg-text-muted)] mt-0.5 m-0 zg-pretty",
29
+ className: "text-xs text-[var(--zg-text-muted)] mt-0.5 m-0",
30
30
  children: description
31
31
  })]
32
32
  }), onClose && /* @__PURE__ */ jsx(IconButton, {
@@ -47,12 +47,40 @@ export interface DaemonOrbProps {
47
47
  /** Inline styles on the root element, merged after the component's own. */
48
48
  style?: CSSProperties;
49
49
  }
50
+ /** Props for {@link StatusOrb}. */
51
+ export interface StatusOrbProps {
52
+ /** What the orb shows. */
53
+ state: OrbState;
54
+ /** A count of work in progress: the orb ripples once when it drops (a run ended). Absent: only state changes ripple. */
55
+ activity?: number;
56
+ /**
57
+ * What the light falls on: a sphere, or a cube (the Environments icon) for where a session runs.
58
+ * @default 'sphere'
59
+ */
60
+ shape?: 'sphere' | 'cube';
61
+ /**
62
+ * Diameter of the orb in pixels. Defaults to 10.
63
+ * @default 10
64
+ */
65
+ size?: number;
66
+ /** Extra classes on the root element. */
67
+ className?: string;
68
+ /** Inline styles on the root element, merged after the component's own. */
69
+ style?: CSSProperties;
70
+ }
71
+ /**
72
+ * Renders a status orb in a given state: the daemon's, or another place's (a session's sandbox or server). It
73
+ * ripples once when the state changes or `activity` drops.
74
+ *
75
+ * @param props - The {@link StatusOrbProps}.
76
+ */
77
+ export declare function StatusOrb({ state, activity, shape, size, className, style }: StatusOrbProps): import("react").JSX.Element;
50
78
  /**
51
79
  * Renders the daemon status orb for the given health and activity counts. It ripples once when the state changes or a run ends.
52
80
  *
53
81
  * @param props - The {@link DaemonOrbProps}.
54
82
  */
55
- export declare function DaemonOrb({ health, running, attention, size, className, style }: DaemonOrbProps): import("react").JSX.Element;
83
+ export declare function DaemonOrb({ health, running, attention, ...rest }: DaemonOrbProps): import("react").JSX.Element;
56
84
  /** Props for {@link DaemonOrbButton}: the orb's `health`, `running`, and `attention` plus the attributes of a `button` (without `children`). */
57
85
  export interface DaemonOrbButtonProps extends Pick<DaemonOrbProps, 'health' | 'running' | 'attention'>, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {}
58
86
  /** Renders the daemon orb inside an icon-button-sized `button`. The caller supplies the label (for example `aria-label`) and the click handler. */