omni-notify-mcp 1.3.406 → 1.3.407

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.
@@ -160,7 +160,7 @@ function show(name,heading){
160
160
  return view;
161
161
  }
162
162
 
163
- function down(what,method,path){if(method==="GET"&&path==="/v1/conversations")window.bullseyeConnection.reconnecting(what,8000);else if(method==="GET"&&path==="/v1/panel")window.bullseyeConnection.reconnecting(what,5000);else window.bullseyeConnection.disconnected(what,"this request did not go through — repeat it");}function scoped(h){if(scope!==null)h["x-bullseye-project"]=scope;return h}async function api(method,path,body,signal){var response;try{response=await fetch(path,{method:method,headers:scoped({authorization:"Bearer "+token,"content-type":"application/json"}),body:body===undefined?undefined:JSON.stringify(body),signal:signal});}catch(e){if(e.name!=="AbortError")down("the connection to the Notify service",method,path);throw e;}if(response.status>=502)down("the connection to the Notify service (HTTP "+response.status+")",method,path);else if(!socketDown)window.bullseyeConnection.live();var data=await response.json();if(!response.ok){if(response.status===401)signIn("Sign in again to reach your CLI.");var error=Error(data.error||"Request failed");error.status=response.status;throw error;}return data;}
163
+ function down(what,method,path){if(method==="GET"&&path==="/v1/conversations")window.bullseyeConnection.reconnecting(what,8000);else if(method==="GET"&&path==="/v1/panel")window.bullseyeConnection.reconnecting(what,5000);else if(method==="GET"&&path.indexOf("/v1/terminals/")===0)window.bullseyeConnection.reconnecting(what,1000);else window.bullseyeConnection.disconnected(what,"this request did not go through — repeat it");}function scoped(h){if(scope!==null)h["x-bullseye-project"]=scope;return h}async function api(method,path,body,signal){var response;try{response=await fetch(path,{method:method,headers:scoped({authorization:"Bearer "+token,"content-type":"application/json"}),body:body===undefined?undefined:JSON.stringify(body),signal:signal});}catch(e){if(e.name!=="AbortError")down("the connection to the Notify service",method,path);throw e;}if(response.status>=502)down("the connection to the Notify service (HTTP "+response.status+")",method,path);else if(!socketDown)window.bullseyeConnection.live();var data=await response.json();if(!response.ok){if(response.status===401)signIn("Sign in again to reach your CLI.");var error=Error(data.error||"Request failed");error.status=response.status;throw error;}return data;}
164
164
  function fail(error){note.textContent=error.message;}
165
165
  function ordered(id,act,body){if(!socket||socket.readyState!==WebSocket.OPEN)return;socket.send(JSON.stringify(Object.assign({kind:act},body)));}
166
166
  /** The last folder of a path, so a row names its project without printing the whole path. */
@@ -382,10 +382,10 @@ async function cliAttach(id,origin){
382
382
  if(mine!==view)return;
383
383
  term.options.disableStdin=true;
384
384
  var ws=new WebSocket((location.protocol==="https:"?"wss://":"ws://")+location.host+"/v1/terminals/"+id+"/ws",["bn-terminal","bn-bearer."+token]);socket=ws;
385
- var frames=Promise.resolve();
386
- ws.onopen=function(){if(mine!==view){ws.close();return;}socketDown=false;window.bullseyeConnection.live();term.options.disableStdin=false;fitAddon.fit();ordered(id,"resize",{cols:term.cols,rows:term.rows});term.focus();};
385
+ var frames=Promise.resolve(),opened=false;
386
+ ws.onopen=function(){if(mine!==view){ws.close();return;}opened=true;socketDown=false;window.bullseyeConnection.live();term.options.disableStdin=false;fitAddon.fit();ordered(id,"resize",{cols:term.cols,rows:term.rows});term.focus();};
387
387
  ws.onmessage=function(event){frames=frames.then(async function(){if(mine!==view)return;var frame=JSON.parse(event.data);if(frame.files){fileNotice=frame.error||"Sent to CLI: "+frame.paths.join(" · ");note.textContent=fileNotice;return;}if(frame.error){note.textContent=frame.error;return;}var behind=frame.reset?term.buffer.active.baseY-term.buffer.active.viewportY:0;if(frame.reset)term.reset();await new Promise(function(done){term.write(frame.data,done);});if(mine!==view)return;if(behind>0)term.scrollLines(-behind);note.textContent=frame.provider+" · "+(phone?base(frame.project):frame.project)+(frame.ended?" · CLI ended":" · connected")+(frame.failure?" · "+frame.failure:"")+(fileNotice?" · "+fileNotice:"");}).catch(fail);};
388
- ws.onclose=function(event){if(mine!==view)return;term.options.disableStdin=true;if(event.code===1000){socketDown=false;window.bullseyeConnection.live();note.textContent="CLI ended.";return;}if(event.code===1008){socketDown=true;window.bullseyeConnection.disconnected("the terminal connection to the CLI",event.reason+" — press Reattach or sign in again");note.textContent="Disconnected: "+event.reason+". Press Reattach or sign in again.";return;}socketDown=true;window.bullseyeConnection.reconnecting("the terminal connection to the CLI",1000);note.textContent="Disconnected. Reattaching to the same CLI…";reconnect=setTimeout(connect,1000);};
388
+ ws.onclose=function(event){if(mine!==view)return;term.options.disableStdin=true;if(event.code===1000){socketDown=false;window.bullseyeConnection.live();note.textContent="CLI ended.";return;}if(event.code===1008){socketDown=true;window.bullseyeConnection.disconnected("the terminal connection to the CLI",event.reason+" — press Reattach or sign in again");note.textContent="Disconnected: "+event.reason+". Press Reattach or sign in again.";return;}socketDown=true;window.bullseyeConnection.reconnecting("the terminal connection to the CLI",1000);note.textContent="Disconnected. Reattaching to the same CLI…";if(opened){reconnect=setTimeout(connect,1000);return;}api("GET","/v1/terminals/"+id).then(function(){if(mine===view)reconnect=setTimeout(connect,1000);},function(error){if(mine!==view)return;if(error.status!==404){reconnect=setTimeout(connect,1000);return;}window.bullseyeConnection.disconnected("the terminal connection to the CLI","this CLI no longer exists — press Back to pick another");note.textContent="This CLI no longer exists. Press Back to pick another.";});};
389
389
  ws.onerror=function(){socketDown=true;window.bullseyeConnection.reconnecting("the terminal connection to the CLI",1000);note.textContent="Terminal connection failed. Reconnecting…";};
390
390
  }
391
391
  connect();
@@ -266,7 +266,7 @@ function cookieOf(request, name) {
266
266
  function escapeAttribute(value) {
267
267
  return String(value).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
268
268
  }
269
- function webDocument(source, { page, roots, theme }) {
269
+ function webDocument(source, { page, drawn, roots, theme }) {
270
270
  let html = repoint(source, roots).replace(/<meta\b[^>]*http-equiv\s*=\s*["']?Content-Security-Policy["']?[^>]*>/gi, "");
271
271
  const nonces = [...source.matchAll(/\bnonce\s*=\s*["']([^"']+)["']/g)].map((match) => `'nonce-${match[1]}'`);
272
272
  const policy = [
@@ -286,7 +286,7 @@ function webDocument(source, { page, roots, theme }) {
286
286
  const head = viewport +
287
287
  `<meta http-equiv="Content-Security-Policy" content="${policy}">` +
288
288
  `<style id="_defaultStyles">${known ? theme.defaultCss.replace(/<\/style/gi, "<\\/style") : ""}</style>` +
289
- `<script src="/__bullseye/host.js" data-page="${escapeAttribute(page)}" data-theme="${known ? "captured" : "missing"}"></script>`;
289
+ `<script src="/__bullseye/host.js" data-page="${escapeAttribute(page)}" data-drawn="${escapeAttribute(drawn)}" data-theme="${known ? "captured" : "missing"}"></script>`;
290
290
  html = html.replace(/<html\b([^>]*)>/i, (tag, attributes) => {
291
291
  const without = attributes.replace(/\sstyle\s*=\s*("[^"]*"|'[^']*')/i, "");
292
292
  return known ? `<html${without} style="${escapeAttribute(vars)}">` : tag;
@@ -581,6 +581,11 @@ class Page {
581
581
  this.title = options.title ?? name;
582
582
  this.mirror = undefined;
583
583
  this.sockets = new Set();
584
+ this.drawing = 0;
585
+ }
586
+ /** Which drawing of this page a document is: this process and how many times the page was redrawn in it, so a browser that missed a redraw while its socket was down reloads instead of reconnecting to the old page. */
587
+ get drawn() {
588
+ return `${process.pid}.${this.drawing}`;
584
589
  }
585
590
  get mark() {
586
591
  return `${this.host.extension}/${this.name}/${process.pid}`;
@@ -615,6 +620,7 @@ class Page {
615
620
  this.host.publish();
616
621
  }
617
622
  redrawn() {
623
+ this.drawing += 1;
618
624
  for (const socket of this.sockets) {
619
625
  writeFrame(socket, JSON.stringify({ type: "reload" }));
620
626
  }
@@ -1021,6 +1027,7 @@ class WebHost {
1021
1027
  const pages = Object.fromEntries([...this.pages.values()].map((page) => [page.name, {
1022
1028
  url: page.url,
1023
1029
  live: page.live,
1030
+ drawn: page.drawn,
1024
1031
  browsers: page.sockets.size,
1025
1032
  }]));
1026
1033
  return send(response, 200, MIME[".json"], JSON.stringify({ extension: this.extension, label: this.label, pid: process.pid, pages }, null, 2), { "Cache-Control": "no-store" });
@@ -1030,7 +1037,7 @@ class WebHost {
1030
1037
  return send(response, 200, MIME[".html"], closedPage(this.extension, page), { "Cache-Control": "no-store" });
1031
1038
  }
1032
1039
  const source = page.mirror.html;
1033
- return send(response, 200, MIME[".html"], webDocument(source, { page: page.name, roots: page.mirror.roots(), theme: this.theme() }), {
1040
+ return send(response, 200, MIME[".html"], webDocument(source, { page: page.name, drawn: page.drawn, roots: page.mirror.roots(), theme: this.theme() }), {
1034
1041
  "Cache-Control": "no-store",
1035
1042
  "X-Bullseye-Source-Sha256": sha256(source),
1036
1043
  });
@@ -1237,6 +1244,10 @@ class WebHost {
1237
1244
  page.sockets.delete(socket);
1238
1245
  };
1239
1246
  page.sockets.add(socket);
1247
+ const drawn = url.searchParams.get("drawn");
1248
+ // NULL-OK: field drawn is OPTIONAL and therefore it is ok to check for NULL
1249
+ if (drawn !== null && drawn !== page.drawn)
1250
+ writeFrame(socket, JSON.stringify({ type: "reload" }));
1240
1251
  // NULL-OK: field mirror is OPTIONAL and therefore it is ok to check for NULL
1241
1252
  page.mirror?.forget();
1242
1253
  socket.on("data", frameReader(socket, (text) => setImmediate(() => page.received(socket, text))));
@@ -1335,19 +1346,29 @@ function closedPage(extension, page) {
1335
1346
  return `<!DOCTYPE html><html><head><meta charset="utf-8">${PHONE_VIEWPORT}<title>${escapeAttribute(extension)} · ${escapeAttribute(page.title)}</title></head>
1336
1347
  <body style="font:14px system-ui,sans-serif;padding:24px;background:#1e1e1e;color:#ccc">⚪ ${escapeAttribute(page.title)} is not open in VS Code right now, so there is nothing to show here — this page loads it the moment it opens.<div id="said" style="margin-top:8px"></div>
1337
1348
  <script>${CONNECTION_SOURCE}</script><script>(function () {
1338
- var opened = false;
1339
- var socket = new WebSocket((location.protocol === "https:" ? "wss:" : "ws:") + "//" + location.host + "/__bullseye/ws?page=${encodeURIComponent(page.name)}&peek=1");
1349
+ var WHAT = "this page's live connection to its host";
1350
+ var reconnected = false;
1351
+ function connect() {
1352
+ var opened = false;
1353
+ var socket = new WebSocket((location.protocol === "https:" ? "wss:" : "ws:") + "//" + location.host + "/__bullseye/ws?page=${encodeURIComponent(page.name)}&peek=1");
1354
+ socket.addEventListener("open", function () {
1355
+ opened = true;
1356
+ var mine = socket;
1357
+ window.bullseyeConnection.opened(function () { return mine.readyState === 1; }, function () {
1358
+ window.bullseyeConnection.live();
1359
+ document.getElementById("said").textContent = "";
1360
+ });
1361
+ fetch("/__bullseye/health", { cache: "no-store" }).then(function (r) { return r.json(); }).then(function (health) { if (health.pages[${JSON.stringify(page.name)}].live) location.reload(); });
1362
+ });
1363
+ socket.addEventListener("message", function (event) { if (JSON.parse(String(event.data)).type === "reload") location.reload(); });
1364
+ socket.addEventListener("close", function () { if (opened) { var w = window.bullseyeConnection.closed(reconnected); reconnected = true; window.bullseyeConnection.reconnecting(WHAT, w); setTimeout(awaitHost, w); } else if (reconnected) { var refused = window.bullseyeConnection.failed(); window.bullseyeConnection.reconnecting(WHAT, refused); setTimeout(awaitHost, refused); } else { window.bullseyeConnection.disconnected(WHAT, "the host did not accept the connection — reload this page to try again"); 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"; } });
1365
+ }
1340
1366
  function awaitHost() {
1341
- window.bullseyeConnection.reconnecting("this page's live connection to its host", 250);
1342
- document.getElementById("said").textContent = "⏳ This page's host is not answering — this page reloads the moment it does";
1343
- fetch("/__bullseye/health", { cache: "no-store" }).then(function (r) { if (r.ok) { window.bullseyeConnection.live(); location.reload(); } else if (r.status === 401) location.assign("/"); else setTimeout(awaitHost, 250); }, function () { setTimeout(awaitHost, 250); });
1367
+ window.bullseyeConnection.reconnecting(WHAT, 250);
1368
+ document.getElementById("said").textContent = "⏳ This page's host is not answering — this page reconnects the moment it does";
1369
+ fetch("/__bullseye/health", { cache: "no-store" }).then(function (r) { if (r.ok) { connect(); } else if (r.status === 401) location.assign("/"); else setTimeout(awaitHost, 250); }, function () { setTimeout(awaitHost, 250); });
1344
1370
  }
1345
- socket.addEventListener("open", function () {
1346
- opened = true;
1347
- fetch("/__bullseye/health", { cache: "no-store" }).then(function (r) { return r.json(); }).then(function (health) { if (health.pages[${JSON.stringify(page.name)}].live) location.reload(); });
1348
- });
1349
- socket.addEventListener("message", function (event) { if (JSON.parse(String(event.data)).type === "reload") location.reload(); });
1350
- socket.addEventListener("close", function () { if (opened) { window.bullseyeConnection.reconnecting("this page's live connection to its host", 0); awaitHost(); } else { window.bullseyeConnection.disconnected("this page's live connection to its host", "the host did not accept the connection — reload this page to try again"); 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"; } });
1371
+ connect();
1351
1372
  })();</script></body></html>`;
1352
1373
  }
1353
1374
  function codeDefect(err) {
@@ -365,7 +365,39 @@ const CONNECTION_SOURCE = String.raw `(function () {
365
365
  ticker = window.setInterval(paint, 1000);
366
366
  }
367
367
 
368
+ // GATE: a socket that drops sooner than this after opening counts as a failed attempt, so each retry waits twice as long and LIVE shows only once a socket has stayed up this long
369
+ var SETTLED_MS = 3000;
370
+ var drops = 0;
371
+ var openedAt = 0;
372
+
368
373
  window.bullseyeConnection = {
374
+ attempts: function () {
375
+ return drops;
376
+ },
377
+ forget: function () {
378
+ drops = 0;
379
+ },
380
+ failed: function () {
381
+ drops += 1;
382
+ return Math.min(250 * Math.pow(2, drops - 1), 30000);
383
+ },
384
+ opened: function (stillOpen, settle) {
385
+ openedAt = Date.now();
386
+ if (drops === 0) {
387
+ settle();
388
+ return;
389
+ }
390
+ window.setTimeout(function () {
391
+ if (stillOpen()) {
392
+ drops = 0;
393
+ settle();
394
+ }
395
+ }, SETTLED_MS);
396
+ },
397
+ closed: function (reopened) {
398
+ drops = reopened && Date.now() - openedAt < SETTLED_MS ? drops + 1 : 0;
399
+ return Math.min(250 * Math.pow(2, drops), 30000);
400
+ },
369
401
  reconnecting: function (what, retryInMs) {
370
402
  show("reconnecting", what, { retryAt: Date.now() + retryInMs });
371
403
  },
@@ -395,6 +427,7 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
395
427
  };
396
428
  var themeMissing = script.getAttribute("data-theme") === "missing";
397
429
  var stateKey = "bullseye-webhost:" + page;
430
+ var drawn = script.getAttribute("data-drawn");
398
431
  var socket = null;
399
432
  var queue = [];
400
433
  var acquired = false;
@@ -423,42 +456,71 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
423
456
  var WHAT = "this page's live connection to its service";
424
457
  // GATE: one health read is abandoned after this times the square of the tries so far (capped at 8000), then asked again
425
458
  var ANSWER_MS = 700;
459
+ // GATE: how long a reopened socket may stay connecting before it is given up and the host is asked again, times the give-ups in a row (capped at 30000)
460
+ var CONNECT_MS = 5000;
426
461
  var healthTries = 0;
427
462
  var lastHeard = Date.now();
428
- var gone = false;
463
+ var reconnects = 0;
429
464
 
430
465
  function hostGone() {
431
- if (gone) {
466
+ if (socket === null) {
432
467
  return;
433
468
  }
434
- gone = true;
435
- if (socket !== null) {
436
- socket.close();
437
- socket = null;
438
- }
469
+ var dropped = socket;
470
+ window.bullseyeConnection.forget();
471
+ socket = null;
472
+ dropped.close();
439
473
  awaitHost();
440
474
  }
441
475
 
476
+ function unreached(err) {
477
+ if (err.name === "AbortError") {
478
+ awaitHost();
479
+ } else if (err instanceof TypeError) {
480
+ window.setTimeout(awaitHost, 250);
481
+ } else {
482
+ window.bullseyeConnection.disconnected(WHAT, "the host answered its health read with something that is not its own reply — reload this page to try again");
483
+ }
484
+ }
485
+
486
+ function reconnectOrReload(health) {
487
+ if (health.pages === undefined) {
488
+ window.bullseyeConnection.disconnected(WHAT, "the host answered its health read with something that is not its own reply — reload this page to try again");
489
+ return;
490
+ }
491
+ var served = health.pages[page];
492
+ if (served === undefined || served.live !== true || served.drawn !== drawn || typeof window.bullseyeHello !== "function") {
493
+ window.location.reload();
494
+ return;
495
+ }
496
+ reconnects += 1;
497
+ open();
498
+ }
499
+
442
500
  function awaitHost() {
443
501
  window.bullseyeConnection.reconnecting(WHAT, 250);
444
502
  var asking = new AbortController();
445
503
  healthTries += 1;
446
- window.setTimeout(function () {
504
+ var abandon = window.setTimeout(function () {
447
505
  asking.abort();
448
506
  }, Math.min(ANSWER_MS * healthTries * healthTries, 8000));
449
507
  window.fetch("/__bullseye/health", { cache: "no-store", signal: asking.signal }).then(function (response) {
450
- healthTries = 0;
451
508
  if (response.ok) {
452
- window.bullseyeConnection.live();
453
- window.location.reload();
454
- } else if (response.status === 401) {
509
+ response.json().then(function (health) {
510
+ window.clearTimeout(abandon);
511
+ healthTries = 0;
512
+ reconnectOrReload(health);
513
+ }, unreached);
514
+ return;
515
+ }
516
+ window.clearTimeout(abandon);
517
+ healthTries = 0;
518
+ if (response.status === 401) {
455
519
  window.location.assign("/");
456
520
  } else {
457
521
  window.setTimeout(awaitHost, 250);
458
522
  }
459
- }, function () {
460
- window.setTimeout(awaitHost, 250);
461
- });
523
+ }, unreached);
462
524
  }
463
525
 
464
526
  function open() {
@@ -466,21 +528,46 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
466
528
  notice("__bullseye-theme-missing", "⚪ VS Code colours not captured yet — open the Bullseye tab in VS Code once and reload this page");
467
529
  }
468
530
  var scheme = window.location.protocol === "https:" ? "wss:" : "ws:";
469
- socket = new WebSocket(scheme + "//" + window.location.host + "/__bullseye/ws?page=" + encodeURIComponent(page) + "&at=" + encodeURIComponent(window.location.search) + (new URLSearchParams(window.location.search).get("bullseye-peek") === null ? "" : "&peek=1"));
531
+ var mine = new WebSocket(scheme + "//" + window.location.host + "/__bullseye/ws?page=" + encodeURIComponent(page) + "&at=" + encodeURIComponent(window.location.search) + "&drawn=" + encodeURIComponent(drawn) + (new URLSearchParams(window.location.search).get("bullseye-peek") === null ? "" : "&peek=1"));
532
+ socket = mine;
533
+ if (reconnects > 0) {
534
+ window.setTimeout(function () {
535
+ if (socket === mine && mine.readyState === 0) {
536
+ window.bullseyeConnection.failed();
537
+ socket = null;
538
+ mine.close();
539
+ awaitHost();
540
+ }
541
+ }, Math.min(CONNECT_MS * (window.bullseyeConnection.attempts() + 1), 30000));
542
+ }
470
543
  var opened = false;
471
- socket.addEventListener("open", function () {
544
+ var reopened = reconnects > 0;
545
+ mine.addEventListener("open", function () {
472
546
  opened = true;
547
+ lastHeard = Date.now();
548
+ lastBeat = lastHeard;
473
549
  if (typeof DecompressionStream === "function") {
474
- socket.send(JSON.stringify({ type: "packed" }));
550
+ mine.send(JSON.stringify({ type: "packed" }));
551
+ }
552
+ if (reconnects > 0) {
553
+ mine.send(JSON.stringify({ type: "message", message: window.bullseyeHello() }));
475
554
  }
476
555
  while (queue.length > 0) {
477
- socket.send(queue.shift());
556
+ mine.send(queue.shift());
557
+ }
558
+ if (reconnects > 0) {
559
+ window.bullseyeConnection.opened(function () {
560
+ return socket === mine && mine.readyState === 1;
561
+ }, window.bullseyeConnection.live);
478
562
  }
479
563
  });
480
- socket.binaryType = "blob";
564
+ mine.binaryType = "blob";
481
565
  var unpacking = Promise.resolve();
482
566
  var unpackingCount = 0;
483
- socket.addEventListener("message", function (event) {
567
+ mine.addEventListener("message", function (event) {
568
+ if (mine !== socket) {
569
+ return;
570
+ }
484
571
  lastHeard = Date.now();
485
572
  if (typeof event.data === "string" && unpackingCount === 0) {
486
573
  handle(event.data);
@@ -517,11 +604,21 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
517
604
  }
518
605
  }
519
606
  }
520
- socket.addEventListener("close", function () {
607
+ mine.addEventListener("close", function () {
608
+ if (mine !== socket) {
609
+ return;
610
+ }
521
611
  socket = null;
522
612
  if (opened) {
523
- window.bullseyeConnection.reconnecting(WHAT, 250);
524
- window.setTimeout(hostGone, 250);
613
+ var wait = window.bullseyeConnection.closed(reopened);
614
+ window.bullseyeConnection.reconnecting(WHAT, wait);
615
+ window.setTimeout(awaitHost, wait);
616
+ return;
617
+ }
618
+ if (reopened) {
619
+ var refusedWait = window.bullseyeConnection.failed();
620
+ window.bullseyeConnection.reconnecting(WHAT, refusedWait);
621
+ window.setTimeout(awaitHost, refusedWait);
525
622
  return;
526
623
  }
527
624
  window.fetch("/__bullseye/health", { cache: "no-store" }).then(function (response) {
@@ -534,7 +631,7 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
534
631
  });
535
632
  }
536
633
 
537
- // GATE: the page pings this often while visible; a socket a tunnel or a suspended phone tab cut sends no close, and one that hears nothing back goes to the reload path
634
+ // GATE: the page pings this often while visible; a socket a tunnel or a suspended phone tab cut sends no close, and one that hears nothing back is reopened in place
538
635
  var BEAT_MS = 20000;
539
636
  // GATE: a ping sent on being seen again must come back within this, or the page treats the socket as dead; the steady beat instead ends a socket that heard nothing for a whole beat
540
637
  var PING_ANSWER_MS = 1200;
@@ -542,7 +639,7 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
542
639
  var lastBeat = lastHeard;
543
640
 
544
641
  function beat() {
545
- if (gone || socket === null || socket.readyState !== 1) {
642
+ if (socket === null || socket.readyState !== 1) {
546
643
  return;
547
644
  }
548
645
  if (lastHeard < lastBeat) {
@@ -554,9 +651,6 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
554
651
  }
555
652
 
556
653
  function probe() {
557
- if (gone) {
558
- return;
559
- }
560
654
  if (socket === null || socket.readyState === 0) {
561
655
  return;
562
656
  }
@@ -565,9 +659,10 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
565
659
  return;
566
660
  }
567
661
  var asked = Date.now();
662
+ var asking = socket;
568
663
  socket.send('{"type":"ping"}');
569
664
  window.setTimeout(function () {
570
- if (lastHeard < asked) {
665
+ if (socket === asking && lastHeard < asked) {
571
666
  hostGone();
572
667
  }
573
668
  }, PING_ANSWER_MS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-notify-mcp",
3
- "version": "1.3.406",
3
+ "version": "1.3.407",
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",