ai 5.0.52 → 5.0.53
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 +6 -0
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -6
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -4327,10 +4327,18 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
4327
4327
|
* Clear the error state and set the status to ready if the chat is in an error state.
|
|
4328
4328
|
*/
|
|
4329
4329
|
clearError: () => void;
|
|
4330
|
-
addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ tool, toolCallId, output, }: {
|
|
4330
|
+
addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ state, tool, toolCallId, output, errorText, }: {
|
|
4331
|
+
state?: "output-available";
|
|
4331
4332
|
tool: TOOL;
|
|
4332
4333
|
toolCallId: string;
|
|
4333
4334
|
output: InferUIMessageTools<UI_MESSAGE>[TOOL]["output"];
|
|
4335
|
+
errorText?: never;
|
|
4336
|
+
} | {
|
|
4337
|
+
state: "output-error";
|
|
4338
|
+
tool: TOOL;
|
|
4339
|
+
toolCallId: string;
|
|
4340
|
+
output?: never;
|
|
4341
|
+
errorText: string;
|
|
4334
4342
|
}) => Promise<void>;
|
|
4335
4343
|
/**
|
|
4336
4344
|
* Abort the current request immediately, keep the generated tokens if any.
|
package/dist/index.d.ts
CHANGED
|
@@ -4327,10 +4327,18 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
4327
4327
|
* Clear the error state and set the status to ready if the chat is in an error state.
|
|
4328
4328
|
*/
|
|
4329
4329
|
clearError: () => void;
|
|
4330
|
-
addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ tool, toolCallId, output, }: {
|
|
4330
|
+
addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ state, tool, toolCallId, output, errorText, }: {
|
|
4331
|
+
state?: "output-available";
|
|
4331
4332
|
tool: TOOL;
|
|
4332
4333
|
toolCallId: string;
|
|
4333
4334
|
output: InferUIMessageTools<UI_MESSAGE>[TOOL]["output"];
|
|
4335
|
+
errorText?: never;
|
|
4336
|
+
} | {
|
|
4337
|
+
state: "output-error";
|
|
4338
|
+
tool: TOOL;
|
|
4339
|
+
toolCallId: string;
|
|
4340
|
+
output?: never;
|
|
4341
|
+
errorText: string;
|
|
4334
4342
|
}) => Promise<void>;
|
|
4335
4343
|
/**
|
|
4336
4344
|
* Abort the current request immediately, keep the generated tokens if any.
|
package/dist/index.js
CHANGED
|
@@ -768,7 +768,7 @@ function detectMediaType({
|
|
|
768
768
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
769
769
|
|
|
770
770
|
// src/version.ts
|
|
771
|
-
var VERSION = true ? "5.0.
|
|
771
|
+
var VERSION = true ? "5.0.53" : "0.0.0-test";
|
|
772
772
|
|
|
773
773
|
// src/util/download/download.ts
|
|
774
774
|
var download = async ({ url }) => {
|
|
@@ -9721,9 +9721,11 @@ var AbstractChat = class {
|
|
|
9721
9721
|
}
|
|
9722
9722
|
};
|
|
9723
9723
|
this.addToolResult = async ({
|
|
9724
|
+
state = "output-available",
|
|
9724
9725
|
tool: tool3,
|
|
9725
9726
|
toolCallId,
|
|
9726
|
-
output
|
|
9727
|
+
output,
|
|
9728
|
+
errorText
|
|
9727
9729
|
}) => this.jobExecutor.run(async () => {
|
|
9728
9730
|
var _a17, _b;
|
|
9729
9731
|
const messages = this.state.messages;
|
|
@@ -9731,16 +9733,16 @@ var AbstractChat = class {
|
|
|
9731
9733
|
this.state.replaceMessage(messages.length - 1, {
|
|
9732
9734
|
...lastMessage,
|
|
9733
9735
|
parts: lastMessage.parts.map(
|
|
9734
|
-
(part) => isToolOrDynamicToolUIPart(part) && part.toolCallId === toolCallId ? { ...part, state
|
|
9736
|
+
(part) => isToolOrDynamicToolUIPart(part) && part.toolCallId === toolCallId ? { ...part, state, output, errorText } : part
|
|
9735
9737
|
)
|
|
9736
9738
|
});
|
|
9737
9739
|
if (this.activeResponse) {
|
|
9738
9740
|
this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(
|
|
9739
9741
|
(part) => isToolOrDynamicToolUIPart(part) && part.toolCallId === toolCallId ? {
|
|
9740
9742
|
...part,
|
|
9741
|
-
state
|
|
9743
|
+
state,
|
|
9742
9744
|
output,
|
|
9743
|
-
errorText
|
|
9745
|
+
errorText
|
|
9744
9746
|
} : part
|
|
9745
9747
|
);
|
|
9746
9748
|
}
|
|
@@ -9949,7 +9951,9 @@ function lastAssistantMessageIsCompleteWithToolCalls({
|
|
|
9949
9951
|
return part.type === "step-start" ? index : lastIndex;
|
|
9950
9952
|
}, -1);
|
|
9951
9953
|
const lastStepToolInvocations = message.parts.slice(lastStepStartIndex + 1).filter(isToolOrDynamicToolUIPart);
|
|
9952
|
-
return lastStepToolInvocations.length > 0 && lastStepToolInvocations.every(
|
|
9954
|
+
return lastStepToolInvocations.length > 0 && lastStepToolInvocations.every(
|
|
9955
|
+
(part) => part.state === "output-available" || part.state === "output-error"
|
|
9956
|
+
);
|
|
9953
9957
|
}
|
|
9954
9958
|
|
|
9955
9959
|
// src/ui/transform-text-to-ui-message-stream.ts
|