zidane-ui 9.3.1 → 9.5.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 (665) hide show
  1. package/dist/adapters/index.d.ts +2 -1
  2. package/dist/adapters/index.js +2 -1
  3. package/dist/adapters/live.d.ts +9 -2
  4. package/dist/adapters/live.js +8 -2
  5. package/dist/adapters/server-approvals-host.js +3 -1
  6. package/dist/adapters/server-channels-host.d.ts +32 -0
  7. package/dist/adapters/server-channels-host.js +49 -0
  8. package/dist/adapters/server-composer-host.js +13 -0
  9. package/dist/adapters/server-files-host.js +12 -31
  10. package/dist/adapters/server-git-host.js +5 -2
  11. package/dist/adapters/server-host.js +44 -14
  12. package/dist/adapters/server-machines-host.d.ts +5 -0
  13. package/dist/adapters/server-machines-host.js +15 -1
  14. package/dist/adapters/server-oauth-flow.d.ts +2 -1
  15. package/dist/adapters/server-projects.d.ts +15 -0
  16. package/dist/adapters/server-projects.js +225 -0
  17. package/dist/adapters/server-session-host.d.ts +2 -0
  18. package/dist/adapters/server-session-host.js +69 -1
  19. package/dist/adapters/server-settings-sections.js +4 -1
  20. package/dist/adapters/sse-host.js +3 -0
  21. package/dist/adapters/sse-protocol.d.ts +10 -0
  22. package/dist/app/AppHostProvider.d.ts +1 -1
  23. package/dist/app/AppHostProvider.js +7 -2
  24. package/dist/app/ModalProvider.d.ts +6 -2
  25. package/dist/app/ModalProvider.js +38 -10
  26. package/dist/app/headless/app-host.d.ts +3 -0
  27. package/dist/appearance/ZoomIndicator.js +5 -8
  28. package/dist/approvals/ApprovalsProvider.d.ts +2 -1
  29. package/dist/approvals/ApprovalsProvider.js +12 -4
  30. package/dist/approvals/headless/host.d.ts +13 -2
  31. package/dist/approvals/headless/index.d.ts +3 -3
  32. package/dist/approvals/headless/index.js +2 -2
  33. package/dist/approvals/headless/labels.d.ts +12 -2
  34. package/dist/approvals/headless/labels.js +19 -1
  35. package/dist/channels/BindingEditorDialog.d.ts +18 -0
  36. package/dist/channels/BindingEditorDialog.js +637 -0
  37. package/dist/channels/ChannelAlertsList.d.ts +25 -0
  38. package/dist/channels/ChannelAlertsList.js +107 -0
  39. package/dist/channels/ChannelDefaultsSection.d.ts +20 -0
  40. package/dist/channels/ChannelDefaultsSection.js +133 -0
  41. package/dist/channels/ChannelsProvider.d.ts +31 -0
  42. package/dist/channels/ChannelsProvider.js +29 -0
  43. package/dist/channels/ChannelsSettingsSection.d.ts +40 -0
  44. package/dist/channels/ChannelsSettingsSection.js +456 -0
  45. package/dist/channels/ConnectionSetupDialog.d.ts +16 -0
  46. package/dist/channels/ConnectionSetupDialog.js +470 -0
  47. package/dist/channels/HeldRepliesList.d.ts +27 -0
  48. package/dist/channels/HeldRepliesList.js +173 -0
  49. package/dist/channels/ProjectChannelsSection.d.ts +55 -0
  50. package/dist/channels/ProjectChannelsSection.js +433 -0
  51. package/dist/channels/ReadinessChecklist.d.ts +102 -0
  52. package/dist/channels/ReadinessChecklist.js +273 -0
  53. package/dist/channels/TestSessionBanner.d.ts +24 -0
  54. package/dist/channels/TestSessionBanner.js +44 -0
  55. package/dist/channels/channels-parts.d.ts +104 -0
  56. package/dist/channels/channels-parts.js +203 -0
  57. package/dist/channels/context.d.ts +9 -0
  58. package/dist/channels/context.js +14 -0
  59. package/dist/channels/headless/access.d.ts +127 -0
  60. package/dist/channels/headless/access.js +187 -0
  61. package/dist/channels/headless/fixture-host.d.ts +83 -0
  62. package/dist/channels/headless/fixture-host.js +557 -0
  63. package/dist/channels/headless/host.d.ts +245 -0
  64. package/dist/channels/headless/host.js +39 -0
  65. package/dist/channels/headless/index.d.ts +10 -0
  66. package/dist/channels/headless/index.js +5 -0
  67. package/dist/channels/headless/labels.d.ts +217 -0
  68. package/dist/channels/headless/labels.js +260 -0
  69. package/dist/channels/headless/state.d.ts +22 -0
  70. package/dist/channels/headless/state.js +303 -0
  71. package/dist/channels/index.d.ts +21 -0
  72. package/dist/channels/index.js +13 -0
  73. package/dist/channels/testing/contract.d.ts +31 -0
  74. package/dist/channels/testing/contract.js +378 -0
  75. package/dist/channels/testing/index.d.ts +7 -0
  76. package/dist/channels/testing/index.js +1 -0
  77. package/dist/chat/HostBadge.js +1 -0
  78. package/dist/chat/HostTranscript.js +15 -1
  79. package/dist/chat/OrchestratorBadge.d.ts +23 -0
  80. package/dist/chat/OrchestratorBadge.js +22 -0
  81. package/dist/chat/SessionGroupHeader.d.ts +11 -1
  82. package/dist/chat/SessionGroupHeader.js +25 -14
  83. package/dist/chat/SessionRow.d.ts +141 -0
  84. package/dist/chat/SessionRow.js +215 -0
  85. package/dist/chat/SessionStreamsProvider.d.ts +1 -1
  86. package/dist/chat/StatusDot.d.ts +7 -2
  87. package/dist/chat/StatusDot.js +3 -2
  88. package/dist/chat/Transcript.d.ts +3 -2
  89. package/dist/chat/Transcript.js +26 -7
  90. package/dist/chat/composer/ComposerEditor.js +1 -1
  91. package/dist/chat/composer/ContextBreakdown.d.ts +27 -2
  92. package/dist/chat/composer/ContextBreakdown.js +123 -2
  93. package/dist/chat/composer/DraftPickers.js +2 -0
  94. package/dist/chat/composer/HostContextOrb.d.ts +2 -0
  95. package/dist/chat/composer/HostContextOrb.js +17 -2
  96. package/dist/chat/composer/ModelOptionsPicker.js +6 -2
  97. package/dist/chat/composer/ModelPicker.d.ts +1 -1
  98. package/dist/chat/composer/PlacePicker.d.ts +3 -1
  99. package/dist/chat/composer/PlacePicker.js +5 -1
  100. package/dist/chat/composer/ProjectMenu.d.ts +16 -3
  101. package/dist/chat/composer/ProjectMenu.js +102 -20
  102. package/dist/chat/composer/ScopeToggle.d.ts +3 -1
  103. package/dist/chat/composer/ScopeToggle.js +2 -1
  104. package/dist/chat/composer/ServerScopeToggle.d.ts +3 -1
  105. package/dist/chat/composer/ServerScopeToggle.js +2 -1
  106. package/dist/chat/composer/index.d.ts +2 -2
  107. package/dist/chat/composer/index.js +2 -2
  108. package/dist/chat/composer/use-draft-target.d.ts +5 -0
  109. package/dist/chat/composer/use-draft-target.js +18 -3
  110. package/dist/chat/composer/use-send-prompt.d.ts +2 -0
  111. package/dist/chat/composer/use-send-prompt.js +4 -1
  112. package/dist/chat/headless/answered-first.d.ts +28 -0
  113. package/dist/chat/headless/answered-first.js +14 -0
  114. package/dist/chat/headless/block-runs.js +26 -1
  115. package/dist/chat/headless/chip-labels.d.ts +2 -0
  116. package/dist/chat/headless/chip-labels.js +2 -0
  117. package/dist/chat/headless/chip-views.js +1 -1
  118. package/dist/chat/headless/composer/composer-sources.d.ts +5 -2
  119. package/dist/chat/headless/composer/composer-sources.js +6 -0
  120. package/dist/chat/headless/composer/host.d.ts +13 -0
  121. package/dist/chat/headless/composer/index.d.ts +2 -2
  122. package/dist/chat/headless/composer/labels-chrome.d.ts +3 -0
  123. package/dist/chat/headless/composer/labels-chrome.js +4 -1
  124. package/dist/chat/headless/composer/labels-editor.d.ts +2 -0
  125. package/dist/chat/headless/composer/labels-editor.js +2 -0
  126. package/dist/chat/headless/draft-target.d.ts +30 -1
  127. package/dist/chat/headless/draft-target.js +22 -1
  128. package/dist/chat/headless/folder-groups.d.ts +41 -0
  129. package/dist/chat/headless/folder-groups.js +76 -0
  130. package/dist/chat/headless/host.d.ts +16 -1
  131. package/dist/chat/headless/hosts.d.ts +4 -0
  132. package/dist/chat/headless/index.d.ts +31 -27
  133. package/dist/chat/headless/index.js +33 -29
  134. package/dist/chat/headless/labels.d.ts +34 -4
  135. package/dist/chat/headless/labels.js +28 -6
  136. package/dist/chat/headless/markdown-scan.d.ts +0 -2
  137. package/dist/chat/headless/markdown-scan.js +3 -8
  138. package/dist/chat/headless/markdown-stream.js +3 -3
  139. package/dist/chat/headless/prompt-origin.d.ts +4 -2
  140. package/dist/chat/headless/prompt-origin.js +9 -5
  141. package/dist/chat/headless/send-flow.d.ts +2 -0
  142. package/dist/chat/headless/session-list.d.ts +28 -2
  143. package/dist/chat/headless/sidebar/directory.d.ts +15 -1
  144. package/dist/chat/headless/sidebar/directory.js +11 -1
  145. package/dist/chat/headless/sidebar/environment.d.ts +15 -4
  146. package/dist/chat/headless/sidebar/environment.js +27 -9
  147. package/dist/chat/headless/sidebar/inbox.d.ts +13 -3
  148. package/dist/chat/headless/sidebar/inbox.js +40 -19
  149. package/dist/chat/headless/sidebar/index.d.ts +6 -4
  150. package/dist/chat/headless/sidebar/index.js +5 -3
  151. package/dist/chat/headless/sidebar/labels.d.ts +38 -8
  152. package/dist/chat/headless/sidebar/labels.js +8 -4
  153. package/dist/chat/headless/sidebar/project-main.d.ts +43 -0
  154. package/dist/chat/headless/sidebar/project-main.js +46 -0
  155. package/dist/chat/headless/sidebar/row-changes.d.ts +43 -0
  156. package/dist/chat/headless/sidebar/row-changes.js +43 -0
  157. package/dist/chat/headless/sidebar/rows.d.ts +2 -1
  158. package/dist/chat/headless/sidebar/rows.js +7 -3
  159. package/dist/chat/headless/sidebar/types.d.ts +12 -0
  160. package/dist/chat/headless/streams/actions.d.ts +2 -2
  161. package/dist/chat/headless/streams/actions.js +1 -1
  162. package/dist/chat/headless/streams/event-bytes.d.ts +12 -1
  163. package/dist/chat/headless/streams/event-bytes.js +13 -1
  164. package/dist/chat/headless/streams/live-events.d.ts +12 -0
  165. package/dist/chat/headless/streams/live-events.js +21 -2
  166. package/dist/chat/headless/streams/store.d.ts +38 -5
  167. package/dist/chat/headless/streams/store.js +74 -22
  168. package/dist/chat/headless/streams/transcript-map.js +2 -5
  169. package/dist/chat/headless/streams/types.d.ts +4 -2
  170. package/dist/chat/headless/transcript/collapse.js +6 -1
  171. package/dist/chat/headless/transcript/rail.d.ts +8 -1
  172. package/dist/chat/headless/transcript/rail.js +9 -2
  173. package/dist/chat/headless/transcript/rows.d.ts +5 -1
  174. package/dist/chat/headless/transcript-labels.d.ts +1 -0
  175. package/dist/chat/index.d.ts +6 -4
  176. package/dist/chat/index.js +8 -6
  177. package/dist/chat/interactions/HostInteractions.js +4 -2
  178. package/dist/chat/interactions/InboxPanel.js +6 -4
  179. package/dist/chat/interactions/use-answer-interaction.d.ts +11 -0
  180. package/dist/chat/interactions/use-answer-interaction.js +19 -0
  181. package/dist/chat/rich-composer/artifact-mentions.d.ts +29 -0
  182. package/dist/chat/rich-composer/artifact-mentions.js +40 -0
  183. package/dist/chat/rich-composer/composer-extensions.d.ts +3 -2
  184. package/dist/chat/rich-composer/composer-extensions.js +12 -9
  185. package/dist/chat/rich-composer/use-composer-sources.js +1 -0
  186. package/dist/chat/sidebar/InboxList.d.ts +13 -2
  187. package/dist/chat/sidebar/InboxList.js +44 -48
  188. package/dist/chat/sidebar/MainSessionRow.d.ts +2 -1
  189. package/dist/chat/sidebar/MainSessionRow.js +1 -1
  190. package/dist/chat/sidebar/ProjectIcon.d.ts +8 -4
  191. package/dist/chat/sidebar/ProjectIcon.js +16 -4
  192. package/dist/chat/sidebar/RowChips.js +2 -2
  193. package/dist/chat/sidebar/SessionSidebar.d.ts +47 -0
  194. package/dist/chat/sidebar/SessionSidebar.js +85 -28
  195. package/dist/chat/sidebar/SidebarFilterMenu.js +0 -1
  196. package/dist/chat/sidebar/SidebarFold.js +17 -16
  197. package/dist/chat/sidebar/SidebarFooter.d.ts +2 -23
  198. package/dist/chat/sidebar/SidebarFooter.js +2 -43
  199. package/dist/chat/sidebar/SidebarGroupHeader.d.ts +7 -3
  200. package/dist/chat/sidebar/SidebarGroupHeader.js +15 -10
  201. package/dist/chat/sidebar/SidebarLiveProvider.d.ts +22 -0
  202. package/dist/chat/sidebar/SidebarLiveProvider.js +20 -0
  203. package/dist/chat/sidebar/SidebarSessionRow.d.ts +12 -1
  204. package/dist/chat/sidebar/SidebarSessionRow.js +25 -13
  205. package/dist/chat/sidebar/inbox-triage.d.ts +18 -2
  206. package/dist/chat/sidebar/inbox-triage.js +39 -12
  207. package/dist/chat/sidebar/index.d.ts +5 -4
  208. package/dist/chat/sidebar/index.js +3 -2
  209. package/dist/chat/sidebar/session-menu.d.ts +4 -0
  210. package/dist/chat/sidebar/session-menu.js +14 -2
  211. package/dist/chat/sidebar/sidebar-live.d.ts +29 -2
  212. package/dist/chat/sidebar/sidebar-live.js +64 -6
  213. package/dist/chat/sidebar/useInboxRows.js +8 -9
  214. package/dist/chat/sidebar/useInboxTriage.d.ts +5 -2
  215. package/dist/chat/sidebar/useInboxTriage.js +78 -67
  216. package/dist/chat/sidebar/useSessionSearch.js +19 -18
  217. package/dist/chat/testing/fixture-composer-host.d.ts +3 -1
  218. package/dist/chat/testing/fixture-composer-host.js +1 -0
  219. package/dist/chat/transcript/FileChip.js +28 -0
  220. package/dist/chat/transcript/LazyRow.d.ts +1 -1
  221. package/dist/chat/transcript/LazyRow.js +3 -4
  222. package/dist/chat/transcript/PromptEcho.js +18 -13
  223. package/dist/chat/transcript/PromptOriginLabel.d.ts +1 -1
  224. package/dist/chat/transcript/SessionChip.d.ts +11 -0
  225. package/dist/chat/transcript/SessionChip.js +34 -0
  226. package/dist/chat/transcript/TranscriptRail.d.ts +4 -2
  227. package/dist/chat/transcript/TranscriptRail.js +12 -2
  228. package/dist/chat/transcript/TranscriptRow.js +1 -0
  229. package/dist/chat/transcript/badges.d.ts +1 -0
  230. package/dist/chat/transcript/badges.js +1 -0
  231. package/dist/chat/transcript/chip-details.d.ts +11 -0
  232. package/dist/chat/transcript/chip-details.js +17 -1
  233. package/dist/chat/transcript/fold-worker.js +2 -1
  234. package/dist/chat/transcript/fold.js +13 -4
  235. package/dist/chat/transcript/index.d.ts +3 -3
  236. package/dist/chat/transcript/index.js +3 -3
  237. package/dist/chat/transcript/inline-facts.d.ts +9 -0
  238. package/dist/chat/transcript/inline-facts.js +20 -0
  239. package/dist/chat/transcript/markdown-cache.d.ts +10 -1
  240. package/dist/chat/transcript/markdown-cache.js +37 -4
  241. package/dist/chat/transcript/markdown.js +27 -34
  242. package/dist/chat/transcript/media-gallery.js +13 -16
  243. package/dist/chat/transcript/messages.js +5 -4
  244. package/dist/chat/transcript/notices.d.ts +25 -3
  245. package/dist/chat/transcript/notices.js +136 -17
  246. package/dist/chat/transcript/prompt.d.ts +1 -1
  247. package/dist/chat/transcript/prompt.js +8 -1
  248. package/dist/chat/transcript/row-mount.d.ts +27 -8
  249. package/dist/chat/transcript/row-mount.js +114 -80
  250. package/dist/chat/transcript/row-parking.d.ts +27 -0
  251. package/dist/chat/transcript/row-parking.js +37 -1
  252. package/dist/chat/transcript/script-input.d.ts +1 -1
  253. package/dist/chat/transcript/tasks.d.ts +1 -1
  254. package/dist/chat/transcript/tasks.js +1 -1
  255. package/dist/chat/transcript/tool-parts.js +0 -1
  256. package/dist/chat/transcript/tool-row.js +3 -2
  257. package/dist/chat/transcript/use-transcript-rows.d.ts +1 -1
  258. package/dist/chat/transcript/useHistoryBackfill.d.ts +42 -0
  259. package/dist/chat/transcript/useHistoryBackfill.js +170 -0
  260. package/dist/chat/transcript/useTranscriptFind.js +2 -4
  261. package/dist/chat/transcript/useTranscriptScroll.d.ts +7 -4
  262. package/dist/chat/transcript/useTranscriptScroll.js +12 -1
  263. package/dist/chat/transcript/useTranscriptSearch.d.ts +2 -2
  264. package/dist/chat/transcript/useTranscriptSearch.js +6 -6
  265. package/dist/chat/transcript/useTranscriptSelectionCopy.d.ts +5 -5
  266. package/dist/chat/transcript/useTranscriptSelectionCopy.js +28 -7
  267. package/dist/code/editor/FileTree.d.ts +2 -0
  268. package/dist/code/editor/FileTree.js +1 -1
  269. package/dist/code/editor/FileView.js +16 -27
  270. package/dist/code/editor/find/useFind.js +17 -17
  271. package/dist/code/editor/useCodeDocument.js +22 -19
  272. package/dist/code/editor/useDetachCleanup.js +4 -3
  273. package/dist/code/use-highlighted-html.js +12 -13
  274. package/dist/components/Form.d.ts +28 -1
  275. package/dist/components/Form.js +43 -7
  276. package/dist/components/HelpTip.d.ts +22 -0
  277. package/dist/components/HelpTip.js +26 -0
  278. package/dist/components/IconButton.d.ts +3 -1
  279. package/dist/components/IconButton.js +7 -2
  280. package/dist/components/IconButtonTip.d.ts +3 -1
  281. package/dist/components/IconButtonTip.js +2 -1
  282. package/dist/components/Menu.js +1 -1
  283. package/dist/components/Notice.d.ts +6 -4
  284. package/dist/components/Notice.js +73 -27
  285. package/dist/components/Progress.js +10 -4
  286. package/dist/components/RowActionsMenu.js +7 -14
  287. package/dist/components/SearchField.d.ts +46 -0
  288. package/dist/components/SearchField.js +50 -0
  289. package/dist/components/ShowMore.d.ts +48 -0
  290. package/dist/components/ShowMore.js +57 -0
  291. package/dist/components/Tooltip.d.ts +4 -1
  292. package/dist/components/Tooltip.js +16 -11
  293. package/dist/components/assign-ref.d.ts +8 -0
  294. package/dist/components/assign-ref.js +12 -0
  295. package/dist/components/charts/ScatterChart.js +13 -6
  296. package/dist/components/floating/FloatingSurface.js +4 -4
  297. package/dist/components/floating/HoverCard.js +32 -14
  298. package/dist/components/floating/Popover.js +4 -7
  299. package/dist/components/floating/useAnchoredPosition.d.ts +20 -4
  300. package/dist/components/floating/useAnchoredPosition.js +44 -10
  301. package/dist/components/object-key.d.ts +7 -0
  302. package/dist/components/object-key.js +18 -0
  303. package/dist/components/palette/PaletteList.d.ts +5 -5
  304. package/dist/components/palette/PaletteList.js +1 -7
  305. package/dist/components/palette/PalettePanel.js +18 -12
  306. package/dist/components/palette/palette-layout.d.ts +5 -1
  307. package/dist/components/palette/palette-layout.js +13 -10
  308. package/dist/components/tooltip-arming.d.ts +3 -0
  309. package/dist/components/tooltip-arming.js +8 -1
  310. package/dist/core.css +45 -20
  311. package/dist/dist/index-BmO8bRgK.d.ts +1 -0
  312. package/dist/dist/{index-C6-t1SS9.d.ts → index-Bsp5Ku7r.d.ts} +264 -133
  313. package/dist/dist/index.d.ts +5 -5
  314. package/dist/dist/sandbox-Bzg_jJK2.d.ts +2 -0
  315. package/dist/dist/{timeout-CmTx6V9y.d.ts → timeout-NoG7ppkm.d.ts} +1 -1
  316. package/dist/files/FilesProvider.d.ts +2 -0
  317. package/dist/files/FilesProvider.js +5 -1
  318. package/dist/files/FilesTab.js +0 -1
  319. package/dist/files/TreeColumn.d.ts +2 -4
  320. package/dist/files/TreeColumn.js +0 -5
  321. package/dist/files/headless/host.d.ts +9 -9
  322. package/dist/files/headless/labels.d.ts +0 -1
  323. package/dist/files/headless/labels.js +0 -1
  324. package/dist/files/headless/workspace-diff.js +1 -1
  325. package/dist/files/index.d.ts +2 -2
  326. package/dist/files/index.js +2 -2
  327. package/dist/files/useCodeReview.js +1 -3
  328. package/dist/files/useFilesDiagnostics.d.ts +1 -1
  329. package/dist/files/useFilesDiagnostics.js +4 -11
  330. package/dist/files/useOpenFiles.js +9 -12
  331. package/dist/files/useWorkspace.d.ts +5 -7
  332. package/dist/files/useWorkspace.js +4 -15
  333. package/dist/git/GitBar.js +13 -5
  334. package/dist/git/MoveSessionDialog.d.ts +18 -8
  335. package/dist/git/MoveSessionDialog.js +39 -57
  336. package/dist/git/MoveToDialog.d.ts +63 -0
  337. package/dist/git/MoveToDialog.js +267 -0
  338. package/dist/git/SandboxManager.js +9 -4
  339. package/dist/git/SyncChip.js +11 -4
  340. package/dist/git/TeleportSessionDialog.d.ts +76 -0
  341. package/dist/git/TeleportSessionDialog.js +596 -0
  342. package/dist/git/WherePicker.js +4 -1
  343. package/dist/git/headless/host.d.ts +14 -0
  344. package/dist/git/headless/index.d.ts +2 -1
  345. package/dist/git/headless/index.js +2 -1
  346. package/dist/git/headless/labels.d.ts +52 -1
  347. package/dist/git/headless/labels.js +58 -0
  348. package/dist/git/headless/sandboxes.d.ts +1 -1
  349. package/dist/git/headless/sandboxes.js +4 -3
  350. package/dist/git/headless/teleport.d.ts +76 -0
  351. package/dist/git/headless/teleport.js +19 -0
  352. package/dist/git/index.d.ts +5 -3
  353. package/dist/git/index.js +5 -3
  354. package/dist/git/useEnvironmentChoices.d.ts +24 -2
  355. package/dist/git/useEnvironmentChoices.js +43 -11
  356. package/dist/hooks/useLastCount.d.ts +9 -0
  357. package/dist/hooks/useLastCount.js +29 -0
  358. package/dist/hooks/useLatest.d.ts +8 -0
  359. package/dist/hooks/useLatest.js +17 -0
  360. package/dist/hooks/useMinuteTick.d.ts +6 -2
  361. package/dist/hooks/useMinuteTick.js +12 -6
  362. package/dist/hooks/useNearViewport.js +11 -8
  363. package/dist/index.d.ts +8 -3
  364. package/dist/index.js +8 -3
  365. package/dist/keybindings/KeybindingsProvider.js +3 -4
  366. package/dist/keybindings/headless/catalog.d.ts +1 -1
  367. package/dist/keybindings/headless/catalog.js +18 -0
  368. package/dist/keybindings/headless/overrides.d.ts +1 -1
  369. package/dist/keybindings/headless/overrides.js +14 -3
  370. package/dist/labels.d.ts +7 -0
  371. package/dist/labels.js +10 -3
  372. package/dist/machines/AddMachineDialog.js +1 -1
  373. package/dist/machines/AddServerForm.d.ts +14 -2
  374. package/dist/machines/AddServerForm.js +198 -30
  375. package/dist/machines/Banners.d.ts +2 -2
  376. package/dist/machines/Banners.js +3 -3
  377. package/dist/machines/DaemonMenu.js +1 -3
  378. package/dist/machines/HostCapabilities.js +8 -4
  379. package/dist/machines/HostSignIn.d.ts +2 -1
  380. package/dist/machines/HostSignIn.js +1 -0
  381. package/dist/machines/HostSyncPanel.d.ts +4 -1
  382. package/dist/machines/HostSyncPanel.js +248 -132
  383. package/dist/machines/HostsSection.d.ts +2 -2
  384. package/dist/machines/HostsSection.js +94 -51
  385. package/dist/machines/LinkedAccountsPanel.d.ts +29 -0
  386. package/dist/machines/LinkedAccountsPanel.js +268 -0
  387. package/dist/machines/MachinesExplainer.d.ts +4 -4
  388. package/dist/machines/MachinesExplainer.js +27 -17
  389. package/dist/machines/OrganizationPanel.d.ts +32 -0
  390. package/dist/machines/OrganizationPanel.js +553 -0
  391. package/dist/machines/ProjectsSpendPanel.d.ts +22 -0
  392. package/dist/machines/ProjectsSpendPanel.js +160 -0
  393. package/dist/machines/ServerMachinesPanel.js +19 -4
  394. package/dist/machines/ServerUpdatePanel.js +3 -3
  395. package/dist/machines/SyncAccounts.d.ts +14 -7
  396. package/dist/machines/SyncAccounts.js +67 -81
  397. package/dist/machines/TokensPanel.js +54 -30
  398. package/dist/machines/headless/fixture-host.d.ts +15 -0
  399. package/dist/machines/headless/fixture-host.js +75 -0
  400. package/dist/machines/headless/fixtures.d.ts +12 -0
  401. package/dist/machines/headless/fixtures.js +71 -1
  402. package/dist/machines/headless/host.d.ts +25 -1
  403. package/dist/machines/headless/index.d.ts +3 -1
  404. package/dist/machines/headless/index.js +3 -1
  405. package/dist/machines/headless/labels.d.ts +104 -8
  406. package/dist/machines/headless/labels.js +121 -21
  407. package/dist/machines/headless/linked-accounts.d.ts +42 -0
  408. package/dist/machines/headless/linked-accounts.js +31 -0
  409. package/dist/machines/headless/organization.d.ts +44 -0
  410. package/dist/machines/headless/organization.js +54 -0
  411. package/dist/machines/headless/sync.d.ts +2 -0
  412. package/dist/machines/index.d.ts +4 -1
  413. package/dist/machines/index.js +4 -1
  414. package/dist/machines/sync-rows.d.ts +8 -0
  415. package/dist/machines/sync-rows.js +10 -0
  416. package/dist/machines/testing/index.d.ts +3 -3
  417. package/dist/machines/testing/index.js +2 -2
  418. package/dist/motion/grow.js +12 -13
  419. package/dist/motion/swap.js +2 -5
  420. package/dist/motion/use-flip-list.d.ts +14 -0
  421. package/dist/motion/use-flip-list.js +17 -12
  422. package/dist/onboarding/demos/extensions.d.ts +4 -0
  423. package/dist/onboarding/demos/extensions.js +27 -1
  424. package/dist/onboarding/demos/sidebar-layout.d.ts +4 -2
  425. package/dist/onboarding/demos/sidebar-layout.js +5 -2
  426. package/dist/onboarding/headless/labels.d.ts +9 -0
  427. package/dist/onboarding/headless/labels.js +2 -0
  428. package/dist/onboarding/steps/SidebarStep.js +4 -2
  429. package/dist/onboarding/steps/setting-cards.d.ts +4 -2
  430. package/dist/onboarding/steps/setting-cards.js +3 -2
  431. package/dist/palette/PaletteDialog.js +4 -4
  432. package/dist/palette/PaletteRows.js +34 -16
  433. package/dist/palette/headless/app-sources.js +40 -1
  434. package/dist/palette/headless/labels.js +5 -2
  435. package/dist/palette/usePaletteController.js +4 -8
  436. package/dist/server/sse-handler.js +25 -2
  437. package/dist/session/ArtifactsPanel.js +11 -23
  438. package/dist/session/DiffFileTree.js +1 -4
  439. package/dist/session/NewProjectDialog.d.ts +33 -0
  440. package/dist/session/NewProjectDialog.js +216 -0
  441. package/dist/session/OpenProjectsDialog.d.ts +56 -0
  442. package/dist/session/OpenProjectsDialog.js +324 -0
  443. package/dist/session/OpenSessionsDialog.d.ts +46 -0
  444. package/dist/session/OpenSessionsDialog.js +295 -0
  445. package/dist/session/PlanTracker.js +1 -2
  446. package/dist/session/ProjectArtifactsHome.d.ts +42 -0
  447. package/dist/session/ProjectArtifactsHome.js +98 -0
  448. package/dist/session/ProjectArtifactsSection.d.ts +13 -0
  449. package/dist/session/ProjectArtifactsSection.js +367 -0
  450. package/dist/session/ProjectBudgetsSection.d.ts +7 -0
  451. package/dist/session/ProjectBudgetsSection.js +377 -0
  452. package/dist/session/ProjectContextSection.d.ts +20 -0
  453. package/dist/session/ProjectContextSection.js +139 -0
  454. package/dist/session/ProjectHome.d.ts +32 -5
  455. package/dist/session/ProjectHome.js +502 -254
  456. package/dist/session/ProjectInstructionsSection.d.ts +7 -0
  457. package/dist/session/ProjectInstructionsSection.js +179 -0
  458. package/dist/session/ProjectMainButton.d.ts +35 -0
  459. package/dist/session/ProjectMainButton.js +73 -0
  460. package/dist/session/ProjectName.d.ts +76 -0
  461. package/dist/session/ProjectName.js +140 -0
  462. package/dist/session/ProjectOrchestratorSection.d.ts +14 -0
  463. package/dist/session/ProjectOrchestratorSection.js +117 -0
  464. package/dist/session/ProjectPublishDialog.d.ts +30 -0
  465. package/dist/session/ProjectPublishDialog.js +420 -0
  466. package/dist/session/ProjectSessionAccessSection.d.ts +13 -0
  467. package/dist/session/ProjectSessionAccessSection.js +109 -0
  468. package/dist/session/ProjectSessionsList.d.ts +53 -0
  469. package/dist/session/ProjectSessionsList.js +316 -0
  470. package/dist/session/ProjectSettingsDialog.d.ts +30 -0
  471. package/dist/session/ProjectSettingsDialog.js +693 -0
  472. package/dist/session/ProjectShareDialog.d.ts +36 -0
  473. package/dist/session/ProjectShareDialog.js +190 -0
  474. package/dist/session/ProjectSkillsSection.d.ts +7 -0
  475. package/dist/session/ProjectSkillsSection.js +197 -0
  476. package/dist/session/ProjectToolsSection.d.ts +16 -0
  477. package/dist/session/ProjectToolsSection.js +347 -0
  478. package/dist/session/ProjectUsage.d.ts +61 -0
  479. package/dist/session/ProjectUsage.js +344 -0
  480. package/dist/session/ProviderUsageProvider.d.ts +2 -3
  481. package/dist/session/QueueTab.js +11 -1
  482. package/dist/session/RemindersPanel.js +10 -12
  483. package/dist/session/SecretsPanel.js +2 -1
  484. package/dist/session/SessionAccessNotice.d.ts +31 -0
  485. package/dist/session/SessionAccessNotice.js +69 -0
  486. package/dist/session/SessionDetailsDialog.d.ts +3 -1
  487. package/dist/session/SessionDetailsDialog.js +16 -1
  488. package/dist/session/SessionHeader.d.ts +10 -3
  489. package/dist/session/SessionHeader.js +19 -7
  490. package/dist/session/SessionPeopleStack.d.ts +24 -0
  491. package/dist/session/SessionPeopleStack.js +99 -0
  492. package/dist/session/SessionPlaceMenu.js +7 -6
  493. package/dist/session/SessionProvider.d.ts +13 -1
  494. package/dist/session/SessionProvider.js +21 -1
  495. package/dist/session/ShareSessionDialog.d.ts +32 -0
  496. package/dist/session/ShareSessionDialog.js +241 -0
  497. package/dist/session/TypingLine.d.ts +27 -0
  498. package/dist/session/TypingLine.js +42 -0
  499. package/dist/session/{UsagePanel.d.ts → UsageSection.d.ts} +9 -13
  500. package/dist/session/{UsagePanel.js → UsageSection.js} +40 -41
  501. package/dist/session/artifact-row-parts.d.ts +32 -0
  502. package/dist/session/artifact-row-parts.js +51 -0
  503. package/dist/session/headless/access.d.ts +33 -0
  504. package/dist/session/headless/access.js +48 -0
  505. package/dist/session/headless/fixture-host.d.ts +48 -9
  506. package/dist/session/headless/fixture-host.js +139 -1
  507. package/dist/session/headless/fixture-project-artifacts.d.ts +77 -0
  508. package/dist/session/headless/fixture-project-artifacts.js +168 -0
  509. package/dist/session/headless/fixture-project-content.d.ts +67 -0
  510. package/dist/session/headless/fixture-project-content.js +176 -0
  511. package/dist/session/headless/fixture-projects.d.ts +175 -0
  512. package/dist/session/headless/fixture-projects.js +498 -0
  513. package/dist/session/headless/home-layout.d.ts +18 -2
  514. package/dist/session/headless/home-layout.js +20 -7
  515. package/dist/session/headless/host.d.ts +302 -7
  516. package/dist/session/headless/index.d.ts +11 -4
  517. package/dist/session/headless/index.js +9 -2
  518. package/dist/session/headless/labels.d.ts +428 -4
  519. package/dist/session/headless/labels.js +109 -5
  520. package/dist/session/headless/orchestration-labels.d.ts +52 -0
  521. package/dist/session/headless/orchestration-labels.js +59 -0
  522. package/dist/session/headless/people.d.ts +29 -0
  523. package/dist/session/headless/people.js +53 -0
  524. package/dist/session/headless/place.d.ts +5 -0
  525. package/dist/session/headless/place.js +5 -1
  526. package/dist/session/headless/project-artifact-labels.d.ts +67 -0
  527. package/dist/session/headless/project-artifact-labels.js +96 -0
  528. package/dist/session/headless/project-artifacts.d.ts +124 -0
  529. package/dist/session/headless/project-artifacts.js +271 -0
  530. package/dist/session/headless/project-content-labels.d.ts +88 -0
  531. package/dist/session/headless/project-content-labels.js +152 -0
  532. package/dist/session/headless/project-labels.d.ts +123 -0
  533. package/dist/session/headless/project-labels.js +128 -0
  534. package/dist/session/headless/project-sessions.d.ts +37 -0
  535. package/dist/session/headless/project-sessions.js +57 -0
  536. package/dist/session/headless/project-usage-labels.d.ts +74 -0
  537. package/dist/session/headless/project-usage-labels.js +81 -0
  538. package/dist/session/headless/project-usage.d.ts +65 -0
  539. package/dist/session/headless/project-usage.js +92 -0
  540. package/dist/session/headless/projects.d.ts +158 -0
  541. package/dist/session/headless/projects.js +301 -0
  542. package/dist/session/headless/pushed-once.d.ts +22 -0
  543. package/dist/session/headless/pushed-once.js +28 -0
  544. package/dist/session/headless/queue.js +2 -1
  545. package/dist/session/headless/typing.d.ts +56 -0
  546. package/dist/session/headless/typing.js +115 -0
  547. package/dist/session/home-block-parts.d.ts +40 -0
  548. package/dist/session/home-block-parts.js +46 -0
  549. package/dist/session/index.d.ts +21 -4
  550. package/dist/session/index.js +20 -3
  551. package/dist/session/modal-shell.d.ts +1 -1
  552. package/dist/session/modal-shell.js +1 -1
  553. package/dist/session/project-artifact-parts.d.ts +59 -0
  554. package/dist/session/project-artifact-parts.js +222 -0
  555. package/dist/session/project-content-parts.d.ts +176 -0
  556. package/dist/session/project-content-parts.js +546 -0
  557. package/dist/session/project-files.d.ts +48 -0
  558. package/dist/session/project-files.js +54 -0
  559. package/dist/session/project-folder-actions.d.ts +11 -0
  560. package/dist/session/project-folder-actions.js +39 -0
  561. package/dist/session/project-mcp-add.d.ts +23 -0
  562. package/dist/session/project-mcp-add.js +107 -0
  563. package/dist/session/project-record-document.d.ts +48 -0
  564. package/dist/session/project-record-document.js +225 -0
  565. package/dist/session/project-settings-parts.d.ts +69 -0
  566. package/dist/session/project-settings-parts.js +90 -0
  567. package/dist/session/share-people.d.ts +222 -0
  568. package/dist/session/share-people.js +457 -0
  569. package/dist/session/testing/contract.d.ts +67 -8
  570. package/dist/session/testing/contract.js +343 -6
  571. package/dist/session/testing/index.d.ts +5 -2
  572. package/dist/session/testing/index.js +4 -1
  573. package/dist/session/testing/project-artifacts.contract.js +159 -0
  574. package/dist/session/testing/project-content.contract.d.ts +19 -0
  575. package/dist/session/testing/project-content.contract.js +221 -0
  576. package/dist/session/testing/project-sessions.contract.js +134 -0
  577. package/dist/session/use-folder-missing.d.ts +6 -0
  578. package/dist/session/use-folder-missing.js +31 -0
  579. package/dist/session/use-folder-project.d.ts +14 -0
  580. package/dist/session/use-folder-project.js +37 -0
  581. package/dist/session/use-home-projects.d.ts +48 -0
  582. package/dist/session/use-home-projects.js +118 -0
  583. package/dist/session/use-project-home-layout.d.ts +33 -0
  584. package/dist/session/use-project-home-layout.js +134 -0
  585. package/dist/session/use-project-home-on.d.ts +2 -0
  586. package/dist/session/use-project-home-on.js +14 -0
  587. package/dist/settings/SettingCard.d.ts +3 -1
  588. package/dist/settings/SettingCard.js +2 -1
  589. package/dist/settings/SettingDemo.d.ts +3 -1
  590. package/dist/settings/SettingDemo.js +4 -3
  591. package/dist/settings/SettingsShell.d.ts +2 -1
  592. package/dist/settings/SettingsShell.js +55 -43
  593. package/dist/settings/headless/index.d.ts +2 -1
  594. package/dist/settings/headless/index.js +2 -1
  595. package/dist/settings/headless/mcp-requirement.d.ts +93 -0
  596. package/dist/settings/headless/mcp-requirement.js +116 -0
  597. package/dist/settings/headless/search.d.ts +1 -1
  598. package/dist/settings/headless/sections-host.d.ts +7 -2
  599. package/dist/settings/index.d.ts +3 -2
  600. package/dist/settings/index.js +5 -4
  601. package/dist/settings/section.d.ts +24 -3
  602. package/dist/settings/section.js +27 -4
  603. package/dist/settings/sections/editor/labels.js +1 -1
  604. package/dist/settings/sections/environments/EnvironmentsSection.js +30 -6
  605. package/dist/settings/sections/extensions/ExtensionConfigRows.d.ts +6 -2
  606. package/dist/settings/sections/extensions/ExtensionConfigRows.js +10 -1
  607. package/dist/settings/sections/extensions/ExtensionOptionsSection.js +1 -0
  608. package/dist/settings/sections/extensions/ExtensionsSection.d.ts +6 -3
  609. package/dist/settings/sections/extensions/ExtensionsSection.js +24 -3
  610. package/dist/settings/sections/extensions/McpRequirementRow.d.ts +45 -0
  611. package/dist/settings/sections/extensions/McpRequirementRow.js +298 -0
  612. package/dist/settings/sections/extensions/labels.d.ts +4 -0
  613. package/dist/settings/sections/extensions/labels.js +4 -0
  614. package/dist/settings/sections/extensions/options-labels.d.ts +39 -0
  615. package/dist/settings/sections/extensions/options-labels.js +48 -1
  616. package/dist/settings/sections/extensions/use-mcp-setup.d.ts +6 -0
  617. package/dist/settings/sections/extensions/use-mcp-setup.js +41 -0
  618. package/dist/settings/sections/host-catalog/HostCatalogSection.js +3 -0
  619. package/dist/settings/sections/index.d.ts +4 -3
  620. package/dist/settings/sections/index.js +4 -3
  621. package/dist/settings/sections/instructions/InstructionsSection.d.ts +69 -1
  622. package/dist/settings/sections/instructions/InstructionsSection.js +181 -109
  623. package/dist/settings/sections/keybindings/labels.d.ts +3 -0
  624. package/dist/settings/sections/keybindings/labels.js +3 -0
  625. package/dist/settings/sections/keybindings/rows.js +12 -0
  626. package/dist/settings/sections/logs/LogsSection.js +5 -8
  627. package/dist/settings/sections/mcp/McpAddForm.d.ts +9 -2
  628. package/dist/settings/sections/mcp/McpAddForm.js +15 -7
  629. package/dist/settings/sections/mcp/McpServerRow.js +7 -47
  630. package/dist/settings/sections/mcp/McpSignIn.d.ts +38 -0
  631. package/dist/settings/sections/mcp/McpSignIn.js +72 -0
  632. package/dist/settings/sections/mcp/labels.js +1 -1
  633. package/dist/settings/sections/models/AgentDefaults.d.ts +12 -4
  634. package/dist/settings/sections/models/AgentDefaults.js +102 -70
  635. package/dist/settings/sections/models/ModelPickField.d.ts +10 -1
  636. package/dist/settings/sections/models/ModelPickField.js +87 -39
  637. package/dist/settings/sections/models/labels.d.ts +8 -0
  638. package/dist/settings/sections/models/labels.js +8 -0
  639. package/dist/settings/sections/performance/labels.js +2 -2
  640. package/dist/settings/sections/providers/ServerSignIn.d.ts +6 -1
  641. package/dist/settings/sections/providers/ServerSignIn.js +66 -61
  642. package/dist/settings/sections/skills/SkillList.d.ts +45 -0
  643. package/dist/settings/sections/skills/SkillList.js +58 -40
  644. package/dist/settings/server-app.d.ts +2 -0
  645. package/dist/settings/server-app.js +16 -4
  646. package/dist/styles.css +154 -36
  647. package/dist/terminal/HostTerminalSurface.js +28 -30
  648. package/dist/terminal/TerminalPanel.js +4 -12
  649. package/dist/terminal/TerminalProvider.d.ts +10 -2
  650. package/dist/terminal/TerminalProvider.js +10 -2
  651. package/dist/terminal/headless/labels.d.ts +0 -1
  652. package/dist/terminal/headless/labels.js +1 -2
  653. package/dist/terminal/headless/store.js +5 -1
  654. package/dist/theme/runtime-icons.js +7 -3
  655. package/dist/workspace/LayoutBudget.js +1 -7
  656. package/dist/workspace/PanelContentView.js +1 -1
  657. package/package.json +26 -2
  658. package/src/styles/app.css +6 -3
  659. package/src/styles/chat.css +3 -1
  660. package/src/styles/palette.css +15 -19
  661. package/src/styles/primitives.css +3 -1
  662. package/src/styles/transcript.css +39 -3
  663. package/dist/dist/index-De9AbmxS.d.ts +0 -1
  664. package/dist/dist/sandbox-CSUihARm.d.ts +0 -2
  665. /package/dist/dist/{execution-failure-SREfl-EZ.d.ts → execution-failure-_L2r_Qd-.d.ts} +0 -0
@@ -142,6 +142,57 @@ export declare const DEFAULT_GIT_LABELS: {
142
142
  gitMoveDone: string;
143
143
  gitMoveListFailed: string;
144
144
  gitMoveFailed: string;
145
+ gitTeleportTitle: string;
146
+ gitTeleportWhere: string;
147
+ gitTeleportLoading: string;
148
+ gitTeleportNone: string;
149
+ gitTeleportMarkFixable: string;
150
+ gitTeleportMarkChanges: string;
151
+ gitTeleportMarkBlocked: string;
152
+ gitTeleportConfirm: (name: string) => string;
153
+ gitTeleportCarryWork: (count: number) => string;
154
+ gitTeleportNoWork: string;
155
+ gitTeleportNotRepo: string;
156
+ gitTeleportPreviewLoading: string;
157
+ gitTeleportPreviewFailed: string;
158
+ gitTeleportCheckout: (name: string) => string;
159
+ gitTeleportCheckoutPlaceholder: string;
160
+ gitTeleportFolder: (name: string) => string;
161
+ gitTeleportFolderPlaceholder: string;
162
+ gitTeleportBrowse: string;
163
+ gitTeleportIgnored: string;
164
+ gitTeleportSecret: string;
165
+ /** Ticked ignored files that look like secrets: where they go. */
166
+ gitTeleportSecretsTicked: (count: number, host: string) => string;
167
+ gitTeleportLfs: string;
168
+ gitTeleportSubmodules: (count: number) => string;
169
+ gitTeleportDetail: string;
170
+ gitTeleportSubmit: string;
171
+ gitTeleporting: string;
172
+ /** Where a teleport is, under the dialog's content while it runs. */
173
+ gitTeleportStage: (stage: "export" | "transfer" | "prepare" | "commit" | "complete", done?: number, total?: number) => string;
174
+ gitTeleportStop: string;
175
+ gitTeleportStopping: string;
176
+ gitTeleportStopped: string;
177
+ gitTeleportFailed: string;
178
+ gitTeleportRetry: string;
179
+ /** The target stopped answering during the switch: the session may be on it already. */
180
+ gitTeleportUnknown: string;
181
+ /** The session moved, but its old host could not be told yet (the host's words under Details). */
182
+ gitTeleportSourceNotTold: string;
183
+ gitTeleportListFailed: string;
184
+ /** The host picked in Move to… can't take the session: why, from its comparison. */
185
+ gitTeleportCannot: (name: string) => string;
186
+ /** The host picked in Move to… went offline before the teleport. */
187
+ gitTeleportGone: (name: string) => string;
188
+ /** In the teleport step of Move to…, when an isolation was picked on the target too. */
189
+ gitTeleportThen: (isolation: string) => string;
190
+ gitMoveContinue: string;
191
+ gitMoveHere: string;
192
+ gitMoveUnavailable: string;
193
+ /** After a teleport, before its isolation is set up on the new host. */
194
+ gitMoveThen: (host: string, isolation: string) => string;
195
+ gitMoveKeepThere: string;
145
196
  gitWhereLabel: string;
146
197
  gitWhereTitle: (place: string, isolation: string | undefined, branch: string | undefined) => string;
147
198
  gitRunsOn: string;
@@ -216,7 +267,7 @@ export declare const DEFAULT_GIT_LABELS: {
216
267
  sandboxReplaced: string;
217
268
  sandboxReplacedHint: (title: string) => string;
218
269
  sandboxOpenSession: (title: string) => string;
219
- sandboxStates: Record<"running" | "paused" | "other", string>;
270
+ sandboxStates: Record<"running" | "paused" | "failed" | "other", string>;
220
271
  sandboxCpu: (count: number) => string;
221
272
  sandboxMemory: (mib: number) => string;
222
273
  sandboxCopyId: string;
@@ -138,6 +138,63 @@ const DEFAULT_GIT_LABELS = {
138
138
  gitMoveDone: "Done",
139
139
  gitMoveListFailed: "Couldn't list where it can run.",
140
140
  gitMoveFailed: "Couldn't move the session.",
141
+ gitTeleportTitle: "Teleport this session",
142
+ gitTeleportWhere: "Pick a host.",
143
+ gitTeleportLoading: "Comparing the hosts…",
144
+ gitTeleportNone: "Connect another host to move it there.",
145
+ gitTeleportMarkFixable: "to set up",
146
+ gitTeleportMarkChanges: "changes",
147
+ gitTeleportMarkBlocked: "can't run it",
148
+ gitTeleportConfirm: (name) => `Teleport to ${name}?`,
149
+ gitTeleportCarryWork: (count) => `Bring the work in progress (${count} ${count === 1 ? "file" : "files"})`,
150
+ gitTeleportNoWork: "No uncommitted work to bring.",
151
+ gitTeleportNotRepo: "Not a git folder. Only the conversation moves.",
152
+ gitTeleportPreviewLoading: "Reading the work in progress…",
153
+ gitTeleportPreviewFailed: "Couldn't read the work in progress.",
154
+ gitTeleportCheckout: (name) => `Checkout on ${name}`,
155
+ gitTeleportCheckoutPlaceholder: "/path/to/the/project",
156
+ gitTeleportFolder: (name) => `Folder on ${name}`,
157
+ gitTeleportFolderPlaceholder: "/path/on/that/host",
158
+ gitTeleportBrowse: "Browse…",
159
+ gitTeleportIgnored: "Ignored files stay here unless ticked.",
160
+ gitTeleportSecret: "likely secret",
161
+ /** Ticked ignored files that look like secrets: where they go. */
162
+ gitTeleportSecretsTicked: (count, host) => `${count === 1 ? "A likely secret goes" : `${count} likely secrets go`} to ${host}.`,
163
+ gitTeleportLfs: "Git LFS files move only if that host can fetch them.",
164
+ gitTeleportSubmodules: (count) => `${count === 1 ? "A submodule stays" : `${count} submodules stay`} here.`,
165
+ gitTeleportDetail: "Your folder here stays as it is.",
166
+ gitTeleportSubmit: "Teleport",
167
+ gitTeleporting: "Teleporting…",
168
+ /** Where a teleport is, under the dialog's content while it runs. */
169
+ gitTeleportStage: (stage, done, total) => ({
170
+ export: "Packing the session…",
171
+ transfer: total !== void 0 && total > 1 ? `Sending ${Math.min(done ?? 0, total)} of ${total}…` : "Sending it…",
172
+ prepare: "Preparing it there…",
173
+ commit: "Starting it there…",
174
+ complete: "Finishing…"
175
+ })[stage],
176
+ gitTeleportStop: "Stop",
177
+ gitTeleportStopping: "Stopping…",
178
+ gitTeleportStopped: "Stopped. Nothing changed.",
179
+ gitTeleportFailed: "Couldn't move the session. Nothing changed.",
180
+ gitTeleportRetry: "Retry",
181
+ /** The target stopped answering during the switch: the session may be on it already. */
182
+ gitTeleportUnknown: "The other host stopped answering. Look for the session there before you retry.",
183
+ /** The session moved, but its old host could not be told yet (the host's words under Details). */
184
+ gitTeleportSourceNotTold: "It moved. The old host keeps a copy for now.",
185
+ gitTeleportListFailed: "Couldn't compare the hosts.",
186
+ /** The host picked in Move to… can't take the session: why, from its comparison. */
187
+ gitTeleportCannot: (name) => `${name} can't run this session.`,
188
+ /** The host picked in Move to… went offline before the teleport. */
189
+ gitTeleportGone: (name) => `${name} isn't connected.`,
190
+ /** In the teleport step of Move to…, when an isolation was picked on the target too. */
191
+ gitTeleportThen: (isolation) => `Then it sets up ${isolation} there.`,
192
+ gitMoveContinue: "Continue",
193
+ gitMoveHere: "It runs here now. Pick another place.",
194
+ gitMoveUnavailable: "It cannot run there now.",
195
+ /** After a teleport, before its isolation is set up on the new host. */
196
+ gitMoveThen: (host, isolation) => `It's on ${host} now. Set up ${isolation} there next.`,
197
+ gitMoveKeepThere: "Keep it in its folder",
141
198
  gitWhereLabel: "Choose where the session runs",
142
199
  gitWhereTitle: (place, isolation, branch) => `Runs on ${place}${isolation ? `, ${isolation.toLowerCase()}` : ""}${branch ? ` (${branch})` : ""}`,
143
200
  gitRunsOn: "Runs on",
@@ -215,6 +272,7 @@ const DEFAULT_GIT_LABELS = {
215
272
  sandboxStates: {
216
273
  running: "Running",
217
274
  paused: "Paused",
275
+ failed: "Failed",
218
276
  other: "Unknown"
219
277
  },
220
278
  sandboxCpu: (count) => `${count} CPU`,
@@ -29,7 +29,7 @@ export declare function sandboxMatches(sandbox: EnvironmentSandboxSummary, filte
29
29
  */
30
30
  export declare function sandboxCounts(sandboxes: readonly EnvironmentSandboxSummary[]): Record<SandboxFilter, number>;
31
31
  /**
32
- * Running first (they cost), then paused, then the rest; a session's before a stray one; newest first.
32
+ * Running first (they cost), then failed (they need a look), then paused, then the rest; a session's before a stray one; newest first.
33
33
  *
34
34
  * @param sandboxes - The sandboxes.
35
35
  */
@@ -24,11 +24,12 @@ function sandboxCounts(sandboxes) {
24
24
  }
25
25
  const STATE_ORDER = {
26
26
  running: 0,
27
- paused: 1,
28
- other: 2
27
+ failed: 1,
28
+ paused: 2,
29
+ other: 3
29
30
  };
30
31
  /**
31
- * Running first (they cost), then paused, then the rest; a session's before a stray one; newest first.
32
+ * Running first (they cost), then failed (they need a look), then paused, then the rest; a session's before a stray one; newest first.
32
33
  *
33
34
  * @param sandboxes - The sandboxes.
34
35
  */
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Teleport in the kit (docs/TELEPORT.md): what the dialog reads from a
3
+ * `GitHost` and the pure rules it renders by. The comparison itself comes
4
+ * from the host (`checkTeleportTarget` in `zidane/ipc`).
5
+ */
6
+ import { movingCount, shownRows, workTarget } from "zidane/chat/pure";
7
+ import { CompareRow, Readiness } from "zidane/ipc";
8
+ /** A host a session could go to, compared with it. `error`: it could not be asked. */
9
+ export interface TeleportTargetView {
10
+ /** The host's id. */
11
+ hostId: string;
12
+ /** The host's name, as people see it. */
13
+ name: string;
14
+ /** A server (absent or `false`: This computer). */
15
+ remote?: boolean;
16
+ /** The differences with the session, worst first. */
17
+ rows: readonly CompareRow[];
18
+ /** The worst of them, as the picker shows it. */
19
+ readiness: Readiness;
20
+ /** Why it could not be asked. */
21
+ error?: string;
22
+ }
23
+ /** What a teleport asks for. */
24
+ export interface TeleportRequestView {
25
+ /** The target's id. */
26
+ hostId: string;
27
+ /** Carry the git work into a new worktree of `repo` at `path` on `branch` (on the target). */
28
+ work?: {
29
+ repo: string;
30
+ path: string;
31
+ branch: string;
32
+ };
33
+ /** Ignored files the person ticked. */
34
+ carryIgnored?: string[];
35
+ /** The session's folder on the target when no work is carried. */
36
+ cwd?: string;
37
+ }
38
+ /** Where a teleport is: its stage, and while it sends the session the chunks sent of all. */
39
+ export interface TeleportProgressView {
40
+ /** The step it is at. */
41
+ stage: 'export' | 'transfer' | 'prepare' | 'commit' | 'complete';
42
+ /** The chunks sent so far, during `transfer`. */
43
+ done?: number;
44
+ /** All the chunks to send, during `transfer`. */
45
+ total?: number;
46
+ }
47
+ /** A teleport's progress, and a stop before its commit (nothing changes then). */
48
+ export interface TeleportCallView {
49
+ /** Gets each step, and the chunks sent during `transfer`. */
50
+ onProgress?: (progress: TeleportProgressView) => void;
51
+ /** Stops the teleport before its commit. */
52
+ signal?: AbortSignal;
53
+ }
54
+ /**
55
+ * Until the commit, a teleport can stop with nothing changed.
56
+ *
57
+ * @param progress - Where the teleport is; `null` before it starts.
58
+ */
59
+ export declare function teleportStoppable(progress: TeleportProgressView | null): boolean;
60
+ /** What a teleport answered: the session's id on the target, and a notice to show when the source could not be told. */
61
+ export type TeleportOutcome = {
62
+ ok: true;
63
+ sessionId: string;
64
+ notice?: string;
65
+ } | {
66
+ ok: false;
67
+ message: string;
68
+ unknown?: true;
69
+ };
70
+ /**
71
+ * A target can be picked unless something blocks it or it could not be asked.
72
+ *
73
+ * @param target - The target, compared with the session.
74
+ */
75
+ export declare function canTeleportTo(target: TeleportTargetView): boolean;
76
+ export { movingCount, shownRows, workTarget };
@@ -0,0 +1,19 @@
1
+ import { movingCount, shownRows, workTarget } from "zidane/chat/pure";
2
+ // src/git/headless/teleport.ts
3
+ /**
4
+ * Until the commit, a teleport can stop with nothing changed.
5
+ *
6
+ * @param progress - Where the teleport is; `null` before it starts.
7
+ */
8
+ function teleportStoppable(progress) {
9
+ return progress === null || progress.stage === "export" || progress.stage === "transfer" || progress.stage === "prepare";
10
+ }
11
+ /**
12
+ * A target can be picked unless something blocks it or it could not be asked.
13
+ *
14
+ * @param target - The target, compared with the session.
15
+ */
16
+ function canTeleportTo(target) {
17
+ return target.error === void 0 && target.readiness !== "blocked";
18
+ }
19
+ export { canTeleportTo, movingCount, shownRows, teleportStoppable, workTarget };
@@ -2,12 +2,14 @@ import { BranchMenu, BranchMenuProps, BranchMenuWorktree } from "./BranchMenu.js
2
2
  import { GitBar, GitBarBranchMenuProps, GitBarProps } from "./GitBar.js";
3
3
  import { GitProvider, GitProviderProps, useGitHost, useGitLabels } from "./GitProvider.js";
4
4
  import { ImportRepoDialog, ImportRepoDialogProps, ImportRepoTarget, useImportRepo } from "./ImportRepoDialog.js";
5
- import { MoveSessionDialog, MoveSessionDialogProps, useMoveSession } from "./MoveSessionDialog.js";
5
+ import { MOVE_SESSION_TITLE_ID, MoveSessionDialog, MoveSessionDialogProps } from "./MoveSessionDialog.js";
6
+ import { MoveSessionOptions, MoveToDialog, MoveToDialogProps, useMoveSession } from "./MoveToDialog.js";
6
7
  import { RemoteFolderBrowser, RemoteFolderBrowserProps, RemoteFolderPicker, RemoteFolderPickerProps } from "./RemoteFolderPicker.js";
7
8
  import { SandboxManager, SandboxManagerKind, SandboxManagerProps } from "./SandboxManager.js";
8
9
  import { GIT_BAR_ITEM, SyncChip, SyncChipProps } from "./SyncChip.js";
9
- import { useEnvironmentChoices } from "./useEnvironmentChoices.js";
10
+ import { TeleportDone, TeleportSessionDialog, TeleportSessionDialogProps, TeleportSubject, useTeleportSession } from "./TeleportSessionDialog.js";
11
+ import { EnvironmentChoicesState, useEnvironmentChoices, useEnvironmentChoicesState } from "./useEnvironmentChoices.js";
10
12
  import { GitBarState, useGitBar } from "./useGitBar.js";
11
13
  import { StartFromPanelDraft, StartFromPanelResult, useStartFromPanel } from "./useStartFromPanel.js";
12
14
  import { WhereMenu, WhereMenuProps, WherePicker, WherePickerProps } from "./WherePicker.js";
13
- export { BranchMenu, BranchMenuProps, BranchMenuWorktree, GIT_BAR_ITEM, GitBar, GitBarBranchMenuProps, GitBarProps, GitBarState, GitProvider, GitProviderProps, ImportRepoDialog, ImportRepoDialogProps, ImportRepoTarget, MoveSessionDialog, MoveSessionDialogProps, RemoteFolderBrowser, RemoteFolderBrowserProps, RemoteFolderPicker, RemoteFolderPickerProps, SandboxManager, SandboxManagerKind, SandboxManagerProps, StartFromPanelDraft, StartFromPanelResult, SyncChip, SyncChipProps, WhereMenu, WhereMenuProps, WherePicker, WherePickerProps, useEnvironmentChoices, useGitBar, useGitHost, useGitLabels, useImportRepo, useMoveSession, useStartFromPanel };
15
+ export { BranchMenu, BranchMenuProps, BranchMenuWorktree, EnvironmentChoicesState, GIT_BAR_ITEM, GitBar, GitBarBranchMenuProps, GitBarProps, GitBarState, GitProvider, GitProviderProps, ImportRepoDialog, ImportRepoDialogProps, ImportRepoTarget, MOVE_SESSION_TITLE_ID, MoveSessionDialog, MoveSessionDialogProps, MoveSessionOptions, MoveToDialog, MoveToDialogProps, RemoteFolderBrowser, RemoteFolderBrowserProps, RemoteFolderPicker, RemoteFolderPickerProps, SandboxManager, SandboxManagerKind, SandboxManagerProps, StartFromPanelDraft, StartFromPanelResult, SyncChip, SyncChipProps, TeleportDone, TeleportSessionDialog, TeleportSessionDialogProps, TeleportSubject, WhereMenu, WhereMenuProps, WherePicker, WherePickerProps, useEnvironmentChoices, useEnvironmentChoicesState, useGitBar, useGitHost, useGitLabels, useImportRepo, useMoveSession, useStartFromPanel, useTeleportSession };
package/dist/git/index.js CHANGED
@@ -2,12 +2,14 @@ import { BranchMenu } from "./BranchMenu.js";
2
2
  import { GitBar } from "./GitBar.js";
3
3
  import { GitProvider, useGitHost, useGitLabels } from "./GitProvider.js";
4
4
  import { ImportRepoDialog, useImportRepo } from "./ImportRepoDialog.js";
5
- import { MoveSessionDialog, useMoveSession } from "./MoveSessionDialog.js";
5
+ import { MOVE_SESSION_TITLE_ID, MoveSessionDialog } from "./MoveSessionDialog.js";
6
+ import { MoveToDialog, useMoveSession } from "./MoveToDialog.js";
6
7
  import { RemoteFolderBrowser, RemoteFolderPicker } from "./RemoteFolderPicker.js";
7
8
  import { SandboxManager } from "./SandboxManager.js";
8
9
  import { GIT_BAR_ITEM, SyncChip } from "./SyncChip.js";
9
- import { useEnvironmentChoices } from "./useEnvironmentChoices.js";
10
+ import { TeleportSessionDialog, useTeleportSession } from "./TeleportSessionDialog.js";
11
+ import { useEnvironmentChoices, useEnvironmentChoicesState } from "./useEnvironmentChoices.js";
10
12
  import { useGitBar } from "./useGitBar.js";
11
13
  import { useStartFromPanel } from "./useStartFromPanel.js";
12
14
  import { WhereMenu, WherePicker } from "./WherePicker.js";
13
- export { BranchMenu, GIT_BAR_ITEM, GitBar, GitProvider, ImportRepoDialog, MoveSessionDialog, RemoteFolderBrowser, RemoteFolderPicker, SandboxManager, SyncChip, WhereMenu, WherePicker, useEnvironmentChoices, useGitBar, useGitHost, useGitLabels, useImportRepo, useMoveSession, useStartFromPanel };
15
+ export { BranchMenu, GIT_BAR_ITEM, GitBar, GitProvider, ImportRepoDialog, MOVE_SESSION_TITLE_ID, MoveSessionDialog, MoveToDialog, RemoteFolderBrowser, RemoteFolderPicker, SandboxManager, SyncChip, TeleportSessionDialog, WhereMenu, WherePicker, useEnvironmentChoices, useEnvironmentChoicesState, useGitBar, useGitHost, useGitLabels, useImportRepo, useMoveSession, useStartFromPanel, useTeleportSession };
@@ -7,12 +7,34 @@
7
7
  */
8
8
  import { WithMachinesOptions } from "./headless/environment.js";
9
9
  import { EnvironmentDescriptor } from "zidane/chat";
10
+ /** The environment kinds a draft can pick, and how their read went: for a surface that says when the list failed. */
11
+ export interface EnvironmentChoicesState {
12
+ /** The kinds, `withMachines` applied. Empty while loading or after a failed first read. */
13
+ descriptors: readonly EnvironmentDescriptor[];
14
+ /** The last read failed (a failed re-read keeps the last list and sets this too). */
15
+ error: unknown;
16
+ /** Reads the list again. */
17
+ retry: () => void;
18
+ }
19
+ /**
20
+ * The environment kinds a draft in `cwd` can pick, with the outcome of the read (see {@link useEnvironmentChoices}).
21
+ *
22
+ * @param cwd - The draft's folder (`''`: none); `null` reads nothing (no draft on screen).
23
+ * @param hostId - The saved server the draft runs on (absent: this host).
24
+ * @param options - As {@link useEnvironmentChoices}.
25
+ */
26
+ export declare function useEnvironmentChoicesState(cwd: string | null, hostId?: string, options?: WithMachinesOptions & {
27
+ machineOnly?: boolean;
28
+ }): EnvironmentChoicesState;
10
29
  /**
11
30
  * The environment kinds a draft in `cwd` can pick, `withMachines` applied. Empty while loading, when the list
12
31
  * fails or without `GitHost.environments`: the draft runs on its default. A failed re-read keeps the last list.
13
32
  *
14
33
  * @param cwd - The draft's folder (`''`: none); `null` reads nothing (no draft on screen).
15
34
  * @param hostId - The saved server the draft runs on (absent: this host).
16
- * @param options - Whether an offline machine's kinds stay usable (a new chat waits for it).
35
+ * @param options - Whether an offline machine's kinds stay usable (a new chat waits for it), and whether to list
36
+ * what the host can run whatever the folder (`machineOnly`: a default for many folders).
17
37
  */
18
- export declare function useEnvironmentChoices(cwd: string | null, hostId?: string, options?: WithMachinesOptions): readonly EnvironmentDescriptor[];
38
+ export declare function useEnvironmentChoices(cwd: string | null, hostId?: string, options?: WithMachinesOptions & {
39
+ machineOnly?: boolean;
40
+ }): readonly EnvironmentDescriptor[];
@@ -4,35 +4,49 @@ import { useEffect, useState } from "react";
4
4
  // src/git/useEnvironmentChoices.ts
5
5
  const NO_DESCRIPTORS = [];
6
6
  /**
7
- * The environment kinds a draft in `cwd` can pick, `withMachines` applied. Empty while loading, when the list
8
- * fails or without `GitHost.environments`: the draft runs on its default. A failed re-read keeps the last list.
7
+ * The environment kinds a draft in `cwd` can pick, with the outcome of the read (see {@link useEnvironmentChoices}).
9
8
  *
10
9
  * @param cwd - The draft's folder (`''`: none); `null` reads nothing (no draft on screen).
11
10
  * @param hostId - The saved server the draft runs on (absent: this host).
12
- * @param options - Whether an offline machine's kinds stay usable (a new chat waits for it).
11
+ * @param options - As {@link useEnvironmentChoices}.
13
12
  */
14
- function useEnvironmentChoices(cwd, hostId, options = {}) {
13
+ function useEnvironmentChoicesState(cwd, hostId, options = {}) {
15
14
  const offlineWaits = options.offlineWaits === true;
15
+ const machineOnly = options.machineOnly === true;
16
16
  const host = useGitHost();
17
17
  const [listed, setListed] = useState(null);
18
- const key = cwd === null ? null : JSON.stringify([cwd, hostId ?? null]);
18
+ const [failed, setFailed] = useState(null);
19
+ const [attempt, setAttempt] = useState(0);
20
+ const key = cwd === null ? null : JSON.stringify([
21
+ cwd,
22
+ hostId ?? null,
23
+ machineOnly
24
+ ]);
19
25
  useEffect(() => {
20
26
  const list = host?.environments;
21
27
  if (key === null || cwd === null || !list) return void 0;
22
28
  const query = {
23
29
  cwd,
24
- ...hostId ? { hostId } : {}
30
+ ...hostId ? { hostId } : {},
31
+ ...machineOnly ? { machineOnly: true } : {}
25
32
  };
26
33
  let read = 0;
27
34
  let live = true;
28
35
  const load = () => {
29
36
  const mine = ++read;
30
37
  list(query).then((descriptors) => {
31
- if (live && mine === read) setListed({
38
+ if (!live || mine !== read) return;
39
+ setListed({
32
40
  key,
33
41
  descriptors: withMachines(descriptors, { offlineWaits })
34
42
  });
35
- }, () => {});
43
+ setFailed(null);
44
+ }, (error) => {
45
+ if (live && mine === read) setFailed({
46
+ key,
47
+ error
48
+ });
49
+ });
36
50
  };
37
51
  load();
38
52
  const off = host.subscribeEnvironments?.(query, load);
@@ -45,8 +59,26 @@ function useEnvironmentChoices(cwd, hostId, options = {}) {
45
59
  key,
46
60
  cwd,
47
61
  hostId,
48
- offlineWaits
62
+ offlineWaits,
63
+ machineOnly,
64
+ attempt
49
65
  ]);
50
- return listed && listed.key === key ? listed.descriptors : NO_DESCRIPTORS;
66
+ return {
67
+ descriptors: listed && listed.key === key ? listed.descriptors : NO_DESCRIPTORS,
68
+ error: failed && failed.key === key ? failed.error : void 0,
69
+ retry: () => setAttempt((n) => n + 1)
70
+ };
71
+ }
72
+ /**
73
+ * The environment kinds a draft in `cwd` can pick, `withMachines` applied. Empty while loading, when the list
74
+ * fails or without `GitHost.environments`: the draft runs on its default. A failed re-read keeps the last list.
75
+ *
76
+ * @param cwd - The draft's folder (`''`: none); `null` reads nothing (no draft on screen).
77
+ * @param hostId - The saved server the draft runs on (absent: this host).
78
+ * @param options - Whether an offline machine's kinds stay usable (a new chat waits for it), and whether to list
79
+ * what the host can run whatever the folder (`machineOnly`: a default for many folders).
80
+ */
81
+ function useEnvironmentChoices(cwd, hostId, options = {}) {
82
+ return useEnvironmentChoicesState(cwd, hostId, options).descriptors;
51
83
  }
52
- export { useEnvironmentChoices };
84
+ export { useEnvironmentChoices, useEnvironmentChoicesState };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns the rows to draw while a list loads: its count once loaded, else the count it had the last time it loaded
3
+ * under `key`, else `fallback`.
4
+ *
5
+ * @param key - What the list is (a dialog, a session's list), shared by every component that draws it.
6
+ * @param count - The loaded list's length, `null` while it loads.
7
+ * @param fallback - The rows to draw before it ever loaded.
8
+ */
9
+ export declare function useLastCount(key: string, count: number | null, fallback: number): number;
@@ -0,0 +1,29 @@
1
+ import { useEffect } from "react";
2
+ // src/hooks/useLastCount.ts
3
+ /**
4
+ * How many rows a list had the last time it loaded, for the placeholder that
5
+ * stands in for it while it loads again: a list that opens with as many
6
+ * loading rows as it will show does not grow or shrink when its rows land.
7
+ * Kept in memory for the page's life, per key.
8
+ */
9
+ const counts = /* @__PURE__ */ new Map();
10
+ /** Past this many keys, the oldest is forgotten. */
11
+ const MAX_KEYS = 200;
12
+ /**
13
+ * Returns the rows to draw while a list loads: its count once loaded, else the count it had the last time it loaded
14
+ * under `key`, else `fallback`.
15
+ *
16
+ * @param key - What the list is (a dialog, a session's list), shared by every component that draws it.
17
+ * @param count - The loaded list's length, `null` while it loads.
18
+ * @param fallback - The rows to draw before it ever loaded.
19
+ */
20
+ function useLastCount(key, count, fallback) {
21
+ useEffect(() => {
22
+ if (count === null) return;
23
+ counts.delete(key);
24
+ counts.set(key, count);
25
+ if (counts.size > MAX_KEYS) counts.delete(counts.keys().next().value);
26
+ }, [key, count]);
27
+ return count ?? counts.get(key) ?? fallback;
28
+ }
29
+ export { useLastCount };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A stable function returning `value` as of the last commit, for what is built once (a store, a palette
3
+ * source, a listener) and reads the current value when it runs. Never call it during render.
4
+ *
5
+ * @param value - What the function returns.
6
+ * @returns The same function for the component's life.
7
+ */
8
+ export declare function useLatest<T>(value: T): () => T;
@@ -0,0 +1,17 @@
1
+ import { useCallback, useInsertionEffect, useRef } from "react";
2
+ // src/hooks/useLatest.ts
3
+ /**
4
+ * A stable function returning `value` as of the last commit, for what is built once (a store, a palette
5
+ * source, a listener) and reads the current value when it runs. Never call it during render.
6
+ *
7
+ * @param value - What the function returns.
8
+ * @returns The same function for the component's life.
9
+ */
10
+ function useLatest(value) {
11
+ const ref = useRef(value);
12
+ useInsertionEffect(() => {
13
+ ref.current = value;
14
+ });
15
+ return useCallback(() => ref.current, []);
16
+ }
17
+ export { useLatest };
@@ -1,2 +1,6 @@
1
- /** Re-renders the caller once a minute (and when the window shows again); read `Date.now()` for the time. */
2
- export declare function useMinuteTick(): void;
1
+ /**
2
+ * Re-renders the caller once a minute (and when the window shows again).
3
+ *
4
+ * @returns The time to measure from: the last tick's, or the caller's first render's when later.
5
+ */
6
+ export declare function useMinuteTick(): number;
@@ -1,4 +1,4 @@
1
- import { useSyncExternalStore } from "react";
1
+ import { useState, useSyncExternalStore } from "react";
2
2
  // src/hooks/useMinuteTick.ts
3
3
  /**
4
4
  * One shared minute tick for relative times ("now", "5m", "2h"): a single
@@ -6,11 +6,12 @@ import { useSyncExternalStore } from "react";
6
6
  * visible. A window coming back into view ticks at once.
7
7
  */
8
8
  const MINUTE_MS = 6e4;
9
- let minute = 0;
9
+ /** When the last tick happened (0 before the first). */
10
+ let tickedAt = 0;
10
11
  let timer = null;
11
12
  const listeners = /* @__PURE__ */ new Set();
12
13
  function tick() {
13
- minute++;
14
+ tickedAt = Date.now();
14
15
  for (const listener of [...listeners]) listener();
15
16
  }
16
17
  function sync() {
@@ -35,9 +36,14 @@ function subscribe(listener) {
35
36
  sync();
36
37
  };
37
38
  }
38
- const read = () => minute;
39
- /** Re-renders the caller once a minute (and when the window shows again); read `Date.now()` for the time. */
39
+ const read = () => tickedAt;
40
+ /**
41
+ * Re-renders the caller once a minute (and when the window shows again).
42
+ *
43
+ * @returns The time to measure from: the last tick's, or the caller's first render's when later.
44
+ */
40
45
  function useMinuteTick() {
41
- useSyncExternalStore(subscribe, read, read);
46
+ const [mountedAt] = useState(() => Date.now());
47
+ return Math.max(useSyncExternalStore(subscribe, read, read), mountedAt);
42
48
  }
43
49
  export { useMinuteTick };
@@ -1,5 +1,5 @@
1
1
  import { AllNearViewportContext } from "./near-viewport-all.js";
2
- import { useContext, useEffect, useState } from "react";
2
+ import { useContext, useEffect, useState, useSyncExternalStore } from "react";
3
3
  // src/hooks/useNearViewport.ts
4
4
  const listeners = /* @__PURE__ */ new WeakMap();
5
5
  const observers = /* @__PURE__ */ new WeakMap();
@@ -62,6 +62,11 @@ function shared(margin, root) {
62
62
  byMargin.set(margin, io);
63
63
  return io;
64
64
  }
65
+ const noSubscribe = () => () => {};
66
+ /** No `IntersectionObserver` to watch with (an old engine, jsdom): everything counts as near. */
67
+ const noObserver = () => typeof IntersectionObserver === "undefined";
68
+ /** While hydrating: as the server rendered, not near. */
69
+ const notYet = () => false;
65
70
  /**
66
71
  * Reports whether an element has come within `margin` of the viewport. It turns true once
67
72
  * and stays true, so it suits lazy work such as highlighting code that scrolls into reach.
@@ -75,13 +80,10 @@ function shared(margin, root) {
75
80
  function useNearViewport(ref, margin = "600px 0px") {
76
81
  const [near, setNear] = useState(false);
77
82
  const all = useContext(AllNearViewportContext);
83
+ const unwatched = useSyncExternalStore(noSubscribe, noObserver, notYet);
78
84
  useEffect(() => {
79
85
  const el = ref.current;
80
- if (!el || near || all) return void 0;
81
- if (typeof IntersectionObserver === "undefined") {
82
- setNear(true);
83
- return;
84
- }
86
+ if (!el || near || all || unwatched) return void 0;
85
87
  const io = shared(margin, scrollRootOf(el));
86
88
  listeners.set(el, () => setNear(true));
87
89
  io.observe(el);
@@ -93,8 +95,9 @@ function useNearViewport(ref, margin = "600px 0px") {
93
95
  ref,
94
96
  near,
95
97
  margin,
96
- all
98
+ all,
99
+ unwatched
97
100
  ]);
98
- return near || all;
101
+ return near || all || unwatched;
99
102
  }
100
103
  export { scrollRootOf, useNearViewport };