@ai-sdk/provider-utils 5.0.40 → 5.0.42

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,24 @@
1
1
  # @ai-sdk/provider-utils
2
2
 
3
+ ## 5.0.42
4
+
5
+ ### Patch Changes
6
+
7
+ - 91c2128: feat(ai): add mid conversation tool discovery/updates for code-mode
8
+ - 2cd80b3: Keep default Node.js downloads protected by DNS validation and connection pinning when frameworks or instrumentation wrap global fetch before or after the SDK loads.
9
+ - 2fa5e0e: fix(provider-utils): avoid crashing when DOMException is not a global constructor
10
+ - Updated dependencies [d06bb2a]
11
+ - Updated dependencies [123d71f]
12
+ - @ai-sdk/provider@4.0.16
13
+
14
+ ## 5.0.41
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [5c0054d]
19
+ - Updated dependencies [39535af]
20
+ - @ai-sdk/provider@4.0.15
21
+
3
22
  ## 5.0.40
4
23
 
5
24
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -2766,6 +2766,14 @@ interface ToolCall<NAME extends string, INPUT> {
2766
2766
  type ToolCallerDefinition = {
2767
2767
  type: 'local';
2768
2768
  bind: (tools: ToolSet) => Tool;
2769
+ /**
2770
+ * Creates a provider-agnostic user message that describes the tools
2771
+ * available through this caller. When present, the unbound caller tool
2772
+ * remains model-visible so its definition stays stable, while the
2773
+ * returned message is added to the conversation when its content has
2774
+ * not already been announced.
2775
+ */
2776
+ prepareModelMessage?: (tools: ToolSet) => string | undefined;
2769
2777
  } | {
2770
2778
  type: 'provider';
2771
2779
  prepareProviderOptions: (providerOptions: ProviderOptions | undefined) => ProviderOptions;
package/dist/index.js CHANGED
@@ -438,7 +438,7 @@ import { APICallError } from "@ai-sdk/provider";
438
438
 
439
439
  // src/is-abort-error.ts
440
440
  function isAbortError(error) {
441
- return (error instanceof Error || error instanceof DOMException) && (error.name === "AbortError" || error.name === "ResponseAborted" || // Next.js
441
+ return (error instanceof Error || typeof DOMException === "function" && error instanceof DOMException) && (error.name === "AbortError" || error.name === "ResponseAborted" || // Next.js
442
442
  error.name === "TimeoutError");
443
443
  }
444
444
 
@@ -518,7 +518,7 @@ function handleFetchError({
518
518
  }
519
519
 
520
520
  // src/version.ts
521
- var VERSION = true ? "5.0.40" : "0.0.0-test";
521
+ var VERSION = true ? "5.0.42" : "0.0.0-test";
522
522
 
523
523
  // src/normalize-headers.ts
524
524
  function normalizeHeaders(headers) {
@@ -1167,26 +1167,17 @@ function createSafeLookup(lookup) {
1167
1167
  });
1168
1168
  }
1169
1169
  var safeNodeFetchPromise;
1170
- var initialGlobalFetch = globalThis.fetch;
1171
- var initialGlobalFetchIsNodeDefault = isNodeDefaultFetch(initialGlobalFetch);
1172
1170
  function isNodeRuntime() {
1173
- var _a3, _b3;
1171
+ var _a3, _b3, _c;
1174
1172
  const runtimeProcess = globalThis.process;
1175
- return ((_a3 = runtimeProcess == null ? void 0 : runtimeProcess.release) == null ? void 0 : _a3.name) === "node" && ((_b3 = runtimeProcess.versions) == null ? void 0 : _b3.bun) == null;
1173
+ return ((_a3 = runtimeProcess == null ? void 0 : runtimeProcess.release) == null ? void 0 : _a3.name) === "node" && ((_b3 = runtimeProcess.versions) == null ? void 0 : _b3.bun) == null && ((_c = runtimeProcess.versions) == null ? void 0 : _c.deno) == null && runtimeProcess.title !== "workerd" && globalThis.EdgeRuntime == null;
1176
1174
  }
1177
1175
  async function getDefaultDownloadFetch() {
1178
- if (!isNodeRuntime() || !initialGlobalFetchIsNodeDefault || globalThis.fetch !== initialGlobalFetch) {
1176
+ if (!isNodeRuntime()) {
1179
1177
  return globalThis.fetch;
1180
1178
  }
1181
1179
  return safeNodeFetchPromise != null ? safeNodeFetchPromise : safeNodeFetchPromise = Promise.resolve().then(createSafeNodeFetch);
1182
1180
  }
1183
- function isNodeDefaultFetch(fetch) {
1184
- if (typeof fetch !== "function") {
1185
- return false;
1186
- }
1187
- const source = Function.prototype.toString.call(fetch);
1188
- return source.includes("internal/deps/undici") || source.includes("lazy loading of undici");
1189
- }
1190
1181
  function createSafeNodeFetch() {
1191
1182
  const { createRequire } = loadBuiltinModule("node:module");
1192
1183
  const { lookup } = loadBuiltinModule("node:dns");