@flatkey-ai/cli 0.2.3 → 0.2.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +14 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatkey-ai/cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Flatkey media generation CLI for image, video, audio, credits, status, and models.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -636,7 +636,8 @@ async function waitForVideoResult(response, options) {
636
636
 
637
637
  while (Date.now() <= deadline) {
638
638
  last = await options.getVideo(options, taskId);
639
- if (hasArtifact(last) || isVideoDone(last)) return last;
639
+ if (hasArtifact(last)) return last;
640
+ if (isVideoDone(last)) return withVideoContentFallback(last, options, taskId);
640
641
  if (isVideoFailed(last)) {
641
642
  const message = last?.error?.message ?? last?.message ?? `Video generation failed: ${taskId}`;
642
643
  throw new Error(message);
@@ -647,6 +648,18 @@ async function waitForVideoResult(response, options) {
647
648
  throw new Error(`Video task still processing after ${Math.round(timeoutMs / 1000)}s: ${taskId}`);
648
649
  }
649
650
 
651
+ function withVideoContentFallback(response, options, taskId) {
652
+ const baseUrl = String(options.baseUrl ?? "").replace(/\/$/, "");
653
+ if (!baseUrl || !taskId) return response;
654
+ return {
655
+ ...response,
656
+ metadata: {
657
+ ...(response.metadata ?? {}),
658
+ url: `${baseUrl}/v1/videos/${encodeURIComponent(taskId)}/content`,
659
+ },
660
+ };
661
+ }
662
+
650
663
  function hasArtifact(response) {
651
664
  return Boolean(
652
665
  response?.metadata?.url