omni-notify-mcp 1.3.497 → 1.3.499

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.
@@ -16,7 +16,7 @@ const SETUP_PATH = "/passkey/setup";
16
16
  const ADMIN_DOOR_PATH = "/passkey/admin/door";
17
17
  // GATE: a session is named on the admin page by this many leading characters of its stored hash; a revoke must name all of them.
18
18
  const SESSION_REF_LENGTH = 16;
19
- // GATE: a sign-in session (passkey, authenticator or texted code) older than this answers 401 and the page asks Meni to sign in again.
19
+ // GATE: a sign-in session (passkey, authenticator or texted code) older than this answers 401 and the page asks Meni to sign in again; 8 hours is his ruling (2026-11-17, "8 hours (Recommended)"), kept unchanged by #4962.
20
20
  export const SESSION_LIFETIME_MS = 8 * 3600_000;
21
21
  // GATE: an enrolment link minted on this machine, or an authenticator setup whose QR was shown, not finished within this is refused.
22
22
  const TICKET_LIFETIME_MS = 10 * 60_000;
@@ -350,22 +350,21 @@ export function localOnly(req) {
350
350
  }
351
351
  /** A session records the credential it was signed in with: a passkey's id, `authenticator:<id>`, or `sms`. */
352
352
  const approvalOfCredential = (credentialId) => (credentialId.startsWith(AUTHENTICATOR) || credentialId === SMS ? credentialId : `passkey:${credentialId}`);
353
- /** One service's sign-in: its passkeys, authenticator app, sessions and code strikes, kept apart from every other door's. */
354
- export function createSignInDoor({ storeFile, product, short, home, host: doorHost, ownerFile, ownsStore }) {
353
+ /** One service's sign-in: its passkeys, authenticator app and code strikes kept apart from every other door's, over the ONE session store every door on this machine shares (#4962). */
354
+ export function createSignInDoor({ storeFile, product, short, home, host: doorHost, ownerFile, sessionsFile, ownsStore }) {
355
355
  const challenges = new Map();
356
356
  const tickets = new Map();
357
357
  const pendingAuthenticators = new Map();
358
358
  const strikes = new Map();
359
359
  let textedCode;
360
- const readStoreAt = (file) => readJsonFile(file, () => ({ userId: randomBytes(16).toString("base64url"), passkeys: [], sessions: {} }));
360
+ const readStoreAt = (file) => readJsonFile(file, () => ({ userId: randomBytes(16).toString("base64url"), passkeys: [] }));
361
361
  const readStore = () => readStoreAt(storeFile);
362
- /** Changes the store as one step no other process can interleave with, writing it without its expired sessions; a session ends only by expiry, revoke or logout. */
363
- function changeStore(change) {
364
- return changeLocked(storeFile, readStoreAt, (store) => {
362
+ const readSessionsAt = (file) => readJsonFile(file, () => ({ sessions: {} }));
363
+ const readSessions = () => readSessionsAt(sessionsFile());
364
+ /** Changes this machine's one session store as a step no other process can interleave with, writing it without its expired sessions; a session ends only by expiry, revoke or logout. */
365
+ function changeSessions(change) {
366
+ return changeLocked(sessionsFile(), readSessionsAt, (store) => {
365
367
  const result = change(store);
366
- // NULL-OK: field ownerModel is OPTIONAL and therefore it is ok to check for NULL
367
- if (store.ownerModel !== true && readOwners().legacyRetired)
368
- store.ownerModel = true;
369
368
  const now = Date.now();
370
369
  const gone = Object.keys(store.sessions).filter((key) => store.sessions[key].exp <= now);
371
370
  for (const key of gone)
@@ -376,12 +375,22 @@ export function createSignInDoor({ storeFile, product, short, home, host: doorHo
376
375
  return result;
377
376
  });
378
377
  }
378
+ /** Changes this service's own store (its passkeys, authenticator app and code strikes) as one step no other process can interleave with; sessions live in the machine's shared session store instead. */
379
+ function changeStore(change) {
380
+ return changeLocked(storeFile, readStoreAt, (store) => {
381
+ const result = change(store);
382
+ // NULL-OK: field ownerModel is OPTIONAL and therefore it is ok to check for NULL
383
+ if (store.ownerModel !== true && readOwners().legacyRetired)
384
+ store.ownerModel = true;
385
+ return result;
386
+ });
387
+ }
379
388
  /** Why a bearer is not a live session, in words; nothing when it is one. */
380
389
  function refusalOf(secret) {
381
390
  if (secret === null || secret === "")
382
391
  return "no session was presented";
383
392
  const store = readStore();
384
- const session = store.sessions[digest(secret)];
393
+ const session = readSessions().sessions[digest(secret)];
385
394
  if (session === undefined)
386
395
  return "no such session (signed out, revoked or never issued)";
387
396
  if (session.exp <= Date.now())
@@ -445,7 +454,7 @@ export function createSignInDoor({ storeFile, product, short, home, host: doorHo
445
454
  function activeSession(secret) {
446
455
  if (secret === null)
447
456
  return undefined;
448
- return refusalOf(secret) === undefined ? readStore().sessions[digest(secret)] : undefined;
457
+ return refusalOf(secret) === undefined ? readSessions().sessions[digest(secret)] : undefined;
449
458
  }
450
459
  const sessionSignIn = (secret) => activeSession(secret)?.credentialId;
451
460
  /** When a live session ends, in epoch milliseconds; otherwise nothing. */
@@ -664,10 +673,9 @@ ${locked(store) ? "" : `<p class="mut">Until an owner passkey is registered, not
664
673
  const session = mint();
665
674
  const key = digest(session);
666
675
  const exp = Date.now() + SESSION_LIFETIME_MS;
667
- changeStore((store) => {
668
- touch(store);
669
- store.sessions[key] = { credentialId, exp };
670
- });
676
+ // The credential's own bookkeeping (a spent counter, a used code step) lands in this service's store first, so a touch that refuses (a replayed code, a removed passkey) records no session.
677
+ changeStore((store) => { touch(store); });
678
+ changeSessions((store) => { store.sessions[key] = { credentialId, exp, host: doorHost }; });
671
679
  process.stderr.write(`[agent-gateway] ${short} session ${key.slice(0, SESSION_REF_LENGTH)} issued for ${how}, valid until ${new Date(exp).toISOString()}\n`);
672
680
  return { session, expiresIn: SESSION_LIFETIME_MS / 1000 };
673
681
  }
@@ -822,17 +830,17 @@ ${locked(store) ? "" : `<p class="mut">Until an owner passkey is registered, not
822
830
  const now = Date.now();
823
831
  // NULL-OK: field authenticator is OPTIONAL and therefore it is ok to check for NULL
824
832
  const authenticator = store.authenticator === undefined ? null : { createdAt: store.authenticator.createdAt };
825
- const sessions = Object.entries(store.sessions).filter(([, s]) => s.exp > now && standing(approvalOfCredential(s.credentialId), store))
833
+ const sessions = Object.entries(readSessions().sessions).filter(([, s]) => s.exp > now && s.host === doorHost && standing(approvalOfCredential(s.credentialId), store))
826
834
  .map(([key, s]) => ({ ref: key.slice(0, SESSION_REF_LENGTH), signedInWith: approvalOfCredential(s.credentialId).slice(0, 24), exp: s.exp }));
827
835
  const enrollments = [...tickets.entries()].filter(([, ticket]) => ticket.exp > now).map(([key, ticket]) => ({ ref: key.slice(0, SESSION_REF_LENGTH), host: ticket.host, exp: ticket.exp }));
828
836
  const registry = ownerRegistry();
829
837
  const owner = { rpID: registry.rpID, origins: registry.origins, outside: registry.outside, legacyRetired: legacyRetired(store), credentials: readOwners().credentials.map(({ id, device, createdAt }) => ({ id, device, createdAt })) };
830
838
  return { locked: locked(store), sms: ownerTexter.reaches(), passkeys: store.passkeys.map(({ id, rpID, device, createdAt }) => ({ id, rpID, device, createdAt })), owner, authenticator, sessions, enrollments };
831
839
  }
832
- /** Revokes one session by its reference, or every session when none is given; the next request carrying it is refused. Returns how many went. */
840
+ /** Revokes one session by its reference, or every session this service minted when none is given; the next request carrying it is refused. Returns how many went. */
833
841
  function revokeSessions(ref) {
834
- const removed = changeStore((store) => {
835
- const keys = Object.keys(store.sessions).filter((key) => ref === undefined || key.startsWith(ref));
842
+ const removed = changeSessions((store) => {
843
+ const keys = Object.keys(store.sessions).filter((key) => (ref === undefined ? store.sessions[key].host === doorHost : key.startsWith(ref)));
836
844
  if (ref !== undefined && (ref.length < SESSION_REF_LENGTH || keys.length !== 1))
837
845
  throw new GatewayError(404, "no single session has that reference");
838
846
  for (const key of keys)
@@ -950,7 +958,7 @@ ${locked(store) ? "" : `<p class="mut">Until an owner passkey is registered, not
950
958
  send(res, 200, await loginVerify(body));
951
959
  else if (path === `${PASSKEY_PREFIX}logout`) {
952
960
  const key = digest(bearer(req));
953
- const signedOut = changeStore((store) => key in store.sessions && delete store.sessions[key]);
961
+ const signedOut = changeSessions((store) => key in store.sessions && delete store.sessions[key]);
954
962
  if (signedOut)
955
963
  process.stderr.write(`[agent-gateway] ${short} session ${key.slice(0, SESSION_REF_LENGTH)} removed: signed out\n`);
956
964
  send(res, 200, { ok: true });
@@ -983,6 +991,6 @@ ${locked(store) ? "" : `<p class="mut">Until an owner passkey is registered, not
983
991
  const refusalOfRequest = (req) => (bearer(req) === "" ? undefined : refusalOf(bearer(req)));
984
992
  return { handlePasskey, admin, refusalOfRequest, bearerAdmitted, sessionSignIn, sessionExpiresAt, personId, sessionApproval, approvalStands, signInEnrolled, tokenStands, doorState };
985
993
  }
986
- /** BN's own door: its store is `agent-passkeys.json` beside BN's config. */
987
- const bn = createSignInDoor({ storeFile: join(CONFIG_DIR, "agent-passkeys.json"), product: "BullseyeNotify", short: "BN", home: "Open BN chat", host: readGatewaySettings()?.host ?? "bn.bullseyecalc.com", ownerFile: () => join(CONFIG_DIR, "owner-passkeys.json"), ownsStore: process.env.NOTIFY_MCP_DOOR_READONLY !== "1" });
994
+ /** BN's own door: its passkey store is `agent-passkeys.json` beside BN's config, its sessions the machine's one `owner-sessions.json` every door shares. */
995
+ const bn = createSignInDoor({ storeFile: join(CONFIG_DIR, "agent-passkeys.json"), product: "BullseyeNotify", short: "BN", home: "Open BN chat", host: readGatewaySettings()?.host ?? "bn.bullseyecalc.com", ownerFile: () => join(CONFIG_DIR, "owner-passkeys.json"), sessionsFile: () => join(CONFIG_DIR, "owner-sessions.json"), ownsStore: process.env.NOTIFY_MCP_DOOR_READONLY !== "1" });
988
996
  export const { handlePasskey, admin, refusalOfRequest, bearerAdmitted, sessionSignIn, sessionExpiresAt, personId, sessionApproval, approvalStands, signInEnrolled, tokenStands, doorState } = bn;
@@ -39,6 +39,7 @@ export function listenForever(platform, sinks, intervalMs, running) {
39
39
  export async function pollForever(source, route, log, intervalMs, running) {
40
40
  let idleReason = "";
41
41
  let errors = 0;
42
+ let failure = "";
42
43
  while (running()) {
43
44
  try {
44
45
  const why = source.idleReason();
@@ -58,14 +59,19 @@ export async function pollForever(source, route, log, intervalMs, running) {
58
59
  if (errors > 0) {
59
60
  log("·", source.name, `recovered after ${errors} attempt(s)`);
60
61
  errors = 0;
62
+ failure = "";
61
63
  }
62
64
  await new Promise((r) => setTimeout(r, intervalMs));
63
65
  }
64
66
  catch (err) {
65
67
  errors++;
66
68
  const delay = Math.min(60_000, 2000 * Math.pow(2, Math.min(5, errors - 1)));
67
- // OWNER: the poll loop is the workflow's trigger root; a failed read is classified by its message, reported, and retried with backoff.
68
- log("·", `${source.name}:error`, `poll attempt ${errors} failed: ${err instanceof Error ? err.message : String(err)} — retrying in ${delay}ms`);
69
+ const why = err instanceof Error ? err.message : String(err);
70
+ // OWNER: the poll loop is the workflow's trigger root; a failed read is classified by its message, retried with backoff, and reported once per DISTINCT failure — a source that stays down on the same reason is one line, never one per attempt.
71
+ if (why !== failure) {
72
+ failure = why;
73
+ log("·", `${source.name}:error`, `poll failed: ${why} — retrying with backoff until it recovers`);
74
+ }
69
75
  await new Promise((r) => setTimeout(r, delay));
70
76
  }
71
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-notify-mcp",
3
- "version": "1.3.497",
3
+ "version": "1.3.499",
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",