@av-pi-studio/workbench 0.0.0-stage → 0.0.117

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 (273) hide show
  1. package/README.md +157 -2
  2. package/dist/chunks/BinaryFallbackViewer-BN-9Yvel.js +19 -0
  3. package/dist/chunks/ChatPanel-CjPUJMEs.js +2493 -0
  4. package/dist/chunks/CodeView-6kJms_MF.js +143 -0
  5. package/dist/chunks/DiffView-BqDuT3CF.js +48 -0
  6. package/dist/chunks/FilePanel-B8IXG2bj.js +92 -0
  7. package/dist/chunks/HtmlViewer-DpuVFaDo.js +490 -0
  8. package/dist/chunks/ImageViewer-BBfyA5QN.js +27 -0
  9. package/dist/chunks/MarkdownFileViewer-DPFPDS7G.js +88 -0
  10. package/dist/chunks/ModelProvidersPanel-Dsezq7Ss.js +95 -0
  11. package/dist/chunks/MoleculeViewerPanel-DEEU6Zkx.js +191 -0
  12. package/dist/chunks/PdfViewer-BdacmAu_.js +300 -0
  13. package/dist/chunks/SaveFileButton-2rOu02Xx.js +33 -0
  14. package/dist/chunks/SettingsDialog-DO1tDhMW.js +471 -0
  15. package/dist/chunks/SkillsPanel-DZDia4Pw.js +833 -0
  16. package/dist/chunks/TerminalPanel-bphwCSyW.js +242 -0
  17. package/dist/chunks/TextViewer-CVGqN6yy.js +63 -0
  18. package/dist/chunks/VideoViewer-BkB9BoOr.js +20 -0
  19. package/dist/chunks/ViewersPanel-C2E9FLf7.js +50 -0
  20. package/dist/chunks/href-resolution-jv3tpRcp.js +25 -0
  21. package/dist/chunks/index-Dlz8mEKZ.js +6258 -0
  22. package/dist/chunks/markdown-B2OXhZ-_.js +353 -0
  23. package/dist/chunks/provider-auth-store-C1GaLTlw.js +34 -0
  24. package/dist/chunks/use-file-download-CogCqTvU.js +31 -0
  25. package/dist/chunks/use-file-watch-Bb_Xzbr-.js +55 -0
  26. package/dist/chunks/use-provider-auth-list-DTjIZycd.js +16 -0
  27. package/dist/features/agent-ui/AskCard.d.ts +62 -0
  28. package/dist/features/agent-ui/agent-ui-store.d.ts +84 -0
  29. package/dist/features/agent-ui/announce.d.ts +51 -0
  30. package/dist/features/agent-ui/ask-list.d.ts +53 -0
  31. package/dist/features/agent-ui/ask-placement.d.ts +47 -0
  32. package/dist/features/agent-ui/deadline.d.ts +27 -0
  33. package/dist/features/agent-ui/keyboard.d.ts +37 -0
  34. package/dist/features/agent-ui/notify-effect.d.ts +41 -0
  35. package/dist/features/agent-ui/option-layout.d.ts +24 -0
  36. package/dist/features/agent-ui/outcome-line.d.ts +38 -0
  37. package/dist/features/agent-ui/prompt-text.d.ts +24 -0
  38. package/dist/features/chat/Attachments.d.ts +20 -0
  39. package/dist/features/chat/ChatPanel.d.ts +12 -0
  40. package/dist/features/chat/CommandMenu.d.ts +41 -0
  41. package/dist/features/chat/Composer.d.ts +58 -0
  42. package/dist/features/chat/ForkDialog.d.ts +24 -0
  43. package/dist/features/chat/ModelMenu.d.ts +54 -0
  44. package/dist/features/chat/ThinkingMenu.d.ts +39 -0
  45. package/dist/features/chat/Timeline.d.ts +30 -0
  46. package/dist/features/chat/TurnProgressBar.d.ts +14 -0
  47. package/dist/features/chat/composer-busy.d.ts +22 -0
  48. package/dist/features/chat/composer-gate.d.ts +37 -0
  49. package/dist/features/chat/composer-path-drop.d.ts +75 -0
  50. package/dist/features/chat/fork-correlation.d.ts +39 -0
  51. package/dist/features/chat/fork-gate.d.ts +27 -0
  52. package/dist/features/chat/fork-picker-nav.d.ts +14 -0
  53. package/dist/features/chat/fork-result.d.ts +43 -0
  54. package/dist/features/chat/model-menu-sort.d.ts +30 -0
  55. package/dist/features/chat/onboarding-nudge.d.ts +18 -0
  56. package/dist/features/chat/rows/AssistantRow.d.ts +24 -0
  57. package/dist/features/chat/rows/CompactionRow.d.ts +16 -0
  58. package/dist/features/chat/rows/ErrorRow.d.ts +13 -0
  59. package/dist/features/chat/rows/ReasoningRow.d.ts +16 -0
  60. package/dist/features/chat/rows/RowShell.d.ts +37 -0
  61. package/dist/features/chat/rows/SystemRow.d.ts +11 -0
  62. package/dist/features/chat/rows/ToolCard.d.ts +30 -0
  63. package/dist/features/chat/rows/UserRow.d.ts +43 -0
  64. package/dist/features/chat/slash-commands.d.ts +81 -0
  65. package/dist/features/chat/thinking-level-source.d.ts +29 -0
  66. package/dist/features/chat/todos/TodoPanel.d.ts +11 -0
  67. package/dist/features/chat/todos/agent-todos-store.d.ts +35 -0
  68. package/dist/features/chat/todos/todo-collapse-codec.d.ts +12 -0
  69. package/dist/features/chat/todos/todo-panel-model.d.ts +37 -0
  70. package/dist/features/chat/use-bottom-anchor.d.ts +33 -0
  71. package/dist/features/chat/use-fork-action.d.ts +32 -0
  72. package/dist/features/connection/ConnectionBar.d.ts +18 -0
  73. package/dist/features/connection/connection-presentation.d.ts +70 -0
  74. package/dist/features/files/BinaryFallbackViewer.d.ts +9 -0
  75. package/dist/features/files/CodeView.d.ts +15 -0
  76. package/dist/features/files/DiffView.d.ts +18 -0
  77. package/dist/features/files/FileContextMenu.d.ts +13 -0
  78. package/dist/features/files/FileExplorer.d.ts +24 -0
  79. package/dist/features/files/FilePanel.d.ts +26 -0
  80. package/dist/features/files/HtmlViewer.d.ts +22 -0
  81. package/dist/features/files/ImageViewer.d.ts +8 -0
  82. package/dist/features/files/MarkdownFileViewer.d.ts +14 -0
  83. package/dist/features/files/MoleculeViewer.d.ts +60 -0
  84. package/dist/features/files/MoleculeViewerPanel.d.ts +9 -0
  85. package/dist/features/files/PdfViewer.d.ts +14 -0
  86. package/dist/features/files/RightSidebar.d.ts +9 -0
  87. package/dist/features/files/SaveFileButton.d.ts +9 -0
  88. package/dist/features/files/TextViewer.d.ts +23 -0
  89. package/dist/features/files/TreeDraftRow.d.ts +15 -0
  90. package/dist/features/files/TreeNode.d.ts +42 -0
  91. package/dist/features/files/TreeRenameRow.d.ts +19 -0
  92. package/dist/features/files/VideoViewer.d.ts +8 -0
  93. package/dist/features/files/create-entry.d.ts +23 -0
  94. package/dist/features/files/delete-entry.d.ts +17 -0
  95. package/dist/features/files/file-tree.d.ts +92 -0
  96. package/dist/features/files/git-status-index.d.ts +37 -0
  97. package/dist/features/files/html-asset-loader.d.ts +43 -0
  98. package/dist/features/files/html-assets.d.ts +97 -0
  99. package/dist/features/files/html-sandbox.d.ts +62 -0
  100. package/dist/features/files/molecule-reload.d.ts +20 -0
  101. package/dist/features/files/molecule-source.d.ts +10 -0
  102. package/dist/features/files/molecule-theme.d.ts +31 -0
  103. package/dist/features/files/move-entry.d.ts +10 -0
  104. package/dist/features/files/move-status.d.ts +10 -0
  105. package/dist/features/files/move-target.d.ts +31 -0
  106. package/dist/features/files/open-file-tab.d.ts +32 -0
  107. package/dist/features/files/pdf-layout.d.ts +28 -0
  108. package/dist/features/files/pdfjs-runtime.d.ts +30 -0
  109. package/dist/features/files/polymer-file.d.ts +33 -0
  110. package/dist/features/files/text-viewer-state.d.ts +53 -0
  111. package/dist/features/files/upload-sources.d.ts +20 -0
  112. package/dist/features/files/viewer-registry.d.ts +81 -0
  113. package/dist/features/files/write-file.d.ts +12 -0
  114. package/dist/features/git/ChangesPanel.d.ts +13 -0
  115. package/dist/features/provider-auth/LoginDialog.d.ts +21 -0
  116. package/dist/features/provider-auth/ModelProvidersPanel.d.ts +12 -0
  117. package/dist/features/provider-auth/QrCode.d.ts +26 -0
  118. package/dist/features/provider-auth/login-flow.d.ts +55 -0
  119. package/dist/features/provider-auth/provider-auth-presentation.d.ts +31 -0
  120. package/dist/features/provider-auth/provider-auth-store.d.ts +42 -0
  121. package/dist/features/sessions/SessionContextMenu.d.ts +11 -0
  122. package/dist/features/sessions/SessionItem.d.ts +22 -0
  123. package/dist/features/sessions/SessionList.d.ts +9 -0
  124. package/dist/features/sessions/WorkspaceContextMenu.d.ts +9 -0
  125. package/dist/features/sessions/WorkspaceGroupHeader.d.ts +26 -0
  126. package/dist/features/sessions/apply-agent-deep-link.d.ts +7 -0
  127. package/dist/features/sessions/open-chat-tab.d.ts +14 -0
  128. package/dist/features/sessions/open-workspace.d.ts +20 -0
  129. package/dist/features/sessions/session-actions.d.ts +18 -0
  130. package/dist/features/sessions/session-presentation.d.ts +47 -0
  131. package/dist/features/sessions/status-map.d.ts +10 -0
  132. package/dist/features/sessions/workspace-grouping.d.ts +30 -0
  133. package/dist/features/settings/SettingsDialog.d.ts +22 -0
  134. package/dist/features/settings/ViewersPanel.d.ts +18 -0
  135. package/dist/features/settings/settings-categories.d.ts +32 -0
  136. package/dist/features/skills/InstallSkillDialog.d.ts +21 -0
  137. package/dist/features/skills/SkillsPanel.d.ts +32 -0
  138. package/dist/features/skills/skills-presentation.d.ts +159 -0
  139. package/dist/features/skills/use-skills.d.ts +215 -0
  140. package/dist/features/terminal/TerminalPanel.d.ts +37 -0
  141. package/dist/features/terminal/terminal-font.d.ts +44 -0
  142. package/dist/features/terminal/terminal-size.d.ts +52 -0
  143. package/dist/features/workspace/ContextMeter.d.ts +15 -0
  144. package/dist/features/workspace/ContextMeterPopover.d.ts +16 -0
  145. package/dist/features/workspace/DropPreview.d.ts +23 -0
  146. package/dist/features/workspace/PaneDividers.d.ts +30 -0
  147. package/dist/features/workspace/StatusBar.d.ts +16 -0
  148. package/dist/features/workspace/TabContextMenu.d.ts +15 -0
  149. package/dist/features/workspace/TabPanelHost.d.ts +30 -0
  150. package/dist/features/workspace/TabStrip.d.ts +36 -0
  151. package/dist/features/workspace/compact-action.d.ts +21 -0
  152. package/dist/features/workspace/context-meter.d.ts +26 -0
  153. package/dist/features/workspace/external-drag.d.ts +99 -0
  154. package/dist/features/workspace/pane-dnd.d.ts +70 -0
  155. package/dist/features/workspace/pane-layout-view.d.ts +73 -0
  156. package/dist/features/workspace/pane-tree.d.ts +141 -0
  157. package/dist/features/workspace/panel-registry.d.ts +13 -0
  158. package/dist/features/workspace/reopen-client-tabs.d.ts +44 -0
  159. package/dist/features/workspace/restore-active-workspace.d.ts +30 -0
  160. package/dist/features/workspace/status-bar-format.d.ts +20 -0
  161. package/dist/features/workspace/tab-attention.d.ts +35 -0
  162. package/dist/features/workspace-picker/OpenWorkspaceDialog.d.ts +11 -0
  163. package/dist/fonts/CascadiaMono.woff2 +0 -0
  164. package/dist/fonts/CascadiaMonoNF.woff2 +0 -0
  165. package/dist/fonts/LICENSE-Cascadia.txt +97 -0
  166. package/dist/fonts.css +60 -0
  167. package/dist/hooks/agent-stream-events.d.ts +20 -0
  168. package/dist/hooks/file-text-state.d.ts +31 -0
  169. package/dist/hooks/file-transfer-instance.d.ts +10 -0
  170. package/dist/hooks/use-agent-commands.d.ts +18 -0
  171. package/dist/hooks/use-agent-deep-link-boot.d.ts +9 -0
  172. package/dist/hooks/use-agent-stream.d.ts +15 -0
  173. package/dist/hooks/use-agent-todos.d.ts +10 -0
  174. package/dist/hooks/use-checkout-status.d.ts +13 -0
  175. package/dist/hooks/use-connection.d.ts +27 -0
  176. package/dist/hooks/use-explorer-tree.d.ts +20 -0
  177. package/dist/hooks/use-explorer-watch.d.ts +39 -0
  178. package/dist/hooks/use-explorer.d.ts +21 -0
  179. package/dist/hooks/use-external-pane-drop.d.ts +47 -0
  180. package/dist/hooks/use-file-diff.d.ts +9 -0
  181. package/dist/hooks/use-file-download.d.ts +18 -0
  182. package/dist/hooks/use-file-live-refresh.d.ts +31 -0
  183. package/dist/hooks/use-file-read.d.ts +31 -0
  184. package/dist/hooks/use-file-source.d.ts +16 -0
  185. package/dist/hooks/use-file-text.d.ts +21 -0
  186. package/dist/hooks/use-file-transfer.d.ts +18 -0
  187. package/dist/hooks/use-file-watch.d.ts +36 -0
  188. package/dist/hooks/use-home-dir.d.ts +14 -0
  189. package/dist/hooks/use-inline-image.d.ts +37 -0
  190. package/dist/hooks/use-is-compacting.d.ts +9 -0
  191. package/dist/hooks/use-pane-drag.d.ts +40 -0
  192. package/dist/hooks/use-pane-layout.d.ts +40 -0
  193. package/dist/hooks/use-provider-auth-list.d.ts +19 -0
  194. package/dist/hooks/use-provider-models.d.ts +14 -0
  195. package/dist/hooks/use-session-restore.d.ts +44 -0
  196. package/dist/hooks/use-session-stats.d.ts +40 -0
  197. package/dist/hooks/use-shortcuts.d.ts +6 -0
  198. package/dist/hooks/use-terminal-exit-watch.d.ts +47 -0
  199. package/dist/hooks/use-terminal-restore.d.ts +38 -0
  200. package/dist/hooks/use-thinking-levels.d.ts +13 -0
  201. package/dist/hooks/use-timeline-reset-watch.d.ts +43 -0
  202. package/dist/hooks/use-viewer-settings.d.ts +17 -0
  203. package/dist/host/browser-clipboard.d.ts +9 -0
  204. package/dist/host/browser-connection.d.ts +13 -0
  205. package/dist/host/browser-files.d.ts +9 -0
  206. package/dist/host/browser-host.d.ts +14 -0
  207. package/dist/host/browser-launch.d.ts +19 -0
  208. package/dist/host/browser-worker-timers.d.ts +29 -0
  209. package/dist/host/external-link.d.ts +14 -0
  210. package/dist/host/index.d.ts +4 -0
  211. package/dist/host/install.d.ts +21 -0
  212. package/dist/host/types.d.ts +168 -0
  213. package/dist/index.d.ts +14 -0
  214. package/dist/index.js +18 -0
  215. package/dist/lib/agent-deep-link.d.ts +29 -0
  216. package/dist/lib/connection/connection-store.d.ts +49 -0
  217. package/dist/lib/connection/files-changed.d.ts +41 -0
  218. package/dist/lib/connection/live-file-transfer.d.ts +8 -0
  219. package/dist/lib/connection/normalize-url.d.ts +16 -0
  220. package/dist/lib/connection/query-client.d.ts +3 -0
  221. package/dist/lib/connection/resolve-connect-target.d.ts +10 -0
  222. package/dist/lib/connection/resume-action.d.ts +33 -0
  223. package/dist/lib/connection/resume-handler.d.ts +6 -0
  224. package/dist/lib/connection/rpc-keys.d.ts +39 -0
  225. package/dist/lib/drag-guard.d.ts +39 -0
  226. package/dist/lib/inline-image-cache.d.ts +34 -0
  227. package/dist/lib/pane-layout-persistence.d.ts +74 -0
  228. package/dist/lib/paths.d.ts +33 -0
  229. package/dist/lib/protocol/events.d.ts +19 -0
  230. package/dist/lib/protocol/timeline-paging.d.ts +29 -0
  231. package/dist/lib/random-id.d.ts +16 -0
  232. package/dist/shell/Workbench.d.ts +6 -0
  233. package/dist/shell/WorkbenchBoot.d.ts +4 -0
  234. package/dist/shell/WorkbenchProvider.d.ts +10 -0
  235. package/dist/shell/WorkspaceShell.d.ts +12 -0
  236. package/dist/shell/context.d.ts +8 -0
  237. package/dist/shell/hooks.d.ts +32 -0
  238. package/dist/shell/regions.d.ts +17 -0
  239. package/dist/stores/compaction-store.d.ts +45 -0
  240. package/dist/stores/deep-link-store.d.ts +15 -0
  241. package/dist/stores/draft-store.d.ts +45 -0
  242. package/dist/stores/explorer-store.d.ts +63 -0
  243. package/dist/stores/fork-store.d.ts +69 -0
  244. package/dist/stores/git-store.d.ts +59 -0
  245. package/dist/stores/layout-store.d.ts +137 -0
  246. package/dist/stores/materialize.d.ts +47 -0
  247. package/dist/stores/session-store.d.ts +76 -0
  248. package/dist/stores/stats-store.d.ts +48 -0
  249. package/dist/stores/tab-store.d.ts +145 -0
  250. package/dist/stores/ui-store.d.ts +85 -0
  251. package/dist/styles.css +1 -0
  252. package/dist/timeline/FileLink.d.ts +22 -0
  253. package/dist/timeline/InlineImage.d.ts +16 -0
  254. package/dist/timeline/bottom-anchor.d.ts +77 -0
  255. package/dist/timeline/compaction.d.ts +12 -0
  256. package/dist/timeline/file-link-src.d.ts +34 -0
  257. package/dist/timeline/file-open-target.d.ts +19 -0
  258. package/dist/timeline/format-meta-time.d.ts +10 -0
  259. package/dist/timeline/highlight.d.ts +9 -0
  260. package/dist/timeline/href-resolution.d.ts +34 -0
  261. package/dist/timeline/image-src.d.ts +32 -0
  262. package/dist/timeline/inline-image-view.d.ts +34 -0
  263. package/dist/timeline/live-tail.d.ts +5 -0
  264. package/dist/timeline/markdown.d.ts +35 -0
  265. package/dist/timeline/mermaid-theme.d.ts +23 -0
  266. package/dist/timeline/reducer.d.ts +38 -0
  267. package/dist/timeline/row-model.d.ts +154 -0
  268. package/dist/timeline/streaming-split.d.ts +42 -0
  269. package/dist/timeline/tool-mapping.d.ts +60 -0
  270. package/dist/viewer-plugins/viewer-settings-store.d.ts +55 -0
  271. package/dist/vite/index.d.ts +36 -0
  272. package/dist/vite/index.js +39 -0
  273. package/package.json +81 -4
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Terminal exit watch — listens for `terminals_update` (a JSON push, broadcast to **every** active
3
+ * session unconditionally whenever a terminal is created/renamed/killed/self-exits/starts a
4
+ * workspace script, **or is resized to a genuinely new size** (sprint-053/task-003 and task-007,
5
+ * `packages/server/src/terminal/terminal-rpc.ts`) and marks any open terminal tab whose slot has
6
+ * disappeared from the daemon's live inventory as `exited`.
7
+ * Follows the same local-interface-plus-type-guard convention as `checkout_status_update` /
8
+ * `file_changed` (root AGENTS.md § Protocol overview) — no protocol-package schema exists for this
9
+ * push family, and none is needed: it is a per-connection JSON broadcast, not a per-path
10
+ * subscription.
11
+ *
12
+ * `TerminalManager.list()` (daemon) only ever returns *live* entries — `onExit` deletes a
13
+ * terminal's map entry the instant it fires, before the broadcast that reports the removal — so
14
+ * there is no `closed: true` flag to look for on this side; a slot's absence from `terminals` IS
15
+ * the exit signal.
16
+ *
17
+ * Reconciles only tabs whose `data.slot` is already known (non-null). The create broadcast lands
18
+ * *before* `create_terminal_response` resolves (`terminal-rpc.ts`'s create handler broadcasts,
19
+ * then returns), so this client's own freshly created tab has no slot yet when the very first
20
+ * `terminals_update` naming it arrives — treating that gap as an exit would mark a brand-new
21
+ * terminal exited before it ever ran. Once `TerminalPanel` records the slot, later updates
22
+ * reconcile it normally.
23
+ *
24
+ * `TerminalsUpdateMessage.terminals[].cols`/`.rows` (task-007) are consumed by a separate,
25
+ * per-panel listener in `TerminalPanel.tsx` — resize belief (`believedSizeRef`) is deliberately a
26
+ * component-local ref, not tab-store state, so it cannot be reconciled from this global hook. That
27
+ * listener reuses this file's `TerminalsUpdateMessage` type and `isTerminalsUpdate` guard rather
28
+ * than declaring a parallel one, per this file's original design note to coordinate, not duplicate.
29
+ */
30
+ export interface TerminalsUpdateMessage {
31
+ type: "terminals_update";
32
+ terminals: Array<{
33
+ slot: number;
34
+ cols?: number;
35
+ rows?: number;
36
+ }>;
37
+ }
38
+ export declare function isTerminalsUpdate(message: unknown): message is TerminalsUpdateMessage;
39
+ /**
40
+ * Marks every open terminal tab whose `data.slot` is a known, non-null number NOT present in
41
+ * `liveSlots` as exited. Exported for direct unit testing — this project's vitest config runs
42
+ * `.test.ts` under a plain Node environment (no DOM), so the hook itself is verified by smoke
43
+ * test while this is driven directly (mirrors `use-terminal-restore.ts`'s `runTerminalRestore`).
44
+ */
45
+ export declare function reconcileLiveTerminals(liveSlots: Set<number>): void;
46
+ export declare function useTerminalExitWatch(): void;
47
+ //# sourceMappingURL=use-terminal-exit-watch.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Terminal restore — on a fresh `open` connection, fetches every terminal currently running on
3
+ * the daemon (`list_terminals_request`) and reopens a tab for each one it should surface,
4
+ * mirroring `use-session-restore.ts`'s one-shot restore pattern but for terminals instead of chat
5
+ * sessions. A terminal can outlive its tab (a daemon restart losing the tab's in-memory link, a
6
+ * dev-mode double-mount race losing the created slot before it's persisted onto the tab, or simply
7
+ * a terminal created outside this UI — the CLI/MCP, or another connected client) and this is what
8
+ * makes it reappear automatically as an ordinary closable tab instead of leaking silently or
9
+ * needing a separate "orphaned terminals" management view. `TerminalPanel`'s slot-creation effect
10
+ * only fires `create_terminal_request` when a tab's `data.slot` is still `null`, so opening a tab
11
+ * with the terminal's already-known slot here just subscribes to its existing stream (reattach),
12
+ * never spawns a second PTY.
13
+ *
14
+ * **"Reopen every terminal" only holds for a workspace with no persisted pane-layout record.** For
15
+ * one that has one (the ordinary case once it has been split), this is claim-driven like chat
16
+ * restore: a terminal only gets a tab automatically if some pane there is actually waiting for it
17
+ * (`terminal:<slot>` in that workspace's `pendingPlacement`) — checked per workspace, so one
18
+ * workspace's record never suppresses a terminal belonging to an unrelated, never-split one. An
19
+ * unrelated terminal left running elsewhere used to force a tab open regardless, landing in
20
+ * whichever pane happened to be focused and — before `layout-store.ts#claimPaneFor`'s restore-time
21
+ * guard existed — silently replacing a chat a claim had *just* placed there a moment earlier in the
22
+ * same restore pass. Orphaned-terminal surfacing is deliberately narrower now: real for a workspace
23
+ * nothing has ever split (nothing to conflict with), suppressed once that workspace has an
24
+ * arrangement a stray terminal has no claim on.
25
+ *
26
+ * This is also one of the two halves of the pane-layout hydration settle point
27
+ * (`layout-store.markHydrationSource`): being one-shot per connection is what makes "initial
28
+ * hydration complete" a well-defined moment.
29
+ */
30
+ import type { PiStudioClient } from "@av-pi-studio/client";
31
+ /**
32
+ * The one-shot restore body plus its hydration signal. Exported for direct unit testing — this
33
+ * project's vitest config runs `.test.ts` under a plain Node environment (no DOM), so the hook
34
+ * itself is verified by smoke test while this is driven directly.
35
+ */
36
+ export declare function runTerminalRestore(client: PiStudioClient): Promise<void>;
37
+ export declare function useTerminalRestore(): void;
38
+ //# sourceMappingURL=use-terminal-restore.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `use-thinking-levels` — TanStack Query wrapper over `agent_thinking_levels_request`
3
+ * (`client.agent(id).listThinkingLevels()`, sprint-070). Keyed `[agentId, model]` so a model
4
+ * change — which can clamp the level list — refetches automatically without manual
5
+ * invalidation. Live sessions only: drafts answer from the cached model catalogue
6
+ * (`thinking-level-source.ts`), never this query — the caller (`Composer.tsx`) gates `enabled`
7
+ * on `userMessageCount > 0` so a never-spawned draft never issues it. `retry: false` because a
8
+ * `requireSession` rejection is deterministic for a given `[agentId, model]` key: retrying a
9
+ * request that can never succeed is pure waste (and briefly leaves the menu stuck retrying
10
+ * instead of showing the catalogue fallback).
11
+ */
12
+ export declare function useThinkingLevels(agentId: string | null | undefined, model: string | undefined, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<NoInfer<string[]>, Error>;
13
+ //# sourceMappingURL=use-thinking-levels.d.ts.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Timeline reset watch — listens for `agent_timeline_reset` (a JSON push, broadcast to **every**
3
+ * active session unconditionally whenever a fork rebinds an agent's native session handle,
4
+ * `packages/server/src/agent/slash-command-operations.ts`'s `handleFork`, sprint-071/task-003) and
5
+ * fully replaces that agent's cached timeline with a fresh, from-scratch authoritative refetch.
6
+ *
7
+ * Follows the same local-interface-plus-type-guard convention as `checkout_status_update` /
8
+ * `file_changed` / `terminals_update` (root AGENTS.md § Protocol overview) — no protocol-package
9
+ * schema exists for this push family, and none is needed: it is a per-connection JSON broadcast,
10
+ * not a per-path subscription.
11
+ *
12
+ * This is the **convergence backbone** for conversation fork (sprint-072/task-001): the requester
13
+ * takes no bespoke refresh path, so a second browser window, a relay-connected phone, and the
14
+ * initiating tab all converge through this one code path once the daemon's post-fork resync
15
+ * broadcasts. `reason` is deliberately treated as opaque — the daemon documents it as an open
16
+ * string reserved for other rebind operations (`/new`, `/resume`, `/clone`, `switch_session`) to
17
+ * reuse later, so this handler never branches on its value; every reset gets the same full replace.
18
+ *
19
+ * Hydrated rows carry fresh epoch/seq numbering after a fork (`session-hydration.ts`), so any
20
+ * cursor a client holds from before the reset is meaningless afterwards — the refetch always
21
+ * starts from `cursor: null` (`fetchTimelineEvents`'s own contract), never a tail-sync. Replacing
22
+ * the timeline wholesale with authoritative rows also clears any pending optimistic user row for
23
+ * the agent as a side effect: an optimistic row only ever exists in this client's local state, so a
24
+ * fresh server-truth replay can never reproduce one.
25
+ */
26
+ import type { PiStudioClient } from "@av-pi-studio/client";
27
+ export interface AgentTimelineResetMessage {
28
+ type: "agent_timeline_reset";
29
+ agentId: string;
30
+ reason?: string;
31
+ }
32
+ export declare function isAgentTimelineReset(message: unknown): message is AgentTimelineResetMessage;
33
+ /**
34
+ * Drops the agent's cached timeline and refetches it from scratch, paging to completion. A no-op
35
+ * (no fetch issued) when this client has no cached session for `agentId` at all — cheap, and avoids
36
+ * a fetch storm for agents this tab was never showing. Exported for direct unit testing — this
37
+ * project's vitest config runs `.test.ts` under a plain Node environment (no DOM), so the hook
38
+ * itself is verified by smoke test while this is driven directly (mirrors `use-session-restore.ts`'s
39
+ * `runSessionRestore`).
40
+ */
41
+ export declare function handleAgentTimelineReset(client: PiStudioClient, agentId: string): Promise<void>;
42
+ export declare function useTimelineResetWatch(): void;
43
+ //# sourceMappingURL=use-timeline-reset-watch.d.ts.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Viewer-settings boot: hydrates `viewer-settings-store.ts` on connect, subscribes to
3
+ * `viewer_settings_update` pushes for the lifetime of the connection, and resets local state
4
+ * whenever the connection leaves `open` — so a stale document never survives past its daemon and a
5
+ * subsequent reconnect always re-hydrates.
6
+ *
7
+ * Subscribing directly inside this effect (rather than from a component) means exactly one
8
+ * subscription exists per connection, matching `viewer-settings-store.ts`'s own note ("not per
9
+ * component") and `use-terminal-exit-watch.ts`'s established shape for a connection-scoped push
10
+ * subscription.
11
+ *
12
+ * Mount once in `app.tsx`'s `Boot`, after `useConnectionBoot()` and before `usePaneLayoutBoot()`.
13
+ * Ordering is not load-bearing — the layout replay gates on the store's `loaded` flag, not hook
14
+ * declaration order — but it keeps the read order legible.
15
+ */
16
+ export declare function useViewerSettingsBoot(): void;
17
+ //# sourceMappingURL=use-viewer-settings.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The browser host's `clipboard.writeText` (file-explorer "Copy Path" actions, task quick-wins-1;
3
+ * the login dialog's "Copy link", sprint-065). Tries the async Clipboard API first, falling back to a hidden
4
+ * `execCommand("copy")` textarea when it's unavailable — plain-http access to a self-hosted daemon
5
+ * over a LAN is not a secure context, so `navigator.clipboard` is `undefined` there, a real
6
+ * deployment condition for this app, not a hypothetical.
7
+ */
8
+ export declare function copyText(text: string): Promise<void>;
9
+ //# sourceMappingURL=browser-clipboard.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The browser host's `connection`: today's socket wiring, worker-backed reconnect timers, and the
3
+ * page-level resume signals.
4
+ */
5
+ import { type Transport } from "@av-pi-studio/client";
6
+ import { type ConnectTarget, type HostConnection } from "./types.js";
7
+ /** Relay transport for a relay-routed pairing link, a bearer-subprotocol socket when a password is
8
+ * set, otherwise the SDK's default socket. */
9
+ export declare function createBrowserTransport(target: ConnectTarget, options: {
10
+ password?: string;
11
+ }): Transport | undefined;
12
+ export declare function createBrowserConnection(): HostConnection;
13
+ //# sourceMappingURL=browser-connection.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The browser host's `files`: uploads hand the `File` itself to the SDK (sliced and paced there, so a
3
+ * large upload never sits in memory), save-to-disk downloads into memory and clicks a download
4
+ * anchor, and viewers get a `Blob` object URL.
5
+ */
6
+ import { type FileTransferClient } from "@av-pi-studio/client";
7
+ import { type HostFiles } from "./types.js";
8
+ export declare function createBrowserFiles(transfer: () => FileTransferClient): HostFiles;
9
+ //# sourceMappingURL=browser-files.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { type AppIdentity, type HostPdf, type WorkbenchHost } from "./types.js";
2
+ export interface BrowserHostOptions {
3
+ /** Brand title and version for the connection bar. A real shell always passes it. */
4
+ app: AppIdentity;
5
+ /**
6
+ * The PDF runtime. Only the application bundle can build the pdf.js worker, so it passes it in
7
+ * (`packages/web-client/src/main.tsx` shows the Vite form: a worker import of `pdfjs-dist`'s
8
+ * `build/pdf.worker.min.mjs`, and the app base plus `pdfjs/`). Omitted: no PDF preview.
9
+ */
10
+ pdf: HostPdf;
11
+ }
12
+ /** The host `web-client` uses: today's browser behaviour behind the host contract. */
13
+ export declare function createBrowserHost(overrides?: Partial<BrowserHostOptions>): WorkbenchHost;
14
+ //# sourceMappingURL=browser-host.d.ts.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The browser host's `launch`: the page URL is the launch intent.
3
+ * - `?host=&password=&cwd=&connect=1` pre-fills the connection bar; connects only with `connect=1`.
4
+ * - `?pair=<url-encoded pairing link>` pre-fills and always connects (the link is its own
5
+ * credential).
6
+ * - A fragment carrying `offer=` means the page URL itself is a pairing link (`pi-studio daemon
7
+ * pair` used this origin as its `baseUrl`): connect to it immediately.
8
+ * - `#agent=<id>` is the agent deep link (swe/features/web-ui-agent-deep-link.md), re-read on
9
+ * `hashchange`; consuming it strips `agent=` from the fragment with `history.replaceState`.
10
+ */
11
+ import { type ConnectIntent, type HostLaunch } from "./types.js";
12
+ /** Today's URL grammar as a pure function of the page location. */
13
+ export declare function parseBrowserConnectIntent(location: {
14
+ href: string;
15
+ search: string;
16
+ hash: string;
17
+ }): ConnectIntent | null;
18
+ export declare function createBrowserLaunch(): HostLaunch;
19
+ //# sourceMappingURL=browser-launch.d.ts.map
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `setTimeout`/`clearTimeout` equivalents backed by a dedicated Web Worker
3
+ * (swe/features/connection-resilience.md § Purpose item 1).
4
+ *
5
+ * Dedicated-worker timers are exempt from a hidden tab's page-visibility throttling (Chrome
6
+ * intensive throttling clamps chained main-thread `setTimeout` chains to ~1 fire/minute after
7
+ * ~5 minutes hidden — see the spec for the user-facing symptom this fixes). The worker is built
8
+ * from an inline `Blob` URL: no separate asset file, no bundler/Vite worker-plugin config, nothing
9
+ * for the build to resolve.
10
+ *
11
+ * Falls back to plain `setTimeout`/`clearTimeout` if `Worker`/`Blob`/`URL.createObjectURL` is
12
+ * unavailable or Worker construction throws (e.g. a CSP without `worker-src blob:` — see
13
+ * `docker/web-client.nginx.conf.template`, which today sets no CSP at all, so this is a
14
+ * forward-looking safety net rather than an active constraint). The fallback decision is latched
15
+ * on first use: a throwing Worker is never retried on a later `setTimer` call. Behavior in the
16
+ * fallback path is identical to not having this module at all — the feature degrades, never
17
+ * regresses.
18
+ */
19
+ interface TimerBackend {
20
+ setTimer: (cb: () => void, ms: number) => unknown;
21
+ clearTimer: (handle: unknown) => void;
22
+ }
23
+ /**
24
+ * Returns `setTimer`/`clearTimer` backed by a lazily-created, module-level shared Worker (created
25
+ * on first `setTimer`, not at import time — importing this module has no side effects).
26
+ */
27
+ export declare function createWorkerTimers(): TimerBackend;
28
+ export {};
29
+ //# sourceMappingURL=browser-worker-timers.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { type AnchorHTMLAttributes, type MouseEvent } from "react";
2
+ /**
3
+ * Click activation of an external link: routed to `host.links.openExternal` when the host has one
4
+ * (the default navigation is suppressed), otherwise left to the browser. Middle-click (`auxclick`)
5
+ * and "copy link address" never reach this and keep working natively.
6
+ */
7
+ export declare function routeExternalLinkClick(event: Pick<MouseEvent, "preventDefault">, url: string): void;
8
+ type ExternalAnchorProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "target" | "rel"> & {
9
+ href: string;
10
+ };
11
+ /** An `<a target="_blank">` that defers to the host's `links.openExternal` when it has one. */
12
+ export declare function ExternalAnchor({ href, onClick, ...rest }: ExternalAnchorProps): import("react").JSX.Element;
13
+ export {};
14
+ //# sourceMappingURL=external-link.d.ts.map
@@ -0,0 +1,4 @@
1
+ export { createBrowserHost, type BrowserHostOptions } from "./browser-host.js";
2
+ export { getHost, installHost, onHostInstalled, resetHostForTests } from "./install.js";
3
+ export { type AppIdentity, type WorkbenchHost } from "./types.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The installed host is a module-level singleton: most of its callers are not React code (zustand
3
+ * stores, persistence helpers, the connection store), so they read it with `getHost()` at call
4
+ * time. `WorkbenchProvider` installs it during its first render, before any child renders.
5
+ */
6
+ import { type WorkbenchHost } from "./types.js";
7
+ /**
8
+ * Install `host` as the current host. The first install wins: installing the same host again is a
9
+ * no-op (StrictMode renders twice), and a different one is ignored with one development warning.
10
+ */
11
+ export declare function installHost(host: WorkbenchHost): WorkbenchHost;
12
+ /** The installed host, or a lazily created browser host when nothing is installed yet. */
13
+ export declare function getHost(): WorkbenchHost;
14
+ /**
15
+ * Run `listener` when a host is installed. For module-level stores that read the host while the
16
+ * module loads (before installation) and must re-read from the real host.
17
+ */
18
+ export declare function onHostInstalled(listener: (host: WorkbenchHost) => void): () => void;
19
+ /** Test-only: forget the installed host and the warning latch. Listeners stay registered. */
20
+ export declare function resetHostForTests(): void;
21
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1,168 @@
1
+ import { type Transport } from "@av-pi-studio/client";
2
+ import { type KeyValueStore } from "@av-pi-studio/ui-library";
3
+ /** Shown in the connection bar. Static for the lifetime of the page. */
4
+ export interface AppIdentity {
5
+ title: string;
6
+ version: string;
7
+ /**
8
+ * Sent as `hello.platform` so the daemon can tell what kind of client this is (`"desktop"` for the
9
+ * Tauri app). Omit in a plain browser. Informational: nothing branches on it.
10
+ */
11
+ platform?: string;
12
+ }
13
+ /** Blocking questions to the user. Each resolves when the user answers. */
14
+ export interface HostDialogs {
15
+ /** Resolves `false` on dismissal. */
16
+ confirm(message: string): Promise<boolean>;
17
+ alert(message: string): Promise<void>;
18
+ /** Resolves `null` on dismissal. */
19
+ prompt(message: string, initial?: string): Promise<string | null>;
20
+ }
21
+ export interface HostClipboard {
22
+ /** Rejects on failure; callers report the failure to the user. */
23
+ writeText(text: string): Promise<void>;
24
+ }
25
+ export interface HostLinks {
26
+ /**
27
+ * Optional. When present, activating an external link calls it and the default navigation is
28
+ * suppressed. When absent, the anchor behaves natively (`target="_blank"`).
29
+ */
30
+ openExternal?(url: string): void;
31
+ }
32
+ /**
33
+ * What the shell was launched to connect to. `url` is a daemon address or a pairing link; every
34
+ * field is a pre-fill for the connection bar. `connect: true` connects immediately (a pairing link
35
+ * always does).
36
+ */
37
+ export interface ConnectIntent {
38
+ url?: string;
39
+ password?: string;
40
+ cwd?: string;
41
+ connect: boolean;
42
+ }
43
+ /** A source of "open this agent" requests (`#agent=<id>` in a browser, an OS deep link natively). */
44
+ export interface AgentDeepLinkSource {
45
+ /** The pending agent id at boot, or `null`. */
46
+ current(): string | null;
47
+ /** Fires for each later request while the app is open. Returns the unsubscribe. */
48
+ subscribe(listener: (agentId: string) => void): () => void;
49
+ /** Called after a target was applied or rejected, so it is not applied again. */
50
+ consume(): void;
51
+ }
52
+ export interface HostLaunch {
53
+ /** Read once at boot. `null` means no intent: show the connection fields, do not connect. */
54
+ initialConnect(): ConnectIntent | null;
55
+ agentDeepLink: AgentDeepLinkSource;
56
+ }
57
+ /**
58
+ * Where `connect()` dials, decided from what the user typed or pasted: a direct daemon address, or
59
+ * a relay-routed pairing link with the daemon's public key.
60
+ */
61
+ export type ConnectTarget = {
62
+ mode: "direct";
63
+ url: string;
64
+ } | {
65
+ mode: "relay";
66
+ url: string;
67
+ daemonPublicKey: Uint8Array;
68
+ };
69
+ /** `setTimeout`/`clearTimeout` equivalents for the SDK's `ReconnectionManager`. */
70
+ export interface HostTimers {
71
+ setTimer(cb: () => void, ms: number): unknown;
72
+ clearTimer(handle: unknown): void;
73
+ }
74
+ export interface HostConnection {
75
+ /**
76
+ * The transport `DaemonClient` uses for one `connect()`, or `undefined` for the SDK's default
77
+ * WebSocket. A foreign transport (e.g. a Rust-owned socket) MUST deliver frames in wire order and
78
+ * binary frames as `ArrayBuffer`. Throwing fails that `connect()` with the error.
79
+ */
80
+ createTransport(target: ConnectTarget, options: {
81
+ password?: string;
82
+ }): Transport | undefined;
83
+ /** Passed to `ReconnectionManager`. Must keep firing while the window is hidden. */
84
+ timers: HostTimers;
85
+ /**
86
+ * Fires when a stale connection may need checking (window visible again, network back, machine
87
+ * woke). The workbench decides what to do. Returns the unsubscribe.
88
+ */
89
+ onResume(listener: () => void): () => void;
90
+ }
91
+ /**
92
+ * Something to upload. Opaque to the workbench, which reads only `name` (the target file name) and
93
+ * `size`. The browser's `File` satisfies it. Sources the workbench creates itself (a generated
94
+ * structure file) are always `File`s, so every host must accept a `Blob`; a native host may also
95
+ * accept its own kind (e.g. a local path from its file picker).
96
+ */
97
+ export interface UploadSource {
98
+ readonly name: string;
99
+ readonly size?: number;
100
+ }
101
+ /** A daemon file a viewer can display by URL. */
102
+ export interface ViewableFile {
103
+ /** Loadable by `<img>`, `<video>`, `fetch()` and pdf.js. */
104
+ url: string;
105
+ mimeType?: string;
106
+ fileName?: string;
107
+ /** Frees whatever backs `url`. Idempotent; the workbench calls it once the URL is unused. */
108
+ release(): void;
109
+ }
110
+ /** Optional extras the workbench passes to `files.upload`. A host may ignore them. */
111
+ export interface UploadOptions {
112
+ /**
113
+ * Bytes handed to the transport so far, and the source's total when known. Called as the upload
114
+ * runs (monotonic, possibly many times per second); the explorer turns it into a percentage.
115
+ */
116
+ onProgress?(sent: number, total?: number): void;
117
+ }
118
+ export interface HostFiles {
119
+ /**
120
+ * Upload `source` to `<dir>/<source.name>` on the daemon. Resolves only once the daemon has
121
+ * confirmed the file is written (with a daemon that advertises `fileTransferAck`; an older daemon
122
+ * resolves when the bytes have left the machine). Rejects with the daemon's reason on failure.
123
+ */
124
+ upload(dir: string, source: UploadSource, options?: UploadOptions): Promise<void>;
125
+ /** Copy the daemon file at `path` to the user's machine (save dialog, downloads folder). */
126
+ saveToDisk(path: string): Promise<void>;
127
+ /** Make the daemon file at `path` displayable by URL. */
128
+ openForView(path: string): Promise<ViewableFile>;
129
+ /** Optional native picker. Absent: the workbench uses an `<input type="file">`. */
130
+ pickUploads?(): Promise<UploadSource[]>;
131
+ }
132
+ /**
133
+ * pdf.js runtime pieces only an application bundle can provide: a worker built from the
134
+ * application's own `pdfjs-dist` (same version as the workbench's), and the URL its data
135
+ * directories are served from (`@av-pi-studio/workbench/vite`'s `pdfjsAssetsPlugin`).
136
+ */
137
+ export interface HostPdf {
138
+ createWorker(): Worker;
139
+ /** Where `cmaps/`, `standard_fonts/`, `wasm/` and `iccs/` live. Relative URLs resolve against
140
+ * the document; a trailing slash is optional. */
141
+ assetBaseUrl: string;
142
+ }
143
+ /**
144
+ * The one object an embedding shell supplies to the workbench for everything browser-bound
145
+ * (`swe/architecture/workbench-host-adapter.md`). `web-client` passes `createBrowserHost(...)`; a
146
+ * desktop shell passes its own implementation. Members are added as the call sites move behind it.
147
+ */
148
+ export interface WorkbenchHost {
149
+ app: AppIdentity;
150
+ /**
151
+ * **Synchronous** by contract: stores read it during initialisation. Never throws; a failed
152
+ * write is dropped. A host with asynchronous storage loads into memory before the first render
153
+ * and writes behind.
154
+ */
155
+ storage: KeyValueStore;
156
+ clipboard: HostClipboard;
157
+ dialogs: HostDialogs;
158
+ links: HostLinks;
159
+ launch: HostLaunch;
160
+ connection: HostConnection;
161
+ files: HostFiles;
162
+ /**
163
+ * Optional. The PDF viewer's runtime. Absent: opening a PDF shows the viewer's error state with
164
+ * its Download action.
165
+ */
166
+ pdf?: HostPdf;
167
+ }
168
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `@av-pi-studio/workbench` — the supported API (`swe/architecture/workbench-package.md` § Public
3
+ * contract). Everything not exported here is private and may change without notice.
4
+ */
5
+ export { Workbench } from "./shell/Workbench.js";
6
+ export { WorkbenchProvider, type WorkbenchProviderProps } from "./shell/WorkbenchProvider.js";
7
+ export { WorkbenchBoot } from "./shell/WorkbenchBoot.js";
8
+ export { WorkspaceShell } from "./shell/WorkspaceShell.js";
9
+ export { ConnectionBar, OpenWorkspaceDialog, PaneArea, RightSidebar, SessionList, SettingsDialog, type SettingsDialogProps, StatusBar, } from "./shell/regions.js";
10
+ export { type SidebarLayout, useConnection, useSettingsDialog, useShellLayout, type WorkbenchConnection, } from "./shell/hooks.js";
11
+ export { type ConnectOptions } from "./lib/connection/connection-store.js";
12
+ export { createBrowserHost, type BrowserHostOptions } from "./host/browser-host.js";
13
+ export type { AgentDeepLinkSource, AppIdentity, ConnectIntent, ConnectTarget, HostClipboard, HostConnection, HostDialogs, HostFiles, HostLaunch, HostLinks, HostPdf, HostTimers, UploadSource, ViewableFile, WorkbenchHost, } from "./host/types.js";
14
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ import { a0 as e, a1 as o, a2 as r, a3 as t, a4 as n, a5 as i, a6 as c, a7 as l, a8 as S, a9 as g, aa as h, ab as b, ac as k, ad as u, ae as W } from "./chunks/index-Dlz8mEKZ.js";
2
+ export {
3
+ e as ConnectionBar,
4
+ o as OpenWorkspaceDialog,
5
+ r as PaneArea,
6
+ t as RightSidebar,
7
+ n as SessionList,
8
+ i as SettingsDialog,
9
+ c as StatusBar,
10
+ l as Workbench,
11
+ S as WorkbenchBoot,
12
+ g as WorkbenchProvider,
13
+ h as WorkspaceShell,
14
+ b as createBrowserHost,
15
+ k as useConnection,
16
+ u as useSettingsDialog,
17
+ W as useShellLayout
18
+ };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Agent deep link (`#agent=<urlencoded agentId>`, swe/features/web-ui-agent-deep-link.md): pure
3
+ * fragment grammar + URL cleanup, kept free of `window` so plain-Node vitest can prove every rule.
4
+ */
5
+ /** The first decoded `agent` value of a URL fragment; empty or over-long values are absent. */
6
+ export declare function parseAgentDeepLink(hash: string): string | undefined;
7
+ /**
8
+ * The same URL with every `agent` key removed from the fragment. Other fragment keys keep their
9
+ * order and raw encoding, the query string is untouched, and an emptied fragment drops the `#`.
10
+ */
11
+ export declare function stripAgentParam(href: string): string;
12
+ /** Effects of applying a deep link, injected so Node tests can drive `applyAgentDeepLink`. */
13
+ export interface AgentDeepLinkDeps<S extends {
14
+ id: string;
15
+ cwd?: string;
16
+ }> {
17
+ consume(): string | undefined;
18
+ findByAgentId(agentId: string): S | undefined;
19
+ select(session: S): void;
20
+ notifyNotFound(agentId: string): void;
21
+ /** Mark the host's deep-link source consumed (the browser strips `agent=` from the URL). */
22
+ consumeSource(): void;
23
+ }
24
+ /** Consume the pending target and select it, or report it unknown; then consume the source. */
25
+ export declare function applyAgentDeepLink<S extends {
26
+ id: string;
27
+ cwd?: string;
28
+ }>(deps: AgentDeepLinkDeps<S>): void;
29
+ //# sourceMappingURL=agent-deep-link.d.ts.map
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Connection store — Zustand wrapper around `DaemonClient` + `PiStudioClient`
3
+ * (@av-pi-studio/client). Replaces the POC's raw `WebSocket`/`doConnect()`/`rpc()` globals
4
+ * (POC_TO_APP_PLAN_UI.md §4.1). The socket itself comes from the host
5
+ * (`host.connection.createTransport`); no workbench code outside the browser host builds one.
6
+ */
7
+ import { DaemonClient, PiStudioClient, ReconnectionManager, type ConnectionState } from "@av-pi-studio/client";
8
+ import type { ServerInfoPayload } from "@av-pi-studio/protocol";
9
+ export interface ConnectOptions {
10
+ /**
11
+ * Daemon address, OR a full pairing link (`https://app.pi-studio.sh/#offer=...`) copied from
12
+ * `pi-studio daemon pair`. A pairing link is detected via {@link parsePairingUrl} and switches
13
+ * this connection to the relay transport automatically — see {@link connectViaPairingOffer}.
14
+ * Otherwise accepts `ws://`/`wss://`, `http://`/`https://` (mapped to `ws`/`wss`), or a bare
15
+ * `host[:port]` (assumed `ws://`), normalized via {@link normalizeDaemonUrl}.
16
+ */
17
+ url: string;
18
+ /** Bearer password, sent via the `pi-studio.bearer.<pw>` WS subprotocol. Ignored for a pairing-link (relay) connection — the pairing link's public key is itself the credential. */
19
+ password?: string;
20
+ /** Stable per-tab client id; generated once if omitted. */
21
+ clientId?: string;
22
+ }
23
+ interface ConnectionStoreState {
24
+ status: ConnectionState;
25
+ serverInfo: ServerInfoPayload | null;
26
+ error: string | null;
27
+ /** Non-null once `connect()` has ever succeeded — the live SDK handles. */
28
+ daemon: DaemonClient | null;
29
+ client: PiStudioClient | null;
30
+ reconnection: ReconnectionManager | null;
31
+ connect(opts: ConnectOptions): Promise<void>;
32
+ disconnect(): void;
33
+ }
34
+ export declare const useConnectionStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ConnectionStoreState>>;
35
+ /** Convenience selector: the live `PiStudioClient`, or `null` when disconnected. */
36
+ export declare function useClient(): PiStudioClient | null;
37
+ /** Convenience selector: current connection lifecycle state. */
38
+ export declare function useConnectionStatus(): ConnectionState;
39
+ /**
40
+ * The daemon host's home directory as reported in `server_info` (`homeDir`), or `null` when it is
41
+ * unknown — no connection yet, or a daemon predating the field. The imperative counterpart to
42
+ * `hooks/use-home-dir.ts`, for the non-React restore paths.
43
+ *
44
+ * Never derive this client-side: the browser may run on macOS (`/Users/<me>`) against a Linux
45
+ * daemon (`/home/<me>`) or vice versa, and only the daemon's own value expands a `~` cwd correctly.
46
+ */
47
+ export declare function daemonHomeDir(): string | null;
48
+ export {};
49
+ //# sourceMappingURL=connection-store.d.ts.map
@@ -0,0 +1,41 @@
1
+ /**
2
+ * `filesChanged` signal — invalidates the file/diff/explorer query caches after a completed
3
+ * write/edit/shell tool call (POC `scheduleFileRefresh`/`reloadOpenFileTabs`, chat.html
4
+ * ~line 1070-1092, POC_TO_APP_PLAN_UI.md §4.3/§4.5/§5). Debounced ~500ms to coalesce a burst of
5
+ * tool completions (POC used `setTimeout(...,600)`/`400`).
6
+ *
7
+ * As of task-006/008, the daemon ALSO pushes `file_changed` directly for any expanded directory
8
+ * (`use-explorer-watch.ts`, a real `fs.watch`-backed daemon push) — covering non-agent filesystem
9
+ * changes (an external editor, a shell command run outside the tool-call path, `git` in a
10
+ * pi-studio terminal) that this debounced post-tool invalidation cannot see at all, since it only
11
+ * fires from the timeline reducer's own `tool_call` completions. This module remains as the
12
+ * belt-and-braces path for two things directory watching does NOT cover: it also invalidates
13
+ * `["file"]` *content* queries (an open text tab's read cache), and it covers a tool completion
14
+ * even when the affected directory happens not to be expanded in the tree right now. The daemon's
15
+ * 150ms coalescing (task-006) sits well under this module's 500ms debounce, so the two paths
16
+ * cannot thrash each other.
17
+ *
18
+ * The daemon does NOT push a `checkout_status_update` automatically after a git-affecting tool
19
+ * completion, so this module also fires an explicit `checkout_refresh_request` for the active
20
+ * cwd — `ChangesPanel`/`FileExplorer` then pick up the resulting push/refetch reactively, since
21
+ * they're already subscribed (`use-checkout-status.ts`) or query-cache-driven (`use-explorer.ts`).
22
+ *
23
+ * NOTE (follow-up, cross-slice): this module only *exports* the invalidation function. The actual
24
+ * call site — wiring this into the timeline reducer's `tool_call` handling on `status:"completed"`
25
+ * for `toolMutatesFiles(tool) === true` — belongs to the chat/session-store slice (built in
26
+ * parallel) or the top-level app wiring; do not import/call it from `timeline/reducer.ts` here,
27
+ * that file is a shared contract file owned across slices.
28
+ */
29
+ import type { QueryClient } from "@tanstack/react-query";
30
+ import type { PiStudioClient } from "@av-pi-studio/client";
31
+ /**
32
+ * Invalidate file/diff/explorer TanStack Query caches and refresh git status for `cwd`.
33
+ * Debounced: repeated calls within `DEBOUNCE_MS` coalesce into a single invalidation pass.
34
+ *
35
+ * `toolFilePath` is accepted for future path-scoped invalidation (POC `reloadOpenFileTabs`
36
+ * matched by path suffix) but the current pass invalidates the whole `file`/`explorer` query
37
+ * families — TanStack Query dedupes refetches for inactive queries, so this is cheap and correct
38
+ * even when the path is unknown.
39
+ */
40
+ export declare function invalidateAfterToolCompletion(queryClient: QueryClient, client: PiStudioClient | null, cwd: string | null, _toolFilePath: string | null): void;
41
+ //# sourceMappingURL=files-changed.d.ts.map