@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.90.2",
3
+ "version": "9.90.4",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -101,7 +101,7 @@ import {
101
101
  updateZeroUserPreferences,
102
102
  upsertZeroOrgModelProvider,
103
103
  withErrorHandler
104
- } from "./chunk-VO3BTEUW.js";
104
+ } from "./chunk-XQKSWAGW.js";
105
105
 
106
106
  // src/zero.ts
107
107
  import { Command as Command68 } from "commander";
@@ -191,7 +191,9 @@ import chalk4 from "chalk";
191
191
  var useCommand = new Command4().name("use").description("Switch to a different organization").argument("<slug>", "Organization slug to switch to").action(
192
192
  withErrorHandler(async (slug) => {
193
193
  const orgList = await listZeroOrgs();
194
- const target = orgList.orgs.find((s) => s.slug === slug);
194
+ const target = orgList.orgs.find((s) => {
195
+ return s.slug === slug;
196
+ });
195
197
  if (!target) {
196
198
  throw new Error(`Organization '${slug}' not found or not accessible.`);
197
199
  }
@@ -607,7 +609,11 @@ function validateSecrets(type, authMethod, secrets) {
607
609
  }
608
610
  for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
609
611
  if (fieldConfig.required && !secrets[name]) {
610
- const requiredNames = Object.entries(secretsConfig).filter(([, fc]) => fc.required).map(([n]) => n).join(", ");
612
+ const requiredNames = Object.entries(secretsConfig).filter(([, fc]) => {
613
+ return fc.required;
614
+ }).map(([n]) => {
615
+ return n;
616
+ }).join(", ");
611
617
  throw new Error(`Missing required secret: ${name}`, {
612
618
  cause: new Error(`Required secrets: ${requiredNames}`)
613
619
  });
@@ -712,7 +718,11 @@ async function promptForModelSelection(type) {
712
718
  message: "Select model:",
713
719
  choices: modelChoices
714
720
  },
715
- { onCancel: () => process.exit(0) }
721
+ {
722
+ onCancel: () => {
723
+ return process.exit(0);
724
+ }
725
+ }
716
726
  );
717
727
  const selected = modelResponse.model;
718
728
  if (selected === "__custom__") {
@@ -725,9 +735,15 @@ async function promptForModelSelection(type) {
725
735
  type: "text",
726
736
  name: "customModel",
727
737
  message: "Enter model ID:",
728
- validate: (value) => value.length > 0 || "Model ID is required"
738
+ validate: (value) => {
739
+ return value.length > 0 || "Model ID is required";
740
+ }
729
741
  },
730
- { onCancel: () => process.exit(0) }
742
+ {
743
+ onCancel: () => {
744
+ return process.exit(0);
745
+ }
746
+ }
731
747
  );
732
748
  return customResponse.customModel;
733
749
  }
@@ -739,10 +755,12 @@ async function promptForAuthMethod(type) {
739
755
  if (!authMethods) {
740
756
  return "default";
741
757
  }
742
- const choices = Object.entries(authMethods).map(([method, config]) => ({
743
- title: method === defaultAuthMethod ? `${config.label} (Recommended)` : config.label,
744
- value: method
745
- }));
758
+ const choices = Object.entries(authMethods).map(([method, config]) => {
759
+ return {
760
+ title: method === defaultAuthMethod ? `${config.label} (Recommended)` : config.label,
761
+ value: method
762
+ };
763
+ });
746
764
  const response = await prompts(
747
765
  {
748
766
  type: "select",
@@ -750,15 +768,19 @@ async function promptForAuthMethod(type) {
750
768
  message: "Select authentication method:",
751
769
  choices
752
770
  },
753
- { onCancel: () => process.exit(0) }
771
+ {
772
+ onCancel: () => {
773
+ return process.exit(0);
774
+ }
775
+ }
754
776
  );
755
777
  return response.authMethod;
756
778
  }
757
779
  function isSensitiveSecret(name) {
758
780
  const nonSecretPatterns = ["REGION", "ENDPOINT", "URL"];
759
- return !nonSecretPatterns.some(
760
- (pattern) => name.toUpperCase().includes(pattern)
761
- );
781
+ return !nonSecretPatterns.some((pattern) => {
782
+ return name.toUpperCase().includes(pattern);
783
+ });
762
784
  }
763
785
  async function promptForSecrets(type, authMethod) {
764
786
  const secretsConfig = getSecretsForAuthMethod(type, authMethod);
@@ -779,9 +801,15 @@ async function promptForSecrets(type, authMethod) {
779
801
  name: "value",
780
802
  message: `${fieldConfig.label}:`,
781
803
  initial: placeholder ? "" : void 0,
782
- validate: (value) => value.length > 0 || `${fieldConfig.label} is required`
804
+ validate: (value) => {
805
+ return value.length > 0 || `${fieldConfig.label} is required`;
806
+ }
783
807
  },
784
- { onCancel: () => process.exit(0) }
808
+ {
809
+ onCancel: () => {
810
+ return process.exit(0);
811
+ }
812
+ }
785
813
  );
786
814
  secrets[name] = response.value;
787
815
  } else {
@@ -791,7 +819,11 @@ async function promptForSecrets(type, authMethod) {
791
819
  name: "value",
792
820
  message: `${fieldConfig.label} (optional):`
793
821
  },
794
- { onCancel: () => process.exit(0) }
822
+ {
823
+ onCancel: () => {
824
+ return process.exit(0);
825
+ }
826
+ }
795
827
  );
796
828
  const value = response.value;
797
829
  if (value && value.trim()) {
@@ -820,7 +852,11 @@ async function handleInteractiveMode() {
820
852
  return false;
821
853
  };
822
854
  const { modelProviders: configuredProviders } = await listZeroOrgModelProviders();
823
- const configuredTypes = new Set(configuredProviders.map((p) => p.type));
855
+ const configuredTypes = new Set(
856
+ configuredProviders.map((p) => {
857
+ return p.type;
858
+ })
859
+ );
824
860
  const annotatedChoices = getSelectableProviderTypes().map((type2) => {
825
861
  const config2 = MODEL_PROVIDER_TYPES[type2];
826
862
  const isConfigured = configuredTypes.has(type2);
@@ -851,7 +887,9 @@ async function handleInteractiveMode() {
851
887
  return null;
852
888
  }
853
889
  const type = typeResponse.type;
854
- const existingProvider = configuredProviders.find((p) => p.type === type);
890
+ const existingProvider = configuredProviders.find((p) => {
891
+ return p.type === type;
892
+ });
855
893
  if (existingProvider) {
856
894
  console.log();
857
895
  console.log(`"${type}" is already configured`);
@@ -906,7 +944,9 @@ async function handleInteractiveMode() {
906
944
  type: "password",
907
945
  name: "secret",
908
946
  message: `Enter your ${secretLabel}:`,
909
- validate: (value) => value.length > 0 || `${secretLabel} is required`
947
+ validate: (value) => {
948
+ return value.length > 0 || `${secretLabel} is required`;
949
+ }
910
950
  },
911
951
  { onCancel }
912
952
  );
@@ -1098,7 +1138,9 @@ Examples:
1098
1138
  ).action(
1099
1139
  withErrorHandler(
1100
1140
  async (options) => {
1101
- const customSkills = options.skills ? options.skills.split(",").map((s) => s.trim()) : void 0;
1141
+ const customSkills = options.skills ? options.skills.split(",").map((s) => {
1142
+ return s.trim();
1143
+ }) : void 0;
1102
1144
  const agent = await createZeroAgent({
1103
1145
  displayName: options.displayName,
1104
1146
  description: options.description,
@@ -1106,7 +1148,9 @@ Examples:
1106
1148
  customSkills
1107
1149
  });
1108
1150
  if (options.connectors) {
1109
- const connectors = options.connectors.split(",").map((s) => s.trim());
1151
+ const connectors = options.connectors.split(",").map((s) => {
1152
+ return s.trim();
1153
+ });
1110
1154
  await setZeroAgentUserConnectors(agent.agentId, connectors);
1111
1155
  }
1112
1156
  if (options.instructionsFile) {
@@ -1137,7 +1181,9 @@ function resolveCustomSkills(options, existing) {
1137
1181
  throw new Error("Cannot use --skills with --add-skill or --remove-skill");
1138
1182
  }
1139
1183
  if (options.skills) {
1140
- return options.skills.split(",").map((s) => s.trim());
1184
+ return options.skills.split(",").map((s) => {
1185
+ return s.trim();
1186
+ });
1141
1187
  }
1142
1188
  if (options.addSkill) {
1143
1189
  if (existing.includes(options.addSkill)) {
@@ -1153,7 +1199,9 @@ function resolveCustomSkills(options, existing) {
1153
1199
  `Skill "${options.removeSkill}" is not attached to this agent`
1154
1200
  );
1155
1201
  }
1156
- return existing.filter((s) => s !== options.removeSkill);
1202
+ return existing.filter((s) => {
1203
+ return s !== options.removeSkill;
1204
+ });
1157
1205
  }
1158
1206
  return void 0;
1159
1207
  }
@@ -1275,10 +1323,17 @@ Notes:
1275
1323
  );
1276
1324
  return;
1277
1325
  }
1278
- const idWidth = Math.max(8, ...agents.map((a) => a.agentId.length));
1326
+ const idWidth = Math.max(
1327
+ 8,
1328
+ ...agents.map((a) => {
1329
+ return a.agentId.length;
1330
+ })
1331
+ );
1279
1332
  const displayWidth = Math.max(
1280
1333
  12,
1281
- ...agents.map((a) => (a.displayName ?? "").length)
1334
+ ...agents.map((a) => {
1335
+ return (a.displayName ?? "").length;
1336
+ })
1282
1337
  );
1283
1338
  const header = [
1284
1339
  "AGENT ID".padEnd(idWidth),
@@ -1403,7 +1458,9 @@ async function getRandomPort() {
1403
1458
  const server = createServer();
1404
1459
  server.listen(0, "127.0.0.1", () => {
1405
1460
  const { port } = server.address();
1406
- server.close(() => resolve(port));
1461
+ server.close(() => {
1462
+ return resolve(port);
1463
+ });
1407
1464
  });
1408
1465
  server.on("error", reject);
1409
1466
  });
@@ -1419,7 +1476,9 @@ async function findBinary(...candidates) {
1419
1476
  } else {
1420
1477
  const found = await new Promise((resolve) => {
1421
1478
  const child = spawn("which", [candidate]);
1422
- child.on("close", (code) => resolve(code === 0));
1479
+ child.on("close", (code) => {
1480
+ return resolve(code === 0);
1481
+ });
1423
1482
  });
1424
1483
  if (found) return candidate;
1425
1484
  }
@@ -1464,8 +1523,12 @@ async function startComputerServices(credentials) {
1464
1523
  ],
1465
1524
  { stdio: ["ignore", "pipe", "pipe"] }
1466
1525
  );
1467
- wsgidav.stdout?.on("data", (data) => process.stdout.write(data));
1468
- wsgidav.stderr?.on("data", (data) => process.stderr.write(data));
1526
+ wsgidav.stdout?.on("data", (data) => {
1527
+ return process.stdout.write(data);
1528
+ });
1529
+ wsgidav.stderr?.on("data", (data) => {
1530
+ return process.stderr.write(data);
1531
+ });
1469
1532
  console.log(chalk26.green("\u2713 WebDAV server started"));
1470
1533
  const chrome = spawn(
1471
1534
  chromeBinary,
@@ -1478,8 +1541,12 @@ async function startComputerServices(credentials) {
1478
1541
  ],
1479
1542
  { stdio: ["ignore", "pipe", "pipe"] }
1480
1543
  );
1481
- chrome.stdout?.on("data", (data) => process.stdout.write(data));
1482
- chrome.stderr?.on("data", (data) => process.stderr.write(data));
1544
+ chrome.stdout?.on("data", (data) => {
1545
+ return process.stdout.write(data);
1546
+ });
1547
+ chrome.stderr?.on("data", (data) => {
1548
+ return process.stderr.write(data);
1549
+ });
1483
1550
  console.log(chalk26.green("\u2713 Chrome started"));
1484
1551
  try {
1485
1552
  await startNgrokTunnels(
@@ -1534,16 +1601,18 @@ async function startComputerServices(credentials) {
1534
1601
 
1535
1602
  // src/commands/zero/connector/connect.ts
1536
1603
  function delay(ms) {
1537
- return new Promise((resolve) => setTimeout(resolve, ms));
1604
+ return new Promise((resolve) => {
1605
+ return setTimeout(resolve, ms);
1606
+ });
1538
1607
  }
1539
1608
  function renderHelpText(text) {
1540
- return text.replace(
1541
- /\[([^\]]+)\]\(([^)]+)\)/g,
1542
- (_m, label, url) => `${label} (${chalk27.cyan(url)})`
1543
- ).replace(/\*\*([^*]+)\*\*/g, (_m, content) => chalk27.bold(content)).replace(
1544
- /^> (.+)$/gm,
1545
- (_m, content) => chalk27.yellow(` ${content}`)
1546
- );
1609
+ return text.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_m, label, url) => {
1610
+ return `${label} (${chalk27.cyan(url)})`;
1611
+ }).replace(/\*\*([^*]+)\*\*/g, (_m, content) => {
1612
+ return chalk27.bold(content);
1613
+ }).replace(/^> (.+)$/gm, (_m, content) => {
1614
+ return chalk27.yellow(` ${content}`);
1615
+ });
1547
1616
  }
1548
1617
  async function connectViaApiToken(connectorType, tokenValue) {
1549
1618
  const config = CONNECTOR_TYPES[connectorType];
@@ -1706,7 +1775,11 @@ import chalk28 from "chalk";
1706
1775
  var listCommand6 = new Command31().name("list").alias("ls").description("List all connectors and their status").action(
1707
1776
  withErrorHandler(async () => {
1708
1777
  const result = await listZeroConnectors();
1709
- const connectedMap = new Map(result.connectors.map((c) => [c.type, c]));
1778
+ const connectedMap = new Map(
1779
+ result.connectors.map((c) => {
1780
+ return [c.type, c];
1781
+ })
1782
+ );
1710
1783
  const orgId = await getActiveOrg();
1711
1784
  const allTypesRaw = Object.keys(CONNECTOR_TYPES);
1712
1785
  const allTypes = [];
@@ -1718,7 +1791,12 @@ var listCommand6 = new Command31().name("list").alias("ls").description("List al
1718
1791
  }
1719
1792
  allTypes.push(type);
1720
1793
  }
1721
- const typeWidth = Math.max(4, ...allTypes.map((t) => t.length));
1794
+ const typeWidth = Math.max(
1795
+ 4,
1796
+ ...allTypes.map((t) => {
1797
+ return t.length;
1798
+ })
1799
+ );
1722
1800
  const statusText = "STATUS";
1723
1801
  const statusWidth = statusText.length;
1724
1802
  const header = [
@@ -1998,8 +2076,12 @@ Notes:
1998
2076
  const platformUrl = toPlatformUrl(apiUrl);
1999
2077
  const agentId = process.env.ZERO_AGENT_ID;
2000
2078
  const [connector, enabledTypes] = await Promise.all([
2001
- getZeroConnector(connectorType).catch(() => null),
2002
- agentId ? getZeroAgentUserConnectors(agentId).catch(() => null) : Promise.resolve(null)
2079
+ getZeroConnector(connectorType).catch(() => {
2080
+ return null;
2081
+ }),
2082
+ agentId ? getZeroAgentUserConnectors(agentId).catch(() => {
2083
+ return null;
2084
+ }) : Promise.resolve(null)
2003
2085
  ]);
2004
2086
  const isConnected = connector !== null;
2005
2087
  const hasPermission = enabledTypes !== null && enabledTypes.includes(connectorType);
@@ -2213,7 +2295,9 @@ async function pollZeroEvents(runId, options) {
2213
2295
  }
2214
2296
  if (eventsResponse.events.length > 0) {
2215
2297
  lastSequence = Math.max(
2216
- ...eventsResponse.events.map((e) => e.sequenceNumber)
2298
+ ...eventsResponse.events.map((e) => {
2299
+ return e.sequenceNumber;
2300
+ })
2217
2301
  );
2218
2302
  }
2219
2303
  const runResponse = await getZeroRun(runId);
@@ -2243,7 +2327,9 @@ async function pollZeroEvents(runId, options) {
2243
2327
  result = { succeeded: false, runId };
2244
2328
  }
2245
2329
  if (!complete) {
2246
- await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
2330
+ await new Promise((resolve) => {
2331
+ return setTimeout(resolve, pollIntervalMs);
2332
+ });
2247
2333
  }
2248
2334
  }
2249
2335
  return result;
@@ -2442,7 +2528,11 @@ function formatInTimezone(isoDate, timezone) {
2442
2528
  minute: "2-digit",
2443
2529
  hour12: false
2444
2530
  }).formatToParts(date);
2445
- const get = (type) => parts.find((p) => p.type === type)?.value ?? "";
2531
+ const get = (type) => {
2532
+ return parts.find((p) => {
2533
+ return p.type === type;
2534
+ })?.value ?? "";
2535
+ };
2446
2536
  return `${get("year")}-${get("month")}-${get("day")} ${get("hour")}:${get("minute")}`;
2447
2537
  }
2448
2538
  function parseFrequencyFromCron(cron) {
@@ -2484,7 +2574,9 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
2484
2574
  if (!isInteractive()) {
2485
2575
  throw new Error("--frequency is required (daily|weekly|monthly|once|loop)");
2486
2576
  }
2487
- const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c) => c.value === existingFrequency) : 0;
2577
+ const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c) => {
2578
+ return c.value === existingFrequency;
2579
+ }) : 0;
2488
2580
  frequency = await promptSelect(
2489
2581
  "Schedule frequency",
2490
2582
  FREQUENCY_CHOICES,
@@ -2509,7 +2601,9 @@ async function gatherDay(frequency, optionDay, existingDay) {
2509
2601
  throw new Error("--day is required for weekly/monthly");
2510
2602
  }
2511
2603
  if (frequency === "weekly") {
2512
- const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c) => c.value === existingDay) : 0;
2604
+ const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c) => {
2605
+ return c.value === existingDay;
2606
+ }) : 0;
2513
2607
  const day2 = await promptSelect(
2514
2608
  "Day of week",
2515
2609
  DAY_OF_WEEK_CHOICES,
@@ -2707,9 +2801,9 @@ async function gatherTiming(frequency, options, defaults) {
2707
2801
  }
2708
2802
  async function findExistingSchedule(agentId, scheduleName) {
2709
2803
  const { schedules } = await listZeroSchedules();
2710
- return schedules.find(
2711
- (s) => s.agentId === agentId && s.name === scheduleName
2712
- );
2804
+ return schedules.find((s) => {
2805
+ return s.agentId === agentId && s.name === scheduleName;
2806
+ });
2713
2807
  }
2714
2808
  async function buildAndDeploy(params) {
2715
2809
  let cronExpression;
@@ -2944,17 +3038,21 @@ Examples:
2944
3038
  }
2945
3039
  const agentWidth = Math.max(
2946
3040
  5,
2947
- ...result.schedules.map((s) => s.agentId.length)
3041
+ ...result.schedules.map((s) => {
3042
+ return s.agentId.length;
3043
+ })
2948
3044
  );
2949
3045
  const scheduleWidth = Math.max(
2950
3046
  8,
2951
- ...result.schedules.map((s) => s.name.length)
3047
+ ...result.schedules.map((s) => {
3048
+ return s.name.length;
3049
+ })
2952
3050
  );
2953
3051
  const triggerWidth = Math.max(
2954
3052
  7,
2955
- ...result.schedules.map(
2956
- (s) => s.cronExpression ? s.cronExpression.length + s.timezone.length + 3 : s.atTime?.length || 0
2957
- )
3053
+ ...result.schedules.map((s) => {
3054
+ return s.cronExpression ? s.cronExpression.length + s.timezone.length + 3 : s.atTime?.length || 0;
3055
+ })
2958
3056
  );
2959
3057
  const header = [
2960
3058
  "AGENT".padEnd(agentWidth),
@@ -3614,7 +3712,9 @@ Notes:
3614
3712
  if (response.status === "expired") {
3615
3713
  throw new Error("Question expired before user responded");
3616
3714
  }
3617
- await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
3715
+ await new Promise((resolve) => {
3716
+ return setTimeout(resolve, pollIntervalMs);
3717
+ });
3618
3718
  }
3619
3719
  throw new Error(
3620
3720
  `Timed out waiting for user response after ${options.timeout}s`
@@ -3750,10 +3850,17 @@ Examples:
3750
3850
  );
3751
3851
  return;
3752
3852
  }
3753
- const nameWidth = Math.max(4, ...skills.map((s) => s.name.length));
3853
+ const nameWidth = Math.max(
3854
+ 4,
3855
+ ...skills.map((s) => {
3856
+ return s.name.length;
3857
+ })
3858
+ );
3754
3859
  const displayWidth = Math.max(
3755
3860
  12,
3756
- ...skills.map((s) => (s.displayName ?? "").length)
3861
+ ...skills.map((s) => {
3862
+ return (s.displayName ?? "").length;
3863
+ })
3757
3864
  );
3758
3865
  const header = [
3759
3866
  "NAME".padEnd(nameWidth),
@@ -3866,7 +3973,7 @@ function registerZeroCommands(prog, commands) {
3866
3973
  var program = new Command68();
3867
3974
  program.name("zero").description(
3868
3975
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
3869
- ).version("9.90.2").addHelpText(
3976
+ ).version("9.90.4").addHelpText(
3870
3977
  "after",
3871
3978
  `
3872
3979
  Examples: