nexus-agents 8.127.2 → 8.127.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.
Files changed (42) hide show
  1. package/dist/{chunk-MFFQMSZE.js → chunk-4BOMMHUE.js} +8 -8
  2. package/dist/{chunk-KSUHCDKP.js → chunk-CHEE634Q.js} +94 -12
  3. package/dist/chunk-CHEE634Q.js.map +1 -0
  4. package/dist/{chunk-HBU4TS4G.js → chunk-DMPSZJOB.js} +3 -3
  5. package/dist/{chunk-PJK7D5WY.js → chunk-HBDVJXZO.js} +2 -2
  6. package/dist/{chunk-ZQWNLCUU.js → chunk-P25EFRTP.js} +3 -3
  7. package/dist/{chunk-IPUOSGL7.js → chunk-WWZEJP6X.js} +2 -2
  8. package/dist/cli.js +7 -7
  9. package/dist/{consensus-vote-UCUFI2OU.js → consensus-vote-PNVJR6HL.js} +4 -4
  10. package/dist/{improvement-review-GPM5HHZJ.js → improvement-review-EVTF6OQ6.js} +4 -4
  11. package/dist/index.js +6 -6
  12. package/dist/{setup-data-dir-LQD5YYJ6.js → setup-data-dir-C6NKPLEF.js} +3 -3
  13. package/node_modules/@google/genai/dist/genai.d.ts +16 -1
  14. package/node_modules/@google/genai/dist/index.cjs +35 -1
  15. package/node_modules/@google/genai/dist/index.mjs +35 -1
  16. package/node_modules/@google/genai/dist/index.mjs.map +1 -1
  17. package/node_modules/@google/genai/dist/node/index.cjs +35 -1
  18. package/node_modules/@google/genai/dist/node/index.mjs +35 -1
  19. package/node_modules/@google/genai/dist/node/index.mjs.map +1 -1
  20. package/node_modules/@google/genai/dist/node/node.d.ts +16 -1
  21. package/node_modules/@google/genai/dist/tokenizer/node.cjs +4 -0
  22. package/node_modules/@google/genai/dist/tokenizer/node.mjs +4 -0
  23. package/node_modules/@google/genai/dist/tokenizer/node.mjs.map +1 -1
  24. package/node_modules/@google/genai/dist/vertex_internal/index.cjs +5 -1
  25. package/node_modules/@google/genai/dist/vertex_internal/index.cjs.map +1 -1
  26. package/node_modules/@google/genai/dist/vertex_internal/index.d.ts +16 -1
  27. package/node_modules/@google/genai/dist/vertex_internal/index.js +5 -1
  28. package/node_modules/@google/genai/dist/vertex_internal/index.js.map +1 -1
  29. package/node_modules/@google/genai/dist/web/index.mjs +35 -1
  30. package/node_modules/@google/genai/dist/web/index.mjs.map +1 -1
  31. package/node_modules/@google/genai/dist/web/web.d.ts +16 -1
  32. package/node_modules/@google/genai/package.json +1 -1
  33. package/package.json +1 -1
  34. package/dist/chunk-KSUHCDKP.js.map +0 -1
  35. /package/dist/{chunk-MFFQMSZE.js.map → chunk-4BOMMHUE.js.map} +0 -0
  36. /package/dist/{chunk-HBU4TS4G.js.map → chunk-DMPSZJOB.js.map} +0 -0
  37. /package/dist/{chunk-PJK7D5WY.js.map → chunk-HBDVJXZO.js.map} +0 -0
  38. /package/dist/{chunk-ZQWNLCUU.js.map → chunk-P25EFRTP.js.map} +0 -0
  39. /package/dist/{chunk-IPUOSGL7.js.map → chunk-WWZEJP6X.js.map} +0 -0
  40. /package/dist/{consensus-vote-UCUFI2OU.js.map → consensus-vote-PNVJR6HL.js.map} +0 -0
  41. /package/dist/{improvement-review-GPM5HHZJ.js.map → improvement-review-EVTF6OQ6.js.map} +0 -0
  42. /package/dist/{setup-data-dir-LQD5YYJ6.js.map → setup-data-dir-C6NKPLEF.js.map} +0 -0
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-2IKFZJQO.js";
10
10
  import {
11
11
  withPrerequisite
12
- } from "./chunk-PJK7D5WY.js";
12
+ } from "./chunk-HBDVJXZO.js";
13
13
  import {
14
14
  generateSecurityPlan
15
15
  } from "./chunk-DAV5URDU.js";
@@ -41,7 +41,7 @@ import {
41
41
  import {
42
42
  DEFAULT_TASK_TTL_MS,
43
43
  clampTaskTtl
44
- } from "./chunk-ZQWNLCUU.js";
44
+ } from "./chunk-P25EFRTP.js";
45
45
  import {
46
46
  executeExpert
47
47
  } from "./chunk-YMZZVKX7.js";
@@ -96,7 +96,7 @@ import {
96
96
  withFileLock,
97
97
  withWarnings,
98
98
  writeJobCancelled
99
- } from "./chunk-HBU4TS4G.js";
99
+ } from "./chunk-DMPSZJOB.js";
100
100
  import {
101
101
  NOOP_NOTIFIER,
102
102
  RateLimiter,
@@ -122,12 +122,12 @@ import {
122
122
  toolSuccessStructured,
123
123
  withProgressHeartbeat,
124
124
  wrapToolWithTimeout
125
- } from "./chunk-KSUHCDKP.js";
125
+ } from "./chunk-CHEE634Q.js";
126
126
  import {
127
127
  VERSION,
128
128
  createRequestContext,
129
129
  measuredTrustTier
130
- } from "./chunk-IPUOSGL7.js";
130
+ } from "./chunk-WWZEJP6X.js";
131
131
  import {
132
132
  allOf,
133
133
  anyOf
@@ -47060,7 +47060,7 @@ function buildVotingInput(plan, config) {
47060
47060
  }
47061
47061
  async function executeSingleVote(plan, config, log) {
47062
47062
  try {
47063
- const { executeVoting } = await import("./consensus-vote-UCUFI2OU.js");
47063
+ const { executeVoting } = await import("./consensus-vote-PNVJR6HL.js");
47064
47064
  const input = buildVotingInput(plan, config);
47065
47065
  const result = await executeVoting(input, log);
47066
47066
  return parseVotingResult(result);
@@ -48207,7 +48207,7 @@ function createVoteStage({ config, startStage }) {
48207
48207
  const strategy = config.votingStrategy ?? "higher_order";
48208
48208
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
48209
48209
  try {
48210
- const { executeVoting } = await import("./consensus-vote-UCUFI2OU.js");
48210
+ const { executeVoting } = await import("./consensus-vote-PNVJR6HL.js");
48211
48211
  const proposal = buildVoteProposal(plan, research);
48212
48212
  const votingResult = await executeVoting(
48213
48213
  {
@@ -57918,4 +57918,4 @@ export {
57918
57918
  initializeSandbox,
57919
57919
  getSandboxMode
57920
57920
  };
57921
- //# sourceMappingURL=chunk-MFFQMSZE.js.map
57921
+ //# sourceMappingURL=chunk-4BOMMHUE.js.map
@@ -5,7 +5,7 @@ import {
5
5
  getCurrentRequestContext,
6
6
  runWithRequestContext,
7
7
  serverCallerInfo
8
- } from "./chunk-IPUOSGL7.js";
8
+ } from "./chunk-WWZEJP6X.js";
9
9
  import {
10
10
  DEFAULT_EXECUTION_MODE
11
11
  } from "./chunk-ECJ52NSK.js";
@@ -812,17 +812,17 @@ function checkSecurityTier(tier, sanitizeResult, logger) {
812
812
  tier
813
813
  };
814
814
  }
815
- function emitSecurityTierAudit(auditLogger, toolName, ctx, refusal) {
815
+ function emitSecurityTierAudit(auditLogger, toolName, ctx, refusal2) {
816
816
  auditLogger.logSecurityEvent({
817
- eventType: refusal.eventType,
817
+ eventType: refusal2.eventType,
818
818
  // `critical` is this enum's security-violation level ('info' / 'warning' /
819
819
  // 'critical'); a refused injection attempt is not routine noise, and the
820
820
  // level is what a downstream consumer filters on.
821
821
  severity: "critical",
822
822
  actor: actorFromContext(ctx),
823
- description: refusal.eventType === "sanitization_incomplete" ? `Tool '${toolName}' refused input the sanitizer could not reduce to a fixed point.` : `Tool '${toolName}' refused input carrying injection patterns [${refusal.patterns.join(", ")}].`,
823
+ description: refusal2.eventType === "sanitization_incomplete" ? `Tool '${toolName}' refused input the sanitizer could not reduce to a fixed point.` : `Tool '${toolName}' refused input carrying injection patterns [${refusal2.patterns.join(", ")}].`,
824
824
  requestId: ctx.requestId,
825
- metadata: { toolName, tier: refusal.tier, patterns: [...refusal.patterns] }
825
+ metadata: { toolName, tier: refusal2.tier, patterns: [...refusal2.patterns] }
826
826
  });
827
827
  }
828
828
 
@@ -1156,6 +1156,84 @@ function checkPolicyForDispatchedTool(opts) {
1156
1156
  ).error;
1157
1157
  }
1158
1158
 
1159
+ // src/mcp/middleware/install-state.ts
1160
+ import { readFileSync, statSync } from "node:fs";
1161
+ import { basename, dirname, isAbsolute, relative, resolve as resolve2, sep as sep2 } from "node:path";
1162
+ import { fileURLToPath } from "node:url";
1163
+ var moduleDirectory = dirname(fileURLToPath(import.meta.url));
1164
+ var packagePath = basename(moduleDirectory) === "dist" ? resolve2(moduleDirectory, "../package.json") : void 0;
1165
+ var cachedMtime;
1166
+ var installedVersion = VERSION;
1167
+ var refusal;
1168
+ var warned = false;
1169
+ function warnOnce(logger, message) {
1170
+ if (warned) return;
1171
+ warned = true;
1172
+ logger.warn(message);
1173
+ }
1174
+ function refuseInstall(version, logger) {
1175
+ const message = `nexus-agents was upgraded from ${VERSION} to ${version} while this MCP server was running; restart the MCP server (or your client) to load the new version.`;
1176
+ warnOnce(logger, message);
1177
+ refusal = toolStructuredError({ errorCategory: "business", message });
1178
+ return refusal;
1179
+ }
1180
+ function checkRunningInstall(logger) {
1181
+ if (packagePath === void 0) {
1182
+ warnOnce(
1183
+ logger,
1184
+ "Running install check unmeasured: starting package.json cannot be determined; skipping check."
1185
+ );
1186
+ return void 0;
1187
+ }
1188
+ if (refusal !== void 0) return refusal;
1189
+ try {
1190
+ const mtime = statSync(packagePath).mtimeMs;
1191
+ if (mtime !== cachedMtime) {
1192
+ installedVersion = readInstalledVersion(packagePath);
1193
+ cachedMtime = mtime;
1194
+ }
1195
+ return installedVersion === VERSION ? void 0 : refuseInstall(installedVersion, logger);
1196
+ } catch (error) {
1197
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
1198
+ return refuseInstall("removed", logger);
1199
+ }
1200
+ const message = "Running install check could not read package.json; restart the MCP server (or your client).";
1201
+ warnOnce(logger, message);
1202
+ return toolStructuredError({ errorCategory: "internal", message });
1203
+ }
1204
+ }
1205
+ function mapInstallModuleError(error, logger) {
1206
+ if (packagePath === void 0) return void 0;
1207
+ const target = missingModuleTarget(error);
1208
+ if (target === void 0) return void 0;
1209
+ const path = moduleTargetPath(target);
1210
+ if (path === void 0) return void 0;
1211
+ if (!isAbsolute(path)) return void 0;
1212
+ const within = relative(moduleDirectory, path);
1213
+ if (within === "" || within === ".." || within.startsWith(`..${sep2}`) || isAbsolute(within))
1214
+ return void 0;
1215
+ return checkRunningInstall(logger) ?? refuseInstall("unknown (installation changed)", logger);
1216
+ }
1217
+ function moduleTargetPath(target) {
1218
+ try {
1219
+ return target.startsWith("file:") ? fileURLToPath(target) : target;
1220
+ } catch {
1221
+ return void 0;
1222
+ }
1223
+ }
1224
+ function readInstalledVersion(path) {
1225
+ const pkg = JSON.parse(readFileSync(path, "utf8"));
1226
+ if (typeof pkg !== "object" || pkg === null || !("version" in pkg) || typeof pkg.version !== "string") {
1227
+ throw new Error("Installed package.json has no version");
1228
+ }
1229
+ return pkg.version;
1230
+ }
1231
+ function missingModuleTarget(error) {
1232
+ if (!(error instanceof Error) || !("code" in error)) return void 0;
1233
+ if (error.code !== "ERR_MODULE_NOT_FOUND" && error.code !== "MODULE_NOT_FOUND") return void 0;
1234
+ return /Cannot find module ['"]([^'"]+)['"]/.exec(error.message)?.[1];
1235
+ }
1236
+
1159
1237
  // src/mcp/middleware/secure-handler.ts
1160
1238
  function internalError(message, requestId) {
1161
1239
  return toolStructuredError({
@@ -1276,11 +1354,11 @@ function runPreChecks(config, args, mode, requestContext, logger) {
1276
1354
  // sanitization touched it.
1277
1355
  ...measureRawFields(config.rawHashFields, args)
1278
1356
  };
1279
- const refusal = checkSecurityTier(config.securityTier ?? "standard", sanitizeResult, logger);
1280
- if (refusal !== null) {
1357
+ const refusal2 = checkSecurityTier(config.securityTier ?? "standard", sanitizeResult, logger);
1358
+ if (refusal2 !== null) {
1281
1359
  if (config.auditLogger)
1282
- emitSecurityTierAudit(config.auditLogger, config.toolName, requestContext, refusal);
1283
- return { error: refusal.error, sanitizedArgs, nearMiss: false, sanitization };
1360
+ emitSecurityTierAudit(config.auditLogger, config.toolName, requestContext, refusal2);
1361
+ return { error: refusal2.error, sanitizedArgs, nearMiss: false, sanitization };
1284
1362
  }
1285
1363
  if (config.rateLimiter) {
1286
1364
  const denial = checkRateLimit(config.rateLimiter, logger);
@@ -1301,6 +1379,8 @@ function createSecureHandler(handler, config) {
1301
1379
  config = { ...config, auditLogger: registeredAuditLogger };
1302
1380
  const logger = config.logger ?? createLogger({ tool: config.toolName });
1303
1381
  return async (args) => {
1382
+ const installError = checkRunningInstall(logger);
1383
+ if (installError !== void 0) return installError;
1304
1384
  const mode = config.executionMode ?? getGlobalExecutionMode();
1305
1385
  const ctxOpts = {
1306
1386
  toolName: config.toolName,
@@ -1365,6 +1445,8 @@ async function executeAndAudit(handler, sanitizedArgs, config, invocation) {
1365
1445
  nearMiss: invocation.nearMiss
1366
1446
  });
1367
1447
  }
1448
+ const installError = mapInstallModuleError(error, requestLogger);
1449
+ if (installError !== void 0) return installError;
1368
1450
  const sanitized = sanitizeOutput(rawMessage, requestLogger);
1369
1451
  return internalError(sanitized, requestContext.requestId);
1370
1452
  }
@@ -1434,7 +1516,7 @@ async function withProgressHeartbeat(toolName, notifier, operation, intervalMs =
1434
1516
  // src/mcp/middleware/tool-wrapper.ts
1435
1517
  import { randomUUID } from "node:crypto";
1436
1518
  import { appendFileSync, existsSync, mkdirSync } from "node:fs";
1437
- import { dirname, join } from "node:path";
1519
+ import { dirname as dirname2, join } from "node:path";
1438
1520
 
1439
1521
  // src/mcp/middleware/timeout-guard.ts
1440
1522
  var DEFAULT_TIMEOUT_MS = TIMEOUT_GUARD.defaultMs;
@@ -1903,7 +1985,7 @@ var ensuredDirs = /* @__PURE__ */ new Set();
1903
1985
  function appendTimeoutMismatchEvent(event) {
1904
1986
  try {
1905
1987
  const path = join(getNexusDataDir(), TIMEOUT_MISMATCH_TELEMETRY_REL_PATH);
1906
- const dir = dirname(path);
1988
+ const dir = dirname2(path);
1907
1989
  if (!ensuredDirs.has(dir)) {
1908
1990
  if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
1909
1991
  ensuredDirs.add(dir);
@@ -2253,4 +2335,4 @@ export {
2253
2335
  DEFAULT_CONSENSUS_CONFIG,
2254
2336
  ConsensusMetricsSchema
2255
2337
  };
2256
- //# sourceMappingURL=chunk-KSUHCDKP.js.map
2338
+ //# sourceMappingURL=chunk-CHEE634Q.js.map