omni-notify-mcp 1.3.441 → 1.3.443
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
CHANGED
|
@@ -204,6 +204,7 @@ function agoSpan(at) { var span = el("span", "ago", ago(at) + " ago"); span.data
|
|
|
204
204
|
function tickAges() { document.querySelectorAll("[data-ago]").forEach(function (span) { var old = ago(Number(span.dataset.ago)) + " ago"; if (span.textContent !== old) span.textContent = old; }); }
|
|
205
205
|
function aged(before, at, after) { var words = el("span"); words.append(before, agoSpan(at), after || ""); return words; }
|
|
206
206
|
function plainWhy(err) { return err instanceof TypeError ? "no connection to BN" : err.message; }
|
|
207
|
+
async function told(response) { if (response.status !== 502 && response.status !== 504 && /json/.test(response.headers.get("content-type") || "")) return response.json(); var gone = Error("BN is not answering (HTTP " + response.status + ")"); gone.status = response.status; throw gone; }
|
|
207
208
|
function factsTable(rows) {
|
|
208
209
|
var table = el("table", "facts");
|
|
209
210
|
rows.forEach(function (row) { var tr = el("tr"), value = el("td"); if (row[1] instanceof Node) value.append(row[1]); else value.textContent = row[1]; tr.append(el("th", "", row[0]), value); table.append(tr); });
|
|
@@ -309,7 +310,7 @@ async function signIn(notice) {
|
|
|
309
310
|
token = "";
|
|
310
311
|
btnLogout.disabled = false;
|
|
311
312
|
var door;
|
|
312
|
-
try { door = await (await fetch("/passkey/state"))
|
|
313
|
+
try { door = await told(await fetch("/passkey/state")); }
|
|
313
314
|
catch (e) {
|
|
314
315
|
if (mine !== view) return;
|
|
315
316
|
window.bullseyeConnection.reconnecting("this page's connection to BN", RECHECK_MS);
|
|
@@ -910,8 +911,8 @@ async function home() {
|
|
|
910
911
|
try {
|
|
911
912
|
var res = await fetch("/screen/open", { method: "POST", headers: { authorization: "Bearer " + token } });
|
|
912
913
|
if (res.status === 401) { signIn("You are signed out. Sign in again."); return; }
|
|
913
|
-
if (!res.ok) throw new Error("The gateway answered " + res.status + ": " + await res.text());
|
|
914
|
-
var opened = await res
|
|
914
|
+
if (!res.ok && res.status !== 502 && res.status !== 504) throw new Error("The gateway answered " + res.status + ": " + await res.text());
|
|
915
|
+
var opened = await told(res);
|
|
915
916
|
liveRead();
|
|
916
917
|
if (mine === view) {
|
|
917
918
|
var back = sessionStorage.getItem("bullseye-return-to");
|
|
@@ -106,8 +106,8 @@ async function call(method, path, body) {
|
|
|
106
106
|
try { r = await fetch(path, { method: method, headers: scoped({ authorization: "Bearer " + token, "content-type": "application/json" }), body: body === undefined ? undefined : JSON.stringify(body) }); }
|
|
107
107
|
catch (e) { window.bullseyeConnection.reconnecting("this page's connection to the Notify service", location.pathname.indexOf("public-access") >= 0 ? 2000 : REFRESH_MS); throw e; }
|
|
108
108
|
if (r.status >= 502) window.bullseyeConnection.reconnecting("this page's connection to the Notify service (HTTP " + r.status + ")", location.pathname.indexOf("public-access") >= 0 ? 2000 : REFRESH_MS); else window.bullseyeConnection.live();
|
|
109
|
-
var j = await r.json().catch(function () { return {}; });
|
|
110
109
|
if (r.status === 401) { needSignIn("This sign-in was not accepted. Sign in again."); throw new Error("not signed in"); }
|
|
110
|
+
var j = await told(r);
|
|
111
111
|
if (!r.ok) { var refused = new Error(j.error || ("HTTP " + r.status)); refused.status = r.status; throw refused; }
|
|
112
112
|
return j;
|
|
113
113
|
}
|
|
@@ -341,7 +341,8 @@ var STEPS_REFRESH_MS = 2000;
|
|
|
341
341
|
function paint(m) {
|
|
342
342
|
model = m;
|
|
343
343
|
liveRead();
|
|
344
|
-
|
|
344
|
+
bannerLine.fill = function (detail) { detail.replaceChildren(el("p", "", model.banner.replace(/^⚠️ /, ""))); };
|
|
345
|
+
if (m.banner) bannerLine.set("⚠️ TUNNEL", "another one runs here · tap to read", "warning", m.banner); else bannerLine.hide();
|
|
345
346
|
m.steps.forEach(function (s, i) {
|
|
346
347
|
var sec = document.getElementById("s" + i);
|
|
347
348
|
sec.querySelector(".mark").textContent = s.mark;
|
|
@@ -249,7 +249,7 @@ export function signInPage(res, title, body) {
|
|
|
249
249
|
<style>:root{--bg:#fff;--fg:#111;--mut:#667;--line:#d8dce2;--go:#0b5fff;--bad:#a40000}@media(prefers-color-scheme:dark){:root{--bg:#14171c;--fg:#e8eaed;--mut:#9aa3b0;--line:#2b313b;--go:#2f6df0;--bad:#ff8a80}}
|
|
250
250
|
body{font:16px system-ui,sans-serif;max-width:440px;margin:12px auto;padding:0 16px;background:var(--bg);color:var(--fg)}h2{font-size:19px;margin:0 0 8px}h3{font-size:15px;margin:16px 0 4px}input{font:inherit;width:100%;padding:10px;box-sizing:border-box;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--fg)}
|
|
251
251
|
button{font:inherit;padding:10px 16px;margin:12px 8px 0 0;border:1px solid var(--go);border-radius:8px;background:var(--go);color:#fff}button.plain{background:none;color:var(--fg);border-color:var(--line)}
|
|
252
|
-
.mut{color:var(--mut);font-size:14px}.err{color:var(--bad);font-weight:600}code{word-break:break-all}svg{width:240px;height:240px;background:#fff}li{margin:4px 0}a{color:var(--go)}.home{display:inline-flex;align-items:center;min-height:32px;padding:0 10px;margin:0 0 10px;border:1px solid var(--line);border-radius:8px;color:var(--fg);text-decoration:none;font-size:14px}@media(max-width:480px) and (pointer:coarse){a{display:inline-block;padding:10px 0}a.home{display:inline-flex;padding:0 10px}button{min-height:44px}}</style></head><body
|
|
252
|
+
.mut{color:var(--mut);font-size:14px}.err{color:var(--bad);font-weight:600}code{word-break:break-all}svg{width:240px;height:240px;background:#fff}li{margin:4px 0}a{color:var(--go)}.home{display:inline-flex;align-items:center;min-height:32px;padding:0 10px;margin:0 0 10px;border:1px solid var(--line);border-radius:8px;color:var(--fg);text-decoration:none;font-size:14px}@media(max-width:480px) and (pointer:coarse){a{display:inline-block;padding:10px 0}a.home{display:inline-flex;padding:0 10px}button{min-height:44px}}</style></head><body>${body}</body></html>`;
|
|
253
253
|
res.writeHead(200, { ...PAGE_HEADERS, "content-length": String(Buffer.byteLength(html)) });
|
|
254
254
|
res.end(html);
|
|
255
255
|
}
|
|
@@ -480,8 +480,9 @@ export function createSignInDoor({ storeFile, product, short, home, host: doorHo
|
|
|
480
480
|
tickets.set(digest(ticket), { exp: expiresAt, host: doorHost, ...(replaces === undefined ? {} : { replaces }) });
|
|
481
481
|
return { url: `https://${doorHost}${ENROL_PATH}#${ticket}`, expiresAt };
|
|
482
482
|
}
|
|
483
|
+
const wayBack = `<a class="home" href="/">‹ ${short} sign-in</a>`;
|
|
483
484
|
function enrolPage(res) {
|
|
484
|
-
signInPage(res, `${short} passkey`,
|
|
485
|
+
signInPage(res, `${short} passkey`, `${wayBack}<h2>Add a passkey for ${short}</h2>
|
|
485
486
|
<p>Your phone's fingerprint will be what signs you in to ${short} from anywhere. After it is added, it is the only way into ${short} from the internet.</p>
|
|
486
487
|
<p>${PROOF_WAYS.link}</p>
|
|
487
488
|
<button id="go">Add passkey</button><p id="out"></p>
|
|
@@ -495,15 +496,15 @@ go.onclick=async function(){go.disabled=true;out.className="";out.textContent="W
|
|
|
495
496
|
</script>`);
|
|
496
497
|
}
|
|
497
498
|
function authenticatorPage(res) {
|
|
498
|
-
signInPage(res, `${short} authenticator`,
|
|
499
|
+
signInPage(res, `${short} authenticator`, `${wayBack}<h2>Add an authenticator app</h2>
|
|
499
500
|
<p>Google Authenticator, Microsoft Authenticator and LastPass all work. Its 6-digit code becomes the second way to sign in to ${short}, after the fingerprint. Away from this computer, your fingerprint is asked first.</p>
|
|
500
501
|
<button id="go">Show the QR code</button><div id="qr"></div>
|
|
501
502
|
<div id="confirm" hidden><label>Code the app shows<br><input id="code" inputmode="numeric" autocomplete="one-time-code" maxlength="6"></label><button id="ok">Add authenticator</button></div><p id="out"></p>
|
|
502
503
|
<script>${PASSKEY_SCRIPT}
|
|
503
504
|
var out=document.getElementById("out"),go=document.getElementById("go"),ok=document.getElementById("ok"),qr=document.getElementById("qr"),confirm=document.getElementById("confirm"),auth={},pending="";
|
|
504
|
-
var fail=function(b){return function(e){out.className="err";out.textContent=e.message;b.disabled=false;};};
|
|
505
|
+
var fail=function(b){return function(e){out.className="err";out.textContent=e instanceof TypeError?"No connection to ${short} — press it again once you are back online.":e.message;b.disabled=false;};};
|
|
505
506
|
go.onclick=function(){go.disabled=true;out.className="";
|
|
506
|
-
fetch("/passkey/state"+location.search).then(function(r){return r.json();}).then(function(door){if(door.local)return;out.textContent="Waiting for your fingerprint...";return passkeySignIn().then(function(s){auth={authorization:"Bearer "+s};});})
|
|
507
|
+
fetch("/passkey/state"+location.search).then(function(r){if(r.status===502||r.status===504||!/json/.test(r.headers.get("content-type")||""))throw new Error("${short} is not answering (HTTP "+r.status+")");return r.json();}).then(function(door){if(door.local)return;out.textContent="Waiting for your fingerprint...";return passkeySignIn().then(function(s){auth={authorization:"Bearer "+s};});})
|
|
507
508
|
.then(function(){return pkPost("/passkey/authenticator/begin"+location.search,{},auth);})
|
|
508
509
|
.then(function(b){pending=b.pending;qr.innerHTML=b.qr;var k=document.createElement("p");k.className="mut";k.textContent="Or type this key in the app: "+b.key;qr.append(k);confirm.hidden=false;
|
|
509
510
|
out.textContent="Scan it in the app, then type the 6-digit code it shows.";document.getElementById("code").focus();},fail(go));};
|
|
@@ -520,7 +521,7 @@ ok.onclick=function(){ok.disabled=true;pkPost("/passkey/authenticator/confirm"+l
|
|
|
520
521
|
const app = store.authenticator === undefined ? `<p class="mut">None — <a href="${authenticatorHref}">add an authenticator app</a>.</p>`
|
|
521
522
|
: `<ul><li><b>Authenticator app</b> <span class="mut">${escapeHtml(new Date(store.authenticator.createdAt).toLocaleString())}</span>
|
|
522
523
|
<button class="plain" data-route="authenticator/remove">Remove</button></li></ul><p><a href="${authenticatorHref}">Replace it</a></p>`;
|
|
523
|
-
signInPage(res, `${short} passkey setup`,
|
|
524
|
+
signInPage(res, `${short} passkey setup`, `${wayBack}<h2>${short} passkeys</h2><h3>Enrolled</h3>${listed ? `<ul>${listed}</ul>` : `<p class="mut">No passkey yet.</p>`}<h3>Authenticator app</h3>${app}
|
|
524
525
|
${locked(store) ? "" : `<p class="mut">Until an owner passkey is registered, nothing opens ${short} from outside.</p>`}<p id="out" class="err"></p>
|
|
525
526
|
<script>document.querySelectorAll("button[data-id],button[data-route]").forEach(function(b){b.onclick=async function(){b.disabled=true;
|
|
526
527
|
var r=await fetch("${PASSKEY_PREFIX}"+(b.dataset.route||"remove")+location.search,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:b.dataset.id})});
|
|
@@ -128,7 +128,8 @@ function sizePhone(){
|
|
|
128
128
|
document.body.classList.toggle("phone",phone);document.documentElement.style.setProperty("--k",String(phoneScale));
|
|
129
129
|
if(terminal&&terminal.options.fontSize!==Math.round(15*phoneScale)){terminal.options.fontSize=Math.round(15*phoneScale);refit();}
|
|
130
130
|
}
|
|
131
|
-
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 view=0,sent={},listResize=null,terminal,fitAddon,socket=null,reconnect,observer,arrival=null,socketDown=false,reopened=null,lost=function(){},sender=Math.random().toString(36).slice(2)+Date.now().toString(36);
|
|
132
|
+
var REOPENED="A new CLI of this conversation — the one before is gone, and its screen was not kept.";
|
|
132
133
|
var heard=window.bullseyeConnection.watch(function(){return socket;},function(alive){alive.send('{"kind":"ping"}');},function(dead){lost(dead);});
|
|
133
134
|
sizePhone();window.addEventListener("resize",sizePhone);
|
|
134
135
|
if(window.visualViewport){var fitKeyboard=function(){document.body.style.height=phone?visualViewport.height+"px":"";};visualViewport.addEventListener("resize",fitKeyboard);fitKeyboard();}
|
|
@@ -153,8 +154,8 @@ function tool(id,icon,label,cls,brief){var b=el("button",cls,icon);b.id=id;b.app
|
|
|
153
154
|
|
|
154
155
|
function show(name,heading){
|
|
155
156
|
view++;
|
|
156
|
-
clearTimeout(reconnect);if(socket!==null){socket.onclose=null;socket.close();socket=null;}
|
|
157
|
-
if(name!=="terminal"){socketDown=false;if(!gatewayDown)window.bullseyeConnection.live();
|
|
157
|
+
clearTimeout(reconnect);if(socket!==null){socket.onopen=socket.onmessage=socket.onerror=socket.onclose=null;socket.close();socket=null;}if(observer){observer.disconnect();observer=null;}if(terminal){terminal.dispose();terminal=null;}
|
|
158
|
+
if(name!=="terminal"){socketDown=false;if(!gatewayDown)window.bullseyeConnection.live();document.getElementById("keybar").hidden=true;main.style.display="";main.style.flexDirection="";tools.replaceChildren();}
|
|
158
159
|
title.textContent=heading;
|
|
159
160
|
var inList=name==="list";
|
|
160
161
|
btnBack.hidden=inList||name==="signin";
|
|
@@ -175,7 +176,7 @@ function show(name,heading){
|
|
|
175
176
|
|
|
176
177
|
function scoped(h){if(scope!==null)h["x-bullseye-project"]=scope;return h}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);}
|
|
177
178
|
async function reach(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();return response;}
|
|
178
|
-
async function api(method,path,body,signal){var response=await reach(method,path,body,signal);var data=await response
|
|
179
|
+
async function api(method,path,body,signal){var response=await reach(method,path,body,signal);var data=await told(response);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;}
|
|
179
180
|
function fail(error){liveNotice(plainWhy(error),"error");}
|
|
180
181
|
function ordered(id,act,body){if(!socket||socket.readyState!==WebSocket.OPEN)return;socket.send(JSON.stringify(Object.assign({kind:act},body)));}
|
|
181
182
|
/** The last folder of a path, so a row names its project without printing the whole path. */
|
|
@@ -379,7 +380,7 @@ async function cliAttach(id,origin){
|
|
|
379
380
|
liveNotice("⏳ Getting "+name+" from the CLI machine…");
|
|
380
381
|
try{
|
|
381
382
|
var response=await reach("GET","/v1/terminals/"+id+"/file?path="+encodeURIComponent(path));
|
|
382
|
-
if(!response.ok){var refused=await response
|
|
383
|
+
if(!response.ok){var refused=await told(response);if(response.status===401)signIn("Sign in again to reach your CLI.");throw Error(refused.error||"the gateway answered "+response.status);}
|
|
383
384
|
var address=URL.createObjectURL(await response.blob()),link=el("a");link.href=address;link.download=name;document.body.append(link);link.click();link.remove();setTimeout(function(){URL.revokeObjectURL(address);},60000);
|
|
384
385
|
if(mine===view)liveNotice("Saved "+name+" to this device's downloads.");
|
|
385
386
|
}catch(error){if(mine===view)liveNotice("Not saved — "+plainWhy(error),"error");}
|
|
@@ -396,7 +397,7 @@ async function cliAttach(id,origin){
|
|
|
396
397
|
var response=await reach("GET","/v1/terminals/"+id+"/file?path="+encodeURIComponent(path));
|
|
397
398
|
if(mine!==view||said.parentNode!==sheet)return;
|
|
398
399
|
if(response.status===401){signIn("Sign in again to reach your CLI.");return;}
|
|
399
|
-
if(!response.ok){said.className="err";said.textContent="⚠️ "+((await response
|
|
400
|
+
if(!response.ok){said.className="err";said.textContent="⚠️ "+((await told(response)).error||"the gateway answered "+response.status);return;}
|
|
400
401
|
if(!(response.headers.get("content-type")||"").includes("json")){
|
|
401
402
|
var name=base(path);
|
|
402
403
|
var address=URL.createObjectURL(await response.blob()),link=el("a");link.href=address;link.download=name;document.body.append(link);link.click();link.remove();setTimeout(function(){URL.revokeObjectURL(address);},60000);
|
|
@@ -434,7 +435,7 @@ async function cliAttach(id,origin){
|
|
|
434
435
|
},true);
|
|
435
436
|
var keybar=document.getElementById("keybar"),ctrlHeld=false,ctrlKey=null;
|
|
436
437
|
function disarm(){ctrlHeld=false;ctrlKey.classList.remove("armed");}
|
|
437
|
-
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);}
|
|
438
|
+
var unacked=[],inputs=0,from=sender+"."+mine;function typed(body){if(term.options.disableStdin){liveNotice("Not sent — this CLI is no longer connected. Press 🔌 Reattach.","error");return;}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);}
|
|
438
439
|
function sendKey(data){if(ctrlHeld){disarm();data=ctrlBarSeq(data);}typed({data:data});}
|
|
439
440
|
keybar.replaceChildren();keybar.hidden=false;
|
|
440
441
|
[NEW_LINE].concat(KEY_BAR.slice(0,7),[{id:"ctrl",label:"Ctrl",title:"Ctrl (sticky)"}],KEY_BAR.slice(7)).forEach(function(key){
|
|
@@ -448,6 +449,8 @@ async function cliAttach(id,origin){
|
|
|
448
449
|
refit=function(){if(mine!==view||!socket||socket.readyState!==WebSocket.OPEN||host.clientWidth===0||host.clientHeight===0)return;fitAddon.fit();ordered(id,"resize",{cols:term.cols,rows:term.rows});};
|
|
449
450
|
if(observer)observer.disconnect();observer=new ResizeObserver(refit);host.addEventListener("pointerdown",refit);host.addEventListener("touchstart",refit,{passive:true});var wake=function(){if(!document.hidden)refit();},off=observer.disconnect.bind(observer);window.addEventListener("focus",wake);document.addEventListener("visibilitychange",wake);observer.disconnect=function(){window.removeEventListener("focus",wake);document.removeEventListener("visibilitychange",wake);off();};
|
|
450
451
|
reattach.onclick=function(){cliAttach(id,origin);};
|
|
452
|
+
if(reopened!==null&&reopened.id===id)liveNotice(REOPENED+(reopened.unsent?" What you typed while it was away was not sent.":""),"hint");
|
|
453
|
+
reopened=null;
|
|
451
454
|
close.onclick=async function(){close.disabled=true;try{await api("DELETE","/v1/terminals/"+id);swap("list");}catch(error){close.disabled=false;fail(error);}};
|
|
452
455
|
observer.observe(host);
|
|
453
456
|
var WHAT="the terminal connection to the CLI",reattached=false;
|
|
@@ -474,7 +477,7 @@ async function cliAttach(id,origin){
|
|
|
474
477
|
if(mine!==view)return;
|
|
475
478
|
if(error.status===401)return;
|
|
476
479
|
if(error.status!==404)return later();
|
|
477
|
-
api("POST","/v1/terminals",{conversation:id,cols:term.cols,rows:term.rows},AbortSignal.timeout(START_MS)).then(function(started){if(mine!==view)return;if(started.id!==id){swap("term",started.id);return;}connect();},function(failure){
|
|
480
|
+
api("POST","/v1/terminals",{conversation:id,cols:term.cols,rows:term.rows},AbortSignal.timeout(START_MS)).then(function(started){if(mine!==view)return;if(started.id!==id){reopened={id:started.id,unsent:unacked.length>0};swap("term",started.id);return;}liveNotice(REOPENED,"hint");connect();},function(failure){
|
|
478
481
|
if(mine!==view)return;
|
|
479
482
|
if(failure.status!==404)return later();
|
|
480
483
|
swap("term",id);
|
|
@@ -3485,6 +3485,16 @@ function applyRequest(store, r, now) {
|
|
|
3485
3485
|
e.why = `request metadata updated, but ${e.handStop.by} 🛑 Stop holds it — only a newer explicit Start press puts it back`;
|
|
3486
3486
|
step(e, now, "updated", e.why);
|
|
3487
3487
|
}
|
|
3488
|
+
else if (r.eligible && !newPress && (e.state === "failed" || e.state === "withdrawn") && neverRecordedSpent(e)) {
|
|
3489
|
+
// 🔴 #4485 — a story reported for a never-recorded worker, withdrawn while its decision was open and asked for again, goes back to failed: only his press or ↻ Retry starts it
|
|
3490
|
+
const reported = `the board asks for it again, but ${NEVER_RECORDED_REPORT} — its worker never recorded itself after its one restart for that cause`;
|
|
3491
|
+
if (e.state !== "failed") {
|
|
3492
|
+
e.state = "failed";
|
|
3493
|
+
delete e.nextTryAt;
|
|
3494
|
+
step(e, now, "failed", reported);
|
|
3495
|
+
}
|
|
3496
|
+
e.why = reported;
|
|
3497
|
+
}
|
|
3488
3498
|
else if (r.eligible && !newPress && (e.state === "withdrawn" || e.state === "failed") && (e.attempts >= WORKER_ATTEMPTS || e.accountRefused !== undefined)) {
|
|
3489
3499
|
// NULL-OK: field accountRefused is OPTIONAL and therefore it is ok to check for NULL
|
|
3490
3500
|
const spent = e.accountRefused === undefined ? `its worker was started ${e.attempts} times and the story is still open` : e.accountRefused.why;
|
|
@@ -3501,6 +3511,7 @@ function applyRequest(store, r, now) {
|
|
|
3501
3511
|
else if (r.eligible && (e.state === "withdrawn" || e.state === "done" || e.state === "failed" || (e.handStop !== undefined && newPress))) {
|
|
3502
3512
|
if (r.origin === "press" || e.state === "done")
|
|
3503
3513
|
e.attempts = 0;
|
|
3514
|
+
delete e.neverRecorded;
|
|
3504
3515
|
delete e.accountRefused;
|
|
3505
3516
|
delete e.accountRefusals;
|
|
3506
3517
|
if (e.handStop !== undefined && e.worker !== undefined)
|
|
@@ -3755,6 +3766,13 @@ FleetView's story queue started you on #${entry.storyId}, and no session stands
|
|
|
3755
3766
|
${workerStanding(entry.storyId)}`;
|
|
3756
3767
|
// GATE: how many times one story's worker is started before the queue gives up on it and its entry stops in `failed` — each start that ends with the story still open is one
|
|
3757
3768
|
export const WORKER_ATTEMPTS = 3;
|
|
3769
|
+
// GATE: 🔴 #4485 — how many times a story whose worker never recorded itself is started again for that same cause before it is reported instead — once
|
|
3770
|
+
export const NEVER_RECORDED_RESTARTS = 1;
|
|
3771
|
+
/** 🔴 #4485 — what a never-recorded failure says it waits on: the steward reads it off the queue and puts it to Meni as the story's board decision. */
|
|
3772
|
+
export const NEVER_RECORDED_REPORT = "it waits failed for a decision on its story (his ↻ Retry or Start starts it again)";
|
|
3773
|
+
/** 🔴 #4485 — whether an entry has spent its one restart on a worker that never recorded itself. */
|
|
3774
|
+
// NULL-OK: field neverRecorded is OPTIONAL and therefore it is ok to check for NULL
|
|
3775
|
+
const neverRecordedSpent = (e) => (e.neverRecorded ?? 0) > NEVER_RECORDED_RESTARTS;
|
|
3758
3776
|
// GATE: the wait before a story whose worker ended is started again: this, doubled for each earlier attempt
|
|
3759
3777
|
export const RETRY_BASE_MS = 60_000;
|
|
3760
3778
|
// GATE: the wait before a story the queue gave up on is offered to the line again: this, doubled for each start past WORKER_ATTEMPTS
|
|
@@ -4127,6 +4145,7 @@ async function passHeld(board, world, now) {
|
|
|
4127
4145
|
}
|
|
4128
4146
|
e.state = "queued";
|
|
4129
4147
|
e.attempts = 0;
|
|
4148
|
+
delete e.neverRecorded;
|
|
4130
4149
|
delete e.accountRefused;
|
|
4131
4150
|
delete e.accountRefusals;
|
|
4132
4151
|
delete e.nextTryAt;
|
|
@@ -4203,7 +4222,8 @@ async function passHeld(board, world, now) {
|
|
|
4203
4222
|
}
|
|
4204
4223
|
if (e.state === "failed") {
|
|
4205
4224
|
const gaveUp = e.trace.filter((t) => t.stage === "failed").pop();
|
|
4206
|
-
|
|
4225
|
+
// 🔴 #4485 — a story reported for a worker that never recorded itself, after its one restart, waits for his press or ↻ Retry: no re-arm starts it a third time on the same cause
|
|
4226
|
+
if (!e.eligible || gaveUp === undefined || neverRecordedSpent(e))
|
|
4207
4227
|
continue;
|
|
4208
4228
|
delete e.worker?.killedAt;
|
|
4209
4229
|
// NULL-OK: field accountRefused is OPTIONAL and therefore it is ok to check for NULL
|
|
@@ -4397,6 +4417,20 @@ async function passHeld(board, world, now) {
|
|
|
4397
4417
|
// NULL-OK: field neverHeldRefusals is OPTIONAL and therefore it is ok to check for NULL
|
|
4398
4418
|
if (w.neverHeld === undefined)
|
|
4399
4419
|
delete e.neverHeldRefusals;
|
|
4420
|
+
if (w.neverRecorded === true) {
|
|
4421
|
+
e.neverRecorded = (e.neverRecorded ?? 0) + 1;
|
|
4422
|
+
if (e.neverRecorded > NEVER_RECORDED_RESTARTS) {
|
|
4423
|
+
// 🔴 #4485 — the restart for this cause was spent and its worker never recorded itself either: reported with the cause, never started again on it until his press or ↻ Retry (a story the board no longer asks for rests withdrawn with the same words, and a later ask puts it back to failed)
|
|
4424
|
+
e.state = e.eligible ? "failed" : "withdrawn";
|
|
4425
|
+
delete e.nextTryAt;
|
|
4426
|
+
e.why = `${w.why} — restarted once already for the same cause and that worker never recorded itself either, so it is not started again; ${NEVER_RECORDED_REPORT}`;
|
|
4427
|
+
step(e, now, e.eligible ? "failed" : "withdrawn", e.why);
|
|
4428
|
+
continue;
|
|
4429
|
+
}
|
|
4430
|
+
afterWorker(e, now, e.eligible ? `${w.why}; restarted once for that cause` : w.why);
|
|
4431
|
+
continue;
|
|
4432
|
+
}
|
|
4433
|
+
delete e.neverRecorded;
|
|
4400
4434
|
// A post the owning native main accepted and no lane ever took is not a start the story spent: its charge is given back, its recorded main is kept, and the trace keeps what happened.
|
|
4401
4435
|
afterWorker(e, now, w.neverHeld === undefined ? w.why : `${w.why}; that post never held a lane, so it spends none of the story's starts`, true, w.neverHeld !== undefined);
|
|
4402
4436
|
continue;
|
|
@@ -4435,8 +4469,10 @@ async function passHeld(board, world, now) {
|
|
|
4435
4469
|
e.worker.progressAt = w.progressAt;
|
|
4436
4470
|
}
|
|
4437
4471
|
// NULL-OK: field session is OPTIONAL and therefore it is ok to check for NULL
|
|
4438
|
-
if (w.session !== undefined)
|
|
4472
|
+
if (w.session !== undefined) {
|
|
4439
4473
|
e.worker.session = w.session;
|
|
4474
|
+
delete e.neverRecorded;
|
|
4475
|
+
}
|
|
4440
4476
|
// NULL-OK: field question is OPTIONAL and therefore it is ok to check for NULL
|
|
4441
4477
|
if (w.blocked === true && w.question !== undefined && e.worker.question?.text !== w.question && (w.guessed !== true || e.worker.question === undefined)) {
|
|
4442
4478
|
const from = Math.max(e.worker.startedAt, e.worker.pastAt ?? 0);
|
|
@@ -4692,7 +4728,8 @@ async function passHeld(board, world, now) {
|
|
|
4692
4728
|
workerMade();
|
|
4693
4729
|
e.landedAt = now;
|
|
4694
4730
|
// NULL-OK: field cwd is OPTIONAL and therefore it is ok to check for NULL
|
|
4695
|
-
|
|
4731
|
+
// 🔴 #4485 — a wake that resumed the very session it was handed keeps that session even under a new job id, so its worker is never read as one that never recorded itself
|
|
4732
|
+
e.worker = { ...woken, wakes, ...(woken.provider === parked.provider && (woken.jobId === parked.jobId || parked.session?.id === sessionId) ? keptSession(parked) : {}), ...(parked.cwd === undefined ? {} : { cwd: parked.cwd }) };
|
|
4696
4733
|
delete e.forced;
|
|
4697
4734
|
delete e.forcedBy;
|
|
4698
4735
|
if (noteCarried(e, { alive: true, why: "", carried: e.worker.carried }, now)) {
|
|
@@ -5120,6 +5157,7 @@ async function pressHeld(board, storyId, press, now, by, requestHandledByOwner =
|
|
|
5120
5157
|
startsNothingOnItsOwn("↻ Retry");
|
|
5121
5158
|
e.state = "queued";
|
|
5122
5159
|
e.attempts = 0;
|
|
5160
|
+
delete e.neverRecorded;
|
|
5123
5161
|
delete e.accountRefused;
|
|
5124
5162
|
delete e.accountRefusals;
|
|
5125
5163
|
delete e.nextTryAt;
|
|
@@ -5515,6 +5553,14 @@ const keptSession = (worker) => ({ ...(worker.session === undefined ? {} : { ses
|
|
|
5515
5553
|
/** 🔴 #4123 — a worker whose job record Claude Code no longer keeps: still the story's worker while a process runs its session or that process is inside its start grace, woken in its own session once none does and its transcript is on disk, ended when there is no session to wake. */
|
|
5516
5554
|
function goneWorker(worker, now, home) {
|
|
5517
5555
|
const gone = `its job ${worker.jobId} is no longer on Claude Code's record`;
|
|
5556
|
+
// 🔴 #4485 — a worker that never recorded itself: no job record, no session and no work ever read of it. Inside its start grace it may still be writing its record; past it the start is named as never recorded, so the queue restarts it once for that cause and then reports it.
|
|
5557
|
+
// NULL-OK: field session is OPTIONAL and therefore it is ok to check for NULL
|
|
5558
|
+
if (worker.session === undefined && worker.progressAt === undefined) {
|
|
5559
|
+
const age = Math.round((now - worker.startedAt) / 1000);
|
|
5560
|
+
if (now - worker.startedAt < WORKER_START_GRACE_MS)
|
|
5561
|
+
return { alive: true, why: `its job ${worker.jobId} was started ${age}s ago and its process has not recorded itself yet` };
|
|
5562
|
+
return { alive: false, neverRecorded: true, why: `its job ${worker.jobId} never recorded itself — ${age}s after its start Claude Code holds no record and no session of it, past its ${WORKER_START_GRACE_MS / 60_000}-minute start grace` };
|
|
5563
|
+
}
|
|
5518
5564
|
// NULL-OK: field session is OPTIONAL and therefore it is ok to check for NULL
|
|
5519
5565
|
if (worker.session === undefined || readingTranscript(worker.session.transcript, () => mtimeOf(worker.session.transcript)) === undefined)
|
|
5520
5566
|
return { alive: false, why: gone };
|
|
@@ -851,6 +851,19 @@ function recordKeyPlan(home, providerId, plan) {
|
|
|
851
851
|
return;
|
|
852
852
|
writeAtomically(file, JSON.stringify({ ...plan, at: Date.now() }));
|
|
853
853
|
}
|
|
854
|
+
const FUNDS_REFUSAL_FILE = encodeURIComponent("deepagent.fundsRefusal.");
|
|
855
|
+
/**
|
|
856
|
+
* #3729 — every key DeepAgent's own store records refusing a prompt for lack of funds on this box (`balance.ts`
|
|
857
|
+
* `recordFundsRefusal`, one `deepagent.fundsRefusal.<id>.json` per key in `~/.bullseye/settings/da.memento`), read from
|
|
858
|
+
* that store itself, so the pad's pass and DeepAgent's server hand the one Claude Code mover the same refusals.
|
|
859
|
+
* @param {string} home @returns {string[]}
|
|
860
|
+
*/
|
|
861
|
+
function fundsRefusedKeys(home) {
|
|
862
|
+
const dir = path.join(home, ".bullseye", "settings", "da.memento");
|
|
863
|
+
const names = unlessErr("ENOENT", () => fs.readdirSync(dir)) ?? [];
|
|
864
|
+
return names.filter((name) => name.startsWith(FUNDS_REFUSAL_FILE) && name.endsWith(".json"))
|
|
865
|
+
.map((name) => decodeURIComponent(name.slice(FUNDS_REFUSAL_FILE.length, -".json".length))).sort();
|
|
866
|
+
}
|
|
854
867
|
/**
|
|
855
868
|
* @param {string} home
|
|
856
869
|
* @param {string} providerId
|
|
@@ -2110,6 +2123,7 @@ module.exports = {
|
|
|
2110
2123
|
keyPlanPath,
|
|
2111
2124
|
recordKeyPlan,
|
|
2112
2125
|
readKeyPlan,
|
|
2126
|
+
fundsRefusedKeys,
|
|
2113
2127
|
AGENT_CLIS,
|
|
2114
2128
|
OPENCODE_PROVIDER,
|
|
2115
2129
|
OPENCODE_KEY_KINDS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-notify-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.443",
|
|
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",
|