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
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
resolveExecutableFromPath,
|
|
7
7
|
runEvaluation,
|
|
8
8
|
runExternalTool
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-0a0asz2s.js";
|
|
10
10
|
import {
|
|
11
11
|
stableCanonicalStringify
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-1g87esfp.js";
|
|
13
13
|
import {
|
|
14
14
|
detectStraySwarmDirs,
|
|
15
15
|
readDoctorArtifact,
|
|
16
16
|
removeStraySwarmDir,
|
|
17
17
|
runConfigDoctor
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-612rr70a.js";
|
|
19
19
|
import {
|
|
20
20
|
MAX_TRANSIENT_RETRIES,
|
|
21
21
|
archiveEvidence,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
updateTaskStatus,
|
|
61
61
|
validateProjectRoot,
|
|
62
62
|
validateSymlinkBoundary
|
|
63
|
-
} from "./index-
|
|
63
|
+
} from "./index-917z76qr.js";
|
|
64
64
|
import {
|
|
65
65
|
EvaluationTaskV1Schema,
|
|
66
66
|
GateAuditManifestV1Schema,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
saveGateAuditResult,
|
|
78
78
|
savePromotionDecision,
|
|
79
79
|
saveTaskSetSnapshot
|
|
80
|
-
} from "./index-
|
|
80
|
+
} from "./index-nsr5b69r.js";
|
|
81
81
|
import {
|
|
82
82
|
loadDatabaseCtor
|
|
83
83
|
} from "./index-134d35c1.js";
|
|
@@ -103,12 +103,12 @@ import {
|
|
|
103
103
|
} from "./index-y8552snf.js";
|
|
104
104
|
import {
|
|
105
105
|
readRecentEscalations
|
|
106
|
-
} from "./index-
|
|
106
|
+
} from "./index-ncfjxz9n.js";
|
|
107
107
|
import {
|
|
108
108
|
alreadyCuratedThisGeneration,
|
|
109
109
|
claimNextScanBatch,
|
|
110
110
|
resolveCohortId
|
|
111
|
-
} from "./index-
|
|
111
|
+
} from "./index-np4ytvvv.js";
|
|
112
112
|
import {
|
|
113
113
|
CURATOR_INIT_PROMPT,
|
|
114
114
|
CURATOR_PHASE_PROMPT,
|
|
@@ -157,7 +157,7 @@ import {
|
|
|
157
157
|
listActive,
|
|
158
158
|
subscribe,
|
|
159
159
|
unsubscribe
|
|
160
|
-
} from "./index-
|
|
160
|
+
} from "./index-5e5a1y2r.js";
|
|
161
161
|
import {
|
|
162
162
|
BUNDLED_PROJECT_SKILL_ROOT,
|
|
163
163
|
DEFAULT_SKILL_MIN_CONFIDENCE,
|
|
@@ -178,7 +178,7 @@ import {
|
|
|
178
178
|
retireSkill,
|
|
179
179
|
selectCandidateEntries,
|
|
180
180
|
syncBundledProjectSkillsIfMissingAsync
|
|
181
|
-
} from "./index-
|
|
181
|
+
} from "./index-jgb7mq2y.js";
|
|
182
182
|
import {
|
|
183
183
|
appendUnactionable,
|
|
184
184
|
quarantineEntry,
|
|
@@ -189,11 +189,11 @@ import {
|
|
|
189
189
|
validateActionableFields,
|
|
190
190
|
validateLesson,
|
|
191
191
|
validateSkillPath
|
|
192
|
-
} from "./index-
|
|
192
|
+
} from "./index-jpppcckq.js";
|
|
193
193
|
import {
|
|
194
194
|
authorizeCuration,
|
|
195
195
|
buildConfigFingerprintInput
|
|
196
|
-
} from "./index-
|
|
196
|
+
} from "./index-4p3qfb05.js";
|
|
197
197
|
import {
|
|
198
198
|
cohortConfigFingerprint
|
|
199
199
|
} from "./index-rtry5xyf.js";
|
|
@@ -212,7 +212,7 @@ import {
|
|
|
212
212
|
findByBatchId,
|
|
213
213
|
readDelegations,
|
|
214
214
|
sweepStaleDelegations
|
|
215
|
-
} from "./index-
|
|
215
|
+
} from "./index-97psh79d.js";
|
|
216
216
|
import {
|
|
217
217
|
WORKTREE_LIFECYCLE_LOCK_FILE,
|
|
218
218
|
recordWorktreeProvisioningOwner,
|
|
@@ -242,18 +242,18 @@ import {
|
|
|
242
242
|
startupOrphanRecovery,
|
|
243
243
|
withTaskEvidenceTransaction,
|
|
244
244
|
writeWorkflowWalFile
|
|
245
|
-
} from "./index-
|
|
245
|
+
} from "./index-n55a28zr.js";
|
|
246
246
|
import {
|
|
247
247
|
provisionWorktree,
|
|
248
248
|
removeWorktree
|
|
249
|
-
} from "./index-
|
|
249
|
+
} from "./index-rk80jhef.js";
|
|
250
250
|
import {
|
|
251
251
|
MAX_PENDING_SCOPE_BINDINGS,
|
|
252
252
|
canonicalWorkspaceIdentity,
|
|
253
253
|
clearAllScopes,
|
|
254
254
|
clearScopeBindingFromDisk,
|
|
255
255
|
clearScopeBindings
|
|
256
|
-
} from "./index-
|
|
256
|
+
} from "./index-vav705md.js";
|
|
257
257
|
import {
|
|
258
258
|
appendLedgerEvent,
|
|
259
259
|
computePlanHash,
|
|
@@ -262,11 +262,12 @@ import {
|
|
|
262
262
|
derivePlanIdentityHash,
|
|
263
263
|
getOrAdoptPlanEpochUnderLock,
|
|
264
264
|
initLedger,
|
|
265
|
+
ledgerExists,
|
|
265
266
|
readLedgerEvents,
|
|
266
267
|
readPlanEpochIdentity,
|
|
267
268
|
replayFromLedgerWithStatus,
|
|
268
269
|
takeSnapshotEvent
|
|
269
|
-
} from "./index-
|
|
270
|
+
} from "./index-673axbjx.js";
|
|
270
271
|
import {
|
|
271
272
|
isPathWithinDeclaredScope,
|
|
272
273
|
sanitizeDiagnosticText
|
|
@@ -317,7 +318,7 @@ import {
|
|
|
317
318
|
transactFile,
|
|
318
319
|
transactKnowledge,
|
|
319
320
|
wordBigrams
|
|
320
|
-
} from "./index-
|
|
321
|
+
} from "./index-6wf75rcm.js";
|
|
321
322
|
import {
|
|
322
323
|
MAX_EVENT_LOG_ENTRIES,
|
|
323
324
|
_internals as _internals2,
|
|
@@ -331,10 +332,10 @@ import {
|
|
|
331
332
|
recordKnowledgeEvent,
|
|
332
333
|
recordPhaseCloseIntent,
|
|
333
334
|
resolveKnowledgeEventsPath
|
|
334
|
-
} from "./index-
|
|
335
|
+
} from "./index-cxn95n7q.js";
|
|
335
336
|
import {
|
|
336
337
|
resolveWorktreeIsolationConfig
|
|
337
|
-
} from "./index-
|
|
338
|
+
} from "./index-czde45km.js";
|
|
338
339
|
import {
|
|
339
340
|
RetrospectiveEvidenceSchema
|
|
340
341
|
} from "./index-gprxjmm7.js";
|
|
@@ -344,7 +345,7 @@ import {
|
|
|
344
345
|
init_loader,
|
|
345
346
|
loadPluginConfig,
|
|
346
347
|
loadPluginConfigWithMeta
|
|
347
|
-
} from "./index-
|
|
348
|
+
} from "./index-2vefr1f8.js";
|
|
348
349
|
import {
|
|
349
350
|
DEFAULT_SKILL_OPT_CONFIG,
|
|
350
351
|
FALLBACK_MODELS_MAX,
|
|
@@ -358,7 +359,7 @@ import {
|
|
|
358
359
|
package_default,
|
|
359
360
|
resolveAutoReviewConfig,
|
|
360
361
|
stripKnownSwarmPrefix
|
|
361
|
-
} from "./index-
|
|
362
|
+
} from "./index-gpnv14kq.js";
|
|
362
363
|
import {
|
|
363
364
|
AGENT_TOOL_MAP,
|
|
364
365
|
ALL_AGENT_NAMES,
|
|
@@ -372,7 +373,7 @@ import {
|
|
|
372
373
|
init_agent_names,
|
|
373
374
|
init_constants,
|
|
374
375
|
init_tool_metadata
|
|
375
|
-
} from "./index-
|
|
376
|
+
} from "./index-cpg98bh1.js";
|
|
376
377
|
import {
|
|
377
378
|
init_git_executable,
|
|
378
379
|
resolveGitExecutable,
|
|
@@ -409,10 +410,10 @@ import {
|
|
|
409
410
|
resolveLinkDir,
|
|
410
411
|
sanitizeLinkId,
|
|
411
412
|
writeLinkPointer
|
|
412
|
-
} from "./index-
|
|
413
|
+
} from "./index-x8pm918t.js";
|
|
413
414
|
import {
|
|
414
415
|
atomicWriteFile
|
|
415
|
-
} from "./index-
|
|
416
|
+
} from "./index-j20fzn0w.js";
|
|
416
417
|
import {
|
|
417
418
|
KNOWLEDGE_SCHEMA_VERSION,
|
|
418
419
|
OUTCOME_BLOCK_THRESHOLD,
|
|
@@ -424,7 +425,7 @@ import {
|
|
|
424
425
|
atomicWriteSwarmFileSync,
|
|
425
426
|
matchTempGrammar,
|
|
426
427
|
parseTargetBasename
|
|
427
|
-
} from "./index-
|
|
428
|
+
} from "./index-kggqpefz.js";
|
|
428
429
|
import {
|
|
429
430
|
assertProjectRoot,
|
|
430
431
|
hasExplicitProjectBoundary,
|
|
@@ -432,12 +433,12 @@ import {
|
|
|
432
433
|
listActiveLocks,
|
|
433
434
|
tryAcquireLock,
|
|
434
435
|
withEvidenceLock
|
|
435
|
-
} from "./index-
|
|
436
|
+
} from "./index-bghwrr59.js";
|
|
436
437
|
import {
|
|
437
438
|
emit,
|
|
438
439
|
getLastHeartbeat,
|
|
439
440
|
telemetry
|
|
440
|
-
} from "./index-
|
|
441
|
+
} from "./index-qyvjp0bq.js";
|
|
441
442
|
import {
|
|
442
443
|
require_proper_lockfile
|
|
443
444
|
} from "./index-7g4c7s5r.js";
|
|
@@ -464,7 +465,7 @@ import {
|
|
|
464
465
|
|
|
465
466
|
// src/hooks/delegation-gate/worktree-isolation.ts
|
|
466
467
|
init_constants();
|
|
467
|
-
import { createHash as
|
|
468
|
+
import { createHash as createHash23 } from "crypto";
|
|
468
469
|
import * as fs53 from "fs/promises";
|
|
469
470
|
import * as path113 from "path";
|
|
470
471
|
init_executor();
|
|
@@ -4192,7 +4193,7 @@ async function cleanupRecoveredWorktree(directory, descriptor) {
|
|
|
4192
4193
|
awaitingMergeByCallID,
|
|
4193
4194
|
cleanupStandardWorktreeForCallId,
|
|
4194
4195
|
standardWorktreeByCallID
|
|
4195
|
-
} = await import("./worktree-isolation-
|
|
4196
|
+
} = await import("./worktree-isolation-ajzyp2gm.js");
|
|
4196
4197
|
standardWorktreeByCallID.delete(descriptor.callID);
|
|
4197
4198
|
if (hasResidue)
|
|
4198
4199
|
awaitingMergeByCallID.set(descriptor.callID, {
|
|
@@ -4294,7 +4295,7 @@ async function recoverCoderSettlement(directory, taskId) {
|
|
|
4294
4295
|
awaitingMergeByCallID,
|
|
4295
4296
|
finishStandardWorktreeDispatch,
|
|
4296
4297
|
standardWorktreeByCallID
|
|
4297
|
-
} = await import("./worktree-isolation-
|
|
4298
|
+
} = await import("./worktree-isolation-ajzyp2gm.js");
|
|
4298
4299
|
const descriptor = wal.worktree;
|
|
4299
4300
|
const reconstructedDispatch = {
|
|
4300
4301
|
callID: descriptor.callID,
|
|
@@ -15557,7 +15558,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
|
|
|
15557
15558
|
};
|
|
15558
15559
|
}
|
|
15559
15560
|
async function sweepActiveNearDuplicates(directory, options = {}) {
|
|
15560
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
15561
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-9gt8g2qj.js");
|
|
15561
15562
|
const { config } = loadPluginConfigWithMeta2(directory);
|
|
15562
15563
|
const sweepConfig = config.learning?.dedup_sweep;
|
|
15563
15564
|
if (sweepConfig?.enabled === false)
|
|
@@ -16641,7 +16642,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
16641
16642
|
}
|
|
16642
16643
|
if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
|
|
16643
16644
|
try {
|
|
16644
|
-
const skillModule = await import("./skill-generator-
|
|
16645
|
+
const skillModule = await import("./skill-generator-gsa6qwwt.js");
|
|
16645
16646
|
for (const cand of skillCandidates) {
|
|
16646
16647
|
if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
|
|
16647
16648
|
continue;
|
|
@@ -17101,7 +17102,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
17101
17102
|
} catch {}
|
|
17102
17103
|
}
|
|
17103
17104
|
if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
|
|
17104
|
-
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-
|
|
17105
|
+
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-22apj3dj.js");
|
|
17105
17106
|
for (const { id } of contradictedEntries) {
|
|
17106
17107
|
try {
|
|
17107
17108
|
await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
|
|
@@ -17920,7 +17921,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
17920
17921
|
warnings.push("Failed to collect knowledge summary.");
|
|
17921
17922
|
}
|
|
17922
17923
|
try {
|
|
17923
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
17924
|
+
const { getScanStatus } = await import("./scan-cursor-6ksgv514.js");
|
|
17924
17925
|
const scanStatus = await getScanStatus(directory);
|
|
17925
17926
|
if (scanStatus.remaining_estimate > 0) {
|
|
17926
17927
|
warnings.push(`Fair scan: reviewed ${knowledgeSummary.length} entries this sweep (generation ${scanStatus.generation}); ${scanStatus.remaining_estimate} more eligible entries will be visited in future curation sweeps.`);
|
|
@@ -18092,9 +18093,9 @@ var _internals24 = {
|
|
|
18092
18093
|
verifyPostMortemKnowledgeActions,
|
|
18093
18094
|
repairPostMortemActions,
|
|
18094
18095
|
loadDefaultKnowledgeConfig: async (directory) => {
|
|
18095
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
18096
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-mpcm7nje.js");
|
|
18096
18097
|
try {
|
|
18097
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
18098
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-9gt8g2qj.js");
|
|
18098
18099
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
18099
18100
|
return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
18100
18101
|
} catch {
|
|
@@ -18102,11 +18103,11 @@ var _internals24 = {
|
|
|
18102
18103
|
}
|
|
18103
18104
|
},
|
|
18104
18105
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
18105
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
18106
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-gk2kmrk1.js");
|
|
18106
18107
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
18107
18108
|
},
|
|
18108
18109
|
checkHivePromotions: async (entries, knowledgeConfig, directory) => {
|
|
18109
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
18110
|
+
const { checkHivePromotions } = await import("./hive-promoter-ay8a7sct.js");
|
|
18110
18111
|
return checkHivePromotions(entries, knowledgeConfig, directory);
|
|
18111
18112
|
},
|
|
18112
18113
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -18115,7 +18116,7 @@ var _internals24 = {
|
|
|
18115
18116
|
activateProposal,
|
|
18116
18117
|
listSkills: listSkills2,
|
|
18117
18118
|
sanitizeSlug
|
|
18118
|
-
} = await import("./skill-generator-
|
|
18119
|
+
} = await import("./skill-generator-gsa6qwwt.js");
|
|
18119
18120
|
const result = {
|
|
18120
18121
|
approved: [],
|
|
18121
18122
|
rejected: [],
|
|
@@ -19451,9 +19452,9 @@ function hashContent(content) {
|
|
|
19451
19452
|
return createHash7("sha1").update(content).digest("hex");
|
|
19452
19453
|
}
|
|
19453
19454
|
async function loadConfigForPolicyCurator(directory) {
|
|
19454
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
19455
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-mpcm7nje.js");
|
|
19455
19456
|
try {
|
|
19456
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
19457
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-9gt8g2qj.js");
|
|
19457
19458
|
const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
|
|
19458
19459
|
return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
|
|
19459
19460
|
} catch {
|
|
@@ -28527,12 +28528,20 @@ async function executeWriteRetro(args, directory) {
|
|
|
28527
28528
|
}
|
|
28528
28529
|
}
|
|
28529
28530
|
const taskId = args.task_id ?? `retro-${phase}`;
|
|
28531
|
+
if (args.verdict !== "pass" && args.verdict !== "fail") {
|
|
28532
|
+
return JSON.stringify({
|
|
28533
|
+
success: false,
|
|
28534
|
+
phase,
|
|
28535
|
+
reason: "RETRO_VERDICT_REQUIRED",
|
|
28536
|
+
message: 'Invalid verdict: write_retro requires an explicit verdict of "pass" or "fail".'
|
|
28537
|
+
}, null, 2);
|
|
28538
|
+
}
|
|
28530
28539
|
const retroEntry = {
|
|
28531
28540
|
task_id: taskId,
|
|
28532
28541
|
type: "retrospective",
|
|
28533
28542
|
timestamp: new Date().toISOString(),
|
|
28534
28543
|
agent: "architect",
|
|
28535
|
-
verdict:
|
|
28544
|
+
verdict: args.verdict,
|
|
28536
28545
|
summary,
|
|
28537
28546
|
metadata: args.metadata,
|
|
28538
28547
|
phase_number: phase,
|
|
@@ -28621,6 +28630,7 @@ var write_retro = createSwarmTool({
|
|
|
28621
28630
|
description: "Write a retrospective evidence bundle for a completed phase. " + "Accepts flat retro fields and writes a correctly-wrapped EvidenceBundle to " + ".swarm/evidence/retro-{phase}/evidence.json. " + "Use this instead of manually writing retro JSON to avoid schema validation failures in phase_complete.",
|
|
28622
28631
|
args: {
|
|
28623
28632
|
phase: exports_external.number().int().min(1).max(99).describe("The phase number being completed (e.g., 1, 2, 3)"),
|
|
28633
|
+
verdict: exports_external.enum(["pass", "fail"]).describe("Explicit retrospective verdict for the phase"),
|
|
28624
28634
|
summary: exports_external.string().describe("Human-readable summary of the phase"),
|
|
28625
28635
|
task_count: exports_external.number().int().min(1).max(9999).describe("Count of tasks completed in this phase"),
|
|
28626
28636
|
task_complexity: exports_external.enum(["trivial", "simple", "moderate", "complex"]).describe("Complexity level of the completed tasks"),
|
|
@@ -28642,6 +28652,7 @@ var write_retro = createSwarmTool({
|
|
|
28642
28652
|
try {
|
|
28643
28653
|
const writeRetroArgs = {
|
|
28644
28654
|
phase: Number(args.phase),
|
|
28655
|
+
verdict: args.verdict,
|
|
28645
28656
|
summary: String(args.summary ?? ""),
|
|
28646
28657
|
task_count: Number(args.task_count),
|
|
28647
28658
|
task_complexity: args.task_complexity,
|
|
@@ -29374,6 +29385,7 @@ async function runFinalizeStage(ctx) {
|
|
|
29374
29385
|
try {
|
|
29375
29386
|
retroResult = await executeWriteRetro({
|
|
29376
29387
|
phase: phase.id,
|
|
29388
|
+
verdict: ctx.isForced ? "fail" : "pass",
|
|
29377
29389
|
summary: ctx.isForced ? `Phase force-closed via /swarm close --force` : `Phase closed via /swarm close`,
|
|
29378
29390
|
task_count: Math.max(1, (phase.tasks ?? []).length),
|
|
29379
29391
|
task_complexity: "simple",
|
|
@@ -29421,6 +29433,7 @@ async function runFinalizeStage(ctx) {
|
|
|
29421
29433
|
try {
|
|
29422
29434
|
const sessionRetroResult = await executeWriteRetro({
|
|
29423
29435
|
phase: 1,
|
|
29436
|
+
verdict: ctx.isForced ? "fail" : "pass",
|
|
29424
29437
|
task_id: "retro-session",
|
|
29425
29438
|
summary: ctx.isForced ? "Plan-free session force-closed via /swarm close --force" : "Plan-free session closed via /swarm close",
|
|
29426
29439
|
task_count: 1,
|
|
@@ -29673,7 +29686,7 @@ async function runFinalizeStage(ctx) {
|
|
|
29673
29686
|
}
|
|
29674
29687
|
}
|
|
29675
29688
|
try {
|
|
29676
|
-
const { CuratorConfigSchema: CCS } = await import("./schema-
|
|
29689
|
+
const { CuratorConfigSchema: CCS } = await import("./schema-mpcm7nje.js");
|
|
29677
29690
|
const { config: pmLoadedConfig } = _internals38.loadPluginConfigWithMeta(ctx.directory);
|
|
29678
29691
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
29679
29692
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
@@ -30531,7 +30544,7 @@ var _internals38 = {
|
|
|
30531
30544
|
closePlanTerminalState: reconcileCloseTerminalStateForPlan,
|
|
30532
30545
|
endAgentSession,
|
|
30533
30546
|
flushAndDrainTelemetry: async () => {
|
|
30534
|
-
const { flushAndDrainTelemetry } = await import("./telemetry-
|
|
30547
|
+
const { flushAndDrainTelemetry } = await import("./telemetry-t109dhv7.js");
|
|
30535
30548
|
return flushAndDrainTelemetry();
|
|
30536
30549
|
}
|
|
30537
30550
|
};
|
|
@@ -31937,9 +31950,9 @@ var _internals43 = {
|
|
|
31937
31950
|
loadPluginConfigWithMeta,
|
|
31938
31951
|
loadCuratorDeps: async () => {
|
|
31939
31952
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
|
|
31940
|
-
import("./schema-
|
|
31941
|
-
import("./curator-
|
|
31942
|
-
import("./curator-llm-factory-
|
|
31953
|
+
import("./schema-mpcm7nje.js"),
|
|
31954
|
+
import("./curator-gk2kmrk1.js"),
|
|
31955
|
+
import("./curator-llm-factory-sat3mn5n.js")
|
|
31943
31956
|
]);
|
|
31944
31957
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
|
|
31945
31958
|
}
|
|
@@ -32893,7 +32906,7 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
32893
32906
|
let scanCompleted = false;
|
|
32894
32907
|
let scanRemaining = 0;
|
|
32895
32908
|
try {
|
|
32896
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
32909
|
+
const { getScanStatus } = await import("./scan-cursor-6ksgv514.js");
|
|
32897
32910
|
const status = await getScanStatus(directory);
|
|
32898
32911
|
scanGeneration = status.generation;
|
|
32899
32912
|
scanCompleted = status.completed;
|
|
@@ -32901,19 +32914,19 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
32901
32914
|
} catch {}
|
|
32902
32915
|
let configMatch = null;
|
|
32903
32916
|
try {
|
|
32904
|
-
const { isLinked: isLinked2 } = await import("./knowledge-link-
|
|
32917
|
+
const { isLinked: isLinked2 } = await import("./knowledge-link-82ew2yc4.js");
|
|
32905
32918
|
if (isLinked2(directory)) {
|
|
32906
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
32919
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-mpcm7nje.js");
|
|
32907
32920
|
let config;
|
|
32908
32921
|
try {
|
|
32909
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
32922
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-9gt8g2qj.js");
|
|
32910
32923
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
32911
32924
|
config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
32912
32925
|
} catch {
|
|
32913
32926
|
config = KnowledgeConfigSchema2.parse({});
|
|
32914
32927
|
}
|
|
32915
32928
|
const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
|
|
32916
|
-
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-
|
|
32929
|
+
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-xv0j8zyt.js");
|
|
32917
32930
|
const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
|
|
32918
32931
|
const cohortFp = await readCohortConfigFingerprint(directory);
|
|
32919
32932
|
configMatch = cohortFp === null ? null : currentFp === cohortFp;
|
|
@@ -34189,7 +34202,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
34189
34202
|
const result = runConfigDoctor(config, directory);
|
|
34190
34203
|
let output;
|
|
34191
34204
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
34192
|
-
const { runConfigDoctorWithFixes } = await import("./config-doctor-
|
|
34205
|
+
const { runConfigDoctorWithFixes } = await import("./config-doctor-j1r33f4q.js");
|
|
34193
34206
|
const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
|
|
34194
34207
|
applyLossy: true
|
|
34195
34208
|
});
|
|
@@ -34227,7 +34240,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
34227
34240
|
`;
|
|
34228
34241
|
}
|
|
34229
34242
|
try {
|
|
34230
|
-
const { runModelPreflight } = await import("./model-preflight-
|
|
34243
|
+
const { runModelPreflight } = await import("./model-preflight-7ea00h34.js");
|
|
34231
34244
|
const preflight = await runModelPreflight(config, swarmState.opencodeClient);
|
|
34232
34245
|
if (preflight.catalogAvailable) {
|
|
34233
34246
|
const unresolved = preflight.resolutions.filter((resolution) => resolution.status === "unresolved");
|
|
@@ -35129,7 +35142,7 @@ async function handleEvidenceCommand(directory, args) {
|
|
|
35129
35142
|
return formatTaskEvidenceMarkdown(evidenceData);
|
|
35130
35143
|
}
|
|
35131
35144
|
async function handleEvidenceSummaryCommand(directory) {
|
|
35132
|
-
const { buildEvidenceSummary } = await import("./evidence-summary-service-
|
|
35145
|
+
const { buildEvidenceSummary } = await import("./evidence-summary-service-0mhx0t0v.js");
|
|
35133
35146
|
const artifact = await buildEvidenceSummary(directory);
|
|
35134
35147
|
if (!artifact) {
|
|
35135
35148
|
return "No plan found. Run `/swarm plan` to check plan status.";
|
|
@@ -56537,6 +56550,9 @@ var DEFAULT_MAX_UNTRACKED_FILE_BYTES = 64 * 1024;
|
|
|
56537
56550
|
var MAX_REVIEW_BYTES = 8 * 1024 * 1024;
|
|
56538
56551
|
var MAX_UNTRACKED_FILE_BYTES = 1024 * 1024;
|
|
56539
56552
|
var MAX_TIMEOUT_MS2 = 60000;
|
|
56553
|
+
var WORKTREE_IDENTITY_MAX_FILE_BYTES = 2 * 1024 * 1024;
|
|
56554
|
+
var WORKTREE_IDENTITY_TOTAL_BYTES = 8 * 1024 * 1024;
|
|
56555
|
+
var WORKTREE_IDENTITY_MAX_DURATION_MS = 2000;
|
|
56540
56556
|
var METADATA_OUTPUT_LIMIT = 256 * 1024;
|
|
56541
56557
|
var STDERR_OUTPUT_LIMIT = 64 * 1024;
|
|
56542
56558
|
var MAX_REF_LENGTH = 200;
|
|
@@ -56919,6 +56935,204 @@ function selectorKey(selector) {
|
|
|
56919
56935
|
return "working-tree";
|
|
56920
56936
|
}
|
|
56921
56937
|
}
|
|
56938
|
+
function reviewTargetKind(selector) {
|
|
56939
|
+
switch (selector.kind) {
|
|
56940
|
+
case "range":
|
|
56941
|
+
return "exact-committed-range";
|
|
56942
|
+
case "working-tree":
|
|
56943
|
+
return "checkout-index-working-tree";
|
|
56944
|
+
default:
|
|
56945
|
+
return "checkout-history-index-working-tree";
|
|
56946
|
+
}
|
|
56947
|
+
}
|
|
56948
|
+
function compareUtf8Bytes(left, right) {
|
|
56949
|
+
return Buffer.compare(Buffer.from(left, "utf8"), Buffer.from(right, "utf8"));
|
|
56950
|
+
}
|
|
56951
|
+
function uniqueSkipCodes(skipReasons) {
|
|
56952
|
+
return [...new Set(skipReasons.map((item) => item.code))].sort();
|
|
56953
|
+
}
|
|
56954
|
+
function hashManifestPayload(payload) {
|
|
56955
|
+
return createHash17("sha256").update(JSON.stringify(payload), "utf8").digest("hex");
|
|
56956
|
+
}
|
|
56957
|
+
function parseObjectFormat(stdout) {
|
|
56958
|
+
const objectFormat = stdout.trim();
|
|
56959
|
+
return objectFormat.length > 0 && !hasControlCharacter(objectFormat) ? objectFormat : null;
|
|
56960
|
+
}
|
|
56961
|
+
function parseLsTreeBlobId(stdout, expectedPath) {
|
|
56962
|
+
const trimmed = stdout.endsWith("\x00") ? stdout.slice(0, -1) : stdout;
|
|
56963
|
+
if (!trimmed)
|
|
56964
|
+
return null;
|
|
56965
|
+
const tabIndex = trimmed.indexOf("\t");
|
|
56966
|
+
if (tabIndex === -1)
|
|
56967
|
+
return null;
|
|
56968
|
+
const metadata = trimmed.slice(0, tabIndex).trim().split(/\s+/);
|
|
56969
|
+
const actualPath = normalizeRelativePath(trimmed.slice(tabIndex + 1));
|
|
56970
|
+
if (metadata.length < 3 || metadata[1] !== "blob" || actualPath !== expectedPath || !SHA_PATTERN.test(metadata[2] ?? "")) {
|
|
56971
|
+
return null;
|
|
56972
|
+
}
|
|
56973
|
+
return metadata[2];
|
|
56974
|
+
}
|
|
56975
|
+
async function resolveGitObjectFormat(root, timeoutMs) {
|
|
56976
|
+
const result = await runGit2(root, ["rev-parse", "--show-object-format"], {
|
|
56977
|
+
timeoutMs,
|
|
56978
|
+
maxStdoutBytes: METADATA_OUTPUT_LIMIT
|
|
56979
|
+
});
|
|
56980
|
+
return result.ok ? parseObjectFormat(result.stdout) : null;
|
|
56981
|
+
}
|
|
56982
|
+
async function readGitBlobIdentity(root, treeish, relativePath2, timeoutMs, objectFormat) {
|
|
56983
|
+
const result = await runGit2(root, ["ls-tree", "-z", treeish, "--", relativePath2], {
|
|
56984
|
+
timeoutMs,
|
|
56985
|
+
maxStdoutBytes: METADATA_OUTPUT_LIMIT
|
|
56986
|
+
});
|
|
56987
|
+
if (!result.ok)
|
|
56988
|
+
return null;
|
|
56989
|
+
const blobId = parseLsTreeBlobId(result.stdout, relativePath2);
|
|
56990
|
+
if (!blobId)
|
|
56991
|
+
return null;
|
|
56992
|
+
return {
|
|
56993
|
+
algorithm: "git-blob",
|
|
56994
|
+
git_blob_oid: blobId,
|
|
56995
|
+
git_object_format: objectFormat
|
|
56996
|
+
};
|
|
56997
|
+
}
|
|
56998
|
+
function compareStats(left, right) {
|
|
56999
|
+
return sameFileIdentity(left, right) && left.size === right.size && left.mtimeNs === right.mtimeNs && left.ctimeNs === right.ctimeNs;
|
|
57000
|
+
}
|
|
57001
|
+
function hashWorkingTreeIdentity(root, rawPath, budget) {
|
|
57002
|
+
const normalized = normalizeRelativePath(rawPath);
|
|
57003
|
+
if (!normalized)
|
|
57004
|
+
return { identity: null };
|
|
57005
|
+
const candidate = path89.resolve(root, ...normalized.split("/"));
|
|
57006
|
+
if (!isContained(root, candidate))
|
|
57007
|
+
return { identity: null };
|
|
57008
|
+
let handle;
|
|
57009
|
+
const deadlineExceeded = (detail) => ({
|
|
57010
|
+
identity: null,
|
|
57011
|
+
failure: {
|
|
57012
|
+
code: "UNREADABLE_FILE",
|
|
57013
|
+
path: normalized,
|
|
57014
|
+
detail
|
|
57015
|
+
}
|
|
57016
|
+
});
|
|
57017
|
+
try {
|
|
57018
|
+
if (_internals78.now() > budget.deadlineMs) {
|
|
57019
|
+
return deadlineExceeded("working-tree content identity deadline expired before file hashing started");
|
|
57020
|
+
}
|
|
57021
|
+
const pathStat = _internals78.lstatBigIntSync(candidate);
|
|
57022
|
+
if (!pathStat.isFile() || pathStat.isSymbolicLink())
|
|
57023
|
+
return { identity: null };
|
|
57024
|
+
const canonicalBeforeOpen = _internals78.realpathSync(candidate);
|
|
57025
|
+
if (!isContained(root, canonicalBeforeOpen))
|
|
57026
|
+
return { identity: null };
|
|
57027
|
+
handle = _internals78.openSync(canonicalBeforeOpen, "r");
|
|
57028
|
+
const openedBeforeRead = _internals78.fstatBigIntSync(handle);
|
|
57029
|
+
const canonicalAfterOpen = _internals78.realpathSync(candidate);
|
|
57030
|
+
if (!openedBeforeRead.isFile() || !compareStats(pathStat, openedBeforeRead) || !samePath(canonicalBeforeOpen, canonicalAfterOpen) || !isContained(root, canonicalAfterOpen)) {
|
|
57031
|
+
return { identity: null };
|
|
57032
|
+
}
|
|
57033
|
+
if (openedBeforeRead.size > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
57034
|
+
return deadlineExceeded("working-tree content identity byte length exceeds safe integer bounds");
|
|
57035
|
+
}
|
|
57036
|
+
if (openedBeforeRead.size > BigInt(WORKTREE_IDENTITY_MAX_FILE_BYTES)) {
|
|
57037
|
+
return deadlineExceeded(`working-tree content identity exceeded the ${WORKTREE_IDENTITY_MAX_FILE_BYTES}-byte per-file cap`);
|
|
57038
|
+
}
|
|
57039
|
+
const fileBytes = Number(openedBeforeRead.size);
|
|
57040
|
+
if (fileBytes > budget.remainingBytes) {
|
|
57041
|
+
return deadlineExceeded(`working-tree content identity exceeded the ${WORKTREE_IDENTITY_TOTAL_BYTES}-byte aggregate cap`);
|
|
57042
|
+
}
|
|
57043
|
+
const hash2 = createHash17("sha256");
|
|
57044
|
+
const buffer = Buffer.alloc(64 * 1024);
|
|
57045
|
+
let offset = 0;
|
|
57046
|
+
while (offset < fileBytes) {
|
|
57047
|
+
if (_internals78.now() > budget.deadlineMs) {
|
|
57048
|
+
return deadlineExceeded("working-tree content identity deadline expired while hashing file content");
|
|
57049
|
+
}
|
|
57050
|
+
const read = _internals78.readSync(handle, buffer, 0, Math.min(buffer.byteLength, fileBytes - offset), offset);
|
|
57051
|
+
if (read === 0)
|
|
57052
|
+
break;
|
|
57053
|
+
hash2.update(buffer.subarray(0, read));
|
|
57054
|
+
offset += read;
|
|
57055
|
+
}
|
|
57056
|
+
const openedAfterRead = _internals78.fstatBigIntSync(handle);
|
|
57057
|
+
const canonicalAfterRead = _internals78.realpathSync(candidate);
|
|
57058
|
+
if (!compareStats(openedBeforeRead, openedAfterRead) || !samePath(canonicalBeforeOpen, canonicalAfterRead) || !isContained(root, canonicalAfterRead) || offset !== fileBytes) {
|
|
57059
|
+
return { identity: null };
|
|
57060
|
+
}
|
|
57061
|
+
budget.remainingBytes -= fileBytes;
|
|
57062
|
+
return {
|
|
57063
|
+
identity: {
|
|
57064
|
+
algorithm: "sha256",
|
|
57065
|
+
sha256: hash2.digest("hex"),
|
|
57066
|
+
byte_length: Number(openedAfterRead.size)
|
|
57067
|
+
}
|
|
57068
|
+
};
|
|
57069
|
+
} catch {
|
|
57070
|
+
return { identity: null };
|
|
57071
|
+
} finally {
|
|
57072
|
+
if (handle !== undefined) {
|
|
57073
|
+
try {
|
|
57074
|
+
_internals78.closeSync(handle);
|
|
57075
|
+
} catch {}
|
|
57076
|
+
}
|
|
57077
|
+
}
|
|
57078
|
+
}
|
|
57079
|
+
async function buildReviewManifest(root, selector, files, completeness, timeoutMs, revisionContext, contentHash) {
|
|
57080
|
+
const objectFormat = await resolveGitObjectFormat(root, timeoutMs) ?? "sha1";
|
|
57081
|
+
const pathRecords = [];
|
|
57082
|
+
const identityFailures = [];
|
|
57083
|
+
const missingIdentityBindings = new Set;
|
|
57084
|
+
const workingTreeBudget = selector.kind === "range" ? undefined : {
|
|
57085
|
+
remainingBytes: WORKTREE_IDENTITY_TOTAL_BYTES,
|
|
57086
|
+
deadlineMs: _internals78.now() + Math.min(timeoutMs, WORKTREE_IDENTITY_MAX_DURATION_MS)
|
|
57087
|
+
};
|
|
57088
|
+
const orderedScopes = [...files.values()].sort((left, right) => compareUtf8Bytes(left.newPath ?? left.oldPath ?? "", right.newPath ?? right.oldPath ?? ""));
|
|
57089
|
+
const oldTreeForSelector = selector.kind === "working-tree" ? revisionContext.headSha : selector.kind === "range" ? selector.operator === "..." ? revisionContext.mergeBase : revisionContext.baseSha : revisionContext.mergeBase;
|
|
57090
|
+
const newTreeForSelector = selector.kind === "range" ? revisionContext.rangeToSha : undefined;
|
|
57091
|
+
for (const scope of orderedScopes) {
|
|
57092
|
+
const record = {
|
|
57093
|
+
kind: scope.kind,
|
|
57094
|
+
old_path: scope.oldPath,
|
|
57095
|
+
new_path: scope.newPath
|
|
57096
|
+
};
|
|
57097
|
+
if (scope.kind !== "added" && scope.oldPath && oldTreeForSelector) {
|
|
57098
|
+
record.old_identity = await readGitBlobIdentity(root, oldTreeForSelector, scope.oldPath, timeoutMs, objectFormat) ?? undefined;
|
|
57099
|
+
}
|
|
57100
|
+
if (scope.newPath) {
|
|
57101
|
+
if (selector.kind === "range" && newTreeForSelector) {
|
|
57102
|
+
record.new_identity = await readGitBlobIdentity(root, newTreeForSelector, scope.newPath, timeoutMs, objectFormat) ?? undefined;
|
|
57103
|
+
} else if (workingTreeBudget) {
|
|
57104
|
+
const hashed = hashWorkingTreeIdentity(root, scope.newPath, workingTreeBudget);
|
|
57105
|
+
record.new_identity = hashed.identity ?? undefined;
|
|
57106
|
+
if (hashed.failure) {
|
|
57107
|
+
identityFailures.push(hashed.failure);
|
|
57108
|
+
missingIdentityBindings.add(`new:${scope.newPath}`);
|
|
57109
|
+
}
|
|
57110
|
+
}
|
|
57111
|
+
}
|
|
57112
|
+
pathRecords.push(record);
|
|
57113
|
+
}
|
|
57114
|
+
const payload = {
|
|
57115
|
+
schema_version: 2,
|
|
57116
|
+
content_hash: contentHash,
|
|
57117
|
+
selector,
|
|
57118
|
+
selector_key: selectorKey(selector),
|
|
57119
|
+
review_target_kind: reviewTargetKind(selector),
|
|
57120
|
+
completeness: {
|
|
57121
|
+
complete: completeness.complete,
|
|
57122
|
+
truncated: completeness.truncated,
|
|
57123
|
+
skip_reason_codes: uniqueSkipCodes(completeness.skipReasons)
|
|
57124
|
+
},
|
|
57125
|
+
path_records: pathRecords
|
|
57126
|
+
};
|
|
57127
|
+
return {
|
|
57128
|
+
manifest: {
|
|
57129
|
+
...payload,
|
|
57130
|
+
hash: hashManifestPayload(payload)
|
|
57131
|
+
},
|
|
57132
|
+
identityFailures,
|
|
57133
|
+
missingIdentityBindings
|
|
57134
|
+
};
|
|
57135
|
+
}
|
|
56922
57136
|
function boundedPositiveInteger(value, fallback, maximum) {
|
|
56923
57137
|
if (value === undefined || !Number.isFinite(value))
|
|
56924
57138
|
return fallback;
|
|
@@ -57407,6 +57621,11 @@ async function collectReviewDiff(options) {
|
|
|
57407
57621
|
fileListFallback: fileListFallback ?? null
|
|
57408
57622
|
});
|
|
57409
57623
|
const scopeHash = createHash17("sha256").update(hashPayload, "utf8").digest("hex");
|
|
57624
|
+
const reviewContentHash = createHash17("sha256").update(JSON.stringify({
|
|
57625
|
+
selector,
|
|
57626
|
+
canonicalText,
|
|
57627
|
+
fileListFallback: fileListFallback ?? null
|
|
57628
|
+
}), "utf8").digest("hex");
|
|
57410
57629
|
const completeness = {
|
|
57411
57630
|
complete: skipReasons.length === 0 && !truncated,
|
|
57412
57631
|
truncated,
|
|
@@ -57420,6 +57639,39 @@ async function collectReviewDiff(options) {
|
|
|
57420
57639
|
includesWorkingTree,
|
|
57421
57640
|
scopeHash
|
|
57422
57641
|
};
|
|
57642
|
+
const { manifest, identityFailures, missingIdentityBindings } = await buildReviewManifest(root, selector, parsed.files, completeness, timeoutMs, {
|
|
57643
|
+
headSha,
|
|
57644
|
+
mergeBase,
|
|
57645
|
+
baseSha,
|
|
57646
|
+
rangeToSha
|
|
57647
|
+
}, reviewContentHash);
|
|
57648
|
+
skipReasons.push(...identityFailures);
|
|
57649
|
+
for (const record of manifest.path_records) {
|
|
57650
|
+
if (record.kind !== "added" && record.old_path && !record.old_identity) {
|
|
57651
|
+
skipReasons.push({
|
|
57652
|
+
code: "UNREADABLE_FILE",
|
|
57653
|
+
path: record.old_path,
|
|
57654
|
+
detail: "could not bind the reviewed old-side file to a complete content identity"
|
|
57655
|
+
});
|
|
57656
|
+
}
|
|
57657
|
+
if (record.kind !== "deleted" && record.new_path && !record.new_identity && !missingIdentityBindings.has(`new:${record.new_path}`)) {
|
|
57658
|
+
skipReasons.push({
|
|
57659
|
+
code: "UNREADABLE_FILE",
|
|
57660
|
+
path: record.new_path,
|
|
57661
|
+
detail: "could not bind the reviewed new-side file to a complete content identity"
|
|
57662
|
+
});
|
|
57663
|
+
}
|
|
57664
|
+
}
|
|
57665
|
+
if (skipReasons.length > manifest.completeness.skip_reason_codes.length) {
|
|
57666
|
+
completeness.complete = false;
|
|
57667
|
+
manifest.completeness = {
|
|
57668
|
+
complete: false,
|
|
57669
|
+
truncated: completeness.truncated,
|
|
57670
|
+
skip_reason_codes: uniqueSkipCodes(skipReasons)
|
|
57671
|
+
};
|
|
57672
|
+
const { hash: _oldHash, ...manifestPayload } = manifest;
|
|
57673
|
+
manifest.hash = hashManifestPayload(manifestPayload);
|
|
57674
|
+
}
|
|
57423
57675
|
const scope = {
|
|
57424
57676
|
selector,
|
|
57425
57677
|
canonicalText,
|
|
@@ -57434,7 +57686,8 @@ async function collectReviewDiff(options) {
|
|
|
57434
57686
|
deletedLines: parsed.deletedLines,
|
|
57435
57687
|
files: parsed.files,
|
|
57436
57688
|
completeness,
|
|
57437
|
-
staleness
|
|
57689
|
+
staleness,
|
|
57690
|
+
manifest
|
|
57438
57691
|
};
|
|
57439
57692
|
const clean = canonicalText.trim().length === 0 && untrackedCount === 0 && skipReasons.length === 0;
|
|
57440
57693
|
return { status: clean ? "clean" : "ok", ...scope };
|
|
@@ -57447,7 +57700,8 @@ var _internals78 = {
|
|
|
57447
57700
|
fstatBigIntSync: (fd) => fs40.fstatSync(fd, { bigint: true }),
|
|
57448
57701
|
readSync: fs40.readSync,
|
|
57449
57702
|
closeSync: fs40.closeSync,
|
|
57450
|
-
resolveGitExecutable: resolveGitExecutableAsync
|
|
57703
|
+
resolveGitExecutable: resolveGitExecutableAsync,
|
|
57704
|
+
now: () => Date.now()
|
|
57451
57705
|
};
|
|
57452
57706
|
|
|
57453
57707
|
// src/review/engine.ts
|
|
@@ -58993,8 +59247,22 @@ var _internals82 = {
|
|
|
58993
59247
|
};
|
|
58994
59248
|
|
|
58995
59249
|
// src/review/evidence.ts
|
|
59250
|
+
import { createHash as createHash21 } from "crypto";
|
|
58996
59251
|
import * as fs44 from "fs";
|
|
58997
59252
|
import * as path93 from "path";
|
|
59253
|
+
function computeAutoReviewManifestHash(manifest) {
|
|
59254
|
+
return createHash21("sha256").update(JSON.stringify({
|
|
59255
|
+
schema_version: manifest.schema_version,
|
|
59256
|
+
content_hash: manifest.content_hash,
|
|
59257
|
+
plan_requirements_hash: manifest.plan_requirements_hash,
|
|
59258
|
+
review_policy_digest: manifest.review_policy_digest,
|
|
59259
|
+
selector: manifest.selector,
|
|
59260
|
+
selector_key: manifest.selector_key,
|
|
59261
|
+
review_target_kind: manifest.review_target_kind,
|
|
59262
|
+
completeness: manifest.completeness,
|
|
59263
|
+
path_records: manifest.path_records
|
|
59264
|
+
}), "utf8").digest("hex");
|
|
59265
|
+
}
|
|
58998
59266
|
function autoReviewEvidenceRelativePath(trigger, scopeHash, phase) {
|
|
58999
59267
|
if ((trigger === "phase_completion" || trigger === "plan_completion") && Number.isInteger(phase) && (phase ?? 0) > 0) {
|
|
59000
59268
|
return path93.join("evidence", String(phase), "auto-review.json");
|
|
@@ -59046,7 +59314,7 @@ function isAutoReviewEvidence(value) {
|
|
|
59046
59314
|
if (!value || typeof value !== "object")
|
|
59047
59315
|
return false;
|
|
59048
59316
|
const candidate = value;
|
|
59049
|
-
if (!(candidate.schema_version === 1 && typeof candidate.timestamp === "string" && [
|
|
59317
|
+
if (!((candidate.schema_version === 1 || candidate.schema_version === 2) && typeof candidate.timestamp === "string" && [
|
|
59050
59318
|
"task_completion",
|
|
59051
59319
|
"phase_completion",
|
|
59052
59320
|
"plan_completion",
|
|
@@ -59054,8 +59322,91 @@ function isAutoReviewEvidence(value) {
|
|
|
59054
59322
|
].includes(String(candidate.trigger)) && typeof candidate.session_id === "string" && Boolean(candidate.scope) && typeof candidate.scope?.hash === "string" && typeof candidate.scope?.head_sha === "string" && Boolean(candidate.scope?.selector) && Boolean(candidate.scope?.completeness) && Boolean(candidate.policy) && (candidate.policy?.mode === "advisory" || candidate.policy?.mode === "gate") && typeof candidate.policy?.min_confidence === "number" && typeof candidate.policy?.structured_findings === "boolean" && typeof candidate.policy?.validate_findings === "boolean" && Array.isArray(candidate.findings) && Array.isArray(candidate.blocking_finding_ids) && typeof candidate.validation_complete === "boolean" && Boolean(candidate.review) && ["completed", "clean", "error"].includes(String(candidate.review?.status)))) {
|
|
59055
59323
|
return false;
|
|
59056
59324
|
}
|
|
59325
|
+
if (candidate.schema_version === 2) {
|
|
59326
|
+
if (!candidate.scope?.manifest || candidate.scope.manifest.schema_version !== 2 || typeof candidate.scope.manifest.content_hash !== "string" || typeof candidate.scope.manifest.plan_requirements_hash !== "string" || typeof candidate.scope.manifest.review_policy_digest !== "string" || typeof candidate.scope.manifest.hash !== "string" || typeof candidate.policy?.digest !== "string") {
|
|
59327
|
+
return false;
|
|
59328
|
+
}
|
|
59329
|
+
const { hash: hash2, ...manifestPayload } = candidate.scope.manifest;
|
|
59330
|
+
if (hash2 !== computeAutoReviewManifestHash(manifestPayload)) {
|
|
59331
|
+
return false;
|
|
59332
|
+
}
|
|
59333
|
+
}
|
|
59057
59334
|
return candidate.findings.every(isAutoReviewEvidenceFinding);
|
|
59058
59335
|
}
|
|
59336
|
+
async function computePlanRequirementsHash(directory) {
|
|
59337
|
+
const plan = await loadReviewRequirementsPlan(directory);
|
|
59338
|
+
return plan ? computeReviewPlanRequirementsHash(plan) : "plan:none";
|
|
59339
|
+
}
|
|
59340
|
+
function computeAutoReviewPolicyDigest(config) {
|
|
59341
|
+
return createHash21("sha256").update(JSON.stringify({
|
|
59342
|
+
mode: config.final_review.mode,
|
|
59343
|
+
min_confidence: config.min_confidence,
|
|
59344
|
+
structured_findings: config.structured_findings,
|
|
59345
|
+
validate_findings: config.validate_findings,
|
|
59346
|
+
final_review: {
|
|
59347
|
+
on_phase_complete: config.final_review.on_phase_complete,
|
|
59348
|
+
on_plan_complete: config.final_review.on_plan_complete,
|
|
59349
|
+
max_diff_bytes: config.final_review.max_diff_bytes,
|
|
59350
|
+
timeout_ms: config.final_review.timeout_ms,
|
|
59351
|
+
model: config.final_review.model
|
|
59352
|
+
},
|
|
59353
|
+
validation_timeout_ms: config.validation_timeout_ms,
|
|
59354
|
+
validation_model: config.validation_model
|
|
59355
|
+
}), "utf8").digest("hex");
|
|
59356
|
+
}
|
|
59357
|
+
async function materializeAutoReviewManifest(directory, manifest, config) {
|
|
59358
|
+
const planRequirementsHash = await computePlanRequirementsHash(directory);
|
|
59359
|
+
const policyDigest = computeAutoReviewPolicyDigest(config);
|
|
59360
|
+
const payload = {
|
|
59361
|
+
...manifest,
|
|
59362
|
+
plan_requirements_hash: planRequirementsHash,
|
|
59363
|
+
review_policy_digest: policyDigest
|
|
59364
|
+
};
|
|
59365
|
+
const hash2 = computeAutoReviewManifestHash(payload);
|
|
59366
|
+
return { ...payload, hash: hash2 };
|
|
59367
|
+
}
|
|
59368
|
+
async function loadReviewRequirementsPlan(directory) {
|
|
59369
|
+
if (!await ledgerExists(directory)) {
|
|
59370
|
+
return loadPlanJsonOnly(directory);
|
|
59371
|
+
}
|
|
59372
|
+
let replayed;
|
|
59373
|
+
try {
|
|
59374
|
+
replayed = await replayFromLedgerWithStatus(directory);
|
|
59375
|
+
} catch (error2) {
|
|
59376
|
+
throw new Error(`authoritative plan ledger replay failed for final-review requirements: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
59377
|
+
}
|
|
59378
|
+
if (replayed.truncated) {
|
|
59379
|
+
throw new Error("authoritative plan ledger replay is truncated; final-review requirements are unavailable");
|
|
59380
|
+
}
|
|
59381
|
+
if (!replayed.plan) {
|
|
59382
|
+
throw new Error("authoritative plan ledger replay returned no plan; final-review requirements are unavailable");
|
|
59383
|
+
}
|
|
59384
|
+
return replayed.plan;
|
|
59385
|
+
}
|
|
59386
|
+
function computeReviewPlanRequirementsHash(plan) {
|
|
59387
|
+
return createHash21("sha256").update(JSON.stringify({
|
|
59388
|
+
schema_version: plan.schema_version,
|
|
59389
|
+
title: plan.title,
|
|
59390
|
+
swarm: plan.swarm,
|
|
59391
|
+
migration_status: plan.migration_status,
|
|
59392
|
+
phases: plan.phases.map((phase) => ({
|
|
59393
|
+
id: phase.id,
|
|
59394
|
+
name: phase.name,
|
|
59395
|
+
type: phase.type,
|
|
59396
|
+
required_agents: phase.required_agents ? [...phase.required_agents].sort() : undefined,
|
|
59397
|
+
tasks: phase.tasks.map((task) => ({
|
|
59398
|
+
id: task.id,
|
|
59399
|
+
phase: task.phase,
|
|
59400
|
+
size: task.size,
|
|
59401
|
+
description: task.description,
|
|
59402
|
+
depends: [...task.depends].sort(),
|
|
59403
|
+
acceptance: task.acceptance,
|
|
59404
|
+
files_touched: [...task.files_touched].sort(),
|
|
59405
|
+
fr_refs: task.fr_refs ? [...task.fr_refs].sort() : undefined
|
|
59406
|
+
}))
|
|
59407
|
+
}))
|
|
59408
|
+
}), "utf8").digest("hex");
|
|
59409
|
+
}
|
|
59059
59410
|
function baseFinding(finding) {
|
|
59060
59411
|
return {
|
|
59061
59412
|
title: finding.title,
|
|
@@ -59176,13 +59527,9 @@ function scopeFreshnessMismatches(reviewed, current) {
|
|
|
59176
59527
|
};
|
|
59177
59528
|
compare("status", reviewed.status, current.status);
|
|
59178
59529
|
compare("scopeHash", reviewed.scopeHash, current.scopeHash);
|
|
59530
|
+
compare("manifestHash", reviewed.manifest.hash, current.manifest.hash);
|
|
59179
59531
|
compare("canonicalText", reviewed.canonicalText, current.canonicalText);
|
|
59180
59532
|
compare("reviewTextBytes", reviewed.reviewTextBytes, current.reviewTextBytes);
|
|
59181
|
-
compare("headSha", reviewed.headSha, current.headSha);
|
|
59182
|
-
compare("baseRef", reviewed.baseRef, current.baseRef);
|
|
59183
|
-
compare("baseSha", reviewed.baseSha, current.baseSha);
|
|
59184
|
-
compare("mergeBase", reviewed.mergeBase, current.mergeBase);
|
|
59185
|
-
compare("rangeToSha", reviewed.rangeToSha, current.rangeToSha);
|
|
59186
59533
|
compare("selector", JSON.stringify(reviewed.selector), JSON.stringify(current.selector));
|
|
59187
59534
|
compare("completeness", JSON.stringify(reviewed.completeness), JSON.stringify(current.completeness));
|
|
59188
59535
|
compare("includesWorkingTree", reviewed.staleness.includesWorkingTree, current.staleness.includesWorkingTree);
|
|
@@ -59208,6 +59555,7 @@ async function stalePersistenceResult(input, maxBytes, message, modelCalls) {
|
|
|
59208
59555
|
result.modelCalls = modelCalls;
|
|
59209
59556
|
if (current.status !== "error") {
|
|
59210
59557
|
result.scopeHash = current.scopeHash;
|
|
59558
|
+
result.manifestHash = current.manifest.hash;
|
|
59211
59559
|
result.scopeComplete = current.completeness.complete;
|
|
59212
59560
|
Object.assign(result, scopeResultFields(current));
|
|
59213
59561
|
}
|
|
@@ -59273,14 +59621,14 @@ var REVIEW_SYSTEM_PROMPT = [
|
|
|
59273
59621
|
function renderReviewPrompt(input, renderedFallbackFiles, omittedFallbackFiles) {
|
|
59274
59622
|
const { diff } = input;
|
|
59275
59623
|
const exactRange = diff.selector.kind === "range";
|
|
59276
|
-
const
|
|
59624
|
+
const reviewTargetKind2 = diff.selector.kind === "range" ? "exact-committed-range" : diff.selector.kind === "working-tree" ? "checkout-index-working-tree" : "checkout-history-index-working-tree";
|
|
59277
59625
|
const fallback = diff.completeness.fileListFallback;
|
|
59278
59626
|
const promptFallbackComplete = fallback?.complete && omittedFallbackFiles === 0;
|
|
59279
59627
|
return [
|
|
59280
59628
|
`TASK: Review the complete ${input.trigger.replaceAll("_", " ")} diff.`,
|
|
59281
59629
|
input.phase ? `PHASE: ${input.phase}` : "",
|
|
59282
59630
|
`REVIEW_SELECTOR: ${JSON.stringify(diff.selector)}`,
|
|
59283
|
-
`REVIEW_TARGET_KIND: ${
|
|
59631
|
+
`REVIEW_TARGET_KIND: ${reviewTargetKind2}`,
|
|
59284
59632
|
`SCOPE_HASH: ${diff.scopeHash}`,
|
|
59285
59633
|
`BASE_REF: ${diff.baseRef ?? "none"}`,
|
|
59286
59634
|
`BASE_SHA: ${diff.baseSha ?? "none"}`,
|
|
@@ -59497,7 +59845,7 @@ function addCost(evidence2, dispatches) {
|
|
|
59497
59845
|
}
|
|
59498
59846
|
function baseEvidence(input, diff, status) {
|
|
59499
59847
|
return {
|
|
59500
|
-
schema_version:
|
|
59848
|
+
schema_version: 2,
|
|
59501
59849
|
timestamp: new Date().toISOString(),
|
|
59502
59850
|
trigger: input.trigger,
|
|
59503
59851
|
session_id: input.sessionID,
|
|
@@ -59517,7 +59865,8 @@ function baseEvidence(input, diff, status) {
|
|
|
59517
59865
|
mode: input.config.final_review.mode,
|
|
59518
59866
|
min_confidence: input.config.min_confidence,
|
|
59519
59867
|
structured_findings: input.config.structured_findings,
|
|
59520
|
-
validate_findings: input.config.validate_findings
|
|
59868
|
+
validate_findings: input.config.validate_findings,
|
|
59869
|
+
digest: undefined
|
|
59521
59870
|
},
|
|
59522
59871
|
review: { status },
|
|
59523
59872
|
findings: [],
|
|
@@ -59576,6 +59925,8 @@ function emptyResult2(status, message, blocked, blockReason) {
|
|
|
59576
59925
|
}
|
|
59577
59926
|
async function persistErrorResult(input, diff, result, error2, dispatches, promptRequest) {
|
|
59578
59927
|
const evidence2 = baseEvidence(input, diff, "error");
|
|
59928
|
+
evidence2.scope.manifest = await materializeAutoReviewManifest(input.directory, diff.manifest, input.config);
|
|
59929
|
+
evidence2.policy.digest = evidence2.scope.manifest.review_policy_digest;
|
|
59579
59930
|
evidence2.review.error = error2;
|
|
59580
59931
|
addCost(evidence2, dispatches);
|
|
59581
59932
|
try {
|
|
@@ -59587,6 +59938,7 @@ async function persistErrorResult(input, diff, result, error2, dispatches, promp
|
|
|
59587
59938
|
}
|
|
59588
59939
|
}
|
|
59589
59940
|
result.scopeHash = diff.scopeHash;
|
|
59941
|
+
result.manifestHash = evidence2.scope.manifest.hash;
|
|
59590
59942
|
result.scopeComplete = diff.completeness.complete;
|
|
59591
59943
|
Object.assign(result, scopeResultFields(diff, promptRequest));
|
|
59592
59944
|
return result;
|
|
@@ -59607,6 +59959,8 @@ async function runReviewEngine(input) {
|
|
|
59607
59959
|
}
|
|
59608
59960
|
if (diff.status === "clean") {
|
|
59609
59961
|
const evidence3 = baseEvidence(input, diff, "clean");
|
|
59962
|
+
evidence3.scope.manifest = await materializeAutoReviewManifest(input.directory, diff.manifest, input.config);
|
|
59963
|
+
evidence3.policy.digest = evidence3.scope.manifest.review_policy_digest;
|
|
59610
59964
|
let evidencePath2;
|
|
59611
59965
|
try {
|
|
59612
59966
|
evidencePath2 = await _internals83.persistEvidence(input.directory, evidence3, { verifyCurrent: createScopeVerifier(input, diff, maxBytes) });
|
|
@@ -59620,6 +59974,7 @@ async function runReviewEngine(input) {
|
|
|
59620
59974
|
...emptyResult2("clean", "Review scope is clean.", blocked2, blocked2 ? "EVIDENCE_PERSISTENCE_FAILED" : undefined),
|
|
59621
59975
|
validationComplete: true,
|
|
59622
59976
|
scopeHash: diff.scopeHash,
|
|
59977
|
+
manifestHash: evidence3.scope.manifest.hash,
|
|
59623
59978
|
scopeComplete: diff.completeness.complete,
|
|
59624
59979
|
...scopeResultFields(diff),
|
|
59625
59980
|
evidencePath: evidencePath2
|
|
@@ -59630,6 +59985,7 @@ async function runReviewEngine(input) {
|
|
|
59630
59985
|
diff,
|
|
59631
59986
|
phase: input.phase
|
|
59632
59987
|
});
|
|
59988
|
+
const reviewManifest = await materializeAutoReviewManifest(input.directory, diff.manifest, input.config);
|
|
59633
59989
|
if (input.phase !== undefined && (input.trigger === "phase_completion" || input.trigger === "plan_completion")) {
|
|
59634
59990
|
const existing = _internals83.readPhaseEvidence(input.directory, input.phase);
|
|
59635
59991
|
const integrity = existing ? validateAutoReviewEvidenceIntegrity(input.directory, existing, {
|
|
@@ -59644,7 +60000,7 @@ async function runReviewEngine(input) {
|
|
|
59644
60000
|
},
|
|
59645
60001
|
scopeContent: diff.canonicalText
|
|
59646
60002
|
}) : undefined;
|
|
59647
|
-
if (existing?.review.status === "completed" && existing.scope.
|
|
60003
|
+
if (existing?.review.status === "completed" && existing.schema_version === 2 && existing.scope.manifest?.hash === reviewManifest.hash && integrity?.ok && integrity.receipt) {
|
|
59648
60004
|
const validationsById = new Map((integrity.receipt.finding_validations ?? []).map((validation) => [
|
|
59649
60005
|
validation.finding_id,
|
|
59650
60006
|
validation
|
|
@@ -59673,6 +60029,7 @@ async function runReviewEngine(input) {
|
|
|
59673
60029
|
receiptPath: existing.receipt_path,
|
|
59674
60030
|
evidencePath: path94.join(input.directory, ".swarm", "evidence", String(input.phase), "auto-review.json"),
|
|
59675
60031
|
scopeHash: existing.scope.hash,
|
|
60032
|
+
manifestHash: existing.scope.manifest?.hash,
|
|
59676
60033
|
scopeComplete: diff.completeness.complete,
|
|
59677
60034
|
...scopeResultFields(diff, promptRequest),
|
|
59678
60035
|
reviewModel: existing.review.model,
|
|
@@ -59779,6 +60136,8 @@ async function runReviewEngine(input) {
|
|
|
59779
60136
|
}
|
|
59780
60137
|
const blockingFindings = findings.filter((finding) => finding.anchored && isGateSeverity(finding.effective_severity) && finding.validation?.disposition === "CONFIRMED");
|
|
59781
60138
|
const evidence2 = baseEvidence(input, diff, "completed");
|
|
60139
|
+
evidence2.scope.manifest = reviewManifest;
|
|
60140
|
+
evidence2.policy.digest = reviewManifest.review_policy_digest;
|
|
59782
60141
|
evidence2.review = {
|
|
59783
60142
|
status: "completed",
|
|
59784
60143
|
output_mode: parsed.outputMode,
|
|
@@ -59896,6 +60255,7 @@ async function runReviewEngine(input) {
|
|
|
59896
60255
|
receiptPath,
|
|
59897
60256
|
evidencePath,
|
|
59898
60257
|
scopeHash: diff.scopeHash,
|
|
60258
|
+
manifestHash: reviewManifest.hash,
|
|
59899
60259
|
scopeComplete: diff.completeness.complete,
|
|
59900
60260
|
...scopeResultFields(diff, promptRequest),
|
|
59901
60261
|
reviewModel: dispatched.result.modelId,
|
|
@@ -61032,7 +61392,7 @@ import {
|
|
|
61032
61392
|
import * as path99 from "path";
|
|
61033
61393
|
|
|
61034
61394
|
// src/services/skill-optimizer/store.ts
|
|
61035
|
-
import { createHash as
|
|
61395
|
+
import { createHash as createHash22, randomUUID as randomUUID12 } from "crypto";
|
|
61036
61396
|
import {
|
|
61037
61397
|
closeSync as closeSync16,
|
|
61038
61398
|
existsSync as existsSync55,
|
|
@@ -61057,10 +61417,10 @@ function canonicalJson3(value) {
|
|
|
61057
61417
|
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson3(v)}`).join(",")}}`;
|
|
61058
61418
|
}
|
|
61059
61419
|
function computeStateHash(value) {
|
|
61060
|
-
return
|
|
61420
|
+
return createHash22("sha256").update(canonicalJson3(value), "utf8").digest("hex");
|
|
61061
61421
|
}
|
|
61062
61422
|
function computeContentHash2(content) {
|
|
61063
|
-
return
|
|
61423
|
+
return createHash22("sha256").update(content, "utf8").digest("hex");
|
|
61064
61424
|
}
|
|
61065
61425
|
function computeEventHash(event) {
|
|
61066
61426
|
return computeStateHash({
|
|
@@ -62412,7 +62772,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
62412
62772
|
if (!input.dispatcher) {
|
|
62413
62773
|
throw new Error("no evaluation dispatcher available (cannot run validation)");
|
|
62414
62774
|
}
|
|
62415
|
-
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-
|
|
62775
|
+
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-pqsf809k.js");
|
|
62416
62776
|
const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
|
|
62417
62777
|
const result = await _internals91.evaluateCandidateV1({
|
|
62418
62778
|
projectRoot: input.directory,
|
|
@@ -64183,6 +64543,7 @@ Writes a retrospective evidence bundle for a completed phase.
|
|
|
64183
64543
|
\`\`\`json
|
|
64184
64544
|
{
|
|
64185
64545
|
"phase": 1,
|
|
64546
|
+
"verdict": "pass",
|
|
64186
64547
|
"summary": "Phase summary here",
|
|
64187
64548
|
"task_count": 3,
|
|
64188
64549
|
"task_complexity": "simple",
|
|
@@ -64201,6 +64562,8 @@ Writes a retrospective evidence bundle for a completed phase.
|
|
|
64201
64562
|
- \`task_id\`: string (defaults to \`retro-{phase}\`)
|
|
64202
64563
|
- \`metadata\`: Record<string, unknown>
|
|
64203
64564
|
|
|
64565
|
+
### verdict values: pass | fail
|
|
64566
|
+
|
|
64204
64567
|
### task_complexity values: trivial | simple | moderate | complex`;
|
|
64205
64568
|
}
|
|
64206
64569
|
let parsedArgs;
|
|
@@ -64315,7 +64678,7 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
64315
64678
|
async function handleHelpCommand(ctx) {
|
|
64316
64679
|
const targetCommand = ctx.args.join(" ");
|
|
64317
64680
|
if (!targetCommand) {
|
|
64318
|
-
const { buildHelpText } = await import("./index-
|
|
64681
|
+
const { buildHelpText } = await import("./index-9080b3de.js");
|
|
64319
64682
|
return buildHelpText();
|
|
64320
64683
|
}
|
|
64321
64684
|
const tokens = targetCommand.split(/\s+/);
|
|
@@ -64324,7 +64687,7 @@ async function handleHelpCommand(ctx) {
|
|
|
64324
64687
|
return _internals94.buildDetailedHelp(resolved.key, resolved.entry);
|
|
64325
64688
|
}
|
|
64326
64689
|
const similar = _internals94.findSimilarCommands(targetCommand);
|
|
64327
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
64690
|
+
const { buildHelpText: fullHelp } = await import("./index-9080b3de.js");
|
|
64328
64691
|
if (similar.length > 0) {
|
|
64329
64692
|
return `Command '/swarm ${targetCommand}' not found.
|
|
64330
64693
|
|
|
@@ -64501,7 +64864,7 @@ var COMMAND_REGISTRY = {
|
|
|
64501
64864
|
},
|
|
64502
64865
|
"guardrail explain": {
|
|
64503
64866
|
handler: async (ctx) => {
|
|
64504
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
64867
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-r50fery8.js");
|
|
64505
64868
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
64506
64869
|
},
|
|
64507
64870
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -64511,7 +64874,7 @@ var COMMAND_REGISTRY = {
|
|
|
64511
64874
|
},
|
|
64512
64875
|
"guardrail-explain": {
|
|
64513
64876
|
handler: async (ctx) => {
|
|
64514
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
64877
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-r50fery8.js");
|
|
64515
64878
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
64516
64879
|
},
|
|
64517
64880
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -64521,7 +64884,7 @@ var COMMAND_REGISTRY = {
|
|
|
64521
64884
|
},
|
|
64522
64885
|
"guardrail-log": {
|
|
64523
64886
|
handler: async (ctx) => {
|
|
64524
|
-
const { handleGuardrailLog } = await import("./guardrail-log-
|
|
64887
|
+
const { handleGuardrailLog } = await import("./guardrail-log-p69eys6d.js");
|
|
64525
64888
|
return handleGuardrailLog(ctx.directory, ctx.args);
|
|
64526
64889
|
},
|
|
64527
64890
|
description: "Read the guardrail decision log (use --blocks-only for blocks)",
|
|
@@ -71515,7 +71878,7 @@ function getDisplayBudget() {
|
|
|
71515
71878
|
async function rehydratePrSubscriptions(sessionID, directory) {
|
|
71516
71879
|
const map = new Map;
|
|
71517
71880
|
try {
|
|
71518
|
-
const { listActive: listActive2 } = await import("./pr-subscriptions-
|
|
71881
|
+
const { listActive: listActive2 } = await import("./pr-subscriptions-2xn238xt.js");
|
|
71519
71882
|
const records = await listActive2(directory);
|
|
71520
71883
|
for (const record of records) {
|
|
71521
71884
|
if (record.sessionID !== sessionID)
|
|
@@ -71931,7 +72294,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
|
|
|
71931
72294
|
return extracted === expectedSessionId;
|
|
71932
72295
|
}
|
|
71933
72296
|
async function inspectStandardWorktreeCollisionOwnership(identity) {
|
|
71934
|
-
const collisionOwnership = await import("./worktree-collision-ownership-
|
|
72297
|
+
const collisionOwnership = await import("./worktree-collision-ownership-2jtg2my1.js");
|
|
71935
72298
|
return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
|
|
71936
72299
|
}
|
|
71937
72300
|
async function precreateStandardWorktreeSession(args) {
|
|
@@ -72079,7 +72442,7 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
72079
72442
|
const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, provisionResult.worktreePath);
|
|
72080
72443
|
if (laneProfile) {
|
|
72081
72444
|
try {
|
|
72082
|
-
const { writeLaneProfileToDiskReal } = await import("./core-
|
|
72445
|
+
const { writeLaneProfileToDiskReal } = await import("./core-c2zrd384.js");
|
|
72083
72446
|
await writeLaneProfileToDiskReal(provisionResult.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
|
|
72084
72447
|
} catch {}
|
|
72085
72448
|
}
|
|
@@ -72175,7 +72538,7 @@ async function preserveBackgroundWorktreeOwnershipForCallId(callID) {
|
|
|
72175
72538
|
}
|
|
72176
72539
|
const session = Buffer.from(dispatch.handle.sessionId, "utf8").toString("base64url");
|
|
72177
72540
|
const lane = Buffer.from(dispatch.handle.id, "utf8").toString("base64url");
|
|
72178
|
-
const callDigest =
|
|
72541
|
+
const callDigest = createHash23("sha256").update(callID).digest("hex").slice(0, 12);
|
|
72179
72542
|
const tag = `swarm-preserved-owner/${session}/${lane}/${callDigest}`;
|
|
72180
72543
|
let tagProc;
|
|
72181
72544
|
try {
|
|
@@ -72737,7 +73100,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
|
|
|
72737
73100
|
}
|
|
72738
73101
|
clearWorktreeMergeStatus(statusKey);
|
|
72739
73102
|
try {
|
|
72740
|
-
const { removeLaneProfileFromDiskReal } = await import("./core-
|
|
73103
|
+
const { removeLaneProfileFromDiskReal } = await import("./core-c2zrd384.js");
|
|
72741
73104
|
await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
|
|
72742
73105
|
} catch {}
|
|
72743
73106
|
const state = serializationStateBySessionID.get(dispatch.parentSessionID);
|