vargai 0.4.0-alpha68 → 0.4.0-alpha69

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/package.json CHANGED
@@ -71,7 +71,7 @@
71
71
  "zod": "^4.2.1"
72
72
  },
73
73
  "sideEffects": false,
74
- "version": "0.4.0-alpha68",
74
+ "version": "0.4.0-alpha69",
75
75
  "exports": {
76
76
  ".": "./src/index.ts",
77
77
  "./ai": "./src/ai-sdk/index.ts",
@@ -22,7 +22,20 @@ async function resolveImageInput(
22
22
  return new Uint8Array(await response.arrayBuffer());
23
23
  }
24
24
  const file = await renderImage(input, ctx);
25
- return file.arrayBuffer();
25
+ const data = await file.arrayBuffer();
26
+ // Debug: ensure we always return a proper Uint8Array
27
+ if (!(data instanceof Uint8Array)) {
28
+ console.error(
29
+ `[resolveImageInput] file.arrayBuffer() returned ${typeof data} (constructor: ${data?.constructor?.name}), converting...`,
30
+ );
31
+ if (data instanceof ArrayBuffer) {
32
+ return new Uint8Array(data);
33
+ }
34
+ throw new Error(
35
+ `resolveImageInput: unexpected data type ${typeof data} from file.arrayBuffer()`,
36
+ );
37
+ }
38
+ return data;
26
39
  }
27
40
 
28
41
  async function resolvePrompt(
@@ -35,6 +48,15 @@ async function resolvePrompt(
35
48
  const resolvedImages = await Promise.all(
36
49
  prompt.images.map((img) => resolveImageInput(img, ctx)),
37
50
  );
51
+ // Debug: verify all images are Uint8Array before passing to generateImage
52
+ for (let i = 0; i < resolvedImages.length; i++) {
53
+ const img = resolvedImages[i];
54
+ if (!(img instanceof Uint8Array)) {
55
+ console.error(
56
+ `[resolvePrompt] images[${i}] is ${typeof img} (constructor: ${(img as any)?.constructor?.name}), not Uint8Array`,
57
+ );
58
+ }
59
+ }
38
60
  return { text: prompt.text, images: resolvedImages };
39
61
  }
40
62