ai 5.0.2 → 5.0.4
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 +18 -0
- package/dist/index.d.mts +26 -2
- package/dist/index.d.ts +26 -2
- package/dist/index.js +26 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
@@ -1966,6 +1966,7 @@ async function generateText({
|
|
1966
1966
|
experimental_prepareStep,
|
1967
1967
|
prepareStep = experimental_prepareStep,
|
1968
1968
|
experimental_repairToolCall: repairToolCall,
|
1969
|
+
experimental_context,
|
1969
1970
|
_internal: {
|
1970
1971
|
generateId: generateId3 = originalGenerateId,
|
1971
1972
|
currentDate = () => /* @__PURE__ */ new Date()
|
@@ -2163,7 +2164,8 @@ async function generateText({
|
|
2163
2164
|
input: toolCall.input,
|
2164
2165
|
toolCallId: toolCall.toolCallId,
|
2165
2166
|
messages: stepInputMessages,
|
2166
|
-
abortSignal
|
2167
|
+
abortSignal,
|
2168
|
+
experimental_context
|
2167
2169
|
});
|
2168
2170
|
}
|
2169
2171
|
}
|
@@ -2176,7 +2178,8 @@ async function generateText({
|
|
2176
2178
|
tracer,
|
2177
2179
|
telemetry,
|
2178
2180
|
messages: stepInputMessages,
|
2179
|
-
abortSignal
|
2181
|
+
abortSignal,
|
2182
|
+
experimental_context
|
2180
2183
|
});
|
2181
2184
|
const stepContent = asContent({
|
2182
2185
|
content: currentModelResponse.content,
|
@@ -2257,7 +2260,8 @@ async function executeTools({
|
|
2257
2260
|
tracer,
|
2258
2261
|
telemetry,
|
2259
2262
|
messages,
|
2260
|
-
abortSignal
|
2263
|
+
abortSignal,
|
2264
|
+
experimental_context
|
2261
2265
|
}) {
|
2262
2266
|
const toolOutputs = await Promise.all(
|
2263
2267
|
toolCalls.map(async ({ toolCallId, toolName, input }) => {
|
@@ -2287,7 +2291,8 @@ async function executeTools({
|
|
2287
2291
|
const output = await tool3.execute(input, {
|
2288
2292
|
toolCallId,
|
2289
2293
|
messages,
|
2290
|
-
abortSignal
|
2294
|
+
abortSignal,
|
2295
|
+
experimental_context
|
2291
2296
|
});
|
2292
2297
|
try {
|
2293
2298
|
span.setAttributes(
|
@@ -3858,7 +3863,8 @@ function runToolsTransformation({
|
|
3858
3863
|
system,
|
3859
3864
|
messages,
|
3860
3865
|
abortSignal,
|
3861
|
-
repairToolCall
|
3866
|
+
repairToolCall,
|
3867
|
+
experimental_context
|
3862
3868
|
}) {
|
3863
3869
|
let toolResultsStreamController = null;
|
3864
3870
|
const toolResultsStream = new ReadableStream({
|
@@ -3935,7 +3941,8 @@ function runToolsTransformation({
|
|
3935
3941
|
input: toolCall.input,
|
3936
3942
|
toolCallId: toolCall.toolCallId,
|
3937
3943
|
messages,
|
3938
|
-
abortSignal
|
3944
|
+
abortSignal,
|
3945
|
+
experimental_context
|
3939
3946
|
});
|
3940
3947
|
}
|
3941
3948
|
if (tool3.execute != null && toolCall.providerExecuted !== true) {
|
@@ -3964,7 +3971,8 @@ function runToolsTransformation({
|
|
3964
3971
|
output = await tool3.execute(toolCall.input, {
|
3965
3972
|
toolCallId: toolCall.toolCallId,
|
3966
3973
|
messages,
|
3967
|
-
abortSignal
|
3974
|
+
abortSignal,
|
3975
|
+
experimental_context
|
3968
3976
|
});
|
3969
3977
|
} catch (error) {
|
3970
3978
|
recordErrorOnSpan(span, error);
|
@@ -4098,6 +4106,7 @@ function streamText({
|
|
4098
4106
|
onFinish,
|
4099
4107
|
onAbort,
|
4100
4108
|
onStepFinish,
|
4109
|
+
experimental_context,
|
4101
4110
|
_internal: {
|
4102
4111
|
now: now2 = now,
|
4103
4112
|
generateId: generateId3 = originalGenerateId2,
|
@@ -4132,7 +4141,8 @@ function streamText({
|
|
4132
4141
|
onStepFinish,
|
4133
4142
|
now: now2,
|
4134
4143
|
currentDate,
|
4135
|
-
generateId: generateId3
|
4144
|
+
generateId: generateId3,
|
4145
|
+
experimental_context
|
4136
4146
|
});
|
4137
4147
|
}
|
4138
4148
|
function createOutputTransformStream(output) {
|
@@ -4228,7 +4238,8 @@ var DefaultStreamTextResult = class {
|
|
4228
4238
|
onError,
|
4229
4239
|
onFinish,
|
4230
4240
|
onAbort,
|
4231
|
-
onStepFinish
|
4241
|
+
onStepFinish,
|
4242
|
+
experimental_context
|
4232
4243
|
}) {
|
4233
4244
|
this._totalUsage = new DelayedPromise();
|
4234
4245
|
this._finishReason = new DelayedPromise();
|
@@ -4607,7 +4618,8 @@ var DefaultStreamTextResult = class {
|
|
4607
4618
|
system,
|
4608
4619
|
messages: stepInputMessages,
|
4609
4620
|
repairToolCall,
|
4610
|
-
abortSignal
|
4621
|
+
abortSignal,
|
4622
|
+
experimental_context
|
4611
4623
|
});
|
4612
4624
|
const stepRequest = request != null ? request : {};
|
4613
4625
|
const stepToolCalls = [];
|
@@ -4735,7 +4747,8 @@ var DefaultStreamTextResult = class {
|
|
4735
4747
|
await tool3.onInputStart({
|
4736
4748
|
toolCallId: chunk.id,
|
4737
4749
|
messages: stepInputMessages,
|
4738
|
-
abortSignal
|
4750
|
+
abortSignal,
|
4751
|
+
experimental_context
|
4739
4752
|
});
|
4740
4753
|
}
|
4741
4754
|
controller.enqueue({
|
@@ -4757,7 +4770,8 @@ var DefaultStreamTextResult = class {
|
|
4757
4770
|
inputTextDelta: chunk.delta,
|
4758
4771
|
toolCallId: chunk.id,
|
4759
4772
|
messages: stepInputMessages,
|
4760
|
-
abortSignal
|
4773
|
+
abortSignal,
|
4774
|
+
experimental_context
|
4761
4775
|
});
|
4762
4776
|
}
|
4763
4777
|
controller.enqueue(chunk);
|