@meshy-ai/cli 0.4.6 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/README.md +7 -6
  2. package/dist/client/endpoints/balance.d.ts +4 -3
  3. package/dist/client/endpoints/balance.d.ts.map +1 -1
  4. package/dist/client/endpoints/balance.js +10 -12
  5. package/dist/client/endpoints/balance.js.map +1 -1
  6. package/dist/client/endpoints/base.d.ts +0 -2
  7. package/dist/client/endpoints/base.d.ts.map +1 -1
  8. package/dist/client/endpoints/base.js.map +1 -1
  9. package/dist/client/index.d.ts +0 -6
  10. package/dist/client/index.d.ts.map +1 -1
  11. package/dist/client/index.js +2 -22
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/client/resource-registry.d.ts +2 -9
  14. package/dist/client/resource-registry.d.ts.map +1 -1
  15. package/dist/client/resource-registry.js +5 -14
  16. package/dist/client/resource-registry.js.map +1 -1
  17. package/dist/client/transport.d.ts +1 -1
  18. package/dist/client/transport.d.ts.map +1 -1
  19. package/dist/client/types.d.ts +4 -26
  20. package/dist/client/types.d.ts.map +1 -1
  21. package/dist/client/types.js +4 -31
  22. package/dist/client/types.js.map +1 -1
  23. package/dist/cmd/animation-catalog.js +4 -4
  24. package/dist/cmd/animation-catalog.js.map +1 -1
  25. package/dist/cmd/api.d.ts.map +1 -1
  26. package/dist/cmd/api.js +5 -5
  27. package/dist/cmd/api.js.map +1 -1
  28. package/dist/cmd/auth.d.ts.map +1 -1
  29. package/dist/cmd/auth.js +41 -25
  30. package/dist/cmd/auth.js.map +1 -1
  31. package/dist/cmd/auto-split.d.ts.map +1 -1
  32. package/dist/cmd/auto-split.js +0 -1
  33. package/dist/cmd/auto-split.js.map +1 -1
  34. package/dist/cmd/balance.d.ts.map +1 -1
  35. package/dist/cmd/balance.js +6 -6
  36. package/dist/cmd/balance.js.map +1 -1
  37. package/dist/cmd/creative-lab.d.ts +0 -2
  38. package/dist/cmd/creative-lab.d.ts.map +1 -1
  39. package/dist/cmd/creative-lab.js +0 -7
  40. package/dist/cmd/creative-lab.js.map +1 -1
  41. package/dist/cmd/delete.d.ts.map +1 -1
  42. package/dist/cmd/delete.js +4 -4
  43. package/dist/cmd/delete.js.map +1 -1
  44. package/dist/cmd/doctor.js +4 -4
  45. package/dist/cmd/doctor.js.map +1 -1
  46. package/dist/cmd/download.d.ts +1 -1
  47. package/dist/cmd/download.js +9 -9
  48. package/dist/cmd/download.js.map +1 -1
  49. package/dist/cmd/image-to-3d.d.ts +3 -3
  50. package/dist/cmd/image-to-3d.d.ts.map +1 -1
  51. package/dist/cmd/image-to-3d.js +16 -45
  52. package/dist/cmd/image-to-3d.js.map +1 -1
  53. package/dist/cmd/image-to-image.d.ts.map +1 -1
  54. package/dist/cmd/image-to-image.js +2 -1
  55. package/dist/cmd/image-to-image.js.map +1 -1
  56. package/dist/cmd/inspect.d.ts +12 -4
  57. package/dist/cmd/inspect.d.ts.map +1 -1
  58. package/dist/cmd/inspect.js +63 -39
  59. package/dist/cmd/inspect.js.map +1 -1
  60. package/dist/cmd/make.d.ts.map +1 -1
  61. package/dist/cmd/make.js +51 -112
  62. package/dist/cmd/make.js.map +1 -1
  63. package/dist/cmd/mesh.d.ts +3 -3
  64. package/dist/cmd/mesh.js +5 -5
  65. package/dist/cmd/mesh.js.map +1 -1
  66. package/dist/cmd/multi-image-to-3d.d.ts +2 -3
  67. package/dist/cmd/multi-image-to-3d.d.ts.map +1 -1
  68. package/dist/cmd/multi-image-to-3d.js +10 -28
  69. package/dist/cmd/multi-image-to-3d.js.map +1 -1
  70. package/dist/cmd/operations.js +6 -6
  71. package/dist/cmd/operations.js.map +1 -1
  72. package/dist/cmd/project.d.ts.map +1 -1
  73. package/dist/cmd/project.js +11 -13
  74. package/dist/cmd/project.js.map +1 -1
  75. package/dist/cmd/resources.d.ts +4 -4
  76. package/dist/cmd/resources.d.ts.map +1 -1
  77. package/dist/cmd/resources.js +6 -15
  78. package/dist/cmd/resources.js.map +1 -1
  79. package/dist/cmd/retexture.d.ts +2 -2
  80. package/dist/cmd/retexture.js +2 -2
  81. package/dist/cmd/showcases.d.ts.map +1 -1
  82. package/dist/cmd/showcases.js +4 -4
  83. package/dist/cmd/showcases.js.map +1 -1
  84. package/dist/cmd/slicer.js +4 -4
  85. package/dist/cmd/slicer.js.map +1 -1
  86. package/dist/cmd/text-to-3d.d.ts +1 -1
  87. package/dist/cmd/text-to-3d.js +1 -1
  88. package/dist/cmd/text-to-image.d.ts.map +1 -1
  89. package/dist/cmd/text-to-image.js +3 -2
  90. package/dist/cmd/text-to-image.js.map +1 -1
  91. package/dist/cmd/usage.js +4 -4
  92. package/dist/cmd/usage.js.map +1 -1
  93. package/dist/cmd/uv-unwrap.d.ts +0 -1
  94. package/dist/cmd/uv-unwrap.d.ts.map +1 -1
  95. package/dist/cmd/uv-unwrap.js +0 -2
  96. package/dist/cmd/uv-unwrap.js.map +1 -1
  97. package/dist/index.d.ts +1 -1
  98. package/dist/index.js +22 -53
  99. package/dist/index.js.map +1 -1
  100. package/dist/internal/artifacts.d.ts +18 -9
  101. package/dist/internal/artifacts.d.ts.map +1 -1
  102. package/dist/internal/artifacts.js +56 -30
  103. package/dist/internal/artifacts.js.map +1 -1
  104. package/dist/internal/command-helpers.d.ts +9 -16
  105. package/dist/internal/command-helpers.d.ts.map +1 -1
  106. package/dist/internal/command-helpers.js +14 -31
  107. package/dist/internal/command-helpers.js.map +1 -1
  108. package/dist/internal/config.d.ts +3 -3
  109. package/dist/internal/config.js +3 -3
  110. package/dist/internal/context.d.ts +3 -5
  111. package/dist/internal/context.d.ts.map +1 -1
  112. package/dist/internal/context.js +3 -3
  113. package/dist/internal/context.js.map +1 -1
  114. package/dist/internal/doctor.d.ts +0 -2
  115. package/dist/internal/doctor.d.ts.map +1 -1
  116. package/dist/internal/doctor.js +0 -4
  117. package/dist/internal/doctor.js.map +1 -1
  118. package/dist/internal/download.d.ts +34 -50
  119. package/dist/internal/download.d.ts.map +1 -1
  120. package/dist/internal/download.js +83 -331
  121. package/dist/internal/download.js.map +1 -1
  122. package/dist/internal/errors.d.ts +2 -20
  123. package/dist/internal/errors.d.ts.map +1 -1
  124. package/dist/internal/errors.js +9 -88
  125. package/dist/internal/errors.js.map +1 -1
  126. package/dist/internal/file-input.d.ts +0 -12
  127. package/dist/internal/file-input.d.ts.map +1 -1
  128. package/dist/internal/file-input.js +2 -49
  129. package/dist/internal/file-input.js.map +1 -1
  130. package/dist/internal/global-options.d.ts +4 -1
  131. package/dist/internal/global-options.d.ts.map +1 -1
  132. package/dist/internal/global-options.js +9 -2
  133. package/dist/internal/global-options.js.map +1 -1
  134. package/dist/internal/image-models.d.ts +7 -0
  135. package/dist/internal/image-models.d.ts.map +1 -1
  136. package/dist/internal/image-models.js +14 -0
  137. package/dist/internal/image-models.js.map +1 -1
  138. package/dist/internal/inspect.d.ts +31 -6
  139. package/dist/internal/inspect.d.ts.map +1 -1
  140. package/dist/internal/inspect.js +125 -12
  141. package/dist/internal/inspect.js.map +1 -1
  142. package/dist/internal/logger.d.ts +0 -1
  143. package/dist/internal/logger.d.ts.map +1 -1
  144. package/dist/internal/logger.js +0 -3
  145. package/dist/internal/logger.js.map +1 -1
  146. package/dist/internal/material-links.d.ts +0 -2
  147. package/dist/internal/material-links.d.ts.map +1 -1
  148. package/dist/internal/material-links.js +0 -4
  149. package/dist/internal/material-links.js.map +1 -1
  150. package/dist/internal/obj-transform.d.ts +1 -1
  151. package/dist/internal/obj-transform.js +1 -1
  152. package/dist/internal/output.d.ts +4 -13
  153. package/dist/internal/output.d.ts.map +1 -1
  154. package/dist/internal/output.js +5 -26
  155. package/dist/internal/output.js.map +1 -1
  156. package/dist/internal/paths.d.ts +2 -0
  157. package/dist/internal/paths.d.ts.map +1 -1
  158. package/dist/internal/paths.js +4 -0
  159. package/dist/internal/paths.js.map +1 -1
  160. package/dist/internal/pricing.d.ts +1 -1
  161. package/dist/internal/pricing.d.ts.map +1 -1
  162. package/dist/internal/pricing.js +1 -1
  163. package/dist/internal/pricing.js.map +1 -1
  164. package/dist/internal/project-store.d.ts +6 -13
  165. package/dist/internal/project-store.d.ts.map +1 -1
  166. package/dist/internal/project-store.js +23 -27
  167. package/dist/internal/project-store.js.map +1 -1
  168. package/dist/internal/result.d.ts +1 -2
  169. package/dist/internal/result.d.ts.map +1 -1
  170. package/dist/internal/result.js +1 -1
  171. package/dist/internal/result.js.map +1 -1
  172. package/dist/internal/runtime.d.ts +3 -19
  173. package/dist/internal/runtime.d.ts.map +1 -1
  174. package/dist/internal/runtime.js +12 -35
  175. package/dist/internal/runtime.js.map +1 -1
  176. package/dist/internal/slicers.d.ts +7 -8
  177. package/dist/internal/slicers.d.ts.map +1 -1
  178. package/dist/internal/slicers.js +7 -8
  179. package/dist/internal/slicers.js.map +1 -1
  180. package/dist/internal/task-command.d.ts +18 -14
  181. package/dist/internal/task-command.d.ts.map +1 -1
  182. package/dist/internal/task-command.js +53 -201
  183. package/dist/internal/task-command.js.map +1 -1
  184. package/dist/internal/task-view.js +1 -1
  185. package/dist/internal/task-view.js.map +1 -1
  186. package/dist/internal/texturing.d.ts +17 -0
  187. package/dist/internal/texturing.d.ts.map +1 -0
  188. package/dist/internal/texturing.js +30 -0
  189. package/dist/internal/texturing.js.map +1 -0
  190. package/dist/internal/update-notifier.d.ts +5 -25
  191. package/dist/internal/update-notifier.d.ts.map +1 -1
  192. package/dist/internal/update-notifier.js +5 -58
  193. package/dist/internal/update-notifier.js.map +1 -1
  194. package/dist/internal/views.d.ts +8 -10
  195. package/dist/internal/views.d.ts.map +1 -1
  196. package/dist/internal/views.js +61 -29
  197. package/dist/internal/views.js.map +1 -1
  198. package/dist/root.d.ts +0 -5
  199. package/dist/root.d.ts.map +1 -1
  200. package/dist/root.js +6 -24
  201. package/dist/root.js.map +1 -1
  202. package/package.json +1 -1
  203. package/skills/meshy-cli/SKILL.md +53 -49
  204. package/dist/internal/report.d.ts +0 -40
  205. package/dist/internal/report.d.ts.map +0 -1
  206. package/dist/internal/report.js +0 -48
  207. package/dist/internal/report.js.map +0 -1
@@ -3,14 +3,11 @@
3
3
  * subcommands for any registered task resource. Per-resource modules only
4
4
  * contribute their unique `create` flag shape and payload validation.
5
5
  *
6
- * Two output schemas share one execution path:
7
- * legacy — the 0.2.0 payloads and `-o` status report, with two documented
8
- * fixes: `get` of a non-terminal task exits 0, and async create
9
- * never polls.
10
- * v1 — one `meshy.cli/v1` envelope whose result carries the TaskView,
11
- * the submission record and the download manifest.
6
+ * Every verb prints one `meshy.cli/v1` envelope whose result carries the
7
+ * TaskView, the submission record and the download manifest. `get` of a task
8
+ * in any status is a successful query (exit 0); async create never polls.
12
9
  *
13
- * Money rules enforced here, independent of schema:
10
+ * Money rules enforced here:
14
11
  * - every create is exactly one POST, journaled before it is sent;
15
12
  * - a lost or malformed response is `submission_unknown` (exit 10), never a
16
13
  * retry and never a "please run it again" hint;
@@ -26,34 +23,32 @@ import { Command, Option } from "commander";
26
23
  import { MeshyApiError } from "../client/errors.js";
27
24
  import { requireTaskResource } from "../client/resource-registry.js";
28
25
  import { TransportError } from "../client/transport.js";
29
- import { isTerminalStatus, summarizeTask } from "../client/types.js";
30
- import { emitResult, openCommand, rejectOutputFlagForV1, saveRawJson } from "./command-helpers.js";
26
+ import { emitResult, openCommand, rejectOutputFlag, saveRawJson } from "./command-helpers.js";
31
27
  import { abortSignal, wasInterrupted } from "./context.js";
32
- import { downloadArtifacts, looksLikeFile } from "./download.js";
28
+ import { downloadTaskAssets } from "./download.js";
33
29
  import { classifyError, CliError, UsageError } from "./errors.js";
34
30
  import { normalizeMediaPayload } from "./file-input.js";
31
+ import { allAssetsOption, outputOption } from "./global-options.js";
35
32
  import { logger } from "./logger.js";
36
33
  import { mergeNestedObjects, mergePayload, parseJsonFlag } from "./payload.js";
37
- import { painterFor } from "./color.js";
38
- import { taskCard } from "./views.js";
39
- import { emitEnvelope, emitStreamEvent, emit } from "./output.js";
34
+ import { emitEnvelope, emitStreamEvent } from "./output.js";
40
35
  import { parseTimeoutSeconds, pollUntilTerminal } from "./poll.js";
41
36
  import { createProgress, withSpinner } from "./progress.js";
42
- import { printReport } from "./report.js";
43
37
  import { errorEnvelope, okEnvelope, warning } from "./result.js";
44
38
  import { buildRuntime } from "./runtime.js";
45
- import { getUpdateNotice, printHumanUpdateHint } from "./update-notifier.js";
46
39
  import { streamTask } from "./stream.js";
47
40
  import { toTaskView } from "./task-view.js";
48
41
  import { beginOperation, credentialBinding, credentialFingerprint, newOperationId, operationsRoot, payloadFingerprint, updateOperation, } from "./operation-store.js";
49
42
  import { originOf } from "./config.js";
50
- import { resolveWithinRoot, freezeRoot } from "./paths.js";
43
+ import { freezeRoot, looksLikeFile, resolveWithinRoot } from "./paths.js";
51
44
  import { assertProjectMetadataPresent, indexRootFor, projectRecordCommand, recordTask, saveTaskSnapshot, stageFromTaskType } from "./project-store.js";
52
45
  import { existsSync } from "node:fs";
53
46
  import { dirname, join, resolve as resolvePath } from "node:path";
54
47
  const TASK_JSON_OPTIONS = (cmd) => cmd
48
+ .addOption(outputOption())
49
+ .addOption(allAssetsOption())
55
50
  .option("--save-json <file>", "save the full task JSON as received (never overwrites)")
56
- .option("--include-raw", "v1: include the untouched task response under result.task.raw")
51
+ .option("--include-raw", "include the untouched task response under result.task.raw")
57
52
  .option("--project <dir>", "initialised meshy_output project: save task_<id>.json there and record the task in metadata.json")
58
53
  .option("--stage <name>", "stage label for the project record (default: derived from the task type, e.g. preview | refine | build)");
59
54
  const NOT_REQUESTED = () => ({ state: "not_requested", files: [], metadata_path: null });
@@ -69,9 +64,9 @@ function taskResult(o) {
69
64
  function nextCommands(descriptor, taskId) {
70
65
  const base = `meshy ${descriptor.commandPath.join(" ")}`;
71
66
  return {
72
- get: `${base} get ${taskId} --output-schema v1`,
73
- wait: `${base} wait ${taskId} --output-schema v1`,
74
- stream: `${base} stream ${taskId} --format ndjson --output-schema v1`,
67
+ get: `${base} get ${taskId}`,
68
+ wait: `${base} wait ${taskId}`,
69
+ stream: `${base} stream ${taskId} --format ndjson`,
75
70
  };
76
71
  }
77
72
  /**
@@ -196,7 +191,7 @@ function attachToProject(opts, opened, descriptor, taskId, task, raw, extra, war
196
191
  stage,
197
192
  resource: descriptor.id,
198
193
  taskType: task?.type ?? null,
199
- endpoint: descriptor.legacyEndpoint,
194
+ endpoint: descriptor.endpoint,
200
195
  parentTaskId: parentTaskIdFromPayload(extra.payload ?? null),
201
196
  status: task?.status ?? null,
202
197
  taskJson: null,
@@ -228,8 +223,6 @@ function attachToProject(opts, opened, descriptor, taskId, task, raw, extra, war
228
223
  const rec = recordTask(located, input, { root: indexRoot.root, skipIndex: indexRoot.skipIndex });
229
224
  if (!rec.index.updated)
230
225
  warnings.push(warning("index_dirty", `metadata.json committed but history.json was not updated: ${rec.index.error}; run \`meshy project rebuild-index\``));
231
- if (rec.migrated_from_legacy)
232
- warnings.push(warning("metadata_migrated", "legacy metadata.json migrated to schema_version 2 (backup kept beside it)"));
233
226
  return { project_dir: projectDir, snapshot: snapshot?.path ?? null, stage, action: rec.action, index: rec.index };
234
227
  }
235
228
  catch (err) {
@@ -349,7 +342,6 @@ export function buildResourceCommand(spec) {
349
342
  const descriptor = requireTaskResource(spec.name);
350
343
  const endpointOf = spec.endpointOf ?? ((client) => client.endpointFor(descriptor));
351
344
  const prefix = spec.commandPrefix ?? spec.name;
352
- const defaultSchema = spec.defaultSchema ?? "legacy";
353
345
  const cmd = new Command(spec.commandName ?? spec.name).description(spec.description);
354
346
  // create
355
347
  const createCmd = new Command("create").description(spec.create.description);
@@ -360,7 +352,7 @@ export function buildResourceCommand(spec) {
360
352
  .addOption(new Option("--timeout <seconds>", "max seconds to poll in sync mode; the task keeps running after it (resume with `wait`; the API advises allowing up to 60 min)").default("600"))
361
353
  .addOption(new Option("--operation-id <id>", "local journal id for this submission; repeating it returns the recorded outcome instead of submitting again (local record only, not a server idempotency key)"))
362
354
  .action(async (opts, thisCmd) => {
363
- const opened = openCommand(thisCmd, `${prefix}.create`, defaultSchema);
355
+ const opened = openCommand(thisCmd, `${prefix}.create`);
364
356
  const timeoutSeconds = parseTimeoutSeconds(opts.timeout ?? "600");
365
357
  const runAsync = Boolean(opts.async);
366
358
  const includeRaw = Boolean(opts.includeRaw);
@@ -369,45 +361,36 @@ export function buildResourceCommand(spec) {
369
361
  // 1. Build and validate the payload — every local failure happens here, before the journal and the POST.
370
362
  const data = parseJsonFlag(opts.data, "--data");
371
363
  const flagPayload = spec.create.toPayload(opts);
372
- const defaults = spec.create.toDefaults?.(opts) ?? {};
364
+ const defaults = spec.create.toDefaults?.(opts, data) ?? {};
373
365
  const layers = [defaults, data, flagPayload];
374
366
  let merged = mergePayload(...layers);
375
367
  if (spec.create.nestedObjectKeys && spec.create.nestedObjectKeys.length > 0) {
376
368
  merged = mergeNestedObjects(merged, layers, spec.create.nestedObjectKeys);
377
369
  }
378
370
  spec.create.validatePayload?.(merged, opts);
371
+ const payloadWarnings = spec.create.warnPayload?.(merged) ?? [];
379
372
  const { payload } = await normalizeMediaPayload(merged, descriptor.mediaFields, { signal: abortSignal() });
380
373
  logger.debug("create payload", redactForLog(payload));
381
374
  // 2. Local targets that would fail after the POST are refused before it.
382
375
  preflightLocalTargets(opts, opened);
383
376
  // 3. Journal, then exactly one POST.
384
377
  const submitted = await submitCreate(runtime, descriptor, endpoint, payload, opts.operationId ?? null);
385
- const { taskId, raw: createRaw, operationId, warnings } = submitted;
378
+ const { taskId, raw: createRaw, operationId } = submitted;
379
+ const warnings = [...payloadWarnings, ...submitted.warnings];
386
380
  const submission = { state: "accepted", operation_id: operationId, task_id: taskId, request_id: submitted.requestId };
387
381
  if (runAsync) {
388
382
  const ctx = { descriptor, taskId, task: null, raw: null, submission, includeRaw };
389
383
  const savedJson = saveJsonInContext(opts, opened, createRaw, ctx);
390
384
  const project = attachInContext(opts, opened, descriptor, taskId, null, null, { operationId, payload }, warnings, { ...ctx, savedJson });
391
- if (opened.schema === "v1") {
392
- await emitEnvelope(okEnvelope(opened.command, taskResult({
393
- task: null,
394
- raw: null,
395
- descriptor,
396
- includeRaw: false,
397
- submission,
398
- savedJson,
399
- extra: { task_id: taskId, next: nextCommands(descriptor, taskId), project },
400
- }), warnings), opened.format);
401
- return;
402
- }
403
- emit({
404
- resource: spec.name,
405
- task_id: taskId,
406
- status: "PENDING",
407
- hint: `meshy-cli ${descriptor.commandPath.join(" ")} wait ${taskId}`,
408
- operation_id: operationId,
409
- ...(project ? { project_dir: project.project_dir } : {}),
410
- }, { format: opened.format, file: undefined });
385
+ await emitEnvelope(okEnvelope(opened.command, taskResult({
386
+ task: null,
387
+ raw: null,
388
+ descriptor,
389
+ includeRaw: false,
390
+ submission,
391
+ savedJson,
392
+ extra: { task_id: taskId, next: nextCommands(descriptor, taskId), project },
393
+ }), warnings), opened.format);
411
394
  return;
412
395
  }
413
396
  // 4. Sync: poll the id we just recorded.
@@ -416,7 +399,7 @@ export function buildResourceCommand(spec) {
416
399
  cmd.addCommand(createCmd);
417
400
  // get
418
401
  TASK_JSON_OPTIONS(cmd.command("get <task-id>").description("Retrieve a single task by id (any status is a successful query)")).action(async (taskId, opts, thisCmd) => {
419
- const opened = openCommand(thisCmd, `${prefix}.get`, defaultSchema);
402
+ const opened = openCommand(thisCmd, `${prefix}.get`);
420
403
  beginProjectContext(opts, opened);
421
404
  const runtime = await buildRuntime(opened.flags);
422
405
  const { task, raw } = await endpointOf(runtime.client).retrieveDetailed(taskId, { signal: abortSignal() });
@@ -426,25 +409,16 @@ export function buildResourceCommand(spec) {
426
409
  const ctx = { descriptor, taskId, task, raw, submission, includeRaw };
427
410
  const savedJson = saveJsonInContext(opts, opened, raw, ctx);
428
411
  const project = attachInContext(opts, opened, descriptor, taskId, task, raw, {}, warnings, { ...ctx, savedJson });
429
- if (opened.schema === "v1") {
430
- const downloads = await maybeDownloadV1(opened, descriptor, task, raw, submission, warnings, { savedJson, includeRaw, project });
431
- await emitEnvelope(okEnvelope(opened.command, taskResult({ task, raw, descriptor, includeRaw, submission, downloads, savedJson, extra: project ? { project } : {} }), warnings), opened.format);
432
- return;
433
- }
434
- // Legacy shape, same rule: a download failure still names the task.
435
- try {
436
- await emitLegacyOutcome(task, false, undefined, spec.name, runtime, { query: true });
437
- }
438
- catch (err) {
439
- throw withTaskContext(err, { ...ctx, savedJson, extra: project ? { project } : {} });
440
- }
412
+ const downloads = await maybeDownloadV1(opened, descriptor, task, raw, submission, warnings, { savedJson, includeRaw, project });
413
+ await emitEnvelope(okEnvelope(opened.command, taskResult({ task, raw, descriptor, includeRaw, submission, downloads, savedJson, extra: project ? { project } : {} }), warnings), opened.format);
414
+ return;
441
415
  });
442
416
  // wait
443
417
  TASK_JSON_OPTIONS(cmd
444
418
  .command("wait <task-id>")
445
419
  .description("Poll until the task reaches a terminal status")
446
420
  .option("--timeout <seconds>", "max seconds to wait (0 = a single query); the task keeps running after it — the API advises allowing up to 60 min", "600")).action(async (taskId, opts, thisCmd) => {
447
- const opened = openCommand(thisCmd, `${prefix}.wait`, defaultSchema);
421
+ const opened = openCommand(thisCmd, `${prefix}.wait`);
448
422
  beginProjectContext(opts, opened);
449
423
  const timeoutSeconds = parseTimeoutSeconds(opts.timeout ?? "600");
450
424
  const runtime = await buildRuntime(opened.flags);
@@ -457,7 +431,7 @@ export function buildResourceCommand(spec) {
457
431
  .description("Follow the task over Server-Sent Events until it is terminal")
458
432
  .option("--timeout <seconds>", "total deadline for the stream", "600")
459
433
  .option("--idle-timeout <seconds>", "abort when no bytes arrive for this long (keep-alives count)", "60")).action(async (taskId, opts, thisCmd) => {
460
- const opened = openCommand(thisCmd, `${prefix}.stream`, defaultSchema);
434
+ const opened = openCommand(thisCmd, `${prefix}.stream`);
461
435
  beginProjectContext(opts, opened);
462
436
  if (!descriptor.supports.stream)
463
437
  throw new UsageError(`${spec.name} does not support stream`);
@@ -478,8 +452,8 @@ export function buildResourceCommand(spec) {
478
452
  ? "Cancel a task: PENDING is refunded, IN_PROGRESS is not; a finished task cannot be canceled (the task is kept as CANCELED, not deleted)"
479
453
  : "Permanently delete a task (a PENDING task is refunded; an IN_PROGRESS one cannot be stopped and is refused with exit 14; a finished one is deleted without a refund)")
480
454
  .action(async (taskId, _opts, thisCmd) => {
481
- const opened = openCommand(thisCmd, `${prefix}.delete`, defaultSchema);
482
- rejectOutputFlagForV1(opened, undefined);
455
+ const opened = openCommand(thisCmd, `${prefix}.delete`);
456
+ rejectOutputFlag(opened, undefined);
483
457
  const runtime = await buildRuntime(opened.flags);
484
458
  let raw;
485
459
  try {
@@ -489,7 +463,7 @@ export function buildResourceCommand(spec) {
489
463
  throw deleteFailure(err, taskId, nextCommands(descriptor, taskId).wait);
490
464
  }
491
465
  const outcome = cancels ? { deleted: false, canceled: true } : { deleted: true };
492
- await emitResult(opened, { resource: spec.name, task_id: taskId, ...outcome }, { resource: spec.name, endpoint: descriptor.legacyEndpoint, task_id: taskId, ...outcome, response: raw ?? null }, { legacyFile: opened.flags.output });
466
+ await emitResult(opened, { resource: spec.name, endpoint: descriptor.endpoint, task_id: taskId, ...outcome, response: raw ?? null });
493
467
  });
494
468
  // list
495
469
  if (spec.supportsList !== false && descriptor.supports.list) {
@@ -500,10 +474,10 @@ export function buildResourceCommand(spec) {
500
474
  .option("--page-size <n>", "page size", "10")
501
475
  .option("--sort-by <field>", "sort order (e.g. -created_at)", "-created_at")
502
476
  .option("--save-json <file>", "save the raw list response (never overwrites)")
503
- .option("--include-raw", "v1: include each raw task under items[].raw")
477
+ .option("--include-raw", "include each raw task under items[].raw")
504
478
  .action(async (opts, thisCmd) => {
505
- const opened = openCommand(thisCmd, `${prefix}.list`, defaultSchema);
506
- rejectOutputFlagForV1(opened, opts.saveJson);
479
+ const opened = openCommand(thisCmd, `${prefix}.list`);
480
+ rejectOutputFlag(opened, opts.saveJson);
507
481
  const runtime = await buildRuntime(opened.flags);
508
482
  const page = { page_num: Number(opts.page ?? 1), page_size: Number(opts.pageSize ?? 10), sort_by: String(opts.sortBy ?? "-created_at") };
509
483
  if (!Number.isInteger(page.page_num) || page.page_num < 1)
@@ -513,12 +487,12 @@ export function buildResourceCommand(spec) {
513
487
  const { tasks, raw } = await endpointOf(runtime.client).listDetailed(page, { signal: abortSignal() });
514
488
  const savedJson = opts.saveJson ? saveRawJson(opts.saveJson, raw, { workspace: opened.flags.workspaceRoot }) : null;
515
489
  const rawItems = Array.isArray(raw) ? raw : [];
516
- await emitResult(opened, tasks.map((t) => summarizeTask(t)), {
490
+ await emitResult(opened, {
517
491
  items: tasks.map((t, i) => toTaskView(rawItems[i] ?? t, { descriptor, includeRaw: Boolean(opts.includeRaw) })),
518
492
  count: tasks.length,
519
493
  page,
520
494
  saved_json: savedJson,
521
- }, { legacyFile: opened.flags.output });
495
+ });
522
496
  });
523
497
  }
524
498
  else {
@@ -598,7 +572,7 @@ export async function submitCreate(runtime, descriptor, endpoint, payload, reque
598
572
  const credential = credentialIdentityFor(runtime, apiOrigin);
599
573
  const identity = {
600
574
  resource: descriptor.id,
601
- endpoint: descriptor.legacyEndpoint,
575
+ endpoint: descriptor.endpoint,
602
576
  apiOrigin,
603
577
  credentialFingerprint: credential.fingerprint,
604
578
  credentialVerified: credential.verified,
@@ -656,7 +630,7 @@ export async function submitCreate(runtime, descriptor, endpoint, payload, reque
656
630
  recovery: {
657
631
  action: "reconcile",
658
632
  automatic: false,
659
- command: `meshy ${descriptor.commandPath.join(" ")} list --output-schema v1 # then match operation ${operationId} by time/prompt before creating again`,
633
+ command: `meshy ${descriptor.commandPath.join(" ")} list # then match operation ${operationId} by time/prompt before creating again`,
660
634
  },
661
635
  hint: resolveHint(operationId),
662
636
  result: { submission: { state: "unknown", operation_id: operationId, task_id: null }, task: null, downloads: NOT_REQUESTED(), ...extra },
@@ -700,7 +674,7 @@ function replayExisting(record, descriptor, operationId, extra) {
700
674
  throw new CliError({
701
675
  code: "submission_unknown",
702
676
  message: `operation ${operationId} is recorded as '${record.state}' since ${record.updated_at}; reconcile it before submitting again (nothing was sent now)`,
703
- recovery: { action: "reconcile", automatic: false, command: `meshy ${descriptor.commandPath.join(" ")} list --output-schema v1` },
677
+ recovery: { action: "reconcile", automatic: false, command: `meshy ${descriptor.commandPath.join(" ")} list` },
704
678
  hint: resolveHint(operationId),
705
679
  result: { submission: { state: "unknown", operation_id: operationId, task_id: record.task_id }, task: null, ...extra },
706
680
  });
@@ -732,8 +706,8 @@ function attachSubmission(err, submission, warnings) {
732
706
  return err;
733
707
  }
734
708
  /**
735
- * v1 `-o`: download a SUCCEEDED task's assets through the legacy layout,
736
- * confined to the workspace when one is set. A failure keeps the task in the
709
+ * `-o`: save a SUCCEEDED task's default selection (every asset with
710
+ * --all-assets), confined to the workspace when one is set. A failure keeps the task in the
737
711
  * result — the assets are still on the server, the task still exists.
738
712
  */
739
713
  async function maybeDownloadV1(opened, descriptor, task, raw, submission, warnings, ctx) {
@@ -743,14 +717,14 @@ async function maybeDownloadV1(opened, descriptor, task, raw, submission, warnin
743
717
  if (task.status !== "SUCCEEDED")
744
718
  return { state: "not_ready", files: [], metadata_path: null };
745
719
  try {
746
- const { files, metadataPath, materialLinks } = await withSpinner(opened.format, "Downloading assets", () => downloadArtifacts(task, output, descriptor.id, { root: opened.flags.workspaceRoot, signal: abortSignal() }));
747
- if (materialLinks)
748
- warnings.push(...materialLinks.warnings);
720
+ const { files, metadataPath, materialLinks, skipped, warnings: transferWarnings } = await withSpinner(opened.format, "Downloading assets", () => downloadTaskAssets(task, output, descriptor, { root: opened.flags.workspaceRoot, signal: abortSignal(), allAssets: opened.flags.allAssets }));
721
+ warnings.push(...transferWarnings.map((w) => warning(w.code, w.message)));
749
722
  return {
750
723
  state: "completed",
751
724
  files: files.map((f) => ({ key: f.key, path: f.path, status: f.status, bytes: f.bytes, sha256: f.sha256, error: f.error })),
752
725
  metadata_path: metadataPath,
753
726
  material_links: materialLinks,
727
+ skipped,
754
728
  };
755
729
  }
756
730
  catch (err) {
@@ -835,10 +809,6 @@ async function waitAndReport(opened, runtime, descriptor, endpoint, taskId, time
835
809
  throw interruptedError(descriptor, taskId, task ? { task, raw } : seen.last, submission, opts, opened);
836
810
  if (task === null) {
837
811
  // The deadline passed before the first response arrived; the task id is all we know — and it is enough.
838
- if (opened.schema !== "v1") {
839
- emitLegacyTimeoutWithoutTask(taskId, descriptor.id, runtime);
840
- return;
841
- }
842
812
  throw new CliError({
843
813
  code: "timed_out",
844
814
  message: `task ${taskId} did not answer within ${timeoutSeconds}s (no status was received in time${poll.lastError ? `; ${poll.failedPolls} status request(s) failed, last: ${poll.lastError.message}` : ""}); the server keeps running it`,
@@ -851,18 +821,6 @@ async function waitAndReport(opened, runtime, descriptor, endpoint, taskId, time
851
821
  const savedJson = saveJsonInContext(opts, opened, raw, ctx);
852
822
  const project = attachInContext(opts, opened, descriptor, taskId, task, raw, { operationId: opts.__operationId ?? submission.operation_id ?? null, payload: opts.__payload ?? null }, warnings, { ...ctx, savedJson });
853
823
  const projectExtra = project ? { project } : {};
854
- if (opened.schema !== "v1") {
855
- // The legacy reporter downloads too; whatever fails there — an asset host
856
- // 503, a sidecar that cannot be published, Ctrl-C — the error still
857
- // carries the accepted task id, the real submission and the resume command.
858
- try {
859
- await emitLegacyOutcome(task, timedOut, elapsed, descriptor.id, runtime, { query: false });
860
- }
861
- catch (err) {
862
- throw withTaskContext(err, { ...ctx, savedJson, extra: { wait: waitInfo, ...projectExtra } });
863
- }
864
- return;
865
- }
866
824
  if (timedOut) {
867
825
  throw new CliError({
868
826
  code: "timed_out",
@@ -892,20 +850,6 @@ export function retriedPolls(poll) {
892
850
  export function retriedWarning(poll) {
893
851
  return warning("poll_retried", `${poll.failedPolls} status request(s) failed transiently and were retried at the next poll (last: ${poll.lastError?.message ?? "unknown"})`);
894
852
  }
895
- /** Legacy shape for a wait that timed out before any status arrived: still the task id, still exit 8. */
896
- function emitLegacyTimeoutWithoutTask(taskId, resourceName, runtime) {
897
- if (runtime.flags.output) {
898
- const report = { status: "FAIL", taskId, type: resourceName, timedOut: true };
899
- const notice = getUpdateNotice();
900
- if (notice)
901
- report._notice = notice;
902
- printReport(report);
903
- }
904
- else {
905
- emit({ resource: resourceName, id: taskId, status: null, timed_out: true }, { format: runtime.flags.format });
906
- }
907
- process.exitCode = 8;
908
- }
909
853
  function interruptedError(descriptor, taskId, last, submission, opts, opened, savedJson = null) {
910
854
  let saved = savedJson;
911
855
  if (!saved && opts.saveJson && last) {
@@ -940,7 +884,7 @@ async function streamAndReport(opened, runtime, descriptor, endpoint, taskId, ti
940
884
  },
941
885
  onTask: async (task, raw) => {
942
886
  progress.tick(task.status, task.progress);
943
- if (opened.schema === "v1" && ndjson) {
887
+ if (ndjson) {
944
888
  sequence += 1;
945
889
  const event = {
946
890
  ...okEnvelope(opened.command, taskResult({ task, raw, descriptor, includeRaw, submission })),
@@ -1008,20 +952,6 @@ async function streamAndReport(opened, runtime, descriptor, endpoint, taskId, ti
1008
952
  finalError = bookkeepingError;
1009
953
  }
1010
954
  }
1011
- if (opened.schema !== "v1") {
1012
- // Legacy has no stream shape to preserve: reuse the terminal summary path (which honours -o itself).
1013
- if (finalError)
1014
- throw finalError;
1015
- if (outcome.task) {
1016
- try {
1017
- await emitLegacyOutcome(outcome.task, false, outcome.elapsedMs / 1000, descriptor.id, runtime, { query: false });
1018
- }
1019
- catch (err) {
1020
- throw withTaskContext(err, { ...ctx, savedJson, extra: { stream: streamInfo, ...projectExtra } });
1021
- }
1022
- }
1023
- return;
1024
- }
1025
955
  // The terminal outcome includes the requested download whatever the output
1026
956
  // format: `-o` means "put the assets on disk", not "only when printing JSON".
1027
957
  if (!finalError && outcome.task && outcome.task.status === "SUCCEEDED") {
@@ -1057,81 +987,6 @@ function wrapStreamError(err, result, warnings) {
1057
987
  }
1058
988
  return new CliError({ code: "protocol", message: "stream ended abnormally", result, warnings });
1059
989
  }
1060
- /**
1061
- * Legacy reporter. `query: true` is `get`: a valid task is a successful query
1062
- * whatever its status (0.2.0 exited 1 for PENDING/IN_PROGRESS — fixed); a
1063
- * terminal FAILED/CANCELED still exits 1 for compatibility.
1064
- */
1065
- async function emitLegacyOutcome(task, timedOut, elapsedSeconds, resourceName, runtime, mode) {
1066
- const output = runtime.flags.output;
1067
- const succeeded = !timedOut && task.status === "SUCCEEDED";
1068
- const pretty = runtime.flags.format === "pretty";
1069
- if (output) {
1070
- if (succeeded) {
1071
- const { savedFiles, metadataPath } = await withSpinner(runtime.flags.format, "Downloading assets", () => downloadArtifacts(task, output, resourceName, { root: runtime.flags.workspaceRoot, signal: abortSignal() }));
1072
- if (pretty) {
1073
- printTaskCard(task, savedFiles);
1074
- return;
1075
- }
1076
- const successReport = {
1077
- status: "SUCCESS",
1078
- taskId: task.id,
1079
- type: task.type || resourceName,
1080
- savedFiles,
1081
- metadataPath,
1082
- };
1083
- const successNotice = getUpdateNotice();
1084
- if (successNotice)
1085
- successReport._notice = successNotice;
1086
- printReport(successReport);
1087
- return;
1088
- }
1089
- const report = {
1090
- status: "FAIL",
1091
- taskId: task.id,
1092
- type: task.type || resourceName,
1093
- };
1094
- if (timedOut)
1095
- report.timedOut = true;
1096
- else if (task.task_error?.message)
1097
- report.error = task.task_error.message;
1098
- else if (task.status)
1099
- report.error = `task status: ${task.status}`;
1100
- const failNotice = getUpdateNotice();
1101
- if (failNotice)
1102
- report._notice = failNotice;
1103
- if (pretty)
1104
- printTaskCard(task, []);
1105
- else
1106
- printReport(report);
1107
- if (timedOut)
1108
- process.exitCode = 8;
1109
- else if (mode.query && !isTerminalStatus(task.status))
1110
- process.exitCode = 0;
1111
- else
1112
- process.exitCode = 1;
1113
- return;
1114
- }
1115
- emit({
1116
- resource: resourceName,
1117
- ...summarizeTask(task, elapsedSeconds),
1118
- ...(timedOut ? { timed_out: true } : {}),
1119
- }, { format: runtime.flags.format });
1120
- if (timedOut)
1121
- process.exitCode = 8;
1122
- else if (task.status === "SUCCEEDED")
1123
- process.exitCode = 0;
1124
- else if (!isTerminalStatus(task.status))
1125
- process.exitCode = mode.query ? 0 : 1;
1126
- else
1127
- process.exitCode = 1;
1128
- }
1129
- /** Kept for make.ts (legacy path). */
1130
- /** The `-o` report for a person: the task card with the files it saved, the update hint on stderr. */
1131
- function printTaskCard(task, saved) {
1132
- process.stdout.write(`${taskCard(toTaskView(task), painterFor(process.stdout), { saved }).join("\n")}\n`);
1133
- printHumanUpdateHint(getUpdateNotice(), process);
1134
- }
1135
990
  /** Freeze the progress line with how the wait or stream ended. */
1136
991
  function endProgress(progress, task, timedOut, abandoned) {
1137
992
  if (abandoned)
@@ -1143,8 +998,5 @@ function endProgress(progress, task, timedOut, abandoned) {
1143
998
  else
1144
999
  progress.finish("failed", task?.status ?? "no status received");
1145
1000
  }
1146
- export async function emitTerminalOutcome(task, timedOut, elapsedSeconds, resourceName, runtime) {
1147
- await emitLegacyOutcome(task, timedOut, elapsedSeconds, resourceName, runtime, { query: false });
1148
- }
1149
1001
  export { taskResult as buildTaskResult, nextCommands as taskNextCommands };
1150
1002
  //# sourceMappingURL=task-command.js.map