@cargo-ai/cli 1.0.3 → 1.0.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"mcpClient.d.ts","sourceRoot":"","sources":["../../../src/commands/ai/mcpClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA+CN"}
1
+ {"version":3,"file":"mcpClient.d.ts","sourceRoot":"","sources":["../../../src/commands/ai/mcpClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAgDN"}
@@ -14,6 +14,7 @@ export function registerMcpClientCommands(parent, getApi) {
14
14
  const api = getApi();
15
15
  const result = await handleApiCall(() => api.ai.mcpClient.connect({
16
16
  mcpClient: {
17
+ kind: "custom",
17
18
  name: opts.name,
18
19
  url: opts.url,
19
20
  authentication: opts.authentication === undefined
@@ -1 +1 @@
1
- {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/commands/ai/release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAiQN"}
1
+ {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/commands/ai/release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAoQN"}
@@ -102,7 +102,7 @@ export function registerReleaseCommands(parent, getApi) {
102
102
  .requiredOption("--agent-uuid <uuid>", "Agent UUID")
103
103
  .requiredOption("--integration-slug <slug>", "Integration slug")
104
104
  .requiredOption("--language-model-slug <slug>", "Language model slug")
105
- .requiredOption("--version <version>", "Release version")
105
+ .option("--version <version>", "Release version (e.g. '1.0.0', '1.1.0', '1.0.1', etc.)")
106
106
  .requiredOption("--tools <json>", 'Tools (JSON array, e.g. [{"slug":"my-tool","kind":"tool","config":{}}])')
107
107
  .requiredOption("--mcp-clients <json>", 'MCP clients (JSON array, e.g. [{"name":"client","url":"https://...","authentication":null,"disabledToolSlugs":[]}])')
108
108
  .requiredOption("--resources <json>", 'Resources (JSON array, e.g. [{"slug":"my-resource","kind":"model","modelUuid":"..."}])')
@@ -1 +1 @@
1
- {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/batch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAiLN"}
1
+ {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/batch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAQxC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAwMN"}
@@ -1,4 +1,4 @@
1
- import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
1
+ import { handleApiCall, outputJson, parseJson, pollBatchUntilFinished, } from "../runHandler.js";
2
2
  export function registerBatchCommands(parent, getApi) {
3
3
  const batch = parent.command("batch").description("Batch operations");
4
4
  batch
@@ -63,6 +63,8 @@ export function registerBatchCommands(parent, getApi) {
63
63
  .requiredOption("--data <json>", 'Batch data (JSON, e.g. {"kind":"segment","segmentUuid":"..."} or {"kind":"file","s3Filename":"..."})')
64
64
  .option("--release-uuid <uuid>", "Release UUID")
65
65
  .option("--nodes <json>", 'Custom nodes to override the workflow definition (JSON array). Must include a start node (slug:"start") and an end node (slug:"end"). E.g. [{"uuid":"a","slug":"start","kind":"native","actionSlug":"start","config":{},"childrenUuids":["b"],"fallbackOnFailure":false,"position":{"x":0,"y":0}},{"uuid":"b","slug":"end","kind":"native","actionSlug":"end","config":{},"childrenUuids":[],"fallbackOnFailure":false,"position":{"x":1,"y":0}}]')
66
+ .option("--wait-until-finished", "Poll the batch until it reaches a terminal status before returning")
67
+ .option("--polling-interval <ms>", "Polling interval in milliseconds (used with --wait-until-finished)", "5000")
66
68
  .action(async (opts) => {
67
69
  const api = getApi();
68
70
  const result = await handleApiCall(() => api.orchestration.batch.create({
@@ -73,6 +75,12 @@ export function registerBatchCommands(parent, getApi) {
73
75
  : undefined,
74
76
  data: parseJson(opts.data, "--data"),
75
77
  }));
78
+ if (opts.waitUntilFinished === true) {
79
+ const intervalMs = parseInt(opts.pollingInterval, 10);
80
+ const finalResult = await pollBatchUntilFinished(() => api.orchestration.batch.get(result.batch.uuid), (r) => r.batch.status, intervalMs);
81
+ outputJson(finalResult);
82
+ return;
83
+ }
76
84
  outputJson(result);
77
85
  });
78
86
  batch
@@ -1 +1 @@
1
- {"version":3,"file":"draftRelease.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/draftRelease.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA2GN"}
1
+ {"version":3,"file":"draftRelease.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/draftRelease.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA8GN"}
@@ -18,7 +18,7 @@ export function registerDraftReleaseCommands(parent, getApi) {
18
18
  .command("deploy")
19
19
  .description("Deploy draft release")
20
20
  .requiredOption("--workflow-uuid <uuid>", "Workflow UUID")
21
- .requiredOption("--version <version>", "Release version")
21
+ .option("--version <version>", "Release version (e.g. '1.0.0', '1.1.0', '1.0.1', etc.)")
22
22
  .requiredOption("--nodes <json>", "Nodes (JSON array of node definitions)")
23
23
  .requiredOption("--form-fields <json>", "Form fields (JSON array, or 'null')")
24
24
  .option("--description <text>", "Release description")
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CA0T5E"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAQxC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CAiV5E"}
@@ -1,4 +1,4 @@
1
- import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
1
+ import { handleApiCall, outputJson, parseJson, pollRunUntilFinished, } from "../runHandler.js";
2
2
  export function registerRunCommands(parent, getApi) {
3
3
  const run = parent.command("run").description("Run operations");
4
4
  run
@@ -63,6 +63,8 @@ export function registerRunCommands(parent, getApi) {
63
63
  .requiredOption("--data <json>", "Run data (JSON, e.g. {...})")
64
64
  .option("--release-uuid <uuid>", "Release UUID")
65
65
  .option("--nodes <json>", 'Custom nodes to override the workflow definition (JSON array). Must include a start node (slug:"start") and an end node (slug:"end"). E.g. [{"uuid":"a","slug":"start","kind":"native","actionSlug":"start","config":{},"childrenUuids":["b"],"fallbackOnFailure":false,"position":{"x":0,"y":0}},{"uuid":"b","slug":"end","kind":"native","actionSlug":"end","config":{},"childrenUuids":[],"fallbackOnFailure":false,"position":{"x":1,"y":0}}]')
66
+ .option("--wait-until-finished", "Poll the run until it reaches a terminal status before returning")
67
+ .option("--polling-interval <ms>", "Polling interval in milliseconds (used with --wait-until-finished)", "5000")
66
68
  .action(async (opts) => {
67
69
  const data = parseJson(opts.data, "--data");
68
70
  const api = getApi();
@@ -74,6 +76,12 @@ export function registerRunCommands(parent, getApi) {
74
76
  : undefined,
75
77
  data,
76
78
  }));
79
+ if (opts.waitUntilFinished === true) {
80
+ const intervalMs = parseInt(opts.pollingInterval, 10);
81
+ const finalResult = await pollRunUntilFinished(() => api.orchestration.run.get(result.run.uuid), (r) => r.run.status, intervalMs);
82
+ outputJson(finalResult);
83
+ return;
84
+ }
77
85
  outputJson(result);
78
86
  });
79
87
  run
@@ -1,4 +1,6 @@
1
1
  export declare function outputJson(value: unknown): void;
2
2
  export declare function parseJson(value: string, optionName: string): any;
3
3
  export declare function handleApiCall<T>(fn: () => Promise<T>): Promise<T | never>;
4
+ export declare function pollRunUntilFinished<T>(getResult: () => Promise<T>, getStatus: (result: T) => string, intervalMs: number): Promise<T>;
5
+ export declare function pollBatchUntilFinished<T>(getResult: () => Promise<T>, getStatus: (result: T) => string, intervalMs: number): Promise<T>;
4
6
  //# sourceMappingURL=runHandler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runHandler.d.ts","sourceRoot":"","sources":["../../src/commands/runHandler.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE/C;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,CAWhE;AAED,wBAAsB,aAAa,CAAC,CAAC,EACnC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,CAiBpB"}
1
+ {"version":3,"file":"runHandler.d.ts","sourceRoot":"","sources":["../../src/commands/runHandler.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE/C;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,CAWhE;AAED,wBAAsB,aAAa,CAAC,CAAC,EACnC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,CAiBpB;AAoBD,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,EAChC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,CAAC,CASZ;AAED,wBAAsB,sBAAsB,CAAC,CAAC,EAC5C,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,EAChC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,CAAC,CASZ"}
@@ -31,3 +31,34 @@ export async function handleApiCall(fn) {
31
31
  throw err;
32
32
  }
33
33
  }
34
+ function sleep(ms) {
35
+ return new Promise((resolve) => setTimeout(resolve, ms));
36
+ }
37
+ const TERMINAL_RUN_STATUSES = new Set([
38
+ "success",
39
+ "error",
40
+ "cancelled",
41
+ "skipped",
42
+ ]);
43
+ const TERMINAL_BATCH_STATUSES = new Set([
44
+ "success",
45
+ "error",
46
+ "cancelled",
47
+ "skipped",
48
+ ]);
49
+ export async function pollRunUntilFinished(getResult, getStatus, intervalMs) {
50
+ let result = await handleApiCall(getResult);
51
+ while (!TERMINAL_RUN_STATUSES.has(getStatus(result))) {
52
+ await sleep(intervalMs);
53
+ result = await handleApiCall(getResult);
54
+ }
55
+ return result;
56
+ }
57
+ export async function pollBatchUntilFinished(getResult, getStatus, intervalMs) {
58
+ let result = await handleApiCall(getResult);
59
+ while (!TERMINAL_BATCH_STATUSES.has(getStatus(result))) {
60
+ await sleep(intervalMs);
61
+ result = await handleApiCall(getResult);
62
+ }
63
+ return result;
64
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cargo-ai/cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
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.10"
32
+ "@cargo-ai/api": "^1.0.11"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@cargo-ai/eslint-config": "*",