makaron-cli 0.17.29 → 0.17.30

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.29",
3
+ "version": "0.17.30",
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.29",
3
+ "version": "0.17.30",
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
@@ -801,3 +801,8 @@ quote stops before charging. Input video adds billable seconds; supplier credits
801
801
  are different from Makaron credits. Native 4K uses EvoLink, never Eco enhancement.
802
802
 
803
803
  Kling Image 4.0 (`--image-model kling-image-4.0`) generates or edits one native PNG at `--image-resolution 2K|4K|8K` (default 2K) on fal. You can include up to 10 ordered reference images, counting the source image. The CLI uploads local files automatically. Each input must be at most 30 MiB, at least 300 pixels on both sides, with an aspect ratio from 0.4 to 2.5. Refer to them as `@Image1`, `@Image2`. Keep the image request UUID printed by the CLI. If the response is uncertain, pass the same UUID with `--image-request-id <uuid>` to check the existing receipt without a second submission or charge. Hosted MCP requires `imageRequestId`. Pick a model with native transparency for cutouts. Kling Image 4.0 uses prompt-guided edits, so areas outside the requested edit can change.
804
+
805
+
806
+ ### Director private preview
807
+
808
+ With an enrolled Makaron API key and the private service address in `MAKARON_DIRECTOR_URL`, use `makaron director start --prompt "A red train pulls into a station" --open` to open the live player. Live shows default to 480p. Pass `--resolution 768p` for higher resolution. Inside the player, use text or the microphone to direct the next scene. From another terminal use `makaron director direct <id> "A dragon arrives"`, `status <id>`, and `stop <id>` under the same `makaron director` command. Once status reports `recorded: true`, use `makaron director export <id> --output show.mp4` (WebM when requested by the CLI). `makaron director --help` lists opening image, format and composition options.
@@ -0,0 +1,118 @@
1
+ import { parseArgs } from 'node:util';
2
+ import { spawn } from 'node:child_process';
3
+ import { randomUUID } from 'node:crypto';
4
+ import { createWriteStream } from 'node:fs';
5
+ import { link, rm } from 'node:fs/promises';
6
+ import { pipeline } from 'node:stream/promises';
7
+ import { Readable } from 'node:stream';
8
+ import path from 'node:path';
9
+
10
+ export const directorHelp = `makaron director start --prompt <scene> [--image <file|https-url>] [--resolution 480p|768p] [--aspect-ratio 16:9|9:16|1:1] [--memory 1-50] [--seed n] [--story] [--open] [--json]
11
+ makaron director open <session>
12
+ makaron director direct <session> [--ready] <direction>
13
+ makaron director status <session>
14
+ makaron director stop <session>
15
+ makaron director export <session> --output <file>
16
+ Use the player for live voice or text, preview and recording. The player link is private.
17
+ Use --request-id <uuid> to recover the same start after a connection failure.
18
+ --story keeps the story moving on its own between your directions.
19
+ --ready sends a direction you already wrote as is, without the spoken-draft cleanup.`;
20
+
21
+ export async function runDirector(argv, getAuth, uploadImage) {
22
+ const { values, positionals } = parseArgs({
23
+ args: argv,
24
+ allowPositionals: true,
25
+ options: {
26
+ prompt: { type: 'string' },
27
+ image: { type: 'string' },
28
+ open: { type: 'boolean' },
29
+ json: { type: 'boolean' },
30
+ resolution: { type: 'string' },
31
+ 'aspect-ratio': { type: 'string' },
32
+ memory: { type: 'string' },
33
+ seed: { type: 'string' },
34
+ host: { type: 'boolean' },
35
+ story: { type: 'boolean' },
36
+ ready: { type: 'boolean' },
37
+ 'turn-id': { type: 'string' },
38
+ output: { type: 'string' },
39
+ 'request-id': { type: 'string' },
40
+ },
41
+ });
42
+ const [action, id, ...words] = positionals;
43
+ if (!['start', 'open', 'direct', 'status', 'stop', 'export'].includes(action))
44
+ throw Error(directorHelp);
45
+ if (action === 'start' ? !values.prompt?.trim() || id : !id || (action !== 'direct' && words.length))
46
+ throw Error(directorHelp);
47
+ if ((action === 'direct' && !words.join(' ').trim()) || (action === 'export' && !values.output))
48
+ throw Error(directorHelp);
49
+ const { baseUrl, headers } = getAuth();
50
+ const directorUrl = new URL(process.env.MAKARON_DIRECTOR_URL || baseUrl);
51
+ if (
52
+ directorUrl.protocol !== 'https:' &&
53
+ !(
54
+ directorUrl.protocol === 'http:' &&
55
+ ['localhost', '127.0.0.1', '[::1]'].includes(directorUrl.hostname)
56
+ )
57
+ )
58
+ throw Error('Director requires HTTPS or loopback');
59
+ let image = values.image;
60
+ if (image && !/^https:\/\//i.test(image)) {
61
+ image = await uploadImage(directorUrl.origin, headers, image);
62
+ if (!image) throw Error('Opening image upload failed');
63
+ }
64
+ const payload =
65
+ action === 'start'
66
+ ? {
67
+ action,
68
+ prompt: values.prompt,
69
+ image,
70
+ resolution: values.resolution,
71
+ aspectRatio: values['aspect-ratio'],
72
+ memory: values.memory,
73
+ seed: values.seed,
74
+ ...(values.story ? { story: true } : {}),
75
+ requestId: values['request-id'] || randomUUID(),
76
+ }
77
+ : { action, id, text: words.join(' '), turnId: values['turn-id'], host: values.host, ready: values.ready };
78
+ if (action === 'start') process.stderr.write('Director request ID: ' + payload.requestId + '\n');
79
+ const res = await fetch(new URL('/api/director', directorUrl), {
80
+ method: 'POST',
81
+ redirect: 'error',
82
+ headers: { ...headers, 'content-type': 'application/json' },
83
+ body: JSON.stringify(payload),
84
+ });
85
+ if (!res.ok) {
86
+ const e = await res.json().catch(() => ({}));
87
+ throw Error(e.error || 'Director returned HTTP ' + res.status);
88
+ }
89
+ if (action === 'export') {
90
+ const ext = res.headers.get('content-type')?.includes('mp4') ? '.mp4' : '.webm';
91
+ if (path.extname(values.output).toLowerCase() !== ext)
92
+ throw Error('Use ' + ext + ' for this recording');
93
+ const tmp = values.output + '.' + randomUUID() + '.part';
94
+ try {
95
+ await pipeline(Readable.fromWeb(res.body), createWriteStream(tmp, { flags: 'wx', mode: 0o600 }));
96
+ await link(tmp, values.output);
97
+ } finally {
98
+ await rm(tmp, { force: true });
99
+ }
100
+ console.log(values.output);
101
+ return;
102
+ }
103
+ const result = await res.json();
104
+ if ((action === 'open' || values.open) && result.playerPath) {
105
+ const url = new URL(result.playerPath, directorUrl);
106
+ if (url.origin !== directorUrl.origin) throw Error('Unexpected Director player origin');
107
+ const exe =
108
+ process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'rundll32' : 'xdg-open';
109
+ const args = process.platform === 'win32' ? ['url.dll,FileProtocolHandler', url.href] : [url.href];
110
+ const child = spawn(exe, args, { stdio: 'ignore', detached: true });
111
+ await new Promise((ok, fail) => {
112
+ child.once('spawn', ok);
113
+ child.once('error', fail);
114
+ });
115
+ child.unref();
116
+ }
117
+ console.log(JSON.stringify(result, null, values.json ? 0 : 2));
118
+ }
package/bin/makaron.mjs CHANGED
@@ -11,6 +11,7 @@
11
11
  * npx makaron-cli list
12
12
  */
13
13
 
14
+ import {directorHelp,runDirector} from './director.mjs';
14
15
  import fs from 'fs';
15
16
  import { randomUUID } from 'node:crypto';
16
17
  import path from 'path';
@@ -2326,6 +2327,7 @@ Commands:
2326
2327
  Add an external image without uploading it
2327
2328
  project media add <projectId> --type video --source-url <url> --start <n> --end <n>
2328
2329
  Add an external video range without uploading it
2330
+ director --help Start, steer, watch and record a live show
2329
2331
  create --image <file> Create project from local image
2330
2332
  create --image-url <url> Create project from URL
2331
2333
  create --title "name" Create empty project (text-to-image)
@@ -2425,6 +2427,7 @@ function setupMakaron(values = []) {
2425
2427
  }
2426
2428
 
2427
2429
  function printHelp(topic, subtopic) {
2430
+ if (topic === 'director') { console.log(directorHelp); return; }
2428
2431
  if (topic === 'price') { printPriceHelp(); return; }
2429
2432
  if (topic === 'layerize') { printLayerizeHelp(); return; }
2430
2433
  if (topic === 'login') {
@@ -3442,6 +3445,13 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
3442
3445
  }
3443
3446
  await analyzeVideoCli(baseUrl, headers, video, questionParts);
3444
3447
 
3448
+ } else if (command === 'director') {
3449
+ try {
3450
+ await runDirector(args.slice(1),getAuth,(base,headers,file)=>{
3451
+ const image=validateImage(file);if(!image.ok)throw Error(image.error);
3452
+ return uploadFileViaSignedUrl(base,headers,undefined,file,image.mime);
3453
+ });
3454
+ } catch(error) {console.error(error.message);process.exitCode=1;}
3445
3455
  } else if (command === 'video') {
3446
3456
  const { headers, baseUrl } = getAuth();
3447
3457
  const sub = args[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makaron-cli",
3
- "version": "0.17.29",
3
+ "version": "0.17.30",
4
4
  "description": "Talk to Makaron Agent from the terminal — create projects, edit images, generate videos",
5
5
  "type": "module",
6
6
  "scripts": {