@locusai/locus-telegram 0.21.16 → 0.22.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.
@@ -107,7 +107,7 @@ function readLocusConfig(cwd) {
107
107
  function invokeLocusStream(args, cwd) {
108
108
  return spawn("locus", args, {
109
109
  cwd: cwd ?? process.cwd(),
110
- stdio: ["inherit", "pipe", "pipe"],
110
+ stdio: ["ignore", "pipe", "pipe"],
111
111
  env: process.env,
112
112
  shell: false
113
113
  });
@@ -9045,7 +9045,7 @@ var init_keyboards = __esm(() => {
9045
9045
  // src/ui/messages.ts
9046
9046
  function welcomeMessage() {
9047
9047
  return [
9048
- `${bold2("\uD83E\uDD16 Locus Telegram Bot")}`,
9048
+ `${bold2("\uD83E\uDD16 Locus Telegram Remote Control")}`,
9049
9049
  "",
9050
9050
  "Control your Locus agent directly from Telegram.",
9051
9051
  "",
@@ -9396,6 +9396,11 @@ async function handleLocusCommand(ctx, command, args) {
9396
9396
  await ctx.reply(`Unknown command: /${command}`);
9397
9397
  return;
9398
9398
  }
9399
+ const requiresArgsMsg = REQUIRES_ARGS[command];
9400
+ if (requiresArgsMsg && args.length === 0) {
9401
+ await ctx.reply(requiresArgsMsg);
9402
+ return;
9403
+ }
9399
9404
  const fullArgs = [...cliArgs, ...args];
9400
9405
  const displayCmd = `locus ${fullArgs.join(" ")}`;
9401
9406
  const isStreaming = STREAMING_COMMANDS.has(command);
@@ -9496,7 +9501,7 @@ function getPostCommandKeyboard(command, args, exitCode) {
9496
9501
  return null;
9497
9502
  }
9498
9503
  }
9499
- var COMMAND_MAP, STREAMING_COMMANDS, EDIT_INTERVAL = 2000;
9504
+ var COMMAND_MAP, STREAMING_COMMANDS, REQUIRES_ARGS, EDIT_INTERVAL = 2000;
9500
9505
  var init_locus = __esm(() => {
9501
9506
  init_dist();
9502
9507
  init_keyboards();
@@ -9524,6 +9529,14 @@ var init_locus = __esm(() => {
9524
9529
  "discuss",
9525
9530
  "exec"
9526
9531
  ]);
9532
+ REQUIRES_ARGS = {
9533
+ exec: `Please provide a prompt.
9534
+
9535
+ Example: /exec Add error handling to the API`,
9536
+ discuss: `Please provide a discussion topic.
9537
+
9538
+ Example: /discuss Should we use Redis or in-memory caching?`
9539
+ };
9527
9540
  });
9528
9541
 
9529
9542
  // src/commands/service.ts
@@ -9846,32 +9859,36 @@ async function handleBot() {
9846
9859
  const bot = createBot2(config);
9847
9860
  logger2.info("Starting Telegram bot...");
9848
9861
  logger2.info(`Allowed chat IDs: ${config.allowedChatIds.join(", ")}`);
9849
- await bot.api.setMyCommands([
9850
- { command: "run", description: "Execute issues" },
9851
- { command: "status", description: "Dashboard view" },
9852
- { command: "issues", description: "List issues" },
9853
- { command: "issue", description: "Show issue details" },
9854
- { command: "sprint", description: "Sprint management" },
9855
- { command: "plan", description: "AI planning" },
9856
- { command: "review", description: "Code review" },
9857
- { command: "iterate", description: "Re-execute with feedback" },
9858
- { command: "discuss", description: "AI discussion" },
9859
- { command: "exec", description: "REPL / one-shot prompt" },
9860
- { command: "logs", description: "View logs" },
9861
- { command: "config", description: "View config" },
9862
- { command: "artifacts", description: "View artifacts" },
9863
- { command: "gitstatus", description: "Git status" },
9864
- { command: "stage", description: "Stage files" },
9865
- { command: "commit", description: "Commit changes" },
9866
- { command: "stash", description: "Stash operations" },
9867
- { command: "branch", description: "List/create branches" },
9868
- { command: "checkout", description: "Switch branch" },
9869
- { command: "diff", description: "Show diff" },
9870
- { command: "pr", description: "Create pull request" },
9871
- { command: "service", description: "Manage bot process" },
9872
- { command: "help", description: "Show help message" }
9873
- ]);
9874
- logger2.info("Telegram command menu synced.");
9862
+ try {
9863
+ await bot.api.setMyCommands([
9864
+ { command: "run", description: "Execute issues" },
9865
+ { command: "status", description: "Dashboard view" },
9866
+ { command: "issues", description: "List issues" },
9867
+ { command: "issue", description: "Show issue details" },
9868
+ { command: "sprint", description: "Sprint management" },
9869
+ { command: "plan", description: "AI planning" },
9870
+ { command: "review", description: "Code review" },
9871
+ { command: "iterate", description: "Re-execute with feedback" },
9872
+ { command: "discuss", description: "AI discussion" },
9873
+ { command: "exec", description: "One-shot AI prompt" },
9874
+ { command: "logs", description: "View logs" },
9875
+ { command: "config", description: "View config" },
9876
+ { command: "artifacts", description: "View artifacts" },
9877
+ { command: "gitstatus", description: "Git status" },
9878
+ { command: "stage", description: "Stage files" },
9879
+ { command: "commit", description: "Commit changes" },
9880
+ { command: "stash", description: "Stash operations" },
9881
+ { command: "branch", description: "List/create branches" },
9882
+ { command: "checkout", description: "Switch branch" },
9883
+ { command: "diff", description: "Show diff" },
9884
+ { command: "pr", description: "Create pull request" },
9885
+ { command: "service", description: "Manage bot process" },
9886
+ { command: "help", description: "Show help message" }
9887
+ ]);
9888
+ logger2.info("Telegram command menu synced.");
9889
+ } catch (err) {
9890
+ logger2.warn("Failed to sync command menu", { error: String(err) });
9891
+ }
9875
9892
  const shutdown = () => {
9876
9893
  logger2.info("Shutting down bot...");
9877
9894
  bot.stop();
@@ -9880,6 +9897,7 @@ async function handleBot() {
9880
9897
  process.on("SIGINT", shutdown);
9881
9898
  process.on("SIGTERM", shutdown);
9882
9899
  await bot.start({
9900
+ drop_pending_updates: true,
9883
9901
  onStart: () => {
9884
9902
  logger2.info("Bot is running. Send /help in Telegram to get started.");
9885
9903
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusai/locus-telegram",
3
- "version": "0.21.16",
3
+ "version": "0.22.0",
4
4
  "description": "Remote-control Locus via Telegram with full CLI mapping, git operations, and PM2 management",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,7 +26,7 @@
26
26
  "format": "biome format --write ."
27
27
  },
28
28
  "dependencies": {
29
- "@locusai/sdk": "^0.21.16",
29
+ "@locusai/sdk": "^0.22.0",
30
30
  "grammy": "^1.35.0",
31
31
  "pm2": "^6.0.5"
32
32
  },