@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.cjs CHANGED
@@ -120,6 +120,11 @@ function clampOutputTokens(key, requested) {
120
120
  // src/agent-loop.ts
121
121
  var DEFAULT_MAX_TURNS = 300;
122
122
  var DEFAULT_TOOL_TIMEOUT_MS = 3e5;
123
+ var _toolRedaction;
124
+ function toolRedactionOptions() {
125
+ _toolRedaction ??= { secrets: (0, import_ai.environmentSecrets)(process.env) };
126
+ return _toolRedaction;
127
+ }
123
128
  var _diagFn = null;
124
129
  function setStreamDiagnostic(fn) {
125
130
  _diagFn = fn;
@@ -1442,8 +1447,8 @@ async function executeSingleToolCall(toolCall, options, pushEvent) {
1442
1447
  ctx.signal
1443
1448
  );
1444
1449
  const normalized = normalizeToolResult(raw);
1445
- resultContent = (0, import_ai.redactValue)(normalized.content);
1446
- details = (0, import_ai.redactValue)(normalized.details);
1450
+ resultContent = (0, import_ai.redactValue)(normalized.content, toolRedactionOptions());
1451
+ details = (0, import_ai.redactValue)(normalized.details, toolRedactionOptions());
1447
1452
  for (const key of options.invalidToolArgumentCounts.keys()) {
1448
1453
  if (key.startsWith(`${toolCall.name}:`)) options.invalidToolArgumentCounts.delete(key);
1449
1454
  }
@@ -1474,12 +1479,15 @@ async function executeSingleToolCall(toolCall, options, pushEvent) {
1474
1479
  } else if (options.signal?.aborted && isAbortError(err)) {
1475
1480
  resultContent = indeterminateOutcomeText(toolCall.name);
1476
1481
  } else {
1477
- resultContent = (0, import_ai.redactValue)(err instanceof Error ? err.message : String(err));
1482
+ resultContent = (0, import_ai.redactValue)(
1483
+ err instanceof Error ? err.message : String(err),
1484
+ toolRedactionOptions()
1485
+ );
1478
1486
  }
1479
1487
  }
1480
1488
  }
1481
- resultContent = (0, import_ai.redactValue)(resultContent);
1482
- details = (0, import_ai.redactValue)(details);
1489
+ resultContent = (0, import_ai.redactValue)(resultContent, toolRedactionOptions());
1490
+ details = (0, import_ai.redactValue)(details, toolRedactionOptions());
1483
1491
  const durationMs = Date.now() - startTime;
1484
1492
  pushEvent({
1485
1493
  type: "tool_call_end",