blun-king-cli 9.1.640 → 9.1.642

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.640",
3
+ "version": "9.1.642",
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": {
@@ -68438,6 +68438,12 @@ function alreadySeen(key) {
68438
68438
  }
68439
68439
  const MAX_INBOUND_AGE_S = Number(process.env.BLUN_TELEGRAM_MAX_INBOUND_AGE_S ?? 900);
68440
68440
  const HEADLESS_ENABLED = (process.env.BLUN_TELEGRAM_HEADLESS ?? "on").trim().toLowerCase() !== "off";
68441
+ function controlAuthorized(ctx, result) {
68442
+ if (result.action !== "deliver" || result.addressed === false || result.inferAddressing === true || ctx.from === void 0 || ctx.from.isBot === true || ctx.chatId === void 0) return false;
68443
+ const id = String(ctx.from.id);
68444
+ const group = result.access.groups[String(ctx.chatId)];
68445
+ return result.access.allowFrom.includes(id) || (group?.allowFrom ?? []).includes(id) || (group?.alwaysAllowFrom ?? []).includes(id);
68446
+ }
68441
68447
  async function handleInbound(event) {
68442
68448
  const { ctx } = event;
68443
68449
  const result = gate(ctx, botUsername);
@@ -68478,6 +68484,8 @@ async function handleInbound(event) {
68478
68484
  addressed: inferAddressing ? "semantic" : String(addressed),
68479
68485
  user: ctx.from?.username ?? String(ctx.from?.id),
68480
68486
  user_id: String(ctx.from?.id),
68487
+ bot_username: bot.botInfo.username,
68488
+ control_authorized: String(controlAuthorized(ctx, result)),
68481
68489
  ts: (/* @__PURE__ */ new Date((ctx.date ?? 0) * 1e3)).toISOString(),
68482
68490
  ...image !== void 0 ? { image_path: image.path } : {},
68483
68491
  ...attachment !== void 0 ? {