ai 6.0.326 → 6.0.328

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.328
4
+
5
+ ### Patch Changes
6
+
7
+ - 6b9a53a: Redact OpenAI MCP authorization and header values, and Code Interpreter and shell domain-secret values, from tool definitions recorded in generateText and streamText telemetry. Preserve the original application and provider arguments.
8
+ - Updated dependencies [88bb257]
9
+ - Updated dependencies [d1c2947]
10
+ - @ai-sdk/provider-utils@4.0.66
11
+ - @ai-sdk/gateway@3.0.234
12
+
13
+ ## 6.0.327
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [69e9ea1]
18
+ - Updated dependencies [94eba00]
19
+ - @ai-sdk/gateway@3.0.233
20
+
3
21
  ## 6.0.326
4
22
 
5
23
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1335,7 +1335,7 @@ function detectMediaType({
1335
1335
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
1336
1336
 
1337
1337
  // src/version.ts
1338
- var VERSION = true ? "6.0.326" : "0.0.0-test";
1338
+ var VERSION = true ? "6.0.328" : "0.0.0-test";
1339
1339
 
1340
1340
  // src/util/download/download.ts
1341
1341
  var download = async ({
@@ -2679,6 +2679,58 @@ function stringifyForTelemetry(prompt) {
2679
2679
  );
2680
2680
  }
2681
2681
 
2682
+ // src/telemetry/redact-tool-definition.ts
2683
+ function redactToolDefinition(tool2) {
2684
+ if (tool2.type !== "provider") {
2685
+ return tool2;
2686
+ }
2687
+ const args = tool2.args;
2688
+ if (!isRecord(args))
2689
+ return tool2;
2690
+ if (tool2.id === "openai.mcp") {
2691
+ return {
2692
+ ...tool2,
2693
+ args: {
2694
+ ...args,
2695
+ ...args.authorization != null ? { authorization: "[redacted]" } : {},
2696
+ ...isRecord(args.headers) ? {
2697
+ headers: Object.fromEntries(
2698
+ Object.keys(args.headers).map((name23) => [name23, "[redacted]"])
2699
+ )
2700
+ } : {}
2701
+ }
2702
+ };
2703
+ }
2704
+ const containerKey = tool2.id === "openai.code_interpreter" ? "container" : tool2.id === "openai.shell" ? "environment" : void 0;
2705
+ if (containerKey == null)
2706
+ return tool2;
2707
+ const container = args[containerKey];
2708
+ if (!isRecord(container))
2709
+ return tool2;
2710
+ const networkPolicy = container.networkPolicy;
2711
+ if (!isRecord(networkPolicy) || !Array.isArray(networkPolicy.domainSecrets)) {
2712
+ return tool2;
2713
+ }
2714
+ return {
2715
+ ...tool2,
2716
+ args: {
2717
+ ...args,
2718
+ [containerKey]: {
2719
+ ...container,
2720
+ networkPolicy: {
2721
+ ...networkPolicy,
2722
+ domainSecrets: networkPolicy.domainSecrets.map(
2723
+ (secret) => isRecord(secret) && "value" in secret ? { ...secret, value: "[redacted]" } : secret
2724
+ )
2725
+ }
2726
+ }
2727
+ }
2728
+ };
2729
+ }
2730
+ function isRecord(value) {
2731
+ return value != null && typeof value === "object" && !Array.isArray(value);
2732
+ }
2733
+
2682
2734
  // src/telemetry/telemetry-integration-registry.ts
2683
2735
  function registerTelemetryIntegration(integration) {
2684
2736
  if (!globalThis.AI_SDK_TELEMETRY_INTEGRATIONS) {
@@ -4956,7 +5008,9 @@ async function generateText({
4956
5008
  },
4957
5009
  "ai.prompt.tools": {
4958
5010
  // convert the language model level tools:
4959
- input: () => stepTools == null ? void 0 : stepTools.map((tool2) => JSON.stringify(tool2))
5011
+ input: () => stepTools == null ? void 0 : stepTools.map(
5012
+ (tool2) => JSON.stringify(redactToolDefinition(tool2))
5013
+ )
4960
5014
  },
4961
5015
  "ai.prompt.toolChoice": {
4962
5016
  input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : void 0
@@ -8440,7 +8494,9 @@ var DefaultStreamTextResult = class {
8440
8494
  },
8441
8495
  "ai.prompt.tools": {
8442
8496
  // convert the language model level tools:
8443
- input: () => stepTools == null ? void 0 : stepTools.map((tool2) => JSON.stringify(tool2))
8497
+ input: () => stepTools == null ? void 0 : stepTools.map(
8498
+ (tool2) => JSON.stringify(redactToolDefinition(tool2))
8499
+ )
8444
8500
  },
8445
8501
  "ai.prompt.toolChoice": {
8446
8502
  input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : void 0