@vm0/cli 9.90.2 → 9.90.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.
package/index.js CHANGED
@@ -33,7 +33,6 @@ import {
33
33
  getStorageDownload,
34
34
  getSystemLog,
35
35
  getToken,
36
- getZeroOrg,
37
36
  isInteractive,
38
37
  isUUID,
39
38
  listRuns,
@@ -60,7 +59,7 @@ import {
60
59
  showNextSteps,
61
60
  volumeConfigSchema,
62
61
  withErrorHandler
63
- } from "./chunk-VO3BTEUW.js";
62
+ } from "./chunk-XQKSWAGW.js";
64
63
 
65
64
  // src/index.ts
66
65
  import { Command as Command44 } from "commander";
@@ -106,7 +105,9 @@ async function exchangeToken(apiUrl, deviceCode) {
106
105
  return response.json();
107
106
  }
108
107
  function delay(ms) {
109
- return new Promise((resolve) => setTimeout(resolve, ms));
108
+ return new Promise((resolve) => {
109
+ return setTimeout(resolve, ms);
110
+ });
110
111
  }
111
112
  async function authenticate(apiUrl) {
112
113
  const targetApiUrl = apiUrl ?? await getApiUrl();
@@ -309,7 +310,9 @@ function buildRerunCommand(prompt) {
309
310
  async function getLatestVersion() {
310
311
  try {
311
312
  const controller = new AbortController();
312
- const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
313
+ const timeoutId = setTimeout(() => {
314
+ return controller.abort();
315
+ }, TIMEOUT_MS);
313
316
  const response = await fetch(NPM_REGISTRY_URL, {
314
317
  signal: controller.signal
315
318
  });
@@ -410,8 +413,12 @@ async function startSilentUpgrade(currentVersion) {
410
413
  windowsHide: true
411
414
  });
412
415
  const promise = new Promise((resolve) => {
413
- child.on("close", (code) => resolve(code === 0));
414
- child.on("error", () => resolve(false));
416
+ child.on("close", (code) => {
417
+ return resolve(code === 0);
418
+ });
419
+ child.on("error", () => {
420
+ return resolve(false);
421
+ });
415
422
  });
416
423
  pendingUpgrade = { promise, child, packageManager };
417
424
  }
@@ -445,7 +452,7 @@ function getConfigPath() {
445
452
  return join(homedir(), ".vm0", "config.json");
446
453
  }
447
454
  var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
448
- console.log(chalk3.bold(`VM0 CLI v${"9.90.2"}`));
455
+ console.log(chalk3.bold(`VM0 CLI v${"9.90.4"}`));
449
456
  console.log();
450
457
  const config = await loadConfig();
451
458
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -636,7 +643,9 @@ function levenshteinDistance(a, b) {
636
643
  if (a.length === 0) return b.length;
637
644
  if (b.length === 0) return a.length;
638
645
  if (a.length > b.length) [a, b] = [b, a];
639
- const row = Array.from({ length: a.length + 1 }, (_, i) => i);
646
+ const row = Array.from({ length: a.length + 1 }, (_, i) => {
647
+ return i;
648
+ });
640
649
  for (let j = 1; j <= b.length; j++) {
641
650
  let prev = j - 1;
642
651
  row[0] = j;
@@ -983,7 +992,9 @@ function listTarFiles(tarPath) {
983
992
  files.push(entry.path);
984
993
  }
985
994
  }
986
- }).then(() => resolve(files)).catch(reject);
995
+ }).then(() => {
996
+ return resolve(files);
997
+ }).catch(reject);
987
998
  });
988
999
  }
989
1000
  async function listLocalFiles(dir, excludeDirs = [".vm0"]) {
@@ -1048,8 +1059,12 @@ async function hashFileStream(filePath) {
1048
1059
  return new Promise((resolve, reject) => {
1049
1060
  const hash = createHash("sha256");
1050
1061
  const stream = fs4.createReadStream(filePath);
1051
- stream.on("data", (chunk) => hash.update(chunk));
1052
- stream.on("end", () => resolve(hash.digest("hex")));
1062
+ stream.on("data", (chunk) => {
1063
+ return hash.update(chunk);
1064
+ });
1065
+ stream.on("end", () => {
1066
+ return resolve(hash.digest("hex"));
1067
+ });
1053
1068
  stream.on("error", reject);
1054
1069
  });
1055
1070
  }
@@ -1095,7 +1110,9 @@ async function createArchive(cwd, files) {
1095
1110
  const tmpDir = fs4.mkdtempSync(path4.join(os2.tmpdir(), "vm0-"));
1096
1111
  const tarPath = path4.join(tmpDir, "archive.tar.gz");
1097
1112
  try {
1098
- const relativePaths = files.map((file) => path4.relative(cwd, file));
1113
+ const relativePaths = files.map((file) => {
1114
+ return path4.relative(cwd, file);
1115
+ });
1099
1116
  if (relativePaths.length > 0) {
1100
1117
  await tar2.create(
1101
1118
  {
@@ -1134,7 +1151,9 @@ function createManifest(files) {
1134
1151
  return Buffer.from(JSON.stringify(manifest, null, 2));
1135
1152
  }
1136
1153
  function sleep(ms) {
1137
- return new Promise((resolve) => setTimeout(resolve, ms));
1154
+ return new Promise((resolve) => {
1155
+ return setTimeout(resolve, ms);
1156
+ });
1138
1157
  }
1139
1158
  async function uploadToPresignedUrl(presignedUrl, data, contentType, maxRetries = 3) {
1140
1159
  let lastError = null;
@@ -1286,11 +1305,19 @@ function isGitHubUrl(input) {
1286
1305
  }
1287
1306
  function getSecretsFromComposeContent(content) {
1288
1307
  const grouped = extractAndGroupVariables(content);
1289
- return new Set(grouped.secrets.map((r) => r.name));
1308
+ return new Set(
1309
+ grouped.secrets.map((r) => {
1310
+ return r.name;
1311
+ })
1312
+ );
1290
1313
  }
1291
1314
  function getVarsFromComposeContent(content) {
1292
1315
  const grouped = extractAndGroupVariables(content);
1293
- return new Set(grouped.vars.map((r) => r.name));
1316
+ return new Set(
1317
+ grouped.vars.map((r) => {
1318
+ return r.name;
1319
+ })
1320
+ );
1294
1321
  }
1295
1322
  async function loadAndValidateConfig(configFile) {
1296
1323
  if (!existsSync4(configFile)) {
@@ -1394,20 +1421,24 @@ async function checkAndPromptMissingItems(config, options) {
1394
1421
  listZeroConnectors()
1395
1422
  ]);
1396
1423
  const existingSecretNames = new Set(
1397
- secretsResponse.secrets.map((s) => s.name)
1424
+ secretsResponse.secrets.map((s) => {
1425
+ return s.name;
1426
+ })
1398
1427
  );
1399
1428
  const existingVarNames = new Set(
1400
- variablesResponse.variables.map((v) => v.name)
1429
+ variablesResponse.variables.map((v) => {
1430
+ return v.name;
1431
+ })
1401
1432
  );
1402
1433
  const connectorProvided = new Set(
1403
1434
  connectorsResponse.connectorProvidedSecretNames
1404
1435
  );
1405
- const missingSecrets = [...requiredSecrets].filter(
1406
- (name) => !existingSecretNames.has(name) && !connectorProvided.has(name)
1407
- );
1408
- const missingVars = [...requiredVars].filter(
1409
- (name) => !existingVarNames.has(name)
1410
- );
1436
+ const missingSecrets = [...requiredSecrets].filter((name) => {
1437
+ return !existingSecretNames.has(name) && !connectorProvided.has(name);
1438
+ });
1439
+ const missingVars = [...requiredVars].filter((name) => {
1440
+ return !existingVarNames.has(name);
1441
+ });
1411
1442
  if (missingSecrets.length === 0 && missingVars.length === 0) {
1412
1443
  return { missingSecrets: [], missingVars: [] };
1413
1444
  }
@@ -1430,7 +1461,7 @@ async function finalizeCompose(config, agent, options) {
1430
1461
  }
1431
1462
  const response = await createOrUpdateCompose({ content: config });
1432
1463
  const shortVersionId = response.versionId.slice(0, 8);
1433
- const displayName = options.json ? response.name : `${(await getZeroOrg()).slug}/${response.name}`;
1464
+ const displayName = response.name;
1434
1465
  const result = {
1435
1466
  composeId: response.composeId,
1436
1467
  composeName: response.name,
@@ -1548,7 +1579,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
1548
1579
  options.autoUpdate = false;
1549
1580
  }
1550
1581
  if (options.autoUpdate !== false) {
1551
- await startSilentUpgrade("9.90.2");
1582
+ await startSilentUpgrade("9.90.4");
1552
1583
  }
1553
1584
  try {
1554
1585
  let result;
@@ -1578,7 +1609,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
1578
1609
  import { Command as Command8, Option as Option2 } from "commander";
1579
1610
  var mainRunCommand = new Command8().name("run").description("Run an agent").argument(
1580
1611
  "<agent-name>",
1581
- "Agent reference: [org/]name[:version] (e.g., 'my-agent', 'lancy/my-agent:abc123', 'my-agent:latest')"
1612
+ "Agent reference: name[:version] (e.g., 'my-agent', 'my-agent:abc123', 'my-agent:latest')"
1582
1613
  ).argument("<prompt>", "Prompt for the agent").option(
1583
1614
  "--env-file <path>",
1584
1615
  "Load environment variables from file (priority: CLI flags > file > env vars)"
@@ -1625,9 +1656,9 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
1625
1656
  withErrorHandler(
1626
1657
  async (identifier, prompt, options) => {
1627
1658
  if (options.autoUpdate !== false) {
1628
- await startSilentUpgrade("9.90.2");
1659
+ await startSilentUpgrade("9.90.4");
1629
1660
  }
1630
- const { org, name, version } = parseIdentifier(identifier);
1661
+ const { name, version } = parseIdentifier(identifier);
1631
1662
  let composeId;
1632
1663
  let composeContent;
1633
1664
  if (isUUID(name)) {
@@ -1635,7 +1666,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
1635
1666
  composeId = compose.id;
1636
1667
  composeContent = compose.content;
1637
1668
  } else {
1638
- const compose = await getComposeByName(name, org);
1669
+ const compose = await getComposeByName(name);
1639
1670
  if (!compose) {
1640
1671
  throw new Error(`Agent not found: ${identifier}`, {
1641
1672
  cause: new Error(
@@ -1951,7 +1982,9 @@ function parseStatusFilter(options) {
1951
1982
  return VALID_STATUSES;
1952
1983
  }
1953
1984
  if (options.status) {
1954
- const values = options.status.split(",").map((s) => s.trim());
1985
+ const values = options.status.split(",").map((s) => {
1986
+ return s.trim();
1987
+ });
1955
1988
  for (const v of values) {
1956
1989
  if (!ALL_RUN_STATUSES.includes(v)) {
1957
1990
  throw new Error(`Invalid status "${v}"`, {
@@ -1984,8 +2017,18 @@ function parseLimit(value) {
1984
2017
  return limit;
1985
2018
  }
1986
2019
  function displayRuns(runs) {
1987
- const agentWidth = Math.max(5, ...runs.map((r) => r.agentName.length));
1988
- const statusWidth = Math.max(6, ...runs.map((r) => r.status.length));
2020
+ const agentWidth = Math.max(
2021
+ 5,
2022
+ ...runs.map((r) => {
2023
+ return r.agentName.length;
2024
+ })
2025
+ );
2026
+ const statusWidth = Math.max(
2027
+ 6,
2028
+ ...runs.map((r) => {
2029
+ return r.status.length;
2030
+ })
2031
+ );
1989
2032
  const header = [
1990
2033
  "ID".padEnd(UUID_LENGTH),
1991
2034
  "AGENT".padEnd(agentWidth),
@@ -2073,11 +2116,15 @@ var queueCommand = new Command13().name("queue").description("Show org run queue
2073
2116
  const posWidth = Math.max(1, String(queue.length).length);
2074
2117
  const agentWidth = Math.max(
2075
2118
  5,
2076
- ...queue.map((e) => (e.agentName ?? "-").length)
2119
+ ...queue.map((e) => {
2120
+ return (e.agentName ?? "-").length;
2121
+ })
2077
2122
  );
2078
2123
  const emailWidth = Math.max(
2079
2124
  4,
2080
- ...queue.map((e) => (e.userEmail ?? "-").length)
2125
+ ...queue.map((e) => {
2126
+ return (e.userEmail ?? "-").length;
2127
+ })
2081
2128
  );
2082
2129
  const header = [
2083
2130
  "#".padEnd(posWidth),
@@ -2318,7 +2365,9 @@ var pullCommand = new Command16().name("pull").description("Pull cloud files to
2318
2365
  console.log(chalk11.dim("Syncing local files..."));
2319
2366
  const remoteFiles = await listTarFiles(tarPath);
2320
2367
  const remoteFilesSet = new Set(
2321
- remoteFiles.map((f) => f.replace(/\\/g, "/"))
2368
+ remoteFiles.map((f) => {
2369
+ return f.replace(/\\/g, "/");
2370
+ })
2322
2371
  );
2323
2372
  const removedCount = await removeExtraFiles(cwd, remoteFilesSet);
2324
2373
  if (removedCount > 0) {
@@ -2396,14 +2445,23 @@ var listCommand2 = new Command18().name("list").alias("ls").description("List al
2396
2445
  );
2397
2446
  return;
2398
2447
  }
2399
- const nameWidth = Math.max(4, ...items.map((i) => i.name.length));
2448
+ const nameWidth = Math.max(
2449
+ 4,
2450
+ ...items.map((i) => {
2451
+ return i.name.length;
2452
+ })
2453
+ );
2400
2454
  const sizeWidth = Math.max(
2401
2455
  4,
2402
- ...items.map((i) => formatBytes(i.size).length)
2456
+ ...items.map((i) => {
2457
+ return formatBytes(i.size).length;
2458
+ })
2403
2459
  );
2404
2460
  const filesWidth = Math.max(
2405
2461
  5,
2406
- ...items.map((i) => i.fileCount.toString().length)
2462
+ ...items.map((i) => {
2463
+ return i.fileCount.toString().length;
2464
+ })
2407
2465
  );
2408
2466
  const header = [
2409
2467
  "NAME".padEnd(nameWidth),
@@ -2689,7 +2747,9 @@ var pullCommand2 = new Command23().name("pull").description("Pull cloud artifact
2689
2747
  console.log(chalk18.dim("Syncing local files..."));
2690
2748
  const remoteFiles = await listTarFiles(tarPath);
2691
2749
  const remoteFilesSet = new Set(
2692
- remoteFiles.map((f) => f.replace(/\\/g, "/"))
2750
+ remoteFiles.map((f) => {
2751
+ return f.replace(/\\/g, "/");
2752
+ })
2693
2753
  );
2694
2754
  const removedCount = await removeExtraFiles(cwd, remoteFilesSet);
2695
2755
  if (removedCount > 0) {
@@ -2769,14 +2829,23 @@ var listCommand3 = new Command25().name("list").alias("ls").description("List al
2769
2829
  );
2770
2830
  return;
2771
2831
  }
2772
- const nameWidth = Math.max(4, ...items.map((i) => i.name.length));
2832
+ const nameWidth = Math.max(
2833
+ 4,
2834
+ ...items.map((i) => {
2835
+ return i.name.length;
2836
+ })
2837
+ );
2773
2838
  const sizeWidth = Math.max(
2774
2839
  4,
2775
- ...items.map((i) => formatBytes(i.size).length)
2840
+ ...items.map((i) => {
2841
+ return formatBytes(i.size).length;
2842
+ })
2776
2843
  );
2777
2844
  const filesWidth = Math.max(
2778
2845
  5,
2779
- ...items.map((i) => i.fileCount.toString().length)
2846
+ ...items.map((i) => {
2847
+ return i.fileCount.toString().length;
2848
+ })
2780
2849
  );
2781
2850
  const header = [
2782
2851
  "NAME".padEnd(nameWidth),
@@ -3006,14 +3075,23 @@ var listCommand4 = new Command32().name("list").alias("ls").description("List al
3006
3075
  );
3007
3076
  return;
3008
3077
  }
3009
- const nameWidth = Math.max(4, ...items.map((i) => i.name.length));
3078
+ const nameWidth = Math.max(
3079
+ 4,
3080
+ ...items.map((i) => {
3081
+ return i.name.length;
3082
+ })
3083
+ );
3010
3084
  const sizeWidth = Math.max(
3011
3085
  4,
3012
- ...items.map((i) => formatBytes(i.size).length)
3086
+ ...items.map((i) => {
3087
+ return formatBytes(i.size).length;
3088
+ })
3013
3089
  );
3014
3090
  const filesWidth = Math.max(
3015
3091
  5,
3016
- ...items.map((i) => i.fileCount.toString().length)
3092
+ ...items.map((i) => {
3093
+ return i.fileCount.toString().length;
3094
+ })
3017
3095
  );
3018
3096
  const header = [
3019
3097
  "NAME".padEnd(nameWidth),
@@ -3394,7 +3472,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
3394
3472
  withErrorHandler(
3395
3473
  async (prompt, options) => {
3396
3474
  if (options.autoUpdate !== false) {
3397
- const shouldExit = await checkAndUpgrade("9.90.2", prompt);
3475
+ const shouldExit = await checkAndUpgrade("9.90.4", prompt);
3398
3476
  if (shouldExit) {
3399
3477
  process.exit(0);
3400
3478
  }
@@ -3923,7 +4001,9 @@ async function showAgentEvents(runId, options, platformUrl) {
3923
4001
  });
3924
4002
  return { items: response.events, hasMore: response.hasMore };
3925
4003
  },
3926
- getTimestamp: (event) => new Date(event.createdAt).getTime(),
4004
+ getTimestamp: (event) => {
4005
+ return new Date(event.createdAt).getTime();
4006
+ },
3927
4007
  targetCount: options.targetCount === "all" ? "all" : options.targetCount - firstResponse.events.length,
3928
4008
  initialSince: firstPageTimestamp
3929
4009
  });
@@ -3977,7 +4057,9 @@ async function showMetrics(runId, options) {
3977
4057
  });
3978
4058
  return { items: response.metrics, hasMore: response.hasMore };
3979
4059
  },
3980
- getTimestamp: (metric) => new Date(metric.ts).getTime(),
4060
+ getTimestamp: (metric) => {
4061
+ return new Date(metric.ts).getTime();
4062
+ },
3981
4063
  targetCount: options.targetCount === "all" ? "all" : options.targetCount - firstResponse.metrics.length,
3982
4064
  initialSince: firstPageTimestamp
3983
4065
  });
@@ -4020,7 +4102,9 @@ async function showNetworkLogs(runId, options) {
4020
4102
  });
4021
4103
  return { items: response.networkLogs, hasMore: response.hasMore };
4022
4104
  },
4023
- getTimestamp: (entry) => new Date(entry.timestamp).getTime(),
4105
+ getTimestamp: (entry) => {
4106
+ return new Date(entry.timestamp).getTime();
4107
+ },
4024
4108
  targetCount: options.targetCount === "all" ? "all" : options.targetCount - firstResponse.networkLogs.length,
4025
4109
  initialSince: firstPageTimestamp
4026
4110
  });
@@ -4146,13 +4230,13 @@ var upgradeCommand = new Command42().name("upgrade").description("Upgrade vm0 CL
4146
4230
  if (latestVersion === null) {
4147
4231
  throw new Error("Could not check for updates. Please try again later.");
4148
4232
  }
4149
- if (latestVersion === "9.90.2") {
4150
- console.log(chalk33.green(`\u2713 Already up to date (${"9.90.2"})`));
4233
+ if (latestVersion === "9.90.4") {
4234
+ console.log(chalk33.green(`\u2713 Already up to date (${"9.90.4"})`));
4151
4235
  return;
4152
4236
  }
4153
4237
  console.log(
4154
4238
  chalk33.yellow(
4155
- `Current version: ${"9.90.2"} -> Latest version: ${latestVersion}`
4239
+ `Current version: ${"9.90.4"} -> Latest version: ${latestVersion}`
4156
4240
  )
4157
4241
  );
4158
4242
  console.log();
@@ -4179,7 +4263,7 @@ var upgradeCommand = new Command42().name("upgrade").description("Upgrade vm0 CL
4179
4263
  const success = await performUpgrade(packageManager);
4180
4264
  if (success) {
4181
4265
  console.log(
4182
- chalk33.green(`\u2713 Upgraded from ${"9.90.2"} to ${latestVersion}`)
4266
+ chalk33.green(`\u2713 Upgraded from ${"9.90.4"} to ${latestVersion}`)
4183
4267
  );
4184
4268
  return;
4185
4269
  }
@@ -4247,7 +4331,7 @@ var whoamiCommand = new Command43().name("whoami").description("Show current ide
4247
4331
 
4248
4332
  // src/index.ts
4249
4333
  var program = new Command44();
4250
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.90.2");
4334
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.90.4");
4251
4335
  program.addCommand(authCommand);
4252
4336
  program.addCommand(infoCommand);
4253
4337
  program.addCommand(composeCommand);