@vm0/cli 4.5.0 → 4.5.2

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.
Files changed (2) hide show
  1. package/index.js +44 -22
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -813,35 +813,34 @@ var EventRenderer = class {
813
813
  return `${(elapsedMs / 1e3).toFixed(1)}s`;
814
814
  }
815
815
  /**
816
- * Format timestamp for display
816
+ * Format timestamp for display (without milliseconds, matching metrics format)
817
817
  */
818
818
  static formatTimestamp(timestamp) {
819
- return timestamp.toISOString();
819
+ return timestamp.toISOString().replace(/\.\d{3}Z$/, "Z");
820
820
  }
821
821
  /**
822
822
  * Render a parsed event to console
823
823
  */
824
824
  static render(event, options) {
825
- const timestampPrefix = options?.showTimestamp ? chalk3.gray(`[${this.formatTimestamp(event.timestamp)}] `) : "";
826
- const elapsedPrefix = options?.verbose && options?.previousTimestamp ? chalk3.gray(
825
+ const timestampPrefix = options?.showTimestamp ? `[${this.formatTimestamp(event.timestamp)}] ` : "";
826
+ const elapsedSuffix = options?.verbose && options?.previousTimestamp ? " " + chalk3.gray(
827
827
  this.formatElapsed(options.previousTimestamp, event.timestamp)
828
828
  ) : "";
829
- const prefix = timestampPrefix + elapsedPrefix;
830
829
  switch (event.type) {
831
830
  case "init":
832
- this.renderInit(event, prefix);
831
+ this.renderInit(event, timestampPrefix, elapsedSuffix);
833
832
  break;
834
833
  case "text":
835
- this.renderText(event, prefix);
834
+ this.renderText(event, timestampPrefix, elapsedSuffix);
836
835
  break;
837
836
  case "tool_use":
838
- this.renderToolUse(event, prefix);
837
+ this.renderToolUse(event, timestampPrefix, elapsedSuffix);
839
838
  break;
840
839
  case "tool_result":
841
- this.renderToolResult(event, prefix);
840
+ this.renderToolResult(event, timestampPrefix, elapsedSuffix);
842
841
  break;
843
842
  case "result":
844
- this.renderResult(event, prefix);
843
+ this.renderResult(event, timestampPrefix, elapsedSuffix);
845
844
  break;
846
845
  }
847
846
  }
@@ -888,8 +887,10 @@ var EventRenderer = class {
888
887
  console.log(chalk3.red("\u2717 Run failed"));
889
888
  console.log(` Error: ${chalk3.red(error43 || "Unknown error")}`);
890
889
  }
891
- static renderInit(event, prefix) {
892
- console.log(chalk3.cyan("[init]") + prefix + " Starting Claude Code agent");
890
+ static renderInit(event, prefix, suffix) {
891
+ console.log(
892
+ prefix + chalk3.cyan("[init]") + suffix + " Starting Claude Code agent"
893
+ );
893
894
  console.log(` Session: ${chalk3.gray(String(event.data.sessionId || ""))}`);
894
895
  console.log(` Model: ${chalk3.gray(String(event.data.model || ""))}`);
895
896
  console.log(
@@ -898,13 +899,13 @@ var EventRenderer = class {
898
899
  )}`
899
900
  );
900
901
  }
901
- static renderText(event, prefix) {
902
+ static renderText(event, prefix, suffix) {
902
903
  const text = String(event.data.text || "");
903
- console.log(chalk3.blue("[text]") + prefix + " " + text);
904
+ console.log(prefix + chalk3.blue("[text]") + suffix + " " + text);
904
905
  }
905
- static renderToolUse(event, prefix) {
906
+ static renderToolUse(event, prefix, suffix) {
906
907
  const tool = String(event.data.tool || "");
907
- console.log(chalk3.yellow("[tool_use]") + prefix + " " + tool);
908
+ console.log(prefix + chalk3.yellow("[tool_use]") + suffix + " " + tool);
908
909
  const input = event.data.input;
909
910
  if (input && typeof input === "object") {
910
911
  for (const [key, value] of Object.entries(input)) {
@@ -915,19 +916,19 @@ var EventRenderer = class {
915
916
  }
916
917
  }
917
918
  }
918
- static renderToolResult(event, prefix) {
919
+ static renderToolResult(event, prefix, suffix) {
919
920
  const isError = Boolean(event.data.isError);
920
921
  const status = isError ? "Error" : "Completed";
921
922
  const color = isError ? chalk3.red : chalk3.green;
922
- console.log(color("[tool_result]") + prefix + " " + status);
923
+ console.log(prefix + color("[tool_result]") + suffix + " " + status);
923
924
  const result = String(event.data.result || "");
924
925
  console.log(` ${chalk3.gray(result)}`);
925
926
  }
926
- static renderResult(event, prefix) {
927
+ static renderResult(event, prefix, suffix) {
927
928
  const success2 = Boolean(event.data.success);
928
929
  const status = success2 ? "\u2713 completed successfully" : "\u2717 failed";
929
930
  const color = success2 ? chalk3.green : chalk3.red;
930
- console.log(color("[result]") + prefix + " " + status);
931
+ console.log(prefix + color("[result]") + suffix + " " + status);
931
932
  const durationMs = Number(event.data.durationMs || 0);
932
933
  const durationSec = (durationMs / 1e3).toFixed(1);
933
934
  console.log(` Duration: ${chalk3.gray(durationSec + "s")}`);
@@ -1201,6 +1202,13 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
1201
1202
  volumeVersions: Object.keys(options.volumeVersion).length > 0 ? options.volumeVersion : void 0,
1202
1203
  conversationId: options.conversation
1203
1204
  });
1205
+ if (response.status === "failed") {
1206
+ console.error(chalk4.red("\u2717 Run preparation failed"));
1207
+ if (response.error) {
1208
+ console.error(chalk4.gray(` ${response.error}`));
1209
+ }
1210
+ process.exit(1);
1211
+ }
1204
1212
  EventRenderer.renderRunStarted({
1205
1213
  runId: response.runId,
1206
1214
  sandboxId: response.sandboxId
@@ -1270,6 +1278,13 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
1270
1278
  prompt,
1271
1279
  volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
1272
1280
  });
1281
+ if (response.status === "failed") {
1282
+ console.error(chalk4.red("\u2717 Run preparation failed"));
1283
+ if (response.error) {
1284
+ console.error(chalk4.gray(` ${response.error}`));
1285
+ }
1286
+ process.exit(1);
1287
+ }
1273
1288
  EventRenderer.renderRunStarted({
1274
1289
  runId: response.runId,
1275
1290
  sandboxId: response.sandboxId
@@ -1337,6 +1352,13 @@ runCmd.command("continue").description(
1337
1352
  prompt,
1338
1353
  volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
1339
1354
  });
1355
+ if (response.status === "failed") {
1356
+ console.error(chalk4.red("\u2717 Run preparation failed"));
1357
+ if (response.error) {
1358
+ console.error(chalk4.gray(` ${response.error}`));
1359
+ }
1360
+ process.exit(1);
1361
+ }
1340
1362
  EventRenderer.renderRunStarted({
1341
1363
  runId: response.runId,
1342
1364
  sandboxId: response.sandboxId
@@ -15694,6 +15716,7 @@ var listCommand2 = new Command17().name("list").alias("ls").description("List yo
15694
15716
  // src/commands/image/delete.ts
15695
15717
  import { Command as Command18 } from "commander";
15696
15718
  import chalk17 from "chalk";
15719
+ import * as readline from "readline";
15697
15720
  var deleteCommand2 = new Command18().name("delete").alias("rm").description("Delete a custom image").argument("<name>", "Name of the image to delete").option("-f, --force", "Skip confirmation prompt").action(async (name, options) => {
15698
15721
  try {
15699
15722
  const listResponse = await apiClient.get("/api/images");
@@ -15710,7 +15733,6 @@ var deleteCommand2 = new Command18().name("delete").alias("rm").description("Del
15710
15733
  process.exit(1);
15711
15734
  }
15712
15735
  if (!options.force) {
15713
- const readline = await import("readline");
15714
15736
  const rl = readline.createInterface({
15715
15737
  input: process.stdin,
15716
15738
  output: process.stdout
@@ -15945,7 +15967,7 @@ function handleError(error43, runId) {
15945
15967
 
15946
15968
  // src/index.ts
15947
15969
  var program = new Command21();
15948
- program.name("vm0").description("VM0 CLI - A modern build tool").version("4.5.0");
15970
+ program.name("vm0").description("VM0 CLI - A modern build tool").version("4.5.2");
15949
15971
  program.command("info").description("Display environment information").action(async () => {
15950
15972
  console.log(chalk19.cyan("System Information:"));
15951
15973
  console.log(`Node Version: ${process.version}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "4.5.0",
3
+ "version": "4.5.2",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",