@vm0/cli 9.119.0 → 9.119.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
@@ -8,7 +8,6 @@ import {
8
8
  Command,
9
9
  EventRenderer,
10
10
  Option,
11
- __toESM,
12
11
  agentDefinitionSchema,
13
12
  cancelRun,
14
13
  clearConfig,
@@ -40,7 +39,6 @@ import {
40
39
  getStorageDownload,
41
40
  getSystemLog,
42
41
  getToken,
43
- init_esm_shims,
44
42
  isInteractive,
45
43
  isUUID,
46
44
  listRuns,
@@ -72,7 +70,11 @@ import {
72
70
  source_default,
73
71
  volumeConfigSchema,
74
72
  withErrorHandler
75
- } from "./chunk-BESNYOIM.js";
73
+ } from "./chunk-Y5MLJMUZ.js";
74
+ import {
75
+ __toESM,
76
+ init_esm_shims
77
+ } from "./chunk-BMCQ2T6Q.js";
76
78
 
77
79
  // src/index.ts
78
80
  init_esm_shims();
@@ -311,15 +313,6 @@ function getManualUpgradeCommand(pm) {
311
313
  return `npm install -g ${PACKAGE_NAME}@latest`;
312
314
  }
313
315
  }
314
- function escapeForShell(str) {
315
- return `'${str.replace(/'/g, "'\\''")}'`;
316
- }
317
- function buildRerunCommand(prompt) {
318
- if (prompt) {
319
- return `vm0 cook ${escapeForShell(prompt)}`;
320
- }
321
- return "vm0 cook";
322
- }
323
316
  async function getLatestVersion() {
324
317
  try {
325
318
  const controller = new AbortController();
@@ -353,61 +346,6 @@ function performUpgrade(packageManager) {
353
346
  });
354
347
  });
355
348
  }
356
- async function checkAndUpgrade(currentVersion, prompt) {
357
- const latestVersion = await getLatestVersion();
358
- if (latestVersion === null) {
359
- console.log(source_default.yellow("\u26A0 Could not check for updates"));
360
- console.log();
361
- return false;
362
- }
363
- if (latestVersion === currentVersion) {
364
- return false;
365
- }
366
- console.log(source_default.yellow("vm0 is currently in beta."));
367
- console.log(
368
- source_default.yellow(
369
- `Current version: ${currentVersion} -> Latest version: ${latestVersion}`
370
- )
371
- );
372
- console.log(
373
- source_default.yellow(
374
- "Please always use the latest version for best compatibility."
375
- )
376
- );
377
- console.log();
378
- const packageManager = detectPackageManager();
379
- if (!isAutoUpgradeSupported(packageManager)) {
380
- if (packageManager === "unknown") {
381
- console.log(
382
- source_default.yellow("Could not detect your package manager for auto-upgrade.")
383
- );
384
- } else {
385
- console.log(
386
- source_default.yellow(`Auto-upgrade is not supported for ${packageManager}.`)
387
- );
388
- }
389
- console.log(source_default.yellow("Please upgrade manually:"));
390
- console.log(source_default.cyan(` ${getManualUpgradeCommand(packageManager)}`));
391
- console.log();
392
- return false;
393
- }
394
- console.log(`Upgrading via ${packageManager}...`);
395
- const success = await performUpgrade(packageManager);
396
- if (success) {
397
- console.log(source_default.green(`Upgraded to ${latestVersion}`));
398
- console.log();
399
- console.log("To continue, run:");
400
- console.log(source_default.cyan(` ${buildRerunCommand(prompt)}`));
401
- return true;
402
- }
403
- console.error();
404
- console.error(source_default.red("\u2717 Upgrade failed. Please run manually:"));
405
- console.error(source_default.cyan(` ${getManualUpgradeCommand(packageManager)}`));
406
- console.error();
407
- console.error("Then re-run:");
408
- console.error(source_default.cyan(` ${buildRerunCommand(prompt)}`));
409
- return true;
410
- }
411
349
  async function startSilentUpgrade(currentVersion) {
412
350
  pendingUpgrade = null;
413
351
  const latestVersion = await getLatestVersion();
@@ -465,7 +403,7 @@ function getConfigPath() {
465
403
  return join(homedir(), ".vm0", "config.json");
466
404
  }
467
405
  var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
468
- console.log(source_default.bold(`VM0 CLI v${"9.119.0"}`));
406
+ console.log(source_default.bold(`VM0 CLI v${"9.119.1"}`));
469
407
  console.log();
470
408
  const config = await loadConfig();
471
409
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -582,29 +520,29 @@ var cliComposeSchema = external_exports.object({
582
520
  }
583
521
  }
584
522
  });
585
- function formatInvalidTypeIssue(path17, issue) {
523
+ function formatInvalidTypeIssue(path14, issue) {
586
524
  const received = issue.received;
587
525
  const isMissing = received === "undefined" || issue.message.includes("received undefined") || issue.message === "Required";
588
- if (path17 === "version" && isMissing) {
526
+ if (path14 === "version" && isMissing) {
589
527
  return "Missing config.version";
590
528
  }
591
- if (path17 === "agents" && isMissing) {
529
+ if (path14 === "agents" && isMissing) {
592
530
  return "Missing agents object in config";
593
531
  }
594
- if (path17.startsWith("volumes.") && path17.endsWith(".name")) {
595
- const volumeKey = path17.split(".")[1];
532
+ if (path14.startsWith("volumes.") && path14.endsWith(".name")) {
533
+ const volumeKey = path14.split(".")[1];
596
534
  return `Volume "${volumeKey}" must have a 'name' field (string)`;
597
535
  }
598
- if (path17.startsWith("volumes.") && path17.endsWith(".version")) {
599
- const volumeKey = path17.split(".")[1];
536
+ if (path14.startsWith("volumes.") && path14.endsWith(".version")) {
537
+ const volumeKey = path14.split(".")[1];
600
538
  return `Volume "${volumeKey}" must have a 'version' field (string)`;
601
539
  }
602
540
  if (issue.expected === "array") {
603
- const fieldName = path17.replace(/^agents\.[^.]+\./, "agent.");
541
+ const fieldName = path14.replace(/^agents\.[^.]+\./, "agent.");
604
542
  return `${fieldName} must be an array`;
605
543
  }
606
544
  if (issue.expected === "string" && received === "number") {
607
- const fieldName = path17.replace(/^agents\.[^.]+\./, "agent.");
545
+ const fieldName = path14.replace(/^agents\.[^.]+\./, "agent.");
608
546
  const match = fieldName.match(/^(agent\.[^.]+)\.\d+$/);
609
547
  if (match) {
610
548
  return `Each entry in ${match[1]?.replace("agent.", "")} must be a string`;
@@ -615,24 +553,24 @@ function formatInvalidTypeIssue(path17, issue) {
615
553
  function formatZodError(error) {
616
554
  const issue = error.issues[0];
617
555
  if (!issue) return "Validation failed";
618
- const path17 = issue.path.join(".");
556
+ const path14 = issue.path.join(".");
619
557
  const message = issue.message;
620
- if (!path17) return message;
558
+ if (!path14) return message;
621
559
  if (issue.code === "invalid_type") {
622
- const formatted = formatInvalidTypeIssue(path17, issue);
560
+ const formatted = formatInvalidTypeIssue(path14, issue);
623
561
  if (formatted) return formatted;
624
562
  }
625
- if (issue.code === "invalid_key" && path17.startsWith("agents.")) {
563
+ if (issue.code === "invalid_key" && path14.startsWith("agents.")) {
626
564
  return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
627
565
  }
628
- if (message === "Invalid key in record" && path17.startsWith("agents.")) {
566
+ if (message === "Invalid key in record" && path14.startsWith("agents.")) {
629
567
  return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
630
568
  }
631
569
  if (issue.code === "custom") {
632
570
  return message;
633
571
  }
634
- if (path17.startsWith("agents.")) {
635
- const cleanPath = path17.replace(/^agents\.[^.]+\./, "agent.");
572
+ if (path14.startsWith("agents.")) {
573
+ const cleanPath = path14.replace(/^agents\.[^.]+\./, "agent.");
636
574
  if (message.startsWith("Invalid input:")) {
637
575
  const match = message.match(/expected (\w+), received (\w+)/);
638
576
  if (match && match[1] === "string" && match[2] === "number") {
@@ -644,7 +582,7 @@ function formatZodError(error) {
644
582
  }
645
583
  return `${cleanPath}: ${message}`;
646
584
  }
647
- return `${path17}: ${message}`;
585
+ return `${path14}: ${message}`;
648
586
  }
649
587
  function validateAgentName(name) {
650
588
  return cliAgentNameSchema.safeParse(name).success;
@@ -4494,7 +4432,7 @@ var composeCommand = new Command().name("compose").description("Create or update
4494
4432
  options.autoUpdate = false;
4495
4433
  }
4496
4434
  if (options.autoUpdate !== false) {
4497
- await startSilentUpgrade("9.119.0");
4435
+ await startSilentUpgrade("9.119.1");
4498
4436
  }
4499
4437
  try {
4500
4438
  let result;
@@ -4579,7 +4517,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
4579
4517
  withErrorHandler(
4580
4518
  async (identifier, prompt, options) => {
4581
4519
  if (options.autoUpdate !== false) {
4582
- await startSilentUpgrade("9.119.0");
4520
+ await startSilentUpgrade("9.119.1");
4583
4521
  }
4584
4522
  const { name, version } = parseIdentifier(identifier);
4585
4523
  let composeId;
@@ -6010,530 +5948,6 @@ var cloneCommand3 = new Command().name("clone").description("Clone a remote memo
6010
5948
  // src/commands/memory/index.ts
6011
5949
  var memoryCommand = new Command().name("memory").description("Manage agent long-term memory").addCommand(initCommand3).addCommand(pushCommand3).addCommand(pullCommand3).addCommand(statusCommand4).addCommand(listCommand4).addCommand(cloneCommand3);
6012
5950
 
6013
- // src/commands/cook/index.ts
6014
- init_esm_shims();
6015
-
6016
- // src/commands/cook/cook.ts
6017
- init_esm_shims();
6018
- var import_yaml3 = __toESM(require_dist(), 1);
6019
- import { readFile as readFile6, mkdir as mkdir5 } from "fs/promises";
6020
- import { existsSync as existsSync8 } from "fs";
6021
- import path13 from "path";
6022
-
6023
- // src/lib/domain/cook-state.ts
6024
- init_esm_shims();
6025
- import { homedir as homedir2 } from "os";
6026
- import { join as join8 } from "path";
6027
- import { readFile as readFile5, writeFile as writeFile4, mkdir as mkdir4 } from "fs/promises";
6028
- import { existsSync as existsSync6 } from "fs";
6029
- var CONFIG_DIR2 = join8(homedir2(), ".vm0");
6030
- var COOK_STATE_FILE = join8(CONFIG_DIR2, "cook.json");
6031
- var STALE_THRESHOLD_MS = 48 * 60 * 60 * 1e3;
6032
- async function loadCookStateFile() {
6033
- if (!existsSync6(COOK_STATE_FILE)) {
6034
- return { ppid: {} };
6035
- }
6036
- try {
6037
- const content = await readFile5(COOK_STATE_FILE, "utf8");
6038
- const data = JSON.parse(content);
6039
- if (!data.ppid) {
6040
- const oldState = data;
6041
- return {
6042
- ppid: {
6043
- [String(process.ppid)]: {
6044
- lastRunId: oldState.lastRunId,
6045
- lastSessionId: oldState.lastSessionId,
6046
- lastCheckpointId: oldState.lastCheckpointId,
6047
- lastActiveAt: Date.now()
6048
- }
6049
- }
6050
- };
6051
- }
6052
- return data;
6053
- } catch {
6054
- return { ppid: {} };
6055
- }
6056
- }
6057
- async function loadCookState() {
6058
- const file = await loadCookStateFile();
6059
- const ppid = String(process.ppid);
6060
- const entry = file.ppid[ppid];
6061
- if (!entry) return {};
6062
- return {
6063
- lastRunId: entry.lastRunId,
6064
- lastSessionId: entry.lastSessionId,
6065
- lastCheckpointId: entry.lastCheckpointId
6066
- };
6067
- }
6068
- async function saveCookState(state) {
6069
- await mkdir4(CONFIG_DIR2, { recursive: true });
6070
- const file = await loadCookStateFile();
6071
- const ppid = String(process.ppid);
6072
- const now = Date.now();
6073
- for (const key of Object.keys(file.ppid)) {
6074
- const entry = file.ppid[key];
6075
- if (entry && now - entry.lastActiveAt > STALE_THRESHOLD_MS) {
6076
- delete file.ppid[key];
6077
- }
6078
- }
6079
- const existing = file.ppid[ppid];
6080
- file.ppid[ppid] = {
6081
- lastRunId: state.lastRunId ?? existing?.lastRunId,
6082
- lastSessionId: state.lastSessionId ?? existing?.lastSessionId,
6083
- lastCheckpointId: state.lastCheckpointId ?? existing?.lastCheckpointId,
6084
- lastActiveAt: now
6085
- };
6086
- await writeFile4(COOK_STATE_FILE, JSON.stringify(file, null, 2), "utf8");
6087
- }
6088
-
6089
- // src/commands/cook/utils.ts
6090
- init_esm_shims();
6091
- import { existsSync as existsSync7 } from "fs";
6092
- var CONFIG_FILE2 = "vm0.yaml";
6093
- var ARTIFACT_DIR = "artifact";
6094
- function printCommand(cmd) {
6095
- console.log(source_default.dim(`> ${cmd}`));
6096
- }
6097
- function execVm0Command(args, options = {}) {
6098
- return new Promise((resolve, reject) => {
6099
- const stdio = options.silent ? "pipe" : "inherit";
6100
- const proc = safeSpawn("vm0", args, {
6101
- cwd: options.cwd,
6102
- stdio
6103
- });
6104
- let stdout = "";
6105
- let stderr = "";
6106
- if (options.silent) {
6107
- proc.stdout?.on("data", (data) => {
6108
- stdout += data.toString();
6109
- });
6110
- proc.stderr?.on("data", (data) => {
6111
- stderr += data.toString();
6112
- });
6113
- }
6114
- proc.on("close", (code) => {
6115
- if (code === 0) {
6116
- resolve(stdout);
6117
- } else {
6118
- reject(new Error(stderr || `Command failed with exit code ${code}`));
6119
- }
6120
- });
6121
- proc.on("error", (err) => {
6122
- reject(err);
6123
- });
6124
- });
6125
- }
6126
- function execVm0RunWithCapture(args, options = {}) {
6127
- return new Promise((resolve, reject) => {
6128
- const env = process.stdout.isTTY ? { ...process.env, FORCE_COLOR: "1" } : process.env;
6129
- const proc = safeSpawn("vm0", args, {
6130
- cwd: options.cwd,
6131
- env,
6132
- stdio: ["inherit", "pipe", "pipe"]
6133
- });
6134
- let stdout = "";
6135
- let stderr = "";
6136
- proc.stdout?.on("data", (data) => {
6137
- const chunk = data.toString();
6138
- stdout += chunk;
6139
- process.stdout.write(chunk);
6140
- });
6141
- proc.stderr?.on("data", (data) => {
6142
- const chunk = data.toString();
6143
- stderr += chunk;
6144
- process.stderr.write(chunk);
6145
- });
6146
- proc.on("close", (code) => {
6147
- if (code === 0) {
6148
- resolve(stdout);
6149
- } else {
6150
- reject(new Error(stderr || `Command failed with exit code ${code}`));
6151
- }
6152
- });
6153
- proc.on("error", (err) => {
6154
- reject(err);
6155
- });
6156
- });
6157
- }
6158
- function parseArtifactVersionFromCompletion(output, artifactName) {
6159
- const completionMarker = "Run completed successfully";
6160
- const completionIndex = output.indexOf(completionMarker);
6161
- if (completionIndex === -1) return null;
6162
- const section = output.slice(completionIndex);
6163
- const artifactPattern = new RegExp(
6164
- `^\\s*${escapeRegExp(artifactName)}:\\s*(?:\\x1b\\[[0-9;]*m)?([a-f0-9]+)`,
6165
- "m"
6166
- );
6167
- const match = section.match(artifactPattern);
6168
- return match ? match[1] : null;
6169
- }
6170
- function escapeRegExp(str) {
6171
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6172
- }
6173
- function parseRunIdsFromOutput(output) {
6174
- const completionMarker = "Run completed successfully";
6175
- const completionIndex = output.indexOf(completionMarker);
6176
- if (completionIndex === -1) return {};
6177
- const section = output.slice(completionIndex);
6178
- const ESC = String.fromCharCode(27);
6179
- const ansiPattern = new RegExp(`${ESC}\\[[0-9;]*m`, "g");
6180
- const stripped = section.replace(ansiPattern, "");
6181
- return {
6182
- runId: stripped.match(/vm0 logs ([0-9a-f-]{36})/)?.[1],
6183
- sessionId: stripped.match(/vm0 run continue ([0-9a-f-]{36})/)?.[1],
6184
- checkpointId: stripped.match(/vm0 run resume ([0-9a-f-]{36})/)?.[1]
6185
- };
6186
- }
6187
- async function autoPullArtifact(runOutput, artifactDir) {
6188
- const serverVersion = parseArtifactVersionFromCompletion(
6189
- runOutput,
6190
- ARTIFACT_DIR
6191
- );
6192
- if (serverVersion && existsSync7(artifactDir)) {
6193
- console.log();
6194
- console.log(source_default.bold("Pulling updated artifact:"));
6195
- printCommand(`cd ${ARTIFACT_DIR}`);
6196
- printCommand(`vm0 artifact pull ${serverVersion}`);
6197
- try {
6198
- await execVm0Command(["artifact", "pull", serverVersion], {
6199
- cwd: artifactDir,
6200
- silent: true
6201
- });
6202
- printCommand("cd ..");
6203
- } catch (error) {
6204
- console.error(source_default.red(`\u2717 Artifact pull failed`));
6205
- if (error instanceof Error) {
6206
- console.error(source_default.dim(` ${error.message}`));
6207
- }
6208
- }
6209
- }
6210
- }
6211
-
6212
- // src/commands/cook/cook.ts
6213
- async function loadAndValidateConfig2() {
6214
- console.log(source_default.bold(`Reading config: ${CONFIG_FILE2}`));
6215
- if (!existsSync8(CONFIG_FILE2)) {
6216
- throw new Error(`Config file not found: ${CONFIG_FILE2}`);
6217
- }
6218
- let config;
6219
- try {
6220
- const content = await readFile6(CONFIG_FILE2, "utf8");
6221
- config = (0, import_yaml3.parse)(content);
6222
- } catch (error) {
6223
- if (error instanceof Error) {
6224
- throw new Error("Invalid YAML format", { cause: error });
6225
- }
6226
- throw new Error("Invalid YAML format");
6227
- }
6228
- const validation = validateAgentCompose(config);
6229
- if (!validation.valid) {
6230
- throw new Error(validation.error);
6231
- }
6232
- const agentNames = Object.keys(config.agents);
6233
- const agentName = agentNames[0];
6234
- const volumeCount = config.volumes ? Object.keys(config.volumes).length : 0;
6235
- console.log(
6236
- source_default.green(`\u2713 Config validated: 1 agent, ${volumeCount} volume(s)`)
6237
- );
6238
- return { config, agentName, volumeCount };
6239
- }
6240
- async function processVolumes(config, cwd) {
6241
- if (!config.volumes || Object.keys(config.volumes).length === 0) {
6242
- return;
6243
- }
6244
- console.log();
6245
- console.log(source_default.bold("Processing volumes:"));
6246
- for (const volumeConfig of Object.values(config.volumes)) {
6247
- const volumeDir = path13.join(cwd, volumeConfig.name);
6248
- if (!existsSync8(volumeDir)) {
6249
- throw new Error(`Directory not found: ${volumeConfig.name}`, {
6250
- cause: new Error("Create the directory and add files first")
6251
- });
6252
- }
6253
- try {
6254
- printCommand(`cd ${volumeConfig.name}`);
6255
- const existingConfig = await readStorageConfig(volumeDir);
6256
- if (!existingConfig) {
6257
- printCommand(`vm0 volume init --name ${volumeConfig.name}`);
6258
- await execVm0Command(["volume", "init", "--name", volumeConfig.name], {
6259
- cwd: volumeDir,
6260
- silent: true
6261
- });
6262
- }
6263
- printCommand("vm0 volume push");
6264
- await execVm0Command(["volume", "push"], {
6265
- cwd: volumeDir,
6266
- silent: true
6267
- });
6268
- printCommand("cd ..");
6269
- } catch (error) {
6270
- if (error instanceof Error) {
6271
- throw new Error("Volume processing failed", { cause: error });
6272
- }
6273
- throw error;
6274
- }
6275
- }
6276
- }
6277
- async function processArtifact(cwd) {
6278
- console.log();
6279
- console.log(source_default.bold("Processing artifact:"));
6280
- const artifactDir = path13.join(cwd, ARTIFACT_DIR);
6281
- try {
6282
- if (!existsSync8(artifactDir)) {
6283
- printCommand(`mkdir ${ARTIFACT_DIR}`);
6284
- await mkdir5(artifactDir, { recursive: true });
6285
- }
6286
- printCommand(`cd ${ARTIFACT_DIR}`);
6287
- const existingConfig = await readStorageConfig(artifactDir);
6288
- if (!existingConfig) {
6289
- printCommand(`vm0 artifact init --name ${ARTIFACT_DIR}`);
6290
- await execVm0Command(["artifact", "init", "--name", ARTIFACT_DIR], {
6291
- cwd: artifactDir,
6292
- silent: true
6293
- });
6294
- }
6295
- printCommand("vm0 artifact push");
6296
- await execVm0Command(["artifact", "push"], {
6297
- cwd: artifactDir,
6298
- silent: true
6299
- });
6300
- printCommand("cd ..");
6301
- } catch (error) {
6302
- if (error instanceof Error) {
6303
- throw new Error("Artifact processing failed", { cause: error });
6304
- }
6305
- throw error;
6306
- }
6307
- return artifactDir;
6308
- }
6309
- async function composeAgent(cwd, skipConfirm) {
6310
- console.log();
6311
- console.log(source_default.bold("Composing agent:"));
6312
- const composeArgs = skipConfirm ? ["compose", "--yes", CONFIG_FILE2] : ["compose", CONFIG_FILE2];
6313
- printCommand(`vm0 ${composeArgs.join(" ")}`);
6314
- try {
6315
- await execVm0Command(composeArgs, { cwd });
6316
- } catch (error) {
6317
- if (error instanceof Error) {
6318
- throw new Error("Compose failed", { cause: error });
6319
- }
6320
- throw error;
6321
- }
6322
- }
6323
- async function runAgent(agentName, artifactDir, prompt, cwd, options) {
6324
- console.log();
6325
- console.log(source_default.bold("Running agent:"));
6326
- printCommand(`vm0 run ${agentName} --artifact ${ARTIFACT_DIR} "${prompt}"`);
6327
- console.log();
6328
- const runArgs = [
6329
- "run",
6330
- agentName,
6331
- "--artifact",
6332
- ARTIFACT_DIR,
6333
- ...options.envFile ? ["--env-file", options.envFile] : [],
6334
- ...options.verbose ? ["--verbose"] : [],
6335
- ...options.debugNoMockClaude ? ["--debug-no-mock-claude"] : [],
6336
- prompt
6337
- ];
6338
- const runOutput = await execVm0RunWithCapture(runArgs, { cwd });
6339
- const runIds = parseRunIdsFromOutput(runOutput);
6340
- if (runIds.runId || runIds.sessionId || runIds.checkpointId) {
6341
- await saveCookState({
6342
- lastRunId: runIds.runId,
6343
- lastSessionId: runIds.sessionId,
6344
- lastCheckpointId: runIds.checkpointId
6345
- });
6346
- }
6347
- await autoPullArtifact(runOutput, artifactDir);
6348
- }
6349
- var cookAction = new Command().name("cook").description("Quick start: prepare, compose and run agent from vm0.yaml").argument("[prompt]", "Prompt for the agent").option(
6350
- "--env-file <path>",
6351
- "Load environment variables from file (priority: CLI flags > file > env vars)"
6352
- ).option("-y, --yes", "Skip confirmation prompts").option("-v, --verbose", "Show full tool inputs and outputs").addOption(new Option("--debug-no-mock-claude").hideHelp()).addOption(new Option("--no-auto-update").hideHelp()).action(
6353
- withErrorHandler(
6354
- async (prompt, options) => {
6355
- if (options.autoUpdate !== false) {
6356
- const shouldExit = await checkAndUpgrade("9.119.0", prompt);
6357
- if (shouldExit) {
6358
- process.exit(0);
6359
- }
6360
- }
6361
- const cwd = process.cwd();
6362
- const { config, agentName } = await loadAndValidateConfig2();
6363
- await processVolumes(config, cwd);
6364
- const artifactDir = await processArtifact(cwd);
6365
- await composeAgent(cwd, options.yes ?? false);
6366
- if (prompt) {
6367
- await runAgent(agentName, artifactDir, prompt, cwd, {
6368
- envFile: options.envFile,
6369
- verbose: options.verbose,
6370
- debugNoMockClaude: options.debugNoMockClaude
6371
- });
6372
- } else {
6373
- console.log();
6374
- console.log("To run your agent:");
6375
- printCommand(
6376
- `vm0 run ${agentName} --artifact ${ARTIFACT_DIR} "your prompt"`
6377
- );
6378
- }
6379
- }
6380
- )
6381
- );
6382
-
6383
- // src/commands/cook/logs.ts
6384
- init_esm_shims();
6385
- var logsCommand = new Command().name("logs").description("View logs from the last cook run").option("-a, --agent", "Show agent events (default)").option("-s, --system", "Show system log").option("-m, --metrics", "Show metrics").option("-n, --network", "Show network logs (proxy traffic)").option(
6386
- "--since <time>",
6387
- "Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z)"
6388
- ).option("--tail <n>", "Show last N entries (default: 5, max: 100)").option("--head <n>", "Show first N entries (max: 100)").action(
6389
- withErrorHandler(
6390
- async (options) => {
6391
- const state = await loadCookState();
6392
- if (!state.lastRunId) {
6393
- throw new Error("No previous run found", {
6394
- cause: new Error("Run 'vm0 cook <prompt>' first")
6395
- });
6396
- }
6397
- const args = ["logs", state.lastRunId];
6398
- const displayArgs = [`vm0 logs ${state.lastRunId}`];
6399
- if (options.agent) {
6400
- args.push("--agent");
6401
- displayArgs.push("--agent");
6402
- }
6403
- if (options.system) {
6404
- args.push("--system");
6405
- displayArgs.push("--system");
6406
- }
6407
- if (options.metrics) {
6408
- args.push("--metrics");
6409
- displayArgs.push("--metrics");
6410
- }
6411
- if (options.network) {
6412
- args.push("--network");
6413
- displayArgs.push("--network");
6414
- }
6415
- if (options.since) {
6416
- args.push("--since", options.since);
6417
- displayArgs.push(`--since ${options.since}`);
6418
- }
6419
- if (options.tail) {
6420
- args.push("--tail", options.tail);
6421
- displayArgs.push(`--tail ${options.tail}`);
6422
- }
6423
- if (options.head) {
6424
- args.push("--head", options.head);
6425
- displayArgs.push(`--head ${options.head}`);
6426
- }
6427
- printCommand(displayArgs.join(" "));
6428
- await execVm0Command(args);
6429
- }
6430
- )
6431
- );
6432
-
6433
- // src/commands/cook/continue.ts
6434
- init_esm_shims();
6435
- import path14 from "path";
6436
- var continueCommand2 = new Command().name("continue").description(
6437
- "Continue from the last session (latest conversation and artifact)"
6438
- ).argument("<prompt>", "Prompt for the continued agent").option(
6439
- "--env-file <path>",
6440
- "Load environment variables from file (priority: CLI flags > file > env vars)"
6441
- ).option("-v, --verbose", "Show full tool inputs and outputs").addOption(new Option("--debug-no-mock-claude").hideHelp()).action(
6442
- withErrorHandler(
6443
- async (prompt, options) => {
6444
- const state = await loadCookState();
6445
- if (!state.lastSessionId) {
6446
- throw new Error("No previous session found", {
6447
- cause: new Error("Run 'vm0 cook <prompt>' first")
6448
- });
6449
- }
6450
- const cwd = process.cwd();
6451
- const artifactDir = path14.join(cwd, ARTIFACT_DIR);
6452
- const envFileArg = options.envFile ? ` --env-file ${options.envFile}` : "";
6453
- printCommand(
6454
- `vm0 run continue${envFileArg} ${state.lastSessionId} "${prompt}"`
6455
- );
6456
- console.log();
6457
- const runOutput = await execVm0RunWithCapture(
6458
- [
6459
- "run",
6460
- "continue",
6461
- ...options.envFile ? ["--env-file", options.envFile] : [],
6462
- ...options.verbose ? ["--verbose"] : [],
6463
- state.lastSessionId,
6464
- ...options.debugNoMockClaude ? ["--debug-no-mock-claude"] : [],
6465
- prompt
6466
- ],
6467
- { cwd }
6468
- );
6469
- const newIds = parseRunIdsFromOutput(runOutput);
6470
- if (newIds.runId || newIds.sessionId || newIds.checkpointId) {
6471
- await saveCookState({
6472
- lastRunId: newIds.runId,
6473
- lastSessionId: newIds.sessionId,
6474
- lastCheckpointId: newIds.checkpointId
6475
- });
6476
- }
6477
- await autoPullArtifact(runOutput, artifactDir);
6478
- }
6479
- )
6480
- );
6481
-
6482
- // src/commands/cook/resume.ts
6483
- init_esm_shims();
6484
- import path15 from "path";
6485
- var resumeCommand2 = new Command().name("resume").description(
6486
- "Resume from the last checkpoint (snapshotted conversation and artifact)"
6487
- ).argument("<prompt>", "Prompt for the resumed agent").option(
6488
- "--env-file <path>",
6489
- "Load environment variables from file (priority: CLI flags > file > env vars)"
6490
- ).option("-v, --verbose", "Show full tool inputs and outputs").addOption(new Option("--debug-no-mock-claude").hideHelp()).action(
6491
- withErrorHandler(
6492
- async (prompt, options) => {
6493
- const state = await loadCookState();
6494
- if (!state.lastCheckpointId) {
6495
- throw new Error("No previous checkpoint found", {
6496
- cause: new Error("Run 'vm0 cook <prompt>' first")
6497
- });
6498
- }
6499
- const cwd = process.cwd();
6500
- const artifactDir = path15.join(cwd, ARTIFACT_DIR);
6501
- const envFileArg = options.envFile ? ` --env-file ${options.envFile}` : "";
6502
- printCommand(
6503
- `vm0 run resume${envFileArg} ${state.lastCheckpointId} "${prompt}"`
6504
- );
6505
- console.log();
6506
- const runOutput = await execVm0RunWithCapture(
6507
- [
6508
- "run",
6509
- "resume",
6510
- ...options.envFile ? ["--env-file", options.envFile] : [],
6511
- ...options.verbose ? ["--verbose"] : [],
6512
- state.lastCheckpointId,
6513
- ...options.debugNoMockClaude ? ["--debug-no-mock-claude"] : [],
6514
- prompt
6515
- ],
6516
- { cwd }
6517
- );
6518
- const newIds = parseRunIdsFromOutput(runOutput);
6519
- if (newIds.runId || newIds.sessionId || newIds.checkpointId) {
6520
- await saveCookState({
6521
- lastRunId: newIds.runId,
6522
- lastSessionId: newIds.sessionId,
6523
- lastCheckpointId: newIds.checkpointId
6524
- });
6525
- }
6526
- await autoPullArtifact(runOutput, artifactDir);
6527
- }
6528
- )
6529
- );
6530
-
6531
- // src/commands/cook/index.ts
6532
- cookAction.addCommand(logsCommand);
6533
- cookAction.addCommand(continueCommand2);
6534
- cookAction.addCommand(resumeCommand2);
6535
- var cookCommand = cookAction;
6536
-
6537
5951
  // src/commands/logs/index.ts
6538
5952
  init_esm_shims();
6539
5953
 
@@ -6806,14 +6220,14 @@ function getLogType(options) {
6806
6220
  if (options.network) return "network";
6807
6221
  return "agent";
6808
6222
  }
6809
- var logsCommand2 = new Command().name("logs").description("View and search agent run logs").argument("[runId]", "Run ID to fetch logs for").addCommand(searchCommand).option("-a, --agent", "Show agent events (default)").option("-s, --system", "Show system log").option("-m, --metrics", "Show metrics").option("-n, --network", "Show network logs (proxy traffic)").option(
6223
+ var logsCommand = new Command().name("logs").description("View and search agent run logs").argument("[runId]", "Run ID to fetch logs for").addCommand(searchCommand).option("-a, --agent", "Show agent events (default)").option("-s, --system", "Show system log").option("-m, --metrics", "Show metrics").option("-n, --network", "Show network logs (proxy traffic)").option(
6810
6224
  "--since <time>",
6811
6225
  "Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z, 1705312200)"
6812
6226
  ).option("--tail <n>", "Show last N entries (default: 5)").option("--head <n>", "Show first N entries").option("--all", "Fetch all log entries").action(
6813
6227
  withErrorHandler(
6814
6228
  async (runId, options) => {
6815
6229
  if (!runId) {
6816
- logsCommand2.help();
6230
+ logsCommand.help();
6817
6231
  return;
6818
6232
  }
6819
6233
  const logType = getLogType(options);
@@ -7013,9 +6427,9 @@ async function showNetworkLogs(runId, options) {
7013
6427
 
7014
6428
  // src/commands/init/index.ts
7015
6429
  init_esm_shims();
7016
- import path16 from "path";
7017
- import { existsSync as existsSync9 } from "fs";
7018
- import { writeFile as writeFile5 } from "fs/promises";
6430
+ import path13 from "path";
6431
+ import { existsSync as existsSync6 } from "fs";
6432
+ import { writeFile as writeFile4 } from "fs/promises";
7019
6433
  var VM0_YAML_FILE = "vm0.yaml";
7020
6434
  var AGENTS_MD_FILE = "AGENTS.md";
7021
6435
  function generateVm0Yaml(agentName) {
@@ -7046,8 +6460,8 @@ You are a HackerNews AI content curator.
7046
6460
  }
7047
6461
  function checkExistingFiles() {
7048
6462
  const existingFiles = [];
7049
- if (existsSync9(VM0_YAML_FILE)) existingFiles.push(VM0_YAML_FILE);
7050
- if (existsSync9(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
6463
+ if (existsSync6(VM0_YAML_FILE)) existingFiles.push(VM0_YAML_FILE);
6464
+ if (existsSync6(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
7051
6465
  return existingFiles;
7052
6466
  }
7053
6467
  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(
@@ -7066,7 +6480,7 @@ var initCommand4 = new Command().name("init").description("Initialize a new VM0
7066
6480
  cause: new Error("Usage: vm0 init --name <agent-name>")
7067
6481
  });
7068
6482
  } else {
7069
- const dirName = path16.basename(process.cwd());
6483
+ const dirName = path13.basename(process.cwd());
7070
6484
  const defaultName = validateAgentName(dirName) ? dirName : void 0;
7071
6485
  const name = await promptText(
7072
6486
  "Enter agent name",
@@ -7091,22 +6505,20 @@ var initCommand4 = new Command().name("init").description("Initialize a new VM0
7091
6505
  )
7092
6506
  });
7093
6507
  }
7094
- await writeFile5(VM0_YAML_FILE, generateVm0Yaml(agentName));
6508
+ await writeFile4(VM0_YAML_FILE, generateVm0Yaml(agentName));
7095
6509
  const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
7096
6510
  console.log(source_default.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
7097
- await writeFile5(AGENTS_MD_FILE, generateAgentsMd());
6511
+ await writeFile4(AGENTS_MD_FILE, generateAgentsMd());
7098
6512
  const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
7099
6513
  console.log(source_default.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
7100
6514
  console.log();
7101
6515
  console.log("Next steps:");
7102
- console.log(
7103
- ` 1. Set up model provider (one-time): ${source_default.cyan("zero org model-provider setup")}`
7104
- );
6516
+ console.log(` 1. Log in to VM0: ${source_default.cyan("vm0 auth login")}`);
7105
6517
  console.log(
7106
6518
  ` 2. Edit ${source_default.cyan("AGENTS.md")} to customize your agent's workflow`
7107
6519
  );
7108
6520
  console.log(
7109
- ` 3. Run your agent: ${source_default.cyan(`vm0 cook "let's start working"`)}`
6521
+ ` 3. Run your agent: ${source_default.cyan(`vm0 run --secrets CLAUDE_CODE_OAUTH_TOKEN=<token> "let's start working"`)}`
7110
6522
  );
7111
6523
  })
7112
6524
  );
@@ -7120,13 +6532,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
7120
6532
  if (latestVersion === null) {
7121
6533
  throw new Error("Could not check for updates. Please try again later.");
7122
6534
  }
7123
- if (latestVersion === "9.119.0") {
7124
- console.log(source_default.green(`\u2713 Already up to date (${"9.119.0"})`));
6535
+ if (latestVersion === "9.119.1") {
6536
+ console.log(source_default.green(`\u2713 Already up to date (${"9.119.1"})`));
7125
6537
  return;
7126
6538
  }
7127
6539
  console.log(
7128
6540
  source_default.yellow(
7129
- `Current version: ${"9.119.0"} -> Latest version: ${latestVersion}`
6541
+ `Current version: ${"9.119.1"} -> Latest version: ${latestVersion}`
7130
6542
  )
7131
6543
  );
7132
6544
  console.log();
@@ -7153,7 +6565,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
7153
6565
  const success = await performUpgrade(packageManager);
7154
6566
  if (success) {
7155
6567
  console.log(
7156
- source_default.green(`\u2713 Upgraded from ${"9.119.0"} to ${latestVersion}`)
6568
+ source_default.green(`\u2713 Upgraded from ${"9.119.1"} to ${latestVersion}`)
7157
6569
  );
7158
6570
  return;
7159
6571
  }
@@ -7220,7 +6632,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
7220
6632
 
7221
6633
  // src/index.ts
7222
6634
  var program = new Command();
7223
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.119.0");
6635
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.119.1");
7224
6636
  program.addCommand(authCommand);
7225
6637
  program.addCommand(infoCommand);
7226
6638
  program.addCommand(composeCommand);
@@ -7228,8 +6640,7 @@ program.addCommand(runCommand);
7228
6640
  program.addCommand(volumeCommand);
7229
6641
  program.addCommand(artifactCommand);
7230
6642
  program.addCommand(memoryCommand);
7231
- program.addCommand(cookCommand);
7232
- program.addCommand(logsCommand2);
6643
+ program.addCommand(logsCommand);
7233
6644
  program.addCommand(initCommand4);
7234
6645
  program.addCommand(upgradeCommand);
7235
6646
  program.addCommand(whoamiCommand);