@vm0/cli 9.110.1 → 9.111.0

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
@@ -70,7 +70,7 @@ import {
70
70
  source_default,
71
71
  volumeConfigSchema,
72
72
  withErrorHandler
73
- } from "./chunk-2XRAJ4IJ.js";
73
+ } from "./chunk-QX23MVVI.js";
74
74
 
75
75
  // src/index.ts
76
76
  init_esm_shims();
@@ -463,7 +463,7 @@ function getConfigPath() {
463
463
  return join(homedir(), ".vm0", "config.json");
464
464
  }
465
465
  var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
466
- console.log(source_default.bold(`VM0 CLI v${"9.110.1"}`));
466
+ console.log(source_default.bold(`VM0 CLI v${"9.111.0"}`));
467
467
  console.log();
468
468
  const config = await loadConfig();
469
469
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -4492,7 +4492,7 @@ var composeCommand = new Command().name("compose").description("Create or update
4492
4492
  options.autoUpdate = false;
4493
4493
  }
4494
4494
  if (options.autoUpdate !== false) {
4495
- await startSilentUpgrade("9.110.1");
4495
+ await startSilentUpgrade("9.111.0");
4496
4496
  }
4497
4497
  try {
4498
4498
  let result;
@@ -4572,7 +4572,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
4572
4572
  withErrorHandler(
4573
4573
  async (identifier, prompt, options) => {
4574
4574
  if (options.autoUpdate !== false) {
4575
- await startSilentUpgrade("9.110.1");
4575
+ await startSilentUpgrade("9.111.0");
4576
4576
  }
4577
4577
  const { name, version } = parseIdentifier(identifier);
4578
4578
  let composeId;
@@ -6313,7 +6313,7 @@ var cookAction = new Command().name("cook").description("Quick start: prepare, c
6313
6313
  withErrorHandler(
6314
6314
  async (prompt, options) => {
6315
6315
  if (options.autoUpdate !== false) {
6316
- const shouldExit = await checkAndUpgrade("9.110.1", prompt);
6316
+ const shouldExit = await checkAndUpgrade("9.111.0", prompt);
6317
6317
  if (shouldExit) {
6318
6318
  process.exit(0);
6319
6319
  }
@@ -7080,13 +7080,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
7080
7080
  if (latestVersion === null) {
7081
7081
  throw new Error("Could not check for updates. Please try again later.");
7082
7082
  }
7083
- if (latestVersion === "9.110.1") {
7084
- console.log(source_default.green(`\u2713 Already up to date (${"9.110.1"})`));
7083
+ if (latestVersion === "9.111.0") {
7084
+ console.log(source_default.green(`\u2713 Already up to date (${"9.111.0"})`));
7085
7085
  return;
7086
7086
  }
7087
7087
  console.log(
7088
7088
  source_default.yellow(
7089
- `Current version: ${"9.110.1"} -> Latest version: ${latestVersion}`
7089
+ `Current version: ${"9.111.0"} -> Latest version: ${latestVersion}`
7090
7090
  )
7091
7091
  );
7092
7092
  console.log();
@@ -7113,7 +7113,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
7113
7113
  const success = await performUpgrade(packageManager);
7114
7114
  if (success) {
7115
7115
  console.log(
7116
- source_default.green(`\u2713 Upgraded from ${"9.110.1"} to ${latestVersion}`)
7116
+ source_default.green(`\u2713 Upgraded from ${"9.111.0"} to ${latestVersion}`)
7117
7117
  );
7118
7118
  return;
7119
7119
  }
@@ -7180,7 +7180,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
7180
7180
 
7181
7181
  // src/index.ts
7182
7182
  var program = new Command();
7183
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.110.1");
7183
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.111.0");
7184
7184
  program.addCommand(authCommand);
7185
7185
  program.addCommand(infoCommand);
7186
7186
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.110.1",
3
+ "version": "9.111.0",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -128,7 +128,7 @@ import {
128
128
  upsertZeroOrgModelProvider,
129
129
  withErrorHandler,
130
130
  zeroAgentCustomSkillNameSchema
131
- } from "./chunk-2XRAJ4IJ.js";
131
+ } from "./chunk-QX23MVVI.js";
132
132
 
133
133
  // src/zero.ts
134
134
  init_esm_shims();
@@ -5762,21 +5762,61 @@ init_esm_shims();
5762
5762
  // src/commands/zero/phone/call.ts
5763
5763
  init_esm_shims();
5764
5764
  import * as fs from "fs";
5765
+
5766
+ // src/commands/zero/phone/format.ts
5767
+ init_esm_shims();
5768
+ function printTranscript(transcript) {
5769
+ if (!transcript || transcript.length === 0) {
5770
+ console.log(" (no transcript)");
5771
+ return;
5772
+ }
5773
+ for (const entry of transcript) {
5774
+ console.log(` ${source_default.dim(`[${entry.role}]`)} ${entry.text}`);
5775
+ }
5776
+ }
5777
+ function printCallInfo(call, callId) {
5778
+ console.log(` ${"Call ID:".padEnd(16)}${source_default.cyan(call.id ?? callId)}`);
5779
+ console.log(` ${"From:".padEnd(16)}${call.fromNumber}`);
5780
+ console.log(` ${"To:".padEnd(16)}${call.toNumber}`);
5781
+ console.log(` ${"Status:".padEnd(16)}${call.status}`);
5782
+ console.log(
5783
+ ` ${"Duration:".padEnd(16)}${call.durationSeconds != null ? `${call.durationSeconds}s` : "N/A"}`
5784
+ );
5785
+ console.log(` ${"Started:".padEnd(16)}${call.startedAt ?? ""}`);
5786
+ }
5787
+
5788
+ // src/commands/zero/phone/call.ts
5789
+ var POLL_INTERVAL_MS = 1e4;
5790
+ var POLL_TIMEOUT_MS = 15 * 60 * 1e3;
5791
+ var delay2 = {
5792
+ ms: (ms) => {
5793
+ return new Promise((resolve) => {
5794
+ setTimeout(resolve, ms);
5795
+ });
5796
+ }
5797
+ };
5798
+ var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
5799
+ "completed",
5800
+ "ended",
5801
+ "failed",
5802
+ "no-answer",
5803
+ "busy",
5804
+ "cancelled"
5805
+ ]);
5765
5806
  function isErrnoException(err) {
5766
5807
  return err instanceof Error && "code" in err;
5767
5808
  }
5768
5809
  var callCommand = new Command().name("call").description("Initiate an outbound phone call").argument(
5769
5810
  "<to-number>",
5770
5811
  "Phone number to call (E.164 format, e.g. +14155551234)"
5771
- ).option("--greeting <message>", "Initial greeting when the recipient answers").option(
5772
- "--greeting-file <path>",
5773
- "Read greeting from a file (use instead of --greeting)"
5774
- ).option(
5775
- "--system-prompt <prompt>",
5776
- "Override the agent's system prompt for this call"
5812
+ ).addOption(
5813
+ new Option(
5814
+ "--mode <mode>",
5815
+ "onhold: wait for call to complete and return transcript. fire-and-forget: initiate and return immediately."
5816
+ ).choices(["onhold", "fire-and-forget"]).makeOptionMandatory()
5777
5817
  ).option(
5778
- "--prompt-file <path>",
5779
- "Read system prompt from a file (use instead of --system-prompt)"
5818
+ "--system-prompt-file <path>",
5819
+ "File that defines the agent's persona and task context for this call"
5780
5820
  ).action(
5781
5821
  withErrorHandler(
5782
5822
  async (toNumber, options) => {
@@ -5788,38 +5828,14 @@ var callCommand = new Command().name("call").description("Initiate an outbound p
5788
5828
  );
5789
5829
  process.exit(1);
5790
5830
  }
5791
- if (options.systemPrompt && options.promptFile) {
5792
- console.error(
5793
- source_default.red("Cannot use both --system-prompt and --prompt-file")
5794
- );
5795
- process.exit(1);
5796
- }
5797
- if (options.greeting && options.greetingFile) {
5798
- console.error(
5799
- source_default.red("Cannot use both --greeting and --greeting-file")
5800
- );
5801
- process.exit(1);
5802
- }
5803
- let systemPrompt = options.systemPrompt;
5804
- if (options.promptFile) {
5805
- try {
5806
- systemPrompt = fs.readFileSync(options.promptFile, "utf-8");
5807
- } catch (err) {
5808
- if (isErrnoException(err) && err.code === "ENOENT") {
5809
- console.error(source_default.red(`File not found: ${options.promptFile}`));
5810
- process.exit(1);
5811
- }
5812
- throw err;
5813
- }
5814
- }
5815
- let greeting = options.greeting;
5816
- if (options.greetingFile) {
5831
+ let systemPrompt;
5832
+ if (options.systemPromptFile) {
5817
5833
  try {
5818
- greeting = fs.readFileSync(options.greetingFile, "utf-8");
5834
+ systemPrompt = fs.readFileSync(options.systemPromptFile, "utf-8");
5819
5835
  } catch (err) {
5820
5836
  if (isErrnoException(err) && err.code === "ENOENT") {
5821
5837
  console.error(
5822
- source_default.red(`File not found: ${options.greetingFile}`)
5838
+ source_default.red(`File not found: ${options.systemPromptFile}`)
5823
5839
  );
5824
5840
  process.exit(1);
5825
5841
  }
@@ -5828,54 +5844,48 @@ var callCommand = new Command().name("call").description("Initiate an outbound p
5828
5844
  }
5829
5845
  const result = await createPhoneCall({
5830
5846
  toNumber,
5831
- greeting,
5832
5847
  systemPrompt
5833
5848
  });
5834
5849
  console.log(source_default.green("Call initiated"));
5835
5850
  console.log(` ${"Call ID:".padEnd(12)}${source_default.cyan(result.callId)}`);
5836
5851
  console.log(` ${"Status:".padEnd(12)}${result.status}`);
5852
+ if (options.mode === "fire-and-forget") {
5853
+ return;
5854
+ }
5855
+ console.log();
5856
+ console.log(
5857
+ source_default.dim("Waiting for call to complete (polling every 10s)...")
5858
+ );
5859
+ const startTime = Date.now();
5860
+ while (Date.now() - startTime < POLL_TIMEOUT_MS) {
5861
+ await delay2.ms(POLL_INTERVAL_MS);
5862
+ const detail = await getPhoneCallDetail(result.callId);
5863
+ const status = detail.call.status;
5864
+ const elapsed = Math.round((Date.now() - startTime) / 1e3);
5865
+ if (TERMINAL_STATUSES.has(status)) {
5866
+ console.log();
5867
+ console.log(source_default.bold("Call Detail"));
5868
+ console.log();
5869
+ printCallInfo(detail.call, result.callId);
5870
+ console.log();
5871
+ console.log(source_default.bold("Transcript"));
5872
+ console.log();
5873
+ printTranscript(detail.transcript);
5874
+ if (status === "failed") {
5875
+ process.exit(1);
5876
+ }
5877
+ return;
5878
+ }
5879
+ console.log(source_default.dim(` [${elapsed}s] status: ${status}`));
5880
+ }
5881
+ console.error(source_default.red("\nCall timed out after 15 minutes"));
5882
+ process.exit(1);
5837
5883
  }
5838
5884
  )
5839
5885
  );
5840
5886
 
5841
5887
  // src/commands/zero/phone/record.ts
5842
5888
  init_esm_shims();
5843
- function printTranscript(transcript) {
5844
- if (Array.isArray(transcript)) {
5845
- for (const entry of transcript) {
5846
- if (typeof entry === "string") {
5847
- console.log(` ${entry}`);
5848
- } else if (typeof entry === "object" && entry !== null) {
5849
- const e = entry;
5850
- const role = e.role ?? e.speaker ?? "Unknown";
5851
- const text = e.text ?? e.content ?? e.body ?? "";
5852
- console.log(` ${source_default.dim(`[${role}]`)} ${text}`);
5853
- }
5854
- }
5855
- } else if (typeof transcript === "string") {
5856
- console.log(` ${transcript}`);
5857
- } else {
5858
- console.log(` ${JSON.stringify(transcript, null, 2)}`);
5859
- }
5860
- }
5861
- function printCallInfo(call, callId) {
5862
- console.log(
5863
- ` ${"Call ID:".padEnd(16)}${source_default.cyan(String(call.id ?? callId))}`
5864
- );
5865
- console.log(
5866
- ` ${"From:".padEnd(16)}${String(call.fromNumber ?? call.from_number ?? "")}`
5867
- );
5868
- console.log(
5869
- ` ${"To:".padEnd(16)}${String(call.toNumber ?? call.to_number ?? "")}`
5870
- );
5871
- console.log(` ${"Status:".padEnd(16)}${String(call.status ?? "")}`);
5872
- console.log(
5873
- ` ${"Duration:".padEnd(16)}${String(call.durationSeconds ?? call.duration_seconds ?? "N/A")}s`
5874
- );
5875
- console.log(
5876
- ` ${"Started:".padEnd(16)}${String(call.startedAt ?? call.started_at ?? "")}`
5877
- );
5878
- }
5879
5889
  async function showCallDetail(callId) {
5880
5890
  const result = await getPhoneCallDetail(callId);
5881
5891
  console.log(source_default.bold("Call Detail"));
@@ -5895,14 +5905,12 @@ async function showCallList(limit) {
5895
5905
  console.log(source_default.bold("Recent Calls"));
5896
5906
  console.log();
5897
5907
  for (const call of result.data) {
5898
- const id = String(call.id ?? "");
5899
- const from = String(call.fromNumber ?? call.from_number ?? "");
5900
- const to = String(call.toNumber ?? call.to_number ?? "");
5901
- const status = String(call.status ?? "");
5902
- const duration = call.durationSeconds ?? call.duration_seconds;
5903
- const snippet = String(
5904
- call.lastTranscriptSnippet ?? call.last_transcript_snippet ?? ""
5905
- );
5908
+ const id = call.id;
5909
+ const from = call.fromNumber;
5910
+ const to = call.toNumber;
5911
+ const status = call.status;
5912
+ const duration = call.durationSeconds;
5913
+ const snippet = call.lastTranscriptSnippet ?? "";
5906
5914
  console.log(` ${source_default.cyan(id)}`);
5907
5915
  console.log(
5908
5916
  ` ${from} \u2192 ${to} ${source_default.dim(status)}${duration != null ? ` ${duration}s` : ""}`
@@ -6050,7 +6058,7 @@ function registerZeroCommands(prog, commands) {
6050
6058
  var program = new Command();
6051
6059
  program.name("zero").description(
6052
6060
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
6053
- ).version("9.110.1").addHelpText(
6061
+ ).version("9.111.0").addHelpText(
6054
6062
  "after",
6055
6063
  `
6056
6064
  Examples: