blun-king-cli 9.1.577 → 9.1.579

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.
@@ -3,6 +3,7 @@ import process$1 from "node:process";
3
3
  import { mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
4
4
  import { dirname, extname, join } from "node:path";
5
5
  import privateConversationPolicy from "../bin/telegram-private-conversation-policy.cjs";
6
+ import directReplyPolicy from "../bin/telegram-direct-reply-policy.cjs";
6
7
  import replyParts from "../bin/telegram-reply-parts.cjs";
7
8
  //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
8
9
  function isZ4Schema(s) {
@@ -9672,7 +9673,7 @@ const { findDuplicateReplyWithoutNewInbound, isPrivateInternalStatusReply, sanit
9672
9673
  const TOOL_DEFINITIONS = [
9673
9674
  {
9674
9675
  name: "reply",
9675
- description: "Reply on Telegram. Pass chat_id from the inbound message. Optionally pass reply_to (message_id) for threading, and files (absolute paths) to attach images or documents.",
9676
+ description: "Reply on Telegram. Keep chat_id from the inbound message. When answering an inbound question or presence check, set reply_to to that message_id; do not infer another chat or recipient. Files (absolute paths) attach images or documents.",
9676
9677
  inputSchema: {
9677
9678
  type: "object",
9678
9679
  properties: {
@@ -9832,6 +9833,7 @@ async function runReply(api, args, token = botToken()) {
9832
9833
  const chatId = resolveAllowedChatId(args.chat_id);
9833
9834
  const rawText = args.text;
9834
9835
  const replyTo = args.reply_to != null ? Number(args.reply_to) : void 0;
9836
+ const replyContextLog = { reply_to: Number.isSafeInteger(replyTo) && replyTo > 0 ? replyTo : null };
9835
9837
  const files = args.files ?? [];
9836
9838
  const text = files.length === 0 ? sanitizePrivateConversationReply(chatId, rawText) : rawText;
9837
9839
  const parseMode = args.format === "markdownv2" ? "MarkdownV2" : void 0;
@@ -9839,16 +9841,16 @@ async function runReply(api, args, token = botToken()) {
9839
9841
  appendJsonl(outboxLog(), {
9840
9842
  direction: "out",
9841
9843
  kind: "reply-suppressed-private-internal",
9842
- chat_id: chatId,
9844
+ chat_id: chatId, ...replyContextLog,
9843
9845
  text
9844
9846
  });
9845
9847
  return "suppressed: internal work-control narration does not belong in a private conversation";
9846
9848
  }
9847
- if (files.length === 0 && isGroupChat(chatId) && isGroupNoiseReply(text)) {
9849
+ if (files.length === 0 && isGroupChat(chatId) && isGroupNoiseReply(text) && !directReplyPolicy.permitsPresenceReply({ text, chatId, replyTo, inboxFile: inboxLog() })) {
9848
9850
  appendJsonl(outboxLog(), {
9849
9851
  direction: "out",
9850
9852
  kind: "reply-suppressed",
9851
- chat_id: chatId,
9853
+ chat_id: chatId, ...replyContextLog,
9852
9854
  text
9853
9855
  });
9854
9856
  return "suppressed: group meta/acknowledgement noise — not sent (silence means silence)";
@@ -9857,7 +9859,7 @@ async function runReply(api, args, token = botToken()) {
9857
9859
  appendJsonl(outboxLog(), {
9858
9860
  direction: "out",
9859
9861
  kind: "reply-duplicate-suppressed",
9860
- chat_id: chatId,
9862
+ chat_id: chatId, ...replyContextLog,
9861
9863
  text
9862
9864
  });
9863
9865
  return "already delivered: an identical message was sent to this chat moments ago — do NOT send it again";
@@ -9886,7 +9888,7 @@ async function runReply(api, args, token = botToken()) {
9886
9888
  let outboxWarning = "";
9887
9889
  try {
9888
9890
  if (!result.replayed) appendJsonl(outboxLog(), {
9889
- direction: "out", kind: "reply", chat_id: chatId, message_ids: result.sentIds,
9891
+ direction: "out", kind: "reply", chat_id: chatId, ...replyContextLog, message_ids: result.sentIds,
9890
9892
  text, files, delivery_id: result.deliveryId,
9891
9893
  ...result.plainTextFallbacks > 0 ? { plain_text_fallbacks: result.plainTextFallbacks } : {}
9892
9894
  });
@@ -9921,7 +9923,7 @@ async function runReply(api, args, token = botToken()) {
9921
9923
  appendJsonl(outboxLog(), {
9922
9924
  direction: "out",
9923
9925
  kind: "reply",
9924
- chat_id: chatId,
9926
+ chat_id: chatId, ...replyContextLog,
9925
9927
  message_ids: sentIds,
9926
9928
  text,
9927
9929
  ...plainTextFallbacks > 0 ? { plain_text_fallbacks: plainTextFallbacks } : {},