opencode-swarm 7.164.5 → 7.164.7

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 (101) hide show
  1. package/.opencode/skills/swarm-pr-review/SKILL.md +12 -12
  2. package/README.md +1 -1
  3. package/dist/background/pending-delegations.d.ts +12 -2
  4. package/dist/background/pr-review-contract.d.ts +9 -0
  5. package/dist/background/pr-subscriptions.d.ts +1 -8
  6. package/dist/cli/{coder-settlement-x9wbqx46.js → coder-settlement-p8wwmtnn.js} +14 -14
  7. package/dist/cli/{config-doctor-axd9d6hs.js → config-doctor-wxf488mw.js} +5 -3
  8. package/dist/cli/{core-f1a1fk13.js → core-671ybpbt.js} +2 -2
  9. package/dist/cli/{curation-policy-2cy7wejw.js → curation-policy-de7emfqc.js} +7 -6
  10. package/dist/cli/{curator-drift-3s3q4wsy.js → curator-drift-nvxv8xkk.js} +7 -5
  11. package/dist/cli/{curator-b104f7a7.js → curator-eaz5rj6k.js} +39 -37
  12. package/dist/cli/curator-llm-factory-swzyfnh6.js +68 -0
  13. package/dist/cli/{dispatch-q4v8x2pk.js → dispatch-dqybvj8v.js} +10 -6
  14. package/dist/cli/{evidence-summary-service-5xsjs3x3.js → evidence-summary-service-deqsc8hj.js} +19 -16
  15. package/dist/cli/{gate-evidence-ypja4156.js → gate-evidence-mafg71qb.js} +14 -8
  16. package/dist/cli/guardrail-explain-ygq7cx9w.js +69 -0
  17. package/dist/cli/{guardrail-log-6t4e2j5f.js → guardrail-log-k3w9dq6x.js} +9 -8
  18. package/dist/cli/{guardrail-reset-es0bg976.js → guardrail-reset-ae2step4.js} +39 -37
  19. package/dist/cli/hive-promoter-a4cs5sbr.js +83 -0
  20. package/dist/cli/{index-hnjkpk57.js → index-0zjwnbze.js} +1 -1
  21. package/dist/cli/{index-er8ba9be.js → index-1ekzd5wf.js} +56 -15
  22. package/dist/cli/{index-fxxja498.js → index-2czt53wz.js} +1 -1
  23. package/dist/cli/{index-wbnyc50b.js → index-388sxv1b.js} +17 -8
  24. package/dist/cli/{index-1q2dwv69.js → index-3kgg2n6z.js} +12 -6
  25. package/dist/cli/{index-50s9q4c1.js → index-3sv8t7ca.js} +2 -2
  26. package/dist/cli/{index-4jmtdtm9.js → index-46yrz972.js} +3 -3
  27. package/dist/cli/{index-s09b63xg.js → index-4vx89ymn.js} +5 -5
  28. package/dist/cli/{index-aaqbhn9h.js → index-581bcqp9.js} +2 -2
  29. package/dist/cli/{index-0trtcm9n.js → index-63enf73z.js} +20 -15
  30. package/dist/cli/index-7qefgq4j.js +71 -0
  31. package/dist/cli/{index-yrsag0vs.js → index-8ck1jkhd.js} +3 -2
  32. package/dist/cli/{index-y42pra05.js → index-8ntf8jnj.js} +19 -18
  33. package/dist/cli/{index-m1nrd3yd.js → index-8psybzzf.js} +1 -1
  34. package/dist/cli/{index-rz87mx1c.js → index-8tqqmsav.js} +1 -1
  35. package/dist/cli/{index-25z5qwkk.js → index-93znbdam.js} +9 -5
  36. package/dist/cli/{index-maxz22c1.js → index-9qkytpwa.js} +185 -376
  37. package/dist/cli/{index-164m995b.js → index-9ydhzegh.js} +28 -17
  38. package/dist/cli/{index-3gb7bw7h.js → index-bvjwmmdc.js} +1332 -1217
  39. package/dist/cli/{index-ywtcznk2.js → index-c4j9sjcs.js} +4 -4
  40. package/dist/cli/index-cw912re7.js +200 -0
  41. package/dist/cli/{index-8h9nng7f.js → index-fq1wfsmw.js} +100 -97
  42. package/dist/cli/{index-7rat6nyh.js → index-gm65h7bh.js} +9 -6
  43. package/dist/cli/{index-rc6hec4j.js → index-h3k3rgyr.js} +4 -4
  44. package/dist/cli/{index-ea7sehgy.js → index-jkwfajh1.js} +4 -4
  45. package/dist/cli/{index-1dz8hv7p.js → index-kvq1e82k.js} +3 -3
  46. package/dist/cli/{index-4emx8hhh.js → index-mr3h3sm5.js} +2 -2
  47. package/dist/cli/{index-q0gtgwyr.js → index-rey1tzcw.js} +7 -7
  48. package/dist/cli/index-ry16d01s.js +107 -0
  49. package/dist/cli/{index-aper29nf.js → index-ry4mwbc2.js} +1 -1
  50. package/dist/cli/{index-xj4kbtdw.js → index-sxxh4ams.js} +2 -2
  51. package/dist/cli/{index-tfa2p4y4.js → index-t1qzjhnj.js} +13 -13
  52. package/dist/cli/{index-xm7dc14y.js → index-v1fj9exz.js} +12 -5
  53. package/dist/cli/{index-3f7hqtgg.js → index-w3gtqey0.js} +4 -1
  54. package/dist/cli/{index-4krjn1gn.js → index-wgqeqy68.js} +2 -2
  55. package/dist/cli/{index-3rrc5x4v.js → index-x2t2tbm2.js} +2 -2
  56. package/dist/cli/{index-0zbze3n6.js → index-x3qzt684.js} +71 -47
  57. package/dist/cli/{index-j9a4fsxg.js → index-xc3q62ev.js} +2 -2
  58. package/dist/cli/{index-553veay1.js → index-xy59dnvq.js} +1 -1
  59. package/dist/cli/{index-fwebva1m.js → index-y75xd50f.js} +36 -27
  60. package/dist/cli/{index-25jze7sf.js → index-yzn1fm9a.js} +1 -1
  61. package/dist/cli/{index-1f4nandk.js → index-zg34ngdf.js} +21 -11
  62. package/dist/cli/{index-ssb67ff6.js → index-zg8tvjb0.js} +41 -39
  63. package/dist/cli/index.js +39 -37
  64. package/dist/cli/{knowledge-escalator-evjd8g7y.js → knowledge-escalator-t532h2ym.js} +15 -14
  65. package/dist/cli/{knowledge-events-q46z1wy6.js → knowledge-events-hdtc0cxe.js} +13 -12
  66. package/dist/cli/{knowledge-link-ffmzf72f.js → knowledge-link-hhnmc4g1.js} +6 -5
  67. package/dist/cli/{knowledge-store-z82f5x9k.js → knowledge-store-45jadhmb.js} +7 -6
  68. package/dist/cli/{knowledge-validator-19gbnxx2.js → knowledge-validator-5e6qbq6h.js} +9 -8
  69. package/dist/cli/{model-preflight-pmnbfzjv.js → model-preflight-bq035tfh.js} +1 -1
  70. package/dist/cli/{pending-delegations-t4cqk5ha.js → pending-delegations-z0crvst3.js} +7 -7
  71. package/dist/cli/{pr-subscriptions-3enjtq0k.js → pr-subscriptions-73fs8y3n.js} +7 -6
  72. package/dist/cli/{pr-workflow-gate-3ecgfsge.js → pr-workflow-gate-rpdts7wy.js} +41 -37
  73. package/dist/cli/{runner-wqy2hbxn.js → runner-5qqh83e2.js} +6 -6
  74. package/dist/cli/{scan-cursor-8wcy0dvf.js → scan-cursor-t75qznf3.js} +8 -7
  75. package/dist/cli/{schema-hsw9r2tm.js → schema-8dfjsrk6.js} +2 -2
  76. package/dist/cli/{scope-persistence-mbwt4grd.js → scope-persistence-zfmz4sws.js} +12 -10
  77. package/dist/cli/{skill-generator-kg32a5jy.js → skill-generator-psdb10jw.js} +17 -16
  78. package/dist/cli/{telemetry-j14cj552.js → telemetry-85gxedng.js} +1 -1
  79. package/dist/cli/{workspace-snapshot-yq0tc49d.js → workspace-snapshot-eh18vgkn.js} +2 -1
  80. package/dist/cli/{worktree-collision-ownership-0rfw6kp3.js → worktree-collision-ownership-xrqssqzd.js} +12 -15
  81. package/dist/cli/{worktree-isolation-qcwt09ve.js → worktree-isolation-s9m3bgah.js} +39 -37
  82. package/dist/db/canonical-project.d.ts +10 -3
  83. package/dist/db/project-db.d.ts +4 -0
  84. package/dist/evidence/task-gate-repair.d.ts +1 -1
  85. package/dist/gate-evidence.d.ts +19 -1
  86. package/dist/hooks/delegation-gate.d.ts +3 -1
  87. package/dist/hooks/pr-workflow-gate.d.ts +10 -2
  88. package/dist/index.js +593 -590
  89. package/dist/plan/ledger.d.ts +2 -0
  90. package/dist/pr-review/authorization.d.ts +13 -3
  91. package/dist/tools/authorize-pr-review-reentry.d.ts +5 -4
  92. package/dist/tools/dispatch-lanes.d.ts +1 -0
  93. package/dist/tools/pr-workflow-status.d.ts +2 -0
  94. package/dist/tools/pre-check-batch.d.ts +1 -1
  95. package/dist/utils/canonical-root.d.ts +21 -1
  96. package/dist/utils/filesystem-identity.d.ts +59 -0
  97. package/package.json +2 -1
  98. package/dist/cli/curator-llm-factory-cv7ft0mb.js +0 -66
  99. package/dist/cli/guardrail-explain-cvha7b9p.js +0 -67
  100. package/dist/cli/hive-promoter-yzv5g7jy.js +0 -81
  101. package/dist/cli/index-ddszzne4.js +0 -42
@@ -11,16 +11,16 @@ import {
11
11
  import {
12
12
  init_schema,
13
13
  stripKnownSwarmPrefix
14
- } from "./index-yrsag0vs.js";
14
+ } from "./index-8ck1jkhd.js";
15
15
  import {
16
16
  observeStoreHealth
17
- } from "./index-164m995b.js";
17
+ } from "./index-9ydhzegh.js";
18
18
  import {
19
19
  init_constants
20
- } from "./index-m1nrd3yd.js";
20
+ } from "./index-8psybzzf.js";
21
21
  import {
22
22
  telemetry
23
- } from "./index-1dz8hv7p.js";
23
+ } from "./index-kvq1e82k.js";
24
24
  import {
25
25
  init_logger,
26
26
  warn
@@ -665,7 +665,7 @@ var CATALOG_SOURCE = [
665
665
  category: "plan",
666
666
  severity: "notice",
667
667
  privacyClass: "operational",
668
- producer: "src/plan/manager.ts:345",
668
+ producer: "src/plan/manager.ts:346",
669
669
  consumers: NO_CONSUMERS,
670
670
  futureOwnerIssue: ISSUE_SINK,
671
671
  retentionOwnerIssue: ISSUE_PLAN_EVIDENCE_RETENTION,
@@ -678,7 +678,7 @@ var CATALOG_SOURCE = [
678
678
  category: "plan",
679
679
  severity: "warning",
680
680
  privacyClass: "sensitive",
681
- producer: "src/plan/manager.ts:1853",
681
+ producer: "src/plan/manager.ts:1854",
682
682
  consumers: NO_CONSUMERS,
683
683
  futureOwnerIssue: ISSUE_SINK,
684
684
  retentionOwnerIssue: ISSUE_PLAN_EVIDENCE_RETENTION,
@@ -691,7 +691,7 @@ var CATALOG_SOURCE = [
691
691
  category: "plan",
692
692
  severity: "error",
693
693
  privacyClass: "sensitive",
694
- producer: "src/plan/ledger.ts:1167",
694
+ producer: "src/plan/ledger.ts:1176",
695
695
  consumers: NO_CONSUMERS,
696
696
  futureOwnerIssue: ISSUE_SINK,
697
697
  retentionOwnerIssue: ISSUE_PLAN_EVIDENCE_RETENTION,
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  withEvidenceLock
4
- } from "./index-fxxja498.js";
4
+ } from "./index-2czt53wz.js";
5
5
  import {
6
6
  atomicWriteFileAnyRoot
7
- } from "./index-tfa2p4y4.js";
7
+ } from "./index-t1qzjhnj.js";
8
8
 
9
9
  // src/evidence/task-file.ts
10
10
  import * as path from "path";
@@ -6,17 +6,17 @@ import {
6
6
  } from "./index-ae75rja9.js";
7
7
  import {
8
8
  resolveKnowledgeStoreDir
9
- } from "./index-25z5qwkk.js";
9
+ } from "./index-93znbdam.js";
10
10
  import {
11
11
  atomicWriteFile
12
- } from "./index-4emx8hhh.js";
12
+ } from "./index-mr3h3sm5.js";
13
13
  import {
14
14
  init_knowledge_types,
15
15
  isActiveStatus
16
16
  } from "./index-bk5tah7q.js";
17
17
  import {
18
18
  readCachedParsedFile
19
- } from "./index-tfa2p4y4.js";
19
+ } from "./index-t1qzjhnj.js";
20
20
  import {
21
21
  require_proper_lockfile
22
22
  } from "./index-7g4c7s5r.js";
@@ -713,7 +713,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
713
713
  const {
714
714
  readAuthoritativeKnowledgeCounterRollups,
715
715
  effectiveRetrievalOutcomes
716
- } = await import("./knowledge-events-q46z1wy6.js");
716
+ } = await import("./knowledge-events-hdtc0cxe.js");
717
717
  const rollups = await readAuthoritativeKnowledgeCounterRollups(directory);
718
718
  const flagIds = new Set;
719
719
  for (const e of atFloor) {
@@ -780,11 +780,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
780
780
  });
781
781
  }
782
782
  if (action === "quarantine" && toQuarantine.length > 0) {
783
- const { quarantineEntry } = await import("./knowledge-validator-19gbnxx2.js");
784
- const { KnowledgeConfigSchema } = await import("./schema-hsw9r2tm.js");
783
+ const { quarantineEntry } = await import("./knowledge-validator-5e6qbq6h.js");
784
+ const { KnowledgeConfigSchema } = await import("./schema-8dfjsrk6.js");
785
785
  let config;
786
786
  try {
787
- const { loadPluginConfigWithMeta } = await import("./index-ywtcznk2.js");
787
+ const { loadPluginConfigWithMeta } = await import("./index-c4j9sjcs.js");
788
788
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
789
789
  config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
790
790
  } catch {
@@ -0,0 +1,107 @@
1
+ // @bun
2
+ // src/utils/filesystem-identity.ts
3
+ import * as fsSync from "fs";
4
+ import * as path from "path";
5
+ var _internals = {
6
+ realpathSyncNative: fsSync.realpathSync.native,
7
+ realpathSync: fsSync.realpathSync,
8
+ lstatSync: fsSync.lstatSync,
9
+ platform: () => process.platform
10
+ };
11
+ function normalizeIdentityPath(resolved) {
12
+ const normalized = _internals.platform() === "win32" ? path.win32.normalize(resolved) : path.posix.normalize(resolved);
13
+ return _internals.platform() === "win32" ? normalized.replaceAll("\\", "/").toLowerCase() : normalized;
14
+ }
15
+ function canonicalExistingFilesystemPath(entryPath) {
16
+ if (typeof entryPath !== "string")
17
+ return null;
18
+ const resolvedInput = path.resolve(entryPath);
19
+ try {
20
+ return normalizeIdentityPath(_internals.realpathSyncNative(resolvedInput));
21
+ } catch {
22
+ try {
23
+ return normalizeIdentityPath(_internals.realpathSync(resolvedInput));
24
+ } catch {
25
+ return null;
26
+ }
27
+ }
28
+ }
29
+ function legacyCanonicalExistingFilesystemPath(entryPath) {
30
+ if (typeof entryPath !== "string")
31
+ return null;
32
+ try {
33
+ return normalizeIdentityPath(_internals.realpathSync(path.resolve(entryPath)));
34
+ } catch {
35
+ return null;
36
+ }
37
+ }
38
+ function appendLinkedAncestorWitnesses(witnesses, startPath) {
39
+ let probe = path.resolve(startPath);
40
+ for (let depth = 0;depth < 4096; depth++) {
41
+ const parent = path.dirname(probe);
42
+ if (parent === probe)
43
+ return;
44
+ probe = parent;
45
+ try {
46
+ if (!_internals.lstatSync(probe).isSymbolicLink())
47
+ continue;
48
+ } catch {
49
+ continue;
50
+ }
51
+ const canonical = canonicalExistingFilesystemPath(probe);
52
+ if (canonical !== null) {
53
+ witnesses.push({ lexicalPath: probe, canonicalPath: canonical });
54
+ }
55
+ }
56
+ }
57
+ function filesystemIdentityWitnesses(entryPath) {
58
+ const lexicalPath = path.resolve(entryPath);
59
+ const canonicalPath = canonicalExistingFilesystemPath(lexicalPath);
60
+ if (canonicalPath === null)
61
+ return [];
62
+ const witnesses = [{ lexicalPath, canonicalPath }];
63
+ appendLinkedAncestorWitnesses(witnesses, lexicalPath);
64
+ return witnesses;
65
+ }
66
+ function canonicalPathFromExistingAncestor(entryPath) {
67
+ let probe = path.resolve(entryPath);
68
+ const tail = [];
69
+ for (let depth = 0;depth < 4096; depth++) {
70
+ let stat;
71
+ try {
72
+ stat = _internals.lstatSync(probe);
73
+ } catch (error) {
74
+ const code = error && typeof error === "object" && "code" in error ? String(error.code) : undefined;
75
+ if (code !== "ENOENT" && code !== "ENOTDIR")
76
+ return null;
77
+ const parent = path.dirname(probe);
78
+ if (parent === probe)
79
+ return null;
80
+ tail.unshift(path.basename(probe));
81
+ probe = parent;
82
+ continue;
83
+ }
84
+ const canonicalAncestor = canonicalExistingFilesystemPath(probe);
85
+ if (canonicalAncestor === null)
86
+ return null;
87
+ let existingAncestorIsLink = false;
88
+ existingAncestorIsLink = stat.isSymbolicLink();
89
+ return {
90
+ canonicalPath: normalizeIdentityPath(path.join(canonicalAncestor, ...tail)),
91
+ existingAncestor: probe,
92
+ existingAncestorIsLink,
93
+ identityWitnesses: filesystemIdentityWitnesses(probe)
94
+ };
95
+ }
96
+ return null;
97
+ }
98
+ function canonicalPathForFutureIo(entryPath) {
99
+ return canonicalExistingFilesystemPath(entryPath) ?? canonicalPathFromExistingAncestor(entryPath)?.canonicalPath ?? null;
100
+ }
101
+ function sameExistingFilesystemPath(a, b) {
102
+ const canonicalA = canonicalExistingFilesystemPath(a);
103
+ const canonicalB = canonicalExistingFilesystemPath(b);
104
+ return canonicalA !== null && canonicalB !== null && canonicalA === canonicalB;
105
+ }
106
+
107
+ export { canonicalExistingFilesystemPath, legacyCanonicalExistingFilesystemPath, filesystemIdentityWitnesses, canonicalPathFromExistingAncestor, canonicalPathForFutureIo, sameExistingFilesystemPath };
@@ -4,7 +4,7 @@ import {
4
4
  readShellAuditTail,
5
5
  redactPath,
6
6
  redactShellCommand
7
- } from "./index-ea7sehgy.js";
7
+ } from "./index-jkwfajh1.js";
8
8
 
9
9
  // src/services/guardrail-log-service.ts
10
10
  var BLOCK_TYPES = new Set([
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  validateSwarmPath
4
- } from "./index-rz87mx1c.js";
4
+ } from "./index-8tqqmsav.js";
5
5
  import {
6
6
  atomicWriteSwarmFileSync
7
- } from "./index-tfa2p4y4.js";
7
+ } from "./index-t1qzjhnj.js";
8
8
 
9
9
  // src/hooks/delegation-gate/worktree-provisioning-owner.ts
10
10
  import { createHash } from "crypto";
@@ -177,7 +177,7 @@ var SWARM_TEMP_GRAMMARS = [
177
177
  "src/commands/handoff.ts:48 (pre-#2035)",
178
178
  "src/commands/handoff.ts:79 (pre-#2035)",
179
179
  "src/memory/local-jsonl-provider.ts:1288",
180
- "src/config/bundled-skills.ts:250"
180
+ "src/config/bundled-skills.ts:251"
181
181
  ]
182
182
  },
183
183
  {
@@ -213,16 +213,16 @@ var SWARM_TEMP_GRAMMARS = [
213
213
  "src/evidence/task-file.ts:67 (pre-#2035)",
214
214
  "src/scope/scope-persistence.ts:2304 (pre-#2035)",
215
215
  "src/scope/scope-persistence.ts:2318 (pre-#2035)",
216
- "src/plan/manager.ts:629",
217
- "src/plan/manager.ts:1785",
218
- "src/plan/manager.ts:1831",
216
+ "src/plan/manager.ts:630",
217
+ "src/plan/manager.ts:1786",
218
+ "src/plan/manager.ts:1832",
219
219
  "src/review/evidence.ts:175",
220
220
  "src/turbo/lean/evidence.ts:182",
221
221
  "src/summaries/manager.ts:122",
222
222
  "src/evidence/manager.ts:288",
223
223
  "src/evidence/manager.ts:456",
224
224
  "src/tools/sast-baseline.ts:199",
225
- "src/tools/repo-graph/storage.ts:493",
225
+ "src/tools/repo-graph/storage.ts:494",
226
226
  "src/memory/reflection-service.ts:547 (pre-#2035)",
227
227
  "src/hooks/review-receipt.ts:608",
228
228
  "src/hooks/review-receipt.ts:674",
@@ -231,12 +231,12 @@ var SWARM_TEMP_GRAMMARS = [
231
231
  "src/evidence/phase-participation.ts:303 (pre-#2035)",
232
232
  "src/turbo/lean/integration.ts:426",
233
233
  "src/turbo/lean/reviewer.ts:403",
234
- "src/plan/ledger.ts:737",
234
+ "src/plan/ledger.ts:746",
235
235
  "src/services/synonym-map.ts:389",
236
236
  "src/services/skill-optimizer/store.ts:340",
237
237
  "src/services/skill-optimizer/store.ts:503",
238
- "src/turbo/epic/state.ts:177",
239
- "src/turbo/epic/calibration.ts:197",
238
+ "src/turbo/epic/state.ts:182",
239
+ "src/turbo/epic/calibration.ts:202",
240
240
  "src/commands/archive-sqlite.ts:318",
241
241
  "src/memory/jsonl-migration.ts:161"
242
242
  ],
@@ -250,7 +250,7 @@ var SWARM_TEMP_GRAMMARS = [
250
250
  quarantineEligible: true,
251
251
  parsesTarget: true,
252
252
  producers: [
253
- "src/turbo/lean/state.ts:246",
253
+ "src/turbo/lean/state.ts:251",
254
254
  "src/turbo/lean/recovery.ts:175",
255
255
  "src/hooks/delegation-gate/worktree-merge-status.ts:110"
256
256
  ]
@@ -270,7 +270,7 @@ var SWARM_TEMP_GRAMMARS = [
270
270
  "src/tools/spec-write.ts:98",
271
271
  "src/sdd/effective-spec.ts:1149",
272
272
  "src/background/lane-output-store.ts:353",
273
- "src/background/pending-delegations.ts:1091",
273
+ "src/background/pending-delegations.ts:1117",
274
274
  "src/background/delegation-health.ts:391",
275
275
  "src/tools/submit-phase-council-verdicts.ts:458",
276
276
  "src/summaries/store.ts:46 (pre-#2035)"
@@ -340,7 +340,7 @@ var SWARM_TEMP_GRAMMARS = [
340
340
  token: "instance",
341
341
  quarantineEligible: true,
342
342
  parsesTarget: true,
343
- producers: ["src/plan/manager.ts:1971", "src/plan/manager.ts:2160"],
343
+ producers: ["src/plan/manager.ts:1972", "src/plan/manager.ts:2161"],
344
344
  note: "plan-durability (invariant 5) fd-write paths; grammars registered, writers unchanged in this PR"
345
345
  },
346
346
  {
@@ -402,8 +402,8 @@ var SWARM_TEMP_GRAMMARS = [
402
402
  "src/hooks/skill-usage-log.ts:1675",
403
403
  "src/hooks/skill-usage-pending.ts:817",
404
404
  "src/parallel/file-locks.ts:113",
405
- "src/plan/ledger.ts:1333",
406
- "src/plan/ledger.ts:1334"
405
+ "src/plan/ledger.ts:1344",
406
+ "src/plan/ledger.ts:1345"
407
407
  ],
408
408
  note: "constant-name temps: reported when stale, never auto-quarantined. file-locks meta sidecars live under the scanner-skipped .swarm/locks/ subtree; the ledger reconcile temp embeds instance tokens but its .tmp-suffix shape maps here (conservatively report-only)"
409
409
  }
@@ -4,14 +4,14 @@ import {
4
4
  PlanSchema,
5
5
  TaskStatusSchema,
6
6
  init_loader
7
- } from "./index-553veay1.js";
7
+ } from "./index-xy59dnvq.js";
8
8
  import {
9
9
  assertProjectRoot,
10
10
  withEvidenceLock
11
- } from "./index-fxxja498.js";
11
+ } from "./index-2czt53wz.js";
12
12
  import {
13
13
  emit
14
- } from "./index-1dz8hv7p.js";
14
+ } from "./index-kvq1e82k.js";
15
15
  import {
16
16
  criticalWarn,
17
17
  init_logger,
@@ -85,6 +85,12 @@ function getLedgerPath(directory) {
85
85
  function getPlanJsonPath(directory) {
86
86
  return path.join(directory, ".swarm", PLAN_JSON_FILENAME);
87
87
  }
88
+ function compareCodeUnits(a, b) {
89
+ return a < b ? -1 : a > b ? 1 : 0;
90
+ }
91
+ function readLedgerDirectory(directory) {
92
+ return fs.readdirSync(directory);
93
+ }
88
94
  function asRecord(value) {
89
95
  if (value && typeof value === "object" && !Array.isArray(value)) {
90
96
  return value;
@@ -619,7 +625,7 @@ async function replaceTruncatedLedgerWithRecoveryRoot(directory, plan, expected)
619
625
  let archiveName = `plan-ledger.reconcile-archive.${Date.now()}.${Math.floor(Math.random() * 1e9)}${archiveSuffix}`;
620
626
  let archivePath = path.join(swarmDir, archiveName);
621
627
  let archiveNeedsWrite = true;
622
- for (const candidate of fs.readdirSync(swarmDir)) {
628
+ for (const candidate of _internals.readLedgerDirectory(swarmDir).sort(compareCodeUnits)) {
623
629
  if (!candidate.startsWith("plan-ledger.reconcile-archive.") || !candidate.endsWith(archiveSuffix)) {
624
630
  continue;
625
631
  }
@@ -877,7 +883,7 @@ async function quarantineLedgerSuffix(directory, badSuffix) {
877
883
  const hash = crypto.createHash("sha256").update(badSuffix, "utf8").digest("hex").slice(0, 12);
878
884
  const swarmDir = path.join(directory, ".swarm");
879
885
  try {
880
- const existing = fs.readdirSync(swarmDir).filter((name) => name.startsWith("plan-ledger.quarantine.") && name.endsWith(`.${hash}`));
886
+ const existing = _internals.readLedgerDirectory(swarmDir).sort(compareCodeUnits).filter((name) => name.startsWith("plan-ledger.quarantine.") && name.endsWith(`.${hash}`));
881
887
  for (const name of existing) {
882
888
  const existingPath = path.join(swarmDir, name);
883
889
  if (fs.readFileSync(existingPath, "utf8") === badSuffix) {
@@ -959,6 +965,7 @@ var _internals = {
959
965
  getPlanJsonPath,
960
966
  writeFileFsyncedThenRename,
961
967
  fsyncRecoveryDirectory,
968
+ readLedgerDirectory,
962
969
  randomUUID: () => crypto.randomUUID()
963
970
  };
964
971
 
@@ -6,6 +6,9 @@ import {
6
6
  init_git_executable,
7
7
  resolveGitExecutable
8
8
  } from "./index-9e6fdz2h.js";
9
+ import {
10
+ sameProjectRoot
11
+ } from "./index-7qefgq4j.js";
9
12
 
10
13
  // src/background/workspace-snapshot.ts
11
14
  import * as child_process from "child_process";
@@ -1167,7 +1170,7 @@ function changedFilesSinceSnapshot(directory, baseline) {
1167
1170
  function workspaceSnapshotMatches(expected, current) {
1168
1171
  if (!expected)
1169
1172
  return { ok: true };
1170
- if (path.resolve(expected.directory) !== path.resolve(current.directory)) {
1173
+ if (!sameProjectRoot(expected.directory, current.directory)) {
1171
1174
  return {
1172
1175
  ok: false,
1173
1176
  reason: `directory changed: expected ${expected.directory}, got ${current.directory}`
@@ -9,11 +9,11 @@ import {
9
9
  } from "./index-txdagbh7.js";
10
10
  import {
11
11
  atomicWriteFile
12
- } from "./index-4emx8hhh.js";
12
+ } from "./index-mr3h3sm5.js";
13
13
  import {
14
14
  assertProjectRoot,
15
15
  withEvidenceLock
16
- } from "./index-fxxja498.js";
16
+ } from "./index-2czt53wz.js";
17
17
  import {
18
18
  exports_external,
19
19
  init_zod
@@ -14,14 +14,14 @@ import {
14
14
  detectWindowsWrites,
15
15
  getSharedClassifierGuardrailBlock,
16
16
  resolveWriteTargets
17
- } from "./index-3gb7bw7h.js";
17
+ } from "./index-bvjwmmdc.js";
18
18
  import {
19
19
  checkFileAuthority,
20
20
  classifyFile,
21
21
  isInDeclaredScope,
22
22
  redactPath,
23
23
  redactShellCommand
24
- } from "./index-ea7sehgy.js";
24
+ } from "./index-jkwfajh1.js";
25
25
 
26
26
  // src/services/guardrail-explain-service.ts
27
27
  import path from "path";
@@ -2,6 +2,9 @@
2
2
  import {
3
3
  loadDatabaseCtor
4
4
  } from "./index-zaab1wz9.js";
5
+ import {
6
+ canonicalExistingFilesystemPath
7
+ } from "./index-ry16d01s.js";
5
8
  import {
6
9
  validateSpecContent
7
10
  } from "./index-n832052r.js";
@@ -9,9 +12,13 @@ import {
9
12
  advisoryWarn,
10
13
  init_warning_buffer
11
14
  } from "./index-4rhhvd1a.js";
15
+ import {
16
+ canonicalRootKeyFresh,
17
+ lexicalRootAliasKey
18
+ } from "./index-7qefgq4j.js";
12
19
  import {
13
20
  atomicWriteSwarmFileSync
14
- } from "./index-tfa2p4y4.js";
21
+ } from "./index-t1qzjhnj.js";
15
22
 
16
23
  // src/sdd/effective-spec.ts
17
24
  import { createHash } from "crypto";
@@ -727,26 +734,9 @@ function withDurabilityClass(db, cls, fn) {
727
734
  }
728
735
  }
729
736
 
730
- // src/db/canonical-project.ts
731
- import { realpathSync } from "fs";
732
- import { resolve as resolve2 } from "path";
733
- var _internals = {
734
- realpathSync
735
- };
736
- function canonicalProjectKey(directory) {
737
- const lexical = resolve2(directory);
738
- let canonical;
739
- try {
740
- canonical = _internals.realpathSync(lexical);
741
- } catch {
742
- canonical = lexical;
743
- }
744
- return process.platform === "win32" ? canonical.toLowerCase() : canonical;
745
- }
746
-
747
737
  // src/db/project-db.ts
748
738
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, unlinkSync } from "fs";
749
- import { join as join2, resolve as resolve3 } from "path";
739
+ import { join as join2 } from "path";
750
740
 
751
741
  // src/db/db-errors.ts
752
742
  class ProjectDbError extends Error {
@@ -964,6 +954,38 @@ var MIGRATIONS = [
964
954
  }
965
955
  ];
966
956
  var _projectDbs = new Map;
957
+ var _projectDbAliases = new Map;
958
+ var MAX_ALIASES_PER_PROJECT_DB = 128;
959
+ function lexicalAliasKey(directory) {
960
+ return lexicalRootAliasKey(directory);
961
+ }
962
+ function unbindAlias(alias, physicalKey) {
963
+ if (_projectDbAliases.get(alias) === physicalKey) {
964
+ _projectDbAliases.delete(alias);
965
+ }
966
+ _projectDbs.get(physicalKey)?.aliases.delete(alias);
967
+ }
968
+ function bindAlias(record, physicalKey, alias) {
969
+ const previousKey = _projectDbAliases.get(alias);
970
+ if (previousKey !== undefined && previousKey !== physicalKey) {
971
+ unbindAlias(alias, previousKey);
972
+ }
973
+ record.aliases.delete(alias);
974
+ record.aliases.add(alias);
975
+ _projectDbAliases.set(alias, physicalKey);
976
+ while (record.aliases.size > MAX_ALIASES_PER_PROJECT_DB) {
977
+ const evicted = [...record.aliases].find((candidate) => candidate !== record.primaryAlias && candidate !== alias);
978
+ if (evicted === undefined)
979
+ break;
980
+ unbindAlias(evicted, physicalKey);
981
+ }
982
+ }
983
+ function closeRecord(physicalKey, record) {
984
+ record.db.close();
985
+ _projectDbs.delete(physicalKey);
986
+ for (const alias of [...record.aliases])
987
+ unbindAlias(alias, physicalKey);
988
+ }
967
989
  function recordMigrationFailure(db, migration, err, markerDir) {
968
990
  const errorText = String(err instanceof Error ? err.message : err).slice(0, MIGRATION_FAILURE_ERROR_MAX_CHARS);
969
991
  try {
@@ -1032,28 +1054,20 @@ function runProjectMigrations(db, markerDir) {
1032
1054
  removeMigrationFailureMarker(markerDir);
1033
1055
  }
1034
1056
  function projectDbPath(directory) {
1035
- return join2(resolve3(directory), ".swarm", "swarm.db");
1057
+ return join2(canonicalRootKeyFresh(directory), ".swarm", "swarm.db");
1036
1058
  }
1037
1059
  function projectDbExists(directory) {
1038
- return existsSync2(join2(canonicalProjectKey(directory), ".swarm", "swarm.db"));
1039
- }
1040
- function checkpointWalBestEffort(db) {
1041
- try {
1042
- const row = db.query("PRAGMA wal_checkpoint(TRUNCATE)").get();
1043
- if (row && row.busy === 1) {
1044
- db.run("PRAGMA wal_checkpoint(PASSIVE);");
1045
- }
1046
- } catch {
1047
- try {
1048
- db.run("PRAGMA wal_checkpoint(PASSIVE);");
1049
- } catch {}
1050
- }
1060
+ return existsSync2(projectDbPath(directory));
1051
1061
  }
1052
1062
  function getProjectDb(directory) {
1053
- const key = canonicalProjectKey(directory);
1063
+ mkdirSync2(directory, { recursive: true });
1064
+ const key = canonicalRootKeyFresh(directory);
1065
+ const alias = lexicalAliasKey(directory);
1054
1066
  const existing = _projectDbs.get(key);
1055
- if (existing)
1056
- return existing;
1067
+ if (existing) {
1068
+ bindAlias(existing, key, alias);
1069
+ return existing.db;
1070
+ }
1057
1071
  const swarmDir = join2(key, ".swarm");
1058
1072
  try {
1059
1073
  mkdirSync2(swarmDir, { recursive: true });
@@ -1084,20 +1098,30 @@ function getProjectDb(directory) {
1084
1098
  throw err;
1085
1099
  throw new ProjectDbError("open_failed", `Failed to open .swarm/swarm.db for project ${key}: ${err instanceof Error ? err.message : String(err)}`);
1086
1100
  }
1087
- _projectDbs.set(key, db);
1101
+ const record = {
1102
+ db,
1103
+ primaryAlias: alias,
1104
+ aliases: new Set
1105
+ };
1106
+ _projectDbs.set(key, record);
1107
+ bindAlias(record, key, alias);
1088
1108
  return db;
1089
1109
  }
1090
1110
  function closeProjectDb(directory) {
1091
- const key = canonicalProjectKey(directory);
1092
- const db = _projectDbs.get(key);
1093
- if (db) {
1094
- checkpointWalBestEffort(db);
1095
- try {
1096
- db.close();
1097
- } finally {
1098
- _projectDbs.delete(key);
1099
- }
1111
+ const alias = lexicalAliasKey(directory);
1112
+ const currentPath = canonicalExistingFilesystemPath(directory);
1113
+ if (currentPath !== null) {
1114
+ const currentKey = canonicalRootKeyFresh(directory);
1115
+ const currentRecord = _projectDbs.get(currentKey);
1116
+ if (currentRecord)
1117
+ closeRecord(currentKey, currentRecord);
1118
+ return;
1119
+ }
1120
+ const previousKey = _projectDbAliases.get(alias);
1121
+ const previousRecord = previousKey === undefined ? undefined : _projectDbs.get(previousKey);
1122
+ if (previousKey !== undefined && previousRecord) {
1123
+ closeRecord(previousKey, previousRecord);
1100
1124
  }
1101
1125
  }
1102
1126
 
1103
- export { DURABILITY_CLASSES, batchDurabilityClass, applySynchronousForClass, withDurabilityClass, canonicalProjectKey, DbWriteError, classifyDbWriteError, projectDbPath, projectDbExists, getProjectDb, closeProjectDb, detectSpeckit, resolveSpeckitProjection, loadSddStatusSync, buildOpenSpecProjectionSync, readEffectiveSpecSync, writeProjectedSpecSync, validateSpeckit };
1127
+ export { DURABILITY_CLASSES, batchDurabilityClass, applySynchronousForClass, withDurabilityClass, DbWriteError, classifyDbWriteError, projectDbPath, projectDbExists, getProjectDb, closeProjectDb, detectSpeckit, resolveSpeckitProjection, loadSddStatusSync, buildOpenSpecProjectionSync, readEffectiveSpecSync, writeProjectedSpecSync, validateSpeckit };
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  SWARM_WORKTREE_DIR_NAME,
15
15
  init_constants
16
- } from "./index-m1nrd3yd.js";
16
+ } from "./index-8psybzzf.js";
17
17
  import {
18
18
  log
19
19
  } from "./index-zgwm4ryv.js";
@@ -92,7 +92,7 @@ var _internals = {
92
92
  symlinkSync: fs.symlinkSync
93
93
  },
94
94
  writeScopeToDisk: async (directory, taskId, files) => {
95
- const { writeScopeToDisk: realWrite } = await import("./scope-persistence-mbwt4grd.js");
95
+ const { writeScopeToDisk: realWrite } = await import("./scope-persistence-zfmz4sws.js");
96
96
  return realWrite(directory, taskId, files);
97
97
  },
98
98
  writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
@@ -6,7 +6,7 @@ import {
6
6
  PluginConfigSchema,
7
7
  init_schema,
8
8
  resolveExternalSkillsConfig
9
- } from "./index-yrsag0vs.js";
9
+ } from "./index-8ck1jkhd.js";
10
10
  import {
11
11
  GIT_BINARY_ENV_VAR,
12
12
  init_git_executable