@melius-ai/cli 0.12.0 → 0.14.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.
package/README.md CHANGED
@@ -130,6 +130,7 @@ Edge type determines data flow: `text` passes text output, `image` passes image
130
130
  | Command | Description |
131
131
  | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
132
132
  | `mel run start <nodeId> --canvas-id <canvasId>` | Start a generation. Returns `{ id }` |
133
+ | `mel run tool <nodeId> --canvas-id <canvasId> --tool remove-background` | Remove an image background in place. Returns `{ id }` |
133
134
  | `mel run get <runId>` | Check run status: `pending`, `running`, `finished`, `failed` |
134
135
  | `mel run wait <runId>` | **Block until done.** Exit 0 = finished, 1 = failed, 4 = timeout |
135
136
  | `mel run latest <canvasId>` | Latest run status for every node on a canvas |
@@ -138,6 +139,8 @@ Edge type determines data flow: `text` passes text output, `image` passes image
138
139
 
139
140
  **Magic resize:** `mel run magic-resize` creates a magic-resize node, wires the source image in, and runs it — all in one call. The source node must already have a finished image asset. `--ratios` is comma-separated (1–5): presets `21:9, 16:9, 4:3, 1:1, 3:4, 9:16, 9:21` render at 1K, or pass custom `WxH` pixel sizes (each side 64–4096, e.g. `1080x1350`). Pass the returned `nodeId` to `mel run wait` to block until the variants are ready.
140
141
 
142
+ **Node tools:** `mel run tool` post-processes a node's finished asset in place and creates a new active version. The currently supported tool is `remove-background` for image and image-backed file nodes. Pass the returned run ID to `mel run wait` before inspecting the result with `mel canvas content <canvasId> --node-id <nodeId> --include-all-versions`.
143
+
141
144
  **Auto-model resolution:** when `--model`/`--variant` are omitted, `mel run start` automatically resolves the correct model from the platform defaults. `--canvas-id` is required so the CLI can verify the node is on the canvas and the backend can do edge-aware detection (picks `image-to-image` when the node has incoming image edges). Always source the node ID from the latest `mel canvas content` output or the current-turn `idMap` returned by `mel node bulk-create`.
142
145
 
143
146
  ```bash
@@ -149,6 +152,9 @@ mel run start <nodeId> --canvas-id <canvasId> --model flux-pro --variant text-to
149
152
 
150
153
  # With overrides
151
154
  mel run start <nodeId> --canvas-id <canvasId> --prompt "Override prompt" --variations 3
155
+
156
+ # Remove an image background in place
157
+ mel run tool <imageNodeId> --canvas-id <canvasId> --tool remove-background
152
158
  ```
153
159
 
154
160
  ### Bulk runs (entire canvas)
package/dist/bin/mel.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  printUpgradeNoticeIfNeeded,
8
8
  withDefaultHelp,
9
9
  writeError
10
- } from "../chunk-2PWVQ3PC.js";
10
+ } from "../chunk-RTPRU2JD.js";
11
11
 
12
12
  // bin/mel.ts
13
13
  var program = createProgram();
@@ -1166,7 +1166,7 @@ var require_command = __commonJS({
1166
1166
  var { Help: Help2, stripColor } = require_help();
1167
1167
  var { Option: Option2, DualOptions } = require_option();
1168
1168
  var { suggestSimilar } = require_suggestSimilar();
1169
- var Command2 = class _Command extends EventEmitter {
1169
+ var Command3 = class _Command extends EventEmitter {
1170
1170
  /**
1171
1171
  * Initialize a new `Command`.
1172
1172
  *
@@ -3307,7 +3307,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3307
3307
  return true;
3308
3308
  return void 0;
3309
3309
  }
3310
- exports.Command = Command2;
3310
+ exports.Command = Command3;
3311
3311
  exports.useColor = useColor;
3312
3312
  }
3313
3313
  });
@@ -3317,15 +3317,15 @@ var require_commander = __commonJS({
3317
3317
  "../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/index.js"(exports) {
3318
3318
  "use strict";
3319
3319
  var { Argument: Argument2 } = require_argument();
3320
- var { Command: Command2 } = require_command();
3320
+ var { Command: Command3 } = require_command();
3321
3321
  var { CommanderError: CommanderError3, InvalidArgumentError: InvalidArgumentError2 } = require_error();
3322
3322
  var { Help: Help2 } = require_help();
3323
3323
  var { Option: Option2 } = require_option();
3324
- exports.program = new Command2();
3325
- exports.createCommand = (name) => new Command2(name);
3324
+ exports.program = new Command3();
3325
+ exports.createCommand = (name) => new Command3(name);
3326
3326
  exports.createOption = (flags, description) => new Option2(flags, description);
3327
3327
  exports.createArgument = (name, description) => new Argument2(name, description);
3328
- exports.Command = Command2;
3328
+ exports.Command = Command3;
3329
3329
  exports.Option = Option2;
3330
3330
  exports.Argument = Argument2;
3331
3331
  exports.Help = Help2;
@@ -7740,6 +7740,13 @@ var MAX_VARIATIONS = 10;
7740
7740
 
7741
7741
  // ../api-contract/src/common.ts
7742
7742
  var MessageResponseSchema = external_exports.object({ message: external_exports.string() });
7743
+ var ApiErrorResponseSchema = external_exports.object({
7744
+ statusCode: external_exports.number().int(),
7745
+ message: external_exports.string(),
7746
+ error: external_exports.string(),
7747
+ code: external_exports.string().optional(),
7748
+ retryAfterSeconds: external_exports.number().int().optional()
7749
+ });
7743
7750
  var ShareVisibilitySchema = external_exports.enum(["team", "anyone"]);
7744
7751
  var CompletedPartSchema = external_exports.object({
7745
7752
  partNumber: external_exports.number().int().positive(),
@@ -7903,6 +7910,13 @@ var customContextContract = c.router({
7903
7910
  }
7904
7911
  });
7905
7912
 
7913
+ // ../api-contract/src/rgb-color.ts
7914
+ var RgbColorSchema = external_exports.object({
7915
+ r: external_exports.number().int().min(0).max(255),
7916
+ g: external_exports.number().int().min(0).max(255),
7917
+ b: external_exports.number().int().min(0).max(255)
7918
+ });
7919
+
7906
7920
  // ../api-contract/src/files.ts
7907
7921
  var c2 = initContract();
7908
7922
  var FileSourceSchema = external_exports.enum(["upload", "generated"]);
@@ -7929,12 +7943,25 @@ var MAX_ASSET_TAG_NAME_LENGTH = 100;
7929
7943
  var FileTagSchema = external_exports.object({
7930
7944
  id: external_exports.string().uuid(),
7931
7945
  name: external_exports.string(),
7932
- color: external_exports.string()
7946
+ color: external_exports.string(),
7947
+ /**
7948
+ * Which subsystem-written tag this is, or null for a team-authored one.
7949
+ * Same open string as {@link AssetTagResponseSchema}: a chip only ever
7950
+ * needs the *fact* for the shared rules (rename freely, never delete, never
7951
+ * apply by hand), and a second system tag must not need a contract change.
7952
+ * {@link AssetSystemTag} names the one case that reads the value — the
7953
+ * sign-off projection, which a node-scoped surface has to be able to tell
7954
+ * apart from an ordinary tag.
7955
+ */
7956
+ systemTag: external_exports.string().nullable()
7933
7957
  });
7934
7958
  var FileCanvasBacklinkSchema = external_exports.object({
7935
7959
  canvasId: external_exports.string().uuid(),
7936
7960
  projectId: external_exports.string().uuid(),
7937
7961
  canvasTitle: external_exports.string(),
7962
+ // The owning project, so the picker can qualify canvases that share a
7963
+ // title. Optional: responses from a core build that predates it omit it.
7964
+ projectTitle: external_exports.string().optional(),
7938
7965
  // A node on this canvas whose active version holds the asset, so opening
7939
7966
  // the canvas can center on it. Null when no such node survives (e.g. it was
7940
7967
  // deleted but the asset is still referenced elsewhere on the canvas).
@@ -7987,7 +8014,11 @@ var FileGenerationSchema = external_exports.object({
7987
8014
  *
7988
8015
  * Optional so a client that ships ahead of the server keeps validating —
7989
8016
  * absent reads the same as "not a tool run". */
7990
- sourceToolName: external_exports.string().nullable().optional()
8017
+ sourceToolName: external_exports.string().nullable().optional(),
8018
+ /** Recraft palette persisted with the version that created this asset. */
8019
+ colors: external_exports.array(RgbColorSchema).optional(),
8020
+ /** Recraft background color persisted with the version that created this asset. */
8021
+ backgroundColor: RgbColorSchema.optional()
7991
8022
  });
7992
8023
  var FileDetailSchema = FileCardSchema.extend({
7993
8024
  width: external_exports.number().int().nullable(),
@@ -8098,6 +8129,12 @@ var ListFilesQuerySchema = external_exports.object({
8098
8129
  // active one — so a generation a member starred survives later regens and
8099
8130
  // stays findable here. Same query-string coercion as `hidden`.
8100
8131
  favorited: external_exports.union([external_exports.boolean(), external_exports.literal("true"), external_exports.literal("false")]).optional().transform((value) => value === true || value === "true"),
8132
+ // The "Archived" view: generations whose every canvas home is archived (a
8133
+ // deleted project) or trashed (a deleted canvas), so they are exactly the
8134
+ // assets the normal grid drops. Uploads never appear here — they survive
8135
+ // archiving and stay in the main listing. Same query-string coercion as
8136
+ // `hidden`.
8137
+ archived: external_exports.union([external_exports.boolean(), external_exports.literal("true"), external_exports.literal("false")]).optional().transform((value) => value === true || value === "true"),
8101
8138
  // Whether to compute the exact `total`. Defaults to `true`. The Files
8102
8139
  // visibility predicate is an EXISTS over the team's whole node graph, so an
8103
8140
  // exact `count(*)` scans every asset (seconds on large teams) and runs in
@@ -8132,7 +8169,11 @@ var FileTabCountsResponseSchema = external_exports.object({
8132
8169
  all: external_exports.number().int(),
8133
8170
  uploads: external_exports.number().int(),
8134
8171
  generations: external_exports.number().int(),
8135
- favorites: external_exports.number().int()
8172
+ favorites: external_exports.number().int(),
8173
+ // Optional so a web bundle that ships before core still parses the older
8174
+ // response; callers treat a missing count as 0. Can be made required once
8175
+ // this has fully rolled out.
8176
+ archived: external_exports.number().int().optional()
8136
8177
  });
8137
8178
  var AGENT_ASSET_SEARCH_PAGE_SIZE = 20;
8138
8179
  var AgentAssetSearchQuerySchema = external_exports.object({
@@ -8249,6 +8290,14 @@ var AssetTagResponseSchema = external_exports.object({
8249
8290
  createdByName: external_exports.string().nullable(),
8250
8291
  createdAt: external_exports.string().datetime(),
8251
8292
  updatedAt: external_exports.string().datetime(),
8293
+ /**
8294
+ * Names which subsystem-written tag this is, or null for a tag a person
8295
+ * authored. Opaque to the client on purpose: it needs the *fact*, not the
8296
+ * value, because the rule is the same for every one of them — a non-null
8297
+ * tag may be renamed but never deleted, applied or removed by hand — and a
8298
+ * second system tag should not need a contract change to be handled right.
8299
+ */
8300
+ systemTag: external_exports.string().nullable(),
8252
8301
  // How many of the team's assets carry this tag. Present in listAssetTags;
8253
8302
  // omitted on single-tag create/update responses (which don't recount).
8254
8303
  assetCount: external_exports.number().int().nonnegative().optional()
@@ -9361,12 +9410,29 @@ var audioContract = c5.router({
9361
9410
  }
9362
9411
  });
9363
9412
 
9413
+ // ../canvas-yjs/src/group-color.ts
9414
+ var GROUP_COLOR_KEYS = [
9415
+ "default",
9416
+ "amber",
9417
+ "blue",
9418
+ "purple",
9419
+ "olive"
9420
+ ];
9421
+
9364
9422
  // ../api-contract/src/heygen.ts
9365
9423
  var HeygenAvatarSettingsSchema = external_exports.object({
9366
9424
  backgroundColor: external_exports.string().regex(/^#[0-9a-f]{6}$/i, "Background color must be a hex color").optional(),
9367
9425
  removeBackground: external_exports.boolean().optional(),
9368
9426
  fit: external_exports.enum(["cover", "contain"]).optional(),
9369
- caption: external_exports.boolean().optional()
9427
+ caption: external_exports.boolean().optional(),
9428
+ /**
9429
+ * Runware TTS voice id for the text-driven path (e.g.
9430
+ * "chill_brian_male_english"), chosen from the provider's voice catalog.
9431
+ * Only used when a script is typed with no connected audio; the
9432
+ * audio-driven (mirror-voice) path ignores it. When absent the backend
9433
+ * falls back to its default voice.
9434
+ */
9435
+ voice: external_exports.string().trim().min(1).optional()
9370
9436
  });
9371
9437
  var HeygenAvatarVariantSchema = external_exports.object({
9372
9438
  avatar: external_exports.string().describe(
@@ -10144,6 +10210,8 @@ var ElevenLabsVoiceSettingsSchema = external_exports.object({
10144
10210
  removeBackgroundNoise: external_exports.boolean().optional(),
10145
10211
  outputFormat: ElevenLabsOutputFormatSchema.optional()
10146
10212
  });
10213
+ var AUDIO_TAG_BODY = /\[[^\]\n]*[A-Za-z][^\]\n]*\]/;
10214
+ var AUDIO_TAG_BODY_GLOBAL = new RegExp(AUDIO_TAG_BODY.source, "g");
10147
10215
 
10148
10216
  // ../api-contract/src/generation-failure-reason.ts
10149
10217
  var GENERATION_FAILURE_REASONS = [
@@ -10395,6 +10463,10 @@ var TemplatePortTargetSchema = external_exports.object({
10395
10463
  nodeKey: external_exports.string(),
10396
10464
  internalHandle: external_exports.string().nullable()
10397
10465
  });
10466
+ var TemplatePortSourcePositionSchema = external_exports.object({
10467
+ x: external_exports.number(),
10468
+ y: external_exports.number()
10469
+ });
10398
10470
  var TemplatePortSchema = external_exports.discriminatedUnion("direction", [
10399
10471
  external_exports.object({
10400
10472
  direction: external_exports.literal("input"),
@@ -10424,6 +10496,8 @@ var TemplatePortSchema = external_exports.discriminatedUnion("direction", [
10424
10496
  * single `nodeKey`/`internalHandle` binding (pre-fan-out templates).
10425
10497
  */
10426
10498
  internalTargets: external_exports.array(TemplatePortTargetSchema).optional(),
10499
+ /** Authored position of this input's source. See the schema's doc. */
10500
+ sourcePosition: TemplatePortSourcePositionSchema.optional(),
10427
10501
  ...TemplatePortBaseFields
10428
10502
  }),
10429
10503
  external_exports.object({
@@ -10479,6 +10553,12 @@ var InstancePortBindingSchema = external_exports.discriminatedUnion("direction",
10479
10553
  * the next connect, so a stale id never strands a slot.
10480
10554
  */
10481
10555
  connectedSourceIds: external_exports.array(external_exports.string()).optional(),
10556
+ /**
10557
+ * `TemplatePort.sourcePosition` baked onto this canvas — apply adds the
10558
+ * same offset it gives the hidden children, so this is absolute here and
10559
+ * expand can treat it exactly like a child position.
10560
+ */
10561
+ sourcePosition: TemplatePortSourcePositionSchema.optional(),
10482
10562
  ...InstancePortBindingBaseFields
10483
10563
  }),
10484
10564
  external_exports.object({
@@ -10531,6 +10611,7 @@ var EdgeTypeSchema = external_exports.enum([
10531
10611
  "file"
10532
10612
  ]);
10533
10613
  var GroupTypeSchema = external_exports.enum(["default", "unified", "template"]);
10614
+ var GroupColorSchema = external_exports.enum(GROUP_COLOR_KEYS);
10534
10615
  var ModelConfigSchema = external_exports.object({
10535
10616
  model: external_exports.string(),
10536
10617
  variant: external_exports.string(),
@@ -10557,7 +10638,11 @@ var ModelConfigSchema = external_exports.object({
10557
10638
  /** SDXL only: sampler steps used for this version. */
10558
10639
  steps: external_exports.number().optional(),
10559
10640
  /** SDXL only: classifier-free guidance scale used for this version. */
10560
- guidanceScale: external_exports.number().optional()
10641
+ guidanceScale: external_exports.number().optional(),
10642
+ /** Recraft only: RGB palette used for this version's generation. */
10643
+ colors: external_exports.array(RgbColorSchema).optional(),
10644
+ /** Recraft only: RGB background used for this version's generation. */
10645
+ backgroundColor: RgbColorSchema.optional()
10561
10646
  });
10562
10647
  var ModelConfigInputSchema = external_exports.object({
10563
10648
  model: external_exports.string(),
@@ -10788,6 +10873,7 @@ var NodeResponseSchema = external_exports.object({
10788
10873
  /** Per-clip trim windows for stitch nodes (keyed by source node id, from CRDT). */
10789
10874
  stitchClipTrims: StitchClipTrimsSchema.nullable().optional(),
10790
10875
  groupType: GroupTypeSchema.nullable().optional(),
10876
+ groupColor: GroupColorSchema.nullable().optional(),
10791
10877
  /** Resolved input/output port bindings on a template-instance group (from CRDT). */
10792
10878
  templatePorts: external_exports.array(InstancePortBindingSchema).nullable().optional(),
10793
10879
  /** The source template id on a template-instance group (from CRDT). */
@@ -10918,7 +11004,7 @@ var NodeRunStatusSchema = external_exports.enum([
10918
11004
  var CreateNodeRunResponseSchema = external_exports.object({
10919
11005
  id: external_exports.string().uuid()
10920
11006
  });
10921
- var RunOriginSchema = external_exports.enum(["canvas", "playground"]);
11007
+ var RunOriginSchema = external_exports.enum(["canvas", "playground", "cast"]);
10922
11008
  var RunNodeBodySchema = external_exports.object({
10923
11009
  canvasId: external_exports.string().uuid().optional(),
10924
11010
  /** Product surface this run originated on. Defaults to `canvas` server-side. */
@@ -10965,6 +11051,10 @@ var RunNodeBodySchema = external_exports.object({
10965
11051
  * own default still applies.
10966
11052
  */
10967
11053
  negativePrompt: external_exports.string().optional(),
11054
+ /** Recraft's preferred RGB palette. Ignored by other models. */
11055
+ colors: external_exports.array(RgbColorSchema).optional(),
11056
+ /** Recraft's RGB background colour. Ignored by other models. */
11057
+ backgroundColor: RgbColorSchema.optional(),
10968
11058
  /** Explicit image URLs to include as inputs (merged with edge-resolved images). */
10969
11059
  imageUrls: external_exports.array(external_exports.string().url()).max(MAX_INPUT_IMAGES).optional(),
10970
11060
  /**
@@ -11007,6 +11097,14 @@ var RunImageToolBodySchema = external_exports.object({
11007
11097
  /** Base64-encoded PNG mask image for inpainting (white = areas to regenerate). */
11008
11098
  maskImageBase64: external_exports.string().optional()
11009
11099
  });
11100
+ var REMOVE_BACKGROUND_NODE_TOOL_NAME = "remove-background";
11101
+ var PUBLIC_NODE_TOOL_NAMES = [
11102
+ REMOVE_BACKGROUND_NODE_TOOL_NAME
11103
+ ];
11104
+ var RunNodeToolBodySchema = external_exports.object({
11105
+ canvasId: external_exports.string().uuid(),
11106
+ toolName: external_exports.enum(PUBLIC_NODE_TOOL_NAMES)
11107
+ });
11010
11108
  var RunSplitLayersBodySchema = external_exports.object({
11011
11109
  canvasId: external_exports.string().uuid().optional(),
11012
11110
  numLayers: external_exports.number().int().min(2).max(5).nullable()
@@ -11063,6 +11161,11 @@ var RunVideoToolBodySchema = external_exports.object({
11063
11161
  toolName: external_exports.string().trim().min(1),
11064
11162
  toolConfig: external_exports.record(external_exports.unknown()).optional()
11065
11163
  });
11164
+ var ExtractVideoFrameBodySchema = external_exports.object({
11165
+ canvasId: external_exports.string().uuid(),
11166
+ targetNodeId: external_exports.string().uuid(),
11167
+ timeMs: external_exports.number().int().min(0)
11168
+ });
11066
11169
  var NodeRunResponseSchema = external_exports.object({
11067
11170
  id: external_exports.string().uuid(),
11068
11171
  nodeId: external_exports.string().uuid(),
@@ -11892,6 +11995,18 @@ var canvasContract = c7.router({
11892
11995
  404: NodeRunErrorResponseSchema
11893
11996
  }
11894
11997
  },
11998
+ runNodeTool: {
11999
+ method: "POST",
12000
+ path: "/nodes/:nodeId/tool-runs",
12001
+ pathParams: external_exports.object({ nodeId: external_exports.string().uuid() }),
12002
+ body: RunNodeToolBodySchema,
12003
+ responses: {
12004
+ 201: CreateNodeRunResponseSchema,
12005
+ 202: external_exports.object({ approvalId: external_exports.string().uuid() }),
12006
+ 400: NodeRunErrorResponseSchema,
12007
+ 404: NodeRunErrorResponseSchema
12008
+ }
12009
+ },
11895
12010
  runImageTool: {
11896
12011
  method: "POST",
11897
12012
  path: "/nodes/:nodeId/image-tool-runs",
@@ -11985,6 +12100,17 @@ var canvasContract = c7.router({
11985
12100
  404: NodeRunErrorResponseSchema
11986
12101
  }
11987
12102
  },
12103
+ extractVideoFrame: {
12104
+ method: "POST",
12105
+ path: "/nodes/:nodeId/frame-extractions",
12106
+ pathParams: external_exports.object({ nodeId: external_exports.string().uuid() }),
12107
+ body: ExtractVideoFrameBodySchema,
12108
+ responses: {
12109
+ 201: CreateNodeRunResponseSchema,
12110
+ 400: NodeRunErrorResponseSchema,
12111
+ 404: NodeRunErrorResponseSchema
12112
+ }
12113
+ },
11988
12114
  getNodeRun: {
11989
12115
  method: "GET",
11990
12116
  path: "/node-runs/:nodeRunId",
@@ -12057,6 +12183,17 @@ var canvasContract = c7.router({
12057
12183
  method: "GET",
12058
12184
  path: "/canvases/:canvasId/node-runs/latest",
12059
12185
  pathParams: external_exports.object({ canvasId: external_exports.string().uuid() }),
12186
+ query: external_exports.object({
12187
+ /**
12188
+ * Return every pending/running run per node instead of only the
12189
+ * single latest run. A node can have several runs in flight at
12190
+ * once, and the default one-per-node shape drops all but the
12191
+ * newest — so a reload loses the others. Opt-in: clients that
12192
+ * key run state by node id must not receive multiple rows for
12193
+ * one node.
12194
+ */
12195
+ includeAllActiveRuns: external_exports.coerce.boolean().optional()
12196
+ }),
12060
12197
  responses: {
12061
12198
  200: external_exports.object({
12062
12199
  data: external_exports.array(LatestNodeRunResponseSchema)
@@ -12627,6 +12764,10 @@ var GenerationRunBodySchema = external_exports.object({
12627
12764
  * "blur, distort, and low quality") still applies.
12628
12765
  */
12629
12766
  negativePrompt: external_exports.string().optional(),
12767
+ /** Recraft's preferred RGB palette. Ignored by models without `falColorsField`. */
12768
+ colors: external_exports.array(RgbColorSchema).optional(),
12769
+ /** Recraft's RGB background colour. Ignored by models without `falBackgroundColorField`. */
12770
+ backgroundColor: RgbColorSchema.optional(),
12630
12771
  /**
12631
12772
  * The font the better-font-32b model should use as its typography
12632
12773
  * reference. Only honored when `model === "better-font-32b"`; ignored
@@ -12678,6 +12819,9 @@ var AutoModelDefaultCapabilitiesSchema = external_exports.object({
12678
12819
  supportedDurationsByResolution: external_exports.record(external_exports.string(), external_exports.array(external_exports.number())).nullable().optional(),
12679
12820
  supportedResolutions: external_exports.array(OutputResolutionSchema).nullable().optional(),
12680
12821
  supportsCustomResolution: external_exports.boolean().optional(),
12822
+ maxCustomResolutionArea: external_exports.number().nullable().optional(),
12823
+ minCustomResolutionArea: external_exports.number().nullable().optional(),
12824
+ maxCustomResolutionAspectRatio: external_exports.number().nullable().optional(),
12681
12825
  resolutionPricingMultipliers: external_exports.record(external_exports.string(), external_exports.number()).nullable().optional(),
12682
12826
  audioOffCreditMultiplier: external_exports.number().nullable().optional(),
12683
12827
  audioOffCreditMultipliersByResolution: external_exports.record(external_exports.string(), external_exports.number()).nullable().optional(),
@@ -12686,6 +12830,8 @@ var AutoModelDefaultCapabilitiesSchema = external_exports.object({
12686
12830
  maxReferenceImagesWithEndImage: external_exports.number().nullable().optional(),
12687
12831
  maxVideoInputs: external_exports.number().nullable().optional(),
12688
12832
  maxAudioInputs: external_exports.number().nullable().optional(),
12833
+ /** Maximum combined reference image, video, and audio inputs. */
12834
+ maxCombinedReferenceInputs: external_exports.number().nullable().optional(),
12689
12835
  maxNativeOutputs: external_exports.number().nullable().optional(),
12690
12836
  maxInputArea: external_exports.number().nullable().optional(),
12691
12837
  minInputVideoArea: external_exports.number().nullable().optional(),
@@ -12798,6 +12944,8 @@ var ModelVariantResponseSchema = external_exports.object({
12798
12944
  supportsNegativePrompt: external_exports.boolean().optional(),
12799
12945
  supportedAspectRatios: external_exports.array(OutputAspectRatioSchema),
12800
12946
  supportedDurations: external_exports.array(external_exports.number()).nullable(),
12947
+ /** Provider default used when a duration is not selected. */
12948
+ defaultDuration: external_exports.number().nullable().optional(),
12801
12949
  /**
12802
12950
  * For a per-second model whose output length is NOT user-selected: how the
12803
12951
  * billed length is derived. `"input-media"` → longest connected input
@@ -12808,6 +12956,9 @@ var ModelVariantResponseSchema = external_exports.object({
12808
12956
  supportedDurationsByResolution: external_exports.record(external_exports.string(), external_exports.array(external_exports.number())).nullable().optional(),
12809
12957
  supportedResolutions: external_exports.array(OutputResolutionSchema).nullable(),
12810
12958
  supportsCustomResolution: external_exports.boolean().optional(),
12959
+ maxCustomResolutionArea: external_exports.number().nullable().optional(),
12960
+ minCustomResolutionArea: external_exports.number().nullable().optional(),
12961
+ maxCustomResolutionAspectRatio: external_exports.number().nullable().optional(),
12811
12962
  resolutionPricingMultipliers: external_exports.record(external_exports.string(), external_exports.number()).nullable(),
12812
12963
  /** Multiplier applied to creditCost when audio is toggled off. */
12813
12964
  audioOffCreditMultiplier: external_exports.number().nullable().optional(),
@@ -12818,6 +12969,7 @@ var ModelVariantResponseSchema = external_exports.object({
12818
12969
  maxReferenceImagesWithEndImage: external_exports.number().nullable().optional(),
12819
12970
  maxVideoInputs: external_exports.number().nullable().optional(),
12820
12971
  maxAudioInputs: external_exports.number().nullable().optional(),
12972
+ maxCombinedReferenceInputs: external_exports.number().nullable().optional(),
12821
12973
  /**
12822
12974
  * For variants accepting both video and audio: whether the connected
12823
12975
  * durations must line up. `false` for lipsync models (e.g. Kling Lipsync)
@@ -12968,10 +13120,21 @@ var generationContract = c9.router({
12968
13120
  listHeygenAvatarVAvatars: {
12969
13121
  method: "GET",
12970
13122
  path: "/generation/heygen-avatar-v-avatars",
13123
+ // Each HeyGen avatar model has its own provider roster, so the caller
13124
+ // names the model it is picking for. Omitted means Avatar V, which is
13125
+ // what every client sent before Avatar IV existed.
13126
+ query: external_exports.object({ model: external_exports.string().optional() }).optional(),
12971
13127
  responses: {
12972
13128
  200: external_exports.object({ avatars: external_exports.array(external_exports.string()) })
12973
13129
  }
12974
13130
  },
13131
+ listHeygenAvatarVVoices: {
13132
+ method: "GET",
13133
+ path: "/generation/heygen-avatar-v-voices",
13134
+ responses: {
13135
+ 200: external_exports.object({ voices: external_exports.array(external_exports.string()) })
13136
+ }
13137
+ },
12975
13138
  getAutoModelDefaults: {
12976
13139
  method: "GET",
12977
13140
  path: "/generation/auto-model-defaults",
@@ -13678,6 +13841,13 @@ var TeamAdvancedSettingsSchema = external_exports.object({
13678
13841
  // enterprise team's owner domain. Admin-governed via the dedicated
13679
13842
  // domain-join-settings endpoint, not the editor-facing advanced-settings write.
13680
13843
  domainJoinAutoApprove: external_exports.boolean().optional()
13844
+ // NOTE: the team's approval policy config also lives in this jsonb column,
13845
+ // but is deliberately NOT declared here — see `InternalTeamAdvancedSettings`
13846
+ // in `apps/core/nagi/team/team.mappers.ts`, the same treatment
13847
+ // `modelDiscounts` gets. Declaring it would publish the team's approver
13848
+ // list into the public OpenAPI surface, and would make it writable through
13849
+ // the editor-facing advanced-settings endpoint. It is read and written
13850
+ // only through the admin-gated approvals endpoints.
13681
13851
  });
13682
13852
  var DomainJoinTargetSchema = external_exports.object({
13683
13853
  teamId: external_exports.string().uuid(),
@@ -13808,6 +13978,12 @@ var teamContract = c13.router({
13808
13978
  body: null,
13809
13979
  responses: { 204: c13.noBody() }
13810
13980
  },
13981
+ leaveTeam: {
13982
+ method: "POST",
13983
+ path: "/teams/current/leave",
13984
+ body: null,
13985
+ responses: { 204: c13.noBody() }
13986
+ },
13811
13987
  listMembers: {
13812
13988
  method: "GET",
13813
13989
  path: "/teams/current/members",
@@ -14404,6 +14580,7 @@ var publicContract = c16.router(
14404
14580
  },
14405
14581
  run: {
14406
14582
  start: canvasContract.runNode,
14583
+ tool: canvasContract.runNodeTool,
14407
14584
  get: canvasContract.getNodeRun,
14408
14585
  cancel: canvasContract.cancelNodeRun,
14409
14586
  latest: canvasContract.getLatestNodeRuns,
@@ -14706,7 +14883,7 @@ function isMajorUpgrade(current, latest) {
14706
14883
  return l[0] > c17[0];
14707
14884
  }
14708
14885
  function shouldShowUpgradeNotice(ctx = {}) {
14709
- const current = ctx.current ?? "0.12.0";
14886
+ const current = ctx.current ?? "0.14.0";
14710
14887
  const latest = ctx.latest ?? serverLatestVersion;
14711
14888
  const env = ctx.env ?? process.env;
14712
14889
  const isTty = ctx.isTty ?? Boolean(process.stderr.isTTY);
@@ -14727,7 +14904,7 @@ Upgrade: npm install -g @melius-ai/cli@latest (or: brew update && brew upgrade
14727
14904
  function printUpgradeNoticeIfNeeded(ctx = {}) {
14728
14905
  try {
14729
14906
  if (!shouldShowUpgradeNotice(ctx)) return;
14730
- const current = ctx.current ?? "0.12.0";
14907
+ const current = ctx.current ?? "0.14.0";
14731
14908
  const latest = ctx.latest ?? serverLatestVersion;
14732
14909
  process.stderr.write(formatUpgradeNotice(current, latest));
14733
14910
  } catch {
@@ -18036,6 +18213,38 @@ function assertNodeIdsExistOnCanvas(nodeIds, canvasId, canvasNodeIds) {
18036
18213
  }
18037
18214
 
18038
18215
  // src/commands/run.ts
18216
+ async function handleRunApproval(result, client, outputOpts, details) {
18217
+ if (result.status !== 202) return false;
18218
+ const body = result.body;
18219
+ const signal = JSON.stringify({
18220
+ type: "approval_required",
18221
+ approvalId: body.approvalId,
18222
+ tool: details.tool,
18223
+ summary: details.summary
18224
+ });
18225
+ process.stdout.write(signal + "\n");
18226
+ process.stderr.write(signal + "\n");
18227
+ const approval = await pollApproval(
18228
+ client,
18229
+ body.approvalId,
18230
+ 18e5,
18231
+ 2e3
18232
+ );
18233
+ if (approval.status === "denied") {
18234
+ writeError(
18235
+ formatError(
18236
+ "DENIED",
18237
+ "The user denied this generation. Do NOT retry or re-run this command. Ask the user what they would like to do instead.",
18238
+ {
18239
+ suggestion: "Ask the user what they would like to do next"
18240
+ }
18241
+ ),
18242
+ EXIT_API_ERROR
18243
+ );
18244
+ }
18245
+ writeJson(approval.result, outputOpts);
18246
+ return true;
18247
+ }
18039
18248
  function registerRunCommands(program2, getOutputOpts) {
18040
18249
  const run = program2.command("run").description("Start AI generations and poll for results");
18041
18250
  run.command("start").description("Start an AI generation run on a node").argument(
@@ -18134,35 +18343,10 @@ Examples:
18134
18343
  }
18135
18344
  }
18136
18345
  });
18137
- if (result.status === 202) {
18138
- const body = result.body;
18139
- const signal = JSON.stringify({
18140
- type: "approval_required",
18141
- approvalId: body.approvalId,
18142
- tool: "run_start",
18143
- summary: `mel run start ${nodeId} --canvas-id ${opts.canvasId}`
18144
- });
18145
- process.stdout.write(signal + "\n");
18146
- process.stderr.write(signal + "\n");
18147
- const approval = await pollApproval(
18148
- client,
18149
- body.approvalId,
18150
- 18e5,
18151
- 2e3
18152
- );
18153
- if (approval.status === "denied") {
18154
- writeError(
18155
- formatError(
18156
- "DENIED",
18157
- "The user denied this generation. Do NOT retry or re-run this command. Ask the user what they would like to do instead.",
18158
- {
18159
- suggestion: "Ask the user what they would like to do next"
18160
- }
18161
- ),
18162
- EXIT_API_ERROR
18163
- );
18164
- }
18165
- writeJson(approval.result, getOutputOpts());
18346
+ if (await handleRunApproval(result, client, getOutputOpts(), {
18347
+ tool: "run_start",
18348
+ summary: `mel run start ${nodeId} --canvas-id ${opts.canvasId}`
18349
+ })) {
18166
18350
  return;
18167
18351
  }
18168
18352
  if (result.status !== 201) {
@@ -18178,6 +18362,58 @@ Examples:
18178
18362
  writeJson(result.body, getOutputOpts());
18179
18363
  }
18180
18364
  );
18365
+ run.command("tool").description(
18366
+ "Run a node tool on an existing node in place and return its run ID"
18367
+ ).argument(
18368
+ "<nodeId>",
18369
+ "Node ID with a finished asset (from mel canvas content)"
18370
+ ).requiredOption(
18371
+ "--canvas-id <id>",
18372
+ "Canvas ID (from mel canvas create or mel canvas list output)"
18373
+ ).addOption(
18374
+ new Option(
18375
+ "--tool <name>",
18376
+ `Node tool name. Valid values: ${PUBLIC_NODE_TOOL_NAMES.join(", ")}`
18377
+ ).choices([...PUBLIC_NODE_TOOL_NAMES]).makeOptionMandatory()
18378
+ ).addHelpText(
18379
+ "after",
18380
+ `
18381
+ Returns: { id } \u2014 the run ID. Use mel run wait <id> to block until completion.
18382
+ Valid tools: ${PUBLIC_NODE_TOOL_NAMES.join(", ")}.
18383
+ Node tools post-process the node's finished asset in place and create a new active version.
18384
+ After completion, use mel canvas content <canvasId> --node-id <nodeId> --include-all-versions to inspect the result.
18385
+
18386
+ Examples:
18387
+ $ mel run tool <imageNodeId> --canvas-id <canvasId> --tool remove-background
18388
+ $ RUN=$(mel run tool <imageNodeId> --canvas-id <canvasId> --tool remove-background); mel run wait $(echo $RUN | jq -r .id)`
18389
+ ).action(
18390
+ async (nodeId, opts) => {
18391
+ const client = getClient();
18392
+ const canvasNodeIds = await loadCanvasNodeIds(
18393
+ client,
18394
+ opts.canvasId
18395
+ );
18396
+ assertNodeExistsOnCanvas(nodeId, opts.canvasId, canvasNodeIds);
18397
+ const result = await client.run.tool({
18398
+ params: { nodeId },
18399
+ body: {
18400
+ canvasId: opts.canvasId,
18401
+ toolName: opts.tool
18402
+ }
18403
+ });
18404
+ if (await handleRunApproval(result, client, getOutputOpts(), {
18405
+ tool: "run_node_tool",
18406
+ summary: `mel run tool ${nodeId} --canvas-id ${opts.canvasId} --tool ${opts.tool}`
18407
+ })) {
18408
+ return;
18409
+ }
18410
+ if (result.status !== 201) {
18411
+ const suggestion = result.status === 404 ? `Run: mel canvas content ${opts.canvasId} to refresh node IDs, then retry with a current node ID` : `Make sure the node has a finished image asset. Use mel canvas content ${opts.canvasId} --node-id ${nodeId} --include-all-versions to inspect it.`;
18412
+ handleApiError(result.status, result.body, suggestion);
18413
+ }
18414
+ writeJson(result.body, getOutputOpts());
18415
+ }
18416
+ );
18181
18417
  run.command("magic-resize").description(
18182
18418
  "Resize an image into multiple aspect ratios in one call. Creates a magic-resize node, wires the source image in, and runs it (writes to CRDT + starts a run)"
18183
18419
  ).argument(
@@ -19864,7 +20100,7 @@ function withDefaultHelp(args) {
19864
20100
  }
19865
20101
  function createProgram() {
19866
20102
  const program2 = new Command();
19867
- program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.12.0").showSuggestionAfterError(true).option("--json", "Force JSON output (default)").option("--text", "Human-readable output").option(
20103
+ program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.14.0").showSuggestionAfterError(true).option("--json", "Force JSON output (default)").option("--text", "Human-readable output").option(
19868
20104
  "--fields <fields>",
19869
20105
  "Select specific output fields (comma-separated)"
19870
20106
  ).option("--quiet", "Suppress output, exit code only").option("--verbose", "Log request/response metadata to stderr").addHelpText(
package/dist/src/index.js CHANGED
@@ -2,7 +2,7 @@ import { createRequire } from 'node:module'; const require = createRequire(impor
2
2
  import {
3
3
  createProgram,
4
4
  withDefaultHelp
5
- } from "../chunk-2PWVQ3PC.js";
5
+ } from "../chunk-RTPRU2JD.js";
6
6
  export {
7
7
  createProgram,
8
8
  withDefaultHelp
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melius-ai/cli",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "The Melius command-line interface — create canvases and run AI image/video generations from your terminal",
5
5
  "keywords": [
6
6
  "ai",