@vm0/cli 9.176.0 → 9.176.3

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
@@ -67,7 +67,7 @@ import {
67
67
  source_default,
68
68
  volumeConfigSchema,
69
69
  withErrorHandler
70
- } from "./chunk-3WAS5ORK.js";
70
+ } from "./chunk-PK542UZ7.js";
71
71
  import {
72
72
  __toESM,
73
73
  init_esm_shims
@@ -400,7 +400,7 @@ function getConfigPath() {
400
400
  return join(os.homedir(), ".vm0", "config.json");
401
401
  }
402
402
  var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
403
- console.log(source_default.bold(`VM0 CLI v${"9.176.0"}`));
403
+ console.log(source_default.bold(`VM0 CLI v${"9.176.3"}`));
404
404
  console.log();
405
405
  const config = await loadConfig();
406
406
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -4293,7 +4293,7 @@ var composeCommand = new Command().name("compose").description("Create or update
4293
4293
  options.autoUpdate = false;
4294
4294
  }
4295
4295
  if (options.autoUpdate !== false) {
4296
- await startSilentUpgrade("9.176.0");
4296
+ await startSilentUpgrade("9.176.3");
4297
4297
  }
4298
4298
  try {
4299
4299
  let result;
@@ -4395,7 +4395,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
4395
4395
  withErrorHandler(
4396
4396
  async (identifier, prompt, options) => {
4397
4397
  if (options.autoUpdate !== false) {
4398
- await startSilentUpgrade("9.176.0");
4398
+ await startSilentUpgrade("9.176.3");
4399
4399
  }
4400
4400
  const { name, version } = parseIdentifier(identifier);
4401
4401
  let composeId;
@@ -6189,13 +6189,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
6189
6189
  if (latestVersion === null) {
6190
6190
  throw new Error("Could not check for updates. Please try again later.");
6191
6191
  }
6192
- if (latestVersion === "9.176.0") {
6193
- console.log(source_default.green(`\u2713 Already up to date (${"9.176.0"})`));
6192
+ if (latestVersion === "9.176.3") {
6193
+ console.log(source_default.green(`\u2713 Already up to date (${"9.176.3"})`));
6194
6194
  return;
6195
6195
  }
6196
6196
  console.log(
6197
6197
  source_default.yellow(
6198
- `Current version: ${"9.176.0"} -> Latest version: ${latestVersion}`
6198
+ `Current version: ${"9.176.3"} -> Latest version: ${latestVersion}`
6199
6199
  )
6200
6200
  );
6201
6201
  console.log();
@@ -6222,7 +6222,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
6222
6222
  const success = await performUpgrade(packageManager);
6223
6223
  if (success) {
6224
6224
  console.log(
6225
- source_default.green(`\u2713 Upgraded from ${"9.176.0"} to ${latestVersion}`)
6225
+ source_default.green(`\u2713 Upgraded from ${"9.176.3"} to ${latestVersion}`)
6226
6226
  );
6227
6227
  return;
6228
6228
  }
@@ -6289,7 +6289,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
6289
6289
 
6290
6290
  // src/index.ts
6291
6291
  var program = new Command();
6292
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.176.0");
6292
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.176.3");
6293
6293
  program.addCommand(authCommand);
6294
6294
  program.addCommand(infoCommand);
6295
6295
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.176.0",
3
+ "version": "9.176.3",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -56,6 +56,7 @@ import {
56
56
  getApiUrl,
57
57
  getAuthMethodsForType,
58
58
  getComputerUseCommand,
59
+ getConnectorAuthMethodScopeDiff,
59
60
  getConnectorEnvBindings,
60
61
  getConnectorEnvNamesForSecret,
61
62
  getConnectorFirewall,
@@ -63,7 +64,6 @@ import {
63
64
  getConnectorTypeForSecretName,
64
65
  getDefaultAuthMethod,
65
66
  getGithubInstallation,
66
- getScopeDiff,
67
67
  getSecretsForAuthMethod,
68
68
  getSelectableProviderTypes,
69
69
  getSkill,
@@ -81,7 +81,7 @@ import {
81
81
  getZeroRunContext,
82
82
  getZeroUserPreferences,
83
83
  hasAuthMethods,
84
- hasRequiredScopes,
84
+ hasRequiredConnectorAuthMethodScopes,
85
85
  initGithubFileUpload,
86
86
  initPhoneFileUpload,
87
87
  initSlackFileUpload,
@@ -145,7 +145,7 @@ import {
145
145
  withErrorHandler,
146
146
  zeroAgentCustomSkillNameSchema,
147
147
  zeroTokenAllowsFeatureSwitch
148
- } from "./chunk-3WAS5ORK.js";
148
+ } from "./chunk-PK542UZ7.js";
149
149
  import {
150
150
  __toESM,
151
151
  init_esm_shims
@@ -1792,7 +1792,11 @@ function renderConnectedAsCell(connector) {
1792
1792
  if (connector.needsReconnect) {
1793
1793
  return source_default.yellow(`${identity} (reconnect needed)`);
1794
1794
  }
1795
- const scopeMismatch = connector.authMethod === "oauth" && !hasRequiredScopes(connector.type, connector.oauthScopes);
1795
+ const scopeMismatch = !hasRequiredConnectorAuthMethodScopes(
1796
+ connector.type,
1797
+ connector.authMethod,
1798
+ connector.oauthScopes
1799
+ );
1796
1800
  if (scopeMismatch) {
1797
1801
  return source_default.yellow(`${identity} (permissions update available)`);
1798
1802
  }
@@ -2287,8 +2291,16 @@ function printConnectorDetails(type, connector) {
2287
2291
  `${"OAuth Scopes:".padEnd(LABEL_WIDTH)}${connector.oauthScopes.join(", ")}`
2288
2292
  );
2289
2293
  }
2290
- if (connector.authMethod === "oauth" && !hasRequiredScopes(type, connector.oauthScopes)) {
2291
- const diff = getScopeDiff(type, connector.oauthScopes);
2294
+ if (!hasRequiredConnectorAuthMethodScopes(
2295
+ type,
2296
+ connector.authMethod,
2297
+ connector.oauthScopes
2298
+ )) {
2299
+ const diff = getConnectorAuthMethodScopeDiff(
2300
+ type,
2301
+ connector.authMethod,
2302
+ connector.oauthScopes
2303
+ );
2292
2304
  console.log(
2293
2305
  `${"Permissions:".padEnd(LABEL_WIDTH)}${source_default.yellow("update available")}`
2294
2306
  );
@@ -2438,16 +2450,21 @@ var zeroCreditCommand = new Command().name("credit").description("Create a Strip
2438
2450
  const origin = await getPlatformOrigin();
2439
2451
  const successUrl = `${origin}/?settings=usage&credit=success`;
2440
2452
  const cancelUrl = `${origin}/?settings=usage&credit=canceled`;
2441
- const autoRecharge = options.autoRecharge === void 0 && options.autoRechargeThreshold === void 0 && options.autoRechargeAmount === void 0 ? void 0 : {
2442
- enabled: options.autoRecharge === true,
2443
- threshold: options.autoRechargeThreshold,
2444
- amount: options.autoRechargeAmount
2445
- };
2446
- if (autoRecharge?.enabled === true && (autoRecharge.threshold === void 0 || autoRecharge.amount === void 0)) {
2453
+ if (options.autoRecharge !== true && (options.autoRechargeThreshold !== void 0 || options.autoRechargeAmount !== void 0)) {
2454
+ throw new Error(
2455
+ "--auto-recharge-threshold and --auto-recharge-amount require --auto-recharge"
2456
+ );
2457
+ }
2458
+ if (options.autoRecharge === true && (options.autoRechargeThreshold === void 0 || options.autoRechargeAmount === void 0)) {
2447
2459
  throw new Error(
2448
2460
  "--auto-recharge requires --auto-recharge-threshold and --auto-recharge-amount"
2449
2461
  );
2450
2462
  }
2463
+ const autoRecharge = options.autoRecharge === true ? {
2464
+ enabled: true,
2465
+ threshold: options.autoRechargeThreshold,
2466
+ amount: options.autoRechargeAmount
2467
+ } : void 0;
2451
2468
  const result = await createZeroCreditCheckout({
2452
2469
  credits,
2453
2470
  successUrl,
@@ -6577,6 +6594,10 @@ Notes:
6577
6594
  set-value when you need deterministic accessibility value assignment.
6578
6595
  press-key accepts xdotool-style names such as shift+semicolon, Control_L+J,
6579
6596
  ctrl+alt+n, and BackSpace, plus existing macOS-style forms such as Command+L.
6597
+ type-text and press-key accept the same --snapshot-id as the element actions:
6598
+ pass it to deliver keyboard input to that snapshot's window. Without it, the
6599
+ most relevant window for the app is picked, which is ambiguous for multi-window
6600
+ apps.
6580
6601
 
6581
6602
  Examples:
6582
6603
  List available apps:
@@ -6591,11 +6612,11 @@ Examples:
6591
6612
  Click screenshot coordinate (320, 240) from snapshot desktop_abc:
6592
6613
  zero computer-use click --app Safari --snapshot-id desktop_abc --x 320 --y 240
6593
6614
 
6594
- Type text into the current focus in Safari:
6595
- zero computer-use type-text --app Safari --text "Hello"
6615
+ Type text into the snapshot desktop_abc window in Safari:
6616
+ zero computer-use type-text --app Safari --snapshot-id desktop_abc --text "Hello"
6596
6617
 
6597
- Press a keyboard shortcut:
6598
- zero computer-use press-key --app Safari --key shift+semicolon
6618
+ Press a keyboard shortcut in the snapshot desktop_abc window:
6619
+ zero computer-use press-key --app Safari --snapshot-id desktop_abc --key shift+semicolon
6599
6620
 
6600
6621
  Open an app without activating the current foreground app:
6601
6622
  zero computer-use open-app --app Things`;
@@ -6884,10 +6905,11 @@ var setValueCommand = appOption(
6884
6905
  );
6885
6906
  var typeTextCommand = appOption(
6886
6907
  addTargetOptions(
6887
- new Command().name("type-text").description("Type literal keyboard input into the target app").requiredOption("--text <text>", "Text to type").action(
6908
+ new Command().name("type-text").description("Type literal keyboard input into the target app").option("--snapshot-id <id>", "Snapshot id returned by get-app-state").requiredOption("--text <text>", "Text to type").action(
6888
6909
  withErrorHandler(async (options) => {
6889
6910
  await runWriteCommand("keyboard.type_text", options, {
6890
6911
  app: options.app,
6912
+ ...options.snapshotId ? { snapshotId: options.snapshotId } : {},
6891
6913
  text: options.text
6892
6914
  });
6893
6915
  })
@@ -6896,13 +6918,14 @@ var typeTextCommand = appOption(
6896
6918
  );
6897
6919
  var pressKeyCommand = appOption(
6898
6920
  addTargetOptions(
6899
- new Command().name("press-key").description("Send a background key or key combination to the target app").requiredOption(
6921
+ new Command().name("press-key").description("Send a background key or key combination to the target app").option("--snapshot-id <id>", "Snapshot id returned by get-app-state").requiredOption(
6900
6922
  "--key <key>",
6901
6923
  "Key or xdotool-style combination, for example Command+K, shift+semicolon, or Control_L+J"
6902
6924
  ).action(
6903
6925
  withErrorHandler(async (options) => {
6904
6926
  await runWriteCommand("keyboard.press_key", options, {
6905
6927
  app: options.app,
6928
+ ...options.snapshotId ? { snapshotId: options.snapshotId } : {},
6906
6929
  key: options.key
6907
6930
  });
6908
6931
  })
@@ -12930,7 +12953,7 @@ var COMMAND_CAPABILITY_MAP = {
12930
12953
  run: "agent-run:write",
12931
12954
  schedule: "schedule:read",
12932
12955
  doctor: null,
12933
- credit: null,
12956
+ credit: "billing:write",
12934
12957
  model: null,
12935
12958
  "model-provider": null,
12936
12959
  logs: "agent-run:read",
@@ -12995,8 +13018,8 @@ function shouldHideCommand(name, payload) {
12995
13018
  function buildZeroHelpText(payload = decodeZeroTokenPayload()) {
12996
13019
  const examples = [
12997
13020
  " Check a connector? zero doctor check-connector --env-name <ENV_NAME>",
12998
- " Check credits? zero doctor credit",
12999
- " Buy credits? zero credit 20000",
13021
+ ...payload && !payload.capabilities.includes("billing:read") ? [] : [" Check credits? zero doctor credit"],
13022
+ ...shouldHideCommand("credit", payload) ? [] : [" Buy credits? zero credit 20000"],
13000
13023
  " Send a Slack message? zero slack message send --help",
13001
13024
  " Upload GitHub? zero github upload-file --help",
13002
13025
  " Download GitHub? zero github download-file --help",
@@ -13037,7 +13060,7 @@ function registerZeroCommands(prog, commands) {
13037
13060
  var program = new Command();
13038
13061
  program.name("zero").description(
13039
13062
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
13040
- ).version("9.176.0").addHelpText("after", () => {
13063
+ ).version("9.176.3").addHelpText("after", () => {
13041
13064
  return buildZeroHelpText();
13042
13065
  });
13043
13066
  if (process.argv[1]?.endsWith("zero.js") || process.argv[1]?.endsWith("zero.ts") || process.argv[1]?.endsWith("zero")) {