ai 6.0.229 → 6.0.230

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.
@@ -152,7 +152,7 @@ function detectMediaType({
152
152
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
153
153
 
154
154
  // src/version.ts
155
- var VERSION = true ? "6.0.229" : "0.0.0-test";
155
+ var VERSION = true ? "6.0.230" : "0.0.0-test";
156
156
 
157
157
  // src/util/download/download.ts
158
158
  var download = async ({
@@ -132,7 +132,7 @@ import {
132
132
  } from "@ai-sdk/provider-utils";
133
133
 
134
134
  // src/version.ts
135
- var VERSION = true ? "6.0.229" : "0.0.0-test";
135
+ var VERSION = true ? "6.0.230" : "0.0.0-test";
136
136
 
137
137
  // src/util/download/download.ts
138
138
  var download = async ({
@@ -723,7 +723,7 @@ The following tool input lifecycle hooks are available:
723
723
  - **`onInputDelta`**: Called for each chunk of text as the input is streamed
724
724
  - **`onInputAvailable`**: Called when the complete input is available and validated
725
725
 
726
- `onInputStart` and `onInputDelta` are only called in streaming contexts (when using `streamText`). They are not called when using `generateText`.
726
+ `onInputStart` is always called before `onInputAvailable`, including when using `generateText`. `onInputDelta` is only called in streaming contexts (when using `streamText`).
727
727
 
728
728
  ### Example
729
729
 
@@ -146,7 +146,7 @@ export const weatherTool = tool({
146
146
  isOptional: true,
147
147
  type: '(options: ToolExecutionOptions) => void | PromiseLike<void>',
148
148
  description:
149
- 'Optional function that is called when the argument streaming starts. Only called when the tool is used in a streaming context.',
149
+ 'Optional function that is called when the model starts generating the tool input. In non-streaming contexts, it is called immediately before onInputAvailable.',
150
150
  },
151
151
  {
152
152
  name: 'onInputDelta',
@@ -131,7 +131,7 @@ export const customTool = dynamicTool({
131
131
  isOptional: true,
132
132
  type: '(options: ToolExecutionOptions) => void | PromiseLike<void>',
133
133
  description:
134
- 'Optional function that is called when the argument streaming starts. Only called when the tool is used in a streaming context.'
134
+ 'Optional function that is called when the model starts generating the tool input. In non-streaming contexts, it is called immediately before onInputAvailable.'
135
135
  },
136
136
  {
137
137
  name: 'onInputDelta',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "6.0.229",
3
+ "version": "6.0.230",
4
4
  "description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -45,9 +45,9 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@opentelemetry/api": "^1.9.0",
48
- "@ai-sdk/gateway": "3.0.152",
48
+ "@ai-sdk/gateway": "3.0.153",
49
49
  "@ai-sdk/provider": "3.0.14",
50
- "@ai-sdk/provider-utils": "4.0.39"
50
+ "@ai-sdk/provider-utils": "4.0.40"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@edge-runtime/vm": "^5.0.0",
@@ -942,7 +942,16 @@ export async function generateText<
942
942
  continue;
943
943
  }
944
944
 
945
- if (tool?.onInputAvailable != null) {
945
+ if (tool.onInputStart != null) {
946
+ await tool.onInputStart({
947
+ toolCallId: toolCall.toolCallId,
948
+ messages: stepInputMessages,
949
+ abortSignal: mergedAbortSignal,
950
+ experimental_context,
951
+ });
952
+ }
953
+
954
+ if (tool.onInputAvailable != null) {
946
955
  await tool.onInputAvailable({
947
956
  input: toolCall.input,
948
957
  toolCallId: toolCall.toolCallId,