@melius-ai/cli 0.9.1 → 0.10.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 +25 -0
- package/dist/bin/mel.js +1 -1
- package/dist/{chunk-WRLYKNYI.js → chunk-GEI5UAWV.js} +302 -18
- package/dist/src/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -203,6 +203,31 @@ mel preset apply <canvasId> <presetId>
|
|
|
203
203
|
mel bulk-run start <canvasId> --wait
|
|
204
204
|
```
|
|
205
205
|
|
|
206
|
+
### Templates
|
|
207
|
+
|
|
208
|
+
Templates are reusable workflows applied server-side as collapsed boxes. Listing includes global templates and templates scoped to the current team. The CLI exposes only template metadata, declared ports, and the applied box IDs; internal workflow nodes and configuration stay private.
|
|
209
|
+
|
|
210
|
+
| Command | Description |
|
|
211
|
+
| -------------------------------------------- | ------------------------------------------------------------------------ |
|
|
212
|
+
| `mel template list` | List available templates and their declared input/output ports |
|
|
213
|
+
| `mel template apply <canvasId> <templateId>` | Apply a template as one collapsed box and return `instanceId`, `groupId` |
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Discover templates and ports
|
|
217
|
+
mel template list
|
|
218
|
+
mel template list --fields id,title,inputPorts,outputPorts
|
|
219
|
+
|
|
220
|
+
# Apply with automatic placement
|
|
221
|
+
mel template apply <canvasId> <templateId>
|
|
222
|
+
|
|
223
|
+
# Materialize a text input while applying
|
|
224
|
+
mel template apply <canvasId> <templateId> \
|
|
225
|
+
--inputs '[{"kind":"text","portId":"<portId>","text":"A red shoe"}]'
|
|
226
|
+
|
|
227
|
+
# Run only the opaque template box
|
|
228
|
+
mel bulk-run start <canvasId> --node-ids <groupId> --wait
|
|
229
|
+
```
|
|
230
|
+
|
|
206
231
|
### Models
|
|
207
232
|
|
|
208
233
|
| Command | Description |
|
package/dist/bin/mel.js
CHANGED
|
@@ -8647,12 +8647,17 @@ var AgentMessageFeedbackResponseSchema = external_exports.object({
|
|
|
8647
8647
|
createdAt: external_exports.string().datetime()
|
|
8648
8648
|
});
|
|
8649
8649
|
var AgentSessionStatusSchema = external_exports.enum(["active", "ended", "error"]);
|
|
8650
|
+
var AgentSessionSourceSchema = external_exports.enum(["web", "slack"]);
|
|
8650
8651
|
var AgentSessionResponseSchema = external_exports.object({
|
|
8651
8652
|
id: external_exports.string().uuid(),
|
|
8652
8653
|
userId: external_exports.string().uuid(),
|
|
8653
8654
|
teamId: external_exports.string().uuid(),
|
|
8654
8655
|
title: external_exports.string(),
|
|
8655
8656
|
status: AgentSessionStatusSchema,
|
|
8657
|
+
/** Optional so web clients remain compatible with servers that predate session sources. */
|
|
8658
|
+
source: AgentSessionSourceSchema.optional(),
|
|
8659
|
+
/** True when this transcript is view-only on the current surface. */
|
|
8660
|
+
readOnly: external_exports.boolean().optional(),
|
|
8656
8661
|
/** True when the agent is actively generating a response. */
|
|
8657
8662
|
isGenerating: external_exports.boolean(),
|
|
8658
8663
|
/** Present when the session is waiting for the user to approve a tool call. */
|
|
@@ -8781,6 +8786,28 @@ var agentContract = c3.router({
|
|
|
8781
8786
|
},
|
|
8782
8787
|
summary: "Get an agent session with recent messages"
|
|
8783
8788
|
},
|
|
8789
|
+
getInternalDemoCanvasSession: {
|
|
8790
|
+
method: "GET",
|
|
8791
|
+
path: "/agent/internal-demo-canvas-sessions/:sessionId",
|
|
8792
|
+
pathParams: external_exports.object({ sessionId: external_exports.string().uuid() }),
|
|
8793
|
+
query: external_exports.object({
|
|
8794
|
+
messageLimit: external_exports.coerce.number().int().min(0).max(100).default(50)
|
|
8795
|
+
}),
|
|
8796
|
+
responses: {
|
|
8797
|
+
200: AgentSessionResponseSchema
|
|
8798
|
+
},
|
|
8799
|
+
summary: "Get an internal demo canvas Slack transcript"
|
|
8800
|
+
},
|
|
8801
|
+
forkInternalDemoCanvasSession: {
|
|
8802
|
+
method: "POST",
|
|
8803
|
+
path: "/agent/internal-demo-canvas-sessions/:sessionId/fork",
|
|
8804
|
+
pathParams: external_exports.object({ sessionId: external_exports.string().uuid() }),
|
|
8805
|
+
body: null,
|
|
8806
|
+
responses: {
|
|
8807
|
+
201: AgentSessionResponseSchema
|
|
8808
|
+
},
|
|
8809
|
+
summary: "Fork an internal demo canvas Slack transcript into a private agent session"
|
|
8810
|
+
},
|
|
8784
8811
|
renameSession: {
|
|
8785
8812
|
method: "PATCH",
|
|
8786
8813
|
path: "/agent/sessions/:sessionId",
|
|
@@ -10221,7 +10248,21 @@ var PreviewAssetSchema = external_exports.object({
|
|
|
10221
10248
|
thumbnailUrl: external_exports.string().nullable()
|
|
10222
10249
|
});
|
|
10223
10250
|
|
|
10251
|
+
// ../api-contract/src/template-port-summary.ts
|
|
10252
|
+
var TemplatePortSummarySchema = external_exports.object({
|
|
10253
|
+
id: external_exports.string(),
|
|
10254
|
+
direction: external_exports.enum(["input", "output"]),
|
|
10255
|
+
label: external_exports.string(),
|
|
10256
|
+
handleType: external_exports.string(),
|
|
10257
|
+
required: external_exports.boolean().optional(),
|
|
10258
|
+
maxConnections: external_exports.number().int().positive().optional(),
|
|
10259
|
+
outputAspectRatio: external_exports.enum(ASPECT_RATIOS).nullable().optional(),
|
|
10260
|
+
exampleAssetUrl: external_exports.string().nullable().optional(),
|
|
10261
|
+
exampleText: external_exports.string().nullable().optional()
|
|
10262
|
+
});
|
|
10263
|
+
|
|
10224
10264
|
// ../api-contract/src/templates-ports.ts
|
|
10265
|
+
var TEMPLATE_EXAMPLE_TEXT_MAX_LENGTH = 2e3;
|
|
10225
10266
|
var TemplatePortBaseFields = {
|
|
10226
10267
|
/** Stable handle id on the box, e.g. "in_character", "out_angle_1". */
|
|
10227
10268
|
id: external_exports.string(),
|
|
@@ -10238,7 +10279,25 @@ var TemplatePortBaseFields = {
|
|
|
10238
10279
|
*/
|
|
10239
10280
|
internalHandle: external_exports.string().nullable(),
|
|
10240
10281
|
/** Optional vertical position override on the box (e.g. "35%"). */
|
|
10241
|
-
top: external_exports.string().optional()
|
|
10282
|
+
top: external_exports.string().optional(),
|
|
10283
|
+
/**
|
|
10284
|
+
* Example media for a MEDIA port (image/video/audio input source or output
|
|
10285
|
+
* result), shown in the template details panel and the build/edit authoring
|
|
10286
|
+
* UIs. `exampleAssetKey` is the persisted ref: an S3 object key under
|
|
10287
|
+
* `template-examples/`, copied at capture so the example outlives the source
|
|
10288
|
+
* canvas — exactly like `previewImageUrl`. `exampleAssetUrl` is the
|
|
10289
|
+
* freshly-signed display URL, populated on read only and ignored on write.
|
|
10290
|
+
* Both absent when the port has no media example (unset, or a text port).
|
|
10291
|
+
*/
|
|
10292
|
+
exampleAssetKey: external_exports.string().nullable().optional(),
|
|
10293
|
+
exampleAssetUrl: external_exports.string().nullable().optional(),
|
|
10294
|
+
/**
|
|
10295
|
+
* Example prompt for a TEXT port — the text parallel of `exampleAssetKey`.
|
|
10296
|
+
* Stored inline (no S3, no signing) since it's just a string; the details
|
|
10297
|
+
* panel shows it truncated, and "use example as input" drops a text node
|
|
10298
|
+
* pre-filled with it. Absent for media ports and text ports with no example.
|
|
10299
|
+
*/
|
|
10300
|
+
exampleText: external_exports.string().max(TEMPLATE_EXAMPLE_TEXT_MAX_LENGTH).nullable().optional()
|
|
10242
10301
|
};
|
|
10243
10302
|
var TemplatePortTargetSchema = external_exports.object({
|
|
10244
10303
|
nodeKey: external_exports.string(),
|
|
@@ -10336,15 +10395,6 @@ var InstancePortBindingSchema = external_exports.discriminatedUnion("direction",
|
|
|
10336
10395
|
...InstancePortBindingBaseFields
|
|
10337
10396
|
})
|
|
10338
10397
|
]);
|
|
10339
|
-
var TemplatePortSummarySchema = external_exports.object({
|
|
10340
|
-
id: external_exports.string(),
|
|
10341
|
-
direction: external_exports.enum(["input", "output"]),
|
|
10342
|
-
label: external_exports.string(),
|
|
10343
|
-
handleType: external_exports.string(),
|
|
10344
|
-
required: external_exports.boolean().optional(),
|
|
10345
|
-
maxConnections: external_exports.number().int().positive().optional(),
|
|
10346
|
-
outputAspectRatio: external_exports.enum(ASPECT_RATIOS).nullable().optional()
|
|
10347
|
-
});
|
|
10348
10398
|
|
|
10349
10399
|
// ../api-contract/src/canvas.ts
|
|
10350
10400
|
var c7 = initContract();
|
|
@@ -11286,7 +11336,33 @@ var CanvasSettingsResponseSchema = external_exports.object({
|
|
|
11286
11336
|
createdAt: external_exports.string().datetime(),
|
|
11287
11337
|
updatedAt: external_exports.string().datetime()
|
|
11288
11338
|
});
|
|
11339
|
+
var PlaygroundCanvasReferenceSchema = external_exports.object({
|
|
11340
|
+
projectId: external_exports.string().uuid(),
|
|
11341
|
+
canvasId: external_exports.string().uuid()
|
|
11342
|
+
});
|
|
11343
|
+
var PlaygroundCanvasPageSchema = external_exports.object({
|
|
11344
|
+
projectId: external_exports.string().uuid().nullable(),
|
|
11345
|
+
data: external_exports.array(external_exports.object({ id: external_exports.string().uuid() })),
|
|
11346
|
+
total: external_exports.number().int().nonnegative()
|
|
11347
|
+
});
|
|
11289
11348
|
var canvasContract = c7.router({
|
|
11349
|
+
createPlaygroundCanvas: {
|
|
11350
|
+
method: "POST",
|
|
11351
|
+
path: "/playground/canvases",
|
|
11352
|
+
body: null,
|
|
11353
|
+
responses: {
|
|
11354
|
+
201: PlaygroundCanvasReferenceSchema,
|
|
11355
|
+
409: MessageResponseSchema
|
|
11356
|
+
}
|
|
11357
|
+
},
|
|
11358
|
+
listPlaygroundCanvases: {
|
|
11359
|
+
method: "GET",
|
|
11360
|
+
path: "/playground/canvases",
|
|
11361
|
+
query: external_exports.object({
|
|
11362
|
+
...paginationQuery({ maxLimit: 100, defaultLimit: 25 })
|
|
11363
|
+
}),
|
|
11364
|
+
responses: { 200: PlaygroundCanvasPageSchema }
|
|
11365
|
+
},
|
|
11290
11366
|
createCanvas: {
|
|
11291
11367
|
method: "POST",
|
|
11292
11368
|
path: "/projects/:projectId/canvases",
|
|
@@ -13816,8 +13892,81 @@ var projectContract = c14.router({
|
|
|
13816
13892
|
}
|
|
13817
13893
|
});
|
|
13818
13894
|
|
|
13895
|
+
// ../api-contract/src/template-apply-input.ts
|
|
13896
|
+
var TemplateApplyInputSchema = external_exports.discriminatedUnion("kind", [
|
|
13897
|
+
external_exports.object({
|
|
13898
|
+
kind: external_exports.literal("asset"),
|
|
13899
|
+
portId: external_exports.string(),
|
|
13900
|
+
assetId: external_exports.string().uuid(),
|
|
13901
|
+
mediaType: external_exports.enum(["image", "video", "audio", "pdf"])
|
|
13902
|
+
}),
|
|
13903
|
+
external_exports.object({
|
|
13904
|
+
kind: external_exports.literal("text"),
|
|
13905
|
+
portId: external_exports.string(),
|
|
13906
|
+
text: external_exports.string().min(1)
|
|
13907
|
+
})
|
|
13908
|
+
]);
|
|
13909
|
+
|
|
13910
|
+
// ../api-contract/src/template-public-api.ts
|
|
13911
|
+
var TemplateResponseSchema = external_exports.object({
|
|
13912
|
+
id: external_exports.string(),
|
|
13913
|
+
title: external_exports.string(),
|
|
13914
|
+
groupLabel: external_exports.string(),
|
|
13915
|
+
icon: external_exports.string(),
|
|
13916
|
+
description: external_exports.string(),
|
|
13917
|
+
previewImageUrl: external_exports.string().nullable(),
|
|
13918
|
+
previewVideoUrl: external_exports.string().nullable().optional(),
|
|
13919
|
+
inputPorts: external_exports.array(TemplatePortSummarySchema),
|
|
13920
|
+
outputPorts: external_exports.array(TemplatePortSummarySchema),
|
|
13921
|
+
canEdit: external_exports.boolean(),
|
|
13922
|
+
isGlobal: external_exports.boolean().optional(),
|
|
13923
|
+
authorName: external_exports.string().nullable().optional(),
|
|
13924
|
+
estimatedCreditCost: external_exports.number().optional(),
|
|
13925
|
+
tags: external_exports.array(external_exports.string()).optional()
|
|
13926
|
+
});
|
|
13927
|
+
var PublicApplyTemplateResponseSchema = external_exports.object({
|
|
13928
|
+
/** The created template instance id. */
|
|
13929
|
+
instanceId: external_exports.string(),
|
|
13930
|
+
/** The collapsed group id shown on the canvas. */
|
|
13931
|
+
groupId: external_exports.string()
|
|
13932
|
+
});
|
|
13933
|
+
var ApplyTemplateBodySchema = external_exports.object({
|
|
13934
|
+
canvasId: external_exports.string().uuid(),
|
|
13935
|
+
templateId: external_exports.string().uuid(),
|
|
13936
|
+
/** Box center X. Auto-positioned to avoid existing nodes if omitted. */
|
|
13937
|
+
centerX: external_exports.number().optional(),
|
|
13938
|
+
/** Box center Y. Auto-positioned to avoid existing nodes if omitted. */
|
|
13939
|
+
centerY: external_exports.number().optional(),
|
|
13940
|
+
/** Optional input values materialized with the template instance. */
|
|
13941
|
+
inputs: external_exports.array(TemplateApplyInputSchema).optional()
|
|
13942
|
+
});
|
|
13943
|
+
var templateListRoute = {
|
|
13944
|
+
method: "GET",
|
|
13945
|
+
path: "/templates",
|
|
13946
|
+
responses: {
|
|
13947
|
+
200: external_exports.object({
|
|
13948
|
+
data: external_exports.array(TemplateResponseSchema)
|
|
13949
|
+
})
|
|
13950
|
+
},
|
|
13951
|
+
summary: "List available templates (active)"
|
|
13952
|
+
};
|
|
13953
|
+
var templateApplyRouteBase = {
|
|
13954
|
+
method: "POST",
|
|
13955
|
+
path: "/templates/apply",
|
|
13956
|
+
body: ApplyTemplateBodySchema,
|
|
13957
|
+
summary: "Apply a template as a collapsed canvas box"
|
|
13958
|
+
};
|
|
13959
|
+
var publicTemplateApplyRoute = {
|
|
13960
|
+
...templateApplyRouteBase,
|
|
13961
|
+
responses: {
|
|
13962
|
+
200: PublicApplyTemplateResponseSchema,
|
|
13963
|
+
404: MessageResponseSchema
|
|
13964
|
+
}
|
|
13965
|
+
};
|
|
13966
|
+
|
|
13819
13967
|
// ../api-contract/src/upload.ts
|
|
13820
13968
|
var c15 = initContract();
|
|
13969
|
+
var PdfExtractionModeSchema = external_exports.enum(["summary", "pages"]);
|
|
13821
13970
|
var InitUploadBodySchema = external_exports.object({
|
|
13822
13971
|
nodeId: external_exports.string().uuid().optional(),
|
|
13823
13972
|
filename: external_exports.string(),
|
|
@@ -13877,7 +14026,10 @@ var CompleteUploadBodySchema = external_exports.object({
|
|
|
13877
14026
|
// edit/upstream change to keep `src` fresh for downstream nodes; those
|
|
13878
14027
|
// background refreshes set this so they don't mint a new version each time.
|
|
13879
14028
|
// Explicit user saves omit it and fork a new version as usual.
|
|
13880
|
-
replaceActiveVersion: external_exports.boolean().optional()
|
|
14029
|
+
replaceActiveVersion: external_exports.boolean().optional(),
|
|
14030
|
+
// PDF-only: how to process the upload once complete. Omitted ⇒ "summary"
|
|
14031
|
+
// (the server default and every non-PDF upload). See PdfExtractionModeSchema.
|
|
14032
|
+
pdfExtractionMode: PdfExtractionModeSchema.optional()
|
|
13881
14033
|
});
|
|
13882
14034
|
var CompleteUploadResponseSchema = external_exports.object({
|
|
13883
14035
|
success: external_exports.boolean(),
|
|
@@ -13998,6 +14150,10 @@ var publicContract = c16.router(
|
|
|
13998
14150
|
preset: {
|
|
13999
14151
|
list: presetsContract.listPresets
|
|
14000
14152
|
},
|
|
14153
|
+
template: {
|
|
14154
|
+
list: templateListRoute,
|
|
14155
|
+
apply: publicTemplateApplyRoute
|
|
14156
|
+
},
|
|
14001
14157
|
team: {
|
|
14002
14158
|
list: teamContract.listMyTeams
|
|
14003
14159
|
},
|
|
@@ -14249,7 +14405,7 @@ function isMajorUpgrade(current, latest) {
|
|
|
14249
14405
|
return l[0] > c17[0];
|
|
14250
14406
|
}
|
|
14251
14407
|
function shouldShowUpgradeNotice(ctx = {}) {
|
|
14252
|
-
const current = ctx.current ?? "0.
|
|
14408
|
+
const current = ctx.current ?? "0.10.0";
|
|
14253
14409
|
const latest = ctx.latest ?? serverLatestVersion;
|
|
14254
14410
|
const env = ctx.env ?? process.env;
|
|
14255
14411
|
const isTty = ctx.isTty ?? Boolean(process.stderr.isTTY);
|
|
@@ -14270,7 +14426,7 @@ Upgrade: npm install -g @melius-ai/cli@latest (or: brew update && brew upgrade
|
|
|
14270
14426
|
function printUpgradeNoticeIfNeeded(ctx = {}) {
|
|
14271
14427
|
try {
|
|
14272
14428
|
if (!shouldShowUpgradeNotice(ctx)) return;
|
|
14273
|
-
const current = ctx.current ?? "0.
|
|
14429
|
+
const current = ctx.current ?? "0.10.0";
|
|
14274
14430
|
const latest = ctx.latest ?? serverLatestVersion;
|
|
14275
14431
|
process.stderr.write(formatUpgradeNotice(current, latest));
|
|
14276
14432
|
} catch {
|
|
@@ -15302,14 +15458,27 @@ function shiftToAvoidExisting(result, allNodes, targetIds, allEdges = []) {
|
|
|
15302
15458
|
}));
|
|
15303
15459
|
const existingIds = new Set(otherNodes.map((n) => n.id));
|
|
15304
15460
|
const nodeById = new Map(allNodes.map((n) => [n.id, n]));
|
|
15461
|
+
function resolveTopLevelNodeId(id) {
|
|
15462
|
+
let resolvedId = id;
|
|
15463
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15464
|
+
while (!seen.has(resolvedId)) {
|
|
15465
|
+
seen.add(resolvedId);
|
|
15466
|
+
const parentId2 = nodeById.get(resolvedId)?.groupId;
|
|
15467
|
+
if (!parentId2) break;
|
|
15468
|
+
resolvedId = parentId2;
|
|
15469
|
+
}
|
|
15470
|
+
return resolvedId;
|
|
15471
|
+
}
|
|
15305
15472
|
const incomingSourceIds = /* @__PURE__ */ new Set();
|
|
15306
15473
|
const outgoingTargetIds = /* @__PURE__ */ new Set();
|
|
15307
15474
|
for (const edge of allEdges) {
|
|
15308
|
-
|
|
15309
|
-
|
|
15475
|
+
const srcNodeId = resolveTopLevelNodeId(edge.srcNodeId);
|
|
15476
|
+
const dstNodeId = resolveTopLevelNodeId(edge.dstNodeId);
|
|
15477
|
+
if (existingIds.has(srcNodeId) && targetIds.has(dstNodeId)) {
|
|
15478
|
+
incomingSourceIds.add(srcNodeId);
|
|
15310
15479
|
}
|
|
15311
|
-
if (targetIds.has(
|
|
15312
|
-
outgoingTargetIds.add(
|
|
15480
|
+
if (targetIds.has(srcNodeId) && existingIds.has(dstNodeId)) {
|
|
15481
|
+
outgoingTargetIds.add(dstNodeId);
|
|
15313
15482
|
}
|
|
15314
15483
|
}
|
|
15315
15484
|
const SCATTER_THRESHOLD = 3;
|
|
@@ -18816,6 +18985,120 @@ Examples:
|
|
|
18816
18985
|
);
|
|
18817
18986
|
}
|
|
18818
18987
|
|
|
18988
|
+
// src/commands/template.ts
|
|
18989
|
+
function parseCoordinate(value, option) {
|
|
18990
|
+
if (value === void 0) return void 0;
|
|
18991
|
+
const parsed = Number(value);
|
|
18992
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
18993
|
+
writeError(
|
|
18994
|
+
formatError("USAGE_ERROR", `${option} must be a finite number`, {
|
|
18995
|
+
suggestion: `Provide ${option} <number> or omit it for automatic placement`
|
|
18996
|
+
}),
|
|
18997
|
+
EXIT_USAGE_ERROR
|
|
18998
|
+
);
|
|
18999
|
+
}
|
|
19000
|
+
function parseInputs(value) {
|
|
19001
|
+
if (value === void 0) return void 0;
|
|
19002
|
+
let parsed;
|
|
19003
|
+
try {
|
|
19004
|
+
parsed = JSON.parse(value);
|
|
19005
|
+
} catch {
|
|
19006
|
+
writeError(
|
|
19007
|
+
formatError("USAGE_ERROR", "Invalid JSON in --inputs", {
|
|
19008
|
+
suggestion: `--inputs must be a JSON array, for example '[{"kind":"text","portId":"prompt","text":"A red shoe"}]'`
|
|
19009
|
+
}),
|
|
19010
|
+
EXIT_USAGE_ERROR
|
|
19011
|
+
);
|
|
19012
|
+
}
|
|
19013
|
+
const result = TemplateApplyInputSchema.array().safeParse(parsed);
|
|
19014
|
+
if (result.success) return result.data;
|
|
19015
|
+
writeError(
|
|
19016
|
+
formatError(
|
|
19017
|
+
"USAGE_ERROR",
|
|
19018
|
+
result.error.issues.map((issue) => issue.message).join("; "),
|
|
19019
|
+
{
|
|
19020
|
+
suggestion: 'Use text inputs {"kind":"text","portId":"<portId>","text":"<text>"} or asset inputs {"kind":"asset","portId":"<portId>","assetId":"<assetId>","mediaType":"image|video|audio|pdf"}'
|
|
19021
|
+
}
|
|
19022
|
+
),
|
|
19023
|
+
EXIT_USAGE_ERROR
|
|
19024
|
+
);
|
|
19025
|
+
}
|
|
19026
|
+
function registerTemplateCommands(program2, getOutputOpts) {
|
|
19027
|
+
const template = program2.command("template").description("List and apply opaque canvas workflow templates");
|
|
19028
|
+
template.command("list").description(
|
|
19029
|
+
"List available templates with display metadata and declared input/output ports"
|
|
19030
|
+
).addHelpText(
|
|
19031
|
+
"after",
|
|
19032
|
+
`
|
|
19033
|
+
Returns: Array of templates with id, title, description, previewImageUrl, inputPorts, outputPorts, and estimatedCreditCost.
|
|
19034
|
+
Includes global templates and templates scoped to the current team.
|
|
19035
|
+
The template's internal workflow stays private. Use a returned id with mel template apply.
|
|
19036
|
+
|
|
19037
|
+
Examples:
|
|
19038
|
+
$ mel template list
|
|
19039
|
+
$ mel template list --fields id,title,inputPorts,outputPorts`
|
|
19040
|
+
).action(async () => {
|
|
19041
|
+
const client = getClient();
|
|
19042
|
+
const result = await client.template.list();
|
|
19043
|
+
if (result.status !== 200) {
|
|
19044
|
+
handleApiError(result.status, result.body);
|
|
19045
|
+
}
|
|
19046
|
+
writeJson(result.body.data, getOutputOpts());
|
|
19047
|
+
});
|
|
19048
|
+
template.command("apply").description(
|
|
19049
|
+
"Apply a template to a canvas as one collapsed box and return its instanceId and groupId"
|
|
19050
|
+
).argument(
|
|
19051
|
+
"<canvasId>",
|
|
19052
|
+
"Canvas ID (from mel canvas create or mel canvas list output)"
|
|
19053
|
+
).argument("<templateId>", "Template ID (from mel template list output)").option(
|
|
19054
|
+
"--center-x <number>",
|
|
19055
|
+
"X center for the template box. Omit for automatic non-overlapping placement"
|
|
19056
|
+
).option(
|
|
19057
|
+
"--center-y <number>",
|
|
19058
|
+
"Y center for the template box. Omit for automatic non-overlapping placement"
|
|
19059
|
+
).option(
|
|
19060
|
+
"--inputs <json>",
|
|
19061
|
+
"JSON array of text or library-asset inputs targeting port IDs from mel template list"
|
|
19062
|
+
).addHelpText(
|
|
19063
|
+
"after",
|
|
19064
|
+
`
|
|
19065
|
+
Returns: { instanceId, groupId }. Internal workflow node IDs are never returned.
|
|
19066
|
+
Input kinds: text {kind,portId,text}; asset {kind,portId,assetId,mediaType} where mediaType is image, video, audio, or pdf.
|
|
19067
|
+
Omit --center-x/--center-y to place the box automatically. Use mel canvas content <canvasId> afterward to inspect its public ports.
|
|
19068
|
+
Run the applied template with mel bulk-run start <canvasId> --node-ids <groupId> --wait.
|
|
19069
|
+
|
|
19070
|
+
Examples:
|
|
19071
|
+
$ mel template apply <canvasId> <templateId>
|
|
19072
|
+
$ mel template apply <canvasId> <templateId> --inputs '[{"kind":"text","portId":"<portId>","text":"A red shoe"}]'
|
|
19073
|
+
$ mel bulk-run start <canvasId> --node-ids <groupId> --wait`
|
|
19074
|
+
).action(
|
|
19075
|
+
async (canvasId, templateId, opts) => {
|
|
19076
|
+
const client = getClient();
|
|
19077
|
+
const centerX = parseCoordinate(opts.centerX, "--center-x");
|
|
19078
|
+
const centerY = parseCoordinate(opts.centerY, "--center-y");
|
|
19079
|
+
const inputs = parseInputs(opts.inputs);
|
|
19080
|
+
const result = await client.template.apply({
|
|
19081
|
+
body: {
|
|
19082
|
+
canvasId,
|
|
19083
|
+
templateId,
|
|
19084
|
+
...centerX !== void 0 && { centerX },
|
|
19085
|
+
...centerY !== void 0 && { centerY },
|
|
19086
|
+
...inputs !== void 0 && { inputs }
|
|
19087
|
+
}
|
|
19088
|
+
});
|
|
19089
|
+
if (result.status !== 200) {
|
|
19090
|
+
handleApiError(
|
|
19091
|
+
result.status,
|
|
19092
|
+
result.body,
|
|
19093
|
+
"Run: mel template list"
|
|
19094
|
+
);
|
|
19095
|
+
}
|
|
19096
|
+
const { instanceId, groupId } = result.body;
|
|
19097
|
+
writeJson({ instanceId, groupId }, getOutputOpts());
|
|
19098
|
+
}
|
|
19099
|
+
);
|
|
19100
|
+
}
|
|
19101
|
+
|
|
18819
19102
|
// src/lib/upload.ts
|
|
18820
19103
|
import * as fs3 from "fs";
|
|
18821
19104
|
import * as path3 from "path";
|
|
@@ -19271,7 +19554,7 @@ function withDefaultHelp(args) {
|
|
|
19271
19554
|
}
|
|
19272
19555
|
function createProgram() {
|
|
19273
19556
|
const program2 = new Command();
|
|
19274
|
-
program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.
|
|
19557
|
+
program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.10.0").showSuggestionAfterError(true).option("--json", "Force JSON output (default)").option("--text", "Human-readable output").option(
|
|
19275
19558
|
"--fields <fields>",
|
|
19276
19559
|
"Select specific output fields (comma-separated)"
|
|
19277
19560
|
).option("--quiet", "Suppress output, exit code only").option("--verbose", "Log request/response metadata to stderr").addHelpText(
|
|
@@ -19310,6 +19593,7 @@ Learn more: https://docs.melius.com`
|
|
|
19310
19593
|
registerAudioCommands(program2, getOutputOpts);
|
|
19311
19594
|
registerFontCommands(program2, getOutputOpts);
|
|
19312
19595
|
registerPresetCommands(program2, getOutputOpts);
|
|
19596
|
+
registerTemplateCommands(program2, getOutputOpts);
|
|
19313
19597
|
registerConfigCommands(program2, getOutputOpts);
|
|
19314
19598
|
if (false) {
|
|
19315
19599
|
registerSkillCommands(program2, getOutputOpts);
|
package/dist/src/index.js
CHANGED