omni-notify-mcp 1.3.419 → 1.3.421

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
@@ -17,7 +17,7 @@ function packChunks(message, body, wordAware) {
17
17
  chunks.push(rest);
18
18
  return chunks;
19
19
  }
20
- const BLOCK_START = /^\s*(#{1,6}\s|>|[-*+]\s|\||```)/;
20
+ const BLOCK_START = /^\s*(#{1,6}\s|>|[-*+]\s|\||```|\*\*\S)/;
21
21
  export function withLead(lead, text) {
22
22
  return `${lead}${BLOCK_START.test(text) ? "\n" : " "}${text}`;
23
23
  }
@@ -0,0 +1,49 @@
1
+ /** #4494 — the BullseyeBacklog service's loopback door that takes a digit he replied to one of its decision messages with. */
2
+ export const BOARD_DIGIT_DOOR = "http://127.0.0.1:7471/board/decisionDigit";
3
+ /** The board's door answered something other than a ruling or a reason it ruled nothing. */
4
+ export class BoardDoorRefused extends Error {
5
+ }
6
+ /** His reply as a decision pick: a lone digit 1-4 (an optional `.` or `)` after it) sent as a reply to a message carrying a board decision link; else undefined. */
7
+ export function decisionReply(text, repliedTo) {
8
+ const digit = /^\s*([1-4])[.)]?\s*$/.exec(text)?.[1];
9
+ const link = /https?:\/\/\S+\/board\/decision\?\S+/.exec(repliedTo ?? "")?.[0];
10
+ return digit === undefined || link === undefined ? undefined : { digit, link };
11
+ }
12
+ /** The door's answer as a ruling and a report, or why it is not one. */
13
+ function answerOf(status, body) {
14
+ if (![200, 400, 409].includes(status))
15
+ throw new BoardDoorRefused(`the board answered HTTP ${status}: ${body.slice(0, 200)}`);
16
+ let said;
17
+ try {
18
+ said = JSON.parse(body);
19
+ }
20
+ catch (e) {
21
+ if (!(e instanceof SyntaxError))
22
+ throw e;
23
+ throw new BoardDoorRefused(`the board answered HTTP ${status} with a body that is not JSON: ${body.slice(0, 200)}`, { cause: e });
24
+ }
25
+ const { ruled, report } = (typeof said === "object" && said !== null ? said : {});
26
+ if (typeof ruled !== "boolean" || typeof report !== "string")
27
+ throw new BoardDoorRefused(`the board answered HTTP ${status} without a ruling and a report: ${body.slice(0, 200)}`);
28
+ return { ruled, report };
29
+ }
30
+ /**
31
+ * Hands his digit to the board, which rules that option on the story the replied-to message names. Answers the board's ruling or its
32
+ * reason for ruling nothing (an already answered, multi-pick or out-of-range decision); throws {@link BoardDoorRefused} when the door
33
+ * could not be reached, timed out, or answered out of contract.
34
+ */
35
+ export async function pickByDigit(reply, door = BOARD_DIGIT_DOOR) {
36
+ let status;
37
+ let body;
38
+ try {
39
+ const res = await fetch(door, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(reply), signal: AbortSignal.timeout(10_000) });
40
+ status = res.status;
41
+ body = await res.text();
42
+ }
43
+ catch (e) {
44
+ if (!(e instanceof TypeError || (e instanceof DOMException && e.name === "TimeoutError")))
45
+ throw e;
46
+ throw new BoardDoorRefused(`the board's door ${door} could not be reached: ${e.message}`, { cause: e });
47
+ }
48
+ return answerOf(status, body);
49
+ }
package/dist/notify.js CHANGED
@@ -27,6 +27,7 @@ import { idleNow, playVoice, showBanner } from "./desk.js";
27
27
  import { AgentGateway, AGENT_PREFIX } from "./agentGateway.js";
28
28
  import { PollCursors, DiscordPlatform, TeamsPlatform, NtfyPlatform, SmsPlatform, listenForever, pollForever } from "./messaging/chatInbound.js";
29
29
  import { EmailAgentInbox } from "./messaging/emailInbound.js";
30
+ import { BoardDoorRefused, decisionReply, pickByDigit } from "./messaging/decisionDigit.js";
30
31
  import { z } from "zod";
31
32
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
32
33
  const MANIFEST_PATH = fileURLToPath(new URL("../package.json", import.meta.url));
@@ -1187,7 +1188,24 @@ async function startTelegramListener() {
1187
1188
  // Match an outstanding ask first. If the message is tagged, only
1188
1189
  // route to a pending ask from that same session — otherwise fall
1189
1190
  // through to the inbox so the targeted session can pick it up.
1190
- const answer = takePendingAskFor(tag);
1191
+ // #4494 — a digit he replied to a board decision message with is that decision's pick, whatever else waits on him.
1192
+ const pick = tag === undefined ? decisionReply(text, msg.reply_to_message?.text) : undefined;
1193
+ let ruling;
1194
+ // NULL-OK: field pick is OPTIONAL and therefore it is ok to check for NULL
1195
+ if (pick !== undefined) {
1196
+ try {
1197
+ const said = await pickByDigit(pick);
1198
+ ruling = `${said.ruled ? "✅ RULED" : "❌ NOT RULED"}\n${said.report}`;
1199
+ log("←", "decision:digit", `${pick.digit} → ${said.report}`);
1200
+ }
1201
+ catch (err) {
1202
+ if (!(err instanceof BoardDoorRefused))
1203
+ throw err;
1204
+ // OWNER: ITER/LOOP — the board could not take his digit, so it is queued as an ordinary inbox message (never handed to another agent's pending question), why is logged, and the next update is read.
1205
+ log("·", "decision:digit", `the board did not take digit ${pick.digit}, queued as a message: ${err.message}`);
1206
+ }
1207
+ }
1208
+ const answer = pick === undefined ? takePendingAskFor(tag) : undefined;
1191
1209
  if (answer) {
1192
1210
  log("←", "ask:reply", text, tag);
1193
1211
  answer(text);
@@ -1196,7 +1214,7 @@ async function startTelegramListener() {
1196
1214
  const entry = {
1197
1215
  text, ts: arrivedAt.toISOString(), messageId: msg.message_id, chatId: fromChatId, tag, origin: "telegram",
1198
1216
  };
1199
- const ackText = ingestChatEntry(entry);
1217
+ const ackText = ruling ?? ingestChatEntry(entry);
1200
1218
  if (masterMuted())
1201
1219
  continue;
1202
1220
  // OWNER: ITER/LOOP — a non-2xx does not reject a fetch, so a refused acknowledgement would read as delivered; this frame reports it and the next update is read.
@@ -39,6 +39,7 @@ if (!(PROCESS_KEY in globalThis)) {
39
39
  const PROCESS = globalThis[PROCESS_KEY];
40
40
  // NULL-OK: field actToken is OPTIONAL and therefore it is ok to check for NULL
41
41
  PROCESS.actToken ??= crypto.randomBytes(24).toString("hex");
42
+ PROCESS.hosts ??= new Set();
42
43
  const ACT_PATH = "/__bullseye/act";
43
44
  // GATE: an act body larger than this is answered 413 and never parsed.
44
45
  const ACT_BODY_BYTES = 65_536;
@@ -731,6 +732,7 @@ class WebHost {
731
732
  }
732
733
  this.server = server;
733
734
  this.port = server.address().port;
735
+ PROCESS.hosts.add(this);
734
736
  this.publish();
735
737
  },
736
738
  // OWNER: the listen began in activate() and nothing awaits it — the refused bind becomes this window's web UI record, which the Bullseye dashboard draws on the extension's card, and the VS Code view runs on without its web page
@@ -749,6 +751,12 @@ class WebHost {
749
751
  this.server.close();
750
752
  this.server = undefined;
751
753
  }
754
+ PROCESS.hosts.delete(this);
755
+ const survivor = [...PROCESS.hosts].find((host) => host.extension === this.extension);
756
+ if (survivor !== undefined) {
757
+ survivor.publish();
758
+ return;
759
+ }
752
760
  PROCESS.records.delete(this.extension);
753
761
  fs.rmSync(this.recordFile(), { force: true });
754
762
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-notify-mcp",
3
- "version": "1.3.419",
3
+ "version": "1.3.421",
4
4
  "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.",
5
5
  "main": "dist/daemon.js",
6
6
  "type": "module",