@vm0/cli 9.160.6 → 9.160.8

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
@@ -68,7 +68,7 @@ import {
68
68
  source_default,
69
69
  volumeConfigSchema,
70
70
  withErrorHandler
71
- } from "./chunk-ITWX7YWW.js";
71
+ } from "./chunk-3P3WTJU2.js";
72
72
  import {
73
73
  __toESM,
74
74
  init_esm_shims
@@ -387,7 +387,7 @@ function getConfigPath() {
387
387
  return join(os.homedir(), ".vm0", "config.json");
388
388
  }
389
389
  var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
390
- console.log(source_default.bold(`VM0 CLI v${"9.160.6"}`));
390
+ console.log(source_default.bold(`VM0 CLI v${"9.160.8"}`));
391
391
  console.log();
392
392
  const config = await loadConfig();
393
393
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -4280,7 +4280,7 @@ var composeCommand = new Command().name("compose").description("Create or update
4280
4280
  options.autoUpdate = false;
4281
4281
  }
4282
4282
  if (options.autoUpdate !== false) {
4283
- await startSilentUpgrade("9.160.6");
4283
+ await startSilentUpgrade("9.160.8");
4284
4284
  }
4285
4285
  try {
4286
4286
  let result;
@@ -4372,7 +4372,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
4372
4372
  withErrorHandler(
4373
4373
  async (identifier, prompt, options) => {
4374
4374
  if (options.autoUpdate !== false) {
4375
- await startSilentUpgrade("9.160.6");
4375
+ await startSilentUpgrade("9.160.8");
4376
4376
  }
4377
4377
  const { name, version } = parseIdentifier(identifier);
4378
4378
  let composeId;
@@ -6165,13 +6165,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
6165
6165
  if (latestVersion === null) {
6166
6166
  throw new Error("Could not check for updates. Please try again later.");
6167
6167
  }
6168
- if (latestVersion === "9.160.6") {
6169
- console.log(source_default.green(`\u2713 Already up to date (${"9.160.6"})`));
6168
+ if (latestVersion === "9.160.8") {
6169
+ console.log(source_default.green(`\u2713 Already up to date (${"9.160.8"})`));
6170
6170
  return;
6171
6171
  }
6172
6172
  console.log(
6173
6173
  source_default.yellow(
6174
- `Current version: ${"9.160.6"} -> Latest version: ${latestVersion}`
6174
+ `Current version: ${"9.160.8"} -> Latest version: ${latestVersion}`
6175
6175
  )
6176
6176
  );
6177
6177
  console.log();
@@ -6198,7 +6198,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
6198
6198
  const success = await performUpgrade(packageManager);
6199
6199
  if (success) {
6200
6200
  console.log(
6201
- source_default.green(`\u2713 Upgraded from ${"9.160.6"} to ${latestVersion}`)
6201
+ source_default.green(`\u2713 Upgraded from ${"9.160.8"} to ${latestVersion}`)
6202
6202
  );
6203
6203
  return;
6204
6204
  }
@@ -6265,7 +6265,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
6265
6265
 
6266
6266
  // src/index.ts
6267
6267
  var program = new Command();
6268
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.160.6");
6268
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.160.8");
6269
6269
  program.addCommand(authCommand);
6270
6270
  program.addCommand(infoCommand);
6271
6271
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.160.6",
3
+ "version": "9.160.8",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -148,7 +148,7 @@ import {
148
148
  zeroAgentCustomSkillNameSchema,
149
149
  zeroLocalAgentCommand,
150
150
  zeroTokenAllowsFeatureSwitch
151
- } from "./chunk-ITWX7YWW.js";
151
+ } from "./chunk-3P3WTJU2.js";
152
152
  import {
153
153
  __commonJS,
154
154
  __require,
@@ -33954,6 +33954,10 @@ Notes:
33954
33954
 
33955
33955
  // src/commands/zero/computer-use/index.ts
33956
33956
  init_esm_shims();
33957
+ import { mkdir, writeFile } from "fs/promises";
33958
+ import { join as join5 } from "path";
33959
+ var COMPUTER_USE_SCREENSHOT_DIR = "/tmp/vm0/computer-use";
33960
+ var DATA_URL_PATTERN = /^data:([^;,]+);base64,(.*)$/s;
33957
33961
  function sleep2(ms) {
33958
33962
  return new Promise((resolve2) => {
33959
33963
  setTimeout(resolve2, ms);
@@ -34009,21 +34013,64 @@ function parseLimit4(value) {
34009
34013
  }
34010
34014
  return parsed;
34011
34015
  }
34012
- function summarizeScreenshotValue(value) {
34013
- return `[omitted ${value.length.toString()} character screenshot data URL]`;
34016
+ function sanitizeFilenamePart(value, fallback) {
34017
+ if (typeof value !== "string") {
34018
+ return fallback;
34019
+ }
34020
+ const sanitized = value.trim().replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
34021
+ return sanitized.length > 0 ? sanitized : fallback;
34022
+ }
34023
+ function extensionForMimeType(mimeType) {
34024
+ if (mimeType === "image/png") {
34025
+ return "png";
34026
+ }
34027
+ if (mimeType === "image/jpeg") {
34028
+ return "jpg";
34029
+ }
34030
+ if (mimeType === "image/webp") {
34031
+ return "webp";
34032
+ }
34033
+ const suffix = mimeType.startsWith("image/") ? mimeType.slice(6) : "bin";
34034
+ return sanitizeFilenamePart(suffix, "bin").toLowerCase();
34035
+ }
34036
+ async function writeScreenshotDataUrl(result, dataUrl) {
34037
+ const match = DATA_URL_PATTERN.exec(dataUrl);
34038
+ if (!match) {
34039
+ return null;
34040
+ }
34041
+ const mimeType = match[1] ?? "";
34042
+ if (!mimeType.startsWith("image/")) {
34043
+ throw new Error(`Unsupported screenshot MIME type: ${mimeType}`);
34044
+ }
34045
+ const base64Data = match[2] ?? "";
34046
+ const appName = sanitizeFilenamePart(result.app, "app");
34047
+ const snapshotId = sanitizeFilenamePart(result.snapshotId, "snapshot");
34048
+ const outputPath = join5(
34049
+ COMPUTER_USE_SCREENSHOT_DIR,
34050
+ `${appName}-${snapshotId}.${extensionForMimeType(mimeType)}`
34051
+ );
34052
+ await mkdir(COMPUTER_USE_SCREENSHOT_DIR, { recursive: true });
34053
+ await writeFile(outputPath, Buffer.from(base64Data, "base64"));
34054
+ return outputPath;
34014
34055
  }
34015
- function formatComputerUseResultForConsole(result) {
34056
+ async function formatComputerUseResultForConsole(result) {
34016
34057
  const printable = { ...result };
34017
34058
  if (typeof printable.screenshot === "string") {
34018
- printable.screenshot = summarizeScreenshotValue(printable.screenshot);
34059
+ const screenshotPath = await writeScreenshotDataUrl(
34060
+ printable,
34061
+ printable.screenshot
34062
+ );
34063
+ if (screenshotPath) {
34064
+ printable.screenshot = screenshotPath;
34065
+ }
34019
34066
  }
34020
34067
  return JSON.stringify(printable, null, 2);
34021
34068
  }
34022
- function resultText(command) {
34069
+ async function resultText(command) {
34023
34070
  if (!command.result) {
34024
34071
  return "";
34025
34072
  }
34026
- return formatComputerUseResultForConsole(command.result);
34073
+ return await formatComputerUseResultForConsole(command.result);
34027
34074
  }
34028
34075
  async function waitForCommand(commandId, timeoutSeconds) {
34029
34076
  const deadline = Date.now() + timeoutSeconds * 1e3;
@@ -34044,7 +34091,7 @@ async function waitForCommand(commandId, timeoutSeconds) {
34044
34091
  command.error ? `${command.error.code}: ${command.error.message}` : "Computer-use command failed"
34045
34092
  );
34046
34093
  }
34047
- const text = resultText(command);
34094
+ const text = await resultText(command);
34048
34095
  if (text) {
34049
34096
  console.log(text);
34050
34097
  }
@@ -34080,13 +34127,21 @@ function addTargetOptions(command) {
34080
34127
  function appOption(command) {
34081
34128
  return command.requiredOption("--app <name>", "Target app name or bundle id");
34082
34129
  }
34130
+ function auditMetadataValue(metadata, key) {
34131
+ const value = metadata?.[key];
34132
+ return typeof value === "string" && value.length > 0 ? value : null;
34133
+ }
34083
34134
  function formatAuditEvent(event) {
34135
+ const dispatchMode = auditMetadataValue(event.redactedResult, "dispatchMode");
34136
+ const inputRisk = auditMetadataValue(event.redactedResult, "inputRisk");
34084
34137
  return [
34085
34138
  `${event.createdAt} ${event.event} ${event.kind}`,
34086
34139
  `command=${event.commandId}`,
34087
34140
  event.hostId ? `host=${event.hostId}` : null,
34088
34141
  event.app ? `app=${event.app}` : null,
34089
- event.approvalOutcome ? `approval=${event.approvalOutcome}` : null
34142
+ event.approvalOutcome ? `approval=${event.approvalOutcome}` : null,
34143
+ dispatchMode ? `dispatch=${dispatchMode}` : null,
34144
+ inputRisk ? `risk=${inputRisk}` : null
34090
34145
  ].filter((part) => {
34091
34146
  return part !== null;
34092
34147
  }).join(" ");
@@ -34172,7 +34227,10 @@ var typeTextCommand = appOption(
34172
34227
  );
34173
34228
  var pressKeyCommand = appOption(
34174
34229
  addTargetOptions(
34175
- new Command().name("press-key").description("Press a key or key combination in the target app").requiredOption("--key <key>", "Key or key combination to press").action(
34230
+ new Command().name("press-key").description("Press a key or key combination in the target app").requiredOption(
34231
+ "--key <key>",
34232
+ "Key or key combination to press, for example Command+K or Control+K"
34233
+ ).action(
34176
34234
  withErrorHandler(async (options) => {
34177
34235
  await runWriteCommand("keyboard.press_key", options, {
34178
34236
  app: options.app,
@@ -34670,7 +34728,7 @@ var videoCommand = createVideoGenerateCommand({
34670
34728
  init_esm_shims();
34671
34729
  import { mkdtemp, rm } from "fs/promises";
34672
34730
  import { readFileSync as readFileSync15 } from "fs";
34673
- import { join as join6 } from "path";
34731
+ import { join as join7 } from "path";
34674
34732
  import { tmpdir as tmpdir4 } from "os";
34675
34733
 
34676
34734
  // src/lib/host/publish-static-site.ts
@@ -34945,8 +35003,8 @@ async function publishStaticSite(options) {
34945
35003
  init_esm_shims();
34946
35004
  var import_react = __toESM(require_react(), 1);
34947
35005
  var import_server = __toESM(require_server_node(), 1);
34948
- import { mkdir, writeFile } from "fs/promises";
34949
- import { join as join5 } from "path";
35006
+ import { mkdir as mkdir2, writeFile as writeFile2 } from "fs/promises";
35007
+ import { join as join6 } from "path";
34950
35008
  function h(type, props, ...children) {
34951
35009
  return import_react.default.createElement(type, props, ...children);
34952
35010
  }
@@ -35685,8 +35743,8 @@ h1 {
35685
35743
  }
35686
35744
  `;
35687
35745
  async function buildGeneratedWebsite(options) {
35688
- const assetsDir = join5(options.outDir, "assets");
35689
- await mkdir(assetsDir, { recursive: true });
35746
+ const assetsDir = join6(options.outDir, "assets");
35747
+ await mkdir2(assetsDir, { recursive: true });
35690
35748
  const markup = (0, import_server.renderToStaticMarkup)(
35691
35749
  import_react.default.createElement(WebsiteDocument, {
35692
35750
  data: options.siteData,
@@ -35694,11 +35752,11 @@ async function buildGeneratedWebsite(options) {
35694
35752
  generatedVisuals: options.generatedVisuals ?? []
35695
35753
  })
35696
35754
  );
35697
- await writeFile(
35698
- join5(options.outDir, "index.html"),
35755
+ await writeFile2(
35756
+ join6(options.outDir, "index.html"),
35699
35757
  `<!doctype html>${markup}`
35700
35758
  );
35701
- await writeFile(join5(assetsDir, "styles.css"), WEBSITE_CSS.trimStart());
35759
+ await writeFile2(join6(assetsDir, "styles.css"), WEBSITE_CSS.trimStart());
35702
35760
  }
35703
35761
 
35704
35762
  // src/commands/zero/built-in/generate/website.ts
@@ -35788,8 +35846,8 @@ Notes:
35788
35846
  title: options.title,
35789
35847
  audience: options.audience
35790
35848
  });
35791
- const buildRoot = await mkdtemp(join6(tmpdir4(), "zero-website-"));
35792
- const outDir = join6(buildRoot, "dist");
35849
+ const buildRoot = await mkdtemp(join7(tmpdir4(), "zero-website-"));
35850
+ const outDir = join7(buildRoot, "dist");
35793
35851
  try {
35794
35852
  if (!options.json) {
35795
35853
  console.log(source_default.dim("Building React template..."));
@@ -35976,10 +36034,10 @@ init_esm_shims();
35976
36034
 
35977
36035
  // src/commands/zero/web/download-file.ts
35978
36036
  init_esm_shims();
35979
- import { basename as basename7, join as join7 } from "path";
36037
+ import { basename as basename7, join as join8 } from "path";
35980
36038
  import { tmpdir as tmpdir5 } from "os";
35981
36039
  function defaultOutPath4(fileId) {
35982
- return join7(tmpdir5(), `web-${basename7(fileId)}`);
36040
+ return join8(tmpdir5(), `web-${basename7(fileId)}`);
35983
36041
  }
35984
36042
  var downloadFileCommand4 = new Command().name("download-file").description("Download a web-uploaded file by id").argument("<file-id>", "File id (UUID returned by the upload API)").option(
35985
36043
  "-o, --out <path>",
@@ -36848,7 +36906,7 @@ function registerZeroCommands(prog, commands) {
36848
36906
  var program = new Command();
36849
36907
  program.name("zero").description(
36850
36908
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
36851
- ).version("9.160.6").addHelpText("after", () => {
36909
+ ).version("9.160.8").addHelpText("after", () => {
36852
36910
  return buildZeroHelpText();
36853
36911
  });
36854
36912
  if (process.argv[1]?.endsWith("zero.js") || process.argv[1]?.endsWith("zero.ts") || process.argv[1]?.endsWith("zero")) {