nexus-agents 8.3.1 → 8.3.2

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-2OS7HTUM.js";
3
+ } from "./chunk-LZBARHPR.js";
4
4
  import {
5
5
  emitClawGuardViolation
6
6
  } from "./chunk-U5YJKJK2.js";
@@ -1029,24 +1029,37 @@ function checkSecurityTier(config, sanitizeResult, logger) {
1029
1029
  });
1030
1030
  }
1031
1031
  function runPreChecks(config, args, mode, requestContext, logger) {
1032
+ const noSanitization = { wasModified: false, commentsRemoved: 0 };
1032
1033
  const sizeResult = checkInputSize(args, logger, requestContext.requestId);
1033
- if (sizeResult) return { error: sizeResult, sanitizedArgs: args, nearMiss: false };
1034
+ if (sizeResult) {
1035
+ return {
1036
+ error: sizeResult,
1037
+ sanitizedArgs: args,
1038
+ nearMiss: false,
1039
+ sanitization: noSanitization
1040
+ };
1041
+ }
1034
1042
  const sanitizeResult = sanitizeToolInput(args);
1035
1043
  logSanitizationResult(sanitizeResult, logger, config.toolName);
1036
1044
  const sanitizedArgs = sanitizeResult.wasModified ? sanitizeResult.sanitized : args;
1045
+ const sanitization = {
1046
+ wasModified: sanitizeResult.wasModified,
1047
+ commentsRemoved: sanitizeResult.commentsRemoved
1048
+ };
1037
1049
  const tierError = checkSecurityTier(config, sanitizeResult, logger);
1038
- if (tierError !== null) return { error: tierError, sanitizedArgs, nearMiss: false };
1050
+ if (tierError !== null) return { error: tierError, sanitizedArgs, nearMiss: false, sanitization };
1039
1051
  if (config.rateLimiter) {
1040
1052
  const rlResult = checkRateLimit(config.rateLimiter, logger);
1041
1053
  if (rlResult) {
1042
1054
  if (config.auditLogger)
1043
1055
  emitRateLimitAudit(config.auditLogger, config.toolName, requestContext);
1044
- return { error: rlResult, sanitizedArgs, nearMiss: false };
1056
+ return { error: rlResult, sanitizedArgs, nearMiss: false, sanitization };
1045
1057
  }
1046
1058
  }
1047
1059
  const policy = runPolicyCheck(config, sanitizedArgs, mode, logger, requestContext);
1048
- if (policy.error) return { error: policy.error, sanitizedArgs, nearMiss: policy.nearMiss };
1049
- return { error: null, sanitizedArgs, nearMiss: policy.nearMiss };
1060
+ if (policy.error)
1061
+ return { error: policy.error, sanitizedArgs, nearMiss: policy.nearMiss, sanitization };
1062
+ return { error: null, sanitizedArgs, nearMiss: policy.nearMiss, sanitization };
1050
1063
  }
1051
1064
  function createSecureHandler(handler, config) {
1052
1065
  const logger = config.logger ?? createLogger({ tool: config.toolName });
@@ -1066,13 +1079,15 @@ function createSecureHandler(handler, config) {
1066
1079
  const {
1067
1080
  error: preCheckError,
1068
1081
  sanitizedArgs,
1069
- nearMiss
1082
+ nearMiss,
1083
+ sanitization
1070
1084
  } = runPreChecks(config, args, mode, requestContext, requestLogger);
1071
1085
  if (preCheckError) return preCheckError;
1072
1086
  return executeAndAudit(handler, sanitizedArgs, config, {
1073
1087
  requestContext,
1074
1088
  requestLogger,
1075
1089
  nearMiss,
1090
+ sanitization,
1076
1091
  logLifecycle: inherited === void 0
1077
1092
  });
1078
1093
  };
@@ -1084,7 +1099,7 @@ async function executeAndAudit(handler, sanitizedArgs, config, invocation) {
1084
1099
  const result = await executeHandler(
1085
1100
  handler,
1086
1101
  sanitizedArgs,
1087
- { requestContext, logger: requestLogger },
1102
+ { requestContext, logger: requestLogger, sanitization: invocation.sanitization },
1088
1103
  requestLogger,
1089
1104
  invocation.logLifecycle
1090
1105
  );
@@ -2231,4 +2246,4 @@ export {
2231
2246
  VOTING_THRESHOLDS,
2232
2247
  ConsensusMetricsSchema
2233
2248
  };
2234
- //# sourceMappingURL=chunk-TSZWXRF7.js.map
2249
+ //# sourceMappingURL=chunk-VULYVX6X.js.map