omni-notify-mcp 1.3.342 → 1.3.343

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.
@@ -1,5 +1,5 @@
1
1
  import { homedir } from "node:os";
2
- import autoSwitch from "../shared/autoSwitch.cjs";
2
+ import autoSwitch from "../shared/webhost/autoSwitch.cjs";
3
3
  import { OpenCodeTurn } from "../shared/agentSession.js";
4
4
  import { agentEnv } from "./provider.js";
5
5
  const ROUTE_REFUSALS = new Set(["OPENCODE_NO_KEY", "KEYPLAN_UNREADABLE", "REFUSAL_UNREADABLE"]);
package/dist/notify.js CHANGED
@@ -738,11 +738,17 @@ function persistInboxQueue(arrivals = []) {
738
738
  absorbQueued(merged, entry, [...(inboxDeliveredTo.get(entryKey(entry)) ?? [])]);
739
739
  for (const entry of arrivals)
740
740
  absorbQueued(merged, entry, []);
741
+ for (const [key, entry] of merged)
742
+ absorbQueued(merged, entry, [...(inboxDeliveredTo.get(key) ?? [])]);
741
743
  const name = `${OWN_QUEUE_PREFIX}${Date.now()}${String(queueWrites++).padStart(4, "0")}.json`;
742
744
  writeFileSync(join(CONFIG_DIR, `${name}.tmp`), JSON.stringify([...merged.values()]));
743
745
  renameSync(join(CONFIG_DIR, `${name}.tmp`), join(CONFIG_DIR, name));
744
746
  for (const old of earlier)
745
747
  rmSync(join(CONFIG_DIR, old), { force: true });
748
+ const queued = new Set(inboxQueue.map(entryKey));
749
+ for (const key of [...inboxDeliveredTo.keys()])
750
+ if (!queued.has(key))
751
+ inboxDeliveredTo.delete(key);
746
752
  // a file nobody wrote for the entry lifetime holds only entries already past it (an entry is never newer than its file's last write); a staging file a dead process left is the same
747
753
  const staged = existsSync(CONFIG_DIR) ? readdirSync(CONFIG_DIR).filter((f) => STAGED_QUEUE_FILE.test(f)) : [];
748
754
  for (const other of [...queueFileNames().filter((f) => !f.startsWith(OWN_QUEUE_PREFIX)), ...staged]) {
@@ -751,17 +757,17 @@ function persistInboxQueue(arrivals = []) {
751
757
  rmSync(join(CONFIG_DIR, other), { force: true });
752
758
  }
753
759
  }
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.
760
+ // Entries in the shared queue this process does not hold yet, restored with the marks the file carries.
756
761
  function takeSharedEntries(saved) {
757
762
  const mine = [];
758
763
  for (const { deliveredTo, ...entry } of saved) {
759
- if (deliveredTo.includes(deliveredKey(SELF_TAG)) || alreadyDelivered(entry, SELF_TAG))
764
+ const key = entryKey(entry);
765
+ if (inboxQueue.some((queued) => entryKey(queued) === key))
760
766
  continue;
761
- // The daemon is the machine's queue: it holds every chat's undelivered entry in memory, tagged ones
762
- // included, because the HTTP chats it serves are the only readers of a tagged entry and each drains its own by
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.
767
+ if (entry.tag && (deliveredTo.includes(deliveredKey(entry.tag)) || alreadyDelivered(entry, entry.tag)))
768
+ continue;
769
+ for (const mark of deliveredTo)
770
+ markDelivered(entry, mark === "*" ? undefined : mark);
765
771
  mine.push(entry);
766
772
  }
767
773
  if (mine.length === 0)
@@ -769,8 +775,13 @@ function takeSharedEntries(saved) {
769
775
  for (const entry of mine) {
770
776
  // Only the entry addressed to this host is recorded as taken by it; a tagged entry another chat owns stays
771
777
  // unmarked here and is marked when that chat drains it.
778
+ const takenBefore = alreadyDelivered(entry, SELF_TAG);
772
779
  if (matchesSession(entry, SELF_TAG))
773
780
  markDelivered(entry, SELF_TAG);
781
+ if (takenBefore) {
782
+ inboxQueue.push(entry);
783
+ continue;
784
+ }
774
785
  if (entry.origin === "telegram")
775
786
  noteTelegramInbound(entry.messageId, entry.chatId, Date.parse(entry.ts));
776
787
  handOver(entry);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-notify-mcp",
3
- "version": "1.3.342",
3
+ "version": "1.3.343",
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",