opencode-swarm 7.196.0 → 7.197.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 (129) hide show
  1. package/.opencode/skills/brainstorm/SKILL.md +2 -1
  2. package/.opencode/skills/ci-failure-batching/SKILL.md +2 -1
  3. package/.opencode/skills/ci-fix-monitor/SKILL.md +2 -1
  4. package/.opencode/skills/clarify/SKILL.md +2 -1
  5. package/.opencode/skills/clarify-spec/SKILL.md +2 -1
  6. package/.opencode/skills/codebase-review-swarm/SKILL.md +1 -1
  7. package/.opencode/skills/commit-pr/SKILL.md +3 -2
  8. package/.opencode/skills/consult/SKILL.md +2 -1
  9. package/.opencode/skills/council/SKILL.md +2 -1
  10. package/.opencode/skills/critic-gate/SKILL.md +2 -1
  11. package/.opencode/skills/deep-dive/SKILL.md +2 -1
  12. package/.opencode/skills/deep-research/SKILL.md +2 -1
  13. package/.opencode/skills/design-docs/SKILL.md +2 -1
  14. package/.opencode/skills/discover/SKILL.md +2 -1
  15. package/.opencode/skills/durable-session-state/SKILL.md +2 -1
  16. package/.opencode/skills/engineering-conventions/SKILL.md +2 -1
  17. package/.opencode/skills/execute/SKILL.md +2 -1
  18. package/.opencode/skills/fork-pr-operations/SKILL.md +2 -1
  19. package/.opencode/skills/gate-attribution/SKILL.md +2 -1
  20. package/.opencode/skills/issue-ingest/SKILL.md +2 -1
  21. package/.opencode/skills/issue-tracer/SKILL.md +1 -1
  22. package/.opencode/skills/loop/SKILL.md +2 -1
  23. package/.opencode/skills/merge-queue-readiness/SKILL.md +2 -1
  24. package/.opencode/skills/orchestrating-subagents/SKILL.md +2 -1
  25. package/.opencode/skills/parallel-work-check/SKILL.md +17 -16
  26. package/.opencode/skills/phase-wrap/SKILL.md +2 -1
  27. package/.opencode/skills/pre-phase-briefing/SKILL.md +2 -1
  28. package/.opencode/skills/running-tests/SKILL.md +2 -1
  29. package/.opencode/skills/skill-edit-validation/SKILL.md +2 -1
  30. package/.opencode/skills/specify/SKILL.md +2 -1
  31. package/.opencode/skills/swarm/SKILL.md +2 -1
  32. package/.opencode/skills/swarm-ci-monitor/SKILL.md +3 -2
  33. package/.opencode/skills/swarm-implement/SKILL.md +2 -1
  34. package/.opencode/skills/swarm-plan/SKILL.md +2 -1
  35. package/.opencode/skills/swarm-pr-feedback/SKILL.md +9 -162
  36. package/.opencode/skills/swarm-pr-feedback/references/gate-evidence-scope.md +20 -0
  37. package/.opencode/skills/swarm-pr-feedback/references/intake-surfaces.md +107 -0
  38. package/.opencode/skills/swarm-pr-feedback/references/preflight-checkout.md +67 -0
  39. package/.opencode/skills/swarm-pr-review/SKILL.md +12 -344
  40. package/.opencode/skills/swarm-pr-review/references/council-mode.md +38 -0
  41. package/.opencode/skills/swarm-pr-review/references/explorer-output-format.md +54 -0
  42. package/.opencode/skills/swarm-pr-review/references/findings-persistence-detail.md +15 -0
  43. package/.opencode/skills/swarm-pr-review/references/parser-candidate-extraction.md +75 -0
  44. package/.opencode/skills/swarm-pr-review/references/phase0a-intake.md +61 -0
  45. package/.opencode/skills/swarm-pr-review/references/scope-detection.md +103 -0
  46. package/.opencode/skills/swarm-pr-review/references/writeback-phases.md +68 -0
  47. package/.opencode/skills/swarm-pr-subscribe/SKILL.md +3 -2
  48. package/.opencode/skills/swarm-resume/SKILL.md +2 -1
  49. package/.opencode/skills/test-file-split/SKILL.md +2 -1
  50. package/.opencode/skills/worktree-retry-cleanup/SKILL.md +2 -1
  51. package/.opencode/skills/writing-tests/SKILL.md +7 -437
  52. package/.opencode/skills/writing-tests/references/cross-platform-patterns.md +237 -0
  53. package/.opencode/skills/writing-tests/references/mock-tiers.md +207 -0
  54. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  55. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  56. package/dist/cli/{auto-checkpoint-f00tk7sc.js → auto-checkpoint-1dv9a1w5.js} +4 -4
  57. package/dist/cli/{checkpoint-acztxqga.js → checkpoint-rkjb6kpr.js} +8 -8
  58. package/dist/cli/{coder-settlement-0ka4n1xf.js → coder-settlement-eavtvg8d.js} +3 -3
  59. package/dist/cli/{config-doctor-qv7wc6fa.js → config-doctor-4ck8e1fq.js} +7 -7
  60. package/dist/cli/{core-dmn3arr1.js → core-cyj0vphv.js} +1 -1
  61. package/dist/cli/{curator-drift-sxzs48ew.js → curator-drift-15mcxawb.js} +5 -5
  62. package/dist/cli/{curator-llm-factory-cvrt4bf9.js → curator-llm-factory-k0yebhsk.js} +25 -25
  63. package/dist/cli/{curator-891pc8b7.js → curator-p1r777m5.js} +25 -25
  64. package/dist/cli/{doctor-knowledge-receipt-phase-id-mvbj576e.js → doctor-knowledge-receipt-phase-id-k204028d.js} +4 -4
  65. package/dist/cli/{evidence-summary-service-x9nxvmn5.js → evidence-summary-service-4mx5ge81.js} +9 -9
  66. package/dist/cli/{gate-evidence-dxd20wrc.js → gate-evidence-pa8qadxh.js} +2 -2
  67. package/dist/cli/{guardrail-explain-fga9bnvt.js → guardrail-explain-pba5em4h.js} +26 -26
  68. package/dist/cli/{guardrail-log-y84b9m8n.js → guardrail-log-24fbykv3.js} +3 -3
  69. package/dist/cli/{guardrail-reset-xpcsxyt0.js → guardrail-reset-rfnr2vnn.js} +25 -25
  70. package/dist/cli/{hive-promoter-w1vchgfr.js → hive-promoter-0ht8jafr.js} +25 -25
  71. package/dist/cli/{index-hjma52c8.js → index-0sw6gjtn.js} +3 -3
  72. package/dist/cli/{index-mt5t492g.js → index-3h4tajza.js} +2 -2
  73. package/dist/cli/{index-t5med3ga.js → index-528gk6k1.js} +1 -1
  74. package/dist/cli/{index-nrqyc8pr.js → index-56n6nb7p.js} +25 -25
  75. package/dist/cli/{index-bjaef5zn.js → index-57g7yqx9.js} +390 -233
  76. package/dist/cli/{index-jnjvghgp.js → index-6g81mmmy.js} +4 -4
  77. package/dist/cli/{index-8bsnnnj2.js → index-9rqvm5sk.js} +2 -2
  78. package/dist/cli/{index-ryjp0wmq.js → index-9vwsvgzp.js} +1 -1
  79. package/dist/cli/{index-knxq5byr.js → index-a9bs0c71.js} +1 -1
  80. package/dist/cli/{index-3hpjqa6y.js → index-d0m3snqt.js} +1 -1
  81. package/dist/cli/{index-7zkgdefv.js → index-d483e4gz.js} +3 -3
  82. package/dist/cli/{index-sgt1d7ez.js → index-efen9p4c.js} +1 -1
  83. package/dist/cli/{index-w3mav870.js → index-f0d3z2ha.js} +2 -2
  84. package/dist/cli/{index-wscg5ryb.js → index-fmgkemn9.js} +1 -1
  85. package/dist/cli/{index-svbh91pz.js → index-h69nppa3.js} +1 -1
  86. package/dist/cli/{index-391ydd25.js → index-hyxw4j9t.js} +1 -1
  87. package/dist/cli/{index-41p9zzpe.js → index-kah11mjw.js} +153 -52
  88. package/dist/cli/{index-nqxbqb50.js → index-mwh6srje.js} +1 -1
  89. package/dist/cli/{index-psqfkgav.js → index-pek9gmwm.js} +3 -3
  90. package/dist/cli/{index-31b55cq9.js → index-pywrvjxj.js} +3 -3
  91. package/dist/cli/{index-2grr37ry.js → index-qae4572e.js} +1 -1
  92. package/dist/cli/{index-tzasccpd.js → index-qqe9tt5y.js} +1 -1
  93. package/dist/cli/{index-4cazf4kb.js → index-r9ab1sat.js} +27 -27
  94. package/dist/cli/{index-174j0g38.js → index-rqbhn0mh.js} +2 -2
  95. package/dist/cli/{index-te61qv0q.js → index-syrktqz9.js} +2 -2
  96. package/dist/cli/{index-3drq02r1.js → index-t4nxee8x.js} +1 -1
  97. package/dist/cli/{index-ppnpkww2.js → index-tstk9xx7.js} +1 -1
  98. package/dist/cli/{index-tjc68trf.js → index-vanjqbhp.js} +5 -5
  99. package/dist/cli/{index-vsa05smc.js → index-xtb61w73.js} +1 -1
  100. package/dist/cli/{index-7gqmqhzj.js → index-z5rkkhng.js} +6 -6
  101. package/dist/cli/index.js +26 -26
  102. package/dist/cli/{knowledge-escalator-2dy96d0j.js → knowledge-escalator-89crpby4.js} +7 -7
  103. package/dist/cli/{knowledge-events-70kb745b.js → knowledge-events-eyratqdp.js} +5 -5
  104. package/dist/cli/{knowledge-store-hvq03g0j.js → knowledge-store-kkwds05z.js} +1 -1
  105. package/dist/cli/{knowledge-validator-eaatcnkr.js → knowledge-validator-fww6p37v.js} +2 -2
  106. package/dist/cli/{mcp-bj3awdfy.js → mcp-8t3m998m.js} +1 -1
  107. package/dist/cli/{model-preflight-skhq4xtr.js → model-preflight-98g183my.js} +25 -25
  108. package/dist/cli/{pending-delegations-yamzv468.js → pending-delegations-qj5e0hh2.js} +2 -2
  109. package/dist/cli/{pr-subscriptions-hkzd0nr4.js → pr-subscriptions-edwd3syw.js} +1 -1
  110. package/dist/cli/{pr-workflow-gate-2gmznmj4.js → pr-workflow-gate-t8veygyh.js} +25 -25
  111. package/dist/cli/{scan-cursor-arezehhk.js → scan-cursor-0ffhpz79.js} +2 -2
  112. package/dist/cli/{schema-emx6r32d.js → schema-zytt0t7a.js} +1 -1
  113. package/dist/cli/{scope-persistence-tvr8w7ea.js → scope-persistence-p8a9a2xb.js} +5 -5
  114. package/dist/cli/{server-ez03wdw9.js → server-q4b9s64v.js} +25 -25
  115. package/dist/cli/{skill-generator-w0jy1mpc.js → skill-generator-wt7d640t.js} +8 -8
  116. package/dist/cli/{snapshot-coordination-init-2x56ds8a.js → snapshot-coordination-init-ywxyf130.js} +25 -25
  117. package/dist/cli/{speckit-checkoff-c2e5wezr.js → speckit-checkoff-y8na83hj.js} +3 -3
  118. package/dist/cli/{worktree-collision-ownership-1bgcea0v.js → worktree-collision-ownership-kssmhrpk.js} +2 -2
  119. package/dist/cli/{worktree-isolation-9xp4dz41.js → worktree-isolation-w6np680v.js} +25 -25
  120. package/dist/config/skill-contract-digest.d.ts +6 -0
  121. package/dist/hooks/pr-workflow-gate.d.ts +12 -0
  122. package/dist/hooks/pr-workflow-response-gate.d.ts +8 -0
  123. package/dist/hooks/skill-scoring.d.ts +1 -1
  124. package/dist/hooks/skill-usage-log.d.ts +2 -0
  125. package/dist/index.js +30 -28
  126. package/dist/pr-review/persistence.d.ts +18 -1
  127. package/dist/services/skill-evaluator.d.ts +2 -0
  128. package/dist/services/skill-generator.d.ts +13 -0
  129. package/package.json +1 -1
@@ -8,14 +8,14 @@ import {
8
8
  protectedRoots,
9
9
  redactDecisionLineForArchive,
10
10
  stableCanonicalStringify
11
- } from "./index-t5med3ga.js";
11
+ } from "./index-528gk6k1.js";
12
12
  import {
13
13
  detectStraySwarmDirs,
14
14
  readDoctorArtifact,
15
15
  removeStraySwarmDir,
16
16
  resolvePlanParallelizationFlag,
17
17
  runConfigDoctor
18
- } from "./index-hjma52c8.js";
18
+ } from "./index-0sw6gjtn.js";
19
19
  import {
20
20
  archiveEvidence,
21
21
  checkRequirementCoverage,
@@ -27,7 +27,7 @@ import {
27
27
  sanitizeTaskId,
28
28
  saveEvidence,
29
29
  validateProjectRoot
30
- } from "./index-2grr37ry.js";
30
+ } from "./index-qae4572e.js";
31
31
  import {
32
32
  JAVA_SYMBOL_GRAMMAR,
33
33
  LANGUAGE_REGISTRY,
@@ -89,7 +89,7 @@ import {
89
89
  alreadyCuratedThisGeneration,
90
90
  claimNextScanBatch,
91
91
  resolveCohortId
92
- } from "./index-knxq5byr.js";
92
+ } from "./index-a9bs0c71.js";
93
93
  import {
94
94
  CURATOR_CONSOLIDATION_PROMPT,
95
95
  CURATOR_INIT_PROMPT,
@@ -108,13 +108,13 @@ import {
108
108
  getGroupCommitWriter,
109
109
  importLegacyJsonl,
110
110
  readPriorDriftReports
111
- } from "./index-sgt1d7ez.js";
111
+ } from "./index-efen9p4c.js";
112
112
  import {
113
113
  assertNoUnsettledCoderDispatch,
114
114
  listCoderSettlementWalStates,
115
115
  recoverCoderSettlement,
116
116
  recoverStaleCoderSettlements
117
- } from "./index-7zkgdefv.js";
117
+ } from "./index-d483e4gz.js";
118
118
  import {
119
119
  BUNDLED_PROJECT_SKILL_ROOT,
120
120
  DEFAULT_SKILL_MIN_CONFIDENCE,
@@ -134,12 +134,14 @@ import {
134
134
  retireOrMarkStale,
135
135
  retireSkill,
136
136
  selectCandidateEntries,
137
+ skillContractDigest,
138
+ splitSkillFrontmatter,
137
139
  syncBundledProjectSkillsIfMissingAsync
138
- } from "./index-41p9zzpe.js";
140
+ } from "./index-kah11mjw.js";
139
141
  import {
140
142
  buildEscalationBriefing,
141
143
  readRecentEscalations
142
- } from "./index-7gqmqhzj.js";
144
+ } from "./index-z5rkkhng.js";
143
145
  import {
144
146
  parsePorcelainV2Snapshot,
145
147
  resolveCommitCountSince,
@@ -223,7 +225,7 @@ import {
223
225
  swarmOverwriteCandidates,
224
226
  trackedDirtyCandidates,
225
227
  transientBackoff
226
- } from "./index-31b55cq9.js";
228
+ } from "./index-pywrvjxj.js";
227
229
  import {
228
230
  EPIC_MODE_CONFIG_DISABLED_MESSAGE,
229
231
  PlanRecoverySupersededError,
@@ -255,7 +257,7 @@ import {
255
257
  updateEpicRecord,
256
258
  updateTaskStatus,
257
259
  withPlanLifecycleLock
258
- } from "./index-tjc68trf.js";
260
+ } from "./index-vanjqbhp.js";
259
261
  import {
260
262
  containsControlChars,
261
263
  containsPathTraversal,
@@ -271,7 +273,7 @@ import {
271
273
  resolveSpeckitProjection,
272
274
  validateSpeckit,
273
275
  writeProjectedSpecSync
274
- } from "./index-ryjp0wmq.js";
276
+ } from "./index-9vwsvgzp.js";
275
277
  import {
276
278
  clearWorktreeMergeStatus,
277
279
  getAllWorktreeMergeFailures,
@@ -303,7 +305,7 @@ import {
303
305
  transitionTaskWorkflowEvidenceWithStatus,
304
306
  withTaskEvidenceTransaction,
305
307
  writeWorkflowWalFile
306
- } from "./index-3drq02r1.js";
308
+ } from "./index-t4nxee8x.js";
307
309
  import {
308
310
  isPathUnderSwarmWorktreeBase,
309
311
  listLiveLaneOwners,
@@ -312,7 +314,7 @@ import {
312
314
  recordLiveLaneOwner,
313
315
  removeWorktree,
314
316
  resolveWorktreeBaseDir
315
- } from "./index-391ydd25.js";
317
+ } from "./index-hyxw4j9t.js";
316
318
  import {
317
319
  GitBinaryMissingError,
318
320
  GitSpawnCwdError,
@@ -354,7 +356,7 @@ import {
354
356
  scanBackgroundCoderReservationsForAdmission,
355
357
  scanDelegationsForRecovery,
356
358
  sweepStaleDelegations
357
- } from "./index-vsa05smc.js";
359
+ } from "./index-xtb61w73.js";
358
360
  import {
359
361
  MAX_EVENT_LOG_ENTRIES,
360
362
  _internals,
@@ -366,7 +368,7 @@ import {
366
368
  recordHiveKnowledgeEvent,
367
369
  recordKnowledgeEvent,
368
370
  resolveKnowledgeEventsPath
369
- } from "./index-mt5t492g.js";
371
+ } from "./index-3h4tajza.js";
370
372
  import {
371
373
  commitDisplayedMembership,
372
374
  commitEmptyRetrieval,
@@ -379,7 +381,7 @@ import {
379
381
  queryLiveMemberships,
380
382
  reconcilePhaseClose,
381
383
  recordPhaseCloseIntent
382
- } from "./index-te61qv0q.js";
384
+ } from "./index-syrktqz9.js";
383
385
  import {
384
386
  sanitizeContextText
385
387
  } from "./index-m9zzj4ee.js";
@@ -410,7 +412,7 @@ import {
410
412
  validateActionableFields,
411
413
  validateLesson,
412
414
  validateSkillPath
413
- } from "./index-wscg5ryb.js";
415
+ } from "./index-fmgkemn9.js";
414
416
  import {
415
417
  MAX_CURATION_PROPOSALS,
416
418
  authorizeCuration,
@@ -421,7 +423,7 @@ import {
421
423
  } from "./index-rtry5xyf.js";
422
424
  import {
423
425
  resolveWorktreeIsolationConfig
424
- } from "./index-8bsnnnj2.js";
426
+ } from "./index-9rqvm5sk.js";
425
427
  import {
426
428
  RetrospectiveEvidenceSchema
427
429
  } from "./index-g22dps7x.js";
@@ -433,7 +435,7 @@ import {
433
435
  clearScopeBindings,
434
436
  readAuthoritativeScopeBindingSet,
435
437
  readDeclaredScopeFilesFromBindings
436
- } from "./index-tzasccpd.js";
438
+ } from "./index-qqe9tt5y.js";
437
439
  import {
438
440
  approvedSnapshotCoversPlan,
439
441
  clearPlanLedgerForReset,
@@ -450,7 +452,7 @@ import {
450
452
  replayFromLedgerWithStatus,
451
453
  resolvePlanningProfile,
452
454
  takeSnapshotEvent
453
- } from "./index-174j0g38.js";
455
+ } from "./index-rqbhn0mh.js";
454
456
  import {
455
457
  CORE_EVENT_LOCKED,
456
458
  appendCoreEventSync,
@@ -539,7 +541,7 @@ import {
539
541
  transactFile,
540
542
  transactKnowledge,
541
543
  wordBigrams
542
- } from "./index-jnjvghgp.js";
544
+ } from "./index-6g81mmmy.js";
543
545
  import {
544
546
  readTailJsonl,
545
547
  readTailJsonlDetailed,
@@ -624,7 +626,7 @@ import {
624
626
  loadPluginConfig,
625
627
  loadPluginConfigWithMeta,
626
628
  resolveEpicConfig
627
- } from "./index-ppnpkww2.js";
629
+ } from "./index-tstk9xx7.js";
628
630
  import {
629
631
  GIT_BINARY_ENV_VAR,
630
632
  addDeferredWarning,
@@ -657,7 +659,7 @@ import {
657
659
  resolveContextWindow,
658
660
  resolveGeneratedAgentRole,
659
661
  stripKnownSwarmPrefix
660
- } from "./index-nqxbqb50.js";
662
+ } from "./index-mwh6srje.js";
661
663
  import {
662
664
  AGENT_TOOL_MAP,
663
665
  ALL_AGENT_NAMES,
@@ -830,7 +832,7 @@ init_loader();
830
832
 
831
833
  // src/hooks/pr-workflow-gate.ts
832
834
  init_zod();
833
- import { createHash as createHash26, randomUUID as randomUUID6 } from "crypto";
835
+ import { createHash as createHash25, randomUUID as randomUUID6 } from "crypto";
834
836
  import * as fsp5 from "fs/promises";
835
837
  import * as path34 from "path";
836
838
 
@@ -3095,8 +3097,10 @@ function bindPrReviewPersistenceHooks(nextHooks) {
3095
3097
  hooks = nextHooks;
3096
3098
  }
3097
3099
  var codec;
3098
- function bindPrReviewStateCodec(nextCodec) {
3100
+ var observabilityFieldNames = [];
3101
+ function bindPrReviewStateCodec(nextCodec, nextObservabilityFieldNames) {
3099
3102
  codec = nextCodec;
3103
+ observabilityFieldNames = nextObservabilityFieldNames;
3100
3104
  }
3101
3105
  function requireCodec() {
3102
3106
  if (!codec) {
@@ -3457,7 +3461,7 @@ async function importLegacyPrWorkflowGateStateIfNeeded(directory, sessionID, all
3457
3461
  return null;
3458
3462
  throw error2;
3459
3463
  }
3460
- const legacy = allowSalvagedImport ? (await (await import("./pr-workflow-gate-2gmznmj4.js")).readPrWorkflowGateStateForRecovery(directory, sessionID))?.state ?? null : await readPrWorkflowGateStateFileFromDisk(filePath, sessionID);
3464
+ const legacy = allowSalvagedImport ? (await (await import("./pr-workflow-gate-t8veygyh.js")).readPrWorkflowGateStateForRecovery(directory, sessionID))?.state ?? null : await readPrWorkflowGateStateFileFromDisk(filePath, sessionID);
3461
3465
  if (!legacy)
3462
3466
  return null;
3463
3467
  const namespace = workflowGateStateCoordinationNamespace(sessionID);
@@ -3487,25 +3491,62 @@ async function importLegacyPrWorkflowGateStateIfNeeded(directory, sessionID, all
3487
3491
  }
3488
3492
  return authoritative;
3489
3493
  }
3490
- async function writeStateWhileLocked(directory, state, options = {}) {
3494
+ function withDurableObservabilityFields(incoming, current) {
3495
+ if (!current || observabilityFieldNames.length === 0)
3496
+ return incoming;
3497
+ const merged = {
3498
+ ...{ ...incoming }
3499
+ };
3500
+ const durable = current;
3501
+ const instanceReplaced = current.workflowInstanceId !== undefined && current.workflowInstanceId !== incoming.workflowInstanceId;
3502
+ for (const field of observabilityFieldNames) {
3503
+ if (instanceReplaced)
3504
+ delete merged[field];
3505
+ else if (durable[field] !== undefined)
3506
+ merged[field] = durable[field];
3507
+ else
3508
+ delete merged[field];
3509
+ }
3510
+ return merged;
3511
+ }
3512
+ function enforceObservabilityOnlyMutation(validated, current) {
3513
+ if (!current)
3514
+ return;
3515
+ const incoming = validated;
3516
+ const durable = current;
3517
+ const skip = new Set(observabilityFieldNames);
3518
+ skip.add("updatedAt");
3519
+ skip.add("revision");
3520
+ const keys = new Set([...Object.keys(incoming), ...Object.keys(durable)]);
3521
+ for (const key of keys) {
3522
+ if (skip.has(key))
3523
+ continue;
3524
+ if (JSON.stringify(incoming[key]) !== JSON.stringify(durable[key])) {
3525
+ throw new Error(`BLOCKED: appendObservabilityStateWhileLocked may change only observability fields and updatedAt; field "${key}" also differs from the durable state`);
3526
+ }
3527
+ }
3528
+ }
3529
+ async function persistStateRowWhileLocked(directory, validated, bumpRevision, options = {}) {
3491
3530
  const bound = requireCodec();
3492
- const validated = bound.parse(state);
3493
3531
  let currentAuthoritative = readPrWorkflowGateStateCoordinationRow(directory, validated.sessionID);
3494
3532
  let current = currentAuthoritative?.state ?? null;
3495
3533
  if (!current) {
3496
3534
  current = await readPrWorkflowGateStateFromDisk(directory, validated.sessionID);
3497
3535
  currentAuthoritative = readPrWorkflowGateStateCoordinationRow(directory, validated.sessionID);
3498
3536
  }
3537
+ let effective = validated;
3538
+ if (bumpRevision) {
3539
+ effective = withDurableObservabilityFields(validated, current);
3540
+ } else {
3541
+ enforceObservabilityOnlyMutation(validated, current);
3542
+ }
3499
3543
  if (current ? current.revision !== validated.revision : validated.revision !== 0) {
3500
3544
  throw new Error("BLOCKED: PR workflow gate state changed concurrently; reload the active session state before retrying");
3501
3545
  }
3502
3546
  if (current?.workflowInstanceId && validated.workflowInstanceId !== current.workflowInstanceId && options.replaceWorkflowInstanceId !== current.workflowInstanceId) {
3503
3547
  throw new Error("BLOCKED: PR workflow gate state changed concurrently; reload the active session state before retrying");
3504
3548
  }
3505
- const nextState = bound.parse({
3506
- ...validated,
3507
- revision: validated.revision + 1
3508
- });
3549
+ const nextState = bound.parse(bumpRevision ? { ...effective, revision: validated.revision + 1 } : effective);
3509
3550
  const result = transitionCoordinationState(directory, {
3510
3551
  namespace: workflowGateStateCoordinationNamespace(validated.sessionID),
3511
3552
  entityKey: WORKFLOW_STATE_ENTITY_KEY,
@@ -3521,6 +3562,16 @@ async function writeStateWhileLocked(directory, state, options = {}) {
3521
3562
  rememberState(directory, nextState);
3522
3563
  return nextState;
3523
3564
  }
3565
+ async function writeStateWhileLocked(directory, state, options = {}) {
3566
+ const bound = requireCodec();
3567
+ const validated = bound.parse(state);
3568
+ return persistStateRowWhileLocked(directory, validated, true, options);
3569
+ }
3570
+ async function appendObservabilityStateWhileLocked(directory, state) {
3571
+ const bound = requireCodec();
3572
+ const validated = bound.parse(state);
3573
+ return persistStateRowWhileLocked(directory, validated, false);
3574
+ }
3524
3575
  async function deleteStateWhileLocked(directory, sessionID, options = {}) {
3525
3576
  const normalizedSessionID = normalizeSessionID(sessionID);
3526
3577
  let currentAuthoritative = null;
@@ -3544,7 +3595,7 @@ async function deleteStateWhileLocked(directory, sessionID, options = {}) {
3544
3595
  let recoveryState = null;
3545
3596
  if (!currentAuthoritative) {
3546
3597
  if (options.allowSalvagedRead) {
3547
- const { readPrWorkflowGateStateForRecovery } = await import("./pr-workflow-gate-2gmznmj4.js");
3598
+ const { readPrWorkflowGateStateForRecovery } = await import("./pr-workflow-gate-t8veygyh.js");
3548
3599
  recoveryState = (await readPrWorkflowGateStateForRecovery(directory, normalizedSessionID))?.state ?? null;
3549
3600
  }
3550
3601
  if (!recoveryState) {
@@ -7019,30 +7070,6 @@ import * as fs4 from "fs";
7019
7070
  import * as os2 from "os";
7020
7071
  import * as path9 from "path";
7021
7072
  import { fileURLToPath } from "url";
7022
-
7023
- // src/config/skill-contract-digest.ts
7024
- import { createHash as createHash11 } from "crypto";
7025
- function splitSkillFrontmatter(content) {
7026
- if (!content.startsWith(`---
7027
- `))
7028
- return { frontmatter: "", body: content };
7029
- const end = content.indexOf(`
7030
- ---
7031
- `, 4);
7032
- if (end === -1)
7033
- return { frontmatter: "", body: content };
7034
- return {
7035
- frontmatter: content.slice(0, end + 5),
7036
- body: content.slice(end + 5)
7037
- };
7038
- }
7039
- function skillContractDigest(body) {
7040
- const normalized = body.replace(/\r\n/g, `
7041
- `);
7042
- return createHash11("sha256").update(normalized, "utf8").digest("hex").slice(0, 12);
7043
- }
7044
-
7045
- // src/services/pr-workflow-skill-contract.ts
7046
7073
  init_warning_buffer();
7047
7074
  var PR_WORKFLOW_MODE_SKILL = {
7048
7075
  PR_REVIEW: "swarm-pr-review",
@@ -7155,7 +7182,7 @@ init_schema();
7155
7182
 
7156
7183
  // src/council/council-review-identity.ts
7157
7184
  init_schema();
7158
- import { createHash as createHash12 } from "crypto";
7185
+ import { createHash as createHash11 } from "crypto";
7159
7186
  var COUNCIL_REVIEW_IDENTITY_VERSION = 2;
7160
7187
  function computeCouncilReviewHash(plan) {
7161
7188
  const normalized = {
@@ -7182,7 +7209,7 @@ function computeCouncilReviewHash(plan) {
7182
7209
  }))
7183
7210
  }))
7184
7211
  };
7185
- return createHash12("sha256").update(JSON.stringify(normalized), "utf8").digest("hex");
7212
+ return createHash11("sha256").update(JSON.stringify(normalized), "utf8").digest("hex");
7186
7213
  }
7187
7214
  function computeCouncilPolicyDigest(level, config) {
7188
7215
  const base = {
@@ -7210,7 +7237,7 @@ function computeCouncilPolicyDigest(level, config) {
7210
7237
  minimumMembers: config?.minimumMembers ?? 3
7211
7238
  };
7212
7239
  }
7213
- return createHash12("sha256").update(JSON.stringify(normalized), "utf8").digest("hex");
7240
+ return createHash11("sha256").update(JSON.stringify(normalized), "utf8").digest("hex");
7214
7241
  }
7215
7242
  function resolveFinalCompletionPolicy(config) {
7216
7243
  const policy = config?.finalCompletionPolicy;
@@ -7235,7 +7262,7 @@ function computeCouncilReviewIdentity(input) {
7235
7262
  };
7236
7263
  return {
7237
7264
  ...identity,
7238
- identityDigest: createHash12("sha256").update(JSON.stringify(identity), "utf8").digest("hex")
7265
+ identityDigest: createHash11("sha256").update(JSON.stringify(identity), "utf8").digest("hex")
7239
7266
  };
7240
7267
  }
7241
7268
 
@@ -7529,7 +7556,7 @@ import * as fs21 from "fs";
7529
7556
  import * as path31 from "path";
7530
7557
 
7531
7558
  // src/background/stage-b-dispatch-binding-store.ts
7532
- import { createHash as createHash13 } from "crypto";
7559
+ import { createHash as createHash12 } from "crypto";
7533
7560
  var STAGE_B_BINDINGS_DIR = "stage-b-dispatch-bindings";
7534
7561
  var STAGE_B_BINDING_MAX_BYTES = 64 * 1024;
7535
7562
  var STAGE_B_BINDING_TTL_MS = 24 * 60 * 60 * 1000;
@@ -7559,7 +7586,7 @@ var WINDOWS_RESERVED = new Set([
7559
7586
  "LPT9"
7560
7587
  ]);
7561
7588
  function stageBSessionDirName(sessionID) {
7562
- return createHash13("sha256").update(sessionID).digest("hex").slice(0, 24);
7589
+ return createHash12("sha256").update(sessionID).digest("hex").slice(0, 24);
7563
7590
  }
7564
7591
 
7565
7592
  // src/hooks/delegation-gate.ts
@@ -9153,7 +9180,7 @@ import * as path18 from "path";
9153
9180
  // src/hooks/delegation-gate/worktree-isolation.ts
9154
9181
  init_constants();
9155
9182
  init_schema();
9156
- import { createHash as createHash17 } from "crypto";
9183
+ import { createHash as createHash16 } from "crypto";
9157
9184
  import * as fs10 from "fs/promises";
9158
9185
  import * as path16 from "path";
9159
9186
 
@@ -9161,7 +9188,7 @@ import * as path16 from "path";
9161
9188
  init_logger();
9162
9189
 
9163
9190
  // src/epic/plan-key.ts
9164
- import { createHash as createHash14 } from "crypto";
9191
+ import { createHash as createHash13 } from "crypto";
9165
9192
  var SWARM_PLAN_TRAILER_KEY = "Swarm-Plan";
9166
9193
  var SWARM_TASK_SUBJECT_RE = /^swarm\(task ([^)]+)\):/;
9167
9194
  var TRAILER_LINE_RE = /^Swarm-Plan:[ \t]*(\S+)[ \t]*$/;
@@ -9175,7 +9202,7 @@ function scrubTaskIdForGitSubject(taskId) {
9175
9202
  return taskId.replace(/[^a-zA-Z0-9._-]/g, "_");
9176
9203
  }
9177
9204
  function computePlanKey(planIdentityHash, planEpoch) {
9178
- return createHash14("sha256").update(`${planIdentityHash}|${planEpoch ?? ""}`, "utf8").digest("hex").slice(0, 16);
9205
+ return createHash13("sha256").update(`${planIdentityHash}|${planEpoch ?? ""}`, "utf8").digest("hex").slice(0, 16);
9179
9206
  }
9180
9207
  function formatSwarmPlanTrailer(planKey) {
9181
9208
  return `${SWARM_PLAN_TRAILER_KEY}: ${planKey}`;
@@ -9450,7 +9477,7 @@ var _internals19 = {
9450
9477
  init_git_executable();
9451
9478
  init_logger();
9452
9479
  // src/hooks/reviewer-scope-file-fingerprint.ts
9453
- import { createHash as createHash15 } from "crypto";
9480
+ import { createHash as createHash14 } from "crypto";
9454
9481
  import * as fs7 from "fs";
9455
9482
  import * as path14 from "path";
9456
9483
  var RETRYABLE_CAPTURE_FAILURE_CODES = new Set([
@@ -9736,7 +9763,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
9736
9763
  retryable: true
9737
9764
  };
9738
9765
  }
9739
- const hash = createHash15("sha256");
9766
+ const hash = createHash14("sha256");
9740
9767
  const chunk = Buffer.alloc(REVIEWER_SCOPE_CAPTURE_CHUNK_BYTES);
9741
9768
  let totalBytes = 0;
9742
9769
  for (;; ) {
@@ -10092,7 +10119,7 @@ var _internals22 = {
10092
10119
  };
10093
10120
 
10094
10121
  // src/hooks/delegation-gate/worktree-recovery-authority.ts
10095
- import { createHash as createHash16, randomBytes } from "crypto";
10122
+ import { createHash as createHash15, randomBytes } from "crypto";
10096
10123
  import * as fs9 from "fs";
10097
10124
  import * as path15 from "path";
10098
10125
  var STORE_RELATIVE_PATH = path15.join(".swarm", "worktree-merge-recovery-v2.json");
@@ -10111,7 +10138,7 @@ function nowMs(input) {
10111
10138
  return input ?? Date.now();
10112
10139
  }
10113
10140
  function sha2562(input) {
10114
- return createHash16("sha256").update(input).digest("hex");
10141
+ return createHash15("sha256").update(input).digest("hex");
10115
10142
  }
10116
10143
  function storePath2(directory) {
10117
10144
  return path15.join(directory, STORE_RELATIVE_PATH);
@@ -11342,7 +11369,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
11342
11369
  return extracted === expectedSessionId;
11343
11370
  }
11344
11371
  async function inspectStandardWorktreeCollisionOwnership(identity) {
11345
- const collisionOwnership = await import("./worktree-collision-ownership-1bgcea0v.js");
11372
+ const collisionOwnership = await import("./worktree-collision-ownership-kssmhrpk.js");
11346
11373
  return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
11347
11374
  }
11348
11375
  async function runRecoveryGit(directory, args, timeoutMs = 15000) {
@@ -11770,7 +11797,7 @@ async function precreateStandardWorktreeSession(args) {
11770
11797
  const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, handle.worktreePath);
11771
11798
  if (laneProfile) {
11772
11799
  try {
11773
- const { writeLaneProfileToDiskReal } = await import("./core-dmn3arr1.js");
11800
+ const { writeLaneProfileToDiskReal } = await import("./core-cyj0vphv.js");
11774
11801
  await writeLaneProfileToDiskReal(handle.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
11775
11802
  } catch {}
11776
11803
  }
@@ -11935,7 +11962,7 @@ async function preserveBackgroundWorktreeOwnershipForCallId(callID) {
11935
11962
  }
11936
11963
  const session = Buffer.from(dispatch.handle.sessionId, "utf8").toString("base64url");
11937
11964
  const lane = Buffer.from(dispatch.handle.id, "utf8").toString("base64url");
11938
- const callDigest = createHash17("sha256").update(callID).digest("hex").slice(0, 12);
11965
+ const callDigest = createHash16("sha256").update(callID).digest("hex").slice(0, 12);
11939
11966
  const tag = `swarm-preserved-owner/${session}/${lane}/${callDigest}`;
11940
11967
  let tagProc;
11941
11968
  try {
@@ -12764,7 +12791,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
12764
12791
  }
12765
12792
  clearWorktreeMergeStatus(statusKey);
12766
12793
  try {
12767
- const { removeLaneProfileFromDiskReal } = await import("./core-dmn3arr1.js");
12794
+ const { removeLaneProfileFromDiskReal } = await import("./core-cyj0vphv.js");
12768
12795
  await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
12769
12796
  } catch {}
12770
12797
  const state = serializationStateBySessionID.get(dispatch.parentSessionID);
@@ -13347,7 +13374,7 @@ function summarizeEpicLearning(stats, hotExcess, limit = 10) {
13347
13374
 
13348
13375
  // src/epic/learning-store.ts
13349
13376
  init_zod();
13350
- import { createHash as createHash18 } from "crypto";
13377
+ import { createHash as createHash17 } from "crypto";
13351
13378
  import * as fs11 from "fs";
13352
13379
  import * as path17 from "path";
13353
13380
  init_logger();
@@ -13449,7 +13476,7 @@ function readBounded(filePath) {
13449
13476
  return fs11.readFileSync(filePath, "utf-8");
13450
13477
  }
13451
13478
  function sha2563(text) {
13452
- return createHash18("sha256").update(text).digest("hex");
13479
+ return createHash17("sha256").update(text).digest("hex");
13453
13480
  }
13454
13481
  function directoryProbe(directory) {
13455
13482
  return (entry) => {
@@ -14600,7 +14627,7 @@ init_schema();
14600
14627
  init_config();
14601
14628
 
14602
14629
  // src/security/command-classifier.ts
14603
- import { createHash as createHash19 } from "crypto";
14630
+ import { createHash as createHash18 } from "crypto";
14604
14631
 
14605
14632
  // src/hooks/guardrails/destructive-command.ts
14606
14633
  import * as fsSync2 from "fs";
@@ -15411,7 +15438,7 @@ var SAFE = [
15411
15438
  ];
15412
15439
  var BLOCK_RULES_BY_ID = new Map([...CATASTROPHIC, ...DESTRUCTIVE].map((rule) => [rule.id, rule]));
15413
15440
  function digest(value) {
15414
- return createHash19("sha256").update(value).digest("hex");
15441
+ return createHash18("sha256").update(value).digest("hex");
15415
15442
  }
15416
15443
  function hasAmbiguousSyntax(value) {
15417
15444
  let single = false;
@@ -18149,6 +18176,10 @@ function parseGeneratedFromKnowledge(content) {
18149
18176
  if (!frontmatterMatch)
18150
18177
  return [];
18151
18178
  const body = frontmatterMatch[1];
18179
+ const jsonMatch = body.match(/^\s+generated_from_knowledge:\s*'?\[([^\]]*)\]'?\s*$/m);
18180
+ if (jsonMatch) {
18181
+ return jsonMatch[1].split(",").map((entry) => entry.trim().replace(/^["']|["']$/g, "")).filter(Boolean);
18182
+ }
18152
18183
  const ids = [];
18153
18184
  const sectionRegex = /generated_from_knowledge\s*:\s*\n((?:\s+-\s+\S+[^\n]*\n?)+)/;
18154
18185
  const sectionMatch = body.match(sectionRegex);
@@ -18479,6 +18510,61 @@ function collectAudienceYamlList(lines, start, end) {
18479
18510
  nextIndex: i - 1
18480
18511
  };
18481
18512
  }
18513
+ function collectMetadataChildren(lines, start, end) {
18514
+ const children = new Map;
18515
+ const duplicateKeys = new Set;
18516
+ let i = start;
18517
+ let current = null;
18518
+ for (;i < end; i++) {
18519
+ const line = lines[i] ?? "";
18520
+ if (line.trim() === "")
18521
+ continue;
18522
+ if (!/^\s/.test(line))
18523
+ break;
18524
+ const childMatch = line.match(/^\s+([A-Za-z_][A-Za-z0-9_-]*)\s*:\s*(.*)$/);
18525
+ if (childMatch) {
18526
+ const key = childMatch[1].toLowerCase();
18527
+ if (children.has(key)) {
18528
+ duplicateKeys.add(key);
18529
+ current = null;
18530
+ continue;
18531
+ }
18532
+ const child = {
18533
+ inline: stripQuotes(childMatch[2].trim()).replace(/''/g, "'"),
18534
+ listItems: []
18535
+ };
18536
+ children.set(key, child);
18537
+ current = { child };
18538
+ continue;
18539
+ }
18540
+ const itemMatch = line.match(/^\s+-\s+(.+?)\s*$/);
18541
+ if (itemMatch && current) {
18542
+ current.child.listItems.push(itemMatch[1]);
18543
+ }
18544
+ }
18545
+ return { children, duplicateKeys, nextIndex: i - 1 };
18546
+ }
18547
+ function resolveAudiencePair(metadataAudience, topLevelAudience) {
18548
+ if (metadataAudience.status === "absent")
18549
+ return topLevelAudience;
18550
+ if (metadataAudience.status !== "valid")
18551
+ return { status: "invalid", values: [] };
18552
+ if (topLevelAudience.status === "absent")
18553
+ return metadataAudience;
18554
+ if (topLevelAudience.status !== "valid")
18555
+ return { status: "invalid", values: [] };
18556
+ const sortKey = (values) => [...values].sort().join("\x00");
18557
+ return sortKey(metadataAudience.values) === sortKey(topLevelAudience.values) ? metadataAudience : { status: "invalid", values: [] };
18558
+ }
18559
+ function parseMetadataAudienceChild(child) {
18560
+ if (child.inline) {
18561
+ return parseInlineAudienceList(child.inline);
18562
+ }
18563
+ if (child.listItems.length === 0) {
18564
+ return { status: "invalid", values: [] };
18565
+ }
18566
+ return parseAudienceValues(child.listItems);
18567
+ }
18482
18568
  function isSkillAudienceMatch(metadata, context) {
18483
18569
  const audience = metadata.audience;
18484
18570
  if (!audience || audience.status === "absent")
@@ -18513,6 +18599,8 @@ function parseSkillFrontmatter(content, skillPath) {
18513
18599
  let skillType;
18514
18600
  let triggers = [];
18515
18601
  let audience = { status: "absent", values: [] };
18602
+ let metadataChildren = null;
18603
+ let duplicateMetadataBlocks = 0;
18516
18604
  for (let i = 1;i < end; i++) {
18517
18605
  const line = lines[i] ?? "";
18518
18606
  const match = line.match(/^([A-Za-z_][A-Za-z0-9_-]*)\s*:\s*(.*)$/);
@@ -18520,6 +18608,18 @@ function parseSkillFrontmatter(content, skillPath) {
18520
18608
  continue;
18521
18609
  const key = match[1].toLowerCase();
18522
18610
  const rawValue = match[2].trim();
18611
+ if (key === "metadata") {
18612
+ duplicateMetadataBlocks += 1;
18613
+ if (duplicateMetadataBlocks === 1) {
18614
+ const collected = collectMetadataChildren(lines, i + 1, end);
18615
+ metadataChildren = collected.children;
18616
+ if (collected.duplicateKeys.has("audience")) {
18617
+ audience = { status: "invalid", values: [] };
18618
+ }
18619
+ i = collected.nextIndex;
18620
+ }
18621
+ continue;
18622
+ }
18523
18623
  if (key === "name") {
18524
18624
  const parsed = stripQuotes(rawValue);
18525
18625
  if (parsed)
@@ -18552,7 +18652,7 @@ function parseSkillFrontmatter(content, skillPath) {
18552
18652
  audience = collected.audience;
18553
18653
  i = collected.nextIndex;
18554
18654
  } else {
18555
- audience = parseInlineAudienceList(rawValue);
18655
+ audience = parseInlineAudienceList(stripQuotes(rawValue));
18556
18656
  }
18557
18657
  continue;
18558
18658
  }
@@ -18572,6 +18672,24 @@ function parseSkillFrontmatter(content, skillPath) {
18572
18672
  description = stripQuotes(rawValue);
18573
18673
  }
18574
18674
  }
18675
+ if (duplicateMetadataBlocks > 1) {
18676
+ audience = { status: "invalid", values: [] };
18677
+ } else if (metadataChildren) {
18678
+ const audienceChild = metadataChildren.get("audience");
18679
+ if (audienceChild && audience.status !== "invalid") {
18680
+ audience = resolveAudiencePair(parseMetadataAudienceChild(audienceChild), audience);
18681
+ }
18682
+ const skillTypeChild = metadataChildren.get("skill_type");
18683
+ if (skillTypeChild) {
18684
+ const value = skillTypeChild.inline;
18685
+ if (value === "directive" || value === "workflow")
18686
+ skillType = value;
18687
+ }
18688
+ const triggersChild = metadataChildren.get("triggers");
18689
+ if (triggersChild) {
18690
+ triggers = triggersChild.inline ? normalizeTriggerList(parseInlineStringList(triggersChild.inline)) : normalizeTriggerList(triggersChild.listItems);
18691
+ }
18692
+ }
18575
18693
  const meta = {
18576
18694
  path: normalizedPath,
18577
18695
  frontmatterStatus: "valid",
@@ -21232,7 +21350,7 @@ init_schema();
21232
21350
 
21233
21351
  // src/failures/action-identity.ts
21234
21352
  init_schema();
21235
- import { createHash as createHash21 } from "crypto";
21353
+ import { createHash as createHash20 } from "crypto";
21236
21354
  var MAX_STRING_INPUT = 512;
21237
21355
  var MAX_PUBLIC_FIELD_LENGTH = 128;
21238
21356
  var MAX_COLLECTION_ITEMS = 64;
@@ -21286,7 +21404,7 @@ function normalizeToolName2(tool) {
21286
21404
  return tool.trim().toLowerCase() || "unknown-tool";
21287
21405
  }
21288
21406
  function hashString(value) {
21289
- return createHash21("sha256").update(value).digest("hex");
21407
+ return createHash20("sha256").update(value).digest("hex");
21290
21408
  }
21291
21409
  function readRecord(value) {
21292
21410
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
@@ -21531,7 +21649,7 @@ function createActionIdentity(input) {
21531
21649
  }
21532
21650
 
21533
21651
  // src/failures/invocation-failure.ts
21534
- import { createHash as createHash22 } from "crypto";
21652
+ import { createHash as createHash21 } from "crypto";
21535
21653
  var MAX_DISPLAY_BYTES = 512;
21536
21654
  var MAX_STRUCTURED_STRING = 128;
21537
21655
  function hasOwn(source, key) {
@@ -21555,7 +21673,7 @@ function boundedUtf8(value, maxBytes = MAX_DISPLAY_BYTES) {
21555
21673
  return buffer.subarray(0, maxBytes).toString("utf8").replace(/\uFFFD+$/g, "");
21556
21674
  }
21557
21675
  function hashValue(value) {
21558
- return createHash22("sha256").update(value).digest("hex");
21676
+ return createHash21("sha256").update(value).digest("hex");
21559
21677
  }
21560
21678
  function redactUrl(match) {
21561
21679
  try {
@@ -21895,7 +22013,7 @@ function getFullAutoRecoveryBlockers(input) {
21895
22013
  }
21896
22014
 
21897
22015
  // src/review/diff-source.ts
21898
- import { createHash as createHash23 } from "crypto";
22016
+ import { createHash as createHash22 } from "crypto";
21899
22017
  import * as fs19 from "fs";
21900
22018
  import * as path28 from "path";
21901
22019
  init_git_executable();
@@ -22307,7 +22425,7 @@ function uniqueSkipCodes(skipReasons) {
22307
22425
  return [...new Set(skipReasons.map((item) => item.code))].sort();
22308
22426
  }
22309
22427
  function hashManifestPayload(payload) {
22310
- return createHash23("sha256").update(JSON.stringify(payload), "utf8").digest("hex");
22428
+ return createHash22("sha256").update(JSON.stringify(payload), "utf8").digest("hex");
22311
22429
  }
22312
22430
  function parseObjectFormat(stdout) {
22313
22431
  const objectFormat = stdout.trim();
@@ -22395,7 +22513,7 @@ function hashWorkingTreeIdentity(root, rawPath, budget) {
22395
22513
  if (fileBytes > budget.remainingBytes) {
22396
22514
  return deadlineExceeded(`working-tree content identity exceeded the ${WORKTREE_IDENTITY_TOTAL_BYTES}-byte aggregate cap`);
22397
22515
  }
22398
- const hash = createHash23("sha256");
22516
+ const hash = createHash22("sha256");
22399
22517
  const buffer = Buffer.alloc(64 * 1024);
22400
22518
  let offset = 0;
22401
22519
  while (offset < fileBytes) {
@@ -22975,8 +23093,8 @@ async function collectReviewDiff(options) {
22975
23093
  canonicalText,
22976
23094
  fileListFallback: fileListFallback ?? null
22977
23095
  });
22978
- const scopeHash = createHash23("sha256").update(hashPayload, "utf8").digest("hex");
22979
- const reviewContentHash = createHash23("sha256").update(JSON.stringify({
23096
+ const scopeHash = createHash22("sha256").update(hashPayload, "utf8").digest("hex");
23097
+ const reviewContentHash = createHash22("sha256").update(JSON.stringify({
22980
23098
  selector,
22981
23099
  canonicalText,
22982
23100
  fileListFallback: fileListFallback ?? null
@@ -23180,7 +23298,7 @@ ${text}`;
23180
23298
  }
23181
23299
 
23182
23300
  // src/db/observability-event-store.ts
23183
- import { createHash as createHash24 } from "crypto";
23301
+ import { createHash as createHash23 } from "crypto";
23184
23302
  import { existsSync as existsSync11, readFileSync as readFileSync14, statSync as statSync10 } from "fs";
23185
23303
  import { join as join23 } from "path";
23186
23304
  var MAX_OBSERVABILITY_EVENT_ROWS = 50000;
@@ -23192,7 +23310,7 @@ var LINE_HASH_NAMESPACE = "obs-line-v1";
23192
23310
  var LINE_HASH_QUERY_CHUNK = 500;
23193
23311
  var LIVE_LINE_HASH_BACKFILL_MARKER = "__live_line_hash_backfill__";
23194
23312
  function lineHashOf(content) {
23195
- return createHash24("sha256").update(`${LINE_HASH_NAMESPACE}\x00${content}`).digest("hex");
23313
+ return createHash23("sha256").update(`${LINE_HASH_NAMESPACE}\x00${content}`).digest("hex");
23196
23314
  }
23197
23315
  function normalizeSegmentForLineHash(segment) {
23198
23316
  return segment.endsWith("\r") ? segment.slice(0, -1) : segment;
@@ -23249,7 +23367,7 @@ function runRetentionIfOverCap(db) {
23249
23367
  db.run("DELETE FROM observability_event WHERE rowid IN (SELECT rowid FROM observability_event ORDER BY rowid ASC LIMIT ?)", [excess]);
23250
23368
  }
23251
23369
  function syntheticImportEventId(line) {
23252
- return createHash24("sha256").update(`${IMPORT_ID_NAMESPACE}\x00${line}`).digest("hex");
23370
+ return createHash23("sha256").update(`${IMPORT_ID_NAMESPACE}\x00${line}`).digest("hex");
23253
23371
  }
23254
23372
  function unparseableImportRow(line, reason) {
23255
23373
  return {
@@ -23639,7 +23757,7 @@ function readOtlpExporterHealth(directory) {
23639
23757
 
23640
23758
  // src/services/task-cohort.ts
23641
23759
  init_logger();
23642
- import { createHash as createHash25 } from "crypto";
23760
+ import { createHash as createHash24 } from "crypto";
23643
23761
  import * as fs20 from "fs";
23644
23762
  import * as path29 from "path";
23645
23763
  var MANIFEST_DIGEST_LIMIT_BYTES = 64 * 1024;
@@ -23661,7 +23779,7 @@ function captureFileManifest(source, filePath, capturedAt) {
23661
23779
  try {
23662
23780
  const buffer = Buffer.alloc(MANIFEST_DIGEST_LIMIT_BYTES);
23663
23781
  const bytesRead = fs20.readSync(fd, buffer, 0, buffer.length, 0);
23664
- const digest2 = createHash25("sha256").update(buffer.subarray(0, bytesRead)).digest("hex");
23782
+ const digest2 = createHash24("sha256").update(buffer.subarray(0, bytesRead)).digest("hex");
23665
23783
  return {
23666
23784
  source,
23667
23785
  status: "captured",
@@ -23687,7 +23805,7 @@ function captureHostStatusManifest(capturedAt, strata) {
23687
23805
  if (runtime === "") {
23688
23806
  return { source: "host_status", status: "unavailable", capturedAt };
23689
23807
  }
23690
- const digest2 = createHash25("sha256").update(runtime).digest("hex");
23808
+ const digest2 = createHash24("sha256").update(runtime).digest("hex");
23691
23809
  return {
23692
23810
  source: "host_status",
23693
23811
  status: "captured",
@@ -23697,7 +23815,7 @@ function captureHostStatusManifest(capturedAt, strata) {
23697
23815
  }
23698
23816
  function manifestFileName(capturedAt, manifests) {
23699
23817
  const combined = manifests.map((m) => `${m.source}:${m.status}:${m.digest ?? "-"}`).join("|");
23700
- const suffix = createHash25("sha256").update(combined).digest("hex").slice(0, 12);
23818
+ const suffix = createHash24("sha256").update(combined).digest("hex").slice(0, 12);
23701
23819
  const epoch = Date.parse(capturedAt);
23702
23820
  const stamp = Number.isFinite(epoch) ? epoch : 0;
23703
23821
  return `${stamp}-${suffix}.json`;
@@ -29106,7 +29224,7 @@ function clearCriticalShownIds(sessionID) {
29106
29224
  async function rehydratePrSubscriptions(sessionID, directory) {
29107
29225
  const map = new Map;
29108
29226
  try {
29109
- const { listActive: listActive2 } = await import("./pr-subscriptions-hkzd0nr4.js");
29227
+ const { listActive: listActive2 } = await import("./pr-subscriptions-edwd3syw.js");
29110
29228
  const records = await listActive2(directory);
29111
29229
  for (const record of records) {
29112
29230
  if (record.sessionID !== sessionID)
@@ -29694,7 +29812,7 @@ async function appendPrWorkflowSkillContractAdvisories(directory, sessionID, adv
29694
29812
  }
29695
29813
  if (merged.length === current.length)
29696
29814
  return;
29697
- await writeStateWhileLocked(directory, {
29815
+ await appendObservabilityStateWhileLocked(directory, {
29698
29816
  ...existing,
29699
29817
  skillContractAdvisories: merged,
29700
29818
  updatedAt: isoNow()
@@ -29752,7 +29870,7 @@ async function recordPrReviewSubmitRejection(directory, childSessionId, message)
29752
29870
  message: bounded
29753
29871
  }
29754
29872
  ].slice(-MAX_PR_REVIEW_SUBMIT_REJECTIONS);
29755
- await writeStateWhileLocked(directory, {
29873
+ await appendObservabilityStateWhileLocked(directory, {
29756
29874
  ...locked,
29757
29875
  prReviewSubmitRejections: journal,
29758
29876
  updatedAt: isoNow()
@@ -29802,7 +29920,7 @@ async function recordPrReviewVerdictRejection(directory, sessionID, message, att
29802
29920
  message: bounded
29803
29921
  }
29804
29922
  ].slice(-MAX_PR_REVIEW_VERDICT_REJECTIONS);
29805
- await writeStateWhileLocked(directory, {
29923
+ await appendObservabilityStateWhileLocked(directory, {
29806
29924
  ...locked,
29807
29925
  prReviewVerdictRejections: journal,
29808
29926
  updatedAt: isoNow()
@@ -32492,7 +32610,7 @@ async function recordPrFeedbackStageA(directory, sessionID, revisionDigest, chec
32492
32610
  throw new Error(`BLOCKED: PR_FEEDBACK Stage A obligation ${obligation.id} requires exact validator contract provenance`);
32493
32611
  }
32494
32612
  }
32495
- const commandDigest = createHash26("sha256").update(`${check.obligationId ?? check.category}\x00${check.workingDirectory ?? "."}\x00${check.command.join("\x00")}`).digest("hex");
32613
+ const commandDigest = createHash25("sha256").update(`${check.obligationId ?? check.category}\x00${check.workingDirectory ?? "."}\x00${check.command.join("\x00")}`).digest("hex");
32496
32614
  if (commandDigests.has(commandDigest)) {
32497
32615
  throw new Error("BLOCKED: PR_FEEDBACK Stage A cannot reuse one command as multiple check receipts");
32498
32616
  }
@@ -33361,7 +33479,7 @@ function parseExactBoundPushIntent(command, armed) {
33361
33479
  return {
33362
33480
  ok: true,
33363
33481
  intent,
33364
- digest: createHash26("sha256").update(JSON.stringify(intent), "utf8").digest("hex")
33482
+ digest: createHash25("sha256").update(JSON.stringify(intent), "utf8").digest("hex")
33365
33483
  };
33366
33484
  }
33367
33485
  async function admitPrFeedbackPushAttempt(directory, sessionID, callID, intent, intentDigest) {
@@ -34152,7 +34270,7 @@ async function findOwnedPrReviewRunReservations(directory, sessionID, workflowIn
34152
34270
  return owned.sort();
34153
34271
  }
34154
34272
  function hashPrReviewFindingIds(ids) {
34155
- return createHash26("sha256").update([...new Set(ids)].sort().join("\x00"), "utf8").digest("hex");
34273
+ return createHash25("sha256").update([...new Set(ids)].sort().join("\x00"), "utf8").digest("hex");
34156
34274
  }
34157
34275
  async function readPrReviewRunReservation(directory, runId) {
34158
34276
  try {
@@ -34267,7 +34385,7 @@ async function readPrReviewFeedbackHandoffArtifact(directory, relativePath) {
34267
34385
  }
34268
34386
  return {
34269
34387
  artifact: parsed.data,
34270
- digest: createHash26("sha256").update(raw, "utf8").digest("hex")
34388
+ digest: createHash25("sha256").update(raw, "utf8").digest("hex")
34271
34389
  };
34272
34390
  }
34273
34391
  var PrReviewFindingProjectionSchema = exports_external.object({
@@ -34345,7 +34463,7 @@ async function readAuthoritativeFindingPolicy(directory, state) {
34345
34463
  const receipt = routeReceipt;
34346
34464
  const expectedPath = `pr-review/${runId}/findings.jsonl`;
34347
34465
  const raw = await readBoundedSwarmRegularFile2(directory, state.prReviewFindingsPath, PR_REVIEW_FINDINGS_MAX_BYTES, "PR_REVIEW final findings artifact");
34348
- const findingsDigest = createHash26("sha256").update(raw, "utf8").digest("hex");
34466
+ const findingsDigest = createHash25("sha256").update(raw, "utf8").digest("hex");
34349
34467
  if (receipt.version !== FINDING_POLICY_VERSION) {
34350
34468
  throw new Error(`BLOCKED: PR_REVIEW finding-policy route receipt version ${String(receipt.version)} does not match the current finding-policy version ${FINDING_POLICY_VERSION}; the sidecar was written by a different plugin version and cannot be trusted at this one`);
34351
34469
  }
@@ -34395,7 +34513,7 @@ function assertMatchingPrReviewFeedbackConsent(record, input) {
34395
34513
  }
34396
34514
  }
34397
34515
  function workflowIdentity(state) {
34398
- return state.workflowInstanceId ?? `legacy-${createHash26("sha256").update(`${state.sessionID}\x00${state.mode}\x00${state.activatedAt}`).digest("hex").slice(0, 32)}`;
34516
+ return state.workflowInstanceId ?? `legacy-${createHash25("sha256").update(`${state.sessionID}\x00${state.mode}\x00${state.activatedAt}`).digest("hex").slice(0, 32)}`;
34399
34517
  }
34400
34518
  function sameHandoffIds(left, right) {
34401
34519
  const normalizedLeft = [...new Set(left)].sort();
@@ -35399,7 +35517,11 @@ bindPrReviewPersistenceHooks(_test_exports2);
35399
35517
  bindPrReviewStateCodec({
35400
35518
  safeParse: (data) => PrWorkflowGateStateSchema.safeParse(data),
35401
35519
  parse: (data) => PrWorkflowGateStateSchema.parse(data)
35402
- });
35520
+ }, [
35521
+ "prReviewSubmitRejections",
35522
+ "prReviewVerdictRejections",
35523
+ "skillContractAdvisories"
35524
+ ]);
35403
35525
  bindPrReviewCompletionHelpers({
35404
35526
  createPrReviewGateContext: createPrReviewGateContext2,
35405
35527
  requireBoundState: requireBoundState2,
@@ -37944,7 +38066,7 @@ ${USAGE2}`;
37944
38066
  }
37945
38067
 
37946
38068
  // src/services/spec-drift-recovery.ts
37947
- import { createHash as createHash27 } from "crypto";
38069
+ import { createHash as createHash26 } from "crypto";
37948
38070
  import { mkdir as mkdir6, readFile as readFile10, unlink as unlink2 } from "fs/promises";
37949
38071
  import { dirname as dirname17 } from "path";
37950
38072
  var SPEC_DRIFT_RECOVERY_AGENT = "spec-drift-recovery";
@@ -37974,7 +38096,7 @@ function now() {
37974
38096
  return new Date().toISOString();
37975
38097
  }
37976
38098
  function sha2564(text) {
37977
- return createHash27("sha256").update(text, "utf-8").digest("hex");
38099
+ return createHash26("sha256").update(text, "utf-8").digest("hex");
37978
38100
  }
37979
38101
  function parseMarker(raw) {
37980
38102
  try {
@@ -38493,7 +38615,7 @@ ${USAGE3}`;
38493
38615
 
38494
38616
  // src/security/write-authority.ts
38495
38617
  import { AsyncLocalStorage } from "async_hooks";
38496
- import { createHash as createHash28, randomUUID as randomUUID7 } from "crypto";
38618
+ import { createHash as createHash27, randomUUID as randomUUID7 } from "crypto";
38497
38619
  import { existsSync as existsSync15, readFileSync as readFileSync17 } from "fs";
38498
38620
  import * as path35 from "path";
38499
38621
  var DEFAULT_TTL_MS = 30 * 60 * 1000;
@@ -38600,7 +38722,7 @@ function leastPrivilege(left, right) {
38600
38722
  return ORIGIN_RANK[left.origin] <= ORIGIN_RANK[right.origin] ? left : right;
38601
38723
  }
38602
38724
  function computeWriteApprovalHash(input) {
38603
- return createHash28("sha256").update(stableSerialize(input)).digest("hex");
38725
+ return createHash27("sha256").update(stableSerialize(input)).digest("hex");
38604
38726
  }
38605
38727
  function getCurrentWriteAuthority() {
38606
38728
  const extent = authorityStore.getStore();
@@ -43222,7 +43344,7 @@ import { promises as fs31 } from "fs";
43222
43344
  import path47 from "path";
43223
43345
 
43224
43346
  // src/services/swarm-residue.ts
43225
- import { createHash as createHash29 } from "crypto";
43347
+ import { createHash as createHash28 } from "crypto";
43226
43348
  import * as fs30 from "fs";
43227
43349
  import * as path45 from "path";
43228
43350
  var RESIDUE_STALE_AGE_MS = 30 * 60000;
@@ -43276,7 +43398,7 @@ var _internals52 = {
43276
43398
  return targets;
43277
43399
  },
43278
43400
  sha256File: (absPath) => {
43279
- const hash = createHash29("sha256");
43401
+ const hash = createHash28("sha256");
43280
43402
  const fd = fs30.openSync(absPath, "r");
43281
43403
  try {
43282
43404
  const chunk = Buffer.alloc(1024 * 1024);
@@ -45826,7 +45948,7 @@ var _internals56 = {
45826
45948
  import { existsSync as existsSync22 } from "fs";
45827
45949
 
45828
45950
  // src/hooks/knowledge-curator.ts
45829
- import { createHash as createHash30 } from "crypto";
45951
+ import { createHash as createHash29 } from "crypto";
45830
45952
  import { realpath as realpath3 } from "fs/promises";
45831
45953
  import * as path53 from "path";
45832
45954
 
@@ -46105,12 +46227,12 @@ function recordSeenRetroSection(key, value, timestamp) {
46105
46227
  capSeenRetroSections();
46106
46228
  }
46107
46229
  function hashContent(content) {
46108
- return createHash30("sha1").update(content).digest("hex");
46230
+ return createHash29("sha1").update(content).digest("hex");
46109
46231
  }
46110
46232
  async function loadConfigForPolicyCurator(directory) {
46111
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-emx6r32d.js");
46233
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-zytt0t7a.js");
46112
46234
  try {
46113
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-psqfkgav.js");
46235
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-pek9gmwm.js");
46114
46236
  const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
46115
46237
  return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
46116
46238
  } catch {
@@ -48948,9 +49070,9 @@ var _internals59 = {
48948
49070
  init_logger();
48949
49071
 
48950
49072
  // src/workflow/close-terminal.ts
48951
- import { createHash as createHash31 } from "crypto";
49073
+ import { createHash as createHash30 } from "crypto";
48952
49074
  function createCloseTransitionId(planEpoch, taskId, target) {
48953
- const digest2 = createHash31("sha256").update(JSON.stringify([planEpoch, taskId, target]), "utf8").digest("hex");
49075
+ const digest2 = createHash30("sha256").update(JSON.stringify([planEpoch, taskId, target]), "utf8").digest("hex");
48954
49076
  return `close-terminal:${digest2}`;
48955
49077
  }
48956
49078
  function findTask(plan, taskId) {
@@ -49168,7 +49290,7 @@ async function resolveCuratorLLMDelegate(directory, mode, sessionId) {
49168
49290
  const seam = _internals50.createCuratorLLMDelegate;
49169
49291
  if (seam)
49170
49292
  return seam(directory, mode, sessionId);
49171
- const { createCuratorLLMDelegate } = await import("./curator-llm-factory-cvrt4bf9.js");
49293
+ const { createCuratorLLMDelegate } = await import("./curator-llm-factory-k0yebhsk.js");
49172
49294
  return createCuratorLLMDelegate(directory, mode, sessionId);
49173
49295
  }
49174
49296
  async function reconcileCloseTerminalStateForPlan(directory, targetPlan, options) {
@@ -49563,7 +49685,7 @@ async function runFinalizeStage(ctx) {
49563
49685
  }
49564
49686
  }
49565
49687
  try {
49566
- const { CuratorConfigSchema: CCS } = await import("./schema-emx6r32d.js");
49688
+ const { CuratorConfigSchema: CCS } = await import("./schema-zytt0t7a.js");
49567
49689
  const { config: pmLoadedConfig } = _internals50.loadPluginConfigWithMeta(ctx.directory);
49568
49690
  const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
49569
49691
  if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
@@ -52295,7 +52417,7 @@ function buildApprovedReceipt(opts) {
52295
52417
  }
52296
52418
 
52297
52419
  // src/services/skill-optimizer/store.ts
52298
- import { createHash as createHash33, randomUUID as randomUUID10 } from "crypto";
52420
+ import { createHash as createHash32, randomUUID as randomUUID10 } from "crypto";
52299
52421
  import {
52300
52422
  closeSync as closeSync13,
52301
52423
  existsSync as existsSync27,
@@ -52320,10 +52442,10 @@ function canonicalJson2(value) {
52320
52442
  return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson2(v)}`).join(",")}}`;
52321
52443
  }
52322
52444
  function computeStateHash(value) {
52323
- return createHash33("sha256").update(canonicalJson2(value), "utf8").digest("hex");
52445
+ return createHash32("sha256").update(canonicalJson2(value), "utf8").digest("hex");
52324
52446
  }
52325
52447
  function computeContentHash2(content) {
52326
- return createHash33("sha256").update(content, "utf8").digest("hex");
52448
+ return createHash32("sha256").update(content, "utf8").digest("hex");
52327
52449
  }
52328
52450
  function computeEventHash(event) {
52329
52451
  return computeStateHash({
@@ -53361,7 +53483,7 @@ async function countStaleSummaries(projectRoot, retentionDays, now2) {
53361
53483
  }
53362
53484
 
53363
53485
  // src/session/snapshot-coordination-init.ts
53364
- import { createHash as createHash34, randomUUID as randomUUID11 } from "crypto";
53486
+ import { createHash as createHash33, randomUUID as randomUUID11 } from "crypto";
53365
53487
  import { existsSync as existsSync29, readFileSync as readFileSync24, renameSync as renameSync10 } from "fs";
53366
53488
  init_warning_buffer();
53367
53489
 
@@ -53596,7 +53718,7 @@ function serializeAgentSession(s) {
53596
53718
  }
53597
53719
  async function writeSnapshot(directory, state) {
53598
53720
  try {
53599
- const { ensureSnapshotCoordinationReady } = await import("./snapshot-coordination-init-2x56ds8a.js");
53721
+ const { ensureSnapshotCoordinationReady } = await import("./snapshot-coordination-init-ywxyf130.js");
53600
53722
  await ensureSnapshotCoordinationReady(directory);
53601
53723
  const snapshot = {
53602
53724
  version: 3,
@@ -54190,7 +54312,7 @@ async function initializeSnapshotCoordination(directory, scope) {
54190
54312
  if (!isCurrent())
54191
54313
  return "superseded";
54192
54314
  const serialized = JSON.stringify(candidate);
54193
- const outcome = _snapshotCoordinationInternals.importSnapshotRowsOnce(directory, candidate, createHash34("sha256").update(serialized).digest("hex"), source);
54315
+ const outcome = _snapshotCoordinationInternals.importSnapshotRowsOnce(directory, candidate, createHash33("sha256").update(serialized).digest("hex"), source);
54194
54316
  snapshot = readSnapshotRows(directory);
54195
54317
  if (outcome === "imported" && source === "session/state.json") {
54196
54318
  legacyArchiveAttempted = true;
@@ -55895,16 +56017,16 @@ function parsePromotedExternalFrontmatter(content) {
55895
56017
  if (!match)
55896
56018
  return {};
55897
56019
  const fm = match[1];
55898
- const originMatch = /^skill_origin:\s*(\S+)/m.exec(fm);
55899
- const promotedAtMatch = /^promoted_at:\s*(\S+)/m.exec(fm);
55900
- const origin = originMatch?.[1];
55901
- const promotedAt = promotedAtMatch?.[1];
56020
+ const originMatch = /^\s+skill_origin:\s*(\S+)/m.exec(fm);
56021
+ const promotedAtMatch = /^\s+promoted_at:\s*(\S+)/m.exec(fm);
56022
+ const origin = stripFmQuotes(originMatch?.[1] ?? /^skill_origin:\s*(\S+)/m.exec(fm)?.[1]);
56023
+ const promotedAt = stripFmQuotes(promotedAtMatch?.[1] ?? /^promoted_at:\s*(\S+)/m.exec(fm)?.[1]);
55902
56024
  let sourceKnowledgeIds;
55903
- const inlineMatch = /^source_knowledge_ids:\s*\[([^\]]*)\]/m.exec(fm);
56025
+ const inlineMatch = /^\s*source_knowledge_ids:\s*'?\[([^\]]*)\]'?/m.exec(fm);
55904
56026
  if (inlineMatch) {
55905
56027
  sourceKnowledgeIds = inlineMatch[1].split(",").map((s) => s.trim().replace(/^["']|["']$/g, "")).filter(Boolean);
55906
56028
  } else {
55907
- const blockMatch = /^source_knowledge_ids:\s*$/m.exec(fm);
56029
+ const blockMatch = /^\s*source_knowledge_ids:\s*$/m.exec(fm);
55908
56030
  if (blockMatch && blockMatch.index !== undefined) {
55909
56031
  const afterKey = fm.slice(blockMatch.index + blockMatch[0].length);
55910
56032
  const blockItems = [];
@@ -55924,6 +56046,15 @@ function parsePromotedExternalFrontmatter(content) {
55924
56046
  }
55925
56047
  return { origin, sourceKnowledgeIds, promotedAt };
55926
56048
  }
56049
+ function stripFmQuotes(value) {
56050
+ if (value === undefined)
56051
+ return;
56052
+ const trimmed = value.trim();
56053
+ if (trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'")) {
56054
+ return trimmed.slice(1, -1);
56055
+ }
56056
+ return trimmed;
56057
+ }
55927
56058
  function readPromotedExternalFrontmatter(skillPath) {
55928
56059
  if (!existsSync32(skillPath))
55929
56060
  return {};
@@ -55977,14 +56108,17 @@ function buildPromotedExternalInputFromSkill(directory, skillSlug, usage, ageDay
55977
56108
  }
55978
56109
 
55979
56110
  // src/services/skill-reviser.ts
55980
- init_logger();
55981
56111
  import { readFile as readFile16, rename as rename6, writeFile as writeFile7 } from "fs/promises";
56112
+ init_logger();
55982
56113
  var REVISION_VIOLATION_THRESHOLD = 0.15;
55983
56114
  var MAX_REVISION_CALLS_PER_PHASE = 3;
55984
56115
  var DEFAULT_MAX_CALLS = 10;
55985
56116
  async function getSkillVersion(skillPath) {
55986
56117
  try {
55987
56118
  const content = await readFile16(skillPath, "utf-8");
56119
+ const nested = content.match(/^\s+version:\s*"(\d+)"\s*$/m);
56120
+ if (nested)
56121
+ return parseInt(nested[1], 10);
55988
56122
  const match = content.match(/^version:\s*(\d+)\s*$/m);
55989
56123
  return match ? parseInt(match[1], 10) : 1;
55990
56124
  } catch {
@@ -56009,15 +56143,30 @@ function buildDeterministicRevision(currentContent, currentVersion, violationCon
56009
56143
  ].join(`
56010
56144
  `);
56011
56145
  let result = currentContent;
56012
- if (/^version:\s*\d+\s*$/m.test(result)) {
56013
- result = result.replace(/^version:\s*\d+\s*$/m, `version: ${nextVersion}`);
56014
- } else if (/^confidence:\s*.+$/m.test(result)) {
56015
- result = result.replace(/^(confidence:\s*.+)$/m, `$1
56146
+ const split = splitSkillFrontmatter(result);
56147
+ let fm = split.frontmatter;
56148
+ const nestedVersion = /^(\s+)version:\s*"?(\d+)"?\s*[ \t]*$/m.exec(fm);
56149
+ if (nestedVersion?.[1]) {
56150
+ fm = fm.replace(/^(\s+)version:\s*"?(\d+)"?\s*[ \t]*$/m, `${nestedVersion[1]}version: "${nextVersion}"`);
56151
+ } else if (/^version:\s*"?(\d+)"?\s*[ \t]*$/m.test(fm)) {
56152
+ fm = fm.replace(/^version:\s*"?(\d+)"?\s*[ \t]*$/m, `version: ${nextVersion}`);
56153
+ } else if (/^(\s+)confidence:\s*/m.test(fm)) {
56154
+ const indent = /^(\s+)confidence:/m.exec(fm)?.[1] ?? "";
56155
+ fm = fm.replace(/^(\s+)(confidence:[^\n]*)$/m, `$1$2
56156
+ ${indent}version: "${nextVersion}"`);
56157
+ } else if (/^confidence:[^\n]*$/m.test(fm) && !/^metadata:[ \t]*$/m.test(fm)) {
56158
+ fm = fm.replace(/^(confidence:[^\n]*)$/m, `$1
56016
56159
  version: ${nextVersion}`);
56017
- } else {
56018
- result = result.replace(/^(---\s*\n)/, `$1version: ${nextVersion}
56160
+ } else if (/^metadata:[ \t]*$/m.test(fm)) {
56161
+ fm = fm.replace(/^(metadata:[ \t]*\n)/m, `$1 version: "${nextVersion}"
56019
56162
  `);
56163
+ } else {
56164
+ fm = fm.replace(/\n(---[ \t]*(?:\r?\n|$))/, `
56165
+ metadata:
56166
+ version: "${nextVersion}"
56167
+ $1`);
56020
56168
  }
56169
+ result = fm + split.body;
56021
56170
  const revisionNotesPattern = /## Revision Notes\n[\s\S]*?(?=\n## Source Knowledge IDs|$)/;
56022
56171
  if (revisionNotesPattern.test(result)) {
56023
56172
  result = result.replace(revisionNotesPattern, "");
@@ -56051,9 +56200,9 @@ function buildLLMPrompt(currentContent, currentVersion, violationContexts) {
56051
56200
  const userPrompt = [
56052
56201
  "Instructions:",
56053
56202
  "- Revise ONLY the sections that were violated",
56054
- "- Preserve the exact frontmatter format (--- fenced YAML)",
56203
+ "- Preserve the exact frontmatter format (--- fenced YAML), including the indented `metadata:` block",
56055
56204
  "- Preserve all sections: Trigger, Required Procedure, Forbidden Shortcuts, Delegation Template, Reviewer Checks, Source Knowledge IDs",
56056
- `- Update the version field in frontmatter to ${currentVersion + 1}`,
56205
+ `- Update the version field in frontmatter to ${currentVersion + 1} (metadata.version when the metadata block is present)`,
56057
56206
  "- Make the violated rules clearer, more specific, or add missing edge cases",
56058
56207
  "- Do NOT remove any source knowledge IDs",
56059
56208
  "- Do NOT change the name or description in frontmatter",
@@ -56185,8 +56334,16 @@ async function reviseSkill(params) {
56185
56334
  }
56186
56335
  const expectedVersion = params.currentVersion + 1;
56187
56336
  let finalOutput = llmOutput.trim();
56188
- if (/^version:\s*\d+\s*$/m.test(finalOutput)) {
56189
- finalOutput = finalOutput.replace(/^version:\s*\d+\s*$/m, `version: ${expectedVersion}`);
56337
+ {
56338
+ const llmSplit = splitSkillFrontmatter(finalOutput);
56339
+ let llmFm = llmSplit.frontmatter;
56340
+ const nested = /^(\s+)version:\s*"?\d+"?\s*[ \t]*$/m.exec(llmFm);
56341
+ if (nested?.[1]) {
56342
+ llmFm = llmFm.replace(/^(\s+)version:\s*"?\d+"?\s*[ \t]*$/m, `${nested[1]}version: "${expectedVersion}"`);
56343
+ } else if (/^version:\s*\d+\s*$/m.test(llmFm)) {
56344
+ llmFm = llmFm.replace(/^version:\s*\d+\s*$/m, `version: ${expectedVersion}`);
56345
+ }
56346
+ finalOutput = llmFm + llmSplit.body;
56190
56347
  }
56191
56348
  const validation = await validateRevisionCandidate(params, `${finalOutput}
56192
56349
  `, "skill_reviser:llm");
@@ -56617,7 +56774,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
56617
56774
  };
56618
56775
  }
56619
56776
  async function sweepActiveNearDuplicates(directory, options = {}) {
56620
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-psqfkgav.js");
56777
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-pek9gmwm.js");
56621
56778
  const { config } = loadPluginConfigWithMeta2(directory);
56622
56779
  const sweepConfig = config.learning?.dedup_sweep;
56623
56780
  if (sweepConfig?.enabled === false)
@@ -57741,7 +57898,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
57741
57898
  }
57742
57899
  if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
57743
57900
  try {
57744
- const skillModule = await import("./skill-generator-w0jy1mpc.js");
57901
+ const skillModule = await import("./skill-generator-wt7d640t.js");
57745
57902
  for (const cand of skillCandidates) {
57746
57903
  if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
57747
57904
  continue;
@@ -58213,7 +58370,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
58213
58370
  } catch {}
58214
58371
  }
58215
58372
  if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
58216
- const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-2dy96d0j.js");
58373
+ const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-89crpby4.js");
58217
58374
  for (const { id } of contradictedEntries) {
58218
58375
  try {
58219
58376
  await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
@@ -59045,7 +59202,7 @@ async function runCuratorPostMortem(directory, options = {}) {
59045
59202
  warnings.push("Failed to collect knowledge summary.");
59046
59203
  }
59047
59204
  try {
59048
- const { getScanStatus } = await import("./scan-cursor-arezehhk.js");
59205
+ const { getScanStatus } = await import("./scan-cursor-0ffhpz79.js");
59049
59206
  const scanStatus = await getScanStatus(directory);
59050
59207
  if (scanStatus.remaining_estimate > 0) {
59051
59208
  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.`);
@@ -59217,9 +59374,9 @@ var _internals72 = {
59217
59374
  verifyPostMortemKnowledgeActions,
59218
59375
  repairPostMortemActions,
59219
59376
  loadDefaultKnowledgeConfig: async (directory) => {
59220
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-emx6r32d.js");
59377
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-zytt0t7a.js");
59221
59378
  try {
59222
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-psqfkgav.js");
59379
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-pek9gmwm.js");
59223
59380
  const loaded = loadPluginConfigWithMeta2(directory);
59224
59381
  return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
59225
59382
  } catch {
@@ -59227,11 +59384,11 @@ var _internals72 = {
59227
59384
  }
59228
59385
  },
59229
59386
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
59230
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-891pc8b7.js");
59387
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-p1r777m5.js");
59231
59388
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
59232
59389
  },
59233
59390
  checkHivePromotions: async (entries2, knowledgeConfig, directory) => {
59234
- const { checkHivePromotions } = await import("./hive-promoter-w1vchgfr.js");
59391
+ const { checkHivePromotions } = await import("./hive-promoter-0ht8jafr.js");
59235
59392
  return checkHivePromotions(entries2, knowledgeConfig, directory);
59236
59393
  },
59237
59394
  applyProposalTriage: async (directory, triage) => {
@@ -59240,7 +59397,7 @@ var _internals72 = {
59240
59397
  activateProposal,
59241
59398
  listSkills: listSkills2,
59242
59399
  sanitizeSlug
59243
- } = await import("./skill-generator-w0jy1mpc.js");
59400
+ } = await import("./skill-generator-wt7d640t.js");
59244
59401
  const result = {
59245
59402
  approved: [],
59246
59403
  rejected: [],
@@ -59282,7 +59439,7 @@ var _internals72 = {
59282
59439
  return result;
59283
59440
  },
59284
59441
  readPriorDriftReports: async (directory) => {
59285
- const { readPriorDriftReports: readPriorDriftReports2 } = await import("./curator-drift-sxzs48ew.js");
59442
+ const { readPriorDriftReports: readPriorDriftReports2 } = await import("./curator-drift-15mcxawb.js");
59286
59443
  return readPriorDriftReports2(directory);
59287
59444
  },
59288
59445
  readSwarmKnowledge: (directory) => readKnowledge(resolveSwarmKnowledgePath(directory))
@@ -59291,7 +59448,7 @@ var _internals72 = {
59291
59448
  // src/hooks/hive-promoter.ts
59292
59449
  init_constants();
59293
59450
  init_schema();
59294
- import { createHash as createHash35 } from "crypto";
59451
+ import { createHash as createHash34 } from "crypto";
59295
59452
  import path75 from "path";
59296
59453
 
59297
59454
  // src/hooks/cohort-cache.ts
@@ -59733,7 +59890,7 @@ function buildLineage(args) {
59733
59890
  return lineage;
59734
59891
  }
59735
59892
  function lessonRevision(lesson) {
59736
- return createHash35("sha256").update(lesson).digest("hex").slice(0, 12);
59893
+ return createHash34("sha256").update(lesson).digest("hex").slice(0, 12);
59737
59894
  }
59738
59895
  async function checkHivePromotions(swarmEntries, config, directory, sessionID) {
59739
59896
  const empty = {
@@ -60377,7 +60534,7 @@ async function promoteFromSwarm(directory, lessonId, options, config) {
60377
60534
  init_logger();
60378
60535
 
60379
60536
  // src/memory/gateway.ts
60380
- import { createHash as createHash39, randomUUID as randomUUID16 } from "crypto";
60537
+ import { createHash as createHash38, randomUUID as randomUUID16 } from "crypto";
60381
60538
  import { existsSync as existsSync39, mkdirSync as mkdirSync25, readFileSync as readFileSync32 } from "fs";
60382
60539
  import * as path84 from "path";
60383
60540
  init_logger();
@@ -60627,7 +60784,7 @@ var MAX_RELATIONS_PER_MEMORY = 32;
60627
60784
  var RELATED_RECALL_FANOUT = 2;
60628
60785
  // src/memory/schema.ts
60629
60786
  init_zod();
60630
- import { createHash as createHash36 } from "crypto";
60787
+ import { createHash as createHash35 } from "crypto";
60631
60788
 
60632
60789
  // src/memory/pii.ts
60633
60790
  import { createRequire } from "module";
@@ -61112,7 +61269,7 @@ function stableScopeKey(scope) {
61112
61269
  }
61113
61270
  function computeMemoryContentHash(recordLike) {
61114
61271
  const normalized = normalizeMemoryText(recordLike.text).toLowerCase();
61115
- return createHash36("sha256").update(`${stableScopeKey(recordLike.scope)}
61272
+ return createHash35("sha256").update(`${stableScopeKey(recordLike.scope)}
61116
61273
  ${recordLike.kind}
61117
61274
  ${normalized}`).digest("hex");
61118
61275
  }
@@ -61120,14 +61277,14 @@ function createMemoryId(recordLike) {
61120
61277
  return `mem_${computeMemoryContentHash(recordLike).slice(0, 16)}`;
61121
61278
  }
61122
61279
  function createProposalId(input) {
61123
- const hash = createHash36("sha256").update(`${input.createdAt}
61280
+ const hash = createHash35("sha256").update(`${input.createdAt}
61124
61281
  ${input.proposer}
61125
61282
  ${normalizeMemoryText(input.text)}`).digest("hex");
61126
61283
  return `prop_${hash.slice(0, 16)}`;
61127
61284
  }
61128
61285
  function createBundleId(query, generatedAt) {
61129
61286
  const compactTimestamp = generatedAt.replace(/[-:.TZ]/g, "").slice(0, 14);
61130
- const hash = createHash36("sha256").update(`${generatedAt}
61287
+ const hash = createHash35("sha256").update(`${generatedAt}
61131
61288
  ${query}`).digest("hex").slice(0, 8);
61132
61289
  return `bundle_${compactTimestamp}_${hash}`;
61133
61290
  }
@@ -61989,7 +62146,7 @@ function proposalSort(a, b) {
61989
62146
  }
61990
62147
 
61991
62148
  // src/memory/outcome-events.ts
61992
- import { createHash as createHash37, randomUUID as randomUUID13 } from "crypto";
62149
+ import { createHash as createHash36, randomUUID as randomUUID13 } from "crypto";
61993
62150
  function newOutcomeGeneration() {
61994
62151
  return randomUUID13();
61995
62152
  }
@@ -62122,7 +62279,7 @@ function dedupeAnchors(anchors) {
62122
62279
  return [...byKey.values()].sort((a, b) => compareText(a.file, b.file) || compareText(a.symbol ?? "", b.symbol ?? ""));
62123
62280
  }
62124
62281
  function hash(value) {
62125
- return createHash37("sha256").update(value).digest("hex").slice(0, 32);
62282
+ return createHash36("sha256").update(value).digest("hex").slice(0, 32);
62126
62283
  }
62127
62284
  function compareText(a, b) {
62128
62285
  return a < b ? -1 : a > b ? 1 : 0;
@@ -63088,7 +63245,7 @@ function toRecallBundle(input) {
63088
63245
  import { mkdirSync as mkdirSync23 } from "fs";
63089
63246
 
63090
63247
  // src/memory/sqlite-provider.ts
63091
- import { createHash as createHash38, randomUUID as randomUUID15 } from "crypto";
63248
+ import { createHash as createHash37, randomUUID as randomUUID15 } from "crypto";
63092
63249
  import {
63093
63250
  existsSync as existsSync37,
63094
63251
  mkdirSync as mkdirSync22,
@@ -63758,7 +63915,7 @@ function toJsonl(values) {
63758
63915
  var EVENT_CHAIN_GENESIS = "GENESIS";
63759
63916
  var MEMORY_EVENTS_CHAIN_HEAD_KEY = "memory_events_chain_head";
63760
63917
  function memoryEventRowHash(row) {
63761
- return createHash38("sha256").update(stableCanonicalStringify({
63918
+ return createHash37("sha256").update(stableCanonicalStringify({
63762
63919
  id: row.id,
63763
63920
  operation: row.operation,
63764
63921
  target_id: row.target_id,
@@ -67248,7 +67405,7 @@ function sourceFromEvidence(evidenceRefs, context) {
67248
67405
  return { type: "manual", ref: first };
67249
67406
  }
67250
67407
  function createStableId(value) {
67251
- return createHash39("sha256").update(value.toLowerCase()).digest("hex").slice(0, 16);
67408
+ return createHash38("sha256").update(value.toLowerCase()).digest("hex").slice(0, 16);
67252
67409
  }
67253
67410
  var gitRemoteUrlCache = new Map;
67254
67411
  var MAX_GIT_REMOTE_CACHE_ENTRIES = 128;
@@ -69552,9 +69709,9 @@ var _internals80 = {
69552
69709
  loadPluginConfigWithMeta,
69553
69710
  loadCuratorDeps: async () => {
69554
69711
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate }] = await Promise.all([
69555
- import("./schema-emx6r32d.js"),
69556
- import("./curator-891pc8b7.js"),
69557
- import("./curator-llm-factory-cvrt4bf9.js")
69712
+ import("./schema-zytt0t7a.js"),
69713
+ import("./curator-p1r777m5.js"),
69714
+ import("./curator-llm-factory-k0yebhsk.js")
69558
69715
  ]);
69559
69716
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate };
69560
69717
  }
@@ -69821,11 +69978,11 @@ async function handleDashboardCommand(directory, _args) {
69821
69978
  }
69822
69979
 
69823
69980
  // src/commands/dataset.ts
69824
- import { createHash as createHash43 } from "crypto";
69981
+ import { createHash as createHash42 } from "crypto";
69825
69982
 
69826
69983
  // src/training/consent.ts
69827
69984
  init_zod();
69828
- import { createHash as createHash40, randomUUID as randomUUID17 } from "crypto";
69985
+ import { createHash as createHash39, randomUUID as randomUUID17 } from "crypto";
69829
69986
  import * as fs46 from "fs";
69830
69987
  import * as path90 from "path";
69831
69988
 
@@ -69896,7 +70053,7 @@ function rootDigestOf(directory) {
69896
70053
  try {
69897
70054
  canonical = fs46.realpathSync.native(directory);
69898
70055
  } catch {}
69899
- return createHash40("sha256").update(`training-project-binding-v1\x00${canonical}`).digest("hex").slice(0, 16);
70056
+ return createHash39("sha256").update(`training-project-binding-v1\x00${canonical}`).digest("hex").slice(0, 16);
69900
70057
  }
69901
70058
  function computeProjectBinding(directory) {
69902
70059
  return {
@@ -70005,13 +70162,13 @@ function readTrainingConsentState(directory) {
70005
70162
 
70006
70163
  // src/training/exporter.ts
70007
70164
  init_zod();
70008
- import { createHash as createHash42, randomBytes as randomBytes2 } from "crypto";
70165
+ import { createHash as createHash41, randomBytes as randomBytes2 } from "crypto";
70009
70166
  import * as fs49 from "fs";
70010
70167
  import * as path92 from "path";
70011
70168
 
70012
70169
  // src/training/vault.ts
70013
70170
  init_zod();
70014
- import { createHash as createHash41, randomUUID as randomUUID18 } from "crypto";
70171
+ import { createHash as createHash40, randomUUID as randomUUID18 } from "crypto";
70015
70172
  import * as fs48 from "fs";
70016
70173
  import * as path91 from "path";
70017
70174
 
@@ -70096,7 +70253,7 @@ var TrainingWithdrawalTombstoneSchema = exports_external.object({
70096
70253
  revoked_export_ids: exports_external.array(exports_external.string())
70097
70254
  }).strict();
70098
70255
  function sha2565(input) {
70099
- return createHash41("sha256").update(input, "utf8").digest("hex");
70256
+ return createHash40("sha256").update(input, "utf8").digest("hex");
70100
70257
  }
70101
70258
  function readHealth(directory) {
70102
70259
  try {
@@ -70332,7 +70489,7 @@ var TrainingExportFiltersSchema = exports_external.object({
70332
70489
  validationRatio: exports_external.number().min(0).max(0.5).optional()
70333
70490
  }).strict();
70334
70491
  function sha2566(input) {
70335
- return createHash42("sha256").update(input, "utf8").digest("hex");
70492
+ return createHash41("sha256").update(input, "utf8").digest("hex");
70336
70493
  }
70337
70494
  function canonicalJson3(value) {
70338
70495
  if (value === null || typeof value !== "object") {
@@ -70473,7 +70630,7 @@ function consumeTrainingPendingOp(directory) {
70473
70630
  } catch {}
70474
70631
  }
70475
70632
  function issueTrainingConfirmToken(directory, scope) {
70476
- const token = createHash42("sha256").update(`${scope.digest}:${randomBytes2(16).toString("hex")}`).digest("hex").slice(0, 24);
70633
+ const token = createHash41("sha256").update(`${scope.digest}:${randomBytes2(16).toString("hex")}`).digest("hex").slice(0, 24);
70477
70634
  writePending(directory, {
70478
70635
  schema_version: 1,
70479
70636
  kind: scope.kind,
@@ -70617,7 +70774,7 @@ async function handleDatasetConsentCommand(directory, args) {
70617
70774
  maxRecords: quotaNumber(flagValue(args, "max-records")) ?? TRAINING_QUOTA_CEILINGS.maxRecords,
70618
70775
  retentionDays: quotaNumber(flagValue(args, "retention-days")) ?? TRAINING_QUOTA_CEILINGS.retentionDays
70619
70776
  };
70620
- const digest2 = createHash43("sha256").update(`dataset-consent-v1\x00${JSON.stringify(quotas)}`).digest("hex");
70777
+ const digest2 = createHash42("sha256").update(`dataset-consent-v1\x00${JSON.stringify(quotas)}`).digest("hex");
70621
70778
  if (confirm !== undefined) {
70622
70779
  const check = checkTrainingConfirmToken(directory, "consent", confirm);
70623
70780
  if (!check.ok) {
@@ -70658,7 +70815,7 @@ async function handleDatasetWithdrawCommand(directory, args) {
70658
70815
  const status = getTrainingVaultStatus(directory);
70659
70816
  const revocations = readTrainingExportRevocations(directory);
70660
70817
  const exportIds = revocations.length;
70661
- const digest2 = createHash43("sha256").update(`dataset-withdraw-v1\x00${status.recordCount}\x00${status.vaultBytes}\x00${status.tombstoneCount}`).digest("hex");
70818
+ const digest2 = createHash42("sha256").update(`dataset-withdraw-v1\x00${status.recordCount}\x00${status.vaultBytes}\x00${status.tombstoneCount}`).digest("hex");
70662
70819
  const confirm = flagValue(args, "confirm");
70663
70820
  if (confirm !== undefined) {
70664
70821
  const check = checkTrainingConfirmToken(directory, "withdraw", confirm);
@@ -72004,7 +72161,7 @@ async function computeCurationDiagnostics(directory, entries2) {
72004
72161
  let scanCompleted = false;
72005
72162
  let scanRemaining = 0;
72006
72163
  try {
72007
- const { getScanStatus } = await import("./scan-cursor-arezehhk.js");
72164
+ const { getScanStatus } = await import("./scan-cursor-0ffhpz79.js");
72008
72165
  const status = await getScanStatus(directory);
72009
72166
  scanGeneration = status.generation;
72010
72167
  scanCompleted = status.completed;
@@ -72014,10 +72171,10 @@ async function computeCurationDiagnostics(directory, entries2) {
72014
72171
  try {
72015
72172
  const { isLinked: isLinked2 } = await import("./knowledge-link-8bn2b7vr.js");
72016
72173
  if (isLinked2(directory)) {
72017
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-emx6r32d.js");
72174
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-zytt0t7a.js");
72018
72175
  let config;
72019
72176
  try {
72020
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-psqfkgav.js");
72177
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-pek9gmwm.js");
72021
72178
  const loaded = loadPluginConfigWithMeta2(directory);
72022
72179
  config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
72023
72180
  } catch {
@@ -73473,7 +73630,7 @@ async function handleDoctorCommand(directory, args) {
73473
73630
  const result = runConfigDoctor(config, directory, planParallelizationEnabled);
73474
73631
  let output;
73475
73632
  if (enableAutoFix && result.hasAutoFixableIssues) {
73476
- const { runConfigDoctorWithFixes } = await import("./config-doctor-qv7wc6fa.js");
73633
+ const { runConfigDoctorWithFixes } = await import("./config-doctor-4ck8e1fq.js");
73477
73634
  const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
73478
73635
  applyLossy: true
73479
73636
  });
@@ -73511,7 +73668,7 @@ async function handleDoctorCommand(directory, args) {
73511
73668
  `;
73512
73669
  }
73513
73670
  try {
73514
- const { runModelPreflight } = await import("./model-preflight-skhq4xtr.js");
73671
+ const { runModelPreflight } = await import("./model-preflight-98g183my.js");
73515
73672
  const preflight = await runModelPreflight(config, swarmState.opencodeClient, { generatedAgentNames: swarmState.generatedAgentNames });
73516
73673
  const missingSelection = preflight.resolutions.filter((resolution) => resolution.status === "missing-selection");
73517
73674
  const unresolved = preflight.catalogAvailable ? preflight.resolutions.filter((resolution) => resolution.status === "unresolved") : [];
@@ -73545,7 +73702,7 @@ async function handleDoctorCommand(directory, args) {
73545
73702
  }
73546
73703
  } catch {}
73547
73704
  try {
73548
- const { renderKnowledgeReceiptPhaseIdSection } = await import("./doctor-knowledge-receipt-phase-id-mvbj576e.js");
73705
+ const { renderKnowledgeReceiptPhaseIdSection } = await import("./doctor-knowledge-receipt-phase-id-k204028d.js");
73549
73706
  output += await renderKnowledgeReceiptPhaseIdSection(directory, enableAutoFix);
73550
73707
  } catch {}
73551
73708
  const strayDirs = detectStraySwarmDirs(directory);
@@ -75562,7 +75719,7 @@ async function handleEvidenceCommand(directory, args) {
75562
75719
  return formatTaskEvidenceMarkdown(evidenceData);
75563
75720
  }
75564
75721
  async function handleEvidenceSummaryCommand(directory) {
75565
- const { buildEvidenceSummary } = await import("./evidence-summary-service-x9nxvmn5.js");
75722
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-4mx5ge81.js");
75566
75723
  const artifact = await buildEvidenceSummary(directory);
75567
75724
  if (!artifact) {
75568
75725
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -83282,7 +83439,7 @@ import * as path109 from "path";
83282
83439
  init_zod();
83283
83440
 
83284
83441
  // src/harness/hash.ts
83285
- import { createHash as createHash46 } from "crypto";
83442
+ import { createHash as createHash45 } from "crypto";
83286
83443
  function canonicalize(value, ancestors2) {
83287
83444
  if (value === null || typeof value === "string" || typeof value === "boolean") {
83288
83445
  return value;
@@ -83330,7 +83487,7 @@ function canonicalJson4(value) {
83330
83487
  return serialized;
83331
83488
  }
83332
83489
  function sha2567(value) {
83333
- return createHash46("sha256").update(value).digest("hex");
83490
+ return createHash45("sha256").update(value).digest("hex");
83334
83491
  }
83335
83492
  function canonicalHash2(value) {
83336
83493
  return sha2567(canonicalJson4(value));
@@ -87447,7 +87604,7 @@ async function handleHistoryCommand(directory, _args) {
87447
87604
  }
87448
87605
  // src/knowledge/hive-quarantine.ts
87449
87606
  init_package();
87450
- import { createHash as createHash47, createHmac, randomBytes as randomBytes3, randomUUID as randomUUID20 } from "crypto";
87607
+ import { createHash as createHash46, createHmac, randomBytes as randomBytes3, randomUUID as randomUUID20 } from "crypto";
87451
87608
  import {
87452
87609
  chmod,
87453
87610
  copyFile as copyFile2,
@@ -87480,7 +87637,7 @@ function serializeCanonical(value) {
87480
87637
  return `{${entries2.map(([k, v]) => `${JSON.stringify(k)}:${serializeCanonical(v)}`).join(",")}}`;
87481
87638
  }
87482
87639
  function sha256Hex(content) {
87483
- return createHash47("sha256").update(content, "utf-8").digest("hex");
87640
+ return createHash46("sha256").update(content, "utf-8").digest("hex");
87484
87641
  }
87485
87642
  var QUARANTINE_SECRET_FILE = "hive-quarantine.key";
87486
87643
  async function readQuarantineSecret() {
@@ -90270,13 +90427,13 @@ import { existsSync as existsSync66, readFileSync as readFileSync60, realpathSyn
90270
90427
  import * as path132 from "path";
90271
90428
  import { fileURLToPath as fileURLToPath4 } from "url";
90272
90429
  // src/memory/evaluation.ts
90273
- import { createHash as createHash49 } from "crypto";
90430
+ import { createHash as createHash48 } from "crypto";
90274
90431
  import * as fs65 from "fs/promises";
90275
90432
  import * as os13 from "os";
90276
90433
  import * as path121 from "path";
90277
90434
 
90278
90435
  // src/memory/heldout-evaluation-corpus.ts
90279
- import { createHash as createHash48 } from "crypto";
90436
+ import { createHash as createHash47 } from "crypto";
90280
90437
  import * as fs64 from "fs/promises";
90281
90438
  import * as path120 from "path";
90282
90439
  var MAX_CORPUS_CASES = 256;
@@ -90349,7 +90506,7 @@ function isValidEdge(value) {
90349
90506
  return typeof edge.from === "string" && Boolean(edge.from.trim()) && typeof edge.to === "string" && Boolean(edge.to.trim());
90350
90507
  }
90351
90508
  function computeCanonicalSourceHash(source) {
90352
- return createHash48("sha256").update(source.toString("utf8").replace(/\r\n?|\n/g, `
90509
+ return createHash47("sha256").update(source.toString("utf8").replace(/\r\n?|\n/g, `
90353
90510
  `)).digest("hex");
90354
90511
  }
90355
90512
  async function loadHeldoutRecallEvaluationScenarios(corpusDirectory) {
@@ -90762,8 +90919,8 @@ function normalizeResourceUsage(usage) {
90762
90919
  };
90763
90920
  }
90764
90921
  function createRecallEvaluationManifest(args) {
90765
- const corpusHash = createHash49("sha256").update(stableStringify2(args.fixtures)).digest("hex");
90766
- const configHash = createHash49("sha256").update(stableStringify2({
90922
+ const corpusHash = createHash48("sha256").update(stableStringify2(args.fixtures)).digest("hex");
90923
+ const configHash = createHash48("sha256").update(stableStringify2({
90767
90924
  providers: args.providers,
90768
90925
  profiles: args.profiles ?? ["legacy"],
90769
90926
  resourceCaps: args.resourceCaps,
@@ -90794,19 +90951,19 @@ function createRecallEvaluationManifest(args) {
90794
90951
  source_id: args.heldoutCorpusId ? `heldout:${args.heldoutCorpusId}` : `fixtures:${corpusHash}`,
90795
90952
  model_id: profile === "lexical" ? "none" : args.dependencies?.embeddingProvider?.modelVersion ?? "configured-embedding",
90796
90953
  provider_id: `profiles:${profile};providers:${args.providers.join(",")}`,
90797
- config_hash: createHash49("sha256").update(stableStringify2({ profile, resourceCaps: args.resourceCaps })).digest("hex")
90954
+ config_hash: createHash48("sha256").update(stableStringify2({ profile, resourceCaps: args.resourceCaps })).digest("hex")
90798
90955
  }
90799
90956
  ]))
90800
90957
  };
90801
90958
  }
90802
90959
  function createRunIdentity(args) {
90803
90960
  const profile = args.profile ?? "legacy";
90804
- const sourceId = args.fixture.scenario ? `source:${args.fixture.scenario.id}:${args.fixture.sourceHash}` : `fixture:${args.fixture.name}:${createHash49("sha256").update(args.fixture.query).digest("hex")}`;
90961
+ const sourceId = args.fixture.scenario ? `source:${args.fixture.scenario.id}:${args.fixture.sourceHash}` : `fixture:${args.fixture.name}:${createHash48("sha256").update(args.fixture.query).digest("hex")}`;
90805
90962
  return {
90806
90963
  source_id: sourceId,
90807
90964
  model_id: profile === "lexical" ? "none" : args.dependencies?.embeddingProvider?.modelVersion ?? "configured-embedding",
90808
90965
  provider_id: args.provider,
90809
- config_hash: createHash49("sha256").update(stableStringify2({
90966
+ config_hash: createHash48("sha256").update(stableStringify2({
90810
90967
  profile,
90811
90968
  resourceCaps: args.resourceCaps,
90812
90969
  model: args.dependencies?.embeddingProvider?.modelVersion ?? "configured",
@@ -91118,7 +91275,7 @@ function parseJsonObject(candidate2) {
91118
91275
  init_schema();
91119
91276
  init_logger();
91120
91277
  // src/memory/instruction-pairing.ts
91121
- import { createHash as createHash51 } from "crypto";
91278
+ import { createHash as createHash50 } from "crypto";
91122
91279
  import {
91123
91280
  existsSync as existsSync63,
91124
91281
  mkdirSync as mkdirSync37,
@@ -91131,7 +91288,7 @@ import { tmpdir as tmpdir7 } from "os";
91131
91288
  import path125 from "path";
91132
91289
 
91133
91290
  // src/hooks/knowledge-injector.ts
91134
- import { createHash as createHash50 } from "crypto";
91291
+ import { createHash as createHash49 } from "crypto";
91135
91292
 
91136
91293
  // src/agents/reviewer-directive-compliance.ts
91137
91294
  var DIRECTIVES_TO_VERIFY_TAG = "<directives_to_verify>";
@@ -92138,7 +92295,7 @@ function stableInstructionJson(value) {
92138
92295
  return JSON.stringify(value);
92139
92296
  }
92140
92297
  function sha256Short(value) {
92141
- return createHash50("sha256").update(value).digest("hex").slice(0, 16);
92298
+ return createHash49("sha256").update(value).digest("hex").slice(0, 16);
92142
92299
  }
92143
92300
  async function readInstructionInputs(directory) {
92144
92301
  let briefing = null;
@@ -92663,9 +92820,9 @@ function createKnowledgeInjectorHook(directory, config, modelLimitOverrides = {}
92663
92820
  ctx.targetAgent ?? "",
92664
92821
  ctx.taskId ?? "",
92665
92822
  (ctx.filePaths ?? []).slice(0, 8).join(","),
92666
- ctx.lastUserMessage ? createHash50("sha1").update(ctx.lastUserMessage).digest("hex").slice(0, 16) : ""
92823
+ ctx.lastUserMessage ? createHash49("sha1").update(ctx.lastUserMessage).digest("hex").slice(0, 16) : ""
92667
92824
  ].join("|");
92668
- return createHash50("sha1").update(parts).digest("hex").slice(0, 16);
92825
+ return createHash49("sha1").update(parts).digest("hex").slice(0, 16);
92669
92826
  }
92670
92827
  let lastSeenCacheKey = null;
92671
92828
  let cachedInjectionText = null;
@@ -93197,7 +93354,7 @@ async function materializeTaskStore(projectDir, task2) {
93197
93354
  for (const record of task2.records) {
93198
93355
  const lesson = `__PAIRING_LABEL_${record.label}__ ${record.lesson}`.slice(0, 280);
93199
93356
  const entry = {
93200
- id: createHash51("sha1").update(`${task2.id}:${record.label}`).digest("hex"),
93357
+ id: createHash50("sha1").update(`${task2.id}:${record.label}`).digest("hex"),
93201
93358
  tier: "swarm",
93202
93359
  lesson,
93203
93360
  category: "process",
@@ -93355,8 +93512,8 @@ async function runInstructionSelectionPairing(options) {
93355
93512
  pairs.push(await runTaskPairing(task2, injectCharBudget));
93356
93513
  }
93357
93514
  const cacheInvalidation = await verifyCacheInvalidation();
93358
- const taskSetId = createHash51("sha256").update(stableJson2(tasks)).digest("hex");
93359
- const instructionSetDigest = createHash51("sha256").update(stableJson2({
93515
+ const taskSetId = createHash50("sha256").update(stableJson2(tasks)).digest("hex");
93516
+ const instructionSetDigest = createHash50("sha256").update(stableJson2({
93360
93517
  task_set: taskSetId,
93361
93518
  inject_char_budget: injectCharBudget,
93362
93519
  cache_invalidation_verified: cacheInvalidation.verified
@@ -98560,12 +98717,12 @@ var workspaceCache = new Map;
98560
98717
 
98561
98718
  // src/tools/repo-graph/freshness.ts
98562
98719
  init_package();
98563
- import { createHash as createHash52 } from "crypto";
98720
+ import { createHash as createHash51 } from "crypto";
98564
98721
  import * as fsPromises3 from "fs/promises";
98565
98722
  import * as path130 from "path";
98566
98723
  var REPO_GRAPH_FINGERPRINT_FILENAME = "repo-graph.fingerprint.json";
98567
98724
  var FINGERPRINT_SCHEMA_VERSION = 1;
98568
- var EXTRACTOR_STAMP = createHash52("sha256").update(`${package_default.version}\x00${GRAPH_SCHEMA_VERSION}`).digest("hex");
98725
+ var EXTRACTOR_STAMP = createHash51("sha256").update(`${package_default.version}\x00${GRAPH_SCHEMA_VERSION}`).digest("hex");
98569
98726
  var MAX_FINGERPRINT_BYTES = 24 * 1024 * 1024;
98570
98727
  var MAX_FINGERPRINT_ENTRIES = 100256;
98571
98728
  var MAX_RELATIVE_PATH_LENGTH = 4096;
@@ -98588,7 +98745,7 @@ function normalizedExcludes(options) {
98588
98745
  return [...new Set((options?.excludeDirs ?? []).filter(Boolean))].sort((a, b) => a.localeCompare(b));
98589
98746
  }
98590
98747
  function exclusionStamp(options) {
98591
- return createHash52("sha256").update(JSON.stringify({
98748
+ return createHash51("sha256").update(JSON.stringify({
98592
98749
  excludeDirs: normalizedExcludes(options),
98593
98750
  followSymlinks: options?.followSymlinks ?? false
98594
98751
  })).digest("hex");
@@ -100028,7 +100185,7 @@ function createCuratorLLMDelegate(directory, mode = "init", sessionId) {
100028
100185
  }
100029
100186
  const sdkOpts = signal ? { signal } : {};
100030
100187
  try {
100031
- const { getSwarmAgents: getSwarmAgents2, resolveFallbackModel: resolveFallbackModel2 } = await import("./index-nrqyc8pr.js");
100188
+ const { getSwarmAgents: getSwarmAgents2, resolveFallbackModel: resolveFallbackModel2 } = await import("./index-56n6nb7p.js");
100032
100189
  const createResult = await client.session.create({
100033
100190
  ...sessionId ? {
100034
100191
  body: {
@@ -100319,7 +100476,7 @@ function handlePrFeedbackCommand(directory, args) {
100319
100476
  // src/background/pr-feedback-loop.ts
100320
100477
  init_zod();
100321
100478
  init_loader();
100322
- import { createHash as createHash53, randomUUID as randomUUID23 } from "crypto";
100479
+ import { createHash as createHash52, randomUUID as randomUUID23 } from "crypto";
100323
100480
  import * as fsSync10 from "fs";
100324
100481
  import * as fs68 from "fs/promises";
100325
100482
  import * as path136 from "path";
@@ -102126,7 +102283,7 @@ async function cancelPrFeedbackLoopUnlocked(directory, sessionID, reason) {
102126
102283
  clearedEvents: []
102127
102284
  };
102128
102285
  try {
102129
- const { cancelPrFeedbackPublication: cancelPrFeedbackPublication2 } = await import("./pr-workflow-gate-2gmznmj4.js");
102286
+ const { cancelPrFeedbackPublication: cancelPrFeedbackPublication2 } = await import("./pr-workflow-gate-t8veygyh.js");
102130
102287
  await cancelPrFeedbackPublication2(directory, sessionID, reason);
102131
102288
  } catch (err) {
102132
102289
  warn(`[pr-feedback-loop] cancelPrFeedbackPublication failed (fail-open): ${err instanceof Error ? err.message : String(err)}`);
@@ -105464,7 +105621,7 @@ import * as fs73 from "fs";
105464
105621
  import * as path141 from "path";
105465
105622
 
105466
105623
  // src/test-impact/analyzer.ts
105467
- import { createHash as createHash54 } from "crypto";
105624
+ import { createHash as createHash53 } from "crypto";
105468
105625
  import fs71 from "fs";
105469
105626
  import path139 from "path";
105470
105627
  var MAX_IMPACT_TEST_FILES = 4096;
@@ -105569,7 +105726,7 @@ function sharedTrailingSegments(a, b) {
105569
105726
  return shared;
105570
105727
  }
105571
105728
  function digestContent(content) {
105572
- return createHash54("sha256").update(content).digest("hex");
105729
+ return createHash53("sha256").update(content).digest("hex");
105573
105730
  }
105574
105731
  function scanTestFilesSync(cwd) {
105575
105732
  const result = {
@@ -111439,7 +111596,7 @@ function resolveWorktreeEnumerationBases(directory) {
111439
111596
 
111440
111597
  // src/hooks/gate-denial-tracker.ts
111441
111598
  init_schema();
111442
- import { createHash as createHash55 } from "crypto";
111599
+ import { createHash as createHash54 } from "crypto";
111443
111600
 
111444
111601
  // src/dispatch/spawn-circuit.ts
111445
111602
  var SPAWN_CIRCUIT_TTL_MS = 30 * 60000;
@@ -111511,7 +111668,7 @@ function boundedPathAlias(value) {
111511
111668
  if (normalizedPaths.length <= MAX_ACTION_PATH_PREFIX_ITEMS) {
111512
111669
  return { value: normalizedPaths };
111513
111670
  }
111514
- const tailHasher = createHash55("sha256");
111671
+ const tailHasher = createHash54("sha256");
111515
111672
  tailHasher.update(`tail-count:${normalizedPaths.length - MAX_ACTION_PATH_PREFIX_ITEMS};`);
111516
111673
  for (let index = MAX_ACTION_PATH_PREFIX_ITEMS;index < normalizedPaths.length; index += 1) {
111517
111674
  const pathValue = normalizedPaths[index];
@@ -112132,7 +112289,7 @@ import * as path149 from "path";
112132
112289
  init_schema();
112133
112290
 
112134
112291
  // src/review/finding-validator.ts
112135
- import { createHash as createHash56 } from "crypto";
112292
+ import { createHash as createHash55 } from "crypto";
112136
112293
  init_schema();
112137
112294
  var MAX_VALIDATOR_FALLBACK_MODELS = FALLBACK_MODELS_MAX;
112138
112295
  function canonicalFindingPayload(finding) {
@@ -112158,7 +112315,7 @@ function canonicalizeValidationCandidates(findings) {
112158
112315
  line_start: finding.line_start,
112159
112316
  line_end: finding.line_end
112160
112317
  };
112161
- const findingId = createHash56("sha256").update(canonicalFindingPayload(normalized), "utf8").digest("hex");
112318
+ const findingId = createHash55("sha256").update(canonicalFindingPayload(normalized), "utf8").digest("hex");
112162
112319
  const existing = candidates.get(findingId);
112163
112320
  if (existing) {
112164
112321
  existing.duplicate_count += "duplicate_count" in finding && finding.duplicate_count > 1 ? finding.duplicate_count : 1;
@@ -112824,11 +112981,11 @@ var _internals134 = {
112824
112981
  };
112825
112982
 
112826
112983
  // src/review/evidence.ts
112827
- import { createHash as createHash57 } from "crypto";
112984
+ import { createHash as createHash56 } from "crypto";
112828
112985
  import * as fs81 from "fs";
112829
112986
  import * as path148 from "path";
112830
112987
  function computeAutoReviewManifestHash(manifest) {
112831
- return createHash57("sha256").update(JSON.stringify({
112988
+ return createHash56("sha256").update(JSON.stringify({
112832
112989
  schema_version: manifest.schema_version,
112833
112990
  content_hash: manifest.content_hash,
112834
112991
  plan_requirements_hash: manifest.plan_requirements_hash,
@@ -112919,7 +113076,7 @@ async function computePlanRequirementsHash(directory) {
112919
113076
  return plan ? computeReviewPlanRequirementsHash(plan) : "plan:none";
112920
113077
  }
112921
113078
  function computeAutoReviewPolicyDigest(config) {
112922
- return createHash57("sha256").update(JSON.stringify({
113079
+ return createHash56("sha256").update(JSON.stringify({
112923
113080
  mode: config.final_review.mode,
112924
113081
  min_confidence: config.min_confidence,
112925
113082
  structured_findings: config.structured_findings,
@@ -112965,7 +113122,7 @@ async function loadReviewRequirementsPlan(directory) {
112965
113122
  return replayed.plan;
112966
113123
  }
112967
113124
  function computeReviewPlanRequirementsHash(plan) {
112968
- return createHash57("sha256").update(JSON.stringify({
113125
+ return createHash56("sha256").update(JSON.stringify({
112969
113126
  schema_version: plan.schema_version,
112970
113127
  title: plan.title,
112971
113128
  swarm: plan.swarm,
@@ -115277,7 +115434,7 @@ import { existsSync as existsSync78, mkdirSync as mkdirSync43, readFileSync as r
115277
115434
  import * as path156 from "path";
115278
115435
 
115279
115436
  // src/security/protected-input-integrity.ts
115280
- import { createHash as createHash58 } from "crypto";
115437
+ import { createHash as createHash57 } from "crypto";
115281
115438
  import { lstat as lstat6, readdir as readdir9, readFile as readFile32, realpath as realpath11 } from "fs/promises";
115282
115439
  import * as path154 from "path";
115283
115440
  var LIMITS = {
@@ -115300,11 +115457,11 @@ async function snapshotProtectedTree(root) {
115300
115457
  const afterRead = await lstat6(canonicalRoot);
115301
115458
  if (`${afterRead.dev}:${afterRead.ino}:${afterRead.size}:${afterRead.mtimeMs}` !== `${rootStat.dev}:${rootStat.ino}:${rootStat.size}:${rootStat.mtimeMs}`)
115302
115459
  throw new Error("PROTECTED_INPUT_REPLACED_DURING_READ:root");
115303
- entries2.push(`f\x00.\x00${rootStat.size}\x00${rootStat.mode}\x00${createHash58("sha256").update(content).digest("hex")}`);
115460
+ entries2.push(`f\x00.\x00${rootStat.size}\x00${rootStat.mode}\x00${createHash57("sha256").update(content).digest("hex")}`);
115304
115461
  return Object.freeze({
115305
115462
  v: 1,
115306
115463
  root: canonicalRoot,
115307
- digest: createHash58("sha256").update(entries2[0]).digest("hex"),
115464
+ digest: createHash57("sha256").update(entries2[0]).digest("hex"),
115308
115465
  entries: Object.freeze(entries2)
115309
115466
  });
115310
115467
  }
@@ -115335,7 +115492,7 @@ async function snapshotProtectedTree(root) {
115335
115492
  byteCount += stat14.size;
115336
115493
  if (fileCount > LIMITS.files || byteCount > LIMITS.bytes || Date.now() - started > LIMITS.elapsedMs)
115337
115494
  throw new Error("PROTECTED_INPUT_INTEGRITY_BUDGET_EXCEEDED");
115338
- const contentHash = createHash58("sha256").update(await readFile32(absolute)).digest("hex");
115495
+ const contentHash = createHash57("sha256").update(await readFile32(absolute)).digest("hex");
115339
115496
  const afterRead = await lstat6(absolute);
115340
115497
  if (`${afterRead.dev}:${afterRead.ino}:${afterRead.size}:${afterRead.mtimeMs}` !== identityBefore)
115341
115498
  throw new Error(`PROTECTED_INPUT_REPLACED_DURING_READ:${relative37}`);
@@ -115346,7 +115503,7 @@ async function snapshotProtectedTree(root) {
115346
115503
  return Object.freeze({
115347
115504
  v: 1,
115348
115505
  root: canonicalRoot,
115349
- digest: createHash58("sha256").update(entries2.join(`
115506
+ digest: createHash57("sha256").update(entries2.join(`
115350
115507
  `)).digest("hex"),
115351
115508
  entries: Object.freeze(entries2)
115352
115509
  });
@@ -116710,7 +116867,7 @@ async function countConsensusReportFiles(directory) {
116710
116867
  }
116711
116868
 
116712
116869
  // src/turbo/lean/state.ts
116713
- import { createHash as createHash59 } from "crypto";
116870
+ import { createHash as createHash58 } from "crypto";
116714
116871
  import * as fs86 from "fs";
116715
116872
  import * as path160 from "path";
116716
116873
  init_logger();
@@ -116803,7 +116960,7 @@ function readLegacyPersisted(directory) {
116803
116960
  const raw = fs86.readFileSync(filePath, "utf-8");
116804
116961
  return {
116805
116962
  persisted: parsePersistedJson(raw),
116806
- sourceDigest: createHash59("sha256").update(raw).digest("hex")
116963
+ sourceDigest: createHash58("sha256").update(raw).digest("hex")
116807
116964
  };
116808
116965
  }
116809
116966
  function seedProjectionBestEffort(directory, persisted) {
@@ -118592,7 +118749,7 @@ function buildDetailedHelp(commandName, entry) {
118592
118749
  async function handleHelpCommand(ctx) {
118593
118750
  const targetCommand = ctx.args.join(" ");
118594
118751
  if (!targetCommand) {
118595
- const { buildHelpText } = await import("./index-4cazf4kb.js");
118752
+ const { buildHelpText } = await import("./index-r9ab1sat.js");
118596
118753
  return buildHelpText();
118597
118754
  }
118598
118755
  const tokens = targetCommand.split(/\s+/);
@@ -118606,7 +118763,7 @@ async function handleHelpCommand(ctx) {
118606
118763
  > Note: \`/swarm ${resolved.key}\` is a deprecated alias for \`/swarm ${aliasTarget}\`.` : detailed;
118607
118764
  }
118608
118765
  const similar = _internals39.findSimilarCommands(targetCommand);
118609
- const { buildHelpText: fullHelp } = await import("./index-4cazf4kb.js");
118766
+ const { buildHelpText: fullHelp } = await import("./index-r9ab1sat.js");
118610
118767
  if (similar.length > 0) {
118611
118768
  return `Command '/swarm ${targetCommand}' not found.
118612
118769
 
@@ -118934,7 +119091,7 @@ var COMMAND_REGISTRY = {
118934
119091
  },
118935
119092
  "guardrail explain": {
118936
119093
  handler: async (ctx) => {
118937
- const { handleGuardrailExplain } = await import("./guardrail-explain-fga9bnvt.js");
119094
+ const { handleGuardrailExplain } = await import("./guardrail-explain-pba5em4h.js");
118938
119095
  return handleGuardrailExplain(ctx.directory, ctx.args);
118939
119096
  },
118940
119097
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -118944,7 +119101,7 @@ var COMMAND_REGISTRY = {
118944
119101
  },
118945
119102
  "guardrail reset": {
118946
119103
  handler: async (ctx) => {
118947
- const { handleGuardrailReset } = await import("./guardrail-reset-xpcsxyt0.js");
119104
+ const { handleGuardrailReset } = await import("./guardrail-reset-rfnr2vnn.js");
118948
119105
  return handleGuardrailReset(ctx.args, ctx.sessionID);
118949
119106
  },
118950
119107
  description: "Reset one exact active invocation/action circuit after repair",
@@ -118965,7 +119122,7 @@ var COMMAND_REGISTRY = {
118965
119122
  },
118966
119123
  "guardrail-log": {
118967
119124
  handler: async (ctx) => {
118968
- const { handleGuardrailLog } = await import("./guardrail-log-y84b9m8n.js");
119125
+ const { handleGuardrailLog } = await import("./guardrail-log-24fbykv3.js");
118969
119126
  return handleGuardrailLog(ctx.directory, ctx.args);
118970
119127
  },
118971
119128
  description: "Read the guardrail decision log (use --blocks-only for blocks)",