@vm0/cli 9.84.7 → 9.85.1

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-2D3ANUQI.js";
54
+ } from "./chunk-FEUDHROP.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.7"}`));
439
+ console.log(chalk3.bold(`VM0 CLI v${"9.85.1"}`));
440
440
  console.log();
441
441
  const config = await loadConfig();
442
442
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -1540,7 +1540,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
1540
1540
  options.autoUpdate = false;
1541
1541
  }
1542
1542
  if (options.autoUpdate !== false) {
1543
- await startSilentUpgrade("9.84.7");
1543
+ await startSilentUpgrade("9.85.1");
1544
1544
  }
1545
1545
  try {
1546
1546
  let result;
@@ -2363,7 +2363,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
2363
2363
  withErrorHandler(
2364
2364
  async (identifier, prompt, options) => {
2365
2365
  if (options.autoUpdate !== false) {
2366
- await startSilentUpgrade("9.84.7");
2366
+ await startSilentUpgrade("9.85.1");
2367
2367
  }
2368
2368
  const { org, name, version } = parseIdentifier(identifier);
2369
2369
  let composeId;
@@ -4119,7 +4119,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
4119
4119
  withErrorHandler(
4120
4120
  async (prompt, options) => {
4121
4121
  if (options.autoUpdate !== false) {
4122
- const shouldExit = await checkAndUpgrade("9.84.7", prompt);
4122
+ const shouldExit = await checkAndUpgrade("9.85.1", prompt);
4123
4123
  if (shouldExit) {
4124
4124
  process.exit(0);
4125
4125
  }
@@ -4859,13 +4859,13 @@ var upgradeCommand = new Command42().name("upgrade").description("Upgrade vm0 CL
4859
4859
  if (latestVersion === null) {
4860
4860
  throw new Error("Could not check for updates. Please try again later.");
4861
4861
  }
4862
- if (latestVersion === "9.84.7") {
4863
- console.log(chalk36.green(`\u2713 Already up to date (${"9.84.7"})`));
4862
+ if (latestVersion === "9.85.1") {
4863
+ console.log(chalk36.green(`\u2713 Already up to date (${"9.85.1"})`));
4864
4864
  return;
4865
4865
  }
4866
4866
  console.log(
4867
4867
  chalk36.yellow(
4868
- `Current version: ${"9.84.7"} -> Latest version: ${latestVersion}`
4868
+ `Current version: ${"9.85.1"} -> Latest version: ${latestVersion}`
4869
4869
  )
4870
4870
  );
4871
4871
  console.log();
@@ -4892,7 +4892,7 @@ var upgradeCommand = new Command42().name("upgrade").description("Upgrade vm0 CL
4892
4892
  const success = await performUpgrade(packageManager);
4893
4893
  if (success) {
4894
4894
  console.log(
4895
- chalk36.green(`\u2713 Upgraded from ${"9.84.7"} to ${latestVersion}`)
4895
+ chalk36.green(`\u2713 Upgraded from ${"9.85.1"} to ${latestVersion}`)
4896
4896
  );
4897
4897
  return;
4898
4898
  }
@@ -4960,7 +4960,7 @@ var whoamiCommand = new Command43().name("whoami").description("Show current ide
4960
4960
 
4961
4961
  // src/index.ts
4962
4962
  var program = new Command44();
4963
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.84.7");
4963
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.85.1");
4964
4964
  program.addCommand(authCommand);
4965
4965
  program.addCommand(infoCommand);
4966
4966
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.84.7",
3
+ "version": "9.85.1",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -25,9 +25,9 @@ import {
25
25
  enableZeroSchedule,
26
26
  getActiveOrg,
27
27
  getApiUrl,
28
+ getAskUserAnswer,
28
29
  getAuthMethodsForType,
29
30
  getBaseUrl,
30
- getComposeByName,
31
31
  getConnectorDerivedNames,
32
32
  getConnectorTypeForSecretName,
33
33
  getCustomModelPlaceholder,
@@ -61,11 +61,13 @@ import {
61
61
  listZeroSchedules,
62
62
  listZeroSecrets,
63
63
  listZeroVariables,
64
+ postAskUserQuestion,
64
65
  promptConfirm,
65
66
  promptPassword,
66
67
  promptSelect,
67
68
  promptText,
68
69
  removeZeroOrgMember,
70
+ resolveCompose,
69
71
  resolveZeroScheduleByAgent,
70
72
  saveConfig,
71
73
  sendSlackMessage,
@@ -82,10 +84,10 @@ import {
82
84
  updateZeroUserPreferences,
83
85
  upsertZeroOrgModelProvider,
84
86
  withErrorHandler
85
- } from "./chunk-2D3ANUQI.js";
87
+ } from "./chunk-FEUDHROP.js";
86
88
 
87
89
  // src/zero.ts
88
- import { Command as Command57 } from "commander";
90
+ import { Command as Command59 } from "commander";
89
91
 
90
92
  // src/commands/zero/org/index.ts
91
93
  import { Command as Command23 } from "commander";
@@ -2389,10 +2391,10 @@ async function handleScheduleEnabling(params) {
2389
2391
  }
2390
2392
  }
2391
2393
  var setupCommand2 = new Command38().name("setup").description("Create or edit a schedule for a zero agent").argument("<agent-id>", "Agent ID").option("-n, --name <schedule-name>", 'Schedule name (default: "default")').option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once|loop").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-i, --interval <seconds>", "Interval in seconds for loop mode").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").option("--notify-email", "Enable email notifications (default: true)").option("--no-notify-email", "Disable email notifications").option("--notify-slack", "Enable Slack notifications (default: true)").option("--no-notify-slack", "Disable Slack notifications").action(
2392
- withErrorHandler(async (agentName, options) => {
2393
- const compose = await getComposeByName(agentName);
2394
+ withErrorHandler(async (agentIdentifier, options) => {
2395
+ const compose = await resolveCompose(agentIdentifier);
2394
2396
  if (!compose) {
2395
- throw new Error(`Agent not found: ${agentName}`);
2397
+ throw new Error(`Agent not found: ${agentIdentifier}`);
2396
2398
  }
2397
2399
  const agentId = compose.id;
2398
2400
  const scheduleName = options.name || "default";
@@ -2400,6 +2402,7 @@ var setupCommand2 = new Command38().name("setup").description("Create or edit a
2400
2402
  agentId,
2401
2403
  scheduleName
2402
2404
  );
2405
+ const agentName = compose.name;
2403
2406
  console.log(
2404
2407
  chalk32.dim(
2405
2408
  existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
@@ -3003,13 +3006,87 @@ var zeroWhoamiCommand = new Command56().name("whoami").description("Show agent i
3003
3006
  })
3004
3007
  );
3005
3008
 
3009
+ // src/commands/zero/ask-user/index.ts
3010
+ import { Command as Command58 } from "commander";
3011
+
3012
+ // src/commands/zero/ask-user/question.ts
3013
+ import { Command as Command57 } from "commander";
3014
+ import chalk46 from "chalk";
3015
+ function collectOption(value, previous) {
3016
+ const list = previous ?? [];
3017
+ list.push({ label: value });
3018
+ return list;
3019
+ }
3020
+ function collectDesc(value, previous) {
3021
+ const list = previous ?? [];
3022
+ list.push(value);
3023
+ return list;
3024
+ }
3025
+ var questionCommand = new Command57().name("question").description("Ask the user a question and wait for the answer").argument("<question>", "The question to ask").option("--header <text>", "Short label displayed as chip/tag (max 12 chars)").option("--option <label>", "Add a choice option (repeatable)", collectOption).option(
3026
+ "--desc <text>",
3027
+ "Description for the preceding --option",
3028
+ collectDesc
3029
+ ).option("--multi-select", "Allow multiple selections").option("--timeout <seconds>", "How long to wait for answer", "300").action(
3030
+ withErrorHandler(
3031
+ async (question, options) => {
3032
+ const optionItems = options.option ?? [];
3033
+ const descItems = options.desc ?? [];
3034
+ for (let i = 0; i < descItems.length; i++) {
3035
+ const opt = optionItems[i];
3036
+ if (!opt) {
3037
+ throw new Error("--desc must follow an --option flag");
3038
+ }
3039
+ opt.description = descItems[i];
3040
+ }
3041
+ const timeoutMs = parseInt(options.timeout, 10) * 1e3;
3042
+ if (isNaN(timeoutMs) || timeoutMs <= 0) {
3043
+ throw new Error("--timeout must be a positive number of seconds");
3044
+ }
3045
+ const questionItem = {
3046
+ question,
3047
+ header: options.header,
3048
+ options: optionItems.length > 0 ? optionItems : void 0,
3049
+ multiSelect: options.multiSelect
3050
+ };
3051
+ const { pendingId } = await postAskUserQuestion({
3052
+ questions: [questionItem]
3053
+ });
3054
+ console.error(
3055
+ chalk46.dim(
3056
+ `\u23F3 Waiting for user response... (pendingId: ${pendingId})`
3057
+ )
3058
+ );
3059
+ const deadline = Date.now() + timeoutMs;
3060
+ const pollIntervalMs = 1e3;
3061
+ while (Date.now() < deadline) {
3062
+ const response = await getAskUserAnswer(pendingId);
3063
+ if (response.status === "answered") {
3064
+ console.log(response.answer ?? "");
3065
+ return;
3066
+ }
3067
+ if (response.status === "expired") {
3068
+ throw new Error("Question expired before user responded");
3069
+ }
3070
+ await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
3071
+ }
3072
+ throw new Error(
3073
+ `Timed out waiting for user response after ${options.timeout}s`
3074
+ );
3075
+ }
3076
+ )
3077
+ );
3078
+
3079
+ // src/commands/zero/ask-user/index.ts
3080
+ var zeroAskUserCommand = new Command58().name("ask-user").description("Ask the user a question and wait for the answer").addCommand(questionCommand);
3081
+
3006
3082
  // src/zero.ts
3007
3083
  var COMMAND_CAPABILITY_MAP = {
3008
3084
  agent: "agent:read",
3009
3085
  schedule: "schedule:read",
3010
3086
  doctor: null,
3011
3087
  slack: "slack:write",
3012
- whoami: null
3088
+ whoami: null,
3089
+ "ask-user": null
3013
3090
  };
3014
3091
  var DEFAULT_COMMANDS = [
3015
3092
  zeroOrgCommand,
@@ -3021,7 +3098,8 @@ var DEFAULT_COMMANDS = [
3021
3098
  zeroSecretCommand,
3022
3099
  zeroSlackCommand,
3023
3100
  zeroVariableCommand,
3024
- zeroWhoamiCommand
3101
+ zeroWhoamiCommand,
3102
+ zeroAskUserCommand
3025
3103
  ];
3026
3104
  function shouldHideCommand(name, payload) {
3027
3105
  if (!payload) return false;
@@ -3037,10 +3115,10 @@ function registerZeroCommands(prog, commands) {
3037
3115
  prog.addCommand(cmd, hidden ? { hidden: true } : {});
3038
3116
  }
3039
3117
  }
3040
- var program = new Command57();
3118
+ var program = new Command59();
3041
3119
  program.name("zero").description(
3042
3120
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
3043
- ).version("9.84.7").addHelpText(
3121
+ ).version("9.85.1").addHelpText(
3044
3122
  "after",
3045
3123
  `
3046
3124
  Common scenarios: