@ai-sdk/provider-utils 3.1.0-beta.8 → 4.0.0-beta.10

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,22 @@
1
1
  # @ai-sdk/provider-utils
2
2
 
3
+ ## 4.0.0-beta.10
4
+
5
+ ### Major Changes
6
+
7
+ - dee8b05: ai SDK 6 beta
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [dee8b05]
12
+ - @ai-sdk/provider@3.0.0-beta.6
13
+
14
+ ## 3.1.0-beta.9
15
+
16
+ ### Patch Changes
17
+
18
+ - 521c537: feat(ai): Tool.needsApproval can be a function
19
+
3
20
  ## 3.1.0-beta.8
4
21
 
5
22
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -698,7 +698,23 @@ type Tool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONVa
698
698
  /**
699
699
  Whether the tool needs approval before it can be executed.
700
700
  */
701
- needsApproval?: boolean;
701
+ needsApproval?: boolean | ((input: [INPUT] extends [never] ? unknown : INPUT, options: {
702
+ /**
703
+ * The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
704
+ */
705
+ toolCallId: string;
706
+ /**
707
+ * Messages that were sent to the language model to initiate the response that contained the tool call.
708
+ * The messages **do not** include the system prompt nor the assistant response that contained the tool call.
709
+ */
710
+ messages: ModelMessage[];
711
+ /**
712
+ * Additional context.
713
+ *
714
+ * Experimental (can break in patch releases).
715
+ */
716
+ experimental_context?: unknown;
717
+ }) => boolean | PromiseLike<boolean>);
702
718
  /**
703
719
  * Optional function that is called when the argument streaming starts.
704
720
  * Only called when the tool is used in a streaming context.
@@ -716,7 +732,7 @@ type Tool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONVa
716
732
  * even if the execute function is not provided.
717
733
  */
718
734
  onInputAvailable?: (options: {
719
- input: [INPUT] extends [never] ? undefined : INPUT;
735
+ input: [INPUT] extends [never] ? unknown : INPUT;
720
736
  } & ToolCallOptions) => void | PromiseLike<void>;
721
737
  } & ToolOutputProperties<INPUT, OUTPUT> & {
722
738
  /**
package/dist/index.d.ts CHANGED
@@ -698,7 +698,23 @@ type Tool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONVa
698
698
  /**
699
699
  Whether the tool needs approval before it can be executed.
700
700
  */
701
- needsApproval?: boolean;
701
+ needsApproval?: boolean | ((input: [INPUT] extends [never] ? unknown : INPUT, options: {
702
+ /**
703
+ * The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
704
+ */
705
+ toolCallId: string;
706
+ /**
707
+ * Messages that were sent to the language model to initiate the response that contained the tool call.
708
+ * The messages **do not** include the system prompt nor the assistant response that contained the tool call.
709
+ */
710
+ messages: ModelMessage[];
711
+ /**
712
+ * Additional context.
713
+ *
714
+ * Experimental (can break in patch releases).
715
+ */
716
+ experimental_context?: unknown;
717
+ }) => boolean | PromiseLike<boolean>);
702
718
  /**
703
719
  * Optional function that is called when the argument streaming starts.
704
720
  * Only called when the tool is used in a streaming context.
@@ -716,7 +732,7 @@ type Tool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONVa
716
732
  * even if the execute function is not provided.
717
733
  */
718
734
  onInputAvailable?: (options: {
719
- input: [INPUT] extends [never] ? undefined : INPUT;
735
+ input: [INPUT] extends [never] ? unknown : INPUT;
720
736
  } & ToolCallOptions) => void | PromiseLike<void>;
721
737
  } & ToolOutputProperties<INPUT, OUTPUT> & {
722
738
  /**
package/dist/index.js CHANGED
@@ -284,7 +284,7 @@ function handleFetchError({
284
284
  }
285
285
 
286
286
  // src/version.ts
287
- var VERSION = true ? "3.1.0-beta.8" : "0.0.0-test";
287
+ var VERSION = true ? "4.0.0-beta.10" : "0.0.0-test";
288
288
 
289
289
  // src/get-from-api.ts
290
290
  var getOriginalFetch = () => globalThis.fetch;