nexus-agents 4.21.0 → 4.22.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.
@@ -170,7 +170,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
170
170
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
171
171
 
172
172
  // src/version.ts
173
- var VERSION = true ? "4.21.0" : "dev";
173
+ var VERSION = true ? "4.22.1" : "dev";
174
174
 
175
175
  // src/mcp/task-store.ts
176
176
  import { InMemoryTaskStore } from "@modelcontextprotocol/sdk/experimental/tasks";
@@ -1201,7 +1201,7 @@ async function runDoctorFix(result) {
1201
1201
  writeLine2("\u2500".repeat(40));
1202
1202
  let fixCount = 0;
1203
1203
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
1204
- const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-II6YK33Z.js");
1204
+ const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-BKIKRQCE.js");
1205
1205
  const outcome = describeDataDirFix2(initDataDirectories2());
1206
1206
  writeLine2(outcome.line);
1207
1207
  if (outcome.counted) fixCount++;
@@ -1304,4 +1304,4 @@ export {
1304
1304
  startStdioServer,
1305
1305
  closeServer
1306
1306
  };
1307
- //# sourceMappingURL=chunk-HSTJBWEB.js.map
1307
+ //# sourceMappingURL=chunk-CMXVOO4L.js.map
@@ -22,7 +22,7 @@ import {
22
22
  toolSuccess,
23
23
  withProgressHeartbeat,
24
24
  wrapToolWithTimeout
25
- } from "./chunk-F6ZTTBI3.js";
25
+ } from "./chunk-JJC5YKBH.js";
26
26
  import {
27
27
  assessPanelIndependence,
28
28
  countDistinctModels,
@@ -6749,4 +6749,4 @@ export {
6749
6749
  CONSENSUS_VOTE_TOOL_SCHEMA,
6750
6750
  registerConsensusVoteTool
6751
6751
  };
6752
- //# sourceMappingURL=chunk-WRJGJNPL.js.map
6752
+ //# sourceMappingURL=chunk-G2USF7DN.js.map
@@ -719,6 +719,26 @@ function logSanitizationResult(result, logger, toolName) {
719
719
  }
720
720
  }
721
721
 
722
+ // src/mcp/middleware/policy-registry.ts
723
+ var globalPolicyFirewall;
724
+ function getGlobalPolicyFirewall() {
725
+ return globalPolicyFirewall;
726
+ }
727
+ function setGlobalPolicyFirewall(firewall) {
728
+ globalPolicyFirewall = firewall;
729
+ }
730
+ function stagePolicyFirewallForRollout(firewall, logger) {
731
+ const configuredMode = firewall.getMode();
732
+ if (configuredMode !== "warn") {
733
+ firewall.setMode("warn");
734
+ }
735
+ logger.info("MCP policy firewall wired in warn mode \u2014 denials are logged, not applied", {
736
+ configuredMode,
737
+ ruleCount: firewall.getRules().length
738
+ });
739
+ return firewall;
740
+ }
741
+
722
742
  // src/mcp/middleware/secure-handler.ts
723
743
  function rateLimitError(nextTokenMs) {
724
744
  return toolStructuredError({
@@ -804,6 +824,23 @@ function checkPolicy(opts) {
804
824
  opts.logger.debug("Policy check passed", { reason: decision.reason });
805
825
  return null;
806
826
  }
827
+ function runPolicyCheck(config, sanitizedArgs, mode, logger, requestContext) {
828
+ const firewall = config.policyFirewall ?? getGlobalPolicyFirewall();
829
+ if (!firewall) return null;
830
+ const pResult = checkPolicy({
831
+ firewall,
832
+ toolName: config.toolName,
833
+ args: sanitizedArgs,
834
+ mode,
835
+ allowedPaths: config.allowedPaths,
836
+ logger,
837
+ requestId: requestContext.requestId
838
+ });
839
+ if (pResult && config.auditLogger) {
840
+ emitPolicyAudit(config.auditLogger, config.toolName, requestContext, "policy denied");
841
+ }
842
+ return pResult;
843
+ }
807
844
  async function executeHandler(handler, args, ctx, logger) {
808
845
  const startTime = getTimeProvider().now();
809
846
  const result = handler.length >= 2 ? await handler(args, ctx) : await handler(args);
@@ -887,22 +924,8 @@ function runPreChecks(config, args, mode, requestContext, logger) {
887
924
  return { error: rlResult, sanitizedArgs };
888
925
  }
889
926
  }
890
- if (config.policyFirewall) {
891
- const pResult = checkPolicy({
892
- firewall: config.policyFirewall,
893
- toolName: config.toolName,
894
- args: sanitizedArgs,
895
- mode,
896
- allowedPaths: config.allowedPaths,
897
- logger,
898
- requestId: requestContext.requestId
899
- });
900
- if (pResult) {
901
- if (config.auditLogger)
902
- emitPolicyAudit(config.auditLogger, config.toolName, requestContext, "policy denied");
903
- return { error: pResult, sanitizedArgs };
904
- }
905
- }
927
+ const pResult = runPolicyCheck(config, sanitizedArgs, mode, logger, requestContext);
928
+ if (pResult) return { error: pResult, sanitizedArgs };
906
929
  return { error: null, sanitizedArgs };
907
930
  }
908
931
  function createSecureHandler(handler, config) {
@@ -2014,6 +2037,8 @@ export {
2014
2037
  toolSuccessStructured,
2015
2038
  toolStructuredError,
2016
2039
  toolError,
2040
+ setGlobalPolicyFirewall,
2041
+ stagePolicyFirewallForRollout,
2017
2042
  createSecureHandler,
2018
2043
  createMcpNotifier,
2019
2044
  NOOP_NOTIFIER,
@@ -2042,4 +2067,4 @@ export {
2042
2067
  VOTING_THRESHOLDS,
2043
2068
  ConsensusMetricsSchema
2044
2069
  };
2045
- //# sourceMappingURL=chunk-F6ZTTBI3.js.map
2070
+ //# sourceMappingURL=chunk-JJC5YKBH.js.map