@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
@@ -0,0 +1,86 @@
1
+ import { i as __toESM } from "./rolldown-runtime-DYf_mQCB.js";
2
+ import { Bi as Link } from "./button-CIJqAhni.js";
3
+ import { j as require_react, u as require_jsx_runtime } from "./__23tanstack-start-server-fn-resolver-M2GBs8s3.js";
4
+ // src/views/vault/markdown-view.tsx
5
+ var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
6
+ var import_jsx_runtime = require_jsx_runtime();
7
+ var TAGS = /* @__PURE__ */ new Set([
8
+ "h1",
9
+ "h2",
10
+ "h3",
11
+ "h4",
12
+ "h5",
13
+ "h6",
14
+ "p",
15
+ "pre",
16
+ "code",
17
+ "span",
18
+ "blockquote",
19
+ "hr",
20
+ "ol",
21
+ "ul",
22
+ "li",
23
+ "div",
24
+ "dl",
25
+ "dt",
26
+ "dd",
27
+ "table",
28
+ "thead",
29
+ "tbody",
30
+ "tr",
31
+ "th",
32
+ "td",
33
+ "strong",
34
+ "em",
35
+ "del",
36
+ "br"
37
+ ]);
38
+ function element(node, key) {
39
+ const children = node.c?.map(render);
40
+ const { a } = node;
41
+ if (node.t === "a") {
42
+ if (a?.note) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
43
+ to: "/vault",
44
+ search: (previous) => ({
45
+ ...previous,
46
+ path: a.note,
47
+ dir: void 0,
48
+ mode: void 0
49
+ }),
50
+ "data-vault-entry": a.note,
51
+ children
52
+ }, key);
53
+ if (a?.href && /^https?:\/\//i.test(a.href)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
54
+ href: a.href,
55
+ target: "_blank",
56
+ rel: "noopener noreferrer",
57
+ children
58
+ }, key);
59
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children }, key);
60
+ }
61
+ if (node.t === "input") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
62
+ type: "checkbox",
63
+ checked: !!a?.checked,
64
+ disabled: true,
65
+ readOnly: true,
66
+ "aria-label": "Task"
67
+ }, key);
68
+ if (!TAGS.has(node.t)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children }, key);
69
+ return (0, import_react.createElement)(node.t, {
70
+ key,
71
+ className: a?.className,
72
+ start: a?.start,
73
+ style: a?.align ? { textAlign: a.align } : void 0
74
+ }, children && children.length > 0 ? children : void 0);
75
+ }
76
+ function render(node, key) {
77
+ return typeof node === "string" ? node : element(node, key);
78
+ }
79
+ /** A file the server rendered to data; React escapes every value it shows. */
80
+ function MarkdownView({ nodes }) {
81
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
82
+ className: "markdown-body",
83
+ children: nodes.map(render)
84
+ });
85
+ }
86
+ export { MarkdownView as t };
@@ -0,0 +1,169 @@
1
+ import { i as __toESM } from "./rolldown-runtime-DYf_mQCB.js";
2
+ import { j as require_react, u as require_jsx_runtime } from "./__23tanstack-start-server-fn-resolver-M2GBs8s3.js";
3
+ import { Ar as cn, r as Icon, t as Button } from "./button-CIJqAhni.js";
4
+ import { A as DialogTitle, F as DialogBackdrop, M as DialogPortal, N as DialogPopup, O as inField, P as DialogClose, j as DialogRoot, k as Kbd } from "./router-C8MGqlAY.js";
5
+ // src/components/ui/sheet.tsx
6
+ var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
7
+ var import_jsx_runtime = require_jsx_runtime();
8
+ function Sheet(props) {
9
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogRoot, {
10
+ "data-slot": "sheet",
11
+ ...props
12
+ });
13
+ }
14
+ var SheetClose = DialogClose;
15
+ /** A panel floating over the page from the right edge; it alone casts the floating shadow. */
16
+ function SheetContent({ className, wide = false, ...props }) {
17
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPortal, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogBackdrop, {
18
+ "data-slot": "sheet-overlay",
19
+ className: "fixed inset-0 z-30 bg-[color-mix(in_srgb,var(--bg)_45%,transparent)] transition-opacity duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0"
20
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPopup, {
21
+ "data-slot": "sheet-content",
22
+ "data-wide": wide ? "" : void 0,
23
+ className: cn("fixed top-2 right-2 bottom-2 z-30 flex w-[min(560px,calc(100vw-16px))] flex-col overflow-hidden rounded-panel border border-rule bg-surface text-text shadow-float outline-none transition-[transform,width] duration-250 ease-[cubic-bezier(.16,1,.3,1)] data-ending-style:translate-x-[calc(100%+16px)] data-starting-style:translate-x-[calc(100%+16px)] data-wide:w-[min(760px,calc(100vw-16px))]", className),
24
+ ...props
25
+ })] });
26
+ }
27
+ function SheetTitle({ className, ...props }) {
28
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, {
29
+ "data-slot": "sheet-title",
30
+ className: cn("m-0 text-lg font-semibold break-words", className),
31
+ ...props
32
+ });
33
+ }
34
+ // src/shell/panel.tsx
35
+ /**
36
+ * The one slide-over panel (design D3): an item's detail floats over the page from the right,
37
+ * walks its list with Previous, Next and the arrow keys, and returns focus to its opener.
38
+ */
39
+ function SidePanel({ items, current, onSelect, pass, wide, title, children }) {
40
+ const opener = (0, import_react.useRef)(null);
41
+ const open = current !== null;
42
+ const index = current === null ? -1 : items.indexOf(current);
43
+ const previous = index > 0 ? items[index - 1] : void 0;
44
+ const next = index >= 0 && index < items.length - 1 ? items[index + 1] : void 0;
45
+ (0, import_react.useEffect)(() => {
46
+ const remember = (event) => {
47
+ const target = event.target;
48
+ if (target?.closest && !target.closest("[data-slot=sheet-content]")) opener.current = target;
49
+ };
50
+ document.addEventListener("focusin", remember);
51
+ return () => document.removeEventListener("focusin", remember);
52
+ }, []);
53
+ const walk = (0, import_react.useEffectEvent)((event) => {
54
+ if (event.metaKey || event.ctrlKey || event.altKey || inField(event.target)) return;
55
+ const to = event.key === "ArrowRight" ? next : event.key === "ArrowLeft" ? previous : void 0;
56
+ if (to === void 0) return;
57
+ event.preventDefault();
58
+ onSelect(to);
59
+ });
60
+ (0, import_react.useEffect)(() => {
61
+ if (!open) return;
62
+ const listener = (event) => walk(event);
63
+ document.addEventListener("keydown", listener, true);
64
+ return () => document.removeEventListener("keydown", listener, true);
65
+ }, [open]);
66
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sheet, {
67
+ open,
68
+ onOpenChange: (nextOpen) => {
69
+ if (!nextOpen) onSelect(null);
70
+ },
71
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetContent, {
72
+ wide,
73
+ "aria-label": title,
74
+ finalFocus: () => opener.current?.isConnected ? opener.current : true,
75
+ initialFocus: () => document.getElementById("side-panel-close"),
76
+ children: [
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetTitle, {
78
+ className: "sr-only",
79
+ children: title
80
+ }),
81
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
82
+ className: "flex items-center gap-1.5 border-b border-rule py-2.5 pr-3 pl-5",
83
+ children: [
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
85
+ className: "mr-auto font-mono text-xs text-muted",
86
+ "aria-live": "polite",
87
+ children: [index >= 0 ? `${index + 1} of ${items.length}` : null, pass ? ` · ${pass}` : null]
88
+ }),
89
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
90
+ size: "icon-sm",
91
+ variant: "ghost",
92
+ "aria-label": "Previous",
93
+ disabled: previous === void 0,
94
+ onClick: () => previous !== void 0 && onSelect(previous),
95
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "left" })
96
+ }),
97
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
98
+ size: "icon-sm",
99
+ variant: "ghost",
100
+ "aria-label": "Next",
101
+ disabled: next === void 0,
102
+ onClick: () => next !== void 0 && onSelect(next),
103
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "right" })
104
+ }),
105
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetClose, {
106
+ id: "side-panel-close",
107
+ render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
108
+ size: "icon-sm",
109
+ variant: "ghost",
110
+ "aria-label": "Close"
111
+ }),
112
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "close" })
113
+ })
114
+ ]
115
+ }),
116
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
117
+ className: "flex min-h-0 flex-1 flex-col overflow-auto",
118
+ children
119
+ }),
120
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
121
+ className: "flex gap-3.5 border-t border-rule px-5 py-2.5 text-2xs text-muted max-sm:hidden",
122
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
123
+ className: "inline-flex items-center gap-1.5",
124
+ children: [
125
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Kbd, { children: "←" }),
126
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Kbd, { children: "→" }),
127
+ " previous, next"
128
+ ]
129
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
130
+ className: "inline-flex items-center gap-1.5",
131
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Kbd, { children: "esc" }), " close"]
132
+ })]
133
+ })
134
+ ]
135
+ })
136
+ });
137
+ }
138
+ /** The panel's lead: what the item is, then its name. */
139
+ function PanelHead({ kicker, title, mono = false, children }) {
140
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
141
+ className: "grid gap-1.5 border-b border-rule px-5 pt-4 pb-3.5",
142
+ children: [
143
+ kicker ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
144
+ className: "flex items-center gap-2 text-xs text-muted",
145
+ children: kicker
146
+ }) : null,
147
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
148
+ className: mono ? "m-0 font-mono text-md font-semibold break-words" : "m-0 text-lg font-semibold",
149
+ children: title
150
+ }),
151
+ children
152
+ ]
153
+ });
154
+ }
155
+ /** One section of the panel, under a short heading. */
156
+ function PanelSection({ title, aside, children }) {
157
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
158
+ className: "grid gap-2.5 border-b border-rule-soft px-5 py-4",
159
+ "aria-label": title,
160
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", {
161
+ className: "m-0 flex items-center gap-2 text-sm font-semibold",
162
+ children: [title, aside ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
163
+ className: "ml-auto font-mono text-2xs font-normal text-muted",
164
+ children: aside
165
+ }) : null]
166
+ }), children]
167
+ });
168
+ }
169
+ export { SheetClose as a, Sheet as i, PanelSection as n, SheetContent as o, SidePanel as r, SheetTitle as s, PanelHead as t };
@@ -3,10 +3,11 @@ import { l as COMPANION_DIGEST_PATTERN, u as COMPANION_PARAM } from "./studio-Be
3
3
  var THEME_STORAGE_KEY = "mate-studio-theme";
4
4
  var COMPANION_STORAGE_KEY = "mate-studio-companion";
5
5
  var VAULT_TREE_STORAGE_KEY = "mate-studio-vault-tree";
6
+ var RAIL_STORAGE_KEY = "mate-studio-rail";
6
7
  /**
7
8
  * Runs in `<head>` before first paint. A server-rendered document arrives with
8
9
  * its markup already in place, so a remembered appearance applied after load
9
- * would paint the other one first and then repaint, and a remembered companion
10
+ * would paint the other one first and then repaint (so would a collapsed sidebar), and a remembered companion
10
11
  * restored after load would paint the picker before leaving it.
11
12
  *
12
13
  * The restore names the companion in the URL and reloads, because the URL is
@@ -23,6 +24,9 @@ var STUDIO_PREPAINT_SCRIPT = `(function () {
23
24
  if (localStorage.getItem(${JSON.stringify(VAULT_TREE_STORAGE_KEY)}) === "hidden") {
24
25
  document.documentElement.setAttribute("data-vault-tree", "hidden");
25
26
  }
27
+ if (localStorage.getItem(${JSON.stringify(RAIL_STORAGE_KEY)}) === "min") {
28
+ document.documentElement.setAttribute("data-rail", "min");
29
+ }
26
30
  } catch (error) {
27
31
  /* a blocked web store only costs the preference, never the page */
28
32
  }
@@ -38,4 +42,4 @@ var STUDIO_PREPAINT_SCRIPT = `(function () {
38
42
  /* a blocked web store only costs the restore, never the page */
39
43
  }
40
44
  })();`;
41
- export { VAULT_TREE_STORAGE_KEY as i, STUDIO_PREPAINT_SCRIPT as n, THEME_STORAGE_KEY as r, COMPANION_STORAGE_KEY as t };
45
+ export { VAULT_TREE_STORAGE_KEY as a, THEME_STORAGE_KEY as i, RAIL_STORAGE_KEY as n, STUDIO_PREPAINT_SCRIPT as r, COMPANION_STORAGE_KEY as t };
@@ -1,11 +1,6 @@
1
1
  import { i as __toESM } from "./rolldown-runtime-DYf_mQCB.js";
2
- import { A as require_react } from "./__23tanstack-start-server-fn-resolver-BQKuMdJW.js";
3
- import { j as QueryObserver, k as useBaseQuery } from "./studio-queries-CLnP9kGu.js";
4
- // ../../node_modules/.bun/@tanstack+react-query@5.105.3+cef22a3c7e8b4cef/node_modules/@tanstack/react-query/build/modern/useQuery.js
5
- function useQuery(options, queryClient) {
6
- return useBaseQuery(options, QueryObserver, queryClient);
7
- }
8
- // ../../node_modules/.bun/zustand@5.0.16+ea2f17093d73c934/node_modules/zustand/esm/vanilla.mjs
2
+ import { j as require_react } from "./__23tanstack-start-server-fn-resolver-M2GBs8s3.js";
3
+ // ../../node_modules/.bun/zustand@5.0.16+d485e2f7e55e3bff/node_modules/zustand/esm/vanilla.mjs
9
4
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
10
5
  var createStoreImpl = (createState) => {
11
6
  let state;
@@ -34,7 +29,7 @@ var createStoreImpl = (createState) => {
34
29
  return api;
35
30
  };
36
31
  var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
37
- // ../../node_modules/.bun/zustand@5.0.16+ea2f17093d73c934/node_modules/zustand/esm/react.mjs
32
+ // ../../node_modules/.bun/zustand@5.0.16+d485e2f7e55e3bff/node_modules/zustand/esm/react.mjs
38
33
  var identity = (arg) => arg;
39
34
  function useStore(api, selector = identity) {
40
35
  const slice = import_react.useSyncExternalStore(api.subscribe, import_react.useCallback(() => selector(api.getState()), [api, selector]), () => selector(api.getInitialState()));
@@ -48,4 +43,4 @@ var createImpl = (createState) => {
48
43
  return useBoundStore;
49
44
  };
50
45
  var create = ((createState) => createState ? createImpl(createState) : createImpl);
51
- export { useQuery as n, create as t };
46
+ export { create as t };
@@ -0,0 +1,18 @@
1
+ import { t as createServerRpc } from "./createServerRpc-tK2lE9R2.js";
2
+ import { t as createServerFn } from "./createServerFn-F5sAOF8V.js";
3
+ import { l as COMPANION_DIGEST_PATTERN } from "./studio-BeltxxKt.js";
4
+ // src/server/reports.ts?tss-serverfn-split
5
+ var getReports_createServerFn_handler = createServerRpc({
6
+ id: "990d830ca9afc020639551c43ec50904b734051c52b1ad91dbf739065b343bb3",
7
+ name: "getReports",
8
+ filename: "src/server/reports.ts"
9
+ }, (opts) => getReports.__executeServer(opts));
10
+ var getReports = createServerFn({ method: "GET" }).validator((input) => {
11
+ if (typeof input?.companion !== "string" || !COMPANION_DIGEST_PATTERN.test(input.companion)) throw new Error("no registered companion was selected");
12
+ return { companion: input.companion };
13
+ }).handler(getReports_createServerFn_handler, async ({ data, context }) => (await context.studio.reports(data.companion)).map(({ id, title, createdAt }) => ({
14
+ id,
15
+ title,
16
+ createdAt
17
+ })));
18
+ export { getReports_createServerFn_handler };
@@ -0,0 +1,142 @@
1
+ import { i as __toESM } from "./rolldown-runtime-DYf_mQCB.js";
2
+ import { Ar as cn, Hr as reportsQuery, fi as useQuery, ii as REPORT_VIEW_PREFIX, nt as ListCard, r as Icon, rt as PAGE_PAD, st as ROW, tt as EmptyNote } from "./button-CIJqAhni.js";
3
+ import { c as useRouter, j as require_react, u as require_jsx_runtime } from "./__23tanstack-start-server-fn-resolver-M2GBs8s3.js";
4
+ import "./studio-BeltxxKt.js";
5
+ import { r as SidePanel, t as PanelHead } from "./panel-3Jmn4awF.js";
6
+ import { I as useAppearance, R as usePageUi, o as Route } from "./router-C8MGqlAY.js";
7
+ // ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/useLocation.js
8
+ /**
9
+ * Read the current location from the router state with optional selection.
10
+ * Useful for subscribing to just the pieces of location you care about.
11
+ *
12
+ * Options:
13
+ * - `select`: Project the `location` object to a derived value
14
+ * - `structuralSharing`: Enable structural sharing for stable references
15
+ *
16
+ * @returns The current location (or selected value).
17
+ * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLocationHook
18
+ */
19
+ function useLocation(opts) {
20
+ const router = useRouter();
21
+ {
22
+ const location = router.stores.location.get();
23
+ return opts?.select ? opts.select(location) : location;
24
+ }
25
+ }
26
+ // src/lib/report-time.ts
27
+ var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
28
+ var pad = (part) => String(part).padStart(2, "0");
29
+ /** A report's local publishing time, the same in every view and independent of the locale. */
30
+ function formatReportTime(createdAt) {
31
+ const at = new Date(createdAt);
32
+ return `${at.getFullYear()}-${pad(at.getMonth() + 1)}-${pad(at.getDate())} ${pad(at.getHours())}:${pad(at.getMinutes())}`;
33
+ }
34
+ // src/views/reports/reports-view.tsx
35
+ var import_jsx_runtime = require_jsx_runtime();
36
+ /** The report the address names, as `#report=<id>`. */
37
+ var REPORT_ID = /(?:^|[#&])report=([0-9a-f]{32})/;
38
+ function reportSrc(id, theme) {
39
+ const scheme = theme === "system" ? "" : `?scheme=${theme}`;
40
+ return `${REPORT_VIEW_PREFIX}${id}${scheme}`;
41
+ }
42
+ function setAddress(id) {
43
+ try {
44
+ const url = `${location.pathname}${location.search}${id ? `#report=${id}` : ""}`;
45
+ history.replaceState(history.state, "", url);
46
+ } catch {}
47
+ }
48
+ /** One report in the panel: a link to it on its own, and the report in a sandboxed frame. */
49
+ function ReportDetail({ report, src }) {
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelHead, {
51
+ title: report.title,
52
+ kicker: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: formatReportTime(report.createdAt) }),
53
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", {
54
+ id: "reports-open",
55
+ className: "inline-flex items-center gap-1.5 text-sm",
56
+ href: src,
57
+ target: "_blank",
58
+ rel: "noopener noreferrer",
59
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
60
+ name: "external",
61
+ className: "size-3.5"
62
+ }), " Open in new tab"]
63
+ })
64
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("iframe", {
65
+ id: "reports-frame",
66
+ className: "min-h-0 w-full flex-1 border-0 bg-page",
67
+ title: "Hosted report",
68
+ sandbox: "allow-scripts allow-modals",
69
+ referrerPolicy: "no-referrer",
70
+ src
71
+ }, src)] });
72
+ }
73
+ /**
74
+ * Hosted reports, newest first; one opens in the panel in a sandboxed frame. A new report lists
75
+ * as it is published; the frame reloads in the appearance chosen in Studio.
76
+ */
77
+ function Reports({ companion }) {
78
+ const reports = useQuery(reportsQuery(companion));
79
+ const theme = useAppearance((state) => state.theme);
80
+ const clearReports = usePageUi((state) => state.clearReports);
81
+ const named = REPORT_ID.exec(useLocation({ select: (location) => `#${location.hash}` }))?.[1];
82
+ const [chosen, setChosen] = (0, import_react.useState)(void 0);
83
+ (0, import_react.useEffect)(clearReports, [clearReports]);
84
+ const list = reports.data ?? [];
85
+ const wanted = chosen === void 0 ? named ?? null : chosen;
86
+ const open = list.find((report) => report.id === wanted) ?? null;
87
+ const select = (id) => {
88
+ setChosen(id);
89
+ setAddress(id);
90
+ };
91
+ const src = open ? reportSrc(open.id, theme) : null;
92
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
93
+ className: cn(PAGE_PAD, "grid content-start gap-3 pb-10"),
94
+ "data-reports-view": true,
95
+ "aria-label": "Hosted reports",
96
+ children: [list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyNote, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
97
+ id: "reports-empty",
98
+ children: "No hosted reports yet."
99
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListCard, {
100
+ title: "Reports",
101
+ count: list.length,
102
+ hint: "Newest first",
103
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
104
+ id: "reports-list",
105
+ className: "m-0 list-none p-0",
106
+ "aria-label": "Reports",
107
+ children: list.map((report) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
108
+ type: "button",
109
+ className: cn(ROW, "grid grid-cols-[minmax(0,1fr)_auto]"),
110
+ "data-report-id": report.id,
111
+ "aria-current": report.id === open?.id ? "true" : void 0,
112
+ onClick: () => select(report.id),
113
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
114
+ className: "truncate text-sm",
115
+ "data-report-title": true,
116
+ children: report.title
117
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
118
+ className: "font-mono text-xs text-muted",
119
+ "data-report-time": true,
120
+ children: formatReportTime(report.createdAt)
121
+ })]
122
+ }) }, report.id))
123
+ })
124
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidePanel, {
125
+ items: list.map((report) => report.id),
126
+ current: open?.id ?? null,
127
+ onSelect: select,
128
+ wide: true,
129
+ title: open ? `Report ${open.title}` : "Report",
130
+ children: open && src ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReportDetail, {
131
+ report: open,
132
+ src
133
+ }) : null
134
+ })]
135
+ });
136
+ }
137
+ // src/routes/reports.tsx?tsr-split=component
138
+ var SplitComponent = function ReportsRoute() {
139
+ const { companion } = Route.useSearch();
140
+ return companion ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Reports, { companion }) : null;
141
+ };
142
+ export { SplitComponent as component };