mmx-cli 1.0.17 → 1.0.19
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 +14 -2
- package/dist/index.d.ts +73 -10
- package/dist/mmx.mjs +279 -278
- package/dist/sdk.mjs +263 -14
- package/package.json +9 -1
package/dist/sdk.mjs
CHANGED
|
@@ -496,9 +496,17 @@ function maybeShowStatusBar(config, token, model) {
|
|
|
496
496
|
// package.json
|
|
497
497
|
var package_default = {
|
|
498
498
|
name: "mmx-cli",
|
|
499
|
-
version: "1.0.
|
|
499
|
+
version: "1.0.19",
|
|
500
500
|
description: "CLI for the MiniMax AI Platform",
|
|
501
501
|
type: "module",
|
|
502
|
+
repository: {
|
|
503
|
+
type: "git",
|
|
504
|
+
url: "git+https://github.com/MiniMax-AI/cli.git"
|
|
505
|
+
},
|
|
506
|
+
homepage: "https://github.com/MiniMax-AI/cli#readme",
|
|
507
|
+
bugs: {
|
|
508
|
+
url: "https://github.com/MiniMax-AI/cli/issues"
|
|
509
|
+
},
|
|
502
510
|
engines: {
|
|
503
511
|
node: ">=18"
|
|
504
512
|
},
|
|
@@ -729,9 +737,15 @@ function imageEndpoint(baseUrl) {
|
|
|
729
737
|
function videoGenerateEndpoint(baseUrl) {
|
|
730
738
|
return `${baseUrl}/v1/video_generation`;
|
|
731
739
|
}
|
|
740
|
+
function videoGenerateV2Endpoint(baseUrl) {
|
|
741
|
+
return `${baseUrl}/v2/video_generation`;
|
|
742
|
+
}
|
|
732
743
|
function videoTaskEndpoint(baseUrl, taskId) {
|
|
733
744
|
return `${baseUrl}/v1/query/video_generation?task_id=${taskId}`;
|
|
734
745
|
}
|
|
746
|
+
function videoTaskV2Endpoint(baseUrl, taskId) {
|
|
747
|
+
return `${baseUrl}/v2/query/video_generation/${taskId}`;
|
|
748
|
+
}
|
|
735
749
|
function fileRetrieveEndpoint(baseUrl, fileId) {
|
|
736
750
|
return `${baseUrl}/v1/files/retrieve?file_id=${fileId}`;
|
|
737
751
|
}
|
|
@@ -793,7 +807,7 @@ class TextSDK extends Client {
|
|
|
793
807
|
}
|
|
794
808
|
return {
|
|
795
809
|
...params,
|
|
796
|
-
model: params.model ?? "MiniMax-
|
|
810
|
+
model: params.model ?? "MiniMax-M3",
|
|
797
811
|
max_tokens: params.max_tokens ?? 4096
|
|
798
812
|
};
|
|
799
813
|
}
|
|
@@ -1178,7 +1192,7 @@ async function downloadFile(url, destPath, opts) {
|
|
|
1178
1192
|
if (!res.ok) {
|
|
1179
1193
|
throw new CLIError(`Download failed: HTTP ${res.status}`, ExitCode.GENERAL);
|
|
1180
1194
|
}
|
|
1181
|
-
const contentLength = Number(res.headers.get("content-length") || 0);
|
|
1195
|
+
const contentLength = res.headers.get("content-encoding") ? 0 : Number(res.headers.get("content-length") || 0);
|
|
1182
1196
|
const reader = res.body?.getReader();
|
|
1183
1197
|
if (!reader)
|
|
1184
1198
|
throw new CLIError("No response body", ExitCode.GENERAL);
|
|
@@ -1205,6 +1219,9 @@ async function downloadFile(url, destPath, opts) {
|
|
|
1205
1219
|
received += value.byteLength;
|
|
1206
1220
|
progress?.update(received);
|
|
1207
1221
|
}
|
|
1222
|
+
if (contentLength > 0 && received !== contentLength) {
|
|
1223
|
+
throw new CLIError(`Download truncated: expected ${contentLength} bytes, received ${received}.`, ExitCode.NETWORK);
|
|
1224
|
+
}
|
|
1208
1225
|
readComplete = true;
|
|
1209
1226
|
} finally {
|
|
1210
1227
|
reader.releaseLock();
|
|
@@ -1350,11 +1367,169 @@ async function poll(config, opts) {
|
|
|
1350
1367
|
throw new CLIError("Polling timed out.", ExitCode.TIMEOUT, "Try increasing --timeout or check task status manually.");
|
|
1351
1368
|
}
|
|
1352
1369
|
|
|
1370
|
+
// src/utils/media.ts
|
|
1371
|
+
var VIDEO_V2_MEDIA_SIZE_LIMITS = {
|
|
1372
|
+
image: 30 * 1024 * 1024,
|
|
1373
|
+
video: 50 * 1024 * 1024,
|
|
1374
|
+
audio: 15 * 1024 * 1024
|
|
1375
|
+
};
|
|
1376
|
+
var VIDEO_V2_MAX_REQUEST_BODY_BYTES = 64 * 1024 * 1024;
|
|
1377
|
+
function dataUriDecodedSize(input) {
|
|
1378
|
+
const match = /^data:[^;,]+;base64,([\s\S]*)$/.exec(input);
|
|
1379
|
+
if (!match)
|
|
1380
|
+
return;
|
|
1381
|
+
const base64 = match[1].replace(/\s/g, "");
|
|
1382
|
+
const padding = base64.endsWith("==") ? 2 : base64.endsWith("=") ? 1 : 0;
|
|
1383
|
+
return Math.max(0, Math.floor(base64.length * 3 / 4) - padding);
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
// src/video/v2.ts
|
|
1387
|
+
var VIDEO_V2_MODEL = "MiniMax-H3";
|
|
1388
|
+
var VIDEO_V2_RATIOS = new Set([
|
|
1389
|
+
"adaptive",
|
|
1390
|
+
"21:9",
|
|
1391
|
+
"16:9",
|
|
1392
|
+
"4:3",
|
|
1393
|
+
"1:1",
|
|
1394
|
+
"3:4",
|
|
1395
|
+
"9:16"
|
|
1396
|
+
]);
|
|
1397
|
+
var VIDEO_V2_IMAGE_ROLES = new Set([
|
|
1398
|
+
"first_frame",
|
|
1399
|
+
"last_frame",
|
|
1400
|
+
"reference_image"
|
|
1401
|
+
]);
|
|
1402
|
+
|
|
1403
|
+
class VideoV2InputError extends Error {
|
|
1404
|
+
constructor(message) {
|
|
1405
|
+
super(message);
|
|
1406
|
+
this.name = "VideoV2InputError";
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
function isVideoV2Model(model) {
|
|
1410
|
+
return model === VIDEO_V2_MODEL;
|
|
1411
|
+
}
|
|
1412
|
+
function isVideoV2Request(request2) {
|
|
1413
|
+
return isVideoV2Model(request2.model);
|
|
1414
|
+
}
|
|
1415
|
+
function buildVideoV2Request(options) {
|
|
1416
|
+
const images = options.images ?? [];
|
|
1417
|
+
if (images.length > 1 && images.some((image) => !image.role)) {
|
|
1418
|
+
throw new VideoV2InputError("Each image must specify a role when multiple images are provided.");
|
|
1419
|
+
}
|
|
1420
|
+
const content = [
|
|
1421
|
+
{ type: "text", text: options.prompt },
|
|
1422
|
+
...images.map((image) => ({
|
|
1423
|
+
type: "image_url",
|
|
1424
|
+
image_url: { url: image.url },
|
|
1425
|
+
role: image.role ?? "first_frame"
|
|
1426
|
+
})),
|
|
1427
|
+
...(options.referenceVideos ?? []).map((url) => ({
|
|
1428
|
+
type: "video_url",
|
|
1429
|
+
video_url: { url },
|
|
1430
|
+
role: "reference_video"
|
|
1431
|
+
})),
|
|
1432
|
+
...(options.referenceAudios ?? []).map((url) => ({
|
|
1433
|
+
type: "audio_url",
|
|
1434
|
+
audio_url: { url },
|
|
1435
|
+
role: "reference_audio"
|
|
1436
|
+
}))
|
|
1437
|
+
];
|
|
1438
|
+
const hasFrameInput = content.some((item) => item.type === "image_url" && (item.role === "first_frame" || item.role === "last_frame"));
|
|
1439
|
+
const hasReferenceInput = content.some((item) => item.type !== "text" && item.role?.startsWith("reference_"));
|
|
1440
|
+
const request2 = {
|
|
1441
|
+
model: VIDEO_V2_MODEL,
|
|
1442
|
+
content,
|
|
1443
|
+
resolution: options.resolution ?? "2K",
|
|
1444
|
+
duration: options.duration ?? 5,
|
|
1445
|
+
ratio: hasFrameInput ? "adaptive" : options.ratio ?? (hasReferenceInput ? "adaptive" : "16:9")
|
|
1446
|
+
};
|
|
1447
|
+
if (options.callbackUrl)
|
|
1448
|
+
request2.callback_url = options.callbackUrl;
|
|
1449
|
+
validateVideoV2Request(request2);
|
|
1450
|
+
return request2;
|
|
1451
|
+
}
|
|
1452
|
+
function validateVideoV2Request(request2) {
|
|
1453
|
+
if (!isVideoV2Model(request2.model)) {
|
|
1454
|
+
throw new VideoV2InputError(`Video Generation V2 only supports ${VIDEO_V2_MODEL}.`);
|
|
1455
|
+
}
|
|
1456
|
+
const textItems = request2.content.filter((item) => item.type === "text");
|
|
1457
|
+
if (!textItems.some((item) => item.text.trim().length > 0)) {
|
|
1458
|
+
throw new VideoV2InputError("MiniMax-H3 requires a non-empty text content item.");
|
|
1459
|
+
}
|
|
1460
|
+
if (textItems.some((item) => item.text.length > 7000)) {
|
|
1461
|
+
throw new VideoV2InputError("MiniMax-H3 text content must not exceed 7000 characters.");
|
|
1462
|
+
}
|
|
1463
|
+
if (request2.resolution !== "2K") {
|
|
1464
|
+
throw new VideoV2InputError("MiniMax-H3 currently only supports 2K resolution.");
|
|
1465
|
+
}
|
|
1466
|
+
if (!Number.isInteger(request2.duration) || request2.duration < 4 || request2.duration > 15) {
|
|
1467
|
+
throw new VideoV2InputError("MiniMax-H3 duration must be an integer from 4 to 15 seconds.");
|
|
1468
|
+
}
|
|
1469
|
+
if (request2.ratio && !VIDEO_V2_RATIOS.has(request2.ratio)) {
|
|
1470
|
+
throw new VideoV2InputError("MiniMax-H3 ratio must be one of: adaptive, 21:9, 16:9, 4:3, 1:1, 3:4, 9:16.");
|
|
1471
|
+
}
|
|
1472
|
+
const images = request2.content.filter((item) => item.type === "image_url");
|
|
1473
|
+
const videos = request2.content.filter((item) => item.type === "video_url");
|
|
1474
|
+
const audios = request2.content.filter((item) => item.type === "audio_url");
|
|
1475
|
+
if (images.some((item) => item.role && !VIDEO_V2_IMAGE_ROLES.has(item.role))) {
|
|
1476
|
+
throw new VideoV2InputError("MiniMax-H3 image role must be one of: first_frame, last_frame, reference_image.");
|
|
1477
|
+
}
|
|
1478
|
+
if (videos.some((item) => item.role !== "reference_video")) {
|
|
1479
|
+
throw new VideoV2InputError("MiniMax-H3 video role must be reference_video.");
|
|
1480
|
+
}
|
|
1481
|
+
if (audios.some((item) => item.role !== "reference_audio")) {
|
|
1482
|
+
throw new VideoV2InputError("MiniMax-H3 audio role must be reference_audio.");
|
|
1483
|
+
}
|
|
1484
|
+
for (const image of images) {
|
|
1485
|
+
validateDataUriSize(image.image_url.url, "image");
|
|
1486
|
+
}
|
|
1487
|
+
for (const video of videos) {
|
|
1488
|
+
validateDataUriSize(video.video_url.url, "video");
|
|
1489
|
+
}
|
|
1490
|
+
for (const audio of audios) {
|
|
1491
|
+
validateDataUriSize(audio.audio_url.url, "audio");
|
|
1492
|
+
}
|
|
1493
|
+
const requestBodyBytes = Buffer.byteLength(JSON.stringify(request2));
|
|
1494
|
+
if (requestBodyBytes > VIDEO_V2_MAX_REQUEST_BODY_BYTES) {
|
|
1495
|
+
throw new VideoV2InputError(`MiniMax-H3 request body is ${(requestBodyBytes / 1024 / 1024).toFixed(1)} MB; the maximum is 64 MB. Use public URLs or mm_file:// file IDs instead of Base64.`);
|
|
1496
|
+
}
|
|
1497
|
+
const firstFrames = images.filter((item) => !item.role || item.role === "first_frame");
|
|
1498
|
+
const lastFrames = images.filter((item) => item.role === "last_frame");
|
|
1499
|
+
const referenceImages = images.filter((item) => item.role === "reference_image");
|
|
1500
|
+
const hasFrameInput = firstFrames.length > 0 || lastFrames.length > 0;
|
|
1501
|
+
const hasReferenceInput = referenceImages.length > 0 || videos.length > 0 || audios.length > 0;
|
|
1502
|
+
if (firstFrames.length > 1 || lastFrames.length > 1) {
|
|
1503
|
+
throw new VideoV2InputError("MiniMax-H3 accepts at most one first frame and one last frame.");
|
|
1504
|
+
}
|
|
1505
|
+
if (referenceImages.length > 9 || videos.length > 3 || audios.length > 3) {
|
|
1506
|
+
throw new VideoV2InputError("MiniMax-H3 accepts up to 9 reference images, 3 reference videos, and 3 reference audios.");
|
|
1507
|
+
}
|
|
1508
|
+
if (hasFrameInput && hasReferenceInput) {
|
|
1509
|
+
throw new VideoV2InputError("MiniMax-H3 frame inputs and reference inputs cannot be used together.");
|
|
1510
|
+
}
|
|
1511
|
+
if (audios.length > 0 && referenceImages.length === 0 && videos.length === 0) {
|
|
1512
|
+
throw new VideoV2InputError("MiniMax-H3 reference audio requires at least one reference image or reference video.");
|
|
1513
|
+
}
|
|
1514
|
+
const isTextOnly = request2.content.every((item) => item.type === "text");
|
|
1515
|
+
if (isTextOnly && (!request2.ratio || request2.ratio === "adaptive")) {
|
|
1516
|
+
throw new VideoV2InputError("MiniMax-H3 text-to-video requires a concrete ratio; adaptive is not supported.");
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
function validateDataUriSize(url, kind) {
|
|
1520
|
+
const size = dataUriDecodedSize(url);
|
|
1521
|
+
const maxBytes = VIDEO_V2_MEDIA_SIZE_LIMITS[kind];
|
|
1522
|
+
if (size !== undefined && size > maxBytes) {
|
|
1523
|
+
throw new VideoV2InputError(`MiniMax-H3 ${kind} input is ${(size / 1024 / 1024).toFixed(1)} MB; the maximum is ${maxBytes / 1024 / 1024} MB.`);
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1353
1527
|
// src/sdk/video/index.ts
|
|
1354
1528
|
class VideoSDK extends Client {
|
|
1355
1529
|
async generate(request2) {
|
|
1356
1530
|
const body = this.validateParams(request2);
|
|
1357
|
-
const
|
|
1531
|
+
const usesV2 = isVideoV2Request(body);
|
|
1532
|
+
const url = usesV2 ? videoGenerateV2Endpoint(this.config.baseUrl) : videoGenerateEndpoint(this.config.baseUrl);
|
|
1358
1533
|
const res = await this.requestJson({
|
|
1359
1534
|
url,
|
|
1360
1535
|
method: "POST",
|
|
@@ -1364,8 +1539,20 @@ class VideoSDK extends Client {
|
|
|
1364
1539
|
if (request2.async) {
|
|
1365
1540
|
return { taskId };
|
|
1366
1541
|
}
|
|
1542
|
+
if (usesV2) {
|
|
1543
|
+
const taskUrl2 = videoTaskV2Endpoint(this.config.baseUrl, taskId);
|
|
1544
|
+
const result = await poll(this.config, {
|
|
1545
|
+
url: taskUrl2,
|
|
1546
|
+
intervalSec: request2.pollInterval ?? 5,
|
|
1547
|
+
timeoutSec: request2.timeout ?? this.config.timeout,
|
|
1548
|
+
isComplete: (d) => d.task.status === "succeeded",
|
|
1549
|
+
isFailed: (d) => ["failed", "cancelled", "expired"].includes(d.task.status),
|
|
1550
|
+
getStatus: (d) => d.task.status
|
|
1551
|
+
});
|
|
1552
|
+
return result.task;
|
|
1553
|
+
}
|
|
1367
1554
|
const taskUrl = videoTaskEndpoint(this.config.baseUrl, taskId);
|
|
1368
|
-
|
|
1555
|
+
return await poll(this.config, {
|
|
1369
1556
|
url: taskUrl,
|
|
1370
1557
|
intervalSec: request2.pollInterval ?? 5,
|
|
1371
1558
|
timeoutSec: request2.timeout ?? this.config.timeout,
|
|
@@ -1373,9 +1560,13 @@ class VideoSDK extends Client {
|
|
|
1373
1560
|
isFailed: (d) => d.status === "Failed",
|
|
1374
1561
|
getStatus: (d) => d.status
|
|
1375
1562
|
});
|
|
1376
|
-
return result;
|
|
1377
1563
|
}
|
|
1378
|
-
async getTask({ taskId }) {
|
|
1564
|
+
async getTask({ taskId, model }) {
|
|
1565
|
+
if (isVideoV2Model(model)) {
|
|
1566
|
+
const url2 = videoTaskV2Endpoint(this.config.baseUrl, taskId);
|
|
1567
|
+
const result = await this.requestJson({ url: url2 });
|
|
1568
|
+
return result.task;
|
|
1569
|
+
}
|
|
1379
1570
|
const url = videoTaskEndpoint(this.config.baseUrl, taskId);
|
|
1380
1571
|
return await this.requestJson({ url });
|
|
1381
1572
|
}
|
|
@@ -1394,7 +1585,55 @@ class VideoSDK extends Client {
|
|
|
1394
1585
|
};
|
|
1395
1586
|
}
|
|
1396
1587
|
validateParams(request2) {
|
|
1397
|
-
const
|
|
1588
|
+
const params = { ...request2 };
|
|
1589
|
+
delete params.async;
|
|
1590
|
+
delete params.pollInterval;
|
|
1591
|
+
delete params.timeout;
|
|
1592
|
+
if ("content" in params || isVideoV2Model(params.model)) {
|
|
1593
|
+
try {
|
|
1594
|
+
if ("content" in params) {
|
|
1595
|
+
if (params.model && !isVideoV2Model(params.model)) {
|
|
1596
|
+
throw new VideoV2InputError("content is only supported with model MiniMax-H3");
|
|
1597
|
+
}
|
|
1598
|
+
const content = params.content;
|
|
1599
|
+
const hasFrameInput = content.some((item) => item.type === "image_url" && (!item.role || item.role === "first_frame" || item.role === "last_frame"));
|
|
1600
|
+
const hasReferenceInput = content.some((item) => item.type !== "text" && item.role?.startsWith("reference_"));
|
|
1601
|
+
const body = {
|
|
1602
|
+
...params,
|
|
1603
|
+
model: VIDEO_V2_MODEL,
|
|
1604
|
+
resolution: params.resolution ?? "2K",
|
|
1605
|
+
duration: params.duration ?? 5,
|
|
1606
|
+
ratio: params.ratio ?? (hasFrameInput || hasReferenceInput ? "adaptive" : "16:9")
|
|
1607
|
+
};
|
|
1608
|
+
validateVideoV2Request(body);
|
|
1609
|
+
return body;
|
|
1610
|
+
}
|
|
1611
|
+
const prompt2 = params.prompt;
|
|
1612
|
+
if (!prompt2) {
|
|
1613
|
+
throw new VideoV2InputError("prompt or content is required");
|
|
1614
|
+
}
|
|
1615
|
+
return buildVideoV2Request({
|
|
1616
|
+
prompt: prompt2,
|
|
1617
|
+
images: [
|
|
1618
|
+
...params.first_frame_image ? [{ url: params.first_frame_image, role: "first_frame" }] : [],
|
|
1619
|
+
...params.last_frame_image ? [{ url: params.last_frame_image, role: "last_frame" }] : []
|
|
1620
|
+
],
|
|
1621
|
+
resolution: params.resolution,
|
|
1622
|
+
duration: params.duration,
|
|
1623
|
+
ratio: params.ratio,
|
|
1624
|
+
callbackUrl: params.callback_url
|
|
1625
|
+
});
|
|
1626
|
+
} catch (error) {
|
|
1627
|
+
if (error instanceof VideoV2InputError) {
|
|
1628
|
+
throw new SDKError(error.message, ExitCode.USAGE);
|
|
1629
|
+
}
|
|
1630
|
+
throw error;
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
if ("resolution" in params || "duration" in params || "ratio" in params) {
|
|
1634
|
+
throw new SDKError("resolution, duration, and ratio require model MiniMax-H3", ExitCode.USAGE);
|
|
1635
|
+
}
|
|
1636
|
+
const { prompt, model, first_frame_image, last_frame_image, subject_reference } = params;
|
|
1398
1637
|
if (!prompt) {
|
|
1399
1638
|
throw new SDKError("prompt is required", ExitCode.USAGE);
|
|
1400
1639
|
}
|
|
@@ -1417,9 +1656,10 @@ class VideoSDK extends Client {
|
|
|
1417
1656
|
if (last_frame_image && subject_reference) {
|
|
1418
1657
|
throw new SDKError("last_frame_image and subject_reference cannot be used together (SEF and S2V are different modes).", ExitCode.USAGE);
|
|
1419
1658
|
}
|
|
1420
|
-
return
|
|
1659
|
+
return {
|
|
1660
|
+
...params,
|
|
1421
1661
|
model: resolvedModel
|
|
1422
|
-
}
|
|
1662
|
+
};
|
|
1423
1663
|
}
|
|
1424
1664
|
}
|
|
1425
1665
|
|
|
@@ -1429,6 +1669,7 @@ import { resolve as resolve3, dirname as dirname3 } from "node:path";
|
|
|
1429
1669
|
|
|
1430
1670
|
// src/commands/music/models.ts
|
|
1431
1671
|
var MUSIC_GENERATE_MODELS = [
|
|
1672
|
+
"music-3.0",
|
|
1432
1673
|
"music-2.6",
|
|
1433
1674
|
"music-2.6-free",
|
|
1434
1675
|
"music-2.5+",
|
|
@@ -1442,7 +1683,7 @@ function musicGenerateModel(config) {
|
|
|
1442
1683
|
if (config.defaultMusicModel && includesModel(MUSIC_GENERATE_MODELS, config.defaultMusicModel)) {
|
|
1443
1684
|
return config.defaultMusicModel;
|
|
1444
1685
|
}
|
|
1445
|
-
return "music-
|
|
1686
|
+
return "music-3.0";
|
|
1446
1687
|
}
|
|
1447
1688
|
|
|
1448
1689
|
// src/utils/audio-stream.ts
|
|
@@ -1751,15 +1992,23 @@ class SearchSDK extends Client {
|
|
|
1751
1992
|
}
|
|
1752
1993
|
|
|
1753
1994
|
// src/utils/image.ts
|
|
1754
|
-
import { readFileSync as readFileSync2, existsSync as existsSync5 } from "fs";
|
|
1995
|
+
import { readFileSync as readFileSync2, existsSync as existsSync5, statSync } from "fs";
|
|
1755
1996
|
import { extname } from "path";
|
|
1756
1997
|
var IMAGE_MIME_TYPES = {
|
|
1757
1998
|
".jpg": "image/jpeg",
|
|
1758
1999
|
".jpeg": "image/jpeg",
|
|
1759
2000
|
".png": "image/png",
|
|
1760
|
-
".webp": "image/webp"
|
|
2001
|
+
".webp": "image/webp",
|
|
2002
|
+
".heic": "image/heic",
|
|
2003
|
+
".heif": "image/heif"
|
|
1761
2004
|
};
|
|
1762
|
-
function localFileToDataUri(filePath) {
|
|
2005
|
+
function localFileToDataUri(filePath, maxBytes) {
|
|
2006
|
+
if (maxBytes !== undefined) {
|
|
2007
|
+
const size = statSync(filePath).size;
|
|
2008
|
+
if (size > maxBytes) {
|
|
2009
|
+
throw new CLIError(`Image file is ${(size / 1024 / 1024).toFixed(1)} MB; MiniMax-H3 allows at most ${maxBytes / 1024 / 1024} MB.`, ExitCode.USAGE, "Use a public URL or mm_file:// file ID for large images.");
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
1763
2012
|
const ext = extname(filePath).toLowerCase();
|
|
1764
2013
|
const mime = IMAGE_MIME_TYPES[ext] || "image/jpeg";
|
|
1765
2014
|
const data = readFileSync2(filePath);
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mmx-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "CLI for the MiniMax AI Platform",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/MiniMax-AI/cli.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/MiniMax-AI/cli#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/MiniMax-AI/cli/issues"
|
|
13
|
+
},
|
|
6
14
|
"engines": {
|
|
7
15
|
"node": ">=18"
|
|
8
16
|
},
|