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

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,20 @@
1
+ /**
2
+ * `use-explorer-tree` — one TanStack Query per expanded directory path (POC_TO_APP_PLAN_UI.md
3
+ * §4.7 tree-view follow-up). `FileExplorer`'s `explorer-store` tracks *which* paths are expanded;
4
+ * this hook fetches each of them (via the same `file_explorer_request` + `rpcKeys.explorer` cache
5
+ * `use-explorer.ts` uses for the single-path case, so results are shared/deduped) and hands back a
6
+ * lookup keyed by path for `flattenTree` (`features/files/file-tree.ts`) to walk into rows.
7
+ *
8
+ * Collapsing a directory drops it from `expanded`, so its query stops being requested here — but
9
+ * TanStack Query keeps the cached entry around under `rpcKeys.explorer(path)`, so re-expanding is
10
+ * instant until the cache is invalidated (`filesChanged`, an upload, a delete, ...).
11
+ */
12
+ import { type ExplorerListing } from "./use-explorer.js";
13
+ export interface ExplorerTreeEntry {
14
+ listing: ExplorerListing | undefined;
15
+ isLoading: boolean;
16
+ isError: boolean;
17
+ error: unknown;
18
+ }
19
+ export declare function useExplorerTree(expanded: Set<string>): Map<string, ExplorerTreeEntry>;
20
+ //# sourceMappingURL=use-explorer-tree.d.ts.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * `use-explorer-watch` — keeps the file tree live: subscribes each expanded directory to daemon
3
+ * `file_changed` pushes (task-006's `FileWatchService`, a directory target — no basename filter,
4
+ * so a child being created/deleted/renamed/modified all notify) and invalidates exactly that
5
+ * directory's `rpcKeys.explorer(path)` query when one arrives. Reuses the `file_watch_subscribe`/
6
+ * `file_watch_unsubscribe` RPCs from task-006 as-is — a directory is just another target, no new
7
+ * RPC needed.
8
+ *
9
+ * The actual diff/subscribe/route/dispose logic lives in `createExplorerWatcher`, a plain
10
+ * framework-free factory (mirrors task-007's `watchFile` extraction) — this repo has no jsdom/DOM
11
+ * test environment configured, so it is the seam `use-explorer-watch.test.ts` exercises directly
12
+ * with a fake client + a real `QueryClient`, rather than mounting the hook.
13
+ *
14
+ * Diffs `expanded` across calls to `sync` — subscribes newly-expanded paths, unsubscribes
15
+ * collapsed ones, leaves unchanged ones alone — rather than tearing down and resubscribing the
16
+ * whole set every time, which would churn every watcher on the daemon for a single `Set` identity
17
+ * change. The hook memoizes the diff key as `Array.from(expanded).toSorted().join("\0")`; sorting
18
+ * is THIS hook's own requirement — `use-explorer-tree.ts`'s own `Array.from(expanded)` preserves
19
+ * `Set` insertion order and is not sorted, so two logically-identical sets can produce different
20
+ * arrays there.
21
+ *
22
+ * One `onSessionMessage` handler per watcher (not one per subscribed path), matching pushes
23
+ * against the currently-subscribed set. `too_many_watches` (task-006's per-session cap) is a soft
24
+ * failure: that one directory stays unwatched (falls back to `invalidateAfterToolCompletion`'s
25
+ * existing post-tool debounce) rather than throwing or retrying.
26
+ */
27
+ import type { PiStudioClient } from "@av-pi-studio/client";
28
+ export interface ExplorerWatcher {
29
+ /** Diff `expanded` against the currently-held subscription set and subscribe/unsubscribe
30
+ * accordingly. Safe to call repeatedly with the same set — a no-op diff issues zero RPCs. */
31
+ sync(expanded: ReadonlySet<string>): void;
32
+ /** Detach the message handler and unsubscribe every currently-held path. */
33
+ dispose(): void;
34
+ }
35
+ /** Framework-free core: owns one `onSessionMessage` handler and the set of directories currently
36
+ * subscribed, calling `onChanged(path)` for a push matching one of them. */
37
+ export declare function createExplorerWatcher(client: Pick<PiStudioClient, "connection">, onChanged: (path: string) => void): ExplorerWatcher;
38
+ export declare function useExplorerWatch(expanded: Set<string>): void;
39
+ //# sourceMappingURL=use-explorer-watch.d.ts.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * `use-explorer` — TanStack Query wrapper over `file_explorer_request` (POC `loadFiles`,
3
+ * POC_TO_APP_PLAN_UI.md §4.7 / §3 `hooks/use-explorer.ts`). Directory listings are read-through
4
+ * cached, keyed by resolved path — components resolve `~` via `resolveTildePath` before calling.
5
+ */
6
+ import type { PiStudioClient } from "@av-pi-studio/client";
7
+ export interface ExplorerEntry {
8
+ name: string;
9
+ kind: "file" | "directory" | "symlink" | "other";
10
+ size?: number;
11
+ mtimeMs?: number;
12
+ }
13
+ export interface ExplorerListing {
14
+ path: string;
15
+ entries: ExplorerEntry[];
16
+ }
17
+ /** Shared fetch — used by both the single-path `useExplorer` and the multi-path tree query
18
+ * (`useExplorerTree`, one TanStack Query per expanded directory). */
19
+ export declare function fetchExplorerListing(client: PiStudioClient, path: string): Promise<ExplorerListing>;
20
+ export declare function useExplorer(path: string, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<NoInfer<ExplorerListing>, Error>;
21
+ //# sourceMappingURL=use-explorer.d.ts.map
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The pane's side of a sidebar-to-pane drag: preview while an external drag is over a pane body, and
3
+ * the open-or-move dispatch on release. `use-pane-drag.ts` is the dnd-kit counterpart for drags that
4
+ * start on a tab already in a strip; `features/workspace/external-drag.ts` documents why this half is
5
+ * native HTML5 DnD instead.
6
+ *
7
+ * The dispatch has two shapes, and what separates them is whether the dragged thing already has a tab:
8
+ *
9
+ * ||centre drop|edge drop|
10
+ * |---|---|---|
11
+ * |already open|`moveTab`|`splitWithTab`|
12
+ * |not open yet|`open(tab, pane)`|`splitEmpty` then `open(tab, newPane)`|
13
+ *
14
+ * The already-open row deliberately routes through the *same* store calls an internal tab drag makes,
15
+ * rather than re-`open`ing the tab: `tab-store.open` short-circuits to `activate` for an id that
16
+ * already exists (ignoring `targetPaneId`), and the internal path is also where the no-op guards live
17
+ * — dragging a chat from the sidebar onto the pane its tab already occupies must do nothing, exactly
18
+ * as dragging its tab there does.
19
+ *
20
+ * `activeTabId` needs no manual resync here: it is a projection, and `tab-store`'s subscription on the
21
+ * layout store follows every layout mutation, including these.
22
+ *
23
+ * This hook also owns the app-wide iframe drag guard (`lib/drag-guard.ts`), mounted here because it
24
+ * is where a native drag's document-level lifecycle is already understood — it applies to the
25
+ * dnd-kit half too, which arms it from its own callbacks.
26
+ *
27
+ * swe/features/workspace-split-panes.md § Drop regions, § Splitting
28
+ */
29
+ import { type DragEvent, type RefObject } from "react";
30
+ import { type ExternalDragPayload } from "../features/workspace/external-drag.js";
31
+ import { type DropOutcome, type DropRegion } from "../features/workspace/pane-dnd.js";
32
+ export declare function paneDropProps(paneId: string): Record<string, string>;
33
+ export interface ExternalPaneDrop {
34
+ /** The outcome a release right now would produce, or `null` when no external drag is over a pane. */
35
+ preview: DropOutcome | null;
36
+ onDragOver(event: DragEvent<HTMLElement>): void;
37
+ onDragLeave(event: DragEvent<HTMLElement>): void;
38
+ onDrop(event: DragEvent<HTMLElement>): void;
39
+ }
40
+ /**
41
+ * Apply a resolved external drop. Exported for direct unit testing — this project's vitest config runs
42
+ * `.test.ts` under a plain Node environment with no DOM, so the hook is verified by smoke test while
43
+ * this, which is all of the behaviour, is driven directly.
44
+ */
45
+ export declare function applyExternalDrop(payload: ExternalDragPayload, cwd: string, paneId: string, region: DropRegion, homeDir: string | null): void;
46
+ export declare function useExternalPaneDrop(cwd: string | null, hostRef: RefObject<HTMLElement | null>): ExternalPaneDrop;
47
+ //# sourceMappingURL=use-external-pane-drop.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `use-file-diff` — TanStack Query wrapper over `file_diff_request` (POC `loadDiffContent`,
3
+ * POC_TO_APP_PLAN_UI.md §4.5 / §3 `hooks/use-file-diff.ts`).
4
+ */
5
+ export interface FileDiffResult {
6
+ patch: string;
7
+ }
8
+ export declare function useFileDiff(path: string, cwd: string, staged: boolean, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<NoInfer<FileDiffResult>, Error>;
9
+ //# sourceMappingURL=use-file-diff.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * `use-file-download` — TanStack Query wrapper that makes a daemon file displayable by URL, for
3
+ * viewers that need raw bytes rather than the UTF-8 preview `file_read_request` returns (images,
4
+ * video, PDF, molecules, large text). The URL comes from the host's `files.openForView` (browser: a
5
+ * `Blob` object URL over the chunked binary download). Each URL is released once superseded by a
6
+ * new one or once this consumer unmounts.
7
+ */
8
+ export interface FileDownload {
9
+ objectUrl: string;
10
+ mimeType?: string;
11
+ fileName?: string;
12
+ /** Frees `objectUrl`. Owned by this hook; consumers never call it. */
13
+ release(): void;
14
+ }
15
+ /** Release `previous` when `next` supersedes it. Returns what to remember as current. */
16
+ export declare function supersedeDownload(previous: FileDownload | null, next: FileDownload | null): FileDownload | null;
17
+ export declare function useFileDownload(path: string, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<NoInfer<FileDownload>, Error>;
18
+ //# sourceMappingURL=use-file-download.d.ts.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * `use-file-live-refresh` — watches a file tab's OWN file (via `useFileWatch`/`watchFile`) and
3
+ * invalidates that path's content queries on every `file_changed` push, so a `kind:"file"` or
4
+ * `kind:"diff"` tab refetches from disk within ~1s of an external change — an editor, a shell
5
+ * command, a build step, or `git` run in a terminal — not just a Pi tool call completing
6
+ * (`lib/connection/files-changed.ts`'s existing debounced post-tool-call invalidation, which stays
7
+ * as the belt-and-braces path for files nobody has open).
8
+ *
9
+ * `LIVE_REFRESH_KINDS` is the scope gate: `"text"`, `"markdown"`, `"image"`, `"html"` and `"pdf"`
10
+ * tabs watch. `"video"` is excluded because a refetch mints a new object URL, which restarts
11
+ * playback from zero mid-watch; `"binary"` fetches nothing at all until the user clicks its
12
+ * Download button, so there is nothing to refresh. The set is derived from the viewer registry at
13
+ * module load and enforced by the type — a new `ViewerKind` cannot silently inherit a default.
14
+ */
15
+ import type { ViewerKind } from "../features/files/viewer-registry.js";
16
+ /**
17
+ * Invalidates `path`'s `fileRead`/`fileDownload`/`fileDiffByPath` queries on every `file_changed`
18
+ * push for the WATCHED (resolved absolute) target — these differ for a diff tab, which is why
19
+ * both `path` and `cwd` are taken separately. All three keys are invalidated unconditionally: a
20
+ * watched tab can be showing any of them (`fileRead` → `TextViewer` tier 1 + `MarkdownFileViewer`;
21
+ * `fileDownload` → `ImageViewer` and `TextViewer`'s tier-2 streamed source; `fileDiffByPath` →
22
+ * `DiffView`, reachable from both tab kinds through `FilePanel`'s File/Diff toggle). Invalidating a
23
+ * key with no live query is a no-op, so only *whether to watch* branches on `viewerKind`, never
24
+ * the invalidation list.
25
+ *
26
+ * No client-side debounce: the daemon already coalesces at `FILE_WATCH_COALESCE_MS` (150ms). A
27
+ * deleted file pushes too — the refetch then fails and the viewer shows its existing error state,
28
+ * which is the correct observable outcome; no special-casing.
29
+ */
30
+ export declare function useFileLiveRefresh(path: string, cwd: string, viewerKind: ViewerKind): void;
31
+ //# sourceMappingURL=use-file-live-refresh.d.ts.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * `use-file-read` — TanStack Query wrapper over `file_read_request` (POC `loadFileContent`,
3
+ * POC_TO_APP_PLAN_UI.md §4.5 / §3 `hooks/use-file-read.ts`).
4
+ */
5
+ export interface FileReadResult {
6
+ content: string;
7
+ size: number;
8
+ }
9
+ /** Thrown by `useFileRead` when the server rejects a read with `error: "file_too_large"`
10
+ * (`file_read_response`, `MAX_INLINE_FILE_READ_BYTES` server-side). Carries `size` and the
11
+ * server's own `maxBytes` ceiling so a caller can render an accurate message and decide whether
12
+ * to fall back to the streaming path (`use-file-text.ts`) instead of just displaying the string
13
+ * `"file_too_large"`. */
14
+ export declare class FileTooLargeError extends Error {
15
+ readonly size: number;
16
+ readonly maxBytes?: number;
17
+ constructor(size: number, maxBytes?: number);
18
+ }
19
+ export interface FileReadRpcResponse {
20
+ ok: boolean;
21
+ content?: string;
22
+ size?: number;
23
+ maxBytes?: number;
24
+ error?: string;
25
+ }
26
+ /** Maps a raw `file_read_response` into a result or a thrown error — pure, so the
27
+ * `file_too_large` classification (the actual behavior change in this task) is directly
28
+ * unit-testable without a connected client or React. */
29
+ export declare function parseFileReadResponse(response: FileReadRpcResponse): FileReadResult;
30
+ export declare function useFileRead(path: string, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<NoInfer<FileReadResult>, Error>;
31
+ //# sourceMappingURL=use-file-read.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * `use-file-source` — shared three-tier file-source loader for text-shaped viewers (`TextViewer`,
3
+ * `MarkdownFileViewer`, and — sprint-063 task-003 — the HTML viewer).
4
+ *
5
+ * Composes `useFileRead` (tier 1: inline JSON read, capped at the server's
6
+ * `MAX_INLINE_FILE_READ_BYTES`), `useFileText` (tier 2: chunked binary download + UTF-8 decode,
7
+ * for files up to `MAX_DISPLAY_BYTES`) and, above that, a too-large state whose only action is
8
+ * saving the file through the host (`SaveFileButton`) around the pure, DOM-free tier selector in `text-viewer-state.ts` — the
9
+ * same decision core `TextViewer` used before this hook existed, now shared so every text-shaped
10
+ * viewer gets the same ladder instead of failing outright above the inline cap.
11
+ */
12
+ import { type TextViewerState } from "../features/files/text-viewer-state.js";
13
+ /** Display ceiling above the inline cap — see `text-viewer-state.ts`'s doc comment for why. */
14
+ export declare const MAX_DISPLAY_BYTES: number;
15
+ export declare function useFileSource(path: string, enabled?: boolean): TextViewerState;
16
+ //# sourceMappingURL=use-file-source.d.ts.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * `use-file-text` — tier-2 fallback for `TextViewer` (task-009): decodes a file's bytes to UTF-8
3
+ * text via the already-uncapped chunked binary download path (`useFileDownload` →
4
+ * `file_download_token_request`/`file_download_request`), for files over `file_read_request`'s
5
+ * inline cap (`MAX_INLINE_FILE_READ_BYTES`, `packages/server/src/files/limits.ts`). Same
6
+ * transport the molecule viewer uses for its own (binary-safe) source — no new RPC, no new
7
+ * transport, just a text decode over the resulting blob.
8
+ *
9
+ * Note the daemon asymmetry documented on `useFileDownload`'s own RPCs: the download path is
10
+ * registered only in the production bootstrap (`bootstrap.ts`), not `dev-bootstrap.ts`. Under
11
+ * `npm run dev:daemon` a file above the inline cap fails this fetch rather than rendering — that
12
+ * surfaces as the normal error state below, which is the intended behavior (see task-009 notes).
13
+ *
14
+ * The loading/error/data merge across the two dependent queries (download → decode) is the pure,
15
+ * DOM-free `mergeFileTextState` (`file-text-state.ts`) — this hook is a thin wrapper feeding it
16
+ * live query state.
17
+ */
18
+ import { type FileTextResult } from "./file-text-state.js";
19
+ export type { FileTextResult };
20
+ export declare function useFileText(path: string, enabled?: boolean): import("./file-text-state.js").FileTextQueryState;
21
+ //# sourceMappingURL=use-file-text.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * `use-file-transfer` — imperative upload + save-to-disk actions for the Files sidebar
3
+ * (features/file-explorer-transfer.md § Binary transfer frames). Unlike `use-file-download`
4
+ * (which produces view URLs for inline viewers), these are one-shot user-triggered actions; both go
5
+ * through the host's `files` member.
6
+ */
7
+ import { type QueryClient } from "@tanstack/react-query";
8
+ import { type UploadOptions, type UploadSource } from "../host/types.js";
9
+ export interface FileTransferActions {
10
+ /** Upload one source to `<dir>/<source.name>` on the daemon, then refresh the explorer. */
11
+ upload(dir: string, source: UploadSource, options?: UploadOptions): Promise<void>;
12
+ /** Copy `path` from the daemon to the user's machine. */
13
+ saveToDisk(path: string): Promise<void>;
14
+ }
15
+ /** The hook's upload, outside React: host upload, then an explorer refresh. */
16
+ export declare function uploadAndRefresh(queryClient: Pick<QueryClient, "invalidateQueries">, dir: string, source: UploadSource, options?: UploadOptions): Promise<void>;
17
+ export declare function useFileTransfer(): FileTransferActions;
18
+ //# sourceMappingURL=use-file-transfer.d.ts.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * `use-file-watch` — subscribes to live daemon `file_changed` pushes for a path (task-006's
3
+ * `FileWatchService`), structurally mirroring `use-checkout-status.ts`: subscribe on mount/path
4
+ * change via `file_watch_subscribe`, route matching pushes through `onSessionMessage`, and on
5
+ * cleanup detach the message handler AND send `file_watch_unsubscribe` for the path being left —
6
+ * `use-checkout-status.ts`'s own header comment calls out that leaving either half undone is the
7
+ * leak this pattern exists to avoid.
8
+ *
9
+ * The actual subscribe/route/cleanup wiring lives in `watchFile`, a plain function with no React
10
+ * dependency (mirrors `molecule-source.ts`/`molecule-reload.ts`'s "extract the testable core"
11
+ * convention) — this repo has no DOM test environment set up, so it is the seam
12
+ * `use-file-watch.test.ts` exercises directly with a fake client rather than mounting the hook.
13
+ *
14
+ * A `null` path (an empty "+"-menu molecule tab, or the absence of a client) subscribes nothing.
15
+ *
16
+ * `watchFile` ref-counts subscriptions per `(client, path)` in a module-level registry (mirrors
17
+ * `file-transfer-instance.ts`'s `WeakMap<DaemonClient, …>` shared-instance convention): more than
18
+ * one component can watch the same file (a file tab and a diff tab on the same path) and share
19
+ * ONE daemon watch, rather than the second `file_watch_unsubscribe` killing it for both — the
20
+ * daemon's `SessionSubscriptions.add` disposes any existing entry for the same resolved-path key.
21
+ * The entry also remembers the RESOLVED path echoed back by `file_watch_subscribe_response.path`
22
+ * (the daemon expands a leading `~` server-side before pushing `file_changed`), and matches a
23
+ * push against either the requested spelling or that resolved path.
24
+ */
25
+ import type { PiStudioClient } from "@av-pi-studio/client";
26
+ /** Subscribes `path` on `client.connection`, calls `onChanged` for every matching `file_changed`
27
+ * push, and returns a cleanup function that detaches the handler AND sends
28
+ * `file_watch_unsubscribe` for `path` once the LAST subscriber for that `(client, path)` pair
29
+ * releases it. Framework-agnostic on purpose — see module header. */
30
+ export declare function watchFile(client: Pick<PiStudioClient, "connection">, path: string, onChanged: (changedAt: number) => void): () => void;
31
+ export interface UseFileWatchResult {
32
+ /** Monotonic timestamp of the last `file_changed` push for this path; `null` if none yet. */
33
+ changedAt: number | null;
34
+ }
35
+ export declare function useFileWatch(path: string | null): UseFileWatchResult;
36
+ //# sourceMappingURL=use-file-watch.d.ts.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Reactively exposes the daemon host's home directory, so `~`-relative session `cwd`s can be
3
+ * normalized against their absolute form for workspace grouping (§4.3 sidebar tree) and the
4
+ * workspace picker can seed itself somewhere that actually exists.
5
+ *
6
+ * The value is whatever the daemon reported in `server_info.homeDir` — never derived locally. It
7
+ * used to be *probed* (list `/home`, take the first directory), which produced a nonexistent
8
+ * `/home/<name>` against a macOS daemon whose real home is `/Users/<name>`.
9
+ *
10
+ * `null` means "not known yet / daemon predates the field"; every consumer treats that as "leave
11
+ * tilde paths unexpanded" rather than guessing.
12
+ */
13
+ export declare function useHomeDir(): string | null;
14
+ //# sourceMappingURL=use-home-dir.d.ts.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * `use-inline-image` — fetches (via the shared ref-counted `inline-image-cache`) and hands back
3
+ * a view URL (host `files.openForView`) for an inline chat image (features/inline-image-rendering.md § Inline image fetch
4
+ * + cache). Consumed by the markdown `img` node override (task-004) once a `classifyImageSrc`
5
+ * result is `local`.
6
+ *
7
+ * Deliberately NOT a TanStack Query hook, and therefore no `rpcKeys` entry: the whole point of
8
+ * `inline-image-cache.ts` is a retention policy (revoke only on LRU eviction, never on unmount)
9
+ * that Query's cache cannot express. Do not "fix" this into a `useQuery` — see that module's
10
+ * header for why.
11
+ *
12
+ * `loadInlineImage` is the actual effect body, extracted for direct unit testing without
13
+ * rendering — this package has no jsdom/React-Testing-Library environment (`AGENTS.md`'s testing
14
+ * convention; mirrors `use-file-watch.ts`'s `watchFile` extraction).
15
+ */
16
+ import { type ViewableFile } from "../host/types.js";
17
+ export type InlineImageState = {
18
+ status: "idle";
19
+ } | {
20
+ status: "loading";
21
+ } | {
22
+ status: "ready";
23
+ objectUrl: string;
24
+ } | {
25
+ status: "error";
26
+ message: string;
27
+ };
28
+ /**
29
+ * Runs one effect cycle: `open === null` (no live connection, or no path) is the idle case —
30
+ * nothing to acquire, nothing to clean up. Otherwise acquires `path`, reports the loading →
31
+ * ready/error transition via `onStateChange`, and returns a cleanup that releases the path and
32
+ * ignores a resolution that lands after it (the `cancelled` flag pattern used across the existing
33
+ * hooks, e.g. `use-checkout-status.ts`).
34
+ */
35
+ export declare function loadInlineImage(path: string | null, open: ((path: string) => Promise<ViewableFile>) | null, onStateChange: (state: InlineImageState) => void): (() => void) | void;
36
+ export declare function useInlineImage(path: string | null): InlineImageState;
37
+ //# sourceMappingURL=use-inline-image.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `useIsCompacting` — true while this session is compacting, from either source: a `started`
3
+ * compaction row in its timeline (`isCompactionPending` — covers automatic compactions and other
4
+ * clients' manual ones, via the stream) or this client's own in-flight compact RPC
5
+ * (`compaction-store`'s local pending flag — the only signal against a daemon without
6
+ * `compactionEvents`). The single selector the meter and composer gate on.
7
+ */
8
+ export declare function useIsCompacting(sessionId: string | null): boolean;
9
+ //# sourceMappingURL=use-is-compacting.d.ts.map
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The single drag gesture that spans every pane: reorder inside a strip, move to another strip, and
3
+ * split by dropping on a pane body's edge.
4
+ *
5
+ * One `DndContext` (owned by `TabPanelHost`) is a hard requirement, not a preference — a gesture
6
+ * cannot begin in one drag system and finish in another, so strips and bodies must be droppables of
7
+ * the same context. This hook owns everything that context needs: sensors, collision ranking, the
8
+ * live preview, and the drop dispatch.
9
+ *
10
+ * Three droppable kinds, ranked in that order by `collisionDetection`:
11
+ *
12
+ * |`data.type`|Registered by|Drop meaning|
13
+ * |---|---|---|
14
+ * |`tab`|`TabStrip`'s `useSortable`|move (if cross-pane) + reorder at that tab's position|
15
+ * |`strip`|`TabStrip`'s `useDroppable`|move into that pane, appended last|
16
+ * |`pane`|`TabPanelHost`'s body zone|edge → split; centre → move into the pane|
17
+ *
18
+ * The preview and the drop read ONE already-degraded region (`pane-dnd.effectiveDropRegion`), so what
19
+ * the user sees is what happens — including when an illegal edge degrades to a whole-pane move.
20
+ *
21
+ * swe/features/workspace-split-panes.md § Drop regions, § Resolving a drop region,
22
+ * § Splitting, § UI Behavior
23
+ */
24
+ import { type CollisionDetection, type DragEndEvent, type DragMoveEvent, type DragStartEvent, type SensorDescriptor, type SensorOptions } from "@dnd-kit/core";
25
+ import { type DropOutcome } from "../features/workspace/pane-dnd.js";
26
+ import { type Tab } from "../stores/tab-store.js";
27
+ export interface PaneDrag {
28
+ sensors: SensorDescriptor<SensorOptions>[];
29
+ collisionDetection: CollisionDetection;
30
+ onDragStart(event: DragStartEvent): void;
31
+ onDragMove(event: DragMoveEvent): void;
32
+ onDragEnd(event: DragEndEvent): void;
33
+ onDragCancel(): void;
34
+ /** The tab being dragged, for the floating drag chip. */
35
+ draggedTab: Tab | null;
36
+ /** What the drop would do, or `null` when it would do nothing (no target, or a no-op drop). */
37
+ preview: DropOutcome | null;
38
+ }
39
+ export declare function usePaneDrag(cwd: string | null): PaneDrag;
40
+ //# sourceMappingURL=use-pane-drag.d.ts.map
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Pane-layout boot: install the persisted pane geometry, wire the write triggers, and flush on
3
+ * `pagehide`.
4
+ *
5
+ * Ordering matters and is the reason this is a hook rather than a module side effect. The persisted
6
+ * geometry must be installed *before* the restore hooks open their first tab, because every arrival
7
+ * consumes its pane claim on the way in (`layout-store.claimPaneFor`) — a tab that arrives before
8
+ * the claims exist lands in the default pane and the layout is lost. Both restore hooks only fire
9
+ * once the connection reports `open`, i.e. a later commit than this mount effect, so "install first"
10
+ * holds without any coordination between them.
11
+ *
12
+ * The record also carries the **client-side** tabs — files, diffs, molecule views — which no daemon
13
+ * inventory can rebuild, so `reopenClientTabs` replays them. That replay waits for the connection to
14
+ * report `open`, even though it needs no RPC of its own: reopening tabs is what brings a workspace
15
+ * into view, and doing it at mount put a full split layout with file tabs on screen behind the
16
+ * connect form, before there was any daemon to load them from. Restoring the UI is only meaningful
17
+ * once there is a daemon behind it, which is the same rule the two daemon restores follow.
18
+ *
19
+ * It still runs before either of them: all three effects live in one component (`app.tsx`'s `Boot`),
20
+ * so they fire in hook-declaration order within the same commit, and this one is declared first.
21
+ * Once per page load, not per connection — the tabs stay open across a reconnect, and replaying would
22
+ * re-activate them and yank the user's focus.
23
+ *
24
+ * `installPaneLayoutPersistence` is wired *after* the install so it does not schedule a write of the
25
+ * state it just read. Writes that land before hydration settles are safe regardless: they preserve
26
+ * unconsumed claims (see `pane-layout-persistence.ts`'s `writePaneLayout`).
27
+ *
28
+ * swe/features/workspace-split-panes.md § Restoring a persisted layout
29
+ */
30
+ /**
31
+ * Whether the replay effect should run now. Pure — extracted for direct unit testing (no jsdom
32
+ * test environment in this repo; `hooks/file-text-state.ts`'s identical rationale). The replay
33
+ * waits on BOTH `status === "open"` and `loaded` (the viewer-settings store's hydration flag): a
34
+ * persisted `molecule:<path>` identity must not race the settings fetch and reopen as a molecule
35
+ * tab the user disabled. `replayed` makes it a one-shot regardless of how many times either input
36
+ * changes afterward.
37
+ */
38
+ export declare function shouldReplayPaneLayout(status: string, viewerSettingsLoaded: boolean, replayed: boolean): boolean;
39
+ export declare function usePaneLayoutBoot(): void;
40
+ //# sourceMappingURL=use-pane-layout.d.ts.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `use-provider-auth-list` — TanStack Query wrapper over `listProviderAuth()` (sprint-065),
3
+ * shared by `ModelProvidersPanel` (task-003, the settings list) and the chat empty-state
4
+ * onboarding nudge (task-006) under one query key (`rpcKeys.providerAuthList()`). A login or
5
+ * logout in either surface invalidates the single cached query, so both update together with no
6
+ * reload and no second fetch path — mirrors `use-provider-models.ts`/`use-file-diff.ts`'s
7
+ * existing RPC-query convention.
8
+ */
9
+ export declare function useProviderAuthList(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<NoInfer<import("zod").objectOutputType<{
10
+ id: import("zod").ZodString;
11
+ name: import("zod").ZodString;
12
+ authTypes: import("zod").ZodArray<import("zod").ZodEnum<["api_key", "oauth"]>, "many">;
13
+ oauthLoginLabel: import("zod").ZodOptional<import("zod").ZodString>;
14
+ oauthIsSubscription: import("zod").ZodOptional<import("zod").ZodBoolean>;
15
+ configured: import("zod").ZodUnion<[import("zod").ZodBoolean, import("zod").ZodLiteral<"unknown">]>;
16
+ configuredType: import("zod").ZodOptional<import("zod").ZodEnum<["api_key", "oauth"]>>;
17
+ configuredSource: import("zod").ZodOptional<import("zod").ZodString>;
18
+ }, import("zod").ZodTypeAny, "passthrough">[]>, Error>;
19
+ //# sourceMappingURL=use-provider-auth-list.d.ts.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `use-provider-models` — TanStack Query wrapper over `list_provider_models`
3
+ * (`client.providers.listModels`, sprint-043). Read-through cached by `[provider, agentId]`: a
4
+ * subsequent open of the model picker shows the cached list immediately (`isLoading: false`)
5
+ * while a background refetch keeps it current, instead of re-showing a loading spinner every
6
+ * time — mirrors `use-file-diff.ts`/`use-explorer.ts`'s existing RPC-query convention.
7
+ *
8
+ * `agentId` scopes the list to that agent: when it has a live process the daemon answers from it,
9
+ * since Pi reads `models.json` once per process and a fresh discovery can offer a model that
10
+ * agent's `set_model` rejects ("Model not found") after the file was edited.
11
+ */
12
+ import type { ProviderModel } from "@av-pi-studio/client";
13
+ export declare function useProviderModels(provider: string, agentId: string | null | undefined, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<NoInfer<ProviderModel[]>, Error>;
14
+ //# sourceMappingURL=use-provider-models.d.ts.map
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Session restore — on a fresh `open` connection, fetches known agents
3
+ * (`list_agents_request`) and hydrates each into the session store from its authoritative
4
+ * timeline (`fetch_agent_timeline_request`). Ports POC `restoreSessions()`/`onConnected()`
5
+ * (POC_TO_APP_PLAN_UI.md §4.3 "Session restore"). Live agent-stream subscription for restored
6
+ * sessions is wired by `ChatPanel`'s `useAgentStream` once its tab mounts, keyed off `agentId` —
7
+ * no `expectingAgent` race, since `agentId` is always known before subscribing.
8
+ *
9
+ * A daemon reporting zero agents restores nothing: `activeWorkspaceCwd` stays `null` and the UI
10
+ * renders its no-workspace empty state (`TabPanelHost`) — this hook never auto-creates a session.
11
+ * Every known agent restores, including an idle, never-used draft (eager materialization,
12
+ * `materialize.ts`, `tab-store.ts`'s `openNewChat`) that survives to the next connect because its
13
+ * tab was never explicitly closed — it is a real persisted session the instant it materializes,
14
+ * not a phantom the UI should hide; only an explicit close (`closeTab`'s `discardIfEmpty`) or an
15
+ * explicit delete removes it.
16
+ */
17
+ import type { AgentUpdateMessage, PiStudioClient } from "@av-pi-studio/client";
18
+ /** Exported for direct unit testing — this project's vitest config runs `.test.ts` under a plain
19
+ * Node environment (no DOM), so hooks with effects are verified by smoke test (task-007) rather
20
+ * than rendered; this narrow type guard is the one piece of the listener worth a direct test. */
21
+ export declare function hasStringModel(msg: AgentUpdateMessage): msg is AgentUpdateMessage & {
22
+ model: string;
23
+ };
24
+ /** Sprint-070: the `agent_update` listener below only reacts to broadcasts that carry a
25
+ * `thinkingLevel` — same narrow type-guard convention as `hasStringModel`. */
26
+ export declare function hasStringThinkingLevel(msg: AgentUpdateMessage): msg is AgentUpdateMessage & {
27
+ thinkingLevel: string;
28
+ };
29
+ /** Sprint auto-titling: the `agent_update` listener below only reacts to broadcasts that carry a
30
+ * `title` — same narrow type-guard convention as `hasStringModel`. Applies to BOTH the daemon's
31
+ * auto-generated title (`agent-service.ts`'s `maybeGenerateTitle`) and a rename from another
32
+ * connected client (`agent_set_session_name_request`) — this listener is what makes a rename in
33
+ * one window appear live in every other window, which previously only updated locally. */
34
+ export declare function hasStringTitle(msg: AgentUpdateMessage): msg is AgentUpdateMessage & {
35
+ title: string;
36
+ };
37
+ export declare function useSessionRestore(): void;
38
+ /**
39
+ * The one-shot restore body plus its hydration signal. Exported for direct unit testing — this
40
+ * project's vitest config runs `.test.ts` under a plain Node environment (no DOM), so the hook
41
+ * itself is verified by smoke test while this is driven directly.
42
+ */
43
+ export declare function runSessionRestore(client: PiStudioClient): Promise<void>;
44
+ //# sourceMappingURL=use-session-restore.d.ts.map
@@ -0,0 +1,40 @@
1
+ /**
2
+ * `use-session-stats` — polls `agent_session_stats_request` (SDK `client.agent(id).sessionStats()`)
3
+ * for one session's context/token/cost usage and poll-reconciled model, writing into `stats-store`
4
+ * (sprint-042). This data is **pull-only**: no `AgentStreamEvent` kind carries context/token/cost
5
+ * (see `agentStreamEventSchema` in `@av-pi-studio/protocol`), so there is no push channel to react
6
+ * to — a poll is the only option.
7
+ *
8
+ * Poll triggers:
9
+ * - once when a session with a bound `agentId` becomes the argument (mount / session switch /
10
+ * agent bound after create),
11
+ * - every `POLL_INTERVAL_MS` as a backstop while that stays true,
12
+ * - immediately when the session's `status` transitions away from `"running"` — a proxy for
13
+ * `turn_completed`/`turn_failed`/`turn_canceled` that avoids a second raw `agent_stream`
14
+ * subscription: `agent-stream-events.ts` already drives exactly that status transition off those
15
+ * stream events, so watching `SessionEntry.status` here is equivalent and simpler.
16
+ *
17
+ * A session with no `agentId` yet (a fresh, never-run chat) polls nothing — there is no agent to
18
+ * ask. Failures (unsupported provider, no live session right now) are swallowed; the previous
19
+ * cached value in `stats-store` is left untouched rather than cleared, so a transient failure
20
+ * never blanks the status bar.
21
+ */
22
+ import type { AgentSessionStatsResponse, AgentStatus } from "@av-pi-studio/protocol";
23
+ type SessionStatus = AgentStatus | "idle" | undefined;
24
+ /** True exactly when a turn just ended: `prev` was `"running"` and `next` no longer is. Pure —
25
+ * exported for direct unit testing without rendering the hook. */
26
+ export declare function shouldRepollOnStatusChange(prev: SessionStatus, next: SessionStatus): boolean;
27
+ /** Maps the RPC payload onto `stats-store`'s flatter `SessionStats` shape, writing only fields the
28
+ * payload actually carries — `setStats`'s merge treats an explicit `undefined` value as "clear
29
+ * this field", not "leave it alone" (object spread doesn't distinguish an absent key from one set
30
+ * to `undefined`), so a poll response that omits e.g. `cost` must never wipe a previously known
31
+ * cost. Also reconciles `session-store`'s `model` — the status bar's model *segment* reads
32
+ * `SessionEntry.model` (seeded by create/restore, updated live by `agent_update`), not
33
+ * `stats-store`, so the poll must write through to keep that value authoritative (design intent:
34
+ * "stats poll authoritative + agent_update for instant feedback" — a payload `model` this session
35
+ * never learned any other way, e.g. right after `/model` cycle, must still reach the segment).
36
+ * Exported for direct unit testing without rendering the hook. */
37
+ export declare function applySessionStats(sessionId: string, payload: AgentSessionStatsResponse["payload"]): void;
38
+ export declare function useSessionStats(sessionId: string | null): void;
39
+ export {};
40
+ //# sourceMappingURL=use-session-stats.d.ts.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Global keymap: Ctrl/Cmd+T new terminal, Ctrl/Cmd+W close active tab, Esc close overlays
3
+ * (POC `document.addEventListener("keydown", …)`, POC_TO_APP_PLAN_UI.md §4.8).
4
+ */
5
+ export declare function useShortcuts(): void;
6
+ //# sourceMappingURL=use-shortcuts.d.ts.map