opencode-swarm 7.149.0 → 7.149.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/background/candidate-contract.d.ts +1 -1
  2. package/dist/background/pending-delegations.d.ts +6 -0
  3. package/dist/background/pr-review-contract.d.ts +20 -0
  4. package/dist/cli/{config-doctor-fx8d6pma.js → config-doctor-d3nsq1nz.js} +2 -2
  5. package/dist/cli/{core-0v762txd.js → core-y9d858n6.js} +1 -1
  6. package/dist/cli/{curation-policy-4jxx3ey4.js → curation-policy-nck9g765.js} +6 -6
  7. package/dist/cli/{curator-6w4frzdz.js → curator-f5m0hh2p.js} +28 -28
  8. package/dist/cli/{curator-llm-factory-8fstpeqh.js → curator-llm-factory-mzh9ns5s.js} +28 -28
  9. package/dist/cli/{evidence-summary-service-x00z38n2.js → evidence-summary-service-601x7ne7.js} +12 -12
  10. package/dist/cli/{gate-evidence-ejdek2td.js → gate-evidence-kjs9vsx9.js} +6 -6
  11. package/dist/cli/{guardrail-explain-nynjhbzk.js → guardrail-explain-j291sss5.js} +29 -29
  12. package/dist/cli/{guardrail-log-6bktj08e.js → guardrail-log-1jykfrqc.js} +5 -5
  13. package/dist/cli/{guardrail-reset-hsfd5ykq.js → guardrail-reset-tr07m077.js} +28 -28
  14. package/dist/cli/{hive-promoter-32artf8c.js → hive-promoter-162ws6xp.js} +28 -28
  15. package/dist/cli/{index-6thxr1q7.js → index-1aztaa2s.js} +3 -3
  16. package/dist/cli/{index-xdp0bx28.js → index-38ema5k2.js} +2 -2
  17. package/dist/cli/{index-bmaz2yy4.js → index-4sdhbxgq.js} +1 -1
  18. package/dist/cli/{index-ef0wracg.js → index-5gntxwxt.js} +5 -5
  19. package/dist/cli/{index-8yan955h.js → index-64d17yd0.js} +2 -2
  20. package/dist/cli/{index-bcfcekx9.js → index-7m8rk72d.js} +287 -78
  21. package/dist/cli/{index-cfvbd3dg.js → index-apwcvfjt.js} +2 -2
  22. package/dist/cli/{index-wsar7d91.js → index-cna8m7my.js} +1 -1
  23. package/dist/cli/{index-q8e2yd98.js → index-cqhf7fkw.js} +1 -1
  24. package/dist/cli/{index-42habrdv.js → index-dkrz1vv5.js} +4 -4
  25. package/dist/cli/{index-ame8ek9g.js → index-dtmgt2xn.js} +5 -5
  26. package/dist/cli/{index-zkcwan96.js → index-eaq9b0qm.js} +1 -1
  27. package/dist/cli/{index-kb1p6dpx.js → index-ekvs3ade.js} +7 -7
  28. package/dist/cli/{index-c83bztkp.js → index-exn0ztsv.js} +1 -1
  29. package/dist/cli/{index-ka2vav7t.js → index-f53yyerg.js} +30 -30
  30. package/dist/cli/{index-79pwr8hc.js → index-fc4x86sy.js} +5 -5
  31. package/dist/cli/{index-s7t2c9jd.js → index-hxbrsb40.js} +2 -2
  32. package/dist/cli/{index-c1h0rdkr.js → index-jb9tb1sd.js} +1 -1
  33. package/dist/cli/{index-5q5ws00e.js → index-jg2gwzvq.js} +4 -4
  34. package/dist/cli/{index-wbz365gn.js → index-k2sm9677.js} +1 -1
  35. package/dist/cli/{index-ccyve4pb.js → index-kgk65rde.js} +1 -1
  36. package/dist/cli/{index-a90c1gtn.js → index-m8dn0qnm.js} +1 -1
  37. package/dist/cli/{index-01q7mb83.js → index-mdwtj4xm.js} +6 -6
  38. package/dist/cli/{index-vfv4vnnc.js → index-n99s022c.js} +1 -1
  39. package/dist/cli/{index-41n0thtd.js → index-pf22x0dr.js} +2 -1
  40. package/dist/cli/{index-z6471b7r.js → index-prxrmc3b.js} +2 -2
  41. package/dist/cli/{index-8hkxm9mh.js → index-srwp8fs7.js} +4 -4
  42. package/dist/cli/{index-mza55jmc.js → index-t994f8fp.js} +1 -1
  43. package/dist/cli/{index-n6jykega.js → index-vy6q9d8j.js} +3 -2
  44. package/dist/cli/{index-pgfn8h50.js → index-xe83cwvn.js} +7 -7
  45. package/dist/cli/{index-wj0gnab0.js → index-xggpmtfx.js} +1 -1
  46. package/dist/cli/{index-hbhw2qd7.js → index-yjj3s8af.js} +3 -3
  47. package/dist/cli/index.js +28 -28
  48. package/dist/cli/{knowledge-escalator-ty2kesdj.js → knowledge-escalator-whkxxgxj.js} +11 -11
  49. package/dist/cli/{knowledge-events-x3rd7r3j.js → knowledge-events-rnqzt87h.js} +9 -9
  50. package/dist/cli/{knowledge-link-a5f89833.js → knowledge-link-mzn8x0qd.js} +5 -5
  51. package/dist/cli/{knowledge-store-zsz4dxjq.js → knowledge-store-7de59rnz.js} +6 -6
  52. package/dist/cli/{knowledge-validator-bdhgkw9f.js → knowledge-validator-bpk17jf4.js} +8 -8
  53. package/dist/cli/{pending-delegations-aez8ebdr.js → pending-delegations-qzy6rnvw.js} +3 -3
  54. package/dist/cli/{pr-subscriptions-cpnwvc6y.js → pr-subscriptions-q862pvz1.js} +3 -3
  55. package/dist/cli/{runner-9mnkfjw7.js → runner-1aygs98c.js} +6 -6
  56. package/dist/cli/{scan-cursor-3ba1spad.js → scan-cursor-0p51fh61.js} +7 -7
  57. package/dist/cli/{schema-h251vmd1.js → schema-8g2nxhjf.js} +1 -1
  58. package/dist/cli/{scope-persistence-h1b31ba2.js → scope-persistence-hhkr0c46.js} +8 -8
  59. package/dist/cli/{skill-generator-esrn40th.js → skill-generator-pk9gcz7r.js} +13 -13
  60. package/dist/cli/{telemetry-jtq6px7k.js → telemetry-5deacb7w.js} +1 -1
  61. package/dist/cli/{worktree-collision-ownership-r8j31h06.js → worktree-collision-ownership-9v8e0dz7.js} +3 -3
  62. package/dist/cli/{worktree-isolation-pbr4d5m9.js → worktree-isolation-1hwwfbdw.js} +28 -28
  63. package/dist/failures/invocation-failure.d.ts +7 -0
  64. package/dist/hooks/pr-workflow-gate.d.ts +37 -6
  65. package/dist/index.js +33 -30
  66. package/dist/services/session-reflection.d.ts +7 -0
  67. package/dist/state.d.ts +10 -0
  68. package/dist/tools/dispatch-lanes.d.ts +50 -1
  69. package/dist/tools/write-pr-review-artifact.d.ts +2 -0
  70. package/package.json +2 -1
@@ -6,17 +6,17 @@ import {
6
6
  resolveExecutableFromPath,
7
7
  runEvaluation,
8
8
  runExternalTool
9
- } from "./index-vfv4vnnc.js";
9
+ } from "./index-n99s022c.js";
10
10
  import {
11
11
  normalizeToolNameLowerCase,
12
12
  stableCanonicalStringify
13
- } from "./index-wsar7d91.js";
13
+ } from "./index-cna8m7my.js";
14
14
  import {
15
15
  detectStraySwarmDirs,
16
16
  readDoctorArtifact,
17
17
  removeStraySwarmDir,
18
18
  runConfigDoctor
19
- } from "./index-ccyve4pb.js";
19
+ } from "./index-kgk65rde.js";
20
20
  import {
21
21
  MAX_TRANSIENT_RETRIES,
22
22
  archiveEvidence,
@@ -62,7 +62,7 @@ import {
62
62
  updateTaskStatus,
63
63
  validateProjectRoot,
64
64
  validateSymlinkBoundary
65
- } from "./index-kb1p6dpx.js";
65
+ } from "./index-ekvs3ade.js";
66
66
  import {
67
67
  EvaluationTaskV1Schema,
68
68
  GateAuditManifestV1Schema,
@@ -79,7 +79,7 @@ import {
79
79
  saveGateAuditResult,
80
80
  savePromotionDecision,
81
81
  saveTaskSetSnapshot
82
- } from "./index-z6471b7r.js";
82
+ } from "./index-prxrmc3b.js";
83
83
  import {
84
84
  loadDatabaseCtor
85
85
  } from "./index-134d35c1.js";
@@ -105,12 +105,12 @@ import {
105
105
  } from "./index-y8552snf.js";
106
106
  import {
107
107
  readRecentEscalations
108
- } from "./index-ef0wracg.js";
108
+ } from "./index-5gntxwxt.js";
109
109
  import {
110
110
  alreadyCuratedThisGeneration,
111
111
  claimNextScanBatch,
112
112
  resolveCohortId
113
- } from "./index-s7t2c9jd.js";
113
+ } from "./index-hxbrsb40.js";
114
114
  import {
115
115
  CURATOR_INIT_PROMPT,
116
116
  CURATOR_PHASE_PROMPT,
@@ -159,7 +159,7 @@ import {
159
159
  listActive,
160
160
  subscribe,
161
161
  unsubscribe
162
- } from "./index-wbz365gn.js";
162
+ } from "./index-k2sm9677.js";
163
163
  import {
164
164
  BUNDLED_PROJECT_SKILL_ROOT,
165
165
  DEFAULT_SKILL_MIN_CONFIDENCE,
@@ -180,7 +180,7 @@ import {
180
180
  retireSkill,
181
181
  selectCandidateEntries,
182
182
  syncBundledProjectSkillsIfMissingAsync
183
- } from "./index-42habrdv.js";
183
+ } from "./index-dkrz1vv5.js";
184
184
  import {
185
185
  appendUnactionable,
186
186
  quarantineEntry,
@@ -191,11 +191,11 @@ import {
191
191
  validateActionableFields,
192
192
  validateLesson,
193
193
  validateSkillPath
194
- } from "./index-8hkxm9mh.js";
194
+ } from "./index-srwp8fs7.js";
195
195
  import {
196
196
  authorizeCuration,
197
197
  buildConfigFingerprintInput
198
- } from "./index-bmaz2yy4.js";
198
+ } from "./index-4sdhbxgq.js";
199
199
  import {
200
200
  cohortConfigFingerprint
201
201
  } from "./index-rtry5xyf.js";
@@ -219,7 +219,7 @@ import {
219
219
  scanBackgroundCoderReservationsForAdmission,
220
220
  scanDelegationsForRecovery,
221
221
  sweepStaleDelegations
222
- } from "./index-n6jykega.js";
222
+ } from "./index-vy6q9d8j.js";
223
223
  import {
224
224
  WORKTREE_LIFECYCLE_LOCK_FILE,
225
225
  recordWorktreeProvisioningOwner,
@@ -252,18 +252,18 @@ import {
252
252
  transitionTaskWorkflowEvidence,
253
253
  withTaskEvidenceTransaction,
254
254
  writeWorkflowWalFile
255
- } from "./index-5q5ws00e.js";
255
+ } from "./index-jg2gwzvq.js";
256
256
  import {
257
257
  provisionWorktree,
258
258
  removeWorktree
259
- } from "./index-mza55jmc.js";
259
+ } from "./index-t994f8fp.js";
260
260
  import {
261
261
  MAX_PENDING_SCOPE_BINDINGS,
262
262
  canonicalWorkspaceIdentity,
263
263
  clearAllScopes,
264
264
  clearScopeBindingFromDisk,
265
265
  clearScopeBindings
266
- } from "./index-79pwr8hc.js";
266
+ } from "./index-fc4x86sy.js";
267
267
  import {
268
268
  appendLedgerEvent,
269
269
  computePlanHash,
@@ -278,7 +278,7 @@ import {
278
278
  readPlanEpochIdentity,
279
279
  replayFromLedgerWithStatus,
280
280
  takeSnapshotEvent
281
- } from "./index-6thxr1q7.js";
281
+ } from "./index-1aztaa2s.js";
282
282
  import {
283
283
  CORE_EVENT_LOCKED,
284
284
  appendCoreEventSync,
@@ -288,7 +288,7 @@ import {
288
288
  hasSpecDriftAuditEvent,
289
289
  hasTaskRepairAuditEvent,
290
290
  readCoreEvents
291
- } from "./index-c83bztkp.js";
291
+ } from "./index-exn0ztsv.js";
292
292
  import {
293
293
  isPathWithinDeclaredScope,
294
294
  sanitizeDiagnosticText
@@ -340,7 +340,7 @@ import {
340
340
  transactFile,
341
341
  transactKnowledge,
342
342
  wordBigrams
343
- } from "./index-01q7mb83.js";
343
+ } from "./index-mdwtj4xm.js";
344
344
  import {
345
345
  MAX_EVENT_LOG_ENTRIES,
346
346
  _internals as _internals2,
@@ -354,10 +354,10 @@ import {
354
354
  recordKnowledgeEvent,
355
355
  recordPhaseCloseIntent,
356
356
  resolveKnowledgeEventsPath
357
- } from "./index-pgfn8h50.js";
357
+ } from "./index-xe83cwvn.js";
358
358
  import {
359
359
  resolveWorktreeIsolationConfig
360
- } from "./index-xdp0bx28.js";
360
+ } from "./index-38ema5k2.js";
361
361
  import {
362
362
  RetrospectiveEvidenceSchema
363
363
  } from "./index-gprxjmm7.js";
@@ -379,7 +379,7 @@ import {
379
379
  init_loader,
380
380
  loadPluginConfig,
381
381
  loadPluginConfigWithMeta
382
- } from "./index-q8e2yd98.js";
382
+ } from "./index-cqhf7fkw.js";
383
383
  import {
384
384
  DEFAULT_SKILL_OPT_CONFIG,
385
385
  FALLBACK_MODELS_MAX,
@@ -393,7 +393,7 @@ import {
393
393
  package_default,
394
394
  resolveAutoReviewConfig,
395
395
  stripKnownSwarmPrefix
396
- } from "./index-41n0thtd.js";
396
+ } from "./index-pf22x0dr.js";
397
397
  import {
398
398
  AGENT_TOOL_MAP,
399
399
  ALL_AGENT_NAMES,
@@ -433,10 +433,10 @@ import {
433
433
  resolveLinkDir,
434
434
  sanitizeLinkId,
435
435
  writeLinkPointer
436
- } from "./index-c1h0rdkr.js";
436
+ } from "./index-jb9tb1sd.js";
437
437
  import {
438
438
  atomicWriteFile
439
- } from "./index-cfvbd3dg.js";
439
+ } from "./index-apwcvfjt.js";
440
440
  import {
441
441
  KNOWLEDGE_SCHEMA_VERSION,
442
442
  OUTCOME_BLOCK_THRESHOLD,
@@ -448,7 +448,7 @@ import {
448
448
  atomicWriteSwarmFileSync,
449
449
  matchTempGrammar,
450
450
  parseTargetBasename
451
- } from "./index-ame8ek9g.js";
451
+ } from "./index-dtmgt2xn.js";
452
452
  import {
453
453
  assertProjectRoot,
454
454
  hasExplicitProjectBoundary,
@@ -456,12 +456,12 @@ import {
456
456
  listActiveLocks,
457
457
  tryAcquireLock,
458
458
  withEvidenceLock
459
- } from "./index-a90c1gtn.js";
459
+ } from "./index-m8dn0qnm.js";
460
460
  import {
461
461
  emit,
462
462
  getLastHeartbeat,
463
463
  telemetry
464
- } from "./index-wj0gnab0.js";
464
+ } from "./index-xggpmtfx.js";
465
465
  import {
466
466
  require_proper_lockfile
467
467
  } from "./index-7g4c7s5r.js";
@@ -599,6 +599,7 @@ function formatLegacyQaBindingRecovery(identity, retryAction) {
599
599
  }
600
600
 
601
601
  // src/db/qa-gate-profile.ts
602
+ init_logger();
602
603
  var _internals5 = {
603
604
  getProfile,
604
605
  getProfileLookupForIdentity,
@@ -826,7 +827,9 @@ function hasAnyProfileWithEnabledGate(directory, gate) {
826
827
  const parsed = JSON.parse(row.gates);
827
828
  if (parsed?.[gate] === true)
828
829
  return true;
829
- } catch {}
830
+ } catch (err) {
831
+ warn(`[qa-gate-profile] skipping unparseable qa_gate_profile row while checking gate "${gate}": ${err instanceof Error ? err.message : String(err)}`);
832
+ }
830
833
  }
831
834
  return false;
832
835
  }
@@ -5596,7 +5599,7 @@ async function cleanupRecoveredWorktree(directory, descriptor) {
5596
5599
  awaitingMergeByCallID,
5597
5600
  cleanupStandardWorktreeForCallId,
5598
5601
  standardWorktreeByCallID
5599
- } = await import("./worktree-isolation-pbr4d5m9.js");
5602
+ } = await import("./worktree-isolation-1hwwfbdw.js");
5600
5603
  standardWorktreeByCallID.delete(descriptor.callID);
5601
5604
  if (hasResidue)
5602
5605
  awaitingMergeByCallID.set(descriptor.callID, {
@@ -5698,7 +5701,7 @@ async function recoverCoderSettlement(directory, taskId) {
5698
5701
  awaitingMergeByCallID,
5699
5702
  finishStandardWorktreeDispatch,
5700
5703
  standardWorktreeByCallID
5701
- } = await import("./worktree-isolation-pbr4d5m9.js");
5704
+ } = await import("./worktree-isolation-1hwwfbdw.js");
5702
5705
  const descriptor = wal.worktree;
5703
5706
  const reconstructedDispatch = {
5704
5707
  callID: descriptor.callID,
@@ -6576,6 +6579,69 @@ function repairCleanEvidencePipes(text) {
6576
6579
  return { text: lines.join(`
6577
6580
  `), repaired };
6578
6581
  }
6582
+ function escapeCandidateField(value) {
6583
+ return value.trim().replace(/\|/g, "\\|");
6584
+ }
6585
+ function repairCandidateEvidencePipes(text, family) {
6586
+ let repaired = false;
6587
+ const lines = text.split(/\r?\n/).map((line) => {
6588
+ const fields = splitPipeFields(line);
6589
+ if (fields[0]?.trim() !== CANDIDATE_MARKER || fields.length <= CANDIDATE_FIELD_COUNT + 1 || fields.length > CANDIDATE_FIELD_COUNT + 17 || !isCandidateConfidence(fields.at(-1)?.trim())) {
6590
+ return line;
6591
+ }
6592
+ const normalized = fields.map(escapeCandidateField);
6593
+ const overflowEvidence = family === "base_explorer" ? normalized.slice(7, -2) : normalized.slice(8, -1);
6594
+ if (overflowEvidence.length < 3 || overflowEvidence.some((fragment) => fragment.length < 4)) {
6595
+ return line;
6596
+ }
6597
+ const rebuilt = family === "base_explorer" ? [
6598
+ ...normalized.slice(0, 7),
6599
+ overflowEvidence.join(" \\| "),
6600
+ ...normalized.slice(-2)
6601
+ ] : [
6602
+ ...normalized.slice(0, 8),
6603
+ overflowEvidence.join(" \\| "),
6604
+ normalized.at(-1) ?? ""
6605
+ ];
6606
+ if (rebuilt.length !== CANDIDATE_FIELD_COUNT + 1)
6607
+ return line;
6608
+ repaired = true;
6609
+ return rebuilt.join(" | ");
6610
+ });
6611
+ return { text: lines.join(`
6612
+ `), repaired };
6613
+ }
6614
+ function resynchronizeLateCanonicalHeader(text, family) {
6615
+ const lines = text.split(/\r?\n/);
6616
+ const firstMarker = lines.findIndex((line) => {
6617
+ const marker = splitPipeFields(line)[0]?.trim();
6618
+ return marker === CANDIDATE_MARKER || marker === CLEAN_MARKER;
6619
+ });
6620
+ if (firstMarker < 0 || !analyzeCandidateLine(lines[firstMarker], family)?.valid) {
6621
+ return { text, repaired: false };
6622
+ }
6623
+ const headerIndexes = lines.flatMap((line, index) => line.trim() === CANDIDATE_HEADERS[family] ? [index] : []);
6624
+ if (!headerIndexes.some((index) => index > firstMarker)) {
6625
+ return { text, repaired: false };
6626
+ }
6627
+ if (declaredCanonicalFamilies(text).some((declared) => declared !== family)) {
6628
+ return { text, repaired: false };
6629
+ }
6630
+ const withoutHeaders = lines.filter((_line, index) => !headerIndexes.includes(index));
6631
+ const insertion = withoutHeaders.findIndex((line) => {
6632
+ const marker = splitPipeFields(line)[0]?.trim();
6633
+ return marker === CANDIDATE_MARKER || marker === CLEAN_MARKER;
6634
+ });
6635
+ return {
6636
+ text: [
6637
+ ...withoutHeaders.slice(0, insertion),
6638
+ CANDIDATE_HEADERS[family],
6639
+ ...withoutHeaders.slice(insertion)
6640
+ ].join(`
6641
+ `),
6642
+ repaired: true
6643
+ };
6644
+ }
6579
6645
  function isStrictProtocolDataLine(line, family) {
6580
6646
  const clean = repairRedundantCleanConfidenceLine(line, family).line;
6581
6647
  const fields = splitPipeFields(clean).map((field) => field.trim());
@@ -6644,7 +6710,15 @@ function normalizeCandidateArtifact(rawText, fallbackFamily) {
6644
6710
  const pipeRepair = repairCleanEvidencePipes(cleanRepair.text);
6645
6711
  if (pipeRepair.repaired)
6646
6712
  repairKinds.push("clean-evidence-pipe-tail-merge");
6647
- const duplicateHeaderDrop = dropDuplicateHeaderRows(pipeRepair.text);
6713
+ const candidatePipeRepair = repairCandidateEvidencePipes(pipeRepair.text, fallbackFamily);
6714
+ if (candidatePipeRepair.repaired) {
6715
+ repairKinds.push("candidate-evidence-pipe-recovery-lossy");
6716
+ }
6717
+ const lateHeaderRepair = resynchronizeLateCanonicalHeader(candidatePipeRepair.text, fallbackFamily);
6718
+ if (lateHeaderRepair.repaired) {
6719
+ repairKinds.push("late-canonical-header-resynchronized");
6720
+ }
6721
+ const duplicateHeaderDrop = dropDuplicateHeaderRows(lateHeaderRepair.text);
6648
6722
  if (duplicateHeaderDrop.dropped) {
6649
6723
  repairKinds.push("duplicate-header-row-dropped");
6650
6724
  }
@@ -7680,13 +7754,24 @@ var PrReviewHandoffSchema = exports_external.object({
7680
7754
  summary: exports_external.string().trim().min(1).max(20000),
7681
7755
  provenance: exports_external.array(exports_external.string().trim().min(1).max(4000)).min(1).max(1000)
7682
7756
  }).strict();
7757
+ var PrReviewPartialBaseCoverageSchema = exports_external.object({
7758
+ missing_dimension: exports_external.enum([
7759
+ "intent-architecture",
7760
+ "correctness-state",
7761
+ "tests-falsifiability",
7762
+ "security-trust",
7763
+ "reliability-performance",
7764
+ "compatibility-delivery"
7765
+ ])
7766
+ }).strict();
7683
7767
  var WritePrReviewArtifactArgsSchema = exports_external.discriminatedUnion("kind", [
7684
7768
  exports_external.object({
7685
7769
  kind: exports_external.literal("findings"),
7686
7770
  run_id: PrReviewRunIdSchema.optional(),
7687
7771
  pr_head_sha: exports_external.string().trim().regex(/^[0-9a-f]{6,64}$/i),
7688
7772
  boundary: exports_external.enum(PR_REVIEW_ARTIFACT_BOUNDARIES),
7689
- records: exports_external.array(PrReviewFindingSchema).min(1).max(1000)
7773
+ records: exports_external.array(PrReviewFindingSchema).min(1).max(1000),
7774
+ partial_base_coverage: PrReviewPartialBaseCoverageSchema.optional()
7690
7775
  }).strict(),
7691
7776
  exports_external.object({
7692
7777
  kind: exports_external.literal("handoff"),
@@ -7695,6 +7780,13 @@ var WritePrReviewArtifactArgsSchema = exports_external.discriminatedUnion("kind"
7695
7780
  handoff: PrReviewHandoffSchema
7696
7781
  }).strict()
7697
7782
  ]).superRefine((value, ctx) => {
7783
+ if (value.kind === "findings" && value.partial_base_coverage !== undefined && value.boundary !== "post_explorer") {
7784
+ ctx.addIssue({
7785
+ code: "custom",
7786
+ path: ["partial_base_coverage"],
7787
+ message: "is valid only for the post_explorer boundary"
7788
+ });
7789
+ }
7698
7790
  const bytes = serializedPrReviewArtifactInputBytes(value);
7699
7791
  const maxBytes = value.kind === "findings" ? PR_REVIEW_FINDINGS_WRITE_MAX_BYTES : PR_REVIEW_HANDOFF_WRITE_MAX_BYTES;
7700
7792
  if (bytes > maxBytes) {
@@ -8529,6 +8621,15 @@ var PrReviewResilienceStateRecordSchema = exports_external.object({
8529
8621
  attempts: exports_external.array(PrReviewResilienceAttemptRecordSchema).max(3),
8530
8622
  circuit: PrReviewResilienceCircuitRecordSchema.optional()
8531
8623
  }).strict();
8624
+ var PrReviewPartialBaseCoverageRecordSchema = exports_external.object({
8625
+ runId: exports_external.string().min(1).max(128),
8626
+ prHeadSha: exports_external.string().regex(/^[0-9a-f]{6,64}$/i),
8627
+ revisionDigest: exports_external.string().min(1).max(256),
8628
+ missingDimension: exports_external.enum(PR_REVIEW_BASE_DIMENSION_IDS),
8629
+ failureClass: exports_external.enum(["contract", "resource", "deadline"]),
8630
+ terminalEventId: exports_external.string().min(1).max(256),
8631
+ admittedAt: exports_external.string().datetime()
8632
+ }).strict();
8532
8633
  var PrFeedbackLaneOwnershipSchema = exports_external.object({
8533
8634
  laneId: exports_external.string().min(1),
8534
8635
  ownedItemIds: exports_external.array(exports_external.string().min(1)).min(1)
@@ -8681,6 +8782,7 @@ var PrWorkflowGateStateSchema = exports_external.object({
8681
8782
  prReviewBaseDispatches: exports_external.array(PrReviewBaseDispatchRecordSchema).max(MAX_WORKFLOW_BATCHES).optional(),
8682
8783
  prReviewBaseDispatch: PrReviewBaseDispatchRecordSchema.optional(),
8683
8784
  prReviewResilience: PrReviewResilienceStateRecordSchema.optional(),
8785
+ prReviewContractRetryDimensions: exports_external.array(PrReviewBaseDimensionIdSchema).max(PR_REVIEW_BASE_DIMENSION_IDS.length).optional(),
8684
8786
  prReviewTriggerLedger: exports_external.array(PrReviewInlineTriggerRowSchema).length(PR_REVIEW_REQUIRED_TRIGGER_IDS.length).optional(),
8685
8787
  prReviewTriggerEvalPath: exports_external.string().min(1).optional(),
8686
8788
  prReviewTriggerEvalRunId: exports_external.string().min(1).optional(),
@@ -8691,6 +8793,9 @@ var PrWorkflowGateStateSchema = exports_external.object({
8691
8793
  prReviewReservedRunId: exports_external.string().min(1).optional(),
8692
8794
  prReviewArtifactRunId: exports_external.string().min(1).optional(),
8693
8795
  prReviewFindingsPath: exports_external.string().min(1).optional(),
8796
+ prReviewPartialBaseCoverage: PrReviewPartialBaseCoverageRecordSchema.optional(),
8797
+ prReviewCoverageDisclosurePath: exports_external.string().min(1).max(512).optional(),
8798
+ prReviewCoverageDisclosureDigest: exports_external.string().regex(/^[0-9a-f]{64}$/).optional(),
8694
8799
  prReviewArtifactBoundaries: exports_external.array(exports_external.enum(["post_explorer", "post_reviewer", "post_critic"])).max(3).optional(),
8695
8800
  prReviewHandoffPath: exports_external.string().min(1).optional(),
8696
8801
  prReviewHandoffRequired: exports_external.boolean().optional(),
@@ -8817,13 +8922,6 @@ var PR_WORKFLOW_SWEEPABLE_LANE_STATUSES = new Set(["pending", "running"]);
8817
8922
  var CAS_ESCAPE_DISCLOSURE = "state revision unsalvageable; cleared without compare-and-swap";
8818
8923
  var PR_WORKFLOW_LANE_LIVENESS_PROBE_TIMEOUT_MS = 5000;
8819
8924
  var PR_WORKFLOW_PENDING_LIVENESS_THRESHOLD_MS = 3 * 60000;
8820
- var PR_WORKFLOW_PENDING_LIVENESS_MODES = new Set([
8821
- "swarm-pr-review:base",
8822
- "swarm-pr-review:micro",
8823
- "swarm-pr-review:council",
8824
- "swarm-pr-review:reviewer",
8825
- "swarm-pr-review:critic"
8826
- ]);
8827
8925
  var LIVE_SESSION_STATUS_TYPES = new Set([
8828
8926
  "busy",
8829
8927
  "retry"
@@ -9221,6 +9319,28 @@ async function assertPrFeedbackTrackingCheckout(directory, prHeadSha) {
9221
9319
  throw new Error(`BLOCKED: PR_FEEDBACK upstream "${attachedUpstream.remoteTrackingRef}" must point to the exact intake PR head "${prHeadSha}" before the first head bind`);
9222
9320
  }
9223
9321
  }
9322
+ function normalizeFailureSignatureText(value) {
9323
+ return value.toLowerCase().replace(/\b\d{4}-\d{2}-\d{2}t\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?(?:z|[+-]\d{2}:\d{2})\b/g, "<iso-timestamp>").replace(/\b\d{10,16}\b/g, "<epoch>").replace(/\b((?:session|request|trace|correlation|run)(?:[_-]?id)?)\s*[:=]\s*([a-z0-9._:-]*[0-9_-][a-z0-9._:-]*)\b/g, "$1=<id>").replace(/\b((?:session|sess|request|req|trace|correlation|corr|run)(?:[_-]?id)?)\s+((?:(?:sess?|req|trace|corr|run)[_-][a-z0-9._:-]+|[a-z][a-z0-9._:-]*\d[a-z0-9._:-]*))\b/g, "$1 <id>").replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/g, "<uuid>").replace(/\b[0-9a-f]{16,64}\b/g, "<hex>").replace(/[a-z]:\\[^\s)]+/gi, "<path>").replace(/(?:\/[\w.@:-]+)+/g, "<path>").replace(/\s+/g, " ").trim().slice(0, 160);
9324
+ }
9325
+ function classifyTerminalFailureSignature(record) {
9326
+ if (!TERMINAL_FAILED_DELEGATION_STATUSES.has(record.status))
9327
+ return null;
9328
+ const result = record.terminalResult?.result ?? record.result;
9329
+ if (!result)
9330
+ return `terminal-zero-output:${record.status}`;
9331
+ const outputRef = result.outputRef?.trim();
9332
+ const text = result.text?.trim() ?? "";
9333
+ if (!outputRef && text.length === 0 && (result.chars ?? 0) === 0) {
9334
+ return `terminal-zero-output:${record.status}`;
9335
+ }
9336
+ const errorText = result.error?.trim();
9337
+ if (errorText) {
9338
+ return `terminal-error-output:${record.status}:${normalizeFailureSignatureText(errorText)}`;
9339
+ }
9340
+ if (record.status === "completed")
9341
+ return null;
9342
+ return `terminal-nonzero-output:${record.status}`;
9343
+ }
9224
9344
  var TERMINAL_FAILED_DELEGATION_STATUSES = new Set([
9225
9345
  "completed",
9226
9346
  "error",
@@ -9276,6 +9396,40 @@ function minimumConsolidatedLaneCover(sets) {
9276
9396
  }
9277
9397
  return best[full];
9278
9398
  }
9399
+ var PR_REVIEW_COVERAGE_DISCLOSURE_MAX_BYTES = 4096;
9400
+ function coverageDisclosureRelativePath(runId) {
9401
+ return path12.join("pr-review", runId, "coverage-disclosure.json");
9402
+ }
9403
+ async function readAndVerifyCoverageDisclosure(directory, state) {
9404
+ const record = state.prReviewPartialBaseCoverage;
9405
+ const relativePath = state.prReviewCoverageDisclosurePath;
9406
+ const expectedDigest = state.prReviewCoverageDisclosureDigest;
9407
+ if (!record && !relativePath && !expectedDigest)
9408
+ return null;
9409
+ if (!record || !relativePath || !expectedDigest) {
9410
+ throw new Error("BLOCKED: PR_REVIEW partial base coverage disclosure state is incomplete");
9411
+ }
9412
+ const expectedPath = coverageDisclosureRelativePath(record.runId).split(path12.sep).join("/");
9413
+ if (relativePath !== expectedPath) {
9414
+ throw new Error("BLOCKED: PR_REVIEW partial base coverage disclosure path does not match its bound run");
9415
+ }
9416
+ const raw = await readBoundedSwarmRegularFile(directory, relativePath, PR_REVIEW_COVERAGE_DISCLOSURE_MAX_BYTES, "PR_REVIEW partial base coverage disclosure");
9417
+ const digest = createHash5("sha256").update(raw, "utf8").digest("hex");
9418
+ if (digest !== expectedDigest) {
9419
+ throw new Error("BLOCKED: PR_REVIEW partial base coverage disclosure digest does not match durable state");
9420
+ }
9421
+ let decoded;
9422
+ try {
9423
+ decoded = JSON.parse(raw);
9424
+ } catch {
9425
+ throw new Error("BLOCKED: PR_REVIEW partial base coverage disclosure is invalid JSON");
9426
+ }
9427
+ const parsed = PrReviewPartialBaseCoverageRecordSchema.safeParse(decoded);
9428
+ if (!parsed.success || JSON.stringify(parsed.data) !== JSON.stringify(record)) {
9429
+ throw new Error("BLOCKED: PR_REVIEW partial base coverage disclosure does not match durable state");
9430
+ }
9431
+ return record;
9432
+ }
9279
9433
  async function assertPrReviewBaseCoverageSettled(directory, sessionID, gateContext) {
9280
9434
  const state = await requireBoundState(directory, sessionID, "PR_REVIEW");
9281
9435
  const batches = state.prReviewBaseDispatches ?? [];
@@ -9293,6 +9447,10 @@ async function assertPrReviewBaseCoverageSettled(directory, sessionID, gateConte
9293
9447
  }
9294
9448
  const missing = PR_REVIEW_BASE_DIMENSION_IDS.filter((dimension) => !covered.has(dimension));
9295
9449
  if (missing.length > 0 || covered.size !== PR_REVIEW_BASE_DIMENSION_IDS.length) {
9450
+ const disclosure = await readAndVerifyCoverageDisclosure(directory, state);
9451
+ if (disclosure && missing.length === 1 && covered.size === PR_REVIEW_BASE_DIMENSION_IDS.length - 1 && disclosure.missingDimension === missing[0] && disclosure.prHeadSha === state.prHeadSha && disclosure.revisionDigest === ctx.revisionDigest && disclosure.runId === (state.prReviewArtifactRunId ?? state.prReviewReservedRunId)) {
9452
+ return state;
9453
+ }
9296
9454
  throw new Error(`BLOCKED: PR_REVIEW base coverage is incomplete; missing dimensions: ${missing.join(", ") || "(none)"}${malformedDiagnostics.length > 0 ? `; first failed lane predicates: ${malformedDiagnostics.join(" | ")}` : ""}; valid dimensions: ${PR_REVIEW_BASE_DIMENSION_IDS.join(", ")}; expected candidate row: ${CANDIDATE_HEADERS.base_explorer}; expected clean row: ${CLEAN_TEMPLATES.base_explorer}`);
9297
9455
  }
9298
9456
  return state;
@@ -9794,6 +9952,7 @@ async function transitionPrReviewToFeedback(directory, sessionID, request) {
9794
9952
  }));
9795
9953
  }
9796
9954
  var _test_exports2 = {
9955
+ classifyTerminalFailureSignature,
9797
9956
  minimumConsolidatedLaneCover,
9798
9957
  analyzePrReviewBatchRecordIntegrity,
9799
9958
  MAX_COVER_UNIVERSE_BITS,
@@ -13089,6 +13248,7 @@ async function computeGateStatistics(directory, minSamples = 6, runId) {
13089
13248
  }
13090
13249
 
13091
13250
  // src/services/cost-accounting.ts
13251
+ init_logger();
13092
13252
  import * as fs8 from "fs";
13093
13253
  import * as os from "os";
13094
13254
  import * as path15 from "path";
@@ -13121,11 +13281,17 @@ function readTelemetryEvents(directory) {
13121
13281
  }
13122
13282
  } catch {}
13123
13283
  const events = [];
13284
+ let unreadableSnapshots = 0;
13285
+ let firstUnreadableReason = "";
13124
13286
  for (const file of snapshotFiles) {
13125
13287
  let content = "";
13126
13288
  try {
13127
13289
  content = fs8.readFileSync(file, "utf-8");
13128
- } catch {
13290
+ } catch (err) {
13291
+ unreadableSnapshots += 1;
13292
+ if (!firstUnreadableReason) {
13293
+ firstUnreadableReason = err instanceof Error ? err.message : String(err);
13294
+ }
13129
13295
  continue;
13130
13296
  }
13131
13297
  for (const line of content.split(/\r?\n/)) {
@@ -13139,6 +13305,9 @@ function readTelemetryEvents(directory) {
13139
13305
  } catch {}
13140
13306
  }
13141
13307
  }
13308
+ if (unreadableSnapshots > 0) {
13309
+ warn(`[cost-accounting] ${unreadableSnapshots} of ${snapshotFiles.length} snapshot file(s) were unreadable; cost totals undercount. First reason: ${firstUnreadableReason}`);
13310
+ }
13142
13311
  try {
13143
13312
  for (const f of snapshotFiles) {
13144
13313
  try {
@@ -16121,8 +16290,40 @@ function redactUrl(match) {
16121
16290
  return `<url:${hashValue(match).slice(0, 12)}>`;
16122
16291
  }
16123
16292
  }
16293
+ var FILL_MAX_RUN = 8;
16294
+ var FILL = `[\\s\\p{Cc}\\p{Cf}\\p{Default_Ignorable_Code_Point}]{0,${FILL_MAX_RUN}}`;
16295
+ var CONTROL_CHAR_RUN = /[\p{Cc}\p{Cf}\p{Default_Ignorable_Code_Point}]+/gu;
16296
+ var MAX_SANITIZE_INPUT_CHARS = MAX_DISPLAY_BYTES * 8;
16297
+ function tolerantKeyword(word) {
16298
+ return word.split("").join(FILL);
16299
+ }
16300
+ var CREDENTIAL_KEYWORDS_LOWER = [
16301
+ "bearer",
16302
+ "token",
16303
+ "secret",
16304
+ "password",
16305
+ "authorization"
16306
+ ].map(tolerantKeyword);
16307
+ var API_KEY_PATTERN = `${tolerantKeyword("api")}${FILL}[_-]?${FILL}${tolerantKeyword("key")}`;
16308
+ var CREDENTIAL_KEYWORD_ALTERNATION = `(?:${API_KEY_PATTERN}|${CREDENTIAL_KEYWORDS_LOWER.join("|")})`;
16309
+ var SCREAMING_SUFFIXES = ["TOKEN", "KEY", "SECRET", "PASSWORD", "AUTH"];
16310
+ var TOLERANT_BEARER_PREFIX = tolerantKeyword("Bearer");
16311
+ var CREDENTIAL_KV_PATTERN = new RegExp(`\\b(${CREDENTIAL_KEYWORD_ALTERNATION})\\b${FILL}[:=]${FILL}(?:${TOLERANT_BEARER_PREFIX}${FILL})?[^\\s,;]+`, "giu");
16312
+ var SCREAMING_KEY_HORIZONTAL_FILL_CHARS = "\\x00-\\x09\\x0e-\\x1f\\x7f-\\x9f\\p{Zs}\\p{Cf}\\p{Default_Ignorable_Code_Point}";
16313
+ var SCREAMING_KV_CANDIDATE_PATTERN = new RegExp(`\\b([A-Z0-9_${SCREAMING_KEY_HORIZONTAL_FILL_CHARS}]{1,80})${FILL}=${FILL}([^\\s]+)`, "gu");
16314
+ function screamingKeyContainsSuffix(key) {
16315
+ const stripped = key.replace(CONTROL_CHAR_RUN, "").replace(/\s+/g, "");
16316
+ return SCREAMING_SUFFIXES.some((suffix) => stripped.includes(suffix));
16317
+ }
16124
16318
  function sanitizeFailureEvidenceDisplay(value) {
16125
- const redacted = value.replace(/\bhttps?:\/\/[^\s'"<>]+/gi, (match) => redactUrl(match)).replace(/\b((?:api[_-]?key|bearer|token|secret|password|authorization))\b\s*[:=]\s*(?:Bearer\s+)?[^\s,;]+/gi, (_, key) => `${key}=<redacted>`).replace(/\b([A-Z][A-Z0-9_]*(?:TOKEN|KEY|SECRET|PASSWORD|AUTH)[A-Z0-9_]*)=([^\s]+)/g, (_, key) => `${key}=<redacted>`);
16319
+ const bounded = value.slice(0, MAX_SANITIZE_INPUT_CHARS);
16320
+ const redacted = bounded.replace(/\bhttps?:\/\/[^\s'"<>]+/gi, (match) => redactUrl(match)).replace(CREDENTIAL_KV_PATTERN, (_, key) => {
16321
+ return `${key.replace(CONTROL_CHAR_RUN, "")}=<redacted>`;
16322
+ }).replace(SCREAMING_KV_CANDIDATE_PATTERN, (match, key) => {
16323
+ if (!screamingKeyContainsSuffix(key))
16324
+ return match;
16325
+ return `${key.replace(CONTROL_CHAR_RUN, "").replace(/\s+/g, "")}=<redacted>`;
16326
+ }).replace(CONTROL_CHAR_RUN, " ");
16126
16327
  return boundedUtf8(redacted.trim());
16127
16328
  }
16128
16329
  function signalFrom(value) {
@@ -18302,7 +18503,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
18302
18503
  };
18303
18504
  }
18304
18505
  async function sweepActiveNearDuplicates(directory, options = {}) {
18305
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-hbhw2qd7.js");
18506
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-yjj3s8af.js");
18306
18507
  const { config } = loadPluginConfigWithMeta2(directory);
18307
18508
  const sweepConfig = config.learning?.dedup_sweep;
18308
18509
  if (sweepConfig?.enabled === false)
@@ -19432,7 +19633,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
19432
19633
  }
19433
19634
  if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
19434
19635
  try {
19435
- const skillModule = await import("./skill-generator-esrn40th.js");
19636
+ const skillModule = await import("./skill-generator-pk9gcz7r.js");
19436
19637
  for (const cand of skillCandidates) {
19437
19638
  if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
19438
19639
  continue;
@@ -19904,7 +20105,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
19904
20105
  } catch {}
19905
20106
  }
19906
20107
  if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
19907
- const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-ty2kesdj.js");
20108
+ const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-whkxxgxj.js");
19908
20109
  for (const { id } of contradictedEntries) {
19909
20110
  try {
19910
20111
  await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
@@ -20723,7 +20924,7 @@ async function runCuratorPostMortem(directory, options = {}) {
20723
20924
  warnings.push("Failed to collect knowledge summary.");
20724
20925
  }
20725
20926
  try {
20726
- const { getScanStatus } = await import("./scan-cursor-3ba1spad.js");
20927
+ const { getScanStatus } = await import("./scan-cursor-0p51fh61.js");
20727
20928
  const scanStatus = await getScanStatus(directory);
20728
20929
  if (scanStatus.remaining_estimate > 0) {
20729
20930
  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.`);
@@ -20895,9 +21096,9 @@ var _internals26 = {
20895
21096
  verifyPostMortemKnowledgeActions,
20896
21097
  repairPostMortemActions,
20897
21098
  loadDefaultKnowledgeConfig: async (directory) => {
20898
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-h251vmd1.js");
21099
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-8g2nxhjf.js");
20899
21100
  try {
20900
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-hbhw2qd7.js");
21101
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-yjj3s8af.js");
20901
21102
  const loaded = loadPluginConfigWithMeta2(directory);
20902
21103
  return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
20903
21104
  } catch {
@@ -20905,11 +21106,11 @@ var _internals26 = {
20905
21106
  }
20906
21107
  },
20907
21108
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
20908
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-6w4frzdz.js");
21109
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-f5m0hh2p.js");
20909
21110
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
20910
21111
  },
20911
21112
  checkHivePromotions: async (entries, knowledgeConfig, directory) => {
20912
- const { checkHivePromotions } = await import("./hive-promoter-32artf8c.js");
21113
+ const { checkHivePromotions } = await import("./hive-promoter-162ws6xp.js");
20913
21114
  return checkHivePromotions(entries, knowledgeConfig, directory);
20914
21115
  },
20915
21116
  applyProposalTriage: async (directory, triage) => {
@@ -20918,7 +21119,7 @@ var _internals26 = {
20918
21119
  activateProposal,
20919
21120
  listSkills: listSkills2,
20920
21121
  sanitizeSlug
20921
- } = await import("./skill-generator-esrn40th.js");
21122
+ } = await import("./skill-generator-pk9gcz7r.js");
20922
21123
  const result = {
20923
21124
  approved: [],
20924
21125
  rejected: [],
@@ -22248,9 +22449,9 @@ function hashContent(content) {
22248
22449
  return createHash10("sha1").update(content).digest("hex");
22249
22450
  }
22250
22451
  async function loadConfigForPolicyCurator(directory) {
22251
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-h251vmd1.js");
22452
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-8g2nxhjf.js");
22252
22453
  try {
22253
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-hbhw2qd7.js");
22454
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-yjj3s8af.js");
22254
22455
  const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
22255
22456
  return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
22256
22457
  } catch {
@@ -29894,7 +30095,8 @@ function gatherToolProblems(toolAggregates) {
29894
30095
  failureCount: agg.failureCount,
29895
30096
  totalCalls: agg.count,
29896
30097
  failureRate: Math.round(failureRate * 100) / 100,
29897
- avgDurationMs: Math.round(agg.totalDuration / agg.count)
30098
+ avgDurationMs: Math.round(agg.totalDuration / agg.count),
30099
+ ...agg.failureReasons && agg.failureReasons.length > 0 ? { failureReasons: agg.failureReasons } : {}
29898
30100
  });
29899
30101
  }
29900
30102
  }
@@ -30205,6 +30407,9 @@ function buildReflectionDataSummary(data) {
30205
30407
  lines.push("TOOL PROBLEMS (tools with >20% failure rate or >2 failures):");
30206
30408
  for (const p of data.toolProblems) {
30207
30409
  lines.push(` - ${p.tool}: ${p.failureCount}/${p.totalCalls} failures (${Math.round(p.failureRate * 100)}%), avg ${p.avgDurationMs}ms`);
30410
+ if (p.failureReasons && p.failureReasons.length > 0) {
30411
+ lines.push(` reasons: ${p.failureReasons.join("; ")}`);
30412
+ }
30208
30413
  }
30209
30414
  lines.push("");
30210
30415
  }
@@ -30320,7 +30525,7 @@ function buildSignalsBlock(data) {
30320
30525
  if (p.failureCount > 0) {
30321
30526
  reproBacked.push({
30322
30527
  title: `Tool ${p.tool} failing (${p.failureCount}/${p.totalCalls}, ${Math.round(p.failureRate * 100)}%)`,
30323
- evidence: `tool failure rate ${Math.round(p.failureRate * 100)}% (${p.failureCount}/${p.totalCalls})`
30528
+ evidence: `tool failure rate ${Math.round(p.failureRate * 100)}% (${p.failureCount}/${p.totalCalls})${p.failureReasons && p.failureReasons.length > 0 ? `; reasons: ${p.failureReasons.join("; ")}` : ""}`
30324
30529
  });
30325
30530
  }
30326
30531
  }
@@ -30463,6 +30668,9 @@ function buildDeterministicReport(data) {
30463
30668
  lines.push("");
30464
30669
  for (const p of data.toolProblems) {
30465
30670
  lines.push(`- **${p.tool}**: ${p.failureCount}/${p.totalCalls} failures (${Math.round(p.failureRate * 100)}%), avg ${p.avgDurationMs}ms per call`);
30671
+ if (p.failureReasons && p.failureReasons.length > 0) {
30672
+ lines.push(` - reasons: ${p.failureReasons.join("; ")}`);
30673
+ }
30466
30674
  }
30467
30675
  lines.push("");
30468
30676
  }
@@ -33450,7 +33658,7 @@ async function runFinalizeStage(ctx) {
33450
33658
  }
33451
33659
  }
33452
33660
  try {
33453
- const { CuratorConfigSchema: CCS } = await import("./schema-h251vmd1.js");
33661
+ const { CuratorConfigSchema: CCS } = await import("./schema-8g2nxhjf.js");
33454
33662
  const { config: pmLoadedConfig } = _internals41.loadPluginConfigWithMeta(ctx.directory);
33455
33663
  const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
33456
33664
  if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
@@ -34320,7 +34528,7 @@ var _internals41 = {
34320
34528
  closePlanTerminalState: reconcileCloseTerminalStateForPlan,
34321
34529
  endAgentSession,
34322
34530
  flushAndDrainTelemetry: async () => {
34323
- const { flushAndDrainTelemetry } = await import("./telemetry-jtq6px7k.js");
34531
+ const { flushAndDrainTelemetry } = await import("./telemetry-5deacb7w.js");
34324
34532
  return flushAndDrainTelemetry();
34325
34533
  },
34326
34534
  finalizeContextTelemetry: (directory) => {
@@ -35652,9 +35860,9 @@ var _internals45 = {
35652
35860
  loadPluginConfigWithMeta,
35653
35861
  loadCuratorDeps: async () => {
35654
35862
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
35655
- import("./schema-h251vmd1.js"),
35656
- import("./curator-6w4frzdz.js"),
35657
- import("./curator-llm-factory-8fstpeqh.js")
35863
+ import("./schema-8g2nxhjf.js"),
35864
+ import("./curator-f5m0hh2p.js"),
35865
+ import("./curator-llm-factory-mzh9ns5s.js")
35658
35866
  ]);
35659
35867
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
35660
35868
  }
@@ -36644,7 +36852,7 @@ async function computeCurationDiagnostics(directory, entries) {
36644
36852
  let scanCompleted = false;
36645
36853
  let scanRemaining = 0;
36646
36854
  try {
36647
- const { getScanStatus } = await import("./scan-cursor-3ba1spad.js");
36855
+ const { getScanStatus } = await import("./scan-cursor-0p51fh61.js");
36648
36856
  const status = await getScanStatus(directory);
36649
36857
  scanGeneration = status.generation;
36650
36858
  scanCompleted = status.completed;
@@ -36652,19 +36860,19 @@ async function computeCurationDiagnostics(directory, entries) {
36652
36860
  } catch {}
36653
36861
  let configMatch = null;
36654
36862
  try {
36655
- const { isLinked: isLinked2 } = await import("./knowledge-link-a5f89833.js");
36863
+ const { isLinked: isLinked2 } = await import("./knowledge-link-mzn8x0qd.js");
36656
36864
  if (isLinked2(directory)) {
36657
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-h251vmd1.js");
36865
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-8g2nxhjf.js");
36658
36866
  let config;
36659
36867
  try {
36660
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-hbhw2qd7.js");
36868
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-yjj3s8af.js");
36661
36869
  const loaded = loadPluginConfigWithMeta2(directory);
36662
36870
  config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
36663
36871
  } catch {
36664
36872
  config = KnowledgeConfigSchema2.parse({});
36665
36873
  }
36666
36874
  const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
36667
- const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-4jxx3ey4.js");
36875
+ const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-nck9g765.js");
36668
36876
  const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
36669
36877
  const cohortFp = await readCohortConfigFingerprint(directory);
36670
36878
  configMatch = cohortFp === null ? null : currentFp === cohortFp;
@@ -37968,7 +38176,7 @@ async function handleDoctorCommand(directory, args) {
37968
38176
  const result = runConfigDoctor(config, directory);
37969
38177
  let output;
37970
38178
  if (enableAutoFix && result.hasAutoFixableIssues) {
37971
- const { runConfigDoctorWithFixes } = await import("./config-doctor-fx8d6pma.js");
38179
+ const { runConfigDoctorWithFixes } = await import("./config-doctor-d3nsq1nz.js");
37972
38180
  const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
37973
38181
  applyLossy: true
37974
38182
  });
@@ -38908,7 +39116,7 @@ async function handleEvidenceCommand(directory, args) {
38908
39116
  return formatTaskEvidenceMarkdown(evidenceData);
38909
39117
  }
38910
39118
  async function handleEvidenceSummaryCommand(directory) {
38911
- const { buildEvidenceSummary } = await import("./evidence-summary-service-x00z38n2.js");
39119
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-601x7ne7.js");
38912
39120
  const artifact = await buildEvidenceSummary(directory);
38913
39121
  if (!artifact) {
38914
39122
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -69319,7 +69527,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
69319
69527
  if (!input.dispatcher) {
69320
69528
  throw new Error("no evaluation dispatcher available (cannot run validation)");
69321
69529
  }
69322
- const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-9mnkfjw7.js");
69530
+ const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-1aygs98c.js");
69323
69531
  const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
69324
69532
  const result = await _internals95.evaluateCandidateV1({
69325
69533
  projectRoot: input.directory,
@@ -71354,7 +71562,7 @@ function buildDetailedHelp(commandName, entry) {
71354
71562
  async function handleHelpCommand(ctx) {
71355
71563
  const targetCommand = ctx.args.join(" ");
71356
71564
  if (!targetCommand) {
71357
- const { buildHelpText } = await import("./index-ka2vav7t.js");
71565
+ const { buildHelpText } = await import("./index-f53yyerg.js");
71358
71566
  return buildHelpText();
71359
71567
  }
71360
71568
  const tokens = targetCommand.split(/\s+/);
@@ -71363,7 +71571,7 @@ async function handleHelpCommand(ctx) {
71363
71571
  return _internals98.buildDetailedHelp(resolved.key, resolved.entry);
71364
71572
  }
71365
71573
  const similar = _internals98.findSimilarCommands(targetCommand);
71366
- const { buildHelpText: fullHelp } = await import("./index-ka2vav7t.js");
71574
+ const { buildHelpText: fullHelp } = await import("./index-f53yyerg.js");
71367
71575
  if (similar.length > 0) {
71368
71576
  return `Command '/swarm ${targetCommand}' not found.
71369
71577
 
@@ -71543,7 +71751,7 @@ var COMMAND_REGISTRY = {
71543
71751
  },
71544
71752
  "guardrail explain": {
71545
71753
  handler: async (ctx) => {
71546
- const { handleGuardrailExplain } = await import("./guardrail-explain-nynjhbzk.js");
71754
+ const { handleGuardrailExplain } = await import("./guardrail-explain-j291sss5.js");
71547
71755
  return handleGuardrailExplain(ctx.directory, ctx.args);
71548
71756
  },
71549
71757
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -71553,7 +71761,7 @@ var COMMAND_REGISTRY = {
71553
71761
  },
71554
71762
  "guardrail reset": {
71555
71763
  handler: async (ctx) => {
71556
- const { handleGuardrailReset } = await import("./guardrail-reset-hsfd5ykq.js");
71764
+ const { handleGuardrailReset } = await import("./guardrail-reset-tr07m077.js");
71557
71765
  return handleGuardrailReset(ctx.args, ctx.sessionID);
71558
71766
  },
71559
71767
  description: "Reset one exact active invocation/action circuit after repair",
@@ -71562,7 +71770,7 @@ var COMMAND_REGISTRY = {
71562
71770
  },
71563
71771
  "guardrail-explain": {
71564
71772
  handler: async (ctx) => {
71565
- const { handleGuardrailExplain } = await import("./guardrail-explain-nynjhbzk.js");
71773
+ const { handleGuardrailExplain } = await import("./guardrail-explain-j291sss5.js");
71566
71774
  return handleGuardrailExplain(ctx.directory, ctx.args);
71567
71775
  },
71568
71776
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -71572,7 +71780,7 @@ var COMMAND_REGISTRY = {
71572
71780
  },
71573
71781
  "guardrail-reset": {
71574
71782
  handler: async (ctx) => {
71575
- const { handleGuardrailReset } = await import("./guardrail-reset-hsfd5ykq.js");
71783
+ const { handleGuardrailReset } = await import("./guardrail-reset-tr07m077.js");
71576
71784
  return handleGuardrailReset(ctx.args, ctx.sessionID);
71577
71785
  },
71578
71786
  description: "Reset one exact active invocation/action circuit after repair",
@@ -71582,7 +71790,7 @@ var COMMAND_REGISTRY = {
71582
71790
  },
71583
71791
  "guardrail-log": {
71584
71792
  handler: async (ctx) => {
71585
- const { handleGuardrailLog } = await import("./guardrail-log-6bktj08e.js");
71793
+ const { handleGuardrailLog } = await import("./guardrail-log-1jykfrqc.js");
71586
71794
  return handleGuardrailLog(ctx.directory, ctx.args);
71587
71795
  },
71588
71796
  description: "Read the guardrail decision log (use --blocks-only for blocks)",
@@ -73516,6 +73724,7 @@ HARD CONSTRAINTS (apply regardless of skill load success):
73516
73724
  - Treat the controller Git-state result as final for the attempt: \`clean\` proceeds; \`stashable\` permits one preparation call; \`recovery-required\` or \`indeterminate\` means report the typed \`required_action\`, abort/clear any already-active gate, and STOP unless \`retryable: true\`. Never loop on stash against an unmerged index or in-progress Git operation.
73517
73725
  - RUN ALL BASE LANES: the default PR_REVIEW path covers all six repository-agnostic base dimensions from the skill on every PR. Use \`mode: "swarm-pr-review:base"\`, the exact \`workflow_lane\` identifiers, and the exact bound \`pr_head_sha\`. With the default \`pr_review_resilience\` policy enabled, depth tier M/L MUST stage attempt 0 as one singleton \`pr_review_wave_stage: "canary"\` batch followed by a \`"fanout"\` batch whose combined canary+fanout ownership partitions all six dimensions exactly once; tier L still requires six singleton combined lanes, and tier S keeps the legacy one-wave path. If a project disables \`pr_review_resilience\`, stay on the legacy one-wave base dispatch. The runtime rejects omitted stage metadata, partial, duplicate, mislabelled, or structurally invalid waves.
73518
73726
  - RETRY STRUCTURALLY: retry only unresolved failed base obligations in later \`swarm-pr-review:base\` async batches with the same exact \`pr_head_sha\`. Under staged resilience, attempts are numbered by \`pr_review_wave_attempt\`: attempt 0 plus at most two retry attempts (1 and 2), each with one singleton canary batch and then its matching fanout batch when obligations remain. Blocking \`dispatch_lanes\` and direct Task explorer/reviewer/critic dispatch are not provenance-equivalent and are rejected. If the runtime returns typed \`retry_exhausted\` or \`circuit_open\`, or if the second retry still cannot close coverage, collect every lane to settlement, do not probe downstream writers or micro lanes, call \`abort_pr_workflow\` with \`mode: "PR_REVIEW"\`, \`kind: "recovery"\`, and a non-empty one-line \`reason\` naming the failed lane or correlated failure and exhausted retries, then call \`prepare_pr_workflow_checkout\` with \`operation: "restore"\` before reporting the blocker.
73727
+ - RECOVER CONTRACT FAILURES EXPLICITLY: when collection reports \`workflow_lane_failure_class: "contract"\`, retry that one singleton base dimension once with \`pr_review_contract_retry: true\`; this retry is outside staged \`pr_review_wave_attempt\` accounting and cannot be combined with stage metadata. If exactly five base dimensions settle successfully and one dimension remains terminally failed with a typed \`contract\`, \`resource\`, or \`deadline\` class, the \`post_explorer\` findings write may explicitly submit \`partial_base_coverage: { missing_dimension: "<exact lane>" }\`. Never infer or omit this disclosure: the runtime verifies five-of-six, persists an immutable coverage receipt, and rejects any other partial shape.
73519
73728
  - USE ASYNC DISPATCH WITHOUT IDLING: each admissible base wave uses one \`dispatch_lanes_async\` call. With enabled tier-M/L staged resilience, this means one singleton canary call followed by one unresolved-only fanout call after canary admission; it never means one legacy call carrying the whole initial base wave. Record each \`batch_id\`, then keep doing non-dependent architect work while its lanes run. Poll with \`collect_lane_results\` without \`wait\` (or \`wait: false\`) to process settled lanes and continue independent work between polls; use \`wait: true\` only as the final join when no independent work remains.
73520
73729
  - EVALUATE ALL RISK FAMILIES: after the base explorer lanes settle, evaluate every repository-agnostic trigger row against the exact diff/context pack. Record applicable families as \`MATCHED\` and inapplicable families as provenance-free \`NOT_TRIGGERED\` with concrete absence evidence; \`unclassified-risk\` always remains \`MATCHED\`. Launch \`swarm-pr-review:micro\` lanes only for the \`MATCHED\` IDs. The first micro dispatch MUST pass the complete exact eleven-row \`trigger_evaluation\`, which freezes it for this session; any subsequent same-session micro batch may omit it and reuse the frozen ledger, while an explicitly supplied copy must remain exactly identical. Use each dispatched trigger ID as \`workflow_lane\`. Missing an evaluation row or a matched-family attestation is BLOCKED; a \`NOT_TRIGGERED\` family must not create a micro artifact.
73521
73730
  - RUN HEAD-BOUND VALIDATION: dispatch independent reviewers with \`mode: "swarm-pr-review:reviewer"\` and critics with \`mode: "swarm-pr-review:critic"\`, unique \`workflow_lane\` obligations, role-correct agents, and the same exact \`pr_head_sha\`. Critic dispatch is blocked until all declared reviewer obligations have successful artifacts.
@@ -78007,7 +78216,7 @@ function getDisplayBudget() {
78007
78216
  async function rehydratePrSubscriptions(sessionID, directory) {
78008
78217
  const map = new Map;
78009
78218
  try {
78010
- const { listActive: listActive2 } = await import("./pr-subscriptions-cpnwvc6y.js");
78219
+ const { listActive: listActive2 } = await import("./pr-subscriptions-q862pvz1.js");
78011
78220
  const records = await listActive2(directory);
78012
78221
  for (const record of records) {
78013
78222
  if (record.sessionID !== sessionID)
@@ -78423,7 +78632,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
78423
78632
  return extracted === expectedSessionId;
78424
78633
  }
78425
78634
  async function inspectStandardWorktreeCollisionOwnership(identity) {
78426
- const collisionOwnership = await import("./worktree-collision-ownership-r8j31h06.js");
78635
+ const collisionOwnership = await import("./worktree-collision-ownership-9v8e0dz7.js");
78427
78636
  return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
78428
78637
  }
78429
78638
  async function precreateStandardWorktreeSession(args) {
@@ -78571,7 +78780,7 @@ async function precreateStandardWorktreeSession(args) {
78571
78780
  const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, provisionResult.worktreePath);
78572
78781
  if (laneProfile) {
78573
78782
  try {
78574
- const { writeLaneProfileToDiskReal } = await import("./core-0v762txd.js");
78783
+ const { writeLaneProfileToDiskReal } = await import("./core-y9d858n6.js");
78575
78784
  await writeLaneProfileToDiskReal(provisionResult.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
78576
78785
  } catch {}
78577
78786
  }
@@ -79229,7 +79438,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
79229
79438
  }
79230
79439
  clearWorktreeMergeStatus(statusKey);
79231
79440
  try {
79232
- const { removeLaneProfileFromDiskReal } = await import("./core-0v762txd.js");
79441
+ const { removeLaneProfileFromDiskReal } = await import("./core-y9d858n6.js");
79233
79442
  await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
79234
79443
  } catch {}
79235
79444
  const state = serializationStateBySessionID.get(dispatch.parentSessionID);