@vm0/cli 9.111.0 → 9.111.2

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
@@ -70,7 +70,7 @@ import {
70
70
  source_default,
71
71
  volumeConfigSchema,
72
72
  withErrorHandler
73
- } from "./chunk-QX23MVVI.js";
73
+ } from "./chunk-EZQQVFEQ.js";
74
74
 
75
75
  // src/index.ts
76
76
  init_esm_shims();
@@ -463,7 +463,7 @@ function getConfigPath() {
463
463
  return join(homedir(), ".vm0", "config.json");
464
464
  }
465
465
  var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
466
- console.log(source_default.bold(`VM0 CLI v${"9.111.0"}`));
466
+ console.log(source_default.bold(`VM0 CLI v${"9.111.2"}`));
467
467
  console.log();
468
468
  const config = await loadConfig();
469
469
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -4492,7 +4492,7 @@ var composeCommand = new Command().name("compose").description("Create or update
4492
4492
  options.autoUpdate = false;
4493
4493
  }
4494
4494
  if (options.autoUpdate !== false) {
4495
- await startSilentUpgrade("9.111.0");
4495
+ await startSilentUpgrade("9.111.2");
4496
4496
  }
4497
4497
  try {
4498
4498
  let result;
@@ -4572,7 +4572,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
4572
4572
  withErrorHandler(
4573
4573
  async (identifier, prompt, options) => {
4574
4574
  if (options.autoUpdate !== false) {
4575
- await startSilentUpgrade("9.111.0");
4575
+ await startSilentUpgrade("9.111.2");
4576
4576
  }
4577
4577
  const { name, version } = parseIdentifier(identifier);
4578
4578
  let composeId;
@@ -6313,7 +6313,7 @@ var cookAction = new Command().name("cook").description("Quick start: prepare, c
6313
6313
  withErrorHandler(
6314
6314
  async (prompt, options) => {
6315
6315
  if (options.autoUpdate !== false) {
6316
- const shouldExit = await checkAndUpgrade("9.111.0", prompt);
6316
+ const shouldExit = await checkAndUpgrade("9.111.2", prompt);
6317
6317
  if (shouldExit) {
6318
6318
  process.exit(0);
6319
6319
  }
@@ -7080,13 +7080,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
7080
7080
  if (latestVersion === null) {
7081
7081
  throw new Error("Could not check for updates. Please try again later.");
7082
7082
  }
7083
- if (latestVersion === "9.111.0") {
7084
- console.log(source_default.green(`\u2713 Already up to date (${"9.111.0"})`));
7083
+ if (latestVersion === "9.111.2") {
7084
+ console.log(source_default.green(`\u2713 Already up to date (${"9.111.2"})`));
7085
7085
  return;
7086
7086
  }
7087
7087
  console.log(
7088
7088
  source_default.yellow(
7089
- `Current version: ${"9.111.0"} -> Latest version: ${latestVersion}`
7089
+ `Current version: ${"9.111.2"} -> Latest version: ${latestVersion}`
7090
7090
  )
7091
7091
  );
7092
7092
  console.log();
@@ -7113,7 +7113,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
7113
7113
  const success = await performUpgrade(packageManager);
7114
7114
  if (success) {
7115
7115
  console.log(
7116
- source_default.green(`\u2713 Upgraded from ${"9.111.0"} to ${latestVersion}`)
7116
+ source_default.green(`\u2713 Upgraded from ${"9.111.2"} to ${latestVersion}`)
7117
7117
  );
7118
7118
  return;
7119
7119
  }
@@ -7180,7 +7180,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
7180
7180
 
7181
7181
  // src/index.ts
7182
7182
  var program = new Command();
7183
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.111.0");
7183
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.111.2");
7184
7184
  program.addCommand(authCommand);
7185
7185
  program.addCommand(infoCommand);
7186
7186
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.111.0",
3
+ "version": "9.111.2",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -40,7 +40,6 @@ import {
40
40
  findMatchingPermissions,
41
41
  getActiveOrg,
42
42
  getApiUrl,
43
- getAskUserAnswer,
44
43
  getAuthMethodsForType,
45
44
  getBaseUrl,
46
45
  getComputerUseHost,
@@ -94,7 +93,6 @@ import {
94
93
  paginate,
95
94
  parseEvent,
96
95
  parseTime,
97
- postAskUserQuestion,
98
96
  promptConfirm,
99
97
  promptPassword,
100
98
  promptSelect,
@@ -128,7 +126,7 @@ import {
128
126
  upsertZeroOrgModelProvider,
129
127
  withErrorHandler,
130
128
  zeroAgentCustomSkillNameSchema
131
- } from "./chunk-QX23MVVI.js";
129
+ } from "./chunk-EZQQVFEQ.js";
132
130
 
133
131
  // src/zero.ts
134
132
  init_esm_shims();
@@ -1289,6 +1287,16 @@ Notes:
1289
1287
 
1290
1288
  // src/commands/zero/agent/view.ts
1291
1289
  init_esm_shims();
1290
+
1291
+ // src/lib/utils/format-utils.ts
1292
+ init_esm_shims();
1293
+ function policyIcon(policy) {
1294
+ if (policy === "allow") return source_default.green("\u2713");
1295
+ if (policy === "ask") return source_default.yellow("?");
1296
+ return source_default.dim("\u2717");
1297
+ }
1298
+
1299
+ // src/commands/zero/agent/view.ts
1292
1300
  function getConnectorPermissionInfo(type, resolvedPolicies) {
1293
1301
  if (!isFirewallConnectorType(type)) {
1294
1302
  return {
@@ -1296,11 +1304,13 @@ function getConnectorPermissionInfo(type, resolvedPolicies) {
1296
1304
  hasPermissions: false,
1297
1305
  permissions: [],
1298
1306
  policies: null,
1307
+ unknownPolicy: "allow",
1299
1308
  allowed: 0,
1300
1309
  total: 0
1301
1310
  };
1302
1311
  }
1303
- const policies = resolvedPolicies?.[type] ?? null;
1312
+ const refPolicy = resolvedPolicies?.[type];
1313
+ const policies = refPolicy && Object.keys(refPolicy.policies).length > 0 ? refPolicy.policies : null;
1304
1314
  const config = getConnectorFirewall(type);
1305
1315
  const permissions = config.apis.flatMap((a) => {
1306
1316
  return a.permissions ?? [];
@@ -1309,7 +1319,40 @@ function getConnectorPermissionInfo(type, resolvedPolicies) {
1309
1319
  const allowed = policies ? permissions.filter((p) => {
1310
1320
  return policies[p.name] === "allow";
1311
1321
  }).length : 0;
1312
- return { type, hasPermissions: true, permissions, policies, allowed, total };
1322
+ const unknownPolicy = refPolicy?.unknownPolicy ?? "allow";
1323
+ return {
1324
+ type,
1325
+ hasPermissions: true,
1326
+ permissions,
1327
+ policies,
1328
+ unknownPolicy,
1329
+ allowed,
1330
+ total
1331
+ };
1332
+ }
1333
+ function printDetailedPermissions(info) {
1334
+ if (!info.policies) {
1335
+ const icon = policyIcon(info.unknownPolicy);
1336
+ console.log(` ${icon} unknown endpoints`);
1337
+ return;
1338
+ }
1339
+ const nameWidth = Math.max(
1340
+ "unknown endpoints".length,
1341
+ ...info.permissions.map((p) => {
1342
+ return p.name.length;
1343
+ })
1344
+ );
1345
+ for (const perm of info.permissions) {
1346
+ const policy = info.policies[perm.name] ?? "deny";
1347
+ const desc = perm.description ?? "";
1348
+ console.log(
1349
+ ` ${policyIcon(policy)} ${perm.name.padEnd(nameWidth)} ${desc}`
1350
+ );
1351
+ }
1352
+ const unknownIcon = policyIcon(info.unknownPolicy);
1353
+ console.log(
1354
+ ` ${unknownIcon} ${"unknown endpoints".padEnd(nameWidth)} Endpoints not matching any rule`
1355
+ );
1313
1356
  }
1314
1357
  function formatConnectorIdentity(connector) {
1315
1358
  if (!connector) return "";
@@ -1392,25 +1435,8 @@ Examples:
1392
1435
  for (const info of connectorInfos) {
1393
1436
  const identity = formatDetailIdentity(identityMap.get(info.type));
1394
1437
  console.log(` ${info.type.padEnd(14)}${identity}`);
1395
- if (!info.hasPermissions) continue;
1396
- if (!info.policies) {
1397
- console.log(
1398
- source_default.dim(" full access \u2014 no permission rules configured")
1399
- );
1400
- continue;
1401
- }
1402
- const nameWidth = Math.max(
1403
- ...info.permissions.map((p) => {
1404
- return p.name.length;
1405
- })
1406
- );
1407
- for (const perm of info.permissions) {
1408
- const policy = info.policies[perm.name] ?? "deny";
1409
- const icon = policy === "allow" ? source_default.green("\u2713") : policy === "ask" ? source_default.yellow("?") : source_default.dim("\u2717");
1410
- const desc = perm.description ?? "";
1411
- console.log(
1412
- ` ${icon} ${perm.name.padEnd(nameWidth)} ${desc}`
1413
- );
1438
+ if (info.hasPermissions) {
1439
+ printDetailedPermissions(info);
1414
1440
  }
1415
1441
  }
1416
1442
  }
@@ -3899,8 +3925,8 @@ function formatConnectorIdentity2(connector) {
3899
3925
  }
3900
3926
  function printConnectorPermissions(type, resolvedPolicies) {
3901
3927
  if (!isFirewallConnectorType(type)) return;
3902
- const policies = resolvedPolicies?.[type] ?? null;
3903
- if (!policies) {
3928
+ const refPolicy = resolvedPolicies?.[type];
3929
+ if (!refPolicy) {
3904
3930
  console.log(source_default.dim(" full access \u2014 no permission rules configured"));
3905
3931
  return;
3906
3932
  }
@@ -3908,18 +3934,27 @@ function printConnectorPermissions(type, resolvedPolicies) {
3908
3934
  const permissions = config.apis.flatMap((a) => {
3909
3935
  return a.permissions ?? [];
3910
3936
  });
3911
- if (permissions.length === 0) return;
3937
+ if (permissions.length === 0 && Object.keys(refPolicy.policies).length === 0) {
3938
+ const unknownIcon2 = policyIcon(refPolicy.unknownPolicy ?? "allow");
3939
+ console.log(` ${unknownIcon2} unknown endpoints`);
3940
+ return;
3941
+ }
3912
3942
  const nameWidth = Math.max(
3943
+ "unknown endpoints".length,
3913
3944
  ...permissions.map((p) => {
3914
3945
  return p.name.length;
3915
3946
  })
3916
3947
  );
3917
3948
  for (const perm of permissions) {
3918
- const policy = policies[perm.name] ?? "deny";
3919
- const icon = policy === "allow" ? source_default.green("\u2713") : policy === "ask" ? source_default.yellow("?") : source_default.dim("\u2717");
3949
+ const policy = refPolicy.policies[perm.name] ?? "deny";
3950
+ const icon = policyIcon(policy);
3920
3951
  const desc = perm.description ?? "";
3921
3952
  console.log(` ${icon} ${perm.name.padEnd(nameWidth)} ${desc}`);
3922
3953
  }
3954
+ const unknownIcon = policyIcon(refPolicy.unknownPolicy ?? "allow");
3955
+ console.log(
3956
+ ` ${unknownIcon} ${"unknown endpoints".padEnd(nameWidth)} Endpoints not matching any rule`
3957
+ );
3923
3958
  }
3924
3959
  async function showSandboxInfo(showPermissions) {
3925
3960
  const agentId = process.env.ZERO_AGENT_ID;
@@ -4018,115 +4053,6 @@ Notes:
4018
4053
  })
4019
4054
  );
4020
4055
 
4021
- // src/commands/zero/ask-user/index.ts
4022
- init_esm_shims();
4023
-
4024
- // src/commands/zero/ask-user/question.ts
4025
- init_esm_shims();
4026
- function collectOption(value, previous) {
4027
- const list = previous ?? [];
4028
- list.push({ label: value });
4029
- return list;
4030
- }
4031
- function collectDesc(value, previous) {
4032
- const list = previous ?? [];
4033
- list.push(value);
4034
- return list;
4035
- }
4036
- var questionCommand = new Command().name("question").description("Ask the user a question and wait for the answer").argument("<question>", "The question to ask").option("--header <text>", "Short label displayed as chip/tag (max 12 chars)").option("--option <label>", "Add a choice option (repeatable)", collectOption).option(
4037
- "--desc <text>",
4038
- "Description for the preceding --option",
4039
- collectDesc
4040
- ).option("--multi-select", "Allow multiple selections").option("--timeout <seconds>", "How long to wait for answer", "300").addHelpText(
4041
- "after",
4042
- `
4043
- Examples:
4044
- Yes/No confirmation:
4045
- zero ask-user question "Deploy to production?" --option "Yes" --option "No"
4046
-
4047
- Options with descriptions:
4048
- zero ask-user question "Pick a strategy" \\
4049
- --header "Strategy" \\
4050
- --option "Fast" --desc "Quick but risky" \\
4051
- --option "Safe" --desc "Slow but reliable"
4052
-
4053
- Multi-select:
4054
- zero ask-user question "Which services to restart?" \\
4055
- --multi-select \\
4056
- --option "API" --option "Worker" --option "Scheduler"
4057
-
4058
- Notes:
4059
- - At least one --option is required
4060
- - --desc must immediately follow its --option`
4061
- ).action(
4062
- withErrorHandler(
4063
- async (question, options) => {
4064
- const optionItems = options.option ?? [];
4065
- const descItems = options.desc ?? [];
4066
- for (let i = 0; i < descItems.length; i++) {
4067
- const opt = optionItems[i];
4068
- if (!opt) {
4069
- throw new Error("--desc must follow an --option flag");
4070
- }
4071
- opt.description = descItems[i];
4072
- }
4073
- if (optionItems.length === 0) {
4074
- throw new Error(
4075
- 'At least one --option is required. Example: zero ask-user question "Pick one" --option "Yes" --option "No"'
4076
- );
4077
- }
4078
- const timeoutMs = parseInt(options.timeout, 10) * 1e3;
4079
- if (isNaN(timeoutMs) || timeoutMs <= 0) {
4080
- throw new Error("--timeout must be a positive number of seconds");
4081
- }
4082
- const questionItem = {
4083
- question,
4084
- header: options.header,
4085
- options: optionItems,
4086
- multiSelect: options.multiSelect
4087
- };
4088
- const { pendingId } = await postAskUserQuestion({
4089
- questions: [questionItem]
4090
- });
4091
- console.error(
4092
- source_default.dim(
4093
- `\u23F3 Waiting for user response... (pendingId: ${pendingId})`
4094
- )
4095
- );
4096
- const deadline = Date.now() + timeoutMs;
4097
- const pollIntervalMs = 1e3;
4098
- while (Date.now() < deadline) {
4099
- const response = await getAskUserAnswer(pendingId);
4100
- if (response.status === "answered") {
4101
- console.log(response.answer ?? "");
4102
- return;
4103
- }
4104
- if (response.status === "expired") {
4105
- throw new Error("Question expired before user responded");
4106
- }
4107
- await new Promise((resolve) => {
4108
- return setTimeout(resolve, pollIntervalMs);
4109
- });
4110
- }
4111
- throw new Error(
4112
- `Timed out waiting for user response after ${options.timeout}s`
4113
- );
4114
- }
4115
- )
4116
- );
4117
-
4118
- // src/commands/zero/ask-user/index.ts
4119
- var zeroAskUserCommand = new Command().name("ask-user").description("Ask the user a question and wait for the answer").addCommand(questionCommand).addHelpText(
4120
- "after",
4121
- `
4122
- Examples:
4123
- zero ask-user question "Deploy to production?" --option "Yes" --option "No"
4124
-
4125
- Notes:
4126
- - The command blocks until the user responds or the timeout expires (default 300s)
4127
- - The user's answer is printed to stdout for your consumption`
4128
- );
4129
-
4130
4056
  // src/commands/zero/skill/index.ts
4131
4057
  init_esm_shims();
4132
4058
 
@@ -6015,7 +5941,6 @@ var COMMAND_CAPABILITY_MAP = {
6015
5941
  logs: "agent-run:read",
6016
5942
  slack: "slack:write",
6017
5943
  whoami: null,
6018
- "ask-user": null,
6019
5944
  "developer-support": null,
6020
5945
  "computer-use": "computer-use:write",
6021
5946
  phone: "phone:write",
@@ -6034,7 +5959,6 @@ var DEFAULT_COMMANDS = [
6034
5959
  zeroVariableCommand,
6035
5960
  zeroLogsCommand,
6036
5961
  zeroWhoamiCommand,
6037
- zeroAskUserCommand,
6038
5962
  zeroSkillCommand,
6039
5963
  zeroDeveloperSupportCommand,
6040
5964
  zeroComputerUseCommand,
@@ -6058,7 +5982,7 @@ function registerZeroCommands(prog, commands) {
6058
5982
  var program = new Command();
6059
5983
  program.name("zero").description(
6060
5984
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
6061
- ).version("9.111.0").addHelpText(
5985
+ ).version("9.111.2").addHelpText(
6062
5986
  "after",
6063
5987
  `
6064
5988
  Examples: