@makemidas/cli 0.8.0 → 0.9.0
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/README.md +8 -6
- package/dist/api.js +21 -21
- package/dist/config.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -110,12 +110,14 @@ stdin is not a terminal), 3 not signed in, 4 not enough credits, a plan
|
|
|
110
110
|
limit or busy (also over `--max-credits`), 5 generation failed (credits
|
|
111
111
|
refunded), 6 network or server error, 7 still rendering.
|
|
112
112
|
|
|
113
|
-
Every
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
Every request that spends credits carries an `Idempotency-Key`: generating,
|
|
114
|
+
`compare`, template videos (`render --video`, `html --video`) and film
|
|
115
|
+
`approve` and `redo`. When its answer is lost (a dropped connection, a
|
|
116
|
+
server error), the CLI asks again with the same key after 2, 5 and 10
|
|
117
|
+
seconds; MakeMidas answers what the first attempt made, so nothing is made
|
|
118
|
+
or charged twice. Exit 6 after that means it still had no answer: look for
|
|
119
|
+
it with `makemidas list` (or `makemidas film get <id>`) before running the
|
|
120
|
+
command again.
|
|
119
121
|
|
|
120
122
|
## Talking avatars
|
|
121
123
|
|
package/dist/api.js
CHANGED
|
@@ -319,12 +319,18 @@ export class Api {
|
|
|
319
319
|
* again answers the generation the first attempt started instead of
|
|
320
320
|
* starting, and charging for, another.
|
|
321
321
|
*/
|
|
322
|
-
|
|
322
|
+
/**
|
|
323
|
+
* POST a request that spends credits with an Idempotency-Key, and send it
|
|
324
|
+
* again with the same key when the answer is lost, so the server answers
|
|
325
|
+
* what the first one made instead of charging twice. `lookup` says where
|
|
326
|
+
* to look when every try failed.
|
|
327
|
+
*/
|
|
328
|
+
async postOnce(path, json, key, lookup) {
|
|
323
329
|
for (let attempt = 0;; attempt++) {
|
|
324
330
|
try {
|
|
325
|
-
return await this.json(
|
|
331
|
+
return await this.json(path, {
|
|
326
332
|
method: 'POST',
|
|
327
|
-
json
|
|
333
|
+
json,
|
|
328
334
|
headers: { 'Idempotency-Key': key },
|
|
329
335
|
});
|
|
330
336
|
}
|
|
@@ -334,13 +340,16 @@ export class Api {
|
|
|
334
340
|
const delay = GENERATE_RETRY_MS[attempt];
|
|
335
341
|
if (delay === undefined) {
|
|
336
342
|
const last = error;
|
|
337
|
-
throw new CliError(`${last.message}. It may have started anyway:
|
|
343
|
+
throw new CliError(`${last.message}. It may have started anyway: ${lookup} before running this again.`, last.exitCode, last.code, last.details);
|
|
338
344
|
}
|
|
339
345
|
log(`No answer yet (${error.message}); asking again in ${delay / 1000} s with the same request key, so nothing is charged twice…`);
|
|
340
346
|
await this.sleep(delay);
|
|
341
347
|
}
|
|
342
348
|
}
|
|
343
349
|
}
|
|
350
|
+
generate(input, key = randomUUID()) {
|
|
351
|
+
return this.postOnce('/generations', input, key, 'look for it with `makemidas list`');
|
|
352
|
+
}
|
|
344
353
|
/** Price a request without charging or creating anything. */
|
|
345
354
|
estimate(input) {
|
|
346
355
|
return this.json('/generations/estimate', {
|
|
@@ -354,11 +363,8 @@ export class Api {
|
|
|
354
363
|
});
|
|
355
364
|
}
|
|
356
365
|
/** Run one prompt on 2-4 image models at once. */
|
|
357
|
-
compare(input) {
|
|
358
|
-
return this.
|
|
359
|
-
method: 'POST',
|
|
360
|
-
json: input,
|
|
361
|
-
});
|
|
366
|
+
compare(input, key = randomUUID()) {
|
|
367
|
+
return this.postOnce('/generations/compare', input, key, 'look for them with `makemidas list`');
|
|
362
368
|
}
|
|
363
369
|
/** Delete a finished or failed generation and its files. */
|
|
364
370
|
deleteGeneration(id) {
|
|
@@ -444,11 +450,8 @@ export class Api {
|
|
|
444
450
|
return this.json('/renders', { method: 'POST', json: input });
|
|
445
451
|
}
|
|
446
452
|
/** A video; it answers while rendering, so read the generation until done. */
|
|
447
|
-
videoRender(input) {
|
|
448
|
-
return this.
|
|
449
|
-
method: 'POST',
|
|
450
|
-
json: input,
|
|
451
|
-
});
|
|
453
|
+
videoRender(input, key = randomUUID()) {
|
|
454
|
+
return this.postOnce('/video-renders', input, key, 'look for it with `makemidas list`');
|
|
452
455
|
}
|
|
453
456
|
// ---------------------------------------------------------------- films
|
|
454
457
|
async films() {
|
|
@@ -484,14 +487,11 @@ export class Api {
|
|
|
484
487
|
json: input,
|
|
485
488
|
});
|
|
486
489
|
}
|
|
487
|
-
approveFilm(id, input) {
|
|
488
|
-
return this.
|
|
489
|
-
method: 'POST',
|
|
490
|
-
json: input,
|
|
491
|
-
});
|
|
490
|
+
approveFilm(id, input, key = randomUUID()) {
|
|
491
|
+
return this.postOnce(`/films/${encodeURIComponent(id)}/approve`, input, key, `check it with \`makemidas film get ${id}\``);
|
|
492
492
|
}
|
|
493
|
-
redoShot(id, shotId, input) {
|
|
494
|
-
return this.
|
|
493
|
+
redoShot(id, shotId, input, key = randomUUID()) {
|
|
494
|
+
return this.postOnce(`/films/${encodeURIComponent(id)}/shots/${encodeURIComponent(shotId)}/redo`, input, key, `check it with \`makemidas film get ${id}\``);
|
|
495
495
|
}
|
|
496
496
|
resumeFilm(id) {
|
|
497
497
|
return this.json(`/films/${encodeURIComponent(id)}/resume`, {
|
package/dist/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
export const VERSION = '0.
|
|
4
|
+
export const VERSION = '0.9.0';
|
|
5
5
|
export const USER_AGENT = `makemidas-cli/${VERSION}`;
|
|
6
6
|
export const DEFAULT_BASE_URL = 'https://makemidas.com';
|
|
7
7
|
export function resolveBaseUrl(flag) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makemidas/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "AI image, video and audio generation CLI for AI agents (Claude Code, Cursor, Codex) and people: Nano Banana, GPT Image, Seedream, Seedance, Kling, Veo, Suno and more, plus talking avatars, HTML templates and short films, through MakeMidas.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-image-generator",
|