opencode-swarm 7.171.0 → 7.171.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.
Files changed (79) hide show
  1. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  2. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  3. package/dist/cli/{coder-settlement-pn26zx36.js → coder-settlement-9e696204.js} +7 -7
  4. package/dist/cli/{config-doctor-jrhpq41y.js → config-doctor-zr748h4m.js} +2 -2
  5. package/dist/cli/{core-r0nbh1k2.js → core-aa3jmzcs.js} +1 -1
  6. package/dist/cli/{curation-policy-qemp257w.js → curation-policy-fakrpw5t.js} +4 -4
  7. package/dist/cli/{curator-drift-3ssjr0nx.js → curator-drift-r9r8gepb.js} +2 -2
  8. package/dist/cli/{curator-llm-factory-89yjg1m4.js → curator-llm-factory-nshzhgs4.js} +32 -32
  9. package/dist/cli/{curator-0g733bka.js → curator-xgpxtaf1.js} +32 -32
  10. package/dist/cli/{evidence-summary-service-4r7sqb2h.js → evidence-summary-service-5e2323zr.js} +13 -13
  11. package/dist/cli/{gate-evidence-f13tm63x.js → gate-evidence-5htpsr5y.js} +4 -4
  12. package/dist/cli/{guardrail-explain-kt4w2rt8.js → guardrail-explain-d0h0p73g.js} +33 -33
  13. package/dist/cli/{guardrail-log-18wdr04f.js → guardrail-log-heejmjce.js} +6 -6
  14. package/dist/cli/{guardrail-reset-795t6nah.js → guardrail-reset-rdqxeqy0.js} +32 -32
  15. package/dist/cli/{hive-promoter-gwtvg5vc.js → hive-promoter-n262tkm3.js} +32 -32
  16. package/dist/cli/{index-ttyvcxxb.js → index-04ph4jp2.js} +2 -2
  17. package/dist/cli/{index-9fxnn8xg.js → index-0caqxnby.js} +1 -1
  18. package/dist/cli/{index-ak3ca0nv.js → index-0yffa3np.js} +5 -5
  19. package/dist/cli/{index-xdw0m34m.js → index-11gz0few.js} +1 -1
  20. package/dist/cli/{index-wp0396m1.js → index-2ryy0cwt.js} +6 -6
  21. package/dist/cli/{index-sz75avt3.js → index-3jcp3zb6.js} +1 -1
  22. package/dist/cli/{index-k2cpsr0d.js → index-5a8q4qr5.js} +1 -1
  23. package/dist/cli/{index-znf55hyt.js → index-6k5aq7b9.js} +2 -2
  24. package/dist/cli/{index-zjkkz9qh.js → index-7hnjs7tf.js} +2 -2
  25. package/dist/cli/{index-4m7q9hqd.js → index-7qqwx64h.js} +5 -5
  26. package/dist/cli/{index-bvr0p6ns.js → index-95e3a9en.js} +1 -1
  27. package/dist/cli/{index-cravqkxf.js → index-9dz2ee2g.js} +55 -50
  28. package/dist/cli/{index-wy4txsws.js → index-9txyxbqc.js} +7 -7
  29. package/dist/cli/{index-npst1d4g.js → index-9vfp6g53.js} +34 -34
  30. package/dist/cli/{index-br3mvbsa.js → index-aa2eyfvr.js} +2 -2
  31. package/dist/cli/{index-4dpsvbdt.js → index-d79q2f8z.js} +3 -3
  32. package/dist/cli/{index-gxbesz2h.js → index-dsgc303n.js} +3 -3
  33. package/dist/cli/{index-7s5cm87j.js → index-e7yv4xw1.js} +2 -2
  34. package/dist/cli/{index-v3e19zzm.js → index-er6sk4e6.js} +1 -1
  35. package/dist/cli/{index-cex3emb2.js → index-evxd1art.js} +1 -1
  36. package/dist/cli/{index-mvcjc28t.js → index-f1rj1j8t.js} +279 -179
  37. package/dist/cli/{index-bernkwgf.js → index-g6nen3gt.js} +1 -1
  38. package/dist/cli/{index-sz9qnjd6.js → index-gq2zdxep.js} +5 -5
  39. package/dist/cli/{index-003d071j.js → index-j6rq132j.js} +6 -6
  40. package/dist/cli/{index-nmffafb0.js → index-jr6pypmj.js} +32 -32
  41. package/dist/cli/{index-cgpwjctj.js → index-kb66he4e.js} +1 -1
  42. package/dist/cli/{index-g93g1c5r.js → index-mazy938h.js} +1 -1
  43. package/dist/cli/{index-fdz0076x.js → index-nfs78aqj.js} +1 -1
  44. package/dist/cli/{index-d7yc4ys8.js → index-ph94evsh.js} +3 -3
  45. package/dist/cli/{index-dgpdnve5.js → index-q2yk70rs.js} +2 -1
  46. package/dist/cli/{index-0qa2cqyv.js → index-qcy7eg6z.js} +5 -5
  47. package/dist/cli/{index-7c0e181h.js → index-qdy4a48x.js} +1 -1
  48. package/dist/cli/{index-yj0qrgyc.js → index-r60cw2jt.js} +6 -6
  49. package/dist/cli/{index-b3nw1bzp.js → index-rrc08h4q.js} +3 -3
  50. package/dist/cli/{index-j92fe86t.js → index-vqb65csb.js} +9 -9
  51. package/dist/cli/{index-h17tpj0y.js → index-wfh89qct.js} +4 -4
  52. package/dist/cli/{index-dvbf6fpn.js → index-yqbnsmmv.js} +39 -0
  53. package/dist/cli/index.js +32 -32
  54. package/dist/cli/{knowledge-escalator-kpfm536v.js → knowledge-escalator-kn74r5w8.js} +10 -10
  55. package/dist/cli/{knowledge-events-t3e721m2.js → knowledge-events-7gpw741m.js} +8 -8
  56. package/dist/cli/{knowledge-link-refyc1fz.js → knowledge-link-vh9pfnb9.js} +3 -3
  57. package/dist/cli/{knowledge-store-sk2bhh52.js → knowledge-store-3f9kke7z.js} +4 -4
  58. package/dist/cli/{knowledge-validator-nmc56pbg.js → knowledge-validator-c2z68v8v.js} +6 -6
  59. package/dist/cli/{pending-delegations-ckshrtar.js → pending-delegations-d5c07rb7.js} +9 -9
  60. package/dist/cli/{pr-subscriptions-h81nme2p.js → pr-subscriptions-krv0jvds.js} +9 -9
  61. package/dist/cli/{pr-workflow-gate-m1k4b8mr.js → pr-workflow-gate-hmdht1he.js} +32 -32
  62. package/dist/cli/{runner-kzs5wbqh.js → runner-8m8qhngm.js} +4 -4
  63. package/dist/cli/{scan-cursor-e7varrte.js → scan-cursor-b57xxs3q.js} +5 -5
  64. package/dist/cli/{schema-nsb0saad.js → schema-r8tv8dqm.js} +1 -1
  65. package/dist/cli/{scope-persistence-2s5h5ry7.js → scope-persistence-0sc90mpj.js} +13 -13
  66. package/dist/cli/{skill-generator-wpq9j1nf.js → skill-generator-syxa1mxm.js} +12 -12
  67. package/dist/cli/{snapshot-coordination-init-8nhmhefs.js → snapshot-coordination-init-x18mwxyv.js} +32 -32
  68. package/dist/cli/{telemetry-z9scwfbz.js → telemetry-0mz37v3h.js} +1 -1
  69. package/dist/cli/{worktree-collision-ownership-2kmajcc9.js → worktree-collision-ownership-1tzw8qzp.js} +9 -9
  70. package/dist/cli/{worktree-isolation-kepgr7j2.js → worktree-isolation-ez0e48v3.js} +32 -32
  71. package/dist/db/observability-event-store.d.ts +17 -1
  72. package/dist/index.js +18 -17
  73. package/dist/observability/index.d.ts +1 -1
  74. package/dist/observability/observe.d.ts +6 -0
  75. package/dist/pr-review/reducer.d.ts +18 -10
  76. package/dist/pr-review/types.d.ts +43 -47
  77. package/dist/retention/dir-prune.d.ts +5 -1
  78. package/dist/telemetry.d.ts +10 -2
  79. package/package.json +2 -1
@@ -16,7 +16,7 @@ import {
16
16
  resolveExecutableFromPath,
17
17
  runEvaluation,
18
18
  runExternalTool
19
- } from "./index-v3e19zzm.js";
19
+ } from "./index-er6sk4e6.js";
20
20
  import {
21
21
  finalizeShellAuditForClose,
22
22
  isPolicyProtectedPath,
@@ -26,20 +26,20 @@ import {
26
26
  protectedRoots,
27
27
  redactDecisionLineForArchive,
28
28
  stableCanonicalStringify
29
- } from "./index-gxbesz2h.js";
29
+ } from "./index-dsgc303n.js";
30
30
  import {
31
31
  canonicalProjectKey,
32
32
  closeGroupCommitWriter,
33
33
  getGlobalEventBus,
34
34
  getGroupCommitWriter,
35
35
  importLegacyJsonl
36
- } from "./index-cgpwjctj.js";
36
+ } from "./index-kb66he4e.js";
37
37
  import {
38
38
  detectStraySwarmDirs,
39
39
  readDoctorArtifact,
40
40
  removeStraySwarmDir,
41
41
  runConfigDoctor
42
- } from "./index-7c0e181h.js";
42
+ } from "./index-qdy4a48x.js";
43
43
  import {
44
44
  MAX_TRANSIENT_RETRIES,
45
45
  archiveEvidence,
@@ -81,7 +81,7 @@ import {
81
81
  updateTaskStatus,
82
82
  validateProjectRoot,
83
83
  withPlanLifecycleLock
84
- } from "./index-j92fe86t.js";
84
+ } from "./index-vqb65csb.js";
85
85
  import {
86
86
  EvaluationTaskV1Schema,
87
87
  GateAuditManifestV1Schema,
@@ -98,7 +98,7 @@ import {
98
98
  saveGateAuditResult,
99
99
  savePromotionDecision,
100
100
  saveTaskSetSnapshot
101
- } from "./index-sz75avt3.js";
101
+ } from "./index-3jcp3zb6.js";
102
102
  import {
103
103
  canonicalHash,
104
104
  canonicalJson,
@@ -146,15 +146,15 @@ import {
146
146
  retireSkill,
147
147
  selectCandidateEntries,
148
148
  syncBundledProjectSkillsIfMissingAsync
149
- } from "./index-4dpsvbdt.js";
149
+ } from "./index-d79q2f8z.js";
150
150
  import {
151
151
  readRecentEscalations
152
- } from "./index-ak3ca0nv.js";
152
+ } from "./index-0yffa3np.js";
153
153
  import {
154
154
  alreadyCuratedThisGeneration,
155
155
  claimNextScanBatch,
156
156
  resolveCohortId
157
- } from "./index-ttyvcxxb.js";
157
+ } from "./index-04ph4jp2.js";
158
158
  import {
159
159
  CURATOR_CONSOLIDATION_PROMPT,
160
160
  CURATOR_INIT_PROMPT,
@@ -174,7 +174,7 @@ import {
174
174
  sweepStale,
175
175
  unsubscribe,
176
176
  updateSnapshot
177
- } from "./index-4m7q9hqd.js";
177
+ } from "./index-7qqwx64h.js";
178
178
  import {
179
179
  clearWorktreeMergeStatus,
180
180
  getAllWorktreeMergeFailures,
@@ -186,7 +186,7 @@ import {
186
186
  listCoderSettlementWalStates,
187
187
  recoverCoderSettlement,
188
188
  recoverStaleCoderSettlements
189
- } from "./index-sz9qnjd6.js";
189
+ } from "./index-gq2zdxep.js";
190
190
  import {
191
191
  parsePorcelainV2Snapshot,
192
192
  resolveCommitCountSince,
@@ -257,7 +257,7 @@ import {
257
257
  transitionTaskWorkflowEvidence,
258
258
  withTaskEvidenceTransaction,
259
259
  writeWorkflowWalFile
260
- } from "./index-b3nw1bzp.js";
260
+ } from "./index-rrc08h4q.js";
261
261
  import {
262
262
  isPathUnderSwarmWorktreeBase,
263
263
  listLiveLaneOwners,
@@ -266,7 +266,7 @@ import {
266
266
  recordLiveLaneOwner,
267
267
  removeWorktree,
268
268
  resolveWorktreeBaseDir
269
- } from "./index-g93g1c5r.js";
269
+ } from "./index-mazy938h.js";
270
270
  import {
271
271
  DEFAULT_STALE_DELEGATION_TIMEOUT_MS,
272
272
  DELEGATION_COMPACTION_HIGH_WATER_BYTES,
@@ -300,7 +300,7 @@ import {
300
300
  scanBackgroundCoderReservationsForAdmission,
301
301
  scanDelegationsForRecovery,
302
302
  sweepStaleDelegations
303
- } from "./index-0qa2cqyv.js";
303
+ } from "./index-qcy7eg6z.js";
304
304
  import {
305
305
  MAX_EVENT_LOG_ENTRIES,
306
306
  _internals,
@@ -316,7 +316,7 @@ import {
316
316
  recordKnowledgeEvent,
317
317
  recordPhaseCloseIntent,
318
318
  resolveKnowledgeEventsPath
319
- } from "./index-wy4txsws.js";
319
+ } from "./index-9txyxbqc.js";
320
320
  import {
321
321
  estimateTokens,
322
322
  readSwarmFileAsync,
@@ -342,18 +342,18 @@ import {
342
342
  validateActionableFields,
343
343
  validateLesson,
344
344
  validateSkillPath
345
- } from "./index-h17tpj0y.js";
345
+ } from "./index-wfh89qct.js";
346
346
  import {
347
347
  MAX_CURATION_PROPOSALS,
348
348
  authorizeCuration,
349
349
  buildConfigFingerprintInput
350
- } from "./index-9fxnn8xg.js";
350
+ } from "./index-0caqxnby.js";
351
351
  import {
352
352
  cohortConfigFingerprint
353
353
  } from "./index-rtry5xyf.js";
354
354
  import {
355
355
  resolveWorktreeIsolationConfig
356
- } from "./index-7s5cm87j.js";
356
+ } from "./index-e7yv4xw1.js";
357
357
  import {
358
358
  RetrospectiveEvidenceSchema
359
359
  } from "./index-3qf1vxtb.js";
@@ -363,7 +363,7 @@ import {
363
363
  clearAllScopes,
364
364
  clearScopeBindingFromDisk,
365
365
  clearScopeBindings
366
- } from "./index-003d071j.js";
366
+ } from "./index-j6rq132j.js";
367
367
  import {
368
368
  clearPlanLedgerForReset,
369
369
  computePlanStructureHash,
@@ -379,7 +379,7 @@ import {
379
379
  replayFromLedgerWithStatus,
380
380
  resolvePlanningProfile,
381
381
  takeSnapshotEvent
382
- } from "./index-wp0396m1.js";
382
+ } from "./index-2ryy0cwt.js";
383
383
  import {
384
384
  CORE_EVENT_LOCKED,
385
385
  appendCoreEventSync,
@@ -389,7 +389,7 @@ import {
389
389
  hasSpecDriftAuditEvent,
390
390
  hasTaskRepairAuditEvent,
391
391
  readCoreEvents
392
- } from "./index-znf55hyt.js";
392
+ } from "./index-6k5aq7b9.js";
393
393
  import {
394
394
  DEFAULT_QA_GATES,
395
395
  computeProfileHash,
@@ -397,7 +397,7 @@ import {
397
397
  getEffectiveGates,
398
398
  getProfileLookupForIdentity,
399
399
  setGatesForIdentity
400
- } from "./index-br3mvbsa.js";
400
+ } from "./index-aa2eyfvr.js";
401
401
  import {
402
402
  MAX_COORDINATION_STATE_LIST_ROWS,
403
403
  deleteCoordinationImports,
@@ -409,7 +409,7 @@ import {
409
409
  listCoordinationStates,
410
410
  transitionCoordinationState,
411
411
  withCoordinationTransaction
412
- } from "./index-bernkwgf.js";
412
+ } from "./index-g6nen3gt.js";
413
413
  import {
414
414
  DURABILITY_CLASSES,
415
415
  closeAllProjectDbs,
@@ -417,7 +417,7 @@ import {
417
417
  getProjectDb,
418
418
  projectDbExists,
419
419
  projectDbPath
420
- } from "./index-dvbf6fpn.js";
420
+ } from "./index-yqbnsmmv.js";
421
421
  import {
422
422
  loadDatabaseCtor
423
423
  } from "./index-rdm3px0g.js";
@@ -432,7 +432,7 @@ import {
432
432
  observeCuratorCompliance,
433
433
  observeStoreHealth,
434
434
  readLearningHealth
435
- } from "./index-fdz0076x.js";
435
+ } from "./index-nfs78aqj.js";
436
436
  import {
437
437
  appendKnowledge,
438
438
  appendRejectedLesson,
@@ -462,7 +462,7 @@ import {
462
462
  transactFile,
463
463
  transactKnowledge,
464
464
  wordBigrams
465
- } from "./index-yj0qrgyc.js";
465
+ } from "./index-r60cw2jt.js";
466
466
  import {
467
467
  readTailJsonl,
468
468
  readTailJsonlDetailed,
@@ -483,7 +483,7 @@ import {
483
483
  resolveLinkDir,
484
484
  sanitizeLinkId,
485
485
  writeLinkPointer
486
- } from "./index-bvr0p6ns.js";
486
+ } from "./index-95e3a9en.js";
487
487
  import {
488
488
  assertProjectRoot,
489
489
  atomicWriteFile,
@@ -492,20 +492,21 @@ import {
492
492
  listActiveLocks,
493
493
  tryAcquireLock,
494
494
  withEvidenceLock
495
- } from "./index-cex3emb2.js";
495
+ } from "./index-evxd1art.js";
496
496
  import {
497
497
  require_proper_lockfile
498
498
  } from "./index-7g4c7s5r.js";
499
499
  import {
500
500
  OPENINFERENCE_MAPPING_VERSION,
501
501
  OTEL_GENAI_MAPPING_VERSION,
502
+ canonicalLineContent,
502
503
  emit,
503
504
  extractWorkflowIds,
504
505
  getLastHeartbeat,
505
506
  pseudonymousRef,
506
507
  resolveLineageSalt,
507
508
  telemetry
508
- } from "./index-cravqkxf.js";
509
+ } from "./index-9dz2ee2g.js";
509
510
  import {
510
511
  atomicWriteSwarmFile,
511
512
  atomicWriteSwarmFileSync,
@@ -530,7 +531,7 @@ import {
530
531
  loadGateOverrides,
531
532
  loadPluginConfig,
532
533
  loadPluginConfigWithMeta
533
- } from "./index-k2cpsr0d.js";
534
+ } from "./index-5a8q4qr5.js";
534
535
  import {
535
536
  init_git_executable,
536
537
  resolveGitExecutable,
@@ -559,7 +560,7 @@ import {
559
560
  resolveAutoReviewConfig,
560
561
  resolveGeneratedAgentRole,
561
562
  stripKnownSwarmPrefix
562
- } from "./index-dgpdnve5.js";
563
+ } from "./index-q2yk70rs.js";
563
564
  import {
564
565
  AGENT_TOOL_MAP,
565
566
  ALL_AGENT_NAMES,
@@ -3173,7 +3174,7 @@ async function importLegacyPrWorkflowGateStateIfNeeded(directory, sessionID, all
3173
3174
  return null;
3174
3175
  throw error2;
3175
3176
  }
3176
- const legacy = allowSalvagedImport ? (await (await import("./pr-workflow-gate-m1k4b8mr.js")).readPrWorkflowGateStateForRecovery(directory, sessionID))?.state ?? null : await readPrWorkflowGateStateFileFromDisk(filePath, sessionID);
3177
+ const legacy = allowSalvagedImport ? (await (await import("./pr-workflow-gate-hmdht1he.js")).readPrWorkflowGateStateForRecovery(directory, sessionID))?.state ?? null : await readPrWorkflowGateStateFileFromDisk(filePath, sessionID);
3177
3178
  if (!legacy)
3178
3179
  return null;
3179
3180
  const namespace = workflowGateStateCoordinationNamespace(sessionID);
@@ -3243,7 +3244,7 @@ async function deleteStateWhileLocked(directory, sessionID, options = {}) {
3243
3244
  let recoveryState = null;
3244
3245
  if (!currentAuthoritative) {
3245
3246
  if (options.allowSalvagedRead) {
3246
- const { readPrWorkflowGateStateForRecovery } = await import("./pr-workflow-gate-m1k4b8mr.js");
3247
+ const { readPrWorkflowGateStateForRecovery } = await import("./pr-workflow-gate-hmdht1he.js");
3247
3248
  recoveryState = (await readPrWorkflowGateStateForRecovery(directory, normalizedSessionID))?.state ?? null;
3248
3249
  }
3249
3250
  if (!recoveryState) {
@@ -5373,43 +5374,6 @@ function reducePrReviewEvent(state, event) {
5373
5374
  }
5374
5375
  ]);
5375
5376
  }
5376
- case "transcript_evidence_presented": {
5377
- if (event.laneHasStructuredReceipt) {
5378
- return rejected(state, "receipt_cannot_be_downgraded", `lane ${event.laneId} has a structured receipt; transcript evidence cannot alter it`);
5379
- }
5380
- return applied(state);
5381
- }
5382
- case "provider_terminal_observed": {
5383
- if (event.evidence.source === "observer_deadline") {
5384
- return rejected(state, "observer_deadline_not_terminal_evidence", "a collection wait deadline is never terminal provider evidence");
5385
- }
5386
- if (event.evidence.source === "client_unavailable") {
5387
- return rejected(state, "client_absence_not_terminal_evidence", "an unavailable host messages client is never terminal provider evidence");
5388
- }
5389
- if (event.evidence.source === "parser_or_transcript") {
5390
- return rejected(state, "parser_failure_not_provider_signal", "parser/transcript rejection is never a provider circuit signal");
5391
- }
5392
- if (event.evidence.source === "stale_observation") {
5393
- return rejected(state, "stale_observation_not_provider_signal", "a presumed-stale sweep is never terminal provider evidence");
5394
- }
5395
- if (event.generation !== currentGeneration(state)) {
5396
- return rejected(state, "stale_generation_result", `terminal evidence generation ${event.generation} is not the active generation`);
5397
- }
5398
- return applied(state);
5399
- }
5400
- case "lane_cancelled": {
5401
- if (event.generation !== currentGeneration(state)) {
5402
- return rejected(state, "stale_generation_result", `cancellation generation ${event.generation} does not match the active generation`);
5403
- }
5404
- return applied(state, [
5405
- {
5406
- kind: "settle_delegation",
5407
- batchId: event.batchId,
5408
- laneId: event.laneId,
5409
- status: "cancelled"
5410
- }
5411
- ]);
5412
- }
5413
5377
  case "circuit_advance_requested": {
5414
5378
  const adoption = adoptPrReviewCircuit(state.prReviewResilience?.circuit, event.nowMs);
5415
5379
  let circuit = null;
@@ -5488,53 +5452,40 @@ function reducePrReviewEvent(state, event) {
5488
5452
  return rejected(state, "live_lane_blocks_coverage", `coverage finalization blocked by live dimension(s): ${settlement.liveDimensions.join(", ")}`);
5489
5453
  }
5490
5454
  const verdict = event.requestedVerdict;
5491
- if (verdict === "APPROVE") {
5492
- if (settlement.kind === "PARTIAL") {
5493
- return rejected(state, "partial_coverage_cannot_approve", "a partial review can never emit APPROVE");
5455
+ if (verdict !== undefined) {
5456
+ if (settlement.kind === "PARTIAL" && verdict === "APPROVE") {
5457
+ return rejected(state, "partial_coverage_cannot_approve", `a partial review can never emit ${verdict}`);
5494
5458
  }
5495
- if (settlement.kind === "NO_COVERAGE") {
5496
- return rejected(state, "no_coverage_cannot_approve", "a zero-coverage report can never emit APPROVE");
5459
+ if (settlement.kind === "NO_COVERAGE" && verdict !== "INCOMPLETE") {
5460
+ return rejected(state, "no_coverage_requires_incomplete", `a zero-coverage review must report INCOMPLETE, not ${verdict}`);
5497
5461
  }
5498
5462
  }
5499
- return applied(state, [{ kind: "persist_state" }]);
5463
+ return applied(state);
5500
5464
  }
5501
5465
  case "critic_result_recorded": {
5502
- const unfulfilled = event.criticRequiredFindingIds.filter((id) => !event.criticConfirmedFindingIds.includes(id));
5466
+ const settledFindingIds = new Set(event.criticSettledReceipts.filter((receipt) => receipt.status === "UPHELD" || receipt.status === "DOWNGRADED" || receipt.status === "DISPROVED").map((receipt) => receipt.findingId));
5467
+ const unfulfilled = event.criticRequiredFindingIds.filter((id) => !settledFindingIds.has(id));
5503
5468
  if (unfulfilled.length > 0) {
5504
5469
  return rejected(state, "critic_required_unfulfilled", `critic confirmation missing for finding(s): ${unfulfilled.join(", ")}`);
5505
5470
  }
5506
- return applied(state, [{ kind: "persist_state" }]);
5507
- }
5508
- case "publication_armed": {
5509
- if (event.verdict === "APPROVE" && event.coverageKind !== "COMPLETE") {
5510
- return rejected(state, event.coverageKind === "NO_COVERAGE" ? "no_coverage_cannot_approve" : "partial_coverage_cannot_approve", `cannot arm publication of ${event.verdict} on ${event.coverageKind} coverage`);
5511
- }
5512
- return applied(state, [{ kind: "persist_state" }]);
5471
+ return applied(state);
5513
5472
  }
5514
- case "publication_published":
5515
- case "armed_recovery_requested":
5516
- case "reviewer_authorization_consumed": {
5473
+ case "armed_recovery_requested": {
5517
5474
  const reason = bindingRejection(state, event);
5518
5475
  if (reason) {
5519
5476
  return rejected(state, "stale_foreign_authorization", reason.detail);
5520
5477
  }
5521
- if (event.type === "reviewer_authorization_consumed" && event.role !== event.expectedRole) {
5522
- return rejected(state, "stale_foreign_authorization", `authorization role ${event.role} does not match the expected role ${event.expectedRole}`);
5523
- }
5524
- if (event.type === "armed_recovery_requested") {
5525
- const cancellations = {
5526
- ...state.prReviewDimensionCancellations ?? {}
5478
+ const cancellations = {
5479
+ ...state.prReviewDimensionCancellations ?? {}
5480
+ };
5481
+ for (const dimension of event.dimensionsToCancel) {
5482
+ cancellations[dimension] = {
5483
+ reason: event.reason,
5484
+ cancelledAt: event.nowIso,
5485
+ source: "armed_recovery"
5527
5486
  };
5528
- for (const dimension of event.dimensionsToCancel) {
5529
- cancellations[dimension] = {
5530
- reason: "armed-recovery cancellation of remaining lanes",
5531
- cancelledAt: event.nowIso,
5532
- source: "armed_recovery"
5533
- };
5534
- }
5535
- return applied({ ...state, prReviewDimensionCancellations: cancellations }, [{ kind: "persist_state" }]);
5536
5487
  }
5537
- return applied(state, [{ kind: "persist_state" }]);
5488
+ return applied({ ...state, prReviewDimensionCancellations: cancellations }, [{ kind: "persist_state" }]);
5538
5489
  }
5539
5490
  default: {
5540
5491
  const exhausted = event;
@@ -13877,7 +13828,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
13877
13828
  return extracted === expectedSessionId;
13878
13829
  }
13879
13830
  async function inspectStandardWorktreeCollisionOwnership(identity) {
13880
- const collisionOwnership = await import("./worktree-collision-ownership-2kmajcc9.js");
13831
+ const collisionOwnership = await import("./worktree-collision-ownership-1tzw8qzp.js");
13881
13832
  return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
13882
13833
  }
13883
13834
  async function runRecoveryGit(directory, args, timeoutMs = 15000) {
@@ -14303,7 +14254,7 @@ async function precreateStandardWorktreeSession(args) {
14303
14254
  const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, handle.worktreePath);
14304
14255
  if (laneProfile) {
14305
14256
  try {
14306
- const { writeLaneProfileToDiskReal } = await import("./core-r0nbh1k2.js");
14257
+ const { writeLaneProfileToDiskReal } = await import("./core-aa3jmzcs.js");
14307
14258
  await writeLaneProfileToDiskReal(handle.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
14308
14259
  } catch {}
14309
14260
  }
@@ -15274,7 +15225,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
15274
15225
  }
15275
15226
  clearWorktreeMergeStatus(statusKey);
15276
15227
  try {
15277
- const { removeLaneProfileFromDiskReal } = await import("./core-r0nbh1k2.js");
15228
+ const { removeLaneProfileFromDiskReal } = await import("./core-aa3jmzcs.js");
15278
15229
  await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
15279
15230
  } catch {}
15280
15231
  const state = serializationStateBySessionID.get(dispatch.parentSessionID);
@@ -17595,6 +17546,15 @@ var MAX_EVENT_PAYLOAD_BYTES = 16 * 1024;
17595
17546
  var LEGACY_STREAM_FILES = ["telemetry.jsonl.1", "telemetry.jsonl"];
17596
17547
  var IMPORT_ID_NAMESPACE = "obs-import-v1";
17597
17548
  var MAX_IMPORT_LINE_BYTES = 1024 * 1024;
17549
+ var LINE_HASH_NAMESPACE = "obs-line-v1";
17550
+ var LINE_HASH_QUERY_CHUNK = 500;
17551
+ var LIVE_LINE_HASH_BACKFILL_MARKER = "__live_line_hash_backfill__";
17552
+ function lineHashOf(content) {
17553
+ return createHash18("sha256").update(`${LINE_HASH_NAMESPACE}\x00${content}`).digest("hex");
17554
+ }
17555
+ function normalizeSegmentForLineHash(segment) {
17556
+ return segment.endsWith("\r") ? segment.slice(0, -1) : segment;
17557
+ }
17598
17558
  function flushPendingWrites(directory) {
17599
17559
  try {
17600
17560
  _internals25.getGroupCommitWriter(directory).flushSync();
@@ -17608,8 +17568,8 @@ var INSERT_EVENT_SQL = `INSERT OR IGNORE INTO observability_event (
17608
17568
  trace_id, span_id, host_session_id, task_id, lane_id, batch_id,
17609
17569
  phase_id, council_round_id, project_ref, outcome_status, retry_index,
17610
17570
  privacy_class, sampled, payload_json, relationship_violations,
17611
- quarantined, quarantine_reason, ingested_via
17612
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`;
17571
+ quarantined, quarantine_reason, line_hash, ingested_via
17572
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`;
17613
17573
  function insertRow(db, columns, ingestedVia) {
17614
17574
  db.run(INSERT_EVENT_SQL, [
17615
17575
  columns.event_id,
@@ -17635,6 +17595,7 @@ function insertRow(db, columns, ingestedVia) {
17635
17595
  columns.relationship_violations,
17636
17596
  columns.quarantined,
17637
17597
  columns.quarantine_reason,
17598
+ columns.line_hash,
17638
17599
  ingestedVia
17639
17600
  ]);
17640
17601
  }
@@ -17673,9 +17634,11 @@ function unparseableImportRow(line, reason) {
17673
17634
  payload_json: line.length > MAX_EVENT_PAYLOAD_BYTES ? '{"truncated":true}' : JSON.stringify({ raw_line: line }),
17674
17635
  relationship_violations: null,
17675
17636
  quarantined: 1,
17676
- quarantine_reason: reason
17637
+ quarantine_reason: reason,
17638
+ line_hash: null
17677
17639
  },
17678
- quarantined: true
17640
+ quarantined: true,
17641
+ contentHash: lineHashOf(normalizeSegmentForLineHash(line))
17679
17642
  };
17680
17643
  }
17681
17644
  function buildImportRow(line) {
@@ -17718,18 +17681,75 @@ function buildImportRow(line) {
17718
17681
  payload_json: payloadJson.length > MAX_EVENT_PAYLOAD_BYTES ? '{"truncated":true}' : payloadJson,
17719
17682
  relationship_violations: null,
17720
17683
  quarantined: timestamp === null ? 1 : 0,
17721
- quarantine_reason: timestamp === null ? "import_missing_timestamp" : null
17684
+ quarantine_reason: timestamp === null ? "import_missing_timestamp" : null,
17685
+ line_hash: null
17722
17686
  },
17723
- quarantined: timestamp === null
17687
+ quarantined: timestamp === null,
17688
+ contentHash: lineHashOf(normalizeSegmentForLineHash(line))
17724
17689
  };
17725
17690
  }
17691
+ function reconstructLiveRowLineHash(row) {
17692
+ const { payload_json: payloadJson } = row;
17693
+ if (!payloadJson.startsWith("{") || !payloadJson.endsWith("}") || payloadJson.length < 2) {
17694
+ return null;
17695
+ }
17696
+ let parsed;
17697
+ try {
17698
+ parsed = JSON.parse(payloadJson);
17699
+ } catch {
17700
+ return null;
17701
+ }
17702
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed) || Object.keys(parsed).some((k) => k === "timestamp" || k === "event")) {
17703
+ return null;
17704
+ }
17705
+ const body = payloadJson.slice(1, -1);
17706
+ const line = body.length === 0 ? `{"timestamp":${JSON.stringify(row.occurred_at)},"event":${JSON.stringify(row.kind)}}` : `{"timestamp":${JSON.stringify(row.occurred_at)},"event":${JSON.stringify(row.kind)},${body}}`;
17707
+ return lineHashOf(line);
17708
+ }
17709
+ function backfillLiveLineHashesOnce(db) {
17710
+ const done = db.query("SELECT 1 as found FROM observability_import WHERE source = ?").get(LIVE_LINE_HASH_BACKFILL_MARKER);
17711
+ if (done !== undefined && done !== null)
17712
+ return;
17713
+ const rows = db.query("SELECT rowid, occurred_at, kind, payload_json FROM observability_event WHERE line_hash IS NULL AND ingested_via = 'live' AND quarantined = 0").all();
17714
+ for (const row of rows) {
17715
+ const hash = reconstructLiveRowLineHash(row);
17716
+ if (hash === null)
17717
+ continue;
17718
+ db.run("UPDATE observability_event SET line_hash = ? WHERE rowid = ?", [
17719
+ hash,
17720
+ row.rowid
17721
+ ]);
17722
+ }
17723
+ db.run("INSERT INTO observability_import (source, fingerprint_size, fingerprint_mtime_ms, lines_seen, imported_at) VALUES (?, 0, 0, 0, ?)", [LIVE_LINE_HASH_BACKFILL_MARKER, new Date().toISOString()]);
17724
+ }
17725
+ function filterImportCandidates(db, rows) {
17726
+ const existing = new Set;
17727
+ for (let i = 0;i < rows.length; i += LINE_HASH_QUERY_CHUNK) {
17728
+ const chunk = rows.slice(i, i + LINE_HASH_QUERY_CHUNK).map((r) => r.contentHash);
17729
+ const placeholders = chunk.map(() => "?").join(", ");
17730
+ const found = db.query(`SELECT line_hash FROM observability_event WHERE line_hash IN (${placeholders})`).all(...chunk);
17731
+ for (const f of found)
17732
+ existing.add(f.line_hash);
17733
+ }
17734
+ const toInsert = [];
17735
+ let skippedLive = 0;
17736
+ for (const row of rows) {
17737
+ if (existing.has(row.contentHash)) {
17738
+ skippedLive += 1;
17739
+ continue;
17740
+ }
17741
+ toInsert.push({ columns: row.columns, quarantined: row.quarantined });
17742
+ }
17743
+ return { toInsert, skippedLive };
17744
+ }
17726
17745
  function syncObservabilityImport(directory) {
17727
17746
  flushPendingWrites(directory);
17728
17747
  const root = canonicalProjectKey(directory);
17729
17748
  const result = {
17730
17749
  imported: 0,
17731
17750
  quarantined: 0,
17732
- skippedUnchanged: true
17751
+ skippedUnchanged: true,
17752
+ skippedLive: 0
17733
17753
  };
17734
17754
  for (const fileName of LEGACY_STREAM_FILES) {
17735
17755
  const filePath = join16(root, ".swarm", fileName);
@@ -17764,11 +17784,11 @@ function syncObservabilityImport(directory) {
17764
17784
  continue;
17765
17785
  rows.push(built);
17766
17786
  }
17767
- const imported = rows.length;
17768
- const quarantined = rows.filter((r) => r.quarantined).length;
17769
17787
  db.run("BEGIN IMMEDIATE");
17770
17788
  try {
17771
- for (const row of rows)
17789
+ backfillLiveLineHashesOnce(db);
17790
+ const { toInsert, skippedLive } = filterImportCandidates(db, rows);
17791
+ for (const row of toInsert)
17772
17792
  insertRow(db, row.columns, "import");
17773
17793
  db.run(`INSERT INTO observability_import (source, fingerprint_size, fingerprint_mtime_ms, lines_seen, imported_at)
17774
17794
  VALUES (?, ?, ?, ?, ?)
@@ -17785,14 +17805,15 @@ function syncObservabilityImport(directory) {
17785
17805
  ]);
17786
17806
  runRetentionIfOverCap(db);
17787
17807
  db.run("COMMIT");
17808
+ result.imported += toInsert.length;
17809
+ result.quarantined += toInsert.filter((r) => r.quarantined).length;
17810
+ result.skippedLive += skippedLive;
17788
17811
  } catch (err) {
17789
17812
  try {
17790
17813
  db.run("ROLLBACK");
17791
17814
  } catch {}
17792
17815
  throw err;
17793
17816
  }
17794
- result.imported += imported;
17795
- result.quarantined += quarantined;
17796
17817
  }
17797
17818
  return result;
17798
17819
  }
@@ -17889,7 +17910,8 @@ function legacyStreamExists(directory) {
17889
17910
  var _internals25 = {
17890
17911
  getProjectDb,
17891
17912
  getGroupCommitWriter,
17892
- extractWorkflowIds
17913
+ extractWorkflowIds,
17914
+ canonicalLineContent
17893
17915
  };
17894
17916
 
17895
17917
  // src/observability/otlp-exporter.ts
@@ -18131,6 +18153,7 @@ async function handleReportCommand(directory, args) {
18131
18153
  ...postImportCoverage,
18132
18154
  importedThisSync: importResult.imported,
18133
18155
  quarantinedThisSync: importResult.quarantined,
18156
+ skippedLiveThisSync: importResult.skippedLive,
18134
18157
  rowCap: MAX_REPORT_ROWS,
18135
18158
  truncated: query.truncated,
18136
18159
  totalMatching: query.totalMatching,
@@ -21798,7 +21821,7 @@ function getDisplayFinalPromptPressure() {
21798
21821
  async function rehydratePrSubscriptions(sessionID, directory) {
21799
21822
  const map = new Map;
21800
21823
  try {
21801
- const { listActive: listActive2 } = await import("./pr-subscriptions-h81nme2p.js");
21824
+ const { listActive: listActive2 } = await import("./pr-subscriptions-krv0jvds.js");
21802
21825
  const records = await listActive2(directory);
21803
21826
  for (const record of records) {
21804
21827
  if (record.sessionID !== sessionID)
@@ -23297,14 +23320,25 @@ async function recoverArmedPrWorkflow(directory, sessionID, request) {
23297
23320
  if (entry.terminalState !== "NOT_LAUNCHED")
23298
23321
  continue;
23299
23322
  cancelledDimensions.push(entry.dimension);
23300
- cancellations = {
23301
- ...cancellations,
23302
- [entry.dimension]: {
23303
- reason: sanitizedReason,
23304
- cancelledAt: isoNow(),
23305
- source: "armed_recovery"
23306
- }
23307
- };
23323
+ }
23324
+ if (cancelledDimensions.length > 0) {
23325
+ const recoveryOutcome = reducePrReviewEvent(state, {
23326
+ type: "armed_recovery_requested",
23327
+ binding: {
23328
+ sessionID: state.sessionID,
23329
+ ...state.workflowInstanceId ? { workflowInstanceId: state.workflowInstanceId } : {},
23330
+ prHeadSha: state.prHeadSha,
23331
+ revisionDigest: armed.revisionDigest,
23332
+ generation: state.revision
23333
+ },
23334
+ dimensionsToCancel: cancelledDimensions,
23335
+ nowIso: isoNow(),
23336
+ reason: sanitizedReason
23337
+ });
23338
+ if (recoveryOutcome.status === "rejected") {
23339
+ throw new Error(`BLOCKED: armed recovery rejected (${recoveryOutcome.rejection.code}): ${recoveryOutcome.rejection.detail}`);
23340
+ }
23341
+ cancellations = recoveryOutcome.state.prReviewDimensionCancellations ?? cancellations;
23308
23342
  }
23309
23343
  }
23310
23344
  const recoveredAt = isoNow();
@@ -24081,11 +24115,20 @@ async function enforcePrReviewBaseDimensionsWhileLocked(directory, normalizedSes
24081
24115
  })),
24082
24116
  validatedAt: isoNow()
24083
24117
  };
24118
+ const admissionOutcome = reducePrReviewEvent(state, {
24119
+ type: "base_admission_requested",
24120
+ batchId,
24121
+ lanes: record.lanes,
24122
+ maxBatches: MAX_WORKFLOW_BATCHES,
24123
+ validatedAt: record.validatedAt
24124
+ });
24125
+ if (admissionOutcome.status === "rejected") {
24126
+ throw new Error("BLOCKED: PR_REVIEW base batch limit reached");
24127
+ }
24128
+ const admittedState = admissionOutcome.state;
24084
24129
  const nextState = {
24085
- ...state,
24130
+ ...admittedState,
24086
24131
  updatedAt: isoNow(),
24087
- prReviewBaseDispatches: [...previous, record],
24088
- prReviewBaseDispatch: record,
24089
24132
  ...requestedContractRetry ? {
24090
24133
  prReviewContractRetryDimensions: [
24091
24134
  ...state.prReviewContractRetryDimensions ?? [],
@@ -26618,6 +26661,32 @@ async function assertPrReviewTerminalReady(directory, sessionID, laneLiveness) {
26618
26661
  throw new Error(`BLOCKED: PR_REVIEW reviewer verdicts require critic coverage for: ${criticInventory.join(", ")}`);
26619
26662
  }
26620
26663
  await assertPrReviewValidationSettled(directory, sessionID, "critic", ctx);
26664
+ const criticVerdicts = deriveLatestPrReviewCriticVerdicts(directory, state, ctx);
26665
+ const reviewerClaims = authoritativeReviewerClaims2(directory, state, ctx);
26666
+ const settledReceipts = [];
26667
+ for (const [itemId, verdict] of criticVerdicts) {
26668
+ if (verdict.status !== "UPHELD" && verdict.status !== "DOWNGRADED" && verdict.status !== "DISPROVED") {
26669
+ continue;
26670
+ }
26671
+ const reviewerRowDigest = reviewerClaims.get(itemId)?.rowDigest;
26672
+ if (!reviewerRowDigest)
26673
+ continue;
26674
+ settledReceipts.push({
26675
+ findingId: itemId,
26676
+ status: verdict.status,
26677
+ reviewerRowDigest
26678
+ });
26679
+ }
26680
+ const criticOutcome = reducePrReviewEvent(state, {
26681
+ type: "critic_result_recorded",
26682
+ criticRequiredFindingIds: criticInventory,
26683
+ criticSettledReceipts: settledReceipts
26684
+ });
26685
+ if (criticOutcome.status === "rejected") {
26686
+ const settledIds = new Set(settledReceipts.map((r) => r.findingId));
26687
+ const unfulfilled = criticInventory.filter((id) => !settledIds.has(id));
26688
+ throw new Error(`BLOCKED: PR_REVIEW reviewer verdicts require critic coverage for: ${unfulfilled.join(", ")}`);
26689
+ }
26621
26690
  }
26622
26691
  const requiredBoundaries = [
26623
26692
  "post_explorer",
@@ -27082,13 +27151,34 @@ async function completePrWorkflow(directory, sessionID, expectedMode, prHeadSha,
27082
27151
  }
27083
27152
  const ctx = await createPrReviewGateContext2(directory, state);
27084
27153
  const settlement = derivePrReviewDimensionSettlement(directory, state, ctx.revisionDigest);
27085
- if (settlement.kind === "NO_COVERAGE") {
27086
- if (settlement.liveDimensions.length > 0) {
27087
- throw new Error(`BLOCKED: PR_REVIEW completion has zero covered dimensions and still-live lanes for: ${settlement.liveDimensions.join(", ")}. Collect or settle them, then complete with report_verdict INCOMPLETE.`);
27154
+ const dispatchCoverageFinalization = (finalizationSettlement) => {
27155
+ const outcome = reducePrReviewEvent(state, {
27156
+ type: "coverage_finalization_requested",
27157
+ settlement: {
27158
+ kind: finalizationSettlement.kind,
27159
+ coveredDimensions: finalizationSettlement.coveredDimensions,
27160
+ unresolvedDimensions: finalizationSettlement.unresolvedDimensions,
27161
+ liveDimensions: finalizationSettlement.liveDimensions
27162
+ },
27163
+ requestedVerdict: verdict
27164
+ });
27165
+ if (outcome.status === "applied")
27166
+ return;
27167
+ const { code } = outcome.rejection;
27168
+ if (code === "live_lane_blocks_coverage") {
27169
+ if (finalizationSettlement.kind === "NO_COVERAGE") {
27170
+ throw new Error(`BLOCKED: PR_REVIEW completion has zero covered dimensions and still-live lanes for: ${finalizationSettlement.liveDimensions.join(", ")}. Collect or settle them, then complete with report_verdict INCOMPLETE.`);
27171
+ }
27172
+ throw new Error(`BLOCKED: PR_REVIEW base coverage is incomplete and still has live lanes for: ${finalizationSettlement.liveDimensions.join(", ")}. Completion is allowed only once every launched lane is terminal or explicitly cancelled.`);
27088
27173
  }
27089
- if (verdict !== "INCOMPLETE") {
27174
+ if (code === "no_coverage_requires_incomplete") {
27090
27175
  throw new Error(`BLOCKED: PR_REVIEW NO_COVERAGE completion must report verdict INCOMPLETE; got "${verdict}". A zero-coverage report never approves and never claims a code-quality review.`);
27091
27176
  }
27177
+ const allowedList = allowedPrReviewReportVerdicts(finalizationSettlement.kind).join(" | ");
27178
+ throw new Error(`BLOCKED: PR_REVIEW ${finalizationSettlement.kind} completion allows report_verdict ${allowedList}; got "${verdict}". Partial coverage never approves and never claims a full review.`);
27179
+ };
27180
+ dispatchCoverageFinalization(settlement);
27181
+ if (settlement.kind === "NO_COVERAGE") {
27092
27182
  const noCoverageRunId = state.prReviewArtifactRunId ?? state.prReviewReservedRunId ?? generatePrReviewRunId();
27093
27183
  const admittedState = await admitPrReviewPartialBaseCoverage2(directory, sessionID, noCoverageRunId, settlement.unresolvedDimensions.map((entry) => entry.dimension));
27094
27184
  terminalClearRevision = admittedState.revision;
@@ -27106,19 +27196,12 @@ async function completePrWorkflow(directory, sessionID, expectedMode, prHeadSha,
27106
27196
  });
27107
27197
  } catch {}
27108
27198
  } else {
27109
- const preAllowed = allowedPrReviewReportVerdicts(settlement.kind);
27110
- if (!preAllowed.includes(verdict)) {
27111
- throw new Error(`BLOCKED: PR_REVIEW ${settlement.kind} completion allows report_verdict ${preAllowed.join(" | ")}; got "${verdict}". Partial coverage never approves and never claims a full review.`);
27112
- }
27113
27199
  const ready = await assertPrReviewTerminalReady(directory, sessionID, options?.laneLiveness);
27114
27200
  const readyState = ready.state;
27115
27201
  if (workflowIdentity(readyState) !== workflowIdentity(state) || readyState.revision !== state.revision) {
27116
27202
  throw new Error("BLOCKED: PR_REVIEW state changed while checking terminal readiness; retry from current state");
27117
27203
  }
27118
- const allowed = allowedPrReviewReportVerdicts(ready.settlement.kind);
27119
- if (!allowed.includes(verdict)) {
27120
- throw new Error(`BLOCKED: PR_REVIEW ${ready.settlement.kind} completion allows report_verdict ${allowed.join(" | ")}; got "${verdict}". Partial coverage never approves and never claims a full review.`);
27121
- }
27204
+ dispatchCoverageFinalization(ready.settlement);
27122
27205
  }
27123
27206
  } else {
27124
27207
  await ensurePublicationGenerationCurrent(directory, sessionID);
@@ -38117,9 +38200,9 @@ function hashContent(content) {
38117
38200
  return createHash23("sha1").update(content).digest("hex");
38118
38201
  }
38119
38202
  async function loadConfigForPolicyCurator(directory) {
38120
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-nsb0saad.js");
38203
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-r8tv8dqm.js");
38121
38204
  try {
38122
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-d7yc4ys8.js");
38205
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-ph94evsh.js");
38123
38206
  const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
38124
38207
  return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
38125
38208
  } catch {
@@ -41177,7 +41260,7 @@ async function resolveCuratorLLMDelegate(directory, mode, sessionId) {
41177
41260
  const seam = _internals35.createCuratorLLMDelegate;
41178
41261
  if (seam)
41179
41262
  return seam(directory, mode, sessionId);
41180
- const { createCuratorLLMDelegate } = await import("./curator-llm-factory-89yjg1m4.js");
41263
+ const { createCuratorLLMDelegate } = await import("./curator-llm-factory-nshzhgs4.js");
41181
41264
  return createCuratorLLMDelegate(directory, mode, sessionId);
41182
41265
  }
41183
41266
  async function reconcileCloseTerminalStateForPlan(directory, targetPlan, options) {
@@ -41572,7 +41655,7 @@ async function runFinalizeStage(ctx) {
41572
41655
  }
41573
41656
  }
41574
41657
  try {
41575
- const { CuratorConfigSchema: CCS } = await import("./schema-nsb0saad.js");
41658
+ const { CuratorConfigSchema: CCS } = await import("./schema-r8tv8dqm.js");
41576
41659
  const { config: pmLoadedConfig } = _internals35.loadPluginConfigWithMeta(ctx.directory);
41577
41660
  const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
41578
41661
  if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
@@ -42860,7 +42943,7 @@ function effectiveEntryMtime(entryPath, ownMtimeMs) {
42860
42943
  return ownMtimeMs;
42861
42944
  return newest;
42862
42945
  }
42863
- function listPruneCandidates(dir, maxScan) {
42946
+ function listPruneCandidates(dir, maxScan, includeEntry = () => true) {
42864
42947
  const candidates = [];
42865
42948
  const refusedSymlinks = [];
42866
42949
  let names;
@@ -42877,6 +42960,8 @@ function listPruneCandidates(dir, maxScan) {
42877
42960
  refusedSymlinks.push(name);
42878
42961
  continue;
42879
42962
  }
42963
+ if (!includeEntry(name, stat6))
42964
+ continue;
42880
42965
  candidates.push({
42881
42966
  name,
42882
42967
  mtimeMs: stat6.isDirectory() ? effectiveEntryMtime(entryPath, stat6.mtimeMs) : stat6.mtimeMs
@@ -42888,7 +42973,7 @@ function listPruneCandidates(dir, maxScan) {
42888
42973
  async function pruneDirectory(dir, opts) {
42889
42974
  const now2 = opts.now ?? Date.now();
42890
42975
  const maxScan = opts.maxScan ?? 1e5;
42891
- const { candidates } = listPruneCandidates(dir, maxScan);
42976
+ const { candidates } = listPruneCandidates(dir, maxScan, opts.includeEntry);
42892
42977
  if (candidates.length === 0)
42893
42978
  return 0;
42894
42979
  candidates.sort((a, b) => a.mtimeMs === b.mtimeMs ? a.name < b.name ? -1 : a.name > b.name ? 1 : 0 : a.mtimeMs - b.mtimeMs);
@@ -42937,16 +43022,30 @@ var PR_REVIEW_KEEP_NEWEST_RUNS = 50;
42937
43022
  var LANE_RESULTS_KEEP_NEWEST_BATCHES = 100;
42938
43023
  var REVIEW_RECEIPTS_KEEP_NEWEST = 1000;
42939
43024
  var LEGACY_LEDGER_ARCHIVES_KEEP_NEWEST = 16;
43025
+ var PR_WORKFLOW_GATE_STATE_STEM = "[A-Za-z0-9_.-]+-[0-9a-f]{12}";
43026
+ var PR_WORKFLOW_GATE_STATE_NAME = new RegExp(`^${PR_WORKFLOW_GATE_STATE_STEM}\\.json$`);
43027
+ var PR_WORKFLOW_GATE_SIDECAR_NAME = new RegExp(`^${PR_WORKFLOW_GATE_STATE_STEM}\\.json(?:\\.imported(?:\\.[0-9]+)?|\\.sqlite-projection)$`);
43028
+ var isPrWorkflowGateStateProjection = (name, stat6) => stat6.isFile() && PR_WORKFLOW_GATE_STATE_NAME.test(name);
43029
+ var isPrWorkflowGateSidecar = (name, stat6) => stat6.isFile() && PR_WORKFLOW_GATE_SIDECAR_NAME.test(name);
42940
43030
  function familiesFor(swarmRoot, now2) {
42941
43031
  const age = (days) => days * DAY_MS;
42942
43032
  const f = (label, rel, opts) => ({
42943
43033
  label,
42944
43034
  dir: path52.join(swarmRoot, rel),
42945
43035
  maxAgeMs: opts.maxAgeDays !== undefined ? age(opts.maxAgeDays) : undefined,
42946
- maxEntries: opts.maxEntries
43036
+ maxEntries: opts.maxEntries,
43037
+ includeEntry: opts.includeEntry
42947
43038
  });
42948
43039
  return [
42949
43040
  f("pr-feedback-events", "pr-feedback-events", { maxAgeDays: 30 }),
43041
+ f("pr-workflow-gates", "pr-workflow-gates", {
43042
+ maxAgeDays: 30,
43043
+ includeEntry: isPrWorkflowGateStateProjection
43044
+ }),
43045
+ f("pr-workflow-gate-sidecars", "pr-workflow-gates", {
43046
+ maxAgeDays: 30,
43047
+ includeEntry: isPrWorkflowGateSidecar
43048
+ }),
42950
43049
  f("pr-review-reentry-shadows", path52.join("pr-review", "reentry-authorizations"), {
42951
43050
  maxAgeDays: 30
42952
43051
  }),
@@ -43009,7 +43108,8 @@ async function runRetentionSweep(projectRoot, options = {}) {
43009
43108
  maxAgeMs: family.maxAgeMs,
43010
43109
  maxEntries: family.maxEntries,
43011
43110
  now: now2,
43012
- dryRun
43111
+ dryRun,
43112
+ includeEntry: family.includeEntry
43013
43113
  });
43014
43114
  if (pruned > 0)
43015
43115
  result.pruned[family.label] = pruned;
@@ -43389,7 +43489,7 @@ function serializeAgentSession(s) {
43389
43489
  }
43390
43490
  async function writeSnapshot(directory, state) {
43391
43491
  try {
43392
- const { ensureSnapshotCoordinationReady } = await import("./snapshot-coordination-init-8nhmhefs.js");
43492
+ const { ensureSnapshotCoordinationReady } = await import("./snapshot-coordination-init-x18mwxyv.js");
43393
43493
  await ensureSnapshotCoordinationReady(directory);
43394
43494
  const snapshot = {
43395
43495
  version: 3,
@@ -46045,7 +46145,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
46045
46145
  };
46046
46146
  }
46047
46147
  async function sweepActiveNearDuplicates(directory, options = {}) {
46048
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-d7yc4ys8.js");
46148
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-ph94evsh.js");
46049
46149
  const { config } = loadPluginConfigWithMeta2(directory);
46050
46150
  const sweepConfig = config.learning?.dedup_sweep;
46051
46151
  if (sweepConfig?.enabled === false)
@@ -47169,7 +47269,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
47169
47269
  }
47170
47270
  if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
47171
47271
  try {
47172
- const skillModule = await import("./skill-generator-wpq9j1nf.js");
47272
+ const skillModule = await import("./skill-generator-syxa1mxm.js");
47173
47273
  for (const cand of skillCandidates) {
47174
47274
  if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
47175
47275
  continue;
@@ -47641,7 +47741,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
47641
47741
  } catch {}
47642
47742
  }
47643
47743
  if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
47644
- const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-kpfm536v.js");
47744
+ const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-kn74r5w8.js");
47645
47745
  for (const { id } of contradictedEntries) {
47646
47746
  try {
47647
47747
  await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
@@ -48473,7 +48573,7 @@ async function runCuratorPostMortem(directory, options = {}) {
48473
48573
  warnings.push("Failed to collect knowledge summary.");
48474
48574
  }
48475
48575
  try {
48476
- const { getScanStatus } = await import("./scan-cursor-e7varrte.js");
48576
+ const { getScanStatus } = await import("./scan-cursor-b57xxs3q.js");
48477
48577
  const scanStatus = await getScanStatus(directory);
48478
48578
  if (scanStatus.remaining_estimate > 0) {
48479
48579
  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.`);
@@ -48645,9 +48745,9 @@ var _internals51 = {
48645
48745
  verifyPostMortemKnowledgeActions,
48646
48746
  repairPostMortemActions,
48647
48747
  loadDefaultKnowledgeConfig: async (directory) => {
48648
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-nsb0saad.js");
48748
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-r8tv8dqm.js");
48649
48749
  try {
48650
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-d7yc4ys8.js");
48750
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-ph94evsh.js");
48651
48751
  const loaded = loadPluginConfigWithMeta2(directory);
48652
48752
  return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
48653
48753
  } catch {
@@ -48655,11 +48755,11 @@ var _internals51 = {
48655
48755
  }
48656
48756
  },
48657
48757
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
48658
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-0g733bka.js");
48758
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-xgpxtaf1.js");
48659
48759
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
48660
48760
  },
48661
48761
  checkHivePromotions: async (entries2, knowledgeConfig, directory) => {
48662
- const { checkHivePromotions } = await import("./hive-promoter-gwtvg5vc.js");
48762
+ const { checkHivePromotions } = await import("./hive-promoter-n262tkm3.js");
48663
48763
  return checkHivePromotions(entries2, knowledgeConfig, directory);
48664
48764
  },
48665
48765
  applyProposalTriage: async (directory, triage) => {
@@ -48668,7 +48768,7 @@ var _internals51 = {
48668
48768
  activateProposal,
48669
48769
  listSkills: listSkills2,
48670
48770
  sanitizeSlug
48671
- } = await import("./skill-generator-wpq9j1nf.js");
48771
+ } = await import("./skill-generator-syxa1mxm.js");
48672
48772
  const result = {
48673
48773
  approved: [],
48674
48774
  rejected: [],
@@ -48710,7 +48810,7 @@ var _internals51 = {
48710
48810
  return result;
48711
48811
  },
48712
48812
  readPriorDriftReports: async (directory) => {
48713
- const { readPriorDriftReports } = await import("./curator-drift-3ssjr0nx.js");
48813
+ const { readPriorDriftReports } = await import("./curator-drift-r9r8gepb.js");
48714
48814
  return readPriorDriftReports(directory);
48715
48815
  },
48716
48816
  readSwarmKnowledge: (directory) => readKnowledge(resolveSwarmKnowledgePath(directory))
@@ -56189,7 +56289,7 @@ function wireCloseInternals() {
56189
56289
  archiveEvidence,
56190
56290
  endAgentSession,
56191
56291
  flushAndDrainTelemetry: async () => {
56192
- const { flushAndDrainTelemetry } = await import("./telemetry-z9scwfbz.js");
56292
+ const { flushAndDrainTelemetry } = await import("./telemetry-0mz37v3h.js");
56193
56293
  return flushAndDrainTelemetry();
56194
56294
  },
56195
56295
  finalizeContextTelemetry,
@@ -57541,9 +57641,9 @@ var _internals60 = {
57541
57641
  loadPluginConfigWithMeta,
57542
57642
  loadCuratorDeps: async () => {
57543
57643
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate }] = await Promise.all([
57544
- import("./schema-nsb0saad.js"),
57545
- import("./curator-0g733bka.js"),
57546
- import("./curator-llm-factory-89yjg1m4.js")
57644
+ import("./schema-r8tv8dqm.js"),
57645
+ import("./curator-xgpxtaf1.js"),
57646
+ import("./curator-llm-factory-nshzhgs4.js")
57547
57647
  ]);
57548
57648
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate };
57549
57649
  }
@@ -59452,7 +59552,7 @@ async function computeCurationDiagnostics(directory, entries2) {
59452
59552
  let scanCompleted = false;
59453
59553
  let scanRemaining = 0;
59454
59554
  try {
59455
- const { getScanStatus } = await import("./scan-cursor-e7varrte.js");
59555
+ const { getScanStatus } = await import("./scan-cursor-b57xxs3q.js");
59456
59556
  const status = await getScanStatus(directory);
59457
59557
  scanGeneration = status.generation;
59458
59558
  scanCompleted = status.completed;
@@ -59460,19 +59560,19 @@ async function computeCurationDiagnostics(directory, entries2) {
59460
59560
  } catch {}
59461
59561
  let configMatch = null;
59462
59562
  try {
59463
- const { isLinked: isLinked2 } = await import("./knowledge-link-refyc1fz.js");
59563
+ const { isLinked: isLinked2 } = await import("./knowledge-link-vh9pfnb9.js");
59464
59564
  if (isLinked2(directory)) {
59465
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-nsb0saad.js");
59565
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-r8tv8dqm.js");
59466
59566
  let config;
59467
59567
  try {
59468
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-d7yc4ys8.js");
59568
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-ph94evsh.js");
59469
59569
  const loaded = loadPluginConfigWithMeta2(directory);
59470
59570
  config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
59471
59571
  } catch {
59472
59572
  config = KnowledgeConfigSchema2.parse({});
59473
59573
  }
59474
59574
  const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
59475
- const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-qemp257w.js");
59575
+ const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-fakrpw5t.js");
59476
59576
  const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
59477
59577
  const cohortFp = await readCohortConfigFingerprint(directory);
59478
59578
  configMatch = cohortFp === null ? null : currentFp === cohortFp;
@@ -60863,7 +60963,7 @@ async function handleDoctorCommand(directory, args) {
60863
60963
  const result = runConfigDoctor(config, directory);
60864
60964
  let output;
60865
60965
  if (enableAutoFix && result.hasAutoFixableIssues) {
60866
- const { runConfigDoctorWithFixes } = await import("./config-doctor-jrhpq41y.js");
60966
+ const { runConfigDoctorWithFixes } = await import("./config-doctor-zr748h4m.js");
60867
60967
  const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
60868
60968
  applyLossy: true
60869
60969
  });
@@ -61817,7 +61917,7 @@ async function handleEvidenceCommand(directory, args) {
61817
61917
  return formatTaskEvidenceMarkdown(evidenceData);
61818
61918
  }
61819
61919
  async function handleEvidenceSummaryCommand(directory) {
61820
- const { buildEvidenceSummary } = await import("./evidence-summary-service-4r7sqb2h.js");
61920
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-5e2323zr.js");
61821
61921
  const artifact = await buildEvidenceSummary(directory);
61822
61922
  if (!artifact) {
61823
61923
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -81821,7 +81921,7 @@ function createCuratorLLMDelegate(directory, mode = "init", sessionId) {
81821
81921
  }
81822
81922
  const sdkOpts = signal ? { signal } : {};
81823
81923
  try {
81824
- const { getSwarmAgents: getSwarmAgents2, resolveFallbackModel: resolveFallbackModel2 } = await import("./index-nmffafb0.js");
81924
+ const { getSwarmAgents: getSwarmAgents2, resolveFallbackModel: resolveFallbackModel2 } = await import("./index-jr6pypmj.js");
81825
81925
  const createResult = await client.session.create({
81826
81926
  ...sessionId ? {
81827
81927
  body: {
@@ -96025,7 +96125,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
96025
96125
  if (!input.dispatcher) {
96026
96126
  throw new Error("no evaluation dispatcher available (cannot run validation)");
96027
96127
  }
96028
- const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-kzs5wbqh.js");
96128
+ const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-8m8qhngm.js");
96029
96129
  const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
96030
96130
  const result = await withProtectedSetIntegrity([evalInputRoot, ...protectedRoots(input.directory)], () => _internals116.evaluateCandidateV1({
96031
96131
  projectRoot: input.directory,
@@ -98654,7 +98754,7 @@ function buildDetailedHelp(commandName, entry) {
98654
98754
  async function handleHelpCommand(ctx) {
98655
98755
  const targetCommand = ctx.args.join(" ");
98656
98756
  if (!targetCommand) {
98657
- const { buildHelpText } = await import("./index-npst1d4g.js");
98757
+ const { buildHelpText } = await import("./index-9vfp6g53.js");
98658
98758
  return buildHelpText();
98659
98759
  }
98660
98760
  const tokens = targetCommand.split(/\s+/);
@@ -98668,7 +98768,7 @@ async function handleHelpCommand(ctx) {
98668
98768
  > Note: \`/swarm ${resolved.key}\` is a deprecated alias for \`/swarm ${aliasTarget}\`.` : detailed;
98669
98769
  }
98670
98770
  const similar = _internals24.findSimilarCommands(targetCommand);
98671
- const { buildHelpText: fullHelp } = await import("./index-npst1d4g.js");
98771
+ const { buildHelpText: fullHelp } = await import("./index-9vfp6g53.js");
98672
98772
  if (similar.length > 0) {
98673
98773
  return `Command '/swarm ${targetCommand}' not found.
98674
98774
 
@@ -98983,7 +99083,7 @@ var COMMAND_REGISTRY = {
98983
99083
  },
98984
99084
  "guardrail explain": {
98985
99085
  handler: async (ctx) => {
98986
- const { handleGuardrailExplain } = await import("./guardrail-explain-kt4w2rt8.js");
99086
+ const { handleGuardrailExplain } = await import("./guardrail-explain-d0h0p73g.js");
98987
99087
  return handleGuardrailExplain(ctx.directory, ctx.args);
98988
99088
  },
98989
99089
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -98993,7 +99093,7 @@ var COMMAND_REGISTRY = {
98993
99093
  },
98994
99094
  "guardrail reset": {
98995
99095
  handler: async (ctx) => {
98996
- const { handleGuardrailReset } = await import("./guardrail-reset-795t6nah.js");
99096
+ const { handleGuardrailReset } = await import("./guardrail-reset-rdqxeqy0.js");
98997
99097
  return handleGuardrailReset(ctx.args, ctx.sessionID);
98998
99098
  },
98999
99099
  description: "Reset one exact active invocation/action circuit after repair",
@@ -99014,7 +99114,7 @@ var COMMAND_REGISTRY = {
99014
99114
  },
99015
99115
  "guardrail-log": {
99016
99116
  handler: async (ctx) => {
99017
- const { handleGuardrailLog } = await import("./guardrail-log-18wdr04f.js");
99117
+ const { handleGuardrailLog } = await import("./guardrail-log-heejmjce.js");
99018
99118
  return handleGuardrailLog(ctx.directory, ctx.args);
99019
99119
  },
99020
99120
  description: "Read the guardrail decision log (use --blocks-only for blocks)",