ai 6.0.250 → 6.0.253

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,29 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.253
4
+
5
+ ### Patch Changes
6
+
7
+ - d91d30b: Preserve reasoning block IDs from UI message streams on reasoning UI parts.
8
+ - Updated dependencies [0ec239b]
9
+ - @ai-sdk/gateway@3.0.172
10
+
11
+ ## 6.0.252
12
+
13
+ ### Patch Changes
14
+
15
+ - 2f96d3f: Allow providers without reranking model support to satisfy the `Provider` type.
16
+ - afb1965: Propagate errors thrown by the Chat `onFinish` callback to the initiating request.
17
+ - Updated dependencies [18b0965]
18
+ - Updated dependencies [451d2c3]
19
+ - @ai-sdk/gateway@3.0.171
20
+
21
+ ## 6.0.251
22
+
23
+ ### Patch Changes
24
+
25
+ - d13c2e9: Respect ToolLoopAgent timeouts configured in agent settings.
26
+
3
27
  ## 6.0.250
4
28
 
5
29
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -205,7 +205,7 @@ type Provider = {
205
205
  *
206
206
  * @throws {NoSuchModelError} If no such model exists.
207
207
  */
208
- rerankingModel(modelId: string): RerankingModel;
208
+ rerankingModel?(modelId: string): RerankingModel;
209
209
  };
210
210
 
211
211
  /**
@@ -1635,6 +1635,10 @@ type TextUIPart = {
1635
1635
  */
1636
1636
  type ReasoningUIPart = {
1637
1637
  type: 'reasoning';
1638
+ /**
1639
+ * The reasoning part ID.
1640
+ */
1641
+ id?: string;
1638
1642
  /**
1639
1643
  * The reasoning text.
1640
1644
  */
@@ -3357,7 +3361,7 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
3357
3361
  * }),
3358
3362
  * ```
3359
3363
  */
3360
- prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
3364
+ prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'timeout' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
3361
3365
  };
3362
3366
 
3363
3367
  /**
package/dist/index.d.ts CHANGED
@@ -205,7 +205,7 @@ type Provider = {
205
205
  *
206
206
  * @throws {NoSuchModelError} If no such model exists.
207
207
  */
208
- rerankingModel(modelId: string): RerankingModel;
208
+ rerankingModel?(modelId: string): RerankingModel;
209
209
  };
210
210
 
211
211
  /**
@@ -1635,6 +1635,10 @@ type TextUIPart = {
1635
1635
  */
1636
1636
  type ReasoningUIPart = {
1637
1637
  type: 'reasoning';
1638
+ /**
1639
+ * The reasoning part ID.
1640
+ */
1641
+ id?: string;
1638
1642
  /**
1639
1643
  * The reasoning text.
1640
1644
  */
@@ -3357,7 +3361,7 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
3357
3361
  * }),
3358
3362
  * ```
3359
3363
  */
3360
- prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
3364
+ prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'timeout' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
3361
3365
  };
3362
3366
 
3363
3367
  /**
package/dist/index.js CHANGED
@@ -1304,7 +1304,7 @@ function detectMediaType({
1304
1304
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
1305
1305
 
1306
1306
  // src/version.ts
1307
- var VERSION = true ? "6.0.250" : "0.0.0-test";
1307
+ var VERSION = true ? "6.0.253" : "0.0.0-test";
1308
1308
 
1309
1309
  // src/util/download/download.ts
1310
1310
  var download = async ({
@@ -6023,6 +6023,7 @@ function processUIMessageStream({
6023
6023
  case "reasoning-start": {
6024
6024
  const reasoningPart = {
6025
6025
  type: "reasoning",
6026
+ id: chunk.id,
6026
6027
  text: "",
6027
6028
  providerMetadata: chunk.providerMetadata,
6028
6029
  state: "streaming"
@@ -8910,10 +8911,11 @@ var ToolLoopAgent = class {
8910
8911
  onStepFinish,
8911
8912
  ...options
8912
8913
  }) {
8914
+ const preparedCall = await this.prepareCall(options);
8913
8915
  return generateText({
8914
- ...await this.prepareCall(options),
8916
+ ...preparedCall,
8915
8917
  abortSignal,
8916
- timeout,
8918
+ timeout: timeout != null ? timeout : preparedCall.timeout,
8917
8919
  onStepFinish: this.mergeOnStepFinishCallbacks(onStepFinish)
8918
8920
  });
8919
8921
  }
@@ -8927,10 +8929,11 @@ var ToolLoopAgent = class {
8927
8929
  onStepFinish,
8928
8930
  ...options
8929
8931
  }) {
8932
+ const preparedCall = await this.prepareCall(options);
8930
8933
  return streamText({
8931
- ...await this.prepareCall(options),
8934
+ ...preparedCall,
8932
8935
  abortSignal,
8933
- timeout,
8936
+ timeout: timeout != null ? timeout : preparedCall.timeout,
8934
8937
  experimental_transform,
8935
8938
  onStepFinish: this.mergeOnStepFinishCallbacks(onStepFinish)
8936
8939
  });
@@ -9336,6 +9339,7 @@ var uiMessagesSchema = (0, import_provider_utils24.lazySchema)(
9336
9339
  }),
9337
9340
  import_v48.z.object({
9338
9341
  type: import_v48.z.literal("reasoning"),
9342
+ id: import_v48.z.string().optional(),
9339
9343
  text: import_v48.z.string(),
9340
9344
  state: import_v48.z.enum(["streaming", "done"]).optional(),
9341
9345
  providerMetadata: providerMetadataSchema.optional()
@@ -14156,13 +14160,12 @@ var AbstractChat = class {
14156
14160
  finishReason: activeResponse.state.finishReason
14157
14161
  });
14158
14162
  }
14159
- } catch (err) {
14160
- console.error(err);
14161
- }
14162
- if (this.activeResponse === activeResponse) {
14163
- this.activeResponse = void 0;
14163
+ } finally {
14164
+ if (this.activeResponse === activeResponse) {
14165
+ this.activeResponse = void 0;
14166
+ }
14167
+ clearActiveResumeRequest();
14164
14168
  }
14165
- clearActiveResumeRequest();
14166
14169
  }
14167
14170
  if (!isError && await this.shouldSendAutomatically()) {
14168
14171
  await this.makeRequest({