ai 6.0.249 → 6.0.252
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 +26 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -14
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/02-foundations/02-providers-and-models.mdx +1 -0
- package/package.json +3 -3
- package/src/agent/tool-loop-agent-settings.ts +1 -0
- package/src/agent/tool-loop-agent.ts +8 -4
- package/src/generate-object/stream-object.ts +2 -0
- package/src/generate-text/stream-text.ts +1 -0
- package/src/telemetry/record-span.ts +5 -2
- package/src/test/mock-tracer.ts +2 -0
- package/src/types/provider.ts +1 -1
- package/src/ui/chat.ts +6 -8
package/dist/index.mjs
CHANGED
|
@@ -1193,7 +1193,7 @@ import {
|
|
|
1193
1193
|
} from "@ai-sdk/provider-utils";
|
|
1194
1194
|
|
|
1195
1195
|
// src/version.ts
|
|
1196
|
-
var VERSION = true ? "6.0.
|
|
1196
|
+
var VERSION = true ? "6.0.252" : "0.0.0-test";
|
|
1197
1197
|
|
|
1198
1198
|
// src/util/download/download.ts
|
|
1199
1199
|
var download = async ({
|
|
@@ -2429,7 +2429,8 @@ async function recordSpan({
|
|
|
2429
2429
|
tracer,
|
|
2430
2430
|
attributes,
|
|
2431
2431
|
fn,
|
|
2432
|
-
endWhenDone = true
|
|
2432
|
+
endWhenDone = true,
|
|
2433
|
+
endOnError = endWhenDone
|
|
2433
2434
|
}) {
|
|
2434
2435
|
return tracer.startActiveSpan(
|
|
2435
2436
|
name22,
|
|
@@ -2446,7 +2447,9 @@ async function recordSpan({
|
|
|
2446
2447
|
try {
|
|
2447
2448
|
recordErrorOnSpan(span, error);
|
|
2448
2449
|
} finally {
|
|
2449
|
-
|
|
2450
|
+
if (endOnError) {
|
|
2451
|
+
span.end();
|
|
2452
|
+
}
|
|
2450
2453
|
}
|
|
2451
2454
|
throw error;
|
|
2452
2455
|
}
|
|
@@ -7829,6 +7832,7 @@ var DefaultStreamTextResult = class {
|
|
|
7829
7832
|
}),
|
|
7830
7833
|
tracer,
|
|
7831
7834
|
endWhenDone: false,
|
|
7835
|
+
endOnError: true,
|
|
7832
7836
|
fn: async (doStreamSpan2) => ({
|
|
7833
7837
|
startTimestampMs: now2(),
|
|
7834
7838
|
// get before the call
|
|
@@ -8834,10 +8838,11 @@ var ToolLoopAgent = class {
|
|
|
8834
8838
|
onStepFinish,
|
|
8835
8839
|
...options
|
|
8836
8840
|
}) {
|
|
8841
|
+
const preparedCall = await this.prepareCall(options);
|
|
8837
8842
|
return generateText({
|
|
8838
|
-
...
|
|
8843
|
+
...preparedCall,
|
|
8839
8844
|
abortSignal,
|
|
8840
|
-
timeout,
|
|
8845
|
+
timeout: timeout != null ? timeout : preparedCall.timeout,
|
|
8841
8846
|
onStepFinish: this.mergeOnStepFinishCallbacks(onStepFinish)
|
|
8842
8847
|
});
|
|
8843
8848
|
}
|
|
@@ -8851,10 +8856,11 @@ var ToolLoopAgent = class {
|
|
|
8851
8856
|
onStepFinish,
|
|
8852
8857
|
...options
|
|
8853
8858
|
}) {
|
|
8859
|
+
const preparedCall = await this.prepareCall(options);
|
|
8854
8860
|
return streamText({
|
|
8855
|
-
...
|
|
8861
|
+
...preparedCall,
|
|
8856
8862
|
abortSignal,
|
|
8857
|
-
timeout,
|
|
8863
|
+
timeout: timeout != null ? timeout : preparedCall.timeout,
|
|
8858
8864
|
experimental_transform,
|
|
8859
8865
|
onStepFinish: this.mergeOnStepFinishCallbacks(onStepFinish)
|
|
8860
8866
|
});
|
|
@@ -11358,6 +11364,7 @@ var DefaultStreamObjectResult = class {
|
|
|
11358
11364
|
}),
|
|
11359
11365
|
tracer,
|
|
11360
11366
|
endWhenDone: false,
|
|
11367
|
+
endOnError: true,
|
|
11361
11368
|
fn: async (rootSpan) => {
|
|
11362
11369
|
const standardizedPrompt = await standardizePrompt({
|
|
11363
11370
|
system,
|
|
@@ -11429,6 +11436,7 @@ var DefaultStreamObjectResult = class {
|
|
|
11429
11436
|
}),
|
|
11430
11437
|
tracer,
|
|
11431
11438
|
endWhenDone: false,
|
|
11439
|
+
endOnError: true,
|
|
11432
11440
|
fn: async (doStreamSpan2) => ({
|
|
11433
11441
|
startTimestampMs: now2(),
|
|
11434
11442
|
doStreamSpan: doStreamSpan2,
|
|
@@ -14022,7 +14030,7 @@ var AbstractChat = class {
|
|
|
14022
14030
|
try {
|
|
14023
14031
|
const response = {
|
|
14024
14032
|
state: createStreamingUIMessageState({
|
|
14025
|
-
lastMessage: trigger === "regenerate-message" ? void 0 : this.state.snapshot(lastMessage),
|
|
14033
|
+
lastMessage: trigger === "resume-stream" || trigger === "regenerate-message" ? void 0 : this.state.snapshot(lastMessage),
|
|
14026
14034
|
messageId: this.generateId()
|
|
14027
14035
|
}),
|
|
14028
14036
|
abortController
|
|
@@ -14131,13 +14139,12 @@ var AbstractChat = class {
|
|
|
14131
14139
|
finishReason: activeResponse.state.finishReason
|
|
14132
14140
|
});
|
|
14133
14141
|
}
|
|
14134
|
-
}
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14142
|
+
} finally {
|
|
14143
|
+
if (this.activeResponse === activeResponse) {
|
|
14144
|
+
this.activeResponse = void 0;
|
|
14145
|
+
}
|
|
14146
|
+
clearActiveResumeRequest();
|
|
14139
14147
|
}
|
|
14140
|
-
clearActiveResumeRequest();
|
|
14141
14148
|
}
|
|
14142
14149
|
if (!isError && await this.shouldSendAutomatically()) {
|
|
14143
14150
|
await this.makeRequest({
|