@prestyj/agent 5.25.1 → 5.27.0

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.js CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  stream,
8
8
  EventStream,
9
9
  EZCoderAIError,
10
+ environmentSecrets,
10
11
  isHardBillingMessage,
11
12
  redactValue,
12
13
  sliceHead,
@@ -92,6 +93,11 @@ function clampOutputTokens(key, requested) {
92
93
  // src/agent-loop.ts
93
94
  var DEFAULT_MAX_TURNS = 300;
94
95
  var DEFAULT_TOOL_TIMEOUT_MS = 3e5;
96
+ var _toolRedaction;
97
+ function toolRedactionOptions() {
98
+ _toolRedaction ??= { secrets: environmentSecrets(process.env) };
99
+ return _toolRedaction;
100
+ }
95
101
  var _diagFn = null;
96
102
  function setStreamDiagnostic(fn) {
97
103
  _diagFn = fn;
@@ -1414,8 +1420,8 @@ async function executeSingleToolCall(toolCall, options, pushEvent) {
1414
1420
  ctx.signal
1415
1421
  );
1416
1422
  const normalized = normalizeToolResult(raw);
1417
- resultContent = redactValue(normalized.content);
1418
- details = redactValue(normalized.details);
1423
+ resultContent = redactValue(normalized.content, toolRedactionOptions());
1424
+ details = redactValue(normalized.details, toolRedactionOptions());
1419
1425
  for (const key of options.invalidToolArgumentCounts.keys()) {
1420
1426
  if (key.startsWith(`${toolCall.name}:`)) options.invalidToolArgumentCounts.delete(key);
1421
1427
  }
@@ -1446,12 +1452,15 @@ async function executeSingleToolCall(toolCall, options, pushEvent) {
1446
1452
  } else if (options.signal?.aborted && isAbortError(err)) {
1447
1453
  resultContent = indeterminateOutcomeText(toolCall.name);
1448
1454
  } else {
1449
- resultContent = redactValue(err instanceof Error ? err.message : String(err));
1455
+ resultContent = redactValue(
1456
+ err instanceof Error ? err.message : String(err),
1457
+ toolRedactionOptions()
1458
+ );
1450
1459
  }
1451
1460
  }
1452
1461
  }
1453
- resultContent = redactValue(resultContent);
1454
- details = redactValue(details);
1462
+ resultContent = redactValue(resultContent, toolRedactionOptions());
1463
+ details = redactValue(details, toolRedactionOptions());
1455
1464
  const durationMs = Date.now() - startTime;
1456
1465
  pushEvent({
1457
1466
  type: "tool_call_end",