omni-notify-mcp 1.3.432 → 1.3.433

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/mcpHosts.cjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const fs = require("fs");
4
4
  const path = require("path");
5
+ const { threadId } = require("worker_threads");
5
6
 
6
7
  class FileMoved extends Error {}
7
8
 
@@ -10,7 +11,7 @@ function contentOf(file) {
10
11
  }
11
12
 
12
13
  function atomicWrite(file, text, read) {
13
- const staged = `${file}.${process.pid}.tmp`;
14
+ const staged = `${file}.${process.pid}-${threadId}.tmp`;
14
15
  fs.writeFileSync(staged, text, "utf8");
15
16
  if (contentOf(file) !== read) {
16
17
  fs.rmSync(staged, { force: true });
@@ -247,6 +248,7 @@ function createHostWriters(env) {
247
248
  }
248
249
  if (!root.projects || typeof root.projects !== "object" || Array.isArray(root.projects)) root.projects = {};
249
250
  const sameKey = (x, y) => shapeOf(x) === shapeOf(y);
251
+ const asCompared = (entry) => entry && JSON.stringify({ ...entry, headers: { ...entry.headers, "x-bullseye-project": shapeOf(String((entry.headers || {})["x-bullseye-project"] || "")) } });
250
252
  let changed = false;
251
253
  for (const folder of folders) {
252
254
  // Claude Code keeps a folder under each spelling of its drive letter as separate projects, so every spelling that exists carries the entry.
@@ -255,7 +257,7 @@ function createHostWriters(env) {
255
257
  const project = root.projects[key] || (root.projects[key] = {});
256
258
  if (!project.mcpServers || typeof project.mcpServers !== "object" || Array.isArray(project.mcpServers)) project.mcpServers = {};
257
259
  const wanted = { type: "http", url, headers: { Authorization: `Bearer ${gateway.token}`, "x-bullseye-project": folder } };
258
- if (JSON.stringify(project.mcpServers.bn) === JSON.stringify(wanted)) continue;
260
+ if (asCompared(project.mcpServers.bn) === asCompared(wanted)) continue;
259
261
  project.mcpServers.bn = wanted;
260
262
  changed = true;
261
263
  }
@@ -2784,10 +2784,11 @@ export function newerVersion(a, b) {
2784
2784
  }
2785
2785
  return false;
2786
2786
  }
2787
- /** 🔴 #4156 — a move named an entry that is no longer in line on the board: withdrawn, finished or failed out between the press and the queue's lock. */
2787
+ /** 🔴 #4156 — a press named a story the line does not hold: one that left it (withdrawn or finished) says so with what it reads, and 🔴 #4522 one the queue never took in says that instead. */
2788
2788
  export class NotInQueue extends Error {
2789
- constructor(board, storyId) {
2790
- super(`#${storyId} is no longer in FleetView's queue on ${board}`);
2789
+ constructor(board, storyId, left) {
2790
+ // NULL-OK: field left is OPTIONAL and therefore it is ok to check for NULL
2791
+ super(left === undefined ? (readableRequestView(board, storyId) === undefined ? `#${storyId} has never been in FleetView's queue on ${board} — BullseyeBacklog has not handed it over` : `#${storyId} is not in FleetView's queue on ${board} yet — BullseyeBacklog's request is in, and the queue takes it in on its next pass`) : `#${storyId} is not waiting in FleetView's queue on ${board} — it is ${left.state}: ${left.why}`);
2791
2792
  this.name = "NotInQueue";
2792
2793
  }
2793
2794
  }
@@ -2982,7 +2983,9 @@ export async function clearStoryQueue(board, since) {
2982
2983
  removed += 1;
2983
2984
  }
2984
2985
  }
2985
- writeStore(board, { ...store, entries: kept });
2986
+ // NULL-OK: field forcesAhead is OPTIONAL and therefore it is ok to check for NULL
2987
+ const ahead = store.forcesAhead === undefined ? {} : { forcesAhead: Object.fromEntries(Object.entries(store.forcesAhead).filter(([, f]) => f.at >= since)) };
2988
+ writeStore(board, { ...store, entries: kept, ...ahead });
2986
2989
  return removed;
2987
2990
  });
2988
2991
  }
@@ -3123,6 +3126,10 @@ function refusalOf(r) {
3123
3126
  const priorAuthorityOf = (e) => Math.max(e?.startPressedAt ?? 0, e?.handStop?.at ?? 0, e?.worker?.startedAt ?? 0, e?.forceStartedAt ?? 0, e?.forceEventAt ?? 0);
3124
3127
  /** One request applied to the store: an entry made, updated, withdrawn or put back in line; answers the refusal when it cannot be queued. */
3125
3128
  function applyRequest(store, r, now) {
3129
+ const ahead = store.forcesAhead?.[String(r.storyId)];
3130
+ // NULL-OK: field ahead is OPTIONAL and therefore it is ok to check for NULL
3131
+ if (ahead !== undefined)
3132
+ delete store.forcesAhead[String(r.storyId)];
3126
3133
  const refused = refusalOf(r);
3127
3134
  if (refused !== undefined)
3128
3135
  return refused;
@@ -3220,6 +3227,13 @@ function applyRequest(store, r, now) {
3220
3227
  else
3221
3228
  forceEntry(e, now, HIS_PRESS, r.forced);
3222
3229
  }
3230
+ // NULL-OK: field ahead is OPTIONAL and therefore it is ok to check for NULL
3231
+ if (ahead !== undefined && r.eligible && IN_LINE.has(e.state)) {
3232
+ if (ahead.at <= priorAuthority || e.state === "starting" || e.state === "running" || e.handStop !== undefined)
3233
+ step(e, now, "updated", `${ahead.by} ⚡ Force start, pressed before the board handed it over, had nothing to start — ${e.handStop === undefined ? "a worker took it up since" : `${e.handStop.by} 🛑 Stop holds it until his Start`}`);
3234
+ else
3235
+ forceEntry(e, now, ahead.by, ahead.at);
3236
+ }
3223
3237
  return undefined;
3224
3238
  }
3225
3239
  /** 🔴 #4156 — his ⚡ Force start on an entry in line: it starts on the next pass past a ⏸ Stop; the request that carries it (#4177) and the queue's own ⚡ press both force it here. */
@@ -4609,19 +4623,49 @@ export class StoryPressRefused extends Error {
4609
4623
  this.name = "StoryPressRefused";
4610
4624
  }
4611
4625
  }
4626
+ /** 🔴 #4522 — BullseyeBacklog's standing request for a story the line does not hold, taken in now as the next pass would; a request the queue refuses, or one the board says is not to be started, refuses the press with why. */
4627
+ function takeStandingRequest(board, store, storyId, now) {
4628
+ const r = readableRequest(board, storyId);
4629
+ // NULL-OK: field r is OPTIONAL and therefore it is ok to check for NULL
4630
+ if (r === undefined)
4631
+ return undefined;
4632
+ const refused = applyRequest(store, r, now);
4633
+ // NULL-OK: field refused is OPTIONAL and therefore it is ok to check for NULL
4634
+ if (refused !== undefined)
4635
+ throw new StoryPressRefused(`#${storyId}: FleetView refuses BullseyeBacklog's request for it — ${refused}`);
4636
+ if (!r.eligible)
4637
+ throw new StoryPressRefused(`#${storyId}: BullseyeBacklog's request says it is not to be started — ${r.why}`);
4638
+ return r;
4639
+ }
4640
+ /** 🔴 #4522 — his ⚡ Force start on a story BullseyeBacklog has not handed over yet: kept on the store, so the request that brings it into line takes it in forced. */
4641
+ function forceAhead(board, store, storyId, now, by) {
4642
+ const held = autoStartHeld(board);
4643
+ store.forcesAhead = { ...store.forcesAhead, [String(storyId)]: { at: now, by } };
4644
+ writeStore(board, store);
4645
+ // NULL-OK: field held is OPTIONAL and therefore it is ok to check for NULL
4646
+ return `#${storyId} is not in FleetView's queue yet — BullseyeBacklog has not handed it over; the ⚡ Force start is kept, and the pass that takes the board's request in starts it, past a ⏸ Stop and this workspace's lane limit${held === undefined ? "" : ` (AUTO START is off on this board, so the board hands it over on his ▶️ Start)`}`;
4647
+ }
4612
4648
  /**
4613
4649
  * 🔴 #4156 — HIS PRESS ON ONE STORY OF FLEETVIEW'S QUEUE, under the queue's lock: ✕ Remove takes it out of the line (BullseyeBacklog's
4614
4650
  * next new request puts it back), ↻ Retry puts a failed or retrying story back in line with its attempts reset, ⚡ Force start starts
4615
4651
  * it on the next pass past a ⏸ Stop, and 🔔 Nudge ends the wait it stands on (a retry's backoff, a parked worker's wake delay). A press
4616
4652
  * that does not apply throws
4617
- * {@link StoryPressRefused}; one on a story no longer in line throws {@link NotInQueue}. Answers what it did, in words.
4653
+ * {@link StoryPressRefused}; one on a story not in line throws {@link NotInQueue}, except 🔴 #4522 a ⚡ Force start, which takes in the board's standing request or keeps the force for the request to come. Answers what it did, in words.
4618
4654
  */
4619
4655
  export async function pressStory(board, storyId, press, now, by, requestHandledByOwner = false, ownerAction) {
4620
4656
  return withQueueLock(board, now, async () => {
4621
4657
  const store = readQueueStore(board);
4622
- const e = store.entries.find((x) => x.storyId === storyId && IN_LINE.has(x.state));
4623
- if (e === undefined)
4624
- throw new NotInQueue(board, storyId);
4658
+ const inLine = () => store.entries.find((x) => x.storyId === storyId && IN_LINE.has(x.state));
4659
+ const taken = press === "force" && inLine() === undefined ? takeStandingRequest(board, store, storyId, now) : undefined;
4660
+ const e = inLine();
4661
+ // NULL-OK: field e is OPTIONAL and therefore it is ok to check for NULL
4662
+ if (e === undefined) {
4663
+ const left = store.entries.find((x) => x.storyId === storyId);
4664
+ // NULL-OK: field left is OPTIONAL and therefore it is ok to check for NULL
4665
+ if (press === "force" && left === undefined)
4666
+ return forceAhead(board, store, storyId, now, by);
4667
+ throw new NotInQueue(board, storyId, left);
4668
+ }
4625
4669
  const working = e.state === "starting" || e.state === "running";
4626
4670
  // NULL-OK: field stopped is OPTIONAL and therefore it is ok to check for NULL
4627
4671
  const afterStop = store.stopped === undefined ? "" : " after ▶ Run lifts the queue's ⏸ Stop";
@@ -4659,7 +4703,7 @@ export async function pressStory(board, storyId, press, now, by, requestHandledB
4659
4703
  if (working)
4660
4704
  throw new StoryPressRefused(`#${storyId} already has a worker at work, so there is nothing to force`);
4661
4705
  forceEntry(e, now, by);
4662
- did = `#${storyId} starts on the next pass, past a ⏸ Stop and this workspace's lane limit`;
4706
+ did = `#${storyId} ${taken === undefined ? "" : "was taken into the queue from BullseyeBacklog's request and "}starts on the next pass, past a ⏸ Stop and this workspace's lane limit`;
4663
4707
  }
4664
4708
  else if (press === "stop" || press === "kill") {
4665
4709
  if (e.worker === undefined || !(working || parkedInLine(e) || e.worker.carried !== undefined || ownerAction !== undefined))
@@ -4761,7 +4805,7 @@ export async function placeStory(board, storyId, place, now, by) {
4761
4805
  const store = readQueueStore(board);
4762
4806
  const e = store.entries.find((x) => x.storyId === storyId && IN_LINE.has(x.state));
4763
4807
  if (e === undefined)
4764
- throw new NotInQueue(board, storyId);
4808
+ throw new NotInQueue(board, storyId, store.entries.find((x) => x.storyId === storyId));
4765
4809
  if (place === "auto") {
4766
4810
  delete e.manual;
4767
4811
  delete e.ordered;
@@ -4790,7 +4834,7 @@ export async function placeWaiting(board, now, by, decide, visible) {
4790
4834
  const { next, moved } = decide(waiting);
4791
4835
  for (const id of moved)
4792
4836
  if (!waiting.includes(id))
4793
- throw new NotInQueue(board, id);
4837
+ throw new NotInQueue(board, id, store.entries.find((x) => x.storyId === id));
4794
4838
  if (next.join() === waiting.join())
4795
4839
  return waiting;
4796
4840
  const refill = next.slice();
@@ -13,6 +13,28 @@ const path = require("path");
13
13
  const { spawn, spawnSync } = require("child_process");
14
14
  // GATE: the room, in percent, at or under which the live account's own figure is shown as running low — the same band the room column already paints CRITICAL/LOW; DeepAgent's tick moves nothing at this boundary, the pad's Claude tick moves the live work off it only to a subscription above it, and no move onto or off a key answers to it
15
15
  const WARN_BAND_ROOM_PCT = 25;
16
+ // GATE: the US dollars LEFT on a key under which it reads `low` (little left) and `critical` (nearly gone) — warnings only, nothing moves at either; a dashboard spending limit is invisible to this figure, so the key's own 402 refusal is watched beside it
17
+ const KEY_FUNDS_LOW_USD = 50;
18
+ const KEY_FUNDS_CRITICAL_USD = 10;
19
+ /**
20
+ * The band a key's spendable dollars fall in, on what is LEFT. `go` and `dead` are the two states every caller already
21
+ * reads; `low` and `critical` are the two between them, so a key that has not yet refused anything is warned about
22
+ * before it dies rather than reported dead after the fact.
23
+ * @param {number} dollars @returns {"go" | "low" | "critical" | "dead"}
24
+ */
25
+ function keyFundsBand(dollars) {
26
+ if (!(dollars > 0))
27
+ return "dead";
28
+ if (dollars < KEY_FUNDS_CRITICAL_USD)
29
+ return "critical";
30
+ if (dollars < KEY_FUNDS_LOW_USD)
31
+ return "low";
32
+ return "go";
33
+ }
34
+ /** The two warning bands said in words, as the surface that warns shouts them. @param {"low" | "critical"} band */
35
+ function keyFundsWords(band) {
36
+ return band === "low" ? "little left" : "nearly gone";
37
+ }
16
38
  /**
17
39
  * @typedef {object} AccountState
18
40
  * @property {string} identityId
@@ -773,13 +795,14 @@ function recordRoom(home, providerId, room) {
773
795
  writeAtomically(roomPath(home, providerId), JSON.stringify(room));
774
796
  }
775
797
  /**
776
- * Whether the key carrying the live work has funds, as the room record states it: the balance reading's status word
777
- * (`go` funded, `dead` unfunded) as a boolean, and no field at all when the work is on a subscription or the balance could not be read.
798
+ * Whether the key carrying the live work has funds, as the room record states it: the balance reading's status word as
799
+ * a boolean — every band but `dead` is funded, `low` and `critical` included — and no field at all when the work is on
800
+ * a subscription or the balance could not be read.
778
801
  * @param {string} fundsStatus
779
802
  * @returns {{ liveKeyFunded?: boolean }}
780
803
  */
781
804
  function keyFundsRecord(fundsStatus) {
782
- if (fundsStatus === "go")
805
+ if (fundsStatus === "go" || fundsStatus === "low" || fundsStatus === "critical")
783
806
  return { liveKeyFunded: true };
784
807
  if (fundsStatus === "dead")
785
808
  return { liveKeyFunded: false };
@@ -2104,6 +2127,8 @@ module.exports = {
2104
2127
  OPENCODE_RULES,
2105
2128
  OPENCODE_KEY_REFUSAL_WORDS,
2106
2129
  keyFundsRecord,
2130
+ keyFundsBand,
2131
+ keyFundsWords,
2107
2132
  failbackDue,
2108
2133
  appliedHookWired,
2109
2134
  expectApplied,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-notify-mcp",
3
- "version": "1.3.432",
3
+ "version": "1.3.433",
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",