opencode-swarm 7.200.12 → 7.200.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/.opencode/skills/test-file-split/SKILL.md +6 -1
  2. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  3. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  4. package/dist/cli/{attest-task-0h9adt4t.js → attest-task-1bhnpxsr.js} +26 -26
  5. package/dist/cli/{auto-checkpoint-f7pcj09v.js → auto-checkpoint-v0k01dwk.js} +4 -4
  6. package/dist/cli/{checkpoint-5j4dqdd1.js → checkpoint-w9fkn2v6.js} +8 -8
  7. package/dist/cli/{coder-settlement-n69ee5jz.js → coder-settlement-4t577hx9.js} +4 -4
  8. package/dist/cli/{config-doctor-q23166e4.js → config-doctor-m4c4f4j3.js} +7 -7
  9. package/dist/cli/{core-2th9bfmx.js → core-pqpsbekk.js} +1 -1
  10. package/dist/cli/{curator-drift-b4rcjh23.js → curator-drift-yb05q3a8.js} +5 -5
  11. package/dist/cli/{curator-llm-factory-3b7b55k6.js → curator-llm-factory-r2rsrmz4.js} +26 -26
  12. package/dist/cli/{curator-dsf0966y.js → curator-sxq06cgw.js} +26 -26
  13. package/dist/cli/{doctor-knowledge-receipt-phase-id-4npan6z7.js → doctor-knowledge-receipt-phase-id-7z98yg2z.js} +4 -4
  14. package/dist/cli/{evidence-summary-service-evv73ay3.js → evidence-summary-service-y3g4tg5y.js} +10 -10
  15. package/dist/cli/{gate-evidence-vz9gjwkz.js → gate-evidence-7nasr4dk.js} +3 -3
  16. package/dist/cli/{guardrail-explain-jvvk0at1.js → guardrail-explain-zhq6djgr.js} +27 -27
  17. package/dist/cli/{guardrail-log-b81vyjvz.js → guardrail-log-enq4hp9f.js} +3 -3
  18. package/dist/cli/{guardrail-reset-ygq8e117.js → guardrail-reset-3k2x5vsr.js} +26 -26
  19. package/dist/cli/{hive-promoter-73e5qa2r.js → hive-promoter-sstdct9j.js} +26 -26
  20. package/dist/cli/{index-9t4gxpt5.js → index-11aqm3bt.js} +1 -1
  21. package/dist/cli/{index-213w5jn9.js → index-1520thw9.js} +1 -1
  22. package/dist/cli/{index-9dtd681s.js → index-25v6n1t3.js} +1 -1
  23. package/dist/cli/{index-fk1w7r9k.js → index-39v48pf0.js} +3 -3
  24. package/dist/cli/{index-jkj598w8.js → index-5mbyavx0.js} +1 -1
  25. package/dist/cli/{index-60yd5f2p.js → index-6cnppnh7.js} +2 -2
  26. package/dist/cli/{index-zs5vymnk.js → index-93xekq7n.js} +1 -1
  27. package/dist/cli/{index-0kgqjaaj.js → index-9p3phwap.js} +2 -2
  28. package/dist/cli/{index-dfgqg3qd.js → index-b7y19187.js} +5 -5
  29. package/dist/cli/{index-sfd8kb4k.js → index-fhrcyexn.js} +1 -1
  30. package/dist/cli/{index-fe3dtakd.js → index-g3mrxex7.js} +3 -3
  31. package/dist/cli/{index-0cqr8afr.js → index-gsyv2s9g.js} +4 -4
  32. package/dist/cli/{index-2w17wxc1.js → index-gx2a1xgp.js} +1 -1
  33. package/dist/cli/{index-bxsbm6xx.js → index-h91a4abf.js} +3 -3
  34. package/dist/cli/{index-gkaj31rk.js → index-j3me99q7.js} +3 -3
  35. package/dist/cli/{index-2pvmk43k.js → index-mem1hrkw.js} +1 -1
  36. package/dist/cli/{index-5t3p0nd1.js → index-ne0s5g10.js} +5 -5
  37. package/dist/cli/{index-2ftz9m3d.js → index-pdaycg02.js} +1 -1
  38. package/dist/cli/{index-vzd1w4ra.js → index-phdf1pjq.js} +2 -2
  39. package/dist/cli/{index-5e5s7p5z.js → index-r160hfq9.js} +26 -26
  40. package/dist/cli/{index-phm7gmpq.js → index-sm64f3fc.js} +757 -198
  41. package/dist/cli/{index-1egy4f76.js → index-sxna6jn9.js} +1 -1
  42. package/dist/cli/{index-xdyqfp37.js → index-szwa4tek.js} +2 -2
  43. package/dist/cli/{index-td0bfecx.js → index-szwmgbm4.js} +3 -3
  44. package/dist/cli/{index-n9mb83fx.js → index-t6dkmt0c.js} +3 -3
  45. package/dist/cli/{index-z0jf1tyr.js → index-vjdwrd9r.js} +1 -1
  46. package/dist/cli/{index-gvzf86kf.js → index-vqxvdx7n.js} +2 -2
  47. package/dist/cli/{index-5ecsb26p.js → index-vv9k85h0.js} +6 -6
  48. package/dist/cli/{index-n425a88g.js → index-wj3a023e.js} +1 -1
  49. package/dist/cli/{index-wfx209wp.js → index-yc5e6yr5.js} +2 -2
  50. package/dist/cli/{index-cy2zmsa0.js → index-ztezaknp.js} +28 -28
  51. package/dist/cli/index.js +27 -27
  52. package/dist/cli/{knowledge-escalator-et068ebg.js → knowledge-escalator-h8j3v62j.js} +7 -7
  53. package/dist/cli/{knowledge-events-2ha1zsv5.js → knowledge-events-f80mxhjd.js} +5 -5
  54. package/dist/cli/{knowledge-store-bpchbre8.js → knowledge-store-z0eb6xk5.js} +1 -1
  55. package/dist/cli/{knowledge-validator-0q4xmhch.js → knowledge-validator-k0jn2w06.js} +2 -2
  56. package/dist/cli/{mcp-hh5k6qar.js → mcp-zg75c3e4.js} +1 -1
  57. package/dist/cli/{model-preflight-zh4t5ywj.js → model-preflight-2592b0fv.js} +26 -26
  58. package/dist/cli/{pending-delegations-vxk971ny.js → pending-delegations-ek7600es.js} +2 -2
  59. package/dist/cli/{pr-subscriptions-nhdfz8pc.js → pr-subscriptions-wmzs42h3.js} +1 -1
  60. package/dist/cli/{pr-workflow-gate-bej2nn0c.js → pr-workflow-gate-regg66xa.js} +26 -26
  61. package/dist/cli/{scan-cursor-v5f7s9jb.js → scan-cursor-rxpkxhj3.js} +2 -2
  62. package/dist/cli/{schema-ejerjdcy.js → schema-art9xdhq.js} +1 -1
  63. package/dist/cli/{scope-persistence-5nd08ct5.js → scope-persistence-7ny8a0gk.js} +5 -5
  64. package/dist/cli/{server-e9xvqypk.js → server-b4nczew1.js} +26 -26
  65. package/dist/cli/{skill-generator-6c57ckmm.js → skill-generator-bbzwn7ny.js} +8 -8
  66. package/dist/cli/{snapshot-coordination-init-jbs93ng2.js → snapshot-coordination-init-1v237k29.js} +26 -26
  67. package/dist/cli/{speckit-checkoff-ryx6gh3p.js → speckit-checkoff-tc2pswse.js} +3 -3
  68. package/dist/cli/{workflow-wal-file-3f6ajfce.js → workflow-wal-file-4vh413p1.js} +2 -2
  69. package/dist/cli/{worktree-collision-ownership-vdjhvm3b.js → worktree-collision-ownership-vt740r91.js} +2 -2
  70. package/dist/cli/{worktree-isolation-arqj4g26.js → worktree-isolation-yqfqvtex.js} +26 -26
  71. package/dist/hooks/guardrails/cmd-delete-grammar.d.ts +17 -0
  72. package/dist/hooks/skill-propagation-gate.d.ts +13 -0
  73. package/dist/index.js +100 -83
  74. package/dist/memory/memory-family-migration.d.ts +57 -3
  75. package/dist/turbo/lean/planner.d.ts +8 -5
  76. package/dist/turbo/lean/runner.d.ts +3 -0
  77. package/dist/turbo/lean/upstream-committed.d.ts +94 -0
  78. package/dist/utils/ephemeral-session-teardown.d.ts +24 -5
  79. package/package.json +1 -1
@@ -17,14 +17,14 @@ import {
17
17
  protectedRoots,
18
18
  redactDecisionLineForArchive,
19
19
  stableCanonicalStringify
20
- } from "./index-1egy4f76.js";
20
+ } from "./index-sxna6jn9.js";
21
21
  import {
22
22
  detectStraySwarmDirs,
23
23
  readDoctorArtifact,
24
24
  removeStraySwarmDir,
25
25
  resolvePlanParallelizationFlag,
26
26
  runConfigDoctor
27
- } from "./index-gkaj31rk.js";
27
+ } from "./index-j3me99q7.js";
28
28
  import {
29
29
  archiveEvidence,
30
30
  checkRequirementCoverage,
@@ -36,7 +36,7 @@ import {
36
36
  sanitizeTaskId,
37
37
  saveEvidence,
38
38
  validateProjectRoot
39
- } from "./index-sfd8kb4k.js";
39
+ } from "./index-fhrcyexn.js";
40
40
  import {
41
41
  EvaluationTaskV1Schema,
42
42
  GateAuditManifestV1Schema,
@@ -107,16 +107,16 @@ import {
107
107
  skillContractDigest,
108
108
  splitSkillFrontmatter,
109
109
  syncBundledProjectSkillsIfMissingAsync
110
- } from "./index-fk1w7r9k.js";
110
+ } from "./index-39v48pf0.js";
111
111
  import {
112
112
  buildEscalationBriefing,
113
113
  readRecentEscalations
114
- } from "./index-5ecsb26p.js";
114
+ } from "./index-vv9k85h0.js";
115
115
  import {
116
116
  alreadyCuratedThisGeneration,
117
117
  claimNextScanBatch,
118
118
  resolveCohortId
119
- } from "./index-2w17wxc1.js";
119
+ } from "./index-gx2a1xgp.js";
120
120
  import {
121
121
  CURATOR_CONSOLIDATION_PROMPT,
122
122
  CURATOR_INIT_PROMPT,
@@ -135,13 +135,13 @@ import {
135
135
  getGroupCommitWriter,
136
136
  importLegacyJsonl,
137
137
  readPriorDriftReports
138
- } from "./index-2ftz9m3d.js";
138
+ } from "./index-pdaycg02.js";
139
139
  import {
140
140
  assertNoUnsettledCoderDispatch,
141
141
  listCoderSettlementWalStates,
142
142
  recoverCoderSettlement,
143
143
  recoverStaleCoderSettlements
144
- } from "./index-dfgqg3qd.js";
144
+ } from "./index-b7y19187.js";
145
145
  import {
146
146
  TASK_WORKFLOW_SCHEMA_MARKER,
147
147
  compareTaskWorkflowStateRank,
@@ -155,7 +155,7 @@ import {
155
155
  readTaskEvidenceState,
156
156
  transitionTaskWorkflowEvidenceWithStatus,
157
157
  withTaskEvidenceTransaction
158
- } from "./index-213w5jn9.js";
158
+ } from "./index-1520thw9.js";
159
159
  import {
160
160
  fastForwardToRefAsync,
161
161
  parsePorcelainV2Snapshot,
@@ -289,7 +289,7 @@ import {
289
289
  writeAtomicJson,
290
290
  writePrWorkflowAtomicJson,
291
291
  writeStateWhileLocked
292
- } from "./index-n9mb83fx.js";
292
+ } from "./index-t6dkmt0c.js";
293
293
  import {
294
294
  MAX_PENDING_SCOPE_BINDINGS,
295
295
  canonicalWorkspaceIdentity,
@@ -298,7 +298,7 @@ import {
298
298
  clearScopeBindings,
299
299
  readAuthoritativeScopeBindingSet,
300
300
  readDeclaredScopeFilesFromBindings
301
- } from "./index-9dtd681s.js";
301
+ } from "./index-25v6n1t3.js";
302
302
  import {
303
303
  DEFAULT_QA_GATES,
304
304
  computeProfileHash,
@@ -349,7 +349,7 @@ import {
349
349
  swarmOverwriteCandidates,
350
350
  trackedDirtyCandidates,
351
351
  transientBackoff
352
- } from "./index-fe3dtakd.js";
352
+ } from "./index-g3mrxex7.js";
353
353
  import {
354
354
  EPIC_MODE_CONFIG_DISABLED_MESSAGE,
355
355
  PlanRecoverySupersededError,
@@ -381,7 +381,7 @@ import {
381
381
  updateEpicRecord,
382
382
  updateTaskStatus,
383
383
  withPlanLifecycleLock
384
- } from "./index-5t3p0nd1.js";
384
+ } from "./index-ne0s5g10.js";
385
385
  import {
386
386
  containsControlChars,
387
387
  containsPathTraversal,
@@ -398,7 +398,7 @@ import {
398
398
  resolveSpeckitProjection,
399
399
  validateSpeckit,
400
400
  writeProjectedSpecSync
401
- } from "./index-td0bfecx.js";
401
+ } from "./index-szwmgbm4.js";
402
402
  import {
403
403
  clearWorktreeMergeStatus,
404
404
  getAllWorktreeMergeFailures,
@@ -421,7 +421,7 @@ import {
421
421
  replayFromLedgerWithStatus,
422
422
  resolvePlanningProfile,
423
423
  takeSnapshotEvent
424
- } from "./index-vzd1w4ra.js";
424
+ } from "./index-phdf1pjq.js";
425
425
  import {
426
426
  MAX_COORDINATION_STATE_LIST_ROWS,
427
427
  deleteCoordinationImports,
@@ -485,7 +485,7 @@ import {
485
485
  recordHiveKnowledgeEvent,
486
486
  recordKnowledgeEvent,
487
487
  resolveKnowledgeEventsPath
488
- } from "./index-gvzf86kf.js";
488
+ } from "./index-vqxvdx7n.js";
489
489
  import {
490
490
  commitDisplayedMembership,
491
491
  commitEmptyRetrieval,
@@ -498,7 +498,7 @@ import {
498
498
  queryLiveMemberships,
499
499
  reconcilePhaseClose,
500
500
  recordPhaseCloseIntent
501
- } from "./index-wfx209wp.js";
501
+ } from "./index-yc5e6yr5.js";
502
502
  import {
503
503
  sanitizeContextText
504
504
  } from "./index-m9zzj4ee.js";
@@ -519,7 +519,7 @@ import {
519
519
  validateActionableFields,
520
520
  validateLesson,
521
521
  validateSkillPath
522
- } from "./index-n425a88g.js";
522
+ } from "./index-wj3a023e.js";
523
523
  import {
524
524
  MAX_CURATION_PROPOSALS,
525
525
  authorizeCuration,
@@ -558,7 +558,7 @@ import {
558
558
  transactFile,
559
559
  transactKnowledge,
560
560
  wordBigrams
561
- } from "./index-0cqr8afr.js";
561
+ } from "./index-gsyv2s9g.js";
562
562
  import {
563
563
  readTailJsonl,
564
564
  readTailJsonlDetailed,
@@ -582,7 +582,7 @@ import {
582
582
  } from "./index-erp7fk72.js";
583
583
  import {
584
584
  resolveWorktreeIsolationConfig
585
- } from "./index-60yd5f2p.js";
585
+ } from "./index-6cnppnh7.js";
586
586
  import {
587
587
  RetrospectiveEvidenceSchema
588
588
  } from "./index-g22dps7x.js";
@@ -603,7 +603,7 @@ import {
603
603
  loadPluginConfig,
604
604
  loadPluginConfigWithMeta,
605
605
  resolveEpicConfig
606
- } from "./index-jkj598w8.js";
606
+ } from "./index-5mbyavx0.js";
607
607
  import {
608
608
  DEFAULT_HARNESS_EVOLUTION_CONFIG,
609
609
  DEFAULT_HARNESS_OPT_CONFIG,
@@ -625,7 +625,7 @@ import {
625
625
  resolveContextWindow,
626
626
  resolveGeneratedAgentRole,
627
627
  stripKnownSwarmPrefix
628
- } from "./index-9t4gxpt5.js";
628
+ } from "./index-11aqm3bt.js";
629
629
  import {
630
630
  KNOWLEDGE_SCHEMA_VERSION,
631
631
  OUTCOME_BLOCK_THRESHOLD,
@@ -647,7 +647,7 @@ import {
647
647
  recoveryReadErrored,
648
648
  startupOrphanRecovery,
649
649
  writeWorkflowWalFile
650
- } from "./index-2pvmk43k.js";
650
+ } from "./index-mem1hrkw.js";
651
651
  import {
652
652
  assertSettlementArtifactsRemovable,
653
653
  isPathUnderSwarmWorktreeBase,
@@ -658,7 +658,7 @@ import {
658
658
  removeWorktree,
659
659
  resolveWorktreeBaseDir,
660
660
  withSettlementArtifactLifecycle
661
- } from "./index-xdyqfp37.js";
661
+ } from "./index-szwa4tek.js";
662
662
  import {
663
663
  estimateCharsForTokens,
664
664
  estimateTokens,
@@ -1716,6 +1716,83 @@ var SidecarCandidateSchema = exports_external.discriminatedUnion("row_format_fam
1716
1716
  invariant_violated: exports_external.string().min(1)
1717
1717
  }).strict()
1718
1718
  ]);
1719
+ var BIDI_RANGES = [
1720
+ [8234, 8238],
1721
+ [8294, 8297]
1722
+ ];
1723
+ function isBidiCodePoint(code) {
1724
+ for (let i = 0;i < BIDI_RANGES.length; i++) {
1725
+ const [lo, hi] = BIDI_RANGES[i];
1726
+ if (code >= lo && code <= hi)
1727
+ return true;
1728
+ }
1729
+ return false;
1730
+ }
1731
+ function sanitizeString(value) {
1732
+ let result = "";
1733
+ for (let i = 0;i < value.length; i++) {
1734
+ const code = value.codePointAt(i) ?? 0;
1735
+ if (code > 65535) {
1736
+ result += value[i];
1737
+ i++;
1738
+ result += value[i];
1739
+ } else if (code === 0) {
1740
+ result += "\\u0000";
1741
+ } else if (code === 27) {
1742
+ if (i + 1 < value.length && value[i + 1] === "[") {
1743
+ i++;
1744
+ while (i + 1 < value.length) {
1745
+ const next = value.charCodeAt(i + 1);
1746
+ if (next >= 48 && next <= 63) {
1747
+ i++;
1748
+ } else if (next >= 32 && next <= 47) {
1749
+ i++;
1750
+ } else if (next >= 64 && next <= 126) {
1751
+ i++;
1752
+ break;
1753
+ } else {
1754
+ break;
1755
+ }
1756
+ }
1757
+ } else if (i + 1 < value.length && value[i + 1] === "]") {
1758
+ i++;
1759
+ while (i + 1 < value.length) {
1760
+ const next = value.charCodeAt(i + 1);
1761
+ if (next === 7) {
1762
+ i++;
1763
+ break;
1764
+ } else if (next === 27 && i + 2 < value.length && value[i + 2] === "\\") {
1765
+ i += 2;
1766
+ break;
1767
+ } else {
1768
+ i++;
1769
+ }
1770
+ }
1771
+ } else if (i + 1 < value.length) {
1772
+ const next = value.charCodeAt(i + 1);
1773
+ if (next >= 32 && next <= 47) {
1774
+ i++;
1775
+ while (i + 1 < value.length) {
1776
+ const b = value.charCodeAt(i + 1);
1777
+ if (b >= 48 && b <= 126) {
1778
+ i++;
1779
+ break;
1780
+ } else if (b >= 32 && b <= 47) {
1781
+ i++;
1782
+ } else {
1783
+ break;
1784
+ }
1785
+ }
1786
+ } else if (next >= 48 && next <= 126) {
1787
+ i++;
1788
+ }
1789
+ }
1790
+ } else if (isBidiCodePoint(code)) {} else {
1791
+ result += value[i];
1792
+ }
1793
+ }
1794
+ return result;
1795
+ }
1719
1796
 
1720
1797
  // src/background/candidate-parser.ts
1721
1798
  var ArtifactInputSchema = exports_external.object({
@@ -7723,17 +7800,47 @@ async function teardownEphemeralSession(session, sessionId, options = {}) {
7723
7800
  }
7724
7801
  var DEFAULT_EPHEMERAL_VERIFY_TIMEOUT_MS = 2000;
7725
7802
  var DEFAULT_EPHEMERAL_MAX_DELETE_ATTEMPTS = 3;
7803
+ var TRANSIENT_TRANSPORT_ERROR_CODES = new Set([
7804
+ "ECONNRESET",
7805
+ "ECONNREFUSED",
7806
+ "EAI_AGAIN",
7807
+ "ETIMEDOUT",
7808
+ "ENOTFOUND",
7809
+ "EPIPE",
7810
+ "UND_ERR_SOCKET"
7811
+ ]);
7812
+ function isTransientTransportError(err) {
7813
+ if (typeof err !== "object" || err === null)
7814
+ return false;
7815
+ if (err instanceof TypeError)
7816
+ return true;
7817
+ const coded = err;
7818
+ if (typeof coded.code === "string" && TRANSIENT_TRANSPORT_ERROR_CODES.has(coded.code)) {
7819
+ return true;
7820
+ }
7821
+ return coded.name === "AbortError";
7822
+ }
7726
7823
  async function sessionExists(session, sessionId, verifyTimeoutMs) {
7727
7824
  if (typeof session.get !== "function")
7728
- return true;
7825
+ return "alive";
7826
+ const verifyTimeoutError = new Error(`ephemeral session verify timed out after ${verifyTimeoutMs}ms`);
7729
7827
  try {
7730
- const result = await withTimeout(session.get({ path: { id: sessionId } }), verifyTimeoutMs, new Error(`ephemeral session verify timed out after ${verifyTimeoutMs}ms`));
7828
+ const result = await withTimeout(session.get({ path: { id: sessionId } }), verifyTimeoutMs, verifyTimeoutError);
7731
7829
  const body = result?.data;
7732
- if (body === undefined || body === null)
7733
- return false;
7734
- return true;
7735
- } catch {
7736
- return false;
7830
+ if (body === undefined || body === null) {
7831
+ const envelopeError = result?.error;
7832
+ if (envelopeError !== undefined && envelopeError !== null && isTransientTransportError(envelopeError)) {
7833
+ return "unreadable";
7834
+ }
7835
+ return "gone";
7836
+ }
7837
+ return "alive";
7838
+ } catch (err) {
7839
+ if (err === verifyTimeoutError)
7840
+ return "unreadable";
7841
+ if (isTransientTransportError(err))
7842
+ return "unreadable";
7843
+ return "gone";
7737
7844
  }
7738
7845
  }
7739
7846
  async function teardownEphemeralSessionVerified(session, sessionId, options = {}) {
@@ -7756,9 +7863,19 @@ async function teardownEphemeralSessionVerified(session, sessionId, options = {}
7756
7863
  skipAbort: deleteAttempts > 0 ? true : options.skipAbort
7757
7864
  });
7758
7865
  deleteAttempts += 1;
7759
- const alive = await _internals18.sessionExists(session, sessionId, verifyTimeoutMs);
7760
- if (!alive)
7866
+ const existence = await _internals18.sessionExists(session, sessionId, verifyTimeoutMs);
7867
+ if (existence === "gone") {
7761
7868
  return { ok: true, sessionId, attempts: deleteAttempts };
7869
+ }
7870
+ if (existence === "unreadable") {
7871
+ return {
7872
+ ok: false,
7873
+ sessionId,
7874
+ attempts: deleteAttempts,
7875
+ kind: "ephemeral-session-teardown-unverified",
7876
+ reason: "verify-unreadable"
7877
+ };
7878
+ }
7762
7879
  if (deleteAttempts >= attempts) {
7763
7880
  return {
7764
7881
  ok: false,
@@ -7775,6 +7892,7 @@ var _internals18 = {
7775
7892
  boundedAbort: boundedAbortEphemeralSession,
7776
7893
  boundedDelete: boundedDeleteEphemeralSession,
7777
7894
  sessionExists,
7895
+ isTransientTransportError,
7778
7896
  log
7779
7897
  };
7780
7898
 
@@ -9675,7 +9793,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
9675
9793
  return extracted === expectedSessionId;
9676
9794
  }
9677
9795
  async function inspectStandardWorktreeCollisionOwnership(identity) {
9678
- const collisionOwnership = await import("./worktree-collision-ownership-vdjhvm3b.js");
9796
+ const collisionOwnership = await import("./worktree-collision-ownership-vt740r91.js");
9679
9797
  return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
9680
9798
  }
9681
9799
  async function runRecoveryGit(directory, args, timeoutMs = 15000) {
@@ -9878,7 +9996,7 @@ async function precreateStandardWorktreeSession(args) {
9878
9996
  if (lateChildSessionId) {
9879
9997
  const verification = await teardownEphemeralSessionVerified(client.session, lateChildSessionId);
9880
9998
  if (!verification.ok) {
9881
- pushAdvisory(ensureAgentSession(args.parentSessionID), `WORKTREE_RECOVERY_CHILD_SESSION_LEAKED: recovery child session ${lateChildSessionId} survived verified teardown (${verification.reason}); it holds the lane swarm.db at ${collision.worktreePath}. Retry the dispatch or restart the host to release it.`);
9999
+ pushAdvisory(ensureAgentSession(args.parentSessionID), `WORKTREE_RECOVERY_CHILD_SESSION_LEAKED: recovery child session ${lateChildSessionId} was not confirmed deleted by verified teardown (${verification.reason}); it holds the lane swarm.db at ${collision.worktreePath}. Retry the dispatch or restart the host to release it.`);
9882
10000
  }
9883
10001
  }
9884
10002
  }, resolveSessionCreateTimeoutMs(args));
@@ -9928,7 +10046,7 @@ async function precreateStandardWorktreeSession(args) {
9928
10046
  if (recoveredChildSessionId) {
9929
10047
  const verification = await teardownEphemeralSessionVerified(client.session, recoveredChildSessionId);
9930
10048
  if (!verification.ok) {
9931
- pushAdvisory(ensureAgentSession(args.parentSessionID), `WORKTREE_RECOVERY_CHILD_SESSION_LEAKED: recovery child session ${recoveredChildSessionId} survived verified teardown (${verification.reason}); it holds the lane swarm.db at ${collision.worktreePath}. Retry the dispatch or restart the host to release it.`);
10049
+ pushAdvisory(ensureAgentSession(args.parentSessionID), `WORKTREE_RECOVERY_CHILD_SESSION_LEAKED: recovery child session ${recoveredChildSessionId} was not confirmed deleted by verified teardown (${verification.reason}); it holds the lane swarm.db at ${collision.worktreePath}. Retry the dispatch or restart the host to release it.`);
9932
10050
  }
9933
10051
  }
9934
10052
  hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_RECOVERY_SESSION_CREATE_FAILED: ${error2 instanceof Error ? error2.message : String(error2)}. The PREPARED claim was rolled back and recovery re-dispatch was blocked.`);
@@ -10103,7 +10221,7 @@ async function precreateStandardWorktreeSession(args) {
10103
10221
  const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, handle.worktreePath);
10104
10222
  if (laneProfile) {
10105
10223
  try {
10106
- const { writeLaneProfileToDiskReal } = await import("./core-2th9bfmx.js");
10224
+ const { writeLaneProfileToDiskReal } = await import("./core-pqpsbekk.js");
10107
10225
  await writeLaneProfileToDiskReal(handle.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
10108
10226
  } catch {}
10109
10227
  }
@@ -10136,7 +10254,7 @@ async function precreateStandardWorktreeSession(args) {
10136
10254
  lanePath: handle.worktreePath,
10137
10255
  branchName: handle.branchName,
10138
10256
  taskId: args.taskId,
10139
- reason: `late child session ${lateChildSessionId} survived verified teardown (${verification.reason})`
10257
+ reason: `late child session ${lateChildSessionId} was not confirmed deleted by verified teardown (${verification.reason})`
10140
10258
  });
10141
10259
  }
10142
10260
  }
@@ -11103,7 +11221,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
11103
11221
  }
11104
11222
  clearWorktreeMergeStatus(statusKey);
11105
11223
  try {
11106
- const { removeLaneProfileFromDiskReal } = await import("./core-2th9bfmx.js");
11224
+ const { removeLaneProfileFromDiskReal } = await import("./core-pqpsbekk.js");
11107
11225
  await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
11108
11226
  } catch {}
11109
11227
  const state = serializationStateBySessionID.get(dispatch.parentSessionID);
@@ -12943,39 +13061,6 @@ init_config();
12943
13061
  // src/security/command-classifier.ts
12944
13062
  import { createHash as createHash16 } from "crypto";
12945
13063
 
12946
- // src/hooks/guardrails/destructive-command.ts
12947
- import * as fsSync from "fs";
12948
- import * as path17 from "path";
12949
-
12950
- // src/hooks/shell-executor-context.ts
12951
- var CMD_SWITCH = String.raw`\/[a-z](?::(?:on|off))?`;
12952
- var CMD_WRAPPER_DECLARATION = new RegExp(String.raw`(?:^|[;|&\n])\s*cmd(?:\.exe)?\s+(?:${CMD_SWITCH}\s+)*\/c(?:\s|$)`, "i");
12953
- var PS_WRAPPER_DECLARATION = /(?:^|[;|&\n])\s*(?:powershell|pwsh)(?:\.exe)?\s+(?:-[A-Za-z]+\s+)*-command(?:\s|$)/i;
12954
- var PS_WRAPPER_LOOSE = /(?:^|\|)\s*(?:powershell|pwsh)(?:\.exe)?\s+-/i;
12955
- function declaresWindowsWrapper(command) {
12956
- return CMD_WRAPPER_DECLARATION.test(command) || PS_WRAPPER_DECLARATION.test(command);
12957
- }
12958
- function declaresWindowsWrapperLoose(command) {
12959
- return declaresWindowsWrapper(command) || PS_WRAPPER_LOOSE.test(command);
12960
- }
12961
- var CMD_BUILTIN_PREFIX = new RegExp(String.raw`(?:(?:^|\s)(?:if\s+(?:not\s+)?exist\s+(?:"[^"]*"|\S+)\s+)|(?:^|[;|&\n])\s*cmd(?:\.exe)?\s+(?:${CMD_SWITCH}\s+)*\/c\s+|(?:^|\s)(?:call|start)\s+)*`, "i");
12962
- var CMD_STRIP_PREFIX = new RegExp(String.raw`^cmd(?:\.exe)?\s+(?:${CMD_SWITCH}\s+)*\/[ck]\s+`, "i");
12963
- var PS_STRIP_PREFIX = /^(?:powershell|pwsh)(?:\.exe)?\s+(?:-[A-Za-z]+\s+)*-(?:command|c)\s+/i;
12964
- var observedHostShell;
12965
- function getObservedHostShell() {
12966
- return observedHostShell;
12967
- }
12968
- function hostShellGrammarFamily(hostShell) {
12969
- const leaf = hostShell.split(/[\\/]/).filter(Boolean).pop() ?? hostShell;
12970
- const name = leaf.replace(/\.exe$/i, "").toLowerCase();
12971
- return name === "powershell" || name === "pwsh" || name === "cmd" ? "windows" : "posix";
12972
- }
12973
-
12974
- // src/hooks/shell-write-detect.ts
12975
- init_path_identity();
12976
- import * as path16 from "path";
12977
- import parse from "bash-parser";
12978
-
12979
13064
  // src/hooks/guardrails/cmd-delete-grammar.ts
12980
13065
  function dcIsSwitchClusterText(text) {
12981
13066
  if (text.length === 0)
@@ -12993,7 +13078,7 @@ function dcScanCmdTokens(args) {
12993
13078
  current += ch;
12994
13079
  continue;
12995
13080
  }
12996
- if (!inQuote && /[\s,;=]/.test(ch)) {
13081
+ if (!inQuote && /[\s,;=()<>|&]/.test(ch)) {
12997
13082
  if (current.length > 0)
12998
13083
  tokens.push(current);
12999
13084
  current = "";
@@ -13005,9 +13090,9 @@ function dcScanCmdTokens(args) {
13005
13090
  tokens.push(current);
13006
13091
  return tokens;
13007
13092
  }
13008
- function dcParseWindowsRecursiveDelete(args) {
13009
- const tokens = dcScanCmdTokens(args);
13010
- const fires = tokens.some((token) => {
13093
+ function dcHasCmdDeleteSwitch(args, letters) {
13094
+ const wanted = letters.toLowerCase();
13095
+ return dcScanCmdTokens(args).some((token) => {
13011
13096
  let inQuote = false;
13012
13097
  let slashIdx = -1;
13013
13098
  for (let i = 0;i < token.length; i += 1) {
@@ -13025,8 +13110,19 @@ function dcParseWindowsRecursiveDelete(args) {
13025
13110
  const afterSlash = token.slice(slashIdx + 1);
13026
13111
  const quoteIdx = afterSlash.indexOf('"');
13027
13112
  const switchText = (quoteIdx >= 0 ? afterSlash.slice(0, quoteIdx) : afterSlash).replace(/["']/g, "");
13028
- return dcIsSwitchClusterText(switchText) && switchText.replace(/\//g, "").toLowerCase().includes("s");
13113
+ if (!dcIsSwitchClusterText(switchText))
13114
+ return false;
13115
+ const cluster = switchText.replace(/\//g, "").toLowerCase();
13116
+ for (const letter of wanted) {
13117
+ if (cluster.includes(letter))
13118
+ return true;
13119
+ }
13120
+ return false;
13029
13121
  });
13122
+ }
13123
+ function dcParseWindowsRecursiveDelete(args) {
13124
+ const tokens = dcScanCmdTokens(args);
13125
+ const fires = dcHasCmdDeleteSwitch(args, "s");
13030
13126
  const targets = [];
13031
13127
  for (const token of tokens) {
13032
13128
  let inQuote = false;
@@ -13070,7 +13166,38 @@ function dcParseWindowsRecursiveDelete(args) {
13070
13166
  return { fires, targets };
13071
13167
  }
13072
13168
 
13169
+ // src/hooks/guardrails/destructive-command.ts
13170
+ import * as fsSync from "fs";
13171
+ import * as path17 from "path";
13172
+
13173
+ // src/hooks/shell-executor-context.ts
13174
+ var CMD_SWITCH = String.raw`\/[a-z](?::(?:on|off))?`;
13175
+ var CMD_WRAPPER_DECLARATION = new RegExp(String.raw`(?:^|[;|&\n])\s*cmd(?:\.exe)?\s+(?:${CMD_SWITCH}\s+)*\/c(?:\s|$)`, "i");
13176
+ var PS_WRAPPER_DECLARATION = /(?:^|[;|&\n])\s*(?:powershell|pwsh)(?:\.exe)?\s+(?:-[A-Za-z]+\s+)*-command(?:\s|$)/i;
13177
+ var PS_WRAPPER_LOOSE = /(?:^|\|)\s*(?:powershell|pwsh)(?:\.exe)?\s+-/i;
13178
+ function declaresWindowsWrapper(command) {
13179
+ return CMD_WRAPPER_DECLARATION.test(command) || PS_WRAPPER_DECLARATION.test(command);
13180
+ }
13181
+ function declaresWindowsWrapperLoose(command) {
13182
+ return declaresWindowsWrapper(command) || PS_WRAPPER_LOOSE.test(command);
13183
+ }
13184
+ var CMD_BUILTIN_PREFIX = new RegExp(String.raw`(?:(?:^|\s)(?:if\s+(?:not\s+)?exist\s+(?:"[^"]*"|\S+)\s+)|(?:^|[;|&\n])\s*cmd(?:\.exe)?\s+(?:${CMD_SWITCH}\s+)*\/c\s+|(?:^|\s)(?:call|start)\s+)*`, "i");
13185
+ var CMD_STRIP_PREFIX = new RegExp(String.raw`^cmd(?:\.exe)?\s+(?:${CMD_SWITCH}\s+)*\/[ck]\s+`, "i");
13186
+ var PS_STRIP_PREFIX = /^(?:powershell|pwsh)(?:\.exe)?\s+(?:-[A-Za-z]+\s+)*-(?:command|c)\s+/i;
13187
+ var observedHostShell;
13188
+ function getObservedHostShell() {
13189
+ return observedHostShell;
13190
+ }
13191
+ function hostShellGrammarFamily(hostShell) {
13192
+ const leaf = hostShell.split(/[\\/]/).filter(Boolean).pop() ?? hostShell;
13193
+ const name = leaf.replace(/\.exe$/i, "").toLowerCase();
13194
+ return name === "powershell" || name === "pwsh" || name === "cmd" ? "windows" : "posix";
13195
+ }
13196
+
13073
13197
  // src/hooks/shell-write-detect.ts
13198
+ init_path_identity();
13199
+ import * as path16 from "path";
13200
+ import parse from "bash-parser";
13074
13201
  function unsafeShellCommandTextReason(value) {
13075
13202
  return unsafePathTextReason(value.replace(/[\r\n]/g, ""));
13076
13203
  }
@@ -13547,9 +13674,10 @@ function detectProcessSubstitutionWrites(command) {
13547
13674
  continue;
13548
13675
  const stages = innerCommand.split("|").map((s) => s.trim());
13549
13676
  for (const stage of stages) {
13550
- const builtinResult = detectBuiltinWritesFromString(stage);
13551
- if (builtinResult)
13552
- results.push(builtinResult);
13677
+ const builtinWrites = detectBuiltinWritesFromString(stage);
13678
+ for (const write of builtinWrites) {
13679
+ results.push(write);
13680
+ }
13553
13681
  const appendMatch = stage.match(/^\s*(.*?)\s*>>(\s*)(\S+)\s*$/);
13554
13682
  if (appendMatch) {
13555
13683
  const path17 = appendMatch[3];
@@ -13572,20 +13700,37 @@ function detectProcessSubstitutionWrites(command) {
13572
13700
  function detectBuiltinWritesFromString(cmd) {
13573
13701
  const tokens = cmd.trim().split(/\s+/);
13574
13702
  if (tokens.length === 0)
13575
- return null;
13703
+ return [];
13576
13704
  const leaf = detectorCommandLeafFromWords(tokens[0], tokens.slice(1));
13577
13705
  const name = detectorSetMember(leaf, BUILTIN_WRITE_COMMANDS);
13578
13706
  if (!name)
13579
- return null;
13707
+ return [];
13580
13708
  if (name === "rmdir" && dcParseWindowsRecursiveDelete(cmd).fires) {
13581
- return null;
13709
+ return [];
13710
+ }
13711
+ if (name === "rmdir" || name === "truncate") {
13712
+ const writes = [];
13713
+ let endOfOptions = false;
13714
+ for (let i = 1;i < tokens.length; i += 1) {
13715
+ const token = tokens[i];
13716
+ if (!endOfOptions && token === "--") {
13717
+ endOfOptions = true;
13718
+ continue;
13719
+ }
13720
+ if (!endOfOptions && token.startsWith("-"))
13721
+ continue;
13722
+ if (name === "truncate" && !endOfOptions && isNumeric(token))
13723
+ continue;
13724
+ writes.push({ category: "builtin_write", operator: name, path: token });
13725
+ }
13726
+ return writes;
13582
13727
  }
13583
13728
  for (let i = tokens.length - 1;i >= 1; i--) {
13584
13729
  if (!tokens[i].startsWith("-")) {
13585
- return { category: "builtin_write", operator: name, path: tokens[i] };
13730
+ return [{ category: "builtin_write", operator: name, path: tokens[i] }];
13586
13731
  }
13587
13732
  }
13588
- return null;
13733
+ return [];
13589
13734
  }
13590
13735
  function wordText(node) {
13591
13736
  if (!node || typeof node !== "object")
@@ -14314,14 +14459,33 @@ function detectBuiltinWrites(cmd) {
14314
14459
  return results;
14315
14460
  }
14316
14461
  if (lowerName === "truncate") {
14462
+ let endOfOptions = false;
14317
14463
  for (const word of suffixWords) {
14318
- if (!word.startsWith("-") && !isNumeric(word)) {
14464
+ if (!endOfOptions && word === "--") {
14465
+ endOfOptions = true;
14466
+ continue;
14467
+ }
14468
+ if (endOfOptions || !word.startsWith("-") && !isNumeric(word)) {
14319
14469
  results.push({
14320
14470
  category: "builtin_write",
14321
14471
  operator: "truncate",
14322
14472
  path: word
14323
14473
  });
14324
- break;
14474
+ }
14475
+ }
14476
+ } else if (lowerName === "rmdir") {
14477
+ let endOfOptions = false;
14478
+ for (const word of suffixWords) {
14479
+ if (!endOfOptions && word === "--") {
14480
+ endOfOptions = true;
14481
+ continue;
14482
+ }
14483
+ if (endOfOptions || !word.startsWith("-")) {
14484
+ results.push({
14485
+ category: "builtin_write",
14486
+ operator: dedupeOperator,
14487
+ path: word
14488
+ });
14325
14489
  }
14326
14490
  }
14327
14491
  } else {
@@ -15576,19 +15740,28 @@ function detectPosixWrites(command) {
15576
15740
  collectLeafCommands(ast, leafCommands);
15577
15741
  cwdNeutral = leafCommands.every(isCwdNeutralLeaf);
15578
15742
  for (const cmd of leafCommands) {
15579
- allWrites.push(...detectRedirects(cmd));
15580
- allWrites.push(...detectBuiltinWrites(cmd));
15581
- allWrites.push(...detectInplaceEdit(cmd));
15582
- allWrites.push(...detectInterpreterEval(cmd));
15583
- allWrites.push(...detectNetworkDownloaders(cmd));
15584
- allWrites.push(...detectArchiveExtract(cmd));
15585
- allWrites.push(...detectGitDestructive(cmd));
15743
+ for (const write of detectRedirects(cmd))
15744
+ allWrites.push(write);
15745
+ for (const write of detectBuiltinWrites(cmd))
15746
+ allWrites.push(write);
15747
+ for (const write of detectInplaceEdit(cmd))
15748
+ allWrites.push(write);
15749
+ for (const write of detectInterpreterEval(cmd))
15750
+ allWrites.push(write);
15751
+ for (const write of detectNetworkDownloaders(cmd))
15752
+ allWrites.push(write);
15753
+ for (const write of detectArchiveExtract(cmd))
15754
+ allWrites.push(write);
15755
+ for (const write of detectGitDestructive(cmd))
15756
+ allWrites.push(write);
15586
15757
  }
15587
15758
  collectPipeStdinEvals(ast, allWrites);
15588
15759
  }
15589
15760
  if (parseFailed) {
15590
15761
  const procSubWrites = detectProcessSubstitutionWrites(command);
15591
- allWrites.push(...procSubWrites);
15762
+ for (const write of procSubWrites) {
15763
+ allWrites.push(write);
15764
+ }
15592
15765
  }
15593
15766
  const seen = new Set;
15594
15767
  const occurrence = new Map;
@@ -16759,6 +16932,18 @@ var SEVERITY = {
16759
16932
  destructive: 3,
16760
16933
  catastrophic: 4
16761
16934
  };
16935
+ var WINDOWS_RECURSIVE_DELETE_VERB = /\b(?:rmdir|rd|del)(?:\.exe)?\b/i;
16936
+ function windowsRecursiveDeleteMatch(segment) {
16937
+ const verb = WINDOWS_RECURSIVE_DELETE_VERB.exec(segment);
16938
+ if (verb === null)
16939
+ return false;
16940
+ let args = segment.slice(verb.index + verb[0].length);
16941
+ const lineBreak = /[\r\n]/.exec(args);
16942
+ if (lineBreak !== null) {
16943
+ args = args.slice(0, lineBreak.index);
16944
+ }
16945
+ return dcHasCmdDeleteSwitch(args, "sqf");
16946
+ }
16762
16947
  var CATASTROPHIC = [
16763
16948
  {
16764
16949
  id: "fork-bomb",
@@ -16899,7 +17084,9 @@ var DESTRUCTIVE = [
16899
17084
  },
16900
17085
  {
16901
17086
  id: "windows-recursive-delete",
16902
- pattern: /\b(?:rmdir|rd|del)(?:\.exe)?\b[^\n]*\/[sqf]/i,
17087
+ pattern: /\b(?:rmdir|rd|del)(?:\.exe)?\b/i,
17088
+ match: windowsRecursiveDeleteMatch,
17089
+ reason: "cmd.exe delete switch (valid cluster containing s/q/f)",
16903
17090
  liveGuardrail: {
16904
17091
  mode: "target-aware",
16905
17092
  destructiveCategory: "recursive delete",
@@ -17099,8 +17286,9 @@ function hasAmbiguousSyntax(value) {
17099
17286
  }
17100
17287
  function matchRule(rules, segment) {
17101
17288
  for (const rule of rules) {
17102
- if (rule.pattern.test(segment))
17289
+ if (rule.match ? rule.match(segment) : rule.pattern?.test(segment)) {
17103
17290
  return rule;
17291
+ }
17104
17292
  }
17105
17293
  return null;
17106
17294
  }
@@ -17111,7 +17299,7 @@ function classifySegment(segment, ambiguous) {
17111
17299
  return {
17112
17300
  segment: bounded,
17113
17301
  category: "catastrophic",
17114
- reason: catastrophic.reason ?? catastrophic.pattern.source,
17302
+ reason: catastrophic.reason ?? catastrophic.pattern?.source ?? catastrophic.id,
17115
17303
  ruleId: catastrophic.id
17116
17304
  };
17117
17305
  const destructive = matchRule(DESTRUCTIVE, segment);
@@ -17119,7 +17307,7 @@ function classifySegment(segment, ambiguous) {
17119
17307
  return {
17120
17308
  segment: bounded,
17121
17309
  category: "destructive",
17122
- reason: destructive.reason ?? destructive.pattern.source,
17310
+ reason: destructive.reason ?? destructive.pattern?.source ?? destructive.id,
17123
17311
  ruleId: destructive.id
17124
17312
  };
17125
17313
  if (ambiguous || /[<>]|\|\s*(?:sh|bash|zsh|fish|pwsh|powershell|cmd)\b/i.test(segment)) {
@@ -17134,7 +17322,7 @@ function classifySegment(segment, ambiguous) {
17134
17322
  return {
17135
17323
  segment: bounded,
17136
17324
  category: "escalate",
17137
- reason: escalate.reason ?? escalate.pattern.source,
17325
+ reason: escalate.reason ?? escalate.pattern?.source ?? escalate.id,
17138
17326
  ruleId: escalate.id
17139
17327
  };
17140
17328
  const safe = matchRule(SAFE, segment);
@@ -17142,7 +17330,7 @@ function classifySegment(segment, ambiguous) {
17142
17330
  return {
17143
17331
  segment: bounded,
17144
17332
  category: "safe",
17145
- reason: safe.reason ?? safe.pattern.source,
17333
+ reason: safe.reason ?? safe.pattern?.source ?? safe.id,
17146
17334
  ruleId: safe.id
17147
17335
  };
17148
17336
  return {
@@ -17401,7 +17589,7 @@ var INJECTION_PATTERNS = [
17401
17589
  /\bDAN\s*MODE/gi,
17402
17590
  /\bBYPASS/gi
17403
17591
  ];
17404
- function sanitizeString(input) {
17592
+ function sanitizeString2(input) {
17405
17593
  if (!input || typeof input !== "string") {
17406
17594
  return "";
17407
17595
  }
@@ -17462,9 +17650,9 @@ function detectRepetitionLoop(trajectory, config) {
17462
17650
  severity: severity2,
17463
17651
  category: "coordination_error",
17464
17652
  stepRange: [data.startStep, data.endStep],
17465
- description: `Agent "${sanitizeString(agent)}" performed "${sanitizeString(action2)}" on "${sanitizeString(target)}" ${data.count} times within ${windowSize} steps`,
17466
- affectedAgents: [sanitizeString(agent)],
17467
- affectedTargets: [sanitizeString(target)],
17653
+ description: `Agent "${sanitizeString2(agent)}" performed "${sanitizeString2(action2)}" on "${sanitizeString2(target)}" ${data.count} times within ${windowSize} steps`,
17654
+ affectedAgents: [sanitizeString2(agent)],
17655
+ affectedTargets: [sanitizeString2(target)],
17468
17656
  occurrenceCount: data.count
17469
17657
  });
17470
17658
  }
@@ -17512,12 +17700,12 @@ function detectPingPong(trajectory, config) {
17512
17700
  severity: "high",
17513
17701
  category: "coordination_error",
17514
17702
  stepRange: [delegateEntries[i].step, delegateEntries[endIndex].step],
17515
- description: `Ping-pong delegation detected: "${sanitizeString(firstAgent)}" and "${sanitizeString(secondAgent)}" alternating on "${sanitizeString(target)}"`,
17703
+ description: `Ping-pong delegation detected: "${sanitizeString2(firstAgent)}" and "${sanitizeString2(secondAgent)}" alternating on "${sanitizeString2(target)}"`,
17516
17704
  affectedAgents: [
17517
- sanitizeString(firstAgent),
17518
- sanitizeString(secondAgent)
17705
+ sanitizeString2(firstAgent),
17706
+ sanitizeString2(secondAgent)
17519
17707
  ],
17520
- affectedTargets: [sanitizeString(target)],
17708
+ affectedTargets: [sanitizeString2(target)],
17521
17709
  occurrenceCount: roundTrips
17522
17710
  });
17523
17711
  }
@@ -17554,9 +17742,9 @@ function detectExpansionDrift(trajectory, config) {
17554
17742
  ],
17555
17743
  description: `Scope expansion detected: ${previousTargets.size} unique targets \u2192 ${recentTargets.size} unique targets (${expansionRatio.toFixed(1)}x increase)`,
17556
17744
  affectedAgents: [
17557
- ...new Set(recentWindow.map((e) => sanitizeString(e.agent)))
17745
+ ...new Set(recentWindow.map((e) => sanitizeString2(e.agent)))
17558
17746
  ],
17559
- affectedTargets: [...recentTargets].map((t) => sanitizeString(t)),
17747
+ affectedTargets: [...recentTargets].map((t) => sanitizeString2(t)),
17560
17748
  occurrenceCount: Math.floor(expansionRatio * 10) / 10
17561
17749
  });
17562
17750
  }
@@ -17625,9 +17813,9 @@ function detectStuckOnTest(trajectory, config) {
17625
17813
  severity: "high",
17626
17814
  category: "reasoning_error",
17627
17815
  stepRange: [cycleStart, cycleEnd],
17628
- description: `Stuck on test detected: ${cycleCount} edit-test cycles on "${sanitizeString(file)}"`,
17629
- affectedAgents: data.agents.map((a) => sanitizeString(a)),
17630
- affectedTargets: [sanitizeString(file)],
17816
+ description: `Stuck on test detected: ${cycleCount} edit-test cycles on "${sanitizeString2(file)}"`,
17817
+ affectedAgents: data.agents.map((a) => sanitizeString2(a)),
17818
+ affectedTargets: [sanitizeString2(file)],
17631
17819
  occurrenceCount: cycleCount
17632
17820
  });
17633
17821
  }
@@ -17665,10 +17853,10 @@ function detectContextThrash(trajectory, config) {
17665
17853
  stepRange: [trajectory[runStart].step, trajectory[runEnd].step],
17666
17854
  description: `Context thrash detected: unique targets grew monotonically from ${priorCount} to ${finalCount} over ${runLength} steps`,
17667
17855
  affectedAgents: [
17668
- ...new Set(trajectory.slice(runStart, runEnd + 1).map((e) => sanitizeString(e.agent)))
17856
+ ...new Set(trajectory.slice(runStart, runEnd + 1).map((e) => sanitizeString2(e.agent)))
17669
17857
  ],
17670
17858
  affectedTargets: [
17671
- ...new Set(trajectory.slice(runStart, runEnd + 1).map((e) => sanitizeString(e.target)))
17859
+ ...new Set(trajectory.slice(runStart, runEnd + 1).map((e) => sanitizeString2(e.target)))
17672
17860
  ],
17673
17861
  occurrenceCount: runLength
17674
17862
  });
@@ -18351,9 +18539,10 @@ function toTaskIdPlanContextOptions(context) {
18351
18539
  }
18352
18540
 
18353
18541
  // src/hooks/skill-propagation-gate.ts
18354
- init_schema();
18355
18542
  import * as fs15 from "fs";
18356
18543
  import * as path22 from "path";
18544
+ init_schema();
18545
+ init_path_identity();
18357
18546
  init_logger();
18358
18547
 
18359
18548
  // src/hooks/skill-scoring.ts
@@ -20988,6 +21177,7 @@ var _internals31 = {
20988
21177
  readdirSync: fs15.readdirSync.bind(fs15),
20989
21178
  existsSync: fs15.existsSync.bind(fs15),
20990
21179
  statSync: fs15.statSync.bind(fs15),
21180
+ lstatSync: fs15.lstatSync.bind(fs15),
20991
21181
  realpathSync: fs15.realpathSync.bind(fs15),
20992
21182
  mkdirSync: fs15.mkdirSync.bind(fs15),
20993
21183
  appendFileSync: fs15.appendFileSync.bind(fs15),
@@ -21136,6 +21326,63 @@ function extractFileSkillReferences(fieldValue) {
21136
21326
  }
21137
21327
  var MAX_EXPLICIT_SKILL_REFERENCES = 16;
21138
21328
  var MAX_PROVENANCE_SKILL_REFERENCES_PER_TRANSFORM = 64;
21329
+ var RETIRED_SKILL_REPLACEMENTS = {
21330
+ "gate-attribution": bundledProjectSkillFileReference("gate-attribution"),
21331
+ "merge-queue-readiness": bundledProjectSkillFileReference("merge-queue-readiness"),
21332
+ "skill-edit-validation": bundledProjectSkillFileReference("skill-edit-validation"),
21333
+ "worktree-retry-cleanup": bundledProjectSkillFileReference("worktree-retry-cleanup"),
21334
+ "pr-review-fix": bundledProjectSkillFileReference("swarm-pr-feedback"),
21335
+ "pr-readiness": bundledProjectSkillFileReference("swarm-pr-feedback")
21336
+ };
21337
+ var RETIREMENT_REASON_MAX_CHARS = 160;
21338
+ var MAX_MARKER_BYTES = 8192;
21339
+ function readRetirementMarker(skillDir) {
21340
+ for (const kind of ["retired", "stale"]) {
21341
+ try {
21342
+ const st = _internals31.lstatSync(path22.join(skillDir, `${kind}.marker`));
21343
+ if (st.isFile() || st.isSymbolicLink())
21344
+ return kind;
21345
+ } catch {}
21346
+ }
21347
+ return null;
21348
+ }
21349
+ function readMarkerDetail(skillDir, marker) {
21350
+ const file = path22.join(skillDir, marker === "retired" ? "retired.marker" : "stale.marker");
21351
+ try {
21352
+ const st = _internals31.lstatSync(file);
21353
+ if (st.isSymbolicLink() || !st.isFile() || st.size > MAX_MARKER_BYTES) {
21354
+ return;
21355
+ }
21356
+ const raw = _internals31.readFileSync(file, "utf-8");
21357
+ if (marker === "retired") {
21358
+ try {
21359
+ const parsed = JSON.parse(raw);
21360
+ const parts = [];
21361
+ if (typeof parsed.reason === "string" && parsed.reason.trim().length > 0) {
21362
+ parts.push(parsed.reason);
21363
+ }
21364
+ if (typeof parsed.retiredAt === "string" && parsed.retiredAt.trim().length > 0) {
21365
+ parts.push(`retired ${parsed.retiredAt}`);
21366
+ }
21367
+ if (parts.length > 0) {
21368
+ return sanitizeDiagnosticText(parts.join(", "), RETIREMENT_REASON_MAX_CHARS);
21369
+ }
21370
+ } catch {}
21371
+ }
21372
+ const flat = sanitizeDiagnosticText(raw, RETIREMENT_REASON_MAX_CHARS);
21373
+ return flat.length > 0 ? flat : undefined;
21374
+ } catch {
21375
+ return;
21376
+ }
21377
+ }
21378
+ function retirementMessage(slug, marker, detail) {
21379
+ const state = marker === "retired" ? "retired" : "stale";
21380
+ const detailText = detail === undefined ? "" : ` (${detail})`;
21381
+ const safeSlug = sanitizeDiagnosticText(slug, 120);
21382
+ const replacement = Object.hasOwn(RETIRED_SKILL_REPLACEMENTS, slug) ? RETIRED_SKILL_REPLACEMENTS[slug] : undefined;
21383
+ const guidance = replacement === undefined ? "regenerate via skill_generate or pick a live skill with skill_inspect" : `use "${replacement}" instead`;
21384
+ return `skill "${safeSlug}" is ${state}${detailText}: ${guidance} \u2014 do not delegate with retired skills`;
21385
+ }
21139
21386
  function resolveSkillAudienceContext(config) {
21140
21387
  return {
21141
21388
  runner: "opencode",
@@ -21176,6 +21423,20 @@ function validateSkillReference(directory, reference, context, options) {
21176
21423
  reason: "skill symlink resolves outside the project"
21177
21424
  };
21178
21425
  }
21426
+ const realSkillDir = path22.dirname(realPath);
21427
+ const lexicalSkillDir = path22.dirname(lexicalPath);
21428
+ const realMarker = readRetirementMarker(realSkillDir);
21429
+ const lexicalMarker = realSkillDir === lexicalSkillDir ? null : readRetirementMarker(lexicalSkillDir);
21430
+ const retirement = realMarker === "retired" || lexicalMarker === "retired" ? "retired" : realMarker ?? lexicalMarker;
21431
+ if (retirement !== null) {
21432
+ const slug = path22.basename(lexicalSkillDir);
21433
+ const winnerIsReal = realMarker === retirement;
21434
+ const detail = readMarkerDetail(winnerIsReal ? realSkillDir : lexicalSkillDir, retirement);
21435
+ return {
21436
+ valid: false,
21437
+ reason: retirementMessage(slug, retirement, detail)
21438
+ };
21439
+ }
21179
21440
  const normalizedPath = withoutPrefix.replace(/^\.\//, "");
21180
21441
  const validatedMetadataPath = path22.relative(root, realPath).replace(/\\/g, "/");
21181
21442
  const metadata = _internals31.readSkillMetadata(validatedMetadataPath, root);
@@ -29510,7 +29771,7 @@ function clearCriticalShownIds(sessionID) {
29510
29771
  async function rehydratePrSubscriptions(sessionID, directory) {
29511
29772
  const map = new Map;
29512
29773
  try {
29513
- const { listActive: listActive2 } = await import("./pr-subscriptions-nhdfz8pc.js");
29774
+ const { listActive: listActive2 } = await import("./pr-subscriptions-wmzs42h3.js");
29514
29775
  const records = await listActive2(directory);
29515
29776
  for (const record of records) {
29516
29777
  if (record.sessionID !== sessionID)
@@ -40151,7 +40412,7 @@ async function handleAttestCommand(directory, args, sessionID) {
40151
40412
  `);
40152
40413
  }
40153
40414
  const taskId = args[0];
40154
- const { executeAttestTask } = await import("./attest-task-0h9adt4t.js");
40415
+ const { executeAttestTask } = await import("./attest-task-1bhnpxsr.js");
40155
40416
  const result = await executeAttestTask({
40156
40417
  task_id: taskId,
40157
40418
  working_directory: directory,
@@ -47343,9 +47604,9 @@ function hashContent(content) {
47343
47604
  return createHash28("sha1").update(content).digest("hex");
47344
47605
  }
47345
47606
  async function loadConfigForPolicyCurator(directory) {
47346
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-ejerjdcy.js");
47607
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-art9xdhq.js");
47347
47608
  try {
47348
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-bxsbm6xx.js");
47609
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-h91a4abf.js");
47349
47610
  const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
47350
47611
  return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
47351
47612
  } catch {
@@ -50403,7 +50664,7 @@ async function resolveCuratorLLMDelegate(directory, mode, sessionId) {
50403
50664
  const seam = _internals49.createCuratorLLMDelegate;
50404
50665
  if (seam)
50405
50666
  return seam(directory, mode, sessionId);
50406
- const { createCuratorLLMDelegate } = await import("./curator-llm-factory-3b7b55k6.js");
50667
+ const { createCuratorLLMDelegate } = await import("./curator-llm-factory-r2rsrmz4.js");
50407
50668
  return createCuratorLLMDelegate(directory, mode, sessionId);
50408
50669
  }
50409
50670
  async function reconcileCloseTerminalStateForPlan(directory, targetPlan, options) {
@@ -50798,7 +51059,7 @@ async function runFinalizeStage(ctx) {
50798
51059
  }
50799
51060
  }
50800
51061
  try {
50801
- const { CuratorConfigSchema: CCS } = await import("./schema-ejerjdcy.js");
51062
+ const { CuratorConfigSchema: CCS } = await import("./schema-art9xdhq.js");
50802
51063
  const { config: pmLoadedConfig } = _internals49.loadPluginConfigWithMeta(ctx.directory);
50803
51064
  const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
50804
51065
  if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
@@ -54871,7 +55132,7 @@ function adviseClosingStop(directory) {
54871
55132
  }
54872
55133
  async function writeSnapshot(directory, state) {
54873
55134
  try {
54874
- const { ensureSnapshotCoordinationReady } = await import("./snapshot-coordination-init-jbs93ng2.js");
55135
+ const { ensureSnapshotCoordinationReady } = await import("./snapshot-coordination-init-1v237k29.js");
54875
55136
  await ensureSnapshotCoordinationReady(directory);
54876
55137
  if (closingStopAdvisedRoots.size > 0) {
54877
55138
  closingStopAdvisedRoots.delete(canonicalProjectKey(directory));
@@ -58100,7 +58361,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
58100
58361
  };
58101
58362
  }
58102
58363
  async function sweepActiveNearDuplicates(directory, options = {}) {
58103
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-bxsbm6xx.js");
58364
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-h91a4abf.js");
58104
58365
  const { config } = loadPluginConfigWithMeta2(directory);
58105
58366
  const sweepConfig = config.learning?.dedup_sweep;
58106
58367
  if (sweepConfig?.enabled === false)
@@ -59224,7 +59485,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
59224
59485
  }
59225
59486
  if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
59226
59487
  try {
59227
- const skillModule = await import("./skill-generator-6c57ckmm.js");
59488
+ const skillModule = await import("./skill-generator-bbzwn7ny.js");
59228
59489
  for (const cand of skillCandidates) {
59229
59490
  if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
59230
59491
  continue;
@@ -59696,7 +59957,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
59696
59957
  } catch {}
59697
59958
  }
59698
59959
  if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
59699
- const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-et068ebg.js");
59960
+ const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-h8j3v62j.js");
59700
59961
  for (const { id } of contradictedEntries) {
59701
59962
  try {
59702
59963
  await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
@@ -60528,7 +60789,7 @@ async function runCuratorPostMortem(directory, options = {}) {
60528
60789
  warnings.push("Failed to collect knowledge summary.");
60529
60790
  }
60530
60791
  try {
60531
- const { getScanStatus } = await import("./scan-cursor-v5f7s9jb.js");
60792
+ const { getScanStatus } = await import("./scan-cursor-rxpkxhj3.js");
60532
60793
  const scanStatus = await getScanStatus(directory);
60533
60794
  if (scanStatus.remaining_estimate > 0) {
60534
60795
  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.`);
@@ -60700,9 +60961,9 @@ var _internals71 = {
60700
60961
  verifyPostMortemKnowledgeActions,
60701
60962
  repairPostMortemActions,
60702
60963
  loadDefaultKnowledgeConfig: async (directory) => {
60703
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-ejerjdcy.js");
60964
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-art9xdhq.js");
60704
60965
  try {
60705
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-bxsbm6xx.js");
60966
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-h91a4abf.js");
60706
60967
  const loaded = loadPluginConfigWithMeta2(directory);
60707
60968
  return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
60708
60969
  } catch {
@@ -60710,11 +60971,11 @@ var _internals71 = {
60710
60971
  }
60711
60972
  },
60712
60973
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
60713
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-dsf0966y.js");
60974
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-sxq06cgw.js");
60714
60975
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
60715
60976
  },
60716
60977
  checkHivePromotions: async (entries2, knowledgeConfig, directory) => {
60717
- const { checkHivePromotions } = await import("./hive-promoter-73e5qa2r.js");
60978
+ const { checkHivePromotions } = await import("./hive-promoter-sstdct9j.js");
60718
60979
  return checkHivePromotions(entries2, knowledgeConfig, directory);
60719
60980
  },
60720
60981
  applyProposalTriage: async (directory, triage) => {
@@ -60723,7 +60984,7 @@ var _internals71 = {
60723
60984
  activateProposal,
60724
60985
  listSkills: listSkills2,
60725
60986
  sanitizeSlug
60726
- } = await import("./skill-generator-6c57ckmm.js");
60987
+ } = await import("./skill-generator-bbzwn7ny.js");
60727
60988
  const result = {
60728
60989
  approved: [],
60729
60990
  rejected: [],
@@ -60765,7 +61026,7 @@ var _internals71 = {
60765
61026
  return result;
60766
61027
  },
60767
61028
  readPriorDriftReports: async (directory) => {
60768
- const { readPriorDriftReports: readPriorDriftReports2 } = await import("./curator-drift-b4rcjh23.js");
61029
+ const { readPriorDriftReports: readPriorDriftReports2 } = await import("./curator-drift-yb05q3a8.js");
60769
61030
  return readPriorDriftReports2(directory);
60770
61031
  },
60771
61032
  readSwarmKnowledge: (directory) => readKnowledge(resolveSwarmKnowledgePath(directory))
@@ -71036,9 +71297,9 @@ var _internals79 = {
71036
71297
  loadPluginConfigWithMeta,
71037
71298
  loadCuratorDeps: async () => {
71038
71299
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate }] = await Promise.all([
71039
- import("./schema-ejerjdcy.js"),
71040
- import("./curator-dsf0966y.js"),
71041
- import("./curator-llm-factory-3b7b55k6.js")
71300
+ import("./schema-art9xdhq.js"),
71301
+ import("./curator-sxq06cgw.js"),
71302
+ import("./curator-llm-factory-r2rsrmz4.js")
71042
71303
  ]);
71043
71304
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate };
71044
71305
  }
@@ -73486,7 +73747,7 @@ async function computeCurationDiagnostics(directory, entries2) {
73486
73747
  let scanCompleted = false;
73487
73748
  let scanRemaining = 0;
73488
73749
  try {
73489
- const { getScanStatus } = await import("./scan-cursor-v5f7s9jb.js");
73750
+ const { getScanStatus } = await import("./scan-cursor-rxpkxhj3.js");
73490
73751
  const status = await getScanStatus(directory);
73491
73752
  scanGeneration = status.generation;
73492
73753
  scanCompleted = status.completed;
@@ -73496,10 +73757,10 @@ async function computeCurationDiagnostics(directory, entries2) {
73496
73757
  try {
73497
73758
  const { isLinked: isLinked2 } = await import("./knowledge-link-r7e2t5c1.js");
73498
73759
  if (isLinked2(directory)) {
73499
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-ejerjdcy.js");
73760
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-art9xdhq.js");
73500
73761
  let config;
73501
73762
  try {
73502
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-bxsbm6xx.js");
73763
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-h91a4abf.js");
73503
73764
  const loaded = loadPluginConfigWithMeta2(directory);
73504
73765
  config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
73505
73766
  } catch {
@@ -74979,7 +75240,7 @@ async function handleDoctorCommand(directory, args) {
74979
75240
  const result = runConfigDoctor(config, directory, planParallelizationEnabled);
74980
75241
  let output;
74981
75242
  if (enableAutoFix && result.hasAutoFixableIssues) {
74982
- const { runConfigDoctorWithFixes } = await import("./config-doctor-q23166e4.js");
75243
+ const { runConfigDoctorWithFixes } = await import("./config-doctor-m4c4f4j3.js");
74983
75244
  const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
74984
75245
  applyLossy: true
74985
75246
  });
@@ -75017,7 +75278,7 @@ async function handleDoctorCommand(directory, args) {
75017
75278
  `;
75018
75279
  }
75019
75280
  try {
75020
- const { runModelPreflight } = await import("./model-preflight-zh4t5ywj.js");
75281
+ const { runModelPreflight } = await import("./model-preflight-2592b0fv.js");
75021
75282
  const preflight = await runModelPreflight(config, swarmState.opencodeClient, { generatedAgentNames: swarmState.generatedAgentNames });
75022
75283
  const missingSelection = preflight.resolutions.filter((resolution) => resolution.status === "missing-selection");
75023
75284
  const unresolved = preflight.catalogAvailable ? preflight.resolutions.filter((resolution) => resolution.status === "unresolved") : [];
@@ -75051,7 +75312,7 @@ async function handleDoctorCommand(directory, args) {
75051
75312
  }
75052
75313
  } catch {}
75053
75314
  try {
75054
- const { renderKnowledgeReceiptPhaseIdSection } = await import("./doctor-knowledge-receipt-phase-id-4npan6z7.js");
75315
+ const { renderKnowledgeReceiptPhaseIdSection } = await import("./doctor-knowledge-receipt-phase-id-7z98yg2z.js");
75055
75316
  output += await renderKnowledgeReceiptPhaseIdSection(directory, enableAutoFix);
75056
75317
  } catch {}
75057
75318
  const strayDirs = detectStraySwarmDirs(directory);
@@ -77068,7 +77329,7 @@ async function handleEvidenceCommand(directory, args) {
77068
77329
  return formatTaskEvidenceMarkdown(evidenceData);
77069
77330
  }
77070
77331
  async function handleEvidenceSummaryCommand(directory) {
77071
- const { buildEvidenceSummary } = await import("./evidence-summary-service-evv73ay3.js");
77332
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-y3g4tg5y.js");
77072
77333
  const artifact = await buildEvidenceSummary(directory);
77073
77334
  if (!artifact) {
77074
77335
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -84376,7 +84637,7 @@ var MAX_INCOMPLETE_TASKS = 20;
84376
84637
  function escapeHtml(str) {
84377
84638
  return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
84378
84639
  }
84379
- function sanitizeString2(str, maxLength) {
84640
+ function sanitizeString3(str, maxLength) {
84380
84641
  if (!str)
84381
84642
  return "";
84382
84643
  const sanitized = String(str).replace(RTL_OVERRIDE_PATTERN, "");
@@ -84418,11 +84679,11 @@ function extractCurrentPhaseFromPlan2(plan) {
84418
84679
  for (const phase of plan.phases) {
84419
84680
  for (const task of phase.tasks) {
84420
84681
  if (task.status === "in_progress") {
84421
- currentTask = sanitizeString2(task.id, MAX_TASK_ID_LENGTH);
84682
+ currentTask = sanitizeString3(task.id, MAX_TASK_ID_LENGTH);
84422
84683
  }
84423
84684
  if (task.status !== "completed") {
84424
84685
  if (incompleteTasks.length < MAX_INCOMPLETE_TASKS) {
84425
- incompleteTasks.push(sanitizeString2(task.id, MAX_TASK_ID_LENGTH));
84686
+ incompleteTasks.push(sanitizeString3(task.id, MAX_TASK_ID_LENGTH));
84426
84687
  }
84427
84688
  }
84428
84689
  }
@@ -84441,7 +84702,7 @@ function parseSessionState(content) {
84441
84702
  if (state.activeAgent && typeof state.activeAgent === "object") {
84442
84703
  const entries2 = Object.entries(state.activeAgent);
84443
84704
  if (entries2.length > 0) {
84444
- activeAgent = sanitizeString2(entries2[entries2.length - 1][1], MAX_TASK_ID_LENGTH);
84705
+ activeAgent = sanitizeString3(entries2[entries2.length - 1][1], MAX_TASK_ID_LENGTH);
84445
84706
  }
84446
84707
  }
84447
84708
  let delegationState = null;
@@ -84451,7 +84712,7 @@ function parseSessionState(content) {
84451
84712
  let maxDepth = 0;
84452
84713
  for (const [, chain] of chains) {
84453
84714
  if (Array.isArray(chain) && chain.length > 0) {
84454
- const sanitizedChain = chain.map((e) => `${sanitizeString2(e.from, MAX_TASK_ID_LENGTH)}->${sanitizeString2(e.to, MAX_TASK_ID_LENGTH)}`).join(" | ");
84715
+ const sanitizedChain = chain.map((e) => `${sanitizeString3(e.from, MAX_TASK_ID_LENGTH)}->${sanitizeString3(e.to, MAX_TASK_ID_LENGTH)}`).join(" | ");
84455
84716
  activeChains.push(sanitizedChain);
84456
84717
  maxDepth = Math.max(maxDepth, chain.length);
84457
84718
  }
@@ -84470,8 +84731,8 @@ function parseSessionState(content) {
84470
84731
  const sess = session;
84471
84732
  if (sess.lastGateFailure && sess.currentTaskId) {
84472
84733
  pendingQA = {
84473
- taskId: sanitizeString2(sess.lastGateFailure.taskId, MAX_TASK_ID_LENGTH),
84474
- lastFailure: sanitizeString2(sess.lastGateFailure.tool, MAX_TASK_ID_LENGTH)
84734
+ taskId: sanitizeString3(sess.lastGateFailure.taskId, MAX_TASK_ID_LENGTH),
84735
+ lastFailure: sanitizeString3(sess.lastGateFailure.tool, MAX_TASK_ID_LENGTH)
84475
84736
  };
84476
84737
  break;
84477
84738
  }
@@ -84492,7 +84753,7 @@ function extractDecisions(content) {
84492
84753
  for (const decision of extractContextDecisions(content)) {
84493
84754
  const cleaned = decision.text.replace(/\u2705/g, "").trim();
84494
84755
  if (cleaned) {
84495
- const sanitized = sanitizeString2(cleaned, MAX_DECISION_LENGTH);
84756
+ const sanitized = sanitizeString3(cleaned, MAX_DECISION_LENGTH);
84496
84757
  if (sanitized) {
84497
84758
  decisions.push(sanitized);
84498
84759
  }
@@ -84543,11 +84804,11 @@ async function getHandoffData(directory) {
84543
84804
  const phaseMatch = planMdContent.match(/^## Phase (\d+):?\s*(.+)?$/m);
84544
84805
  const taskMatch = planMdContent.match(/^- \[ \] (\d+\.\d+)/g);
84545
84806
  if (phaseMatch) {
84546
- planInfo.currentPhase = sanitizeString2(`Phase ${phaseMatch[1]}${phaseMatch[2] ? `: ${phaseMatch[2]}` : ""}`, MAX_TASK_ID_LENGTH);
84807
+ planInfo.currentPhase = sanitizeString3(`Phase ${phaseMatch[1]}${phaseMatch[2] ? `: ${phaseMatch[2]}` : ""}`, MAX_TASK_ID_LENGTH);
84547
84808
  }
84548
84809
  if (taskMatch) {
84549
84810
  const rawTasks = taskMatch.map((t) => t.replace("- [ ] ", ""));
84550
- planInfo.incompleteTasks = rawTasks.map((t) => sanitizeString2(t, MAX_TASK_ID_LENGTH)).slice(0, MAX_INCOMPLETE_TASKS);
84811
+ planInfo.incompleteTasks = rawTasks.map((t) => sanitizeString3(t, MAX_TASK_ID_LENGTH)).slice(0, MAX_INCOMPLETE_TASKS);
84551
84812
  if (!planInfo.currentTask && planInfo.incompleteTasks.length > 0) {
84552
84813
  planInfo.currentTask = planInfo.incompleteTasks[0];
84553
84814
  }
@@ -84557,7 +84818,7 @@ async function getHandoffData(directory) {
84557
84818
  const contextContent = await readSwarmFileAsync(directory, "context.md");
84558
84819
  const recentDecisions = _internals97.extractDecisions(contextContent);
84559
84820
  const rawPhaseMetrics = _internals97.extractPhaseMetrics(contextContent);
84560
- const phaseMetrics = sanitizeString2(rawPhaseMetrics, 1000);
84821
+ const phaseMetrics = sanitizeString3(rawPhaseMetrics, 1000);
84561
84822
  let delegationState = null;
84562
84823
  if (sessionState?.delegationState) {
84563
84824
  delegationState = {
@@ -84730,7 +84991,7 @@ var _internals97 = {
84730
84991
  formatHandoffMarkdown,
84731
84992
  formatContinuationPrompt,
84732
84993
  escapeHtml,
84733
- sanitizeString: sanitizeString2,
84994
+ sanitizeString: sanitizeString3,
84734
84995
  validatePlanPhases,
84735
84996
  extractCurrentPhaseFromPlan: extractCurrentPhaseFromPlan2,
84736
84997
  parseSessionState,
@@ -84791,7 +85052,7 @@ import {
84791
85052
  closeSync as closeSync19,
84792
85053
  constants as FS_CONSTANTS2,
84793
85054
  fstatSync as fstatSync6,
84794
- lstatSync as lstatSync13,
85055
+ lstatSync as lstatSync14,
84795
85056
  openSync as openSync19,
84796
85057
  readFileSync as readFileSync50
84797
85058
  } from "fs";
@@ -85433,7 +85694,7 @@ import {
85433
85694
  fstatSync as fstatSync5,
85434
85695
  fsyncSync as fsyncSync5,
85435
85696
  ftruncateSync as ftruncateSync2,
85436
- lstatSync as lstatSync12,
85697
+ lstatSync as lstatSync13,
85437
85698
  mkdirSync as mkdirSync32,
85438
85699
  opendirSync as opendirSync2,
85439
85700
  openSync as openSync18,
@@ -85734,7 +85995,7 @@ function assertSafeArtifactPath(filePath, root) {
85734
85995
  let probe = resolvedFile;
85735
85996
  for (let index = 0;index < 4096; index++) {
85736
85997
  try {
85737
- if (lstatSync12(probe).isSymbolicLink()) {
85998
+ if (lstatSync13(probe).isSymbolicLink()) {
85738
85999
  throw new HarnessStoreIntegrityError(filePath, "harness artifact path contains a symlink or junction");
85739
86000
  }
85740
86001
  } catch (error2) {
@@ -85758,7 +86019,7 @@ function readJsonFile(filePath, storeRoot) {
85758
86019
  if (!existsSync51(filePath))
85759
86020
  return null;
85760
86021
  try {
85761
- const initial = lstatSync12(filePath);
86022
+ const initial = lstatSync13(filePath);
85762
86023
  if (!initial.isFile() || initial.isSymbolicLink() || (initial.nlink ?? 1) > 1) {
85763
86024
  throw new Error("artifact must be a regular non-linked file");
85764
86025
  }
@@ -86989,7 +87250,7 @@ function boundedJsonFile(directory, relativePath2, config) {
86989
87250
  if (rejection)
86990
87251
  throw new Error(`unsafe input path: ${rejection}`);
86991
87252
  const target = path109.resolve(directory, relativePath2);
86992
- const stat7 = lstatSync13(target);
87253
+ const stat7 = lstatSync14(target);
86993
87254
  if (!stat7.isFile() || stat7.isSymbolicLink()) {
86994
87255
  throw new Error("input must be a regular non-symlink file");
86995
87256
  }
@@ -87022,7 +87283,7 @@ function inputPathExists(directory, relativePath2) {
87022
87283
  if (validateTargetWithinRoot(relativePath2, directory))
87023
87284
  return false;
87024
87285
  try {
87025
- lstatSync13(path109.resolve(directory, relativePath2));
87286
+ lstatSync14(path109.resolve(directory, relativePath2));
87026
87287
  return true;
87027
87288
  } catch {
87028
87289
  return false;
@@ -94965,6 +95226,36 @@ function makeAdmissionError(cause) {
94965
95226
  return new MemoryMigrationLockError("storage", `memory-family-migration: destination lock acquisition failed${code ? ` (${code})` : ""}`, cause);
94966
95227
  }
94967
95228
  var MAX_BACKUPS = 5;
95229
+ var MEMBER_RECENCY_KEYS = {
95230
+ "memories.jsonl": ["updatedAt", "updated_at"],
95231
+ "proposals.jsonl": ["reviewedAt"]
95232
+ };
95233
+ function rowRecency(row, keys) {
95234
+ if (typeof row !== "object" || row === null)
95235
+ return;
95236
+ const o = row;
95237
+ for (const key of keys) {
95238
+ const value = o[key];
95239
+ if (typeof value === "string") {
95240
+ const ms2 = Date.parse(value);
95241
+ if (!Number.isNaN(ms2))
95242
+ return ms2;
95243
+ }
95244
+ }
95245
+ return;
95246
+ }
95247
+ function rowId(row) {
95248
+ if (typeof row !== "object" || row === null)
95249
+ return null;
95250
+ const o = row;
95251
+ return typeof o.id === "string" ? o.id : null;
95252
+ }
95253
+ function rowIsTombstone(row) {
95254
+ if (typeof row !== "object" || row === null)
95255
+ return false;
95256
+ const metadata = row.metadata;
95257
+ return typeof metadata === "object" && metadata !== null && metadata.deleted === true;
95258
+ }
94968
95259
  function readJsonl3(filePath) {
94969
95260
  if (!existsSync64(filePath))
94970
95261
  return [];
@@ -94985,26 +95276,96 @@ function readJsonl3(filePath) {
94985
95276
  return [];
94986
95277
  }
94987
95278
  }
94988
- function appendUnionById2(destination, source) {
95279
+ function appendUnionById2(destination, source, options = {}) {
95280
+ const memberFilename = options.memberFilename ?? "memories.jsonl";
95281
+ const recencyKeys = MEMBER_RECENCY_KEYS[memberFilename] ?? [];
94989
95282
  const result = [...destination];
94990
- const seen = new Set(result.map((r) => {
94991
- const o = r;
94992
- return typeof o.id === "string" ? o.id : JSON.stringify(r);
94993
- }));
95283
+ const effectiveLast = new Map;
95284
+ const seenRowJson = new Set;
95285
+ for (const row of destination) {
95286
+ const id = rowId(row);
95287
+ if (id !== null)
95288
+ effectiveLast.set(id, row);
95289
+ seenRowJson.add(JSON.stringify(row));
95290
+ }
94994
95291
  let added = 0;
94995
95292
  let skipped = 0;
95293
+ let superseded = 0;
95294
+ const unresolvedCollisions = [];
95295
+ const resurrectedIds = [];
94996
95296
  for (const src of source) {
94997
- const o = src;
94998
- const id = typeof o.id === "string" ? o.id : JSON.stringify(src);
94999
- if (seen.has(id)) {
95297
+ const id = rowId(src);
95298
+ if (id === null) {
95299
+ const json = JSON.stringify(src);
95300
+ if (seenRowJson.has(json)) {
95301
+ skipped++;
95302
+ continue;
95303
+ }
95304
+ result.push(src);
95305
+ seenRowJson.add(json);
95306
+ added++;
95307
+ continue;
95308
+ }
95309
+ const destRow = effectiveLast.get(id);
95310
+ if (destRow === undefined) {
95311
+ result.push(src);
95312
+ effectiveLast.set(id, src);
95313
+ added++;
95314
+ continue;
95315
+ }
95316
+ if (JSON.stringify(destRow) === JSON.stringify(src)) {
95317
+ skipped++;
95318
+ continue;
95319
+ }
95320
+ if (recencyKeys.length === 0) {
95321
+ unresolvedCollisions.push(id);
95000
95322
  skipped++;
95001
95323
  continue;
95002
95324
  }
95325
+ const destRecency = rowRecency(destRow, recencyKeys);
95326
+ const srcRecency = rowRecency(src, recencyKeys);
95327
+ let sourceWins;
95328
+ if (memberFilename === "proposals.jsonl") {
95329
+ if (destRecency === undefined && srcRecency === undefined) {
95330
+ unresolvedCollisions.push(id);
95331
+ skipped++;
95332
+ continue;
95333
+ }
95334
+ sourceWins = destRecency === undefined ? true : srcRecency === undefined ? false : srcRecency > destRecency;
95335
+ } else {
95336
+ if (destRecency === undefined || srcRecency === undefined) {
95337
+ unresolvedCollisions.push(id);
95338
+ skipped++;
95339
+ continue;
95340
+ }
95341
+ sourceWins = srcRecency > destRecency;
95342
+ }
95343
+ if (!sourceWins) {
95344
+ if (rowIsTombstone(destRow) && !rowIsTombstone(src)) {
95345
+ superseded++;
95346
+ } else {
95347
+ skipped++;
95348
+ }
95349
+ continue;
95350
+ }
95351
+ if (rowIsTombstone(destRow) && !rowIsTombstone(src)) {
95352
+ resurrectedIds.push(id);
95353
+ result.push(src);
95354
+ effectiveLast.set(id, src);
95355
+ continue;
95356
+ }
95003
95357
  result.push(src);
95004
- seen.add(id);
95005
- added++;
95358
+ effectiveLast.set(id, src);
95359
+ superseded++;
95006
95360
  }
95007
- return { merged: result, added, skipped };
95361
+ return {
95362
+ merged: result,
95363
+ added,
95364
+ skipped,
95365
+ superseded,
95366
+ unresolvedCollisions,
95367
+ resurrectedIds
95368
+ };
95008
95369
  }
95009
95370
  function appendUnionOutcomeEvents(destination, source) {
95010
95371
  const result = destination.map(validateOutcomeEvent);
@@ -95076,9 +95437,84 @@ async function mergeStagedSqlite(destStoragePath, stagedPath) {
95076
95437
  } catch {}
95077
95438
  }
95078
95439
  }
95079
- return { merged: await countRowsSafe(destDbPath), skipped: 0 };
95440
+ return {
95441
+ merged: await countRowsSafe(destDbPath),
95442
+ skipped: 0,
95443
+ audit: {
95444
+ filename: "memory.db",
95445
+ resurrectedIds: [],
95446
+ supersededCount: 0,
95447
+ unresolvedCollisions: []
95448
+ }
95449
+ };
95080
95450
  }
95081
95451
  try {
95452
+ let tableColumns = function(schema, table) {
95453
+ try {
95454
+ const rows = db.query(`PRAGMA ${schema}.table_info(${table})`).all();
95455
+ return rows.map((r) => r.name);
95456
+ } catch {
95457
+ return [];
95458
+ }
95459
+ }, mergeMemoryItemsRecency = function() {
95460
+ const destCols = tableColumns("main", "memory_items");
95461
+ const stagedCols = tableColumns("staged", "memory_items");
95462
+ const shared = destCols.filter((c) => stagedCols.includes(c));
95463
+ const shapesMatch = destCols.length > 0 && destCols.length === stagedCols.length && shared.length === destCols.length;
95464
+ if (!shapesMatch || !shared.includes("updated_at")) {
95465
+ const result2 = db.run("INSERT OR IGNORE INTO memory_items SELECT * FROM staged.memory_items;");
95466
+ return {
95467
+ merged: result2.changes ?? 0,
95468
+ skipped: 0,
95469
+ resurrectedIds: [],
95470
+ supersededCount: 0
95471
+ };
95472
+ }
95473
+ const overlaps = db.query(`SELECT destination.id AS id,
95474
+ destination.deleted AS dest_deleted,
95475
+ source.deleted AS src_deleted,
95476
+ destination.updated_at AS dest_at,
95477
+ source.updated_at AS src_at
95478
+ FROM memory_items AS destination
95479
+ JOIN staged.memory_items AS source ON source.id = destination.id`).all();
95480
+ const resurrectedIds = [];
95481
+ let supersededCount = 0;
95482
+ for (const row of overlaps) {
95483
+ const srcNewer = row.src_at > row.dest_at;
95484
+ if (row.dest_deleted === 1 && row.src_deleted === 0 && srcNewer) {
95485
+ resurrectedIds.push(row.id);
95486
+ } else if (srcNewer) {
95487
+ supersededCount++;
95488
+ } else if (row.dest_deleted === 1 && row.src_deleted === 0) {
95489
+ supersededCount++;
95490
+ }
95491
+ }
95492
+ const colList = shared.join(", ");
95493
+ const plainSet = shared.filter((c) => c !== "id" && c !== "valid_from" && c !== "supersedes_reason");
95494
+ const setList = plainSet.map((c) => `${c} = excluded.${c}`).join(`,
95495
+ `);
95496
+ const validFromClause = shared.includes("valid_from") ? `,
95497
+ valid_from = memory_items.valid_from` : "";
95498
+ const supersedesClause = shared.includes("supersedes_reason") ? `,
95499
+ supersedes_reason = COALESCE(excluded.supersedes_reason, memory_items.supersedes_reason)` : "";
95500
+ const result = db.run(`INSERT INTO memory_items (${colList})
95501
+ SELECT ${colList} FROM staged.memory_items WHERE true
95502
+ ON CONFLICT(id) DO UPDATE SET
95503
+ ${setList}${validFromClause}${supersedesClause}
95504
+ WHERE excluded.updated_at > memory_items.updated_at;`);
95505
+ const merged = result.changes ?? 0;
95506
+ const stagedCount = db.query("SELECT COUNT(*) AS n FROM staged.memory_items").get()?.n ?? 0;
95507
+ const newIds = Math.max(0, stagedCount - overlaps.length);
95508
+ const updated = Math.min(Math.max(0, merged - newIds), overlaps.length);
95509
+ const skipped = Math.max(0, overlaps.length - updated);
95510
+ if (updated > 0) {
95511
+ const ftsTable = db.query("SELECT COUNT(*) AS n FROM sqlite_master WHERE type='table' AND name='memory_items_fts'").get()?.n ?? 0;
95512
+ if (ftsTable > 0) {
95513
+ db.run("DELETE FROM memory_items_fts;");
95514
+ }
95515
+ }
95516
+ return { merged, skipped, resurrectedIds, supersededCount };
95517
+ };
95082
95518
  const { loadDatabaseCtor: loadDatabaseCtor2 } = await import("./sqlite-loader-amp9z7ty.js");
95083
95519
  const Db = loadDatabaseCtor2();
95084
95520
  const db = new Db(destDbPath);
@@ -95108,13 +95544,32 @@ async function mergeStagedSqlite(destStoragePath, stagedPath) {
95108
95544
  "memory_outcomes"
95109
95545
  ];
95110
95546
  let merged = 0;
95547
+ let skippedCollisions = 0;
95111
95548
  let skippedDueToError = 0;
95112
95549
  const failedTables = [];
95550
+ const unresolvedCollisions = [];
95551
+ let resurrectedIds = [];
95552
+ let supersededCount = 0;
95113
95553
  for (const table of tables) {
95114
95554
  try {
95115
95555
  const stashed = db.query(`SELECT COUNT(*) AS n FROM staged.sqlite_master WHERE type='table' AND name='${table}'`).get();
95116
95556
  if (!stashed || stashed.n === 0)
95117
95557
  continue;
95558
+ if (table === "memory_items") {
95559
+ const outcome = mergeMemoryItemsRecency();
95560
+ merged += outcome.merged;
95561
+ skippedCollisions += outcome.skipped;
95562
+ resurrectedIds = outcome.resurrectedIds;
95563
+ supersededCount = outcome.supersededCount;
95564
+ continue;
95565
+ }
95566
+ if (table === "memory_proposals") {
95567
+ const collided = db.query(`SELECT destination.id AS id
95568
+ FROM memory_proposals AS destination
95569
+ JOIN staged.memory_proposals AS source ON source.id = destination.id`).all();
95570
+ for (const row of collided)
95571
+ unresolvedCollisions.push(row.id);
95572
+ }
95118
95573
  if (table === "memory_outcomes") {
95119
95574
  const overlaps = db.query(`SELECT destination.id,
95120
95575
  destination.event_json AS destination_json,
@@ -95145,7 +95600,16 @@ async function mergeStagedSqlite(destStoragePath, stagedPath) {
95145
95600
  if (failedTables.length > 0) {
95146
95601
  warn(`[memory-family-migration] ${failedTables.length} table(s) skipped during SQLite ATTACH merge: ${failedTables.join(", ")}`);
95147
95602
  }
95148
- return { merged, skipped: skippedDueToError };
95603
+ return {
95604
+ merged,
95605
+ skipped: skippedDueToError + skippedCollisions,
95606
+ audit: {
95607
+ filename: "memory.db",
95608
+ resurrectedIds,
95609
+ supersededCount,
95610
+ unresolvedCollisions
95611
+ }
95612
+ };
95149
95613
  } catch (error2) {
95150
95614
  if (transactionActive) {
95151
95615
  try {
@@ -95204,6 +95668,7 @@ async function migrateMemoryFamily(destRoot, sourceRoot) {
95204
95668
  throw makeAdmissionError(error2);
95205
95669
  }
95206
95670
  const perMember = [];
95671
+ const auditEntries = [];
95207
95672
  try {
95208
95673
  for (const member of MEMORY_FAMILY) {
95209
95674
  if (member.mergeStrategy === "skip")
@@ -95212,32 +95677,92 @@ async function migrateMemoryFamily(destRoot, sourceRoot) {
95212
95677
  const destPath = path126.join(destStoragePath, member.filename);
95213
95678
  if (member.mergeStrategy === "sqlite-file-copy") {
95214
95679
  if (!existsSync64(srcPath)) {
95215
- perMember.push({ filename: member.filename, merged: 0, skipped: 0 });
95680
+ perMember.push({
95681
+ filename: member.filename,
95682
+ merged: 0,
95683
+ skipped: 0,
95684
+ superseded: 0
95685
+ });
95216
95686
  continue;
95217
95687
  }
95218
95688
  const staged = stageSqliteDb(sourceStoragePath, destStoragePath);
95219
95689
  if (!staged) {
95220
- perMember.push({ filename: member.filename, merged: 0, skipped: 0 });
95690
+ perMember.push({
95691
+ filename: member.filename,
95692
+ merged: 0,
95693
+ skipped: 0,
95694
+ superseded: 0
95695
+ });
95221
95696
  continue;
95222
95697
  }
95223
- const { merged, skipped } = await mergeStagedSqlite(destStoragePath, staged.stagedPath);
95224
- perMember.push({ filename: member.filename, merged, skipped });
95698
+ const { merged, skipped, audit } = await mergeStagedSqlite(destStoragePath, staged.stagedPath);
95699
+ perMember.push({
95700
+ filename: member.filename,
95701
+ merged,
95702
+ skipped,
95703
+ superseded: audit.supersededCount
95704
+ });
95705
+ if (audit.resurrectedIds.length > 0 || audit.supersededCount > 0 || audit.unresolvedCollisions.length > 0) {
95706
+ auditEntries.push(audit);
95707
+ }
95225
95708
  continue;
95226
95709
  }
95227
95710
  if (member.mergeStrategy === "append-union") {
95228
95711
  if (!existsSync64(srcPath)) {
95229
- perMember.push({ filename: member.filename, merged: 0, skipped: 0 });
95712
+ perMember.push({
95713
+ filename: member.filename,
95714
+ merged: 0,
95715
+ skipped: 0,
95716
+ superseded: 0
95717
+ });
95230
95718
  continue;
95231
95719
  }
95232
95720
  const srcData = readJsonl3(srcPath);
95233
95721
  const destData = readJsonl3(destPath);
95234
- const { merged, added, skipped } = member.filename === "outcome-events.jsonl" ? appendUnionOutcomeEvents(destData, srcData) : appendUnionById2(destData, srcData);
95722
+ if (member.filename === "outcome-events.jsonl") {
95723
+ const { merged: merged2, added: added2, skipped: skipped2 } = appendUnionOutcomeEvents(destData, srcData);
95724
+ const serialized2 = serializeJsonl(merged2);
95725
+ if (!validateSerializedJsonl(serialized2)) {
95726
+ throw new Error(`memory-family-migration: validation failed for ${member.filename}; aborting before commit`);
95727
+ }
95728
+ await atomicWriteFile(destPath, serialized2);
95729
+ perMember.push({
95730
+ filename: member.filename,
95731
+ merged: added2,
95732
+ skipped: skipped2,
95733
+ superseded: 0
95734
+ });
95735
+ continue;
95736
+ }
95737
+ const {
95738
+ merged,
95739
+ added,
95740
+ skipped,
95741
+ superseded,
95742
+ unresolvedCollisions,
95743
+ resurrectedIds
95744
+ } = appendUnionById2(destData, srcData, {
95745
+ memberFilename: member.filename
95746
+ });
95235
95747
  const serialized = serializeJsonl(merged);
95236
95748
  if (!validateSerializedJsonl(serialized)) {
95237
95749
  throw new Error(`memory-family-migration: validation failed for ${member.filename}; aborting before commit`);
95238
95750
  }
95239
95751
  await atomicWriteFile(destPath, serialized);
95240
- perMember.push({ filename: member.filename, merged: added, skipped });
95752
+ perMember.push({
95753
+ filename: member.filename,
95754
+ merged: added,
95755
+ skipped,
95756
+ superseded
95757
+ });
95758
+ if (resurrectedIds.length > 0 || superseded > 0 || unresolvedCollisions.length > 0) {
95759
+ auditEntries.push({
95760
+ filename: member.filename,
95761
+ resurrectedIds,
95762
+ supersededCount: superseded,
95763
+ unresolvedCollisions
95764
+ });
95765
+ }
95241
95766
  }
95242
95767
  }
95243
95768
  if (isCohortRoot(sourceRoot)) {
@@ -95267,7 +95792,7 @@ async function migrateMemoryFamily(destRoot, sourceRoot) {
95267
95792
  } catch {}
95268
95793
  }
95269
95794
  }
95270
- return { perMember };
95795
+ return { perMember, audit: auditEntries };
95271
95796
  }
95272
95797
  var _internals104 = {
95273
95798
  appendUnionById: appendUnionById2,
@@ -101179,15 +101704,19 @@ ${formatStatus2(directory)}`;
101179
101704
  evictAndCloseForRoot(localRoot);
101180
101705
  let totalMerged = 0;
101181
101706
  let totalSkipped = 0;
101707
+ let totalSuperseded = 0;
101182
101708
  let familySummary = "";
101709
+ let familyAuditNote = "";
101183
101710
  try {
101184
101711
  const result = await migrateMemoryFamily(cohortRoot, localRoot);
101185
101712
  for (const m of result.perMember) {
101186
101713
  totalMerged += m.merged;
101187
101714
  totalSkipped += m.skipped;
101715
+ totalSuperseded += m.superseded;
101188
101716
  }
101189
- familySummary = result.perMember.filter((m) => m.merged > 0 || m.skipped > 0).map((m) => ` ${m.filename}: ${m.merged} merged, ${m.skipped} kept`).join(`
101717
+ familySummary = result.perMember.filter((m) => m.merged > 0 || m.skipped > 0 || m.superseded > 0).map((m) => ` ${m.filename}: ${m.merged} merged, ${m.skipped} kept${m.superseded > 0 ? `, ${m.superseded} recency-resolved` : ""}`).join(`
101190
101718
  `);
101719
+ familyAuditNote = formatFamilyAuditNote(result.audit);
101191
101720
  } catch (error2) {
101192
101721
  return `\u274C Failed to migrate the memory family into the cohort store: ${error2 instanceof Error ? error2.message : String(error2)}`;
101193
101722
  }
@@ -101221,20 +101750,48 @@ ${formatStatus2(directory)}`;
101221
101750
  (Re-linked from previous memory link "${existing.linkId}".)` : "";
101222
101751
  const familyNote = familySummary ? `
101223
101752
  ${familySummary}` : "";
101753
+ const auditNote = familyAuditNote ? `
101754
+ ${familyAuditNote}` : "";
101224
101755
  return [
101225
101756
  `\uD83D\uDD17 Linked this worktree's memory to shared cohort store "${linkId}".`,
101226
- ` migrated the memory family (${totalMerged} new, ${totalSkipped} already present).`,
101757
+ ` migrated the memory family (${totalMerged} new, ${totalSkipped} already present${totalSuperseded > 0 ? `, ${totalSuperseded} resolved by recency` : ""}).`,
101227
101758
  ` shared at: ${cohortRoot.cohortRoot}`,
101228
- "All worktrees linked to this id now read and write the same memory." + relinkNote + familyNote
101759
+ "All worktrees linked to this id now read and write the same memory." + relinkNote + familyNote + auditNote
101229
101760
  ].join(`
101230
101761
  `);
101231
101762
  }
101763
+ function formatFamilyAuditNote(audit) {
101764
+ const resurrected = [...new Set(audit.flatMap((m) => m.resurrectedIds))];
101765
+ const unresolved = [...new Set(audit.flatMap((m) => m.unresolvedCollisions))];
101766
+ const totalSuperseded = audit.reduce((sum, m) => sum + m.supersededCount, 0);
101767
+ const fmtIds = (ids) => {
101768
+ const shown = ids.slice(0, 5).map((raw) => {
101769
+ const id = sanitizeString(raw);
101770
+ return id.length > 40 ? `${id.slice(0, 39)}\u2026` : id;
101771
+ });
101772
+ const more = ids.length > 5 ? ` +${ids.length - 5} more` : "";
101773
+ return `ids: ${shown.join(", ")}${more}`;
101774
+ };
101775
+ const lines = [];
101776
+ if (resurrected.length > 0) {
101777
+ lines.push(`\u26A0 ${resurrected.length} record(s) deleted in one store were re-added from the other (${fmtIds(resurrected)}).`);
101778
+ }
101779
+ if (totalSuperseded > 0) {
101780
+ lines.push(`\u2139 ${totalSuperseded} record collision(s) resolved by recency \u2014 the newer state won.`);
101781
+ }
101782
+ if (unresolved.length > 0) {
101783
+ lines.push(`\u26A0 ${unresolved.length} collision(s) had no recency signal; the pre-existing version was kept (${fmtIds(unresolved)}).`);
101784
+ }
101785
+ return lines.join(`
101786
+ `);
101787
+ }
101232
101788
  async function handleMemoryUnlinkCommand(directory, args) {
101233
101789
  const noCopy = args.includes("--no-copy");
101234
101790
  const pointer = readMemoryLinkPointer(directory);
101235
101791
  if (!pointer) {
101236
101792
  return "\u2139\uFE0F Memory is not linked. Nothing to unlink.";
101237
101793
  }
101794
+ let unlinkAuditNote = "";
101238
101795
  const cohortDir = resolveLinkDir(pointer.linkId);
101239
101796
  const localRoot = wrapLocalRoot(directory);
101240
101797
  const cohortRoot = {
@@ -101249,7 +101806,8 @@ async function handleMemoryUnlinkCommand(directory, args) {
101249
101806
  evictAndCloseForRoot(cohortRoot);
101250
101807
  if (!noCopy) {
101251
101808
  try {
101252
- await migrateMemoryFamily(localRoot, cohortRoot);
101809
+ const result = await migrateMemoryFamily(localRoot, cohortRoot);
101810
+ unlinkAuditNote = formatFamilyAuditNote(result.audit);
101253
101811
  } catch (error2) {
101254
101812
  return `\u274C Failed to copy the cohort memory family back to local storage: ${error2 instanceof Error ? error2.message : String(error2)}`;
101255
101813
  }
@@ -101263,7 +101821,8 @@ async function handleMemoryUnlinkCommand(directory, args) {
101263
101821
  return [
101264
101822
  `\uD83D\uDD13 Unlinked memory. ${copyNote}`,
101265
101823
  ` The shared cohort store at ${cohortRoot.cohortRoot} is NOT deleted`,
101266
- " (other worktrees may still be linked to it)."
101824
+ " (other worktrees may still be linked to it).",
101825
+ ...unlinkAuditNote ? [unlinkAuditNote] : []
101267
101826
  ].join(`
101268
101827
  `);
101269
101828
  }
@@ -101506,7 +102065,7 @@ function createCuratorLLMDelegate(directory, mode = "init", sessionId) {
101506
102065
  }
101507
102066
  const sdkOpts = signal ? { signal } : {};
101508
102067
  try {
101509
- const { getSwarmAgents: getSwarmAgents2, resolveFallbackModel: resolveFallbackModel2 } = await import("./index-5e5s7p5z.js");
102068
+ const { getSwarmAgents: getSwarmAgents2, resolveFallbackModel: resolveFallbackModel2 } = await import("./index-r160hfq9.js");
101510
102069
  const createResult = await client.session.create({
101511
102070
  ...sessionId ? {
101512
102071
  body: {
@@ -103605,7 +104164,7 @@ async function cancelPrFeedbackLoopUnlocked(directory, sessionID, reason) {
103605
104164
  clearedEvents: []
103606
104165
  };
103607
104166
  try {
103608
- const { cancelPrFeedbackPublication: cancelPrFeedbackPublication2 } = await import("./pr-workflow-gate-bej2nn0c.js");
104167
+ const { cancelPrFeedbackPublication: cancelPrFeedbackPublication2 } = await import("./pr-workflow-gate-regg66xa.js");
103609
104168
  await cancelPrFeedbackPublication2(directory, sessionID, reason);
103610
104169
  } catch (err) {
103611
104170
  warn(`[pr-feedback-loop] cancelPrFeedbackPublication failed (fail-open): ${err instanceof Error ? err.message : String(err)}`);
@@ -117153,7 +117712,7 @@ async function deterministicSeed(input) {
117153
117712
  }
117154
117713
 
117155
117714
  // src/services/skill-optimizer/smoke.ts
117156
- import { existsSync as existsSync78, lstatSync as lstatSync18, readFileSync as readFileSync72, realpathSync as realpathSync24 } from "fs";
117715
+ import { existsSync as existsSync78, lstatSync as lstatSync19, readFileSync as readFileSync72, realpathSync as realpathSync24 } from "fs";
117157
117716
  import * as path155 from "path";
117158
117717
 
117159
117718
  // src/hooks/spawn-helper.ts
@@ -117237,7 +117796,7 @@ var _internals142 = {
117237
117796
  validateSkillPath,
117238
117797
  isSymbolicLink: (p) => {
117239
117798
  try {
117240
- return lstatSync18(p).isSymbolicLink();
117799
+ return lstatSync19(p).isSymbolicLink();
117241
117800
  } catch {
117242
117801
  return false;
117243
117802
  }
@@ -120245,7 +120804,7 @@ function buildDetailedHelp(commandName, entry) {
120245
120804
  async function handleHelpCommand(ctx) {
120246
120805
  const targetCommand = ctx.args.join(" ");
120247
120806
  if (!targetCommand) {
120248
- const { buildHelpText } = await import("./index-cy2zmsa0.js");
120807
+ const { buildHelpText } = await import("./index-ztezaknp.js");
120249
120808
  return buildHelpText();
120250
120809
  }
120251
120810
  const tokens = targetCommand.split(/\s+/);
@@ -120259,7 +120818,7 @@ async function handleHelpCommand(ctx) {
120259
120818
  > Note: \`/swarm ${resolved.key}\` is a deprecated alias for \`/swarm ${aliasTarget}\`.` : detailed;
120260
120819
  }
120261
120820
  const similar = _internals38.findSimilarCommands(targetCommand);
120262
- const { buildHelpText: fullHelp } = await import("./index-cy2zmsa0.js");
120821
+ const { buildHelpText: fullHelp } = await import("./index-ztezaknp.js");
120263
120822
  if (similar.length > 0) {
120264
120823
  return `Command '/swarm ${targetCommand}' not found.
120265
120824
 
@@ -120587,7 +121146,7 @@ var COMMAND_REGISTRY = {
120587
121146
  },
120588
121147
  "guardrail explain": {
120589
121148
  handler: async (ctx) => {
120590
- const { handleGuardrailExplain } = await import("./guardrail-explain-jvvk0at1.js");
121149
+ const { handleGuardrailExplain } = await import("./guardrail-explain-zhq6djgr.js");
120591
121150
  return handleGuardrailExplain(ctx.directory, ctx.args);
120592
121151
  },
120593
121152
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -120597,7 +121156,7 @@ var COMMAND_REGISTRY = {
120597
121156
  },
120598
121157
  "guardrail reset": {
120599
121158
  handler: async (ctx) => {
120600
- const { handleGuardrailReset } = await import("./guardrail-reset-ygq8e117.js");
121159
+ const { handleGuardrailReset } = await import("./guardrail-reset-3k2x5vsr.js");
120601
121160
  return handleGuardrailReset(ctx.args, ctx.sessionID);
120602
121161
  },
120603
121162
  description: "Reset one exact active invocation/action circuit after repair",
@@ -120618,7 +121177,7 @@ var COMMAND_REGISTRY = {
120618
121177
  },
120619
121178
  "guardrail-log": {
120620
121179
  handler: async (ctx) => {
120621
- const { handleGuardrailLog } = await import("./guardrail-log-b81vyjvz.js");
121180
+ const { handleGuardrailLog } = await import("./guardrail-log-enq4hp9f.js");
120622
121181
  return handleGuardrailLog(ctx.directory, ctx.args);
120623
121182
  },
120624
121183
  description: "Read the guardrail decision log (use --blocks-only for blocks)",
@@ -125950,4 +126509,4 @@ function getAgentConfigs(config, directory, sessionId, projectContext) {
125950
126509
  return result;
125951
126510
  }
125952
126511
 
125953
- export { resetActionCircuitExternally, getBlockingActionCircuit, resolveConfiguredAgentModel, resolveRegisteredAgentModel, resolveEffectiveAgentOverride, normalizePath, MAX_PARALLEL_VERDICT_TASKS, computeParallelVerdict, declaresWindowsWrapperLoose, getObservedHostShell, dcParseWindowsRecursiveDelete, mergeWriteAnalyses, isPowerShellShaped, isPowerShellReadOnlyPipeline, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractPowerShellTargets, getSharedClassifierGuardrailBlock, classifyCommand, readReviewRouteReceiptSync, enforcePersistedReviewRouteReceipt, recoverPreparedTaskRepair, recoverPreparedTaskRepairUnderPlanLock, repairTaskWorkflowUnderPlanLock, recoverPreparedTaskTerminal, recoverPreparedTaskTerminalUnderPlanLock, commitTaskTerminalUnderPlanLock, matchesTier3, resetArchitectPromptBudgetAdvisories, createArchitectAgent, createCoderAgent, GENERALIST_COUNCIL_PROMPT, SKEPTIC_COUNCIL_PROMPT, DOMAIN_EXPERT_COUNCIL_PROMPT, createCriticAgent, createCuratorAgent, createDesignerAgent, createDocsAgent, createResearcherAgent, SECURITY_CATEGORIES, createReviewerAgent, createSMEAgent, createTestEngineerAgent, _internals146 as _internals, stripSwarmPrefix, extractSwarmIdFromAgentName, resolveFallbackModel, getSwarmAgents, createAgents, resolvePrimaryAgentNames, getAgentConfigs, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, isPosixRmdirExecutor, isEmptyDirectoryRemovalWithinWorkspace, resolveWindowsWriteAuthority, swarmState, startAgentSession, getAgentSession, ensureAgentSession, hasModifiedFilesForTask, getModifiedFilesForTask, updateTaskWorkflowCache, advanceTaskState, getTaskState, recordStageBCompletion, getStageBRouteEvidence, isStageBRouteRequired, hasBothStageBCompletions, hasActiveTurboMode, hasActiveLeanTurbo, parseLeanLaneIndex, computeLaneRuntimeProfile, MAX_TRACKED_STANDARD_WORKTREE_CALLS, awaitingMergeByCallID, standardWorktreeByCallID, standardWorktreeSerializationSessions, laneChildSessionAgents, recordLaneChildSession, assertTaskIdNotForeignLaneSession, getStandardWorktreeDegradationReason, resetStandardWorktreeIsolationState, checkStandardWorktreeSerializationRelease, sanitizeWorktreeTaskId, preProvisionCollisionCheck, isLaneOwnedByCurrentSession, precreateStandardWorktreeSession, preserveBackgroundWorktreeOwnershipForCallId, preserveDirtyWorktreeForCallId, preserveDirtyWorktreeAtPath, cleanupStandardWorktreeForCallId, abortStandardWorktreeDispatch, runSerializedWithMergeBacks, finishStandardWorktreeDispatch, readLaneEnvFileFromDisk, _internals23 as _internals1, redactSecrets, PR_REVIEW_REPORT_VERDICTS, allowedPrReviewReportVerdicts, normalizePrReviewPartialBaseCoverageRecord, rollbackPrReviewPartialBaseCoverageAdmission, readPrReviewTerminalCoverageForReport, PR_REVIEW_REQUIRED_MICRO_LANE_IDS, PR_REVIEW_DEPTH_TIER_THRESHOLDS, PR_REVIEW_BASE_LANE_FLOORS, PR_REVIEW_TIER_L_CONSOLIDATED_LANE_FLOOR, PR_REVIEW_MICRO_LANE_FLOORS, computePrReviewDepthTier, MAX_PR_REVIEW_SUBMIT_REJECTIONS, MAX_PR_REVIEW_VERDICT_REJECTIONS, MAX_PR_FEEDBACK_INVENTORY_AMENDMENTS, activatePrWorkflow, appendPrWorkflowSkillContractAdvisories, readPrWorkflowGateState, recordPrReviewSubmitRejection, latestPrReviewSubmitRejectionMessage, recordPrReviewVerdictRejection, latestPrReviewVerdictRejectionForLane, submitPrReviewResult, withPrWorkflowCheckoutPreparationLock, withInactivePrWorkflowCheckoutRestoreLock, clearPrWorkflowGateState, terminalizePrWorkflowGateForSession2 as terminalizePrWorkflowGateForSession, PR_WORKFLOW_PROBE_SKIPPED_NO_BUDGET_REASON, collectPrWorkflowPendingLaneLiveness, settlePresumedStalePrWorkflowLanes, abortPrWorkflow, recoverArmedPrWorkflow, bindPrWorkflowHead, rebindPrFeedbackHead, bindPrReviewBase, assertCurrentCheckoutHead, assertPrReviewCleanCheckout, enforcePrWorkflowDispatchLanesAsync, PrReviewResilienceCircuitOpenError, PrReviewResilienceRetryExhaustedError, enforcePrReviewBaseDimensions, rollbackPrReviewBaseAdmissionIfUnlaunched, rollbackPrReviewValidationBatchIfUnlaunched, admitPrReviewPartialBaseCoverage2 as admitPrReviewPartialBaseCoverage, assertPrReviewBaseCoverageSettled2 as assertPrReviewBaseCoverageSettled, recordPrReviewMicroFamilyDispatch, recordPrReviewValidationBatch, assertPrReviewValidationSettled, declarePrFeedbackInventory, enforcePrFeedbackVerificationOwnership, assertPrFeedbackVerificationSettled, recordPrFeedbackStageA, recordPrFeedbackGateBatch, assertPrFeedbackGatePhaseSettled, assertPrFeedbackReadyToPublish, invalidatePrFeedbackPublication, describePrWorkflowPublicationSection, findDanglingLivePublicationGeneration, recordPrFeedbackPushAttemptResult, cancelPrFeedbackPublication, resolvePrReviewWriterRunId, markPrReviewTriggerEvaluationComplete, bindPrReviewTriggerLedger, assertPrReviewArtifactBoundary, assertPrReviewArtifactRecordsMatchAuthoritativeVerdicts, markPrReviewArtifactBoundary, markPrReviewHandoffComplete, readAuthoritativeFindingPolicy, readPrReviewFinalFindingPolicyForReport, transitionPrReviewToFeedback, declarePrFeedbackScope, resolvePrFeedbackScopeDeclaration, consumePrFeedbackScopeDeclaration, validatePrFeedbackScopeBinding, enforcePrWorkflowToolBefore, readPrReviewReentryBindingContext, hasActivePrReviewReentryAuthorization, reserveActivePrReviewReentryAuthorization, completePrWorkflow, _test_exports2 as _test_exports, normalizePrWorkflowShellCommand, describePrWorkflowRevisionDigestFailure, derivePrReviewCandidateInventoryForStatus, prReviewPhaseWindowForStatus, readPrReviewVerdictSettlementReceiptItems, readPrReviewVerdictSettlementEffectiveIds, readAuthoritativePrReviewCriticSettlements, readAuthoritativePrReviewCriticVerdicts, derivePrReviewPresentationOrder, derivePrReviewOrderUnstableItems, derivePrReviewReviewerSeverities, readAuthoritativePrReviewOrderAgreement, formatPrReviewLaneValidationFailure, validateExactStructuredReceiptCoverage2 as validateExactStructuredReceiptCoverage, validatePrReviewDiscoveryLaneCompletion2 as validatePrReviewDiscoveryLaneCompletion, validatePrWorkflowTransportRecovery, prReviewDiscoveryArtifactCoversLane, MAX_SALVAGED_SCHEMA_ERROR_CHARS, readPrWorkflowGateStateForRecovery, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleApproveWriteCommand, handleArchiveCommand, applySessionWorkflowView, handleAttestCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, DEFAULT_CI_DEADLINE_MS2 as DEFAULT_CI_DEADLINE_MS, createSignalCancellation, handleCiCommand, handleCiSimulateCommand, handleClarifyCommand, safeRealpathSync, createCuratorLLMDelegate, getCoChangePairs, startSnapshotCoordinationInitialization, ensureSnapshotCoordinationReady, retrySnapshotCoordinationInitialization, getSnapshotCoordinationStatus, beginSnapshotCoordinationReset, closeSnapshotCoordinationInitialization, markSnapshotCoordinationClosing, _snapshotCoordinationInternals, handleCloseCommand, _internals70 as _internals2, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals74 as _internals3, createHivePromoterHook, promoteToHive, promoteFromSwarm, createMemoryGateway, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getHostConfigDir, getPluginCachePaths, getPluginLockFilePaths, VERSION_PINNED_LEAF, discoverVersionPinnedCachePaths, readCachePackageVersion, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, computeQualityBudget, computeSastScan, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleBlueprintValidateCommand, handleBlueprintCurrentCommand, handleBlueprintHistoryCommand, handleBlueprintDiffCommand, handleBlueprintExportCommand, handleHarnessCandidateValidateCommand, handleHarnessCandidateShowCommand, handleHarnessCandidateDiffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, searchKnowledge, symbols, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleRecoverCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleReviewCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, isCommandFailure, COMMAND_REGISTRY, VALID_COMMANDS, _internals38 as _internals4, resolveCommand, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand };
126512
+ export { resetActionCircuitExternally, getBlockingActionCircuit, resolveConfiguredAgentModel, resolveRegisteredAgentModel, resolveEffectiveAgentOverride, normalizePath, MAX_PARALLEL_VERDICT_TASKS, computeParallelVerdict, dcParseWindowsRecursiveDelete, declaresWindowsWrapperLoose, getObservedHostShell, mergeWriteAnalyses, isPowerShellShaped, isPowerShellReadOnlyPipeline, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractPowerShellTargets, getSharedClassifierGuardrailBlock, classifyCommand, readReviewRouteReceiptSync, enforcePersistedReviewRouteReceipt, recoverPreparedTaskRepair, recoverPreparedTaskRepairUnderPlanLock, repairTaskWorkflowUnderPlanLock, recoverPreparedTaskTerminal, recoverPreparedTaskTerminalUnderPlanLock, commitTaskTerminalUnderPlanLock, matchesTier3, resetArchitectPromptBudgetAdvisories, createArchitectAgent, createCoderAgent, GENERALIST_COUNCIL_PROMPT, SKEPTIC_COUNCIL_PROMPT, DOMAIN_EXPERT_COUNCIL_PROMPT, createCriticAgent, createCuratorAgent, createDesignerAgent, createDocsAgent, createResearcherAgent, SECURITY_CATEGORIES, createReviewerAgent, createSMEAgent, createTestEngineerAgent, _internals146 as _internals, stripSwarmPrefix, extractSwarmIdFromAgentName, resolveFallbackModel, getSwarmAgents, createAgents, resolvePrimaryAgentNames, getAgentConfigs, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, isPosixRmdirExecutor, isEmptyDirectoryRemovalWithinWorkspace, resolveWindowsWriteAuthority, swarmState, startAgentSession, getAgentSession, ensureAgentSession, hasModifiedFilesForTask, getModifiedFilesForTask, updateTaskWorkflowCache, advanceTaskState, getTaskState, recordStageBCompletion, getStageBRouteEvidence, isStageBRouteRequired, hasBothStageBCompletions, hasActiveTurboMode, hasActiveLeanTurbo, parseLeanLaneIndex, computeLaneRuntimeProfile, MAX_TRACKED_STANDARD_WORKTREE_CALLS, awaitingMergeByCallID, standardWorktreeByCallID, standardWorktreeSerializationSessions, laneChildSessionAgents, recordLaneChildSession, assertTaskIdNotForeignLaneSession, getStandardWorktreeDegradationReason, resetStandardWorktreeIsolationState, checkStandardWorktreeSerializationRelease, sanitizeWorktreeTaskId, preProvisionCollisionCheck, isLaneOwnedByCurrentSession, precreateStandardWorktreeSession, preserveBackgroundWorktreeOwnershipForCallId, preserveDirtyWorktreeForCallId, preserveDirtyWorktreeAtPath, cleanupStandardWorktreeForCallId, abortStandardWorktreeDispatch, runSerializedWithMergeBacks, finishStandardWorktreeDispatch, readLaneEnvFileFromDisk, _internals23 as _internals1, redactSecrets, PR_REVIEW_REPORT_VERDICTS, allowedPrReviewReportVerdicts, normalizePrReviewPartialBaseCoverageRecord, rollbackPrReviewPartialBaseCoverageAdmission, readPrReviewTerminalCoverageForReport, PR_REVIEW_REQUIRED_MICRO_LANE_IDS, PR_REVIEW_DEPTH_TIER_THRESHOLDS, PR_REVIEW_BASE_LANE_FLOORS, PR_REVIEW_TIER_L_CONSOLIDATED_LANE_FLOOR, PR_REVIEW_MICRO_LANE_FLOORS, computePrReviewDepthTier, MAX_PR_REVIEW_SUBMIT_REJECTIONS, MAX_PR_REVIEW_VERDICT_REJECTIONS, MAX_PR_FEEDBACK_INVENTORY_AMENDMENTS, activatePrWorkflow, appendPrWorkflowSkillContractAdvisories, readPrWorkflowGateState, recordPrReviewSubmitRejection, latestPrReviewSubmitRejectionMessage, recordPrReviewVerdictRejection, latestPrReviewVerdictRejectionForLane, submitPrReviewResult, withPrWorkflowCheckoutPreparationLock, withInactivePrWorkflowCheckoutRestoreLock, clearPrWorkflowGateState, terminalizePrWorkflowGateForSession2 as terminalizePrWorkflowGateForSession, PR_WORKFLOW_PROBE_SKIPPED_NO_BUDGET_REASON, collectPrWorkflowPendingLaneLiveness, settlePresumedStalePrWorkflowLanes, abortPrWorkflow, recoverArmedPrWorkflow, bindPrWorkflowHead, rebindPrFeedbackHead, bindPrReviewBase, assertCurrentCheckoutHead, assertPrReviewCleanCheckout, enforcePrWorkflowDispatchLanesAsync, PrReviewResilienceCircuitOpenError, PrReviewResilienceRetryExhaustedError, enforcePrReviewBaseDimensions, rollbackPrReviewBaseAdmissionIfUnlaunched, rollbackPrReviewValidationBatchIfUnlaunched, admitPrReviewPartialBaseCoverage2 as admitPrReviewPartialBaseCoverage, assertPrReviewBaseCoverageSettled2 as assertPrReviewBaseCoverageSettled, recordPrReviewMicroFamilyDispatch, recordPrReviewValidationBatch, assertPrReviewValidationSettled, declarePrFeedbackInventory, enforcePrFeedbackVerificationOwnership, assertPrFeedbackVerificationSettled, recordPrFeedbackStageA, recordPrFeedbackGateBatch, assertPrFeedbackGatePhaseSettled, assertPrFeedbackReadyToPublish, invalidatePrFeedbackPublication, describePrWorkflowPublicationSection, findDanglingLivePublicationGeneration, recordPrFeedbackPushAttemptResult, cancelPrFeedbackPublication, resolvePrReviewWriterRunId, markPrReviewTriggerEvaluationComplete, bindPrReviewTriggerLedger, assertPrReviewArtifactBoundary, assertPrReviewArtifactRecordsMatchAuthoritativeVerdicts, markPrReviewArtifactBoundary, markPrReviewHandoffComplete, readAuthoritativeFindingPolicy, readPrReviewFinalFindingPolicyForReport, transitionPrReviewToFeedback, declarePrFeedbackScope, resolvePrFeedbackScopeDeclaration, consumePrFeedbackScopeDeclaration, validatePrFeedbackScopeBinding, enforcePrWorkflowToolBefore, readPrReviewReentryBindingContext, hasActivePrReviewReentryAuthorization, reserveActivePrReviewReentryAuthorization, completePrWorkflow, _test_exports2 as _test_exports, normalizePrWorkflowShellCommand, describePrWorkflowRevisionDigestFailure, derivePrReviewCandidateInventoryForStatus, prReviewPhaseWindowForStatus, readPrReviewVerdictSettlementReceiptItems, readPrReviewVerdictSettlementEffectiveIds, readAuthoritativePrReviewCriticSettlements, readAuthoritativePrReviewCriticVerdicts, derivePrReviewPresentationOrder, derivePrReviewOrderUnstableItems, derivePrReviewReviewerSeverities, readAuthoritativePrReviewOrderAgreement, formatPrReviewLaneValidationFailure, validateExactStructuredReceiptCoverage2 as validateExactStructuredReceiptCoverage, validatePrReviewDiscoveryLaneCompletion2 as validatePrReviewDiscoveryLaneCompletion, validatePrWorkflowTransportRecovery, prReviewDiscoveryArtifactCoversLane, MAX_SALVAGED_SCHEMA_ERROR_CHARS, readPrWorkflowGateStateForRecovery, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleApproveWriteCommand, handleArchiveCommand, applySessionWorkflowView, handleAttestCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, DEFAULT_CI_DEADLINE_MS2 as DEFAULT_CI_DEADLINE_MS, createSignalCancellation, handleCiCommand, handleCiSimulateCommand, handleClarifyCommand, safeRealpathSync, createCuratorLLMDelegate, getCoChangePairs, startSnapshotCoordinationInitialization, ensureSnapshotCoordinationReady, retrySnapshotCoordinationInitialization, getSnapshotCoordinationStatus, beginSnapshotCoordinationReset, closeSnapshotCoordinationInitialization, markSnapshotCoordinationClosing, _snapshotCoordinationInternals, handleCloseCommand, _internals70 as _internals2, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals74 as _internals3, createHivePromoterHook, promoteToHive, promoteFromSwarm, createMemoryGateway, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getHostConfigDir, getPluginCachePaths, getPluginLockFilePaths, VERSION_PINNED_LEAF, discoverVersionPinnedCachePaths, readCachePackageVersion, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, computeQualityBudget, computeSastScan, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleBlueprintValidateCommand, handleBlueprintCurrentCommand, handleBlueprintHistoryCommand, handleBlueprintDiffCommand, handleBlueprintExportCommand, handleHarnessCandidateValidateCommand, handleHarnessCandidateShowCommand, handleHarnessCandidateDiffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, searchKnowledge, symbols, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleRecoverCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleReviewCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, isCommandFailure, COMMAND_REGISTRY, VALID_COMMANDS, _internals38 as _internals4, resolveCommand, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand };