nexus-agents 2.99.0 → 2.100.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.
Files changed (27) hide show
  1. package/dist/{chunk-O6EXYWHP.js → chunk-B364VMMP.js} +144 -82
  2. package/dist/{chunk-O6EXYWHP.js.map → chunk-B364VMMP.js.map} +1 -1
  3. package/dist/{chunk-VPH2M5H7.js → chunk-BFN7RO3R.js} +4 -4
  4. package/dist/{chunk-VPH2M5H7.js.map → chunk-BFN7RO3R.js.map} +1 -1
  5. package/dist/{chunk-WHFCVKAV.js → chunk-FU2AMASK.js} +3 -3
  6. package/dist/{chunk-6IHEDRKI.js → chunk-H4LBBFCO.js} +2 -2
  7. package/dist/{chunk-EM7NUGMG.js → chunk-P453545L.js} +21 -2
  8. package/dist/chunk-P453545L.js.map +1 -0
  9. package/dist/{chunk-AN3IGMJT.js → chunk-TYELRYRO.js} +9 -4
  10. package/dist/chunk-TYELRYRO.js.map +1 -0
  11. package/dist/cli.js +12 -7
  12. package/dist/cli.js.map +1 -1
  13. package/dist/{consensus-vote-5D7FNWYM.js → consensus-vote-PGOS5AA6.js} +3 -3
  14. package/dist/{expert-bridge-EOVHUCJ4.js → expert-bridge-L25WFHQF.js} +2 -2
  15. package/dist/{factory-NJRJAZKK.js → factory-PVN7DDNZ.js} +2 -2
  16. package/dist/index.d.ts +27 -0
  17. package/dist/index.js +6 -6
  18. package/dist/{setup-command-PHTP43V7.js → setup-command-RRBGCIBW.js} +4 -4
  19. package/package.json +1 -1
  20. package/dist/chunk-AN3IGMJT.js.map +0 -1
  21. package/dist/chunk-EM7NUGMG.js.map +0 -1
  22. /package/dist/{chunk-WHFCVKAV.js.map → chunk-FU2AMASK.js.map} +0 -0
  23. /package/dist/{chunk-6IHEDRKI.js.map → chunk-H4LBBFCO.js.map} +0 -0
  24. /package/dist/{consensus-vote-5D7FNWYM.js.map → consensus-vote-PGOS5AA6.js.map} +0 -0
  25. /package/dist/{expert-bridge-EOVHUCJ4.js.map → expert-bridge-L25WFHQF.js.map} +0 -0
  26. /package/dist/{factory-NJRJAZKK.js.map → factory-PVN7DDNZ.js.map} +0 -0
  27. /package/dist/{setup-command-PHTP43V7.js.map → setup-command-RRBGCIBW.js.map} +0 -0
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-UWQ3BALH.js";
10
10
  import {
11
11
  executeExpert
12
- } from "./chunk-6IHEDRKI.js";
12
+ } from "./chunk-H4LBBFCO.js";
13
13
  import {
14
14
  EventTopics,
15
15
  JobStatusSchema,
@@ -30,7 +30,7 @@ import {
30
30
  writeJobComplete,
31
31
  writeJobFailed,
32
32
  writeJobPending
33
- } from "./chunk-AN3IGMJT.js";
33
+ } from "./chunk-TYELRYRO.js";
34
34
  import {
35
35
  REGISTRY_PATH,
36
36
  getProjectRoot,
@@ -92,7 +92,7 @@ import {
92
92
  DEFAULT_TASK_TTL_MS,
93
93
  DEFAULT_TOOL_RATE_LIMITS,
94
94
  clampTaskTtl
95
- } from "./chunk-VPH2M5H7.js";
95
+ } from "./chunk-BFN7RO3R.js";
96
96
  import {
97
97
  getAvailabilityCache,
98
98
  getCliForModelId,
@@ -116,7 +116,7 @@ import {
116
116
  getAvailableClis,
117
117
  sleep,
118
118
  withTimeout
119
- } from "./chunk-EM7NUGMG.js";
119
+ } from "./chunk-P453545L.js";
120
120
  import {
121
121
  generateHyphenId,
122
122
  generateUUID
@@ -42436,7 +42436,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
42436
42436
  ]);
42437
42437
  async function classifyWithLLM(task) {
42438
42438
  try {
42439
- const { executeExpert: executeExpert2 } = await import("./expert-bridge-EOVHUCJ4.js");
42439
+ const { executeExpert: executeExpert2 } = await import("./expert-bridge-L25WFHQF.js");
42440
42440
  const prompt = [
42441
42441
  "Classify this task into exactly one pipeline template.",
42442
42442
  "Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
@@ -43181,6 +43181,77 @@ function buildScanSummary(total, confirmed, falsePositives, osvCount) {
43181
43181
  return parts.join(", ");
43182
43182
  }
43183
43183
 
43184
+ // src/security/quality-gate.ts
43185
+ async function runCommandCheck(name, command, args) {
43186
+ const start = Date.now();
43187
+ try {
43188
+ const { execFile: execFile3 } = await import("child_process");
43189
+ const { promisify: promisify3 } = await import("util");
43190
+ const exec2 = promisify3(execFile3);
43191
+ await exec2(command, [...args], { timeout: 12e4 });
43192
+ return {
43193
+ name,
43194
+ verdict: "pass",
43195
+ details: `${name} completed successfully`,
43196
+ durationMs: Date.now() - start
43197
+ };
43198
+ } catch (error) {
43199
+ const msg = error instanceof Error ? error.message : String(error);
43200
+ return {
43201
+ name,
43202
+ verdict: "fail",
43203
+ details: msg.slice(0, 500),
43204
+ durationMs: Date.now() - start
43205
+ };
43206
+ }
43207
+ }
43208
+ function checkTypeCheck(projectDir) {
43209
+ return () => runCommandCheck("type_check", "npx", ["tsc", "--noEmit", "--project", projectDir]);
43210
+ }
43211
+ function checkLint(projectDir) {
43212
+ return () => runCommandCheck("lint", "npx", ["eslint", "--max-warnings", "0", projectDir]);
43213
+ }
43214
+ function checkTests(projectDir) {
43215
+ return () => runCommandCheck("tests", "npx", ["vitest", "run", "--dir", projectDir]);
43216
+ }
43217
+ function checkBuild() {
43218
+ return () => runCommandCheck("build", "pnpm", ["build"]);
43219
+ }
43220
+ function aggregateResults2(checks) {
43221
+ let pass = 0;
43222
+ let fail = 0;
43223
+ let skip = 0;
43224
+ for (const c of checks) {
43225
+ if (c.verdict === "pass") pass++;
43226
+ else if (c.verdict === "fail") fail++;
43227
+ else skip++;
43228
+ }
43229
+ return { verdict: fail > 0 ? "fail" : "pass", summary: { pass, fail, skip } };
43230
+ }
43231
+ function generateFeedback2(checks) {
43232
+ const failures = checks.filter((c) => c.verdict === "fail");
43233
+ if (failures.length === 0) return "All checks passed.";
43234
+ const lines = failures.map((f) => `- ${f.name}: ${f.details}`);
43235
+ return `${String(failures.length)} check(s) failed:
43236
+ ${lines.join("\n")}`;
43237
+ }
43238
+ async function runQualityGate(stage, checks, iteration = 1) {
43239
+ const results = [];
43240
+ for (const check of checks) {
43241
+ const result = await check();
43242
+ results.push(result);
43243
+ }
43244
+ const { verdict, summary } = aggregateResults2(results);
43245
+ return {
43246
+ stage,
43247
+ verdict,
43248
+ checks: results,
43249
+ summary,
43250
+ feedback: generateFeedback2(results),
43251
+ iteration
43252
+ };
43253
+ }
43254
+
43184
43255
  // src/pipeline/agent-executor.ts
43185
43256
  var logger38 = createLogger({ component: "agent-executor" });
43186
43257
  function emitStageEvent2(stage, status, details) {
@@ -43433,7 +43504,7 @@ ${contextBlock}`;
43433
43504
  const strategy = config.votingStrategy ?? "higher_order";
43434
43505
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
43435
43506
  try {
43436
- const { executeVoting } = await import("./consensus-vote-5D7FNWYM.js");
43507
+ const { executeVoting } = await import("./consensus-vote-PGOS5AA6.js");
43437
43508
  const votingResult = await executeVoting(
43438
43509
  {
43439
43510
  proposal: plan.slice(0, 4e3),
@@ -43566,6 +43637,33 @@ Verdict: PASS/NEEDS_WORK/REJECT`
43566
43637
  await postProgress(config, `QA [${task.id}]`, review.verdict);
43567
43638
  return review;
43568
43639
  },
43640
+ qualityGate: async () => {
43641
+ emitStageEvent2("quality-gate", "started");
43642
+ const start = getTimeProvider().now();
43643
+ const target = config.scanTarget ?? process.cwd();
43644
+ await postProgress(config, "QualityGate", `Typecheck/lint/tests on ${target}...`);
43645
+ const result = await runQualityGate("qa", [
43646
+ checkTypeCheck(target),
43647
+ checkLint(target),
43648
+ checkTests(target)
43649
+ ]);
43650
+ const passed = result.verdict !== "fail";
43651
+ const ms = getTimeProvider().now() - start;
43652
+ emitStageEvent2("quality-gate", passed ? "completed" : "failed", { durationMs: ms });
43653
+ recordOutcome({
43654
+ taskId: "quality-gate",
43655
+ category: "code_review",
43656
+ cli: void 0,
43657
+ success: passed,
43658
+ durationMs: ms
43659
+ });
43660
+ await postProgress(
43661
+ config,
43662
+ "QualityGate",
43663
+ passed ? "Passed" : `Gate failed: ${result.feedback}`
43664
+ );
43665
+ return { passed, feedback: result.feedback };
43666
+ },
43569
43667
  securityScan: async () => {
43570
43668
  emitStageEvent2("security", "started");
43571
43669
  const start = getTimeProvider().now();
@@ -43864,7 +43962,13 @@ async function runDevPipelineInner(task, stages, options, sid, prior) {
43864
43962
  logger41.info("Harness mode \u2014 returning tasks for external implementation");
43865
43963
  return buildHarnessResult(planResult, tasks);
43866
43964
  }
43867
- const result = await runImplSecurityPhase(planResult, tasks, stages, sid);
43965
+ const result = await runImplSecurityPhase(
43966
+ planResult,
43967
+ tasks,
43968
+ stages,
43969
+ sid,
43970
+ options?.qualityGate ?? "off"
43971
+ );
43868
43972
  applyPipelineHindsight(bm, task, sid, result);
43869
43973
  return result;
43870
43974
  }
@@ -43980,10 +44084,21 @@ function buildHarnessResult(planResult, tasks) {
43980
44084
  securityPassed: false
43981
44085
  };
43982
44086
  }
43983
- async function runImplSecurityPhase(planResult, tasks, stages, sid) {
44087
+ async function runImplSecurityPhase(planResult, tasks, stages, sid, qualityGateMode) {
43984
44088
  const implResult = await implementQaLoop(tasks, stages);
43985
44089
  if (sid !== void 0)
43986
44090
  saveStageCheckpoint(sid, "implement", { type: "implement", tasks: implResult.completedTasks });
44091
+ const qaGate = await runQualityGateStage(stages, qualityGateMode);
44092
+ if (qualityGateMode === "blocking" && !qaGate.passed) {
44093
+ return {
44094
+ completed: false,
44095
+ plan: planResult.plan,
44096
+ tasks: implResult.completedTasks.length > 0 ? implResult.completedTasks : tasks,
44097
+ voteIterations: planResult.iterations,
44098
+ qaIterations: implResult.totalIterations,
44099
+ securityPassed: false
44100
+ };
44101
+ }
43987
44102
  const security = await withStep(
43988
44103
  { name: "security-scan", kind: "pipeline.stage" },
43989
44104
  async (ctx) => {
@@ -44005,6 +44120,26 @@ async function runImplSecurityPhase(planResult, tasks, stages, sid) {
44005
44120
  securityPassed: security.passed
44006
44121
  };
44007
44122
  }
44123
+ async function runQualityGateStage(stages, mode) {
44124
+ if (mode === "off" || stages.qualityGate === void 0) {
44125
+ return { passed: true, feedback: "Quality gate skipped" };
44126
+ }
44127
+ const runGate = stages.qualityGate.bind(stages);
44128
+ return withStep(
44129
+ { name: "quality-gate", kind: "pipeline.stage", attrs: { mode } },
44130
+ async (ctx) => {
44131
+ const r = await runGate();
44132
+ const advisory = mode === "advisory" && !r.passed;
44133
+ ctx.setSummary(r.passed ? "passed" : advisory ? "FAILED (advisory)" : "FAILED");
44134
+ if (advisory) {
44135
+ logger41.warn("Quality gate failed (advisory \u2014 not blocking)", {
44136
+ feedback: r.feedback.slice(0, 200)
44137
+ });
44138
+ }
44139
+ return r;
44140
+ }
44141
+ );
44142
+ }
44008
44143
  async function runOrResume(prior, stage, run) {
44009
44144
  if (prior?.research !== void 0 && stage === "research") {
44010
44145
  logger41.info("Resuming from checkpoint", { stage });
@@ -45908,79 +46043,6 @@ function registerCiHealthCheckTool(server, deps) {
45908
46043
  // src/mcp/tools/quality-gate-tool.ts
45909
46044
  import { statSync as statSync3 } from "fs";
45910
46045
  import { z as z101 } from "zod";
45911
-
45912
- // src/security/quality-gate.ts
45913
- async function runCommandCheck(name, command, args) {
45914
- const start = Date.now();
45915
- try {
45916
- const { execFile: execFile3 } = await import("child_process");
45917
- const { promisify: promisify3 } = await import("util");
45918
- const exec2 = promisify3(execFile3);
45919
- await exec2(command, [...args], { timeout: 12e4 });
45920
- return {
45921
- name,
45922
- verdict: "pass",
45923
- details: `${name} completed successfully`,
45924
- durationMs: Date.now() - start
45925
- };
45926
- } catch (error) {
45927
- const msg = error instanceof Error ? error.message : String(error);
45928
- return {
45929
- name,
45930
- verdict: "fail",
45931
- details: msg.slice(0, 500),
45932
- durationMs: Date.now() - start
45933
- };
45934
- }
45935
- }
45936
- function checkTypeCheck(projectDir) {
45937
- return () => runCommandCheck("type_check", "npx", ["tsc", "--noEmit", "--project", projectDir]);
45938
- }
45939
- function checkLint(projectDir) {
45940
- return () => runCommandCheck("lint", "npx", ["eslint", "--max-warnings", "0", projectDir]);
45941
- }
45942
- function checkTests(projectDir) {
45943
- return () => runCommandCheck("tests", "npx", ["vitest", "run", "--dir", projectDir]);
45944
- }
45945
- function checkBuild() {
45946
- return () => runCommandCheck("build", "pnpm", ["build"]);
45947
- }
45948
- function aggregateResults2(checks) {
45949
- let pass = 0;
45950
- let fail = 0;
45951
- let skip = 0;
45952
- for (const c of checks) {
45953
- if (c.verdict === "pass") pass++;
45954
- else if (c.verdict === "fail") fail++;
45955
- else skip++;
45956
- }
45957
- return { verdict: fail > 0 ? "fail" : "pass", summary: { pass, fail, skip } };
45958
- }
45959
- function generateFeedback2(checks) {
45960
- const failures = checks.filter((c) => c.verdict === "fail");
45961
- if (failures.length === 0) return "All checks passed.";
45962
- const lines = failures.map((f) => `- ${f.name}: ${f.details}`);
45963
- return `${String(failures.length)} check(s) failed:
45964
- ${lines.join("\n")}`;
45965
- }
45966
- async function runQualityGate(stage, checks, iteration = 1) {
45967
- const results = [];
45968
- for (const check of checks) {
45969
- const result = await check();
45970
- results.push(result);
45971
- }
45972
- const { verdict, summary } = aggregateResults2(results);
45973
- return {
45974
- stage,
45975
- verdict,
45976
- checks: results,
45977
- summary,
45978
- feedback: generateFeedback2(results),
45979
- iteration
45980
- };
45981
- }
45982
-
45983
- // src/mcp/tools/quality-gate-tool.ts
45984
46046
  var QualityCheckSchema = z101.enum(["typecheck", "lint", "tests", "build", "security"]);
45985
46047
  var DEFAULT_CHECKS = ["typecheck", "lint", "tests"];
45986
46048
  var RunQualityGateInputSchema = z101.object({
@@ -51080,4 +51142,4 @@ export {
51080
51142
  detectBackend,
51081
51143
  createTaskTracker
51082
51144
  };
51083
- //# sourceMappingURL=chunk-O6EXYWHP.js.map
51145
+ //# sourceMappingURL=chunk-B364VMMP.js.map