opencode-swarm 7.145.1 → 7.145.2
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/.opencode/skills/phase-wrap/SKILL.md +3 -2
- package/README.md +5 -1
- package/dist/cli/{config-doctor-96jmxr7s.js → config-doctor-j1r33f4q.js} +3 -3
- package/dist/cli/{core-w78pc1hh.js → core-c2zrd384.js} +2 -2
- package/dist/cli/{curation-policy-smyc2mrm.js → curation-policy-xv0j8zyt.js} +6 -6
- package/dist/cli/{curator-59hzdxrv.js → curator-gk2kmrk1.js} +28 -28
- package/dist/cli/{curator-llm-factory-g794pv51.js → curator-llm-factory-sat3mn5n.js} +28 -28
- package/dist/cli/{evidence-summary-service-41m0cna6.js → evidence-summary-service-0mhx0t0v.js} +12 -12
- package/dist/cli/{gate-evidence-7aywx7qa.js → gate-evidence-a5adh55x.js} +7 -7
- package/dist/cli/{guardrail-explain-j88dhm6w.js → guardrail-explain-r50fery8.js} +29 -29
- package/dist/cli/{guardrail-log-xcb3ke8s.js → guardrail-log-p69eys6d.js} +4 -4
- package/dist/cli/{hive-promoter-nnnx5692.js → hive-promoter-ay8a7sct.js} +28 -28
- package/dist/cli/{index-34tawmyx.js → index-0a0asz2s.js} +1 -1
- package/dist/cli/{index-ymyke19q.js → index-1g87esfp.js} +2 -2
- package/dist/cli/{index-17e73wac.js → index-2vefr1f8.js} +1 -1
- package/dist/cli/{index-2qrd8mfa.js → index-4p3qfb05.js} +1 -1
- package/dist/cli/{index-gey2257h.js → index-5e5a1y2r.js} +1 -1
- package/dist/cli/{index-tw8ck794.js → index-612rr70a.js} +2 -2
- package/dist/cli/{index-cqfp05jb.js → index-673axbjx.js} +3 -3
- package/dist/cli/{index-qpke2x5h.js → index-6wf75rcm.js} +6 -6
- package/dist/cli/{index-tm0bezd9.js → index-7y5akvc9.js} +1 -1
- package/dist/cli/{index-xz4x17z0.js → index-9080b3de.js} +30 -30
- package/dist/cli/{index-kxzgnz2h.js → index-917z76qr.js} +14 -7
- package/dist/cli/{index-rtkttser.js → index-97psh79d.js} +1 -1
- package/dist/cli/{index-b7ntt9cw.js → index-9gt8g2qj.js} +4 -4
- package/dist/cli/{index-19v4tccw.js → index-b9kxxd6k.js} +2 -2
- package/dist/cli/{index-gf03198s.js → index-bghwrr59.js} +1 -1
- package/dist/cli/{index-bst6epnr.js → index-cb2qtetk.js} +445 -82
- package/dist/cli/{index-v3y3qg48.js → index-cpg98bh1.js} +17 -1
- package/dist/cli/{index-ff66fbjt.js → index-cxn95n7q.js} +177 -29
- package/dist/cli/{index-neh8azwc.js → index-czde45km.js} +3 -3
- package/dist/cli/{index-7axx11dt.js → index-gpnv14kq.js} +2 -2
- package/dist/cli/{index-mpf01swm.js → index-j20fzn0w.js} +2 -2
- package/dist/cli/{index-mrkgxfeh.js → index-jgb7mq2y.js} +4 -4
- package/dist/cli/{index-8ef23wex.js → index-jpppcckq.js} +4 -4
- package/dist/cli/{index-4evasm2b.js → index-kggqpefz.js} +5 -5
- package/dist/cli/{index-41t3hgaa.js → index-n55a28zr.js} +247 -29
- package/dist/cli/{index-sfemjcb8.js → index-ncfjxz9n.js} +5 -5
- package/dist/cli/{index-evpgszmp.js → index-np4ytvvv.js} +2 -2
- package/dist/cli/{index-fwnhh6s7.js → index-nsr5b69r.js} +2 -2
- package/dist/cli/{index-dppzthm9.js → index-qyvjp0bq.js} +2 -2
- package/dist/cli/{index-zpp507z0.js → index-rk80jhef.js} +2 -2
- package/dist/cli/{index-90w06fqr.js → index-vav705md.js} +4 -4
- package/dist/cli/{index-dzan8czb.js → index-x8pm918t.js} +1 -1
- package/dist/cli/index.js +28 -28
- package/dist/cli/{knowledge-escalator-s6acdpwj.js → knowledge-escalator-22apj3dj.js} +12 -12
- package/dist/cli/{knowledge-events-jprkz49t.js → knowledge-events-bx8xba9z.js} +10 -10
- package/dist/cli/{knowledge-link-zvtmj756.js → knowledge-link-82ew2yc4.js} +5 -5
- package/dist/cli/{knowledge-store-mc4awds4.js → knowledge-store-nc71kfsg.js} +6 -6
- package/dist/cli/{knowledge-validator-pe4ncrvj.js → knowledge-validator-g8ne80v6.js} +8 -8
- package/dist/cli/{model-preflight-77dwxfv5.js → model-preflight-7ea00h34.js} +1 -1
- package/dist/cli/{pending-delegations-epzht3d7.js → pending-delegations-kkrczqv7.js} +3 -3
- package/dist/cli/{pr-subscriptions-2ahy8g87.js → pr-subscriptions-2xn238xt.js} +3 -3
- package/dist/cli/{runner-ra9pjhp2.js → runner-pqsf809k.js} +6 -6
- package/dist/cli/{scan-cursor-hdzhqwzj.js → scan-cursor-6ksgv514.js} +7 -7
- package/dist/cli/{schema-pg85z06v.js → schema-mpcm7nje.js} +2 -2
- package/dist/cli/{scope-persistence-v8we8ja7.js → scope-persistence-mj1w3hqw.js} +8 -8
- package/dist/cli/{skill-generator-ctskfct2.js → skill-generator-gsa6qwwt.js} +14 -14
- package/dist/cli/{telemetry-c21dgffc.js → telemetry-t109dhv7.js} +1 -1
- package/dist/cli/{worktree-collision-ownership-f7se4wbf.js → worktree-collision-ownership-2jtg2my1.js} +3 -3
- package/dist/cli/{worktree-isolation-j4qb7mgb.js → worktree-isolation-ajzyp2gm.js} +28 -28
- package/dist/config/schema.d.ts +2 -2
- package/dist/evidence/task-gate-repair.d.ts +26 -0
- package/dist/evidence/task-gate-requirements.d.ts +20 -0
- package/dist/gate-evidence.d.ts +7 -0
- package/dist/hooks/knowledge-receipt-ledger-storage.d.ts +2 -0
- package/dist/hooks/knowledge-receipt-ledger.d.ts +72 -3
- package/dist/hooks/knowledge-receipt-observability.d.ts +1 -1
- package/dist/hooks/phase-complete-directive-gate.d.ts +9 -0
- package/dist/index.js +455 -449
- package/dist/plan/manager.d.ts +8 -0
- package/dist/review/diff-source.d.ts +30 -0
- package/dist/review/engine.d.ts +1 -0
- package/dist/review/evidence.d.ts +16 -2
- package/dist/review/phase-runner.d.ts +1 -0
- package/dist/tools/completion-verify.d.ts +2 -0
- package/dist/tools/convene-council.d.ts +1 -1
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/manifest.d.ts +4 -0
- package/dist/tools/phase-complete/gates/final-review-gate.d.ts +3 -3
- package/dist/tools/phase-complete/gates/types.d.ts +2 -2
- package/dist/tools/phase-complete/preflight-report.d.ts +66 -0
- package/dist/tools/phase-complete/snapshot-identity.d.ts +1 -0
- package/dist/tools/phase-complete.d.ts +66 -3
- package/dist/tools/record-directive-override.d.ts +14 -0
- package/dist/tools/repair-gate-evidence.d.ts +6 -0
- package/dist/tools/repair-knowledge-receipt-ledger.d.ts +27 -0
- package/dist/tools/run-phase-review.d.ts +37 -0
- package/dist/tools/submit-phase-council-verdicts.d.ts +1 -1
- package/dist/tools/tool-metadata.d.ts +32 -16
- package/dist/tools/write-final-council-evidence.d.ts +1 -1
- package/dist/tools/write-retro.d.ts +2 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
autoCommitDirty,
|
|
4
4
|
cleanUntrackedFiles
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-rk80jhef.js";
|
|
6
6
|
import {
|
|
7
7
|
isPathWithinDeclaredScope,
|
|
8
8
|
unsafePathTextReason
|
|
@@ -26,10 +26,13 @@ import {
|
|
|
26
26
|
atomicWriteFile,
|
|
27
27
|
taskEvidencePath,
|
|
28
28
|
withTaskEvidenceLock
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-j20fzn0w.js";
|
|
30
|
+
import {
|
|
31
|
+
assertProjectRoot
|
|
32
|
+
} from "./index-bghwrr59.js";
|
|
30
33
|
import {
|
|
31
34
|
telemetry
|
|
32
|
-
} from "./index-
|
|
35
|
+
} from "./index-qyvjp0bq.js";
|
|
33
36
|
import {
|
|
34
37
|
exports_external,
|
|
35
38
|
init_zod
|
|
@@ -40,8 +43,214 @@ import {
|
|
|
40
43
|
|
|
41
44
|
// src/gate-evidence.ts
|
|
42
45
|
init_zod();
|
|
43
|
-
import { mkdirSync as
|
|
44
|
-
import * as
|
|
46
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync3, realpathSync as realpathSync2 } from "fs";
|
|
47
|
+
import * as path3 from "path";
|
|
48
|
+
|
|
49
|
+
// src/evidence/task-gate-requirements.ts
|
|
50
|
+
init_zod();
|
|
51
|
+
import { createHash } from "crypto";
|
|
52
|
+
import * as fs from "fs";
|
|
53
|
+
import * as path from "path";
|
|
54
|
+
var MAX_TASK_GATE_REQUIREMENTS_BYTES = 256 * 1024;
|
|
55
|
+
var TaskGateRequirementsReceiptSchema = exports_external.object({
|
|
56
|
+
schemaVersion: exports_external.literal(1),
|
|
57
|
+
taskId: exports_external.string().min(1).max(120),
|
|
58
|
+
generation: exports_external.number().int().min(0),
|
|
59
|
+
normalizedRole: exports_external.string().min(1).max(120),
|
|
60
|
+
testEngineerExempt: exports_external.boolean().nullable(),
|
|
61
|
+
requiredGates: exports_external.array(exports_external.string()).min(1).max(16),
|
|
62
|
+
sourceEvent: exports_external.string().min(1).max(120),
|
|
63
|
+
sourceTransitionId: exports_external.string().min(1).max(200).nullable(),
|
|
64
|
+
recordedAt: exports_external.string().min(1).max(128),
|
|
65
|
+
previousChainHash: exports_external.string().regex(/^[a-f0-9]{64}$/).nullable(),
|
|
66
|
+
chainHash: exports_external.string().regex(/^[a-f0-9]{64}$/)
|
|
67
|
+
}).strict();
|
|
68
|
+
function samePath(left, right) {
|
|
69
|
+
const normalize = (value) => process.platform === "win32" ? path.resolve(value).toLowerCase() : path.resolve(value);
|
|
70
|
+
return normalize(left) === normalize(right);
|
|
71
|
+
}
|
|
72
|
+
function assertSafeRequirementsParent(directory, create) {
|
|
73
|
+
assertProjectRoot(directory, undefined, "task gate requirements");
|
|
74
|
+
const rootStat = fs.lstatSync(directory);
|
|
75
|
+
if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {
|
|
76
|
+
throw new Error("TASK_GATE_REQUIREMENTS_UNREADABLE: project root is not a regular directory");
|
|
77
|
+
}
|
|
78
|
+
const canonicalRoot = fs.realpathSync(directory);
|
|
79
|
+
const segments = [".swarm", "evidence", "task-gate-requirements"];
|
|
80
|
+
let current = canonicalRoot;
|
|
81
|
+
for (const segment of segments) {
|
|
82
|
+
current = path.join(current, segment);
|
|
83
|
+
let info;
|
|
84
|
+
try {
|
|
85
|
+
info = fs.lstatSync(current);
|
|
86
|
+
} catch (error) {
|
|
87
|
+
if (error.code === "ENOENT") {
|
|
88
|
+
if (!create)
|
|
89
|
+
return current;
|
|
90
|
+
try {
|
|
91
|
+
fs.mkdirSync(current);
|
|
92
|
+
} catch (mkdirError) {
|
|
93
|
+
if (mkdirError.code !== "EEXIST") {
|
|
94
|
+
throw mkdirError;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
info = fs.lstatSync(current);
|
|
98
|
+
} else {
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (info.isSymbolicLink() || !info.isDirectory()) {
|
|
103
|
+
throw new Error("TASK_GATE_REQUIREMENTS_UNREADABLE: receipt parent is redirected or not a directory");
|
|
104
|
+
}
|
|
105
|
+
const canonicalCurrent = fs.realpathSync(current);
|
|
106
|
+
if (!samePath(canonicalCurrent, current)) {
|
|
107
|
+
throw new Error("TASK_GATE_REQUIREMENTS_UNREADABLE: receipt parent escaped the project root");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return current;
|
|
111
|
+
}
|
|
112
|
+
function safeTaskGateRequirementsReceiptPath(directory, taskId, createParent) {
|
|
113
|
+
const parent = assertSafeRequirementsParent(directory, createParent);
|
|
114
|
+
return path.join(parent, `${taskId}.jsonl`);
|
|
115
|
+
}
|
|
116
|
+
function sha256(value) {
|
|
117
|
+
return createHash("sha256").update(value).digest("hex");
|
|
118
|
+
}
|
|
119
|
+
function canonicalReceiptPayload(receipt) {
|
|
120
|
+
return JSON.stringify({
|
|
121
|
+
...receipt,
|
|
122
|
+
requiredGates: [...receipt.requiredGates]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function computeChainHash(receipt) {
|
|
126
|
+
return sha256(canonicalReceiptPayload(receipt));
|
|
127
|
+
}
|
|
128
|
+
function readBoundedTextFile(filePath) {
|
|
129
|
+
let pathStat;
|
|
130
|
+
try {
|
|
131
|
+
pathStat = fs.lstatSync(filePath);
|
|
132
|
+
} catch (error) {
|
|
133
|
+
if (error.code === "ENOENT")
|
|
134
|
+
return null;
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
if (pathStat.isSymbolicLink() || !pathStat.isFile()) {
|
|
138
|
+
throw new Error("TASK_GATE_REQUIREMENTS_UNREADABLE: receipt path is not a regular file");
|
|
139
|
+
}
|
|
140
|
+
if (pathStat.size > MAX_TASK_GATE_REQUIREMENTS_BYTES) {
|
|
141
|
+
throw new Error(`TASK_GATE_REQUIREMENTS_OVERSIZED: ${pathStat.size} bytes exceeds ${MAX_TASK_GATE_REQUIREMENTS_BYTES}`);
|
|
142
|
+
}
|
|
143
|
+
const descriptor = fs.openSync(filePath, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW ?? 0));
|
|
144
|
+
try {
|
|
145
|
+
const openedStat = fs.fstatSync(descriptor);
|
|
146
|
+
if (!openedStat.isFile() || openedStat.dev !== pathStat.dev || openedStat.ino !== pathStat.ino) {
|
|
147
|
+
throw new Error("TASK_GATE_REQUIREMENTS_UNREADABLE: receipt changed while being opened");
|
|
148
|
+
}
|
|
149
|
+
if (openedStat.size > MAX_TASK_GATE_REQUIREMENTS_BYTES) {
|
|
150
|
+
throw new Error(`TASK_GATE_REQUIREMENTS_OVERSIZED: ${openedStat.size} bytes exceeds ${MAX_TASK_GATE_REQUIREMENTS_BYTES}`);
|
|
151
|
+
}
|
|
152
|
+
return fs.readFileSync(descriptor, "utf-8");
|
|
153
|
+
} finally {
|
|
154
|
+
fs.closeSync(descriptor);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async function readTaskGateRequirementsReceipts(directory, taskId) {
|
|
158
|
+
const filePath = safeTaskGateRequirementsReceiptPath(directory, taskId, false);
|
|
159
|
+
const text = readBoundedTextFile(filePath);
|
|
160
|
+
if (text === null)
|
|
161
|
+
return [];
|
|
162
|
+
const receipts = [];
|
|
163
|
+
for (const line of text.split(`
|
|
164
|
+
`)) {
|
|
165
|
+
if (!line.trim())
|
|
166
|
+
continue;
|
|
167
|
+
const parsed = TaskGateRequirementsReceiptSchema.parse(JSON.parse(line));
|
|
168
|
+
if (parsed.taskId !== taskId) {
|
|
169
|
+
throw new Error(`TASK_GATE_REQUIREMENTS_IDENTITY_MISMATCH: expected ${taskId}, found ${parsed.taskId}`);
|
|
170
|
+
}
|
|
171
|
+
const { chainHash, ...withoutChainHash } = parsed;
|
|
172
|
+
const expectedHash = computeChainHash(withoutChainHash);
|
|
173
|
+
if (expectedHash !== chainHash) {
|
|
174
|
+
throw new Error(`TASK_GATE_REQUIREMENTS_CHAIN_MISMATCH: receipt for ${taskId} failed hash validation`);
|
|
175
|
+
}
|
|
176
|
+
const previousChainHash = receipts.at(-1)?.chainHash ?? null;
|
|
177
|
+
if (parsed.previousChainHash !== previousChainHash) {
|
|
178
|
+
throw new Error(`TASK_GATE_REQUIREMENTS_CHAIN_MISMATCH: receipt for ${taskId} failed linkage validation`);
|
|
179
|
+
}
|
|
180
|
+
receipts.push(parsed);
|
|
181
|
+
}
|
|
182
|
+
return receipts;
|
|
183
|
+
}
|
|
184
|
+
function deriveReceiptRole(event) {
|
|
185
|
+
switch (event.type) {
|
|
186
|
+
case "accepted_mutation":
|
|
187
|
+
case "dispatch_attempted":
|
|
188
|
+
case "dispatch_no_mutation":
|
|
189
|
+
if (typeof event.agentType === "string" && event.agentType.trim().length > 0) {
|
|
190
|
+
return {
|
|
191
|
+
normalizedRole: event.agentType.trim(),
|
|
192
|
+
testEngineerExempt: event.agentType === "coder" ? event.context?.testEngineerExempt === true : null
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
case "stage_b_completed":
|
|
197
|
+
case "gate_recorded":
|
|
198
|
+
return {
|
|
199
|
+
normalizedRole: event.gate,
|
|
200
|
+
testEngineerExempt: null
|
|
201
|
+
};
|
|
202
|
+
default:
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function shouldAppendReceipt(current, next, role) {
|
|
207
|
+
if (next.required_gates.length === 0)
|
|
208
|
+
return false;
|
|
209
|
+
const currentGeneration = current?.workflow?.generation ?? -1;
|
|
210
|
+
const nextGeneration = next.workflow?.generation ?? -1;
|
|
211
|
+
if (current === null)
|
|
212
|
+
return true;
|
|
213
|
+
if (JSON.stringify(current.required_gates) !== JSON.stringify(next.required_gates)) {
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
if ((current.test_engineer_exempt ?? null) !== role.testEngineerExempt) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
return currentGeneration !== nextGeneration;
|
|
220
|
+
}
|
|
221
|
+
async function appendTaskGateRequirementsReceiptIfNeeded(directory, taskId, current, next, event) {
|
|
222
|
+
const role = deriveReceiptRole(event);
|
|
223
|
+
if (!role || !shouldAppendReceipt(current, next, role))
|
|
224
|
+
return;
|
|
225
|
+
const filePath = safeTaskGateRequirementsReceiptPath(directory, taskId, true);
|
|
226
|
+
const receipts = await readTaskGateRequirementsReceipts(directory, taskId);
|
|
227
|
+
const latest = receipts.at(-1);
|
|
228
|
+
const baseReceipt = {
|
|
229
|
+
schemaVersion: 1,
|
|
230
|
+
taskId,
|
|
231
|
+
generation: next.workflow?.generation ?? 0,
|
|
232
|
+
normalizedRole: role.normalizedRole,
|
|
233
|
+
testEngineerExempt: role.testEngineerExempt,
|
|
234
|
+
requiredGates: [...next.required_gates],
|
|
235
|
+
sourceEvent: event.type,
|
|
236
|
+
sourceTransitionId: event.transitionId ?? null,
|
|
237
|
+
recordedAt: new Date().toISOString(),
|
|
238
|
+
previousChainHash: latest?.chainHash ?? null
|
|
239
|
+
};
|
|
240
|
+
const receipt = {
|
|
241
|
+
...baseReceipt,
|
|
242
|
+
chainHash: computeChainHash(baseReceipt)
|
|
243
|
+
};
|
|
244
|
+
if (latest && latest.generation === receipt.generation && latest.normalizedRole === receipt.normalizedRole && latest.testEngineerExempt === receipt.testEngineerExempt && JSON.stringify(latest.requiredGates) === JSON.stringify(receipt.requiredGates) && latest.sourceTransitionId === receipt.sourceTransitionId) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const lines = [...receipts, receipt].map((entry) => JSON.stringify(entry));
|
|
248
|
+
assertSafeRequirementsParent(directory, false);
|
|
249
|
+
await atomicWriteFile(filePath, `${lines.join(`
|
|
250
|
+
`)}
|
|
251
|
+
`);
|
|
252
|
+
assertSafeRequirementsParent(directory, false);
|
|
253
|
+
}
|
|
45
254
|
|
|
46
255
|
// src/validation/task-id.ts
|
|
47
256
|
var STRICT_TASK_ID_PATTERN = /^\d+\.\d+(\.\d+)*$/;
|
|
@@ -90,7 +299,7 @@ function sanitizeTaskId(taskId) {
|
|
|
90
299
|
}
|
|
91
300
|
|
|
92
301
|
// src/workflow/workflow-wal-file.ts
|
|
93
|
-
import * as
|
|
302
|
+
import * as fs3 from "fs";
|
|
94
303
|
import { mkdir, open } from "fs/promises";
|
|
95
304
|
import { dirname } from "path";
|
|
96
305
|
|
|
@@ -98,11 +307,11 @@ import { dirname } from "path";
|
|
|
98
307
|
init_warning_buffer();
|
|
99
308
|
|
|
100
309
|
// src/turbo/lean/recovery.ts
|
|
101
|
-
import * as
|
|
102
|
-
import * as
|
|
310
|
+
import * as fs2 from "fs";
|
|
311
|
+
import * as path2 from "path";
|
|
103
312
|
var RECOVERY_DIR_NAME = "recovery";
|
|
104
313
|
function recoveryDir(directory) {
|
|
105
|
-
return
|
|
314
|
+
return path2.join(directory, ".swarm", RECOVERY_DIR_NAME);
|
|
106
315
|
}
|
|
107
316
|
function isRecoveryRecord(value) {
|
|
108
317
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -116,11 +325,11 @@ function readRecoveryRecords(directory) {
|
|
|
116
325
|
const dir = recoveryDir(directory);
|
|
117
326
|
let entries;
|
|
118
327
|
try {
|
|
119
|
-
entries =
|
|
328
|
+
entries = fs2.readdirSync(dir, { withFileTypes: true });
|
|
120
329
|
} catch {
|
|
121
330
|
return {
|
|
122
331
|
records: [],
|
|
123
|
-
errored:
|
|
332
|
+
errored: fs2.existsSync(dir)
|
|
124
333
|
};
|
|
125
334
|
}
|
|
126
335
|
const records = [];
|
|
@@ -128,9 +337,9 @@ function readRecoveryRecords(directory) {
|
|
|
128
337
|
for (const entry of entries) {
|
|
129
338
|
if (!entry.isFile() || !entry.name.endsWith(".json"))
|
|
130
339
|
continue;
|
|
131
|
-
const full =
|
|
340
|
+
const full = path2.join(dir, entry.name);
|
|
132
341
|
try {
|
|
133
|
-
const parsed = JSON.parse(
|
|
342
|
+
const parsed = JSON.parse(fs2.readFileSync(full, "utf-8"));
|
|
134
343
|
if (isRecoveryRecord(parsed)) {
|
|
135
344
|
records.push(parsed);
|
|
136
345
|
} else {
|
|
@@ -189,7 +398,7 @@ init_git_executable();
|
|
|
189
398
|
var _internals = {
|
|
190
399
|
bunSpawn,
|
|
191
400
|
platform: process.platform,
|
|
192
|
-
sleep: (ms) => new Promise((
|
|
401
|
+
sleep: (ms) => new Promise((resolve2) => setTimeout(resolve2, ms)),
|
|
193
402
|
cleanupOrphanedBranches,
|
|
194
403
|
startupOrphanRecovery,
|
|
195
404
|
extractSessionId,
|
|
@@ -763,9 +972,9 @@ var SMALL_WORKFLOW_WAL_MAX_BYTES = 1024 * 1024;
|
|
|
763
972
|
var CHUNK_BYTES = 64 * 1024;
|
|
764
973
|
var _internals2 = {
|
|
765
974
|
openFile: open,
|
|
766
|
-
openFileSync:
|
|
767
|
-
readFileSync:
|
|
768
|
-
closeFileSync:
|
|
975
|
+
openFileSync: fs3.openSync,
|
|
976
|
+
readFileSync: fs3.readSync,
|
|
977
|
+
closeFileSync: fs3.closeSync
|
|
769
978
|
};
|
|
770
979
|
function maxBytesFor(kind) {
|
|
771
980
|
return kind === "coder-settlement" ? CODER_SETTLEMENT_MAX_BYTES : SMALL_WORKFLOW_WAL_MAX_BYTES;
|
|
@@ -1017,8 +1226,14 @@ var TaskEvidenceSchema = exports_external.object({
|
|
|
1017
1226
|
required_gates: exports_external.array(exports_external.string()).default([]),
|
|
1018
1227
|
gates: exports_external.record(exports_external.string(), GateEvidenceSchema),
|
|
1019
1228
|
turbo: exports_external.boolean().optional(),
|
|
1229
|
+
requirements_state: exports_external.enum(["known", "unknown"]).optional(),
|
|
1020
1230
|
test_engineer_exempt: exports_external.boolean().optional(),
|
|
1021
|
-
workflow: TaskWorkflowMetadataSchema.optional()
|
|
1231
|
+
workflow: TaskWorkflowMetadataSchema.optional(),
|
|
1232
|
+
repair_provenance: exports_external.object({
|
|
1233
|
+
source_sha256: exports_external.string().regex(/^[a-f0-9]{64}$/).nullable(),
|
|
1234
|
+
source_generation: exports_external.number().int().min(0).nullable(),
|
|
1235
|
+
requirements_receipt_hash: exports_external.string().regex(/^[a-f0-9]{64}$/).nullable()
|
|
1236
|
+
}).optional()
|
|
1022
1237
|
});
|
|
1023
1238
|
function parseTaskEvidence(raw, expectedTaskId) {
|
|
1024
1239
|
const parsed = TaskEvidenceSchema.parse(JSON.parse(raw));
|
|
@@ -1259,18 +1474,18 @@ function reduceTaskWorkflowSnapshot(current, event, context) {
|
|
|
1259
1474
|
}
|
|
1260
1475
|
}
|
|
1261
1476
|
function getEvidenceDir(directory) {
|
|
1262
|
-
const swarmDir =
|
|
1263
|
-
const evidenceDir =
|
|
1264
|
-
|
|
1477
|
+
const swarmDir = path3.resolve(directory, ".swarm");
|
|
1478
|
+
const evidenceDir = path3.join(swarmDir, "evidence");
|
|
1479
|
+
mkdirSync3(evidenceDir, { recursive: true });
|
|
1265
1480
|
let resolvedSwarmDir;
|
|
1266
1481
|
let resolvedEvidenceDir;
|
|
1267
1482
|
try {
|
|
1268
|
-
resolvedSwarmDir =
|
|
1269
|
-
resolvedEvidenceDir =
|
|
1483
|
+
resolvedSwarmDir = path3.normalize(realpathSync2(swarmDir));
|
|
1484
|
+
resolvedEvidenceDir = path3.normalize(realpathSync2(evidenceDir));
|
|
1270
1485
|
} catch (error) {
|
|
1271
1486
|
throw new Error(`Unable to resolve evidence directory: ${error.message}`);
|
|
1272
1487
|
}
|
|
1273
|
-
const swarmPrefix = `${resolvedSwarmDir}${
|
|
1488
|
+
const swarmPrefix = `${resolvedSwarmDir}${path3.sep}`;
|
|
1274
1489
|
const withinSwarmBoundary = process.platform === "win32" ? resolvedEvidenceDir.toLowerCase().startsWith(swarmPrefix.toLowerCase()) : resolvedEvidenceDir.startsWith(swarmPrefix);
|
|
1275
1490
|
if (!withinSwarmBoundary) {
|
|
1276
1491
|
throw new Error(`Evidence path escapes .swarm boundary: ${resolvedEvidenceDir}`);
|
|
@@ -1283,7 +1498,7 @@ function getEvidencePath(directory, taskId) {
|
|
|
1283
1498
|
}
|
|
1284
1499
|
function readExisting(evidencePath, taskId) {
|
|
1285
1500
|
try {
|
|
1286
|
-
const raw =
|
|
1501
|
+
const raw = readFileSync3(evidencePath, "utf-8");
|
|
1287
1502
|
return parseTaskEvidence(raw, taskId);
|
|
1288
1503
|
} catch (error) {
|
|
1289
1504
|
if (error.code === "ENOENT")
|
|
@@ -1399,7 +1614,7 @@ async function withTaskEvidenceTransaction(directory, taskId, agent, callback) {
|
|
|
1399
1614
|
assertValidTaskId(taskId);
|
|
1400
1615
|
return withTaskEvidenceLock(directory, taskId, agent, async () => {
|
|
1401
1616
|
const resolvedEvidenceDir = getEvidenceDir(directory);
|
|
1402
|
-
const evidencePath =
|
|
1617
|
+
const evidencePath = path3.join(resolvedEvidenceDir, `${taskId}.json`);
|
|
1403
1618
|
let current = null;
|
|
1404
1619
|
try {
|
|
1405
1620
|
current = readExisting(evidencePath, taskId);
|
|
@@ -1407,12 +1622,15 @@ async function withTaskEvidenceTransaction(directory, taskId, agent, callback) {
|
|
|
1407
1622
|
telemetry.gateParseError(taskId, error);
|
|
1408
1623
|
throw error;
|
|
1409
1624
|
}
|
|
1410
|
-
const persist = async (nextEvidence) => {
|
|
1625
|
+
const persist = async (nextEvidence, event) => {
|
|
1411
1626
|
const validated = TaskEvidenceSchema.parse({
|
|
1412
1627
|
...nextEvidence,
|
|
1413
1628
|
taskId
|
|
1414
1629
|
});
|
|
1415
1630
|
await atomicWriteFile(evidencePath, JSON.stringify(validated, null, 2));
|
|
1631
|
+
if (event) {
|
|
1632
|
+
await appendTaskGateRequirementsReceiptIfNeeded(directory, taskId, current, validated, event);
|
|
1633
|
+
}
|
|
1416
1634
|
current = validated;
|
|
1417
1635
|
return validated;
|
|
1418
1636
|
};
|
|
@@ -1423,7 +1641,7 @@ async function withTaskEvidenceTransaction(directory, taskId, agent, callback) {
|
|
|
1423
1641
|
assertTaskEvidenceWriteAllowed(directory, taskId, event);
|
|
1424
1642
|
const nextEvidence = updateEvidenceForTransition(current, event);
|
|
1425
1643
|
nextEvidence.taskId = taskId;
|
|
1426
|
-
return persist(nextEvidence);
|
|
1644
|
+
return persist(nextEvidence, event);
|
|
1427
1645
|
}
|
|
1428
1646
|
});
|
|
1429
1647
|
});
|
|
@@ -1480,7 +1698,7 @@ function readTaskEvidenceRaw(directory, taskId) {
|
|
|
1480
1698
|
assertValidTaskId(taskId);
|
|
1481
1699
|
const evidencePath = getEvidencePath(directory, taskId);
|
|
1482
1700
|
try {
|
|
1483
|
-
const raw =
|
|
1701
|
+
const raw = readFileSync3(evidencePath, "utf-8");
|
|
1484
1702
|
return parseTaskEvidence(raw, taskId);
|
|
1485
1703
|
} catch (error) {
|
|
1486
1704
|
const code = error.code;
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
resolveSwarmKnowledgePath,
|
|
7
7
|
transactKnowledge,
|
|
8
8
|
wordBigrams
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-6wf75rcm.js";
|
|
10
10
|
import {
|
|
11
11
|
queryHistoricalOutcomes,
|
|
12
12
|
readKnowledgeEvents,
|
|
13
13
|
recordKnowledgeEvent
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-cxn95n7q.js";
|
|
15
15
|
import {
|
|
16
16
|
init_knowledge_types,
|
|
17
17
|
isActiveStatus
|
|
@@ -224,11 +224,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
|
|
|
224
224
|
alreadyInactive: true
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
227
|
+
const { quarantineEntry } = await import("./knowledge-validator-g8ne80v6.js");
|
|
228
228
|
let policyConfig;
|
|
229
229
|
try {
|
|
230
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
231
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
230
|
+
const { KnowledgeConfigSchema } = await import("./schema-mpcm7nje.js");
|
|
231
|
+
const { loadPluginConfigWithMeta } = await import("./index-9gt8g2qj.js");
|
|
232
232
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
233
233
|
policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
234
234
|
} catch {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
readKnowledge,
|
|
4
4
|
transactKnowledge
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-6wf75rcm.js";
|
|
6
6
|
import {
|
|
7
7
|
init_git_executable,
|
|
8
8
|
resolveGitExecutableAsync
|
|
9
9
|
} from "./index-9e6fdz2h.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveKnowledgeStoreDir
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-x8pm918t.js";
|
|
13
13
|
import {
|
|
14
14
|
init_knowledge_types,
|
|
15
15
|
isActiveStatus
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
} from "./index-y8552snf.js";
|
|
10
10
|
import {
|
|
11
11
|
atomicWriteFile
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-j20fzn0w.js";
|
|
13
13
|
import {
|
|
14
14
|
assertProjectRoot,
|
|
15
15
|
withEvidenceLock
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-bghwrr59.js";
|
|
17
17
|
import {
|
|
18
18
|
exports_external,
|
|
19
19
|
init_zod
|
|
@@ -572,7 +572,7 @@ var CATALOG_SOURCE = [
|
|
|
572
572
|
category: "plan",
|
|
573
573
|
severity: "warning",
|
|
574
574
|
privacyClass: "sensitive",
|
|
575
|
-
producer: "src/plan/manager.ts:
|
|
575
|
+
producer: "src/plan/manager.ts:1861",
|
|
576
576
|
consumers: NO_CONSUMERS,
|
|
577
577
|
futureOwnerIssue: ISSUE_SINK,
|
|
578
578
|
retentionOwnerIssue: ISSUE_PLAN_EVIDENCE_RETENTION,
|
|
@@ -626,7 +626,7 @@ var CATALOG_SOURCE = [
|
|
|
626
626
|
category: "knowledge",
|
|
627
627
|
severity: "info",
|
|
628
628
|
privacyClass: "pseudonymous",
|
|
629
|
-
producer: "src/hooks/knowledge-receipt-observability.ts:
|
|
629
|
+
producer: "src/hooks/knowledge-receipt-observability.ts:197",
|
|
630
630
|
consumers: NO_CONSUMERS,
|
|
631
631
|
futureOwnerIssue: ISSUE_SINK,
|
|
632
632
|
retentionOwnerIssue: ISSUE_LIFECYCLE_RETENTION,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SWARM_WORKTREE_DIR_NAME,
|
|
4
4
|
init_constants
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-cpg98bh1.js";
|
|
6
6
|
import {
|
|
7
7
|
init_git_executable,
|
|
8
8
|
resolveGitExecutable
|
|
@@ -92,7 +92,7 @@ var _internals = {
|
|
|
92
92
|
symlinkSync: fs.symlinkSync
|
|
93
93
|
},
|
|
94
94
|
writeScopeToDisk: async (directory, taskId, files) => {
|
|
95
|
-
const { writeScopeToDisk: realWrite } = await import("./scope-persistence-
|
|
95
|
+
const { writeScopeToDisk: realWrite } = await import("./scope-persistence-mj1w3hqw.js");
|
|
96
96
|
return realWrite(directory, taskId, files);
|
|
97
97
|
},
|
|
98
98
|
writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
import {
|
|
3
3
|
computePlanStructureHash,
|
|
4
4
|
derivePlanId
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-673axbjx.js";
|
|
6
6
|
import {
|
|
7
7
|
unsafePathTextReason
|
|
8
8
|
} from "./index-556ja8an.js";
|
|
9
9
|
import {
|
|
10
10
|
PlanSchema
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-2vefr1f8.js";
|
|
12
12
|
import {
|
|
13
13
|
validateSwarmPath
|
|
14
14
|
} from "./index-w8pgjr75.js";
|
|
15
15
|
import {
|
|
16
16
|
atomicWriteSwarmFile,
|
|
17
17
|
atomicWriteSwarmFileSync
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-kggqpefz.js";
|
|
19
19
|
import {
|
|
20
20
|
assertProjectRoot
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-bghwrr59.js";
|
|
22
22
|
import {
|
|
23
23
|
require_proper_lockfile
|
|
24
24
|
} from "./index-7g4c7s5r.js";
|
package/dist/cli/index.js
CHANGED
|
@@ -11,52 +11,52 @@ import {
|
|
|
11
11
|
readCachePackageVersion,
|
|
12
12
|
resolveCommand,
|
|
13
13
|
safeRealpathSync
|
|
14
|
-
} from "./index-
|
|
15
|
-
import"./index-
|
|
16
|
-
import"./index-
|
|
17
|
-
import"./index-
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
14
|
+
} from "./index-cb2qtetk.js";
|
|
15
|
+
import"./index-0a0asz2s.js";
|
|
16
|
+
import"./index-1g87esfp.js";
|
|
17
|
+
import"./index-612rr70a.js";
|
|
18
|
+
import"./index-917z76qr.js";
|
|
19
|
+
import"./index-nsr5b69r.js";
|
|
20
20
|
import"./index-134d35c1.js";
|
|
21
21
|
import"./index-abtrcs16.js";
|
|
22
22
|
import"./index-y8552snf.js";
|
|
23
|
-
import"./index-
|
|
24
|
-
import"./index-
|
|
23
|
+
import"./index-ncfjxz9n.js";
|
|
24
|
+
import"./index-np4ytvvv.js";
|
|
25
25
|
import"./index-70ha9e09.js";
|
|
26
26
|
import"./index-c8s9a3zh.js";
|
|
27
27
|
import"./index-9ss2m4rs.js";
|
|
28
28
|
import"./index-z9yhhk6q.js";
|
|
29
|
-
import"./index-
|
|
30
|
-
import"./index-
|
|
31
|
-
import"./index-
|
|
32
|
-
import"./index-
|
|
29
|
+
import"./index-5e5a1y2r.js";
|
|
30
|
+
import"./index-jgb7mq2y.js";
|
|
31
|
+
import"./index-jpppcckq.js";
|
|
32
|
+
import"./index-4p3qfb05.js";
|
|
33
33
|
import"./index-rtry5xyf.js";
|
|
34
34
|
import"./index-zsrtt42s.js";
|
|
35
|
-
import"./index-
|
|
35
|
+
import"./index-97psh79d.js";
|
|
36
36
|
import"./index-e1pxav9g.js";
|
|
37
|
-
import"./index-
|
|
38
|
-
import"./index-
|
|
39
|
-
import"./index-
|
|
40
|
-
import"./index-
|
|
37
|
+
import"./index-n55a28zr.js";
|
|
38
|
+
import"./index-rk80jhef.js";
|
|
39
|
+
import"./index-vav705md.js";
|
|
40
|
+
import"./index-673axbjx.js";
|
|
41
41
|
import"./index-556ja8an.js";
|
|
42
42
|
import"./index-7sy3aa9m.js";
|
|
43
43
|
import"./index-wx8zdh4a.js";
|
|
44
44
|
import"./index-3g0xk6tk.js";
|
|
45
45
|
import"./index-85gkedsf.js";
|
|
46
|
-
import"./index-
|
|
47
|
-
import"./index-
|
|
48
|
-
import"./index-
|
|
46
|
+
import"./index-6wf75rcm.js";
|
|
47
|
+
import"./index-cxn95n7q.js";
|
|
48
|
+
import"./index-czde45km.js";
|
|
49
49
|
import"./index-gprxjmm7.js";
|
|
50
50
|
import"./index-n832052r.js";
|
|
51
|
-
import"./index-
|
|
51
|
+
import"./index-2vefr1f8.js";
|
|
52
52
|
import {
|
|
53
53
|
init_package,
|
|
54
54
|
package_default
|
|
55
|
-
} from "./index-
|
|
55
|
+
} from "./index-gpnv14kq.js";
|
|
56
56
|
import {
|
|
57
57
|
DEFAULT_AGENT_CONFIGS,
|
|
58
58
|
init_constants
|
|
59
|
-
} from "./index-
|
|
59
|
+
} from "./index-cpg98bh1.js";
|
|
60
60
|
import"./index-9e6fdz2h.js";
|
|
61
61
|
import"./index-4rhhvd1a.js";
|
|
62
62
|
import"./index-w8pgjr75.js";
|
|
@@ -64,12 +64,12 @@ import"./index-z6xqpmqg.js";
|
|
|
64
64
|
import"./index-zj6t9zgx.js";
|
|
65
65
|
import"./index-zjygnfay.js";
|
|
66
66
|
import"./index-ae75rja9.js";
|
|
67
|
-
import"./index-
|
|
68
|
-
import"./index-
|
|
67
|
+
import"./index-x8pm918t.js";
|
|
68
|
+
import"./index-j20fzn0w.js";
|
|
69
69
|
import"./index-bk5tah7q.js";
|
|
70
|
-
import"./index-
|
|
71
|
-
import"./index-
|
|
72
|
-
import"./index-
|
|
70
|
+
import"./index-kggqpefz.js";
|
|
71
|
+
import"./index-bghwrr59.js";
|
|
72
|
+
import"./index-qyvjp0bq.js";
|
|
73
73
|
import"./index-7g4c7s5r.js";
|
|
74
74
|
import"./index-bpmtbmy9.js";
|
|
75
75
|
import"./index-ed5ykebp.js";
|
|
@@ -9,15 +9,15 @@ import {
|
|
|
9
9
|
maybeEscalateOnViolation,
|
|
10
10
|
maybeQuarantineOnContradiction,
|
|
11
11
|
readRecentEscalations
|
|
12
|
-
} from "./index-
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-
|
|
15
|
-
import"./index-
|
|
12
|
+
} from "./index-ncfjxz9n.js";
|
|
13
|
+
import"./index-6wf75rcm.js";
|
|
14
|
+
import"./index-cxn95n7q.js";
|
|
15
|
+
import"./index-czde45km.js";
|
|
16
16
|
import"./index-gprxjmm7.js";
|
|
17
17
|
import"./index-n832052r.js";
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
20
|
-
import"./index-
|
|
18
|
+
import"./index-2vefr1f8.js";
|
|
19
|
+
import"./index-gpnv14kq.js";
|
|
20
|
+
import"./index-cpg98bh1.js";
|
|
21
21
|
import"./index-9e6fdz2h.js";
|
|
22
22
|
import"./index-4rhhvd1a.js";
|
|
23
23
|
import"./index-w8pgjr75.js";
|
|
@@ -25,12 +25,12 @@ import"./index-z6xqpmqg.js";
|
|
|
25
25
|
import"./index-zj6t9zgx.js";
|
|
26
26
|
import"./index-zjygnfay.js";
|
|
27
27
|
import"./index-ae75rja9.js";
|
|
28
|
-
import"./index-
|
|
29
|
-
import"./index-
|
|
28
|
+
import"./index-x8pm918t.js";
|
|
29
|
+
import"./index-j20fzn0w.js";
|
|
30
30
|
import"./index-bk5tah7q.js";
|
|
31
|
-
import"./index-
|
|
32
|
-
import"./index-
|
|
33
|
-
import"./index-
|
|
31
|
+
import"./index-kggqpefz.js";
|
|
32
|
+
import"./index-bghwrr59.js";
|
|
33
|
+
import"./index-qyvjp0bq.js";
|
|
34
34
|
import"./index-7g4c7s5r.js";
|
|
35
35
|
import"./index-bpmtbmy9.js";
|
|
36
36
|
import"./index-ed5ykebp.js";
|