@artillect/cli 0.1.3 → 0.1.5
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 +43 -11
- package/dist/index.js +930 -94
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,9 +9,6 @@ import { homedir } from "node:os";
|
|
|
9
9
|
import { dirname, join } from "node:path";
|
|
10
10
|
|
|
11
11
|
// ../artillect-sdk/dist/uploadMime.js
|
|
12
|
-
import { basename, isAbsolute, resolve } from "node:path";
|
|
13
|
-
import { access, readFile } from "node:fs/promises";
|
|
14
|
-
import { constants as fsConstants } from "node:fs";
|
|
15
12
|
function mimeFromFilename(filename) {
|
|
16
13
|
const ext = String(filename || "").split(".").pop()?.toLowerCase();
|
|
17
14
|
switch (ext) {
|
|
@@ -86,46 +83,6 @@ function resolveUploadContentType(opts) {
|
|
|
86
83
|
return { contentType: fromMagic, source: "magic" };
|
|
87
84
|
return { contentType: declared || "application/octet-stream", source: "unknown" };
|
|
88
85
|
}
|
|
89
|
-
async function resolveLocalUploadPath(filePath) {
|
|
90
|
-
const raw = String(filePath || "").trim();
|
|
91
|
-
if (!raw)
|
|
92
|
-
throw new Error("file_path is empty");
|
|
93
|
-
const tried = [];
|
|
94
|
-
const candidates = [];
|
|
95
|
-
if (isAbsolute(raw)) {
|
|
96
|
-
candidates.push(raw);
|
|
97
|
-
} else {
|
|
98
|
-
candidates.push(resolve(process.cwd(), raw));
|
|
99
|
-
const uploadCwd = String(process.env.ARTILLECT_UPLOAD_CWD || "").trim();
|
|
100
|
-
if (uploadCwd)
|
|
101
|
-
candidates.push(resolve(uploadCwd, raw));
|
|
102
|
-
const workspace = String(process.env.CURSOR_WORKSPACE || process.env.PWD || "").trim();
|
|
103
|
-
if (workspace)
|
|
104
|
-
candidates.push(resolve(workspace, raw));
|
|
105
|
-
}
|
|
106
|
-
for (const p of candidates) {
|
|
107
|
-
if (tried.includes(p))
|
|
108
|
-
continue;
|
|
109
|
-
tried.push(p);
|
|
110
|
-
try {
|
|
111
|
-
await access(p, fsConstants.R_OK);
|
|
112
|
-
return { path: p, tried };
|
|
113
|
-
} catch {
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
const err = new Error(`ENOENT: file not found. On stdio MCP pass an absolute path; on remote/hosted MCP use file_base64 + filename instead. Tried: ${tried.join(" | ")}`);
|
|
117
|
-
err.code = "ENOENT";
|
|
118
|
-
err.tried = tried;
|
|
119
|
-
throw err;
|
|
120
|
-
}
|
|
121
|
-
async function readLocalUploadFile(filePath) {
|
|
122
|
-
const { path: resolved } = await resolveLocalUploadPath(filePath);
|
|
123
|
-
const buf = await readFile(resolved);
|
|
124
|
-
const bytes = new Uint8Array(buf);
|
|
125
|
-
const filename = basename(resolved);
|
|
126
|
-
const { contentType } = resolveUploadContentType({ filename, bytes });
|
|
127
|
-
return { bytes, filename, contentType };
|
|
128
|
-
}
|
|
129
86
|
|
|
130
87
|
// ../artillect-sdk/dist/http.js
|
|
131
88
|
var JOB_SUFFIX_KIND = [
|
|
@@ -183,10 +140,19 @@ async function publicApiFetch(config, method, path, body, extraHeaders) {
|
|
|
183
140
|
};
|
|
184
141
|
if (config.clientSource)
|
|
185
142
|
headers["X-Artillect-Client-Source"] = config.clientSource;
|
|
143
|
+
let requestBody = body;
|
|
144
|
+
if (body && typeof body === "object" && !Array.isArray(body)) {
|
|
145
|
+
const record = body;
|
|
146
|
+
if (typeof record.idempotency_key === "string" && record.idempotency_key.trim()) {
|
|
147
|
+
headers["Idempotency-Key"] = record.idempotency_key.trim();
|
|
148
|
+
const { idempotency_key: _idempotencyKey, ...withoutIdempotency } = record;
|
|
149
|
+
requestBody = withoutIdempotency;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
186
152
|
let payload;
|
|
187
|
-
if (
|
|
153
|
+
if (requestBody !== void 0) {
|
|
188
154
|
headers["Content-Type"] = "application/json";
|
|
189
|
-
payload = JSON.stringify(
|
|
155
|
+
payload = JSON.stringify(requestBody);
|
|
190
156
|
}
|
|
191
157
|
Object.assign(headers, extraHeaders);
|
|
192
158
|
const res = await fetch(url, { method, headers, body: payload });
|
|
@@ -215,6 +181,13 @@ async function publicApiUploadFile(config, file) {
|
|
|
215
181
|
});
|
|
216
182
|
return parseApiResponse(res);
|
|
217
183
|
}
|
|
184
|
+
async function publicApiUploadFromUrl(config, opts) {
|
|
185
|
+
return publicApiFetch(config, "POST", "/api/v1/files/from-url", {
|
|
186
|
+
url: opts.url,
|
|
187
|
+
...opts.filename ? { filename: opts.filename } : {},
|
|
188
|
+
...opts.projectId != null ? { project_id: opts.projectId } : {}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
218
191
|
function listQueryPath(basePath, params) {
|
|
219
192
|
const search = new URLSearchParams();
|
|
220
193
|
if (params?.limit != null)
|
|
@@ -309,6 +282,7 @@ function createClient(opts) {
|
|
|
309
282
|
listModels: () => publicApiFetch(config, "GET", "/api/v1/models"),
|
|
310
283
|
estimate: (body) => publicApiFetch(config, "POST", "/api/v1/estimate", body),
|
|
311
284
|
uploadFile: (file) => publicApiUploadFile(config, file),
|
|
285
|
+
uploadFromUrl: (opts2) => publicApiUploadFromUrl(config, opts2),
|
|
312
286
|
generateImage: (body) => publicApiFetch(config, "POST", "/api/v1/images/generations", body),
|
|
313
287
|
getImageGeneration: (id) => publicApiFetch(config, "GET", `/api/v1/images/generations/${encodeURIComponent(id)}`),
|
|
314
288
|
listImageGenerations: (params) => publicApiFetch(config, "GET", listQueryPath("/api/v1/images/generations", params)),
|
|
@@ -329,6 +303,10 @@ function createClient(opts) {
|
|
|
329
303
|
getMeshGeneration: (id) => publicApiFetch(config, "GET", `/api/v1/mesh/generations/${encodeURIComponent(id)}`),
|
|
330
304
|
listMeshGenerations: (params) => publicApiFetch(config, "GET", listQueryPath("/api/v1/mesh/generations", params)),
|
|
331
305
|
cancelMeshGeneration: (id) => publicApiFetch(config, "POST", `/api/v1/mesh/generations/${encodeURIComponent(id)}/cancel`),
|
|
306
|
+
generateAudio: (body) => publicApiFetch(config, "POST", "/api/v1/audio/generations", body),
|
|
307
|
+
getAudioGeneration: (id) => publicApiFetch(config, "GET", `/api/v1/audio/generations/${encodeURIComponent(id)}`),
|
|
308
|
+
listAudioGenerations: (params) => publicApiFetch(config, "GET", listQueryPath("/api/v1/audio/generations", params)),
|
|
309
|
+
cancelAudioGeneration: (id) => publicApiFetch(config, "POST", `/api/v1/audio/generations/${encodeURIComponent(id)}/cancel`),
|
|
332
310
|
chatCompletion: (body) => publicApiFetch(config, "POST", "/api/v1/chat/completions", body),
|
|
333
311
|
getTask: (id, kind) => publicApiFetch(config, "GET", resolvePollPath(id, kind)),
|
|
334
312
|
getWebhook: () => publicApiFetch(config, "GET", "/api/v1/webhooks"),
|
|
@@ -346,6 +324,51 @@ function createClient(opts) {
|
|
|
346
324
|
};
|
|
347
325
|
}
|
|
348
326
|
|
|
327
|
+
// ../artillect-sdk/dist/localUpload.js
|
|
328
|
+
import { basename, isAbsolute, resolve } from "node:path";
|
|
329
|
+
import { access, readFile } from "node:fs/promises";
|
|
330
|
+
import { constants as fsConstants } from "node:fs";
|
|
331
|
+
async function resolveLocalUploadPath(filePath) {
|
|
332
|
+
const raw = String(filePath || "").trim();
|
|
333
|
+
if (!raw)
|
|
334
|
+
throw new Error("file_path is empty");
|
|
335
|
+
const tried = [];
|
|
336
|
+
const candidates = [];
|
|
337
|
+
if (isAbsolute(raw)) {
|
|
338
|
+
candidates.push(raw);
|
|
339
|
+
} else {
|
|
340
|
+
candidates.push(resolve(process.cwd(), raw));
|
|
341
|
+
const uploadCwd = String(process.env.ARTILLECT_UPLOAD_CWD || "").trim();
|
|
342
|
+
if (uploadCwd)
|
|
343
|
+
candidates.push(resolve(uploadCwd, raw));
|
|
344
|
+
const workspace = String(process.env.CURSOR_WORKSPACE || process.env.PWD || "").trim();
|
|
345
|
+
if (workspace)
|
|
346
|
+
candidates.push(resolve(workspace, raw));
|
|
347
|
+
}
|
|
348
|
+
for (const p of candidates) {
|
|
349
|
+
if (tried.includes(p))
|
|
350
|
+
continue;
|
|
351
|
+
tried.push(p);
|
|
352
|
+
try {
|
|
353
|
+
await access(p, fsConstants.R_OK);
|
|
354
|
+
return { path: p, tried };
|
|
355
|
+
} catch {
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const err = new Error(`ENOENT: file not found. On stdio MCP pass an absolute path; on remote/hosted MCP use file_base64 + filename instead. Tried: ${tried.join(" | ")}`);
|
|
359
|
+
err.code = "ENOENT";
|
|
360
|
+
err.tried = tried;
|
|
361
|
+
throw err;
|
|
362
|
+
}
|
|
363
|
+
async function readLocalUploadFile(filePath) {
|
|
364
|
+
const { path: resolved } = await resolveLocalUploadPath(filePath);
|
|
365
|
+
const buf = await readFile(resolved);
|
|
366
|
+
const bytes = new Uint8Array(buf);
|
|
367
|
+
const filename = basename(resolved);
|
|
368
|
+
const { contentType } = resolveUploadContentType({ filename, bytes });
|
|
369
|
+
return { bytes, filename, contentType };
|
|
370
|
+
}
|
|
371
|
+
|
|
349
372
|
// src/config.ts
|
|
350
373
|
var DEFAULT_BASE = "https://app.artillect.pro";
|
|
351
374
|
function configPath() {
|
|
@@ -451,6 +474,22 @@ import { pipeline } from "node:stream/promises";
|
|
|
451
474
|
function asRecord(value) {
|
|
452
475
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
453
476
|
}
|
|
477
|
+
function modelLimits(m) {
|
|
478
|
+
const lines = [];
|
|
479
|
+
if (m.max_prompt_chars != null) lines.push(`prompt \u2264 ${m.max_prompt_chars} \u0441\u0438\u043C\u0432.`);
|
|
480
|
+
if (m.context_length_tokens != null) {
|
|
481
|
+
lines.push(`\u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442 OpenRouter: ${m.context_length_tokens} \u0442\u043E\u043A\u0435\u043D\u043E\u0432`);
|
|
482
|
+
}
|
|
483
|
+
if (m.provider_context_length_tokens != null) {
|
|
484
|
+
lines.push(`\u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442 \u043C\u0430\u0440\u0448\u0440\u0443\u0442\u0430: ${m.provider_context_length_tokens} \u0442\u043E\u043A\u0435\u043D\u043E\u0432`);
|
|
485
|
+
}
|
|
486
|
+
if (m.provider_max_output_tokens != null) {
|
|
487
|
+
lines.push(`\u0432\u044B\u0445\u043E\u0434 \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u2264 ${m.provider_max_output_tokens} \u0442\u043E\u043A\u0435\u043D\u043E\u0432`);
|
|
488
|
+
}
|
|
489
|
+
if (m.max_input_chars != null) lines.push(`\u0432\u0445\u043E\u0434 API \u2264 ${m.max_input_chars} \u0441\u0438\u043C\u0432.`);
|
|
490
|
+
if (m.max_output_tokens != null) lines.push(`\u0432\u044B\u0445\u043E\u0434 API \u2264 ${m.max_output_tokens} \u0442\u043E\u043A\u0435\u043D\u043E\u0432`);
|
|
491
|
+
return lines;
|
|
492
|
+
}
|
|
454
493
|
function formatModelsList(body, kind) {
|
|
455
494
|
const groups = [
|
|
456
495
|
["images", "\u041A\u0430\u0440\u0442\u0438\u043D\u043A\u0438"],
|
|
@@ -472,7 +511,8 @@ function formatModelsList(body, kind) {
|
|
|
472
511
|
const m = asRecord(raw);
|
|
473
512
|
const slug = String(m.slug || "");
|
|
474
513
|
const name = String(m.display_name || slug);
|
|
475
|
-
|
|
514
|
+
const limits = modelLimits(m);
|
|
515
|
+
lines.push(` ${slug.padEnd(24)} ${name}${limits.length ? ` \u2014 ${limits.join("; ")}` : ""}`);
|
|
476
516
|
}
|
|
477
517
|
lines.push("");
|
|
478
518
|
}
|
|
@@ -602,10 +642,14 @@ async function resolveInputRef(client, ref, opts) {
|
|
|
602
642
|
function mediaUrls(body) {
|
|
603
643
|
const images = Array.isArray(body.images) ? body.images : [];
|
|
604
644
|
const videos = Array.isArray(body.videos) ? body.videos : [];
|
|
605
|
-
const
|
|
645
|
+
const audios = Array.isArray(body.audio_urls) ? body.audio_urls : [];
|
|
646
|
+
const meshes = Array.isArray(body.mesh) ? body.mesh : [];
|
|
647
|
+
const fromSlots = [...images, ...videos, ...audios, ...meshes].map(
|
|
648
|
+
(item) => item && typeof item === "object" ? String(asRecord(item).url || asRecord(item).audio_url || asRecord(item).glb_url || "") : typeof item === "string" ? item : ""
|
|
649
|
+
).filter(Boolean);
|
|
606
650
|
if (fromSlots.length) return fromSlots;
|
|
607
|
-
const
|
|
608
|
-
return
|
|
651
|
+
const media2 = Array.isArray(body.media_urls) ? body.media_urls : [];
|
|
652
|
+
return [...media2, body.audio_url, body.mesh_url].map((u) => String(u || "")).filter(Boolean);
|
|
609
653
|
}
|
|
610
654
|
function terminalStatus(body) {
|
|
611
655
|
const status = String(body.status || "").toLowerCase();
|
|
@@ -781,7 +825,127 @@ async function authStatus() {
|
|
|
781
825
|
}
|
|
782
826
|
}
|
|
783
827
|
|
|
828
|
+
// src/generateBody.ts
|
|
829
|
+
function omitEmpty(obj) {
|
|
830
|
+
const out = {};
|
|
831
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
832
|
+
if (value === void 0) continue;
|
|
833
|
+
if (Array.isArray(value) && value.length === 0) continue;
|
|
834
|
+
if (typeof value === "string" && !value.trim()) continue;
|
|
835
|
+
out[key] = value;
|
|
836
|
+
}
|
|
837
|
+
return out;
|
|
838
|
+
}
|
|
839
|
+
function parseExtra(raw) {
|
|
840
|
+
if (!raw) return {};
|
|
841
|
+
if (typeof raw === "object" && !Array.isArray(raw)) return raw;
|
|
842
|
+
if (typeof raw !== "string") return {};
|
|
843
|
+
const trimmed = raw.trim();
|
|
844
|
+
if (!trimmed) return {};
|
|
845
|
+
const parsed = JSON.parse(trimmed);
|
|
846
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
847
|
+
throw new Error("--extra \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C JSON-\u043E\u0431\u044A\u0435\u043A\u0442\u043E\u043C");
|
|
848
|
+
}
|
|
849
|
+
return parsed;
|
|
850
|
+
}
|
|
851
|
+
function mergeExtra(body, extra, prompt) {
|
|
852
|
+
const merged = { ...body, ...extra };
|
|
853
|
+
const extraPrompt = typeof extra.prompt === "string" ? extra.prompt.trim() : "";
|
|
854
|
+
merged.prompt = extraPrompt || prompt;
|
|
855
|
+
return merged;
|
|
856
|
+
}
|
|
857
|
+
function buildImageGenerateBody(flags) {
|
|
858
|
+
const extra = parseExtra(flags.extra);
|
|
859
|
+
const prompt = flags.prompt ?? "";
|
|
860
|
+
const body = omitEmpty({
|
|
861
|
+
prompt,
|
|
862
|
+
...flags.model ? { model: flags.model } : {},
|
|
863
|
+
...flags.inputUrls?.length ? { input_urls: flags.inputUrls } : {},
|
|
864
|
+
...flags.projectId != null ? { project_id: flags.projectId } : {},
|
|
865
|
+
...flags.aspectRatio ? { aspect_ratio: flags.aspectRatio } : {},
|
|
866
|
+
...flags.resolution ? { resolution: flags.resolution } : {},
|
|
867
|
+
...flags.quality ? { quality: flags.quality } : {},
|
|
868
|
+
...flags.numImages != null ? { num_images: flags.numImages } : {},
|
|
869
|
+
...flags.outputFormat ? { output_format: flags.outputFormat } : {},
|
|
870
|
+
...flags.syncMode != null ? { sync_mode: flags.syncMode } : {},
|
|
871
|
+
...flags.billingSource ? { billing_source: flags.billingSource } : {},
|
|
872
|
+
...flags.tagIds?.length ? { tag_ids: flags.tagIds } : {},
|
|
873
|
+
...flags.elementNames?.length ? { element_names: flags.elementNames } : {}
|
|
874
|
+
});
|
|
875
|
+
return mergeExtra(body, extra, prompt);
|
|
876
|
+
}
|
|
877
|
+
function buildVideoGenerateBody(flags) {
|
|
878
|
+
const extra = parseExtra(flags.extra);
|
|
879
|
+
const body = omitEmpty({
|
|
880
|
+
model: flags.model,
|
|
881
|
+
prompt: flags.prompt,
|
|
882
|
+
...flags.projectId != null ? { project_id: flags.projectId } : {},
|
|
883
|
+
...flags.startImageUrl ? { start_image_url: flags.startImageUrl } : {},
|
|
884
|
+
...flags.endImageUrl ? { end_image_url: flags.endImageUrl } : {},
|
|
885
|
+
...flags.duration != null && flags.duration !== "" ? { duration: flags.duration } : {},
|
|
886
|
+
...flags.resolution ? { resolution: flags.resolution } : {},
|
|
887
|
+
...flags.aspectRatio ? { aspect_ratio: flags.aspectRatio } : {},
|
|
888
|
+
...flags.task ? { task: flags.task } : {},
|
|
889
|
+
...flags.seedanceMode ? { seedance_mode: flags.seedanceMode } : {},
|
|
890
|
+
...flags.referenceImages?.length ? { reference_images: flags.referenceImages } : {},
|
|
891
|
+
...flags.referenceVideos?.length ? { reference_videos: flags.referenceVideos } : {},
|
|
892
|
+
...flags.referenceAudios?.length ? { reference_audios: flags.referenceAudios } : {},
|
|
893
|
+
...flags.referenceFiles?.length ? { reference_file_urls: flags.referenceFiles } : {},
|
|
894
|
+
...flags.referenceLinks?.length ? { reference_link_urls: flags.referenceLinks } : {},
|
|
895
|
+
...flags.audio != null ? { audio: flags.audio } : {},
|
|
896
|
+
...flags.seed != null ? { seed: flags.seed } : {},
|
|
897
|
+
...flags.nsfwChecker != null ? { nsfw_checker: flags.nsfwChecker } : {},
|
|
898
|
+
...flags.promptExpansionMode ? { prompt_expansion_mode: flags.promptExpansionMode } : {},
|
|
899
|
+
...flags.enableSafetyChecker != null ? { enable_safety_checker: flags.enableSafetyChecker } : {},
|
|
900
|
+
...flags.syncMode != null ? { sync_mode: flags.syncMode } : {},
|
|
901
|
+
...flags.sourceVideoUrl ? { source_video_url: flags.sourceVideoUrl } : {},
|
|
902
|
+
...flags.audioUrl ? { audio_url: flags.audioUrl } : {},
|
|
903
|
+
...flags.motionVideoUrl ? { motion_video_url: flags.motionVideoUrl } : {},
|
|
904
|
+
...flags.elementNames?.length ? { element_names: flags.elementNames } : {},
|
|
905
|
+
...flags.klingMode ? { kling_mode: flags.klingMode } : {},
|
|
906
|
+
...flags.shotType ? { shot_type: flags.shotType } : {},
|
|
907
|
+
...flags.multiPrompt != null ? { multi_prompt: flags.multiPrompt } : {},
|
|
908
|
+
...flags.multiShots != null ? { multi_shots: flags.multiShots } : {},
|
|
909
|
+
...flags.keepAudio != null ? { keep_audio: flags.keepAudio } : {},
|
|
910
|
+
...flags.cfgScale != null ? { cfg_scale: flags.cfgScale } : {},
|
|
911
|
+
...flags.generateAudio != null ? { generate_audio: flags.generateAudio } : {},
|
|
912
|
+
...flags.billingSource ? { billing_source: flags.billingSource } : {},
|
|
913
|
+
...flags.tagIds?.length ? { tag_ids: flags.tagIds } : {}
|
|
914
|
+
});
|
|
915
|
+
return mergeExtra(body, extra, flags.prompt);
|
|
916
|
+
}
|
|
917
|
+
|
|
784
918
|
// src/generate.ts
|
|
919
|
+
function parseExtra2(raw) {
|
|
920
|
+
if (!raw?.trim()) return {};
|
|
921
|
+
const parsed = JSON.parse(raw);
|
|
922
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
923
|
+
throw new Error("--extra \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C JSON-\u043E\u0431\u044A\u0435\u043A\u0442\u043E\u043C");
|
|
924
|
+
}
|
|
925
|
+
return parsed;
|
|
926
|
+
}
|
|
927
|
+
function parseTagIds(raw) {
|
|
928
|
+
if (!raw?.trim()) return void 0;
|
|
929
|
+
const ids = raw.split(",").map((part) => Number(part.trim()));
|
|
930
|
+
if (ids.some((id) => !Number.isInteger(id) || id <= 0)) {
|
|
931
|
+
throw new Error("--tag-id \u0434\u043E\u043B\u0436\u0435\u043D \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u043F\u043E\u043B\u043E\u0436\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0446\u0435\u043B\u044B\u0435 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E");
|
|
932
|
+
}
|
|
933
|
+
return ids;
|
|
934
|
+
}
|
|
935
|
+
async function finishSubmitted(client, body, opts) {
|
|
936
|
+
const taskId = String(body.task_id || body.id || "");
|
|
937
|
+
if (!opts.wait) {
|
|
938
|
+
printOrJson(opts.json, body, [`\u041E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043E ${taskId || "(\u043D\u0435\u0442 task_id)"}`]);
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
if (!taskId) throw new Error("\u0441\u0435\u0440\u0432\u0435\u0440 \u043D\u0435 \u0432\u0435\u0440\u043D\u0443\u043B task_id");
|
|
942
|
+
await finishAndSave(client, taskId, {
|
|
943
|
+
json: opts.json,
|
|
944
|
+
out: opts.out,
|
|
945
|
+
open: opts.open,
|
|
946
|
+
timeoutMs: parseDurationMs(opts.waitTimeout, 20 * 60 * 1e3)
|
|
947
|
+
});
|
|
948
|
+
}
|
|
785
949
|
async function cmdBalance(jsonMode) {
|
|
786
950
|
const cfg = requireApiKey();
|
|
787
951
|
const client = createCliClient(cfg);
|
|
@@ -829,7 +993,12 @@ async function cmdModelsGet(slug, jsonMode) {
|
|
|
829
993
|
`${found.kind}: ${String(m.slug || slug)}`,
|
|
830
994
|
m.display_name ? String(m.display_name) : "",
|
|
831
995
|
Array.isArray(m.tasks) ? `\u0437\u0430\u0434\u0430\u0447\u0438: ${m.tasks.join(", ")}` : "",
|
|
832
|
-
m.max_prompt_chars != null ? `\u043B\u0438\u043C\u0438\u0442 \u043F\u0440\u043E\u043C\u043F\u0442\u0430: ${m.max_prompt_chars}` : ""
|
|
996
|
+
m.max_prompt_chars != null ? `\u043B\u0438\u043C\u0438\u0442 \u043F\u0440\u043E\u043C\u043F\u0442\u0430: ${m.max_prompt_chars}` : "",
|
|
997
|
+
m.context_length_tokens != null ? `\u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442 OpenRouter: ${m.context_length_tokens} \u0442\u043E\u043A\u0435\u043D\u043E\u0432` : "",
|
|
998
|
+
m.provider_context_length_tokens != null ? `\u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442 \u043C\u0430\u0440\u0448\u0440\u0443\u0442\u0430: ${m.provider_context_length_tokens} \u0442\u043E\u043A\u0435\u043D\u043E\u0432` : "",
|
|
999
|
+
m.provider_max_output_tokens != null ? `\u0432\u044B\u0445\u043E\u0434 \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440\u0430: \u0434\u043E ${m.provider_max_output_tokens} \u0442\u043E\u043A\u0435\u043D\u043E\u0432` : "",
|
|
1000
|
+
m.max_input_chars != null ? `\u0432\u0445\u043E\u0434 API: \u0434\u043E ${m.max_input_chars} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432` : "",
|
|
1001
|
+
m.max_output_tokens != null ? `\u0432\u044B\u0445\u043E\u0434 API: \u0434\u043E ${m.max_output_tokens} \u0442\u043E\u043A\u0435\u043D\u043E\u0432` : ""
|
|
833
1002
|
].filter(Boolean);
|
|
834
1003
|
if (m.parameters && typeof m.parameters === "object") {
|
|
835
1004
|
lines.push("\u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B:");
|
|
@@ -841,11 +1010,23 @@ async function cmdUpload(opts) {
|
|
|
841
1010
|
const cfg = requireApiKey();
|
|
842
1011
|
const client = createCliClient(cfg);
|
|
843
1012
|
const projectId = opts.projectId ? parseProjectId(opts.projectId) : void 0;
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
1013
|
+
if (Boolean(opts.filePath) === Boolean(opts.url)) {
|
|
1014
|
+
throw new Error("\u0443\u043A\u0430\u0436\u0438\u0442\u0435 \u0440\u043E\u0432\u043D\u043E \u043E\u0434\u0438\u043D \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A: \u0444\u0430\u0439\u043B \u0438\u043B\u0438 --url");
|
|
1015
|
+
}
|
|
1016
|
+
const uploaded = opts.url ? await client.uploadFromUrl({
|
|
1017
|
+
url: opts.url,
|
|
1018
|
+
filename: opts.filename,
|
|
1019
|
+
...projectId != null ? { projectId } : {}
|
|
1020
|
+
}).then((res) => {
|
|
1021
|
+
if (!res.ok) fail(res);
|
|
1022
|
+
const body = asRecord(res.body);
|
|
1023
|
+
return {
|
|
1024
|
+
assetId: String(body.asset_id || ""),
|
|
1025
|
+
url: String(body.url || ""),
|
|
1026
|
+
kind: String(body.kind || "")
|
|
1027
|
+
};
|
|
1028
|
+
}) : await uploadLocal(client, opts.filePath, projectId != null ? { projectId } : void 0);
|
|
1029
|
+
if (!uploaded.url) throw new Error("\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u043D\u0435 \u0432\u0435\u0440\u043D\u0443\u043B\u0430 url");
|
|
849
1030
|
printOrJson(opts.json, { asset_id: uploaded.assetId, url: uploaded.url, kind: uploaded.kind }, [
|
|
850
1031
|
uploaded.assetId || "(\u043D\u0435\u0442 asset_id)",
|
|
851
1032
|
uploaded.url
|
|
@@ -874,12 +1055,24 @@ async function cmdGenerateImage(opts) {
|
|
|
874
1055
|
await resolveInputRef(client, ref, projectId != null ? { projectId } : void 0)
|
|
875
1056
|
);
|
|
876
1057
|
}
|
|
877
|
-
const
|
|
878
|
-
prompt: opts.prompt,
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
1058
|
+
const payload = buildImageGenerateBody({
|
|
1059
|
+
prompt: opts.prompt ?? "",
|
|
1060
|
+
model: opts.model,
|
|
1061
|
+
inputUrls,
|
|
1062
|
+
projectId,
|
|
1063
|
+
aspectRatio: opts.aspectRatio,
|
|
1064
|
+
resolution: opts.resolution,
|
|
1065
|
+
quality: opts.quality,
|
|
1066
|
+
numImages: opts.numImages == null ? void 0 : Number(opts.numImages),
|
|
1067
|
+
outputFormat: opts.outputFormat,
|
|
1068
|
+
syncMode: opts.syncMode,
|
|
1069
|
+
billingSource: opts.billingSource,
|
|
1070
|
+
tagIds: opts.tagIds,
|
|
1071
|
+
elementNames: opts.elementNames,
|
|
1072
|
+
extra: opts.extra
|
|
882
1073
|
});
|
|
1074
|
+
if (opts.idempotencyKey) payload.idempotency_key = opts.idempotencyKey;
|
|
1075
|
+
const res = await client.generateImage(payload);
|
|
883
1076
|
if (!res.ok) fail(res);
|
|
884
1077
|
const body = asRecord(res.body);
|
|
885
1078
|
const taskId = String(body.task_id || body.id || "");
|
|
@@ -899,23 +1092,165 @@ async function cmdGenerateVideo(opts) {
|
|
|
899
1092
|
const cfg = requireApiKey();
|
|
900
1093
|
const client = createCliClient(cfg);
|
|
901
1094
|
const projectId = opts.projectId ? parseProjectId(opts.projectId) : void 0;
|
|
902
|
-
const
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
client,
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
1095
|
+
const resolveOpts = projectId != null ? { projectId } : void 0;
|
|
1096
|
+
const resolveAll = async (refs) => {
|
|
1097
|
+
const out = [];
|
|
1098
|
+
for (const ref of refs ?? []) {
|
|
1099
|
+
out.push(await resolveInputRef(client, ref, resolveOpts));
|
|
1100
|
+
}
|
|
1101
|
+
return out;
|
|
1102
|
+
};
|
|
1103
|
+
const durationRaw = opts.duration?.trim();
|
|
1104
|
+
const durationNum = durationRaw != null && durationRaw !== "" ? Number(durationRaw) : NaN;
|
|
1105
|
+
const documentRefs = opts.refFile ? [opts.refFile.trim()] : [];
|
|
1106
|
+
if (documentRefs.some((ref) => !/^https?:\/\//i.test(ref))) {
|
|
1107
|
+
throw new Error("--ref-file \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442 \u043F\u0443\u0431\u043B\u0438\u0447\u043D\u044B\u0439 http(s) URL \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430");
|
|
910
1108
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
)
|
|
1109
|
+
const payload = buildVideoGenerateBody({
|
|
1110
|
+
model: opts.model,
|
|
1111
|
+
prompt: opts.prompt,
|
|
1112
|
+
projectId,
|
|
1113
|
+
startImageUrl: opts.startImage ? await resolveInputRef(client, opts.startImage, resolveOpts) : void 0,
|
|
1114
|
+
endImageUrl: opts.endImage ? await resolveInputRef(client, opts.endImage, resolveOpts) : void 0,
|
|
1115
|
+
sourceVideoUrl: opts.sourceVideoUrl ? await resolveInputRef(client, opts.sourceVideoUrl, resolveOpts) : void 0,
|
|
1116
|
+
audioUrl: opts.audioUrl ? await resolveInputRef(client, opts.audioUrl, resolveOpts) : void 0,
|
|
1117
|
+
motionVideoUrl: opts.motionVideoUrl ? await resolveInputRef(client, opts.motionVideoUrl, resolveOpts) : void 0,
|
|
1118
|
+
duration: durationRaw ? Number.isFinite(durationNum) ? durationNum : durationRaw : void 0,
|
|
1119
|
+
resolution: opts.resolution,
|
|
1120
|
+
aspectRatio: opts.aspectRatio,
|
|
1121
|
+
task: opts.task,
|
|
1122
|
+
seedanceMode: opts.seedanceMode,
|
|
1123
|
+
referenceImages: await resolveAll(opts.refImage),
|
|
1124
|
+
referenceVideos: await resolveAll(opts.refVideo),
|
|
1125
|
+
referenceAudios: await resolveAll(opts.refAudio),
|
|
1126
|
+
referenceFiles: documentRefs,
|
|
1127
|
+
referenceLinks: opts.refLink ?? [],
|
|
1128
|
+
audio: opts.audio,
|
|
1129
|
+
seed: opts.seed != null && opts.seed !== "" ? Number(opts.seed) : void 0,
|
|
1130
|
+
nsfwChecker: opts.nsfwChecker,
|
|
1131
|
+
promptExpansionMode: opts.promptExpansionMode,
|
|
1132
|
+
enableSafetyChecker: opts.enableSafetyChecker,
|
|
1133
|
+
syncMode: opts.syncMode,
|
|
1134
|
+
elementNames: opts.elementNames,
|
|
1135
|
+
klingMode: opts.klingMode,
|
|
1136
|
+
shotType: opts.shotType,
|
|
1137
|
+
multiPrompt: opts.multiPrompt ? JSON.parse(opts.multiPrompt) : void 0,
|
|
1138
|
+
multiShots: opts.multiShots == null ? void 0 : Number(opts.multiShots),
|
|
1139
|
+
keepAudio: opts.keepAudio,
|
|
1140
|
+
cfgScale: opts.cfgScale == null ? void 0 : Number(opts.cfgScale),
|
|
1141
|
+
generateAudio: opts.generateAudio,
|
|
1142
|
+
billingSource: opts.billingSource,
|
|
1143
|
+
tagIds: opts.tagIds,
|
|
1144
|
+
extra: opts.extra
|
|
1145
|
+
});
|
|
1146
|
+
if (opts.idempotencyKey) payload.idempotency_key = opts.idempotencyKey;
|
|
1147
|
+
const res = await client.generateVideo(payload);
|
|
1148
|
+
if (!res.ok) fail(res);
|
|
1149
|
+
const submitted = asRecord(res.body);
|
|
1150
|
+
const taskId = String(submitted.task_id || submitted.id || "");
|
|
1151
|
+
if (!opts.wait) {
|
|
1152
|
+
printOrJson(opts.json, submitted, [`\u041E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043E ${taskId || "(\u043D\u0435\u0442 task_id)"}`]);
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
if (!taskId) throw new Error("\u0441\u0435\u0440\u0432\u0435\u0440 \u043D\u0435 \u0432\u0435\u0440\u043D\u0443\u043B task_id");
|
|
1156
|
+
await finishAndSave(client, taskId, {
|
|
1157
|
+
json: opts.json,
|
|
1158
|
+
out: opts.out,
|
|
1159
|
+
open: opts.open,
|
|
1160
|
+
timeoutMs: parseDurationMs(opts.waitTimeout, 20 * 60 * 1e3)
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
async function cmdGenerateMesh(opts) {
|
|
1164
|
+
const cfg = requireApiKey();
|
|
1165
|
+
const client = createCliClient(cfg);
|
|
1166
|
+
const projectId = opts.projectId ? parseProjectId(opts.projectId) : void 0;
|
|
1167
|
+
const resolveOpts = projectId != null ? { projectId } : void 0;
|
|
1168
|
+
const images = [];
|
|
1169
|
+
for (const ref of opts.image ?? []) images.push(await resolveInputRef(client, ref, resolveOpts));
|
|
1170
|
+
const bool = (value) => value == null ? void 0 : value !== "false";
|
|
1171
|
+
const body = {
|
|
1172
|
+
kind: "threed",
|
|
1173
|
+
model: opts.model,
|
|
1174
|
+
task: opts.task,
|
|
1175
|
+
prompt: opts.prompt,
|
|
1176
|
+
project_id: projectId,
|
|
1177
|
+
...images.length > 1 || opts.task === "multi-i2m" || opts.model === "meshy-v7-multi-i2m" ? { image_urls: images } : images[0] ? { image_url: images[0] } : {},
|
|
1178
|
+
mode: opts.mode,
|
|
1179
|
+
model_type: opts.modelType,
|
|
1180
|
+
topology: opts.topology,
|
|
1181
|
+
target_polycount: opts.targetPolycount == null ? void 0 : Number(opts.targetPolycount),
|
|
1182
|
+
symmetry_mode: opts.symmetryMode,
|
|
1183
|
+
should_remesh: bool(opts.shouldRemesh),
|
|
1184
|
+
should_texture: bool(opts.shouldTexture),
|
|
1185
|
+
enable_pbr: bool(opts.enablePbr),
|
|
1186
|
+
pose_mode: opts.poseMode,
|
|
1187
|
+
enable_prompt_expansion: bool(opts.enablePromptExpansion),
|
|
1188
|
+
texture_prompt: opts.texturePrompt,
|
|
1189
|
+
texture_image_url: opts.textureImage,
|
|
1190
|
+
seed: opts.seed == null ? void 0 : Number(opts.seed),
|
|
1191
|
+
enable_rigging: bool(opts.enableRigging),
|
|
1192
|
+
rigging_height_meters: opts.riggingHeight == null ? void 0 : Number(opts.riggingHeight),
|
|
1193
|
+
enable_animation: bool(opts.enableAnimation),
|
|
1194
|
+
animation_action_id: opts.animationActionId == null ? void 0 : Number(opts.animationActionId),
|
|
1195
|
+
enable_safety_checker: bool(opts.enableSafetyChecker),
|
|
1196
|
+
ultra_mode: bool(opts.ultraMode),
|
|
1197
|
+
billing_source: opts.billingSource,
|
|
1198
|
+
tag_ids: opts.tagIds
|
|
1199
|
+
};
|
|
1200
|
+
const extra = parseExtra2(opts.extra);
|
|
1201
|
+
if (opts.idempotencyKey) extra.idempotency_key = opts.idempotencyKey;
|
|
1202
|
+
const res = await client.generateMesh({ ...body, ...extra });
|
|
1203
|
+
if (!res.ok) fail(res);
|
|
1204
|
+
const submitted = asRecord(res.body);
|
|
1205
|
+
const taskId = String(submitted.task_id || submitted.id || "");
|
|
1206
|
+
if (!opts.wait) {
|
|
1207
|
+
printOrJson(opts.json, submitted, [`\u041E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043E ${taskId || "(\u043D\u0435\u0442 task_id)"}`]);
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
if (!taskId) throw new Error("\u0441\u0435\u0440\u0432\u0435\u0440 \u043D\u0435 \u0432\u0435\u0440\u043D\u0443\u043B task_id");
|
|
1211
|
+
await finishAndSave(client, taskId, {
|
|
1212
|
+
json: opts.json,
|
|
1213
|
+
out: opts.out,
|
|
1214
|
+
open: opts.open,
|
|
1215
|
+
timeoutMs: parseDurationMs(opts.waitTimeout, 20 * 60 * 1e3)
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
async function cmdGenerateUpscale(opts) {
|
|
1219
|
+
const cfg = requireApiKey();
|
|
1220
|
+
const client = createCliClient(cfg);
|
|
1221
|
+
const projectId = opts.projectId ? parseProjectId(opts.projectId) : void 0;
|
|
1222
|
+
if (Boolean(opts.image) === Boolean(opts.video)) {
|
|
1223
|
+
throw new Error("\u0443\u043A\u0430\u0436\u0438\u0442\u0435 \u0440\u043E\u0432\u043D\u043E \u043E\u0434\u0438\u043D \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A: --image \u0438\u043B\u0438 --video");
|
|
917
1224
|
}
|
|
918
|
-
const
|
|
1225
|
+
const source = opts.image || opts.video;
|
|
1226
|
+
const sourceUrl = await resolveInputRef(
|
|
1227
|
+
client,
|
|
1228
|
+
source,
|
|
1229
|
+
projectId != null ? { projectId } : void 0
|
|
1230
|
+
);
|
|
1231
|
+
const body = {
|
|
1232
|
+
kind: opts.image ? "image" : "video",
|
|
1233
|
+
model: opts.model,
|
|
1234
|
+
...opts.image ? { image_url: sourceUrl } : { video_url: sourceUrl },
|
|
1235
|
+
...opts.enhancementModel ? { enhancement_model: opts.enhancementModel } : {},
|
|
1236
|
+
...opts.upscaleFactor ? { upscale_factor: Number(opts.upscaleFactor) } : {},
|
|
1237
|
+
...opts.creativity ? { creativity: Number(opts.creativity) } : {},
|
|
1238
|
+
...opts.prompt ? { prompt: opts.prompt } : {},
|
|
1239
|
+
...opts.safetyTolerance ? { safety_tolerance: Number(opts.safetyTolerance) } : {},
|
|
1240
|
+
...opts.duration ? { duration: Number(opts.duration) } : {},
|
|
1241
|
+
...opts.width ? { width: Number(opts.width) } : {},
|
|
1242
|
+
...opts.height ? { height: Number(opts.height) } : {},
|
|
1243
|
+
...opts.outputFormat ? { output_format: opts.outputFormat } : {},
|
|
1244
|
+
...opts.cropToFill != null ? { crop_to_fill: opts.cropToFill } : {},
|
|
1245
|
+
...opts.faceEnhancement != null ? { face_enhancement: opts.faceEnhancement } : {},
|
|
1246
|
+
...opts.faceEnhancementStrength ? { face_enhancement_strength: Number(opts.faceEnhancementStrength) } : {},
|
|
1247
|
+
...opts.faceEnhancementCreativity ? { face_enhancement_creativity: Number(opts.faceEnhancementCreativity) } : {},
|
|
1248
|
+
...opts.billingSource ? { billing_source: opts.billingSource } : {},
|
|
1249
|
+
...opts.tagIds?.length ? { tag_ids: opts.tagIds } : {}
|
|
1250
|
+
};
|
|
1251
|
+
const extra = parseExtra2(opts.extra);
|
|
1252
|
+
if (opts.idempotencyKey) extra.idempotency_key = opts.idempotencyKey;
|
|
1253
|
+
const res = await client.generateUpscale({ ...body, ...extra });
|
|
919
1254
|
if (!res.ok) fail(res);
|
|
920
1255
|
const submitted = asRecord(res.body);
|
|
921
1256
|
const taskId = String(submitted.task_id || submitted.id || "");
|
|
@@ -931,6 +1266,58 @@ async function cmdGenerateVideo(opts) {
|
|
|
931
1266
|
timeoutMs: parseDurationMs(opts.waitTimeout, 20 * 60 * 1e3)
|
|
932
1267
|
});
|
|
933
1268
|
}
|
|
1269
|
+
async function cmdGenerateAudio(opts) {
|
|
1270
|
+
const client = createCliClient(requireApiKey());
|
|
1271
|
+
const body = {
|
|
1272
|
+
prompt: opts.prompt,
|
|
1273
|
+
model: opts.model,
|
|
1274
|
+
style: opts.style,
|
|
1275
|
+
title: opts.title,
|
|
1276
|
+
custom_mode: opts.customMode,
|
|
1277
|
+
instrumental: opts.instrumental,
|
|
1278
|
+
negative_tags: opts.negativeTags,
|
|
1279
|
+
vocal_gender: opts.vocalGender,
|
|
1280
|
+
style_weight: opts.styleWeight == null ? void 0 : Number(opts.styleWeight),
|
|
1281
|
+
weirdness_constraint: opts.weirdnessConstraint == null ? void 0 : Number(opts.weirdnessConstraint),
|
|
1282
|
+
audio_weight: opts.audioWeight == null ? void 0 : Number(opts.audioWeight),
|
|
1283
|
+
project_id: opts.projectId ? parseProjectId(opts.projectId) : void 0,
|
|
1284
|
+
billing_source: opts.billingSource,
|
|
1285
|
+
tag_ids: opts.tagIds,
|
|
1286
|
+
...parseExtra2(opts.extra)
|
|
1287
|
+
};
|
|
1288
|
+
if (opts.idempotencyKey) body.idempotency_key = opts.idempotencyKey;
|
|
1289
|
+
const res = await client.generateAudio(body);
|
|
1290
|
+
if (!res.ok) fail(res);
|
|
1291
|
+
await finishSubmitted(client, asRecord(res.body), opts);
|
|
1292
|
+
}
|
|
1293
|
+
async function cmdGenerateSwitchx(opts) {
|
|
1294
|
+
const client = createCliClient(requireApiKey());
|
|
1295
|
+
const projectId = opts.projectId ? parseProjectId(opts.projectId) : void 0;
|
|
1296
|
+
const sourceUrl = await resolveInputRef(
|
|
1297
|
+
client,
|
|
1298
|
+
opts.source,
|
|
1299
|
+
projectId ? { projectId } : void 0
|
|
1300
|
+
);
|
|
1301
|
+
const body = {
|
|
1302
|
+
source_url: sourceUrl,
|
|
1303
|
+
model: opts.model,
|
|
1304
|
+
generation_type: opts.generationType,
|
|
1305
|
+
reference_image_url: opts.referenceImage,
|
|
1306
|
+
alpha_mode: opts.alphaMode,
|
|
1307
|
+
alpha_url: opts.alphaUrl,
|
|
1308
|
+
prompt: opts.prompt,
|
|
1309
|
+
max_resolution: opts.maxResolution == null ? void 0 : Number(opts.maxResolution),
|
|
1310
|
+
frame_count: opts.frameCount == null ? void 0 : Number(opts.frameCount),
|
|
1311
|
+
project_id: projectId,
|
|
1312
|
+
billing_source: opts.billingSource,
|
|
1313
|
+
tag_ids: opts.tagIds,
|
|
1314
|
+
...parseExtra2(opts.extra)
|
|
1315
|
+
};
|
|
1316
|
+
if (opts.idempotencyKey) body.idempotency_key = opts.idempotencyKey;
|
|
1317
|
+
const res = await client.generateSwitchx(body);
|
|
1318
|
+
if (!res.ok) fail(res);
|
|
1319
|
+
await finishSubmitted(client, asRecord(res.body), opts);
|
|
1320
|
+
}
|
|
934
1321
|
async function cmdGenerateGet(taskId, jsonMode) {
|
|
935
1322
|
const cfg = requireApiKey();
|
|
936
1323
|
const client = createCliClient(cfg);
|
|
@@ -953,7 +1340,7 @@ async function cmdGenerateCancel(taskId, jsonMode) {
|
|
|
953
1340
|
const cfg = requireApiKey();
|
|
954
1341
|
const client = createCliClient(cfg);
|
|
955
1342
|
const kind = inferJobKind(taskId);
|
|
956
|
-
const res = kind === "image" ? await client.cancelImageGeneration(taskId) : kind === "video" ? await client.cancelVideoGeneration(taskId) : kind === "upscale" ? await client.cancelUpscaleGeneration(taskId) : kind === "mesh" ? await client.cancelMeshGeneration(taskId) : kind === "switchx" ? await client.cancelSwitchxGeneration(taskId) : null;
|
|
1343
|
+
const res = kind === "image" ? await client.cancelImageGeneration(taskId) : kind === "video" ? await client.cancelVideoGeneration(taskId) : kind === "upscale" ? await client.cancelUpscaleGeneration(taskId) : kind === "mesh" ? await client.cancelMeshGeneration(taskId) : kind === "switchx" ? await client.cancelSwitchxGeneration(taskId) : kind === "audio" ? await client.cancelAudioGeneration(taskId) : null;
|
|
957
1344
|
if (!res) {
|
|
958
1345
|
throw new Error(`\u043D\u0435 \u0443\u043C\u0435\u044E \u043E\u0442\u043C\u0435\u043D\u044F\u0442\u044C \u044D\u0442\u043E\u0442 \u0442\u0438\u043F \u0437\u0430\u0434\u0430\u0447\u0438 (${kind || "unknown"})`);
|
|
959
1346
|
}
|
|
@@ -967,7 +1354,7 @@ async function cmdGenerateList(opts) {
|
|
|
967
1354
|
limit: opts.limit,
|
|
968
1355
|
...opts.cursor ? { cursor: opts.cursor } : {}
|
|
969
1356
|
};
|
|
970
|
-
const res = opts.kind === "video" ? await client.listVideoGenerations(params) : await client.listImageGenerations(params);
|
|
1357
|
+
const res = opts.kind === "video" ? await client.listVideoGenerations(params) : opts.kind === "audio" ? await client.listAudioGenerations(params) : opts.kind === "upscale" ? await client.listUpscaleGenerations(params) : opts.kind === "switchx" ? await client.listSwitchxGenerations(params) : opts.kind === "mesh" ? await client.listMeshGenerations(params) : await client.listImageGenerations(params);
|
|
971
1358
|
if (!res.ok) fail(res);
|
|
972
1359
|
const body = asRecord(res.body);
|
|
973
1360
|
const items = Array.isArray(body.items) ? body.items : [];
|
|
@@ -986,8 +1373,8 @@ function mediaHint(body) {
|
|
|
986
1373
|
const images = Array.isArray(body.images) ? body.images : [];
|
|
987
1374
|
const videos = Array.isArray(body.videos) ? body.videos : [];
|
|
988
1375
|
const urls = [...images, ...videos].map((item) => item && typeof item === "object" ? String(asRecord(item).url || "") : "").filter(Boolean);
|
|
989
|
-
const
|
|
990
|
-
return [...urls, ...
|
|
1376
|
+
const media2 = Array.isArray(body.media_urls) ? body.media_urls.map((u) => String(u || "")) : [];
|
|
1377
|
+
return [...urls, ...media2].filter(Boolean);
|
|
991
1378
|
}
|
|
992
1379
|
|
|
993
1380
|
// src/library.ts
|
|
@@ -1184,7 +1571,7 @@ function parse(raw) {
|
|
|
1184
1571
|
return [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
1185
1572
|
}
|
|
1186
1573
|
function cliVersion() {
|
|
1187
|
-
return String("0.1.
|
|
1574
|
+
return String("0.1.5");
|
|
1188
1575
|
}
|
|
1189
1576
|
function updateAvailableMessage(local, latest) {
|
|
1190
1577
|
return `\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u043D\u043E\u0432\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F @artillect/cli (${latest}, \u0443 \u0432\u0430\u0441 ${local}).
|
|
@@ -1237,6 +1624,228 @@ async function maybeNotifyUpdate() {
|
|
|
1237
1624
|
}
|
|
1238
1625
|
}
|
|
1239
1626
|
|
|
1627
|
+
// src/operations.ts
|
|
1628
|
+
function jsonArg(raw, label) {
|
|
1629
|
+
if (!raw) return {};
|
|
1630
|
+
const value = JSON.parse(String(raw));
|
|
1631
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
1632
|
+
throw new Error(`${label} \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C JSON-\u043E\u0431\u044A\u0435\u043A\u0442\u043E\u043C`);
|
|
1633
|
+
return value;
|
|
1634
|
+
}
|
|
1635
|
+
async function call(method, path, body) {
|
|
1636
|
+
const res = await publicApiFetch(createCliClient(requireApiKey()).config, method, path, body);
|
|
1637
|
+
if (!res.ok) fail(res);
|
|
1638
|
+
return res.body;
|
|
1639
|
+
}
|
|
1640
|
+
async function cmdApiOperation(operation, args) {
|
|
1641
|
+
const json = Boolean(args.json);
|
|
1642
|
+
let method = "GET";
|
|
1643
|
+
let path = "/api/v1/health";
|
|
1644
|
+
let body;
|
|
1645
|
+
const projectValue = args.project ?? args.id;
|
|
1646
|
+
const project = projectValue ? parseProjectId(String(projectValue)) : void 0;
|
|
1647
|
+
switch (operation) {
|
|
1648
|
+
case "health":
|
|
1649
|
+
path = "/api/v1/health";
|
|
1650
|
+
break;
|
|
1651
|
+
case "feedback":
|
|
1652
|
+
method = "POST";
|
|
1653
|
+
path = "/api/v1/feedback";
|
|
1654
|
+
body = jsonArg(args.body, "--body");
|
|
1655
|
+
break;
|
|
1656
|
+
case "folders":
|
|
1657
|
+
path = "/api/v1/folders";
|
|
1658
|
+
break;
|
|
1659
|
+
case "folder-create":
|
|
1660
|
+
method = "POST";
|
|
1661
|
+
path = "/api/v1/folders";
|
|
1662
|
+
body = {
|
|
1663
|
+
name: args.name,
|
|
1664
|
+
...args.parentId ? { parent_id: parseProjectId(String(args.parentId)) } : {}
|
|
1665
|
+
};
|
|
1666
|
+
break;
|
|
1667
|
+
case "tags":
|
|
1668
|
+
path = `/api/v1/projects/${project}/tags`;
|
|
1669
|
+
break;
|
|
1670
|
+
case "tag-create":
|
|
1671
|
+
method = "POST";
|
|
1672
|
+
path = `/api/v1/projects/${project}/tags`;
|
|
1673
|
+
body = { name: args.name, ...args.color ? { color: args.color } : {} };
|
|
1674
|
+
break;
|
|
1675
|
+
case "tag-delete":
|
|
1676
|
+
method = "DELETE";
|
|
1677
|
+
path = `/api/v1/projects/${project}/tags/${parseProjectId(String(args.tag))}`;
|
|
1678
|
+
break;
|
|
1679
|
+
case "favorites":
|
|
1680
|
+
path = `/api/v1/projects/${project}/favorites`;
|
|
1681
|
+
break;
|
|
1682
|
+
case "project-generations":
|
|
1683
|
+
path = `/api/v1/projects/${project}/generations`;
|
|
1684
|
+
break;
|
|
1685
|
+
default:
|
|
1686
|
+
throw new Error(`\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F API-\u043E\u043F\u0435\u0440\u0430\u0446\u0438\u044F: ${operation}`);
|
|
1687
|
+
}
|
|
1688
|
+
const qs = new URLSearchParams();
|
|
1689
|
+
for (const [key, value] of Object.entries(args)) {
|
|
1690
|
+
if (["json", "body", "name", "color", "parentId", "project", "id", "tag"].includes(key) || value == null || value === false)
|
|
1691
|
+
continue;
|
|
1692
|
+
if (key === "tagIds") qs.set("tag_ids", String(value));
|
|
1693
|
+
else
|
|
1694
|
+
qs.set(
|
|
1695
|
+
key.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`),
|
|
1696
|
+
String(value)
|
|
1697
|
+
);
|
|
1698
|
+
}
|
|
1699
|
+
const result = await call(method, qs.size && method === "GET" ? `${path}?${qs}` : path, body);
|
|
1700
|
+
printOrJson(json, result, [JSON.stringify(result)]);
|
|
1701
|
+
}
|
|
1702
|
+
async function cmdChatOperation(operation, args) {
|
|
1703
|
+
const json = Boolean(args.json);
|
|
1704
|
+
const id = args.id != null ? parseProjectId(String(args.id)) : void 0;
|
|
1705
|
+
let method = "GET";
|
|
1706
|
+
let path = "/api/v1/chat/conversations";
|
|
1707
|
+
let body;
|
|
1708
|
+
if (operation === "completion") {
|
|
1709
|
+
method = "POST";
|
|
1710
|
+
path = "/api/v1/chat/completions";
|
|
1711
|
+
body = jsonArg(args.body, "--body");
|
|
1712
|
+
} else if (operation === "send") {
|
|
1713
|
+
method = "POST";
|
|
1714
|
+
path = `/api/v1/chat/conversations/${id}/messages`;
|
|
1715
|
+
body = jsonArg(args.body, "--body");
|
|
1716
|
+
} else if (operation === "create") {
|
|
1717
|
+
method = "POST";
|
|
1718
|
+
body = jsonArg(args.body, "--body");
|
|
1719
|
+
} else if (operation === "messages") {
|
|
1720
|
+
path = `/api/v1/chat/conversations/${id}/messages`;
|
|
1721
|
+
const query = new URLSearchParams();
|
|
1722
|
+
if (args.limit) query.set("limit", String(args.limit));
|
|
1723
|
+
if (args.cursor) query.set("cursor", String(args.cursor));
|
|
1724
|
+
if (query.size) path += `?${query}`;
|
|
1725
|
+
} else if (operation === "delete") {
|
|
1726
|
+
method = "DELETE";
|
|
1727
|
+
path = `/api/v1/chat/conversations/${id}`;
|
|
1728
|
+
}
|
|
1729
|
+
const result = await call(method, path, body);
|
|
1730
|
+
printOrJson(json, result, [JSON.stringify(result)]);
|
|
1731
|
+
}
|
|
1732
|
+
async function cmdProjectOperation(operation, args) {
|
|
1733
|
+
const json = Boolean(args.json);
|
|
1734
|
+
const client = createCliClient(requireApiKey());
|
|
1735
|
+
const id = args.id == null ? void 0 : parseProjectId(String(args.id));
|
|
1736
|
+
let result;
|
|
1737
|
+
if (operation === "list")
|
|
1738
|
+
result = await client.listProjects({
|
|
1739
|
+
limit: parseLimit(args.limit, 50),
|
|
1740
|
+
cursor: args.cursor
|
|
1741
|
+
});
|
|
1742
|
+
else if (operation === "get") result = await call("GET", `/api/v1/projects/${id}`);
|
|
1743
|
+
else if (operation === "create")
|
|
1744
|
+
result = await call("POST", "/api/v1/projects", jsonArg(args.body, "--body"));
|
|
1745
|
+
else if (operation === "update")
|
|
1746
|
+
result = await call("PATCH", `/api/v1/projects/${id}`, jsonArg(args.body, "--body"));
|
|
1747
|
+
else if (operation === "delete") result = await call("DELETE", `/api/v1/projects/${id}`);
|
|
1748
|
+
else if (operation === "roles") result = await call("GET", "/api/v1/projects/roles");
|
|
1749
|
+
else if (operation === "members") result = await call("GET", `/api/v1/projects/${id}/members`);
|
|
1750
|
+
else if (operation === "invite")
|
|
1751
|
+
result = await call("POST", `/api/v1/projects/${id}/members`, jsonArg(args.body, "--body"));
|
|
1752
|
+
else if (operation === "update-member")
|
|
1753
|
+
result = await call(
|
|
1754
|
+
"PATCH",
|
|
1755
|
+
`/api/v1/projects/${id}/members/${args.user}`,
|
|
1756
|
+
jsonArg(args.body, "--body")
|
|
1757
|
+
);
|
|
1758
|
+
else if (operation === "remove-member")
|
|
1759
|
+
result = await call("DELETE", `/api/v1/projects/${id}/members/${args.user}`);
|
|
1760
|
+
else if (operation === "leave")
|
|
1761
|
+
result = await call("DELETE", `/api/v1/projects/${id}/members/me`);
|
|
1762
|
+
else if (operation === "analytics" || operation === "billing")
|
|
1763
|
+
result = await call("GET", `/api/v1/projects/${id}/${operation}`);
|
|
1764
|
+
else throw new Error(`\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F project-\u043E\u043F\u0435\u0440\u0430\u0446\u0438\u044F: ${operation}`);
|
|
1765
|
+
const payload = result && typeof result === "object" && "ok" in result ? result.body ?? result : result;
|
|
1766
|
+
printOrJson(json, payload, [JSON.stringify(payload)]);
|
|
1767
|
+
}
|
|
1768
|
+
async function cmdWebhookOperation(operation, args) {
|
|
1769
|
+
const json = Boolean(args.json);
|
|
1770
|
+
const client = createCliClient(requireApiKey());
|
|
1771
|
+
let result;
|
|
1772
|
+
if (operation === "get") result = await client.getWebhook();
|
|
1773
|
+
else if (operation === "upsert")
|
|
1774
|
+
result = await client.upsertWebhook({
|
|
1775
|
+
url: String(args.url),
|
|
1776
|
+
include_studio: Boolean(args.includeStudio)
|
|
1777
|
+
});
|
|
1778
|
+
else if (operation === "delete") result = await client.deleteWebhook();
|
|
1779
|
+
else if (operation === "rotate") result = await client.rotateWebhookSecret();
|
|
1780
|
+
else if (operation === "deliveries")
|
|
1781
|
+
result = await client.listWebhookDeliveries({
|
|
1782
|
+
limit: parseLimit(args.limit, 50),
|
|
1783
|
+
cursor: args.cursor
|
|
1784
|
+
});
|
|
1785
|
+
else if (operation === "delivery") result = await client.getWebhookDelivery(String(args.id));
|
|
1786
|
+
else throw new Error(`\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F webhook-\u043E\u043F\u0435\u0440\u0430\u0446\u0438\u044F: ${operation}`);
|
|
1787
|
+
if (!result.ok) fail(result);
|
|
1788
|
+
printOrJson(json, result.body, [JSON.stringify(result.body)]);
|
|
1789
|
+
}
|
|
1790
|
+
async function cmdLibraryOperation(operation, args) {
|
|
1791
|
+
const json = Boolean(args.json);
|
|
1792
|
+
const project = parseProjectId(String(args.project));
|
|
1793
|
+
const generation2 = args.generation == null ? "" : encodeURIComponent(String(args.generation));
|
|
1794
|
+
const element = args.element == null ? "" : encodeURIComponent(String(args.element));
|
|
1795
|
+
let method = "POST";
|
|
1796
|
+
let path = `/api/v1/projects/${project}/generations/${generation2}`;
|
|
1797
|
+
let body;
|
|
1798
|
+
switch (operation) {
|
|
1799
|
+
case "generation-tags":
|
|
1800
|
+
path += "/tags";
|
|
1801
|
+
body = jsonArg(args.body, "--body");
|
|
1802
|
+
break;
|
|
1803
|
+
case "generation-like":
|
|
1804
|
+
path += "/likes";
|
|
1805
|
+
body = jsonArg(args.body, "--body");
|
|
1806
|
+
break;
|
|
1807
|
+
case "generation-copy":
|
|
1808
|
+
path += "/copy";
|
|
1809
|
+
body = { project_id: parseProjectId(String(args.destination)) };
|
|
1810
|
+
break;
|
|
1811
|
+
case "generation-move":
|
|
1812
|
+
method = "PATCH";
|
|
1813
|
+
body = { project_id: parseProjectId(String(args.destination)) };
|
|
1814
|
+
break;
|
|
1815
|
+
case "generation-delete":
|
|
1816
|
+
method = "DELETE";
|
|
1817
|
+
break;
|
|
1818
|
+
case "element-update":
|
|
1819
|
+
method = "PATCH";
|
|
1820
|
+
path = `/api/v1/projects/${project}/elements/${element}`;
|
|
1821
|
+
body = jsonArg(args.body, "--body");
|
|
1822
|
+
break;
|
|
1823
|
+
case "element-delete":
|
|
1824
|
+
method = "DELETE";
|
|
1825
|
+
path = `/api/v1/projects/${project}/elements/${element}`;
|
|
1826
|
+
break;
|
|
1827
|
+
case "element-reorder":
|
|
1828
|
+
path = `/api/v1/projects/${project}/elements/reorder`;
|
|
1829
|
+
body = jsonArg(args.body, "--body");
|
|
1830
|
+
break;
|
|
1831
|
+
case "media-edit":
|
|
1832
|
+
path = "/api/v1/media/operations";
|
|
1833
|
+
body = jsonArg(args.body, "--body");
|
|
1834
|
+
break;
|
|
1835
|
+
case "media-get":
|
|
1836
|
+
method = "GET";
|
|
1837
|
+
path = `/api/v1/media/operations/${encodeURIComponent(String(args.id))}`;
|
|
1838
|
+
break;
|
|
1839
|
+
case "media-cancel":
|
|
1840
|
+
path = `/api/v1/media/operations/${encodeURIComponent(String(args.id))}/cancel`;
|
|
1841
|
+
break;
|
|
1842
|
+
default:
|
|
1843
|
+
throw new Error(`\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F library-\u043E\u043F\u0435\u0440\u0430\u0446\u0438\u044F: ${operation}`);
|
|
1844
|
+
}
|
|
1845
|
+
const result = await call(method, path, body);
|
|
1846
|
+
printOrJson(json, result, [JSON.stringify(result)]);
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1240
1849
|
// src/index.ts
|
|
1241
1850
|
var program = new Command();
|
|
1242
1851
|
program.name("artillect").description("Artillect CLI \u2014 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u044F \u043A\u0430\u0440\u0442\u0438\u043D\u043E\u043A \u0438 \u0432\u0438\u0434\u0435\u043E \u0438\u0437 \u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B\u0430.").version(cliVersion());
|
|
@@ -1253,6 +1862,8 @@ auth.command("status").description("\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u
|
|
|
1253
1862
|
program.command("balance").description("\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0431\u0430\u043B\u0430\u043D\u0441 \u0442\u043E\u043A\u0435\u043D\u043E\u0432").option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(async (opts) => {
|
|
1254
1863
|
await cmdBalance(Boolean(opts.json));
|
|
1255
1864
|
});
|
|
1865
|
+
program.command("health").description("\u041F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E\u0441\u0442\u044C Public API").option("--json").action((opts) => cmdApiOperation("health", opts));
|
|
1866
|
+
program.command("feedback").description("\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C feedback \u0430\u0433\u0435\u043D\u0442\u0441\u043A\u043E\u0433\u043E/CLI \u0441\u0446\u0435\u043D\u0430\u0440\u0438\u044F").requiredOption("--body <json>", "JSON-\u0442\u0435\u043B\u043E feedback").option("--json").action((opts) => cmdApiOperation("feedback", opts));
|
|
1256
1867
|
var models = program.command("models").description("\u041A\u0430\u0442\u0430\u043B\u043E\u0433 \u043C\u043E\u0434\u0435\u043B\u0435\u0439 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430");
|
|
1257
1868
|
models.command("list").description("\u0421\u043F\u0438\u0441\u043E\u043A \u043C\u043E\u0434\u0435\u043B\u0435\u0439").option("-k, --kind <kind>", "images | video | chat | audio | upscale | mesh").option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(async (opts) => {
|
|
1258
1869
|
await cmdModels(opts.kind, Boolean(opts.json));
|
|
@@ -1260,15 +1871,19 @@ models.command("list").description("\u0421\u043F\u0438\u0441\u043E\u043A \u043C\
|
|
|
1260
1871
|
models.command("get").description("\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u043E\u0434\u043D\u043E\u0439 \u043C\u043E\u0434\u0435\u043B\u0438").argument("<slug>", "\u0441\u043B\u0430\u0433, \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 gpt-image-2").option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(async (slug, opts) => {
|
|
1261
1872
|
await cmdModelsGet(slug, Boolean(opts.json));
|
|
1262
1873
|
});
|
|
1263
|
-
program.command("upload").description("\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0444\u0430\u0439\u043B \u0432 storage \u0438 \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C ast_\u2026").argument("
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1874
|
+
program.command("upload").description("\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0444\u0430\u0439\u043B \u0432 storage \u0438 \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C ast_\u2026").argument("[file]", "\u043F\u0443\u0442\u044C \u043A \u0444\u0430\u0439\u043B\u0443").option("--url <https>", "\u043F\u0443\u0431\u043B\u0438\u0447\u043D\u044B\u0439 URL \u0434\u043B\u044F \u0437\u0435\u0440\u043A\u0430\u043B\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0432 storage").option("--filename <name>", "\u0438\u043C\u044F \u0444\u0430\u0439\u043B\u0430 \u0434\u043B\u044F --url").option("--project <id>", "\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C \u0444\u0430\u0439\u043B \u0432 storage \u043F\u0440\u043E\u0435\u043A\u0442\u0430").option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(
|
|
1875
|
+
async (file, opts) => {
|
|
1876
|
+
await cmdUpload({
|
|
1877
|
+
filePath: file,
|
|
1878
|
+
url: opts.url,
|
|
1879
|
+
filename: opts.filename,
|
|
1880
|
+
projectId: opts.project,
|
|
1881
|
+
json: Boolean(opts.json)
|
|
1882
|
+
});
|
|
1883
|
+
}
|
|
1884
|
+
);
|
|
1885
|
+
program.command("estimate").description("\u041E\u0446\u0435\u043D\u0438\u0442\u044C \u0446\u0435\u043D\u0443 \u0431\u0435\u0437 \u0441\u043F\u0438\u0441\u0430\u043D\u0438\u044F").argument("<type>", "image | video | audio | mesh | upscale | switchx | chat").option("-p, --prompt <text>", "\u043F\u0440\u043E\u043C\u043F\u0442 (\u0434\u043B\u044F Wan 3 ref2v \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043F\u0443\u0441\u0442\u044B\u043C)").option("-m, --model <slug>", "\u0441\u043B\u0430\u0433 \u043C\u043E\u0434\u0435\u043B\u0438").option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(async (type, opts) => {
|
|
1886
|
+
const kind = ["image", "video", "audio", "mesh", "upscale", "switchx", "chat"].includes(type) ? type : null;
|
|
1272
1887
|
if (!kind) throw new Error("type: image \u0438\u043B\u0438 video");
|
|
1273
1888
|
await cmdEstimate({
|
|
1274
1889
|
type: kind,
|
|
@@ -1278,12 +1893,61 @@ program.command("estimate").description("\u041E\u0446\u0435\u043D\u0438\u0442\u0
|
|
|
1278
1893
|
});
|
|
1279
1894
|
});
|
|
1280
1895
|
var generate = program.command("generate").description("\u0417\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0438\u043B\u0438 \u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u044E");
|
|
1281
|
-
generate.command("
|
|
1896
|
+
generate.command("audio").description("\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u043C\u0443\u0437\u044B\u043A\u0443 Suno").requiredOption("-p, --prompt <text>", "\u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0438\u043B\u0438 lyrics").option("-m, --model <slug>", "\u0430\u0443\u0434\u0438\u043E\u043C\u043E\u0434\u0435\u043B\u044C").option("--style <text>", "\u0436\u0430\u043D\u0440/\u0441\u0442\u0438\u043B\u044C").option("--title <text>", "\u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0442\u0440\u0435\u043A\u0430").option("--custom-mode <boolean>", "prompt \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 lyrics").option("--instrumental <boolean>", "\u0431\u0435\u0437 \u0432\u043E\u043A\u0430\u043B\u0430").option("--negative-tags <text>", "\u0441\u0442\u0438\u043B\u0438, \u043A\u043E\u0442\u043E\u0440\u044B\u0445 \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044C").option("--vocal-gender <m|f>", "\u043F\u043E\u043B \u0432\u043E\u043A\u0430\u043B\u0430").option("--style-weight <n>", "\u0432\u0435\u0441 \u0441\u0442\u0438\u043B\u044F").option("--weirdness-constraint <n>", "weirdness").option("--audio-weight <n>", "\u0432\u0435\u0441 \u0430\u0443\u0434\u0438\u043E").option("--project <id>", "\u043F\u0440\u043E\u0435\u043A\u0442").option("--billing-source <source>", "cli | mcp | public_api | studio").option("--tag-id <ids>", "tag ids \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E").option("--idempotency-key <key>", "\u043A\u043B\u044E\u0447 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0433\u043E \u043F\u043E\u0432\u0442\u043E\u0440\u0430 submit").option("--extra <json>", "\u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043F\u043E\u043B\u044F \u0442\u0435\u043B\u0430 API").option("-w, --wait", "\u0434\u043E\u0436\u0434\u0430\u0442\u044C\u0441\u044F \u0433\u043E\u0442\u043E\u0432\u043D\u043E\u0441\u0442\u0438", false).option("--wait-timeout <duration>", "\u043B\u0438\u043C\u0438\u0442 \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F", "20m").option("-o, --out <dir>", "\u043F\u0430\u043F\u043A\u0430 \u0434\u043B\u044F \u0444\u0430\u0439\u043B\u043E\u0432", ".").option("--open", "\u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0444\u0430\u0439\u043B", false).option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(async (opts) => {
|
|
1897
|
+
await cmdGenerateAudio({
|
|
1898
|
+
prompt: String(opts.prompt),
|
|
1899
|
+
model: opts.model,
|
|
1900
|
+
style: opts.style,
|
|
1901
|
+
title: opts.title,
|
|
1902
|
+
customMode: opts.customMode == null ? void 0 : opts.customMode !== "false",
|
|
1903
|
+
instrumental: opts.instrumental == null ? void 0 : opts.instrumental !== "false",
|
|
1904
|
+
negativeTags: opts.negativeTags,
|
|
1905
|
+
vocalGender: opts.vocalGender,
|
|
1906
|
+
styleWeight: opts.styleWeight,
|
|
1907
|
+
weirdnessConstraint: opts.weirdnessConstraint,
|
|
1908
|
+
audioWeight: opts.audioWeight,
|
|
1909
|
+
projectId: opts.project,
|
|
1910
|
+
billingSource: opts.billingSource,
|
|
1911
|
+
tagIds: parseTagIds(opts.tagId),
|
|
1912
|
+
idempotencyKey: opts.idempotencyKey,
|
|
1913
|
+
extra: opts.extra,
|
|
1914
|
+
wait: Boolean(opts.wait),
|
|
1915
|
+
json: Boolean(opts.json),
|
|
1916
|
+
out: String(opts.out || "."),
|
|
1917
|
+
open: Boolean(opts.open),
|
|
1918
|
+
waitTimeout: opts.waitTimeout
|
|
1919
|
+
});
|
|
1920
|
+
});
|
|
1921
|
+
generate.command("switchx").description("SwitchX compositing").requiredOption("--source <ref>", "\u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0435 \u0432\u0438\u0434\u0435\u043E/\u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435").option("-m, --model <slug>", "\u043C\u043E\u0434\u0435\u043B\u044C").option("--generation-type <type>", "\u0442\u0438\u043F \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u0438").option("--reference-image <url>", "\u0440\u0435\u0444\u0435\u0440\u0435\u043D\u0441\u043D\u043E\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435").option("--alpha-mode <mode>", "\u0440\u0435\u0436\u0438\u043C alpha").option("--alpha-url <url>", "alpha URL").option("-p, --prompt <text>", "\u043F\u0440\u043E\u043C\u043F\u0442").option("--max-resolution <n>", "\u043C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0435").option("--frame-count <n>", "\u0447\u0438\u0441\u043B\u043E \u043A\u0430\u0434\u0440\u043E\u0432").option("--project <id>", "\u043F\u0440\u043E\u0435\u043A\u0442").option("--billing-source <source>", "cli | mcp | public_api | studio").option("--tag-id <ids>", "tag ids \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E").option("--idempotency-key <key>", "\u043A\u043B\u044E\u0447 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0433\u043E \u043F\u043E\u0432\u0442\u043E\u0440\u0430 submit").option("--extra <json>", "\u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043F\u043E\u043B\u044F \u0442\u0435\u043B\u0430 API").option("-w, --wait", "\u0434\u043E\u0436\u0434\u0430\u0442\u044C\u0441\u044F \u0433\u043E\u0442\u043E\u0432\u043D\u043E\u0441\u0442\u0438", false).option("--wait-timeout <duration>", "\u043B\u0438\u043C\u0438\u0442 \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F", "20m").option("-o, --out <dir>", "\u043F\u0430\u043F\u043A\u0430 \u0434\u043B\u044F \u0444\u0430\u0439\u043B\u043E\u0432", ".").option("--open", "\u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0444\u0430\u0439\u043B", false).option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(
|
|
1922
|
+
async (opts) => cmdGenerateSwitchx({
|
|
1923
|
+
source: String(opts.source),
|
|
1924
|
+
model: opts.model,
|
|
1925
|
+
generationType: opts.generationType,
|
|
1926
|
+
referenceImage: opts.referenceImage,
|
|
1927
|
+
alphaMode: opts.alphaMode,
|
|
1928
|
+
alphaUrl: opts.alphaUrl,
|
|
1929
|
+
prompt: opts.prompt,
|
|
1930
|
+
maxResolution: opts.maxResolution,
|
|
1931
|
+
frameCount: opts.frameCount,
|
|
1932
|
+
projectId: opts.project,
|
|
1933
|
+
billingSource: opts.billingSource,
|
|
1934
|
+
tagIds: parseTagIds(opts.tagId),
|
|
1935
|
+
idempotencyKey: opts.idempotencyKey,
|
|
1936
|
+
extra: opts.extra,
|
|
1937
|
+
wait: Boolean(opts.wait),
|
|
1938
|
+
json: Boolean(opts.json),
|
|
1939
|
+
out: String(opts.out || "."),
|
|
1940
|
+
open: Boolean(opts.open),
|
|
1941
|
+
waitTimeout: opts.waitTimeout
|
|
1942
|
+
})
|
|
1943
|
+
);
|
|
1944
|
+
generate.command("image").description("\u041A\u0430\u0440\u0442\u0438\u043D\u043A\u0430 \u043F\u043E \u0442\u0435\u043A\u0441\u0442\u0443 \u0438\u043B\u0438 \u043F\u0440\u0430\u0432\u043A\u0430 \u043F\u043E \u0440\u0435\u0444\u0435\u0440\u0435\u043D\u0441\u0430\u043C").option("-p, --prompt <text>", "\u043F\u0440\u043E\u043C\u043F\u0442 (\u0434\u043B\u044F \u043D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u0445 image-to-image \u043C\u043E\u0434\u0435\u043B\u0435\u0439 \u043D\u0435 \u043D\u0443\u0436\u0435\u043D)").option("-m, --model <slug>", "\u0441\u043B\u0430\u0433 \u043C\u043E\u0434\u0435\u043B\u0438 (\u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E gpt-image-2)").option("-i, --input <file...>", "\u0440\u0435\u0444\u0435\u0440\u0435\u043D\u0441\u044B: \u0444\u0430\u0439\u043B, url \u0438\u043B\u0438 ast_\u2026").option("--project <id>", "\u043F\u0440\u043E\u0435\u043A\u0442 (\u0434\u043B\u044F @\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 \u0438 \u043B\u0435\u043D\u0442\u044B)").option("--aspect-ratio <ratio>", "\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 1:1, 16:9").option("--resolution <size>", "\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 1K, 2K, 4K").option("--quality <value>", "\u043A\u0430\u0447\u0435\u0441\u0442\u0432\u043E, \u0435\u0441\u043B\u0438 \u043C\u043E\u0434\u0435\u043B\u044C \u0435\u0433\u043E \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442").option("--num-images <n>", "\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 (1\u201310, \u0434\u043B\u044F \u043F\u0440\u0438\u043C\u0435\u0440\u043E\u0447\u043D\u043E\u0439 1\u20134)").option("--output-format <format>", "jpeg | png | webp, \u0435\u0441\u043B\u0438 \u043C\u043E\u0434\u0435\u043B\u044C \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442").option("--sync-mode <boolean>", "\u0432\u0435\u0440\u043D\u0443\u0442\u044C data URI \u0432\u043C\u0435\u0441\u0442\u043E persisted URL").option("--billing-source <source>", "cli | mcp | public_api | studio").option("--tag-id <ids>", "tag ids \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E").option("--element-name <names...>", "Element @names \u043F\u0440\u043E\u0435\u043A\u0442\u0430").option("--idempotency-key <key>", "\u043A\u043B\u044E\u0447 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0433\u043E \u043F\u043E\u0432\u0442\u043E\u0440\u0430 submit").option("--extra <json>", "\u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043F\u043E\u043B\u044F \u0442\u0435\u043B\u0430 API (JSON-\u043E\u0431\u044A\u0435\u043A\u0442)").option("-w, --wait", "\u0434\u043E\u0436\u0434\u0430\u0442\u044C\u0441\u044F \u0433\u043E\u0442\u043E\u0432\u043D\u043E\u0441\u0442\u0438 \u0438 \u0441\u043A\u0430\u0447\u0430\u0442\u044C \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442", false).option("--wait-timeout <duration>", "\u043B\u0438\u043C\u0438\u0442 \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F, \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 10m", "20m").option("-o, --out <dir>", "\u043F\u0430\u043F\u043A\u0430 \u0434\u043B\u044F \u0444\u0430\u0439\u043B\u043E\u0432", ".").option("--open", "\u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0444\u0430\u0439\u043B \u043F\u043E\u0441\u043B\u0435 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F", false).option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).addHelpText(
|
|
1282
1945
|
"after",
|
|
1283
1946
|
`
|
|
1284
1947
|
\u041F\u0440\u0438\u043C\u0435\u0440\u044B:
|
|
1285
1948
|
$ artillect generate image -p "\u043A\u043E\u0442 \u0432 \u043A\u043E\u0441\u043C\u043E\u0441\u0435" --wait --open
|
|
1286
1949
|
$ artillect generate image -m seedream-5-pro -p "\u043A\u043E\u0442" -i ./ref.png --wait
|
|
1950
|
+
$ artillect generate image -m google-virtual-try-on -i ./person.jpg -i ./jacket.jpg --num-images 2 --wait
|
|
1287
1951
|
`
|
|
1288
1952
|
).action(
|
|
1289
1953
|
async (opts) => {
|
|
@@ -1292,6 +1956,17 @@ generate.command("image").description("\u041A\u0430\u0440\u0442\u0438\u043D\u043
|
|
|
1292
1956
|
model: opts.model,
|
|
1293
1957
|
input: opts.input,
|
|
1294
1958
|
projectId: opts.project,
|
|
1959
|
+
aspectRatio: opts.aspectRatio,
|
|
1960
|
+
resolution: opts.resolution,
|
|
1961
|
+
quality: opts.quality,
|
|
1962
|
+
numImages: opts.numImages,
|
|
1963
|
+
outputFormat: opts.outputFormat,
|
|
1964
|
+
syncMode: opts.syncMode == null ? void 0 : opts.syncMode !== "false",
|
|
1965
|
+
billingSource: opts.billingSource,
|
|
1966
|
+
tagIds: parseTagIds(opts.tagId),
|
|
1967
|
+
elementNames: opts.elementName,
|
|
1968
|
+
idempotencyKey: opts.idempotencyKey,
|
|
1969
|
+
extra: opts.extra,
|
|
1295
1970
|
wait: Boolean(opts.wait),
|
|
1296
1971
|
waitTimeout: opts.waitTimeout,
|
|
1297
1972
|
json: Boolean(opts.json),
|
|
@@ -1300,21 +1975,76 @@ generate.command("image").description("\u041A\u0430\u0440\u0442\u0438\u043D\u043
|
|
|
1300
1975
|
});
|
|
1301
1976
|
}
|
|
1302
1977
|
);
|
|
1303
|
-
generate.command("
|
|
1978
|
+
generate.command("mesh").description("\u0421\u043E\u0437\u0434\u0430\u0442\u044C 3D-\u043C\u043E\u0434\u0435\u043B\u044C Meshy").option(
|
|
1979
|
+
"-m, --model <slug>",
|
|
1980
|
+
"meshy-v6-t2m | meshy-v6-i2m | meshy-v7-t2m | meshy-v7-i2m | meshy-v7-multi-i2m"
|
|
1981
|
+
).option("--task <task>", "t2m | i2m | multi-i2m").option("-p, --prompt <text>", "\u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u043E\u0431\u044A\u0435\u043A\u0442\u0430; \u0434\u043B\u044F Meshy 7 \u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C 600 \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432").option(
|
|
1982
|
+
"-i, --image <file-or-url>",
|
|
1983
|
+
"\u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435: \u0444\u0430\u0439\u043B, URL \u0438\u043B\u0438 ast_\u2026; \u043C\u043E\u0436\u043D\u043E \u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C \u0434\u043E 4 \u0440\u0430\u0437",
|
|
1984
|
+
(value, previous = []) => [...previous, value],
|
|
1985
|
+
[]
|
|
1986
|
+
).option("--mode <mode>", "preview | full; Meshy 7 text-to-3D").option("--model-type <type>", "standard | lowpoly | smart-topology; Meshy 7").option("--topology <topology>", "quad | triangle").option("--target-polycount <n>", "100\u2013300000; smart-topology \u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C 15000").option("--symmetry-mode <mode>", "off | auto | on").option("--should-remesh <boolean>", "true | false").option("--should-texture <boolean>", "true | false").option("--enable-pbr <boolean>", "true | false").option("--pose-mode <mode>", "a-pose | t-pose | none").option("--enable-prompt-expansion <boolean>", "true | false").option("--texture-prompt <text>", "\u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430 \u0434\u043B\u044F \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B").option("--texture-image <file-or-url>", "\u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0434\u043B\u044F \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B").option("--seed <n>", "seed \u0434\u043B\u044F text-to-3D").option("--enable-rigging <boolean>", "true | false").option("--rigging-height <meters>", "\u0432\u044B\u0441\u043E\u0442\u0430 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u0436\u0430, \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E 1.7").option("--enable-animation <boolean>", "true | false; \u0442\u0440\u0435\u0431\u0443\u0435\u0442 rigging").option("--animation-action-id <n>", "ID \u0430\u043D\u0438\u043C\u0430\u0446\u0438\u0438 0\u2013696").option("--enable-safety-checker <boolean>", "true | false").option("--ultra-mode <boolean>", "true | false; Meshy 7 standard + textured").option("--billing-source <source>", "cli | mcp | public_api | studio").option("--tag-id <ids>", "tag ids \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E").option("--idempotency-key <key>", "\u043A\u043B\u044E\u0447 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0433\u043E \u043F\u043E\u0432\u0442\u043E\u0440\u0430 submit").option("--extra <json>", "\u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043F\u043E\u043B\u044F \u0442\u0435\u043B\u0430 API (JSON-\u043E\u0431\u044A\u0435\u043A\u0442)").option("--project <id>", "\u043F\u0440\u043E\u0435\u043A\u0442 \u0434\u043B\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0445 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439").option("-w, --wait", "\u0434\u043E\u0436\u0434\u0430\u0442\u044C\u0441\u044F \u0433\u043E\u0442\u043E\u0432\u043D\u043E\u0441\u0442\u0438 \u0438 \u0441\u043A\u0430\u0447\u0430\u0442\u044C \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442", false).option("--wait-timeout <duration>", "\u043B\u0438\u043C\u0438\u0442 \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F, \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 10m", "20m").option("-o, --out <dir>", "\u043F\u0430\u043F\u043A\u0430 \u0434\u043B\u044F \u0444\u0430\u0439\u043B\u043E\u0432", ".").option("--open", "\u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0444\u0430\u0439\u043B \u043F\u043E\u0441\u043B\u0435 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F", false).option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(
|
|
1987
|
+
async (opts) => {
|
|
1988
|
+
await cmdGenerateMesh({
|
|
1989
|
+
...opts,
|
|
1990
|
+
projectId: opts.project,
|
|
1991
|
+
wait: Boolean(opts.wait),
|
|
1992
|
+
json: Boolean(opts.json),
|
|
1993
|
+
out: opts.out,
|
|
1994
|
+
open: Boolean(opts.open),
|
|
1995
|
+
billingSource: opts.billingSource,
|
|
1996
|
+
tagIds: parseTagIds(opts.tagId),
|
|
1997
|
+
idempotencyKey: opts.idempotencyKey
|
|
1998
|
+
});
|
|
1999
|
+
}
|
|
2000
|
+
);
|
|
2001
|
+
generate.command("video").description("\u0412\u0438\u0434\u0435\u043E \u043F\u043E \u0442\u0435\u043A\u0441\u0442\u0443 \u0438\u043B\u0438 \u043A\u0430\u0434\u0440\u0430\u043C").argument("[model]", "\u0441\u043B\u0430\u0433 \u0432\u0438\u0434\u0435\u043E\u043C\u043E\u0434\u0435\u043B\u0438 (\u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E kling-3-turbo)").option("-p, --prompt <text>", "\u043F\u0440\u043E\u043C\u043F\u0442 (\u0434\u043B\u044F Wan 3 ref2v \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043F\u0443\u0441\u0442\u044B\u043C)").option("-m, --model <slug>", "\u0441\u043B\u0430\u0433 \u043C\u043E\u0434\u0435\u043B\u0438 (\u0435\u0441\u043B\u0438 \u043D\u0435 \u0443\u043A\u0430\u0437\u0430\u043D \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442\u043E\u043C)").option("--start-image <ref>", "\u0441\u0442\u0430\u0440\u0442\u043E\u0432\u044B\u0439 \u043A\u0430\u0434\u0440: \u0444\u0430\u0439\u043B, url \u0438\u043B\u0438 ast_\u2026").option("--end-image <ref>", "\u0444\u0438\u043D\u0430\u043B\u044C\u043D\u044B\u0439 \u043A\u0430\u0434\u0440: \u0444\u0430\u0439\u043B, url \u0438\u043B\u0438 ast_\u2026").option("--source-video <ref>", "\u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0435 \u0432\u0438\u0434\u0435\u043E \u0434\u043B\u044F edit/v2v/motion").option("--audio-url <ref>", "\u0430\u0443\u0434\u0438\u043E \u0434\u043B\u044F avatar/lipsync").option("--motion-video <ref>", "motion reference video").option("--element-name <names...>", "Element @names \u043F\u0440\u043E\u0435\u043A\u0442\u0430").option("--kling-mode <mode>", "Kling mode, \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 std/pro").option("--shot-type <type>", "single | multi").option("--multi-prompt <json>", "JSON-\u043C\u0430\u0441\u0441\u0438\u0432 multi-prompt").option("--multi-shots <n>", "\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E shots").option("--keep-audio <boolean>", "\u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0430\u0443\u0434\u0438\u043E \u0438\u0441\u0445\u043E\u0434\u043D\u0438\u043A\u0430").option("--cfg-scale <n>", "CFG scale").option("--generate-audio <boolean>", "\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0430\u0443\u0434\u0438\u043E").option("--billing-source <source>", "cli | mcp | public_api | studio").option("--tag-id <ids>", "tag ids \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E").option("--idempotency-key <key>", "\u043A\u043B\u044E\u0447 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0433\u043E \u043F\u043E\u0432\u0442\u043E\u0440\u0430 submit").option("--duration <n>", "\u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C \u0432 \u0441\u0435\u043A\u0443\u043D\u0434\u0430\u0445").option("--resolution <size>", "480P | 720P | 1080P | \u2026").option("--aspect-ratio <ratio>", "adaptive | 16:9 | 4:3 | 1:1 | 3:4 | 9:16").option("--task <task>", "t2v | i2v | flf2v | \u2026").option("--seedance-mode <mode>", "quality | fast").option("--ref-image <ref...>", "\u0440\u0435\u0444\u0435\u0440\u0435\u043D\u0441-\u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438: \u0444\u0430\u0439\u043B, url \u0438\u043B\u0438 ast_\u2026").option("--ref-video <ref...>", "\u0440\u0435\u0444\u0435\u0440\u0435\u043D\u0441-\u0432\u0438\u0434\u0435\u043E").option("--ref-audio <ref...>", "\u0440\u0435\u0444\u0435\u0440\u0435\u043D\u0441-\u0430\u0443\u0434\u0438\u043E").option("--ref-file <url>", "\u043F\u0443\u0431\u043B\u0438\u0447\u043D\u044B\u0439 URL \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430 (Wan 3: \u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C 1)").option("--ref-link <url>", "\u043F\u0443\u0431\u043B\u0438\u0447\u043D\u0430\u044F \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430 (Wan 3: \u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C 1)").option("--audio <boolean>", "\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0430\u0443\u0434\u0438\u043E\u0434\u043E\u0440\u043E\u0436\u043A\u0443: true | false").option("--seed <n>", "seed: 0\u20132147483647").option("--nsfw-checker <boolean>", "nsfw_checker: true | false").option("--prompt-expansion-mode <mode>", "MiniMax H3 Max: disabled | balanced | quality").option("--enable-safety-checker <boolean>", "MiniMax H3 Max: \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043A\u043E\u043D\u0442\u0435\u043D\u0442\u0430 true | false").option("--sync-mode <boolean>", "MiniMax H3 Max: \u0432\u0435\u0440\u043D\u0443\u0442\u044C base64 \u0432\u043C\u0435\u0441\u0442\u043E CDN URL true | false").option("--extra <json>", "\u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043F\u043E\u043B\u044F \u0442\u0435\u043B\u0430 API (JSON-\u043E\u0431\u044A\u0435\u043A\u0442)").option("--project <id>", "\u043F\u0440\u043E\u0435\u043A\u0442 (\u043D\u0443\u0436\u0435\u043D \u0434\u043B\u044F @\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432)").option("-w, --wait", "\u0434\u043E\u0436\u0434\u0430\u0442\u044C\u0441\u044F \u0433\u043E\u0442\u043E\u0432\u043D\u043E\u0441\u0442\u0438 \u0438 \u0441\u043A\u0430\u0447\u0430\u0442\u044C \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442", false).option("--wait-timeout <duration>", "\u043B\u0438\u043C\u0438\u0442 \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F, \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 10m", "20m").option("-o, --out <dir>", "\u043F\u0430\u043F\u043A\u0430 \u0434\u043B\u044F \u0444\u0430\u0439\u043B\u043E\u0432", ".").option("--open", "\u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0444\u0430\u0439\u043B \u043F\u043E\u0441\u043B\u0435 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F", false).option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).addHelpText(
|
|
1304
2002
|
"after",
|
|
1305
2003
|
`
|
|
1306
2004
|
\u041F\u0440\u0438\u043C\u0435\u0440\u044B:
|
|
1307
2005
|
$ artillect generate video grok-imagine-video -p "\u043A\u043E\u0442 \u0438\u0434\u0451\u0442" --wait --open
|
|
1308
2006
|
$ artillect generate video kling-3 -p "@Hero \u0438\u0434\u0451\u0442" --project 12 --start-image ast_\u2026 --wait
|
|
2007
|
+
$ artillect generate video seedance-2.5 -p "\u2026" --duration 10 --resolution 1080p --ref-image ./sheet.png --wait
|
|
1309
2008
|
`
|
|
1310
2009
|
).action(
|
|
1311
2010
|
async (positionalModel, opts) => {
|
|
1312
2011
|
const model = String(opts.model || positionalModel || "kling-3-turbo").trim();
|
|
1313
2012
|
await cmdGenerateVideo({
|
|
1314
2013
|
model,
|
|
1315
|
-
prompt: opts.prompt,
|
|
2014
|
+
prompt: opts.prompt ?? "",
|
|
1316
2015
|
startImage: opts.startImage,
|
|
1317
2016
|
endImage: opts.endImage,
|
|
2017
|
+
sourceVideoUrl: opts.sourceVideo,
|
|
2018
|
+
audioUrl: opts.audioUrl,
|
|
2019
|
+
motionVideoUrl: opts.motionVideo,
|
|
2020
|
+
elementNames: opts.elementName,
|
|
2021
|
+
klingMode: opts.klingMode,
|
|
2022
|
+
shotType: opts.shotType,
|
|
2023
|
+
multiPrompt: opts.multiPrompt,
|
|
2024
|
+
multiShots: opts.multiShots,
|
|
2025
|
+
keepAudio: opts.keepAudio == null ? void 0 : opts.keepAudio !== "false",
|
|
2026
|
+
cfgScale: opts.cfgScale,
|
|
2027
|
+
generateAudio: opts.generateAudio == null ? void 0 : opts.generateAudio !== "false",
|
|
2028
|
+
billingSource: opts.billingSource,
|
|
2029
|
+
tagIds: parseTagIds(opts.tagId),
|
|
2030
|
+
idempotencyKey: opts.idempotencyKey,
|
|
2031
|
+
duration: opts.duration,
|
|
2032
|
+
resolution: opts.resolution,
|
|
2033
|
+
aspectRatio: opts.aspectRatio,
|
|
2034
|
+
task: opts.task,
|
|
2035
|
+
seedanceMode: opts.seedanceMode,
|
|
2036
|
+
refImage: opts.refImage,
|
|
2037
|
+
refVideo: opts.refVideo,
|
|
2038
|
+
refAudio: opts.refAudio,
|
|
2039
|
+
refFile: opts.refFile,
|
|
2040
|
+
refLink: opts.refLink ? [opts.refLink] : void 0,
|
|
2041
|
+
audio: opts.audio == null ? void 0 : opts.audio !== "false",
|
|
2042
|
+
seed: opts.seed,
|
|
2043
|
+
nsfwChecker: opts.nsfwChecker == null ? void 0 : opts.nsfwChecker !== "false",
|
|
2044
|
+
promptExpansionMode: opts.promptExpansionMode,
|
|
2045
|
+
enableSafetyChecker: opts.enableSafetyChecker == null ? void 0 : opts.enableSafetyChecker !== "false",
|
|
2046
|
+
syncMode: opts.syncMode == null ? void 0 : opts.syncMode !== "false",
|
|
2047
|
+
extra: opts.extra,
|
|
1318
2048
|
projectId: opts.project,
|
|
1319
2049
|
wait: Boolean(opts.wait),
|
|
1320
2050
|
waitTimeout: opts.waitTimeout,
|
|
@@ -1324,6 +2054,44 @@ generate.command("video").description("\u0412\u0438\u0434\u0435\u043E \u043F\u04
|
|
|
1324
2054
|
});
|
|
1325
2055
|
}
|
|
1326
2056
|
);
|
|
2057
|
+
generate.command("upscale").description("\u0423\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0438\u043B\u0438 \u0432\u0438\u0434\u0435\u043E").option("-i, --image <file-or-url>", "\u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435: \u0444\u0430\u0439\u043B, URL \u0438\u043B\u0438 ast_\u2026").option("-v, --video <file-or-url>", "\u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0435 \u0432\u0438\u0434\u0435\u043E: \u0444\u0430\u0439\u043B, URL \u0438\u043B\u0438 ast_\u2026").option("-m, --model <slug>", "\u043C\u043E\u0434\u0435\u043B\u044C: flux-video-upscale | topaz-video | crystal-video").option("--enhancement-model <name>", "Topaz enhancement model").option("--upscale-factor <n>", "\u043A\u043E\u044D\u0444\u0444\u0438\u0446\u0438\u0435\u043D\u0442; FLUX: 1.5\u20133").option("--creativity <0|1>", "FLUX: 0 precise \u0438\u043B\u0438 1 creative").option("-p, --prompt <text>", "FLUX: \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430 \u0434\u043B\u044F creative detail enhancement").option("--safety-tolerance <n>", "FLUX: 0\u20134, \u043C\u0435\u043D\u044C\u0448\u0435 \u2014 \u0441\u0442\u0440\u043E\u0436\u0435").option("--duration <seconds>", "\u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C \u0434\u043B\u044F \u0442\u043E\u0447\u043D\u043E\u0439 \u043E\u0446\u0435\u043D\u043A\u0438 \u0446\u0435\u043D\u044B").option("--width <pixels>", "\u0448\u0438\u0440\u0438\u043D\u0430 \u0438\u0441\u0445\u043E\u0434\u043D\u0438\u043A\u0430 \u0434\u043B\u044F \u0442\u043E\u0447\u043D\u043E\u0439 \u043E\u0446\u0435\u043D\u043A\u0438 \u0446\u0435\u043D\u044B").option("--height <pixels>", "\u0432\u044B\u0441\u043E\u0442\u0430 \u0438\u0441\u0445\u043E\u0434\u043D\u0438\u043A\u0430 \u0434\u043B\u044F \u0442\u043E\u0447\u043D\u043E\u0439 \u043E\u0446\u0435\u043D\u043A\u0438 \u0446\u0435\u043D\u044B").option("--output-format <format>", "png | jpg | webp").option("--crop-to-fill <boolean>", "\u043E\u0431\u0440\u0435\u0437\u0430\u0442\u044C \u0434\u043E \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F").option("--face-enhancement <boolean>", "\u0443\u043B\u0443\u0447\u0448\u0430\u0442\u044C \u043B\u0438\u0446\u0430").option("--face-enhancement-strength <n>", "\u0441\u0438\u043B\u0430 \u0443\u043B\u0443\u0447\u0448\u0435\u043D\u0438\u044F \u043B\u0438\u0446").option("--face-enhancement-creativity <n>", "\u043A\u0440\u0435\u0430\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u044C \u0443\u043B\u0443\u0447\u0448\u0435\u043D\u0438\u044F \u043B\u0438\u0446").option("--billing-source <source>", "cli | mcp | public_api | studio").option("--tag-id <ids>", "tag ids \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E").option("--idempotency-key <key>", "\u043A\u043B\u044E\u0447 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0433\u043E \u043F\u043E\u0432\u0442\u043E\u0440\u0430 submit").option("--project <id>", "\u043F\u0440\u043E\u0435\u043A\u0442 \u0434\u043B\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u0444\u0430\u0439\u043B\u0430").option("--extra <json>", "\u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043F\u043E\u043B\u044F \u0442\u0435\u043B\u0430 API (JSON-\u043E\u0431\u044A\u0435\u043A\u0442)").option("-w, --wait", "\u0434\u043E\u0436\u0434\u0430\u0442\u044C\u0441\u044F \u0433\u043E\u0442\u043E\u0432\u043D\u043E\u0441\u0442\u0438 \u0438 \u0441\u043A\u0430\u0447\u0430\u0442\u044C \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442", false).option("--wait-timeout <duration>", "\u043B\u0438\u043C\u0438\u0442 \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F, \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 10m", "20m").option("-o, --out <dir>", "\u043F\u0430\u043F\u043A\u0430 \u0434\u043B\u044F \u0444\u0430\u0439\u043B\u043E\u0432", ".").option("--open", "\u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0444\u0430\u0439\u043B \u043F\u043E\u0441\u043B\u0435 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F", false).option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).addHelpText(
|
|
2058
|
+
"after",
|
|
2059
|
+
`
|
|
2060
|
+
\u041F\u0440\u0438\u043C\u0435\u0440:
|
|
2061
|
+
$ artillect generate upscale --model topaz-image --image ./photo.png --wait
|
|
2062
|
+
`
|
|
2063
|
+
).action(
|
|
2064
|
+
async (opts) => {
|
|
2065
|
+
await cmdGenerateUpscale({
|
|
2066
|
+
model: opts.model,
|
|
2067
|
+
image: opts.image,
|
|
2068
|
+
video: opts.video,
|
|
2069
|
+
enhancementModel: opts.enhancementModel,
|
|
2070
|
+
projectId: opts.project,
|
|
2071
|
+
upscaleFactor: opts.upscaleFactor,
|
|
2072
|
+
creativity: opts.creativity,
|
|
2073
|
+
prompt: opts.prompt,
|
|
2074
|
+
safetyTolerance: opts.safetyTolerance,
|
|
2075
|
+
duration: opts.duration,
|
|
2076
|
+
width: opts.width,
|
|
2077
|
+
height: opts.height,
|
|
2078
|
+
outputFormat: opts.outputFormat,
|
|
2079
|
+
cropToFill: opts.cropToFill == null ? void 0 : opts.cropToFill !== "false",
|
|
2080
|
+
faceEnhancement: opts.faceEnhancement == null ? void 0 : opts.faceEnhancement !== "false",
|
|
2081
|
+
faceEnhancementStrength: opts.faceEnhancementStrength,
|
|
2082
|
+
faceEnhancementCreativity: opts.faceEnhancementCreativity,
|
|
2083
|
+
billingSource: opts.billingSource,
|
|
2084
|
+
tagIds: parseTagIds(opts.tagId),
|
|
2085
|
+
idempotencyKey: opts.idempotencyKey,
|
|
2086
|
+
extra: opts.extra,
|
|
2087
|
+
wait: Boolean(opts.wait),
|
|
2088
|
+
waitTimeout: opts.waitTimeout,
|
|
2089
|
+
json: Boolean(opts.json),
|
|
2090
|
+
out: opts.out,
|
|
2091
|
+
open: Boolean(opts.open)
|
|
2092
|
+
});
|
|
2093
|
+
}
|
|
2094
|
+
);
|
|
1327
2095
|
generate.command("get").description("\u0421\u0442\u0430\u0442\u0443\u0441 \u0437\u0430\u0434\u0430\u0447\u0438").argument("<task_id>", "id \u0438\u0437 generate").option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(async (taskId, opts) => {
|
|
1328
2096
|
await cmdGenerateGet(taskId, Boolean(opts.json));
|
|
1329
2097
|
});
|
|
@@ -1341,8 +2109,9 @@ generate.command("wait").description("\u0414\u043E\u0436\u0434\u0430\u0442\u044C
|
|
|
1341
2109
|
generate.command("cancel").description("\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u0437\u0430\u0434\u0430\u0447\u0443").argument("<task_id>", "id \u0438\u0437 generate").option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(async (taskId, opts) => {
|
|
1342
2110
|
await cmdGenerateCancel(taskId, Boolean(opts.json));
|
|
1343
2111
|
});
|
|
1344
|
-
generate.command("list").description("\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u0438").option("-k, --kind <kind>", "image | video", "image").option("--limit <n>", "\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0441\u0442\u0440\u043E\u043A", "20").option("--cursor <id>", "\u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u043F\u043E\u0441\u043B\u0435 \u044D\u0442\u043E\u0433\u043E task_id").option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(async (opts) => {
|
|
1345
|
-
const kind = opts.kind
|
|
2112
|
+
generate.command("list").description("\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u0438").option("-k, --kind <kind>", "image | video | audio | upscale | switchx | mesh", "image").option("--limit <n>", "\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0441\u0442\u0440\u043E\u043A", "20").option("--cursor <id>", "\u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u043F\u043E\u0441\u043B\u0435 \u044D\u0442\u043E\u0433\u043E task_id").option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(async (opts) => {
|
|
2113
|
+
const kind = ["image", "video", "audio", "upscale", "switchx", "mesh"].includes(opts.kind || "") ? opts.kind : null;
|
|
2114
|
+
if (!kind) throw new Error("--kind: image | video | audio | upscale | switchx | mesh");
|
|
1346
2115
|
await cmdGenerateList({
|
|
1347
2116
|
kind,
|
|
1348
2117
|
json: Boolean(opts.json),
|
|
@@ -1385,6 +2154,73 @@ projects.command("list").description("\u0421\u043F\u0438\u0441\u043E\u043A \u043
|
|
|
1385
2154
|
json: Boolean(opts.json)
|
|
1386
2155
|
});
|
|
1387
2156
|
});
|
|
2157
|
+
for (const [name, description, operation] of [
|
|
2158
|
+
["get", "\u041F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u043F\u0440\u043E\u0435\u043A\u0442", "get"],
|
|
2159
|
+
["create", "\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u043F\u0440\u043E\u0435\u043A\u0442", "create"],
|
|
2160
|
+
["update", "\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u0440\u043E\u0435\u043A\u0442", "update"],
|
|
2161
|
+
["delete", "\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043F\u0440\u043E\u0435\u043A\u0442", "delete"],
|
|
2162
|
+
["roles", "\u0420\u043E\u043B\u0438 \u043F\u0440\u043E\u0435\u043A\u0442\u0430", "roles"],
|
|
2163
|
+
["members", "\u0423\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0438 \u043F\u0440\u043E\u0435\u043A\u0442\u0430", "members"],
|
|
2164
|
+
["invite", "\u041F\u0440\u0438\u0433\u043B\u0430\u0441\u0438\u0442\u044C \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430", "invite"],
|
|
2165
|
+
["update-member", "\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u0440\u043E\u043B\u044C \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430", "update-member"],
|
|
2166
|
+
["remove-member", "\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430", "remove-member"],
|
|
2167
|
+
["leave", "\u041F\u043E\u043A\u0438\u043D\u0443\u0442\u044C \u043F\u0440\u043E\u0435\u043A\u0442", "leave"],
|
|
2168
|
+
["analytics", "\u0410\u043D\u0430\u043B\u0438\u0442\u0438\u043A\u0430 \u043F\u0440\u043E\u0435\u043A\u0442\u0430", "analytics"],
|
|
2169
|
+
["billing", "\u0411\u0438\u043B\u043B\u0438\u043D\u0433 \u043F\u0440\u043E\u0435\u043A\u0442\u0430", "billing"]
|
|
2170
|
+
]) {
|
|
2171
|
+
const command = projects.command(name).description(description).option("--json");
|
|
2172
|
+
if (!["roles"].includes(name)) command.option("--id <id>", "id \u043F\u0440\u043E\u0435\u043A\u0442\u0430");
|
|
2173
|
+
if (["create", "update", "invite", "update-member"].includes(name))
|
|
2174
|
+
command.requiredOption("--body <json>", "JSON-\u0442\u0435\u043B\u043E");
|
|
2175
|
+
if (["update-member", "remove-member"].includes(name))
|
|
2176
|
+
command.requiredOption("--user <id>", "id \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F");
|
|
2177
|
+
command.action((opts) => cmdProjectOperation(operation, opts));
|
|
2178
|
+
}
|
|
2179
|
+
projects.command("generations").description("\u041B\u0435\u043D\u0442\u0430 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u0439 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 \u0441 \u0444\u0438\u043B\u044C\u0442\u0440\u0430\u043C\u0438").requiredOption("--id <id>", "id \u043F\u0440\u043E\u0435\u043A\u0442\u0430").option("--limit <n>").option("--cursor <id>").option("--kind <kind>").option("--source <source>").option("--date <YYYY-MM-DD>").option("--date-from <YYYY-MM-DD>").option("--date-to <YYYY-MM-DD>").option("--before-created-at <iso>").option("-q, --query <text>").option("--tag-ids <ids>").option("--json").action((opts) => cmdApiOperation("project-generations", opts));
|
|
2180
|
+
program.command("folders").description("\u041F\u0430\u043F\u043A\u0438 \u043F\u0440\u043E\u0435\u043A\u0442\u043E\u0432").option("--json").action((opts) => cmdApiOperation("folders", opts));
|
|
2181
|
+
program.command("folder-create").description("\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u043F\u0430\u043F\u043A\u0443").requiredOption("--name <name>").option("--parent-id <id>").option("--json").action((opts) => cmdApiOperation("folder-create", opts));
|
|
2182
|
+
var tags = program.command("tags").description("\u0422\u0435\u0433\u0438 \u043F\u0440\u043E\u0435\u043A\u0442\u0430");
|
|
2183
|
+
tags.command("list").requiredOption("--project <id>").option("--json").action((opts) => cmdApiOperation("tags", opts));
|
|
2184
|
+
tags.command("create").requiredOption("--project <id>").requiredOption("--name <name>").option("--color <color>").option("--json").action((opts) => cmdApiOperation("tag-create", opts));
|
|
2185
|
+
tags.command("delete").requiredOption("--project <id>").requiredOption("--tag <id>").option("--json").action((opts) => cmdApiOperation("tag-delete", opts));
|
|
2186
|
+
program.command("favorites").description("\u0418\u0437\u0431\u0440\u0430\u043D\u043D\u044B\u0435 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u0438 \u043F\u0440\u043E\u0435\u043A\u0442\u0430").requiredOption("--project <id>").option("--limit <n>").option("--cursor <id>").option("--json").action((opts) => cmdApiOperation("favorites", opts));
|
|
2187
|
+
var chat = program.command("chat").description("LLM chat \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043D\u044B\u0435 \u0442\u0440\u0435\u0434\u044B");
|
|
2188
|
+
chat.command("completion").requiredOption("--body <json>").option("--json").action((opts) => cmdChatOperation("completion", opts));
|
|
2189
|
+
chat.command("send").requiredOption("--id <id>").requiredOption("--body <json>").option("--json").action((opts) => cmdChatOperation("send", opts));
|
|
2190
|
+
chat.command("list").option("--json").action((opts) => cmdChatOperation("list", opts));
|
|
2191
|
+
chat.command("create").option("--body <json>").option("--json").action((opts) => cmdChatOperation("create", opts));
|
|
2192
|
+
chat.command("messages").requiredOption("--id <id>").option("--limit <n>").option("--cursor <id>").option("--json").action((opts) => cmdChatOperation("messages", opts));
|
|
2193
|
+
chat.command("delete").requiredOption("--id <id>").option("--json").action((opts) => cmdChatOperation("delete", opts));
|
|
2194
|
+
var webhook = program.command("webhook").description("\u0418\u0441\u0445\u043E\u0434\u044F\u0449\u0438\u0435 webhook-\u0438");
|
|
2195
|
+
webhook.command("get").option("--json").action((opts) => cmdWebhookOperation("get", opts));
|
|
2196
|
+
webhook.command("upsert").requiredOption("--url <https>").option("--include-studio").option("--json").action((opts) => cmdWebhookOperation("upsert", opts));
|
|
2197
|
+
webhook.command("delete").option("--json").action((opts) => cmdWebhookOperation("delete", opts));
|
|
2198
|
+
webhook.command("rotate").option("--json").action((opts) => cmdWebhookOperation("rotate", opts));
|
|
2199
|
+
webhook.command("deliveries").option("--limit <n>").option("--cursor <id>").option("--json").action((opts) => cmdWebhookOperation("deliveries", opts));
|
|
2200
|
+
webhook.command("delivery").requiredOption("--id <id>").option("--json").action((opts) => cmdWebhookOperation("delivery", opts));
|
|
2201
|
+
var generation = program.command("generation").description("\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u0441 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u044F\u043C\u0438 \u0432 \u043F\u0440\u043E\u0435\u043A\u0442\u0430\u0445");
|
|
2202
|
+
for (const [name, operation, description] of [
|
|
2203
|
+
["tags", "generation-tags", "\u041D\u0430\u0437\u043D\u0430\u0447\u0438\u0442\u044C \u0442\u0435\u0433\u0438"],
|
|
2204
|
+
["like", "generation-like", "\u041B\u0430\u0439\u043A \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u0438"],
|
|
2205
|
+
["copy", "generation-copy", "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432 \u043F\u0440\u043E\u0435\u043A\u0442"],
|
|
2206
|
+
["move", "generation-move", "\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u0432 \u043F\u0440\u043E\u0435\u043A\u0442"],
|
|
2207
|
+
["delete", "generation-delete", "\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u044E"]
|
|
2208
|
+
]) {
|
|
2209
|
+
const command = generation.command(name).description(description).requiredOption("--project <id>").requiredOption("--generation <id>").option("--json");
|
|
2210
|
+
if (["generation-tags", "generation-like"].includes(operation))
|
|
2211
|
+
command.requiredOption("--body <json>");
|
|
2212
|
+
if (["generation-copy", "generation-move"].includes(operation))
|
|
2213
|
+
command.requiredOption("--destination <id>");
|
|
2214
|
+
command.action((opts) => cmdLibraryOperation(operation, opts));
|
|
2215
|
+
}
|
|
2216
|
+
var elementActions = program.command("element").description("\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C Element Library");
|
|
2217
|
+
elementActions.command("update").requiredOption("--project <id>").requiredOption("--element <id>").requiredOption("--body <json>").option("--json").action((opts) => cmdLibraryOperation("element-update", opts));
|
|
2218
|
+
elementActions.command("delete").requiredOption("--project <id>").requiredOption("--element <id>").option("--json").action((opts) => cmdLibraryOperation("element-delete", opts));
|
|
2219
|
+
elementActions.command("reorder").requiredOption("--project <id>").requiredOption("--body <json>").option("--json").action((opts) => cmdLibraryOperation("element-reorder", opts));
|
|
2220
|
+
var media = program.command("media").description("\u0410\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u044B\u0435 trim/concat \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438");
|
|
2221
|
+
media.command("edit").requiredOption("--body <json>").option("--json").action((opts) => cmdLibraryOperation("media-edit", opts));
|
|
2222
|
+
media.command("get").requiredOption("--id <id>").option("--json").action((opts) => cmdLibraryOperation("media-get", opts));
|
|
2223
|
+
media.command("cancel").requiredOption("--id <id>").option("--json").action((opts) => cmdLibraryOperation("media-cancel", opts));
|
|
1388
2224
|
var elements = program.command("elements").description("Element library \u043F\u0440\u043E\u0435\u043A\u0442\u0430 (@Name)");
|
|
1389
2225
|
elements.command("list").description("\u042D\u043B\u0435\u043C\u0435\u043D\u0442\u044B \u043F\u0440\u043E\u0435\u043A\u0442\u0430").requiredOption("--project <id>", "id \u043F\u0440\u043E\u0435\u043A\u0442\u0430").option("--kinds <kinds>", "image,video").option("--limit <n>", "\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0441\u0442\u0440\u043E\u043A", "50").option("--cursor <id>", "\u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u043F\u043E\u0441\u043B\u0435 \u044D\u0442\u043E\u0433\u043E id").option("--json", "\u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u044B\u0440\u043E\u0439 JSON", false).action(
|
|
1390
2226
|
async (opts) => {
|