@ai-sdk/provider-utils 5.0.63 → 5.0.65

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/provider-utils",
3
- "version": "5.0.63",
3
+ "version": "5.0.65",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -42,7 +42,7 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "@ai-sdk/provider": "4.0.30",
45
+ "@ai-sdk/provider": "4.0.31",
46
46
  "@standard-schema/spec": "^1.1.0",
47
47
  "@workflow/serde": "4.1.0",
48
48
  "eventsource-parser": "^3.0.8",
@@ -51,6 +51,7 @@
51
51
  "devDependencies": {
52
52
  "@types/node": "22.19.19",
53
53
  "@vercel/ai-tsconfig": "0.0.0",
54
+ "@vercel/ai-tsdown-config": "0.0.0",
54
55
  "msw": "2.7.0",
55
56
  "tsdown": "^0.23.0",
56
57
  "typescript": "6.0.3",
@@ -62,6 +62,8 @@ export class DecisionLanguageModel implements DecisionModelV4 {
62
62
  async doDecide({
63
63
  state,
64
64
  questions,
65
+ maxOutputTokens,
66
+ reasoning,
65
67
  abortSignal,
66
68
  headers,
67
69
  providerOptions,
@@ -148,7 +150,8 @@ export class DecisionLanguageModel implements DecisionModelV4 {
148
150
  ]),
149
151
  );
150
152
  const result = await this.model.doGenerate({
151
- reasoning: 'none',
153
+ reasoning: reasoning ?? 'none',
154
+ maxOutputTokens,
152
155
  prompt: [
153
156
  {
154
157
  role: 'system',
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Encodes a raw identifier as one URL path segment, including standalone dot
3
+ * segments that URL parsers would otherwise normalize. Pass unencoded values;
4
+ * for resource paths with intentional slashes, encode each segment separately.
5
+ */
6
+ export function encodePathSegment(value: string): string {
7
+ const encodedValue = encodeURIComponent(value);
8
+
9
+ // URL parsing normalizes both literal and percent-encoded dot segments.
10
+ return encodedValue === '.'
11
+ ? '%252E'
12
+ : encodedValue === '..'
13
+ ? '%252E%252E'
14
+ : encodedValue;
15
+ }
package/src/index.ts CHANGED
@@ -40,6 +40,7 @@ export {
40
40
  fetchWithValidatedEndpoint,
41
41
  fetchWithValidatedRedirects,
42
42
  } from './fetch-with-validated-redirects';
43
+ export { encodePathSegment } from './encode-path-segment';
43
44
  export { extractLines } from './extract-lines';
44
45
  export * from './extract-response-headers';
45
46
  export * from './fetch-function';
@@ -79,7 +79,14 @@ export async function readResponseWithSizeLimit({
79
79
  });
80
80
  }
81
81
 
82
- chunks.push(value);
82
+ // A small chunk can keep a much larger backing buffer alive. Copy such
83
+ // views before retaining them. Unlike Uint8Array, Node Buffer's slice()
84
+ // returns another view, so use the Uint8Array constructor to copy.
85
+ chunks.push(
86
+ value.byteLength < value.buffer.byteLength
87
+ ? new Uint8Array(value)
88
+ : value,
89
+ );
83
90
  }
84
91
  } finally {
85
92
  try {
@@ -46,11 +46,12 @@ export function validateDownloadUrl(url: string): void {
46
46
  });
47
47
  }
48
48
 
49
- // Block localhost and .local domains
49
+ // Block localhost and domains reserved for local/private use.
50
50
  if (
51
51
  hostname === 'localhost' ||
52
52
  hostname.endsWith('.local') ||
53
- hostname.endsWith('.localhost')
53
+ hostname.endsWith('.localhost') ||
54
+ hostname.endsWith('.internal')
54
55
  ) {
55
56
  throw new DownloadError({
56
57
  url,