ai 6.0.8 → 6.0.10

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/dist/index.mjs CHANGED
@@ -898,7 +898,7 @@ import {
898
898
  } from "@ai-sdk/provider-utils";
899
899
 
900
900
  // src/version.ts
901
- var VERSION = true ? "6.0.8" : "0.0.0-test";
901
+ var VERSION = true ? "6.0.10" : "0.0.0-test";
902
902
 
903
903
  // src/util/download/download.ts
904
904
  var download = async ({ url }) => {
@@ -5506,6 +5506,12 @@ function runToolsTransformation({
5506
5506
  }
5507
5507
  }).then((result) => {
5508
5508
  toolResultsStreamController.enqueue(result);
5509
+ }).catch((error) => {
5510
+ toolResultsStreamController.enqueue({
5511
+ type: "error",
5512
+ error
5513
+ });
5514
+ }).finally(() => {
5509
5515
  outstandingToolResults.delete(toolExecutionId);
5510
5516
  attemptClose();
5511
5517
  });
@@ -11747,6 +11753,46 @@ var AbstractChat = class {
11747
11753
  }
11748
11754
  };
11749
11755
 
11756
+ // src/ui/direct-chat-transport.ts
11757
+ var DirectChatTransport = class {
11758
+ constructor({
11759
+ agent,
11760
+ options,
11761
+ ...uiMessageStreamOptions
11762
+ }) {
11763
+ this.agent = agent;
11764
+ this.agentOptions = options;
11765
+ this.uiMessageStreamOptions = uiMessageStreamOptions;
11766
+ }
11767
+ async sendMessages({
11768
+ messages,
11769
+ abortSignal
11770
+ }) {
11771
+ const validatedMessages = await validateUIMessages({
11772
+ messages,
11773
+ tools: this.agent.tools
11774
+ });
11775
+ const modelMessages = await convertToModelMessages(validatedMessages, {
11776
+ tools: this.agent.tools
11777
+ });
11778
+ const result = await this.agent.stream({
11779
+ prompt: modelMessages,
11780
+ abortSignal,
11781
+ ...this.agentOptions !== void 0 ? { options: this.agentOptions } : {}
11782
+ });
11783
+ return result.toUIMessageStream(this.uiMessageStreamOptions);
11784
+ }
11785
+ /**
11786
+ * Direct transport does not support reconnection since there is no
11787
+ * persistent server-side stream to reconnect to.
11788
+ *
11789
+ * @returns Always returns `null`
11790
+ */
11791
+ async reconnectToStream(_options) {
11792
+ return null;
11793
+ }
11794
+ };
11795
+
11750
11796
  // src/ui/last-assistant-message-is-complete-with-approval-responses.ts
11751
11797
  function lastAssistantMessageIsCompleteWithApprovalResponses({
11752
11798
  messages
@@ -11830,6 +11876,7 @@ export {
11830
11876
  APICallError,
11831
11877
  AbstractChat,
11832
11878
  DefaultChatTransport,
11879
+ DirectChatTransport,
11833
11880
  DownloadError,
11834
11881
  EmptyResponseBodyError,
11835
11882
  ToolLoopAgent as Experimental_Agent,