ai 6.0.208 → 6.0.210
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 +18 -0
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/02-getting-started/02-nextjs-app-router.mdx +2 -2
- package/docs/02-getting-started/03-nextjs-pages-router.mdx +2 -2
- package/docs/02-getting-started/04-svelte.mdx +4 -4
- package/docs/02-getting-started/05-nuxt.mdx +5 -5
- package/docs/02-getting-started/06-nodejs.mdx +3 -3
- package/docs/02-getting-started/07-expo.mdx +4 -4
- package/docs/02-getting-started/08-tanstack-start.mdx +4 -4
- package/docs/04-ai-sdk-ui/02-chatbot.mdx +3 -3
- package/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +1 -1
- package/docs/04-ai-sdk-ui/21-error-handling.mdx +2 -2
- package/docs/04-ai-sdk-ui/25-message-metadata.mdx +2 -2
- package/docs/06-advanced/02-stopping-streams.mdx +3 -3
- package/package.json +5 -5
- package/src/telemetry/sanitize-attribute-value.ts +39 -0
- package/src/telemetry/select-telemetry-attributes.ts +7 -3
package/dist/index.mjs
CHANGED
|
@@ -1171,7 +1171,7 @@ import {
|
|
|
1171
1171
|
} from "@ai-sdk/provider-utils";
|
|
1172
1172
|
|
|
1173
1173
|
// src/version.ts
|
|
1174
|
-
var VERSION = true ? "6.0.
|
|
1174
|
+
var VERSION = true ? "6.0.210" : "0.0.0-test";
|
|
1175
1175
|
|
|
1176
1176
|
// src/util/download/download.ts
|
|
1177
1177
|
var download = async ({
|
|
@@ -2403,6 +2403,30 @@ function recordErrorOnSpan(span, error) {
|
|
|
2403
2403
|
}
|
|
2404
2404
|
}
|
|
2405
2405
|
|
|
2406
|
+
// src/telemetry/sanitize-attribute-value.ts
|
|
2407
|
+
function isPrimitiveAttributeValue(value) {
|
|
2408
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
2409
|
+
}
|
|
2410
|
+
function sanitizeAttributeValue(value) {
|
|
2411
|
+
if (!Array.isArray(value)) {
|
|
2412
|
+
return value;
|
|
2413
|
+
}
|
|
2414
|
+
const primitiveTypes = new Set(
|
|
2415
|
+
value.filter(isPrimitiveAttributeValue).map((item) => typeof item)
|
|
2416
|
+
);
|
|
2417
|
+
if (primitiveTypes.size !== 1) {
|
|
2418
|
+
return void 0;
|
|
2419
|
+
}
|
|
2420
|
+
const [primitiveType] = primitiveTypes;
|
|
2421
|
+
if (primitiveType === "string") {
|
|
2422
|
+
return value.filter((item) => typeof item === "string");
|
|
2423
|
+
}
|
|
2424
|
+
if (primitiveType === "number") {
|
|
2425
|
+
return value.filter((item) => typeof item === "number");
|
|
2426
|
+
}
|
|
2427
|
+
return value.filter((item) => typeof item === "boolean");
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2406
2430
|
// src/telemetry/select-telemetry-attributes.ts
|
|
2407
2431
|
async function selectTelemetryAttributes({
|
|
2408
2432
|
telemetry,
|
|
@@ -2422,7 +2446,9 @@ async function selectTelemetryAttributes({
|
|
|
2422
2446
|
}
|
|
2423
2447
|
const result = await value.input();
|
|
2424
2448
|
if (result != null) {
|
|
2425
|
-
|
|
2449
|
+
const sanitized2 = sanitizeAttributeValue(result);
|
|
2450
|
+
if (sanitized2 != null)
|
|
2451
|
+
resultAttributes[key] = sanitized2;
|
|
2426
2452
|
}
|
|
2427
2453
|
continue;
|
|
2428
2454
|
}
|
|
@@ -2432,11 +2458,15 @@ async function selectTelemetryAttributes({
|
|
|
2432
2458
|
}
|
|
2433
2459
|
const result = await value.output();
|
|
2434
2460
|
if (result != null) {
|
|
2435
|
-
|
|
2461
|
+
const sanitized2 = sanitizeAttributeValue(result);
|
|
2462
|
+
if (sanitized2 != null)
|
|
2463
|
+
resultAttributes[key] = sanitized2;
|
|
2436
2464
|
}
|
|
2437
2465
|
continue;
|
|
2438
2466
|
}
|
|
2439
|
-
|
|
2467
|
+
const sanitized = sanitizeAttributeValue(value);
|
|
2468
|
+
if (sanitized != null)
|
|
2469
|
+
resultAttributes[key] = sanitized;
|
|
2440
2470
|
}
|
|
2441
2471
|
return resultAttributes;
|
|
2442
2472
|
}
|