@agent-inspect/eval 6.31.9 → 6.31.11

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.
package/dist/index.mjs CHANGED
@@ -729,6 +729,15 @@ function actionForRule(rule) {
729
729
  if (rule.strategy === "full") return "replace";
730
730
  return rule.strategy;
731
731
  }
732
+ function isCompleteRedactionMarker(value, replacement = "[REDACTED]") {
733
+ if (typeof value !== "string") return false;
734
+ const trimmed = value.trim();
735
+ if (trimmed.length === 0) return false;
736
+ if (trimmed === replacement) return true;
737
+ if (/^\[HASH:[A-Za-z0-9_-]+\]$/.test(trimmed)) return true;
738
+ if (/^\[REDACTED:[^\]]*\]$/.test(trimmed)) return true;
739
+ return false;
740
+ }
732
741
  function applyRule(rule, value, replacement) {
733
742
  if (rule.strategy === "full") return replacement;
734
743
  const asString = stringifyScalar(value);
@@ -843,6 +852,9 @@ var Redactor = class {
843
852
  if (key !== void 0) {
844
853
  const rule = findCompiledKeyRule(key, this.#rules);
845
854
  if (rule) {
855
+ if (isCompleteRedactionMarker(value, this.#replacement)) {
856
+ return value;
857
+ }
846
858
  this.#recordFinding(
847
859
  state,
848
860
  makeFinding(path, `key.${rule.key}`, actionForRule(rule), "key", "warning")