ai 5.0.12 → 5.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -514,6 +514,31 @@ var audioMediaTypeSignatures = [
514
514
  bytesPrefix: [255, 251],
515
515
  base64Prefix: "//s="
516
516
  },
517
+ {
518
+ mediaType: "audio/mpeg",
519
+ bytesPrefix: [255, 250],
520
+ base64Prefix: "//o="
521
+ },
522
+ {
523
+ mediaType: "audio/mpeg",
524
+ bytesPrefix: [255, 243],
525
+ base64Prefix: "//M="
526
+ },
527
+ {
528
+ mediaType: "audio/mpeg",
529
+ bytesPrefix: [255, 242],
530
+ base64Prefix: "//I="
531
+ },
532
+ {
533
+ mediaType: "audio/mpeg",
534
+ bytesPrefix: [255, 227],
535
+ base64Prefix: "/+M="
536
+ },
537
+ {
538
+ mediaType: "audio/mpeg",
539
+ bytesPrefix: [255, 226],
540
+ base64Prefix: "/+I="
541
+ },
517
542
  {
518
543
  mediaType: "audio/wav",
519
544
  bytesPrefix: [82, 73, 70, 70],
@@ -7686,10 +7711,19 @@ function extractReasoningMiddleware({
7686
7711
  wrapStream: async ({ doStream }) => {
7687
7712
  const { stream, ...rest } = await doStream();
7688
7713
  const reasoningExtractions = {};
7714
+ let delayedTextStart;
7689
7715
  return {
7690
7716
  stream: stream.pipeThrough(
7691
7717
  new TransformStream({
7692
7718
  transform: (chunk, controller) => {
7719
+ if (chunk.type === "text-start") {
7720
+ delayedTextStart = chunk;
7721
+ return;
7722
+ }
7723
+ if (chunk.type === "text-end" && delayedTextStart) {
7724
+ controller.enqueue(delayedTextStart);
7725
+ delayedTextStart = void 0;
7726
+ }
7693
7727
  if (chunk.type !== "text-delta") {
7694
7728
  controller.enqueue(chunk);
7695
7729
  return;
@@ -7716,17 +7750,23 @@ function extractReasoningMiddleware({
7716
7750
  id: `reasoning-${activeExtraction.idCounter}`
7717
7751
  });
7718
7752
  }
7719
- controller.enqueue(
7720
- activeExtraction.isReasoning ? {
7753
+ if (activeExtraction.isReasoning) {
7754
+ controller.enqueue({
7721
7755
  type: "reasoning-delta",
7722
7756
  delta: prefix + text2,
7723
7757
  id: `reasoning-${activeExtraction.idCounter}`
7724
- } : {
7758
+ });
7759
+ } else {
7760
+ if (delayedTextStart) {
7761
+ controller.enqueue(delayedTextStart);
7762
+ delayedTextStart = void 0;
7763
+ }
7764
+ controller.enqueue({
7725
7765
  type: "text-delta",
7726
7766
  delta: prefix + text2,
7727
7767
  id: activeExtraction.textId
7728
- }
7729
- );
7768
+ });
7769
+ }
7730
7770
  activeExtraction.afterSwitch = false;
7731
7771
  if (activeExtraction.isReasoning) {
7732
7772
  activeExtraction.isFirstReasoning = false;