nexus-agents 2.30.5 → 2.30.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  VERSION,
6
6
  initDataDirectories
7
- } from "./chunk-VIT7VLL5.js";
7
+ } from "./chunk-WGP6G6QU.js";
8
8
  import {
9
9
  CLI_SUBPROCESS_TIMEOUTS,
10
10
  createLogger,
@@ -1523,4 +1523,4 @@ export {
1523
1523
  setupCommand,
1524
1524
  setupCommandAsync
1525
1525
  };
1526
- //# sourceMappingURL=chunk-WZSC46BL.js.map
1526
+ //# sourceMappingURL=chunk-42FGTDIW.js.map
@@ -25,7 +25,7 @@ import {
25
25
  toolSuccessStructured,
26
26
  withProgressHeartbeat,
27
27
  wrapToolWithTimeout
28
- } from "./chunk-3QB7RYPU.js";
28
+ } from "./chunk-23G7NV6B.js";
29
29
  import {
30
30
  REGISTRY_PATH,
31
31
  getProjectRoot,
@@ -65,7 +65,7 @@ import {
65
65
  import {
66
66
  DEFAULT_TASK_TTL_MS,
67
67
  clampTaskTtl
68
- } from "./chunk-VIT7VLL5.js";
68
+ } from "./chunk-WGP6G6QU.js";
69
69
  import {
70
70
  createSessionMemory
71
71
  } from "./chunk-ZXIFNJ7Q.js";
@@ -87,7 +87,7 @@ import {
87
87
  } from "./chunk-2L6A7RUZ.js";
88
88
  import {
89
89
  executeExpert
90
- } from "./chunk-5HPIESKY.js";
90
+ } from "./chunk-ZVUNIQLB.js";
91
91
  import {
92
92
  ClaudeCliAdapter,
93
93
  CliDetectionCache,
@@ -9705,27 +9705,43 @@ function extractJsonFromText(text) {
9705
9705
  const match = text.match(/```(?:json)?\s*([\s\S]*?)```/);
9706
9706
  return match?.[1]?.trim() ?? text.trim();
9707
9707
  }
9708
+ var VALID_OPERATION_TYPES = /* @__PURE__ */ new Set([
9709
+ "generation",
9710
+ "refactoring",
9711
+ "optimization",
9712
+ "debugging"
9713
+ ]);
9714
+ function isValidOperationType(v) {
9715
+ return typeof v === "string" && VALID_OPERATION_TYPES.has(v);
9716
+ }
9717
+ function isNumberInUnitRange(v) {
9718
+ return typeof v === "number" && v >= 0 && v <= 1;
9719
+ }
9720
+ function isStringArray(v) {
9721
+ return Array.isArray(v) && v.every((x) => typeof x === "string");
9722
+ }
9723
+ function applyOptionalArrays(result, p) {
9724
+ if (isStringArray(p["affectedFiles"])) result.affectedFiles = p["affectedFiles"];
9725
+ if (Array.isArray(p["codeChanges"])) {
9726
+ result.codeChanges = p["codeChanges"];
9727
+ }
9728
+ if (isStringArray(p["recommendations"])) result.recommendations = p["recommendations"];
9729
+ if (isStringArray(p["warnings"])) result.warnings = p["warnings"];
9730
+ }
9708
9731
  function parseCodeResult(text, defaultType) {
9709
9732
  try {
9710
9733
  const jsonText = extractJsonFromText(text);
9711
- const parsed = JSON.parse(jsonText);
9734
+ const rawParsed = JSON.parse(jsonText);
9735
+ if (typeof rawParsed !== "object" || rawParsed === null || Array.isArray(rawParsed)) {
9736
+ throw new Error("Parsed value is not a plain object");
9737
+ }
9738
+ const p = rawParsed;
9712
9739
  const result = {
9713
- content: parsed.content ?? "Code analysis completed",
9714
- operationType: parsed.operationType ?? defaultType,
9715
- confidence: parsed.confidence ?? 0.7
9740
+ content: typeof p["content"] === "string" ? p["content"] : "Code analysis completed",
9741
+ operationType: isValidOperationType(p["operationType"]) ? p["operationType"] : defaultType,
9742
+ confidence: isNumberInUnitRange(p["confidence"]) ? p["confidence"] : 0.7
9716
9743
  };
9717
- if (parsed.affectedFiles !== void 0) {
9718
- result.affectedFiles = parsed.affectedFiles;
9719
- }
9720
- if (parsed.codeChanges !== void 0) {
9721
- result.codeChanges = parsed.codeChanges;
9722
- }
9723
- if (parsed.recommendations !== void 0) {
9724
- result.recommendations = parsed.recommendations;
9725
- }
9726
- if (parsed.warnings !== void 0) {
9727
- result.warnings = parsed.warnings;
9728
- }
9744
+ applyOptionalArrays(result, p);
9729
9745
  return result;
9730
9746
  } catch {
9731
9747
  return {
@@ -10721,20 +10737,38 @@ function generateSecurityWarnings(vulnerabilities) {
10721
10737
  }
10722
10738
  return warnings;
10723
10739
  }
10740
+ function isSecPlainObject(v) {
10741
+ return typeof v === "object" && v !== null && !Array.isArray(v);
10742
+ }
10743
+ function isSecStringArray(v) {
10744
+ return Array.isArray(v) && v.every((x) => typeof x === "string");
10745
+ }
10746
+ function applySecOptionalFields(result, p) {
10747
+ if (isSecPlainObject(p["compliance"])) {
10748
+ result.compliance = p["compliance"];
10749
+ }
10750
+ if (isSecStringArray(p["recommendations"])) result.recommendations = p["recommendations"];
10751
+ if (isSecStringArray(p["warnings"])) result.warnings = p["warnings"];
10752
+ }
10753
+ function buildSecurityCore(p, validVulns, calculateScore2) {
10754
+ const score = p["securityScore"];
10755
+ const conf = p["confidence"];
10756
+ return {
10757
+ content: typeof p["content"] === "string" ? p["content"] : "Security analysis completed",
10758
+ vulnerabilities: validVulns,
10759
+ securityScore: typeof score === "number" && score >= 0 && score <= 100 ? score : calculateScore2(validVulns),
10760
+ confidence: typeof conf === "number" && conf >= 0 && conf <= 1 ? conf : 0.7
10761
+ };
10762
+ }
10724
10763
  function parseSecurityResult(text, calculateScore2, validator) {
10725
10764
  try {
10726
10765
  const jsonText = extractJsonFromText2(text);
10727
- const parsed = JSON.parse(jsonText);
10728
- const validVulns = (parsed.vulnerabilities ?? []).map((v) => validator(v)).filter((r) => r.success).map((r) => r.data);
10729
- const result = {
10730
- content: parsed.content ?? "Security analysis completed",
10731
- vulnerabilities: validVulns,
10732
- securityScore: parsed.securityScore ?? calculateScore2(validVulns),
10733
- confidence: parsed.confidence ?? 0.7
10734
- };
10735
- if (parsed.compliance !== void 0) result.compliance = parsed.compliance;
10736
- if (parsed.recommendations !== void 0) result.recommendations = parsed.recommendations;
10737
- if (parsed.warnings !== void 0) result.warnings = parsed.warnings;
10766
+ const rawParsed = JSON.parse(jsonText);
10767
+ if (!isSecPlainObject(rawParsed)) throw new Error("Parsed value is not a plain object");
10768
+ const vulnCandidates = Array.isArray(rawParsed["vulnerabilities"]) ? rawParsed["vulnerabilities"] : [];
10769
+ const validVulns = vulnCandidates.map((v) => validator(v)).filter((r) => r.success).map((r) => r.data);
10770
+ const result = buildSecurityCore(rawParsed, validVulns, calculateScore2);
10771
+ applySecOptionalFields(result, rawParsed);
10738
10772
  return result;
10739
10773
  } catch {
10740
10774
  const heuristicVulns = detectHeuristicVulnerabilities(text);
@@ -11047,20 +11081,43 @@ function detectArchitectureWarnings(description) {
11047
11081
  }
11048
11082
  return warnings;
11049
11083
  }
11084
+ var VALID_ANALYSIS_TYPES = /* @__PURE__ */ new Set([
11085
+ "design",
11086
+ "review",
11087
+ "pattern_selection"
11088
+ ]);
11089
+ function isValidAnalysisType(v) {
11090
+ return typeof v === "string" && VALID_ANALYSIS_TYPES.has(v);
11091
+ }
11092
+ function isUnitRangeNum(v) {
11093
+ return typeof v === "number" && v >= 0 && v <= 1;
11094
+ }
11095
+ function isStrArr(v) {
11096
+ return Array.isArray(v) && v.every((x) => typeof x === "string");
11097
+ }
11098
+ function applyArchOptionals(result, p) {
11099
+ if (Array.isArray(p["patterns"])) result.patterns = p["patterns"];
11100
+ if (Array.isArray(p["decisions"])) result.decisions = p["decisions"];
11101
+ if (Array.isArray(p["components"])) {
11102
+ result.components = p["components"];
11103
+ }
11104
+ if (isStrArr(p["recommendations"])) result.recommendations = p["recommendations"];
11105
+ if (isStrArr(p["warnings"])) result.warnings = p["warnings"];
11106
+ }
11050
11107
  function parseArchitectureResult(text, defaultType) {
11051
11108
  try {
11052
11109
  const jsonText = extractJsonFromText3(text);
11053
- const parsed = JSON.parse(jsonText);
11110
+ const rawParsed = JSON.parse(jsonText);
11111
+ if (typeof rawParsed !== "object" || rawParsed === null || Array.isArray(rawParsed)) {
11112
+ throw new Error("Parsed value is not a plain object");
11113
+ }
11114
+ const p = rawParsed;
11054
11115
  const result = {
11055
- content: parsed.content ?? "Architecture analysis completed",
11056
- analysisType: parsed.analysisType ?? defaultType,
11057
- confidence: parsed.confidence ?? 0.7
11058
- };
11059
- if (parsed.patterns !== void 0) result.patterns = parsed.patterns;
11060
- if (parsed.decisions !== void 0) result.decisions = parsed.decisions;
11061
- if (parsed.components !== void 0) result.components = parsed.components;
11062
- if (parsed.recommendations !== void 0) result.recommendations = parsed.recommendations;
11063
- if (parsed.warnings !== void 0) result.warnings = parsed.warnings;
11116
+ content: typeof p["content"] === "string" ? p["content"] : "Architecture analysis completed",
11117
+ analysisType: isValidAnalysisType(p["analysisType"]) ? p["analysisType"] : defaultType,
11118
+ confidence: isUnitRangeNum(p["confidence"]) ? p["confidence"] : 0.7
11119
+ };
11120
+ applyArchOptionals(result, p);
11064
11121
  return result;
11065
11122
  } catch {
11066
11123
  return { content: text, analysisType: defaultType, confidence: 0.5 };
@@ -11571,26 +11628,47 @@ function extractJsonFromText4(text) {
11571
11628
  function validateTests(tests) {
11572
11629
  return (tests ?? []).map((t) => GeneratedTestSchema.safeParse(t)).filter((r) => r.success).map((r) => r.data);
11573
11630
  }
11574
- function buildTestingResult(parsed, defaultType) {
11575
- const validTests = validateTests(parsed.tests);
11576
- const coverageResult = CoverageMetricsSchema.safeParse(parsed.coverage);
11631
+ var VALID_TESTING_OP_TYPES = /* @__PURE__ */ new Set([
11632
+ "generation",
11633
+ "coverage_analysis",
11634
+ "quality_assessment"
11635
+ ]);
11636
+ function isValidTestingOpType(v) {
11637
+ return typeof v === "string" && VALID_TESTING_OP_TYPES.has(v);
11638
+ }
11639
+ function isTestUnitConfidence(v) {
11640
+ return typeof v === "number" && v >= 0 && v <= 1;
11641
+ }
11642
+ function isTestStringArray(v) {
11643
+ return Array.isArray(v) && v.every((x) => typeof x === "string");
11644
+ }
11645
+ function applyTestingOptionalFields(result, p, validTests, coverage) {
11646
+ if (validTests.length > 0) result.tests = validTests;
11647
+ if (coverage !== void 0) result.coverage = coverage;
11648
+ if (p["quality"] !== void 0) result.quality = p["quality"];
11649
+ if (isTestStringArray(p["recommendations"])) result.recommendations = p["recommendations"];
11650
+ if (isTestStringArray(p["warnings"])) result.warnings = p["warnings"];
11651
+ }
11652
+ function buildTestingResult(p, defaultType) {
11653
+ const validTests = validateTests(Array.isArray(p["tests"]) ? p["tests"] : []);
11654
+ const coverageResult = CoverageMetricsSchema.safeParse(p["coverage"]);
11655
+ const coverage = coverageResult.success ? coverageResult.data : void 0;
11577
11656
  const result = {
11578
- content: parsed.content ?? "Testing analysis completed",
11579
- operationType: parsed.operationType ?? defaultType,
11580
- confidence: parsed.confidence ?? 0.7
11657
+ content: typeof p["content"] === "string" ? p["content"] : "Testing analysis completed",
11658
+ operationType: isValidTestingOpType(p["operationType"]) ? p["operationType"] : defaultType,
11659
+ confidence: isTestUnitConfidence(p["confidence"]) ? p["confidence"] : 0.7
11581
11660
  };
11582
- if (validTests.length > 0) result.tests = validTests;
11583
- if (coverageResult.success) result.coverage = coverageResult.data;
11584
- if (parsed.quality !== void 0) result.quality = parsed.quality;
11585
- if (parsed.recommendations !== void 0) result.recommendations = parsed.recommendations;
11586
- if (parsed.warnings !== void 0) result.warnings = parsed.warnings;
11661
+ applyTestingOptionalFields(result, p, validTests, coverage);
11587
11662
  return result;
11588
11663
  }
11589
11664
  function parseTestingResult(text, defaultType) {
11590
11665
  try {
11591
11666
  const jsonText = extractJsonFromText4(text);
11592
- const parsed = JSON.parse(jsonText);
11593
- return buildTestingResult(parsed, defaultType);
11667
+ const rawParsed = JSON.parse(jsonText);
11668
+ if (typeof rawParsed !== "object" || rawParsed === null || Array.isArray(rawParsed)) {
11669
+ throw new Error("Parsed value is not a plain object");
11670
+ }
11671
+ return buildTestingResult(rawParsed, defaultType);
11594
11672
  } catch {
11595
11673
  return { content: text, operationType: defaultType, confidence: 0.5 };
11596
11674
  }
@@ -11893,19 +11971,45 @@ function extractJsonFromText5(text) {
11893
11971
  }
11894
11972
  return text.trim();
11895
11973
  }
11974
+ var VALID_DOC_TYPES = /* @__PURE__ */ new Set([
11975
+ "api",
11976
+ "readme",
11977
+ "guide",
11978
+ "reference"
11979
+ ]);
11980
+ function isValidDocType(v) {
11981
+ return typeof v === "string" && VALID_DOC_TYPES.has(v);
11982
+ }
11983
+ function isDocUnitConfidence(v) {
11984
+ return typeof v === "number" && v >= 0 && v <= 1;
11985
+ }
11986
+ function isDocStringArray(v) {
11987
+ return Array.isArray(v) && v.every((x) => typeof x === "string");
11988
+ }
11989
+ function isPlainObject(v) {
11990
+ return typeof v === "object" && v !== null && !Array.isArray(v);
11991
+ }
11992
+ function applyDocOptionalFields(result, p) {
11993
+ if (Array.isArray(p["sections"])) result.sections = p["sections"];
11994
+ if (isPlainObject(p["apiDocs"])) {
11995
+ result.apiDocs = p["apiDocs"];
11996
+ }
11997
+ if (isDocStringArray(p["recommendations"])) result.recommendations = p["recommendations"];
11998
+ if (isDocStringArray(p["warnings"])) result.warnings = p["warnings"];
11999
+ }
11896
12000
  function parseDocumentationResult(text, defaultType) {
11897
12001
  try {
11898
12002
  const jsonText = extractJsonFromText5(text);
11899
- const parsed = JSON.parse(jsonText);
12003
+ const rawParsed = JSON.parse(jsonText);
12004
+ if (!isPlainObject(rawParsed)) {
12005
+ throw new Error("Parsed value is not a plain object");
12006
+ }
11900
12007
  const result = {
11901
- content: parsed.content ?? "Documentation generated",
11902
- documentationType: parsed.documentationType ?? defaultType,
11903
- confidence: parsed.confidence ?? 0.7
11904
- };
11905
- if (parsed.sections !== void 0) result.sections = parsed.sections;
11906
- if (parsed.apiDocs !== void 0) result.apiDocs = parsed.apiDocs;
11907
- if (parsed.recommendations !== void 0) result.recommendations = parsed.recommendations;
11908
- if (parsed.warnings !== void 0) result.warnings = parsed.warnings;
12008
+ content: typeof rawParsed["content"] === "string" ? rawParsed["content"] : "Documentation generated",
12009
+ documentationType: isValidDocType(rawParsed["documentationType"]) ? rawParsed["documentationType"] : defaultType,
12010
+ confidence: isDocUnitConfidence(rawParsed["confidence"]) ? rawParsed["confidence"] : 0.7
12011
+ };
12012
+ applyDocOptionalFields(result, rawParsed);
11909
12013
  return result;
11910
12014
  } catch {
11911
12015
  return { content: text, documentationType: defaultType, confidence: 0.5 };
@@ -20652,6 +20756,10 @@ function cleanupExecution(state) {
20652
20756
  clearTimeout(state.timeoutId);
20653
20757
  }
20654
20758
  state.queue.cancel();
20759
+ if (state.abortCleanup !== void 0) {
20760
+ state.abortCleanup.signal.removeEventListener("abort", state.abortCleanup.handler);
20761
+ delete state.abortCleanup;
20762
+ }
20655
20763
  }
20656
20764
  function sortResultsByStepOrder(results, steps) {
20657
20765
  const stepOrder = new Map(steps.map((s, i) => [s.id, i]));
@@ -20675,6 +20783,7 @@ async function executeParallel(steps, context, stepExecutor, options) {
20675
20783
  };
20676
20784
  if (context.signal !== void 0) {
20677
20785
  context.signal.addEventListener("abort", abortHandler);
20786
+ state.abortCleanup = { signal: context.signal, handler: abortHandler };
20678
20787
  }
20679
20788
  try {
20680
20789
  setupOverallTimeout(state, opts);
@@ -40884,7 +40993,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
40884
40993
  ]);
40885
40994
  async function classifyWithLLM(task) {
40886
40995
  try {
40887
- const { executeExpert: executeExpert2 } = await import("./expert-bridge-7OFH3ZXI.js");
40996
+ const { executeExpert: executeExpert2 } = await import("./expert-bridge-IKR23WRI.js");
40888
40997
  const prompt = [
40889
40998
  "Classify this task into exactly one pipeline template.",
40890
40999
  "Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
@@ -41887,7 +41996,7 @@ ${contextBlock}`;
41887
41996
  const strategy = config.votingStrategy ?? "higher_order";
41888
41997
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
41889
41998
  try {
41890
- const { executeVoting } = await import("./consensus-vote-APVO4C5T.js");
41999
+ const { executeVoting } = await import("./consensus-vote-MFGKPIAO.js");
41891
42000
  const votingResult = await executeVoting(
41892
42001
  {
41893
42002
  proposal: plan.slice(0, 4e3),
@@ -53059,4 +53168,4 @@ export {
53059
53168
  detectBackend,
53060
53169
  createTaskTracker
53061
53170
  };
53062
- //# sourceMappingURL=chunk-MBFIXCG3.js.map
53171
+ //# sourceMappingURL=chunk-7GW7ZRJ3.js.map