@tangle-network/agent-app 3.0.31 → 3.0.32

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.
@@ -88,7 +88,7 @@ import {
88
88
  turnPromptText,
89
89
  valueRedactor,
90
90
  withProducerStream
91
- } from "../chunk-HP5KD7ZI.js";
91
+ } from "../chunk-S4QFJSLR.js";
92
92
  import "../chunk-SBHFMDR7.js";
93
93
  import "../chunk-H6BRJU5M.js";
94
94
  import "../chunk-4DBHC63F.js";
@@ -1,5 +1,6 @@
1
1
  export type ValueRedactor = <T>(value: T) => T;
2
- /** A redactor for these values, or undefined when none qualifies. Longest first, so a value that contains another wins. */
2
+ /** A redactor for these values, or undefined when none qualifies: object keys and string values alike. Longest first, so
3
+ * a value that contains another wins. */
3
4
  export declare function valueRedactor(values: readonly string[] | undefined): ValueRedactor | undefined;
4
5
  /** Every event of a stream, redacted. A value split across two text deltas is caught where the turn is stored, not live. */
5
6
  export declare function redactEvents<T>(source: AsyncIterable<T>, redact: ValueRedactor): AsyncGenerator<T>;
@@ -143,7 +143,7 @@ function valueRedactor(values) {
143
143
  const secrets = [...new Set((values ?? []).filter((v) => typeof v === "string" && v.length >= MIN_SECRET_LENGTH))].sort((a, b) => b.length - a.length);
144
144
  if (secrets.length === 0) return void 0;
145
145
  const text = (s) => secrets.some((v) => s.includes(v)) ? secrets.reduce((acc, v) => acc.split(v).join(REDACTED), s) : s;
146
- const walk = (v) => typeof v === "string" ? text(v) : Array.isArray(v) ? v.map(walk) : v !== null && typeof v === "object" ? Object.fromEntries(Object.entries(v).map(([k, x]) => [k, walk(x)])) : v;
146
+ const walk = (v) => typeof v === "string" ? text(v) : Array.isArray(v) ? v.map(walk) : v !== null && typeof v === "object" ? Object.fromEntries(Object.entries(v).map(([k, x]) => [text(k), walk(x)])) : v;
147
147
  return walk;
148
148
  }
149
149
  async function* redactEvents(source, redact) {
@@ -4220,4 +4220,4 @@ export {
4220
4220
  createChatTurnRoutes,
4221
4221
  streamChatRouteAsSandboxEvents
4222
4222
  };
4223
- //# sourceMappingURL=chunk-HP5KD7ZI.js.map
4223
+ //# sourceMappingURL=chunk-S4QFJSLR.js.map