@vantageos/mcp-doctor 0.22.0 → 0.23.0

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.
package/dist/doctor.js CHANGED
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-OLW7SIJF.js";
7
7
 
8
8
  // src/doctor.ts
9
- import { readFileSync as readFileSync28, realpathSync, statSync as statSync27 } from "fs";
10
- import { dirname as dirname19, join as join37, resolve as resolve4 } from "path";
9
+ import { readFileSync as readFileSync30, realpathSync, statSync as statSync27 } from "fs";
10
+ import { dirname as dirname20, join as join38, resolve as resolve4 } from "path";
11
11
  import { fileURLToPath as fileURLToPath2 } from "url";
12
12
 
13
13
  // src/scan.ts
@@ -681,12 +681,12 @@ function findDiskFiles(tree, pred) {
681
681
  }
682
682
  walk3(full);
683
683
  } else {
684
- const rel = relative2(base, full).split(sep2).join("/");
685
- if (!pred(name, rel)) continue;
684
+ const rel2 = relative2(base, full).split(sep2).join("/");
685
+ if (!pred(name, rel2)) continue;
686
686
  if (!st.isFile()) {
687
687
  const why = "not a regular file (FIFO, socket or device) \u2014 not read";
688
688
  recordSkip(tree, full, base, why);
689
- refused.push({ rel, reason: why });
689
+ refused.push({ rel: rel2, reason: why });
690
690
  continue;
691
691
  }
692
692
  try {
@@ -694,10 +694,10 @@ function findDiskFiles(tree, pred) {
694
694
  } catch (err) {
695
695
  const why = `could not be read (${fsErrorCode(err)}) \u2014 not read`;
696
696
  recordSkip(tree, full, base, why);
697
- refused.push({ rel, reason: why });
697
+ refused.push({ rel: rel2, reason: why });
698
698
  continue;
699
699
  }
700
- out.push({ path: full, rel, name });
700
+ out.push({ path: full, rel: rel2, name });
701
701
  }
702
702
  }
703
703
  };
@@ -800,6 +800,7 @@ var MANUFACT_RULES_PIN = "7e5513eff22c0e2174c100d26e0aa40f642a562f";
800
800
  var C40_RULES_PIN = "941156e5734007188d1e3c54adadf3f1a3f84761";
801
801
  var C19_RULES_PIN = "1596b8c552d8b836f4d6044569fb2e15c3bfe6cb";
802
802
  var S51_RULES_PIN = "3b4982f7da3d34f0dc3bb42f8d3f3c5f9480943a";
803
+ var C41_RULES_PIN = "173d3f0bef155a362ffce9fbe9bb4f1d1115e5b8";
803
804
 
804
805
  // src/detectors/dLocalIdentity.ts
805
806
  var CLOUD_IDENTITY_PACKAGE = "@vantageos/cloud-identity";
@@ -1979,7 +1980,7 @@ function scanWrappers(tree) {
1979
1980
  lineStart.push(off);
1980
1981
  off += l.raw.length + 1;
1981
1982
  }
1982
- const lineOf4 = (idx) => {
1983
+ const lineOf5 = (idx) => {
1983
1984
  let lo = 0;
1984
1985
  let hi = lineStart.length - 1;
1985
1986
  while (lo < hi) {
@@ -2030,7 +2031,7 @@ function scanWrappers(tree) {
2030
2031
  const k = paramNames.indexOf(c[1]);
2031
2032
  if (k < 0) continue;
2032
2033
  idxs.add(k);
2033
- scan.internal.add(`${file.rel}:${lineOf4(bodyOpen + (c.index ?? 0))}`);
2034
+ scan.internal.add(`${file.rel}:${lineOf5(bodyOpen + (c.index ?? 0))}`);
2034
2035
  const after = body.slice((c.index ?? 0) + c[0].length, (c.index ?? 0) + c[0].length + 3e3);
2035
2036
  const dm = after.match(/(?:^|[\s{,])description\b\s*(?::\s*([A-Za-z_$][\w$]*))?\s*[,}]/);
2036
2037
  if (dm) {
@@ -2045,7 +2046,7 @@ function scanWrappers(tree) {
2045
2046
  descIdx,
2046
2047
  file,
2047
2048
  declLine: line.n,
2048
- endLine: lineOf4(bodyEnd)
2049
+ endLine: lineOf5(bodyEnd)
2049
2050
  });
2050
2051
  });
2051
2052
  }
@@ -2725,11 +2726,11 @@ var presentResult = (id, anchor, verdict3) => ({
2725
2726
  state: "present",
2726
2727
  verdict: verdict3
2727
2728
  });
2728
- function isProductSource(rel) {
2729
+ function isProductSource(rel2) {
2729
2730
  return !/(^|\/)(scripts|evals|examples|docs|e2e|test|tests|__tests__|spec|specs|fixtures|mocks?)\//.test(
2730
- rel
2731
+ rel2
2731
2732
  ) && // `bin/` is tooling only at the top of the tree: `src/bin/server.ts` is the stdio entry of a server.
2732
- !/^bin\//.test(rel) && !/\.(?:test|spec)\.[jt]sx?$/.test(rel);
2733
+ !/^bin\//.test(rel2) && !/\.(?:test|spec)\.[jt]sx?$/.test(rel2);
2733
2734
  }
2734
2735
  function productHits(tree, re) {
2735
2736
  return lineHits(tree, re).filter((h) => isProductSource(h.file.rel));
@@ -3161,30 +3162,30 @@ function collect(base) {
3161
3162
  }
3162
3163
  for (const name of entries.sort()) {
3163
3164
  const full = join4(dir, name);
3164
- const rel = relOf(full);
3165
- const candidate = BUNDLE_EXT_RE.test(name) && UI_PATH_RE.test(rel);
3165
+ const rel2 = relOf(full);
3166
+ const candidate = BUNDLE_EXT_RE.test(name) && UI_PATH_RE.test(rel2);
3166
3167
  let st;
3167
3168
  try {
3168
3169
  st = statSync5(full);
3169
3170
  } catch {
3170
- if (candidate) unmeasured.push(`${rel} (cannot be read: dangling link or permission)`);
3171
+ if (candidate) unmeasured.push(`${rel2} (cannot be read: dangling link or permission)`);
3171
3172
  continue;
3172
3173
  }
3173
3174
  if (st.isDirectory()) {
3174
3175
  if (!WALK_SKIP.has(name)) walk3(full, depth + 1);
3175
3176
  } else if (candidate) {
3176
3177
  if (!st.isFile()) {
3177
- unmeasured.push(`${rel} (not a regular file, not read)`);
3178
+ unmeasured.push(`${rel2} (not a regular file, not read)`);
3178
3179
  continue;
3179
3180
  }
3180
3181
  if (st.size > MAX_MEASURE_BYTES) {
3181
- unmeasured.push(`${rel} (${(st.size / 1048576).toFixed(0)} MB, too large to measure)`);
3182
+ unmeasured.push(`${rel2} (${(st.size / 1048576).toFixed(0)} MB, too large to measure)`);
3182
3183
  continue;
3183
3184
  }
3184
3185
  try {
3185
- out.push({ rel, gz: gzipSync(readFileSync4(full), { level: 9 }).length });
3186
+ out.push({ rel: rel2, gz: gzipSync(readFileSync4(full), { level: 9 }).length });
3186
3187
  } catch {
3187
- unmeasured.push(`${rel} (read or compression failed)`);
3188
+ unmeasured.push(`${rel2} (read or compression failed)`);
3188
3189
  }
3189
3190
  }
3190
3191
  }
@@ -4546,7 +4547,7 @@ function readDeclaredUpstreams(tree) {
4546
4547
  const decls = [];
4547
4548
  const unreadable2 = [];
4548
4549
  let located = false;
4549
- const fromJson = (rel, v) => {
4550
+ const fromJson = (rel2, v) => {
4550
4551
  if (v === null || typeof v !== "object") return;
4551
4552
  const root = v;
4552
4553
  const holders = [
@@ -4562,7 +4563,7 @@ function readDeclaredUpstreams(tree) {
4562
4563
  const add = (name, o) => {
4563
4564
  if (typeof name !== "string") return;
4564
4565
  const t = o && typeof o === "object" ? o.tenancy : void 0;
4565
- decls.push({ name, tenancy: typeof t === "string" ? t : void 0, anchor: `${rel}:1` });
4566
+ decls.push({ name, tenancy: typeof t === "string" ? t : void 0, anchor: `${rel2}:1` });
4566
4567
  };
4567
4568
  if (Array.isArray(u)) {
4568
4569
  for (const e of u) {
@@ -4573,8 +4574,8 @@ function readDeclaredUpstreams(tree) {
4573
4574
  for (const [k, e] of Object.entries(u)) add(k, e);
4574
4575
  } else {
4575
4576
  unreadable2.push({
4576
- anchor: `${rel}:1`,
4577
- reason: `${rel} has an \`upstreams\` key that is neither a list nor an object`
4577
+ anchor: `${rel2}:1`,
4578
+ reason: `${rel2} has an \`upstreams\` key that is neither a list nor an object`
4578
4579
  });
4579
4580
  }
4580
4581
  }
@@ -4695,9 +4696,9 @@ function insideLoop(s, off) {
4695
4696
  function controlTree(files) {
4696
4697
  return {
4697
4698
  root: "/nonexistent-control-root",
4698
- files: Object.entries(files).map(([rel, text]) => ({
4699
- path: rel,
4700
- rel,
4699
+ files: Object.entries(files).map(([rel2, text]) => ({
4700
+ path: rel2,
4701
+ rel: rel2,
4701
4702
  lines: text.split("\n").map((raw, i) => ({ n: i + 1, raw, comment: false }))
4702
4703
  })),
4703
4704
  packageJson: null,
@@ -6413,8 +6414,8 @@ function skillsCacheProblems(tree) {
6413
6414
  let first = "";
6414
6415
  for (const [method, anchors] of sites) {
6415
6416
  for (const anchor of anchors) {
6416
- const rel = anchor.slice(0, anchor.lastIndexOf(":"));
6417
- if (!(ttl.some((h) => h.file.rel === rel) && scope2.some((h) => h.file.rel === rel))) {
6417
+ const rel2 = anchor.slice(0, anchor.lastIndexOf(":"));
6418
+ if (!(ttl.some((h) => h.file.rel === rel2) && scope2.some((h) => h.file.rel === rel2))) {
6418
6419
  problems.push(`${method} (${anchor})`);
6419
6420
  first = first || anchor;
6420
6421
  }
@@ -6736,11 +6737,11 @@ function hostToolProblems(tree) {
6736
6737
  text: `${n.from} tool \`${n.name}\` does not list "app" in ui.visibility`
6737
6738
  });
6738
6739
  }
6739
- const rel = t.anchor.slice(0, t.anchor.lastIndexOf(":"));
6740
- if (!lineHits(tree, /resource_link|ResourceLink/).some((h) => h.file.rel === rel)) {
6740
+ const rel2 = t.anchor.slice(0, t.anchor.lastIndexOf(":"));
6741
+ if (!lineHits(tree, /resource_link|ResourceLink/).some((h) => h.file.rel === rel2)) {
6741
6742
  problems.push({
6742
6743
  anchor: t.anchor,
6743
- text: `${n.from} tool \`${n.name}\` never returns a ResourceLink (no resource_link in ${rel})`
6744
+ text: `${n.from} tool \`${n.name}\` never returns a ResourceLink (no resource_link in ${rel2})`
6744
6745
  });
6745
6746
  }
6746
6747
  }
@@ -6865,8 +6866,8 @@ var a9Entrypoint = {
6865
6866
  reason: "no ontoolresult / onToolResult handler is found in the tree \u2014 whether the first view renders from the initial tool result is unread"
6866
6867
  });
6867
6868
  }
6868
- for (const rel of handlerFiles) {
6869
- const file = tree.files.find((f) => f.rel === rel);
6869
+ for (const rel2 of handlerFiles) {
6870
+ const file = tree.files.find((f) => f.rel === rel2);
6870
6871
  if (!file) continue;
6871
6872
  const handler = codeSites(
6872
6873
  { ...tree, files: [file] },
@@ -6876,7 +6877,7 @@ var a9Entrypoint = {
6876
6877
  if (handler && connect && connect.line.n < handler.line.n) {
6877
6878
  reds.push({
6878
6879
  anchor: handler.anchor,
6879
- text: `${rel}: ontoolresult is registered at line ${handler.line.n}, AFTER connect at line ${connect.line.n} \u2014 the initial tool result can arrive before the handler exists (register ontoolresult before connect)`
6880
+ text: `${rel2}: ontoolresult is registered at line ${handler.line.n}, AFTER connect at line ${connect.line.n} \u2014 the initial tool result can arrive before the handler exists (register ontoolresult before connect)`
6880
6881
  });
6881
6882
  }
6882
6883
  }
@@ -7216,8 +7217,8 @@ function resourceCallEnd(file, n) {
7216
7217
  }
7217
7218
  return file.lines.length;
7218
7219
  }
7219
- var within = (r, rel, n) => (r.get(rel) ?? []).some(([a, b]) => n >= a && n <= b);
7220
- var addRange = (r, rel, a, b) => r.set(rel, [...r.get(rel) ?? [], [a, b]]);
7220
+ var within = (r, rel2, n) => (r.get(rel2) ?? []).some(([a, b]) => n >= a && n <= b);
7221
+ var addRange = (r, rel2, a, b) => r.set(rel2, [...r.get(rel2) ?? [], [a, b]]);
7221
7222
  function run(tree) {
7222
7223
  const covered = /* @__PURE__ */ new Map();
7223
7224
  const consts = /* @__PURE__ */ new Set();
@@ -7685,7 +7686,7 @@ var MECHANISM_BASE_SET = /* @__PURE__ */ new Set([
7685
7686
  "indexed-hybrid-rrf",
7686
7687
  "upstream-delegated"
7687
7688
  ]);
7688
- var isDataLayerFile = (rel) => /(^|\/)convex\//.test(rel);
7689
+ var isDataLayerFile = (rel2) => /(^|\/)convex\//.test(rel2);
7689
7690
  function judgeIndexedFromSource(tree, id, indexed) {
7690
7691
  const names2 = indexed.map((t) => `"${t.name}" (${t.searchMechanism})`).join(", ");
7691
7692
  const dataLayer = tree.files.filter((f) => isJudgeable(f) && isDataLayerFile(f.rel));
@@ -11030,8 +11031,8 @@ function findProvenanceClaim(tree, root, unreadable2) {
11030
11031
  const hit = workflowStatements(text).find(([, l]) => PROVENANCE_RE2.test(l));
11031
11032
  if (hit) {
11032
11033
  const line = hit[0];
11033
- const rel = relative4(root, workflowsDir) || WORKFLOW_DIR;
11034
- return { site: `${rel}/${name}:${line}`, text };
11034
+ const rel2 = relative4(root, workflowsDir) || WORKFLOW_DIR;
11035
+ return { site: `${rel2}/${name}:${line}`, text };
11035
11036
  }
11036
11037
  }
11037
11038
  }
@@ -11471,15 +11472,15 @@ function findInlineDescription(tree, siteAnchor, toolName2) {
11471
11472
  if (v.kind === "literal" && v.text.length > 0) return v.text;
11472
11473
  if (v.kind === "non-literal") return v;
11473
11474
  }
11474
- const [rel, lineStr] = siteAnchor.split(":");
11475
- const file = tree.files.find((f) => f.rel === rel);
11475
+ const [rel2, lineStr] = siteAnchor.split(":");
11476
+ const file = tree.files.find((f) => f.rel === rel2);
11476
11477
  if (!file) return void 0;
11477
11478
  const siteLine = Number.parseInt(lineStr, 10);
11478
11479
  let floor = 1;
11479
11480
  for (const other of findRegisteredTools(tree)) {
11480
11481
  const [orel, oline] = other.anchor.split(":");
11481
11482
  const n = Number.parseInt(oline, 10);
11482
- if (orel === rel && n < siteLine) floor = Math.max(floor, ownCallEnd(file, n) + 1);
11483
+ if (orel === rel2 && n < siteLine) floor = Math.max(floor, ownCallEnd(file, n) + 1);
11483
11484
  }
11484
11485
  const start = Math.max(floor, siteLine - BACKWARD_LOOKBACK);
11485
11486
  const end = Math.min(siteLine + FORWARD_LOOKAHEAD, file.lines.length + 1);
@@ -12162,7 +12163,7 @@ var c24AcceptanceAtDispatch = {
12162
12163
  `C24 positive control FAILED: ${JSON.stringify(ctl)} \u2014 the dispatch matcher cannot tell an instrument job from another, verdict untrustworthy`
12163
12164
  );
12164
12165
  }
12165
- const candidates = diskText(tree, (_name, rel) => DISPATCH_PATH_RE.test(rel));
12166
+ const candidates = diskText(tree, (_name, rel2) => DISPATCH_PATH_RE.test(rel2));
12166
12167
  const docs = candidates.filter((d) => INSTRUMENT_RE.test(d.text) && ACTION_RE.test(d.text));
12167
12168
  const unreadDocs = refusedAsUnreadable(
12168
12169
  candidates.refused,
@@ -12829,10 +12830,10 @@ function renderCoverage(scope2, verdicts) {
12829
12830
  }
12830
12831
  }
12831
12832
  return verdicts.map((v) => {
12832
- const rel = relative5(process.cwd(), v.site.dir) || v.site.dir;
12833
- if (v.status === "skipped") return `SKIPPED ${rel} (${v.reason})`;
12834
- if (v.status === "unreadable") return `UNREAD ${rel} (${v.reason})`;
12835
- return `ANALYSED ${rel} -> ${v.ok ? "GREEN" : "RED"}: ${v.detail}`;
12833
+ const rel2 = relative5(process.cwd(), v.site.dir) || v.site.dir;
12834
+ if (v.status === "skipped") return `SKIPPED ${rel2} (${v.reason})`;
12835
+ if (v.status === "unreadable") return `UNREAD ${rel2} (${v.reason})`;
12836
+ return `ANALYSED ${rel2} -> ${v.ok ? "GREEN" : "RED"}: ${v.detail}`;
12836
12837
  }).join(" | ");
12837
12838
  }
12838
12839
  var c26SubpackageLockfile = {
@@ -13192,7 +13193,7 @@ function pluginPackages(tree) {
13192
13193
  }
13193
13194
  return [...out].sort();
13194
13195
  }
13195
- function filesUnder(dir, unread2, rel) {
13196
+ function filesUnder(dir, unread2, rel2) {
13196
13197
  const out = /* @__PURE__ */ new Map();
13197
13198
  let incomplete = false;
13198
13199
  const walk3 = (d, prefix) => {
@@ -13200,7 +13201,7 @@ function filesUnder(dir, unread2, rel) {
13200
13201
  try {
13201
13202
  names2 = readdirSync8(d);
13202
13203
  } catch (e) {
13203
- unread2.push({ anchor: rel, reason: `${prefix || "."} not listed (${e.message})` });
13204
+ unread2.push({ anchor: rel2, reason: `${prefix || "."} not listed (${e.message})` });
13204
13205
  incomplete = true;
13205
13206
  return;
13206
13207
  }
@@ -13213,7 +13214,7 @@ function filesUnder(dir, unread2, rel) {
13213
13214
  } catch (e) {
13214
13215
  out.set(r, null);
13215
13216
  unread2.push({
13216
- anchor: `${rel}/${r}`,
13217
+ anchor: `${rel2}/${r}`,
13217
13218
  reason: `not read (${e.message}): not compared`
13218
13219
  });
13219
13220
  }
@@ -13222,15 +13223,15 @@ function filesUnder(dir, unread2, rel) {
13222
13223
  walk3(dir, "");
13223
13224
  return { files: out, incomplete };
13224
13225
  }
13225
- function absenceOf(base, rel) {
13226
+ function absenceOf(base, rel2) {
13226
13227
  try {
13227
- statSync11(join12(base, rel));
13228
- return `${rel} exists but was not read by the scan`;
13228
+ statSync11(join12(base, rel2));
13229
+ return `${rel2} exists but was not read by the scan`;
13229
13230
  } catch (e) {
13230
13231
  if (e.code !== "ENOENT")
13231
- return `${rel} not read (${e.message})`;
13232
+ return `${rel2} not read (${e.message})`;
13232
13233
  }
13233
- const parts = rel.split("/");
13234
+ const parts = rel2.split("/");
13234
13235
  for (let i = parts.length - 1; i >= 0; i--) {
13235
13236
  const dir = parts.slice(0, i).join("/");
13236
13237
  try {
@@ -13238,7 +13239,7 @@ function absenceOf(base, rel) {
13238
13239
  return true;
13239
13240
  } catch (e) {
13240
13241
  if (e.code === "ENOENT") continue;
13241
- return `${dir || "."} not listed (${e.message}): whether ${rel} is there is not read`;
13242
+ return `${dir || "."} not listed (${e.message}): whether ${rel2} is there is not read`;
13242
13243
  }
13243
13244
  }
13244
13245
  return true;
@@ -13248,22 +13249,22 @@ function packageSkillProblems(tree, skillFiles, unread2) {
13248
13249
  const packages = pluginPackages(tree);
13249
13250
  if (packages.length === 0 || skillFiles.length === 0) return [];
13250
13251
  const skillsRoot = (pkg) => pkg ? `${pkg}/skills` : "skills";
13251
- const inPackage = (rel) => packages.some((p) => rel.startsWith(`${skillsRoot(p)}/`));
13252
+ const inPackage = (rel2) => packages.some((p) => rel2.startsWith(`${skillsRoot(p)}/`));
13252
13253
  const names2 = [...new Set(skillFiles.map((s) => s.dir))].sort();
13253
13254
  const out = [];
13254
13255
  for (const pkg of packages) {
13255
13256
  const at = pkg || ".";
13256
13257
  const missing = [];
13257
13258
  for (const name of names2) {
13258
- const rel = `${skillsRoot(pkg)}/${name}/SKILL.md`;
13259
- const copy = skillFiles.find((s) => s.rel === rel);
13259
+ const rel2 = `${skillsRoot(pkg)}/${name}/SKILL.md`;
13260
+ const copy = skillFiles.find((s) => s.rel === rel2);
13260
13261
  if (!copy) {
13261
- const absent = absenceOf(base, rel);
13262
+ const absent = absenceOf(base, rel2);
13262
13263
  if (absent === true) missing.push(name);
13263
- else unread2.push({ anchor: rel, reason: absent });
13264
+ else unread2.push({ anchor: rel2, reason: absent });
13264
13265
  continue;
13265
13266
  }
13266
- const served = skillFiles.find((s) => s.dir === name && s.rel !== rel && !inPackage(s.rel));
13267
+ const served = skillFiles.find((s) => s.dir === name && s.rel !== rel2 && !inPackage(s.rel));
13267
13268
  if (!served) {
13268
13269
  if (pkg) {
13269
13270
  const servedRel = `skills/${name}/SKILL.md`;
@@ -13273,7 +13274,7 @@ function packageSkillProblems(tree, skillFiles, unread2) {
13273
13274
  continue;
13274
13275
  }
13275
13276
  const servedDir = served.rel.slice(0, -"/SKILL.md".length);
13276
- const copyDir = rel.slice(0, -"/SKILL.md".length);
13277
+ const copyDir = rel2.slice(0, -"/SKILL.md".length);
13277
13278
  const servedWalk = filesUnder(join12(base, servedDir), unread2, servedDir);
13278
13279
  const copyWalk = filesUnder(join12(base, copyDir), unread2, copyDir);
13279
13280
  const a = servedWalk.files;
@@ -13287,7 +13288,7 @@ function packageSkillProblems(tree, skillFiles, unread2) {
13287
13288
  });
13288
13289
  if (missingFiles.length + extraFiles.length + differing.length > 0)
13289
13290
  out.push({
13290
- anchor: rel,
13291
+ anchor: rel2,
13291
13292
  text: `the package copy ${copyDir}/ is not derived from the served ${servedDir}/: ${[
13292
13293
  missingFiles.length ? `missing ${missingFiles.join(", ")}` : "",
13293
13294
  differing.length ? `differing ${differing.join(", ")}` : "",
@@ -13599,16 +13600,16 @@ function judgeServers(servers, anchor, out) {
13599
13600
  }
13600
13601
  }
13601
13602
  function judgeFolder(tree, folder, manifestPath2, out) {
13602
- const rel = (p) => relative8(tree.root, p).split(sep5).join("/") || ".";
13603
+ const rel2 = (p) => relative8(tree.root, p).split(sep5).join("/") || ".";
13603
13604
  const manifest = readJsonRecord(manifestPath2);
13604
13605
  if (!manifest) {
13605
13606
  out.unreadable.push({
13606
- anchor: rel(manifestPath2),
13607
- reason: `${rel(manifestPath2)} is present but is not a parseable JSON object \u2014 the plugin cannot be judged`
13607
+ anchor: rel2(manifestPath2),
13608
+ reason: `${rel2(manifestPath2)} is present but is not a parseable JSON object \u2014 the plugin cannot be judged`
13608
13609
  });
13609
13610
  return;
13610
13611
  }
13611
- const a = rel(manifestPath2);
13612
+ const a = rel2(manifestPath2);
13612
13613
  const name = manifest.name;
13613
13614
  if (typeof name !== "string" || !KEBAB_RE.test(name)) {
13614
13615
  out.reds.push({
@@ -13637,8 +13638,8 @@ function judgeFolder(tree, folder, manifestPath2, out) {
13637
13638
  } catch (err) {
13638
13639
  folderListed = false;
13639
13640
  out.unreadable.push({
13640
- anchor: rel(folder),
13641
- reason: `${rel(folder)} cannot be listed (${fsErrorCode(err)}) \u2014 whether it carries a LICENSE file is unread`
13641
+ anchor: rel2(folder),
13642
+ reason: `${rel2(folder)} cannot be listed (${fsErrorCode(err)}) \u2014 whether it carries a LICENSE file is unread`
13642
13643
  });
13643
13644
  }
13644
13645
  if (!hasLicenseField && !hasLicenseFile && folderListed) {
@@ -13651,16 +13652,16 @@ function judgeFolder(tree, folder, manifestPath2, out) {
13651
13652
  const readme = readText(readmePath);
13652
13653
  if (readme === null && existsSync11(readmePath)) {
13653
13654
  out.unreadable.push({
13654
- anchor: rel(readmePath),
13655
- reason: `${rel(readmePath)} is present but cannot be read as text (permission, or not a regular file) \u2014 its length and credential content are unread`
13655
+ anchor: rel2(readmePath),
13656
+ reason: `${rel2(readmePath)} is present but cannot be read as text (permission, or not a regular file) \u2014 its length and credential content are unread`
13656
13657
  });
13657
13658
  } else if (readme === null) {
13658
- out.reds.push({ anchor: rel(folder), text: "no README.md at the plugin folder root" });
13659
+ out.reds.push({ anchor: rel2(folder), text: "no README.md at the plugin folder root" });
13659
13660
  } else {
13660
13661
  const n = proseWordCount(readme);
13661
13662
  if (n < MIN_README_WORDS) {
13662
13663
  out.reds.push({
13663
- anchor: rel(readmePath),
13664
+ anchor: rel2(readmePath),
13664
13665
  text: `README.md has ${n} words outside code blocks (minimum ${MIN_README_WORDS})`
13665
13666
  });
13666
13667
  }
@@ -13669,8 +13670,8 @@ function judgeFolder(tree, folder, manifestPath2, out) {
13669
13670
  for (const shape of CREDENTIAL_SHAPES) {
13670
13671
  if (shape.re.test(lines2[i])) {
13671
13672
  out.reds.push({
13672
- anchor: `${rel(readmePath)}:${i + 1}`,
13673
- text: `${rel(readmePath)}:${i + 1} carries a literal credential (${shape.id}) \u2014 a README template shows an environment-variable reference, never a value`
13673
+ anchor: `${rel2(readmePath)}:${i + 1}`,
13674
+ text: `${rel2(readmePath)}:${i + 1} carries a literal credential (${shape.id}) \u2014 a README template shows an environment-variable reference, never a value`
13674
13675
  });
13675
13676
  break;
13676
13677
  }
@@ -13678,7 +13679,7 @@ function judgeFolder(tree, folder, manifestPath2, out) {
13678
13679
  }
13679
13680
  }
13680
13681
  let servers = null;
13681
- let mcpAnchor = rel(join13(folder, ".mcp.json"));
13682
+ let mcpAnchor = rel2(join13(folder, ".mcp.json"));
13682
13683
  const inline = manifest.mcpServers;
13683
13684
  if (isRecord(inline)) {
13684
13685
  servers = inline;
@@ -13686,7 +13687,7 @@ function judgeFolder(tree, folder, manifestPath2, out) {
13686
13687
  } else if (typeof inline === "string") {
13687
13688
  const target = join13(folder, inline);
13688
13689
  const j = readJsonRecord(target);
13689
- mcpAnchor = rel(target);
13690
+ mcpAnchor = rel2(target);
13690
13691
  if (j) servers = isRecord(j.mcpServers) ? j.mcpServers : j;
13691
13692
  else
13692
13693
  out.unreadable.push({
@@ -13703,7 +13704,7 @@ function judgeFolder(tree, folder, manifestPath2, out) {
13703
13704
  });
13704
13705
  } else {
13705
13706
  out.reds.push({
13706
- anchor: rel(folder),
13707
+ anchor: rel2(folder),
13707
13708
  text: "no .mcp.json (and no plugin.json mcpServers): the plugin does not reference the MCP server it ships"
13708
13709
  });
13709
13710
  }
@@ -13716,7 +13717,7 @@ function judgeFolder(tree, folder, manifestPath2, out) {
13716
13717
  try {
13717
13718
  if (statSync12(join13(folder, "bin")).isDirectory()) {
13718
13719
  out.reds.push({
13719
- anchor: rel(join13(folder, "bin")),
13720
+ anchor: rel2(join13(folder, "bin")),
13720
13721
  text: "a top-level bin/ directory (a plugin ships no bin/ at its top level)"
13721
13722
  });
13722
13723
  }
@@ -13724,8 +13725,8 @@ function judgeFolder(tree, folder, manifestPath2, out) {
13724
13725
  const code = fsErrorCode(err);
13725
13726
  if (code !== "ENOENT" && code !== "ENOTDIR") {
13726
13727
  out.unreadable.push({
13727
- anchor: rel(join13(folder, "bin")),
13728
- reason: `${rel(join13(folder, "bin"))} could not be probed (${code}) \u2014 whether the plugin ships a top-level bin/ is unread`
13728
+ anchor: rel2(join13(folder, "bin")),
13729
+ reason: `${rel2(join13(folder, "bin"))} could not be probed (${code}) \u2014 whether the plugin ships a top-level bin/ is unread`
13729
13730
  });
13730
13731
  }
13731
13732
  }
@@ -13755,7 +13756,7 @@ var c31PluginInstallable = {
13755
13756
  }
13756
13757
  const manifests = findDiskFiles(
13757
13758
  tree,
13758
- (_n, rel) => rel === ".claude-plugin/plugin.json" || rel.endsWith("/.claude-plugin/plugin.json")
13759
+ (_n, rel2) => rel2 === ".claude-plugin/plugin.json" || rel2.endsWith("/.claude-plugin/plugin.json")
13759
13760
  );
13760
13761
  const refusedManifests = refusedAsUnreadable(
13761
13762
  manifests.refused,
@@ -13991,8 +13992,8 @@ import { readFileSync as readFileSync12, readdirSync as readdirSync10, statSync
13991
13992
  import { join as join14 } from "path";
13992
13993
  var ID3 = "C34 plugin-families";
13993
13994
  var RULE3 = "C-34";
13994
- function familyOf(rel) {
13995
- const segs = rel.split("/");
13995
+ function familyOf(rel2) {
13996
+ const segs = rel2.split("/");
13996
13997
  const name = segs[segs.length - 1];
13997
13998
  const parent = segs[segs.length - 2] ?? "";
13998
13999
  if (name === "plugin.json" && parent === ".claude-plugin")
@@ -14075,12 +14076,12 @@ function writesFile(text, f) {
14075
14076
  function testFiles(tree, unread2) {
14076
14077
  const base = baseOf(tree);
14077
14078
  const out = [];
14078
- const walk3 = (dir, rel) => {
14079
+ const walk3 = (dir, rel2) => {
14079
14080
  let names2;
14080
14081
  try {
14081
14082
  names2 = readdirSync10(dir);
14082
14083
  } catch (err) {
14083
- unread2.push(`${rel}/ (not listed: ${err.message})`);
14084
+ unread2.push(`${rel2}/ (not listed: ${err.message})`);
14084
14085
  return;
14085
14086
  }
14086
14087
  for (const name of names2) {
@@ -14092,9 +14093,9 @@ function testFiles(tree, unread2) {
14092
14093
  } catch {
14093
14094
  continue;
14094
14095
  }
14095
- if (st.isDirectory()) walk3(full, `${rel}/${name}`);
14096
+ if (st.isDirectory()) walk3(full, `${rel2}/${name}`);
14096
14097
  else if (/\.[cm]?[jt]sx?$/.test(name))
14097
- out.push({ rel: `${rel}/${name}`, text: readText(full) ?? "" });
14098
+ out.push({ rel: `${rel2}/${name}`, text: readText(full) ?? "" });
14098
14099
  }
14099
14100
  };
14100
14101
  for (const d of ["tests", "test", "__tests__"]) {
@@ -14110,9 +14111,9 @@ function testFiles(tree, unread2) {
14110
14111
  function run2(tree) {
14111
14112
  const found = findDiskFiles(
14112
14113
  tree,
14113
- (name, rel) => familyOf(rel) !== null && !/(^|\/)(dist|node_modules)\//.test(rel) && name.endsWith(".json")
14114
+ (name, rel2) => familyOf(rel2) !== null && !/(^|\/)(dist|node_modules)\//.test(rel2) && name.endsWith(".json")
14114
14115
  );
14115
- const dirOf = (rel) => rel.split("/").slice(0, -1).join("/");
14116
+ const dirOf = (rel2) => rel2.split("/").slice(0, -1).join("/");
14116
14117
  const agentDirs = new Set(
14117
14118
  found.filter((f) => f.name === "plugin.json" && familyOf(f.rel)?.id === "agent").map((f) => dirOf(f.rel))
14118
14119
  );
@@ -14129,12 +14130,12 @@ function run2(tree) {
14129
14130
  const unread2 = found.refused.map((r) => `${r.rel} (${r.reason})`);
14130
14131
  const scripts = findDiskFiles(
14131
14132
  tree,
14132
- (name, rel) => /\.(?:mjs|cjs|js|ts)$/.test(name) && !/(^|\/)(dist|node_modules|tests?|__tests__)\//.test(rel) && !/\.(?:test|spec)\.[cm]?[jt]s$/.test(name)
14133
+ (name, rel2) => /\.(?:mjs|cjs|js|ts)$/.test(name) && !/(^|\/)(dist|node_modules|tests?|__tests__)\//.test(rel2) && !/\.(?:test|spec)\.[cm]?[jt]s$/.test(name)
14133
14134
  ).map((f) => ({ file: f, text: readText(f.path) ?? "" }));
14134
14135
  const tests = testFiles(tree, unread2);
14135
14136
  const wiring = findDiskFiles(
14136
14137
  tree,
14137
- (name, rel) => name === "package.json" && !rel.includes("node_modules/") || /\.github\/workflows\/[^/]+\.ya?ml$/.test(rel)
14138
+ (name, rel2) => name === "package.json" && !rel2.includes("node_modules/") || /\.github\/workflows\/[^/]+\.ya?ml$/.test(rel2)
14138
14139
  ).map((f) => ({ file: f, text: readText(f.path) ?? "" }));
14139
14140
  const badManifests = wiring.filter((w) => w.file.name === "package.json").filter((w) => {
14140
14141
  try {
@@ -14233,7 +14234,7 @@ function readJson2(path) {
14233
14234
  function pluginManifests(tree) {
14234
14235
  return findDiskFiles(
14235
14236
  tree,
14236
- (name, rel) => name === "plugin.json" && !/(^|\/)(dist|node_modules)\//.test(rel)
14237
+ (name, rel2) => name === "plugin.json" && !/(^|\/)(dist|node_modules)\//.test(rel2)
14237
14238
  ).map((f) => {
14238
14239
  const r = readJson2(f.path);
14239
14240
  const d = r.ok && r.value && typeof r.value === "object" ? r.value.description : void 0;
@@ -14459,11 +14460,11 @@ function registrationWindow(tree, anchor) {
14459
14460
  }
14460
14461
  function findManifestsUnder(root) {
14461
14462
  const out = [];
14462
- for (const rel of ["plugin.json", ".claude-plugin/plugin.json", ".cursor-plugin/plugin.json"]) {
14463
- const r = readJson2(join15(root, rel));
14463
+ for (const rel2 of ["plugin.json", ".claude-plugin/plugin.json", ".cursor-plugin/plugin.json"]) {
14464
+ const r = readJson2(join15(root, rel2));
14464
14465
  if (!r.ok) continue;
14465
14466
  const d = r.value && typeof r.value === "object" ? r.value.description : void 0;
14466
- out.push({ rel, description: typeof d === "string" ? d : void 0 });
14467
+ out.push({ rel: rel2, description: typeof d === "string" ? d : void 0 });
14467
14468
  }
14468
14469
  return out;
14469
14470
  }
@@ -15304,6 +15305,290 @@ var c40ToolDocumentation = {
15304
15305
  runServed: runServed4
15305
15306
  };
15306
15307
 
15308
+ // src/detectors/c41-vantageos-latest.ts
15309
+ import { spawnSync as spawnSync2 } from "child_process";
15310
+ import { readFileSync as readFileSync16, readdirSync as readdirSync12 } from "fs";
15311
+ import { join as join18, relative as relative9, sep as sep6 } from "path";
15312
+ var RULE9 = "C-41";
15313
+ var SCOPE = "@vantageos/";
15314
+ var FIELDS = [
15315
+ "dependencies",
15316
+ "devDependencies",
15317
+ "peerDependencies",
15318
+ "optionalDependencies"
15319
+ ];
15320
+ var NON_REGISTRY_SPEC = /^(?:file|link|workspace|portal|patch|git|git\+[a-z]+|github|gitlab|bitbucket|gist|https?|npm):/i;
15321
+ var OWNER_REPO_SHORTHAND = /^[^\s@/]+\/[^\s/]+$/;
15322
+ function rel(root, p) {
15323
+ return relative9(root, p).split(sep6).join("/") || ".";
15324
+ }
15325
+ function walkManifests(tree, dir, out, unread2) {
15326
+ let entries;
15327
+ try {
15328
+ entries = readdirSync12(dir, { withFileTypes: true });
15329
+ } catch (e) {
15330
+ unread2.push({
15331
+ manifest: `${rel(tree.root, dir)}/`,
15332
+ reason: `directory unreadable (${fsErrorCode(e)})`
15333
+ });
15334
+ return;
15335
+ }
15336
+ for (const e of entries) {
15337
+ const p = join18(dir, e.name);
15338
+ if (e.isDirectory()) {
15339
+ if (SKIP_DIRS.has(e.name)) {
15340
+ recordSkip(tree, p, tree.root);
15341
+ continue;
15342
+ }
15343
+ walkManifests(tree, p, out, unread2);
15344
+ } else if (e.isFile() && e.name === "package.json") {
15345
+ out.push(p);
15346
+ }
15347
+ }
15348
+ }
15349
+ function lineOf2(text, pkg) {
15350
+ const i = text.split("\n").findIndex((l) => l.includes(`"${pkg}"`));
15351
+ return i < 0 ? 1 : i + 1;
15352
+ }
15353
+ function parseVantageosAlias(spec) {
15354
+ const m = /^npm:(@vantageos\/[^@\s]+)(?:@(.*))?$/.exec(spec.trim());
15355
+ if (!m) return void 0;
15356
+ return { pkg: m[1], spec: m[2] === void 0 || m[2].trim() === "" ? "*" : m[2].trim() };
15357
+ }
15358
+ function c41Collect(tree) {
15359
+ const files = [];
15360
+ const unreadable2 = [];
15361
+ walkManifests(tree, tree.root, files, unreadable2);
15362
+ const decls = [];
15363
+ for (const file of files.sort()) {
15364
+ const manifest = rel(tree.root, file);
15365
+ let text;
15366
+ let json;
15367
+ try {
15368
+ text = readFileSync16(file, "utf8");
15369
+ json = JSON.parse(text);
15370
+ } catch (e) {
15371
+ unreadable2.push({ manifest, reason: e instanceof Error ? e.message : String(e) });
15372
+ continue;
15373
+ }
15374
+ if (typeof json !== "object" || json === null || Array.isArray(json)) {
15375
+ unreadable2.push({ manifest, reason: "not a JSON object" });
15376
+ continue;
15377
+ }
15378
+ for (const field of FIELDS) {
15379
+ const block = json[field];
15380
+ if (block === void 0) continue;
15381
+ if (typeof block !== "object" || block === null || Array.isArray(block)) {
15382
+ unreadable2.push({ manifest, reason: `${field} is not an object` });
15383
+ continue;
15384
+ }
15385
+ for (const [pkg, spec] of Object.entries(block)) {
15386
+ const alias = typeof spec === "string" ? parseVantageosAlias(spec) : void 0;
15387
+ if (alias) {
15388
+ decls.push({
15389
+ manifest,
15390
+ line: lineOf2(text, pkg),
15391
+ field: `${field} (alias ${pkg})`,
15392
+ pkg: alias.pkg,
15393
+ spec: alias.spec
15394
+ });
15395
+ continue;
15396
+ }
15397
+ if (!pkg.startsWith(SCOPE)) continue;
15398
+ decls.push({ manifest, line: lineOf2(text, pkg), field, pkg, spec });
15399
+ }
15400
+ }
15401
+ }
15402
+ return { decls, unreadable: unreadable2 };
15403
+ }
15404
+ function isRegistrySpec(spec) {
15405
+ const s = spec.trim();
15406
+ return !NON_REGISTRY_SPEC.test(s) && !OWNER_REPO_SHORTHAND.test(s) && !s.includes("://");
15407
+ }
15408
+ function c41JudgeDeclarations(id, { decls, unreadable: unreadable2 }, resolver) {
15409
+ const lagging = [];
15410
+ const unjudged = unreadable2.map((u) => ({
15411
+ anchor: u.manifest,
15412
+ reason: `${u.manifest} could not be read (${u.reason})`
15413
+ }));
15414
+ let firstLagAnchor;
15415
+ for (const d of decls) {
15416
+ const anchor = `${d.manifest}:${d.line}`;
15417
+ const where = `${d.manifest} ${d.field}`;
15418
+ if (typeof d.spec !== "string") {
15419
+ unjudged.push({
15420
+ anchor,
15421
+ reason: `${d.pkg} in ${where} has a non-string spec (${JSON.stringify(d.spec)})`
15422
+ });
15423
+ continue;
15424
+ }
15425
+ if (!isRegistrySpec(d.spec)) {
15426
+ unjudged.push({
15427
+ anchor,
15428
+ reason: `${d.pkg} in ${where} is declared as "${d.spec}", not a registry spec: which published version it installs is not decidable from the registry`
15429
+ });
15430
+ continue;
15431
+ }
15432
+ const latest = resolver.latest(d.pkg);
15433
+ if (!latest.ok) {
15434
+ unjudged.push({
15435
+ anchor,
15436
+ reason: `registry did not give the latest version of ${d.pkg} (${latest.reason})`
15437
+ });
15438
+ continue;
15439
+ }
15440
+ const selected = resolver.satisfying(d.pkg, d.spec);
15441
+ if (!selected.ok) {
15442
+ unjudged.push({
15443
+ anchor,
15444
+ reason: `registry did not give the versions "${d.spec}" selects for ${d.pkg} (${selected.reason})`
15445
+ });
15446
+ continue;
15447
+ }
15448
+ if (!selected.value.includes(latest.value)) {
15449
+ lagging.push(
15450
+ `${d.pkg} "${d.spec}" does not accept latest ${latest.value} (${where}, ${anchor})`
15451
+ );
15452
+ firstLagAnchor ??= anchor;
15453
+ }
15454
+ }
15455
+ if (lagging.length > 0) {
15456
+ const tail = unjudged.length > 0 ? `; ${unjudged.length} other declaration(s) not judged: ${unjudged.map((u) => u.reason).join("; ")}` : "";
15457
+ return {
15458
+ id,
15459
+ anchor: firstLagAnchor ?? "-",
15460
+ state: "non-conforming",
15461
+ verdict: `${lagging.length} @vantageos/* dependenc${lagging.length === 1 ? "y is" : "ies are"} behind latest: ${lagging.join("; ")}${tail} (${RULE9})`
15462
+ };
15463
+ }
15464
+ if (unjudged.length > 0) {
15465
+ return couldNotJudge(
15466
+ id,
15467
+ unjudged[0].anchor,
15468
+ `${unjudged.length} @vantageos/* declaration(s) not judged: ${unjudged.map((u) => u.reason).join("; ")} (${RULE9})`
15469
+ );
15470
+ }
15471
+ if (decls.length === 0) {
15472
+ return {
15473
+ id,
15474
+ anchor: "-",
15475
+ state: "absent",
15476
+ verdict: `no @vantageos/* dependency declared in any package.json; ${RULE9} does not oblige (said aloud)`
15477
+ };
15478
+ }
15479
+ return {
15480
+ id,
15481
+ anchor: `${decls[0].manifest}:${decls[0].line}`,
15482
+ state: "present",
15483
+ verdict: `${decls.length} @vantageos/* declaration(s), each accepting the registry's latest (${RULE9})`
15484
+ };
15485
+ }
15486
+ function c41Judge(tree, resolver) {
15487
+ return c41JudgeDeclarations(c41VantageosLatest.id, c41Collect(tree), resolver);
15488
+ }
15489
+ function npmView(args, registry, timeoutMs) {
15490
+ const full = [
15491
+ "view",
15492
+ ...args,
15493
+ "--json",
15494
+ "--fetch-retries=0",
15495
+ ...registry ? [`--registry=${registry}`] : []
15496
+ ];
15497
+ const r = spawnSync2("npm", full, { encoding: "utf8", timeout: timeoutMs });
15498
+ if (r.error) return { ok: false, reason: `npm ${full.join(" ")}: ${r.error.message}` };
15499
+ let parsed;
15500
+ try {
15501
+ parsed = r.stdout.trim() === "" ? void 0 : JSON.parse(r.stdout);
15502
+ } catch {
15503
+ return { ok: false, reason: `npm ${args.join(" ")}: unparseable reply (exit ${r.status})` };
15504
+ }
15505
+ if (r.status !== 0) {
15506
+ const err = parsed?.error;
15507
+ const summary = err?.summary ?? (r.stderr.split("\n").find((l) => l.includes("error")) || `exit ${r.status}`);
15508
+ if (err?.code === "E404" && /^No match found for version/.test(err.summary ?? "")) {
15509
+ return { ok: false, reason: summary, noMatch: true };
15510
+ }
15511
+ return { ok: false, reason: `npm ${args.join(" ")}: ${err?.code ?? ""} ${summary}`.trim() };
15512
+ }
15513
+ if (parsed === void 0) return { ok: false, reason: `npm ${args.join(" ")}: empty reply` };
15514
+ return { ok: true, value: parsed };
15515
+ }
15516
+ function npmResolver(opts = {}) {
15517
+ const timeoutMs = opts.timeoutMs ?? 3e4;
15518
+ const latestCache = /* @__PURE__ */ new Map();
15519
+ const setCache = /* @__PURE__ */ new Map();
15520
+ return {
15521
+ latest(pkg) {
15522
+ const hit = latestCache.get(pkg);
15523
+ if (hit) return hit;
15524
+ const r = npmView([pkg, "dist-tags.latest"], opts.registry, timeoutMs);
15525
+ const out = !r.ok ? { ok: false, reason: r.reason } : typeof r.value === "string" ? { ok: true, value: r.value } : {
15526
+ ok: false,
15527
+ reason: `npm view ${pkg} dist-tags.latest: not a version (${JSON.stringify(r.value)})`
15528
+ };
15529
+ if (out.ok) latestCache.set(pkg, out);
15530
+ return out;
15531
+ },
15532
+ satisfying(pkg, spec) {
15533
+ const key = `${pkg}@${spec}`;
15534
+ const hit = setCache.get(key);
15535
+ if (hit) return hit;
15536
+ const r = npmView([key, "version"], opts.registry, timeoutMs);
15537
+ let out;
15538
+ if (!r.ok) out = "noMatch" in r ? { ok: true, value: [] } : { ok: false, reason: r.reason };
15539
+ else if (typeof r.value === "string") out = { ok: true, value: [r.value] };
15540
+ else if (Array.isArray(r.value) && r.value.every((v) => typeof v === "string"))
15541
+ out = { ok: true, value: r.value };
15542
+ else
15543
+ out = {
15544
+ ok: false,
15545
+ reason: `npm view ${key} version: not a version list (${JSON.stringify(r.value)})`
15546
+ };
15547
+ if (out.ok) setCache.set(key, out);
15548
+ return out;
15549
+ }
15550
+ };
15551
+ }
15552
+ function c41PositiveControls() {
15553
+ const decl = (spec) => ({
15554
+ manifest: "package.json",
15555
+ line: 1,
15556
+ field: "dependencies",
15557
+ pkg: "@vantageos/x",
15558
+ spec
15559
+ });
15560
+ const reg = {
15561
+ latest: () => ({ ok: true, value: "1.1.0" }),
15562
+ satisfying: (_p, s) => ({ ok: true, value: s === "^1.0.0" ? ["1.0.0", "1.1.0"] : ["0.9.0"] })
15563
+ };
15564
+ const dead = {
15565
+ latest: () => ({ ok: false, reason: "offline" }),
15566
+ satisfying: () => ({ ok: false, reason: "offline" })
15567
+ };
15568
+ const cases = [
15569
+ ["lag", { decls: [decl("^0.9.0")], unreadable: [] }, reg, "non-conforming"],
15570
+ ["accepts", { decls: [decl("^1.0.0")], unreadable: [] }, reg, "present"],
15571
+ ["offline", { decls: [decl("^1.0.0")], unreadable: [] }, dead, "could-not-judge"],
15572
+ ["file spec", { decls: [decl("file:../x")], unreadable: [] }, reg, "could-not-judge"],
15573
+ ["none", { decls: [], unreadable: [] }, reg, "absent"]
15574
+ ];
15575
+ for (const [name, input, resolver, want] of cases) {
15576
+ const got = c41JudgeDeclarations("C41 control", input, resolver).state;
15577
+ if (got !== want)
15578
+ throw new Error(`C41 positive control "${name}": expected ${want}, got ${got}`);
15579
+ }
15580
+ }
15581
+ var c41VantageosLatest = {
15582
+ id: "C41 vantageos-latest",
15583
+ rule: RULE9,
15584
+ pin: C41_RULES_PIN,
15585
+ run(tree) {
15586
+ c41PositiveControls();
15587
+ return c41Judge(tree, defaultResolver);
15588
+ }
15589
+ };
15590
+ var defaultResolver = npmResolver();
15591
+
15307
15592
  // src/detectors/d2.ts
15308
15593
  var SESSION_RE = /mcp-session-id/i;
15309
15594
  var GENERATOR_RE = /\bsessionIdGenerator\s*:\s*(?!undefined\b)\S/;
@@ -16193,7 +16478,7 @@ var d6 = {
16193
16478
 
16194
16479
  // src/detectors/d8.ts
16195
16480
  import { existsSync as existsSync12, statSync as statSync15 } from "fs";
16196
- import { dirname as dirname6, join as join18, relative as relative9 } from "path";
16481
+ import { dirname as dirname6, join as join19, relative as relative10 } from "path";
16197
16482
  var POSITIVE_CONTROL2 = 'server.registerTool("list_items", { ... }, handler);';
16198
16483
  function d8PositiveControl() {
16199
16484
  return {
@@ -16213,7 +16498,7 @@ function resolveBaseDir(tree) {
16213
16498
  function findEvalsFile(tree) {
16214
16499
  let dir = resolveBaseDir(tree);
16215
16500
  for (let depth = 0; depth < 8; depth++) {
16216
- const candidate = join18(dir, "evals", "evals.json");
16501
+ const candidate = join19(dir, "evals", "evals.json");
16217
16502
  if (existsSync12(candidate)) return candidate;
16218
16503
  const parent = dirname6(dir);
16219
16504
  if (parent === dir) break;
@@ -16276,7 +16561,7 @@ var d8 = {
16276
16561
  };
16277
16562
  }
16278
16563
  const baseDir = resolveBaseDir(tree);
16279
- const displayPath = relative9(baseDir, evalsPath) || evalsPath;
16564
+ const displayPath = relative10(baseDir, evalsPath) || evalsPath;
16280
16565
  const parsed = readJsonObject(evalsPath);
16281
16566
  if (parsed === null || !Array.isArray(parsed.cases)) {
16282
16567
  return couldNotJudge(
@@ -16367,7 +16652,7 @@ var d8 = {
16367
16652
 
16368
16653
  // src/detectors/d9.ts
16369
16654
  import { existsSync as existsSync13 } from "fs";
16370
- import { dirname as dirname7, join as join19 } from "path";
16655
+ import { dirname as dirname7, join as join20 } from "path";
16371
16656
  var SEMVER_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
16372
16657
  var POSITIVE_CONTROL3 = "1.2.3-beta.1+build.7";
16373
16658
  function d9PositiveControl() {
@@ -16416,7 +16701,7 @@ var d9Inner = {
16416
16701
  };
16417
16702
  }
16418
16703
  const projectDir = dirname7(pkgPath);
16419
- const changelogPath = join19(projectDir, "CHANGELOG.md");
16704
+ const changelogPath = join20(projectDir, "CHANGELOG.md");
16420
16705
  const hasChangelog = existsSync13(changelogPath);
16421
16706
  const validSemver = SEMVER_RE.test(version);
16422
16707
  if (validSemver && hasChangelog) {
@@ -16447,7 +16732,7 @@ var d9 = guardUnreadablePackageJson(d9Inner, { authoritative: false });
16447
16732
 
16448
16733
  // src/detectors/d10.ts
16449
16734
  import { existsSync as existsSync14 } from "fs";
16450
- import { dirname as dirname8, join as join20 } from "path";
16735
+ import { dirname as dirname8, join as join21 } from "path";
16451
16736
  var DESCRIPTION_FR_RE = /"description_fr"\s*:\s*"[^"]+"/;
16452
16737
  var POSITIVE_CONTROL4 = '"description_fr": "Un serveur MCP conforme.",';
16453
16738
  function d10PositiveControl() {
@@ -16580,7 +16865,7 @@ var d10Inner = {
16580
16865
  };
16581
16866
  }
16582
16867
  const hasDescriptionFr = hasDescriptionFrJson || sourceScan.present;
16583
- const readmeFrPath = join20(root, "README.fr.md");
16868
+ const readmeFrPath = join21(root, "README.fr.md");
16584
16869
  const hasReadmeFr = existsSync14(readmeFrPath);
16585
16870
  const missing = [];
16586
16871
  if (!hasDescriptionFr) missing.push("description_fr (package.json or source _meta)");
@@ -16879,8 +17164,8 @@ var d15 = {
16879
17164
  };
16880
17165
 
16881
17166
  // src/detectors/d16.ts
16882
- import { existsSync as existsSync15, readFileSync as readFileSync16, statSync as statSync16 } from "fs";
16883
- import { dirname as dirname9, join as join21 } from "path";
17167
+ import { existsSync as existsSync15, readFileSync as readFileSync17, statSync as statSync16 } from "fs";
17168
+ import { dirname as dirname9, join as join22 } from "path";
16884
17169
  var DISCOVER_RE2 = /server\/discover|DiscoverResult|ServerDiscover|handleServerDiscover/;
16885
17170
  var HEALTH_ROUTE_FRAMEWORK_RE = /\b[A-Za-z_$][\w$]*\.(?:get|post|put|patch|delete|all|route|use)\s*\(\s*["'`][^"'`]*\/health/;
16886
17171
  var HEALTH_ROUTE_RAWPATH_RE = /\bpathname\s*===?\s*["'`][^"'`]*\/health/;
@@ -16964,7 +17249,7 @@ function manifestVersionEqualsPackage(tree) {
16964
17249
  if (typeof pkgVersion !== "string" || pkgVersion.length === 0 || !tree.packageJson) return false;
16965
17250
  try {
16966
17251
  const manifest = JSON.parse(
16967
- readFileSync16(join21(dirname9(tree.packageJson.path), "mcp-server.json"), "utf8")
17252
+ readFileSync17(join22(dirname9(tree.packageJson.path), "mcp-server.json"), "utf8")
16968
17253
  );
16969
17254
  return manifest.version === pkgVersion;
16970
17255
  } catch {
@@ -17252,10 +17537,10 @@ function readPackageVersion(root) {
17252
17537
  try {
17253
17538
  let dir = statSync16(root).isDirectory() ? root : dirname9(root);
17254
17539
  for (let depth = 0; depth < 8; depth++) {
17255
- const candidate = join21(dir, "package.json");
17540
+ const candidate = join22(dir, "package.json");
17256
17541
  if (existsSync15(candidate)) {
17257
17542
  if (!statSync16(candidate).isFile()) return null;
17258
- const pkg = JSON.parse(readFileSync16(candidate, "utf8"));
17543
+ const pkg = JSON.parse(readFileSync17(candidate, "utf8"));
17259
17544
  return typeof pkg.version === "string" ? pkg.version : null;
17260
17545
  }
17261
17546
  const parent = dirname9(dir);
@@ -17269,8 +17554,8 @@ function readPackageVersion(root) {
17269
17554
  }
17270
17555
 
17271
17556
  // src/detectors/dAppI18n.ts
17272
- import { existsSync as existsSync16, readFileSync as readFileSync17, statSync as statSync17 } from "fs";
17273
- import { dirname as dirname10, join as join22 } from "path";
17557
+ import { existsSync as existsSync16, readFileSync as readFileSync18, statSync as statSync17 } from "fs";
17558
+ import { dirname as dirname10, join as join23 } from "path";
17274
17559
  function flattenKeys(obj, prefix = "") {
17275
17560
  if (obj === null || typeof obj !== "object" || Array.isArray(obj)) {
17276
17561
  return prefix ? [prefix] : [];
@@ -17304,7 +17589,7 @@ function dAppI18nPositiveControls() {
17304
17589
  function readJson3(path) {
17305
17590
  try {
17306
17591
  if (!statSync17(path).isFile()) return { ok: false };
17307
- return { ok: true, value: JSON.parse(readFileSync17(path, "utf8")) };
17592
+ return { ok: true, value: JSON.parse(readFileSync18(path, "utf8")) };
17308
17593
  } catch {
17309
17594
  return { ok: false };
17310
17595
  }
@@ -17321,9 +17606,9 @@ var dAppI18n = {
17321
17606
  );
17322
17607
  }
17323
17608
  const root = tree.packageJson ? dirname10(tree.packageJson.path) : tree.root;
17324
- const i18nDir = join22(root, "i18n");
17325
- const enPath = join22(i18nDir, "en.json");
17326
- const frPath = join22(i18nDir, "fr.json");
17609
+ const i18nDir = join23(root, "i18n");
17610
+ const enPath = join23(i18nDir, "en.json");
17611
+ const frPath = join23(i18nDir, "fr.json");
17327
17612
  const hasI18n = existsSync16(i18nDir);
17328
17613
  const hasFr = existsSync16(frPath);
17329
17614
  if (!hasI18n && !hasFr) {
@@ -17502,27 +17787,27 @@ var dDebugOptIn = {
17502
17787
  };
17503
17788
 
17504
17789
  // src/detectors/extManifests.ts
17505
- import { readdirSync as readdirSync12, statSync as statSync18 } from "fs";
17506
- import { join as join23 } from "path";
17790
+ import { readdirSync as readdirSync13, statSync as statSync18 } from "fs";
17791
+ import { join as join24 } from "path";
17507
17792
  function findExtensionManifests(tree) {
17508
17793
  const out = [];
17509
17794
  const root = tree.root;
17510
17795
  let base;
17511
17796
  try {
17512
- base = statSync18(root).isDirectory() ? root : join23(root, "..");
17797
+ base = statSync18(root).isDirectory() ? root : join24(root, "..");
17513
17798
  } catch {
17514
17799
  return out;
17515
17800
  }
17516
17801
  const walk3 = (dir) => {
17517
17802
  let entries;
17518
17803
  try {
17519
- entries = readdirSync12(dir);
17804
+ entries = readdirSync13(dir);
17520
17805
  } catch (err) {
17521
17806
  recordSkip(tree, dir, base, `could not be listed (${fsErrorCode(err)}) \u2014 not read`);
17522
17807
  return;
17523
17808
  }
17524
17809
  for (const name of entries) {
17525
- const full = join23(dir, name);
17810
+ const full = join24(dir, name);
17526
17811
  let st;
17527
17812
  try {
17528
17813
  st = statSync18(full);
@@ -17550,8 +17835,8 @@ function findExtensionManifests(tree) {
17550
17835
  }
17551
17836
 
17552
17837
  // src/detectors/vendorRegistry.ts
17553
- import { existsSync as existsSync17, readFileSync as readFileSync18 } from "fs";
17554
- import { dirname as dirname11, join as join24 } from "path";
17838
+ import { existsSync as existsSync17, readFileSync as readFileSync19 } from "fs";
17839
+ import { dirname as dirname11, join as join25 } from "path";
17555
17840
  import { fileURLToPath } from "url";
17556
17841
  function locateRegistry() {
17557
17842
  let dir;
@@ -17561,7 +17846,7 @@ function locateRegistry() {
17561
17846
  return null;
17562
17847
  }
17563
17848
  for (let depth = 0; depth < 5; depth++) {
17564
- const candidate = join24(dir, "vendor-namespaces.json");
17849
+ const candidate = join25(dir, "vendor-namespaces.json");
17565
17850
  if (existsSync17(candidate)) return candidate;
17566
17851
  const parent = dirname11(dir);
17567
17852
  if (parent === dir) break;
@@ -17579,7 +17864,7 @@ function loadRegistry(path) {
17579
17864
  }
17580
17865
  let parsed;
17581
17866
  try {
17582
- parsed = JSON.parse(readFileSync18(p, "utf8"));
17867
+ parsed = JSON.parse(readFileSync19(p, "utf8"));
17583
17868
  } catch (err) {
17584
17869
  return {
17585
17870
  ok: false,
@@ -18209,8 +18494,8 @@ var dExt3 = {
18209
18494
  };
18210
18495
 
18211
18496
  // src/detectors/dExt4.ts
18212
- import { readdirSync as readdirSync13, statSync as statSync19 } from "fs";
18213
- import { join as join25, relative as relative10 } from "path";
18497
+ import { readdirSync as readdirSync14, statSync as statSync19 } from "fs";
18498
+ import { join as join26, relative as relative11 } from "path";
18214
18499
  function canonical(name) {
18215
18500
  return name.replace(/[-_]/g, "").toLowerCase();
18216
18501
  }
@@ -18234,13 +18519,13 @@ function findHooksDirs(tree, unreadable2, gaps) {
18234
18519
  const out = [];
18235
18520
  let base;
18236
18521
  try {
18237
- base = statSync19(root).isDirectory() ? root : join25(root, "..");
18522
+ base = statSync19(root).isDirectory() ? root : join26(root, "..");
18238
18523
  } catch {
18239
18524
  return out;
18240
18525
  }
18241
18526
  const noteUnread = (path, what, err) => {
18242
18527
  gaps.count++;
18243
- const anchor = relative10(base, path) || ".";
18528
+ const anchor = relative11(base, path) || ".";
18244
18529
  const reason = `${anchor} ${what} (${fsErrorCode(err)}) \u2014 a hooks/ directory under it may exist unseen, so the implemented hooks are unverifiable (Extension Rule 4)`;
18245
18530
  if (!unreadable2.some((u) => u.anchor === anchor && u.reason === reason)) {
18246
18531
  unreadable2.push({ anchor, reason });
@@ -18249,13 +18534,13 @@ function findHooksDirs(tree, unreadable2, gaps) {
18249
18534
  const walk3 = (dir) => {
18250
18535
  let entries;
18251
18536
  try {
18252
- entries = readdirSync13(dir);
18537
+ entries = readdirSync14(dir);
18253
18538
  } catch (err) {
18254
18539
  noteUnread(dir, "could not be listed", err);
18255
18540
  return;
18256
18541
  }
18257
18542
  for (const name of entries) {
18258
- const full = join25(dir, name);
18543
+ const full = join26(dir, name);
18259
18544
  let st;
18260
18545
  try {
18261
18546
  st = statSync19(full);
@@ -18273,7 +18558,7 @@ function findHooksDirs(tree, unreadable2, gaps) {
18273
18558
  const tokens = /* @__PURE__ */ new Set();
18274
18559
  let files;
18275
18560
  try {
18276
- files = readdirSync13(full);
18561
+ files = readdirSync14(full);
18277
18562
  } catch (err) {
18278
18563
  noteUnread(full, "could not be listed", err);
18279
18564
  files = [];
@@ -18437,7 +18722,7 @@ var dExt4 = {
18437
18722
 
18438
18723
  // src/detectors/dExt5.ts
18439
18724
  import { existsSync as existsSync18 } from "fs";
18440
- import { dirname as dirname12, join as join26 } from "path";
18725
+ import { dirname as dirname12, join as join27 } from "path";
18441
18726
  function nonEmptyString(v) {
18442
18727
  return typeof v === "string" && v.trim().length > 0;
18443
18728
  }
@@ -18499,7 +18784,7 @@ var dExt5 = {
18499
18784
  if (!nonEmptyString(parsed.description_fr)) {
18500
18785
  missing.push("description_fr (extension.json)");
18501
18786
  }
18502
- if (!existsSync18(join26(root, "README.fr.md"))) {
18787
+ if (!existsSync18(join27(root, "README.fr.md"))) {
18503
18788
  missing.push("README.fr.md");
18504
18789
  }
18505
18790
  if (isToolExtension(parsed.type) && "tools" in parsed) {
@@ -18543,7 +18828,7 @@ var dExt5 = {
18543
18828
 
18544
18829
  // src/detectors/dExt7.ts
18545
18830
  import { existsSync as existsSync19 } from "fs";
18546
- import { dirname as dirname13, join as join27 } from "path";
18831
+ import { dirname as dirname13, join as join28 } from "path";
18547
18832
  var ABSENCE_FLAG_FIELDS = [
18548
18833
  "extensionAbsent",
18549
18834
  "extension_absent",
@@ -18615,7 +18900,7 @@ var dExt7 = {
18615
18900
  for (const manifestPath2 of manifests) {
18616
18901
  const extDir = dirname13(manifestPath2);
18617
18902
  const extLabel = extDir.split("/").pop() ?? extDir;
18618
- const evalsPath = join27(extDir, "evals", "evals.json");
18903
+ const evalsPath = join28(extDir, "evals", "evals.json");
18619
18904
  const shortPath = `${extLabel}/evals/evals.json`;
18620
18905
  if (!existsSync19(evalsPath)) {
18621
18906
  return {
@@ -18682,7 +18967,7 @@ var dExt7 = {
18682
18967
 
18683
18968
  // src/detectors/dExt8.ts
18684
18969
  import { existsSync as existsSync20 } from "fs";
18685
- import { dirname as dirname14, join as join28 } from "path";
18970
+ import { dirname as dirname14, join as join29 } from "path";
18686
18971
  var SEMVER_RE2 = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
18687
18972
  var POSITIVE_CONTROL5 = "1.2.3-beta.1+build.7";
18688
18973
  function dExt8PositiveControl() {
@@ -18718,7 +19003,7 @@ var dExt8 = {
18718
19003
  for (const manifestPath2 of manifests) {
18719
19004
  const extDir = dirname14(manifestPath2);
18720
19005
  const extLabel = extDir.split("/").pop() ?? extDir;
18721
- const pkgPath = join28(extDir, "package.json");
19006
+ const pkgPath = join29(extDir, "package.json");
18722
19007
  const shortPkgPath = `${extLabel}/package.json`;
18723
19008
  if (!existsSync20(pkgPath)) {
18724
19009
  unreadable2.push({
@@ -18755,7 +19040,7 @@ var dExt8 = {
18755
19040
  continue;
18756
19041
  }
18757
19042
  const validSemver = SEMVER_RE2.test(version);
18758
- const changelogPath = join28(extDir, "CHANGELOG.md");
19043
+ const changelogPath = join29(extDir, "CHANGELOG.md");
18759
19044
  const hasChangelog = existsSync20(changelogPath);
18760
19045
  if (!validSemver) {
18761
19046
  finding ??= {
@@ -18790,20 +19075,20 @@ var dExt8 = {
18790
19075
  };
18791
19076
 
18792
19077
  // src/detectors/dExt9.ts
18793
- import { readFileSync as readFileSync19, readdirSync as readdirSync14, statSync as statSync20 } from "fs";
18794
- import { join as join29, relative as relative11 } from "path";
19078
+ import { readFileSync as readFileSync20, readdirSync as readdirSync15, statSync as statSync20 } from "fs";
19079
+ import { join as join30, relative as relative12 } from "path";
18795
19080
  function collectHooksDirSources(tree, unreadable2, gaps) {
18796
19081
  const root = tree.root;
18797
19082
  const out = [];
18798
19083
  let base;
18799
19084
  try {
18800
- base = statSync20(root).isDirectory() ? root : join29(root, "..");
19085
+ base = statSync20(root).isDirectory() ? root : join30(root, "..");
18801
19086
  } catch {
18802
19087
  return out;
18803
19088
  }
18804
19089
  const noteUnread = (path, what, err) => {
18805
19090
  gaps.count++;
18806
- const anchor = relative11(base, path) || ".";
19091
+ const anchor = relative12(base, path) || ".";
18807
19092
  const reason = `${anchor} ${what} (${fsErrorCode(err)}) \u2014 a hooks/ directory under it may exist unseen, so the timeout guards are undeterminable (Extension Rule 9)`;
18808
19093
  if (!unreadable2.some((u) => u.anchor === anchor && u.reason === reason)) {
18809
19094
  unreadable2.push({ anchor, reason });
@@ -18812,13 +19097,13 @@ function collectHooksDirSources(tree, unreadable2, gaps) {
18812
19097
  const walk3 = (dir) => {
18813
19098
  let entries;
18814
19099
  try {
18815
- entries = readdirSync14(dir);
19100
+ entries = readdirSync15(dir);
18816
19101
  } catch (err) {
18817
19102
  noteUnread(dir, "could not be listed", err);
18818
19103
  return;
18819
19104
  }
18820
19105
  for (const name of entries) {
18821
- const full = join29(dir, name);
19106
+ const full = join30(dir, name);
18822
19107
  let st;
18823
19108
  try {
18824
19109
  st = statSync20(full);
@@ -18835,7 +19120,7 @@ function collectHooksDirSources(tree, unreadable2, gaps) {
18835
19120
  if (name === "hooks") {
18836
19121
  let files;
18837
19122
  try {
18838
- files = readdirSync14(full);
19123
+ files = readdirSync15(full);
18839
19124
  } catch (err) {
18840
19125
  noteUnread(full, "could not be listed", err);
18841
19126
  files = [];
@@ -18844,11 +19129,11 @@ function collectHooksDirSources(tree, unreadable2, gaps) {
18844
19129
  if (!f.endsWith(".ts") || f.endsWith(".d.ts")) continue;
18845
19130
  const stem = f.replace(/\.ts$/, "");
18846
19131
  if (stem === "index") continue;
18847
- const filePath = join29(full, f);
19132
+ const filePath = join30(full, f);
18848
19133
  let body;
18849
19134
  try {
18850
19135
  if (!statSync20(filePath).isFile()) throw new Error("not a regular file");
18851
- body = readFileSync19(filePath, "utf8");
19136
+ body = readFileSync20(filePath, "utf8");
18852
19137
  } catch {
18853
19138
  const shortPath = filePath.split("/").slice(-2).join("/");
18854
19139
  unreadable2.push({
@@ -19940,7 +20225,7 @@ function codeText(file) {
19940
20225
  }
19941
20226
  return { file, text: parts.join(""), kind: Uint8Array.from(kinds), lineStart };
19942
20227
  }
19943
- function lineOf2(ct, off) {
20228
+ function lineOf3(ct, off) {
19944
20229
  let lo = 0;
19945
20230
  let hi = ct.lineStart.length - 1;
19946
20231
  while (lo < hi) {
@@ -20066,8 +20351,8 @@ function on401Path(ct, siteStart, siteEnd) {
20066
20351
  }
20067
20352
  }
20068
20353
  }
20069
- const first = Math.max(1, lineOf2(ct, siteStart) - PATH_LINES_BEFORE);
20070
- const last = Math.min(ct.lineStart.length, lineOf2(ct, siteEnd) + PATH_LINES_AFTER);
20354
+ const first = Math.max(1, lineOf3(ct, siteStart) - PATH_LINES_BEFORE);
20355
+ const last = Math.min(ct.lineStart.length, lineOf3(ct, siteEnd) + PATH_LINES_AFTER);
20071
20356
  const from = Math.max(blockStart, ct.lineStart[first - 1]);
20072
20357
  const to = Math.min(blockEnd2, last < ct.lineStart.length ? ct.lineStart[last] : t.length);
20073
20358
  for (const m of t.slice(from, to).matchAll(/\b401\b/g)) {
@@ -20085,7 +20370,7 @@ function scanChallengeSites(files) {
20085
20370
  const open = m.index ?? 0;
20086
20371
  const close2 = open + m[0].length - 1;
20087
20372
  if (ct.kind[open] !== 1 || ct.kind[close2] !== 1) continue;
20088
- const anchor = `${file.rel}:${lineOf2(ct, open)}`;
20373
+ const anchor = `${file.rel}:${lineOf3(ct, open)}`;
20089
20374
  const before = t.slice(Math.max(0, open - 200), open);
20090
20375
  const after = t.slice(close2 + 1, close2 + 200);
20091
20376
  let form = null;
@@ -20686,7 +20971,7 @@ function configPlaces(tree, reg) {
20686
20971
  meta: placeOf(tree, config, "_meta")
20687
20972
  };
20688
20973
  }
20689
- function lineOf3(anchor) {
20974
+ function lineOf4(anchor) {
20690
20975
  const i = anchor.lastIndexOf(":");
20691
20976
  return [anchor.slice(0, i), Number(anchor.slice(i + 1))];
20692
20977
  }
@@ -20792,8 +21077,8 @@ function judgeStatic(tree, id) {
20792
21077
  to: fn ? lineAt(gate.src.shape, fn.close) : lineAt(gate.src.shape, gate.at) + 1
20793
21078
  }));
20794
21079
  regUnread = unread2.filter((u) => {
20795
- const [rel, n] = lineOf3(u.anchor);
20796
- return !spans.some((sp) => sp.rel === rel && n >= sp.from && n <= sp.to);
21080
+ const [rel2, n] = lineOf4(u.anchor);
21081
+ return !spans.some((sp) => sp.rel === rel2 && n >= sp.from && n <= sp.to);
20797
21082
  });
20798
21083
  for (const { gate, fn } of installers) {
20799
21084
  const ex = gateExemptions(tree, gate, fn);
@@ -20844,7 +21129,7 @@ function judgeStatic(tree, id) {
20844
21129
  }
20845
21130
  const decided = problems.length > 0 ? {
20846
21131
  id,
20847
- anchor: lineOf3(problems[0].match(/\(([^()\s]+:\d+)\)/)?.[1] ?? "-:0").join(":"),
21132
+ anchor: lineOf4(problems[0].match(/\(([^()\s]+:\d+)\)/)?.[1] ?? "-:0").join(":"),
20848
21133
  state: "non-conforming",
20849
21134
  verdict: `${problems.join("; ")} -> every tool declares { domain, mode } (mode exactly read | write, read <-> readOnlyHint true), and the shared decision of ${CLOUD_IDENTITY} refuses tools/call and filters tools/list for every registered tool (mcp-server-standard "Agent tool roles", rules 2-4, 7)`
20850
21135
  } : {
@@ -21393,7 +21678,7 @@ var e10MrtrOnly = {
21393
21678
 
21394
21679
  // src/detectors/e11-surfaces-derived.ts
21395
21680
  import { existsSync as existsSync21, statSync as statSync21 } from "fs";
21396
- import { dirname as dirname15, join as join30, relative as relative12, sep as sep6 } from "path";
21681
+ import { dirname as dirname15, join as join31, relative as relative13, sep as sep7 } from "path";
21397
21682
  var ALL = ["chat", "cowork", "claude-code"];
21398
21683
  function excludedSurfaces(c) {
21399
21684
  const cause = /* @__PURE__ */ new Map();
@@ -21465,7 +21750,7 @@ var e11SurfacesDerived = {
21465
21750
  continue;
21466
21751
  }
21467
21752
  const folder = dirname15(m.path);
21468
- const rel = (p) => relative12(tree.root, p).split(sep6).join("/") || ".";
21753
+ const rel2 = (p) => relative13(tree.root, p).split(sep7).join("/") || ".";
21469
21754
  if (!Array.isArray(j.surfaces)) {
21470
21755
  reds.push({
21471
21756
  anchor: m.rel,
@@ -21482,14 +21767,14 @@ var e11SurfacesDerived = {
21482
21767
  text: `${m.rel} surfaces ${unknown.join(", ")} are not in {${ALL.join(", ")}}`
21483
21768
  });
21484
21769
  }
21485
- const mcp = join30(folder, ".mcp.json");
21770
+ const mcp = join31(folder, ".mcp.json");
21486
21771
  let localMcp = false;
21487
21772
  if (existsSync21(mcp)) {
21488
21773
  const mj = readJsonRecord(mcp);
21489
21774
  if (!mj)
21490
21775
  unreadable2.push({
21491
- anchor: rel(mcp),
21492
- reason: `${rel(mcp)} is not a parseable JSON object \u2014 local MCP commands are unread`
21776
+ anchor: rel2(mcp),
21777
+ reason: `${rel2(mcp)} is not a parseable JSON object \u2014 local MCP commands are unread`
21493
21778
  });
21494
21779
  else {
21495
21780
  const servers = isRecord(mj.mcpServers) ? mj.mcpServers : mj;
@@ -21501,9 +21786,9 @@ var e11SurfacesDerived = {
21501
21786
  }
21502
21787
  }
21503
21788
  const cause = excludedSurfaces({
21504
- bin: isDir(join30(folder, "bin"), rel(join30(folder, "bin")), unreadable2),
21505
- hooks: isDir(join30(folder, "hooks"), rel(join30(folder, "hooks")), unreadable2),
21506
- agents: isDir(join30(folder, "agents"), rel(join30(folder, "agents")), unreadable2),
21789
+ bin: isDir(join31(folder, "bin"), rel2(join31(folder, "bin")), unreadable2),
21790
+ hooks: isDir(join31(folder, "hooks"), rel2(join31(folder, "hooks")), unreadable2),
21791
+ agents: isDir(join31(folder, "agents"), rel2(join31(folder, "agents")), unreadable2),
21507
21792
  localMcp
21508
21793
  });
21509
21794
  for (const s of declared) {
@@ -21627,8 +21912,8 @@ var e12HostCapabilityPlacement = {
21627
21912
  };
21628
21913
 
21629
21914
  // src/detectors/installedAs.ts
21630
- import { readdirSync as readdirSync15, statSync as statSync22 } from "fs";
21631
- import { join as join31 } from "path";
21915
+ import { readFileSync as readFileSync21, readdirSync as readdirSync16, statSync as statSync22 } from "fs";
21916
+ import { dirname as dirname16, join as join32, relative as relative14, sep as sep8 } from "path";
21632
21917
  var KEY = (k) => `(?:\\[\\s*["'\`]${k}["'\`]\\s*\\]|["']${k}["']|\\b${k}\\b)`;
21633
21918
  function keyRe(key) {
21634
21919
  return new RegExp(`${KEY(key)}\\s*(?<sep>:)`);
@@ -21649,17 +21934,193 @@ var REGISTER_HANDLER_RE = /\.(?:get|post|put|all|on|route)\s*(?<sep>\()\s*(?:["'
21649
21934
  var REGISTER_MOUNT_RE = /\.use\s*(?<sep>\()\s*["'`]\/register["'`]/;
21650
21935
  var REGISTER_LITERAL_RE = /(?<sep>["'`])\/register["'`]/;
21651
21936
  var ROUTE_RE = /["'`]\/?\.well-known\/oauth-authorization-server["'`]/;
21937
+ var ENTRY_FIELDS = ["exports", "main", "module", "bin"];
21938
+ var IMPORT_RE = /\b(?:from|import)\s*(["'])([^"'\n]+)\1|\b(?:import|require)\s*\(\s*(["'`])([^"'`\n]+)\3\s*\)/g;
21939
+ var NONLITERAL_IMPORT_RE = /\b(?:import|require)\s*\((?!\s*["'`])/g;
21940
+ var RESOLVE_SUFFIXES = [
21941
+ "",
21942
+ ".js",
21943
+ ".mjs",
21944
+ ".cjs",
21945
+ ".json",
21946
+ "/index.js",
21947
+ "/index.mjs",
21948
+ "/index.cjs"
21949
+ ];
21950
+ var FIXTURE_DIRS = /* @__PURE__ */ new Set([
21951
+ "test",
21952
+ "tests",
21953
+ "__test__",
21954
+ "__tests__",
21955
+ "test-utils",
21956
+ "spec",
21957
+ "specs",
21958
+ "e2e",
21959
+ "__mocks__",
21960
+ "mocks",
21961
+ "__fixtures__",
21962
+ "fixture",
21963
+ "fixtures",
21964
+ "example",
21965
+ "examples",
21966
+ "samples",
21967
+ "demo",
21968
+ "docs"
21969
+ ]);
21652
21970
  var MAX_BYTES = 1e6;
21653
21971
  var MAX_FILES_PER_PACKAGE = 3e3;
21654
21972
  var SOURCE_EXT = /\.(?:js|mjs|cjs|json)$/;
21973
+ var FACT_KEYS = ["cimd", "registration", "iss", "none"];
21974
+ var countFacts = (f) => FACT_KEYS.filter((k) => f[k]).length;
21655
21975
  function declaredDependencies(tree) {
21656
21976
  const json = tree.packageJson?.json;
21657
21977
  const deps = json && typeof json.dependencies === "object" ? json.dependencies : null;
21658
21978
  return deps && !Array.isArray(deps) ? Object.keys(deps).sort() : [];
21659
21979
  }
21980
+ function declaredEntries(dir, dep, unread2) {
21981
+ let json;
21982
+ try {
21983
+ json = JSON.parse(readFileSync21(join32(dir, "package.json"), "utf8"));
21984
+ } catch (e) {
21985
+ if (e.code === "ENOENT") return null;
21986
+ unread2.push(
21987
+ `${dep}/package.json (not parsed: ${e.message}; the package is not read)`
21988
+ );
21989
+ return [];
21990
+ }
21991
+ if (!json || typeof json !== "object" || Array.isArray(json)) {
21992
+ unread2.push(`${dep}/package.json (not an object; the package is not read)`);
21993
+ return [];
21994
+ }
21995
+ const pj = json;
21996
+ if (!ENTRY_FIELDS.some((f) => pj[f] !== void 0)) return null;
21997
+ const targets = [];
21998
+ const collect2 = (v, field) => {
21999
+ if (typeof v === "string") targets.push(v);
22000
+ else if (Array.isArray(v)) for (const x of v) collect2(x, field);
22001
+ else if (v === null)
22002
+ return;
22003
+ else if (typeof v === "object")
22004
+ for (const x of Object.values(v)) collect2(x, field);
22005
+ else
22006
+ unread2.push(
22007
+ `${dep}/package.json (${field}: a ${typeof v} is not an entry form this reader knows: not followed)`
22008
+ );
22009
+ };
22010
+ for (const f of ENTRY_FIELDS) if (pj[f] !== void 0) collect2(pj[f], f);
22011
+ return targets;
22012
+ }
22013
+ function walkPackage(dir, nm, skipFixtures, unread2) {
22014
+ const files = [];
22015
+ const walk3 = (d) => {
22016
+ let names2;
22017
+ try {
22018
+ names2 = readdirSync16(d).sort();
22019
+ } catch (e) {
22020
+ unread2.push(`${d.slice(nm.length + 1)} (directory not listed: ${e.message})`);
22021
+ return;
22022
+ }
22023
+ for (const n of names2) {
22024
+ if (files.length >= MAX_FILES_PER_PACKAGE) return;
22025
+ if (n === "node_modules") continue;
22026
+ const full = join32(d, n);
22027
+ let st;
22028
+ try {
22029
+ st = statSync22(full);
22030
+ } catch (e) {
22031
+ unread2.push(`${full.slice(nm.length + 1)} (not stat'ed: ${e.message})`);
22032
+ continue;
22033
+ }
22034
+ if (st.isDirectory()) {
22035
+ if (skipFixtures && FIXTURE_DIRS.has(n.toLowerCase())) {
22036
+ unread2.push(`${full.slice(nm.length + 1)} (test/example directory: not read)`);
22037
+ continue;
22038
+ }
22039
+ walk3(full);
22040
+ } else if (st.isFile() && SOURCE_EXT.test(n)) files.push(full);
22041
+ }
22042
+ };
22043
+ walk3(dir);
22044
+ return files;
22045
+ }
22046
+ var escapeRe4 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
22047
+ function followEntries(dir, nm, targets, files, load2, unread2) {
22048
+ const dep = dir.slice(nm.length + 1);
22049
+ const show = (f) => f.slice(nm.length + 1);
22050
+ const reached = /* @__PURE__ */ new Set();
22051
+ const queue = [];
22052
+ const enqueue = (f) => {
22053
+ if (reached.has(f)) return;
22054
+ reached.add(f);
22055
+ queue.push(f);
22056
+ };
22057
+ const resolve5 = (base, spec) => {
22058
+ for (const suffix of RESOLVE_SUFFIXES) {
22059
+ const f = join32(base, spec + suffix);
22060
+ if (f !== dir && !f.startsWith(dir + sep8)) return "outside";
22061
+ let st;
22062
+ try {
22063
+ st = statSync22(f);
22064
+ } catch {
22065
+ continue;
22066
+ }
22067
+ if (!st.isFile()) continue;
22068
+ return SOURCE_EXT.test(f) ? { path: f } : "not-source";
22069
+ }
22070
+ return "not-found";
22071
+ };
22072
+ const take = (r, where, spec) => {
22073
+ if (typeof r === "object") enqueue(r.path);
22074
+ else if (r === "not-found") unread2.push(`${where} ("${spec}" not resolved: not followed)`);
22075
+ else if (r === "outside") unread2.push(`${where} ("${spec}" leaves the package: not followed)`);
22076
+ };
22077
+ for (const t of targets) {
22078
+ if (t.includes("*")) {
22079
+ const re = new RegExp(`^${t.replace(/^\.\//, "").split("*").map(escapeRe4).join(".*")}$`);
22080
+ for (const f of files) if (re.test(relative14(dir, f).split(sep8).join("/"))) enqueue(f);
22081
+ continue;
22082
+ }
22083
+ take(resolve5(dir, t), `${dep}/package.json`, t);
22084
+ }
22085
+ while (queue.length > 0) {
22086
+ if (reached.size > MAX_FILES_PER_PACKAGE) {
22087
+ unread2.push(
22088
+ `${dep} (more than ${MAX_FILES_PER_PACKAGE} files reached: the rest were not read)`
22089
+ );
22090
+ break;
22091
+ }
22092
+ const f = queue.shift();
22093
+ const file = load2(f);
22094
+ if (!file || f.endsWith(".json")) continue;
22095
+ const text = file.lines.map((l) => l.raw).join("\n");
22096
+ const at = (index) => {
22097
+ const head = text.slice(0, index);
22098
+ return { n: head.split("\n").length, col: index - (head.lastIndexOf("\n") + 1) };
22099
+ };
22100
+ for (const m of text.matchAll(IMPORT_RE)) {
22101
+ const { n, col } = at(m.index);
22102
+ if (!isCodeAt(file, n, col)) continue;
22103
+ const spec = m[2] ?? m[4];
22104
+ const where = `${show(f)}:${n}`;
22105
+ if (spec.includes("${")) unread2.push(`${where} (import of a computed path: not followed)`);
22106
+ else if (spec.startsWith("./") || spec.startsWith("../"))
22107
+ take(resolve5(dirname16(f), spec), where, spec);
22108
+ else if (spec.startsWith("#"))
22109
+ unread2.push(`${where} (subpath import "${spec}": not followed)`);
22110
+ else if (spec.startsWith("/") || spec.startsWith("file:"))
22111
+ unread2.push(`${where} (absolute import "${spec}": not followed)`);
22112
+ }
22113
+ for (const m of text.matchAll(NONLITERAL_IMPORT_RE)) {
22114
+ const { n, col } = at(m.index);
22115
+ if (isCodeAt(file, n, col))
22116
+ unread2.push(`${show(f)}:${n} (non-literal import/require: its target not followed)`);
22117
+ }
22118
+ }
22119
+ return reached;
22120
+ }
21660
22121
  function readInstalledAs(tree) {
21661
22122
  const out = { installed: false, missing: [], publishers: [], unread: [] };
21662
- const nm = join31(baseOf(tree), "node_modules");
22123
+ const nm = join32(baseOf(tree), "node_modules");
21663
22124
  try {
21664
22125
  out.installed = statSync22(nm).isDirectory();
21665
22126
  } catch {
@@ -21667,74 +22128,75 @@ function readInstalledAs(tree) {
21667
22128
  }
21668
22129
  if (!out.installed) return out;
21669
22130
  const methods = authMethodsRe();
22131
+ const perPublisher = [];
21670
22132
  for (const dep of declaredDependencies(tree)) {
21671
- const dir = join31(nm, dep);
22133
+ const dir = join32(nm, dep);
21672
22134
  try {
21673
22135
  if (!statSync22(dir).isDirectory()) throw new Error("not a directory");
21674
22136
  } catch {
21675
22137
  out.missing.push(dep);
21676
22138
  continue;
21677
22139
  }
21678
- const files = [];
21679
- const walk3 = (d) => {
21680
- let names2;
21681
- try {
21682
- names2 = readdirSync15(d).sort();
21683
- } catch (e) {
21684
- out.unread.push(
21685
- `${d.slice(nm.length + 1)} (directory not listed: ${e.message})`
21686
- );
21687
- return;
21688
- }
21689
- for (const n of names2) {
21690
- if (files.length >= MAX_FILES_PER_PACKAGE) return;
21691
- if (n === "node_modules") continue;
21692
- const full = join31(d, n);
21693
- let st;
21694
- try {
21695
- st = statSync22(full);
21696
- } catch (e) {
21697
- out.unread.push(`${full.slice(nm.length + 1)} (not stat'ed: ${e.message})`);
21698
- continue;
21699
- }
21700
- if (st.isDirectory()) walk3(full);
21701
- else if (st.isFile() && SOURCE_EXT.test(n) && !n.endsWith(".d.ts")) files.push(full);
21702
- }
21703
- };
21704
- walk3(dir);
22140
+ const entries = declaredEntries(dir, dep, out.unread);
22141
+ const files = walkPackage(dir, nm, entries === null, out.unread);
21705
22142
  if (files.length >= MAX_FILES_PER_PACKAGE) {
21706
22143
  out.unread.push(`${dep} (more than ${MAX_FILES_PER_PACKAGE} files: the rest were not read)`);
21707
22144
  }
21708
22145
  const read = [];
21709
- for (const f of files) {
21710
- const rel = f.slice(nm.length + 1);
22146
+ const load2 = (f) => {
22147
+ const rel2 = f.slice(nm.length + 1);
21711
22148
  try {
21712
22149
  if (statSync22(f).size > MAX_BYTES) {
21713
- out.unread.push(`${rel} (larger than ${MAX_BYTES} bytes: not read)`);
21714
- continue;
22150
+ out.unread.push(`${rel2} (larger than ${MAX_BYTES} bytes: not read)`);
22151
+ return void 0;
21715
22152
  }
21716
22153
  const file = loadSourceFile(f, nm);
21717
- read.push({ rel, file, rows: uncommentedLines(file) });
22154
+ read.push({ rel: rel2, file, rows: uncommentedLines(file) });
22155
+ return file;
21718
22156
  } catch (e) {
21719
- out.unread.push(`${rel} (not read: ${e.message})`);
22157
+ out.unread.push(`${rel2} (not read: ${e.message})`);
22158
+ return void 0;
22159
+ }
22160
+ };
22161
+ if (entries === null) {
22162
+ for (const f of files) load2(f);
22163
+ } else {
22164
+ const reached = followEntries(dir, nm, entries, files, load2, out.unread);
22165
+ const manifest = join32(dir, "package.json");
22166
+ const outside = files.filter((f) => f !== manifest && !reached.has(f)).length;
22167
+ if (outside > 0) {
22168
+ out.unread.push(
22169
+ `${dep} (${outside} file${outside === 1 ? "" : "s"} outside what its declared entry points load: not read)`
22170
+ );
21720
22171
  }
21721
22172
  }
21722
- if (!read.some((r) => r.rows.some((row) => ROUTE_RE.test(row)))) continue;
22173
+ const routeFiles = read.filter((r) => r.rows.some((row) => ROUTE_RE.test(row)));
22174
+ if (routeFiles.length === 0) continue;
21723
22175
  out.publishers.push(dep);
21724
22176
  const find = (...res) => {
21725
22177
  for (const re of res) {
21726
- for (const r of read) {
22178
+ for (const r of routeFiles) {
21727
22179
  const n = separatorLines(r.file, re)[0];
21728
22180
  if (n !== void 0) return { anchor: `node_modules/${r.rel}:${n}` };
21729
22181
  }
21730
22182
  }
21731
22183
  return void 0;
21732
22184
  };
21733
- out.cimd ??= find(flagTrueRe("client_id_metadata_document_supported"));
21734
- out.registration ??= find(REGISTRATION_KEY_RE, REGISTER_HANDLER_RE, REGISTER_MOUNT_RE);
21735
- out.iss ??= find(flagTrueRe("authorization_response_iss_parameter_supported"));
21736
- out.none ??= find(methods.none);
21737
- out.authMethodsKeyWithoutNone ??= find(methods.key);
22185
+ const facts = {
22186
+ cimd: find(flagTrueRe("client_id_metadata_document_supported")),
22187
+ registration: find(REGISTRATION_KEY_RE, REGISTER_HANDLER_RE, REGISTER_MOUNT_RE),
22188
+ iss: find(flagTrueRe("authorization_response_iss_parameter_supported")),
22189
+ none: find(methods.none)
22190
+ };
22191
+ perPublisher.push({ dep, facts });
22192
+ }
22193
+ let best;
22194
+ for (const p of perPublisher) {
22195
+ if (!best || countFacts(p.facts) > countFacts(best.facts)) best = p;
22196
+ }
22197
+ if (best && countFacts(best.facts) > 0) {
22198
+ out.factsFrom = best.dep;
22199
+ for (const k of FACT_KEYS) if (best.facts[k]) out[k] = best.facts[k];
21738
22200
  }
21739
22201
  return out;
21740
22202
  }
@@ -21792,7 +22254,7 @@ function delegatedAsElements(tree, fallbackAnchor) {
21792
22254
  const g = inst.cimd && inst.none ? [
21793
22255
  {
21794
22256
  status: "ok",
21795
- text: `CIMD announced (${inst.cimd.anchor}) and "none" listed (${inst.none.anchor}) by the installed ${pk}`,
22257
+ text: `CIMD announced (${inst.cimd.anchor}) and "none" listed (${inst.none.anchor}) by the installed ${inst.factsFrom ?? pk}`,
21796
22258
  anchor: inst.cimd.anchor
21797
22259
  }
21798
22260
  ] : owed(
@@ -21801,7 +22263,7 @@ function delegatedAsElements(tree, fallbackAnchor) {
21801
22263
  const l = inst.iss ? [
21802
22264
  {
21803
22265
  status: "owed",
21804
- text: `the installed ${pk} announces authorization_response_iss_parameter_supported: true (${inst.iss.anchor}); owed (probe): \`iss\` is returned on every authorization response, error responses included`,
22266
+ text: `the installed ${inst.factsFrom ?? pk} announces authorization_response_iss_parameter_supported: true (${inst.iss.anchor}); owed (probe): \`iss\` is returned on every authorization response, error responses included`,
21805
22267
  anchor: inst.iss.anchor
21806
22268
  }
21807
22269
  ] : owed(
@@ -22941,8 +23403,8 @@ var s12ListPagination = {
22941
23403
  for (const [method, anchors] of sites) {
22942
23404
  for (const a of anchors) {
22943
23405
  handled++;
22944
- const rel = a.slice(0, a.lastIndexOf(":"));
22945
- if (!withCursor.has(rel)) {
23406
+ const rel2 = a.slice(0, a.lastIndexOf(":"));
23407
+ if (!withCursor.has(rel2)) {
22946
23408
  reds.push({
22947
23409
  anchor: a,
22948
23410
  text: `${method} is handled at ${a} in a file with no nextCursor (a list that can exceed a page returns nextCursor)`
@@ -24052,7 +24514,7 @@ var s20ScopeMinimization = {
24052
24514
 
24053
24515
  // src/detectors/s21-stdio-proxy-sandbox.ts
24054
24516
  var LAUNCH_RE = /(?<![.\w$])(?:spawn|spawnSync|exec|execSync|execFile|execFileSync|fork)\s*\(|child_process\s*\.\s*(?:spawn|spawnSync|exec|execSync|execFile|execFileSync|fork)\s*\(|\bnew\s+StdioClientTransport\s*\(/g;
24055
- var IMPORT_RE = /child_process|\bexeca\b|StdioClientTransport/;
24517
+ var IMPORT_RE2 = /child_process|\bexeca\b|StdioClientTransport/;
24056
24518
  var SANDBOX_RE = /\b(?:docker|podman|bwrap|bubblewrap|firejail|nsjail|chroot|seccomp|unshare|landlock|gvisor|runsc)\b|\bsandbox\w*\b|--network[= ]none|--read-only/i;
24057
24519
  var LOG_RE = /\blogger\s*\.\s*\w+\s*\(|\blog\s*\.\s*\w+\s*\(|\bconsole\s*\.\s*(?:log|info|warn|error|debug)\s*\(|\b(?:audit|logLaunch|logSpawn|logProcess|logCommand)\w*\s*\(/i;
24058
24520
  var DANGEROUS_RE = /shell\s*:\s*true|["'`](?:sh|bash|zsh|sudo|cmd(?:\.exe)?|powershell(?:\.exe)?)["'`]/;
@@ -24082,7 +24544,7 @@ var s21StdioProxySandbox = {
24082
24544
  if (!isProductSource(file.rel)) continue;
24083
24545
  const rows = uncommentedLines(file);
24084
24546
  const text = rows.join("\n");
24085
- if (!IMPORT_RE.test(text)) continue;
24547
+ if (!IMPORT_RE2.test(text)) continue;
24086
24548
  const launches = [];
24087
24549
  rows.forEach((row, i) => {
24088
24550
  if (new RegExp(LAUNCH_RE.source).test(row)) launches.push(i);
@@ -24998,8 +25460,8 @@ var s27ElicitationFloor = {
24998
25460
  };
24999
25461
 
25000
25462
  // src/detectors/s28-claim-forwarded.ts
25001
- import { existsSync as existsSync22, readFileSync as readFileSync20, readdirSync as readdirSync16, statSync as statSync23 } from "fs";
25002
- import { dirname as dirname16, join as join32, relative as relative13 } from "path";
25463
+ import { existsSync as existsSync22, readFileSync as readFileSync22, readdirSync as readdirSync17, statSync as statSync23 } from "fs";
25464
+ import { dirname as dirname17, join as join33, relative as relative15 } from "path";
25003
25465
 
25004
25466
  // src/detectors/backendReceiver.ts
25005
25467
  var CLIENT_NAME = /convex|client/i;
@@ -25107,14 +25569,14 @@ function splitTop3(m, from, to) {
25107
25569
  function listTs(dir, unread2, out = []) {
25108
25570
  let names2;
25109
25571
  try {
25110
- names2 = readdirSync16(dir);
25572
+ names2 = readdirSync17(dir);
25111
25573
  } catch (err) {
25112
25574
  unread2.push(`${dir} could not be listed (${fsErrorCode(err)})`);
25113
25575
  return out;
25114
25576
  }
25115
25577
  for (const n of names2) {
25116
25578
  if (n === "node_modules" || n === "_generated" || n === "__tests__") continue;
25117
- const p = join32(dir, n);
25579
+ const p = join33(dir, n);
25118
25580
  let st;
25119
25581
  try {
25120
25582
  st = statSync23(p);
@@ -25133,14 +25595,14 @@ function listTs(dir, unread2, out = []) {
25133
25595
  function discoverBackend(root) {
25134
25596
  let dir = root;
25135
25597
  try {
25136
- if (!statSync23(root).isDirectory()) dir = dirname16(root);
25598
+ if (!statSync23(root).isDirectory()) dir = dirname17(root);
25137
25599
  } catch {
25138
25600
  return void 0;
25139
25601
  }
25140
25602
  for (let up2 = 0; up2 < 5; up2++) {
25141
- const cand = join32(dir, "convex");
25142
- if (existsSync22(join32(cand, "schema.ts"))) return cand;
25143
- const parent = dirname16(dir);
25603
+ const cand = join33(dir, "convex");
25604
+ if (existsSync22(join33(cand, "schema.ts"))) return cand;
25605
+ const parent = dirname17(dir);
25144
25606
  if (parent === dir) break;
25145
25607
  dir = parent;
25146
25608
  }
@@ -25151,18 +25613,18 @@ function readDoors(backendRoot, unread2) {
25151
25613
  for (const path of listTs(backendRoot, unread2)) {
25152
25614
  let text;
25153
25615
  try {
25154
- text = readFileSync20(path, "utf8");
25616
+ text = readFileSync22(path, "utf8");
25155
25617
  } catch (err) {
25156
25618
  unread2.push(`${path} could not be read (${fsErrorCode(err)})`);
25157
25619
  continue;
25158
25620
  }
25159
25621
  const file = {
25160
25622
  path,
25161
- rel: relative13(backendRoot, path),
25623
+ rel: relative15(backendRoot, path),
25162
25624
  lines: text.split("\n").map((raw, i) => ({ n: i + 1, raw, comment: false }))
25163
25625
  };
25164
25626
  const m = masked(file);
25165
- const module = relative13(backendRoot, path).replace(/\.ts$/, "").split("\\").join("/");
25627
+ const module = relative15(backendRoot, path).replace(/\.ts$/, "").split("\\").join("/");
25166
25628
  const re = /\bexport\s+const\s+([A-Za-z_$][\w$]*)\s*=\s*(?:query|mutation|action)\s*\(/g;
25167
25629
  for (let hit = re.exec(m); hit; hit = re.exec(m)) {
25168
25630
  const open = hit.index + hit[0].length - 1;
@@ -28650,10 +29112,10 @@ var s41LakeReader = {
28650
29112
  };
28651
29113
 
28652
29114
  // src/detectors/s42-write-read-claims.ts
28653
- import { readFileSync as readFileSync21 } from "fs";
28654
- import { relative as relative14 } from "path";
29115
+ import { readFileSync as readFileSync23 } from "fs";
29116
+ import { relative as relative16 } from "path";
28655
29117
  var ID9 = "S42 write-read-claims";
28656
- var RULE9 = "S-42";
29118
+ var RULE10 = "S-42";
28657
29119
  var CLAIMS = ["verifiedOrg", "verifiedPerson", "verifiedActor", "seatOrgSlug"];
28658
29120
  var KEY_RE = new RegExp(`\\b(${CLAIMS.join("|")})\\s*\\??\\s*:`, "g");
28659
29121
  var CALL_RE4 = /\b([A-Za-z_$][\w$]*)\s*\.\s*(query|mutation|action)\s*\(/g;
@@ -28698,18 +29160,18 @@ function readDoorAccess(backendRoot, unread2) {
28698
29160
  for (const path of listTs(backendRoot, unread2)) {
28699
29161
  let text;
28700
29162
  try {
28701
- text = readFileSync21(path, "utf8");
29163
+ text = readFileSync23(path, "utf8");
28702
29164
  } catch (err) {
28703
29165
  unread2.push(`${path} could not be read (${fsErrorCode(err)})`);
28704
29166
  continue;
28705
29167
  }
28706
29168
  const file = {
28707
29169
  path,
28708
- rel: relative14(backendRoot, path),
29170
+ rel: relative16(backendRoot, path),
28709
29171
  lines: text.split("\n").map((raw, i) => ({ n: i + 1, raw, comment: false }))
28710
29172
  };
28711
29173
  const m = masked(file);
28712
- const module = relative14(backendRoot, path).replace(/\.ts$/, "").split("\\").join("/");
29174
+ const module = relative16(backendRoot, path).replace(/\.ts$/, "").split("\\").join("/");
28713
29175
  const re = /\bexport\s+const\s+([A-Za-z_$][\w$]*)\s*=\s*(query|mutation|action|internalMutation|internalQuery)\s*\(/g;
28714
29176
  for (let hit = re.exec(m); hit; hit = re.exec(m)) {
28715
29177
  const open = hit.index + hit[0].length - 1;
@@ -28782,14 +29244,14 @@ function scanS42(tree) {
28782
29244
  if (door !== void 0 || importsConvex(m, text))
28783
29245
  unread2.push({
28784
29246
  anchor: at,
28785
- reason: `${tool}: the receiver is not resolved to a backend client \u2014 ${rcv.why} (${RULE9})`
29247
+ reason: `${tool}: the receiver is not resolved to a backend client \u2014 ${rcv.why} (${RULE10})`
28786
29248
  });
28787
29249
  continue;
28788
29250
  }
28789
29251
  if (door === void 0) {
28790
29252
  unread2.push({
28791
29253
  anchor: at,
28792
- reason: `${tool}: a backend door named by an expression (${RULE9})`
29254
+ reason: `${tool}: a backend door named by an expression (${RULE10})`
28793
29255
  });
28794
29256
  continue;
28795
29257
  }
@@ -28815,7 +29277,7 @@ function scanS42(tree) {
28815
29277
  if (unresolved !== void 0) {
28816
29278
  unread2.push({
28817
29279
  anchor: at,
28818
- reason: `${tool}: the claims spread by ${unresolved}(...) cannot be resolved (no definition with readable claim keys in the tree) (${RULE9})`
29280
+ reason: `${tool}: the claims spread by ${unresolved}(...) cannot be resolved (no definition with readable claim keys in the tree) (${RULE10})`
28819
29281
  });
28820
29282
  continue;
28821
29283
  }
@@ -28826,12 +29288,12 @@ function scanS42(tree) {
28826
29288
  if (calls.length > 0 && !backendRoot)
28827
29289
  unread2.push({
28828
29290
  anchor: tree.root,
28829
- reason: `no backend source found above the scanned tree, so no door's table can be read (${RULE9})`
29291
+ reason: `no backend source found above the scanned tree, so no door's table can be read (${RULE10})`
28830
29292
  });
28831
29293
  const fsUnread = [];
28832
29294
  const access = backendRoot ? readDoorAccess(backendRoot, fsUnread) : /* @__PURE__ */ new Map();
28833
29295
  for (const u of fsUnread)
28834
- unread2.push({ anchor: backendRoot ?? tree.root, reason: `${u} (${RULE9})` });
29296
+ unread2.push({ anchor: backendRoot ?? tree.root, reason: `${u} (${RULE10})` });
28835
29297
  return { calls, unread: unread2, backend: backendRoot, access };
28836
29298
  }
28837
29299
  function runStatic3(tree) {
@@ -28841,7 +29303,7 @@ function runStatic3(tree) {
28841
29303
  id: ID9,
28842
29304
  anchor: tree.root,
28843
29305
  state: "absent",
28844
- verdict: `no backend door call in the tree \u2014 ${RULE9} n/a`
29306
+ verdict: `no backend door call in the tree \u2014 ${RULE10} n/a`
28845
29307
  };
28846
29308
  const writesOf = /* @__PURE__ */ new Map();
28847
29309
  const readsOf = /* @__PURE__ */ new Map();
@@ -28851,7 +29313,7 @@ function runStatic3(tree) {
28851
29313
  if (c.claims.size > 0 || c.keyed)
28852
29314
  unread2.push({
28853
29315
  anchor: c.at,
28854
- reason: `${c.tool}: door ${c.door} is not defined in the backend read (${RULE9})`
29316
+ reason: `${c.tool}: door ${c.door} is not defined in the backend read (${RULE10})`
28855
29317
  });
28856
29318
  continue;
28857
29319
  }
@@ -28885,29 +29347,29 @@ function runStatic3(tree) {
28885
29347
  id: ID9,
28886
29348
  anchor: red[0].slice(red[0].indexOf("(") + 1).split(", ")[1]?.replace(")", "") ?? tree.root,
28887
29349
  state: "non-conforming",
28888
- verdict: `${red.length} write/read claim mismatch(es): a row written without a claim its reads forward is stored where those reads cannot return it (${RULE9}): ${red.join("; ")}.`
29350
+ verdict: `${red.length} write/read claim mismatch(es): a row written without a claim its reads forward is stored where those reads cannot return it (${RULE10}): ${red.join("; ")}.`
28889
29351
  } : {
28890
29352
  id: ID9,
28891
29353
  anchor: tree.root,
28892
29354
  state: "present",
28893
- verdict: `${compared} table(s) with both a write and a read tool compared: every write forwards the claims its reads forward${keyedTables.length > 0 ? `; resolved by one helper keyed by the door on ${keyedTables.join(", ")}` : ""} (${RULE9}).`
29355
+ verdict: `${compared} table(s) with both a write and a read tool compared: every write forwards the claims its reads forward${keyedTables.length > 0 ? `; resolved by one helper keyed by the door on ${keyedTables.join(", ")}` : ""} (${RULE10}).`
28894
29356
  };
28895
29357
  return settle(ID9, decided, unread2);
28896
29358
  }
28897
29359
  var s42WriteReadClaims = {
28898
29360
  id: ID9,
28899
- rule: RULE9,
29361
+ rule: RULE10,
28900
29362
  pin: STANDARD_PIN,
28901
29363
  run: runStatic3
28902
29364
  };
28903
29365
 
28904
29366
  // src/detectors/s44-closed-output.ts
28905
29367
  var ID10 = "S44 closed-output";
28906
- var RULE10 = "S-44";
29368
+ var RULE11 = "S-44";
28907
29369
  function judge(sites, j) {
28908
29370
  for (const s of sites) {
28909
29371
  if (s.kind === "unread")
28910
- j.unread.push({ anchor: s.anchor, reason: `${s.path}: ${s.form} (${RULE10})` });
29372
+ j.unread.push({ anchor: s.anchor, reason: `${s.path}: ${s.form} (${RULE11})` });
28911
29373
  else if (s.exempt) j.exempt.push(s);
28912
29374
  else j.violations.push(s);
28913
29375
  }
@@ -28919,18 +29381,18 @@ function verdictOf2(j, scope2, anchorFallback) {
28919
29381
  id: ID10,
28920
29382
  anchor: anchorFallback,
28921
29383
  state: "absent",
28922
- verdict: `${j.toolCount} tool(s) read (${scope2}), none declares an output schema \u2014 ${RULE10} n/a`
29384
+ verdict: `${j.toolCount} tool(s) read (${scope2}), none declares an output schema \u2014 ${RULE11} n/a`
28923
29385
  };
28924
29386
  const decided = j.violations.length > 0 ? {
28925
29387
  id: ID10,
28926
29388
  anchor: j.violations[0].anchor,
28927
29389
  state: "non-conforming",
28928
- verdict: `${j.violations.length} closed object(s) in the output schemas of ${j.withOutput} tool(s): each refuses a field added later, which breaks every client connected before the release (${RULE10}): ${j.violations.map((v) => `${v.path} (${v.form}, ${v.anchor})`).join(", ")}.${ex}`
29390
+ verdict: `${j.violations.length} closed object(s) in the output schemas of ${j.withOutput} tool(s): each refuses a field added later, which breaks every client connected before the release (${RULE11}): ${j.violations.map((v) => `${v.path} (${v.form}, ${v.anchor})`).join(", ")}.${ex}`
28929
29391
  } : {
28930
29392
  id: ID10,
28931
29393
  anchor: anchorFallback,
28932
29394
  state: "present",
28933
- verdict: `${j.withOutput} output schema(s) read (${scope2}): no object refuses an added field (${RULE10}).${ex}`
29395
+ verdict: `${j.withOutput} output schema(s) read (${scope2}): no object refuses an added field (${RULE11}).${ex}`
28934
29396
  };
28935
29397
  return settle(ID10, decided, j.unread);
28936
29398
  }
@@ -28962,7 +29424,7 @@ function runStatic4(tree) {
28962
29424
  if (tools.length === 0) {
28963
29425
  const surface = toolSurfaceAnchor(tree);
28964
29426
  if (surface || unresolved.length > 0) {
28965
- const reason = noToolsLocatedReason(tree, `no output schema could be read (${RULE10})`);
29427
+ const reason = noToolsLocatedReason(tree, `no output schema could be read (${RULE11})`);
28966
29428
  return couldNotJudge(
28967
29429
  ID10,
28968
29430
  surface ?? unresolved[0],
@@ -28973,7 +29435,7 @@ function runStatic4(tree) {
28973
29435
  id: ID10,
28974
29436
  anchor: tree.root,
28975
29437
  state: "absent",
28976
- verdict: `no MCP tool registered in product source \u2014 ${RULE10} n/a`
29438
+ verdict: `no MCP tool registered in product source \u2014 ${RULE11} n/a`
28977
29439
  };
28978
29440
  }
28979
29441
  const j = {
@@ -28986,7 +29448,7 @@ function runStatic4(tree) {
28986
29448
  for (const a of unresolved)
28987
29449
  j.unread.push({
28988
29450
  anchor: a,
28989
- reason: `a tool registered here has a name the scan cannot resolve, so its output schema is unread (${RULE10})`
29451
+ reason: `a tool registered here has a name the scan cannot resolve, so its output schema is unread (${RULE11})`
28990
29452
  });
28991
29453
  for (const tool of tools) {
28992
29454
  const read = closedOutputSites(tree, tool.name, tool.anchor);
@@ -29002,7 +29464,7 @@ function runServedHalf2(runtime) {
29002
29464
  return couldNotJudge(
29003
29465
  ID10,
29004
29466
  anchor,
29005
- `the server could not be started/introspected, so no served outputSchema was read: ${runtime.launchError} (${RULE10})`
29467
+ `the server could not be started/introspected, so no served outputSchema was read: ${runtime.launchError} (${RULE11})`
29006
29468
  );
29007
29469
  const j = {
29008
29470
  violations: [],
@@ -29020,15 +29482,15 @@ function runServedHalf2(runtime) {
29020
29482
  }
29021
29483
  var s44ClosedOutput = {
29022
29484
  id: ID10,
29023
- rule: RULE10,
29485
+ rule: RULE11,
29024
29486
  pin: STANDARD_PIN,
29025
29487
  run: runStatic4,
29026
29488
  runServed: (runtime) => runServedHalf2(runtime)
29027
29489
  };
29028
29490
 
29029
29491
  // src/detectors/s45-origin-targets.ts
29030
- import { readFileSync as readFileSync22 } from "fs";
29031
- import { join as join33 } from "path";
29492
+ import { readFileSync as readFileSync24 } from "fs";
29493
+ import { join as join34 } from "path";
29032
29494
 
29033
29495
  // src/detectors/data/pslPrivate.ts
29034
29496
  var PSL_PRIVATE_RULES = [
@@ -32485,7 +32947,7 @@ var PSL_PRIVATE_RULES = [
32485
32947
  // src/detectors/s45-origin-targets.ts
32486
32948
  var HOSTS_VERIFICATION = (id) => HOSTS[id]?.verification;
32487
32949
  var ID11 = "S45 origin-targets";
32488
- var RULE11 = "S-45";
32950
+ var RULE12 = "S-45";
32489
32951
  var PIN12 = STANDARD_PIN;
32490
32952
  var PLATFORM_HOSTS = PSL_PRIVATE_RULES.map((r) => r.startsWith("*.") ? r.slice(2) : r);
32491
32953
  var TRANSPORT_RE4 = /\bStreamableHTTPServerTransport\b|\bWebStandardStreamableHTTPServerTransport\b|\bcreateMcpHandler\s*\(|\.(?:post|all)\(\s*["'`]\/mcp["'`]|\bbuildHttpApp\s*\(/;
@@ -32548,16 +33010,16 @@ function servesStreamableHttp(tree, manifest) {
32548
33010
  });
32549
33011
  }
32550
33012
  function run7(tree) {
32551
- const manifestPath2 = join33(tree.root, "mcp-server.json");
33013
+ const manifestPath2 = join34(tree.root, "mcp-server.json");
32552
33014
  let manifest = {};
32553
33015
  try {
32554
- manifest = JSON.parse(readFileSync22(manifestPath2, "utf8"));
33016
+ manifest = JSON.parse(readFileSync24(manifestPath2, "utf8"));
32555
33017
  } catch (err) {
32556
33018
  if (fsErrorCode(err) !== "ENOENT")
32557
33019
  return couldNotJudge(
32558
33020
  ID11,
32559
33021
  manifestPath2,
32560
- `mcp-server.json could not be read or parsed (${fsErrorCode(err)}) (${RULE11})`
33022
+ `mcp-server.json could not be read or parsed (${fsErrorCode(err)}) (${RULE12})`
32561
33023
  );
32562
33024
  }
32563
33025
  const files = tree.files.map((f) => ({ f, text: textOf(f) }));
@@ -32568,11 +33030,11 @@ function run7(tree) {
32568
33030
  id: ID11,
32569
33031
  anchor: manifestPath2,
32570
33032
  state: "absent",
32571
- verdict: hasHttp ? `no target host declared (mcp-server.json distribution.targets is absent): the server is not distributed on hosts \u2014 ${RULE11} n/a` : `no HTTP transport and no target host declared (mcp-server.json distribution.targets): not a remote server \u2014 ${RULE11} n/a`
33033
+ verdict: hasHttp ? `no target host declared (mcp-server.json distribution.targets is absent): the server is not distributed on hosts \u2014 ${RULE12} n/a` : `no HTTP transport and no target host declared (mcp-server.json distribution.targets): not a remote server \u2014 ${RULE12} n/a`
32572
33034
  };
32573
33035
  }
32574
33036
  if (read.kind === "unreadable")
32575
- return couldNotJudge(ID11, manifestPath2, `${read.reason} (${RULE11})`);
33037
+ return couldNotJudge(ID11, manifestPath2, `${read.reason} (${RULE12})`);
32576
33038
  const targets = read.targets;
32577
33039
  const red = [];
32578
33040
  const unread2 = [];
@@ -32602,7 +33064,7 @@ function run7(tree) {
32602
33064
  }
32603
33065
  }
32604
33066
  try {
32605
- const env = readFileSync22(join33(tree.root, ".env.example"), "utf8");
33067
+ const env = readFileSync24(join34(tree.root, ".env.example"), "utf8");
32606
33068
  for (const m of env.matchAll(/^PUBLIC_BASE_URL=(\S+)/gm))
32607
33069
  urls.push({ url: m[1], where: ".env.example" });
32608
33070
  } catch {
@@ -32660,28 +33122,28 @@ function run7(tree) {
32660
33122
  id: ID11,
32661
33123
  anchor: manifestPath2,
32662
33124
  state: "non-conforming",
32663
- verdict: `${RULE11}: ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
33125
+ verdict: `${RULE12}: ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
32664
33126
  };
32665
- if (unread2.length > 0) return couldNotJudge(ID11, manifestPath2, `${unread2.join("; ")} (${RULE11})`);
33127
+ if (unread2.length > 0) return couldNotJudge(ID11, manifestPath2, `${unread2.join("; ")} (${RULE12})`);
32666
33128
  return {
32667
33129
  id: ID11,
32668
33130
  anchor: manifestPath2,
32669
33131
  state: "present",
32670
- verdict: `declared targets ${targets.join(", ")}: owned origin (${publicUrls.map((u) => hostOf2(u.url)).join(", ")}), Streamable HTTP served, every declared verification path read from configuration (${RULE11})`
33132
+ verdict: `declared targets ${targets.join(", ")}: owned origin (${publicUrls.map((u) => hostOf2(u.url)).join(", ")}), Streamable HTTP served, every declared verification path read from configuration (${RULE12})`
32671
33133
  };
32672
33134
  }
32673
33135
  var s45OriginTargets = {
32674
33136
  id: ID11,
32675
- rule: RULE11,
33137
+ rule: RULE12,
32676
33138
  pin: PIN12,
32677
33139
  run: run7
32678
33140
  };
32679
33141
 
32680
33142
  // src/detectors/s46-registration-redirects.ts
32681
- import { readFileSync as readFileSync23 } from "fs";
32682
- import { join as join34 } from "path";
33143
+ import { readFileSync as readFileSync25 } from "fs";
33144
+ import { join as join35 } from "path";
32683
33145
  var ID12 = "S46 registration-redirects";
32684
- var RULE12 = "S-46";
33146
+ var RULE13 = "S-46";
32685
33147
  var AS_ROUTE = /["'`]\/?\.well-known\/oauth-authorization-server["'`]/;
32686
33148
  var CIMD_RE2 = flagTrueRe("client_id_metadata_document_supported");
32687
33149
  function textOf2(f) {
@@ -32700,16 +33162,16 @@ function siteOf(files, re) {
32700
33162
  return void 0;
32701
33163
  }
32702
33164
  function run8(tree) {
32703
- const manifestPath2 = join34(tree.root, "mcp-server.json");
33165
+ const manifestPath2 = join35(tree.root, "mcp-server.json");
32704
33166
  let manifest = {};
32705
33167
  try {
32706
- manifest = JSON.parse(readFileSync23(manifestPath2, "utf8"));
33168
+ manifest = JSON.parse(readFileSync25(manifestPath2, "utf8"));
32707
33169
  } catch (err) {
32708
33170
  if (fsErrorCode(err) !== "ENOENT")
32709
33171
  return couldNotJudge(
32710
33172
  ID12,
32711
33173
  manifestPath2,
32712
- `mcp-server.json could not be read or parsed (${fsErrorCode(err)}) (${RULE12})`
33174
+ `mcp-server.json could not be read or parsed (${fsErrorCode(err)}) (${RULE13})`
32713
33175
  );
32714
33176
  }
32715
33177
  const read = readTargets(manifest);
@@ -32718,10 +33180,10 @@ function run8(tree) {
32718
33180
  id: ID12,
32719
33181
  anchor: manifestPath2,
32720
33182
  state: "absent",
32721
- verdict: `no target host declared (mcp-server.json distribution.targets is absent) \u2014 ${RULE12} n/a`
33183
+ verdict: `no target host declared (mcp-server.json distribution.targets is absent) \u2014 ${RULE13} n/a`
32722
33184
  };
32723
33185
  if (read.kind === "unreadable")
32724
- return couldNotJudge(ID12, manifestPath2, `${read.reason} (${RULE12})`);
33186
+ return couldNotJudge(ID12, manifestPath2, `${read.reason} (${RULE13})`);
32725
33187
  const installed = readInstalledAs(tree);
32726
33188
  const asSite = siteOf(tree.files, AS_ROUTE);
32727
33189
  if (!asSite && installed.publishers.length === 0)
@@ -32729,7 +33191,7 @@ function run8(tree) {
32729
33191
  id: ID12,
32730
33192
  anchor: manifestPath2,
32731
33193
  state: "absent",
32732
- verdict: `no authorization server in the tree or installed (no ${".well-known/oauth-authorization-server"} route): the server authenticates no person \u2014 ${RULE12} n/a`
33194
+ verdict: `no authorization server in the tree or installed (no ${".well-known/oauth-authorization-server"} route): the server authenticates no person \u2014 ${RULE13} n/a`
32733
33195
  };
32734
33196
  const first = (...res) => {
32735
33197
  for (const re of res) {
@@ -32766,19 +33228,19 @@ function run8(tree) {
32766
33228
  id: ID12,
32767
33229
  anchor: asSite ?? manifestPath2,
32768
33230
  state: "non-conforming",
32769
- verdict: `${RULE12}: ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
33231
+ verdict: `${RULE13}: ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
32770
33232
  };
32771
33233
  if (unread2.length > 0)
32772
33234
  return couldNotJudge(
32773
33235
  ID12,
32774
33236
  asSite ?? manifestPath2,
32775
- `CIMD (${cimd}) and DCR (${dcr}) offered; ${unread2.join("; ")} (${RULE12})`
33237
+ `CIMD (${cimd}) and DCR (${dcr}) offered; ${unread2.join("; ")} (${RULE13})`
32776
33238
  );
32777
33239
  return {
32778
33240
  id: ID12,
32779
33241
  anchor: asSite ?? manifestPath2,
32780
33242
  state: "present",
32781
- verdict: `CIMD (${cimd}) and DCR (${dcr}) offered; no declared host needs a redirect callback (${RULE12})`
33243
+ verdict: `CIMD (${cimd}) and DCR (${dcr}) offered; no declared host needs a redirect callback (${RULE13})`
32782
33244
  };
32783
33245
  }
32784
33246
  function sameTarget(location, redirect) {
@@ -32845,7 +33307,7 @@ function judgeServed2(runtime) {
32845
33307
  let facts;
32846
33308
  if (!runtime.served && runtime.publicAuth) facts = runtime.publicAuth;
32847
33309
  else {
32848
- const got = servedOrCouldNotJudge(ID12, RULE12, runtime);
33310
+ const got = servedOrCouldNotJudge(ID12, RULE13, runtime);
32849
33311
  if ("cnj" in got) return got.cnj;
32850
33312
  facts = got.served;
32851
33313
  }
@@ -32855,17 +33317,17 @@ function judgeServed2(runtime) {
32855
33317
  return couldNotJudge(
32856
33318
  ID12,
32857
33319
  anchor,
32858
- `no source tree was given (--source), so the declared targets (mcp-server.json distribution.targets) were not read (${RULE12})`
33320
+ `no source tree was given (--source), so the declared targets (mcp-server.json distribution.targets) were not read (${RULE13})`
32859
33321
  );
32860
33322
  let manifest = {};
32861
33323
  try {
32862
- manifest = JSON.parse(readFileSync23(join34(src, "mcp-server.json"), "utf8"));
33324
+ manifest = JSON.parse(readFileSync25(join35(src, "mcp-server.json"), "utf8"));
32863
33325
  } catch (err) {
32864
33326
  if (fsErrorCode(err) !== "ENOENT")
32865
33327
  return couldNotJudge(
32866
33328
  ID12,
32867
33329
  anchor,
32868
- `mcp-server.json not read: ${err.message} (${RULE12})`
33330
+ `mcp-server.json not read: ${err.message} (${RULE13})`
32869
33331
  );
32870
33332
  }
32871
33333
  const read = readTargets(manifest);
@@ -32874,15 +33336,15 @@ function judgeServed2(runtime) {
32874
33336
  id: ID12,
32875
33337
  anchor,
32876
33338
  state: "absent",
32877
- verdict: `no target host declared (mcp-server.json distribution.targets is absent) \u2014 ${RULE12} n/a`
33339
+ verdict: `no target host declared (mcp-server.json distribution.targets is absent) \u2014 ${RULE13} n/a`
32878
33340
  };
32879
- if (read.kind === "unreadable") return couldNotJudge(ID12, anchor, `${read.reason} (${RULE12})`);
33341
+ if (read.kind === "unreadable") return couldNotJudge(ID12, anchor, `${read.reason} (${RULE13})`);
32880
33342
  const as = facts.authServer;
32881
33343
  if (as.kind !== "document")
32882
33344
  return couldNotJudge(
32883
33345
  ID12,
32884
33346
  anchor,
32885
- `the authorization-server metadata was not read: ${as.kind === "not-run" ? as.reason : `${as.url}: ${as.reason}`} (${RULE12})`
33347
+ `the authorization-server metadata was not read: ${as.kind === "not-run" ? as.reason : `${as.url}: ${as.reason}`} (${RULE13})`
32886
33348
  );
32887
33349
  const doc = as.document;
32888
33350
  const red = [];
@@ -32935,15 +33397,15 @@ function judgeServed2(runtime) {
32935
33397
  id: ID12,
32936
33398
  anchor,
32937
33399
  state: "non-conforming",
32938
- verdict: `${RULE12} (served): ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
33400
+ verdict: `${RULE13} (served): ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
32939
33401
  };
32940
33402
  if (unread2.length > 0)
32941
- return couldNotJudge(ID12, anchor, `${ok.join("; ")}; ${unread2.join("; ")} (${RULE12}, served)`);
32942
- return { id: ID12, anchor, state: "present", verdict: `${ok.join("; ")} (${RULE12}, served)` };
33403
+ return couldNotJudge(ID12, anchor, `${ok.join("; ")}; ${unread2.join("; ")} (${RULE13}, served)`);
33404
+ return { id: ID12, anchor, state: "present", verdict: `${ok.join("; ")} (${RULE13}, served)` };
32943
33405
  }
32944
33406
  var s46RegistrationRedirects = {
32945
33407
  id: ID12,
32946
- rule: RULE12,
33408
+ rule: RULE13,
32947
33409
  pin: STANDARD_PIN,
32948
33410
  run: run8,
32949
33411
  runServed: runServed5
@@ -32951,7 +33413,7 @@ var s46RegistrationRedirects = {
32951
33413
 
32952
33414
  // src/detectors/s47-webhook-delivery.ts
32953
33415
  var ID13 = "S47 webhook-delivery";
32954
- var RULE13 = "S-47";
33416
+ var RULE14 = "S-47";
32955
33417
  var OUTBOUND_RE = /\bfetch\s*\(|\b(?:undici\.)?request\s*\(|\.post\s*\(|\bhttps?\.request\s*\(/;
32956
33418
  var CALLBACK_RE = /\b(?:callbackUrl|callback_url|webhookUrl|webhook_url)\b|\b(?:subscription|subscriber|sub|delivery|callback|webhook|target)\w*\??\.(?:url|uri|href|endpoint)\b/;
32957
33419
  var HEADERS = ["webhook-id", "webhook-timestamp", "webhook-signature"];
@@ -33105,7 +33567,7 @@ function bodyOf(file, line, col, levels = 0) {
33105
33567
  return { start: b.startLine, end: b.endLine, text: b.text };
33106
33568
  }
33107
33569
  function run9(tree) {
33108
- const { surface, early } = eventsGate(ID13, tree, RULE13);
33570
+ const { surface, early } = eventsGate(ID13, tree, RULE14);
33109
33571
  if (early) return early;
33110
33572
  const anchor = surface.declared?.anchor ?? surface.methods.get("events/subscribe")?.[0] ?? "-";
33111
33573
  const outbound2 = lineHits(tree, OUTBOUND_RE);
@@ -33165,28 +33627,28 @@ function run9(tree) {
33165
33627
  return couldNotJudge(
33166
33628
  ID13,
33167
33629
  anchor,
33168
- `${[...red, ...unread2].join("; ")} in this tree, but ${surface.helpers.join(", ")} is imported and may deliver events from outside it (${RULE13})`
33630
+ `${[...red, ...unread2].join("; ")} in this tree, but ${surface.helpers.join(", ")} is imported and may deliver events from outside it (${RULE14})`
33169
33631
  );
33170
33632
  if (red.length > 0)
33171
33633
  return {
33172
33634
  id: ID13,
33173
33635
  anchor,
33174
33636
  state: "non-conforming",
33175
- verdict: `${RULE13}: ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
33637
+ verdict: `${RULE14}: ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
33176
33638
  };
33177
- if (unread2.length > 0) return couldNotJudge(ID13, anchor, `${unread2.join("; ")} (${RULE13})`);
33639
+ if (unread2.length > 0) return couldNotJudge(ID13, anchor, `${unread2.join("; ")} (${RULE14})`);
33178
33640
  return {
33179
33641
  id: ID13,
33180
33642
  anchor: delivery?.anchor ?? anchor,
33181
33643
  state: "present",
33182
- verdict: `events delivered by webhook (${delivery?.anchor}), signed with ${HEADERS.join(", ")}, callback verified before the first delivery (${RULE13})`
33644
+ verdict: `events delivered by webhook (${delivery?.anchor}), signed with ${HEADERS.join(", ")}, callback verified before the first delivery (${RULE14})`
33183
33645
  };
33184
33646
  }
33185
- var s47WebhookDelivery = { id: ID13, rule: RULE13, pin: STANDARD_PIN, run: run9 };
33647
+ var s47WebhookDelivery = { id: ID13, rule: RULE14, pin: STANDARD_PIN, run: run9 };
33186
33648
 
33187
33649
  // src/detectors/s48-per-member.ts
33188
33650
  var ID14 = "S48 per-member";
33189
- var RULE14 = "S-48";
33651
+ var RULE15 = "S-48";
33190
33652
  var AS_ROUTE2 = /["'`]\/?\.well-known\/oauth-authorization-server["'`]/;
33191
33653
  var CRED = "(?:TOKEN|KEY|SECRET|BEARER|CREDENTIAL|PASSWORD)";
33192
33654
  var CRED_CAMEL = "(?:[Tt]oken|[Kk]ey|[Ss]ecret|[Bb]earer|[Cc]redential|[Pp]assword)";
@@ -33225,12 +33687,12 @@ function run10(tree) {
33225
33687
  id: ID14,
33226
33688
  anchor: "-",
33227
33689
  state: "absent",
33228
- verdict: `no authorization server in the tree or installed, and the ${RULE14} scope condition ${S48_CONDITION} is false here: ${scope2.found} \u2014 ${RULE14} n/a`
33690
+ verdict: `no authorization server in the tree or installed, and the ${RULE15} scope condition ${S48_CONDITION} is false here: ${scope2.found} \u2014 ${RULE15} n/a`
33229
33691
  };
33230
33692
  return couldNotJudge(
33231
33693
  ID14,
33232
33694
  scope2.anchor,
33233
- `the ${RULE14} scope condition ${S48_CONDITION} cannot be read: ${scope2.why} (${RULE14})`
33695
+ `the ${RULE15} scope condition ${S48_CONDITION} cannot be read: ${scope2.why} (${RULE15})`
33234
33696
  );
33235
33697
  }
33236
33698
  const anchor = asSite?.anchor ?? `node_modules/${installed.publishers[0]}`;
@@ -33257,26 +33719,26 @@ function run10(tree) {
33257
33719
  id: ID14,
33258
33720
  anchor: fallbacks[0]?.anchor ?? anchor,
33259
33721
  state: "non-conforming",
33260
- verdict: `${RULE14}: ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
33722
+ verdict: `${RULE15}: ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
33261
33723
  };
33262
33724
  if (unread2.length > 0)
33263
33725
  return couldNotJudge(
33264
33726
  ID14,
33265
33727
  anchor,
33266
- `no shared-credential fallback found; ${unread2.join("; ")} (${RULE14})`
33728
+ `no shared-credential fallback found; ${unread2.join("; ")} (${RULE15})`
33267
33729
  );
33268
33730
  return {
33269
33731
  id: ID14,
33270
33732
  anchor: challenge?.anchor ?? anchor,
33271
33733
  state: "present",
33272
- verdict: `no shared-credential fallback on the request path; a member with no credential is refused with a 401 challenge (${challenge?.anchor}) (${RULE14})`
33734
+ verdict: `no shared-credential fallback on the request path; a member with no credential is refused with a 401 challenge (${challenge?.anchor}) (${RULE15})`
33273
33735
  };
33274
33736
  }
33275
- var s48PerMember = { id: ID14, rule: RULE14, pin: STANDARD_PIN, run: run10 };
33737
+ var s48PerMember = { id: ID14, rule: RULE15, pin: STANDARD_PIN, run: run10 };
33276
33738
 
33277
33739
  // src/detectors/s49-server-metadata.ts
33278
33740
  var ID15 = "S49 server-metadata";
33279
- var RULE15 = "S-49";
33741
+ var RULE16 = "S-49";
33280
33742
  var PLACEHOLDER = /^(?:|\?+|tbd|tba|todo|n\/a|xxx+|placeholder|changeme|lorem ipsum.*|-+)$/i;
33281
33743
  var RESERVED_HOST = /(?:^|\.)(?:example\.(?:com|net|org)|example|test|invalid|localhost)$/i;
33282
33744
  function isPlaceholder(v) {
@@ -33351,15 +33813,15 @@ function verdict2(anchor, v, note) {
33351
33813
  id: ID15,
33352
33814
  anchor,
33353
33815
  state: "non-conforming",
33354
- verdict: `${RULE15}: ${v.red.join("; ")}${v.unread.length > 0 ? `; also could not judge: ${v.unread.join("; ")}` : ""}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""}${note}`
33816
+ verdict: `${RULE16}: ${v.red.join("; ")}${v.unread.length > 0 ? `; also could not judge: ${v.unread.join("; ")}` : ""}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""}${note}`
33355
33817
  };
33356
33818
  if (v.unread.length > 0)
33357
33819
  return couldNotJudge(
33358
33820
  ID15,
33359
33821
  anchor,
33360
- `${v.unread.join("; ")}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""} (${RULE15}${note})`
33822
+ `${v.unread.join("; ")}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""} (${RULE16}${note})`
33361
33823
  );
33362
- return { id: ID15, anchor, state: "present", verdict: `${v.ok.join("; ")} (${RULE15}${note})` };
33824
+ return { id: ID15, anchor, state: "present", verdict: `${v.ok.join("; ")} (${RULE16}${note})` };
33363
33825
  }
33364
33826
  var MANIFEST_FIELDS = [
33365
33827
  ["name", "string"],
@@ -33400,13 +33862,13 @@ function run11(tree) {
33400
33862
  id: ID15,
33401
33863
  anchor: "-",
33402
33864
  state: "absent",
33403
- verdict: `no server manifest and no MCP server surface (S-14's predicate: no server construction, no registered tool): not an MCP server \u2014 ${RULE15} n/a`
33865
+ verdict: `no server manifest and no MCP server surface (S-14's predicate: no server construction, no registered tool): not an MCP server \u2014 ${RULE16} n/a`
33404
33866
  };
33405
33867
  const what = read.length > 0 ? `read ${read.join(", ")}: no placeholder` : "no server manifest (mcp-server.json, mcp.json, server.json) at the tree root";
33406
33868
  return couldNotJudge(
33407
33869
  ID15,
33408
33870
  read[0] ?? "-",
33409
- `${what}${v.unread.length > 0 ? `; ${v.unread.join("; ")}` : ""}; the eight items are judged on the served initialize answer (serverInfo, instructions, capabilities) \u2014 decided by the served half (${RULE15})`
33871
+ `${what}${v.unread.length > 0 ? `; ${v.unread.join("; ")}` : ""}; the eight items are judged on the served initialize answer (serverInfo, instructions, capabilities) \u2014 decided by the served half (${RULE16})`
33410
33872
  );
33411
33873
  }
33412
33874
  function runServed6(runtime) {
@@ -33415,14 +33877,14 @@ function runServed6(runtime) {
33415
33877
  return couldNotJudge(
33416
33878
  ID15,
33417
33879
  anchor,
33418
- `the initialize answer was not read: ${runtime.launchError} (${RULE15})`
33880
+ `the initialize answer was not read: ${runtime.launchError} (${RULE16})`
33419
33881
  );
33420
33882
  const init = runtime.served?.initialize;
33421
33883
  if (!init)
33422
33884
  return couldNotJudge(
33423
33885
  ID15,
33424
33886
  anchor,
33425
- `the introspector recorded no initialize result (instructions unread) (${RULE15})`
33887
+ `the introspector recorded no initialize result (instructions unread) (${RULE16})`
33426
33888
  );
33427
33889
  const v = { red: [], unread: [], ok: [] };
33428
33890
  const si = runtime.serverInfo;
@@ -33445,7 +33907,7 @@ function runServed6(runtime) {
33445
33907
  }
33446
33908
  var s49ServerMetadata = {
33447
33909
  id: ID15,
33448
- rule: RULE15,
33910
+ rule: RULE16,
33449
33911
  pin: MANUFACT_RULES_PIN,
33450
33912
  run: run11,
33451
33913
  runServed: runServed6
@@ -33453,7 +33915,7 @@ var s49ServerMetadata = {
33453
33915
 
33454
33916
  // src/detectors/s50-served-discovery.ts
33455
33917
  var ID16 = "S50 served-discovery";
33456
- var RULE16 = "S-50";
33918
+ var RULE17 = "S-50";
33457
33919
  function pathOf(url) {
33458
33920
  try {
33459
33921
  return new URL(url).pathname;
@@ -33524,19 +33986,19 @@ function judgeLanding(landing, v) {
33524
33986
  function run12(tree) {
33525
33987
  const read = readDeclaredTargets(tree.root);
33526
33988
  if (read.targets.kind === "unreadable")
33527
- return couldNotJudge(ID16, read.file ?? "-", `${read.targets.reason} (${RULE16})`);
33989
+ return couldNotJudge(ID16, read.file ?? "-", `${read.targets.reason} (${RULE17})`);
33528
33990
  const manifest = read.manifest ?? {};
33529
33991
  if (!servesStreamableHttp(tree, manifest))
33530
33992
  return {
33531
33993
  id: ID16,
33532
33994
  anchor: "-",
33533
33995
  state: "absent",
33534
- verdict: `no Streamable HTTP transport (none in the source, none in the server manifest): no MCP URL to discover the server from \u2014 ${RULE16} n/a`
33996
+ verdict: `no Streamable HTTP transport (none in the source, none in the server manifest): no MCP URL to discover the server from \u2014 ${RULE17} n/a`
33535
33997
  };
33536
33998
  return couldNotJudge(
33537
33999
  ID16,
33538
34000
  "-",
33539
- `the server serves Streamable HTTP: the server card and the setup page are read on the served URL \u2014 run with --url (${RULE16})`
34001
+ `the server serves Streamable HTTP: the server card and the setup page are read on the served URL \u2014 run with --url (${RULE17})`
33540
34002
  );
33541
34003
  }
33542
34004
  function runServed7(runtime) {
@@ -33546,9 +34008,9 @@ function runServed7(runtime) {
33546
34008
  return couldNotJudge(
33547
34009
  ID16,
33548
34010
  anchor,
33549
- runtime.launchError ? `the server was not read (${runtime.launchError}) and no public read was recorded (${RULE16})` : `the introspector recorded no server-card or setup-page read (${RULE16})`
34011
+ runtime.launchError ? `the server was not read (${runtime.launchError}) and no public read was recorded (${RULE17})` : `the introspector recorded no server-card or setup-page read (${RULE17})`
33550
34012
  );
33551
- if (d.kind === "not-run") return couldNotJudge(ID16, anchor, `${d.reason} (${RULE16})`);
34013
+ if (d.kind === "not-run") return couldNotJudge(ID16, anchor, `${d.reason} (${RULE17})`);
33552
34014
  const v = { red: [], unread: [], ok: [] };
33553
34015
  judgeCards(d.cards, v);
33554
34016
  judgeLanding(d.landing, v);
@@ -33556,7 +34018,7 @@ function runServed7(runtime) {
33556
34018
  return couldNotJudge(
33557
34019
  ID16,
33558
34020
  anchor,
33559
- `the MCP handshake failed: ${runtime.launchError}; the public reads found: ${[...v.red, ...v.unread, ...v.ok].join("; ")} (${RULE16})`
34021
+ `the MCP handshake failed: ${runtime.launchError}; the public reads found: ${[...v.red, ...v.unread, ...v.ok].join("; ")} (${RULE17})`
33560
34022
  );
33561
34023
  const scope2 = " \u2014 read without a credential, on the endpoint's origin only";
33562
34024
  if (v.red.length > 0)
@@ -33564,19 +34026,19 @@ function runServed7(runtime) {
33564
34026
  id: ID16,
33565
34027
  anchor,
33566
34028
  state: "non-conforming",
33567
- verdict: `${RULE16}: ${v.red.join("; ")}${v.unread.length > 0 ? `; also could not judge: ${v.unread.join("; ")}` : ""}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""}${scope2}`
34029
+ verdict: `${RULE17}: ${v.red.join("; ")}${v.unread.length > 0 ? `; also could not judge: ${v.unread.join("; ")}` : ""}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""}${scope2}`
33568
34030
  };
33569
34031
  if (v.unread.length > 0)
33570
34032
  return couldNotJudge(
33571
34033
  ID16,
33572
34034
  anchor,
33573
- `${v.unread.join("; ")}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""} (${RULE16})`
34035
+ `${v.unread.join("; ")}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""} (${RULE17})`
33574
34036
  );
33575
- return { id: ID16, anchor, state: "present", verdict: `${v.ok.join("; ")} (${RULE16}${scope2})` };
34037
+ return { id: ID16, anchor, state: "present", verdict: `${v.ok.join("; ")} (${RULE17}${scope2})` };
33576
34038
  }
33577
34039
  var s50ServedDiscovery = {
33578
34040
  id: ID16,
33579
- rule: RULE16,
34041
+ rule: RULE17,
33580
34042
  pin: MANUFACT_RULES_PIN,
33581
34043
  run: run12,
33582
34044
  runServed: runServed7
@@ -33977,12 +34439,12 @@ function stmtCompletes(s) {
33977
34439
  }
33978
34440
  return true;
33979
34441
  }
33980
- function collectReturns(body, sf, rel, out, inCatch = false) {
34442
+ function collectReturns(body, sf, rel2, out, inCatch = false) {
33981
34443
  const visit = (n, catching) => {
33982
34444
  if (n !== body && ts.isFunctionLike(n)) return;
33983
34445
  if (ts.isReturnStatement(n)) {
33984
34446
  out.push({
33985
- anchor: `${rel}:${startLine(n)}`,
34447
+ anchor: `${rel2}:${startLine(n)}`,
33986
34448
  ...n.expression ? { expr: n.expression } : {},
33987
34449
  form: n.expression ? "return" : "bare-return",
33988
34450
  inCatch: catching
@@ -33998,23 +34460,23 @@ function collectReturns(body, sf, rel, out, inCatch = false) {
33998
34460
  visit(body, inCatch);
33999
34461
  void sf;
34000
34462
  }
34001
- function functionReturns(fn, sf, rel) {
34463
+ function functionReturns(fn, sf, rel2) {
34002
34464
  const out = [];
34003
34465
  const body = fn.body;
34004
34466
  if (!body) return out;
34005
34467
  if (!ts.isBlock(body)) {
34006
34468
  out.push({
34007
- anchor: `${rel}:${startLine(body)}`,
34469
+ anchor: `${rel2}:${startLine(body)}`,
34008
34470
  expr: body,
34009
34471
  form: "concise",
34010
34472
  inCatch: false
34011
34473
  });
34012
34474
  return out;
34013
34475
  }
34014
- collectReturns(body, sf, rel, out);
34476
+ collectReturns(body, sf, rel2, out);
34015
34477
  if (completes(body.statements))
34016
34478
  out.push({
34017
- anchor: `${rel}:${lineOfPos(sf, body.getEnd())}`,
34479
+ anchor: `${rel2}:${lineOfPos(sf, body.getEnd())}`,
34018
34480
  form: "fall-through",
34019
34481
  inCatch: false
34020
34482
  });
@@ -34065,9 +34527,9 @@ function sourceFileOf(f) {
34065
34527
  }
34066
34528
  function readHandler(tree, tool) {
34067
34529
  const cut = tool.anchor.lastIndexOf(":");
34068
- const rel = tool.anchor.slice(0, cut);
34530
+ const rel2 = tool.anchor.slice(0, cut);
34069
34531
  const line = Number(tool.anchor.slice(cut + 1));
34070
- const file = tree.files.find((f) => f.rel === rel);
34532
+ const file = tree.files.find((f) => f.rel === rel2);
34071
34533
  if (!file)
34072
34534
  return {
34073
34535
  kind: "unread",
@@ -34087,8 +34549,8 @@ function readHandler(tree, tool) {
34087
34549
  if (u && isFunctionLikeExpr(u))
34088
34550
  return {
34089
34551
  kind: "read",
34090
- anchor: `${rel}:${startLine(u)}`,
34091
- returns: functionReturns(u, sf, rel),
34552
+ anchor: `${rel2}:${startLine(u)}`,
34553
+ returns: functionReturns(u, sf, rel2),
34092
34554
  sf,
34093
34555
  file
34094
34556
  };
@@ -34097,15 +34559,15 @@ function readHandler(tree, tool) {
34097
34559
  if (fn)
34098
34560
  return {
34099
34561
  kind: "read",
34100
- anchor: `${rel}:${startLine(fn)}`,
34101
- returns: functionReturns(fn, sf, rel),
34562
+ anchor: `${rel2}:${startLine(fn)}`,
34563
+ returns: functionReturns(fn, sf, rel2),
34102
34564
  sf,
34103
34565
  file
34104
34566
  };
34105
34567
  return {
34106
34568
  kind: "unread",
34107
- anchor: `${rel}:${startLine(u)}`,
34108
- reason: `${tool.name}: its handler \`${u.text}\` is not a function declared in ${rel}`
34569
+ anchor: `${rel2}:${startLine(u)}`,
34570
+ reason: `${tool.name}: its handler \`${u.text}\` is not a function declared in ${rel2}`
34109
34571
  };
34110
34572
  }
34111
34573
  }
@@ -34255,7 +34717,7 @@ function names(list, max = 400) {
34255
34717
 
34256
34718
  // src/detectors/s51-served-output.ts
34257
34719
  var ID17 = "S51 served-output";
34258
- var RULE17 = "S-51";
34720
+ var RULE18 = "S-51";
34259
34721
  var isNullish = (e) => {
34260
34722
  let x = e;
34261
34723
  while (ts2.isParenthesizedExpression(x) || ts2.isAsExpression(x)) x = x.expression;
@@ -34297,9 +34759,9 @@ function underCondition(n) {
34297
34759
  }
34298
34760
  return false;
34299
34761
  }
34300
- function exemptionSites(sf, rel) {
34762
+ function exemptionSites(sf, rel2) {
34301
34763
  const out = [];
34302
- const at = (n) => `${rel}:${sf.getLineAndCharacterOfPosition(n.getStart(sf)).line + 1}`;
34764
+ const at = (n) => `${rel2}:${sf.getLineAndCharacterOfPosition(n.getStart(sf)).line + 1}`;
34303
34765
  const text = (n) => n.getText(sf).replace(/\s+/g, " ").slice(0, 120);
34304
34766
  const visit = (n) => {
34305
34767
  if (ts2.isSpreadAssignment(n)) {
@@ -34350,18 +34812,18 @@ function runStatic5(tree) {
34350
34812
  return couldNotJudge(
34351
34813
  ID17,
34352
34814
  surface ?? unresolved[0],
34353
- noToolsLocatedReason(tree, `no registration was read (${RULE17})`)
34815
+ noToolsLocatedReason(tree, `no registration was read (${RULE18})`)
34354
34816
  );
34355
34817
  return {
34356
34818
  id: ID17,
34357
34819
  anchor: tree.root,
34358
34820
  state: "absent",
34359
- verdict: `no MCP tool registered in product source \u2014 ${RULE17} n/a`
34821
+ verdict: `no MCP tool registered in product source \u2014 ${RULE18} n/a`
34360
34822
  };
34361
34823
  }
34362
34824
  const unread2 = unresolved.map((a) => ({
34363
34825
  anchor: a,
34364
- reason: `a tool registered here has a name the scan cannot resolve, so whether it declares an output schema is unread (${RULE17})`
34826
+ reason: `a tool registered here has a name the scan cannot resolve, so whether it declares an output schema is unread (${RULE18})`
34365
34827
  }));
34366
34828
  const missing = [];
34367
34829
  const declared = [];
@@ -34372,7 +34834,7 @@ function runStatic5(tree) {
34372
34834
  const loc = r.sites.find(
34373
34835
  (s) => s.path === t.name && s.kind === "unread" && /^registration/.test(s.form)
34374
34836
  );
34375
- if (loc) unread2.push({ anchor: loc.anchor, reason: `${loc.form} (${RULE17})` });
34837
+ if (loc) unread2.push({ anchor: loc.anchor, reason: `${loc.form} (${RULE18})` });
34376
34838
  else declared.push(t.name);
34377
34839
  }
34378
34840
  }
@@ -34395,7 +34857,7 @@ function runStatic5(tree) {
34395
34857
  id: ID17,
34396
34858
  anchor: exemptions[0]?.anchor ?? missing[0].replace(/^.* \((.*)\)$/, "$1"),
34397
34859
  state: "non-conforming",
34398
- verdict: `${parts.join("; ")} \u2014 every served tool carries an outputSchema and no code path exempts one (${RULE17})`
34860
+ verdict: `${parts.join("; ")} \u2014 every served tool carries an outputSchema and no code path exempts one (${RULE18})`
34399
34861
  },
34400
34862
  unread2
34401
34863
  );
@@ -34405,17 +34867,17 @@ function runStatic5(tree) {
34405
34867
  couldNotJudge(
34406
34868
  ID17,
34407
34869
  tools[0].anchor,
34408
- `static half: ${declared.length} registered tool(s) declare an outputSchema and no exemption mechanism (X1..X3) is in the registration code; unread by a static run: whether each served result's structuredContent validates against it (${names(declared)}) \u2014 run --mode=dynamic (${RULE17})`
34870
+ `static half: ${declared.length} registered tool(s) declare an outputSchema and no exemption mechanism (X1..X3) is in the registration code; unread by a static run: whether each served result's structuredContent validates against it (${names(declared)}) \u2014 run --mode=dynamic (${RULE18})`
34409
34871
  ),
34410
34872
  unread2
34411
34873
  );
34412
34874
  }
34413
34875
  function runServedHalf3(runtime) {
34414
- const got = servedToolCalls(ID17, RULE17, runtime);
34876
+ const got = servedToolCalls(ID17, RULE18, runtime);
34415
34877
  if ("cnj" in got) return got.cnj;
34416
34878
  const { calls, tools, anchor } = got;
34417
34879
  if (tools.length === 0)
34418
- return { id: ID17, anchor, state: "absent", verdict: `the server serves no tool \u2014 ${RULE17} n/a` };
34880
+ return { id: ID17, anchor, state: "absent", verdict: `the server serves no tool \u2014 ${RULE18} n/a` };
34419
34881
  const noSchema = tools.filter((t) => t.outputSchema === void 0).map((t) => t.name);
34420
34882
  const invalid = [];
34421
34883
  const unread2 = [];
@@ -34427,7 +34889,7 @@ function runServedHalf3(runtime) {
34427
34889
  if (why || !c || c.kind !== "result") {
34428
34890
  unread2.push({
34429
34891
  anchor: `${anchor} tools/call ${t.name}`,
34430
- reason: `${t.name}: ${why} (${RULE17})`
34892
+ reason: `${t.name}: ${why} (${RULE18})`
34431
34893
  });
34432
34894
  continue;
34433
34895
  }
@@ -34442,7 +34904,7 @@ function runServedHalf3(runtime) {
34442
34904
  else if (v.kind === "unread")
34443
34905
  unread2.push({
34444
34906
  anchor: `${anchor} tools/list ${t.name}`,
34445
- reason: `${t.name}: the outputSchema could not be read at ${v.path} \u2014 ${v.why} (${RULE17})`
34907
+ reason: `${t.name}: the outputSchema could not be read at ${v.path} \u2014 ${v.why} (${RULE18})`
34446
34908
  });
34447
34909
  else validated++;
34448
34910
  }
@@ -34456,7 +34918,7 @@ function runServedHalf3(runtime) {
34456
34918
  parts.push(`${invalid.length} served result(s) do not validate: ${invalid.join("; ")}`);
34457
34919
  return settle(
34458
34920
  ID17,
34459
- { id: ID17, anchor, state: "non-conforming", verdict: `${parts.join("; ")} (${RULE17})` },
34921
+ { id: ID17, anchor, state: "non-conforming", verdict: `${parts.join("; ")} (${RULE18})` },
34460
34922
  unread2
34461
34923
  );
34462
34924
  }
@@ -34466,14 +34928,14 @@ function runServedHalf3(runtime) {
34466
34928
  id: ID17,
34467
34929
  anchor,
34468
34930
  state: "present",
34469
- verdict: `${tools.length} served tool(s) declare an outputSchema; ${validated} successful result(s) read, each structuredContent valid against it (${RULE17})`
34931
+ verdict: `${tools.length} served tool(s) declare an outputSchema; ${validated} successful result(s) read, each structuredContent valid against it (${RULE18})`
34470
34932
  },
34471
34933
  unread2
34472
34934
  );
34473
34935
  }
34474
34936
  var s51ServedOutput = {
34475
34937
  id: ID17,
34476
- rule: RULE17,
34938
+ rule: RULE18,
34477
34939
  pin: S51_RULES_PIN,
34478
34940
  run: runStatic5,
34479
34941
  runServed: (runtime) => runServedHalf3(runtime)
@@ -34482,7 +34944,7 @@ var s51ServedOutput = {
34482
34944
  // src/detectors/s52-no-null-success.ts
34483
34945
  import * as ts3 from "typescript";
34484
34946
  var ID18 = "S52 no-null-success";
34485
- var RULE18 = "S-52";
34947
+ var RULE19 = "S-52";
34486
34948
  function nullReturns(tool, read) {
34487
34949
  const red = [];
34488
34950
  const unread2 = [];
@@ -34501,7 +34963,7 @@ function nullReturns(tool, read) {
34501
34963
  else if (v.kind === "unread")
34502
34964
  unread2.push({
34503
34965
  anchor: r.anchor,
34504
- reason: `${tool}: the returned value is ${v.form} (${RULE18})`
34966
+ reason: `${tool}: the returned value is ${v.form} (${RULE19})`
34505
34967
  });
34506
34968
  else {
34507
34969
  if (isErrorObject(v.node)) continue;
@@ -34546,25 +35008,25 @@ function runStatic6(tree) {
34546
35008
  return couldNotJudge(
34547
35009
  ID18,
34548
35010
  surface ?? unresolved[0],
34549
- noToolsLocatedReason(tree, `no handler was read (${RULE18})`)
35011
+ noToolsLocatedReason(tree, `no handler was read (${RULE19})`)
34550
35012
  );
34551
35013
  return {
34552
35014
  id: ID18,
34553
35015
  anchor: tree.root,
34554
35016
  state: "absent",
34555
- verdict: `no MCP tool registered in product source \u2014 ${RULE18} n/a`
35017
+ verdict: `no MCP tool registered in product source \u2014 ${RULE19} n/a`
34556
35018
  };
34557
35019
  }
34558
35020
  const red = [];
34559
35021
  const unread2 = unresolved.map((a) => ({
34560
35022
  anchor: a,
34561
- reason: `a tool registered here has a name the scan cannot resolve, so its handler is unread (${RULE18})`
35023
+ reason: `a tool registered here has a name the scan cannot resolve, so its handler is unread (${RULE19})`
34562
35024
  }));
34563
35025
  const read = [];
34564
35026
  for (const t of tools) {
34565
35027
  const h = readHandler(tree, t);
34566
35028
  if (h.kind === "unread") {
34567
- unread2.push({ anchor: h.anchor, reason: `${h.reason} (${RULE18})` });
35029
+ unread2.push({ anchor: h.anchor, reason: `${h.reason} (${RULE19})` });
34568
35030
  continue;
34569
35031
  }
34570
35032
  read.push(t.name);
@@ -34579,7 +35041,7 @@ function runStatic6(tree) {
34579
35041
  id: ID18,
34580
35042
  anchor: red[0].anchor,
34581
35043
  state: "non-conforming",
34582
- verdict: `${red.length} success-path return(s) answer null or empty: ${red.map((f) => `${f.tool} ${f.form} (${f.anchor})`).join("; ")} \u2014 a tool that found nothing returns a typed empty value (${RULE18})`
35044
+ verdict: `${red.length} success-path return(s) answer null or empty: ${red.map((f) => `${f.tool} ${f.form} (${f.anchor})`).join("; ")} \u2014 a tool that found nothing returns a typed empty value (${RULE19})`
34583
35045
  },
34584
35046
  unread2
34585
35047
  );
@@ -34588,17 +35050,17 @@ function runStatic6(tree) {
34588
35050
  couldNotJudge(
34589
35051
  ID18,
34590
35052
  tools[0].anchor,
34591
- `static half: no success-path return writes null or empty in the ${read.length} handler(s) read (${names(read)}); unread by a static run: what each returned expression evaluates to \u2014 run --mode=dynamic (${RULE18})`
35053
+ `static half: no success-path return writes null or empty in the ${read.length} handler(s) read (${names(read)}); unread by a static run: what each returned expression evaluates to \u2014 run --mode=dynamic (${RULE19})`
34592
35054
  ),
34593
35055
  unread2
34594
35056
  );
34595
35057
  }
34596
35058
  function runServedHalf4(runtime) {
34597
- const got = servedToolCalls(ID18, RULE18, runtime);
35059
+ const got = servedToolCalls(ID18, RULE19, runtime);
34598
35060
  if ("cnj" in got) return got.cnj;
34599
35061
  const { calls, anchor } = got;
34600
35062
  if (runtime.tools.length === 0)
34601
- return { id: ID18, anchor, state: "absent", verdict: `the server serves no tool \u2014 ${RULE18} n/a` };
35063
+ return { id: ID18, anchor, state: "absent", verdict: `the server serves no tool \u2014 ${RULE19} n/a` };
34602
35064
  const red = [];
34603
35065
  const unread2 = [];
34604
35066
  let ok = 0;
@@ -34608,7 +35070,7 @@ function runServedHalf4(runtime) {
34608
35070
  if (why || !c || c.kind !== "result") {
34609
35071
  unread2.push({
34610
35072
  anchor: `${anchor} tools/call ${t.name}`,
34611
- reason: `${t.name}: ${why} (${RULE18})`
35073
+ reason: `${t.name}: ${why} (${RULE19})`
34612
35074
  });
34613
35075
  continue;
34614
35076
  }
@@ -34623,7 +35085,7 @@ function runServedHalf4(runtime) {
34623
35085
  id: ID18,
34624
35086
  anchor,
34625
35087
  state: "non-conforming",
34626
- verdict: `${red.length} successful result(s) answer null or empty: ${red.join("; ")} (${RULE18})`
35088
+ verdict: `${red.length} successful result(s) answer null or empty: ${red.join("; ")} (${RULE19})`
34627
35089
  },
34628
35090
  unread2
34629
35091
  );
@@ -34633,14 +35095,14 @@ function runServedHalf4(runtime) {
34633
35095
  id: ID18,
34634
35096
  anchor,
34635
35097
  state: "present",
34636
- verdict: `${ok} successful result(s) read, each carrying a typed value (${RULE18})`
35098
+ verdict: `${ok} successful result(s) read, each carrying a typed value (${RULE19})`
34637
35099
  },
34638
35100
  unread2
34639
35101
  );
34640
35102
  }
34641
35103
  var s52NoNullSuccess = {
34642
35104
  id: ID18,
34643
- rule: RULE18,
35105
+ rule: RULE19,
34644
35106
  pin: S51_RULES_PIN,
34645
35107
  run: runStatic6,
34646
35108
  runServed: (runtime) => runServedHalf4(runtime)
@@ -34649,7 +35111,7 @@ var s52NoNullSuccess = {
34649
35111
  // src/detectors/s53-structured-not-text.ts
34650
35112
  import * as ts4 from "typescript";
34651
35113
  var ID19 = "S53 structured-not-text";
34652
- var RULE19 = "S-53";
35114
+ var RULE20 = "S-53";
34653
35115
  function classifyTextExpr(e, sf, depth = 0) {
34654
35116
  let x = e;
34655
35117
  while (ts4.isParenthesizedExpression(x) || ts4.isAsExpression(x)) x = x.expression;
@@ -34736,26 +35198,26 @@ function runStatic7(tree) {
34736
35198
  return couldNotJudge(
34737
35199
  ID19,
34738
35200
  surface ?? unresolved[0],
34739
- noToolsLocatedReason(tree, `no handler was read (${RULE19})`)
35201
+ noToolsLocatedReason(tree, `no handler was read (${RULE20})`)
34740
35202
  );
34741
35203
  return {
34742
35204
  id: ID19,
34743
35205
  anchor: tree.root,
34744
35206
  state: "absent",
34745
- verdict: `no MCP tool registered in product source \u2014 ${RULE19} n/a`
35207
+ verdict: `no MCP tool registered in product source \u2014 ${RULE20} n/a`
34746
35208
  };
34747
35209
  }
34748
35210
  const red = [];
34749
35211
  const unread2 = unresolved.map((a) => ({
34750
35212
  anchor: a,
34751
- reason: `a tool registered here has a name the scan cannot resolve, so its handler is unread (${RULE19})`
35213
+ reason: `a tool registered here has a name the scan cannot resolve, so its handler is unread (${RULE20})`
34752
35214
  }));
34753
35215
  const read = [];
34754
35216
  let firstRed = "";
34755
35217
  for (const t of tools) {
34756
35218
  const h = readHandler(tree, t);
34757
35219
  if (h.kind === "unread") {
34758
- unread2.push({ anchor: h.anchor, reason: `${h.reason} (${RULE19})` });
35220
+ unread2.push({ anchor: h.anchor, reason: `${h.reason} (${RULE20})` });
34759
35221
  continue;
34760
35222
  }
34761
35223
  read.push(t.name);
@@ -34766,7 +35228,7 @@ function runStatic7(tree) {
34766
35228
  if (v.kind === "unread")
34767
35229
  unread2.push({
34768
35230
  anchor: r.anchor,
34769
- reason: `${t.name}: the returned value is ${v.form} (${RULE19})`
35231
+ reason: `${t.name}: the returned value is ${v.form} (${RULE20})`
34770
35232
  });
34771
35233
  continue;
34772
35234
  }
@@ -34775,7 +35237,7 @@ function runStatic7(tree) {
34775
35237
  if (sc.kind === "spread") {
34776
35238
  unread2.push({
34777
35239
  anchor: r.anchor,
34778
- reason: `${t.name}: a result object built with a spread, structuredContent unread (${RULE19})`
35240
+ reason: `${t.name}: a result object built with a spread, structuredContent unread (${RULE20})`
34779
35241
  });
34780
35242
  continue;
34781
35243
  }
@@ -34785,7 +35247,7 @@ function runStatic7(tree) {
34785
35247
  red.push(`${t.name} ${c.form}, no structuredContent (${r.anchor})`);
34786
35248
  firstRed ||= r.anchor;
34787
35249
  } else if (c.kind === "unread")
34788
- unread2.push({ anchor: r.anchor, reason: `${t.name}: ${c.form} (${RULE19})` });
35250
+ unread2.push({ anchor: r.anchor, reason: `${t.name}: ${c.form} (${RULE20})` });
34789
35251
  }
34790
35252
  }
34791
35253
  }
@@ -34796,7 +35258,7 @@ function runStatic7(tree) {
34796
35258
  id: ID19,
34797
35259
  anchor: firstRed,
34798
35260
  state: "non-conforming",
34799
- verdict: `${red.length} success-path return(s) carry data in the text only: ${red.join("; ")} \u2014 return it as structuredContent under the outputSchema, the text being its serialization (${RULE19})`
35261
+ verdict: `${red.length} success-path return(s) carry data in the text only: ${red.join("; ")} \u2014 return it as structuredContent under the outputSchema, the text being its serialization (${RULE20})`
34800
35262
  },
34801
35263
  unread2
34802
35264
  );
@@ -34805,7 +35267,7 @@ function runStatic7(tree) {
34805
35267
  couldNotJudge(
34806
35268
  ID19,
34807
35269
  tools[0].anchor,
34808
- `static half: no text-only return carrying data in the ${read.length} handler(s) read (${names(read)}); unread by a static run: whether each served text is the serialization of its structuredContent \u2014 run --mode=dynamic (${RULE19})`
35270
+ `static half: no text-only return carrying data in the ${read.length} handler(s) read (${names(read)}); unread by a static run: whether each served text is the serialization of its structuredContent \u2014 run --mode=dynamic (${RULE20})`
34809
35271
  ),
34810
35272
  unread2
34811
35273
  );
@@ -34900,11 +35362,11 @@ function servedTextForm(c) {
34900
35362
  return { kind: "green" };
34901
35363
  }
34902
35364
  function runServedHalf5(runtime) {
34903
- const got = servedToolCalls(ID19, RULE19, runtime);
35365
+ const got = servedToolCalls(ID19, RULE20, runtime);
34904
35366
  if ("cnj" in got) return got.cnj;
34905
35367
  const { calls, anchor } = got;
34906
35368
  if (runtime.tools.length === 0)
34907
- return { id: ID19, anchor, state: "absent", verdict: `the server serves no tool \u2014 ${RULE19} n/a` };
35369
+ return { id: ID19, anchor, state: "absent", verdict: `the server serves no tool \u2014 ${RULE20} n/a` };
34908
35370
  const red = [];
34909
35371
  const unread2 = [];
34910
35372
  let ok = 0;
@@ -34914,7 +35376,7 @@ function runServedHalf5(runtime) {
34914
35376
  if (why || !c || c.kind !== "result") {
34915
35377
  unread2.push({
34916
35378
  anchor: `${anchor} tools/call ${t.name}`,
34917
- reason: `${t.name}: ${why} (${RULE19})`
35379
+ reason: `${t.name}: ${why} (${RULE20})`
34918
35380
  });
34919
35381
  continue;
34920
35382
  }
@@ -34923,7 +35385,7 @@ function runServedHalf5(runtime) {
34923
35385
  else if (v.kind === "unread")
34924
35386
  unread2.push({
34925
35387
  anchor: `${anchor} tools/call ${t.name}`,
34926
- reason: `${t.name}: ${v.form} (${RULE19})`
35388
+ reason: `${t.name}: ${v.form} (${RULE20})`
34927
35389
  });
34928
35390
  else ok++;
34929
35391
  }
@@ -34934,7 +35396,7 @@ function runServedHalf5(runtime) {
34934
35396
  id: ID19,
34935
35397
  anchor,
34936
35398
  state: "non-conforming",
34937
- verdict: `${red.length} successful result(s) carry data in free text: ${red.join("; ")} (${RULE19})`
35399
+ verdict: `${red.length} successful result(s) carry data in free text: ${red.join("; ")} (${RULE20})`
34938
35400
  },
34939
35401
  unread2
34940
35402
  );
@@ -34944,25 +35406,25 @@ function runServedHalf5(runtime) {
34944
35406
  id: ID19,
34945
35407
  anchor,
34946
35408
  state: "present",
34947
- verdict: `${ok} successful result(s) read: data in structuredContent, text its serialization or summary (${RULE19})`
35409
+ verdict: `${ok} successful result(s) read: data in structuredContent, text its serialization or summary (${RULE20})`
34948
35410
  },
34949
35411
  unread2
34950
35412
  );
34951
35413
  }
34952
35414
  var s53StructuredNotText = {
34953
35415
  id: ID19,
34954
- rule: RULE19,
35416
+ rule: RULE20,
34955
35417
  pin: S51_RULES_PIN,
34956
35418
  run: runStatic7,
34957
35419
  runServed: (runtime) => runServedHalf5(runtime)
34958
35420
  };
34959
35421
 
34960
35422
  // src/detectors/s54-tools-tested.ts
34961
- import { readFileSync as readFileSync24, readdirSync as readdirSync17, statSync as statSync24 } from "fs";
34962
- import { join as join35, relative as relative15, sep as sep7 } from "path";
35423
+ import { readFileSync as readFileSync26, readdirSync as readdirSync18, statSync as statSync24 } from "fs";
35424
+ import { join as join36, relative as relative17, sep as sep9 } from "path";
34963
35425
  import * as ts5 from "typescript";
34964
35426
  var ID20 = "S54 tools-tested";
34965
- var RULE20 = "S-54";
35427
+ var RULE21 = "S-54";
34966
35428
  var TEST_DIR = /(^|\/)(test|tests|__tests__|spec|specs|e2e)\//;
34967
35429
  var TEST_NAME = /\.(test|spec)\.[cm]?[jt]sx?$/;
34968
35430
  var CODE2 = /\.[cm]?[jt]sx?$/;
@@ -34970,8 +35432,8 @@ var NOT_TESTS = /* @__PURE__ */ new Set([
34970
35432
  ...Object.keys(SKIP_DIR_INFO).filter((d) => !SKIP_DIR_INFO[d].authored),
34971
35433
  "fixtures"
34972
35434
  ]);
34973
- function isTestFile(rel) {
34974
- return CODE2.test(rel) && !/\.d\.[cm]?ts$/.test(rel) && (TEST_NAME.test(rel) || TEST_DIR.test(rel));
35435
+ function isTestFile(rel2) {
35436
+ return CODE2.test(rel2) && !/\.d\.[cm]?ts$/.test(rel2) && (TEST_NAME.test(rel2) || TEST_DIR.test(rel2));
34975
35437
  }
34976
35438
  function testFiles2(root) {
34977
35439
  const files = [];
@@ -34979,23 +35441,23 @@ function testFiles2(root) {
34979
35441
  const walk3 = (dir) => {
34980
35442
  let entries;
34981
35443
  try {
34982
- entries = readdirSync17(dir);
35444
+ entries = readdirSync18(dir);
34983
35445
  } catch (e) {
34984
35446
  unread2.push({
34985
- anchor: relative15(root, dir) || ".",
34986
- reason: `directory not listed (${e.message}) (${RULE20})`
35447
+ anchor: relative17(root, dir) || ".",
35448
+ reason: `directory not listed (${e.message}) (${RULE21})`
34987
35449
  });
34988
35450
  return;
34989
35451
  }
34990
35452
  for (const name of entries) {
34991
- const full = join35(dir, name);
35453
+ const full = join36(dir, name);
34992
35454
  let st;
34993
35455
  try {
34994
35456
  st = statSync24(full);
34995
35457
  } catch (e) {
34996
35458
  unread2.push({
34997
- anchor: relative15(root, full),
34998
- reason: `not read (${e.message}) (${RULE20})`
35459
+ anchor: relative17(root, full),
35460
+ reason: `not read (${e.message}) (${RULE21})`
34999
35461
  });
35000
35462
  continue;
35001
35463
  }
@@ -35003,16 +35465,16 @@ function testFiles2(root) {
35003
35465
  if (!NOT_TESTS.has(name)) walk3(full);
35004
35466
  continue;
35005
35467
  }
35006
- const rel = relative15(root, full).split(sep7).join("/");
35007
- if (!st.isFile() || !isTestFile(rel)) continue;
35468
+ const rel2 = relative17(root, full).split(sep9).join("/");
35469
+ if (!st.isFile() || !isTestFile(rel2)) continue;
35008
35470
  try {
35009
- const text = readFileSync24(full, "utf8");
35010
- const kind = /x$/.test(rel) ? ts5.ScriptKind.TSX : /\.[cm]?js$/.test(rel) ? ts5.ScriptKind.JS : ts5.ScriptKind.TS;
35011
- files.push({ rel, sf: ts5.createSourceFile(rel, text, ts5.ScriptTarget.Latest, true, kind) });
35471
+ const text = readFileSync26(full, "utf8");
35472
+ const kind = /x$/.test(rel2) ? ts5.ScriptKind.TSX : /\.[cm]?js$/.test(rel2) ? ts5.ScriptKind.JS : ts5.ScriptKind.TS;
35473
+ files.push({ rel: rel2, sf: ts5.createSourceFile(rel2, text, ts5.ScriptTarget.Latest, true, kind) });
35012
35474
  } catch (e) {
35013
35475
  unread2.push({
35014
- anchor: rel,
35015
- reason: `test file not read (${e.message}) (${RULE20})`
35476
+ anchor: rel2,
35477
+ reason: `test file not read (${e.message}) (${RULE21})`
35016
35478
  });
35017
35479
  }
35018
35480
  }
@@ -35125,10 +35587,10 @@ function testCalls(files, tools) {
35125
35587
  const helpers = deriveHelpers(files);
35126
35588
  const wanted = new Set(tools);
35127
35589
  const out = new Map(tools.map((t) => [t, []]));
35128
- for (const { rel, sf } of files) {
35590
+ for (const { rel: rel2, sf } of files) {
35129
35591
  const visit = (n) => {
35130
35592
  if ((ts5.isStringLiteral(n) || ts5.isNoSubstitutionTemplateLiteral(n)) && wanted.has(n.text) && callsAt(n, helpers))
35131
- out.get(n.text)?.push(`${rel}:${sf.getLineAndCharacterOfPosition(n.getStart(sf)).line + 1}`);
35593
+ out.get(n.text)?.push(`${rel2}:${sf.getLineAndCharacterOfPosition(n.getStart(sf)).line + 1}`);
35132
35594
  ts5.forEachChild(n, visit);
35133
35595
  };
35134
35596
  visit(sf);
@@ -35161,25 +35623,25 @@ function runStatic8(tree) {
35161
35623
  return couldNotJudge(
35162
35624
  ID20,
35163
35625
  surface ?? unresolved[0],
35164
- noToolsLocatedReason(tree, `no tool name was derived (${RULE20})`)
35626
+ noToolsLocatedReason(tree, `no tool name was derived (${RULE21})`)
35165
35627
  );
35166
35628
  return {
35167
35629
  id: ID20,
35168
35630
  anchor: tree.root,
35169
35631
  state: "absent",
35170
- verdict: `no MCP tool registered in product source \u2014 ${RULE20} n/a`
35632
+ verdict: `no MCP tool registered in product source \u2014 ${RULE21} n/a`
35171
35633
  };
35172
35634
  }
35173
35635
  let root = tree.root;
35174
35636
  try {
35175
- if (!statSync24(root).isDirectory()) root = join35(root, "..");
35637
+ if (!statSync24(root).isDirectory()) root = join36(root, "..");
35176
35638
  } catch {
35177
35639
  }
35178
35640
  const { files, unread: unread2 } = testFiles2(root);
35179
35641
  for (const a of unresolved)
35180
35642
  unread2.push({
35181
35643
  anchor: a,
35182
- reason: `a tool registered here has a computed name, so whether a test calls it is unread (${RULE20})`
35644
+ reason: `a tool registered here has a computed name, so whether a test calls it is unread (${RULE21})`
35183
35645
  });
35184
35646
  if (files.length === 0)
35185
35647
  return settle(
@@ -35187,7 +35649,7 @@ function runStatic8(tree) {
35187
35649
  couldNotJudge(
35188
35650
  ID20,
35189
35651
  tools[0].anchor,
35190
- `no test file under ${root} (searched: *.test.* / *.spec.* and test/, tests/, __tests__/, spec/, specs/, e2e/ directories): a suite outside the scanned root is not read, so whether the ${tools.length} registered tool(s) are called is unread (${RULE20})`
35652
+ `no test file under ${root} (searched: *.test.* / *.spec.* and test/, tests/, __tests__/, spec/, specs/, e2e/ directories): a suite outside the scanned root is not read, so whether the ${tools.length} registered tool(s) are called is unread (${RULE21})`
35191
35653
  ),
35192
35654
  unread2
35193
35655
  );
@@ -35203,7 +35665,7 @@ function runStatic8(tree) {
35203
35665
  id: ID20,
35204
35666
  anchor: untested[0].anchor,
35205
35667
  state: "non-conforming",
35206
- verdict: `${untested.length} of ${tools.length} registered tool(s) are called by no test (${files.length} test file(s) read under ${root}; call positions K1..K4): ${names(untested.map((t) => `${t.name} (${t.anchor})`))} (${RULE20})`
35668
+ verdict: `${untested.length} of ${tools.length} registered tool(s) are called by no test (${files.length} test file(s) read under ${root}; call positions K1..K4): ${names(untested.map((t) => `${t.name} (${t.anchor})`))} (${RULE21})`
35207
35669
  },
35208
35670
  unread2
35209
35671
  );
@@ -35213,14 +35675,14 @@ function runStatic8(tree) {
35213
35675
  id: ID20,
35214
35676
  anchor: tools[0].anchor,
35215
35677
  state: "present",
35216
- verdict: `${tools.length} registered tool(s), each called by at least one test (${files.length} test file(s) read under ${root}) (${RULE20})`
35678
+ verdict: `${tools.length} registered tool(s), each called by at least one test (${files.length} test file(s) read under ${root}) (${RULE21})`
35217
35679
  },
35218
35680
  unread2
35219
35681
  );
35220
35682
  }
35221
35683
  function runServedHalf6(runtime) {
35222
35684
  const anchor = `${runtime.root} (served)`;
35223
- const why = runtime.remote ? `a URL scan has no repository: S-54 reads the repository's test files, which the served list does not carry (${RULE20})` : `the served tools/list does not say which tests call a tool: S-54 is read from the repository (static) (${RULE20})`;
35685
+ const why = runtime.remote ? `a URL scan has no repository: S-54 reads the repository's test files, which the served list does not carry (${RULE21})` : `the served tools/list does not say which tests call a tool: S-54 is read from the repository (static) (${RULE21})`;
35224
35686
  return couldNotJudge(
35225
35687
  ID20,
35226
35688
  anchor,
@@ -35229,7 +35691,7 @@ function runServedHalf6(runtime) {
35229
35691
  }
35230
35692
  var s54ToolsTested = {
35231
35693
  id: ID20,
35232
- rule: RULE20,
35694
+ rule: RULE21,
35233
35695
  pin: S51_RULES_PIN,
35234
35696
  run: runStatic8,
35235
35697
  runServed: (runtime) => runServedHalf6(runtime)
@@ -35275,6 +35737,7 @@ var registered = [
35275
35737
  c37DirectoryListing,
35276
35738
  c38FieldBudget,
35277
35739
  c40ToolDocumentation,
35740
+ c41VantageosLatest,
35278
35741
  s45OriginTargets,
35279
35742
  s46RegistrationRedirects,
35280
35743
  s47WebhookDelivery,
@@ -35519,13 +35982,13 @@ function parseEventsArgs(args) {
35519
35982
  }
35520
35983
 
35521
35984
  // src/gate.ts
35522
- import { readFileSync as readFileSync25 } from "fs";
35985
+ import { readFileSync as readFileSync27 } from "fs";
35523
35986
  var OWED_FILE_NAME = "mcp-doctor.owed.json";
35524
35987
  var FORMAT = `expected {"owed": [{"id": "<detector id, the table's first column>", "reason": "<why this row may publish undecided>"}, ...]}`;
35525
35988
  function readOwedFile(path, opts) {
35526
35989
  let text;
35527
35990
  try {
35528
- text = readFileSync25(path, "utf8");
35991
+ text = readFileSync27(path, "utf8");
35529
35992
  } catch (err) {
35530
35993
  const code = err.code;
35531
35994
  if (code === "ENOENT" && !opts.explicit) return { kind: "none", path };
@@ -35727,7 +36190,7 @@ import { createServer } from "https";
35727
36190
  import { Webhook } from "standardwebhooks";
35728
36191
 
35729
36192
  // src/runtime/publicTarget.ts
35730
- import { spawnSync as spawnSync2 } from "child_process";
36193
+ import { spawnSync as spawnSync3 } from "child_process";
35731
36194
  import { isIP } from "net";
35732
36195
 
35733
36196
  // src/runtime/ianaSpecial.ts
@@ -36159,7 +36622,7 @@ function resolveHost(host) {
36159
36622
  const bare = host.replace(/^\[|\]$/g, "");
36160
36623
  if (isIP(bare) !== 0) return { addresses: [bare] };
36161
36624
  const script = "require('node:dns').promises.lookup(process.argv[1], { all: true, verbatim: true }).then((a) => process.stdout.write(JSON.stringify(a.map((x) => x.address)))).catch((e) => { process.stdout.write(JSON.stringify({ error: e && e.code ? e.code : String(e) })); })";
36162
- const out = spawnSync2(process.execPath, ["-e", script, bare], {
36625
+ const out = spawnSync3(process.execPath, ["-e", script, bare], {
36163
36626
  encoding: "utf8",
36164
36627
  timeout: 1e4
36165
36628
  });
@@ -37075,19 +37538,19 @@ function verifySignature(secret, h) {
37075
37538
  }
37076
37539
 
37077
37540
  // src/runtime/launch.ts
37078
- import { spawnSync as spawnSync3 } from "child_process";
37079
- import { existsSync as existsSync23, readFileSync as readFileSync26, statSync as statSync25 } from "fs";
37080
- import { dirname as dirname17, isAbsolute, join as join36, resolve as resolve3 } from "path";
37541
+ import { spawnSync as spawnSync4 } from "child_process";
37542
+ import { existsSync as existsSync23, readFileSync as readFileSync28, statSync as statSync25 } from "fs";
37543
+ import { dirname as dirname18, isAbsolute, join as join37, resolve as resolve3 } from "path";
37081
37544
  function findPackageDir(target) {
37082
37545
  let dir;
37083
37546
  try {
37084
- dir = statSync25(target).isDirectory() ? target : dirname17(target);
37547
+ dir = statSync25(target).isDirectory() ? target : dirname18(target);
37085
37548
  } catch {
37086
37549
  return null;
37087
37550
  }
37088
37551
  for (let depth = 0; depth < 8; depth++) {
37089
- if (existsSync23(join36(dir, "package.json"))) return dir;
37090
- const parent = dirname17(dir);
37552
+ if (existsSync23(join37(dir, "package.json"))) return dir;
37553
+ const parent = dirname18(dir);
37091
37554
  if (parent === dir) break;
37092
37555
  dir = parent;
37093
37556
  }
@@ -37111,13 +37574,13 @@ function deriveLaunchPlan(target) {
37111
37574
  }
37112
37575
  let pkg;
37113
37576
  try {
37114
- if (!statSync25(join36(pkgDir, "package.json")).isFile()) {
37115
- return { error: `${join36(pkgDir, "package.json")} is not a regular file \u2014 not read` };
37577
+ if (!statSync25(join37(pkgDir, "package.json")).isFile()) {
37578
+ return { error: `${join37(pkgDir, "package.json")} is not a regular file \u2014 not read` };
37116
37579
  }
37117
- pkg = JSON.parse(readFileSync26(join36(pkgDir, "package.json"), "utf8"));
37580
+ pkg = JSON.parse(readFileSync28(join37(pkgDir, "package.json"), "utf8"));
37118
37581
  } catch (err) {
37119
37582
  return {
37120
- error: `could not parse ${join36(pkgDir, "package.json")}: ${err instanceof Error ? err.message : String(err)}`
37583
+ error: `could not parse ${join37(pkgDir, "package.json")}: ${err instanceof Error ? err.message : String(err)}`
37121
37584
  };
37122
37585
  }
37123
37586
  const bin = firstBinEntry(pkg.bin);
@@ -37898,14 +38361,14 @@ function readEvalCounts(target) {
37898
38361
  if (!pkgDir) return { counts };
37899
38362
  let dir = pkgDir;
37900
38363
  for (let depth = 0; depth < 8; depth++) {
37901
- const candidate = join36(dir, "evals", "evals.json");
38364
+ const candidate = join37(dir, "evals", "evals.json");
37902
38365
  if (existsSync23(candidate)) {
37903
38366
  let text;
37904
38367
  try {
37905
38368
  if (!statSync25(candidate).isFile()) {
37906
38369
  return { counts, unreadable: `${candidate} is not a regular file \u2014 not read` };
37907
38370
  }
37908
- text = readFileSync26(candidate, "utf8");
38371
+ text = readFileSync28(candidate, "utf8");
37909
38372
  } catch (err) {
37910
38373
  return {
37911
38374
  counts,
@@ -37921,7 +38384,7 @@ function readEvalCounts(target) {
37921
38384
  }
37922
38385
  return { counts };
37923
38386
  }
37924
- const parent = dirname17(dir);
38387
+ const parent = dirname18(dir);
37925
38388
  if (parent === dir) break;
37926
38389
  dir = parent;
37927
38390
  }
@@ -37936,7 +38399,7 @@ function statSyncSafe(p) {
37936
38399
  }
37937
38400
  function deriveExpectedCommit(cwd) {
37938
38401
  try {
37939
- const out = spawnSync3("git", ["rev-parse", "HEAD"], {
38402
+ const out = spawnSync4("git", ["rev-parse", "HEAD"], {
37940
38403
  cwd,
37941
38404
  encoding: "utf8",
37942
38405
  timeout: 5e3
@@ -38030,7 +38493,7 @@ function displayUrl(url) {
38030
38493
  }
38031
38494
  }
38032
38495
  function introspect(plan, root, evalSource, expectedCommit, evalsNote, secrets) {
38033
- const proc = spawnSync3(process.execPath, ["--input-type=module", "-e", INTROSPECTOR], {
38496
+ const proc = spawnSync4(process.execPath, ["--input-type=module", "-e", INTROSPECTOR], {
38034
38497
  env: { ...process.env, MCP_DOCTOR_PLAN: JSON.stringify(plan) },
38035
38498
  encoding: "utf8",
38036
38499
  timeout: 2e4,
@@ -38295,7 +38758,7 @@ function parseUrlArgs(args, env) {
38295
38758
  }
38296
38759
 
38297
38760
  // src/kit/rule-ids.ts
38298
- import { readFileSync as readFileSync27 } from "fs";
38761
+ import { readFileSync as readFileSync29 } from "fs";
38299
38762
  var StandardUnreadableError = class extends Error {
38300
38763
  constructor(path, cause) {
38301
38764
  super(
@@ -38335,7 +38798,7 @@ function stateless(pattern) {
38335
38798
  function deriveRuleIds(path, pattern) {
38336
38799
  let blob;
38337
38800
  try {
38338
- blob = readFileSync27(path, "utf8");
38801
+ blob = readFileSync29(path, "utf8");
38339
38802
  } catch (e) {
38340
38803
  throw new StandardUnreadableError(path, e);
38341
38804
  }
@@ -38451,7 +38914,7 @@ function checkedRuleIds(entries) {
38451
38914
 
38452
38915
  // src/kit/report.ts
38453
38916
  import { mkdirSync, writeFileSync as writeFileSync2 } from "fs";
38454
- import { dirname as dirname18 } from "path";
38917
+ import { dirname as dirname19 } from "path";
38455
38918
  function renderReport(ctx) {
38456
38919
  const lines2 = [];
38457
38920
  lines2.push(`${ctx.title} report \u2014 target: ${ctx.target}`);
@@ -38469,7 +38932,7 @@ function renderReport(ctx) {
38469
38932
  return lines2.join("\n");
38470
38933
  }
38471
38934
  function writeReport(path, ctx) {
38472
- mkdirSync(dirname18(path), { recursive: true });
38935
+ mkdirSync(dirname19(path), { recursive: true });
38473
38936
  writeFileSync2(path, renderReport(ctx), "utf8");
38474
38937
  }
38475
38938
 
@@ -38796,11 +39259,11 @@ function renderJson(surface, results, skipped, coverage, gate) {
38796
39259
  function renderResults(surface, results, coverageLine) {
38797
39260
  const cols = { item: 24, anchor: 26, state: 15 };
38798
39261
  const header = `${pad("item", cols.item)} | ${pad("file:line", cols.anchor)} | ${pad("state", cols.state)} | verdict`;
38799
- const sep8 = "-".repeat(header.length);
39262
+ const sep10 = "-".repeat(header.length);
38800
39263
  const rows = results.map(
38801
39264
  (r) => `${pad(r.id, cols.item)} | ${pad(r.anchor, cols.anchor)} | ${pad(r.state, cols.state)} | ${r.verdict}`
38802
39265
  );
38803
- const table = [`surface: ${surface}`, coverageLine, header, sep8, ...rows].join("\n");
39266
+ const table = [`surface: ${surface}`, coverageLine, header, sep10, ...rows].join("\n");
38804
39267
  const unjudged = results.filter((r) => r.state === "could-not-judge");
38805
39268
  if (unjudged.length === 0) return table;
38806
39269
  const cnjHeader = `could-not-judge (${unjudged.length}) \u2014 the doctor could NOT read these; this is NOT a clean bill:`;
@@ -38882,8 +39345,8 @@ var USAGE = [
38882
39345
  ].join("\n");
38883
39346
  function readVersion() {
38884
39347
  try {
38885
- const here = dirname19(fileURLToPath2(import.meta.url));
38886
- const manifest = JSON.parse(readFileSync28(join37(here, "..", "package.json"), "utf8"));
39348
+ const here = dirname20(fileURLToPath2(import.meta.url));
39349
+ const manifest = JSON.parse(readFileSync30(join38(here, "..", "package.json"), "utf8"));
38887
39350
  return manifest.version ?? null;
38888
39351
  } catch {
38889
39352
  return null;
@@ -38951,10 +39414,10 @@ function runEventsMode(endpoint, rest, options) {
38951
39414
  }
38952
39415
  function defaultOwedPath(target) {
38953
39416
  try {
38954
- if (statSync27(target).isFile()) return join37(dirname19(target), OWED_FILE_NAME);
39417
+ if (statSync27(target).isFile()) return join38(dirname20(target), OWED_FILE_NAME);
38955
39418
  } catch {
38956
39419
  }
38957
- return join37(target, OWED_FILE_NAME);
39420
+ return join38(target, OWED_FILE_NAME);
38958
39421
  }
38959
39422
  function main() {
38960
39423
  const argv = process.argv.slice(2);