nexus-agents 3.5.1 → 3.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,7 +49,7 @@ import {
49
49
  } from "./chunk-OQLFRJCW.js";
50
50
 
51
51
  // src/version.ts
52
- var VERSION = true ? "3.5.1" : "dev";
52
+ var VERSION = true ? "3.5.3" : "dev";
53
53
 
54
54
  // src/config/schemas-core.ts
55
55
  import { z } from "zod";
@@ -2287,7 +2287,7 @@ async function runDoctorFix(result) {
2287
2287
  writeLine2("\u2500".repeat(40));
2288
2288
  let fixCount = 0;
2289
2289
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
2290
- const { runSetup } = await import("./setup-command-VWOUSXWP.js");
2290
+ const { runSetup } = await import("./setup-command-5YJMFY3W.js");
2291
2291
  const setupResult = runSetup({
2292
2292
  skipMcp: true,
2293
2293
  skipRules: true,
@@ -2400,4 +2400,4 @@ export {
2400
2400
  startStdioServer,
2401
2401
  closeServer
2402
2402
  };
2403
- //# sourceMappingURL=chunk-6ZOZYECZ.js.map
2403
+ //# sourceMappingURL=chunk-454KEMNV.js.map
@@ -8,7 +8,7 @@ import {
8
8
  checkSqlite,
9
9
  defaultConfig,
10
10
  initDataDirectories
11
- } from "./chunk-6ZOZYECZ.js";
11
+ } from "./chunk-454KEMNV.js";
12
12
  import {
13
13
  BUILT_IN_EXPERTS
14
14
  } from "./chunk-YPNQPT2F.js";
@@ -2001,4 +2001,4 @@ export {
2001
2001
  setupCommand,
2002
2002
  setupCommandAsync
2003
2003
  };
2004
- //# sourceMappingURL=chunk-CQ4Y7ULT.js.map
2004
+ //# sourceMappingURL=chunk-C4GSCDCI.js.map
@@ -22,7 +22,7 @@ import {
22
22
  DEFAULT_TASK_TTL_MS,
23
23
  DEFAULT_TOOL_RATE_LIMITS,
24
24
  clampTaskTtl
25
- } from "./chunk-6ZOZYECZ.js";
25
+ } from "./chunk-454KEMNV.js";
26
26
  import {
27
27
  executeExpert
28
28
  } from "./chunk-GVLDWGSK.js";
@@ -45344,6 +45344,68 @@ function buildScanSummary(total, confirmed, falsePositives, osvCount) {
45344
45344
  return parts.join(", ");
45345
45345
  }
45346
45346
 
45347
+ // src/security/quality-gate-commands.ts
45348
+ import { existsSync as existsSync9, readFileSync as readFileSync7 } from "fs";
45349
+ import { join as join9 } from "path";
45350
+ var LOCKFILES = [
45351
+ { file: "pnpm-lock.yaml", manager: "pnpm" },
45352
+ { file: "yarn.lock", manager: "yarn" },
45353
+ { file: "bun.lockb", manager: "bun" },
45354
+ { file: "package-lock.json", manager: "npm" }
45355
+ ];
45356
+ var SCRIPT_CANDIDATES = {
45357
+ lint: ["lint"],
45358
+ typecheck: ["typecheck", "type-check", "types"],
45359
+ tests: ["test", "tests"],
45360
+ build: ["build"]
45361
+ };
45362
+ function detectPackageManager(projectDir) {
45363
+ for (const { file, manager } of LOCKFILES) {
45364
+ if (existsSync9(join9(projectDir, file))) return manager;
45365
+ }
45366
+ return "npm";
45367
+ }
45368
+ function readScripts(projectDir) {
45369
+ const manifest = join9(projectDir, "package.json");
45370
+ if (!existsSync9(manifest)) return void 0;
45371
+ try {
45372
+ const parsed = JSON.parse(readFileSync7(manifest, "utf-8"));
45373
+ if (typeof parsed !== "object" || parsed === null) return void 0;
45374
+ const scripts = parsed.scripts;
45375
+ if (typeof scripts !== "object" || scripts === null) return void 0;
45376
+ const out = {};
45377
+ for (const [name, body] of Object.entries(scripts)) {
45378
+ if (typeof body === "string") out[name] = body;
45379
+ }
45380
+ return out;
45381
+ } catch {
45382
+ return void 0;
45383
+ }
45384
+ }
45385
+ function resolveCheckCommand(projectDir, check) {
45386
+ const scripts = readScripts(projectDir);
45387
+ if (scripts === void 0) {
45388
+ return {
45389
+ kind: "unconfigured",
45390
+ reason: `no readable package.json in ${projectDir}, so the "${check}" script could not be resolved`
45391
+ };
45392
+ }
45393
+ const candidates = SCRIPT_CANDIDATES[check];
45394
+ const found = candidates.find((name) => (scripts[name] ?? "").trim() !== "");
45395
+ if (found === void 0) {
45396
+ return {
45397
+ kind: "unconfigured",
45398
+ reason: `no "${check}" script declared (looked for: ${candidates.join(", ")})`
45399
+ };
45400
+ }
45401
+ return {
45402
+ kind: "command",
45403
+ command: detectPackageManager(projectDir),
45404
+ args: ["run", "--silent", found],
45405
+ script: found
45406
+ };
45407
+ }
45408
+
45347
45409
  // src/security/quality-gate.ts
45348
45410
  async function runCommandCheck(name, command, args, cwd) {
45349
45411
  const start = Date.now();
@@ -45368,17 +45430,31 @@ async function runCommandCheck(name, command, args, cwd) {
45368
45430
  };
45369
45431
  }
45370
45432
  }
45433
+ function scriptedCheck(name, check, projectDir) {
45434
+ return async () => {
45435
+ const resolved = resolveCheckCommand(projectDir, check);
45436
+ if (resolved.kind === "unconfigured") {
45437
+ return {
45438
+ name,
45439
+ verdict: "skip",
45440
+ details: `Not run: ${resolved.reason}. Declare the script to enable this check.`,
45441
+ durationMs: 0
45442
+ };
45443
+ }
45444
+ return runCommandCheck(name, resolved.command, resolved.args, projectDir);
45445
+ };
45446
+ }
45371
45447
  function checkTypeCheck(projectDir) {
45372
- return () => runCommandCheck("type_check", "npx", ["tsc", "--noEmit", "--project", projectDir], projectDir);
45448
+ return scriptedCheck("type_check", "typecheck", projectDir);
45373
45449
  }
45374
45450
  function checkLint(projectDir) {
45375
- return () => runCommandCheck("lint", "npx", ["eslint", "--max-warnings", "0", projectDir], projectDir);
45451
+ return scriptedCheck("lint", "lint", projectDir);
45376
45452
  }
45377
45453
  function checkTests(projectDir) {
45378
- return () => runCommandCheck("tests", "npx", ["vitest", "run", "--dir", projectDir], projectDir);
45454
+ return scriptedCheck("tests", "tests", projectDir);
45379
45455
  }
45380
45456
  function checkBuild(projectDir) {
45381
- return () => runCommandCheck("build", "pnpm", ["build"], projectDir);
45457
+ return scriptedCheck("build", "build", projectDir);
45382
45458
  }
45383
45459
  function aggregateResults2(checks) {
45384
45460
  let pass = 0;
@@ -45389,14 +45465,23 @@ function aggregateResults2(checks) {
45389
45465
  else if (c.verdict === "fail") fail++;
45390
45466
  else skip2++;
45391
45467
  }
45392
- return { verdict: fail > 0 ? "fail" : "pass", summary: { pass, fail, skip: skip2 } };
45468
+ const verdict = fail > 0 ? "fail" : pass === 0 && skip2 > 0 ? "skip" : "pass";
45469
+ return { verdict, summary: { pass, fail, skip: skip2 } };
45393
45470
  }
45394
45471
  function generateFeedback2(checks) {
45395
45472
  const failures = checks.filter((c) => c.verdict === "fail");
45396
- if (failures.length === 0) return "All checks passed.";
45473
+ const skipped = checks.filter((c) => c.verdict === "skip");
45474
+ const skipNote = skipped.length > 0 ? `
45475
+ ${String(skipped.length)} check(s) did not run:
45476
+ ${skipped.map((s) => `- ${s.name}: ${s.details}`).join("\n")}` : "";
45477
+ if (failures.length === 0) {
45478
+ const ran = checks.length - skipped.length;
45479
+ const headline = ran === 0 ? "No checks ran." : `All ${String(ran)} check(s) that ran passed.`;
45480
+ return `${headline}${skipNote}`;
45481
+ }
45397
45482
  const lines = failures.map((f) => `- ${f.name}: ${f.details}`);
45398
45483
  return `${String(failures.length)} check(s) failed:
45399
- ${lines.join("\n")}`;
45484
+ ${lines.join("\n")}${skipNote}`;
45400
45485
  }
45401
45486
  async function runQualityGate(stage, checks, iteration = 1) {
45402
45487
  const results = [];
@@ -45952,7 +46037,7 @@ Verdict: PASS/NEEDS_WORK/REJECT`,
45952
46037
  checkLint(target),
45953
46038
  checkTests(target)
45954
46039
  ]);
45955
- const passed = result.verdict !== "fail";
46040
+ const passed = result.verdict === "pass";
45956
46041
  const ms = getTimeProvider().now() - start;
45957
46042
  emitStageEvent2("quality-gate", passed ? "completed" : "failed", { durationMs: ms });
45958
46043
  recordOutcome({
@@ -45962,11 +46047,8 @@ Verdict: PASS/NEEDS_WORK/REJECT`,
45962
46047
  success: passed,
45963
46048
  durationMs: ms
45964
46049
  });
45965
- await postProgress(
45966
- config,
45967
- "QualityGate",
45968
- passed ? "Passed" : `Gate failed: ${result.feedback}`
45969
- );
46050
+ const verdictNote = result.verdict === "skip" ? `Gate unmeasured: ${result.feedback}` : `Gate failed: ${result.feedback}`;
46051
+ await postProgress(config, "QualityGate", passed ? "Passed" : verdictNote);
45970
46052
  return { passed, feedback: result.feedback };
45971
46053
  },
45972
46054
  securityScan: async () => {
@@ -45976,7 +46058,7 @@ Verdict: PASS/NEEDS_WORK/REJECT`,
45976
46058
  await postProgress(config, "Security", `Scanning ${target}...`);
45977
46059
  const check = checkSecurityScan(target);
45978
46060
  const result = await check();
45979
- const passed = result.verdict !== "fail";
46061
+ const passed = result.verdict === "pass";
45980
46062
  const ms = getTimeProvider().now() - start;
45981
46063
  emitStageEvent2("security", passed ? "completed" : "failed", { durationMs: ms });
45982
46064
  recordOutcome({
@@ -46456,8 +46538,8 @@ function reviewedDiffWasTruncated(diff) {
46456
46538
  }
46457
46539
 
46458
46540
  // src/audit/pr-review-record-store.ts
46459
- import { appendFileSync as appendFileSync4, existsSync as existsSync9, mkdirSync as mkdirSync6, readFileSync as readFileSync7 } from "fs";
46460
- import { dirname as dirname4, isAbsolute, join as join9, resolve as resolve13 } from "path";
46541
+ import { appendFileSync as appendFileSync4, existsSync as existsSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync8 } from "fs";
46542
+ import { dirname as dirname4, isAbsolute, join as join10, resolve as resolve13 } from "path";
46461
46543
 
46462
46544
  // src/audit/pr-review-record.ts
46463
46545
  import * as crypto3 from "crypto";
@@ -46588,7 +46670,7 @@ function assertNotSourceCheckoutWrite(filePath) {
46588
46670
  if (!isUnderTestRunner()) return;
46589
46671
  const here = findRepoRoot(process.cwd());
46590
46672
  if (here === null) return;
46591
- if (resolve13(filePath) !== resolve13(join9(here, PR_REVIEW_RECORDS_REL_PATH))) return;
46673
+ if (resolve13(filePath) !== resolve13(join10(here, PR_REVIEW_RECORDS_REL_PATH))) return;
46592
46674
  throw new Error(
46593
46675
  `Refusing to write ${filePath} from a test run (#4415): this is the source checkout's tracked, hash-chained audit file, and a fabricated record that chains cleanly is indistinguishable from a real verdict. Pass repoPath to a throwaway repo, or set NEXUS_PR_REVIEW_RECORDS_PATH.`
46594
46676
  );
@@ -46600,17 +46682,17 @@ function resolvePrReviewRecordsPath(repoPathOverride) {
46600
46682
  }
46601
46683
  if (repoPathOverride !== void 0 && repoPathOverride.trim() !== "") {
46602
46684
  const overrideRoot = findRepoRoot(repoPathOverride);
46603
- if (overrideRoot !== null) return join9(overrideRoot, PR_REVIEW_RECORDS_REL_PATH);
46685
+ if (overrideRoot !== null) return join10(overrideRoot, PR_REVIEW_RECORDS_REL_PATH);
46604
46686
  }
46605
46687
  const root = findRepoRoot(process.cwd());
46606
46688
  if (root === null) return void 0;
46607
- return join9(root, PR_REVIEW_RECORDS_REL_PATH);
46689
+ return join10(root, PR_REVIEW_RECORDS_REL_PATH);
46608
46690
  }
46609
46691
  function readPrReviewRecords(filePath) {
46610
46692
  const records = [];
46611
46693
  const invalidLines = [];
46612
- if (!existsSync9(filePath)) return { records, invalidLines };
46613
- const lines = readFileSync7(filePath, "utf-8").split("\n").filter((l) => l.trim() !== "");
46694
+ if (!existsSync10(filePath)) return { records, invalidLines };
46695
+ const lines = readFileSync8(filePath, "utf-8").split("\n").filter((l) => l.trim() !== "");
46614
46696
  for (const [i, line] of lines.entries()) {
46615
46697
  try {
46616
46698
  const parsed = PrReviewRecordSchema.safeParse(JSON.parse(line));
@@ -46623,7 +46705,7 @@ function readPrReviewRecords(filePath) {
46623
46705
  return { records, invalidLines };
46624
46706
  }
46625
46707
  function readPrReviewLedgerTip(filePath, logger58) {
46626
- if (!existsSync9(filePath)) return { maxSequence: -1, lastHash: void 0 };
46708
+ if (!existsSync10(filePath)) return { maxSequence: -1, lastHash: void 0 };
46627
46709
  try {
46628
46710
  const { records } = readPrReviewRecords(filePath);
46629
46711
  if (records.length === 0) return { maxSequence: -1, lastHash: void 0 };
@@ -47856,7 +47938,7 @@ function registerQueryTaskStateTool(server, deps) {
47856
47938
  import { z as z100 } from "zod";
47857
47939
 
47858
47940
  // src/mcp/tools/ci-health-log.ts
47859
- import { appendFileSync as appendFileSync5, existsSync as existsSync11, readFileSync as readFileSync9, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
47941
+ import { appendFileSync as appendFileSync5, existsSync as existsSync12, readFileSync as readFileSync10, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
47860
47942
  import { z as z99 } from "zod";
47861
47943
 
47862
47944
  // src/mcp/tools/ci-health-types.ts
@@ -47898,7 +47980,7 @@ function capLogSize(path12) {
47898
47980
  }
47899
47981
  if (size <= max) return;
47900
47982
  try {
47901
- const lines = readFileSync9(path12, "utf-8").split("\n").filter((l) => l !== "");
47983
+ const lines = readFileSync10(path12, "utf-8").split("\n").filter((l) => l !== "");
47902
47984
  const kept = [];
47903
47985
  let bytes = 0;
47904
47986
  for (let i = lines.length - 1; i >= 0; i--) {
@@ -48701,7 +48783,7 @@ function createMetaOrchestrator(options) {
48701
48783
  }
48702
48784
 
48703
48785
  // src/orchestration/meta-shadow-selector.ts
48704
- import { appendFileSync as appendFileSync6, existsSync as existsSync12, readFileSync as readFileSync10 } from "fs";
48786
+ import { appendFileSync as appendFileSync6, existsSync as existsSync13, readFileSync as readFileSync11 } from "fs";
48705
48787
  import { z as z104 } from "zod";
48706
48788
  var SHADOW_STRATEGY_ARMS = [
48707
48789
  "single-shot",
@@ -48820,11 +48902,11 @@ function hydrateShadowSelector(selector) {
48820
48902
  const hydratable = selector;
48821
48903
  if (typeof hydratable.recordFromContext !== "function") return 0;
48822
48904
  const file = getMetaOutcomesFile();
48823
- if (!existsSync12(file)) return 0;
48905
+ if (!existsSync13(file)) return 0;
48824
48906
  let replayed = 0;
48825
48907
  try {
48826
48908
  const cutoff = Date.now() - HYDRATE_LOOKBACK_MS;
48827
- const lines = readFileSync10(file, "utf-8").split("\n").filter((l) => l.trim().length > 0);
48909
+ const lines = readFileSync11(file, "utf-8").split("\n").filter((l) => l.trim().length > 0);
48828
48910
  for (const line of lines) {
48829
48911
  let parsed;
48830
48912
  try {
@@ -54172,4 +54254,4 @@ export {
54172
54254
  shutdownFeedbackSubscriber,
54173
54255
  createEventBusBridge
54174
54256
  };
54175
- //# sourceMappingURL=chunk-6H5AM5SG.js.map
54257
+ //# sourceMappingURL=chunk-VJU2NER7.js.map