opencode-swarm 7.178.1 → 7.179.0

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 (96) hide show
  1. package/.opencode/skills/deep-dive/SKILL.md +1 -1
  2. package/.opencode/skills/running-tests/SKILL.md +30 -24
  3. package/.opencode/skills/swarm-plan/SKILL.md +1 -1
  4. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  5. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  6. package/dist/agents/critic.d.ts +6 -6
  7. package/dist/agents/explorer.d.ts +1 -1
  8. package/dist/cli/{coder-settlement-m03dfyec.js → coder-settlement-7pt3a0y0.js} +8 -8
  9. package/dist/cli/{config-doctor-x8b260sh.js → config-doctor-82w4bp4b.js} +3 -3
  10. package/dist/cli/{core-2d0xcyby.js → core-9rqzs794.js} +2 -2
  11. package/dist/cli/{curation-policy-7am15ht9.js → curation-policy-c7mdsf7m.js} +4 -4
  12. package/dist/cli/{curator-llm-factory-rgdb2ee5.js → curator-llm-factory-cbm1ny30.js} +33 -33
  13. package/dist/cli/{curator-5kfkqzc9.js → curator-m8act07j.js} +33 -33
  14. package/dist/cli/{dispatch-9yqqqfr6.js → dispatch-3rwdxpp2.js} +1 -1
  15. package/dist/cli/{evidence-summary-service-959pwbwb.js → evidence-summary-service-a99bgje1.js} +13 -13
  16. package/dist/cli/{explorer-2cv64zfj.js → explorer-z0cf5cz0.js} +1 -1
  17. package/dist/cli/{gate-evidence-66kjx6zj.js → gate-evidence-yssmxba5.js} +5 -5
  18. package/dist/cli/{guardrail-explain-rre9ntq3.js → guardrail-explain-ffwmhf7s.js} +34 -34
  19. package/dist/cli/{guardrail-log-t0ydqz5s.js → guardrail-log-j2wtq7p2.js} +7 -7
  20. package/dist/cli/{guardrail-reset-6gad352a.js → guardrail-reset-07byr7nr.js} +33 -33
  21. package/dist/cli/{hive-promoter-zgnagx67.js → hive-promoter-ewrz7vh1.js} +33 -33
  22. package/dist/cli/{index-ksq6cqg0.js → index-09wm3963.js} +5 -5
  23. package/dist/cli/{index-6e8fpjdg.js → index-0bc8jdnv.js} +2 -2
  24. package/dist/cli/{index-xr9n0vjv.js → index-0h3cr7pn.js} +1 -1
  25. package/dist/cli/{index-fyfbpz4f.js → index-1c1dbwze.js} +1 -0
  26. package/dist/cli/{index-1zrrerev.js → index-1rwyfvq2.js} +2 -2
  27. package/dist/cli/{index-qbs49vge.js → index-1sz02k85.js} +1 -1
  28. package/dist/cli/{index-t8dqe4ns.js → index-34bwqcea.js} +1 -1
  29. package/dist/cli/{index-7kty6f59.js → index-3hne91yd.js} +5 -5
  30. package/dist/cli/{index-yew23624.js → index-6r92fw88.js} +4 -4
  31. package/dist/cli/{index-j7w16s92.js → index-6tnkvqr9.js} +2 -2
  32. package/dist/cli/{index-x1m1nnry.js → index-7zmbtxw1.js} +4 -4
  33. package/dist/cli/{index-kj599831.js → index-80q47hpw.js} +2 -2
  34. package/dist/cli/{index-r78kphsr.js → index-8815e95e.js} +3 -3
  35. package/dist/cli/{index-pyxs697r.js → index-9p1pqykb.js} +5 -5
  36. package/dist/cli/{index-whjrhatw.js → index-a11ztzs5.js} +18 -1
  37. package/dist/cli/{index-eq1n57tg.js → index-amf88k1e.js} +1 -1
  38. package/dist/cli/{index-bb148vht.js → index-cvg402ha.js} +1 -1
  39. package/dist/cli/{index-wajcx84s.js → index-d66zb40k.js} +651 -179
  40. package/dist/cli/{index-1jcy4gc6.js → index-etmwjgre.js} +33 -33
  41. package/dist/cli/{index-kz9pcqn9.js → index-f2v90gfc.js} +1 -1
  42. package/dist/cli/{index-7n4dtzk4.js → index-g6nyk713.js} +1 -1
  43. package/dist/cli/{index-w1b5qqnp.js → index-h59vsbch.js} +2 -2
  44. package/dist/cli/{index-xr3eye3f.js → index-hwcra3y9.js} +7 -7
  45. package/dist/cli/{index-2e6txjp7.js → index-kanxpgf8.js} +3 -3
  46. package/dist/cli/{index-1hgqs8j8.js → index-kmhnkn6t.js} +3 -3
  47. package/dist/cli/{index-2pyba37z.js → index-ndwbb3xm.js} +6 -6
  48. package/dist/cli/{index-nrfjjqm4.js → index-pskba939.js} +1 -1
  49. package/dist/cli/{index-1qnykdaw.js → index-pxtye2ng.js} +35 -35
  50. package/dist/cli/{index-pk97v7b8.js → index-qt0793qm.js} +4 -4
  51. package/dist/cli/{index-x54339yd.js → index-qxk5qkfh.js} +5 -5
  52. package/dist/cli/{index-4e4zsj2g.js → index-sv4y1cma.js} +5 -5
  53. package/dist/cli/{index-byfrearz.js → index-tmy46dtd.js} +4 -4
  54. package/dist/cli/{index-zv3j0v08.js → index-twtez316.js} +2 -2
  55. package/dist/cli/{index-m2n1rhgv.js → index-w872yykk.js} +1 -1
  56. package/dist/cli/{index-h0kyy9rd.js → index-wvpsm8ja.js} +9 -9
  57. package/dist/cli/{index-b50qevsm.js → index-yagqxt2p.js} +4 -4
  58. package/dist/cli/{index-0pmh1kks.js → index-yfpswnjt.js} +1 -1
  59. package/dist/cli/{index-hnvmj9wx.js → index-zgvzbz48.js} +14 -4
  60. package/dist/cli/index.js +34 -34
  61. package/dist/cli/{knowledge-escalator-5r6mww64.js → knowledge-escalator-yx97q9c1.js} +11 -11
  62. package/dist/cli/{knowledge-events-typjw0sd.js → knowledge-events-p269fyvv.js} +9 -9
  63. package/dist/cli/{knowledge-link-mvykydxg.js → knowledge-link-gfz47ves.js} +3 -3
  64. package/dist/cli/{knowledge-store-9qcf3emn.js → knowledge-store-36zemyqa.js} +4 -4
  65. package/dist/cli/{knowledge-validator-k6ydsxzy.js → knowledge-validator-rd20yq41.js} +6 -6
  66. package/dist/cli/{mcp-tedxsgey.js → mcp-sg9zrkz2.js} +1 -1
  67. package/dist/cli/{model-preflight-kh9dwts2.js → model-preflight-61xgqwcs.js} +1 -1
  68. package/dist/cli/{pending-delegations-d20fnrzv.js → pending-delegations-8p2gf4kt.js} +8 -8
  69. package/dist/cli/{pr-subscriptions-awwhg139.js → pr-subscriptions-4dj9r71h.js} +8 -8
  70. package/dist/cli/{pr-workflow-gate-ke79bb9c.js → pr-workflow-gate-8dgz5z1h.js} +35 -33
  71. package/dist/cli/{runner-y3sydwtj.js → runner-16b691ba.js} +4 -4
  72. package/dist/cli/{scan-cursor-16s6dp7f.js → scan-cursor-nx0jv9ya.js} +5 -5
  73. package/dist/cli/{schema-nqjp43vq.js → schema-q6gsrxwz.js} +2 -2
  74. package/dist/cli/{scope-persistence-8z1hwdr2.js → scope-persistence-1k4xsyh7.js} +13 -13
  75. package/dist/cli/{server-x16hp9aq.js → server-shhxq34t.js} +33 -33
  76. package/dist/cli/{skill-generator-xadg43ph.js → skill-generator-6j7tq2tb.js} +13 -13
  77. package/dist/cli/{snapshot-coordination-init-3yyzb2c4.js → snapshot-coordination-init-h8n8w1cm.js} +33 -33
  78. package/dist/cli/{telemetry-c9wv2cfw.js → telemetry-qxav5cdk.js} +1 -1
  79. package/dist/cli/{worktree-collision-ownership-drqhmmtd.js → worktree-collision-ownership-97jzh4ra.js} +8 -8
  80. package/dist/cli/{worktree-isolation-aebdyb1m.js → worktree-isolation-g4w74ccb.js} +33 -33
  81. package/dist/commands/registry.d.ts +3 -3
  82. package/dist/db/coordination-store.d.ts +10 -0
  83. package/dist/hooks/pr-workflow-gate.d.ts +15 -6
  84. package/dist/index.js +77 -64
  85. package/dist/mutation/engine.d.ts +6 -0
  86. package/dist/mutation/equivalence.d.ts +12 -1
  87. package/dist/pr-review/circuit.d.ts +3 -3
  88. package/dist/pr-review/legacy-transcript-adapter.d.ts +7 -10
  89. package/dist/pr-review/persistence.d.ts +36 -0
  90. package/dist/retention/sweep.d.ts +4 -0
  91. package/dist/tools/mutation-test.d.ts +6 -0
  92. package/dist/tools/prepare-pr-workflow-checkout.d.ts +19 -0
  93. package/dist/tools/repo-map-action-dispositions.d.ts +23 -0
  94. package/dist/tools/test-runner.d.ts +17 -2
  95. package/package.json +1 -1
  96. package/dist/pr-review/guardrails.d.ts +0 -67
@@ -8,7 +8,7 @@ import {
8
8
  isCommandAvailable,
9
9
  resolveLocalNodeTool,
10
10
  tool
11
- } from "./index-hnvmj9wx.js";
11
+ } from "./index-zgvzbz48.js";
12
12
  import {
13
13
  captureWorkingTreeFingerprint,
14
14
  createModelEvaluationExecutor,
@@ -16,7 +16,7 @@ import {
16
16
  resolveExecutableFromPath,
17
17
  runEvaluation,
18
18
  runExternalTool
19
- } from "./index-nrfjjqm4.js";
19
+ } from "./index-pskba939.js";
20
20
  import {
21
21
  finalizeShellAuditForClose,
22
22
  isPolicyProtectedPath,
@@ -26,7 +26,7 @@ import {
26
26
  protectedRoots,
27
27
  redactDecisionLineForArchive,
28
28
  stableCanonicalStringify
29
- } from "./index-x1m1nnry.js";
29
+ } from "./index-7zmbtxw1.js";
30
30
  import {
31
31
  canonicalProjectKey,
32
32
  closeGroupCommitWriter,
@@ -39,7 +39,7 @@ import {
39
39
  readDoctorArtifact,
40
40
  removeStraySwarmDir,
41
41
  runConfigDoctor
42
- } from "./index-6e8fpjdg.js";
42
+ } from "./index-0bc8jdnv.js";
43
43
  import {
44
44
  MAX_TRANSIENT_RETRIES,
45
45
  archiveEvidence,
@@ -76,7 +76,7 @@ import {
76
76
  updateTaskStatus,
77
77
  validateProjectRoot,
78
78
  withPlanLifecycleLock
79
- } from "./index-h0kyy9rd.js";
79
+ } from "./index-wvpsm8ja.js";
80
80
  import {
81
81
  EvaluationTaskV1Schema,
82
82
  GateAuditManifestV1Schema,
@@ -93,7 +93,7 @@ import {
93
93
  saveGateAuditResult,
94
94
  savePromotionDecision,
95
95
  saveTaskSetSnapshot
96
- } from "./index-7n4dtzk4.js";
96
+ } from "./index-g6nyk713.js";
97
97
  import {
98
98
  canonicalHash,
99
99
  canonicalJson,
@@ -141,15 +141,15 @@ import {
141
141
  retireSkill,
142
142
  selectCandidateEntries,
143
143
  syncBundledProjectSkillsIfMissingAsync
144
- } from "./index-r78kphsr.js";
144
+ } from "./index-8815e95e.js";
145
145
  import {
146
146
  readRecentEscalations
147
- } from "./index-x54339yd.js";
147
+ } from "./index-qxk5qkfh.js";
148
148
  import {
149
149
  alreadyCuratedThisGeneration,
150
150
  claimNextScanBatch,
151
151
  resolveCohortId
152
- } from "./index-1zrrerev.js";
152
+ } from "./index-1rwyfvq2.js";
153
153
  import {
154
154
  CURATOR_CONSOLIDATION_PROMPT,
155
155
  CURATOR_INIT_PROMPT,
@@ -159,7 +159,7 @@ import {
159
159
  READ_ONLY_LANE_GUIDANCE,
160
160
  createExplorerAgent,
161
161
  resolvePrompt
162
- } from "./index-fyfbpz4f.js";
162
+ } from "./index-1c1dbwze.js";
163
163
  import {
164
164
  buildCorrelationId,
165
165
  getPrSubscriptionHealth,
@@ -169,7 +169,7 @@ import {
169
169
  sweepStale,
170
170
  unsubscribe,
171
171
  updateSnapshot
172
- } from "./index-yew23624.js";
172
+ } from "./index-6r92fw88.js";
173
173
  import {
174
174
  clearWorktreeMergeStatus,
175
175
  getAllWorktreeMergeFailures,
@@ -181,7 +181,7 @@ import {
181
181
  listCoderSettlementWalStates,
182
182
  recoverCoderSettlement,
183
183
  recoverStaleCoderSettlements
184
- } from "./index-7kty6f59.js";
184
+ } from "./index-3hne91yd.js";
185
185
  import {
186
186
  parsePorcelainV2Snapshot,
187
187
  resolveCommitCountSince,
@@ -252,7 +252,7 @@ import {
252
252
  transitionTaskWorkflowEvidence,
253
253
  withTaskEvidenceTransaction,
254
254
  writeWorkflowWalFile
255
- } from "./index-1hgqs8j8.js";
255
+ } from "./index-kmhnkn6t.js";
256
256
  import {
257
257
  isPathUnderSwarmWorktreeBase,
258
258
  listLiveLaneOwners,
@@ -261,7 +261,7 @@ import {
261
261
  recordLiveLaneOwner,
262
262
  removeWorktree,
263
263
  resolveWorktreeBaseDir
264
- } from "./index-j7w16s92.js";
264
+ } from "./index-6tnkvqr9.js";
265
265
  import {
266
266
  DEFAULT_STALE_DELEGATION_TIMEOUT_MS,
267
267
  DELEGATION_COMPACTION_HIGH_WATER_BYTES,
@@ -295,7 +295,7 @@ import {
295
295
  scanBackgroundCoderReservationsForAdmission,
296
296
  scanDelegationsForRecovery,
297
297
  sweepStaleDelegations
298
- } from "./index-4e4zsj2g.js";
298
+ } from "./index-sv4y1cma.js";
299
299
  import {
300
300
  MAX_EVENT_LOG_ENTRIES,
301
301
  _internals,
@@ -311,7 +311,7 @@ import {
311
311
  recordKnowledgeEvent,
312
312
  recordPhaseCloseIntent,
313
313
  resolveKnowledgeEventsPath
314
- } from "./index-xr3eye3f.js";
314
+ } from "./index-hwcra3y9.js";
315
315
  import {
316
316
  estimateTokens,
317
317
  readSwarmFileAsync,
@@ -337,18 +337,18 @@ import {
337
337
  validateActionableFields,
338
338
  validateLesson,
339
339
  validateSkillPath
340
- } from "./index-b50qevsm.js";
340
+ } from "./index-yagqxt2p.js";
341
341
  import {
342
342
  MAX_CURATION_PROPOSALS,
343
343
  authorizeCuration,
344
344
  buildConfigFingerprintInput
345
- } from "./index-xr9n0vjv.js";
345
+ } from "./index-0h3cr7pn.js";
346
346
  import {
347
347
  cohortConfigFingerprint
348
348
  } from "./index-rtry5xyf.js";
349
349
  import {
350
350
  resolveWorktreeIsolationConfig
351
- } from "./index-2e6txjp7.js";
351
+ } from "./index-kanxpgf8.js";
352
352
  import {
353
353
  RetrospectiveEvidenceSchema
354
354
  } from "./index-frcemc0b.js";
@@ -360,7 +360,7 @@ import {
360
360
  clearScopeBindings,
361
361
  readAuthoritativeScopeBindingSet,
362
362
  readDeclaredScopeFilesFromBindings
363
- } from "./index-pyxs697r.js";
363
+ } from "./index-9p1pqykb.js";
364
364
  import {
365
365
  clearPlanLedgerForReset,
366
366
  computePlanStructureHash,
@@ -376,7 +376,7 @@ import {
376
376
  replayFromLedgerWithStatus,
377
377
  resolvePlanningProfile,
378
378
  takeSnapshotEvent
379
- } from "./index-ksq6cqg0.js";
379
+ } from "./index-09wm3963.js";
380
380
  import {
381
381
  CORE_EVENT_LOCKED,
382
382
  appendCoreEventSync,
@@ -386,7 +386,7 @@ import {
386
386
  hasSpecDriftAuditEvent,
387
387
  hasTaskRepairAuditEvent,
388
388
  readCoreEvents
389
- } from "./index-w1b5qqnp.js";
389
+ } from "./index-h59vsbch.js";
390
390
  import {
391
391
  DEFAULT_QA_GATES,
392
392
  computeProfileHash,
@@ -394,7 +394,7 @@ import {
394
394
  getEffectiveGates,
395
395
  getProfileLookupForIdentity,
396
396
  setGatesForIdentity
397
- } from "./index-bb148vht.js";
397
+ } from "./index-cvg402ha.js";
398
398
  import {
399
399
  MAX_COORDINATION_STATE_LIST_ROWS,
400
400
  deleteCoordinationImports,
@@ -402,11 +402,12 @@ import {
402
402
  derivePlanId,
403
403
  derivePlanIdentityHash,
404
404
  getCoordinationState,
405
+ getCoordinationStateRaw,
405
406
  importCoordinationOnce,
406
407
  listCoordinationStates,
407
408
  transitionCoordinationState,
408
409
  withCoordinationTransaction
409
- } from "./index-whjrhatw.js";
410
+ } from "./index-a11ztzs5.js";
410
411
  import {
411
412
  DURABILITY_CLASSES,
412
413
  closeAllProjectDbs,
@@ -429,7 +430,7 @@ import {
429
430
  observeCuratorCompliance,
430
431
  observeStoreHealth,
431
432
  readLearningHealth
432
- } from "./index-0pmh1kks.js";
433
+ } from "./index-yfpswnjt.js";
433
434
  import {
434
435
  appendKnowledge,
435
436
  appendRejectedLesson,
@@ -459,7 +460,7 @@ import {
459
460
  transactFile,
460
461
  transactKnowledge,
461
462
  wordBigrams
462
- } from "./index-2pyba37z.js";
463
+ } from "./index-ndwbb3xm.js";
463
464
  import {
464
465
  readTailJsonl,
465
466
  readTailJsonlDetailed,
@@ -480,7 +481,7 @@ import {
480
481
  resolveLinkDir,
481
482
  sanitizeLinkId,
482
483
  writeLinkPointer
483
- } from "./index-t8dqe4ns.js";
484
+ } from "./index-34bwqcea.js";
484
485
  import {
485
486
  assertProjectRoot,
486
487
  atomicWriteFile,
@@ -489,7 +490,7 @@ import {
489
490
  listActiveLocks,
490
491
  tryAcquireLock,
491
492
  withEvidenceLock
492
- } from "./index-kz9pcqn9.js";
493
+ } from "./index-f2v90gfc.js";
493
494
  import {
494
495
  require_proper_lockfile
495
496
  } from "./index-7g4c7s5r.js";
@@ -503,7 +504,7 @@ import {
503
504
  pseudonymousRef,
504
505
  resolveLineageSalt,
505
506
  telemetry
506
- } from "./index-pk97v7b8.js";
507
+ } from "./index-qt0793qm.js";
507
508
  import {
508
509
  atomicWriteSwarmFile,
509
510
  atomicWriteSwarmFileSync,
@@ -530,7 +531,7 @@ import {
530
531
  loadPluginConfig,
531
532
  loadPluginConfigWithMeta,
532
533
  resolveActivePhaseId
533
- } from "./index-qbs49vge.js";
534
+ } from "./index-1sz02k85.js";
534
535
  import {
535
536
  init_git_executable,
536
537
  resolveGitExecutable,
@@ -559,7 +560,7 @@ import {
559
560
  resolveAutoReviewConfig,
560
561
  resolveGeneratedAgentRole,
561
562
  stripKnownSwarmPrefix
562
- } from "./index-zv3j0v08.js";
563
+ } from "./index-twtez316.js";
563
564
  import {
564
565
  AGENT_TOOL_MAP,
565
566
  ALL_AGENT_NAMES,
@@ -582,7 +583,7 @@ import {
582
583
  init_agent_names,
583
584
  init_constants,
584
585
  init_tool_metadata
585
- } from "./index-m2n1rhgv.js";
586
+ } from "./index-w872yykk.js";
586
587
  import {
587
588
  KNOWLEDGE_SCHEMA_VERSION,
588
589
  OUTCOME_BLOCK_THRESHOLD,
@@ -2829,6 +2830,7 @@ var STATE_MUTATION_LOCK_MAX_ATTEMPTS = 50;
2829
2830
  var STATE_MUTATION_LOCK_RETRY_DELAY_MS = 10;
2830
2831
  var STATE_MUTATION_LOCK_UNINITIALIZED_STALE_MS = 30000;
2831
2832
  var CHECKOUT_MUTATION_ACTION_TIMEOUT_MS = 5 * 60000;
2833
+ var MAX_COORDINATION_PAYLOAD_CHARS = 1048576;
2832
2834
  var trackedStatesByProjectSession = new Map;
2833
2835
  var pendingStateMutationsByProjectSession = new Map;
2834
2836
  var pendingCheckoutMutationsByProject = new Map;
@@ -3050,6 +3052,61 @@ async function readPrWorkflowGateStateFromCoordination(directory, sessionID) {
3050
3052
  const decoded = readPrWorkflowGateStateCoordinationRow(directory, sessionID);
3051
3053
  return decoded?.state ?? null;
3052
3054
  }
3055
+ function readPrWorkflowGateStateCoordinationForRecovery(directory, sessionID) {
3056
+ const normalizedSessionID = normalizeSessionID(sessionID);
3057
+ const row = getCoordinationStateRaw(directory, workflowGateStateCoordinationNamespace(normalizedSessionID), WORKFLOW_STATE_ENTITY_KEY);
3058
+ if (!row)
3059
+ return { kind: "absent" };
3060
+ if (row.payload.length > MAX_COORDINATION_PAYLOAD_CHARS) {
3061
+ return {
3062
+ kind: "corrupt",
3063
+ rowRevision: row.revision,
3064
+ generation: row.generation,
3065
+ reason: "coordination payload exceeds the maximum size"
3066
+ };
3067
+ }
3068
+ let parsedJson;
3069
+ try {
3070
+ parsedJson = JSON.parse(row.payload);
3071
+ } catch {
3072
+ return {
3073
+ kind: "corrupt",
3074
+ rowRevision: row.revision,
3075
+ generation: row.generation,
3076
+ reason: "coordination payload is not valid JSON"
3077
+ };
3078
+ }
3079
+ const bound = requireCodec();
3080
+ const parsed = bound.safeParse(parsedJson);
3081
+ if (!parsed.success) {
3082
+ return {
3083
+ kind: "corrupt",
3084
+ rowRevision: row.revision,
3085
+ generation: row.generation,
3086
+ reason: "coordination payload failed the workflow state schema"
3087
+ };
3088
+ }
3089
+ if (parsed.data.sessionID !== normalizedSessionID) {
3090
+ return {
3091
+ kind: "invalid",
3092
+ reason: "coordination payload session identity does not match the requested session"
3093
+ };
3094
+ }
3095
+ if (parsed.data.revision !== row.generation) {
3096
+ return {
3097
+ kind: "corrupt",
3098
+ rowRevision: row.revision,
3099
+ generation: row.generation,
3100
+ reason: "coordination payload revision does not match its generation"
3101
+ };
3102
+ }
3103
+ return {
3104
+ kind: "valid",
3105
+ rowRevision: row.revision,
3106
+ generation: row.generation,
3107
+ state: parsed.data
3108
+ };
3109
+ }
3053
3110
  function readPrWorkflowGateStateCoordinationRow(directory, sessionID) {
3054
3111
  const row = getCoordinationState(directory, workflowGateStateCoordinationNamespace(sessionID), WORKFLOW_STATE_ENTITY_KEY);
3055
3112
  if (!row)
@@ -3062,7 +3119,7 @@ function readPrWorkflowGateStateCoordinationRow(directory, sessionID) {
3062
3119
  }
3063
3120
  const bound = requireCodec();
3064
3121
  const parsed = bound.safeParse(parsedJson);
3065
- if (!parsed.success || parsed.data.revision !== row.generation) {
3122
+ if (!parsed.success || parsed.data.sessionID !== normalizeSessionID(sessionID) || parsed.data.revision !== row.generation) {
3066
3123
  throw new Error(`BLOCKED: PR workflow gate state for session "${sessionID}" is invalid`);
3067
3124
  }
3068
3125
  return { rowRevision: row.revision, state: parsed.data };
@@ -3164,6 +3221,29 @@ async function repairImportedWorkflowGateShadow(directory, sessionID, state) {
3164
3221
  archiveLegacy: true
3165
3222
  });
3166
3223
  }
3224
+ async function removeWorkflowGateShadowProjection(directory, sessionID) {
3225
+ for (const filePath of [
3226
+ workflowGateStatePath(directory, sessionID),
3227
+ workflowGateStateProjectionMarkerPath(directory, sessionID)
3228
+ ]) {
3229
+ try {
3230
+ await (hooks.removeShadowProjection ?? ((target) => fsp2.rm(target, { force: true })))(filePath);
3231
+ } catch (error2) {
3232
+ if (error2.code !== "ENOENT")
3233
+ throw error2;
3234
+ }
3235
+ }
3236
+ }
3237
+ function appendSessionTerminalizationEvent(directory, sessionID, rowRevision) {
3238
+ try {
3239
+ appendCoreEventSync(directory, {
3240
+ type: "pr_workflow_session_terminalized",
3241
+ timestamp: isoNow(),
3242
+ sessionID,
3243
+ rowRevision
3244
+ });
3245
+ } catch {}
3246
+ }
3167
3247
  async function importLegacyPrWorkflowGateStateIfNeeded(directory, sessionID, allowSalvagedImport = false) {
3168
3248
  const filePath = workflowGateStatePath(directory, sessionID);
3169
3249
  let raw;
@@ -3174,7 +3254,7 @@ async function importLegacyPrWorkflowGateStateIfNeeded(directory, sessionID, all
3174
3254
  return null;
3175
3255
  throw error2;
3176
3256
  }
3177
- const legacy = allowSalvagedImport ? (await (await import("./pr-workflow-gate-ke79bb9c.js")).readPrWorkflowGateStateForRecovery(directory, sessionID))?.state ?? null : await readPrWorkflowGateStateFileFromDisk(filePath, sessionID);
3257
+ const legacy = allowSalvagedImport ? (await (await import("./pr-workflow-gate-8dgz5z1h.js")).readPrWorkflowGateStateForRecovery(directory, sessionID))?.state ?? null : await readPrWorkflowGateStateFileFromDisk(filePath, sessionID);
3178
3258
  if (!legacy)
3179
3259
  return null;
3180
3260
  const namespace = workflowGateStateCoordinationNamespace(sessionID);
@@ -3240,11 +3320,28 @@ async function writeStateWhileLocked(directory, state, options = {}) {
3240
3320
  }
3241
3321
  async function deleteStateWhileLocked(directory, sessionID, options = {}) {
3242
3322
  const normalizedSessionID = normalizeSessionID(sessionID);
3243
- let currentAuthoritative = readPrWorkflowGateStateCoordinationRow(directory, normalizedSessionID);
3323
+ let currentAuthoritative = null;
3324
+ let corruptCoordinationRowRevision;
3325
+ if (options.allowSalvagedRead) {
3326
+ const coordination = readPrWorkflowGateStateCoordinationForRecovery(directory, normalizedSessionID);
3327
+ if (coordination.kind === "invalid") {
3328
+ throw new Error(`BLOCKED: PR workflow gate state for session "${normalizedSessionID}" is invalid (${coordination.reason})`);
3329
+ }
3330
+ if (coordination.kind === "valid") {
3331
+ currentAuthoritative = {
3332
+ rowRevision: coordination.rowRevision,
3333
+ state: coordination.state
3334
+ };
3335
+ } else if (coordination.kind === "corrupt") {
3336
+ corruptCoordinationRowRevision = coordination.rowRevision;
3337
+ }
3338
+ } else {
3339
+ currentAuthoritative = readPrWorkflowGateStateCoordinationRow(directory, normalizedSessionID);
3340
+ }
3244
3341
  let recoveryState = null;
3245
3342
  if (!currentAuthoritative) {
3246
3343
  if (options.allowSalvagedRead) {
3247
- const { readPrWorkflowGateStateForRecovery } = await import("./pr-workflow-gate-ke79bb9c.js");
3344
+ const { readPrWorkflowGateStateForRecovery } = await import("./pr-workflow-gate-8dgz5z1h.js");
3248
3345
  recoveryState = (await readPrWorkflowGateStateForRecovery(directory, normalizedSessionID))?.state ?? null;
3249
3346
  }
3250
3347
  if (!recoveryState) {
@@ -3258,23 +3355,32 @@ async function deleteStateWhileLocked(directory, sessionID, options = {}) {
3258
3355
  if (options.expectedStateRevision !== undefined && currentRevision !== options.expectedStateRevision) {
3259
3356
  throw new Error("BLOCKED: PR workflow gate state changed concurrently; reload the active session state before retrying");
3260
3357
  }
3261
- if (currentAuthoritative) {
3262
- const deleted = deleteCoordinationState(directory, workflowGateStateCoordinationNamespace(normalizedSessionID), WORKFLOW_STATE_ENTITY_KEY, currentAuthoritative.rowRevision);
3358
+ const authoritativeRowRevision = currentAuthoritative?.rowRevision ?? (recoveryState ? corruptCoordinationRowRevision : undefined);
3359
+ if (authoritativeRowRevision !== undefined) {
3360
+ const deleted = deleteCoordinationState(directory, workflowGateStateCoordinationNamespace(normalizedSessionID), WORKFLOW_STATE_ENTITY_KEY, authoritativeRowRevision);
3263
3361
  if (!deleted) {
3264
3362
  throw new Error("BLOCKED: PR workflow gate state changed concurrently; reload the active session state before retrying");
3265
3363
  }
3266
3364
  }
3267
- try {
3268
- await fsp2.rm(workflowGateStatePath(directory, normalizedSessionID), {
3269
- force: true
3270
- });
3271
- } catch (error2) {
3272
- if (error2.code !== "ENOENT") {
3273
- throw error2;
3274
- }
3275
- }
3365
+ await removeWorkflowGateShadowProjection(directory, normalizedSessionID);
3276
3366
  forgetTrackedPrWorkflowState(directory, normalizedSessionID);
3277
3367
  }
3368
+ async function terminalizePrWorkflowGateForSession(directory, sessionID) {
3369
+ const normalizedSessionID = normalizeSessionID(sessionID);
3370
+ await withSessionStateMutation(directory, normalizedSessionID, async () => {
3371
+ const row = getCoordinationStateRaw(directory, workflowGateStateCoordinationNamespace(normalizedSessionID), WORKFLOW_STATE_ENTITY_KEY);
3372
+ await removeWorkflowGateShadowProjection(directory, normalizedSessionID);
3373
+ await hooks.beforeTerminalizationDelete?.();
3374
+ if (row) {
3375
+ const deleted = deleteCoordinationState(directory, workflowGateStateCoordinationNamespace(normalizedSessionID), WORKFLOW_STATE_ENTITY_KEY, row.revision);
3376
+ if (!deleted) {
3377
+ throw new Error("BLOCKED: PR workflow gate state changed concurrently; retry session terminalization");
3378
+ }
3379
+ appendSessionTerminalizationEvent(directory, normalizedSessionID, row.revision);
3380
+ }
3381
+ forgetTrackedPrWorkflowState(directory, normalizedSessionID);
3382
+ });
3383
+ }
3278
3384
  function checkoutMutationProjectKey(directory) {
3279
3385
  return canonicalRootKeyFresh(directory);
3280
3386
  }
@@ -14382,7 +14488,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
14382
14488
  return extracted === expectedSessionId;
14383
14489
  }
14384
14490
  async function inspectStandardWorktreeCollisionOwnership(identity) {
14385
- const collisionOwnership = await import("./worktree-collision-ownership-drqhmmtd.js");
14491
+ const collisionOwnership = await import("./worktree-collision-ownership-97jzh4ra.js");
14386
14492
  return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
14387
14493
  }
14388
14494
  async function runRecoveryGit(directory, args, timeoutMs = 15000) {
@@ -14808,7 +14914,7 @@ async function precreateStandardWorktreeSession(args) {
14808
14914
  const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, handle.worktreePath);
14809
14915
  if (laneProfile) {
14810
14916
  try {
14811
- const { writeLaneProfileToDiskReal } = await import("./core-2d0xcyby.js");
14917
+ const { writeLaneProfileToDiskReal } = await import("./core-9rqzs794.js");
14812
14918
  await writeLaneProfileToDiskReal(handle.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
14813
14919
  } catch {}
14814
14920
  }
@@ -15787,7 +15893,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
15787
15893
  }
15788
15894
  clearWorktreeMergeStatus(statusKey);
15789
15895
  try {
15790
- const { removeLaneProfileFromDiskReal } = await import("./core-2d0xcyby.js");
15896
+ const { removeLaneProfileFromDiskReal } = await import("./core-9rqzs794.js");
15791
15897
  await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
15792
15898
  } catch {}
15793
15899
  const state = serializationStateBySessionID.get(dispatch.parentSessionID);
@@ -22642,7 +22748,7 @@ function getDisplayFinalPromptPressure() {
22642
22748
  async function rehydratePrSubscriptions(sessionID, directory) {
22643
22749
  const map = new Map;
22644
22750
  try {
22645
- const { listActive: listActive2 } = await import("./pr-subscriptions-awwhg139.js");
22751
+ const { listActive: listActive2 } = await import("./pr-subscriptions-4dj9r71h.js");
22646
22752
  const records = await listActive2(directory);
22647
22753
  for (const record of records) {
22648
22754
  if (record.sessionID !== sessionID)
@@ -22778,6 +22884,7 @@ var MAX_RETIRED_CONSOLIDATED_LANES = 64;
22778
22884
  var MAX_RETIRED_FEEDBACK_ITEM_OWNERS = 4096;
22779
22885
  var MAX_PR_FEEDBACK_INVENTORY_AMENDMENTS = 128;
22780
22886
  var MAX_PR_WORKFLOW_GATE_DIRECTORY_ENTRIES = MAX_TRACKED_SESSIONS * 2 + 1;
22887
+ var MAX_PR_WORKFLOW_GATE_ENTRY_NAME_CHARS = 240;
22781
22888
  var MAX_CANDIDATE_ISSUES_PER_ARTIFACT = 8;
22782
22889
  var MAX_BASE_COVERAGE_DIAGNOSTICS = 8;
22783
22890
  var MAX_BASE_COVERAGE_DIAGNOSTIC_CHARS2 = 1000;
@@ -23407,7 +23514,8 @@ async function assertNoActivePrWorkflowGateForCheckoutRestore(directory) {
23407
23514
  if (entry.name !== expectedName) {
23408
23515
  throw new Error("BLOCKED: PR workflow gate inventory contains an ambiguous state filename; checkout restoration cannot prove project inactivity");
23409
23516
  }
23410
- throw new Error(`BLOCKED: checkout restoration cannot mutate this project while session "${state.sessionID}" has an active ${state.mode} workflow`);
23517
+ const boundedEntryName = entry.name.length <= MAX_PR_WORKFLOW_GATE_ENTRY_NAME_CHARS ? entry.name : `${entry.name.slice(0, MAX_PR_WORKFLOW_GATE_ENTRY_NAME_CHARS - 1)}\u2026`;
23518
+ throw new Error(`BLOCKED: checkout restoration cannot mutate this project while session "${state.sessionID}" has an active ${state.mode} workflow (state entry "${boundedEntryName}"). For the owning session, run \`/swarm abort-pr-workflow ${state.mode} <reason...>\` to recover the stuck gate.`);
23411
23519
  }
23412
23520
  } catch (error2) {
23413
23521
  scanError = error2;
@@ -23440,6 +23548,9 @@ async function clearPrWorkflowGateState(directory, sessionID, expectedRevision,
23440
23548
  });
23441
23549
  });
23442
23550
  }
23551
+ async function terminalizePrWorkflowGateForSession2(directory, sessionID) {
23552
+ return terminalizePrWorkflowGateForSession(directory, sessionID);
23553
+ }
23443
23554
  var PR_WORKFLOW_STALE_LANE_TIMEOUT_MS = DEFAULT_STALE_DELEGATION_TIMEOUT_MS;
23444
23555
  var MAX_DISCLOSED_LANE_IDS = 10;
23445
23556
  var PR_WORKFLOW_SWEEPABLE_LANE_STATUSES = new Set(["pending", "running"]);
@@ -30567,8 +30678,29 @@ var MAX_SALVAGED_SCHEMA_ERROR_CHARS = 240;
30567
30678
  function boundSalvagedSchemaError(message) {
30568
30679
  return message.length <= MAX_SALVAGED_SCHEMA_ERROR_CHARS ? message : `${message.slice(0, MAX_SALVAGED_SCHEMA_ERROR_CHARS - 1)}\u2026`;
30569
30680
  }
30681
+ function boundSalvageDisclosure(sessionID, schemaErrors, coordinationNotice, revisionSalvageable = true, armedShapeUnreadable = false, publicationShapeUnreadable = false) {
30682
+ const disclosure = `DEGRADED: PR workflow gate state for session "${sessionID}" ` + (coordinationNotice ? `${coordinationNotice} and was SALVAGED for recovery only (abort/status; write and completion paths still refuse it). ` : "failed schema validation and was SALVAGED for recovery only (abort/status; write and completion paths still refuse it). ") + `Schema errors: ${schemaErrors.join("; ")}.` + (revisionSalvageable ? "" : " state revision unsalvageable.") + (armedShapeUnreadable ? " prFeedbackReadyToPublish is present but unreadable; treated as ARMED (fail-closed)." : "") + (publicationShapeUnreadable ? " prFeedbackPublication is present but unreadable; treated as ARMED (fail-closed)." : "");
30683
+ const maxDisclosureChars = MAX_SALVAGED_SCHEMA_ERROR_CHARS * 12;
30684
+ return disclosure.length <= maxDisclosureChars ? disclosure : `${disclosure.slice(0, maxDisclosureChars - 1)}\u2026`;
30685
+ }
30570
30686
  async function readPrWorkflowGateStateForRecovery(directory, sessionID) {
30571
30687
  const normalizedSessionID = normalizeSessionID(sessionID);
30688
+ const coordination = readPrWorkflowGateStateCoordinationForRecovery(directory, normalizedSessionID);
30689
+ if (coordination.kind === "invalid") {
30690
+ throw new Error(`BLOCKED: PR workflow gate state for session "${normalizedSessionID}" is invalid (${coordination.reason})`);
30691
+ }
30692
+ if (coordination.kind === "valid") {
30693
+ return {
30694
+ state: coordination.state,
30695
+ salvaged: false,
30696
+ schemaErrors: [],
30697
+ revisionSalvageable: true,
30698
+ armedShapeUnreadable: false
30699
+ };
30700
+ }
30701
+ const coordinationCorrupt = coordination.kind === "corrupt";
30702
+ const coordinationGeneration = coordinationCorrupt ? coordination.generation : undefined;
30703
+ const coordinationReason = coordinationCorrupt ? coordination.reason : undefined;
30572
30704
  const filePath = workflowGateStatePath(directory, normalizedSessionID);
30573
30705
  let raw;
30574
30706
  try {
@@ -30586,10 +30718,24 @@ async function readPrWorkflowGateStateForRecovery(directory, sessionID) {
30586
30718
  }
30587
30719
  const parsed = PrWorkflowGateStateSchema.safeParse(parsedJson);
30588
30720
  if (parsed.success) {
30721
+ if (parsed.data.sessionID !== normalizedSessionID || coordinationGeneration !== undefined && parsed.data.revision !== coordinationGeneration) {
30722
+ throw new Error(`BLOCKED: PR workflow gate state for session "${normalizedSessionID}" is invalid`);
30723
+ }
30724
+ if (!coordinationCorrupt) {
30725
+ return {
30726
+ state: parsed.data,
30727
+ salvaged: false,
30728
+ schemaErrors: [],
30729
+ revisionSalvageable: true,
30730
+ armedShapeUnreadable: false
30731
+ };
30732
+ }
30733
+ const coordinationSchemaError = boundSalvagedSchemaError(`coordination_state.payload: ${coordinationReason}`);
30589
30734
  return {
30590
30735
  state: parsed.data,
30591
- salvaged: false,
30592
- schemaErrors: [],
30736
+ salvaged: true,
30737
+ schemaErrors: [coordinationSchemaError],
30738
+ disclosure: boundSalvageDisclosure(normalizedSessionID, [coordinationSchemaError], "coordination authority was corrupt and the valid shadow projection was used"),
30593
30739
  revisionSalvageable: true,
30594
30740
  armedShapeUnreadable: false
30595
30741
  };
@@ -30601,12 +30747,16 @@ async function readPrWorkflowGateStateForRecovery(directory, sessionID) {
30601
30747
  const rawRecord = parsedJson;
30602
30748
  const salvagedSessionID = exports_external.string().min(1).safeParse(rawRecord.sessionID);
30603
30749
  const salvagedMode = exports_external.enum(["PR_REVIEW", "PR_FEEDBACK"]).safeParse(rawRecord.mode);
30604
- if (!salvagedSessionID.success || !salvagedMode.success)
30750
+ if (!salvagedSessionID.success || !salvagedMode.success || salvagedSessionID.data !== normalizedSessionID) {
30605
30751
  throw invalidError;
30752
+ }
30606
30753
  const salvagedRevision = exports_external.number().int().nonnegative().safeParse(rawRecord.revision);
30607
30754
  const salvagedHead = exports_external.string().min(1).safeParse(rawRecord.prHeadSha);
30608
30755
  const salvagedActivatedAt = exports_external.string().min(1).safeParse(rawRecord.activatedAt);
30609
30756
  const salvagedUpdatedAt = exports_external.string().min(1).safeParse(rawRecord.updatedAt);
30757
+ if (coordinationGeneration !== undefined && (!salvagedRevision.success || salvagedRevision.data !== coordinationGeneration)) {
30758
+ throw invalidError;
30759
+ }
30610
30760
  const armedKeyPresent = rawRecord.prFeedbackReadyToPublish !== undefined;
30611
30761
  const salvagedArmed = PrFeedbackReadyToPublishRecordSchema.safeParse(rawRecord.prFeedbackReadyToPublish);
30612
30762
  const publicationKeyPresent = rawRecord.prFeedbackPublication !== undefined;
@@ -30614,8 +30764,14 @@ async function readPrWorkflowGateStateForRecovery(directory, sessionID) {
30614
30764
  const publicationShapeUnreadable = publicationKeyPresent && !salvagedPublication.success;
30615
30765
  const salvagedCheckoutRecovery = PrWorkflowCheckoutRecoveryRecordSchema.safeParse(rawRecord.checkoutRecovery);
30616
30766
  const armedShapeUnreadable = armedKeyPresent && !salvagedArmed.success || publicationShapeUnreadable;
30617
- const schemaErrors = parsed.error.issues.slice(0, MAX_SALVAGED_SCHEMA_ERRORS).map((issue) => boundSalvagedSchemaError(`${issue.path.join(".") || "(root)"}: ${issue.message}`));
30618
- const disclosure = `DEGRADED: PR workflow gate state for session "${normalizedSessionID}" failed schema validation ` + `and was SALVAGED for recovery only (abort/status; write and completion paths still refuse it). ` + `Schema errors: ${schemaErrors.join("; ")}.` + (salvagedRevision.success ? "" : " state revision unsalvageable.") + (armedShapeUnreadable ? " prFeedbackReadyToPublish is present but unreadable; treated as ARMED (fail-closed)." : "") + (publicationShapeUnreadable ? " prFeedbackPublication is present but unreadable; treated as ARMED (fail-closed)." : "");
30767
+ const shadowSchemaErrors = parsed.error.issues.slice(0, MAX_SALVAGED_SCHEMA_ERRORS).map((issue) => boundSalvagedSchemaError(`${issue.path.join(".") || "(root)"}: ${issue.message}`));
30768
+ const schemaErrors = [
30769
+ ...coordinationCorrupt ? [
30770
+ boundSalvagedSchemaError(`coordination_state.payload: ${coordinationReason}`)
30771
+ ] : [],
30772
+ ...shadowSchemaErrors
30773
+ ].slice(0, MAX_SALVAGED_SCHEMA_ERRORS);
30774
+ const disclosure = boundSalvageDisclosure(normalizedSessionID, schemaErrors, coordinationCorrupt ? `coordination authority was corrupt (${coordinationReason}) and the shadow projection was used` : undefined, salvagedRevision.success, armedShapeUnreadable, publicationShapeUnreadable);
30619
30775
  return {
30620
30776
  state: {
30621
30777
  schemaVersion: GATE_SCHEMA_VERSION,
@@ -30642,10 +30798,11 @@ init_logger();
30642
30798
 
30643
30799
  // src/commands/abort-pr-workflow.ts
30644
30800
  var USAGE2 = [
30645
- "Usage: /swarm abort-pr-workflow [PR_REVIEW|PR_FEEDBACK] <reason...>",
30801
+ "Usage: /swarm abort-pr-workflow [PR_REVIEW|PR_FEEDBACK] [reason...]",
30802
+ " /swarm abort-pr-workflow PR_FEEDBACK --cancel-publication <reason...>",
30646
30803
  "",
30647
30804
  "Clear an active PR_REVIEW or PR_FEEDBACK mechanical gate for the current session",
30648
- "and stop the auto-resume loop. This is the human-only FORCE escape hatch, usable",
30805
+ "and stop the auto-resume loop. The first form is the human-only FORCE escape hatch, usable",
30649
30806
  "even when the architect cannot call its audited recovery abort. Both paths may clear",
30650
30807
  "a BOUND gate after lanes settle; the force path does not require agent cooperation. Use when",
30651
30808
  "a PR review or feedback workflow is unrecoverably stuck (e.g. the working tree",
@@ -30657,6 +30814,8 @@ var USAGE2 = [
30657
30814
  " reason Optional free-text reason recorded to the audit trail (.swarm/events.jsonl).",
30658
30815
  ' If omitted, a default ("user-initiated force abort ...") is recorded so the',
30659
30816
  " gate always has a non-empty reason. The agent tool call must supply its own.",
30817
+ " --cancel-publication Explicitly cancel an armed PR_FEEDBACK publication without",
30818
+ " publishing. It is valid only after PR_FEEDBACK and requires a non-empty reason.",
30660
30819
  "",
30661
30820
  "Refuses while the workflow is armed for publication (call complete_pr_workflow",
30662
30821
  "instead) or while PR workflow lanes are still in flight (collect their results first).",
@@ -30664,10 +30823,10 @@ var USAGE2 = [
30664
30823
  "Armed publication (issue #2108): to CHANGE approved content after arming, the agent",
30665
30824
  "should use the invalidate_pr_feedback_publication tool (audited invalidation; the",
30666
30825
  "full Stage A + independent-gate ladder re-runs). To CANCEL an armed PR_FEEDBACK",
30667
- 'workflow without publication, the agent tool supports kind "cancel-publication" with',
30668
- "cancel_publication: true and a reason \u2014 the publication generation is recorded as",
30669
- "cancelled_without_publication (terminal; never grants push authority) before the gate",
30670
- "clears. A plain (recovery or force) abort never clears an armed window.",
30826
+ "workflow without publication, use the exact human form shown above. It records",
30827
+ "cancelled_without_publication (terminal; never grants push authority), reports the",
30828
+ "observed remote head, and then clears the gate. A plain (recovery or force) abort",
30829
+ "never clears an armed window.",
30671
30830
  "",
30672
30831
  "Lane liveness (issue #2251): a lane past the 30-minute staleness horizon whose",
30673
30832
  "session the host still reports as busy or retrying is RETAINED rather than settled,",
@@ -30686,15 +30845,27 @@ var USAGE2 = [
30686
30845
  ].join(`
30687
30846
  `);
30688
30847
  var KNOWN_MODES = new Set(["PR_REVIEW", "PR_FEEDBACK"]);
30848
+ var CANCEL_PUBLICATION_FLAG = "--cancel-publication";
30689
30849
  async function handleAbortPrWorkflowCommand(directory, args, sessionID) {
30690
30850
  const tokens = (args ?? []).filter((token) => token.trim().length > 0);
30691
30851
  const modeToken = tokens[0]?.toUpperCase();
30692
30852
  const knownMode = modeToken && KNOWN_MODES.has(modeToken) ? modeToken : undefined;
30853
+ const cancellationRequested = tokens.includes(CANCEL_PUBLICATION_FLAG);
30693
30854
  const reasonStartIndex = knownMode ? 1 : 0;
30694
- const explicitReason = tokens.slice(reasonStartIndex).join(" ").trim().slice(0, 500);
30695
30855
  if (modeToken && !knownMode) {
30696
30856
  return `Error: Unknown mode "${modeToken}". Expected PR_REVIEW or PR_FEEDBACK.
30697
30857
 
30858
+ ${USAGE2}`;
30859
+ }
30860
+ if (cancellationRequested && (knownMode !== "PR_FEEDBACK" || tokens[1] !== CANCEL_PUBLICATION_FLAG)) {
30861
+ return `Error: ${CANCEL_PUBLICATION_FLAG} requires the exact form PR_FEEDBACK ${CANCEL_PUBLICATION_FLAG} <reason...>. It is not valid for PR_REVIEW or an unqualified force abort.
30862
+
30863
+ ${USAGE2}`;
30864
+ }
30865
+ const explicitReason = tokens.slice(cancellationRequested ? 2 : reasonStartIndex).join(" ").trim().slice(0, 500);
30866
+ if (cancellationRequested && !explicitReason) {
30867
+ return `Error: cancel_publication requires a non-empty reason; use PR_FEEDBACK ${CANCEL_PUBLICATION_FLAG} <reason...>.
30868
+
30698
30869
  ${USAGE2}`;
30699
30870
  }
30700
30871
  if (!sessionID?.trim()) {
@@ -30702,13 +30873,17 @@ ${USAGE2}`;
30702
30873
 
30703
30874
  ${USAGE2}`;
30704
30875
  }
30705
- const reason = explicitReason || "user-initiated force abort via /swarm abort-pr-workflow (no explicit reason provided)";
30876
+ const reason = cancellationRequested ? explicitReason : explicitReason || "user-initiated force abort via /swarm abort-pr-workflow (no explicit reason provided)";
30706
30877
  try {
30707
30878
  const summary = await abortPrWorkflow(directory, sessionID, {
30708
- kind: "force",
30879
+ kind: cancellationRequested ? "cancel-publication" : "force",
30709
30880
  reason,
30710
- ...knownMode ? { expectedMode: knownMode } : {}
30881
+ ...cancellationRequested ? { cancelPublication: true, expectedMode: "PR_FEEDBACK" } : knownMode ? { expectedMode: knownMode } : {}
30711
30882
  });
30883
+ if (cancellationRequested) {
30884
+ const observedRemoteHead = summary.observedRemoteHead ?? "(unavailable)";
30885
+ return `Cancelled active ${summary.mode} publication without publication (cancelled_without_publication) for session ${sessionID}. Observed remote head: ${observedRemoteHead}. The durable gate state has been cleared and the auto-resume loop will stop. An audit event was appended to .swarm/events.jsonl.`;
30886
+ }
30712
30887
  const headLine = summary.prHeadSha ? ` (was bound to PR head ${summary.prHeadSha})` : " (was not bound to a PR head)";
30713
30888
  const overrideLine = summary.probeRetentionOverrideDisclosure ? ` WARNING: ${summary.probeRetentionOverrideDisclosure}` : "";
30714
30889
  return `Aborted active ${summary.mode} mechanical gate for session ${sessionID}${headLine} (force). The durable gate state has been cleared and the auto-resume loop will stop. An audit event was appended to .swarm/events.jsonl. If checkout preparation preserved changes, continue with prepare_pr_workflow_checkout operation=restore (or follow the preserved receipt manually).${overrideLine}`;
@@ -39517,9 +39692,9 @@ function hashContent(content) {
39517
39692
  return createHash24("sha1").update(content).digest("hex");
39518
39693
  }
39519
39694
  async function loadConfigForPolicyCurator(directory) {
39520
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-nqjp43vq.js");
39695
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-q6gsrxwz.js");
39521
39696
  try {
39522
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-byfrearz.js");
39697
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-tmy46dtd.js");
39523
39698
  const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
39524
39699
  return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
39525
39700
  } catch {
@@ -42577,7 +42752,7 @@ async function resolveCuratorLLMDelegate(directory, mode, sessionId) {
42577
42752
  const seam = _internals36.createCuratorLLMDelegate;
42578
42753
  if (seam)
42579
42754
  return seam(directory, mode, sessionId);
42580
- const { createCuratorLLMDelegate } = await import("./curator-llm-factory-rgdb2ee5.js");
42755
+ const { createCuratorLLMDelegate } = await import("./curator-llm-factory-cbm1ny30.js");
42581
42756
  return createCuratorLLMDelegate(directory, mode, sessionId);
42582
42757
  }
42583
42758
  async function reconcileCloseTerminalStateForPlan(directory, targetPlan, options) {
@@ -42972,7 +43147,7 @@ async function runFinalizeStage(ctx) {
42972
43147
  }
42973
43148
  }
42974
43149
  try {
42975
- const { CuratorConfigSchema: CCS } = await import("./schema-nqjp43vq.js");
43150
+ const { CuratorConfigSchema: CCS } = await import("./schema-q6gsrxwz.js");
42976
43151
  const { config: pmLoadedConfig } = _internals36.loadPluginConfigWithMeta(ctx.directory);
42977
43152
  const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
42978
43153
  if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
@@ -44444,6 +44619,12 @@ var LEGACY_LEDGER_ARCHIVES_KEEP_NEWEST = 16;
44444
44619
  var PR_WORKFLOW_GATE_STATE_STEM = "[A-Za-z0-9_.-]+-[0-9a-f]{12}";
44445
44620
  var PR_WORKFLOW_GATE_STATE_NAME = new RegExp(`^${PR_WORKFLOW_GATE_STATE_STEM}\\.json$`);
44446
44621
  var PR_WORKFLOW_GATE_SIDECAR_NAME = new RegExp(`^${PR_WORKFLOW_GATE_STATE_STEM}\\.json(?:\\.imported(?:\\.[0-9]+)?|\\.sqlite-projection)$`);
44622
+ var PR_WORKFLOW_CHECKOUT_SESSION_NAME = /^[A-Za-z0-9_.-]+-[0-9a-f]{12}$/;
44623
+ var PR_WORKFLOW_CHECKOUT_TEMP_NAME = /^[0-9a-f]{40,64}\.json\.tmp\.[0-9]+\.[0-9a-f-]{36}$/i;
44624
+ var PR_WORKFLOW_CHECKOUT_RECEIPT_NAME = /^[0-9a-f]{40,64}\.json$/i;
44625
+ var PR_WORKFLOW_CHECKOUT_SESSION_SCAN_CAP = 256;
44626
+ var PR_WORKFLOW_CHECKOUT_ENTRY_SCAN_CAP = 64;
44627
+ var PR_WORKFLOW_CHECKOUT_RECEIPT_BYTES = 64 * 1024;
44447
44628
  var isPrWorkflowGateStateProjection = (name, stat6) => stat6.isFile() && PR_WORKFLOW_GATE_STATE_NAME.test(name);
44448
44629
  var isPrWorkflowGateSidecar = (name, stat6) => stat6.isFile() && PR_WORKFLOW_GATE_SIDECAR_NAME.test(name);
44449
44630
  var isPrReviewRunArtifact = (_name, stat6) => stat6.isDirectory();
@@ -44543,6 +44724,17 @@ async function runRetentionSweep(projectRoot, options = {}) {
44543
44724
  result.errors[family.label] = error2 instanceof Error ? error2.message : String(error2);
44544
44725
  }
44545
44726
  }
44727
+ if (cancelled("pr-workflow-checkout-temps"))
44728
+ return result;
44729
+ try {
44730
+ const pruned = await prunePrWorkflowCheckoutArtifacts(path56.join(swarmRoot, "pr-workflow-checkouts"), now2, dryRun);
44731
+ if (pruned.temps > 0)
44732
+ result.pruned["pr-workflow-checkout-temps"] = pruned.temps;
44733
+ if (pruned.receipts > 0)
44734
+ result.pruned["pr-workflow-checkout-receipts"] = pruned.receipts;
44735
+ } catch (error2) {
44736
+ result.errors["pr-workflow-checkout-temps"] = error2 instanceof Error ? error2.message : String(error2);
44737
+ }
44546
44738
  if (cancelled("review-receipts-index"))
44547
44739
  return result;
44548
44740
  try {
@@ -44739,6 +44931,156 @@ async function walkEvolution(root, visit) {
44739
44931
  await visit(entryPath, stat6);
44740
44932
  }
44741
44933
  }
44934
+ async function readDirectoryNamesBounded(directory, cap) {
44935
+ let handle;
44936
+ try {
44937
+ handle = await fs34.promises.opendir(directory);
44938
+ } catch {
44939
+ return null;
44940
+ }
44941
+ const names = [];
44942
+ try {
44943
+ for (;; ) {
44944
+ const entry = await handle.read();
44945
+ if (!entry)
44946
+ return names;
44947
+ if (names.length >= cap)
44948
+ return null;
44949
+ names.push(entry.name);
44950
+ }
44951
+ } catch {
44952
+ return null;
44953
+ } finally {
44954
+ try {
44955
+ await handle.close();
44956
+ } catch {}
44957
+ }
44958
+ }
44959
+ async function prunePrWorkflowCheckoutTemps(root, now2, dryRun) {
44960
+ const sessionNames = await readDirectoryNamesBounded(root, PR_WORKFLOW_CHECKOUT_SESSION_SCAN_CAP);
44961
+ if (!sessionNames)
44962
+ return 0;
44963
+ const cutoff = now2 - DEFAULT_FAMILY_AGE_DAYS * DAY_MS;
44964
+ let pruned = 0;
44965
+ for (const sessionName of sessionNames) {
44966
+ if (!PR_WORKFLOW_CHECKOUT_SESSION_NAME.test(sessionName))
44967
+ continue;
44968
+ const sessionPath = path56.join(root, sessionName);
44969
+ const sessionStat = await fs34.promises.lstat(sessionPath).catch(() => null);
44970
+ if (!sessionStat || sessionStat.isSymbolicLink() || !sessionStat.isDirectory()) {
44971
+ continue;
44972
+ }
44973
+ const entryNames = await readDirectoryNamesBounded(sessionPath, PR_WORKFLOW_CHECKOUT_ENTRY_SCAN_CAP);
44974
+ if (!entryNames)
44975
+ continue;
44976
+ for (const entryName of entryNames) {
44977
+ if (!PR_WORKFLOW_CHECKOUT_TEMP_NAME.test(entryName))
44978
+ continue;
44979
+ const entryPath = path56.join(sessionPath, entryName);
44980
+ const stat6 = await fs34.promises.lstat(entryPath).catch(() => null);
44981
+ if (!stat6 || stat6.isSymbolicLink() || !stat6.isFile())
44982
+ continue;
44983
+ if (stat6.mtimeMs > now2 || stat6.mtimeMs >= cutoff)
44984
+ continue;
44985
+ if (dryRun) {
44986
+ pruned += 1;
44987
+ continue;
44988
+ }
44989
+ try {
44990
+ await fs34.promises.unlink(entryPath);
44991
+ pruned += 1;
44992
+ } catch {}
44993
+ }
44994
+ }
44995
+ return pruned;
44996
+ }
44997
+ async function readBoundedCheckoutReceipt(receiptPath) {
44998
+ const stat6 = await fs34.promises.lstat(receiptPath).catch(() => null);
44999
+ if (!stat6 || stat6.isSymbolicLink() || !stat6.isFile())
45000
+ return null;
45001
+ let handle;
45002
+ try {
45003
+ handle = await fs34.promises.open(receiptPath, "r");
45004
+ } catch {
45005
+ return null;
45006
+ }
45007
+ try {
45008
+ const buffer = new Uint8Array(PR_WORKFLOW_CHECKOUT_RECEIPT_BYTES + 1);
45009
+ const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
45010
+ if (bytesRead > PR_WORKFLOW_CHECKOUT_RECEIPT_BYTES)
45011
+ return null;
45012
+ let value;
45013
+ try {
45014
+ value = JSON.parse(new TextDecoder().decode(buffer.subarray(0, bytesRead)));
45015
+ } catch {
45016
+ return null;
45017
+ }
45018
+ if (!value || typeof value !== "object" || Array.isArray(value))
45019
+ return null;
45020
+ return { value, mtimeMs: stat6.mtimeMs };
45021
+ } finally {
45022
+ try {
45023
+ await handle.close();
45024
+ } catch {}
45025
+ }
45026
+ }
45027
+ function isStrictlyValidatedAppliedCheckoutReceipt(value, stashOid, sessionStem) {
45028
+ if (value.schemaVersion !== 1 || typeof value.sessionID !== "string" || value.sessionID.length === 0 || prWorkflowSessionFileStem(value.sessionID) !== sessionStem || typeof value.stashOid !== "string" || value.stashOid.toLowerCase() !== stashOid.toLowerCase() || !Array.isArray(value.paths) || value.paths.length > 64 || value.paths.some((entry) => typeof entry !== "string" || entry.length === 0 || entry.length > 4096) || typeof value.preparedAt !== "string" || value.preparedAt.length === 0 || value.preparedAt.length > 64 || value.mode !== "PR_REVIEW" && value.mode !== "PR_FEEDBACK" || !Number.isInteger(value.gateRevision) || value.gateRevision < 0 || typeof value.gateActivatedAt !== "string" || value.gateActivatedAt.length === 0 || value.gateActivatedAt.length > 64 || typeof value.originalHead !== "string" || !/^[0-9a-f]{40,64}$/i.test(value.originalHead) || value.originalBranch !== null && (typeof value.originalBranch !== "string" || value.originalBranch.length === 0 || value.originalBranch.length > 240 || value.originalBranch.startsWith("-") || value.originalBranch.startsWith("/") || value.originalBranch.endsWith("/") || value.originalBranch.endsWith(".") || value.originalBranch.endsWith(".lock") || value.originalBranch.includes("..") || value.originalBranch.includes("@{") || value.originalBranch.includes("//") || /[\s~^:?*[\]\\]/.test(value.originalBranch) || containsControlChars(value.originalBranch)) || value.restoreState !== "applied" || typeof value.restoreAppliedAt !== "string" || value.restoreAppliedAt.length === 0 || value.restoreAppliedAt.length > 64 || typeof value.restoreVerifiedAt !== "string" || value.restoreVerifiedAt.length === 0 || value.restoreVerifiedAt.length > 64 || typeof value.restoredHead !== "string" || !/^[0-9a-f]{40,64}$/i.test(value.restoredHead) || value.restoredBranch !== null && (typeof value.restoredBranch !== "string" || value.restoredBranch.length === 0 || value.restoredBranch.length > 240 || value.restoredBranch.startsWith("-") || value.restoredBranch.startsWith("/") || value.restoredBranch.endsWith("/") || value.restoredBranch.endsWith(".") || value.restoredBranch.endsWith(".lock") || value.restoredBranch.includes("..") || value.restoredBranch.includes("@{") || value.restoredBranch.includes("//") || /[\s~^:?*[\]\\]/.test(value.restoredBranch) || containsControlChars(value.restoredBranch))) {
45029
+ return false;
45030
+ }
45031
+ return true;
45032
+ }
45033
+ async function prunePrWorkflowCheckoutReceipts(root, now2, dryRun) {
45034
+ const sessionNames = await readDirectoryNamesBounded(root, PR_WORKFLOW_CHECKOUT_SESSION_SCAN_CAP);
45035
+ if (!sessionNames)
45036
+ return 0;
45037
+ const cutoff = now2 - DEFAULT_FAMILY_AGE_DAYS * DAY_MS;
45038
+ let pruned = 0;
45039
+ for (const sessionName of sessionNames) {
45040
+ if (!PR_WORKFLOW_CHECKOUT_SESSION_NAME.test(sessionName))
45041
+ continue;
45042
+ const sessionPath = path56.join(root, sessionName);
45043
+ const sessionStat = await fs34.promises.lstat(sessionPath).catch(() => null);
45044
+ if (!sessionStat || sessionStat.isSymbolicLink() || !sessionStat.isDirectory()) {
45045
+ continue;
45046
+ }
45047
+ const entryNames = await readDirectoryNamesBounded(sessionPath, PR_WORKFLOW_CHECKOUT_ENTRY_SCAN_CAP);
45048
+ if (!entryNames)
45049
+ continue;
45050
+ for (const entryName of entryNames) {
45051
+ if (!PR_WORKFLOW_CHECKOUT_RECEIPT_NAME.test(entryName))
45052
+ continue;
45053
+ const receiptPath = path56.join(sessionPath, entryName);
45054
+ const receipt = await readBoundedCheckoutReceipt(receiptPath);
45055
+ if (!receipt || !isStrictlyValidatedAppliedCheckoutReceipt(receipt.value, entryName.slice(0, -".json".length), sessionName)) {
45056
+ continue;
45057
+ }
45058
+ const verifiedAt = Date.parse(receipt.value.restoreVerifiedAt);
45059
+ if (!Number.isFinite(verifiedAt) || verifiedAt > now2 || verifiedAt >= cutoff) {
45060
+ continue;
45061
+ }
45062
+ if (dryRun) {
45063
+ pruned += 1;
45064
+ continue;
45065
+ }
45066
+ const beforeDelete = await fs34.promises.lstat(receiptPath).catch(() => null);
45067
+ if (!beforeDelete || beforeDelete.isSymbolicLink() || !beforeDelete.isFile() || beforeDelete.mtimeMs !== receipt.mtimeMs) {
45068
+ continue;
45069
+ }
45070
+ try {
45071
+ await fs34.promises.unlink(receiptPath);
45072
+ pruned += 1;
45073
+ } catch {}
45074
+ }
45075
+ }
45076
+ return pruned;
45077
+ }
45078
+ async function prunePrWorkflowCheckoutArtifacts(root, now2, dryRun) {
45079
+ return {
45080
+ temps: await prunePrWorkflowCheckoutTemps(root, now2, dryRun),
45081
+ receipts: await prunePrWorkflowCheckoutReceipts(root, now2, dryRun)
45082
+ };
45083
+ }
44742
45084
  async function isRealDirectory(dir) {
44743
45085
  try {
44744
45086
  const stat6 = fs34.lstatSync(dir);
@@ -44917,7 +45259,7 @@ function serializeAgentSession(s) {
44917
45259
  }
44918
45260
  async function writeSnapshot(directory, state) {
44919
45261
  try {
44920
- const { ensureSnapshotCoordinationReady } = await import("./snapshot-coordination-init-3yyzb2c4.js");
45262
+ const { ensureSnapshotCoordinationReady } = await import("./snapshot-coordination-init-h8n8w1cm.js");
44921
45263
  await ensureSnapshotCoordinationReady(directory);
44922
45264
  const snapshot = {
44923
45265
  version: 3,
@@ -47843,7 +48185,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
47843
48185
  };
47844
48186
  }
47845
48187
  async function sweepActiveNearDuplicates(directory, options = {}) {
47846
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-byfrearz.js");
48188
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-tmy46dtd.js");
47847
48189
  const { config } = loadPluginConfigWithMeta2(directory);
47848
48190
  const sweepConfig = config.learning?.dedup_sweep;
47849
48191
  if (sweepConfig?.enabled === false)
@@ -48967,7 +49309,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
48967
49309
  }
48968
49310
  if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
48969
49311
  try {
48970
- const skillModule = await import("./skill-generator-xadg43ph.js");
49312
+ const skillModule = await import("./skill-generator-6j7tq2tb.js");
48971
49313
  for (const cand of skillCandidates) {
48972
49314
  if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
48973
49315
  continue;
@@ -49439,7 +49781,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
49439
49781
  } catch {}
49440
49782
  }
49441
49783
  if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
49442
- const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-5r6mww64.js");
49784
+ const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-yx97q9c1.js");
49443
49785
  for (const { id } of contradictedEntries) {
49444
49786
  try {
49445
49787
  await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
@@ -50271,7 +50613,7 @@ async function runCuratorPostMortem(directory, options = {}) {
50271
50613
  warnings.push("Failed to collect knowledge summary.");
50272
50614
  }
50273
50615
  try {
50274
- const { getScanStatus } = await import("./scan-cursor-16s6dp7f.js");
50616
+ const { getScanStatus } = await import("./scan-cursor-nx0jv9ya.js");
50275
50617
  const scanStatus = await getScanStatus(directory);
50276
50618
  if (scanStatus.remaining_estimate > 0) {
50277
50619
  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.`);
@@ -50313,7 +50655,7 @@ async function runCuratorPostMortem(directory, options = {}) {
50313
50655
  let actionResult;
50314
50656
  if (options.llmDelegate) {
50315
50657
  try {
50316
- const { CURATOR_POSTMORTEM_PROMPT: CURATOR_POSTMORTEM_PROMPT2 } = await import("./explorer-2cv64zfj.js");
50658
+ const { CURATOR_POSTMORTEM_PROMPT: CURATOR_POSTMORTEM_PROMPT2 } = await import("./explorer-z0cf5cz0.js");
50317
50659
  const userInput = assembleLLMInput(effectivePlanId, scope, options.sessionID, planSummary, knowledgeSummary, curatorDigest, proposals, unactionable, retrospectives, driftReports);
50318
50660
  const ac = new AbortController;
50319
50661
  const timer = setTimeout(() => ac.abort(), options.llmTimeoutMs ?? 300000);
@@ -50443,9 +50785,9 @@ var _internals54 = {
50443
50785
  verifyPostMortemKnowledgeActions,
50444
50786
  repairPostMortemActions,
50445
50787
  loadDefaultKnowledgeConfig: async (directory) => {
50446
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-nqjp43vq.js");
50788
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-q6gsrxwz.js");
50447
50789
  try {
50448
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-byfrearz.js");
50790
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-tmy46dtd.js");
50449
50791
  const loaded = loadPluginConfigWithMeta2(directory);
50450
50792
  return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
50451
50793
  } catch {
@@ -50453,11 +50795,11 @@ var _internals54 = {
50453
50795
  }
50454
50796
  },
50455
50797
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
50456
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-5kfkqzc9.js");
50798
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-m8act07j.js");
50457
50799
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
50458
50800
  },
50459
50801
  checkHivePromotions: async (entries2, knowledgeConfig, directory) => {
50460
- const { checkHivePromotions } = await import("./hive-promoter-zgnagx67.js");
50802
+ const { checkHivePromotions } = await import("./hive-promoter-ewrz7vh1.js");
50461
50803
  return checkHivePromotions(entries2, knowledgeConfig, directory);
50462
50804
  },
50463
50805
  applyProposalTriage: async (directory, triage) => {
@@ -50466,7 +50808,7 @@ var _internals54 = {
50466
50808
  activateProposal,
50467
50809
  listSkills: listSkills2,
50468
50810
  sanitizeSlug
50469
- } = await import("./skill-generator-xadg43ph.js");
50811
+ } = await import("./skill-generator-6j7tq2tb.js");
50470
50812
  const result = {
50471
50813
  approved: [],
50472
50814
  rejected: [],
@@ -58952,7 +59294,7 @@ function wireCloseInternals() {
58952
59294
  archiveEvidence,
58953
59295
  endAgentSession,
58954
59296
  flushAndDrainTelemetry: async () => {
58955
- const { flushAndDrainTelemetry } = await import("./telemetry-c9wv2cfw.js");
59297
+ const { flushAndDrainTelemetry } = await import("./telemetry-qxav5cdk.js");
58956
59298
  return flushAndDrainTelemetry();
58957
59299
  },
58958
59300
  finalizeContextTelemetry,
@@ -60304,9 +60646,9 @@ var _internals64 = {
60304
60646
  loadPluginConfigWithMeta,
60305
60647
  loadCuratorDeps: async () => {
60306
60648
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate }] = await Promise.all([
60307
- import("./schema-nqjp43vq.js"),
60308
- import("./curator-5kfkqzc9.js"),
60309
- import("./curator-llm-factory-rgdb2ee5.js")
60649
+ import("./schema-q6gsrxwz.js"),
60650
+ import("./curator-m8act07j.js"),
60651
+ import("./curator-llm-factory-cbm1ny30.js")
60310
60652
  ]);
60311
60653
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate };
60312
60654
  }
@@ -62638,7 +62980,7 @@ async function computeCurationDiagnostics(directory, entries2) {
62638
62980
  let scanCompleted = false;
62639
62981
  let scanRemaining = 0;
62640
62982
  try {
62641
- const { getScanStatus } = await import("./scan-cursor-16s6dp7f.js");
62983
+ const { getScanStatus } = await import("./scan-cursor-nx0jv9ya.js");
62642
62984
  const status = await getScanStatus(directory);
62643
62985
  scanGeneration = status.generation;
62644
62986
  scanCompleted = status.completed;
@@ -62646,19 +62988,19 @@ async function computeCurationDiagnostics(directory, entries2) {
62646
62988
  } catch {}
62647
62989
  let configMatch = null;
62648
62990
  try {
62649
- const { isLinked: isLinked2 } = await import("./knowledge-link-mvykydxg.js");
62991
+ const { isLinked: isLinked2 } = await import("./knowledge-link-gfz47ves.js");
62650
62992
  if (isLinked2(directory)) {
62651
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-nqjp43vq.js");
62993
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-q6gsrxwz.js");
62652
62994
  let config;
62653
62995
  try {
62654
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-byfrearz.js");
62996
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-tmy46dtd.js");
62655
62997
  const loaded = loadPluginConfigWithMeta2(directory);
62656
62998
  config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
62657
62999
  } catch {
62658
63000
  config = KnowledgeConfigSchema2.parse({});
62659
63001
  }
62660
63002
  const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
62661
- const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-7am15ht9.js");
63003
+ const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-c7mdsf7m.js");
62662
63004
  const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
62663
63005
  const cohortFp = await readCohortConfigFingerprint(directory);
62664
63006
  configMatch = cohortFp === null ? null : currentFp === cohortFp;
@@ -64094,7 +64436,7 @@ async function handleDoctorCommand(directory, args) {
64094
64436
  const result = runConfigDoctor(config, directory);
64095
64437
  let output;
64096
64438
  if (enableAutoFix && result.hasAutoFixableIssues) {
64097
- const { runConfigDoctorWithFixes } = await import("./config-doctor-x8b260sh.js");
64439
+ const { runConfigDoctorWithFixes } = await import("./config-doctor-82w4bp4b.js");
64098
64440
  const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
64099
64441
  applyLossy: true
64100
64442
  });
@@ -64132,7 +64474,7 @@ async function handleDoctorCommand(directory, args) {
64132
64474
  `;
64133
64475
  }
64134
64476
  try {
64135
- const { runModelPreflight } = await import("./model-preflight-kh9dwts2.js");
64477
+ const { runModelPreflight } = await import("./model-preflight-61xgqwcs.js");
64136
64478
  const preflight = await runModelPreflight(config, swarmState.opencodeClient);
64137
64479
  if (preflight.catalogAvailable) {
64138
64480
  const unresolved = preflight.resolutions.filter((resolution) => resolution.status === "unresolved");
@@ -65048,7 +65390,7 @@ async function handleEvidenceCommand(directory, args) {
65048
65390
  return formatTaskEvidenceMarkdown(evidenceData);
65049
65391
  }
65050
65392
  async function handleEvidenceSummaryCommand(directory) {
65051
- const { buildEvidenceSummary } = await import("./evidence-summary-service-959pwbwb.js");
65393
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-a99bgje1.js");
65052
65394
  const artifact = await buildEvidenceSummary(directory);
65053
65395
  if (!artifact) {
65054
65396
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -65114,7 +65456,7 @@ async function handleExportCommand(directory, _args) {
65114
65456
  // src/agents/critic.ts
65115
65457
  var CRITIC_MEMORY_OUTCOME_GUIDANCE = "Use `swarm_memory_outcome` after evaluating recalled memory or a graph answer. When overturning a memory-backed claim, record `corrected` and include the correction text and relevant file/symbol anchors.";
65116
65458
  var GRAPH_FIRST_CRITIC_GUIDANCE = `## GRAPH-FIRST EVIDENCE
65117
- Use repo_map action="graph_health" before graph-backed review and a targeted repo_map action="impact_cone" for changed or proposed shared symbols. Treat graph evidence as advisory, never as approval or denial. Require source anchors; if freshness is stale or inconclusive, confidence is low, source is missing, the language is unsupported/dynamic, the graph is absent, or an action fails, inspect the direct source and searches before deciding.`;
65459
+ Use repo_map action="graph_health" before graph-backed review, a targeted repo_map action="impact_cone" for changed or proposed shared symbols, and repo_map action="graph_explain" when validating or challenging why a file or symbol is graph-relevant. Treat graph evidence as advisory, never as approval or denial. Require source anchors; if freshness is stale or inconclusive, confidence is low, source is missing, the language is unsupported/dynamic, the graph is absent, or an action fails, inspect the direct source and searches before deciding.`;
65118
65460
  var ALWAYS_SURFACE_CATEGORIES = [
65119
65461
  "scope",
65120
65462
  "data_loss",
@@ -66248,12 +66590,49 @@ import * as path90 from "path";
66248
66590
  init_git_executable();
66249
66591
 
66250
66592
  // src/mutation/equivalence.ts
66251
- function isStaticallyEquivalent(originalCode, mutatedCode) {
66593
+ var DEFAULT_COMMENT_FAMILY = {
66594
+ lineTokens: ["//"],
66595
+ blockComments: true
66596
+ };
66597
+ function commentFamilyForLanguage(languageHint) {
66598
+ if (!languageHint)
66599
+ return DEFAULT_COMMENT_FAMILY;
66600
+ const hint = languageHint.toLowerCase();
66601
+ const ext = hint.includes(".") ? hint.slice(hint.lastIndexOf(".") + 1) : hint;
66602
+ switch (ext) {
66603
+ case "py":
66604
+ case "pyi":
66605
+ case "python":
66606
+ case "rb":
66607
+ case "ruby":
66608
+ case "sh":
66609
+ case "bash":
66610
+ case "zsh":
66611
+ case "yaml":
66612
+ case "yml":
66613
+ case "toml":
66614
+ case "r":
66615
+ case "makefile":
66616
+ return { lineTokens: ["#"], blockComments: false };
66617
+ case "php":
66618
+ return { lineTokens: ["//", "#"], blockComments: true };
66619
+ case "sql":
66620
+ case "lua":
66621
+ return { lineTokens: ["--"], blockComments: false };
66622
+ case "pl":
66623
+ case "perl":
66624
+ return { lineTokens: ["#"], blockComments: true };
66625
+ default:
66626
+ return DEFAULT_COMMENT_FAMILY;
66627
+ }
66628
+ }
66629
+ function isStaticallyEquivalent(originalCode, mutatedCode, languageHint) {
66630
+ const family = commentFamilyForLanguage(languageHint);
66252
66631
  const stripCode = (code) => {
66253
66632
  let inMultiLineComment = false;
66254
66633
  const afterMultiLine = [];
66255
- for (const line of code.split(`
66256
- `)) {
66634
+ for (const line of family.blockComments ? code.split(`
66635
+ `) : []) {
66257
66636
  if (!inMultiLineComment) {
66258
66637
  const openIndex = line.indexOf("/*");
66259
66638
  if (openIndex !== -1) {
@@ -66276,7 +66655,9 @@ function isStaticallyEquivalent(originalCode, mutatedCode) {
66276
66655
  }
66277
66656
  }
66278
66657
  const afterSingleLine = [];
66279
- for (const line of afterMultiLine) {
66658
+ const linesForSingle = family.blockComments ? afterMultiLine : code.split(`
66659
+ `);
66660
+ for (const line of linesForSingle) {
66280
66661
  let inString = null;
66281
66662
  let commentStart = -1;
66282
66663
  for (let i = 0;i < line.length; i++) {
@@ -66292,9 +66673,15 @@ function isStaticallyEquivalent(originalCode, mutatedCode) {
66292
66673
  } else {
66293
66674
  if (ch === "'" || ch === '"' || ch === "`") {
66294
66675
  inString = ch;
66295
- } else if (ch === "/" && i + 1 < line.length && line[i + 1] === "/") {
66296
- commentStart = i;
66297
- break;
66676
+ } else {
66677
+ for (const token of family.lineTokens) {
66678
+ if (line.startsWith(token, i)) {
66679
+ commentStart = i;
66680
+ break;
66681
+ }
66682
+ }
66683
+ if (commentStart >= 0)
66684
+ break;
66298
66685
  }
66299
66686
  }
66300
66687
  }
@@ -66323,7 +66710,7 @@ var _internals72 = {
66323
66710
  batchCheckEquivalence
66324
66711
  };
66325
66712
  async function checkEquivalence(patch, originalCode, mutatedCode, llmJudge) {
66326
- if (isStaticallyEquivalent(originalCode, mutatedCode)) {
66713
+ if (isStaticallyEquivalent(originalCode, mutatedCode, patch.filePath)) {
66327
66714
  return {
66328
66715
  patchId: patch.id,
66329
66716
  isEquivalent: true,
@@ -66717,6 +67104,89 @@ function computeReport(results, durationMs, budgetMs) {
66717
67104
  timestamp: new Date().toISOString()
66718
67105
  };
66719
67106
  }
67107
+ function hunkOnlyText(patchText) {
67108
+ const mutatedLines = [];
67109
+ for (const line of patchText.split(`
67110
+ `)) {
67111
+ if (line.startsWith("+++"))
67112
+ continue;
67113
+ if (line.startsWith("+")) {
67114
+ mutatedLines.push(line.substring(1));
67115
+ } else if (!line.startsWith("-") && !line.startsWith("@") && !line.startsWith("diff ") && !line.startsWith("index ") && !line.startsWith("---") && !line.startsWith("\\")) {
67116
+ mutatedLines.push(line.startsWith(" ") ? line.substring(1) : line);
67117
+ }
67118
+ }
67119
+ return mutatedLines.join(`
67120
+ `);
67121
+ }
67122
+ function parseUnifiedHunks(patchText) {
67123
+ const hunks = [];
67124
+ let current = null;
67125
+ const body = patchText.endsWith(`
67126
+ `) ? patchText.slice(0, -1) : patchText;
67127
+ for (const line of body.split(`
67128
+ `)) {
67129
+ const header = /^@@ -(\d+)(?:,(\d+))? \+\d+(?:,\d+)? @@/.exec(line);
67130
+ if (header) {
67131
+ current = {
67132
+ oldStart: Number.parseInt(header[1], 10),
67133
+ oldCount: header[2] === undefined ? 1 : Number.parseInt(header[2], 10),
67134
+ originalLines: [],
67135
+ resultLines: []
67136
+ };
67137
+ hunks.push(current);
67138
+ continue;
67139
+ }
67140
+ if (!current)
67141
+ continue;
67142
+ if (line.startsWith("diff ") || line.startsWith("index ") || line.startsWith("---") || line.startsWith("+++")) {
67143
+ continue;
67144
+ }
67145
+ if (line.startsWith("\\"))
67146
+ continue;
67147
+ if (line.startsWith("-")) {
67148
+ current.originalLines.push(line.substring(1));
67149
+ } else if (line.startsWith("+")) {
67150
+ current.resultLines.push(line.substring(1));
67151
+ } else if (line.startsWith(" ")) {
67152
+ const ctx = line.substring(1);
67153
+ current.originalLines.push(ctx);
67154
+ current.resultLines.push(ctx);
67155
+ } else if (line === "") {
67156
+ current.originalLines.push("");
67157
+ current.resultLines.push("");
67158
+ } else {
67159
+ return null;
67160
+ }
67161
+ }
67162
+ return hunks.length > 0 ? hunks : null;
67163
+ }
67164
+ function applyUnifiedDiff(originalCode, patchText) {
67165
+ const hunks = parseUnifiedHunks(patchText);
67166
+ if (!hunks)
67167
+ return null;
67168
+ let lines = originalCode.split(`
67169
+ `);
67170
+ for (const hunk of [...hunks].sort((a, b) => b.oldStart - a.oldStart)) {
67171
+ const startIdx = hunk.oldCount === 0 ? hunk.oldStart : hunk.oldStart - 1;
67172
+ if (startIdx < 0 || startIdx > lines.length)
67173
+ return null;
67174
+ if (hunk.originalLines.length > 0) {
67175
+ const actual = lines.slice(startIdx, startIdx + hunk.originalLines.length);
67176
+ for (let i = 0;i < hunk.originalLines.length; i++) {
67177
+ if (actual[i] !== hunk.originalLines[i])
67178
+ return null;
67179
+ }
67180
+ }
67181
+ lines = [
67182
+ ...lines.slice(0, startIdx),
67183
+ ...hunk.resultLines,
67184
+ ...lines.slice(startIdx + hunk.originalLines.length)
67185
+ ];
67186
+ }
67187
+ return lines.join(`
67188
+ `);
67189
+ }
66720
67190
  async function executeMutationSuite(patches, testCommand, testFiles, workingDir, budgetMs, onProgress, sourceFiles, options = {}) {
66721
67191
  const startTime = Date.now();
66722
67192
  const effectiveBudget = budgetMs ?? TOTAL_BUDGET_MS;
@@ -66732,19 +67202,7 @@ async function executeMutationSuite(patches, testCommand, testFiles, workingDir,
66732
67202
  for (const patch of patches) {
66733
67203
  const originalCode = sourceFiles.get(patch.filePath);
66734
67204
  if (originalCode) {
66735
- const mutatedLines = [];
66736
- for (const line of patch.patch.split(`
66737
- `)) {
66738
- if (line.startsWith("+++"))
66739
- continue;
66740
- if (line.startsWith("+")) {
66741
- mutatedLines.push(line.substring(1));
66742
- } else if (!line.startsWith("-") && !line.startsWith("@") && !line.startsWith("diff ") && !line.startsWith("index ") && !line.startsWith("---")) {
66743
- mutatedLines.push(line);
66744
- }
66745
- }
66746
- const mutatedCode = mutatedLines.join(`
66747
- `);
67205
+ const mutatedCode = applyUnifiedDiff(originalCode, patch.patch) ?? hunkOnlyText(patch.patch);
66748
67206
  eqInput.push({ patch, originalCode, mutatedCode });
66749
67207
  }
66750
67208
  }
@@ -85130,7 +85588,7 @@ function createCuratorLLMDelegate(directory, mode = "init", sessionId) {
85130
85588
  }
85131
85589
  const sdkOpts = signal ? { signal } : {};
85132
85590
  try {
85133
- const { getSwarmAgents: getSwarmAgents2, resolveFallbackModel: resolveFallbackModel2 } = await import("./index-1jcy4gc6.js");
85591
+ const { getSwarmAgents: getSwarmAgents2, resolveFallbackModel: resolveFallbackModel2 } = await import("./index-etmwjgre.js");
85134
85592
  const createResult = await client.session.create({
85135
85593
  ...sessionId ? {
85136
85594
  body: {
@@ -89057,13 +89515,26 @@ function sharedTrailingSegments(a, b) {
89057
89515
  return shared;
89058
89516
  }
89059
89517
  function isCacheStale(impactMap, generatedAtMs) {
89060
- for (const sourcePath of Object.keys(impactMap)) {
89518
+ const statFor = (filePath) => {
89061
89519
  try {
89062
- const stat12 = fs62.statSync(sourcePath);
89063
- if (stat12.mtimeMs > generatedAtMs) {
89064
- return true;
89065
- }
89520
+ const stat12 = fs62.statSync(filePath);
89521
+ return stat12.mtimeMs > generatedAtMs ? "stale" : "fresh";
89066
89522
  } catch {
89523
+ return "missing";
89524
+ }
89525
+ };
89526
+ for (const sourcePath of Object.keys(impactMap)) {
89527
+ if (statFor(sourcePath) !== "fresh") {
89528
+ return true;
89529
+ }
89530
+ }
89531
+ const mappedTests = new Set;
89532
+ for (const tests of Object.values(impactMap)) {
89533
+ for (const testPath of tests)
89534
+ mappedTests.add(testPath);
89535
+ }
89536
+ for (const testPath of mappedTests) {
89537
+ if (statFor(testPath) !== "fresh") {
89067
89538
  return true;
89068
89539
  }
89069
89540
  }
@@ -89430,8 +89901,11 @@ async function analyzeImpact(changedFiles, cwd, budget) {
89430
89901
  budgetExceeded = true;
89431
89902
  break;
89432
89903
  }
89904
+ const sizeBefore = impactedTestsSet.size;
89433
89905
  impactedTestsSet.add(test);
89434
- visitedCount++;
89906
+ if (impactedTestsSet.size > sizeBefore) {
89907
+ visitedCount++;
89908
+ }
89435
89909
  }
89436
89910
  if (budgetExceeded)
89437
89911
  break;
@@ -89813,7 +90287,6 @@ var MAX_COMMAND_LENGTH2 = 500;
89813
90287
  var DEFAULT_TIMEOUT_MS3 = 60000;
89814
90288
  var MAX_TIMEOUT_MS2 = 300000;
89815
90289
  var MAX_SAFE_TEST_FILES = 50;
89816
- var MAX_SAFE_SOURCE_FILES = 1;
89817
90290
  async function estimateFanOut(sourceFiles, cwd) {
89818
90291
  try {
89819
90292
  const impactMap = await _internals102.loadImpactMap(cwd, {
@@ -90117,7 +90590,7 @@ var DISPATCH_FRAMEWORK_MAP = {
90117
90590
  };
90118
90591
  async function detectTestFrameworkViaDispatch(cwd) {
90119
90592
  try {
90120
- const { pickBackend } = await import("./dispatch-9yqqqfr6.js");
90593
+ const { pickBackend } = await import("./dispatch-3rwdxpp2.js");
90121
90594
  const backend = await pickBackend(cwd);
90122
90595
  if (!backend?.selectTestFramework)
90123
90596
  return "none";
@@ -90133,7 +90606,7 @@ async function buildTestCommandViaDispatch(framework, scope, files, coverage, ba
90133
90606
  if (framework === "none")
90134
90607
  return null;
90135
90608
  try {
90136
- const { pickBackend } = await import("./dispatch-9yqqqfr6.js");
90609
+ const { pickBackend } = await import("./dispatch-3rwdxpp2.js");
90137
90610
  const backend = await pickBackend(baseDir);
90138
90611
  if (backend?.buildTestCommand) {
90139
90612
  const cmd = backend.buildTestCommand(framework, files, baseDir, {
@@ -90155,7 +90628,7 @@ async function parseTestOutputViaDispatch(framework, output, baseDir) {
90155
90628
  if (framework === "none")
90156
90629
  return null;
90157
90630
  try {
90158
- const { pickBackend } = await import("./dispatch-9yqqqfr6.js");
90631
+ const { pickBackend } = await import("./dispatch-3rwdxpp2.js");
90159
90632
  const backend = await pickBackend(baseDir);
90160
90633
  if (!backend?.parseTestOutput)
90161
90634
  return null;
@@ -90470,6 +90943,7 @@ async function getTestFilesFromGraph(sourceFiles, workingDir) {
90470
90943
  }
90471
90944
  }
90472
90945
  } else {
90946
+ match = importRegex.exec(content);
90473
90947
  continue;
90474
90948
  }
90475
90949
  const importBasename = path120.basename(resolvedImport, path120.extname(resolvedImport));
@@ -91544,7 +92018,7 @@ function analyzeFailures(workingDir) {
91544
92018
  return report;
91545
92019
  }
91546
92020
  var test_runner = createSwarmTool({
91547
- description: 'Run project tests with automatic framework detection for bun, vitest, jest, mocha, pytest, cargo, pester, go test, maven, gradle, dotnet test, ctest, swift test, dart test, rspec, minitest, pest, phpunit, or php-artisan. Returns JSON with success, framework, scope, command, timeout_ms, duration_ms, totals, outcome, and optional coveragePercent, rawOutput, testCases, and message fields. Scope "target" runs one exact Go test/subtest or CTest name via native_target using a workspace-relative package/build directory, with no broad fallback, coverage, or bail. The "targets" array passes framework-native test name patterns to cargo, go-test, maven, gradle, dotnet-test, ctest, and swift-test.',
92021
+ description: 'Run project tests with automatic framework detection for bun, vitest, jest, mocha, pytest, cargo, pester, go test, maven, gradle, dotnet test, ctest, swift test, dart test, rspec, minitest, pest, phpunit, or php-artisan. Multi-source graph/impact/convention batches are permitted and deduplicated; the resolved test-file union is hard-capped at 50 (typed scope_exceeded with cap_decision on overflow). Returns JSON with success, framework, scope, command, timeout_ms, duration_ms, totals, outcome, and optional coveragePercent, rawOutput, testCases, resolved_test_files, cap_decision, fallback_reason, and message fields. A discovery scope that legitimately resolves zero tests returns outcome no_impacted_tests. Scope "target" runs one exact Go test/subtest or CTest name via native_target using a workspace-relative package/build directory, with no broad fallback, coverage, or bail. The "targets" array passes framework-native test name patterns to cargo, go-test, maven, gradle, dotnet-test, ctest, and swift-test.',
91548
92022
  args: {
91549
92023
  scope: exports_external.enum(["all", "convention", "graph", "impact", "target"]).optional().describe('Test scope: "all" runs the full suite, "convention"/"graph"/"impact" resolve files, and "target" runs one exact Go or CTest native name without file fallback.'),
91550
92024
  native_target: exports_external.object({
@@ -91653,8 +92127,8 @@ var test_runner = createSwarmTool({
91653
92127
  success: false,
91654
92128
  framework: "none",
91655
92129
  scope: "all",
91656
- error: 'scope "all" is blocked for agent use. Use scope "convention" with specific test files, or scope "graph" with exactly one source file.',
91657
- message: 'The full test suite is blocked in agent context. Use scope "convention" with specific test files, or scope "graph" with exactly one source file. Example: { scope: "convention", files: ["src/tools/test-runner.ts"] }',
92130
+ error: 'scope "all" is blocked for agent use. Use scope "convention" with specific test files, or a bounded multi-source batch via scope "graph"/"impact" (the resolved test set must stay under the safe cap).',
92131
+ message: 'The full test suite is blocked in agent context. Use scope "convention" with specific test files, or a bounded multi-source batch via scope "graph"/"impact" (the resolved test set must stay under the safe cap). Example: { scope: "convention", files: ["src/tools/test-runner.ts"] }',
91658
92132
  outcome: "error"
91659
92133
  };
91660
92134
  return JSON.stringify(errorResult, null, 2);
@@ -91738,17 +92212,6 @@ var test_runner = createSwarmTool({
91738
92212
  };
91739
92213
  return JSON.stringify(errorResult, null, 2);
91740
92214
  }
91741
- if (sourceFiles.length > MAX_SAFE_SOURCE_FILES) {
91742
- const errorResult = {
91743
- success: false,
91744
- framework,
91745
- scope,
91746
- error: `scope "convention" accepts at most ${MAX_SAFE_SOURCE_FILES} source file for discovery (got ${sourceFiles.length}). Treat this as SKIP without retry.`,
91747
- message: `Too many source files for scope "convention" discovery (${sourceFiles.length} provided, limit is ${MAX_SAFE_SOURCE_FILES}). Call test_runner once per source file, or pass direct test file paths instead of source files.`,
91748
- outcome: "scope_exceeded"
91749
- };
91750
- return JSON.stringify(errorResult, null, 2);
91751
- }
91752
92215
  testFiles = [
91753
92216
  ...directTestFiles,
91754
92217
  ...getTestFilesFromConvention(sourceFiles, workingDir)
@@ -91772,17 +92235,6 @@ var test_runner = createSwarmTool({
91772
92235
  };
91773
92236
  return JSON.stringify(errorResult, null, 2);
91774
92237
  }
91775
- if (sourceFiles.length > MAX_SAFE_SOURCE_FILES) {
91776
- const errorResult = {
91777
- success: false,
91778
- framework,
91779
- scope,
91780
- error: `scope "graph" accepts at most ${MAX_SAFE_SOURCE_FILES} source file (got ${sourceFiles.length}). Treat this as SKIP without retry.`,
91781
- message: `Too many source files for scope "graph" (${sourceFiles.length} provided, limit is ${MAX_SAFE_SOURCE_FILES}). Call test_runner once per source file, or use scope "convention" with direct test file paths.`,
91782
- outcome: "scope_exceeded"
91783
- };
91784
- return JSON.stringify(errorResult, null, 2);
91785
- }
91786
92238
  const estimate = await estimateFanOut(sourceFiles, workingDir);
91787
92239
  if (estimate.estimatedCount > MAX_SAFE_TEST_FILES) {
91788
92240
  const errorResult = {
@@ -91822,17 +92274,6 @@ var test_runner = createSwarmTool({
91822
92274
  };
91823
92275
  return JSON.stringify(errorResult, null, 2);
91824
92276
  }
91825
- if (sourceFiles.length > MAX_SAFE_SOURCE_FILES) {
91826
- const errorResult = {
91827
- success: false,
91828
- framework,
91829
- scope,
91830
- error: `scope "impact" accepts at most ${MAX_SAFE_SOURCE_FILES} source file (got ${sourceFiles.length}). Treat this as SKIP without retry.`,
91831
- message: `Too many source files for scope "impact" (${sourceFiles.length} provided, limit is ${MAX_SAFE_SOURCE_FILES}). Call test_runner once per source file, or use scope "convention" with direct test file paths.`,
91832
- outcome: "scope_exceeded"
91833
- };
91834
- return JSON.stringify(errorResult, null, 2);
91835
- }
91836
92277
  const estimate = await estimateFanOut(sourceFiles, workingDir);
91837
92278
  if (estimate.estimatedCount > MAX_SAFE_TEST_FILES) {
91838
92279
  const errorResult = {
@@ -91854,7 +92295,12 @@ var test_runner = createSwarmTool({
91854
92295
  scope,
91855
92296
  error: "Budget exceeded during impact analysis",
91856
92297
  message: `Impact analysis exceeded safe budget of ${MAX_SAFE_TEST_FILES} test files.`,
91857
- outcome: "scope_exceeded"
92298
+ outcome: "scope_exceeded",
92299
+ cap_decision: {
92300
+ decision: "cap_exceeded",
92301
+ resolved_test_count: impactResult.impactedTests.length,
92302
+ limit: MAX_SAFE_TEST_FILES
92303
+ }
91858
92304
  };
91859
92305
  return JSON.stringify(errorResult, null, 2);
91860
92306
  }
@@ -91890,13 +92336,21 @@ var test_runner = createSwarmTool({
91890
92336
  }
91891
92337
  if (scope !== "all" && scope !== "target" && testFiles.length === 0 && !(args.targets && args.targets.length > 0)) {
91892
92338
  const baseMessage = "No matching test files found for the provided source files. Check that test files exist with matching naming conventions (.spec.*, .test.*, .Tests.ps1, __tests__/, tests/, test/, spec/).";
92339
+ const discoveryEmptyOutcome = scope === "impact" || scope === "graph" ? "no_impacted_tests" : "skip";
91893
92340
  const errorResult = {
91894
92341
  success: false,
91895
92342
  framework,
91896
92343
  scope: effectiveScope,
91897
92344
  error: "Provided source files resolved to zero test files",
91898
92345
  message: graphFallbackReason ? `${baseMessage} (${graphFallbackReason})` : baseMessage,
91899
- outcome: "skip",
92346
+ outcome: discoveryEmptyOutcome,
92347
+ resolved_test_files: [],
92348
+ cap_decision: {
92349
+ decision: "within_cap",
92350
+ resolved_test_count: 0,
92351
+ limit: MAX_SAFE_TEST_FILES
92352
+ },
92353
+ ...graphFallbackReason && { fallback_reason: graphFallbackReason },
91900
92354
  ...scope === "graph" && { attempted_scope: "graph" },
91901
92355
  ...scope === "impact" && { attempted_scope: "graph" }
91902
92356
  };
@@ -91910,7 +92364,14 @@ var test_runner = createSwarmTool({
91910
92364
  scope: effectiveScope,
91911
92365
  error: `Resolved test file count (${testFiles.length}) exceeds safe maximum (${MAX_SAFE_TEST_FILES})`,
91912
92366
  message: `Too many test files resolved (${testFiles.length}). Maximum allowed is ${MAX_SAFE_TEST_FILES}. Treat this as SKIP without retry. Provide more specific source files to narrow down test scope. First few resolved: ${sampleFiles.join(", ")}`,
91913
- outcome: "scope_exceeded"
92367
+ outcome: "scope_exceeded",
92368
+ resolved_test_files: testFiles,
92369
+ cap_decision: {
92370
+ decision: "cap_exceeded",
92371
+ resolved_test_count: testFiles.length,
92372
+ limit: MAX_SAFE_TEST_FILES
92373
+ },
92374
+ ...graphFallbackReason && { fallback_reason: graphFallbackReason }
91914
92375
  };
91915
92376
  return JSON.stringify(errorResult, null, 2);
91916
92377
  }
@@ -91928,6 +92389,17 @@ var test_runner = createSwarmTool({
91928
92389
  result.message = `${result.message || ""} | FAILURE ANALYSIS: ${clusterSummary}`;
91929
92390
  }
91930
92391
  }
92392
+ if (scope === "graph" || scope === "impact" || scope === "convention") {
92393
+ result.resolved_test_files = testFiles;
92394
+ result.cap_decision = {
92395
+ decision: "within_cap",
92396
+ resolved_test_count: testFiles.length,
92397
+ limit: MAX_SAFE_TEST_FILES
92398
+ };
92399
+ if (graphFallbackReason) {
92400
+ result.fallback_reason = graphFallbackReason;
92401
+ }
92402
+ }
91931
92403
  if (graphFallbackReason && result.message) {
91932
92404
  result.message = `${result.message} (${graphFallbackReason})`;
91933
92405
  }
@@ -99048,7 +99520,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
99048
99520
  if (!input.dispatcher) {
99049
99521
  throw new Error("no evaluation dispatcher available (cannot run validation)");
99050
99522
  }
99051
- const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-y3sydwtj.js");
99523
+ const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-16b691ba.js");
99052
99524
  const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
99053
99525
  const result = await withProtectedSetIntegrity([evalInputRoot, ...protectedRoots(input.directory)], () => _internals120.evaluateCandidateV1({
99054
99526
  projectRoot: input.directory,
@@ -101677,7 +102149,7 @@ function buildDetailedHelp(commandName, entry) {
101677
102149
  async function handleHelpCommand(ctx) {
101678
102150
  const targetCommand = ctx.args.join(" ");
101679
102151
  if (!targetCommand) {
101680
- const { buildHelpText } = await import("./index-1qnykdaw.js");
102152
+ const { buildHelpText } = await import("./index-pxtye2ng.js");
101681
102153
  return buildHelpText();
101682
102154
  }
101683
102155
  const tokens = targetCommand.split(/\s+/);
@@ -101691,7 +102163,7 @@ async function handleHelpCommand(ctx) {
101691
102163
  > Note: \`/swarm ${resolved.key}\` is a deprecated alias for \`/swarm ${aliasTarget}\`.` : detailed;
101692
102164
  }
101693
102165
  const similar = _internals24.findSimilarCommands(targetCommand);
101694
- const { buildHelpText: fullHelp } = await import("./index-1qnykdaw.js");
102166
+ const { buildHelpText: fullHelp } = await import("./index-pxtye2ng.js");
101695
102167
  if (similar.length > 0) {
101696
102168
  return `Command '/swarm ${targetCommand}' not found.
101697
102169
 
@@ -102006,7 +102478,7 @@ var COMMAND_REGISTRY = {
102006
102478
  },
102007
102479
  "guardrail explain": {
102008
102480
  handler: async (ctx) => {
102009
- const { handleGuardrailExplain } = await import("./guardrail-explain-rre9ntq3.js");
102481
+ const { handleGuardrailExplain } = await import("./guardrail-explain-ffwmhf7s.js");
102010
102482
  return handleGuardrailExplain(ctx.directory, ctx.args);
102011
102483
  },
102012
102484
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -102016,7 +102488,7 @@ var COMMAND_REGISTRY = {
102016
102488
  },
102017
102489
  "guardrail reset": {
102018
102490
  handler: async (ctx) => {
102019
- const { handleGuardrailReset } = await import("./guardrail-reset-6gad352a.js");
102491
+ const { handleGuardrailReset } = await import("./guardrail-reset-07byr7nr.js");
102020
102492
  return handleGuardrailReset(ctx.args, ctx.sessionID);
102021
102493
  },
102022
102494
  description: "Reset one exact active invocation/action circuit after repair",
@@ -102037,7 +102509,7 @@ var COMMAND_REGISTRY = {
102037
102509
  },
102038
102510
  "guardrail-log": {
102039
102511
  handler: async (ctx) => {
102040
- const { handleGuardrailLog } = await import("./guardrail-log-t0ydqz5s.js");
102512
+ const { handleGuardrailLog } = await import("./guardrail-log-j2wtq7p2.js");
102041
102513
  return handleGuardrailLog(ctx.directory, ctx.args);
102042
102514
  },
102043
102515
  description: "Read the guardrail decision log (use --blocks-only for blocks)",
@@ -102523,9 +102995,9 @@ Subcommands:
102523
102995
  },
102524
102996
  "abort-pr-workflow": {
102525
102997
  handler: (ctx) => handleAbortPrWorkflowCommand(ctx.directory, ctx.args, ctx.sessionID),
102526
- description: "Clear a stuck PR_REVIEW/PR_FEEDBACK mechanical gate and stop the auto-resume loop [mode] [reason]",
102527
- args: "[PR_REVIEW|PR_FEEDBACK] [reason...]",
102528
- details: 'Human-only escape hatch for an unrecoverable PR_REVIEW or PR_FEEDBACK mechanical gate. When the architect cannot reach complete_pr_workflow \u2014 for example a compound `git fetch && git checkout` was rejected as read-only shell syntax, the PR head cannot be fetched, or the working tree is on the wrong branch \u2014 running this clears the durable gate state for the current session and stops the auto-resume loop without depending on the trapped model. The agent itself cannot run this command; it must call the abort_pr_workflow tool (or ask you to run this command). Both paths funnel into the same fail-closed abortPrWorkflow hook, which refuses while the workflow is armed for publication or while PR workflow lanes are still in flight. Issue #2108 adds the two audited exits from an armed publication window: the invalidate_pr_feedback_publication tool (change approved content \u2014 every approval of the generation is superseded and the full ladder re-runs) and the abort_pr_workflow tool kind "cancel-publication" with cancel_publication: true and a reason (terminal no-publish cancellation; never grants push authority). A plain recovery or force abort never clears an armed window. This human-only force path has exactly one exception to the lane refusal (issue #2251): when the ONLY lanes still blocking are ones past the 30-minute staleness horizon that the liveness probe reports as still running \u2014 a lane nothing will ever settle on a schedule \u2014 it clears the gate anyway, names exactly which lanes it overrode, and finalizes their delegation records so the session can start a new PR workflow. Those sessions are NOT stopped and their output is NOT collected. A lane with a fresh updatedAt still blocks even under force, and any delegation record that still keeps the session blocked is named in the warning. When checkout preparation preserved a stash, the result instructs the caller to run prepare_pr_workflow_checkout operation=restore after the clear. An audit event is appended to .swarm/events.jsonl.',
102998
+ description: "Clear a stuck PR_REVIEW/PR_FEEDBACK mechanical gate and stop the auto-resume loop [mode] [reason] or PR_FEEDBACK --cancel-publication <reason...> (cancelled_without_publication)",
102999
+ args: "[PR_REVIEW|PR_FEEDBACK] [reason...] | PR_FEEDBACK --cancel-publication <reason...>",
103000
+ details: "Human-only escape hatch for an unrecoverable PR_REVIEW or PR_FEEDBACK mechanical gate. When the architect cannot reach complete_pr_workflow \u2014 for example a compound `git fetch && git checkout` was rejected as read-only shell syntax, the PR head cannot be fetched, or the working tree is on the wrong branch \u2014 running this clears the durable gate state for the current session and stops the auto-resume loop without depending on the trapped model. The agent itself cannot run this command; it must call the abort_pr_workflow tool (or ask you to run this command). Both paths funnel into the same fail-closed abortPrWorkflow hook, which refuses while the workflow is armed for publication or while PR workflow lanes are still in flight. To cancel an armed PR_FEEDBACK publication without publishing, use the exact human syntax `PR_FEEDBACK --cancel-publication <reason...>`; it requires a non-empty reason, records the terminal `cancelled_without_publication` status with the observed remote head, and never grants push authority. A plain recovery or force abort never clears an armed window. This human-only force path has exactly one exception to the lane refusal (issue #2251): when the ONLY lanes still blocking are ones past the 30-minute staleness horizon that the liveness probe reports as still running \u2014 a lane nothing will ever settle on a schedule \u2014 it clears the gate anyway, names exactly which lanes it overrode, and finalizes their delegation records so the session can start a new PR workflow. Those sessions are NOT stopped and their output is NOT collected. A lane with a fresh updatedAt still blocks even under force, and any delegation record that still keeps the session blocked is named in the warning. When checkout preparation preserved a stash, the result instructs the caller to run prepare_pr_workflow_checkout operation=restore after the clear. An audit event is appended to .swarm/events.jsonl.",
102529
103001
  category: "utility",
102530
103002
  toolPolicy: "restricted"
102531
103003
  },
@@ -103205,7 +103677,7 @@ Entry points: {{ENTRY_POINTS}}
103205
103677
  If any field is \`{{...}}\` (unresolved): run MODE: DISCOVER to populate it, then cache in \`.swarm/context.md\` under \`## Project Context\`.
103206
103678
 
103207
103679
  ## GRAPH-FIRST EVIDENCE
103208
- Before planning or broad codebase/security review, use \`repo_map\` in this order: \`graph_health\`, then \`package_boundaries\` and \`key_files\`, then a targeted \`context_pack\` that includes source anchors. For security or cross-boundary data flow, add \`route_trace\` and \`data_trace\`. Graph evidence is advisory, never an approval or denial. If the graph is absent, stale, freshness is inconclusive, confidence is low, a claim lacks source, the language is unsupported/dynamic, or an action fails, inspect the direct source and searches before deciding.
103680
+ Before planning or broad codebase/security review, use \`repo_map\` in this order: \`graph_health\`, then \`package_boundaries\` and \`key_files\`, then a targeted \`context_pack\` that includes source anchors. For security or cross-boundary data flow, add \`route_trace\` and \`data_trace\`. For planning preflight, run \`repo_map\` with action="preflight_packet" (bounded ontology packet of roles, routes, data, and security findings) to frame risk, and action="ontology" where a file's roles matter. Graph evidence is advisory, never an approval or denial. If the graph is absent, stale, freshness is inconclusive, confidence is low, a claim lacks source, the language is unsupported/dynamic, or an action fails, inspect the direct source and searches before deciding.
103209
103681
 
103210
103682
  ## CONTEXT TRIAGE
103211
103683
  When approaching context limits, preserve/discard in this priority order:
@@ -104745,7 +105217,7 @@ SKILLS HANDLING: If SKILLS is present and not "none", read the skill names/descr
104745
105217
 
104746
105218
  RULES:
104747
105219
  - Read target file before editing
104748
- - Before editing a shared or cross-imported file, call \`repo_map action="localization"\`, then \`repo_map action="impact_cone"\` before changing shared or exported symbols \u2014 the injected localization block covers only a declared scope's primary file; this covers the rest, including when no scope was declared
105220
+ - Before editing a shared or cross-imported file, call \`repo_map action="localization"\`, then \`repo_map action="impact_cone"\` plus \`repo_map action="callers"\` before changing shared or exported symbols (callers is conservative regex analysis; it cannot see dynamic dispatch) \u2014 the injected localization block covers only a declared scope's primary file; this covers the rest, including when no scope was declared
104749
105221
  - Treat graph results as advisory evidence. Require source anchors; when freshness is stale or inconclusive, confidence is low, source is missing, the language is unsupported/dynamic, the graph is absent, or an action fails, inspect the direct source and searches before editing.
104750
105222
  - Implement exactly what TASK specifies
104751
105223
  - Respect CONSTRAINT
@@ -105795,7 +106267,7 @@ DO (explicitly):
105795
106267
  - VERIFY imports exist: if the coder added a new import, use search to verify the export exists in the source
105796
106268
  - CHECK test files were updated: if the coder changed a function signature, the tests should reflect it
105797
106269
  - VERIFY platform compatibility: path.join() used for all paths, no hardcoded separators
105798
- - GRAPH-FIRST REVIEW: call \`repo_map action="graph_health"\`, then use \`diff_context\` and \`impact_cone\` (or \`blast_radius\` for file-level dependents) to localize the changed surface. Require source anchors and verify the direct source. Graph evidence is advisory only, never an approval or denial; if freshness is stale or inconclusive, confidence is low, source is missing, the language is unsupported/dynamic, the graph is absent, or an action fails, rely on the direct source, Git diff, and searches.
106270
+ - GRAPH-FIRST REVIEW: call \`repo_map action="graph_health"\`, then use \`diff_context\` and \`impact_cone\` (or \`blast_radius\` for file-level dependents) to localize the changed surface. Use \`repo_map action="symbol_context"\` for definition-first verification of symbol claims and \`repo_map action="dead_exports"\` to surface advisory review candidates (never delete directives). Require source anchors and verify the direct source. Graph evidence is advisory only, never an approval or denial; if freshness is stale or inconclusive, confidence is low, source is missing, the language is unsupported/dynamic, the graph is absent, or an action fails, rely on the direct source, Git diff, and searches.
105799
106271
  - For confirmed issues requiring a concrete fix: use suggest_patch to produce a structured patch artifact for the coder
105800
106272
 
105801
106273
  ## CONFIG STRICTNESS VERIFICATION
@@ -107173,4 +107645,4 @@ function getAgentConfigs(config, directory, sessionId, projectContext) {
107173
107645
  return result;
107174
107646
  }
107175
107647
 
107176
- export { resetActionCircuitExternally, getBlockingActionCircuit, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, getSharedClassifierGuardrailBlock, classifyCommand, MAX_PARALLEL_VERDICT_TASKS, computeParallelVerdict, createArchitectAgent, createCoderAgent, GENERALIST_COUNCIL_PROMPT, SKEPTIC_COUNCIL_PROMPT, DOMAIN_EXPERT_COUNCIL_PROMPT, createCriticAgent, createCuratorAgent, createDesignerAgent, createDocsAgent, createResearcherAgent, SECURITY_CATEGORIES, createReviewerAgent, createSMEAgent, createTestEngineerAgent, _internals123 as _internals, stripSwarmPrefix, extractSwarmIdFromAgentName, resolveFallbackModel, getSwarmAgents, createAgents, resolvePrimaryAgentNames, getAgentConfigs, 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, _internals22 as _internals1, redactSecrets, prWorkflowSessionFileStem, ensurePrWorkflowSafeParentDirectory, writePrWorkflowAtomicJson, PrWorkflowCheckoutMutationTimeoutError, withPrWorkflowCheckoutMutationLock, PR_REVIEW_REPORT_VERDICTS, allowedPrReviewReportVerdicts, normalizePrReviewPartialBaseCoverageRecord, rollbackPrReviewPartialBaseCoverageAdmission, readPrReviewTerminalCoverageForReport, PR_REVIEW_REQUIRED_MICRO_LANE_IDS, PR_REVIEW_DEPTH_TIER_THRESHOLDS, PR_REVIEW_BASE_LANE_FLOORS, PR_REVIEW_TIER_L_CONSOLIDATED_LANE_FLOOR, PR_REVIEW_MICRO_LANE_FLOORS, computePrReviewDepthTier, MAX_PR_FEEDBACK_INVENTORY_AMENDMENTS, activatePrWorkflow, readPrWorkflowGateState, submitPrReviewResult, withPrWorkflowCheckoutPreparationLock, withInactivePrWorkflowCheckoutRestoreLock, clearPrWorkflowGateState, collectPrWorkflowPendingLaneLiveness, settlePresumedStalePrWorkflowLanes, abortPrWorkflow, recoverArmedPrWorkflow, bindPrWorkflowHead, rebindPrFeedbackHead, bindPrReviewBase, assertCurrentCheckoutHead, assertPrReviewCleanCheckout, enforcePrWorkflowDispatchLanesAsync, PrReviewResilienceCircuitOpenError, PrReviewResilienceRetryExhaustedError, enforcePrReviewBaseDimensions, rollbackPrReviewBaseAdmissionIfUnlaunched, admitPrReviewPartialBaseCoverage2 as admitPrReviewPartialBaseCoverage, assertPrReviewBaseCoverageSettled2 as assertPrReviewBaseCoverageSettled, recordPrReviewValidationBatch, assertPrReviewValidationSettled, declarePrFeedbackInventory, enforcePrFeedbackVerificationOwnership, assertPrFeedbackVerificationSettled, recordPrFeedbackStageA, recordPrFeedbackGateBatch, assertPrFeedbackGatePhaseSettled, assertPrFeedbackReadyToPublish, invalidatePrFeedbackPublication, describePrWorkflowPublicationSection, findDanglingLivePublicationGeneration, recordPrFeedbackPushAttemptResult, resolvePrReviewWriterRunId, markPrReviewTriggerEvaluationComplete, bindPrReviewTriggerLedger, assertPrReviewArtifactBoundary, assertPrReviewArtifactRecordsMatchAuthoritativeVerdicts, markPrReviewArtifactBoundary, markPrReviewHandoffComplete, readPrReviewFinalFindingPolicyForReport, transitionPrReviewToFeedback, declarePrFeedbackScope, resolvePrFeedbackScopeDeclaration, consumePrFeedbackScopeDeclaration, validatePrFeedbackScopeBinding, enforcePrWorkflowToolBefore, readPrReviewReentryBindingContext, hasActivePrReviewReentryAuthorization, reserveActivePrReviewReentryAuthorization, completePrWorkflow, _test_exports2 as _test_exports, normalizePrWorkflowShellCommand, describePrWorkflowRevisionDigestFailure, readAuthoritativePrReviewCriticSettlements, readAuthoritativePrReviewCriticVerdicts, formatPrReviewLaneValidationFailure, validatePrReviewDiscoveryLaneCompletion2 as validatePrReviewDiscoveryLaneCompletion, validatePrWorkflowTransportRecovery, prReviewDiscoveryArtifactCoversLane, MAX_SALVAGED_SCHEMA_ERROR_CHARS, readPrWorkflowGateStateForRecovery, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleApproveWriteCommand, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, createSwarmTool, handleCheckpointCommand, DEFAULT_CI_DEADLINE_MS2 as DEFAULT_CI_DEADLINE_MS, createSignalCancellation, handleCiCommand, handleCiSimulateCommand, handleClarifyCommand, safeRealpathSync, buildSynonymIndex, expandTokens, readSynonymMap, createCuratorLLMDelegate, startSnapshotCoordinationInitialization, ensureSnapshotCoordinationReady, retrySnapshotCoordinationInitialization, getSnapshotCoordinationStatus, beginSnapshotCoordinationReset, closeSnapshotCoordinationInitialization, markSnapshotCoordinationClosing, _snapshotCoordinationInternals, handleCloseCommand, _internals53 as _internals2, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals57 as _internals3, createHivePromoterHook, promoteToHive, promoteFromSwarm, createMemoryGateway, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, getCoChangePairs, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getHostConfigDir, getPluginCachePaths, getPluginLockFilePaths, VERSION_PINNED_LEAF, discoverVersionPinnedCachePaths, readCachePackageVersion, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, computeQualityBudget, computeSastScan, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleBlueprintValidateCommand, handleBlueprintCurrentCommand, handleBlueprintHistoryCommand, handleBlueprintDiffCommand, handleBlueprintExportCommand, handleHarnessCandidateValidateCommand, handleHarnessCandidateShowCommand, handleHarnessCandidateDiffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, symbols, 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, isCommandFailure, COMMAND_REGISTRY, VALID_COMMANDS, _internals24 as _internals4, resolveCommand, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand };
107648
+ export { resetActionCircuitExternally, getBlockingActionCircuit, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, getSharedClassifierGuardrailBlock, classifyCommand, MAX_PARALLEL_VERDICT_TASKS, computeParallelVerdict, createArchitectAgent, createCoderAgent, GENERALIST_COUNCIL_PROMPT, SKEPTIC_COUNCIL_PROMPT, DOMAIN_EXPERT_COUNCIL_PROMPT, createCriticAgent, createCuratorAgent, createDesignerAgent, createDocsAgent, createResearcherAgent, SECURITY_CATEGORIES, createReviewerAgent, createSMEAgent, createTestEngineerAgent, _internals123 as _internals, stripSwarmPrefix, extractSwarmIdFromAgentName, resolveFallbackModel, getSwarmAgents, createAgents, resolvePrimaryAgentNames, getAgentConfigs, 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, _internals22 as _internals1, redactSecrets, prWorkflowSessionFileStem, ensurePrWorkflowSafeParentDirectory, writePrWorkflowAtomicJson, PrWorkflowCheckoutMutationTimeoutError, withPrWorkflowCheckoutMutationLock, PR_REVIEW_REPORT_VERDICTS, allowedPrReviewReportVerdicts, normalizePrReviewPartialBaseCoverageRecord, rollbackPrReviewPartialBaseCoverageAdmission, readPrReviewTerminalCoverageForReport, PR_REVIEW_REQUIRED_MICRO_LANE_IDS, PR_REVIEW_DEPTH_TIER_THRESHOLDS, PR_REVIEW_BASE_LANE_FLOORS, PR_REVIEW_TIER_L_CONSOLIDATED_LANE_FLOOR, PR_REVIEW_MICRO_LANE_FLOORS, computePrReviewDepthTier, MAX_PR_FEEDBACK_INVENTORY_AMENDMENTS, activatePrWorkflow, readPrWorkflowGateState, submitPrReviewResult, withPrWorkflowCheckoutPreparationLock, withInactivePrWorkflowCheckoutRestoreLock, clearPrWorkflowGateState, terminalizePrWorkflowGateForSession2 as terminalizePrWorkflowGateForSession, collectPrWorkflowPendingLaneLiveness, settlePresumedStalePrWorkflowLanes, abortPrWorkflow, recoverArmedPrWorkflow, bindPrWorkflowHead, rebindPrFeedbackHead, bindPrReviewBase, assertCurrentCheckoutHead, assertPrReviewCleanCheckout, enforcePrWorkflowDispatchLanesAsync, PrReviewResilienceCircuitOpenError, PrReviewResilienceRetryExhaustedError, enforcePrReviewBaseDimensions, rollbackPrReviewBaseAdmissionIfUnlaunched, admitPrReviewPartialBaseCoverage2 as admitPrReviewPartialBaseCoverage, assertPrReviewBaseCoverageSettled2 as assertPrReviewBaseCoverageSettled, recordPrReviewValidationBatch, assertPrReviewValidationSettled, declarePrFeedbackInventory, enforcePrFeedbackVerificationOwnership, assertPrFeedbackVerificationSettled, recordPrFeedbackStageA, recordPrFeedbackGateBatch, assertPrFeedbackGatePhaseSettled, assertPrFeedbackReadyToPublish, invalidatePrFeedbackPublication, describePrWorkflowPublicationSection, findDanglingLivePublicationGeneration, recordPrFeedbackPushAttemptResult, resolvePrReviewWriterRunId, markPrReviewTriggerEvaluationComplete, bindPrReviewTriggerLedger, assertPrReviewArtifactBoundary, assertPrReviewArtifactRecordsMatchAuthoritativeVerdicts, markPrReviewArtifactBoundary, markPrReviewHandoffComplete, readPrReviewFinalFindingPolicyForReport, transitionPrReviewToFeedback, declarePrFeedbackScope, resolvePrFeedbackScopeDeclaration, consumePrFeedbackScopeDeclaration, validatePrFeedbackScopeBinding, enforcePrWorkflowToolBefore, readPrReviewReentryBindingContext, hasActivePrReviewReentryAuthorization, reserveActivePrReviewReentryAuthorization, completePrWorkflow, _test_exports2 as _test_exports, normalizePrWorkflowShellCommand, describePrWorkflowRevisionDigestFailure, readAuthoritativePrReviewCriticSettlements, readAuthoritativePrReviewCriticVerdicts, formatPrReviewLaneValidationFailure, validatePrReviewDiscoveryLaneCompletion2 as validatePrReviewDiscoveryLaneCompletion, validatePrWorkflowTransportRecovery, prReviewDiscoveryArtifactCoversLane, MAX_SALVAGED_SCHEMA_ERROR_CHARS, readPrWorkflowGateStateForRecovery, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleApproveWriteCommand, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, createSwarmTool, handleCheckpointCommand, DEFAULT_CI_DEADLINE_MS2 as DEFAULT_CI_DEADLINE_MS, createSignalCancellation, handleCiCommand, handleCiSimulateCommand, handleClarifyCommand, safeRealpathSync, buildSynonymIndex, expandTokens, readSynonymMap, createCuratorLLMDelegate, startSnapshotCoordinationInitialization, ensureSnapshotCoordinationReady, retrySnapshotCoordinationInitialization, getSnapshotCoordinationStatus, beginSnapshotCoordinationReset, closeSnapshotCoordinationInitialization, markSnapshotCoordinationClosing, _snapshotCoordinationInternals, handleCloseCommand, _internals53 as _internals2, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals57 as _internals3, createHivePromoterHook, promoteToHive, promoteFromSwarm, createMemoryGateway, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, getCoChangePairs, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getHostConfigDir, getPluginCachePaths, getPluginLockFilePaths, VERSION_PINNED_LEAF, discoverVersionPinnedCachePaths, readCachePackageVersion, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, computeQualityBudget, computeSastScan, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleBlueprintValidateCommand, handleBlueprintCurrentCommand, handleBlueprintHistoryCommand, handleBlueprintDiffCommand, handleBlueprintExportCommand, handleHarnessCandidateValidateCommand, handleHarnessCandidateShowCommand, handleHarnessCandidateDiffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, symbols, 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, isCommandFailure, COMMAND_REGISTRY, VALID_COMMANDS, _internals24 as _internals4, resolveCommand, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand };