@vm0/cli 9.180.4 → 9.180.6

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-7XY55Z3Z.js";
70
+ } from "./chunk-Z5VRB237.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.180.4"}`));
403
+ console.log(source_default.bold(`VM0 CLI v${"9.180.6"}`));
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.180.4");
4296
+ await startSilentUpgrade("9.180.6");
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.180.4");
4398
+ await startSilentUpgrade("9.180.6");
4399
4399
  }
4400
4400
  const { name, version } = parseIdentifier(identifier);
4401
4401
  let composeId;
@@ -6192,13 +6192,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
6192
6192
  if (latestVersion === null) {
6193
6193
  throw new Error("Could not check for updates. Please try again later.");
6194
6194
  }
6195
- if (latestVersion === "9.180.4") {
6196
- console.log(source_default.green(`\u2713 Already up to date (${"9.180.4"})`));
6195
+ if (latestVersion === "9.180.6") {
6196
+ console.log(source_default.green(`\u2713 Already up to date (${"9.180.6"})`));
6197
6197
  return;
6198
6198
  }
6199
6199
  console.log(
6200
6200
  source_default.yellow(
6201
- `Current version: ${"9.180.4"} -> Latest version: ${latestVersion}`
6201
+ `Current version: ${"9.180.6"} -> Latest version: ${latestVersion}`
6202
6202
  )
6203
6203
  );
6204
6204
  console.log();
@@ -6225,7 +6225,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
6225
6225
  const success = await performUpgrade(packageManager);
6226
6226
  if (success) {
6227
6227
  console.log(
6228
- source_default.green(`\u2713 Upgraded from ${"9.180.4"} to ${latestVersion}`)
6228
+ source_default.green(`\u2713 Upgraded from ${"9.180.6"} to ${latestVersion}`)
6229
6229
  );
6230
6230
  return;
6231
6231
  }
@@ -6292,7 +6292,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
6292
6292
 
6293
6293
  // src/index.ts
6294
6294
  var program = new Command();
6295
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.180.4");
6295
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.180.6");
6296
6296
  program.addCommand(authCommand);
6297
6297
  program.addCommand(infoCommand);
6298
6298
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.180.4",
3
+ "version": "9.180.6",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -28,7 +28,6 @@ import {
28
28
  createZeroAgent,
29
29
  createZeroCreditCheckout,
30
30
  createZeroRun,
31
- decodeCliTokenPayload,
32
31
  decodeZeroTokenPayload,
33
32
  deleteGithubLabelListener,
34
33
  deleteSkill,
@@ -107,11 +106,13 @@ import {
107
106
  listZeroOrgs,
108
107
  listZeroSchedules,
109
108
  listZeroSecrets,
109
+ listZeroUserPermissionGrants,
110
110
  listZeroVariables,
111
111
  matchFirewallBaseUrl,
112
112
  paginate,
113
113
  parseEvent,
114
114
  parseTime,
115
+ permissionGrantsToFirewallPolicies,
115
116
  prepareHostedSite,
116
117
  promptConfirm,
117
118
  promptPassword,
@@ -149,7 +150,7 @@ import {
149
150
  upsertZeroOrgModelProvider,
150
151
  withErrorHandler,
151
152
  zeroAgentCustomSkillNameSchema
152
- } from "./chunk-7XY55Z3Z.js";
153
+ } from "./chunk-Z5VRB237.js";
153
154
  import {
154
155
  __toESM,
155
156
  init_esm_shims
@@ -1552,8 +1553,11 @@ Examples:
1552
1553
  if (agent.displayName) console.log(source_default.dim(agent.displayName));
1553
1554
  console.log();
1554
1555
  console.log(`Agent ID: ${agent.agentId}`);
1556
+ const permissionPolicies = options.permissions ? permissionGrantsToFirewallPolicies(
1557
+ await listZeroUserPermissionGrants(agent.agentId)
1558
+ ) : null;
1555
1559
  const resolvedPolicies = resolveFirewallPolicies(
1556
- agent.permissionPolicies,
1560
+ permissionPolicies,
1557
1561
  connectorTypes
1558
1562
  );
1559
1563
  const connectorInfos = connectorTypes.map((type) => {
@@ -2979,66 +2983,6 @@ How connectors work:
2979
2983
 
2980
2984
  // src/commands/zero/doctor/permission-deny.ts
2981
2985
  init_esm_shims();
2982
-
2983
- // src/commands/zero/doctor/permission-context.ts
2984
- init_esm_shims();
2985
- var LEGACY_PERMISSION_GRANT_MODE = "legacy";
2986
- function roleFromOrg(org) {
2987
- if (org.role === "admin") return "admin";
2988
- if (org.role === "member") return "member";
2989
- return "unknown";
2990
- }
2991
- function permissionGrantModeFromOrg(org) {
2992
- return org.permissionGrantMode ?? LEGACY_PERMISSION_GRANT_MODE;
2993
- }
2994
- async function resolveUserId() {
2995
- const zeroPayload = decodeZeroTokenPayload();
2996
- if (zeroPayload?.userId) return zeroPayload.userId;
2997
- const token = await getToken();
2998
- const cliPayload = decodeCliTokenPayload(token);
2999
- return cliPayload?.userId;
3000
- }
3001
- async function resolvePermissionGrantMode() {
3002
- try {
3003
- const org = await getZeroOrg();
3004
- return permissionGrantModeFromOrg(org);
3005
- } catch {
3006
- return LEGACY_PERMISSION_GRANT_MODE;
3007
- }
3008
- }
3009
- async function resolvePermissionChangeContext(agentId) {
3010
- try {
3011
- const org = await getZeroOrg();
3012
- const permissionGrantMode = permissionGrantModeFromOrg(org);
3013
- if (!agentId || permissionGrantMode === "user-grants") {
3014
- return {
3015
- role: roleFromOrg(org),
3016
- permissionGrantMode
3017
- };
3018
- }
3019
- if (org.role === "admin") {
3020
- return { role: "admin", permissionGrantMode };
3021
- }
3022
- if (org.role === "member") {
3023
- const userId = await resolveUserId();
3024
- if (userId) {
3025
- const agent = await getZeroAgent(agentId);
3026
- if (agent.ownerId === userId) {
3027
- return { role: "owner", permissionGrantMode };
3028
- }
3029
- }
3030
- return { role: "member", permissionGrantMode };
3031
- }
3032
- return { role: "unknown", permissionGrantMode };
3033
- } catch {
3034
- return {
3035
- role: "unknown",
3036
- permissionGrantMode: LEGACY_PERMISSION_GRANT_MODE
3037
- };
3038
- }
3039
- }
3040
-
3041
- // src/commands/zero/doctor/permission-deny.ts
3042
2986
  var permissionDenyCommand = new Command().name("permission-deny").description(
3043
2987
  "Diagnose a permission denial and find the permission that covers it"
3044
2988
  ).argument("<connector-ref>", "The connector type (e.g. github)").addOption(
@@ -3092,11 +3036,8 @@ Notes:
3092
3036
  return (ruleCount.get(current) ?? Infinity) < (ruleCount.get(narrowest) ?? Infinity) ? current : narrowest;
3093
3037
  });
3094
3038
  console.log(`This is covered by the "${permission}" permission.`);
3095
- const permissionGrantMode = await resolvePermissionGrantMode();
3096
- const reasonArg = permissionGrantMode === "user-grants" ? "" : ' --reason "why this is needed"';
3097
- const actionVerb = permissionGrantMode === "user-grants" ? "allow" : "request";
3098
3039
  console.log(
3099
- `To ${actionVerb} this permission, run: zero doctor permission-change ${connectorRef} --permission ${permission} --enable${reasonArg}`
3040
+ `To allow this permission, run: zero doctor permission-change ${connectorRef} --permission ${permission} --enable`
3100
3041
  );
3101
3042
  }
3102
3043
  )
@@ -3115,15 +3056,8 @@ function findPermissionInConfig(ref, permissionName) {
3115
3056
  }
3116
3057
  return false;
3117
3058
  }
3118
- var REASON_MAX_LENGTH = 500;
3119
- function addReasonParam(urlParams, role, usesUserGrants, reason) {
3120
- if (usesUserGrants || role !== "member" || !reason) return;
3121
- const truncated = reason.length > REASON_MAX_LENGTH ? reason.slice(0, REASON_MAX_LENGTH) : reason;
3122
- urlParams.set("reason", truncated);
3123
- }
3124
- function printSensitivePermissionGuidance(connectorRef, permission, action, usesUserGrants) {
3059
+ function printSensitivePermissionGuidance(connectorRef, permission, action) {
3125
3060
  if (action !== "enable") return;
3126
- const approvalWording = usesUserGrants ? "Only allow this permission below" : "Only request user approval below";
3127
3061
  if (connectorRef === "slack" && permission === "chat:write") {
3128
3062
  console.log("");
3129
3063
  console.log(
@@ -3133,7 +3067,7 @@ function printSensitivePermissionGuidance(connectorRef, permission, action, uses
3133
3067
  "Use `zero slack message send -c <channel> -t <text>` to send messages as the bot instead \u2014 this is the recommended approach for most use cases."
3134
3068
  );
3135
3069
  console.log(
3136
- `${approvalWording} if acting as the user is specifically required.`
3070
+ "Only allow this permission below if acting as the user is specifically required."
3137
3071
  );
3138
3072
  console.log("");
3139
3073
  }
@@ -3146,77 +3080,34 @@ function printSensitivePermissionGuidance(connectorRef, permission, action, uses
3146
3080
  "Consider keeping gmail.send disabled and using gmail.compose instead \u2014 the agent can create drafts for the user to review and send manually."
3147
3081
  );
3148
3082
  console.log(
3149
- `${approvalWording} if direct sending is specifically required.`
3083
+ "Only allow this permission below if direct sending is specifically required."
3150
3084
  );
3151
3085
  console.log("");
3152
3086
  }
3153
3087
  }
3154
3088
  function printPermissionActionMessage(args) {
3155
- if (args.usesUserGrants) {
3156
- const grantAction = args.action === "enable" ? "allow" : "deny";
3157
- console.log(
3158
- `You can ${grantAction} the "${args.permission}" permission for your connector access: [Manage ${args.label} permissions](${args.url})`
3159
- );
3160
- return;
3161
- }
3162
- if (args.role === "admin" || args.role === "owner") {
3163
- console.log(
3164
- `You can ${args.action} the "${args.permission}" permission directly: [Manage ${args.label} permissions](${args.url})`
3165
- );
3166
- return;
3167
- }
3168
- if (args.role !== "member") {
3169
- console.log(
3170
- `To ${args.action} the "${args.permission}" permission for ${args.label}: [Manage ${args.label} permissions](${args.url})`
3171
- );
3172
- return;
3173
- }
3174
- if (!args.reason) {
3175
- console.log(
3176
- `IMPORTANT: Re-run with \`--reason "one sentence why this is needed"\` so the admin can review your request faster.`
3177
- );
3178
- return;
3179
- }
3180
- if (args.action === "enable") {
3181
- console.log(
3182
- `Permission changes require admin approval. Request access at: [Request ${args.label} access](${args.url})`
3183
- );
3184
- return;
3185
- }
3089
+ const grantAction = args.action === "enable" ? "allow" : "deny";
3186
3090
  console.log(
3187
- `Permission changes require admin approval. Contact an org admin to disable this permission: [View ${args.label} permissions](${args.url})`
3091
+ `You can ${grantAction} the "${args.permission}" permission for your connector access: [Manage ${args.label} permissions](${args.url})`
3188
3092
  );
3189
3093
  }
3190
- async function outputPermissionChangeMessage(connectorRef, permission, action, reason) {
3094
+ async function outputPermissionChangeMessage(connectorRef, permission, action) {
3191
3095
  const { label } = CONNECTOR_TYPES[connectorRef];
3192
3096
  const platformOrigin = await getPlatformOrigin();
3193
3097
  const agentId = process.env.ZERO_AGENT_ID;
3194
- const context = await resolvePermissionChangeContext(agentId || void 0);
3195
- const role = context.role;
3196
- const permissionGrantMode = context.permissionGrantMode;
3197
- const usesUserGrants = permissionGrantMode === "user-grants";
3198
3098
  const urlParams = new URLSearchParams({
3199
3099
  ref: connectorRef,
3200
3100
  permission,
3201
3101
  action: action === "enable" ? "allow" : "deny"
3202
3102
  });
3203
- addReasonParam(urlParams, role, usesUserGrants, reason);
3204
3103
  const pagePath = agentId ? `/agents/${agentId}/permissions` : "/agents";
3205
3104
  const url = `${platformOrigin}${pagePath}?${urlParams.toString()}`;
3206
- printSensitivePermissionGuidance(
3207
- connectorRef,
3208
- permission,
3209
- action,
3210
- usesUserGrants
3211
- );
3105
+ printSensitivePermissionGuidance(connectorRef, permission, action);
3212
3106
  printPermissionActionMessage({
3213
- usesUserGrants,
3214
3107
  action,
3215
- role,
3216
3108
  permission,
3217
3109
  label,
3218
- url,
3219
- reason
3110
+ url
3220
3111
  });
3221
3112
  }
3222
3113
  var permissionChangeCommand = new Command().name("permission-change").description("Change or request a permission (enable or disable)").argument("<connector-ref>", "The connector type (e.g. github)").addOption(
@@ -3235,10 +3126,7 @@ var permissionChangeCommand = new Command().name("permission-change").descriptio
3235
3126
  "Disable or request disabling the permission"
3236
3127
  ).conflicts("enable")
3237
3128
  ).addOption(
3238
- new Option(
3239
- "--reason <text>",
3240
- "Brief reason for admin approval requests (max 500 chars)"
3241
- )
3129
+ new Option("--reason <text>", "Brief reason for the permission change")
3242
3130
  ).addHelpText(
3243
3131
  "after",
3244
3132
  `
@@ -3248,7 +3136,7 @@ Examples:
3248
3136
 
3249
3137
  Notes:
3250
3138
  - Outputs a platform URL for the user to adjust the permission
3251
- - Depending on rollout state, members either request approval or manage their own permission grants`
3139
+ - Permission changes update the current user's connector grants`
3252
3140
  ).action(
3253
3141
  withErrorHandler(
3254
3142
  async (connectorRef, opts) => {
@@ -3267,8 +3155,7 @@ Notes:
3267
3155
  await outputPermissionChangeMessage(
3268
3156
  connectorRef,
3269
3157
  opts.permission,
3270
- action,
3271
- opts.reason
3158
+ action
3272
3159
  );
3273
3160
  }
3274
3161
  )
@@ -5838,9 +5725,9 @@ async function showSandboxInfo(showPermissions) {
5838
5725
  }
5839
5726
  try {
5840
5727
  if (showPermissions) {
5841
- const [connectorsResult, agentResult, enabledResult] = await Promise.allSettled([
5728
+ const [connectorsResult, grantsResult, enabledResult] = await Promise.allSettled([
5842
5729
  listZeroConnectors(),
5843
- getZeroAgent(agentId),
5730
+ listZeroUserPermissionGrants(agentId),
5844
5731
  getZeroAgentUserConnectors(agentId)
5845
5732
  ]);
5846
5733
  if (connectorsResult.status === "rejected") return;
@@ -5849,10 +5736,10 @@ async function showSandboxInfo(showPermissions) {
5849
5736
  });
5850
5737
  if (identities.length === 0) return;
5851
5738
  let resolvedPolicies = null;
5852
- const permissionDataAvailable = agentResult.status === "fulfilled" && enabledResult.status === "fulfilled";
5739
+ const permissionDataAvailable = grantsResult.status === "fulfilled" && enabledResult.status === "fulfilled";
5853
5740
  if (permissionDataAvailable) {
5854
5741
  resolvedPolicies = resolveFirewallPolicies(
5855
- agentResult.value.permissionPolicies,
5742
+ permissionGrantsToFirewallPolicies(grantsResult.value),
5856
5743
  enabledResult.value
5857
5744
  );
5858
5745
  }
@@ -13432,7 +13319,7 @@ function registerZeroCommands(prog, commands) {
13432
13319
  var program = new Command();
13433
13320
  program.name("zero").description(
13434
13321
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
13435
- ).version("9.180.4").addHelpText("after", () => {
13322
+ ).version("9.180.6").addHelpText("after", () => {
13436
13323
  return buildZeroHelpText();
13437
13324
  });
13438
13325
  if (process.argv[1]?.endsWith("zero.js") || process.argv[1]?.endsWith("zero.ts") || process.argv[1]?.endsWith("zero")) {