@melius-ai/cli 0.12.0 → 0.13.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 +6 -0
- package/dist/bin/mel.js +1 -1
- package/dist/{chunk-2PWVQ3PC.js → chunk-5APS3BGT.js} +125 -38
- package/dist/src/index.js +1 -1
- package/package.json +1 -1
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
|
@@ -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
|
|
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 =
|
|
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:
|
|
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
|
|
3325
|
-
exports.createCommand = (name) => new
|
|
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 =
|
|
3328
|
+
exports.Command = Command3;
|
|
3329
3329
|
exports.Option = Option2;
|
|
3330
3330
|
exports.Argument = Argument2;
|
|
3331
3331
|
exports.Help = Help2;
|
|
@@ -11007,6 +11007,14 @@ var RunImageToolBodySchema = external_exports.object({
|
|
|
11007
11007
|
/** Base64-encoded PNG mask image for inpainting (white = areas to regenerate). */
|
|
11008
11008
|
maskImageBase64: external_exports.string().optional()
|
|
11009
11009
|
});
|
|
11010
|
+
var REMOVE_BACKGROUND_NODE_TOOL_NAME = "remove-background";
|
|
11011
|
+
var PUBLIC_NODE_TOOL_NAMES = [
|
|
11012
|
+
REMOVE_BACKGROUND_NODE_TOOL_NAME
|
|
11013
|
+
];
|
|
11014
|
+
var RunNodeToolBodySchema = external_exports.object({
|
|
11015
|
+
canvasId: external_exports.string().uuid(),
|
|
11016
|
+
toolName: external_exports.enum(PUBLIC_NODE_TOOL_NAMES)
|
|
11017
|
+
});
|
|
11010
11018
|
var RunSplitLayersBodySchema = external_exports.object({
|
|
11011
11019
|
canvasId: external_exports.string().uuid().optional(),
|
|
11012
11020
|
numLayers: external_exports.number().int().min(2).max(5).nullable()
|
|
@@ -11892,6 +11900,18 @@ var canvasContract = c7.router({
|
|
|
11892
11900
|
404: NodeRunErrorResponseSchema
|
|
11893
11901
|
}
|
|
11894
11902
|
},
|
|
11903
|
+
runNodeTool: {
|
|
11904
|
+
method: "POST",
|
|
11905
|
+
path: "/nodes/:nodeId/tool-runs",
|
|
11906
|
+
pathParams: external_exports.object({ nodeId: external_exports.string().uuid() }),
|
|
11907
|
+
body: RunNodeToolBodySchema,
|
|
11908
|
+
responses: {
|
|
11909
|
+
201: CreateNodeRunResponseSchema,
|
|
11910
|
+
202: external_exports.object({ approvalId: external_exports.string().uuid() }),
|
|
11911
|
+
400: NodeRunErrorResponseSchema,
|
|
11912
|
+
404: NodeRunErrorResponseSchema
|
|
11913
|
+
}
|
|
11914
|
+
},
|
|
11895
11915
|
runImageTool: {
|
|
11896
11916
|
method: "POST",
|
|
11897
11917
|
path: "/nodes/:nodeId/image-tool-runs",
|
|
@@ -13678,6 +13698,13 @@ var TeamAdvancedSettingsSchema = external_exports.object({
|
|
|
13678
13698
|
// enterprise team's owner domain. Admin-governed via the dedicated
|
|
13679
13699
|
// domain-join-settings endpoint, not the editor-facing advanced-settings write.
|
|
13680
13700
|
domainJoinAutoApprove: external_exports.boolean().optional()
|
|
13701
|
+
// NOTE: the team's approval policy config also lives in this jsonb column,
|
|
13702
|
+
// but is deliberately NOT declared here — see `InternalTeamAdvancedSettings`
|
|
13703
|
+
// in `apps/core/nagi/team/team.mappers.ts`, the same treatment
|
|
13704
|
+
// `modelDiscounts` gets. Declaring it would publish the team's approver
|
|
13705
|
+
// list into the public OpenAPI surface, and would make it writable through
|
|
13706
|
+
// the editor-facing advanced-settings endpoint. It is read and written
|
|
13707
|
+
// only through the admin-gated approvals endpoints.
|
|
13681
13708
|
});
|
|
13682
13709
|
var DomainJoinTargetSchema = external_exports.object({
|
|
13683
13710
|
teamId: external_exports.string().uuid(),
|
|
@@ -14404,6 +14431,7 @@ var publicContract = c16.router(
|
|
|
14404
14431
|
},
|
|
14405
14432
|
run: {
|
|
14406
14433
|
start: canvasContract.runNode,
|
|
14434
|
+
tool: canvasContract.runNodeTool,
|
|
14407
14435
|
get: canvasContract.getNodeRun,
|
|
14408
14436
|
cancel: canvasContract.cancelNodeRun,
|
|
14409
14437
|
latest: canvasContract.getLatestNodeRuns,
|
|
@@ -14706,7 +14734,7 @@ function isMajorUpgrade(current, latest) {
|
|
|
14706
14734
|
return l[0] > c17[0];
|
|
14707
14735
|
}
|
|
14708
14736
|
function shouldShowUpgradeNotice(ctx = {}) {
|
|
14709
|
-
const current = ctx.current ?? "0.
|
|
14737
|
+
const current = ctx.current ?? "0.13.0";
|
|
14710
14738
|
const latest = ctx.latest ?? serverLatestVersion;
|
|
14711
14739
|
const env = ctx.env ?? process.env;
|
|
14712
14740
|
const isTty = ctx.isTty ?? Boolean(process.stderr.isTTY);
|
|
@@ -14727,7 +14755,7 @@ Upgrade: npm install -g @melius-ai/cli@latest (or: brew update && brew upgrade
|
|
|
14727
14755
|
function printUpgradeNoticeIfNeeded(ctx = {}) {
|
|
14728
14756
|
try {
|
|
14729
14757
|
if (!shouldShowUpgradeNotice(ctx)) return;
|
|
14730
|
-
const current = ctx.current ?? "0.
|
|
14758
|
+
const current = ctx.current ?? "0.13.0";
|
|
14731
14759
|
const latest = ctx.latest ?? serverLatestVersion;
|
|
14732
14760
|
process.stderr.write(formatUpgradeNotice(current, latest));
|
|
14733
14761
|
} catch {
|
|
@@ -18036,6 +18064,38 @@ function assertNodeIdsExistOnCanvas(nodeIds, canvasId, canvasNodeIds) {
|
|
|
18036
18064
|
}
|
|
18037
18065
|
|
|
18038
18066
|
// src/commands/run.ts
|
|
18067
|
+
async function handleRunApproval(result, client, outputOpts, details) {
|
|
18068
|
+
if (result.status !== 202) return false;
|
|
18069
|
+
const body = result.body;
|
|
18070
|
+
const signal = JSON.stringify({
|
|
18071
|
+
type: "approval_required",
|
|
18072
|
+
approvalId: body.approvalId,
|
|
18073
|
+
tool: details.tool,
|
|
18074
|
+
summary: details.summary
|
|
18075
|
+
});
|
|
18076
|
+
process.stdout.write(signal + "\n");
|
|
18077
|
+
process.stderr.write(signal + "\n");
|
|
18078
|
+
const approval = await pollApproval(
|
|
18079
|
+
client,
|
|
18080
|
+
body.approvalId,
|
|
18081
|
+
18e5,
|
|
18082
|
+
2e3
|
|
18083
|
+
);
|
|
18084
|
+
if (approval.status === "denied") {
|
|
18085
|
+
writeError(
|
|
18086
|
+
formatError(
|
|
18087
|
+
"DENIED",
|
|
18088
|
+
"The user denied this generation. Do NOT retry or re-run this command. Ask the user what they would like to do instead.",
|
|
18089
|
+
{
|
|
18090
|
+
suggestion: "Ask the user what they would like to do next"
|
|
18091
|
+
}
|
|
18092
|
+
),
|
|
18093
|
+
EXIT_API_ERROR
|
|
18094
|
+
);
|
|
18095
|
+
}
|
|
18096
|
+
writeJson(approval.result, outputOpts);
|
|
18097
|
+
return true;
|
|
18098
|
+
}
|
|
18039
18099
|
function registerRunCommands(program2, getOutputOpts) {
|
|
18040
18100
|
const run = program2.command("run").description("Start AI generations and poll for results");
|
|
18041
18101
|
run.command("start").description("Start an AI generation run on a node").argument(
|
|
@@ -18134,35 +18194,10 @@ Examples:
|
|
|
18134
18194
|
}
|
|
18135
18195
|
}
|
|
18136
18196
|
});
|
|
18137
|
-
if (result
|
|
18138
|
-
|
|
18139
|
-
|
|
18140
|
-
|
|
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());
|
|
18197
|
+
if (await handleRunApproval(result, client, getOutputOpts(), {
|
|
18198
|
+
tool: "run_start",
|
|
18199
|
+
summary: `mel run start ${nodeId} --canvas-id ${opts.canvasId}`
|
|
18200
|
+
})) {
|
|
18166
18201
|
return;
|
|
18167
18202
|
}
|
|
18168
18203
|
if (result.status !== 201) {
|
|
@@ -18178,6 +18213,58 @@ Examples:
|
|
|
18178
18213
|
writeJson(result.body, getOutputOpts());
|
|
18179
18214
|
}
|
|
18180
18215
|
);
|
|
18216
|
+
run.command("tool").description(
|
|
18217
|
+
"Run a node tool on an existing node in place and return its run ID"
|
|
18218
|
+
).argument(
|
|
18219
|
+
"<nodeId>",
|
|
18220
|
+
"Node ID with a finished asset (from mel canvas content)"
|
|
18221
|
+
).requiredOption(
|
|
18222
|
+
"--canvas-id <id>",
|
|
18223
|
+
"Canvas ID (from mel canvas create or mel canvas list output)"
|
|
18224
|
+
).addOption(
|
|
18225
|
+
new Option(
|
|
18226
|
+
"--tool <name>",
|
|
18227
|
+
`Node tool name. Valid values: ${PUBLIC_NODE_TOOL_NAMES.join(", ")}`
|
|
18228
|
+
).choices([...PUBLIC_NODE_TOOL_NAMES]).makeOptionMandatory()
|
|
18229
|
+
).addHelpText(
|
|
18230
|
+
"after",
|
|
18231
|
+
`
|
|
18232
|
+
Returns: { id } \u2014 the run ID. Use mel run wait <id> to block until completion.
|
|
18233
|
+
Valid tools: ${PUBLIC_NODE_TOOL_NAMES.join(", ")}.
|
|
18234
|
+
Node tools post-process the node's finished asset in place and create a new active version.
|
|
18235
|
+
After completion, use mel canvas content <canvasId> --node-id <nodeId> --include-all-versions to inspect the result.
|
|
18236
|
+
|
|
18237
|
+
Examples:
|
|
18238
|
+
$ mel run tool <imageNodeId> --canvas-id <canvasId> --tool remove-background
|
|
18239
|
+
$ RUN=$(mel run tool <imageNodeId> --canvas-id <canvasId> --tool remove-background); mel run wait $(echo $RUN | jq -r .id)`
|
|
18240
|
+
).action(
|
|
18241
|
+
async (nodeId, opts) => {
|
|
18242
|
+
const client = getClient();
|
|
18243
|
+
const canvasNodeIds = await loadCanvasNodeIds(
|
|
18244
|
+
client,
|
|
18245
|
+
opts.canvasId
|
|
18246
|
+
);
|
|
18247
|
+
assertNodeExistsOnCanvas(nodeId, opts.canvasId, canvasNodeIds);
|
|
18248
|
+
const result = await client.run.tool({
|
|
18249
|
+
params: { nodeId },
|
|
18250
|
+
body: {
|
|
18251
|
+
canvasId: opts.canvasId,
|
|
18252
|
+
toolName: opts.tool
|
|
18253
|
+
}
|
|
18254
|
+
});
|
|
18255
|
+
if (await handleRunApproval(result, client, getOutputOpts(), {
|
|
18256
|
+
tool: "run_node_tool",
|
|
18257
|
+
summary: `mel run tool ${nodeId} --canvas-id ${opts.canvasId} --tool ${opts.tool}`
|
|
18258
|
+
})) {
|
|
18259
|
+
return;
|
|
18260
|
+
}
|
|
18261
|
+
if (result.status !== 201) {
|
|
18262
|
+
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.`;
|
|
18263
|
+
handleApiError(result.status, result.body, suggestion);
|
|
18264
|
+
}
|
|
18265
|
+
writeJson(result.body, getOutputOpts());
|
|
18266
|
+
}
|
|
18267
|
+
);
|
|
18181
18268
|
run.command("magic-resize").description(
|
|
18182
18269
|
"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
18270
|
).argument(
|
|
@@ -19864,7 +19951,7 @@ function withDefaultHelp(args) {
|
|
|
19864
19951
|
}
|
|
19865
19952
|
function createProgram() {
|
|
19866
19953
|
const program2 = new Command();
|
|
19867
|
-
program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.
|
|
19954
|
+
program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.13.0").showSuggestionAfterError(true).option("--json", "Force JSON output (default)").option("--text", "Human-readable output").option(
|
|
19868
19955
|
"--fields <fields>",
|
|
19869
19956
|
"Select specific output fields (comma-separated)"
|
|
19870
19957
|
).option("--quiet", "Suppress output, exit code only").option("--verbose", "Log request/response metadata to stderr").addHelpText(
|
package/dist/src/index.js
CHANGED