opencode-swarm 7.181.1 → 7.181.3

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 (99) hide show
  1. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  2. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  3. package/dist/background/stage-b-gates.d.ts +4 -0
  4. package/dist/cli/{coder-settlement-ee8bmg83.js → coder-settlement-txte2m87.js} +11 -11
  5. package/dist/cli/{config-doctor-mnmxzg86.js → config-doctor-101n3c1r.js} +3 -3
  6. package/dist/cli/{core-m9yymv84.js → core-s0yzzpaj.js} +3 -3
  7. package/dist/cli/{curation-policy-m3x9mkj9.js → curation-policy-r4dkajw9.js} +4 -4
  8. package/dist/cli/{curator-7nmwpcxy.js → curator-dp49fr0p.js} +38 -38
  9. package/dist/cli/curator-drift-r7w3cg3m.js +37 -0
  10. package/dist/cli/curator-llm-factory-tycc9xkw.js +74 -0
  11. package/dist/cli/{evidence-summary-service-m2b0mxmr.js → evidence-summary-service-r648x5f2.js} +17 -17
  12. package/dist/cli/{gate-evidence-4y2x85g4.js → gate-evidence-8rh69tsh.js} +6 -6
  13. package/dist/cli/guardrail-explain-dfyj1g1c.js +75 -0
  14. package/dist/cli/{guardrail-log-202rfw7b.js → guardrail-log-yr60w7h6.js} +7 -7
  15. package/dist/cli/{guardrail-reset-7nt7z18b.js → guardrail-reset-eztc62va.js} +38 -38
  16. package/dist/cli/{hive-promoter-segsykns.js → hive-promoter-g56ba4a4.js} +38 -38
  17. package/dist/cli/{index-m65tnv4j.js → index-01r2wrwa.js} +1 -1
  18. package/dist/cli/{index-hxe22tx3.js → index-1ks0rnzn.js} +5 -5
  19. package/dist/cli/{index-ztph1v9m.js → index-1w1xrk5k.js} +1 -1
  20. package/dist/cli/{index-12ewkms0.js → index-23mdeh2a.js} +1 -1
  21. package/dist/cli/{index-a7z6jygf.js → index-2pt5g7zz.js} +3 -3
  22. package/dist/cli/{index-y4zjbrqs.js → index-2t21pv2v.js} +1 -1
  23. package/dist/cli/{index-38cfx8g8.js → index-427x3j6p.js} +2 -2
  24. package/dist/cli/{index-tczqm089.js → index-4ffryqb1.js} +1 -1
  25. package/dist/cli/{index-pee6ykkg.js → index-4jvt3r77.js} +5 -5
  26. package/dist/cli/{index-908yea8v.js → index-6ep83w7x.js} +1 -1
  27. package/dist/cli/{index-r6p6x0pb.js → index-789tdsfv.js} +4 -4
  28. package/dist/cli/{index-yhx94xpr.js → index-7s6ct0t2.js} +6 -6
  29. package/dist/cli/{index-9j5jjqks.js → index-8c37kzh6.js} +7 -7
  30. package/dist/cli/{index-gc6h1fmf.js → index-a2hvmc3a.js} +1 -1
  31. package/dist/cli/{index-ea9fk6v0.js → index-ap6hs8fj.js} +1 -1
  32. package/dist/cli/{index-92m05mew.js → index-by9wfeja.js} +1 -1
  33. package/dist/cli/{index-kjstkfgh.js → index-ckrm4784.js} +7 -7
  34. package/dist/cli/{index-rxs0rrv1.js → index-dy9mxh0z.js} +40 -40
  35. package/dist/cli/{index-b2zbak7v.js → index-ekwe81my.js} +2 -2
  36. package/dist/cli/{index-3qhx9dx0.js → index-h6gxh3an.js} +4946 -1965
  37. package/dist/cli/{index-basp4sxt.js → index-hcaspktr.js} +1 -1
  38. package/dist/cli/{index-bdpgfep1.js → index-jrxrjz89.js} +1 -1
  39. package/dist/cli/{index-q1prchye.js → index-k5rqe97g.js} +27 -13
  40. package/dist/cli/{index-4h54k8h3.js → index-kexzhwbq.js} +2 -2
  41. package/dist/cli/{index-516j9vsk.js → index-kkrbybgt.js} +27 -2
  42. package/dist/cli/{index-cyyvc1cd.js → index-m4e3p8na.js} +2 -2
  43. package/dist/cli/{index-jqjdejqe.js → index-mdqp0cq2.js} +4 -4
  44. package/dist/cli/{index-6mwha20t.js → index-mkpdcbye.js} +3 -3
  45. package/dist/cli/{index-y30y1rkg.js → index-nw3z614g.js} +6 -6
  46. package/dist/cli/{index-nhxykfyy.js → index-nw8pfcw1.js} +270 -10
  47. package/dist/cli/{index-na3br902.js → index-qdz43cne.js} +38 -38
  48. package/dist/cli/{index-g9ax7jyf.js → index-rchygh27.js} +57 -4
  49. package/dist/cli/{index-6gcxgx84.js → index-s34y6gbh.js} +1 -1
  50. package/dist/cli/{index-s0zgz4p1.js → index-sf51gh68.js} +1 -1
  51. package/dist/cli/{index-gydvqmtg.js → index-sr9k8sh7.js} +4 -4
  52. package/dist/cli/{index-edb3sgxg.js → index-ttgex8ky.js} +6 -6
  53. package/dist/cli/{index-91dhg3wr.js → index-ved1325w.js} +2 -2
  54. package/dist/cli/{index-rw0wy2y7.js → index-vgjmahnd.js} +3 -3
  55. package/dist/cli/{index-bv4b8tpa.js → index-vvgpgcyn.js} +10 -0
  56. package/dist/cli/{index-vmthakz0.js → index-w1ydvzef.js} +1 -1
  57. package/dist/cli/{index-gqe4sm73.js → index-xqr076aq.js} +4 -4
  58. package/dist/cli/{index-g5wjasjn.js → index-yv0q0hp9.js} +140 -9
  59. package/dist/cli/{index-vs83acgx.js → index-yzapt508.js} +3 -3
  60. package/dist/cli/index.js +39 -39
  61. package/dist/cli/{knowledge-escalator-r9chkas8.js → knowledge-escalator-0rcft6q4.js} +12 -12
  62. package/dist/cli/{knowledge-events-5j2n6age.js → knowledge-events-7jyz3qxs.js} +10 -10
  63. package/dist/cli/{knowledge-link-s2qs178z.js → knowledge-link-655xa3db.js} +3 -3
  64. package/dist/cli/{knowledge-store-mybx9bmx.js → knowledge-store-asa26g6p.js} +4 -4
  65. package/dist/cli/{knowledge-validator-v1sj9tv4.js → knowledge-validator-j3x9ezej.js} +6 -6
  66. package/dist/cli/{mcp-7yx5230p.js → mcp-70hefjk6.js} +1 -1
  67. package/dist/cli/model-preflight-szekh1dc.js +359 -0
  68. package/dist/cli/{pending-delegations-amjfmc7t.js → pending-delegations-rb6bhv5x.js} +10 -10
  69. package/dist/cli/{pr-subscriptions-rctqs0gk.js → pr-subscriptions-v4ms5pfb.js} +10 -10
  70. package/dist/cli/{pr-workflow-gate-9he8ys4e.js → pr-workflow-gate-qmfpz6wb.js} +38 -38
  71. package/dist/cli/{runner-tzgwvvn1.js → runner-b5vt1any.js} +4 -4
  72. package/dist/cli/{scan-cursor-pxqkphrh.js → scan-cursor-7zn4t1hw.js} +5 -5
  73. package/dist/cli/{schema-n8pk3f80.js → schema-tx62mfy8.js} +2 -2
  74. package/dist/cli/{scope-persistence-p992x2yd.js → scope-persistence-f8w12sns.js} +14 -14
  75. package/dist/cli/{server-ywrd2q6z.js → server-f2vrp2wc.js} +73 -603
  76. package/dist/cli/{skill-generator-cdppktqx.js → skill-generator-jme09w7n.js} +14 -14
  77. package/dist/cli/{snapshot-coordination-init-z42ev5g9.js → snapshot-coordination-init-ad83sq6c.js} +38 -38
  78. package/dist/cli/{speckit-checkoff-6ynv46bn.js → speckit-checkoff-98gfvn3r.js} +4 -4
  79. package/dist/cli/{telemetry-zhcgfe70.js → telemetry-6k8t2mrw.js} +1 -1
  80. package/dist/cli/{workspace-snapshot-4m2ex1ey.js → workspace-snapshot-hsssm50w.js} +2 -2
  81. package/dist/cli/{worktree-collision-ownership-65971p3m.js → worktree-collision-ownership-47kdjtqb.js} +11 -11
  82. package/dist/cli/{worktree-isolation-xf7dfc46.js → worktree-isolation-etaawcnt.js} +38 -38
  83. package/dist/commands/registry.d.ts +1 -1
  84. package/dist/config/agent-model.d.ts +14 -0
  85. package/dist/config/bundled-skill-dispositions.d.ts +29 -0
  86. package/dist/db/qa-gate-profile.d.ts +6 -3
  87. package/dist/db/qa-gate-session-override.d.ts +72 -0
  88. package/dist/index.js +404 -390
  89. package/dist/memory/index.d.ts +1 -0
  90. package/dist/memory/instruction-pairing.d.ts +112 -0
  91. package/dist/services/model-preflight.d.ts +103 -21
  92. package/dist/session/restart-reconciliation.d.ts +74 -0
  93. package/dist/state.d.ts +6 -3
  94. package/dist/tools/get-qa-gate-profile.d.ts +13 -6
  95. package/package.json +1 -1
  96. package/dist/cli/curator-drift-q42fr0c9.js +0 -297
  97. package/dist/cli/curator-llm-factory-s1b2p162.js +0 -74
  98. package/dist/cli/guardrail-explain-nvmf3y7j.js +0 -75
  99. package/dist/cli/model-preflight-ckvv1arg.js +0 -170
@@ -9,7 +9,6 @@ import {
9
9
  } from "./index-ykamkw55.js";
10
10
  import {
11
11
  MAX_PARALLEL_VERDICT_TASKS,
12
- buildSynonymIndex,
13
12
  classifyCommand,
14
13
  computeParallelVerdict,
15
14
  computeQualityBudget,
@@ -18,35 +17,34 @@ import {
18
17
  createSwarmTool,
19
18
  detectPosixWrites,
20
19
  detectWindowsWrites,
21
- expandTokens,
22
20
  getAgentSession,
23
21
  getCoChangePairs,
24
- readSynonymMap,
25
22
  redactSecrets,
26
23
  resolveWriteTargets,
24
+ searchKnowledge,
27
25
  symbols
28
- } from "./index-3qhx9dx0.js";
26
+ } from "./index-h6gxh3an.js";
29
27
  import {
30
28
  checkFileAuthority,
31
29
  checkWriteTargetForSymlink
32
- } from "./index-jqjdejqe.js";
30
+ } from "./index-mdqp0cq2.js";
33
31
  import {
34
32
  getProfileForFile
35
33
  } from "./index-hamqvzqn.js";
36
34
  import {
37
35
  pLimit
38
- } from "./index-m65tnv4j.js";
39
- import"./index-nhxykfyy.js";
40
- import"./index-b2zbak7v.js";
36
+ } from "./index-01r2wrwa.js";
37
+ import"./index-nw8pfcw1.js";
38
+ import"./index-ekwe81my.js";
41
39
  import {
42
40
  _internals,
43
41
  loadPlan,
44
42
  loadPlanJsonOnly,
45
43
  saveEvidence
46
- } from "./index-q1prchye.js";
47
- import"./index-s0zgz4p1.js";
44
+ } from "./index-k5rqe97g.js";
45
+ import"./index-sf51gh68.js";
48
46
  import"./index-txdagbh7.js";
49
- import"./index-tczqm089.js";
47
+ import"./index-4ffryqb1.js";
50
48
  import {
51
49
  containsControlChars,
52
50
  createTargetWithinRootValidator,
@@ -55,81 +53,69 @@ import {
55
53
  validateTargetWithinRoot,
56
54
  validateWorkspaceRoot
57
55
  } from "./index-6b295cas.js";
58
- import"./index-vs83acgx.js";
59
- import"./index-hxe22tx3.js";
56
+ import"./index-yzapt508.js";
57
+ import"./index-1ks0rnzn.js";
60
58
  import {
61
59
  resolveCohortId
62
- } from "./index-cyyvc1cd.js";
60
+ } from "./index-m4e3p8na.js";
63
61
  import"./index-rdec0y3z.js";
64
- import"./index-y30y1rkg.js";
62
+ import"./index-nw3z614g.js";
65
63
  import"./index-cjapb4hy.js";
66
64
  import"./index-zsrtt42s.js";
67
- import"./index-kjstkfgh.js";
68
- import"./index-bdpgfep1.js";
69
- import"./index-92m05mew.js";
65
+ import"./index-ckrm4784.js";
66
+ import"./index-jrxrjz89.js";
67
+ import"./index-by9wfeja.js";
70
68
  import {
71
69
  getLanguageForExtension,
72
70
  getParserForFile
73
71
  } from "./index-pt7h91zc.js";
74
72
  import"./index-q7sjgr1y.js";
75
- import"./index-908yea8v.js";
76
- import"./index-r6p6x0pb.js";
77
- import"./index-a7z6jygf.js";
78
- import"./index-9j5jjqks.js";
79
- import {
80
- effectiveRetrievalOutcomes,
81
- newTraceId,
82
- readAuthoritativeKnowledgeCounterRollups,
83
- recordKnowledgeEvent
84
- } from "./index-g5wjasjn.js";
85
- import"./index-gc6h1fmf.js";
73
+ import"./index-6ep83w7x.js";
74
+ import"./index-789tdsfv.js";
75
+ import"./index-2pt5g7zz.js";
76
+ import"./index-8c37kzh6.js";
77
+ import"./index-yv0q0hp9.js";
78
+ import"./index-a2hvmc3a.js";
86
79
  import"./index-2s7dvzff.js";
87
80
  import {
88
81
  appendUnactionable,
89
82
  validateActionability,
90
83
  validateActionableFields,
91
84
  validateLesson
92
- } from "./index-gqe4sm73.js";
85
+ } from "./index-xqr076aq.js";
93
86
  import {
94
87
  resolveWorktreeId
95
- } from "./index-6gcxgx84.js";
88
+ } from "./index-s34y6gbh.js";
96
89
  import"./index-rtry5xyf.js";
97
- import"./index-rw0wy2y7.js";
90
+ import"./index-vgjmahnd.js";
98
91
  import"./index-frcemc0b.js";
99
92
  import"./index-0725jpp7.js";
100
93
  import {
101
94
  normalizeScopeFiles
102
- } from "./index-pee6ykkg.js";
103
- import"./index-edb3sgxg.js";
104
- import"./index-38cfx8g8.js";
105
- import"./index-91dhg3wr.js";
106
- import"./index-vmthakz0.js";
107
- import"./index-bv4b8tpa.js";
95
+ } from "./index-4jvt3r77.js";
96
+ import"./index-ttgex8ky.js";
97
+ import"./index-427x3j6p.js";
98
+ import"./index-ved1325w.js";
99
+ import"./index-w1ydvzef.js";
100
+ import"./index-vvgpgcyn.js";
108
101
  import"./index-rdm3px0g.js";
109
102
  import"./index-ry16d01s.js";
110
- import"./index-516j9vsk.js";
103
+ import"./index-kkrbybgt.js";
111
104
  import {
112
105
  computeContentHash,
113
- computeOutcomeSignal,
114
106
  dedupeCapped,
115
107
  findActiveSwarmNearDuplicate,
116
108
  findNearDuplicate,
117
109
  inferTags,
118
- jaccardBigram,
119
- normalize,
120
- readKnowledge,
121
- readRetractionRecords,
122
110
  reinforceSwarmKnowledgeEntry,
123
- resolveHiveKnowledgePath,
124
111
  resolveSwarmKnowledgePath,
125
- transactKnowledge,
126
- wordBigrams
127
- } from "./index-yhx94xpr.js";
112
+ transactKnowledge
113
+ } from "./index-7s6ct0t2.js";
128
114
  import"./index-vzm6zre7.js";
129
115
  import"./index-ae75rja9.js";
130
- import"./index-12ewkms0.js";
131
- import"./index-ea9fk6v0.js";
132
- import"./index-6mwha20t.js";
116
+ import"./index-23mdeh2a.js";
117
+ import"./index-ap6hs8fj.js";
118
+ import"./index-mkpdcbye.js";
133
119
  import {
134
120
  canonicalRootKeyFresh
135
121
  } from "./index-1xnse449.js";
@@ -148,24 +134,22 @@ import"./index-gx2vp8gx.js";
148
134
  import {
149
135
  loadGateOverrides,
150
136
  loadPluginConfigWithMeta
151
- } from "./index-basp4sxt.js";
137
+ } from "./index-hcaspktr.js";
152
138
  import {
153
139
  init_git_executable,
154
140
  resolveGitExecutableAsync
155
141
  } from "./index-zxdawwc7.js";
156
142
  import {
157
143
  KnowledgeConfigSchema,
158
- init_schema,
159
- stripKnownSwarmPrefix
160
- } from "./index-g9ax7jyf.js";
144
+ init_schema
145
+ } from "./index-rchygh27.js";
161
146
  import {
162
147
  TOOL_METADATA,
163
148
  init_tool_metadata
164
- } from "./index-y4zjbrqs.js";
149
+ } from "./index-2t21pv2v.js";
165
150
  import {
166
151
  KNOWLEDGE_SCHEMA_VERSION,
167
- init_knowledge_types,
168
- isActiveStatus
152
+ init_knowledge_types
169
153
  } from "./index-bk5tah7q.js";
170
154
  import {
171
155
  $ZodObject,
@@ -213,10 +197,7 @@ import {
213
197
  normalizePathIdentity,
214
198
  unsafePathTextReason
215
199
  } from "./index-9rwhas09.js";
216
- import {
217
- init_logger,
218
- warn
219
- } from "./index-zgwm4ryv.js";
200
+ import"./index-zgwm4ryv.js";
220
201
  import {
221
202
  __commonJS,
222
203
  __require,
@@ -2370,8 +2351,8 @@ var require_resolve = __commonJS((exports) => {
2370
2351
  }
2371
2352
  return count;
2372
2353
  }
2373
- function getFullPath(resolver, id = "", normalize2) {
2374
- if (normalize2 !== false)
2354
+ function getFullPath(resolver, id = "", normalize) {
2355
+ if (normalize !== false)
2375
2356
  id = normalizeId(id);
2376
2357
  const p = resolver.parse(id);
2377
2358
  return _getFullPath(resolver, p);
@@ -3930,7 +3911,7 @@ var require_fast_uri = __commonJS((exports, module) => {
3930
3911
  }
3931
3912
  return decodedScheme;
3932
3913
  }
3933
- function normalize2(uri, options) {
3914
+ function normalize(uri, options) {
3934
3915
  if (typeof uri === "string") {
3935
3916
  uri = normalizeString(uri, options);
3936
3917
  } else if (typeof uri === "object") {
@@ -4307,7 +4288,7 @@ var require_fast_uri = __commonJS((exports, module) => {
4307
4288
  }
4308
4289
  var fastUri = {
4309
4290
  SCHEMES,
4310
- normalize: normalize2,
4291
+ normalize,
4311
4292
  resolve,
4312
4293
  resolveComponent,
4313
4294
  equal,
@@ -7110,7 +7091,7 @@ var require_dist = __commonJS((exports, module) => {
7110
7091
  });
7111
7092
 
7112
7093
  // src/mcp/server.ts
7113
- import path9 from "path";
7094
+ import path8 from "path";
7114
7095
 
7115
7096
  // node_modules/zod/v3/helpers/util.js
7116
7097
  var util;
@@ -17902,520 +17883,9 @@ var knowledgeAddAdapter = {
17902
17883
 
17903
17884
  // src/mcp/adapters/knowledge-memory.ts
17904
17885
  init_zod();
17905
- import { existsSync as existsSync4 } from "fs";
17906
- import path6 from "path";
17907
- init_schema();
17908
-
17909
- // src/hooks/search-knowledge.ts
17910
- init_schema();
17911
- import { existsSync as existsSync3, statSync as statSync4 } from "fs";
17886
+ import { existsSync as existsSync3 } from "fs";
17912
17887
  import path5 from "path";
17913
- init_logger();
17914
-
17915
- // src/hooks/knowledge-reader.ts
17916
- init_logger();
17917
- init_knowledge_types();
17918
- var JACCARD_THRESHOLD = 0.6;
17919
- var HIVE_TIER_BOOST = 0.05;
17920
- var DEFAULT_SAME_PROJECT_PENALTY = -0.05;
17921
- function inferCategoriesFromPhase(phaseDescription) {
17922
- const lower = phaseDescription.toLowerCase();
17923
- const patterns = [
17924
- {
17925
- pattern: /\b(?:test|qa|quality|verification|validation)\b/,
17926
- categories: ["testing", "debugging"]
17927
- },
17928
- {
17929
- pattern: /\b(?:implement|build|develop|coding|code)\b/,
17930
- categories: ["tooling", "architecture", "debugging"]
17931
- },
17932
- {
17933
- pattern: /\b(?:integrat|deploy|ci|cd|release|publish)\b/,
17934
- categories: ["integration", "tooling", "performance"]
17935
- },
17936
- {
17937
- pattern: /\b(?:plan|design|architect|spec|requirement)\b/,
17938
- categories: ["architecture", "process"]
17939
- },
17940
- {
17941
- pattern: /\b(?:review|refactor|cleanup|polish|optimi)\b/,
17942
- categories: ["performance", "architecture", "process"]
17943
- },
17944
- {
17945
- pattern: /\b(?:secur|audit|harden|compliance)\b/,
17946
- categories: ["security", "testing"]
17947
- },
17948
- {
17949
- pattern: /\b(?:setup|config|scaffold|init|bootstrap)\b/,
17950
- categories: ["tooling", "other"]
17951
- },
17952
- {
17953
- pattern: /\b(?:doc|readme|changelog)\b/,
17954
- categories: ["process", "tooling"]
17955
- }
17956
- ];
17957
- for (const { pattern, categories } of patterns) {
17958
- if (pattern.test(lower)) {
17959
- return categories;
17960
- }
17961
- }
17962
- return ["process", "tooling"];
17963
- }
17964
- async function readMergedKnowledge(directory, config, context, opts) {
17965
- const swarmPath = resolveSwarmKnowledgePath(directory);
17966
- const swarmEntries = await readKnowledge(swarmPath);
17967
- let hiveEntries = [];
17968
- if (config.hive_enabled !== false) {
17969
- const hivePath = resolveHiveKnowledgePath();
17970
- hiveEntries = await readKnowledge(hivePath);
17971
- }
17972
- const seenLessons = new Set;
17973
- const merged = [];
17974
- for (const entry of hiveEntries) {
17975
- const normalized = normalize(entry.lesson);
17976
- seenLessons.add(normalized);
17977
- merged.push({
17978
- ...entry,
17979
- relevanceScore: { category: 0, confidence: 0, keywords: 0 },
17980
- finalScore: 0
17981
- });
17982
- }
17983
- for (const entry of swarmEntries) {
17984
- const normalized = normalize(entry.lesson);
17985
- if (seenLessons.has(normalized)) {
17986
- continue;
17987
- }
17988
- const swarmBigrams = wordBigrams(normalized);
17989
- const isHiveNearDup = hiveEntries.some((hiveEntry) => jaccardBigram(swarmBigrams, wordBigrams(normalize(hiveEntry.lesson))) >= JACCARD_THRESHOLD);
17990
- if (isHiveNearDup)
17991
- continue;
17992
- const isSwarmNearDup = merged.some((m) => m.tier === "swarm" && jaccardBigram(swarmBigrams, wordBigrams(normalize(m.lesson))) >= JACCARD_THRESHOLD);
17993
- if (isSwarmNearDup)
17994
- continue;
17995
- seenLessons.add(normalized);
17996
- merged.push({
17997
- ...entry,
17998
- relevanceScore: { category: 0, confidence: 0, keywords: 0 },
17999
- finalScore: 0
18000
- });
18001
- }
18002
- const retractionRecords = await readRetractionRecords(directory);
18003
- const suppressedLessons = new Set(retractionRecords.map((record3) => record3.normalized_lesson).filter((value) => typeof value === "string" && value.length > 0));
18004
- const scopeFilter = config.scope_filter ?? ["global"];
18005
- const filtered = merged.filter((entry) => (opts?.skipScopeFilter || scopeFilter.some((pattern) => (entry.scope ?? "global") === pattern)) && isActiveStatus(entry.status) && !suppressedLessons.has(normalize(entry.lesson)));
18006
- const ranked = filtered.map((entry) => {
18007
- let categoryScore = 0;
18008
- if (context?.currentPhase) {
18009
- const phaseCategories = inferCategoriesFromPhase(context.currentPhase);
18010
- if (phaseCategories.includes(entry.category)) {
18011
- categoryScore = 1;
18012
- } else if (entry.category === "process") {
18013
- categoryScore = 0.5;
18014
- }
18015
- } else {
18016
- categoryScore = 0.5;
18017
- }
18018
- const confidenceScore = entry.confidence;
18019
- let keywordsScore = 0;
18020
- if (context?.techStack && entry.tags.length > 0) {
18021
- const matchingTags = entry.tags.filter((t) => context.techStack.some((s) => t.toLowerCase().includes(s.toLowerCase()) || s.toLowerCase().includes(t.toLowerCase()))).length;
18022
- keywordsScore = Math.min(matchingTags / Math.max(entry.tags.length, 1), 1);
18023
- } else if (entry.tags.length === 0) {
18024
- keywordsScore = 0.5;
18025
- }
18026
- let tierBoost = 0;
18027
- let isSameProject = false;
18028
- if (entry.tier === "hive" && "source_project" in entry) {
18029
- const sourceProject = entry.source_project;
18030
- isSameProject = !!(context?.projectName && sourceProject === context.projectName);
18031
- tierBoost = HIVE_TIER_BOOST;
18032
- }
18033
- const sameProjectPenalty = isSameProject ? DEFAULT_SAME_PROJECT_PENALTY : 0;
18034
- const finalScore = categoryScore * 0.4 + confidenceScore * 0.35 + keywordsScore * 0.25 + tierBoost + sameProjectPenalty;
18035
- const relevanceScore = {
18036
- category: categoryScore,
18037
- confidence: confidenceScore,
18038
- keywords: keywordsScore
18039
- };
18040
- return {
18041
- ...entry,
18042
- relevanceScore,
18043
- finalScore: Math.min(Math.max(finalScore, 0), 1)
18044
- };
18045
- });
18046
- ranked.sort((a, b) => {
18047
- const scoreDiff = b.finalScore - a.finalScore;
18048
- if (Math.abs(scoreDiff) > 0.001)
18049
- return scoreDiff;
18050
- const dateA = new Date(a.created_at).getTime();
18051
- const dateB = new Date(b.created_at).getTime();
18052
- return dateB - dateA;
18053
- });
18054
- const maxInject = config.max_inject_count ?? 5;
18055
- const topN = ranked.slice(0, maxInject);
18056
- return topN;
18057
- }
18058
- function lc(s) {
18059
- return (s ?? "").toLowerCase();
18060
- }
18061
- function anyMatch(haystack, needles) {
18062
- if (needles.length === 0)
18063
- return false;
18064
- const hay = haystack.map(lc);
18065
- return needles.some((n) => hay.some((h) => h.includes(lc(n))));
18066
- }
18067
- function tokenizeContext(ctx) {
18068
- const parts = [];
18069
- if (ctx.taskTitle)
18070
- parts.push(ctx.taskTitle);
18071
- if (ctx.taskDescription)
18072
- parts.push(ctx.taskDescription);
18073
- if (ctx.lastUserMessage)
18074
- parts.push(ctx.lastUserMessage);
18075
- if (ctx.currentAction)
18076
- parts.push(ctx.currentAction);
18077
- if (ctx.currentTool)
18078
- parts.push(ctx.currentTool);
18079
- if (ctx.targetAgent)
18080
- parts.push(ctx.targetAgent);
18081
- if (ctx.declaredScope)
18082
- parts.push(ctx.declaredScope);
18083
- if (ctx.recentReviewerFailures)
18084
- parts.push(...ctx.recentReviewerFailures);
18085
- if (ctx.recentTestFailures)
18086
- parts.push(...ctx.recentTestFailures);
18087
- if (ctx.recentToolErrors)
18088
- parts.push(...ctx.recentToolErrors);
18089
- if (ctx.planConstraints)
18090
- parts.push(...ctx.planConstraints);
18091
- if (ctx.filePaths)
18092
- parts.push(...ctx.filePaths);
18093
- return parts.map(lc);
18094
- }
18095
- function scoreDirectiveAgainstContext(entry, ctx) {
18096
- const haystack = tokenizeContext(ctx);
18097
- const triggerHit = entry.triggers && entry.triggers.length > 0 ? anyMatch(haystack, entry.triggers) : false;
18098
- const actionHit = entry.applies_to_tools && entry.applies_to_tools.length > 0 ? entry.applies_to_tools.map(lc).some((t) => t === lc(ctx.currentTool) || t === lc(ctx.currentAction)) : false;
18099
- const agentHit = entry.applies_to_agents && entry.applies_to_agents.length > 0 ? entry.applies_to_agents.map(lc).some((a) => a === lc(ctx.targetAgent)) : false;
18100
- let score = 0;
18101
- if (triggerHit)
18102
- score += 0.5;
18103
- if (actionHit)
18104
- score += 0.35;
18105
- if (agentHit)
18106
- score += 0.25;
18107
- if (entry.directive_priority === "critical")
18108
- score += 0.4;
18109
- else if (entry.directive_priority === "high")
18110
- score += 0.2;
18111
- else if (entry.directive_priority === "medium")
18112
- score += 0.1;
18113
- return { triggerHit, actionHit, agentHit, score: Math.min(1, score) };
18114
- }
18115
-
18116
- // src/hooks/search-knowledge.ts
18117
- init_knowledge_types();
18118
- var TEXT_WEIGHT = 0.6;
18119
- var META_WEIGHT = 0.4;
18120
- var DIRECTIVE_BOOST_MIN_CONFIDENCE = 0.75;
18121
- var SYNONYM_TEXT_BOOST = 0.15;
18122
- var TRIGGER_RECALL_BOOST = 0.3;
18123
- var TRIGGER_RECALL_MIN_LEN = 3;
18124
- var DEFAULT_COLD_START_BONUS = 0.08;
18125
- var DEFAULT_COLD_START_MAX_AGE_PHASES = 3;
18126
- var OUTCOME_RANK_WEIGHT = 0.1;
18127
- function entryText(e) {
18128
- return `${e.lesson} ${e.tags.join(" ")} ${e.category}`;
18129
- }
18130
- function entryAgePhases(e) {
18131
- const cb = e.confirmed_by;
18132
- if (!Array.isArray(cb) || cb.length === 0)
18133
- return 0;
18134
- const phases = new Set;
18135
- for (const c of cb) {
18136
- if (typeof c?.phase_number === "number")
18137
- phases.add(c.phase_number);
18138
- }
18139
- return phases.size > 0 ? phases.size : cb.length;
18140
- }
18141
- function clampLambda(v) {
18142
- if (typeof v !== "number" || Number.isNaN(v))
18143
- return 0.5;
18144
- return Math.min(1, Math.max(0, v));
18145
- }
18146
- function mmrRerank(pool, pinned, max, lambda) {
18147
- if (pool.length === 0)
18148
- return [];
18149
- const bigrams = new Map;
18150
- const bg = (e) => {
18151
- let s = bigrams.get(e.id);
18152
- if (!s) {
18153
- s = wordBigrams(normalize(e.lesson ?? ""));
18154
- bigrams.set(e.id, s);
18155
- }
18156
- return s;
18157
- };
18158
- const selected = [...pinned];
18159
- const candidates = [...pool];
18160
- const out = [];
18161
- while (selected.length < max && candidates.length > 0) {
18162
- let bestIdx = -1;
18163
- let bestScore = Number.NEGATIVE_INFINITY;
18164
- let best = null;
18165
- for (let i = 0;i < candidates.length; i++) {
18166
- const c = candidates[i];
18167
- let maxSim = 0;
18168
- for (const s of selected) {
18169
- const sim = jaccardBigram(bg(c), bg(s));
18170
- if (sim > maxSim)
18171
- maxSim = sim;
18172
- }
18173
- const score = lambda * c.finalScore - (1 - lambda) * maxSim;
18174
- if (score > bestScore + 0.000000001 || Math.abs(score - bestScore) <= 0.000000001 && best !== null && tieBreak(c, best) < 0) {
18175
- bestScore = score;
18176
- bestIdx = i;
18177
- best = c;
18178
- }
18179
- }
18180
- if (bestIdx < 0 || best === null)
18181
- break;
18182
- out.push(best);
18183
- selected.push(best);
18184
- candidates.splice(bestIdx, 1);
18185
- }
18186
- return out;
18187
- }
18188
- function tieBreak(a, b) {
18189
- if (Math.abs(a.finalScore - b.finalScore) > 0.000000001)
18190
- return b.finalScore - a.finalScore;
18191
- const at = new Date(a.created_at).getTime();
18192
- const bt = new Date(b.created_at).getTime();
18193
- if (at !== bt)
18194
- return bt - at;
18195
- return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
18196
- }
18197
- function statusBoost(status) {
18198
- if (status === "promoted")
18199
- return 0.15;
18200
- if (status === "established")
18201
- return 0.1;
18202
- return 0;
18203
- }
18204
- async function searchKnowledge(params) {
18205
- const {
18206
- directory,
18207
- config,
18208
- query,
18209
- context,
18210
- mode,
18211
- agent = "unknown",
18212
- sessionId = "unknown",
18213
- tier = "all",
18214
- emitEvent = false,
18215
- applyScopeFilter = true,
18216
- forceReadHive = false,
18217
- applyRoleScope = true,
18218
- skipLedgerGenesis = false
18219
- } = params;
18220
- const traceId = newTraceId();
18221
- const max = params.maxResults ?? config.max_inject_count ?? 5;
18222
- let results = [];
18223
- let synonymTokens = [];
18224
- const synonymTrace = {};
18225
- try {
18226
- const mergeConfig = {
18227
- ...config,
18228
- hive_enabled: tier === "swarm" ? false : forceReadHive ? true : config.hive_enabled,
18229
- max_inject_count: Math.max(20, max)
18230
- };
18231
- const projected = {
18232
- projectName: context?.projectName ?? "unknown",
18233
- currentPhase: context?.currentPhase ?? "",
18234
- techStack: context?.techStack,
18235
- recentErrors: [
18236
- ...context?.recentReviewerFailures ?? [],
18237
- ...context?.recentTestFailures ?? [],
18238
- ...context?.recentToolErrors ?? []
18239
- ]
18240
- };
18241
- let candidates = await readMergedKnowledge(directory, mergeConfig, projected, {
18242
- skipScopeFilter: !applyScopeFilter
18243
- });
18244
- const journalPath2 = path5.join(directory, ".swarm", "knowledge-receipts-v2.jsonl");
18245
- const journalReadable = existsSync3(journalPath2) && statSync4(journalPath2).size > 0;
18246
- const counterRollups = skipLedgerGenesis && !journalReadable ? new Map : await readAuthoritativeKnowledgeCounterRollups(directory);
18247
- candidates = candidates.filter((e) => {
18248
- if (!isActiveStatus(e.status))
18249
- return false;
18250
- if (tier === "hive" && e.tier !== "hive")
18251
- return false;
18252
- return true;
18253
- });
18254
- const role = stripKnownSwarmPrefix(agent).toLowerCase();
18255
- if (applyRoleScope && role && role !== "unknown") {
18256
- candidates = candidates.filter((e) => {
18257
- if (!e.applies_to_agents || e.applies_to_agents.length === 0)
18258
- return true;
18259
- if (role === "architect")
18260
- return true;
18261
- return e.applies_to_agents.map((a) => stripKnownSwarmPrefix(a).toLowerCase()).includes(role);
18262
- });
18263
- }
18264
- const queryText = (query ?? "").trim();
18265
- const queryBigrams = queryText ? wordBigrams(normalize(queryText)) : null;
18266
- const hasQuery = queryBigrams !== null;
18267
- const textWeight = hasQuery ? TEXT_WEIGHT : 0;
18268
- const metaWeight = hasQuery ? META_WEIGHT : 1;
18269
- const compositeRaw = [
18270
- queryText,
18271
- context?.taskTitle,
18272
- context?.taskDescription,
18273
- context?.lastUserMessage,
18274
- context?.currentAction,
18275
- ...context?.recentReviewerFailures ?? [],
18276
- ...context?.recentTestFailures ?? [],
18277
- ...context?.recentToolErrors ?? []
18278
- ].filter((s) => typeof s === "string" && s.length > 0).join(" ");
18279
- const compositeNorm = normalize(compositeRaw);
18280
- const hasComposite = compositeNorm.length > 0;
18281
- try {
18282
- if (hasComposite) {
18283
- const synMap = await readSynonymMap(directory, config.retrieval?.synonym_map_max_pairs);
18284
- const synIndex = buildSynonymIndex(synMap, config.retrieval?.synonym_min_cooccurrence);
18285
- const baseTokens = compositeNorm.split(" ").filter(Boolean);
18286
- synonymTokens = expandTokens(synIndex, baseTokens);
18287
- }
18288
- } catch {
18289
- synonymTokens = [];
18290
- }
18291
- const minConf = typeof config.directive_min_confidence === "number" ? config.directive_min_confidence : DIRECTIVE_BOOST_MIN_CONFIDENCE;
18292
- const scored = candidates.map((entry) => {
18293
- const retrievalOutcomes = effectiveRetrievalOutcomes(entry.retrieval_outcomes, counterRollups.get(entry.id));
18294
- const textScore = queryBigrams ? jaccardBigram(queryBigrams, wordBigrams(normalize(entryText(entry)))) : 0;
18295
- const metaScore = entry.finalScore;
18296
- const ds = context ? scoreDirectiveAgainstContext(entry, context) : { triggerHit: false, actionHit: false, agentHit: false, score: 0 };
18297
- const confBoost = context && entry.confidence >= minConf && (ds.actionHit || ds.agentHit) ? 0.25 : 0;
18298
- const generatedSkillBoost = entry.generated_skill_path && entry.status !== "archived" ? 0.05 : 0;
18299
- const outcomeBoost = computeOutcomeSignal(retrievalOutcomes) * OUTCOME_RANK_WEIGHT;
18300
- const coldStartBonus = (retrievalOutcomes.applied_explicit_count ?? 0) === 0 && entryAgePhases(entry) < (config.retrieval?.cold_start_max_age_phases ?? DEFAULT_COLD_START_MAX_AGE_PHASES) ? config.retrieval?.cold_start_bonus ?? DEFAULT_COLD_START_BONUS : 0;
18301
- let synonymBoost = 0;
18302
- if (synonymTokens.length > 0) {
18303
- const entryHay = normalize(entryText(entry));
18304
- const matched = [];
18305
- for (const t of synonymTokens) {
18306
- if (t.length > 0 && entryHay.includes(t))
18307
- matched.push(t);
18308
- }
18309
- if (matched.length > 0) {
18310
- synonymBoost = SYNONYM_TEXT_BOOST;
18311
- synonymTrace[entry.id] = matched;
18312
- }
18313
- }
18314
- const triggerRecallHit = !ds.triggerHit && hasComposite && Array.isArray(entry.triggers) && entry.triggers.some((tr) => {
18315
- const n = normalize(tr);
18316
- return n.length >= TRIGGER_RECALL_MIN_LEN && compositeNorm.includes(n);
18317
- });
18318
- const triggerRecallBoost = triggerRecallHit ? TRIGGER_RECALL_BOOST : 0;
18319
- const finalScore = Math.min(1, Math.max(0, textWeight * textScore + metaWeight * metaScore + ds.score + confBoost + generatedSkillBoost + outcomeBoost + coldStartBonus + synonymBoost + triggerRecallBoost + (hasQuery && !entry.confidence_floor_demoted ? statusBoost(entry.status) : 0)));
18320
- const statusScoreBoost = hasQuery && !entry.confidence_floor_demoted ? statusBoost(entry.status) : 0;
18321
- const isCritical = entry.directive_priority === "critical" && (ds.triggerHit || ds.actionHit || ds.agentHit);
18322
- const isForceHive = forceReadHive && entry.tier === "hive";
18323
- return {
18324
- ...entry,
18325
- retrieval_outcomes: retrievalOutcomes,
18326
- finalScore,
18327
- coldStartBoost: coldStartBonus,
18328
- score_breakdown: {
18329
- text_score: textScore,
18330
- metadata_score: metaScore,
18331
- directive_score: ds.score,
18332
- confidence_boost: confBoost,
18333
- generated_skill_boost: generatedSkillBoost,
18334
- outcome_boost: outcomeBoost,
18335
- cold_start_boost: coldStartBonus,
18336
- synonym_boost: synonymBoost,
18337
- trigger_recall_boost: triggerRecallBoost,
18338
- status_boost: statusScoreBoost,
18339
- final_score: finalScore,
18340
- ...synonymTrace[entry.id] ? { synonym_matches: synonymTrace[entry.id] } : {}
18341
- },
18342
- __critical: isCritical,
18343
- __forceHive: isForceHive
18344
- };
18345
- });
18346
- scored.sort((a, b) => {
18347
- const diff = b.finalScore - a.finalScore;
18348
- if (Math.abs(diff) > 0.001)
18349
- return diff;
18350
- return new Date(b.created_at).getTime() - new Date(a.created_at).getTime();
18351
- });
18352
- const top = [];
18353
- const seen = new Set;
18354
- for (const e of scored) {
18355
- if (top.length >= max)
18356
- break;
18357
- if (e.__critical && !seen.has(e.id)) {
18358
- top.push(e);
18359
- seen.add(e.id);
18360
- }
18361
- }
18362
- for (const e of scored) {
18363
- if (top.length >= max)
18364
- break;
18365
- if (e.__forceHive && !seen.has(e.id)) {
18366
- top.push(e);
18367
- seen.add(e.id);
18368
- }
18369
- }
18370
- const lambda = clampLambda(config.retrieval?.mmr_lambda);
18371
- const remaining = scored.filter((e) => !seen.has(e.id));
18372
- const selected = mmrRerank(remaining, top, max, lambda);
18373
- for (const e of selected) {
18374
- if (top.length >= max)
18375
- break;
18376
- if (!seen.has(e.id)) {
18377
- top.push(e);
18378
- seen.add(e.id);
18379
- }
18380
- }
18381
- results = top.map(({ __critical: _c, __forceHive: _f, ...rest }) => rest);
18382
- } catch (err) {
18383
- warn(`[search-knowledge] retrieval failed: ${err instanceof Error ? err.message : String(err)}`);
18384
- results = [];
18385
- }
18386
- if (emitEvent) {
18387
- const ranks = {};
18388
- const scores = {};
18389
- results.forEach((e, idx) => {
18390
- ranks[e.id] = idx + 1;
18391
- scores[e.id] = e.finalScore;
18392
- });
18393
- const synonymBreakdown = {};
18394
- for (const e of results) {
18395
- if (synonymTrace[e.id])
18396
- synonymBreakdown[e.id] = synonymTrace[e.id];
18397
- }
18398
- const scoreBreakdown = synonymTokens.length > 0 ? {
18399
- synonyms_expanded: synonymTokens,
18400
- synonym_matches: synonymBreakdown
18401
- } : undefined;
18402
- await recordKnowledgeEvent(directory, {
18403
- type: "retrieved",
18404
- trace_id: traceId,
18405
- session_id: sessionId,
18406
- phase: context?.currentPhase,
18407
- task_id: context?.taskId,
18408
- agent,
18409
- query: query ?? context?.lastUserMessage ?? context?.currentPhase ?? "",
18410
- retrieval_mode: mode,
18411
- result_ids: results.map((e) => e.id),
18412
- ranks,
18413
- scores,
18414
- ...scoreBreakdown ? { score_breakdown: scoreBreakdown } : {}
18415
- });
18416
- }
18417
- return { trace_id: traceId, results };
18418
- }
17888
+ init_schema();
18419
17889
 
18420
17890
  // src/tools/swarm-memory-recall.ts
18421
17891
  init_zod();
@@ -18524,8 +17994,8 @@ var knowledgeRecallAdapter = {
18524
17994
  inputSchema: knowledgeRecallSchema,
18525
17995
  execute: async (rawArgs, root) => {
18526
17996
  const args = knowledgeRecallSchema.parse(rawArgs);
18527
- const knowledgePath = path6.join(root, ".swarm", "knowledge");
18528
- if (!existsSync4(knowledgePath)) {
17997
+ const knowledgePath = path5.join(root, ".swarm", "knowledge");
17998
+ if (!existsSync3(knowledgePath)) {
18529
17999
  return {
18530
18000
  results: [],
18531
18001
  total: 0,
@@ -18571,8 +18041,8 @@ var swarmMemoryRecallAdapter = {
18571
18041
  message: "Swarm memory is disabled. Set swarm.memory.enabled=true."
18572
18042
  };
18573
18043
  }
18574
- const storeArtifact = (config.memory.provider ?? "sqlite") === "sqlite" ? path6.join(root, ".swarm", "memory", "memory.db") : path6.join(root, ".swarm", "memory", "memories.jsonl");
18575
- if (!existsSync4(storeArtifact)) {
18044
+ const storeArtifact = (config.memory.provider ?? "sqlite") === "sqlite" ? path5.join(root, ".swarm", "memory", "memory.db") : path5.join(root, ".swarm", "memory", "memories.jsonl");
18045
+ if (!existsSync3(storeArtifact)) {
18576
18046
  return {
18577
18047
  available: false,
18578
18048
  reason: "no_store",
@@ -18603,7 +18073,7 @@ init_zod();
18603
18073
  init_zod();
18604
18074
  import * as child_process from "child_process";
18605
18075
  import * as fs4 from "fs";
18606
- import * as path7 from "path";
18076
+ import * as path6 from "path";
18607
18077
 
18608
18078
  // src/diff/summary-generator.ts
18609
18079
  var RISK_LEVELS = ["Critical", "High", "Medium", "Low"];
@@ -18700,20 +18170,20 @@ function validateBase(base) {
18700
18170
  function validatePaths(paths) {
18701
18171
  if (!paths)
18702
18172
  return null;
18703
- for (const path8 of paths) {
18704
- if (!path8 || path8.length === 0) {
18173
+ for (const path7 of paths) {
18174
+ if (!path7 || path7.length === 0) {
18705
18175
  return "empty path not allowed";
18706
18176
  }
18707
- if (path8.length > MAX_PATH_LENGTH) {
18177
+ if (path7.length > MAX_PATH_LENGTH) {
18708
18178
  return `path exceeds maximum length of ${MAX_PATH_LENGTH}`;
18709
18179
  }
18710
- if (SHELL_METACHARACTERS.test(path8)) {
18180
+ if (SHELL_METACHARACTERS.test(path7)) {
18711
18181
  return "path contains shell metacharacters";
18712
18182
  }
18713
- if (path8.startsWith("-")) {
18183
+ if (path7.startsWith("-")) {
18714
18184
  return 'path cannot start with "-" (option-like arguments not allowed)';
18715
18185
  }
18716
- if (CONTROL_CHAR_PATTERN.test(path8)) {
18186
+ if (CONTROL_CHAR_PATTERN.test(path7)) {
18717
18187
  return "path contains control characters";
18718
18188
  }
18719
18189
  }
@@ -18817,8 +18287,8 @@ var diff = createSwarmTool({
18817
18287
  if (parts.length >= 3) {
18818
18288
  const additions = parseInt(parts[0], 10) || 0;
18819
18289
  const deletions = parseInt(parts[1], 10) || 0;
18820
- const path8 = parts[2];
18821
- files.push({ path: path8, additions, deletions });
18290
+ const path7 = parts[2];
18291
+ files.push({ path: path7, additions, deletions });
18822
18292
  }
18823
18293
  }
18824
18294
  if (summaryOnly) {
@@ -18901,7 +18371,7 @@ var diff = createSwarmTool({
18901
18371
  } else if (base === "unstaged") {
18902
18372
  const oldRef = `:${file.path}`;
18903
18373
  oldContent = fileExistsInRef(oldRef) ? getContentFromRef(oldRef) : "";
18904
- newContent = fs4.readFileSync(path7.join(directory, file.path), "utf-8");
18374
+ newContent = fs4.readFileSync(path6.join(directory, file.path), "utf-8");
18905
18375
  } else {
18906
18376
  const oldRef = `${base}:${file.path}`;
18907
18377
  oldContent = fileExistsInRef(oldRef) ? getContentFromRef(oldRef) : "";
@@ -19098,7 +18568,7 @@ var symbolsAdapter = {
19098
18568
 
19099
18569
  // src/tools/scope-validate.ts
19100
18570
  init_zod();
19101
- import path8 from "path";
18571
+ import path7 from "path";
19102
18572
  init_path_identity();
19103
18573
  var scopeValidateArgs = {
19104
18574
  command: exports_external.string().min(1).max(64 * 1024).describe("Shell command to inspect; it is never executed"),
@@ -19125,7 +18595,7 @@ function detectWrites(args) {
19125
18595
  }
19126
18596
  function createScopeMatcher(scopeEntries, directory) {
19127
18597
  const flavor = getPathFlavor();
19128
- const pathImpl = flavor === "win32" ? path8.win32 : path8.posix;
18598
+ const pathImpl = flavor === "win32" ? path7.win32 : path7.posix;
19129
18599
  const scopeIdentities = new Set(scopeEntries.map((scope) => normalizePathIdentity(pathImpl.resolve(directory, scope), flavor)));
19130
18600
  return (filePath) => {
19131
18601
  let candidate = pathImpl.resolve(directory, filePath);
@@ -19190,7 +18660,7 @@ function evaluateScopeValidate(args, directory) {
19190
18660
  if (!target.resolved || !target.resolvedPath) {
19191
18661
  fail("UNRESOLVED_TARGET", "a write target could not be resolved statically");
19192
18662
  }
19193
- const resolvedPath = path8.resolve(target.resolvedPath);
18663
+ const resolvedPath = path7.resolve(target.resolvedPath);
19194
18664
  if (!isCanonicalPathWithinRoot(resolvedPath, directory)) {
19195
18665
  fail("ROOT_ESCAPE", "a write target resolves outside the configured root");
19196
18666
  }
@@ -19198,7 +18668,7 @@ function evaluateScopeValidate(args, directory) {
19198
18668
  if (symlinkReason) {
19199
18669
  fail("SYMLINK_ESCAPE", "a write target uses an unverifiable symlink or junction");
19200
18670
  }
19201
- const relativeTarget = path8.relative(directory, resolvedPath);
18671
+ const relativeTarget = path7.relative(directory, resolvedPath);
19202
18672
  if (!isInScope(relativeTarget)) {
19203
18673
  fail("SCOPE_VIOLATION", "a write target is outside the inline declared scope");
19204
18674
  }
@@ -19341,10 +18811,10 @@ class McpContainmentError extends Error {
19341
18811
  function validatePathValue(field, value, root) {
19342
18812
  if (typeof value !== "string" || value === "")
19343
18813
  return;
19344
- if (path9.isAbsolute(value) || /^[A-Za-z]:[/\\]/.test(value)) {
19345
- const resolved2 = path9.resolve(value);
19346
- const relative2 = path9.relative(root, resolved2);
19347
- if (relative2.startsWith("..") || path9.isAbsolute(relative2)) {
18814
+ if (path8.isAbsolute(value) || /^[A-Za-z]:[/\\]/.test(value)) {
18815
+ const resolved2 = path8.resolve(value);
18816
+ const relative2 = path8.relative(root, resolved2);
18817
+ if (relative2.startsWith("..") || path8.isAbsolute(relative2)) {
19348
18818
  throw new McpContainmentError(field, value, root);
19349
18819
  }
19350
18820
  if (!isCanonicalPathWithinRoot(resolved2, root)) {
@@ -19356,7 +18826,7 @@ function validatePathValue(field, value, root) {
19356
18826
  if (reason !== null) {
19357
18827
  throw new McpContainmentError(field, value, root);
19358
18828
  }
19359
- const resolved = path9.resolve(root, value);
18829
+ const resolved = path8.resolve(root, value);
19360
18830
  if (!isCanonicalPathWithinRoot(resolved, root)) {
19361
18831
  throw new McpContainmentError(field, value, root);
19362
18832
  }