@uniqbit/mate-core 1.0.0-canary.6 → 1.0.0-canary.8

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 (249) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
  2. package/package.json +6 -3
  3. package/src/cli/commands/artifact/delivery/submit.ts +6 -4
  4. package/src/cli/commands/artifact/finish/command.ts +28 -11
  5. package/src/cli/commands/artifact/pending/command.ts +71 -7
  6. package/src/cli/commands/cap/tokensave.ts +2 -2
  7. package/src/cli/commands/companion/update.ts +2 -3
  8. package/src/cli/commands/doctor.ts +67 -4
  9. package/src/cli/commands/friction.ts +558 -0
  10. package/src/cli/commands/install.ts +8 -4
  11. package/src/cli/commands/plugin/install.ts +82 -35
  12. package/src/cli/commands/studio/connection.ts +53 -0
  13. package/src/cli/commands/studio/routes.ts +3 -0
  14. package/src/cli/commands/studio/selection.ts +10 -1
  15. package/src/cli/commands/studio/server.ts +31 -0
  16. package/src/cli/commands/studio/service-host.ts +3 -0
  17. package/src/cli/commands/studio/services.ts +25 -0
  18. package/src/cli/commands/triage.ts +172 -0
  19. package/src/cli/commands/vscode/release-vsix.json +2 -2
  20. package/src/cli/install-plan.tsx +3 -0
  21. package/src/cli/main.ts +85 -19
  22. package/src/cli/plugin-commands.ts +6 -1
  23. package/src/cli/usage.ts +12 -2
  24. package/src/create-mate.ts +11 -5
  25. package/src/distribution.ts +2 -0
  26. package/src/factory-host.ts +6 -0
  27. package/src/hooks/validate-artifact-path.ts +64 -14
  28. package/src/index.ts +1 -0
  29. package/src/lib/delivery/merge-git.ts +31 -7
  30. package/src/lib/delivery/overlap.ts +14 -1
  31. package/src/lib/delivery/repository-access.ts +11 -6
  32. package/src/lib/delivery/staging/apply-chain.ts +25 -7
  33. package/src/lib/delivery/staging/linked-merges.ts +175 -0
  34. package/src/lib/delivery/staging/naming.ts +3 -0
  35. package/src/lib/delivery/staging/openspec-type.ts +38 -7
  36. package/src/lib/delivery/staging/pending.ts +153 -11
  37. package/src/lib/delivery/staging/preflight.ts +239 -0
  38. package/src/lib/delivery/staging/project.ts +243 -104
  39. package/src/lib/delivery/staging/replay.ts +5 -3
  40. package/src/lib/delivery/staging/settle-linked.ts +5 -119
  41. package/src/lib/delivery/staging/submit.ts +139 -18
  42. package/src/lib/delivery/submit-change.ts +163 -37
  43. package/src/lib/friction/describe.ts +42 -0
  44. package/src/lib/friction/fields.ts +60 -0
  45. package/src/lib/friction/mark.ts +194 -0
  46. package/src/lib/friction/view/model.ts +67 -0
  47. package/src/lib/friction/view/read.ts +145 -0
  48. package/src/lib/friction/view/select.ts +54 -0
  49. package/src/lib/openspec-cli.ts +10 -5
  50. package/src/lib/orchestrator/adapters/claude.ts +5 -4
  51. package/src/lib/orchestrator/adapters/opencode.ts +2 -0
  52. package/src/lib/orchestrator/root-context.ts +23 -6
  53. package/src/lib/package-paths.ts +23 -15
  54. package/src/lib/session-attribution.ts +3 -7
  55. package/src/lib/skills-cli.ts +38 -0
  56. package/src/lib/tool-manifest.ts +73 -0
  57. package/src/lib/triage/context.ts +312 -0
  58. package/src/lib/triage/launch.ts +52 -0
  59. package/src/lib/triage/prepare.ts +112 -0
  60. package/src/lib/triage/session.ts +126 -0
  61. package/src/opencode/companion-hooks.ts +53 -5
  62. package/src/opencode/projected-guidance.ts +2 -0
  63. package/src/playbooks/companion-guidance.ts +2 -2
  64. package/src/plugin-api.ts +6 -0
  65. package/src/runtime/command-arg.ts +15 -0
  66. package/src/runtime/command-friction.ts +97 -0
  67. package/src/runtime/companion-guidance.ts +33 -16
  68. package/src/runtime/friction-fingerprint.ts +35 -0
  69. package/src/runtime/friction-log.ts +376 -0
  70. package/src/runtime/friction-recorder.ts +212 -0
  71. package/src/runtime/friction-retention.ts +1 -0
  72. package/src/runtime/friction-state.ts +110 -0
  73. package/src/runtime/friction-switch.ts +26 -0
  74. package/src/runtime/friction-vocabulary.ts +42 -0
  75. package/src/runtime/git-tracked.ts +13 -2
  76. package/src/runtime/projected-guidance.ts +2 -1
  77. package/src/runtime/secret-values.ts +16 -0
  78. package/src/runtime/session-id.ts +24 -0
  79. package/src/runtime/session-prepare-runner.ts +3 -0
  80. package/src/runtime/workflow/next-handoff-process.ts +2 -1
  81. package/src/studio.ts +47 -1
  82. package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +5 -1
  83. package/src/templates/capabilities/react-doctor/mate-react-doctor/SKILL.md +28 -0
  84. package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +42 -4
  85. package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +27 -2
  86. package/src/templates/mate-skills/agents/mate-backfill-spec/SKILL.md +23 -1
  87. package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +26 -1
  88. package/src/templates/mate-skills/agents/mate-domain-modeling/SKILL.md +28 -0
  89. package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +28 -3
  90. package/src/templates/mate-skills/agents/mate-grill-me/SKILL.md +28 -0
  91. package/src/templates/mate-skills/agents/mate-grill-with-docs/SKILL.md +28 -0
  92. package/src/templates/mate-skills/agents/mate-grilling/SKILL.md +25 -0
  93. package/src/templates/mate-skills/agents/mate-interview-me/SKILL.md +28 -0
  94. package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +28 -3
  95. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +28 -6
  96. package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +27 -2
  97. package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +28 -0
  98. package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +24 -2
  99. package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +42 -4
  100. package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +27 -2
  101. package/src/templates/mate-skills/claude/mate-backfill-spec/SKILL.md +23 -1
  102. package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +26 -1
  103. package/src/templates/mate-skills/claude/mate-domain-modeling/SKILL.md +28 -0
  104. package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +28 -3
  105. package/src/templates/mate-skills/claude/mate-grill-me/SKILL.md +28 -0
  106. package/src/templates/mate-skills/claude/mate-grill-with-docs/SKILL.md +28 -0
  107. package/src/templates/mate-skills/claude/mate-grilling/SKILL.md +25 -0
  108. package/src/templates/mate-skills/claude/mate-interview-me/SKILL.md +28 -0
  109. package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +28 -3
  110. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +28 -6
  111. package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +27 -2
  112. package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +28 -0
  113. package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +24 -2
  114. package/src/templates/triage/PLAYBOOK.md +120 -0
  115. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +108 -108
  116. package/src/tools/setup/capabilities/graphify.ts +23 -1
  117. package/src/tools/setup/capabilities/rtk.ts +46 -94
  118. package/src/tools/setup/capabilities/tokensave.ts +76 -54
  119. package/src/tools/setup/dynamic-plugins/audiences.ts +28 -14
  120. package/src/tools/setup/dynamic-plugins/hydrate.ts +32 -14
  121. package/src/tools/setup/dynamic-plugins/install.ts +2 -0
  122. package/src/tools/setup/dynamic-plugins/installed.ts +73 -0
  123. package/src/tools/setup/dynamic-plugins/loader.ts +12 -10
  124. package/src/tools/setup/dynamic-plugins/local.ts +492 -0
  125. package/src/tools/setup/dynamic-plugins/paths.ts +34 -6
  126. package/src/tools/setup/dynamic-plugins/verify.ts +34 -14
  127. package/src/tools/setup/dynamic-plugins/workspaces.ts +17 -8
  128. package/src/tools/setup/mate.ts +26 -1
  129. package/src/tools/setup/plugin.ts +5 -0
  130. package/src/tools/setup/plugins/gitignore.ts +45 -12
  131. package/src/tools/setup/service.ts +12 -0
  132. package/src/tools/setup/utils.ts +10 -1
  133. package/src/tools/setup.ts +16 -2
  134. package/studio-dist/client/assets/app-ggXJ_QVh.css +2 -0
  135. package/studio-dist/client/assets/button-amJ3g5oD.js +1 -0
  136. package/studio-dist/client/assets/cn-BQPKiwI4.js +1 -0
  137. package/studio-dist/client/assets/combobox-CJ7aGFid.js +1 -0
  138. package/studio-dist/client/assets/{companion-view-BVaZNtiI.js → companion-view-C_N237bf.js} +1 -1
  139. package/studio-dist/client/assets/fields-BAiGkJ5N.js +1 -0
  140. package/studio-dist/client/assets/friction-DqOU59v7.js +1 -0
  141. package/studio-dist/client/assets/getting-started-djaQeWlu.js +1 -0
  142. package/studio-dist/client/assets/getting-started-yp42dj5S.js +1 -0
  143. package/studio-dist/client/assets/getting-started._topic-C9zVXz_m.js +1 -0
  144. package/studio-dist/client/assets/getting-started.index-DWbDKICP.js +1 -0
  145. package/studio-dist/client/assets/graph-BYaD_5Bq.js +2 -0
  146. package/studio-dist/client/assets/{graph-canvas-DDuzsNSx.js → graph-canvas-ySGKMhmk.js} +1 -1
  147. package/studio-dist/client/assets/guides-D6T6W_jV.js +1 -0
  148. package/studio-dist/client/assets/index-Qx7reRPD.js +40 -0
  149. package/studio-dist/client/assets/markdown-view-jMiaBTSO.js +1 -0
  150. package/studio-dist/client/assets/panel-C4bf_h2W.js +1 -0
  151. package/studio-dist/client/assets/plugins._service._view-y6f2FDAB.js +1 -0
  152. package/studio-dist/client/assets/prepaint-CKsXyJOR.js +27 -0
  153. package/studio-dist/client/assets/{queries-axYk2u9L.js → queries-Dfp5deWj.js} +1 -1
  154. package/studio-dist/client/assets/react-BYUSgtBs.js +1 -0
  155. package/studio-dist/client/assets/reports-JFSwSueq.js +1 -0
  156. package/studio-dist/client/assets/routes-BdOWSgzK.js +1 -0
  157. package/studio-dist/client/assets/search-CXosfvYh.js +1 -0
  158. package/studio-dist/client/assets/select-BHYYWPhK.js +1 -0
  159. package/studio-dist/client/assets/skills-Bo9FLsBd.js +1 -0
  160. package/studio-dist/client/assets/{specs-DU1kqcp5.js → specs-BrCOjOch.js} +1 -1
  161. package/studio-dist/client/assets/specs-view-CdE2rlli.js +1 -0
  162. package/studio-dist/client/assets/{steps-DhIFuAZy.js → steps-CKUno4lh.js} +1 -1
  163. package/studio-dist/client/assets/store-C3vJq8Wj.js +1 -0
  164. package/studio-dist/client/assets/{studio-BR9j15J0.js → studio-0ueISxwP.js} +8 -8
  165. package/studio-dist/client/assets/{studio-queries-CFP_yTpr.js → studio-queries-BflKt9va.js} +2 -2
  166. package/studio-dist/client/assets/{usage-CHmwtkoM.js → usage-BLsLy0nN.js} +16 -16
  167. package/studio-dist/client/assets/useAnchoredPopupScrollLock-DC7f8GOp.js +1 -0
  168. package/studio-dist/client/assets/useMutation-uJUrejsi.js +1 -0
  169. package/studio-dist/client/assets/vault-BB1B_OhR.js +1 -0
  170. package/studio-dist/client/assets/warnings-CqOOGlPD.js +1 -0
  171. package/studio-dist/client/assets/workflow-BFzmI-06.js +1 -0
  172. package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-DAbZ6fzY.js → __23tanstack-start-server-fn-resolver-gVfW5vIV.js} +30 -14
  173. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +66 -50
  174. package/studio-dist/server/assets/{button-BfoNadNR.js → button-D6bvrFmm.js} +226 -3478
  175. package/studio-dist/server/assets/cn-FXJAM0KO.js +5528 -0
  176. package/studio-dist/server/assets/combobox-D2MbYV1O.js +484 -0
  177. package/studio-dist/server/assets/{companion-view-DHUjPpA0.js → companion-view-Mf1ANbMb.js} +2 -2
  178. package/studio-dist/server/assets/{companions-kBrJZAd6.js → companions-Dr6IpNAb.js} +1 -1
  179. package/studio-dist/server/assets/{fields-BD_c65T1.js → fields-B4mAPETz.js} +2 -1
  180. package/studio-dist/server/assets/friction-9a5S1m7U.js +943 -0
  181. package/studio-dist/server/assets/friction-CWOTjpCV.js +62 -0
  182. package/studio-dist/server/assets/{getting-started-7P0oyWaM.js → getting-started-RU6tYU2Q.js} +2 -2
  183. package/studio-dist/server/assets/{getting-started._topic-B1mV0kGz.js → getting-started._topic-C02HGrC6.js} +2 -2
  184. package/studio-dist/server/assets/{getting-started.index-CeGtvUsm.js → getting-started.index-EzLRosbb.js} +2 -2
  185. package/studio-dist/server/assets/{graph-BWtmJOH2.js → graph-B11ITte0.js} +1 -1
  186. package/studio-dist/server/assets/{graph-DSDVEELZ.js → graph-CZ2H9Fzr.js} +8 -8
  187. package/studio-dist/server/assets/{graph-canvas-CID9Nksc.js → graph-canvas-rP5TT14Z.js} +2 -2
  188. package/studio-dist/server/assets/{guides-Bm3RbUB-.js → guides-B8HdeK_C.js} +1 -1
  189. package/studio-dist/server/assets/{guides-BLJenHwQ.js → guides-BGftp4wf.js} +1 -1
  190. package/studio-dist/server/assets/{guides.server-rHHqRuzV.js → guides.server-DqFQAStf.js} +1 -1
  191. package/studio-dist/server/assets/{markdown-view-D3v9x-cM.js → markdown-view-CArpV-CS.js} +1 -1
  192. package/studio-dist/server/assets/{panel-yqOl5GMU.js → panel-DR0iq46J.js} +4 -3
  193. package/studio-dist/server/assets/{plugins._service._view-DwqJX7s9.js → plugins._service._view-n7u2k5dF.js} +11 -6
  194. package/studio-dist/server/assets/prepaint-B28ClcPN.js +45 -0
  195. package/studio-dist/server/assets/{queries-DYmGrhNO.js → queries-D-yVP9i0.js} +1 -1
  196. package/studio-dist/server/assets/react-CiBZPDs8.js +45 -0
  197. package/studio-dist/server/assets/{reports-C4Y_Jd-x.js → reports-B9k98oE6.js} +1 -1
  198. package/studio-dist/server/assets/{reports-7yaPz7aP.js → reports-C2SmTgqh.js} +7 -7
  199. package/studio-dist/server/assets/{router-Dnoq5auE.js → router-CPt0TAk_.js} +654 -1565
  200. package/studio-dist/server/assets/{routes-Cok4p3mK.js → routes-CwH8LEy2.js} +8 -8
  201. package/studio-dist/server/assets/{search-DUK7Jl6f.js → search-b-yQesv3.js} +25 -2
  202. package/studio-dist/server/assets/{combobox-oxUI6r4V.js → select-C3i6TTX-.js} +35 -514
  203. package/studio-dist/server/assets/{shell-DNVXedgE.js → shell-CagqZZMZ.js} +4 -3
  204. package/studio-dist/server/assets/{skills-D8qdXSku.js → skills-C21Mg_8-.js} +8 -8
  205. package/studio-dist/server/assets/{skills-pKmuAs0F.js → skills-DGg0mWDM.js} +1 -1
  206. package/studio-dist/server/assets/{specs-DeHYUNFp.js → specs-DetoMiaB.js} +4 -4
  207. package/studio-dist/server/assets/{specs-view-BGn-5Ik_.js → specs-view-CmbfLDwN.js} +10 -9
  208. package/studio-dist/server/assets/{steps-CV7Yk7L7.js → steps-D1tYAyWZ.js} +1 -1
  209. package/studio-dist/server/assets/store-aC-I6f6o.js +93 -0
  210. package/studio-dist/server/assets/{studio-CB94np48.js → studio-qRvQjRpz.js} +47 -2
  211. package/studio-dist/server/assets/{studio-queries-BqZGBE70.js → studio-queries-Dqf-3nzj.js} +66 -8
  212. package/studio-dist/server/assets/{usage-M6Gi6Km7.js → usage-CS4CBK9D.js} +13 -44
  213. package/studio-dist/server/assets/{usage-j5jR9gX9.js → usage-Cwle9-xY.js} +1 -1
  214. package/studio-dist/server/assets/useAnchoredPopupScrollLock-BjMNgXv9.js +756 -0
  215. package/studio-dist/server/assets/useMutation-DpBIuWXt.js +690 -0
  216. package/studio-dist/server/assets/{vault-lBlvSyD4.js → vault-CEBBRLMb.js} +1 -1
  217. package/studio-dist/server/assets/{vault-PqVmssmW.js → vault-DVQidlId.js} +6 -6
  218. package/studio-dist/server/assets/{views-CsFp1i1G.js → views-UgO0Qz_g.js} +2 -2
  219. package/studio-dist/server/assets/{warnings-BDs34j_m.js → warnings-C7hgXpdk.js} +2 -2
  220. package/studio-dist/server/assets/{workflow-T0eEldsa.js → workflow-6dZZ1ofw.js} +9 -9
  221. package/studio-dist/server/server.js +2 -2
  222. package/tool-manifest.yaml +85 -0
  223. package/studio-dist/client/assets/app-BFVyWHGo.css +0 -2
  224. package/studio-dist/client/assets/button-D6LrRkOG.js +0 -1
  225. package/studio-dist/client/assets/combobox-Dk2MMZWE.js +0 -1
  226. package/studio-dist/client/assets/fields-D_FYhxQr.js +0 -1
  227. package/studio-dist/client/assets/getting-started-ByWRg7hC.js +0 -1
  228. package/studio-dist/client/assets/getting-started-DZSjYC-b.js +0 -1
  229. package/studio-dist/client/assets/getting-started._topic-C6OyQ4G6.js +0 -1
  230. package/studio-dist/client/assets/getting-started.index-BkmPHdEm.js +0 -1
  231. package/studio-dist/client/assets/graph-7jm2XzyL.js +0 -2
  232. package/studio-dist/client/assets/guides-D9VTjWXP.js +0 -1
  233. package/studio-dist/client/assets/index-BBmFpG4y.js +0 -40
  234. package/studio-dist/client/assets/markdown-view-RL5YvfZg.js +0 -1
  235. package/studio-dist/client/assets/panel-B8F8sOKQ.js +0 -1
  236. package/studio-dist/client/assets/plugins._service._view-CynxTbMx.js +0 -1
  237. package/studio-dist/client/assets/react-r45OnJCw.js +0 -27
  238. package/studio-dist/client/assets/reports-BCAyXh6p.js +0 -1
  239. package/studio-dist/client/assets/routes-BFPqq89E.js +0 -1
  240. package/studio-dist/client/assets/skills-DTks_uBx.js +0 -1
  241. package/studio-dist/client/assets/specs-view-omrd_5P3.js +0 -1
  242. package/studio-dist/client/assets/store-DJ5cncKA.js +0 -1
  243. package/studio-dist/client/assets/useBaseQuery-BlC-AZ35.js +0 -1
  244. package/studio-dist/client/assets/vault-DRg8MScm.js +0 -1
  245. package/studio-dist/client/assets/warnings-UHFy6HAp.js +0 -1
  246. package/studio-dist/client/assets/workflow-Bv9vSfVV.js +0 -1
  247. package/studio-dist/server/assets/react-BO0uMhpm.js +0 -89
  248. package/studio-dist/server/assets/store-CWDGIp6x.js +0 -280
  249. package/studio-dist/server/assets/useBaseQuery-Tv_QJt9r.js +0 -2051
@@ -1 +0,0 @@
1
- import{J as e}from"./studio-queries-CFP_yTpr.js";import{a as t,n,t as r}from"./jsx-runtime-MZURdZre.js";var i=t(n(),1),a=r(),o=new Set(`h1.h2.h3.h4.h5.h6.p.pre.code.span.blockquote.hr.ol.ul.li.div.dl.dt.dd.table.thead.tbody.tr.th.td.strong.em.del.br`.split(`.`));function s(t,n,r){let s=t.c?.map((e,t)=>c(e,t,r)),{a:l}=t;if(t.t===`a`){if(r&&l?.guide){let[t,i]=l.guide.split(`#`);return t&&!/^\/getting-started(?:\/(?:worktrees|vscode))?$/.test(t)?(0,a.jsx)(`span`,{children:s},n):(0,a.jsx)(e,{to:t||`.`,hash:i,search:r,children:s},n)}return l?.note?(0,a.jsx)(e,{to:`/vault`,search:e=>({...e,path:l.note,dir:void 0,mode:void 0}),"data-vault-entry":l.note,children:s},n):l?.href&&/^https?:\/\//i.test(l.href)?(0,a.jsx)(`a`,{href:l.href,target:`_blank`,rel:`noopener noreferrer`,children:s},n):(0,a.jsx)(`span`,{children:s},n)}return t.t===`input`?(0,a.jsx)(`input`,{type:`checkbox`,checked:!!l?.checked,disabled:!0,readOnly:!0,"aria-label":`Task`},n):o.has(t.t)?(r&&l?.id&&s&&s.push((0,a.jsx)(e,{to:`.`,hash:l.id,search:r,className:`guide-anchor`,"aria-label":`Link to ${l.id}`,children:`#`},`anchor`)),(0,i.createElement)(t.t,{key:n,className:l?.className,id:r?l?.id:void 0,tabIndex:r&&l?.id?-1:void 0,start:l?.start,style:l?.align?{textAlign:l.align}:void 0},s&&s.length>0?s:void 0)):(0,a.jsx)(`span`,{children:s},n)}function c(e,t,n){return typeof e==`string`?e:s(e,t,n)}function l({nodes:e,guideSearch:t}){return(0,a.jsx)(`div`,{className:`markdown-body`,children:e.map((e,n)=>c(e,n,t))})}export{l as t};
@@ -1 +0,0 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-MZURdZre.js";import{Tr as r,r as i,t as a}from"./button-D6LrRkOG.js";import{C as o,D as s,E as c,O as l,T as u,k as d,w as f}from"./index-BBmFpG4y.js";import{n as p}from"./fields-D_FYhxQr.js";var m=e(t(),1),h=n();function g(e){return(0,h.jsx)(u,{"data-slot":`sheet`,...e})}var _=l;function v({className:e,wide:t=!1,...n}){return(0,h.jsxs)(c,{children:[(0,h.jsx)(d,{"data-slot":`sheet-overlay`,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`}),(0,h.jsx)(s,{"data-slot":`sheet-content`,"data-wide":t?``:void 0,className:r(`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))]`,e),...n})]})}function y({className:e,...t}){return(0,h.jsx)(f,{"data-slot":`sheet-title`,className:r(`m-0 text-lg font-semibold break-words`,e),...t})}function b({items:e,current:t,onSelect:n,pass:r,wide:s,title:c,children:l}){let u=(0,m.useRef)(null),d=t!==null,f=t===null?-1:e.indexOf(t),b=f>0?e[f-1]:void 0,x=f>=0&&f<e.length-1?e[f+1]:void 0;(0,m.useEffect)(()=>{let e=e=>{let t=e.target;t?.closest&&!t.closest(`[data-slot=sheet-content]`)&&(u.current=t)};return document.addEventListener(`focusin`,e),()=>document.removeEventListener(`focusin`,e)},[]);let S=(0,m.useEffectEvent)(e=>{if(e.metaKey||e.ctrlKey||e.altKey||o(e.target))return;let t=e.key===`ArrowRight`?x:e.key===`ArrowLeft`?b:void 0;t!==void 0&&(e.preventDefault(),n(t))});return(0,m.useEffect)(()=>{if(!d)return;let e=e=>S(e);return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[d]),(0,h.jsx)(g,{open:d,onOpenChange:e=>{e||n(null)},children:(0,h.jsxs)(v,{wide:s,"aria-label":c,finalFocus:()=>!u.current?.isConnected||u.current,initialFocus:()=>document.getElementById(`side-panel-close`),children:[(0,h.jsx)(y,{className:`sr-only`,children:c}),(0,h.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-rule py-2.5 pr-3 pl-5`,children:[(0,h.jsxs)(`span`,{className:`mr-auto font-mono text-xs text-muted`,"aria-live":`polite`,children:[f>=0?`${f+1} of ${e.length}`:null,r?` · ${r}`:null]}),(0,h.jsx)(a,{size:`icon-sm`,variant:`ghost`,"aria-label":`Previous`,disabled:b===void 0,onClick:()=>b!==void 0&&n(b),children:(0,h.jsx)(i,{name:`left`})}),(0,h.jsx)(a,{size:`icon-sm`,variant:`ghost`,"aria-label":`Next`,disabled:x===void 0,onClick:()=>x!==void 0&&n(x),children:(0,h.jsx)(i,{name:`right`})}),(0,h.jsx)(_,{id:`side-panel-close`,render:(0,h.jsx)(a,{size:`icon-sm`,variant:`ghost`,"aria-label":`Close`}),children:(0,h.jsx)(i,{name:`close`})})]}),(0,h.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-auto`,children:l}),(0,h.jsxs)(`div`,{className:`flex gap-3.5 border-t border-rule px-5 py-2.5 text-2xs text-muted max-sm:hidden`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,h.jsx)(p,{children:`←`}),(0,h.jsx)(p,{children:`→`}),` previous, next`]}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,h.jsx)(p,{children:`esc`}),` close`]})]})]})})}function x({kicker:e,title:t,mono:n=!1,children:r}){return(0,h.jsxs)(`div`,{className:`grid gap-1.5 border-b border-rule px-5 pt-4 pb-3.5`,children:[e?(0,h.jsx)(`div`,{className:`flex items-center gap-2 text-xs text-muted`,children:e}):null,(0,h.jsx)(`h2`,{className:n?`m-0 font-mono text-md font-semibold break-words`:`m-0 text-lg font-semibold`,children:t}),r]})}function S({title:e,aside:t,children:n}){return(0,h.jsxs)(`section`,{className:`grid gap-2.5 border-b border-rule-soft px-5 py-4`,"aria-label":e,children:[(0,h.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-sm font-semibold`,children:[e,t?(0,h.jsx)(`span`,{className:`ml-auto font-mono text-2xs font-normal text-muted`,children:t}):null]}),n]})}export{S as n,b as r,x as t};
@@ -1 +0,0 @@
1
- import{t as e,xt as t,yt as n}from"./index-BBmFpG4y.js";import"./studio-BR9j15J0.js";import{u as r}from"./studio-queries-CFP_yTpr.js";import{a as i,n as a,t as o}from"./jsx-runtime-MZURdZre.js";var s=i(a(),1),c=o(),l=e=>import(e);async function u(e,t,n,r=l){let i=(await r(t)).mount;if(typeof i!=`function`)throw Error(`the view module has no mount export`);let a=i(e,n);return typeof a==`function`?a:()=>{}}function d({moduleUrl:e,context:t,load:n}){let r=(0,s.useRef)(null),[i,a]=(0,s.useState)(null),{companion:o,apiBase:l,writable:d}=t;return(0,s.useEffect)(()=>{let t=r.current;if(!t)return;let i=null,s=!1;return a(null),u(t,e,{companion:o,apiBase:l,writable:d},n).then(e=>{s?e():i=e},e=>{s||a(e instanceof Error?e.message:String(e))}),()=>{s=!0,i?.(),t.replaceChildren()}},[e,o,l,d,n]),(0,c.jsxs)(`section`,{className:`plugin-view mx-8 min-h-0 flex-1 max-sm:mx-4`,children:[i?(0,c.jsxs)(`p`,{className:`m-0 rounded-card border border-dashed border-rule px-6 py-7 text-muted`,children:[`The view could not load: `,i]}):null,(0,c.jsx)(`div`,{ref:r,"data-plugin-view":e})]})}var f=function(){let{service:i,view:a}=e.useParams(),o=e.useSearch(),{data:s}=t(r(o)),l=s.pluginViews.find(e=>e.service===i&&e.view===a);return l?(0,c.jsx)(d,{moduleUrl:l.moduleUrl,context:{companion:s.selected?.digest??null,apiBase:`${n}${i}`,writable:s.writable}}):(0,c.jsx)(`section`,{className:`mx-8 max-sm:mx-4`,children:(0,c.jsx)(`p`,{className:`empty m-0 rounded-card border border-dashed border-rule px-6 py-7 text-muted`,children:`No running service offers this view.`})})};export{f as component};
@@ -1,27 +0,0 @@
1
- import{a as e,n as t}from"./jsx-runtime-MZURdZre.js";import{g as n,h as r}from"./studio-BR9j15J0.js";var i=`mate-studio-theme`,a=`mate-studio-companion`,o=`mate-studio-vault-tree`,s=`mate-studio-rail`,c=`(function () {
2
- try {
3
- var chosen = localStorage.getItem(${JSON.stringify(i)});
4
- if (chosen === "dark" || chosen === "light") {
5
- document.documentElement.setAttribute("data-theme", chosen);
6
- }
7
- if (localStorage.getItem(${JSON.stringify(o)}) === "hidden") {
8
- document.documentElement.setAttribute("data-vault-tree", "hidden");
9
- }
10
- if (localStorage.getItem(${JSON.stringify(s)}) === "min") {
11
- document.documentElement.setAttribute("data-rail", "min");
12
- }
13
- } catch (error) {
14
- /* a blocked web store only costs the preference, never the page */
15
- }
16
-
17
- try {
18
- var params = new URLSearchParams(location.search);
19
- var last = localStorage.getItem(${JSON.stringify(a)});
20
- if (!params.has(${JSON.stringify(n)}) && ${String(r)}.test(last || "")) {
21
- params.set(${JSON.stringify(n)}, last);
22
- location.replace(location.pathname + "?" + params.toString());
23
- }
24
- } catch (error) {
25
- /* a blocked web store only costs the restore, never the page */
26
- }
27
- })();`,l=e(t(),1),u=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},d=(e=>e?u(e):u),f=e=>e;function p(e,t=f){let n=l.useSyncExternalStore(e.subscribe,l.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return l.useDebugValue(n),n}var m=e=>{let t=d(e),n=e=>p(t,e);return Object.assign(n,t),n},h=(e=>e?m(e):m);export{i as a,c as i,a as n,o,s as r,h as t};
@@ -1 +0,0 @@
1
- import{Dr as e,Tr as t,r as n}from"./button-D6LrRkOG.js";import{a as r,t as i}from"./useSelector-AYcH7lB0.js";import{Z as a,l as o}from"./studio-queries-CFP_yTpr.js";import{a as s,n as c,t as l}from"./jsx-runtime-MZURdZre.js";import{c as u,f as d,o as f,s as p}from"./store-DJ5cncKA.js";import{r as m,t as h}from"./panel-B8F8sOKQ.js";import{l as g,lt as _,st as v,vt as y}from"./index-BBmFpG4y.js";import"./studio-BR9j15J0.js";function b(e){let t=r();return i(t.stores.location,a(e,t))}var x=s(c(),1),S=e=>String(e).padStart(2,`0`);function C(e){let t=new Date(e);return`${t.getFullYear()}-${S(t.getMonth()+1)}-${S(t.getDate())} ${S(t.getHours())}:${S(t.getMinutes())}`}function w(e,t){let n=t===`system`?``:`?scheme=${t}`;return`${y}${e}${n}`}var T=l(),E=/(?:^|[#&])report=([0-9a-f]{32})/;function D(e){try{let t=`${location.pathname}${location.search}${e?`#report=${e}`:``}`;history.replaceState(history.state,``,t)}catch{}}function O({report:e,src:t}){return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(h,{title:e.title,kicker:(0,T.jsx)(`span`,{children:C(e.createdAt)}),children:(0,T.jsxs)(`a`,{id:`reports-open`,className:`inline-flex items-center gap-1.5 text-sm`,href:t,target:`_blank`,rel:`noopener noreferrer`,children:[(0,T.jsx)(n,{name:`external`,className:`size-3.5`}),` Open in new tab`]})}),(0,T.jsx)(`iframe`,{id:`reports-frame`,className:`min-h-0 w-full flex-1 border-0 bg-page`,title:`Hosted report`,sandbox:`allow-scripts allow-modals`,referrerPolicy:`no-referrer`,src:t},t)]})}function k({companion:n}){let r=e(o(n)),i=v(e=>e.theme),a=_(e=>e.clearReports),s=E.exec(b({select:e=>`#${e.hash}`}))?.[1],[c,l]=(0,x.useState)(void 0);(0,x.useEffect)(a,[a]);let h=r.data??[],g=c===void 0?s??null:c,y=h.find(e=>e.id===g)??null,S=e=>{l(e),D(e)},k=y?w(y.id,i):null;return(0,T.jsxs)(`section`,{className:t(u,`grid content-start gap-3 pb-10`),"data-reports-view":!0,"aria-label":`Hosted reports`,children:[h.length===0?(0,T.jsx)(f,{children:(0,T.jsx)(`span`,{id:`reports-empty`,children:`No hosted reports yet.`})}):(0,T.jsx)(p,{title:`Reports`,count:h.length,hint:`Newest first`,children:(0,T.jsx)(`ul`,{id:`reports-list`,className:`m-0 list-none p-0`,"aria-label":`Reports`,children:h.map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,className:t(d,`grid grid-cols-[minmax(0,1fr)_auto]`),"data-report-id":e.id,"aria-current":e.id===y?.id?`true`:void 0,onClick:()=>S(e.id),children:[(0,T.jsx)(`span`,{className:`truncate text-sm`,"data-report-title":!0,children:e.title}),(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted`,"data-report-time":!0,children:C(e.createdAt)})]})},e.id))})}),(0,T.jsx)(m,{items:h.map(e=>e.id),current:y?.id??null,onSelect:S,wide:!0,title:y?`Report ${y.title}`:`Report`,children:y&&k?(0,T.jsx)(O,{report:y,src:k}):null})]})}var A=function(){let{companion:e}=g.useSearch();return e?(0,T.jsx)(k,{companion:e}):null};export{A as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./companion-view-BVaZNtiI.js";import{J as t,Y as n,f as r,m as i}from"./studio-queries-CFP_yTpr.js";import{a,n as o,t as s}from"./jsx-runtime-MZURdZre.js";import{Dr as c,Tr as l,r as u,t as d}from"./button-D6LrRkOG.js";import{a as f,c as p,d as m,f as h,i as g,o as ee,p as _,r as v,s as y,u as b}from"./store-DJ5cncKA.js";import{n as x,r as S,t as C}from"./panel-B8F8sOKQ.js";import{t as w}from"./warnings-UHFy6HAp.js";import{t as T}from"./markdown-view-RL5YvfZg.js";import{S as te,_ as ne,b as E,d as D,g as O,h as k,v as A,x as j,y as re}from"./index-BBmFpG4y.js";var M=a(o(),1);function ie(e){let t=new Set,n=[];for(let r of e)for(let e of r.specs)t.has(e)||(t.add(e),n.push({capability:e,change:r.name,archivedOn:r.archivedOn}));return n}var N=s(),ae=20,P=12,F=`openspec/changes/archive`,I=e=>`openspec/specs/${e}/spec.md`,L=l(h,`grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 py-2`);function R({payload:e}){let[t,n]=(0,M.useState)(null),r=e.shipped.slice(0,ae),i=r.find(e=>e.anchor===t)??null;return(0,N.jsxs)(`div`,{className:`analyst-overview`,children:[(0,N.jsx)(w,{warnings:e.warnings}),(0,N.jsx)(`div`,{className:l(p,`@container pb-10`),children:(0,N.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1.5fr)_minmax(0,1fr)] items-start gap-3 @max-[760px]:grid-cols-1`,children:[(0,N.jsx)(V,{all:e.shipped.length,shown:r,current:t,onOpen:n}),(0,N.jsx)(U,{shipped:e.shipped})]})}),(0,N.jsx)(S,{items:r.map(e=>e.anchor),current:i?.anchor??null,onSelect:n,title:i?`Shipped change ${i.name}`:`Shipped change`,children:i?(0,N.jsx)(H,{change:i}):null})]})}function z(e){let t=[];for(let n of e){let e=t.at(-1);e?.[0]===n.archivedOn?e[1].push(n):t.push([n.archivedOn,[n]])}return t}function B(e){let t=new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(`en`,{weekday:`long`,timeZone:`UTC`})}function V({all:e,shown:t,current:n,onOpen:r}){return(0,N.jsx)(y,{title:`Recently shipped`,count:e,hint:e>t.length?`newest ${t.length}`:void 0,children:t.length===0?(0,N.jsx)(`p`,{className:`empty m-0 px-4 py-3 text-sm text-muted`,children:`No shipped changes yet.`}):(0,N.jsx)(`ol`,{className:`analyst-days m-0 list-none p-0`,children:z(t).map(([e,t])=>(0,N.jsxs)(`li`,{className:`border-t border-rule first:border-t-0`,children:[(0,N.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 bg-[color-mix(in_srgb,var(--surface)_45%,transparent)] px-4 pt-2.5 pb-1.5 text-xs font-semibold text-muted`,children:[(0,N.jsx)(`time`,{dateTime:e,className:`font-mono text-text`,children:e}),B(e),(0,N.jsx)(f,{value:t.length})]}),(0,N.jsx)(`ol`,{className:`analyst-list m-0 list-none p-0`,children:t.map(e=>(0,N.jsx)(`li`,{children:(0,N.jsxs)(`button`,{type:`button`,className:l(h,`grid gap-0.5 py-2`),"aria-current":n===e.anchor?`true`:void 0,onClick:()=>r(e.anchor),children:[(0,N.jsx)(`span`,{className:`analyst-row-title truncate font-mono text-sm`,children:e.name}),(0,N.jsx)(`span`,{className:`truncate text-xs text-muted`,children:e.specs.length===0?`no spec changes`:e.specs.join(`, `)})]})},e.anchor))})]},e))})})}function H({change:e}){let n=`${F}/${e.anchor}`;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(C,{mono:!0,title:e.name,kicker:(0,N.jsxs)(`span`,{children:[`Shipped `,e.archivedOn]})}),(0,N.jsx)(x,{title:`Proposal`,children:e.hasProposal?(0,N.jsxs)(t,{className:`inline-flex items-center gap-2 text-sm`,to:`/vault`,search:e=>({...e,path:`${n}/proposal.md`}),children:[(0,N.jsx)(u,{name:`doc`}),` Read the proposal`]}):(0,N.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`This change has no proposal.`,` `,(0,N.jsx)(t,{to:`/vault`,search:e=>({...e,dir:n}),children:`Open its folder`})]})}),(0,N.jsx)(x,{title:`Specs it changed`,aside:String(e.specs.length),children:e.specs.length===0?(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No spec changed.`}):(0,N.jsx)(`ul`,{className:`m-0 grid list-none gap-1 p-0`,children:e.specs.map(e=>(0,N.jsx)(`li`,{children:(0,N.jsx)(t,{className:`font-mono text-sm`,to:`/vault`,search:t=>({...t,path:I(e)}),children:e})},e))})})]})}function U({shipped:e}){let n=ie(e).slice(0,P);return(0,N.jsx)(y,{title:`Recently changed specs`,hint:(0,N.jsx)(t,{to:`/specs`,search:e=>e,children:`All specs`}),children:n.length===0?(0,N.jsx)(`p`,{className:`empty m-0 px-4 py-3 text-sm text-muted`,children:`No specs changed by shipped changes yet.`}):(0,N.jsx)(`ol`,{className:`analyst-list m-0 list-none p-0`,children:n.map((e,r)=>(0,N.jsx)(`li`,{children:(0,N.jsxs)(t,{className:L,to:`/vault`,search:t=>({...t,path:I(e.capability)}),children:[(0,N.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,N.jsx)(`span`,{className:`analyst-row-title truncate font-mono text-sm`,children:e.capability}),(0,N.jsxs)(`span`,{className:`truncate text-xs text-muted`,children:[`by `,e.change]})]}),(0,N.jsx)(`span`,{className:`font-mono text-xs text-muted`,children:e.archivedOn===n[r-1]?.archivedOn?null:e.archivedOn})]})},e.capability))})})}var W={accent:`before:bg-accent`,warn:`before:bg-warn`,why:`before:bg-why`,bad:`before:bg-bad`},G={accent:`bg-accent`,warn:`bg-warn`,why:`bg-why`,bad:`bg-bad`},K={accent:`text-text`,warn:`text-warn`,why:`text-why`,bad:`text-bad`};function q({steps:e,current:t,tone:n}){let r=`Step ${t+1} of ${e.length} · ${e[t]}`;return t<0?r=`Saved for later`:t>=e.length&&(r=`Delivered`),(0,N.jsxs)(`div`,{className:`grid gap-2`,role:`group`,"aria-label":`Delivery Path`,children:[(0,N.jsx)(`p`,{className:l(`m-0 text-xs font-semibold`,t>=0?K[n]:`text-muted`),children:r}),(0,N.jsx)(`ol`,{className:`m-0 grid list-none gap-1 p-0`,style:{gridTemplateColumns:`repeat(${e.length}, minmax(0, 1fr))`},children:e.map((e,r)=>(0,N.jsx)(`li`,{"aria-current":r===t?`step`:void 0,className:l(`h-1 rounded-full bg-rule`,r<t&&`bg-[color-mix(in_srgb,var(--accent)_55%,var(--border))]`,r===t&&G[n]),children:(0,N.jsx)(`span`,{className:`sr-only`,children:e})},e))})]})}function J({steps:e,current:t,tone:n=`accent`,compact:r=!1}){return r?(0,N.jsx)(q,{steps:e,current:t,tone:n}):(0,N.jsx)(`ol`,{className:`m-0 grid list-none gap-1 p-0`,style:{gridTemplateColumns:`repeat(${e.length}, minmax(0, 1fr))`},"aria-label":`Delivery Path`,children:e.map((e,r)=>(0,N.jsx)(`li`,{"aria-current":r===t?`step`:void 0,className:l(`grid gap-1.5 text-2xs text-muted before:h-1 before:rounded-full before:bg-rule before:content-['']`,r<t&&`before:bg-[color-mix(in_srgb,var(--accent)_55%,var(--border))]`,r===t&&`font-semibold text-text`,r===t&&W[n]),children:e},e))})}var oe=`openspec/changes`,Y=e=>`${oe}/${e.name}`,X=`flex w-full min-w-0 items-center gap-2.5 rounded-control border-0 bg-transparent px-2 py-1 text-left text-sm text-text hover:bg-surface-soft disabled:cursor-default disabled:hover:bg-transparent`;function se({done:e}){return(0,N.jsx)(`span`,{className:l(`grid size-3.5 flex-none place-items-center rounded-[4px] border`,e?`border-accent bg-accent text-on-accent`:`border-rule bg-page`),"aria-hidden":`true`,children:e?(0,N.jsx)(u,{name:`check`,className:`size-2.5 [stroke-width:2.4]`}):null})}function ce({companion:e,dir:n,onRead:i}){let a=c(r(e,`${n}/specs`));if(a.isPending)return(0,N.jsx)(`p`,{className:`m-0 pl-8 text-xs text-muted`,children:`Listing specs…`});let o=(a.data?.entries??[]).filter(e=>e.kind===`directory`);return a.isError||o.length===0?(0,N.jsx)(`p`,{className:`m-0 pl-8 text-xs text-muted`,children:(0,N.jsx)(t,{to:`/vault`,search:e=>({...e,dir:`${n}/specs`}),children:`Open the specs folder`})}):(0,N.jsx)(`ul`,{className:`m-0 grid list-none gap-0.5 p-0 pl-6`,children:o.map(e=>(0,N.jsx)(`li`,{children:(0,N.jsxs)(`button`,{type:`button`,className:X,"data-artifact-file":`${e.path}/spec.md`,onClick:()=>i(`${e.path}/spec.md`),children:[(0,N.jsx)(u,{name:`doc`,className:`flex-none text-muted`}),(0,N.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e.name})]})},e.path))})}function le(e){return e.declared?e.folder?`folder`:`read`:e.done?e.folder?`per capability`:`read`:`not yet`}function ue({change:e,companion:t,onRead:n}){if(e.artifacts.length===0)return(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No artifacts yet.`});let r=Y(e);return(0,N.jsx)(`ul`,{className:`m-0 -mx-2 grid list-none gap-0.5 p-0`,children:e.artifacts.map(e=>{let i=e.path!==void 0,a=e.status===`done`,o=(a||i)&&t!==void 0,s=e.path===void 0?e.id===`specs`:e.path.endsWith(`/`);return(0,N.jsxs)(`li`,{children:[(0,N.jsxs)(`button`,{type:`button`,className:X,disabled:!o||s,"data-artifact":e.id,onClick:()=>n(e.path??`${r}/${e.id}.md`),children:[i?null:(0,N.jsx)(se,{done:a}),(0,N.jsx)(`span`,{className:a||i?`text-text`:`text-muted`,children:e.id}),(0,N.jsx)(`span`,{className:`ml-auto text-xs text-muted`,children:le({declared:i,done:a,folder:s})}),o&&!s?(0,N.jsx)(u,{name:`right`,className:`text-muted`}):null]}),o&&s&&!i?(0,N.jsx)(ce,{companion:t,dir:r,onRead:n}):null]},e.id)})})}function de({companion:e,path:t}){let n=c(i(e,{path:t})),r=n.data?.open?.markdown;return r?(0,N.jsx)(`div`,{className:`prose-panel`,children:(0,N.jsx)(T,{nodes:r})}):(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:n.isPending?`Loading…`:`The file could not be read.`})}function fe({companion:e,path:n,change:r,onBack:i}){let a=n.slice(Y(r).length+1);return(0,N.jsxs)(`section`,{className:`grid content-start gap-3 px-5 py-4`,"aria-label":`Artifact ${a}`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsxs)(d,{size:`sm`,variant:`ghost`,className:`-ml-2`,onClick:i,children:[(0,N.jsx)(u,{name:`left`}),` Artifacts`]}),(0,N.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted`,children:a}),(0,N.jsxs)(t,{className:`ml-auto inline-flex flex-none items-center gap-1.5 text-xs`,to:`/vault`,search:e=>({...e,path:n}),children:[(0,N.jsx)(u,{name:`external`,className:`size-3.5`}),` Open in Vault`]})]}),(0,N.jsx)(de,{companion:e,path:n})]})}var Z=`Awaiting publication`,pe=[],me={"needs-you":`Review or fix before the build goes on`,building:`Some tasks are done; others remain`,ready:`Every task is done`};function Q(e){if(e.valid===!1)return{marker:`issue`,word:`Invalid`};let t=A(e);if(e.planned===!1){let n=e.position?.stage;return n?t===`ready`?{marker:`done`,word:n.label}:{marker:n.kind===`review`?`review`:`build`,word:n.label}:{marker:`idle`,word:e.dropped?`Dropped`:`Not placed`}}return t===`needs-you`?(e.totalTasks??0)===0?{marker:`warn`,word:`No tasks`}:{marker:`review`,word:`Review`}:t===`building`?{marker:`build`,word:O.building}:{marker:`done`,word:`Ready`}}function he({change:e,workflow:t,companion:n,reading:r,onRead:i}){let a=j(e,t),o=re(t),s=E(e),{marker:c,word:l}=Q(e),u=(0,N.jsx)(x,{title:`Artifacts`,aside:e.schemaName,children:(0,N.jsx)(ue,{change:e,companion:n,onRead:i})}),d=A(e)===`needs-you`;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(C,{mono:!0,title:e.name,kicker:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(_,{marker:c,children:l}),(0,N.jsx)(v,{at:e.lastModified,className:`ml-auto`})]}),children:(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:a.situation})}),r&&n?(0,N.jsx)(fe,{companion:n,path:r,change:e,onBack:()=>i(null)}):(0,N.jsxs)(N.Fragment,{children:[d?u:null,(0,N.jsx)(x,{title:`Delivery Path`,aside:a.stage,children:(0,N.jsx)(J,{steps:o.map(e=>e.label),current:o.findIndex(e=>e.id===a.stageId),tone:a.review?`why`:`accent`})}),(0,N.jsxs)(x,{title:`Next step`,children:[(0,N.jsxs)(`p`,{className:`m-0 text-sm`,children:[a.next,`.`]}),(0,N.jsx)(g,{text:a.prompt})]}),e.planned===!1?null:(0,N.jsx)(x,{title:s.unit===`tasks`?`Tasks`:`Plan`,aside:`${s.done}/${s.total}`,children:(0,N.jsx)(m,{...s})}),d?null:u]})]})}function ge({change:e,workflow:t,current:n,onOpen:r}){let{marker:i,word:a}=Q(e),o=j(e,t);return(0,N.jsx)(`li`,{children:(0,N.jsxs)(`button`,{type:`button`,className:l(h,`grid grid-cols-[minmax(0,1fr)_max-content_150px_72px] @max-[640px]:grid-cols-[minmax(0,1fr)_auto]`),"aria-current":n?`true`:void 0,"data-change":e.name,onClick:r,children:[(0,N.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,N.jsx)(`span`,{className:`truncate font-mono text-sm`,children:e.name}),(0,N.jsx)(`span`,{className:l(`truncate text-xs`,e.valid===!1?`text-bad`:`text-muted`),children:o.situation})]}),(0,N.jsx)(_,{marker:i,children:a}),(0,N.jsx)(`span`,{className:`@max-[640px]:hidden`,children:e.planned===!1?null:(0,N.jsx)(m,{...E(e)})}),(0,N.jsx)(v,{at:e.lastModified,className:`text-right @max-[640px]:hidden`})]})})}function $({change:e}){return(0,N.jsxs)(`li`,{className:l(h,`grid grid-cols-[minmax(0,1fr)_max-content] hover:bg-transparent`),"data-submitted":e.name,children:[(0,N.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,N.jsx)(`span`,{className:`truncate font-mono text-sm`,children:e.name}),(0,N.jsxs)(`span`,{className:`truncate text-xs text-muted`,children:[(0,N.jsx)(`span`,{className:e.mine?`font-semibold text-accent`:void 0,children:e.mine?`Yours`:e.author??`Someone else`}),` · ${e.group||`no delivery branch`}`]})]}),e.blocked?(0,N.jsx)(_,{marker:`issue`,children:`Blocked`}):(0,N.jsx)(_,{marker:`idle`,children:`Submitted`})]})}function _e({submitted:e}){return e.length===0?null:(0,N.jsx)(y,{title:Z,count:e.length,hint:`Publish with /mate-publish-artifact once merged`,children:(0,N.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.map(e=>(0,N.jsx)($,{change:e},e.name))})})}function ve(e,t){return[{value:`all`,label:`All`,count:k.reduce((t,n)=>t+e[n].length,0)+t},...k.map(t=>({value:t,label:O[t],count:e[t].length,tone:t===`needs-you`?`warn`:void 0})),...t>0?[{value:`submitted`,label:Z,count:t}]:[]]}function ye({changes:e,submitted:t=pe,selected:r,companion:i,workflow:a}){let o=n(),[s,c]=(0,M.useState)(`all`),[u,m]=(0,M.useState)(!1),[h,g]=(0,M.useState)(null),_=ne(e,t),v=te(_),x=k.filter(e=>s===`all`||s===e),C=x.flatMap(e=>v[e]),w=u?v[`needs-you`]:C,T=_.find(e=>e.name===r)??null,E=h&&h.change===T?.name?h.path:null,D=e=>{e===null&&m(!1),o({to:`.`,search:t=>({...t,change:e??void 0}),replace:!0})};return _.length===0&&t.length===0?(0,N.jsx)(`section`,{className:l(p,`pb-10`),"aria-label":`Changes`,children:(0,N.jsx)(ee,{children:`No change is in flight in this companion.`})}):(0,N.jsxs)(`section`,{className:l(p,`@container grid content-start gap-3 pb-10`),"aria-label":`Changes`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(b,{label:`Show changes`,value:s,onChange:c,options:ve(v,t.length)}),v[`needs-you`].length>0?(0,N.jsxs)(d,{variant:`primary`,size:`sm`,className:`ml-auto`,onClick:()=>{m(!0),D(v[`needs-you`][0].name)},children:[`Start review pass`,(0,N.jsx)(f,{value:v[`needs-you`].length})]}):null]}),x.map(e=>v[e].length===0?null:(0,N.jsx)(y,{title:O[e],count:v[e].length,hint:me[e],tone:e===`needs-you`?`warn`:void 0,children:(0,N.jsx)(`ul`,{className:`m-0 list-none p-0`,children:v[e].map(e=>(0,N.jsx)(ge,{change:e,workflow:a,current:e.name===r,onOpen:()=>{m(!1),D(e.name)}},e.name))})},e)),s===`all`||s===`submitted`?(0,N.jsx)(_e,{submitted:t}):null,(0,N.jsx)(S,{items:w.map(e=>e.name),current:T?.name??null,onSelect:D,pass:u?`Needs you`:void 0,wide:E!==null,title:T?`Change ${T.name}`:`Change`,children:T?(0,N.jsx)(he,{change:T,workflow:a,companion:i,reading:E,onRead:e=>g(e?{change:T.name,path:e}:null)}):null})]})}function be({payload:e,selected:t,companion:n}){return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(w,{warnings:e.warnings}),(0,N.jsx)(ye,{changes:e.changes,submitted:e.submitted,selected:t,companion:n,workflow:e.workflow??void 0})]})}function xe(){let t=D.useSearch();return(0,N.jsx)(e,{view:`dashboard`,search:t,children:e=>e.studioMode===`analysis`?(0,N.jsx)(R,{payload:{shipped:e.shipped??[],warnings:e.warnings}}):(0,N.jsx)(be,{payload:{changes:e.changes??[],submitted:e.submitted,warnings:e.warnings,workflow:e.workflow},selected:t.change,companion:t.companion})})}export{xe as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./companion-view-BVaZNtiI.js";import{a as t,n,t as r}from"./jsx-runtime-MZURdZre.js";import{c as i,f as a,i as o,o as s,s as c,u as l}from"./store-DJ5cncKA.js";import{Dr as u,Tr as d,r as f}from"./button-D6LrRkOG.js";import{n as p,r as m,t as h}from"./panel-B8F8sOKQ.js";import{i as g}from"./steps-DhIFuAZy.js";import{A as _,d as v}from"./studio-queries-CFP_yTpr.js";import{t as y}from"./markdown-view-RL5YvfZg.js";import{c as b}from"./index-BBmFpG4y.js";var x=t(n(),1),S=r(),C=`flex w-full min-w-0 items-center gap-2.5 rounded-control border-0 bg-transparent px-2 py-1 text-left text-sm text-text hover:bg-surface-soft aria-[current=true]:bg-accent-soft`;function w(e){return e<1024?`${e} B`:`${(e/1024).toFixed(+(e<10240))} KB`}function T({companion:e,agent:t,name:n}){let[r,i]=(0,x.useState)(void 0),a=u({...v(e,t,n,r),placeholderData:_});if(!a.data)return(0,S.jsx)(p,{title:`Files`,children:a.isError?(0,S.jsx)(`p`,{className:`m-0 text-sm text-muted`,role:`alert`,children:a.error instanceof Error?a.error.message:`The skill could not be read.`}):(0,S.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Listing files…`})});let{files:o,truncated:s,open:c}=a.data;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(p,{title:`Files`,aside:s?`first ${o.length}`:o.length,children:(0,S.jsx)(`ul`,{className:`m-0 -mx-2 grid list-none gap-0.5 p-0`,children:o.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsxs)(`button`,{type:`button`,className:C,"aria-current":c?.path===e.path?`true`:void 0,"data-skill-file":e.path,onClick:()=>i(e.path),children:[(0,S.jsx)(f,{name:`doc`,className:`flex-none text-muted`}),(0,S.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.path}),(0,S.jsx)(`span`,{className:`ml-auto flex-none font-mono text-2xs text-muted`,children:w(e.size)})]})},e.path))})}),c?(0,S.jsxs)(`section`,{className:d(`grid gap-2.5 px-5 py-4`,a.isPlaceholderData&&`opacity-60`),"aria-label":`File ${c.path}`,children:[(0,S.jsx)(`code`,{className:`truncate font-mono text-xs text-muted`,children:c.path}),c.nodes?(0,S.jsx)(`div`,{className:`prose-panel`,children:(0,S.jsx)(y,{nodes:c.nodes})}):(0,S.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:c.note})]}):null]})}var E=[{id:`claude`,label:`Claude`,dir:`.claude/skills`,invoke:e=>`/${e}`},{id:`opencode`,label:`OpenCode`,dir:`.opencode/skills`,invoke:e=>`@${e}`},{id:`agents`,label:`Agents`,dir:`.agents/skills`,invoke:e=>`$${e}`}],D=new Set([`mate-grilling`,`mate-domain-modeling`]);function O(){let e=new Map;for(let t of g({}).paths[0]?.steps??[]){t.skill&&!e.has(t.skill)&&e.set(t.skill,t.label);for(let n of t.alternatives??[])e.has(n.name)||e.set(n.name,t.label)}return e}function k(e,t){let n=[...t.keys()],r=e.filter(e=>t.has(e)).toSorted((e,t)=>n.indexOf(e)-n.indexOf(t)),i=e.filter(e=>D.has(e)),a=e.filter(e=>e.startsWith(`mate-`)&&!t.has(e)&&!D.has(e)),o=e.filter(e=>!e.startsWith(`mate-`)&&!t.has(e));return[{title:`Delivery Path`,hint:`In the order a change meets them`,names:r},{title:`Other Mate skills`,hint:`Run when you need them`,names:a},{title:`Used by other skills`,hint:`Loaded for you, not started on their own`,names:i},{title:`Other skills`,hint:`Installed besides Mate`,names:o}].filter(e=>e.names.length>0)}function A({skills:e,companion:t}){let n=e??{claude:[],opencode:[],agents:[]},[r,u]=(0,x.useState)(`claude`),[f,g]=(0,x.useState)(null),_=O(),v=E.find(e=>e.id===r);return(0,S.jsxs)(`section`,{className:d(i,`grid content-start gap-3 pb-10`),"aria-label":`Agent skills`,"data-skills-root":!0,children:[(0,S.jsx)(l,{label:`Agent`,value:r,onChange:e=>{u(e),g(null)},options:E.map(e=>({value:e.id,label:e.label,count:n[e.id].length}))}),E.map(e=>{let t=e.id===r,i=n[e.id];return(0,S.jsx)(`div`,{id:`skills-panel-${e.id}`,className:t?`grid gap-3`:`hidden`,"aria-hidden":!t,"data-skill-panel":e.id,"data-active":t,children:i.length===0?(0,S.jsxs)(s,{children:[e.label,` has no skills in this companion.`]}):k(i,_).map(e=>(0,S.jsx)(c,{title:e.title,count:e.names.length,hint:e.hint,children:(0,S.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.names.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsxs)(`button`,{type:`button`,className:d(a,`grid grid-cols-[minmax(0,1fr)_auto] py-1.5`),"aria-current":t&&f===e?`true`:void 0,"data-skill":e,onClick:()=>g(e),children:[(0,S.jsx)(`span`,{className:`truncate font-mono text-sm`,children:e}),_.has(e)?(0,S.jsx)(`span`,{className:`text-xs text-muted`,children:_.get(e)}):null]})},e))})},e.title))},e.id)}),(0,S.jsx)(m,{items:k(n[r],_).flatMap(e=>e.names),current:f,onSelect:g,wide:t!==void 0,title:f?`Skill ${f}`:`Skill`,children:f?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(h,{mono:!0,title:f,kicker:_.has(f)?(0,S.jsxs)(`span`,{children:[`Delivery Path · `,_.get(f)]}):(0,S.jsx)(`span`,{children:v.label})}),(0,S.jsx)(p,{title:`Start`,children:D.has(f)?(0,S.jsx)(`p`,{className:`m-0 text-sm`,children:`Used by other skills: they load it when they need it, so it has no start command.`}):(0,S.jsx)(o,{text:v.invoke(f),label:`start command`})}),(0,S.jsx)(p,{title:`Installed for`,children:(0,S.jsx)(`ul`,{className:`m-0 grid list-none gap-1.5 p-0`,children:E.filter(e=>n[e.id].includes(f)).map(e=>(0,S.jsxs)(`li`,{className:`flex items-center gap-3 text-sm`,children:[(0,S.jsx)(`span`,{className:`w-20 text-muted`,children:e.label}),(0,S.jsxs)(`code`,{className:`truncate font-mono text-xs`,children:[e.dir,`/`,f,`/`]})]},e.id))})}),t?(0,S.jsx)(T,{companion:t,agent:r,name:f},`${r}/${f}`):null]}):null})]})}var j=function(){let t=b.useSearch();return(0,S.jsx)(e,{view:`skills`,search:t,children:e=>(0,S.jsx)(A,{skills:e.skillInventory,companion:t.companion})})};export{j as component};
@@ -1 +0,0 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-MZURdZre.js";import{Dr as r,Tr as i,r as a}from"./button-D6LrRkOG.js";import{J as o,m as s}from"./studio-queries-CFP_yTpr.js";import"./studio-BR9j15J0.js";import{c,f as l,o as u,p as d,s as f}from"./store-DJ5cncKA.js";import{t as p}from"./fields-D_FYhxQr.js";import{a as m,c as h,d as g,i as _,l as v,n as y,o as b,r as x,s as S,t as C,u as w}from"./combobox-Dk2MMZWE.js";import{t as T}from"./markdown-view-RL5YvfZg.js";import{n as ee,r as te,t as E}from"./panel-B8F8sOKQ.js";import{t as D}from"./warnings-UHFy6HAp.js";var O=[`binds`,`in`,`mentions`,`co-change`],k=`Repository root`,A=e=>`spec:${e}`,j=(e,t)=>`openspec/changes/archive/${e}/${t}`,ne=e=>`openspec/specs/${e}/spec.md`,re=/^[a-z0-9][a-z0-9-]{0,63}$/,M=[{id:`show-me`,skill:`mate-show-me`,label:`Show me`,subject:`spec`,prompts:{claude:e=>`/mate-show-me ${e}`,opencode:e=>`Use the mate-show-me skill on spec ${e}.`}}];function N(e){return M.find(t=>t.id===e)??null}var P=e(t(),1),F=`unassigned`,I=e=>e??`(none)`;function L(e){return e.flatMap(e=>e.scopes.length===0?[{repository:null,area:F,spec:e}]:e.scopes.map(t=>({repository:t.repository??null,area:t.area??F,spec:e})))}function R(e,t){return e===t?0:e===null?1:t===null?-1:e.localeCompare(t)}var z=e=>new Set(e.map(e=>e.spec.capability)).size;function B(e,t){let n=L(e),r=Map.groupBy(n,e=>I(e.repository)),i=[...r.entries()].map(([e,t])=>({value:e,repository:t[0].repository,count:z(t)})).toSorted((e,t)=>R(e.repository,t.repository)),a=t!==void 0&&r.get(t)||n;return{repositories:i,areas:[...Map.groupBy(a,e=>`${I(e.repository)}\n${e.area}`).values()].map(e=>{let{repository:t,area:n}=e[0];return{repo:I(t),repository:t,area:n,count:z(e)}}).toSorted((e,t)=>R(e.repository,t.repository)||e.area.localeCompare(t.area))}}function V({repositories:e,areas:t},n){let r=n.q?.trim(),i=e.some(e=>e.value===n.repo)?n.repo:void 0,a=i!==void 0&&t.some(e=>e.area===n.area)?n.area:void 0;return{...r?{q:r}:{},...i===void 0?{}:{repo:i},...a===void 0?{}:{area:a}}}function H(e,t){if(t.repo!==void 0&&I(e.repository)!==t.repo||t.area!==void 0&&e.area!==t.area)return!1;if(!t.q)return!0;let n=t.q.toLowerCase();return e.spec.capability.toLowerCase().includes(n)||e.area.toLowerCase().includes(n)}function U(e,t={}){let n=L(e).filter(e=>H(e,t));return[...Map.groupBy(n,e=>I(e.repository)).values()].map(e=>({repository:e[0].repository,areas:[...Map.groupBy(e,e=>e.area)].map(([e,t])=>({area:e,specs:[...new Set(t.map(e=>e.spec))]})).toSorted((e,t)=>e.area.localeCompare(t.area))})).toSorted((e,t)=>R(e.repository,t.repository))}var W=n(),G=[];function K(e){return e.valid===!1?(0,W.jsx)(d,{marker:`issue`,children:`${e.issueCount??0} issues`}):e.valid===!0?(0,W.jsx)(d,{marker:`done`,children:`valid`}):(0,W.jsx)(d,{marker:`idle`,children:`unvalidated`})}var q=`.`,J=e=>e===q?k:e,Y=e=>e??`No repository`,ie=({repository:e,area:t})=>[e,t===void 0?void 0:J(t)].filter(Boolean).join(` · `),ae=200;function X(e){return e===void 0?`requirements unknown`:`${e} ${e===1?`requirement`:`requirements`}`}var oe={};function se({payload:e,actions:t=G,companion:n,filter:r=oe,onFilterChange:i}){let[a,o]=(0,P.useState)(r);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(D,{warnings:e.warnings}),(0,W.jsx)(pe,{specs:e.specs,actions:t,companion:n,filter:i?r:a,onFilterChange:i??o})]})}var Z={key:``,label:`All Areas`},ce=(e,t)=>e.key===t.key,le=e=>e.label;function ue({specs:e,options:{repositories:t,areas:n},filter:r,search:i,onSearch:a,onChange:o}){let s=r.repo!==void 0,c=[{value:``,label:`All repositories`},...t.map(e=>({value:e.value,label:`${Y(e.repository)} (${e.count})`}))],l=[Z,...n.map(e=>{let t=s?J(e.area):`${Y(e.repository)} · ${J(e.area)}`;return{key:`${e.repo}\n${e.area}`,label:`${t} (${e.count})`,option:e}})],u=l.find(e=>e.option?.repo===r.repo&&e.option?.area===r.area)??Z;return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,role:`search`,"aria-label":`Filter specs`,children:[(0,W.jsx)(p,{type:`search`,className:`w-64 max-sm:w-full`,placeholder:`Search capability or Area`,"aria-label":`Search specs`,value:i,onChange:e=>a(e.currentTarget.value)}),(0,W.jsxs)(S,{items:c,value:r.repo??``,onValueChange:t=>{let n=t||void 0,i=B(e,n).areas.some(e=>e.repo===n&&e.area===r.area);o({...r,repo:n,area:i?r.area:void 0})},children:[(0,W.jsx)(w,{className:`w-auto max-w-72`,"aria-label":`Repository`,children:(0,W.jsx)(g,{})}),(0,W.jsx)(h,{children:c.map(e=>(0,W.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,W.jsxs)(C,{items:l,value:u,onValueChange:e=>o(e?.option?{...r,repo:e.option.repo,area:e.option.area}:{...r,area:void 0}),isItemEqualToValue:ce,itemToStringLabel:le,children:[(0,W.jsx)(_,{className:`w-80 max-sm:w-full`,"aria-label":`Area`,placeholder:`All Areas`}),(0,W.jsxs)(y,{children:[(0,W.jsx)(x,{children:`No Areas match`}),(0,W.jsx)(b,{children:e=>(0,W.jsx)(m,{value:e,children:e.label},e.key)})]})]})]})}var Q=`inline-flex h-7 items-center gap-1.5 rounded-[6px] border border-rule bg-surface px-2.5 text-xs text-text hover:border-accent hover:bg-accent-soft`;function de({capability:e,actions:t}){return!re.test(e)||t.length===0?null:(0,W.jsx)(`span`,{className:`spec-actions flex flex-wrap items-center gap-1.5`,children:t.map(({action:t,runAgents:n,copyAgents:r})=>(0,W.jsxs)(P.Fragment,{children:[n.length>0?(0,W.jsxs)(`button`,{type:`button`,className:i(Q,`spec-action`),"data-studio-action":t.id,"data-studio-subject":e,"data-studio-agents":n.join(` `),children:[(0,W.jsx)(a,{name:`play`,className:`size-3.5`}),t.label]}):null,(0,W.jsxs)(`button`,{type:`button`,className:i(Q,`spec-copy`),"aria-label":`Copy prompt`,"data-studio-copy-prompt":t.id,"data-prompt-claude":r.includes(`claude`)?t.prompts.claude(e):void 0,"data-prompt-opencode":r.includes(`opencode`)?t.prompts.opencode(e):void 0,children:[(0,W.jsx)(a,{name:`copy`,className:`size-3.5`}),`Copy prompt`]})]},t.id))})}function fe({specs:e,open:t,onOpen:n}){return(0,W.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,className:i(l,`grid grid-cols-[minmax(0,1fr)_auto_120px] py-1.5 max-sm:grid-cols-[minmax(0,1fr)_auto]`),"aria-current":t===e.capability?`true`:void 0,"data-spec":e.capability,onClick:()=>n(e.capability),children:[(0,W.jsx)(`span`,{className:`truncate font-mono text-sm`,children:e.capability}),e.valid===!0?(0,W.jsx)(`span`,{}):K(e),(0,W.jsx)(`span`,{className:`text-right text-xs text-muted tabular-nums max-sm:hidden`,children:X(e.requirementCount)})]})},e.capability))})}function pe({specs:e,actions:t,companion:n,filter:r,onFilterChange:a}){let[o,s]=(0,P.useState)(r.q??``),[l,d]=(0,P.useState)(r.q);r.q!==l&&(d(r.q),(r.q??``)!==o.trim()&&s(r.q??``));let p=(0,P.useRef)(void 0);(0,P.useEffect)(()=>()=>clearTimeout(p.current),[]);let m=B(e,r.repo),h=V(m,{...r,q:o}),g=e=>{clearTimeout(p.current),a(e)},_=e=>{s(e),clearTimeout(p.current),p.current=setTimeout(()=>a({...h,q:e.trim()}),ae)},v=()=>{s(``),g({})},y=U(e,h),[b,x]=(0,P.useState)(null),S=[...new Set(y.flatMap(e=>e.areas.flatMap(e=>e.specs.map(e=>e.capability))))],C=e.find(e=>e.capability===b)??null;return(0,W.jsxs)(`section`,{className:i(c,`grid content-start gap-3 pb-10`),"aria-label":`Specs by repository and Area`,children:[e.length===0?(0,W.jsx)(u,{children:`No specs in this companion.`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ue,{specs:e,options:m,filter:h,search:o,onSearch:_,onChange:e=>g({...e,q:o.trim()})}),y.length===0?(0,W.jsxs)(u,{className:`flex flex-wrap items-center gap-3`,children:[`No spec matches the search and filters.`,(0,W.jsx)(`button`,{type:`button`,className:Q,onClick:v,children:`Clear filters`})]}):y.map(e=>(0,W.jsxs)(`section`,{className:`grid content-start gap-3`,"aria-label":`Repository ${Y(e.repository)}`,children:[(0,W.jsx)(`h2`,{className:`m-0 mt-2 font-mono text-sm font-semibold text-muted`,children:Y(e.repository)}),e.areas.map(({area:e,specs:t})=>(0,W.jsx)(f,{level:3,title:e===q?J(e):(0,W.jsx)(`span`,{className:`font-mono`,children:e}),label:`Area ${e}`,count:t.length,children:(0,W.jsx)(fe,{specs:t,open:b,onOpen:x})},e))]},e.repository??``))]}),(0,W.jsx)(te,{items:S,current:C?.capability??null,onSelect:x,wide:!0,title:C?`Spec ${C.capability}`:`Spec`,children:C?(0,W.jsx)($,{spec:C,actions:t,companion:n}):null})]})}function $({spec:e,actions:t=G,companion:n,withStatus:i=!0,children:c}){let l=ne(e.capability),u=r({...s(n??``,{path:l}),enabled:!!n}),d=u.data?.open?.markdown;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(E,{mono:!0,title:e.capability,kicker:(0,W.jsxs)(W.Fragment,{children:[i?K(e):null,(0,W.jsx)(`span`,{className:`ml-auto`,children:e.scopes.map(ie).join(`, `)})]}),children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(de,{capability:e.capability,actions:t}),(0,W.jsxs)(o,{className:`inline-flex items-center gap-1.5 text-sm`,to:`/vault`,search:e=>({companion:e.companion,studioMode:e.studioMode,path:l}),children:[(0,W.jsx)(a,{name:`external`,className:`size-3.5`}),` Open in Vault`]})]})}),c,(0,W.jsx)(ee,{title:`Spec`,aside:e.requirementCount===void 0?void 0:X(e.requirementCount),children:d?(0,W.jsx)(`div`,{className:`prose-panel`,children:(0,W.jsx)(T,{nodes:d})}):(0,W.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:u.isError?`The spec file could not be read.`:u.isPending&&n?`Loading…`:`The spec file could not be read.`})})]})}export{k as a,O as i,se as n,j as o,N as r,A as s,$ as t};
@@ -1 +0,0 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-MZURdZre.js";import{$ as r,Tr as i,_r as a,et as o,i as s}from"./button-D6LrRkOG.js";var c=e(t(),1),l=n();function u({title:e,description:t,actions:n}){return(0,l.jsxs)(`header`,{className:`page-header flex flex-wrap items-end gap-x-4 gap-y-2 px-6 pt-5 pb-1 max-sm:px-4`,children:[(0,l.jsxs)(`div`,{className:`min-w-0`,children:[(0,l.jsx)(`h1`,{className:`m-0 text-xl font-semibold tracking-[-0.015em]`,children:e}),(0,l.jsx)(`p`,{className:`m-0 mt-0.5 text-sm text-muted`,children:t})]}),n?(0,l.jsx)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:n}):null]})}var d=`px-6 max-sm:px-4`,f={warn:`text-warn`,bad:`text-bad`,accent:`text-accent`,why:`text-why`,muted:`text-muted`};function p({value:e,tone:t,className:n,label:r}){return(0,l.jsx)(`span`,{className:i(`count inline-grid h-[18px] min-w-[18px] flex-none place-items-center rounded-full px-1.5 font-mono text-2xs leading-none font-medium tabular-nums`,t===`warn`&&e>0?`bg-warn-soft text-warn`:`bg-[color-mix(in_srgb,var(--muted)_16%,transparent)] text-muted`,n),"aria-label":r,children:e})}function m({title:e,count:t,hint:n,tone:r,children:a,className:o,label:s,level:c=2}){let u=c===3?`h3`:`h2`;return(0,l.jsxs)(`section`,{className:i(`list-card overflow-hidden rounded-card border border-rule`,o),"aria-label":s??(typeof e==`string`?e:void 0),children:[(0,l.jsxs)(`div`,{className:i(`list-card-head flex items-center gap-2.5 border-b border-rule bg-surface px-4 py-2 text-[0.9rem] font-semibold`,r?f[r]:null),children:[(0,l.jsx)(u,{className:`m-0 text-[inherit] font-[inherit]`,children:e}),t===void 0?null:(0,l.jsx)(p,{value:t,tone:r===`warn`?`warn`:void 0}),n?(0,l.jsx)(`span`,{className:`ml-auto text-xs font-normal text-muted`,children:n}):null]}),a]})}var h=`list-row flex w-full min-w-0 items-center gap-4 border-0 border-t border-rule-soft bg-transparent px-4 py-2 text-left text-base text-text no-underline transition-colors first:border-t-0 hover:bg-surface aria-[current=true]:bg-surface aria-[current=true]:shadow-[inset_2px_0_0_var(--accent)]`;function g({label:e,options:t,value:n,onChange:i,className:a}){return(0,l.jsx)(r,{"aria-label":e,value:[n],onValueChange:e=>{let t=e[0];t&&i(t)},className:a,children:t.map(e=>(0,l.jsxs)(o,{value:e.value,children:[e.label,e.count===void 0?null:(0,l.jsx)(p,{value:e.count,tone:e.tone===`warn`?`warn`:void 0})]},e.value))})}var _={review:`rotate-45 rounded-[2px] size-[7px] bg-why`,build:`rotate-45 rounded-[2px] size-[7px] bg-accent`,done:`rounded-full size-2 bg-accent`,issue:`rounded-[1px] size-2 bg-bad`,idle:`rounded-full size-2 ring-[1.5px] ring-muted ring-inset`,warn:`rounded-full size-2 bg-warn`},v={review:`text-why`,build:`text-accent`,done:`text-accent`,issue:`text-bad`,idle:`text-muted`,warn:`text-warn`};function y({marker:e,children:t}){return(0,l.jsxs)(`span`,{className:i(`status-word inline-flex items-center gap-2 text-xs whitespace-nowrap`,v[e]),children:[(0,l.jsx)(`span`,{className:i(`flex-none`,_[e]),"aria-hidden":`true`}),t]})}function b({done:e,total:t,unit:n=`tasks`}){if(t===0)return(0,l.jsxs)(`span`,{className:`text-xs text-muted`,children:[`No `,n]});let r=Math.min(100,Math.round(e/t*100)),i=`${e} of ${t} ${n}`;return(0,l.jsxs)(`span`,{className:`grid min-w-[120px] gap-1.5 text-xs text-muted`,children:[(0,l.jsx)(`span`,{children:i}),(0,l.jsx)(`span`,{className:`relative block h-1 w-full max-w-[140px] overflow-hidden rounded-full bg-rule`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,"aria-label":i,children:(0,l.jsx)(`span`,{className:`absolute inset-y-0 left-0 rounded-full bg-accent`,style:{width:`${r}%`}})})]})}var x=()=>()=>{};function S({at:e,className:t}){let n=(0,c.useSyncExternalStore)(x,()=>e===void 0?``:C(e,Date.now()),()=>``);if(e===void 0)return null;let r=new Date(e);return Number.isNaN(r.getTime())?null:(0,l.jsx)(`time`,{dateTime:r.toISOString(),className:i(`font-mono text-xs whitespace-nowrap text-muted`,t),children:n})}function C(e,t){let n=Math.max(0,Math.round((t-new Date(e).getTime())/1e3));return n<60?`just now`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function w({children:e,className:t}){return(0,l.jsx)(`p`,{className:i(`empty m-0 rounded-card border border-dashed border-rule px-5 py-5 text-base text-muted`,t),children:e})}function T({text:e,copy:t=e,label:n=`prompt`}){return(0,l.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-control border border-rule bg-page py-1.5 pr-1.5 pl-3 font-mono text-xs`,children:[(0,l.jsx)(`code`,{className:`min-w-0 flex-1 truncate`,children:e}),(0,l.jsx)(`button`,{type:`button`,className:`inline-flex h-7 flex-none items-center rounded-[6px] border border-rule bg-surface px-2.5 font-sans text-xs text-text hover:border-accent hover:bg-accent-soft`,"data-copy":t,"data-copy-label":n,children:`Copy`})]})}function E(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new s({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:a,inactiveTriggerProps:a,popupProps:a}}var D=e=>e.triggerIdProp??e.activeTriggerId,O=e=>e.openProp??e.open,k=e=>(e.popupElement?.id??e.floatingId)||void 0;function A(e,t){return t!==void 0&&O(e)&&D(e)===t}function j(e,t){return A(e,t)?!0:t!==void 0&&O(e)&&D(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var M={open:O,mounted:e=>e.mounted,transitionStatus:e=>O(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:D,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:k,isTriggerActive:(e,t)=>t!==void 0&&D(e)===t,isOpenedByTrigger:(e,t)=>A(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&D(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>j(e,t)?k(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};export{p as a,d as c,b as d,h as f,T as i,u as l,M as n,w as o,y as p,S as r,m as s,E as t,g as u};
@@ -1 +0,0 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-MZURdZre.js";import{B as r,C as i,F as a,H as o,I as s,L as c,N as l,O as u,R as d,S as f,U as p,V as m,b as h,k as g,w as _,x as v,z as y}from"./studio-queries-CFP_yTpr.js";var b=e(t(),1),x=n(),S=b.createContext(void 0),C=e=>{let t=b.useContext(S);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},w=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,x.jsx)(S.Provider,{value:e,children:t})),T=()=>u,E=()=>T(),D=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},O=new class extends D{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},k=o;function A(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=k,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var j=A(),M=new class extends D{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function N(e){return Math.min(1e3*2**e,3e4)}function P(e){return(e??`online`)!==`online`||M.isOnline()}var F=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function I(e){let t=!1,n=0,i,a=`pending`,o,s,c=new Promise((e,t)=>{o=e,s=t});c.catch(l);let u=()=>a!==`pending`,d=t=>{if(!u()){let n=new F(t);_(n),e.onCancel?.(n)}},f=()=>{t=!0},p=()=>{t=!1},m=()=>O.isFocused()&&(e.networkMode===`always`||M.isOnline())&&e.canRun(),h=()=>P(e.networkMode)&&e.canRun(),g=e=>{u()||(i?.(),a=`resolved`,o(e))},_=e=>{u()||(i?.(),a=`rejected`,s(e))},v=t=>new Promise(n=>{i=e=>{(u()||t())&&n(e)},e.onPause?.()}).then(()=>{i=void 0,u()||e.onContinue?.()}),y=()=>{if(u())return;let i,a=n===0?e.initialPromise:void 0;try{i=a??e.fn()}catch(e){i=Promise.reject(e)}Promise.resolve(i).then(g).catch(i=>{if(u())return;let a=e.retry??(E()?0:3),o=e.retryDelay??N,s=typeof o==`function`?o(n,i):o,c=a===!0||typeof a==`number`&&n<a||typeof a==`function`&&a(n,i);t||!c?_(i):(n++,e.onFail?.(n,i),r(s).then(()=>u()||m()?void 0:v(m)).then(()=>{t?_(i):y()}))})};return{promise:c,status:()=>a,cancel:d,continue:()=>(i?.(),c),cancelRetry:f,continueRetry:p,canStart:h,start:()=>(h()?y():v(h).then(y),c)}}var L=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),g(this.gcTime)&&(this.#e=p.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(E()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(p.clearTimeout(this.#e),this.#e=void 0)}};function R(e){return{onFetch:(t,n)=>{let r=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[],c={pages:[],pageParams:[]},l=0,u=async()=>{let n=!1,u=t,d=e=>{h(e,()=>t.signal,()=>n=!0,u[_])},p=i(t.options,t.fetchOptions),m=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return d(e),e})(),o=await p(a),{maxPages:s}=t.options,c=i?f:v;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(a&&o.length){let e=a===`backward`,t=e?B:z,n={pages:o,pageParams:s};c=await m(n,t(r,n),e)}else{let t=e??o.length;do{let e=l===0?s[0]===void 0?r.initialPageParam:s[0]:z(r,c);if(l>0&&e==null)break;c=await m(c,e),l++}while(l<t)}return c};t.fetchFn=t.options.persister?()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):u}}}function z(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function B(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var V=class extends L{#e;#t;#n;#r;#i;#a;#o;#s;#c;constructor(e){super(),this.#c=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=W(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#s,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=W(this.options);e.data!==void 0&&(this.setState(U(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=a(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(l).catch(l):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>s(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===y||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data!==void 0&&this.getObserversCount()>0&&this.observers.some(e=>s(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!m(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#c||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a&&this.#o)return this.#a.continueRetry(),this.#o}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperties(e,{[_]:{value:n.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#c=!0,n.signal)}})},a=()=>{let e=i(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#c=!1,this.options.persister?this.options.persister(e,n,this):e(n)},o=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:a};return r(e),e})();(this.#e===`infinite`?R(this.options.pages):this.options.behavior)?.onFetch(o,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:o.fetchOptions?.meta});let s=this.#a=I({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof F&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}),c=(async()=>{try{let e=await s.promise;if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof F){if(e.silent){if(this.#a!==s&&this.#o)return this.#o;throw e}if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===s&&(this.#a=void 0,this.#o=void 0),this.scheduleGc()}})();return this.#o=c,s.start(),c}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...H(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...U(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),j.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function H(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:P(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function U(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function W(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var G=class extends D{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),q(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return J(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return J(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof s(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!c(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Y(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||s(this.options.enabled,this.#t)!==s(t.enabled,this.#t)||s(this.options.staleTime,this.#t)!==s(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||s(this.options.enabled,this.#t)!==s(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return c(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch(t).then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(l)),t}#h(e){return!E()&&s(this.options.enabled,this.#t)!==!1&&g(e)}#g(){this.#b();let e=s(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=m(this.#r.dataUpdatedAt,e)+1;this.#u=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return s(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=p.setInterval(()=>{(this.options.refetchIntervalInBackground||O.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(p.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(p.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,o=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:u}=e,d={...u},f=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&q(e,t),o=i&&Y(e,n,t,r);(a||o)&&(d={...d,...H(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:h,status:g}=d;p=d.data;let _=!1;if(t.placeholderData!==void 0&&p===void 0&&g===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=i.data,_=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(g=`success`,p=a(i?.data,e,t),f=!0)}if(t.select&&p!==void 0&&!_){if(i&&p===o?.data&&t.select===this.#s)p=this.#c;else try{this.#s=t.select,p=t.select(p),p=a(i?.data,p,t),this.#c=p,this.#o=null}catch(e){this.#o=e}}else p===void 0&&(this.#o=null);this.#o&&(m=this.#o,p=this.#c,h=Date.now(),g=`error`,f=!1);let v=d.fetchStatus===`fetching`,y=g===`pending`,b=g===`error`,x=y&&v,S=p!==void 0;return{status:g,fetchStatus:d.fetchStatus,isPending:y,isSuccess:g===`success`,isError:b,isInitialLoading:x,isLoading:x,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:h,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:v,isRefetching:v&&!y,isLoadingError:b&&!S,isPaused:d.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:b&&S,isStale:X(e,t),refetch:this.refetch,isEnabled:s(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),c(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size||this.options.throwOnError&&this.#r.error!==e.error)return!0;for(let t of n??this.#p)if(this.#r[t]!==e[t])return!0;return!1})();j.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function K(e,t){return s(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||s(t.retryOnMount,e)!==!1)}function q(e,t){return K(e,t)||e.state.data!==void 0&&J(e,t,t.refetchOnMount)}function J(e,t,n){if(s(t.enabled,e)!==!1&&s(t.staleTime,e)!==`static`){let r=s(n,e);return r===`always`||r!==!1&&X(e,t)}return!1}function Y(e,t,n,r){return(e!==t||s(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&X(e,n)}function X(e,t){return s(t.enabled,e)!==!1&&e.isStaleByTime(s(t.staleTime,e))}var Z=b.createContext(!1),Q=()=>b.useContext(Z);Z.Provider;function $(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ee=b.createContext($()),te=()=>b.useContext(ee),ne=(e,t,n)=>{let r=n?.state.status===`error`&&typeof e.throwOnError==`function`?d(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},re=e=>{b.useEffect(()=>{e.clearReset()},[e])},ie=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||d(n,[e.error,r])),ae=(e,t)=>t.state.data===void 0,oe=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},se=(e,t)=>e?.suspense&&t.isPending,ce=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function le(e,t,n){let r=Q(),i=te(),a=C(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,oe(o),ne(o,i,s),re(i);let[u]=b.useState(()=>new t(a,o)),d=u.getOptimisticResult(o);b.useEffect(()=>{u.setOptions(o)},[o,u]);let f=!r&&c;if(b.useSyncExternalStore(b.useCallback(e=>{let t=f?u.subscribe(j.batchCalls(e)):l;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),se(o,d))throw ce(o,u,i);if(ie({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return o.notifyOnChangeProps?d:u.trackResult(d)}export{L as a,j as c,w as d,C as f,V as i,O as l,ae as n,I as o,G as r,M as s,le as t,D as u};
@@ -1 +0,0 @@
1
- import{a as e,bt as t,ct as n,m as r,p as i,ut as a,xt as o}from"./index-BBmFpG4y.js";import{J as s,Y as c,_ as l,f as u,g as d,h as f,i as p,m,p as h,r as g,u as _}from"./studio-queries-CFP_yTpr.js";import{Dr as v,Tr as y,n as b,r as x,t as S}from"./button-D6LrRkOG.js";import{f as C}from"./useBaseQuery-BlC-AZ35.js";import{a as w,n as T,t as E}from"./jsx-runtime-MZURdZre.js";import{f as D,s as O}from"./store-DJ5cncKA.js";import{a as k}from"./useSelector-AYcH7lB0.js";import{t as A}from"./markdown-view-RL5YvfZg.js";var j=w(T(),1);function M(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if(`shouldBlockFn`in e)return e;if(typeof e==`function`){let n=!!(t??!0);return{shouldBlockFn:async()=>n?await e():!1,enableBeforeUnload:n,withResolver:!1}}let n=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>n&&r!==void 0?await r():n,enableBeforeUnload:n,withResolver:r===void 0}}function ee(e,t){let{shouldBlockFn:n,enableBeforeUnload:r=!0,disabled:i=!1,withResolver:a=!1}=M(e,t),o=k(),{history:s}=o,[c,l]=j.useState({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return j.useEffect(()=>i?void 0:s.block({blockerFn:async e=>{function t(e){let t=o.parseLocation(e),[,n,r]=o.getMatchedRoutes(t.pathname);return r===void 0?{routeId:`__notFound__`,fullPath:t.pathname,pathname:t.pathname,params:n,search:o.options.parseSearch(e.search)}:{routeId:r.id,fullPath:r.fullPath,pathname:t.pathname,params:n,search:o.options.parseSearch(e.search)}}let r=t(e.currentLocation),i=t(e.nextLocation);if(r.routeId===`__notFound__`&&i.routeId!==`__notFound__`)return!1;let s=await n({action:e.action,current:r,next:i});if(!a)return s;if(!s)return!1;let c=await new Promise(t=>{l({status:`blocked`,current:r,next:i,action:e.action,proceed:()=>t(!1),reset:()=>t(!0)})});return l({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),c},enableBeforeUnload:r}),[n,r,i,a,s,o]),c}var N=E(),te=(e,t)=>`/api/vault/events?${new URLSearchParams({companion:e,path:t})}`;function P(e,t,n){let r=(0,j.useRef)(n);(0,j.useEffect)(()=>{r.current=n}),(0,j.useEffect)(()=>{if(typeof EventSource>`u`)return;let n=new EventSource(te(e,t));return n.addEventListener(`message`,e=>{try{r.current(JSON.parse(e.data))}catch{}}),()=>n.close()},[e,t])}function F({crumbs:e,children:t}){return(0,N.jsxs)(`div`,{className:`vault-bar sticky top-0 z-2 flex min-h-[52px] items-center gap-2 border-b border-rule-soft bg-[color-mix(in_srgb,var(--bg)_88%,transparent)] px-6 py-2 backdrop-blur-md max-sm:px-3`,children:[(0,N.jsx)(`div`,{className:`mr-auto flex min-w-0 items-center gap-1`,children:e}),t]})}var I=`vault-prose prose mx-auto w-full max-w-[68ch] px-10 pt-10 pb-28 max-sm:px-4`,L=b({variant:`default`,size:`sm`});function R({path:e}){return(0,N.jsxs)(`button`,{type:`button`,className:b({variant:`ghost`,size:`sm`}),"data-copy":e,"data-copy-label":`path`,"aria-label":`Copy path`,children:[(0,N.jsx)(x,{name:`copy`,className:`size-3.5`}),(0,N.jsx)(`span`,{className:`@max-[1000px]:hidden`,children:`Copy path`})]})}function z({companion:e,data:t,writable:n,search:r,crumbs:i}){let a=t.open;return a?n&&r.mode===`edit`?(0,N.jsx)(ne,{companion:e,data:t,crumbs:i},`${a.path}:edit`):(0,N.jsx)(V,{companion:e,data:t,writable:n,crumbs:i},`${a.path}:read`):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(F,{crumbs:i}),(0,N.jsxs)(`div`,{className:I,children:[(0,N.jsx)(`h1`,{className:`text-xl`,children:t.refusal?`File refused`:`Open a markdown file`}),(0,N.jsx)(`p`,{className:t.refusal?`vault-warning text-warn`:`empty text-muted`,children:t.refusal??`Choose a file from the tree to begin.`})]})]})}var B=e=>e.split(`/`).at(-1)??e;function V({companion:e,data:t,writable:n,crumbs:r}){let i=t.open,a=C(),[o,c]=(0,j.useState)(``);return P(e,i.path,t=>{t.kind===`removed`?c(`this file no longer exists on disk`):g(a,e)}),(0,N.jsxs)(`div`,{"data-vault-root":!0,"data-vault-mode":`read`,"data-vault-path":i.path,children:[(0,N.jsxs)(F,{crumbs:r,children:[(0,N.jsx)(R,{path:i.path}),n?(0,N.jsxs)(s,{className:L,id:`vault-mode-edit`,to:`/vault`,search:e=>({...e,mode:`edit`}),"data-vault-mode-link":!0,children:[(0,N.jsx)(x,{name:`pencil`,className:`size-3.5`}),`Edit`]}):(0,N.jsx)(`span`,{className:`text-xs text-muted`,title:`Start Studio with --writable to edit.`,children:`Read only`})]}),(0,N.jsxs)(`article`,{className:I,"aria-label":B(i.path),children:[(0,N.jsx)(A,{nodes:i.markdown}),(0,N.jsx)(`p`,{id:`vault-status`,className:`text-sm text-warn`,"aria-live":`polite`,children:o})]})]})}function H({companion:e,open:t,text:n}){let[i,a]=(0,j.useState)(n);(0,j.useEffect)(()=>{let e=setTimeout(()=>a(n),250);return()=>clearTimeout(e)},[n]);let o=r(`(min-width: 64rem)`),s=i===t.content,c=v({queryKey:[`vault-preview`,e,t.path,i],queryFn:()=>d({data:{companion:e,path:t.path,content:i}}),placeholderData:e=>e,enabled:o&&!s,gcTime:0}),l=s?t.markdown:c.data;return(0,N.jsxs)(`div`,{className:`vault-preview min-h-0 overflow-auto max-lg:hidden`,"aria-label":`Preview`,role:`region`,"data-vault-preview":!0,children:[(0,N.jsx)(`p`,{className:`m-0 px-7 pt-3 text-xs font-semibold text-muted`,children:`Preview`}),(0,N.jsx)(`div`,{className:`prose px-7 pt-2 pb-16 text-sm`,children:l?(0,N.jsx)(A,{nodes:l}):null})]})}function ne({companion:e,data:r,crumbs:i}){let a=r.open,o=C(),u=c(),[d,f]=(0,j.useState)(a.content),[p,m]=(0,j.useState)(a.content),[h,_]=(0,j.useState)(a.token),[v,b]=(0,j.useState)(``),[w,T]=(0,j.useState)(null),E=d!==p,D=(0,j.useRef)(E);(0,j.useEffect)(()=>{D.current=E},[E]);let O=n(e=>e.setDirty);(0,j.useEffect)(()=>O(E),[E,O]),(0,j.useEffect)(()=>()=>O(!1),[O]),ee({shouldBlockFn:()=>D.current&&!window.confirm(`Discard unsaved changes?`),enableBeforeUnload:()=>D.current}),P(e,a.path,e=>{if(e.kind===`removed`){b(`this file no longer exists on disk`);return}let t={content:e.content??``,token:e.token??``};e.kind===`overwritten`?(T(t),b(`a version was overwritten; its content is available below`)):E?(T(t),b(`the file changed on disk; unsaved content is still in the editor`)):(f(t.content),m(t.content),_(t.token),b(`updated from disk`))});let k=t({mutationFn:()=>l({data:{companion:e,path:a.path,content:d,token:h}}),onSuccess:t=>{t.kind===`conflict`?(T({content:t.content,token:t.token}),b(t.reason||`save refused`)):(_(t.token),m(d),D.current=!1,O(!1),b(`saved`),g(o,e),u({to:`/vault`,search:e=>({...e,mode:void 0}),resetScroll:!1}))},onError:e=>b(e.message||`save failed`)});return(0,N.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-vault-root":!0,"data-vault-mode":`edit`,"data-vault-path":a.path,children:[(0,N.jsxs)(F,{crumbs:i,children:[E?(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-warn`,children:[(0,N.jsx)(`span`,{className:`size-[7px] rounded-full bg-current`,"aria-hidden":`true`}),`Unsaved`]}):null,(0,N.jsxs)(s,{className:L,id:`vault-mode-read`,to:`/vault`,search:e=>({...e,mode:void 0}),"data-vault-mode-link":!0,children:[(0,N.jsx)(x,{name:`eye`,className:`size-3.5`}),`Read`]}),(0,N.jsx)(S,{variant:`primary`,size:`sm`,id:`vault-save`,onClick:()=>k.mutate(),disabled:k.isPending,children:`Save`})]}),(0,N.jsxs)(`div`,{className:v||w?`grid gap-2 border-b border-rule-soft px-6 py-2.5 text-sm`:`sr-only`,children:[(0,N.jsx)(`p`,{id:`vault-status`,className:`m-0 text-warn`,"aria-live":`polite`,children:v}),w?(0,N.jsxs)(`div`,{id:`vault-incoming`,className:`grid gap-2`,children:[(0,N.jsx)(`strong`,{id:`vault-incoming-title`,className:`text-sm`,children:`Incoming version`}),(0,N.jsx)(`pre`,{id:`vault-incoming-content`,className:`m-0 max-h-40 overflow-auto rounded-control border border-rule bg-surface p-3 font-mono text-xs whitespace-pre-wrap`,children:w.content}),(0,N.jsx)(S,{size:`sm`,id:`vault-recover`,className:`justify-self-start`,onClick:()=>{f(w.content),m(w.content),w.token&&_(w.token),T(null),b(`incoming version loaded into the editor`)},children:`Put incoming content back`})]}):null]}),(0,N.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-2 max-lg:grid-cols-1`,children:[(0,N.jsx)(`textarea`,{id:`vault-editor`,"data-vault-editor":!0,"data-vault-path":a.path,"aria-label":`Markdown source of ${B(a.path)}`,spellCheck:!1,value:d,onChange:e=>f(e.target.value),className:y(`min-h-[60vh] resize-none border-0 border-r border-rule-soft bg-transparent px-6 pt-4 pb-10 font-mono text-[0.86rem] leading-[1.75] text-text outline-none focus-visible:outline-none max-lg:border-r-0`)}),(0,N.jsx)(H,{companion:e,open:a,text:d})]})]})}var U=e=>e.split(`/`).filter(Boolean),W=`flex w-full min-w-0 items-center gap-2 rounded-[6px] border-0 bg-transparent px-2.5 py-1.5 text-left text-sm text-text no-underline hover:bg-surface aria-[current=page]:bg-accent-soft aria-[current=page]:font-semibold`;function G({entry:e,current:t,label:n}){return(0,N.jsxs)(s,{to:`/vault`,search:t=>({...t,path:e.path,dir:void 0,mode:void 0}),className:y(W,`vault-file`),"data-vault-entry":e.path,"aria-current":t?`page`:void 0,children:[(0,N.jsx)(x,{name:`doc`,className:y(`size-3.5`,t?`text-accent`:`text-muted`)}),(0,N.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n??e.name})]})}function K({dir:e,className:t,children:n}){return(0,N.jsx)(s,{to:`/vault`,search:t=>({...t,path:void 0,dir:e??void 0,mode:void 0}),className:t,children:n})}function q({entry:e,companion:t,search:n}){return e.kind===`file`?(0,N.jsx)(G,{entry:e,current:n.path===e.path}):(0,N.jsx)(re,{entry:e,companion:t,search:n})}function re({entry:e,companion:t,search:n}){let[r,i]=(0,j.useState)(e.children!==void 0),a=v({...u(t,e.path),enabled:r&&e.children===void 0}),o=e.children??a.data?.entries;return(0,N.jsxs)(`details`,{className:`vault-directory group/dir`,open:r,"data-vault-dir":e.path,onToggle:e=>i(e.currentTarget.open),children:[(0,N.jsxs)(`summary`,{className:y(W,`cursor-pointer list-none font-semibold [&::-webkit-details-marker]:hidden`),"aria-current":n.dir===e.path?`page`:void 0,children:[(0,N.jsx)(x,{name:`right`,className:`size-3 text-muted transition-transform group-open/dir:rotate-90`}),(0,N.jsx)(x,{name:`folder`,className:`size-3.5 text-muted`}),(0,N.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]}),(0,N.jsxs)(`div`,{className:`vault-children grid gap-px pl-3.5`,children:[r&&o?o.map(e=>(0,N.jsx)(q,{entry:e,companion:t,search:n},e.path)):null,a.error?(0,N.jsx)(`p`,{className:`vault-warning m-0 px-2.5 py-1 text-xs text-warn`,children:a.error.message}):null]})]})}var J=`m-0 px-2.5 py-1.5 text-sm text-muted`,Y=`vault-warning m-0 px-2.5 py-1.5 text-xs text-warn`;function ie({data:e,companion:t,search:n}){return e.failure?(0,N.jsx)(`div`,{"data-vault-slot":`tree`,children:(0,N.jsxs)(`p`,{className:Y,children:[`The files could not be listed: `,e.failure]})}):e.tree===null?(0,N.jsx)(`div`,{"data-vault-slot":`tree`,"aria-busy":`true`,children:(0,N.jsx)(`p`,{className:y(J,`empty`),children:`Listing files…`})}):(0,N.jsxs)(`div`,{"data-vault-slot":`tree`,"data-vault-generation":e.generation??void 0,children:[(0,N.jsx)(ae,{data:e}),e.tree.length===0?(0,N.jsx)(`p`,{className:y(J,`empty`),children:`This companion has no markdown files.`}):(0,N.jsx)(`nav`,{className:`vault-tree grid gap-px`,"aria-label":`Markdown files`,children:e.tree.map(e=>(0,N.jsx)(q,{entry:e,companion:t,search:n},e.path))})]})}function ae({data:e}){return e.warning?(0,N.jsxs)(`p`,{className:Y,children:[e.warning,`. The tree may be out of date.`]}):e.watching?null:(0,N.jsx)(`p`,{className:Y,children:`The tree may be out of date.`})}function oe({companion:e,query:t,search:n}){let[r,i]=(0,j.useState)(t);(0,j.useEffect)(()=>{let e=setTimeout(()=>i(t),150);return()=>clearTimeout(e)},[t]);let a=v({...h(e,r),enabled:r.trim().length>0});if(!a.data)return null;let{shown:o,total:s}=a.data,c=s-o.length;return(0,N.jsxs)(`div`,{"data-vault-filter-results":!0,children:[o.length===0?(0,N.jsx)(`p`,{className:y(J,`empty`),children:`No files match.`}):(0,N.jsx)(`nav`,{className:`vault-tree vault-results grid gap-px`,"aria-label":`Matching files`,children:o.map(e=>(0,N.jsx)(G,{entry:e,current:n.path===e.path,label:e.path},e.path))}),c>0?(0,N.jsxs)(`p`,{className:J,"data-vault-more":!0,children:[c,` more match`,c===1?``:`es`,`; refine the filter.`]}):null]})}var X=`vault-crumb rounded-[6px] px-1.5 py-0.5 text-sm text-muted no-underline hover:bg-surface hover:text-text`;function se({rootName:e,search:t}){let n=U(t.path??t.dir??``);return(0,N.jsx)(`nav`,{className:`vault-breadcrumb min-w-0`,"aria-label":`Breadcrumb`,"data-vault-crumb":!0,children:(0,N.jsxs)(`ol`,{className:`m-0 flex min-w-0 list-none items-center gap-0.5 overflow-hidden p-0 text-sm text-muted`,children:[(0,N.jsx)(`li`,{className:`flex-none`,children:n.length===0?(0,N.jsx)(`span`,{"aria-current":`page`,className:`px-1.5 font-semibold text-text`,children:e}):(0,N.jsx)(K,{dir:null,className:X,children:e})}),n.map((e,t)=>{let r=n.slice(0,t+1).join(`/`),i=t===n.length-1;return(0,N.jsxs)(`li`,{className:y(`flex items-center gap-0.5`,i?`min-w-0`:`flex-none max-md:hidden`),children:[(0,N.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),i?(0,N.jsx)(`span`,{"aria-current":`page`,className:`truncate px-1.5 font-semibold text-text`,children:e}):(0,N.jsx)(K,{dir:r,className:X,children:e})]},r)})]})})}function ce(e,t){let n=e;for(let e of U(t)){let t=n?.find(t=>t.kind===`directory`&&t.name===e);if(!t)return null;n=t.children}return n??null}function le({data:e,rootName:t}){let n=e.failure?(0,N.jsxs)(`p`,{className:Y,children:[`The files could not be listed: `,e.failure]}):e.tree===null?(0,N.jsx)(`p`,{className:y(J,`empty`),children:`Listing files…`}):null,r=e.dir?U(e.dir):[],i=r.at(-1)??t;if(n)return(0,N.jsx)(`div`,{"data-vault-slot":`listing`,className:`vault-listing mx-auto w-full max-w-[820px] px-10 py-8`,"aria-busy":e.tree===null,children:n});let a=(e.dir?ce(e.tree,e.dir):null)??e.tree;return(0,N.jsxs)(`div`,{"data-vault-slot":`listing`,className:`vault-listing mx-auto grid w-full max-w-[820px] gap-4 px-10 py-8 max-sm:px-4`,children:[(0,N.jsx)(`h1`,{className:`m-0 text-xl font-semibold`,children:i}),e.dirMissing?(0,N.jsx)(`p`,{className:Y,children:`That folder is not in the tree; showing the root.`}):null,a.length===0&&r.length===0?(0,N.jsx)(`p`,{className:y(J,`empty`),children:`This companion has no markdown files.`}):(0,N.jsx)(O,{title:`In this folder`,count:a.length,children:(0,N.jsxs)(`ul`,{className:`vault-rows m-0 list-none p-0`,"aria-label":`Folder contents`,children:[r.length>0?(0,N.jsx)(`li`,{children:(0,N.jsxs)(K,{dir:r.length>1?r.slice(0,-1).join(`/`):null,className:y(D,`vault-row py-1.5`),children:[(0,N.jsx)(x,{name:`left`,className:`text-muted`}),(0,N.jsx)(`span`,{children:`..`})]})}):null,a.map(e=>(0,N.jsx)(`li`,{children:e.kind===`directory`?(0,N.jsxs)(K,{dir:e.path,className:y(D,`vault-row py-1.5 font-semibold`),children:[(0,N.jsx)(x,{name:`folder`,className:`text-muted`}),(0,N.jsx)(`span`,{className:`truncate`,children:e.name})]}):(0,N.jsxs)(s,{to:`/vault`,search:t=>({...t,path:e.path,dir:void 0,mode:void 0}),className:y(D,`vault-row py-1.5`),children:[(0,N.jsx)(x,{name:`doc`,className:`text-muted`}),(0,N.jsx)(`span`,{className:`truncate`,children:e.name})]})},e.path))]})})]})}function Z(e){return typeof e==`string`?e:(e.c??[]).map(Z).join(``)}function ue(e){return(e??[]).filter(e=>typeof e!=`string`&&e.t===`h2`).map((e,t)=>({index:t,text:Z(e)}))}var Q=e=>[...e?.querySelectorAll(`article .markdown-body h2`)??[]];function de(e,t,n){let[r,i]=(0,j.useState)(null);return(0,j.useEffect)(()=>{if(!t)return;let n=e.current,r=Q(n);if(r.length===0||typeof IntersectionObserver>`u`)return;let a=new IntersectionObserver(e=>{let t=e.find(e=>e.isIntersecting);t&&i(r.indexOf(t.target))},{root:n,rootMargin:`-60px 0px -70% 0px`});for(let e of r)a.observe(e);return()=>a.disconnect()},[e,t]),{current:r!==null&&r<n?r:0,go:t=>{Q(e.current)[t]?.scrollIntoView({behavior:`smooth`,block:`start`}),i(t)}}}function fe({headings:e,current:t,go:n}){return(0,N.jsxs)(`nav`,{className:`vault-outline min-h-0 overflow-auto border-l border-rule-soft px-5 pt-[72px] pb-6 @max-[1080px]:hidden`,"aria-label":`Outline`,children:[(0,N.jsx)(`h2`,{className:`m-0 mb-2 text-xs font-semibold text-muted`,children:`On this page`}),(0,N.jsx)(`ol`,{className:`m-0 grid list-none gap-0.5 p-0`,children:e.map(e=>(0,N.jsx)(`li`,{children:(0,N.jsx)(`button`,{type:`button`,className:y(`block w-full truncate rounded-r-[8px] border-0 bg-transparent px-2.5 py-1 text-left text-sm text-text hover:bg-surface`,t===e.index&&`font-semibold text-accent shadow-[inset_2px_0_0_var(--accent)]`),"aria-current":t===e.index?`location`:void 0,onClick:()=>n(e.index),children:e.text})},e.index))})]})}var pe=[],$=(e,t)=>[e?`272px`:null,`minmax(0,1fr)`,t?`232px`:null].filter(Boolean).join(` `);function me({data:e,companion:t,search:n,stale:r,refresh:i,filter:o,setFilter:s,hidden:c}){return(0,N.jsxs)(`aside`,{hidden:c,className:`vault-tree-panel flex min-h-0 flex-col border-r border-rule @max-[720px]:max-h-[40vh] @max-[720px]:border-r-0 @max-[720px]:border-b`,id:`vault-tree-panel`,"aria-label":`Files`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between pt-3 pr-2.5 pb-2 pl-5`,children:[(0,N.jsx)(`strong`,{className:`text-sm`,children:`Files`}),(0,N.jsx)(a,{label:`Refresh tree`,side:`bottom`,children:(0,N.jsx)(S,{size:`icon-sm`,variant:`ghost`,"aria-label":i.isPending?`Refreshing…`:`Refresh tree`,onClick:()=>i.mutate(),disabled:i.isPending,children:(0,N.jsx)(x,{name:`refresh`,className:i.isPending?`animate-spin`:void 0})})})]}),(0,N.jsx)(`p`,{id:`vault-stale`,className:Y+` mx-2.5`,role:`status`,hidden:!r,children:`Files changed — refresh tree.`}),i.error?(0,N.jsx)(`p`,{className:Y+` mx-2.5`,role:`status`,children:i.error.message}):null,(0,N.jsxs)(`label`,{className:`mx-3.5 mb-2 flex h-[34px] items-center gap-2 rounded-control border border-rule bg-surface pr-2 pl-2.5 text-muted focus-within:border-accent`,children:[(0,N.jsx)(x,{name:`search`,className:`size-3.5`}),(0,N.jsx)(`input`,{type:`search`,id:`vault-filter`,className:`vault-filter min-w-0 flex-1 border-0 bg-transparent text-sm text-text outline-none placeholder:text-muted`,placeholder:`Go to file`,"aria-label":`Go to file`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Escape`&&s(``)}})]}),(0,N.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-2.5 pb-6`,children:o.trim()?(0,N.jsx)(oe,{companion:t,query:o,search:n}):(0,N.jsx)(ie,{data:e,companion:t,search:n})})]})}function he({companion:e,rootName:r,writable:o,search:s}){let c=C(),l=v(m(e,s)),u=v({...m(e,s,!0),enabled:!(!l.data||l.data.tree!==null||l.data.failure)}).data??l.data,[d,h]=(0,j.useState)(``),g=n(e=>e.latestGeneration),_=n(e=>e.treeHidden),y=n(e=>e.toggleTree),b=n(e=>e.hydrate);(0,j.useEffect)(b,[b]);let w=t({mutationFn:()=>f({data:{companion:e,path:s.path,dir:s.dir,refresh:!0,wait:!0}}),onSuccess:t=>void p(c,e,s,t)}),T=(0,j.useRef)(null),E=!!u?.open&&s.mode!==`edit`,D=E?ue(u?.open?.markdown):pe,O=de(T,E?u?.open?.markdown:void 0,D.length);if(!u)return(0,N.jsx)(i,{});let k=g!==null&&u.generation!==null&&g>u.generation,A=D.length>0,M=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(a,{label:_?`Show files`:`Hide files`,side:`bottom`,children:(0,N.jsx)(S,{size:`icon-sm`,variant:`ghost`,id:`vault-tree-toggle`,"aria-controls":`vault-tree-panel`,"aria-expanded":!_,"aria-label":_?`Show files`:`Hide files`,onClick:y,children:(0,N.jsx)(x,{name:`sidebar`})})}),(0,N.jsx)(se,{rootName:r,search:s})]});return(0,N.jsx)(`div`,{className:`@container flex min-h-0 flex-1 flex-col`,children:(0,N.jsxs)(`section`,{className:`vault-layout grid min-h-0 flex-1 border-t border-rule @max-[720px]:grid-cols-1!`,style:{"--vault-wide":$(!0,A),"--vault-wide-bare":$(!1,A),"--vault-narrow":$(!0,!1),"--vault-narrow-bare":$(!1,!1)},"data-vault-layout":!0,children:[(0,N.jsx)(me,{data:u,companion:e,search:s,stale:k,refresh:w,filter:d,setFilter:h,hidden:_}),(0,N.jsx)(`div`,{ref:T,className:`vault-main min-h-0 min-w-0 overflow-auto scroll-smooth`,"data-vault-main":!0,"data-vault-pane":!0,children:s.path||u.open||u.refusal?(0,N.jsx)(z,{companion:e,data:u,writable:o,search:s,crumbs:M}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(F,{crumbs:M}),(0,N.jsx)(le,{data:u,rootName:r})]})}),A?(0,N.jsx)(fe,{headings:D,...O}):null]})})}function ge(){let t=e.useSearch(),{data:n}=o(_({companion:t.companion,studioMode:t.studioMode}));if(!t.companion||!n.selected)return null;let r=n.selected.path.split(/[\\/]/).findLast(Boolean)??`companion`;return(0,N.jsx)(he,{companion:t.companion,rootName:r,writable:n.writable,search:{path:t.path,dir:t.dir,mode:t.mode}})}export{ge as component};
@@ -1 +0,0 @@
1
- import{Tr as e}from"./button-D6LrRkOG.js";import{c as t}from"./store-DJ5cncKA.js";import{t as n}from"./jsx-runtime-MZURdZre.js";var r=n();function i({warnings:n}){return n.length===0?null:(0,r.jsx)(`section`,{className:e(t,`pb-4`),"aria-label":`Warnings`,children:(0,r.jsxs)(`div`,{className:`warnings grid gap-1.5 rounded-card border border-[color-mix(in_srgb,var(--warn)_35%,var(--border))] bg-warn-soft px-4 py-3 text-sm`,children:[(0,r.jsx)(`h2`,{className:`m-0 text-sm font-semibold text-warn`,children:`Some data could not be read`}),(0,r.jsx)(`ul`,{className:`m-0 grid list-none gap-1 p-0`,children:n.map(e=>(0,r.jsx)(`li`,{children:e},e))})]})})}export{i as t};
@@ -1 +0,0 @@
1
- import{Dr as e,Tr as t}from"./button-D6LrRkOG.js";import{_ as n,f as r,i,x as a,y as o}from"./index-BBmFpG4y.js";import{a as s}from"./studio-queries-CFP_yTpr.js";import{t as c}from"./companion-view-BVaZNtiI.js";import{p as l}from"./studio-BR9j15J0.js";import{t as u}from"./warnings-UHFy6HAp.js";import{a as d,n as f,t as p}from"./jsx-runtime-MZURdZre.js";import{a as m,c as h,i as g,s as _,u as v}from"./store-DJ5cncKA.js";import{n as y,r as b,t as x}from"./panel-B8F8sOKQ.js";import{i as S,n as C,r as w,t as T}from"./steps-DhIFuAZy.js";var E=d(f(),1),D=e=>({id:e.id,kind:`stage`,step:e});function O(e){let t=e.map.map(e=>e.kind===`stage`?{nodes:[D(e.step)],optional:e.step.optional,phase:e.step.phase}:e.group===`human`?{nodes:[{id:C(e.steps[0]),kind:`review-group`,steps:e.steps}],optional:e.steps[0].optional,phase:e.steps[0].phase}:{nodes:e.steps.map(D),optional:!0,phase:e.steps[0].phase});return t.unshift({nodes:[{id:`start`,kind:`start`}],optional:!1,phase:t[0]?.phase??`plan`}),t}function k(e){return e.kind===`stage`?!!e.step.sessionBreakBefore:e.kind===`review-group`&&!!e.steps[0].sessionBreakBefore}function A(e){let t=[],n=(e,n,r)=>{for(let i of e)for(let e of n)t.push({from:i.id,to:e.id,kind:r,newSession:k(e)})};return e.forEach((t,r)=>{let i=e[r+1];i&&n(t.nodes,i.nodes,`flow`);let a=e[r-1];t.optional&&a&&i&&n(a.nodes,i.nodes,`bypass`)}),t}function ee(e){let t=[];return e.forEach((e,n)=>{let r=t.at(-1);r?.phase===e.phase?r.to=n+1:t.push({phase:e.phase,label:T[e.phase],from:n,to:n+1})}),t}function j(e){let t=e.findIndex(e=>e.nodes.some(e=>e.id===`submit`));return t===-1?null:{from:0,to:t+1}}function M(e){let t=O(e),n=Math.max(1,...t.map(e=>e.nodes.length)),r=t.flatMap((e,t)=>e.nodes.map((r,i)=>e.nodes.length===1?{...r,column:t,row:0,rowSpan:n}:{...r,column:t,row:i,rowSpan:1}));return{columns:t.length,rows:n,nodes:r,edges:A(t),bands:ee(t),cycle:j(t)}}var N=e=>e.rows*2+1;function P(e){return{along:e.column+.5,across:e.row*2+e.rowSpan}}var F=e=>Math.round(e*1e4)/1e4,I=(e,t)=>`${F(e/t*100)}%`,L=({along:e,across:t})=>`${F(t)} ${F(e)}`;function R(e,t){let n=t=>{let n=e.nodes.find(e=>e.id===t);if(!n)throw Error(`Unknown graph node: ${t}`);return P(n)};return[n(t.from),n(t.to)]}function z(e,t){let[n,r]=R(e,t);if(t.kind===`bypass`){let t=N(e);return`M ${L(n)} C ${L({along:n.along,across:t})}, ${L({along:r.along,across:t})}, ${L(r)}`}let i=(n.along+r.along)/2;return`M ${L(n)} C ${L({along:i,across:n.across})}, ${L({along:i,across:r.across})}, ${L(r)}`}function B(e,t){let[n,r]=R(e,t),i=(n.along+r.along)/2;return t.kind===`bypass`?{along:i,across:(n.across+r.across)/8+N(e)*3/4}:{along:i,across:(n.across+r.across)/2}}function V(e,t){return{x:I(t.across,N(e)),y:I(t.along,e.columns)}}function H(e,t){return{top:I(t.from,e.columns),height:I(t.to-t.from,e.columns)}}var U=p(),W={},G=[];function te({payload:e,counts:t=W,changesByStage:n=G}){let r=S({skills:e.skills&&e.skills.length>0?e.skills:void 0,topology:e.topology,workflow:e.workflow}),[i,a]=(0,E.useState)(r.paths[0].schema),o=r.paths.find(e=>e.schema===i)??r.paths[0];return(0,U.jsx)(`section`,{className:`workflow-delivery-path @container grid content-start gap-2`,"aria-label":`Delivery Path`,children:(0,U.jsx)(K,{path:o,paths:r.paths,onSchemaChange:a,counts:t,changesByStage:n})})}function K({path:e,paths:n,onSchemaChange:r,counts:i,changesByStage:a}){let[o,s]=(0,E.useState)(null),c=e.steps.find(e=>e.id===o)??null,l=a.filter(e=>e.changes.length>0);return(0,U.jsxs)(`div`,{className:t(h,`workflow-path grid grid-cols-[minmax(380px,520px)_minmax(260px,1fr)] items-start gap-10 pt-10 pb-12 @max-[880px]:grid-cols-1`),"data-workflow-schema-panel":e.schema,children:[(0,U.jsxs)(`div`,{className:`workflow-path-graph grid min-w-0 justify-items-center gap-9 px-8 pt-4`,children:[(0,U.jsx)(X,{path:e,selected:o,onSelect:s,counts:i}),(0,U.jsx)(Q,{})]}),(0,U.jsxs)(`div`,{className:`workflow-detail-overview grid content-start gap-5`,id:q(e),children:[(0,U.jsxs)(`div`,{className:`grid gap-2 text-sm leading-relaxed text-muted`,children:[(0,U.jsx)(`p`,{className:`workflow-description m-0 text-text`,children:e.description}),e.reviewsKnown?null:(0,U.jsx)(`p`,{className:`workflow-description m-0`,children:`The schema's artifacts could not be read, so its review stages are unknown.`}),(0,U.jsx)(`p`,{className:`workflow-description m-0`,children:`A workset is one or more changes published together: after Submit change, start again at the top for the next change, and publish once the workset is merged.`}),(0,U.jsx)(`p`,{className:`workflow-detail-hint m-0`,children:`Choose a stage to see what it does and the prompt that runs it.`})]}),l.length>0?(0,U.jsx)(_,{title:`Where your changes are`,children:(0,U.jsx)(`ul`,{className:`m-0 list-none p-0`,children:l.map(e=>(0,U.jsxs)(`li`,{className:`grid gap-1 border-t border-rule-soft px-4 py-2 first:border-t-0`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[e.label,(0,U.jsx)(m,{value:e.changes.length})]}),(0,U.jsx)(`span`,{className:`truncate font-mono text-xs text-muted`,children:e.changes.join(`, `)})]},e.node))})}):null]}),(0,U.jsx)(b,{items:e.steps.map(e=>e.id),current:c?.id??null,onSelect:s,title:c?`Stage ${c.label}`:`Stage`,children:c?(0,U.jsx)(re,{step:c,stepsKnown:e.stepsKnown,changes:a.find(e=>e.node===C(c))?.changes??[],children:c.kind===`human`?(0,U.jsx)(y,{title:`OpenSpec schema`,children:(0,U.jsxs)(`div`,{className:`grid gap-2`,"data-workflow-schema-root":!0,children:[n.length>1?(0,U.jsx)(v,{label:`OpenSpec schema`,value:e.schema,onChange:e=>{let t=n.find(t=>t.schema===e);t&&(t.steps.some(e=>e.id===o)||s(t.steps.find(e=>e.kind===`human`)?.id??null),r(e))},options:n.map(e=>({value:e.schema,label:e.label}))}):(0,U.jsx)(`code`,{className:`font-mono text-sm`,children:e.label}),(0,U.jsx)(`span`,{className:`text-sm text-muted`,children:e.tagline})]})}):null}):null})]})}var q=e=>`workflow-${e.schema}-overview`,J=(e,t,n)=>e.startsWith(`reviews`)?`${n} ${n===1?`change waits`:`changes wait`} for review`:`${n} ${n===1?`change`:`changes`} at ${t}`;function Y({count:e,name:t}){return e?(0,U.jsx)(`span`,{className:`workflow-graph-count absolute -top-2.5 -right-2.5 z-1 inline-grid h-5 min-w-5 place-items-center rounded-full border border-[color-mix(in_srgb,var(--accent)_45%,var(--border))] bg-accent-soft px-1.5 font-sans text-2xs font-bold text-text`,"aria-label":t,role:`img`,children:e}):null}function X({path:e,label:t=`Delivery Path map`,selected:n=null,onSelect:r,counts:i=W}){let a=M(e),o=!r;return(0,U.jsxs)(`nav`,{className:`workflow-graph`,"aria-label":t,style:{"--graph-columns":String(a.columns),"--graph-rows":String(a.rows)},children:[(0,U.jsxs)(`div`,{className:`workflow-graph-bands`,"aria-hidden":`true`,children:[a.bands.map(e=>(0,U.jsx)(`div`,{className:`workflow-graph-band`,"data-band":e.phase,style:H(a,e),children:e.label},e.phase)),a.cycle?(0,U.jsx)(`div`,{className:`workflow-graph-cycle`,style:H(a,a.cycle),children:(0,U.jsx)(`span`,{children:`repeats for each change`})}):null,(0,U.jsx)(`div`,{className:`workflow-graph-workset`,children:(0,U.jsx)(`span`,{children:`workset`})})]}),(0,U.jsx)(ne,{graph:a}),(0,U.jsx)(`ol`,{className:`workflow-graph-nodes`,children:a.nodes.map(e=>e.kind===`start`?null:(0,U.jsx)(`li`,{className:`workflow-graph-node`,"data-node-kind":e.kind,style:{"--graph-row":String(e.column+1),"--graph-lane":String(e.row+1),"--graph-span":String(e.rowSpan)},children:e.kind===`stage`?(0,U.jsxs)(`span`,{className:`relative max-w-full`,children:[(0,U.jsx)($,{step:e.step,box:!0,plain:o,current:n===e.step.id,onSelect:r}),o?null:(0,U.jsx)(Y,{count:i[e.id],name:J(e.id,e.step.label,i[e.id]??0)})]}):(0,U.jsxs)(`div`,{className:`workflow-graph-box workflow-graph-group relative`,"data-map-group":`human`,"data-current":e.steps.some(e=>e.id===n)?`true`:void 0,children:[o?(0,U.jsx)(`span`,{className:`workflow-graph-group-label`,children:Z(e.steps)}):(0,U.jsx)(`button`,{type:`button`,className:`workflow-graph-group-label cursor-pointer rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,onClick:()=>r?.(e.steps[0].id),children:Z(e.steps)}),(0,U.jsx)(`ol`,{children:e.steps.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)($,{step:e,plain:o,current:n===e.id,onSelect:r})},e.id))}),o?null:(0,U.jsx)(Y,{count:i[e.id],name:J(e.id,Z(e.steps),i[e.id]??0)})]})},e.id))})]})}function Z(e){let[t]=e;return t?.kind===`human`?t.groupLabel:`Human review`}function Q(){return(0,U.jsxs)(`ul`,{className:`workflow-graph-legend`,"aria-hidden":`true`,children:[(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`i`,{className:`workflow-legend-optional`}),`optional`]}),(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`i`,{className:`workflow-graph-openspec`}),`OpenSpec`]}),(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`i`,{className:`workflow-legend-session`}),`new session`]}),(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`i`,{className:`workflow-legend-skip`}),`can be skipped`]})]})}function ne({graph:e}){return(0,U.jsxs)(`svg`,{className:`workflow-graph-layer`,"aria-hidden":`true`,focusable:`false`,children:[(0,U.jsx)(`svg`,{viewBox:`0 0 ${N(e)} ${e.columns}`,preserveAspectRatio:`none`,overflow:`visible`,children:e.edges.map(t=>(0,U.jsx)(`path`,{className:`workflow-graph-edge`,d:z(e,t),"data-edge-kind":t.kind,"data-edge-from":t.from,"data-edge-to":t.to,"data-new-session":t.newSession?`true`:void 0},`${t.kind}-${t.from}-${t.to}`))}),e.nodes.map(t=>{if(t.kind!==`start`)return null;let{x:n,y:r}=V(e,P(t));return(0,U.jsx)(`circle`,{className:`workflow-graph-start`,cx:n,cy:r,r:`3.5`},t.id)}),e.edges.map(t=>{if(!t.newSession)return null;let{x:n,y:r}=V(e,B(e,t));return(0,U.jsx)(`circle`,{className:`workflow-graph-session`,"data-session-mark":t.to,cx:n,cy:r,r:`3.5`},`${t.from}-${t.to}`)})]})}function $({step:e,box:t,plain:n,current:r,onSelect:i}){let a={className:t?`workflow-graph-link workflow-graph-box`:`workflow-graph-link`,"data-map-stage":e.id,"data-stage-kind":e.kind,"data-optional":e.optional?`true`:void 0},o=(0,U.jsxs)(U.Fragment,{children:[e.badges.includes(`openspec`)?(0,U.jsx)(`span`,{className:`workflow-graph-openspec`,"aria-hidden":`true`}):null,e.kind===`human`?e.artifact:e.label]});return n?(0,U.jsx)(`span`,{...a,children:o}):(0,U.jsx)(`button`,{type:`button`,...a,"aria-label":e.kind===`human`?e.label:void 0,"aria-current":r?`true`:void 0,onClick:()=>i?.(e.id),children:o})}function re({step:e,stepsKnown:t,changes:n,children:r}){return(0,U.jsxs)(`article`,{className:`workflow-card`,"data-stage":e.id,"data-stage-kind":e.kind,"data-optional":e.optional?`true`:void 0,children:[(0,U.jsx)(x,{title:e.label,kicker:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:T[e.phase]}),e.optional?(0,U.jsx)(`span`,{children:`· optional`}):null,e.kind===`human`?(0,U.jsx)(`span`,{className:`text-why`,children:`· human review`}):null,e.badges.includes(`openspec`)?(0,U.jsx)(`span`,{children:`· OpenSpec`}):null]}),children:e.skill||e.sessionBreakBefore?(0,U.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm text-muted`,children:[e.skill?(0,U.jsx)(`code`,{className:`font-mono text-text`,children:e.skill}):null,e.sessionBreakBefore?(0,U.jsxs)(`span`,{className:`workflow-card-session inline-flex items-center gap-1.5 text-accent`,children:[(0,U.jsx)(`span`,{className:`size-2 rounded-full border-[1.5px] border-accent`,"aria-hidden":`true`}),`New session / clean chat`]}):null]}):null}),r,(0,U.jsxs)(y,{title:e.kind===`human`?`How it runs`:`Run`,children:[(0,U.jsx)(ie,{step:e}),e.missingSkill?(0,U.jsxs)(`p`,{className:`workflow-missing-skill m-0 text-sm text-warn`,role:`note`,children:[`Skill not reported for this companion:`,` `,(0,U.jsx)(`code`,{className:`font-mono`,children:e.missingSkill}),`. Run`,` `,(0,U.jsx)(`code`,{className:`font-mono`,children:`mate companion update`}),`; this stage is not complete.`]}):null]}),e.kind===`skill`&&t?(0,U.jsx)(y,{title:`Steps`,aside:e.source,children:(0,U.jsx)(`ol`,{className:`workflow-stage-steps m-0 grid list-decimal gap-1 pl-5 text-sm`,children:e.steps.map((e,t)=>(0,U.jsx)(`li`,{children:(0,U.jsx)(`code`,{className:`font-mono`,children:e.skill})},`${t}-${e.skill}`))})}):null,(0,U.jsx)(y,{title:`What`,children:(0,U.jsx)(`p`,{className:`m-0 text-sm leading-relaxed`,children:e.what})}),(0,U.jsx)(y,{title:`Why`,children:(0,U.jsx)(`p`,{className:`m-0 text-sm leading-relaxed`,children:e.why})}),n.length>0?(0,U.jsx)(y,{title:`Changes at this stage`,aside:String(n.length),children:(0,U.jsx)(`ul`,{className:`m-0 grid list-none gap-1 p-0`,children:n.map(e=>(0,U.jsx)(`li`,{className:`truncate font-mono text-sm`,children:e},e))})}):null]})}function ie({step:e}){return e.kind===`human`?(0,U.jsxs)(`p`,{className:`workflow-card-human m-0 text-sm`,children:[`Review `,e.artifact,` yourself — no skill, no prompt`]}):e.alternatives?.length?(0,U.jsx)(`div`,{className:`workflow-option-list grid gap-3`,children:e.alternatives.map(e=>(0,U.jsxs)(`div`,{className:`workflow-option grid gap-1.5`,children:[(0,U.jsx)(g,{text:e.prompt,copy:e.copyPrompt,label:`${e.name} prompt`}),(0,U.jsx)(`small`,{className:`text-xs text-muted`,children:e.description})]},e.name))}):e.prompt?(0,U.jsx)(g,{text:e.prompt,copy:e.copyPrompt??e.prompt,label:`${e.label} prompt`}):null}var ae=l();function oe(e,t){let n=e.map(e=>({name:e.name,stage:a(e,t).stageId})),r=o(t).map(e=>({node:e.kind===`review`?w(e.id):e.id,label:e.label,changes:n.flatMap(t=>t.stage===e.id?[t.name]:[])})),i={};for(let e of r)e.changes.length>0&&(i[e.node]=e.changes.length);return{counts:i,byStage:r}}var se=[];function ce({payload:e,changes:t=se}){let{counts:n,byStage:r}=oe(t,e.workflow??ae);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(u,{warnings:e.warnings}),(0,U.jsx)(`div`,{className:`workflow-view`,children:(0,U.jsx)(te,{payload:e,counts:n,changesByStage:r})})]})}var le=function(){let t=i.useSearch(),a=r(),o=e({...s(`dashboard`,t),enabled:a});return(0,U.jsx)(c,{view:`workflow`,search:t,children:e=>(0,U.jsx)(ce,{payload:{skills:e.skills??[],topology:e.topology??null,warnings:e.warnings,workflow:e.workflow},changes:n(o.data?.changes??[],o.data?.submitted??[])})})};export{le as component};
@@ -1,89 +0,0 @@
1
- import { n as require_react, o as __toESM } from "./jsx-runtime-Bt0s0YKS.js";
2
- import { _ as COMPANION_PARAM, g as COMPANION_DIGEST_PATTERN } from "./studio-CB94np48.js";
3
- // src/shell/prepaint.ts
4
- var THEME_STORAGE_KEY = "mate-studio-theme";
5
- var COMPANION_STORAGE_KEY = "mate-studio-companion";
6
- var VAULT_TREE_STORAGE_KEY = "mate-studio-vault-tree";
7
- var RAIL_STORAGE_KEY = "mate-studio-rail";
8
- /**
9
- * Runs in `<head>` before first paint. A server-rendered document arrives with
10
- * its markup already in place, so a remembered appearance applied after load
11
- * would paint the other one first and then repaint (so would a collapsed sidebar), and a remembered companion
12
- * restored after load would paint the picker before leaving it.
13
- *
14
- * The restore names the companion in the URL and reloads, because the URL is
15
- * what the server answers. A companion parameter that is present and empty is
16
- * a deliberate "no companion" and is left alone, so the redirect cannot loop
17
- * and the picker stays reachable.
18
- */
19
- var STUDIO_PREPAINT_SCRIPT = `(function () {
20
- try {
21
- var chosen = localStorage.getItem(${JSON.stringify(THEME_STORAGE_KEY)});
22
- if (chosen === "dark" || chosen === "light") {
23
- document.documentElement.setAttribute("data-theme", chosen);
24
- }
25
- if (localStorage.getItem(${JSON.stringify(VAULT_TREE_STORAGE_KEY)}) === "hidden") {
26
- document.documentElement.setAttribute("data-vault-tree", "hidden");
27
- }
28
- if (localStorage.getItem(${JSON.stringify(RAIL_STORAGE_KEY)}) === "min") {
29
- document.documentElement.setAttribute("data-rail", "min");
30
- }
31
- } catch (error) {
32
- /* a blocked web store only costs the preference, never the page */
33
- }
34
-
35
- try {
36
- var params = new URLSearchParams(location.search);
37
- var last = localStorage.getItem(${JSON.stringify(COMPANION_STORAGE_KEY)});
38
- if (!params.has(${JSON.stringify(COMPANION_PARAM)}) && ${String(COMPANION_DIGEST_PATTERN)}.test(last || "")) {
39
- params.set(${JSON.stringify(COMPANION_PARAM)}, last);
40
- location.replace(location.pathname + "?" + params.toString());
41
- }
42
- } catch (error) {
43
- /* a blocked web store only costs the restore, never the page */
44
- }
45
- })();`;
46
- // ../../node_modules/.bun/zustand@5.0.16+f73d66fb2ea5e116/node_modules/zustand/esm/vanilla.mjs
47
- var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
48
- var createStoreImpl = (createState) => {
49
- let state;
50
- const listeners = /* @__PURE__ */ new Set();
51
- const setState = (partial, replace) => {
52
- const nextState = typeof partial === "function" ? partial(state) : partial;
53
- if (!Object.is(nextState, state)) {
54
- const previousState = state;
55
- state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
56
- listeners.forEach((listener) => listener(state, previousState));
57
- }
58
- };
59
- const getState = () => state;
60
- const getInitialState = () => initialState;
61
- const subscribe = (listener) => {
62
- listeners.add(listener);
63
- return () => listeners.delete(listener);
64
- };
65
- const api = {
66
- setState,
67
- getState,
68
- getInitialState,
69
- subscribe
70
- };
71
- const initialState = state = createState(setState, getState, api);
72
- return api;
73
- };
74
- var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
75
- // ../../node_modules/.bun/zustand@5.0.16+f73d66fb2ea5e116/node_modules/zustand/esm/react.mjs
76
- var identity = (arg) => arg;
77
- function useStore(api, selector = identity) {
78
- const slice = import_react.useSyncExternalStore(api.subscribe, import_react.useCallback(() => selector(api.getState()), [api, selector]), () => selector(api.getInitialState()));
79
- import_react.useDebugValue(slice);
80
- return slice;
81
- }
82
- var createImpl = (createState) => {
83
- const api = createStore(createState);
84
- const useBoundStore = (selector) => useStore(api, selector);
85
- Object.assign(useBoundStore, api);
86
- return useBoundStore;
87
- };
88
- var create = ((createState) => createState ? createImpl(createState) : createImpl);
89
- export { THEME_STORAGE_KEY as a, STUDIO_PREPAINT_SCRIPT as i, COMPANION_STORAGE_KEY as n, VAULT_TREE_STORAGE_KEY as o, RAIL_STORAGE_KEY as r, create as t };