omni-notify-mcp 1.3.426 → 1.3.427
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/gateway/chatPage.js +1 -2
- package/dist/gateway/terminalPage.js +12 -6
- package/dist/shared/agentSession.js +71 -30
- package/dist/shared/conversation/nativeTerminalWorker.js +2 -1
- package/dist/shared/conversation/terminalTransport.js +20 -0
- package/dist/shared/webhost/bullseyeWebHost.js +8 -0
- package/dist/shared/webhost/webviewShim.js +108 -101
- package/package.json +1 -1
package/dist/gateway/chatPage.js
CHANGED
|
@@ -74,8 +74,7 @@ label{display:block;margin:10px 0 4px;color:var(--mut);font-size:14px}
|
|
|
74
74
|
.facts th{color:var(--mut);white-space:nowrap;width:1%}
|
|
75
75
|
.facts thead th{font-weight:600;background:var(--agent);width:auto}
|
|
76
76
|
.facts .idrow{overflow:visible}.facts .conv-id{flex:1 1 0;white-space:normal;overflow:visible;overflow-wrap:anywhere}
|
|
77
|
-
#__bullseye-connection{position:static!important;order:-1
|
|
78
|
-
#__bullseye-connection button{width:40px!important;height:auto!important;min-height:0!important;align-self:stretch}
|
|
77
|
+
#__bullseye-connection{position:static!important;order:-1}
|
|
79
78
|
header{order:-2}
|
|
80
79
|
.convscroll{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
|
|
81
80
|
.conv{border-collapse:separate;border-spacing:0;font-size:14px;table-layout:fixed}
|
|
@@ -127,7 +127,8 @@ function sizePhone(){
|
|
|
127
127
|
document.body.classList.toggle("phone",phone);document.documentElement.style.setProperty("--k",String(phoneScale));
|
|
128
128
|
if(terminal&&terminal.options.fontSize!==Math.round(15*phoneScale)){terminal.options.fontSize=Math.round(15*phoneScale);refit();}
|
|
129
129
|
}
|
|
130
|
-
var view=0,sent={},listResize=null,terminal,fitAddon,socket,reconnect,observer,arrival=null,socketDown=false;
|
|
130
|
+
var view=0,sent={},listResize=null,terminal,fitAddon,socket=null,reconnect,observer,arrival=null,socketDown=false,lost=function(){},sender=Math.random().toString(36).slice(2)+Date.now().toString(36);
|
|
131
|
+
var heard=window.bullseyeConnection.watch(function(){return socket;},function(alive){alive.send('{"kind":"ping"}');},function(dead){lost(dead);});
|
|
131
132
|
sizePhone();window.addEventListener("resize",sizePhone);
|
|
132
133
|
if(window.visualViewport){var fitKeyboard=function(){document.body.style.height=phone?visualViewport.height+"px":"";};visualViewport.addEventListener("resize",fitKeyboard);fitKeyboard();}
|
|
133
134
|
var AGENTS = ${JSON.stringify(PROVIDER_CHOICES)};
|
|
@@ -151,7 +152,8 @@ function tool(id,icon,label,cls,brief){var b=el("button",cls,icon);b.id=id;b.app
|
|
|
151
152
|
|
|
152
153
|
function show(name,heading){
|
|
153
154
|
view++;
|
|
154
|
-
|
|
155
|
+
clearTimeout(reconnect);if(socket!==null){socket.onclose=null;socket.close();socket=null;}
|
|
156
|
+
if(name!=="terminal"){socketDown=false;if(!gatewayDown)window.bullseyeConnection.live();if(observer){observer.disconnect();observer=null;}document.getElementById("keybar").hidden=true;if(terminal){terminal.dispose();terminal=null;}main.style.display="";main.style.flexDirection="";}
|
|
155
157
|
title.textContent=heading;
|
|
156
158
|
var inList=name==="list";
|
|
157
159
|
btnBack.hidden=inList||name==="signin";
|
|
@@ -431,7 +433,7 @@ async function cliAttach(id,origin){
|
|
|
431
433
|
},true);
|
|
432
434
|
var keybar=document.getElementById("keybar"),ctrlHeld=false,ctrlKey=null;
|
|
433
435
|
function disarm(){ctrlHeld=false;ctrlKey.classList.remove("armed");}
|
|
434
|
-
var
|
|
436
|
+
var unacked=[],inputs=0,from=sender+"."+mine;function typed(body){inputs+=1;var sent={id:inputs,frame:JSON.stringify(Object.assign({kind:"input",from:from,id:inputs},body))};unacked.push(sent);if(socket!==null&&socket.readyState===WebSocket.OPEN)socket.send(sent.frame);}
|
|
435
437
|
function sendKey(data){if(ctrlHeld){disarm();data=ctrlBarSeq(data);}typed({data:data});}
|
|
436
438
|
keybar.replaceChildren();keybar.hidden=false;
|
|
437
439
|
KEY_BAR.slice(0,7).concat([{id:"ctrl",label:"Ctrl",title:"Ctrl (sticky)"}],KEY_BAR.slice(7)).forEach(function(key){
|
|
@@ -448,13 +450,17 @@ async function cliAttach(id,origin){
|
|
|
448
450
|
close.onclick=async function(){close.disabled=true;try{await api("DELETE","/v1/terminals/"+id);swap("list");}catch(error){close.disabled=false;fail(error);}};
|
|
449
451
|
observer.observe(host);
|
|
450
452
|
var WHAT="the terminal connection to the CLI",reattached=false;
|
|
453
|
+
function again(wait){socketDown=true;reattached=true;window.bullseyeConnection.reconnecting(WHAT,wait);liveFailed("reattaching to the same CLI…");reconnect=setTimeout(findCli,wait);}
|
|
454
|
+
function abandon(ws,wait){ws.onopen=ws.onmessage=ws.onclose=ws.onerror=null;ws.close();if(socket===ws)socket=null;again(wait);}
|
|
455
|
+
lost=function(ws){if(mine===view&&socket===ws)abandon(ws,window.bullseyeConnection.closed(reattached));};
|
|
451
456
|
function connect(){
|
|
452
457
|
if(mine!==view)return;
|
|
453
458
|
var ws=new WebSocket((location.protocol==="https:"?"wss://":"ws://")+location.host+"/v1/terminals/"+id+"/ws",["bn-terminal","bn-bearer."+token]);socket=ws;
|
|
454
459
|
var frames=Promise.resolve(),opened=false;
|
|
455
|
-
|
|
456
|
-
ws.
|
|
457
|
-
ws.
|
|
460
|
+
setTimeout(function(){if(mine===view&&socket===ws&&ws.readyState===WebSocket.CONNECTING)abandon(ws,window.bullseyeConnection.failed());},window.bullseyeConnection.limit());
|
|
461
|
+
ws.onopen=function(){if(mine!==view){ws.close();return;}opened=true;socketDown=false;heard();window.bullseyeConnection.opened(function(){return socket===ws&&ws.readyState===WebSocket.OPEN;},window.bullseyeConnection.live);term.options.disableStdin=false;refit();unacked.forEach(function(sent){ws.send(sent.frame);});term.focus();};
|
|
462
|
+
ws.onmessage=function(event){if(socket===ws)heard();var frame=JSON.parse(event.data);if(frame.pong)return;if(frame.ack!==undefined){unacked=unacked.filter(function(sent){return sent.id>frame.ack;});return;}frames=frames.then(async function(){if(mine!==view)return;if(frame.files){if(frame.error)liveNotice(frame.error,"error");else{sentPaths=sentPaths.concat(frame.paths);liveNotice("Sent to CLI: "+frame.paths.map(function(sent){return phone?base(sent):sent;}).join(" · "));}return;}if(frame.error){liveNotice(frame.error,"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);cli.provider=frame.provider;cli.project=frame.project;liveRead();if(frame.ended)liveEnded("CLI ended"+(frame.failure?" · "+frame.failure:""));else if(frame.failure&&frame.failure!==cli.failure)liveNotice(frame.failure,"error");cli.failure=frame.failure;}).catch(fail);};
|
|
463
|
+
ws.onclose=function(event){if(mine!==view)return;var ending=event.code===1000||(event.code===1008&&event.reason==="Sign in again");if(ending){term.options.disableStdin=true;unacked=[];}if(event.code===1000){socketDown=false;window.bullseyeConnection.live();liveEnded("CLI ended");return;}if(event.code===1008&&event.reason==="Sign in again"){socketDown=false;window.bullseyeConnection.live();signIn("Your sign-in expired. Sign in again to return to this CLI.");return;}again(opened?window.bullseyeConnection.closed(reattached):window.bullseyeConnection.failed());};
|
|
458
464
|
ws.onerror=function(){socketDown=true;liveFailed("reattaching to the same CLI…");};
|
|
459
465
|
}
|
|
460
466
|
// GATE: a reattach's read of its CLI that has not answered in this long is abandoned and asked again with backoff, so a dead link never leaves the page waiting on it
|
|
@@ -4957,11 +4957,11 @@ function readingTranscript(transcript, read) {
|
|
|
4957
4957
|
// GATE: how many bytes of a transcript one backward read takes while it looks for the last assistant record — the reads go on to the file's start, so nothing is ever left unread
|
|
4958
4958
|
const TRANSCRIPT_READ_BYTES = 64 * 1024;
|
|
4959
4959
|
/**
|
|
4960
|
-
*
|
|
4961
|
-
*
|
|
4962
|
-
*
|
|
4960
|
+
* A session's records of the given types, newest first, until `visit` answers: read backward from the end, a block at a time, so a session of
|
|
4961
|
+
* tens of megabytes costs one block on a beat; a line cut at a block's start is carried into the next read, and the last line Claude Code is
|
|
4962
|
+
* still appending says nothing yet.
|
|
4963
4963
|
*/
|
|
4964
|
-
function
|
|
4964
|
+
function fromTranscriptEnd(transcript, types, visit) {
|
|
4965
4965
|
const fd = fs.openSync(transcript, "r");
|
|
4966
4966
|
try {
|
|
4967
4967
|
let at = fs.fstatSync(fd).size;
|
|
@@ -4975,35 +4975,64 @@ function turnCutOff(transcript) {
|
|
|
4975
4975
|
const first = text.indexOf(0x0a);
|
|
4976
4976
|
carry = at > 0 && first >= 0 ? text.subarray(0, first) : at > 0 ? text : Buffer.alloc(0);
|
|
4977
4977
|
const whole = at > 0 ? (first >= 0 ? text.subarray(first + 1) : Buffer.alloc(0)) : text;
|
|
4978
|
-
const
|
|
4979
|
-
|
|
4980
|
-
|
|
4978
|
+
for (const line of whole.toString("utf8").split("\n").reverse()) {
|
|
4979
|
+
if (!types.some((t) => line.includes(`"type":"${t}"`)))
|
|
4980
|
+
continue;
|
|
4981
|
+
let record;
|
|
4982
|
+
try {
|
|
4983
|
+
record = JSON.parse(line);
|
|
4984
|
+
}
|
|
4985
|
+
catch (err) {
|
|
4986
|
+
if (!(err instanceof SyntaxError))
|
|
4987
|
+
throw err;
|
|
4988
|
+
// OWNER: ITER/LOOP — Claude Code is mid-append to its last line: that line says nothing yet, and the one before it is read.
|
|
4989
|
+
continue;
|
|
4990
|
+
}
|
|
4991
|
+
if (!types.includes(record.type))
|
|
4992
|
+
continue;
|
|
4993
|
+
const answer = visit(record);
|
|
4994
|
+
// NULL-OK: field answer is OPTIONAL and therefore it is ok to check for NULL
|
|
4995
|
+
if (answer !== undefined)
|
|
4996
|
+
return answer;
|
|
4997
|
+
}
|
|
4981
4998
|
}
|
|
4982
|
-
return
|
|
4999
|
+
return undefined;
|
|
4983
5000
|
}
|
|
4984
5001
|
finally {
|
|
4985
5002
|
fs.closeSync(fd);
|
|
4986
5003
|
}
|
|
4987
5004
|
}
|
|
4988
|
-
/**
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5005
|
+
/** 🔴 #4162 — whether a session's last assistant record stopped on a tool call (`stop_reason: "tool_use"`) it never saw answered: its process was killed mid-work. */
|
|
5006
|
+
const turnCutOff = (transcript) => fromTranscriptEnd(transcript, ["assistant"], (r) => r.type === "assistant" && r.message.stop_reason === "tool_use") === true;
|
|
5007
|
+
/** 🔴 #187 — the steps of a session's message queue that take a message off it: handed to the next turn, or folded into the turn that runs. */
|
|
5008
|
+
const QUEUE_TAKES = new Set(["dequeue", "remove"]);
|
|
5009
|
+
/**
|
|
5010
|
+
* 🔴 #187 — whether a message waits to start the job's next turn. Claude Code's record counts one (`inFlight.queued`), but that count stays above
|
|
5011
|
+
* zero after the message it counted was taken, which held settled workers at their prompts for hours; so the session's own transcript decides:
|
|
5012
|
+
* a message waits only while an enqueue logged after its last reply has no take after it. A record with no transcript to read, or a queue step
|
|
5013
|
+
* this reading does not know, keeps the record's own count.
|
|
5014
|
+
*/
|
|
5015
|
+
function messageArriving(job) {
|
|
5016
|
+
// NULL-OK: field inFlight is OPTIONAL and therefore it is ok to check for NULL
|
|
5017
|
+
if (job.inFlight === undefined || job.inFlight.queued === 0)
|
|
5018
|
+
return false;
|
|
5019
|
+
const transcript = job.linkScanPath;
|
|
5020
|
+
// NULL-OK: field linkScanPath is OPTIONAL and therefore it is ok to check for NULL
|
|
5021
|
+
if (transcript === undefined || readingTranscript(transcript, () => mtimeOf(transcript)) === undefined)
|
|
5022
|
+
return true;
|
|
5023
|
+
let taken = 0;
|
|
5024
|
+
return readingTranscript(transcript, () => fromTranscriptEnd(transcript, ["assistant", "queue-operation"], (r) => {
|
|
5025
|
+
if (r.type === "assistant")
|
|
5026
|
+
return false;
|
|
5027
|
+
if (QUEUE_TAKES.has(r.operation)) {
|
|
5028
|
+
taken += 1;
|
|
5029
|
+
return undefined;
|
|
5002
5030
|
}
|
|
5003
|
-
if (
|
|
5004
|
-
return
|
|
5005
|
-
|
|
5006
|
-
|
|
5031
|
+
if (r.operation !== "enqueue" || taken === 0)
|
|
5032
|
+
return true;
|
|
5033
|
+
taken -= 1;
|
|
5034
|
+
return undefined;
|
|
5035
|
+
})) === true;
|
|
5007
5036
|
}
|
|
5008
5037
|
/** 🔴 #4123 — a job's last whole timeline step, which ends `failed` for a provider's refusal and mid-work for a job killed with the daemon, and whether a step after it is caught mid-append. */
|
|
5009
5038
|
function lastTimelineStep(jobId, home) {
|
|
@@ -5043,7 +5072,7 @@ function timelineStepOf(line) {
|
|
|
5043
5072
|
const TURN_OVER = new Set(["done", "blocked", "stopped"]);
|
|
5044
5073
|
/** 🔴 #4123 — whether a job still has background tasks of its own running. 🔴 #4499 — a message queued to a job stopped on Meni waits behind that stop and is no task of its own; its own tasks still are. */
|
|
5045
5074
|
// NULL-OK: field inFlight is OPTIONAL and therefore it is ok to check for NULL
|
|
5046
|
-
const waitsOnTasks = (job) => job.inFlight !== undefined && job.inFlight.tasks +
|
|
5075
|
+
const waitsOnTasks = (job) => job.inFlight !== undefined && (job.inFlight.tasks + job.inFlight.drainableMonitors > 0 || (!waitsOnMeni(job) && messageArriving(job)));
|
|
5047
5076
|
/** 🔴 #4215 — whether a job has a subagent of its own running: a local agent among its in-flight tasks (its `fan` keeps the finished ones, so it says nothing of what runs now); a record that names no kinds cannot say, so any task it counts is taken as one. */
|
|
5048
5077
|
const runsSubagent = (job) => {
|
|
5049
5078
|
// NULL-OK: field inFlight is OPTIONAL and therefore it is ok to check for NULL
|
|
@@ -5059,8 +5088,8 @@ const runsSubagent = (job) => {
|
|
|
5059
5088
|
*/
|
|
5060
5089
|
const worksNow = (job) => {
|
|
5061
5090
|
// NULL-OK: field inFlight is OPTIONAL and therefore it is ok to check for NULL
|
|
5062
|
-
const
|
|
5063
|
-
return runsSubagent(job) || (!waitsOnMeni(job) && (
|
|
5091
|
+
const draining = job.inFlight !== undefined && job.inFlight.drainableMonitors > 0;
|
|
5092
|
+
return runsSubagent(job) || (!waitsOnMeni(job) && (draining || (!TURN_OVER.has(job.state) && job.tempo !== "idle") || messageArriving(job)));
|
|
5064
5093
|
};
|
|
5065
5094
|
/** 🔴 #4499 — a job stopped on Meni: its turn ended on an act it cannot do itself, or it sits mid-turn on a prompt (a question, a permission) that nobody at a background session's terminal answers; a message queued to it waits behind that stop and is no work. */
|
|
5066
5095
|
const waitsOnMeni = (job) => job.state === "blocked" || job.tempo === "blocked";
|
|
@@ -5220,7 +5249,19 @@ export function parkedDaemonWorkers(home = claudeHome()) {
|
|
|
5220
5249
|
return [];
|
|
5221
5250
|
return [...held].filter(([jobId]) => {
|
|
5222
5251
|
const job = jobRecordOf(jobId, home);
|
|
5223
|
-
|
|
5252
|
+
if (job === "gone")
|
|
5253
|
+
return true;
|
|
5254
|
+
if (job === "torn" || !TURN_OVER.has(job.state))
|
|
5255
|
+
return false;
|
|
5256
|
+
try {
|
|
5257
|
+
return !waitsOnTasks(job);
|
|
5258
|
+
}
|
|
5259
|
+
catch (err) {
|
|
5260
|
+
if (!(err instanceof TranscriptRefused))
|
|
5261
|
+
throw err;
|
|
5262
|
+
// OWNER: ITER/LOOP — the disk refused this one worker's transcript, so whether a message waits for it is not known this beat: it is not stopped, and the next beat reads it again.
|
|
5263
|
+
return false;
|
|
5264
|
+
}
|
|
5224
5265
|
}).map(([jobId, worker]) => ({ jobId, worker }));
|
|
5225
5266
|
}
|
|
5226
5267
|
/** 🔴 #4190 — why a stop is not taken: when Claude Code's daemon (pid in `daemon.lock`) is itself refused a signal, it runs at a higher privilege than this process, and so does every background session under it; only the resident FleetView server, started at that same privilege, ends them (FleetView's `stopSession`). Empty when the daemon is reachable. */
|
|
@@ -149,7 +149,8 @@ process.on("message", (message) => {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
else if (message.kind === "resize") {
|
|
152
|
-
terminal
|
|
152
|
+
if (terminal && alive(terminal.pid))
|
|
153
|
+
terminal.resize(message.cols, message.rows);
|
|
153
154
|
send({ kind: "resized", cols: message.cols, rows: message.rows });
|
|
154
155
|
}
|
|
155
156
|
else if (message.kind === "close")
|
|
@@ -10,6 +10,13 @@ export function dimensions(body) {
|
|
|
10
10
|
export function validFiles(files) {
|
|
11
11
|
return Array.isArray(files) && files.length > 0 && !files.some((file) => !file || typeof file.name !== "string" || typeof file.data !== "string" || (file.data.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(file.data)));
|
|
12
12
|
}
|
|
13
|
+
const PING = '{"kind":"ping"}', PONG = '{"pong":true}';
|
|
14
|
+
const INPUTS_SEEN = new WeakMap();
|
|
15
|
+
function inputsSeen(terminal) {
|
|
16
|
+
if (!INPUTS_SEEN.has(terminal))
|
|
17
|
+
INPUTS_SEEN.set(terminal, new Map());
|
|
18
|
+
return INPUTS_SEEN.get(terminal);
|
|
19
|
+
}
|
|
13
20
|
export function attachTerminalSocket(ws, terminal, access) {
|
|
14
21
|
const detach = terminal.attach();
|
|
15
22
|
const disconnected = new AbortController();
|
|
@@ -25,6 +32,10 @@ export function attachTerminalSocket(ws, terminal, access) {
|
|
|
25
32
|
};
|
|
26
33
|
let input = Promise.resolve();
|
|
27
34
|
ws.on("message", (data, binary) => {
|
|
35
|
+
if (!binary && data.toString() === PING) {
|
|
36
|
+
ws.send(PONG);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
28
39
|
input = input.then(async () => {
|
|
29
40
|
if (!access.admitted()) {
|
|
30
41
|
ws.close(1008, "Sign in again");
|
|
@@ -41,6 +52,15 @@ export function attachTerminalSocket(ws, terminal, access) {
|
|
|
41
52
|
const size = dimensions(body);
|
|
42
53
|
await terminal.resize(size.cols, size.rows);
|
|
43
54
|
}
|
|
55
|
+
else if (body.kind === "input" && typeof body.data === "string" && typeof body.from === "string" && Number.isInteger(body.id)) {
|
|
56
|
+
const seen = inputsSeen(terminal);
|
|
57
|
+
if (!seen.has(body.from) || seen.get(body.from) < body.id) {
|
|
58
|
+
seen.set(body.from, body.id);
|
|
59
|
+
await terminal.input(body.data, body.binary === true);
|
|
60
|
+
}
|
|
61
|
+
if (ws.readyState === WebSocket.OPEN)
|
|
62
|
+
ws.send(JSON.stringify({ ack: body.id }));
|
|
63
|
+
}
|
|
44
64
|
else if (body.kind === "input" && typeof body.data === "string")
|
|
45
65
|
await terminal.input(body.data, body.binary === true);
|
|
46
66
|
else if (body.kind === "files") {
|
|
@@ -549,6 +549,7 @@ class Page {
|
|
|
549
549
|
this.mirror = undefined;
|
|
550
550
|
this.sockets = new Set();
|
|
551
551
|
this.drawing = 0;
|
|
552
|
+
this.lastFrom = new Map();
|
|
552
553
|
}
|
|
553
554
|
/** 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. */
|
|
554
555
|
get drawn() {
|
|
@@ -628,6 +629,13 @@ class Page {
|
|
|
628
629
|
if (frame === null || frame.type !== "message" || this.mirror === undefined) {
|
|
629
630
|
return;
|
|
630
631
|
}
|
|
632
|
+
if (typeof frame.sender === "string" && Number.isInteger(frame.id)) {
|
|
633
|
+
writeFrame(socket, `{"type":"ack","id":${frame.id}}`);
|
|
634
|
+
if (this.lastFrom.has(frame.sender) && this.lastFrom.get(frame.sender) >= frame.id) {
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
this.lastFrom.set(frame.sender, frame.id);
|
|
638
|
+
}
|
|
631
639
|
const mirror = this.mirror;
|
|
632
640
|
const hello = saysHello(frame);
|
|
633
641
|
if (hello) {
|
|
@@ -266,15 +266,14 @@ const CONNECTION_SOURCE = String.raw `(function () {
|
|
|
266
266
|
if (window.bullseyeConnection !== undefined) {
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
|
-
var
|
|
269
|
+
var BAR = "__bullseye-connection";
|
|
270
270
|
var MARKS = { reconnecting: "🔄 RECONNECTING", live: "✅ LIVE" };
|
|
271
271
|
var COLOURS = { reconnecting: "#7a5200", live: "#1d5a2c" };
|
|
272
272
|
var current = null;
|
|
273
273
|
var ticker = 0;
|
|
274
274
|
var clearer = 0;
|
|
275
275
|
var pending = 0;
|
|
276
|
-
|
|
277
|
-
// GATE: a drop that comes back within this shows nothing at all; only a connection still down after it is covered with RECONNECTING
|
|
276
|
+
// GATE: a drop that comes back within this shows nothing at all; only a connection still down after it shows the RECONNECTING bar
|
|
278
277
|
var GRACE_MS = 1500;
|
|
279
278
|
|
|
280
279
|
function clock(at) {
|
|
@@ -292,40 +291,29 @@ const CONNECTION_SOURCE = String.raw `(function () {
|
|
|
292
291
|
return lines.join("\n");
|
|
293
292
|
}
|
|
294
293
|
|
|
295
|
-
function
|
|
296
|
-
var found = document.getElementById(
|
|
294
|
+
function bar() {
|
|
295
|
+
var found = document.getElementById(BAR);
|
|
297
296
|
if (found !== null) {
|
|
298
297
|
return found;
|
|
299
298
|
}
|
|
300
299
|
found = document.createElement("div");
|
|
301
|
-
found.id =
|
|
302
|
-
found.setAttribute("role", "
|
|
300
|
+
found.id = BAR;
|
|
301
|
+
found.setAttribute("role", "status");
|
|
302
|
+
found.setAttribute("aria-live", "polite");
|
|
303
303
|
found.setAttribute("data-be-notice", "own");
|
|
304
|
-
found.style.cssText = "position:
|
|
305
|
-
var word = document.createElement("
|
|
304
|
+
found.style.cssText = "position:sticky;top:0;z-index:1;flex:none;box-sizing:border-box;width:100%;min-height:20px;padding:1px 8px;display:flex;align-items:center;justify-content:center";
|
|
305
|
+
var word = document.createElement("span");
|
|
306
306
|
word.className = "__bullseye-notice-text";
|
|
307
|
-
word.style.cssText = "
|
|
307
|
+
word.style.cssText = "font:700 12px/18px system-ui,sans-serif;color:#fff;cursor:help";
|
|
308
308
|
found.appendChild(word);
|
|
309
|
-
document.body.
|
|
309
|
+
document.body.insertBefore(found, document.body.firstChild);
|
|
310
310
|
return found;
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
function stillThePage(shown) {
|
|
314
|
-
if (document.activeElement !== null && document.activeElement !== document.body) {
|
|
315
|
-
document.activeElement.blur();
|
|
316
|
-
}
|
|
317
|
-
Array.prototype.forEach.call(document.body.children, function (el) {
|
|
318
|
-
if (el !== shown && !el.inert) {
|
|
319
|
-
el.inert = true;
|
|
320
|
-
stilled.push(el);
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
|
|
325
313
|
function paint() {
|
|
326
|
-
var shown =
|
|
314
|
+
var shown = bar();
|
|
327
315
|
var word = shown.firstChild;
|
|
328
|
-
|
|
316
|
+
shown.style.background = COLOURS[current.state];
|
|
329
317
|
var mark = MARKS[current.state];
|
|
330
318
|
if (word.textContent !== mark) {
|
|
331
319
|
word.textContent = mark;
|
|
@@ -334,16 +322,13 @@ const CONNECTION_SOURCE = String.raw `(function () {
|
|
|
334
322
|
if (word.getAttribute("data-be-tip") !== tip) {
|
|
335
323
|
word.setAttribute("data-be-tip", tip);
|
|
336
324
|
}
|
|
337
|
-
stillThePage(shown);
|
|
338
325
|
}
|
|
339
326
|
|
|
340
327
|
function release() {
|
|
341
|
-
var shown = document.getElementById(
|
|
328
|
+
var shown = document.getElementById(BAR);
|
|
342
329
|
if (shown !== null) {
|
|
343
330
|
shown.remove();
|
|
344
331
|
}
|
|
345
|
-
stilled.forEach(function (el) { el.inert = false; });
|
|
346
|
-
stilled = [];
|
|
347
332
|
current = null;
|
|
348
333
|
}
|
|
349
334
|
|
|
@@ -358,12 +343,70 @@ const CONNECTION_SOURCE = String.raw `(function () {
|
|
|
358
343
|
|
|
359
344
|
// 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
|
|
360
345
|
var SETTLED_MS = 3000;
|
|
346
|
+
// GATE: how long a socket may stay connecting, or its sign-in check go unanswered, before it is given up and asked again, times the give-ups in a row (capped at 30000)
|
|
347
|
+
var CONNECT_MS = 5000;
|
|
348
|
+
// 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
|
|
349
|
+
var BEAT_MS = 20000;
|
|
350
|
+
// 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
|
|
351
|
+
var PING_ANSWER_MS = 2500;
|
|
361
352
|
var drops = 0;
|
|
362
353
|
var openedAt = 0;
|
|
363
354
|
|
|
364
355
|
window.bullseyeConnection = {
|
|
365
|
-
|
|
366
|
-
return drops;
|
|
356
|
+
limit: function () {
|
|
357
|
+
return Math.min(CONNECT_MS * (drops + 1), 30000);
|
|
358
|
+
},
|
|
359
|
+
watch: function (socketNow, ping, dead) {
|
|
360
|
+
var lastHeard = Date.now();
|
|
361
|
+
var lastBeat = lastHeard;
|
|
362
|
+
function beat() {
|
|
363
|
+
var socket = socketNow();
|
|
364
|
+
if (socket === null || socket.readyState !== 1) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
if (lastHeard < lastBeat) {
|
|
368
|
+
dead(socket);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
lastBeat = Date.now();
|
|
372
|
+
ping(socket);
|
|
373
|
+
}
|
|
374
|
+
function probe() {
|
|
375
|
+
var asking = socketNow();
|
|
376
|
+
if (asking === null || asking.readyState === 0) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
if (asking.readyState !== 1) {
|
|
380
|
+
dead(asking);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
var asked = Date.now();
|
|
384
|
+
ping(asking);
|
|
385
|
+
window.setTimeout(function () {
|
|
386
|
+
if (socketNow() === asking && lastHeard < asked) {
|
|
387
|
+
dead(asking);
|
|
388
|
+
}
|
|
389
|
+
}, PING_ANSWER_MS);
|
|
390
|
+
}
|
|
391
|
+
window.setInterval(function () {
|
|
392
|
+
if (document.visibilityState === "visible") {
|
|
393
|
+
beat();
|
|
394
|
+
}
|
|
395
|
+
}, BEAT_MS);
|
|
396
|
+
document.addEventListener("visibilitychange", function () {
|
|
397
|
+
if (document.visibilityState === "visible") {
|
|
398
|
+
probe();
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
window.addEventListener("pageshow", function (event) {
|
|
402
|
+
if (event.persisted) {
|
|
403
|
+
probe();
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
window.addEventListener("online", probe);
|
|
407
|
+
return function heard() {
|
|
408
|
+
lastHeard = Date.now();
|
|
409
|
+
};
|
|
367
410
|
},
|
|
368
411
|
forget: function () {
|
|
369
412
|
drops = 0;
|
|
@@ -374,6 +417,8 @@ const CONNECTION_SOURCE = String.raw `(function () {
|
|
|
374
417
|
},
|
|
375
418
|
opened: function (stillOpen, settle) {
|
|
376
419
|
openedAt = Date.now();
|
|
420
|
+
window.clearTimeout(pending);
|
|
421
|
+
pending = 0;
|
|
377
422
|
if (drops === 0) {
|
|
378
423
|
settle();
|
|
379
424
|
return;
|
|
@@ -433,7 +478,9 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
|
|
|
433
478
|
var stateKey = "bullseye-webhost:" + page;
|
|
434
479
|
var drawn = script.getAttribute("data-drawn");
|
|
435
480
|
var socket = null;
|
|
436
|
-
var
|
|
481
|
+
var sender = Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
482
|
+
var numbered = 0;
|
|
483
|
+
var unacked = [];
|
|
437
484
|
var acquired = false;
|
|
438
485
|
var state = readState();
|
|
439
486
|
window.bullseyeWebUi = true;
|
|
@@ -444,18 +491,25 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
|
|
|
444
491
|
}
|
|
445
492
|
|
|
446
493
|
function frameOf(message) {
|
|
447
|
-
|
|
494
|
+
numbered += 1;
|
|
495
|
+
var hello = typeof window.bullseyeHello === "function" && JSON.stringify(message) === JSON.stringify(window.bullseyeHello());
|
|
496
|
+
return { id: numbered, hello: hello, text: JSON.stringify({ type: "message", message: message, hello: hello, sender: sender, id: numbered }) };
|
|
448
497
|
}
|
|
449
498
|
|
|
450
499
|
function send(message) {
|
|
451
500
|
var frame = frameOf(message);
|
|
501
|
+
unacked.push(frame);
|
|
452
502
|
if (socket !== null && socket.readyState === 1) {
|
|
453
|
-
socket.send(frame);
|
|
454
|
-
} else {
|
|
455
|
-
queue.push(frame);
|
|
503
|
+
socket.send(frame.text);
|
|
456
504
|
}
|
|
457
505
|
}
|
|
458
506
|
|
|
507
|
+
function acked(id) {
|
|
508
|
+
unacked = unacked.filter(function (frame) {
|
|
509
|
+
return frame.id > id;
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
|
|
459
513
|
function deliver(message) {
|
|
460
514
|
window.dispatchEvent(new MessageEvent("message", { data: message, origin: window.location.origin }));
|
|
461
515
|
}
|
|
@@ -464,10 +518,7 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
|
|
|
464
518
|
var WHAT = "this page's live connection to its service";
|
|
465
519
|
// GATE: one health read is abandoned after this times the square of the tries so far (capped at 8000), then asked again
|
|
466
520
|
var ANSWER_MS = 700;
|
|
467
|
-
// GATE: how long a socket may stay connecting, or its sign-in check go unanswered, before it is given up and asked again, times the give-ups in a row (capped at 30000)
|
|
468
|
-
var CONNECT_MS = 5000;
|
|
469
521
|
var healthTries = 0;
|
|
470
|
-
var lastHeard = Date.now();
|
|
471
522
|
var reconnects = 0;
|
|
472
523
|
|
|
473
524
|
function hostGone() {
|
|
@@ -549,20 +600,22 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
|
|
|
549
600
|
mine.close();
|
|
550
601
|
notAccepted(reopened);
|
|
551
602
|
}
|
|
552
|
-
},
|
|
603
|
+
}, window.bullseyeConnection.limit());
|
|
553
604
|
mine.addEventListener("open", function () {
|
|
554
605
|
opened = true;
|
|
555
|
-
|
|
556
|
-
lastBeat = lastHeard;
|
|
606
|
+
heard();
|
|
557
607
|
if (typeof DecompressionStream === "function") {
|
|
558
608
|
mine.send(JSON.stringify({ type: "packed" }));
|
|
559
609
|
}
|
|
560
610
|
if (reconnects > 0) {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
611
|
+
unacked = unacked.filter(function (frame) {
|
|
612
|
+
return !frame.hello;
|
|
613
|
+
});
|
|
614
|
+
unacked.push(frameOf(window.bullseyeHello()));
|
|
565
615
|
}
|
|
616
|
+
unacked.forEach(function (frame) {
|
|
617
|
+
mine.send(frame.text);
|
|
618
|
+
});
|
|
566
619
|
window.bullseyeConnection.opened(function () {
|
|
567
620
|
return socket === mine && mine.readyState === 1;
|
|
568
621
|
}, window.bullseyeConnection.live);
|
|
@@ -574,7 +627,7 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
|
|
|
574
627
|
if (mine !== socket) {
|
|
575
628
|
return;
|
|
576
629
|
}
|
|
577
|
-
|
|
630
|
+
heard();
|
|
578
631
|
if (typeof event.data === "string" && unpackingCount === 0) {
|
|
579
632
|
handle(event.data);
|
|
580
633
|
return;
|
|
@@ -598,6 +651,8 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
|
|
|
598
651
|
var frame = JSON.parse(text);
|
|
599
652
|
if (frame.type === "post") {
|
|
600
653
|
deliver(frame.message);
|
|
654
|
+
} else if (frame.type === "ack") {
|
|
655
|
+
acked(frame.id);
|
|
601
656
|
} else if (frame.type === "reload") {
|
|
602
657
|
window.location.reload();
|
|
603
658
|
} else if (frame.type === "failed") {
|
|
@@ -632,7 +687,7 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
|
|
|
632
687
|
}
|
|
633
688
|
|
|
634
689
|
function openUnlessSignedOut() {
|
|
635
|
-
window.fetch("/__bullseye/health", { cache: "no-store", signal: AbortSignal.timeout(
|
|
690
|
+
window.fetch("/__bullseye/health", { cache: "no-store", signal: AbortSignal.timeout(window.bullseyeConnection.limit()) }).then(function (response) {
|
|
636
691
|
if (response.status === 401) {
|
|
637
692
|
window.bullseyeConnection.signInAgain();
|
|
638
693
|
} else {
|
|
@@ -643,59 +698,11 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
|
|
|
643
698
|
});
|
|
644
699
|
}
|
|
645
700
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
var lastBeat = lastHeard;
|
|
652
|
-
|
|
653
|
-
function beat() {
|
|
654
|
-
if (socket === null || socket.readyState !== 1) {
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
if (lastHeard < lastBeat) {
|
|
658
|
-
hostGone();
|
|
659
|
-
return;
|
|
660
|
-
}
|
|
661
|
-
lastBeat = Date.now();
|
|
662
|
-
socket.send('{"type":"ping"}');
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
function probe() {
|
|
666
|
-
if (socket === null || socket.readyState === 0) {
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
if (socket.readyState !== 1) {
|
|
670
|
-
hostGone();
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
var asked = Date.now();
|
|
674
|
-
var asking = socket;
|
|
675
|
-
socket.send('{"type":"ping"}');
|
|
676
|
-
window.setTimeout(function () {
|
|
677
|
-
if (socket === asking && lastHeard < asked) {
|
|
678
|
-
hostGone();
|
|
679
|
-
}
|
|
680
|
-
}, PING_ANSWER_MS);
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
window.setInterval(function () {
|
|
684
|
-
if (document.visibilityState === "visible") {
|
|
685
|
-
beat();
|
|
686
|
-
}
|
|
687
|
-
}, BEAT_MS);
|
|
688
|
-
document.addEventListener("visibilitychange", function () {
|
|
689
|
-
if (document.visibilityState === "visible") {
|
|
690
|
-
probe();
|
|
691
|
-
}
|
|
692
|
-
});
|
|
693
|
-
window.addEventListener("pageshow", function (event) {
|
|
694
|
-
if (event.persisted) {
|
|
695
|
-
probe();
|
|
696
|
-
}
|
|
697
|
-
});
|
|
698
|
-
window.addEventListener("online", probe);
|
|
701
|
+
var heard = window.bullseyeConnection.watch(function () {
|
|
702
|
+
return socket;
|
|
703
|
+
}, function (alive) {
|
|
704
|
+
alive.send('{"type":"ping"}');
|
|
705
|
+
}, hostGone);
|
|
699
706
|
|
|
700
707
|
window.acquireVsCodeApi = function () {
|
|
701
708
|
if (acquired) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-notify-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.427",
|
|
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",
|