ai 6.0.325 → 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 +25 -0
- package/dist/index.js +59 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/02-foundations/02-providers-and-models.mdx +1 -0
- package/docs/03-ai-sdk-core/16-mcp-tools.mdx +18 -1
- package/package.json +5 -5
- package/src/generate-text/generate-text.ts +5 -1
- package/src/generate-text/stream-text.ts +5 -1
- package/src/telemetry/redact-tool-definition.ts +68 -0
package/dist/index.mjs
CHANGED
|
@@ -1225,7 +1225,7 @@ import {
|
|
|
1225
1225
|
} from "@ai-sdk/provider-utils";
|
|
1226
1226
|
|
|
1227
1227
|
// src/version.ts
|
|
1228
|
-
var VERSION = true ? "6.0.
|
|
1228
|
+
var VERSION = true ? "6.0.328" : "0.0.0-test";
|
|
1229
1229
|
|
|
1230
1230
|
// src/util/download/download.ts
|
|
1231
1231
|
var download = async ({
|
|
@@ -2579,6 +2579,58 @@ function stringifyForTelemetry(prompt) {
|
|
|
2579
2579
|
);
|
|
2580
2580
|
}
|
|
2581
2581
|
|
|
2582
|
+
// src/telemetry/redact-tool-definition.ts
|
|
2583
|
+
function redactToolDefinition(tool2) {
|
|
2584
|
+
if (tool2.type !== "provider") {
|
|
2585
|
+
return tool2;
|
|
2586
|
+
}
|
|
2587
|
+
const args = tool2.args;
|
|
2588
|
+
if (!isRecord(args))
|
|
2589
|
+
return tool2;
|
|
2590
|
+
if (tool2.id === "openai.mcp") {
|
|
2591
|
+
return {
|
|
2592
|
+
...tool2,
|
|
2593
|
+
args: {
|
|
2594
|
+
...args,
|
|
2595
|
+
...args.authorization != null ? { authorization: "[redacted]" } : {},
|
|
2596
|
+
...isRecord(args.headers) ? {
|
|
2597
|
+
headers: Object.fromEntries(
|
|
2598
|
+
Object.keys(args.headers).map((name23) => [name23, "[redacted]"])
|
|
2599
|
+
)
|
|
2600
|
+
} : {}
|
|
2601
|
+
}
|
|
2602
|
+
};
|
|
2603
|
+
}
|
|
2604
|
+
const containerKey = tool2.id === "openai.code_interpreter" ? "container" : tool2.id === "openai.shell" ? "environment" : void 0;
|
|
2605
|
+
if (containerKey == null)
|
|
2606
|
+
return tool2;
|
|
2607
|
+
const container = args[containerKey];
|
|
2608
|
+
if (!isRecord(container))
|
|
2609
|
+
return tool2;
|
|
2610
|
+
const networkPolicy = container.networkPolicy;
|
|
2611
|
+
if (!isRecord(networkPolicy) || !Array.isArray(networkPolicy.domainSecrets)) {
|
|
2612
|
+
return tool2;
|
|
2613
|
+
}
|
|
2614
|
+
return {
|
|
2615
|
+
...tool2,
|
|
2616
|
+
args: {
|
|
2617
|
+
...args,
|
|
2618
|
+
[containerKey]: {
|
|
2619
|
+
...container,
|
|
2620
|
+
networkPolicy: {
|
|
2621
|
+
...networkPolicy,
|
|
2622
|
+
domainSecrets: networkPolicy.domainSecrets.map(
|
|
2623
|
+
(secret) => isRecord(secret) && "value" in secret ? { ...secret, value: "[redacted]" } : secret
|
|
2624
|
+
)
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
};
|
|
2629
|
+
}
|
|
2630
|
+
function isRecord(value) {
|
|
2631
|
+
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2582
2634
|
// src/telemetry/telemetry-integration-registry.ts
|
|
2583
2635
|
function registerTelemetryIntegration(integration) {
|
|
2584
2636
|
if (!globalThis.AI_SDK_TELEMETRY_INTEGRATIONS) {
|
|
@@ -4878,7 +4930,9 @@ async function generateText({
|
|
|
4878
4930
|
},
|
|
4879
4931
|
"ai.prompt.tools": {
|
|
4880
4932
|
// convert the language model level tools:
|
|
4881
|
-
input: () => stepTools == null ? void 0 : stepTools.map(
|
|
4933
|
+
input: () => stepTools == null ? void 0 : stepTools.map(
|
|
4934
|
+
(tool2) => JSON.stringify(redactToolDefinition(tool2))
|
|
4935
|
+
)
|
|
4882
4936
|
},
|
|
4883
4937
|
"ai.prompt.toolChoice": {
|
|
4884
4938
|
input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : void 0
|
|
@@ -8371,7 +8425,9 @@ var DefaultStreamTextResult = class {
|
|
|
8371
8425
|
},
|
|
8372
8426
|
"ai.prompt.tools": {
|
|
8373
8427
|
// convert the language model level tools:
|
|
8374
|
-
input: () => stepTools == null ? void 0 : stepTools.map(
|
|
8428
|
+
input: () => stepTools == null ? void 0 : stepTools.map(
|
|
8429
|
+
(tool2) => JSON.stringify(redactToolDefinition(tool2))
|
|
8430
|
+
)
|
|
8375
8431
|
},
|
|
8376
8432
|
"ai.prompt.toolChoice": {
|
|
8377
8433
|
input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : void 0
|