omni-notify-mcp 1.3.463 → 1.3.465

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.
@@ -203,11 +203,11 @@ function control(row) {
203
203
  }
204
204
  return wrap;
205
205
  }
206
- var busy = {};
206
+ var busy = {}, failed = {};
207
207
  function factRows(table, label, items) { items.forEach(function (x, i) { var tr = el("tr"); tr.append(el("td", "name", i === 0 ? label : ""), el("td", "", x)); table.append(tr); }); }
208
208
  function setupRow(g) {
209
209
  var row = el("tr"), cell = el("td"), button = el("button", "", "🔁 Reinstall"), working = el("span", "hint", ""), facts = el("table"), last = g.setup && g.setup.last;
210
- button.title = "Makes what is installed match what is set above, and shows both";
210
+ button.setAttribute("aria-label", "Reinstall " + g.title + ": make what is installed match what is set above");
211
211
  facts.setAttribute("aria-label", g.title + " setup");
212
212
  factRows(facts, "Intent", g.setup ? g.setup.intent : []);
213
213
  factRows(facts, "Installed", last ? (last.installed.length ? last.installed : ["nothing yet"]) : ["not checked yet"]);
@@ -220,13 +220,14 @@ function setupRow(g) {
220
220
  busy[g.messenger] = true; button.disabled = true; working.textContent = "⏳ Working";
221
221
  try {
222
222
  var r = await call("POST", "/v1/messenger-setup", { messenger: g.messenger });
223
- button.title = r.gaps.length ? r.gaps.join("\n") : "Everything this messenger needs is in place";
223
+ failed[g.messenger] = "";
224
224
  say(r.gaps.length ? "error" : "good", r.gaps.length ? "⚠️ " + g.messenger.toUpperCase() + " " + r.gaps.length + " MISSING" : "✅ " + g.messenger.toUpperCase() + " INSTALLED");
225
- } catch (e) { button.title = plainWhy(e); say("error", "❌ " + g.messenger.toUpperCase() + " FAILED"); }
226
- busy[g.messenger] = false;
225
+ } catch (e) { failed[g.messenger] = "❌ Reinstall failed — " + plainWhy(e); say("error", "❌ " + g.messenger.toUpperCase() + " FAILED"); }
226
+ busy[g.messenger] = false; reason.textContent = failed[g.messenger]; button.disabled = false; working.textContent = "";
227
227
  await load();
228
228
  };
229
- cell.colSpan = 2; cell.append(button, working, facts); row.append(cell); return row;
229
+ var reason = el("div", "hint", failed[g.messenger] || "");
230
+ cell.colSpan = 2; cell.append(button, working, reason, facts); row.append(cell); return row;
230
231
  }
231
232
  function shownOf(s) { return JSON.stringify([s.state, s.conversation, s.groups, s.configPath]); }
232
233
  function draw(s) {
package/dist/notify.js CHANGED
@@ -1704,7 +1704,7 @@ const TELEGRAM_POLL_FRESH_MS = 45_000;
1704
1704
  /** Why his replies and taps are not being read now, or nothing while the poller reads Telegram. */
1705
1705
  function telegramInboundGap() {
1706
1706
  if (pollersNotRunning !== "")
1707
- return pollersNotRunning;
1707
+ return lastOtherBn !== "" ? `${pollersNotRunning}; the BN on ${lastOtherBn} holds the gateway and reads his replies, which this process cannot see` : pollersNotRunning;
1708
1708
  if (Date.now() - tgPolledAt < TELEGRAM_POLL_FRESH_MS)
1709
1709
  return undefined;
1710
1710
  const state = tgStoppedWhy !== "" ? `the poller STOPPED: ${tgStoppedWhy}` : tgLastErrorMsg !== null ? `the poller is backing off: ${tgLastErrorMsg}` : "the poller is not reading";
@@ -1712,9 +1712,6 @@ function telegramInboundGap() {
1712
1712
  }
1713
1713
  /** Telegram carries only both ways: its outbound reading (a send, an ask or a getMe probe) AND its poller reading his replies; a dead poller is a channel that cannot carry, whatever the token answers. */
1714
1714
  function telegramCarriage(outbound) {
1715
- // NULL-OK: field outbound is OPTIONAL and therefore it is ok to check for NULL
1716
- if (door === undefined && lastOtherBn !== "")
1717
- return outbound === undefined ? undefined : { ...outbound, detail: `${outbound.detail}; his replies are read by the BN on ${lastOtherBn}, which this process does not poll` };
1718
1715
  const heard = tgLastUpdateAt === 0 ? "nothing of his has arrived in this process" : `his last message or tap arrived ${ageLabel(tgLastUpdateAt)} ago`;
1719
1716
  const gap = telegramInboundGap();
1720
1717
  // NULL-OK: field gap is OPTIONAL and therefore it is ok to check for NULL
@@ -5545,87 +5545,167 @@ export async function pressStory(board, storyId, press, now, by, requestHandledB
5545
5545
  return await withQueueLock(board, now, () => pressHeld(board, storyId, press, now, by, requestHandledByOwner, ownerAction));
5546
5546
  }
5547
5547
  catch (err) {
5548
- if (!(err instanceof QueueBusy) || press !== "force")
5548
+ // a Codex native stop acts on its turn only once the stop is WRITTEN on the entry, so a recorded one is refused as busy, never answered as done
5549
+ if (!(err instanceof QueueBusy) || requestHandledByOwner || ownerAction !== undefined)
5549
5550
  throw err;
5550
- // OWNER: ITER/LOOP — 🔴 #4529 another driver holds the queue's lock for its pass: his ⚡ Force start is recorded beside the queue, and the pass that holds the lock takes it in before it lets go (or the next pass does) — never refused.
5551
- writeWhole(board, pressFile(board, storyId), { press, at: now, by });
5552
- try {
5553
- // the holder may have let go meanwhile: one look, never a second wait in line behind it
5554
- const answered = await withQueueLock(board, now, () => takePendingPresses(board, now), true);
5555
- const mine = answered.get(storyId);
5556
- // the caller's own press, pressed here, answers as a direct press does: a refusal is thrown, never returned as words of success
5557
- if (mine instanceof Error)
5558
- throw mine;
5559
- // NULL-OK: field mine is OPTIONAL and therefore it is ok to check for NULL
5560
- if (mine !== undefined)
5561
- return mine;
5562
- }
5563
- catch (again) {
5564
- if (!(again instanceof QueueBusy))
5565
- throw again;
5551
+ // OWNER: ITER/LOOP — 🔴 #4529/#4592 another driver holds the queue's lock for its pass: his press is recorded beside the queue, and the pass that holds the lock takes it in before it lets go (or the next pass does) — never refused.
5552
+ const name = `${storyId}.${press}`;
5553
+ writeWhole(board, pressFile(board, name), { press, at: now, by });
5554
+ const said = press === "force"
5555
+ ? `#${storyId}'s ⚡ Force start is recorded — ${err.message}, and the queue's pass takes it in and starts it — the pass holding the queue now before it lets go, or the next one — past a ⏸ Stop and this workspace's lane limit`
5556
+ : `#${storyId}'s ${PRESS_LABEL[press]} is recorded — ${err.message}, and the queue's pass carries it out — the pass holding the queue now before it lets go, or the next one`;
5557
+ return handedToDriver(board, name, now, said);
5558
+ }
5559
+ }
5560
+ /** 🔴 #4592 — how a press reads in the words that tell him it was recorded for the driver. */
5561
+ const PRESS_LABEL = { remove: "✕ Remove", retry: "↻ Retry", force: "⚡ Force start", nudge: "🔔 Nudge", stop: "🛑 Stop worker", kill: "⛔ Kill" };
5562
+ /** 🔴 #4592 — the one look a recorded press takes at the lock before it answers: the holder may have let go meanwhile, so it is taken in at once and answered as a direct press answers; never a second wait in line behind it. */
5563
+ async function handedToDriver(board, name, now, said) {
5564
+ try {
5565
+ const answered = await withQueueLock(board, now, () => takePendingPresses(board, now), true);
5566
+ const mine = answered.get(name);
5567
+ // the caller's own press, pressed here, answers as a direct press does: a refusal is thrown, never returned as words of success
5568
+ if (mine instanceof Error)
5569
+ throw mine;
5570
+ // NULL-OK: field mine is OPTIONAL and therefore it is ok to check for NULL
5571
+ if (mine !== undefined)
5572
+ return mine;
5573
+ }
5574
+ catch (again) {
5575
+ if (!(again instanceof QueueBusy))
5576
+ throw again;
5577
+ }
5578
+ return said;
5579
+ }
5580
+ export function shiftedTogether(pending, moved, delta) {
5581
+ const out = pending.slice();
5582
+ const up = delta < 0;
5583
+ for (let step = 0; step < Math.abs(delta) && step < out.length; step++) {
5584
+ let changed = false;
5585
+ const walk = up ? out.map((_, i) => i) : out.map((_, i) => out.length - 1 - i);
5586
+ for (const i of walk) {
5587
+ const j = up ? i - 1 : i + 1;
5588
+ if (moved.has(out[i]) && j >= 0 && j < out.length && !moved.has(out[j])) {
5589
+ [out[i], out[j]] = [out[j], out[i]];
5590
+ changed = true;
5591
+ }
5566
5592
  }
5567
- return `#${storyId}'s ⚡ Force start is recorded — ${err.message}, and the queue's pass takes it in and starts it — the pass holding the queue now before it lets go, or the next one — past a ⏸ Stop and this workspace's lane limit`;
5593
+ if (!changed)
5594
+ break;
5595
+ }
5596
+ return out;
5597
+ }
5598
+ export function droppedBefore(pending, moved, anchor) {
5599
+ if (anchor !== undefined && (!pending.includes(anchor) || moved.has(anchor)))
5600
+ throw new StoryPressRefused(`${String(anchor)} is not a waiting row that stays where it is, so nothing was dropped before it`);
5601
+ const rest = pending.filter((id) => !moved.has(id));
5602
+ const at = anchor === undefined ? rest.length : rest.indexOf(anchor);
5603
+ return [...rest.slice(0, at), ...pending.filter((id) => moved.has(id)), ...rest.slice(at)];
5604
+ }
5605
+ /** The row a drop lands before, as a waiting row: a row that already started, drawn above the waiting ones, stands for the first waiting row drawn after it, so a drop at the very top of the strip puts the rows first in line. */
5606
+ function firstWaitingFrom(anchor, drawn, waiting, moved) {
5607
+ if (anchor === undefined || waiting.includes(anchor) || drawn === undefined || !drawn.includes(anchor))
5608
+ return anchor;
5609
+ return drawn.slice(drawn.indexOf(anchor)).find((id) => waiting.includes(id) && !moved.has(id));
5610
+ }
5611
+ /** 🔴 #4592 — what a move decides over the waiting stories: the new order and the stories he moved. */
5612
+ function movedLine(m) {
5613
+ const moved = new Set(m.ids);
5614
+ return (waiting) => ({ next: "delta" in m.how ? shiftedTogether(waiting, moved, m.how.delta) : droppedBefore(waiting, moved, firstWaitingFrom(m.how.before ?? undefined, m.visible, waiting, moved)), moved });
5615
+ }
5616
+ const movedLineWords = (ids, line) => ids.map((id) => `#${id} is now ${line.indexOf(id) + 1} of ${line.length} in FleetView's story queue`).join(" | ");
5617
+ /**
5618
+ * 🔴 #4592 — HIS MOVE OF WAITING STORIES, never refused because the queue is driven: made under the lock when it is free, and
5619
+ * otherwise recorded beside the queue for the pass that holds it to make before it lets go (or the next one).
5620
+ */
5621
+ export async function moveStories(board, ids, how, visible, by, now) {
5622
+ const move = { ids: [...ids], how, ...(visible === undefined ? {} : { visible: [...visible] }) };
5623
+ try {
5624
+ return movedLineWords(ids, await placeWaiting(board, now, by, movedLine(move), visible));
5625
+ }
5626
+ catch (err) {
5627
+ if (!(err instanceof QueueBusy))
5628
+ throw err;
5629
+ // OWNER: ITER/LOOP — another driver holds the queue's lock for its pass: his move is recorded beside the queue and the pass that holds the lock makes it before it lets go (or the next pass does) — never refused.
5630
+ const name = `move-${now}-${Math.random().toString(36).slice(2, 8)}`;
5631
+ writeWhole(board, pressFile(board, name), { press: "move", at: now, by, move });
5632
+ return handedToDriver(board, name, now, `the move of ${ids.map((id) => `#${id}`).join(", ")} is recorded — ${err.message}, and the queue's pass makes it — the pass holding the queue now before it lets go, or the next one`);
5568
5633
  }
5569
5634
  }
5570
5635
  const pressDir = (board) => path.join(storyQueueDir(board), "presses");
5571
- const pressFile = (board, id) => path.join(pressDir(board), `${id}.json`);
5572
- /** 🔴 #4529 — the stories a ⚡ Force start was recorded on while another driver held the queue's lock. */
5636
+ const pressFile = (board, name) => path.join(pressDir(board), `${name}.json`);
5637
+ /** 🔴 #4529/#4592 — the presses recorded while another driver held the queue's lock: `<story>.<press>`, a move's `move-…`, and the bare `<story>` an older build wrote for a ⚡ Force start. */
5573
5638
  function pendingPresses(board) {
5574
5639
  const dir = pressDir(board);
5575
5640
  if (!fs.existsSync(dir))
5576
5641
  return [];
5577
- return fs.readdirSync(dir).filter((f) => /^\d+\.json$/.test(f)).map((f) => Number(f.slice(0, -".json".length)));
5642
+ return fs.readdirSync(dir).filter((f) => /^(\d+(\.(force|remove|retry|nudge|stop|kill))?|move-[\w-]+)\.json$/.test(f)).map((f) => f.slice(0, -".json".length));
5578
5643
  }
5579
5644
  /**
5580
- * 🔴 #4529 — UNDER THE QUEUE'S LOCK: every ⚡ Force start recorded while another driver held it is pressed now, as his press
5581
- * would have been, and its record removed; answers each story's words. A press that does not apply leaves its refusal on the
5645
+ * 🔴 #4529/#4592 — UNDER THE QUEUE'S LOCK: every press recorded while another driver held it is pressed now, as his press
5646
+ * would have been, and its record removed; answers each record's words by its name. A press that does not apply leaves its refusal on the
5582
5647
  * story's entry, where the queue's row shows it.
5583
5648
  */
5584
5649
  async function takePendingPresses(board, now) {
5585
5650
  const answered = new Map();
5586
- for (const id of pendingPresses(board)) {
5587
- const file = pressFile(board, id);
5651
+ const records = pendingPresses(board).map((name) => {
5588
5652
  let pending;
5589
5653
  try {
5590
- pending = readJson(file);
5654
+ pending = readJson(pressFile(board, name));
5591
5655
  }
5592
5656
  catch (err) {
5593
5657
  // OWNER: ITER/LOOP — a press record that cannot be read (torn, not JSON, a folder by its name, the disk refusing it) is dropped with its words on the answer, so one bad record never stalls the board's queue; the next record is read.
5594
- answered.set(id, new StoryPressRefused(`#${id}'s recorded ⚡ Force start could not be read, so it was dropped: ${err instanceof Error ? err.message : String(err)}`));
5658
+ answered.set(name, new StoryPressRefused(`the recorded press ${name} could not be read, so it was dropped: ${err instanceof Error ? err.message : String(err)}`));
5595
5659
  pending = undefined;
5596
5660
  }
5661
+ return { name, pending };
5662
+ }).sort((x, y) => (x.pending?.at ?? 0) - (y.pending?.at ?? 0));
5663
+ for (const { name, pending } of records) {
5664
+ const file = pressFile(board, name);
5665
+ const id = Number.parseInt(name, 10);
5597
5666
  try {
5598
5667
  fs.rmSync(file, { force: true, recursive: true });
5599
5668
  }
5600
5669
  catch (err) {
5601
5670
  // OWNER: ITER/LOOP — a record the disk will not let go of is left, and pressed again only when it reads as a press; the next record is read.
5602
- if (!answered.has(id))
5603
- answered.set(id, new StoryPressRefused(`#${id}'s recorded ⚡ Force start could not be removed: ${err instanceof Error ? err.message : String(err)}`));
5671
+ if (!answered.has(name))
5672
+ answered.set(name, new StoryPressRefused(`the recorded press ${name} could not be removed: ${err instanceof Error ? err.message : String(err)}`));
5604
5673
  continue;
5605
5674
  }
5606
5675
  // NULL-OK: field pending is OPTIONAL and therefore it is ok to check for NULL
5607
5676
  if (pending === undefined || pending === null)
5608
5677
  continue;
5609
- if (pending.press !== "force" || typeof pending.by !== "string" || typeof pending.at !== "number") {
5610
- answered.set(id, new StoryPressRefused(`#${id}'s recorded press is not a ⚡ Force start this queue knows, so it was dropped`));
5678
+ const press = pending.press;
5679
+ if (typeof pending.by !== "string" || typeof pending.at !== "number" || (press !== "move" && !(press !== undefined && Object.prototype.hasOwnProperty.call(PRESS_LABEL, press)))) {
5680
+ answered.set(name, new StoryPressRefused(`the recorded press ${name} is not a press this queue knows, so it was dropped`));
5611
5681
  continue;
5612
5682
  }
5613
5683
  const by = pending.by;
5614
5684
  try {
5615
- answered.set(id, await pressHeld(board, id, "force", now, by, false, undefined, pending.at));
5685
+ if (press === "move") {
5686
+ // NULL-OK: field move is OPTIONAL and therefore it is ok to check for NULL
5687
+ if (pending.move === undefined)
5688
+ throw new StoryPressRefused(`the recorded move ${name} names no stories, so it was dropped`);
5689
+ answered.set(name, movedLineWords(pending.move.ids, placeWaitingHeld(board, now, by, movedLine(pending.move), pending.move.visible)));
5690
+ }
5691
+ else {
5692
+ answered.set(name, await pressHeld(board, id, press, now, by, false, undefined, pending.at));
5693
+ }
5616
5694
  }
5617
5695
  catch (err) {
5618
5696
  if (!(err instanceof StoryPressRefused) && !(err instanceof NotInQueue))
5619
5697
  throw err;
5620
- // OWNER: ITER/LOOP — the recorded force does not apply (the board says the story is not to be started, or it is already at work): its words are kept on the story's entry and returned as the refusal; the next record is pressed.
5621
- answered.set(id, err);
5698
+ // OWNER: ITER/LOOP — the recorded press does not apply (the story is not in line, or is at work, or the board says it is not to be started): its words are kept on the story's entry and returned as the refusal; the next record is pressed.
5699
+ answered.set(name, err);
5622
5700
  const store = readQueueStore(board);
5623
- const e = store.entries.find((x) => x.storyId === id);
5624
- // NULL-OK: field e is OPTIONAL and therefore it is ok to check for NULL
5625
- if (e !== undefined) {
5626
- step(e, now, "updated", `${by} ⚡ Force start, recorded while another driver held the queue, was not applied — ${err.message}`);
5627
- writeStore(board, store);
5701
+ const hit = press === "move" ? pending.move.ids : [id];
5702
+ let wrote = false;
5703
+ for (const e of store.entries.filter((x) => hit.includes(x.storyId) && IN_LINE.has(x.state))) {
5704
+ step(e, now, "updated", `${by} ${press === "move" ? "move" : PRESS_LABEL[press]}, recorded while another driver held the queue, was not applied — ${err.message}`);
5705
+ wrote = true;
5628
5706
  }
5707
+ if (wrote)
5708
+ writeStore(board, store);
5629
5709
  }
5630
5710
  }
5631
5711
  return answered;
@@ -5656,8 +5736,9 @@ async function pressHeld(board, storyId, press, now, by, requestHandledByOwner =
5656
5736
  throw new StoryPressRefused(`#${storyId}: ${held} — ${verb} starts and wakes nothing on its own`);
5657
5737
  };
5658
5738
  if (press === "remove") {
5659
- if (working)
5660
- throw new StoryPressRefused(`#${storyId} has a worker at work — ✕ Remove takes a waiting story out of the line, and ⛔ Kill on its lane stops a worker`);
5739
+ // 🔴 #4592 — ✕ Remove is unconditional: a worker at work is told to stop (the pass ends it and the row leaves the line when it has), never a refusal
5740
+ if (working && e.worker !== undefined)
5741
+ return pressHeld(board, storyId, "kill", now, by, requestHandledByOwner, ownerAction, eventAt).then((did) => `${did} — ✕ Remove takes the row out of the line once its worker has ended`);
5661
5742
  e.state = "withdrawn";
5662
5743
  delete e.forced;
5663
5744
  delete e.forcedBy;
@@ -5807,7 +5888,11 @@ export async function placeStory(board, storyId, place, now, by) {
5807
5888
  * for a story the line does not wait on; a move that changes nothing writes nothing; answers the new waiting order.
5808
5889
  */
5809
5890
  export async function placeWaiting(board, now, by, decide, visible) {
5810
- return withQueueLock(board, now, async () => {
5891
+ return withQueueLock(board, now, async () => placeWaitingHeld(board, now, by, decide, visible));
5892
+ }
5893
+ /** {@link placeWaiting}'s move, run by a caller that already holds the queue's lock. */
5894
+ function placeWaitingHeld(board, now, by, decide, visible) {
5895
+ {
5811
5896
  const store = readQueueStore(board);
5812
5897
  const line = queueOrder(store).filter((e) => WAITING_STATES.has(e.state));
5813
5898
  const waiting = line.filter((e) => visible === undefined || visible.includes(e.storyId)).map((e) => e.storyId);
@@ -5831,7 +5916,7 @@ export async function placeWaiting(board, now, by, decide, visible) {
5831
5916
  step(line.find((e) => e.storyId === id), now, "placed", `${by} move put it at place ${ordered.indexOf(id) + 1}`);
5832
5917
  writeStore(board, store);
5833
5918
  return queueOrder(store).filter((e) => waiting.includes(e.storyId)).map((e) => e.storyId);
5834
- });
5919
+ }
5835
5920
  }
5836
5921
  /** 🔴 #4154 — FleetView's investigator ruled ABORT on the worker `jobId` of this story: its entry leaves the line, so the stopped worker is never woken, and his next Start press brings the story back; undefined when no entry in line runs that worker. */
5837
5922
  export async function withdrawStory(board, storyId, jobId, why, now) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-notify-mcp",
3
- "version": "1.3.463",
3
+ "version": "1.3.465",
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",