vargai 0.4.0-alpha37 → 0.4.0-alpha39

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
@@ -68,7 +68,7 @@
68
68
  "sharp": "^0.34.5",
69
69
  "zod": "^4.2.1"
70
70
  },
71
- "version": "0.4.0-alpha37",
71
+ "version": "0.4.0-alpha39",
72
72
  "exports": {
73
73
  ".": "./src/index.ts",
74
74
  "./ai": "./src/ai-sdk/index.ts",
@@ -583,37 +583,11 @@ class FalImageModel implements ImageModelV3 {
583
583
 
584
584
  const finalEndpoint = this.resolveEndpoint();
585
585
 
586
- // Timing diagnostics
587
- const t0 = Date.now();
588
- let lastStatus = "";
589
- const queueStartTime = t0;
590
- let processingStartTime = 0;
591
-
592
586
  const result = await fal.subscribe(finalEndpoint, {
593
587
  input,
594
588
  logs: true,
595
- onQueueUpdate: (status) => {
596
- const elapsed = Date.now() - t0;
597
- if (status.status !== lastStatus) {
598
- if (status.status === "IN_PROGRESS" && !processingStartTime) {
599
- processingStartTime = Date.now();
600
- console.log(
601
- `[fal-timing] ${this.modelId}: IN_QUEUE took ${processingStartTime - queueStartTime}ms`,
602
- );
603
- }
604
- console.log(
605
- `[fal-timing] ${this.modelId}: status=${status.status} at ${elapsed}ms`,
606
- );
607
- lastStatus = status.status;
608
- }
609
- },
610
589
  });
611
590
 
612
- const subscribeTime = Date.now() - t0;
613
- console.log(
614
- `[fal-timing] ${this.modelId}: total subscribe took ${subscribeTime}ms`,
615
- );
616
-
617
591
  const data = result.data as { images?: Array<{ url?: string }> };
618
592
  const images = data?.images ?? [];
619
593
 
@@ -621,17 +595,12 @@ class FalImageModel implements ImageModelV3 {
621
595
  throw new Error("No images in fal response");
622
596
  }
623
597
 
624
- const t1 = Date.now();
625
598
  const imageBuffers = await Promise.all(
626
599
  images.map(async (img) => {
627
600
  const response = await fetch(img.url!, { signal: abortSignal });
628
601
  return new Uint8Array(await response.arrayBuffer());
629
602
  }),
630
603
  );
631
- const downloadTime = Date.now() - t1;
632
- console.log(
633
- `[fal-timing] ${this.modelId}: image download took ${downloadTime}ms`,
634
- );
635
604
 
636
605
  return {
637
606
  images: imageBuffers,
@@ -239,6 +239,9 @@ async function renderClipLayers(
239
239
  .filter(Boolean) as { index: number; reason: Error }[];
240
240
 
241
241
  if (failures.length > 0) {
242
+ if (failures.length === 1 && failures[0]) {
243
+ throw failures[0].reason;
244
+ }
242
245
  const errors = failures
243
246
  .map((f) => f.reason?.message || "Unknown error")
244
247
  .join("; ");
@@ -222,8 +222,13 @@ export async function renderRoot(
222
222
  `\x1b[33mℹ ${successCount} clip(s) cached, ${failures.length} failed\x1b[0m`,
223
223
  );
224
224
  }
225
- const errors = failures
226
- .map((f) => f.reason?.message || "Unknown error")
225
+ const errorCounts = new Map<string, number>();
226
+ for (const f of failures) {
227
+ const msg = f.reason?.message || "Unknown error";
228
+ errorCounts.set(msg, (errorCounts.get(msg) || 0) + 1);
229
+ }
230
+ const errors = [...errorCounts.entries()]
231
+ .map(([msg, count]) => (count > 1 ? `${msg} (x${count})` : msg))
227
232
  .join("; ");
228
233
  throw new Error(
229
234
  `${failures.length} of ${clipResults.length} clips failed: ${errors}`,