@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,242 @@
1
+ import { jsxs as K, jsx as U } from "react/jsx-runtime";
2
+ import { useRef as c, useState as j, useEffect as m } from "react";
3
+ import { Terminal as ie } from "@xterm/xterm";
4
+ import { FitAddon as ue } from "@xterm/addon-fit";
5
+ import "@xterm/xterm/css/xterm.css";
6
+ import { TerminalStreamRouter as le } from "@av-pi-studio/client";
7
+ import { u as ae, v as fe, K as de, M as Z, N as me, m as pe } from "./index-Dlz8mEKZ.js";
8
+ import { baseFontSize as we, TERMINAL_FONT_STACK as J, useAppearance as Se, Spinner as he } from "@av-pi-studio/ui-library";
9
+ const Re = 3e3, ee = `${we.sm}px ${J}`, te = "M";
10
+ function ne() {
11
+ if (typeof document > "u" || !document.fonts) return !0;
12
+ try {
13
+ return document.fonts.check(ee, te);
14
+ } catch {
15
+ return !0;
16
+ }
17
+ }
18
+ const ve = (async () => {
19
+ if (typeof document > "u" || !document.fonts || ne()) return;
20
+ let n;
21
+ try {
22
+ await Promise.race([
23
+ document.fonts.load(ee, te),
24
+ new Promise((e) => {
25
+ n = window.setTimeout(e, Re);
26
+ })
27
+ ]);
28
+ } catch {
29
+ } finally {
30
+ window.clearTimeout(n);
31
+ }
32
+ })(), ye = 2, Te = 1;
33
+ function S(n) {
34
+ if (n == null) return !1;
35
+ const { cols: e, rows: r } = n;
36
+ return typeof e == "number" && Number.isInteger(e) && e >= ye && typeof r == "number" && Number.isInteger(r) && r >= Te;
37
+ }
38
+ function be(n, e) {
39
+ return n === null || e === null ? n === e : n.cols === e.cols && n.rows === e.rows;
40
+ }
41
+ function _e(n, e) {
42
+ return S(n) ? !be(n, e) : !1;
43
+ }
44
+ function ge(n, e) {
45
+ if (e === null) return;
46
+ const r = n.find((z) => z.slot === e);
47
+ if (!r) return;
48
+ const p = { cols: r.cols, rows: r.rows };
49
+ return S(p) ? p : void 0;
50
+ }
51
+ const Fe = "piwb-TerminalPanel_wrap_ZIi6f", Ae = "piwb-TerminalPanel_terminal_WkMQ7", ze = "piwb-TerminalPanel_statusOverlay_Y2lKF", Ne = "piwb-TerminalPanel_exitedBanner_0Ptov", A = {
52
+ wrap: Fe,
53
+ terminal: Ae,
54
+ statusOverlay: ze,
55
+ exitedBanner: Ne
56
+ }, Oe = 64 * 1024, Y = new TextEncoder(), $ = /* @__PURE__ */ new WeakMap();
57
+ function Me(n) {
58
+ let e = $.get(n);
59
+ return e || (e = new le(n), e.start(), $.set(n, e)), e;
60
+ }
61
+ function Q(n) {
62
+ const e = Z.getState(), r = e.tabs.find((p) => p.id === n);
63
+ return !r || r.workspaceCwd !== e.activeWorkspaceCwd ? !1 : me(pe.getState().layouts[r.workspaceCwd], n);
64
+ }
65
+ function Ce({ tab: n }) {
66
+ const e = n.data, r = ae((t) => t.client), p = fe(n.id), { settings: z, resolvedTheme: h } = Se(), P = z.monoFont && z.monoFont.trim() !== "" ? h.fontFamily.mono : J, H = c(null), w = c(null), R = c(null), v = c(e.slot), N = c(null), O = c([]), M = c(0), _ = c(null), re = c(null), E = c(null), y = c(null), g = c(null), k = c(!1), V = c(null), X = c(r);
67
+ X.current = r;
68
+ const B = c(e.exited ?? !1);
69
+ B.current = e.exited ?? !1;
70
+ const [T, oe] = j(e.slot), [D, I] = j({ isAttaching: !0, error: null }), [q, se] = j(ne);
71
+ m(() => {
72
+ if (q) return;
73
+ let t = !1;
74
+ return ve.then(() => {
75
+ t || se(!0);
76
+ }), () => {
77
+ t = !0;
78
+ };
79
+ }, [q]);
80
+ const C = () => {
81
+ const t = R.current?.proposeDimensions();
82
+ E.current?.(S(t) ? t : null);
83
+ }, ce = () => {
84
+ g.current = null, k.current = !0, R.current?.fit(), C(), requestAnimationFrame(() => {
85
+ k.current = !1;
86
+ });
87
+ }, L = () => {
88
+ y.current !== null && window.clearTimeout(y.current), y.current = window.setTimeout(() => {
89
+ y.current = null, g.current === null && (g.current = requestAnimationFrame(ce));
90
+ }, 60);
91
+ };
92
+ m(() => {
93
+ const t = H.current;
94
+ if (!t || !q) return;
95
+ const o = new ie({
96
+ cursorBlink: !0,
97
+ fontFamily: P,
98
+ // An absolute px number, not a CSS var: xterm measures a cell from the computed style of its
99
+ // own element and cannot resolve a var it was never given. The root font-size is left at the
100
+ // browser default, so a rung's px value renders 1:1. (xterm 5.x renders to the DOM by
101
+ // default — canvas/WebGL are addons this app does not load.) `fontSize.code`, not `.sm`: the
102
+ // spec's "code font size" rung (task-002) — also picks up the appearance font-size setting's
103
+ // scale, unlike the old unscaled `baseFontSize.sm` literal.
104
+ fontSize: h.fontSize.code,
105
+ scrollback: 5e3,
106
+ theme: h.colors.terminal,
107
+ allowProposedApi: !0
108
+ }), i = new ue();
109
+ o.loadAddon(i), o.open(t);
110
+ const s = (l) => {
111
+ if (!Q(n.id)) return;
112
+ const a = v.current, F = N.current;
113
+ a === null || !F || _e(l, _.current) && (_.current = l, F.sendResize(a, l.rows, l.cols));
114
+ }, f = o.onData((l) => {
115
+ if (B.current) return;
116
+ const a = v.current, F = N.current;
117
+ if (a === null || !F) {
118
+ const G = Y.encode(l);
119
+ M.current + G.length <= Oe && (O.current.push(G), M.current += G.length);
120
+ return;
121
+ }
122
+ F.sendInput(a, Y.encode(l));
123
+ }), d = o.onResize(({ cols: l, rows: a }) => {
124
+ s({ cols: l, rows: a });
125
+ }), u = () => {
126
+ i.fit(), C();
127
+ };
128
+ t.addEventListener("focusin", u), i.fit(), w.current = o, R.current = i, E.current = s;
129
+ const x = new ResizeObserver((l) => {
130
+ if (k.current) return;
131
+ const a = l[0];
132
+ a && (a.contentRect.width === 0 || a.contentRect.height === 0) || L();
133
+ });
134
+ return x.observe(t), () => {
135
+ x.disconnect(), y.current !== null && window.clearTimeout(y.current), g.current !== null && cancelAnimationFrame(g.current), t.removeEventListener("focusin", u), f.dispose(), d.dispose(), o.dispose(), w.current = null, R.current = null, E.current = null;
136
+ };
137
+ }, [q]), m(() => {
138
+ const t = w.current;
139
+ if (!t) return;
140
+ t.options.theme = h.colors.terminal;
141
+ const o = h.fontSize.code, i = P, s = V.current, f = s !== null && (s.size !== o || s.family !== i);
142
+ t.options.fontSize = o, t.options.fontFamily = i, V.current = { size: o, family: i }, f && L();
143
+ }, [h, P]), m(() => {
144
+ if (!e.exited) return;
145
+ const t = w.current;
146
+ t && (t.options.cursorBlink = !1, t.blur());
147
+ }, [e.exited]), m(() => {
148
+ if (r)
149
+ return r.connection.onSessionMessage((t) => {
150
+ const o = t;
151
+ if (!de(o)) return;
152
+ const i = ge(o.terminals, v.current);
153
+ i !== void 0 && (_.current = i);
154
+ });
155
+ }, [r]);
156
+ const b = c(!1), W = c(!1);
157
+ return m(() => {
158
+ if (b.current = !0, !r || v.current !== null || W.current)
159
+ return () => {
160
+ b.current = !1;
161
+ };
162
+ W.current = !0;
163
+ const t = e.cwd || "~", o = R.current?.proposeDimensions(), i = S(o) ? o : null;
164
+ return r.connection.request("create_terminal_request", {
165
+ workspaceId: "",
166
+ cwd: t,
167
+ ...i ? { cols: i.cols, rows: i.rows } : {}
168
+ }).then((s) => {
169
+ const f = s.terminal.slot;
170
+ if (!b.current) {
171
+ r.connection.request("kill_terminal_request", { slot: f }).catch(() => {
172
+ });
173
+ return;
174
+ }
175
+ v.current = f, oe(f), Z.getState().updateData(n.id, { slot: f });
176
+ const d = { cols: s.terminal.cols, rows: s.terminal.rows };
177
+ _.current = S(d) ? d : null;
178
+ }).catch((s) => {
179
+ b.current && I({ isAttaching: !1, error: s instanceof Error ? s.message : String(s) });
180
+ }).finally(() => {
181
+ W.current = !1;
182
+ }), () => {
183
+ b.current = !1;
184
+ };
185
+ }, [r, n.id]), m(() => () => {
186
+ const t = v.current;
187
+ t !== null && setTimeout(() => {
188
+ b.current || B.current || X.current?.connection.request("kill_terminal_request", { slot: t }).catch(() => {
189
+ });
190
+ }, 0);
191
+ }, []), m(() => {
192
+ if (!r || T === null) return;
193
+ I({ isAttaching: !0, error: null });
194
+ const t = Me(r.connection);
195
+ N.current = t;
196
+ const o = (u) => {
197
+ w.current?.reset(), w.current?.write(u);
198
+ }, i = t.subscribeSlot(T, {
199
+ onOutput: (u) => w.current?.write(u),
200
+ onSnapshot: o,
201
+ onRestore: o
202
+ });
203
+ let s = !1;
204
+ const f = R.current?.proposeDimensions(), d = S(f) && Q(n.id) ? f : null;
205
+ return r.connection.request("subscribe_terminal_request", {
206
+ slot: T,
207
+ // The exact wire literal terminal-rpc.ts negotiates on (sprint-053/task-004/005) — any
208
+ // other value, including an older client's, is served+echoed back as "basic" by the
209
+ // daemon, so sending this unconditionally is always safe.
210
+ restoreMode: "reflowable",
211
+ ...d ? { cols: d.cols, rows: d.rows } : {}
212
+ }).then((u) => {
213
+ if (s) return;
214
+ I({ isAttaching: !1, error: null }), re.current = u?.restoreMode ?? "basic";
215
+ const x = O.current;
216
+ O.current = [], M.current = 0;
217
+ for (const a of x) t.sendInput(T, a);
218
+ const l = { cols: u?.cols, rows: u?.rows };
219
+ _.current = S(l) ? l : d, C();
220
+ }).catch((u) => {
221
+ s || (O.current = [], M.current = 0, I({ isAttaching: !1, error: u instanceof Error ? u.message : String(u) }));
222
+ }), () => {
223
+ s = !0, i(), N.current = null, r.connection.request("unsubscribe_terminal_request", { slot: T }).catch(() => {
224
+ });
225
+ };
226
+ }, [r, T]), m(() => {
227
+ p && L();
228
+ }, [p]), /* @__PURE__ */ K("div", { className: A.wrap, children: [
229
+ /* @__PURE__ */ U("div", { ref: H, className: A.terminal }),
230
+ D.error ? /* @__PURE__ */ K("div", { className: A.statusOverlay, children: [
231
+ "Terminal error: ",
232
+ D.error
233
+ ] }) : D.isAttaching ? /* @__PURE__ */ K("div", { className: A.statusOverlay, children: [
234
+ /* @__PURE__ */ U(he, { size: "sm" }),
235
+ " Starting terminal…"
236
+ ] }) : null,
237
+ e.exited ? /* @__PURE__ */ U("div", { className: A.exitedBanner, children: "Terminal exited" }) : null
238
+ ] });
239
+ }
240
+ export {
241
+ Ce as TerminalPanel
242
+ };
@@ -0,0 +1,63 @@
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import { EmptyState as o, Panel as d, Spinner as a } from "@av-pi-studio/ui-library";
3
+ import { u as l, C as c } from "./CodeView-6kJms_MF.js";
4
+ import { S as m } from "./SaveFileButton-2rOu02Xx.js";
5
+ const g = "piwb-TextViewer_note_8NLWz", u = "piwb-TextViewer_body_674Gk", y = "piwb-TextViewer_tooLarge_AE_S5", s = {
6
+ note: g,
7
+ body: u,
8
+ tooLarge: y
9
+ };
10
+ function n(i) {
11
+ return `${(i / (1024 * 1024)).toFixed(1)} MB`;
12
+ }
13
+ function b({ path: i }) {
14
+ const e = l(i);
15
+ switch (e.kind) {
16
+ case "loading":
17
+ return /* @__PURE__ */ r(o, { children: [
18
+ /* @__PURE__ */ t(a, { size: "sm" }),
19
+ " Loading..."
20
+ ] });
21
+ case "inline":
22
+ return /* @__PURE__ */ t(c, { path: i, content: e.content });
23
+ case "streaming":
24
+ return /* @__PURE__ */ r(o, { children: [
25
+ /* @__PURE__ */ t(a, { size: "sm" }),
26
+ " Streaming ",
27
+ n(e.size),
28
+ " file..."
29
+ ] });
30
+ case "stream-error":
31
+ return /* @__PURE__ */ r(o, { children: [
32
+ "Error: ",
33
+ e.message
34
+ ] });
35
+ case "streamed":
36
+ return /* @__PURE__ */ r(d, { children: [
37
+ /* @__PURE__ */ r("div", { className: s.note, children: [
38
+ n(e.size),
39
+ " file streamed"
40
+ ] }),
41
+ /* @__PURE__ */ t("div", { className: s.body, children: /* @__PURE__ */ t(c, { path: i, content: e.content }) })
42
+ ] });
43
+ case "too-large":
44
+ return /* @__PURE__ */ t(o, { children: /* @__PURE__ */ r("div", { className: s.tooLarge, children: [
45
+ /* @__PURE__ */ r("div", { children: [
46
+ n(e.size),
47
+ " — too large to display (display ceiling is",
48
+ " ",
49
+ n(e.maxDisplayBytes),
50
+ ")."
51
+ ] }),
52
+ /* @__PURE__ */ t(m, { path: i })
53
+ ] }) });
54
+ case "error":
55
+ return /* @__PURE__ */ r(o, { children: [
56
+ "Error: ",
57
+ e.message
58
+ ] });
59
+ }
60
+ }
61
+ export {
62
+ b as TextViewer
63
+ };
@@ -0,0 +1,20 @@
1
+ import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
+ import { EmptyState as i, Spinner as t } from "@av-pi-studio/ui-library";
3
+ import { u as a } from "./use-file-download-CogCqTvU.js";
4
+ const d = "piwb-VideoViewer_wrap_uRDRg", c = "piwb-VideoViewer_video_e-yEz", n = {
5
+ wrap: d,
6
+ video: c
7
+ };
8
+ function m({ path: s, workspaceCwd: p }) {
9
+ const r = a(s);
10
+ return r.isLoading ? /* @__PURE__ */ o(i, { children: [
11
+ /* @__PURE__ */ e(t, { size: "sm" }),
12
+ " Loading video..."
13
+ ] }) : r.isError ? /* @__PURE__ */ o(i, { children: [
14
+ "Error: ",
15
+ r.error instanceof Error ? r.error.message : "unknown error"
16
+ ] }) : r.data ? /* @__PURE__ */ e("div", { className: n.wrap, children: /* @__PURE__ */ e("video", { className: n.video, src: r.data.objectUrl, controls: !0 }) }) : null;
17
+ }
18
+ export {
19
+ m as VideoViewer
20
+ };
@@ -0,0 +1,50 @@
1
+ import { jsxs as o, jsx as s } from "react/jsx-runtime";
2
+ import { Switch as w } from "@av-pi-studio/ui-library";
3
+ import { a as r } from "./index-Dlz8mEKZ.js";
4
+ const p = "piwb-ViewersPanel_list_-coFH", m = "piwb-ViewersPanel_row_HkMPx", b = "piwb-ViewersPanel_rowMain_WGJdx", f = "piwb-ViewersPanel_name_RIRP4", V = "piwb-ViewersPanel_description_SHFiN", _ = "piwb-ViewersPanel_note_CvJyn", n = {
5
+ list: p,
6
+ row: m,
7
+ rowMain: b,
8
+ name: f,
9
+ description: V,
10
+ note: _
11
+ }, h = [
12
+ {
13
+ id: "molviewer",
14
+ name: "Molecule Viewer",
15
+ description: "Open molecular structure files (.cif, .pdb, .xyz, and similar) in the 3D viewer instead of as plain text."
16
+ },
17
+ {
18
+ id: "pdfviewer",
19
+ name: "PDF Viewer",
20
+ description: "Render PDF files in place instead of offering only a download."
21
+ }
22
+ ];
23
+ function P({ id: a, name: e, description: t }) {
24
+ const l = r((i) => i.capable), c = r((i) => i.isViewerEnabled(a)), d = r((i) => i.setEnabled);
25
+ return /* @__PURE__ */ o("div", { className: n.row, children: [
26
+ /* @__PURE__ */ o("div", { className: n.rowMain, children: [
27
+ /* @__PURE__ */ s("span", { className: n.name, children: e }),
28
+ /* @__PURE__ */ s("span", { className: n.description, children: t })
29
+ ] }),
30
+ /* @__PURE__ */ s(
31
+ w,
32
+ {
33
+ checked: c,
34
+ disabled: !l,
35
+ onCheckedChange: (i) => void d(a, i),
36
+ "aria-label": e
37
+ }
38
+ )
39
+ ] });
40
+ }
41
+ function N() {
42
+ const a = r((e) => e.capable);
43
+ return /* @__PURE__ */ o("div", { className: n.list, children: [
44
+ h.map((e) => /* @__PURE__ */ s(P, { ...e }, e.id)),
45
+ !a && /* @__PURE__ */ s("p", { className: n.note, children: "Requires a newer daemon." })
46
+ ] });
47
+ }
48
+ export {
49
+ N as ViewersPanel
50
+ };
@@ -0,0 +1,25 @@
1
+ import { n as l, H as o, _ as i } from "./index-Dlz8mEKZ.js";
2
+ const u = /^([a-zA-Z][a-zA-Z0-9+.-]*):/;
3
+ function d(n) {
4
+ try {
5
+ return decodeURIComponent(n);
6
+ } catch {
7
+ return n;
8
+ }
9
+ }
10
+ function p(n, a, r) {
11
+ const s = n.trim();
12
+ if (!s) return null;
13
+ const e = s.split(/[?#]/, 1)[0];
14
+ if (!e || u.exec(e))
15
+ return null;
16
+ let t;
17
+ if (e.startsWith("/") ? t = e : e === "~" || e.startsWith("~/") ? t = r ? l(e, r) : null : t = o(e, a ?? ""), !t) return null;
18
+ const c = i(t);
19
+ return d(c);
20
+ }
21
+ export {
22
+ u as S,
23
+ d as p,
24
+ p as r
25
+ };