makaron-cli 0.17.7 → 0.17.8

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makaron-cli",
3
- "version": "0.17.7",
3
+ "version": "0.17.8",
4
4
  "description": "Give Claude Code a creative agent. Pass complete creative requests and source media to Makaron Chat.",
5
5
  "author": {
6
6
  "name": "Versa AI",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makaron-cli",
3
- "version": "0.17.7",
3
+ "version": "0.17.8",
4
4
  "description": "Give Codex a creative agent. Pass complete creative requests and source media to Makaron Chat.",
5
5
  "author": {
6
6
  "name": "Versa AI",
package/README.md CHANGED
@@ -317,7 +317,7 @@ npx makaron-cli chat --project <id> --video party.mp4 --image kid.jpg -b "make t
317
317
  npx makaron-cli chat --project <id> --video clip1.mp4 --video clip2.mp4 -b "splice these into one seamless video"
318
318
  ```
319
319
 
320
- Video files are uploaded via signed URL. CLI local video uploads support `.mp4`, `.mov`, or `.webm`, max 50MB, max 900s (15 minutes) with 1s metadata tolerance, and <=1080p / 2,086,876 frame pixels. The frontend can transcode larger videos before upload; the CLI uploads directly to Storage and rejects videos above those limits.
320
+ Video files are uploaded via signed URL. CLI local video uploads support `.mp4`, `.mov`, or `.webm`, max 500MB, max 900s (15 minutes) with 1s metadata tolerance, and <=1080p / 2,086,876 frame pixels. The CLI uploads files over 6MB directly to Storage in 6MB resumable chunks without loading the entire file into memory and rejects videos above those limits. Local `makaron analyze --video` uploads also support max 500MB; analysis provider limits still apply.
321
321
  For a new presenter or product video, ask for picture, speech, lip sync and music together in one `chat` brief. Seedance 2.5 defaults to Eco. Native subtitles can be included; for precise or editable captions, Makaron keeps the native soundtrack and adds text through a lightweight composition, without a Studio production recipe or another voice generation. Review the completed MP4 for speech, caption spelling and synchronization.
322
322
 
323
323
  The agent understands video content natively — it can analyze scenes, edit, extend, and compose videos. Seedance video-reference editing is still limited to ~15s provider references, so longer uploaded videos should be split/prepared by the agent before model submission; Kling 4.0 supports direct edit for a 3-30s source.
package/bin/makaron.mjs CHANGED
@@ -52,12 +52,13 @@ const CHAT_AGENT_MODELS = [
52
52
  const SUPABASE_URL = 'https://sdyrtztrjgmmpnirswxt.supabase.co';
53
53
  const SUPABASE_ANON_KEY = 'sb_publishable_FJFN2YYaWaQjABUKLqxQcA_fhxPLFDY';
54
54
 
55
- const MAX_VIDEO_UPLOAD_FILE_SIZE_MB = 50;
55
+ const MAX_VIDEO_UPLOAD_FILE_SIZE_MB = 500;
56
56
  const MAX_VIDEO_UPLOAD_FILE_SIZE = MAX_VIDEO_UPLOAD_FILE_SIZE_MB * 1024 * 1024;
57
57
  const MAX_VIDEO_UPLOAD_DURATION = 900;
58
58
  const MAX_VIDEO_UPLOAD_DURATION_TOLERANCE = 1;
59
59
  const MAX_VIDEO_PROVIDER_REFERENCE_DURATION = 15;
60
60
  const MAX_VIDEO_PROVIDER_REFERENCE_DURATION_TOLERANCE = 0.5;
61
+ const MAX_VIDEO_PROVIDER_REFERENCE_FILE_SIZE = 50 * 1024 * 1024;
61
62
  const MIN_AUDIO_REFERENCE_DURATION = 2;
62
63
  const MAX_AUDIO_REFERENCE_DURATION = 15;
63
64
  const MAX_AUDIO_REFERENCE_DURATION_TOLERANCE = 0.5;
@@ -523,6 +524,10 @@ Options:
523
524
  --stream Live SSE; follows the same run after handoff.
524
525
  --help, -h Show this help.
525
526
 
527
+ Local video uploads: MP4/MOV/WebM, max ${MAX_VIDEO_UPLOAD_FILE_SIZE_MB}MB,
528
+ max ${MAX_VIDEO_UPLOAD_DURATION}s (15 minutes, with 1s metadata tolerance), <=1080p.
529
+ Direct video model reference limits remain provider-specific.
530
+
526
531
  Agent LLM defaults to auto, following the server-configured Agent model.
527
532
  When that default is a GPT model, eligible accounts can use the Codex plan.
528
533
  GPT-5.6 and GPT-6 base ids select Azure API; append -codex-subscription to
@@ -1596,10 +1601,96 @@ function readImageAsDataUrl(filePath) {
1596
1601
  return `data:${v.mime};base64,${buf.toString('base64')}`;
1597
1602
  }
1598
1603
 
1604
+ async function uploadFileResumable(uploadUrl, token, storagePath, filePath, contentType) {
1605
+ const chunkSize = 6 * 1024 * 1024;
1606
+ const size = fs.statSync(filePath).size;
1607
+ const bucket = new URL(uploadUrl).pathname.match(/\/object\/upload\/sign\/([^/]+)\//)?.[1];
1608
+ if (!bucket || !storagePath) {
1609
+ process.stderr.write('⚠️ Missing resumable upload metadata. Update the Makaron service and retry.\n');
1610
+ return null;
1611
+ }
1612
+ const headers = { 'Tus-Resumable': '1.0.0', 'x-signature': token, apikey: SUPABASE_ANON_KEY };
1613
+ const metadata = Object.entries({ bucketName: decodeURIComponent(bucket), objectName: storagePath, contentType, cacheControl: '3600' })
1614
+ .map(([key, value]) => `${key} ${Buffer.from(value).toString('base64')}`).join(',');
1615
+ let file;
1616
+ try {
1617
+ const created = await fetch(new URL('/storage/v1/upload/resumable/sign', uploadUrl), {
1618
+ method: 'POST',
1619
+ headers: { ...headers, 'Upload-Length': String(size), 'Upload-Metadata': metadata },
1620
+ signal: AbortSignal.timeout(60_000),
1621
+ });
1622
+ if (!created.ok || !created.headers.get('location')) {
1623
+ process.stderr.write(`⚠️ Failed to start resumable upload (HTTP ${created.status}).\n`);
1624
+ return null;
1625
+ }
1626
+ const location = new URL(created.headers.get('location'), uploadUrl);
1627
+ const offsetFrom = response => {
1628
+ const raw = response.headers.get('upload-offset');
1629
+ const value = raw === null ? NaN : Number(raw);
1630
+ return Number.isSafeInteger(value) && value >= 0 && value <= size ? value : null;
1631
+ };
1632
+ let offset = 0;
1633
+ let retries = 0;
1634
+ let progress = 0;
1635
+ file = await fs.promises.open(filePath, 'r');
1636
+ const buffer = Buffer.alloc(chunkSize);
1637
+ while (offset < size) {
1638
+ const length = Math.min(chunkSize, size - offset);
1639
+ let read = 0;
1640
+ while (read < length) {
1641
+ const { bytesRead } = await file.read(buffer, read, length - read, offset + read);
1642
+ if (!bytesRead) throw new Error('Unexpected end of upload file');
1643
+ read += bytesRead;
1644
+ }
1645
+ let response;
1646
+ try {
1647
+ response = await fetch(location, {
1648
+ method: 'PATCH',
1649
+ headers: { ...headers, 'Upload-Offset': String(offset), 'Content-Type': 'application/offset+octet-stream' },
1650
+ body: buffer.subarray(0, length),
1651
+ signal: AbortSignal.timeout(60_000),
1652
+ });
1653
+ } catch {
1654
+ // A lost response may still mean the chunk committed. HEAD reconciles it.
1655
+ }
1656
+ const next = response?.ok ? offsetFrom(response) : null;
1657
+ if (next === offset + length) {
1658
+ offset = next;
1659
+ retries = 0;
1660
+ } else {
1661
+ if (response && !response.ok && response.status < 500 && ![408, 409, 429].includes(response.status)) {
1662
+ process.stderr.write(`⚠️ Failed to upload file (HTTP ${response.status}).\n`);
1663
+ return null;
1664
+ }
1665
+ if (++retries > 3) throw new Error('Resumable upload retries exhausted');
1666
+ await new Promise(resolve => setTimeout(resolve, 1000 * retries));
1667
+ const head = await fetch(location, { method: 'HEAD', headers, signal: AbortSignal.timeout(60_000) }).catch(() => null);
1668
+ const committed = head?.ok ? offsetFrom(head) : null;
1669
+ if (committed !== null) {
1670
+ if (committed < offset || committed > offset + length) throw new Error('Invalid resumable upload offset');
1671
+ if (committed > offset) { offset = committed; retries = 0; }
1672
+ }
1673
+ continue;
1674
+ }
1675
+ const percent = Math.floor(offset / size * 10) * 10;
1676
+ if (percent > progress) {
1677
+ progress = percent;
1678
+ process.stderr.write(`📤 Upload ${percent}%\n`);
1679
+ }
1680
+ }
1681
+ return true;
1682
+ } catch {
1683
+ process.stderr.write('⚠️ Resumable upload failed. Retry the upload.\n');
1684
+ return null;
1685
+ } finally {
1686
+ await file?.close();
1687
+ }
1688
+ }
1689
+
1599
1690
  /**
1600
1691
  * Upload a local file via signed URL (works for both images and videos).
1601
1692
  * 1. POST /api/storage/upload-url → get signed URL + public URL
1602
- * 2. PUT file directly to Supabase Storage (no Vercel body limit)
1693
+ * 2. Upload directly to Storage; files over 6MB use signed TUS chunks.
1603
1694
  * Returns public URL on success, null on failure.
1604
1695
  */
1605
1696
  async function uploadFileViaSignedUrl(baseUrl, headers, projectId, filePath, contentType, options = {}) {
@@ -1614,23 +1705,33 @@ async function uploadFileViaSignedUrl(baseUrl, headers, projectId, filePath, con
1614
1705
  process.stderr.write(`⚠️ Failed to get upload URL: ${await urlRes.text()}\n`);
1615
1706
  return null;
1616
1707
  }
1617
- const { uploadUrl, token, publicUrl } = await urlRes.json();
1708
+ const { uploadUrl, token, publicUrl, path: storagePath } = await urlRes.json();
1709
+
1710
+ if (fs.statSync(filePath).size > 6 * 1024 * 1024) {
1711
+ return await uploadFileResumable(uploadUrl, token, storagePath, filePath, contentType) ? publicUrl : null;
1712
+ }
1618
1713
 
1619
1714
  // Step 2: PUT file directly to Supabase Storage
1620
- const buf = fs.readFileSync(filePath);
1621
- const putRes = await fetch(uploadUrl, {
1622
- method: 'PUT',
1623
- headers: {
1624
- 'Content-Type': contentType,
1625
- 'Authorization': `Bearer ${token}`,
1626
- },
1627
- body: buf,
1628
- });
1629
- if (!putRes.ok) {
1630
- process.stderr.write(`⚠️ Failed to upload file: ${await putRes.text()}\n`);
1631
- return null;
1715
+ const file = fs.createReadStream(filePath);
1716
+ try {
1717
+ const putRes = await fetch(uploadUrl, {
1718
+ method: 'PUT',
1719
+ headers: {
1720
+ 'Content-Type': contentType,
1721
+ 'Content-Length': String(fs.statSync(filePath).size),
1722
+ 'Authorization': `Bearer ${token}`,
1723
+ },
1724
+ body: file,
1725
+ duplex: 'half',
1726
+ });
1727
+ if (!putRes.ok) {
1728
+ process.stderr.write(`⚠️ Failed to upload file: ${await putRes.text()}\n`);
1729
+ return null;
1730
+ }
1731
+ return publicUrl;
1732
+ } finally {
1733
+ file.destroy();
1632
1734
  }
1633
- return publicUrl;
1634
1735
  }
1635
1736
 
1636
1737
  async function uploadImageFilesViaSignedUrl(baseUrl, headers, projectId, imagePaths) {
@@ -1888,7 +1989,7 @@ function validateVideoFileForAnalysis(videoPath) {
1888
1989
  return { ok: false, error: `Video file is empty: ${videoPath}` };
1889
1990
  }
1890
1991
  if (stat.size > MAX_VIDEO_UPLOAD_FILE_SIZE) {
1891
- return { ok: false, error: `Video too large: ${(stat.size / 1024 / 1024).toFixed(1)}MB (max ${MAX_VIDEO_UPLOAD_FILE_SIZE_MB}MB). The CLI uploads directly to Storage; use the frontend to transcode larger videos first.` };
1992
+ return { ok: false, error: `Video too large: ${(stat.size / 1024 / 1024).toFixed(1)}MB (max ${MAX_VIDEO_UPLOAD_FILE_SIZE_MB}MB). Compress or split the video before uploading.` };
1892
1993
  }
1893
1994
  const ext = path.extname(videoPath).slice(1).toLowerCase();
1894
1995
  if (!['mp4', 'mov', 'webm'].includes(ext)) {
@@ -2264,7 +2365,7 @@ Not sure which built-in skill to use? Start with:
2264
2365
  } else if (topic === 'edit') {
2265
2366
  printEditHelp();
2266
2367
  } else if (topic === 'analyze') {
2267
- console.log('Usage: makaron analyze --video <file|url> ["question"]');
2368
+ console.log(`Usage: makaron analyze --video <file|url> ["question"]\nLocal video uploads: MP4/MOV/WebM, max ${MAX_VIDEO_UPLOAD_FILE_SIZE_MB}MB. Analysis provider limits apply.`);
2268
2369
  } else if (topic === 'video') {
2269
2370
  if (subtopic === 'script') console.log('Usage: makaron video script --image <file> [--image <file>] [--lang en|zh] "direction"');
2270
2371
  else if (subtopic === 'create') printVideoCreateHelp();
@@ -2648,7 +2749,7 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
2648
2749
  }
2649
2750
 
2650
2751
  if (chatVideos.length > 0) {
2651
- // Upload local files via signed URL (no size limit, works with API key auth)
2752
+ // Stream prevalidated local files via signed URL (works with API key auth).
2652
2753
  const uploadedVideoUrls = [...prevalidatedVideoUrlList];
2653
2754
  const uploadedVideoMetas = prevalidatedVideoUrlList.map(() => null);
2654
2755
  if (prevalidatedVideoUrlList.length) {
@@ -3324,7 +3425,7 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
3324
3425
  maxDuration: providerMaxDuration,
3325
3426
  durationTolerance: MAX_VIDEO_PROVIDER_REFERENCE_DURATION_TOLERANCE,
3326
3427
  maxFramePixels: providerMaxPixels,
3327
- maxFileSize: isWan30 ? MULEROUTER_WAN_MAX_VIDEO_FILE_SIZE : isSeedance25 || isSyncLipsync || isKling4 ? 200 * 1024 * 1024 : MAX_VIDEO_UPLOAD_FILE_SIZE,
3428
+ maxFileSize: isWan30 ? MULEROUTER_WAN_MAX_VIDEO_FILE_SIZE : isSeedance25 || isSyncLipsync || isKling4 ? 200 * 1024 * 1024 : MAX_VIDEO_PROVIDER_REFERENCE_FILE_SIZE,
3328
3429
  ...(isKling4 ? {
3329
3430
  allowedExtensions: ['mp4', 'mov'], minSide: 720, maxSide: 2160,
3330
3431
  } : isGrok ? {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "makaron-cli",
3
- "version": "0.17.7",
3
+ "version": "0.17.8",
4
4
  "description": "Talk to Makaron Agent from the terminal — create projects, edit images, generate videos",
5
5
  "type": "module",
6
6
  "scripts": {
7
- "test": "node test/smoke.mjs",
7
+ "test": "node test/smoke.mjs && node test/upload.mjs",
8
8
  "test:smoke": "node test/smoke.mjs",
9
9
  "test:live": "MAKARON_LIVE=1 node test/live-smoke.mjs"
10
10
  },
@@ -246,7 +246,7 @@ npx makaron-cli chat --project <id> --video clip1.mp4 --video clip2.mp4 -b "comb
246
246
  npx makaron-cli chat --project auto --video https://example.com/dance.mp4 -b "extend this to 15 seconds"
247
247
  ```
248
248
 
249
- Supported formats: MP4, MOV, WebM. CLI local video uploads support max 50MB, max 900s (15 minutes) with 1s metadata tolerance, and <=1080p / 2,086,876 frame pixels. The frontend can transcode larger videos before upload; the CLI uploads directly to Storage and rejects videos above those limits. Videos are uploaded to the project timeline. The Agent can analyze scenes, edit content, compose multiple clips, extend duration, and add effects — all via natural language. Seedance reference-video limits remain provider-specific, so longer uploaded videos should be split/prepared by the agent before model submission; Kling 4.0 supports direct edit for a 3-30s source.
249
+ Supported formats: MP4, MOV, WebM. CLI local video uploads support max 500MB, max 900s (15 minutes) with 1s metadata tolerance, and <=1080p / 2,086,876 frame pixels. The CLI uploads files over 6MB directly to Storage in 6MB resumable chunks without loading the entire file into memory and rejects videos above those limits. Local `makaron analyze --video` uploads also support max 500MB; analysis provider limits still apply. Videos are uploaded to the project timeline. The Agent can analyze scenes, edit content, compose multiple clips, extend duration, and add effects — all via natural language. Seedance reference-video limits remain provider-specific, so longer uploaded videos should be split/prepared by the agent before model submission; Kling 4.0 supports direct edit for a 3-30s source.
250
250
 
251
251
  Use `chat --project <id|auto> --video ...` for any project/timeline video work. Direct video commands are standalone raw-tool calls.
252
252