omni-notify-mcp 1.3.505 → 1.3.506

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/dist/chunk.js CHANGED
@@ -22,6 +22,11 @@ const BLOCK_START = /^\s*(#{1,6}\s|>|[-*+]\s|\||```|\*\*\S)/;
22
22
  export function withLead(lead, text) {
23
23
  return `${lead}${BLOCK_START.test(text) ? "\n" : " "}${text}`;
24
24
  }
25
+ /** #5085 — the text one channel reads: `message` whole, or with `lead.from` swapped for that channel's own wording when the caller named one. */
26
+ export function forChannel(message, channel, lead) {
27
+ const said = lead?.per[channel];
28
+ return lead === undefined || said === undefined ? message : message.split(lead.from).join(said);
29
+ }
25
30
  export function splitForNotify(message, limit = NOTIFY_CHUNK_LIMIT) {
26
31
  if (message.length <= limit)
27
32
  return [message];
package/dist/notify.js CHANGED
@@ -21,7 +21,7 @@ import { sendWithRouting, formatIdleReading, describePriorityRouting } from "./m
21
21
  import { deliveryVerdict } from "./messaging/deliveryVerdict.js";
22
22
  import { telegramSendErrorHint } from "./messaging/telegramError.js";
23
23
  import { postTelegramMessage, telegramParseMode } from "./messaging/telegramFormat.js";
24
- import { splitForNotify, withLead } from "./chunk.js";
24
+ import { forChannel, splitForNotify, withLead } from "./chunk.js";
25
25
  import { idleNow, playVoice, showBanner } from "./desk.js";
26
26
  import { AgentGateway, AGENT_PREFIX, SLACK_DM, streamedChat } from "./agentGateway.js";
27
27
  import { slackVerifyAndRepair } from "./messaging/slackSetup.js";
@@ -389,7 +389,7 @@ export const textOwner = (message) => smsEveryNumber(loadConfig(), message);
389
389
  export function masterMuted() {
390
390
  return loadConfig().muteAll === true;
391
391
  }
392
- async function sendNotification(message, priority, client, buttons, topic) {
392
+ async function sendNotification(message, priority, client, buttons, topic, lead) {
393
393
  const cfg = loadConfig();
394
394
  if (cfg.muteAll === true) {
395
395
  log("·", "notify", `BLOCKED — all notifications disabled (master mute), priority=${priority}`, client);
@@ -437,11 +437,12 @@ async function sendNotification(message, priority, client, buttons, topic) {
437
437
  enableTeams: able.teams,
438
438
  senders: measuredSends({
439
439
  desktop: async () => {
440
+ const text = forChannel(message, "desktop", lead);
440
441
  if (cfg.desktop?.tts) {
441
442
  const voice = cfg.desktop?.ttsVoice ?? "en-US-AndrewMultilingualNeural";
442
- speakText(message, voice).catch((err) => log("→", "tts", `ERROR: ${err instanceof Error ? err.message : String(err)}`, client));
443
+ speakText(text, voice).catch((err) => log("→", "tts", `ERROR: ${err instanceof Error ? err.message : String(err)}`, client));
443
444
  }
444
- await showBanner(CONFIG_DIR, "Claude Notify", message);
445
+ await showBanner(CONFIG_DIR, "Claude Notify", text);
445
446
  },
446
447
  telegram: async () => {
447
448
  const errors = [];
@@ -449,7 +450,7 @@ async function sendNotification(message, priority, client, buttons, topic) {
449
450
  let unformatted = 0;
450
451
  const mode = telegramParseMode(cfg);
451
452
  for (const chatId of cfg.telegram.chatIds) {
452
- const body = { chat_id: chatId, text: message };
453
+ const body = { chat_id: chatId, text: forChannel(message, "telegram", lead) };
453
454
  // NULL-OK: field buttons is OPTIONAL and therefore it is ok to check for NULL
454
455
  if (buttons !== undefined)
455
456
  body.reply_markup = buttons;
@@ -489,8 +490,8 @@ async function sendNotification(message, priority, client, buttons, topic) {
489
490
  throw new Error(errors.join("; "));
490
491
  return unformatted ? `went out UNFORMATTED to ${unformatted} chat(s): Telegram refused the formatting (can't parse entities), so the message was re-sent once as plain text` : undefined;
491
492
  },
492
- sms: () => smsEveryNumber(cfg, message),
493
- ntfy: async (_text, prio) => { await ntfyPublish(cfg, message, prio); },
493
+ sms: () => smsEveryNumber(cfg, forChannel(message, "sms", lead)),
494
+ ntfy: async (_text, prio) => { await ntfyPublish(cfg, forChannel(message, "ntfy", lead), prio); },
494
495
  discord: async (_text, prio) => {
495
496
  const colorMap = { low: 0x6b7280, normal: 0x7c6dfa, high: 0xef4444 };
496
497
  const r = await fetch(cfg.discord.webhookUrl, {
@@ -500,7 +501,7 @@ async function sendNotification(message, priority, client, buttons, topic) {
500
501
  username: cfg.discord.username ?? "Claude Notify",
501
502
  embeds: [{
502
503
  title: "Claude Notify",
503
- description: message,
504
+ description: forChannel(message, "discord", lead),
504
505
  color: colorMap[prio] ?? colorMap.normal,
505
506
  timestamp: new Date().toISOString(),
506
507
  }],
@@ -513,7 +514,7 @@ async function sendNotification(message, priority, client, buttons, topic) {
513
514
  const emojiMap = { low: "ℹ️", normal: "🔔", high: "🚨" };
514
515
  const emoji = emojiMap[prio] ?? emojiMap.normal;
515
516
  const blocks = [
516
- { type: "section", text: { type: "mrkdwn", text: `${emoji} *Claude Notify*\n${message}` } },
517
+ { type: "section", text: { type: "mrkdwn", text: `${emoji} *Claude Notify*\n${forChannel(message, "slack", lead)}` } },
517
518
  { type: "context", elements: [{ type: "mrkdwn", text: `Priority: ${prio}` }] },
518
519
  ];
519
520
  // Bot token + selected channels → one chat.postMessage per channel
@@ -560,7 +561,7 @@ async function sendNotification(message, priority, client, buttons, topic) {
560
561
  version: "1.2",
561
562
  body: [
562
563
  { type: "TextBlock", size: "Medium", weight: "Bolder", text: "Claude Notify", color: colorMap[prio] ?? "Default" },
563
- { type: "TextBlock", text: message, wrap: true },
564
+ { type: "TextBlock", text: forChannel(message, "teams", lead), wrap: true },
564
565
  { type: "TextBlock", text: `Priority: ${prio}`, isSubtle: true, size: "Small" },
565
566
  ],
566
567
  },
@@ -583,7 +584,7 @@ async function sendNotification(message, priority, client, buttons, topic) {
583
584
  };
584
585
  }
585
586
  for (const delivered of result.delivered) {
586
- log("→", delivered, message, client);
587
+ log("→", delivered, forChannel(message, delivered, lead), client);
587
588
  }
588
589
  for (const err of result.errors) {
589
590
  log("→", "notify", `ERROR: ${err}`, client);
@@ -3204,7 +3205,7 @@ function drainInboxFor(tag) {
3204
3205
  // One message, delivered as however many parts the 500-character limit needs.
3205
3206
  // Every part is sent and every part's outcome is returned — a part that reached
3206
3207
  // nobody must not be swallowed by the part before it.
3207
- async function sendChunked(message, priority, clientId) {
3208
+ async function sendChunked(message, priority, clientId, lead) {
3208
3209
  const outcomes = [];
3209
3210
  const parts = splitForNotify(message);
3210
3211
  const buttons = decisionButtons(message);
@@ -3213,7 +3214,7 @@ async function sendChunked(message, priority, clientId) {
3213
3214
  // #5063 — the buttons ride on EVERY part, not only the last: splitForNotify puts the decision link on every part too, so a
3214
3215
  // tap on any part's buttons resolves the decision (buttonPick reads the link off the message the button sits on). Attaching
3215
3216
  // them to the last part alone left every earlier part a dead end for both a tap and a reply.
3216
- outcomes.push(await sendNotification(withLead(`[${clientId}]`, chunk), priority, clientId, buttons, topic === undefined ? undefined : { ...topic, ships: topic.ships && i === parts.length - 1 }));
3217
+ outcomes.push(await sendNotification(withLead(`[${clientId}]`, chunk), priority, clientId, buttons, topic === undefined ? undefined : { ...topic, ships: topic.ships && i === parts.length - 1 }, lead));
3217
3218
  }
3218
3219
  return outcomes;
3219
3220
  }
@@ -3425,11 +3426,16 @@ export function createMcpServer(clientId, sessionTag) {
3425
3426
  .describe(`Channels per priority, each only when enabled: ${describePriorityRouting()} — high also bypasses activity gating (it never overrides DND)`),
3426
3427
  answers: z.string().max(2000).optional()
3427
3428
  .describe("The user's own words, verbatim, of the request this notification answers. Required unless the message is a board decision carrying its decision link."),
3428
- }, async ({ message, priority, answers }) => {
3429
+ per_channel_line: z.object({
3430
+ from: z.string().min(1),
3431
+ per: z.record(z.string(), z.string()),
3432
+ }).optional()
3433
+ .describe("One line of `message` that must read differently on a channel where it is not true, with the wording that channel reads instead: `from` is the line as sent on the channels not named; `per` maps a channel (telegram, slack, desktop, …) to the line it reads. Every channel the caller does not name, and every message that sends none, is delivered whole. A board decision uses it so the tap-or-reply invitation reaches only the channel whose reply rules it."),
3434
+ }, async ({ message, priority, answers, per_channel_line }) => {
3429
3435
  const unasked = refusedUnasked(message, answers, sessionTag, clientId);
3430
3436
  if (unasked !== undefined)
3431
3437
  return unasked;
3432
- const outcomes = await sendChunked(message, priority, clientId);
3438
+ const outcomes = await sendChunked(message, priority, clientId, per_channel_line);
3433
3439
  const notDelivered = outcomes.some((o) => o.outcome !== "delivered");
3434
3440
  const held = notDelivered && outcomes.every((o) => o.outcome === "blocked");
3435
3441
  const delivered = [...new Set(outcomes.filter((o) => o.outcome === "delivered").flatMap((o) => o.delivered))];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-notify-mcp",
3
- "version": "1.3.505",
3
+ "version": "1.3.506",
4
4
  "homepage": "https://www.npmjs.com/package/omni-notify-mcp",
5
5
  "description": "Reach your AI agents from anywhere — and let them reach you. One resident process on 127.0.0.1:7475 serves the whole tool surface to Claude Code, GitHub Copilot Chat and Codex: desktop, Telegram, Slack, ntfy, Discord, Teams and SMS are configured in one file, and agents notify you when long work finishes or a decision is needed, ask you a question and wait for your answer, and receive and reply to the messages you send them — with Do Not Disturb and idle detection deciding what actually gets through.",
6
6
  "main": "dist/daemon.js",