@cargo-ai/cli 1.0.75 → 1.0.77
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 +1 -1
- package/build/commands/ai/message.js +2 -2
- package/build/commands/orchestration/action.d.ts.map +1 -1
- package/build/commands/orchestration/action.js +3 -3
- package/build/commands/orchestration/batch.js +2 -2
- package/build/commands/orchestration/node.d.ts.map +1 -1
- package/build/commands/orchestration/node.js +3 -2
- package/build/commands/orchestration/nodeDiagram.d.ts +4 -0
- package/build/commands/orchestration/nodeDiagram.d.ts.map +1 -1
- package/build/commands/orchestration/release.d.ts.map +1 -1
- package/build/commands/orchestration/release.js +22 -7
- package/build/commands/orchestration/run.js +2 -2
- package/build/commands/runHandler.d.ts +1 -3
- package/build/commands/runHandler.d.ts.map +1 -1
- package/build/commands/runHandler.js +6 -32
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -168,7 +168,7 @@ Deploy a draft release of an **existing** workflow. Two input modes share the sa
|
|
|
168
168
|
# Compile a Workflow SDK module and deploy it
|
|
169
169
|
cargo-ai orchestration release deploy-draft --file ./my-workflow.ts
|
|
170
170
|
|
|
171
|
-
# Preview
|
|
171
|
+
# Preview nodes + form fields without deploying
|
|
172
172
|
cargo-ai orchestration release deploy-draft --file ./my-workflow.ts --dry-run
|
|
173
173
|
|
|
174
174
|
# Pin an explicit version + description
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseBooleanOption } from "../../utils/booleanOption.js";
|
|
2
2
|
import { loadCompiledAgent, resolveCompiledAgentFromState, } from "../../utils/loadCompiledAgent.js";
|
|
3
|
-
import { ExitCodes, failWith, handleApiCall, info, outputJson, parseJson,
|
|
3
|
+
import { ExitCodes, failWith, handleApiCall, info, outputJson, parseJson, pollUntilFinished, } from "../runHandler.js";
|
|
4
4
|
export function registerMessageCommands(parent, getApi) {
|
|
5
5
|
const message = parent
|
|
6
6
|
.command("message")
|
|
@@ -133,7 +133,7 @@ MCP client shape: { "name": string, "url": string }`)
|
|
|
133
133
|
}));
|
|
134
134
|
if (opts.waitUntilFinished === true) {
|
|
135
135
|
const intervalMs = parseInt(opts.pollingInterval, 10);
|
|
136
|
-
const finalResult = await
|
|
136
|
+
const finalResult = await pollUntilFinished(() => api.ai.message.get(result.assistantMessage.uuid), (r) => r.message.finishedAt, intervalMs);
|
|
137
137
|
outputJson(finalResult);
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
@@ -1 +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;
|
|
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;AAaxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAgTN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseBooleanOption } from "../../utils/booleanOption.js";
|
|
2
|
-
import { applyRecordsLimit, ExitCodes, failWith, handleApiCall, outputJson, parseJson, parsePositiveInt,
|
|
2
|
+
import { applyRecordsLimit, ExitCodes, failWith, handleApiCall, outputJson, parseJson, parsePositiveInt, pollUntilFinished, } from "../runHandler.js";
|
|
3
3
|
export function registerActionCommands(parent, getApi) {
|
|
4
4
|
const action = parent
|
|
5
5
|
.command("action")
|
|
@@ -97,7 +97,7 @@ Examples:
|
|
|
97
97
|
}));
|
|
98
98
|
if (opts.waitUntilFinished === true) {
|
|
99
99
|
const intervalMs = parseInt(opts.pollingInterval, 10);
|
|
100
|
-
const finalResult = await
|
|
100
|
+
const finalResult = await pollUntilFinished(() => api.orchestration.run.get(result.run.uuid), (r) => r.run.finishedAt, intervalMs);
|
|
101
101
|
outputJson(finalResult);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
@@ -139,7 +139,7 @@ Examples:
|
|
|
139
139
|
}));
|
|
140
140
|
if (opts.waitUntilFinished === true) {
|
|
141
141
|
const intervalMs = parseInt(opts.pollingInterval, 10);
|
|
142
|
-
const finalResult = await
|
|
142
|
+
const finalResult = await pollUntilFinished(() => api.orchestration.batch.get(result.batch.uuid), (r) => r.batch.finishedAt, intervalMs);
|
|
143
143
|
outputJson(finalResult);
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseBooleanOption } from "../../utils/booleanOption.js";
|
|
2
2
|
import { loadCompiledWorkflow, resolveCompiledWorkflowFromState, } from "../../utils/loadCompiledWorkflow.js";
|
|
3
|
-
import { ExitCodes, failWith, handleApiCall, info, outputJson, parseJson,
|
|
3
|
+
import { ExitCodes, failWith, handleApiCall, info, outputJson, parseJson, pollUntilFinished, } from "../runHandler.js";
|
|
4
4
|
export function registerBatchCommands(parent, getApi) {
|
|
5
5
|
const batch = parent
|
|
6
6
|
.command("batch")
|
|
@@ -103,7 +103,7 @@ Examples:
|
|
|
103
103
|
}));
|
|
104
104
|
if (opts.waitUntilFinished === true) {
|
|
105
105
|
const intervalMs = parseInt(opts.pollingInterval, 10);
|
|
106
|
-
const finalResult = await
|
|
106
|
+
const finalResult = await pollUntilFinished(() => api.orchestration.batch.get(result.batch.uuid), (r) => r.batch.finishedAt, intervalMs);
|
|
107
107
|
outputJson(finalResult);
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAiBxC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAiBxC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CAqK7E"}
|
|
@@ -12,8 +12,9 @@ Use these commands to inspect or debug the node graph of a workflow. To just
|
|
|
12
12
|
run a tool or connector action, no workflow needed, use instead:
|
|
13
13
|
$ cargo-ai orchestration action execute --action '<json>' --data '<json>'
|
|
14
14
|
|
|
15
|
-
'diagram', 'compute' and 'validate' are free and run nothing.
|
|
16
|
-
a dry run: it performs the node's real action and consumes
|
|
15
|
+
'diagram', 'compute' and 'validate' are free and run nothing.
|
|
16
|
+
'execute' is not a dry run: it performs the node's real action and consumes
|
|
17
|
+
credits.
|
|
17
18
|
|
|
18
19
|
Before deploying a graph:
|
|
19
20
|
$ cargo-ai orchestration node validate --nodes '<json>'
|
|
@@ -15,6 +15,10 @@ export type DiagramNode = {
|
|
|
15
15
|
childrenUuids?: (string | null)[] | null;
|
|
16
16
|
fallbackChildUuid?: string | null;
|
|
17
17
|
config?: Record<string, unknown> | null;
|
|
18
|
+
position?: {
|
|
19
|
+
x?: number;
|
|
20
|
+
y?: number;
|
|
21
|
+
} | null;
|
|
18
22
|
};
|
|
19
23
|
export type DiagramOptions = {
|
|
20
24
|
title?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeDiagram.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/nodeDi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commands/orchestration/release.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/release.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAoCxC,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAkLN"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { layoutWorkflowNodes, parseWorkflowLayoutNodes, } from "@cargo-ai/utils/workflow-layout";
|
|
1
2
|
import { parseBooleanOption } from "../../utils/booleanOption.js";
|
|
2
3
|
import { loadCompiledWorkflow, } from "../../utils/loadCompiledWorkflow.js";
|
|
3
4
|
import { ExitCodes, failWith, handleApiCall, info, outputJson, parseJson, success, } from "../runHandler.js";
|
|
@@ -61,12 +62,13 @@ export function registerReleaseCommands(parent, getApi) {
|
|
|
61
62
|
.option("--options <json>", "Options (JSON object)")
|
|
62
63
|
.action(async (opts) => {
|
|
63
64
|
const api = getApi();
|
|
65
|
+
const nodes = opts.nodes !== undefined
|
|
66
|
+
? await layoutOrFail(parseJson(opts.nodes, "--nodes"))
|
|
67
|
+
: undefined;
|
|
64
68
|
const result = await handleApiCall(() => api.orchestration.draftRelease.update({
|
|
65
69
|
workflowUuid: opts.workflowUuid,
|
|
66
70
|
parentUuid: opts.parentUuid,
|
|
67
|
-
nodes
|
|
68
|
-
? parseJson(opts.nodes, "--nodes")
|
|
69
|
-
: undefined,
|
|
71
|
+
nodes,
|
|
70
72
|
testRecords: opts.testRecords !== undefined
|
|
71
73
|
? parseJson(opts.testRecords, "--test-records")
|
|
72
74
|
: undefined,
|
|
@@ -122,11 +124,13 @@ async function runJsonDeploy(getApi, opts) {
|
|
|
122
124
|
const workflowUuid = opts.workflowUuid;
|
|
123
125
|
const nodesJson = opts.nodes;
|
|
124
126
|
const formFieldsJson = opts.formFields;
|
|
127
|
+
const parsedNodes = parseJson(nodesJson, "--nodes");
|
|
128
|
+
const nodes = await layoutOrFail(parsedNodes);
|
|
125
129
|
const api = getApi();
|
|
126
130
|
const result = await handleApiCall(() => api.orchestration.draftRelease.deploy({
|
|
127
131
|
workflowUuid,
|
|
128
132
|
version: opts.version,
|
|
129
|
-
nodes:
|
|
133
|
+
nodes: nodes,
|
|
130
134
|
formFields: formFieldsJson === "null"
|
|
131
135
|
? null
|
|
132
136
|
: parseJson(formFieldsJson, "--form-fields"),
|
|
@@ -153,10 +157,11 @@ async function runFileDeploy(getApi, opts) {
|
|
|
153
157
|
failWith("--form-fields is not allowed with --file (sourced from the module)", { code: ExitCodes.InvalidUsage });
|
|
154
158
|
}
|
|
155
159
|
const compiled = await loadCompiledWorkflow(opts.file);
|
|
160
|
+
const nodes = await layoutOrFail(compiled.nodes);
|
|
156
161
|
if (opts.dryRun === true) {
|
|
157
162
|
outputJson({
|
|
158
163
|
slug: compiled.slug,
|
|
159
|
-
nodes
|
|
164
|
+
nodes,
|
|
160
165
|
formFields: compiled.formFields,
|
|
161
166
|
});
|
|
162
167
|
return;
|
|
@@ -166,11 +171,11 @@ async function runFileDeploy(getApi, opts) {
|
|
|
166
171
|
const version = opts.version !== undefined
|
|
167
172
|
? opts.version
|
|
168
173
|
: await computeNextVersion(api, workflowUuid);
|
|
169
|
-
info(`Deploying "${compiled.slug}" → workflow ${workflowUuid} as v${version} (${String(
|
|
174
|
+
info(`Deploying "${compiled.slug}" → workflow ${workflowUuid} as v${version} (${String(nodes.length)} node(s))…`);
|
|
170
175
|
const payload = {
|
|
171
176
|
workflowUuid,
|
|
172
177
|
version,
|
|
173
|
-
nodes:
|
|
178
|
+
nodes: nodes,
|
|
174
179
|
formFields: compiled.formFields,
|
|
175
180
|
description: opts.description,
|
|
176
181
|
options: opts.options !== undefined
|
|
@@ -181,6 +186,16 @@ async function runFileDeploy(getApi, opts) {
|
|
|
181
186
|
success(`Deployed v${version}.`);
|
|
182
187
|
outputJson(result);
|
|
183
188
|
}
|
|
189
|
+
async function layoutOrFail(value) {
|
|
190
|
+
try {
|
|
191
|
+
return (await layoutWorkflowNodes(parseWorkflowLayoutNodes(value), {
|
|
192
|
+
nested: "recursive",
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
failWith(`layout failed: ${error instanceof Error ? error.message : String(error)}`, { code: ExitCodes.InvalidUsage });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
184
199
|
// Resolve the target workflow UUID. The platform `Workflow` has no free-form
|
|
185
200
|
// slug field — the closest stable identifier is `template.slug` — and there
|
|
186
201
|
// is no `workflow.create` endpoint, so an explicit `--workflow-uuid` always
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseBooleanOption } from "../../utils/booleanOption.js";
|
|
2
2
|
import { loadCompiledWorkflow, resolveCompiledWorkflowFromState, } from "../../utils/loadCompiledWorkflow.js";
|
|
3
|
-
import { ExitCodes, failWith, handleApiCall, info, outputJson, parseJson,
|
|
3
|
+
import { ExitCodes, failWith, handleApiCall, info, outputJson, parseJson, pollUntilFinished, } from "../runHandler.js";
|
|
4
4
|
export function registerRunCommands(parent, getApi) {
|
|
5
5
|
const run = parent
|
|
6
6
|
.command("run")
|
|
@@ -116,7 +116,7 @@ Examples:
|
|
|
116
116
|
}));
|
|
117
117
|
if (opts.waitUntilFinished === true) {
|
|
118
118
|
const intervalMs = parseInt(opts.pollingInterval, 10);
|
|
119
|
-
const finalResult = await
|
|
119
|
+
const finalResult = await pollUntilFinished(() => api.orchestration.run.get(result.run.uuid), (r) => r.run.finishedAt, intervalMs);
|
|
120
120
|
outputJson(finalResult);
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
@@ -47,8 +47,6 @@ type HandleApiCallOpts = {
|
|
|
47
47
|
};
|
|
48
48
|
export declare function handleApiCall<T>(fn: () => Promise<T>, opts?: HandleApiCallOpts): Promise<T>;
|
|
49
49
|
export declare function sleep(ms: number): Promise<void>;
|
|
50
|
-
export declare function
|
|
51
|
-
export declare function pollBatchUntilFinished<T>(getResult: () => Promise<T>, getStatus: (result: T) => string, intervalMs: number): Promise<T>;
|
|
52
|
-
export declare function pollMessageUntilFinished<T>(getResult: () => Promise<T>, getFinishedAt: (result: T) => string | null | undefined, intervalMs: number): Promise<T>;
|
|
50
|
+
export declare function pollUntilFinished<T>(getResult: () => Promise<T>, getFinishedAt: (result: T) => Date | string | null | undefined, intervalMs: number): Promise<T>;
|
|
53
51
|
export {};
|
|
54
52
|
//# sourceMappingURL=runHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runHandler.d.ts","sourceRoot":"","sources":["../../src/commands/runHandler.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;CAOZ,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAclE,eAAO,MAAM,MAAM;aACR,MAAM,KAAG,MAAM;eACb,MAAM,KAAG,MAAM;gBACd,MAAM,KAAG,MAAM;cACjB,MAAM,KAAG,MAAM;aAChB,MAAM,KAAG,MAAM;cACd,MAAM,KAAG,MAAM;CAC1B,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAM/C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAID,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAUhE;AAED,KAAK,YAAY,GAAG;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF,wBAA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wBAAgB,iBAAiB,CAAC,CAAC,EACjC,OAAO,EAAE,CAAC,EAAE,EACZ,KAAK,EAAE,MAAM,GACZ;IAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAAC,YAAY,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CASxD;AAKD,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACzB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,wBAAsB,aAAa,CAAC,CAAC,EACnC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,IAAI,CAAC,EAAE,iBAAiB,GACvB,OAAO,CAAC,CAAC,CAAC,CAgEZ;AA0ED,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,aAAa,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9D,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,CAAC,CAaZ"}
|
|
@@ -290,40 +290,14 @@ function extractApiErrorDetail(body) {
|
|
|
290
290
|
export function sleep(ms) {
|
|
291
291
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
292
292
|
}
|
|
293
|
-
|
|
294
|
-
"success",
|
|
295
|
-
"error",
|
|
296
|
-
"cancelled",
|
|
297
|
-
"skipped",
|
|
298
|
-
]);
|
|
299
|
-
const TERMINAL_BATCH_STATUSES = new Set([
|
|
300
|
-
"success",
|
|
301
|
-
"error",
|
|
302
|
-
"cancelled",
|
|
303
|
-
"skipped",
|
|
304
|
-
]);
|
|
305
|
-
export async function pollRunUntilFinished(getResult, getStatus, intervalMs) {
|
|
293
|
+
export async function pollUntilFinished(getResult, getFinishedAt, intervalMs) {
|
|
306
294
|
let result = await handleApiCall(getResult, { spinner: false });
|
|
307
|
-
while (
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}
|
|
313
|
-
export async function pollBatchUntilFinished(getResult, getStatus, intervalMs) {
|
|
314
|
-
let result = await handleApiCall(getResult, { spinner: false });
|
|
315
|
-
while (!TERMINAL_BATCH_STATUSES.has(getStatus(result))) {
|
|
316
|
-
await sleep(intervalMs);
|
|
317
|
-
result = await handleApiCall(getResult, { spinner: false });
|
|
318
|
-
}
|
|
319
|
-
return result;
|
|
320
|
-
}
|
|
321
|
-
export async function pollMessageUntilFinished(getResult, getFinishedAt, intervalMs) {
|
|
322
|
-
let result = await handleApiCall(getResult, { spinner: false });
|
|
323
|
-
const finishedAt = getFinishedAt(result);
|
|
324
|
-
while (finishedAt === null || finishedAt === undefined) {
|
|
295
|
+
while (true) {
|
|
296
|
+
const finishedAt = getFinishedAt(result);
|
|
297
|
+
if (finishedAt !== null && finishedAt !== undefined) {
|
|
298
|
+
return result;
|
|
299
|
+
}
|
|
325
300
|
await sleep(intervalMs);
|
|
326
301
|
result = await handleApiCall(getResult, { spinner: false });
|
|
327
302
|
}
|
|
328
|
-
return result;
|
|
329
303
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cargo-ai/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.77",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://getcargo.ai",
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
"@cargo-ai/api": "^1.0.71",
|
|
68
68
|
"@cargo-ai/app-sdk": "^1.0.9",
|
|
69
69
|
"@cargo-ai/cdk": "^1.0.61",
|
|
70
|
-
"@cargo-ai/types": "^1.0.
|
|
70
|
+
"@cargo-ai/types": "^1.0.68",
|
|
71
|
+
"@cargo-ai/utils": "^1.0.28",
|
|
71
72
|
"@cargo-ai/worker-sdk": "^1.0.17",
|
|
72
73
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
73
74
|
"commander": "^12.1.0",
|