omni-notify-mcp 1.3.315 → 1.3.316

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.
@@ -443,7 +443,7 @@ class ServedWebview {
443
443
  return;
444
444
  }
445
445
  socket.failure = err.message;
446
- const defect = err instanceof TypeError || err instanceof ReferenceError || err instanceof RangeError;
446
+ const defect = codeDefect(err);
447
447
  const where = [...viewer.search].map(([key, value]) => `${key}=${value}`).join("&");
448
448
  console.error(`[${this.page.host.extension}] ${defect ? "a defect in the service's own code" : "a read failed"} on page "${this.page.name}" (${where}) — that browser is told and serving goes on: ${defect ? err.stack : err.message}`);
449
449
  // NULL-OK: field failed is OPTIONAL and therefore it is ok to check for NULL
@@ -709,15 +709,24 @@ class WebHost {
709
709
  return value === undefined || value === `http://127.0.0.1:${this.port}` || value === `http://localhost:${this.port}`;
710
710
  }
711
711
  answer(request, response) {
712
+ this.answered(request, response, () => this.handle(request, response));
713
+ }
714
+ answered(request, response, work) {
712
715
  try {
713
- this.handle(request, response);
716
+ work();
714
717
  }
715
718
  catch (err) {
716
- if (!(err instanceof URIError) && err.code !== "ERR_INVALID_URL") {
719
+ if (!(err instanceof Error)) {
717
720
  throw err;
718
721
  }
719
- // OWNER: a browser's malformed %-escape or address must not reach the process that serves this page — that one request is answered 400 with the reason.
720
- send(response, 400, MIME[".txt"], `the address is not a valid URL: ${err.message}`);
722
+ // OWNER: a browser request is its own trigger root inside the process every hosted extension shares — that one request is answered with its failure, and the process goes on serving.
723
+ if (err instanceof URIError || err.code === "ERR_INVALID_URL") {
724
+ send(response, 400, MIME[".txt"], `the address is not a valid URL: ${err.message}`);
725
+ return;
726
+ }
727
+ const at = (request.url ?? "").split("?")[0];
728
+ console.error(`[${this.extension}] ${request.method} ${at} ${codeDefect(err) ? "hit a defect in the host's own code" : "failed"} — answered 500: ${codeDefect(err) ? err.stack : err.message}`);
729
+ send(response, 500, MIME[".txt"], `${request.method} ${at} failed: ${err.message}`);
721
730
  }
722
731
  }
723
732
  handle(request, response) {
@@ -939,7 +948,10 @@ class WebHost {
939
948
  if (input === null || typeof input !== "object" || Array.isArray(input)) {
940
949
  return json(400, { error: "bad_request", text: "the body must be a JSON object" });
941
950
  }
942
- Promise.resolve(handler(input)).then((answer) => json(answer.status, answer.body), (cause) => json(500, { error: "failed", text: cause instanceof Error ? cause.message : String(cause) }));
951
+ Promise.resolve()
952
+ .then(() => handler(input))
953
+ .then((answer) => json(answer.status, answer.body))
954
+ .catch((cause) => json(500, { error: "failed", text: cause instanceof Error ? cause.message : String(cause) }));
943
955
  });
944
956
  return undefined;
945
957
  }
@@ -957,7 +969,7 @@ class WebHost {
957
969
  if (!over)
958
970
  chunks.push(chunk);
959
971
  });
960
- request.on("end", () => {
972
+ request.on("end", () => this.answered(request, response, () => {
961
973
  if (over)
962
974
  return;
963
975
  let label;
@@ -996,7 +1008,7 @@ class WebHost {
996
1008
  return send(response, 500, MIME[".txt"], `the workspace pick could not be saved: ${err.message}`);
997
1009
  }
998
1010
  return send(response, 204, MIME[".txt"], "");
999
- });
1011
+ }));
1000
1012
  return undefined;
1001
1013
  }
1002
1014
  serveFile(encoded, response) {
@@ -1164,6 +1176,9 @@ function closedPage(extension, page) {
1164
1176
  socket.addEventListener("close", function () { if (opened) awaitHost(); else document.getElementById("said").textContent = "⚠️ This page could not reach its host, so it cannot load the page when it opens — reload it to try again"; });
1165
1177
  })();</script></body></html>`;
1166
1178
  }
1179
+ function codeDefect(err) {
1180
+ return err instanceof TypeError || err instanceof ReferenceError || err instanceof RangeError;
1181
+ }
1167
1182
  function send(response, status, type, body, headers = {}) {
1168
1183
  const payload = Buffer.isBuffer(body) ? body : Buffer.from(String(body), "utf8");
1169
1184
  response.writeHead(status, { "Content-Type": type, "Content-Length": payload.length, ...headers });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-notify-mcp",
3
- "version": "1.3.315",
3
+ "version": "1.3.316",
4
4
  "description": "Reach your AI agents from anywhere — and let them reach you. One stdio process 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/index.js",
6
6
  "type": "module",