ai 6.0.0-beta.57 → 6.0.0-beta.59
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 +12 -0
 - package/README.md +4 -3
 - package/dist/index.d.mts +23 -15
 - package/dist/index.d.ts +23 -15
 - package/dist/index.js +779 -766
 - package/dist/index.js.map +1 -1
 - package/dist/index.mjs +697 -685
 - 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/dist/index.js
    CHANGED
    
    | 
         @@ -74,6 +74,7 @@ __export(src_exports, { 
     | 
|
| 
       74 
74 
     | 
    
         
             
              coreToolMessageSchema: () => coreToolMessageSchema,
         
     | 
| 
       75 
75 
     | 
    
         
             
              coreUserMessageSchema: () => coreUserMessageSchema,
         
     | 
| 
       76 
76 
     | 
    
         
             
              cosineSimilarity: () => cosineSimilarity,
         
     | 
| 
      
 77 
     | 
    
         
            +
              createAgentStreamResponse: () => createAgentStreamResponse,
         
     | 
| 
       77 
78 
     | 
    
         
             
              createGateway: () => import_gateway3.createGateway,
         
     | 
| 
       78 
79 
     | 
    
         
             
              createIdGenerator: () => import_provider_utils37.createIdGenerator,
         
     | 
| 
       79 
80 
     | 
    
         
             
              createProviderRegistry: () => createProviderRegistry,
         
     | 
| 
         @@ -870,7 +871,7 @@ function detectMediaType({ 
     | 
|
| 
       870 
871 
     | 
    
         
             
            var import_provider_utils2 = require("@ai-sdk/provider-utils");
         
     | 
| 
       871 
872 
     | 
    
         | 
| 
       872 
873 
     | 
    
         
             
            // src/version.ts
         
     | 
| 
       873 
     | 
    
         
            -
            var VERSION = true ? "6.0.0-beta. 
     | 
| 
      
 874 
     | 
    
         
            +
            var VERSION = true ? "6.0.0-beta.59" : "0.0.0-test";
         
     | 
| 
       874 
875 
     | 
    
         | 
| 
       875 
876 
     | 
    
         
             
            // src/util/download/download.ts
         
     | 
| 
       876 
877 
     | 
    
         
             
            var download = async ({ url }) => {
         
     | 
| 
         @@ -6320,6 +6321,182 @@ var DefaultStreamTextResult = class { 
     | 
|
| 
       6320 
6321 
     | 
    
         
             
              }
         
     | 
| 
       6321 
6322 
     | 
    
         
             
            };
         
     | 
| 
       6322 
6323 
     | 
    
         | 
| 
      
 6324 
     | 
    
         
            +
            // src/agent/tool-loop-agent.ts
         
     | 
| 
      
 6325 
     | 
    
         
            +
            var ToolLoopAgent = class {
         
     | 
| 
      
 6326 
     | 
    
         
            +
              constructor(settings) {
         
     | 
| 
      
 6327 
     | 
    
         
            +
                this.version = "agent-v1";
         
     | 
| 
      
 6328 
     | 
    
         
            +
                this.settings = settings;
         
     | 
| 
      
 6329 
     | 
    
         
            +
              }
         
     | 
| 
      
 6330 
     | 
    
         
            +
              /**
         
     | 
| 
      
 6331 
     | 
    
         
            +
               * The id of the agent.
         
     | 
| 
      
 6332 
     | 
    
         
            +
               */
         
     | 
| 
      
 6333 
     | 
    
         
            +
              get id() {
         
     | 
| 
      
 6334 
     | 
    
         
            +
                return this.settings.id;
         
     | 
| 
      
 6335 
     | 
    
         
            +
              }
         
     | 
| 
      
 6336 
     | 
    
         
            +
              /**
         
     | 
| 
      
 6337 
     | 
    
         
            +
               * The tools that the agent can use.
         
     | 
| 
      
 6338 
     | 
    
         
            +
               */
         
     | 
| 
      
 6339 
     | 
    
         
            +
              get tools() {
         
     | 
| 
      
 6340 
     | 
    
         
            +
                return this.settings.tools;
         
     | 
| 
      
 6341 
     | 
    
         
            +
              }
         
     | 
| 
      
 6342 
     | 
    
         
            +
              /**
         
     | 
| 
      
 6343 
     | 
    
         
            +
               * Generates an output from the agent (non-streaming).
         
     | 
| 
      
 6344 
     | 
    
         
            +
               */
         
     | 
| 
      
 6345 
     | 
    
         
            +
              async generate(options) {
         
     | 
| 
      
 6346 
     | 
    
         
            +
                var _a17;
         
     | 
| 
      
 6347 
     | 
    
         
            +
                return generateText({
         
     | 
| 
      
 6348 
     | 
    
         
            +
                  ...this.settings,
         
     | 
| 
      
 6349 
     | 
    
         
            +
                  stopWhen: (_a17 = this.settings.stopWhen) != null ? _a17 : stepCountIs(20),
         
     | 
| 
      
 6350 
     | 
    
         
            +
                  ...options
         
     | 
| 
      
 6351 
     | 
    
         
            +
                });
         
     | 
| 
      
 6352 
     | 
    
         
            +
              }
         
     | 
| 
      
 6353 
     | 
    
         
            +
              /**
         
     | 
| 
      
 6354 
     | 
    
         
            +
               * Streams an output from the agent (streaming).
         
     | 
| 
      
 6355 
     | 
    
         
            +
               */
         
     | 
| 
      
 6356 
     | 
    
         
            +
              stream(options) {
         
     | 
| 
      
 6357 
     | 
    
         
            +
                var _a17;
         
     | 
| 
      
 6358 
     | 
    
         
            +
                return streamText({
         
     | 
| 
      
 6359 
     | 
    
         
            +
                  ...this.settings,
         
     | 
| 
      
 6360 
     | 
    
         
            +
                  stopWhen: (_a17 = this.settings.stopWhen) != null ? _a17 : stepCountIs(20),
         
     | 
| 
      
 6361 
     | 
    
         
            +
                  ...options
         
     | 
| 
      
 6362 
     | 
    
         
            +
                });
         
     | 
| 
      
 6363 
     | 
    
         
            +
              }
         
     | 
| 
      
 6364 
     | 
    
         
            +
            };
         
     | 
| 
      
 6365 
     | 
    
         
            +
             
     | 
| 
      
 6366 
     | 
    
         
            +
            // src/ui-message-stream/create-ui-message-stream.ts
         
     | 
| 
      
 6367 
     | 
    
         
            +
            var import_provider_utils17 = require("@ai-sdk/provider-utils");
         
     | 
| 
      
 6368 
     | 
    
         
            +
            function createUIMessageStream({
         
     | 
| 
      
 6369 
     | 
    
         
            +
              execute,
         
     | 
| 
      
 6370 
     | 
    
         
            +
              onError = import_provider_utils17.getErrorMessage,
         
     | 
| 
      
 6371 
     | 
    
         
            +
              originalMessages,
         
     | 
| 
      
 6372 
     | 
    
         
            +
              onFinish,
         
     | 
| 
      
 6373 
     | 
    
         
            +
              generateId: generateId2 = import_provider_utils17.generateId
         
     | 
| 
      
 6374 
     | 
    
         
            +
            }) {
         
     | 
| 
      
 6375 
     | 
    
         
            +
              let controller;
         
     | 
| 
      
 6376 
     | 
    
         
            +
              const ongoingStreamPromises = [];
         
     | 
| 
      
 6377 
     | 
    
         
            +
              const stream = new ReadableStream({
         
     | 
| 
      
 6378 
     | 
    
         
            +
                start(controllerArg) {
         
     | 
| 
      
 6379 
     | 
    
         
            +
                  controller = controllerArg;
         
     | 
| 
      
 6380 
     | 
    
         
            +
                }
         
     | 
| 
      
 6381 
     | 
    
         
            +
              });
         
     | 
| 
      
 6382 
     | 
    
         
            +
              function safeEnqueue(data) {
         
     | 
| 
      
 6383 
     | 
    
         
            +
                try {
         
     | 
| 
      
 6384 
     | 
    
         
            +
                  controller.enqueue(data);
         
     | 
| 
      
 6385 
     | 
    
         
            +
                } catch (error) {
         
     | 
| 
      
 6386 
     | 
    
         
            +
                }
         
     | 
| 
      
 6387 
     | 
    
         
            +
              }
         
     | 
| 
      
 6388 
     | 
    
         
            +
              try {
         
     | 
| 
      
 6389 
     | 
    
         
            +
                const result = execute({
         
     | 
| 
      
 6390 
     | 
    
         
            +
                  writer: {
         
     | 
| 
      
 6391 
     | 
    
         
            +
                    write(part) {
         
     | 
| 
      
 6392 
     | 
    
         
            +
                      safeEnqueue(part);
         
     | 
| 
      
 6393 
     | 
    
         
            +
                    },
         
     | 
| 
      
 6394 
     | 
    
         
            +
                    merge(streamArg) {
         
     | 
| 
      
 6395 
     | 
    
         
            +
                      ongoingStreamPromises.push(
         
     | 
| 
      
 6396 
     | 
    
         
            +
                        (async () => {
         
     | 
| 
      
 6397 
     | 
    
         
            +
                          const reader = streamArg.getReader();
         
     | 
| 
      
 6398 
     | 
    
         
            +
                          while (true) {
         
     | 
| 
      
 6399 
     | 
    
         
            +
                            const { done, value } = await reader.read();
         
     | 
| 
      
 6400 
     | 
    
         
            +
                            if (done)
         
     | 
| 
      
 6401 
     | 
    
         
            +
                              break;
         
     | 
| 
      
 6402 
     | 
    
         
            +
                            safeEnqueue(value);
         
     | 
| 
      
 6403 
     | 
    
         
            +
                          }
         
     | 
| 
      
 6404 
     | 
    
         
            +
                        })().catch((error) => {
         
     | 
| 
      
 6405 
     | 
    
         
            +
                          safeEnqueue({
         
     | 
| 
      
 6406 
     | 
    
         
            +
                            type: "error",
         
     | 
| 
      
 6407 
     | 
    
         
            +
                            errorText: onError(error)
         
     | 
| 
      
 6408 
     | 
    
         
            +
                          });
         
     | 
| 
      
 6409 
     | 
    
         
            +
                        })
         
     | 
| 
      
 6410 
     | 
    
         
            +
                      );
         
     | 
| 
      
 6411 
     | 
    
         
            +
                    },
         
     | 
| 
      
 6412 
     | 
    
         
            +
                    onError
         
     | 
| 
      
 6413 
     | 
    
         
            +
                  }
         
     | 
| 
      
 6414 
     | 
    
         
            +
                });
         
     | 
| 
      
 6415 
     | 
    
         
            +
                if (result) {
         
     | 
| 
      
 6416 
     | 
    
         
            +
                  ongoingStreamPromises.push(
         
     | 
| 
      
 6417 
     | 
    
         
            +
                    result.catch((error) => {
         
     | 
| 
      
 6418 
     | 
    
         
            +
                      safeEnqueue({
         
     | 
| 
      
 6419 
     | 
    
         
            +
                        type: "error",
         
     | 
| 
      
 6420 
     | 
    
         
            +
                        errorText: onError(error)
         
     | 
| 
      
 6421 
     | 
    
         
            +
                      });
         
     | 
| 
      
 6422 
     | 
    
         
            +
                    })
         
     | 
| 
      
 6423 
     | 
    
         
            +
                  );
         
     | 
| 
      
 6424 
     | 
    
         
            +
                }
         
     | 
| 
      
 6425 
     | 
    
         
            +
              } catch (error) {
         
     | 
| 
      
 6426 
     | 
    
         
            +
                safeEnqueue({
         
     | 
| 
      
 6427 
     | 
    
         
            +
                  type: "error",
         
     | 
| 
      
 6428 
     | 
    
         
            +
                  errorText: onError(error)
         
     | 
| 
      
 6429 
     | 
    
         
            +
                });
         
     | 
| 
      
 6430 
     | 
    
         
            +
              }
         
     | 
| 
      
 6431 
     | 
    
         
            +
              const waitForStreams = new Promise(async (resolve3) => {
         
     | 
| 
      
 6432 
     | 
    
         
            +
                while (ongoingStreamPromises.length > 0) {
         
     | 
| 
      
 6433 
     | 
    
         
            +
                  await ongoingStreamPromises.shift();
         
     | 
| 
      
 6434 
     | 
    
         
            +
                }
         
     | 
| 
      
 6435 
     | 
    
         
            +
                resolve3();
         
     | 
| 
      
 6436 
     | 
    
         
            +
              });
         
     | 
| 
      
 6437 
     | 
    
         
            +
              waitForStreams.finally(() => {
         
     | 
| 
      
 6438 
     | 
    
         
            +
                try {
         
     | 
| 
      
 6439 
     | 
    
         
            +
                  controller.close();
         
     | 
| 
      
 6440 
     | 
    
         
            +
                } catch (error) {
         
     | 
| 
      
 6441 
     | 
    
         
            +
                }
         
     | 
| 
      
 6442 
     | 
    
         
            +
              });
         
     | 
| 
      
 6443 
     | 
    
         
            +
              return handleUIMessageStreamFinish({
         
     | 
| 
      
 6444 
     | 
    
         
            +
                stream,
         
     | 
| 
      
 6445 
     | 
    
         
            +
                messageId: generateId2(),
         
     | 
| 
      
 6446 
     | 
    
         
            +
                originalMessages,
         
     | 
| 
      
 6447 
     | 
    
         
            +
                onFinish,
         
     | 
| 
      
 6448 
     | 
    
         
            +
                onError
         
     | 
| 
      
 6449 
     | 
    
         
            +
              });
         
     | 
| 
      
 6450 
     | 
    
         
            +
            }
         
     | 
| 
      
 6451 
     | 
    
         
            +
             
     | 
| 
      
 6452 
     | 
    
         
            +
            // src/ui-message-stream/read-ui-message-stream.ts
         
     | 
| 
      
 6453 
     | 
    
         
            +
            function readUIMessageStream({
         
     | 
| 
      
 6454 
     | 
    
         
            +
              message,
         
     | 
| 
      
 6455 
     | 
    
         
            +
              stream,
         
     | 
| 
      
 6456 
     | 
    
         
            +
              onError,
         
     | 
| 
      
 6457 
     | 
    
         
            +
              terminateOnError = false
         
     | 
| 
      
 6458 
     | 
    
         
            +
            }) {
         
     | 
| 
      
 6459 
     | 
    
         
            +
              var _a17;
         
     | 
| 
      
 6460 
     | 
    
         
            +
              let controller;
         
     | 
| 
      
 6461 
     | 
    
         
            +
              let hasErrored = false;
         
     | 
| 
      
 6462 
     | 
    
         
            +
              const outputStream = new ReadableStream({
         
     | 
| 
      
 6463 
     | 
    
         
            +
                start(controllerParam) {
         
     | 
| 
      
 6464 
     | 
    
         
            +
                  controller = controllerParam;
         
     | 
| 
      
 6465 
     | 
    
         
            +
                }
         
     | 
| 
      
 6466 
     | 
    
         
            +
              });
         
     | 
| 
      
 6467 
     | 
    
         
            +
              const state = createStreamingUIMessageState({
         
     | 
| 
      
 6468 
     | 
    
         
            +
                messageId: (_a17 = message == null ? void 0 : message.id) != null ? _a17 : "",
         
     | 
| 
      
 6469 
     | 
    
         
            +
                lastMessage: message
         
     | 
| 
      
 6470 
     | 
    
         
            +
              });
         
     | 
| 
      
 6471 
     | 
    
         
            +
              const handleError = (error) => {
         
     | 
| 
      
 6472 
     | 
    
         
            +
                onError == null ? void 0 : onError(error);
         
     | 
| 
      
 6473 
     | 
    
         
            +
                if (!hasErrored && terminateOnError) {
         
     | 
| 
      
 6474 
     | 
    
         
            +
                  hasErrored = true;
         
     | 
| 
      
 6475 
     | 
    
         
            +
                  controller == null ? void 0 : controller.error(error);
         
     | 
| 
      
 6476 
     | 
    
         
            +
                }
         
     | 
| 
      
 6477 
     | 
    
         
            +
              };
         
     | 
| 
      
 6478 
     | 
    
         
            +
              consumeStream({
         
     | 
| 
      
 6479 
     | 
    
         
            +
                stream: processUIMessageStream({
         
     | 
| 
      
 6480 
     | 
    
         
            +
                  stream,
         
     | 
| 
      
 6481 
     | 
    
         
            +
                  runUpdateMessageJob(job) {
         
     | 
| 
      
 6482 
     | 
    
         
            +
                    return job({
         
     | 
| 
      
 6483 
     | 
    
         
            +
                      state,
         
     | 
| 
      
 6484 
     | 
    
         
            +
                      write: () => {
         
     | 
| 
      
 6485 
     | 
    
         
            +
                        controller == null ? void 0 : controller.enqueue(structuredClone(state.message));
         
     | 
| 
      
 6486 
     | 
    
         
            +
                      }
         
     | 
| 
      
 6487 
     | 
    
         
            +
                    });
         
     | 
| 
      
 6488 
     | 
    
         
            +
                  },
         
     | 
| 
      
 6489 
     | 
    
         
            +
                  onError: handleError
         
     | 
| 
      
 6490 
     | 
    
         
            +
                }),
         
     | 
| 
      
 6491 
     | 
    
         
            +
                onError: handleError
         
     | 
| 
      
 6492 
     | 
    
         
            +
              }).finally(() => {
         
     | 
| 
      
 6493 
     | 
    
         
            +
                if (!hasErrored) {
         
     | 
| 
      
 6494 
     | 
    
         
            +
                  controller == null ? void 0 : controller.close();
         
     | 
| 
      
 6495 
     | 
    
         
            +
                }
         
     | 
| 
      
 6496 
     | 
    
         
            +
              });
         
     | 
| 
      
 6497 
     | 
    
         
            +
              return createAsyncIterableStream(outputStream);
         
     | 
| 
      
 6498 
     | 
    
         
            +
            }
         
     | 
| 
      
 6499 
     | 
    
         
            +
             
     | 
| 
       6323 
6500 
     | 
    
         
             
            // src/ui/convert-to-model-messages.ts
         
     | 
| 
       6324 
6501 
     | 
    
         
             
            function convertToModelMessages(messages, options) {
         
     | 
| 
       6325 
6502 
     | 
    
         
             
              const modelMessages = [];
         
     | 
| 
         @@ -6525,95 +6702,440 @@ function convertToModelMessages(messages, options) { 
     | 
|
| 
       6525 
6702 
     | 
    
         
             
            }
         
     | 
| 
       6526 
6703 
     | 
    
         
             
            var convertToCoreMessages = convertToModelMessages;
         
     | 
| 
       6527 
6704 
     | 
    
         | 
| 
       6528 
     | 
    
         
            -
            // src/ 
     | 
| 
       6529 
     | 
    
         
            -
            var  
     | 
| 
       6530 
     | 
    
         
            -
             
     | 
| 
       6531 
     | 
    
         
            -
             
     | 
| 
       6532 
     | 
    
         
            -
             
     | 
| 
       6533 
     | 
    
         
            -
               
     | 
| 
       6534 
     | 
    
         
            -
             
     | 
| 
       6535 
     | 
    
         
            -
             
     | 
| 
       6536 
     | 
    
         
            -
             
     | 
| 
       6537 
     | 
    
         
            -
             
     | 
| 
       6538 
     | 
    
         
            -
             
     | 
| 
       6539 
     | 
    
         
            -
             
     | 
| 
       6540 
     | 
    
         
            -
             
     | 
| 
       6541 
     | 
    
         
            -
             
     | 
| 
       6542 
     | 
    
         
            -
             
     | 
| 
       6543 
     | 
    
         
            -
             
     | 
| 
       6544 
     | 
    
         
            -
             
     | 
| 
       6545 
     | 
    
         
            -
             
     | 
| 
       6546 
     | 
    
         
            -
             
     | 
| 
       6547 
     | 
    
         
            -
             
     | 
| 
       6548 
     | 
    
         
            -
             
     | 
| 
       6549 
     | 
    
         
            -
             
     | 
| 
       6550 
     | 
    
         
            -
             
     | 
| 
       6551 
     | 
    
         
            -
             
     | 
| 
       6552 
     | 
    
         
            -
             
     | 
| 
       6553 
     | 
    
         
            -
             
     | 
| 
       6554 
     | 
    
         
            -
             
     | 
| 
       6555 
     | 
    
         
            -
             
     | 
| 
       6556 
     | 
    
         
            -
             
     | 
| 
       6557 
     | 
    
         
            -
             
     | 
| 
       6558 
     | 
    
         
            -
             
     | 
| 
       6559 
     | 
    
         
            -
             
     | 
| 
       6560 
     | 
    
         
            -
             
     | 
| 
       6561 
     | 
    
         
            -
             
     | 
| 
       6562 
     | 
    
         
            -
             
     | 
| 
       6563 
     | 
    
         
            -
             
     | 
| 
       6564 
     | 
    
         
            -
             
     | 
| 
       6565 
     | 
    
         
            -
             
     | 
| 
       6566 
     | 
    
         
            -
             
     | 
| 
       6567 
     | 
    
         
            -
             
     | 
| 
       6568 
     | 
    
         
            -
             
     | 
| 
       6569 
     | 
    
         
            -
             
     | 
| 
       6570 
     | 
    
         
            -
             
     | 
| 
       6571 
     | 
    
         
            -
             
     | 
| 
       6572 
     | 
    
         
            -
             
     | 
| 
       6573 
     | 
    
         
            -
             
     | 
| 
       6574 
     | 
    
         
            -
             
     | 
| 
       6575 
     | 
    
         
            -
             
     | 
| 
       6576 
     | 
    
         
            -
             
     | 
| 
       6577 
     | 
    
         
            -
             
     | 
| 
       6578 
     | 
    
         
            -
             
     | 
| 
       6579 
     | 
    
         
            -
             
     | 
| 
       6580 
     | 
    
         
            -
             
     | 
| 
       6581 
     | 
    
         
            -
             
     | 
| 
       6582 
     | 
    
         
            -
             
     | 
| 
       6583 
     | 
    
         
            -
             
     | 
| 
       6584 
     | 
    
         
            -
             
     | 
| 
       6585 
     | 
    
         
            -
             
     | 
| 
       6586 
     | 
    
         
            -
             
     | 
| 
       6587 
     | 
    
         
            -
             
     | 
| 
       6588 
     | 
    
         
            -
             
     | 
| 
       6589 
     | 
    
         
            -
             
     | 
| 
       6590 
     | 
    
         
            -
             
     | 
| 
       6591 
     | 
    
         
            -
             
     | 
| 
       6592 
     | 
    
         
            -
             
     | 
| 
       6593 
     | 
    
         
            -
             
     | 
| 
       6594 
     | 
    
         
            -
             
     | 
| 
       6595 
     | 
    
         
            -
             
     | 
| 
       6596 
     | 
    
         
            -
             
     | 
| 
       6597 
     | 
    
         
            -
             
     | 
| 
       6598 
     | 
    
         
            -
             
     | 
| 
       6599 
     | 
    
         
            -
             
     | 
| 
       6600 
     | 
    
         
            -
             
     | 
| 
       6601 
     | 
    
         
            -
             
     | 
| 
       6602 
     | 
    
         
            -
             
     | 
| 
       6603 
     | 
    
         
            -
             
     | 
| 
       6604 
     | 
    
         
            -
             
     | 
| 
       6605 
     | 
    
         
            -
             
     | 
| 
       6606 
     | 
    
         
            -
             
     | 
| 
       6607 
     | 
    
         
            -
             
     | 
| 
       6608 
     | 
    
         
            -
             
     | 
| 
       6609 
     | 
    
         
            -
             
     | 
| 
       6610 
     | 
    
         
            -
             
     | 
| 
       6611 
     | 
    
         
            -
             
     | 
| 
       6612 
     | 
    
         
            -
             
     | 
| 
       6613 
     | 
    
         
            -
             
     | 
| 
       6614 
     | 
    
         
            -
             
     | 
| 
       6615 
     | 
    
         
            -
             
     | 
| 
       6616 
     | 
    
         
            -
             
     | 
| 
      
 6705 
     | 
    
         
            +
            // src/ui/validate-ui-messages.ts
         
     | 
| 
      
 6706 
     | 
    
         
            +
            var import_provider25 = require("@ai-sdk/provider");
         
     | 
| 
      
 6707 
     | 
    
         
            +
            var import_provider_utils18 = require("@ai-sdk/provider-utils");
         
     | 
| 
      
 6708 
     | 
    
         
            +
            var import_v48 = require("zod/v4");
         
     | 
| 
      
 6709 
     | 
    
         
            +
            var uiMessagesSchema = (0, import_provider_utils18.lazySchema)(
         
     | 
| 
      
 6710 
     | 
    
         
            +
              () => (0, import_provider_utils18.zodSchema)(
         
     | 
| 
      
 6711 
     | 
    
         
            +
                import_v48.z.array(
         
     | 
| 
      
 6712 
     | 
    
         
            +
                  import_v48.z.object({
         
     | 
| 
      
 6713 
     | 
    
         
            +
                    id: import_v48.z.string(),
         
     | 
| 
      
 6714 
     | 
    
         
            +
                    role: import_v48.z.enum(["system", "user", "assistant"]),
         
     | 
| 
      
 6715 
     | 
    
         
            +
                    metadata: import_v48.z.unknown().optional(),
         
     | 
| 
      
 6716 
     | 
    
         
            +
                    parts: import_v48.z.array(
         
     | 
| 
      
 6717 
     | 
    
         
            +
                      import_v48.z.union([
         
     | 
| 
      
 6718 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6719 
     | 
    
         
            +
                          type: import_v48.z.literal("text"),
         
     | 
| 
      
 6720 
     | 
    
         
            +
                          text: import_v48.z.string(),
         
     | 
| 
      
 6721 
     | 
    
         
            +
                          state: import_v48.z.enum(["streaming", "done"]).optional(),
         
     | 
| 
      
 6722 
     | 
    
         
            +
                          providerMetadata: providerMetadataSchema.optional()
         
     | 
| 
      
 6723 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6724 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6725 
     | 
    
         
            +
                          type: import_v48.z.literal("reasoning"),
         
     | 
| 
      
 6726 
     | 
    
         
            +
                          text: import_v48.z.string(),
         
     | 
| 
      
 6727 
     | 
    
         
            +
                          state: import_v48.z.enum(["streaming", "done"]).optional(),
         
     | 
| 
      
 6728 
     | 
    
         
            +
                          providerMetadata: providerMetadataSchema.optional()
         
     | 
| 
      
 6729 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6730 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6731 
     | 
    
         
            +
                          type: import_v48.z.literal("source-url"),
         
     | 
| 
      
 6732 
     | 
    
         
            +
                          sourceId: import_v48.z.string(),
         
     | 
| 
      
 6733 
     | 
    
         
            +
                          url: import_v48.z.string(),
         
     | 
| 
      
 6734 
     | 
    
         
            +
                          title: import_v48.z.string().optional(),
         
     | 
| 
      
 6735 
     | 
    
         
            +
                          providerMetadata: providerMetadataSchema.optional()
         
     | 
| 
      
 6736 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6737 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6738 
     | 
    
         
            +
                          type: import_v48.z.literal("source-document"),
         
     | 
| 
      
 6739 
     | 
    
         
            +
                          sourceId: import_v48.z.string(),
         
     | 
| 
      
 6740 
     | 
    
         
            +
                          mediaType: import_v48.z.string(),
         
     | 
| 
      
 6741 
     | 
    
         
            +
                          title: import_v48.z.string(),
         
     | 
| 
      
 6742 
     | 
    
         
            +
                          filename: import_v48.z.string().optional(),
         
     | 
| 
      
 6743 
     | 
    
         
            +
                          providerMetadata: providerMetadataSchema.optional()
         
     | 
| 
      
 6744 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6745 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6746 
     | 
    
         
            +
                          type: import_v48.z.literal("file"),
         
     | 
| 
      
 6747 
     | 
    
         
            +
                          mediaType: import_v48.z.string(),
         
     | 
| 
      
 6748 
     | 
    
         
            +
                          filename: import_v48.z.string().optional(),
         
     | 
| 
      
 6749 
     | 
    
         
            +
                          url: import_v48.z.string(),
         
     | 
| 
      
 6750 
     | 
    
         
            +
                          providerMetadata: providerMetadataSchema.optional()
         
     | 
| 
      
 6751 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6752 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6753 
     | 
    
         
            +
                          type: import_v48.z.literal("step-start")
         
     | 
| 
      
 6754 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6755 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6756 
     | 
    
         
            +
                          type: import_v48.z.string().startsWith("data-"),
         
     | 
| 
      
 6757 
     | 
    
         
            +
                          id: import_v48.z.string().optional(),
         
     | 
| 
      
 6758 
     | 
    
         
            +
                          data: import_v48.z.unknown()
         
     | 
| 
      
 6759 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6760 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6761 
     | 
    
         
            +
                          type: import_v48.z.literal("dynamic-tool"),
         
     | 
| 
      
 6762 
     | 
    
         
            +
                          toolName: import_v48.z.string(),
         
     | 
| 
      
 6763 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6764 
     | 
    
         
            +
                          state: import_v48.z.literal("input-streaming"),
         
     | 
| 
      
 6765 
     | 
    
         
            +
                          input: import_v48.z.unknown().optional(),
         
     | 
| 
      
 6766 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6767 
     | 
    
         
            +
                          output: import_v48.z.never().optional(),
         
     | 
| 
      
 6768 
     | 
    
         
            +
                          errorText: import_v48.z.never().optional(),
         
     | 
| 
      
 6769 
     | 
    
         
            +
                          approval: import_v48.z.never().optional()
         
     | 
| 
      
 6770 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6771 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6772 
     | 
    
         
            +
                          type: import_v48.z.literal("dynamic-tool"),
         
     | 
| 
      
 6773 
     | 
    
         
            +
                          toolName: import_v48.z.string(),
         
     | 
| 
      
 6774 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6775 
     | 
    
         
            +
                          state: import_v48.z.literal("input-available"),
         
     | 
| 
      
 6776 
     | 
    
         
            +
                          input: import_v48.z.unknown(),
         
     | 
| 
      
 6777 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6778 
     | 
    
         
            +
                          output: import_v48.z.never().optional(),
         
     | 
| 
      
 6779 
     | 
    
         
            +
                          errorText: import_v48.z.never().optional(),
         
     | 
| 
      
 6780 
     | 
    
         
            +
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
      
 6781 
     | 
    
         
            +
                          approval: import_v48.z.never().optional()
         
     | 
| 
      
 6782 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6783 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6784 
     | 
    
         
            +
                          type: import_v48.z.literal("dynamic-tool"),
         
     | 
| 
      
 6785 
     | 
    
         
            +
                          toolName: import_v48.z.string(),
         
     | 
| 
      
 6786 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6787 
     | 
    
         
            +
                          state: import_v48.z.literal("approval-requested"),
         
     | 
| 
      
 6788 
     | 
    
         
            +
                          input: import_v48.z.unknown(),
         
     | 
| 
      
 6789 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6790 
     | 
    
         
            +
                          output: import_v48.z.never().optional(),
         
     | 
| 
      
 6791 
     | 
    
         
            +
                          errorText: import_v48.z.never().optional(),
         
     | 
| 
      
 6792 
     | 
    
         
            +
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
      
 6793 
     | 
    
         
            +
                          approval: import_v48.z.object({
         
     | 
| 
      
 6794 
     | 
    
         
            +
                            id: import_v48.z.string(),
         
     | 
| 
      
 6795 
     | 
    
         
            +
                            approved: import_v48.z.never().optional(),
         
     | 
| 
      
 6796 
     | 
    
         
            +
                            reason: import_v48.z.never().optional()
         
     | 
| 
      
 6797 
     | 
    
         
            +
                          })
         
     | 
| 
      
 6798 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6799 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6800 
     | 
    
         
            +
                          type: import_v48.z.literal("dynamic-tool"),
         
     | 
| 
      
 6801 
     | 
    
         
            +
                          toolName: import_v48.z.string(),
         
     | 
| 
      
 6802 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6803 
     | 
    
         
            +
                          state: import_v48.z.literal("approval-responded"),
         
     | 
| 
      
 6804 
     | 
    
         
            +
                          input: import_v48.z.unknown(),
         
     | 
| 
      
 6805 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6806 
     | 
    
         
            +
                          output: import_v48.z.never().optional(),
         
     | 
| 
      
 6807 
     | 
    
         
            +
                          errorText: import_v48.z.never().optional(),
         
     | 
| 
      
 6808 
     | 
    
         
            +
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
      
 6809 
     | 
    
         
            +
                          approval: import_v48.z.object({
         
     | 
| 
      
 6810 
     | 
    
         
            +
                            id: import_v48.z.string(),
         
     | 
| 
      
 6811 
     | 
    
         
            +
                            approved: import_v48.z.boolean(),
         
     | 
| 
      
 6812 
     | 
    
         
            +
                            reason: import_v48.z.string().optional()
         
     | 
| 
      
 6813 
     | 
    
         
            +
                          })
         
     | 
| 
      
 6814 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6815 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6816 
     | 
    
         
            +
                          type: import_v48.z.literal("dynamic-tool"),
         
     | 
| 
      
 6817 
     | 
    
         
            +
                          toolName: import_v48.z.string(),
         
     | 
| 
      
 6818 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6819 
     | 
    
         
            +
                          state: import_v48.z.literal("output-available"),
         
     | 
| 
      
 6820 
     | 
    
         
            +
                          input: import_v48.z.unknown(),
         
     | 
| 
      
 6821 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6822 
     | 
    
         
            +
                          output: import_v48.z.unknown(),
         
     | 
| 
      
 6823 
     | 
    
         
            +
                          errorText: import_v48.z.never().optional(),
         
     | 
| 
      
 6824 
     | 
    
         
            +
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
      
 6825 
     | 
    
         
            +
                          preliminary: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6826 
     | 
    
         
            +
                          approval: import_v48.z.object({
         
     | 
| 
      
 6827 
     | 
    
         
            +
                            id: import_v48.z.string(),
         
     | 
| 
      
 6828 
     | 
    
         
            +
                            approved: import_v48.z.literal(true),
         
     | 
| 
      
 6829 
     | 
    
         
            +
                            reason: import_v48.z.string().optional()
         
     | 
| 
      
 6830 
     | 
    
         
            +
                          }).optional()
         
     | 
| 
      
 6831 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6832 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6833 
     | 
    
         
            +
                          type: import_v48.z.literal("dynamic-tool"),
         
     | 
| 
      
 6834 
     | 
    
         
            +
                          toolName: import_v48.z.string(),
         
     | 
| 
      
 6835 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6836 
     | 
    
         
            +
                          state: import_v48.z.literal("output-error"),
         
     | 
| 
      
 6837 
     | 
    
         
            +
                          input: import_v48.z.unknown(),
         
     | 
| 
      
 6838 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6839 
     | 
    
         
            +
                          output: import_v48.z.never().optional(),
         
     | 
| 
      
 6840 
     | 
    
         
            +
                          errorText: import_v48.z.string(),
         
     | 
| 
      
 6841 
     | 
    
         
            +
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
      
 6842 
     | 
    
         
            +
                          approval: import_v48.z.object({
         
     | 
| 
      
 6843 
     | 
    
         
            +
                            id: import_v48.z.string(),
         
     | 
| 
      
 6844 
     | 
    
         
            +
                            approved: import_v48.z.literal(true),
         
     | 
| 
      
 6845 
     | 
    
         
            +
                            reason: import_v48.z.string().optional()
         
     | 
| 
      
 6846 
     | 
    
         
            +
                          }).optional()
         
     | 
| 
      
 6847 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6848 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6849 
     | 
    
         
            +
                          type: import_v48.z.literal("dynamic-tool"),
         
     | 
| 
      
 6850 
     | 
    
         
            +
                          toolName: import_v48.z.string(),
         
     | 
| 
      
 6851 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6852 
     | 
    
         
            +
                          state: import_v48.z.literal("output-denied"),
         
     | 
| 
      
 6853 
     | 
    
         
            +
                          input: import_v48.z.unknown(),
         
     | 
| 
      
 6854 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6855 
     | 
    
         
            +
                          output: import_v48.z.never().optional(),
         
     | 
| 
      
 6856 
     | 
    
         
            +
                          errorText: import_v48.z.never().optional(),
         
     | 
| 
      
 6857 
     | 
    
         
            +
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
      
 6858 
     | 
    
         
            +
                          approval: import_v48.z.object({
         
     | 
| 
      
 6859 
     | 
    
         
            +
                            id: import_v48.z.string(),
         
     | 
| 
      
 6860 
     | 
    
         
            +
                            approved: import_v48.z.literal(false),
         
     | 
| 
      
 6861 
     | 
    
         
            +
                            reason: import_v48.z.string().optional()
         
     | 
| 
      
 6862 
     | 
    
         
            +
                          })
         
     | 
| 
      
 6863 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6864 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6865 
     | 
    
         
            +
                          type: import_v48.z.string().startsWith("tool-"),
         
     | 
| 
      
 6866 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6867 
     | 
    
         
            +
                          state: import_v48.z.literal("input-streaming"),
         
     | 
| 
      
 6868 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6869 
     | 
    
         
            +
                          input: import_v48.z.unknown().optional(),
         
     | 
| 
      
 6870 
     | 
    
         
            +
                          output: import_v48.z.never().optional(),
         
     | 
| 
      
 6871 
     | 
    
         
            +
                          errorText: import_v48.z.never().optional(),
         
     | 
| 
      
 6872 
     | 
    
         
            +
                          approval: import_v48.z.never().optional()
         
     | 
| 
      
 6873 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6874 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6875 
     | 
    
         
            +
                          type: import_v48.z.string().startsWith("tool-"),
         
     | 
| 
      
 6876 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6877 
     | 
    
         
            +
                          state: import_v48.z.literal("input-available"),
         
     | 
| 
      
 6878 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6879 
     | 
    
         
            +
                          input: import_v48.z.unknown(),
         
     | 
| 
      
 6880 
     | 
    
         
            +
                          output: import_v48.z.never().optional(),
         
     | 
| 
      
 6881 
     | 
    
         
            +
                          errorText: import_v48.z.never().optional(),
         
     | 
| 
      
 6882 
     | 
    
         
            +
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
      
 6883 
     | 
    
         
            +
                          approval: import_v48.z.never().optional()
         
     | 
| 
      
 6884 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6885 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6886 
     | 
    
         
            +
                          type: import_v48.z.string().startsWith("tool-"),
         
     | 
| 
      
 6887 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6888 
     | 
    
         
            +
                          state: import_v48.z.literal("approval-requested"),
         
     | 
| 
      
 6889 
     | 
    
         
            +
                          input: import_v48.z.unknown(),
         
     | 
| 
      
 6890 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6891 
     | 
    
         
            +
                          output: import_v48.z.never().optional(),
         
     | 
| 
      
 6892 
     | 
    
         
            +
                          errorText: import_v48.z.never().optional(),
         
     | 
| 
      
 6893 
     | 
    
         
            +
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
      
 6894 
     | 
    
         
            +
                          approval: import_v48.z.object({
         
     | 
| 
      
 6895 
     | 
    
         
            +
                            id: import_v48.z.string(),
         
     | 
| 
      
 6896 
     | 
    
         
            +
                            approved: import_v48.z.never().optional(),
         
     | 
| 
      
 6897 
     | 
    
         
            +
                            reason: import_v48.z.never().optional()
         
     | 
| 
      
 6898 
     | 
    
         
            +
                          })
         
     | 
| 
      
 6899 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6900 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6901 
     | 
    
         
            +
                          type: import_v48.z.string().startsWith("tool-"),
         
     | 
| 
      
 6902 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6903 
     | 
    
         
            +
                          state: import_v48.z.literal("approval-responded"),
         
     | 
| 
      
 6904 
     | 
    
         
            +
                          input: import_v48.z.unknown(),
         
     | 
| 
      
 6905 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6906 
     | 
    
         
            +
                          output: import_v48.z.never().optional(),
         
     | 
| 
      
 6907 
     | 
    
         
            +
                          errorText: import_v48.z.never().optional(),
         
     | 
| 
      
 6908 
     | 
    
         
            +
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
      
 6909 
     | 
    
         
            +
                          approval: import_v48.z.object({
         
     | 
| 
      
 6910 
     | 
    
         
            +
                            id: import_v48.z.string(),
         
     | 
| 
      
 6911 
     | 
    
         
            +
                            approved: import_v48.z.boolean(),
         
     | 
| 
      
 6912 
     | 
    
         
            +
                            reason: import_v48.z.string().optional()
         
     | 
| 
      
 6913 
     | 
    
         
            +
                          })
         
     | 
| 
      
 6914 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6915 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6916 
     | 
    
         
            +
                          type: import_v48.z.string().startsWith("tool-"),
         
     | 
| 
      
 6917 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6918 
     | 
    
         
            +
                          state: import_v48.z.literal("output-available"),
         
     | 
| 
      
 6919 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6920 
     | 
    
         
            +
                          input: import_v48.z.unknown(),
         
     | 
| 
      
 6921 
     | 
    
         
            +
                          output: import_v48.z.unknown(),
         
     | 
| 
      
 6922 
     | 
    
         
            +
                          errorText: import_v48.z.never().optional(),
         
     | 
| 
      
 6923 
     | 
    
         
            +
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
      
 6924 
     | 
    
         
            +
                          preliminary: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6925 
     | 
    
         
            +
                          approval: import_v48.z.object({
         
     | 
| 
      
 6926 
     | 
    
         
            +
                            id: import_v48.z.string(),
         
     | 
| 
      
 6927 
     | 
    
         
            +
                            approved: import_v48.z.literal(true),
         
     | 
| 
      
 6928 
     | 
    
         
            +
                            reason: import_v48.z.string().optional()
         
     | 
| 
      
 6929 
     | 
    
         
            +
                          }).optional()
         
     | 
| 
      
 6930 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6931 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6932 
     | 
    
         
            +
                          type: import_v48.z.string().startsWith("tool-"),
         
     | 
| 
      
 6933 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6934 
     | 
    
         
            +
                          state: import_v48.z.literal("output-error"),
         
     | 
| 
      
 6935 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6936 
     | 
    
         
            +
                          input: import_v48.z.unknown(),
         
     | 
| 
      
 6937 
     | 
    
         
            +
                          output: import_v48.z.never().optional(),
         
     | 
| 
      
 6938 
     | 
    
         
            +
                          errorText: import_v48.z.string(),
         
     | 
| 
      
 6939 
     | 
    
         
            +
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
      
 6940 
     | 
    
         
            +
                          approval: import_v48.z.object({
         
     | 
| 
      
 6941 
     | 
    
         
            +
                            id: import_v48.z.string(),
         
     | 
| 
      
 6942 
     | 
    
         
            +
                            approved: import_v48.z.literal(true),
         
     | 
| 
      
 6943 
     | 
    
         
            +
                            reason: import_v48.z.string().optional()
         
     | 
| 
      
 6944 
     | 
    
         
            +
                          }).optional()
         
     | 
| 
      
 6945 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 6946 
     | 
    
         
            +
                        import_v48.z.object({
         
     | 
| 
      
 6947 
     | 
    
         
            +
                          type: import_v48.z.string().startsWith("tool-"),
         
     | 
| 
      
 6948 
     | 
    
         
            +
                          toolCallId: import_v48.z.string(),
         
     | 
| 
      
 6949 
     | 
    
         
            +
                          state: import_v48.z.literal("output-denied"),
         
     | 
| 
      
 6950 
     | 
    
         
            +
                          providerExecuted: import_v48.z.boolean().optional(),
         
     | 
| 
      
 6951 
     | 
    
         
            +
                          input: import_v48.z.unknown(),
         
     | 
| 
      
 6952 
     | 
    
         
            +
                          output: import_v48.z.never().optional(),
         
     | 
| 
      
 6953 
     | 
    
         
            +
                          errorText: import_v48.z.never().optional(),
         
     | 
| 
      
 6954 
     | 
    
         
            +
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
      
 6955 
     | 
    
         
            +
                          approval: import_v48.z.object({
         
     | 
| 
      
 6956 
     | 
    
         
            +
                            id: import_v48.z.string(),
         
     | 
| 
      
 6957 
     | 
    
         
            +
                            approved: import_v48.z.literal(false),
         
     | 
| 
      
 6958 
     | 
    
         
            +
                            reason: import_v48.z.string().optional()
         
     | 
| 
      
 6959 
     | 
    
         
            +
                          })
         
     | 
| 
      
 6960 
     | 
    
         
            +
                        })
         
     | 
| 
      
 6961 
     | 
    
         
            +
                      ])
         
     | 
| 
      
 6962 
     | 
    
         
            +
                    )
         
     | 
| 
      
 6963 
     | 
    
         
            +
                  })
         
     | 
| 
      
 6964 
     | 
    
         
            +
                )
         
     | 
| 
      
 6965 
     | 
    
         
            +
              )
         
     | 
| 
      
 6966 
     | 
    
         
            +
            );
         
     | 
| 
      
 6967 
     | 
    
         
            +
            async function safeValidateUIMessages({
         
     | 
| 
      
 6968 
     | 
    
         
            +
              messages,
         
     | 
| 
      
 6969 
     | 
    
         
            +
              metadataSchema,
         
     | 
| 
      
 6970 
     | 
    
         
            +
              dataSchemas,
         
     | 
| 
      
 6971 
     | 
    
         
            +
              tools
         
     | 
| 
      
 6972 
     | 
    
         
            +
            }) {
         
     | 
| 
      
 6973 
     | 
    
         
            +
              try {
         
     | 
| 
      
 6974 
     | 
    
         
            +
                if (messages == null) {
         
     | 
| 
      
 6975 
     | 
    
         
            +
                  return {
         
     | 
| 
      
 6976 
     | 
    
         
            +
                    success: false,
         
     | 
| 
      
 6977 
     | 
    
         
            +
                    error: new InvalidArgumentError({
         
     | 
| 
      
 6978 
     | 
    
         
            +
                      parameter: "messages",
         
     | 
| 
      
 6979 
     | 
    
         
            +
                      value: messages,
         
     | 
| 
      
 6980 
     | 
    
         
            +
                      message: "messages parameter must be provided"
         
     | 
| 
      
 6981 
     | 
    
         
            +
                    })
         
     | 
| 
      
 6982 
     | 
    
         
            +
                  };
         
     | 
| 
      
 6983 
     | 
    
         
            +
                }
         
     | 
| 
      
 6984 
     | 
    
         
            +
                const validatedMessages = await (0, import_provider_utils18.validateTypes)({
         
     | 
| 
      
 6985 
     | 
    
         
            +
                  value: messages,
         
     | 
| 
      
 6986 
     | 
    
         
            +
                  schema: uiMessagesSchema
         
     | 
| 
      
 6987 
     | 
    
         
            +
                });
         
     | 
| 
      
 6988 
     | 
    
         
            +
                if (metadataSchema) {
         
     | 
| 
      
 6989 
     | 
    
         
            +
                  for (const message of validatedMessages) {
         
     | 
| 
      
 6990 
     | 
    
         
            +
                    await (0, import_provider_utils18.validateTypes)({
         
     | 
| 
      
 6991 
     | 
    
         
            +
                      value: message.metadata,
         
     | 
| 
      
 6992 
     | 
    
         
            +
                      schema: metadataSchema
         
     | 
| 
      
 6993 
     | 
    
         
            +
                    });
         
     | 
| 
      
 6994 
     | 
    
         
            +
                  }
         
     | 
| 
      
 6995 
     | 
    
         
            +
                }
         
     | 
| 
      
 6996 
     | 
    
         
            +
                if (dataSchemas) {
         
     | 
| 
      
 6997 
     | 
    
         
            +
                  for (const message of validatedMessages) {
         
     | 
| 
      
 6998 
     | 
    
         
            +
                    const dataParts = message.parts.filter(
         
     | 
| 
      
 6999 
     | 
    
         
            +
                      (part) => part.type.startsWith("data-")
         
     | 
| 
      
 7000 
     | 
    
         
            +
                    );
         
     | 
| 
      
 7001 
     | 
    
         
            +
                    for (const dataPart of dataParts) {
         
     | 
| 
      
 7002 
     | 
    
         
            +
                      const dataName = dataPart.type.slice(5);
         
     | 
| 
      
 7003 
     | 
    
         
            +
                      const dataSchema = dataSchemas[dataName];
         
     | 
| 
      
 7004 
     | 
    
         
            +
                      if (!dataSchema) {
         
     | 
| 
      
 7005 
     | 
    
         
            +
                        return {
         
     | 
| 
      
 7006 
     | 
    
         
            +
                          success: false,
         
     | 
| 
      
 7007 
     | 
    
         
            +
                          error: new import_provider25.TypeValidationError({
         
     | 
| 
      
 7008 
     | 
    
         
            +
                            value: dataPart.data,
         
     | 
| 
      
 7009 
     | 
    
         
            +
                            cause: `No data schema found for data part ${dataName}`
         
     | 
| 
      
 7010 
     | 
    
         
            +
                          })
         
     | 
| 
      
 7011 
     | 
    
         
            +
                        };
         
     | 
| 
      
 7012 
     | 
    
         
            +
                      }
         
     | 
| 
      
 7013 
     | 
    
         
            +
                      await (0, import_provider_utils18.validateTypes)({
         
     | 
| 
      
 7014 
     | 
    
         
            +
                        value: dataPart.data,
         
     | 
| 
      
 7015 
     | 
    
         
            +
                        schema: dataSchema
         
     | 
| 
      
 7016 
     | 
    
         
            +
                      });
         
     | 
| 
      
 7017 
     | 
    
         
            +
                    }
         
     | 
| 
      
 7018 
     | 
    
         
            +
                  }
         
     | 
| 
      
 7019 
     | 
    
         
            +
                }
         
     | 
| 
      
 7020 
     | 
    
         
            +
                if (tools) {
         
     | 
| 
      
 7021 
     | 
    
         
            +
                  for (const message of validatedMessages) {
         
     | 
| 
      
 7022 
     | 
    
         
            +
                    const toolParts = message.parts.filter(
         
     | 
| 
      
 7023 
     | 
    
         
            +
                      (part) => part.type.startsWith("tool-")
         
     | 
| 
      
 7024 
     | 
    
         
            +
                    );
         
     | 
| 
      
 7025 
     | 
    
         
            +
                    for (const toolPart of toolParts) {
         
     | 
| 
      
 7026 
     | 
    
         
            +
                      const toolName = toolPart.type.slice(5);
         
     | 
| 
      
 7027 
     | 
    
         
            +
                      const tool3 = tools[toolName];
         
     | 
| 
      
 7028 
     | 
    
         
            +
                      if (!tool3) {
         
     | 
| 
      
 7029 
     | 
    
         
            +
                        return {
         
     | 
| 
      
 7030 
     | 
    
         
            +
                          success: false,
         
     | 
| 
      
 7031 
     | 
    
         
            +
                          error: new import_provider25.TypeValidationError({
         
     | 
| 
      
 7032 
     | 
    
         
            +
                            value: toolPart.input,
         
     | 
| 
      
 7033 
     | 
    
         
            +
                            cause: `No tool schema found for tool part ${toolName}`
         
     | 
| 
      
 7034 
     | 
    
         
            +
                          })
         
     | 
| 
      
 7035 
     | 
    
         
            +
                        };
         
     | 
| 
      
 7036 
     | 
    
         
            +
                      }
         
     | 
| 
      
 7037 
     | 
    
         
            +
                      if (toolPart.state === "input-available" || toolPart.state === "output-available" || toolPart.state === "output-error") {
         
     | 
| 
      
 7038 
     | 
    
         
            +
                        await (0, import_provider_utils18.validateTypes)({
         
     | 
| 
      
 7039 
     | 
    
         
            +
                          value: toolPart.input,
         
     | 
| 
      
 7040 
     | 
    
         
            +
                          schema: tool3.inputSchema
         
     | 
| 
      
 7041 
     | 
    
         
            +
                        });
         
     | 
| 
      
 7042 
     | 
    
         
            +
                      }
         
     | 
| 
      
 7043 
     | 
    
         
            +
                      if (toolPart.state === "output-available" && tool3.outputSchema) {
         
     | 
| 
      
 7044 
     | 
    
         
            +
                        await (0, import_provider_utils18.validateTypes)({
         
     | 
| 
      
 7045 
     | 
    
         
            +
                          value: toolPart.output,
         
     | 
| 
      
 7046 
     | 
    
         
            +
                          schema: tool3.outputSchema
         
     | 
| 
      
 7047 
     | 
    
         
            +
                        });
         
     | 
| 
      
 7048 
     | 
    
         
            +
                      }
         
     | 
| 
      
 7049 
     | 
    
         
            +
                    }
         
     | 
| 
      
 7050 
     | 
    
         
            +
                  }
         
     | 
| 
      
 7051 
     | 
    
         
            +
                }
         
     | 
| 
      
 7052 
     | 
    
         
            +
                return {
         
     | 
| 
      
 7053 
     | 
    
         
            +
                  success: true,
         
     | 
| 
      
 7054 
     | 
    
         
            +
                  data: validatedMessages
         
     | 
| 
      
 7055 
     | 
    
         
            +
                };
         
     | 
| 
      
 7056 
     | 
    
         
            +
              } catch (error) {
         
     | 
| 
      
 7057 
     | 
    
         
            +
                const err = error;
         
     | 
| 
      
 7058 
     | 
    
         
            +
                return {
         
     | 
| 
      
 7059 
     | 
    
         
            +
                  success: false,
         
     | 
| 
      
 7060 
     | 
    
         
            +
                  error: err
         
     | 
| 
      
 7061 
     | 
    
         
            +
                };
         
     | 
| 
      
 7062 
     | 
    
         
            +
              }
         
     | 
| 
      
 7063 
     | 
    
         
            +
            }
         
     | 
| 
      
 7064 
     | 
    
         
            +
            async function validateUIMessages({
         
     | 
| 
      
 7065 
     | 
    
         
            +
              messages,
         
     | 
| 
      
 7066 
     | 
    
         
            +
              metadataSchema,
         
     | 
| 
      
 7067 
     | 
    
         
            +
              dataSchemas,
         
     | 
| 
      
 7068 
     | 
    
         
            +
              tools
         
     | 
| 
      
 7069 
     | 
    
         
            +
            }) {
         
     | 
| 
      
 7070 
     | 
    
         
            +
              const response = await safeValidateUIMessages({
         
     | 
| 
      
 7071 
     | 
    
         
            +
                messages,
         
     | 
| 
      
 7072 
     | 
    
         
            +
                metadataSchema,
         
     | 
| 
      
 7073 
     | 
    
         
            +
                dataSchemas,
         
     | 
| 
      
 7074 
     | 
    
         
            +
                tools
         
     | 
| 
      
 7075 
     | 
    
         
            +
              });
         
     | 
| 
      
 7076 
     | 
    
         
            +
              if (!response.success)
         
     | 
| 
      
 7077 
     | 
    
         
            +
                throw response.error;
         
     | 
| 
      
 7078 
     | 
    
         
            +
              return response.data;
         
     | 
| 
      
 7079 
     | 
    
         
            +
            }
         
     | 
| 
      
 7080 
     | 
    
         
            +
             
     | 
| 
      
 7081 
     | 
    
         
            +
            // src/agent/create-agent-stream-response.ts
         
     | 
| 
      
 7082 
     | 
    
         
            +
            async function createAgentStreamResponse({
         
     | 
| 
      
 7083 
     | 
    
         
            +
              agent,
         
     | 
| 
      
 7084 
     | 
    
         
            +
              messages
         
     | 
| 
      
 7085 
     | 
    
         
            +
            }) {
         
     | 
| 
      
 7086 
     | 
    
         
            +
              const validatedMessages = await validateUIMessages({
         
     | 
| 
      
 7087 
     | 
    
         
            +
                messages,
         
     | 
| 
      
 7088 
     | 
    
         
            +
                tools: agent.tools
         
     | 
| 
      
 7089 
     | 
    
         
            +
              });
         
     | 
| 
      
 7090 
     | 
    
         
            +
              const modelMessages = convertToModelMessages(validatedMessages, {
         
     | 
| 
      
 7091 
     | 
    
         
            +
                tools: agent.tools
         
     | 
| 
      
 7092 
     | 
    
         
            +
              });
         
     | 
| 
      
 7093 
     | 
    
         
            +
              const result = agent.stream({ prompt: modelMessages });
         
     | 
| 
      
 7094 
     | 
    
         
            +
              return createUIMessageStreamResponse({
         
     | 
| 
      
 7095 
     | 
    
         
            +
                stream: result.toUIMessageStream()
         
     | 
| 
      
 7096 
     | 
    
         
            +
              });
         
     | 
| 
      
 7097 
     | 
    
         
            +
            }
         
     | 
| 
      
 7098 
     | 
    
         
            +
             
     | 
| 
      
 7099 
     | 
    
         
            +
            // src/embed/embed.ts
         
     | 
| 
      
 7100 
     | 
    
         
            +
            var import_provider_utils19 = require("@ai-sdk/provider-utils");
         
     | 
| 
      
 7101 
     | 
    
         
            +
            async function embed({
         
     | 
| 
      
 7102 
     | 
    
         
            +
              model: modelArg,
         
     | 
| 
      
 7103 
     | 
    
         
            +
              value,
         
     | 
| 
      
 7104 
     | 
    
         
            +
              providerOptions,
         
     | 
| 
      
 7105 
     | 
    
         
            +
              maxRetries: maxRetriesArg,
         
     | 
| 
      
 7106 
     | 
    
         
            +
              abortSignal,
         
     | 
| 
      
 7107 
     | 
    
         
            +
              headers,
         
     | 
| 
      
 7108 
     | 
    
         
            +
              experimental_telemetry: telemetry
         
     | 
| 
      
 7109 
     | 
    
         
            +
            }) {
         
     | 
| 
      
 7110 
     | 
    
         
            +
              const model = resolveEmbeddingModel(modelArg);
         
     | 
| 
      
 7111 
     | 
    
         
            +
              const { maxRetries, retry } = prepareRetries({
         
     | 
| 
      
 7112 
     | 
    
         
            +
                maxRetries: maxRetriesArg,
         
     | 
| 
      
 7113 
     | 
    
         
            +
                abortSignal
         
     | 
| 
      
 7114 
     | 
    
         
            +
              });
         
     | 
| 
      
 7115 
     | 
    
         
            +
              const headersWithUserAgent = (0, import_provider_utils19.withUserAgentSuffix)(
         
     | 
| 
      
 7116 
     | 
    
         
            +
                headers != null ? headers : {},
         
     | 
| 
      
 7117 
     | 
    
         
            +
                `ai/${VERSION}`
         
     | 
| 
      
 7118 
     | 
    
         
            +
              );
         
     | 
| 
      
 7119 
     | 
    
         
            +
              const baseTelemetryAttributes = getBaseTelemetryAttributes({
         
     | 
| 
      
 7120 
     | 
    
         
            +
                model,
         
     | 
| 
      
 7121 
     | 
    
         
            +
                telemetry,
         
     | 
| 
      
 7122 
     | 
    
         
            +
                headers: headersWithUserAgent,
         
     | 
| 
      
 7123 
     | 
    
         
            +
                settings: { maxRetries }
         
     | 
| 
      
 7124 
     | 
    
         
            +
              });
         
     | 
| 
      
 7125 
     | 
    
         
            +
              const tracer = getTracer(telemetry);
         
     | 
| 
      
 7126 
     | 
    
         
            +
              return recordSpan({
         
     | 
| 
      
 7127 
     | 
    
         
            +
                name: "ai.embed",
         
     | 
| 
      
 7128 
     | 
    
         
            +
                attributes: selectTelemetryAttributes({
         
     | 
| 
      
 7129 
     | 
    
         
            +
                  telemetry,
         
     | 
| 
      
 7130 
     | 
    
         
            +
                  attributes: {
         
     | 
| 
      
 7131 
     | 
    
         
            +
                    ...assembleOperationName({ operationId: "ai.embed", telemetry }),
         
     | 
| 
      
 7132 
     | 
    
         
            +
                    ...baseTelemetryAttributes,
         
     | 
| 
      
 7133 
     | 
    
         
            +
                    "ai.value": { input: () => JSON.stringify(value) }
         
     | 
| 
      
 7134 
     | 
    
         
            +
                  }
         
     | 
| 
      
 7135 
     | 
    
         
            +
                }),
         
     | 
| 
      
 7136 
     | 
    
         
            +
                tracer,
         
     | 
| 
      
 7137 
     | 
    
         
            +
                fn: async (span) => {
         
     | 
| 
      
 7138 
     | 
    
         
            +
                  const { embedding, usage, response, providerMetadata } = await retry(
         
     | 
| 
       6617 
7139 
     | 
    
         
             
                    () => (
         
     | 
| 
       6618 
7140 
     | 
    
         
             
                      // nested spans to align with the embedMany telemetry data:
         
     | 
| 
       6619 
7141 
     | 
    
         
             
                      recordSpan({
         
     | 
| 
         @@ -6694,7 +7216,7 @@ var DefaultEmbedResult = class { 
     | 
|
| 
       6694 
7216 
     | 
    
         
             
            };
         
     | 
| 
       6695 
7217 
     | 
    
         | 
| 
       6696 
7218 
     | 
    
         
             
            // src/embed/embed-many.ts
         
     | 
| 
       6697 
     | 
    
         
            -
            var  
     | 
| 
      
 7219 
     | 
    
         
            +
            var import_provider_utils20 = require("@ai-sdk/provider-utils");
         
     | 
| 
       6698 
7220 
     | 
    
         | 
| 
       6699 
7221 
     | 
    
         
             
            // src/util/split-array.ts
         
     | 
| 
       6700 
7222 
     | 
    
         
             
            function splitArray(array, chunkSize) {
         
     | 
| 
         @@ -6724,7 +7246,7 @@ async function embedMany({ 
     | 
|
| 
       6724 
7246 
     | 
    
         
             
                maxRetries: maxRetriesArg,
         
     | 
| 
       6725 
7247 
     | 
    
         
             
                abortSignal
         
     | 
| 
       6726 
7248 
     | 
    
         
             
              });
         
     | 
| 
       6727 
     | 
    
         
            -
              const headersWithUserAgent = (0,  
     | 
| 
      
 7249 
     | 
    
         
            +
              const headersWithUserAgent = (0, import_provider_utils20.withUserAgentSuffix)(
         
     | 
| 
       6728 
7250 
     | 
    
         
             
                headers != null ? headers : {},
         
     | 
| 
       6729 
7251 
     | 
    
         
             
                `ai/${VERSION}`
         
     | 
| 
       6730 
7252 
     | 
    
         
             
              );
         
     | 
| 
         @@ -6943,7 +7465,7 @@ var DefaultEmbedManyResult = class { 
     | 
|
| 
       6943 
7465 
     | 
    
         
             
            };
         
     | 
| 
       6944 
7466 
     | 
    
         | 
| 
       6945 
7467 
     | 
    
         
             
            // src/generate-image/generate-image.ts
         
     | 
| 
       6946 
     | 
    
         
            -
            var  
     | 
| 
      
 7468 
     | 
    
         
            +
            var import_provider_utils21 = require("@ai-sdk/provider-utils");
         
     | 
| 
       6947 
7469 
     | 
    
         
             
            async function generateImage({
         
     | 
| 
       6948 
7470 
     | 
    
         
             
              model,
         
     | 
| 
       6949 
7471 
     | 
    
         
             
              prompt,
         
     | 
| 
         @@ -6965,7 +7487,7 @@ async function generateImage({ 
     | 
|
| 
       6965 
7487 
     | 
    
         
             
                  modelId: model.modelId
         
     | 
| 
       6966 
7488 
     | 
    
         
             
                });
         
     | 
| 
       6967 
7489 
     | 
    
         
             
              }
         
     | 
| 
       6968 
     | 
    
         
            -
              const headersWithUserAgent = (0,  
     | 
| 
      
 7490 
     | 
    
         
            +
              const headersWithUserAgent = (0, import_provider_utils21.withUserAgentSuffix)(
         
     | 
| 
       6969 
7491 
     | 
    
         
             
                headers != null ? headers : {},
         
     | 
| 
       6970 
7492 
     | 
    
         
             
                `ai/${VERSION}`
         
     | 
| 
       6971 
7493 
     | 
    
         
             
              );
         
     | 
| 
         @@ -7061,7 +7583,7 @@ async function invokeModelMaxImagesPerCall(model) { 
     | 
|
| 
       7061 
7583 
     | 
    
         
             
            }
         
     | 
| 
       7062 
7584 
     | 
    
         | 
| 
       7063 
7585 
     | 
    
         
             
            // src/generate-object/generate-object.ts
         
     | 
| 
       7064 
     | 
    
         
            -
            var  
     | 
| 
      
 7586 
     | 
    
         
            +
            var import_provider_utils24 = require("@ai-sdk/provider-utils");
         
     | 
| 
       7065 
7587 
     | 
    
         | 
| 
       7066 
7588 
     | 
    
         
             
            // src/generate-text/extract-reasoning-content.ts
         
     | 
| 
       7067 
7589 
     | 
    
         
             
            function extractReasoningContent(content) {
         
     | 
| 
         @@ -7072,8 +7594,8 @@ function extractReasoningContent(content) { 
     | 
|
| 
       7072 
7594 
     | 
    
         
             
            }
         
     | 
| 
       7073 
7595 
     | 
    
         | 
| 
       7074 
7596 
     | 
    
         
             
            // src/generate-object/output-strategy.ts
         
     | 
| 
       7075 
     | 
    
         
            -
            var  
     | 
| 
       7076 
     | 
    
         
            -
            var  
     | 
| 
      
 7597 
     | 
    
         
            +
            var import_provider26 = require("@ai-sdk/provider");
         
     | 
| 
      
 7598 
     | 
    
         
            +
            var import_provider_utils22 = require("@ai-sdk/provider-utils");
         
     | 
| 
       7077 
7599 
     | 
    
         
             
            var noSchemaOutputStrategy = {
         
     | 
| 
       7078 
7600 
     | 
    
         
             
              type: "no-schema",
         
     | 
| 
       7079 
7601 
     | 
    
         
             
              jsonSchema: async () => void 0,
         
     | 
| 
         @@ -7093,7 +7615,7 @@ var noSchemaOutputStrategy = { 
     | 
|
| 
       7093 
7615 
     | 
    
         
             
                } : { success: true, value };
         
     | 
| 
       7094 
7616 
     | 
    
         
             
              },
         
     | 
| 
       7095 
7617 
     | 
    
         
             
              createElementStream() {
         
     | 
| 
       7096 
     | 
    
         
            -
                throw new  
     | 
| 
      
 7618 
     | 
    
         
            +
                throw new import_provider26.UnsupportedFunctionalityError({
         
     | 
| 
       7097 
7619 
     | 
    
         
             
                  functionality: "element streams in no-schema mode"
         
     | 
| 
       7098 
7620 
     | 
    
         
             
                });
         
     | 
| 
       7099 
7621 
     | 
    
         
             
              }
         
     | 
| 
         @@ -7112,10 +7634,10 @@ var objectOutputStrategy = (schema) => ({ 
     | 
|
| 
       7112 
7634 
     | 
    
         
             
                };
         
     | 
| 
       7113 
7635 
     | 
    
         
             
              },
         
     | 
| 
       7114 
7636 
     | 
    
         
             
              async validateFinalResult(value) {
         
     | 
| 
       7115 
     | 
    
         
            -
                return (0,  
     | 
| 
      
 7637 
     | 
    
         
            +
                return (0, import_provider_utils22.safeValidateTypes)({ value, schema });
         
     | 
| 
       7116 
7638 
     | 
    
         
             
              },
         
     | 
| 
       7117 
7639 
     | 
    
         
             
              createElementStream() {
         
     | 
| 
       7118 
     | 
    
         
            -
                throw new  
     | 
| 
      
 7640 
     | 
    
         
            +
                throw new import_provider26.UnsupportedFunctionalityError({
         
     | 
| 
       7119 
7641 
     | 
    
         
             
                  functionality: "element streams in object mode"
         
     | 
| 
       7120 
7642 
     | 
    
         
             
                });
         
     | 
| 
       7121 
7643 
     | 
    
         
             
              }
         
     | 
| 
         @@ -7145,10 +7667,10 @@ var arrayOutputStrategy = (schema) => { 
     | 
|
| 
       7145 
7667 
     | 
    
         
             
                  isFinalDelta
         
     | 
| 
       7146 
7668 
     | 
    
         
             
                }) {
         
     | 
| 
       7147 
7669 
     | 
    
         
             
                  var _a17;
         
     | 
| 
       7148 
     | 
    
         
            -
                  if (!(0,  
     | 
| 
      
 7670 
     | 
    
         
            +
                  if (!(0, import_provider26.isJSONObject)(value) || !(0, import_provider26.isJSONArray)(value.elements)) {
         
     | 
| 
       7149 
7671 
     | 
    
         
             
                    return {
         
     | 
| 
       7150 
7672 
     | 
    
         
             
                      success: false,
         
     | 
| 
       7151 
     | 
    
         
            -
                      error: new  
     | 
| 
      
 7673 
     | 
    
         
            +
                      error: new import_provider26.TypeValidationError({
         
     | 
| 
       7152 
7674 
     | 
    
         
             
                        value,
         
     | 
| 
       7153 
7675 
     | 
    
         
             
                        cause: "value must be an object that contains an array of elements"
         
     | 
| 
       7154 
7676 
     | 
    
         
             
                      })
         
     | 
| 
         @@ -7158,7 +7680,7 @@ var arrayOutputStrategy = (schema) => { 
     | 
|
| 
       7158 
7680 
     | 
    
         
             
                  const resultArray = [];
         
     | 
| 
       7159 
7681 
     | 
    
         
             
                  for (let i = 0; i < inputArray.length; i++) {
         
     | 
| 
       7160 
7682 
     | 
    
         
             
                    const element = inputArray[i];
         
     | 
| 
       7161 
     | 
    
         
            -
                    const result = await (0,  
     | 
| 
      
 7683 
     | 
    
         
            +
                    const result = await (0, import_provider_utils22.safeValidateTypes)({ value: element, schema });
         
     | 
| 
       7162 
7684 
     | 
    
         
             
                    if (i === inputArray.length - 1 && !isFinalDelta) {
         
     | 
| 
       7163 
7685 
     | 
    
         
             
                      continue;
         
     | 
| 
       7164 
7686 
     | 
    
         
             
                    }
         
     | 
| 
         @@ -7188,10 +7710,10 @@ var arrayOutputStrategy = (schema) => { 
     | 
|
| 
       7188 
7710 
     | 
    
         
             
                  };
         
     | 
| 
       7189 
7711 
     | 
    
         
             
                },
         
     | 
| 
       7190 
7712 
     | 
    
         
             
                async validateFinalResult(value) {
         
     | 
| 
       7191 
     | 
    
         
            -
                  if (!(0,  
     | 
| 
      
 7713 
     | 
    
         
            +
                  if (!(0, import_provider26.isJSONObject)(value) || !(0, import_provider26.isJSONArray)(value.elements)) {
         
     | 
| 
       7192 
7714 
     | 
    
         
             
                    return {
         
     | 
| 
       7193 
7715 
     | 
    
         
             
                      success: false,
         
     | 
| 
       7194 
     | 
    
         
            -
                      error: new  
     | 
| 
      
 7716 
     | 
    
         
            +
                      error: new import_provider26.TypeValidationError({
         
     | 
| 
       7195 
7717 
     | 
    
         
             
                        value,
         
     | 
| 
       7196 
7718 
     | 
    
         
             
                        cause: "value must be an object that contains an array of elements"
         
     | 
| 
       7197 
7719 
     | 
    
         
             
                      })
         
     | 
| 
         @@ -7199,7 +7721,7 @@ var arrayOutputStrategy = (schema) => { 
     | 
|
| 
       7199 
7721 
     | 
    
         
             
                  }
         
     | 
| 
       7200 
7722 
     | 
    
         
             
                  const inputArray = value.elements;
         
     | 
| 
       7201 
7723 
     | 
    
         
             
                  for (const element of inputArray) {
         
     | 
| 
       7202 
     | 
    
         
            -
                    const result = await (0,  
     | 
| 
      
 7724 
     | 
    
         
            +
                    const result = await (0, import_provider_utils22.safeValidateTypes)({ value: element, schema });
         
     | 
| 
       7203 
7725 
     | 
    
         
             
                    if (!result.success) {
         
     | 
| 
       7204 
7726 
     | 
    
         
             
                      return result;
         
     | 
| 
       7205 
7727 
     | 
    
         
             
                    }
         
     | 
| 
         @@ -7254,10 +7776,10 @@ var enumOutputStrategy = (enumValues) => { 
     | 
|
| 
       7254 
7776 
     | 
    
         
             
                  additionalProperties: false
         
     | 
| 
       7255 
7777 
     | 
    
         
             
                }),
         
     | 
| 
       7256 
7778 
     | 
    
         
             
                async validateFinalResult(value) {
         
     | 
| 
       7257 
     | 
    
         
            -
                  if (!(0,  
     | 
| 
      
 7779 
     | 
    
         
            +
                  if (!(0, import_provider26.isJSONObject)(value) || typeof value.result !== "string") {
         
     | 
| 
       7258 
7780 
     | 
    
         
             
                    return {
         
     | 
| 
       7259 
7781 
     | 
    
         
             
                      success: false,
         
     | 
| 
       7260 
     | 
    
         
            -
                      error: new  
     | 
| 
      
 7782 
     | 
    
         
            +
                      error: new import_provider26.TypeValidationError({
         
     | 
| 
       7261 
7783 
     | 
    
         
             
                        value,
         
     | 
| 
       7262 
7784 
     | 
    
         
             
                        cause: 'value must be an object that contains a string in the "result" property.'
         
     | 
| 
       7263 
7785 
     | 
    
         
             
                      })
         
     | 
| 
         @@ -7266,17 +7788,17 @@ var enumOutputStrategy = (enumValues) => { 
     | 
|
| 
       7266 
7788 
     | 
    
         
             
                  const result = value.result;
         
     | 
| 
       7267 
7789 
     | 
    
         
             
                  return enumValues.includes(result) ? { success: true, value: result } : {
         
     | 
| 
       7268 
7790 
     | 
    
         
             
                    success: false,
         
     | 
| 
       7269 
     | 
    
         
            -
                    error: new  
     | 
| 
      
 7791 
     | 
    
         
            +
                    error: new import_provider26.TypeValidationError({
         
     | 
| 
       7270 
7792 
     | 
    
         
             
                      value,
         
     | 
| 
       7271 
7793 
     | 
    
         
             
                      cause: "value must be a string in the enum"
         
     | 
| 
       7272 
7794 
     | 
    
         
             
                    })
         
     | 
| 
       7273 
7795 
     | 
    
         
             
                  };
         
     | 
| 
       7274 
7796 
     | 
    
         
             
                },
         
     | 
| 
       7275 
7797 
     | 
    
         
             
                async validatePartialResult({ value, textDelta }) {
         
     | 
| 
       7276 
     | 
    
         
            -
                  if (!(0,  
     | 
| 
      
 7798 
     | 
    
         
            +
                  if (!(0, import_provider26.isJSONObject)(value) || typeof value.result !== "string") {
         
     | 
| 
       7277 
7799 
     | 
    
         
             
                    return {
         
     | 
| 
       7278 
7800 
     | 
    
         
             
                      success: false,
         
     | 
| 
       7279 
     | 
    
         
            -
                      error: new  
     | 
| 
      
 7801 
     | 
    
         
            +
                      error: new import_provider26.TypeValidationError({
         
     | 
| 
       7280 
7802 
     | 
    
         
             
                        value,
         
     | 
| 
       7281 
7803 
     | 
    
         
             
                        cause: 'value must be an object that contains a string in the "result" property.'
         
     | 
| 
       7282 
7804 
     | 
    
         
             
                      })
         
     | 
| 
         @@ -7289,7 +7811,7 @@ var enumOutputStrategy = (enumValues) => { 
     | 
|
| 
       7289 
7811 
     | 
    
         
             
                  if (value.result.length === 0 || possibleEnumValues.length === 0) {
         
     | 
| 
       7290 
7812 
     | 
    
         
             
                    return {
         
     | 
| 
       7291 
7813 
     | 
    
         
             
                      success: false,
         
     | 
| 
       7292 
     | 
    
         
            -
                      error: new  
     | 
| 
      
 7814 
     | 
    
         
            +
                      error: new import_provider26.TypeValidationError({
         
     | 
| 
       7293 
7815 
     | 
    
         
             
                        value,
         
     | 
| 
       7294 
7816 
     | 
    
         
             
                        cause: "value must be a string in the enum"
         
     | 
| 
       7295 
7817 
     | 
    
         
             
                      })
         
     | 
| 
         @@ -7304,7 +7826,7 @@ var enumOutputStrategy = (enumValues) => { 
     | 
|
| 
       7304 
7826 
     | 
    
         
             
                  };
         
     | 
| 
       7305 
7827 
     | 
    
         
             
                },
         
     | 
| 
       7306 
7828 
     | 
    
         
             
                createElementStream() {
         
     | 
| 
       7307 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 7829 
     | 
    
         
            +
                  throw new import_provider26.UnsupportedFunctionalityError({
         
     | 
| 
       7308 
7830 
     | 
    
         
             
                    functionality: "element streams in enum mode"
         
     | 
| 
       7309 
7831 
     | 
    
         
             
                  });
         
     | 
| 
       7310 
7832 
     | 
    
         
             
                }
         
     | 
| 
         @@ -7317,9 +7839,9 @@ function getOutputStrategy({ 
     | 
|
| 
       7317 
7839 
     | 
    
         
             
            }) {
         
     | 
| 
       7318 
7840 
     | 
    
         
             
              switch (output) {
         
     | 
| 
       7319 
7841 
     | 
    
         
             
                case "object":
         
     | 
| 
       7320 
     | 
    
         
            -
                  return objectOutputStrategy((0,  
     | 
| 
      
 7842 
     | 
    
         
            +
                  return objectOutputStrategy((0, import_provider_utils22.asSchema)(schema));
         
     | 
| 
       7321 
7843 
     | 
    
         
             
                case "array":
         
     | 
| 
       7322 
     | 
    
         
            -
                  return arrayOutputStrategy((0,  
     | 
| 
      
 7844 
     | 
    
         
            +
                  return arrayOutputStrategy((0, import_provider_utils22.asSchema)(schema));
         
     | 
| 
       7323 
7845 
     | 
    
         
             
                case "enum":
         
     | 
| 
       7324 
7846 
     | 
    
         
             
                  return enumOutputStrategy(enumValues);
         
     | 
| 
       7325 
7847 
     | 
    
         
             
                case "no-schema":
         
     | 
| 
         @@ -7332,10 +7854,10 @@ function getOutputStrategy({ 
     | 
|
| 
       7332 
7854 
     | 
    
         
             
            }
         
     | 
| 
       7333 
7855 
     | 
    
         | 
| 
       7334 
7856 
     | 
    
         
             
            // src/generate-object/parse-and-validate-object-result.ts
         
     | 
| 
       7335 
     | 
    
         
            -
            var  
     | 
| 
       7336 
     | 
    
         
            -
            var  
     | 
| 
      
 7857 
     | 
    
         
            +
            var import_provider27 = require("@ai-sdk/provider");
         
     | 
| 
      
 7858 
     | 
    
         
            +
            var import_provider_utils23 = require("@ai-sdk/provider-utils");
         
     | 
| 
       7337 
7859 
     | 
    
         
             
            async function parseAndValidateObjectResult(result, outputStrategy, context) {
         
     | 
| 
       7338 
     | 
    
         
            -
              const parseResult = await (0,  
     | 
| 
      
 7860 
     | 
    
         
            +
              const parseResult = await (0, import_provider_utils23.safeParseJSON)({ text: result });
         
     | 
| 
       7339 
7861 
     | 
    
         
             
              if (!parseResult.success) {
         
     | 
| 
       7340 
7862 
     | 
    
         
             
                throw new NoObjectGeneratedError({
         
     | 
| 
       7341 
7863 
     | 
    
         
             
                  message: "No object generated: could not parse the response.",
         
     | 
| 
         @@ -7370,7 +7892,7 @@ async function parseAndValidateObjectResultWithRepair(result, outputStrategy, re 
     | 
|
| 
       7370 
7892 
     | 
    
         
             
              try {
         
     | 
| 
       7371 
7893 
     | 
    
         
             
                return await parseAndValidateObjectResult(result, outputStrategy, context);
         
     | 
| 
       7372 
7894 
     | 
    
         
             
              } catch (error) {
         
     | 
| 
       7373 
     | 
    
         
            -
                if (repairText != null && NoObjectGeneratedError.isInstance(error) && ( 
     | 
| 
      
 7895 
     | 
    
         
            +
                if (repairText != null && NoObjectGeneratedError.isInstance(error) && (import_provider27.JSONParseError.isInstance(error.cause) || import_provider27.TypeValidationError.isInstance(error.cause))) {
         
     | 
| 
       7374 
7896 
     | 
    
         
             
                  const repairedText = await repairText({
         
     | 
| 
       7375 
7897 
     | 
    
         
             
                    text: result,
         
     | 
| 
       7376 
7898 
     | 
    
         
             
                    error: error.cause
         
     | 
| 
         @@ -7507,7 +8029,7 @@ function validateObjectGenerationInput({ 
     | 
|
| 
       7507 
8029 
     | 
    
         
             
            }
         
     | 
| 
       7508 
8030 
     | 
    
         | 
| 
       7509 
8031 
     | 
    
         
             
            // src/generate-object/generate-object.ts
         
     | 
| 
       7510 
     | 
    
         
            -
            var originalGenerateId3 = (0,  
     | 
| 
      
 8032 
     | 
    
         
            +
            var originalGenerateId3 = (0, import_provider_utils24.createIdGenerator)({ prefix: "aiobj", size: 24 });
         
     | 
| 
       7511 
8033 
     | 
    
         
             
            async function generateObject(options) {
         
     | 
| 
       7512 
8034 
     | 
    
         
             
              const {
         
     | 
| 
       7513 
8035 
     | 
    
         
             
                model: modelArg,
         
     | 
| 
         @@ -7552,7 +8074,7 @@ async function generateObject(options) { 
     | 
|
| 
       7552 
8074 
     | 
    
         
             
                enumValues
         
     | 
| 
       7553 
8075 
     | 
    
         
             
              });
         
     | 
| 
       7554 
8076 
     | 
    
         
             
              const callSettings = prepareCallSettings(settings);
         
     | 
| 
       7555 
     | 
    
         
            -
              const headersWithUserAgent = (0,  
     | 
| 
      
 8077 
     | 
    
         
            +
              const headersWithUserAgent = (0, import_provider_utils24.withUserAgentSuffix)(
         
     | 
| 
       7556 
8078 
     | 
    
         
             
                headers != null ? headers : {},
         
     | 
| 
       7557 
8079 
     | 
    
         
             
                `ai/${VERSION}`
         
     | 
| 
       7558 
8080 
     | 
    
         
             
              );
         
     | 
| 
         @@ -7772,7 +8294,7 @@ var DefaultGenerateObjectResult = class { 
     | 
|
| 
       7772 
8294 
     | 
    
         
             
            };
         
     | 
| 
       7773 
8295 
     | 
    
         | 
| 
       7774 
8296 
     | 
    
         
             
            // src/generate-object/stream-object.ts
         
     | 
| 
       7775 
     | 
    
         
            -
            var  
     | 
| 
      
 8297 
     | 
    
         
            +
            var import_provider_utils26 = require("@ai-sdk/provider-utils");
         
     | 
| 
       7776 
8298 
     | 
    
         | 
| 
       7777 
8299 
     | 
    
         
             
            // src/util/cosine-similarity.ts
         
     | 
| 
       7778 
8300 
     | 
    
         
             
            function cosineSimilarity(vector1, vector2) {
         
     | 
| 
         @@ -7882,7 +8404,7 @@ var SerialJobExecutor = class { 
     | 
|
| 
       7882 
8404 
     | 
    
         
             
            };
         
     | 
| 
       7883 
8405 
     | 
    
         | 
| 
       7884 
8406 
     | 
    
         
             
            // src/util/simulate-readable-stream.ts
         
     | 
| 
       7885 
     | 
    
         
            -
            var  
     | 
| 
      
 8407 
     | 
    
         
            +
            var import_provider_utils25 = require("@ai-sdk/provider-utils");
         
     | 
| 
       7886 
8408 
     | 
    
         
             
            function simulateReadableStream({
         
     | 
| 
       7887 
8409 
     | 
    
         
             
              chunks,
         
     | 
| 
       7888 
8410 
     | 
    
         
             
              initialDelayInMs = 0,
         
     | 
| 
         @@ -7890,7 +8412,7 @@ function simulateReadableStream({ 
     | 
|
| 
       7890 
8412 
     | 
    
         
             
              _internal
         
     | 
| 
       7891 
8413 
     | 
    
         
             
            }) {
         
     | 
| 
       7892 
8414 
     | 
    
         
             
              var _a17;
         
     | 
| 
       7893 
     | 
    
         
            -
              const delay2 = (_a17 = _internal == null ? void 0 : _internal.delay) != null ? _a17 :  
     | 
| 
      
 8415 
     | 
    
         
            +
              const delay2 = (_a17 = _internal == null ? void 0 : _internal.delay) != null ? _a17 : import_provider_utils25.delay;
         
     | 
| 
       7894 
8416 
     | 
    
         
             
              let index = 0;
         
     | 
| 
       7895 
8417 
     | 
    
         
             
              return new ReadableStream({
         
     | 
| 
       7896 
8418 
     | 
    
         
             
                async pull(controller) {
         
     | 
| 
         @@ -7905,7 +8427,7 @@ function simulateReadableStream({ 
     | 
|
| 
       7905 
8427 
     | 
    
         
             
            }
         
     | 
| 
       7906 
8428 
     | 
    
         | 
| 
       7907 
8429 
     | 
    
         
             
            // src/generate-object/stream-object.ts
         
     | 
| 
       7908 
     | 
    
         
            -
            var originalGenerateId4 = (0,  
     | 
| 
      
 8430 
     | 
    
         
            +
            var originalGenerateId4 = (0, import_provider_utils26.createIdGenerator)({ prefix: "aiobj", size: 24 });
         
     | 
| 
       7909 
8431 
     | 
    
         
             
            function streamObject(options) {
         
     | 
| 
       7910 
8432 
     | 
    
         
             
              const {
         
     | 
| 
       7911 
8433 
     | 
    
         
             
                model,
         
     | 
| 
         @@ -8428,7 +8950,7 @@ var DefaultStreamObjectResult = class { 
     | 
|
| 
       8428 
8950 
     | 
    
         
             
            };
         
     | 
| 
       8429 
8951 
     | 
    
         | 
| 
       8430 
8952 
     | 
    
         
             
            // src/generate-speech/generate-speech.ts
         
     | 
| 
       8431 
     | 
    
         
            -
            var  
     | 
| 
      
 8953 
     | 
    
         
            +
            var import_provider_utils27 = require("@ai-sdk/provider-utils");
         
     | 
| 
       8432 
8954 
     | 
    
         | 
| 
       8433 
8955 
     | 
    
         
             
            // src/generate-speech/generated-audio-file.ts
         
     | 
| 
       8434 
8956 
     | 
    
         
             
            var DefaultGeneratedAudioFile = class extends DefaultGeneratedFile {
         
     | 
| 
         @@ -8474,7 +8996,7 @@ async function generateSpeech({ 
     | 
|
| 
       8474 
8996 
     | 
    
         
             
              if (!resolvedModel) {
         
     | 
| 
       8475 
8997 
     | 
    
         
             
                throw new Error("Model could not be resolved");
         
     | 
| 
       8476 
8998 
     | 
    
         
             
              }
         
     | 
| 
       8477 
     | 
    
         
            -
              const headersWithUserAgent = (0,  
     | 
| 
      
 8999 
     | 
    
         
            +
              const headersWithUserAgent = (0, import_provider_utils27.withUserAgentSuffix)(
         
     | 
| 
       8478 
9000 
     | 
    
         
             
                headers != null ? headers : {},
         
     | 
| 
       8479 
9001 
     | 
    
         
             
                `ai/${VERSION}`
         
     | 
| 
       8480 
9002 
     | 
    
         
             
              );
         
     | 
| 
         @@ -8528,7 +9050,7 @@ __export(output_exports, { 
     | 
|
| 
       8528 
9050 
     | 
    
         
             
              object: () => object,
         
     | 
| 
       8529 
9051 
     | 
    
         
             
              text: () => text
         
     | 
| 
       8530 
9052 
     | 
    
         
             
            });
         
     | 
| 
       8531 
     | 
    
         
            -
            var  
     | 
| 
      
 9053 
     | 
    
         
            +
            var import_provider_utils28 = require("@ai-sdk/provider-utils");
         
     | 
| 
       8532 
9054 
     | 
    
         
             
            var text = () => ({
         
     | 
| 
       8533 
9055 
     | 
    
         
             
              type: "text",
         
     | 
| 
       8534 
9056 
     | 
    
         
             
              responseFormat: Promise.resolve({ type: "text" }),
         
     | 
| 
         @@ -8542,10 +9064,10 @@ var text = () => ({ 
     | 
|
| 
       8542 
9064 
     | 
    
         
             
            var object = ({
         
     | 
| 
       8543 
9065 
     | 
    
         
             
              schema: inputSchema
         
     | 
| 
       8544 
9066 
     | 
    
         
             
            }) => {
         
     | 
| 
       8545 
     | 
    
         
            -
              const schema = (0,  
     | 
| 
      
 9067 
     | 
    
         
            +
              const schema = (0, import_provider_utils28.asSchema)(inputSchema);
         
     | 
| 
       8546 
9068 
     | 
    
         
             
              return {
         
     | 
| 
       8547 
9069 
     | 
    
         
             
                type: "object",
         
     | 
| 
       8548 
     | 
    
         
            -
                responseFormat: (0,  
     | 
| 
      
 9070 
     | 
    
         
            +
                responseFormat: (0, import_provider_utils28.resolve)(schema.jsonSchema).then((jsonSchema3) => ({
         
     | 
| 
       8549 
9071 
     | 
    
         
             
                  type: "json",
         
     | 
| 
       8550 
9072 
     | 
    
         
             
                  schema: jsonSchema3
         
     | 
| 
       8551 
9073 
     | 
    
         
             
                })),
         
     | 
| 
         @@ -8568,7 +9090,7 @@ var object = ({ 
     | 
|
| 
       8568 
9090 
     | 
    
         
             
                  }
         
     | 
| 
       8569 
9091 
     | 
    
         
             
                },
         
     | 
| 
       8570 
9092 
     | 
    
         
             
                async parseOutput({ text: text2 }, context) {
         
     | 
| 
       8571 
     | 
    
         
            -
                  const parseResult = await (0,  
     | 
| 
      
 9093 
     | 
    
         
            +
                  const parseResult = await (0, import_provider_utils28.safeParseJSON)({ text: text2 });
         
     | 
| 
       8572 
9094 
     | 
    
         
             
                  if (!parseResult.success) {
         
     | 
| 
       8573 
9095 
     | 
    
         
             
                    throw new NoObjectGeneratedError({
         
     | 
| 
       8574 
9096 
     | 
    
         
             
                      message: "No object generated: could not parse the response.",
         
     | 
| 
         @@ -8579,7 +9101,7 @@ var object = ({ 
     | 
|
| 
       8579 
9101 
     | 
    
         
             
                      finishReason: context.finishReason
         
     | 
| 
       8580 
9102 
     | 
    
         
             
                    });
         
     | 
| 
       8581 
9103 
     | 
    
         
             
                  }
         
     | 
| 
       8582 
     | 
    
         
            -
                  const validationResult = await (0,  
     | 
| 
      
 9104 
     | 
    
         
            +
                  const validationResult = await (0, import_provider_utils28.safeValidateTypes)({
         
     | 
| 
       8583 
9105 
     | 
    
         
             
                    value: parseResult.value,
         
     | 
| 
       8584 
9106 
     | 
    
         
             
                    schema
         
     | 
| 
       8585 
9107 
     | 
    
         
             
                  });
         
     | 
| 
         @@ -8678,8 +9200,8 @@ function pruneMessages({ 
     | 
|
| 
       8678 
9200 
     | 
    
         
             
            }
         
     | 
| 
       8679 
9201 
     | 
    
         | 
| 
       8680 
9202 
     | 
    
         
             
            // src/generate-text/smooth-stream.ts
         
     | 
| 
       8681 
     | 
    
         
            -
            var  
     | 
| 
       8682 
     | 
    
         
            -
            var  
     | 
| 
      
 9203 
     | 
    
         
            +
            var import_provider_utils29 = require("@ai-sdk/provider-utils");
         
     | 
| 
      
 9204 
     | 
    
         
            +
            var import_provider28 = require("@ai-sdk/provider");
         
     | 
| 
       8683 
9205 
     | 
    
         
             
            var CHUNKING_REGEXPS = {
         
     | 
| 
       8684 
9206 
     | 
    
         
             
              word: /\S+\s+/m,
         
     | 
| 
       8685 
9207 
     | 
    
         
             
              line: /\n+/m
         
     | 
| 
         @@ -8687,7 +9209,7 @@ var CHUNKING_REGEXPS = { 
     | 
|
| 
       8687 
9209 
     | 
    
         
             
            function smoothStream({
         
     | 
| 
       8688 
9210 
     | 
    
         
             
              delayInMs = 10,
         
     | 
| 
       8689 
9211 
     | 
    
         
             
              chunking = "word",
         
     | 
| 
       8690 
     | 
    
         
            -
              _internal: { delay: delay2 =  
     | 
| 
      
 9212 
     | 
    
         
            +
              _internal: { delay: delay2 = import_provider_utils29.delay } = {}
         
     | 
| 
       8691 
9213 
     | 
    
         
             
            } = {}) {
         
     | 
| 
       8692 
9214 
     | 
    
         
             
              let detectChunk;
         
     | 
| 
       8693 
9215 
     | 
    
         
             
              if (typeof chunking === "function") {
         
     | 
| 
         @@ -8709,7 +9231,7 @@ function smoothStream({ 
     | 
|
| 
       8709 
9231 
     | 
    
         
             
              } else {
         
     | 
| 
       8710 
9232 
     | 
    
         
             
                const chunkingRegex = typeof chunking === "string" ? CHUNKING_REGEXPS[chunking] : chunking;
         
     | 
| 
       8711 
9233 
     | 
    
         
             
                if (chunkingRegex == null) {
         
     | 
| 
       8712 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 9234 
     | 
    
         
            +
                  throw new import_provider28.InvalidArgumentError({
         
     | 
| 
       8713 
9235 
     | 
    
         
             
                    argument: "chunking",
         
     | 
| 
       8714 
9236 
     | 
    
         
             
                    message: `Chunking must be "word" or "line" or a RegExp. Received: ${chunking}`
         
     | 
| 
       8715 
9237 
     | 
    
         
             
                  });
         
     | 
| 
         @@ -9081,7 +9603,7 @@ function wrapProvider({ 
     | 
|
| 
       9081 
9603 
     | 
    
         
             
            }
         
     | 
| 
       9082 
9604 
     | 
    
         | 
| 
       9083 
9605 
     | 
    
         
             
            // src/registry/custom-provider.ts
         
     | 
| 
       9084 
     | 
    
         
            -
            var  
     | 
| 
      
 9606 
     | 
    
         
            +
            var import_provider29 = require("@ai-sdk/provider");
         
     | 
| 
       9085 
9607 
     | 
    
         
             
            function customProvider({
         
     | 
| 
       9086 
9608 
     | 
    
         
             
              languageModels,
         
     | 
| 
       9087 
9609 
     | 
    
         
             
              textEmbeddingModels,
         
     | 
| 
         @@ -9098,7 +9620,7 @@ function customProvider({ 
     | 
|
| 
       9098 
9620 
     | 
    
         
             
                  if (fallbackProvider) {
         
     | 
| 
       9099 
9621 
     | 
    
         
             
                    return fallbackProvider.languageModel(modelId);
         
     | 
| 
       9100 
9622 
     | 
    
         
             
                  }
         
     | 
| 
       9101 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 9623 
     | 
    
         
            +
                  throw new import_provider29.NoSuchModelError({ modelId, modelType: "languageModel" });
         
     | 
| 
       9102 
9624 
     | 
    
         
             
                },
         
     | 
| 
       9103 
9625 
     | 
    
         
             
                textEmbeddingModel(modelId) {
         
     | 
| 
       9104 
9626 
     | 
    
         
             
                  if (textEmbeddingModels != null && modelId in textEmbeddingModels) {
         
     | 
| 
         @@ -9107,7 +9629,7 @@ function customProvider({ 
     | 
|
| 
       9107 
9629 
     | 
    
         
             
                  if (fallbackProvider) {
         
     | 
| 
       9108 
9630 
     | 
    
         
             
                    return fallbackProvider.textEmbeddingModel(modelId);
         
     | 
| 
       9109 
9631 
     | 
    
         
             
                  }
         
     | 
| 
       9110 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 9632 
     | 
    
         
            +
                  throw new import_provider29.NoSuchModelError({ modelId, modelType: "textEmbeddingModel" });
         
     | 
| 
       9111 
9633 
     | 
    
         
             
                },
         
     | 
| 
       9112 
9634 
     | 
    
         
             
                imageModel(modelId) {
         
     | 
| 
       9113 
9635 
     | 
    
         
             
                  if (imageModels != null && modelId in imageModels) {
         
     | 
| 
         @@ -9116,7 +9638,7 @@ function customProvider({ 
     | 
|
| 
       9116 
9638 
     | 
    
         
             
                  if (fallbackProvider == null ? void 0 : fallbackProvider.imageModel) {
         
     | 
| 
       9117 
9639 
     | 
    
         
             
                    return fallbackProvider.imageModel(modelId);
         
     | 
| 
       9118 
9640 
     | 
    
         
             
                  }
         
     | 
| 
       9119 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 9641 
     | 
    
         
            +
                  throw new import_provider29.NoSuchModelError({ modelId, modelType: "imageModel" });
         
     | 
| 
       9120 
9642 
     | 
    
         
             
                },
         
     | 
| 
       9121 
9643 
     | 
    
         
             
                transcriptionModel(modelId) {
         
     | 
| 
       9122 
9644 
     | 
    
         
             
                  if (transcriptionModels != null && modelId in transcriptionModels) {
         
     | 
| 
         @@ -9125,7 +9647,7 @@ function customProvider({ 
     | 
|
| 
       9125 
9647 
     | 
    
         
             
                  if (fallbackProvider == null ? void 0 : fallbackProvider.transcriptionModel) {
         
     | 
| 
       9126 
9648 
     | 
    
         
             
                    return fallbackProvider.transcriptionModel(modelId);
         
     | 
| 
       9127 
9649 
     | 
    
         
             
                  }
         
     | 
| 
       9128 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 9650 
     | 
    
         
            +
                  throw new import_provider29.NoSuchModelError({ modelId, modelType: "transcriptionModel" });
         
     | 
| 
       9129 
9651 
     | 
    
         
             
                },
         
     | 
| 
       9130 
9652 
     | 
    
         
             
                speechModel(modelId) {
         
     | 
| 
       9131 
9653 
     | 
    
         
             
                  if (speechModels != null && modelId in speechModels) {
         
     | 
| 
         @@ -9134,19 +9656,19 @@ function customProvider({ 
     | 
|
| 
       9134 
9656 
     | 
    
         
             
                  if (fallbackProvider == null ? void 0 : fallbackProvider.speechModel) {
         
     | 
| 
       9135 
9657 
     | 
    
         
             
                    return fallbackProvider.speechModel(modelId);
         
     | 
| 
       9136 
9658 
     | 
    
         
             
                  }
         
     | 
| 
       9137 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 9659 
     | 
    
         
            +
                  throw new import_provider29.NoSuchModelError({ modelId, modelType: "speechModel" });
         
     | 
| 
       9138 
9660 
     | 
    
         
             
                }
         
     | 
| 
       9139 
9661 
     | 
    
         
             
              };
         
     | 
| 
       9140 
9662 
     | 
    
         
             
            }
         
     | 
| 
       9141 
9663 
     | 
    
         
             
            var experimental_customProvider = customProvider;
         
     | 
| 
       9142 
9664 
     | 
    
         | 
| 
       9143 
9665 
     | 
    
         
             
            // src/registry/no-such-provider-error.ts
         
     | 
| 
       9144 
     | 
    
         
            -
            var  
     | 
| 
      
 9666 
     | 
    
         
            +
            var import_provider30 = require("@ai-sdk/provider");
         
     | 
| 
       9145 
9667 
     | 
    
         
             
            var name16 = "AI_NoSuchProviderError";
         
     | 
| 
       9146 
9668 
     | 
    
         
             
            var marker16 = `vercel.ai.error.${name16}`;
         
     | 
| 
       9147 
9669 
     | 
    
         
             
            var symbol16 = Symbol.for(marker16);
         
     | 
| 
       9148 
9670 
     | 
    
         
             
            var _a16;
         
     | 
| 
       9149 
     | 
    
         
            -
            var NoSuchProviderError = class extends  
     | 
| 
      
 9671 
     | 
    
         
            +
            var NoSuchProviderError = class extends import_provider30.NoSuchModelError {
         
     | 
| 
       9150 
9672 
     | 
    
         
             
              constructor({
         
     | 
| 
       9151 
9673 
     | 
    
         
             
                modelId,
         
     | 
| 
       9152 
9674 
     | 
    
         
             
                modelType,
         
     | 
| 
         @@ -9160,13 +9682,13 @@ var NoSuchProviderError = class extends import_provider29.NoSuchModelError { 
     | 
|
| 
       9160 
9682 
     | 
    
         
             
                this.availableProviders = availableProviders;
         
     | 
| 
       9161 
9683 
     | 
    
         
             
              }
         
     | 
| 
       9162 
9684 
     | 
    
         
             
              static isInstance(error) {
         
     | 
| 
       9163 
     | 
    
         
            -
                return  
     | 
| 
      
 9685 
     | 
    
         
            +
                return import_provider30.AISDKError.hasMarker(error, marker16);
         
     | 
| 
       9164 
9686 
     | 
    
         
             
              }
         
     | 
| 
       9165 
9687 
     | 
    
         
             
            };
         
     | 
| 
       9166 
9688 
     | 
    
         
             
            _a16 = symbol16;
         
     | 
| 
       9167 
9689 
     | 
    
         | 
| 
       9168 
9690 
     | 
    
         
             
            // src/registry/provider-registry.ts
         
     | 
| 
       9169 
     | 
    
         
            -
            var  
     | 
| 
      
 9691 
     | 
    
         
            +
            var import_provider31 = require("@ai-sdk/provider");
         
     | 
| 
       9170 
9692 
     | 
    
         
             
            function createProviderRegistry(providers, {
         
     | 
| 
       9171 
9693 
     | 
    
         
             
              separator = ":",
         
     | 
| 
       9172 
9694 
     | 
    
         
             
              languageModelMiddleware
         
     | 
| 
         @@ -9211,7 +9733,7 @@ var DefaultProviderRegistry = class { 
     | 
|
| 
       9211 
9733 
     | 
    
         
             
              splitId(id, modelType) {
         
     | 
| 
       9212 
9734 
     | 
    
         
             
                const index = id.indexOf(this.separator);
         
     | 
| 
       9213 
9735 
     | 
    
         
             
                if (index === -1) {
         
     | 
| 
       9214 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 9736 
     | 
    
         
            +
                  throw new import_provider31.NoSuchModelError({
         
     | 
| 
       9215 
9737 
     | 
    
         
             
                    modelId: id,
         
     | 
| 
       9216 
9738 
     | 
    
         
             
                    modelType,
         
     | 
| 
       9217 
9739 
     | 
    
         
             
                    message: `Invalid ${modelType} id for registry: ${id} (must be in the format "providerId${this.separator}modelId")`
         
     | 
| 
         @@ -9227,7 +9749,7 @@ var DefaultProviderRegistry = class { 
     | 
|
| 
       9227 
9749 
     | 
    
         
             
                  modelId
         
     | 
| 
       9228 
9750 
     | 
    
         
             
                );
         
     | 
| 
       9229 
9751 
     | 
    
         
             
                if (model == null) {
         
     | 
| 
       9230 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 9752 
     | 
    
         
            +
                  throw new import_provider31.NoSuchModelError({ modelId: id, modelType: "languageModel" });
         
     | 
| 
       9231 
9753 
     | 
    
         
             
                }
         
     | 
| 
       9232 
9754 
     | 
    
         
             
                if (this.languageModelMiddleware != null) {
         
     | 
| 
       9233 
9755 
     | 
    
         
             
                  model = wrapLanguageModel({
         
     | 
| 
         @@ -9243,7 +9765,7 @@ var DefaultProviderRegistry = class { 
     | 
|
| 
       9243 
9765 
     | 
    
         
             
                const provider = this.getProvider(providerId, "textEmbeddingModel");
         
     | 
| 
       9244 
9766 
     | 
    
         
             
                const model = (_a17 = provider.textEmbeddingModel) == null ? void 0 : _a17.call(provider, modelId);
         
     | 
| 
       9245 
9767 
     | 
    
         
             
                if (model == null) {
         
     | 
| 
       9246 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 9768 
     | 
    
         
            +
                  throw new import_provider31.NoSuchModelError({
         
     | 
| 
       9247 
9769 
     | 
    
         
             
                    modelId: id,
         
     | 
| 
       9248 
9770 
     | 
    
         
             
                    modelType: "textEmbeddingModel"
         
     | 
| 
       9249 
9771 
     | 
    
         
             
                  });
         
     | 
| 
         @@ -9256,7 +9778,7 @@ var DefaultProviderRegistry = class { 
     | 
|
| 
       9256 
9778 
     | 
    
         
             
                const provider = this.getProvider(providerId, "imageModel");
         
     | 
| 
       9257 
9779 
     | 
    
         
             
                const model = (_a17 = provider.imageModel) == null ? void 0 : _a17.call(provider, modelId);
         
     | 
| 
       9258 
9780 
     | 
    
         
             
                if (model == null) {
         
     | 
| 
       9259 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 9781 
     | 
    
         
            +
                  throw new import_provider31.NoSuchModelError({ modelId: id, modelType: "imageModel" });
         
     | 
| 
       9260 
9782 
     | 
    
         
             
                }
         
     | 
| 
       9261 
9783 
     | 
    
         
             
                return model;
         
     | 
| 
       9262 
9784 
     | 
    
         
             
              }
         
     | 
| 
         @@ -9266,7 +9788,7 @@ var DefaultProviderRegistry = class { 
     | 
|
| 
       9266 
9788 
     | 
    
         
             
                const provider = this.getProvider(providerId, "transcriptionModel");
         
     | 
| 
       9267 
9789 
     | 
    
         
             
                const model = (_a17 = provider.transcriptionModel) == null ? void 0 : _a17.call(provider, modelId);
         
     | 
| 
       9268 
9790 
     | 
    
         
             
                if (model == null) {
         
     | 
| 
       9269 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 9791 
     | 
    
         
            +
                  throw new import_provider31.NoSuchModelError({
         
     | 
| 
       9270 
9792 
     | 
    
         
             
                    modelId: id,
         
     | 
| 
       9271 
9793 
     | 
    
         
             
                    modelType: "transcriptionModel"
         
     | 
| 
       9272 
9794 
     | 
    
         
             
                  });
         
     | 
| 
         @@ -9279,150 +9801,150 @@ var DefaultProviderRegistry = class { 
     | 
|
| 
       9279 
9801 
     | 
    
         
             
                const provider = this.getProvider(providerId, "speechModel");
         
     | 
| 
       9280 
9802 
     | 
    
         
             
                const model = (_a17 = provider.speechModel) == null ? void 0 : _a17.call(provider, modelId);
         
     | 
| 
       9281 
9803 
     | 
    
         
             
                if (model == null) {
         
     | 
| 
       9282 
     | 
    
         
            -
                  throw new  
     | 
| 
      
 9804 
     | 
    
         
            +
                  throw new import_provider31.NoSuchModelError({ modelId: id, modelType: "speechModel" });
         
     | 
| 
       9283 
9805 
     | 
    
         
             
                }
         
     | 
| 
       9284 
9806 
     | 
    
         
             
                return model;
         
     | 
| 
       9285 
9807 
     | 
    
         
             
              }
         
     | 
| 
       9286 
9808 
     | 
    
         
             
            };
         
     | 
| 
       9287 
9809 
     | 
    
         | 
| 
       9288 
9810 
     | 
    
         
             
            // src/tool/mcp/mcp-client.ts
         
     | 
| 
       9289 
     | 
    
         
            -
            var  
     | 
| 
      
 9811 
     | 
    
         
            +
            var import_provider_utils31 = require("@ai-sdk/provider-utils");
         
     | 
| 
       9290 
9812 
     | 
    
         | 
| 
       9291 
9813 
     | 
    
         
             
            // src/tool/mcp/mcp-sse-transport.ts
         
     | 
| 
       9292 
     | 
    
         
            -
            var  
     | 
| 
      
 9814 
     | 
    
         
            +
            var import_provider_utils30 = require("@ai-sdk/provider-utils");
         
     | 
| 
       9293 
9815 
     | 
    
         | 
| 
       9294 
9816 
     | 
    
         
             
            // src/tool/mcp/json-rpc-message.ts
         
     | 
| 
       9295 
     | 
    
         
            -
            var  
     | 
| 
      
 9817 
     | 
    
         
            +
            var import_v410 = require("zod/v4");
         
     | 
| 
       9296 
9818 
     | 
    
         | 
| 
       9297 
9819 
     | 
    
         
             
            // src/tool/mcp/types.ts
         
     | 
| 
       9298 
     | 
    
         
            -
            var  
     | 
| 
      
 9820 
     | 
    
         
            +
            var import_v49 = require("zod/v4");
         
     | 
| 
       9299 
9821 
     | 
    
         
             
            var LATEST_PROTOCOL_VERSION = "2025-06-18";
         
     | 
| 
       9300 
9822 
     | 
    
         
             
            var SUPPORTED_PROTOCOL_VERSIONS = [
         
     | 
| 
       9301 
9823 
     | 
    
         
             
              LATEST_PROTOCOL_VERSION,
         
     | 
| 
       9302 
9824 
     | 
    
         
             
              "2025-03-26",
         
     | 
| 
       9303 
9825 
     | 
    
         
             
              "2024-11-05"
         
     | 
| 
       9304 
9826 
     | 
    
         
             
            ];
         
     | 
| 
       9305 
     | 
    
         
            -
            var ClientOrServerImplementationSchema =  
     | 
| 
       9306 
     | 
    
         
            -
              name:  
     | 
| 
       9307 
     | 
    
         
            -
              version:  
     | 
| 
      
 9827 
     | 
    
         
            +
            var ClientOrServerImplementationSchema = import_v49.z.looseObject({
         
     | 
| 
      
 9828 
     | 
    
         
            +
              name: import_v49.z.string(),
         
     | 
| 
      
 9829 
     | 
    
         
            +
              version: import_v49.z.string()
         
     | 
| 
       9308 
9830 
     | 
    
         
             
            });
         
     | 
| 
       9309 
     | 
    
         
            -
            var BaseParamsSchema =  
     | 
| 
       9310 
     | 
    
         
            -
              _meta:  
     | 
| 
      
 9831 
     | 
    
         
            +
            var BaseParamsSchema = import_v49.z.looseObject({
         
     | 
| 
      
 9832 
     | 
    
         
            +
              _meta: import_v49.z.optional(import_v49.z.object({}).loose())
         
     | 
| 
       9311 
9833 
     | 
    
         
             
            });
         
     | 
| 
       9312 
9834 
     | 
    
         
             
            var ResultSchema = BaseParamsSchema;
         
     | 
| 
       9313 
     | 
    
         
            -
            var RequestSchema =  
     | 
| 
       9314 
     | 
    
         
            -
              method:  
     | 
| 
       9315 
     | 
    
         
            -
              params:  
     | 
| 
      
 9835 
     | 
    
         
            +
            var RequestSchema = import_v49.z.object({
         
     | 
| 
      
 9836 
     | 
    
         
            +
              method: import_v49.z.string(),
         
     | 
| 
      
 9837 
     | 
    
         
            +
              params: import_v49.z.optional(BaseParamsSchema)
         
     | 
| 
       9316 
9838 
     | 
    
         
             
            });
         
     | 
| 
       9317 
     | 
    
         
            -
            var ServerCapabilitiesSchema =  
     | 
| 
       9318 
     | 
    
         
            -
              experimental:  
     | 
| 
       9319 
     | 
    
         
            -
              logging:  
     | 
| 
       9320 
     | 
    
         
            -
              prompts:  
     | 
| 
       9321 
     | 
    
         
            -
                 
     | 
| 
       9322 
     | 
    
         
            -
                  listChanged:  
     | 
| 
      
 9839 
     | 
    
         
            +
            var ServerCapabilitiesSchema = import_v49.z.looseObject({
         
     | 
| 
      
 9840 
     | 
    
         
            +
              experimental: import_v49.z.optional(import_v49.z.object({}).loose()),
         
     | 
| 
      
 9841 
     | 
    
         
            +
              logging: import_v49.z.optional(import_v49.z.object({}).loose()),
         
     | 
| 
      
 9842 
     | 
    
         
            +
              prompts: import_v49.z.optional(
         
     | 
| 
      
 9843 
     | 
    
         
            +
                import_v49.z.looseObject({
         
     | 
| 
      
 9844 
     | 
    
         
            +
                  listChanged: import_v49.z.optional(import_v49.z.boolean())
         
     | 
| 
       9323 
9845 
     | 
    
         
             
                })
         
     | 
| 
       9324 
9846 
     | 
    
         
             
              ),
         
     | 
| 
       9325 
     | 
    
         
            -
              resources:  
     | 
| 
       9326 
     | 
    
         
            -
                 
     | 
| 
       9327 
     | 
    
         
            -
                  subscribe:  
     | 
| 
       9328 
     | 
    
         
            -
                  listChanged:  
     | 
| 
      
 9847 
     | 
    
         
            +
              resources: import_v49.z.optional(
         
     | 
| 
      
 9848 
     | 
    
         
            +
                import_v49.z.looseObject({
         
     | 
| 
      
 9849 
     | 
    
         
            +
                  subscribe: import_v49.z.optional(import_v49.z.boolean()),
         
     | 
| 
      
 9850 
     | 
    
         
            +
                  listChanged: import_v49.z.optional(import_v49.z.boolean())
         
     | 
| 
       9329 
9851 
     | 
    
         
             
                })
         
     | 
| 
       9330 
9852 
     | 
    
         
             
              ),
         
     | 
| 
       9331 
     | 
    
         
            -
              tools:  
     | 
| 
       9332 
     | 
    
         
            -
                 
     | 
| 
       9333 
     | 
    
         
            -
                  listChanged:  
     | 
| 
      
 9853 
     | 
    
         
            +
              tools: import_v49.z.optional(
         
     | 
| 
      
 9854 
     | 
    
         
            +
                import_v49.z.looseObject({
         
     | 
| 
      
 9855 
     | 
    
         
            +
                  listChanged: import_v49.z.optional(import_v49.z.boolean())
         
     | 
| 
       9334 
9856 
     | 
    
         
             
                })
         
     | 
| 
       9335 
9857 
     | 
    
         
             
              )
         
     | 
| 
       9336 
9858 
     | 
    
         
             
            });
         
     | 
| 
       9337 
9859 
     | 
    
         
             
            var InitializeResultSchema = ResultSchema.extend({
         
     | 
| 
       9338 
     | 
    
         
            -
              protocolVersion:  
     | 
| 
      
 9860 
     | 
    
         
            +
              protocolVersion: import_v49.z.string(),
         
     | 
| 
       9339 
9861 
     | 
    
         
             
              capabilities: ServerCapabilitiesSchema,
         
     | 
| 
       9340 
9862 
     | 
    
         
             
              serverInfo: ClientOrServerImplementationSchema,
         
     | 
| 
       9341 
     | 
    
         
            -
              instructions:  
     | 
| 
      
 9863 
     | 
    
         
            +
              instructions: import_v49.z.optional(import_v49.z.string())
         
     | 
| 
       9342 
9864 
     | 
    
         
             
            });
         
     | 
| 
       9343 
9865 
     | 
    
         
             
            var PaginatedResultSchema = ResultSchema.extend({
         
     | 
| 
       9344 
     | 
    
         
            -
              nextCursor:  
     | 
| 
      
 9866 
     | 
    
         
            +
              nextCursor: import_v49.z.optional(import_v49.z.string())
         
     | 
| 
       9345 
9867 
     | 
    
         
             
            });
         
     | 
| 
       9346 
     | 
    
         
            -
            var ToolSchema =  
     | 
| 
       9347 
     | 
    
         
            -
              name:  
     | 
| 
       9348 
     | 
    
         
            -
              description:  
     | 
| 
       9349 
     | 
    
         
            -
              inputSchema:  
     | 
| 
       9350 
     | 
    
         
            -
                type:  
     | 
| 
       9351 
     | 
    
         
            -
                properties:  
     | 
| 
      
 9868 
     | 
    
         
            +
            var ToolSchema = import_v49.z.object({
         
     | 
| 
      
 9869 
     | 
    
         
            +
              name: import_v49.z.string(),
         
     | 
| 
      
 9870 
     | 
    
         
            +
              description: import_v49.z.optional(import_v49.z.string()),
         
     | 
| 
      
 9871 
     | 
    
         
            +
              inputSchema: import_v49.z.object({
         
     | 
| 
      
 9872 
     | 
    
         
            +
                type: import_v49.z.literal("object"),
         
     | 
| 
      
 9873 
     | 
    
         
            +
                properties: import_v49.z.optional(import_v49.z.object({}).loose())
         
     | 
| 
       9352 
9874 
     | 
    
         
             
              }).loose()
         
     | 
| 
       9353 
9875 
     | 
    
         
             
            }).loose();
         
     | 
| 
       9354 
9876 
     | 
    
         
             
            var ListToolsResultSchema = PaginatedResultSchema.extend({
         
     | 
| 
       9355 
     | 
    
         
            -
              tools:  
     | 
| 
      
 9877 
     | 
    
         
            +
              tools: import_v49.z.array(ToolSchema)
         
     | 
| 
       9356 
9878 
     | 
    
         
             
            });
         
     | 
| 
       9357 
     | 
    
         
            -
            var TextContentSchema =  
     | 
| 
       9358 
     | 
    
         
            -
              type:  
     | 
| 
       9359 
     | 
    
         
            -
              text:  
     | 
| 
      
 9879 
     | 
    
         
            +
            var TextContentSchema = import_v49.z.object({
         
     | 
| 
      
 9880 
     | 
    
         
            +
              type: import_v49.z.literal("text"),
         
     | 
| 
      
 9881 
     | 
    
         
            +
              text: import_v49.z.string()
         
     | 
| 
       9360 
9882 
     | 
    
         
             
            }).loose();
         
     | 
| 
       9361 
     | 
    
         
            -
            var ImageContentSchema =  
     | 
| 
       9362 
     | 
    
         
            -
              type:  
     | 
| 
       9363 
     | 
    
         
            -
              data:  
     | 
| 
       9364 
     | 
    
         
            -
              mimeType:  
     | 
| 
      
 9883 
     | 
    
         
            +
            var ImageContentSchema = import_v49.z.object({
         
     | 
| 
      
 9884 
     | 
    
         
            +
              type: import_v49.z.literal("image"),
         
     | 
| 
      
 9885 
     | 
    
         
            +
              data: import_v49.z.base64(),
         
     | 
| 
      
 9886 
     | 
    
         
            +
              mimeType: import_v49.z.string()
         
     | 
| 
       9365 
9887 
     | 
    
         
             
            }).loose();
         
     | 
| 
       9366 
     | 
    
         
            -
            var ResourceContentsSchema =  
     | 
| 
      
 9888 
     | 
    
         
            +
            var ResourceContentsSchema = import_v49.z.object({
         
     | 
| 
       9367 
9889 
     | 
    
         
             
              /**
         
     | 
| 
       9368 
9890 
     | 
    
         
             
               * The URI of this resource.
         
     | 
| 
       9369 
9891 
     | 
    
         
             
               */
         
     | 
| 
       9370 
     | 
    
         
            -
              uri:  
     | 
| 
      
 9892 
     | 
    
         
            +
              uri: import_v49.z.string(),
         
     | 
| 
       9371 
9893 
     | 
    
         
             
              /**
         
     | 
| 
       9372 
9894 
     | 
    
         
             
               * The MIME type of this resource, if known.
         
     | 
| 
       9373 
9895 
     | 
    
         
             
               */
         
     | 
| 
       9374 
     | 
    
         
            -
              mimeType:  
     | 
| 
      
 9896 
     | 
    
         
            +
              mimeType: import_v49.z.optional(import_v49.z.string())
         
     | 
| 
       9375 
9897 
     | 
    
         
             
            }).loose();
         
     | 
| 
       9376 
9898 
     | 
    
         
             
            var TextResourceContentsSchema = ResourceContentsSchema.extend({
         
     | 
| 
       9377 
     | 
    
         
            -
              text:  
     | 
| 
      
 9899 
     | 
    
         
            +
              text: import_v49.z.string()
         
     | 
| 
       9378 
9900 
     | 
    
         
             
            });
         
     | 
| 
       9379 
9901 
     | 
    
         
             
            var BlobResourceContentsSchema = ResourceContentsSchema.extend({
         
     | 
| 
       9380 
     | 
    
         
            -
              blob:  
     | 
| 
      
 9902 
     | 
    
         
            +
              blob: import_v49.z.base64()
         
     | 
| 
       9381 
9903 
     | 
    
         
             
            });
         
     | 
| 
       9382 
     | 
    
         
            -
            var EmbeddedResourceSchema =  
     | 
| 
       9383 
     | 
    
         
            -
              type:  
     | 
| 
       9384 
     | 
    
         
            -
              resource:  
     | 
| 
      
 9904 
     | 
    
         
            +
            var EmbeddedResourceSchema = import_v49.z.object({
         
     | 
| 
      
 9905 
     | 
    
         
            +
              type: import_v49.z.literal("resource"),
         
     | 
| 
      
 9906 
     | 
    
         
            +
              resource: import_v49.z.union([TextResourceContentsSchema, BlobResourceContentsSchema])
         
     | 
| 
       9385 
9907 
     | 
    
         
             
            }).loose();
         
     | 
| 
       9386 
9908 
     | 
    
         
             
            var CallToolResultSchema = ResultSchema.extend({
         
     | 
| 
       9387 
     | 
    
         
            -
              content:  
     | 
| 
       9388 
     | 
    
         
            -
                 
     | 
| 
      
 9909 
     | 
    
         
            +
              content: import_v49.z.array(
         
     | 
| 
      
 9910 
     | 
    
         
            +
                import_v49.z.union([TextContentSchema, ImageContentSchema, EmbeddedResourceSchema])
         
     | 
| 
       9389 
9911 
     | 
    
         
             
              ),
         
     | 
| 
       9390 
     | 
    
         
            -
              isError:  
     | 
| 
      
 9912 
     | 
    
         
            +
              isError: import_v49.z.boolean().default(false).optional()
         
     | 
| 
       9391 
9913 
     | 
    
         
             
            }).or(
         
     | 
| 
       9392 
9914 
     | 
    
         
             
              ResultSchema.extend({
         
     | 
| 
       9393 
     | 
    
         
            -
                toolResult:  
     | 
| 
      
 9915 
     | 
    
         
            +
                toolResult: import_v49.z.unknown()
         
     | 
| 
       9394 
9916 
     | 
    
         
             
              })
         
     | 
| 
       9395 
9917 
     | 
    
         
             
            );
         
     | 
| 
       9396 
9918 
     | 
    
         | 
| 
       9397 
9919 
     | 
    
         
             
            // src/tool/mcp/json-rpc-message.ts
         
     | 
| 
       9398 
9920 
     | 
    
         
             
            var JSONRPC_VERSION = "2.0";
         
     | 
| 
       9399 
     | 
    
         
            -
            var JSONRPCRequestSchema =  
     | 
| 
       9400 
     | 
    
         
            -
              jsonrpc:  
     | 
| 
       9401 
     | 
    
         
            -
              id:  
     | 
| 
      
 9921 
     | 
    
         
            +
            var JSONRPCRequestSchema = import_v410.z.object({
         
     | 
| 
      
 9922 
     | 
    
         
            +
              jsonrpc: import_v410.z.literal(JSONRPC_VERSION),
         
     | 
| 
      
 9923 
     | 
    
         
            +
              id: import_v410.z.union([import_v410.z.string(), import_v410.z.number().int()])
         
     | 
| 
       9402 
9924 
     | 
    
         
             
            }).merge(RequestSchema).strict();
         
     | 
| 
       9403 
     | 
    
         
            -
            var JSONRPCResponseSchema =  
     | 
| 
       9404 
     | 
    
         
            -
              jsonrpc:  
     | 
| 
       9405 
     | 
    
         
            -
              id:  
     | 
| 
      
 9925 
     | 
    
         
            +
            var JSONRPCResponseSchema = import_v410.z.object({
         
     | 
| 
      
 9926 
     | 
    
         
            +
              jsonrpc: import_v410.z.literal(JSONRPC_VERSION),
         
     | 
| 
      
 9927 
     | 
    
         
            +
              id: import_v410.z.union([import_v410.z.string(), import_v410.z.number().int()]),
         
     | 
| 
       9406 
9928 
     | 
    
         
             
              result: ResultSchema
         
     | 
| 
       9407 
9929 
     | 
    
         
             
            }).strict();
         
     | 
| 
       9408 
     | 
    
         
            -
            var JSONRPCErrorSchema =  
     | 
| 
       9409 
     | 
    
         
            -
              jsonrpc:  
     | 
| 
       9410 
     | 
    
         
            -
              id:  
     | 
| 
       9411 
     | 
    
         
            -
              error:  
     | 
| 
       9412 
     | 
    
         
            -
                code:  
     | 
| 
       9413 
     | 
    
         
            -
                message:  
     | 
| 
       9414 
     | 
    
         
            -
                data:  
     | 
| 
      
 9930 
     | 
    
         
            +
            var JSONRPCErrorSchema = import_v410.z.object({
         
     | 
| 
      
 9931 
     | 
    
         
            +
              jsonrpc: import_v410.z.literal(JSONRPC_VERSION),
         
     | 
| 
      
 9932 
     | 
    
         
            +
              id: import_v410.z.union([import_v410.z.string(), import_v410.z.number().int()]),
         
     | 
| 
      
 9933 
     | 
    
         
            +
              error: import_v410.z.object({
         
     | 
| 
      
 9934 
     | 
    
         
            +
                code: import_v410.z.number().int(),
         
     | 
| 
      
 9935 
     | 
    
         
            +
                message: import_v410.z.string(),
         
     | 
| 
      
 9936 
     | 
    
         
            +
                data: import_v410.z.optional(import_v410.z.unknown())
         
     | 
| 
       9415 
9937 
     | 
    
         
             
              })
         
     | 
| 
       9416 
9938 
     | 
    
         
             
            }).strict();
         
     | 
| 
       9417 
     | 
    
         
            -
            var JSONRPCNotificationSchema =  
     | 
| 
       9418 
     | 
    
         
            -
              jsonrpc:  
     | 
| 
      
 9939 
     | 
    
         
            +
            var JSONRPCNotificationSchema = import_v410.z.object({
         
     | 
| 
      
 9940 
     | 
    
         
            +
              jsonrpc: import_v410.z.literal(JSONRPC_VERSION)
         
     | 
| 
       9419 
9941 
     | 
    
         
             
            }).merge(
         
     | 
| 
       9420 
     | 
    
         
            -
               
     | 
| 
       9421 
     | 
    
         
            -
                method:  
     | 
| 
       9422 
     | 
    
         
            -
                params:  
     | 
| 
      
 9942 
     | 
    
         
            +
              import_v410.z.object({
         
     | 
| 
      
 9943 
     | 
    
         
            +
                method: import_v410.z.string(),
         
     | 
| 
      
 9944 
     | 
    
         
            +
                params: import_v410.z.optional(BaseParamsSchema)
         
     | 
| 
       9423 
9945 
     | 
    
         
             
              })
         
     | 
| 
       9424 
9946 
     | 
    
         
             
            ).strict();
         
     | 
| 
       9425 
     | 
    
         
            -
            var JSONRPCMessageSchema =  
     | 
| 
      
 9947 
     | 
    
         
            +
            var JSONRPCMessageSchema = import_v410.z.union([
         
     | 
| 
       9426 
9948 
     | 
    
         
             
              JSONRPCRequestSchema,
         
     | 
| 
       9427 
9949 
     | 
    
         
             
              JSONRPCNotificationSchema,
         
     | 
| 
       9428 
9950 
     | 
    
         
             
              JSONRPCResponseSchema,
         
     | 
| 
         @@ -9448,13 +9970,13 @@ var SseMCPTransport = class { 
     | 
|
| 
       9448 
9970 
     | 
    
         
             
                  const establishConnection = async () => {
         
     | 
| 
       9449 
9971 
     | 
    
         
             
                    var _a17, _b, _c;
         
     | 
| 
       9450 
9972 
     | 
    
         
             
                    try {
         
     | 
| 
       9451 
     | 
    
         
            -
                      const headers = (0,  
     | 
| 
      
 9973 
     | 
    
         
            +
                      const headers = (0, import_provider_utils30.withUserAgentSuffix)(
         
     | 
| 
       9452 
9974 
     | 
    
         
             
                        {
         
     | 
| 
       9453 
9975 
     | 
    
         
             
                          ...this.headers,
         
     | 
| 
       9454 
9976 
     | 
    
         
             
                          Accept: "text/event-stream"
         
     | 
| 
       9455 
9977 
     | 
    
         
             
                        },
         
     | 
| 
       9456 
9978 
     | 
    
         
             
                        `ai-sdk/${VERSION}`,
         
     | 
| 
       9457 
     | 
    
         
            -
                        (0,  
     | 
| 
      
 9979 
     | 
    
         
            +
                        (0, import_provider_utils30.getRuntimeEnvironmentUserAgent)()
         
     | 
| 
       9458 
9980 
     | 
    
         
             
                      );
         
     | 
| 
       9459 
9981 
     | 
    
         
             
                      const response = await fetch(this.url.href, {
         
     | 
| 
       9460 
9982 
     | 
    
         
             
                        headers,
         
     | 
| 
         @@ -9467,7 +9989,7 @@ var SseMCPTransport = class { 
     | 
|
| 
       9467 
9989 
     | 
    
         
             
                        (_b = this.onerror) == null ? void 0 : _b.call(this, error);
         
     | 
| 
       9468 
9990 
     | 
    
         
             
                        return reject(error);
         
     | 
| 
       9469 
9991 
     | 
    
         
             
                      }
         
     | 
| 
       9470 
     | 
    
         
            -
                      const stream = response.body.pipeThrough(new TextDecoderStream()).pipeThrough(new  
     | 
| 
      
 9992 
     | 
    
         
            +
                      const stream = response.body.pipeThrough(new TextDecoderStream()).pipeThrough(new import_provider_utils30.EventSourceParserStream());
         
     | 
| 
       9471 
9993 
     | 
    
         
             
                      const reader = stream.getReader();
         
     | 
| 
       9472 
9994 
     | 
    
         
             
                      const processEvents = async () => {
         
     | 
| 
       9473 
9995 
     | 
    
         
             
                        var _a18, _b2, _c2;
         
     | 
| 
         @@ -9546,13 +10068,13 @@ var SseMCPTransport = class { 
     | 
|
| 
       9546 
10068 
     | 
    
         
             
                  });
         
     | 
| 
       9547 
10069 
     | 
    
         
             
                }
         
     | 
| 
       9548 
10070 
     | 
    
         
             
                try {
         
     | 
| 
       9549 
     | 
    
         
            -
                  const headers = (0,  
     | 
| 
      
 10071 
     | 
    
         
            +
                  const headers = (0, import_provider_utils30.withUserAgentSuffix)(
         
     | 
| 
       9550 
10072 
     | 
    
         
             
                    {
         
     | 
| 
       9551 
10073 
     | 
    
         
             
                      ...this.headers,
         
     | 
| 
       9552 
10074 
     | 
    
         
             
                      "Content-Type": "application/json"
         
     | 
| 
       9553 
10075 
     | 
    
         
             
                    },
         
     | 
| 
       9554 
10076 
     | 
    
         
             
                    `ai-sdk/${VERSION}`,
         
     | 
| 
       9555 
     | 
    
         
            -
                    (0,  
     | 
| 
      
 10077 
     | 
    
         
            +
                    (0, import_provider_utils30.getRuntimeEnvironmentUserAgent)()
         
     | 
| 
       9556 
10078 
     | 
    
         
             
                  );
         
     | 
| 
       9557 
10079 
     | 
    
         
             
                  const init = {
         
     | 
| 
       9558 
10080 
     | 
    
         
             
                    method: "POST",
         
     | 
| 
         @@ -9803,15 +10325,15 @@ var DefaultMCPClient = class { 
     | 
|
| 
       9803 
10325 
     | 
    
         
             
                      (_a18 = options == null ? void 0 : options.abortSignal) == null ? void 0 : _a18.throwIfAborted();
         
     | 
| 
       9804 
10326 
     | 
    
         
             
                      return self.callTool({ name: name17, args, options });
         
     | 
| 
       9805 
10327 
     | 
    
         
             
                    };
         
     | 
| 
       9806 
     | 
    
         
            -
                    const toolWithExecute = schemas === "automatic" ? (0,  
     | 
| 
      
 10328 
     | 
    
         
            +
                    const toolWithExecute = schemas === "automatic" ? (0, import_provider_utils31.dynamicTool)({
         
     | 
| 
       9807 
10329 
     | 
    
         
             
                      description,
         
     | 
| 
       9808 
     | 
    
         
            -
                      inputSchema: (0,  
     | 
| 
      
 10330 
     | 
    
         
            +
                      inputSchema: (0, import_provider_utils31.jsonSchema)({
         
     | 
| 
       9809 
10331 
     | 
    
         
             
                        ...inputSchema,
         
     | 
| 
       9810 
10332 
     | 
    
         
             
                        properties: (_a17 = inputSchema.properties) != null ? _a17 : {},
         
     | 
| 
       9811 
10333 
     | 
    
         
             
                        additionalProperties: false
         
     | 
| 
       9812 
10334 
     | 
    
         
             
                      }),
         
     | 
| 
       9813 
10335 
     | 
    
         
             
                      execute
         
     | 
| 
       9814 
     | 
    
         
            -
                    }) : (0,  
     | 
| 
      
 10336 
     | 
    
         
            +
                    }) : (0, import_provider_utils31.tool)({
         
     | 
| 
       9815 
10337 
     | 
    
         
             
                      description,
         
     | 
| 
       9816 
10338 
     | 
    
         
             
                      inputSchema: schemas[name17].inputSchema,
         
     | 
| 
       9817 
10339 
     | 
    
         
             
                      execute
         
     | 
| 
         @@ -9863,11 +10385,11 @@ var DefaultMCPClient = class { 
     | 
|
| 
       9863 
10385 
     | 
    
         
             
            };
         
     | 
| 
       9864 
10386 
     | 
    
         | 
| 
       9865 
10387 
     | 
    
         
             
            // src/transcribe/transcribe.ts
         
     | 
| 
       9866 
     | 
    
         
            -
            var  
     | 
| 
      
 10388 
     | 
    
         
            +
            var import_provider_utils32 = require("@ai-sdk/provider-utils");
         
     | 
| 
       9867 
10389 
     | 
    
         | 
| 
       9868 
10390 
     | 
    
         
             
            // src/error/no-transcript-generated-error.ts
         
     | 
| 
       9869 
     | 
    
         
            -
            var  
     | 
| 
       9870 
     | 
    
         
            -
            var NoTranscriptGeneratedError = class extends  
     | 
| 
      
 10391 
     | 
    
         
            +
            var import_provider32 = require("@ai-sdk/provider");
         
     | 
| 
      
 10392 
     | 
    
         
            +
            var NoTranscriptGeneratedError = class extends import_provider32.AISDKError {
         
     | 
| 
       9871 
10393 
     | 
    
         
             
              constructor(options) {
         
     | 
| 
       9872 
10394 
     | 
    
         
             
                super({
         
     | 
| 
       9873 
10395 
     | 
    
         
             
                  name: "AI_NoTranscriptGeneratedError",
         
     | 
| 
         @@ -9894,7 +10416,7 @@ async function transcribe({ 
     | 
|
| 
       9894 
10416 
     | 
    
         
             
                maxRetries: maxRetriesArg,
         
     | 
| 
       9895 
10417 
     | 
    
         
             
                abortSignal
         
     | 
| 
       9896 
10418 
     | 
    
         
             
              });
         
     | 
| 
       9897 
     | 
    
         
            -
              const headersWithUserAgent = (0,  
     | 
| 
      
 10419 
     | 
    
         
            +
              const headersWithUserAgent = (0, import_provider_utils32.withUserAgentSuffix)(
         
     | 
| 
       9898 
10420 
     | 
    
         
             
                headers != null ? headers : {},
         
     | 
| 
       9899 
10421 
     | 
    
         
             
                `ai/${VERSION}`
         
     | 
| 
       9900 
10422 
     | 
    
         
             
              );
         
     | 
| 
         @@ -9942,7 +10464,7 @@ var DefaultTranscriptionResult = class { 
     | 
|
| 
       9942 
10464 
     | 
    
         
             
            };
         
     | 
| 
       9943 
10465 
     | 
    
         | 
| 
       9944 
10466 
     | 
    
         
             
            // src/ui/call-completion-api.ts
         
     | 
| 
       9945 
     | 
    
         
            -
            var  
     | 
| 
      
 10467 
     | 
    
         
            +
            var import_provider_utils33 = require("@ai-sdk/provider-utils");
         
     | 
| 
       9946 
10468 
     | 
    
         | 
| 
       9947 
10469 
     | 
    
         
             
            // src/ui/process-text-stream.ts
         
     | 
| 
       9948 
10470 
     | 
    
         
             
            async function processTextStream({
         
     | 
| 
         @@ -9990,13 +10512,13 @@ async function callCompletionApi({ 
     | 
|
| 
       9990 
10512 
     | 
    
         
             
                    ...body
         
     | 
| 
       9991 
10513 
     | 
    
         
             
                  }),
         
     | 
| 
       9992 
10514 
     | 
    
         
             
                  credentials,
         
     | 
| 
       9993 
     | 
    
         
            -
                  headers: (0,  
     | 
| 
      
 10515 
     | 
    
         
            +
                  headers: (0, import_provider_utils33.withUserAgentSuffix)(
         
     | 
| 
       9994 
10516 
     | 
    
         
             
                    {
         
     | 
| 
       9995 
10517 
     | 
    
         
             
                      "Content-Type": "application/json",
         
     | 
| 
       9996 
10518 
     | 
    
         
             
                      ...headers
         
     | 
| 
       9997 
10519 
     | 
    
         
             
                    },
         
     | 
| 
       9998 
10520 
     | 
    
         
             
                    `ai-sdk/${VERSION}`,
         
     | 
| 
       9999 
     | 
    
         
            -
                    (0,  
     | 
| 
      
 10521 
     | 
    
         
            +
                    (0, import_provider_utils33.getRuntimeEnvironmentUserAgent)()
         
     | 
| 
       10000 
10522 
     | 
    
         
             
                  ),
         
     | 
| 
       10001 
10523 
     | 
    
         
             
                  signal: abortController.signal
         
     | 
| 
       10002 
10524 
     | 
    
         
             
                }).catch((err) => {
         
     | 
| 
         @@ -10024,7 +10546,7 @@ async function callCompletionApi({ 
     | 
|
| 
       10024 
10546 
     | 
    
         
             
                  }
         
     | 
| 
       10025 
10547 
     | 
    
         
             
                  case "data": {
         
     | 
| 
       10026 
10548 
     | 
    
         
             
                    await consumeStream({
         
     | 
| 
       10027 
     | 
    
         
            -
                      stream: (0,  
     | 
| 
      
 10549 
     | 
    
         
            +
                      stream: (0, import_provider_utils33.parseJsonEventStream)({
         
     | 
| 
       10028 
10550 
     | 
    
         
             
                        stream: response.body,
         
     | 
| 
       10029 
10551 
     | 
    
         
             
                        schema: uiMessageChunkSchema
         
     | 
| 
       10030 
10552 
     | 
    
         
             
                      }).pipeThrough(
         
     | 
| 
         @@ -10076,7 +10598,7 @@ async function callCompletionApi({ 
     | 
|
| 
       10076 
10598 
     | 
    
         
             
            }
         
     | 
| 
       10077 
10599 
     | 
    
         | 
| 
       10078 
10600 
     | 
    
         
             
            // src/ui/chat.ts
         
     | 
| 
       10079 
     | 
    
         
            -
            var  
     | 
| 
      
 10601 
     | 
    
         
            +
            var import_provider_utils36 = require("@ai-sdk/provider-utils");
         
     | 
| 
       10080 
10602 
     | 
    
         | 
| 
       10081 
10603 
     | 
    
         
             
            // src/ui/convert-file-list-to-file-ui-parts.ts
         
     | 
| 
       10082 
10604 
     | 
    
         
             
            async function convertFileListToFileUIParts(files) {
         
     | 
| 
         @@ -10109,10 +10631,10 @@ async function convertFileListToFileUIParts(files) { 
     | 
|
| 
       10109 
10631 
     | 
    
         
             
            }
         
     | 
| 
       10110 
10632 
     | 
    
         | 
| 
       10111 
10633 
     | 
    
         
             
            // src/ui/default-chat-transport.ts
         
     | 
| 
       10112 
     | 
    
         
            -
            var  
     | 
| 
      
 10634 
     | 
    
         
            +
            var import_provider_utils35 = require("@ai-sdk/provider-utils");
         
     | 
| 
       10113 
10635 
     | 
    
         | 
| 
       10114 
10636 
     | 
    
         
             
            // src/ui/http-chat-transport.ts
         
     | 
| 
       10115 
     | 
    
         
            -
            var  
     | 
| 
      
 10637 
     | 
    
         
            +
            var import_provider_utils34 = require("@ai-sdk/provider-utils");
         
     | 
| 
       10116 
10638 
     | 
    
         
             
            var HttpChatTransport = class {
         
     | 
| 
       10117 
10639 
     | 
    
         
             
              constructor({
         
     | 
| 
       10118 
10640 
     | 
    
         
             
                api = "/api/chat",
         
     | 
| 
         @@ -10136,9 +10658,9 @@ var HttpChatTransport = class { 
     | 
|
| 
       10136 
10658 
     | 
    
         
             
                ...options
         
     | 
| 
       10137 
10659 
     | 
    
         
             
              }) {
         
     | 
| 
       10138 
10660 
     | 
    
         
             
                var _a17, _b, _c, _d, _e;
         
     | 
| 
       10139 
     | 
    
         
            -
                const resolvedBody = await (0,  
     | 
| 
       10140 
     | 
    
         
            -
                const resolvedHeaders = await (0,  
     | 
| 
       10141 
     | 
    
         
            -
                const resolvedCredentials = await (0,  
     | 
| 
      
 10661 
     | 
    
         
            +
                const resolvedBody = await (0, import_provider_utils34.resolve)(this.body);
         
     | 
| 
      
 10662 
     | 
    
         
            +
                const resolvedHeaders = await (0, import_provider_utils34.resolve)(this.headers);
         
     | 
| 
      
 10663 
     | 
    
         
            +
                const resolvedCredentials = await (0, import_provider_utils34.resolve)(this.credentials);
         
     | 
| 
       10142 
10664 
     | 
    
         
             
                const preparedRequest = await ((_a17 = this.prepareSendMessagesRequest) == null ? void 0 : _a17.call(this, {
         
     | 
| 
       10143 
10665 
     | 
    
         
             
                  api: this.api,
         
     | 
| 
       10144 
10666 
     | 
    
         
             
                  id: options.chatId,
         
     | 
| 
         @@ -10164,13 +10686,13 @@ var HttpChatTransport = class { 
     | 
|
| 
       10164 
10686 
     | 
    
         
             
                const fetch2 = (_d = this.fetch) != null ? _d : globalThis.fetch;
         
     | 
| 
       10165 
10687 
     | 
    
         
             
                const response = await fetch2(api, {
         
     | 
| 
       10166 
10688 
     | 
    
         
             
                  method: "POST",
         
     | 
| 
       10167 
     | 
    
         
            -
                  headers: (0,  
     | 
| 
      
 10689 
     | 
    
         
            +
                  headers: (0, import_provider_utils34.withUserAgentSuffix)(
         
     | 
| 
       10168 
10690 
     | 
    
         
             
                    {
         
     | 
| 
       10169 
10691 
     | 
    
         
             
                      "Content-Type": "application/json",
         
     | 
| 
       10170 
10692 
     | 
    
         
             
                      ...headers
         
     | 
| 
       10171 
10693 
     | 
    
         
             
                    },
         
     | 
| 
       10172 
10694 
     | 
    
         
             
                    `ai-sdk/${VERSION}`,
         
     | 
| 
       10173 
     | 
    
         
            -
                    (0,  
     | 
| 
      
 10695 
     | 
    
         
            +
                    (0, import_provider_utils34.getRuntimeEnvironmentUserAgent)()
         
     | 
| 
       10174 
10696 
     | 
    
         
             
                  ),
         
     | 
| 
       10175 
10697 
     | 
    
         
             
                  body: JSON.stringify(body),
         
     | 
| 
       10176 
10698 
     | 
    
         
             
                  credentials,
         
     | 
| 
         @@ -10188,9 +10710,9 @@ var HttpChatTransport = class { 
     | 
|
| 
       10188 
10710 
     | 
    
         
             
              }
         
     | 
| 
       10189 
10711 
     | 
    
         
             
              async reconnectToStream(options) {
         
     | 
| 
       10190 
10712 
     | 
    
         
             
                var _a17, _b, _c, _d, _e;
         
     | 
| 
       10191 
     | 
    
         
            -
                const resolvedBody = await (0,  
     | 
| 
       10192 
     | 
    
         
            -
                const resolvedHeaders = await (0,  
     | 
| 
       10193 
     | 
    
         
            -
                const resolvedCredentials = await (0,  
     | 
| 
      
 10713 
     | 
    
         
            +
                const resolvedBody = await (0, import_provider_utils34.resolve)(this.body);
         
     | 
| 
      
 10714 
     | 
    
         
            +
                const resolvedHeaders = await (0, import_provider_utils34.resolve)(this.headers);
         
     | 
| 
      
 10715 
     | 
    
         
            +
                const resolvedCredentials = await (0, import_provider_utils34.resolve)(this.credentials);
         
     | 
| 
       10194 
10716 
     | 
    
         
             
                const preparedRequest = await ((_a17 = this.prepareReconnectToStreamRequest) == null ? void 0 : _a17.call(this, {
         
     | 
| 
       10195 
10717 
     | 
    
         
             
                  api: this.api,
         
     | 
| 
       10196 
10718 
     | 
    
         
             
                  id: options.chatId,
         
     | 
| 
         @@ -10205,10 +10727,10 @@ var HttpChatTransport = class { 
     | 
|
| 
       10205 
10727 
     | 
    
         
             
                const fetch2 = (_d = this.fetch) != null ? _d : globalThis.fetch;
         
     | 
| 
       10206 
10728 
     | 
    
         
             
                const response = await fetch2(api, {
         
     | 
| 
       10207 
10729 
     | 
    
         
             
                  method: "GET",
         
     | 
| 
       10208 
     | 
    
         
            -
                  headers: (0,  
     | 
| 
      
 10730 
     | 
    
         
            +
                  headers: (0, import_provider_utils34.withUserAgentSuffix)(
         
     | 
| 
       10209 
10731 
     | 
    
         
             
                    headers,
         
     | 
| 
       10210 
10732 
     | 
    
         
             
                    `ai-sdk/${VERSION}`,
         
     | 
| 
       10211 
     | 
    
         
            -
                    (0,  
     | 
| 
      
 10733 
     | 
    
         
            +
                    (0, import_provider_utils34.getRuntimeEnvironmentUserAgent)()
         
     | 
| 
       10212 
10734 
     | 
    
         
             
                  ),
         
     | 
| 
       10213 
10735 
     | 
    
         
             
                  credentials
         
     | 
| 
       10214 
10736 
     | 
    
         
             
                });
         
     | 
| 
         @@ -10233,7 +10755,7 @@ var DefaultChatTransport = class extends HttpChatTransport { 
     | 
|
| 
       10233 
10755 
     | 
    
         
             
                super(options);
         
     | 
| 
       10234 
10756 
     | 
    
         
             
              }
         
     | 
| 
       10235 
10757 
     | 
    
         
             
              processResponseStream(stream) {
         
     | 
| 
       10236 
     | 
    
         
            -
                return (0,  
     | 
| 
      
 10758 
     | 
    
         
            +
                return (0, import_provider_utils35.parseJsonEventStream)({
         
     | 
| 
       10237 
10759 
     | 
    
         
             
                  stream,
         
     | 
| 
       10238 
10760 
     | 
    
         
             
                  schema: uiMessageChunkSchema
         
     | 
| 
       10239 
10761 
     | 
    
         
             
                }).pipeThrough(
         
     | 
| 
         @@ -10252,7 +10774,7 @@ var DefaultChatTransport = class extends HttpChatTransport { 
     | 
|
| 
       10252 
10774 
     | 
    
         
             
            // src/ui/chat.ts
         
     | 
| 
       10253 
10775 
     | 
    
         
             
            var AbstractChat = class {
         
     | 
| 
       10254 
10776 
     | 
    
         
             
              constructor({
         
     | 
| 
       10255 
     | 
    
         
            -
                generateId: generateId2 =  
     | 
| 
      
 10777 
     | 
    
         
            +
                generateId: generateId2 = import_provider_utils36.generateId,
         
     | 
| 
       10256 
10778 
     | 
    
         
             
                id = generateId2(),
         
     | 
| 
       10257 
10779 
     | 
    
         
             
                transport = new DefaultChatTransport(),
         
     | 
| 
       10258 
10780 
     | 
    
         
             
                messageMetadataSchema,
         
     | 
| 
         @@ -10678,516 +11200,6 @@ var TextStreamChatTransport = class extends HttpChatTransport { 
     | 
|
| 
       10678 
11200 
     | 
    
         
             
                });
         
     | 
| 
       10679 
11201 
     | 
    
         
             
              }
         
     | 
| 
       10680 
11202 
     | 
    
         
             
            };
         
     | 
| 
       10681 
     | 
    
         
            -
             
     | 
| 
       10682 
     | 
    
         
            -
            // src/ui/validate-ui-messages.ts
         
     | 
| 
       10683 
     | 
    
         
            -
            var import_provider32 = require("@ai-sdk/provider");
         
     | 
| 
       10684 
     | 
    
         
            -
            var import_provider_utils35 = require("@ai-sdk/provider-utils");
         
     | 
| 
       10685 
     | 
    
         
            -
            var import_v410 = require("zod/v4");
         
     | 
| 
       10686 
     | 
    
         
            -
            var uiMessagesSchema = (0, import_provider_utils35.lazySchema)(
         
     | 
| 
       10687 
     | 
    
         
            -
              () => (0, import_provider_utils35.zodSchema)(
         
     | 
| 
       10688 
     | 
    
         
            -
                import_v410.z.array(
         
     | 
| 
       10689 
     | 
    
         
            -
                  import_v410.z.object({
         
     | 
| 
       10690 
     | 
    
         
            -
                    id: import_v410.z.string(),
         
     | 
| 
       10691 
     | 
    
         
            -
                    role: import_v410.z.enum(["system", "user", "assistant"]),
         
     | 
| 
       10692 
     | 
    
         
            -
                    metadata: import_v410.z.unknown().optional(),
         
     | 
| 
       10693 
     | 
    
         
            -
                    parts: import_v410.z.array(
         
     | 
| 
       10694 
     | 
    
         
            -
                      import_v410.z.union([
         
     | 
| 
       10695 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10696 
     | 
    
         
            -
                          type: import_v410.z.literal("text"),
         
     | 
| 
       10697 
     | 
    
         
            -
                          text: import_v410.z.string(),
         
     | 
| 
       10698 
     | 
    
         
            -
                          state: import_v410.z.enum(["streaming", "done"]).optional(),
         
     | 
| 
       10699 
     | 
    
         
            -
                          providerMetadata: providerMetadataSchema.optional()
         
     | 
| 
       10700 
     | 
    
         
            -
                        }),
         
     | 
| 
       10701 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10702 
     | 
    
         
            -
                          type: import_v410.z.literal("reasoning"),
         
     | 
| 
       10703 
     | 
    
         
            -
                          text: import_v410.z.string(),
         
     | 
| 
       10704 
     | 
    
         
            -
                          state: import_v410.z.enum(["streaming", "done"]).optional(),
         
     | 
| 
       10705 
     | 
    
         
            -
                          providerMetadata: providerMetadataSchema.optional()
         
     | 
| 
       10706 
     | 
    
         
            -
                        }),
         
     | 
| 
       10707 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10708 
     | 
    
         
            -
                          type: import_v410.z.literal("source-url"),
         
     | 
| 
       10709 
     | 
    
         
            -
                          sourceId: import_v410.z.string(),
         
     | 
| 
       10710 
     | 
    
         
            -
                          url: import_v410.z.string(),
         
     | 
| 
       10711 
     | 
    
         
            -
                          title: import_v410.z.string().optional(),
         
     | 
| 
       10712 
     | 
    
         
            -
                          providerMetadata: providerMetadataSchema.optional()
         
     | 
| 
       10713 
     | 
    
         
            -
                        }),
         
     | 
| 
       10714 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10715 
     | 
    
         
            -
                          type: import_v410.z.literal("source-document"),
         
     | 
| 
       10716 
     | 
    
         
            -
                          sourceId: import_v410.z.string(),
         
     | 
| 
       10717 
     | 
    
         
            -
                          mediaType: import_v410.z.string(),
         
     | 
| 
       10718 
     | 
    
         
            -
                          title: import_v410.z.string(),
         
     | 
| 
       10719 
     | 
    
         
            -
                          filename: import_v410.z.string().optional(),
         
     | 
| 
       10720 
     | 
    
         
            -
                          providerMetadata: providerMetadataSchema.optional()
         
     | 
| 
       10721 
     | 
    
         
            -
                        }),
         
     | 
| 
       10722 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10723 
     | 
    
         
            -
                          type: import_v410.z.literal("file"),
         
     | 
| 
       10724 
     | 
    
         
            -
                          mediaType: import_v410.z.string(),
         
     | 
| 
       10725 
     | 
    
         
            -
                          filename: import_v410.z.string().optional(),
         
     | 
| 
       10726 
     | 
    
         
            -
                          url: import_v410.z.string(),
         
     | 
| 
       10727 
     | 
    
         
            -
                          providerMetadata: providerMetadataSchema.optional()
         
     | 
| 
       10728 
     | 
    
         
            -
                        }),
         
     | 
| 
       10729 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10730 
     | 
    
         
            -
                          type: import_v410.z.literal("step-start")
         
     | 
| 
       10731 
     | 
    
         
            -
                        }),
         
     | 
| 
       10732 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10733 
     | 
    
         
            -
                          type: import_v410.z.string().startsWith("data-"),
         
     | 
| 
       10734 
     | 
    
         
            -
                          id: import_v410.z.string().optional(),
         
     | 
| 
       10735 
     | 
    
         
            -
                          data: import_v410.z.unknown()
         
     | 
| 
       10736 
     | 
    
         
            -
                        }),
         
     | 
| 
       10737 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10738 
     | 
    
         
            -
                          type: import_v410.z.literal("dynamic-tool"),
         
     | 
| 
       10739 
     | 
    
         
            -
                          toolName: import_v410.z.string(),
         
     | 
| 
       10740 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10741 
     | 
    
         
            -
                          state: import_v410.z.literal("input-streaming"),
         
     | 
| 
       10742 
     | 
    
         
            -
                          input: import_v410.z.unknown().optional(),
         
     | 
| 
       10743 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10744 
     | 
    
         
            -
                          output: import_v410.z.never().optional(),
         
     | 
| 
       10745 
     | 
    
         
            -
                          errorText: import_v410.z.never().optional(),
         
     | 
| 
       10746 
     | 
    
         
            -
                          approval: import_v410.z.never().optional()
         
     | 
| 
       10747 
     | 
    
         
            -
                        }),
         
     | 
| 
       10748 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10749 
     | 
    
         
            -
                          type: import_v410.z.literal("dynamic-tool"),
         
     | 
| 
       10750 
     | 
    
         
            -
                          toolName: import_v410.z.string(),
         
     | 
| 
       10751 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10752 
     | 
    
         
            -
                          state: import_v410.z.literal("input-available"),
         
     | 
| 
       10753 
     | 
    
         
            -
                          input: import_v410.z.unknown(),
         
     | 
| 
       10754 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10755 
     | 
    
         
            -
                          output: import_v410.z.never().optional(),
         
     | 
| 
       10756 
     | 
    
         
            -
                          errorText: import_v410.z.never().optional(),
         
     | 
| 
       10757 
     | 
    
         
            -
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
       10758 
     | 
    
         
            -
                          approval: import_v410.z.never().optional()
         
     | 
| 
       10759 
     | 
    
         
            -
                        }),
         
     | 
| 
       10760 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10761 
     | 
    
         
            -
                          type: import_v410.z.literal("dynamic-tool"),
         
     | 
| 
       10762 
     | 
    
         
            -
                          toolName: import_v410.z.string(),
         
     | 
| 
       10763 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10764 
     | 
    
         
            -
                          state: import_v410.z.literal("approval-requested"),
         
     | 
| 
       10765 
     | 
    
         
            -
                          input: import_v410.z.unknown(),
         
     | 
| 
       10766 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10767 
     | 
    
         
            -
                          output: import_v410.z.never().optional(),
         
     | 
| 
       10768 
     | 
    
         
            -
                          errorText: import_v410.z.never().optional(),
         
     | 
| 
       10769 
     | 
    
         
            -
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
       10770 
     | 
    
         
            -
                          approval: import_v410.z.object({
         
     | 
| 
       10771 
     | 
    
         
            -
                            id: import_v410.z.string(),
         
     | 
| 
       10772 
     | 
    
         
            -
                            approved: import_v410.z.never().optional(),
         
     | 
| 
       10773 
     | 
    
         
            -
                            reason: import_v410.z.never().optional()
         
     | 
| 
       10774 
     | 
    
         
            -
                          })
         
     | 
| 
       10775 
     | 
    
         
            -
                        }),
         
     | 
| 
       10776 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10777 
     | 
    
         
            -
                          type: import_v410.z.literal("dynamic-tool"),
         
     | 
| 
       10778 
     | 
    
         
            -
                          toolName: import_v410.z.string(),
         
     | 
| 
       10779 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10780 
     | 
    
         
            -
                          state: import_v410.z.literal("approval-responded"),
         
     | 
| 
       10781 
     | 
    
         
            -
                          input: import_v410.z.unknown(),
         
     | 
| 
       10782 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10783 
     | 
    
         
            -
                          output: import_v410.z.never().optional(),
         
     | 
| 
       10784 
     | 
    
         
            -
                          errorText: import_v410.z.never().optional(),
         
     | 
| 
       10785 
     | 
    
         
            -
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
       10786 
     | 
    
         
            -
                          approval: import_v410.z.object({
         
     | 
| 
       10787 
     | 
    
         
            -
                            id: import_v410.z.string(),
         
     | 
| 
       10788 
     | 
    
         
            -
                            approved: import_v410.z.boolean(),
         
     | 
| 
       10789 
     | 
    
         
            -
                            reason: import_v410.z.string().optional()
         
     | 
| 
       10790 
     | 
    
         
            -
                          })
         
     | 
| 
       10791 
     | 
    
         
            -
                        }),
         
     | 
| 
       10792 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10793 
     | 
    
         
            -
                          type: import_v410.z.literal("dynamic-tool"),
         
     | 
| 
       10794 
     | 
    
         
            -
                          toolName: import_v410.z.string(),
         
     | 
| 
       10795 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10796 
     | 
    
         
            -
                          state: import_v410.z.literal("output-available"),
         
     | 
| 
       10797 
     | 
    
         
            -
                          input: import_v410.z.unknown(),
         
     | 
| 
       10798 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10799 
     | 
    
         
            -
                          output: import_v410.z.unknown(),
         
     | 
| 
       10800 
     | 
    
         
            -
                          errorText: import_v410.z.never().optional(),
         
     | 
| 
       10801 
     | 
    
         
            -
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
       10802 
     | 
    
         
            -
                          preliminary: import_v410.z.boolean().optional(),
         
     | 
| 
       10803 
     | 
    
         
            -
                          approval: import_v410.z.object({
         
     | 
| 
       10804 
     | 
    
         
            -
                            id: import_v410.z.string(),
         
     | 
| 
       10805 
     | 
    
         
            -
                            approved: import_v410.z.literal(true),
         
     | 
| 
       10806 
     | 
    
         
            -
                            reason: import_v410.z.string().optional()
         
     | 
| 
       10807 
     | 
    
         
            -
                          }).optional()
         
     | 
| 
       10808 
     | 
    
         
            -
                        }),
         
     | 
| 
       10809 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10810 
     | 
    
         
            -
                          type: import_v410.z.literal("dynamic-tool"),
         
     | 
| 
       10811 
     | 
    
         
            -
                          toolName: import_v410.z.string(),
         
     | 
| 
       10812 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10813 
     | 
    
         
            -
                          state: import_v410.z.literal("output-error"),
         
     | 
| 
       10814 
     | 
    
         
            -
                          input: import_v410.z.unknown(),
         
     | 
| 
       10815 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10816 
     | 
    
         
            -
                          output: import_v410.z.never().optional(),
         
     | 
| 
       10817 
     | 
    
         
            -
                          errorText: import_v410.z.string(),
         
     | 
| 
       10818 
     | 
    
         
            -
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
       10819 
     | 
    
         
            -
                          approval: import_v410.z.object({
         
     | 
| 
       10820 
     | 
    
         
            -
                            id: import_v410.z.string(),
         
     | 
| 
       10821 
     | 
    
         
            -
                            approved: import_v410.z.literal(true),
         
     | 
| 
       10822 
     | 
    
         
            -
                            reason: import_v410.z.string().optional()
         
     | 
| 
       10823 
     | 
    
         
            -
                          }).optional()
         
     | 
| 
       10824 
     | 
    
         
            -
                        }),
         
     | 
| 
       10825 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10826 
     | 
    
         
            -
                          type: import_v410.z.literal("dynamic-tool"),
         
     | 
| 
       10827 
     | 
    
         
            -
                          toolName: import_v410.z.string(),
         
     | 
| 
       10828 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10829 
     | 
    
         
            -
                          state: import_v410.z.literal("output-denied"),
         
     | 
| 
       10830 
     | 
    
         
            -
                          input: import_v410.z.unknown(),
         
     | 
| 
       10831 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10832 
     | 
    
         
            -
                          output: import_v410.z.never().optional(),
         
     | 
| 
       10833 
     | 
    
         
            -
                          errorText: import_v410.z.never().optional(),
         
     | 
| 
       10834 
     | 
    
         
            -
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
       10835 
     | 
    
         
            -
                          approval: import_v410.z.object({
         
     | 
| 
       10836 
     | 
    
         
            -
                            id: import_v410.z.string(),
         
     | 
| 
       10837 
     | 
    
         
            -
                            approved: import_v410.z.literal(false),
         
     | 
| 
       10838 
     | 
    
         
            -
                            reason: import_v410.z.string().optional()
         
     | 
| 
       10839 
     | 
    
         
            -
                          })
         
     | 
| 
       10840 
     | 
    
         
            -
                        }),
         
     | 
| 
       10841 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10842 
     | 
    
         
            -
                          type: import_v410.z.string().startsWith("tool-"),
         
     | 
| 
       10843 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10844 
     | 
    
         
            -
                          state: import_v410.z.literal("input-streaming"),
         
     | 
| 
       10845 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10846 
     | 
    
         
            -
                          input: import_v410.z.unknown().optional(),
         
     | 
| 
       10847 
     | 
    
         
            -
                          output: import_v410.z.never().optional(),
         
     | 
| 
       10848 
     | 
    
         
            -
                          errorText: import_v410.z.never().optional(),
         
     | 
| 
       10849 
     | 
    
         
            -
                          approval: import_v410.z.never().optional()
         
     | 
| 
       10850 
     | 
    
         
            -
                        }),
         
     | 
| 
       10851 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10852 
     | 
    
         
            -
                          type: import_v410.z.string().startsWith("tool-"),
         
     | 
| 
       10853 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10854 
     | 
    
         
            -
                          state: import_v410.z.literal("input-available"),
         
     | 
| 
       10855 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10856 
     | 
    
         
            -
                          input: import_v410.z.unknown(),
         
     | 
| 
       10857 
     | 
    
         
            -
                          output: import_v410.z.never().optional(),
         
     | 
| 
       10858 
     | 
    
         
            -
                          errorText: import_v410.z.never().optional(),
         
     | 
| 
       10859 
     | 
    
         
            -
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
       10860 
     | 
    
         
            -
                          approval: import_v410.z.never().optional()
         
     | 
| 
       10861 
     | 
    
         
            -
                        }),
         
     | 
| 
       10862 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10863 
     | 
    
         
            -
                          type: import_v410.z.string().startsWith("tool-"),
         
     | 
| 
       10864 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10865 
     | 
    
         
            -
                          state: import_v410.z.literal("approval-requested"),
         
     | 
| 
       10866 
     | 
    
         
            -
                          input: import_v410.z.unknown(),
         
     | 
| 
       10867 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10868 
     | 
    
         
            -
                          output: import_v410.z.never().optional(),
         
     | 
| 
       10869 
     | 
    
         
            -
                          errorText: import_v410.z.never().optional(),
         
     | 
| 
       10870 
     | 
    
         
            -
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
       10871 
     | 
    
         
            -
                          approval: import_v410.z.object({
         
     | 
| 
       10872 
     | 
    
         
            -
                            id: import_v410.z.string(),
         
     | 
| 
       10873 
     | 
    
         
            -
                            approved: import_v410.z.never().optional(),
         
     | 
| 
       10874 
     | 
    
         
            -
                            reason: import_v410.z.never().optional()
         
     | 
| 
       10875 
     | 
    
         
            -
                          })
         
     | 
| 
       10876 
     | 
    
         
            -
                        }),
         
     | 
| 
       10877 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10878 
     | 
    
         
            -
                          type: import_v410.z.string().startsWith("tool-"),
         
     | 
| 
       10879 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10880 
     | 
    
         
            -
                          state: import_v410.z.literal("approval-responded"),
         
     | 
| 
       10881 
     | 
    
         
            -
                          input: import_v410.z.unknown(),
         
     | 
| 
       10882 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10883 
     | 
    
         
            -
                          output: import_v410.z.never().optional(),
         
     | 
| 
       10884 
     | 
    
         
            -
                          errorText: import_v410.z.never().optional(),
         
     | 
| 
       10885 
     | 
    
         
            -
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
       10886 
     | 
    
         
            -
                          approval: import_v410.z.object({
         
     | 
| 
       10887 
     | 
    
         
            -
                            id: import_v410.z.string(),
         
     | 
| 
       10888 
     | 
    
         
            -
                            approved: import_v410.z.boolean(),
         
     | 
| 
       10889 
     | 
    
         
            -
                            reason: import_v410.z.string().optional()
         
     | 
| 
       10890 
     | 
    
         
            -
                          })
         
     | 
| 
       10891 
     | 
    
         
            -
                        }),
         
     | 
| 
       10892 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10893 
     | 
    
         
            -
                          type: import_v410.z.string().startsWith("tool-"),
         
     | 
| 
       10894 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10895 
     | 
    
         
            -
                          state: import_v410.z.literal("output-available"),
         
     | 
| 
       10896 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10897 
     | 
    
         
            -
                          input: import_v410.z.unknown(),
         
     | 
| 
       10898 
     | 
    
         
            -
                          output: import_v410.z.unknown(),
         
     | 
| 
       10899 
     | 
    
         
            -
                          errorText: import_v410.z.never().optional(),
         
     | 
| 
       10900 
     | 
    
         
            -
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
       10901 
     | 
    
         
            -
                          preliminary: import_v410.z.boolean().optional(),
         
     | 
| 
       10902 
     | 
    
         
            -
                          approval: import_v410.z.object({
         
     | 
| 
       10903 
     | 
    
         
            -
                            id: import_v410.z.string(),
         
     | 
| 
       10904 
     | 
    
         
            -
                            approved: import_v410.z.literal(true),
         
     | 
| 
       10905 
     | 
    
         
            -
                            reason: import_v410.z.string().optional()
         
     | 
| 
       10906 
     | 
    
         
            -
                          }).optional()
         
     | 
| 
       10907 
     | 
    
         
            -
                        }),
         
     | 
| 
       10908 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10909 
     | 
    
         
            -
                          type: import_v410.z.string().startsWith("tool-"),
         
     | 
| 
       10910 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10911 
     | 
    
         
            -
                          state: import_v410.z.literal("output-error"),
         
     | 
| 
       10912 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10913 
     | 
    
         
            -
                          input: import_v410.z.unknown(),
         
     | 
| 
       10914 
     | 
    
         
            -
                          output: import_v410.z.never().optional(),
         
     | 
| 
       10915 
     | 
    
         
            -
                          errorText: import_v410.z.string(),
         
     | 
| 
       10916 
     | 
    
         
            -
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
       10917 
     | 
    
         
            -
                          approval: import_v410.z.object({
         
     | 
| 
       10918 
     | 
    
         
            -
                            id: import_v410.z.string(),
         
     | 
| 
       10919 
     | 
    
         
            -
                            approved: import_v410.z.literal(true),
         
     | 
| 
       10920 
     | 
    
         
            -
                            reason: import_v410.z.string().optional()
         
     | 
| 
       10921 
     | 
    
         
            -
                          }).optional()
         
     | 
| 
       10922 
     | 
    
         
            -
                        }),
         
     | 
| 
       10923 
     | 
    
         
            -
                        import_v410.z.object({
         
     | 
| 
       10924 
     | 
    
         
            -
                          type: import_v410.z.string().startsWith("tool-"),
         
     | 
| 
       10925 
     | 
    
         
            -
                          toolCallId: import_v410.z.string(),
         
     | 
| 
       10926 
     | 
    
         
            -
                          state: import_v410.z.literal("output-denied"),
         
     | 
| 
       10927 
     | 
    
         
            -
                          providerExecuted: import_v410.z.boolean().optional(),
         
     | 
| 
       10928 
     | 
    
         
            -
                          input: import_v410.z.unknown(),
         
     | 
| 
       10929 
     | 
    
         
            -
                          output: import_v410.z.never().optional(),
         
     | 
| 
       10930 
     | 
    
         
            -
                          errorText: import_v410.z.never().optional(),
         
     | 
| 
       10931 
     | 
    
         
            -
                          callProviderMetadata: providerMetadataSchema.optional(),
         
     | 
| 
       10932 
     | 
    
         
            -
                          approval: import_v410.z.object({
         
     | 
| 
       10933 
     | 
    
         
            -
                            id: import_v410.z.string(),
         
     | 
| 
       10934 
     | 
    
         
            -
                            approved: import_v410.z.literal(false),
         
     | 
| 
       10935 
     | 
    
         
            -
                            reason: import_v410.z.string().optional()
         
     | 
| 
       10936 
     | 
    
         
            -
                          })
         
     | 
| 
       10937 
     | 
    
         
            -
                        })
         
     | 
| 
       10938 
     | 
    
         
            -
                      ])
         
     | 
| 
       10939 
     | 
    
         
            -
                    )
         
     | 
| 
       10940 
     | 
    
         
            -
                  })
         
     | 
| 
       10941 
     | 
    
         
            -
                )
         
     | 
| 
       10942 
     | 
    
         
            -
              )
         
     | 
| 
       10943 
     | 
    
         
            -
            );
         
     | 
| 
       10944 
     | 
    
         
            -
            async function safeValidateUIMessages({
         
     | 
| 
       10945 
     | 
    
         
            -
              messages,
         
     | 
| 
       10946 
     | 
    
         
            -
              metadataSchema,
         
     | 
| 
       10947 
     | 
    
         
            -
              dataSchemas,
         
     | 
| 
       10948 
     | 
    
         
            -
              tools
         
     | 
| 
       10949 
     | 
    
         
            -
            }) {
         
     | 
| 
       10950 
     | 
    
         
            -
              try {
         
     | 
| 
       10951 
     | 
    
         
            -
                if (messages == null) {
         
     | 
| 
       10952 
     | 
    
         
            -
                  return {
         
     | 
| 
       10953 
     | 
    
         
            -
                    success: false,
         
     | 
| 
       10954 
     | 
    
         
            -
                    error: new InvalidArgumentError({
         
     | 
| 
       10955 
     | 
    
         
            -
                      parameter: "messages",
         
     | 
| 
       10956 
     | 
    
         
            -
                      value: messages,
         
     | 
| 
       10957 
     | 
    
         
            -
                      message: "messages parameter must be provided"
         
     | 
| 
       10958 
     | 
    
         
            -
                    })
         
     | 
| 
       10959 
     | 
    
         
            -
                  };
         
     | 
| 
       10960 
     | 
    
         
            -
                }
         
     | 
| 
       10961 
     | 
    
         
            -
                const validatedMessages = await (0, import_provider_utils35.validateTypes)({
         
     | 
| 
       10962 
     | 
    
         
            -
                  value: messages,
         
     | 
| 
       10963 
     | 
    
         
            -
                  schema: uiMessagesSchema
         
     | 
| 
       10964 
     | 
    
         
            -
                });
         
     | 
| 
       10965 
     | 
    
         
            -
                if (metadataSchema) {
         
     | 
| 
       10966 
     | 
    
         
            -
                  for (const message of validatedMessages) {
         
     | 
| 
       10967 
     | 
    
         
            -
                    await (0, import_provider_utils35.validateTypes)({
         
     | 
| 
       10968 
     | 
    
         
            -
                      value: message.metadata,
         
     | 
| 
       10969 
     | 
    
         
            -
                      schema: metadataSchema
         
     | 
| 
       10970 
     | 
    
         
            -
                    });
         
     | 
| 
       10971 
     | 
    
         
            -
                  }
         
     | 
| 
       10972 
     | 
    
         
            -
                }
         
     | 
| 
       10973 
     | 
    
         
            -
                if (dataSchemas) {
         
     | 
| 
       10974 
     | 
    
         
            -
                  for (const message of validatedMessages) {
         
     | 
| 
       10975 
     | 
    
         
            -
                    const dataParts = message.parts.filter(
         
     | 
| 
       10976 
     | 
    
         
            -
                      (part) => part.type.startsWith("data-")
         
     | 
| 
       10977 
     | 
    
         
            -
                    );
         
     | 
| 
       10978 
     | 
    
         
            -
                    for (const dataPart of dataParts) {
         
     | 
| 
       10979 
     | 
    
         
            -
                      const dataName = dataPart.type.slice(5);
         
     | 
| 
       10980 
     | 
    
         
            -
                      const dataSchema = dataSchemas[dataName];
         
     | 
| 
       10981 
     | 
    
         
            -
                      if (!dataSchema) {
         
     | 
| 
       10982 
     | 
    
         
            -
                        return {
         
     | 
| 
       10983 
     | 
    
         
            -
                          success: false,
         
     | 
| 
       10984 
     | 
    
         
            -
                          error: new import_provider32.TypeValidationError({
         
     | 
| 
       10985 
     | 
    
         
            -
                            value: dataPart.data,
         
     | 
| 
       10986 
     | 
    
         
            -
                            cause: `No data schema found for data part ${dataName}`
         
     | 
| 
       10987 
     | 
    
         
            -
                          })
         
     | 
| 
       10988 
     | 
    
         
            -
                        };
         
     | 
| 
       10989 
     | 
    
         
            -
                      }
         
     | 
| 
       10990 
     | 
    
         
            -
                      await (0, import_provider_utils35.validateTypes)({
         
     | 
| 
       10991 
     | 
    
         
            -
                        value: dataPart.data,
         
     | 
| 
       10992 
     | 
    
         
            -
                        schema: dataSchema
         
     | 
| 
       10993 
     | 
    
         
            -
                      });
         
     | 
| 
       10994 
     | 
    
         
            -
                    }
         
     | 
| 
       10995 
     | 
    
         
            -
                  }
         
     | 
| 
       10996 
     | 
    
         
            -
                }
         
     | 
| 
       10997 
     | 
    
         
            -
                if (tools) {
         
     | 
| 
       10998 
     | 
    
         
            -
                  for (const message of validatedMessages) {
         
     | 
| 
       10999 
     | 
    
         
            -
                    const toolParts = message.parts.filter(
         
     | 
| 
       11000 
     | 
    
         
            -
                      (part) => part.type.startsWith("tool-")
         
     | 
| 
       11001 
     | 
    
         
            -
                    );
         
     | 
| 
       11002 
     | 
    
         
            -
                    for (const toolPart of toolParts) {
         
     | 
| 
       11003 
     | 
    
         
            -
                      const toolName = toolPart.type.slice(5);
         
     | 
| 
       11004 
     | 
    
         
            -
                      const tool3 = tools[toolName];
         
     | 
| 
       11005 
     | 
    
         
            -
                      if (!tool3) {
         
     | 
| 
       11006 
     | 
    
         
            -
                        return {
         
     | 
| 
       11007 
     | 
    
         
            -
                          success: false,
         
     | 
| 
       11008 
     | 
    
         
            -
                          error: new import_provider32.TypeValidationError({
         
     | 
| 
       11009 
     | 
    
         
            -
                            value: toolPart.input,
         
     | 
| 
       11010 
     | 
    
         
            -
                            cause: `No tool schema found for tool part ${toolName}`
         
     | 
| 
       11011 
     | 
    
         
            -
                          })
         
     | 
| 
       11012 
     | 
    
         
            -
                        };
         
     | 
| 
       11013 
     | 
    
         
            -
                      }
         
     | 
| 
       11014 
     | 
    
         
            -
                      if (toolPart.state === "input-available" || toolPart.state === "output-available" || toolPart.state === "output-error") {
         
     | 
| 
       11015 
     | 
    
         
            -
                        await (0, import_provider_utils35.validateTypes)({
         
     | 
| 
       11016 
     | 
    
         
            -
                          value: toolPart.input,
         
     | 
| 
       11017 
     | 
    
         
            -
                          schema: tool3.inputSchema
         
     | 
| 
       11018 
     | 
    
         
            -
                        });
         
     | 
| 
       11019 
     | 
    
         
            -
                      }
         
     | 
| 
       11020 
     | 
    
         
            -
                      if (toolPart.state === "output-available" && tool3.outputSchema) {
         
     | 
| 
       11021 
     | 
    
         
            -
                        await (0, import_provider_utils35.validateTypes)({
         
     | 
| 
       11022 
     | 
    
         
            -
                          value: toolPart.output,
         
     | 
| 
       11023 
     | 
    
         
            -
                          schema: tool3.outputSchema
         
     | 
| 
       11024 
     | 
    
         
            -
                        });
         
     | 
| 
       11025 
     | 
    
         
            -
                      }
         
     | 
| 
       11026 
     | 
    
         
            -
                    }
         
     | 
| 
       11027 
     | 
    
         
            -
                  }
         
     | 
| 
       11028 
     | 
    
         
            -
                }
         
     | 
| 
       11029 
     | 
    
         
            -
                return {
         
     | 
| 
       11030 
     | 
    
         
            -
                  success: true,
         
     | 
| 
       11031 
     | 
    
         
            -
                  data: validatedMessages
         
     | 
| 
       11032 
     | 
    
         
            -
                };
         
     | 
| 
       11033 
     | 
    
         
            -
              } catch (error) {
         
     | 
| 
       11034 
     | 
    
         
            -
                const err = error;
         
     | 
| 
       11035 
     | 
    
         
            -
                return {
         
     | 
| 
       11036 
     | 
    
         
            -
                  success: false,
         
     | 
| 
       11037 
     | 
    
         
            -
                  error: err
         
     | 
| 
       11038 
     | 
    
         
            -
                };
         
     | 
| 
       11039 
     | 
    
         
            -
              }
         
     | 
| 
       11040 
     | 
    
         
            -
            }
         
     | 
| 
       11041 
     | 
    
         
            -
            async function validateUIMessages({
         
     | 
| 
       11042 
     | 
    
         
            -
              messages,
         
     | 
| 
       11043 
     | 
    
         
            -
              metadataSchema,
         
     | 
| 
       11044 
     | 
    
         
            -
              dataSchemas,
         
     | 
| 
       11045 
     | 
    
         
            -
              tools
         
     | 
| 
       11046 
     | 
    
         
            -
            }) {
         
     | 
| 
       11047 
     | 
    
         
            -
              const response = await safeValidateUIMessages({
         
     | 
| 
       11048 
     | 
    
         
            -
                messages,
         
     | 
| 
       11049 
     | 
    
         
            -
                metadataSchema,
         
     | 
| 
       11050 
     | 
    
         
            -
                dataSchemas,
         
     | 
| 
       11051 
     | 
    
         
            -
                tools
         
     | 
| 
       11052 
     | 
    
         
            -
              });
         
     | 
| 
       11053 
     | 
    
         
            -
              if (!response.success)
         
     | 
| 
       11054 
     | 
    
         
            -
                throw response.error;
         
     | 
| 
       11055 
     | 
    
         
            -
              return response.data;
         
     | 
| 
       11056 
     | 
    
         
            -
            }
         
     | 
| 
       11057 
     | 
    
         
            -
             
     | 
| 
       11058 
     | 
    
         
            -
            // src/ui-message-stream/create-ui-message-stream.ts
         
     | 
| 
       11059 
     | 
    
         
            -
            var import_provider_utils36 = require("@ai-sdk/provider-utils");
         
     | 
| 
       11060 
     | 
    
         
            -
            function createUIMessageStream({
         
     | 
| 
       11061 
     | 
    
         
            -
              execute,
         
     | 
| 
       11062 
     | 
    
         
            -
              onError = import_provider_utils36.getErrorMessage,
         
     | 
| 
       11063 
     | 
    
         
            -
              originalMessages,
         
     | 
| 
       11064 
     | 
    
         
            -
              onFinish,
         
     | 
| 
       11065 
     | 
    
         
            -
              generateId: generateId2 = import_provider_utils36.generateId
         
     | 
| 
       11066 
     | 
    
         
            -
            }) {
         
     | 
| 
       11067 
     | 
    
         
            -
              let controller;
         
     | 
| 
       11068 
     | 
    
         
            -
              const ongoingStreamPromises = [];
         
     | 
| 
       11069 
     | 
    
         
            -
              const stream = new ReadableStream({
         
     | 
| 
       11070 
     | 
    
         
            -
                start(controllerArg) {
         
     | 
| 
       11071 
     | 
    
         
            -
                  controller = controllerArg;
         
     | 
| 
       11072 
     | 
    
         
            -
                }
         
     | 
| 
       11073 
     | 
    
         
            -
              });
         
     | 
| 
       11074 
     | 
    
         
            -
              function safeEnqueue(data) {
         
     | 
| 
       11075 
     | 
    
         
            -
                try {
         
     | 
| 
       11076 
     | 
    
         
            -
                  controller.enqueue(data);
         
     | 
| 
       11077 
     | 
    
         
            -
                } catch (error) {
         
     | 
| 
       11078 
     | 
    
         
            -
                }
         
     | 
| 
       11079 
     | 
    
         
            -
              }
         
     | 
| 
       11080 
     | 
    
         
            -
              try {
         
     | 
| 
       11081 
     | 
    
         
            -
                const result = execute({
         
     | 
| 
       11082 
     | 
    
         
            -
                  writer: {
         
     | 
| 
       11083 
     | 
    
         
            -
                    write(part) {
         
     | 
| 
       11084 
     | 
    
         
            -
                      safeEnqueue(part);
         
     | 
| 
       11085 
     | 
    
         
            -
                    },
         
     | 
| 
       11086 
     | 
    
         
            -
                    merge(streamArg) {
         
     | 
| 
       11087 
     | 
    
         
            -
                      ongoingStreamPromises.push(
         
     | 
| 
       11088 
     | 
    
         
            -
                        (async () => {
         
     | 
| 
       11089 
     | 
    
         
            -
                          const reader = streamArg.getReader();
         
     | 
| 
       11090 
     | 
    
         
            -
                          while (true) {
         
     | 
| 
       11091 
     | 
    
         
            -
                            const { done, value } = await reader.read();
         
     | 
| 
       11092 
     | 
    
         
            -
                            if (done)
         
     | 
| 
       11093 
     | 
    
         
            -
                              break;
         
     | 
| 
       11094 
     | 
    
         
            -
                            safeEnqueue(value);
         
     | 
| 
       11095 
     | 
    
         
            -
                          }
         
     | 
| 
       11096 
     | 
    
         
            -
                        })().catch((error) => {
         
     | 
| 
       11097 
     | 
    
         
            -
                          safeEnqueue({
         
     | 
| 
       11098 
     | 
    
         
            -
                            type: "error",
         
     | 
| 
       11099 
     | 
    
         
            -
                            errorText: onError(error)
         
     | 
| 
       11100 
     | 
    
         
            -
                          });
         
     | 
| 
       11101 
     | 
    
         
            -
                        })
         
     | 
| 
       11102 
     | 
    
         
            -
                      );
         
     | 
| 
       11103 
     | 
    
         
            -
                    },
         
     | 
| 
       11104 
     | 
    
         
            -
                    onError
         
     | 
| 
       11105 
     | 
    
         
            -
                  }
         
     | 
| 
       11106 
     | 
    
         
            -
                });
         
     | 
| 
       11107 
     | 
    
         
            -
                if (result) {
         
     | 
| 
       11108 
     | 
    
         
            -
                  ongoingStreamPromises.push(
         
     | 
| 
       11109 
     | 
    
         
            -
                    result.catch((error) => {
         
     | 
| 
       11110 
     | 
    
         
            -
                      safeEnqueue({
         
     | 
| 
       11111 
     | 
    
         
            -
                        type: "error",
         
     | 
| 
       11112 
     | 
    
         
            -
                        errorText: onError(error)
         
     | 
| 
       11113 
     | 
    
         
            -
                      });
         
     | 
| 
       11114 
     | 
    
         
            -
                    })
         
     | 
| 
       11115 
     | 
    
         
            -
                  );
         
     | 
| 
       11116 
     | 
    
         
            -
                }
         
     | 
| 
       11117 
     | 
    
         
            -
              } catch (error) {
         
     | 
| 
       11118 
     | 
    
         
            -
                safeEnqueue({
         
     | 
| 
       11119 
     | 
    
         
            -
                  type: "error",
         
     | 
| 
       11120 
     | 
    
         
            -
                  errorText: onError(error)
         
     | 
| 
       11121 
     | 
    
         
            -
                });
         
     | 
| 
       11122 
     | 
    
         
            -
              }
         
     | 
| 
       11123 
     | 
    
         
            -
              const waitForStreams = new Promise(async (resolve3) => {
         
     | 
| 
       11124 
     | 
    
         
            -
                while (ongoingStreamPromises.length > 0) {
         
     | 
| 
       11125 
     | 
    
         
            -
                  await ongoingStreamPromises.shift();
         
     | 
| 
       11126 
     | 
    
         
            -
                }
         
     | 
| 
       11127 
     | 
    
         
            -
                resolve3();
         
     | 
| 
       11128 
     | 
    
         
            -
              });
         
     | 
| 
       11129 
     | 
    
         
            -
              waitForStreams.finally(() => {
         
     | 
| 
       11130 
     | 
    
         
            -
                try {
         
     | 
| 
       11131 
     | 
    
         
            -
                  controller.close();
         
     | 
| 
       11132 
     | 
    
         
            -
                } catch (error) {
         
     | 
| 
       11133 
     | 
    
         
            -
                }
         
     | 
| 
       11134 
     | 
    
         
            -
              });
         
     | 
| 
       11135 
     | 
    
         
            -
              return handleUIMessageStreamFinish({
         
     | 
| 
       11136 
     | 
    
         
            -
                stream,
         
     | 
| 
       11137 
     | 
    
         
            -
                messageId: generateId2(),
         
     | 
| 
       11138 
     | 
    
         
            -
                originalMessages,
         
     | 
| 
       11139 
     | 
    
         
            -
                onFinish,
         
     | 
| 
       11140 
     | 
    
         
            -
                onError
         
     | 
| 
       11141 
     | 
    
         
            -
              });
         
     | 
| 
       11142 
     | 
    
         
            -
            }
         
     | 
| 
       11143 
     | 
    
         
            -
             
     | 
| 
       11144 
     | 
    
         
            -
            // src/ui-message-stream/read-ui-message-stream.ts
         
     | 
| 
       11145 
     | 
    
         
            -
            function readUIMessageStream({
         
     | 
| 
       11146 
     | 
    
         
            -
              message,
         
     | 
| 
       11147 
     | 
    
         
            -
              stream,
         
     | 
| 
       11148 
     | 
    
         
            -
              onError,
         
     | 
| 
       11149 
     | 
    
         
            -
              terminateOnError = false
         
     | 
| 
       11150 
     | 
    
         
            -
            }) {
         
     | 
| 
       11151 
     | 
    
         
            -
              var _a17;
         
     | 
| 
       11152 
     | 
    
         
            -
              let controller;
         
     | 
| 
       11153 
     | 
    
         
            -
              let hasErrored = false;
         
     | 
| 
       11154 
     | 
    
         
            -
              const outputStream = new ReadableStream({
         
     | 
| 
       11155 
     | 
    
         
            -
                start(controllerParam) {
         
     | 
| 
       11156 
     | 
    
         
            -
                  controller = controllerParam;
         
     | 
| 
       11157 
     | 
    
         
            -
                }
         
     | 
| 
       11158 
     | 
    
         
            -
              });
         
     | 
| 
       11159 
     | 
    
         
            -
              const state = createStreamingUIMessageState({
         
     | 
| 
       11160 
     | 
    
         
            -
                messageId: (_a17 = message == null ? void 0 : message.id) != null ? _a17 : "",
         
     | 
| 
       11161 
     | 
    
         
            -
                lastMessage: message
         
     | 
| 
       11162 
     | 
    
         
            -
              });
         
     | 
| 
       11163 
     | 
    
         
            -
              const handleError = (error) => {
         
     | 
| 
       11164 
     | 
    
         
            -
                onError == null ? void 0 : onError(error);
         
     | 
| 
       11165 
     | 
    
         
            -
                if (!hasErrored && terminateOnError) {
         
     | 
| 
       11166 
     | 
    
         
            -
                  hasErrored = true;
         
     | 
| 
       11167 
     | 
    
         
            -
                  controller == null ? void 0 : controller.error(error);
         
     | 
| 
       11168 
     | 
    
         
            -
                }
         
     | 
| 
       11169 
     | 
    
         
            -
              };
         
     | 
| 
       11170 
     | 
    
         
            -
              consumeStream({
         
     | 
| 
       11171 
     | 
    
         
            -
                stream: processUIMessageStream({
         
     | 
| 
       11172 
     | 
    
         
            -
                  stream,
         
     | 
| 
       11173 
     | 
    
         
            -
                  runUpdateMessageJob(job) {
         
     | 
| 
       11174 
     | 
    
         
            -
                    return job({
         
     | 
| 
       11175 
     | 
    
         
            -
                      state,
         
     | 
| 
       11176 
     | 
    
         
            -
                      write: () => {
         
     | 
| 
       11177 
     | 
    
         
            -
                        controller == null ? void 0 : controller.enqueue(structuredClone(state.message));
         
     | 
| 
       11178 
     | 
    
         
            -
                      }
         
     | 
| 
       11179 
     | 
    
         
            -
                    });
         
     | 
| 
       11180 
     | 
    
         
            -
                  },
         
     | 
| 
       11181 
     | 
    
         
            -
                  onError: handleError
         
     | 
| 
       11182 
     | 
    
         
            -
                }),
         
     | 
| 
       11183 
     | 
    
         
            -
                onError: handleError
         
     | 
| 
       11184 
     | 
    
         
            -
              }).finally(() => {
         
     | 
| 
       11185 
     | 
    
         
            -
                if (!hasErrored) {
         
     | 
| 
       11186 
     | 
    
         
            -
                  controller == null ? void 0 : controller.close();
         
     | 
| 
       11187 
     | 
    
         
            -
                }
         
     | 
| 
       11188 
     | 
    
         
            -
              });
         
     | 
| 
       11189 
     | 
    
         
            -
              return createAsyncIterableStream(outputStream);
         
     | 
| 
       11190 
     | 
    
         
            -
            }
         
     | 
| 
       11191 
11203 
     | 
    
         
             
            // Annotate the CommonJS export names for ESM import in node:
         
     | 
| 
       11192 
11204 
     | 
    
         
             
            0 && (module.exports = {
         
     | 
| 
       11193 
11205 
     | 
    
         
             
              AISDKError,
         
     | 
| 
         @@ -11244,6 +11256,7 @@ function readUIMessageStream({ 
     | 
|
| 
       11244 
11256 
     | 
    
         
             
              coreToolMessageSchema,
         
     | 
| 
       11245 
11257 
     | 
    
         
             
              coreUserMessageSchema,
         
     | 
| 
       11246 
11258 
     | 
    
         
             
              cosineSimilarity,
         
     | 
| 
      
 11259 
     | 
    
         
            +
              createAgentStreamResponse,
         
     | 
| 
       11247 
11260 
     | 
    
         
             
              createGateway,
         
     | 
| 
       11248 
11261 
     | 
    
         
             
              createIdGenerator,
         
     | 
| 
       11249 
11262 
     | 
    
         
             
              createProviderRegistry,
         
     |