@vm0/cli 4.4.0 → 4.5.1

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 +48 -20
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -790,6 +790,7 @@ var EventRenderer = class {
790
790
  if (info.sandboxId) {
791
791
  console.log(` Sandbox: ${chalk3.gray(info.sandboxId)}`);
792
792
  }
793
+ console.log(chalk3.gray(` (use "vm0 logs ${info.runId}" to view logs)`));
793
794
  console.log();
794
795
  }
795
796
  /**
@@ -811,28 +812,36 @@ var EventRenderer = class {
811
812
  const elapsedMs = end.getTime() - start.getTime();
812
813
  return `${(elapsedMs / 1e3).toFixed(1)}s`;
813
814
  }
815
+ /**
816
+ * Format timestamp for display
817
+ */
818
+ static formatTimestamp(timestamp) {
819
+ return timestamp.toISOString();
820
+ }
814
821
  /**
815
822
  * Render a parsed event to console
816
823
  */
817
824
  static render(event, options) {
825
+ const timestampPrefix = options?.showTimestamp ? chalk3.gray(`[${this.formatTimestamp(event.timestamp)}] `) : "";
818
826
  const elapsedPrefix = options?.verbose && options?.previousTimestamp ? chalk3.gray(
819
827
  this.formatElapsed(options.previousTimestamp, event.timestamp)
820
828
  ) : "";
829
+ const prefix = timestampPrefix + elapsedPrefix;
821
830
  switch (event.type) {
822
831
  case "init":
823
- this.renderInit(event, elapsedPrefix);
832
+ this.renderInit(event, prefix);
824
833
  break;
825
834
  case "text":
826
- this.renderText(event, elapsedPrefix);
835
+ this.renderText(event, prefix);
827
836
  break;
828
837
  case "tool_use":
829
- this.renderToolUse(event, elapsedPrefix);
838
+ this.renderToolUse(event, prefix);
830
839
  break;
831
840
  case "tool_result":
832
- this.renderToolResult(event, elapsedPrefix);
841
+ this.renderToolResult(event, prefix);
833
842
  break;
834
843
  case "result":
835
- this.renderResult(event, elapsedPrefix);
844
+ this.renderResult(event, prefix);
836
845
  break;
837
846
  }
838
847
  }
@@ -879,10 +888,8 @@ var EventRenderer = class {
879
888
  console.log(chalk3.red("\u2717 Run failed"));
880
889
  console.log(` Error: ${chalk3.red(error43 || "Unknown error")}`);
881
890
  }
882
- static renderInit(event, elapsedPrefix) {
883
- console.log(
884
- chalk3.cyan("[init]") + elapsedPrefix + " Starting Claude Code agent"
885
- );
891
+ static renderInit(event, prefix) {
892
+ console.log(chalk3.cyan("[init]") + prefix + " Starting Claude Code agent");
886
893
  console.log(` Session: ${chalk3.gray(String(event.data.sessionId || ""))}`);
887
894
  console.log(` Model: ${chalk3.gray(String(event.data.model || ""))}`);
888
895
  console.log(
@@ -891,13 +898,13 @@ var EventRenderer = class {
891
898
  )}`
892
899
  );
893
900
  }
894
- static renderText(event, elapsedPrefix) {
901
+ static renderText(event, prefix) {
895
902
  const text = String(event.data.text || "");
896
- console.log(chalk3.blue("[text]") + elapsedPrefix + " " + text);
903
+ console.log(chalk3.blue("[text]") + prefix + " " + text);
897
904
  }
898
- static renderToolUse(event, elapsedPrefix) {
905
+ static renderToolUse(event, prefix) {
899
906
  const tool = String(event.data.tool || "");
900
- console.log(chalk3.yellow("[tool_use]") + elapsedPrefix + " " + tool);
907
+ console.log(chalk3.yellow("[tool_use]") + prefix + " " + tool);
901
908
  const input = event.data.input;
902
909
  if (input && typeof input === "object") {
903
910
  for (const [key, value] of Object.entries(input)) {
@@ -908,19 +915,19 @@ var EventRenderer = class {
908
915
  }
909
916
  }
910
917
  }
911
- static renderToolResult(event, elapsedPrefix) {
918
+ static renderToolResult(event, prefix) {
912
919
  const isError = Boolean(event.data.isError);
913
920
  const status = isError ? "Error" : "Completed";
914
921
  const color = isError ? chalk3.red : chalk3.green;
915
- console.log(color("[tool_result]") + elapsedPrefix + " " + status);
922
+ console.log(color("[tool_result]") + prefix + " " + status);
916
923
  const result = String(event.data.result || "");
917
924
  console.log(` ${chalk3.gray(result)}`);
918
925
  }
919
- static renderResult(event, elapsedPrefix) {
926
+ static renderResult(event, prefix) {
920
927
  const success2 = Boolean(event.data.success);
921
928
  const status = success2 ? "\u2713 completed successfully" : "\u2717 failed";
922
929
  const color = success2 ? chalk3.green : chalk3.red;
923
- console.log(color("[result]") + elapsedPrefix + " " + status);
930
+ console.log(color("[result]") + prefix + " " + status);
924
931
  const durationMs = Number(event.data.durationMs || 0);
925
932
  const durationSec = (durationMs / 1e3).toFixed(1);
926
933
  console.log(` Duration: ${chalk3.gray(durationSec + "s")}`);
@@ -1194,6 +1201,13 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
1194
1201
  volumeVersions: Object.keys(options.volumeVersion).length > 0 ? options.volumeVersion : void 0,
1195
1202
  conversationId: options.conversation
1196
1203
  });
1204
+ if (response.status === "failed") {
1205
+ console.error(chalk4.red("\u2717 Run preparation failed"));
1206
+ if (response.error) {
1207
+ console.error(chalk4.gray(` ${response.error}`));
1208
+ }
1209
+ process.exit(1);
1210
+ }
1197
1211
  EventRenderer.renderRunStarted({
1198
1212
  runId: response.runId,
1199
1213
  sandboxId: response.sandboxId
@@ -1263,6 +1277,13 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
1263
1277
  prompt,
1264
1278
  volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
1265
1279
  });
1280
+ if (response.status === "failed") {
1281
+ console.error(chalk4.red("\u2717 Run preparation failed"));
1282
+ if (response.error) {
1283
+ console.error(chalk4.gray(` ${response.error}`));
1284
+ }
1285
+ process.exit(1);
1286
+ }
1266
1287
  EventRenderer.renderRunStarted({
1267
1288
  runId: response.runId,
1268
1289
  sandboxId: response.sandboxId
@@ -1330,6 +1351,13 @@ runCmd.command("continue").description(
1330
1351
  prompt,
1331
1352
  volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
1332
1353
  });
1354
+ if (response.status === "failed") {
1355
+ console.error(chalk4.red("\u2717 Run preparation failed"));
1356
+ if (response.error) {
1357
+ console.error(chalk4.gray(` ${response.error}`));
1358
+ }
1359
+ process.exit(1);
1360
+ }
1333
1361
  EventRenderer.renderRunStarted({
1334
1362
  runId: response.runId,
1335
1363
  sandboxId: response.sandboxId
@@ -15687,6 +15715,7 @@ var listCommand2 = new Command17().name("list").alias("ls").description("List yo
15687
15715
  // src/commands/image/delete.ts
15688
15716
  import { Command as Command18 } from "commander";
15689
15717
  import chalk17 from "chalk";
15718
+ import * as readline from "readline";
15690
15719
  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) => {
15691
15720
  try {
15692
15721
  const listResponse = await apiClient.get("/api/images");
@@ -15703,7 +15732,6 @@ var deleteCommand2 = new Command18().name("delete").alias("rm").description("Del
15703
15732
  process.exit(1);
15704
15733
  }
15705
15734
  if (!options.force) {
15706
- const readline = await import("readline");
15707
15735
  const rl = readline.createInterface({
15708
15736
  input: process.stdin,
15709
15737
  output: process.stdout
@@ -15814,7 +15842,7 @@ function renderAgentEvent(event) {
15814
15842
  );
15815
15843
  if (parsed) {
15816
15844
  parsed.timestamp = new Date(event.createdAt);
15817
- EventRenderer.render(parsed);
15845
+ EventRenderer.render(parsed, { showTimestamp: true });
15818
15846
  }
15819
15847
  }
15820
15848
  function getLogType(options) {
@@ -15938,7 +15966,7 @@ function handleError(error43, runId) {
15938
15966
 
15939
15967
  // src/index.ts
15940
15968
  var program = new Command21();
15941
- program.name("vm0").description("VM0 CLI - A modern build tool").version("4.4.0");
15969
+ program.name("vm0").description("VM0 CLI - A modern build tool").version("4.5.1");
15942
15970
  program.command("info").description("Display environment information").action(async () => {
15943
15971
  console.log(chalk19.cyan("System Information:"));
15944
15972
  console.log(`Node Version: ${process.version}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "4.4.0",
3
+ "version": "4.5.1",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",