@vm0/cli 9.244.3 → 9.244.4

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 (90) hide show
  1. package/{agent-VMCUKZ77.js → agent-JSLUNSTT.js} +5 -5
  2. package/{banking-GDCYMV63.js → banking-6GCF5OYC.js} +3 -3
  3. package/{chat-GG5VC4L3.js → chat-MLA4L7NU.js} +4 -4
  4. package/{chunk-DYO55E7U.js → chunk-4QZ4HY4E.js} +3 -15
  5. package/{chunk-DYO55E7U.js.map → chunk-4QZ4HY4E.js.map} +1 -1
  6. package/{chunk-6JBCB25F.js → chunk-G7TORBE5.js} +2 -2
  7. package/{chunk-VGLTHIKS.js → chunk-JFWUWF3A.js} +2 -2
  8. package/{chunk-VGLTHIKS.js.map → chunk-JFWUWF3A.js.map} +1 -1
  9. package/{chunk-K56QC4XU.js → chunk-KI4MDAT4.js} +2 -2
  10. package/{chunk-IRPVCBEV.js → chunk-PTF3UL74.js} +2 -2
  11. package/{chunk-RIOGI6WE.js → chunk-PV4JMZMJ.js} +2 -2
  12. package/{chunk-AWYBT46E.js → chunk-PZFMDYSY.js} +2 -2
  13. package/{chunk-QWSA4UPI.js → chunk-Q4DTF2TA.js} +4 -4
  14. package/{chunk-44MXI6U3.js → chunk-QKZ37ZQL.js} +3 -3
  15. package/{chunk-JOBVE3UL.js → chunk-QWRJLFXR.js} +4 -4
  16. package/{computer-use-UWLPLYNT.js → computer-use-N4WNS5N4.js} +3 -3
  17. package/{connector-IAV2HAD3.js → connector-ZSIAJ6YH.js} +6 -6
  18. package/{credit-JYOB7KNE.js → credit-4YFX65IX.js} +4 -4
  19. package/{developer-support-OGHIECZV.js → developer-support-EDEFB7K5.js} +3 -3
  20. package/{doctor-IBOADXQJ.js → doctor-Q54PUMYI.js} +3 -3
  21. package/{generate-5LOGYZX5.js → generate-BHCOSW7B.js} +4 -4
  22. package/{github-D7OXHFVK.js → github-VEZGHR67.js} +3 -3
  23. package/{goal-ZRXFDP3P.js → goal-WG5KBTXD.js} +3 -3
  24. package/{host-X3L2I27V.js → host-FCYDK4BK.js} +3 -3
  25. package/index.js +174 -383
  26. package/index.js.map +1 -1
  27. package/{logs-6FL5TYUR.js → logs-ALIH26LX.js} +5 -5
  28. package/{mail-OOTL5BQV.js → mail-4GBO6NVZ.js} +5 -5
  29. package/{maps-72KAMGLV.js → maps-W6U3SU6K.js} +3 -3
  30. package/{model-TZQDDCI4.js → model-M75D7CBV.js} +4 -4
  31. package/{model-provider-DZQ2LOIX.js → model-provider-ZG6A3OMZ.js} +4 -4
  32. package/{org-OPQT5ABR.js → org-IWZB3I2J.js} +3 -3
  33. package/package.json +1 -1
  34. package/{phone-NGCOFB6A.js → phone-DGVBYVIJ.js} +3 -3
  35. package/{preference-GMDQ56WR.js → preference-D2DZJ6MV.js} +3 -3
  36. package/{resource-S6BFXUN4.js → resource-VDFCXFF7.js} +3 -3
  37. package/{scrape-O42KQAA2.js → scrape-BGAOXMIW.js} +3 -3
  38. package/{search-CXBQKE3F.js → search-EZJ3WHLL.js} +5 -5
  39. package/{secret-7POSV4X6.js → secret-G33GAOLW.js} +3 -3
  40. package/{slack-KK4MB2CG.js → slack-AAWBJANC.js} +3 -3
  41. package/{teams-44GCGRZI.js → teams-QR5UMEYH.js} +3 -3
  42. package/{telegram-EA7E4DDC.js → telegram-WZWDX6D4.js} +3 -3
  43. package/{variable-WPLNUUKW.js → variable-WVIKMT67.js} +3 -3
  44. package/{video-HUOPH4WL.js → video-RNQNZEFT.js} +2 -2
  45. package/{web-Q4AM57LW.js → web-ZOX7CFHF.js} +3 -3
  46. package/{web-search-7FUND7UG.js → web-search-QS7NNSGR.js} +3 -3
  47. package/{whoami-TQ3YG2FR.js → whoami-OT4I5425.js} +5 -5
  48. package/{workflow-TATKRDOV.js → workflow-K2KOXD3F.js} +3 -3
  49. package/zero.js +35 -35
  50. /package/{agent-VMCUKZ77.js.map → agent-JSLUNSTT.js.map} +0 -0
  51. /package/{banking-GDCYMV63.js.map → banking-6GCF5OYC.js.map} +0 -0
  52. /package/{chat-GG5VC4L3.js.map → chat-MLA4L7NU.js.map} +0 -0
  53. /package/{chunk-6JBCB25F.js.map → chunk-G7TORBE5.js.map} +0 -0
  54. /package/{chunk-K56QC4XU.js.map → chunk-KI4MDAT4.js.map} +0 -0
  55. /package/{chunk-IRPVCBEV.js.map → chunk-PTF3UL74.js.map} +0 -0
  56. /package/{chunk-RIOGI6WE.js.map → chunk-PV4JMZMJ.js.map} +0 -0
  57. /package/{chunk-AWYBT46E.js.map → chunk-PZFMDYSY.js.map} +0 -0
  58. /package/{chunk-QWSA4UPI.js.map → chunk-Q4DTF2TA.js.map} +0 -0
  59. /package/{chunk-44MXI6U3.js.map → chunk-QKZ37ZQL.js.map} +0 -0
  60. /package/{chunk-JOBVE3UL.js.map → chunk-QWRJLFXR.js.map} +0 -0
  61. /package/{computer-use-UWLPLYNT.js.map → computer-use-N4WNS5N4.js.map} +0 -0
  62. /package/{connector-IAV2HAD3.js.map → connector-ZSIAJ6YH.js.map} +0 -0
  63. /package/{credit-JYOB7KNE.js.map → credit-4YFX65IX.js.map} +0 -0
  64. /package/{developer-support-OGHIECZV.js.map → developer-support-EDEFB7K5.js.map} +0 -0
  65. /package/{doctor-IBOADXQJ.js.map → doctor-Q54PUMYI.js.map} +0 -0
  66. /package/{generate-5LOGYZX5.js.map → generate-BHCOSW7B.js.map} +0 -0
  67. /package/{github-D7OXHFVK.js.map → github-VEZGHR67.js.map} +0 -0
  68. /package/{goal-ZRXFDP3P.js.map → goal-WG5KBTXD.js.map} +0 -0
  69. /package/{host-X3L2I27V.js.map → host-FCYDK4BK.js.map} +0 -0
  70. /package/{logs-6FL5TYUR.js.map → logs-ALIH26LX.js.map} +0 -0
  71. /package/{mail-OOTL5BQV.js.map → mail-4GBO6NVZ.js.map} +0 -0
  72. /package/{maps-72KAMGLV.js.map → maps-W6U3SU6K.js.map} +0 -0
  73. /package/{model-TZQDDCI4.js.map → model-M75D7CBV.js.map} +0 -0
  74. /package/{model-provider-DZQ2LOIX.js.map → model-provider-ZG6A3OMZ.js.map} +0 -0
  75. /package/{org-OPQT5ABR.js.map → org-IWZB3I2J.js.map} +0 -0
  76. /package/{phone-NGCOFB6A.js.map → phone-DGVBYVIJ.js.map} +0 -0
  77. /package/{preference-GMDQ56WR.js.map → preference-D2DZJ6MV.js.map} +0 -0
  78. /package/{resource-S6BFXUN4.js.map → resource-VDFCXFF7.js.map} +0 -0
  79. /package/{scrape-O42KQAA2.js.map → scrape-BGAOXMIW.js.map} +0 -0
  80. /package/{search-CXBQKE3F.js.map → search-EZJ3WHLL.js.map} +0 -0
  81. /package/{secret-7POSV4X6.js.map → secret-G33GAOLW.js.map} +0 -0
  82. /package/{slack-KK4MB2CG.js.map → slack-AAWBJANC.js.map} +0 -0
  83. /package/{teams-44GCGRZI.js.map → teams-QR5UMEYH.js.map} +0 -0
  84. /package/{telegram-EA7E4DDC.js.map → telegram-WZWDX6D4.js.map} +0 -0
  85. /package/{variable-WPLNUUKW.js.map → variable-WVIKMT67.js.map} +0 -0
  86. /package/{video-HUOPH4WL.js.map → video-RNQNZEFT.js.map} +0 -0
  87. /package/{web-Q4AM57LW.js.map → web-ZOX7CFHF.js.map} +0 -0
  88. /package/{web-search-7FUND7UG.js.map → web-search-QS7NNSGR.js.map} +0 -0
  89. /package/{whoami-TQ3YG2FR.js.map → whoami-OT4I5425.js.map} +0 -0
  90. /package/{workflow-TATKRDOV.js.map → workflow-K2KOXD3F.js.map} +0 -0
package/index.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  renderRunCreated,
37
37
  require_dist,
38
38
  showNextSteps
39
- } from "./chunk-DYO55E7U.js";
39
+ } from "./chunk-4QZ4HY4E.js";
40
40
  import {
41
41
  Qn,
42
42
  So
@@ -74,7 +74,7 @@ import {
74
74
  prepareStorage,
75
75
  searchLogs,
76
76
  volumeConfigSchema
77
- } from "./chunk-RIOGI6WE.js";
77
+ } from "./chunk-PV4JMZMJ.js";
78
78
  import "./chunk-LTDQISD7.js";
79
79
  import {
80
80
  ApiRequestError,
@@ -88,10 +88,10 @@ import {
88
88
  saveConfig,
89
89
  source_default,
90
90
  withErrorHandler
91
- } from "./chunk-VGLTHIKS.js";
91
+ } from "./chunk-JFWUWF3A.js";
92
92
  import {
93
93
  configureGlobalProxyFromEnv
94
- } from "./chunk-44MXI6U3.js";
94
+ } from "./chunk-QKZ37ZQL.js";
95
95
  import "./chunk-LRHXR7JT.js";
96
96
  import {
97
97
  Command,
@@ -277,192 +277,11 @@ var setupTokenCommand = new Command().name("setup-token").description("Output au
277
277
  // src/commands/auth/index.ts
278
278
  var authCommand = new Command().name("auth").description("Authenticate vm0").addCommand(loginCommand).addCommand(logoutCommand).addCommand(statusCommand).addCommand(setupTokenCommand);
279
279
 
280
- // src/commands/info/index.ts
281
- init_esm_shims();
282
- import { existsSync } from "fs";
283
- import * as os from "os";
284
- import { join } from "path";
285
-
286
- // src/lib/utils/update-checker.ts
287
- init_esm_shims();
288
-
289
- // src/lib/utils/spawn.ts
290
- init_esm_shims();
291
- import { spawn } from "child_process";
292
- function safeSpawn(command, args, options) {
293
- const isWindows = process.platform === "win32";
294
- const resolvedCommand = isWindows ? `${command}.cmd` : command;
295
- return spawn(resolvedCommand, args, {
296
- ...options,
297
- shell: isWindows
298
- });
299
- }
300
-
301
- // src/lib/utils/update-checker.ts
302
- var PACKAGE_NAME = "@vm0/cli";
303
- var NPM_REGISTRY_URL = `https://registry.npmjs.org/${encodeURIComponent(PACKAGE_NAME)}/latest`;
304
- var TIMEOUT_MS = 5e3;
305
- var pendingUpgrade = null;
306
- function detectPackageManager() {
307
- const execPath = process.argv[1] ?? "";
308
- if (execPath.includes("pnpm")) {
309
- return "pnpm";
310
- }
311
- if (execPath.includes("/.bun/") || execPath.includes("/bun/")) {
312
- return "bun";
313
- }
314
- if (execPath.includes("/.yarn/") || execPath.includes("/yarn/")) {
315
- return "yarn";
316
- }
317
- if (execPath.includes("/usr/local/") || // Homebrew on Intel Mac
318
- execPath.includes("/opt/homebrew/") || // Homebrew on arm64 Mac
319
- 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
320
- execPath.includes("\\nodejs\\")) {
321
- return "npm";
322
- }
323
- return "unknown";
324
- }
325
- function isAutoUpgradeSupported(pm) {
326
- return pm === "npm" || pm === "pnpm";
327
- }
328
- function getManualUpgradeCommand(pm) {
329
- switch (pm) {
330
- case "bun":
331
- return `bun add -g ${PACKAGE_NAME}@latest`;
332
- case "yarn":
333
- return `yarn global add ${PACKAGE_NAME}@latest`;
334
- case "pnpm":
335
- return `pnpm add -g ${PACKAGE_NAME}@latest`;
336
- case "npm":
337
- return `npm install -g ${PACKAGE_NAME}@latest`;
338
- case "unknown":
339
- return `npm install -g ${PACKAGE_NAME}@latest`;
340
- }
341
- }
342
- async function getLatestVersion() {
343
- try {
344
- const controller = new AbortController();
345
- const timeoutId = setTimeout(() => {
346
- return controller.abort();
347
- }, TIMEOUT_MS);
348
- const response = await fetch(NPM_REGISTRY_URL, {
349
- signal: controller.signal
350
- });
351
- clearTimeout(timeoutId);
352
- if (!response.ok) {
353
- return null;
354
- }
355
- const json = await response.json();
356
- return json.version ?? null;
357
- } catch {
358
- return null;
359
- }
360
- }
361
- function performUpgrade(packageManager) {
362
- return new Promise((resolve) => {
363
- const args = packageManager === "pnpm" ? ["add", "-g", `${PACKAGE_NAME}@latest`] : ["install", "-g", `${PACKAGE_NAME}@latest`];
364
- const child = safeSpawn(packageManager, args, {
365
- stdio: "inherit"
366
- });
367
- child.on("close", (code) => {
368
- resolve(code === 0);
369
- });
370
- child.on("error", () => {
371
- resolve(false);
372
- });
373
- });
374
- }
375
- async function startSilentUpgrade(currentVersion) {
376
- pendingUpgrade = null;
377
- const latestVersion = await getLatestVersion();
378
- if (latestVersion === null || latestVersion === currentVersion) {
379
- return;
380
- }
381
- const packageManager = detectPackageManager();
382
- if (!isAutoUpgradeSupported(packageManager)) {
383
- return;
384
- }
385
- const isWindows = process.platform === "win32";
386
- const args = packageManager === "pnpm" ? ["add", "-g", `${PACKAGE_NAME}@latest`] : ["install", "-g", `${PACKAGE_NAME}@latest`];
387
- const child = safeSpawn(packageManager, args, {
388
- stdio: "pipe",
389
- detached: !isWindows,
390
- windowsHide: true
391
- });
392
- const promise = new Promise((resolve) => {
393
- child.on("close", (code) => {
394
- return resolve(code === 0);
395
- });
396
- child.on("error", () => {
397
- return resolve(false);
398
- });
399
- });
400
- pendingUpgrade = { promise, child, packageManager };
401
- }
402
- async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
403
- if (!pendingUpgrade) {
404
- return;
405
- }
406
- const { promise, child, packageManager } = pendingUpgrade;
407
- pendingUpgrade = null;
408
- const result = await Promise.race([
409
- promise,
410
- new Promise((resolve) => {
411
- setTimeout(() => {
412
- child.kill();
413
- resolve(false);
414
- }, timeout);
415
- })
416
- ]);
417
- if (!result) {
418
- console.log(
419
- source_default.yellow(
420
- `
421
- \u26A0 vm0 auto upgrade failed. Please run: ${getManualUpgradeCommand(packageManager)}`
422
- )
423
- );
424
- }
425
- }
426
-
427
- // src/commands/info/index.ts
428
- function getConfigPath() {
429
- return join(os.homedir(), ".vm0", "config.json");
430
- }
431
- var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
432
- console.log(source_default.bold(`VM0 CLI v${"9.244.3"}`));
433
- console.log();
434
- const config = await loadConfig();
435
- const hasEnvToken = !!process.env.VM0_TOKEN;
436
- const hasConfigToken = !!config.token;
437
- const isAuthenticated = hasEnvToken || hasConfigToken;
438
- console.log(source_default.bold("Authentication:"));
439
- if (isAuthenticated) {
440
- const tokenSource = hasEnvToken ? "VM0_TOKEN env var" : "config file";
441
- console.log(` ${source_default.green("\u2713")} Logged in (via ${tokenSource})`);
442
- } else {
443
- console.log(` ${source_default.red("\u2717")} Not authenticated`);
444
- }
445
- const configExists = existsSync(getConfigPath());
446
- const configDisplay = configExists ? `~/.vm0/config.json` : `~/.vm0/config.json (not found)`;
447
- console.log(` Config: ${configDisplay}`);
448
- console.log();
449
- const apiUrl = await getApiUrl();
450
- console.log(source_default.bold("API:"));
451
- console.log(` Host: ${apiUrl}`);
452
- console.log();
453
- console.log(source_default.bold("System:"));
454
- console.log(` Node: ${process.version}`);
455
- console.log(` Platform: ${process.platform} (${process.arch})`);
456
- console.log(` OS: ${os.type()} ${os.release()}`);
457
- console.log(` Shell: ${process.env.SHELL ?? "unknown"}`);
458
- console.log(` Package Manager: ${detectPackageManager()}`);
459
- });
460
-
461
280
  // src/commands/compose/index.ts
462
281
  init_esm_shims();
463
282
  var import_yaml = __toESM(require_dist(), 1);
464
283
  import { readFile as readFile2 } from "fs/promises";
465
- import { existsSync as existsSync3 } from "fs";
284
+ import { existsSync as existsSync2 } from "fs";
466
285
  import { dirname } from "path";
467
286
 
468
287
  // src/lib/domain/yaml-validator.ts
@@ -526,30 +345,30 @@ var cliComposeSchema = external_exports.object({
526
345
  }
527
346
  }
528
347
  });
529
- function formatInvalidTypeIssue(path10, issue) {
348
+ function formatInvalidTypeIssue(path9, issue) {
530
349
  const runtimeReceived = Reflect.get(issue, "received");
531
350
  const received = typeof runtimeReceived === "string" ? runtimeReceived : void 0;
532
351
  const isMissing = received === "undefined" || issue.message.includes("received undefined") || issue.message === "Required";
533
- if (path10 === "version" && isMissing) {
352
+ if (path9 === "version" && isMissing) {
534
353
  return "Missing config.version";
535
354
  }
536
- if (path10 === "agents" && isMissing) {
355
+ if (path9 === "agents" && isMissing) {
537
356
  return "Missing agents object in config";
538
357
  }
539
- if (path10.startsWith("volumes.") && path10.endsWith(".name")) {
540
- const volumeKey = path10.split(".")[1];
358
+ if (path9.startsWith("volumes.") && path9.endsWith(".name")) {
359
+ const volumeKey = path9.split(".")[1];
541
360
  return `Volume "${volumeKey}" must have a 'name' field (string)`;
542
361
  }
543
- if (path10.startsWith("volumes.") && path10.endsWith(".version")) {
544
- const volumeKey = path10.split(".")[1];
362
+ if (path9.startsWith("volumes.") && path9.endsWith(".version")) {
363
+ const volumeKey = path9.split(".")[1];
545
364
  return `Volume "${volumeKey}" must have a 'version' field (string)`;
546
365
  }
547
366
  if (issue.expected === "array") {
548
- const fieldName = path10.replace(/^agents\.[^.]+\./, "agent.");
367
+ const fieldName = path9.replace(/^agents\.[^.]+\./, "agent.");
549
368
  return `${fieldName} must be an array`;
550
369
  }
551
370
  if (issue.expected === "string" && received === "number") {
552
- const fieldName = path10.replace(/^agents\.[^.]+\./, "agent.");
371
+ const fieldName = path9.replace(/^agents\.[^.]+\./, "agent.");
553
372
  const match = fieldName.match(/^(agent\.[^.]+)\.\d+$/);
554
373
  if (match) {
555
374
  return `Each entry in ${match[1]?.replace("agent.", "")} must be a string`;
@@ -560,24 +379,24 @@ function formatInvalidTypeIssue(path10, issue) {
560
379
  function formatZodError(error) {
561
380
  const issue = error.issues[0];
562
381
  if (!issue) return "Validation failed";
563
- const path10 = issue.path.join(".");
382
+ const path9 = issue.path.join(".");
564
383
  const message = issue.message;
565
- if (!path10) return message;
384
+ if (!path9) return message;
566
385
  if (issue.code === "invalid_type") {
567
- const formatted = formatInvalidTypeIssue(path10, issue);
386
+ const formatted = formatInvalidTypeIssue(path9, issue);
568
387
  if (formatted) return formatted;
569
388
  }
570
- if (issue.code === "invalid_key" && path10.startsWith("agents.")) {
389
+ if (issue.code === "invalid_key" && path9.startsWith("agents.")) {
571
390
  return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
572
391
  }
573
- if (message === "Invalid key in record" && path10.startsWith("agents.")) {
392
+ if (message === "Invalid key in record" && path9.startsWith("agents.")) {
574
393
  return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
575
394
  }
576
395
  if (issue.code === "custom") {
577
396
  return message;
578
397
  }
579
- if (path10.startsWith("agents.")) {
580
- const cleanPath = path10.replace(/^agents\.[^.]+\./, "agent.");
398
+ if (path9.startsWith("agents.")) {
399
+ const cleanPath = path9.replace(/^agents\.[^.]+\./, "agent.");
581
400
  if (message.startsWith("Invalid input:")) {
582
401
  const match = message.match(/expected (\w+), received (\w+)/);
583
402
  if (match && match[1] === "string" && match[2] === "number") {
@@ -589,10 +408,7 @@ function formatZodError(error) {
589
408
  }
590
409
  return `${cleanPath}: ${message}`;
591
410
  }
592
- return `${path10}: ${message}`;
593
- }
594
- function validateAgentName(name) {
595
- return cliAgentNameSchema.safeParse(name).success;
411
+ return `${path9}: ${message}`;
596
412
  }
597
413
  var KNOWN_AGENT_FIELDS = Object.keys(agentDefinitionSchema.shape);
598
414
  function levenshteinDistance(a, b) {
@@ -710,14 +526,14 @@ function validateAgentCompose(config) {
710
526
  init_esm_shims();
711
527
  import * as fs2 from "fs/promises";
712
528
  import * as path2 from "path";
713
- import * as os3 from "os";
529
+ import * as os2 from "os";
714
530
 
715
531
  // src/lib/storage/direct-upload.ts
716
532
  init_esm_shims();
717
533
  import { createHash } from "crypto";
718
534
  import * as fs from "fs";
719
535
  import * as path from "path";
720
- import * as os2 from "os";
536
+ import * as os from "os";
721
537
  async function hashFileStream(filePath) {
722
538
  return new Promise((resolve, reject) => {
723
539
  const hash = createHash("sha256");
@@ -770,7 +586,7 @@ async function collectFileMetadata(cwd, files, onProgress) {
770
586
  return fileEntries;
771
587
  }
772
588
  async function createArchive(cwd, files) {
773
- const tmpDir = fs.mkdtempSync(path.join(os2.tmpdir(), "vm0-"));
589
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "vm0-"));
774
590
  const tarPath = path.join(tmpDir, "archive.tar.gz");
775
591
  try {
776
592
  const relativePaths = files.map((file) => {
@@ -924,7 +740,7 @@ async function uploadInstructions(agentName, instructionsFilePath, basePath, fra
924
740
  const storageName = getInstructionsStorageName(agentName.toLowerCase());
925
741
  const absolutePath = path2.isAbsolute(instructionsFilePath) ? instructionsFilePath : path2.join(basePath, instructionsFilePath);
926
742
  const content = await fs2.readFile(absolutePath, "utf8");
927
- const tmpDir = await fs2.mkdtemp(path2.join(os3.tmpdir(), "vm0-instructions-"));
743
+ const tmpDir = await fs2.mkdtemp(path2.join(os2.tmpdir(), "vm0-instructions-"));
928
744
  const instructionsDir = path2.join(tmpDir, "instructions");
929
745
  await fs2.mkdir(instructionsDir);
930
746
  const filename = getInstructionsFilename(framework);
@@ -941,6 +757,133 @@ async function uploadInstructions(agentName, instructionsFilePath, basePath, fra
941
757
  }
942
758
  }
943
759
 
760
+ // src/lib/utils/update-checker.ts
761
+ init_esm_shims();
762
+
763
+ // src/lib/utils/spawn.ts
764
+ init_esm_shims();
765
+ import { spawn } from "child_process";
766
+ function safeSpawn(command, args, options) {
767
+ const isWindows = process.platform === "win32";
768
+ const resolvedCommand = isWindows ? `${command}.cmd` : command;
769
+ return spawn(resolvedCommand, args, {
770
+ ...options,
771
+ shell: isWindows
772
+ });
773
+ }
774
+
775
+ // src/lib/utils/update-checker.ts
776
+ var PACKAGE_NAME = "@vm0/cli";
777
+ var NPM_REGISTRY_URL = `https://registry.npmjs.org/${encodeURIComponent(PACKAGE_NAME)}/latest`;
778
+ var TIMEOUT_MS = 5e3;
779
+ var pendingUpgrade = null;
780
+ function detectPackageManager() {
781
+ const execPath = process.argv[1] ?? "";
782
+ if (execPath.includes("pnpm")) {
783
+ return "pnpm";
784
+ }
785
+ if (execPath.includes("/.bun/") || execPath.includes("/bun/")) {
786
+ return "bun";
787
+ }
788
+ if (execPath.includes("/.yarn/") || execPath.includes("/yarn/")) {
789
+ return "yarn";
790
+ }
791
+ if (execPath.includes("/usr/local/") || // Homebrew on Intel Mac
792
+ execPath.includes("/opt/homebrew/") || // Homebrew on arm64 Mac
793
+ 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
794
+ execPath.includes("\\nodejs\\")) {
795
+ return "npm";
796
+ }
797
+ return "unknown";
798
+ }
799
+ function isAutoUpgradeSupported(pm) {
800
+ return pm === "npm" || pm === "pnpm";
801
+ }
802
+ function getManualUpgradeCommand(pm) {
803
+ switch (pm) {
804
+ case "bun":
805
+ return `bun add -g ${PACKAGE_NAME}@latest`;
806
+ case "yarn":
807
+ return `yarn global add ${PACKAGE_NAME}@latest`;
808
+ case "pnpm":
809
+ return `pnpm add -g ${PACKAGE_NAME}@latest`;
810
+ case "npm":
811
+ return `npm install -g ${PACKAGE_NAME}@latest`;
812
+ case "unknown":
813
+ return `npm install -g ${PACKAGE_NAME}@latest`;
814
+ }
815
+ }
816
+ async function getLatestVersion() {
817
+ try {
818
+ const controller = new AbortController();
819
+ const timeoutId = setTimeout(() => {
820
+ return controller.abort();
821
+ }, TIMEOUT_MS);
822
+ const response = await fetch(NPM_REGISTRY_URL, {
823
+ signal: controller.signal
824
+ });
825
+ clearTimeout(timeoutId);
826
+ if (!response.ok) {
827
+ return null;
828
+ }
829
+ const json = await response.json();
830
+ return json.version ?? null;
831
+ } catch {
832
+ return null;
833
+ }
834
+ }
835
+ async function startSilentUpgrade(currentVersion) {
836
+ pendingUpgrade = null;
837
+ const latestVersion = await getLatestVersion();
838
+ if (latestVersion === null || latestVersion === currentVersion) {
839
+ return;
840
+ }
841
+ const packageManager = detectPackageManager();
842
+ if (!isAutoUpgradeSupported(packageManager)) {
843
+ return;
844
+ }
845
+ const isWindows = process.platform === "win32";
846
+ const args = packageManager === "pnpm" ? ["add", "-g", `${PACKAGE_NAME}@latest`] : ["install", "-g", `${PACKAGE_NAME}@latest`];
847
+ const child = safeSpawn(packageManager, args, {
848
+ stdio: "pipe",
849
+ detached: !isWindows,
850
+ windowsHide: true
851
+ });
852
+ const promise = new Promise((resolve) => {
853
+ child.on("close", (code) => {
854
+ return resolve(code === 0);
855
+ });
856
+ child.on("error", () => {
857
+ return resolve(false);
858
+ });
859
+ });
860
+ pendingUpgrade = { promise, child, packageManager };
861
+ }
862
+ async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
863
+ if (!pendingUpgrade) {
864
+ return;
865
+ }
866
+ const { promise, child, packageManager } = pendingUpgrade;
867
+ pendingUpgrade = null;
868
+ const result = await Promise.race([
869
+ promise,
870
+ new Promise((resolve) => {
871
+ setTimeout(() => {
872
+ child.kill();
873
+ resolve(false);
874
+ }, timeout);
875
+ })
876
+ ]);
877
+ if (!result) {
878
+ console.log(
879
+ source_default.yellow(
880
+ `
881
+ \u26A0 vm0 auto upgrade failed. Please run: ${getManualUpgradeCommand(packageManager)}`
882
+ )
883
+ );
884
+ }
885
+ }
886
+
944
887
  // src/commands/compose/index.ts
945
888
  var DEFAULT_CONFIG_FILE = "vm0.yaml";
946
889
  function getSecretsFromComposeContent(content) {
@@ -960,7 +903,7 @@ function getVarsFromComposeContent(content) {
960
903
  );
961
904
  }
962
905
  async function loadAndValidateConfig(configFile) {
963
- if (!existsSync3(configFile)) {
906
+ if (!existsSync2(configFile)) {
964
907
  throw new Error(`Config file not found: ${configFile}`);
965
908
  }
966
909
  const content = await readFile2(configFile, "utf8");
@@ -1132,7 +1075,7 @@ var composeCommand = new Command().name("compose").description("Create or update
1132
1075
  options.autoUpdate = false;
1133
1076
  }
1134
1077
  if (options.autoUpdate !== false) {
1135
- await startSilentUpgrade("9.244.3");
1078
+ await startSilentUpgrade("9.244.4");
1136
1079
  }
1137
1080
  try {
1138
1081
  const { config, agentName, agent, basePath } = await loadAndValidateConfig(resolvedConfigFile);
@@ -1229,7 +1172,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
1229
1172
  withErrorHandler(
1230
1173
  async (identifier, prompt, options) => {
1231
1174
  if (options.autoUpdate !== false) {
1232
- await startSilentUpgrade("9.244.3");
1175
+ await startSilentUpgrade("9.244.4");
1233
1176
  }
1234
1177
  const { name, version } = parseIdentifier(identifier);
1235
1178
  let composeId;
@@ -1720,7 +1663,7 @@ import path4 from "path";
1720
1663
  init_esm_shims();
1721
1664
  var import_yaml2 = __toESM(require_dist(), 1);
1722
1665
  import { readFile as readFile3, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
1723
- import { existsSync as existsSync4 } from "fs";
1666
+ import { existsSync as existsSync3 } from "fs";
1724
1667
  import path3 from "path";
1725
1668
  var CONFIG_DIR = ".vm0";
1726
1669
  var CONFIG_FILE = "storage.yaml";
@@ -1735,9 +1678,9 @@ async function readStorageConfig(basePath = process.cwd()) {
1735
1678
  const configPath = path3.join(basePath, CONFIG_DIR, CONFIG_FILE);
1736
1679
  const legacyConfigPath = path3.join(basePath, CONFIG_DIR, "volume.yaml");
1737
1680
  let actualPath = null;
1738
- if (existsSync4(configPath)) {
1681
+ if (existsSync3(configPath)) {
1739
1682
  actualPath = configPath;
1740
- } else if (existsSync4(legacyConfigPath)) {
1683
+ } else if (existsSync3(legacyConfigPath)) {
1741
1684
  actualPath = legacyConfigPath;
1742
1685
  }
1743
1686
  if (!actualPath) {
@@ -1750,15 +1693,15 @@ async function readStorageConfig(basePath = process.cwd()) {
1750
1693
  }
1751
1694
  return config;
1752
1695
  }
1753
- async function writeStorageConfig(storageName, basePath = process.cwd(), type2 = "volume") {
1696
+ async function writeStorageConfig(storageName, basePath = process.cwd(), type = "volume") {
1754
1697
  const configDir = path3.join(basePath, CONFIG_DIR);
1755
1698
  const configPath = path3.join(configDir, CONFIG_FILE);
1756
- if (!existsSync4(configDir)) {
1699
+ if (!existsSync3(configDir)) {
1757
1700
  await mkdir2(configDir, { recursive: true });
1758
1701
  }
1759
1702
  const config = {
1760
1703
  name: storageName,
1761
- type: type2
1704
+ type
1762
1705
  };
1763
1706
  const yamlContent = (0, import_yaml2.stringify)(config);
1764
1707
  await writeFile2(configPath, yamlContent, "utf8");
@@ -1860,7 +1803,7 @@ var pushCommand = new Command().name("push").description("Push local files to cl
1860
1803
  init_esm_shims();
1861
1804
  import path5 from "path";
1862
1805
  import * as fs3 from "fs";
1863
- import * as os4 from "os";
1806
+ import * as os3 from "os";
1864
1807
 
1865
1808
  // src/lib/storage/pull-utils.ts
1866
1809
  init_esm_shims();
@@ -1911,7 +1854,7 @@ var pullCommand = new Command().name("pull").description("Pull cloud files to lo
1911
1854
  const arrayBuffer = await s3Response.arrayBuffer();
1912
1855
  const tarBuffer = Buffer.from(arrayBuffer);
1913
1856
  console.log(source_default.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
1914
- const tmpDir = fs3.mkdtempSync(path5.join(os4.tmpdir(), "vm0-"));
1857
+ const tmpDir = fs3.mkdtempSync(path5.join(os3.tmpdir(), "vm0-"));
1915
1858
  const tarPath = path5.join(tmpDir, "volume.tar.gz");
1916
1859
  await fs3.promises.writeFile(tarPath, tarBuffer);
1917
1860
  console.log(source_default.dim("Syncing local files..."));
@@ -2039,9 +1982,9 @@ init_esm_shims();
2039
1982
  init_esm_shims();
2040
1983
  import path6 from "path";
2041
1984
  import * as fs4 from "fs";
2042
- import * as os5 from "os";
2043
- async function cloneStorage(name, type2, destination, options = {}) {
2044
- const typeLabel = type2;
1985
+ import * as os4 from "os";
1986
+ async function cloneStorage(name, type, destination, options = {}) {
1987
+ const typeLabel = type;
2045
1988
  const dirStatus = checkDirectoryStatus(destination);
2046
1989
  if (dirStatus.exists && !dirStatus.empty) {
2047
1990
  throw new Error(`Directory "${destination}" is not empty`);
@@ -2049,13 +1992,13 @@ async function cloneStorage(name, type2, destination, options = {}) {
2049
1992
  console.log(source_default.dim(`Checking remote ${typeLabel}...`));
2050
1993
  const downloadInfo = await getStorageDownload({
2051
1994
  name,
2052
- type: type2,
1995
+ type,
2053
1996
  version: options.version
2054
1997
  });
2055
1998
  console.log(source_default.dim(`Creating directory: ${destination}/`));
2056
1999
  await fs4.promises.mkdir(destination, { recursive: true });
2057
2000
  if ("empty" in downloadInfo) {
2058
- await writeStorageConfig(name, destination, type2);
2001
+ await writeStorageConfig(name, destination, type);
2059
2002
  console.log(source_default.green(`\u2713 Cloned empty ${typeLabel}: ${name}`));
2060
2003
  console.log(source_default.dim(`\u2713 Initialized .vm0/storage.yaml`));
2061
2004
  return {
@@ -2078,7 +2021,7 @@ async function cloneStorage(name, type2, destination, options = {}) {
2078
2021
  const arrayBuffer = await s3Response.arrayBuffer();
2079
2022
  const tarBuffer = Buffer.from(arrayBuffer);
2080
2023
  console.log(source_default.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
2081
- const tmpDir = fs4.mkdtempSync(path6.join(os5.tmpdir(), "vm0-clone-"));
2024
+ const tmpDir = fs4.mkdtempSync(path6.join(os4.tmpdir(), "vm0-clone-"));
2082
2025
  const tarPath = path6.join(tmpDir, "archive.tar.gz");
2083
2026
  await fs4.promises.writeFile(tarPath, tarBuffer);
2084
2027
  const files = await listTarFiles(tarPath);
@@ -2091,7 +2034,7 @@ async function cloneStorage(name, type2, destination, options = {}) {
2091
2034
  await fs4.promises.unlink(tarPath);
2092
2035
  await fs4.promises.rmdir(tmpDir);
2093
2036
  console.log(source_default.green(`\u2713 Extracted ${files.length} files`));
2094
- await writeStorageConfig(name, destination, type2);
2037
+ await writeStorageConfig(name, destination, type);
2095
2038
  console.log(source_default.green(`\u2713 Initialized .vm0/storage.yaml`));
2096
2039
  return {
2097
2040
  success: true,
@@ -2242,7 +2185,7 @@ var pushCommand2 = new Command().name("push").description("Push local files to c
2242
2185
  init_esm_shims();
2243
2186
  import path8 from "path";
2244
2187
  import * as fs5 from "fs";
2245
- import * as os6 from "os";
2188
+ import * as os5 from "os";
2246
2189
  var pullCommand2 = new Command().name("pull").description("Pull cloud artifact to local directory").argument("[versionId]", "Version ID to pull (default: latest)").action(
2247
2190
  withErrorHandler(async (versionId) => {
2248
2191
  const cwd = process.cwd();
@@ -2285,7 +2228,7 @@ var pullCommand2 = new Command().name("pull").description("Pull cloud artifact t
2285
2228
  const arrayBuffer = await s3Response.arrayBuffer();
2286
2229
  const tarBuffer = Buffer.from(arrayBuffer);
2287
2230
  console.log(source_default.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
2288
- const tmpDir = fs5.mkdtempSync(path8.join(os6.tmpdir(), "vm0-"));
2231
+ const tmpDir = fs5.mkdtempSync(path8.join(os5.tmpdir(), "vm0-"));
2289
2232
  const tarPath = path8.join(tmpDir, "artifact.tar.gz");
2290
2233
  await fs5.promises.writeFile(tarPath, tarBuffer);
2291
2234
  console.log(source_default.dim("Syncing local files..."));
@@ -2990,155 +2933,6 @@ async function showNetworkLogs(runId, options) {
2990
2933
  }
2991
2934
  }
2992
2935
 
2993
- // src/commands/init/index.ts
2994
- init_esm_shims();
2995
- import path9 from "path";
2996
- import { existsSync as existsSync5 } from "fs";
2997
- import { writeFile as writeFile3 } from "fs/promises";
2998
- var VM0_YAML_FILE = "vm0.yaml";
2999
- var AGENTS_MD_FILE = "AGENTS.md";
3000
- function generateVm0Yaml(agentName) {
3001
- return `version: "1.0"
3002
-
3003
- agents:
3004
- ${agentName}:
3005
- framework: claude-code
3006
- # Build agentic workflow using natural language
3007
- instructions: AGENTS.md
3008
- `;
3009
- }
3010
- function generateAgentsMd() {
3011
- return `# Agent Instructions
3012
-
3013
- You are a HackerNews AI content curator.
3014
-
3015
- ## Workflow
3016
-
3017
- 1. Go to HackerNews and read the top 10 articles
3018
- 2. Find and extract AI-related content from these articles
3019
- 3. Summarize the findings into a X (Twitter) post format
3020
- 4. Write the summary to content.md
3021
- `;
3022
- }
3023
- function checkExistingFiles() {
3024
- const existingFiles = [];
3025
- if (existsSync5(VM0_YAML_FILE)) existingFiles.push(VM0_YAML_FILE);
3026
- if (existsSync5(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
3027
- return existingFiles;
3028
- }
3029
- 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(
3030
- withErrorHandler(async (options) => {
3031
- const existingFiles = checkExistingFiles();
3032
- if (existingFiles.length > 0 && !options.force) {
3033
- throw new Error(`${existingFiles.join(", ")} already exists`, {
3034
- cause: new Error("To overwrite: vm0 init --force")
3035
- });
3036
- }
3037
- let agentName;
3038
- if (options.name) {
3039
- agentName = options.name.trim();
3040
- } else if (!isInteractive()) {
3041
- throw new Error("--name flag is required in non-interactive mode", {
3042
- cause: new Error("Usage: vm0 init --name <agent-name>")
3043
- });
3044
- } else {
3045
- const dirName = path9.basename(process.cwd());
3046
- const defaultName = validateAgentName(dirName) ? dirName : void 0;
3047
- const name = await promptText(
3048
- "Enter agent name",
3049
- defaultName,
3050
- (value) => {
3051
- if (!validateAgentName(value)) {
3052
- return "Must be 3-64 characters, alphanumeric and hyphens, start/end with letter or number";
3053
- }
3054
- return true;
3055
- }
3056
- );
3057
- if (name === void 0) {
3058
- console.log(source_default.dim("Cancelled"));
3059
- return;
3060
- }
3061
- agentName = name;
3062
- }
3063
- if (!agentName || !validateAgentName(agentName)) {
3064
- throw new Error("Invalid agent name", {
3065
- cause: new Error(
3066
- "Must be 3-64 characters, alphanumeric and hyphens only, start and end with letter or number"
3067
- )
3068
- });
3069
- }
3070
- await writeFile3(VM0_YAML_FILE, generateVm0Yaml(agentName));
3071
- const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
3072
- console.log(source_default.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
3073
- await writeFile3(AGENTS_MD_FILE, generateAgentsMd());
3074
- const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
3075
- console.log(source_default.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
3076
- console.log();
3077
- console.log("Next steps:");
3078
- console.log(` 1. Log in to VM0: ${source_default.cyan("vm0 auth login")}`);
3079
- console.log(
3080
- ` 2. Edit ${source_default.cyan("AGENTS.md")} to customize your agent's workflow`
3081
- );
3082
- console.log(
3083
- ` 3. Run your agent: ${source_default.cyan(`vm0 run --secrets CLAUDE_CODE_OAUTH_TOKEN=<token> "let's start working"`)}`
3084
- );
3085
- })
3086
- );
3087
-
3088
- // src/commands/upgrade/index.ts
3089
- init_esm_shims();
3090
- var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI to the latest version").action(
3091
- withErrorHandler(async () => {
3092
- console.log("Checking for updates...");
3093
- const latestVersion = await getLatestVersion();
3094
- if (latestVersion === null) {
3095
- throw new Error("Could not check for updates. Please try again later.");
3096
- }
3097
- if (latestVersion === "9.244.3") {
3098
- console.log(source_default.green(`\u2713 Already up to date (${"9.244.3"})`));
3099
- return;
3100
- }
3101
- console.log(
3102
- source_default.yellow(
3103
- `Current version: ${"9.244.3"} -> Latest version: ${latestVersion}`
3104
- )
3105
- );
3106
- console.log();
3107
- const packageManager = detectPackageManager();
3108
- if (!isAutoUpgradeSupported(packageManager)) {
3109
- if (packageManager === "unknown") {
3110
- console.log(
3111
- source_default.yellow(
3112
- "Could not detect your package manager for auto-upgrade."
3113
- )
3114
- );
3115
- } else {
3116
- console.log(
3117
- source_default.yellow(
3118
- `Auto-upgrade is not supported for ${packageManager}.`
3119
- )
3120
- );
3121
- }
3122
- console.log(source_default.yellow("Please upgrade manually:"));
3123
- console.log(source_default.cyan(` ${getManualUpgradeCommand(packageManager)}`));
3124
- return;
3125
- }
3126
- console.log(`Upgrading via ${packageManager}...`);
3127
- const success = await performUpgrade(packageManager);
3128
- if (success) {
3129
- console.log(
3130
- source_default.green(`\u2713 Upgraded from ${"9.244.3"} to ${latestVersion}`)
3131
- );
3132
- return;
3133
- }
3134
- throw new Error("Upgrade failed", {
3135
- cause: new Error(
3136
- `Please run manually: ${getManualUpgradeCommand(packageManager)}`
3137
- )
3138
- });
3139
- })
3140
- );
3141
-
3142
2936
  // src/commands/whoami.ts
3143
2937
  init_esm_shims();
3144
2938
  function isInsideSandbox() {
@@ -3194,16 +2988,13 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
3194
2988
 
3195
2989
  // src/index.ts
3196
2990
  var program = new Command();
3197
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.244.3");
2991
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.244.4");
3198
2992
  program.addCommand(authCommand);
3199
- program.addCommand(infoCommand);
3200
2993
  program.addCommand(composeCommand);
3201
2994
  program.addCommand(runCommand);
3202
2995
  program.addCommand(volumeCommand);
3203
2996
  program.addCommand(artifactCommand);
3204
2997
  program.addCommand(logsCommand);
3205
- program.addCommand(initCommand3);
3206
- program.addCommand(upgradeCommand);
3207
2998
  program.addCommand(whoamiCommand);
3208
2999
  if (process.argv[1]?.endsWith("index.js") || process.argv[1]?.endsWith("index.ts") || process.argv[1]?.endsWith("vm0")) {
3209
3000
  await configureGlobalProxyFromEnv();