nexus-agents 8.48.2 → 8.48.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.
@@ -23,10 +23,10 @@ import {
23
23
  toolSuccessStructured,
24
24
  withProgressHeartbeat,
25
25
  wrapToolWithTimeout
26
- } from "./chunk-5IB64MNO.js";
26
+ } from "./chunk-JZ4GXMVX.js";
27
27
  import {
28
28
  VERSION
29
- } from "./chunk-2EH4T5I6.js";
29
+ } from "./chunk-OTCLEHE2.js";
30
30
  import {
31
31
  assessPanelIndependence,
32
32
  countDistinctModels,
@@ -77,6 +77,7 @@ import {
77
77
  getOutcomesFile
78
78
  } from "./chunk-MTYJPPIG.js";
79
79
  import {
80
+ findRepoRoot,
80
81
  getNexusDataDir,
81
82
  nexusDataPath,
82
83
  nexusDataPathEnsure
@@ -1126,9 +1127,9 @@ function createKeyedSerializer() {
1126
1127
  }
1127
1128
  function raceWithDeadline(p, role, deadlineMs) {
1128
1129
  let timer;
1129
- const timeoutP = new Promise((resolve3) => {
1130
+ const timeoutP = new Promise((resolve4) => {
1130
1131
  timer = setTimeout(() => {
1131
- resolve3(createErrorVoteResult(role, DEADLINE_MESSAGE, deadlineMs));
1132
+ resolve4(createErrorVoteResult(role, DEADLINE_MESSAGE, deadlineMs));
1132
1133
  }, deadlineMs);
1133
1134
  });
1134
1135
  return Promise.race([p, timeoutP]).finally(() => {
@@ -5154,7 +5155,7 @@ function applyErrorPolicy(votes, policy) {
5154
5155
 
5155
5156
  // src/audit/vote-record-store.ts
5156
5157
  import { appendFileSync as appendFileSync2, existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2 } from "node:fs";
5157
- import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
5158
+ import { dirname, isAbsolute, relative, resolve as resolve2, sep } from "node:path";
5158
5159
 
5159
5160
  // src/audit/ledger-append.ts
5160
5161
  var UNREADABLE_RECORD_PREFIX = "refusing to persist an unreadable";
@@ -5175,6 +5176,21 @@ function serializeValidatedRecord(schema, record, ledgerName) {
5175
5176
  return line + "\n";
5176
5177
  }
5177
5178
 
5179
+ // src/audit/source-checkout-guard.ts
5180
+ import { join, resolve } from "node:path";
5181
+ function isUnderTestRunner() {
5182
+ return process.env["VITEST"] !== void 0 || process.env["NODE_ENV"] === "test";
5183
+ }
5184
+ function assertNotSourceCheckoutWrite(filePath, trackedRelPath, overrideEnvVar) {
5185
+ if (!isUnderTestRunner()) return;
5186
+ const here = findRepoRoot(process.cwd());
5187
+ if (here === null) return;
5188
+ if (resolve(filePath) !== resolve(join(here, trackedRelPath))) return;
5189
+ throw new Error(
5190
+ `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 ${overrideEnvVar}.`
5191
+ );
5192
+ }
5193
+
5178
5194
  // src/audit/vote-record.ts
5179
5195
  import * as crypto from "node:crypto";
5180
5196
  import { z as z7 } from "zod";
@@ -5440,6 +5456,7 @@ function hashProposal(proposal) {
5440
5456
  }
5441
5457
 
5442
5458
  // src/audit/vote-record-store.ts
5459
+ var VOTE_RECORDS_REL_PATH = "governance/vote-records.jsonl";
5443
5460
  var VOTE_RECORDS_DATA_CATEGORY = "governance";
5444
5461
  var VOTE_RECORDS_FILENAME = "vote-records.jsonl";
5445
5462
  var VOTE_RECORDS_PATH_ENV = "NEXUS_VOTE_RECORDS_PATH";
@@ -5581,8 +5598,8 @@ function readLedgerTip(filePath, logger11) {
5581
5598
  }
5582
5599
  }
5583
5600
  function isWithin(root, target) {
5584
- const resolvedRoot = resolve(root);
5585
- const resolvedTarget = resolve(target);
5601
+ const resolvedRoot = resolve2(root);
5602
+ const resolvedTarget = resolve2(target);
5586
5603
  if (resolvedTarget === resolvedRoot) return true;
5587
5604
  const rel = relative(resolvedRoot, resolvedTarget);
5588
5605
  return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
@@ -5590,7 +5607,7 @@ function isWithin(root, target) {
5590
5607
  function resolveVoteRecordsPath() {
5591
5608
  const envPath = process.env[VOTE_RECORDS_PATH_ENV];
5592
5609
  if (envPath !== void 0 && envPath.trim() !== "") {
5593
- const resolved2 = isAbsolute(envPath) ? envPath : resolve(envPath);
5610
+ const resolved2 = isAbsolute(envPath) ? envPath : resolve2(envPath);
5594
5611
  if (!isAbsolute(envPath) && !isWithin(process.cwd(), resolved2)) {
5595
5612
  return void 0;
5596
5613
  }
@@ -5614,6 +5631,7 @@ function persistVoteRecord(opts) {
5614
5631
  logger11.warn(voteRecordWriteFailedMessage("<unresolved>"), { id: opts.id });
5615
5632
  return void 0;
5616
5633
  }
5634
+ assertNotSourceCheckoutWrite(filePath, VOTE_RECORDS_REL_PATH, VOTE_RECORDS_PATH_ENV);
5617
5635
  try {
5618
5636
  mkdirSync2(dirname(filePath), { recursive: true });
5619
5637
  const { maxSequence, lastHash } = readLedgerTip(filePath, logger11);
@@ -7924,6 +7942,7 @@ export {
7924
7942
  toRecordDecision,
7925
7943
  mapOutcomeToDecision,
7926
7944
  serializeValidatedRecord,
7945
+ assertNotSourceCheckoutWrite,
7927
7946
  recordAuthenticVote,
7928
7947
  recordDecisionCost,
7929
7948
  checkSimulationAllowed,
@@ -7939,4 +7958,4 @@ export {
7939
7958
  CONSENSUS_VOTE_TOOL_SCHEMA,
7940
7959
  registerConsensusVoteTool
7941
7960
  };
7942
- //# sourceMappingURL=chunk-DTUJCA6M.js.map
7961
+ //# sourceMappingURL=chunk-HWPDTJ25.js.map