opencode-swarm 7.157.1 → 7.158.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 (80) hide show
  1. package/.opencode/skills/swarm-pr-review/SKILL.md +24 -26
  2. package/.opencode/skills/swarm-pr-review/references/findings-persistence-contract.md +11 -3
  3. package/.opencode/skills/swarm-pr-review/references/parser-dry-run.md +1 -1
  4. package/.opencode/skills/swarm-pr-review/references/prompt-templates.md +3 -3
  5. package/dist/background/candidate-contract.d.ts +20 -3
  6. package/dist/background/candidate-parser.d.ts +8 -1
  7. package/dist/background/pr-review-contract.d.ts +93 -5
  8. package/dist/background/pr-subscriptions.d.ts +31 -15
  9. package/dist/cli/{coder-settlement-tqh28pr3.js → coder-settlement-nrtcjr0h.js} +9 -9
  10. package/dist/cli/{config-doctor-9rsk8ags.js → config-doctor-hs0x10ty.js} +3 -3
  11. package/dist/cli/{core-7zwdc0sk.js → core-a42bexs1.js} +3 -3
  12. package/dist/cli/{curation-policy-72qx868r.js → curation-policy-vn3m5nq2.js} +4 -4
  13. package/dist/cli/curator-drift-g6w4ga1q.js +1 -1
  14. package/dist/cli/{curator-llm-factory-rtkeb1y1.js → curator-llm-factory-21vqqvn3.js} +31 -31
  15. package/dist/cli/{curator-fdj5ftfz.js → curator-yawrnk3t.js} +31 -31
  16. package/dist/cli/{evidence-summary-service-bhqvx9qe.js → evidence-summary-service-kmc92b95.js} +12 -12
  17. package/dist/cli/{gate-evidence-rp0r5phx.js → gate-evidence-6tzhdxb2.js} +6 -6
  18. package/dist/cli/{guardrail-explain-17me709w.js → guardrail-explain-7xrdp18c.js} +32 -32
  19. package/dist/cli/{guardrail-log-te4a5fmn.js → guardrail-log-f16sdc3p.js} +4 -4
  20. package/dist/cli/{guardrail-reset-5n76tj7e.js → guardrail-reset-0ks08s0t.js} +31 -31
  21. package/dist/cli/{hive-promoter-e0zrkgns.js → hive-promoter-d661k3qq.js} +31 -31
  22. package/dist/cli/{index-pr6a7669.js → index-203fqkqk.js} +1 -1
  23. package/dist/cli/{index-ybvtfthv.js → index-2j07670d.js} +2 -2
  24. package/dist/cli/{index-w7s5vgb6.js → index-4wy9kzjg.js} +34 -34
  25. package/dist/cli/{index-sdde1nvx.js → index-5erwyk1b.js} +5 -5
  26. package/dist/cli/{index-b5xm177r.js → index-5zgf140g.js} +1 -1
  27. package/dist/cli/{index-n3362zjr.js → index-6x9jq0cd.js} +3 -3
  28. package/dist/cli/{index-pbh1rmb9.js → index-7qvfkgyk.js} +4 -4
  29. package/dist/cli/{index-ngn6jmad.js → index-7s1hmrfh.js} +1 -1
  30. package/dist/cli/{index-b3cwazk2.js → index-86vvhe8m.js} +2 -2
  31. package/dist/cli/{index-dwkrdpz2.js → index-8fqb0ynp.js} +1 -1
  32. package/dist/cli/{index-tt350s4g.js → index-ac8rwjsg.js} +859 -459
  33. package/dist/cli/{index-xttdbb6d.js → index-azx50qge.js} +5 -5
  34. package/dist/cli/{index-80qxscrc.js → index-dr2tfawg.js} +3 -3
  35. package/dist/cli/{index-r98wqjw4.js → index-ff8xjr1c.js} +3 -5
  36. package/dist/cli/{index-xe6zbfps.js → index-h52hs4e9.js} +1 -1
  37. package/dist/cli/{index-r4qxngnx.js → index-hrrzxz3q.js} +8 -8
  38. package/dist/cli/{index-gg70afs7.js → index-jz216dhj.js} +6 -6
  39. package/dist/cli/{index-91ybfvy2.js → index-mc9qgkwd.js} +532 -101
  40. package/dist/cli/{index-hq3m47kh.js → index-mfv7mfgg.js} +2 -2
  41. package/dist/cli/{index-14awxpgt.js → index-mt6qjp4c.js} +2 -2
  42. package/dist/cli/{index-1gk7ctgp.js → index-nphnjeh8.js} +2 -2
  43. package/dist/cli/{index-gpf3cjre.js → index-pfnj5pvs.js} +1 -1
  44. package/dist/cli/{index-e7m7g2f9.js → index-t8g88esk.js} +5 -5
  45. package/dist/cli/{index-n9hecanw.js → index-tc14d2zy.js} +4 -4
  46. package/dist/cli/{index-1vjjh2gp.js → index-tppnfxkm.js} +4 -4
  47. package/dist/cli/{index-q24ffxx6.js → index-xscjecyq.js} +6 -6
  48. package/dist/cli/{index-rgkwg6d7.js → index-xzhk2hav.js} +1 -1
  49. package/dist/cli/{index-qy6rcnjg.js → index-ygxb3jw4.js} +6 -6
  50. package/dist/cli/{index-9r7gp6cp.js → index-yt75r1er.js} +4 -0
  51. package/dist/cli/{index-t0kxka8n.js → index-z54qw70y.js} +1 -1
  52. package/dist/cli/{index-6sbx96v6.js → index-zcmwwp1x.js} +5 -4
  53. package/dist/cli/{index-az2sga91.js → index-zy60xd05.js} +1 -1
  54. package/dist/cli/index.js +32 -32
  55. package/dist/cli/{knowledge-escalator-wrpk82b9.js → knowledge-escalator-9py5r6c9.js} +11 -11
  56. package/dist/cli/{knowledge-events-4z6yzntf.js → knowledge-events-vcbece74.js} +9 -9
  57. package/dist/cli/{knowledge-link-z9cchqdj.js → knowledge-link-cj2abbae.js} +3 -3
  58. package/dist/cli/{knowledge-store-z9686tpv.js → knowledge-store-0rdfjv20.js} +4 -4
  59. package/dist/cli/{knowledge-validator-rqb0b436.js → knowledge-validator-nwjnjgf5.js} +6 -6
  60. package/dist/cli/{model-preflight-cv9kvw8h.js → model-preflight-w85ecyxh.js} +1 -1
  61. package/dist/cli/{pending-delegations-g10v5k22.js → pending-delegations-ht1vgaze.js} +1 -1
  62. package/dist/cli/pr-review-reentry-authorization-857b9rvv.js +299 -0
  63. package/dist/cli/{pr-subscriptions-76vg2xya.js → pr-subscriptions-j9j70bmd.js} +2 -2
  64. package/dist/cli/{runner-eagt6gf8.js → runner-sj5sf36c.js} +4 -4
  65. package/dist/cli/{scan-cursor-7s1bz7ew.js → scan-cursor-59yj7tp9.js} +5 -5
  66. package/dist/cli/{schema-78pdxc8f.js → schema-8a7fyp87.js} +2 -2
  67. package/dist/cli/{scope-persistence-7ad69qmq.js → scope-persistence-prdxtcr3.js} +7 -7
  68. package/dist/cli/{skill-generator-7cxf53ye.js → skill-generator-v2jkgp63.js} +13 -13
  69. package/dist/cli/{worktree-collision-ownership-ry7xnaae.js → worktree-collision-ownership-6x03w8h7.js} +4 -4
  70. package/dist/cli/{worktree-isolation-1jcc8ynj.js → worktree-isolation-s0setq2a.js} +31 -31
  71. package/dist/hooks/pr-review-reentry-authorization.d.ts +97 -0
  72. package/dist/hooks/pr-workflow-gate.d.ts +211 -8
  73. package/dist/index.js +479 -471
  74. package/dist/tools/authorize-pr-review-reentry.d.ts +16 -0
  75. package/dist/tools/complete-pr-workflow.d.ts +2 -1
  76. package/dist/tools/index.d.ts +1 -0
  77. package/dist/tools/manifest.d.ts +1 -0
  78. package/dist/tools/tool-metadata.d.ts +4 -0
  79. package/dist/tools/write-pr-review-artifact.d.ts +18 -0
  80. package/package.json +1 -1
@@ -6,7 +6,7 @@ import {
6
6
  resolveExecutableFromPath,
7
7
  runEvaluation,
8
8
  runExternalTool
9
- } from "./index-t0kxka8n.js";
9
+ } from "./index-z54qw70y.js";
10
10
  import {
11
11
  finalizeShellAuditForClose,
12
12
  isPolicyProtectedPath,
@@ -15,13 +15,13 @@ import {
15
15
  protectedRoots,
16
16
  redactDecisionLineForArchive,
17
17
  stableCanonicalStringify
18
- } from "./index-r98wqjw4.js";
18
+ } from "./index-ff8xjr1c.js";
19
19
  import {
20
20
  detectStraySwarmDirs,
21
21
  readDoctorArtifact,
22
22
  removeStraySwarmDir,
23
23
  runConfigDoctor
24
- } from "./index-b3cwazk2.js";
24
+ } from "./index-86vvhe8m.js";
25
25
  import {
26
26
  MAX_TRANSIENT_RETRIES,
27
27
  archiveEvidence,
@@ -68,7 +68,7 @@ import {
68
68
  validateProjectRoot,
69
69
  validateSymlinkBoundary,
70
70
  validateTargetWithinRoot
71
- } from "./index-pbh1rmb9.js";
71
+ } from "./index-7qvfkgyk.js";
72
72
  import {
73
73
  EvaluationTaskV1Schema,
74
74
  GateAuditManifestV1Schema,
@@ -85,7 +85,18 @@ import {
85
85
  saveGateAuditResult,
86
86
  savePromotionDecision,
87
87
  saveTaskSetSnapshot
88
- } from "./index-ngn6jmad.js";
88
+ } from "./index-7s1hmrfh.js";
89
+ import {
90
+ canonicalHash,
91
+ canonicalJson,
92
+ computeCandidateInputContentHash,
93
+ computeManifestContentHash,
94
+ computeTaskContentHash,
95
+ computeTaskInputContentHash,
96
+ computeTaskSetContentHash,
97
+ resolveContainedExistingPath,
98
+ sha256
99
+ } from "./index-txdagbh7.js";
89
100
  import {
90
101
  loadDatabaseCtor
91
102
  } from "./index-134d35c1.js";
@@ -99,24 +110,34 @@ import {
99
110
  tool
100
111
  } from "./index-nj6rmyeh.js";
101
112
  import {
102
- canonicalHash,
103
- canonicalJson,
104
- computeCandidateInputContentHash,
105
- computeManifestContentHash,
106
- computeTaskContentHash,
107
- computeTaskInputContentHash,
108
- computeTaskSetContentHash,
109
- resolveContainedExistingPath,
110
- sha256
111
- } from "./index-txdagbh7.js";
113
+ BUNDLED_PROJECT_SKILL_ROOT,
114
+ DEFAULT_SKILL_MIN_CONFIDENCE,
115
+ DEFAULT_SKILL_MIN_CONFIRMATIONS,
116
+ appendRejectedSkillEdit,
117
+ appendSkillChangelog,
118
+ autoApplyProposals,
119
+ bundledProjectSkillFileReference,
120
+ evaluateSkillChange,
121
+ findSkillsBySourceKnowledgeId,
122
+ findStaleSkillsBySourceKnowledgeId,
123
+ generateSkills,
124
+ isRejectedSkillContent,
125
+ listSkills,
126
+ parseDraftFrontmatter,
127
+ regenerateSkill,
128
+ retireOrMarkStale,
129
+ retireSkill,
130
+ selectCandidateEntries,
131
+ syncBundledProjectSkillsIfMissingAsync
132
+ } from "./index-tc14d2zy.js";
112
133
  import {
113
134
  readRecentEscalations
114
- } from "./index-xttdbb6d.js";
135
+ } from "./index-azx50qge.js";
115
136
  import {
116
137
  alreadyCuratedThisGeneration,
117
138
  claimNextScanBatch,
118
139
  resolveCohortId
119
- } from "./index-hq3m47kh.js";
140
+ } from "./index-mfv7mfgg.js";
120
141
  import {
121
142
  CURATOR_INIT_PROMPT,
122
143
  CURATOR_PHASE_PROMPT,
@@ -140,7 +161,7 @@ import {
140
161
  listActive,
141
162
  subscribe,
142
163
  unsubscribe
143
- } from "./index-91ybfvy2.js";
164
+ } from "./index-mc9qgkwd.js";
144
165
  import {
145
166
  clearWorktreeMergeStatus,
146
167
  getAllWorktreeMergeFailures,
@@ -152,33 +173,40 @@ import {
152
173
  listCoderSettlementWalStates,
153
174
  recoverCoderSettlement,
154
175
  recoverStaleCoderSettlements
155
- } from "./index-r4qxngnx.js";
176
+ } from "./index-hrrzxz3q.js";
177
+ import {
178
+ parsePorcelainV2Snapshot,
179
+ resolveCommitCountSince,
180
+ resolveCommitCountSinceAsync,
181
+ resolveCurrentGitHead,
182
+ resolveCurrentGitHeadAsync,
183
+ resolveCurrentLocalHeadRefAsync,
184
+ resolveCurrentUpstreamPushTarget,
185
+ resolveCurrentUpstreamPushTargetAsync,
186
+ resolveCurrentUpstreamRemoteRef,
187
+ resolveExactRemoteBranchHead,
188
+ resolveExactRemoteBranchHeadAsync,
189
+ resolveIsExactSingleChildCommit,
190
+ resolveIsExactSingleChildCommitAsync,
191
+ resolveIsWorkingTreeClean,
192
+ resolveIsWorkingTreeCleanAsync,
193
+ resolvePrFeedbackTrackingCandidatesAsync,
194
+ resolvePrReviewDiffStats,
195
+ resolvePrReviewDiffStatsAsync,
196
+ resolvePrWorkflowRevisionDigest,
197
+ resolvePrWorkflowRevisionDigestDetailed,
198
+ resolvePrWorkflowRevisionDigestDetailedAsync,
199
+ resolveRemoteRefsContainingHead,
200
+ resolveRemoteRefsContainingHeadAsync,
201
+ resolveRemoteUrlIdentity,
202
+ resolveRemoteUrlIdentityAsync,
203
+ switchPrFeedbackTrackingCandidateAsync
204
+ } from "./index-3f7hqtgg.js";
156
205
  import {
157
206
  WORKTREE_LIFECYCLE_LOCK_FILE,
158
207
  recordWorktreeProvisioningOwner,
159
208
  removeWorktreeProvisioningOwner
160
- } from "./index-dwkrdpz2.js";
161
- import {
162
- BUNDLED_PROJECT_SKILL_ROOT,
163
- DEFAULT_SKILL_MIN_CONFIDENCE,
164
- DEFAULT_SKILL_MIN_CONFIRMATIONS,
165
- appendRejectedSkillEdit,
166
- appendSkillChangelog,
167
- autoApplyProposals,
168
- bundledProjectSkillFileReference,
169
- evaluateSkillChange,
170
- findSkillsBySourceKnowledgeId,
171
- findStaleSkillsBySourceKnowledgeId,
172
- generateSkills,
173
- isRejectedSkillContent,
174
- listSkills,
175
- parseDraftFrontmatter,
176
- regenerateSkill,
177
- retireOrMarkStale,
178
- retireSkill,
179
- selectCandidateEntries,
180
- syncBundledProjectSkillsIfMissingAsync
181
- } from "./index-n9hecanw.js";
209
+ } from "./index-8fqb0ynp.js";
182
210
  import {
183
211
  appendUnactionable,
184
212
  quarantineEntry,
@@ -189,11 +217,11 @@ import {
189
217
  validateActionableFields,
190
218
  validateLesson,
191
219
  validateSkillPath
192
- } from "./index-1vjjh2gp.js";
220
+ } from "./index-tppnfxkm.js";
193
221
  import {
194
222
  authorizeCuration,
195
223
  buildConfigFingerprintInput
196
- } from "./index-gpf3cjre.js";
224
+ } from "./index-pfnj5pvs.js";
197
225
  import {
198
226
  cohortConfigFingerprint
199
227
  } from "./index-rtry5xyf.js";
@@ -224,12 +252,12 @@ import {
224
252
  transitionTaskWorkflowEvidence,
225
253
  withTaskEvidenceTransaction,
226
254
  writeWorkflowWalFile
227
- } from "./index-ybvtfthv.js";
255
+ } from "./index-2j07670d.js";
228
256
  import {
229
257
  makeWorktreeBranchName,
230
258
  provisionWorktree,
231
259
  removeWorktree
232
- } from "./index-e7m7g2f9.js";
260
+ } from "./index-t8g88esk.js";
233
261
  import {
234
262
  DEFAULT_STALE_DELEGATION_TIMEOUT_MS,
235
263
  DELEGATION_COMPACTION_HIGH_WATER_BYTES,
@@ -244,46 +272,18 @@ import {
244
272
  scanBackgroundCoderReservationsForAdmission,
245
273
  scanDelegationsForRecovery,
246
274
  sweepStaleDelegations
247
- } from "./index-az2sga91.js";
275
+ } from "./index-zy60xd05.js";
248
276
  import {
249
277
  compositeSessionKey,
250
278
  sessionKeySuffix
251
279
  } from "./index-ddszzne4.js";
252
- import {
253
- parsePorcelainV2Snapshot,
254
- resolveCommitCountSince,
255
- resolveCommitCountSinceAsync,
256
- resolveCurrentGitHead,
257
- resolveCurrentGitHeadAsync,
258
- resolveCurrentLocalHeadRefAsync,
259
- resolveCurrentUpstreamPushTarget,
260
- resolveCurrentUpstreamPushTargetAsync,
261
- resolveCurrentUpstreamRemoteRef,
262
- resolveExactRemoteBranchHead,
263
- resolveExactRemoteBranchHeadAsync,
264
- resolveIsExactSingleChildCommit,
265
- resolveIsExactSingleChildCommitAsync,
266
- resolveIsWorkingTreeClean,
267
- resolveIsWorkingTreeCleanAsync,
268
- resolvePrFeedbackTrackingCandidatesAsync,
269
- resolvePrReviewDiffStats,
270
- resolvePrReviewDiffStatsAsync,
271
- resolvePrWorkflowRevisionDigest,
272
- resolvePrWorkflowRevisionDigestDetailed,
273
- resolvePrWorkflowRevisionDigestDetailedAsync,
274
- resolveRemoteRefsContainingHead,
275
- resolveRemoteRefsContainingHeadAsync,
276
- resolveRemoteUrlIdentity,
277
- resolveRemoteUrlIdentityAsync,
278
- switchPrFeedbackTrackingCandidateAsync
279
- } from "./index-3f7hqtgg.js";
280
280
  import {
281
281
  MAX_PENDING_SCOPE_BINDINGS,
282
282
  canonicalWorkspaceIdentity,
283
283
  clearAllScopes,
284
284
  clearScopeBindingFromDisk,
285
285
  clearScopeBindings
286
- } from "./index-80qxscrc.js";
286
+ } from "./index-dr2tfawg.js";
287
287
  import {
288
288
  appendLedgerEvent,
289
289
  computePlanHash,
@@ -298,7 +298,7 @@ import {
298
298
  readPlanEpochIdentity,
299
299
  replayFromLedgerWithStatus,
300
300
  takeSnapshotEvent
301
- } from "./index-pr6a7669.js";
301
+ } from "./index-203fqkqk.js";
302
302
  import {
303
303
  CORE_EVENT_LOCKED,
304
304
  appendCoreEventSync,
@@ -357,7 +357,7 @@ import {
357
357
  transactFile,
358
358
  transactKnowledge,
359
359
  wordBigrams
360
- } from "./index-q24ffxx6.js";
360
+ } from "./index-xscjecyq.js";
361
361
  import {
362
362
  MAX_EVENT_LOG_ENTRIES,
363
363
  _internals as _internals2,
@@ -373,10 +373,10 @@ import {
373
373
  recordKnowledgeEvent,
374
374
  recordPhaseCloseIntent,
375
375
  resolveKnowledgeEventsPath
376
- } from "./index-sdde1nvx.js";
376
+ } from "./index-5erwyk1b.js";
377
377
  import {
378
378
  resolveWorktreeIsolationConfig
379
- } from "./index-n3362zjr.js";
379
+ } from "./index-6x9jq0cd.js";
380
380
  import {
381
381
  RetrospectiveEvidenceSchema
382
382
  } from "./index-gprxjmm7.js";
@@ -399,7 +399,7 @@ import {
399
399
  init_loader,
400
400
  loadPluginConfig,
401
401
  loadPluginConfigWithMeta
402
- } from "./index-gg70afs7.js";
402
+ } from "./index-jz216dhj.js";
403
403
  import {
404
404
  DEFAULT_HARNESS_EVOLUTION_CONFIG,
405
405
  DEFAULT_PR_REVIEW_RESILIENCE_CONFIG,
@@ -415,7 +415,17 @@ import {
415
415
  package_default,
416
416
  resolveAutoReviewConfig,
417
417
  stripKnownSwarmPrefix
418
- } from "./index-14awxpgt.js";
418
+ } from "./index-mt6qjp4c.js";
419
+ import {
420
+ init_git_executable,
421
+ resolveGitExecutable,
422
+ resolveGitExecutableAsync
423
+ } from "./index-9e6fdz2h.js";
424
+ import {
425
+ advisoryWarn,
426
+ getDeferredWarnings,
427
+ init_warning_buffer
428
+ } from "./index-4rhhvd1a.js";
419
429
  import {
420
430
  AGENT_TOOL_MAP,
421
431
  ALL_AGENT_NAMES,
@@ -429,17 +439,7 @@ import {
429
439
  init_agent_names,
430
440
  init_constants,
431
441
  init_tool_metadata
432
- } from "./index-9r7gp6cp.js";
433
- import {
434
- init_git_executable,
435
- resolveGitExecutable,
436
- resolveGitExecutableAsync
437
- } from "./index-9e6fdz2h.js";
438
- import {
439
- advisoryWarn,
440
- getDeferredWarnings,
441
- init_warning_buffer
442
- } from "./index-4rhhvd1a.js";
442
+ } from "./index-yt75r1er.js";
443
443
  import {
444
444
  resolveHiveDataDir,
445
445
  resolveHiveEventsPath,
@@ -455,10 +455,10 @@ import {
455
455
  resolveLinkDir,
456
456
  sanitizeLinkId,
457
457
  writeLinkPointer
458
- } from "./index-b5xm177r.js";
458
+ } from "./index-5zgf140g.js";
459
459
  import {
460
460
  atomicWriteFile
461
- } from "./index-xe6zbfps.js";
461
+ } from "./index-h52hs4e9.js";
462
462
  import {
463
463
  KNOWLEDGE_SCHEMA_VERSION,
464
464
  OUTCOME_BLOCK_THRESHOLD,
@@ -470,7 +470,7 @@ import {
470
470
  atomicWriteSwarmFileSync,
471
471
  matchTempGrammar,
472
472
  parseTargetBasename
473
- } from "./index-6sbx96v6.js";
473
+ } from "./index-zcmwwp1x.js";
474
474
  import {
475
475
  assertProjectRoot,
476
476
  hasExplicitProjectBoundary,
@@ -6924,6 +6924,355 @@ import { readFileSync as readFileSync5, statSync as statSync5 } from "fs";
6924
6924
  import * as fsp2 from "fs/promises";
6925
6925
  import * as path12 from "path";
6926
6926
 
6927
+ // src/background/pr-review-contract.ts
6928
+ init_zod();
6929
+ var PR_REVIEW_REVIEWER_CLASSIFICATIONS = [
6930
+ "CONFIRMED",
6931
+ "DISPROVED",
6932
+ "UNVERIFIED",
6933
+ "PRE_EXISTING"
6934
+ ];
6935
+ var PR_REVIEW_REVIEWER_EVIDENCE_TYPES = [
6936
+ "STRUCTURALLY_PROVEN",
6937
+ "EXECUTION_PROVEN",
6938
+ "STATIC_TRACE_PROVEN",
6939
+ "PLAUSIBLE_BUT_UNVERIFIED"
6940
+ ];
6941
+ var PR_REVIEW_SEVERITIES = [
6942
+ "CRITICAL",
6943
+ "HIGH",
6944
+ "MEDIUM",
6945
+ "LOW",
6946
+ "INFO",
6947
+ "NONE"
6948
+ ];
6949
+ var PR_REVIEW_CRITIC_STATUSES = [
6950
+ "UPHELD",
6951
+ "DOWNGRADED",
6952
+ "DISPROVED",
6953
+ "NEEDS_MORE_EVIDENCE"
6954
+ ];
6955
+ var PR_REVIEW_FINDING_STATUSES = [
6956
+ "PENDING",
6957
+ "CONFIRMED",
6958
+ "DISPROVED",
6959
+ "PRE_EXISTING"
6960
+ ];
6961
+ var PR_REVIEW_FINDING_ACTIONS = [
6962
+ "route_to_reviewer",
6963
+ "route_to_critic",
6964
+ "report",
6965
+ "suppress_with_reason",
6966
+ "handoff_to_feedback"
6967
+ ];
6968
+ var PR_REVIEW_ARTIFACT_BOUNDARIES = [
6969
+ "post_explorer",
6970
+ "post_reviewer",
6971
+ "post_critic"
6972
+ ];
6973
+ var PR_REVIEW_BASE_DIMENSION_IDS = [
6974
+ "intent-architecture",
6975
+ "correctness-state",
6976
+ "tests-falsifiability",
6977
+ "security-trust",
6978
+ "reliability-performance",
6979
+ "compatibility-delivery"
6980
+ ];
6981
+ var PR_REVIEW_RISK_IMPACTS = [
6982
+ "ORDINARY",
6983
+ "HIGH_IMPACT",
6984
+ "UNKNOWN"
6985
+ ];
6986
+ var PR_REVIEW_RISK_TAGS = [
6987
+ "SECURITY",
6988
+ "AUTH_PERMISSIONS",
6989
+ "STATE_INTEGRITY",
6990
+ "WRITE_PATH",
6991
+ "EVIDENCE_INTEGRITY",
6992
+ "GIT",
6993
+ "CONFIGURATION"
6994
+ ];
6995
+ var PR_REVIEW_FINDINGS_MAX_BYTES = 10 * 1024 * 1024;
6996
+ var PR_REVIEW_FINDINGS_WRITE_MAX_BYTES = 3 * 1024 * 1024;
6997
+ var PR_REVIEW_HANDOFF_MAX_BYTES = 128 * 1024;
6998
+ var PR_REVIEW_HANDOFF_WRITE_MAX_BYTES = 120 * 1024;
6999
+ var PR_REVIEW_DISCARDED_EXAMPLE_ITEM_ID = "discarded-id";
7000
+ function serializedPrReviewArtifactInputBytes(value) {
7001
+ return new TextEncoder().encode(JSON.stringify(value)).byteLength;
7002
+ }
7003
+ var PrReviewRunIdSchema = exports_external.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/, "run_id must be a safe relative identifier");
7004
+ var PrReviewFindingSchema = exports_external.object({
7005
+ finding_id: exports_external.string().trim().min(1).max(128),
7006
+ status: exports_external.enum(PR_REVIEW_FINDING_STATUSES),
7007
+ file_line: exports_external.string().trim().min(1).max(1000),
7008
+ evidence: exports_external.string().trim().min(1).max(20000),
7009
+ next_action: exports_external.enum(PR_REVIEW_FINDING_ACTIONS),
7010
+ severity: exports_external.enum(PR_REVIEW_SEVERITIES).optional(),
7011
+ category: exports_external.string().trim().min(1).max(128).optional(),
7012
+ risk_impact: exports_external.enum(PR_REVIEW_RISK_IMPACTS).optional(),
7013
+ risk_tags: exports_external.array(exports_external.enum(PR_REVIEW_RISK_TAGS)).max(PR_REVIEW_RISK_TAGS.length).optional()
7014
+ }).strict().superRefine((value, ctx) => {
7015
+ if (value.status !== "CONFIRMED")
7016
+ return;
7017
+ if (value.risk_impact === undefined) {
7018
+ ctx.addIssue({
7019
+ code: "custom",
7020
+ path: ["risk_impact"],
7021
+ message: "is required on every newly written CONFIRMED finding (issue #2383 typed critic routing)"
7022
+ });
7023
+ }
7024
+ if (value.risk_tags === undefined) {
7025
+ ctx.addIssue({
7026
+ code: "custom",
7027
+ path: ["risk_tags"],
7028
+ message: "is required on every newly written CONFIRMED finding (issue #2383 typed critic routing)"
7029
+ });
7030
+ }
7031
+ });
7032
+ function prReviewFindingRequiresCritic(input) {
7033
+ if (input.classification !== "CONFIRMED")
7034
+ return false;
7035
+ const impact = input.risk_impact ?? "UNKNOWN";
7036
+ const tags = input.risk_tags ?? [];
7037
+ if (impact === "UNKNOWN")
7038
+ return true;
7039
+ if (input.severity === undefined)
7040
+ return true;
7041
+ if (input.severity === "CRITICAL" || input.severity === "HIGH")
7042
+ return true;
7043
+ if (input.severity === "MEDIUM") {
7044
+ return impact === "HIGH_IMPACT" || tags.length > 0;
7045
+ }
7046
+ return false;
7047
+ }
7048
+ var PrReviewHandoffSchema = exports_external.object({
7049
+ pr_url: exports_external.string().url().max(2000),
7050
+ finding_ids: exports_external.array(exports_external.string().trim().min(1).max(128)).min(1).max(1000),
7051
+ summary: exports_external.string().trim().min(1).max(20000),
7052
+ provenance: exports_external.array(exports_external.string().trim().min(1).max(4000)).min(1).max(1000)
7053
+ }).strict();
7054
+ var PrReviewPartialBaseCoverageSchema = exports_external.object({
7055
+ unresolved_dimensions: exports_external.array(exports_external.enum(PR_REVIEW_BASE_DIMENSION_IDS)).min(1).max(PR_REVIEW_BASE_DIMENSION_IDS.length)
7056
+ }).strict().superRefine((value, ctx) => {
7057
+ const seen = new Set;
7058
+ for (const dimension of value.unresolved_dimensions) {
7059
+ if (seen.has(dimension)) {
7060
+ ctx.addIssue({
7061
+ code: "custom",
7062
+ path: ["unresolved_dimensions"],
7063
+ message: `must not contain duplicate dimension "${dimension}"`
7064
+ });
7065
+ return;
7066
+ }
7067
+ seen.add(dimension);
7068
+ }
7069
+ });
7070
+ var WritePrReviewArtifactArgsSchema = exports_external.discriminatedUnion("kind", [
7071
+ exports_external.object({
7072
+ kind: exports_external.literal("findings"),
7073
+ run_id: PrReviewRunIdSchema.optional(),
7074
+ pr_head_sha: exports_external.string().trim().regex(/^[0-9a-f]{6,64}$/i),
7075
+ boundary: exports_external.enum(PR_REVIEW_ARTIFACT_BOUNDARIES),
7076
+ records: exports_external.array(PrReviewFindingSchema).min(1).max(1000),
7077
+ partial_base_coverage: PrReviewPartialBaseCoverageSchema.optional()
7078
+ }).strict(),
7079
+ exports_external.object({
7080
+ kind: exports_external.literal("handoff"),
7081
+ run_id: PrReviewRunIdSchema.optional(),
7082
+ pr_head_sha: exports_external.string().trim().regex(/^[0-9a-f]{6,64}$/i),
7083
+ handoff: PrReviewHandoffSchema
7084
+ }).strict()
7085
+ ]).superRefine((value, ctx) => {
7086
+ if (value.kind === "findings" && value.partial_base_coverage !== undefined && value.boundary !== "post_explorer") {
7087
+ ctx.addIssue({
7088
+ code: "custom",
7089
+ path: ["partial_base_coverage"],
7090
+ message: "is valid only for the post_explorer boundary"
7091
+ });
7092
+ }
7093
+ const bytes = serializedPrReviewArtifactInputBytes(value);
7094
+ const maxBytes = value.kind === "findings" ? PR_REVIEW_FINDINGS_WRITE_MAX_BYTES : PR_REVIEW_HANDOFF_WRITE_MAX_BYTES;
7095
+ if (bytes > maxBytes) {
7096
+ ctx.addIssue({
7097
+ code: "custom",
7098
+ path: [value.kind === "findings" ? "records" : "handoff"],
7099
+ message: `serialized UTF-8 payload must be at most ${maxBytes} bytes (got ${bytes})`
7100
+ });
7101
+ }
7102
+ });
7103
+ var introducedByPrSchema = exports_external.string().regex(/^(?:introduced_by_pr\s*:\s*)?(?:YES|NO|UNKNOWN)$/i);
7104
+ var PrReviewRiskTagsFieldPattern = new RegExp(`^(?:(?:${PR_REVIEW_RISK_TAGS.join("|")})(?:,(?:${PR_REVIEW_RISK_TAGS.join("|")}))*)?$`);
7105
+ var PrReviewRiskTagsFieldSchema = exports_external.string().regex(PrReviewRiskTagsFieldPattern, `must be a comma-separated subset of the canonical risk tags (${PR_REVIEW_RISK_TAGS.join(", ")}), or empty`);
7106
+ var PR_REVIEW_REVIEWER_LEGACY_FIELD_COUNT = 10;
7107
+ function parsePrReviewRiskTagsField(field) {
7108
+ const trimmed = field.trim();
7109
+ if (!trimmed)
7110
+ return [];
7111
+ return trimmed.split(",").map((tag) => tag.trim());
7112
+ }
7113
+ var PrReviewReviewerVerdictFieldsSchema = exports_external.tuple([
7114
+ exports_external.literal("[REVIEWED]"),
7115
+ exports_external.string().min(1),
7116
+ exports_external.enum(PR_REVIEW_REVIEWER_CLASSIFICATIONS),
7117
+ exports_external.enum(PR_REVIEW_REVIEWER_EVIDENCE_TYPES),
7118
+ exports_external.enum(PR_REVIEW_SEVERITIES),
7119
+ introducedByPrSchema,
7120
+ exports_external.string().min(1),
7121
+ exports_external.string().min(8),
7122
+ exports_external.string().min(5),
7123
+ exports_external.string().min(3),
7124
+ exports_external.enum(PR_REVIEW_RISK_IMPACTS),
7125
+ PrReviewRiskTagsFieldSchema
7126
+ ]).superRefine((fields, ctx) => {
7127
+ if (fields[2] === "DISPROVED" && fields[4] !== "NONE") {
7128
+ ctx.addIssue({
7129
+ code: "custom",
7130
+ path: [4],
7131
+ message: "DISPROVED reviewer severity must be NONE"
7132
+ });
7133
+ }
7134
+ });
7135
+ var PrReviewCriticVerdictFieldsSchema = exports_external.tuple([
7136
+ exports_external.literal("[CRITIC]"),
7137
+ exports_external.string().min(1),
7138
+ exports_external.enum(PR_REVIEW_CRITIC_STATUSES),
7139
+ exports_external.enum(PR_REVIEW_SEVERITIES),
7140
+ exports_external.string().min(6),
7141
+ exports_external.string().min(6)
7142
+ ]).superRefine((fields, ctx) => {
7143
+ const status = fields[2];
7144
+ const severity = fields[3];
7145
+ if (status === "NEEDS_MORE_EVIDENCE") {
7146
+ ctx.addIssue({
7147
+ code: "custom",
7148
+ path: [2],
7149
+ message: "NEEDS_MORE_EVIDENCE is not a terminal transport verdict"
7150
+ });
7151
+ }
7152
+ if (status === "DISPROVED" && severity !== "NONE") {
7153
+ ctx.addIssue({
7154
+ code: "custom",
7155
+ path: [3],
7156
+ message: "DISPROVED critic severity must be NONE"
7157
+ });
7158
+ }
7159
+ if (status === "UPHELD" && !["CRITICAL", "HIGH", "MEDIUM"].includes(severity)) {
7160
+ ctx.addIssue({
7161
+ code: "custom",
7162
+ path: [3],
7163
+ message: "UPHELD critic severity must be CRITICAL, HIGH, or MEDIUM"
7164
+ });
7165
+ }
7166
+ if (status === "DOWNGRADED" && severity === "CRITICAL") {
7167
+ ctx.addIssue({
7168
+ code: "custom",
7169
+ path: [3],
7170
+ message: "DOWNGRADED critic severity cannot be CRITICAL"
7171
+ });
7172
+ }
7173
+ });
7174
+ var PR_REVIEW_VERDICT_ROW_DESCRIPTORS = {
7175
+ reviewer: {
7176
+ marker: "[REVIEWED]",
7177
+ fieldCount: 12,
7178
+ fieldRoles: [
7179
+ "marker",
7180
+ "item_id",
7181
+ "classification",
7182
+ "evidence_type",
7183
+ "severity",
7184
+ "introduced_by_pr",
7185
+ "file:line",
7186
+ "rationale",
7187
+ "probe",
7188
+ "reviewer_notes",
7189
+ "risk_impact",
7190
+ "risk_tags"
7191
+ ],
7192
+ schema: PrReviewReviewerVerdictFieldsSchema
7193
+ },
7194
+ critic: {
7195
+ marker: "[CRITIC]",
7196
+ fieldCount: 6,
7197
+ fieldRoles: [
7198
+ "marker",
7199
+ "item_id",
7200
+ "status",
7201
+ "severity",
7202
+ "rationale",
7203
+ "required_change"
7204
+ ],
7205
+ schema: PrReviewCriticVerdictFieldsSchema
7206
+ }
7207
+ };
7208
+ function parsePrReviewVerdictRow(line, kind) {
7209
+ const descriptor = PR_REVIEW_VERDICT_ROW_DESCRIPTORS[kind];
7210
+ const fields = [];
7211
+ let current = "";
7212
+ let usedCanonicalEscape = false;
7213
+ for (let index = 0;index < line.length; index++) {
7214
+ const char = line[index];
7215
+ if (char === "\\") {
7216
+ const next = line[index + 1];
7217
+ if (next === "\\") {
7218
+ current += "\\";
7219
+ usedCanonicalEscape = true;
7220
+ index++;
7221
+ continue;
7222
+ }
7223
+ if (next === "|") {
7224
+ current += "|";
7225
+ usedCanonicalEscape = true;
7226
+ index++;
7227
+ continue;
7228
+ }
7229
+ if (next === "n") {
7230
+ current += `
7231
+ `;
7232
+ usedCanonicalEscape = true;
7233
+ index++;
7234
+ continue;
7235
+ }
7236
+ if (next === "r") {
7237
+ current += "\r";
7238
+ usedCanonicalEscape = true;
7239
+ index++;
7240
+ continue;
7241
+ }
7242
+ current += "\\";
7243
+ continue;
7244
+ }
7245
+ if (char === "|") {
7246
+ fields.push(current.trim());
7247
+ current = "";
7248
+ continue;
7249
+ }
7250
+ current += char;
7251
+ }
7252
+ fields.push(current.trim());
7253
+ if (fields[0] !== descriptor.marker)
7254
+ return null;
7255
+ if (kind === "reviewer" && fields.length === PR_REVIEW_REVIEWER_LEGACY_FIELD_COUNT) {
7256
+ fields.push("UNKNOWN", "");
7257
+ }
7258
+ if (fields.length > descriptor.fieldCount) {
7259
+ const retained = fields.slice(0, descriptor.fieldCount - 1);
7260
+ retained.push(fields.slice(descriptor.fieldCount - 1).join("|"));
7261
+ return {
7262
+ marker: descriptor.marker,
7263
+ fields: retained,
7264
+ recoveredOverflow: true,
7265
+ overflowClass: fields.length === descriptor.fieldCount + 1 && fields[fields.length - 1] === "" ? "legacy-fidelity-safe" : "legacy-lossy"
7266
+ };
7267
+ }
7268
+ return {
7269
+ marker: descriptor.marker,
7270
+ fields,
7271
+ recoveredOverflow: false,
7272
+ overflowClass: fields.length === descriptor.fieldCount ? usedCanonicalEscape ? "canonical" : "legacy-fidelity-safe" : "legacy-lossy"
7273
+ };
7274
+ }
7275
+
6927
7276
  // src/background/candidate-contract.ts
6928
7277
  var CANDIDATE_SEVERITIES = [
6929
7278
  "INFO",
@@ -6934,7 +7283,8 @@ var CANDIDATE_SEVERITIES = [
6934
7283
  ];
6935
7284
  var FINDINGS_SEVERITIES = [...CANDIDATE_SEVERITIES, "NONE"];
6936
7285
  var CANDIDATE_CONFIDENCES = ["HIGH", "MEDIUM", "LOW"];
6937
- var CANDIDATE_FIELD_COUNT = 9;
7286
+ var CANDIDATE_FIELD_COUNT = 11;
7287
+ var CANDIDATE_LEGACY_FIELD_COUNT = 9;
6938
7288
  var CLEAN_FIELD_COUNT = 4;
6939
7289
  var CLEAN_COVERAGE_SCOPE_MIN_CHARS = 12;
6940
7290
  var CLEAN_EVIDENCE_MIN_CHARS = 20;
@@ -6949,7 +7299,9 @@ var CANDIDATE_FIELDS = {
6949
7299
  "claim",
6950
7300
  "evidence_summary",
6951
7301
  "impact_context",
6952
- "confidence"
7302
+ "confidence",
7303
+ "risk_impact",
7304
+ "risk_tags"
6953
7305
  ],
6954
7306
  micro_lane: [
6955
7307
  "candidate_id",
@@ -6960,9 +7312,15 @@ var CANDIDATE_FIELDS = {
6960
7312
  "claim",
6961
7313
  "invariant_violated",
6962
7314
  "evidence_summary",
6963
- "confidence"
7315
+ "confidence",
7316
+ "risk_impact",
7317
+ "risk_tags"
6964
7318
  ]
6965
7319
  };
7320
+ var CANDIDATE_REQUIRED_FIELDS = {
7321
+ base_explorer: CANDIDATE_FIELDS.base_explorer.filter((field) => field !== "risk_impact" && field !== "risk_tags"),
7322
+ micro_lane: CANDIDATE_FIELDS.micro_lane.filter((field) => field !== "risk_impact" && field !== "risk_tags")
7323
+ };
6966
7324
  var CANDIDATE_MARKER = "[CANDIDATE]";
6967
7325
  var CLEAN_MARKER = "[CLEAN]";
6968
7326
  function formatCandidateHeader(family) {
@@ -7186,22 +7544,19 @@ function repairCandidateEvidencePipes(text, family) {
7186
7544
  let repaired = false;
7187
7545
  const lines = text.split(/\r?\n/).map((line) => {
7188
7546
  const fields = splitPipeFields(line);
7189
- if (fields[0]?.trim() !== CANDIDATE_MARKER || fields.length <= CANDIDATE_FIELD_COUNT + 1 || fields.length > CANDIDATE_FIELD_COUNT + 17 || !isCandidateConfidence(fields.at(-1)?.trim())) {
7547
+ const tailLength = family === "base_explorer" ? 4 : 3;
7548
+ if (fields[0]?.trim() !== CANDIDATE_MARKER || fields.length <= CANDIDATE_FIELD_COUNT + 1 || fields.length > CANDIDATE_FIELD_COUNT + 17 || !isCandidateConfidence(fields.at(-3)?.trim())) {
7190
7549
  return line;
7191
7550
  }
7192
7551
  const normalized = fields.map(escapeCandidateField);
7193
- const overflowEvidence = family === "base_explorer" ? normalized.slice(7, -2) : normalized.slice(8, -1);
7552
+ const overflowEvidence = normalized.slice(family === "base_explorer" ? 7 : 8, -tailLength);
7194
7553
  if (overflowEvidence.length < 3 || overflowEvidence.some((fragment) => fragment.length < 4)) {
7195
7554
  return line;
7196
7555
  }
7197
- const rebuilt = family === "base_explorer" ? [
7198
- ...normalized.slice(0, 7),
7556
+ const rebuilt = [
7557
+ ...normalized.slice(0, family === "base_explorer" ? 7 : 8),
7199
7558
  overflowEvidence.join(" \\| "),
7200
- ...normalized.slice(-2)
7201
- ] : [
7202
- ...normalized.slice(0, 8),
7203
- overflowEvidence.join(" \\| "),
7204
- normalized.at(-1) ?? ""
7559
+ ...normalized.slice(-tailLength)
7205
7560
  ];
7206
7561
  if (rebuilt.length !== CANDIDATE_FIELD_COUNT + 1)
7207
7562
  return line;
@@ -7484,7 +7839,7 @@ function analyzeCandidateFields(fields, family) {
7484
7839
  const name = names[index];
7485
7840
  const value = trimmed[index]?.trim() || null;
7486
7841
  values[name] = value;
7487
- if (value === null) {
7842
+ if (value === null && name !== "risk_impact" && name !== "risk_tags") {
7488
7843
  issues.push({
7489
7844
  field: name,
7490
7845
  message: `Missing required field: ${name}`
@@ -7505,6 +7860,24 @@ function analyzeCandidateFields(fields, family) {
7505
7860
  message: `Invalid confidence: ${candidateDiagnosticPreview(confidence)}; expected ${CANDIDATE_CONFIDENCES.join("|")}`
7506
7861
  });
7507
7862
  }
7863
+ const riskImpact = values.risk_impact;
7864
+ if (riskImpact !== null && !PR_REVIEW_RISK_IMPACTS.includes(riskImpact)) {
7865
+ issues.push({
7866
+ field: "risk_impact",
7867
+ message: `Invalid risk_impact: ${candidateDiagnosticPreview(riskImpact)}; expected ${PR_REVIEW_RISK_IMPACTS.join("|")}`
7868
+ });
7869
+ }
7870
+ const riskTags = values.risk_tags;
7871
+ if (riskTags !== null) {
7872
+ const parsedTags = parsePrReviewRiskTagsField(riskTags);
7873
+ const known = new Set(PR_REVIEW_RISK_TAGS);
7874
+ if (riskTags !== "" && (parsedTags.length === 0 || parsedTags.some((tag) => !known.has(tag)))) {
7875
+ issues.push({
7876
+ field: "risk_tags",
7877
+ message: `Invalid risk_tags: ${candidateDiagnosticPreview(riskTags)}; expected a comma-separated subset of ${PR_REVIEW_RISK_TAGS.join("|")}, or empty`
7878
+ });
7879
+ }
7880
+ }
7508
7881
  return {
7509
7882
  valid: issues.length === 0,
7510
7883
  issues,
@@ -7671,7 +8044,9 @@ var SidecarCandidateCommon = {
7671
8044
  file_line: exports_external.string().min(1),
7672
8045
  claim: exports_external.string().min(1),
7673
8046
  evidence_summary: exports_external.string().min(1),
7674
- confidence: exports_external.enum(CANDIDATE_CONFIDENCES)
8047
+ confidence: exports_external.enum(CANDIDATE_CONFIDENCES),
8048
+ risk_impact: exports_external.enum(PR_REVIEW_RISK_IMPACTS).optional(),
8049
+ risk_tags: exports_external.array(exports_external.enum(PR_REVIEW_RISK_TAGS)).optional()
7675
8050
  };
7676
8051
  var SidecarCandidateSchema = exports_external.discriminatedUnion("row_format_family", [
7677
8052
  exports_external.object({
@@ -7765,7 +8140,7 @@ function mapFields(fields, family) {
7765
8140
  return result;
7766
8141
  }
7767
8142
  function getRequiredFields(family) {
7768
- return CANDIDATE_FIELDS[family];
8143
+ return CANDIDATE_REQUIRED_FIELDS[family];
7769
8144
  }
7770
8145
  function assertNonNullCandidateId(value) {
7771
8146
  if (value === null || value === "") {
@@ -7993,6 +8368,9 @@ function parseText(input, flags) {
7993
8368
  if (hadCandidateMarker) {
7994
8369
  fields = fields.slice(1);
7995
8370
  }
8371
+ if (fields.length === CANDIDATE_LEGACY_FIELD_COUNT) {
8372
+ fields = [...fields, "UNKNOWN", ""];
8373
+ }
7996
8374
  if (fields.length < CANDIDATE_FIELD_COUNT) {
7997
8375
  if (isCandidateLookingShortRow(fields, flags, hadCandidateMarker)) {
7998
8376
  parseErrorDetails.push({
@@ -8120,7 +8498,9 @@ ${trimmed}`;
8120
8498
  evidence_summary: mapped.evidence_summary,
8121
8499
  impact_context: mapped.impact_context,
8122
8500
  invariant_violated: mapped.invariant_violated,
8123
- confidence: mapped.confidence
8501
+ confidence: mapped.confidence,
8502
+ risk_impact: mapped.risk_impact ?? "UNKNOWN",
8503
+ risk_tags: mapped.risk_tags ? parsePrReviewRiskTagsField(mapped.risk_tags) : []
8124
8504
  };
8125
8505
  const cid = candidate.candidate_id;
8126
8506
  idCounts.set(cid, (idCounts.get(cid) ?? 0) + 1);
@@ -8284,276 +8664,6 @@ function digestText(text) {
8284
8664
  return createHash5("sha256").update(text).digest("hex");
8285
8665
  }
8286
8666
 
8287
- // src/background/pr-review-contract.ts
8288
- init_zod();
8289
- var PR_REVIEW_REVIEWER_CLASSIFICATIONS = [
8290
- "CONFIRMED",
8291
- "DISPROVED",
8292
- "UNVERIFIED",
8293
- "PRE_EXISTING"
8294
- ];
8295
- var PR_REVIEW_REVIEWER_EVIDENCE_TYPES = [
8296
- "STRUCTURALLY_PROVEN",
8297
- "EXECUTION_PROVEN",
8298
- "STATIC_TRACE_PROVEN",
8299
- "PLAUSIBLE_BUT_UNVERIFIED"
8300
- ];
8301
- var PR_REVIEW_SEVERITIES = [
8302
- "CRITICAL",
8303
- "HIGH",
8304
- "MEDIUM",
8305
- "LOW",
8306
- "INFO",
8307
- "NONE"
8308
- ];
8309
- var PR_REVIEW_CRITIC_STATUSES = [
8310
- "UPHELD",
8311
- "DOWNGRADED",
8312
- "DISPROVED",
8313
- "NEEDS_MORE_EVIDENCE"
8314
- ];
8315
- var PR_REVIEW_FINDING_STATUSES = [
8316
- "PENDING",
8317
- "CONFIRMED",
8318
- "DISPROVED",
8319
- "PRE_EXISTING"
8320
- ];
8321
- var PR_REVIEW_FINDING_ACTIONS = [
8322
- "route_to_reviewer",
8323
- "route_to_critic",
8324
- "report",
8325
- "suppress_with_reason",
8326
- "handoff_to_feedback"
8327
- ];
8328
- var PR_REVIEW_ARTIFACT_BOUNDARIES = [
8329
- "post_explorer",
8330
- "post_reviewer",
8331
- "post_critic"
8332
- ];
8333
- var PR_REVIEW_FINDINGS_MAX_BYTES = 10 * 1024 * 1024;
8334
- var PR_REVIEW_FINDINGS_WRITE_MAX_BYTES = 3 * 1024 * 1024;
8335
- var PR_REVIEW_HANDOFF_MAX_BYTES = 128 * 1024;
8336
- var PR_REVIEW_HANDOFF_WRITE_MAX_BYTES = 120 * 1024;
8337
- var PR_REVIEW_DISCARDED_EXAMPLE_ITEM_ID = "discarded-id";
8338
- function serializedPrReviewArtifactInputBytes(value) {
8339
- return new TextEncoder().encode(JSON.stringify(value)).byteLength;
8340
- }
8341
- var PrReviewRunIdSchema = exports_external.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/, "run_id must be a safe relative identifier");
8342
- var PrReviewFindingSchema = exports_external.object({
8343
- finding_id: exports_external.string().trim().min(1).max(128),
8344
- status: exports_external.enum(PR_REVIEW_FINDING_STATUSES),
8345
- file_line: exports_external.string().trim().min(1).max(1000),
8346
- evidence: exports_external.string().trim().min(1).max(20000),
8347
- next_action: exports_external.enum(PR_REVIEW_FINDING_ACTIONS),
8348
- severity: exports_external.enum(PR_REVIEW_SEVERITIES).optional(),
8349
- category: exports_external.string().trim().min(1).max(128).optional()
8350
- }).strict();
8351
- var PrReviewHandoffSchema = exports_external.object({
8352
- pr_url: exports_external.string().url().max(2000),
8353
- finding_ids: exports_external.array(exports_external.string().trim().min(1).max(128)).min(1).max(1000),
8354
- summary: exports_external.string().trim().min(1).max(20000),
8355
- provenance: exports_external.array(exports_external.string().trim().min(1).max(4000)).min(1).max(1000)
8356
- }).strict();
8357
- var PrReviewPartialBaseCoverageSchema = exports_external.object({
8358
- missing_dimension: exports_external.enum([
8359
- "intent-architecture",
8360
- "correctness-state",
8361
- "tests-falsifiability",
8362
- "security-trust",
8363
- "reliability-performance",
8364
- "compatibility-delivery"
8365
- ])
8366
- }).strict();
8367
- var WritePrReviewArtifactArgsSchema = exports_external.discriminatedUnion("kind", [
8368
- exports_external.object({
8369
- kind: exports_external.literal("findings"),
8370
- run_id: PrReviewRunIdSchema.optional(),
8371
- pr_head_sha: exports_external.string().trim().regex(/^[0-9a-f]{6,64}$/i),
8372
- boundary: exports_external.enum(PR_REVIEW_ARTIFACT_BOUNDARIES),
8373
- records: exports_external.array(PrReviewFindingSchema).min(1).max(1000),
8374
- partial_base_coverage: PrReviewPartialBaseCoverageSchema.optional()
8375
- }).strict(),
8376
- exports_external.object({
8377
- kind: exports_external.literal("handoff"),
8378
- run_id: PrReviewRunIdSchema.optional(),
8379
- pr_head_sha: exports_external.string().trim().regex(/^[0-9a-f]{6,64}$/i),
8380
- handoff: PrReviewHandoffSchema
8381
- }).strict()
8382
- ]).superRefine((value, ctx) => {
8383
- if (value.kind === "findings" && value.partial_base_coverage !== undefined && value.boundary !== "post_explorer") {
8384
- ctx.addIssue({
8385
- code: "custom",
8386
- path: ["partial_base_coverage"],
8387
- message: "is valid only for the post_explorer boundary"
8388
- });
8389
- }
8390
- const bytes = serializedPrReviewArtifactInputBytes(value);
8391
- const maxBytes = value.kind === "findings" ? PR_REVIEW_FINDINGS_WRITE_MAX_BYTES : PR_REVIEW_HANDOFF_WRITE_MAX_BYTES;
8392
- if (bytes > maxBytes) {
8393
- ctx.addIssue({
8394
- code: "custom",
8395
- path: [value.kind === "findings" ? "records" : "handoff"],
8396
- message: `serialized UTF-8 payload must be at most ${maxBytes} bytes (got ${bytes})`
8397
- });
8398
- }
8399
- });
8400
- var introducedByPrSchema = exports_external.string().regex(/^(?:introduced_by_pr\s*:\s*)?(?:YES|NO|UNKNOWN)$/i);
8401
- var PrReviewReviewerVerdictFieldsSchema = exports_external.tuple([
8402
- exports_external.literal("[REVIEWED]"),
8403
- exports_external.string().min(1),
8404
- exports_external.enum(PR_REVIEW_REVIEWER_CLASSIFICATIONS),
8405
- exports_external.enum(PR_REVIEW_REVIEWER_EVIDENCE_TYPES),
8406
- exports_external.enum(PR_REVIEW_SEVERITIES),
8407
- introducedByPrSchema,
8408
- exports_external.string().min(1),
8409
- exports_external.string().min(8),
8410
- exports_external.string().min(5),
8411
- exports_external.string().min(3)
8412
- ]).superRefine((fields, ctx) => {
8413
- if (fields[2] === "DISPROVED" && fields[4] !== "NONE") {
8414
- ctx.addIssue({
8415
- code: "custom",
8416
- path: [4],
8417
- message: "DISPROVED reviewer severity must be NONE"
8418
- });
8419
- }
8420
- });
8421
- var PrReviewCriticVerdictFieldsSchema = exports_external.tuple([
8422
- exports_external.literal("[CRITIC]"),
8423
- exports_external.string().min(1),
8424
- exports_external.enum(PR_REVIEW_CRITIC_STATUSES),
8425
- exports_external.enum(PR_REVIEW_SEVERITIES),
8426
- exports_external.string().min(6),
8427
- exports_external.string().min(6)
8428
- ]).superRefine((fields, ctx) => {
8429
- const status = fields[2];
8430
- const severity = fields[3];
8431
- if (status === "NEEDS_MORE_EVIDENCE") {
8432
- ctx.addIssue({
8433
- code: "custom",
8434
- path: [2],
8435
- message: "NEEDS_MORE_EVIDENCE is not a terminal transport verdict"
8436
- });
8437
- }
8438
- if (status === "DISPROVED" && severity !== "NONE") {
8439
- ctx.addIssue({
8440
- code: "custom",
8441
- path: [3],
8442
- message: "DISPROVED critic severity must be NONE"
8443
- });
8444
- }
8445
- if (status === "UPHELD" && !["CRITICAL", "HIGH", "MEDIUM"].includes(severity)) {
8446
- ctx.addIssue({
8447
- code: "custom",
8448
- path: [3],
8449
- message: "UPHELD critic severity must be CRITICAL, HIGH, or MEDIUM"
8450
- });
8451
- }
8452
- if (status === "DOWNGRADED" && severity === "CRITICAL") {
8453
- ctx.addIssue({
8454
- code: "custom",
8455
- path: [3],
8456
- message: "DOWNGRADED critic severity cannot be CRITICAL"
8457
- });
8458
- }
8459
- });
8460
- var PR_REVIEW_VERDICT_ROW_DESCRIPTORS = {
8461
- reviewer: {
8462
- marker: "[REVIEWED]",
8463
- fieldCount: 10,
8464
- fieldRoles: [
8465
- "marker",
8466
- "item_id",
8467
- "classification",
8468
- "evidence_type",
8469
- "severity",
8470
- "introduced_by_pr",
8471
- "file:line",
8472
- "rationale",
8473
- "probe",
8474
- "reviewer_notes"
8475
- ],
8476
- schema: PrReviewReviewerVerdictFieldsSchema
8477
- },
8478
- critic: {
8479
- marker: "[CRITIC]",
8480
- fieldCount: 6,
8481
- fieldRoles: [
8482
- "marker",
8483
- "item_id",
8484
- "status",
8485
- "severity",
8486
- "rationale",
8487
- "required_change"
8488
- ],
8489
- schema: PrReviewCriticVerdictFieldsSchema
8490
- }
8491
- };
8492
- function parsePrReviewVerdictRow(line, kind) {
8493
- const descriptor = PR_REVIEW_VERDICT_ROW_DESCRIPTORS[kind];
8494
- const fields = [];
8495
- let current = "";
8496
- let usedCanonicalEscape = false;
8497
- for (let index = 0;index < line.length; index++) {
8498
- const char = line[index];
8499
- if (char === "\\") {
8500
- const next = line[index + 1];
8501
- if (next === "\\") {
8502
- current += "\\";
8503
- usedCanonicalEscape = true;
8504
- index++;
8505
- continue;
8506
- }
8507
- if (next === "|") {
8508
- current += "|";
8509
- usedCanonicalEscape = true;
8510
- index++;
8511
- continue;
8512
- }
8513
- if (next === "n") {
8514
- current += `
8515
- `;
8516
- usedCanonicalEscape = true;
8517
- index++;
8518
- continue;
8519
- }
8520
- if (next === "r") {
8521
- current += "\r";
8522
- usedCanonicalEscape = true;
8523
- index++;
8524
- continue;
8525
- }
8526
- current += "\\";
8527
- continue;
8528
- }
8529
- if (char === "|") {
8530
- fields.push(current.trim());
8531
- current = "";
8532
- continue;
8533
- }
8534
- current += char;
8535
- }
8536
- fields.push(current.trim());
8537
- if (fields[0] !== descriptor.marker)
8538
- return null;
8539
- if (fields.length > descriptor.fieldCount) {
8540
- const retained = fields.slice(0, descriptor.fieldCount - 1);
8541
- retained.push(fields.slice(descriptor.fieldCount - 1).join("|"));
8542
- return {
8543
- marker: descriptor.marker,
8544
- fields: retained,
8545
- recoveredOverflow: true,
8546
- overflowClass: fields.length === descriptor.fieldCount + 1 && fields[fields.length - 1] === "" ? "legacy-fidelity-safe" : "legacy-lossy"
8547
- };
8548
- }
8549
- return {
8550
- marker: descriptor.marker,
8551
- fields,
8552
- recoveredOverflow: false,
8553
- overflowClass: fields.length === descriptor.fieldCount ? usedCanonicalEscape ? "canonical" : "legacy-fidelity-safe" : "legacy-lossy"
8554
- };
8555
- }
8556
-
8557
8667
  // src/background/pr-review-trigger-contract.ts
8558
8668
  init_zod();
8559
8669
  var PR_REVIEW_TRIGGER_DEFINITIONS = [
@@ -9315,14 +9425,6 @@ function classifyPrReviewCircuitSignal(record) {
9315
9425
  }
9316
9426
 
9317
9427
  // src/hooks/pr-workflow-gate.ts
9318
- var PR_REVIEW_BASE_DIMENSION_IDS = [
9319
- "intent-architecture",
9320
- "correctness-state",
9321
- "tests-falsifiability",
9322
- "security-trust",
9323
- "reliability-performance",
9324
- "compatibility-delivery"
9325
- ];
9326
9428
  var PR_REVIEW_REQUIRED_MICRO_LANE_IDS = PR_REVIEW_REQUIRED_TRIGGER_IDS;
9327
9429
  var PR_REVIEW_BASE_LANE_FLOORS = {
9328
9430
  S: 1,
@@ -9365,14 +9467,7 @@ var trackedStatesByProjectSession = new Map;
9365
9467
  var pendingStateMutationsByProjectSession = new Map;
9366
9468
  var pendingCheckoutMutationsByProject = new Map;
9367
9469
  var completedCheckoutLockOwners = new Map;
9368
- var PrReviewBaseDimensionIdSchema = exports_external.enum([
9369
- "intent-architecture",
9370
- "correctness-state",
9371
- "tests-falsifiability",
9372
- "security-trust",
9373
- "reliability-performance",
9374
- "compatibility-delivery"
9375
- ]);
9470
+ var PrReviewBaseDimensionIdSchema = exports_external.enum(PR_REVIEW_BASE_DIMENSION_IDS);
9376
9471
  var PrReviewBaseDispatchRecordSchema = exports_external.object({
9377
9472
  batchId: exports_external.string().min(1),
9378
9473
  lanes: exports_external.array(exports_external.object({
@@ -9404,7 +9499,65 @@ var PrReviewResilienceStateRecordSchema = exports_external.object({
9404
9499
  attempts: exports_external.array(PrReviewResilienceAttemptRecordSchema).max(3),
9405
9500
  circuit: PrReviewCircuitRecordSchema.optional()
9406
9501
  }).strict();
9407
- var PrReviewPartialBaseCoverageRecordSchema = exports_external.object({
9502
+ var PR_REVIEW_FAILURE_CLASS_SAFE_DETAILS = {
9503
+ contract: "lane failed its output contract after the bounded retry budget was exhausted",
9504
+ resource: "lane exhausted its resource budget before producing valid output",
9505
+ deadline: "lane passed its collection deadline without valid terminal output"
9506
+ };
9507
+ var PrReviewUnresolvedDimensionRecordSchema = exports_external.object({
9508
+ dimension: exports_external.enum(PR_REVIEW_BASE_DIMENSION_IDS),
9509
+ terminalState: exports_external.enum(["FAILED", "CANCELLED", "NOT_LAUNCHED"]),
9510
+ reasonKind: exports_external.enum(["lane_failure", "cancelled", "not_launched"]),
9511
+ failureClass: exports_external.enum(["contract", "resource", "deadline"]).optional(),
9512
+ terminalEventId: exports_external.string().min(1).max(256).optional(),
9513
+ batchId: exports_external.string().min(1).max(128).optional(),
9514
+ laneId: exports_external.string().min(1).max(128).optional(),
9515
+ safeDetail: exports_external.string().max(200).optional()
9516
+ }).strict().superRefine((value, ctx) => {
9517
+ if (value.terminalState === "FAILED" && value.reasonKind !== "lane_failure") {
9518
+ ctx.addIssue({
9519
+ code: "custom",
9520
+ path: ["reasonKind"],
9521
+ message: 'FAILED dimensions must use reasonKind "lane_failure"'
9522
+ });
9523
+ }
9524
+ if (value.terminalState === "CANCELLED" && value.reasonKind !== "cancelled" || value.terminalState === "NOT_LAUNCHED" && value.reasonKind !== "not_launched") {
9525
+ ctx.addIssue({
9526
+ code: "custom",
9527
+ path: ["reasonKind"],
9528
+ message: `reasonKind must match terminalState "${value.terminalState}"`
9529
+ });
9530
+ }
9531
+ if (value.terminalState !== "FAILED" && (value.failureClass !== undefined || value.terminalEventId !== undefined)) {
9532
+ ctx.addIssue({
9533
+ code: "custom",
9534
+ path: ["failureClass"],
9535
+ message: "failureClass/terminalEventId are legal only on FAILED dimensions"
9536
+ });
9537
+ }
9538
+ });
9539
+ var PrReviewPartialBaseCoverageRecordV2Schema = exports_external.object({
9540
+ schemaVersion: exports_external.literal(2),
9541
+ runId: exports_external.string().min(1).max(128),
9542
+ prHeadSha: exports_external.string().regex(/^[0-9a-f]{6,64}$/i),
9543
+ revisionDigest: exports_external.string().min(1).max(256),
9544
+ unresolvedDimensions: exports_external.array(PrReviewUnresolvedDimensionRecordSchema).min(1).max(PR_REVIEW_BASE_DIMENSION_IDS.length),
9545
+ admittedAt: exports_external.string().datetime()
9546
+ }).strict().superRefine((value, ctx) => {
9547
+ const seen = new Set;
9548
+ for (const entry of value.unresolvedDimensions) {
9549
+ if (seen.has(entry.dimension)) {
9550
+ ctx.addIssue({
9551
+ code: "custom",
9552
+ path: ["unresolvedDimensions"],
9553
+ message: `must not contain duplicate dimension "${entry.dimension}"`
9554
+ });
9555
+ return;
9556
+ }
9557
+ seen.add(entry.dimension);
9558
+ }
9559
+ });
9560
+ var PrReviewPartialBaseCoverageRecordV1Schema = exports_external.object({
9408
9561
  runId: exports_external.string().min(1).max(128),
9409
9562
  prHeadSha: exports_external.string().regex(/^[0-9a-f]{6,64}$/i),
9410
9563
  revisionDigest: exports_external.string().min(1).max(256),
@@ -9413,6 +9566,37 @@ var PrReviewPartialBaseCoverageRecordSchema = exports_external.object({
9413
9566
  terminalEventId: exports_external.string().min(1).max(256),
9414
9567
  admittedAt: exports_external.string().datetime()
9415
9568
  }).strict();
9569
+ var PrReviewPartialBaseCoverageRecordSchema = exports_external.union([
9570
+ PrReviewPartialBaseCoverageRecordV2Schema,
9571
+ PrReviewPartialBaseCoverageRecordV1Schema
9572
+ ]);
9573
+ var PrReviewDimensionCancellationRecordSchema = exports_external.object({
9574
+ reason: exports_external.string().min(1).max(500),
9575
+ cancelledAt: exports_external.string().datetime(),
9576
+ source: exports_external.literal("armed_recovery")
9577
+ }).strict();
9578
+ function normalizePrReviewPartialBaseCoverageRecord(record) {
9579
+ if ("missingDimension" in record) {
9580
+ return {
9581
+ schemaVersion: 2,
9582
+ runId: record.runId,
9583
+ prHeadSha: record.prHeadSha,
9584
+ revisionDigest: record.revisionDigest,
9585
+ unresolvedDimensions: [
9586
+ {
9587
+ dimension: record.missingDimension,
9588
+ terminalState: "FAILED",
9589
+ reasonKind: "lane_failure",
9590
+ failureClass: record.failureClass,
9591
+ terminalEventId: record.terminalEventId,
9592
+ safeDetail: PR_REVIEW_FAILURE_CLASS_SAFE_DETAILS[record.failureClass]
9593
+ }
9594
+ ],
9595
+ admittedAt: record.admittedAt
9596
+ };
9597
+ }
9598
+ return record;
9599
+ }
9416
9600
  var PrFeedbackLaneOwnershipSchema = exports_external.object({
9417
9601
  laneId: exports_external.string().min(1),
9418
9602
  ownedItemIds: exports_external.array(exports_external.string().min(1)).min(1)
@@ -9659,6 +9843,7 @@ var PrWorkflowGateStateSchema = exports_external.object({
9659
9843
  prReviewPartialBaseCoverage: PrReviewPartialBaseCoverageRecordSchema.optional(),
9660
9844
  prReviewCoverageDisclosurePath: exports_external.string().min(1).max(512).optional(),
9661
9845
  prReviewCoverageDisclosureDigest: exports_external.string().regex(/^[0-9a-f]{64}$/).optional(),
9846
+ prReviewDimensionCancellations: exports_external.record(exports_external.enum(PR_REVIEW_BASE_DIMENSION_IDS), PrReviewDimensionCancellationRecordSchema).optional(),
9662
9847
  prReviewArtifactBoundaries: exports_external.array(exports_external.enum(["post_explorer", "post_reviewer", "post_critic"])).max(3).optional(),
9663
9848
  prReviewHandoffPath: exports_external.string().min(1).optional(),
9664
9849
  prReviewHandoffRequired: exports_external.boolean().optional(),
@@ -9674,6 +9859,13 @@ var PrWorkflowGateStateSchema = exports_external.object({
9674
9859
  prFeedbackGateBatches: exports_external.array(PrFeedbackGateBatchRecordSchema).max(MAX_WORKFLOW_BATCHES).optional(),
9675
9860
  prFeedbackReadyToPublish: PrFeedbackReadyToPublishRecordSchema.optional(),
9676
9861
  prFeedbackPublication: PrFeedbackPublicationStateSchema.optional(),
9862
+ prFeedbackArmedRecovery: exports_external.object({
9863
+ recoveredAt: exports_external.string().datetime(),
9864
+ prHeadSha: exports_external.string().regex(/^[0-9a-f]{6,64}$/i),
9865
+ revisionDigest: exports_external.string().min(1).max(256),
9866
+ generation: exports_external.number().int().nonnegative(),
9867
+ reason: exports_external.string().min(1).max(500)
9868
+ }).strict().optional(),
9677
9869
  prFeedbackRebindCount: exports_external.number().int().nonnegative().optional(),
9678
9870
  prFeedbackScopes: exports_external.array(PrFeedbackScopeDeclarationRecordSchema).max(MAX_WORKFLOW_BATCHES).optional()
9679
9871
  }).passthrough();
@@ -10238,6 +10430,111 @@ var TERMINAL_FAILED_DELEGATION_STATUSES = new Set([
10238
10430
  "cancelled",
10239
10431
  "stale"
10240
10432
  ]);
10433
+ function summarizePrReviewBaseDimensionAttempts(directory, state, revisionDigest) {
10434
+ const successful = new Set;
10435
+ const inFlight = new Set;
10436
+ const contractFailed = new Set;
10437
+ const contractRetried = new Set(state.prReviewContractRetryDimensions ?? []);
10438
+ const dedicatedSuccessful = new Set;
10439
+ const terminallyFailed = new Set;
10440
+ for (const batch of state.prReviewBaseDispatches ?? []) {
10441
+ const batchSuccessful = successfulObligationsFromExactBatch(directory, state, batch.batchId, batch.lanes, "swarm-pr-review:base", batch.validatedAt, true, new Set, revisionDigest);
10442
+ for (const obligation of batchSuccessful) {
10443
+ successful.add(obligation);
10444
+ }
10445
+ for (const lane of batch.lanes) {
10446
+ if ((lane.ownedWorkflowLanes?.length ?? 1) !== 1)
10447
+ continue;
10448
+ const dimension = lane.ownedWorkflowLanes?.[0] ?? lane.workflowLane;
10449
+ if (batchSuccessful.has(dimension))
10450
+ dedicatedSuccessful.add(dimension);
10451
+ }
10452
+ const semanticallyValidLaneIds = new Set(recordsPassingBatchIntegrity(directory, state, batch.batchId, batch.lanes, "swarm-pr-review:base", batch.validatedAt).filter((qualified) => hasRevisionIndependentDiscoverySemantics(directory, qualified)).map((qualified) => qualified.record.laneId));
10453
+ const records = findByBatchId(directory, batch.batchId, {
10454
+ parentSessionId: state.sessionID
10455
+ });
10456
+ for (const lane of batch.lanes) {
10457
+ if (semanticallyValidLaneIds.has(lane.laneId))
10458
+ continue;
10459
+ const laneRecords = records.filter((record) => record.laneId === lane.laneId);
10460
+ if (laneRecords.length === 0) {
10461
+ continue;
10462
+ }
10463
+ if (!laneRecords.every((record) => TERMINAL_FAILED_DELEGATION_STATUSES.has(record.status))) {
10464
+ for (const dimension of lane.ownedWorkflowLanes?.length ? lane.ownedWorkflowLanes : [lane.workflowLane]) {
10465
+ inFlight.add(dimension);
10466
+ }
10467
+ continue;
10468
+ }
10469
+ for (const dimension of lane.ownedWorkflowLanes?.length ? lane.ownedWorkflowLanes : [lane.workflowLane]) {
10470
+ terminallyFailed.add(dimension);
10471
+ if (laneRecords.at(-1)?.result?.workflowLaneFailureClass === "contract") {
10472
+ contractFailed.add(dimension);
10473
+ }
10474
+ }
10475
+ }
10476
+ }
10477
+ return {
10478
+ successful,
10479
+ inFlight,
10480
+ contractFailed,
10481
+ contractRetried,
10482
+ dedicatedSuccessful,
10483
+ terminallyFailed
10484
+ };
10485
+ }
10486
+ function hasRevisionIndependentDiscoverySemantics(directory, qualified) {
10487
+ const ref = qualified.record.result?.outputRef?.trim();
10488
+ if (!ref)
10489
+ return false;
10490
+ const artifact = readLaneOutput(directory, ref)?.artifact ?? null;
10491
+ if (!artifact?.revisionDigest?.trim())
10492
+ return false;
10493
+ return validatePrReviewDiscoveryLaneCompletion({
10494
+ record: qualified.record,
10495
+ result: qualified.record.result,
10496
+ artifact,
10497
+ expected: {
10498
+ mode: "swarm-pr-review:base",
10499
+ workflowLane: qualified.expectedWorkflowLane,
10500
+ ownedWorkflowLanes: qualified.expectedOwnedLanes,
10501
+ prHeadSha: qualified.record.workspace?.prHeadSha ?? "",
10502
+ gitHead: qualified.record.workspace?.gitHead ?? "",
10503
+ revisionDigest: artifact.revisionDigest,
10504
+ reviewScope: qualified.record.workspace?.scope ?? undefined
10505
+ }
10506
+ }).ok;
10507
+ }
10508
+ function latestTypedFailureForBaseDimension(directory, state, dimension) {
10509
+ let latest = null;
10510
+ for (const batch of state.prReviewBaseDispatches ?? []) {
10511
+ for (const lane of batch.lanes) {
10512
+ const owned = lane.ownedWorkflowLanes?.length ? lane.ownedWorkflowLanes : [lane.workflowLane];
10513
+ if (!owned.includes(dimension))
10514
+ continue;
10515
+ for (const record of findByBatchId(directory, batch.batchId, {
10516
+ parentSessionId: state.sessionID
10517
+ }).filter((candidate) => candidate.laneId === lane.laneId)) {
10518
+ const terminal = record.terminalResult;
10519
+ const result = terminal?.result ?? record.result;
10520
+ const failureClass = result?.workflowLaneFailureClass;
10521
+ if (!terminal || !failureClass || terminal.status === "completed")
10522
+ continue;
10523
+ const candidate = {
10524
+ failureClass,
10525
+ terminalEventId: terminal.eventId,
10526
+ recordedAt: terminal.recordedAt,
10527
+ batchId: batch.batchId,
10528
+ laneId: lane.laneId
10529
+ };
10530
+ if (latest === null || candidate.recordedAt > latest.recordedAt || candidate.recordedAt === latest.recordedAt && candidate.terminalEventId.localeCompare(latest.terminalEventId) > 0) {
10531
+ latest = candidate;
10532
+ }
10533
+ }
10534
+ }
10535
+ }
10536
+ return latest;
10537
+ }
10241
10538
  var MAX_COVER_UNIVERSE_BITS = 12;
10242
10539
  function minimumConsolidatedLaneCover(sets) {
10243
10540
  const bitOf = new Map;
@@ -10291,6 +10588,78 @@ var PR_REVIEW_COVERAGE_DISCLOSURE_MAX_BYTES = 4096;
10291
10588
  function coverageDisclosureRelativePath(runId) {
10292
10589
  return path12.join("pr-review", runId, "coverage-disclosure.json");
10293
10590
  }
10591
+ function derivePrReviewDimensionSettlement(directory, state, revisionDigest) {
10592
+ const attempts = summarizePrReviewBaseDimensionAttempts(directory, state, revisionDigest);
10593
+ const cancellations = state.prReviewDimensionCancellations ?? {};
10594
+ const dispatched = new Set;
10595
+ for (const batch of state.prReviewBaseDispatches ?? []) {
10596
+ const records = findByBatchId(directory, batch.batchId, {
10597
+ parentSessionId: state.sessionID
10598
+ });
10599
+ for (const lane of batch.lanes) {
10600
+ if (!records.some((record) => record.laneId === lane.laneId))
10601
+ continue;
10602
+ for (const dimension of lane.ownedWorkflowLanes?.length ? lane.ownedWorkflowLanes : [lane.workflowLane]) {
10603
+ dispatched.add(dimension);
10604
+ }
10605
+ }
10606
+ }
10607
+ const coveredDimensions = [];
10608
+ const unresolvedDimensions = [];
10609
+ const liveDimensions = [];
10610
+ for (const dimension of PR_REVIEW_BASE_DIMENSION_IDS) {
10611
+ if (attempts.successful.has(dimension)) {
10612
+ coveredDimensions.push(dimension);
10613
+ continue;
10614
+ }
10615
+ if (attempts.inFlight.has(dimension)) {
10616
+ liveDimensions.push(dimension);
10617
+ continue;
10618
+ }
10619
+ const cancellation = cancellations[dimension];
10620
+ if (cancellation) {
10621
+ unresolvedDimensions.push({
10622
+ dimension,
10623
+ terminalState: "CANCELLED",
10624
+ reasonKind: "cancelled",
10625
+ safeDetail: `explicitly cancelled by the audited armed-recovery operation at ${cancellation.cancelledAt}`
10626
+ });
10627
+ continue;
10628
+ }
10629
+ const latestFailure = latestTypedFailureForBaseDimension(directory, state, dimension);
10630
+ if (attempts.terminallyFailed.has(dimension)) {
10631
+ unresolvedDimensions.push({
10632
+ dimension,
10633
+ terminalState: "FAILED",
10634
+ reasonKind: "lane_failure",
10635
+ failureClass: latestFailure?.failureClass,
10636
+ terminalEventId: latestFailure?.terminalEventId,
10637
+ batchId: latestFailure?.batchId,
10638
+ laneId: latestFailure?.laneId,
10639
+ safeDetail: latestFailure ? PR_REVIEW_FAILURE_CLASS_SAFE_DETAILS[latestFailure.failureClass] : "lane terminated without a typed failure class"
10640
+ });
10641
+ continue;
10642
+ }
10643
+ if (dispatched.has(dimension)) {
10644
+ liveDimensions.push(dimension);
10645
+ continue;
10646
+ }
10647
+ unresolvedDimensions.push({
10648
+ dimension,
10649
+ terminalState: "NOT_LAUNCHED",
10650
+ reasonKind: "not_launched",
10651
+ safeDetail: "no lane for this dimension was ever dispatched"
10652
+ });
10653
+ }
10654
+ const kind = coveredDimensions.length === PR_REVIEW_BASE_DIMENSION_IDS.length ? "COMPLETE" : coveredDimensions.length > 0 ? "PARTIAL" : "NO_COVERAGE";
10655
+ return {
10656
+ kind,
10657
+ coveredDimensions,
10658
+ unresolvedDimensions,
10659
+ liveDimensions,
10660
+ allLaunchedTerminal: liveDimensions.length === 0
10661
+ };
10662
+ }
10294
10663
  async function readAndVerifyCoverageDisclosure(directory, state) {
10295
10664
  const record = state.prReviewPartialBaseCoverage;
10296
10665
  const relativePath = state.prReviewCoverageDisclosurePath;
@@ -10319,7 +10688,7 @@ async function readAndVerifyCoverageDisclosure(directory, state) {
10319
10688
  if (!parsed.success || JSON.stringify(parsed.data) !== JSON.stringify(record)) {
10320
10689
  throw new Error("BLOCKED: PR_REVIEW partial base coverage disclosure does not match durable state");
10321
10690
  }
10322
- return record;
10691
+ return normalizePrReviewPartialBaseCoverageRecord(parsed.data);
10323
10692
  }
10324
10693
  async function assertPrReviewBaseCoverageSettled(directory, sessionID, gateContext) {
10325
10694
  const state = await requireBoundState(directory, sessionID, "PR_REVIEW");
@@ -10328,23 +10697,21 @@ async function assertPrReviewBaseCoverageSettled(directory, sessionID, gateConte
10328
10697
  throw new Error("BLOCKED: PR_REVIEW requires at least one base batch");
10329
10698
  }
10330
10699
  const ctx = gateContext ?? await createPrReviewGateContext(directory, state);
10331
- const covered = new Set;
10332
- const malformedDiagnostics = [];
10333
- for (const batch of batches) {
10334
- const successful = successfulObligationsFromExactBatch(directory, state, batch.batchId, batch.lanes, "swarm-pr-review:base", batch.validatedAt, true, new Set, ctx.revisionDigest, malformedDiagnostics);
10335
- for (const obligation of successful) {
10336
- covered.add(obligation);
10337
- }
10338
- }
10339
- const missing = PR_REVIEW_BASE_DIMENSION_IDS.filter((dimension) => !covered.has(dimension));
10340
- if (missing.length > 0 || covered.size !== PR_REVIEW_BASE_DIMENSION_IDS.length) {
10341
- const disclosure = await readAndVerifyCoverageDisclosure(directory, state);
10342
- 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)) {
10343
- return state;
10344
- }
10345
- 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}`);
10700
+ const settlement = derivePrReviewDimensionSettlement(directory, state, ctx.revisionDigest);
10701
+ if (settlement.kind === "COMPLETE") {
10702
+ return { state, settlement };
10346
10703
  }
10347
- return state;
10704
+ if (settlement.liveDimensions.length > 0) {
10705
+ throw new Error(`BLOCKED: PR_REVIEW base coverage is incomplete and still has live lanes for: ${settlement.liveDimensions.join(", ")}. Completion is allowed only once every launched lane is terminal or explicitly cancelled.`);
10706
+ }
10707
+ const disclosure = await readAndVerifyCoverageDisclosure(directory, state);
10708
+ const disclosureIds = (disclosure?.unresolvedDimensions ?? []).map((entry) => entry.dimension);
10709
+ const derivedIds = settlement.unresolvedDimensions.map((entry) => entry.dimension);
10710
+ if (disclosure && JSON.stringify(disclosureIds) === JSON.stringify(derivedIds) && JSON.stringify(disclosure?.unresolvedDimensions) === JSON.stringify(settlement.unresolvedDimensions) && disclosure.prHeadSha === state.prHeadSha && disclosure.revisionDigest === ctx.revisionDigest && disclosure.runId === (state.prReviewArtifactRunId ?? state.prReviewReservedRunId)) {
10711
+ return { state, settlement };
10712
+ }
10713
+ const reason = disclosure === null ? "no terminal settlement disclosure is admitted; settle via write_pr_review_artifact partial_base_coverage.unresolved_dimensions" : disclosureIds.join(",") !== derivedIds.join(",") ? `the admitted disclosure [${disclosureIds.join(", ")}] no longer matches the derived terminal settlement [${derivedIds.join(", ")}] \u2014 later evidence invalidated it; the disclosure is immutable, so re-run the affected dimensions or restart the review` : "the admitted disclosure no longer matches the derived per-dimension terminal evidence";
10714
+ throw new Error(`BLOCKED: PR_REVIEW base coverage is ${settlement.kind} (${settlement.coveredDimensions.length}/${PR_REVIEW_BASE_DIMENSION_IDS.length} dimensions covered; unresolved: ${derivedIds.join(", ") || "(none)"}); ${reason}`);
10348
10715
  }
10349
10716
  async function assertPrReviewValidationSettled(directory, sessionID, phase, gateContext) {
10350
10717
  const state = await requireBoundState(directory, sessionID, "PR_REVIEW");
@@ -11557,7 +11924,7 @@ async function assertPrReviewTerminalReady(directory, sessionID) {
11557
11924
  throw new Error(`BLOCKED: PR_REVIEW transition has ${laneSettlement.openLanes} unsettled PR workflow lane(s)` + describePrWorkflowLaneProbe(laneSettlement));
11558
11925
  }
11559
11926
  const ctx = await createPrReviewGateContext(directory, state);
11560
- await assertPrReviewBaseCoverageSettled(directory, sessionID, ctx);
11927
+ const { settlement } = await assertPrReviewBaseCoverageSettled(directory, sessionID, ctx);
11561
11928
  if (!state.prReviewTriggerEvalPath) {
11562
11929
  throw new Error("BLOCKED: PR_REVIEW transition requires a persisted trigger evaluation artifact");
11563
11930
  }
@@ -11585,7 +11952,7 @@ async function assertPrReviewTerminalReady(directory, sessionID) {
11585
11952
  if (state.prReviewHandoffRequired && !state.prReviewHandoffPath) {
11586
11953
  throw new Error("BLOCKED: PR_REVIEW actionable findings require a persisted feedback handoff artifact");
11587
11954
  }
11588
- return state;
11955
+ return { state, settlement };
11589
11956
  }
11590
11957
  async function transitionPrReviewToFeedback(directory, sessionID, request) {
11591
11958
  const normalizedSessionID = normalizeSessionID(sessionID);
@@ -11616,7 +11983,7 @@ async function transitionPrReviewToFeedback(directory, sessionID, request) {
11616
11983
  if (preliminary.mode !== "PR_REVIEW") {
11617
11984
  throw wrongModeError(preliminary, "PR_REVIEW");
11618
11985
  }
11619
- const ready = await assertPrReviewTerminalReady(directory, normalizedSessionID);
11986
+ const ready = (await assertPrReviewTerminalReady(directory, normalizedSessionID)).state;
11620
11987
  if (workflowIdentity(ready) !== workflowIdentity(preliminary) || ready.revision !== preliminary.revision || ready.mode !== "PR_REVIEW" || ready.prReviewHandoffPath !== normalizedHandoff.relativePath || ready.prReviewArtifactRunId !== request.runId || !ready.prHeadSha || ready.prHeadSha.toLowerCase() !== artifact.pr_head_sha.toLowerCase() || canonicalGitHubPrUrl(artifact.pr_url) !== canonicalGitHubPrUrl(request.prUrl ?? artifact.pr_url)) {
11621
11988
  throw new Error("BLOCKED: PR_REVIEW feedback handoff does not match the terminal active review state");
11622
11989
  }
@@ -11733,6 +12100,21 @@ async function transitionPrReviewToFeedback(directory, sessionID, request) {
11733
12100
  });
11734
12101
  }));
11735
12102
  }
12103
+ async function readPrReviewReentryBindingContext(directory, sessionID) {
12104
+ const state = await readPrWorkflowGateStateFromDisk(directory, normalizeSessionID(sessionID));
12105
+ if (!state || state.mode !== "PR_REVIEW" || !state.prHeadSha)
12106
+ return null;
12107
+ const ctx = await createPrReviewGateContext(directory, state);
12108
+ return {
12109
+ prHeadSha: state.prHeadSha,
12110
+ revisionDigest: ctx.revisionDigest,
12111
+ generation: state.revision,
12112
+ ...state.workflowInstanceId ? { workflowInstanceId: state.workflowInstanceId } : {},
12113
+ ...state.prReviewArtifactRunId ?? state.prReviewReservedRunId ? {
12114
+ runId: state.prReviewArtifactRunId ?? state.prReviewReservedRunId ?? undefined
12115
+ } : {}
12116
+ };
12117
+ }
11736
12118
  var _test_exports2 = {
11737
12119
  classifyPrReviewCircuitSignal,
11738
12120
  minimumConsolidatedLaneCover,
@@ -12483,7 +12865,12 @@ function authoritativeReviewerClaims(directory, state, ctx) {
12483
12865
  }
12484
12866
  function derivePrReviewCriticInventory(directory, state, ctx) {
12485
12867
  const verdicts = authoritativeReviewerVerdictsForGate(directory, state, ctx, "derivePrReviewCriticInventory");
12486
- return [...verdicts.entries()].filter(([, verdict]) => verdict.classification === "CONFIRMED" && ["CRITICAL", "HIGH", "MEDIUM"].includes(verdict.severity)).map(([itemId]) => itemId).sort();
12868
+ return [...verdicts.entries()].filter(([, verdict]) => prReviewFindingRequiresCritic({
12869
+ classification: verdict.classification,
12870
+ severity: verdict.severity,
12871
+ risk_impact: verdict.riskImpact,
12872
+ risk_tags: verdict.riskTags
12873
+ })).map(([itemId]) => itemId).sort();
12487
12874
  }
12488
12875
  function deriveLatestPrReviewCriticVerdicts(directory, state, ctx) {
12489
12876
  const composed = composePrReviewPhaseVerdicts(directory, state, "critic", ctx);
@@ -12497,7 +12884,12 @@ function deriveLatestPrReviewCriticVerdicts(directory, state, ctx) {
12497
12884
  function deriveLatestPrReviewReviewerVerdicts(directory, state, ctx) {
12498
12885
  return new Map([...authoritativeReviewerClaims(directory, state, ctx)].map(([itemId, claim]) => [
12499
12886
  itemId,
12500
- { classification: claim.classification, severity: claim.severity }
12887
+ {
12888
+ classification: claim.classification,
12889
+ severity: claim.severity,
12890
+ riskImpact: claim.riskImpact,
12891
+ riskTags: claim.riskTags
12892
+ }
12501
12893
  ]));
12502
12894
  }
12503
12895
  function assertSettledPhaseHasAuthoritativeVerdicts(phase, composed, authoritative, origin) {
@@ -13179,6 +13571,8 @@ function parsePrReviewVerdictRows(text, itemIds, phase, reviewerClaims) {
13179
13571
  parsed.set(itemId, {
13180
13572
  classification: fields[2],
13181
13573
  severity: fields[4],
13574
+ riskImpact: fields[10],
13575
+ riskTags: parsePrReviewRiskTagsField(fields[11] ?? ""),
13182
13576
  rowDigest: reviewerVerdictRowDigest(fields)
13183
13577
  });
13184
13578
  continue;
@@ -20646,7 +21040,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
20646
21040
  };
20647
21041
  }
20648
21042
  async function sweepActiveNearDuplicates(directory, options = {}) {
20649
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-qy6rcnjg.js");
21043
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-ygxb3jw4.js");
20650
21044
  const { config } = loadPluginConfigWithMeta2(directory);
20651
21045
  const sweepConfig = config.learning?.dedup_sweep;
20652
21046
  if (sweepConfig?.enabled === false)
@@ -21776,7 +22170,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
21776
22170
  }
21777
22171
  if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
21778
22172
  try {
21779
- const skillModule = await import("./skill-generator-7cxf53ye.js");
22173
+ const skillModule = await import("./skill-generator-v2jkgp63.js");
21780
22174
  for (const cand of skillCandidates) {
21781
22175
  if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
21782
22176
  continue;
@@ -22248,7 +22642,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
22248
22642
  } catch {}
22249
22643
  }
22250
22644
  if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
22251
- const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-wrpk82b9.js");
22645
+ const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-9py5r6c9.js");
22252
22646
  for (const { id } of contradictedEntries) {
22253
22647
  try {
22254
22648
  await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
@@ -23067,7 +23461,7 @@ async function runCuratorPostMortem(directory, options = {}) {
23067
23461
  warnings.push("Failed to collect knowledge summary.");
23068
23462
  }
23069
23463
  try {
23070
- const { getScanStatus } = await import("./scan-cursor-7s1bz7ew.js");
23464
+ const { getScanStatus } = await import("./scan-cursor-59yj7tp9.js");
23071
23465
  const scanStatus = await getScanStatus(directory);
23072
23466
  if (scanStatus.remaining_estimate > 0) {
23073
23467
  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.`);
@@ -23239,9 +23633,9 @@ var _internals27 = {
23239
23633
  verifyPostMortemKnowledgeActions,
23240
23634
  repairPostMortemActions,
23241
23635
  loadDefaultKnowledgeConfig: async (directory) => {
23242
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-78pdxc8f.js");
23636
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-8a7fyp87.js");
23243
23637
  try {
23244
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-qy6rcnjg.js");
23638
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-ygxb3jw4.js");
23245
23639
  const loaded = loadPluginConfigWithMeta2(directory);
23246
23640
  return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
23247
23641
  } catch {
@@ -23249,11 +23643,11 @@ var _internals27 = {
23249
23643
  }
23250
23644
  },
23251
23645
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
23252
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-fdj5ftfz.js");
23646
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-yawrnk3t.js");
23253
23647
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
23254
23648
  },
23255
23649
  checkHivePromotions: async (entries, knowledgeConfig, directory) => {
23256
- const { checkHivePromotions } = await import("./hive-promoter-e0zrkgns.js");
23650
+ const { checkHivePromotions } = await import("./hive-promoter-d661k3qq.js");
23257
23651
  return checkHivePromotions(entries, knowledgeConfig, directory);
23258
23652
  },
23259
23653
  applyProposalTriage: async (directory, triage) => {
@@ -23262,7 +23656,7 @@ var _internals27 = {
23262
23656
  activateProposal,
23263
23657
  listSkills: listSkills2,
23264
23658
  sanitizeSlug
23265
- } = await import("./skill-generator-7cxf53ye.js");
23659
+ } = await import("./skill-generator-v2jkgp63.js");
23266
23660
  const result = {
23267
23661
  approved: [],
23268
23662
  rejected: [],
@@ -24592,9 +24986,9 @@ function hashContent(content) {
24592
24986
  return createHash13("sha1").update(content).digest("hex");
24593
24987
  }
24594
24988
  async function loadConfigForPolicyCurator(directory) {
24595
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-78pdxc8f.js");
24989
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-8a7fyp87.js");
24596
24990
  try {
24597
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-qy6rcnjg.js");
24991
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-ygxb3jw4.js");
24598
24992
  const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
24599
24993
  return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
24600
24994
  } catch {
@@ -36782,7 +37176,7 @@ async function runFinalizeStage(ctx) {
36782
37176
  }
36783
37177
  }
36784
37178
  try {
36785
- const { CuratorConfigSchema: CCS } = await import("./schema-78pdxc8f.js");
37179
+ const { CuratorConfigSchema: CCS } = await import("./schema-8a7fyp87.js");
36786
37180
  const { config: pmLoadedConfig } = _internals41.loadPluginConfigWithMeta(ctx.directory);
36787
37181
  const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
36788
37182
  if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
@@ -39001,9 +39395,9 @@ var _internals45 = {
39001
39395
  loadPluginConfigWithMeta,
39002
39396
  loadCuratorDeps: async () => {
39003
39397
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
39004
- import("./schema-78pdxc8f.js"),
39005
- import("./curator-fdj5ftfz.js"),
39006
- import("./curator-llm-factory-rtkeb1y1.js")
39398
+ import("./schema-8a7fyp87.js"),
39399
+ import("./curator-yawrnk3t.js"),
39400
+ import("./curator-llm-factory-21vqqvn3.js")
39007
39401
  ]);
39008
39402
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
39009
39403
  }
@@ -40012,7 +40406,7 @@ async function computeCurationDiagnostics(directory, entries) {
40012
40406
  let scanCompleted = false;
40013
40407
  let scanRemaining = 0;
40014
40408
  try {
40015
- const { getScanStatus } = await import("./scan-cursor-7s1bz7ew.js");
40409
+ const { getScanStatus } = await import("./scan-cursor-59yj7tp9.js");
40016
40410
  const status = await getScanStatus(directory);
40017
40411
  scanGeneration = status.generation;
40018
40412
  scanCompleted = status.completed;
@@ -40020,19 +40414,19 @@ async function computeCurationDiagnostics(directory, entries) {
40020
40414
  } catch {}
40021
40415
  let configMatch = null;
40022
40416
  try {
40023
- const { isLinked: isLinked2 } = await import("./knowledge-link-z9cchqdj.js");
40417
+ const { isLinked: isLinked2 } = await import("./knowledge-link-cj2abbae.js");
40024
40418
  if (isLinked2(directory)) {
40025
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-78pdxc8f.js");
40419
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-8a7fyp87.js");
40026
40420
  let config;
40027
40421
  try {
40028
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-qy6rcnjg.js");
40422
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-ygxb3jw4.js");
40029
40423
  const loaded = loadPluginConfigWithMeta2(directory);
40030
40424
  config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
40031
40425
  } catch {
40032
40426
  config = KnowledgeConfigSchema2.parse({});
40033
40427
  }
40034
40428
  const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
40035
- const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-72qx868r.js");
40429
+ const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-vn3m5nq2.js");
40036
40430
  const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
40037
40431
  const cohortFp = await readCohortConfigFingerprint(directory);
40038
40432
  configMatch = cohortFp === null ? null : currentFp === cohortFp;
@@ -41345,7 +41739,7 @@ async function handleDoctorCommand(directory, args) {
41345
41739
  const result = runConfigDoctor(config, directory);
41346
41740
  let output;
41347
41741
  if (enableAutoFix && result.hasAutoFixableIssues) {
41348
- const { runConfigDoctorWithFixes } = await import("./config-doctor-9rsk8ags.js");
41742
+ const { runConfigDoctorWithFixes } = await import("./config-doctor-hs0x10ty.js");
41349
41743
  const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
41350
41744
  applyLossy: true
41351
41745
  });
@@ -41383,7 +41777,7 @@ async function handleDoctorCommand(directory, args) {
41383
41777
  `;
41384
41778
  }
41385
41779
  try {
41386
- const { runModelPreflight } = await import("./model-preflight-cv9kvw8h.js");
41780
+ const { runModelPreflight } = await import("./model-preflight-w85ecyxh.js");
41387
41781
  const preflight = await runModelPreflight(config, swarmState.opencodeClient);
41388
41782
  if (preflight.catalogAvailable) {
41389
41783
  const unresolved = preflight.resolutions.filter((resolution) => resolution.status === "unresolved");
@@ -42285,7 +42679,7 @@ async function handleEvidenceCommand(directory, args) {
42285
42679
  return formatTaskEvidenceMarkdown(evidenceData);
42286
42680
  }
42287
42681
  async function handleEvidenceSummaryCommand(directory) {
42288
- const { buildEvidenceSummary } = await import("./evidence-summary-service-bhqvx9qe.js");
42682
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-kmc92b95.js");
42289
42683
  const artifact = await buildEvidenceSummary(directory);
42290
42684
  if (!artifact) {
42291
42685
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -77347,7 +77741,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
77347
77741
  if (!input.dispatcher) {
77348
77742
  throw new Error("no evaluation dispatcher available (cannot run validation)");
77349
77743
  }
77350
- const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-eagt6gf8.js");
77744
+ const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-sj5sf36c.js");
77351
77745
  const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
77352
77746
  const result = await withProtectedSetIntegrity([evalInputRoot, ...protectedRoots(input.directory)], () => _internals97.evaluateCandidateV1({
77353
77747
  projectRoot: input.directory,
@@ -79392,7 +79786,7 @@ function buildDetailedHelp(commandName, entry) {
79392
79786
  async function handleHelpCommand(ctx) {
79393
79787
  const targetCommand = ctx.args.join(" ");
79394
79788
  if (!targetCommand) {
79395
- const { buildHelpText } = await import("./index-w7s5vgb6.js");
79789
+ const { buildHelpText } = await import("./index-4wy9kzjg.js");
79396
79790
  return buildHelpText();
79397
79791
  }
79398
79792
  const tokens = targetCommand.split(/\s+/);
@@ -79401,7 +79795,7 @@ async function handleHelpCommand(ctx) {
79401
79795
  return _internals100.buildDetailedHelp(resolved.key, resolved.entry);
79402
79796
  }
79403
79797
  const similar = _internals100.findSimilarCommands(targetCommand);
79404
- const { buildHelpText: fullHelp } = await import("./index-w7s5vgb6.js");
79798
+ const { buildHelpText: fullHelp } = await import("./index-4wy9kzjg.js");
79405
79799
  if (similar.length > 0) {
79406
79800
  return `Command '/swarm ${targetCommand}' not found.
79407
79801
 
@@ -79732,7 +80126,7 @@ var COMMAND_REGISTRY = {
79732
80126
  },
79733
80127
  "guardrail explain": {
79734
80128
  handler: async (ctx) => {
79735
- const { handleGuardrailExplain } = await import("./guardrail-explain-17me709w.js");
80129
+ const { handleGuardrailExplain } = await import("./guardrail-explain-7xrdp18c.js");
79736
80130
  return handleGuardrailExplain(ctx.directory, ctx.args);
79737
80131
  },
79738
80132
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -79742,7 +80136,7 @@ var COMMAND_REGISTRY = {
79742
80136
  },
79743
80137
  "guardrail reset": {
79744
80138
  handler: async (ctx) => {
79745
- const { handleGuardrailReset } = await import("./guardrail-reset-5n76tj7e.js");
80139
+ const { handleGuardrailReset } = await import("./guardrail-reset-0ks08s0t.js");
79746
80140
  return handleGuardrailReset(ctx.args, ctx.sessionID);
79747
80141
  },
79748
80142
  description: "Reset one exact active invocation/action circuit after repair",
@@ -79751,7 +80145,7 @@ var COMMAND_REGISTRY = {
79751
80145
  },
79752
80146
  "guardrail-explain": {
79753
80147
  handler: async (ctx) => {
79754
- const { handleGuardrailExplain } = await import("./guardrail-explain-17me709w.js");
80148
+ const { handleGuardrailExplain } = await import("./guardrail-explain-7xrdp18c.js");
79755
80149
  return handleGuardrailExplain(ctx.directory, ctx.args);
79756
80150
  },
79757
80151
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -79761,7 +80155,7 @@ var COMMAND_REGISTRY = {
79761
80155
  },
79762
80156
  "guardrail-reset": {
79763
80157
  handler: async (ctx) => {
79764
- const { handleGuardrailReset } = await import("./guardrail-reset-5n76tj7e.js");
80158
+ const { handleGuardrailReset } = await import("./guardrail-reset-0ks08s0t.js");
79765
80159
  return handleGuardrailReset(ctx.args, ctx.sessionID);
79766
80160
  },
79767
80161
  description: "Reset one exact active invocation/action circuit after repair",
@@ -79771,7 +80165,7 @@ var COMMAND_REGISTRY = {
79771
80165
  },
79772
80166
  "guardrail-log": {
79773
80167
  handler: async (ctx) => {
79774
- const { handleGuardrailLog } = await import("./guardrail-log-te4a5fmn.js");
80168
+ const { handleGuardrailLog } = await import("./guardrail-log-f16sdc3p.js");
79775
80169
  return handleGuardrailLog(ctx.directory, ctx.args);
79776
80170
  },
79777
80171
  description: "Read the guardrail decision log (use --blocks-only for blocks)",
@@ -81710,16 +82104,16 @@ HARD CONSTRAINTS (apply regardless of skill load success):
81710
82104
  - No finding may appear as CONFIRMED in the final report without reviewer validation provenance
81711
82105
  - Test execution, explorer lanes, reviewer dispatch, and critic challenge are all permitted within this mode
81712
82106
  - Quality is the only metric \u2014 there is no speed, efficiency, or time exception; time, tokens, and agent dispatches are irrelevant to correctness
81713
- - FOLLOW THE SKILL EXACTLY: execute every phase of the loaded SKILL.md in order with no shortcuts, no phase-skipping, and no premature synthesis. If a required coverage phase cannot complete, apply the skill's coverage gate (retry or verified equivalent alternative). If the gap still cannot be closed, stop and surface the lane failure to the user as BLOCKED; do not produce a degraded review, partial verdict, or final synthesis.
82107
+ - FOLLOW THE SKILL EXACTLY: execute every phase of the loaded SKILL.md in order with no shortcuts, no phase-skipping, and no premature synthesis. If a required coverage phase cannot complete, apply the skill's coverage gate (retry or verified equivalent alternative). If the gap still cannot be closed after every launched lane is terminal or explicitly cancelled, settle N-of-6 truthfully (issue #2383): PARTIAL coverage completes with verdict REQUEST_CHANGES or INCOMPLETE over the covered dimensions' validated findings, and zero coverage completes as an INCOMPLETE operational report \u2014 never a fabricated full review and never an APPROVE.
81714
82108
  - CHECK OUT THE EXACT PR HEAD LOCALLY before dispatching explorer lanes: resolve the authoritative full PR head SHA, verify the working tree is clean (git status --porcelain), and if it is dirty call \`prepare_pr_workflow_checkout\` before checkout \u2014 either with no \`paths\` to auto-discover and preserve every dirty and untracked change in one auditable stash, or with an explicit exact dirty tracked path set. It returns the stash OID and recovery command; an already-clean tree is a no-op. Do NOT run \`git stash\` through shell. Then use standalone commands: fetch the PR head, verify it portably with \`git rev-parse --verify <full_pr_head_sha>^0\` followed by \`git cat-file -t <full_pr_head_sha>\` (which must print \`commit\`), run \`git switch --detach <full_pr_head_sha>\`, confirm HEAD equals that SHA, and bind it through the PR-review controller. Do not use \`--track FETCH_HEAD\`. Explorers read the working-tree filesystem (Read/Glob/Grep), so without this checkout they read the base branch and produce invalid candidates. Always pass the base..head commit range in explorer delegations. Under Profile A, do not create a scratch context-pack file after the gate activates: put bounded shared scope, obligations, and deterministic signals in \`common_prompt\`; every lane must inspect the exact bound diff itself.
81715
82109
  - 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.
81716
82110
  - 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\`. \`pr_review_resilience\` is DISABLED by default, so the legacy one-wave base dispatch is the default path at every depth tier \u2014 do not emit \`pr_review_wave_stage\` or \`pr_review_wave_attempt\` unless a project has explicitly enabled it. Only when a project explicitly sets \`pr_review_resilience.enabled: true\` must depth tier M/L 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 regardless. The runtime rejects omitted stage metadata, partial, duplicate, mislabelled, or structurally invalid waves.
81717
82111
  - 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.
81718
- - 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\` or \`resource\` 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.
82112
+ - 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. When fewer than six base dimensions settle but every launched lane is terminal or explicitly cancelled, the \`post_explorer\` findings write may explicitly submit \`partial_base_coverage: { unresolved_dimensions: [<exactly the uncovered dimensions>] }\` (issue #2383 N-of-6 settlement). Never infer or omit dimensions from this disclosure: the runtime derives each dimension's terminal state from lane evidence, persists an immutable coverage receipt, and rejects any declaration that does not exactly match the derived settlement.
81719
82113
  - 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.
81720
82114
  - 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.
81721
82115
  - 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.
81722
- - COMPLETE EXPLICITLY: after final artifacts and synthesis, call \`complete_pr_workflow\` with \`mode: "PR_REVIEW"\` and the bound \`pr_head_sha\`; never leave the session trapped in a stale workflow gate. When completion reports checkout restoration is required, call \`prepare_pr_workflow_checkout\` with \`operation: "restore"\` before returning to the user.
82116
+ - COMPLETE EXPLICITLY: after final artifacts and synthesis, call \`complete_pr_workflow\` with \`mode: "PR_REVIEW"\`, the bound \`pr_head_sha\`, and the terminal \`report_verdict\` the coverage kind allows (issue #2383): COMPLETE may APPROVE, REQUEST_CHANGES, or INCOMPLETE; PARTIAL only REQUEST_CHANGES or INCOMPLETE; NO_COVERAGE must be INCOMPLETE and skips the findings ladder entirely. Never leave the session trapped in a stale workflow gate. When completion reports checkout restoration is required, call \`prepare_pr_workflow_checkout\` with \`operation: "restore"\` before returning to the user. For a publication-armed workflow whose exact publication cannot proceed, \`abort_pr_workflow\` with \`kind: "armed_recovery"\` plus the armed-recovery identity fields is the audited escape that preserves validated work.
81723
82117
  - ABORT IF UNRECOVERABLE: if the PR head cannot be fetched/checked out (the working tree stays on the wrong branch), a compound \`git fetch && git checkout\` keeps being rejected as read-only shell syntax (run them as TWO separate standalone commands first), the merge-base bind is unreachable, or the bounded lane retries above are exhausted, call \`abort_pr_workflow\` with \`mode: "PR_REVIEW"\`, \`kind: "recovery"\`, and a one-line \`reason\` instead of looping. The tool accepts unbound and bound workflows but refuses while PR workflow lanes are in flight (collect their results first). Aborting clears the durable gate and stops the auto-resume loop; the user can force-clear via \`/swarm abort-pr-workflow\`. Do NOT abort while useful bounded recovery work remains.
81724
82118
  - Honor any free-text instructions that follow the closing bracket of the signal as additional reviewer focus, without weakening the validation ladder above.
81725
82119
 
@@ -82474,6 +82868,12 @@ Use these definitions precisely \u2014 do not inflate severity:
82474
82868
  - LOW: Code smell, readability concern, or minor optimization opportunity. Optional.
82475
82869
  - INFO: Suggestion for future improvement. Not a blocker.
82476
82870
 
82871
+ ## TYPED RISK METADATA (issue #2383)
82872
+ Every CONFIRMED verdict row must also classify typed risk, which drives critic routing:
82873
+ - risk_impact: ORDINARY (routine code path) | HIGH_IMPACT (core data flow, state, money, auth, or blast radius across subsystems) | UNKNOWN (use HONESTLY when you cannot assess impact \u2014 UNKNOWN always routes the finding to a critic; never guess ORDINARY to avoid routing, and never let file paths, keywords, or dimension names decide for you).
82874
+ - risk_tags (comma-separated, any that apply): SECURITY, AUTH_PERMISSIONS, STATE_INTEGRITY, WRITE_PATH, EVIDENCE_INTEGRITY, GIT, CONFIGURATION. Empty means none apply.
82875
+ Routing effect: CRITICAL/HIGH always route to critic; a MEDIUM routes only when HIGH_IMPACT or it carries any tag; an ORDINARY MEDIUM with no tags does not.
82876
+
82477
82877
  CALIBRATION RULE \u2014 If you find NO issues, state this explicitly:
82478
82878
  "NO ISSUES FOUND \u2014 Reviewed [N] changed functions. Preconditions verified for: [list]. Edge cases considered: [list]. No logic errors, security concerns, or contract changes detected."
82479
82879
  A blank APPROVED without reasoning is NOT acceptable \u2014 it indicates you did not actually review.
@@ -85758,7 +86158,7 @@ function getDisplayFinalPromptPressure() {
85758
86158
  async function rehydratePrSubscriptions(sessionID, directory) {
85759
86159
  const map = new Map;
85760
86160
  try {
85761
- const { listActive: listActive2 } = await import("./pr-subscriptions-76vg2xya.js");
86161
+ const { listActive: listActive2 } = await import("./pr-subscriptions-j9j70bmd.js");
85762
86162
  const records = await listActive2(directory);
85763
86163
  for (const record of records) {
85764
86164
  if (record.sessionID !== sessionID)
@@ -86204,7 +86604,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
86204
86604
  return extracted === expectedSessionId;
86205
86605
  }
86206
86606
  async function inspectStandardWorktreeCollisionOwnership(identity) {
86207
- const collisionOwnership = await import("./worktree-collision-ownership-ry7xnaae.js");
86607
+ const collisionOwnership = await import("./worktree-collision-ownership-6x03w8h7.js");
86208
86608
  return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
86209
86609
  }
86210
86610
  async function runRecoveryGit(directory, args, timeoutMs = 15000) {
@@ -86613,7 +87013,7 @@ async function precreateStandardWorktreeSession(args) {
86613
87013
  const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, handle.worktreePath);
86614
87014
  if (laneProfile) {
86615
87015
  try {
86616
- const { writeLaneProfileToDiskReal } = await import("./core-7zwdc0sk.js");
87016
+ const { writeLaneProfileToDiskReal } = await import("./core-a42bexs1.js");
86617
87017
  await writeLaneProfileToDiskReal(handle.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
86618
87018
  } catch {}
86619
87019
  }
@@ -87538,7 +87938,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
87538
87938
  }
87539
87939
  clearWorktreeMergeStatus(statusKey);
87540
87940
  try {
87541
- const { removeLaneProfileFromDiskReal } = await import("./core-7zwdc0sk.js");
87941
+ const { removeLaneProfileFromDiskReal } = await import("./core-a42bexs1.js");
87542
87942
  await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
87543
87943
  } catch {}
87544
87944
  const state = serializationStateBySessionID.get(dispatch.parentSessionID);
@@ -87741,4 +88141,4 @@ var _internals102 = {
87741
88141
  resolveGitExecutable
87742
88142
  };
87743
88143
 
87744
- export { resetActionCircuitExternally, getBlockingActionCircuit, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, getSharedClassifierGuardrailBlock, classifyCommand, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, getAgentSession, parseLeanLaneIndex, computeLaneRuntimeProfile, MAX_TRACKED_STANDARD_WORKTREE_CALLS, awaitingMergeByCallID, standardWorktreeByCallID, standardWorktreeSerializationSessions, getStandardWorktreeDegradationReason, resetStandardWorktreeIsolationState, checkStandardWorktreeSerializationRelease, sanitizeWorktreeTaskId, preProvisionCollisionCheck, isLaneOwnedByCurrentSession, precreateStandardWorktreeSession, preserveBackgroundWorktreeOwnershipForCallId, preserveDirtyWorktreeForCallId, preserveDirtyWorktreeAtPath, cleanupStandardWorktreeForCallId, abortStandardWorktreeDispatch, finishStandardWorktreeDispatch, readLaneEnvFileFromDisk, _internals102 as _internals, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleApproveWriteCommand, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals26 as _internals1, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals30 as _internals2, createHivePromoterHook, promoteToHive, promoteFromSwarm, safeRealpathSync, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, VERSION_PINNED_LEAF, discoverVersionPinnedCachePaths, readCachePackageVersion, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleBlueprintValidateCommand, handleBlueprintCurrentCommand, handleBlueprintHistoryCommand, handleBlueprintDiffCommand, handleBlueprintExportCommand, handleHarnessCandidateValidateCommand, handleHarnessCandidateShowCommand, handleHarnessCandidateDiffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleRecoverCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleReviewCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals100 as _internals3, resolveCommand };
88144
+ export { PrReviewRunIdSchema, resetActionCircuitExternally, getBlockingActionCircuit, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, getSharedClassifierGuardrailBlock, classifyCommand, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, getAgentSession, parseLeanLaneIndex, computeLaneRuntimeProfile, MAX_TRACKED_STANDARD_WORKTREE_CALLS, awaitingMergeByCallID, standardWorktreeByCallID, standardWorktreeSerializationSessions, getStandardWorktreeDegradationReason, resetStandardWorktreeIsolationState, checkStandardWorktreeSerializationRelease, sanitizeWorktreeTaskId, preProvisionCollisionCheck, isLaneOwnedByCurrentSession, precreateStandardWorktreeSession, preserveBackgroundWorktreeOwnershipForCallId, preserveDirtyWorktreeForCallId, preserveDirtyWorktreeAtPath, cleanupStandardWorktreeForCallId, abortStandardWorktreeDispatch, finishStandardWorktreeDispatch, readLaneEnvFileFromDisk, _internals102 as _internals, readPrReviewReentryBindingContext, prWorkflowSessionFileStem, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleApproveWriteCommand, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals26 as _internals1, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals30 as _internals2, createHivePromoterHook, promoteToHive, promoteFromSwarm, safeRealpathSync, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, VERSION_PINNED_LEAF, discoverVersionPinnedCachePaths, readCachePackageVersion, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleBlueprintValidateCommand, handleBlueprintCurrentCommand, handleBlueprintHistoryCommand, handleBlueprintDiffCommand, handleBlueprintExportCommand, handleHarnessCandidateValidateCommand, handleHarnessCandidateShowCommand, handleHarnessCandidateDiffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleRecoverCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleReviewCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals100 as _internals3, resolveCommand };