@vm0/cli 4.29.1 → 4.30.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 +54 -27
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -12616,7 +12616,8 @@ var runSystemLogContract = c2.router({
|
|
|
12616
12616
|
}),
|
|
12617
12617
|
query: external_exports.object({
|
|
12618
12618
|
since: external_exports.coerce.number().optional(),
|
|
12619
|
-
limit: external_exports.coerce.number().min(1).max(100).default(5)
|
|
12619
|
+
limit: external_exports.coerce.number().min(1).max(100).default(5),
|
|
12620
|
+
order: external_exports.enum(["asc", "desc"]).default("desc")
|
|
12620
12621
|
}),
|
|
12621
12622
|
responses: {
|
|
12622
12623
|
200: systemLogResponseSchema,
|
|
@@ -12639,7 +12640,8 @@ var runMetricsContract = c2.router({
|
|
|
12639
12640
|
}),
|
|
12640
12641
|
query: external_exports.object({
|
|
12641
12642
|
since: external_exports.coerce.number().optional(),
|
|
12642
|
-
limit: external_exports.coerce.number().min(1).max(100).default(5)
|
|
12643
|
+
limit: external_exports.coerce.number().min(1).max(100).default(5),
|
|
12644
|
+
order: external_exports.enum(["asc", "desc"]).default("desc")
|
|
12643
12645
|
}),
|
|
12644
12646
|
responses: {
|
|
12645
12647
|
200: metricsResponseSchema,
|
|
@@ -12662,7 +12664,8 @@ var runAgentEventsContract = c2.router({
|
|
|
12662
12664
|
}),
|
|
12663
12665
|
query: external_exports.object({
|
|
12664
12666
|
since: external_exports.coerce.number().optional(),
|
|
12665
|
-
limit: external_exports.coerce.number().min(1).max(100).default(5)
|
|
12667
|
+
limit: external_exports.coerce.number().min(1).max(100).default(5),
|
|
12668
|
+
order: external_exports.enum(["asc", "desc"]).default("desc")
|
|
12666
12669
|
}),
|
|
12667
12670
|
responses: {
|
|
12668
12671
|
200: agentEventsResponseSchema,
|
|
@@ -12685,7 +12688,8 @@ var runNetworkLogsContract = c2.router({
|
|
|
12685
12688
|
}),
|
|
12686
12689
|
query: external_exports.object({
|
|
12687
12690
|
since: external_exports.coerce.number().optional(),
|
|
12688
|
-
limit: external_exports.coerce.number().min(1).max(100).default(5)
|
|
12691
|
+
limit: external_exports.coerce.number().min(1).max(100).default(5),
|
|
12692
|
+
order: external_exports.enum(["asc", "desc"]).default("desc")
|
|
12689
12693
|
}),
|
|
12690
12694
|
responses: {
|
|
12691
12695
|
200: networkLogsResponseSchema,
|
|
@@ -13749,6 +13753,9 @@ var ApiClient = class {
|
|
|
13749
13753
|
if (options?.limit !== void 0) {
|
|
13750
13754
|
params.set("limit", String(options.limit));
|
|
13751
13755
|
}
|
|
13756
|
+
if (options?.order !== void 0) {
|
|
13757
|
+
params.set("order", options.order);
|
|
13758
|
+
}
|
|
13752
13759
|
const queryString = params.toString();
|
|
13753
13760
|
const url2 = `${baseUrl}/api/agent/runs/${runId}/telemetry/system-log${queryString ? `?${queryString}` : ""}`;
|
|
13754
13761
|
const response = await fetch(url2, {
|
|
@@ -13771,6 +13778,9 @@ var ApiClient = class {
|
|
|
13771
13778
|
if (options?.limit !== void 0) {
|
|
13772
13779
|
params.set("limit", String(options.limit));
|
|
13773
13780
|
}
|
|
13781
|
+
if (options?.order !== void 0) {
|
|
13782
|
+
params.set("order", options.order);
|
|
13783
|
+
}
|
|
13774
13784
|
const queryString = params.toString();
|
|
13775
13785
|
const url2 = `${baseUrl}/api/agent/runs/${runId}/telemetry/metrics${queryString ? `?${queryString}` : ""}`;
|
|
13776
13786
|
const response = await fetch(url2, {
|
|
@@ -13793,6 +13803,9 @@ var ApiClient = class {
|
|
|
13793
13803
|
if (options?.limit !== void 0) {
|
|
13794
13804
|
params.set("limit", String(options.limit));
|
|
13795
13805
|
}
|
|
13806
|
+
if (options?.order !== void 0) {
|
|
13807
|
+
params.set("order", options.order);
|
|
13808
|
+
}
|
|
13796
13809
|
const queryString = params.toString();
|
|
13797
13810
|
const url2 = `${baseUrl}/api/agent/runs/${runId}/telemetry/agent${queryString ? `?${queryString}` : ""}`;
|
|
13798
13811
|
const response = await fetch(url2, {
|
|
@@ -13815,6 +13828,9 @@ var ApiClient = class {
|
|
|
13815
13828
|
if (options?.limit !== void 0) {
|
|
13816
13829
|
params.set("limit", String(options.limit));
|
|
13817
13830
|
}
|
|
13831
|
+
if (options?.order !== void 0) {
|
|
13832
|
+
params.set("order", options.order);
|
|
13833
|
+
}
|
|
13818
13834
|
const queryString = params.toString();
|
|
13819
13835
|
const url2 = `${baseUrl}/api/agent/runs/${runId}/telemetry/network${queryString ? `?${queryString}` : ""}`;
|
|
13820
13836
|
const response = await fetch(url2, {
|
|
@@ -16909,7 +16925,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
16909
16925
|
}
|
|
16910
16926
|
var cookCmd = new Command13().name("cook").description("One-click agent preparation and execution from vm0.yaml");
|
|
16911
16927
|
cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
16912
|
-
const shouldExit = await checkAndUpgrade("4.
|
|
16928
|
+
const shouldExit = await checkAndUpgrade("4.30.0", prompt);
|
|
16913
16929
|
if (shouldExit) {
|
|
16914
16930
|
process.exit(0);
|
|
16915
16931
|
}
|
|
@@ -17082,7 +17098,7 @@ cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
|
17082
17098
|
cookCmd.command("logs").description("View logs from the last cook run").option("-a, --agent", "Show agent events (default)").option("-s, --system", "Show system log").option("-m, --metrics", "Show metrics").option("-n, --network", "Show network logs (proxy traffic)").option(
|
|
17083
17099
|
"--since <time>",
|
|
17084
17100
|
"Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z)"
|
|
17085
|
-
).option("--
|
|
17101
|
+
).option("--tail <n>", "Show last N entries (default: 5, max: 100)").option("--head <n>", "Show first N entries (max: 100)").action(
|
|
17086
17102
|
async (options) => {
|
|
17087
17103
|
const state = await loadCookState();
|
|
17088
17104
|
if (!state.lastRunId) {
|
|
@@ -17112,9 +17128,13 @@ cookCmd.command("logs").description("View logs from the last cook run").option("
|
|
|
17112
17128
|
args.push("--since", options.since);
|
|
17113
17129
|
displayArgs.push(`--since ${options.since}`);
|
|
17114
17130
|
}
|
|
17115
|
-
if (options.
|
|
17116
|
-
args.push("--
|
|
17117
|
-
displayArgs.push(`--
|
|
17131
|
+
if (options.tail) {
|
|
17132
|
+
args.push("--tail", options.tail);
|
|
17133
|
+
displayArgs.push(`--tail ${options.tail}`);
|
|
17134
|
+
}
|
|
17135
|
+
if (options.head) {
|
|
17136
|
+
args.push("--head", options.head);
|
|
17137
|
+
displayArgs.push(`--head ${options.head}`);
|
|
17118
17138
|
}
|
|
17119
17139
|
printCommand(displayArgs.join(" "));
|
|
17120
17140
|
await execVm0Command(args);
|
|
@@ -17704,34 +17724,38 @@ function getLogType(options) {
|
|
|
17704
17724
|
var logsCommand = new Command19().name("logs").description("View logs for an agent run").argument("<runId>", "Run ID to fetch logs for").option("-a, --agent", "Show agent events (default)").option("-s, --system", "Show system log").option("-m, --metrics", "Show metrics").option("-n, --network", "Show network logs (proxy traffic)").option(
|
|
17705
17725
|
"--since <time>",
|
|
17706
17726
|
"Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z, 1705312200)"
|
|
17707
|
-
).option(
|
|
17708
|
-
"--limit <n>",
|
|
17709
|
-
"Maximum number of entries to show (default: 5, max: 100)",
|
|
17710
|
-
"5"
|
|
17711
|
-
).action(
|
|
17727
|
+
).option("--tail <n>", "Show last N entries (default: 5, max: 100)").option("--head <n>", "Show first N entries (max: 100)").action(
|
|
17712
17728
|
async (runId, options) => {
|
|
17713
17729
|
try {
|
|
17714
17730
|
const logType = getLogType(options);
|
|
17731
|
+
if (options.tail !== void 0 && options.head !== void 0) {
|
|
17732
|
+
console.error(
|
|
17733
|
+
chalk21.red("Options --tail and --head are mutually exclusive")
|
|
17734
|
+
);
|
|
17735
|
+
process.exit(1);
|
|
17736
|
+
}
|
|
17715
17737
|
let since;
|
|
17716
17738
|
if (options.since) {
|
|
17717
17739
|
since = parseTime(options.since);
|
|
17718
17740
|
}
|
|
17741
|
+
const isHead = options.head !== void 0;
|
|
17719
17742
|
const limit = Math.min(
|
|
17720
|
-
Math.max(1, parseInt(options.
|
|
17743
|
+
Math.max(1, parseInt(options.head || options.tail || "5", 10)),
|
|
17721
17744
|
100
|
|
17722
17745
|
);
|
|
17746
|
+
const order = isHead ? "asc" : "desc";
|
|
17723
17747
|
switch (logType) {
|
|
17724
17748
|
case "agent":
|
|
17725
|
-
await showAgentEvents(runId, { since, limit });
|
|
17749
|
+
await showAgentEvents(runId, { since, limit, order });
|
|
17726
17750
|
break;
|
|
17727
17751
|
case "system":
|
|
17728
|
-
await showSystemLog(runId, { since, limit });
|
|
17752
|
+
await showSystemLog(runId, { since, limit, order });
|
|
17729
17753
|
break;
|
|
17730
17754
|
case "metrics":
|
|
17731
|
-
await showMetrics(runId, { since, limit });
|
|
17755
|
+
await showMetrics(runId, { since, limit, order });
|
|
17732
17756
|
break;
|
|
17733
17757
|
case "network":
|
|
17734
|
-
await showNetworkLogs(runId, { since, limit });
|
|
17758
|
+
await showNetworkLogs(runId, { since, limit, order });
|
|
17735
17759
|
break;
|
|
17736
17760
|
}
|
|
17737
17761
|
} catch (error43) {
|
|
@@ -17746,14 +17770,15 @@ async function showAgentEvents(runId, options) {
|
|
|
17746
17770
|
console.log(chalk21.yellow("No agent events found for this run."));
|
|
17747
17771
|
return;
|
|
17748
17772
|
}
|
|
17749
|
-
|
|
17773
|
+
const events = options.order === "desc" ? [...response.events].reverse() : response.events;
|
|
17774
|
+
for (const event of events) {
|
|
17750
17775
|
renderAgentEvent(event, response.provider);
|
|
17751
17776
|
}
|
|
17752
17777
|
if (response.hasMore) {
|
|
17753
17778
|
console.log();
|
|
17754
17779
|
console.log(
|
|
17755
17780
|
chalk21.dim(
|
|
17756
|
-
`Showing ${response.events.length} events. Use --
|
|
17781
|
+
`Showing ${response.events.length} events. Use --tail to see more.`
|
|
17757
17782
|
)
|
|
17758
17783
|
);
|
|
17759
17784
|
}
|
|
@@ -17768,7 +17793,7 @@ async function showSystemLog(runId, options) {
|
|
|
17768
17793
|
if (response.hasMore) {
|
|
17769
17794
|
console.log();
|
|
17770
17795
|
console.log(
|
|
17771
|
-
chalk21.dim("More log entries available. Use --
|
|
17796
|
+
chalk21.dim("More log entries available. Use --tail to see more.")
|
|
17772
17797
|
);
|
|
17773
17798
|
}
|
|
17774
17799
|
}
|
|
@@ -17778,14 +17803,15 @@ async function showMetrics(runId, options) {
|
|
|
17778
17803
|
console.log(chalk21.yellow("No metrics found for this run."));
|
|
17779
17804
|
return;
|
|
17780
17805
|
}
|
|
17781
|
-
|
|
17806
|
+
const metrics = options.order === "desc" ? [...response.metrics].reverse() : response.metrics;
|
|
17807
|
+
for (const metric of metrics) {
|
|
17782
17808
|
console.log(formatMetric(metric));
|
|
17783
17809
|
}
|
|
17784
17810
|
if (response.hasMore) {
|
|
17785
17811
|
console.log();
|
|
17786
17812
|
console.log(
|
|
17787
17813
|
chalk21.dim(
|
|
17788
|
-
`Showing ${response.metrics.length} metrics. Use --
|
|
17814
|
+
`Showing ${response.metrics.length} metrics. Use --tail to see more.`
|
|
17789
17815
|
)
|
|
17790
17816
|
);
|
|
17791
17817
|
}
|
|
@@ -17800,14 +17826,15 @@ async function showNetworkLogs(runId, options) {
|
|
|
17800
17826
|
);
|
|
17801
17827
|
return;
|
|
17802
17828
|
}
|
|
17803
|
-
|
|
17829
|
+
const networkLogs = options.order === "desc" ? [...response.networkLogs].reverse() : response.networkLogs;
|
|
17830
|
+
for (const entry of networkLogs) {
|
|
17804
17831
|
console.log(formatNetworkLog(entry));
|
|
17805
17832
|
}
|
|
17806
17833
|
if (response.hasMore) {
|
|
17807
17834
|
console.log();
|
|
17808
17835
|
console.log(
|
|
17809
17836
|
chalk21.dim(
|
|
17810
|
-
`Showing ${response.networkLogs.length} network logs. Use --
|
|
17837
|
+
`Showing ${response.networkLogs.length} network logs. Use --tail to see more.`
|
|
17811
17838
|
)
|
|
17812
17839
|
);
|
|
17813
17840
|
}
|
|
@@ -18511,7 +18538,7 @@ var setupGithubCommand = new Command24().name("setup-github").description("Initi
|
|
|
18511
18538
|
|
|
18512
18539
|
// src/index.ts
|
|
18513
18540
|
var program = new Command25();
|
|
18514
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.
|
|
18541
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.30.0");
|
|
18515
18542
|
program.command("info").description("Display environment information").action(async () => {
|
|
18516
18543
|
console.log(chalk26.bold("System Information:"));
|
|
18517
18544
|
console.log(`Node Version: ${process.version}`);
|