@cargo-ai/cli 1.0.9 → 1.0.10
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/build/commands/orchestration/action.d.ts +4 -0
- package/build/commands/orchestration/action.d.ts.map +1 -0
- package/build/commands/orchestration/action.js +64 -0
- package/build/commands/orchestration/batch.js +2 -2
- package/build/commands/orchestration/index.d.ts.map +1 -1
- package/build/commands/orchestration/index.js +2 -0
- package/build/commands/orchestration/record.js +1 -1
- package/build/commands/orchestration/run.js +2 -2
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AASxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAmIN"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { handleApiCall, outputJson, parseJson, pollBatchUntilFinished, pollRunUntilFinished, } from "../runHandler.js";
|
|
2
|
+
export function registerActionCommands(parent, getApi) {
|
|
3
|
+
const action = parent
|
|
4
|
+
.command("action")
|
|
5
|
+
.description("Execute actions (single run or batch)");
|
|
6
|
+
action
|
|
7
|
+
.command("execute")
|
|
8
|
+
.description("Execute a single action")
|
|
9
|
+
.requiredOption("--action <json>", 'Action definition (JSON object, required). Example: \'{"kind":"tool","toolUuid":"550e8400-...","config":{}}\'')
|
|
10
|
+
.requiredOption("--data <json>", "Input data for the run (JSON object, required)")
|
|
11
|
+
.option("--wait-until-finished", "Poll the run until it reaches a terminal status before returning (boolean flag)")
|
|
12
|
+
.option("--polling-interval <ms>", "Polling interval in milliseconds, used with --wait-until-finished (integer, default: 5000)", "5000")
|
|
13
|
+
.addHelpText("after", `
|
|
14
|
+
Examples:
|
|
15
|
+
$ cargo-ai orchestration action execute --action '{"kind":"tool","toolUuid":"550e8400-...","config":{}}' --data '{"email":"user@example.com"}'
|
|
16
|
+
$ cargo-ai orchestration action execute --action '{"kind":"connector","integrationSlug":"slack","actionSlug":"send-message","config":{}}' --data '{"channel":"#general","text":"hello"}' --wait-until-finished`)
|
|
17
|
+
.action(async (opts) => {
|
|
18
|
+
const actionPayload = parseJson(opts.action, "--action");
|
|
19
|
+
const data = parseJson(opts.data, "--data");
|
|
20
|
+
const api = getApi();
|
|
21
|
+
const result = await handleApiCall(() => api.orchestration.action.execute({
|
|
22
|
+
action: actionPayload,
|
|
23
|
+
data,
|
|
24
|
+
}));
|
|
25
|
+
if (opts.waitUntilFinished === true) {
|
|
26
|
+
const intervalMs = parseInt(opts.pollingInterval, 10);
|
|
27
|
+
const finalResult = await pollRunUntilFinished(() => api.orchestration.run.get(result.run.uuid), (r) => r.run.status, intervalMs);
|
|
28
|
+
outputJson(finalResult);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
outputJson(result);
|
|
32
|
+
});
|
|
33
|
+
action
|
|
34
|
+
.command("execute-batch")
|
|
35
|
+
.description("Execute an action as a batch over multiple records")
|
|
36
|
+
.requiredOption("--action <json>", 'Action definition (JSON object, required). Example: \'{"kind":"tool","toolUuid":"550e8400-...","config":{}}\'')
|
|
37
|
+
.requiredOption("--records <json>", 'Records to process (JSON array, required). Example: \'[{"email":"a@b.com"},{"email":"c@d.com"}]\'')
|
|
38
|
+
.option("--webhook-url <url>", "URL to call when the batch completes")
|
|
39
|
+
.option("--webhook-secret <secret>", "Secret used to sign webhook deliveries")
|
|
40
|
+
.option("--wait-until-finished", "Poll the batch until it reaches a terminal status before returning (boolean flag)")
|
|
41
|
+
.option("--polling-interval <ms>", "Polling interval in milliseconds, used with --wait-until-finished (integer, default: 5000)", "5000")
|
|
42
|
+
.addHelpText("after", `
|
|
43
|
+
Examples:
|
|
44
|
+
$ cargo-ai orchestration action execute-batch --action '{"kind":"tool","toolUuid":"550e8400-...","config":{}}' --records '[{"email":"a@b.com"},{"email":"c@d.com"}]'
|
|
45
|
+
$ cargo-ai orchestration action execute-batch --action '{"kind":"connector","integrationSlug":"slack","actionSlug":"send-message","config":{}}' --records '[{"channel":"#general"}]' --wait-until-finished`)
|
|
46
|
+
.action(async (opts) => {
|
|
47
|
+
const actionPayload = parseJson(opts.action, "--action");
|
|
48
|
+
const records = parseJson(opts.records, "--records");
|
|
49
|
+
const api = getApi();
|
|
50
|
+
const result = await handleApiCall(() => api.orchestration.action.executeBatch({
|
|
51
|
+
action: actionPayload,
|
|
52
|
+
records,
|
|
53
|
+
webhookUrl: opts.webhookUrl,
|
|
54
|
+
webhookSecret: opts.webhookSecret,
|
|
55
|
+
}));
|
|
56
|
+
if (opts.waitUntilFinished === true) {
|
|
57
|
+
const intervalMs = parseInt(opts.pollingInterval, 10);
|
|
58
|
+
const finalResult = await pollBatchUntilFinished(() => api.orchestration.batch.get(result.batch.uuid), (r) => r.batch.status, intervalMs);
|
|
59
|
+
outputJson(finalResult);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
outputJson(result);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
@@ -64,7 +64,7 @@ export function registerBatchCommands(parent, getApi) {
|
|
|
64
64
|
.option("--workflow-uuid <uuid>", "Workflow UUID (string)")
|
|
65
65
|
.requiredOption("--data <json>", 'Batch data source (JSON object, required). Supported kinds: {"kind":"segment","segmentUuid":"..."} or {"kind":"file","s3Filename":"..."}')
|
|
66
66
|
.option("--release-uuid <uuid>", "Release UUID to pin the batch to (string)")
|
|
67
|
-
.option("--nodes <json>",
|
|
67
|
+
.option("--nodes <json>", "Custom nodes to override the workflow definition (JSON array).")
|
|
68
68
|
.option("--wait-until-finished", "Poll the batch until it reaches a terminal status before returning (boolean flag)")
|
|
69
69
|
.option("--polling-interval <ms>", "Polling interval in milliseconds, used with --wait-until-finished (integer, default: 5000)", "5000")
|
|
70
70
|
.addHelpText("after", `
|
|
@@ -114,7 +114,7 @@ Examples:
|
|
|
114
114
|
.command("download")
|
|
115
115
|
.description("Download batch results")
|
|
116
116
|
.requiredOption("--uuid <uuid>", "Batch UUID (string, required)")
|
|
117
|
-
.
|
|
117
|
+
.option("--output-node-slug <slug>", "Output node slug to download from (string)")
|
|
118
118
|
.action(async (opts) => {
|
|
119
119
|
const api = getApi();
|
|
120
120
|
const result = await handleApiCall(() => api.orchestration.batch.download({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAcxC,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAiBN"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerActionCommands } from "./action.js";
|
|
1
2
|
import { registerBatchCommands } from "./batch.js";
|
|
2
3
|
import { registerDraftReleaseCommands } from "./draftRelease.js";
|
|
3
4
|
import { registerLogCommands } from "./log.js";
|
|
@@ -13,6 +14,7 @@ export function registerOrchestrationCommands(parent, getApi) {
|
|
|
13
14
|
const orchestration = parent
|
|
14
15
|
.command("orchestration")
|
|
15
16
|
.description("Workflows, plays, runs, batches, tools, templates");
|
|
17
|
+
registerActionCommands(orchestration, getApi);
|
|
16
18
|
registerWorkflowCommands(orchestration, getApi);
|
|
17
19
|
registerPlayCommands(orchestration, getApi);
|
|
18
20
|
registerRunCommands(orchestration, getApi);
|
|
@@ -138,7 +138,7 @@ export function registerRecordCommands(parent, getApi) {
|
|
|
138
138
|
.command("download-outputs")
|
|
139
139
|
.description("Download record outputs")
|
|
140
140
|
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID")
|
|
141
|
-
.
|
|
141
|
+
.option("--output-node-slug <slug>", "Output node slug")
|
|
142
142
|
.option("--format <format>", "Export format (csv or json)", "csv")
|
|
143
143
|
.option("--ids <list>", "Record IDs (comma-separated)")
|
|
144
144
|
.option("--title <title>", "Record title")
|
|
@@ -69,7 +69,7 @@ Examples:
|
|
|
69
69
|
.option("--workflow-uuid <uuid>", "Workflow UUID (string)")
|
|
70
70
|
.requiredOption("--data <json>", "Run input data (JSON object, required). The shape depends on your workflow's start node configuration")
|
|
71
71
|
.option("--release-uuid <uuid>", "Release UUID to pin the run to (string)")
|
|
72
|
-
.option("--nodes <json>",
|
|
72
|
+
.option("--nodes <json>", "Custom nodes to override the workflow definition (JSON array).")
|
|
73
73
|
.option("--wait-until-finished", "Poll the run until it reaches a terminal status before returning (boolean flag)")
|
|
74
74
|
.option("--polling-interval <ms>", "Polling interval in milliseconds, used with --wait-until-finished (integer, default: 5000)", "5000")
|
|
75
75
|
.addHelpText("after", `
|
|
@@ -206,7 +206,7 @@ Examples:
|
|
|
206
206
|
.command("download-outputs")
|
|
207
207
|
.description("Download outputs from a specific node in matching runs")
|
|
208
208
|
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID (string, required)")
|
|
209
|
-
.
|
|
209
|
+
.option("--output-node-slug <slug>", "Output node slug to download from (string)")
|
|
210
210
|
.option("--format <format>", "Export format: csv | json (default: csv)", "csv")
|
|
211
211
|
.option("--batch-uuid <uuid>", "Filter by batch UUID (string)")
|
|
212
212
|
.option("--release-uuid <uuid>", "Filter by release UUID (string)")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cargo-ai/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Command-line interface for the Cargo API",
|
|
6
6
|
"engines": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"commander": "^12.1.0",
|
|
32
|
-
"@cargo-ai/api": "^1.0.
|
|
32
|
+
"@cargo-ai/api": "^1.0.18"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@cargo-ai/eslint-config": "*",
|