omni-notify-mcp 1.3.415 → 1.3.417

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.
@@ -2843,13 +2843,19 @@ function withdrawUntilAsked(board, e, now, why) {
2843
2843
  export async function clearStoryQueue(board, since) {
2844
2844
  return withQueueLock(board, Date.now(), async () => {
2845
2845
  const store = readQueueStore(board);
2846
+ const his = new Set(store.entries.filter((e) => (e.state === "queued" || e.state === "retrying") && hisOwn(e)));
2847
+ const untaken = new Set(requestedStories(board).filter((id) => {
2848
+ const r = readableRequest(board, id);
2849
+ // NULL-OK: field pressedAt is OPTIONAL and therefore it is ok to check for NULL
2850
+ return r !== undefined && r.origin === "press" && r.eligible && r.pressedAt !== undefined && (r.forced ?? r.pressedAt) > priorAuthorityOf(store.entries.find((e) => e.storyId === id));
2851
+ }));
2846
2852
  // NULL-OK: field worker/archivedSessions/handStop is OPTIONAL and therefore it is ok to check for NULL
2847
- const kept = store.entries.filter((e) => e.worker !== undefined || e.archivedSessions !== undefined || e.handStop !== undefined || (e.forceEventAt ?? 0) >= since);
2848
- const working = new Set(kept.filter((e) => e.state === "starting" || e.state === "running" || (e.forceEventAt ?? 0) >= since).map((e) => e.storyId));
2853
+ const kept = store.entries.filter((e) => e.worker !== undefined || e.archivedSessions !== undefined || e.handStop !== undefined || (e.forceEventAt ?? 0) >= since || his.has(e));
2854
+ const working = new Set([...kept.filter((e) => e.state === "starting" || e.state === "running" || (e.forceEventAt ?? 0) >= since || his.has(e)).map((e) => e.storyId), ...untaken]);
2849
2855
  let removed = store.entries.length - kept.length;
2850
2856
  const now = Date.now();
2851
2857
  for (const e of kept) {
2852
- if ((e.forceEventAt ?? 0) >= since)
2858
+ if ((e.forceEventAt ?? 0) >= since || his.has(e) || untaken.has(e.storyId))
2853
2859
  continue;
2854
2860
  e.landedAt = Math.max(e.landedAt ?? 0, since);
2855
2861
  delete e.forced;
@@ -3007,6 +3013,7 @@ function refusalOf(r) {
3007
3013
  return `provider "${r.provider}" is not started by this queue — choose Claude, Copilot, Codex, OpenCode or AUTO`;
3008
3014
  return undefined;
3009
3015
  }
3016
+ const priorAuthorityOf = (e) => Math.max(e?.startPressedAt ?? 0, e?.handStop?.at ?? 0, e?.worker?.startedAt ?? 0, e?.forceStartedAt ?? 0, e?.forceEventAt ?? 0);
3010
3017
  /** One request applied to the store: an entry made, updated, withdrawn or put back in line; answers the refusal when it cannot be queued. */
3011
3018
  function applyRequest(store, r, now) {
3012
3019
  const refused = refusalOf(r);
@@ -3016,7 +3023,7 @@ function applyRequest(store, r, now) {
3016
3023
  if (e?.requestId === r.requestId)
3017
3024
  return undefined;
3018
3025
  const intentAt = r.forced ?? r.pressedAt;
3019
- const priorAuthority = Math.max(e?.startPressedAt ?? 0, e?.handStop?.at ?? 0, e?.worker?.startedAt ?? 0, e?.forceStartedAt ?? 0, e?.forceEventAt ?? 0);
3026
+ const priorAuthority = priorAuthorityOf(e);
3020
3027
  const freshForce = r.forced !== undefined && r.forced > priorAuthority;
3021
3028
  const fields = { title: r.title, pri: r.pri, effort: r.effort, provider: r.provider, model: r.model, name: r.name, brief: r.brief, eligible: r.eligible, why: r.why };
3022
3029
  // NULL-OK: field e is OPTIONAL and therefore it is ok to check for NULL
@@ -47,9 +47,6 @@ const ACT_FORBIDDEN_HEADERS = ["origin", "referer", "forwarded", "x-forwarded-fo
47
47
  function recordDirectory(extension) {
48
48
  return path.join(os.homedir(), ".bullseye", "webhost", extension);
49
49
  }
50
- const WORKSPACE_FILE = path.join(os.homedir(), ".bullseye", "webhost", "workspace.json");
51
- // GATE: a workspace pick body larger than this is answered 413 and never parsed.
52
- const PICK_BODY_BYTES = 4_096;
53
50
  // GATE: a page socket is pinged this often so no tunnel or carrier idles it out; one that sent nothing (not even the browser's automatic pong) for a whole beat is ended, and its page reconnects.
54
51
  const SOCKET_BEAT_MS = 20_000;
55
52
  /** Whether a parsed window record carries everything an entry address to that window needs. */
@@ -116,23 +113,6 @@ function workspacesServed(extension, base) {
116
113
  }
117
114
  return served;
118
115
  }
119
- /** The workspace Meni last picked on any page of this machine; empty only when he has not picked yet. A pick file that is not a label THROWS. */
120
- function chosenWorkspace() {
121
- if (!fs.existsSync(WORKSPACE_FILE)) {
122
- return "";
123
- }
124
- const label = JSON.parse(fs.readFileSync(WORKSPACE_FILE, "utf8"))?.label;
125
- if (typeof label !== "string") {
126
- throw new TypeError(`${WORKSPACE_FILE} carries no workspace label`);
127
- }
128
- return label;
129
- }
130
- function saveChosenWorkspace(label) {
131
- fs.mkdirSync(path.dirname(WORKSPACE_FILE), { recursive: true });
132
- const staged = `${WORKSPACE_FILE}.${process.pid}.tmp`;
133
- fs.writeFileSync(staged, JSON.stringify({ label }));
134
- fs.renameSync(staged, WORKSPACE_FILE);
135
- }
136
116
  function framedPolicy(html, origin) {
137
117
  return html.replace(/<meta\b[^>]*>/gi, (tag) => {
138
118
  if (!/http-equiv\s*=\s*["']?Content-Security-Policy/i.test(tag))
@@ -151,28 +131,19 @@ function framedPolicy(html, origin) {
151
131
  function servedWorkspace(page) {
152
132
  // NULL-OK: field workspaces().get(label) is OPTIONAL and therefore it is ok to check for NULL
153
133
  const addressOf = (label) => page.host.workspaces().get(label)?.[page.name];
154
- const adapter = {
134
+ let picked;
135
+ return {
155
136
  framed: true,
156
- chosenUnreadable: undefined,
157
137
  read: () => {
158
- let chosen = "";
159
- adapter.chosenUnreadable = undefined;
160
- try {
161
- chosen = chosenWorkspace();
162
- }
163
- catch (err) {
164
- if (!(err instanceof SyntaxError) && !(err instanceof TypeError))
165
- throw err;
166
- // OWNER: the panel's workspace read is this read's trigger root — a pick file that is not a label draws the window's own workspace with the reason beside it, and the next pick in the bar rewrites the file whole.
167
- adapter.chosenUnreadable = err.message;
168
- }
169
- // NULL-OK: field addressOf(chosen) is OPTIONAL and therefore it is ok to check for NULL
170
- const at = addressOf(chosen) ?? addressOf(page.host.label);
138
+ if (picked !== undefined)
139
+ return picked;
140
+ const at = addressOf(page.host.label);
171
141
  return at === undefined ? new URLSearchParams() : new URL(at, "http://localhost").searchParams;
172
142
  },
173
- select: () => { },
143
+ select: (search) => {
144
+ picked = new URLSearchParams(search);
145
+ },
174
146
  };
175
- return adapter;
176
147
  }
177
148
  function alive(pid) {
178
149
  try {
@@ -376,7 +347,7 @@ class MirroredWebview {
376
347
  return search.toString() === wanted.toString();
377
348
  });
378
349
  const frame = this.workspace.framed !== true || selected === undefined || selected[0] === this.page.host.label ? "" : selected[1][this.page.name];
379
- return { extension: this.page.host.extension, current: selected === undefined ? "" : selected[0], chosen: "", chosenUnreadable: this.workspace.chosenUnreadable, workspaces, frame };
350
+ return { extension: this.page.host.extension, current: selected === undefined ? "" : selected[0], workspaces, frame };
380
351
  }
381
352
  async workspaceRequest(message) {
382
353
  const answer = (status, body) => this.real.postMessage({ type: "__bullseyeWorkspace", id: message.id, status, body });
@@ -388,8 +359,6 @@ class MirroredWebview {
388
359
  if (target === undefined)
389
360
  return answer(400, "that workspace is not served on this machine");
390
361
  const search = new URL(target, "http://localhost").searchParams;
391
- if (search.get("scope") !== "all")
392
- saveChosenWorkspace(message.pick);
393
362
  await this.workspace.select(search);
394
363
  return answer(200, this.workspaceReading());
395
364
  }).then(undefined, (err) => answer(500, err.message));
@@ -897,8 +866,8 @@ class WebHost {
897
866
  if (!this.admittedOrigin(request.headers.origin, base)) {
898
867
  return send(response, 403, MIME[".txt"], "refused");
899
868
  }
900
- if (request.method === "POST") {
901
- return this.rememberWorkspace(request, response);
869
+ if (request.method !== "GET" && request.method !== "HEAD") {
870
+ return send(response, 405, MIME[".txt"], "method not allowed");
902
871
  }
903
872
  let workspaces;
904
873
  let current;
@@ -911,20 +880,9 @@ class WebHost {
911
880
  if (!(err instanceof SyntaxError))
912
881
  throw err;
913
882
  // OWNER: the page's workspace read is this read's trigger root — a workspace list that is not defined or cannot be read is answered with its reason beside this host's own workspace, so the page says why its picker is short, and the process serving it goes on.
914
- return send(response, 200, MIME[".json"], JSON.stringify({ extension: this.extension, current: this.ownLabel(), chosen: "", workspaces: this.ownWorkspaces(base), listUnreadable: err.message, ...this.level() }), { "Cache-Control": "no-store" });
915
- }
916
- let chosen = "";
917
- let chosenUnreadable;
918
- try {
919
- chosen = chosenWorkspace();
920
- }
921
- catch (err) {
922
- if (!(err instanceof SyntaxError) && !(err instanceof TypeError))
923
- throw err;
924
- // OWNER: the page's workspace read is this read's trigger root — a pick file that is not a label is answered with its reason beside an empty pick, and the next pick rewrites the file whole.
925
- chosenUnreadable = err.message;
883
+ return send(response, 200, MIME[".json"], JSON.stringify({ extension: this.extension, current: this.ownLabel(), workspaces: this.ownWorkspaces(base), listUnreadable: err.message, ...this.level() }), { "Cache-Control": "no-store" });
926
884
  }
927
- return send(response, 200, MIME[".json"], JSON.stringify({ extension: this.extension, current, chosen, chosenUnreadable, workspaces, ...this.level() }), { "Cache-Control": "no-store" });
885
+ return send(response, 200, MIME[".json"], JSON.stringify({ extension: this.extension, current, workspaces, ...this.level() }), { "Cache-Control": "no-store" });
928
886
  }
929
887
  if (request.method !== "GET" && request.method !== "HEAD") {
930
888
  return send(response, 405, MIME[".txt"], "method not allowed");
@@ -953,43 +911,6 @@ class WebHost {
953
911
  if (home !== null && ROSTER_EXTENSIONS.has(this.extension)) {
954
912
  return send(response, 200, MIME[".html"], peekedRosterPage(this.label, home, workspacesServed(this.extension, base).get(home)?.[page.name]), { "Cache-Control": "no-store" });
955
913
  }
956
- let here;
957
- try {
958
- here = this.currentOf(url.searchParams);
959
- }
960
- catch (err) {
961
- if (!(err instanceof SyntaxError))
962
- throw err;
963
- // OWNER: the page request is this read's trigger root — a workspace list that cannot be read serves the page at its own address, and the picker's own read puts listUnreadable on screen.
964
- return this.serveDocument(page, response);
965
- }
966
- let chosen = "";
967
- if (here === "") {
968
- try {
969
- chosen = chosenWorkspace();
970
- }
971
- catch (err) {
972
- if (!(err instanceof SyntaxError) && !(err instanceof TypeError))
973
- throw err;
974
- // OWNER: the page request is this read's trigger root — a pick file that is not a label serves the page at its own address, and the picker's own read puts chosenUnreadable on screen.
975
- }
976
- }
977
- let remembered;
978
- try {
979
- // NULL-OK: field workspaces(base).get(chosen) is OPTIONAL and therefore it is ok to check for NULL
980
- remembered = chosen === "" ? undefined : this.workspaces(base).get(chosen)?.[page.name];
981
- }
982
- catch (err) {
983
- if (!(err instanceof SyntaxError))
984
- throw err;
985
- // OWNER: the page request is this read's trigger root — a workspace list that cannot be read serves the page at its own address, and the picker's own read puts listUnreadable on screen.
986
- remembered = undefined;
987
- }
988
- // NULL-OK: field remembered is OPTIONAL and therefore it is ok to check for NULL
989
- if (remembered !== undefined && new URL(remembered, "http://localhost").searchParams.get("scope") !== "all") {
990
- const moved = url.searchParams.has("bullseye-framed") ? `${remembered}${remembered.includes("?") ? "&" : "?"}bullseye-framed=1` : remembered;
991
- return send(response, 302, MIME[".txt"], `moved to ${moved}`, { Location: moved, "Cache-Control": "no-store" });
992
- }
993
914
  return this.serveDocument(page, response);
994
915
  }
995
916
  /** The workspaces a page of this host can switch to: label -> { page -> address }, built on `base` when the request came through the gateway. The workspaces are this window's own and the ones on the workspace list; a live window's record is only the address of that window's pages, never a source of the list. An extension whose service draws its pages (`service`) switches to that service's workspaces at the service's address, never to another window. */
@@ -1106,61 +1027,6 @@ class WebHost {
1106
1027
  });
1107
1028
  return undefined;
1108
1029
  }
1109
- /** Meni's workspace pick on any page, written once for the machine so every page opens on the workspace he left. */
1110
- rememberWorkspace(request, response) {
1111
- const chunks = [];
1112
- let size = 0;
1113
- let over = false;
1114
- request.on("data", (chunk) => {
1115
- size += chunk.length;
1116
- if (size > PICK_BODY_BYTES && !over) {
1117
- over = true;
1118
- send(response, 413, MIME[".txt"], `a workspace pick is at most ${PICK_BODY_BYTES} bytes`);
1119
- }
1120
- if (!over)
1121
- chunks.push(chunk);
1122
- });
1123
- request.on("end", () => this.answered(request, response, () => {
1124
- if (over)
1125
- return;
1126
- let label;
1127
- try {
1128
- label = JSON.parse(Buffer.concat(chunks).toString("utf8")).label;
1129
- }
1130
- catch (err) {
1131
- if (!(err instanceof SyntaxError) && !(err instanceof TypeError))
1132
- throw err;
1133
- // OWNER: the page's pick request is this read's trigger root — a body that is not a JSON object is answered 400, and the window goes on.
1134
- return send(response, 400, MIME[".txt"], "the body must be a JSON object carrying a label");
1135
- }
1136
- let served;
1137
- try {
1138
- served = this.workspaces();
1139
- }
1140
- catch (err) {
1141
- if (!(err instanceof SyntaxError))
1142
- throw err;
1143
- // OWNER: the page's pick request is this read's trigger root — a workspace list that cannot be read is answered 500 with its reason, nothing is written, and the process serving it goes on.
1144
- return send(response, 500, MIME[".txt"], `the workspaces this host serves could not be read: ${err.message}`);
1145
- }
1146
- if (typeof label !== "string" || !served.has(label)) {
1147
- return send(response, 400, MIME[".txt"], "that workspace is not served on this machine");
1148
- }
1149
- if (Object.values(served.get(label)).some((at) => new URL(at, "http://localhost").searchParams.get("scope") === "all"))
1150
- return send(response, 204, MIME[".txt"], "");
1151
- try {
1152
- saveChosenWorkspace(label);
1153
- }
1154
- catch (err) {
1155
- if (typeof err.code !== "string")
1156
- throw err;
1157
- // OWNER: the page's pick request is this write's trigger root — a pick that cannot be saved (another process holds the file) is answered 500 with its reason and the process serving it goes on.
1158
- return send(response, 500, MIME[".txt"], `the workspace pick could not be saved: ${err.message}`);
1159
- }
1160
- return send(response, 204, MIME[".txt"], "");
1161
- }));
1162
- return undefined;
1163
- }
1164
1030
  serveFile(encoded, response) {
1165
1031
  const file = fileOfResourcePath(encoded);
1166
1032
  const roots = [...this.pages.values()].filter((page) => page.live).flatMap((page) => page.mirror.roots());
@@ -1504,4 +1370,4 @@ function startWebHost(options) {
1504
1370
  void INSTANCE.start(options);
1505
1371
  return { dispose: () => INSTANCE.stop() };
1506
1372
  }
1507
- module.exports = { WebHost, ServiceHost, MirroredWebview, ServedWebview, startWebHost, actWindows, listWebUis, saveTheme, readTheme, webDocument, repoint, fileOfResourcePath, sha256, chosenWorkspace };
1373
+ module.exports = { WebHost, ServiceHost, MirroredWebview, ServedWebview, startWebHost, actWindows, listWebUis, saveTheme, readTheme, webDocument, repoint, fileOfResourcePath, sha256 };
@@ -95,7 +95,6 @@ const PICKER_SOURCE = String.raw `
95
95
  var peekHome = new URLSearchParams(window.location.search).get("bullseye-peek");
96
96
  var framedPage = new URLSearchParams(window.location.search).get("bullseye-framed") !== null;
97
97
  var peeking = peekable && peekHome !== null;
98
- var moved = "bullseye-workspace-moved";
99
98
  var barColours = "background:#252526;color:#ccc";
100
99
 
101
100
  function workspaceBox() {
@@ -143,13 +142,6 @@ const PICKER_SOURCE = String.raw `
143
142
  return holder;
144
143
  }
145
144
 
146
- function transientWorkspace(served, label) {
147
- var pages = served.workspaces[label];
148
- if (pages === undefined || pages[page] === undefined) return false;
149
- var at = pages[page];
150
- return new URLSearchParams(at.slice(at.indexOf("?") + 1)).get("scope") === "all";
151
- }
152
-
153
145
  function workspacesUrl() {
154
146
  return "/__bullseye/workspaces?at=" + encodeURIComponent(window.location.search);
155
147
  }
@@ -177,38 +169,13 @@ const PICKER_SOURCE = String.raw `
177
169
  peekBadge(served, labels);
178
170
  return;
179
171
  }
180
- if (served.chosen === served.current) {
181
- window.sessionStorage.removeItem(moved);
182
- }
183
- var remembered = served.chosen;
184
- if (served.chosenUnreadable !== undefined) {
185
- notice("__bullseye-workspace-pick-unread", "⛔ The workspace you last picked could not be read: " + served.chosenUnreadable + " — pick one in the bar above to replace it");
172
+ if (served.current === "" && new URLSearchParams(window.location.search).has("project")) {
173
+ notice("__bullseye-workspace-unknown", "⛔ This address names a workspace that is not served here — pick one of: " + labels.join(", "));
186
174
  }
187
175
  if (labels.length <= 1) {
188
176
  return;
189
177
  }
190
178
  drawBar(served, labels);
191
- window.addEventListener("focus", function () {
192
- if (transientWorkspace(served, served.current)) return;
193
- pickerFetch(workspacesUrl(), { cache: "no-store" }).then(function (response) {
194
- return response.ok ? response.json() : null;
195
- }).then(function (again) {
196
- if (again === null) return;
197
- if (again.current !== served.current) {
198
- served = again;
199
- labels = Object.keys(served.workspaces).filter(function (label) {
200
- return served.workspaces[label][page] !== undefined;
201
- });
202
- document.getElementById("bullseye-workspace").remove();
203
- drawBar(served, labels);
204
- return;
205
- }
206
- if (again.chosen !== "" && again.chosen !== remembered && again.chosen !== again.current && window.sessionStorage.getItem(moved) !== again.chosen && again.workspaces[again.chosen] !== undefined && again.workspaces[again.chosen][page] !== undefined && !transientWorkspace(again, again.chosen)) {
207
- window.sessionStorage.setItem(moved, again.chosen);
208
- pickerNavigate(again.workspaces[again.chosen][page]);
209
- }
210
- });
211
- });
212
179
  });
213
180
  }
214
181
 
@@ -227,7 +194,6 @@ const PICKER_SOURCE = String.raw `
227
194
  }
228
195
  if (!commit()) return;
229
196
  served.current = picked;
230
- window.sessionStorage.setItem(moved, picked);
231
197
  pickerNavigate(served.workspaces[picked][page]);
232
198
  }, function () {
233
199
  if (!latest()) return;
@@ -308,6 +274,7 @@ const CONNECTION_SOURCE = String.raw `(function () {
308
274
  found = document.createElement("div");
309
275
  found.id = COVER;
310
276
  found.setAttribute("role", "alert");
277
+ found.setAttribute("data-be-notice", "own");
311
278
  found.style.cssText = "position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.6);cursor:not-allowed;padding:16px;box-sizing:border-box";
312
279
  var word = document.createElement("div");
313
280
  word.className = "__bullseye-notice-text";
@@ -422,7 +389,7 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
422
389
  var pickerNavigate = window.location.assign.bind(window.location);
423
390
  var pickerPlaced = function () {};
424
391
  var pickerSave = function (served, picked) {
425
- return transientWorkspace(served, picked) ? Promise.resolve({ ok: true }) : pickerFetch("/__bullseye/workspaces", { method: "POST", body: JSON.stringify({ label: picked }) });
392
+ return Promise.resolve({ ok: true });
426
393
  };
427
394
  var themeMissing = script.getAttribute("data-theme") === "missing";
428
395
  var stateKey = "bullseye-webhost:" + page;
@@ -729,7 +696,7 @@ const PICKER_PAGE_SOURCE = String.raw `(function () {
729
696
  var pickerNavigate = window.location.assign.bind(window.location);
730
697
  var pickerPlaced = function () {};
731
698
  var pickerSave = function (served, picked) {
732
- return transientWorkspace(served, picked) ? Promise.resolve({ ok: true }) : pickerFetch("/__bullseye/workspaces", { method: "POST", body: JSON.stringify({ label: picked }) });
699
+ return Promise.resolve({ ok: true });
733
700
  };
734
701
  ` + PICKER_SOURCE + String.raw `
735
702
  baseStyles();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-notify-mcp",
3
- "version": "1.3.415",
3
+ "version": "1.3.417",
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",