@vm0/cli 3.0.0 → 3.2.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/index.js +179 -111
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -12336,11 +12336,11 @@ var ApiClient = class {
|
|
|
12336
12336
|
}
|
|
12337
12337
|
return apiUrl;
|
|
12338
12338
|
}
|
|
12339
|
-
async
|
|
12339
|
+
async getComposeByName(name) {
|
|
12340
12340
|
const baseUrl = await this.getBaseUrl();
|
|
12341
12341
|
const headers = await this.getHeaders();
|
|
12342
12342
|
const response = await fetch(
|
|
12343
|
-
`${baseUrl}/api/agent/
|
|
12343
|
+
`${baseUrl}/api/agent/composes?name=${encodeURIComponent(name)}`,
|
|
12344
12344
|
{
|
|
12345
12345
|
method: "GET",
|
|
12346
12346
|
headers
|
|
@@ -12348,21 +12348,21 @@ var ApiClient = class {
|
|
|
12348
12348
|
);
|
|
12349
12349
|
if (!response.ok) {
|
|
12350
12350
|
const error43 = await response.json();
|
|
12351
|
-
throw new Error(error43.error?.message || `
|
|
12351
|
+
throw new Error(error43.error?.message || `Compose not found: ${name}`);
|
|
12352
12352
|
}
|
|
12353
12353
|
return await response.json();
|
|
12354
12354
|
}
|
|
12355
|
-
async
|
|
12355
|
+
async createOrUpdateCompose(body) {
|
|
12356
12356
|
const baseUrl = await this.getBaseUrl();
|
|
12357
12357
|
const headers = await this.getHeaders();
|
|
12358
|
-
const response = await fetch(`${baseUrl}/api/agent/
|
|
12358
|
+
const response = await fetch(`${baseUrl}/api/agent/composes`, {
|
|
12359
12359
|
method: "POST",
|
|
12360
12360
|
headers,
|
|
12361
12361
|
body: JSON.stringify(body)
|
|
12362
12362
|
});
|
|
12363
12363
|
if (!response.ok) {
|
|
12364
12364
|
const error43 = await response.json();
|
|
12365
|
-
throw new Error(error43.error?.message || "Failed to create
|
|
12365
|
+
throw new Error(error43.error?.message || "Failed to create compose");
|
|
12366
12366
|
}
|
|
12367
12367
|
return await response.json();
|
|
12368
12368
|
}
|
|
@@ -12480,7 +12480,7 @@ function validateVolumeConfig(volumeKey, volumeConfig) {
|
|
|
12480
12480
|
}
|
|
12481
12481
|
return null;
|
|
12482
12482
|
}
|
|
12483
|
-
function
|
|
12483
|
+
function validateAgentCompose(config2) {
|
|
12484
12484
|
if (!config2 || typeof config2 !== "object") {
|
|
12485
12485
|
return { valid: false, error: "Config must be an object" };
|
|
12486
12486
|
}
|
|
@@ -12637,7 +12637,7 @@ function expandEnvVarsInObject(obj) {
|
|
|
12637
12637
|
}
|
|
12638
12638
|
|
|
12639
12639
|
// src/commands/build.ts
|
|
12640
|
-
var buildCommand = new Command().name("build").description("Create or update agent
|
|
12640
|
+
var buildCommand = new Command().name("build").description("Create or update agent compose").argument("<config-file>", "Path to config YAML file").action(async (configFile) => {
|
|
12641
12641
|
try {
|
|
12642
12642
|
if (!existsSync2(configFile)) {
|
|
12643
12643
|
console.error(chalk2.red(`\u2717 Config file not found: ${configFile}`));
|
|
@@ -12672,19 +12672,19 @@ var buildCommand = new Command().name("build").description("Create or update age
|
|
|
12672
12672
|
process.exit(1);
|
|
12673
12673
|
}
|
|
12674
12674
|
config2 = expandEnvVarsInObject(config2);
|
|
12675
|
-
const validation =
|
|
12675
|
+
const validation = validateAgentCompose(config2);
|
|
12676
12676
|
if (!validation.valid) {
|
|
12677
12677
|
console.error(chalk2.red(`\u2717 ${validation.error}`));
|
|
12678
12678
|
process.exit(1);
|
|
12679
12679
|
}
|
|
12680
|
-
console.log(chalk2.blue("Uploading
|
|
12681
|
-
const response = await apiClient.
|
|
12680
|
+
console.log(chalk2.blue("Uploading compose..."));
|
|
12681
|
+
const response = await apiClient.createOrUpdateCompose({ config: config2 });
|
|
12682
12682
|
if (response.action === "created") {
|
|
12683
|
-
console.log(chalk2.green(`\u2713
|
|
12683
|
+
console.log(chalk2.green(`\u2713 Compose created: ${response.name}`));
|
|
12684
12684
|
} else {
|
|
12685
|
-
console.log(chalk2.green(`\u2713
|
|
12685
|
+
console.log(chalk2.green(`\u2713 Compose updated: ${response.name}`));
|
|
12686
12686
|
}
|
|
12687
|
-
console.log(chalk2.gray(`
|
|
12687
|
+
console.log(chalk2.gray(` Compose ID: ${response.composeId}`));
|
|
12688
12688
|
console.log();
|
|
12689
12689
|
console.log(" Run your agent:");
|
|
12690
12690
|
console.log(
|
|
@@ -12696,11 +12696,11 @@ var buildCommand = new Command().name("build").description("Create or update age
|
|
|
12696
12696
|
if (error43 instanceof Error) {
|
|
12697
12697
|
if (error43.message.includes("Not authenticated")) {
|
|
12698
12698
|
console.error(chalk2.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12699
|
-
} else if (error43.message.includes("Failed to create
|
|
12700
|
-
console.error(chalk2.red("\u2717 Failed to create
|
|
12699
|
+
} else if (error43.message.includes("Failed to create compose")) {
|
|
12700
|
+
console.error(chalk2.red("\u2717 Failed to create compose"));
|
|
12701
12701
|
console.error(chalk2.gray(` ${error43.message}`));
|
|
12702
12702
|
} else {
|
|
12703
|
-
console.error(chalk2.red("\u2717 Failed to create
|
|
12703
|
+
console.error(chalk2.red("\u2717 Failed to create compose"));
|
|
12704
12704
|
console.error(chalk2.gray(` ${error43.message}`));
|
|
12705
12705
|
}
|
|
12706
12706
|
} else {
|
|
@@ -12827,7 +12827,7 @@ var ClaudeEventParser = class {
|
|
|
12827
12827
|
timestamp: new Date(event.timestamp),
|
|
12828
12828
|
data: {
|
|
12829
12829
|
runId: event.runId,
|
|
12830
|
-
|
|
12830
|
+
agentComposeId: event.agentComposeId,
|
|
12831
12831
|
agentName: event.agentName,
|
|
12832
12832
|
prompt: event.prompt,
|
|
12833
12833
|
templateVars: event.templateVars,
|
|
@@ -12869,39 +12869,67 @@ var ClaudeEventParser = class {
|
|
|
12869
12869
|
// src/lib/event-renderer.ts
|
|
12870
12870
|
import chalk3 from "chalk";
|
|
12871
12871
|
var EventRenderer = class {
|
|
12872
|
+
/**
|
|
12873
|
+
* Format elapsed time between two timestamps
|
|
12874
|
+
* Returns [+Nms] for < 1000ms, [+N.Ns] for >= 1000ms
|
|
12875
|
+
*/
|
|
12876
|
+
static formatElapsed(previous, current) {
|
|
12877
|
+
const elapsedMs = current.getTime() - previous.getTime();
|
|
12878
|
+
if (elapsedMs < 1e3) {
|
|
12879
|
+
return `[+${elapsedMs}ms]`;
|
|
12880
|
+
}
|
|
12881
|
+
return `[+${(elapsedMs / 1e3).toFixed(1)}s]`;
|
|
12882
|
+
}
|
|
12883
|
+
/**
|
|
12884
|
+
* Format total elapsed time
|
|
12885
|
+
* Returns N.Ns format
|
|
12886
|
+
*/
|
|
12887
|
+
static formatTotalTime(start, end) {
|
|
12888
|
+
const elapsedMs = end.getTime() - start.getTime();
|
|
12889
|
+
return `${(elapsedMs / 1e3).toFixed(1)}s`;
|
|
12890
|
+
}
|
|
12872
12891
|
/**
|
|
12873
12892
|
* Render a parsed event to console
|
|
12874
12893
|
*/
|
|
12875
|
-
static render(event) {
|
|
12894
|
+
static render(event, options) {
|
|
12895
|
+
const elapsedPrefix = options?.verbose && options?.previousTimestamp ? chalk3.gray(
|
|
12896
|
+
this.formatElapsed(options.previousTimestamp, event.timestamp)
|
|
12897
|
+
) : "";
|
|
12876
12898
|
switch (event.type) {
|
|
12877
12899
|
case "init":
|
|
12878
|
-
this.renderInit(event);
|
|
12900
|
+
this.renderInit(event, elapsedPrefix);
|
|
12879
12901
|
break;
|
|
12880
12902
|
case "text":
|
|
12881
|
-
this.renderText(event);
|
|
12903
|
+
this.renderText(event, elapsedPrefix);
|
|
12882
12904
|
break;
|
|
12883
12905
|
case "tool_use":
|
|
12884
|
-
this.renderToolUse(event);
|
|
12906
|
+
this.renderToolUse(event, elapsedPrefix);
|
|
12885
12907
|
break;
|
|
12886
12908
|
case "tool_result":
|
|
12887
|
-
this.renderToolResult(event);
|
|
12909
|
+
this.renderToolResult(event, elapsedPrefix);
|
|
12888
12910
|
break;
|
|
12889
12911
|
case "result":
|
|
12890
|
-
this.renderResult(event);
|
|
12912
|
+
this.renderResult(event, elapsedPrefix);
|
|
12891
12913
|
break;
|
|
12892
12914
|
case "vm0_start":
|
|
12893
|
-
this.renderVm0Start(event);
|
|
12915
|
+
this.renderVm0Start(event, elapsedPrefix);
|
|
12894
12916
|
break;
|
|
12895
12917
|
case "vm0_result":
|
|
12896
|
-
this.renderVm0Result(
|
|
12918
|
+
this.renderVm0Result(
|
|
12919
|
+
event,
|
|
12920
|
+
elapsedPrefix,
|
|
12921
|
+
options?.verbose ? options?.startTimestamp : void 0
|
|
12922
|
+
);
|
|
12897
12923
|
break;
|
|
12898
12924
|
case "vm0_error":
|
|
12899
|
-
this.renderVm0Error(event);
|
|
12925
|
+
this.renderVm0Error(event, elapsedPrefix);
|
|
12900
12926
|
break;
|
|
12901
12927
|
}
|
|
12902
12928
|
}
|
|
12903
|
-
static renderInit(event) {
|
|
12904
|
-
console.log(
|
|
12929
|
+
static renderInit(event, elapsedPrefix) {
|
|
12930
|
+
console.log(
|
|
12931
|
+
chalk3.cyan("[init]") + elapsedPrefix + " Starting Claude Code agent"
|
|
12932
|
+
);
|
|
12905
12933
|
console.log(` Session: ${chalk3.gray(String(event.data.sessionId || ""))}`);
|
|
12906
12934
|
console.log(` Model: ${chalk3.gray(String(event.data.model || ""))}`);
|
|
12907
12935
|
console.log(
|
|
@@ -12910,13 +12938,13 @@ var EventRenderer = class {
|
|
|
12910
12938
|
)}`
|
|
12911
12939
|
);
|
|
12912
12940
|
}
|
|
12913
|
-
static renderText(event) {
|
|
12941
|
+
static renderText(event, elapsedPrefix) {
|
|
12914
12942
|
const text = String(event.data.text || "");
|
|
12915
|
-
console.log(chalk3.blue("[text]") + " " + text);
|
|
12943
|
+
console.log(chalk3.blue("[text]") + elapsedPrefix + " " + text);
|
|
12916
12944
|
}
|
|
12917
|
-
static renderToolUse(event) {
|
|
12945
|
+
static renderToolUse(event, elapsedPrefix) {
|
|
12918
12946
|
const tool = String(event.data.tool || "");
|
|
12919
|
-
console.log(chalk3.yellow("[tool_use]") + " " + tool);
|
|
12947
|
+
console.log(chalk3.yellow("[tool_use]") + elapsedPrefix + " " + tool);
|
|
12920
12948
|
const input = event.data.input;
|
|
12921
12949
|
if (input && typeof input === "object") {
|
|
12922
12950
|
for (const [key, value] of Object.entries(input)) {
|
|
@@ -12926,19 +12954,19 @@ var EventRenderer = class {
|
|
|
12926
12954
|
}
|
|
12927
12955
|
}
|
|
12928
12956
|
}
|
|
12929
|
-
static renderToolResult(event) {
|
|
12957
|
+
static renderToolResult(event, elapsedPrefix) {
|
|
12930
12958
|
const isError = Boolean(event.data.isError);
|
|
12931
12959
|
const status = isError ? "Error" : "Completed";
|
|
12932
12960
|
const color = isError ? chalk3.red : chalk3.green;
|
|
12933
|
-
console.log(color("[tool_result]") + " " + status);
|
|
12961
|
+
console.log(color("[tool_result]") + elapsedPrefix + " " + status);
|
|
12934
12962
|
const result = String(event.data.result || "");
|
|
12935
12963
|
console.log(` ${chalk3.gray(result)}`);
|
|
12936
12964
|
}
|
|
12937
|
-
static renderResult(event) {
|
|
12965
|
+
static renderResult(event, elapsedPrefix) {
|
|
12938
12966
|
const success2 = Boolean(event.data.success);
|
|
12939
12967
|
const status = success2 ? "\u2713 completed successfully" : "\u2717 failed";
|
|
12940
12968
|
const color = success2 ? chalk3.green : chalk3.red;
|
|
12941
|
-
console.log(color("[result]") + " " + status);
|
|
12969
|
+
console.log(color("[result]") + elapsedPrefix + " " + status);
|
|
12942
12970
|
const durationMs = Number(event.data.durationMs || 0);
|
|
12943
12971
|
const durationSec = (durationMs / 1e3).toFixed(1);
|
|
12944
12972
|
console.log(` Duration: ${chalk3.gray(durationSec + "s")}`);
|
|
@@ -12963,8 +12991,8 @@ var EventRenderer = class {
|
|
|
12963
12991
|
);
|
|
12964
12992
|
}
|
|
12965
12993
|
}
|
|
12966
|
-
static renderVm0Start(event) {
|
|
12967
|
-
console.log(chalk3.cyan("[vm0_start]") + " Run starting");
|
|
12994
|
+
static renderVm0Start(event, elapsedPrefix) {
|
|
12995
|
+
console.log(chalk3.cyan("[vm0_start]") + elapsedPrefix + " Run starting");
|
|
12968
12996
|
if (event.data.runId) {
|
|
12969
12997
|
console.log(` Run ID: ${chalk3.gray(String(event.data.runId))}`);
|
|
12970
12998
|
}
|
|
@@ -12975,8 +13003,10 @@ var EventRenderer = class {
|
|
|
12975
13003
|
}
|
|
12976
13004
|
this.renderArtifactAndVolumes(event.data);
|
|
12977
13005
|
}
|
|
12978
|
-
static renderVm0Result(event) {
|
|
12979
|
-
console.log(
|
|
13006
|
+
static renderVm0Result(event, elapsedPrefix, startTimestamp) {
|
|
13007
|
+
console.log(
|
|
13008
|
+
chalk3.green("[vm0_result]") + elapsedPrefix + " \u2713 Run completed successfully"
|
|
13009
|
+
);
|
|
12980
13010
|
console.log(
|
|
12981
13011
|
` Checkpoint: ${chalk3.gray(String(event.data.checkpointId || ""))}`
|
|
12982
13012
|
);
|
|
@@ -12987,6 +13017,10 @@ var EventRenderer = class {
|
|
|
12987
13017
|
` Conversation: ${chalk3.gray(String(event.data.conversationId || ""))}`
|
|
12988
13018
|
);
|
|
12989
13019
|
this.renderArtifactAndVolumes(event.data);
|
|
13020
|
+
if (startTimestamp) {
|
|
13021
|
+
const totalTime = this.formatTotalTime(startTimestamp, event.timestamp);
|
|
13022
|
+
console.log(` Total time: ${chalk3.gray(totalTime)}`);
|
|
13023
|
+
}
|
|
12990
13024
|
}
|
|
12991
13025
|
/**
|
|
12992
13026
|
* Format version ID for display (show short 8-character prefix)
|
|
@@ -13017,8 +13051,8 @@ var EventRenderer = class {
|
|
|
13017
13051
|
}
|
|
13018
13052
|
}
|
|
13019
13053
|
}
|
|
13020
|
-
static renderVm0Error(event) {
|
|
13021
|
-
console.log(chalk3.red("[vm0_error]") + " \u2717 Run failed");
|
|
13054
|
+
static renderVm0Error(event, elapsedPrefix) {
|
|
13055
|
+
console.log(chalk3.red("[vm0_error]") + elapsedPrefix + " \u2717 Run failed");
|
|
13022
13056
|
let errorMessage = "";
|
|
13023
13057
|
if (typeof event.data.error === "string") {
|
|
13024
13058
|
errorMessage = event.data.error;
|
|
@@ -13060,12 +13094,16 @@ function isUUID(str) {
|
|
|
13060
13094
|
return /^[0-9a-f-]{36}$/i.test(str);
|
|
13061
13095
|
}
|
|
13062
13096
|
var DEFAULT_TIMEOUT_SECONDS = 120;
|
|
13063
|
-
async function pollEvents(runId, timeoutSeconds) {
|
|
13097
|
+
async function pollEvents(runId, timeoutSeconds, options) {
|
|
13064
13098
|
let nextSequence = -1;
|
|
13065
13099
|
let complete = false;
|
|
13100
|
+
let runSucceeded = true;
|
|
13066
13101
|
const pollIntervalMs = 500;
|
|
13067
13102
|
const timeoutMs = timeoutSeconds * 1e3;
|
|
13068
13103
|
const startTime = Date.now();
|
|
13104
|
+
const startTimestamp = /* @__PURE__ */ new Date();
|
|
13105
|
+
let previousTimestamp = startTimestamp;
|
|
13106
|
+
const verbose = options?.verbose;
|
|
13069
13107
|
while (!complete) {
|
|
13070
13108
|
const elapsed = Date.now() - startTime;
|
|
13071
13109
|
if (elapsed > timeoutMs) {
|
|
@@ -13085,9 +13123,18 @@ async function pollEvents(runId, timeoutSeconds) {
|
|
|
13085
13123
|
event.eventData
|
|
13086
13124
|
);
|
|
13087
13125
|
if (parsed) {
|
|
13088
|
-
EventRenderer.render(parsed
|
|
13089
|
-
|
|
13126
|
+
EventRenderer.render(parsed, {
|
|
13127
|
+
verbose,
|
|
13128
|
+
previousTimestamp,
|
|
13129
|
+
startTimestamp
|
|
13130
|
+
});
|
|
13131
|
+
previousTimestamp = parsed.timestamp;
|
|
13132
|
+
if (parsed.type === "vm0_result") {
|
|
13133
|
+
complete = true;
|
|
13134
|
+
runSucceeded = true;
|
|
13135
|
+
} else if (parsed.type === "vm0_error") {
|
|
13090
13136
|
complete = true;
|
|
13137
|
+
runSucceeded = false;
|
|
13091
13138
|
}
|
|
13092
13139
|
}
|
|
13093
13140
|
}
|
|
@@ -13096,6 +13143,19 @@ async function pollEvents(runId, timeoutSeconds) {
|
|
|
13096
13143
|
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
13097
13144
|
}
|
|
13098
13145
|
}
|
|
13146
|
+
return runSucceeded;
|
|
13147
|
+
}
|
|
13148
|
+
function logVerbosePreFlight(action, details) {
|
|
13149
|
+
console.log(chalk4.blue(`
|
|
13150
|
+
${action}...`));
|
|
13151
|
+
for (const { label, value } of details) {
|
|
13152
|
+
if (value !== void 0) {
|
|
13153
|
+
console.log(chalk4.gray(` ${label}: ${value}`));
|
|
13154
|
+
}
|
|
13155
|
+
}
|
|
13156
|
+
console.log();
|
|
13157
|
+
console.log(chalk4.blue("Executing in sandbox..."));
|
|
13158
|
+
console.log();
|
|
13099
13159
|
}
|
|
13100
13160
|
var runCmd = new Command2().name("run").description("Execute an agent").argument(
|
|
13101
13161
|
"<identifier>",
|
|
@@ -13120,7 +13180,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
13120
13180
|
"-t, --timeout <seconds>",
|
|
13121
13181
|
"Polling timeout in seconds (default: 120)",
|
|
13122
13182
|
String(DEFAULT_TIMEOUT_SECONDS)
|
|
13123
|
-
).action(
|
|
13183
|
+
).option("-v, --verbose", "Show verbose output with timing information").action(
|
|
13124
13184
|
async (identifier, prompt, options) => {
|
|
13125
13185
|
const timeoutSeconds = parseInt(options.timeout, 10);
|
|
13126
13186
|
if (isNaN(timeoutSeconds) || timeoutSeconds <= 0) {
|
|
@@ -13138,17 +13198,24 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
13138
13198
|
);
|
|
13139
13199
|
process.exit(1);
|
|
13140
13200
|
}
|
|
13201
|
+
const verbose = options.verbose;
|
|
13141
13202
|
try {
|
|
13142
|
-
let
|
|
13203
|
+
let composeId;
|
|
13143
13204
|
if (isUUID(identifier)) {
|
|
13144
|
-
|
|
13145
|
-
|
|
13205
|
+
composeId = identifier;
|
|
13206
|
+
if (verbose) {
|
|
13207
|
+
console.log(chalk4.gray(` Using compose ID: ${composeId}`));
|
|
13208
|
+
}
|
|
13146
13209
|
} else {
|
|
13147
|
-
|
|
13210
|
+
if (verbose) {
|
|
13211
|
+
console.log(chalk4.gray(` Resolving agent name: ${identifier}`));
|
|
13212
|
+
}
|
|
13148
13213
|
try {
|
|
13149
|
-
const
|
|
13150
|
-
|
|
13151
|
-
|
|
13214
|
+
const compose = await apiClient.getComposeByName(identifier);
|
|
13215
|
+
composeId = compose.id;
|
|
13216
|
+
if (verbose) {
|
|
13217
|
+
console.log(chalk4.gray(` Resolved to compose ID: ${composeId}`));
|
|
13218
|
+
}
|
|
13152
13219
|
} catch (error43) {
|
|
13153
13220
|
if (error43 instanceof Error) {
|
|
13154
13221
|
console.error(chalk4.red(`\u2717 Agent not found: ${identifier}`));
|
|
@@ -13161,34 +13228,24 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
13161
13228
|
process.exit(1);
|
|
13162
13229
|
}
|
|
13163
13230
|
}
|
|
13164
|
-
|
|
13165
|
-
|
|
13166
|
-
|
|
13167
|
-
|
|
13168
|
-
|
|
13169
|
-
|
|
13170
|
-
|
|
13171
|
-
|
|
13172
|
-
|
|
13173
|
-
|
|
13174
|
-
|
|
13175
|
-
|
|
13176
|
-
|
|
13177
|
-
|
|
13178
|
-
|
|
13179
|
-
chalk4.gray(
|
|
13180
|
-
` Volume versions: ${JSON.stringify(options.volumeVersion)}`
|
|
13181
|
-
)
|
|
13182
|
-
);
|
|
13183
|
-
}
|
|
13184
|
-
if (options.conversation) {
|
|
13185
|
-
console.log(chalk4.gray(` Conversation: ${options.conversation}`));
|
|
13231
|
+
if (verbose) {
|
|
13232
|
+
logVerbosePreFlight("Creating agent run", [
|
|
13233
|
+
{ label: "Prompt", value: prompt },
|
|
13234
|
+
{
|
|
13235
|
+
label: "Variables",
|
|
13236
|
+
value: Object.keys(options.vars).length > 0 ? JSON.stringify(options.vars) : void 0
|
|
13237
|
+
},
|
|
13238
|
+
{ label: "Artifact", value: options.artifactName },
|
|
13239
|
+
{ label: "Artifact version", value: options.artifactVersion },
|
|
13240
|
+
{
|
|
13241
|
+
label: "Volume versions",
|
|
13242
|
+
value: Object.keys(options.volumeVersion).length > 0 ? JSON.stringify(options.volumeVersion) : void 0
|
|
13243
|
+
},
|
|
13244
|
+
{ label: "Conversation", value: options.conversation }
|
|
13245
|
+
]);
|
|
13186
13246
|
}
|
|
13187
|
-
console.log();
|
|
13188
|
-
console.log(chalk4.blue("Executing in sandbox..."));
|
|
13189
|
-
console.log();
|
|
13190
13247
|
const response = await apiClient.createRun({
|
|
13191
|
-
|
|
13248
|
+
agentComposeId: composeId,
|
|
13192
13249
|
prompt,
|
|
13193
13250
|
templateVars: Object.keys(options.vars).length > 0 ? options.vars : void 0,
|
|
13194
13251
|
artifactName: options.artifactName,
|
|
@@ -13196,7 +13253,12 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
13196
13253
|
volumeVersions: Object.keys(options.volumeVersion).length > 0 ? options.volumeVersion : void 0,
|
|
13197
13254
|
conversationId: options.conversation
|
|
13198
13255
|
});
|
|
13199
|
-
await pollEvents(response.runId, timeoutSeconds
|
|
13256
|
+
const succeeded = await pollEvents(response.runId, timeoutSeconds, {
|
|
13257
|
+
verbose
|
|
13258
|
+
});
|
|
13259
|
+
if (!succeeded) {
|
|
13260
|
+
process.exit(1);
|
|
13261
|
+
}
|
|
13200
13262
|
} catch (error43) {
|
|
13201
13263
|
if (error43 instanceof Error) {
|
|
13202
13264
|
if (error43.message.includes("Not authenticated")) {
|
|
@@ -13228,7 +13290,7 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
|
|
|
13228
13290
|
"-t, --timeout <seconds>",
|
|
13229
13291
|
"Polling timeout in seconds (default: 120)",
|
|
13230
13292
|
String(DEFAULT_TIMEOUT_SECONDS)
|
|
13231
|
-
).action(
|
|
13293
|
+
).option("-v, --verbose", "Show verbose output with timing information").action(
|
|
13232
13294
|
async (checkpointId, prompt, options, command) => {
|
|
13233
13295
|
const allOpts = command.optsWithGlobals();
|
|
13234
13296
|
const timeoutSeconds = parseInt(options.timeout, 10);
|
|
@@ -13238,6 +13300,7 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
|
|
|
13238
13300
|
);
|
|
13239
13301
|
process.exit(1);
|
|
13240
13302
|
}
|
|
13303
|
+
const verbose = options.verbose || allOpts.verbose;
|
|
13241
13304
|
try {
|
|
13242
13305
|
if (!isUUID(checkpointId)) {
|
|
13243
13306
|
console.error(
|
|
@@ -13246,25 +13309,27 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
|
|
|
13246
13309
|
console.error(chalk4.gray(" Checkpoint ID must be a valid UUID"));
|
|
13247
13310
|
process.exit(1);
|
|
13248
13311
|
}
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
|
|
13257
|
-
);
|
|
13312
|
+
if (verbose) {
|
|
13313
|
+
logVerbosePreFlight("Resuming agent run from checkpoint", [
|
|
13314
|
+
{ label: "Checkpoint ID", value: checkpointId },
|
|
13315
|
+
{ label: "Prompt", value: prompt },
|
|
13316
|
+
{
|
|
13317
|
+
label: "Volume overrides",
|
|
13318
|
+
value: Object.keys(allOpts.volumeVersion).length > 0 ? JSON.stringify(allOpts.volumeVersion) : void 0
|
|
13319
|
+
}
|
|
13320
|
+
]);
|
|
13258
13321
|
}
|
|
13259
|
-
console.log();
|
|
13260
|
-
console.log(chalk4.blue("Executing in sandbox..."));
|
|
13261
|
-
console.log();
|
|
13262
13322
|
const response = await apiClient.createRun({
|
|
13263
13323
|
checkpointId,
|
|
13264
13324
|
prompt,
|
|
13265
13325
|
volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
|
|
13266
13326
|
});
|
|
13267
|
-
await pollEvents(response.runId, timeoutSeconds
|
|
13327
|
+
const succeeded = await pollEvents(response.runId, timeoutSeconds, {
|
|
13328
|
+
verbose
|
|
13329
|
+
});
|
|
13330
|
+
if (!succeeded) {
|
|
13331
|
+
process.exit(1);
|
|
13332
|
+
}
|
|
13268
13333
|
} catch (error43) {
|
|
13269
13334
|
if (error43 instanceof Error) {
|
|
13270
13335
|
if (error43.message.includes("Not authenticated")) {
|
|
@@ -13295,7 +13360,7 @@ runCmd.command("continue").description(
|
|
|
13295
13360
|
"-t, --timeout <seconds>",
|
|
13296
13361
|
"Polling timeout in seconds (default: 120)",
|
|
13297
13362
|
String(DEFAULT_TIMEOUT_SECONDS)
|
|
13298
|
-
).action(
|
|
13363
|
+
).option("-v, --verbose", "Show verbose output with timing information").action(
|
|
13299
13364
|
async (agentSessionId, prompt, options, command) => {
|
|
13300
13365
|
const allOpts = command.optsWithGlobals();
|
|
13301
13366
|
const timeoutSeconds = parseInt(options.timeout, 10);
|
|
@@ -13305,6 +13370,7 @@ runCmd.command("continue").description(
|
|
|
13305
13370
|
);
|
|
13306
13371
|
process.exit(1);
|
|
13307
13372
|
}
|
|
13373
|
+
const verbose = options.verbose || allOpts.verbose;
|
|
13308
13374
|
try {
|
|
13309
13375
|
if (!isUUID(agentSessionId)) {
|
|
13310
13376
|
console.error(
|
|
@@ -13313,26 +13379,28 @@ runCmd.command("continue").description(
|
|
|
13313
13379
|
console.error(chalk4.gray(" Agent session ID must be a valid UUID"));
|
|
13314
13380
|
process.exit(1);
|
|
13315
13381
|
}
|
|
13316
|
-
|
|
13317
|
-
|
|
13318
|
-
|
|
13319
|
-
|
|
13320
|
-
|
|
13321
|
-
|
|
13322
|
-
|
|
13323
|
-
|
|
13324
|
-
|
|
13325
|
-
);
|
|
13382
|
+
if (verbose) {
|
|
13383
|
+
logVerbosePreFlight("Continuing agent run from session", [
|
|
13384
|
+
{ label: "Session ID", value: agentSessionId },
|
|
13385
|
+
{ label: "Prompt", value: prompt },
|
|
13386
|
+
{ label: "Note", value: "Using latest artifact version" },
|
|
13387
|
+
{
|
|
13388
|
+
label: "Volume overrides",
|
|
13389
|
+
value: Object.keys(allOpts.volumeVersion).length > 0 ? JSON.stringify(allOpts.volumeVersion) : void 0
|
|
13390
|
+
}
|
|
13391
|
+
]);
|
|
13326
13392
|
}
|
|
13327
|
-
console.log();
|
|
13328
|
-
console.log(chalk4.blue("Executing in sandbox..."));
|
|
13329
|
-
console.log();
|
|
13330
13393
|
const response = await apiClient.createRun({
|
|
13331
13394
|
sessionId: agentSessionId,
|
|
13332
13395
|
prompt,
|
|
13333
13396
|
volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
|
|
13334
13397
|
});
|
|
13335
|
-
await pollEvents(response.runId, timeoutSeconds
|
|
13398
|
+
const succeeded = await pollEvents(response.runId, timeoutSeconds, {
|
|
13399
|
+
verbose
|
|
13400
|
+
});
|
|
13401
|
+
if (!succeeded) {
|
|
13402
|
+
process.exit(1);
|
|
13403
|
+
}
|
|
13336
13404
|
} catch (error43) {
|
|
13337
13405
|
if (error43 instanceof Error) {
|
|
13338
13406
|
if (error43.message.includes("Not authenticated")) {
|
|
@@ -14059,7 +14127,7 @@ var artifactCommand = new Command10().name("artifact").description("Manage cloud
|
|
|
14059
14127
|
|
|
14060
14128
|
// src/index.ts
|
|
14061
14129
|
var program = new Command11();
|
|
14062
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("3.
|
|
14130
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("3.2.0");
|
|
14063
14131
|
program.command("hello").description("Say hello from the App").action(() => {
|
|
14064
14132
|
console.log(chalk11.blue("Welcome to the VM0 CLI!"));
|
|
14065
14133
|
console.log(chalk11.green(`Core says: ${FOO}`));
|