@vm0/cli 9.94.2 → 9.95.0

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
@@ -59,7 +59,7 @@ import {
59
59
  showNextSteps,
60
60
  volumeConfigSchema,
61
61
  withErrorHandler
62
- } from "./chunk-VSMRILJH.js";
62
+ } from "./chunk-RLI2BL4P.js";
63
63
 
64
64
  // src/index.ts
65
65
  import { Command as Command44 } from "commander";
@@ -452,7 +452,7 @@ function getConfigPath() {
452
452
  return join(homedir(), ".vm0", "config.json");
453
453
  }
454
454
  var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
455
- console.log(chalk3.bold(`VM0 CLI v${"9.94.2"}`));
455
+ console.log(chalk3.bold(`VM0 CLI v${"9.95.0"}`));
456
456
  console.log();
457
457
  const config = await loadConfig();
458
458
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -1579,7 +1579,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
1579
1579
  options.autoUpdate = false;
1580
1580
  }
1581
1581
  if (options.autoUpdate !== false) {
1582
- await startSilentUpgrade("9.94.2");
1582
+ await startSilentUpgrade("9.95.0");
1583
1583
  }
1584
1584
  try {
1585
1585
  let result;
@@ -1653,7 +1653,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
1653
1653
  withErrorHandler(
1654
1654
  async (identifier, prompt, options) => {
1655
1655
  if (options.autoUpdate !== false) {
1656
- await startSilentUpgrade("9.94.2");
1656
+ await startSilentUpgrade("9.95.0");
1657
1657
  }
1658
1658
  const { name, version } = parseIdentifier(identifier);
1659
1659
  let composeId;
@@ -3457,7 +3457,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
3457
3457
  withErrorHandler(
3458
3458
  async (prompt, options) => {
3459
3459
  if (options.autoUpdate !== false) {
3460
- const shouldExit = await checkAndUpgrade("9.94.2", prompt);
3460
+ const shouldExit = await checkAndUpgrade("9.95.0", prompt);
3461
3461
  if (shouldExit) {
3462
3462
  process.exit(0);
3463
3463
  }
@@ -4215,13 +4215,13 @@ var upgradeCommand = new Command42().name("upgrade").description("Upgrade vm0 CL
4215
4215
  if (latestVersion === null) {
4216
4216
  throw new Error("Could not check for updates. Please try again later.");
4217
4217
  }
4218
- if (latestVersion === "9.94.2") {
4219
- console.log(chalk33.green(`\u2713 Already up to date (${"9.94.2"})`));
4218
+ if (latestVersion === "9.95.0") {
4219
+ console.log(chalk33.green(`\u2713 Already up to date (${"9.95.0"})`));
4220
4220
  return;
4221
4221
  }
4222
4222
  console.log(
4223
4223
  chalk33.yellow(
4224
- `Current version: ${"9.94.2"} -> Latest version: ${latestVersion}`
4224
+ `Current version: ${"9.95.0"} -> Latest version: ${latestVersion}`
4225
4225
  )
4226
4226
  );
4227
4227
  console.log();
@@ -4248,7 +4248,7 @@ var upgradeCommand = new Command42().name("upgrade").description("Upgrade vm0 CL
4248
4248
  const success = await performUpgrade(packageManager);
4249
4249
  if (success) {
4250
4250
  console.log(
4251
- chalk33.green(`\u2713 Upgraded from ${"9.94.2"} to ${latestVersion}`)
4251
+ chalk33.green(`\u2713 Upgraded from ${"9.95.0"} to ${latestVersion}`)
4252
4252
  );
4253
4253
  return;
4254
4254
  }
@@ -4316,7 +4316,7 @@ var whoamiCommand = new Command43().name("whoami").description("Show current ide
4316
4316
 
4317
4317
  // src/index.ts
4318
4318
  var program = new Command44();
4319
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.94.2");
4319
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.95.0");
4320
4320
  program.addCommand(authCommand);
4321
4321
  program.addCommand(infoCommand);
4322
4322
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.94.2",
3
+ "version": "9.95.0",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  createZeroComputerConnector,
14
14
  createZeroConnectorSession,
15
15
  createZeroRun,
16
+ decodeCliTokenPayload,
16
17
  decodeZeroTokenPayload,
17
18
  deleteSkill,
18
19
  deleteZeroAgent,
@@ -102,7 +103,7 @@ import {
102
103
  updateZeroUserPreferences,
103
104
  upsertZeroOrgModelProvider,
104
105
  withErrorHandler
105
- } from "./chunk-VSMRILJH.js";
106
+ } from "./chunk-RLI2BL4P.js";
106
107
 
107
108
  // src/zero.ts
108
109
  import { Command as Command70 } from "commander";
@@ -2080,6 +2081,10 @@ Notes:
2080
2081
  const apiUrl = await getApiUrl();
2081
2082
  const platformUrl = toPlatformUrl(apiUrl);
2082
2083
  const agentId = process.env.ZERO_AGENT_ID;
2084
+ const tokenPresent = Boolean(process.env[tokenName]);
2085
+ console.log(
2086
+ `${tokenName} is provided by the ${label} connector. Sandbox env: ${tokenPresent ? "present" : "not present"}.`
2087
+ );
2083
2088
  const [connector, enabledTypes] = await Promise.all([
2084
2089
  getZeroConnector(connectorType).catch(() => {
2085
2090
  return null;
@@ -2090,7 +2095,6 @@ Notes:
2090
2095
  ]);
2091
2096
  const isConnected = connector !== null;
2092
2097
  const hasPermission = enabledTypes !== null && enabledTypes.includes(connectorType);
2093
- console.log(`${tokenName} is provided by the ${label} connector.`);
2094
2098
  if (!isConnected) {
2095
2099
  const url = `${platformUrl.origin}/connectors`;
2096
2100
  console.log(
@@ -2119,7 +2123,7 @@ Notes:
2119
2123
  } else {
2120
2124
  const url = `${platformUrl.origin}/connectors`;
2121
2125
  console.log(
2122
- `The ${label} connector is connected and authorized, but the token is still missing. Ask the user to check the connector status at: [Check ${label} status](${url})`
2126
+ `The ${label} connector is connected and authorized, but the token is still missing. Ask VM0 developer to resolve this issue. Connector status: [Check ${label} status](${url})`
2123
2127
  );
2124
2128
  }
2125
2129
  })
@@ -2129,15 +2133,28 @@ Notes:
2129
2133
  import { Command as Command36, Option } from "commander";
2130
2134
 
2131
2135
  // src/commands/zero/doctor/resolve-role.ts
2132
- async function resolveRole() {
2136
+ async function resolveUserId() {
2137
+ const zeroPayload = decodeZeroTokenPayload();
2138
+ if (zeroPayload?.userId) return zeroPayload.userId;
2139
+ const token = await getToken();
2140
+ const cliPayload = decodeCliTokenPayload(token);
2141
+ return cliPayload?.userId;
2142
+ }
2143
+ async function resolveAgentRole(agentId) {
2133
2144
  try {
2134
2145
  const org = await getZeroOrg();
2135
- if (org.role === "admin" || org.role === "member") {
2136
- return org.role;
2146
+ if (org.role === "admin") return "admin";
2147
+ if (org.role === "member") {
2148
+ const userId = await resolveUserId();
2149
+ if (userId) {
2150
+ const agent = await getZeroAgent(agentId);
2151
+ if (agent.ownerId === userId) return "owner";
2152
+ }
2153
+ return "member";
2137
2154
  }
2138
2155
  return "unknown";
2139
2156
  } catch (error) {
2140
- console.debug("resolveRole failed, falling back to unknown:", error);
2157
+ console.debug("resolveAgentRole failed, falling back to unknown:", error);
2141
2158
  return "unknown";
2142
2159
  }
2143
2160
  }
@@ -2185,7 +2202,7 @@ Notes:
2185
2202
  if (permissions.length > 0) {
2186
2203
  urlParams.set("permission", permissions[0]);
2187
2204
  }
2188
- const pagePath = agentId ? `/firewall-allow/${agentId}` : "/firewall-allow";
2205
+ const pagePath = agentId ? `/agents/${agentId}/permissions` : "/agents";
2189
2206
  const url = `${platformOrigin}${pagePath}?${urlParams.toString()}`;
2190
2207
  console.log(
2191
2208
  `The ${label} firewall blocked ${opts.method} ${opts.path}.`
@@ -2208,8 +2225,8 @@ Notes:
2208
2225
  );
2209
2226
  console.log("");
2210
2227
  }
2211
- const role = agentId ? await resolveRole() : "unknown";
2212
- if (role === "admin") {
2228
+ const role = agentId ? await resolveAgentRole(agentId) : "unknown";
2229
+ if (role === "admin" || role === "owner") {
2213
2230
  console.log(
2214
2231
  `You can allow this permission directly: [Manage ${label} firewall](${url})`
2215
2232
  );
@@ -2284,10 +2301,10 @@ Notes:
2284
2301
  ref: firewallRef,
2285
2302
  permission: opts.permission
2286
2303
  });
2287
- const pagePath = agentId ? `/firewall-allow/${agentId}` : "/firewall-allow";
2304
+ const pagePath = agentId ? `/agents/${agentId}/permissions` : "/agents";
2288
2305
  const url = `${platformOrigin}${pagePath}?${urlParams.toString()}`;
2289
- const role = agentId ? await resolveRole() : "unknown";
2290
- if (role === "admin") {
2306
+ const role = agentId ? await resolveAgentRole(agentId) : "unknown";
2307
+ if (role === "admin" || role === "owner") {
2291
2308
  console.log(
2292
2309
  `You can ${action} the "${opts.permission}" permission directly: [Manage ${label} firewall](${url})`
2293
2310
  );
@@ -4138,7 +4155,7 @@ function registerZeroCommands(prog, commands) {
4138
4155
  var program = new Command70();
4139
4156
  program.name("zero").description(
4140
4157
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
4141
- ).version("9.94.2").addHelpText(
4158
+ ).version("9.95.0").addHelpText(
4142
4159
  "after",
4143
4160
  `
4144
4161
  Examples: