@vm0/cli 6.3.0 → 6.4.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.
Files changed (2) hide show
  1. package/index.js +125 -122
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -747,7 +747,7 @@ var runEventsContract = c3.router({
747
747
  id: z4.string().min(1, "Run ID is required")
748
748
  }),
749
749
  query: z4.object({
750
- since: z4.coerce.number().default(0),
750
+ since: z4.coerce.number().default(-1),
751
751
  limit: z4.coerce.number().default(100)
752
752
  }),
753
753
  responses: {
@@ -1130,7 +1130,7 @@ import { z as z6 } from "zod";
1130
1130
  var c5 = initContract();
1131
1131
  var agentEventSchema = z6.object({
1132
1132
  type: z6.string(),
1133
- sequenceNumber: z6.number().int().positive()
1133
+ sequenceNumber: z6.number().int().nonnegative()
1134
1134
  }).passthrough();
1135
1135
  var artifactSnapshotSchema = z6.object({
1136
1136
  artifactName: z6.string(),
@@ -1753,19 +1753,22 @@ var MODEL_PROVIDER_TYPES = {
1753
1753
  framework: "claude-code",
1754
1754
  credentialName: "CLAUDE_CODE_OAUTH_TOKEN",
1755
1755
  label: "Claude Code (OAuth Token)",
1756
- credentialLabel: "OAuth token"
1756
+ credentialLabel: "OAuth token",
1757
+ helpText: "To get your OAuth token, run: claude setup-token\n(Requires Claude Pro or Max subscription)"
1757
1758
  },
1758
1759
  "anthropic-api-key": {
1759
1760
  framework: "claude-code",
1760
1761
  credentialName: "ANTHROPIC_API_KEY",
1761
1762
  label: "Anthropic API Key",
1762
- credentialLabel: "API key"
1763
+ credentialLabel: "API key",
1764
+ helpText: "Get your API key at: https://console.anthropic.com/settings/keys"
1763
1765
  },
1764
1766
  "openai-api-key": {
1765
1767
  framework: "codex",
1766
1768
  credentialName: "OPENAI_API_KEY",
1767
1769
  label: "OpenAI API Key",
1768
- credentialLabel: "API key"
1770
+ credentialLabel: "API key",
1771
+ helpText: "Get your API key at: https://platform.openai.com/api-keys"
1769
1772
  }
1770
1773
  };
1771
1774
  var modelProviderTypeSchema = z13.enum([
@@ -2874,13 +2877,39 @@ function getFrameworkDisplayName(framework) {
2874
2877
  }
2875
2878
 
2876
2879
  // ../../packages/core/src/feature-switch.ts
2877
- var PricingSwitch = {
2878
- key: "pricing" /* Pricing */,
2879
- maintainer: "ethan@vm0.ai",
2880
- enabled: false
2881
- };
2882
2880
  var FEATURE_SWITCHES = {
2883
- ["pricing" /* Pricing */]: PricingSwitch
2881
+ ["pricing" /* Pricing */]: {
2882
+ maintainer: "ethan@vm0.ai",
2883
+ enabled: false
2884
+ },
2885
+ ["dummy" /* Dummy */]: {
2886
+ maintainer: "ethan@vm0.ai",
2887
+ enabled: true
2888
+ },
2889
+ ["platformOnboarding" /* PlatformOnboarding */]: {
2890
+ maintainer: "ethan@vm0.ai",
2891
+ enabled: false
2892
+ },
2893
+ ["platformAgents" /* PlatformAgents */]: {
2894
+ maintainer: "ethan@vm0.ai",
2895
+ enabled: false
2896
+ },
2897
+ ["platformSecrets" /* PlatformSecrets */]: {
2898
+ maintainer: "ethan@vm0.ai",
2899
+ enabled: false
2900
+ },
2901
+ ["platformArtifacts" /* PlatformArtifacts */]: {
2902
+ maintainer: "ethan@vm0.ai",
2903
+ enabled: false
2904
+ },
2905
+ ["platformApiKeys" /* PlatformApiKeys */]: {
2906
+ maintainer: "ethan@vm0.ai",
2907
+ enabled: false
2908
+ },
2909
+ ["platformLogs" /* PlatformLogs */]: {
2910
+ maintainer: "ethan@vm0.ai",
2911
+ enabled: false
2912
+ }
2884
2913
  };
2885
2914
 
2886
2915
  // src/lib/api/core/client-factory.ts
@@ -3004,7 +3033,7 @@ async function getEvents(runId, options) {
3004
3033
  const result = await client.getEvents({
3005
3034
  params: { id: runId },
3006
3035
  query: {
3007
- since: options?.since ?? 0,
3036
+ since: options?.since ?? -1,
3008
3037
  limit: options?.limit ?? 100
3009
3038
  }
3010
3039
  });
@@ -4120,18 +4149,10 @@ var composeCommand = new Command().name("compose").description("Create or update
4120
4149
  );
4121
4150
  if (defaultImage) {
4122
4151
  agent.image = defaultImage;
4123
- console.log(
4124
- chalk2.dim(` Auto-configured image: ${defaultImage}`)
4125
- );
4126
4152
  }
4127
4153
  }
4128
4154
  if (!agent.working_dir) {
4129
4155
  agent.working_dir = defaults.workingDir;
4130
- console.log(
4131
- chalk2.dim(
4132
- ` Auto-configured working_dir: ${defaults.workingDir}`
4133
- )
4134
- );
4135
4156
  }
4136
4157
  }
4137
4158
  }
@@ -5074,7 +5095,7 @@ var ApiClient = class {
5074
5095
  const result = await client.getEvents({
5075
5096
  params: { id: runId },
5076
5097
  query: {
5077
- since: options?.since ?? 0,
5098
+ since: options?.since ?? -1,
5078
5099
  limit: options?.limit ?? 100
5079
5100
  }
5080
5101
  });
@@ -6022,7 +6043,7 @@ async function streamRealtimeEvents(runId, options) {
6022
6043
  });
6023
6044
  }
6024
6045
  async function pollEvents(runId, options) {
6025
- let nextSequence = 0;
6046
+ let nextSequence = -1;
6026
6047
  let complete = false;
6027
6048
  let result = { succeeded: true, runId };
6028
6049
  const pollIntervalMs = 1e3;
@@ -7512,7 +7533,34 @@ function detectPackageManager() {
7512
7533
  if (execPath.includes("pnpm")) {
7513
7534
  return "pnpm";
7514
7535
  }
7515
- return "npm";
7536
+ if (execPath.includes("/.bun/") || execPath.includes("/bun/")) {
7537
+ return "bun";
7538
+ }
7539
+ if (execPath.includes("/.yarn/") || execPath.includes("/yarn/")) {
7540
+ return "yarn";
7541
+ }
7542
+ if (execPath.includes("/usr/local/") || execPath.includes("/.nvm/") || execPath.includes("/.fnm/") || execPath.includes("/.volta/") || execPath.includes("/.nodenv/") || execPath.includes("/.n/") || execPath.includes("/node_modules/") || execPath.includes("\\npm\\") || // Windows: AppData\Roaming\npm
7543
+ execPath.includes("\\nodejs\\")) {
7544
+ return "npm";
7545
+ }
7546
+ return "unknown";
7547
+ }
7548
+ function isAutoUpgradeSupported(pm) {
7549
+ return pm === "npm" || pm === "pnpm";
7550
+ }
7551
+ function getManualUpgradeCommand(pm) {
7552
+ switch (pm) {
7553
+ case "bun":
7554
+ return `bun add -g ${PACKAGE_NAME}@latest`;
7555
+ case "yarn":
7556
+ return `yarn global add ${PACKAGE_NAME}@latest`;
7557
+ case "pnpm":
7558
+ return `pnpm add -g ${PACKAGE_NAME}@latest`;
7559
+ case "npm":
7560
+ return `npm install -g ${PACKAGE_NAME}@latest`;
7561
+ case "unknown":
7562
+ return `npm install -g ${PACKAGE_NAME}@latest`;
7563
+ }
7516
7564
  }
7517
7565
  function escapeForShell(str) {
7518
7566
  return `"${str.replace(/"/g, '\\"')}"`;
@@ -7580,6 +7628,21 @@ async function checkAndUpgrade(currentVersion, prompt) {
7580
7628
  );
7581
7629
  console.log();
7582
7630
  const packageManager = detectPackageManager();
7631
+ if (!isAutoUpgradeSupported(packageManager)) {
7632
+ if (packageManager === "unknown") {
7633
+ console.log(
7634
+ chalk23.yellow("Could not detect your package manager for auto-upgrade.")
7635
+ );
7636
+ } else {
7637
+ console.log(
7638
+ chalk23.yellow(`Auto-upgrade is not supported for ${packageManager}.`)
7639
+ );
7640
+ }
7641
+ console.log(chalk23.yellow("Please upgrade manually:"));
7642
+ console.log(chalk23.cyan(` ${getManualUpgradeCommand(packageManager)}`));
7643
+ console.log();
7644
+ return false;
7645
+ }
7583
7646
  console.log(`Upgrading via ${packageManager}...`);
7584
7647
  const success = await performUpgrade(packageManager);
7585
7648
  if (success) {
@@ -7591,9 +7654,7 @@ async function checkAndUpgrade(currentVersion, prompt) {
7591
7654
  }
7592
7655
  console.log();
7593
7656
  console.log(chalk23.red("Upgrade failed. Please run manually:"));
7594
- console.log(chalk23.cyan(` npm install -g ${PACKAGE_NAME}@latest`));
7595
- console.log(chalk23.dim(" # or"));
7596
- console.log(chalk23.cyan(` pnpm add -g ${PACKAGE_NAME}@latest`));
7657
+ console.log(chalk23.cyan(` ${getManualUpgradeCommand(packageManager)}`));
7597
7658
  console.log();
7598
7659
  console.log("Then re-run:");
7599
7660
  console.log(chalk23.cyan(` ${buildRerunCommand(prompt)}`));
@@ -7828,7 +7889,7 @@ cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip c
7828
7889
  // eslint-disable-next-line complexity -- TODO: refactor complex function
7829
7890
  async (prompt, options) => {
7830
7891
  if (!options.noAutoUpdate) {
7831
- const shouldExit = await checkAndUpgrade("6.3.0", prompt);
7892
+ const shouldExit = await checkAndUpgrade("6.4.0", prompt);
7832
7893
  if (shouldExit) {
7833
7894
  process.exit(0);
7834
7895
  }
@@ -8835,9 +8896,6 @@ agents:
8835
8896
  # Agent skills - see https://github.com/vm0-ai/vm0-skills for available skills
8836
8897
  # skills:
8837
8898
  # - https://github.com/vm0-ai/vm0-skills/tree/main/github
8838
- environment:
8839
- # Get token using: claude setup-token, then add to .env file
8840
- CLAUDE_CODE_OAUTH_TOKEN: \${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
8841
8899
  `;
8842
8900
  }
8843
8901
  function generateAgentsMd() {
@@ -8914,10 +8972,11 @@ var initCommand3 = new Command27().name("init").description("Initialize a new VM
8914
8972
  console.log();
8915
8973
  console.log("Next steps:");
8916
8974
  console.log(
8917
- ` 1. Get your Claude Code token: ${chalk30.cyan("claude setup-token")}`
8975
+ ` 1. Set model provider (one-time): ${chalk30.cyan("vm0 model-provider setup")}`
8976
+ );
8977
+ console.log(
8978
+ ` 2. Edit ${chalk30.cyan("AGENTS.md")} to customize your agent's workflow`
8918
8979
  );
8919
- console.log(` 2. Set the environment variable (or add to .env file):`);
8920
- console.log(chalk30.dim(` export CLAUDE_CODE_OAUTH_TOKEN=<your-token>`));
8921
8980
  console.log(
8922
8981
  ` 3. Run your agent: ${chalk30.cyan(`vm0 cook "let's start working."`)}`
8923
8982
  );
@@ -9609,6 +9668,18 @@ function toISODateTime(dateTimeStr) {
9609
9668
  const date = new Date(isoStr);
9610
9669
  return date.toISOString();
9611
9670
  }
9671
+ async function resolveScheduleByName(name) {
9672
+ const { schedules } = await listSchedules();
9673
+ const schedule = schedules.find((s) => s.name === name);
9674
+ if (!schedule) {
9675
+ throw new Error(`Schedule "${name}" not found`);
9676
+ }
9677
+ return {
9678
+ name: schedule.name,
9679
+ composeId: schedule.composeId,
9680
+ composeName: schedule.composeName
9681
+ };
9682
+ }
9612
9683
 
9613
9684
  // src/commands/schedule/init.ts
9614
9685
  var SCHEDULE_FILE2 = "schedule.yaml";
@@ -10196,26 +10267,8 @@ var statusCommand4 = new Command32().name("status").description("Show detailed s
10196
10267
  }
10197
10268
  name = scheduleResult.scheduleName;
10198
10269
  }
10199
- const result = loadAgentName();
10200
- if (result.error) {
10201
- console.error(chalk35.red(`\u2717 Invalid vm0.yaml: ${result.error}`));
10202
- process.exit(1);
10203
- }
10204
- if (!result.agentName) {
10205
- console.error(chalk35.red("\u2717 No vm0.yaml found in current directory"));
10206
- console.error(chalk35.dim(" Run this command from the agent directory"));
10207
- process.exit(1);
10208
- }
10209
- const agentName = result.agentName;
10210
- let composeId;
10211
- try {
10212
- const compose = await getComposeByName(agentName);
10213
- composeId = compose.id;
10214
- } catch {
10215
- console.error(chalk35.red(`\u2717 Agent not found: ${agentName}`));
10216
- console.error(chalk35.dim(" Make sure the agent is pushed first"));
10217
- process.exit(1);
10218
- }
10270
+ const resolved = await resolveScheduleByName(name);
10271
+ const composeId = resolved.composeId;
10219
10272
  const schedule = await getScheduleByName({ name, composeId });
10220
10273
  console.log();
10221
10274
  console.log(`Schedule: ${chalk35.cyan(schedule.name)}`);
@@ -10295,6 +10348,7 @@ var statusCommand4 = new Command32().name("status").description("Show detailed s
10295
10348
  console.error(
10296
10349
  chalk35.dim(` Schedule "${nameArg ?? "unknown"}" not found`)
10297
10350
  );
10351
+ console.error(chalk35.dim(" Run: vm0 schedule list"));
10298
10352
  } else {
10299
10353
  console.error(chalk35.dim(` ${error.message}`));
10300
10354
  }
@@ -10342,26 +10396,7 @@ var deleteCommand = new Command33().name("delete").alias("rm").description("Dele
10342
10396
  }
10343
10397
  name = scheduleResult.scheduleName;
10344
10398
  }
10345
- const result = loadAgentName();
10346
- if (result.error) {
10347
- console.error(chalk36.red(`\u2717 Invalid vm0.yaml: ${result.error}`));
10348
- process.exit(1);
10349
- }
10350
- if (!result.agentName) {
10351
- console.error(chalk36.red("\u2717 No vm0.yaml found in current directory"));
10352
- console.error(chalk36.dim(" Run this command from the agent directory"));
10353
- process.exit(1);
10354
- }
10355
- const agentName = result.agentName;
10356
- let composeId;
10357
- try {
10358
- const compose = await getComposeByName(agentName);
10359
- composeId = compose.id;
10360
- } catch {
10361
- console.error(chalk36.red(`\u2717 Agent not found: ${agentName}`));
10362
- console.error(chalk36.dim(" Make sure the agent is pushed first"));
10363
- process.exit(1);
10364
- }
10399
+ const resolved = await resolveScheduleByName(name);
10365
10400
  if (!options.force) {
10366
10401
  const confirmed = await confirm(`Delete schedule ${chalk36.cyan(name)}?`);
10367
10402
  if (!confirmed) {
@@ -10369,7 +10404,7 @@ var deleteCommand = new Command33().name("delete").alias("rm").description("Dele
10369
10404
  return;
10370
10405
  }
10371
10406
  }
10372
- await deleteSchedule({ name, composeId });
10407
+ await deleteSchedule({ name, composeId: resolved.composeId });
10373
10408
  console.log(chalk36.green(`\u2713 Deleted schedule ${chalk36.cyan(name)}`));
10374
10409
  } catch (error) {
10375
10410
  console.error(chalk36.red("\u2717 Failed to delete schedule"));
@@ -10378,6 +10413,7 @@ var deleteCommand = new Command33().name("delete").alias("rm").description("Dele
10378
10413
  console.error(chalk36.dim(" Run: vm0 auth login"));
10379
10414
  } else if (error.message.toLowerCase().includes("not found")) {
10380
10415
  console.error(chalk36.dim(` Schedule "${name}" not found`));
10416
+ console.error(chalk36.dim(" Run: vm0 schedule list"));
10381
10417
  } else {
10382
10418
  console.error(chalk36.dim(` ${error.message}`));
10383
10419
  }
@@ -10412,33 +10448,17 @@ var enableCommand = new Command34().name("enable").description("Enable a schedul
10412
10448
  }
10413
10449
  name = scheduleResult.scheduleName;
10414
10450
  }
10415
- const result = loadAgentName();
10416
- if (result.error) {
10417
- console.error(chalk37.red(`\u2717 Invalid vm0.yaml: ${result.error}`));
10418
- process.exit(1);
10419
- }
10420
- if (!result.agentName) {
10421
- console.error(chalk37.red("\u2717 No vm0.yaml found in current directory"));
10422
- console.error(chalk37.dim(" Run this command from the agent directory"));
10423
- process.exit(1);
10424
- }
10425
- const agentName = result.agentName;
10426
- let composeId;
10427
- try {
10428
- const compose = await getComposeByName(agentName);
10429
- composeId = compose.id;
10430
- } catch {
10431
- console.error(chalk37.red(`\u2717 Agent not found: ${agentName}`));
10432
- console.error(chalk37.dim(" Make sure the agent is pushed first"));
10433
- process.exit(1);
10434
- }
10435
- await enableSchedule({ name, composeId });
10451
+ const resolved = await resolveScheduleByName(name);
10452
+ await enableSchedule({ name, composeId: resolved.composeId });
10436
10453
  console.log(chalk37.green(`\u2713 Enabled schedule ${chalk37.cyan(name)}`));
10437
10454
  } catch (error) {
10438
10455
  console.error(chalk37.red("\u2717 Failed to enable schedule"));
10439
10456
  if (error instanceof Error) {
10440
10457
  if (error.message.includes("Not authenticated")) {
10441
10458
  console.error(chalk37.dim(" Run: vm0 auth login"));
10459
+ } else if (error.message.toLowerCase().includes("not found")) {
10460
+ console.error(chalk37.dim(` Schedule "${nameArg}" not found`));
10461
+ console.error(chalk37.dim(" Run: vm0 schedule list"));
10442
10462
  } else {
10443
10463
  console.error(chalk37.dim(` ${error.message}`));
10444
10464
  }
@@ -10473,33 +10493,17 @@ var disableCommand = new Command35().name("disable").description("Disable a sche
10473
10493
  }
10474
10494
  name = scheduleResult.scheduleName;
10475
10495
  }
10476
- const result = loadAgentName();
10477
- if (result.error) {
10478
- console.error(chalk38.red(`\u2717 Invalid vm0.yaml: ${result.error}`));
10479
- process.exit(1);
10480
- }
10481
- if (!result.agentName) {
10482
- console.error(chalk38.red("\u2717 No vm0.yaml found in current directory"));
10483
- console.error(chalk38.dim(" Run this command from the agent directory"));
10484
- process.exit(1);
10485
- }
10486
- const agentName = result.agentName;
10487
- let composeId;
10488
- try {
10489
- const compose = await getComposeByName(agentName);
10490
- composeId = compose.id;
10491
- } catch {
10492
- console.error(chalk38.red(`\u2717 Agent not found: ${agentName}`));
10493
- console.error(chalk38.dim(" Make sure the agent is pushed first"));
10494
- process.exit(1);
10495
- }
10496
- await disableSchedule({ name, composeId });
10496
+ const resolved = await resolveScheduleByName(name);
10497
+ await disableSchedule({ name, composeId: resolved.composeId });
10497
10498
  console.log(chalk38.green(`\u2713 Disabled schedule ${chalk38.cyan(name)}`));
10498
10499
  } catch (error) {
10499
10500
  console.error(chalk38.red("\u2717 Failed to disable schedule"));
10500
10501
  if (error instanceof Error) {
10501
10502
  if (error.message.includes("Not authenticated")) {
10502
10503
  console.error(chalk38.dim(" Run: vm0 auth login"));
10504
+ } else if (error.message.toLowerCase().includes("not found")) {
10505
+ console.error(chalk38.dim(` Schedule "${nameArg}" not found`));
10506
+ console.error(chalk38.dim(" Run: vm0 schedule list"));
10503
10507
  } else {
10504
10508
  console.error(chalk38.dim(` ${error.message}`));
10505
10509
  }
@@ -10689,13 +10693,9 @@ import { Command as Command41 } from "commander";
10689
10693
  // src/commands/credential/list.ts
10690
10694
  import { Command as Command38 } from "commander";
10691
10695
  import chalk40 from "chalk";
10692
- var listCommand5 = new Command38().name("list").description("List all credentials").option("--json", "Output in JSON format").action(async (options) => {
10696
+ var listCommand5 = new Command38().name("list").alias("ls").description("List all credentials").action(async () => {
10693
10697
  try {
10694
10698
  const result = await listCredentials();
10695
- if (options.json) {
10696
- console.log(JSON.stringify(result.credentials, null, 2));
10697
- return;
10698
- }
10699
10699
  if (result.credentials.length === 0) {
10700
10700
  console.log(chalk40.dim("No credentials found."));
10701
10701
  console.log();
@@ -10970,6 +10970,9 @@ var setupCommand = new Command43().name("setup").description("Configure a model
10970
10970
  }
10971
10971
  }
10972
10972
  const config = MODEL_PROVIDER_TYPES[type];
10973
+ console.log();
10974
+ console.log(chalk44.dim(config.helpText));
10975
+ console.log();
10973
10976
  const credentialResponse = await prompts3(
10974
10977
  {
10975
10978
  type: "password",
@@ -11086,7 +11089,7 @@ var modelProviderCommand = new Command46().name("model-provider").description("M
11086
11089
 
11087
11090
  // src/index.ts
11088
11091
  var program = new Command47();
11089
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("6.3.0");
11092
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("6.4.0");
11090
11093
  program.command("info").description("Display environment information").action(async () => {
11091
11094
  console.log(chalk47.bold("System Information:"));
11092
11095
  console.log(`Node Version: ${process.version}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",