opencode-swarm 7.159.3 → 7.160.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/.opencode/skills/swarm-pr-review/SKILL.md +28 -29
  2. package/.opencode/skills/swarm-pr-review/references/prompt-templates.md +21 -5
  3. package/dist/background/delegation-health.d.ts +1 -1
  4. package/dist/background/pending-delegations.d.ts +46 -1
  5. package/dist/background/pr-review-contract.d.ts +245 -2
  6. package/dist/cli/{coder-settlement-50p7dsya.js → coder-settlement-678ccmnf.js} +11 -10
  7. package/dist/cli/{config-doctor-a7drgs33.js → config-doctor-fr8dfrt2.js} +3 -3
  8. package/dist/cli/{core-madqgdsc.js → core-4j1hbhey.js} +2 -2
  9. package/dist/cli/{curation-policy-ray8h55z.js → curation-policy-47przjwg.js} +6 -6
  10. package/dist/cli/{curator-3sz7refy.js → curator-85d97240.js} +33 -32
  11. package/dist/cli/curator-llm-factory-s9s4s0q3.js +67 -0
  12. package/dist/cli/{evidence-summary-service-cwyjkdsa.js → evidence-summary-service-9dyt2kzh.js} +15 -14
  13. package/dist/cli/{gate-evidence-95k5ap1z.js → gate-evidence-a6paafg8.js} +7 -7
  14. package/dist/cli/guardrail-explain-4a2xdtew.js +68 -0
  15. package/dist/cli/{guardrail-log-nerqk9qb.js → guardrail-log-27nkntrx.js} +9 -6
  16. package/dist/cli/{guardrail-reset-chbc0mep.js → guardrail-reset-xn7k3hn8.js} +33 -32
  17. package/dist/cli/{hive-promoter-4rtxhw7n.js → hive-promoter-k57j3kp6.js} +33 -32
  18. package/dist/cli/{index-515nwvdp.js → index-497a3hhj.js} +19 -10
  19. package/dist/cli/{index-h96xp4t0.js → index-61c3d769.js} +875 -37
  20. package/dist/cli/{index-ve0xj03m.js → index-7ezv5j23.js} +4 -4
  21. package/dist/cli/{index-0zerbq1v.js → index-7h2armwf.js} +23 -14
  22. package/dist/cli/{index-ebxmfr4j.js → index-7npz9n4s.js} +5 -4
  23. package/dist/cli/{index-m9m3emns.js → index-7v0ex0jt.js} +2 -2
  24. package/dist/cli/{index-ebz97mks.js → index-8c9qzpy7.js} +1 -0
  25. package/dist/cli/{index-5hfqc3h3.js → index-98jmggma.js} +24 -7
  26. package/dist/cli/{index-8fyebh3w.js → index-awjx0wgk.js} +1 -1
  27. package/dist/cli/{index-av3gnekk.js → index-b5adxpy6.js} +1 -1
  28. package/dist/cli/{index-t3wk7q51.js → index-bqxffayb.js} +1 -1
  29. package/dist/cli/{index-yt75r1er.js → index-c9zp4xwc.js} +13 -2
  30. package/dist/cli/{index-9qw4sbg1.js → index-dh5q6z7y.js} +7 -7
  31. package/dist/cli/{index-prknc0xn.js → index-dke4wzkn.js} +108 -44
  32. package/dist/cli/{index-nvz4mp5w.js → index-dq93ar40.js} +6 -6
  33. package/dist/cli/{index-zswy6xgb.js → index-drqvph47.js} +7 -7
  34. package/dist/cli/{index-sn6mtxxc.js → index-e1ygmd4q.js} +35 -34
  35. package/dist/cli/{index-6jp5yxye.js → index-f72612zc.js} +16 -2
  36. package/dist/cli/{index-y2d381ce.js → index-gjx53y3c.js} +1 -1
  37. package/dist/cli/{index-xs32znyz.js → index-j3ss86kf.js} +1 -1
  38. package/dist/cli/{index-p3ym3y8b.js → index-jszabr0r.js} +4 -4
  39. package/dist/cli/{index-wwpe4am7.js → index-m1cw9fsh.js} +8 -8
  40. package/dist/cli/{index-8zw60wya.js → index-m84z3aa8.js} +13 -4
  41. package/dist/cli/index-mmr96pwr.js +785 -0
  42. package/dist/cli/{index-gk6gpe7r.js → index-nk498mx6.js} +2 -2
  43. package/dist/cli/{index-2jzmg2km.js → index-nnzdayvk.js} +6 -6
  44. package/dist/cli/{index-fnxmg8sz.js → index-ny0g8fdg.js} +5 -5
  45. package/dist/cli/{index-40t6s98s.js → index-pkz91fwm.js} +3 -3
  46. package/dist/cli/{index-bxpqq9th.js → index-pqjcyj0p.js} +3 -3
  47. package/dist/cli/{index-nhhek8yw.js → index-prv20xq6.js} +1 -1
  48. package/dist/cli/{index-mqfs5f8a.js → index-qc53dfzh.js} +2 -2
  49. package/dist/cli/{index-xqjhbfbx.js → index-v8dsmee1.js} +4 -4
  50. package/dist/cli/{index-qxpfmryw.js → index-wccdm7jv.js} +5 -5
  51. package/dist/cli/{index-rq4jcw64.js → index-z0bxbb9g.js} +4 -4
  52. package/dist/cli/{index-txwx9p21.js → index-zdv914xa.js} +585 -471
  53. package/dist/cli/{index-2fq4a3vk.js → index-znf683sm.js} +1 -1
  54. package/dist/cli/{index-v3ybemb1.js → index-zpzvpybn.js} +2 -2
  55. package/dist/cli/index.js +33 -32
  56. package/dist/cli/{knowledge-escalator-f80n84ch.js → knowledge-escalator-3q2x34cg.js} +14 -13
  57. package/dist/cli/{knowledge-events-1d7v2krw.js → knowledge-events-5y34w84b.js} +12 -11
  58. package/dist/cli/{knowledge-link-vm4caewt.js → knowledge-link-xezm8hr3.js} +5 -5
  59. package/dist/cli/{knowledge-store-66yxeet7.js → knowledge-store-fqv89q5k.js} +6 -6
  60. package/dist/cli/{knowledge-validator-p0xcx7jx.js → knowledge-validator-fsdx14tk.js} +8 -8
  61. package/dist/cli/{model-preflight-w85ecyxh.js → model-preflight-yqqchzjn.js} +1 -1
  62. package/dist/cli/{pending-delegations-vad1z71d.js → pending-delegations-6ae7wy5q.js} +7 -3
  63. package/dist/cli/{pr-review-reentry-authorization-kn3nny7h.js → pr-review-reentry-authorization-986tk381.js} +35 -33
  64. package/dist/cli/{pr-subscriptions-482gzvt6.js → pr-subscriptions-asjevc5p.js} +5 -4
  65. package/dist/cli/{runner-sn7a6zd0.js → runner-wsdcy2d6.js} +6 -6
  66. package/dist/cli/{scan-cursor-2v7995nb.js → scan-cursor-shn926r6.js} +7 -7
  67. package/dist/cli/{schema-dy8fqycb.js → schema-98tdb9h0.js} +4 -2
  68. package/dist/cli/{scope-persistence-baty62vx.js → scope-persistence-cn34xnwr.js} +10 -9
  69. package/dist/cli/{skill-generator-nwrvtqbz.js → skill-generator-kck7087c.js} +16 -15
  70. package/dist/cli/{telemetry-3rh94wv3.js → telemetry-gpr9s3sm.js} +3 -1
  71. package/dist/cli/{worktree-collision-ownership-cy24p5mr.js → worktree-collision-ownership-6b3kshcv.js} +6 -5
  72. package/dist/cli/{worktree-isolation-8jbx0s8d.js → worktree-isolation-he01qhss.js} +33 -32
  73. package/dist/config/constants.d.ts +8 -0
  74. package/dist/config/context-window.d.ts +11 -4
  75. package/dist/config/evidence-schema.d.ts +9 -6
  76. package/dist/config/schema.d.ts +8 -0
  77. package/dist/context-map/telemetry.d.ts +1 -1
  78. package/dist/health/learning-health.d.ts +356 -0
  79. package/dist/hooks/context-budget.d.ts +10 -1
  80. package/dist/hooks/curator.d.ts +2 -0
  81. package/dist/hooks/final-context-accounting.d.ts +2 -0
  82. package/dist/hooks/model-limits.d.ts +56 -25
  83. package/dist/hooks/pr-workflow-gate.d.ts +25 -1
  84. package/dist/hooks/skill-usage-pending.d.ts +1 -1
  85. package/dist/index.js +623 -609
  86. package/dist/observability/catalog.d.ts +2 -2
  87. package/dist/observability/ids.d.ts +17 -0
  88. package/dist/prm/trajectory-store.d.ts +1 -1
  89. package/dist/services/diagnose-service.d.ts +7 -0
  90. package/dist/services/status-service.d.ts +18 -0
  91. package/dist/telemetry.d.ts +52 -1
  92. package/dist/tools/context-status.d.ts +15 -1
  93. package/dist/tools/dispatch-lanes.d.ts +27 -3
  94. package/dist/tools/index.d.ts +1 -0
  95. package/dist/tools/manifest.d.ts +1 -0
  96. package/dist/tools/repo-graph/ontology.d.ts +6 -0
  97. package/dist/tools/repo-graph/pack-query.d.ts +36 -0
  98. package/dist/tools/repo-graph/types.d.ts +198 -1
  99. package/dist/tools/repo-graph.d.ts +5 -3
  100. package/dist/tools/sast-baseline.d.ts +2 -0
  101. package/dist/tools/sast-scan.d.ts +2 -2
  102. package/dist/tools/submit-pr-review-result.d.ts +5 -0
  103. package/dist/tools/tool-metadata.d.ts +8 -0
  104. package/opencode-swarm.schema.json +4 -0
  105. package/package.json +1 -1
  106. package/dist/cli/curator-llm-factory-pyp5kmra.js +0 -66
  107. package/dist/cli/guardrail-explain-a13kbmrt.js +0 -67
@@ -6,7 +6,7 @@ import {
6
6
  resolveExecutableFromPath,
7
7
  runEvaluation,
8
8
  runExternalTool
9
- } from "./index-xs32znyz.js";
9
+ } from "./index-j3ss86kf.js";
10
10
  import {
11
11
  finalizeShellAuditForClose,
12
12
  isPolicyProtectedPath,
@@ -15,13 +15,13 @@ import {
15
15
  protectedRoots,
16
16
  redactDecisionLineForArchive,
17
17
  stableCanonicalStringify
18
- } from "./index-8zw60wya.js";
18
+ } from "./index-m84z3aa8.js";
19
19
  import {
20
20
  detectStraySwarmDirs,
21
21
  readDoctorArtifact,
22
22
  removeStraySwarmDir,
23
23
  runConfigDoctor
24
- } from "./index-6jp5yxye.js";
24
+ } from "./index-f72612zc.js";
25
25
  import {
26
26
  MAX_TRANSIENT_RETRIES,
27
27
  archiveEvidence,
@@ -68,7 +68,7 @@ import {
68
68
  validateProjectRoot,
69
69
  validateSymlinkBoundary,
70
70
  validateTargetWithinRoot
71
- } from "./index-wwpe4am7.js";
71
+ } from "./index-m1cw9fsh.js";
72
72
  import {
73
73
  EvaluationTaskV1Schema,
74
74
  GateAuditManifestV1Schema,
@@ -85,7 +85,7 @@ import {
85
85
  saveGateAuditResult,
86
86
  savePromotionDecision,
87
87
  saveTaskSetSnapshot
88
- } from "./index-gk6gpe7r.js";
88
+ } from "./index-nk498mx6.js";
89
89
  import {
90
90
  canonicalHash,
91
91
  canonicalJson,
@@ -129,15 +129,15 @@ import {
129
129
  retireSkill,
130
130
  selectCandidateEntries,
131
131
  syncBundledProjectSkillsIfMissingAsync
132
- } from "./index-xqjhbfbx.js";
132
+ } from "./index-v8dsmee1.js";
133
133
  import {
134
134
  readRecentEscalations
135
- } from "./index-fnxmg8sz.js";
135
+ } from "./index-ny0g8fdg.js";
136
136
  import {
137
137
  alreadyCuratedThisGeneration,
138
138
  claimNextScanBatch,
139
139
  resolveCohortId
140
- } from "./index-m9m3emns.js";
140
+ } from "./index-7v0ex0jt.js";
141
141
  import {
142
142
  CURATOR_INIT_PROMPT,
143
143
  CURATOR_PHASE_PROMPT,
@@ -161,7 +161,7 @@ import {
161
161
  listActive,
162
162
  subscribe,
163
163
  unsubscribe
164
- } from "./index-515nwvdp.js";
164
+ } from "./index-497a3hhj.js";
165
165
  import {
166
166
  clearWorktreeMergeStatus,
167
167
  getAllWorktreeMergeFailures,
@@ -173,7 +173,7 @@ import {
173
173
  listCoderSettlementWalStates,
174
174
  recoverCoderSettlement,
175
175
  recoverStaleCoderSettlements
176
- } from "./index-nvz4mp5w.js";
176
+ } from "./index-dq93ar40.js";
177
177
  import {
178
178
  parsePorcelainV2Snapshot,
179
179
  resolveCommitCountSince,
@@ -206,7 +206,7 @@ import {
206
206
  WORKTREE_LIFECYCLE_LOCK_FILE,
207
207
  recordWorktreeProvisioningOwner,
208
208
  removeWorktreeProvisioningOwner
209
- } from "./index-8fyebh3w.js";
209
+ } from "./index-awjx0wgk.js";
210
210
  import {
211
211
  appendUnactionable,
212
212
  quarantineEntry,
@@ -217,11 +217,11 @@ import {
217
217
  validateActionableFields,
218
218
  validateLesson,
219
219
  validateSkillPath
220
- } from "./index-p3ym3y8b.js";
220
+ } from "./index-jszabr0r.js";
221
221
  import {
222
222
  authorizeCuration,
223
223
  buildConfigFingerprintInput
224
- } from "./index-2fq4a3vk.js";
224
+ } from "./index-znf683sm.js";
225
225
  import {
226
226
  cohortConfigFingerprint
227
227
  } from "./index-rtry5xyf.js";
@@ -252,27 +252,40 @@ import {
252
252
  transitionTaskWorkflowEvidence,
253
253
  withTaskEvidenceTransaction,
254
254
  writeWorkflowWalFile
255
- } from "./index-rq4jcw64.js";
255
+ } from "./index-z0bxbb9g.js";
256
256
  import {
257
257
  makeWorktreeBranchName,
258
258
  provisionWorktree,
259
259
  removeWorktree
260
- } from "./index-mqfs5f8a.js";
260
+ } from "./index-qc53dfzh.js";
261
261
  import {
262
262
  DEFAULT_STALE_DELEGATION_TIMEOUT_MS,
263
263
  DELEGATION_COMPACTION_HIGH_WATER_BYTES,
264
264
  DELEGATION_COMPACTION_LOW_WATER_BYTES,
265
265
  MAX_PR_REVIEW_COLLECTION_RECEIPT_ITEM_IDS,
266
266
  MAX_RECOVERY_LEDGER_BYTES,
267
+ PR_REVIEW_BASE_DIMENSION_IDS,
268
+ PR_REVIEW_DISCARDED_EXAMPLE_ITEM_ID,
269
+ PR_REVIEW_FINDINGS_MAX_BYTES,
270
+ PR_REVIEW_HANDOFF_MAX_BYTES,
271
+ PR_REVIEW_RISK_IMPACTS,
272
+ PR_REVIEW_RISK_TAGS,
273
+ PrReviewCriticVerdictFieldsSchema,
274
+ PrReviewResultReceiptSchema,
275
+ PrReviewReviewerVerdictFieldsSchema,
267
276
  collectDelegationLedgerHealth,
268
277
  findByBatchId,
269
278
  maintainBackgroundDelegations,
279
+ parsePrReviewRiskTagsField,
280
+ parsePrReviewVerdictRow,
281
+ prReviewFindingRequiresCritic,
282
+ prReviewLegacyTranscriptCompatibilityEnabled,
270
283
  readDelegationHealthArtifact,
271
284
  readDelegations,
272
285
  scanBackgroundCoderReservationsForAdmission,
273
286
  scanDelegationsForRecovery,
274
287
  sweepStaleDelegations
275
- } from "./index-h96xp4t0.js";
288
+ } from "./index-61c3d769.js";
276
289
  import {
277
290
  compositeSessionKey,
278
291
  sessionKeySuffix
@@ -283,7 +296,7 @@ import {
283
296
  clearAllScopes,
284
297
  clearScopeBindingFromDisk,
285
298
  clearScopeBindings
286
- } from "./index-zswy6xgb.js";
299
+ } from "./index-drqvph47.js";
287
300
  import {
288
301
  appendLedgerEvent,
289
302
  computePlanHash,
@@ -298,7 +311,7 @@ import {
298
311
  readPlanEpochIdentity,
299
312
  replayFromLedgerWithStatus,
300
313
  takeSnapshotEvent
301
- } from "./index-bxpqq9th.js";
314
+ } from "./index-pqjcyj0p.js";
302
315
  import {
303
316
  CORE_EVENT_LOCKED,
304
317
  appendCoreEventSync,
@@ -308,7 +321,7 @@ import {
308
321
  hasSpecDriftAuditEvent,
309
322
  hasTaskRepairAuditEvent,
310
323
  readCoreEvents
311
- } from "./index-0zerbq1v.js";
324
+ } from "./index-7h2armwf.js";
312
325
  import {
313
326
  sanitizeDiagnosticText
314
327
  } from "./index-556ja8an.js";
@@ -357,7 +370,7 @@ import {
357
370
  transactFile,
358
371
  transactKnowledge,
359
372
  wordBigrams
360
- } from "./index-2jzmg2km.js";
373
+ } from "./index-nnzdayvk.js";
361
374
  import {
362
375
  MAX_EVENT_LOG_ENTRIES,
363
376
  _internals as _internals2,
@@ -373,13 +386,13 @@ import {
373
386
  recordKnowledgeEvent,
374
387
  recordPhaseCloseIntent,
375
388
  resolveKnowledgeEventsPath
376
- } from "./index-5hfqc3h3.js";
389
+ } from "./index-98jmggma.js";
377
390
  import {
378
391
  resolveWorktreeIsolationConfig
379
- } from "./index-40t6s98s.js";
392
+ } from "./index-pkz91fwm.js";
380
393
  import {
381
394
  RetrospectiveEvidenceSchema
382
- } from "./index-ebz97mks.js";
395
+ } from "./index-8c9qzpy7.js";
383
396
  import {
384
397
  estimateTokens,
385
398
  readSwarmFileAsync,
@@ -399,7 +412,7 @@ import {
399
412
  init_loader,
400
413
  loadPluginConfig,
401
414
  loadPluginConfigWithMeta
402
- } from "./index-t3wk7q51.js";
415
+ } from "./index-bqxffayb.js";
403
416
  import {
404
417
  DEFAULT_HARNESS_EVOLUTION_CONFIG,
405
418
  DEFAULT_PR_REVIEW_RESILIENCE_CONFIG,
@@ -415,7 +428,7 @@ import {
415
428
  package_default,
416
429
  resolveAutoReviewConfig,
417
430
  stripKnownSwarmPrefix
418
- } from "./index-ebxmfr4j.js";
431
+ } from "./index-7npz9n4s.js";
419
432
  import {
420
433
  init_git_executable,
421
434
  resolveGitExecutable,
@@ -426,6 +439,12 @@ import {
426
439
  getDeferredWarnings,
427
440
  init_warning_buffer
428
441
  } from "./index-4rhhvd1a.js";
442
+ import {
443
+ observeCloseArchive,
444
+ observeCuratorCompliance,
445
+ observeStoreHealth,
446
+ readLearningHealth
447
+ } from "./index-mmr96pwr.js";
429
448
  import {
430
449
  AGENT_TOOL_MAP,
431
450
  ALL_AGENT_NAMES,
@@ -439,7 +458,7 @@ import {
439
458
  init_agent_names,
440
459
  init_constants,
441
460
  init_tool_metadata
442
- } from "./index-yt75r1er.js";
461
+ } from "./index-c9zp4xwc.js";
443
462
  import {
444
463
  resolveHiveDataDir,
445
464
  resolveHiveEventsPath,
@@ -455,22 +474,16 @@ import {
455
474
  resolveLinkDir,
456
475
  sanitizeLinkId,
457
476
  writeLinkPointer
458
- } from "./index-nhhek8yw.js";
477
+ } from "./index-prv20xq6.js";
459
478
  import {
460
479
  atomicWriteFile
461
- } from "./index-ve0xj03m.js";
480
+ } from "./index-7ezv5j23.js";
462
481
  import {
463
482
  KNOWLEDGE_SCHEMA_VERSION,
464
483
  OUTCOME_BLOCK_THRESHOLD,
465
484
  init_knowledge_types,
466
485
  isActiveStatus
467
486
  } from "./index-bk5tah7q.js";
468
- import {
469
- atomicWriteSwarmFile,
470
- atomicWriteSwarmFileSync,
471
- matchTempGrammar,
472
- parseTargetBasename
473
- } from "./index-9qw4sbg1.js";
474
487
  import {
475
488
  assertProjectRoot,
476
489
  hasExplicitProjectBoundary,
@@ -478,7 +491,13 @@ import {
478
491
  listActiveLocks,
479
492
  tryAcquireLock,
480
493
  withEvidenceLock
481
- } from "./index-av3gnekk.js";
494
+ } from "./index-b5adxpy6.js";
495
+ import {
496
+ atomicWriteSwarmFile,
497
+ atomicWriteSwarmFileSync,
498
+ matchTempGrammar,
499
+ parseTargetBasename
500
+ } from "./index-dh5q6z7y.js";
482
501
  import {
483
502
  invalidateCachedArtifact,
484
503
  resetSwarmArtifactCache
@@ -487,7 +506,7 @@ import {
487
506
  emit,
488
507
  getLastHeartbeat,
489
508
  telemetry
490
- } from "./index-prknc0xn.js";
509
+ } from "./index-dke4wzkn.js";
491
510
  import {
492
511
  require_proper_lockfile
493
512
  } from "./index-7g4c7s5r.js";
@@ -3561,9 +3580,17 @@ function buildSkillUsageHealthPayload(doc, trigger, gauges) {
3561
3580
  coverage: doc.coverage.complete
3562
3581
  };
3563
3582
  }
3564
- function emitSkillUsageHealth(doc, trigger, gauges) {
3583
+ function emitSkillUsageHealth(doc, trigger, gauges, directory) {
3565
3584
  try {
3566
- _internals7.emitHealth(buildSkillUsageHealthPayload(doc, trigger, gauges));
3585
+ const healthPayload = buildSkillUsageHealthPayload(doc, trigger, gauges);
3586
+ _internals7.emitHealth(healthPayload);
3587
+ if (directory) {
3588
+ observeStoreHealth({
3589
+ directory,
3590
+ kind: "skill_usage_health",
3591
+ payload: healthPayload
3592
+ });
3593
+ }
3567
3594
  } catch (err) {
3568
3595
  log("[skill-usage-pending] health emit failed (best-effort):", err instanceof Error ? err.message : String(err));
3569
3596
  }
@@ -4233,7 +4260,7 @@ function migrateLegacyLog(directory, doc) {
4233
4260
  emitSkillUsageHealth(doc, "migration", {
4234
4261
  bytes: queueByteSize(doc),
4235
4262
  limitBytes: SKILL_USAGE_LIMITS.queueMaxBytes
4236
- });
4263
+ }, directory);
4237
4264
  }
4238
4265
  function ensureMigrated(directory, doc) {
4239
4266
  if (!needsMigration(doc))
@@ -4365,7 +4392,7 @@ function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
4365
4392
  emitSkillUsageHealth(doc, "compaction", {
4366
4393
  bytes: content.length + (surviving.length > 0 ? 1 : 0),
4367
4394
  limitBytes: SKILL_USAGE_LIMITS.maxBytes
4368
- });
4395
+ }, directory);
4369
4396
  return { pruned: dropped, remaining: surviving.length };
4370
4397
  } finally {
4371
4398
  releaseSkillUsageLock(handle);
@@ -4480,7 +4507,7 @@ function commitFeedbackOutcomes(directory, commit) {
4480
4507
  emitSkillUsageHealth(doc, "consumption", {
4481
4508
  bytes: queueByteSize(doc),
4482
4509
  limitBytes: SKILL_USAGE_LIMITS.queueMaxBytes
4483
- });
4510
+ }, directory);
4484
4511
  } finally {
4485
4512
  releaseSkillUsageLock(handle);
4486
4513
  }
@@ -6280,11 +6307,17 @@ var _internals12 = {
6280
6307
  telemetry
6281
6308
  };
6282
6309
  var skippedLockAppends = 0;
6283
- function emitTrajectoryHealth(data) {
6310
+ function emitTrajectoryHealth(directory, data) {
6284
6311
  try {
6285
- _internals12.telemetry.trajectoryHealth({
6312
+ const healthPayload = {
6286
6313
  ...data,
6287
6314
  skipped_lock_count: skippedLockAppends
6315
+ };
6316
+ _internals12.telemetry.trajectoryHealth(healthPayload);
6317
+ observeStoreHealth({
6318
+ directory,
6319
+ kind: "trajectory_health",
6320
+ payload: healthPayload
6288
6321
  });
6289
6322
  } catch {}
6290
6323
  }
@@ -6520,7 +6553,7 @@ async function cleanupOldTrajectoryFiles(directory, maxAgeDays = TRAJECTORY_LIMI
6520
6553
  } catch {}
6521
6554
  }
6522
6555
  if (removed > 0) {
6523
- emitTrajectoryHealth({
6556
+ emitTrajectoryHealth(directory, {
6524
6557
  trigger: "cleanup",
6525
6558
  retained_count: retained,
6526
6559
  dropped_count: removed,
@@ -6924,355 +6957,6 @@ import { readFileSync as readFileSync5, statSync as statSync5 } from "fs";
6924
6957
  import * as fsp2 from "fs/promises";
6925
6958
  import * as path12 from "path";
6926
6959
 
6927
- // src/background/pr-review-contract.ts
6928
- init_zod();
6929
- var PR_REVIEW_REVIEWER_CLASSIFICATIONS = [
6930
- "CONFIRMED",
6931
- "DISPROVED",
6932
- "UNVERIFIED",
6933
- "PRE_EXISTING"
6934
- ];
6935
- var PR_REVIEW_REVIEWER_EVIDENCE_TYPES = [
6936
- "STRUCTURALLY_PROVEN",
6937
- "EXECUTION_PROVEN",
6938
- "STATIC_TRACE_PROVEN",
6939
- "PLAUSIBLE_BUT_UNVERIFIED"
6940
- ];
6941
- var PR_REVIEW_SEVERITIES = [
6942
- "CRITICAL",
6943
- "HIGH",
6944
- "MEDIUM",
6945
- "LOW",
6946
- "INFO",
6947
- "NONE"
6948
- ];
6949
- var PR_REVIEW_CRITIC_STATUSES = [
6950
- "UPHELD",
6951
- "DOWNGRADED",
6952
- "DISPROVED",
6953
- "NEEDS_MORE_EVIDENCE"
6954
- ];
6955
- var PR_REVIEW_FINDING_STATUSES = [
6956
- "PENDING",
6957
- "CONFIRMED",
6958
- "DISPROVED",
6959
- "PRE_EXISTING"
6960
- ];
6961
- var PR_REVIEW_FINDING_ACTIONS = [
6962
- "route_to_reviewer",
6963
- "route_to_critic",
6964
- "report",
6965
- "suppress_with_reason",
6966
- "handoff_to_feedback"
6967
- ];
6968
- var PR_REVIEW_ARTIFACT_BOUNDARIES = [
6969
- "post_explorer",
6970
- "post_reviewer",
6971
- "post_critic"
6972
- ];
6973
- var PR_REVIEW_BASE_DIMENSION_IDS = [
6974
- "intent-architecture",
6975
- "correctness-state",
6976
- "tests-falsifiability",
6977
- "security-trust",
6978
- "reliability-performance",
6979
- "compatibility-delivery"
6980
- ];
6981
- var PR_REVIEW_RISK_IMPACTS = [
6982
- "ORDINARY",
6983
- "HIGH_IMPACT",
6984
- "UNKNOWN"
6985
- ];
6986
- var PR_REVIEW_RISK_TAGS = [
6987
- "SECURITY",
6988
- "AUTH_PERMISSIONS",
6989
- "STATE_INTEGRITY",
6990
- "WRITE_PATH",
6991
- "EVIDENCE_INTEGRITY",
6992
- "GIT",
6993
- "CONFIGURATION"
6994
- ];
6995
- var PR_REVIEW_FINDINGS_MAX_BYTES = 10 * 1024 * 1024;
6996
- var PR_REVIEW_FINDINGS_WRITE_MAX_BYTES = 3 * 1024 * 1024;
6997
- var PR_REVIEW_HANDOFF_MAX_BYTES = 128 * 1024;
6998
- var PR_REVIEW_HANDOFF_WRITE_MAX_BYTES = 120 * 1024;
6999
- var PR_REVIEW_DISCARDED_EXAMPLE_ITEM_ID = "discarded-id";
7000
- function serializedPrReviewArtifactInputBytes(value) {
7001
- return new TextEncoder().encode(JSON.stringify(value)).byteLength;
7002
- }
7003
- var PrReviewRunIdSchema = exports_external.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/, "run_id must be a safe relative identifier");
7004
- var PrReviewFindingSchema = exports_external.object({
7005
- finding_id: exports_external.string().trim().min(1).max(128),
7006
- status: exports_external.enum(PR_REVIEW_FINDING_STATUSES),
7007
- file_line: exports_external.string().trim().min(1).max(1000),
7008
- evidence: exports_external.string().trim().min(1).max(20000),
7009
- next_action: exports_external.enum(PR_REVIEW_FINDING_ACTIONS),
7010
- severity: exports_external.enum(PR_REVIEW_SEVERITIES).optional(),
7011
- category: exports_external.string().trim().min(1).max(128).optional(),
7012
- risk_impact: exports_external.enum(PR_REVIEW_RISK_IMPACTS).optional(),
7013
- risk_tags: exports_external.array(exports_external.enum(PR_REVIEW_RISK_TAGS)).max(PR_REVIEW_RISK_TAGS.length).optional()
7014
- }).strict().superRefine((value, ctx) => {
7015
- if (value.status !== "CONFIRMED")
7016
- return;
7017
- if (value.risk_impact === undefined) {
7018
- ctx.addIssue({
7019
- code: "custom",
7020
- path: ["risk_impact"],
7021
- message: "is required on every newly written CONFIRMED finding (issue #2383 typed critic routing)"
7022
- });
7023
- }
7024
- if (value.risk_tags === undefined) {
7025
- ctx.addIssue({
7026
- code: "custom",
7027
- path: ["risk_tags"],
7028
- message: "is required on every newly written CONFIRMED finding (issue #2383 typed critic routing)"
7029
- });
7030
- }
7031
- });
7032
- function prReviewFindingRequiresCritic(input) {
7033
- if (input.classification !== "CONFIRMED")
7034
- return false;
7035
- const impact = input.risk_impact ?? "UNKNOWN";
7036
- const tags = input.risk_tags ?? [];
7037
- if (impact === "UNKNOWN")
7038
- return true;
7039
- if (input.severity === undefined)
7040
- return true;
7041
- if (input.severity === "CRITICAL" || input.severity === "HIGH")
7042
- return true;
7043
- if (input.severity === "MEDIUM") {
7044
- return impact === "HIGH_IMPACT" || tags.length > 0;
7045
- }
7046
- return false;
7047
- }
7048
- var PrReviewHandoffSchema = exports_external.object({
7049
- pr_url: exports_external.string().url().max(2000),
7050
- finding_ids: exports_external.array(exports_external.string().trim().min(1).max(128)).min(1).max(1000),
7051
- summary: exports_external.string().trim().min(1).max(20000),
7052
- provenance: exports_external.array(exports_external.string().trim().min(1).max(4000)).min(1).max(1000)
7053
- }).strict();
7054
- var PrReviewPartialBaseCoverageSchema = exports_external.object({
7055
- unresolved_dimensions: exports_external.array(exports_external.enum(PR_REVIEW_BASE_DIMENSION_IDS)).min(1).max(PR_REVIEW_BASE_DIMENSION_IDS.length)
7056
- }).strict().superRefine((value, ctx) => {
7057
- const seen = new Set;
7058
- for (const dimension of value.unresolved_dimensions) {
7059
- if (seen.has(dimension)) {
7060
- ctx.addIssue({
7061
- code: "custom",
7062
- path: ["unresolved_dimensions"],
7063
- message: `must not contain duplicate dimension "${dimension}"`
7064
- });
7065
- return;
7066
- }
7067
- seen.add(dimension);
7068
- }
7069
- });
7070
- var WritePrReviewArtifactArgsSchema = exports_external.discriminatedUnion("kind", [
7071
- exports_external.object({
7072
- kind: exports_external.literal("findings"),
7073
- run_id: PrReviewRunIdSchema.optional(),
7074
- pr_head_sha: exports_external.string().trim().regex(/^[0-9a-f]{6,64}$/i),
7075
- boundary: exports_external.enum(PR_REVIEW_ARTIFACT_BOUNDARIES),
7076
- records: exports_external.array(PrReviewFindingSchema).min(1).max(1000),
7077
- partial_base_coverage: PrReviewPartialBaseCoverageSchema.optional()
7078
- }).strict(),
7079
- exports_external.object({
7080
- kind: exports_external.literal("handoff"),
7081
- run_id: PrReviewRunIdSchema.optional(),
7082
- pr_head_sha: exports_external.string().trim().regex(/^[0-9a-f]{6,64}$/i),
7083
- handoff: PrReviewHandoffSchema
7084
- }).strict()
7085
- ]).superRefine((value, ctx) => {
7086
- if (value.kind === "findings" && value.partial_base_coverage !== undefined && value.boundary !== "post_explorer") {
7087
- ctx.addIssue({
7088
- code: "custom",
7089
- path: ["partial_base_coverage"],
7090
- message: "is valid only for the post_explorer boundary"
7091
- });
7092
- }
7093
- const bytes = serializedPrReviewArtifactInputBytes(value);
7094
- const maxBytes = value.kind === "findings" ? PR_REVIEW_FINDINGS_WRITE_MAX_BYTES : PR_REVIEW_HANDOFF_WRITE_MAX_BYTES;
7095
- if (bytes > maxBytes) {
7096
- ctx.addIssue({
7097
- code: "custom",
7098
- path: [value.kind === "findings" ? "records" : "handoff"],
7099
- message: `serialized UTF-8 payload must be at most ${maxBytes} bytes (got ${bytes})`
7100
- });
7101
- }
7102
- });
7103
- var introducedByPrSchema = exports_external.string().regex(/^(?:introduced_by_pr\s*:\s*)?(?:YES|NO|UNKNOWN)$/i);
7104
- var PrReviewRiskTagsFieldPattern = new RegExp(`^(?:(?:${PR_REVIEW_RISK_TAGS.join("|")})(?:,(?:${PR_REVIEW_RISK_TAGS.join("|")}))*)?$`);
7105
- var PrReviewRiskTagsFieldSchema = exports_external.string().regex(PrReviewRiskTagsFieldPattern, `must be a comma-separated subset of the canonical risk tags (${PR_REVIEW_RISK_TAGS.join(", ")}), or empty`);
7106
- var PR_REVIEW_REVIEWER_LEGACY_FIELD_COUNT = 10;
7107
- function parsePrReviewRiskTagsField(field) {
7108
- const trimmed = field.trim();
7109
- if (!trimmed)
7110
- return [];
7111
- return trimmed.split(",").map((tag) => tag.trim());
7112
- }
7113
- var PrReviewReviewerVerdictFieldsSchema = exports_external.tuple([
7114
- exports_external.literal("[REVIEWED]"),
7115
- exports_external.string().min(1),
7116
- exports_external.enum(PR_REVIEW_REVIEWER_CLASSIFICATIONS),
7117
- exports_external.enum(PR_REVIEW_REVIEWER_EVIDENCE_TYPES),
7118
- exports_external.enum(PR_REVIEW_SEVERITIES),
7119
- introducedByPrSchema,
7120
- exports_external.string().min(1),
7121
- exports_external.string().min(8),
7122
- exports_external.string().min(5),
7123
- exports_external.string().min(3),
7124
- exports_external.enum(PR_REVIEW_RISK_IMPACTS),
7125
- PrReviewRiskTagsFieldSchema
7126
- ]).superRefine((fields, ctx) => {
7127
- if (fields[2] === "DISPROVED" && fields[4] !== "NONE") {
7128
- ctx.addIssue({
7129
- code: "custom",
7130
- path: [4],
7131
- message: "DISPROVED reviewer severity must be NONE"
7132
- });
7133
- }
7134
- });
7135
- var PrReviewCriticVerdictFieldsSchema = exports_external.tuple([
7136
- exports_external.literal("[CRITIC]"),
7137
- exports_external.string().min(1),
7138
- exports_external.enum(PR_REVIEW_CRITIC_STATUSES),
7139
- exports_external.enum(PR_REVIEW_SEVERITIES),
7140
- exports_external.string().min(6),
7141
- exports_external.string().min(6)
7142
- ]).superRefine((fields, ctx) => {
7143
- const status = fields[2];
7144
- const severity = fields[3];
7145
- if (status === "NEEDS_MORE_EVIDENCE") {
7146
- ctx.addIssue({
7147
- code: "custom",
7148
- path: [2],
7149
- message: "NEEDS_MORE_EVIDENCE is not a terminal transport verdict"
7150
- });
7151
- }
7152
- if (status === "DISPROVED" && severity !== "NONE") {
7153
- ctx.addIssue({
7154
- code: "custom",
7155
- path: [3],
7156
- message: "DISPROVED critic severity must be NONE"
7157
- });
7158
- }
7159
- if (status === "UPHELD" && !["CRITICAL", "HIGH", "MEDIUM"].includes(severity)) {
7160
- ctx.addIssue({
7161
- code: "custom",
7162
- path: [3],
7163
- message: "UPHELD critic severity must be CRITICAL, HIGH, or MEDIUM"
7164
- });
7165
- }
7166
- if (status === "DOWNGRADED" && severity === "CRITICAL") {
7167
- ctx.addIssue({
7168
- code: "custom",
7169
- path: [3],
7170
- message: "DOWNGRADED critic severity cannot be CRITICAL"
7171
- });
7172
- }
7173
- });
7174
- var PR_REVIEW_VERDICT_ROW_DESCRIPTORS = {
7175
- reviewer: {
7176
- marker: "[REVIEWED]",
7177
- fieldCount: 12,
7178
- fieldRoles: [
7179
- "marker",
7180
- "item_id",
7181
- "classification",
7182
- "evidence_type",
7183
- "severity",
7184
- "introduced_by_pr",
7185
- "file:line",
7186
- "rationale",
7187
- "probe",
7188
- "reviewer_notes",
7189
- "risk_impact",
7190
- "risk_tags"
7191
- ],
7192
- schema: PrReviewReviewerVerdictFieldsSchema
7193
- },
7194
- critic: {
7195
- marker: "[CRITIC]",
7196
- fieldCount: 6,
7197
- fieldRoles: [
7198
- "marker",
7199
- "item_id",
7200
- "status",
7201
- "severity",
7202
- "rationale",
7203
- "required_change"
7204
- ],
7205
- schema: PrReviewCriticVerdictFieldsSchema
7206
- }
7207
- };
7208
- function parsePrReviewVerdictRow(line, kind) {
7209
- const descriptor = PR_REVIEW_VERDICT_ROW_DESCRIPTORS[kind];
7210
- const fields = [];
7211
- let current = "";
7212
- let usedCanonicalEscape = false;
7213
- for (let index = 0;index < line.length; index++) {
7214
- const char = line[index];
7215
- if (char === "\\") {
7216
- const next = line[index + 1];
7217
- if (next === "\\") {
7218
- current += "\\";
7219
- usedCanonicalEscape = true;
7220
- index++;
7221
- continue;
7222
- }
7223
- if (next === "|") {
7224
- current += "|";
7225
- usedCanonicalEscape = true;
7226
- index++;
7227
- continue;
7228
- }
7229
- if (next === "n") {
7230
- current += `
7231
- `;
7232
- usedCanonicalEscape = true;
7233
- index++;
7234
- continue;
7235
- }
7236
- if (next === "r") {
7237
- current += "\r";
7238
- usedCanonicalEscape = true;
7239
- index++;
7240
- continue;
7241
- }
7242
- current += "\\";
7243
- continue;
7244
- }
7245
- if (char === "|") {
7246
- fields.push(current.trim());
7247
- current = "";
7248
- continue;
7249
- }
7250
- current += char;
7251
- }
7252
- fields.push(current.trim());
7253
- if (fields[0] !== descriptor.marker)
7254
- return null;
7255
- if (kind === "reviewer" && fields.length === PR_REVIEW_REVIEWER_LEGACY_FIELD_COUNT) {
7256
- fields.push("UNKNOWN", "");
7257
- }
7258
- if (fields.length > descriptor.fieldCount) {
7259
- const retained = fields.slice(0, descriptor.fieldCount - 1);
7260
- retained.push(fields.slice(descriptor.fieldCount - 1).join("|"));
7261
- return {
7262
- marker: descriptor.marker,
7263
- fields: retained,
7264
- recoveredOverflow: true,
7265
- overflowClass: fields.length === descriptor.fieldCount + 1 && fields[fields.length - 1] === "" ? "legacy-fidelity-safe" : "legacy-lossy"
7266
- };
7267
- }
7268
- return {
7269
- marker: descriptor.marker,
7270
- fields,
7271
- recoveredOverflow: false,
7272
- overflowClass: fields.length === descriptor.fieldCount ? usedCanonicalEscape ? "canonical" : "legacy-fidelity-safe" : "legacy-lossy"
7273
- };
7274
- }
7275
-
7276
6960
  // src/background/candidate-contract.ts
7277
6961
  var CANDIDATE_SEVERITIES = [
7278
6962
  "INFO",
@@ -9441,6 +9125,7 @@ var MAX_PUBLICATION_HISTORY_GENERATIONS = 4;
9441
9125
  var MAX_PUBLICATION_ATTEMPTS = 8;
9442
9126
  var MAX_PUSH_ATTEMPT_DIAGNOSTIC_CHARS = 500;
9443
9127
  var PUBLICATION_SCHEMA_VERSION = 1;
9128
+ var PUBLICATION_URL_CREDENTIALS_PATTERN = /\b([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)[^\s/@:]+:[^\s/@]+@/g;
9444
9129
  var GATE_SCHEMA_VERSION = 1;
9445
9130
  var MAX_TRACKED_SESSIONS3 = 200;
9446
9131
  var MAX_WORKFLOW_BATCHES = 128;
@@ -10449,7 +10134,7 @@ function summarizePrReviewBaseDimensionAttempts(directory, state, revisionDigest
10449
10134
  if (batchSuccessful.has(dimension))
10450
10135
  dedicatedSuccessful.add(dimension);
10451
10136
  }
10452
- const semanticallyValidLaneIds = new Set(recordsPassingBatchIntegrity(directory, state, batch.batchId, batch.lanes, "swarm-pr-review:base", batch.validatedAt).filter((qualified) => hasRevisionIndependentDiscoverySemantics(directory, qualified)).map((qualified) => qualified.record.laneId));
10137
+ const semanticallyValidLaneIds = new Set(recordsPassingBatchIntegrity(directory, state, batch.batchId, batch.lanes, "swarm-pr-review:base", batch.validatedAt).filter((qualified) => hasRevisionIndependentDiscoverySemantics(directory, qualified, state)).map((qualified) => qualified.record.laneId));
10453
10138
  const records = findByBatchId(directory, batch.batchId, {
10454
10139
  parentSessionId: state.sessionID
10455
10140
  });
@@ -10483,7 +10168,7 @@ function summarizePrReviewBaseDimensionAttempts(directory, state, revisionDigest
10483
10168
  terminallyFailed
10484
10169
  };
10485
10170
  }
10486
- function hasRevisionIndependentDiscoverySemantics(directory, qualified) {
10171
+ function hasRevisionIndependentDiscoverySemantics(directory, qualified, state) {
10487
10172
  const ref = qualified.record.result?.outputRef?.trim();
10488
10173
  if (!ref)
10489
10174
  return false;
@@ -10498,10 +10183,13 @@ function hasRevisionIndependentDiscoverySemantics(directory, qualified) {
10498
10183
  mode: "swarm-pr-review:base",
10499
10184
  workflowLane: qualified.expectedWorkflowLane,
10500
10185
  ownedWorkflowLanes: qualified.expectedOwnedLanes,
10501
- prHeadSha: qualified.record.workspace?.prHeadSha ?? "",
10502
- gitHead: qualified.record.workspace?.gitHead ?? "",
10186
+ prHeadSha: state.prHeadSha ?? "",
10187
+ gitHead: state.prHeadSha ?? "",
10503
10188
  revisionDigest: artifact.revisionDigest,
10504
- reviewScope: qualified.record.workspace?.scope ?? undefined
10189
+ workflowInstanceId: state.workflowInstanceId,
10190
+ workflowRevision: state.revision,
10191
+ baseSha: state.prReviewBaseSha,
10192
+ reviewScope: state.prReviewBaseSha && state.prHeadSha ? `complete PR diff ${state.prReviewBaseSha}...${state.prHeadSha}` : undefined
10505
10193
  }
10506
10194
  }).ok;
10507
10195
  }
@@ -10535,6 +10223,86 @@ function latestTypedFailureForBaseDimension(directory, state, dimension) {
10535
10223
  }
10536
10224
  return latest;
10537
10225
  }
10226
+ function failureClassFromStructuredUnresolvedReason(reason) {
10227
+ switch (reason) {
10228
+ case "RESOURCE_LIMIT":
10229
+ return "resource";
10230
+ case "DEADLINE_EXCEEDED":
10231
+ return "deadline";
10232
+ default:
10233
+ return "contract";
10234
+ }
10235
+ }
10236
+ function safeDetailFromStructuredUnresolvedReason(reason) {
10237
+ switch (reason) {
10238
+ case "NOT_EXECUTED":
10239
+ return "structured receipt reported this lane was never executed";
10240
+ case "PARTIAL_OUTPUT":
10241
+ return "structured receipt reported partial output that could not settle this lane";
10242
+ case "CONTRACT_FAILURE":
10243
+ return "structured receipt reported contract-invalid output for this lane";
10244
+ case "RESOURCE_LIMIT":
10245
+ return "structured receipt reported the lane exhausted its resource budget";
10246
+ case "DEADLINE_EXCEEDED":
10247
+ return "structured receipt reported the lane exceeded its collection deadline";
10248
+ case "STALE_BINDING":
10249
+ return "structured receipt reported stale workflow binding for this lane";
10250
+ case "PARENT_CANCELLED":
10251
+ return "structured receipt reported parent-side cancellation before settlement";
10252
+ }
10253
+ }
10254
+ function latestStructuredReceiptUnresolvedForBaseDimension(directory, state, revisionDigest, dimension) {
10255
+ let latest = null;
10256
+ const reviewScope = state.prReviewBaseSha && state.prHeadSha ? `complete PR diff ${state.prReviewBaseSha}...${state.prHeadSha}` : undefined;
10257
+ for (const batch of state.prReviewBaseDispatches ?? []) {
10258
+ const records = findByBatchId(directory, batch.batchId, {
10259
+ parentSessionId: state.sessionID
10260
+ });
10261
+ for (const lane of batch.lanes) {
10262
+ const ownedWorkflowLanes = lane.ownedWorkflowLanes?.length ? lane.ownedWorkflowLanes : [lane.workflowLane];
10263
+ if (!ownedWorkflowLanes.includes(dimension))
10264
+ continue;
10265
+ for (const record of records.filter((candidate) => candidate.laneId === lane.laneId)) {
10266
+ const result = record.result;
10267
+ if (!result)
10268
+ continue;
10269
+ const structured = validateExactStructuredReceiptCoverage({
10270
+ record,
10271
+ result,
10272
+ artifact: null,
10273
+ expected: {
10274
+ mode: "swarm-pr-review:base",
10275
+ workflowLane: lane.workflowLane,
10276
+ ownedWorkflowLanes,
10277
+ prHeadSha: state.prHeadSha ?? "",
10278
+ gitHead: state.prHeadSha ?? "",
10279
+ revisionDigest,
10280
+ workflowInstanceId: state.workflowInstanceId,
10281
+ workflowRevision: state.revision,
10282
+ baseSha: state.prReviewBaseSha,
10283
+ reviewScope
10284
+ }
10285
+ });
10286
+ if (structured.status !== "accepted")
10287
+ continue;
10288
+ const unresolved = structured.receipt.envelope.unresolved.find((entry) => entry.workflowLane === dimension);
10289
+ if (!unresolved)
10290
+ continue;
10291
+ const candidate = {
10292
+ failureClass: failureClassFromStructuredUnresolvedReason(unresolved.reason),
10293
+ recordedAt: record.updatedAt,
10294
+ batchId: batch.batchId,
10295
+ laneId: lane.laneId,
10296
+ safeDetail: safeDetailFromStructuredUnresolvedReason(unresolved.reason)
10297
+ };
10298
+ if (latest === null || candidate.recordedAt > latest.recordedAt || candidate.recordedAt === latest.recordedAt && `${candidate.batchId}\x00${candidate.laneId}`.localeCompare(`${latest.batchId}\x00${latest.laneId}`) > 0) {
10299
+ latest = candidate;
10300
+ }
10301
+ }
10302
+ }
10303
+ }
10304
+ return latest;
10305
+ }
10538
10306
  var MAX_COVER_UNIVERSE_BITS = 12;
10539
10307
  function minimumConsolidatedLaneCover(sets) {
10540
10308
  const bitOf = new Map;
@@ -10627,16 +10395,18 @@ function derivePrReviewDimensionSettlement(directory, state, revisionDigest) {
10627
10395
  continue;
10628
10396
  }
10629
10397
  const latestFailure = latestTypedFailureForBaseDimension(directory, state, dimension);
10630
- if (attempts.terminallyFailed.has(dimension)) {
10398
+ const latestStructuredUnresolved = latestStructuredReceiptUnresolvedForBaseDimension(directory, state, revisionDigest, dimension);
10399
+ if (attempts.terminallyFailed.has(dimension) || latestStructuredUnresolved) {
10400
+ const unresolvedFailure = latestStructuredUnresolved && (!latestFailure || latestStructuredUnresolved.recordedAt >= latestFailure.recordedAt) ? latestStructuredUnresolved : latestFailure;
10631
10401
  unresolvedDimensions.push({
10632
10402
  dimension,
10633
10403
  terminalState: "FAILED",
10634
10404
  reasonKind: "lane_failure",
10635
- failureClass: latestFailure?.failureClass,
10636
- terminalEventId: latestFailure?.terminalEventId,
10637
- batchId: latestFailure?.batchId,
10638
- laneId: latestFailure?.laneId,
10639
- safeDetail: latestFailure ? PR_REVIEW_FAILURE_CLASS_SAFE_DETAILS[latestFailure.failureClass] : "lane terminated without a typed failure class"
10405
+ failureClass: unresolvedFailure?.failureClass,
10406
+ terminalEventId: unresolvedFailure && "terminalEventId" in unresolvedFailure ? unresolvedFailure.terminalEventId : undefined,
10407
+ batchId: unresolvedFailure?.batchId,
10408
+ laneId: unresolvedFailure?.laneId,
10409
+ safeDetail: unresolvedFailure && "safeDetail" in unresolvedFailure ? unresolvedFailure.safeDetail : unresolvedFailure ? PR_REVIEW_FAILURE_CLASS_SAFE_DETAILS[unresolvedFailure.failureClass] : "lane terminated without a typed failure class"
10640
10410
  });
10641
10411
  continue;
10642
10412
  }
@@ -10916,7 +10686,7 @@ function appendPublicationEvent(directory, event) {
10916
10686
  } catch {}
10917
10687
  }
10918
10688
  function boundPublicationDiagnostic(text) {
10919
- const redacted = redactSecrets(text);
10689
+ const redacted = redactSecrets(text).replace(PUBLICATION_URL_CREDENTIALS_PATTERN, "$1[REDACTED:url_credentials]@");
10920
10690
  return redacted.length > MAX_PUSH_ATTEMPT_DIAGNOSTIC_CHARS ? `${redacted.slice(0, MAX_PUSH_ATTEMPT_DIAGNOSTIC_CHARS - 3)}...` : redacted;
10921
10691
  }
10922
10692
  function nextPublicationContainer(previous, active, historyAppends = [], attempts = []) {
@@ -12124,6 +11894,7 @@ var _test_exports2 = {
12124
11894
  parseCanonicalCandidateRows,
12125
11895
  resolvePrReviewRowFamily,
12126
11896
  pipeFieldsCapped,
11897
+ boundPublicationDiagnostic,
12127
11898
  indexVerdictRows,
12128
11899
  reviewerVerdictRowDigest,
12129
11900
  workflowGateStateRelativePath,
@@ -12533,11 +12304,12 @@ function derivePrReviewCandidateInventory(directory, state, ctx) {
12533
12304
  const ownedDimensions = lane.ownedWorkflowLanes?.length ? lane.ownedWorkflowLanes : [lane.workflowLane];
12534
12305
  if (!laneIsInClass(ownedDimensions.length))
12535
12306
  continue;
12536
- if (!ownedDimensions.every((dimension) => successful.has(dimension)))
12307
+ const creditedDimensions = ownedDimensions.filter((dimension) => successful.has(dimension));
12308
+ if (creditedDimensions.length === 0)
12537
12309
  continue;
12538
12310
  const key = `${batch.batchId}\x00${lane.laneId}`;
12539
12311
  baseSourceFullOwnershipCount.set(key, ownedDimensions.length);
12540
- for (const dimension of ownedDimensions) {
12312
+ for (const dimension of creditedDimensions) {
12541
12313
  if (!baseDimensionSources.has(dimension)) {
12542
12314
  baseDimensionSources.set(dimension, {
12543
12315
  batchId: batch.batchId,
@@ -12630,6 +12402,27 @@ function derivePrReviewCandidateInventory(directory, state, ctx) {
12630
12402
  })) {
12631
12403
  if (record.laneId !== source.laneId || record.mode !== source.mode || record.workspace?.prHeadSha !== state.prHeadSha || record.workspace?.gitHead !== state.prHeadSha)
12632
12404
  continue;
12405
+ const structured = record.result?.prReviewResultReceipt;
12406
+ if (structured) {
12407
+ const credited = source.creditedLanes?.length ? structured.envelope.creditedLanes.filter((lane) => source.creditedLanes?.includes(lane)) : structured.envelope.creditedLanes;
12408
+ if (source.workflowLane && !credited.includes(source.workflowLane)) {
12409
+ continue;
12410
+ }
12411
+ resolvedArtifact = true;
12412
+ const laneKey2 = `${source.batchId}\x00${source.laneId}`;
12413
+ if (!extractedLaneKeys.has(laneKey2)) {
12414
+ extractedLaneKeys.add(laneKey2);
12415
+ for (const finding of structured.envelope.findings) {
12416
+ if (!credited.includes(finding.workflowLane))
12417
+ continue;
12418
+ candidateIds.push(finding.id);
12419
+ if (!candidateSeverities.has(finding.id)) {
12420
+ candidateSeverities.set(finding.id, finding.severity);
12421
+ }
12422
+ }
12423
+ }
12424
+ continue;
12425
+ }
12633
12426
  const ref = record.result?.outputRef?.trim();
12634
12427
  const artifact = ref ? readLaneOutput(directory, ref)?.artifact : undefined;
12635
12428
  const recordOwnedLanes = record.ownedWorkflowLanes?.length ? record.ownedWorkflowLanes : record.workflowLane ? [record.workflowLane] : undefined;
@@ -13079,6 +12872,35 @@ function recordsPassingBatchIntegrity(directory, state, batchId, expectedLanes,
13079
12872
  function successfulObligationsFromExactBatch(directory, state, batchId, expectedLanes, expectedMode, validatedAt, checkWorkflowLane = true, forbiddenSubagentSessionIds = new Set, expectedRevisionDigest, diagnostics, reviewerClaims) {
13080
12873
  const successful = new Set;
13081
12874
  for (const qualified of recordsPassingBatchIntegrity(directory, state, batchId, expectedLanes, expectedMode, validatedAt, checkWorkflowLane, forbiddenSubagentSessionIds, diagnostics)) {
12875
+ const structuredCoverage = validateExactStructuredReceiptCoverage({
12876
+ record: qualified.record,
12877
+ result: qualified.record.result,
12878
+ artifact: null,
12879
+ expected: {
12880
+ mode: expectedMode === "swarm-pr-review:base" || expectedMode === "swarm-pr-review:micro" ? expectedMode : "swarm-pr-review:base",
12881
+ workflowLane: qualified.expectedWorkflowLane,
12882
+ ownedWorkflowLanes: qualified.expectedOwnedLanes,
12883
+ prHeadSha: state.prHeadSha ?? "",
12884
+ gitHead: state.prHeadSha ?? "",
12885
+ revisionDigest: expectedRevisionDigest ?? "",
12886
+ workflowInstanceId: state.workflowInstanceId,
12887
+ workflowRevision: state.revision,
12888
+ baseSha: state.prReviewBaseSha,
12889
+ reviewScope: state.mode === "PR_REVIEW" && state.prReviewBaseSha && state.prHeadSha ? `complete PR diff ${state.prReviewBaseSha}...${state.prHeadSha}` : undefined
12890
+ }
12891
+ });
12892
+ if (structuredCoverage.status === "accepted") {
12893
+ for (const obligation of structuredCoverage.creditedWorkflowLanes) {
12894
+ successful.add(obligation);
12895
+ }
12896
+ continue;
12897
+ }
12898
+ if (structuredCoverage.status === "rejected") {
12899
+ if (diagnostics && diagnostics.length < MAX_BASE_COVERAGE_DIAGNOSTICS) {
12900
+ diagnostics.push(`batch=${batchId} lane=${qualified.expectedLane.laneId} workflow_lane=${qualified.expectedWorkflowLane}: ${formatPrReviewLaneValidationFailure(structuredCoverage.failure)}`.slice(0, MAX_BASE_COVERAGE_DIAGNOSTIC_CHARS));
12901
+ }
12902
+ continue;
12903
+ }
13082
12904
  if (workflowArtifactHasContractMarker(directory, state, qualified.record, expectedMode, qualified.expectedWorkflowLane, qualified.expectedLane.reviewItemIds, expectedRevisionDigest, qualified.expectedOwnedLanes, diagnostics, reviewerClaims)) {
13083
12905
  for (const obligation of qualified.expectedOwnedLanes) {
13084
12906
  successful.add(obligation);
@@ -13098,6 +12920,40 @@ function ownedLaneSetsEqual(recordOwned, expectedOwned) {
13098
12920
  }
13099
12921
  return recordOwned.every((owned) => expectedSet.has(owned));
13100
12922
  }
12923
+ function validateExactStructuredReceiptCoverage(input) {
12924
+ if (input.expected.mode !== "swarm-pr-review:base" && input.expected.mode !== "swarm-pr-review:micro") {
12925
+ return { status: "absent" };
12926
+ }
12927
+ const rawReceipt = input.result.prReviewResultReceipt;
12928
+ if (!rawReceipt)
12929
+ return { status: "absent" };
12930
+ const parsedReceipt2 = PrReviewResultReceiptSchema.safeParse(rawReceipt);
12931
+ if (!parsedReceipt2.success) {
12932
+ return {
12933
+ status: "rejected",
12934
+ failure: failedLaneValidation("discovery.coverage", "schema-valid exact child/workflow/revision-bound structured receipt", "invalid structured receipt").failure
12935
+ };
12936
+ }
12937
+ if (input.expected.workflowInstanceId === undefined || input.expected.workflowRevision === undefined || input.expected.baseSha === undefined) {
12938
+ return {
12939
+ status: "rejected",
12940
+ failure: failedLaneValidation("discovery.coverage", "live workflow instance/revision/base identity", "missing live workflow instance/revision/base identity").failure
12941
+ };
12942
+ }
12943
+ const receipt = parsedReceipt2.data;
12944
+ const ownedWorkflowLanes = input.expected.ownedWorkflowLanes?.length ? [...input.expected.ownedWorkflowLanes] : [input.expected.workflowLane];
12945
+ if (receipt.mode !== input.expected.mode || receipt.workflowInstanceId !== input.expected.workflowInstanceId || receipt.workflowRevision !== input.expected.workflowRevision || receipt.baseSha !== input.expected.baseSha || receipt.batchId !== input.record.batchId || receipt.laneId !== input.record.laneId || receipt.childSessionId !== input.record.subagentSessionId || receipt.workflowLane !== input.expected.workflowLane || !ownedLaneSetsEqual(receipt.ownedWorkflowLanes, ownedWorkflowLanes) || receipt.headSha !== input.expected.prHeadSha || receipt.dispatchRevisionDigest !== input.expected.revisionDigest) {
12946
+ return {
12947
+ status: "rejected",
12948
+ failure: failedLaneValidation("discovery.coverage", "exact child/workflow/revision-bound structured receipt", "mismatched structured receipt").failure
12949
+ };
12950
+ }
12951
+ return {
12952
+ status: "accepted",
12953
+ creditedWorkflowLanes: receipt.envelope.creditedLanes.filter((lane) => ownedWorkflowLanes.includes(lane)),
12954
+ receipt
12955
+ };
12956
+ }
13101
12957
  function analyzeLaneArtifactIntegrity(args) {
13102
12958
  const { record, result, artifact, expected } = args;
13103
12959
  if (!artifact) {
@@ -13221,6 +13077,9 @@ function workflowArtifactHasContractMarker(directory, state, record, expectedMod
13221
13077
  prHeadSha: state.prHeadSha ?? "",
13222
13078
  gitHead: state.prHeadSha ?? "",
13223
13079
  revisionDigest: expectedRevisionDigest ?? "",
13080
+ workflowInstanceId: state.workflowInstanceId,
13081
+ workflowRevision: state.revision,
13082
+ baseSha: state.prReviewBaseSha,
13224
13083
  reviewScope
13225
13084
  }
13226
13085
  });
@@ -13396,6 +13255,16 @@ function validatePrReviewDiscoveryLaneCompletion(input) {
13396
13255
  });
13397
13256
  if (!recordIntegrity.ok)
13398
13257
  return recordIntegrity;
13258
+ const structuredCoverage = validateExactStructuredReceiptCoverage(input);
13259
+ if (structuredCoverage.status === "accepted") {
13260
+ return { ok: true };
13261
+ }
13262
+ if (structuredCoverage.status === "rejected") {
13263
+ return { ok: false, failure: structuredCoverage.failure };
13264
+ }
13265
+ if ((input.expected.mode === "swarm-pr-review:base" || input.expected.mode === "swarm-pr-review:micro") && !prReviewLegacyTranscriptCompatibilityEnabled(input.record.prReviewLegacyTranscriptCompatibility)) {
13266
+ return failedLaneValidation("discovery.coverage", "child-bound structured receipt", "missing structured receipt (legacy transcript adapter disabled)");
13267
+ }
13399
13268
  const artifactIntegrity = analyzeLaneArtifactIntegrity({
13400
13269
  record: input.record,
13401
13270
  result: input.result,
@@ -21454,7 +21323,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
21454
21323
  };
21455
21324
  }
21456
21325
  async function sweepActiveNearDuplicates(directory, options = {}) {
21457
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-qxpfmryw.js");
21326
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-wccdm7jv.js");
21458
21327
  const { config } = loadPluginConfigWithMeta2(directory);
21459
21328
  const sweepConfig = config.learning?.dedup_sweep;
21460
21329
  if (sweepConfig?.enabled === false)
@@ -21584,6 +21453,7 @@ var _internals26 = {
21584
21453
  checkPhaseCompliance,
21585
21454
  normalizeAgentName: normalizeAgentName2,
21586
21455
  autoRetireSkills,
21456
+ observeCuratorCompliance,
21587
21457
  readSkillUsageEntries,
21588
21458
  readSkillUsageEntriesWithCoverage,
21589
21459
  recordCuratorSkips,
@@ -22551,6 +22421,12 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
22551
22421
  }
22552
22422
  const sessionId = `session-${Date.now()}`;
22553
22423
  const now2 = new Date().toISOString();
22424
+ _internals26.observeCuratorCompliance({
22425
+ directory,
22426
+ phase,
22427
+ gapTypes: complianceObservations.map((observation) => observation.type),
22428
+ agentsUsed: Array.isArray(phaseDigest.agents_used) ? phaseDigest.agents_used.map(String) : []
22429
+ });
22554
22430
  const summaryUpdated = await _internals26.mergeCuratorPhaseSummary(directory, {
22555
22431
  phase,
22556
22432
  phaseDigest,
@@ -22584,7 +22460,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
22584
22460
  }
22585
22461
  if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
22586
22462
  try {
22587
- const skillModule = await import("./skill-generator-nwrvtqbz.js");
22463
+ const skillModule = await import("./skill-generator-kck7087c.js");
22588
22464
  for (const cand of skillCandidates) {
22589
22465
  if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
22590
22466
  continue;
@@ -23056,7 +22932,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
23056
22932
  } catch {}
23057
22933
  }
23058
22934
  if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
23059
- const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-f80n84ch.js");
22935
+ const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-3q2x34cg.js");
23060
22936
  for (const { id } of contradictedEntries) {
23061
22937
  try {
23062
22938
  await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
@@ -23875,7 +23751,7 @@ async function runCuratorPostMortem(directory, options = {}) {
23875
23751
  warnings.push("Failed to collect knowledge summary.");
23876
23752
  }
23877
23753
  try {
23878
- const { getScanStatus } = await import("./scan-cursor-2v7995nb.js");
23754
+ const { getScanStatus } = await import("./scan-cursor-shn926r6.js");
23879
23755
  const scanStatus = await getScanStatus(directory);
23880
23756
  if (scanStatus.remaining_estimate > 0) {
23881
23757
  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.`);
@@ -24047,9 +23923,9 @@ var _internals27 = {
24047
23923
  verifyPostMortemKnowledgeActions,
24048
23924
  repairPostMortemActions,
24049
23925
  loadDefaultKnowledgeConfig: async (directory) => {
24050
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-dy8fqycb.js");
23926
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-98tdb9h0.js");
24051
23927
  try {
24052
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-qxpfmryw.js");
23928
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-wccdm7jv.js");
24053
23929
  const loaded = loadPluginConfigWithMeta2(directory);
24054
23930
  return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
24055
23931
  } catch {
@@ -24057,11 +23933,11 @@ var _internals27 = {
24057
23933
  }
24058
23934
  },
24059
23935
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
24060
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-3sz7refy.js");
23936
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-85d97240.js");
24061
23937
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
24062
23938
  },
24063
23939
  checkHivePromotions: async (entries, knowledgeConfig, directory) => {
24064
- const { checkHivePromotions } = await import("./hive-promoter-4rtxhw7n.js");
23940
+ const { checkHivePromotions } = await import("./hive-promoter-k57j3kp6.js");
24065
23941
  return checkHivePromotions(entries, knowledgeConfig, directory);
24066
23942
  },
24067
23943
  applyProposalTriage: async (directory, triage) => {
@@ -24070,7 +23946,7 @@ var _internals27 = {
24070
23946
  activateProposal,
24071
23947
  listSkills: listSkills2,
24072
23948
  sanitizeSlug
24073
- } = await import("./skill-generator-nwrvtqbz.js");
23949
+ } = await import("./skill-generator-kck7087c.js");
24074
23950
  const result = {
24075
23951
  approved: [],
24076
23952
  rejected: [],
@@ -25400,9 +25276,9 @@ function hashContent(content) {
25400
25276
  return createHash13("sha1").update(content).digest("hex");
25401
25277
  }
25402
25278
  async function loadConfigForPolicyCurator(directory) {
25403
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-dy8fqycb.js");
25279
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-98tdb9h0.js");
25404
25280
  try {
25405
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-qxpfmryw.js");
25281
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-wccdm7jv.js");
25406
25282
  const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
25407
25283
  return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
25408
25284
  } catch {
@@ -26480,7 +26356,7 @@ function safeRealpathSync(targetPath, fallback, realpathResolver = realpathSync3
26480
26356
  }
26481
26357
 
26482
26358
  // src/tools/repo-graph/types.ts
26483
- var GRAPH_SCHEMA_VERSION = "1.6.0";
26359
+ var GRAPH_SCHEMA_VERSION = "1.7.0";
26484
26360
  var DEFAULT_MAX_SOURCE_BYTES = 1024 * 1024;
26485
26361
  var FILE_ROLE_VALUES = [
26486
26362
  "api_route",
@@ -26542,6 +26418,22 @@ var ONTOLOGY_FINDING_SEVERITY_VALUES = [
26542
26418
  "medium",
26543
26419
  "high"
26544
26420
  ];
26421
+ var ONTOLOGY_LINK_KIND_VALUES = [
26422
+ "HANDLES_ROUTE",
26423
+ "READS",
26424
+ "WRITES",
26425
+ "DELETES",
26426
+ "VALIDATES",
26427
+ "AUTHORIZES",
26428
+ "TESTS",
26429
+ "USES_FIXTURE",
26430
+ "CONFIGURES"
26431
+ ];
26432
+ var ONTOLOGY_LINK_CONFIDENCE_VALUES = [
26433
+ "low",
26434
+ "medium",
26435
+ "high"
26436
+ ];
26545
26437
  var IMPORT_TYPE_VALUES = [
26546
26438
  "default",
26547
26439
  "named",
@@ -26620,6 +26512,8 @@ var DATA_ACCESS_SET = new Set(DATA_ACCESS_VALUES);
26620
26512
  var SECURITY_KIND_SET = new Set(SECURITY_KIND_VALUES);
26621
26513
  var SECURITY_CONFIDENCE_SET = new Set(SECURITY_CONFIDENCE_VALUES);
26622
26514
  var ONTOLOGY_FINDING_SEVERITY_SET = new Set(ONTOLOGY_FINDING_SEVERITY_VALUES);
26515
+ var ONTOLOGY_LINK_KIND_SET = new Set(ONTOLOGY_LINK_KIND_VALUES);
26516
+ var ONTOLOGY_LINK_CONFIDENCE_SET = new Set(ONTOLOGY_LINK_CONFIDENCE_VALUES);
26623
26517
  var IMPORT_TYPE_SET = new Set(IMPORT_TYPE_VALUES);
26624
26518
  var GRAPH_SYMBOL_KIND_SET = new Set(GRAPH_SYMBOL_KIND_VALUES);
26625
26519
  function validateWorkspace(workspace) {
@@ -27280,9 +27174,9 @@ function finalizeContextTelemetry(directory) {
27280
27174
  warnThrottled("finalize failed");
27281
27175
  }
27282
27176
  }
27283
- function emitContextTelemetryHealth(_directory, payload) {
27177
+ function emitContextTelemetryHealth(directory, payload) {
27284
27178
  try {
27285
- telemetry.contextTelemetryHealth({
27179
+ const healthPayload = {
27286
27180
  trigger: payload.trigger,
27287
27181
  accepted_count: payload.accepted,
27288
27182
  compacted_count: payload.compacted,
@@ -27293,6 +27187,12 @@ function emitContextTelemetryHealth(_directory, payload) {
27293
27187
  newest_timestamp: payload.newest,
27294
27188
  bytes: payload.bytes,
27295
27189
  limit_bytes: payload.limitBytes
27190
+ };
27191
+ telemetry.contextTelemetryHealth(healthPayload);
27192
+ observeStoreHealth({
27193
+ directory,
27194
+ kind: "context_telemetry_health",
27195
+ payload: healthPayload
27296
27196
  });
27297
27197
  } catch {}
27298
27198
  }
@@ -37345,6 +37245,34 @@ function emitCloseArchiveResult(ctx, cleanResult) {
37345
37245
  } catch (telemetryErr) {
37346
37246
  log("[close-command] close_archive_result telemetry emit failed:", telemetryErr);
37347
37247
  }
37248
+ observeCloseArchive({
37249
+ directory: ctx.directory,
37250
+ archiveValid,
37251
+ archiveEmpty,
37252
+ activityPredictsContent: archiveActivityPredictsContent(ctx.directory)
37253
+ });
37254
+ }
37255
+ function archiveActivityPredictsContent(directory) {
37256
+ try {
37257
+ for (const name of [
37258
+ "knowledge-events.jsonl",
37259
+ "telemetry.jsonl",
37260
+ "evidence"
37261
+ ]) {
37262
+ const target = path47.join(directory, ".swarm", name);
37263
+ const stat5 = fsSync3.statSync(target);
37264
+ if (target.endsWith("evidence")) {
37265
+ const entries = fsSync3.readdirSync(target);
37266
+ if (entries.length > 0)
37267
+ return true;
37268
+ } else if (stat5.size > 0) {
37269
+ return true;
37270
+ }
37271
+ }
37272
+ return false;
37273
+ } catch {
37274
+ return false;
37275
+ }
37348
37276
  }
37349
37277
  async function runFinalizeStage(ctx) {
37350
37278
  if (!ctx.planAlreadyDone) {
@@ -37655,7 +37583,7 @@ async function runFinalizeStage(ctx) {
37655
37583
  }
37656
37584
  }
37657
37585
  try {
37658
- const { CuratorConfigSchema: CCS } = await import("./schema-dy8fqycb.js");
37586
+ const { CuratorConfigSchema: CCS } = await import("./schema-98tdb9h0.js");
37659
37587
  const { config: pmLoadedConfig } = _internals41.loadPluginConfigWithMeta(ctx.directory);
37660
37588
  const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
37661
37589
  if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
@@ -38541,7 +38469,7 @@ var _internals41 = {
38541
38469
  closePlanTerminalState: reconcileCloseTerminalStateForPlan,
38542
38470
  endAgentSession,
38543
38471
  flushAndDrainTelemetry: async () => {
38544
- const { flushAndDrainTelemetry } = await import("./telemetry-3rh94wv3.js");
38472
+ const { flushAndDrainTelemetry } = await import("./telemetry-gpr9s3sm.js");
38545
38473
  return flushAndDrainTelemetry();
38546
38474
  },
38547
38475
  finalizeContextTelemetry: (directory) => {
@@ -39879,9 +39807,9 @@ var _internals45 = {
39879
39807
  loadPluginConfigWithMeta,
39880
39808
  loadCuratorDeps: async () => {
39881
39809
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
39882
- import("./schema-dy8fqycb.js"),
39883
- import("./curator-3sz7refy.js"),
39884
- import("./curator-llm-factory-pyp5kmra.js")
39810
+ import("./schema-98tdb9h0.js"),
39811
+ import("./curator-85d97240.js"),
39812
+ import("./curator-llm-factory-s9s4s0q3.js")
39885
39813
  ]);
39886
39814
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
39887
39815
  }
@@ -40381,7 +40309,7 @@ ${USAGE9}`;
40381
40309
  // src/services/diagnose-service.ts
40382
40310
  init_package();
40383
40311
  import * as child_process5 from "child_process";
40384
- import { existsSync as existsSync32, readdirSync as readdirSync6, readFileSync as readFileSync23, statSync as statSync14 } from "fs";
40312
+ import { existsSync as existsSync32, readdirSync as readdirSync7, readFileSync as readFileSync23, statSync as statSync15 } from "fs";
40385
40313
  import * as path54 from "path";
40386
40314
  import { fileURLToPath } from "url";
40387
40315
 
@@ -40890,7 +40818,7 @@ async function computeCurationDiagnostics(directory, entries) {
40890
40818
  let scanCompleted = false;
40891
40819
  let scanRemaining = 0;
40892
40820
  try {
40893
- const { getScanStatus } = await import("./scan-cursor-2v7995nb.js");
40821
+ const { getScanStatus } = await import("./scan-cursor-shn926r6.js");
40894
40822
  const status = await getScanStatus(directory);
40895
40823
  scanGeneration = status.generation;
40896
40824
  scanCompleted = status.completed;
@@ -40898,19 +40826,19 @@ async function computeCurationDiagnostics(directory, entries) {
40898
40826
  } catch {}
40899
40827
  let configMatch = null;
40900
40828
  try {
40901
- const { isLinked: isLinked2 } = await import("./knowledge-link-vm4caewt.js");
40829
+ const { isLinked: isLinked2 } = await import("./knowledge-link-xezm8hr3.js");
40902
40830
  if (isLinked2(directory)) {
40903
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-dy8fqycb.js");
40831
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-98tdb9h0.js");
40904
40832
  let config;
40905
40833
  try {
40906
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-qxpfmryw.js");
40834
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-wccdm7jv.js");
40907
40835
  const loaded = loadPluginConfigWithMeta2(directory);
40908
40836
  config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
40909
40837
  } catch {
40910
40838
  config = KnowledgeConfigSchema2.parse({});
40911
40839
  }
40912
40840
  const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
40913
- const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-ray8h55z.js");
40841
+ const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-47przjwg.js");
40914
40842
  const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
40915
40843
  const cohortFp = await readCohortConfigFingerprint(directory);
40916
40844
  configMatch = cohortFp === null ? null : currentFp === cohortFp;
@@ -41286,7 +41214,7 @@ async function checkPlanSync(directory, plan) {
41286
41214
  }
41287
41215
  async function checkConfigBackups(directory) {
41288
41216
  try {
41289
- const files = readdirSync6(directory);
41217
+ const files = readdirSync7(directory);
41290
41218
  const backupCount = files.filter((f) => /\.opencode-swarm\.yaml\.bak/.test(f)).length;
41291
41219
  if (backupCount <= 5) {
41292
41220
  return {
@@ -41317,7 +41245,7 @@ async function checkConfigBackups(directory) {
41317
41245
  }
41318
41246
  async function checkGitRepository(directory) {
41319
41247
  try {
41320
- if (!existsSync32(directory) || !statSync14(directory).isDirectory()) {
41248
+ if (!existsSync32(directory) || !statSync15(directory).isDirectory()) {
41321
41249
  return {
41322
41250
  name: "Git Repository",
41323
41251
  status: "\u274C",
@@ -41599,6 +41527,33 @@ async function checkSteeringDirectives(directory) {
41599
41527
  };
41600
41528
  }
41601
41529
  }
41530
+ async function checkLearningHealth(directory) {
41531
+ try {
41532
+ const snapshot = await readLearningHealth(directory);
41533
+ if (snapshot.activeAlarms.length === 0) {
41534
+ return {
41535
+ name: "Learning health",
41536
+ status: "\u2705",
41537
+ detail: `No active alarms (${snapshot.totalTransitions} transitions recorded)`
41538
+ };
41539
+ }
41540
+ const detail = snapshot.activeAlarms.map((alarm) => {
41541
+ const ageMinutes = Math.floor(alarm.ageMs / 60000);
41542
+ return `${alarm.severity} ${alarm.alarm} [${alarm.scopeClass} ${alarm.scopeRef}] age ${ageMinutes}m coverage ${alarm.coverageFacts}`;
41543
+ }).join("; ");
41544
+ return {
41545
+ name: "Learning health",
41546
+ status: "\u26A0\uFE0F",
41547
+ detail: `${snapshot.activeAlarms.length} active alarm(s): ${detail}`
41548
+ };
41549
+ } catch {
41550
+ return {
41551
+ name: "Learning health",
41552
+ status: "\u2B1C",
41553
+ detail: "Learning-health artifact unreadable (fail-open)"
41554
+ };
41555
+ }
41556
+ }
41602
41557
  async function checkCurator(directory) {
41603
41558
  try {
41604
41559
  const config = loadPluginConfig(directory);
@@ -41892,10 +41847,11 @@ async function getDiagnoseData(directory, sessionID) {
41892
41847
  checks.push(await checkSteeringDirectives(directory));
41893
41848
  checks.push(await checkCurator(directory));
41894
41849
  checks.push(await checkKnowledgeHealth(directory));
41850
+ checks.push(await checkLearningHealth(directory));
41895
41851
  checks.push(await checkResidueInventory(directory));
41896
41852
  try {
41897
41853
  const evidenceDir = path54.join(directory, ".swarm", "evidence");
41898
- const snapshotFiles = existsSync32(evidenceDir) ? readdirSync6(evidenceDir).filter((f) => f.startsWith("agent-tools-") && f.endsWith(".json")) : [];
41854
+ const snapshotFiles = existsSync32(evidenceDir) ? readdirSync7(evidenceDir).filter((f) => f.startsWith("agent-tools-") && f.endsWith(".json")) : [];
41899
41855
  if (snapshotFiles.length > 0) {
41900
41856
  const latest = snapshotFiles.sort().pop();
41901
41857
  checks.push({
@@ -42223,7 +42179,7 @@ async function handleDoctorCommand(directory, args) {
42223
42179
  const result = runConfigDoctor(config, directory);
42224
42180
  let output;
42225
42181
  if (enableAutoFix && result.hasAutoFixableIssues) {
42226
- const { runConfigDoctorWithFixes } = await import("./config-doctor-a7drgs33.js");
42182
+ const { runConfigDoctorWithFixes } = await import("./config-doctor-fr8dfrt2.js");
42227
42183
  const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
42228
42184
  applyLossy: true
42229
42185
  });
@@ -42261,7 +42217,7 @@ async function handleDoctorCommand(directory, args) {
42261
42217
  `;
42262
42218
  }
42263
42219
  try {
42264
- const { runModelPreflight } = await import("./model-preflight-w85ecyxh.js");
42220
+ const { runModelPreflight } = await import("./model-preflight-yqqchzjn.js");
42265
42221
  const preflight = await runModelPreflight(config, swarmState.opencodeClient);
42266
42222
  if (preflight.catalogAvailable) {
42267
42223
  const unresolved = preflight.resolutions.filter((resolution) => resolution.status === "unresolved");
@@ -43163,7 +43119,7 @@ async function handleEvidenceCommand(directory, args) {
43163
43119
  return formatTaskEvidenceMarkdown(evidenceData);
43164
43120
  }
43165
43121
  async function handleEvidenceSummaryCommand(directory) {
43166
- const { buildEvidenceSummary } = await import("./evidence-summary-service-cwyjkdsa.js");
43122
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-9dyt2kzh.js");
43167
43123
  const artifact = await buildEvidenceSummary(directory);
43168
43124
  if (!artifact) {
43169
43125
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -48045,7 +48001,8 @@ function partitionAgainstBaseline(indexed, baselineFingerprints, baselineReflowK
48045
48001
  reflowCounts.set(reflowKey, count - 1);
48046
48002
  }
48047
48003
  } else if (stable && reflowKey && (reflowCounts.get(reflowKey) ?? 0) > 0) {
48048
- reflowCounts.set(reflowKey, (reflowCounts.get(reflowKey) ?? 1) - 1);
48004
+ const matchedCount = reflowCounts.get(reflowKey) ?? 0;
48005
+ reflowCounts.set(reflowKey, matchedCount - 1);
48049
48006
  moved.push(finding);
48050
48007
  } else {
48051
48008
  newFindings.push(finding);
@@ -48190,7 +48147,8 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
48190
48147
  continue;
48191
48148
  }
48192
48149
  if (stable && reflowKey && (priorReflowCounts.get(reflowKey) ?? 0) > 0) {
48193
- priorReflowCounts.set(reflowKey, (priorReflowCounts.get(reflowKey) ?? 1) - 1);
48150
+ const matchedCount = priorReflowCounts.get(reflowKey) ?? 0;
48151
+ priorReflowCounts.set(reflowKey, matchedCount - 1);
48194
48152
  continue;
48195
48153
  }
48196
48154
  const relFile = normalizeFindingPath(directory, finding.location.file);
@@ -48254,8 +48212,10 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
48254
48212
  }
48255
48213
  cappedFilesIndexed = Array.from(survivingFiles);
48256
48214
  }
48215
+ const priorTriage = existing.triage_log ?? [];
48257
48216
  const cappedFingerprintSet = new Set(cappedFingerprints2);
48258
- const retainedTriage = (existing.triage_log ?? []).filter((e) => cappedFingerprintSet.has(e.fingerprint));
48217
+ const retainedTriage = priorTriage.filter((e) => cappedFingerprintSet.has(e.fingerprint));
48218
+ const droppedTriageCount = priorTriage.length - retainedTriage.length;
48259
48219
  const mergedTriageLog = [...retainedTriage, ...triageEntries].slice(-MAX_BASELINE_FINDINGS);
48260
48220
  const now3 = new Date().toISOString();
48261
48221
  const bundle2 = {
@@ -48292,7 +48252,8 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
48292
48252
  status: "merged",
48293
48253
  path: baselinePath,
48294
48254
  fingerprint_count: cappedFingerprints2.length,
48295
- absorbed_finding_count: triageEntries.length
48255
+ absorbed_finding_count: triageEntries.length,
48256
+ dropped_triage_count: droppedTriageCount
48296
48257
  };
48297
48258
  }
48298
48259
  const newFingerprints = indexed.map((i) => i.fingerprint);
@@ -48373,7 +48334,7 @@ function loadBaseline(directory, phase) {
48373
48334
  }
48374
48335
  let reflowKeys = [];
48375
48336
  if (parsed.schema_version === BASELINE_SCHEMA_VERSION) {
48376
- if (parsed.reflow_keys === undefined) {
48337
+ if (parsed.reflow_keys === undefined || parsed.reflow_keys === null) {
48377
48338
  reflowKeys = [];
48378
48339
  } else if (!Array.isArray(parsed.reflow_keys) || parsed.reflow_keys.some((k) => typeof k !== "string") || parsed.reflow_keys.length !== parsed.fingerprints.length) {
48379
48340
  return {
@@ -48756,8 +48717,17 @@ async function sastScan(input, directory, config) {
48756
48717
  warn(`SAST Baseline: capture failed \u2014 ${captureResult.message}`);
48757
48718
  } else if (captureResult.status === "absorption_blocked") {
48758
48719
  warn(`SAST Baseline: ${captureResult.message}`);
48759
- } else if (captureResult.status === "merged" && captureResult.absorbed_finding_count > 0) {
48760
- warn(`SAST Baseline: merged and absorbed ${captureResult.absorbed_finding_count} novel finding(s) ` + "under the supplied refresh rationale. If this capture ran after a gate failure, " + "those findings may be coder-introduced \u2014 verify before proceeding.");
48720
+ } else if (captureResult.status === "merged") {
48721
+ const notes = [];
48722
+ if (captureResult.absorbed_finding_count > 0) {
48723
+ notes.push(`absorbed ${captureResult.absorbed_finding_count} novel finding(s) ` + "under the supplied refresh rationale. If this capture ran after a " + "gate failure, those findings may be coder-introduced \u2014 verify " + "before proceeding.");
48724
+ }
48725
+ if (captureResult.dropped_triage_count > 0) {
48726
+ notes.push(`dropped ${captureResult.dropped_triage_count} stale triage ` + "entr(y/ies) whose fingerprints no longer survive this merge");
48727
+ }
48728
+ if (notes.length > 0) {
48729
+ warn(`SAST Baseline: merged and ${notes.join("; ")}.`);
48730
+ }
48761
48731
  }
48762
48732
  const finalFindings2 = allFindings.slice(0, MAX_FINDINGS);
48763
48733
  const summary2 = {
@@ -48870,6 +48840,8 @@ async function sastScan(input, directory, config) {
48870
48840
  new_findings: newFindings,
48871
48841
  pre_existing_findings: preExistingFindings,
48872
48842
  moved_findings: movedFindings,
48843
+ ...truncatedPreExisting ? { truncated_pre_existing: true } : {},
48844
+ ...truncatedMoved ? { truncated_moved_findings: true } : {},
48873
48845
  baseline_used: true
48874
48846
  }
48875
48847
  }, abort_signal);
@@ -48894,12 +48866,12 @@ async function sastScan(input, directory, config) {
48894
48866
  }
48895
48867
  var sast_scan = createSwarmTool({
48896
48868
  allowWorkingDirectoryOverride: true,
48897
- description: "Static Application Security Testing (SAST) scan. Scans files for security vulnerabilities using built-in rules (Tier A) and optional Semgrep (Tier B). Supports phase-scoped baseline diffing: set capture_baseline:true before first coder delegation to snapshot pre-existing findings; subsequent scans with the same phase only fail on NEW findings.",
48869
+ description: "Static Application Security Testing (SAST) scan. Scans files for security vulnerabilities using built-in rules (Tier A) and optional Semgrep (Tier B). Supports phase-scoped baseline diffing: set capture_baseline:true before first coder delegation to snapshot pre-existing findings; subsequent scans with the same phase only fail on NEW findings. Baseline diff results partition into new_findings (gating), pre_existing_findings, and moved_findings (reflow-matched relocations of pre-existing findings \u2014 reported, never gating). A blocked baseline capture returns status baseline_absorption_blocked with the recovery hint.",
48898
48870
  args: {
48899
48871
  directory: exports_external.string().describe("Directory to scan for security vulnerabilities"),
48900
48872
  changed_files: exports_external.array(exports_external.string()).optional().describe("List of files to scan (leave empty to scan none)"),
48901
48873
  severity_threshold: exports_external.enum(["low", "medium", "high", "critical"]).optional().default("medium").describe("Minimum severity that causes failure"),
48902
- capture_baseline: exports_external.boolean().optional().describe("When true, capture/merge a phase-scoped baseline of pre-existing findings. Requires phase. Subsequent scans with phase only fail on NEW findings. Merging findings not previously in the baseline (any file) is BLOCKED unless baseline_refresh_rationale is provided."),
48874
+ capture_baseline: exports_external.boolean().optional().describe("When true, capture/merge a phase-scoped baseline of pre-existing findings. Requires phase. Subsequent scans with phase only fail on NEW findings. Merging findings not previously in the baseline (any file) is BLOCKED unless baseline_refresh_rationale is provided; blocked captures return status baseline_absorption_blocked."),
48903
48875
  phase: exports_external.number().int().min(1).optional().describe("Current phase number (positive integer >= 1). Required with capture_baseline. Enables baseline diff when provided on non-capture scans."),
48904
48876
  baseline_refresh_rationale: exports_external.string().trim().min(1).max(500).optional().describe('Audited rationale required when capture_baseline would absorb findings not previously in the baseline \u2014 for already-indexed AND first-time files (e.g. "pre-delegation capture for task 2.1; findings verified pre-existing"). Recorded per finding in the baseline triage log. Only meaningful with capture_baseline: true.')
48905
48877
  },
@@ -51053,7 +51025,7 @@ import {
51053
51025
  readFileSync as readFileSync32,
51054
51026
  renameSync as renameSync12,
51055
51027
  rmSync as rmSync7,
51056
- statSync as statSync18,
51028
+ statSync as statSync19,
51057
51029
  unlinkSync as unlinkSync12,
51058
51030
  writeSync
51059
51031
  } from "fs";
@@ -56659,18 +56631,18 @@ var MIN_MAX_CYCLES = 1;
56659
56631
  var MAX_MAX_CYCLES = 5;
56660
56632
  async function readLatestLoopState(directory) {
56661
56633
  try {
56662
- const { readdirSync: readdirSync9, statSync: statSync20, readFileSync: readFileSync38 } = await import("fs");
56634
+ const { readdirSync: readdirSync10, statSync: statSync21, readFileSync: readFileSync38 } = await import("fs");
56663
56635
  const loopDir = `${directory}/.swarm/loop`;
56664
56636
  let latestMtime = 0;
56665
56637
  let latestPath = null;
56666
56638
  try {
56667
- const entries = readdirSync9(loopDir, { withFileTypes: true });
56639
+ const entries = readdirSync10(loopDir, { withFileTypes: true });
56668
56640
  for (const entry of entries) {
56669
56641
  if (!entry.isDirectory())
56670
56642
  continue;
56671
56643
  const statePath = `${loopDir}/${entry.name}/state.json`;
56672
56644
  try {
56673
- const mtime = statSync20(statePath).mtimeMs;
56645
+ const mtime = statSync21(statePath).mtimeMs;
56674
56646
  if (mtime > latestMtime) {
56675
56647
  latestMtime = mtime;
56676
56648
  latestPath = statePath;
@@ -57308,7 +57280,7 @@ import {
57308
57280
  openSync as openSync13,
57309
57281
  readSync as readSync7,
57310
57282
  realpathSync as realpathSync8,
57311
- statSync as statSync21
57283
+ statSync as statSync22
57312
57284
  } from "fs";
57313
57285
  var import_proper_lockfile9 = __toESM(require_proper_lockfile(), 1);
57314
57286
 
@@ -60602,6 +60574,8 @@ var HTTP_METHODS = [
60602
60574
  "HEAD"
60603
60575
  ];
60604
60576
  var MAX_FACTS_PER_KIND = 50;
60577
+ var MAX_LINKS_PER_FILE = 200;
60578
+ var MAX_CONFIGURES_PER_FILE = 20;
60605
60579
  function stripComments(content) {
60606
60580
  let out = "";
60607
60581
  let i = 0;
@@ -61022,7 +60996,7 @@ function buildFindings(roles, routes, dataOperations, security) {
61022
60996
  findings.push({
61023
60997
  code: "api_route_without_detected_auth",
61024
60998
  severity: "medium",
61025
- message: "No authentication, authorization, or CSRF guard was detected near this route.",
60999
+ message: "No authentication, authorization, or CSRF guard was detected anywhere in this file; absence of this finding does not prove an individual route is guarded.",
61026
61000
  line: routes[0]?.line
61027
61001
  });
61028
61002
  }
@@ -61044,6 +61018,112 @@ function buildFindings(roles, routes, dataOperations, security) {
61044
61018
  }
61045
61019
  return findings;
61046
61020
  }
61021
+ function routerCallHandlerSymbol(line) {
61022
+ if (line.length > 500)
61023
+ return null;
61024
+ const match = line.match(/\b(?:router|app|server)\s*\.\s*(?:get|post|put|patch|delete|options|head|all)\s*\([^(]*?([A-Za-z_$][\w$]*)\s*\)\s*[;,)]?\s*$/);
61025
+ return match?.[1] ?? null;
61026
+ }
61027
+ var CONFIG_KEY_PATTERN = /\bprocess\.env\.([A-Za-z_$][A-Za-z0-9_$]*)\b|\bprocess\.env\[\s*['"]([A-Za-z_$][A-Za-z0-9_$]*)['"]\s*\]|\bimport\.meta\.env\.([A-Za-z_$][A-Za-z0-9_$]*)\b|\bDeno\.env\.get\(\s*['"]([A-Za-z_$][A-Za-z0-9_$]*)['"]\s*\)/g;
61028
+ function extractLinks(content, routes, dataOperations, security) {
61029
+ const lines = content.split(/\r?\n/);
61030
+ const links = [];
61031
+ for (const route of routes) {
61032
+ if (route.source === "handler_export") {
61033
+ links.push({
61034
+ kind: "HANDLES_ROUTE",
61035
+ subject: `${route.method} ${route.path}`,
61036
+ ...route.line !== undefined ? { line: route.line } : {},
61037
+ ...route.line !== undefined ? { evidence: (lines[route.line - 1] ?? "").trim().slice(0, 160) } : {},
61038
+ confidence: "high",
61039
+ symbol: route.method
61040
+ });
61041
+ } else if (route.source === "router_call") {
61042
+ const handler = route.line !== undefined ? routerCallHandlerSymbol(lines[route.line - 1] ?? "") : null;
61043
+ links.push({
61044
+ kind: "HANDLES_ROUTE",
61045
+ subject: `${route.method} ${route.path}`,
61046
+ ...route.line !== undefined ? { line: route.line } : {},
61047
+ ...route.line !== undefined ? { evidence: (lines[route.line - 1] ?? "").trim().slice(0, 160) } : {},
61048
+ confidence: "medium",
61049
+ ...handler ? { symbol: handler } : {}
61050
+ });
61051
+ } else {
61052
+ links.push({
61053
+ kind: "HANDLES_ROUTE",
61054
+ subject: `${route.method} ${route.path}`,
61055
+ confidence: "low"
61056
+ });
61057
+ }
61058
+ }
61059
+ const operationKind = {
61060
+ read: "READS",
61061
+ write: "WRITES",
61062
+ delete: "DELETES",
61063
+ transaction: "WRITES",
61064
+ migration: "WRITES"
61065
+ };
61066
+ const dataLinks = [];
61067
+ for (const fact of dataOperations) {
61068
+ if (!fact.entity)
61069
+ continue;
61070
+ const kind = operationKind[fact.operation];
61071
+ if (!kind)
61072
+ continue;
61073
+ const confidence = fact.operation === "transaction" || fact.operation === "migration" ? "low" : "medium";
61074
+ dataLinks.push({
61075
+ kind,
61076
+ subject: fact.entity,
61077
+ line: fact.line,
61078
+ evidence: fact.evidence,
61079
+ confidence
61080
+ });
61081
+ }
61082
+ dataLinks.sort((a, b) => (a.line ?? 0) - (b.line ?? 0));
61083
+ links.push(...dataLinks);
61084
+ const securityLinks = [];
61085
+ for (const fact of security) {
61086
+ if (fact.kind === "input_validation") {
61087
+ securityLinks.push({
61088
+ kind: "VALIDATES",
61089
+ line: fact.line,
61090
+ evidence: fact.evidence,
61091
+ confidence: fact.confidence
61092
+ });
61093
+ } else if (fact.kind === "authorization") {
61094
+ securityLinks.push({
61095
+ kind: "AUTHORIZES",
61096
+ line: fact.line,
61097
+ evidence: fact.evidence,
61098
+ confidence: fact.confidence
61099
+ });
61100
+ }
61101
+ }
61102
+ securityLinks.sort((a, b) => (a.line ?? 0) - (b.line ?? 0));
61103
+ links.push(...securityLinks);
61104
+ const seenKeys = new Set;
61105
+ const configureLinks = [];
61106
+ for (let i = 0;i < lines.length && configureLinks.length < MAX_CONFIGURES_PER_FILE; i++) {
61107
+ const line = lines[i];
61108
+ for (const match of line.matchAll(CONFIG_KEY_PATTERN)) {
61109
+ if (configureLinks.length >= MAX_CONFIGURES_PER_FILE)
61110
+ break;
61111
+ const key = match[1] ?? match[2] ?? match[3] ?? match[4];
61112
+ if (!key || seenKeys.has(key))
61113
+ continue;
61114
+ seenKeys.add(key);
61115
+ configureLinks.push({
61116
+ kind: "CONFIGURES",
61117
+ subject: key,
61118
+ line: i + 1,
61119
+ evidence: line.trim().slice(0, 160),
61120
+ confidence: "medium"
61121
+ });
61122
+ }
61123
+ }
61124
+ links.push(...configureLinks);
61125
+ return links.slice(0, MAX_LINKS_PER_FILE);
61126
+ }
61047
61127
  function extractFileOntology(input) {
61048
61128
  const moduleName = normalizeModuleName(input.moduleName);
61049
61129
  const content = stripComments(input.content);
@@ -61053,6 +61133,7 @@ function extractFileOntology(input) {
61053
61133
  const security = extractSecurityFacts(content);
61054
61134
  const conventions = extractConventions(moduleName, roles, routes);
61055
61135
  const findings = buildFindings(roles, routes, dataOperations, security);
61136
+ const links = extractLinks(content, routes, dataOperations, security);
61056
61137
  return {
61057
61138
  roles,
61058
61139
  packageBoundary: sourceBoundaryForLanguage(input.language, content) ?? boundaryForModule(moduleName, input.hasManifest),
@@ -61060,7 +61141,8 @@ function extractFileOntology(input) {
61060
61141
  dataOperations,
61061
61142
  security,
61062
61143
  conventions,
61063
- findings
61144
+ findings,
61145
+ links
61064
61146
  };
61065
61147
  }
61066
61148
 
@@ -63116,8 +63198,8 @@ async function migrateMemoryFamily(destRoot, sourceRoot) {
63116
63198
  copyFileSync4(sourceDbPath, path82.join(backupDir, `memory.db.pre-merge-${stamp}`));
63117
63199
  } catch {}
63118
63200
  try {
63119
- const { readdirSync: readdirSync10, unlinkSync: rmFileSync } = await import("fs");
63120
- const backups = readdirSync10(backupDir).filter((f) => f.startsWith("memory.db.pre-merge-")).sort();
63201
+ const { readdirSync: readdirSync11, unlinkSync: rmFileSync } = await import("fs");
63202
+ const backups = readdirSync11(backupDir).filter((f) => f.startsWith("memory.db.pre-merge-")).sort();
63121
63203
  while (backups.length > MAX_BACKUPS) {
63122
63204
  const oldest = backups.shift();
63123
63205
  if (oldest)
@@ -76895,7 +76977,7 @@ import {
76895
76977
  openSync as openSync20,
76896
76978
  readFileSync as readFileSync46,
76897
76979
  renameSync as renameSync16,
76898
- statSync as statSync25,
76980
+ statSync as statSync26,
76899
76981
  unlinkSync as unlinkSync22,
76900
76982
  writeFileSync as writeFileSync18,
76901
76983
  writeFileSync as writeFileSyncAsync
@@ -76985,7 +77067,7 @@ var _internals93 = {
76985
77067
  renameSync: renameSync16,
76986
77068
  unlinkSync: unlinkSync22,
76987
77069
  existsSync: existsSync57,
76988
- statSync: statSync25
77070
+ statSync: statSync26
76989
77071
  };
76990
77072
  async function appendEvent2(directory, eventInput) {
76991
77073
  assertProjectRoot(directory);
@@ -78391,7 +78473,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
78391
78473
  if (!input.dispatcher) {
78392
78474
  throw new Error("no evaluation dispatcher available (cannot run validation)");
78393
78475
  }
78394
- const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-sn7a6zd0.js");
78476
+ const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-wsdcy2d6.js");
78395
78477
  const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
78396
78478
  const result = await withProtectedSetIntegrity([evalInputRoot, ...protectedRoots(input.directory)], () => _internals98.evaluateCandidateV1({
78397
78479
  projectRoot: input.directory,
@@ -79548,6 +79630,23 @@ async function getStatusData(directory, agents, sessionId, options) {
79548
79630
  } catch {
79549
79631
  status.delegationLedgerHealth = undefined;
79550
79632
  }
79633
+ try {
79634
+ const snapshot = await readLearningHealth(directory);
79635
+ status.learningHealth = {
79636
+ activeAlarms: snapshot.activeAlarms.map((alarm) => ({
79637
+ alarm: alarm.alarm,
79638
+ severity: alarm.severity,
79639
+ scopeClass: alarm.scopeClass,
79640
+ scopeRef: alarm.scopeRef,
79641
+ ageMs: alarm.ageMs,
79642
+ coverageFacts: alarm.coverageFacts,
79643
+ transitionCount: alarm.transitionCount
79644
+ })),
79645
+ totalTransitions: snapshot.totalTransitions
79646
+ };
79647
+ } catch {
79648
+ status.learningHealth = undefined;
79649
+ }
79551
79650
  const backgroundSubagentsEnabled = options?.backgroundSubagents ?? (() => {
79552
79651
  try {
79553
79652
  return loadPluginConfig(directory)?.hooks?.background_subagents === true;
@@ -79838,6 +79937,19 @@ function formatStatusMarkdown(status) {
79838
79937
  if (consensusReports > 0)
79839
79938
  lines.push(` - Consensus reports: ${consensusReports} (read under \`.swarm/evolution/consensus/\`; each holds proposals-only recommendations)`);
79840
79939
  }
79940
+ if (status.learningHealth) {
79941
+ lines.push("", "**Learning Health**:");
79942
+ const active = status.learningHealth.activeAlarms;
79943
+ if (active.length === 0) {
79944
+ lines.push(` - \u2705 no active learning-health alarms (${status.learningHealth.totalTransitions} transitions recorded)`);
79945
+ } else {
79946
+ for (const alarm of active) {
79947
+ const ageMinutes = Math.floor(alarm.ageMs / 60000);
79948
+ lines.push(` - \u26A0 ${alarm.severity}: ${alarm.alarm} [${alarm.scopeClass} ${alarm.scopeRef}] age ${ageMinutes}m, coverage ${alarm.coverageFacts} facts (${alarm.transitionCount} transitions)`);
79949
+ }
79950
+ lines.push(` - run \`/swarm diagnose\` for the learning-health check detail`);
79951
+ }
79952
+ }
79841
79953
  if (status.cohort?.linked) {
79842
79954
  lines.push("", "**Knowledge Cohort**:");
79843
79955
  lines.push(` - \uD83D\uDD17 Linked to shared store "${status.cohort.linkId}"`);
@@ -80486,7 +80598,7 @@ function buildDetailedHelp(commandName, entry) {
80486
80598
  async function handleHelpCommand(ctx) {
80487
80599
  const targetCommand = ctx.args.join(" ");
80488
80600
  if (!targetCommand) {
80489
- const { buildHelpText } = await import("./index-sn6mtxxc.js");
80601
+ const { buildHelpText } = await import("./index-e1ygmd4q.js");
80490
80602
  return buildHelpText();
80491
80603
  }
80492
80604
  const tokens = targetCommand.split(/\s+/);
@@ -80495,7 +80607,7 @@ async function handleHelpCommand(ctx) {
80495
80607
  return _internals101.buildDetailedHelp(resolved.key, resolved.entry);
80496
80608
  }
80497
80609
  const similar = _internals101.findSimilarCommands(targetCommand);
80498
- const { buildHelpText: fullHelp } = await import("./index-sn6mtxxc.js");
80610
+ const { buildHelpText: fullHelp } = await import("./index-e1ygmd4q.js");
80499
80611
  if (similar.length > 0) {
80500
80612
  return `Command '/swarm ${targetCommand}' not found.
80501
80613
 
@@ -80826,7 +80938,7 @@ var COMMAND_REGISTRY = {
80826
80938
  },
80827
80939
  "guardrail explain": {
80828
80940
  handler: async (ctx) => {
80829
- const { handleGuardrailExplain } = await import("./guardrail-explain-a13kbmrt.js");
80941
+ const { handleGuardrailExplain } = await import("./guardrail-explain-4a2xdtew.js");
80830
80942
  return handleGuardrailExplain(ctx.directory, ctx.args);
80831
80943
  },
80832
80944
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -80836,7 +80948,7 @@ var COMMAND_REGISTRY = {
80836
80948
  },
80837
80949
  "guardrail reset": {
80838
80950
  handler: async (ctx) => {
80839
- const { handleGuardrailReset } = await import("./guardrail-reset-chbc0mep.js");
80951
+ const { handleGuardrailReset } = await import("./guardrail-reset-xn7k3hn8.js");
80840
80952
  return handleGuardrailReset(ctx.args, ctx.sessionID);
80841
80953
  },
80842
80954
  description: "Reset one exact active invocation/action circuit after repair",
@@ -80845,7 +80957,7 @@ var COMMAND_REGISTRY = {
80845
80957
  },
80846
80958
  "guardrail-explain": {
80847
80959
  handler: async (ctx) => {
80848
- const { handleGuardrailExplain } = await import("./guardrail-explain-a13kbmrt.js");
80960
+ const { handleGuardrailExplain } = await import("./guardrail-explain-4a2xdtew.js");
80849
80961
  return handleGuardrailExplain(ctx.directory, ctx.args);
80850
80962
  },
80851
80963
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -80855,7 +80967,7 @@ var COMMAND_REGISTRY = {
80855
80967
  },
80856
80968
  "guardrail-reset": {
80857
80969
  handler: async (ctx) => {
80858
- const { handleGuardrailReset } = await import("./guardrail-reset-chbc0mep.js");
80970
+ const { handleGuardrailReset } = await import("./guardrail-reset-xn7k3hn8.js");
80859
80971
  return handleGuardrailReset(ctx.args, ctx.sessionID);
80860
80972
  },
80861
80973
  description: "Reset one exact active invocation/action circuit after repair",
@@ -80865,7 +80977,7 @@ var COMMAND_REGISTRY = {
80865
80977
  },
80866
80978
  "guardrail-log": {
80867
80979
  handler: async (ctx) => {
80868
- const { handleGuardrailLog } = await import("./guardrail-log-nerqk9qb.js");
80980
+ const { handleGuardrailLog } = await import("./guardrail-log-27nkntrx.js");
80869
80981
  return handleGuardrailLog(ctx.directory, ctx.args);
80870
80982
  },
80871
80983
  description: "Read the guardrail decision log (use --blocks-only for blocks)",
@@ -82808,6 +82920,7 @@ HARD CONSTRAINTS (apply regardless of skill load success):
82808
82920
  - CHECK OUT THE EXACT PR HEAD LOCALLY before dispatching explorer lanes: resolve the authoritative full PR head SHA, verify the working tree is clean (git status --porcelain), and if it is dirty call \`prepare_pr_workflow_checkout\` before checkout \u2014 either with no \`paths\` to auto-discover and preserve every dirty and untracked change in one auditable stash, or with an explicit exact dirty tracked path set. It returns the stash OID and recovery command; an already-clean tree is a no-op. Do NOT run \`git stash\` through shell. Then use standalone commands: fetch the PR head, verify it portably with \`git rev-parse --verify <full_pr_head_sha>^0\` followed by \`git cat-file -t <full_pr_head_sha>\` (which must print \`commit\`), run \`git switch --detach <full_pr_head_sha>\`, confirm HEAD equals that SHA, and bind it through the PR-review controller. Do not use \`--track FETCH_HEAD\`. Explorers read the working-tree filesystem (Read/Glob/Grep), so without this checkout they read the base branch and produce invalid candidates. Always pass the base..head commit range in explorer delegations. Under Profile A, do not create a scratch context-pack file after the gate activates: put bounded shared scope, obligations, and deterministic signals in \`common_prompt\`; every lane must inspect the exact bound diff itself.
82809
82921
  - Treat the controller Git-state result as final for the attempt: \`clean\` proceeds; \`stashable\` permits one preparation call; \`recovery-required\` or \`indeterminate\` means report the typed \`required_action\`, abort/clear any already-active gate, and STOP unless \`retryable: true\`. Never loop on stash against an unmerged index or in-progress Git operation.
82810
82922
  - RUN ALL BASE LANES: the default PR_REVIEW path covers all six repository-agnostic base dimensions from the skill on every PR. Use \`mode: "swarm-pr-review:base"\`, the exact \`workflow_lane\` identifiers, and the exact bound \`pr_head_sha\`. \`pr_review_resilience\` is DISABLED by default, so the legacy one-wave base dispatch is the default path at every depth tier \u2014 do not emit \`pr_review_wave_stage\` or \`pr_review_wave_attempt\` unless a project has explicitly enabled it. Only when a project explicitly sets \`pr_review_resilience.enabled: true\` must depth tier M/L stage attempt 0 as one singleton \`pr_review_wave_stage: "canary"\` batch followed by a \`"fanout"\` batch whose combined canary+fanout ownership partitions all six dimensions exactly once; tier L still requires six singleton combined lanes, and tier S keeps the legacy one-wave path regardless. The runtime rejects omitted stage metadata, partial, duplicate, mislabelled, or structurally invalid waves.
82923
+ - SETTLE DISCOVERY LANES STRUCTURED-FIRST: for Profile A base and micro discovery lanes, require exactly one \`submit_pr_review_result\` call and then stop. Deprecated transcript \`[CANDIDATE]\` / \`[CLEAN]\` rows are legacy-only compatibility for lanes whose snapped \`pr_review_legacy_transcript_compatibility\` contract explicitly enables them; they are OFF by default for new config and must never be duplicated after the structured submission.
82811
82924
  - RETRY STRUCTURALLY: retry only unresolved failed base obligations in later \`swarm-pr-review:base\` async batches with the same exact \`pr_head_sha\`. Under staged resilience, attempts are numbered by \`pr_review_wave_attempt\`: attempt 0 plus at most two retry attempts (1 and 2), each with one singleton canary batch and then its matching fanout batch when obligations remain. Blocking \`dispatch_lanes\` and direct Task explorer/reviewer/critic dispatch are not provenance-equivalent and are rejected. If the runtime returns typed \`retry_exhausted\` or \`circuit_open\`, or if the second retry still cannot close coverage, collect every lane to settlement, do not probe downstream writers or micro lanes, call \`abort_pr_workflow\` with \`mode: "PR_REVIEW"\`, \`kind: "recovery"\`, and a non-empty one-line \`reason\` naming the failed lane or correlated failure and exhausted retries, then call \`prepare_pr_workflow_checkout\` with \`operation: "restore"\` before reporting the blocker.
82812
82925
  - RECOVER CONTRACT FAILURES EXPLICITLY: when collection reports \`workflow_lane_failure_class: "contract"\`, retry that one singleton base dimension once with \`pr_review_contract_retry: true\`; this retry is outside staged \`pr_review_wave_attempt\` accounting and cannot be combined with stage metadata. When fewer than six base dimensions settle but every launched lane is terminal or explicitly cancelled, the \`post_explorer\` findings write may explicitly submit \`partial_base_coverage: { unresolved_dimensions: [<exactly the uncovered dimensions>] }\` (issue #2383 N-of-6 settlement). Never infer or omit dimensions from this disclosure: the runtime derives each dimension's terminal state from lane evidence, persists an immutable coverage receipt, and rejects any declaration that does not exactly match the derived settlement.
82813
82926
  - USE ASYNC DISPATCH WITHOUT IDLING: each admissible base wave uses one \`dispatch_lanes_async\` call. With enabled tier-M/L staged resilience, this means one singleton canary call followed by one unresolved-only fanout call after canary admission; it never means one legacy call carrying the whole initial base wave. Record each \`batch_id\`, then keep doing non-dependent architect work while its lanes run. Poll with \`collect_lane_results\` without \`wait\` (or \`wait: false\`) to process settled lanes and continue independent work between polls; use \`wait: true\` only as the final join when no independent work remains.
@@ -83787,6 +83900,7 @@ init_schema();
83787
83900
  init_context_window();
83788
83901
  var loggedFirstCalls = new Set;
83789
83902
  var warnedUndersizedDefaults = new Set;
83903
+ var invalidOverrideReports = new Set;
83790
83904
 
83791
83905
  // src/hooks/guardrails/nontransient-circuit.ts
83792
83906
  init_schema();
@@ -86858,7 +86972,7 @@ function getDisplayFinalPromptPressure() {
86858
86972
  async function rehydratePrSubscriptions(sessionID, directory) {
86859
86973
  const map = new Map;
86860
86974
  try {
86861
- const { listActive: listActive2 } = await import("./pr-subscriptions-482gzvt6.js");
86975
+ const { listActive: listActive2 } = await import("./pr-subscriptions-asjevc5p.js");
86862
86976
  const records = await listActive2(directory);
86863
86977
  for (const record of records) {
86864
86978
  if (record.sessionID !== sessionID)
@@ -87304,7 +87418,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
87304
87418
  return extracted === expectedSessionId;
87305
87419
  }
87306
87420
  async function inspectStandardWorktreeCollisionOwnership(identity) {
87307
- const collisionOwnership = await import("./worktree-collision-ownership-cy24p5mr.js");
87421
+ const collisionOwnership = await import("./worktree-collision-ownership-6b3kshcv.js");
87308
87422
  return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
87309
87423
  }
87310
87424
  async function runRecoveryGit(directory, args, timeoutMs = 15000) {
@@ -87713,7 +87827,7 @@ async function precreateStandardWorktreeSession(args) {
87713
87827
  const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, handle.worktreePath);
87714
87828
  if (laneProfile) {
87715
87829
  try {
87716
- const { writeLaneProfileToDiskReal } = await import("./core-madqgdsc.js");
87830
+ const { writeLaneProfileToDiskReal } = await import("./core-4j1hbhey.js");
87717
87831
  await writeLaneProfileToDiskReal(handle.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
87718
87832
  } catch {}
87719
87833
  }
@@ -88638,7 +88752,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
88638
88752
  }
88639
88753
  clearWorktreeMergeStatus(statusKey);
88640
88754
  try {
88641
- const { removeLaneProfileFromDiskReal } = await import("./core-madqgdsc.js");
88755
+ const { removeLaneProfileFromDiskReal } = await import("./core-4j1hbhey.js");
88642
88756
  await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
88643
88757
  } catch {}
88644
88758
  const state = serializationStateBySessionID.get(dispatch.parentSessionID);
@@ -88841,4 +88955,4 @@ var _internals103 = {
88841
88955
  resolveGitExecutable
88842
88956
  };
88843
88957
 
88844
- export { PrReviewRunIdSchema, resetActionCircuitExternally, getBlockingActionCircuit, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, getSharedClassifierGuardrailBlock, classifyCommand, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, getAgentSession, parseLeanLaneIndex, computeLaneRuntimeProfile, MAX_TRACKED_STANDARD_WORKTREE_CALLS, awaitingMergeByCallID, standardWorktreeByCallID, standardWorktreeSerializationSessions, getStandardWorktreeDegradationReason, resetStandardWorktreeIsolationState, checkStandardWorktreeSerializationRelease, sanitizeWorktreeTaskId, preProvisionCollisionCheck, isLaneOwnedByCurrentSession, precreateStandardWorktreeSession, preserveBackgroundWorktreeOwnershipForCallId, preserveDirtyWorktreeForCallId, preserveDirtyWorktreeAtPath, cleanupStandardWorktreeForCallId, abortStandardWorktreeDispatch, finishStandardWorktreeDispatch, readLaneEnvFileFromDisk, _internals103 as _internals, readPrReviewReentryBindingContext, prWorkflowSessionFileStem, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleApproveWriteCommand, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals26 as _internals1, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals30 as _internals2, createHivePromoterHook, promoteToHive, promoteFromSwarm, safeRealpathSync, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, VERSION_PINNED_LEAF, discoverVersionPinnedCachePaths, readCachePackageVersion, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleBlueprintValidateCommand, handleBlueprintCurrentCommand, handleBlueprintHistoryCommand, handleBlueprintDiffCommand, handleBlueprintExportCommand, handleHarnessCandidateValidateCommand, handleHarnessCandidateShowCommand, handleHarnessCandidateDiffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleRecoverCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleReviewCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals101 as _internals3, resolveCommand };
88958
+ export { resetActionCircuitExternally, getBlockingActionCircuit, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, getSharedClassifierGuardrailBlock, classifyCommand, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, getAgentSession, parseLeanLaneIndex, computeLaneRuntimeProfile, MAX_TRACKED_STANDARD_WORKTREE_CALLS, awaitingMergeByCallID, standardWorktreeByCallID, standardWorktreeSerializationSessions, getStandardWorktreeDegradationReason, resetStandardWorktreeIsolationState, checkStandardWorktreeSerializationRelease, sanitizeWorktreeTaskId, preProvisionCollisionCheck, isLaneOwnedByCurrentSession, precreateStandardWorktreeSession, preserveBackgroundWorktreeOwnershipForCallId, preserveDirtyWorktreeForCallId, preserveDirtyWorktreeAtPath, cleanupStandardWorktreeForCallId, abortStandardWorktreeDispatch, finishStandardWorktreeDispatch, readLaneEnvFileFromDisk, _internals103 as _internals, readPrReviewReentryBindingContext, prWorkflowSessionFileStem, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleApproveWriteCommand, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals26 as _internals1, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals30 as _internals2, createHivePromoterHook, promoteToHive, promoteFromSwarm, safeRealpathSync, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, VERSION_PINNED_LEAF, discoverVersionPinnedCachePaths, readCachePackageVersion, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleBlueprintValidateCommand, handleBlueprintCurrentCommand, handleBlueprintHistoryCommand, handleBlueprintDiffCommand, handleBlueprintExportCommand, handleHarnessCandidateValidateCommand, handleHarnessCandidateShowCommand, handleHarnessCandidateDiffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleRecoverCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleReviewCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals101 as _internals3, resolveCommand };