@vm0/cli 9.136.0 → 9.137.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
@@ -62,7 +62,7 @@ import {
62
62
  source_default,
63
63
  volumeConfigSchema,
64
64
  withErrorHandler
65
- } from "./chunk-5F6QHYHS.js";
65
+ } from "./chunk-I3QKCVRM.js";
66
66
  import {
67
67
  __commonJS,
68
68
  __require,
@@ -7771,7 +7771,7 @@ function getConfigPath() {
7771
7771
  return join(homedir(), ".vm0", "config.json");
7772
7772
  }
7773
7773
  var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
7774
- console.log(source_default.bold(`VM0 CLI v${"9.136.0"}`));
7774
+ console.log(source_default.bold(`VM0 CLI v${"9.137.1"}`));
7775
7775
  console.log();
7776
7776
  const config = await loadConfig();
7777
7777
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -11716,7 +11716,7 @@ var composeCommand = new Command().name("compose").description("Create or update
11716
11716
  options.autoUpdate = false;
11717
11717
  }
11718
11718
  if (options.autoUpdate !== false) {
11719
- await startSilentUpgrade("9.136.0");
11719
+ await startSilentUpgrade("9.137.1");
11720
11720
  }
11721
11721
  try {
11722
11722
  let result;
@@ -11808,7 +11808,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
11808
11808
  withErrorHandler(
11809
11809
  async (identifier, prompt, options) => {
11810
11810
  if (options.autoUpdate !== false) {
11811
- await startSilentUpgrade("9.136.0");
11811
+ await startSilentUpgrade("9.137.1");
11812
11812
  }
11813
11813
  const { name, version } = parseIdentifier(identifier);
11814
11814
  let composeId;
@@ -13582,13 +13582,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
13582
13582
  if (latestVersion === null) {
13583
13583
  throw new Error("Could not check for updates. Please try again later.");
13584
13584
  }
13585
- if (latestVersion === "9.136.0") {
13586
- console.log(source_default.green(`\u2713 Already up to date (${"9.136.0"})`));
13585
+ if (latestVersion === "9.137.1") {
13586
+ console.log(source_default.green(`\u2713 Already up to date (${"9.137.1"})`));
13587
13587
  return;
13588
13588
  }
13589
13589
  console.log(
13590
13590
  source_default.yellow(
13591
- `Current version: ${"9.136.0"} -> Latest version: ${latestVersion}`
13591
+ `Current version: ${"9.137.1"} -> Latest version: ${latestVersion}`
13592
13592
  )
13593
13593
  );
13594
13594
  console.log();
@@ -13615,7 +13615,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
13615
13615
  const success = await performUpgrade(packageManager);
13616
13616
  if (success) {
13617
13617
  console.log(
13618
- source_default.green(`\u2713 Upgraded from ${"9.136.0"} to ${latestVersion}`)
13618
+ source_default.green(`\u2713 Upgraded from ${"9.137.1"} to ${latestVersion}`)
13619
13619
  );
13620
13620
  return;
13621
13621
  }
@@ -13682,7 +13682,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
13682
13682
 
13683
13683
  // src/index.ts
13684
13684
  var program = new Command();
13685
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.136.0");
13685
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.137.1");
13686
13686
  program.addCommand(authCommand);
13687
13687
  program.addCommand(infoCommand);
13688
13688
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.136.0",
3
+ "version": "9.137.1",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -66,6 +66,7 @@ import {
66
66
  isUUID,
67
67
  leaveZeroOrg,
68
68
  listSkills,
69
+ listTelegramBots,
69
70
  listZeroAgents,
70
71
  listZeroConnectors,
71
72
  listZeroLogs,
@@ -96,6 +97,7 @@ import {
96
97
  searchZeroLogs,
97
98
  sendChatMessage,
98
99
  sendSlackMessage,
100
+ sendTelegramMessage,
99
101
  setZeroOrgModelProviderDefault,
100
102
  setZeroOrgSecret,
101
103
  setZeroOrgVariable,
@@ -115,7 +117,7 @@ import {
115
117
  upsertZeroOrgModelProvider,
116
118
  withErrorHandler,
117
119
  zeroAgentCustomSkillNameSchema
118
- } from "./chunk-5F6QHYHS.js";
120
+ } from "./chunk-I3QKCVRM.js";
119
121
  import {
120
122
  __toESM,
121
123
  init_esm_shims
@@ -13956,13 +13958,7 @@ var FEATURE_SWITCHES = {
13956
13958
  ["chatArtifactsDrawer" /* ChatArtifactsDrawer */]: {
13957
13959
  maintainer: "ethan@vm0.ai",
13958
13960
  description: "Show an artifacts button in the chat header that opens a drawer listing uploaded files grouped by run",
13959
- enabled: false,
13960
- enabledOrgIdHashes: STAFF_ORG_ID_HASHES
13961
- },
13962
- ["chatThreadReadIndicator" /* ChatThreadReadIndicator */]: {
13963
- maintainer: "ethan@vm0.ai",
13964
- description: "Show the unread watermark dot and bold title for chat threads with unread messages in the sidebar",
13965
- enabled: false
13961
+ enabled: true
13966
13962
  },
13967
13963
  ["chatManualHistory" /* ChatManualHistory */]: {
13968
13964
  maintainer: "linghan@vm0.ai",
@@ -16741,6 +16737,86 @@ Examples:
16741
16737
  // src/commands/zero/telegram/index.ts
16742
16738
  init_esm_shims();
16743
16739
 
16740
+ // src/commands/zero/telegram/bot/index.ts
16741
+ init_esm_shims();
16742
+
16743
+ // src/commands/zero/telegram/bot/list.ts
16744
+ init_esm_shims();
16745
+ function usernameLabel(bot) {
16746
+ if (!bot.username) return "-";
16747
+ return bot.username.startsWith("@") ? bot.username : `@${bot.username}`;
16748
+ }
16749
+ function statusLabel(bot) {
16750
+ if (bot.tokenStatus === "valid") return source_default.green("valid");
16751
+ if (bot.tokenStatus === "invalid") return source_default.red("invalid");
16752
+ return source_default.yellow("unknown");
16753
+ }
16754
+ var listCommand9 = new Command().name("list").alias("ls").description("List Telegram bots available in the active organization").addHelpText(
16755
+ "after",
16756
+ `
16757
+ Examples:
16758
+ zero telegram bot list
16759
+
16760
+ Notes:
16761
+ - Use this to find the --bot-id value before sending Telegram messages.`
16762
+ ).action(
16763
+ withErrorHandler(async () => {
16764
+ const result = await listTelegramBots();
16765
+ const { bots } = result;
16766
+ if (bots.length === 0) {
16767
+ console.log(source_default.dim("No Telegram bots found"));
16768
+ console.log(
16769
+ source_default.dim(" Add one from Settings > Integrations > Telegram")
16770
+ );
16771
+ return;
16772
+ }
16773
+ const botIdWidth = Math.max(
16774
+ 6,
16775
+ ...bots.map((bot) => {
16776
+ return bot.id.length;
16777
+ })
16778
+ );
16779
+ const usernameWidth = Math.max(
16780
+ 8,
16781
+ ...bots.map((bot) => {
16782
+ return usernameLabel(bot).length;
16783
+ })
16784
+ );
16785
+ const agentWidth = Math.max(
16786
+ 5,
16787
+ ...bots.map((bot) => {
16788
+ return (bot.agent?.name ?? "-").length;
16789
+ })
16790
+ );
16791
+ const header = [
16792
+ "BOT ID".padEnd(botIdWidth),
16793
+ "USERNAME".padEnd(usernameWidth),
16794
+ "AGENT".padEnd(agentWidth),
16795
+ "CONNECTED",
16796
+ "TOKEN"
16797
+ ].join(" ");
16798
+ console.log(source_default.dim(header));
16799
+ for (const bot of bots) {
16800
+ const row = [
16801
+ bot.id.padEnd(botIdWidth),
16802
+ usernameLabel(bot).padEnd(usernameWidth),
16803
+ (bot.agent?.name ?? "-").padEnd(agentWidth),
16804
+ (bot.isConnected ? "yes" : "no").padEnd(9),
16805
+ statusLabel(bot)
16806
+ ].join(" ");
16807
+ console.log(row);
16808
+ }
16809
+ })
16810
+ );
16811
+
16812
+ // src/commands/zero/telegram/bot/index.ts
16813
+ var zeroTelegramBotCommand = new Command().name("bot").description("Inspect Telegram bots").addCommand(listCommand9).addHelpText(
16814
+ "after",
16815
+ `
16816
+ Examples:
16817
+ zero telegram bot list`
16818
+ );
16819
+
16744
16820
  // src/commands/zero/telegram/download-file.ts
16745
16821
  init_esm_shims();
16746
16822
  import { join as join2 } from "path";
@@ -16789,9 +16865,72 @@ Notes:
16789
16865
  )
16790
16866
  );
16791
16867
 
16868
+ // src/commands/zero/telegram/message/index.ts
16869
+ init_esm_shims();
16870
+
16871
+ // src/commands/zero/telegram/message/send.ts
16872
+ init_esm_shims();
16873
+ import { readFileSync as readFileSync7 } from "fs";
16874
+ function parsePositiveInteger(value, flag) {
16875
+ const parsed = Number(value);
16876
+ if (!Number.isInteger(parsed) || parsed <= 0) {
16877
+ throw new Error(`${flag} must be a positive integer`);
16878
+ }
16879
+ return parsed;
16880
+ }
16881
+ var sendCommand3 = new Command().name("send").description("Send a message to a Telegram chat as the bot").requiredOption("--bot-id <id>", "Telegram bot ID").requiredOption("-c, --chat-id <id>", "Telegram chat ID").option("-t, --text <message>", "Message text").option("--reply-to-message-id <id>", "Message ID to reply to").option("--message-thread-id <id>", "Telegram forum topic thread ID").addHelpText(
16882
+ "after",
16883
+ `
16884
+ Examples:
16885
+ Simple message: zero telegram message send --bot-id 123456789 -c -1001234567890 -t "Hello!"
16886
+ Reply to message: zero telegram message send --bot-id 123456789 -c -1001234567890 --reply-to-message-id 42 -t "reply"
16887
+ Forum topic message: zero telegram message send --bot-id 123456789 -c -1001234567890 --message-thread-id 7 -t "topic update"
16888
+
16889
+ Notes:
16890
+ - Message text can be provided with --text or piped on stdin
16891
+ - Choose an explicit --bot-id. Run "zero telegram bot list" to inspect available bots.`
16892
+ ).action(
16893
+ withErrorHandler(
16894
+ async (options) => {
16895
+ let text = options.text;
16896
+ if (!text && process.stdin.isTTY === false) {
16897
+ text = readFileSync7("/dev/stdin", "utf8").trim();
16898
+ }
16899
+ if (!text) {
16900
+ throw new Error("Either --text or piped stdin must be provided", {
16901
+ cause: new Error(
16902
+ 'Usage: zero telegram message send --bot-id BOT_ID -c CHAT_ID -t "your message"'
16903
+ )
16904
+ });
16905
+ }
16906
+ const result = await sendTelegramMessage({
16907
+ botId: options.botId,
16908
+ chatId: options.chatId,
16909
+ text,
16910
+ replyToMessageId: options.replyToMessageId ? parsePositiveInteger(
16911
+ options.replyToMessageId,
16912
+ "reply-to-message-id"
16913
+ ) : void 0,
16914
+ messageThreadId: options.messageThreadId ? parsePositiveInteger(options.messageThreadId, "message-thread-id") : void 0
16915
+ });
16916
+ console.log(
16917
+ source_default.green(`\u2713 Message sent (message_id: ${result.messageId})`)
16918
+ );
16919
+ }
16920
+ )
16921
+ );
16922
+
16923
+ // src/commands/zero/telegram/message/index.ts
16924
+ var zeroTelegramMessageCommand = new Command().name("message").description("Manage Telegram messages").addCommand(sendCommand3).addHelpText(
16925
+ "after",
16926
+ `
16927
+ Examples:
16928
+ zero telegram message send --bot-id <bot-id> -c <chat-id> -t "Hello!"`
16929
+ );
16930
+
16792
16931
  // src/commands/zero/telegram/upload-file.ts
16793
16932
  init_esm_shims();
16794
- import { readFileSync as readFileSync7, statSync as statSync2 } from "fs";
16933
+ import { readFileSync as readFileSync8, statSync as statSync2 } from "fs";
16795
16934
  import { basename as basename2, extname } from "path";
16796
16935
  var MIME_BY_EXTENSION = {
16797
16936
  ".png": "image/png",
@@ -16864,7 +17003,7 @@ Notes:
16864
17003
  contentType,
16865
17004
  length: fileSize
16866
17005
  });
16867
- const fileContent = readFileSync7(options.file);
17006
+ const fileContent = readFileSync8(options.file);
16868
17007
  const uploadResponse = await fetch(prepared.uploadUrl, {
16869
17008
  method: "PUT",
16870
17009
  headers: { "Content-Type": prepared.contentType },
@@ -16889,10 +17028,14 @@ Notes:
16889
17028
  );
16890
17029
 
16891
17030
  // src/commands/zero/telegram/index.ts
16892
- var zeroTelegramCommand = new Command().name("telegram").description("Upload and download files from Telegram as the bot").addCommand(downloadFileCommand2).addCommand(uploadFileCommand2).addHelpText(
17031
+ var zeroTelegramCommand = new Command().name("telegram").description(
17032
+ "Inspect bots, send messages, upload files, and download files from Telegram"
17033
+ ).addCommand(zeroTelegramBotCommand).addCommand(zeroTelegramMessageCommand).addCommand(downloadFileCommand2).addCommand(uploadFileCommand2).addHelpText(
16893
17034
  "after",
16894
17035
  `
16895
17036
  Examples:
17037
+ List bots: zero telegram bot list
17038
+ Send a message: zero telegram message send --bot-id <bot-id> -c <chat-id> -t "Hello!"
16896
17039
  Upload a file: zero telegram upload-file -f /tmp/report.pdf --bot-id <bot-id> -c <chat-id>
16897
17040
  Download a file: zero telegram download-file <file-id> --bot-id <bot-id> -o /tmp/out.jpg`
16898
17041
  );
@@ -16908,7 +17051,7 @@ function truncateValue2(value, maxLength = 60) {
16908
17051
  }
16909
17052
  return value.slice(0, maxLength - 15) + "... [truncated]";
16910
17053
  }
16911
- var listCommand9 = new Command().name("list").alias("ls").description("List all variables").action(
17054
+ var listCommand10 = new Command().name("list").alias("ls").description("List all variables").action(
16912
17055
  withErrorHandler(async () => {
16913
17056
  const result = await listZeroVariables();
16914
17057
  if (result.variables.length === 0) {
@@ -16985,7 +17128,7 @@ var deleteCommand5 = new Command().name("delete").description("Delete a variable
16985
17128
  );
16986
17129
 
16987
17130
  // src/commands/zero/variable/index.ts
16988
- var zeroVariableCommand = new Command().name("variable").description("Read or write non-sensitive configuration values").addCommand(listCommand9).addCommand(setCommand5).addCommand(deleteCommand5);
17131
+ var zeroVariableCommand = new Command().name("variable").description("Read or write non-sensitive configuration values").addCommand(listCommand10).addCommand(setCommand5).addCommand(deleteCommand5);
16989
17132
 
16990
17133
  // src/commands/zero/whoami.ts
16991
17134
  init_esm_shims();
@@ -17144,7 +17287,7 @@ init_esm_shims();
17144
17287
 
17145
17288
  // src/lib/skill-directory.ts
17146
17289
  init_esm_shims();
17147
- import { readFileSync as readFileSync8, readdirSync } from "fs";
17290
+ import { readFileSync as readFileSync9, readdirSync } from "fs";
17148
17291
  import { join as join3 } from "path";
17149
17292
  var IGNORED_NAMES = /* @__PURE__ */ new Set(["node_modules", ".git", ".DS_Store"]);
17150
17293
  function readSkillDirectory(dirPath) {
@@ -17159,7 +17302,7 @@ function readSkillDirectory(dirPath) {
17159
17302
  } else {
17160
17303
  files.push({
17161
17304
  path: relPath,
17162
- content: readFileSync8(join3(dir, entry.name), "utf-8")
17305
+ content: readFileSync9(join3(dir, entry.name), "utf-8")
17163
17306
  });
17164
17307
  }
17165
17308
  }
@@ -17264,7 +17407,7 @@ Examples:
17264
17407
 
17265
17408
  // src/commands/zero/skill/list.ts
17266
17409
  init_esm_shims();
17267
- var listCommand10 = new Command().name("list").alias("ls").description("List custom skills in the organization").addHelpText(
17410
+ var listCommand11 = new Command().name("list").alias("ls").description("List custom skills in the organization").addHelpText(
17268
17411
  "after",
17269
17412
  `
17270
17413
  Examples:
@@ -17342,7 +17485,7 @@ Notes:
17342
17485
  );
17343
17486
 
17344
17487
  // src/commands/zero/skill/index.ts
17345
- var zeroSkillCommand = new Command("skill").description("Manage custom skills").addCommand(createCommand2).addCommand(editCommand2).addCommand(viewCommand2).addCommand(listCommand10).addCommand(deleteCommand6).addHelpText(
17488
+ var zeroSkillCommand = new Command("skill").description("Manage custom skills").addCommand(createCommand2).addCommand(editCommand2).addCommand(viewCommand2).addCommand(listCommand11).addCommand(deleteCommand6).addHelpText(
17346
17489
  "after",
17347
17490
  `
17348
17491
  Examples:
@@ -17383,7 +17526,7 @@ function formatStatus(status) {
17383
17526
  function formatTime(iso) {
17384
17527
  return new Date(iso).toISOString().replace(/\.\d{3}Z$/, "Z");
17385
17528
  }
17386
- var listCommand11 = new Command().name("list").alias("ls").description("List agent run logs").option("--agent <name>", "Filter by agent name").option(
17529
+ var listCommand12 = new Command().name("list").alias("ls").description("List agent run logs").option("--agent <name>", "Filter by agent name").option(
17387
17530
  "--status <status>",
17388
17531
  "Filter by status (queued|pending|running|completed|failed|timeout|cancelled)"
17389
17532
  ).option(
@@ -17636,7 +17779,7 @@ async function showAgentEvents(runId, options) {
17636
17779
  renderAgentEvent(event, renderer);
17637
17780
  }
17638
17781
  }
17639
- var zeroLogsCommand = new Command().name("logs").description("View and search agent run logs").argument("[runId]", "Run ID to view agent events for").addCommand(listCommand11).addCommand(searchCommand2).option(
17782
+ var zeroLogsCommand = new Command().name("logs").description("View and search agent run logs").argument("[runId]", "Run ID to view agent events for").addCommand(listCommand12).addCommand(searchCommand2).option(
17640
17783
  "--since <time>",
17641
17784
  "Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z)"
17642
17785
  ).option("--tail <n>", "Show last N entries (default: 5)").option("--head <n>", "Show first N entries").option("--all", "Fetch all log entries").addHelpText(
@@ -19078,12 +19221,14 @@ function registerZeroCommands(prog, commands) {
19078
19221
  var program = new Command();
19079
19222
  program.name("zero").description(
19080
19223
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
19081
- ).version("9.136.0").addHelpText(
19224
+ ).version("9.137.1").addHelpText(
19082
19225
  "after",
19083
19226
  `
19084
19227
  Examples:
19085
19228
  Check a connector? zero doctor check-connector --env-name <ENV_NAME>
19086
19229
  Send a Slack message? zero slack message send --help
19230
+ List Telegram bots? zero telegram bot list
19231
+ Send Telegram? zero telegram message send --help
19087
19232
  Upload Telegram? zero telegram upload-file --help
19088
19233
  Download Telegram? zero telegram download-file --help
19089
19234
  Set up a schedule? zero schedule setup --help