ai 6.0.0-beta.69 → 6.0.0-beta.71
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/dist/index.d.mts +53 -7
 - package/dist/index.d.ts +53 -7
 - package/dist/index.js +89 -4
 - package/dist/index.js.map +1 -1
 - package/dist/index.mjs +89 -4
 - 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.mjs
    CHANGED
    
    | 
         @@ -775,7 +775,7 @@ import { 
     | 
|
| 
       775 
775 
     | 
    
         
             
            } from "@ai-sdk/provider-utils";
         
     | 
| 
       776 
776 
     | 
    
         | 
| 
       777 
777 
     | 
    
         
             
            // src/version.ts
         
     | 
| 
       778 
     | 
    
         
            -
            var VERSION = true ? "6.0.0-beta. 
     | 
| 
      
 778 
     | 
    
         
            +
            var VERSION = true ? "6.0.0-beta.71" : "0.0.0-test";
         
     | 
| 
       779 
779 
     | 
    
         | 
| 
       780 
780 
     | 
    
         
             
            // src/util/download/download.ts
         
     | 
| 
       781 
781 
     | 
    
         
             
            var download = async ({ url }) => {
         
     | 
| 
         @@ -2559,7 +2559,8 @@ async function generateText({ 
     | 
|
| 
       2559 
2559 
     | 
    
         
             
              abortSignal,
         
     | 
| 
       2560 
2560 
     | 
    
         
             
              headers,
         
     | 
| 
       2561 
2561 
     | 
    
         
             
              stopWhen = stepCountIs(1),
         
     | 
| 
       2562 
     | 
    
         
            -
              experimental_output 
     | 
| 
      
 2562 
     | 
    
         
            +
              experimental_output,
         
     | 
| 
      
 2563 
     | 
    
         
            +
              output = experimental_output,
         
     | 
| 
       2563 
2564 
     | 
    
         
             
              experimental_telemetry: telemetry,
         
     | 
| 
       2564 
2565 
     | 
    
         
             
              providerOptions,
         
     | 
| 
       2565 
2566 
     | 
    
         
             
              experimental_activeTools,
         
     | 
| 
         @@ -3070,6 +3071,9 @@ var DefaultGenerateTextResult = class { 
     | 
|
| 
       3070 
3071 
     | 
    
         
             
                return this.finalStep.usage;
         
     | 
| 
       3071 
3072 
     | 
    
         
             
              }
         
     | 
| 
       3072 
3073 
     | 
    
         
             
              get experimental_output() {
         
     | 
| 
      
 3074 
     | 
    
         
            +
                return this.output;
         
     | 
| 
      
 3075 
     | 
    
         
            +
              }
         
     | 
| 
      
 3076 
     | 
    
         
            +
              get output() {
         
     | 
| 
       3073 
3077 
     | 
    
         
             
                if (this.resolvedOutput == null) {
         
     | 
| 
       3074 
3078 
     | 
    
         
             
                  throw new NoOutputSpecifiedError();
         
     | 
| 
       3075 
3079 
     | 
    
         
             
                }
         
     | 
| 
         @@ -4856,7 +4860,8 @@ function streamText({ 
     | 
|
| 
       4856 
4860 
     | 
    
         
             
              abortSignal,
         
     | 
| 
       4857 
4861 
     | 
    
         
             
              headers,
         
     | 
| 
       4858 
4862 
     | 
    
         
             
              stopWhen = stepCountIs(1),
         
     | 
| 
       4859 
     | 
    
         
            -
              experimental_output 
     | 
| 
      
 4863 
     | 
    
         
            +
              experimental_output,
         
     | 
| 
      
 4864 
     | 
    
         
            +
              output = experimental_output,
         
     | 
| 
       4860 
4865 
     | 
    
         
             
              experimental_telemetry: telemetry,
         
     | 
| 
       4861 
4866 
     | 
    
         
             
              prepareStep,
         
     | 
| 
       4862 
4867 
     | 
    
         
             
              providerOptions,
         
     | 
| 
         @@ -5907,6 +5912,9 @@ var DefaultStreamTextResult = class { 
     | 
|
| 
       5907 
5912 
     | 
    
         
             
                }
         
     | 
| 
       5908 
5913 
     | 
    
         
             
              }
         
     | 
| 
       5909 
5914 
     | 
    
         
             
              get experimental_partialOutputStream() {
         
     | 
| 
      
 5915 
     | 
    
         
            +
                return this.partialOutputStream;
         
     | 
| 
      
 5916 
     | 
    
         
            +
              }
         
     | 
| 
      
 5917 
     | 
    
         
            +
              get partialOutputStream() {
         
     | 
| 
       5910 
5918 
     | 
    
         
             
                if (this.output == null) {
         
     | 
| 
       5911 
5919 
     | 
    
         
             
                  throw new NoOutputSpecifiedError();
         
     | 
| 
       5912 
5920 
     | 
    
         
             
                }
         
     | 
| 
         @@ -9061,6 +9069,7 @@ var DefaultSpeechResult = class { 
     | 
|
| 
       9061 
9069 
     | 
    
         
             
            var output_exports = {};
         
     | 
| 
       9062 
9070 
     | 
    
         
             
            __export(output_exports, {
         
     | 
| 
       9063 
9071 
     | 
    
         
             
              array: () => array,
         
     | 
| 
      
 9072 
     | 
    
         
            +
              choice: () => choice,
         
     | 
| 
       9064 
9073 
     | 
    
         
             
              object: () => object,
         
     | 
| 
       9065 
9074 
     | 
    
         
             
              text: () => text
         
     | 
| 
       9066 
9075 
     | 
    
         
             
            });
         
     | 
| 
         @@ -9149,7 +9158,7 @@ var array = ({ 
     | 
|
| 
       9149 
9158 
     | 
    
         
             
              const elementSchema = asSchema4(inputElementSchema);
         
     | 
| 
       9150 
9159 
     | 
    
         
             
              return {
         
     | 
| 
       9151 
9160 
     | 
    
         
             
                type: "object",
         
     | 
| 
       9152 
     | 
    
         
            -
                //  
     | 
| 
      
 9161 
     | 
    
         
            +
                // JSON schema that describes an array of elements:
         
     | 
| 
       9153 
9162 
     | 
    
         
             
                responseFormat: resolve(elementSchema.jsonSchema).then((jsonSchema3) => {
         
     | 
| 
       9154 
9163 
     | 
    
         
             
                  const { $schema, ...itemSchema } = jsonSchema3;
         
     | 
| 
       9155 
9164 
     | 
    
         
             
                  return {
         
     | 
| 
         @@ -9243,6 +9252,82 @@ var array = ({ 
     | 
|
| 
       9243 
9252 
     | 
    
         
             
                }
         
     | 
| 
       9244 
9253 
     | 
    
         
             
              };
         
     | 
| 
       9245 
9254 
     | 
    
         
             
            };
         
     | 
| 
      
 9255 
     | 
    
         
            +
            var choice = ({
         
     | 
| 
      
 9256 
     | 
    
         
            +
              options: choiceOptions
         
     | 
| 
      
 9257 
     | 
    
         
            +
            }) => {
         
     | 
| 
      
 9258 
     | 
    
         
            +
              return {
         
     | 
| 
      
 9259 
     | 
    
         
            +
                type: "object",
         
     | 
| 
      
 9260 
     | 
    
         
            +
                // JSON schema that describes an enumeration:
         
     | 
| 
      
 9261 
     | 
    
         
            +
                responseFormat: Promise.resolve({
         
     | 
| 
      
 9262 
     | 
    
         
            +
                  type: "json",
         
     | 
| 
      
 9263 
     | 
    
         
            +
                  schema: {
         
     | 
| 
      
 9264 
     | 
    
         
            +
                    $schema: "http://json-schema.org/draft-07/schema#",
         
     | 
| 
      
 9265 
     | 
    
         
            +
                    type: "object",
         
     | 
| 
      
 9266 
     | 
    
         
            +
                    properties: {
         
     | 
| 
      
 9267 
     | 
    
         
            +
                      result: { type: "string", enum: choiceOptions }
         
     | 
| 
      
 9268 
     | 
    
         
            +
                    },
         
     | 
| 
      
 9269 
     | 
    
         
            +
                    required: ["result"],
         
     | 
| 
      
 9270 
     | 
    
         
            +
                    additionalProperties: false
         
     | 
| 
      
 9271 
     | 
    
         
            +
                  }
         
     | 
| 
      
 9272 
     | 
    
         
            +
                }),
         
     | 
| 
      
 9273 
     | 
    
         
            +
                async parseOutput({ text: text2 }, context) {
         
     | 
| 
      
 9274 
     | 
    
         
            +
                  const parseResult = await safeParseJSON4({ text: text2 });
         
     | 
| 
      
 9275 
     | 
    
         
            +
                  if (!parseResult.success) {
         
     | 
| 
      
 9276 
     | 
    
         
            +
                    throw new NoObjectGeneratedError({
         
     | 
| 
      
 9277 
     | 
    
         
            +
                      message: "No object generated: could not parse the response.",
         
     | 
| 
      
 9278 
     | 
    
         
            +
                      cause: parseResult.error,
         
     | 
| 
      
 9279 
     | 
    
         
            +
                      text: text2,
         
     | 
| 
      
 9280 
     | 
    
         
            +
                      response: context.response,
         
     | 
| 
      
 9281 
     | 
    
         
            +
                      usage: context.usage,
         
     | 
| 
      
 9282 
     | 
    
         
            +
                      finishReason: context.finishReason
         
     | 
| 
      
 9283 
     | 
    
         
            +
                    });
         
     | 
| 
      
 9284 
     | 
    
         
            +
                  }
         
     | 
| 
      
 9285 
     | 
    
         
            +
                  const outerValue = parseResult.value;
         
     | 
| 
      
 9286 
     | 
    
         
            +
                  if (outerValue == null || typeof outerValue !== "object" || !("result" in outerValue) || typeof outerValue.result !== "string" || !choiceOptions.includes(outerValue.result)) {
         
     | 
| 
      
 9287 
     | 
    
         
            +
                    throw new NoObjectGeneratedError({
         
     | 
| 
      
 9288 
     | 
    
         
            +
                      message: "No object generated: response did not match schema.",
         
     | 
| 
      
 9289 
     | 
    
         
            +
                      cause: new TypeValidationError5({
         
     | 
| 
      
 9290 
     | 
    
         
            +
                        value: outerValue,
         
     | 
| 
      
 9291 
     | 
    
         
            +
                        cause: "response must be an object that contains a choice value."
         
     | 
| 
      
 9292 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 9293 
     | 
    
         
            +
                      text: text2,
         
     | 
| 
      
 9294 
     | 
    
         
            +
                      response: context.response,
         
     | 
| 
      
 9295 
     | 
    
         
            +
                      usage: context.usage,
         
     | 
| 
      
 9296 
     | 
    
         
            +
                      finishReason: context.finishReason
         
     | 
| 
      
 9297 
     | 
    
         
            +
                    });
         
     | 
| 
      
 9298 
     | 
    
         
            +
                  }
         
     | 
| 
      
 9299 
     | 
    
         
            +
                  return outerValue.result;
         
     | 
| 
      
 9300 
     | 
    
         
            +
                },
         
     | 
| 
      
 9301 
     | 
    
         
            +
                async parsePartial({ text: text2 }) {
         
     | 
| 
      
 9302 
     | 
    
         
            +
                  const result = await parsePartialJson(text2);
         
     | 
| 
      
 9303 
     | 
    
         
            +
                  switch (result.state) {
         
     | 
| 
      
 9304 
     | 
    
         
            +
                    case "failed-parse":
         
     | 
| 
      
 9305 
     | 
    
         
            +
                    case "undefined-input": {
         
     | 
| 
      
 9306 
     | 
    
         
            +
                      return void 0;
         
     | 
| 
      
 9307 
     | 
    
         
            +
                    }
         
     | 
| 
      
 9308 
     | 
    
         
            +
                    case "repaired-parse":
         
     | 
| 
      
 9309 
     | 
    
         
            +
                    case "successful-parse": {
         
     | 
| 
      
 9310 
     | 
    
         
            +
                      const outerValue = result.value;
         
     | 
| 
      
 9311 
     | 
    
         
            +
                      if (outerValue == null || typeof outerValue !== "object" || !("result" in outerValue) || typeof outerValue.result !== "string") {
         
     | 
| 
      
 9312 
     | 
    
         
            +
                        return void 0;
         
     | 
| 
      
 9313 
     | 
    
         
            +
                      }
         
     | 
| 
      
 9314 
     | 
    
         
            +
                      const potentialMatches = choiceOptions.filter(
         
     | 
| 
      
 9315 
     | 
    
         
            +
                        (choiceOption) => choiceOption.startsWith(outerValue.result)
         
     | 
| 
      
 9316 
     | 
    
         
            +
                      );
         
     | 
| 
      
 9317 
     | 
    
         
            +
                      if (result.state === "successful-parse") {
         
     | 
| 
      
 9318 
     | 
    
         
            +
                        return potentialMatches.includes(outerValue.result) ? { partial: outerValue.result } : void 0;
         
     | 
| 
      
 9319 
     | 
    
         
            +
                      } else {
         
     | 
| 
      
 9320 
     | 
    
         
            +
                        return potentialMatches.length === 1 ? { partial: potentialMatches[0] } : void 0;
         
     | 
| 
      
 9321 
     | 
    
         
            +
                      }
         
     | 
| 
      
 9322 
     | 
    
         
            +
                    }
         
     | 
| 
      
 9323 
     | 
    
         
            +
                    default: {
         
     | 
| 
      
 9324 
     | 
    
         
            +
                      const _exhaustiveCheck = result.state;
         
     | 
| 
      
 9325 
     | 
    
         
            +
                      throw new Error(`Unsupported parse state: ${_exhaustiveCheck}`);
         
     | 
| 
      
 9326 
     | 
    
         
            +
                    }
         
     | 
| 
      
 9327 
     | 
    
         
            +
                  }
         
     | 
| 
      
 9328 
     | 
    
         
            +
                }
         
     | 
| 
      
 9329 
     | 
    
         
            +
              };
         
     | 
| 
      
 9330 
     | 
    
         
            +
            };
         
     | 
| 
       9246 
9331 
     | 
    
         | 
| 
       9247 
9332 
     | 
    
         
             
            // src/generate-text/prune-messages.ts
         
     | 
| 
       9248 
9333 
     | 
    
         
             
            function pruneMessages({
         
     |