@vm0/cli 9.90.3 → 9.90.5

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