nexus-agents 3.1.0 → 3.1.1

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.
@@ -21,7 +21,7 @@ import {
21
21
  DEFAULT_TASK_TTL_MS,
22
22
  DEFAULT_TOOL_RATE_LIMITS,
23
23
  clampTaskTtl
24
- } from "./chunk-PQQP66XZ.js";
24
+ } from "./chunk-NSIPB65X.js";
25
25
  import {
26
26
  executeExpert
27
27
  } from "./chunk-EL62KWUE.js";
@@ -45,7 +45,7 @@ import {
45
45
  simulationDeniedResult,
46
46
  toJobSummary,
47
47
  writeJobCancelled
48
- } from "./chunk-4UN4M4NI.js";
48
+ } from "./chunk-5UFRDLQT.js";
49
49
  import {
50
50
  normalizeTopicToCanonical,
51
51
  synthesizeResearch
@@ -45787,7 +45787,7 @@ ${contextBlock}`;
45787
45787
  const strategy = config.votingStrategy ?? "higher_order";
45788
45788
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
45789
45789
  try {
45790
- const { executeVoting } = await import("./consensus-vote-ORVUPPWD.js");
45790
+ const { executeVoting } = await import("./consensus-vote-6GL7NIDU.js");
45791
45791
  const votingResult = await executeVoting(
45792
45792
  {
45793
45793
  proposal: buildVoteProposal(plan, research),
@@ -46668,87 +46668,6 @@ function persistPrReviewRecord(opts) {
46668
46668
  }
46669
46669
  }
46670
46670
 
46671
- // src/mcp/tools/pr-review-record-producer.ts
46672
- function buildAndPersist(prNumber, baseSha, args) {
46673
- const { input, aggregate, counts, reviewCount, logger: logger58, coverage } = args;
46674
- const coverageSuffix = coverage?.partial === true ? ` [partial coverage: ${String(coverage.reviewedFiles)}/${String(coverage.totalFiles)} files reviewed, dropped: ${coverage.droppedFiles.join(", ")}]` : "";
46675
- if (reviewedDiffWasTruncated(input.prDiff)) {
46676
- logger58.warn(
46677
- "Reviewed diff exceeds the hash byte cap; content past it is unbound in reviewedDiffHash",
46678
- { prNumber }
46679
- );
46680
- }
46681
- const record = persistPrReviewRecord({
46682
- prNumber,
46683
- baseSha,
46684
- reviewedDiffHash: computeReviewedDiffHash(input.prDiff),
46685
- verdict: aggregate.decision,
46686
- verified: aggregate.verified,
46687
- voteCounts: {
46688
- approve: counts.approveCount,
46689
- request_changes: counts.requestChangesCount,
46690
- abstain: counts.abstainCount,
46691
- error: counts.errorCount,
46692
- total: reviewCount
46693
- },
46694
- summary: `${aggregate.decision} (${String(counts.approveCount)} approve / ${String(counts.requestChangesCount)} request_changes / ${String(counts.abstainCount)} abstain) \u2014 ${input.prTitle}${coverageSuffix}`,
46695
- // #4278: lets a caller (e.g. an MCP server whose cwd has no `.git`
46696
- // ancestor) say where the repo is, so the record isn't silently dropped.
46697
- ...input.repoPath !== void 0 ? { repoPathOverride: input.repoPath } : {},
46698
- logger: logger58
46699
- });
46700
- if (record === void 0) {
46701
- return {
46702
- persisted: false,
46703
- reason: "write-failed",
46704
- detail: "Audit record could not be written: the records path was unresolved or the append failed (see server logs for the underlying cause)."
46705
- };
46706
- }
46707
- return {
46708
- persisted: true,
46709
- prNumber: record.prNumber,
46710
- baseSha: record.baseSha,
46711
- reviewedDiffHash: record.reviewedDiffHash,
46712
- sequence: record.sequence
46713
- };
46714
- }
46715
- function persistReviewRecord(args) {
46716
- const { input } = args;
46717
- if (input.prNumber === void 0 || input.baseSha === void 0) {
46718
- return {
46719
- persisted: false,
46720
- reason: "binding-inputs-absent",
46721
- detail: "No audit record written: supply both prNumber and baseSha to persist an Option-C governor-review record bound to {prNumber, baseSha, reviewedDiffHash}."
46722
- };
46723
- }
46724
- if (input.simulate) {
46725
- return {
46726
- persisted: false,
46727
- reason: "simulated",
46728
- detail: "No audit record written: the review used simulated voters, and a committed governance record must not be seeded from non-live output (mirrors #2319)."
46729
- };
46730
- }
46731
- const { counts } = args;
46732
- if (counts.approveCount + counts.requestChangesCount + counts.abstainCount === 0) {
46733
- return {
46734
- persisted: false,
46735
- reason: "no-live-votes",
46736
- detail: "No audit record written: every voter errored, so the aggregate verdict reflects no live review. A committed governor-review record must not be seeded from a failed panel (the pr_review analogue of no_quorum, #4053)."
46737
- };
46738
- }
46739
- try {
46740
- return buildAndPersist(input.prNumber, input.baseSha, args);
46741
- } catch (error) {
46742
- const detail = error instanceof Error ? error.message : String(error);
46743
- args.logger.warn("Audit-record persistence threw (non-fatal)", { detail });
46744
- return {
46745
- persisted: false,
46746
- reason: "write-failed",
46747
- detail: `Audit record persistence raised: ${detail}`
46748
- };
46749
- }
46750
- }
46751
-
46752
46671
  // src/mcp/tools/pr-review-diff-budget.ts
46753
46672
  var SENSITIVE_PATH_PATTERNS = Object.freeze([
46754
46673
  "auth",
@@ -46811,6 +46730,16 @@ function truncateWithMarker(file, budget) {
46811
46730
  const prefix = Buffer.from(file.text, "utf-8").subarray(0, room).toString("utf-8");
46812
46731
  return prefix + marker;
46813
46732
  }
46733
+ var GIT_FILE_HEADER = /^diff --git /m;
46734
+ var HUNK_HEADER = /^@@ .* @@/m;
46735
+ var OLD_FILE_HEADER = /^--- /m;
46736
+ var NEW_FILE_HEADER = /^\+\+\+ /m;
46737
+ var BODY_LINE = /^[+-]/m;
46738
+ function looksLikeUnifiedDiff(text) {
46739
+ if (GIT_FILE_HEADER.test(text)) return true;
46740
+ if (HUNK_HEADER.test(text) && BODY_LINE.test(text)) return true;
46741
+ return OLD_FILE_HEADER.test(text) && NEW_FILE_HEADER.test(text);
46742
+ }
46814
46743
  function securityFirstPack(files, budget) {
46815
46744
  const sensitive = files.filter((f) => isSensitivePath(f.path));
46816
46745
  const rest = files.filter((f) => !isSensitivePath(f.path));
@@ -46876,6 +46805,95 @@ function applyPartialCoverageGate(aggregate, coverage) {
46876
46805
  return aggregate;
46877
46806
  }
46878
46807
 
46808
+ // src/mcp/tools/pr-review-record-producer.ts
46809
+ function buildAndPersist(prNumber, baseSha, args) {
46810
+ const { input, aggregate, counts, reviewCount, logger: logger58, coverage } = args;
46811
+ const coverageSuffix = coverage?.partial === true ? ` [partial coverage: ${String(coverage.reviewedFiles)}/${String(coverage.totalFiles)} files reviewed, dropped: ${coverage.droppedFiles.join(", ")}]` : "";
46812
+ if (reviewedDiffWasTruncated(input.prDiff)) {
46813
+ logger58.warn(
46814
+ "Reviewed diff exceeds the hash byte cap; content past it is unbound in reviewedDiffHash",
46815
+ { prNumber }
46816
+ );
46817
+ }
46818
+ const record = persistPrReviewRecord({
46819
+ prNumber,
46820
+ baseSha,
46821
+ reviewedDiffHash: computeReviewedDiffHash(input.prDiff),
46822
+ verdict: aggregate.decision,
46823
+ verified: aggregate.verified,
46824
+ voteCounts: {
46825
+ approve: counts.approveCount,
46826
+ request_changes: counts.requestChangesCount,
46827
+ abstain: counts.abstainCount,
46828
+ error: counts.errorCount,
46829
+ total: reviewCount
46830
+ },
46831
+ summary: `${aggregate.decision} (${String(counts.approveCount)} approve / ${String(counts.requestChangesCount)} request_changes / ${String(counts.abstainCount)} abstain) \u2014 ${input.prTitle}${coverageSuffix}`,
46832
+ // #4278: lets a caller (e.g. an MCP server whose cwd has no `.git`
46833
+ // ancestor) say where the repo is, so the record isn't silently dropped.
46834
+ ...input.repoPath !== void 0 ? { repoPathOverride: input.repoPath } : {},
46835
+ logger: logger58
46836
+ });
46837
+ if (record === void 0) {
46838
+ return {
46839
+ persisted: false,
46840
+ reason: "write-failed",
46841
+ detail: "Audit record could not be written: the records path was unresolved or the append failed (see server logs for the underlying cause)."
46842
+ };
46843
+ }
46844
+ return {
46845
+ persisted: true,
46846
+ prNumber: record.prNumber,
46847
+ baseSha: record.baseSha,
46848
+ reviewedDiffHash: record.reviewedDiffHash,
46849
+ sequence: record.sequence
46850
+ };
46851
+ }
46852
+ function refuseToPersist(args) {
46853
+ const { input, counts } = args;
46854
+ const refuse = (reason, detail) => ({ ok: false, outcome: { persisted: false, reason, detail } });
46855
+ if (input.prNumber === void 0 || input.baseSha === void 0) {
46856
+ return refuse(
46857
+ "binding-inputs-absent",
46858
+ "No audit record written: supply both prNumber and baseSha to persist an Option-C governor-review record bound to {prNumber, baseSha, reviewedDiffHash}."
46859
+ );
46860
+ }
46861
+ if (!looksLikeUnifiedDiff(input.prDiff)) {
46862
+ return refuse(
46863
+ "diff-not-unified",
46864
+ "No audit record written: prDiff is not a unified diff, so the review did not examine code and reviewedDiffHash would hash non-diff text \u2014 a record indistinguishable from a real one (#4451)."
46865
+ );
46866
+ }
46867
+ if (input.simulate) {
46868
+ return refuse(
46869
+ "simulated",
46870
+ "No audit record written: the review used simulated voters, and a committed governance record must not be seeded from non-live output (mirrors #2319)."
46871
+ );
46872
+ }
46873
+ if (counts.approveCount + counts.requestChangesCount + counts.abstainCount === 0) {
46874
+ return refuse(
46875
+ "no-live-votes",
46876
+ "No audit record written: every voter errored, so the aggregate verdict reflects no live review. A committed governor-review record must not be seeded from a failed panel (the pr_review analogue of no_quorum, #4053)."
46877
+ );
46878
+ }
46879
+ return { ok: true, prNumber: input.prNumber, baseSha: input.baseSha };
46880
+ }
46881
+ function persistReviewRecord(args) {
46882
+ const gate = refuseToPersist(args);
46883
+ if (!gate.ok) return gate.outcome;
46884
+ try {
46885
+ return buildAndPersist(gate.prNumber, gate.baseSha, args);
46886
+ } catch (error) {
46887
+ const detail = error instanceof Error ? error.message : String(error);
46888
+ args.logger.warn("Audit-record persistence threw (non-fatal)", { detail });
46889
+ return {
46890
+ persisted: false,
46891
+ reason: "write-failed",
46892
+ detail: `Audit record persistence raised: ${detail}`
46893
+ };
46894
+ }
46895
+ }
46896
+
46879
46897
  // src/mcp/tools/pr-review-result-mapping.ts
46880
46898
  function resolveFindings(result) {
46881
46899
  const raw = result.vote.findings;
@@ -46931,8 +46949,10 @@ var PR_REVIEW_ASYNC_HINT = "A pr_review run fans out to 5 live LLM voters and ca
46931
46949
  var PrReviewInputSchema = z93.object({
46932
46950
  prTitle: z93.string().min(1).max(500).describe("PR title"),
46933
46951
  prDescription: z93.string().max(MAX_DESCRIPTION_LENGTH).optional().describe("PR body / description"),
46934
- prDiff: z93.string().min(1).max(MAX_DIFF_INPUT_LENGTH).describe(
46935
- `Unified diff text (max ${String(MAX_DIFF_INPUT_LENGTH)} chars). No need to truncate before calling: diffs over ${String(MAX_DIFF_LENGTH)} chars are security-prioritized and PARTIALLY reviewed (lowest-priority whole files dropped; coverage reported on the response, and a partial review can block but never verified-approve).`
46952
+ prDiff: z93.string().min(1).max(MAX_DIFF_INPUT_LENGTH).refine(looksLikeUnifiedDiff, {
46953
+ message: "prDiff must be a unified diff (expected a `diff --git`, `---`/`+++`, or `@@ \u2026 @@` line). Prose descriptions of a change are rejected: a review of a summary is not a review of the code, and would be recorded as though it were (#4451)."
46954
+ }).describe(
46955
+ `Unified diff text (max ${String(MAX_DIFF_INPUT_LENGTH)} chars). REQUIRED SHAPE (#4451): must contain a \`diff --git\` header, an \`@@ \u2026 @@\` hunk header backed by +/- lines, or a \`---\`/\`+++\` header pair \u2014 a prose summary of the change is REJECTED, because reviewing a summary is not reviewing the code and would be recorded as though it were. (Stated here because Zod refinements do not survive JSON-schema generation, so this constraint is otherwise invisible to clients.) No need to truncate before calling: diffs over ${String(MAX_DIFF_LENGTH)} chars are security-prioritized and PARTIALLY reviewed (lowest-priority whole files dropped; coverage reported on the response, and a partial review can block but never verified-approve).`
46936
46956
  ),
46937
46957
  repoContext: z93.string().max(MAX_REPO_CONTEXT_LENGTH).optional().describe(
46938
46958
  `Optional one-paragraph repo context (architecture, conventions; max ${String(MAX_REPO_CONTEXT_LENGTH)} chars; trim before calling)`
@@ -54146,4 +54166,4 @@ export {
54146
54166
  shutdownFeedbackSubscriber,
54147
54167
  createEventBusBridge
54148
54168
  };
54149
- //# sourceMappingURL=chunk-IMOLBA2M.js.map
54169
+ //# sourceMappingURL=chunk-DITV4B6I.js.map