@vm0/cli 9.170.1 → 9.171.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 CHANGED
@@ -69,7 +69,7 @@ import {
69
69
  source_default,
70
70
  volumeConfigSchema,
71
71
  withErrorHandler
72
- } from "./chunk-32G2S2HY.js";
72
+ } from "./chunk-HL3E2RLS.js";
73
73
  import {
74
74
  __toESM,
75
75
  init_esm_shims
@@ -388,7 +388,7 @@ function getConfigPath() {
388
388
  return join(os.homedir(), ".vm0", "config.json");
389
389
  }
390
390
  var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
391
- console.log(source_default.bold(`VM0 CLI v${"9.170.1"}`));
391
+ console.log(source_default.bold(`VM0 CLI v${"9.171.0"}`));
392
392
  console.log();
393
393
  const config = await loadConfig();
394
394
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -4281,7 +4281,7 @@ var composeCommand = new Command().name("compose").description("Create or update
4281
4281
  options.autoUpdate = false;
4282
4282
  }
4283
4283
  if (options.autoUpdate !== false) {
4284
- await startSilentUpgrade("9.170.1");
4284
+ await startSilentUpgrade("9.171.0");
4285
4285
  }
4286
4286
  try {
4287
4287
  let result;
@@ -4383,7 +4383,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
4383
4383
  withErrorHandler(
4384
4384
  async (identifier, prompt, options) => {
4385
4385
  if (options.autoUpdate !== false) {
4386
- await startSilentUpgrade("9.170.1");
4386
+ await startSilentUpgrade("9.171.0");
4387
4387
  }
4388
4388
  const { name, version } = parseIdentifier(identifier);
4389
4389
  let composeId;
@@ -6177,13 +6177,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
6177
6177
  if (latestVersion === null) {
6178
6178
  throw new Error("Could not check for updates. Please try again later.");
6179
6179
  }
6180
- if (latestVersion === "9.170.1") {
6181
- console.log(source_default.green(`\u2713 Already up to date (${"9.170.1"})`));
6180
+ if (latestVersion === "9.171.0") {
6181
+ console.log(source_default.green(`\u2713 Already up to date (${"9.171.0"})`));
6182
6182
  return;
6183
6183
  }
6184
6184
  console.log(
6185
6185
  source_default.yellow(
6186
- `Current version: ${"9.170.1"} -> Latest version: ${latestVersion}`
6186
+ `Current version: ${"9.171.0"} -> Latest version: ${latestVersion}`
6187
6187
  )
6188
6188
  );
6189
6189
  console.log();
@@ -6210,7 +6210,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
6210
6210
  const success = await performUpgrade(packageManager);
6211
6211
  if (success) {
6212
6212
  console.log(
6213
- source_default.green(`\u2713 Upgraded from ${"9.170.1"} to ${latestVersion}`)
6213
+ source_default.green(`\u2713 Upgraded from ${"9.171.0"} to ${latestVersion}`)
6214
6214
  );
6215
6215
  return;
6216
6216
  }
@@ -6277,7 +6277,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
6277
6277
 
6278
6278
  // src/index.ts
6279
6279
  var program = new Command();
6280
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.170.1");
6280
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.171.0");
6281
6281
  program.addCommand(authCommand);
6282
6282
  program.addCommand(infoCommand);
6283
6283
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.170.1",
3
+ "version": "9.171.0",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -152,7 +152,7 @@ import {
152
152
  zeroAgentCustomSkillNameSchema,
153
153
  zeroLocalAgentCommand,
154
154
  zeroTokenAllowsFeatureSwitch
155
- } from "./chunk-32G2S2HY.js";
155
+ } from "./chunk-HL3E2RLS.js";
156
156
  import {
157
157
  __toESM,
158
158
  init_esm_shims
@@ -6678,6 +6678,13 @@ function extensionForMimeType(mimeType) {
6678
6678
  const suffix = mimeType.startsWith("image/") ? mimeType.slice(6) : "bin";
6679
6679
  return sanitizeFilenamePart(suffix, "bin").toLowerCase();
6680
6680
  }
6681
+ function isRecord(value) {
6682
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6683
+ }
6684
+ function stringField(value, key) {
6685
+ const field = value[key];
6686
+ return typeof field === "string" ? field : void 0;
6687
+ }
6681
6688
  async function writeScreenshotDataUrl(result, dataUrl) {
6682
6689
  const match = DATA_URL_PATTERN.exec(dataUrl);
6683
6690
  if (!match) {
@@ -6698,20 +6705,41 @@ async function writeScreenshotDataUrl(result, dataUrl) {
6698
6705
  await writeFile(outputPath, Buffer.from(base64Data, "base64"));
6699
6706
  return outputPath;
6700
6707
  }
6701
- async function formatComputerUseResultForConsole(result) {
6702
- const printable = { ...result };
6703
- if (typeof printable.screenshot === "string") {
6704
- const screenshotPath = await writeScreenshotDataUrl(
6705
- printable,
6706
- printable.screenshot
6707
- );
6708
- if (screenshotPath) {
6709
- printable.screenshot = screenshotPath;
6708
+ function compactActionResult(action) {
6709
+ const compact = {};
6710
+ for (const [key, value] of Object.entries(action)) {
6711
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
6712
+ compact[key] = value;
6710
6713
  }
6711
6714
  }
6715
+ return compact;
6716
+ }
6717
+ async function formatComputerUseResultForConsole(result) {
6718
+ const printable = { status: "succeeded" };
6719
+ const apps = result.apps;
6720
+ if (Array.isArray(apps)) {
6721
+ printable.apps = apps;
6722
+ }
6723
+ const snapshotId = stringField(result, "snapshotId");
6724
+ if (snapshotId) {
6725
+ printable.snapshotId = snapshotId;
6726
+ }
6727
+ const appState = stringField(result, "appState");
6728
+ if (appState) {
6729
+ printable.appState = appState;
6730
+ }
6731
+ const screenshot = stringField(result, "screenshot");
6732
+ if (screenshot) {
6733
+ const screenshotPath = await writeScreenshotDataUrl(result, screenshot);
6734
+ printable.screenshot = screenshotPath ?? screenshot;
6735
+ }
6736
+ const action = result.action;
6737
+ if (isRecord(action)) {
6738
+ printable.action = compactActionResult(action);
6739
+ }
6712
6740
  return JSON.stringify(printable, null, 2);
6713
6741
  }
6714
- async function resultText(command) {
6742
+ async function commandOutputText(command) {
6715
6743
  if (!command.result) {
6716
6744
  return "";
6717
6745
  }
@@ -6736,7 +6764,7 @@ async function waitForCommand(commandId, timeoutSeconds) {
6736
6764
  command.error ? `${command.error.code}: ${command.error.message}` : "Computer-use command failed"
6737
6765
  );
6738
6766
  }
6739
- const text = await resultText(command);
6767
+ const text = await commandOutputText(command);
6740
6768
  if (text) {
6741
6769
  console.log(text);
6742
6770
  }
@@ -11769,7 +11797,7 @@ function parseLimit4(value) {
11769
11797
  }
11770
11798
  return parsed;
11771
11799
  }
11772
- function resultText2(command) {
11800
+ function resultText(command) {
11773
11801
  if (!command.result) {
11774
11802
  return "";
11775
11803
  }
@@ -11802,7 +11830,7 @@ async function runReadCommand2(kind, options) {
11802
11830
  command.error ? `${command.error.code}: ${command.error.message}` : "Local-browser command failed"
11803
11831
  );
11804
11832
  }
11805
- const text = resultText2(command);
11833
+ const text = resultText(command);
11806
11834
  if (text) {
11807
11835
  console.log(text);
11808
11836
  }
@@ -11829,7 +11857,7 @@ async function waitForCommand2(commandId, timeoutSeconds) {
11829
11857
  command.error ? `${command.error.code}: ${command.error.message}` : "Local-browser command failed"
11830
11858
  );
11831
11859
  }
11832
- const text = resultText2(command);
11860
+ const text = resultText(command);
11833
11861
  if (text) {
11834
11862
  console.log(text);
11835
11863
  }
@@ -12796,7 +12824,7 @@ function registerZeroCommands(prog, commands) {
12796
12824
  var program = new Command();
12797
12825
  program.name("zero").description(
12798
12826
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
12799
- ).version("9.170.1").addHelpText("after", () => {
12827
+ ).version("9.171.0").addHelpText("after", () => {
12800
12828
  return buildZeroHelpText();
12801
12829
  });
12802
12830
  if (process.argv[1]?.endsWith("zero.js") || process.argv[1]?.endsWith("zero.ts") || process.argv[1]?.endsWith("zero")) {