@vm0/cli 9.29.0 → 9.29.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.
Files changed (2) hide show
  1. package/index.js +123 -88
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -62,7 +62,7 @@ if (DSN) {
62
62
  }
63
63
  });
64
64
  Sentry.setContext("cli", {
65
- version: "9.29.0",
65
+ version: "9.29.2",
66
66
  command: process.argv.slice(2).join(" ")
67
67
  });
68
68
  Sentry.setContext("runtime", {
@@ -152,6 +152,9 @@ async function requestDeviceCode(apiUrl) {
152
152
  body: JSON.stringify({})
153
153
  });
154
154
  if (!response.ok) {
155
+ if (response.status === 403) {
156
+ throw new Error("An unexpected network issue occurred");
157
+ }
155
158
  throw new Error(`Failed to request device code: ${response.statusText}`);
156
159
  }
157
160
  return response.json();
@@ -268,6 +271,9 @@ var loginCommand = new Command().name("login").description("Log in to VM0 (use V
268
271
  if (error instanceof Error) {
269
272
  console.error(chalk2.red(`\u2717 Login failed`));
270
273
  console.error(chalk2.dim(` ${error.message}`));
274
+ if (error.cause instanceof Error) {
275
+ console.error(chalk2.dim(` Cause: ${error.cause.message}`));
276
+ }
271
277
  } else {
272
278
  console.error(chalk2.red("\u2717 An unexpected error occurred"));
273
279
  }
@@ -499,7 +505,7 @@ async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
499
505
  // src/commands/info/index.ts
500
506
  var CONFIG_PATH = join2(homedir2(), ".vm0", "config.json");
501
507
  var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
502
- console.log(chalk4.bold(`VM0 CLI v${"9.29.0"}`));
508
+ console.log(chalk4.bold(`VM0 CLI v${"9.29.2"}`));
503
509
  console.log();
504
510
  const config = await loadConfig();
505
511
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -6114,7 +6120,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
6114
6120
  options.autoUpdate = false;
6115
6121
  }
6116
6122
  if (options.autoUpdate !== false) {
6117
- await startSilentUpgrade("9.29.0");
6123
+ await startSilentUpgrade("9.29.2");
6118
6124
  }
6119
6125
  try {
6120
6126
  let result;
@@ -8336,7 +8342,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
8336
8342
  async (identifier, prompt, options) => {
8337
8343
  try {
8338
8344
  if (options.autoUpdate !== false) {
8339
- await startSilentUpgrade("9.29.0");
8345
+ await startSilentUpgrade("9.29.2");
8340
8346
  }
8341
8347
  const { scope, name, version } = parseIdentifier(identifier);
8342
8348
  if (scope && !options.experimentalSharedAgent) {
@@ -10003,7 +10009,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
10003
10009
  ).option("-y, --yes", "Skip confirmation prompts").option("-v, --verbose", "Show full tool inputs and outputs").addOption(new Option5("--debug-no-mock-claude").hideHelp()).addOption(new Option5("--no-auto-update").hideHelp()).action(
10004
10010
  async (prompt, options) => {
10005
10011
  if (options.autoUpdate !== false) {
10006
- const shouldExit = await checkAndUpgrade("9.29.0", prompt);
10012
+ const shouldExit = await checkAndUpgrade("9.29.2", prompt);
10007
10013
  if (shouldExit) {
10008
10014
  process.exit(0);
10009
10015
  }
@@ -13313,94 +13319,108 @@ async function getHeaders2() {
13313
13319
  return headers;
13314
13320
  }
13315
13321
  var connectCommand = new Command66().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").action(async (type2) => {
13316
- const parseResult = connectorTypeSchema.safeParse(type2);
13317
- if (!parseResult.success) {
13318
- console.error(chalk63.red(`\u2717 Unknown connector type: ${type2}`));
13319
- console.error("Available connectors: github");
13320
- process.exit(1);
13321
- }
13322
- const connectorType = parseResult.data;
13323
- const apiUrl = await getApiUrl();
13324
- const headers = await getHeaders2();
13325
- console.log(`Connecting ${chalk63.cyan(type2)}...`);
13326
- const sessionsClient = initClient12(connectorSessionsContract, {
13327
- baseUrl: apiUrl,
13328
- baseHeaders: headers,
13329
- jsonQuery: true
13330
- });
13331
- const createResult = await sessionsClient.create({
13332
- params: { type: connectorType },
13333
- body: {}
13334
- });
13335
- if (createResult.status !== 200) {
13336
- const errorBody = createResult.body;
13337
- console.error(
13338
- chalk63.red(`\u2717 Failed to create session: ${errorBody.error?.message}`)
13339
- );
13340
- process.exit(1);
13341
- }
13342
- const session = createResult.body;
13343
- const verificationUrl = `${apiUrl}${session.verificationUrl}`;
13344
- console.log(chalk63.green("\nSession created"));
13345
- console.log(chalk63.cyan(`
13346
- To connect, visit: ${verificationUrl}`));
13347
- console.log(
13348
- `
13349
- The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
13350
- );
13351
- console.log("\nWaiting for authorization...");
13352
- const sessionClient = initClient12(connectorSessionByIdContract, {
13353
- baseUrl: apiUrl,
13354
- baseHeaders: headers,
13355
- jsonQuery: true
13356
- });
13357
- const startTime = Date.now();
13358
- const maxWaitTime = session.expiresIn * 1e3;
13359
- const pollInterval = (session.interval || 5) * 1e3;
13360
- let isFirstPoll = true;
13361
- while (Date.now() - startTime < maxWaitTime) {
13362
- if (!isFirstPoll) {
13363
- await delay2(pollInterval);
13322
+ try {
13323
+ const parseResult = connectorTypeSchema.safeParse(type2);
13324
+ if (!parseResult.success) {
13325
+ console.error(chalk63.red(`\u2717 Unknown connector type: ${type2}`));
13326
+ console.error("Available connectors: github");
13327
+ process.exit(1);
13364
13328
  }
13365
- isFirstPoll = false;
13366
- const statusResult = await sessionClient.get({
13367
- params: { type: connectorType, sessionId: session.id }
13329
+ const connectorType = parseResult.data;
13330
+ const apiUrl = await getApiUrl();
13331
+ const headers = await getHeaders2();
13332
+ console.log(`Connecting ${chalk63.cyan(type2)}...`);
13333
+ const sessionsClient = initClient12(connectorSessionsContract, {
13334
+ baseUrl: apiUrl,
13335
+ baseHeaders: headers,
13336
+ jsonQuery: true
13337
+ });
13338
+ const createResult = await sessionsClient.create({
13339
+ params: { type: connectorType },
13340
+ body: {}
13368
13341
  });
13369
- if (statusResult.status !== 200) {
13370
- const errorBody = statusResult.body;
13342
+ if (createResult.status !== 200) {
13343
+ const errorBody = createResult.body;
13371
13344
  console.error(
13372
- chalk63.red(`
13373
- \u2717 Failed to check status: ${errorBody.error?.message}`)
13345
+ chalk63.red(`\u2717 Failed to create session: ${errorBody.error?.message}`)
13374
13346
  );
13375
13347
  process.exit(1);
13376
13348
  }
13377
- const status = statusResult.body;
13378
- switch (status.status) {
13379
- case "complete":
13380
- console.log(chalk63.green(`
13381
-
13382
- ${type2} connected successfully!`));
13383
- return;
13384
- case "expired":
13385
- console.error(chalk63.red("\n\u2717 Session expired, please try again"));
13386
- process.exit(1);
13387
- break;
13388
- case "error":
13349
+ const session = createResult.body;
13350
+ const verificationUrl = `${apiUrl}${session.verificationUrl}`;
13351
+ console.log(chalk63.green("\nSession created"));
13352
+ console.log(chalk63.cyan(`
13353
+ To connect, visit: ${verificationUrl}`));
13354
+ console.log(
13355
+ `
13356
+ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
13357
+ );
13358
+ console.log("\nWaiting for authorization...");
13359
+ const sessionClient = initClient12(connectorSessionByIdContract, {
13360
+ baseUrl: apiUrl,
13361
+ baseHeaders: headers,
13362
+ jsonQuery: true
13363
+ });
13364
+ const startTime = Date.now();
13365
+ const maxWaitTime = session.expiresIn * 1e3;
13366
+ const pollInterval = (session.interval || 5) * 1e3;
13367
+ let isFirstPoll = true;
13368
+ while (Date.now() - startTime < maxWaitTime) {
13369
+ if (!isFirstPoll) {
13370
+ await delay2(pollInterval);
13371
+ }
13372
+ isFirstPoll = false;
13373
+ const statusResult = await sessionClient.get({
13374
+ params: { type: connectorType, sessionId: session.id }
13375
+ });
13376
+ if (statusResult.status !== 200) {
13377
+ const errorBody = statusResult.body;
13389
13378
  console.error(
13390
13379
  chalk63.red(
13391
13380
  `
13392
- \u2717 Connection failed: ${status.errorMessage || "Unknown error"}`
13381
+ \u2717 Failed to check status: ${errorBody.error?.message}`
13393
13382
  )
13394
13383
  );
13395
13384
  process.exit(1);
13396
- break;
13397
- case "pending":
13398
- process.stdout.write(chalk63.dim("."));
13399
- break;
13385
+ }
13386
+ const status = statusResult.body;
13387
+ switch (status.status) {
13388
+ case "complete":
13389
+ console.log(chalk63.green(`
13390
+
13391
+ ${type2} connected successfully!`));
13392
+ return;
13393
+ case "expired":
13394
+ console.error(chalk63.red("\n\u2717 Session expired, please try again"));
13395
+ process.exit(1);
13396
+ break;
13397
+ case "error":
13398
+ console.error(
13399
+ chalk63.red(
13400
+ `
13401
+ \u2717 Connection failed: ${status.errorMessage || "Unknown error"}`
13402
+ )
13403
+ );
13404
+ process.exit(1);
13405
+ break;
13406
+ case "pending":
13407
+ process.stdout.write(chalk63.dim("."));
13408
+ break;
13409
+ }
13410
+ }
13411
+ console.error(chalk63.red("\n\u2717 Session timed out, please try again"));
13412
+ process.exit(1);
13413
+ } catch (error) {
13414
+ if (error instanceof Error) {
13415
+ console.error(chalk63.red(`\u2717 ${error.message}`));
13416
+ if (error.cause instanceof Error) {
13417
+ console.error(chalk63.dim(` Cause: ${error.cause.message}`));
13418
+ }
13419
+ } else {
13420
+ console.error(chalk63.red("\u2717 An unexpected error occurred"));
13400
13421
  }
13422
+ process.exit(1);
13401
13423
  }
13402
- console.error(chalk63.red("\n\u2717 Session timed out, please try again"));
13403
- process.exit(1);
13404
13424
  });
13405
13425
 
13406
13426
  // src/commands/connector/list.ts
@@ -13436,6 +13456,9 @@ var listCommand9 = new Command67().name("list").alias("ls").description("List al
13436
13456
  console.error(chalk64.red("\u2717 Not authenticated. Run: vm0 auth login"));
13437
13457
  } else {
13438
13458
  console.error(chalk64.red(`\u2717 ${error.message}`));
13459
+ if (error.cause instanceof Error) {
13460
+ console.error(chalk64.dim(` Cause: ${error.cause.message}`));
13461
+ }
13439
13462
  }
13440
13463
  } else {
13441
13464
  console.error(chalk64.red("\u2717 An unexpected error occurred"));
@@ -13503,6 +13526,9 @@ var statusCommand7 = new Command68().name("status").description("Show detailed s
13503
13526
  console.error(chalk65.red("\u2717 Not authenticated. Run: vm0 auth login"));
13504
13527
  } else {
13505
13528
  console.error(chalk65.red(`\u2717 ${error.message}`));
13529
+ if (error.cause instanceof Error) {
13530
+ console.error(chalk65.dim(` Cause: ${error.cause.message}`));
13531
+ }
13506
13532
  }
13507
13533
  } else {
13508
13534
  console.error(chalk65.red("\u2717 An unexpected error occurred"));
@@ -13536,6 +13562,9 @@ var disconnectCommand = new Command69().name("disconnect").description("Disconne
13536
13562
  console.error(chalk66.red("\u2717 Not authenticated. Run: vm0 auth login"));
13537
13563
  } else {
13538
13564
  console.error(chalk66.red(`\u2717 ${error.message}`));
13565
+ if (error.cause instanceof Error) {
13566
+ console.error(chalk66.dim(` Cause: ${error.cause.message}`));
13567
+ }
13539
13568
  }
13540
13569
  } else {
13541
13570
  console.error(chalk66.red("\u2717 An unexpected error occurred"));
@@ -13684,6 +13713,9 @@ async function requestDeviceCode2(apiUrl) {
13684
13713
  body: JSON.stringify({})
13685
13714
  });
13686
13715
  if (!response.ok) {
13716
+ if (response.status === 403) {
13717
+ throw new Error("An unexpected network issue occurred");
13718
+ }
13687
13719
  throw new Error(`Failed to request device code: ${response.statusText}`);
13688
13720
  }
13689
13721
  return response.json();
@@ -13742,15 +13774,15 @@ async function pollForToken(apiUrl, deviceAuth, callbacks) {
13742
13774
  async function runAuthFlow(callbacks, apiUrl) {
13743
13775
  const targetApiUrl = apiUrl ?? await getApiUrl();
13744
13776
  callbacks?.onInitiating?.();
13745
- const deviceAuth = await requestDeviceCode2(targetApiUrl);
13746
- const verificationUrl = `${targetApiUrl}${deviceAuth.verification_path}`;
13747
- const expiresInMinutes = Math.floor(deviceAuth.expires_in / 60);
13748
- callbacks?.onDeviceCodeReady?.(
13749
- verificationUrl,
13750
- deviceAuth.user_code,
13751
- expiresInMinutes
13752
- );
13753
13777
  try {
13778
+ const deviceAuth = await requestDeviceCode2(targetApiUrl);
13779
+ const verificationUrl = `${targetApiUrl}${deviceAuth.verification_path}`;
13780
+ const expiresInMinutes = Math.floor(deviceAuth.expires_in / 60);
13781
+ callbacks?.onDeviceCodeReady?.(
13782
+ verificationUrl,
13783
+ deviceAuth.user_code,
13784
+ expiresInMinutes
13785
+ );
13754
13786
  const accessToken = await pollForToken(targetApiUrl, deviceAuth, callbacks);
13755
13787
  await saveConfig({
13756
13788
  token: accessToken,
@@ -13950,6 +13982,9 @@ async function handleAuthentication(ctx) {
13950
13982
  onError: (error) => {
13951
13983
  console.error(chalk70.red(`
13952
13984
  \u2717 ${error.message}`));
13985
+ if (error.cause instanceof Error) {
13986
+ console.error(chalk70.dim(` Cause: ${error.cause.message}`));
13987
+ }
13953
13988
  process.exit(1);
13954
13989
  }
13955
13990
  });
@@ -14355,7 +14390,7 @@ var devToolCommand = new Command75().name("dev-tool").description("Developer too
14355
14390
 
14356
14391
  // src/index.ts
14357
14392
  var program = new Command76();
14358
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.29.0");
14393
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.29.2");
14359
14394
  program.addCommand(authCommand);
14360
14395
  program.addCommand(infoCommand);
14361
14396
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.29.0",
3
+ "version": "9.29.2",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",