@vm0/cli 4.3.0 → 4.5.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 +28 -21
- 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,
|
|
832
|
+
this.renderInit(event, prefix);
|
|
824
833
|
break;
|
|
825
834
|
case "text":
|
|
826
|
-
this.renderText(event,
|
|
835
|
+
this.renderText(event, prefix);
|
|
827
836
|
break;
|
|
828
837
|
case "tool_use":
|
|
829
|
-
this.renderToolUse(event,
|
|
838
|
+
this.renderToolUse(event, prefix);
|
|
830
839
|
break;
|
|
831
840
|
case "tool_result":
|
|
832
|
-
this.renderToolResult(event,
|
|
841
|
+
this.renderToolResult(event, prefix);
|
|
833
842
|
break;
|
|
834
843
|
case "result":
|
|
835
|
-
this.renderResult(event,
|
|
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,
|
|
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,
|
|
901
|
+
static renderText(event, prefix) {
|
|
895
902
|
const text = String(event.data.text || "");
|
|
896
|
-
console.log(chalk3.blue("[text]") +
|
|
903
|
+
console.log(chalk3.blue("[text]") + prefix + " " + text);
|
|
897
904
|
}
|
|
898
|
-
static renderToolUse(event,
|
|
905
|
+
static renderToolUse(event, prefix) {
|
|
899
906
|
const tool = String(event.data.tool || "");
|
|
900
|
-
console.log(chalk3.yellow("[tool_use]") +
|
|
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,
|
|
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]") +
|
|
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,
|
|
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]") +
|
|
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")}`);
|
|
@@ -1703,7 +1710,7 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
1703
1710
|
console.log(chalk7.cyan(`Pulling volume: ${config2.name}`));
|
|
1704
1711
|
}
|
|
1705
1712
|
console.log(chalk7.gray("Downloading..."));
|
|
1706
|
-
let url2 = `/api/storages?name=${encodeURIComponent(config2.name)}`;
|
|
1713
|
+
let url2 = `/api/storages?name=${encodeURIComponent(config2.name)}&type=volume`;
|
|
1707
1714
|
if (versionId) {
|
|
1708
1715
|
url2 += `&version=${encodeURIComponent(versionId)}`;
|
|
1709
1716
|
}
|
|
@@ -2006,7 +2013,7 @@ var pullCommand2 = new Command9().name("pull").description("Pull cloud artifact
|
|
|
2006
2013
|
console.log(chalk10.cyan(`Pulling artifact: ${config2.name}`));
|
|
2007
2014
|
}
|
|
2008
2015
|
console.log(chalk10.gray("Downloading..."));
|
|
2009
|
-
let url2 = `/api/storages?name=${encodeURIComponent(config2.name)}`;
|
|
2016
|
+
let url2 = `/api/storages?name=${encodeURIComponent(config2.name)}&type=artifact`;
|
|
2010
2017
|
if (versionId) {
|
|
2011
2018
|
url2 += `&version=${encodeURIComponent(versionId)}`;
|
|
2012
2019
|
}
|
|
@@ -15814,7 +15821,7 @@ function renderAgentEvent(event) {
|
|
|
15814
15821
|
);
|
|
15815
15822
|
if (parsed) {
|
|
15816
15823
|
parsed.timestamp = new Date(event.createdAt);
|
|
15817
|
-
EventRenderer.render(parsed);
|
|
15824
|
+
EventRenderer.render(parsed, { showTimestamp: true });
|
|
15818
15825
|
}
|
|
15819
15826
|
}
|
|
15820
15827
|
function getLogType(options) {
|
|
@@ -15938,7 +15945,7 @@ function handleError(error43, runId) {
|
|
|
15938
15945
|
|
|
15939
15946
|
// src/index.ts
|
|
15940
15947
|
var program = new Command21();
|
|
15941
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.
|
|
15948
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.5.0");
|
|
15942
15949
|
program.command("info").description("Display environment information").action(async () => {
|
|
15943
15950
|
console.log(chalk19.cyan("System Information:"));
|
|
15944
15951
|
console.log(`Node Version: ${process.version}`);
|