omni-notify-mcp 1.3.400 → 1.3.402
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/README.md +2 -2
- package/dist/agentGateway.js +3 -9
- package/dist/gateway/conversationOwner.js +2 -3
- package/dist/gateway/panel.js +1 -1
- package/dist/gateway/panelPage.js +6 -3
- package/dist/gateway/terminalPage.js +67 -11
- package/dist/notify.js +0 -2
- package/dist/shared/agentSession.js +28 -11
- package/dist/shared/conversation/conversationOwner.js +0 -1
- package/dist/shared/conversation/conversations.js +2 -3
- package/dist/shared/conversation/sessionDriver.js +1 -1
- package/dist/shared/webhost/autoSwitch.cjs +18 -5
- package/dist/shared/webhost/bullseyeWebHost.js +5 -4
- package/dist/shared/webhost/webviewShim.js +152 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -165,8 +165,8 @@ printed as though it had.
|
|
|
165
165
|
|
|
166
166
|
## Delivery routing
|
|
167
167
|
|
|
168
|
-
Suppression runs first, in order: **master mute** (`muteAll`) drops
|
|
169
|
-
including `high
|
|
168
|
+
Suppression runs first, in order: **master mute** (`muteAll`) drops every outbound notification
|
|
169
|
+
including `high` (agent conversations are never muted); a client listed in `disabledClients` is dropped by client id; then
|
|
170
170
|
**Do Not Disturb** holds everything, `high` included — nothing reaches you until it
|
|
171
171
|
lifts. A deliberate hold is a choice and never wears the same face as a defect.
|
|
172
172
|
|
package/dist/agentGateway.js
CHANGED
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
* Every conversation starts in Meni's workspace root, as the web page's and the MCP door's do.
|
|
12
12
|
*/
|
|
13
13
|
import { splitForNotify } from "./chunk.js";
|
|
14
|
-
import {
|
|
15
|
-
import { appendEvent, CONVERSATION_MUTED_MESSAGE, conversationRefusal, createdIn, creationPending, creationsPending, editOwed, GatewayError, listConversations, monotonicMs, openConversationOf, openConversationsOf, queueNoticeOf, readEvents, resolveProject, routeAsk, stopTargetOf, sendToConversation, startConversation, updateConversation, } from "./gateway/conversationOwner.js";
|
|
14
|
+
import { appendEvent, conversationRefusal, createdIn, creationPending, creationsPending, editOwed, GatewayError, listConversations, monotonicMs, openConversationOf, openConversationsOf, queueNoticeOf, readEvents, resolveProject, routeAsk, stopTargetOf, sendToConversation, startConversation, updateConversation, } from "./gateway/conversationOwner.js";
|
|
16
15
|
import { conversationOwner } from "./gateway/conversationOwner.js";
|
|
17
16
|
import { clearOpenCodeLogs } from "./gateway/conversationOwner.js";
|
|
18
17
|
import { resendUndelivered, turnEnded } from "./gateway/mcpEvents.js";
|
|
@@ -146,9 +145,6 @@ export class AgentGateway {
|
|
|
146
145
|
const arrived = monotonicMs();
|
|
147
146
|
const carriage = CARRIAGE[platform];
|
|
148
147
|
const refusal = conversationRefusal();
|
|
149
|
-
// A muted BN answers nobody: the refusal is spoken to the chat only when the switch, not Mute everything, is what is off.
|
|
150
|
-
if (refusal === CONVERSATION_MUTED_MESSAGE)
|
|
151
|
-
return;
|
|
152
148
|
if (refusal !== undefined)
|
|
153
149
|
return reply(refusal);
|
|
154
150
|
// NULL-OK: field pending is OPTIONAL and therefore it is ok to check for NULL
|
|
@@ -251,13 +247,11 @@ export class AgentGateway {
|
|
|
251
247
|
continue;
|
|
252
248
|
}
|
|
253
249
|
const event = pending.shift();
|
|
254
|
-
|
|
255
|
-
const muted = masterMuted();
|
|
256
|
-
if (!muted && carriage.carries(event.kind))
|
|
250
|
+
if (carriage.carries(event.kind))
|
|
257
251
|
for (const part of carriage.parts(event))
|
|
258
252
|
await reply(part);
|
|
259
253
|
const final = FINAL_KINDS.has(event.kind ?? "");
|
|
260
|
-
if (!closed
|
|
254
|
+
if (!closed)
|
|
261
255
|
editOwed(id, (o) => { if (final)
|
|
262
256
|
delete o[n];
|
|
263
257
|
else
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync } from "fs";
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
|
-
import { CONFIG_DIR
|
|
3
|
+
import { CONFIG_DIR } from "../notify.js";
|
|
4
4
|
let personId;
|
|
5
5
|
void import("./passkeyDoor.js").then((door) => { personId = door.personId; });
|
|
6
6
|
import { createConversationOwner } from "../shared/conversation/conversationOwner.js";
|
|
@@ -35,7 +35,6 @@ export const conversationOwner = createConversationOwner({
|
|
|
35
35
|
get configDir() { return CONFIG_DIR; },
|
|
36
36
|
startOwner: FLEET_OWNER,
|
|
37
37
|
personId: () => personId(),
|
|
38
|
-
masterMuted: () => masterMuted(),
|
|
39
38
|
driver: driverOptions(),
|
|
40
39
|
});
|
|
41
40
|
export const { agentDir, storeChanged, SCOPE_HEADER } = conversationOwner.store;
|
|
@@ -109,7 +108,7 @@ export function shelfInLog(...args) { return conversationOwner.store.shelfInLog(
|
|
|
109
108
|
export function purgeConversation(...args) { return conversationOwner.store.purgeConversation(...args); }
|
|
110
109
|
export function stoppedInLog(...args) { return conversationOwner.store.stoppedInLog(...args); }
|
|
111
110
|
export function resumedInLog(...args) { return conversationOwner.store.resumedInLog(...args); }
|
|
112
|
-
export { GatewayError, MAX_WAIT_SECONDS, CONVERSATION_SWITCH_FILE, CONVERSATION_OFF_MESSAGE
|
|
111
|
+
export { GatewayError, MAX_WAIT_SECONDS, CONVERSATION_SWITCH_FILE, CONVERSATION_OFF_MESSAGE } from "../shared/conversation/conversations.js";
|
|
113
112
|
export const SessionDriver = conversationOwner.Driver;
|
|
114
113
|
export { IDLE_MS, SILENT_MS, STALL_MS, ARCHIVE_IDLE_MS, SPARE_IDLE_MS } from "../shared/conversation/sessionDriver.js";
|
|
115
114
|
export const { terminalHolder, NativeTerminal, terminalArriving, nativeTerminals, openDrivenTerminal, closeNativeTerminal, nativeTerminal, consoleSession, removeEndedDaemonsSpools } = conversationOwner.terminals;
|
package/dist/gateway/panel.js
CHANGED
|
@@ -13,7 +13,7 @@ const CONFIG_PATH = join(CONFIG_DIR, "config.json");
|
|
|
13
13
|
// Every config field the notify server reads, one editable row each. A field the server no longer reads is not listed: a control for it would change nothing.
|
|
14
14
|
export const SETTINGS = [
|
|
15
15
|
{ title: "🔕 Master", rows: [
|
|
16
|
-
{ path: ["muteAll"], label: "Mute everything", kind: "toggle", hint: "Master kill switch: On stops every channel at once, Off lets each enabled channel deliver." },
|
|
16
|
+
{ path: ["muteAll"], label: "Mute everything", kind: "toggle", hint: "Master kill switch for outbound notifications only: On stops every notification channel at once, Off lets each enabled channel deliver. Agent conversations are never muted." },
|
|
17
17
|
{ path: ["disabledClients"], label: "Muted clients (comma-separated ids)", kind: "list", hint: "Agent session ids whose notifications are dropped, e.g. @my-laptop-myproject-ea6d78. Leave empty to hear every agent." },
|
|
18
18
|
] },
|
|
19
19
|
{ guide: { summary: "Desktop banner", steps: ["Nothing to fill in: switch Enabled to On and notifications appear as desktop banners.", "Optional: turn Read aloud On to hear them."], need: [] }, title: "🖥️ Desktop", rows: [
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { PAGE_STYLE } from "./chatPage.js";
|
|
8
8
|
import { ICON_HEAD } from "./iconDoor.js";
|
|
9
|
-
import { PICKER_PAGE_SOURCE } from "../shared/webhost/webviewShim.js";
|
|
9
|
+
import { CONNECTION_SOURCE, PICKER_PAGE_SOURCE } from "../shared/webhost/webviewShim.js";
|
|
10
10
|
export const PANEL_PAGES = ["settings", "public-access"];
|
|
11
11
|
const LINKS = {
|
|
12
12
|
tunnels: "https://dash.cloudflare.com/?to=/:account/tunnels",
|
|
@@ -96,7 +96,10 @@ function needSignIn(why) {
|
|
|
96
96
|
}
|
|
97
97
|
async function call(method, path, body) {
|
|
98
98
|
function scoped(h) { var p = new URLSearchParams(location.search).get("project"); if (p !== null) h["x-bullseye-project"] = p; return h; }
|
|
99
|
-
var r
|
|
99
|
+
var r;
|
|
100
|
+
try { r = await fetch(path, { method: method, headers: scoped({ authorization: "Bearer " + token, "content-type": "application/json" }), body: body === undefined ? undefined : JSON.stringify(body) }); }
|
|
101
|
+
catch (e) { window.bullseyeConnection.reconnecting("this page's connection to the Notify service", location.pathname.indexOf("public-access") >= 0 ? 2000 : 5000); throw e; }
|
|
102
|
+
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 : 5000); else window.bullseyeConnection.live();
|
|
100
103
|
var j = await r.json().catch(function () { return {}; });
|
|
101
104
|
if (r.status === 401) { needSignIn("This sign-in was not accepted. Sign in again."); throw new Error("not signed in"); }
|
|
102
105
|
if (!r.ok) throw new Error(j.error || ("HTTP " + r.status));
|
|
@@ -133,7 +136,7 @@ document.querySelectorAll("nav a").forEach(function (a) { a.search = location.se
|
|
|
133
136
|
function shell(title, here, body, script) {
|
|
134
137
|
const nav = [["/", "💬 Conversations"], ["/settings", "⚙️ Settings"], ["/public-access", "🌐 Public access"]]
|
|
135
138
|
.map(([href, text]) => `<a href="${href}"${href === here ? ' class="here"' : ""}>${text}</a>`).join("");
|
|
136
|
-
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${title}</title>${ICON_HEAD}<style>${PAGE_STYLE}${PANEL_STYLE}</style></head><body><nav>${nav}</nav><div class="wrap"><div id="signin"></div>${body}</div><script>${SIGN_IN}${NAV_KEEPS_WORKSPACE}${script}${notificationStatusScript("call")}</script><script data-page="${here.slice(1)}">${PICKER_PAGE_SOURCE}</script></body></html>`;
|
|
139
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${title}</title>${ICON_HEAD}<style>${PAGE_STYLE}${PANEL_STYLE}</style></head><body><nav>${nav}</nav><div class="wrap"><div id="signin"></div>${body}</div><script>${CONNECTION_SOURCE}</script><script>${SIGN_IN}${NAV_KEEPS_WORKSPACE}${script}${notificationStatusScript("call")}</script><script data-page="${here.slice(1)}">${PICKER_PAGE_SOURCE}</script></body></html>`;
|
|
137
140
|
}
|
|
138
141
|
const SETTINGS_SCRIPT = `
|
|
139
142
|
var root = document.getElementById("root"), said = document.getElementById("said");
|
|
@@ -5,6 +5,7 @@ import { CONVERSATIONS_VIEWS, PAGE_STYLE, SIGN_IN_SCRIPT, servingLine, storedSta
|
|
|
5
5
|
import { PASSKEY_SCRIPT } from "./passkeyDoor.js";
|
|
6
6
|
import { PROVIDER_CHOICES } from "./conversationOwner.js";
|
|
7
7
|
import { notificationStatusScript } from "./panelPage.js";
|
|
8
|
+
import { CONNECTION_SOURCE } from "../shared/webhost/webviewShim.js";
|
|
8
9
|
import { ICON_HEAD } from "./iconDoor.js";
|
|
9
10
|
import { CLI_SCROLLBACK_LINES, CLI_WINDOWS_PTY } from "../shared/conversation/nativeTerminal.js";
|
|
10
11
|
const require = createRequire(import.meta.url);
|
|
@@ -12,6 +13,42 @@ function asset(name, installed) {
|
|
|
12
13
|
const packaged = new URL("../vendor/terminal/" + name, import.meta.url);
|
|
13
14
|
return readFileSync(existsSync(packaged) ? fileURLToPath(packaged) : require.resolve(installed), "utf8");
|
|
14
15
|
}
|
|
16
|
+
export const KEY_BAR = [
|
|
17
|
+
{ id: "up", label: "↑", title: "Up", seq: ["\x1b[A", "\x1bOA"] },
|
|
18
|
+
{ id: "down", label: "↓", title: "Down", seq: ["\x1b[B", "\x1bOB"] },
|
|
19
|
+
{ id: "left", label: "←", title: "Left", seq: ["\x1b[D", "\x1bOD"] },
|
|
20
|
+
{ id: "right", label: "→", title: "Right", seq: ["\x1b[C", "\x1bOC"] },
|
|
21
|
+
{ id: "esc", label: "Esc", title: "Escape", seq: ["\x1b", "\x1b"] },
|
|
22
|
+
{ id: "tab", label: "Tab", title: "Tab", seq: ["\t", "\t"] },
|
|
23
|
+
{ id: "shifttab", label: "⇧Tab", title: "Shift+Tab", seq: ["\x1b[Z", "\x1b[Z"] },
|
|
24
|
+
{ id: "pgup", label: "PgUp", title: "Page Up", seq: ["\x1b[5~", "\x1b[5~"] },
|
|
25
|
+
{ id: "pgdn", label: "PgDn", title: "Page Down", seq: ["\x1b[6~", "\x1b[6~"] },
|
|
26
|
+
{ id: "home", label: "Home", title: "Home", seq: ["\x1b[H", "\x1bOH"] },
|
|
27
|
+
{ id: "end", label: "End", title: "End", seq: ["\x1b[F", "\x1bOF"] },
|
|
28
|
+
];
|
|
29
|
+
export function ctrlByte(data) {
|
|
30
|
+
if (data.length !== 1)
|
|
31
|
+
return data;
|
|
32
|
+
const code = data.charCodeAt(0);
|
|
33
|
+
if (code >= 97 && code <= 122)
|
|
34
|
+
return String.fromCharCode(code - 96);
|
|
35
|
+
if (code >= 65 && code <= 90)
|
|
36
|
+
return String.fromCharCode(code - 64);
|
|
37
|
+
if (code >= 91 && code <= 95)
|
|
38
|
+
return String.fromCharCode(code - 64);
|
|
39
|
+
if (data === "@" || data === " ")
|
|
40
|
+
return "\x00";
|
|
41
|
+
if (data === "?")
|
|
42
|
+
return "\x7f";
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
export function ctrlBarSeq(seq) {
|
|
46
|
+
const cursor = /^\x1b[\[O]([A-DHF])$/.exec(seq);
|
|
47
|
+
if (cursor)
|
|
48
|
+
return "\x1b[1;5" + cursor[1];
|
|
49
|
+
const paged = /^\x1b\[(\d)~$/.exec(seq);
|
|
50
|
+
return paged ? "\x1b[" + paged[1] + ";5~" : seq;
|
|
51
|
+
}
|
|
15
52
|
/**
|
|
16
53
|
* BN's ONE page: the Conversations list and the terminal each conversation opens in. Every conversation opens on the
|
|
17
54
|
* provider's own full interactive CLI — its slash commands, prompts and menus answered by the real CLI — whether MCP or
|
|
@@ -25,7 +62,7 @@ export function terminalHtml() {
|
|
|
25
62
|
const fit = asset("fit.js", "@xterm/addon-fit/lib/addon-fit.js").replace(/<\/script/gi, "<\\/script");
|
|
26
63
|
const uni = asset("unicode11.js", "@xterm/addon-unicode11/lib/addon-unicode11.js").replace(/<\/script/gi, "<\\/script");
|
|
27
64
|
const css = asset("xterm.css", "@xterm/xterm/css/xterm.css");
|
|
28
|
-
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>BN native CLI</title>${ICON_HEAD}<style>${PAGE_STYLE}
|
|
65
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,interactive-widget=resizes-content"><title>BN native CLI</title>${ICON_HEAD}<style>${PAGE_STYLE}
|
|
29
66
|
${css}
|
|
30
67
|
html,body{overscroll-behavior-y:none;-webkit-text-size-adjust:100%;text-size-adjust:100%}
|
|
31
68
|
body{height:100dvh;margin:0;display:flex;flex-direction:column}header{flex-wrap:wrap}main{flex:1;min-height:0;padding:12px;overflow:hidden}main.scroll{overflow-y:auto}#terminal{height:100%;width:100%}.setup{display:flex;gap:8px;flex-wrap:wrap}.setup select,.setup input{font:inherit;padding:8px}
|
|
@@ -59,10 +96,14 @@ body.phone.term header>a,body.phone.term #convs,body.phone.term #logout,body.pho
|
|
|
59
96
|
body.phone.term header{overflow:visible;flex-wrap:nowrap}body.phone.term header h1{flex:1 1 0;min-width:0;max-width:none}
|
|
60
97
|
body.phone.term .setup.toolbar{flex-wrap:wrap;overflow:visible;gap:6px}body.phone .toolbar .lbl{display:none}body.phone .toolbar button{min-width:44px;justify-content:center}
|
|
61
98
|
body.phone.term #status{display:block;-webkit-line-clamp:unset;overflow:visible}
|
|
62
|
-
body.phone.term header,body.phone.term #status,body.phone.term .toolbar{zoom:var(--k,1)}
|
|
99
|
+
body.phone.term header,body.phone.term #status,body.phone.term .toolbar,body.phone.term #keybar{zoom:var(--k,1)}
|
|
100
|
+
#keybar{display:none;flex-wrap:wrap;gap:4px;padding:4px 6px;background:#101217;border-top:1px solid #2a303c}
|
|
101
|
+
body.phone.term #keybar{display:flex}
|
|
102
|
+
#keybar button{flex:1 1 0;min-width:40px;height:32px;min-height:32px;padding:0 4px;font-size:13px;line-height:1;justify-content:center;touch-action:manipulation;-webkit-user-select:none;user-select:none}
|
|
103
|
+
#keybar button.armed{background:#2f6b45;border-color:#7ee2a8;color:#fff}
|
|
63
104
|
</style></head><body><header><button id="back" hidden>Back</button><h1 id="title">Conversations</h1><a href="/settings" style="color:inherit">⚙️ Settings</a><a href="/public-access" style="color:inherit">🌐 Public access</a><button id="newagent" hidden>+ New Agent</button><button id="convs" hidden title="Back to the live Conversations list">📋 Conversations</button><button id="logout" hidden>🚪 Logout</button></header>
|
|
64
|
-
${servingLine()}<div id="status" role="status" hidden></div><main id="main"></main>
|
|
65
|
-
<script>${js}
|
|
105
|
+
${servingLine()}<div id="status" role="status" hidden></div><main id="main"></main><div id="keybar" hidden></div>
|
|
106
|
+
<script>${CONNECTION_SOURCE}</script><script>${js}
|
|
66
107
|
${fit}
|
|
67
108
|
${uni}</script><script>${PASSKEY_SCRIPT}
|
|
68
109
|
${SIGN_IN_SCRIPT}
|
|
@@ -70,6 +111,9 @@ var main=document.getElementById("main"),note=document.getElementById("status"),
|
|
|
70
111
|
var btnBack=document.getElementById("back");
|
|
71
112
|
var btnNew=document.getElementById("newagent"),btnConvs=document.getElementById("convs");
|
|
72
113
|
// A phone is a touch screen no wider than 600px on its short side. Its normal mode lays the page out at the screen's own width; its desktop-site mode lays it out wider and shrinks it to the glass, so everything the page draws outside the terminal is scaled up by that ratio and the terminal's font with it.
|
|
114
|
+
var ctrlByte=${ctrlByte.toString()};
|
|
115
|
+
var ctrlBarSeq=${ctrlBarSeq.toString()};
|
|
116
|
+
var KEY_BAR=${JSON.stringify(KEY_BAR)};
|
|
73
117
|
var phone,phoneScale,refit=function(){};
|
|
74
118
|
function sizePhone(){
|
|
75
119
|
phone=matchMedia("(pointer:coarse)").matches&&Math.min(screen.width,screen.height)<=600;phoneScale=phone?Math.min(3,Math.max(1,innerWidth/screen.width)):1;
|
|
@@ -78,6 +122,7 @@ function sizePhone(){
|
|
|
78
122
|
}
|
|
79
123
|
var view=0,sent={},listResize=null,terminal,fitAddon,socket,reconnect,observer,arrival=null;
|
|
80
124
|
sizePhone();window.addEventListener("resize",sizePhone);
|
|
125
|
+
if(window.visualViewport){var fitKeyboard=function(){document.body.style.height=phone?visualViewport.height+"px":"";};visualViewport.addEventListener("resize",fitKeyboard);fitKeyboard();}
|
|
81
126
|
var AGENTS = ${JSON.stringify(PROVIDER_CHOICES)};
|
|
82
127
|
var storedStamp = ${storedStamp.toString()};
|
|
83
128
|
// The panel that hosts this page (#2726) hands its token over once in the URL fragment, which no request and no
|
|
@@ -97,7 +142,7 @@ function tool(icon,label,cls){var b=el("button",cls,icon);b.append(" ",el("span"
|
|
|
97
142
|
|
|
98
143
|
function show(name,heading){
|
|
99
144
|
view++;
|
|
100
|
-
if(name!=="terminal"){clearTimeout(reconnect);if(socket){socket.onclose=null;socket.close();socket=null;}if(observer){observer.disconnect();observer=null;}if(terminal){terminal.dispose();terminal=null;}main.style.display="";main.style.flexDirection="";}
|
|
145
|
+
if(name!=="terminal"){window.bullseyeConnection.live();clearTimeout(reconnect);if(socket){socket.onclose=null;socket.close();socket=null;}if(observer){observer.disconnect();observer=null;}document.getElementById("keybar").hidden=true;if(terminal){terminal.dispose();terminal=null;}main.style.display="";main.style.flexDirection="";}
|
|
101
146
|
title.textContent=heading;
|
|
102
147
|
var inList=name==="list";
|
|
103
148
|
btnBack.hidden=inList||name==="signin";
|
|
@@ -115,7 +160,7 @@ function show(name,heading){
|
|
|
115
160
|
return view;
|
|
116
161
|
}
|
|
117
162
|
|
|
118
|
-
function scoped(h){if(scope!==null)h["x-bullseye-project"]=scope;return h}async function api(method,path,body,signal){var response=await fetch(path,{method:method,headers:scoped({authorization:"Bearer "+token,"content-type":"application/json"}),body:body===undefined?undefined:JSON.stringify(body),signal:signal});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 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 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;}
|
|
119
164
|
function fail(error){note.textContent=error.message;}
|
|
120
165
|
function ordered(id,act,body){if(!socket||socket.readyState!==WebSocket.OPEN)return;socket.send(JSON.stringify(Object.assign({kind:act},body)));}
|
|
121
166
|
/** The last folder of a path, so a row names its project without printing the whole path. */
|
|
@@ -315,8 +360,18 @@ async function cliAttach(id,origin){
|
|
|
315
360
|
if(!files.length)return;
|
|
316
361
|
event.preventDefault();event.stopImmediatePropagation();upload(files);term.focus();
|
|
317
362
|
},true);
|
|
318
|
-
var
|
|
319
|
-
|
|
363
|
+
var keybar=document.getElementById("keybar"),ctrlHeld=false,ctrlKey=null;
|
|
364
|
+
function disarm(){ctrlHeld=false;ctrlKey.classList.remove("armed");}
|
|
365
|
+
function sendKey(data){if(ctrlHeld){disarm();data=ctrlBarSeq(data);}ordered(id,"input",{data:data});}
|
|
366
|
+
keybar.replaceChildren();keybar.hidden=false;
|
|
367
|
+
KEY_BAR.slice(0,7).concat([{id:"ctrl",label:"Ctrl",title:"Ctrl (sticky)"}],KEY_BAR.slice(7)).forEach(function(key){
|
|
368
|
+
var b=el("button","",key.label);b.setAttribute("aria-label",key.title);b.type="button";
|
|
369
|
+
var keep=function(event){event.preventDefault();};b.addEventListener("pointerdown",keep);b.addEventListener("mousedown",keep);
|
|
370
|
+
if(key.id==="ctrl"){ctrlKey=b;b.onclick=function(){ctrlHeld=!ctrlHeld;b.classList.toggle("armed",ctrlHeld);term.focus();};}
|
|
371
|
+
else b.onclick=function(){sendKey(key.seq[term.modes.applicationCursorKeysMode?1:0]);term.focus();};
|
|
372
|
+
keybar.append(b);
|
|
373
|
+
});
|
|
374
|
+
term.onData(function(data){if(ctrlHeld&&data.length===1){disarm();data=ctrlByte(data);}ordered(id,"input",{data:data});});term.onBinary(function(data){ordered(id,"input",{data:btoa(data),binary:true});});
|
|
320
375
|
refit=function(){if(mine!==view||!socket||socket.readyState!==WebSocket.OPEN)return;fitAddon.fit();ordered(id,"resize",{cols:term.cols,rows:term.rows});};
|
|
321
376
|
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();};
|
|
322
377
|
reattach.onclick=function(){cliAttach(id,origin);};
|
|
@@ -325,12 +380,13 @@ async function cliAttach(id,origin){
|
|
|
325
380
|
observer.observe(host);
|
|
326
381
|
function connect(){
|
|
327
382
|
if(mine!==view)return;
|
|
383
|
+
term.options.disableStdin=true;
|
|
328
384
|
var ws=new WebSocket((location.protocol==="https:"?"wss://":"ws://")+location.host+"/v1/terminals/"+id+"/ws",["bn-terminal","bn-bearer."+token]);socket=ws;
|
|
329
385
|
var frames=Promise.resolve();
|
|
330
|
-
ws.onopen=function(){if(mine!==view){ws.close();return;}fitAddon.fit();ordered(id,"resize",{cols:term.cols,rows:term.rows});
|
|
386
|
+
ws.onopen=function(){if(mine!==view){ws.close();return;}window.bullseyeConnection.live();term.options.disableStdin=false;fitAddon.fit();ordered(id,"resize",{cols:term.cols,rows:term.rows});term.focus();};
|
|
331
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);};
|
|
332
|
-
ws.onclose=function(event){if(mine!==view)return;
|
|
333
|
-
ws.onerror=function(){note.textContent="Terminal connection failed. Reconnecting…";};
|
|
388
|
+
ws.onclose=function(event){if(mine!==view)return;term.options.disableStdin=true;if(event.code===1000){window.bullseyeConnection.live();note.textContent="CLI ended.";return;}if(event.code===1008){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;}window.bullseyeConnection.reconnecting("the terminal connection to the CLI",1000);note.textContent="Disconnected. Reattaching to the same CLI…";reconnect=setTimeout(connect,1000);};
|
|
389
|
+
ws.onerror=function(){window.bullseyeConnection.reconnecting("the terminal connection to the CLI",1000);note.textContent="Terminal connection failed. Reconnecting…";};
|
|
334
390
|
}
|
|
335
391
|
connect();
|
|
336
392
|
}
|
package/dist/notify.js
CHANGED
|
@@ -1723,8 +1723,6 @@ async function slackPost(text) {
|
|
|
1723
1723
|
}
|
|
1724
1724
|
}
|
|
1725
1725
|
async function slackPostInThread(token, channel, threadTs, text) {
|
|
1726
|
-
if (masterMuted())
|
|
1727
|
-
return;
|
|
1728
1726
|
const r = await fetch(`${SLACK_API_BASE}/chat.postMessage`, {
|
|
1729
1727
|
method: "POST",
|
|
1730
1728
|
headers: { "Content-Type": "application/json; charset=utf-8", Authorization: `Bearer ${token}` },
|
|
@@ -2493,6 +2493,7 @@ export const blockedAct = (worker) => (worker.needs === undefined ? "an act its
|
|
|
2493
2493
|
export function workerRunner(worker) {
|
|
2494
2494
|
return worker.blocked === true ? `${worker.provider} worker, stopped until it gets ${blockedAct(worker)}` : `${worker.provider} worker`;
|
|
2495
2495
|
}
|
|
2496
|
+
const STOP_AUTHOR_WORDS = { press: "his ⏸ Stop press", emergency: "emergency stop of every board, not his press", caller: "a caller of the stop verb, not his press" };
|
|
2496
2497
|
export const storyQueueDir = (board) => path.join(board, ".fleetview", "queue");
|
|
2497
2498
|
const requestFile = (board, id) => path.join(storyQueueDir(board), "requests", `${id}.json`);
|
|
2498
2499
|
const ackFile = (board, id) => path.join(storyQueueDir(board), "acks", `${id}.json`);
|
|
@@ -3027,8 +3028,10 @@ function applyRequest(store, r, now) {
|
|
|
3027
3028
|
const authority = queueStartRequestId(e);
|
|
3028
3029
|
const newPress = r.eligible && r.origin === "press" && intentAt !== undefined && intentAt > priorAuthority;
|
|
3029
3030
|
e.startRequestId = newPress ? r.requestId : authority;
|
|
3030
|
-
if (newPress)
|
|
3031
|
+
if (newPress) {
|
|
3031
3032
|
e.startPressedAt = intentAt;
|
|
3033
|
+
delete e.accountRefusals;
|
|
3034
|
+
}
|
|
3032
3035
|
const said = e.why;
|
|
3033
3036
|
Object.assign(e, fields, { requestId: r.requestId });
|
|
3034
3037
|
if (newPress && r.forced === undefined) {
|
|
@@ -3036,7 +3039,12 @@ function applyRequest(store, r, now) {
|
|
|
3036
3039
|
delete e.forcedBy;
|
|
3037
3040
|
delete e.forceStartedAt;
|
|
3038
3041
|
}
|
|
3039
|
-
|
|
3042
|
+
const heldPlace = moved && e.manual !== undefined;
|
|
3043
|
+
if (moved) {
|
|
3044
|
+
delete e.manual;
|
|
3045
|
+
delete e.ordered;
|
|
3046
|
+
}
|
|
3047
|
+
step(e, now, "updated", moved ? `priority and size ${before} → ${r.pri} ${r.effort}${heldPlace ? ", his placement is dropped and" : ","} its automatic place follows` : `request updated — ${r.why}`);
|
|
3040
3048
|
if (!r.eligible && (e.state === "queued" || e.state === "retrying" || e.state === "failed")) {
|
|
3041
3049
|
e.state = "withdrawn";
|
|
3042
3050
|
step(e, now, "withdrawn", r.why);
|
|
@@ -3061,6 +3069,7 @@ function applyRequest(store, r, now) {
|
|
|
3061
3069
|
if (r.origin === "press" || e.state === "done")
|
|
3062
3070
|
e.attempts = 0;
|
|
3063
3071
|
delete e.accountRefused;
|
|
3072
|
+
delete e.accountRefusals;
|
|
3064
3073
|
if (e.handStop !== undefined && e.worker !== undefined)
|
|
3065
3074
|
e.worker.parkedAt = now - wakeDelayMs(e.worker.wakes ?? 0);
|
|
3066
3075
|
// NULL-OK: field session is OPTIONAL and therefore it is ok to check for NULL
|
|
@@ -3212,7 +3221,7 @@ export const REARM_DOUBLINGS = 2;
|
|
|
3212
3221
|
// GATE: how long a done story's archived Claude Code conversation is kept after its archive — past it the queue deletes every file of it, and a story that comes back later starts afresh
|
|
3213
3222
|
export const ARCHIVE_KEPT_DAYS = 7;
|
|
3214
3223
|
/** 🔴 #4418 — a provider's HTTP 402 refusal, in the words its CLI reports it: the account the worker billed has no money or quota left, which no re-send to that account changes. */
|
|
3215
|
-
const ACCOUNT_REFUSAL = /API Error: 402\b|\b402 (?:Payment Required|Insufficient Balance|You need positive balance|You have exceeded your monthly quota)|hit your (?:weekly|5-hour|five-hour|session|usage|monthly)? ?limit|Credit balance is too low|issue with the selected model
|
|
3224
|
+
const ACCOUNT_REFUSAL = /API Error: 402\b|\b402 (?:Payment Required|Insufficient Balance|You need positive balance|You have exceeded your monthly quota)|hit your (?:weekly|5-hour|five-hour|session|usage|monthly)? ?limit|Credit balance is too low|issue with the selected model \(claude-|account (?:has been |is )?(?:suspended|disabled)/i;
|
|
3216
3225
|
/** 🔴 #4123 — how long after the queue gave up on a story it is offered to the line again. */
|
|
3217
3226
|
export const rearmDelayMs = (attempts) => REARM_BASE_MS * 2 ** Math.min(Math.max(attempts - WORKER_ATTEMPTS, 0), REARM_DOUBLINGS);
|
|
3218
3227
|
/** The acks the passes' requests call for: one per request read, carrying its entry's state and place, rewritten only when one of them changed. */
|
|
@@ -3282,6 +3291,8 @@ function noteCarried(e, reading, now) {
|
|
|
3282
3291
|
}
|
|
3283
3292
|
/** A worker that ended with its story still open: started again after its backoff, stopped in `failed` past {@link WORKER_ATTEMPTS}, or at once when its provider refused it as the box stands (`retried` false), read again after the first backoff. */
|
|
3284
3293
|
function afterWorker(e, now, why, retried = true, refund = false) {
|
|
3294
|
+
if (!ACCOUNT_REFUSAL.test(why))
|
|
3295
|
+
delete e.accountRefusals;
|
|
3285
3296
|
if (!e.eligible) {
|
|
3286
3297
|
e.state = "withdrawn";
|
|
3287
3298
|
step(e, now, "withdrawn", e.why);
|
|
@@ -3292,6 +3303,7 @@ function afterWorker(e, now, why, retried = true, refund = false) {
|
|
|
3292
3303
|
e.state = "failed";
|
|
3293
3304
|
delete e.nextTryAt;
|
|
3294
3305
|
e.accountRefused = { at: now, why };
|
|
3306
|
+
e.accountRefusals = (e.accountRefusals ?? 0) + 1;
|
|
3295
3307
|
e.why = `${why} — a refusal about the money on the account it billed, not about the story: nothing starts it again until its start would land on a subscription with room, or his Start press`;
|
|
3296
3308
|
step(e, now, "failed", e.why);
|
|
3297
3309
|
}
|
|
@@ -3526,6 +3538,7 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
3526
3538
|
e.state = "queued";
|
|
3527
3539
|
e.attempts = 0;
|
|
3528
3540
|
delete e.accountRefused;
|
|
3541
|
+
delete e.accountRefusals;
|
|
3529
3542
|
delete e.nextTryAt;
|
|
3530
3543
|
e.why = "its story is an open row on the board again";
|
|
3531
3544
|
delete e.worker?.archiveRefused;
|
|
@@ -3607,12 +3620,16 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
3607
3620
|
continue;
|
|
3608
3621
|
// NULL-OK: field accountRefused is OPTIONAL and therefore it is ok to check for NULL
|
|
3609
3622
|
if (e.accountRefused !== undefined) {
|
|
3623
|
+
// NULL-OK: field accountRefusals is OPTIONAL and therefore it is ok to check for NULL
|
|
3624
|
+
const refusals = e.accountRefusals ?? 1;
|
|
3625
|
+
if (now - e.accountRefused.at < (refusals <= 1 ? RETRY_BASE_MS : rearmDelayMs(WORKER_ATTEMPTS + refusals - 2)))
|
|
3626
|
+
continue;
|
|
3610
3627
|
// NULL-OK: field noRoomForStart is OPTIONAL and therefore it is ok to check for NULL
|
|
3611
3628
|
const noRoom = world.noRoomForStart === undefined ? "this FleetView cannot tell where its next start would land" : await world.noRoomForStart(e);
|
|
3612
3629
|
// NULL-OK: field noRoom is OPTIONAL and therefore it is ok to check for NULL
|
|
3613
3630
|
if (noRoom !== undefined) {
|
|
3614
3631
|
e.accountRefused.at = now;
|
|
3615
|
-
const waits = `${e.accountRefused.why} — it waits failed, read again
|
|
3632
|
+
const waits = `${e.accountRefused.why} — it waits failed, read again when its wait ends: ${noRoom}`;
|
|
3616
3633
|
if (e.why !== waits) {
|
|
3617
3634
|
e.why = waits;
|
|
3618
3635
|
step(e, now, "held-back", waits);
|
|
@@ -3937,14 +3954,13 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
3937
3954
|
}
|
|
3938
3955
|
save();
|
|
3939
3956
|
// NULL-OK: field stopped is OPTIONAL and therefore it is ok to check for NULL
|
|
3940
|
-
const halted = store.stopped === undefined ? undefined : `the queue is stopped (${store.stopped.by}), so nothing more starts or wakes until ▶ Run`;
|
|
3957
|
+
const halted = store.stopped === undefined ? undefined : `the queue is stopped (${store.stopped.by}; ${store.stopped.author === undefined ? "author not recorded" : STOP_AUTHOR_WORDS[store.stopped.author]}), so nothing more starts or wakes until ▶ Run`;
|
|
3941
3958
|
const unscheduled = autoStartHeld(board);
|
|
3942
3959
|
const heldWhy = (e) => {
|
|
3943
3960
|
const manual = unscheduled !== undefined && !hisOwn(e) ? unscheduled : undefined;
|
|
3944
3961
|
// NULL-OK: field halted is OPTIONAL and therefore it is ok to check for NULL
|
|
3945
3962
|
return e.forced === true ? manual : halted ?? manual;
|
|
3946
3963
|
};
|
|
3947
|
-
let lanes = world.lanesRunning();
|
|
3948
3964
|
for (const e of queueOrder(store)) {
|
|
3949
3965
|
try {
|
|
3950
3966
|
const sessionId = wakeable.get(e);
|
|
@@ -3977,7 +3993,6 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
3977
3993
|
save();
|
|
3978
3994
|
continue;
|
|
3979
3995
|
}
|
|
3980
|
-
lanes += 1;
|
|
3981
3996
|
const wakes = (parked.wakes ?? 0) + 1;
|
|
3982
3997
|
try {
|
|
3983
3998
|
const woken = await world.wake(e, board, sessionId, wakeMessage(e.storyId), worker => { e.worker = worker; save(); });
|
|
@@ -4116,7 +4131,6 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
4116
4131
|
continue;
|
|
4117
4132
|
}
|
|
4118
4133
|
}
|
|
4119
|
-
lanes += 1;
|
|
4120
4134
|
world.seat(e);
|
|
4121
4135
|
// NULL-OK: field forcedBy is OPTIONAL and therefore it is ok to check for NULL
|
|
4122
4136
|
const forcer = e.forcedBy ?? "an unrecorded presser's";
|
|
@@ -4124,6 +4138,8 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
4124
4138
|
const forced = e.forced === true && (halted !== undefined || unscheduled !== undefined);
|
|
4125
4139
|
// NULL-OK: field halted is OPTIONAL and therefore it is ok to check for NULL
|
|
4126
4140
|
const forcedPast = halted !== undefined ? "the queue's ⏸ Stop" : "AUTO START being off";
|
|
4141
|
+
if (e.forced === true)
|
|
4142
|
+
delete e.accountRefusals;
|
|
4127
4143
|
delete e.forced;
|
|
4128
4144
|
delete e.forcedBy;
|
|
4129
4145
|
e.state = "starting";
|
|
@@ -4242,6 +4258,7 @@ export async function pressStory(board, storyId, press, now, by, requestHandledB
|
|
|
4242
4258
|
e.state = "queued";
|
|
4243
4259
|
e.attempts = 0;
|
|
4244
4260
|
delete e.accountRefused;
|
|
4261
|
+
delete e.accountRefusals;
|
|
4245
4262
|
delete e.nextTryAt;
|
|
4246
4263
|
e.why = `${by} ↻ Retry put it back in line with its attempts reset`;
|
|
4247
4264
|
step(e, now, "retry", e.why);
|
|
@@ -4328,16 +4345,16 @@ function pressedFor(e) {
|
|
|
4328
4345
|
return e.startPressedAt > (e.landedAt ?? e.worker?.startedAt ?? -Infinity);
|
|
4329
4346
|
}
|
|
4330
4347
|
/** 🔴 #4156 — his ▶ Run or ⏸ Stop on the board's queue: stopped, nothing more starts or wakes until he runs it again; workers already running carry on. Answers whether it changed. */
|
|
4331
|
-
export async function setStoryQueueStopped(board, stopped, by, now) {
|
|
4348
|
+
export async function setStoryQueueStopped(board, stopped, by, now, author = "caller") {
|
|
4332
4349
|
return withQueueLock(board, now, async () => {
|
|
4333
4350
|
const store = readQueueStore(board);
|
|
4334
4351
|
// NULL-OK: field stopped is OPTIONAL and therefore it is ok to check for NULL
|
|
4335
4352
|
if ((store.stopped !== undefined) === stopped)
|
|
4336
4353
|
return false;
|
|
4337
4354
|
if (stopped)
|
|
4338
|
-
store.stopped = { at: now, by };
|
|
4355
|
+
store.stopped = { at: now, by, author };
|
|
4339
4356
|
else {
|
|
4340
|
-
store.lifted = { at: now, by, stoppedBy: store.stopped.by };
|
|
4357
|
+
store.lifted = { at: now, by, stoppedBy: store.stopped.by, stoppedAuthor: store.stopped.author };
|
|
4341
4358
|
delete store.stopped;
|
|
4342
4359
|
}
|
|
4343
4360
|
writeStore(board, store);
|
|
@@ -30,7 +30,6 @@ export class GatewayError extends Error {
|
|
|
30
30
|
/** The service's own store for the agent-conversation On/Off switch, beside config.json in the config dir: BN's page flips it, this process reads it, and BullseyeSync carries it to every machine. */
|
|
31
31
|
export const CONVERSATION_SWITCH_FILE = "conversation-switch.json";
|
|
32
32
|
export const CONVERSATION_OFF_MESSAGE = "The BN agent conversation is switched off. Turn the On switch beside Agent conversations on BN's Settings page to use it; nothing was started.";
|
|
33
|
-
export const CONVERSATION_MUTED_MESSAGE = "BN is muted: Mute everything is On in the BN Notify tab, so nothing was started and nothing is sent.";
|
|
34
33
|
// GATE: the longest a read may wait for a new event, one second under the 55 s BLOCKING_TOOL_MAX_SECONDS in notify.ts so no call is held past it.
|
|
35
34
|
export const MAX_WAIT_SECONDS = 54;
|
|
36
35
|
/** #4230/#4231 — whether `name`'s agents are started by the OTHER owner now (the agent cluster for BN's owner, the fleet for the cluster's), so this owner starts none of them; an unread authority refuses the start. */
|
|
@@ -90,9 +89,9 @@ export function createConversationStore(host, registry) {
|
|
|
90
89
|
if (conversationEnabled() !== enabled)
|
|
91
90
|
throw new Error(`${switchPath()} did not hold — wrote ${enabled}, read back ${!enabled}`);
|
|
92
91
|
}
|
|
93
|
-
/** Why no conversation may run right now, or undefined when one may: Mute everything
|
|
92
|
+
/** Why no conversation may run right now, or undefined when one may: Mute everything never gates a conversation. */
|
|
94
93
|
function conversationRefusal() {
|
|
95
|
-
return
|
|
94
|
+
return conversationEnabled() ? undefined : CONVERSATION_OFF_MESSAGE;
|
|
96
95
|
}
|
|
97
96
|
function requireConversationEnabled() {
|
|
98
97
|
const why = conversationRefusal();
|
|
@@ -49,7 +49,7 @@ export function sessionDriverClass(runtime) {
|
|
|
49
49
|
const GAVE_UP = "❌ BN restarted under this message again and again — that answer was lost. Send the message again.";
|
|
50
50
|
/** What the resumed turn is told before the message it was cut off on. */
|
|
51
51
|
const RESUME_PREAMBLE = "(BN restarted while you were working on the message below, and your work on it was cut off. If this session's history shows what you had already done for it, carry on from where you stopped rather than starting over, then answer it.)";
|
|
52
|
-
// GATE: the longest the driver waits before trying again to warm a spare agent once no spare is standing — after its process died, or an open was refused because BN is switched off,
|
|
52
|
+
// GATE: the longest the driver waits before trying again to warm a spare agent once no spare is standing — after its process died, or an open was refused because BN is switched off, or the project it is needed in holds no board; at the boundary the next beat tries again.
|
|
53
53
|
const SPARE_RETRY_MS = 10_000;
|
|
54
54
|
/** #4230/#4231 — refuses the start of `name`'s agent when this owner does not make it: the other owner starts that provider now, or the ownership authority is unread. */
|
|
55
55
|
function refuseClusterStart(name) {
|
|
@@ -919,11 +919,13 @@ function readOpencodeModel(home) {
|
|
|
919
919
|
function writeOpencodeModel(home, model) {
|
|
920
920
|
writeProviderField(home, OPENCODE_PROVIDER, "model", model);
|
|
921
921
|
}
|
|
922
|
-
// GATE: the key kinds OpenCode is handed, each with the OpenCode provider it names, the ONE environment variable that carries the key and the
|
|
923
|
-
// OpenCode speaks
|
|
922
|
+
// GATE: the key kinds OpenCode is handed, each with the OpenCode provider it names, the ONE environment variable that carries the key and the address variables it is sent with; a key of any other kind is never offered to OpenCode
|
|
923
|
+
// OpenCode speaks Anthropic Messages for the anthropic provider and OpenAI Chat Completions for every other one, and its own catalogue names deepinfra and deepseek as providers that know their own address, so those two carry none. The provider named here must be the one whose wire format the key's vendor answers: an OpenAI address handed to the anthropic provider (or the reverse) is a key OpenCode cannot reach.
|
|
924
924
|
const OPENCODE_KEY_KINDS = Object.freeze({
|
|
925
|
-
"claude-api": Object.freeze({ provider: "anthropic", env: "ANTHROPIC_API_KEY",
|
|
926
|
-
"codex-api": Object.freeze({ provider: "openai", env: "OPENAI_API_KEY",
|
|
925
|
+
"claude-api": Object.freeze({ provider: "anthropic", env: "ANTHROPIC_API_KEY", address: Object.freeze({ ANTHROPIC_BASE_URL: "https://api.anthropic.com/v1" }) }),
|
|
926
|
+
"codex-api": Object.freeze({ provider: "openai", env: "OPENAI_API_KEY", address: Object.freeze({ OPENAI_BASE_URL: "https://api.openai.com/v1" }) }),
|
|
927
|
+
deepinfra: Object.freeze({ provider: "deepinfra", env: "DEEPINFRA_API_KEY", address: Object.freeze({}) }),
|
|
928
|
+
deepseek: Object.freeze({ provider: "deepseek", env: "DEEPSEEK_API_KEY", address: Object.freeze({}) }),
|
|
927
929
|
});
|
|
928
930
|
const OPENCODE_FREE_ID = "opencode-free";
|
|
929
931
|
/** OpenCode's own model catalogue, the file the CLI keeps from models.dev — where its free tier's models are named. */
|
|
@@ -1181,7 +1183,7 @@ function opencodeKeyRoute(home, wanted, now = Date.now(), identities = identitie
|
|
|
1181
1183
|
passed.push(`${named}: ${bare === undefined ? "DeepAgent allows it no model" : `DeepAgent does not allow it ${wanted}`}`);
|
|
1182
1184
|
continue;
|
|
1183
1185
|
}
|
|
1184
|
-
return { identityId: id, named, model: `${kind.provider}/${model}`, env: { [kind.env]: key,
|
|
1186
|
+
return { identityId: id, named, model: `${kind.provider}/${model}`, env: { [kind.env]: key, ...kind.address, ...storeEnv } };
|
|
1185
1187
|
}
|
|
1186
1188
|
throw new NoOpenCodeKey(`no key DeepAgent holds can run OpenCode now — ${passed.join("; ") || "its OpenCode key plan names no key"}`);
|
|
1187
1189
|
}
|
|
@@ -2009,7 +2011,18 @@ function claudeSubscriptions(identities, Failure = Error) {
|
|
|
2009
2011
|
function boxClaudeSubscriptions() {
|
|
2010
2012
|
return claudeSubscriptions(deepagentSettings().values[IDENTITY_RECORDS]);
|
|
2011
2013
|
}
|
|
2014
|
+
/**
|
|
2015
|
+
* The credits a DeepInfra account still holds, from its /payment/checklist reply's two dollar figures, as its own billing page computes them.
|
|
2016
|
+
* @param {number} stripeBalance
|
|
2017
|
+
* @param {number} recent
|
|
2018
|
+
* @returns {{ dollars: number, text: string }}
|
|
2019
|
+
*/
|
|
2020
|
+
function deepinfraCredits(stripeBalance, recent) {
|
|
2021
|
+
const dollars = -(stripeBalance + recent);
|
|
2022
|
+
return { dollars, text: (dollars < 0 ? "-$" : "$") + Math.abs(dollars).toFixed(2) };
|
|
2023
|
+
}
|
|
2012
2024
|
module.exports = {
|
|
2025
|
+
deepinfraCredits,
|
|
2013
2026
|
UnreadableSettings,
|
|
2014
2027
|
VSCODE_VARIANTS,
|
|
2015
2028
|
vscodeDataRoot,
|
|
@@ -5,7 +5,7 @@ const http = require("http");
|
|
|
5
5
|
const os = require("os");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const zlib = require("zlib");
|
|
8
|
-
const { SHIM_SOURCE, NATIVE_PICKER_SOURCE } = require("./webviewShim");
|
|
8
|
+
const { CONNECTION_SOURCE, SHIM_SOURCE, NATIVE_PICKER_SOURCE } = require("./webviewShim");
|
|
9
9
|
const { workspacesHere } = require("./workspaceList");
|
|
10
10
|
const WS_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
|
11
11
|
const TOKEN_PARAMETER = "bullseye-token";
|
|
@@ -1316,19 +1316,20 @@ function peekedRosterPage(label, home, back) {
|
|
|
1316
1316
|
function closedPage(extension, page) {
|
|
1317
1317
|
return `<!DOCTYPE html><html><head><meta charset="utf-8">${PHONE_VIEWPORT}<title>${escapeAttribute(extension)} · ${escapeAttribute(page.title)}</title></head>
|
|
1318
1318
|
<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>
|
|
1319
|
-
<script>(function () {
|
|
1319
|
+
<script>${CONNECTION_SOURCE}</script><script>(function () {
|
|
1320
1320
|
var opened = false;
|
|
1321
1321
|
var socket = new WebSocket((location.protocol === "https:" ? "wss:" : "ws:") + "//" + location.host + "/__bullseye/ws?page=${encodeURIComponent(page.name)}&peek=1");
|
|
1322
1322
|
function awaitHost() {
|
|
1323
|
+
window.bullseyeConnection.reconnecting("this page's live connection to its host", 250);
|
|
1323
1324
|
document.getElementById("said").textContent = "⏳ This page's host is not answering — this page reloads the moment it does";
|
|
1324
|
-
fetch("/__bullseye/health", { cache: "no-store" }).then(function (r) { if (r.ok) location.reload(); else if (r.status === 401) location.assign("/"); else setTimeout(awaitHost,
|
|
1325
|
+
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); });
|
|
1325
1326
|
}
|
|
1326
1327
|
socket.addEventListener("open", function () {
|
|
1327
1328
|
opened = true;
|
|
1328
1329
|
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(); });
|
|
1329
1330
|
});
|
|
1330
1331
|
socket.addEventListener("message", function (event) { if (JSON.parse(String(event.data)).type === "reload") location.reload(); });
|
|
1331
|
-
socket.addEventListener("close", function () { if (opened) awaitHost(); else document.getElementById("said").textContent = "⚠️ This page could not reach its host, so it cannot load the page when it opens — reload it to try again"; });
|
|
1332
|
+
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"; } });
|
|
1332
1333
|
})();</script></body></html>`;
|
|
1333
1334
|
}
|
|
1334
1335
|
function codeDefect(err) {
|
|
@@ -272,7 +272,148 @@ const PICKER_SOURCE = String.raw `
|
|
|
272
272
|
place(box);
|
|
273
273
|
}
|
|
274
274
|
`;
|
|
275
|
-
const
|
|
275
|
+
const CONNECTION_SOURCE = String.raw `(function () {
|
|
276
|
+
"use strict";
|
|
277
|
+
if (window.bullseyeConnection !== undefined) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
var BAR = "__bullseye-connection";
|
|
281
|
+
var MARKS = { reconnecting: "🔄 RECONNECTING", disconnected: "🔴 DISCONNECTED", live: "✅ LIVE" };
|
|
282
|
+
var COLOURS = { reconnecting: "#7a5200", disconnected: "#5a1d1d", live: "#1d5a2c" };
|
|
283
|
+
var current = null;
|
|
284
|
+
var ticker = 0;
|
|
285
|
+
var clearer = 0;
|
|
286
|
+
var dismissed = false;
|
|
287
|
+
var lastText = "";
|
|
288
|
+
|
|
289
|
+
function clock(at) {
|
|
290
|
+
return new Date(at).toLocaleTimeString([], { hour12: false });
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function reading() {
|
|
294
|
+
var now = Date.now();
|
|
295
|
+
var lines = ["What dropped: " + current.what, "Since: " + clock(current.since) + " (" + Math.round((now - current.since) / 1000) + " s ago)"];
|
|
296
|
+
if (current.state === "reconnecting" && current.retryAt !== undefined) {
|
|
297
|
+
lines.push("Next retry: " + (current.retryAt > now ? "in " + Math.ceil((current.retryAt - now) / 1000) + " s" : "now"));
|
|
298
|
+
} else if (current.state === "disconnected") {
|
|
299
|
+
lines.push("Next retry: none — " + (current.why || "reload this page to try again"));
|
|
300
|
+
} else if (current.state === "live") {
|
|
301
|
+
lines.push("Live again after " + Math.round((now - current.since) / 1000) + " s");
|
|
302
|
+
}
|
|
303
|
+
return lines.join("\n");
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function bar() {
|
|
307
|
+
var found = document.getElementById(BAR);
|
|
308
|
+
if (found !== null) {
|
|
309
|
+
return found;
|
|
310
|
+
}
|
|
311
|
+
found = document.createElement("div");
|
|
312
|
+
found.id = BAR;
|
|
313
|
+
found.setAttribute("role", "status");
|
|
314
|
+
found.style.cssText = "position:fixed;left:0;right:0;bottom:0;z-index:2147483647;display:flex;align-items:center;font:12px system-ui,sans-serif;color:#fff";
|
|
315
|
+
var word = document.createElement("span");
|
|
316
|
+
word.className = "__bullseye-notice-text";
|
|
317
|
+
word.style.cssText = "flex:1;min-width:0;padding:4px 10px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis";
|
|
318
|
+
var close = document.createElement("button");
|
|
319
|
+
close.type = "button";
|
|
320
|
+
close.textContent = "✕";
|
|
321
|
+
close.setAttribute("aria-label", "Dismiss");
|
|
322
|
+
close.style.cssText = "flex:none;width:40px;height:40px;border:0;background:none;color:inherit;font:16px system-ui,sans-serif;cursor:pointer";
|
|
323
|
+
close.addEventListener("click", function () {
|
|
324
|
+
dismissed = true;
|
|
325
|
+
found.style.display = "none";
|
|
326
|
+
});
|
|
327
|
+
word.addEventListener("click", function () {
|
|
328
|
+
word.style.whiteSpace = word.style.whiteSpace === "pre-wrap" ? "nowrap" : "pre-wrap";
|
|
329
|
+
paint();
|
|
330
|
+
});
|
|
331
|
+
found.appendChild(word);
|
|
332
|
+
found.appendChild(close);
|
|
333
|
+
document.body.appendChild(found);
|
|
334
|
+
return found;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function paint() {
|
|
338
|
+
var shown = bar();
|
|
339
|
+
shown.style.background = COLOURS[current.state];
|
|
340
|
+
var tip = reading();
|
|
341
|
+
var text = MARKS[current.state] + (shown.firstChild.style.whiteSpace === "pre-wrap" ? "\n" + tip : "");
|
|
342
|
+
if (text !== lastText) {
|
|
343
|
+
lastText = text;
|
|
344
|
+
shown.firstChild.textContent = text;
|
|
345
|
+
}
|
|
346
|
+
if (shown.firstChild.getAttribute("data-be-tip") !== tip) {
|
|
347
|
+
shown.firstChild.setAttribute("data-be-tip", tip);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
var VEIL = "__bullseye-connection-veil";
|
|
352
|
+
var stilled = [];
|
|
353
|
+
|
|
354
|
+
function block(state) {
|
|
355
|
+
var veil = document.getElementById(VEIL);
|
|
356
|
+
if (state === "live") {
|
|
357
|
+
if (veil !== null) {
|
|
358
|
+
veil.remove();
|
|
359
|
+
}
|
|
360
|
+
stilled.forEach(function (el) { el.inert = false; });
|
|
361
|
+
stilled = [];
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
if (veil === null) {
|
|
365
|
+
veil = document.createElement("div");
|
|
366
|
+
veil.id = VEIL;
|
|
367
|
+
veil.style.cssText = "position:fixed;inset:0;z-index:2147483646;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.55);cursor:not-allowed;font:600 20px system-ui,sans-serif;color:#fff;text-align:center;padding:16px";
|
|
368
|
+
document.body.appendChild(veil);
|
|
369
|
+
}
|
|
370
|
+
veil.textContent = MARKS[state];
|
|
371
|
+
Array.prototype.forEach.call(document.body.children, function (el) {
|
|
372
|
+
if (el.id !== BAR && el.id !== VEIL && !el.inert) {
|
|
373
|
+
el.inert = true;
|
|
374
|
+
stilled.push(el);
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function show(state, what, extra) {
|
|
380
|
+
window.clearTimeout(clearer);
|
|
381
|
+
var dropped = current !== null && current.state !== "live";
|
|
382
|
+
var shown = bar();
|
|
383
|
+
shown.style.display = dismissed ? "none" : "flex";
|
|
384
|
+
current = { state: state, what: what || (current && current.what) || "the live connection to this page's service", since: dropped ? current.since : Date.now(), retryAt: extra.retryAt, why: extra.why };
|
|
385
|
+
block(state);
|
|
386
|
+
paint();
|
|
387
|
+
window.clearInterval(ticker);
|
|
388
|
+
ticker = window.setInterval(paint, 1000);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
window.bullseyeConnection = {
|
|
392
|
+
reconnecting: function (what, retryInMs) {
|
|
393
|
+
show("reconnecting", what, { retryAt: Date.now() + retryInMs });
|
|
394
|
+
},
|
|
395
|
+
disconnected: function (what, why) {
|
|
396
|
+
show("disconnected", what, { why: why });
|
|
397
|
+
},
|
|
398
|
+
live: function () {
|
|
399
|
+
if (current === null || current.state === "live") {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
show("live", current.what, {});
|
|
403
|
+
window.clearInterval(ticker);
|
|
404
|
+
clearer = window.setTimeout(function () {
|
|
405
|
+
var shown = document.getElementById(BAR);
|
|
406
|
+
if (shown !== null) {
|
|
407
|
+
shown.remove();
|
|
408
|
+
}
|
|
409
|
+
current = null;
|
|
410
|
+
dismissed = false;
|
|
411
|
+
lastText = "";
|
|
412
|
+
}, 1000);
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
})();`;
|
|
416
|
+
const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
|
|
276
417
|
"use strict";
|
|
277
418
|
var script = document.currentScript;
|
|
278
419
|
var page = script.getAttribute("data-page");
|
|
@@ -310,18 +451,21 @@ const SHIM_SOURCE = String.raw `(function () {
|
|
|
310
451
|
}
|
|
311
452
|
|
|
312
453
|
` + PICKER_SOURCE + String.raw `
|
|
454
|
+
var WHAT = "this page's live connection to its service";
|
|
455
|
+
|
|
313
456
|
function awaitHost() {
|
|
314
|
-
|
|
457
|
+
window.bullseyeConnection.reconnecting(WHAT, 250);
|
|
315
458
|
window.fetch("/__bullseye/health", { cache: "no-store" }).then(function (response) {
|
|
316
459
|
if (response.ok) {
|
|
460
|
+
window.bullseyeConnection.live();
|
|
317
461
|
window.location.reload();
|
|
318
462
|
} else if (response.status === 401) {
|
|
319
463
|
window.location.assign("/");
|
|
320
464
|
} else {
|
|
321
|
-
window.setTimeout(awaitHost,
|
|
465
|
+
window.setTimeout(awaitHost, 250);
|
|
322
466
|
}
|
|
323
467
|
}, function () {
|
|
324
|
-
window.setTimeout(awaitHost,
|
|
468
|
+
window.setTimeout(awaitHost, 250);
|
|
325
469
|
});
|
|
326
470
|
}
|
|
327
471
|
|
|
@@ -383,12 +527,13 @@ const SHIM_SOURCE = String.raw `(function () {
|
|
|
383
527
|
socket.addEventListener("close", function () {
|
|
384
528
|
socket = null;
|
|
385
529
|
if (opened) {
|
|
386
|
-
window.
|
|
530
|
+
window.bullseyeConnection.reconnecting(WHAT, 250);
|
|
531
|
+
window.setTimeout(awaitHost, 250);
|
|
387
532
|
return;
|
|
388
533
|
}
|
|
389
534
|
window.fetch("/__bullseye/health", { cache: "no-store" }).then(function (response) {
|
|
390
535
|
if (response.ok) {
|
|
391
|
-
|
|
536
|
+
window.bullseyeConnection.disconnected(WHAT, "the host did not accept the connection — reload this page to try again");
|
|
392
537
|
} else {
|
|
393
538
|
awaitHost();
|
|
394
539
|
}
|
|
@@ -521,4 +666,4 @@ const NATIVE_PICKER_SOURCE = String.raw `(function () {
|
|
|
521
666
|
return api;
|
|
522
667
|
};
|
|
523
668
|
})();`;
|
|
524
|
-
module.exports = { SHIM_SOURCE, PICKER_PAGE_SOURCE, NATIVE_PICKER_SOURCE };
|
|
669
|
+
module.exports = { CONNECTION_SOURCE, SHIM_SOURCE, PICKER_PAGE_SOURCE, NATIVE_PICKER_SOURCE };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-notify-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.402",
|
|
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",
|