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

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 (244) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
  2. package/package.json +5 -4
  3. package/src/cli/commands/artifact/delivery/link.ts +1 -1
  4. package/src/cli/commands/artifact/delivery/output.ts +10 -1
  5. package/src/cli/commands/artifact/delivery/resolve.ts +3 -2
  6. package/src/cli/commands/artifact/delivery/submit.ts +9 -4
  7. package/src/cli/commands/artifact/delivery/take.ts +12 -9
  8. package/src/cli/commands/artifact/finish/command.ts +16 -14
  9. package/src/cli/commands/artifact/finish/engine.ts +8 -8
  10. package/src/cli/commands/artifact/project/command.ts +2 -3
  11. package/src/cli/commands/companion/hub.ts +11 -6
  12. package/src/cli/commands/companion/link.ts +173 -46
  13. package/src/cli/commands/doctor.ts +17 -0
  14. package/src/cli/commands/report/contract.ts +0 -17
  15. package/src/cli/commands/studio/access.ts +4 -0
  16. package/src/cli/commands/studio/actions.ts +35 -2
  17. package/src/cli/commands/studio/mcp-manager.ts +162 -0
  18. package/src/cli/commands/studio/routes.ts +12 -0
  19. package/src/cli/commands/studio/selection.ts +44 -11
  20. package/src/cli/commands/studio/server.ts +246 -2
  21. package/src/cli/commands/studio/services.ts +26 -0
  22. package/src/cli/commands/studio/terminal-launch.ts +21 -4
  23. package/src/cli/commands/studio/terminal.ts +3 -14
  24. package/src/cli/commands/studio/work-requests.ts +9 -0
  25. package/src/cli/commands/studio/work.ts +473 -0
  26. package/src/cli/commands/vscode/release-vsix.json +2 -2
  27. package/src/cli/commands/working/cleanup.ts +1 -18
  28. package/src/cli/companion-link-wizard.tsx +158 -91
  29. package/src/cli/usage.ts +1 -1
  30. package/src/create-mate.ts +4 -1
  31. package/src/lib/agent-credential.ts +131 -0
  32. package/src/lib/credential-kinds.ts +7 -0
  33. package/src/lib/delivery/merge-git.ts +16 -0
  34. package/src/lib/delivery/record-delivery.ts +12 -6
  35. package/src/lib/delivery/record.ts +5 -0
  36. package/src/lib/delivery/refresh.ts +34 -6
  37. package/src/lib/delivery/staging/refs.ts +9 -4
  38. package/src/lib/delivery/staging/submit.ts +81 -22
  39. package/src/lib/mcp-manager/resolve.ts +88 -0
  40. package/src/lib/mcp-manager/store.ts +133 -0
  41. package/src/lib/mcp-manager/types.ts +72 -0
  42. package/src/lib/mcp-manager/validate.ts +242 -0
  43. package/src/lib/opencode-server.ts +2 -17
  44. package/src/lib/orchestrator/config-store.ts +30 -7
  45. package/src/lib/orchestrator/engine-floor.ts +16 -4
  46. package/src/lib/orchestrator/engine-guard.ts +7 -1
  47. package/src/lib/orchestrator/repo-local-store.ts +14 -0
  48. package/src/lib/orchestrator/repository-link.ts +80 -52
  49. package/src/lib/orchestrator/root-context.ts +17 -1
  50. package/src/lib/orchestrator/types.ts +4 -0
  51. package/src/lib/studio-chat/agent.ts +139 -0
  52. package/src/lib/studio-chat/companion-context.ts +136 -0
  53. package/src/lib/studio-chat/credential.ts +79 -0
  54. package/src/lib/studio-chat/harness-chat-agent.ts +334 -0
  55. package/src/lib/studio-chat/host-sandbox.ts +578 -0
  56. package/src/lib/studio-chat/prepare-bridges.ts +95 -0
  57. package/src/lib/studio-chat/session.ts +15 -0
  58. package/src/lib/studio-chat/turns.ts +112 -0
  59. package/src/lib/workset/claims.ts +85 -0
  60. package/src/lib/workset/execution.ts +71 -0
  61. package/src/lib/workset/git-transaction.ts +74 -0
  62. package/src/lib/workset/groups.ts +176 -0
  63. package/src/lib/workset/inventory.ts +196 -0
  64. package/src/lib/workset/projection.ts +237 -0
  65. package/src/lib/workset/record.ts +101 -36
  66. package/src/lib/workset/repositories.ts +24 -0
  67. package/src/lib/workset/sharing.ts +951 -0
  68. package/src/lib/workset/stages.ts +50 -14
  69. package/src/lib/workset/transactions.ts +158 -0
  70. package/src/runtime/companion-git-state.ts +1 -0
  71. package/src/runtime/companion-guidance.ts +2 -2
  72. package/src/runtime/forge-remote.ts +6 -0
  73. package/src/runtime/host-process.ts +28 -0
  74. package/src/runtime/secret-guard.ts +18 -1
  75. package/src/runtime/secret-patterns.ts +4 -3
  76. package/src/runtime/submitted-arrivals.ts +28 -2
  77. package/src/runtime/workflow/turn.ts +14 -12
  78. package/src/runtime/write-atomic.ts +2 -2
  79. package/src/studio.ts +61 -0
  80. package/src/templates/capabilities/openspec-cap/mate-full/schema.yaml +1 -1
  81. package/src/templates/capabilities/openspec-cap/mate-full/templates/proposal.md +1 -1
  82. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +3 -2
  83. package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +5 -3
  84. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +3 -2
  85. package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +5 -3
  86. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +12 -12
  87. package/src/tools/setup/capabilities/mcp-manager.ts +73 -0
  88. package/src/tools/setup/context-services.ts +35 -6
  89. package/src/tools/setup/dynamic-plugins/audiences.ts +3 -2
  90. package/src/tools/setup/dynamic-plugins/declarations.ts +0 -26
  91. package/src/tools/setup/engine.ts +55 -3
  92. package/src/tools/setup/plugin.ts +14 -0
  93. package/src/tools/setup/plugins/gitignore.ts +1 -0
  94. package/src/tools/setup/providers/claude-format.ts +40 -7
  95. package/src/tools/setup/providers/claude.ts +38 -3
  96. package/src/tools/setup/providers/opencode-format.ts +13 -3
  97. package/src/tools/setup/providers/opencode.ts +7 -18
  98. package/src/tools/setup/providers/relative-path-warnings.ts +26 -0
  99. package/studio-dist/THIRD-PARTY-NOTICES.md +297 -0
  100. package/studio-dist/client/THIRD-PARTY-LICENSES.md +4294 -0
  101. package/studio-dist/client/assets/DialogTitle-DOhjDa7H.js +1 -0
  102. package/studio-dist/client/assets/app-CG3vCgyA.css +2 -0
  103. package/studio-dist/client/assets/bundle-mjs-CdK3cBzO.js +1 -0
  104. package/studio-dist/client/assets/button-upSzkd-q.js +1 -0
  105. package/studio-dist/client/assets/chat-DbaMXb8H.js +157 -0
  106. package/studio-dist/client/assets/cn-BCnYnarL.js +1 -0
  107. package/studio-dist/client/assets/combobox-cP9OsRf2.js +1 -0
  108. package/studio-dist/client/assets/{companion-view-C_N237bf.js → companion-view-B54_Lj0S.js} +1 -1
  109. package/studio-dist/client/assets/fields-DNZ4a89M.js +1 -0
  110. package/studio-dist/client/assets/friction-DgEimeDB.js +1 -0
  111. package/studio-dist/client/assets/getting-started-BTfYCt5s.js +1 -0
  112. package/studio-dist/client/assets/{getting-started-djaQeWlu.js → getting-started-CAszmdDJ.js} +1 -1
  113. package/studio-dist/client/assets/getting-started._topic-CHJMf0pa.js +1 -0
  114. package/studio-dist/client/assets/getting-started.index-MR6HftWs.js +1 -0
  115. package/studio-dist/client/assets/{graph-canvas-ySGKMhmk.js → graph-canvas-BdNk2F9O.js} +1 -1
  116. package/studio-dist/client/assets/graph-hRijsC89.js +2 -0
  117. package/studio-dist/client/assets/guides-CwFnh08E.js +1 -0
  118. package/studio-dist/client/assets/highlighted-body-JLMTFACH-BcroQey-.js +1 -0
  119. package/studio-dist/client/assets/index-D5oGyvG8.js +41 -0
  120. package/studio-dist/client/assets/{markdown-view-jMiaBTSO.js → markdown-view-CJ8JsLb7.js} +1 -1
  121. package/studio-dist/client/assets/marked.esm-vFuq1cCd.js +65 -0
  122. package/studio-dist/client/assets/mcp-BE9M-bkO.js +4 -0
  123. package/studio-dist/client/assets/mermaid-WFAXDIZX-BjSsakrn.js +1 -0
  124. package/studio-dist/client/assets/panel-CDQ6Lryw.js +1 -0
  125. package/studio-dist/client/assets/plugins._service._view-DRVPUAWN.js +1 -0
  126. package/studio-dist/client/assets/{prepaint-CKsXyJOR.js → prepaint-sD_LlrDN.js} +1 -1
  127. package/studio-dist/client/assets/{queries-Dfp5deWj.js → queries-COL925ML.js} +1 -1
  128. package/studio-dist/client/assets/react-dom-K3Hp2Cdj.js +1 -0
  129. package/studio-dist/client/assets/{react-BYUSgtBs.js → react-h2xQ_NSp.js} +1 -1
  130. package/studio-dist/client/assets/reports-BClsojkb.js +1 -0
  131. package/studio-dist/client/assets/routes-CJQ2MAej.js +1 -0
  132. package/studio-dist/client/assets/search-DhWdEiKT.js +1 -0
  133. package/studio-dist/client/assets/select-B2FsN9FY.js +1 -0
  134. package/studio-dist/client/assets/skills-SoUHk77W.js +1 -0
  135. package/studio-dist/client/assets/{specs-BrCOjOch.js → specs-C_tZnAvF.js} +1 -1
  136. package/studio-dist/client/assets/specs-view-C6t3Y5IT.js +1 -0
  137. package/studio-dist/client/assets/steps-CF3-Zpmh.js +1 -0
  138. package/studio-dist/client/assets/{store-C3vJq8Wj.js → store-pY9gU4uS.js} +1 -1
  139. package/studio-dist/client/assets/studio-X7bnFrRe.js +36 -0
  140. package/studio-dist/client/assets/studio-queries-CKtAnIKP.js +2 -0
  141. package/studio-dist/client/assets/usage-BaaqUpTG.js +55 -0
  142. package/studio-dist/client/assets/useAnchoredPopupScrollLock-BspHR7Wt.js +1 -0
  143. package/studio-dist/client/assets/useBlocker-BQOfcu_f.js +1 -0
  144. package/studio-dist/client/assets/useMutation-DKeEoP5S.js +1 -0
  145. package/studio-dist/client/assets/useOpenInteractionType-CtaZCaFT.js +1 -0
  146. package/studio-dist/client/assets/usePopupHandleStore-Bc7Q4bnF.js +1 -0
  147. package/studio-dist/client/assets/vault-sAPFUnPN.js +1 -0
  148. package/studio-dist/client/assets/{warnings-CqOOGlPD.js → warnings-D7YY1HSG.js} +1 -1
  149. package/studio-dist/client/assets/work-BZek_LGB.js +5 -0
  150. package/studio-dist/client/assets/workflow-N5boHXFz.js +1 -0
  151. package/studio-dist/server/THIRD-PARTY-LICENSES.md +4371 -0
  152. package/studio-dist/server/assets/DialogTitle-DnKSl2V0.js +421 -0
  153. package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-gVfW5vIV.js → __23tanstack-start-server-fn-resolver-Bli9bpSB.js} +38 -18
  154. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +91 -59
  155. package/studio-dist/server/assets/{actions-D8erOphH.js → actions-CHEFA1i9.js} +33 -1
  156. package/studio-dist/server/assets/{cn-FXJAM0KO.js → bundle-mjs-Ot6dQ8Pq.js} +1 -2056
  157. package/studio-dist/server/assets/{button-D6bvrFmm.js → button-BqA1urbl.js} +14 -7
  158. package/studio-dist/server/assets/chat-zl332Tvu.js +49486 -0
  159. package/studio-dist/server/assets/cn-B0fl6NWK.js +2057 -0
  160. package/studio-dist/server/assets/{combobox-D2MbYV1O.js → combobox-iTjvPCtS.js} +7 -6
  161. package/studio-dist/server/assets/{companion-view-Mf1ANbMb.js → companion-view-DIQ6AFIY.js} +2 -2
  162. package/studio-dist/server/assets/{companions-Dr6IpNAb.js → companions-aVwjRL8j.js} +1 -1
  163. package/studio-dist/server/assets/{fields-B4mAPETz.js → fields-BMap2_Ju.js} +10 -3
  164. package/studio-dist/server/assets/{friction-CWOTjpCV.js → friction-BER50hoD.js} +2 -2
  165. package/studio-dist/server/assets/{friction-9a5S1m7U.js → friction-BPs9KWdq.js} +8 -8
  166. package/studio-dist/server/assets/{getting-started-RU6tYU2Q.js → getting-started-DGfRVmZ_.js} +2 -2
  167. package/studio-dist/server/assets/{getting-started._topic-C02HGrC6.js → getting-started._topic-BgrBA4Vj.js} +2 -2
  168. package/studio-dist/server/assets/{getting-started.index-EzLRosbb.js → getting-started.index-BaFfQ9Mn.js} +2 -2
  169. package/studio-dist/server/assets/{graph-CZ2H9Fzr.js → graph-Cgzlrv3P.js} +8 -8
  170. package/studio-dist/server/assets/{graph-B11ITte0.js → graph-DODpuOy_.js} +1 -1
  171. package/studio-dist/server/assets/{graph-canvas-rP5TT14Z.js → graph-canvas-DW_zU1nA.js} +2 -2
  172. package/studio-dist/server/assets/{guides-BGftp4wf.js → guides-CA_EMG7E.js} +1 -1
  173. package/studio-dist/server/assets/{guides-B8HdeK_C.js → guides-D0SpoD32.js} +1 -1
  174. package/studio-dist/server/assets/{guides.server-DqFQAStf.js → guides.server-DJjQuy03.js} +1 -1
  175. package/studio-dist/server/assets/highlighted-body-JLMTFACH-BeHllu-r.js +41 -0
  176. package/studio-dist/server/assets/{markdown-view-CArpV-CS.js → markdown-view-CvVBGMZV.js} +1 -1
  177. package/studio-dist/server/assets/mcp-BU0fLYyJ.js +1103 -0
  178. package/studio-dist/server/assets/mcp-manager-D9YctTQe.js +50 -0
  179. package/studio-dist/server/assets/mermaid-WFAXDIZX-B1yDN6vG.js +1 -0
  180. package/studio-dist/server/assets/{panel-DR0iq46J.js → panel-D1K6Bsux.js} +4 -32
  181. package/studio-dist/server/assets/{plugins._service._view-n7u2k5dF.js → plugins._service._view-DdO1nELF.js} +4 -4
  182. package/studio-dist/server/assets/{prepaint-B28ClcPN.js → prepaint-BB3dwSmz.js} +1 -1
  183. package/studio-dist/server/assets/{queries-D-yVP9i0.js → queries-BwiDxQy5.js} +1 -1
  184. package/studio-dist/server/assets/{react-CiBZPDs8.js → react-B2cLiz-i.js} +1 -1
  185. package/studio-dist/server/assets/{reports-C2SmTgqh.js → reports-9Pr7Bz6o.js} +7 -7
  186. package/studio-dist/server/assets/{reports-B9k98oE6.js → reports-Cc9M3phM.js} +1 -1
  187. package/studio-dist/server/assets/{router-CPt0TAk_.js → router-DcWe0J7Y.js} +827 -548
  188. package/studio-dist/server/assets/{routes-CwH8LEy2.js → routes-BEXxl0py.js} +8 -8
  189. package/studio-dist/server/assets/{search-b-yQesv3.js → search-bltT7gwy.js} +39 -7
  190. package/studio-dist/server/assets/{select-C3i6TTX-.js → select-CZvHgGCi.js} +7 -6
  191. package/studio-dist/server/assets/{shell-CagqZZMZ.js → shell-BQ0vMKXN.js} +13 -4
  192. package/studio-dist/server/assets/{skills-DGg0mWDM.js → skills-Be_52h0i.js} +1 -1
  193. package/studio-dist/server/assets/{skills-C21Mg_8-.js → skills-BpGGUl6L.js} +8 -8
  194. package/studio-dist/server/assets/{specs-DetoMiaB.js → specs-CCGgXE-V.js} +5 -5
  195. package/studio-dist/server/assets/{specs-view-CmbfLDwN.js → specs-view-DtL5JxYM.js} +12 -11
  196. package/studio-dist/server/assets/{steps-D1tYAyWZ.js → steps-BWFSO6dM.js} +1 -1
  197. package/studio-dist/server/assets/{store-aC-I6f6o.js → store-X7yLPp7v.js} +1 -1
  198. package/studio-dist/server/assets/{studio-queries-Dqf-3nzj.js → studio-queries-ur1ygXi3.js} +117 -13
  199. package/studio-dist/server/assets/{studio-qRvQjRpz.js → studio-qzH-UETC.js} +1555 -179
  200. package/studio-dist/server/assets/{usage-Cwle9-xY.js → usage-C1o0DLzS.js} +1 -1
  201. package/studio-dist/server/assets/{usage-CS4CBK9D.js → usage-DWbSPrPD.js} +10 -9
  202. package/studio-dist/server/assets/{useAnchoredPopupScrollLock-BjMNgXv9.js → useAnchoredPopupScrollLock-DLDmv6kM.js} +4 -135
  203. package/studio-dist/server/assets/useBlocker-CQtANHK8.js +111 -0
  204. package/studio-dist/server/assets/{useMutation-DpBIuWXt.js → useMutation-NjlA8oFY.js} +2 -2
  205. package/studio-dist/server/assets/useOpenInteractionType-CZYscfOb.js +136 -0
  206. package/studio-dist/server/assets/usePopupHandleStore-DEEXJYv0.js +26 -0
  207. package/studio-dist/server/assets/{vault-CEBBRLMb.js → vault-B_kfi1h-.js} +1 -1
  208. package/studio-dist/server/assets/{vault-DVQidlId.js → vault-dL79JlKH.js} +8 -115
  209. package/studio-dist/server/assets/{views-UgO0Qz_g.js → views-BSGH56lb.js} +3 -3
  210. package/studio-dist/server/assets/{warnings-C7hgXpdk.js → warnings-DtUVPV-k.js} +2 -2
  211. package/studio-dist/server/assets/work-D789VXGH.js +110 -0
  212. package/studio-dist/server/assets/work-DsCEfhmK.js +3817 -0
  213. package/studio-dist/server/assets/work-requests-BLhOmQFO.js +11 -0
  214. package/studio-dist/server/assets/{workflow-6dZZ1ofw.js → workflow-BOZ2sRYg.js} +9 -9
  215. package/studio-dist/server/server.js +3 -3
  216. package/wrappers/bin/openspec +87 -2
  217. package/studio-dist/client/assets/app-ggXJ_QVh.css +0 -2
  218. package/studio-dist/client/assets/button-amJ3g5oD.js +0 -1
  219. package/studio-dist/client/assets/cn-BQPKiwI4.js +0 -1
  220. package/studio-dist/client/assets/combobox-CJ7aGFid.js +0 -1
  221. package/studio-dist/client/assets/fields-BAiGkJ5N.js +0 -1
  222. package/studio-dist/client/assets/friction-DqOU59v7.js +0 -1
  223. package/studio-dist/client/assets/getting-started-yp42dj5S.js +0 -1
  224. package/studio-dist/client/assets/getting-started._topic-C9zVXz_m.js +0 -1
  225. package/studio-dist/client/assets/getting-started.index-DWbDKICP.js +0 -1
  226. package/studio-dist/client/assets/graph-BYaD_5Bq.js +0 -2
  227. package/studio-dist/client/assets/guides-D6T6W_jV.js +0 -1
  228. package/studio-dist/client/assets/index-Qx7reRPD.js +0 -40
  229. package/studio-dist/client/assets/panel-C4bf_h2W.js +0 -1
  230. package/studio-dist/client/assets/plugins._service._view-y6f2FDAB.js +0 -1
  231. package/studio-dist/client/assets/reports-JFSwSueq.js +0 -1
  232. package/studio-dist/client/assets/routes-BdOWSgzK.js +0 -1
  233. package/studio-dist/client/assets/search-CXosfvYh.js +0 -1
  234. package/studio-dist/client/assets/select-BHYYWPhK.js +0 -1
  235. package/studio-dist/client/assets/skills-Bo9FLsBd.js +0 -1
  236. package/studio-dist/client/assets/specs-view-CdE2rlli.js +0 -1
  237. package/studio-dist/client/assets/steps-CKUno4lh.js +0 -1
  238. package/studio-dist/client/assets/studio-0ueISxwP.js +0 -100
  239. package/studio-dist/client/assets/studio-queries-BflKt9va.js +0 -2
  240. package/studio-dist/client/assets/usage-BLsLy0nN.js +0 -55
  241. package/studio-dist/client/assets/useAnchoredPopupScrollLock-DC7f8GOp.js +0 -1
  242. package/studio-dist/client/assets/useMutation-uJUrejsi.js +0 -1
  243. package/studio-dist/client/assets/vault-BB1B_OhR.js +0 -1
  244. package/studio-dist/client/assets/workflow-BFzmI-06.js +0 -1
@@ -4,6 +4,7 @@ import { archiveAnchors, archiveDirOf, changesDirOf } from "../change-layout";
4
4
  import { type DeliveryStatus, isPublishable, readDeliveryState } from "../delivery/record";
5
5
  import { discoverSubmitted } from "../delivery/staging/pending";
6
6
  import {
7
+ type LinkedChange,
7
8
  readWorksets,
8
9
  resolveLinkedChanges,
9
10
  type WorksetProblem,
@@ -90,15 +91,42 @@ export async function readWorksetStages(
90
91
  changes.map((change) => change.name),
91
92
  anchors,
92
93
  );
94
+ const facts = await collectChangeFacts(
95
+ companionPath,
96
+ [...linked.values()].flat(),
97
+ changes,
98
+ published,
99
+ sources,
100
+ );
101
+
102
+ return {
103
+ worksets: listing.worksets.map((record) => ({
104
+ record,
105
+ derived: deriveWorksetStage(record, linked.get(record.id) ?? [], (name) => facts.get(name)),
106
+ })),
107
+ problems: listing.problems,
108
+ };
109
+ }
110
+
111
+ export async function collectChangeFacts(
112
+ companionPath: string,
113
+ linked: readonly LinkedChange[],
114
+ changes: readonly ActiveChangeState[],
115
+ published: ReadonlySet<string>,
116
+ sources: Pick<
117
+ WorksetStageSources,
118
+ "archiveMergeSettled" | "activeDelivery" | "submittedChanges"
119
+ > & { submitted?: ReadonlySet<string> } = {},
120
+ ): Promise<Map<string, ChangeFacts>> {
121
+ const submitted = sources.submitted ?? new Set<string>();
93
122
  const mergeSettled = sources.archiveMergeSettled ?? archiveMergeSettled;
94
123
  const activeByName = new Map(changes.map((change) => [change.name, change]));
95
-
96
- const unique = new Map([...linked.values()].flat().map((change) => [change.name, change]));
124
+ const unique = new Map(linked.map((change) => [change.name, change]));
97
125
  const deliveryOf = sources.activeDelivery ?? activeDelivery;
98
126
  const local = new Map(
99
127
  await Promise.all(
100
128
  [...unique.values()]
101
- .filter((change) => change.kind === "active")
129
+ .filter((change) => change.kind === "active" && activeByName.has(change.name))
102
130
  .map(
103
131
  async (change) =>
104
132
  [
@@ -124,14 +152,30 @@ export async function readWorksetStages(
124
152
  const entries = await Promise.all(
125
153
  [...unique.values()].map(async (change): Promise<[string, ChangeFacts] | null> => {
126
154
  if (change.kind === "active") {
127
- const active = activeByName.get(change.name)!;
155
+ const active = activeByName.get(change.name);
156
+ if (!active) {
157
+ if (!submitted.has(change.name)) return null;
158
+ return [
159
+ change.name,
160
+ {
161
+ name: change.name,
162
+ archived: false,
163
+ submitted: true,
164
+ artifactsComplete: true,
165
+ reviewArtifacts: [],
166
+ checkedTasks: 0,
167
+ mergeSettled: false,
168
+ published: false,
169
+ },
170
+ ];
171
+ }
128
172
  const delivery = local.get(change.name)!;
129
173
  return [
130
174
  change.name,
131
175
  {
132
176
  name: change.name,
133
177
  archived: false,
134
- submitted: delivery.submitted,
178
+ submitted: delivery.submitted || submitted.has(change.name),
135
179
  artifactsComplete:
136
180
  active.artifacts.length > 0 &&
137
181
  active.artifacts.every((artifact) => artifact.status === "done"),
@@ -161,13 +205,5 @@ export async function readWorksetStages(
161
205
  return null;
162
206
  }),
163
207
  );
164
- const facts = new Map(entries.filter((entry) => entry !== null));
165
-
166
- return {
167
- worksets: listing.worksets.map((record) => ({
168
- record,
169
- derived: deriveWorksetStage(record, linked.get(record.id) ?? [], (name) => facts.get(name)),
170
- })),
171
- problems: listing.problems,
172
- };
208
+ return new Map(entries.filter((entry) => entry !== null));
173
209
  }
@@ -0,0 +1,158 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+
4
+ import { commitToPending } from "../delivery/staging/pending-edit";
5
+ import { sourceDir } from "../delivery/staging/artifact-type";
6
+ import { pendingPlace } from "../delivery/staging/refs";
7
+ import { defaultArtifactType } from "../delivery/staging/registry";
8
+ import { pathIsDirectory } from "../fs-utils";
9
+ import { groupClaim, type GroupClaim, type Operator, OWNER_FILE, serializeOwner } from "./claims";
10
+ import type { GitFailure } from "./git-transaction";
11
+ import {
12
+ folderOf,
13
+ inboxChanges,
14
+ joinedInboxGroup,
15
+ pendingCommitDeps,
16
+ pendingContent,
17
+ pendingGit,
18
+ recordPendingContent,
19
+ transactionFailure,
20
+ withWorkLock,
21
+ type WorkGitDeps,
22
+ } from "./sharing";
23
+
24
+ export type RefusalKind = "prerequisite" | "access" | "conflict";
25
+
26
+ export type ClaimOutcome =
27
+ | {
28
+ status: "accepted";
29
+ commit: string;
30
+ members: string[];
31
+ needsTake: string[];
32
+ }
33
+ | { status: "refused"; kind: RefusalKind; reason: string }
34
+ | { status: "stale"; reason: string }
35
+ | { status: "failed"; failure: GitFailure };
36
+
37
+ export interface ClaimRequest {
38
+ action: "claim" | "release";
39
+ members: readonly string[];
40
+ operator: Operator;
41
+ transactionId: string;
42
+ workset?: string;
43
+ }
44
+
45
+ function refused(kind: RefusalKind, reason: string): ClaimOutcome {
46
+ return { status: "refused", kind, reason };
47
+ }
48
+
49
+ export function sameMembers(a: readonly string[], b: readonly string[]): boolean {
50
+ const right = [...b].toSorted();
51
+ return a.length === b.length && [...a].toSorted().every((name, i) => name === right[i]);
52
+ }
53
+
54
+ function ownerRefusal(
55
+ request: ClaimRequest,
56
+ claim: GroupClaim,
57
+ branch: string | undefined,
58
+ ): ClaimOutcome | null {
59
+ const mine = claim.kind === "owned" && claim.owner.id === request.operator.id;
60
+ if (request.action === "claim") {
61
+ if (claim.kind === "owned") {
62
+ return refused("conflict", mine ? "already yours" : `claimed by ${claim.owner.label}`);
63
+ }
64
+ return branch ? refused("conflict", `in progress on ${branch}`) : null;
65
+ }
66
+ return mine ? null : refused("access", "only its owner can release it");
67
+ }
68
+
69
+ export async function updateClaim(
70
+ companionPath: string,
71
+ request: ClaimRequest,
72
+ deps: WorkGitDeps = {},
73
+ ): Promise<ClaimOutcome> {
74
+ if (request.members.length === 0) return refused("prerequisite", "the Workset has no changes");
75
+ const type = deps.artifactType ?? defaultArtifactType();
76
+ const gitFor = deps.git ?? pendingGit;
77
+ const contents = new Map<string, string>();
78
+ let members: string[] = [];
79
+ const result = await withWorkLock(companionPath, () =>
80
+ commitToPending<ClaimOutcome>(
81
+ {
82
+ companionPath,
83
+ subject: `chore(${type.name}): ${request.action} ${request.workset ?? request.members[0]}`,
84
+ transaction: request.transactionId,
85
+ edit: async (dir, remote) => {
86
+ contents.clear();
87
+ const inbox = await inboxChanges(dir, type);
88
+ if (request.members.some((name) => inbox.get(name)?.submitted)) {
89
+ return { stop: refused("conflict", "it is submitted for publication") };
90
+ }
91
+ const joined = joinedInboxGroup(inbox, request.members);
92
+ if (!joined) {
93
+ return {
94
+ stop: refused("prerequisite", `it is not on ${pendingPlace(remote)}; share it first`),
95
+ };
96
+ }
97
+ if (!sameMembers(joined, request.members)) {
98
+ return {
99
+ stop: {
100
+ status: "stale",
101
+ reason: `its changes are now ${joined.join(", ")}; review it again`,
102
+ },
103
+ };
104
+ }
105
+ const claim = groupClaim(joined.map((name) => inbox.get(name)!.owner));
106
+ if (claim.kind === "conflict") return { stop: refused("conflict", claim.diagnostic) };
107
+ const branch = joined.flatMap((name) => inbox.get(name)!.links.branches).at(0);
108
+ const refusal = ownerRefusal(request, claim, branch);
109
+ if (refusal) return { stop: refusal };
110
+ members = joined;
111
+ const work = gitFor(dir);
112
+ const paths: string[] = [];
113
+ for (const name of joined) {
114
+ const folder = folderOf(type, name);
115
+ const file = path.join(sourceDir(dir, type, name), OWNER_FILE);
116
+ if (request.action === "claim") {
117
+ // oxlint-disable-next-line no-await-in-loop -- one small file per member
118
+ await fs.writeFile(file, serializeOwner(request.operator), "utf8");
119
+ } else {
120
+ // oxlint-disable-next-line no-await-in-loop -- one small file per member
121
+ await fs.rm(file, { force: true });
122
+ }
123
+ paths.push(`${folder}/${OWNER_FILE}`);
124
+ // oxlint-disable-next-line no-await-in-loop -- same member
125
+ const content = await pendingContent(dir, folder, type, work);
126
+ if (content) contents.set(folder, content);
127
+ }
128
+ return paths;
129
+ },
130
+ },
131
+ pendingCommitDeps(gitFor, type, deps),
132
+ ),
133
+ );
134
+ switch (result.status) {
135
+ case "refused":
136
+ return refused("conflict", result.reason);
137
+ case "failed": {
138
+ const failure = transactionFailure(result);
139
+ return failure.status === "refused" ? refused("prerequisite", failure.reason) : failure;
140
+ }
141
+ case "stopped":
142
+ return result.value ?? refused("conflict", `the ${request.action} was stopped`);
143
+ case "unchanged":
144
+ return refused("conflict", `nothing to ${request.action}`);
145
+ case "pushed": {
146
+ recordPendingContent(companionPath, contents, deps.stateHome);
147
+ const present = await Promise.all(
148
+ members.map((name) => pathIsDirectory(sourceDir(companionPath, type, name))),
149
+ );
150
+ return {
151
+ status: "accepted",
152
+ commit: result.commit,
153
+ members,
154
+ needsTake: members.filter((_, index) => !present[index]),
155
+ };
156
+ }
157
+ }
158
+ }
@@ -36,6 +36,7 @@ export interface SubmittedFolder {
36
36
  digest: string;
37
37
  /** The same without the Delivery Record; absent on a record of an earlier Mate. */
38
38
  content?: string;
39
+ shared?: string;
39
40
  submittedAt: string;
40
41
  }
41
42
 
@@ -1,7 +1,7 @@
1
1
  import path from "node:path";
2
2
 
3
3
  import { FRAMEWORK_NAME } from "./framework";
4
- import { REPORT_KINDS } from "./friction-vocabulary";
4
+ import { REPORT_KINDS, SUBJECT_TYPES } from "./friction-vocabulary";
5
5
  import { GUIDANCE_FILE_VERSION, type MateGuidanceFile } from "./guidance";
6
6
  import { readWorkflow } from "./workflow/declaration";
7
7
  import type { DeclaredArtifactType } from "./workflow/workflow";
@@ -115,7 +115,7 @@ const SECRET_HANDLING_RULE = ` <rule id="secret-handling" severity="critical"
115
115
 
116
116
  export const FRICTION_GUIDANCE = `## Friction
117
117
 
118
- When ${FRAMEWORK_NAME} gets in your way without a refusal or error to point at, such as a skill step that does not fit or missing guidance, record it when it happens: \`${FRAMEWORK_NAME} friction report --kind <${REPORT_KINDS.join("|")}> --subject <type>:<name> --expected "<what you expected>" --evidence "<what you saw>"\`. Record one report per problem, then keep working on your task. When nothing went wrong, record nothing.`;
118
+ When ${FRAMEWORK_NAME} gets in your way without a refusal or error to point at, such as a skill step that does not fit or missing guidance, record it when it happens: \`${FRAMEWORK_NAME} friction report --kind <${REPORT_KINDS.join("|")}> --subject <${SUBJECT_TYPES.join("|")}>:<name> --expected "<what you expected>" --evidence "<what you saw>"\`. Record one report per problem, then keep working on your task. When nothing went wrong, record nothing.`;
119
119
 
120
120
  function withFriction(policy: string, friction: boolean | undefined): string {
121
121
  return friction ? `${policy}\n\n${FRICTION_GUIDANCE}` : policy;
@@ -46,3 +46,9 @@ export function forgeRepoOf(host: string, path: string): RemoteRepo | null {
46
46
  export function repositoryPath(repo: RemoteRepo): string {
47
47
  return `${repo.owner}/${repo.repo}`;
48
48
  }
49
+
50
+ /** `host/owner/repo` for a Git URL, so SSH and HTTPS forms of one repository are equal; null when unparsable. */
51
+ export function remoteIdentity(url: string): string | null {
52
+ const repo = parseRemote(url);
53
+ return repo ? `${repo.host}/${repositoryPath(repo)}` : null;
54
+ }
@@ -0,0 +1,28 @@
1
+ import net from "node:net";
2
+
3
+ export function freeLoopbackPort(): Promise<number> {
4
+ return new Promise((resolve, reject) => {
5
+ const probe = net.createServer();
6
+ probe.once("error", reject);
7
+ probe.listen(0, "127.0.0.1", () => {
8
+ const address = probe.address();
9
+ probe.close(() =>
10
+ typeof address === "object" && address
11
+ ? resolve(address.port)
12
+ : reject(new Error("no free port")),
13
+ );
14
+ });
15
+ });
16
+ }
17
+
18
+ export function signalProcessGroup(pid: number, signal: NodeJS.Signals): void {
19
+ try {
20
+ process.kill(-pid, signal);
21
+ } catch {}
22
+ }
23
+
24
+ export async function within(done: Promise<unknown>, ms: number): Promise<void> {
25
+ let timer: ReturnType<typeof setTimeout> | undefined;
26
+ await Promise.race([done, new Promise((resolve) => (timer = setTimeout(resolve, ms)))]);
27
+ clearTimeout(timer);
28
+ }
@@ -100,6 +100,23 @@ export function shellWords(command: string): string[] {
100
100
  return words.filter(Boolean);
101
101
  }
102
102
 
103
+ /**
104
+ * A lone `jq` call whose text a shell runs as written: value-free short flags, one filter
105
+ * (single-quoted or a bare path), then plain file names. Group 2 is the filter.
106
+ */
107
+ const PLAIN_JQ =
108
+ /^( *jq(?: +-[acejnrsCMRS]+)* +)('[^'\n-][^'\n]*'|[\w.]+)((?: +(?:~\/)?[\w./][\w./-]*)* *)$/;
109
+
110
+ /** The only words with which a `jq` program opens a file. */
111
+ const JQ_MODULE_LOAD = /import|include|modulemeta/;
112
+
113
+ /** The command without the filter of a plain `jq` call: a program, never a file `jq` opens. */
114
+ function withoutJqFilter(command: string): string {
115
+ const plain = PLAIN_JQ.exec(command);
116
+ if (!plain || JQ_MODULE_LOAD.test(plain[2])) return command;
117
+ return plain[1] + plain[3];
118
+ }
119
+
103
120
  /** A word, plus the value of a `--flag=path` or `NAME=path` word. */
104
121
  function candidatePaths(word: string): string[] {
105
122
  const equals = word.indexOf("=");
@@ -119,7 +136,7 @@ export async function checkSecretAccess(
119
136
  if (!policy.guardrails) return null;
120
137
 
121
138
  if (call.kind === "shell") {
122
- const named = shellWords(call.command)
139
+ const named = shellWords(withoutJqFilter(call.command))
123
140
  .flatMap(candidatePaths)
124
141
  .find((word) => isSecretFile(word, policy));
125
142
  return named ? secretFileRefusal(named) : null;
@@ -204,9 +204,10 @@ export interface SecretPathOptions {
204
204
  windows?: boolean;
205
205
  }
206
206
 
207
- const IS_WINDOWS = process.platform === "win32";
207
+ // Read on call, not at import: Studio's browser bundle imports this module and has no `process`.
208
+ const isWindows = () => process.platform === "win32";
208
209
 
209
- function normalizePath(filePath: string, { windows = IS_WINDOWS }: SecretPathOptions): string {
210
+ function normalizePath(filePath: string, { windows = isWindows() }: SecretPathOptions): string {
210
211
  return (windows ? filePath.replaceAll("\\", "/") : filePath).replace(/\/+$/, "");
211
212
  }
212
213
 
@@ -280,7 +281,7 @@ type BraceSequence = BracePart[];
280
281
  */
281
282
  function parseBraces(
282
283
  glob: string,
283
- { windows = IS_WINDOWS }: SecretPathOptions,
284
+ { windows = isWindows() }: SecretPathOptions,
284
285
  ): BraceSequence | null {
285
286
  const source = windows ? glob.replaceAll("**\\", "**/") : glob;
286
287
  let i = 0;
@@ -94,7 +94,7 @@ export async function ownFiles(
94
94
  }
95
95
 
96
96
  /** SHA-256 over relative file paths and contents, in path order; what submit records. */
97
- export function contentDigest(files: Iterable<readonly [string, Uint8Array]>): string {
97
+ export function contentDigest(files: Iterable<readonly [string, Uint8Array | string]>): string {
98
98
  const hash = createHash("sha256");
99
99
  const sorted = [...files].toSorted(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
100
100
  for (const [file, content] of sorted) {
@@ -103,6 +103,29 @@ export function contentDigest(files: Iterable<readonly [string, Uint8Array]>): s
103
103
  return hash.digest("hex");
104
104
  }
105
105
 
106
+ export const OWNER_FILE = "owner.yaml";
107
+
108
+ export function sharedDigest(files: Iterable<readonly [string, string]>): string {
109
+ return contentDigest([...files].filter(([file]) => file !== OWNER_FILE));
110
+ }
111
+
112
+ export async function emptyFolderKeepingClaim(dir: string): Promise<void> {
113
+ const names = await fs.readdir(dir).catch(() => [] as string[]);
114
+ await Promise.all(
115
+ names
116
+ .filter((name) => name !== OWNER_FILE)
117
+ .map((name) => fs.rm(path.join(dir, name), { recursive: true, force: true })),
118
+ );
119
+ }
120
+
121
+ export async function sharedDigestAt(
122
+ git: CompanionGit,
123
+ ref: string,
124
+ folder: string,
125
+ ): Promise<string> {
126
+ return sharedDigest(await blobsAt(git, ref, folder));
127
+ }
128
+
106
129
  /**
107
130
  * {@link contentDigest} over `files` of `dir`, paths relative to it; every regular file below
108
131
  * `dir` when `files` is omitted.
@@ -283,6 +306,7 @@ async function newArchive(
283
306
  layout: SubmittedLayout,
284
307
  incoming: Map<string, Set<string>>,
285
308
  current: Map<string, Set<string>>,
309
+ filesMayDiffer: boolean,
286
310
  ): Promise<boolean> {
287
311
  const name = path.posix.basename(relative);
288
312
  const known = current.get(name) ?? new Set<string>();
@@ -312,6 +336,7 @@ async function newArchive(
312
336
  continue;
313
337
  }
314
338
  }
339
+ if (filesMayDiffer) return true;
315
340
  // oxlint-disable-next-line no-await-in-loop -- same candidate
316
341
  const blobs = await blobsAt(git, incomingRef, archive);
317
342
  blobs.delete(DELIVERY_FILE);
@@ -349,7 +374,7 @@ export async function planSubmittedArrivals(
349
374
  archivedRecords(git, incomingRef, layout),
350
375
  archivedRecords(git, "HEAD", layout),
351
376
  ]);
352
- for (const [relative, { digest, submittedAt }] of recorded) {
377
+ for (const [relative, { digest, submittedAt, shared }] of recorded) {
353
378
  const dir = path.join(companionPath, ...relative.split("/"));
354
379
  // oxlint-disable-next-line no-await-in-loop -- a few submitted folders per checkout
355
380
  const local = await ownFiles(git, companionPath, relative);
@@ -365,6 +390,7 @@ export async function planSubmittedArrivals(
365
390
  layout,
366
391
  incoming,
367
392
  current,
393
+ shared !== undefined,
368
394
  );
369
395
  if (!archived) continue;
370
396
  plan.forget.push(relative);
@@ -182,20 +182,27 @@ function pathSkill(workflow: Workflow, skill: string): boolean {
182
182
  );
183
183
  }
184
184
 
185
- /**
186
- * The hand-offs the verdict of a finished turn reads, one per change: after each reported
187
- * change's last report, or, for a turn that only started a companion's step, the change's.
188
- */
189
185
  function handoffQueries(turn: Turn, workflow: Workflow, again: boolean): HandoffQuery[] {
190
186
  if (turn.reports.length > 0) {
191
187
  const last = new Map<string, string>();
192
188
  for (const report of turn.reports) if (report.change) last.set(report.change, report.skill);
193
- return [...last].map(([change, after]) => ({ change, after }));
189
+ const queries: HandoffQuery[] = [...last].map(([change, after]) => ({ change, after }));
190
+ const unnamed = unnamedStep(turn);
191
+ if (unnamed && !last.has(unnamed.change)) queries.push({ change: unnamed.change });
192
+ return queries;
194
193
  }
195
194
  const step = turn.step;
196
195
  return !again && step && companionStep(workflow, step.skill) ? [{ change: step.change }] : [];
197
196
  }
198
197
 
198
+ function unnamedStep(turn: Turn): Step | undefined {
199
+ const step = turn.step;
200
+ if (!step?.change) return undefined;
201
+ const reported = (change: string) =>
202
+ turn.reports.some((report) => report.skill === step.skill && report.change === change);
203
+ return reported("") && !reported(step.change) ? step : undefined;
204
+ }
205
+
199
206
  /** Every query's hand-off at once, by change. */
200
207
  async function fetchHandoffs(
201
208
  queries: readonly HandoffQuery[],
@@ -251,13 +258,8 @@ async function turnVerdict(
251
258
  { again, runtime, response }: FinishOptions,
252
259
  ): Promise<TurnVerdict> {
253
260
  if (turn.reports.length > 0) {
254
- // The turn's step reported without its change: nothing was recorded for it.
255
- const step = turn.step;
256
- const unnamed =
257
- step?.change &&
258
- turn.reports.some((report) => report.skill === step.skill && !report.change) &&
259
- !turn.reports.some((report) => report.skill === step.skill && report.change === step.change);
260
- if (unnamed && step) {
261
+ const step = unnamedStep(turn);
262
+ if (step && next(step.change) !== null) {
261
263
  if (again) return PASS;
262
264
  return {
263
265
  kind: "sendBack",
@@ -11,7 +11,7 @@ import path from "node:path";
11
11
  */
12
12
  export async function writeAtomic(
13
13
  target: string,
14
- contents: string | Buffer,
14
+ contents: string | Uint8Array,
15
15
  mode?: number,
16
16
  ): Promise<void> {
17
17
  await replaceViaTemp(target, contents, mode, false);
@@ -20,7 +20,7 @@ export async function writeAtomic(
20
20
  /** `exactMode`: chmod past the umask, so a replaced file keeps the mode it had. */
21
21
  async function replaceViaTemp(
22
22
  target: string,
23
- contents: string | Buffer,
23
+ contents: string | Uint8Array,
24
24
  mode: number | undefined,
25
25
  exactMode: boolean,
26
26
  ): Promise<void> {
package/src/studio.ts CHANGED
@@ -34,6 +34,20 @@ export type {
34
34
  StudioSubmittedChange,
35
35
  StudioWorkset,
36
36
  } from "./cli/commands/studio/payload";
37
+ export { WORK_REQUEST_ACTIONS } from "./cli/commands/studio/work-requests";
38
+ export type {
39
+ StudioWorkCard,
40
+ StudioWorkPayload,
41
+ WorkRequest,
42
+ WorkResult,
43
+ } from "./cli/commands/studio/work";
44
+ export {
45
+ isShared,
46
+ WORK_BUCKETS,
47
+ type WorkActionId,
48
+ type WorkBucket,
49
+ } from "./lib/workset/projection";
50
+ export type { SharePreview } from "./lib/workset/sharing";
37
51
  export {
38
52
  archivedArtifactPath,
39
53
  canonicalSpecPath,
@@ -79,6 +93,7 @@ export {
79
93
  viewsFor,
80
94
  type StudioMode,
81
95
  type StudioModePolicy,
96
+ type StudioOffers,
82
97
  type StudioProfile,
83
98
  type StudioSelection,
84
99
  type StudioView,
@@ -92,6 +107,9 @@ export {
92
107
  } from "./cli/commands/studio/connection";
93
108
  export { BRAND_SVGS } from "./brand/svg.generated";
94
109
  export {
110
+ CHAT_CREDENTIAL_ROUTE,
111
+ CHAT_ROUTE,
112
+ CHAT_SESSION_ROUTE,
95
113
  REPORT_VIEW_PREFIX,
96
114
  SERVICE_ASSET_PREFIX,
97
115
  SERVICE_ROUTE_PREFIX,
@@ -103,6 +121,20 @@ export {
103
121
  TERMINAL_WASM,
104
122
  type StudioEvent,
105
123
  } from "./cli/commands/studio/routes";
124
+ export {
125
+ CHAT_EFFORTS,
126
+ CHAT_HISTORY_BUDGET,
127
+ CHAT_MODELS,
128
+ type ChatEffort,
129
+ type ChatModel,
130
+ chatModel,
131
+ isCredentialFailure,
132
+ messageText,
133
+ replayedChars,
134
+ } from "./lib/studio-chat/agent";
135
+ export type { ChatSession } from "./lib/studio-chat/session";
136
+ export { CREDENTIAL_KIND_LABELS, type CredentialKind } from "./lib/credential-kinds";
137
+ export type { CredentialStatus } from "./lib/agent-credential";
106
138
  export type { TerminalAgent } from "./cli/commands/studio/terminal";
107
139
  export type {
108
140
  VaultEntry,
@@ -222,3 +254,32 @@ export {
222
254
  LIGHT_PALETTE,
223
255
  type ReportPalette,
224
256
  } from "./cli/commands/report/palette";
257
+
258
+ export {
259
+ McpManagerConflictError,
260
+ readMcpManager,
261
+ writeMcpManager,
262
+ type McpManagerPatch,
263
+ type McpManagerSnapshot,
264
+ } from "./lib/mcp-manager/store";
265
+ // The types module imports nothing, so the browser bundle can take these lists.
266
+ export {
267
+ MCP_MANAGER_HEADER_PREFIXES,
268
+ MCP_MANAGER_TRANSPORTS,
269
+ parseHeaderRef,
270
+ type McpManagerAudienceSelection,
271
+ type McpManagerConfig,
272
+ type McpManagerRemoteServer,
273
+ type McpManagerSelection,
274
+ type McpManagerServer,
275
+ type McpManagerStdioServer,
276
+ type McpManagerTransport,
277
+ } from "./lib/mcp-manager/types";
278
+ export type {
279
+ McpManagerDerived,
280
+ McpManagerPreview,
281
+ McpManagerSaveResult,
282
+ McpManagerState,
283
+ McpManagerView,
284
+ McpVariableStatus,
285
+ } from "./cli/commands/studio/mcp-manager";
@@ -15,7 +15,7 @@ artifacts:
15
15
  - **Capabilities**: Identify which specs will be created or modified:
16
16
  - **New Capabilities**: List capabilities being introduced. Each becomes a new `specs/<capability>/spec.md` using a kebab-case capability name (e.g., `user-auth`, `data-export`). Never place specs under an Area folder. Record the paired scope as `scopes` metadata.
17
17
  - **Modified Capabilities**: List existing capabilities whose REQUIREMENTS are changing. Only include if spec-level behavior changes (not just implementation details). Each needs a delta spec file. Check `openspec/specs/` for existing spec names. Leave empty if no requirement changes.
18
- - **Impact**: Affected code, APIs, dependencies, or systems.
18
+ - **Impact**: Affected code, APIs, dependencies, or systems. Search the Working Repository's docs for each value, message or name the change alters, and list every page that states one.
19
19
 
20
20
  IMPORTANT: The Capabilities section is critical. It creates the contract between proposal and specs phases. Research existing specs before filling this in. Each capability listed here will need a corresponding spec file.
21
21
 
@@ -29,4 +29,4 @@ scopes:
29
29
 
30
30
  ## Impact
31
31
 
32
- <!-- Affected code, APIs, dependencies, systems, or workflows. -->
32
+ <!-- Affected code, APIs, dependencies, systems, or workflows, and each doc page that states a value, message or name the change alters. -->
@@ -162,8 +162,9 @@ A drifted spec is published in its own right. It is never shipped by republishin
162
162
 
163
163
  - `no-checkout` → the repository is not linked on this machine and no merge is recorded. Ask the **merge question** below.
164
164
  - `branch-deleted` → the branch is gone on the remote and no default-branch commit contains its head, so it was most likely closed without merging. Ask once per branch whether to drop its changes. Only after the user agrees, drop each submitted change with `mate artifact submit --drop "<name>" --json` (a legacy archive: `--confirm-dropped`, then offer the Git restore below). When the user says it was merged after all, record `--confirm-merged`.
165
- - `likely-merged` → local Git found the branch's changes on the default branch only by patch identity (a `squash` or `rebase` merge, on Git before 2.38), or found its head on the default branch's own line (`fast-forward`, which a branch whose work was never committed looks like too). That is evidence, not proof. Name `suggestion.style` and the short `suggestion.commit`, then ask the **merge question** with **merged** preselected; record it only after the user confirms.
166
- - `not-on-default` → the branch head is not on the default branch as of the last fetch. When the outcome's `fetch.branchDeleted` is true, the branch is deleted on the remote and this machine holds no copy to check (typical after a squash merge someone else delivered): say so and ask the **merge question** directly. When the outcome has no `fetch` field (Mate did not fetch), show `fetchedAt` (or "never fetched") and offer one fetch first; only after the user agrees, re-run `mate artifact link "<anchor>" "<anchor>" --refresh --fetch --json` and use its outcomes. Otherwise, or when the user declines, ask the **merge question**.
165
+ - `likely-merged` → local Git found the branch's changes on the default branch only by patch identity (a `squash` or `rebase` merge, on Git before 2.38), or found its head on the default branch's own line (`fast-forward`). That is evidence, not proof. Name `suggestion.style` and the short `suggestion.commit`, then ask the **merge question** with **merged** preselected; record it only after the user confirms.
166
+ - `empty-branch` → the branch has no commits of its own. Say so; ask the **merge question** with **not yet merged** preselected; never preselect merged.
167
+ - `not-on-default` → the branch head is not on the default branch as of the last fetch. With `fetch.branchUnpushed`, say it was never pushed. When the outcome's `fetch.branchDeleted` is true, the branch is deleted on the remote and this machine holds no copy to check (typical after a squash merge someone else delivered): say so and ask the **merge question** directly. When the outcome has no `fetch` field (Mate did not fetch), show `fetchedAt` (or "never fetched") and offer one fetch first; only after the user agrees, re-run `mate artifact link "<anchor>" "<anchor>" --refresh --fetch --json` and use its outcomes. Otherwise, or when the user declines, ask the **merge question**.
167
168
  - `direct` → a direct delivery is never settled automatically: Git cannot tell this change's commits from the user's other pushes. Ask the **direct-delivery question** below.
168
169
 
169
170
  **The merge question** offers exactly three answers, asked once per branch and applied to every change on it (with `mate artifact publish '<group>' …` for a submitted group):
@@ -81,9 +81,11 @@ it with `mate workflow done <skill> "<change-name>"`; otherwise name it above th
81
81
  submit retries; an unchanged resubmit adds no commit.
82
82
 
83
83
  A non-zero exit without a result is a refusal; report its message. When it names
84
- uncommitted changes, the branch already counts as merged while its work tree holds
85
- modified tracked files: tell the user to commit or stash them and submit again.
86
- Never commit, stash or discard them yourself.
84
+ uncommitted changes, the branch counts or is suggested as merged while its work tree
85
+ holds modified tracked files: tell the user to commit or stash them and submit again.
86
+ For `empty-delivery-branch` (no commits of its own), tell the user to commit the work
87
+ on it or record that repository with `--repository <org/repo> --not-applicable`. Never commit, stash or discard
88
+ them yourself.
87
89
 
88
90
  3. **Report.** Relay every entry of `warnings` first: another active change that
89
91
  modifies the same requirement, a declared dependency that is not submitted yet,