@bonginkan/maria 4.3.15 → 4.3.17

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/dist/cli.cjs CHANGED
@@ -1704,7 +1704,7 @@ var init_AuthenticationManager = __esm({
1704
1704
  const response = await fetch(`${this.apiBase}/api/user/profile`, {
1705
1705
  headers: {
1706
1706
  "Authorization": `Bearer ${tokens2.accessToken}`,
1707
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.15"}`
1707
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.17"}`
1708
1708
  }
1709
1709
  });
1710
1710
  if (response.status === 401) {
@@ -2407,7 +2407,7 @@ async function callApi(path60, init3 = {}) {
2407
2407
  "Authorization": `Bearer ${token}`,
2408
2408
  "X-Device-Id": getDeviceId(),
2409
2409
  "X-Session-Id": getSessionId() || "",
2410
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.15"}`,
2410
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.17"}`,
2411
2411
  "Content-Type": init3.headers?.["Content-Type"] || "application/json"
2412
2412
  });
2413
2413
  const doFetch = async (token) => {
@@ -16071,8 +16071,8 @@ var require_package = __commonJS({
16071
16071
  "package.json"(exports, module) {
16072
16072
  module.exports = {
16073
16073
  name: "@bonginkan/maria",
16074
- version: "4.3.15",
16075
- description: "\u{1F680} MARIA v4.3.15 - Enterprise AI Development Platform with identity system and character voice implementation. Features 74 production-ready commands with comprehensive fallback implementation, local LLM support, and zero external dependencies. Includes natural language coding, AI safety evaluation, intelligent evolution system, episodic memory with PII masking, and real-time monitoring dashboard. Built with TypeScript AST-powered code generation, OAuth2.0 + PKCE authentication, quantum-resistant cryptography, and enterprise-grade performance.",
16074
+ version: "4.3.17",
16075
+ description: "\u{1F680} MARIA v4.3.17 - Enterprise AI Development Platform with identity system and character voice implementation. Features 74 production-ready commands with comprehensive fallback implementation, local LLM support, and zero external dependencies. Includes natural language coding, AI safety evaluation, intelligent evolution system, episodic memory with PII masking, and real-time monitoring dashboard. Built with TypeScript AST-powered code generation, OAuth2.0 + PKCE authentication, quantum-resistant cryptography, and enterprise-grade performance.",
16076
16076
  keywords: [
16077
16077
  "ai",
16078
16078
  "cli",
@@ -22272,7 +22272,7 @@ function normalizeVideoArgs(raw, root) {
22272
22272
  if (!prompt) throw new Error("prompt required");
22273
22273
  const out = {
22274
22274
  prompt,
22275
- duration: 5,
22275
+ duration: 8,
22276
22276
  fps: 24,
22277
22277
  size: [1280, 720],
22278
22278
  format: "mp4",
@@ -22403,6 +22403,15 @@ async function hasCaseInsensitiveCollision(dirFull, targetFile) {
22403
22403
  async function atomicRename(stage, dest) {
22404
22404
  try {
22405
22405
  await fsp__namespace.rename(stage, dest);
22406
+ try {
22407
+ const fd = await fsp__namespace.open(dest, "r");
22408
+ try {
22409
+ await fd.sync();
22410
+ } finally {
22411
+ await fd.close();
22412
+ }
22413
+ } catch {
22414
+ }
22406
22415
  } catch (e2) {
22407
22416
  if (e2 && e2.code === "EXDEV") {
22408
22417
  await fsp__namespace.copyFile(stage, dest);
@@ -22420,7 +22429,7 @@ async function atomicRename(stage, dest) {
22420
22429
  }
22421
22430
  async function saveArtifacts(ctx2, items, manifest) {
22422
22431
  const root = ctx2.root;
22423
- const base = ctx2.baseDir || (ctx2.kind === "image" ? "artifacts/media/images" : "artifacts/media/videos");
22432
+ const base = typeof ctx2.baseDir === "string" ? ctx2.baseDir : "";
22424
22433
  const trace = ctx2.trace || Math.random().toString(36).slice(2, 10).toUpperCase();
22425
22434
  const stage = stageDir(root, trace);
22426
22435
  ensureDirSync(stage);
@@ -22428,7 +22437,7 @@ async function saveArtifacts(ctx2, items, manifest) {
22428
22437
  const dateSeg = datePath(/* @__PURE__ */ new Date());
22429
22438
  const reqHash = manifest.request && manifest.request.promptHash || "sha256:unknown";
22430
22439
  const slug = hashPrefix(reqHash, 6);
22431
- const outDirSeg = `${base}/${dateSeg}/${slug}`;
22440
+ const outDirSeg = ctx2.flat ? base || "" : `${base ? base + "/" : ""}${dateSeg}/${slug}`;
22432
22441
  const outDir = safeJoin(root, outDirSeg).full;
22433
22442
  ensureDirSync(outDir);
22434
22443
  const saved = [];
@@ -22438,7 +22447,8 @@ async function saveArtifacts(ctx2, items, manifest) {
22438
22447
  const ext2 = it.ext.startsWith(".") ? it.ext : `.${it.ext}`;
22439
22448
  const baseName = it.logicalName ? `${it.logicalName}` : `${contentHash}`;
22440
22449
  const fname = `${baseName}${ext2}`;
22441
- const dest = safeJoin(root, `${outDirSeg}/${fname}`);
22450
+ const relPath = outDirSeg ? `${outDirSeg}/${fname}` : `${fname}`;
22451
+ const dest = safeJoin(root, relPath);
22442
22452
  validateWinPathEdge(dest.full);
22443
22453
  if (await hasCaseInsensitiveCollision(path10__namespace.dirname(dest.full), path10__namespace.basename(dest.full))) {
22444
22454
  throw new Error("case-insensitive filename collision");
@@ -22456,25 +22466,31 @@ async function saveArtifacts(ctx2, items, manifest) {
22456
22466
  }
22457
22467
  await fsp__namespace.writeFile(stg, it.bytes);
22458
22468
  await atomicRename(stg, dest.full);
22459
- saved.push(dest.rel);
22469
+ const relPosix = dest.rel.replace(/\\/g, "/");
22470
+ saved.push(relPosix);
22460
22471
  }
22461
- const manifestObj = {
22462
- manifestVersion: 1,
22463
- ...manifest,
22464
- createdAt: manifest.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
22465
- artifacts: manifest.artifacts && manifest.artifacts.length > 0 ? manifest.artifacts : saved.map((file) => ({ file, hash: `sha256:${path10__namespace.basename(file).split(".")[0]}` }))
22466
- };
22467
- const manifestPathRel = `${outDirSeg}/manifest.json`;
22468
- const manifestStage = path10__namespace.join(stage, "manifest.json.part");
22469
- const manifestFull = safeJoin(root, manifestPathRel).full;
22470
- await fsp__namespace.writeFile(manifestStage, JSON.stringify(manifestObj, null, 2), "utf8");
22471
- try {
22472
- console.log(`[store] manifest -> ${manifestPathRel}`);
22473
- } catch {
22472
+ if (!ctx2.skipManifest) {
22473
+ const manifestObj = {
22474
+ manifestVersion: 1,
22475
+ ...manifest,
22476
+ createdAt: manifest.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
22477
+ artifacts: manifest.artifacts && manifest.artifacts.length > 0 ? manifest.artifacts : saved.map((file) => ({ file, hash: `sha256:${path10__namespace.basename(file).split(".")[0]}` }))
22478
+ };
22479
+ const manifestPathRel = `${outDirSeg ? outDirSeg + "/" : ""}manifest.json`;
22480
+ const manifestStage = path10__namespace.join(stage, "manifest.json.part");
22481
+ const manifestFull = safeJoin(root, manifestPathRel).full;
22482
+ await fsp__namespace.writeFile(manifestStage, JSON.stringify(manifestObj, null, 2), "utf8");
22483
+ try {
22484
+ console.log(`[store] manifest -> ${manifestPathRel}`);
22485
+ } catch {
22486
+ }
22487
+ await atomicRename(manifestStage, manifestFull);
22488
+ await fsp__namespace.rm(stage, { recursive: true, force: true });
22489
+ return { files: saved, manifestPath: manifestPathRel.replace(/\\/g, "/") };
22490
+ } else {
22491
+ await fsp__namespace.rm(stage, { recursive: true, force: true });
22492
+ return { files: saved, manifestPath: "" };
22474
22493
  }
22475
- await atomicRename(manifestStage, manifestFull);
22476
- await fsp__namespace.rm(stage, { recursive: true, force: true });
22477
- return { files: saved, manifestPath: manifestPathRel };
22478
22494
  } catch (e2) {
22479
22495
  await fsp__namespace.rm(stage, { recursive: true, force: true });
22480
22496
  throw e2;
@@ -22582,6 +22598,13 @@ var init_gemini_media = __esm({
22582
22598
  `GeminiMediaProvider.generateImage request failed: model=${modelName}; prompt="${promptPreview}"; error=${errMsg}`
22583
22599
  );
22584
22600
  }
22601
+ const feedback = resp?.response?.promptFeedback;
22602
+ const blockReason = feedback?.blockReason || feedback?.block_reason;
22603
+ if (blockReason) {
22604
+ const modelName2 = this.primaryModel;
22605
+ const reason = String(blockReason);
22606
+ throw new Error(`GeminiMediaProvider.policy_violation: model=${modelName2}; reason=${reason}`);
22607
+ }
22585
22608
  const parts = resp?.response?.candidates?.[0]?.content?.parts || [];
22586
22609
  for (const p of parts) {
22587
22610
  const data = p?.inlineData?.data || p?.inline_data?.data;
@@ -22755,7 +22778,7 @@ async function runImagePipeline(params2, opts) {
22755
22778
  trace: Math.random().toString(36).slice(2, 8).toUpperCase()
22756
22779
  };
22757
22780
  const items = successes.filter(Boolean).map((b) => ({ bytes: b, ext: `.${params2.format}` }));
22758
- const saved = await saveArtifacts({ root: opts.root, kind: "image", baseDir: opts.outDir }, items, manifest);
22781
+ const saved = await saveArtifacts({ root: opts.root, kind: "image", baseDir: opts.outDir, flat: true, skipManifest: true }, items, manifest);
22759
22782
  progress.done();
22760
22783
  return {
22761
22784
  saved,
@@ -23147,7 +23170,7 @@ var init_image_command = __esm({
23147
23170
  init_firestore();
23148
23171
  init_cli_auth();
23149
23172
  init_api_client();
23150
- init_MariaAPIClient();
23173
+ init_cli_auth();
23151
23174
  init_animations();
23152
23175
  ImageCommand = class extends BaseCommand {
23153
23176
  name = "image";
@@ -23196,12 +23219,13 @@ var init_image_command = __esm({
23196
23219
  const fsMod = await import('fs/promises');
23197
23220
  const savedPaths = [];
23198
23221
  for (const f3 of filesInline) {
23199
- const rel = String(f3.file || "").replace(/^[\\/]+/, "");
23200
- const full = pathMod.resolve(root, rel);
23222
+ const original = String(f3.file || "").replace(/^[\\/]+/, "");
23223
+ const name2 = pathMod.basename(original);
23224
+ const full = pathMod.resolve(root, name2);
23201
23225
  await fsMod.mkdir(pathMod.dirname(full), { recursive: true });
23202
23226
  const buf = Buffer.from(String(f3.bytesBase64 || ""), "base64");
23203
23227
  await fsMod.writeFile(full, buf);
23204
- savedPaths.push(rel);
23228
+ savedPaths.push(name2);
23205
23229
  }
23206
23230
  const { formatImageOutput: formatImageOutput3 } = await Promise.resolve().then(() => (init_cli_style(), cli_style_exports));
23207
23231
  const output4 = await formatImageOutput3(root, {
@@ -23209,18 +23233,18 @@ var init_image_command = __esm({
23209
23233
  ok: savedPaths.length,
23210
23234
  fail: 0,
23211
23235
  files: savedPaths,
23212
- manifestPath: apiRes?.data?.url || savedPaths[0],
23236
+ manifestPath: "",
23213
23237
  size: cli.size,
23214
23238
  format: cli.format,
23215
23239
  model: cli.model,
23216
23240
  jobId: apiRes?.data?.jobId
23217
23241
  });
23218
23242
  try {
23219
- const api = new MariaAPIClient();
23243
+ const api = cliAuth.getAPIClient();
23220
23244
  await api.consumeQuota({ requests: 1, image: Math.max(1, savedPaths.length) });
23221
23245
  } catch {
23222
23246
  }
23223
- return this.success(output4);
23247
+ return this.success(output4, void 0, void 0);
23224
23248
  }
23225
23249
  if (Array.isArray(filesList) && filesList.length > 0) {
23226
23250
  const pathMod = await import('path');
@@ -23228,16 +23252,17 @@ var init_image_command = __esm({
23228
23252
  const base = (process.env.MARIA_API_BASE || "https://api.maria-code.ai").replace(/\/$/, "");
23229
23253
  const savedPaths = [];
23230
23254
  for (const relRaw of filesList) {
23231
- const rel = String(relRaw || "").replace(/^[\\/]+/, "");
23232
- const url2 = `${base}/${rel}`;
23233
- const full = pathMod.resolve(root, rel);
23255
+ const originalRel = String(relRaw || "").replace(/^[\\/]+/, "");
23256
+ const url2 = `${base}/${originalRel}`;
23257
+ const name2 = pathMod.basename(originalRel);
23258
+ const full = pathMod.resolve(root, name2);
23234
23259
  await fsMod.mkdir(pathMod.dirname(full), { recursive: true });
23235
23260
  const res2 = await fetch(url2);
23236
23261
  if (!res2.ok) throw new Error(`Failed to download image: ${res2.status}`);
23237
23262
  const arrayBuf = await res2.arrayBuffer();
23238
23263
  const buf = Buffer.from(arrayBuf);
23239
23264
  await fsMod.writeFile(full, buf);
23240
- savedPaths.push(rel);
23265
+ savedPaths.push(name2);
23241
23266
  }
23242
23267
  const { formatImageOutput: formatImageOutput3 } = await Promise.resolve().then(() => (init_cli_style(), cli_style_exports));
23243
23268
  const output4 = await formatImageOutput3(root, {
@@ -23245,18 +23270,18 @@ var init_image_command = __esm({
23245
23270
  ok: savedPaths.length,
23246
23271
  fail: 0,
23247
23272
  files: savedPaths,
23248
- manifestPath: savedPaths[0],
23273
+ manifestPath: "",
23249
23274
  size: cli.size,
23250
23275
  format: cli.format,
23251
23276
  model: cli.model,
23252
23277
  jobId: apiRes?.data?.jobId
23253
23278
  });
23254
23279
  try {
23255
- const api = new MariaAPIClient();
23280
+ const api = cliAuth.getAPIClient();
23256
23281
  await api.consumeQuota({ requests: 1, image: Math.max(1, savedPaths.length) });
23257
23282
  } catch {
23258
23283
  }
23259
- return this.success(output4);
23284
+ return this.success(output4, void 0, void 0);
23260
23285
  }
23261
23286
  if (urls.length > 0) {
23262
23287
  const { formatImageOutput: formatImageOutput3 } = await Promise.resolve().then(() => (init_cli_style(), cli_style_exports));
@@ -23265,19 +23290,19 @@ var init_image_command = __esm({
23265
23290
  ok: urls.length,
23266
23291
  fail: 0,
23267
23292
  files: urls,
23268
- manifestPath: urls[0],
23293
+ manifestPath: "",
23269
23294
  size: cli.size,
23270
23295
  format: cli.format,
23271
23296
  model: cli.model,
23272
23297
  jobId: apiRes?.data?.jobId
23273
23298
  });
23274
23299
  try {
23275
- const api = new MariaAPIClient();
23300
+ const api = cliAuth.getAPIClient();
23276
23301
  const consumed = Math.max(1, urls.length || Number(cli.count || 1));
23277
23302
  await api.consumeQuota({ requests: 1, image: consumed });
23278
23303
  } catch {
23279
23304
  }
23280
- return this.success(output4);
23305
+ return this.success(output4, void 0, void 0);
23281
23306
  }
23282
23307
  const { formatRemoteAcceptedImage: formatRemoteAcceptedImage2 } = await Promise.resolve().then(() => (init_cli_style(), cli_style_exports));
23283
23308
  const msg = formatRemoteAcceptedImage2({
@@ -23304,11 +23329,11 @@ var init_image_command = __esm({
23304
23329
  } catch {
23305
23330
  }
23306
23331
  try {
23307
- const api = new MariaAPIClient();
23332
+ const api = cliAuth.getAPIClient();
23308
23333
  await api.consumeQuota({ requests: 1, image: Math.max(1, Number(cli.count || 1)) });
23309
23334
  } catch {
23310
23335
  }
23311
- return this.success(msg);
23336
+ return this.success(msg, void 0, void 0);
23312
23337
  } catch (e2) {
23313
23338
  }
23314
23339
  }
@@ -23322,7 +23347,7 @@ var init_image_command = __esm({
23322
23347
  keepExif: cli.keepExif
23323
23348
  }, {
23324
23349
  root,
23325
- outDir: cli.outDir,
23350
+ outDir: cli.outDir || "",
23326
23351
  concurrency: cli.concurrency || 1,
23327
23352
  retry: cli.retry || 0,
23328
23353
  onProgress: () => {
@@ -23353,7 +23378,7 @@ var init_image_command = __esm({
23353
23378
  }
23354
23379
  try {
23355
23380
  if (await authManager.isAuthenticated()) {
23356
- const api = new MariaAPIClient();
23381
+ const api = cliAuth.getAPIClient();
23357
23382
  const consumed = Math.max(0, Number(res.ok || 0));
23358
23383
  if (consumed > 0) await api.consumeQuota({ requests: 1, image: consumed });
23359
23384
  }
@@ -23365,12 +23390,12 @@ var init_image_command = __esm({
23365
23390
  ok,
23366
23391
  fail,
23367
23392
  files: res.saved.files,
23368
- manifestPath: res.saved.manifestPath,
23393
+ manifestPath: "",
23369
23394
  size: cli.size,
23370
23395
  format: cli.format,
23371
23396
  model: cli.model
23372
23397
  });
23373
- return this.success(output3);
23398
+ return this.success(output3, void 0, void 0);
23374
23399
  } finally {
23375
23400
  try {
23376
23401
  spinner.stop();
@@ -23454,7 +23479,13 @@ async function runVideoPipeline(params2, opts) {
23454
23479
  const { GoogleGenAI } = __require("@google/genai");
23455
23480
  const ai2 = new GoogleGenAI({ apiKey });
23456
23481
  const modelName = params2.model || "veo-3.0-generate-001";
23457
- let operation = await ai2.models.generateVideos({ model: modelName, prompt: String(params2.prompt) });
23482
+ const aspectRatio = params2.size[0] >= params2.size[1] ? "16:9" : "9:16";
23483
+ const effectiveDuration = 8;
23484
+ let operation = await ai2.models.generateVideos({
23485
+ model: modelName,
23486
+ prompt: String(params2.prompt),
23487
+ config: { aspectRatio, durationSeconds: effectiveDuration, frameRate: params2.fps }
23488
+ });
23458
23489
  const pollStart = Date.now();
23459
23490
  const maxWaitMs = 6 * 60 * 1e3;
23460
23491
  while (!operation?.done && Date.now() - pollStart < maxWaitMs) {
@@ -23465,16 +23496,28 @@ async function runVideoPipeline(params2, opts) {
23465
23496
  if (!fileRef) throw new Error("Veo3: no video in response");
23466
23497
  const dl = await ai2.files.download({ file: fileRef });
23467
23498
  const arrayBuffer = await dl.arrayBuffer();
23468
- const mp4 = Buffer.from(arrayBuffer);
23499
+ const bytes = Buffer.from(arrayBuffer);
23500
+ const head2 = bytes.subarray(0, 256);
23501
+ const headStr = head2.toString("latin1");
23502
+ const hasFtyp = headStr.indexOf("ftyp") >= 0 || head2.includes(Buffer.from("ftyp", "ascii"));
23503
+ const isWebm = head2[0] === 26 && head2[1] === 69 && head2[2] === 223 && head2[3] === 163;
23504
+ let ext2 = ".mp4";
23505
+ if (isWebm) ext2 = ".webm";
23506
+ else if (hasFtyp) {
23507
+ const brand = head2.subarray(8, 12).toString("latin1").toLowerCase();
23508
+ if (brand.startsWith("qt")) ext2 = ".mov";
23509
+ else ext2 = ".mp4";
23510
+ }
23469
23511
  const promptHash2 = hashPrompt(params2.prompt);
23470
23512
  const manifest2 = {
23471
23513
  kind: "video",
23472
- request: { promptHash: promptHash2, seed: params2.seed, params: { size: params2.size, fps: params2.fps, duration: params2.duration, format: params2.format }, model: modelName, provider: "google" },
23514
+ request: { promptHash: promptHash2, seed: params2.seed, params: { size: params2.size, fps: params2.fps, duration: effectiveDuration, format: ext2.replace(".", "") }, model: modelName, provider: "google" },
23473
23515
  artifacts: [],
23474
23516
  metrics: { durationMs: Date.now() - started, retries: 0, fallbacks: 0 },
23475
23517
  trace: Math.random().toString(36).slice(2, 8).toUpperCase()
23476
23518
  };
23477
- const saved2 = await saveArtifacts({ root: opts.root, kind: "video", baseDir: opts.outDir }, [{ bytes: mp4, ext: ".mp4" }], manifest2);
23519
+ const baseDir = opts.outDir || path10__namespace.join("artifacts", "media", "videos", String(manifest2.trace));
23520
+ const saved2 = await saveArtifacts({ root: opts.root, kind: "video", baseDir, flat: true }, [{ bytes, ext: ext2 }], manifest2);
23478
23521
  return { saved: saved2, durationMs: Date.now() - started, frames: 0, warnFallback: false, retries: 0 };
23479
23522
  }
23480
23523
  } catch {
@@ -23519,11 +23562,17 @@ async function runVideoPipeline(params2, opts) {
23519
23562
  await fsp__namespace.writeFile(path10__namespace.join(tmpDir, fname), frames[i2]);
23520
23563
  }
23521
23564
  const outBuf = await muxFramesToMp4(tmpDir, params2.fps);
23522
- saved = await saveArtifacts({ root: opts.root, kind: "video", baseDir: opts.outDir }, [{ bytes: outBuf, ext: ".mp4" }], manifest);
23565
+ {
23566
+ const baseDir = opts.outDir || path10__namespace.join("artifacts", "media", "videos", String(manifest.trace));
23567
+ saved = await saveArtifacts({ root: opts.root, kind: "video", baseDir, flat: true }, [{ bytes: outBuf, ext: ".mp4" }], manifest);
23568
+ }
23523
23569
  await fsp__namespace.rm(tmpDir, { recursive: true, force: true });
23524
23570
  } else {
23525
23571
  const items = frames.map((b, i2) => ({ bytes: b, ext: `.png`, logicalName: `frame-${String(i2 + 1).padStart(4, "0")}` }));
23526
- saved = await saveArtifacts({ root: opts.root, kind: "video", baseDir: opts.outDir }, items, manifest);
23572
+ {
23573
+ const baseDir = opts.outDir || path10__namespace.join("artifacts", "media", "videos", String(manifest.trace));
23574
+ saved = await saveArtifacts({ root: opts.root, kind: "video", baseDir, flat: true }, items, manifest);
23575
+ }
23527
23576
  warnFallback = true;
23528
23577
  }
23529
23578
  progress.done();
@@ -23564,15 +23613,16 @@ var init_video_command = __esm({
23564
23613
  category = "media";
23565
23614
  description = "Generate videos using Gemini (frames fallback when mux unavailable)";
23566
23615
  aliases = [];
23567
- usage = '/video "prompt" [--duration 5] [--fps 24] [--res 1280x720] [--format mp4|webm] [--model gemini-...] [--seed N] [--out dir] [--apply|--plan-only|--dry-run] [--concurrency N] [--retry N]';
23616
+ usage = '/video "prompt" [--duration 8] [--fps 24] [--res 1280x720] [--format mp4|webm] [--model gemini-...] [--seed N] [--out dir] [--apply|--plan-only|--dry-run] [--concurrency N] [--retry N]';
23568
23617
  examples = [
23569
- { input: '/video "product demo" --duration 5 --fps 24 --res 1280x720 --apply', description: "Generate a short demo video" }
23618
+ { input: '/video "product demo" --duration 8 --fps 24 --res 1280x720 --apply', description: "Generate a short demo video" }
23570
23619
  ];
23571
23620
  metadata = { version: "2.0.0", author: "maria" };
23572
23621
  async execute(args2, context2) {
23573
23622
  try {
23574
23623
  const root = context2.environment.cwd;
23575
23624
  const cli = normalizeVideoArgs(args2.raw, root);
23625
+ cli.duration = 8;
23576
23626
  if (cli.planOnly || cli.dryRun || !cli.apply) {
23577
23627
  const line = `Plan: video ${cli.duration}s @${cli.fps}fps ${cli.size[0]}x${cli.size[1]} ${cli.format} model=${cli.model || "auto"} concurrency=${cli.concurrency} retry=${cli.retry}`;
23578
23628
  const next = `Next: /video "${cli.prompt}" --duration ${cli.duration} --fps ${cli.fps} --res ${cli.size[0]}x${cli.size[1]} --apply`;
@@ -23598,6 +23648,41 @@ var init_video_command = __esm({
23598
23648
  body: JSON.stringify(body),
23599
23649
  headers: { "Content-Type": "application/json" }
23600
23650
  });
23651
+ const filesInline = apiRes?.data?.filesInline || [];
23652
+ if (filesInline.length > 0) {
23653
+ const pathMod = await import('path');
23654
+ const fsMod = await import('fs/promises');
23655
+ const savedPaths = [];
23656
+ for (const f3 of filesInline) {
23657
+ const original = String(f3.file || "").replace(/^[\\/]+/, "");
23658
+ const name2 = pathMod.basename(original || `video.${cli.format}`);
23659
+ const full = pathMod.resolve(root, name2);
23660
+ await fsMod.mkdir(pathMod.dirname(full), { recursive: true });
23661
+ const buf = Buffer.from(String(f3.bytesBase64 || ""), "base64");
23662
+ await fsMod.writeFile(full, buf);
23663
+ savedPaths.push(name2);
23664
+ }
23665
+ const { formatVideoOutput: formatVideoOutput3 } = await Promise.resolve().then(() => (init_cli_style(), cli_style_exports));
23666
+ const output4 = await formatVideoOutput3(root, {
23667
+ kind: "video",
23668
+ warnFallback: false,
23669
+ frames: 0,
23670
+ files: savedPaths,
23671
+ manifestPath: "",
23672
+ duration: cli.duration,
23673
+ fps: cli.fps,
23674
+ size: cli.size,
23675
+ format: cli.format,
23676
+ model: cli.model,
23677
+ jobId: apiRes?.data?.jobId
23678
+ });
23679
+ try {
23680
+ const api = cliAuth.getAPIClient();
23681
+ await api.consumeQuota({ requests: 1, video: savedPaths.length > 0 ? 1 : 0 });
23682
+ } catch {
23683
+ }
23684
+ return this.success(output4);
23685
+ }
23601
23686
  const filesFromApi = apiRes?.data?.files || [];
23602
23687
  if (filesFromApi.length > 0) {
23603
23688
  const pathMod = await import('path');
@@ -23607,14 +23692,15 @@ var init_video_command = __esm({
23607
23692
  for (const relRaw of filesFromApi) {
23608
23693
  const rel = String(relRaw || "").replace(/^[\\/]+/, "");
23609
23694
  const url2 = `${base}/${rel}`;
23610
- const full = pathMod.resolve(root, rel);
23695
+ const name2 = pathMod.basename(rel);
23696
+ const full = pathMod.resolve(root, name2);
23611
23697
  await fsMod.mkdir(pathMod.dirname(full), { recursive: true });
23612
23698
  const res2 = await fetch(url2);
23613
23699
  if (!res2.ok) throw new Error(`Failed to download video: ${res2.status}`);
23614
23700
  const arrayBuf = await res2.arrayBuffer();
23615
23701
  const buf = Buffer.from(arrayBuf);
23616
23702
  await fsMod.writeFile(full, buf);
23617
- savedPaths.push(rel);
23703
+ savedPaths.push(name2);
23618
23704
  }
23619
23705
  const { formatVideoOutput: formatVideoOutput3 } = await Promise.resolve().then(() => (init_cli_style(), cli_style_exports));
23620
23706
  const output4 = await formatVideoOutput3(root, {
@@ -23622,7 +23708,7 @@ var init_video_command = __esm({
23622
23708
  warnFallback: false,
23623
23709
  frames: 0,
23624
23710
  files: savedPaths,
23625
- manifestPath: String(apiRes?.data?.url || savedPaths[0]),
23711
+ manifestPath: "",
23626
23712
  duration: cli.duration,
23627
23713
  fps: cli.fps,
23628
23714
  size: cli.size,
@@ -25595,7 +25681,7 @@ var init_about_command = __esm({
25595
25681
  async execute(args2, context2) {
25596
25682
  const output3 = [];
25597
25683
  output3.push("");
25598
- output3.push(chalk40__default.default.cyan.bold("\u{1F916} About MARIA v4.3.15"));
25684
+ output3.push(chalk40__default.default.cyan.bold("\u{1F916} About MARIA v4.3.17"));
25599
25685
  output3.push(chalk40__default.default.gray("\u2550".repeat(40)));
25600
25686
  output3.push("");
25601
25687
  output3.push(chalk40__default.default.white.bold("MARIA - Minimal API, Maximum Power"));