ai 7.0.128 → 7.0.130
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 +46 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +173 -39
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +10 -2
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +68 -16
- package/dist/internal/index.js.map +1 -1
- package/docs/02-foundations/06-provider-options.mdx +11 -10
- package/docs/03-agents/02-building-agents.mdx +16 -11
- package/docs/03-agents/07-workflow-agent.mdx +3 -3
- package/docs/03-ai-sdk-core/17-runtime-and-tool-context.mdx +18 -14
- package/docs/03-ai-sdk-core/25-settings.mdx +3 -2
- package/docs/03-ai-sdk-core/26-reasoning.mdx +12 -5
- package/docs/03-ai-sdk-core/32-decisions.mdx +20 -20
- package/docs/03-ai-sdk-core/35-image-generation.mdx +2 -0
- package/docs/04-ai-sdk-ui/21-error-handling.mdx +28 -3
- package/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +2 -2
- package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +3 -3
- package/docs/07-reference/01-ai-sdk-core/14-decide.mdx +2 -1
- package/docs/07-reference/05-ai-sdk-errors/ai-decision-refusal-error.mdx +33 -0
- package/package.json +15 -15
- package/src/decide/decide.ts +11 -0
- package/src/decide/validate-decision.ts +1 -0
- package/src/error/index.ts +1 -0
- package/src/generate-object/generate-object.ts +10 -0
- package/src/generate-object/stream-object.ts +10 -0
- package/src/generate-speech/index.ts +13 -1
- package/src/generate-text/generate-text.ts +3 -1
- package/src/generate-text/stream-text.ts +22 -5
- package/src/generate-text/tool-approval-signature.ts +7 -4
- package/src/global.ts +2 -1
- package/src/logger/deprecations.ts +72 -0
- package/src/logger/log-warnings.ts +25 -3
- package/src/model/as-language-model-v3.ts +4 -0
- package/src/prompt/convert-to-language-model-prompt.ts +7 -1
- package/src/realtime/encode-realtime-frame.ts +7 -2
- package/src/transcribe/index.ts +13 -1
- package/src/types/index.ts +1 -0
- package/src/types/language-model.ts +9 -1
- package/src/types/usage.ts +21 -0
- package/src/ui/chat.ts +16 -8
- package/src/ui/convert-to-model-messages.ts +40 -8
- package/src/ui/http-chat-transport.ts +5 -3
- package/src/ui/process-text-stream.ts +5 -1
- package/src/ui/text-stream-chat-transport.ts +3 -1
- package/src/ui/ui-messages.ts +8 -0
- package/src/ui/unavailable-tool.ts +17 -0
- package/src/ui/validate-ui-messages.ts +10 -2
|
@@ -22,6 +22,7 @@ import type {
|
|
|
22
22
|
ToolUIPart,
|
|
23
23
|
UIMessage,
|
|
24
24
|
} from './ui-messages';
|
|
25
|
+
import { markToolPartAsUnavailable } from './unavailable-tool';
|
|
25
26
|
import { warnIfUIMessageHasDeprecatedRawInput } from './warn-if-ui-message-has-deprecated-raw-input';
|
|
26
27
|
|
|
27
28
|
const toolMetadataSchema: ZodType<JSONObject> = z.record(
|
|
@@ -43,11 +44,11 @@ function isEmptyObject(value: unknown): value is Record<string, never> {
|
|
|
43
44
|
function asDynamicToolPart(toolPart: ToolUIPart): DynamicToolUIPart {
|
|
44
45
|
const { type, ...part } = toolPart;
|
|
45
46
|
|
|
46
|
-
return {
|
|
47
|
+
return markToolPartAsUnavailable({
|
|
47
48
|
...part,
|
|
48
49
|
type: 'dynamic-tool',
|
|
49
50
|
toolName: type.slice(5),
|
|
50
|
-
} as DynamicToolUIPart;
|
|
51
|
+
} as DynamicToolUIPart);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
function getToolPartInputSchemaInput(
|
|
@@ -148,6 +149,7 @@ const uiMessagesSchema = lazySchema(() => {
|
|
|
148
149
|
}),
|
|
149
150
|
z.object({
|
|
150
151
|
type: z.literal('dynamic-tool'),
|
|
152
|
+
dynamic: z.literal(false).optional(),
|
|
151
153
|
toolName: z.string(),
|
|
152
154
|
toolCallId: z.string(),
|
|
153
155
|
title: z.string().optional(),
|
|
@@ -163,6 +165,7 @@ const uiMessagesSchema = lazySchema(() => {
|
|
|
163
165
|
}),
|
|
164
166
|
z.object({
|
|
165
167
|
type: z.literal('dynamic-tool'),
|
|
168
|
+
dynamic: z.literal(false).optional(),
|
|
166
169
|
toolName: z.string(),
|
|
167
170
|
toolCallId: z.string(),
|
|
168
171
|
title: z.string().optional(),
|
|
@@ -177,6 +180,7 @@ const uiMessagesSchema = lazySchema(() => {
|
|
|
177
180
|
}),
|
|
178
181
|
z.object({
|
|
179
182
|
type: z.literal('dynamic-tool'),
|
|
183
|
+
dynamic: z.literal(false).optional(),
|
|
180
184
|
toolName: z.string(),
|
|
181
185
|
toolCallId: z.string(),
|
|
182
186
|
title: z.string().optional(),
|
|
@@ -191,6 +195,7 @@ const uiMessagesSchema = lazySchema(() => {
|
|
|
191
195
|
}),
|
|
192
196
|
z.object({
|
|
193
197
|
type: z.literal('dynamic-tool'),
|
|
198
|
+
dynamic: z.literal(false).optional(),
|
|
194
199
|
toolName: z.string(),
|
|
195
200
|
toolCallId: z.string(),
|
|
196
201
|
title: z.string().optional(),
|
|
@@ -205,6 +210,7 @@ const uiMessagesSchema = lazySchema(() => {
|
|
|
205
210
|
}),
|
|
206
211
|
z.object({
|
|
207
212
|
type: z.literal('dynamic-tool'),
|
|
213
|
+
dynamic: z.literal(false).optional(),
|
|
208
214
|
toolName: z.string(),
|
|
209
215
|
toolCallId: z.string(),
|
|
210
216
|
title: z.string().optional(),
|
|
@@ -221,6 +227,7 @@ const uiMessagesSchema = lazySchema(() => {
|
|
|
221
227
|
}),
|
|
222
228
|
z.object({
|
|
223
229
|
type: z.literal('dynamic-tool'),
|
|
230
|
+
dynamic: z.literal(false).optional(),
|
|
224
231
|
toolName: z.string(),
|
|
225
232
|
toolCallId: z.string(),
|
|
226
233
|
title: z.string().optional(),
|
|
@@ -237,6 +244,7 @@ const uiMessagesSchema = lazySchema(() => {
|
|
|
237
244
|
}),
|
|
238
245
|
z.object({
|
|
239
246
|
type: z.literal('dynamic-tool'),
|
|
247
|
+
dynamic: z.literal(false).optional(),
|
|
240
248
|
toolName: z.string(),
|
|
241
249
|
toolCallId: z.string(),
|
|
242
250
|
title: z.string().optional(),
|