@vm0/cli 9.102.10 → 9.103.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.102.10",
3
+ "version": "9.103.1",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -115,7 +115,7 @@ import {
115
115
  upsertZeroOrgModelProvider,
116
116
  withErrorHandler,
117
117
  zeroAgentCustomSkillNameSchema
118
- } from "./chunk-OCZK25RZ.js";
118
+ } from "./chunk-LQZNYDKG.js";
119
119
 
120
120
  // src/zero.ts
121
121
  import { Command as Command77 } from "commander";
@@ -2246,8 +2246,7 @@ Notes:
2246
2246
  );
2247
2247
  }
2248
2248
  if (!hasPermission) {
2249
- const path = agentId ? `/team/${agentId}` : "/team";
2250
- const url = `${platformUrl.origin}${path}?tab=authorization`;
2249
+ const url = agentId ? `${platformUrl.origin}/connectors/${connectorType}/authorize?agentId=${agentId}` : `${platformUrl.origin}/connectors`;
2251
2250
  issues.push(
2252
2251
  `The ${label} connector is not authorized for this agent. Ask the user to enable it at: [Authorize ${label}](${url})`
2253
2252
  );
@@ -2266,6 +2265,9 @@ Notes:
2266
2265
  );
2267
2266
 
2268
2267
  // src/commands/zero/doctor/firewall-deny.ts
2268
+ import { Command as Command37, Option as Option2 } from "commander";
2269
+
2270
+ // src/commands/zero/doctor/firewall-permissions-change.ts
2269
2271
  import { Command as Command36, Option } from "commander";
2270
2272
 
2271
2273
  // src/commands/zero/doctor/resolve-role.ts
@@ -2295,92 +2297,7 @@ async function resolveAgentRole(agentId) {
2295
2297
  }
2296
2298
  }
2297
2299
 
2298
- // src/commands/zero/doctor/firewall-deny.ts
2299
- var firewallDenyCommand = new Command36().name("firewall-deny").description(
2300
- "Diagnose a firewall denial and find the permission that covers it"
2301
- ).argument("<firewall-ref>", "The firewall connector type (e.g. github)").addOption(
2302
- new Option(
2303
- "--method <method>",
2304
- "The denied HTTP method"
2305
- ).makeOptionMandatory()
2306
- ).addOption(
2307
- new Option("--path <path>", "The denied path").makeOptionMandatory()
2308
- ).addHelpText(
2309
- "after",
2310
- `
2311
- Examples:
2312
- zero doctor firewall-deny github --method GET --path /repos/owner/repo/pulls
2313
- zero doctor firewall-deny slack --method POST --path /chat.postMessage
2314
-
2315
- Notes:
2316
- - Identifies which named permission covers a denied request
2317
- - Outputs a platform URL for the user to allow the permission`
2318
- ).action(
2319
- withErrorHandler(
2320
- async (firewallRef, opts) => {
2321
- if (!isFirewallConnectorType(firewallRef)) {
2322
- throw new Error(`Unknown firewall connector type: ${firewallRef}`);
2323
- }
2324
- const { label } = CONNECTOR_TYPES[firewallRef];
2325
- const config = getConnectorFirewall(firewallRef);
2326
- const permissions = findMatchingPermissions(
2327
- opts.method,
2328
- opts.path,
2329
- config
2330
- );
2331
- const platformOrigin = await getPlatformOrigin();
2332
- const agentId = process.env.ZERO_AGENT_ID;
2333
- const urlParams = new URLSearchParams({
2334
- ref: firewallRef,
2335
- method: opts.method,
2336
- path: opts.path
2337
- });
2338
- if (permissions.length > 0) {
2339
- urlParams.set("permission", permissions[0]);
2340
- }
2341
- const pagePath = agentId ? `/agents/${agentId}/permissions` : "/agents";
2342
- const url = `${platformOrigin}${pagePath}?${urlParams.toString()}`;
2343
- console.log(
2344
- `The ${label} firewall blocked ${opts.method} ${opts.path}.`
2345
- );
2346
- if (permissions.length > 0) {
2347
- console.log(`This is covered by the "${permissions[0]}" permission.`);
2348
- } else {
2349
- console.log("No named permission was found covering this request.");
2350
- }
2351
- if (firewallRef === "slack" && permissions[0] === "chat:write") {
2352
- console.log("");
2353
- console.log(
2354
- "IMPORTANT: Granting chat:write allows sending messages AS THE USER's identity, not as a bot."
2355
- );
2356
- console.log(
2357
- "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."
2358
- );
2359
- console.log(
2360
- "Only request user approval below if acting as the user is specifically required."
2361
- );
2362
- console.log("");
2363
- }
2364
- const role = agentId ? await resolveAgentRole(agentId) : "unknown";
2365
- if (role === "admin" || role === "owner") {
2366
- console.log(
2367
- `You can allow this permission directly: [Manage ${label} firewall](${url})`
2368
- );
2369
- } else if (role === "member") {
2370
- console.log(
2371
- `This change requires admin approval. Request access at: [Request ${label} access](${url})`
2372
- );
2373
- } else {
2374
- console.log(
2375
- `Ask the user to allow it at: [Allow ${label} access](${url})`
2376
- );
2377
- }
2378
- }
2379
- )
2380
- );
2381
-
2382
2300
  // src/commands/zero/doctor/firewall-permissions-change.ts
2383
- import { Command as Command37, Option as Option2 } from "commander";
2384
2301
  function findPermissionInConfig(ref, permissionName) {
2385
2302
  if (!isFirewallConnectorType(ref)) return false;
2386
2303
  const config = getConnectorFirewall(ref);
@@ -2392,17 +2309,62 @@ function findPermissionInConfig(ref, permissionName) {
2392
2309
  }
2393
2310
  return false;
2394
2311
  }
2395
- var firewallPermissionsChangeCommand = new Command37().name("firewall-permissions-change").description("Request a firewall permission change (enable or disable)").argument("<firewall-ref>", "The firewall connector type (e.g. github)").addOption(
2396
- new Option2(
2312
+ async function outputPermissionChangeMessage(firewallRef, permission, action) {
2313
+ const { label } = CONNECTOR_TYPES[firewallRef];
2314
+ const platformOrigin = await getPlatformOrigin();
2315
+ const agentId = process.env.ZERO_AGENT_ID;
2316
+ const urlParams = new URLSearchParams({
2317
+ ref: firewallRef,
2318
+ permission,
2319
+ action: action === "enable" ? "allow" : "deny"
2320
+ });
2321
+ const pagePath = agentId ? `/agents/${agentId}/permissions` : "/agents";
2322
+ const url = `${platformOrigin}${pagePath}?${urlParams.toString()}`;
2323
+ if (firewallRef === "slack" && permission === "chat:write" && action === "enable") {
2324
+ console.log("");
2325
+ console.log(
2326
+ "IMPORTANT: Granting chat:write allows sending messages AS THE USER's identity, not as a bot."
2327
+ );
2328
+ console.log(
2329
+ "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."
2330
+ );
2331
+ console.log(
2332
+ "Only request user approval below if acting as the user is specifically required."
2333
+ );
2334
+ console.log("");
2335
+ }
2336
+ const role = agentId ? await resolveAgentRole(agentId) : "unknown";
2337
+ if (role === "admin" || role === "owner") {
2338
+ console.log(
2339
+ `You can ${action} the "${permission}" permission directly: [Manage ${label} firewall](${url})`
2340
+ );
2341
+ } else if (role === "member") {
2342
+ if (action === "enable") {
2343
+ console.log(
2344
+ `Permission changes require admin approval. Request access at: [Request ${label} access](${url})`
2345
+ );
2346
+ } else {
2347
+ console.log(
2348
+ `Permission changes require admin approval. Contact an org admin to disable this permission: [View ${label} firewall](${url})`
2349
+ );
2350
+ }
2351
+ } else {
2352
+ console.log(
2353
+ `To ${action} the "${permission}" permission on the ${label} firewall: [Manage ${label} firewall](${url})`
2354
+ );
2355
+ }
2356
+ }
2357
+ var firewallPermissionsChangeCommand = new Command36().name("firewall-permissions-change").description("Request a firewall permission change (enable or disable)").argument("<firewall-ref>", "The firewall connector type (e.g. github)").addOption(
2358
+ new Option(
2397
2359
  "--permission <name>",
2398
2360
  "The permission name to change"
2399
2361
  ).makeOptionMandatory()
2400
2362
  ).addOption(
2401
- new Option2("--enable", "Request to enable the permission").conflicts(
2363
+ new Option("--enable", "Request to enable the permission").conflicts(
2402
2364
  "disable"
2403
2365
  )
2404
2366
  ).addOption(
2405
- new Option2("--disable", "Request to disable the permission").conflicts(
2367
+ new Option("--disable", "Request to disable the permission").conflicts(
2406
2368
  "enable"
2407
2369
  )
2408
2370
  ).addHelpText(
@@ -2429,36 +2391,59 @@ Notes:
2429
2391
  `Unknown permission "${opts.permission}" for ${firewallRef} firewall`
2430
2392
  );
2431
2393
  }
2432
- const { label } = CONNECTOR_TYPES[firewallRef];
2433
2394
  const action = opts.enable ? "enable" : "disable";
2434
- const platformOrigin = await getPlatformOrigin();
2435
- const agentId = process.env.ZERO_AGENT_ID;
2436
- const urlParams = new URLSearchParams({
2437
- ref: firewallRef,
2438
- permission: opts.permission
2439
- });
2440
- const pagePath = agentId ? `/agents/${agentId}/permissions` : "/agents";
2441
- const url = `${platformOrigin}${pagePath}?${urlParams.toString()}`;
2442
- const role = agentId ? await resolveAgentRole(agentId) : "unknown";
2443
- if (role === "admin" || role === "owner") {
2444
- console.log(
2445
- `You can ${action} the "${opts.permission}" permission directly: [Manage ${label} firewall](${url})`
2446
- );
2447
- } else if (role === "member") {
2448
- if (action === "enable") {
2449
- console.log(
2450
- `Permission changes require admin approval. Request access at: [Request ${label} access](${url})`
2451
- );
2452
- } else {
2453
- console.log(
2454
- `Permission changes require admin approval. Contact an org admin to disable this permission: [View ${label} firewall](${url})`
2455
- );
2456
- }
2457
- } else {
2458
- console.log(
2459
- `To ${action} the "${opts.permission}" permission on the ${label} firewall: [Manage ${label} firewall](${url})`
2460
- );
2395
+ await outputPermissionChangeMessage(
2396
+ firewallRef,
2397
+ opts.permission,
2398
+ action
2399
+ );
2400
+ }
2401
+ )
2402
+ );
2403
+
2404
+ // src/commands/zero/doctor/firewall-deny.ts
2405
+ var firewallDenyCommand = new Command37().name("firewall-deny").description(
2406
+ "Diagnose a firewall denial and find the permission that covers it"
2407
+ ).argument("<firewall-ref>", "The firewall connector type (e.g. github)").addOption(
2408
+ new Option2(
2409
+ "--method <method>",
2410
+ "The denied HTTP method"
2411
+ ).makeOptionMandatory()
2412
+ ).addOption(
2413
+ new Option2("--path <path>", "The denied path").makeOptionMandatory()
2414
+ ).addHelpText(
2415
+ "after",
2416
+ `
2417
+ Examples:
2418
+ zero doctor firewall-deny github --method GET --path /repos/owner/repo/pulls
2419
+ zero doctor firewall-deny slack --method POST --path /chat.postMessage
2420
+
2421
+ Notes:
2422
+ - Identifies which named permission covers a denied request
2423
+ - Outputs a platform URL for the user to allow the permission`
2424
+ ).action(
2425
+ withErrorHandler(
2426
+ async (firewallRef, opts) => {
2427
+ if (!isFirewallConnectorType(firewallRef)) {
2428
+ throw new Error(`Unknown firewall connector type: ${firewallRef}`);
2429
+ }
2430
+ const { label } = CONNECTOR_TYPES[firewallRef];
2431
+ const config = getConnectorFirewall(firewallRef);
2432
+ const permissions = findMatchingPermissions(
2433
+ opts.method,
2434
+ opts.path,
2435
+ config
2436
+ );
2437
+ console.log(
2438
+ `The ${label} firewall blocked ${opts.method} ${opts.path}.`
2439
+ );
2440
+ if (permissions.length === 0) {
2441
+ console.log("No named permission was found covering this request.");
2442
+ return;
2461
2443
  }
2444
+ const permission = permissions[0];
2445
+ console.log(`This is covered by the "${permission}" permission.`);
2446
+ await outputPermissionChangeMessage(firewallRef, permission, "enable");
2462
2447
  }
2463
2448
  )
2464
2449
  );
@@ -5753,7 +5738,7 @@ function registerZeroCommands(prog, commands) {
5753
5738
  var program = new Command77();
5754
5739
  program.name("zero").description(
5755
5740
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
5756
- ).version("9.102.10").addHelpText(
5741
+ ).version("9.103.1").addHelpText(
5757
5742
  "after",
5758
5743
  `
5759
5744
  Examples: