@uniqbit/mate-core 1.0.0-canary.0 → 1.0.0-canary.3

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 (325) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/marketplace.json +14 -0
  2. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +8 -0
  3. package/claude-capability-plugins/companion-mentions/hooks/companion.ts +457 -0
  4. package/claude-capability-plugins/companion-mentions/hooks/hooks.json +1 -0
  5. package/claude-capability-plugins/companion-mentions/hooks/register.ts +403 -0
  6. package/claude-plugin/hooks/hooks.json +10 -1
  7. package/claude-plugin/hooks/tokensave-route.mjs +52 -0
  8. package/opencode-plugin/src/server.ts +4 -0
  9. package/opencode-plugin/src/tui.tsx +3 -1
  10. package/opencode-plugin/tui.tsx +4 -1
  11. package/package.json +45 -16
  12. package/src/brand/terminal.ts +5 -0
  13. package/src/cli/commands/artifact/apply-context.ts +275 -0
  14. package/src/cli/commands/artifact/artifact.ts +4 -0
  15. package/src/cli/commands/artifact/delivery/archive.ts +13 -5
  16. package/src/cli/commands/artifact/delivery/environment.ts +36 -13
  17. package/src/cli/commands/artifact/delivery/link.ts +35 -15
  18. package/src/cli/commands/artifact/delivery/output.ts +31 -0
  19. package/src/cli/commands/artifact/finish/command.ts +50 -5
  20. package/src/cli/commands/artifact/finish/engine.ts +44 -11
  21. package/src/cli/commands/artifact/finish/git.ts +132 -19
  22. package/src/cli/commands/artifact/finish/openspec.ts +6 -1
  23. package/src/cli/commands/artifact/finish/worktree-cleanup.ts +92 -0
  24. package/src/cli/commands/cap/index-cmd.ts +64 -15
  25. package/src/cli/commands/cap/tokensave.ts +7 -5
  26. package/src/cli/commands/companion/link.ts +14 -1
  27. package/src/cli/commands/companion/open.ts +16 -11
  28. package/src/cli/commands/companion/sync.ts +10 -0
  29. package/src/cli/commands/companion/tui.ts +17 -7
  30. package/src/cli/commands/companion/update.ts +74 -12
  31. package/src/cli/commands/doctor.ts +20 -5
  32. package/src/cli/commands/factory/factory.ts +301 -0
  33. package/src/cli/commands/install.ts +133 -9
  34. package/src/cli/commands/launch/shared.ts +16 -11
  35. package/src/cli/commands/report/index.ts +20 -1
  36. package/src/cli/commands/session/context.ts +102 -0
  37. package/src/cli/commands/setup.ts +44 -10
  38. package/src/cli/commands/studio/factory-credential.ts +49 -0
  39. package/src/cli/commands/studio/index.ts +29 -2
  40. package/src/cli/commands/studio/payload.ts +249 -15
  41. package/src/cli/commands/studio/routes.ts +41 -8
  42. package/src/cli/commands/studio/selection.ts +142 -16
  43. package/src/cli/commands/studio/server.ts +403 -364
  44. package/src/cli/commands/studio/services.ts +60 -0
  45. package/src/cli/commands/studio/studio-app.ts +67 -0
  46. package/src/cli/commands/studio/terminal-assets.ts +21 -33
  47. package/src/cli/commands/studio/terminal.ts +85 -15
  48. package/src/cli/commands/studio/views/model.ts +18 -0
  49. package/src/cli/commands/studio/views/vault/markdown-tree.ts +267 -0
  50. package/src/cli/commands/studio/views/vault/view.ts +185 -0
  51. package/src/cli/commands/studio/workset-session.ts +131 -0
  52. package/src/cli/commands/unwrap.ts +8 -0
  53. package/src/cli/commands/update.ts +27 -1
  54. package/src/cli/commands/working/cleanup.ts +10 -1
  55. package/src/cli/commands/working/link.ts +76 -0
  56. package/src/cli/commands/working/working.ts +10 -0
  57. package/src/cli/commands/working/worktree.ts +356 -0
  58. package/src/cli/companion-link-wizard.tsx +2 -0
  59. package/src/cli/companion-selector.tsx +2 -0
  60. package/src/cli/confirm.ts +2 -0
  61. package/src/cli/install-plan.tsx +127 -160
  62. package/src/cli/launch-selector.tsx +2 -0
  63. package/src/cli/main.ts +18 -0
  64. package/src/cli/parse-flags.ts +9 -1
  65. package/src/cli/repo-list-table.tsx +2 -0
  66. package/src/cli/setup-selector.tsx +79 -20
  67. package/src/cli/usage.ts +11 -1
  68. package/src/create-mate.ts +5 -4
  69. package/src/hooks/tokensave-route.ts +26 -0
  70. package/src/lib/apply-context/fingerprint.ts +174 -0
  71. package/src/lib/apply-context/protocol.ts +193 -0
  72. package/src/lib/components/confirm-prompt.tsx +21 -9
  73. package/src/lib/components/select-menu.tsx +10 -3
  74. package/src/lib/components/spinner.tsx +4 -2
  75. package/src/lib/components/startup-progress.tsx +227 -41
  76. package/src/lib/components/text-input-display.tsx +2 -0
  77. package/src/lib/components/wizard-footer.tsx +2 -0
  78. package/src/lib/components/wizard-header.tsx +13 -11
  79. package/src/lib/delivery/archive-change.ts +14 -2
  80. package/src/lib/delivery/branches.ts +29 -5
  81. package/src/lib/delivery/environment.ts +7 -1
  82. package/src/lib/delivery/forge.ts +2 -2
  83. package/src/lib/delivery/merge-git.ts +261 -0
  84. package/src/lib/delivery/overlap.ts +11 -4
  85. package/src/lib/delivery/record-delivery.ts +97 -10
  86. package/src/lib/delivery/record.ts +67 -7
  87. package/src/lib/delivery/refresh.ts +104 -10
  88. package/src/lib/delivery/repository-access.ts +46 -2
  89. package/src/lib/delivery/resolve-branch.ts +162 -0
  90. package/src/lib/delivery/token.ts +7 -41
  91. package/src/lib/factory/attach-client.ts +113 -0
  92. package/src/lib/factory/attach.ts +178 -0
  93. package/src/lib/factory/broker.ts +190 -0
  94. package/src/lib/factory/bun-commands.ts +39 -0
  95. package/src/lib/factory/client.ts +92 -0
  96. package/src/lib/factory/command.ts +61 -0
  97. package/src/lib/factory/credential-store.ts +153 -0
  98. package/src/lib/factory/frames.ts +77 -0
  99. package/src/lib/factory/ids.ts +58 -0
  100. package/src/lib/factory/keyed-serial.ts +27 -0
  101. package/src/lib/factory/outcomes/actions.ts +114 -0
  102. package/src/lib/factory/outcomes/index.ts +381 -0
  103. package/src/lib/factory/outcomes/lifecycle.ts +205 -0
  104. package/src/lib/factory/outcomes/runs.ts +81 -0
  105. package/src/lib/factory/outcomes/sessions.ts +38 -0
  106. package/src/lib/factory/prepare.ts +49 -0
  107. package/src/lib/factory/pty.ts +103 -0
  108. package/src/lib/factory/runner/companion-context.ts +178 -0
  109. package/src/lib/factory/runner/control.ts +92 -0
  110. package/src/lib/factory/runner/harness-agent.ts +250 -0
  111. package/src/lib/factory/runner/live.ts +159 -0
  112. package/src/lib/factory/runner/questions.ts +22 -0
  113. package/src/lib/factory/runner/rank.ts +26 -0
  114. package/src/lib/factory/runner/run-policy.ts +12 -0
  115. package/src/lib/factory/runner/run.ts +199 -0
  116. package/src/lib/factory/runner/scheduler.ts +416 -0
  117. package/src/lib/factory/runner/state.ts +233 -0
  118. package/src/lib/factory/runner/workflow.ts +542 -0
  119. package/src/lib/factory/runtime.ts +972 -0
  120. package/src/lib/factory/sandbox.ts +292 -0
  121. package/src/lib/factory/worktree-branch.ts +17 -0
  122. package/src/lib/install.ts +66 -14
  123. package/src/lib/live-progress.ts +36 -0
  124. package/src/lib/member-choices.ts +67 -0
  125. package/src/lib/orchestrator/adapters/base.ts +55 -22
  126. package/src/lib/orchestrator/adapters/claude.ts +6 -1
  127. package/src/lib/orchestrator/config-store.ts +3 -2
  128. package/src/lib/orchestrator/editor.ts +29 -23
  129. package/src/lib/orchestrator/projection-entries.ts +56 -21
  130. package/src/lib/orchestrator/projection-opencode-copies.ts +32 -15
  131. package/src/lib/orchestrator/projection-openspec-store.ts +54 -9
  132. package/src/lib/orchestrator/projection-types.ts +33 -1
  133. package/src/lib/orchestrator/session-context-link.ts +67 -0
  134. package/src/lib/orchestrator/setup-compatibilities.ts +55 -12
  135. package/src/lib/orchestrator/types.ts +5 -0
  136. package/src/lib/orchestrator/working-repo-projection.ts +50 -7
  137. package/src/lib/orchestrator/workspace-document.ts +105 -0
  138. package/src/lib/package-paths.ts +29 -0
  139. package/src/lib/runtime-directory-refresh.ts +17 -1
  140. package/src/lib/workset/record.ts +513 -0
  141. package/src/lib/workset/repositories.ts +55 -0
  142. package/src/lib/workset/stage.ts +148 -0
  143. package/src/lib/workset/stages.ts +113 -0
  144. package/src/lib/workset/worktree-index.ts +116 -0
  145. package/src/lib/workset/worktree.ts +830 -0
  146. package/src/opencode/companion-hooks.ts +45 -2
  147. package/src/opencode/enter-worktree.ts +72 -0
  148. package/src/opencode/tui.tsx +21 -26
  149. package/src/plugins.ts +1 -0
  150. package/src/runtime/claude-delivery-plan.ts +22 -5
  151. package/src/runtime/companion-git.ts +52 -10
  152. package/src/runtime/companion-guidance.ts +7 -7
  153. package/src/runtime/companion-lock.ts +30 -7
  154. package/src/runtime/env.ts +48 -3
  155. package/src/runtime/git-layout.ts +219 -0
  156. package/src/runtime/index.ts +24 -0
  157. package/src/runtime/physical-path.ts +111 -0
  158. package/src/runtime/policy.ts +36 -2
  159. package/src/runtime/runtime-directory.ts +5 -0
  160. package/src/runtime/secret-guard.ts +19 -5
  161. package/src/runtime/secret-patterns.ts +267 -34
  162. package/src/runtime/session-context.ts +98 -0
  163. package/src/runtime/tokensave-route.ts +152 -0
  164. package/src/runtime/wrap-state.ts +24 -16
  165. package/src/studio.ts +124 -0
  166. package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +10 -8
  167. package/src/templates/capabilities/openspec-cap/mate-v1/schema.yaml +16 -98
  168. package/src/templates/capabilities/openspec-cap/openspec-conventions.yaml +10 -2
  169. package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +76 -18
  170. package/src/templates/mate-skills/agents/mate-apply-change/references/mate-compact-apply.md +47 -0
  171. package/src/templates/mate-skills/agents/mate-apply-change/references/openspec-apply-change.md +2 -0
  172. package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +32 -5
  173. package/src/templates/mate-skills/agents/mate-backfill-spec/SKILL.md +8 -1
  174. package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +16 -1
  175. package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +22 -6
  176. package/src/templates/mate-skills/agents/mate-explore-change/references/openspec-explore.md +2 -0
  177. package/src/templates/mate-skills/agents/mate-grill-me/SKILL.md +8 -1
  178. package/src/templates/mate-skills/agents/mate-grill-with-docs/SKILL.md +2 -2
  179. package/src/templates/mate-skills/agents/mate-interview-me/SKILL.md +7 -0
  180. package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +55 -50
  181. package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +47 -0
  182. package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-propose.md +2 -0
  183. package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-update-change.md +2 -0
  184. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +29 -10
  185. package/src/templates/mate-skills/agents/mate-publish-artifact/references/openspec.md +4 -2
  186. package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +21 -0
  187. package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +13 -0
  188. package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +76 -18
  189. package/src/templates/mate-skills/claude/mate-apply-change/references/mate-compact-apply.md +47 -0
  190. package/src/templates/mate-skills/claude/mate-apply-change/references/openspec-apply-change.md +2 -0
  191. package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +32 -5
  192. package/src/templates/mate-skills/claude/mate-backfill-spec/SKILL.md +8 -1
  193. package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +16 -1
  194. package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +22 -6
  195. package/src/templates/mate-skills/claude/mate-explore-change/references/openspec-explore.md +2 -0
  196. package/src/templates/mate-skills/claude/mate-grill-me/SKILL.md +8 -1
  197. package/src/templates/mate-skills/claude/mate-grill-with-docs/SKILL.md +2 -2
  198. package/src/templates/mate-skills/claude/mate-interview-me/SKILL.md +7 -0
  199. package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +55 -50
  200. package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +47 -0
  201. package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-propose.md +2 -0
  202. package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-update-change.md +2 -0
  203. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +29 -10
  204. package/src/templates/mate-skills/claude/mate-publish-artifact/references/openspec.md +4 -2
  205. package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +21 -0
  206. package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +13 -0
  207. package/src/templates/mate-skills/openspec-references.ts +2 -0
  208. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +364 -224
  209. package/src/tools/setup/capabilities/companion-mentions.ts +27 -0
  210. package/src/tools/setup/capabilities/context-mode.ts +34 -5
  211. package/src/tools/setup/capabilities/graphify-secrets.ts +2 -14
  212. package/src/tools/setup/capabilities/graphify.ts +34 -7
  213. package/src/tools/setup/capabilities/openspec.ts +12 -2
  214. package/src/tools/setup/capabilities/react-doctor.ts +8 -1
  215. package/src/tools/setup/capabilities/rtk.ts +4 -0
  216. package/src/tools/setup/capabilities/tokensave.ts +77 -68
  217. package/src/tools/setup/engine.ts +3 -2
  218. package/src/tools/setup/install-contract.ts +8 -0
  219. package/src/tools/setup/mate-skill-copies.ts +51 -0
  220. package/src/tools/setup/package-managers/uv.ts +73 -11
  221. package/src/tools/setup/plugin.ts +5 -0
  222. package/src/tools/setup/providers/claude-plugin-hooks.ts +12 -0
  223. package/src/tools/setup/providers/claude-worktree-plugins.ts +122 -0
  224. package/src/tools/setup/providers/claude.ts +11 -5
  225. package/src/tools/setup/utils.ts +4 -0
  226. package/src/tools/setup/working-repo-cleanup.ts +29 -1
  227. package/src/tools/setup/working-repo-local-state.ts +252 -75
  228. package/src/tools/setup.ts +57 -16
  229. package/studio-dist/client/assets/companion-view-Csva26Ir.js +1 -0
  230. package/studio-dist/client/assets/delivery-path-DJMpRmiY.js +1 -0
  231. package/studio-dist/client/assets/dist-Dm7MtyHc.js +5 -0
  232. package/studio-dist/client/assets/factory-B7l9ZQyx.js +4 -0
  233. package/studio-dist/client/assets/index-n6uo_92S.js +40 -0
  234. package/studio-dist/client/assets/preload-helper-BLdHbfdN.js +1 -0
  235. package/studio-dist/client/assets/prepaint-CD5OpmTM.js +24 -0
  236. package/studio-dist/client/assets/queries-CN3JwMBX.js +1 -0
  237. package/studio-dist/client/assets/react-CabXf2Ds.js +1 -0
  238. package/studio-dist/client/assets/report-time-Dc-KOqQu.js +1 -0
  239. package/studio-dist/client/assets/reports-C01RsnMA.js +1 -0
  240. package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +1 -0
  241. package/studio-dist/client/assets/routes-4pbC-2Hj.js +1 -0
  242. package/studio-dist/client/assets/skills-CihQganl.js +1 -0
  243. package/studio-dist/client/assets/spec-areas-C2L48N4C.js +1 -0
  244. package/studio-dist/client/assets/specs-D24_35_K.js +1 -0
  245. package/studio-dist/client/assets/studio-DKxfi691.css +1 -0
  246. package/studio-dist/client/assets/studio-queries-rvbJupCy.js +3 -0
  247. package/studio-dist/client/assets/terminal-eU5fzQzv.css +1 -0
  248. package/studio-dist/client/assets/vault-Bd4CQiTK.js +1 -0
  249. package/studio-dist/client/assets/warnings-V_Ys51wJ.js +1 -0
  250. package/studio-dist/client/assets/wasm-inline-C2en61B5.js +1 -0
  251. package/studio-dist/client/assets/workflow-BJejeVwQ.js +1 -0
  252. package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-BQKuMdJW.js +3881 -0
  253. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +85 -0
  254. package/studio-dist/server/assets/actions-Bvgj9eb8.js +54 -0
  255. package/studio-dist/server/assets/actions-D8erOphH.js +44 -0
  256. package/studio-dist/server/assets/companion-view-aBady57v.js +33 -0
  257. package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +459 -0
  258. package/studio-dist/server/assets/createServerRpc-tK2lE9R2.js +11 -0
  259. package/studio-dist/server/assets/delivery-path-BkKNjgkf.js +778 -0
  260. package/studio-dist/server/assets/dist-DpJWKyCm.js +5582 -0
  261. package/studio-dist/server/assets/empty-plugin-adapters-Cipd4ZH4.js +4 -0
  262. package/studio-dist/server/assets/factory-D6xnjedJ.js +2385 -0
  263. package/studio-dist/server/assets/factory-DT3UzHlh.js +68 -0
  264. package/studio-dist/server/assets/model-PyPALjii.js +18 -0
  265. package/studio-dist/server/assets/prepaint-BMke0fo1.js +41 -0
  266. package/studio-dist/server/assets/queries-Ag2iL8q2.js +107 -0
  267. package/studio-dist/server/assets/react-COs0LHn-.js +51 -0
  268. package/studio-dist/server/assets/report-time-DAfzln-N.js +8 -0
  269. package/studio-dist/server/assets/reports-BnUNJVtx.js +126 -0
  270. package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +34 -0
  271. package/studio-dist/server/assets/router-BH--drIx.js +4298 -0
  272. package/studio-dist/server/assets/routes-khSDK1bV.js +361 -0
  273. package/studio-dist/server/assets/search-JAKurDNh.js +36 -0
  274. package/studio-dist/server/assets/shell-CboT2f66.js +51 -0
  275. package/studio-dist/server/assets/skills-MWYnWoKs.js +106 -0
  276. package/studio-dist/server/assets/spec-areas-DcnO6vW-.js +16 -0
  277. package/studio-dist/server/assets/specs-DE3w8hZP.js +155 -0
  278. package/studio-dist/server/assets/start-BW5ovN0k.js +33 -0
  279. package/studio-dist/server/assets/studio-BeltxxKt.js +216 -0
  280. package/studio-dist/server/assets/studio-queries-CLnP9kGu.js +3365 -0
  281. package/studio-dist/server/assets/utils-C9CX1kcy.js +221 -0
  282. package/studio-dist/server/assets/vault-BGulVoNh.js +70 -0
  283. package/studio-dist/server/assets/vault-CuyyhLyB.js +832 -0
  284. package/studio-dist/server/assets/views-Bd7cRr27.js +82 -0
  285. package/studio-dist/server/assets/warnings-BH05rOuG.js +15 -0
  286. package/studio-dist/server/assets/wasm-inline-CNeBKGwC.js +3 -0
  287. package/studio-dist/server/assets/workflow-BSuIKWqH.js +42 -0
  288. package/studio-dist/server/server.js +16220 -0
  289. package/src/cli/commands/studio/client-asset.ts +0 -16
  290. package/src/cli/commands/studio/views/client.ts +0 -44
  291. package/src/cli/commands/studio/views/companion-picker.tsx +0 -95
  292. package/src/cli/commands/studio/views/companion-selector.tsx +0 -94
  293. package/src/cli/commands/studio/views/dashboard/changes.tsx +0 -102
  294. package/src/cli/commands/studio/views/dashboard/index.tsx +0 -19
  295. package/src/cli/commands/studio/views/document.tsx +0 -910
  296. package/src/cli/commands/studio/views/error.tsx +0 -20
  297. package/src/cli/commands/studio/views/markdown.tsx +0 -250
  298. package/src/cli/commands/studio/views/palette.ts +0 -134
  299. package/src/cli/commands/studio/views/reports/index.tsx +0 -44
  300. package/src/cli/commands/studio/views/selection-fields.tsx +0 -14
  301. package/src/cli/commands/studio/views/skills/index.tsx +0 -68
  302. package/src/cli/commands/studio/views/specs/index.tsx +0 -149
  303. package/src/cli/commands/studio/views/studio-client/actions.ts +0 -51
  304. package/src/cli/commands/studio/views/studio-client/companion.ts +0 -13
  305. package/src/cli/commands/studio/views/studio-client/index.ts +0 -32
  306. package/src/cli/commands/studio/views/studio-client/keys.ts +0 -3
  307. package/src/cli/commands/studio/views/studio-client/main.ts +0 -3
  308. package/src/cli/commands/studio/views/studio-client/page.ts +0 -146
  309. package/src/cli/commands/studio/views/studio-client/panels.ts +0 -57
  310. package/src/cli/commands/studio/views/studio-client/reports.ts +0 -122
  311. package/src/cli/commands/studio/views/studio-client/theme.ts +0 -63
  312. package/src/cli/commands/studio/views/studio-client/vault-editor.ts +0 -166
  313. package/src/cli/commands/studio/views/studio-client/vault-pane.ts +0 -202
  314. package/src/cli/commands/studio/views/studio-client/vault-tree.ts +0 -258
  315. package/src/cli/commands/studio/views/studio-client.generated.ts +0 -2
  316. package/src/cli/commands/studio/views/styles.ts +0 -530
  317. package/src/cli/commands/studio/views/terminal.tsx +0 -484
  318. package/src/cli/commands/studio/views/vault/state.ts +0 -41
  319. package/src/cli/commands/studio/views/warnings.tsx +0 -21
  320. package/src/cli/commands/studio/views/workflow/delivery-path.tsx +0 -370
  321. package/src/cli/commands/studio/views/workflow/graph.ts +0 -220
  322. package/src/cli/commands/studio/views/workflow/index.tsx +0 -20
  323. package/src/cli/commands/studio/views/workflow/steps.ts +0 -278
  324. package/src/lib/components/theme.ts +0 -2
  325. package/src/tools/setup/git-utils.ts +0 -30
@@ -1,20 +0,0 @@
1
- /** @jsxImportSource hono/jsx */
2
-
3
- interface CompanionErrorProps {
4
- companionPath: string;
5
- reason: string;
6
- }
7
-
8
- /**
9
- * A companion that could not be read costs its content, never the page: the
10
- * selector stays rendered around this so another companion can be reached.
11
- */
12
- export function CompanionError({ companionPath, reason }: CompanionErrorProps) {
13
- return (
14
- <section className="panel error">
15
- <h3>Could not read this companion</h3>
16
- <p className="mono">{companionPath}</p>
17
- <p>{reason}</p>
18
- </section>
19
- );
20
- }
@@ -1,250 +0,0 @@
1
- /** @jsxImportSource hono/jsx */
2
-
3
- import { type Token, type Tokens, Lexer } from "marked";
4
-
5
- import { highlightNodes } from "../../report/highlight";
6
-
7
- type Child = unknown;
8
-
9
- export interface MarkdownViewProps {
10
- source: string;
11
- /** The open file's companion-relative path; relative links resolve against its folder. */
12
- path: string;
13
- /** The vault address of a companion-relative markdown path. */
14
- hrefFor: (path: string) => string;
15
- }
16
-
17
- const MARKDOWN_TARGET = /\.(md|markdown)$/i;
18
- const SCHEME = /^[a-z][a-z0-9+.-]*:/i;
19
-
20
- /**
21
- * A relative link as a companion-relative markdown path, or `null` when it is anything
22
- * else. Textual only: nothing is looked up on disk, so a missing note is the vault's to refuse.
23
- */
24
- export function resolveNoteLink(target: string, openPath: string): string | null {
25
- if (!target || SCHEME.test(target) || target.startsWith("//") || target.startsWith("#")) {
26
- return null;
27
- }
28
- let pathname = target.split(/[?#]/, 1)[0] ?? "";
29
- try {
30
- pathname = decodeURIComponent(pathname);
31
- } catch {
32
- return null;
33
- }
34
- if (pathname.includes("\\") || !MARKDOWN_TARGET.test(pathname)) return null;
35
- const folder = pathname.startsWith("/") ? [] : openPath.split("/").filter(Boolean).slice(0, -1);
36
- for (const part of pathname.split("/")) {
37
- if (part === "" || part === ".") continue;
38
- if (part === "..") {
39
- if (folder.length === 0) return null;
40
- folder.pop();
41
- } else {
42
- folder.push(part);
43
- }
44
- }
45
- return folder.length > 0 ? folder.join("/") : null;
46
- }
47
-
48
- function isWebAddress(target: string): boolean {
49
- return /^https?:\/\//i.test(target);
50
- }
51
-
52
- function Highlighted({ code, language }: { code: string; language: string | undefined }) {
53
- const render = (node: ReturnType<typeof highlightNodes>[number], key: number): Child =>
54
- node.type === "text" ? (
55
- node.value
56
- ) : (
57
- <span key={key} className={node.classNames.join(" ")}>
58
- {node.children.map(render)}
59
- </span>
60
- );
61
- return <>{highlightNodes(code, language).map(render)}</>;
62
- }
63
-
64
- /** Plain text of inline tokens, for an image's alternative text. */
65
- function plainText(tokens: Token[] | undefined, fallback: string): string {
66
- if (!tokens) return fallback;
67
- return tokens
68
- .map((token) => ("tokens" in token && token.tokens ? plainText(token.tokens, "") : token.raw))
69
- .join("");
70
- }
71
-
72
- class Mapper {
73
- constructor(private readonly props: MarkdownViewProps) {}
74
-
75
- blocks(tokens: Token[] | undefined): Child[] {
76
- return (tokens ?? []).map((token, index) => this.block(token, index));
77
- }
78
-
79
- inline(tokens: Token[] | undefined, fallback = ""): Child[] {
80
- if (!tokens) return [fallback];
81
- return tokens.map((token, index) => this.span(token, index));
82
- }
83
-
84
- private block(token: Token, key: number): Child {
85
- switch (token.type) {
86
- case "space":
87
- case "def":
88
- return null;
89
- case "heading": {
90
- const heading = token as Tokens.Heading;
91
- const Tag = `h${Math.min(Math.max(heading.depth, 1), 6)}` as "h1";
92
- return <Tag key={key}>{this.inline(heading.tokens, heading.text)}</Tag>;
93
- }
94
- case "paragraph": {
95
- const paragraph = token as Tokens.Paragraph;
96
- return <p key={key}>{this.inline(paragraph.tokens, paragraph.text)}</p>;
97
- }
98
- case "text": {
99
- const text = token as Tokens.Text;
100
- return <p key={key}>{this.inline(text.tokens, text.text)}</p>;
101
- }
102
- case "code": {
103
- const code = token as Tokens.Code;
104
- const language = code.lang?.trim().split(/\s+/, 1)[0] || undefined;
105
- return (
106
- <pre key={key} className="md-fence">
107
- <code>
108
- <Highlighted code={code.text} language={language} />
109
- </code>
110
- </pre>
111
- );
112
- }
113
- case "blockquote":
114
- return (
115
- <blockquote key={key}>{this.blocks((token as Tokens.Blockquote).tokens)}</blockquote>
116
- );
117
- case "hr":
118
- return <hr key={key} />;
119
- case "list":
120
- return this.list(token as Tokens.List, key);
121
- case "table":
122
- return this.table(token as Tokens.Table, key);
123
- case "html":
124
- // Raw markup is shown as the text it is, never inserted.
125
- return (
126
- <p key={key} className="md-raw">
127
- {(token as Tokens.HTML).raw.trim()}
128
- </p>
129
- );
130
- default:
131
- return <p key={key}>{token.raw}</p>;
132
- }
133
- }
134
-
135
- private list(list: Tokens.List, key: number): Child {
136
- const Tag = list.ordered ? "ol" : "ul";
137
- const start =
138
- list.ordered && typeof list.start === "number" && list.start !== 1 ? list.start : undefined;
139
- return (
140
- <Tag key={key} start={start}>
141
- {list.items.map((item, index) => {
142
- const body = item.tokens.filter((token) => token.type !== "checkbox");
143
- return (
144
- <li key={index} className={item.task ? "md-task" : undefined}>
145
- {item.task ? (
146
- <input type="checkbox" checked={!!item.checked} disabled aria-label="Task" />
147
- ) : null}
148
- {item.loose ? this.blocks(body) : this.tight(body)}
149
- </li>
150
- );
151
- })}
152
- </Tag>
153
- );
154
- }
155
-
156
- /** A tight item's text sits in the item, not in a paragraph of its own. */
157
- private tight(tokens: Token[]): Child[] {
158
- return tokens.map((token, index) =>
159
- token.type === "text"
160
- ? this.inline((token as Tokens.Text).tokens, (token as Tokens.Text).text)
161
- : this.block(token, index),
162
- );
163
- }
164
-
165
- private table(table: Tokens.Table, key: number): Child {
166
- const align = (cell: Tokens.TableCell) => (cell.align ? { textAlign: cell.align } : undefined);
167
- return (
168
- <div key={key} className="md-table">
169
- <table>
170
- <thead>
171
- <tr>
172
- {table.header.map((cell, index) => (
173
- <th key={index} style={align(cell)}>
174
- {this.inline(cell.tokens, cell.text)}
175
- </th>
176
- ))}
177
- </tr>
178
- </thead>
179
- <tbody>
180
- {table.rows.map((row, rowIndex) => (
181
- <tr key={rowIndex}>
182
- {row.map((cell, index) => (
183
- <td key={index} style={align(cell)}>
184
- {this.inline(cell.tokens, cell.text)}
185
- </td>
186
- ))}
187
- </tr>
188
- ))}
189
- </tbody>
190
- </table>
191
- </div>
192
- );
193
- }
194
-
195
- private span(token: Token, key: number): Child {
196
- switch (token.type) {
197
- case "text": {
198
- const text = token as Tokens.Text;
199
- return text.tokens ? <span key={key}>{this.inline(text.tokens)}</span> : text.text;
200
- }
201
- case "escape":
202
- return (token as Tokens.Escape).text;
203
- case "strong":
204
- return <strong key={key}>{this.inline((token as Tokens.Strong).tokens)}</strong>;
205
- case "em":
206
- return <em key={key}>{this.inline((token as Tokens.Em).tokens)}</em>;
207
- case "del":
208
- return <del key={key}>{this.inline((token as Tokens.Del).tokens)}</del>;
209
- case "codespan":
210
- return <code key={key}>{(token as Tokens.Codespan).text}</code>;
211
- case "br":
212
- return <br key={key} />;
213
- case "link":
214
- return this.link(token as Tokens.Link, key);
215
- case "image": {
216
- // Not requested or shown: only what the author said the image is.
217
- const image = token as Tokens.Image;
218
- return image.text || plainText(image.tokens, "");
219
- }
220
- case "html":
221
- return (token as Tokens.HTML).raw;
222
- default:
223
- return token.raw;
224
- }
225
- }
226
-
227
- private link(link: Tokens.Link, key: number): Child {
228
- const label = this.inline(link.tokens, link.text);
229
- if (isWebAddress(link.href)) {
230
- return (
231
- <a key={key} href={link.href} target="_blank" rel="noopener noreferrer">
232
- {label}
233
- </a>
234
- );
235
- }
236
- const note = resolveNoteLink(link.href, this.props.path);
237
- if (note === null) return <span key={key}>{label}</span>;
238
- return (
239
- <a key={key} href={this.props.hrefFor(note)} data-vault-entry={note}>
240
- {label}
241
- </a>
242
- );
243
- }
244
- }
245
-
246
- /** Rendered from lexer tokens to elements, so no part of the file is ever inserted as markup. */
247
- export function MarkdownView(props: MarkdownViewProps) {
248
- const tokens = new Lexer({ gfm: true }).lex(props.source);
249
- return <div className="markdown-body">{new Mapper(props).blocks(tokens)}</div>;
250
- }
@@ -1,134 +0,0 @@
1
- import { DARK_PALETTE, LIGHT_PALETTE, type ReportPalette } from "../../report/palette";
2
-
3
- /**
4
- * Studio's colour tokens, built from the report palette so Studio and its hosted
5
- * reports share the Mate brand colours. Token names stay Studio's own; the values
6
- * come from `ReportPalette`, plus Studio-only label colours for workflow badges.
7
- */
8
-
9
- export interface StudioPalette {
10
- bg: string;
11
- bgRail: string;
12
- panel: string;
13
- /** Nested boxes inside a card: the page colour keeps light accent text at 5:1. */
14
- panelSoft: string;
15
- border: string;
16
- text: string;
17
- muted: string;
18
- accent: string;
19
- done: string;
20
- warn: string;
21
- bad: string;
22
- info: string;
23
- what: string;
24
- why: string;
25
- /** Text drawn on an accent or success fill (toast, nav badge). */
26
- onAccent: string;
27
- promptBg: string;
28
- promptText: string;
29
- /** Only the off-canvas terminal drawer floats over the page. */
30
- drawerShadow: string;
31
- }
32
-
33
- /** Colours read as text or status markers; each must reach 4.5:1 on the page and on cards. */
34
- export const STUDIO_TEXT_TOKENS = [
35
- "text",
36
- "muted",
37
- "accent",
38
- "done",
39
- "warn",
40
- "bad",
41
- "info",
42
- "what",
43
- "why",
44
- ] as const satisfies readonly (keyof StudioPalette)[];
45
-
46
- /** Each of these also gets a `--<name>-soft` tint: this share of the colour over the card surface. */
47
- const TINTED_TOKENS = [
48
- "accent",
49
- "done",
50
- "warn",
51
- "bad",
52
- "info",
53
- "what",
54
- "why",
55
- ] as const satisfies readonly (keyof StudioPalette)[];
56
-
57
- export const TINT_PERCENT = 12;
58
-
59
- function fromReport(
60
- report: ReportPalette,
61
- studio: Pick<StudioPalette, "what" | "why" | "onAccent" | "drawerShadow">,
62
- ): StudioPalette {
63
- return {
64
- bg: report.bg,
65
- bgRail: report.surface,
66
- panel: report.surface,
67
- panelSoft: report.bg,
68
- border: report.rule,
69
- text: report.ink,
70
- muted: report.muted,
71
- accent: report.accent,
72
- done: report.ok,
73
- warn: report.warn,
74
- bad: report.error,
75
- info: report.info,
76
- promptBg: report.bg,
77
- promptText: report.ink,
78
- ...studio,
79
- };
80
- }
81
-
82
- export const STUDIO_LIGHT_PALETTE = fromReport(LIGHT_PALETTE, {
83
- what: "#176B75",
84
- why: "#6346A5",
85
- onAccent: "#FFFFFF",
86
- drawerShadow: "0 12px 32px rgb(31 36 33 / 12%)",
87
- });
88
-
89
- export const STUDIO_DARK_PALETTE = fromReport(DARK_PALETTE, {
90
- what: "#74D3D8",
91
- why: "#CAA8FF",
92
- onAccent: DARK_PALETTE.bg,
93
- drawerShadow: "0 14px 36px rgb(0 0 0 / 40%)",
94
- });
95
-
96
- const kebab = (name: string): string => name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
97
-
98
- function declarations(palette: StudioPalette, indent: string): string {
99
- const lines = Object.entries(palette).map(([name, value]) => `--${kebab(name)}: ${value};`);
100
- lines.push("--border-soft: color-mix(in srgb, var(--border) 55%, var(--panel));");
101
- for (const token of TINTED_TOKENS) {
102
- lines.push(
103
- `--${token}-soft: color-mix(in srgb, var(--${token}) ${TINT_PERCENT}%, var(--panel));`,
104
- );
105
- }
106
- return lines.map((line) => `${indent}${line}`).join("\n");
107
- }
108
-
109
- /**
110
- * Dark is the default; light applies through the system preference or the in-page
111
- * toggle, and an explicit `data-theme` wins over the media query in both directions.
112
- */
113
- export function studioPaletteCss(): string {
114
- return `:root {
115
- color-scheme: dark;
116
- ${declarations(STUDIO_DARK_PALETTE, " ")}
117
- }
118
- @media (prefers-color-scheme: light) {
119
- :root:not([data-theme="dark"]) {
120
- color-scheme: light;
121
- ${declarations(STUDIO_LIGHT_PALETTE, " ")}
122
- }
123
- }
124
- @media (prefers-color-scheme: dark) {
125
- :root:not([data-theme="light"]) { color-scheme: dark; }
126
- }
127
- :root[data-theme="light"] {
128
- color-scheme: light;
129
- ${declarations(STUDIO_LIGHT_PALETTE, " ")}
130
- }
131
- :root[data-theme="dark"] {
132
- color-scheme: dark;
133
- }`;
134
- }
@@ -1,44 +0,0 @@
1
- /** @jsxImportSource hono/jsx */
2
-
3
- /**
4
- * The list, frame and empty note are filled by the page client from
5
- * `GET /api/reports`; titles are written as text, never markup.
6
- */
7
- export function Reports() {
8
- return (
9
- <section className="view-section" data-reports-view aria-label="Hosted reports">
10
- <p className="view-summary">Reports published by agent sessions Studio started.</p>
11
- <div className="reports-layout">
12
- <div className="reports-side">
13
- <ul id="reports-list" className="reports-list" aria-label="Reports" />
14
- <template id="reports-item-template">
15
- <li>
16
- <button type="button" data-report-id="">
17
- <span data-report-title />
18
- <span className="report-time" data-report-time />
19
- </button>
20
- </li>
21
- </template>
22
- <p id="reports-empty" className="empty">
23
- No hosted reports yet.
24
- </p>
25
- </div>
26
- <div className="reports-main">
27
- <div className="reports-bar">
28
- <a id="reports-open" target="_blank" rel="noopener noreferrer" hidden>
29
- Open in new tab
30
- </a>
31
- </div>
32
- <iframe
33
- id="reports-frame"
34
- className="reports-frame"
35
- title="Hosted report"
36
- sandbox="allow-scripts allow-modals"
37
- referrerPolicy="no-referrer"
38
- hidden
39
- />
40
- </div>
41
- </div>
42
- </section>
43
- );
44
- }
@@ -1,14 +0,0 @@
1
- /** @jsxImportSource hono/jsx */
2
-
3
- import { type StudioSelection, toFields } from "../selection";
4
-
5
- /** The hidden fields of a control's GET form: the whole selection it leads to. */
6
- export function SelectionFields({ selection }: { selection: StudioSelection }) {
7
- return (
8
- <>
9
- {toFields(selection).map(({ name, value }) => (
10
- <input key={name} type="hidden" name={name} value={value} />
11
- ))}
12
- </>
13
- );
14
- }
@@ -1,68 +0,0 @@
1
- /** @jsxImportSource hono/jsx */
2
-
3
- import type { StudioSkillInventory } from "../../mate-inventory";
4
-
5
- const PROFILES = [
6
- { id: "claude", label: "Claude", description: "Skills available to Claude agents." },
7
- { id: "opencode", label: "OpenCode", description: "Skills available to OpenCode." },
8
- { id: "agents", label: "Agents", description: "Shared skills available to all agents." },
9
- ] as const;
10
-
11
- interface SkillsProps {
12
- skills?: StudioSkillInventory;
13
- }
14
-
15
- /** Lists the skills from each runtime tree without merging away runtime-specific entries. */
16
- export function Skills({ skills }: SkillsProps) {
17
- const inventory = skills ?? { claude: [], opencode: [], agents: [] };
18
- const total = inventory.claude.length + inventory.opencode.length + inventory.agents.length;
19
-
20
- return (
21
- <section className="view-section" aria-label="Agent skills" data-skills-root>
22
- <div className="view-intro">
23
- <label className="view-choice">
24
- <span>Agent</span>
25
- <select data-skills-select>
26
- {PROFILES.map((profile, index) => (
27
- <option key={profile.id} value={profile.id} selected={index === 0}>
28
- {profile.label} – {inventory[profile.id].length} skills
29
- </option>
30
- ))}
31
- </select>
32
- </label>
33
- <p className="view-summary">
34
- {total} {total === 1 ? "skill" : "skills"} · installed in this Companion Repository
35
- </p>
36
- </div>
37
- <div className="skills-panels">
38
- {PROFILES.map((profile, index) => {
39
- const active = index === 0;
40
- const names = inventory[profile.id];
41
- return (
42
- <div
43
- key={profile.id}
44
- id={`skills-panel-${profile.id}`}
45
- aria-hidden={!active}
46
- data-skill-panel={profile.id}
47
- data-active={active}
48
- >
49
- <p className="skills-panel-description">{profile.description}</p>
50
- {names.length === 0 ? (
51
- <p className="empty">No {profile.label} skills in this companion.</p>
52
- ) : (
53
- <div className="skills-grid">
54
- {names.map((name) => (
55
- <div key={name} className="skill-card">
56
- <code>{name}</code>
57
- <span>/{name}</span>
58
- </div>
59
- ))}
60
- </div>
61
- )}
62
- </div>
63
- );
64
- })}
65
- </div>
66
- </section>
67
- );
68
- }
@@ -1,149 +0,0 @@
1
- /** @jsxImportSource hono/jsx */
2
-
3
- import { SUBJECT_PATTERN, type SpecActionOffer } from "../../actions";
4
- import type { StudioCompanionPayload, StudioSpec } from "../../payload";
5
- import { Warnings } from "../warnings";
6
-
7
- const NO_ACTIONS: SpecActionOffer[] = [];
8
- const UNASSIGNED_AREA = "unassigned";
9
-
10
- /** A spec binds one Area or several, so it appears under each of them. */
11
- export function groupSpecsByArea(specs: StudioSpec[]): [string, StudioSpec[]][] {
12
- const groups = new Map<string, StudioSpec[]>();
13
- for (const spec of specs) {
14
- const areas = spec.areas.length > 0 ? spec.areas : [UNASSIGNED_AREA];
15
- for (const area of areas) {
16
- const existing = groups.get(area);
17
- if (existing) existing.push(spec);
18
- else groups.set(area, [spec]);
19
- }
20
- }
21
- return [...groups.entries()].toSorted((left, right) => left[0].localeCompare(right[0]));
22
- }
23
-
24
- function specStatus(spec: StudioSpec): { label: string; invalid: boolean } {
25
- if (spec.valid === false) return { label: `${spec.issueCount ?? 0} issues`, invalid: true };
26
- if (spec.valid === true) return { label: "valid", invalid: false };
27
- return { label: "unvalidated", invalid: false };
28
- }
29
-
30
- interface SpecsProps {
31
- payload: StudioCompanionPayload;
32
- /** Skill actions offered on each spec row; none by default. */
33
- actions?: SpecActionOffer[];
34
- }
35
-
36
- /** Its own view: an Area map is read on its own, not alongside the changes. */
37
- export function Specs({ payload, actions = NO_ACTIONS }: SpecsProps) {
38
- return (
39
- <>
40
- <SpecsByArea specs={payload.specs} actions={actions} />
41
- <Warnings warnings={payload.warnings} />
42
- </>
43
- );
44
- }
45
-
46
- function SpecActions({ capability, actions }: { capability: string; actions: SpecActionOffer[] }) {
47
- if (!SUBJECT_PATTERN.test(capability)) return null;
48
- return (
49
- <span className="spec-actions">
50
- {actions.map(({ action, runAgents, copyAgents }) => (
51
- <>
52
- {runAgents.length > 0 ? (
53
- <button
54
- type="button"
55
- className="button spec-action"
56
- data-studio-action={action.id}
57
- data-studio-subject={capability}
58
- data-studio-agents={runAgents.join(" ")}
59
- >
60
- {action.label}
61
- </button>
62
- ) : null}
63
- <button
64
- type="button"
65
- className="runway-step-copy spec-copy"
66
- aria-label="Copy prompt"
67
- title="Copy prompt"
68
- data-studio-copy-prompt={action.id}
69
- data-prompt-claude={
70
- copyAgents.includes("claude") ? action.prompts.claude(capability) : undefined
71
- }
72
- data-prompt-opencode={
73
- copyAgents.includes("opencode") ? action.prompts.opencode(capability) : undefined
74
- }
75
- >
76
- <svg
77
- viewBox="0 0 16 16"
78
- width="14"
79
- height="14"
80
- fill="none"
81
- stroke="currentColor"
82
- stroke-width="1.5"
83
- aria-hidden="true"
84
- >
85
- <rect x="5.5" y="5.5" width="8" height="8" rx="1.5" />
86
- <path d="M10.5 3.5v-.5a1.5 1.5 0 0 0-1.5-1.5H3.5A1.5 1.5 0 0 0 2 3v5.5A1.5 1.5 0 0 0 3.5 10H4" />
87
- </svg>
88
- </button>
89
- </>
90
- ))}
91
- </span>
92
- );
93
- }
94
-
95
- function SpecsByArea({ specs, actions }: { specs: StudioSpec[]; actions: SpecActionOffer[] }) {
96
- const groups = groupSpecsByArea(specs);
97
-
98
- return (
99
- <section className="view-section" aria-label="Specs by Area">
100
- <p className="view-summary">
101
- {specs.length} {specs.length === 1 ? "spec" : "specs"} · capabilities grouped by the Areas
102
- they serve
103
- </p>
104
- {groups.length === 0 ? (
105
- <p className="empty">No specs in this companion.</p>
106
- ) : (
107
- <div className="specs-area-grid">
108
- {groups.map(([area, areaSpecs]) => (
109
- <section key={area} className="specs-area-card" aria-label={`Area ${area}`}>
110
- <div className="specs-area-card-head">
111
- <h4 className="specs-area-name">{area}</h4>
112
- <span className="specs-area-count">{`${areaSpecs.length} specs`}</span>
113
- </div>
114
- <div className="specs-card-list">
115
- {areaSpecs.map((spec) => {
116
- const status = specStatus(spec);
117
- return (
118
- <div key={spec.capability} className="spec-card-row">
119
- <div>
120
- <strong>{spec.capability}</strong>
121
- <div className="spec-card-meta">
122
- <span>
123
- {spec.requirementCount === undefined
124
- ? "requirements unknown"
125
- : `${spec.requirementCount} requirements`}
126
- </span>
127
- </div>
128
- </div>
129
- <span className="spec-card-end">
130
- <SpecActions capability={spec.capability} actions={actions} />
131
- <span
132
- className={
133
- status.invalid ? "spec-status spec-status-invalid" : "spec-status"
134
- }
135
- >
136
- {status.label}
137
- </span>
138
- </span>
139
- </div>
140
- );
141
- })}
142
- </div>
143
- </section>
144
- ))}
145
- </div>
146
- )}
147
- </section>
148
- );
149
- }