@vm0/cli 9.84.4 → 9.84.6

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
@@ -51,7 +51,7 @@ import {
51
51
  searchLogs,
52
52
  volumeConfigSchema,
53
53
  withErrorHandler
54
- } from "./chunk-ANZYCH6W.js";
54
+ } from "./chunk-ANZUWHEL.js";
55
55
 
56
56
  // src/index.ts
57
57
  import { Command as Command44 } from "commander";
@@ -436,7 +436,7 @@ function getConfigPath() {
436
436
  return join(homedir(), ".vm0", "config.json");
437
437
  }
438
438
  var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
439
- console.log(chalk3.bold(`VM0 CLI v${"9.84.4"}`));
439
+ console.log(chalk3.bold(`VM0 CLI v${"9.84.6"}`));
440
440
  console.log();
441
441
  const config = await loadConfig();
442
442
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -1373,111 +1373,6 @@ async function uploadAssets(agentName, agent, basePath, jsonMode) {
1373
1373
  }
1374
1374
  return skillResults;
1375
1375
  }
1376
- async function collectSkillVariables(skillResults, environment, agentName, options) {
1377
- const skillSecrets = /* @__PURE__ */ new Map();
1378
- const skillVars = /* @__PURE__ */ new Map();
1379
- for (const result of skillResults) {
1380
- const { frontmatter, skillName } = result;
1381
- if (frontmatter.vm0_secrets) {
1382
- for (const secret of frontmatter.vm0_secrets) {
1383
- if (!skillSecrets.has(secret)) {
1384
- skillSecrets.set(secret, []);
1385
- }
1386
- skillSecrets.get(secret).push(skillName);
1387
- }
1388
- }
1389
- if (frontmatter.vm0_vars) {
1390
- for (const varName of frontmatter.vm0_vars) {
1391
- if (!skillVars.has(varName)) {
1392
- skillVars.set(varName, []);
1393
- }
1394
- skillVars.get(varName).push(skillName);
1395
- }
1396
- }
1397
- }
1398
- const newSecrets = [...skillSecrets.entries()].filter(
1399
- ([name]) => !(name in environment)
1400
- );
1401
- const newVars = [...skillVars.entries()].filter(
1402
- ([name]) => !(name in environment)
1403
- );
1404
- let trulyNewSecrets = [];
1405
- if (!options.json) {
1406
- let headSecrets = /* @__PURE__ */ new Set();
1407
- const existingCompose = await getComposeByName(agentName);
1408
- if (existingCompose?.content) {
1409
- headSecrets = getSecretsFromComposeContent(existingCompose.content);
1410
- }
1411
- trulyNewSecrets = newSecrets.map(([name]) => name).filter((name) => !headSecrets.has(name));
1412
- }
1413
- return { newSecrets, newVars, trulyNewSecrets };
1414
- }
1415
- async function displayAndConfirmVariables(variables, options) {
1416
- const { newSecrets, newVars, trulyNewSecrets } = variables;
1417
- if (newSecrets.length === 0 && newVars.length === 0) {
1418
- return true;
1419
- }
1420
- if (!options.json) {
1421
- console.log();
1422
- console.log(
1423
- chalk4.bold("Skills require the following environment variables:")
1424
- );
1425
- console.log();
1426
- if (newSecrets.length > 0) {
1427
- console.log(chalk4.cyan(" Secrets:"));
1428
- for (const [name, skills] of newSecrets) {
1429
- const isNew = trulyNewSecrets.includes(name);
1430
- const newMarker = isNew ? chalk4.yellow(" (new)") : "";
1431
- console.log(
1432
- ` ${name.padEnd(24)}${newMarker} <- ${skills.join(", ")}`
1433
- );
1434
- }
1435
- }
1436
- if (newVars.length > 0) {
1437
- console.log(chalk4.cyan(" Vars:"));
1438
- for (const [name, skills] of newVars) {
1439
- console.log(` ${name.padEnd(24)} <- ${skills.join(", ")}`);
1440
- }
1441
- }
1442
- console.log();
1443
- }
1444
- if (trulyNewSecrets.length > 0 && !options.yes) {
1445
- if (!isInteractive()) {
1446
- throw new Error(`New secrets detected: ${trulyNewSecrets.join(", ")}`, {
1447
- cause: new Error(
1448
- "Use --yes flag to approve new secrets in non-interactive mode."
1449
- )
1450
- });
1451
- }
1452
- const confirmed = await promptConfirm(
1453
- `Approve ${trulyNewSecrets.length} new secret(s)?`,
1454
- true
1455
- );
1456
- if (!confirmed) {
1457
- if (!options.json) {
1458
- console.log(chalk4.yellow("Compose cancelled"));
1459
- }
1460
- return false;
1461
- }
1462
- }
1463
- return true;
1464
- }
1465
- function mergeSkillVariables(agent, variables) {
1466
- const { newSecrets, newVars } = variables;
1467
- if (newSecrets.length === 0 && newVars.length === 0) {
1468
- return;
1469
- }
1470
- const environment = agent.environment || {};
1471
- for (const [name] of newSecrets) {
1472
- environment[name] = `\${{ secrets.${name} }}`;
1473
- }
1474
- for (const [name] of newVars) {
1475
- environment[name] = `\${{ vars.${name} }}`;
1476
- }
1477
- if (Object.keys(environment).length > 0) {
1478
- agent.environment = environment;
1479
- }
1480
- }
1481
1376
  async function checkAndPromptMissingItems(config, options) {
1482
1377
  const requiredSecrets = getSecretsFromComposeContent(config);
1483
1378
  const requiredVars = getVarsFromComposeContent(config);
@@ -1520,12 +1415,7 @@ async function checkAndPromptMissingItems(config, options) {
1520
1415
  }
1521
1416
  return { missingSecrets, missingVars };
1522
1417
  }
1523
- async function finalizeCompose(config, agent, variables, options) {
1524
- const confirmed = await displayAndConfirmVariables(variables, options);
1525
- if (!confirmed) {
1526
- process.exit(0);
1527
- }
1528
- mergeSkillVariables(agent, variables);
1418
+ async function finalizeCompose(config, agent, options) {
1529
1419
  await expandFirewallConfigs(config);
1530
1420
  if (!options.json) {
1531
1421
  console.log("Uploading compose...");
@@ -1619,20 +1509,8 @@ async function handleGitHubCompose(url, options) {
1619
1509
  )
1620
1510
  });
1621
1511
  }
1622
- const skillResults = await uploadAssets(
1623
- agentName,
1624
- agent,
1625
- basePath,
1626
- options.json
1627
- );
1628
- const environment = agent.environment || {};
1629
- const variables = await collectSkillVariables(
1630
- skillResults,
1631
- environment,
1632
- agentName,
1633
- options
1634
- );
1635
- return await finalizeCompose(config, agent, variables, options);
1512
+ await uploadAssets(agentName, agent, basePath, options.json);
1513
+ return await finalizeCompose(config, agent, options);
1636
1514
  } finally {
1637
1515
  await rm3(tempRoot, { recursive: true, force: true });
1638
1516
  }
@@ -1640,7 +1518,7 @@ async function handleGitHubCompose(url, options) {
1640
1518
  var composeCommand = new Command7().name("compose").description("Create or update agent compose (e.g., vm0.yaml)").argument(
1641
1519
  "[agent-yaml]",
1642
1520
  `Path to agent YAML file or GitHub tree URL (default: ${DEFAULT_CONFIG_FILE})`
1643
- ).option("-y, --yes", "Skip confirmation prompts for skill requirements").option(
1521
+ ).option("-y, --yes", "Skip confirmation prompts").option(
1644
1522
  "--experimental-shared-compose",
1645
1523
  "[deprecated] No longer required, kept for backward compatibility"
1646
1524
  ).option("--json", "Output JSON for scripts (suppresses interactive output)").option(
@@ -1662,7 +1540,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
1662
1540
  options.autoUpdate = false;
1663
1541
  }
1664
1542
  if (options.autoUpdate !== false) {
1665
- await startSilentUpgrade("9.84.4");
1543
+ await startSilentUpgrade("9.84.6");
1666
1544
  }
1667
1545
  try {
1668
1546
  let result;
@@ -1670,20 +1548,8 @@ var composeCommand = new Command7().name("compose").description("Create or updat
1670
1548
  result = await handleGitHubCompose(resolvedConfigFile, options);
1671
1549
  } else {
1672
1550
  const { config, agentName, agent, basePath } = await loadAndValidateConfig(resolvedConfigFile);
1673
- const skillResults = await uploadAssets(
1674
- agentName,
1675
- agent,
1676
- basePath,
1677
- options.json
1678
- );
1679
- const environment = agent.environment || {};
1680
- const variables = await collectSkillVariables(
1681
- skillResults,
1682
- environment,
1683
- agentName,
1684
- options
1685
- );
1686
- result = await finalizeCompose(config, agent, variables, options);
1551
+ await uploadAssets(agentName, agent, basePath, options.json);
1552
+ result = await finalizeCompose(config, agent, options);
1687
1553
  }
1688
1554
  if (options.json) {
1689
1555
  console.log(JSON.stringify(result));
@@ -2497,7 +2363,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
2497
2363
  withErrorHandler(
2498
2364
  async (identifier, prompt, options) => {
2499
2365
  if (options.autoUpdate !== false) {
2500
- await startSilentUpgrade("9.84.4");
2366
+ await startSilentUpgrade("9.84.6");
2501
2367
  }
2502
2368
  const { org, name, version } = parseIdentifier(identifier);
2503
2369
  let composeId;
@@ -4253,7 +4119,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
4253
4119
  withErrorHandler(
4254
4120
  async (prompt, options) => {
4255
4121
  if (options.autoUpdate !== false) {
4256
- const shouldExit = await checkAndUpgrade("9.84.4", prompt);
4122
+ const shouldExit = await checkAndUpgrade("9.84.6", prompt);
4257
4123
  if (shouldExit) {
4258
4124
  process.exit(0);
4259
4125
  }
@@ -4993,13 +4859,13 @@ var upgradeCommand = new Command42().name("upgrade").description("Upgrade vm0 CL
4993
4859
  if (latestVersion === null) {
4994
4860
  throw new Error("Could not check for updates. Please try again later.");
4995
4861
  }
4996
- if (latestVersion === "9.84.4") {
4997
- console.log(chalk36.green(`\u2713 Already up to date (${"9.84.4"})`));
4862
+ if (latestVersion === "9.84.6") {
4863
+ console.log(chalk36.green(`\u2713 Already up to date (${"9.84.6"})`));
4998
4864
  return;
4999
4865
  }
5000
4866
  console.log(
5001
4867
  chalk36.yellow(
5002
- `Current version: ${"9.84.4"} -> Latest version: ${latestVersion}`
4868
+ `Current version: ${"9.84.6"} -> Latest version: ${latestVersion}`
5003
4869
  )
5004
4870
  );
5005
4871
  console.log();
@@ -5026,7 +4892,7 @@ var upgradeCommand = new Command42().name("upgrade").description("Upgrade vm0 CL
5026
4892
  const success = await performUpgrade(packageManager);
5027
4893
  if (success) {
5028
4894
  console.log(
5029
- chalk36.green(`\u2713 Upgraded from ${"9.84.4"} to ${latestVersion}`)
4895
+ chalk36.green(`\u2713 Upgraded from ${"9.84.6"} to ${latestVersion}`)
5030
4896
  );
5031
4897
  return;
5032
4898
  }
@@ -5094,7 +4960,7 @@ var whoamiCommand = new Command43().name("whoami").description("Show current ide
5094
4960
 
5095
4961
  // src/index.ts
5096
4962
  var program = new Command44();
5097
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.84.4");
4963
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.84.6");
5098
4964
  program.addCommand(authCommand);
5099
4965
  program.addCommand(infoCommand);
5100
4966
  program.addCommand(composeCommand);