@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,143 @@
1
+ import { useQuery as u } from "@tanstack/react-query";
2
+ import { u as g, r as d } from "./index-Dlz8mEKZ.js";
3
+ import { u as m } from "./use-file-download-CogCqTvU.js";
4
+ import { jsx as a } from "react/jsx-runtime";
5
+ import { useState as E, useEffect as p } from "react";
6
+ import w from "@uiw/react-codemirror";
7
+ import { EditorView as L } from "@codemirror/view";
8
+ import { languages as y } from "@codemirror/language-data";
9
+ import { foldGutter as h, LanguageDescription as x } from "@codemirror/language";
10
+ import { githubDark as k } from "@uiw/codemirror-theme-github";
11
+ function F(o) {
12
+ const { maxDisplayBytes: n, inline: r, streamed: e } = o;
13
+ if (r.isLoading) return { kind: "loading" };
14
+ if (r.tooLarge) {
15
+ const { size: t } = r.tooLarge;
16
+ return t > n ? { kind: "too-large", size: t, maxDisplayBytes: n } : e.isLoading ? { kind: "streaming", size: t } : e.isError ? { kind: "stream-error", size: t, message: e.errorMessage ?? "stream failed" } : e.content !== null ? { kind: "streamed", size: t, content: e.content } : { kind: "loading" };
17
+ }
18
+ return r.isError ? { kind: "error", message: r.errorMessage ?? "unknown error" } : r.content !== null ? { kind: "inline", content: r.content } : { kind: "loading" };
19
+ }
20
+ class f extends Error {
21
+ size;
22
+ maxBytes;
23
+ constructor(n, r) {
24
+ super("file_too_large"), this.name = "FileTooLargeError", this.size = n, this.maxBytes = r;
25
+ }
26
+ }
27
+ function _(o) {
28
+ if (!o.ok)
29
+ throw o.error === "file_too_large" ? new f(o.size ?? 0, o.maxBytes) : new Error(o.error ?? "file read failed");
30
+ return { content: o.content ?? "", size: o.size ?? 0 };
31
+ }
32
+ function B(o, n = !0) {
33
+ const r = g((e) => e.client);
34
+ return u({
35
+ queryKey: d.fileRead(o),
36
+ queryFn: async () => {
37
+ if (!r) throw new Error("not connected");
38
+ const e = await r.connection.request("file_read_request", {
39
+ path: o
40
+ });
41
+ return _(e);
42
+ },
43
+ enabled: !!r && !!o && n
44
+ });
45
+ }
46
+ function b(o) {
47
+ const { enabled: n, download: r, decode: e } = o;
48
+ return {
49
+ isLoading: n && (r.isLoading || r.hasObjectUrl && e.isLoading),
50
+ isError: r.isError || e.isError,
51
+ error: r.isError ? r.error : e.error,
52
+ data: e.data
53
+ };
54
+ }
55
+ function z(o, n = !0) {
56
+ const r = m(o, n), e = r.data?.objectUrl, t = u({
57
+ queryKey: d.fileText(o, e ?? null),
58
+ queryFn: async () => ({ content: await (await fetch(e)).text() }),
59
+ enabled: n && !!e
60
+ });
61
+ return b({
62
+ enabled: n,
63
+ download: {
64
+ isLoading: r.isLoading,
65
+ isError: r.isError,
66
+ error: r.error,
67
+ hasObjectUrl: !!e
68
+ },
69
+ decode: {
70
+ isLoading: t.isLoading,
71
+ isError: t.isError,
72
+ error: t.error,
73
+ data: t.data
74
+ }
75
+ });
76
+ }
77
+ const l = 30 * 1024 * 1024;
78
+ function O(o, n = !0) {
79
+ const r = B(o, n), e = r.error instanceof f ? r.error : null, t = e !== null && e.size <= l, i = z(o, n && t);
80
+ return F({
81
+ maxDisplayBytes: l,
82
+ inline: {
83
+ isLoading: r.isLoading,
84
+ isError: r.isError,
85
+ tooLarge: e ? { size: e.size } : null,
86
+ errorMessage: r.error instanceof Error ? r.error.message : null,
87
+ content: r.data?.content ?? null
88
+ },
89
+ streamed: {
90
+ isLoading: i.isLoading,
91
+ isError: i.isError,
92
+ errorMessage: i.error instanceof Error ? i.error.message : null,
93
+ content: i.data?.content ?? null
94
+ }
95
+ });
96
+ }
97
+ const S = "piwb-CodeView_wrap_U_8I0", M = {
98
+ wrap: S
99
+ }, c = /* @__PURE__ */ new Map();
100
+ function T(o) {
101
+ const [n, r] = E(null);
102
+ return p(() => {
103
+ const e = x.matchFilename(y, o);
104
+ if (!e) {
105
+ r(null);
106
+ return;
107
+ }
108
+ const t = c.get(e.name);
109
+ if (t) {
110
+ r(t);
111
+ return;
112
+ }
113
+ let i = !1;
114
+ return r(null), e.load().then((s) => {
115
+ c.set(e.name, s), i || r(s);
116
+ }), () => {
117
+ i = !0;
118
+ };
119
+ }, [o]), n ? [n] : [];
120
+ }
121
+ function G({ path: o, content: n }) {
122
+ const r = T(o), e = [L.lineWrapping, h(), ...r];
123
+ return /* @__PURE__ */ a("div", { className: M.wrap, children: /* @__PURE__ */ a(
124
+ w,
125
+ {
126
+ value: n,
127
+ theme: k,
128
+ extensions: e,
129
+ editable: !1,
130
+ readOnly: !0,
131
+ basicSetup: {
132
+ highlightActiveLine: !1,
133
+ foldGutter: !1,
134
+ searchKeymap: !1
135
+ },
136
+ height: "100%"
137
+ }
138
+ ) });
139
+ }
140
+ export {
141
+ G as C,
142
+ O as u
143
+ };
@@ -0,0 +1,48 @@
1
+ import { jsx as r, jsxs as o } from "react/jsx-runtime";
2
+ import { clsx as h } from "clsx";
3
+ const u = "piwb-DiffView_diffView_rEVwC", p = "piwb-DiffView_hunkHeader_sH95D", w = "piwb-DiffView_line_oc4jh", _ = "piwb-DiffView_add_7J_YQ", x = "piwb-DiffView_del_G6y_E", k = "piwb-DiffView_ctx_69dDP", m = "piwb-DiffView_ln_f6IO9", s = {
4
+ diffView: u,
5
+ hunkHeader: p,
6
+ line: w,
7
+ add: _,
8
+ del: x,
9
+ ctx: k,
10
+ ln: m
11
+ }, D = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
12
+ function V(d) {
13
+ const f = d.split(`
14
+ `), i = [];
15
+ let t = 0, n = 0;
16
+ for (const e of f) {
17
+ if (e.startsWith("diff --git")) {
18
+ i.push({ kind: "hunk-header", text: e });
19
+ continue;
20
+ }
21
+ if (!(e.startsWith("index ") || e.startsWith("---") || e.startsWith("+++"))) {
22
+ if (e.startsWith("@@")) {
23
+ const c = D.exec(e);
24
+ if (c) {
25
+ const a = c[1], l = c[2];
26
+ t = (a ? parseInt(a, 10) : 1) - 1, n = (l ? parseInt(l, 10) : 1) - 1;
27
+ }
28
+ i.push({ kind: "hunk-header", text: e });
29
+ continue;
30
+ }
31
+ e.startsWith("+") ? (n++, i.push({ kind: "add", text: e, lineNumber: n })) : e.startsWith("-") ? (t++, i.push({ kind: "del", text: e, lineNumber: t })) : (t++, n++, i.push({ kind: "ctx", text: e, lineNumber: n }));
32
+ }
33
+ }
34
+ return i;
35
+ }
36
+ function H({ patch: d }) {
37
+ const f = V(d);
38
+ return /* @__PURE__ */ r("div", { className: s.diffView, children: f.map(
39
+ (i, t) => i.kind === "hunk-header" ? /* @__PURE__ */ r("div", { className: s.hunkHeader, children: i.text }, t) : /* @__PURE__ */ o("div", { className: h(s.line, s[i.kind]), children: [
40
+ /* @__PURE__ */ r("span", { className: s.ln, children: i.lineNumber ?? "" }),
41
+ i.text
42
+ ] }, t)
43
+ ) });
44
+ }
45
+ export {
46
+ H as D,
47
+ V as p
48
+ };
@@ -0,0 +1,92 @@
1
+ import { jsxs as l, jsx as s } from "react/jsx-runtime";
2
+ import { useEffect as _, useState as m, Suspense as F } from "react";
3
+ import { clsx as b } from "clsx";
4
+ import { Panel as D, Button as g, EmptyState as d, Spinner as w } from "@av-pi-studio/ui-library";
5
+ import { useQuery as E, useQueryClient as k } from "@tanstack/react-query";
6
+ import { u as P, r as f, L as K, H as q, I as z, V as C, J as N } from "./index-Dlz8mEKZ.js";
7
+ import { u as S } from "./use-file-watch-Bb_Xzbr-.js";
8
+ import { D as V } from "./DiffView-BqDuT3CF.js";
9
+ function x(e, o, r, i = !0) {
10
+ const a = P((n) => n.client);
11
+ return E({
12
+ queryKey: f.fileDiff(e, o, r),
13
+ queryFn: async () => {
14
+ if (!a) throw new Error("not connected");
15
+ return { patch: (await a.connection.request("file_diff_request", {
16
+ path: e,
17
+ cwd: o,
18
+ staged: r
19
+ })).patch ?? "" };
20
+ },
21
+ enabled: !!a && !!e && !!o && i
22
+ });
23
+ }
24
+ function B(e, o, r) {
25
+ const i = k(), a = K.has(r) ? q(e, o) : null, { changedAt: n } = S(a);
26
+ _(() => {
27
+ n !== null && (i.invalidateQueries({ queryKey: f.fileRead(e) }), i.invalidateQueries({ queryKey: f.fileDownload(e) }), i.invalidateQueries({ queryKey: f.fileDiffByPath(e) }));
28
+ }, [n, e, i]);
29
+ }
30
+ const L = "piwb-FilePanel_header_pSFCG", Q = "piwb-FilePanel_path_m6M0a", T = "piwb-FilePanel_size_GFAJ5", G = "piwb-FilePanel_viewToggle_ckgXe", I = "piwb-FilePanel_body_GGGk5", c = {
31
+ header: L,
32
+ path: Q,
33
+ size: T,
34
+ viewToggle: G,
35
+ body: I
36
+ };
37
+ function y(e) {
38
+ return "path" in e;
39
+ }
40
+ function R(e) {
41
+ return "staged" in e;
42
+ }
43
+ function O({ tab: e }) {
44
+ const o = e.kind === "diff", r = e.data, i = y(r) ? r.path : "", a = y(r) && R(r) ? r.staged : !1, [n, h] = m(o ? "diff" : "file"), u = e.workspaceCwd || "~", [p] = m(() => z(i, N));
45
+ B(i, u, p);
46
+ const t = x(i, u, a, n === "diff"), v = C[p];
47
+ return /* @__PURE__ */ l(D, { children: [
48
+ /* @__PURE__ */ l("div", { className: c.header, children: [
49
+ /* @__PURE__ */ s("span", { className: c.path, children: i }),
50
+ /* @__PURE__ */ s("span", { className: c.size, children: n === "diff" ? a ? "staged" : "unstaged" : null }),
51
+ /* @__PURE__ */ l("div", { className: c.viewToggle, children: [
52
+ /* @__PURE__ */ s(
53
+ g,
54
+ {
55
+ size: "xs",
56
+ variant: n === "file" ? "default" : "ghost",
57
+ onClick: () => h("file"),
58
+ children: "File"
59
+ }
60
+ ),
61
+ /* @__PURE__ */ s(
62
+ g,
63
+ {
64
+ size: "xs",
65
+ variant: n === "diff" ? "default" : "ghost",
66
+ onClick: () => h("diff"),
67
+ children: "Diff"
68
+ }
69
+ )
70
+ ] })
71
+ ] }),
72
+ /* @__PURE__ */ s("div", { className: b(c.body, "file-body"), children: n === "file" ? /* @__PURE__ */ s(
73
+ F,
74
+ {
75
+ fallback: /* @__PURE__ */ l(d, { children: [
76
+ /* @__PURE__ */ s(w, { size: "sm" }),
77
+ " Loading..."
78
+ ] }),
79
+ children: /* @__PURE__ */ s(v, { path: i, workspaceCwd: u })
80
+ }
81
+ ) : t.isLoading ? /* @__PURE__ */ l(d, { children: [
82
+ /* @__PURE__ */ s(w, { size: "sm" }),
83
+ " Loading diff..."
84
+ ] }) : t.isError ? /* @__PURE__ */ l(d, { children: [
85
+ "Error: ",
86
+ t.error instanceof Error ? t.error.message : "unknown error"
87
+ ] }) : t.data?.patch ? /* @__PURE__ */ s(V, { patch: t.data.patch }) : /* @__PURE__ */ s(d, { style: { padding: "var(--pi-spacing-30)" }, children: "No changes (file matches HEAD)" }) })
88
+ ] });
89
+ }
90
+ export {
91
+ O as FilePanel
92
+ };