mmx-cli 1.0.16 → 1.0.18
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 +15 -2
- package/dist/index.d.ts +7 -4
- package/dist/mmx.mjs +270 -272
- package/dist/sdk.mjs +234 -50
- package/package.json +9 -1
package/dist/sdk.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
3
3
|
|
|
4
4
|
// src/config/loader.ts
|
|
5
|
-
import {
|
|
5
|
+
import { copyFileSync, existsSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "fs";
|
|
6
6
|
|
|
7
7
|
// src/config/schema.ts
|
|
8
8
|
var REGIONS = {
|
|
@@ -215,6 +215,23 @@ class SDKError extends CLIError {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
// src/config/loader.ts
|
|
218
|
+
function isCrossDeviceError(err) {
|
|
219
|
+
return err instanceof Error && "code" in err && err.code === "EXDEV";
|
|
220
|
+
}
|
|
221
|
+
function renameWithCrossDeviceFallback(from, to, ops = {
|
|
222
|
+
rename: renameSync,
|
|
223
|
+
copy: copyFileSync,
|
|
224
|
+
unlink: unlinkSync
|
|
225
|
+
}) {
|
|
226
|
+
try {
|
|
227
|
+
ops.rename(from, to);
|
|
228
|
+
} catch (err) {
|
|
229
|
+
if (!isCrossDeviceError(err))
|
|
230
|
+
throw err;
|
|
231
|
+
ops.copy(from, to);
|
|
232
|
+
ops.unlink(from);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
218
235
|
function readConfigFile() {
|
|
219
236
|
const path = getConfigPath();
|
|
220
237
|
if (!existsSync(path))
|
|
@@ -230,13 +247,13 @@ function readConfigFile() {
|
|
|
230
247
|
return {};
|
|
231
248
|
}
|
|
232
249
|
}
|
|
233
|
-
async function writeConfigFile(data) {
|
|
250
|
+
async function writeConfigFile(data, renameOps) {
|
|
234
251
|
await ensureConfigDir();
|
|
235
252
|
const path = getConfigPath();
|
|
236
253
|
const tmp = path + ".tmp";
|
|
237
254
|
writeFileSync(tmp, JSON.stringify(data, null, 2) + `
|
|
238
255
|
`, { mode: 384 });
|
|
239
|
-
|
|
256
|
+
renameWithCrossDeviceFallback(tmp, path, renameOps);
|
|
240
257
|
}
|
|
241
258
|
function loadConfig(flags) {
|
|
242
259
|
const file = readConfigFile();
|
|
@@ -357,6 +374,18 @@ async function ensureFreshToken(creds) {
|
|
|
357
374
|
return updated.access_token;
|
|
358
375
|
}
|
|
359
376
|
|
|
377
|
+
// src/auth/hints.ts
|
|
378
|
+
var NO_CREDENTIALS_REMEDIATION = [
|
|
379
|
+
"Log in: mmx auth login",
|
|
380
|
+
"Pass per-call: --api-key sk-xxxxx",
|
|
381
|
+
"Or set env var: MMX_CONFIG_DIR=/path/to/.mmx"
|
|
382
|
+
].join(`
|
|
383
|
+
`);
|
|
384
|
+
function buildNoCredentialsHint(configPath) {
|
|
385
|
+
return `Looked for credentials in: ${configPath ?? getConfigPath()}
|
|
386
|
+
${NO_CREDENTIALS_REMEDIATION}`;
|
|
387
|
+
}
|
|
388
|
+
|
|
360
389
|
// src/auth/resolver.ts
|
|
361
390
|
async function resolveCredential(config) {
|
|
362
391
|
if (config.apiKey) {
|
|
@@ -370,8 +399,7 @@ async function resolveCredential(config) {
|
|
|
370
399
|
if (config.fileApiKey) {
|
|
371
400
|
return { token: config.fileApiKey, method: "api-key", source: "config.json" };
|
|
372
401
|
}
|
|
373
|
-
throw new CLIError("No credentials found.", ExitCode.AUTH,
|
|
374
|
-
Pass directly: --api-key sk-xxxxx`);
|
|
402
|
+
throw new CLIError("No credentials found.", ExitCode.AUTH, buildNoCredentialsHint(config.configPath));
|
|
375
403
|
}
|
|
376
404
|
|
|
377
405
|
// src/errors/api.ts
|
|
@@ -468,9 +496,17 @@ function maybeShowStatusBar(config, token, model) {
|
|
|
468
496
|
// package.json
|
|
469
497
|
var package_default = {
|
|
470
498
|
name: "mmx-cli",
|
|
471
|
-
version: "1.0.
|
|
499
|
+
version: "1.0.18",
|
|
472
500
|
description: "CLI for the MiniMax AI Platform",
|
|
473
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
|
+
},
|
|
474
510
|
engines: {
|
|
475
511
|
node: ">=18"
|
|
476
512
|
},
|
|
@@ -717,11 +753,10 @@ function vlmEndpoint(baseUrl) {
|
|
|
717
753
|
return `${baseUrl}/v1/coding_plan/vlm`;
|
|
718
754
|
}
|
|
719
755
|
function quotaEndpoint(baseUrl) {
|
|
720
|
-
|
|
721
|
-
return `${host}/v1/api/openplatform/coding_plan/remains`;
|
|
756
|
+
return `${baseUrl}/v1/token_plan/remains`;
|
|
722
757
|
}
|
|
723
758
|
function fileUploadEndpoint(baseUrl) {
|
|
724
|
-
return `${baseUrl}/v1/files`;
|
|
759
|
+
return `${baseUrl}/v1/files/upload`;
|
|
725
760
|
}
|
|
726
761
|
function fileListEndpoint(baseUrl) {
|
|
727
762
|
return `${baseUrl}/v1/files/list`;
|
|
@@ -766,7 +801,7 @@ class TextSDK extends Client {
|
|
|
766
801
|
}
|
|
767
802
|
return {
|
|
768
803
|
...params,
|
|
769
|
-
model: params.model ?? "MiniMax-
|
|
804
|
+
model: params.model ?? "MiniMax-M3",
|
|
770
805
|
max_tokens: params.max_tokens ?? 4096
|
|
771
806
|
};
|
|
772
807
|
}
|
|
@@ -1071,7 +1106,7 @@ import { existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync as wr
|
|
|
1071
1106
|
import { join as join2, resolve as resolve2, dirname as dirname2 } from "node:path";
|
|
1072
1107
|
|
|
1073
1108
|
// src/files/download.ts
|
|
1074
|
-
import { createWriteStream, renameSync as renameSync2, unlinkSync } from "fs";
|
|
1109
|
+
import { createWriteStream, renameSync as renameSync2, unlinkSync as unlinkSync2 } from "fs";
|
|
1075
1110
|
|
|
1076
1111
|
// src/output/progress.ts
|
|
1077
1112
|
var SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
@@ -1194,7 +1229,7 @@ async function downloadFile(url, destPath, opts) {
|
|
|
1194
1229
|
} finally {
|
|
1195
1230
|
if (!completed) {
|
|
1196
1231
|
try {
|
|
1197
|
-
|
|
1232
|
+
unlinkSync2(tmpPath);
|
|
1198
1233
|
} catch {}
|
|
1199
1234
|
}
|
|
1200
1235
|
}
|
|
@@ -1401,10 +1436,81 @@ import { existsSync as existsSync4, mkdirSync as mkdirSync3, writeFileSync as wr
|
|
|
1401
1436
|
import { resolve as resolve3, dirname as dirname3 } from "node:path";
|
|
1402
1437
|
|
|
1403
1438
|
// src/commands/music/models.ts
|
|
1439
|
+
var MUSIC_GENERATE_MODELS = [
|
|
1440
|
+
"music-3.0",
|
|
1441
|
+
"music-2.6",
|
|
1442
|
+
"music-2.6-free",
|
|
1443
|
+
"music-2.5+",
|
|
1444
|
+
"music-2.5"
|
|
1445
|
+
];
|
|
1446
|
+
var MUSIC_COVER_MODELS = ["music-cover", "music-cover-free"];
|
|
1447
|
+
function includesModel(models, model) {
|
|
1448
|
+
return models.includes(model);
|
|
1449
|
+
}
|
|
1404
1450
|
function musicGenerateModel(config) {
|
|
1405
|
-
|
|
1451
|
+
if (config.defaultMusicModel && includesModel(MUSIC_GENERATE_MODELS, config.defaultMusicModel)) {
|
|
1452
|
+
return config.defaultMusicModel;
|
|
1453
|
+
}
|
|
1454
|
+
return "music-3.0";
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
// src/utils/audio-stream.ts
|
|
1458
|
+
function decodeHexAudio(hex) {
|
|
1459
|
+
if (!/^[0-9a-fA-F]+$/.test(hex)) {
|
|
1460
|
+
throw new CLIError("API returned invalid audio data (not valid hex).", ExitCode.GENERAL);
|
|
1461
|
+
}
|
|
1462
|
+
if (hex.length % 2 !== 0) {
|
|
1463
|
+
throw new CLIError("API returned truncated audio data (odd-length hex string).", ExitCode.GENERAL);
|
|
1464
|
+
}
|
|
1465
|
+
return Uint8Array.from(Buffer.from(hex, "hex"));
|
|
1466
|
+
}
|
|
1467
|
+
function throwIfApiError(response, payload) {
|
|
1468
|
+
const statusCode = payload.base_resp?.status_code;
|
|
1469
|
+
if (statusCode !== undefined && statusCode !== 0 || payload.error) {
|
|
1470
|
+
throw mapApiError(response.status, payload, response.url || undefined);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
function missingAudioError() {
|
|
1474
|
+
return new CLIError("API stream ended without audio data.", ExitCode.GENERAL);
|
|
1475
|
+
}
|
|
1476
|
+
async function* decodeAudioStream(response) {
|
|
1477
|
+
const contentType = response.headers.get("content-type") || "";
|
|
1478
|
+
if (!contentType.toLowerCase().includes("text/event-stream")) {
|
|
1479
|
+
let payload;
|
|
1480
|
+
try {
|
|
1481
|
+
payload = await response.json();
|
|
1482
|
+
} catch {
|
|
1483
|
+
throw new CLIError(`Expected SSE audio stream but got content-type "${contentType || "unknown"}".`, ExitCode.GENERAL);
|
|
1484
|
+
}
|
|
1485
|
+
throwIfApiError(response, payload);
|
|
1486
|
+
const hex = payload.data?.audio;
|
|
1487
|
+
if (!hex)
|
|
1488
|
+
throw missingAudioError();
|
|
1489
|
+
yield decodeHexAudio(hex);
|
|
1490
|
+
return;
|
|
1491
|
+
}
|
|
1492
|
+
let receivedAudio = false;
|
|
1493
|
+
for await (const event of parseSSE(response)) {
|
|
1494
|
+
if (!event.data || event.data === "[DONE]")
|
|
1495
|
+
break;
|
|
1496
|
+
let parsed;
|
|
1497
|
+
try {
|
|
1498
|
+
parsed = JSON.parse(event.data);
|
|
1499
|
+
} catch (error) {
|
|
1500
|
+
throw new CLIError(`Failed to parse audio stream chunk: ${error instanceof Error ? error.message : String(error)}`, ExitCode.GENERAL);
|
|
1501
|
+
}
|
|
1502
|
+
throwIfApiError(response, parsed);
|
|
1503
|
+
const hex = parsed.data?.audio;
|
|
1504
|
+
if (hex) {
|
|
1505
|
+
receivedAudio = true;
|
|
1506
|
+
yield decodeHexAudio(hex);
|
|
1507
|
+
}
|
|
1508
|
+
if (parsed.data?.status === 2)
|
|
1509
|
+
break;
|
|
1510
|
+
}
|
|
1511
|
+
if (!receivedAudio)
|
|
1512
|
+
throw missingAudioError();
|
|
1406
1513
|
}
|
|
1407
|
-
var VALID_COVER_MODELS = new Set(["music-cover"]);
|
|
1408
1514
|
|
|
1409
1515
|
// src/sdk/music/index.ts
|
|
1410
1516
|
function hexToBuffer2(hex) {
|
|
@@ -1429,20 +1535,10 @@ class MusicSDK extends Client {
|
|
|
1429
1535
|
body,
|
|
1430
1536
|
stream: true
|
|
1431
1537
|
});
|
|
1432
|
-
|
|
1433
|
-
if (!reader) {
|
|
1538
|
+
if (!res.body) {
|
|
1434
1539
|
throw new SDKError("No response body", ExitCode.GENERAL);
|
|
1435
1540
|
}
|
|
1436
|
-
|
|
1437
|
-
while (true) {
|
|
1438
|
-
const { done, value } = await reader.read();
|
|
1439
|
-
if (done)
|
|
1440
|
-
break;
|
|
1441
|
-
yield value;
|
|
1442
|
-
}
|
|
1443
|
-
} finally {
|
|
1444
|
-
reader.releaseLock();
|
|
1445
|
-
}
|
|
1541
|
+
yield* decodeAudioStream(res);
|
|
1446
1542
|
}
|
|
1447
1543
|
async generate(request2) {
|
|
1448
1544
|
const body = this.validateParams(request2);
|
|
@@ -1493,18 +1589,17 @@ class MusicSDK extends Client {
|
|
|
1493
1589
|
structuredParts.push(`Key: ${request2.key}`);
|
|
1494
1590
|
if (request2.avoid)
|
|
1495
1591
|
structuredParts.push(`Avoid: ${request2.avoid}`);
|
|
1496
|
-
|
|
1497
|
-
|
|
1592
|
+
const useCase = request2.useCase || request2.use_case;
|
|
1593
|
+
if (useCase)
|
|
1594
|
+
structuredParts.push(`Use case: ${useCase}`);
|
|
1498
1595
|
if (request2.structure)
|
|
1499
1596
|
structuredParts.push(`Structure: ${request2.structure}`);
|
|
1500
1597
|
if (request2.references)
|
|
1501
1598
|
structuredParts.push(`References: ${request2.references}`);
|
|
1502
1599
|
if (request2.extra)
|
|
1503
1600
|
structuredParts.push(`Extra: ${request2.extra}`);
|
|
1504
|
-
let lyrics = request2.lyrics;
|
|
1505
1601
|
let prompt = request2.prompt;
|
|
1506
|
-
if (request2.
|
|
1507
|
-
lyrics = "[intro] [outro]";
|
|
1602
|
+
if (request2.is_instrumental || request2.instrumental) {
|
|
1508
1603
|
structuredParts.push("Style: instrumental, no vocals, pure music");
|
|
1509
1604
|
}
|
|
1510
1605
|
if (structuredParts.length > 0) {
|
|
@@ -1514,6 +1609,33 @@ class MusicSDK extends Client {
|
|
|
1514
1609
|
return prompt;
|
|
1515
1610
|
}
|
|
1516
1611
|
validateParams(params) {
|
|
1612
|
+
const instrumental = params.instrumental;
|
|
1613
|
+
const apiParams = { ...params };
|
|
1614
|
+
const sdkOnlyFields = [
|
|
1615
|
+
"instrumental",
|
|
1616
|
+
"vocals",
|
|
1617
|
+
"genre",
|
|
1618
|
+
"mood",
|
|
1619
|
+
"instruments",
|
|
1620
|
+
"tempo",
|
|
1621
|
+
"bpm",
|
|
1622
|
+
"key",
|
|
1623
|
+
"avoid",
|
|
1624
|
+
"use_case",
|
|
1625
|
+
"useCase",
|
|
1626
|
+
"structure",
|
|
1627
|
+
"references",
|
|
1628
|
+
"extra"
|
|
1629
|
+
];
|
|
1630
|
+
for (const field of sdkOnlyFields)
|
|
1631
|
+
delete apiParams[field];
|
|
1632
|
+
if (instrumental !== undefined && params.is_instrumental !== undefined && instrumental !== params.is_instrumental) {
|
|
1633
|
+
throw new SDKError("instrumental and is_instrumental must not conflict", ExitCode.USAGE);
|
|
1634
|
+
}
|
|
1635
|
+
const normalized = {
|
|
1636
|
+
...apiParams,
|
|
1637
|
+
is_instrumental: params.is_instrumental ?? instrumental
|
|
1638
|
+
};
|
|
1517
1639
|
const {
|
|
1518
1640
|
model,
|
|
1519
1641
|
output_format,
|
|
@@ -1522,22 +1644,15 @@ class MusicSDK extends Client {
|
|
|
1522
1644
|
lyrics,
|
|
1523
1645
|
is_instrumental,
|
|
1524
1646
|
lyrics_optimizer
|
|
1525
|
-
} =
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
if (
|
|
1530
|
-
throw new SDKError(
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
}
|
|
1535
|
-
if (!is_instrumental && !lyrics_optimizer && !lyrics?.trim()) {
|
|
1536
|
-
throw new SDKError("lyrics is required", ExitCode.USAGE);
|
|
1537
|
-
}
|
|
1538
|
-
const VALID_MODELS = ["music-2.6", "music-2.5+", "music-2.5"];
|
|
1539
|
-
if (model && !VALID_MODELS.includes(model)) {
|
|
1540
|
-
throw new SDKError(`Invalid model: ${model}. Valid models are ${VALID_MODELS.join(", ")}.`, ExitCode.USAGE);
|
|
1647
|
+
} = normalized;
|
|
1648
|
+
const effectiveModel = model ?? musicGenerateModel(this.config);
|
|
1649
|
+
const isGenerateModel = MUSIC_GENERATE_MODELS.includes(effectiveModel);
|
|
1650
|
+
const isCoverModel = MUSIC_COVER_MODELS.includes(effectiveModel);
|
|
1651
|
+
if (!isGenerateModel && !isCoverModel) {
|
|
1652
|
+
throw new SDKError(`Invalid model: ${effectiveModel}. Valid models are ${[
|
|
1653
|
+
...MUSIC_GENERATE_MODELS,
|
|
1654
|
+
...MUSIC_COVER_MODELS
|
|
1655
|
+
].join(", ")}.`, ExitCode.USAGE);
|
|
1541
1656
|
}
|
|
1542
1657
|
const VALID_OUTPUT_FORMATS = ["hex", "url"];
|
|
1543
1658
|
if (output_format && !VALID_OUTPUT_FORMATS.includes(output_format)) {
|
|
@@ -1546,9 +1661,78 @@ class MusicSDK extends Client {
|
|
|
1546
1661
|
if (stream && output_format === "url") {
|
|
1547
1662
|
throw new SDKError(`stream and output_format url cannot be used together. Streaming requires hex format.`, ExitCode.USAGE);
|
|
1548
1663
|
}
|
|
1549
|
-
|
|
1664
|
+
let targetPrompt = this.buildPrompt({
|
|
1665
|
+
...params,
|
|
1666
|
+
is_instrumental
|
|
1667
|
+
});
|
|
1668
|
+
if (isCoverModel) {
|
|
1669
|
+
if (is_instrumental) {
|
|
1670
|
+
throw new SDKError("is_instrumental is only supported by music generation models", ExitCode.USAGE);
|
|
1671
|
+
}
|
|
1672
|
+
if (lyrics_optimizer) {
|
|
1673
|
+
throw new SDKError("lyrics_optimizer is only supported by music generation models", ExitCode.USAGE);
|
|
1674
|
+
}
|
|
1675
|
+
delete normalized.is_instrumental;
|
|
1676
|
+
delete normalized.lyrics_optimizer;
|
|
1677
|
+
targetPrompt = targetPrompt?.trim();
|
|
1678
|
+
const coverPromptLength = targetPrompt?.length ?? 0;
|
|
1679
|
+
if (coverPromptLength < 10 || coverPromptLength > 300) {
|
|
1680
|
+
throw new SDKError("prompt must be between 10 and 300 characters for music cover models", ExitCode.USAGE);
|
|
1681
|
+
}
|
|
1682
|
+
const hasAudioUrl = Boolean(normalized.audio_url?.trim());
|
|
1683
|
+
const hasAudioBase64 = Boolean(normalized.audio_base64?.trim());
|
|
1684
|
+
const hasCoverFeatureId = Boolean(normalized.cover_feature_id?.trim());
|
|
1685
|
+
const sourceCount = [hasAudioUrl, hasAudioBase64, hasCoverFeatureId].filter(Boolean).length;
|
|
1686
|
+
if (sourceCount !== 1) {
|
|
1687
|
+
throw new SDKError("Exactly one of audio_url, audio_base64, or cover_feature_id is required for music cover models", ExitCode.USAGE);
|
|
1688
|
+
}
|
|
1689
|
+
if (hasAudioUrl)
|
|
1690
|
+
normalized.audio_url = normalized.audio_url?.trim();
|
|
1691
|
+
else
|
|
1692
|
+
delete normalized.audio_url;
|
|
1693
|
+
if (hasAudioBase64)
|
|
1694
|
+
normalized.audio_base64 = normalized.audio_base64?.trim();
|
|
1695
|
+
else
|
|
1696
|
+
delete normalized.audio_base64;
|
|
1697
|
+
if (hasCoverFeatureId) {
|
|
1698
|
+
normalized.cover_feature_id = normalized.cover_feature_id?.trim();
|
|
1699
|
+
} else {
|
|
1700
|
+
delete normalized.cover_feature_id;
|
|
1701
|
+
}
|
|
1702
|
+
const coverLyrics = lyrics?.trim();
|
|
1703
|
+
const lyricsLength = coverLyrics?.length ?? 0;
|
|
1704
|
+
if (hasCoverFeatureId && lyricsLength === 0) {
|
|
1705
|
+
throw new SDKError("lyrics is required with cover_feature_id", ExitCode.USAGE);
|
|
1706
|
+
}
|
|
1707
|
+
if (coverLyrics)
|
|
1708
|
+
normalized.lyrics = coverLyrics;
|
|
1709
|
+
else
|
|
1710
|
+
delete normalized.lyrics;
|
|
1711
|
+
if (lyricsLength > 0 && (lyricsLength < 10 || lyricsLength > 1000)) {
|
|
1712
|
+
throw new SDKError("lyrics must be between 10 and 1000 characters for music cover models", ExitCode.USAGE);
|
|
1713
|
+
}
|
|
1714
|
+
} else {
|
|
1715
|
+
if (normalized.audio_url || normalized.audio_base64 || normalized.cover_feature_id) {
|
|
1716
|
+
throw new SDKError("audio_url, audio_base64, and cover_feature_id are only supported by music cover models", ExitCode.USAGE);
|
|
1717
|
+
}
|
|
1718
|
+
if (is_instrumental && lyrics) {
|
|
1719
|
+
throw new SDKError("Cannot use is_instrumental with lyrics", ExitCode.USAGE);
|
|
1720
|
+
}
|
|
1721
|
+
if (lyrics_optimizer && (lyrics || is_instrumental)) {
|
|
1722
|
+
throw new SDKError("Cannot use lyrics_optimizer with lyrics or is_instrumental", ExitCode.USAGE);
|
|
1723
|
+
}
|
|
1724
|
+
if (!prompt && !lyrics && !is_instrumental && !lyrics_optimizer) {
|
|
1725
|
+
throw new SDKError("At least one of prompt or lyrics or is_instrumental or lyrics_optimizer is required", ExitCode.USAGE);
|
|
1726
|
+
}
|
|
1727
|
+
if ((is_instrumental || lyrics_optimizer) && !prompt?.trim()) {
|
|
1728
|
+
throw new SDKError("prompt is required with is_instrumental or lyrics_optimizer", ExitCode.USAGE);
|
|
1729
|
+
}
|
|
1730
|
+
if (!is_instrumental && !lyrics_optimizer && !lyrics?.trim()) {
|
|
1731
|
+
throw new SDKError("lyrics is required", ExitCode.USAGE);
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1550
1734
|
return toMerged({
|
|
1551
|
-
model:
|
|
1735
|
+
model: effectiveModel,
|
|
1552
1736
|
audio_setting: {
|
|
1553
1737
|
format: "mp3",
|
|
1554
1738
|
sample_rate: 44100,
|
|
@@ -1556,7 +1740,7 @@ class MusicSDK extends Client {
|
|
|
1556
1740
|
},
|
|
1557
1741
|
output_format: "hex"
|
|
1558
1742
|
}, {
|
|
1559
|
-
...
|
|
1743
|
+
...normalized,
|
|
1560
1744
|
prompt: targetPrompt
|
|
1561
1745
|
});
|
|
1562
1746
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mmx-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
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
|
},
|