@vm0/cli 9.7.0 → 9.8.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 +86 -22
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -4626,15 +4626,15 @@ function formatToolHeader(data) {
|
|
|
4626
4626
|
return [headline];
|
|
4627
4627
|
}
|
|
4628
4628
|
var toolHeadlineFormatters = {
|
|
4629
|
-
Read: (input) => `Read
|
|
4630
|
-
Edit: (input) => `Edit
|
|
4631
|
-
Write: (input) => `Write
|
|
4632
|
-
Bash: (input) => `Bash
|
|
4633
|
-
Glob: (input) => `Glob
|
|
4634
|
-
Grep: (input) => `Grep
|
|
4635
|
-
Task: (input) => `Task
|
|
4636
|
-
WebFetch: (input) => `WebFetch
|
|
4637
|
-
WebSearch: (input) => `WebSearch
|
|
4629
|
+
Read: (input) => `Read${chalk4.dim(`(${String(input.file_path || "")})`)}`,
|
|
4630
|
+
Edit: (input) => `Edit${chalk4.dim(`(${String(input.file_path || "")})`)}`,
|
|
4631
|
+
Write: (input) => `Write${chalk4.dim(`(${String(input.file_path || "")})`)}`,
|
|
4632
|
+
Bash: (input) => `Bash${chalk4.dim(`(${truncate(String(input.command || ""), 60)})`)}`,
|
|
4633
|
+
Glob: (input) => `Glob${chalk4.dim(`(${String(input.pattern || "")})`)}`,
|
|
4634
|
+
Grep: (input) => `Grep${chalk4.dim(`(${String(input.pattern || "")})`)}`,
|
|
4635
|
+
Task: (input) => `Task${chalk4.dim(`(${truncate(String(input.description || ""), 60)})`)}`,
|
|
4636
|
+
WebFetch: (input) => `WebFetch${chalk4.dim(`(${truncate(String(input.url || ""), 60)})`)}`,
|
|
4637
|
+
WebSearch: (input) => `WebSearch${chalk4.dim(`(${truncate(String(input.query || ""), 60)})`)}`,
|
|
4638
4638
|
TodoWrite: () => "TodoWrite"
|
|
4639
4639
|
};
|
|
4640
4640
|
function getToolHeadline(tool, input) {
|
|
@@ -4645,6 +4645,11 @@ function formatToolResult(toolUse, result, verbose) {
|
|
|
4645
4645
|
const { tool, input } = toolUse;
|
|
4646
4646
|
const { result: resultText, isError } = result;
|
|
4647
4647
|
const lines = [];
|
|
4648
|
+
if (tool === "Read" && !isError && resultText) {
|
|
4649
|
+
const readLines = formatReadContent(resultText, verbose);
|
|
4650
|
+
lines.push(...readLines);
|
|
4651
|
+
return lines;
|
|
4652
|
+
}
|
|
4648
4653
|
if (tool === "TodoWrite" && !isError) {
|
|
4649
4654
|
const todoLines = formatTodoList(input);
|
|
4650
4655
|
lines.push(...todoLines);
|
|
@@ -4690,6 +4695,43 @@ function formatToolResult(toolUse, result, verbose) {
|
|
|
4690
4695
|
}
|
|
4691
4696
|
return lines;
|
|
4692
4697
|
}
|
|
4698
|
+
function formatReadContent(resultText, verbose) {
|
|
4699
|
+
const lines = [];
|
|
4700
|
+
const rawLines = resultText.split("\n");
|
|
4701
|
+
const contentLines = [];
|
|
4702
|
+
const lineNumberPattern = /^\s*\d+→(.*)$/;
|
|
4703
|
+
for (const line of rawLines) {
|
|
4704
|
+
const match = line.match(lineNumberPattern);
|
|
4705
|
+
if (match) {
|
|
4706
|
+
contentLines.push(match[1] ?? "");
|
|
4707
|
+
}
|
|
4708
|
+
}
|
|
4709
|
+
const displayLines = contentLines.length > 0 ? contentLines : rawLines.filter((line) => line.trim().length > 0);
|
|
4710
|
+
const totalLines = displayLines.length;
|
|
4711
|
+
if (totalLines === 0) {
|
|
4712
|
+
lines.push(`\u2514 \u2713 ${chalk4.dim("(empty)")}`);
|
|
4713
|
+
return lines;
|
|
4714
|
+
}
|
|
4715
|
+
if (verbose) {
|
|
4716
|
+
for (let i = 0; i < displayLines.length; i++) {
|
|
4717
|
+
const prefix = i === 0 ? "\u2514 " : " ";
|
|
4718
|
+
lines.push(`${prefix}${chalk4.dim(displayLines[i] ?? "")}`);
|
|
4719
|
+
}
|
|
4720
|
+
} else {
|
|
4721
|
+
const previewCount = Math.min(3, totalLines);
|
|
4722
|
+
for (let i = 0; i < previewCount; i++) {
|
|
4723
|
+
const prefix = i === 0 ? "\u2514 " : " ";
|
|
4724
|
+
lines.push(`${prefix}${chalk4.dim(displayLines[i] ?? "")}`);
|
|
4725
|
+
}
|
|
4726
|
+
const remaining = totalLines - previewCount;
|
|
4727
|
+
if (remaining > 0) {
|
|
4728
|
+
lines.push(
|
|
4729
|
+
` ${chalk4.dim(`\u2026 +${remaining} ${pluralize(remaining, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
4730
|
+
);
|
|
4731
|
+
}
|
|
4732
|
+
}
|
|
4733
|
+
return lines;
|
|
4734
|
+
}
|
|
4693
4735
|
function formatWritePreview(input, verbose) {
|
|
4694
4736
|
const lines = [];
|
|
4695
4737
|
const content = String(input.content || "");
|
|
@@ -4727,31 +4769,31 @@ function formatEditDiff(input, verbose) {
|
|
|
4727
4769
|
lines.push(`\u23BF ${chalk4.dim(summary)}`);
|
|
4728
4770
|
if (verbose) {
|
|
4729
4771
|
for (const line of oldLines) {
|
|
4730
|
-
lines.push(` ${chalk4.dim(
|
|
4772
|
+
lines.push(` - ${chalk4.dim(line)}`);
|
|
4731
4773
|
}
|
|
4732
4774
|
for (const line of newLines) {
|
|
4733
|
-
lines.push(` ${chalk4.dim(
|
|
4775
|
+
lines.push(` + ${chalk4.dim(line)}`);
|
|
4734
4776
|
}
|
|
4735
4777
|
} else {
|
|
4736
4778
|
const previewLimit = 3;
|
|
4737
4779
|
const showOld = Math.min(previewLimit, oldLines.length);
|
|
4738
4780
|
const showNew = Math.min(previewLimit, newLines.length);
|
|
4739
4781
|
for (let i = 0; i < showOld; i++) {
|
|
4740
|
-
lines.push(` ${chalk4.dim(
|
|
4782
|
+
lines.push(` - ${chalk4.dim(truncate(oldLines[i] ?? "", 60))}`);
|
|
4741
4783
|
}
|
|
4742
4784
|
const remainingOld = oldLines.length - previewLimit;
|
|
4743
4785
|
if (remainingOld > 0) {
|
|
4744
4786
|
lines.push(
|
|
4745
|
-
`
|
|
4787
|
+
` ${chalk4.dim(`\u2026 +${remainingOld} ${pluralize(remainingOld, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
4746
4788
|
);
|
|
4747
4789
|
}
|
|
4748
4790
|
for (let i = 0; i < showNew; i++) {
|
|
4749
|
-
lines.push(` ${chalk4.dim(
|
|
4791
|
+
lines.push(` + ${chalk4.dim(truncate(newLines[i] ?? "", 60))}`);
|
|
4750
4792
|
}
|
|
4751
4793
|
const remainingNew = newLines.length - previewLimit;
|
|
4752
4794
|
if (remainingNew > 0) {
|
|
4753
4795
|
lines.push(
|
|
4754
|
-
`
|
|
4796
|
+
` ${chalk4.dim(`\u2026 +${remainingNew} ${pluralize(remainingNew, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
4755
4797
|
);
|
|
4756
4798
|
}
|
|
4757
4799
|
}
|
|
@@ -4764,12 +4806,14 @@ function formatTodoList(input) {
|
|
|
4764
4806
|
lines.push("\u2514 \u2713 Done");
|
|
4765
4807
|
return lines;
|
|
4766
4808
|
}
|
|
4767
|
-
for (
|
|
4809
|
+
for (let i = 0; i < todos.length; i++) {
|
|
4810
|
+
const todo = todos[i];
|
|
4768
4811
|
const content = todo.content || "Unknown task";
|
|
4769
4812
|
const status = todo.status || "pending";
|
|
4770
4813
|
const icon = getTodoStatusIcon(status);
|
|
4771
4814
|
const styledContent = formatTodoContent(content, status);
|
|
4772
|
-
|
|
4815
|
+
const prefix = i === 0 ? "\u2514 " : " ";
|
|
4816
|
+
lines.push(`${prefix}${icon} ${styledContent}`);
|
|
4773
4817
|
}
|
|
4774
4818
|
return lines;
|
|
4775
4819
|
}
|
|
@@ -8419,7 +8463,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
8419
8463
|
).option("-y, --yes", "Skip confirmation prompts").option("-v, --verbose", "Show full tool inputs and outputs").addOption(new Option4("--debug-no-mock-claude").hideHelp()).addOption(new Option4("--no-auto-update").hideHelp()).action(
|
|
8420
8464
|
async (prompt, options) => {
|
|
8421
8465
|
if (!options.noAutoUpdate) {
|
|
8422
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
8466
|
+
const shouldExit = await checkAndUpgrade("9.8.0", prompt);
|
|
8423
8467
|
if (shouldExit) {
|
|
8424
8468
|
process.exit(0);
|
|
8425
8469
|
}
|
|
@@ -8655,6 +8699,22 @@ function parseRelativeTime(value, unit) {
|
|
|
8655
8699
|
}
|
|
8656
8700
|
|
|
8657
8701
|
// src/commands/logs/index.ts
|
|
8702
|
+
function buildPlatformLogsUrl(apiUrl, runId) {
|
|
8703
|
+
const url = new URL(apiUrl);
|
|
8704
|
+
const hostname = url.hostname;
|
|
8705
|
+
if (hostname === "localhost" || hostname === "127.0.0.1") {
|
|
8706
|
+
return `http://${hostname}:3001/logs/${runId}`;
|
|
8707
|
+
}
|
|
8708
|
+
const parts = hostname.split(".");
|
|
8709
|
+
if (parts[0] === "www") {
|
|
8710
|
+
parts[0] = "platform";
|
|
8711
|
+
} else {
|
|
8712
|
+
parts.unshift("platform");
|
|
8713
|
+
}
|
|
8714
|
+
const platformHost = parts.join(".");
|
|
8715
|
+
const port = url.port ? `:${url.port}` : "";
|
|
8716
|
+
return `https://${platformHost}${port}/logs/${runId}`;
|
|
8717
|
+
}
|
|
8658
8718
|
function formatMetric(metric) {
|
|
8659
8719
|
const memPercent = (metric.mem_used / metric.mem_total * 100).toFixed(1);
|
|
8660
8720
|
const diskPercent = (metric.disk_used / metric.disk_total * 100).toFixed(1);
|
|
@@ -8754,9 +8814,11 @@ var logsCommand2 = new Command31().name("logs").description("View logs for an ag
|
|
|
8754
8814
|
100
|
|
8755
8815
|
);
|
|
8756
8816
|
const order = isHead ? "asc" : "desc";
|
|
8817
|
+
const apiUrl = await getApiUrl();
|
|
8818
|
+
const platformUrl = buildPlatformLogsUrl(apiUrl, runId);
|
|
8757
8819
|
switch (logType) {
|
|
8758
8820
|
case "agent":
|
|
8759
|
-
await showAgentEvents(runId, { since, limit, order });
|
|
8821
|
+
await showAgentEvents(runId, { since, limit, order }, platformUrl);
|
|
8760
8822
|
break;
|
|
8761
8823
|
case "system":
|
|
8762
8824
|
await showSystemLog(runId, { since, limit, order });
|
|
@@ -8774,7 +8836,7 @@ var logsCommand2 = new Command31().name("logs").description("View logs for an ag
|
|
|
8774
8836
|
}
|
|
8775
8837
|
}
|
|
8776
8838
|
);
|
|
8777
|
-
async function showAgentEvents(runId, options) {
|
|
8839
|
+
async function showAgentEvents(runId, options, platformUrl) {
|
|
8778
8840
|
const response = await apiClient.getAgentEvents(runId, options);
|
|
8779
8841
|
if (response.events.length === 0) {
|
|
8780
8842
|
console.log(chalk33.yellow("No agent events found for this run"));
|
|
@@ -8793,6 +8855,7 @@ async function showAgentEvents(runId, options) {
|
|
|
8793
8855
|
)
|
|
8794
8856
|
);
|
|
8795
8857
|
}
|
|
8858
|
+
console.log(chalk33.dim(`View on platform: ${platformUrl}`));
|
|
8796
8859
|
}
|
|
8797
8860
|
async function showSystemLog(runId, options) {
|
|
8798
8861
|
const response = await apiClient.getSystemLog(runId, options);
|
|
@@ -10304,8 +10367,9 @@ var statusCommand6 = new Command41().name("status").description("Show detailed s
|
|
|
10304
10367
|
console.log(chalk42.dim("\u2501".repeat(50)));
|
|
10305
10368
|
printRunConfiguration(schedule);
|
|
10306
10369
|
printTimeSchedule(schedule);
|
|
10370
|
+
const parsed = parseInt(options.limit, 10);
|
|
10307
10371
|
const limit = Math.min(
|
|
10308
|
-
Math.max(0,
|
|
10372
|
+
Math.max(0, Number.isNaN(parsed) ? 5 : parsed),
|
|
10309
10373
|
100
|
|
10310
10374
|
);
|
|
10311
10375
|
await printRecentRuns(name, composeId, limit);
|
|
@@ -11575,7 +11639,7 @@ var setupClaudeCommand = new Command57().name("setup-claude").description("Insta
|
|
|
11575
11639
|
|
|
11576
11640
|
// src/index.ts
|
|
11577
11641
|
var program = new Command58();
|
|
11578
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
11642
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.8.0");
|
|
11579
11643
|
program.addCommand(authCommand);
|
|
11580
11644
|
program.addCommand(infoCommand);
|
|
11581
11645
|
program.addCommand(composeCommand);
|