@uniqbit/mate-core 1.0.0-canary.9 → 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.
- package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
- package/package.json +5 -4
- package/src/cli/commands/artifact/delivery/link.ts +1 -1
- package/src/cli/commands/artifact/delivery/output.ts +10 -1
- package/src/cli/commands/artifact/delivery/resolve.ts +3 -2
- package/src/cli/commands/artifact/delivery/submit.ts +9 -4
- package/src/cli/commands/artifact/delivery/take.ts +12 -9
- package/src/cli/commands/artifact/finish/command.ts +16 -14
- package/src/cli/commands/artifact/finish/engine.ts +8 -8
- package/src/cli/commands/artifact/project/command.ts +2 -3
- package/src/cli/commands/companion/hub.ts +11 -6
- package/src/cli/commands/companion/link.ts +173 -46
- package/src/cli/commands/report/contract.ts +0 -17
- package/src/cli/commands/studio/access.ts +4 -0
- package/src/cli/commands/studio/actions.ts +35 -2
- package/src/cli/commands/studio/mcp-manager.ts +162 -0
- package/src/cli/commands/studio/routes.ts +12 -0
- package/src/cli/commands/studio/selection.ts +44 -11
- package/src/cli/commands/studio/server.ts +246 -2
- package/src/cli/commands/studio/services.ts +26 -0
- package/src/cli/commands/studio/terminal-launch.ts +21 -4
- package/src/cli/commands/studio/terminal.ts +3 -14
- package/src/cli/commands/studio/work-requests.ts +9 -0
- package/src/cli/commands/studio/work.ts +473 -0
- package/src/cli/commands/vscode/release-vsix.json +2 -2
- package/src/cli/commands/working/cleanup.ts +1 -18
- package/src/cli/companion-link-wizard.tsx +158 -91
- package/src/cli/usage.ts +1 -1
- package/src/lib/agent-credential.ts +131 -0
- package/src/lib/credential-kinds.ts +7 -0
- package/src/lib/delivery/merge-git.ts +16 -0
- package/src/lib/delivery/record-delivery.ts +12 -6
- package/src/lib/delivery/record.ts +5 -0
- package/src/lib/delivery/refresh.ts +34 -6
- package/src/lib/delivery/staging/refs.ts +9 -4
- package/src/lib/delivery/staging/submit.ts +81 -22
- package/src/lib/mcp-manager/resolve.ts +27 -9
- package/src/lib/mcp-manager/store.ts +35 -11
- package/src/lib/mcp-manager/types.ts +14 -0
- package/src/lib/mcp-manager/validate.ts +6 -10
- package/src/lib/opencode-server.ts +2 -17
- package/src/lib/orchestrator/repo-local-store.ts +14 -0
- package/src/lib/orchestrator/repository-link.ts +80 -52
- package/src/lib/orchestrator/root-context.ts +17 -1
- package/src/lib/studio-chat/agent.ts +139 -0
- package/src/lib/studio-chat/companion-context.ts +136 -0
- package/src/lib/studio-chat/credential.ts +79 -0
- package/src/lib/studio-chat/harness-chat-agent.ts +334 -0
- package/src/lib/studio-chat/host-sandbox.ts +578 -0
- package/src/lib/studio-chat/prepare-bridges.ts +95 -0
- package/src/lib/studio-chat/session.ts +15 -0
- package/src/lib/studio-chat/turns.ts +112 -0
- package/src/lib/workset/claims.ts +85 -0
- package/src/lib/workset/execution.ts +71 -0
- package/src/lib/workset/git-transaction.ts +74 -0
- package/src/lib/workset/groups.ts +176 -0
- package/src/lib/workset/inventory.ts +196 -0
- package/src/lib/workset/projection.ts +237 -0
- package/src/lib/workset/record.ts +101 -36
- package/src/lib/workset/repositories.ts +24 -0
- package/src/lib/workset/sharing.ts +951 -0
- package/src/lib/workset/stages.ts +50 -14
- package/src/lib/workset/transactions.ts +158 -0
- package/src/runtime/companion-git-state.ts +1 -0
- package/src/runtime/companion-guidance.ts +2 -2
- package/src/runtime/forge-remote.ts +6 -0
- package/src/runtime/host-process.ts +28 -0
- package/src/runtime/secret-guard.ts +18 -1
- package/src/runtime/secret-patterns.ts +4 -3
- package/src/runtime/submitted-arrivals.ts +28 -2
- package/src/runtime/write-atomic.ts +2 -2
- package/src/studio.ts +52 -8
- package/src/templates/capabilities/openspec-cap/mate-full/schema.yaml +1 -1
- package/src/templates/capabilities/openspec-cap/mate-full/templates/proposal.md +1 -1
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +3 -2
- package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +5 -3
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +3 -2
- package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +5 -3
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +12 -12
- package/src/tools/setup/capabilities/mcp-manager.ts +1 -2
- package/src/tools/setup/dynamic-plugins/declarations.ts +0 -26
- package/src/tools/setup/plugins/gitignore.ts +1 -0
- package/src/tools/setup/providers/claude-format.ts +1 -5
- package/src/tools/setup/providers/claude.ts +28 -3
- package/src/tools/setup/providers/opencode.ts +7 -18
- package/src/tools/setup/providers/relative-path-warnings.ts +26 -0
- package/studio-dist/THIRD-PARTY-NOTICES.md +297 -0
- package/studio-dist/client/THIRD-PARTY-LICENSES.md +4294 -0
- package/studio-dist/client/assets/DialogTitle-DOhjDa7H.js +1 -0
- package/studio-dist/client/assets/app-CG3vCgyA.css +2 -0
- package/studio-dist/client/assets/bundle-mjs-CdK3cBzO.js +1 -0
- package/studio-dist/client/assets/button-upSzkd-q.js +1 -0
- package/studio-dist/client/assets/chat-DbaMXb8H.js +157 -0
- package/studio-dist/client/assets/cn-BCnYnarL.js +1 -0
- package/studio-dist/client/assets/combobox-cP9OsRf2.js +1 -0
- package/studio-dist/client/assets/{companion-view-C1F0_jbt.js → companion-view-B54_Lj0S.js} +1 -1
- package/studio-dist/client/assets/fields-DNZ4a89M.js +1 -0
- package/studio-dist/client/assets/friction-DgEimeDB.js +1 -0
- package/studio-dist/client/assets/getting-started-BTfYCt5s.js +1 -0
- package/studio-dist/client/assets/{getting-started-BN4aTpsz.js → getting-started-CAszmdDJ.js} +1 -1
- package/studio-dist/client/assets/getting-started._topic-CHJMf0pa.js +1 -0
- package/studio-dist/client/assets/getting-started.index-MR6HftWs.js +1 -0
- package/studio-dist/client/assets/{graph-canvas-Be5qgdDt.js → graph-canvas-BdNk2F9O.js} +1 -1
- package/studio-dist/client/assets/graph-hRijsC89.js +2 -0
- package/studio-dist/client/assets/guides-CwFnh08E.js +1 -0
- package/studio-dist/client/assets/highlighted-body-JLMTFACH-BcroQey-.js +1 -0
- package/studio-dist/client/assets/index-D5oGyvG8.js +41 -0
- package/studio-dist/client/assets/{markdown-view-dku7MGPn.js → markdown-view-CJ8JsLb7.js} +1 -1
- package/studio-dist/client/assets/marked.esm-vFuq1cCd.js +65 -0
- package/studio-dist/client/assets/mcp-BE9M-bkO.js +4 -0
- package/studio-dist/client/assets/mermaid-WFAXDIZX-BjSsakrn.js +1 -0
- package/studio-dist/client/assets/panel-CDQ6Lryw.js +1 -0
- package/studio-dist/client/assets/plugins._service._view-DRVPUAWN.js +1 -0
- package/studio-dist/client/assets/{prepaint-BkoDSw5X.js → prepaint-sD_LlrDN.js} +1 -1
- package/studio-dist/client/assets/{queries-CMvC2OkU.js → queries-COL925ML.js} +1 -1
- package/studio-dist/client/assets/react-dom-K3Hp2Cdj.js +1 -0
- package/studio-dist/client/assets/{react-BYUSgtBs.js → react-h2xQ_NSp.js} +1 -1
- package/studio-dist/client/assets/reports-BClsojkb.js +1 -0
- package/studio-dist/client/assets/routes-CJQ2MAej.js +1 -0
- package/studio-dist/client/assets/search-DhWdEiKT.js +1 -0
- package/studio-dist/client/assets/select-B2FsN9FY.js +1 -0
- package/studio-dist/client/assets/skills-SoUHk77W.js +1 -0
- package/studio-dist/client/assets/{specs-Bqd1ajyD.js → specs-C_tZnAvF.js} +1 -1
- package/studio-dist/client/assets/specs-view-C6t3Y5IT.js +1 -0
- package/studio-dist/client/assets/steps-CF3-Zpmh.js +1 -0
- package/studio-dist/client/assets/{store-BYnEU33C.js → store-pY9gU4uS.js} +1 -1
- package/studio-dist/client/assets/studio-X7bnFrRe.js +36 -0
- package/studio-dist/client/assets/studio-queries-CKtAnIKP.js +2 -0
- package/studio-dist/client/assets/usage-BaaqUpTG.js +55 -0
- package/studio-dist/client/assets/useAnchoredPopupScrollLock-BspHR7Wt.js +1 -0
- package/studio-dist/client/assets/useBlocker-BQOfcu_f.js +1 -0
- package/studio-dist/client/assets/useMutation-DKeEoP5S.js +1 -0
- package/studio-dist/client/assets/useOpenInteractionType-CtaZCaFT.js +1 -0
- package/studio-dist/client/assets/usePopupHandleStore-Bc7Q4bnF.js +1 -0
- package/studio-dist/client/assets/vault-sAPFUnPN.js +1 -0
- package/studio-dist/client/assets/{warnings-Cnw99ugO.js → warnings-D7YY1HSG.js} +1 -1
- package/studio-dist/client/assets/work-BZek_LGB.js +5 -0
- package/studio-dist/client/assets/workflow-N5boHXFz.js +1 -0
- package/studio-dist/server/THIRD-PARTY-LICENSES.md +4371 -0
- package/studio-dist/server/assets/DialogTitle-DnKSl2V0.js +421 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-CS3QRY4Q.js → __23tanstack-start-server-fn-resolver-Bli9bpSB.js} +38 -18
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +91 -59
- package/studio-dist/server/assets/{actions-D8erOphH.js → actions-CHEFA1i9.js} +33 -1
- package/studio-dist/server/assets/{cn-DWFJaP_9.js → bundle-mjs-Ot6dQ8Pq.js} +1 -2056
- package/studio-dist/server/assets/{button-Ct_WeYLc.js → button-BqA1urbl.js} +14 -7
- package/studio-dist/server/assets/chat-zl332Tvu.js +49486 -0
- package/studio-dist/server/assets/cn-B0fl6NWK.js +2057 -0
- package/studio-dist/server/assets/{combobox-17vO5Uz8.js → combobox-iTjvPCtS.js} +7 -6
- package/studio-dist/server/assets/{companion-view-JkxnGLlp.js → companion-view-DIQ6AFIY.js} +2 -2
- package/studio-dist/server/assets/{companions-YNLsbnch.js → companions-aVwjRL8j.js} +1 -1
- package/studio-dist/server/assets/{fields-VytPpqBq.js → fields-BMap2_Ju.js} +10 -3
- package/studio-dist/server/assets/{friction-BW86PCPM.js → friction-BER50hoD.js} +2 -2
- package/studio-dist/server/assets/{friction-B6osqFSm.js → friction-BPs9KWdq.js} +8 -8
- package/studio-dist/server/assets/{getting-started-CFHSeX5h.js → getting-started-DGfRVmZ_.js} +2 -2
- package/studio-dist/server/assets/{getting-started._topic-BK2eU6AS.js → getting-started._topic-BgrBA4Vj.js} +2 -2
- package/studio-dist/server/assets/{getting-started.index-DZLuXnNO.js → getting-started.index-BaFfQ9Mn.js} +2 -2
- package/studio-dist/server/assets/{graph-BJVZBevL.js → graph-Cgzlrv3P.js} +8 -8
- package/studio-dist/server/assets/{graph-DGZHV-Ek.js → graph-DODpuOy_.js} +1 -1
- package/studio-dist/server/assets/{graph-canvas-lrNT6jbl.js → graph-canvas-DW_zU1nA.js} +2 -2
- package/studio-dist/server/assets/{guides-_G8Vucsk.js → guides-CA_EMG7E.js} +1 -1
- package/studio-dist/server/assets/{guides-CEwLOZb9.js → guides-D0SpoD32.js} +1 -1
- package/studio-dist/server/assets/{guides.server-ZWFKX2XJ.js → guides.server-DJjQuy03.js} +1 -1
- package/studio-dist/server/assets/highlighted-body-JLMTFACH-BeHllu-r.js +41 -0
- package/studio-dist/server/assets/{markdown-view-Bmjghg_Z.js → markdown-view-CvVBGMZV.js} +1 -1
- package/studio-dist/server/assets/mcp-BU0fLYyJ.js +1103 -0
- package/studio-dist/server/assets/mcp-manager-D9YctTQe.js +50 -0
- package/studio-dist/server/assets/mermaid-WFAXDIZX-B1yDN6vG.js +1 -0
- package/studio-dist/server/assets/{panel-DvRjyil3.js → panel-D1K6Bsux.js} +4 -32
- package/studio-dist/server/assets/{plugins._service._view-B32LzraG.js → plugins._service._view-DdO1nELF.js} +4 -4
- package/studio-dist/server/assets/{prepaint-BEHwKl51.js → prepaint-BB3dwSmz.js} +1 -1
- package/studio-dist/server/assets/{queries-D6Vq0AuZ.js → queries-BwiDxQy5.js} +1 -1
- package/studio-dist/server/assets/{react-CiBZPDs8.js → react-B2cLiz-i.js} +1 -1
- package/studio-dist/server/assets/{reports-Dn92pLap.js → reports-9Pr7Bz6o.js} +7 -7
- package/studio-dist/server/assets/{reports-DDaH5k0H.js → reports-Cc9M3phM.js} +1 -1
- package/studio-dist/server/assets/{router-Bjf4S9tO.js → router-DcWe0J7Y.js} +827 -548
- package/studio-dist/server/assets/{routes-B4sNiE0X.js → routes-BEXxl0py.js} +8 -8
- package/studio-dist/server/assets/{search-DKeJRvg8.js → search-bltT7gwy.js} +39 -7
- package/studio-dist/server/assets/{select-CVHYL7oR.js → select-CZvHgGCi.js} +7 -6
- package/studio-dist/server/assets/{shell-BxbYYaAk.js → shell-BQ0vMKXN.js} +13 -4
- package/studio-dist/server/assets/{skills-Bj8eOgzR.js → skills-Be_52h0i.js} +1 -1
- package/studio-dist/server/assets/{skills-B4-0qpqN.js → skills-BpGGUl6L.js} +8 -8
- package/studio-dist/server/assets/{specs-rfMug6qW.js → specs-CCGgXE-V.js} +5 -5
- package/studio-dist/server/assets/{specs-view-qi1SE1Sl.js → specs-view-DtL5JxYM.js} +12 -11
- package/studio-dist/server/assets/{steps-rger6HJc.js → steps-BWFSO6dM.js} +1 -1
- package/studio-dist/server/assets/{store-Dg9T7oWs.js → store-X7yLPp7v.js} +1 -1
- package/studio-dist/server/assets/{studio-queries-CeFfmIuM.js → studio-queries-ur1ygXi3.js} +117 -13
- package/studio-dist/server/assets/{studio-D79JzDLc.js → studio-qzH-UETC.js} +209 -180
- package/studio-dist/server/assets/{usage-Dw_UQFX-.js → usage-C1o0DLzS.js} +1 -1
- package/studio-dist/server/assets/{usage-BJgYWRCX.js → usage-DWbSPrPD.js} +10 -9
- package/studio-dist/server/assets/{useAnchoredPopupScrollLock-ciS_sEq3.js → useAnchoredPopupScrollLock-DLDmv6kM.js} +4 -135
- package/studio-dist/server/assets/useBlocker-CQtANHK8.js +111 -0
- package/studio-dist/server/assets/{useMutation-DnWK0PhO.js → useMutation-NjlA8oFY.js} +2 -2
- package/studio-dist/server/assets/useOpenInteractionType-CZYscfOb.js +136 -0
- package/studio-dist/server/assets/usePopupHandleStore-DEEXJYv0.js +26 -0
- package/studio-dist/server/assets/{vault-BzarssiL.js → vault-B_kfi1h-.js} +1 -1
- package/studio-dist/server/assets/{vault-CvlrLd2H.js → vault-dL79JlKH.js} +8 -115
- package/studio-dist/server/assets/{views-CAxwKHMK.js → views-BSGH56lb.js} +3 -3
- package/studio-dist/server/assets/{warnings-BpVCugHm.js → warnings-DtUVPV-k.js} +2 -2
- package/studio-dist/server/assets/work-D789VXGH.js +110 -0
- package/studio-dist/server/assets/work-DsCEfhmK.js +3817 -0
- package/studio-dist/server/assets/work-requests-BLhOmQFO.js +11 -0
- package/studio-dist/server/assets/{workflow-BdrzcCt8.js → workflow-BOZ2sRYg.js} +9 -9
- package/studio-dist/server/server.js +3 -3
- package/wrappers/bin/openspec +87 -2
- package/studio-dist/client/assets/app-ggXJ_QVh.css +0 -2
- package/studio-dist/client/assets/button-C9SQW3kI.js +0 -1
- package/studio-dist/client/assets/cn-DC80MJV0.js +0 -1
- package/studio-dist/client/assets/combobox-D7mKYCBb.js +0 -1
- package/studio-dist/client/assets/fields-CEep8IFT.js +0 -1
- package/studio-dist/client/assets/friction-D9dBU7WN.js +0 -1
- package/studio-dist/client/assets/getting-started-BDyGvHhc.js +0 -1
- package/studio-dist/client/assets/getting-started._topic-B9ajbF4o.js +0 -1
- package/studio-dist/client/assets/getting-started.index-CYiBPtb7.js +0 -1
- package/studio-dist/client/assets/graph-ah7ZXfTa.js +0 -2
- package/studio-dist/client/assets/guides-CsL0660B.js +0 -1
- package/studio-dist/client/assets/index-zmRH87D4.js +0 -40
- package/studio-dist/client/assets/panel-COgk0vP5.js +0 -1
- package/studio-dist/client/assets/plugins._service._view-Cn3WBHab.js +0 -1
- package/studio-dist/client/assets/reports-C_AqLBYH.js +0 -1
- package/studio-dist/client/assets/routes-BokQmHtC.js +0 -1
- package/studio-dist/client/assets/search-DxidNK2M.js +0 -1
- package/studio-dist/client/assets/select-CYFCbHUd.js +0 -1
- package/studio-dist/client/assets/skills-R3vttWHM.js +0 -1
- package/studio-dist/client/assets/specs-view-znqFPx9p.js +0 -1
- package/studio-dist/client/assets/steps-tVDWn7j6.js +0 -1
- package/studio-dist/client/assets/studio-ndtFcS2Y.js +0 -100
- package/studio-dist/client/assets/studio-queries-CkUSByy7.js +0 -2
- package/studio-dist/client/assets/usage-Kuhr8dSl.js +0 -55
- package/studio-dist/client/assets/useAnchoredPopupScrollLock-dc_kP4Go.js +0 -1
- package/studio-dist/client/assets/useMutation-CqtM9COw.js +0 -1
- package/studio-dist/client/assets/vault-CSP8kwRg.js +0 -1
- package/studio-dist/client/assets/workflow-BPJAmmZi.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
|
-
|
|
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
|
+
}
|
|
@@ -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
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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);
|
|
@@ -11,7 +11,7 @@ import path from "node:path";
|
|
|
11
11
|
*/
|
|
12
12
|
export async function writeAtomic(
|
|
13
13
|
target: string,
|
|
14
|
-
contents: string |
|
|
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 |
|
|
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,
|
|
@@ -230,12 +262,24 @@ export {
|
|
|
230
262
|
type McpManagerPatch,
|
|
231
263
|
type McpManagerSnapshot,
|
|
232
264
|
} from "./lib/mcp-manager/store";
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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,
|
|
241
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
|
|
|
@@ -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
|
|
166
|
-
- `
|
|
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
|
|
85
|
-
modified tracked files: tell the user to commit or stash them and submit again.
|
|
86
|
-
|
|
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,
|
|
@@ -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
|
|
166
|
-
- `
|
|
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
|
|
85
|
-
modified tracked files: tell the user to commit or stash them and submit again.
|
|
86
|
-
|
|
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,
|