blun-king-cli 9.1.73 → 9.1.74

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/blun.mjs CHANGED
@@ -502526,7 +502526,7 @@ var EditorKeyboardController = class {
502526
502526
  host.toggleTodoPanelExpansion();
502527
502527
  return;
502528
502528
  }
502529
- if (host.state.appState.streamingPhase === "idle") return;
502529
+ if (!host.streamingUI.hasActiveTurn() && host.state.appState.streamingPhase === "idle") return;
502530
502530
  host.flushQueuedMessages(editor.getText().trim(), editor.inputMode);
502531
502531
  host.updateQueueDisplay();
502532
502532
  host.state.ui.requestRender();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.73",
3
+ "version": "9.1.74",
4
4
  "description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -9744,26 +9744,38 @@ const TOOL_DEFINITIONS = [
9744
9744
  }
9745
9745
  }
9746
9746
  ];
9747
+ function resolveAllowedChatId(chatId) {
9748
+ const access = readAccess();
9749
+ const requested = String(chatId).trim();
9750
+ const isAllowed = (candidate) => access.allowFrom.includes(candidate) || Object.hasOwn(access.groups, candidate);
9751
+ if (isAllowed(requested)) return requested;
9752
+ if (/^100\d+$/.test(requested)) {
9753
+ const supergroupId = `-${requested}`;
9754
+ if (isAllowed(supergroupId)) return supergroupId;
9755
+ }
9756
+ throw new Error(`chat ${requested} is not allowlisted — add via /telegram:access`);
9757
+ }
9747
9758
  async function runTool(api, token, name, args) {
9748
9759
  switch (name) {
9749
9760
  case "reply": return runReply(api, args);
9750
- case "react":
9751
- assertAllowedChat(args.chat_id);
9752
- await api.setMessageReaction(args.chat_id, Number(args.message_id), [{
9761
+ case "react": {
9762
+ const chatId = resolveAllowedChatId(args.chat_id);
9763
+ await api.setMessageReaction(chatId, Number(args.message_id), [{
9753
9764
  type: "emoji",
9754
9765
  emoji: args.emoji
9755
9766
  }]);
9756
9767
  return "reacted";
9768
+ }
9757
9769
  case "download_attachment": return runDownload(api, token, args.file_id);
9758
9770
  case "edit_message": {
9759
- assertAllowedChat(args.chat_id);
9771
+ const chatId = resolveAllowedChatId(args.chat_id);
9760
9772
  const parseMode = args.format === "markdownv2" ? "MarkdownV2" : void 0;
9761
- const edited = await api.editMessageText(args.chat_id, Number(args.message_id), args.text, parseMode !== void 0 ? { parse_mode: parseMode } : void 0);
9773
+ const edited = await api.editMessageText(chatId, Number(args.message_id), args.text, parseMode !== void 0 ? { parse_mode: parseMode } : void 0);
9762
9774
  const id = typeof edited === "object" ? edited.message_id : args.message_id;
9763
9775
  appendJsonl(outboxLog(), {
9764
9776
  direction: "out",
9765
9777
  kind: "edit",
9766
- chat_id: args.chat_id,
9778
+ chat_id: chatId,
9767
9779
  message_id: id,
9768
9780
  text: args.text
9769
9781
  });
@@ -9803,12 +9815,11 @@ function isRecentDuplicate(chatId, text) {
9803
9815
  return false;
9804
9816
  }
9805
9817
  async function runReply(api, args) {
9806
- const chatId = args.chat_id;
9818
+ const chatId = resolveAllowedChatId(args.chat_id);
9807
9819
  const text = args.text;
9808
9820
  const replyTo = args.reply_to != null ? Number(args.reply_to) : void 0;
9809
9821
  const files = args.files ?? [];
9810
9822
  const parseMode = args.format === "markdownv2" ? "MarkdownV2" : void 0;
9811
- assertAllowedChat(chatId);
9812
9823
  if (files.length === 0 && isGroupChat(chatId) && isGroupNoiseReply(text)) {
9813
9824
  appendJsonl(outboxLog(), {
9814
9825
  direction: "out",