zidane-ui 9.1.13 → 9.1.14

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 (309) hide show
  1. package/dist/adapters/index.d.ts +2 -2
  2. package/dist/adapters/index.js +2 -2
  3. package/dist/adapters/live.d.ts +29 -3
  4. package/dist/adapters/live.js +9 -1
  5. package/dist/adapters/server-composer-host.js +17 -2
  6. package/dist/adapters/server-extensions-host.d.ts +0 -1
  7. package/dist/adapters/server-extensions-host.js +5 -16
  8. package/dist/adapters/server-git-host.js +7 -16
  9. package/dist/adapters/server-host.js +181 -43
  10. package/dist/adapters/server-machines-host.d.ts +2 -0
  11. package/dist/adapters/server-machines-host.js +24 -25
  12. package/dist/adapters/server-onboarding-host.d.ts +1 -1
  13. package/dist/adapters/server-onboarding-host.js +3 -4
  14. package/dist/adapters/server-session-host.js +22 -3
  15. package/dist/adapters/server-settings-accounts.js +2 -2
  16. package/dist/adapters/server-settings-host.js +3 -3
  17. package/dist/adapters/server-settings-performance.js +7 -9
  18. package/dist/adapters/server-settings-sections.js +13 -14
  19. package/dist/adapters/server-sidebar-host.js +2 -2
  20. package/dist/adapters/sse-host.js +68 -3
  21. package/dist/adapters/sse-protocol.d.ts +12 -2
  22. package/dist/adapters/sse-protocol.js +4 -2
  23. package/dist/app/AppHostProvider.js +4 -3
  24. package/dist/app/ModalProvider.d.ts +13 -3
  25. package/dist/app/ModalProvider.js +103 -24
  26. package/dist/app/NoticeStack.d.ts +33 -0
  27. package/dist/app/NoticeStack.js +90 -0
  28. package/dist/app/index.d.ts +3 -2
  29. package/dist/app/index.js +3 -2
  30. package/dist/appearance/AppearanceProvider.js +2 -2
  31. package/dist/appearance/headless/index.js +1 -1
  32. package/dist/approvals/headless/index.js +2 -2
  33. package/dist/chat/SessionFilterMenu.d.ts +1 -1
  34. package/dist/chat/SessionFilterMenu.js +2 -1
  35. package/dist/chat/Transcript.js +1 -1
  36. package/dist/chat/composer/Composer.js +9 -6
  37. package/dist/chat/composer/ComposerEditor.js +1 -1
  38. package/dist/chat/composer/ConversationBadges.js +1 -1
  39. package/dist/chat/composer/ModelChainList.js +17 -8
  40. package/dist/chat/composer/ModelChainTooltip.js +5 -2
  41. package/dist/chat/composer/use-composer-stores.js +1 -1
  42. package/dist/chat/composer/use-draft-target.d.ts +20 -1
  43. package/dist/chat/composer/use-draft-target.js +122 -6
  44. package/dist/chat/composer/use-new-session-defaults.d.ts +5 -1
  45. package/dist/chat/composer/use-new-session-defaults.js +17 -4
  46. package/dist/chat/composer/use-run-meter.js +1 -1
  47. package/dist/chat/composer/use-send-prompt.js +1 -1
  48. package/dist/chat/headless/chip-labels.d.ts +1 -0
  49. package/dist/chat/headless/chip-labels.js +1 -0
  50. package/dist/chat/headless/composer/index.js +2 -2
  51. package/dist/chat/headless/draft-target.d.ts +21 -1
  52. package/dist/chat/headless/fixture-host.js +17 -2
  53. package/dist/chat/headless/host.d.ts +3 -3
  54. package/dist/chat/headless/index.d.ts +9 -9
  55. package/dist/chat/headless/index.js +15 -15
  56. package/dist/chat/headless/labels.d.ts +13 -4
  57. package/dist/chat/headless/labels.js +8 -5
  58. package/dist/chat/headless/session-list.d.ts +20 -6
  59. package/dist/chat/headless/session-list.js +1 -0
  60. package/dist/chat/headless/sidebar/directory.d.ts +56 -14
  61. package/dist/chat/headless/sidebar/directory.js +149 -70
  62. package/dist/chat/headless/sidebar/index.d.ts +3 -3
  63. package/dist/chat/headless/sidebar/index.js +3 -3
  64. package/dist/chat/headless/sidebar/labels.d.ts +15 -6
  65. package/dist/chat/headless/sidebar/types.d.ts +3 -1
  66. package/dist/chat/headless/sidebar/view.d.ts +13 -5
  67. package/dist/chat/headless/sidebar/view.js +31 -11
  68. package/dist/chat/headless/streams/actions.d.ts +5 -3
  69. package/dist/chat/headless/streams/actions.js +3 -2
  70. package/dist/chat/headless/streams/index.d.ts +3 -3
  71. package/dist/chat/headless/streams/merge.d.ts +6 -10
  72. package/dist/chat/headless/streams/merge.js +7 -21
  73. package/dist/chat/headless/streams/session-streams.d.ts +29 -4
  74. package/dist/chat/headless/streams/session-streams.js +86 -0
  75. package/dist/chat/headless/streams/store.d.ts +162 -16
  76. package/dist/chat/headless/streams/store.js +334 -38
  77. package/dist/chat/headless/streams/types.d.ts +10 -7
  78. package/dist/chat/headless/transcript-labels.d.ts +1 -0
  79. package/dist/chat/interactions/PlanCard.js +10 -3
  80. package/dist/chat/interactions/QuestionForm.js +7 -3
  81. package/dist/chat/interactions/card-ui.d.ts +5 -3
  82. package/dist/chat/interactions/card-ui.js +9 -7
  83. package/dist/chat/sidebar/SessionSidebar.js +5 -5
  84. package/dist/chat/sidebar/SidebarFilterMenu.js +3 -1
  85. package/dist/chat/sidebar/SidebarFrame.d.ts +4 -0
  86. package/dist/chat/sidebar/SidebarFrame.js +27 -9
  87. package/dist/chat/sidebar/SidebarGroupHeader.js +1 -1
  88. package/dist/chat/sidebar/SidebarHostProvider.d.ts +8 -5
  89. package/dist/chat/sidebar/SidebarHostProvider.js +13 -9
  90. package/dist/chat/sidebar/SidebarToggleButton.js +7 -3
  91. package/dist/chat/sidebar/index.d.ts +2 -2
  92. package/dist/chat/sidebar/session-menu.js +4 -4
  93. package/dist/chat/sidebar/useSaveViewAsSpace.js +2 -2
  94. package/dist/chat/testing/contract.js +2 -2
  95. package/dist/chat/transcript/AuthFailureCard.js +11 -8
  96. package/dist/chat/transcript/BadgeMenu.js +13 -2
  97. package/dist/chat/transcript/MermaidDiagram.js +7 -3
  98. package/dist/chat/transcript/fold.d.ts +4 -0
  99. package/dist/chat/transcript/fold.js +53 -22
  100. package/dist/chat/transcript/script-input.d.ts +1 -1
  101. package/dist/chat/transcript/shell-block.js +8 -4
  102. package/dist/chat/transcript/useStickToBottom.js +12 -0
  103. package/dist/components/BrowserSignIn.js +23 -21
  104. package/dist/components/Form.d.ts +6 -4
  105. package/dist/components/Form.js +16 -8
  106. package/dist/components/LoadError.d.ts +4 -2
  107. package/dist/components/LoadError.js +13 -9
  108. package/dist/components/Notice.d.ts +29 -0
  109. package/dist/components/Notice.js +63 -0
  110. package/dist/components/PanelEmpty.d.ts +1 -1
  111. package/dist/components/PanelEmpty.js +4 -2
  112. package/dist/components/Restricted.d.ts +1 -1
  113. package/dist/components/palette/PaletteList.js +8 -1
  114. package/dist/components/palette/PalettePanel.js +14 -6
  115. package/dist/core.css +24 -5
  116. package/dist/dist/{index-Bq87OcGy.d.ts → index-C6rzc-tt.d.ts} +28 -3
  117. package/dist/dist/index.d.ts +2 -2
  118. package/dist/dist/{timeout-B5pO5I5a.d.ts → timeout-Cz9dRF8Q.d.ts} +1 -1
  119. package/dist/extensions/ExtensionSettingsPage.js +2 -5
  120. package/dist/extensions/ExtensionSettingsSection.js +5 -4
  121. package/dist/extensions/ExtensionSettingsSidebar.js +3 -7
  122. package/dist/extensions/SettingsWireForm.d.ts +1 -7
  123. package/dist/extensions/SettingsWireForm.js +7 -5
  124. package/dist/extensions/headless/fixture-host.d.ts +1 -5
  125. package/dist/extensions/headless/fixture-host.js +2 -5
  126. package/dist/extensions/headless/host.d.ts +1 -11
  127. package/dist/extensions/headless/index.d.ts +3 -3
  128. package/dist/extensions/headless/index.js +6 -6
  129. package/dist/extensions/headless/select.d.ts +1 -11
  130. package/dist/extensions/headless/select.js +1 -18
  131. package/dist/extensions/hooks.js +1 -1
  132. package/dist/files/EditorColumn.js +13 -2
  133. package/dist/files/MediaDiff.js +1 -1
  134. package/dist/files/TreeColumn.js +13 -20
  135. package/dist/files/useEntryActions.js +1 -1
  136. package/dist/files/useOpenFiles.js +3 -1
  137. package/dist/git/BranchMenu.js +6 -4
  138. package/dist/git/ImportRepoDialog.js +18 -9
  139. package/dist/git/MoveSessionDialog.js +16 -8
  140. package/dist/git/RemoteFolderPicker.js +35 -17
  141. package/dist/git/SyncChip.js +17 -17
  142. package/dist/git/WherePicker.d.ts +16 -1
  143. package/dist/git/WherePicker.js +81 -37
  144. package/dist/git/headless/environment.d.ts +33 -3
  145. package/dist/git/headless/environment.js +33 -5
  146. package/dist/git/headless/index.d.ts +2 -2
  147. package/dist/git/headless/index.js +2 -2
  148. package/dist/git/headless/labels.d.ts +15 -2
  149. package/dist/git/headless/labels.js +17 -4
  150. package/dist/git/useEnvironmentChoices.d.ts +3 -1
  151. package/dist/git/useEnvironmentChoices.js +7 -4
  152. package/dist/index.d.ts +2 -1
  153. package/dist/index.js +2 -1
  154. package/dist/keybindings/KeyCommands.js +1 -1
  155. package/dist/keybindings/KeybindingsProvider.js +1 -1
  156. package/dist/keybindings/headless/index.js +2 -2
  157. package/dist/keybindings/headless/overrides.js +1 -1
  158. package/dist/labels.d.ts +5 -0
  159. package/dist/labels.js +5 -0
  160. package/dist/machines/AddMachineDialog.d.ts +34 -0
  161. package/dist/machines/AddMachineDialog.js +464 -0
  162. package/dist/machines/Banners.d.ts +33 -4
  163. package/dist/machines/Banners.js +64 -3
  164. package/dist/machines/DaemonMenu.js +27 -4
  165. package/dist/machines/HostCapabilities.d.ts +1 -3
  166. package/dist/machines/HostCapabilities.js +24 -45
  167. package/dist/machines/HostSyncPanel.js +124 -130
  168. package/dist/machines/HostsSection.d.ts +4 -1
  169. package/dist/machines/HostsSection.js +30 -7
  170. package/dist/machines/MachinesExplainer.d.ts +17 -0
  171. package/dist/machines/MachinesExplainer.js +71 -0
  172. package/dist/machines/MachinesProvider.d.ts +14 -2
  173. package/dist/machines/MachinesProvider.js +35 -1
  174. package/dist/machines/ServerAddedCard.d.ts +31 -0
  175. package/dist/machines/ServerAddedCard.js +72 -0
  176. package/dist/machines/ServerCard.js +91 -215
  177. package/dist/machines/ServerMachinesPanel.d.ts +2 -2
  178. package/dist/machines/ServerMachinesPanel.js +184 -323
  179. package/dist/machines/ServerUpdatePanel.js +51 -40
  180. package/dist/machines/ShareThisComputerForm.d.ts +19 -0
  181. package/dist/machines/ShareThisComputerForm.js +133 -0
  182. package/dist/machines/SyncOutcomeBadge.js +1 -1
  183. package/dist/machines/TokensPanel.d.ts +5 -3
  184. package/dist/machines/TokensPanel.js +98 -78
  185. package/dist/machines/headless/fixture-host.d.ts +19 -3
  186. package/dist/machines/headless/fixture-host.js +43 -6
  187. package/dist/machines/headless/fixtures.js +4 -6
  188. package/dist/machines/headless/host.d.ts +40 -19
  189. package/dist/machines/headless/index.d.ts +3 -3
  190. package/dist/machines/headless/index.js +3 -3
  191. package/dist/machines/headless/labels.d.ts +63 -20
  192. package/dist/machines/headless/labels.js +88 -25
  193. package/dist/machines/headless/messages.js +8 -0
  194. package/dist/machines/headless/stores.d.ts +9 -2
  195. package/dist/machines/headless/stores.js +28 -1
  196. package/dist/machines/index.d.ts +7 -3
  197. package/dist/machines/index.js +8 -4
  198. package/dist/machines/testing/contract.d.ts +15 -3
  199. package/dist/machines/testing/contract.js +68 -14
  200. package/dist/motion/grow.d.ts +8 -1
  201. package/dist/motion/grow.js +10 -4
  202. package/dist/onboarding/headless/labels.d.ts +13 -0
  203. package/dist/onboarding/headless/labels.js +8 -0
  204. package/dist/onboarding/sources/SourceBrowser.js +11 -7
  205. package/dist/onboarding/steps/ImportStep.js +4 -1
  206. package/dist/onboarding/steps/ReadyStep.js +9 -2
  207. package/dist/onboarding/steps/connect/KeyForm.js +6 -2
  208. package/dist/onboarding/steps/connect/ProviderPanel.js +6 -2
  209. package/dist/onboarding/steps/connect/ProviderReady.js +25 -20
  210. package/dist/onboarding/steps/tasks.js +17 -14
  211. package/dist/palette/app-sources.js +1 -1
  212. package/dist/server/sse-handler.js +141 -19
  213. package/dist/session/ArtifactsPanel.js +40 -18
  214. package/dist/session/PlanTracker.js +13 -8
  215. package/dist/session/ProjectHome.js +13 -11
  216. package/dist/session/RemindersPanel.js +35 -17
  217. package/dist/session/RunningWorkDialog.js +6 -2
  218. package/dist/session/SecretsPanel.js +29 -10
  219. package/dist/session/SessionDetailsDialog.d.ts +1 -1
  220. package/dist/session/SessionDetailsDialog.js +18 -10
  221. package/dist/session/SideChat.js +10 -7
  222. package/dist/session/TurnDetailsDialog.js +19 -5
  223. package/dist/session/UsagePanel.js +10 -4
  224. package/dist/session/headless/host.d.ts +2 -0
  225. package/dist/session/headless/index.js +2 -2
  226. package/dist/session/headless/labels.d.ts +19 -1
  227. package/dist/session/headless/labels.js +15 -1
  228. package/dist/session/headless/queue.js +2 -1
  229. package/dist/session/headless/reminder-labels.d.ts +4 -0
  230. package/dist/session/headless/reminder-labels.js +4 -0
  231. package/dist/settings/SettingsRestricted.d.ts +1 -1
  232. package/dist/settings/SettingsRestricted.js +4 -4
  233. package/dist/settings/SettingsShell.d.ts +7 -0
  234. package/dist/settings/SettingsShell.js +6 -1
  235. package/dist/settings/headless/fixture-performance.d.ts +1 -1
  236. package/dist/settings/headless/host.d.ts +2 -2
  237. package/dist/settings/headless/index.js +1 -1
  238. package/dist/settings/headless/labels.d.ts +3 -3
  239. package/dist/settings/headless/labels.js +3 -3
  240. package/dist/settings/headless/performance.d.ts +3 -4
  241. package/dist/settings/headless/search.d.ts +1 -1
  242. package/dist/settings/index.d.ts +2 -1
  243. package/dist/settings/index.js +2 -1
  244. package/dist/settings/sections/appearance/AppearanceSection.js +2 -2
  245. package/dist/settings/sections/claude-import/ClaudeImportDialog.js +1 -1
  246. package/dist/settings/sections/editor/EditorSection.js +8 -5
  247. package/dist/settings/sections/editor/labels.d.ts +1 -0
  248. package/dist/settings/sections/editor/labels.js +1 -0
  249. package/dist/settings/sections/environments/EnvironmentsSection.js +21 -14
  250. package/dist/settings/sections/environments/labels.d.ts +1 -0
  251. package/dist/settings/sections/environments/labels.js +2 -1
  252. package/dist/settings/sections/extensions/ChangeOriginDialog.js +1 -1
  253. package/dist/settings/sections/extensions/CreateExtensionDialog.js +1 -1
  254. package/dist/settings/sections/extensions/ExtensionConfigRows.d.ts +1 -3
  255. package/dist/settings/sections/extensions/ExtensionConfigRows.js +20 -19
  256. package/dist/settings/sections/extensions/ExtensionOptionsSection.js +2 -1
  257. package/dist/settings/sections/extensions/ExtensionsSection.js +1 -1
  258. package/dist/settings/sections/extensions/options-labels.d.ts +2 -1
  259. package/dist/settings/sections/extensions/options-labels.js +2 -1
  260. package/dist/settings/sections/host-catalog/HostCatalogSection.js +1 -1
  261. package/dist/settings/sections/index.d.ts +2 -1
  262. package/dist/settings/sections/index.js +2 -1
  263. package/dist/settings/sections/instructions/InstructionsSection.js +1 -1
  264. package/dist/settings/sections/logs/LogsSection.d.ts +2 -2
  265. package/dist/settings/sections/logs/LogsSection.js +2 -2
  266. package/dist/settings/sections/mcp/McpSection.d.ts +1 -1
  267. package/dist/settings/sections/mcp/McpSection.js +13 -7
  268. package/dist/settings/sections/mcp/McpServerRow.js +21 -14
  269. package/dist/settings/sections/mcp/labels.d.ts +8 -2
  270. package/dist/settings/sections/mcp/labels.js +8 -2
  271. package/dist/settings/sections/models/ModelRows.js +1 -1
  272. package/dist/settings/sections/models/NewChatPlaceRow.d.ts +26 -0
  273. package/dist/settings/sections/models/NewChatPlaceRow.js +78 -0
  274. package/dist/settings/sections/models/SpacesDefaultsSection.js +15 -3
  275. package/dist/settings/sections/models/labels.d.ts +7 -0
  276. package/dist/settings/sections/models/labels.js +7 -0
  277. package/dist/settings/sections/models/model-test.js +7 -4
  278. package/dist/settings/sections/performance/PerformanceSection.js +16 -6
  279. package/dist/settings/sections/performance/labels.d.ts +1 -1
  280. package/dist/settings/sections/performance/labels.js +1 -1
  281. package/dist/settings/sections/providers/ProvidersSection.d.ts +1 -1
  282. package/dist/settings/sections/providers/ProvidersSection.js +15 -8
  283. package/dist/settings/sections/providers/ServerProvidersSection.d.ts +1 -1
  284. package/dist/settings/sections/providers/ServerProvidersSection.js +12 -6
  285. package/dist/settings/sections/providers/labels.d.ts +2 -2
  286. package/dist/settings/sections/providers/labels.js +2 -2
  287. package/dist/settings/sections/shared/catalog.js +1 -1
  288. package/dist/settings/sections/skills/SkillsSection.js +1 -1
  289. package/dist/settings/testing/performance.contract.js +8 -12
  290. package/dist/styles.css +32 -3
  291. package/dist/terminal/HostTerminalSurface.js +17 -7
  292. package/dist/terminal/TerminalPanel.js +30 -17
  293. package/dist/terminal/TerminalSurface.js +11 -4
  294. package/dist/terminal/headless/labels.d.ts +5 -0
  295. package/dist/terminal/headless/labels.js +5 -0
  296. package/dist/terminal/headless/store.d.ts +1 -1
  297. package/dist/terminal/headless/store.js +6 -3
  298. package/dist/workspace/LayoutBudget.d.ts +5 -1
  299. package/dist/workspace/LayoutBudget.js +14 -1
  300. package/dist/workspace/PanelContentView.d.ts +1 -1
  301. package/dist/workspace/PanelContentView.js +17 -6
  302. package/dist/workspace/WorkspaceProvider.js +4 -3
  303. package/dist/workspace/extension-tabs.js +1 -1
  304. package/dist/workspace/headless/index.js +1 -1
  305. package/dist/workspace/headless/labels.d.ts +1 -0
  306. package/dist/workspace/headless/labels.js +1 -0
  307. package/package.json +3 -3
  308. package/src/styles/motion.css +8 -0
  309. package/src/styles/primitives.css +7 -0
@@ -4,23 +4,29 @@ import { isProjectMember } from "./rows.js";
4
4
  import { DEFAULT_SIDEBAR_VIEW } from "./view.js";
5
5
  import { createNotificationStore } from "./notifications.js";
6
6
  import { NO_SIDEBAR_CONTRIBUTIONS, filterQueryOf, filtersForSpace, mergeSidebarSpaces, resolveGrouping, resolveSort, spaceMembership, switcherSpaces } from "./query.js";
7
- import { DEFAULT_SPACE_ID, SessionQueryError, activeSpaceOf, normalizeSpaces, projectNameOf, resolveSessionSpace, sessionDirLabel, viewQuery } from "zidane/chat/pure";
7
+ import { DEFAULT_SPACE_ID, SessionQueryError, activeSpaceOf, createRecentChanges, normalizeSpaces, projectNameOf, resolveSessionSpace, sessionDirLabel, viewQuery } from "zidane/chat/pure";
8
8
  //#region src/chat/headless/sidebar/directory.ts
9
9
  /**
10
10
  * The session directory: every host's sessions as the sidebar lists them,
11
11
  * kept current outside React.
12
12
  *
13
13
  * - Listing: one read per host (this machine plus each remote host) under
14
- * the shown archive filter. Reads are versioned: only the newest refresh
15
- * lands, and a host's own older answer never overwrites a newer one.
14
+ * the shown archive filter, at the start, on a reconnect, a host or filter
15
+ * change. Reads are versioned: only the newest refresh lands, and a host's
16
+ * own older answer never overwrites a newer one.
17
+ * - Live rows: each change signal carries the session's row as its host
18
+ * lists it (`SessionRowChange`). The directory applies it at once in
19
+ * place, with no read. Create and update upsert, and delete removes. A
20
+ * change that arrives while a read of its host is in flight is applied on
21
+ * top of that read's answer.
16
22
  * - Run state: a refresh reconciles the rows' status with the stream store
17
23
  * (a running row marks the session running, an idle one confirmed by the
18
24
  * host clears a run this client missed the end of) unless a stream signal
19
25
  * moved the run state while the refresh was in flight.
20
- * - Live: a debounced change signal re-reads the hosts it touched; a run end
21
- * re-reads its host and leaves a notification on a session not open; a
22
- * runtime switch drops every stream; a reconnect (runtime or the open
23
- * session's server) re-reads the open transcript when no run streams it.
26
+ * - Live: a run end leaves a notification on a session not open. A runtime
27
+ * switch drops every stream, unless the runtime comes back as the same
28
+ * process. After a reconnect (runtime or the open session's server), the
29
+ * windows on screen climb the reconnect ladder (`streams.resync`).
24
30
  * - Prewarm: the transcripts around the open session load in idle time.
25
31
  * - Spaces: the shown space (kept by the views store), the slide direction of
26
32
  * the last switch, following the open session to its space, and reopening
@@ -56,7 +62,6 @@ const defaultIdle = {
56
62
  function createSessionDirectory(options) {
57
63
  const { sessions, streams, views } = options;
58
64
  const idle = options.idle ?? defaultIdle;
59
- const debounceMs = options.changedDebounceMs ?? 300;
60
65
  const pinnedSession = options.pinnedSession ?? null;
61
66
  const notifications = createNotificationStore();
62
67
  let contributionsStore = options.contributions ?? constant(NO_SIDEBAR_CONTRIBUTIONS);
@@ -117,6 +122,22 @@ function createSessionDirectory(options) {
117
122
  let refreshVersion = 0;
118
123
  const hostLists = /* @__PURE__ */ new Map();
119
124
  const hostReads = /* @__PURE__ */ new Map();
125
+ /** Per host, the changes received while its list is read. A read's answer takes the ones after the read started (`createRecentChanges`). */
126
+ const recentChanges = /* @__PURE__ */ new Map();
127
+ const recentFor = (host) => {
128
+ let recent = recentChanges.get(host);
129
+ if (!recent) recentChanges.set(host, recent = createRecentChanges());
130
+ return recent;
131
+ };
132
+ /** The row as the shown archive filter lists it, `null` when it does not. */
133
+ const listed = (row) => row && (archive === "active" ? !row.archived : archive === "archived" ? Boolean(row.archived) : true) ? row : null;
134
+ /** `rows` with `id`'s row replaced, added (`row`) or removed (`null`), newest first as a host lists them. */
135
+ const withRow = (rows, id, row) => {
136
+ const at = rows.findIndex((s) => s.id === id);
137
+ if (at === -1 && !row) return rows;
138
+ const next = at === -1 ? [...rows, row] : row ? rows.map((s, i) => i === at ? row : s) : rows.filter((_, i) => i !== at);
139
+ return row ? next.map((s, i) => [s, i]).sort((a, b) => b[0].updatedAt - a[0].updatedAt || a[1] - b[1]).map(([s]) => s) : next;
140
+ };
120
141
  const refreshHosts = async (only) => {
121
142
  const version = ++refreshVersion;
122
143
  const unchanged = streams.captureRunState();
@@ -126,11 +147,17 @@ function createSessionDirectory(options) {
126
147
  await Promise.all(hosts.filter((host) => !only || only.has(host) || !hostLists.has(host)).map(async (host) => {
127
148
  const read = (hostReads.get(host) ?? 0) + 1;
128
149
  hostReads.set(host, read);
129
- const rows = host ? await sessions.query({
130
- archive: filter,
131
- hostId: host
132
- }).catch(() => []) : await sessions.query({ archive: filter });
133
- if (hostReads.get(host) === read) hostLists.set(host, rows);
150
+ const recent = recentFor(host);
151
+ const reading = recent.begin();
152
+ try {
153
+ const rows = host ? await sessions.query({
154
+ archive: filter,
155
+ hostId: host
156
+ }).catch(() => []) : await sessions.query({ archive: filter });
157
+ if (hostReads.get(host) === read) hostLists.set(host, recent.end(reading, rows, (list, row, id) => withRow(list, id, listed(row))));
158
+ } finally {
159
+ recent.drop(reading);
160
+ }
134
161
  }));
135
162
  if (version !== refreshVersion) return;
136
163
  for (const host of hostLists.keys()) if (!hosts.includes(host)) hostLists.delete(host);
@@ -157,13 +184,52 @@ function createSessionDirectory(options) {
157
184
  }
158
185
  };
159
186
  const refresh = () => refreshHosts();
160
- const reconvergeActiveTranscript = () => {
187
+ /** Applies a change signal. The row lands in its host's list at once. */
188
+ const applyChange = (change) => {
189
+ const row = change.op === "delete" ? null : change.row ?? void 0;
190
+ if (row === void 0) return;
191
+ const id = change.sessionId;
192
+ const host = row?.hostId ?? options.serverOf(id) ?? [...hostLists].find(([, rows]) => rows.some((s) => s.id === id))?.[0] ?? "";
193
+ recentFor(host).note(id, row);
194
+ const rows = hostLists.get(host);
195
+ if (!rows) return;
196
+ const shown = listed(row);
197
+ const next = withRow(rows, id, shown);
198
+ if (next === rows) return;
199
+ hostLists.set(host, next);
200
+ if (shown) {
201
+ options.onListed?.([shown]);
202
+ if (shown.status === "running") streams.markRunning(shown.id);
203
+ }
204
+ const hosts = ["", ...options.servers.get().map((h) => h.id)];
205
+ patch({ allSessions: hosts.flatMap((h) => hostLists.get(h) ?? []) });
206
+ };
207
+ const comebacks = /* @__PURE__ */ new Map();
208
+ const caughtUp = /* @__PURE__ */ new Map();
209
+ const comebacksOf = (sessionId) => comebacks.get(options.serverOf(sessionId) ?? "") ?? 0;
210
+ const comeBack = (host) => comebacks.set(host, (comebacks.get(host) ?? 0) + 1);
211
+ const catchUp = (sessionId) => {
212
+ const seen = comebacksOf(sessionId);
213
+ if (seen === 0 || caughtUp.get(sessionId) === seen) return;
214
+ caughtUp.set(sessionId, seen);
215
+ if (streams.hasEvents(sessionId)) streams.resync(sessionId);
216
+ };
217
+ /** When the open session's connection comes back, its window climbs the reconnect ladder's last steps (`streams.resync`). */
218
+ const resyncActiveTranscript = () => {
161
219
  const active = state.get().activeSessionId;
162
- if (!active || streams.peekRunning(active) || state.get().allSessions.some((s) => s.id === active && s.status === "running")) return;
163
- const runSeqAtKickoff = streams.peekRunSeq(active);
164
- options.loadEvents(active).then((events) => {
165
- if (state.get().activeSessionId === active && !streams.peekRunning(active) && streams.peekRunSeq(active) === runSeqAtKickoff) streams.setEventsPage(active, events);
166
- }).catch(() => void 0);
220
+ if (!active) return;
221
+ caughtUp.set(active, comebacksOf(active));
222
+ streams.resync(active);
223
+ };
224
+ /** When this machine's runtime comes back, every window on screen (the open session, a side chat) climbs the ladder. */
225
+ const resyncVisibleTranscripts = () => {
226
+ resyncActiveTranscript();
227
+ const active = state.get().activeSessionId;
228
+ for (const id of options.pinned?.() ?? []) {
229
+ if (id === active || options.serverOf(id) !== null || !streams.hasEvents(id)) continue;
230
+ caughtUp.set(id, comebacksOf(id));
231
+ streams.resync(id);
232
+ }
167
233
  };
168
234
  const setActive = (next) => {
169
235
  const current = state.get().activeSessionId;
@@ -349,11 +415,19 @@ function createSessionDirectory(options) {
349
415
  id,
350
416
  status
351
417
  };
352
- if (id !== null && last.id === id && last.status !== void 0 && last.status !== "connected" && status === "connected") reconvergeActiveTranscript();
418
+ if (id !== null && last.id === id && last.status !== void 0 && last.status !== "connected" && status === "connected") resyncActiveTranscript();
419
+ if (active) catchUp(active);
353
420
  };
421
+ let statuses = new Map(options.servers.get().map((host) => [host.id, host.status]));
354
422
  followActiveServer();
355
423
  offs.push(state.subscribe(followActiveServer));
356
424
  offs.push(options.servers.subscribe(() => {
425
+ const next = new Map(options.servers.get().map((host) => [host.id, host.status]));
426
+ for (const [host, status] of next) {
427
+ const was = statuses.get(host);
428
+ if (was !== void 0 && was !== "connected" && status === "connected") comeBack(host);
429
+ }
430
+ statuses = next;
357
431
  followActiveServer();
358
432
  const key = options.servers.get().map((host) => `${host.id}:${host.status}`).join("|");
359
433
  if (key === serversKey) return;
@@ -361,24 +435,65 @@ function createSessionDirectory(options) {
361
435
  refresh();
362
436
  }));
363
437
  let runtime = null;
438
+ /** The process the windows' streams come from, when the transport names it. */
439
+ let runtimeEpoch;
440
+ /** Set when the runtime went down while being resumed. The windows wait for the comeback to know whether to go. */
441
+ let dropPending = false;
442
+ /** The last down notice said an attempt to reconnect was in flight. */
443
+ let attempting = false;
444
+ /** The runtime's connection went down since it was last up, so its next `connected` is a comeback. */
445
+ let runtimeDropped = false;
364
446
  const onRuntime = options.signals?.onRuntime;
365
447
  if (onRuntime) {
366
- offs.push(onRuntime((connected) => {
448
+ offs.push(onRuntime((connected, origin) => {
367
449
  const previous = runtime;
368
450
  runtime = connected;
369
- if (previous === null || previous === connected) return;
370
- streams.dropAll();
371
- refresh();
451
+ const drop = () => {
452
+ dropPending = false;
453
+ streams.dropAll();
454
+ refresh();
455
+ };
456
+ const wasAttempting = attempting;
457
+ attempting = !connected && origin?.connecting === true;
458
+ if (previous === null) {
459
+ if (connected) runtimeEpoch = origin?.epoch;
460
+ return;
461
+ }
462
+ if (!connected) {
463
+ if (previous) {
464
+ if (origin?.resuming && runtimeEpoch !== void 0) dropPending = true;
465
+ else drop();
466
+ return;
467
+ }
468
+ if (dropPending && (!origin?.resuming || wasAttempting && !attempting)) drop();
469
+ return;
470
+ }
471
+ if (previous) return;
472
+ const same = dropPending && origin?.epoch !== void 0 && origin.epoch === runtimeEpoch;
473
+ runtimeEpoch = origin?.epoch;
474
+ if (same) dropPending = false;
475
+ else drop();
372
476
  }));
373
477
  offs.push(onRuntime((connected) => {
374
- if (!connected) return;
478
+ if (!connected) {
479
+ runtimeDropped = true;
480
+ return;
481
+ }
482
+ if (runtimeDropped) comeBack("");
483
+ runtimeDropped = false;
375
484
  refresh();
376
- reconvergeActiveTranscript();
485
+ resyncVisibleTranscripts();
377
486
  }));
487
+ let seeding = true;
488
+ offs.push(() => seeding = false);
489
+ options.signals?.currentRuntime?.().then((now) => {
490
+ if (!seeding || !now || runtime !== null) return;
491
+ runtime = now.connected;
492
+ if (now.connected) runtimeEpoch = now.origin?.epoch;
493
+ }, () => void 0);
378
494
  }
379
495
  const onRunEnd = options.signals?.onRunEnd;
380
496
  if (onRunEnd) offs.push(onRunEnd((sessionId, ok) => {
381
- refreshHosts(/* @__PURE__ */ new Set([options.serverOf(sessionId) ?? ""]));
382
497
  if (sessionId === state.get().activeSessionId) return;
383
498
  notifications.set(sessionId, ok ? "completed" : "error");
384
499
  }));
@@ -391,30 +506,7 @@ function createSessionDirectory(options) {
391
506
  }
392
507
  refresh();
393
508
  }));
394
- if (sessions.onChanged) {
395
- let timer = null;
396
- let activeTouched = false;
397
- let touched = /* @__PURE__ */ new Set();
398
- const off = sessions.onChanged((sessionId) => {
399
- activeTouched ||= sessionId === state.get().activeSessionId;
400
- touched.add(options.serverOf(sessionId) ?? "");
401
- if (timer !== null) clearTimeout(timer);
402
- timer = setTimeout(() => {
403
- timer = null;
404
- const hosts = touched;
405
- touched = /* @__PURE__ */ new Set();
406
- refreshHosts(hosts);
407
- if (activeTouched) {
408
- activeTouched = false;
409
- reconvergeActiveTranscript();
410
- }
411
- }, debounceMs);
412
- });
413
- offs.push(() => {
414
- off();
415
- if (timer !== null) clearTimeout(timer);
416
- });
417
- }
509
+ if (sessions.onChanged) offs.push(sessions.onChanged(applyChange));
418
510
  refresh();
419
511
  return () => {
420
512
  for (const off of offs.splice(0).reverse()) off();
@@ -443,7 +535,6 @@ function createSessionDirectory(options) {
443
535
  },
444
536
  async rename(sessionId, title) {
445
537
  await sessions.rename?.(sessionId, title);
446
- await refresh();
447
538
  },
448
539
  async setFavorite(sessionId, favorite) {
449
540
  const flip = (value) => {
@@ -460,33 +551,23 @@ function createSessionDirectory(options) {
460
551
  flip(!favorite);
461
552
  throw err;
462
553
  }
463
- await refresh();
464
554
  },
465
555
  async setArchived(sessionId, archived) {
466
556
  await sessions.setArchived?.(sessionId, archived);
467
- await refresh();
468
557
  },
469
558
  async archiveMany(sessionIds) {
470
- try {
471
- for (const id of sessionIds) await sessions.setArchived?.(id, true);
472
- } finally {
473
- await refresh();
474
- }
559
+ for (const id of sessionIds) await sessions.setArchived?.(id, true);
475
560
  },
476
561
  drop,
477
562
  async removeMany(sessionIds) {
478
563
  let kept = 0;
479
564
  let reason;
480
- try {
481
- for (const id of sessionIds) {
482
- const result = await drop(id);
483
- if (result.kept) {
484
- kept += 1;
485
- reason ??= result.reason;
486
- }
565
+ for (const id of sessionIds) {
566
+ const result = await drop(id);
567
+ if (result.kept) {
568
+ kept += 1;
569
+ reason ??= result.reason;
487
570
  }
488
- } finally {
489
- await refresh();
490
571
  }
491
572
  return reason ? {
492
573
  kept,
@@ -504,7 +585,6 @@ function createSessionDirectory(options) {
504
585
  async setSessionSpace(sessionId, spaceId) {
505
586
  await sessions.setSpace?.(sessionId, spaceId);
506
587
  views.forgetSession(sessionId, spaceId);
507
- await refresh();
508
588
  },
509
589
  setSpaceHidden(spaceId, hidden) {
510
590
  if (spaceId === DEFAULT_SPACE_ID) return;
@@ -604,7 +684,6 @@ function createSessionDirectory(options) {
604
684
  await sessions.setSpace?.(member.id, spaceId);
605
685
  views.forgetSession(member.id, spaceId);
606
686
  }
607
- await refresh();
608
687
  return members.length;
609
688
  }
610
689
  };
@@ -1,8 +1,8 @@
1
1
  import { SessionNotification, SessionNotificationStore, createNotificationStore } from "./notifications.js";
2
2
  import { SessionActivityFilter, SessionArchiveFilter, SidebarExtensionView, SidebarGroupBy, SidebarListSession, SidebarOrigin, SidebarSortBy, SidebarView, VIEW_CHOICE } from "./types.js";
3
- import { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SidebarLastSessions, SidebarViewMap, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews } from "./view.js";
3
+ import { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, SidebarLastSessions, SidebarViewMap, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews } from "./view.js";
4
4
  import { AGENT_GROUPING, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, SidebarContributionStores, SidebarContributions, SidebarGrouping, SidebarItemEntry, SidebarQueryLayer, SidebarRowChip, SidebarRowDecoration, SidebarSpace, claimChildSessions, clearedViewFilters, createDecorator, extensionSpaceOf, filterQueryOf, filtersForSpace, itemsForSpace, mergeSidebarSpaces, nextSavedViewName, resolveGrouping, resolveSort, sidebarContributionsOf, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn } from "./query.js";
5
- import { DirectoryServer, DirectorySettings, ProjectInSpace, SessionDirectory, SessionDirectoryOptions, SessionDirectorySource, SessionDirectoryState, SessionDirectoryStreams, SessionRef, SessionRemoval, availableProjectsOf, createSessionDirectory, filterDirectorySessions, projectKeyOf, sessionRefsOf } from "./directory.js";
5
+ import { DirectoryServer, DirectorySettings, ProjectInSpace, RuntimeNow, RuntimeOrigin, SessionDirectory, SessionDirectoryOptions, SessionDirectorySource, SessionDirectoryState, SessionDirectoryStreams, SessionRef, SessionRemoval, SessionRowChange, availableProjectsOf, createSessionDirectory, filterDirectorySessions, projectKeyOf, sessionRefsOf } from "./directory.js";
6
6
  import { SessionBadgesEntry, SessionBadgesSource, SessionBadgesStore, createSessionBadges } from "./badges.js";
7
7
  import { SessionWindowMode, SidebarEnvironmentHost, SidebarHost } from "./host.js";
8
8
  import { DEFAULT_SIDEBAR_LABELS, SidebarLabels } from "./labels.js";
@@ -16,4 +16,4 @@ import { CompactionProgress, CompactionProgressStore, CompactionSignal, createCo
16
16
  import { SESSION_HISTORY_LIMIT, SessionHistory, SessionHistoryDirection, SessionHistoryOptions, SessionHistoryPage, SessionHistoryState, SessionHistoryStore, createSessionHistory, parseSessionHistory } from "./history.js";
17
17
  import { DotStateInput, SidebarDotState, deriveDotState } from "./dot-state.js";
18
18
  import { deleteSessionPrompt, environmentKindLabel, environmentSummaryText, runsInRemoteSandbox } from "./environment.js";
19
- export { AGENT_GROUPING, BuildQuerySidebarRowsOptions, BuildSidebarRowsOptions, CHATS_BUCKET, COMMON_EMOJI, CompactionProgress, CompactionProgressStore, CompactionSignal, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, DirectoryServer, DirectorySettings, DotStateInput, MAIN_SESSION_ICON_KEY, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_ICONS_KEY, PinsBySpace, ProjectIcon, ProjectIconMap, ProjectInSpace, RunEstimatesRow, RunEstimatesSignal, RunEstimatesStore, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SessionActivity, SessionActivityFilter, SessionActivitySignal, SessionActivityStore, SessionArchiveFilter, SessionBadgesEntry, SessionBadgesSource, SessionBadgesStore, SessionDirectory, SessionDirectoryOptions, SessionDirectorySource, SessionDirectoryState, SessionDirectoryStreams, SessionHistory, SessionHistoryDirection, SessionHistoryOptions, SessionHistoryPage, SessionHistoryState, SessionHistoryStore, SessionNotification, SessionNotificationStore, SessionRef, SessionRemoval, SessionWindowMode, SidebarContributionStores, SidebarContributions, SidebarDotState, SidebarEnvironmentHost, SidebarExtensionView, SidebarGroupBy, SidebarGrouping, SidebarHost, SidebarItemEntry, SidebarLabels, SidebarLastSessions, SidebarListRow, SidebarListSession, SidebarNode, SidebarOrigin, SidebarQueryLayer, SidebarRowChip, SidebarRowDecoration, SidebarSortBy, SidebarSpace, SidebarView, SidebarViewMap, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, VIEW_CHOICE, activityLabel, availableProjectsOf, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, claimChildSessions, clearedViewFilters, createCompactionProgress, createDecorator, createNotificationStore, createRunEstimates, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSidebarViews, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, isProjectIcon, isProjectMember, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextSavedViewName, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, projectKeyOf, projectPathOf, readSidebarViews, reduceActivity, reduceCompaction, repoGroups, resolveGrouping, resolveSort, runsInRemoteSandbox, sessionRefsOf, sidebarContributionsOf, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn, withPinnedProject };
19
+ export { AGENT_GROUPING, BuildQuerySidebarRowsOptions, BuildSidebarRowsOptions, CHATS_BUCKET, COMMON_EMOJI, CompactionProgress, CompactionProgressStore, CompactionSignal, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, DirectoryServer, DirectorySettings, DotStateInput, MAIN_SESSION_ICON_KEY, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_ICONS_KEY, PinsBySpace, ProjectIcon, ProjectIconMap, ProjectInSpace, RunEstimatesRow, RunEstimatesSignal, RunEstimatesStore, RuntimeNow, RuntimeOrigin, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, SessionActivity, SessionActivityFilter, SessionActivitySignal, SessionActivityStore, SessionArchiveFilter, SessionBadgesEntry, SessionBadgesSource, SessionBadgesStore, SessionDirectory, SessionDirectoryOptions, SessionDirectorySource, SessionDirectoryState, SessionDirectoryStreams, SessionHistory, SessionHistoryDirection, SessionHistoryOptions, SessionHistoryPage, SessionHistoryState, SessionHistoryStore, SessionNotification, SessionNotificationStore, SessionRef, SessionRemoval, SessionRowChange, SessionWindowMode, SidebarContributionStores, SidebarContributions, SidebarDotState, SidebarEnvironmentHost, SidebarExtensionView, SidebarGroupBy, SidebarGrouping, SidebarHost, SidebarItemEntry, SidebarLabels, SidebarLastSessions, SidebarListRow, SidebarListSession, SidebarNode, SidebarOrigin, SidebarQueryLayer, SidebarRowChip, SidebarRowDecoration, SidebarSortBy, SidebarSpace, SidebarView, SidebarViewMap, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, VIEW_CHOICE, activityLabel, availableProjectsOf, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, claimChildSessions, clearedViewFilters, createCompactionProgress, createDecorator, createNotificationStore, createRunEstimates, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSidebarViews, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, isProjectIcon, isProjectMember, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextSavedViewName, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, projectKeyOf, projectPathOf, readSidebarViews, reduceActivity, reduceCompaction, repoGroups, resolveGrouping, resolveSort, runsInRemoteSandbox, sessionRefsOf, sidebarContributionsOf, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn, withPinnedProject };
@@ -1,18 +1,18 @@
1
1
  import { createRunEstimates, pickRunEstimate } from "./estimates.js";
2
+ import { pinSession, pinnedSessions } from "./pinned-sessions.js";
2
3
  import { COMMON_EMOJI, MAIN_SESSION_ICON_KEY, PROJECT_ICONS_KEY, firstGrapheme, isProjectIcon, parseProjectIcons } from "./project-icons.js";
3
4
  import { DEFAULT_SIDEBAR_LABELS } from "./labels.js";
4
- import { pinSession, pinnedSessions } from "./pinned-sessions.js";
5
5
  import { VIEW_CHOICE } from "./types.js";
6
6
  import { CHATS_BUCKET, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, groupsByFolder, isProjectMember, itemRows, nestSidebarRows, partitionMainSession, projectPathOf, repoGroups } from "./rows.js";
7
7
  import { PINNED_PROJECTS_KEY, parsePinnedProjects, withPinnedProject } from "./pinned-projects.js";
8
8
  import { activityLabel, createSessionActivity, reduceActivity } from "./activity.js";
9
9
  import { createCompactionProgress, reduceCompaction } from "./compaction.js";
10
10
  import { createSessionBadges } from "./badges.js";
11
- import { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews } from "./view.js";
11
+ import { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews } from "./view.js";
12
12
  import { SESSION_HISTORY_LIMIT, createSessionHistory, parseSessionHistory } from "./history.js";
13
13
  import { createNotificationStore } from "./notifications.js";
14
14
  import { AGENT_GROUPING, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, claimChildSessions, clearedViewFilters, createDecorator, extensionSpaceOf, filterQueryOf, filtersForSpace, itemsForSpace, mergeSidebarSpaces, nextSavedViewName, resolveGrouping, resolveSort, sidebarContributionsOf, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn } from "./query.js";
15
15
  import { availableProjectsOf, createSessionDirectory, filterDirectorySessions, projectKeyOf, sessionRefsOf } from "./directory.js";
16
16
  import { deriveDotState } from "./dot-state.js";
17
17
  import { deleteSessionPrompt, environmentKindLabel, environmentSummaryText, runsInRemoteSandbox } from "./environment.js";
18
- export { AGENT_GROUPING, CHATS_BUCKET, COMMON_EMOJI, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, MAIN_SESSION_ICON_KEY, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_ICONS_KEY, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, VIEW_CHOICE, activityLabel, availableProjectsOf, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, claimChildSessions, clearedViewFilters, createCompactionProgress, createDecorator, createNotificationStore, createRunEstimates, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSidebarViews, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, isProjectIcon, isProjectMember, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextSavedViewName, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, projectKeyOf, projectPathOf, readSidebarViews, reduceActivity, reduceCompaction, repoGroups, resolveGrouping, resolveSort, runsInRemoteSandbox, sessionRefsOf, sidebarContributionsOf, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn, withPinnedProject };
18
+ export { AGENT_GROUPING, CHATS_BUCKET, COMMON_EMOJI, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, MAIN_SESSION_ICON_KEY, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_ICONS_KEY, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, VIEW_CHOICE, activityLabel, availableProjectsOf, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, claimChildSessions, clearedViewFilters, createCompactionProgress, createDecorator, createNotificationStore, createRunEstimates, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSidebarViews, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, isProjectIcon, isProjectMember, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextSavedViewName, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, projectKeyOf, projectPathOf, readSidebarViews, reduceActivity, reduceCompaction, repoGroups, resolveGrouping, resolveSort, runsInRemoteSandbox, sessionRefsOf, sidebarContributionsOf, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn, withPinnedProject };
@@ -1,6 +1,6 @@
1
1
  import { SecretTimeLeft } from "../secrets.js";
2
- import { u as AuthFailure } from "../../../dist/timeout-B5pO5I5a.js";
3
- import { KC as SecretTtl } from "../../../dist/index-Bq87OcGy.js";
2
+ import { u as AuthFailure } from "../../../dist/timeout-Cz9dRF8Q.js";
3
+ import { tw as SecretTtl } from "../../../dist/index-C6rzc-tt.js";
4
4
  import "../../../dist/index.js";
5
5
  import "../index.js";
6
6
  //#region src/chat/headless/sidebar/labels.d.ts
@@ -209,7 +209,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
209
209
  authSignedInRetrying: string;
210
210
  authFixed: string;
211
211
  authTryAgain: string;
212
- authFailed: (message: string) => string;
212
+ authSignInFailed: string;
213
213
  sessionEventLabel: (title: string, verb: string, needsAttention: boolean) => string;
214
214
  clickToAnswer: string;
215
215
  openSession: string;
@@ -252,7 +252,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
252
252
  zoomOutDiagram: string;
253
253
  fitDiagram: string;
254
254
  copyDiagramSource: string;
255
- diagramError: (message: string, at: string) => string;
255
+ diagramNotDrawn: (at: string) => string;
256
256
  diagramErrorAt: (line: number, column: number) => string;
257
257
  stopCommand: string;
258
258
  shellCancelled: string;
@@ -273,7 +273,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
273
273
  blockRunStopped: string;
274
274
  blockRunTimedOut: string;
275
275
  blockRunTruncated: string;
276
- blockRunFailed: (reason: string) => string;
276
+ blockRunError: string;
277
277
  blockRunNeedsTerminal: string;
278
278
  working: string;
279
279
  foldSteps: (count: number) => string;
@@ -303,6 +303,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
303
303
  composerPlaceholderSteer: string;
304
304
  composerPlaceholderQueue: string;
305
305
  sendMessage: string;
306
+ composerSendFailed: string;
306
307
  sendHint: string;
307
308
  stopRun: string;
308
309
  stopHint: string;
@@ -347,7 +348,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
347
348
  modelsJumpToProvider: string;
348
349
  modelsJumpHint: (provider: string, digit: number | null) => string;
349
350
  modelsLoading: string;
350
- modelsLoadFailed: (error: string) => string;
351
+ modelsLoadError: string;
351
352
  modelsNoProviders: string;
352
353
  modelsNoMatch: (query: string) => string;
353
354
  modelsTypeAnId: string;
@@ -404,6 +405,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
404
405
  inboxRecent: string;
405
406
  inboxPreviousSession: string;
406
407
  unsupportedInteraction: (tool: string) => string;
408
+ answerSendFailed: string;
407
409
  planRejectNote: string;
408
410
  planReviseNote: string;
409
411
  planRejectPlaceholder: string;
@@ -468,6 +470,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
468
470
  filterSorts: {
469
471
  recency: string;
470
472
  createdTime: string;
473
+ lastUserMessage: string;
471
474
  alphabetical: string;
472
475
  };
473
476
  filterAllProjects: string;
@@ -555,6 +558,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
555
558
  interactionAnsweredBy: (who: string) => string;
556
559
  badgePathUnavailable: string;
557
560
  badgeNoComposer: string;
561
+ badgeActionFailed: string;
558
562
  badgeCopied: string;
559
563
  badgeOpenIn: (app: string) => string;
560
564
  badgeOpenInBrowserPane: string;
@@ -590,6 +594,9 @@ declare const DEFAULT_SIDEBAR_LABELS: {
590
594
  previous: string;
591
595
  next: string;
592
596
  loading: string;
597
+ noticeDetails: string;
598
+ noticeStack: string;
599
+ noticeDismiss: string;
593
600
  filePath: (path: string) => string;
594
601
  rename: string;
595
602
  current: string;
@@ -607,6 +614,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
607
614
  modalBack: string;
608
615
  screenBack: (screen: string) => string;
609
616
  screenBackKey: string;
617
+ screenNavBack: (screen: string) => string;
610
618
  paletteLabel: string;
611
619
  paletteFilter: string;
612
620
  paletteBack: string;
@@ -670,6 +678,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
670
678
  openInNewTab: string;
671
679
  terminal: string;
672
680
  terminalLoadFailed: (message: string) => string;
681
+ terminalStartFailed: string;
673
682
  terminalExited: (code: number) => string;
674
683
  };
675
684
  /** The sidebar's strings, as {@link DEFAULT_SIDEBAR_LABELS} has them. */
@@ -15,6 +15,8 @@ interface SidebarListSession {
15
15
  createdAt: number;
16
16
  /** Epoch ms of the last activity. */
17
17
  updatedAt: number;
18
+ /** Epoch ms of the user's last typed message, for the "Last user message" sort. If absent, the session sorts by `createdAt`. */
19
+ lastUserMessageAt?: number;
18
20
  /** The folder its tools run in. */
19
21
  cwd: string;
20
22
  /** The repository or project folder it belongs to, when known. */
@@ -72,7 +74,7 @@ interface SidebarExtensionView {
72
74
  /** The Origin filter: the sessions a reminder started (`scheduleId` set), or the others. */
73
75
  type SidebarOrigin = 'scheduled' | 'unscheduled';
74
76
  /** How the sidebar orders sessions inside a group. */
75
- type SidebarSortBy = 'recency' | 'createdTime' | 'alphabetical';
77
+ type SidebarSortBy = 'recency' | 'createdTime' | 'lastUserMessage' | 'alphabetical';
76
78
  /** The filter axes, kept per space. */
77
79
  interface SidebarView {
78
80
  /** Active, archived or every session. */
@@ -3,13 +3,19 @@ import { SidebarView } from "./types.js";
3
3
  //#region src/chat/headless/sidebar/view.d.ts
4
4
  /** A view nobody changed yet. */
5
5
  declare const DEFAULT_SIDEBAR_VIEW: SidebarView;
6
+ /** The format a view record carries (`v`). Format 1 had none, and its `sortBy: 'recency'` reads as the default. */
7
+ declare const SIDEBAR_VIEW_VERSION = 2;
6
8
  /** Where the views persist: one map of space id → view. */
7
- declare const SIDEBAR_VIEW_KEY = "zg-sidebar-view:v1";
9
+ declare const SIDEBAR_VIEW_KEY = "zg-sidebar-view:v2";
8
10
  /** Where the shown space persists. */
9
11
  declare const SIDEBAR_SPACE_KEY = "zg-sidebar-space";
10
- /** A space's record as stored: its view, plus the conversation last open in it (`session`, when one was). */
12
+ /**
13
+ * A space's record as stored: its view, the conversation last open in it (`session`, when one was),
14
+ * and its format (`v`, {@link SIDEBAR_VIEW_VERSION} on every record written).
15
+ */
11
16
  type SidebarViewRecord = SidebarView & {
12
17
  session?: string;
18
+ v?: number;
13
19
  };
14
20
  /** The views the host keeps for this user, next to the device's Storage. */
15
21
  interface SidebarViewsHost {
@@ -23,7 +29,8 @@ interface SidebarViewsHost {
23
29
  setSpace(spaceId: string): Promise<unknown>;
24
30
  }
25
31
  /**
26
- * A stored view, every axis checked; what is missing or unknown takes the default.
32
+ * A stored view, every axis checked. What is missing or unknown takes the default. A record
33
+ * without the format mark (format 1) reads `sortBy: 'recency'` as unset, because it was format 1's default.
27
34
  *
28
35
  * @param raw - The stored value.
29
36
  */
@@ -55,7 +62,8 @@ type SidebarLastSessions = Record<string, string>;
55
62
  /** The Storage the views persist in (`localStorage` in a browser). */
56
63
  type SidebarViewsStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
57
64
  /**
58
- * The views the Storage holds: the per-space map, else the legacy per-axis keys as the default space's view.
65
+ * The views the Storage holds: the per-space map (format 1's when the current key holds none),
66
+ * else the legacy per-axis keys as the default space's view.
59
67
  *
60
68
  * @param storage - Where the views persist; absent reads nothing.
61
69
  */
@@ -103,4 +111,4 @@ interface SidebarViewsOptions {
103
111
  */
104
112
  declare function createSidebarViews(options?: SidebarViewsOptions): SidebarViews;
105
113
  //#endregion
106
- export { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SidebarLastSessions, SidebarViewMap, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews };
114
+ export { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, SidebarLastSessions, SidebarViewMap, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews };