ai 7.0.59 → 7.0.61

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.
@@ -92,7 +92,7 @@ import {
92
92
  } from "@ai-sdk/provider-utils";
93
93
 
94
94
  // src/version.ts
95
- var VERSION = true ? "7.0.59" : "0.0.0-test";
95
+ var VERSION = true ? "7.0.61" : "0.0.0-test";
96
96
 
97
97
  // src/util/download/download.ts
98
98
  var download = async ({
@@ -163,9 +163,9 @@ Here are the capabilities of popular models:
163
163
  | [Mistral](/providers/ai-sdk-providers/mistral) | `pixtral-12b-2409` | <Check /> | <Check /> | <Check /> | <Check /> |
164
164
  | [DeepSeek](/providers/ai-sdk-providers/deepseek) | `deepseek-chat` | <Cross /> | <Check /> | <Check /> | <Check /> |
165
165
  | [DeepSeek](/providers/ai-sdk-providers/deepseek) | `deepseek-reasoner` | <Cross /> | <Check /> | <Check /> | <Check /> |
166
- | [Cerebras](/providers/ai-sdk-providers/cerebras) | `llama3.1-8b` | <Cross /> | <Check /> | <Check /> | <Check /> |
167
- | [Cerebras](/providers/ai-sdk-providers/cerebras) | `llama3.1-70b` | <Cross /> | <Check /> | <Check /> | <Check /> |
168
- | [Cerebras](/providers/ai-sdk-providers/cerebras) | `llama3.3-70b` | <Cross /> | <Check /> | <Check /> | <Check /> |
166
+ | [Cerebras](/providers/ai-sdk-providers/cerebras) | `gpt-oss-120b` | <Cross /> | <Check /> | <Check /> | <Check /> |
167
+ | [Cerebras](/providers/ai-sdk-providers/cerebras) | `zai-glm-4.7` | <Cross /> | <Check /> | <Check /> | <Check /> |
168
+ | [Cerebras](/providers/ai-sdk-providers/cerebras) | `gemma-4-31b` | <Check /> | <Check /> | <Check /> | <Check /> |
169
169
  | [Groq](/providers/ai-sdk-providers/groq) | `meta-llama/llama-4-scout-17b-16e-instruct` | <Check /> | <Check /> | <Check /> | <Check /> |
170
170
  | [Groq](/providers/ai-sdk-providers/groq) | `llama-3.3-70b-versatile` | <Cross /> | <Check /> | <Check /> | <Check /> |
171
171
  | [Groq](/providers/ai-sdk-providers/groq) | `llama-3.1-8b-instant` | <Cross /> | <Check /> | <Check /> | <Check /> |
@@ -364,7 +364,8 @@ console.log(preparation.identity);
364
364
  - `harness`: the adapter instance.
365
365
  - `sandbox`: a `HarnessV1SandboxProvider`.
366
366
  - `id`: optional stable agent identifier.
367
- - `instructions`: instructions applied once to a fresh session.
367
+ - `instructions`: instructions appended to the runtime's system or developer
368
+ prompt when supported, or prepended to the first user prompt otherwise.
368
369
  - `stopWhen`: condition(s) for finishing a result slice after a completed
369
370
  harness tool step that can continue into another model step.
370
371
  - `tools`: AI SDK tools executed by the host when the harness calls them.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "7.0.59",
3
+ "version": "7.0.61",
4
4
  "type": "module",
5
5
  "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.",
6
6
  "license": "Apache-2.0",
@@ -42,9 +42,9 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "@ai-sdk/gateway": "4.0.47",
45
+ "@ai-sdk/gateway": "4.0.49",
46
46
  "@ai-sdk/provider": "4.0.7",
47
- "@ai-sdk/provider-utils": "5.0.26"
47
+ "@ai-sdk/provider-utils": "5.0.27"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@edge-runtime/vm": "^5.0.0",
@@ -307,7 +307,18 @@ export type ToolLoopAgentSettings<
307
307
  NoInfer<TOOLS>,
308
308
  NoInfer<RUNTIME_CONTEXT>
309
309
  >,
310
- 'onStepEnd' | 'onStepFinish'
310
+ | 'abortSignal'
311
+ | 'timeout'
312
+ | 'onStart'
313
+ | 'experimental_onStart'
314
+ | 'onStepStart'
315
+ | 'experimental_onStepStart'
316
+ | 'onToolExecutionStart'
317
+ | 'onToolExecutionEnd'
318
+ | 'onStepEnd'
319
+ | 'onStepFinish'
320
+ | 'onEnd'
321
+ | 'onFinish'
311
322
  > &
312
323
  Pick<
313
324
  ToolLoopAgentSettings<
@@ -318,6 +329,8 @@ export type ToolLoopAgentSettings<
318
329
  >,
319
330
  | 'model'
320
331
  | 'tools'
332
+ | 'toolChoice'
333
+ | 'maxRetries'
321
334
  | 'maxOutputTokens'
322
335
  | 'temperature'
323
336
  | 'topP'
@@ -337,6 +350,9 @@ export type ToolLoopAgentSettings<
337
350
  | 'toolOrder'
338
351
  | 'toolApproval'
339
352
  | 'experimental_toolCallers'
353
+ | 'prepareStep'
354
+ | 'repairToolCall'
355
+ | 'experimental_repairToolCall'
340
356
  | 'providerOptions'
341
357
  | 'experimental_download'
342
358
  | 'experimental_refineToolInput'
@@ -354,6 +370,8 @@ export type ToolLoopAgentSettings<
354
370
  >,
355
371
  | 'model'
356
372
  | 'tools'
373
+ | 'toolChoice'
374
+ | 'maxRetries'
357
375
  | 'maxOutputTokens'
358
376
  | 'temperature'
359
377
  | 'topP'
@@ -373,6 +391,9 @@ export type ToolLoopAgentSettings<
373
391
  | 'toolOrder'
374
392
  | 'toolApproval'
375
393
  | 'experimental_toolCallers'
394
+ | 'prepareStep'
395
+ | 'repairToolCall'
396
+ | 'experimental_repairToolCall'
376
397
  | 'providerOptions'
377
398
  | 'experimental_download'
378
399
  | 'experimental_refineToolInput'
package/src/ui/chat.ts CHANGED
@@ -257,6 +257,7 @@ export abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
257
257
  private onData?: ChatInit<UI_MESSAGE>['onData'];
258
258
  private sendAutomaticallyWhen?: ChatInit<UI_MESSAGE>['sendAutomaticallyWhen'];
259
259
 
260
+ private pendingMessagePreparations = new Set<AbortController>();
260
261
  private activeResponse: ActiveResponse<UI_MESSAGE> | undefined = undefined;
261
262
  private activeResumeRequest: ActiveResumeRequest | undefined = undefined;
262
263
  private jobExecutor = new SerialJobExecutor();
@@ -370,9 +371,21 @@ export abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
370
371
  let uiMessage: CreateUIMessage<UI_MESSAGE>;
371
372
 
372
373
  if ('text' in message || 'files' in message) {
373
- const fileParts = Array.isArray(message.files)
374
- ? message.files
375
- : await convertFileListToFileUIParts(message.files);
374
+ const abortController = new AbortController();
375
+ this.pendingMessagePreparations.add(abortController);
376
+
377
+ let fileParts: FileUIPart[];
378
+ try {
379
+ fileParts = Array.isArray(message.files)
380
+ ? message.files
381
+ : await convertFileListToFileUIParts(message.files);
382
+ } finally {
383
+ this.pendingMessagePreparations.delete(abortController);
384
+ }
385
+
386
+ if (abortController.signal.aborted) {
387
+ return;
388
+ }
376
389
 
377
390
  uiMessage = {
378
391
  parts: [
@@ -589,6 +602,9 @@ export abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
589
602
  * Abort the current request immediately, keep the generated tokens if any.
590
603
  */
591
604
  stop = async () => {
605
+ for (const controller of this.pendingMessagePreparations) {
606
+ controller.abort();
607
+ }
592
608
  this.activeResumeRequest?.abortController.abort();
593
609
  this.activeResponse?.abortController.abort();
594
610
  };
@@ -705,7 +721,7 @@ export abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
705
721
  const response = {
706
722
  state: createStreamingUIMessageState({
707
723
  lastMessage:
708
- trigger === 'regenerate-message'
724
+ trigger === 'resume-stream' || trigger === 'regenerate-message'
709
725
  ? undefined
710
726
  : this.state.snapshot(lastMessage),
711
727
  messageId: this.generateId(),