omni-notify-mcp 1.3.336 → 1.3.337
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/notify.js +54 -5
- package/package.json +1 -1
package/dist/notify.js
CHANGED
|
@@ -920,9 +920,42 @@ function reapInboxDrops() {
|
|
|
920
920
|
// The drop folder is how a process that is not this one (the trading app's alerts) hands the notify app a
|
|
921
921
|
// message, because only the notify app writes its queue. One .json file per message, staged as .tmp and
|
|
922
922
|
// renamed by the writer; each is claimed through an exclusive hard link in the claims folder, so exactly one host process takes it,
|
|
923
|
-
// queued UNTAGGED so every window sees it, and deleted.
|
|
923
|
+
// queued UNTAGGED so every window sees it, and deleted. A file that cannot be read stays in the folder for the next pass;
|
|
924
|
+
// only a file whose content is bad is kept as .rejected, never silently dropped.
|
|
924
925
|
const INBOX_DROP_IN_DIR = join(CONFIG_DIR, "inbox-drop");
|
|
925
926
|
const INBOX_DROP_CLAIM_DIR = join(CONFIG_DIR, "inbox-drop-claims");
|
|
927
|
+
const DROP_READ_FAILURE_CODES = new Set(["EACCES", "EPERM", "EBUSY", "EMFILE", "ENFILE"]);
|
|
928
|
+
// GATE: a pass that leaves drops unread for a passing reason runs the folder's pass again on its own this many times, each wait twice the one before from the first; past the last the folder waits for its next write or the next start.
|
|
929
|
+
const DROP_READ_RETRIES = 5;
|
|
930
|
+
const DROP_READ_RETRY_FIRST_MS = 200;
|
|
931
|
+
let dropRetryPending = false;
|
|
932
|
+
let dropFailedPasses = 0;
|
|
933
|
+
function rejectDrop(path, name, reason) {
|
|
934
|
+
renameSync(path, `${path}.rejected`);
|
|
935
|
+
log("·", "inbox-drop", `${name} is not a well-formed drop and was kept as .rejected: ${reason}`);
|
|
936
|
+
}
|
|
937
|
+
function retryUnreadDrops(unread, host) {
|
|
938
|
+
if (unread.length === 0) {
|
|
939
|
+
dropFailedPasses = 0;
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
if (dropRetryPending)
|
|
943
|
+
return;
|
|
944
|
+
const which = `${unread.length} drop${unread.length === 1 ? "" : "s"} (${unread[0].code}), first ${unread[0].name}`;
|
|
945
|
+
if (dropFailedPasses === DROP_READ_RETRIES) {
|
|
946
|
+
dropFailedPasses = 0;
|
|
947
|
+
log("·", "inbox-drop", `could not read ${which} after ${DROP_READ_RETRIES} retries; they stay in inbox-drop until its next write or the next start`);
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
const waitMs = DROP_READ_RETRY_FIRST_MS * 2 ** dropFailedPasses;
|
|
951
|
+
dropFailedPasses++;
|
|
952
|
+
dropRetryPending = true;
|
|
953
|
+
log("·", "inbox-drop", `could not read ${which}; they stay in inbox-drop, read again in ${waitMs} ms (retry ${dropFailedPasses} of ${DROP_READ_RETRIES})`);
|
|
954
|
+
setTimeout(() => {
|
|
955
|
+
dropRetryPending = false;
|
|
956
|
+
ingestDropFolder(host);
|
|
957
|
+
}, waitMs).unref();
|
|
958
|
+
}
|
|
926
959
|
function processIsAlive(pid) {
|
|
927
960
|
try {
|
|
928
961
|
process.kill(pid, 0);
|
|
@@ -995,6 +1028,7 @@ function ingestDropFolder(host) {
|
|
|
995
1028
|
return;
|
|
996
1029
|
mkdirSync(INBOX_DROP_CLAIM_DIR, { recursive: true });
|
|
997
1030
|
const arrivals = [];
|
|
1031
|
+
const unread = [];
|
|
998
1032
|
for (const name of readdirSync(INBOX_DROP_IN_DIR).filter((f) => f.endsWith(".json"))) {
|
|
999
1033
|
const path = join(INBOX_DROP_IN_DIR, name);
|
|
1000
1034
|
const marker = join(INBOX_DROP_CLAIM_DIR, `${name}.claim`);
|
|
@@ -1002,18 +1036,32 @@ function ingestDropFolder(host) {
|
|
|
1002
1036
|
if (!claimDrop(marker))
|
|
1003
1037
|
continue;
|
|
1004
1038
|
try {
|
|
1005
|
-
|
|
1039
|
+
let raw;
|
|
1040
|
+
try {
|
|
1041
|
+
raw = readFileSync(path, "utf8");
|
|
1042
|
+
}
|
|
1043
|
+
catch (err) {
|
|
1044
|
+
const code = err.code;
|
|
1045
|
+
if (code === "ENOENT")
|
|
1046
|
+
continue;
|
|
1047
|
+
if (code === "EISDIR") {
|
|
1048
|
+
rejectDrop(path, name, "it is a folder, not a file");
|
|
1049
|
+
continue;
|
|
1050
|
+
}
|
|
1051
|
+
if (!DROP_READ_FAILURE_CODES.has(code ?? ""))
|
|
1052
|
+
throw err;
|
|
1053
|
+
unread.push({ name, code: String(code) });
|
|
1006
1054
|
continue;
|
|
1055
|
+
}
|
|
1007
1056
|
let entry;
|
|
1008
1057
|
try {
|
|
1009
|
-
const { text, ts } = JSON.parse(
|
|
1058
|
+
const { text, ts } = JSON.parse(raw);
|
|
1010
1059
|
if (typeof text !== "string" || text === "")
|
|
1011
1060
|
throw new Error("no text");
|
|
1012
1061
|
entry = { text, ts: typeof ts === "string" ? ts : new Date().toISOString(), origin: "drop" };
|
|
1013
1062
|
}
|
|
1014
1063
|
catch (err) {
|
|
1015
|
-
|
|
1016
|
-
log("·", "inbox-drop", `${name} is not a well-formed drop and was kept as .rejected: ${err instanceof Error ? err.message : String(err)}`);
|
|
1064
|
+
rejectDrop(path, name, err instanceof Error ? err.message : String(err));
|
|
1017
1065
|
continue;
|
|
1018
1066
|
}
|
|
1019
1067
|
unlinkSync(path);
|
|
@@ -1028,6 +1076,7 @@ function ingestDropFolder(host) {
|
|
|
1028
1076
|
log("·", "inbox-drop", `${name} could not be claimed or settled and stays in the folder: ${err instanceof Error ? err.message : String(err)}`);
|
|
1029
1077
|
}
|
|
1030
1078
|
}
|
|
1079
|
+
retryUnreadDrops(unread, host);
|
|
1031
1080
|
if (arrivals.length === 0)
|
|
1032
1081
|
return;
|
|
1033
1082
|
persistInboxQueue(arrivals);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-notify-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.337",
|
|
4
4
|
"description": "Reach your AI agents from anywhere — and let them reach you. One stdio process 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/index.js",
|
|
6
6
|
"type": "module",
|