omni-notify-mcp 1.3.341 → 1.3.342
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/daemon.js +2 -3
- package/dist/notify.js +68 -119
- package/package.json +1 -1
package/dist/daemon.js
CHANGED
|
@@ -104,7 +104,7 @@ let handedOver;
|
|
|
104
104
|
// Only the daemon that owns the gateway port runs the connector and publishes its state: a dormant one has nothing for it to reach.
|
|
105
105
|
const tunnel = new TunnelRunner();
|
|
106
106
|
const daemonHost = {
|
|
107
|
-
clientId: DAEMON_TAG, tag: DAEMON_TAG,
|
|
107
|
+
clientId: DAEMON_TAG, tag: DAEMON_TAG,
|
|
108
108
|
onDoorOwned: (port) => {
|
|
109
109
|
tunnel.beat(port);
|
|
110
110
|
setInterval(() => tunnel.beat(port), HEARTBEAT_MS);
|
|
@@ -112,8 +112,7 @@ const daemonHost = {
|
|
|
112
112
|
onSuperseded: () => (handedOver === undefined ? replaceWithInstalledBuild() : void handedOver.then(() => process.exit(0))),
|
|
113
113
|
};
|
|
114
114
|
startNotifyServer(daemonHost);
|
|
115
|
-
|
|
116
|
-
takePendingInbox(daemonHost);
|
|
115
|
+
takePendingInbox();
|
|
117
116
|
startNotifyDoor(() => { beating = true; beat(); }, undefined, {
|
|
118
117
|
version: PACKAGE_VERSION,
|
|
119
118
|
takeover,
|
package/dist/notify.js
CHANGED
|
@@ -37,9 +37,8 @@ function installedVersion() {
|
|
|
37
37
|
export const PACKAGE_VERSION = installedVersion();
|
|
38
38
|
/**
|
|
39
39
|
* The identity one chat reports and the tag its messages are routed by: `<machine>-<workspace>[-<session>]`.
|
|
40
|
-
* The HTTP door derives it from the headers its client sends
|
|
41
|
-
*
|
|
42
|
-
* system directory names, and a session id (when the host has one) tells two windows on one workspace apart.
|
|
40
|
+
* The HTTP door derives it from the headers its client sends: the workspace is walked up from the project folder,
|
|
41
|
+
* skipping launcher and system directory names, and a session id (when the host has one) tells two windows on one workspace apart.
|
|
43
42
|
* The session part is only ever what a host ACTUALLY sends: a Claude Code MCP header does not expand
|
|
44
43
|
* `${CLAUDE_CODE_SESSION_ID}` — measured, the literal string arrives — so an HTTP chat there is named by its
|
|
45
44
|
* workspace alone and two windows on one workspace share that name.
|
|
@@ -51,9 +50,6 @@ const GENERIC_DIRS = new Set([
|
|
|
51
50
|
]);
|
|
52
51
|
export function sessionIdentity(from) {
|
|
53
52
|
const cleanId = (s) => s.toLowerCase().replace(/[^a-z0-9_-]/g, "");
|
|
54
|
-
const explicit = cleanId(from.explicitTag ?? "");
|
|
55
|
-
if (explicit !== "")
|
|
56
|
-
return explicit;
|
|
57
53
|
// A request that names no workspace never inherits the serving process's own folder: the name it falls back to
|
|
58
54
|
// is the caller's, so a chat is never told it is some other workspace's session.
|
|
59
55
|
const root = from.projectDir ?? "";
|
|
@@ -755,22 +751,21 @@ function persistInboxQueue(arrivals = []) {
|
|
|
755
751
|
rmSync(join(CONFIG_DIR, other), { force: true });
|
|
756
752
|
}
|
|
757
753
|
}
|
|
758
|
-
// Entries in the shared queue
|
|
759
|
-
//
|
|
760
|
-
function
|
|
754
|
+
// Entries in the shared queue that the daemon has not taken yet. Each is recorded as taken (in memory
|
|
755
|
+
// and in the shared file, so it is never taken twice) and handed over.
|
|
756
|
+
function takeSharedEntries(saved) {
|
|
761
757
|
const mine = [];
|
|
762
758
|
for (const { deliveredTo, ...entry } of saved) {
|
|
763
759
|
if (deliveredTo.includes(deliveredKey(SELF_TAG)) || alreadyDelivered(entry, SELF_TAG))
|
|
764
760
|
continue;
|
|
765
761
|
// The daemon is the machine's queue: it holds every chat's undelivered entry in memory, tagged ones
|
|
766
762
|
// included, because the HTTP chats it serves are the only readers of a tagged entry and each drains its own by
|
|
767
|
-
// tag.
|
|
768
|
-
//
|
|
769
|
-
|
|
770
|
-
mine.push(entry);
|
|
763
|
+
// tag. An entry a chat already drained is marked per tag in the shared file, and that mark is what keeps a
|
|
764
|
+
// second reader from delivering it again.
|
|
765
|
+
mine.push(entry);
|
|
771
766
|
}
|
|
772
767
|
if (mine.length === 0)
|
|
773
|
-
return
|
|
768
|
+
return;
|
|
774
769
|
for (const entry of mine) {
|
|
775
770
|
// Only the entry addressed to this host is recorded as taken by it; a tagged entry another chat owns stays
|
|
776
771
|
// unmarked here and is marked when that chat drains it.
|
|
@@ -782,7 +777,6 @@ function takeSharedEntriesForSelf(saved) {
|
|
|
782
777
|
log("·", "inbox", "taken from the shared queue", entry.tag ?? SELF_TAG);
|
|
783
778
|
}
|
|
784
779
|
persistInboxQueue();
|
|
785
|
-
return mine;
|
|
786
780
|
}
|
|
787
781
|
// A message this process took meets its live consumers here: the open question a reply on an
|
|
788
782
|
// answering channel answers, else every parked wait_for_inbox, else the queue the session's next tool result drains.
|
|
@@ -800,7 +794,8 @@ function handOver(entry) {
|
|
|
800
794
|
markDelivered(entry, w.tag);
|
|
801
795
|
w.resolve([entry]);
|
|
802
796
|
}
|
|
803
|
-
|
|
797
|
+
// an untagged entry is every chat's: the ones parked took it, the ones not parked drain it from the queue
|
|
798
|
+
if (waiters.length === 0 || !entry.tag)
|
|
804
799
|
inboxQueue.push(entry);
|
|
805
800
|
}
|
|
806
801
|
// The open question a reply answers: one asked by the session the reply is tagged for, or any
|
|
@@ -849,15 +844,10 @@ function matchesSession(entry, sessionTag) {
|
|
|
849
844
|
return true; // untagged → everyone
|
|
850
845
|
return entry.tag === sessionTag; // tagged → only matching session
|
|
851
846
|
}
|
|
852
|
-
// Set once by startNotifyServer() from the
|
|
853
|
-
//
|
|
854
|
-
// host: there is no other session in here to route to.
|
|
847
|
+
// Set once by startNotifyServer() from the tag its host gave it: the daemon's own tag, the one the shared queue keeps its
|
|
848
|
+
// own reads under.
|
|
855
849
|
let SELF_TAG;
|
|
856
|
-
|
|
857
|
-
function matchesSelfTag(tag) {
|
|
858
|
-
return tag === undefined || tag === SELF_TAG;
|
|
859
|
-
}
|
|
860
|
-
// ── /btw file-drop bridge ─────────────────────────────────────────────────────
|
|
850
|
+
// ── /btw file-drop ─────────────────────────────────────────────────────
|
|
861
851
|
// Claude Code has no API for injecting a prompt into a running session while a
|
|
862
852
|
// tool call is executing (anthropics/claude-code#27441, still open). The only
|
|
863
853
|
// in-band channel is the `FileChanged` hook: when a watched file changes on
|
|
@@ -869,7 +859,7 @@ function matchesSelfTag(tag) {
|
|
|
869
859
|
// closest thing to a "/btw" we can get until the client exposes a real inject
|
|
870
860
|
// endpoint.
|
|
871
861
|
// Test mode drops to an isolated dir so a smoke run never pollutes the live
|
|
872
|
-
// inbox the hook
|
|
862
|
+
// inbox the hook reads (sim/live separation).
|
|
873
863
|
const INBOX_DROP_DIR = join(CONFIG_DIR, process.env.NOTIFY_MCP_TEST_ENDPOINTS === "1" ? "inbox-test" : "inbox");
|
|
874
864
|
const INBOX_DROP_TTL_MS = 24 * 60 * 60 * 1000; // 24h — hook should have consumed within seconds
|
|
875
865
|
function writeInboxDrop(entry) {
|
|
@@ -930,7 +920,7 @@ function rejectDrop(path, name, reason) {
|
|
|
930
920
|
renameSync(path, `${path}.rejected`);
|
|
931
921
|
log("·", "inbox-drop", `${name} is not a well-formed drop and was kept as .rejected: ${reason}`);
|
|
932
922
|
}
|
|
933
|
-
function retryUnreadDrops(unread
|
|
923
|
+
function retryUnreadDrops(unread) {
|
|
934
924
|
if (unread.length === 0) {
|
|
935
925
|
dropFailedPasses = 0;
|
|
936
926
|
return;
|
|
@@ -949,7 +939,7 @@ function retryUnreadDrops(unread, host) {
|
|
|
949
939
|
log("·", "inbox-drop", `could not read ${which}; they stay in inbox-drop, read again in ${waitMs} ms (retry ${dropFailedPasses} of ${DROP_READ_RETRIES})`);
|
|
950
940
|
setTimeout(() => {
|
|
951
941
|
dropRetryPending = false;
|
|
952
|
-
ingestDropFolder(
|
|
942
|
+
ingestDropFolder();
|
|
953
943
|
}, waitMs).unref();
|
|
954
944
|
}
|
|
955
945
|
function processIsAlive(pid) {
|
|
@@ -1019,7 +1009,7 @@ function claimDrop(marker) {
|
|
|
1019
1009
|
rmSync(takeover, { force: true });
|
|
1020
1010
|
}
|
|
1021
1011
|
}
|
|
1022
|
-
function ingestDropFolder(
|
|
1012
|
+
function ingestDropFolder() {
|
|
1023
1013
|
if (!existsSync(INBOX_DROP_IN_DIR))
|
|
1024
1014
|
return;
|
|
1025
1015
|
mkdirSync(INBOX_DROP_CLAIM_DIR, { recursive: true });
|
|
@@ -1072,12 +1062,12 @@ function ingestDropFolder(host) {
|
|
|
1072
1062
|
log("·", "inbox-drop", `${name} could not be claimed or settled and stays in the folder: ${err instanceof Error ? err.message : String(err)}`);
|
|
1073
1063
|
}
|
|
1074
1064
|
}
|
|
1075
|
-
retryUnreadDrops(unread
|
|
1065
|
+
retryUnreadDrops(unread);
|
|
1076
1066
|
if (arrivals.length === 0)
|
|
1077
1067
|
return;
|
|
1078
1068
|
persistInboxQueue(arrivals);
|
|
1079
1069
|
log("·", "inbox-drop", `queued ${arrivals.length} message${arrivals.length === 1 ? "" : "s"} from ${INBOX_DROP_IN_DIR}`);
|
|
1080
|
-
syncInboxFromDisk(
|
|
1070
|
+
syncInboxFromDisk();
|
|
1081
1071
|
}
|
|
1082
1072
|
function ingestInboxEntry(entry, source) {
|
|
1083
1073
|
const waiters = takeWaitersFor(entry.tag);
|
|
@@ -1088,7 +1078,8 @@ function ingestInboxEntry(entry, source) {
|
|
|
1088
1078
|
w.resolve([entry]);
|
|
1089
1079
|
}
|
|
1090
1080
|
}
|
|
1091
|
-
|
|
1081
|
+
// an untagged entry is every chat's: the ones parked took it, the ones not parked drain it from the queue
|
|
1082
|
+
if (waiters.length === 0 || !entry.tag) {
|
|
1092
1083
|
inboxQueue.push(entry);
|
|
1093
1084
|
writeInboxDrop(entry);
|
|
1094
1085
|
}
|
|
@@ -1096,7 +1087,6 @@ function ingestInboxEntry(entry, source) {
|
|
|
1096
1087
|
markDelivered(entry, SELF_TAG);
|
|
1097
1088
|
persistInboxQueue();
|
|
1098
1089
|
log("·", "inbox", `${source}: ${entry.text} (waiters=${waiters.length})`, entry.tag);
|
|
1099
|
-
return { waiters: waiters.length };
|
|
1100
1090
|
}
|
|
1101
1091
|
// #770's late answer: the reply to a question the caller ASKED, so it is queued
|
|
1102
1092
|
// for that caller's own inbox rather than pushed at every subscriber — the
|
|
@@ -1109,22 +1099,11 @@ function queueInboxEntry(entry) {
|
|
|
1109
1099
|
persistInboxQueue();
|
|
1110
1100
|
}
|
|
1111
1101
|
function ingestChatEntry(entry) {
|
|
1112
|
-
|
|
1102
|
+
ingestInboxEntry(entry, entry.origin ?? "telegram");
|
|
1113
1103
|
// The daemon serves no session of its own, so it cannot say who is connected — only that the shared inbox holds the message.
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
: "📬 Queued. Delivered to every agent session that connects.";
|
|
1118
|
-
const listening = waiters > 0 || matchesSelfTag(entry.tag);
|
|
1119
|
-
// NULL-OK: field tag is OPTIONAL and therefore it is ok to check for NULL
|
|
1120
|
-
if (entry.tag) {
|
|
1121
|
-
return listening
|
|
1122
|
-
? `📬 Routed to @${entry.tag}. Waiting for reply.`
|
|
1123
|
-
: `📭 No session @${entry.tag} connected. Message queued — next @${entry.tag} to connect will pick it up.`;
|
|
1124
|
-
}
|
|
1125
|
-
return listening
|
|
1126
|
-
? "📬 Queued for every connected agent. Waiting for reply."
|
|
1127
|
-
: "📭 No agents connected. Message queued — next agent to connect will pick it up.";
|
|
1104
|
+
return entry.tag
|
|
1105
|
+
? `📬 Queued for @${entry.tag}. Delivered when that session is connected.`
|
|
1106
|
+
: "📬 Queued. Delivered to every agent session that connects.";
|
|
1128
1107
|
}
|
|
1129
1108
|
async function initTgOffset(token) {
|
|
1130
1109
|
const r = await fetch(tgApi(token, "getUpdates?offset=-1&timeout=0"));
|
|
@@ -1680,20 +1659,25 @@ async function slackSend(text) {
|
|
|
1680
1659
|
if (!json.ok)
|
|
1681
1660
|
throw new Error(`chat.postMessage: ${json.error ?? "unknown"}`);
|
|
1682
1661
|
}
|
|
1683
|
-
// The tags a user can @-address from Slack
|
|
1684
|
-
//
|
|
1662
|
+
// The tags a user can @-address from Slack: the tags of the chats connected
|
|
1663
|
+
// right now, i.e. the ones holding a live inbox waiter.
|
|
1685
1664
|
function slackClientTags() {
|
|
1686
|
-
|
|
1665
|
+
const tags = new Set();
|
|
1666
|
+
for (const [, w] of inboxWaiters)
|
|
1667
|
+
if (w.tag !== undefined)
|
|
1668
|
+
tags.add(w.tag);
|
|
1669
|
+
return [...tags];
|
|
1687
1670
|
}
|
|
1688
1671
|
// How many live agents would actually receive a message with this tag (undefined
|
|
1689
1672
|
// = broadcast). Used to gate the Slack ack: an "ack" posted when nobody is
|
|
1690
1673
|
// connected is a lie — the message only sits queued for the next connector.
|
|
1674
|
+
// The daemon serves no session of its own, so it is never counted.
|
|
1691
1675
|
function liveListenerCount(tag) {
|
|
1692
1676
|
let waiters = 0;
|
|
1693
1677
|
for (const [, w] of inboxWaiters)
|
|
1694
1678
|
if (!tag || w.tag === tag)
|
|
1695
1679
|
waiters++;
|
|
1696
|
-
return waiters
|
|
1680
|
+
return waiters;
|
|
1697
1681
|
}
|
|
1698
1682
|
function slackClientsNumbered() {
|
|
1699
1683
|
const tags = slackClientTags();
|
|
@@ -1890,14 +1874,14 @@ async function routeSlackInbox(m) {
|
|
|
1890
1874
|
log("←", "slack", `unknown client: ${handle}`);
|
|
1891
1875
|
return;
|
|
1892
1876
|
}
|
|
1877
|
+
const listening = liveListenerCount(tag) > 0; // counted BEFORE ingest, which hands the message to and removes its waiters
|
|
1893
1878
|
ingestInboxEntry({ text: msg, ts: new Date().toISOString(), tag, origin: "slack" }, "slack");
|
|
1894
|
-
|
|
1895
|
-
await slackPost("ack");
|
|
1879
|
+
await slackPost(listening ? "ack" : `📭 No session @${displayTag(tag)} connected. Message queued — next @${displayTag(tag)} to connect will pick it up.`);
|
|
1896
1880
|
}
|
|
1897
1881
|
else {
|
|
1882
|
+
const listening = liveListenerCount(undefined) > 0; // counted BEFORE ingest, which hands the message to and removes its waiters
|
|
1898
1883
|
ingestInboxEntry({ text, ts: new Date().toISOString(), origin: "slack" }, "slack");
|
|
1899
|
-
|
|
1900
|
-
await slackPost("ack");
|
|
1884
|
+
await slackPost(listening ? "ack" : "📭 No agents connected. Message queued — next agent to connect will pick it up.");
|
|
1901
1885
|
}
|
|
1902
1886
|
}
|
|
1903
1887
|
async function pollSlackOnce(token, channel) {
|
|
@@ -2023,13 +2007,20 @@ function drainInboxFor(tag) {
|
|
|
2023
2007
|
const taken = [];
|
|
2024
2008
|
const queuedBefore = inboxQueue.length;
|
|
2025
2009
|
for (let i = inboxQueue.length - 1; i >= 0; i--) {
|
|
2026
|
-
|
|
2010
|
+
const entry = inboxQueue[i];
|
|
2011
|
+
if (!entry.tag && Date.now() - Date.parse(entry.ts) >= INBOX_ENTRY_TTL_MS) {
|
|
2012
|
+
inboxQueue.splice(i, 1);
|
|
2013
|
+
continue;
|
|
2014
|
+
}
|
|
2015
|
+
if (!matchesSession(entry, tag) || alreadyDelivered(entry, tag))
|
|
2027
2016
|
continue;
|
|
2028
|
-
markDelivered(
|
|
2029
|
-
taken.unshift(
|
|
2030
|
-
|
|
2017
|
+
markDelivered(entry, tag);
|
|
2018
|
+
taken.unshift(entry);
|
|
2019
|
+
// a tagged entry has one reader, so it leaves the queue with it; an untagged one stays for every other chat until its lifetime ends
|
|
2020
|
+
if (entry.tag)
|
|
2021
|
+
inboxQueue.splice(i, 1);
|
|
2031
2022
|
}
|
|
2032
|
-
if (inboxQueue.length !== queuedBefore)
|
|
2023
|
+
if (taken.length > 0 || inboxQueue.length !== queuedBefore)
|
|
2033
2024
|
persistInboxQueue();
|
|
2034
2025
|
return taken;
|
|
2035
2026
|
}
|
|
@@ -2380,8 +2371,7 @@ export function createMcpServer(clientId, sessionTag) {
|
|
|
2380
2371
|
? "WAS delivered over telegram"
|
|
2381
2372
|
: "was NOT delivered over anything";
|
|
2382
2373
|
// A blocking MCP tool call does not survive longer than the caller's own
|
|
2383
|
-
// request timeout — MEASURED 2026-09-20 against a real MCP client
|
|
2384
|
-
// stdio bridge: `ask` with timeout_seconds=300 threw `MCP error -32001:
|
|
2374
|
+
// request timeout — MEASURED 2026-09-20 against a real MCP client: `ask` with timeout_seconds=300 threw `MCP error -32001:
|
|
2385
2375
|
// Request timed out` at exactly 60.0s, while the server kept the question
|
|
2386
2376
|
// parked and any answer went into a promise whose caller was gone. So the
|
|
2387
2377
|
// WAIT is clamped and the caller is TOLD; the question itself stays open
|
|
@@ -2509,9 +2499,6 @@ export function createMcpServer(clientId, sessionTag) {
|
|
|
2509
2499
|
"carry, and a channel nothing has measured, each hold it false and are named in " +
|
|
2510
2500
|
"`reason`. Read `channels` for the ones that can carry and `carriage` for the " +
|
|
2511
2501
|
"per-channel state. Do NOT report the user as reachable off `process`.", {}, async () => {
|
|
2512
|
-
// Deliberately NOT logged: this server's `log()` writes to stdout, which on
|
|
2513
|
-
// a stdio server is the JSON-RPC channel, so a line here would interleave
|
|
2514
|
-
// with the tool result. See the finding filed against the stdout trail.
|
|
2515
2502
|
const verdict = deliveryReport();
|
|
2516
2503
|
return { content: [{ type: "text", text: appendInbox(JSON.stringify(verdict), sessionTag, clientId) }] };
|
|
2517
2504
|
});
|
|
@@ -2671,33 +2658,8 @@ function startOwnedWork() {
|
|
|
2671
2658
|
AgentGateway.instance().boot();
|
|
2672
2659
|
log("·", "listener", `this process (pid ${process.pid}, build ${PACKAGE_VERSION}) owns the Telegram, Slack, Discord and Teams pollers, the ntfy and SMS pollers, the agent's email door, and the agent conversations`);
|
|
2673
2660
|
}
|
|
2674
|
-
// GATE: a daemon's beat older than this is presumed dead; it is vscode-extension/bnDaemon.js's own STALE_MS.
|
|
2675
|
-
const DAEMON_BEAT_STALE_MS = 30_000;
|
|
2676
2661
|
/** Written by the daemon (daemon.ts) on its beat, read by vscode-extension/bnDaemon.js. */
|
|
2677
2662
|
export const DAEMON_BEAT_PATH = join(CONFIG_DIR, "daemon.json");
|
|
2678
|
-
/** The daemon's last beat, or undefined when it never wrote one. */
|
|
2679
|
-
function latestBeat() {
|
|
2680
|
-
return existsSync(DAEMON_BEAT_PATH) ? JSON.parse(readFileSync(DAEMON_BEAT_PATH, "utf8")) : undefined;
|
|
2681
|
-
}
|
|
2682
|
-
/** A daemon is alive and beating — of the given build, when one is named. */
|
|
2683
|
-
function daemonBeats(version) {
|
|
2684
|
-
const beat = latestBeat();
|
|
2685
|
-
if (beat === undefined)
|
|
2686
|
-
return false;
|
|
2687
|
-
if (Date.now() - beat.at >= DAEMON_BEAT_STALE_MS || (version !== undefined && beat.version !== version))
|
|
2688
|
-
return false;
|
|
2689
|
-
try {
|
|
2690
|
-
process.kill(beat.pid, 0);
|
|
2691
|
-
return true;
|
|
2692
|
-
}
|
|
2693
|
-
catch (err) {
|
|
2694
|
-
if (err.code === "ESRCH")
|
|
2695
|
-
return false;
|
|
2696
|
-
if (err.code === "EPERM")
|
|
2697
|
-
return true;
|
|
2698
|
-
throw err;
|
|
2699
|
-
}
|
|
2700
|
-
}
|
|
2701
2663
|
let lastBindRefusal = "";
|
|
2702
2664
|
let lastOtherBn = "";
|
|
2703
2665
|
let lastProbeFailure = "";
|
|
@@ -2715,9 +2677,7 @@ export function yieldGateway() {
|
|
|
2715
2677
|
}
|
|
2716
2678
|
/**
|
|
2717
2679
|
* Once the extension installs a newer build, this process is superseded and the gateway passes to the installed build:
|
|
2718
|
-
*
|
|
2719
|
-
* answer is in flight — the daemon at once, since it starts the installed build in its place, and a
|
|
2720
|
-
* bridge once the installed build's daemon beats to take it over.
|
|
2680
|
+
* one that holds it steps aside once no answer is in flight, and then starts the installed build in its place.
|
|
2721
2681
|
*/
|
|
2722
2682
|
function tryOwnGateway(polling, host) {
|
|
2723
2683
|
if (ownershipAttempting)
|
|
@@ -2728,16 +2688,11 @@ function tryOwnGateway(polling, host) {
|
|
|
2728
2688
|
log("·", "listener", `build ${PACKAGE_VERSION} is superseded by ${yielding ? "the release that asked for the chat door" : `the installed ${installed}`}; this process hands the gateway to it`);
|
|
2729
2689
|
supersededSaid = true;
|
|
2730
2690
|
if (door !== undefined) {
|
|
2731
|
-
|
|
2732
|
-
void stepAside(polling, host);
|
|
2691
|
+
void stepAside(polling, host);
|
|
2733
2692
|
return;
|
|
2734
2693
|
}
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
return;
|
|
2738
|
-
}
|
|
2739
|
-
if (daemonBeats())
|
|
2740
|
-
return;
|
|
2694
|
+
host.onSuperseded();
|
|
2695
|
+
return;
|
|
2741
2696
|
}
|
|
2742
2697
|
if (door !== undefined)
|
|
2743
2698
|
return;
|
|
@@ -2809,21 +2764,15 @@ async function stepAside(polling, host) {
|
|
|
2809
2764
|
finally {
|
|
2810
2765
|
ownershipAttempting = false;
|
|
2811
2766
|
}
|
|
2812
|
-
host.onSuperseded
|
|
2767
|
+
host.onSuperseded();
|
|
2813
2768
|
}
|
|
2814
|
-
// Messages another
|
|
2815
|
-
//
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
for (const entry of takeSharedEntriesForSelf(readSharedQueue())) {
|
|
2819
|
-
host.emit(entry).catch((err) =>
|
|
2820
|
-
// OWNER: the message is already in this host's inbox and in the shared queue, so a refused push costs the push alone — it is reported once here and the caller's next poll or wait_for_inbox still hands the message over.
|
|
2821
|
-
log("·", "inbox", `channel push failed: ${err instanceof Error ? err.message : String(err)}`, host.clientId));
|
|
2822
|
-
}
|
|
2769
|
+
// Messages another process's poller recorded: hand them to the tool layer, and
|
|
2770
|
+
// record it in the shared file so no process delivers the same message twice.
|
|
2771
|
+
function syncInboxFromDisk() {
|
|
2772
|
+
takeSharedEntries(readSharedQueue());
|
|
2823
2773
|
}
|
|
2824
2774
|
export function startNotifyServer(host) {
|
|
2825
2775
|
SELF_TAG = host.tag;
|
|
2826
|
-
QUEUE_ONLY = host.queueOnly === true;
|
|
2827
2776
|
importCredsOnStart();
|
|
2828
2777
|
warnIfNoChannelConfigured(loadConfig());
|
|
2829
2778
|
refreshReach();
|
|
@@ -2854,7 +2803,7 @@ export function startNotifyServer(host) {
|
|
|
2854
2803
|
if (dropWatched || !existsSync(INBOX_DROP_IN_DIR))
|
|
2855
2804
|
return;
|
|
2856
2805
|
dropWatched = true;
|
|
2857
|
-
const drops = watch(INBOX_DROP_IN_DIR, { persistent: false }, () => ingestDropFolder(
|
|
2806
|
+
const drops = watch(INBOX_DROP_IN_DIR, { persistent: false }, () => ingestDropFolder());
|
|
2858
2807
|
// The drop folder was taken away: its watch is gone, and the folder's return is seen on the config folder's own watch.
|
|
2859
2808
|
drops.on("error", () => { dropWatched = false; });
|
|
2860
2809
|
};
|
|
@@ -2862,10 +2811,10 @@ export function startNotifyServer(host) {
|
|
|
2862
2811
|
watchNames(CONFIG_DIR, (name) => INBOX_QUEUE_FILE.test(name) || name === basename(INBOX_DROP_IN_DIR), (name) => {
|
|
2863
2812
|
if (name === undefined || name === basename(INBOX_DROP_IN_DIR)) {
|
|
2864
2813
|
watchDrops();
|
|
2865
|
-
ingestDropFolder(
|
|
2814
|
+
ingestDropFolder();
|
|
2866
2815
|
}
|
|
2867
2816
|
if (name !== basename(INBOX_DROP_IN_DIR) && !name?.startsWith(OWN_QUEUE_PREFIX))
|
|
2868
|
-
syncInboxFromDisk(
|
|
2817
|
+
syncInboxFromDisk();
|
|
2869
2818
|
});
|
|
2870
2819
|
watchDrops();
|
|
2871
2820
|
const reapTimer = setInterval(reapInboxDrops, 60 * 60 * 1000);
|
|
@@ -2873,8 +2822,8 @@ export function startNotifyServer(host) {
|
|
|
2873
2822
|
reapTimer.unref();
|
|
2874
2823
|
return createMcpServer(host.clientId, host.tag);
|
|
2875
2824
|
}
|
|
2876
|
-
/** Takes in what was queued or dropped before this process started.
|
|
2877
|
-
export function takePendingInbox(
|
|
2878
|
-
ingestDropFolder(
|
|
2879
|
-
syncInboxFromDisk(
|
|
2825
|
+
/** Takes in what was queued or dropped before this process started. */
|
|
2826
|
+
export function takePendingInbox() {
|
|
2827
|
+
ingestDropFolder();
|
|
2828
|
+
syncInboxFromDisk();
|
|
2880
2829
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-notify-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.342",
|
|
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",
|