@ai-sdk/provider-utils 5.0.50 → 5.0.51

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.50",
3
+ "version": "5.0.51",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -36,7 +36,7 @@ export const deleteFromApi = async <T>({
36
36
  method: 'DELETE',
37
37
  headers: withUserAgentSuffix(
38
38
  headers,
39
- `ai-sdk/provider-utils/${VERSION}`,
39
+ `ai-sdk-provider-utils/${VERSION}`,
40
40
  getRuntimeEnvironmentUserAgent(),
41
41
  ),
42
42
  signal: abortSignal,
@@ -76,7 +76,7 @@ export const getFromApi = async <T>({
76
76
 
77
77
  const requestHeaders = withUserAgentSuffix(
78
78
  outgoingHeaders,
79
- `ai-sdk/provider-utils/${VERSION}`,
79
+ `ai-sdk-provider-utils/${VERSION}`,
80
80
  getRuntimeEnvironmentUserAgent(),
81
81
  );
82
82
 
@@ -1,24 +1,19 @@
1
1
  export function getRuntimeEnvironmentUserAgent(
2
2
  globalThisAny: any = globalThis as any,
3
3
  ): string {
4
- // Browsers
5
- if (globalThisAny.window) {
6
- return `runtime/browser`;
7
- }
8
-
9
- // Cloudflare Workers / Deno / Bun / Node.js >= 21.1
4
+ // Browsers / Cloudflare Workers / Deno / Bun / Node.js >= 21.1
10
5
  if (globalThisAny.navigator?.userAgent) {
11
- return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
6
+ return globalThisAny.navigator.userAgent.toLowerCase();
12
7
  }
13
8
 
14
- // Nodes.js < 21.1
9
+ // Node.js < 21.1
15
10
  if (globalThisAny.process?.versions?.node) {
16
- return `runtime/node.js/${globalThisAny.process.version.substring(0)}`;
11
+ return `node.js/${globalThisAny.process.version}`;
17
12
  }
18
13
 
19
14
  if (globalThisAny.EdgeRuntime) {
20
- return `runtime/vercel-edge`;
15
+ return 'vercel-edge';
21
16
  }
22
17
 
23
- return 'runtime/unknown';
18
+ return '';
24
19
  }
@@ -195,7 +195,7 @@ export const postMultipartStreamToApi = async <T>({
195
195
  ...headers,
196
196
  'Content-Type': `multipart/form-data; boundary=${boundary}`,
197
197
  },
198
- `ai-sdk/provider-utils/${VERSION}`,
198
+ `ai-sdk-provider-utils/${VERSION}`,
199
199
  getRuntimeEnvironmentUserAgent(),
200
200
  ),
201
201
  body: body.stream,
@@ -99,7 +99,7 @@ export const postToApi = async <T>({
99
99
  method: 'POST',
100
100
  headers: withUserAgentSuffix(
101
101
  headers,
102
- `ai-sdk/provider-utils/${VERSION}`,
102
+ `ai-sdk-provider-utils/${VERSION}`,
103
103
  getRuntimeEnvironmentUserAgent(),
104
104
  ),
105
105
  body: body.content,