@vm0/cli 9.131.0 → 9.131.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/index.js CHANGED
@@ -65,7 +65,7 @@ import {
65
65
  source_default,
66
66
  volumeConfigSchema,
67
67
  withErrorHandler
68
- } from "./chunk-65M57PU6.js";
68
+ } from "./chunk-BS3XRRR3.js";
69
69
  import {
70
70
  __toESM,
71
71
  init_esm_shims
@@ -398,7 +398,7 @@ function getConfigPath() {
398
398
  return join(homedir(), ".vm0", "config.json");
399
399
  }
400
400
  var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
401
- console.log(source_default.bold(`VM0 CLI v${"9.131.0"}`));
401
+ console.log(source_default.bold(`VM0 CLI v${"9.131.1"}`));
402
402
  console.log();
403
403
  const config = await loadConfig();
404
404
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -495,29 +495,29 @@ var cliComposeSchema = external_exports.object({
495
495
  }
496
496
  }
497
497
  });
498
- function formatInvalidTypeIssue(path13, issue) {
498
+ function formatInvalidTypeIssue(path12, issue) {
499
499
  const received = issue.received;
500
500
  const isMissing = received === "undefined" || issue.message.includes("received undefined") || issue.message === "Required";
501
- if (path13 === "version" && isMissing) {
501
+ if (path12 === "version" && isMissing) {
502
502
  return "Missing config.version";
503
503
  }
504
- if (path13 === "agents" && isMissing) {
504
+ if (path12 === "agents" && isMissing) {
505
505
  return "Missing agents object in config";
506
506
  }
507
- if (path13.startsWith("volumes.") && path13.endsWith(".name")) {
508
- const volumeKey = path13.split(".")[1];
507
+ if (path12.startsWith("volumes.") && path12.endsWith(".name")) {
508
+ const volumeKey = path12.split(".")[1];
509
509
  return `Volume "${volumeKey}" must have a 'name' field (string)`;
510
510
  }
511
- if (path13.startsWith("volumes.") && path13.endsWith(".version")) {
512
- const volumeKey = path13.split(".")[1];
511
+ if (path12.startsWith("volumes.") && path12.endsWith(".version")) {
512
+ const volumeKey = path12.split(".")[1];
513
513
  return `Volume "${volumeKey}" must have a 'version' field (string)`;
514
514
  }
515
515
  if (issue.expected === "array") {
516
- const fieldName = path13.replace(/^agents\.[^.]+\./, "agent.");
516
+ const fieldName = path12.replace(/^agents\.[^.]+\./, "agent.");
517
517
  return `${fieldName} must be an array`;
518
518
  }
519
519
  if (issue.expected === "string" && received === "number") {
520
- const fieldName = path13.replace(/^agents\.[^.]+\./, "agent.");
520
+ const fieldName = path12.replace(/^agents\.[^.]+\./, "agent.");
521
521
  const match = fieldName.match(/^(agent\.[^.]+)\.\d+$/);
522
522
  if (match) {
523
523
  return `Each entry in ${match[1]?.replace("agent.", "")} must be a string`;
@@ -528,24 +528,24 @@ function formatInvalidTypeIssue(path13, issue) {
528
528
  function formatZodError(error) {
529
529
  const issue = error.issues[0];
530
530
  if (!issue) return "Validation failed";
531
- const path13 = issue.path.join(".");
531
+ const path12 = issue.path.join(".");
532
532
  const message = issue.message;
533
- if (!path13) return message;
533
+ if (!path12) return message;
534
534
  if (issue.code === "invalid_type") {
535
- const formatted = formatInvalidTypeIssue(path13, issue);
535
+ const formatted = formatInvalidTypeIssue(path12, issue);
536
536
  if (formatted) return formatted;
537
537
  }
538
- if (issue.code === "invalid_key" && path13.startsWith("agents.")) {
538
+ if (issue.code === "invalid_key" && path12.startsWith("agents.")) {
539
539
  return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
540
540
  }
541
- if (message === "Invalid key in record" && path13.startsWith("agents.")) {
541
+ if (message === "Invalid key in record" && path12.startsWith("agents.")) {
542
542
  return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
543
543
  }
544
544
  if (issue.code === "custom") {
545
545
  return message;
546
546
  }
547
- if (path13.startsWith("agents.")) {
548
- const cleanPath = path13.replace(/^agents\.[^.]+\./, "agent.");
547
+ if (path12.startsWith("agents.")) {
548
+ const cleanPath = path12.replace(/^agents\.[^.]+\./, "agent.");
549
549
  if (message.startsWith("Invalid input:")) {
550
550
  const match = message.match(/expected (\w+), received (\w+)/);
551
551
  if (match && match[1] === "string" && match[2] === "number") {
@@ -557,7 +557,7 @@ function formatZodError(error) {
557
557
  }
558
558
  return `${cleanPath}: ${message}`;
559
559
  }
560
- return `${path13}: ${message}`;
560
+ return `${path12}: ${message}`;
561
561
  }
562
562
  function validateAgentName(name) {
563
563
  return cliAgentNameSchema.safeParse(name).success;
@@ -4291,7 +4291,7 @@ var composeCommand = new Command().name("compose").description("Create or update
4291
4291
  options.autoUpdate = false;
4292
4292
  }
4293
4293
  if (options.autoUpdate !== false) {
4294
- await startSilentUpgrade("9.131.0");
4294
+ await startSilentUpgrade("9.131.1");
4295
4295
  }
4296
4296
  try {
4297
4297
  let result;
@@ -4358,7 +4358,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
4358
4358
  "Mount a volume (repeatable, format: name:/path or name:version:/path)",
4359
4359
  collectMounts,
4360
4360
  []
4361
- ).option("--memory <name>", "Memory storage name").option(
4361
+ ).option(
4362
4362
  "--conversation <id>",
4363
4363
  "Resume from conversation ID (for fine-grained control)"
4364
4364
  ).option(
@@ -4383,7 +4383,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
4383
4383
  withErrorHandler(
4384
4384
  async (identifier, prompt, options) => {
4385
4385
  if (options.autoUpdate !== false) {
4386
- await startSilentUpgrade("9.131.0");
4386
+ await startSilentUpgrade("9.131.1");
4387
4387
  }
4388
4388
  const { name, version } = parseIdentifier(identifier);
4389
4389
  let composeId;
@@ -4433,7 +4433,6 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
4433
4433
  vars,
4434
4434
  secrets,
4435
4435
  artifacts,
4436
- memoryName: options.memory,
4437
4436
  volumeVersions,
4438
4437
  additionalVolumes,
4439
4438
  conversationId: options.conversation,
@@ -4872,7 +4871,6 @@ import { existsSync as existsSync5 } from "fs";
4872
4871
  import path5 from "path";
4873
4872
  var CONFIG_DIR = ".vm0";
4874
4873
  var CONFIG_FILE = "storage.yaml";
4875
- var memoryTypeWarnedPaths = /* @__PURE__ */ new Set();
4876
4874
  function isValidStorageName(name) {
4877
4875
  if (name.length < 3 || name.length > 64) {
4878
4876
  return false;
@@ -4880,8 +4878,7 @@ function isValidStorageName(name) {
4880
4878
  const pattern = /^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/;
4881
4879
  return pattern.test(name) && !name.includes("--");
4882
4880
  }
4883
- async function readStorageConfig(basePath = process.cwd(), options = {}) {
4884
- const { normalizeMemoryToArtifact = true } = options;
4881
+ async function readStorageConfig(basePath = process.cwd()) {
4885
4882
  const configPath = path5.join(basePath, CONFIG_DIR, CONFIG_FILE);
4886
4883
  const legacyConfigPath = path5.join(basePath, CONFIG_DIR, "volume.yaml");
4887
4884
  let actualPath = null;
@@ -4898,16 +4895,6 @@ async function readStorageConfig(basePath = process.cwd(), options = {}) {
4898
4895
  if (!config.type) {
4899
4896
  config.type = "volume";
4900
4897
  }
4901
- if (config.type === "memory" && normalizeMemoryToArtifact) {
4902
- if (!memoryTypeWarnedPaths.has(actualPath)) {
4903
- memoryTypeWarnedPaths.add(actualPath);
4904
- process.stderr.write(
4905
- `warning: type: "memory" in ${actualPath} is deprecated; rewrite as type: "artifact" (removed in next major)
4906
- `
4907
- );
4908
- }
4909
- config.type = "artifact";
4910
- }
4911
4898
  return config;
4912
4899
  }
4913
4900
  async function writeStorageConfig(storageName, basePath = process.cwd(), type2 = "volume") {
@@ -5585,252 +5572,6 @@ var cloneCommand2 = new Command().name("clone").description("Clone a remote arti
5585
5572
  // src/commands/artifact/index.ts
5586
5573
  var artifactCommand = new Command().name("artifact").description("Manage artifacts (specified at run, versioned after run)").addCommand(initCommand2).addCommand(pushCommand2).addCommand(pullCommand2).addCommand(statusCommand3).addCommand(listCommand3).addCommand(cloneCommand2);
5587
5574
 
5588
- // src/commands/memory/index.ts
5589
- init_esm_shims();
5590
-
5591
- // src/commands/memory/init.ts
5592
- init_esm_shims();
5593
- import path11 from "path";
5594
- var initCommand3 = new Command().name("init").description("Initialize a memory in the current directory").option("-n, --name <name>", "Memory name (required in non-interactive mode)").action(
5595
- withErrorHandler(async (options) => {
5596
- const cwd = process.cwd();
5597
- const dirName = path11.basename(cwd);
5598
- const existingConfig = await readStorageConfig(cwd, {
5599
- normalizeMemoryToArtifact: false
5600
- });
5601
- if (existingConfig) {
5602
- if (existingConfig.type === "memory") {
5603
- console.log(
5604
- source_default.yellow(`Memory already initialized: ${existingConfig.name}`)
5605
- );
5606
- } else {
5607
- console.log(
5608
- source_default.yellow(
5609
- `Directory already initialized as ${existingConfig.type}: ${existingConfig.name}`
5610
- )
5611
- );
5612
- console.log(
5613
- source_default.dim(
5614
- " To change type, delete .vm0/storage.yaml and reinitialize"
5615
- )
5616
- );
5617
- }
5618
- console.log(
5619
- source_default.dim(`Config file: ${path11.join(cwd, ".vm0", "storage.yaml")}`)
5620
- );
5621
- return;
5622
- }
5623
- let memoryName;
5624
- if (options.name) {
5625
- memoryName = options.name;
5626
- } else if (!isInteractive()) {
5627
- throw new Error("--name flag is required in non-interactive mode", {
5628
- cause: new Error("Usage: vm0 memory init --name <memory-name>")
5629
- });
5630
- } else {
5631
- const defaultName = isValidStorageName(dirName) ? dirName : void 0;
5632
- const name = await promptText(
5633
- "Enter memory name",
5634
- defaultName,
5635
- (value) => {
5636
- if (!isValidStorageName(value)) {
5637
- return "Must be 3-64 characters, lowercase alphanumeric with hyphens";
5638
- }
5639
- return true;
5640
- }
5641
- );
5642
- if (name === void 0) {
5643
- console.log(source_default.dim("Cancelled"));
5644
- return;
5645
- }
5646
- memoryName = name;
5647
- }
5648
- if (!isValidStorageName(memoryName)) {
5649
- throw new Error(`Invalid memory name: "${memoryName}"`, {
5650
- cause: new Error(
5651
- "Memory names must be 3-64 characters, lowercase alphanumeric with hyphens"
5652
- )
5653
- });
5654
- }
5655
- await writeStorageConfig(memoryName, cwd, "memory");
5656
- console.log(source_default.green(`\u2713 Initialized memory: ${memoryName}`));
5657
- console.log(
5658
- source_default.dim(
5659
- ` Config saved to ${path11.join(cwd, ".vm0", "storage.yaml")}`
5660
- )
5661
- );
5662
- })
5663
- );
5664
-
5665
- // src/commands/memory/push.ts
5666
- init_esm_shims();
5667
- var pushCommand3 = new Command().name("push").description("Push local files to cloud memory").option(
5668
- "-f, --force",
5669
- "Force upload even if content unchanged (recreate archive)"
5670
- ).action(
5671
- withErrorHandler(async (options) => {
5672
- const cwd = process.cwd();
5673
- const config = await readStorageConfig(cwd, {
5674
- normalizeMemoryToArtifact: false
5675
- });
5676
- if (!config) {
5677
- throw new Error("No memory initialized in this directory", {
5678
- cause: new Error("Run: vm0 memory init")
5679
- });
5680
- }
5681
- if (config.type !== "memory") {
5682
- throw new Error(
5683
- `This directory is initialized as ${config.type === "artifact" ? "an artifact" : "a volume"}, not a memory`,
5684
- { cause: new Error(`Use: vm0 ${config.type} push`) }
5685
- );
5686
- }
5687
- console.log(`Pushing memory: ${config.name}`);
5688
- const result = await directUpload(config.name, "memory", cwd, {
5689
- onProgress: (message) => {
5690
- console.log(source_default.dim(message));
5691
- },
5692
- force: options.force
5693
- });
5694
- const shortVersion = result.versionId.slice(0, 8);
5695
- if (result.empty) {
5696
- console.log(source_default.dim("No files found (empty memory)"));
5697
- } else if (result.deduplicated) {
5698
- console.log(source_default.green("\u2713 Content unchanged (deduplicated)"));
5699
- } else {
5700
- console.log(source_default.green("\u2713 Upload complete"));
5701
- }
5702
- console.log(source_default.dim(` Version: ${shortVersion}`));
5703
- console.log(source_default.dim(` Files: ${result.fileCount.toLocaleString()}`));
5704
- console.log(source_default.dim(` Size: ${formatBytes(result.size)}`));
5705
- })
5706
- );
5707
-
5708
- // src/commands/memory/pull.ts
5709
- init_esm_shims();
5710
- var pullCommand3 = new Command().name("pull").description("Pull remote memory to local directory (latest version)").argument("[name]", "Memory name to pull", "memory").argument("[destination]", "Destination directory (default: memory name)").action(
5711
- withErrorHandler(async (name, destination) => {
5712
- const targetDir = destination || name;
5713
- console.log(`Pulling memory: ${name}`);
5714
- const result = await cloneStorage(name, "memory", targetDir);
5715
- console.log(source_default.green(`
5716
- \u2713 Successfully pulled memory: ${name}`));
5717
- console.log(source_default.dim(` Location: ${targetDir}/`));
5718
- console.log(source_default.dim(` Version: ${result.versionId.slice(0, 8)}`));
5719
- })
5720
- );
5721
-
5722
- // src/commands/memory/status.ts
5723
- init_esm_shims();
5724
- var statusCommand4 = new Command().name("status").description("Show status of cloud memory").action(
5725
- withErrorHandler(async () => {
5726
- const cwd = process.cwd();
5727
- const config = await readStorageConfig(cwd, {
5728
- normalizeMemoryToArtifact: false
5729
- });
5730
- if (!config) {
5731
- throw new Error("No memory initialized in this directory", {
5732
- cause: new Error("Run: vm0 memory init")
5733
- });
5734
- }
5735
- if (config.type !== "memory") {
5736
- throw new Error(
5737
- `This directory is initialized as ${config.type === "artifact" ? "an artifact" : "a volume"}, not a memory`,
5738
- { cause: new Error(`Use: vm0 ${config.type} status`) }
5739
- );
5740
- }
5741
- console.log(`Checking memory: ${config.name}`);
5742
- try {
5743
- const info = await getStorageDownload({
5744
- name: config.name,
5745
- type: "memory"
5746
- });
5747
- const shortVersion = info.versionId.slice(0, 8);
5748
- if ("empty" in info) {
5749
- console.log(source_default.green("\u2713 Found (empty)"));
5750
- console.log(source_default.dim(` Version: ${shortVersion}`));
5751
- } else {
5752
- console.log(source_default.green("\u2713 Found"));
5753
- console.log(source_default.dim(` Version: ${shortVersion}`));
5754
- console.log(source_default.dim(` Files: ${info.fileCount.toLocaleString()}`));
5755
- console.log(source_default.dim(` Size: ${formatBytes(info.size)}`));
5756
- }
5757
- } catch (error) {
5758
- if (error instanceof ApiRequestError && error.status === 404) {
5759
- throw new Error("Not found on remote", {
5760
- cause: new Error("Run: vm0 memory push")
5761
- });
5762
- }
5763
- throw error;
5764
- }
5765
- })
5766
- );
5767
-
5768
- // src/commands/memory/list.ts
5769
- init_esm_shims();
5770
- var listCommand4 = new Command().name("list").alias("ls").description("List all remote memory storages").action(
5771
- withErrorHandler(async () => {
5772
- const items = await listStorages({ type: "memory" });
5773
- if (items.length === 0) {
5774
- console.log(source_default.dim("No memory storages found"));
5775
- console.log(
5776
- source_default.dim(" Memory is created automatically on first agent run")
5777
- );
5778
- return;
5779
- }
5780
- const nameWidth = Math.max(
5781
- 4,
5782
- ...items.map((i) => {
5783
- return i.name.length;
5784
- })
5785
- );
5786
- const sizeWidth = Math.max(
5787
- 4,
5788
- ...items.map((i) => {
5789
- return formatBytes(i.size).length;
5790
- })
5791
- );
5792
- const filesWidth = Math.max(
5793
- 5,
5794
- ...items.map((i) => {
5795
- return i.fileCount.toString().length;
5796
- })
5797
- );
5798
- const header = [
5799
- "NAME".padEnd(nameWidth),
5800
- "SIZE".padStart(sizeWidth),
5801
- "FILES".padStart(filesWidth),
5802
- "UPDATED"
5803
- ].join(" ");
5804
- console.log(source_default.dim(header));
5805
- for (const item of items) {
5806
- const row = [
5807
- item.name.padEnd(nameWidth),
5808
- formatBytes(item.size).padStart(sizeWidth),
5809
- item.fileCount.toString().padStart(filesWidth),
5810
- formatRelativeTime(item.updatedAt)
5811
- ].join(" ");
5812
- console.log(row);
5813
- }
5814
- })
5815
- );
5816
-
5817
- // src/commands/memory/clone.ts
5818
- init_esm_shims();
5819
- var cloneCommand3 = new Command().name("clone").description("Clone a remote memory to local directory (latest version)").argument("<name>", "Memory name to clone").argument("[destination]", "Destination directory (default: memory name)").action(
5820
- withErrorHandler(async (name, destination) => {
5821
- const targetDir = destination || name;
5822
- console.log(`Cloning memory: ${name}`);
5823
- const result = await cloneStorage(name, "memory", targetDir);
5824
- console.log(source_default.green(`
5825
- \u2713 Successfully cloned memory: ${name}`));
5826
- console.log(source_default.dim(` Location: ${targetDir}/`));
5827
- console.log(source_default.dim(` Version: ${result.versionId.slice(0, 8)}`));
5828
- })
5829
- );
5830
-
5831
- // src/commands/memory/index.ts
5832
- var memoryCommand = new Command().name("memory").description("Manage agent long-term memory").addCommand(initCommand3).addCommand(pushCommand3).addCommand(pullCommand3).addCommand(statusCommand4).addCommand(listCommand4).addCommand(cloneCommand3);
5833
-
5834
5575
  // src/commands/logs/index.ts
5835
5576
  init_esm_shims();
5836
5577
 
@@ -6313,7 +6054,7 @@ async function showNetworkLogs(runId, options) {
6313
6054
 
6314
6055
  // src/commands/init/index.ts
6315
6056
  init_esm_shims();
6316
- import path12 from "path";
6057
+ import path11 from "path";
6317
6058
  import { existsSync as existsSync6 } from "fs";
6318
6059
  import { writeFile as writeFile4 } from "fs/promises";
6319
6060
  var VM0_YAML_FILE = "vm0.yaml";
@@ -6347,7 +6088,7 @@ function checkExistingFiles() {
6347
6088
  if (existsSync6(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
6348
6089
  return existingFiles;
6349
6090
  }
6350
- var initCommand4 = new Command().name("init").description("Initialize a new VM0 project in the current directory").option("-f, --force", "Overwrite existing files").option("-n, --name <name>", "Agent name (required in non-interactive mode)").action(
6091
+ var initCommand3 = new Command().name("init").description("Initialize a new VM0 project in the current directory").option("-f, --force", "Overwrite existing files").option("-n, --name <name>", "Agent name (required in non-interactive mode)").action(
6351
6092
  withErrorHandler(async (options) => {
6352
6093
  const existingFiles = checkExistingFiles();
6353
6094
  if (existingFiles.length > 0 && !options.force) {
@@ -6363,7 +6104,7 @@ var initCommand4 = new Command().name("init").description("Initialize a new VM0
6363
6104
  cause: new Error("Usage: vm0 init --name <agent-name>")
6364
6105
  });
6365
6106
  } else {
6366
- const dirName = path12.basename(process.cwd());
6107
+ const dirName = path11.basename(process.cwd());
6367
6108
  const defaultName = validateAgentName(dirName) ? dirName : void 0;
6368
6109
  const name = await promptText(
6369
6110
  "Enter agent name",
@@ -6415,13 +6156,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
6415
6156
  if (latestVersion === null) {
6416
6157
  throw new Error("Could not check for updates. Please try again later.");
6417
6158
  }
6418
- if (latestVersion === "9.131.0") {
6419
- console.log(source_default.green(`\u2713 Already up to date (${"9.131.0"})`));
6159
+ if (latestVersion === "9.131.1") {
6160
+ console.log(source_default.green(`\u2713 Already up to date (${"9.131.1"})`));
6420
6161
  return;
6421
6162
  }
6422
6163
  console.log(
6423
6164
  source_default.yellow(
6424
- `Current version: ${"9.131.0"} -> Latest version: ${latestVersion}`
6165
+ `Current version: ${"9.131.1"} -> Latest version: ${latestVersion}`
6425
6166
  )
6426
6167
  );
6427
6168
  console.log();
@@ -6448,7 +6189,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
6448
6189
  const success = await performUpgrade(packageManager);
6449
6190
  if (success) {
6450
6191
  console.log(
6451
- source_default.green(`\u2713 Upgraded from ${"9.131.0"} to ${latestVersion}`)
6192
+ source_default.green(`\u2713 Upgraded from ${"9.131.1"} to ${latestVersion}`)
6452
6193
  );
6453
6194
  return;
6454
6195
  }
@@ -6515,16 +6256,15 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
6515
6256
 
6516
6257
  // src/index.ts
6517
6258
  var program = new Command();
6518
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.131.0");
6259
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.131.1");
6519
6260
  program.addCommand(authCommand);
6520
6261
  program.addCommand(infoCommand);
6521
6262
  program.addCommand(composeCommand);
6522
6263
  program.addCommand(runCommand);
6523
6264
  program.addCommand(volumeCommand);
6524
6265
  program.addCommand(artifactCommand);
6525
- program.addCommand(memoryCommand);
6526
6266
  program.addCommand(logsCommand);
6527
- program.addCommand(initCommand4);
6267
+ program.addCommand(initCommand3);
6528
6268
  program.addCommand(upgradeCommand);
6529
6269
  program.addCommand(whoamiCommand);
6530
6270
  if (process.argv[1]?.endsWith("index.js") || process.argv[1]?.endsWith("index.ts") || process.argv[1]?.endsWith("vm0")) {