@uniqbit/mate-core 1.0.0-canary.2 → 1.0.0-canary.5

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 (189) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
  2. package/claude-plugin/hooks/hooks.json +21 -1
  3. package/claude-plugin/hooks/session-attention.mjs +10 -0
  4. package/claude-plugin/hooks/session-end.mjs +9 -0
  5. package/claude-plugin/hooks/session-guidance.mjs +1 -1
  6. package/opencode-plugin/src/server.ts +13 -2
  7. package/opencode-plugin/src/tui.tsx +1 -1
  8. package/opencode-plugin/tui.tsx +2 -1
  9. package/package.json +1 -1
  10. package/src/cli/commands/artifact/delivery/archive.ts +2 -2
  11. package/src/cli/commands/artifact/delivery/link.ts +22 -5
  12. package/src/cli/commands/artifact/delivery/output.ts +9 -1
  13. package/src/cli/commands/artifact/finish/openspec.ts +1 -3
  14. package/src/cli/commands/companion/companion.ts +1 -1
  15. package/src/cli/commands/companion/link.ts +36 -4
  16. package/src/cli/commands/companion/open.ts +40 -12
  17. package/src/cli/commands/doctor.ts +122 -0
  18. package/src/cli/commands/session/prepare.ts +32 -4
  19. package/src/cli/commands/session/registry.ts +90 -0
  20. package/src/cli/commands/studio/companion-removal.ts +79 -0
  21. package/src/cli/commands/studio/mate-inventory.ts +1 -1
  22. package/src/cli/commands/studio/payload.ts +12 -1
  23. package/src/cli/commands/studio/server.ts +39 -16
  24. package/src/cli/commands/studio/services.ts +20 -0
  25. package/src/cli/commands/studio/skill-files.ts +133 -0
  26. package/src/cli/commands/studio/vault.ts +218 -44
  27. package/src/cli/commands/studio/views/model.ts +0 -5
  28. package/src/cli/commands/studio/views/vault/markdown-tree.ts +255 -4
  29. package/src/cli/commands/unwrap.ts +8 -0
  30. package/src/cli/commands/update.ts +26 -8
  31. package/src/cli/commands/vscode/setup.ts +155 -0
  32. package/src/cli/commands/vscode/vsix.ts +73 -0
  33. package/src/cli/commands/working/cleanup.ts +34 -10
  34. package/src/cli/commands/working/worktree.ts +58 -8
  35. package/src/cli/commands/wrap.ts +33 -7
  36. package/src/cli/main.ts +9 -2
  37. package/src/cli/usage.ts +6 -1
  38. package/src/hooks/companion-instructions.ts +19 -11
  39. package/src/hooks/hook-io.ts +15 -0
  40. package/src/hooks/session-banner.ts +5 -3
  41. package/src/hooks/session-end.ts +10 -0
  42. package/src/hooks/session-guidance.ts +10 -6
  43. package/src/hooks/session-prepare.ts +47 -31
  44. package/src/hooks/session-register.ts +199 -0
  45. package/src/hooks/tokensave-route.ts +7 -3
  46. package/src/hooks/validate-artifact-path.ts +9 -2
  47. package/src/lib/delivery/archive-change.ts +0 -1
  48. package/src/lib/delivery/branches.ts +15 -0
  49. package/src/lib/delivery/record-delivery.ts +94 -39
  50. package/src/lib/delivery/record.ts +30 -28
  51. package/src/lib/delivery/refresh.ts +37 -17
  52. package/src/lib/delivery/resolve-branch.ts +258 -37
  53. package/src/lib/factory/outcomes/index.ts +11 -1
  54. package/src/lib/factory/runtime.ts +10 -1
  55. package/src/lib/opencode-server.ts +238 -0
  56. package/src/lib/orchestrator/adapters/claude.ts +147 -2
  57. package/src/lib/orchestrator/adapters/opencode.ts +53 -2
  58. package/src/lib/orchestrator/checkout-adoption.ts +125 -0
  59. package/src/lib/orchestrator/companion-registry-store.ts +6 -2
  60. package/src/lib/orchestrator/editor.ts +2 -2
  61. package/src/lib/orchestrator/framework-context.ts +26 -14
  62. package/src/lib/orchestrator/global-config-store.ts +11 -0
  63. package/src/lib/orchestrator/launcher.ts +15 -2
  64. package/src/lib/orchestrator/projection-claude-links.ts +52 -5
  65. package/src/lib/orchestrator/projection-claude-skills.ts +28 -2
  66. package/src/lib/orchestrator/projection-companion-link.ts +12 -1
  67. package/src/lib/orchestrator/registry-checkouts.ts +177 -0
  68. package/src/lib/orchestrator/repository-link.ts +216 -57
  69. package/src/lib/orchestrator/serving-claude-wrap.ts +43 -0
  70. package/src/lib/orchestrator/session-context-link.ts +11 -5
  71. package/src/lib/orchestrator/session-prepare.ts +36 -6
  72. package/src/lib/orchestrator/types.ts +5 -0
  73. package/src/lib/orchestrator/workspace-inventory.ts +5 -1
  74. package/src/lib/public-npm.ts +17 -0
  75. package/src/lib/session-attribution.ts +52 -0
  76. package/src/lib/session-state.ts +285 -0
  77. package/src/lib/session-stop.ts +64 -0
  78. package/src/lib/workset/record.ts +20 -0
  79. package/src/lib/workset/worktree.ts +85 -17
  80. package/src/opencode/background-server.ts +145 -0
  81. package/src/opencode/companion-hooks.ts +3 -1
  82. package/src/opencode/companion-policy.ts +2 -2
  83. package/src/opencode/projected-guidance.ts +2 -1
  84. package/src/opencode/session-register.ts +176 -0
  85. package/src/opencode/tui.tsx +19 -29
  86. package/src/runtime/claude-delivery-plan.ts +14 -3
  87. package/src/runtime/current-branch.ts +10 -0
  88. package/src/runtime/env.ts +13 -7
  89. package/src/runtime/git-layout.ts +164 -17
  90. package/src/runtime/launch-env-guard.ts +65 -0
  91. package/src/runtime/opencode-server-record.ts +136 -0
  92. package/src/runtime/projection.ts +40 -6
  93. package/src/runtime/repo-local.ts +6 -1
  94. package/src/runtime/serving-claude-wrap.ts +28 -0
  95. package/src/runtime/session-context.ts +4 -3
  96. package/src/runtime/session-registry.ts +434 -0
  97. package/src/runtime/tokensave-route.ts +10 -5
  98. package/src/runtime/wrap-state.ts +31 -0
  99. package/src/studio.ts +2 -0
  100. package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +49 -21
  101. package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +0 -5
  102. package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +2 -8
  103. package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +1 -3
  104. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +2 -4
  105. package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +49 -21
  106. package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +0 -5
  107. package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +2 -8
  108. package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +1 -3
  109. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +2 -4
  110. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +404 -30
  111. package/src/tools/setup/dynamic-plugins/hydrate.ts +4 -3
  112. package/src/tools/setup/providers/claude-plugin-hooks.ts +26 -0
  113. package/src/tools/setup/providers/claude.ts +21 -1
  114. package/studio-dist/client/assets/app-CdPiFv59.css +2 -0
  115. package/studio-dist/client/assets/button-BIIHE0EQ.js +3 -0
  116. package/studio-dist/client/assets/companion-view-DM6YyXaR.js +1 -0
  117. package/studio-dist/client/assets/delivery-path-DELxj0Av.js +1 -0
  118. package/studio-dist/client/assets/factory-BZy0E8ty.js +4 -0
  119. package/studio-dist/client/assets/index-B3wkMzjA.js +40 -0
  120. package/studio-dist/client/assets/markdown-view-pQ2Qp_i5.js +1 -0
  121. package/studio-dist/client/assets/panel-CbajlC3p.js +1 -0
  122. package/studio-dist/client/assets/{prepaint-CD5OpmTM.js → prepaint-CwSrpdFA.js} +7 -4
  123. package/studio-dist/client/assets/react-CN2GSx7x.js +1 -0
  124. package/studio-dist/client/assets/reports-DllhYQ5_.js +1 -0
  125. package/studio-dist/client/assets/routes-COm-G3mK.js +1 -0
  126. package/studio-dist/client/assets/skills-DmWAy-jZ.js +1 -0
  127. package/studio-dist/client/assets/specs-BG3Wi3ln.js +1 -0
  128. package/studio-dist/client/assets/steps-DFsH3Neu.js +1 -0
  129. package/studio-dist/client/assets/vault-B2q1nBY5.js +1 -0
  130. package/studio-dist/client/assets/warnings-BSXIyuSQ.js +1 -0
  131. package/studio-dist/client/assets/workflow-DlsQD6Hc.js +1 -0
  132. package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-BQKuMdJW.js → __23tanstack-start-server-fn-resolver-M2GBs8s3.js} +179 -9
  133. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +35 -25
  134. package/studio-dist/server/assets/button-CIJqAhni.js +11929 -0
  135. package/studio-dist/server/assets/{companion-view-aBady57v.js → companion-view-DISASvdJ.js} +13 -7
  136. package/studio-dist/server/assets/companions-BYbHWKOZ.js +15 -0
  137. package/studio-dist/server/assets/delivery-path-C29fBynY.js +654 -0
  138. package/studio-dist/server/assets/{factory-DT3UzHlh.js → factory-DGPmNGbo.js} +1 -0
  139. package/studio-dist/server/assets/{factory-D6xnjedJ.js → factory-DUTa0eDs.js} +317 -530
  140. package/studio-dist/server/assets/markdown-view-Bn7xPdks.js +86 -0
  141. package/studio-dist/server/assets/panel-3Jmn4awF.js +169 -0
  142. package/studio-dist/server/assets/{prepaint-BMke0fo1.js → prepaint-DJfTQ_VH.js} +6 -2
  143. package/studio-dist/server/assets/{react-COs0LHn-.js → react-Ce6dj15C.js} +4 -9
  144. package/studio-dist/server/assets/reports-C06RXVE2.js +18 -0
  145. package/studio-dist/server/assets/reports-D6YMqhnO.js +142 -0
  146. package/studio-dist/server/assets/router-C8MGqlAY.js +13713 -0
  147. package/studio-dist/server/assets/routes-BcFgvqf7.js +622 -0
  148. package/studio-dist/server/assets/{shell-CboT2f66.js → shell-DS3wUexh.js} +1 -0
  149. package/studio-dist/server/assets/skills-BEnOxiDl.js +266 -0
  150. package/studio-dist/server/assets/skills-CtrBAtX3.js +28 -0
  151. package/studio-dist/server/assets/specs-C8rv34-5.js +211 -0
  152. package/studio-dist/server/assets/{start-BW5ovN0k.js → start-h3ICWwd2.js} +4 -1
  153. package/studio-dist/server/assets/steps-Dq_CwY_s.js +181 -0
  154. package/studio-dist/server/assets/{vault-BGulVoNh.js → vault-BmWnryh3.js} +16 -1
  155. package/studio-dist/server/assets/vault-Fvxt2Tzl.js +1032 -0
  156. package/studio-dist/server/assets/{views-Bd7cRr27.js → views-BgYa-za2.js} +1 -3
  157. package/studio-dist/server/assets/warnings-DzR6fyZh.js +23 -0
  158. package/studio-dist/server/assets/workflow-liRYecHk.js +73 -0
  159. package/studio-dist/server/server.js +3 -157
  160. package/studio-dist/client/assets/companion-view-Csva26Ir.js +0 -1
  161. package/studio-dist/client/assets/delivery-path-DJMpRmiY.js +0 -1
  162. package/studio-dist/client/assets/factory-B7l9ZQyx.js +0 -4
  163. package/studio-dist/client/assets/index-n6uo_92S.js +0 -40
  164. package/studio-dist/client/assets/queries-CN3JwMBX.js +0 -1
  165. package/studio-dist/client/assets/react-CabXf2Ds.js +0 -1
  166. package/studio-dist/client/assets/report-time-Dc-KOqQu.js +0 -1
  167. package/studio-dist/client/assets/reports-C01RsnMA.js +0 -1
  168. package/studio-dist/client/assets/routes-4pbC-2Hj.js +0 -1
  169. package/studio-dist/client/assets/skills-CihQganl.js +0 -1
  170. package/studio-dist/client/assets/spec-areas-C2L48N4C.js +0 -1
  171. package/studio-dist/client/assets/specs-D24_35_K.js +0 -1
  172. package/studio-dist/client/assets/studio-DKxfi691.css +0 -1
  173. package/studio-dist/client/assets/studio-queries-rvbJupCy.js +0 -3
  174. package/studio-dist/client/assets/vault-Bd4CQiTK.js +0 -1
  175. package/studio-dist/client/assets/warnings-V_Ys51wJ.js +0 -1
  176. package/studio-dist/client/assets/workflow-BJejeVwQ.js +0 -1
  177. package/studio-dist/server/assets/delivery-path-BkKNjgkf.js +0 -778
  178. package/studio-dist/server/assets/queries-Ag2iL8q2.js +0 -107
  179. package/studio-dist/server/assets/report-time-DAfzln-N.js +0 -8
  180. package/studio-dist/server/assets/reports-BnUNJVtx.js +0 -126
  181. package/studio-dist/server/assets/router-BH--drIx.js +0 -4298
  182. package/studio-dist/server/assets/routes-khSDK1bV.js +0 -361
  183. package/studio-dist/server/assets/skills-MWYnWoKs.js +0 -106
  184. package/studio-dist/server/assets/spec-areas-DcnO6vW-.js +0 -16
  185. package/studio-dist/server/assets/specs-DE3w8hZP.js +0 -155
  186. package/studio-dist/server/assets/studio-queries-CLnP9kGu.js +0 -3365
  187. package/studio-dist/server/assets/vault-CuyyhLyB.js +0 -832
  188. package/studio-dist/server/assets/warnings-BH05rOuG.js +0 -15
  189. package/studio-dist/server/assets/workflow-BSuIKWqH.js +0 -42
@@ -1,832 +0,0 @@
1
- import { i as __toESM } from "./rolldown-runtime-DYf_mQCB.js";
2
- import { i as useSuspenseQuery } from "./queries-Ag2iL8q2.js";
3
- import { Z as useQueryClient, a as afterVaultRefresh, d as vaultMatchesQuery, f as vaultQuery, i as afterVaultFileChange, l as shellQuery, m as saveVaultFile, nt as useNavigate, p as getVault, tt as Link, u as vaultChildrenQuery } from "./studio-queries-CLnP9kGu.js";
4
- import { _ as useMutation, h as useVaultUi, m as ViewPlaceholder, r as Route } from "./router-BH--drIx.js";
5
- import { n as useQuery } from "./react-COs0LHn-.js";
6
- import { A as require_react, l as require_jsx_runtime, s as useRouter } from "./__23tanstack-start-server-fn-resolver-BQKuMdJW.js";
7
- // ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/useBlocker.js
8
- var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
9
- function _resolveBlockerOpts(opts, condition) {
10
- if (opts === void 0) return {
11
- shouldBlockFn: () => true,
12
- withResolver: false
13
- };
14
- if ("shouldBlockFn" in opts) return opts;
15
- if (typeof opts === "function") {
16
- const shouldBlock = Boolean(condition ?? true);
17
- const _customBlockerFn = async () => {
18
- if (shouldBlock) return await opts();
19
- return false;
20
- };
21
- return {
22
- shouldBlockFn: _customBlockerFn,
23
- enableBeforeUnload: shouldBlock,
24
- withResolver: false
25
- };
26
- }
27
- const shouldBlock = Boolean(opts.condition ?? true);
28
- const fn = opts.blockerFn;
29
- const _customBlockerFn = async () => {
30
- if (shouldBlock && fn !== void 0) return await fn();
31
- return shouldBlock;
32
- };
33
- return {
34
- shouldBlockFn: _customBlockerFn,
35
- enableBeforeUnload: shouldBlock,
36
- withResolver: fn === void 0
37
- };
38
- }
39
- function useBlocker(opts, condition) {
40
- const { shouldBlockFn, enableBeforeUnload = true, disabled = false, withResolver = false } = _resolveBlockerOpts(opts, condition);
41
- const router = useRouter();
42
- const { history } = router;
43
- const [resolver, setResolver] = import_react.useState({
44
- status: "idle",
45
- current: void 0,
46
- next: void 0,
47
- action: void 0,
48
- proceed: void 0,
49
- reset: void 0
50
- });
51
- import_react.useEffect(() => {
52
- const blockerFnComposed = async (blockerFnArgs) => {
53
- function getLocation(location) {
54
- const parsedLocation = router.parseLocation(location);
55
- const [, rawParams, foundRoute] = router.getMatchedRoutes(parsedLocation.pathname);
56
- if (foundRoute === void 0) return {
57
- routeId: "__notFound__",
58
- fullPath: parsedLocation.pathname,
59
- pathname: parsedLocation.pathname,
60
- params: rawParams,
61
- search: router.options.parseSearch(location.search)
62
- };
63
- return {
64
- routeId: foundRoute.id,
65
- fullPath: foundRoute.fullPath,
66
- pathname: parsedLocation.pathname,
67
- params: rawParams,
68
- search: router.options.parseSearch(location.search)
69
- };
70
- }
71
- const current = getLocation(blockerFnArgs.currentLocation);
72
- const next = getLocation(blockerFnArgs.nextLocation);
73
- if (current.routeId === "__notFound__" && next.routeId !== "__notFound__") return false;
74
- const shouldBlock = await shouldBlockFn({
75
- action: blockerFnArgs.action,
76
- current,
77
- next
78
- });
79
- if (!withResolver) return shouldBlock;
80
- if (!shouldBlock) return false;
81
- const canNavigateAsync = await new Promise((resolve) => {
82
- setResolver({
83
- status: "blocked",
84
- current,
85
- next,
86
- action: blockerFnArgs.action,
87
- proceed: () => resolve(false),
88
- reset: () => resolve(true)
89
- });
90
- });
91
- setResolver({
92
- status: "idle",
93
- current: void 0,
94
- next: void 0,
95
- action: void 0,
96
- proceed: void 0,
97
- reset: void 0
98
- });
99
- return canNavigateAsync;
100
- };
101
- return disabled ? void 0 : history.block({
102
- blockerFn: blockerFnComposed,
103
- enableBeforeUnload
104
- });
105
- }, [
106
- shouldBlockFn,
107
- enableBeforeUnload,
108
- disabled,
109
- withResolver,
110
- history,
111
- router
112
- ]);
113
- return resolver;
114
- }
115
- // src/views/vault/markdown-view.tsx
116
- var import_jsx_runtime = require_jsx_runtime();
117
- var TAGS = /* @__PURE__ */ new Set([
118
- "h1",
119
- "h2",
120
- "h3",
121
- "h4",
122
- "h5",
123
- "h6",
124
- "p",
125
- "pre",
126
- "code",
127
- "span",
128
- "blockquote",
129
- "hr",
130
- "ol",
131
- "ul",
132
- "li",
133
- "div",
134
- "table",
135
- "thead",
136
- "tbody",
137
- "tr",
138
- "th",
139
- "td",
140
- "strong",
141
- "em",
142
- "del",
143
- "br"
144
- ]);
145
- function element(node, key) {
146
- const children = node.c?.map(render);
147
- const { a } = node;
148
- if (node.t === "a") {
149
- if (a?.note) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
150
- to: "/vault",
151
- search: (previous) => ({
152
- ...previous,
153
- path: a.note,
154
- dir: void 0,
155
- mode: void 0
156
- }),
157
- "data-vault-entry": a.note,
158
- children
159
- }, key);
160
- if (a?.href && /^https?:\/\//i.test(a.href)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
161
- href: a.href,
162
- target: "_blank",
163
- rel: "noopener noreferrer",
164
- children
165
- }, key);
166
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children }, key);
167
- }
168
- if (node.t === "input") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
169
- type: "checkbox",
170
- checked: !!a?.checked,
171
- disabled: true,
172
- readOnly: true,
173
- "aria-label": "Task"
174
- }, key);
175
- if (!TAGS.has(node.t)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children }, key);
176
- return (0, import_react.createElement)(node.t, {
177
- key,
178
- className: a?.className,
179
- start: a?.start,
180
- style: a?.align ? { textAlign: a.align } : void 0
181
- }, children && children.length > 0 ? children : void 0);
182
- }
183
- function render(node, key) {
184
- return typeof node === "string" ? node : element(node, key);
185
- }
186
- /** A file the server rendered to data; React escapes every value it shows. */
187
- function MarkdownView({ nodes }) {
188
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
189
- className: "markdown-body",
190
- children: nodes.map(render)
191
- });
192
- }
193
- // src/views/vault/vault-file.tsx
194
- var eventsUrl = (companion, path) => `/api/vault/events?${new URLSearchParams({
195
- companion,
196
- path
197
- })}`;
198
- /** Follows the open file on disk for as long as it is shown. */
199
- function useFileEvents(companion, path, onEvent) {
200
- const handler = (0, import_react.useRef)(onEvent);
201
- (0, import_react.useEffect)(() => {
202
- handler.current = onEvent;
203
- });
204
- (0, import_react.useEffect)(() => {
205
- if (typeof EventSource === "undefined") return;
206
- const source = new EventSource(eventsUrl(companion, path));
207
- source.onmessage = (message) => {
208
- try {
209
- handler.current(JSON.parse(message.data));
210
- } catch {}
211
- };
212
- return () => source.close();
213
- }, [companion, path]);
214
- }
215
- /**
216
- * An open file, read rendered or edited raw. Without the write path a file is only ever read,
217
- * whatever the address names. Saving returns to read; leaving edit with unsaved text asks.
218
- */
219
- function VaultFile({ companion, data, writable, search }) {
220
- const open = data.open;
221
- if (!open) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
222
- className: "panel vault-editor-panel",
223
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: data.refusal ? "File refused" : "Open a markdown file" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
224
- className: data.refusal ? "note vault-warning" : "empty",
225
- children: data.refusal ?? "Choose a file from the tree to begin."
226
- })]
227
- });
228
- return writable && search.mode === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Editor, {
229
- companion,
230
- data
231
- }, `${open.path}:edit`) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Reader, {
232
- companion,
233
- data,
234
- writable
235
- }, `${open.path}:read`);
236
- }
237
- function Header({ name, note, children }) {
238
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
239
- className: "section-header",
240
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: name }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
241
- className: "section-note",
242
- children: note
243
- })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
244
- className: "vault-actions",
245
- children
246
- })]
247
- });
248
- }
249
- var fileName = (path) => path.split("/").at(-1) ?? path;
250
- /** Rendered; a change on disk shows at once, a removal is stated. */
251
- function Reader({ companion, data, writable }) {
252
- const open = data.open;
253
- const queryClient = useQueryClient();
254
- const [status, setStatus] = (0, import_react.useState)("");
255
- useFileEvents(companion, open.path, (event) => {
256
- if (event.kind === "removed") setStatus("this file no longer exists on disk");
257
- else afterVaultFileChange(queryClient, companion);
258
- });
259
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
260
- className: "panel vault-editor-panel",
261
- "data-vault-root": true,
262
- "data-vault-mode": "read",
263
- "data-vault-path": open.path,
264
- children: [
265
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Header, {
266
- name: fileName(open.path),
267
- note: writable ? "Rendered view." : "Read-only mode. Start Studio with --writable to edit.",
268
- children: writable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
269
- className: "vault-mode-link",
270
- id: "vault-mode-edit",
271
- to: "/vault",
272
- search: (previous) => ({
273
- ...previous,
274
- mode: "edit"
275
- }),
276
- "data-vault-mode-link": true,
277
- children: "Edit"
278
- }) : null
279
- }),
280
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownView, { nodes: open.markdown }),
281
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
282
- id: "vault-status",
283
- className: "note",
284
- "aria-live": "polite",
285
- children: status
286
- })
287
- ]
288
- });
289
- }
290
- /** The raw editor with an explicit save; unsaved text is never replaced by a version from disk. */
291
- function Editor({ companion, data }) {
292
- const open = data.open;
293
- const queryClient = useQueryClient();
294
- const navigate = useNavigate();
295
- const [text, setText] = (0, import_react.useState)(open.content);
296
- const [original, setOriginal] = (0, import_react.useState)(open.content);
297
- const [token, setToken] = (0, import_react.useState)(open.token);
298
- const [status, setStatus] = (0, import_react.useState)("");
299
- const [incoming, setIncoming] = (0, import_react.useState)(null);
300
- const dirty = text !== original;
301
- const unsaved = (0, import_react.useRef)(dirty);
302
- (0, import_react.useEffect)(() => {
303
- unsaved.current = dirty;
304
- }, [dirty]);
305
- const setDirty = useVaultUi((state) => state.setDirty);
306
- (0, import_react.useEffect)(() => setDirty(dirty), [dirty, setDirty]);
307
- (0, import_react.useEffect)(() => () => setDirty(false), [setDirty]);
308
- useBlocker({
309
- shouldBlockFn: () => unsaved.current && !window.confirm("Discard unsaved changes?"),
310
- enableBeforeUnload: () => unsaved.current
311
- });
312
- useFileEvents(companion, open.path, (event) => {
313
- if (event.kind === "removed") {
314
- setStatus("this file no longer exists on disk");
315
- return;
316
- }
317
- const version = {
318
- content: event.content ?? "",
319
- token: event.token ?? ""
320
- };
321
- if (event.kind === "overwritten") {
322
- setIncoming(version);
323
- setStatus("a version was overwritten; its content is available below");
324
- } else if (dirty) {
325
- setIncoming(version);
326
- setStatus("the file changed on disk; unsaved content is still in the editor");
327
- } else {
328
- setText(version.content);
329
- setOriginal(version.content);
330
- setToken(version.token);
331
- setStatus("updated from disk");
332
- }
333
- });
334
- const save = useMutation({
335
- mutationFn: () => saveVaultFile({ data: {
336
- companion,
337
- path: open.path,
338
- content: text,
339
- token
340
- } }),
341
- onSuccess: (result) => {
342
- if (result.kind === "conflict") {
343
- setIncoming({
344
- content: result.content,
345
- token: result.token
346
- });
347
- setStatus(result.reason || "save refused");
348
- return;
349
- }
350
- setToken(result.token);
351
- setOriginal(text);
352
- unsaved.current = false;
353
- setDirty(false);
354
- setStatus("saved");
355
- afterVaultFileChange(queryClient, companion);
356
- navigate({
357
- to: "/vault",
358
- search: (previous) => ({
359
- ...previous,
360
- mode: void 0
361
- }),
362
- resetScroll: false
363
- });
364
- },
365
- onError: (error) => setStatus(error.message || "save failed")
366
- });
367
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
368
- className: "panel vault-editor-panel",
369
- "data-vault-root": true,
370
- "data-vault-mode": "edit",
371
- "data-vault-path": open.path,
372
- children: [
373
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Header, {
374
- name: fileName(open.path),
375
- note: "Changes stay in the editor until you save.",
376
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
377
- type: "button",
378
- id: "vault-save",
379
- onClick: () => save.mutate(),
380
- disabled: save.isPending,
381
- children: "Save"
382
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
383
- className: "vault-mode-link",
384
- id: "vault-mode-read",
385
- to: "/vault",
386
- search: (previous) => ({
387
- ...previous,
388
- mode: void 0
389
- }),
390
- "data-vault-mode-link": true,
391
- children: "Read"
392
- })]
393
- }),
394
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", {
395
- id: "vault-editor",
396
- "data-vault-editor": true,
397
- "data-vault-path": open.path,
398
- "aria-label": `Markdown source of ${fileName(open.path)}`,
399
- spellCheck: false,
400
- value: text,
401
- onChange: (event) => setText(event.target.value)
402
- }),
403
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
404
- id: "vault-status",
405
- className: "note",
406
- "aria-live": "polite",
407
- children: status
408
- }),
409
- incoming ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
410
- id: "vault-incoming",
411
- className: "vault-incoming",
412
- children: [
413
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", {
414
- id: "vault-incoming-title",
415
- children: "Incoming version"
416
- }),
417
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
418
- id: "vault-incoming-content",
419
- children: incoming.content
420
- }),
421
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
422
- type: "button",
423
- id: "vault-recover",
424
- onClick: () => {
425
- setText(incoming.content);
426
- setOriginal(incoming.content);
427
- if (incoming.token) setToken(incoming.token);
428
- setIncoming(null);
429
- setStatus("incoming version loaded into the editor");
430
- },
431
- children: "Put incoming content back"
432
- })
433
- ]
434
- }) : null
435
- ]
436
- });
437
- }
438
- // src/views/vault/vault-view.tsx
439
- var segments = (relative) => relative.split("/").filter(Boolean);
440
- function FolderIcon() {
441
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
442
- className: "vault-icon vault-icon-folder",
443
- "aria-hidden": "true"
444
- });
445
- }
446
- function FileIcon() {
447
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
448
- className: "vault-icon vault-icon-file",
449
- "aria-hidden": "true"
450
- });
451
- }
452
- /** A file entry is a link to the file's address; it opens in read. */
453
- function FileLink({ entry, current, label }) {
454
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
455
- to: "/vault",
456
- search: (previous) => ({
457
- ...previous,
458
- path: entry.path,
459
- dir: void 0,
460
- mode: void 0
461
- }),
462
- className: "vault-file",
463
- "data-vault-entry": entry.path,
464
- "aria-current": current ? "page" : void 0,
465
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FileIcon, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: label ?? entry.name })]
466
- });
467
- }
468
- /** Opens a folder's listing; a breadcrumb step or a listing row. */
469
- function FolderLink({ dir, className, children }) {
470
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
471
- to: "/vault",
472
- search: (previous) => ({
473
- ...previous,
474
- path: void 0,
475
- dir: dir ?? void 0,
476
- mode: void 0
477
- }),
478
- className,
479
- children
480
- });
481
- }
482
- function TreeEntry({ entry, companion, search }) {
483
- if (entry.kind === "file") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FileLink, {
484
- entry,
485
- current: search.path === entry.path
486
- });
487
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TreeFolder, {
488
- entry,
489
- companion,
490
- search
491
- });
492
- }
493
- /** Collapsed unless on the open path; a collapsed folder asks for its entries when first opened. */
494
- function TreeFolder({ entry, companion, search }) {
495
- const [open, setOpen] = (0, import_react.useState)(entry.children !== void 0);
496
- const children = useQuery({
497
- ...vaultChildrenQuery(companion, entry.path),
498
- enabled: open && entry.children === void 0
499
- });
500
- const entries = entry.children ?? children.data?.entries;
501
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
502
- className: "vault-directory",
503
- open,
504
- "data-vault-dir": entry.path,
505
- onToggle: (event) => setOpen(event.currentTarget.open),
506
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", {
507
- "aria-current": search.dir === entry.path ? "page" : void 0,
508
- children: [
509
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
510
- className: "vault-chevron",
511
- "aria-hidden": "true"
512
- }),
513
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FolderIcon, {}),
514
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: entry.name })
515
- ]
516
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
517
- className: "vault-children",
518
- children: [open && entries ? entries.map((child) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TreeEntry, {
519
- entry: child,
520
- companion,
521
- search
522
- }, child.path)) : null, children.error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
523
- className: "note vault-warning",
524
- children: children.error.message
525
- }) : null]
526
- })]
527
- });
528
- }
529
- function TreeSlot({ data, companion, search }) {
530
- if (data.failure) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
531
- "data-vault-slot": "tree",
532
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
533
- className: "note vault-warning",
534
- children: ["The files could not be listed: ", data.failure]
535
- })
536
- });
537
- if (data.tree === null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
538
- "data-vault-slot": "tree",
539
- "aria-busy": "true",
540
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
541
- className: "empty",
542
- children: "Listing files…"
543
- })
544
- });
545
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
546
- "data-vault-slot": "tree",
547
- "data-vault-generation": data.generation ?? void 0,
548
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TreeStaleNote, { data }), data.tree.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
549
- className: "empty",
550
- children: "This companion has no markdown files."
551
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", {
552
- className: "vault-tree",
553
- "aria-label": "Markdown files",
554
- children: data.tree.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TreeEntry, {
555
- entry,
556
- companion,
557
- search
558
- }, entry.path))
559
- })]
560
- });
561
- }
562
- function TreeStaleNote({ data }) {
563
- if (data.warning) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
564
- className: "note vault-warning",
565
- children: [data.warning, ". The tree may be out of date."]
566
- });
567
- if (data.watching) return null;
568
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
569
- className: "note vault-warning",
570
- children: "The tree may be out of date."
571
- });
572
- }
573
- /** Name matches over the whole listed tree, bounded by the server. */
574
- function FilterResults({ companion, query, search }) {
575
- const [settled, setSettled] = (0, import_react.useState)(query);
576
- (0, import_react.useEffect)(() => {
577
- const timer = setTimeout(() => setSettled(query), 150);
578
- return () => clearTimeout(timer);
579
- }, [query]);
580
- const matches = useQuery({
581
- ...vaultMatchesQuery(companion, settled),
582
- enabled: settled.trim().length > 0
583
- });
584
- if (!matches.data) return null;
585
- const { shown, total } = matches.data;
586
- const more = total - shown.length;
587
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
588
- "data-vault-filter-results": true,
589
- children: [shown.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
590
- className: "empty",
591
- children: "No files match."
592
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", {
593
- className: "vault-tree vault-results",
594
- "aria-label": "Matching files",
595
- children: shown.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FileLink, {
596
- entry,
597
- current: search.path === entry.path,
598
- label: entry.path
599
- }, entry.path))
600
- }), more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
601
- className: "note",
602
- "data-vault-more": true,
603
- children: [
604
- more,
605
- " more match",
606
- more === 1 ? "" : "es",
607
- "; refine the filter."
608
- ]
609
- }) : null]
610
- });
611
- }
612
- /** Built from the address alone, so it shows before the tree is listed. */
613
- function Breadcrumb({ rootName, search }) {
614
- const parts = segments(search.path ?? search.dir ?? "");
615
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", {
616
- className: "vault-breadcrumb",
617
- "aria-label": "Breadcrumb",
618
- "data-vault-crumb": true,
619
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ol", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: parts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
620
- "aria-current": "page",
621
- children: rootName
622
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FolderLink, {
623
- dir: null,
624
- className: "vault-crumb",
625
- children: rootName
626
- }) }), parts.map((name, index) => {
627
- const dir = parts.slice(0, index + 1).join("/");
628
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: index === parts.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
629
- "aria-current": "page",
630
- children: name
631
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FolderLink, {
632
- dir,
633
- className: "vault-crumb",
634
- children: name
635
- }) }, dir);
636
- })] })
637
- });
638
- }
639
- function findEntries(tree, dir) {
640
- let level = tree;
641
- for (const name of segments(dir)) {
642
- const folder = level?.find((entry) => entry.kind === "directory" && entry.name === name);
643
- if (!folder) return null;
644
- level = folder.children;
645
- }
646
- return level ?? null;
647
- }
648
- /** With no file open: the open folder's entries, folders first, and the way to its parent. */
649
- function Listing({ data }) {
650
- if (data.failure) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
651
- "data-vault-slot": "listing",
652
- className: "panel vault-listing",
653
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
654
- className: "note vault-warning",
655
- children: ["The files could not be listed: ", data.failure]
656
- })
657
- });
658
- if (data.tree === null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
659
- "data-vault-slot": "listing",
660
- className: "panel vault-listing",
661
- "aria-busy": "true",
662
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
663
- className: "empty",
664
- children: "Listing files…"
665
- })
666
- });
667
- const entries = (data.dir ? findEntries(data.tree, data.dir) : null) ?? data.tree;
668
- const parts = data.dir ? segments(data.dir) : [];
669
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
670
- "data-vault-slot": "listing",
671
- className: "panel vault-listing",
672
- children: [data.dirMissing ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
673
- className: "note vault-warning",
674
- children: "That folder is not in the tree; showing the root."
675
- }) : null, entries.length === 0 && parts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
676
- className: "empty",
677
- children: "This companion has no markdown files."
678
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", {
679
- className: "vault-rows",
680
- "aria-label": "Folder contents",
681
- children: [parts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FolderLink, {
682
- dir: parts.length > 1 ? parts.slice(0, -1).join("/") : null,
683
- className: "vault-row",
684
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FolderIcon, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: ".." })]
685
- }) }) : null, entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: entry.kind === "directory" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FolderLink, {
686
- dir: entry.path,
687
- className: "vault-row",
688
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FolderIcon, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: entry.name })]
689
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
690
- to: "/vault",
691
- search: (previous) => ({
692
- ...previous,
693
- path: entry.path,
694
- dir: void 0,
695
- mode: void 0
696
- }),
697
- className: "vault-row",
698
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FileIcon, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: entry.name })]
699
- }) }, entry.path))]
700
- })]
701
- });
702
- }
703
- /**
704
- * The vault: the companion as folders beside the content. The tree holds only the top level
705
- * and the open path; it fills in without the viewer acting when it was not listed yet.
706
- */
707
- function VaultLayout({ companion, rootName, writable, search }) {
708
- const queryClient = useQueryClient();
709
- const view = useQuery(vaultQuery(companion, search));
710
- const data = useQuery({
711
- ...vaultQuery(companion, search, true),
712
- enabled: Boolean(view.data && view.data.tree === null && !view.data.failure)
713
- }).data ?? view.data;
714
- const [filter, setFilter] = (0, import_react.useState)("");
715
- const latest = useVaultUi((state) => state.latestGeneration);
716
- const treeHidden = useVaultUi((state) => state.treeHidden);
717
- const toggleTree = useVaultUi((state) => state.toggleTree);
718
- const hydrate = useVaultUi((state) => state.hydrate);
719
- (0, import_react.useEffect)(hydrate, [hydrate]);
720
- const refresh = useMutation({
721
- mutationFn: () => getVault({ data: {
722
- companion,
723
- path: search.path,
724
- dir: search.dir,
725
- refresh: true,
726
- wait: true
727
- } }),
728
- onSuccess: (fresh) => void afterVaultRefresh(queryClient, companion, search, fresh)
729
- });
730
- if (!data) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ViewPlaceholder, {});
731
- const stale = latest !== null && data.generation !== null && latest > data.generation;
732
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
733
- className: "vault-layout",
734
- "data-vault-layout": true,
735
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("aside", {
736
- className: "panel vault-tree-panel",
737
- id: "vault-tree-panel",
738
- "aria-label": "Files",
739
- children: [
740
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
741
- className: "vault-tree-head",
742
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "Files" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
743
- type: "button",
744
- onClick: () => refresh.mutate(),
745
- disabled: refresh.isPending,
746
- children: refresh.isPending ? "Refreshing…" : "Refresh tree"
747
- })]
748
- }),
749
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
750
- id: "vault-stale",
751
- className: "note vault-warning",
752
- role: "status",
753
- hidden: !stale,
754
- children: "Files changed — refresh tree."
755
- }),
756
- refresh.error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
757
- className: "note vault-warning",
758
- role: "status",
759
- children: refresh.error.message
760
- }) : null,
761
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
762
- type: "search",
763
- id: "vault-filter",
764
- className: "vault-filter",
765
- placeholder: "Go to file",
766
- "aria-label": "Go to file",
767
- value: filter,
768
- onChange: (event) => setFilter(event.target.value),
769
- onKeyDown: (event) => {
770
- if (event.key === "Escape") setFilter("");
771
- }
772
- }),
773
- filter.trim() ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterResults, {
774
- companion,
775
- query: filter,
776
- search
777
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TreeSlot, {
778
- data,
779
- companion,
780
- search
781
- })
782
- ]
783
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
784
- className: "vault-main",
785
- "data-vault-main": true,
786
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
787
- className: "vault-bar",
788
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
789
- type: "button",
790
- id: "vault-tree-toggle",
791
- className: "vault-tree-toggle",
792
- "aria-controls": "vault-tree-panel",
793
- "aria-expanded": !treeHidden,
794
- onClick: toggleTree,
795
- children: treeHidden ? "Show files" : "Hide files"
796
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Breadcrumb, {
797
- rootName,
798
- search
799
- })]
800
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
801
- "data-vault-pane": true,
802
- children: search.path || data.open || data.refusal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VaultFile, {
803
- companion,
804
- data,
805
- writable,
806
- search
807
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Listing, { data })
808
- })]
809
- })]
810
- });
811
- }
812
- // src/routes/vault.tsx?tsr-split=component
813
- function VaultRoute() {
814
- const search = Route.useSearch();
815
- const { data: shell } = useSuspenseQuery(shellQuery({
816
- companion: search.companion,
817
- studioMode: search.studioMode
818
- }));
819
- if (!search.companion || !shell.selected) return null;
820
- const rootName = shell.selected.path.split(/[\\/]/).findLast(Boolean) ?? "companion";
821
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VaultLayout, {
822
- companion: search.companion,
823
- rootName,
824
- writable: shell.writable,
825
- search: {
826
- path: search.path,
827
- dir: search.dir,
828
- mode: search.mode
829
- }
830
- });
831
- }
832
- export { VaultRoute as component };