omni-notify-mcp 1.3.414 → 1.3.416
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/conversationOwner.js +15 -0
- package/dist/gateway/mcpDoor.js +4 -3
- package/dist/gateway/restDoor.js +3 -11
- package/dist/shared/webhost/autoSwitch.cjs +5 -1
- package/dist/shared/webhost/bullseyeWebHost.js +14 -148
- package/dist/shared/webhost/webviewShim.js +4 -38
- package/package.json +1 -1
|
@@ -4,6 +4,8 @@ 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";
|
|
7
|
+
import { GatewayError } from "../shared/conversation/conversations.js";
|
|
8
|
+
import { sameRoot } from "../shared/webhost/workspaceList.js";
|
|
7
9
|
import { FLEET_OWNER } from "../shared/providerOwnership.js";
|
|
8
10
|
function driverOptions() {
|
|
9
11
|
const bundledGuard = new URL("../scripts/shared/", import.meta.url);
|
|
@@ -124,3 +126,16 @@ export { AgentTurnFailed, agentEnv, nativeAgentEnv, nativeCliRefusal } from "../
|
|
|
124
126
|
export { CliSession, CliEnded, LoggedCliSession, folderKey, plain, sameText, endsWithTyped, tailOf, logRow } from "../shared/conversation/cliSession.js";
|
|
125
127
|
export { nativeCliInvocation } from "../shared/conversation/nativeCliInvocation.js";
|
|
126
128
|
export { archiveCodexThread } from "../shared/conversation/codexArchive.js";
|
|
129
|
+
/** #4471 — one conversation as the CLI page reads it (`GET /v1/conversations/{id}`) and `agent_status` answers: its record with title and lifecycle, the native CLI state (pid, input version, model, startup diagnostic, pending input) and whether a turn is running — the page and the tool read the one producer. */
|
|
130
|
+
export function conversationReading(meta) {
|
|
131
|
+
const native = conversationOwner.driver.nativeState(meta.id);
|
|
132
|
+
return { ...conversationOwner.store.describeConversation(meta), ...native, working: native.working || conversationOwner.store.turnInFlight(conversationOwner.store.readEvents(meta.id), meta) !== undefined };
|
|
133
|
+
}
|
|
134
|
+
/** #4471 — which agent CLIs can start in a project and why one cannot (`GET /v1/providers`, `agent_providers`): the project named exactly as a creation names it, refused for a scoped caller outside its own workspace. */
|
|
135
|
+
export function providerStartupReading(project, viewer) {
|
|
136
|
+
conversationOwner.store.requireConversationEnabled();
|
|
137
|
+
const folder = conversationOwner.store.namedProject(project);
|
|
138
|
+
if (viewer !== undefined && !sameRoot(conversationOwner.store.workspaceOf(folder), viewer.folder))
|
|
139
|
+
throw new GatewayError(403, "This provider startup reading belongs to another workspace");
|
|
140
|
+
return { providers: conversationOwner.driver.availability(folder) };
|
|
141
|
+
}
|
package/dist/gateway/mcpDoor.js
CHANGED
|
@@ -21,7 +21,7 @@ import { performance } from "perf_hooks";
|
|
|
21
21
|
import { z } from "zod";
|
|
22
22
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
23
23
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
24
|
-
import { GatewayError, MAX_WAIT_SECONDS, archiveConversation, deleteConversation, describeConversation, lastEventNumber, listProjects, createdOn, creationPending, openConversation, readConversation, routeAsk, requireConversationEnabled, sendToConversation, setConversationProject, shelvedConversations, stampWaitReturn, startConversation, stopConversation, unarchiveConversation, waitForEvents, waitForTurn, workspaceRoot, allowedProjects, requireOwnCli, scopedConversation, namedWorkspace, } from "./conversationOwner.js";
|
|
24
|
+
import { GatewayError, MAX_WAIT_SECONDS, conversationOwner, conversationReading, providerStartupReading, archiveConversation, deleteConversation, describeConversation, lastEventNumber, listProjects, createdOn, creationPending, openConversation, readConversation, routeAsk, requireConversationEnabled, sendToConversation, setConversationProject, shelvedConversations, stampWaitReturn, startConversation, stopConversation, unarchiveConversation, waitForEvents, waitForTurn, workspaceRoot, allowedProjects, requireOwnCli, scopedConversation, namedWorkspace, } from "./conversationOwner.js";
|
|
25
25
|
import { workspacesFile } from "../shared/webhost/workspaceList.js";
|
|
26
26
|
import { PROVIDER_NAMES } from "./conversationOwner.js";
|
|
27
27
|
import { iconsFor } from "./iconDoor.js";
|
|
@@ -300,7 +300,8 @@ function buildServer(caller, base, offer) {
|
|
|
300
300
|
}).then((result) => { row(outcome ?? `refused why=${result.content[0]?.text ?? "the call was refused"}`); return result; }, (err) => { row(outcome ?? `refused why=${err instanceof Error ? err.message : String(err)}`); throw err; });
|
|
301
301
|
});
|
|
302
302
|
server.tool("agent_project", `Sets or switches the project folder a conversation's agent works in — before its first message, or between any two turns, also after work in another project. The next turn's agent runs in that folder and writes to its board, while the conversation's id, its whole transcript and the agent itself stay: the same session carries on in the new folder with its earlier turns in hand, so this NEVER starts a new agent and never makes a new conversation. A switch is refused at two safe boundaries — while a turn is running, named with the running turn's number, and while a browser CLI is running the conversation's own session, because a running process is never moved under itself. Either refusal leaves the record on its old project.`, { id: z.string().min(1).describe("The conversation id agent_open or agent_start returned, or the 'conversation' agent_prompt returned"), project: projectField(offer).describe(`Exactly one of ${offer.either}, resolved under ${offer.under}; no path is accepted`) }, ({ id, project }) => act(() => setConversationProject(seen(id), project)));
|
|
303
|
-
server.tool("agent_status", "One conversation
|
|
303
|
+
server.tool("agent_status", "Read-only. One conversation exactly as the CLI page reads it: its project (absent until one is chosen), provider, model and state, its title (the name its session carries in Claude's session list), its lifecycle (active while a turn runs, is queued or waits on the user's answer; idle when open with no turn; completed once stopped or archived), beside (the conversation of the same connection it was opened next to, if any), and the native CLI state: working (a turn runs, also one typed straight into the CLI), pendingInput, nativePid, inputVersion (what agent_stop expectedInputVersion takes), nativeModel and startupDiagnostic. A conversation outside the caller's workspace is refused as not found.", { id: z.string().min(1) }, ({ id }) => act(() => conversationReading(scopedConversation(id, viewerNow()))));
|
|
304
|
+
server.tool("agent_providers", "Read-only. Which agent CLIs can start in a project and why one cannot, as the CLI page's New Agent reads it before offering a CLI: {providers:[{name, label, reason?}]}, reason present only when that CLI cannot start there. The project is named as a new conversation names it (exactly one of the listed projects); a caller scoped to one workspace is refused another workspace's project. Starts nothing and spends nothing.", { project: z.string().min(1).describe("Exactly one of the project names agent_projects lists") }, ({ project }) => act(() => providerStartupReading(project, viewerNow())));
|
|
304
305
|
server.tool("agent_stream", `Where to attach to a conversation's LIVE stream: what its agent shows AS IT HAPPENS, not only the finished reply that agent_prompt and agent_wait carry. Every conversation on claude, codex, copilot or opencode runs in ONE interactive CLI of its own — the same process the browser shows and agent_send types into — and this returns {conversation, url, after, console:true}, url being that CLI's own console output at /v1/terminals/<id>/console. Attach with a plain HTTP GET; the answer is a Server-Sent Events stream of frames {seq, ts, kind:"output", text, reset} carrying its raw screen bytes (its prompt, tool traces and any question it waits on). Reconnect with ?after=<seq> of the last frame you read and you are handed every byte past it. It is a read — it starts no agent, spends nothing and changes nothing.`, { id: z.string().min(1).describe("The conversation id agent_start, agent_prompt or agent_open returned"), after: z.number().int().min(0).optional().describe("The last frame seq you already have; the stream resumes past it") }, ({ id, after }) => act(() => {
|
|
305
306
|
seen(id);
|
|
306
307
|
requireOwnCli(id);
|
|
@@ -325,7 +326,7 @@ function buildServer(caller, base, offer) {
|
|
|
325
326
|
return { conversation: id, console: true, frames, seq: read.after, after: read.after };
|
|
326
327
|
}));
|
|
327
328
|
server.tool("agent_list", "Every agent conversation BN holds on this machine, newest first (conversations, not projects — agent_projects lists projects), each with its title, lifecycle (active, idle or completed) and beside as agent_status gives them. archived=true lists the archived ones instead; BN archives a conversation by itself once it has sat 8 hours with no turn in flight, and a message to it brings it back.", { archived: z.boolean().default(false).describe("true lists the Archived conversations instead of the default list") }, ({ archived }) => act(() => ({ conversations: shelvedConversations(archived ? "archived" : "active", viewerNow()).map(describeConversation) })));
|
|
328
|
-
server.tool("agent_stop", "Stop a conversation and free its agent; a later message resumes it.", { id: z.string().min(1) }, ({ id }) => act(() => stopConversation(seen(id))));
|
|
329
|
+
server.tool("agent_stop", "Stop a conversation and free its agent; a later message resumes it. Pass expectedConsumed (the conversation's consumed turn count) with expectedInputVersion (the inputVersion agent_status read) to stop it only if nothing newer arrived since that read — the same guarded Stop the REST door runs; a conversation with newer or unfinished work is refused and nothing is stopped.", { id: z.string().min(1), expectedConsumed: z.number().int().min(0).optional(), expectedInputVersion: z.string().optional() }, ({ id, expectedConsumed, expectedInputVersion }) => act(() => (expectedConsumed === undefined ? stopConversation(seen(id)) : conversationOwner.stopIfCurrent(seen(id), { expectedConsumed, expectedInputVersion: expectedInputVersion ?? null }))));
|
|
329
330
|
server.tool("agent_archive", "Archive a conversation: it is stopped and moved off the default list to the Archived list with its transcript kept. agent_list archived=true shows it; a message to it (agent_send or agent_prompt) brings it back and resumes it.", { id: z.string().min(1), restore: z.boolean().default(false).describe("true moves an archived conversation back to the default list instead") }, ({ id, restore }) => act(() => (seen(id), restore ? unarchiveConversation(id) : archiveConversation(id))));
|
|
330
331
|
server.tool("agent_delete", "Delete a conversation for good: a running agent is stopped first, then the conversation and its transcript are removed from BN. It cannot be undone — agent_archive keeps the transcript instead.", { id: z.string().min(1) }, ({ id }) => act(() => deleteConversation(seen(id))));
|
|
331
332
|
server.tool("agent_terminals", "The agent CLIs this person has open on this machine (what the CLI page lists) with the CLIs New Agent can open and whether each takes a model; id names one terminal and answers only its facts. A read — it starts nothing.", { id: z.string().min(1).optional().describe("One terminal's conversation id; without it every open terminal is listed beside the CLIs New Agent offers") }, ({ id }) => act(async () => (id === undefined ? scopedListing(await terminalListing(personId())) : (seen(id), nativeTerminal(personId(), id).info()))));
|
package/dist/gateway/restDoor.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* once a passkey is enrolled the gateway token is honoured only on a request from this machine.
|
|
10
10
|
*/
|
|
11
11
|
import { createServer } from "http";
|
|
12
|
-
import { GatewayError, archiveConversation, conversationOwner, deleteConversation, listProjects, monotonicMs, scopedConversation, viewerOfHeaders, createdOn, creatorOf, openConversation, readConversation, requireConversationEnabled, sendToConversation, setConversationProject, shelvedConversations, startConversation, stopConversation, unarchiveConversation, waitForEvents,
|
|
12
|
+
import { GatewayError, conversationReading, providerStartupReading, archiveConversation, conversationOwner, deleteConversation, listProjects, monotonicMs, scopedConversation, viewerOfHeaders, createdOn, creatorOf, openConversation, readConversation, requireConversationEnabled, sendToConversation, setConversationProject, shelvedConversations, startConversation, stopConversation, unarchiveConversation, waitForEvents, } from "./conversationOwner.js";
|
|
13
13
|
import { CHAT_HEADERS } from "./chatPage.js";
|
|
14
14
|
import { isIconPath, serveIcon } from "./iconDoor.js";
|
|
15
15
|
import { handleMcp } from "./mcpDoor.js";
|
|
@@ -20,7 +20,6 @@ import { conversationSwitchRead, panelState, saveConversationSwitch, saveSetting
|
|
|
20
20
|
import { PANEL_PAGES, panelHtml } from "./panelPage.js";
|
|
21
21
|
import { wizard } from "./publicAccess.js";
|
|
22
22
|
import { terminalHtml } from "./terminalPage.js";
|
|
23
|
-
import { AgentGateway } from "../agentGateway.js";
|
|
24
23
|
import { ServiceHost } from "../shared/webhost/bullseyeWebHost.js";
|
|
25
24
|
import { sameRoot, workspacesHere } from "../shared/webhost/workspaceList.js";
|
|
26
25
|
export const BAD_TOKEN_ERROR = "missing or wrong token";
|
|
@@ -128,12 +127,7 @@ async function route(req, url, arrivedAt) {
|
|
|
128
127
|
if (resource === "projects" && parts.length === 2 && method === "GET")
|
|
129
128
|
return { status: 200, body: listProjects(viewerOfHeaders(req.headers, fromThisMachine(req))) };
|
|
130
129
|
if (resource === "providers" && parts.length === 2 && method === "GET") {
|
|
131
|
-
|
|
132
|
-
const project = namedProject(url.searchParams.get("project"));
|
|
133
|
-
const viewer = viewerOfHeaders(req.headers, fromThisMachine(req));
|
|
134
|
-
if (viewer !== undefined && !sameRoot(workspaceOf(project), viewer.folder))
|
|
135
|
-
throw new GatewayError(403, "This provider startup reading belongs to another workspace");
|
|
136
|
-
return { status: 200, body: { providers: AgentGateway.instance().driver.availability(project) } };
|
|
130
|
+
return { status: 200, body: providerStartupReading(url.searchParams.get("project"), viewerOfHeaders(req.headers, fromThisMachine(req))) };
|
|
137
131
|
}
|
|
138
132
|
if (resource !== "conversations")
|
|
139
133
|
throw new GatewayError(404, "unknown route");
|
|
@@ -162,9 +156,7 @@ async function route(req, url, arrivedAt) {
|
|
|
162
156
|
}
|
|
163
157
|
else if (sub === undefined) {
|
|
164
158
|
if (method === "GET") {
|
|
165
|
-
|
|
166
|
-
const native = AgentGateway.instance().driver.nativeState(id);
|
|
167
|
-
return { status: 200, body: { ...current, ...native, working: native.working || turnInFlight(readEvents(id), current) !== undefined } };
|
|
159
|
+
return { status: 200, body: conversationReading(readConversation(id)) };
|
|
168
160
|
}
|
|
169
161
|
if (method === "DELETE") {
|
|
170
162
|
const expected = url.searchParams.get("expectedConsumed");
|
|
@@ -1005,7 +1005,11 @@ function identitiesHere() {
|
|
|
1005
1005
|
read = deepagentSettings();
|
|
1006
1006
|
}
|
|
1007
1007
|
catch (absent) {
|
|
1008
|
-
|
|
1008
|
+
const store = workspaceStore();
|
|
1009
|
+
// A checkout off the workspace list keeps machine-wide settings unread by design (savedSettings answers undefined for it): OpenCode is told that, never "no key".
|
|
1010
|
+
if (absent instanceof store.WorkspaceNotListed)
|
|
1011
|
+
throw new NoOpenCodeKey("the BullseyeVSC checkout is not on this machine's workspace list, so DeepAgent's keys are not read here and OpenCode is handed none — add it on Bullseye Control");
|
|
1012
|
+
if (!(absent instanceof store.SettingsUndefined))
|
|
1009
1013
|
throw absent;
|
|
1010
1014
|
throw new NoOpenCodeKey(`${absent.message}, so this machine holds no DeepAgent key OpenCode could be handed`);
|
|
1011
1015
|
}
|
|
@@ -47,9 +47,6 @@ const ACT_FORBIDDEN_HEADERS = ["origin", "referer", "forwarded", "x-forwarded-fo
|
|
|
47
47
|
function recordDirectory(extension) {
|
|
48
48
|
return path.join(os.homedir(), ".bullseye", "webhost", extension);
|
|
49
49
|
}
|
|
50
|
-
const WORKSPACE_FILE = path.join(os.homedir(), ".bullseye", "webhost", "workspace.json");
|
|
51
|
-
// GATE: a workspace pick body larger than this is answered 413 and never parsed.
|
|
52
|
-
const PICK_BODY_BYTES = 4_096;
|
|
53
50
|
// GATE: a page socket is pinged this often so no tunnel or carrier idles it out; one that sent nothing (not even the browser's automatic pong) for a whole beat is ended, and its page reconnects.
|
|
54
51
|
const SOCKET_BEAT_MS = 20_000;
|
|
55
52
|
/** Whether a parsed window record carries everything an entry address to that window needs. */
|
|
@@ -116,23 +113,6 @@ function workspacesServed(extension, base) {
|
|
|
116
113
|
}
|
|
117
114
|
return served;
|
|
118
115
|
}
|
|
119
|
-
/** The workspace Meni last picked on any page of this machine; empty only when he has not picked yet. A pick file that is not a label THROWS. */
|
|
120
|
-
function chosenWorkspace() {
|
|
121
|
-
if (!fs.existsSync(WORKSPACE_FILE)) {
|
|
122
|
-
return "";
|
|
123
|
-
}
|
|
124
|
-
const label = JSON.parse(fs.readFileSync(WORKSPACE_FILE, "utf8"))?.label;
|
|
125
|
-
if (typeof label !== "string") {
|
|
126
|
-
throw new TypeError(`${WORKSPACE_FILE} carries no workspace label`);
|
|
127
|
-
}
|
|
128
|
-
return label;
|
|
129
|
-
}
|
|
130
|
-
function saveChosenWorkspace(label) {
|
|
131
|
-
fs.mkdirSync(path.dirname(WORKSPACE_FILE), { recursive: true });
|
|
132
|
-
const staged = `${WORKSPACE_FILE}.${process.pid}.tmp`;
|
|
133
|
-
fs.writeFileSync(staged, JSON.stringify({ label }));
|
|
134
|
-
fs.renameSync(staged, WORKSPACE_FILE);
|
|
135
|
-
}
|
|
136
116
|
function framedPolicy(html, origin) {
|
|
137
117
|
return html.replace(/<meta\b[^>]*>/gi, (tag) => {
|
|
138
118
|
if (!/http-equiv\s*=\s*["']?Content-Security-Policy/i.test(tag))
|
|
@@ -151,28 +131,19 @@ function framedPolicy(html, origin) {
|
|
|
151
131
|
function servedWorkspace(page) {
|
|
152
132
|
// NULL-OK: field workspaces().get(label) is OPTIONAL and therefore it is ok to check for NULL
|
|
153
133
|
const addressOf = (label) => page.host.workspaces().get(label)?.[page.name];
|
|
154
|
-
|
|
134
|
+
let picked;
|
|
135
|
+
return {
|
|
155
136
|
framed: true,
|
|
156
|
-
chosenUnreadable: undefined,
|
|
157
137
|
read: () => {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
chosen = chosenWorkspace();
|
|
162
|
-
}
|
|
163
|
-
catch (err) {
|
|
164
|
-
if (!(err instanceof SyntaxError) && !(err instanceof TypeError))
|
|
165
|
-
throw err;
|
|
166
|
-
// OWNER: the panel's workspace read is this read's trigger root — a pick file that is not a label draws the window's own workspace with the reason beside it, and the next pick in the bar rewrites the file whole.
|
|
167
|
-
adapter.chosenUnreadable = err.message;
|
|
168
|
-
}
|
|
169
|
-
// NULL-OK: field addressOf(chosen) is OPTIONAL and therefore it is ok to check for NULL
|
|
170
|
-
const at = addressOf(chosen) ?? addressOf(page.host.label);
|
|
138
|
+
if (picked !== undefined)
|
|
139
|
+
return picked;
|
|
140
|
+
const at = addressOf(page.host.label);
|
|
171
141
|
return at === undefined ? new URLSearchParams() : new URL(at, "http://localhost").searchParams;
|
|
172
142
|
},
|
|
173
|
-
select: () => {
|
|
143
|
+
select: (search) => {
|
|
144
|
+
picked = new URLSearchParams(search);
|
|
145
|
+
},
|
|
174
146
|
};
|
|
175
|
-
return adapter;
|
|
176
147
|
}
|
|
177
148
|
function alive(pid) {
|
|
178
149
|
try {
|
|
@@ -376,7 +347,7 @@ class MirroredWebview {
|
|
|
376
347
|
return search.toString() === wanted.toString();
|
|
377
348
|
});
|
|
378
349
|
const frame = this.workspace.framed !== true || selected === undefined || selected[0] === this.page.host.label ? "" : selected[1][this.page.name];
|
|
379
|
-
return { extension: this.page.host.extension, current: selected === undefined ? "" : selected[0],
|
|
350
|
+
return { extension: this.page.host.extension, current: selected === undefined ? "" : selected[0], workspaces, frame };
|
|
380
351
|
}
|
|
381
352
|
async workspaceRequest(message) {
|
|
382
353
|
const answer = (status, body) => this.real.postMessage({ type: "__bullseyeWorkspace", id: message.id, status, body });
|
|
@@ -388,8 +359,6 @@ class MirroredWebview {
|
|
|
388
359
|
if (target === undefined)
|
|
389
360
|
return answer(400, "that workspace is not served on this machine");
|
|
390
361
|
const search = new URL(target, "http://localhost").searchParams;
|
|
391
|
-
if (search.get("scope") !== "all")
|
|
392
|
-
saveChosenWorkspace(message.pick);
|
|
393
362
|
await this.workspace.select(search);
|
|
394
363
|
return answer(200, this.workspaceReading());
|
|
395
364
|
}).then(undefined, (err) => answer(500, err.message));
|
|
@@ -897,8 +866,8 @@ class WebHost {
|
|
|
897
866
|
if (!this.admittedOrigin(request.headers.origin, base)) {
|
|
898
867
|
return send(response, 403, MIME[".txt"], "refused");
|
|
899
868
|
}
|
|
900
|
-
if (request.method
|
|
901
|
-
return
|
|
869
|
+
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
870
|
+
return send(response, 405, MIME[".txt"], "method not allowed");
|
|
902
871
|
}
|
|
903
872
|
let workspaces;
|
|
904
873
|
let current;
|
|
@@ -911,20 +880,9 @@ class WebHost {
|
|
|
911
880
|
if (!(err instanceof SyntaxError))
|
|
912
881
|
throw err;
|
|
913
882
|
// OWNER: the page's workspace read is this read's trigger root — a workspace list that is not defined or cannot be read is answered with its reason beside this host's own workspace, so the page says why its picker is short, and the process serving it goes on.
|
|
914
|
-
return send(response, 200, MIME[".json"], JSON.stringify({ extension: this.extension, current: this.ownLabel(),
|
|
915
|
-
}
|
|
916
|
-
let chosen = "";
|
|
917
|
-
let chosenUnreadable;
|
|
918
|
-
try {
|
|
919
|
-
chosen = chosenWorkspace();
|
|
920
|
-
}
|
|
921
|
-
catch (err) {
|
|
922
|
-
if (!(err instanceof SyntaxError) && !(err instanceof TypeError))
|
|
923
|
-
throw err;
|
|
924
|
-
// OWNER: the page's workspace read is this read's trigger root — a pick file that is not a label is answered with its reason beside an empty pick, and the next pick rewrites the file whole.
|
|
925
|
-
chosenUnreadable = err.message;
|
|
883
|
+
return send(response, 200, MIME[".json"], JSON.stringify({ extension: this.extension, current: this.ownLabel(), workspaces: this.ownWorkspaces(base), listUnreadable: err.message, ...this.level() }), { "Cache-Control": "no-store" });
|
|
926
884
|
}
|
|
927
|
-
return send(response, 200, MIME[".json"], JSON.stringify({ extension: this.extension, current,
|
|
885
|
+
return send(response, 200, MIME[".json"], JSON.stringify({ extension: this.extension, current, workspaces, ...this.level() }), { "Cache-Control": "no-store" });
|
|
928
886
|
}
|
|
929
887
|
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
930
888
|
return send(response, 405, MIME[".txt"], "method not allowed");
|
|
@@ -953,43 +911,6 @@ class WebHost {
|
|
|
953
911
|
if (home !== null && ROSTER_EXTENSIONS.has(this.extension)) {
|
|
954
912
|
return send(response, 200, MIME[".html"], peekedRosterPage(this.label, home, workspacesServed(this.extension, base).get(home)?.[page.name]), { "Cache-Control": "no-store" });
|
|
955
913
|
}
|
|
956
|
-
let here;
|
|
957
|
-
try {
|
|
958
|
-
here = this.currentOf(url.searchParams);
|
|
959
|
-
}
|
|
960
|
-
catch (err) {
|
|
961
|
-
if (!(err instanceof SyntaxError))
|
|
962
|
-
throw err;
|
|
963
|
-
// OWNER: the page request is this read's trigger root — a workspace list that cannot be read serves the page at its own address, and the picker's own read puts listUnreadable on screen.
|
|
964
|
-
return this.serveDocument(page, response);
|
|
965
|
-
}
|
|
966
|
-
let chosen = "";
|
|
967
|
-
if (here === "") {
|
|
968
|
-
try {
|
|
969
|
-
chosen = chosenWorkspace();
|
|
970
|
-
}
|
|
971
|
-
catch (err) {
|
|
972
|
-
if (!(err instanceof SyntaxError) && !(err instanceof TypeError))
|
|
973
|
-
throw err;
|
|
974
|
-
// OWNER: the page request is this read's trigger root — a pick file that is not a label serves the page at its own address, and the picker's own read puts chosenUnreadable on screen.
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
let remembered;
|
|
978
|
-
try {
|
|
979
|
-
// NULL-OK: field workspaces(base).get(chosen) is OPTIONAL and therefore it is ok to check for NULL
|
|
980
|
-
remembered = chosen === "" ? undefined : this.workspaces(base).get(chosen)?.[page.name];
|
|
981
|
-
}
|
|
982
|
-
catch (err) {
|
|
983
|
-
if (!(err instanceof SyntaxError))
|
|
984
|
-
throw err;
|
|
985
|
-
// OWNER: the page request is this read's trigger root — a workspace list that cannot be read serves the page at its own address, and the picker's own read puts listUnreadable on screen.
|
|
986
|
-
remembered = undefined;
|
|
987
|
-
}
|
|
988
|
-
// NULL-OK: field remembered is OPTIONAL and therefore it is ok to check for NULL
|
|
989
|
-
if (remembered !== undefined && new URL(remembered, "http://localhost").searchParams.get("scope") !== "all") {
|
|
990
|
-
const moved = url.searchParams.has("bullseye-framed") ? `${remembered}${remembered.includes("?") ? "&" : "?"}bullseye-framed=1` : remembered;
|
|
991
|
-
return send(response, 302, MIME[".txt"], `moved to ${moved}`, { Location: moved, "Cache-Control": "no-store" });
|
|
992
|
-
}
|
|
993
914
|
return this.serveDocument(page, response);
|
|
994
915
|
}
|
|
995
916
|
/** The workspaces a page of this host can switch to: label -> { page -> address }, built on `base` when the request came through the gateway. The workspaces are this window's own and the ones on the workspace list; a live window's record is only the address of that window's pages, never a source of the list. An extension whose service draws its pages (`service`) switches to that service's workspaces at the service's address, never to another window. */
|
|
@@ -1106,61 +1027,6 @@ class WebHost {
|
|
|
1106
1027
|
});
|
|
1107
1028
|
return undefined;
|
|
1108
1029
|
}
|
|
1109
|
-
/** Meni's workspace pick on any page, written once for the machine so every page opens on the workspace he left. */
|
|
1110
|
-
rememberWorkspace(request, response) {
|
|
1111
|
-
const chunks = [];
|
|
1112
|
-
let size = 0;
|
|
1113
|
-
let over = false;
|
|
1114
|
-
request.on("data", (chunk) => {
|
|
1115
|
-
size += chunk.length;
|
|
1116
|
-
if (size > PICK_BODY_BYTES && !over) {
|
|
1117
|
-
over = true;
|
|
1118
|
-
send(response, 413, MIME[".txt"], `a workspace pick is at most ${PICK_BODY_BYTES} bytes`);
|
|
1119
|
-
}
|
|
1120
|
-
if (!over)
|
|
1121
|
-
chunks.push(chunk);
|
|
1122
|
-
});
|
|
1123
|
-
request.on("end", () => this.answered(request, response, () => {
|
|
1124
|
-
if (over)
|
|
1125
|
-
return;
|
|
1126
|
-
let label;
|
|
1127
|
-
try {
|
|
1128
|
-
label = JSON.parse(Buffer.concat(chunks).toString("utf8")).label;
|
|
1129
|
-
}
|
|
1130
|
-
catch (err) {
|
|
1131
|
-
if (!(err instanceof SyntaxError) && !(err instanceof TypeError))
|
|
1132
|
-
throw err;
|
|
1133
|
-
// OWNER: the page's pick request is this read's trigger root — a body that is not a JSON object is answered 400, and the window goes on.
|
|
1134
|
-
return send(response, 400, MIME[".txt"], "the body must be a JSON object carrying a label");
|
|
1135
|
-
}
|
|
1136
|
-
let served;
|
|
1137
|
-
try {
|
|
1138
|
-
served = this.workspaces();
|
|
1139
|
-
}
|
|
1140
|
-
catch (err) {
|
|
1141
|
-
if (!(err instanceof SyntaxError))
|
|
1142
|
-
throw err;
|
|
1143
|
-
// OWNER: the page's pick request is this read's trigger root — a workspace list that cannot be read is answered 500 with its reason, nothing is written, and the process serving it goes on.
|
|
1144
|
-
return send(response, 500, MIME[".txt"], `the workspaces this host serves could not be read: ${err.message}`);
|
|
1145
|
-
}
|
|
1146
|
-
if (typeof label !== "string" || !served.has(label)) {
|
|
1147
|
-
return send(response, 400, MIME[".txt"], "that workspace is not served on this machine");
|
|
1148
|
-
}
|
|
1149
|
-
if (Object.values(served.get(label)).some((at) => new URL(at, "http://localhost").searchParams.get("scope") === "all"))
|
|
1150
|
-
return send(response, 204, MIME[".txt"], "");
|
|
1151
|
-
try {
|
|
1152
|
-
saveChosenWorkspace(label);
|
|
1153
|
-
}
|
|
1154
|
-
catch (err) {
|
|
1155
|
-
if (typeof err.code !== "string")
|
|
1156
|
-
throw err;
|
|
1157
|
-
// OWNER: the page's pick request is this write's trigger root — a pick that cannot be saved (another process holds the file) is answered 500 with its reason and the process serving it goes on.
|
|
1158
|
-
return send(response, 500, MIME[".txt"], `the workspace pick could not be saved: ${err.message}`);
|
|
1159
|
-
}
|
|
1160
|
-
return send(response, 204, MIME[".txt"], "");
|
|
1161
|
-
}));
|
|
1162
|
-
return undefined;
|
|
1163
|
-
}
|
|
1164
1030
|
serveFile(encoded, response) {
|
|
1165
1031
|
const file = fileOfResourcePath(encoded);
|
|
1166
1032
|
const roots = [...this.pages.values()].filter((page) => page.live).flatMap((page) => page.mirror.roots());
|
|
@@ -1504,4 +1370,4 @@ function startWebHost(options) {
|
|
|
1504
1370
|
void INSTANCE.start(options);
|
|
1505
1371
|
return { dispose: () => INSTANCE.stop() };
|
|
1506
1372
|
}
|
|
1507
|
-
module.exports = { WebHost, ServiceHost, MirroredWebview, ServedWebview, startWebHost, actWindows, listWebUis, saveTheme, readTheme, webDocument, repoint, fileOfResourcePath, sha256
|
|
1373
|
+
module.exports = { WebHost, ServiceHost, MirroredWebview, ServedWebview, startWebHost, actWindows, listWebUis, saveTheme, readTheme, webDocument, repoint, fileOfResourcePath, sha256 };
|
|
@@ -95,7 +95,6 @@ const PICKER_SOURCE = String.raw `
|
|
|
95
95
|
var peekHome = new URLSearchParams(window.location.search).get("bullseye-peek");
|
|
96
96
|
var framedPage = new URLSearchParams(window.location.search).get("bullseye-framed") !== null;
|
|
97
97
|
var peeking = peekable && peekHome !== null;
|
|
98
|
-
var moved = "bullseye-workspace-moved";
|
|
99
98
|
var barColours = "background:#252526;color:#ccc";
|
|
100
99
|
|
|
101
100
|
function workspaceBox() {
|
|
@@ -143,13 +142,6 @@ const PICKER_SOURCE = String.raw `
|
|
|
143
142
|
return holder;
|
|
144
143
|
}
|
|
145
144
|
|
|
146
|
-
function transientWorkspace(served, label) {
|
|
147
|
-
var pages = served.workspaces[label];
|
|
148
|
-
if (pages === undefined || pages[page] === undefined) return false;
|
|
149
|
-
var at = pages[page];
|
|
150
|
-
return new URLSearchParams(at.slice(at.indexOf("?") + 1)).get("scope") === "all";
|
|
151
|
-
}
|
|
152
|
-
|
|
153
145
|
function workspacesUrl() {
|
|
154
146
|
return "/__bullseye/workspaces?at=" + encodeURIComponent(window.location.search);
|
|
155
147
|
}
|
|
@@ -177,38 +169,13 @@ const PICKER_SOURCE = String.raw `
|
|
|
177
169
|
peekBadge(served, labels);
|
|
178
170
|
return;
|
|
179
171
|
}
|
|
180
|
-
if (served.
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
var remembered = served.chosen;
|
|
184
|
-
if (served.chosenUnreadable !== undefined) {
|
|
185
|
-
notice("__bullseye-workspace-pick-unread", "⛔ The workspace you last picked could not be read: " + served.chosenUnreadable + " — pick one in the bar above to replace it");
|
|
172
|
+
if (served.current === "" && new URLSearchParams(window.location.search).has("project")) {
|
|
173
|
+
notice("__bullseye-workspace-unknown", "⛔ This address names a workspace that is not served here — pick one of: " + labels.join(", "));
|
|
186
174
|
}
|
|
187
175
|
if (labels.length <= 1) {
|
|
188
176
|
return;
|
|
189
177
|
}
|
|
190
178
|
drawBar(served, labels);
|
|
191
|
-
window.addEventListener("focus", function () {
|
|
192
|
-
if (transientWorkspace(served, served.current)) return;
|
|
193
|
-
pickerFetch(workspacesUrl(), { cache: "no-store" }).then(function (response) {
|
|
194
|
-
return response.ok ? response.json() : null;
|
|
195
|
-
}).then(function (again) {
|
|
196
|
-
if (again === null) return;
|
|
197
|
-
if (again.current !== served.current) {
|
|
198
|
-
served = again;
|
|
199
|
-
labels = Object.keys(served.workspaces).filter(function (label) {
|
|
200
|
-
return served.workspaces[label][page] !== undefined;
|
|
201
|
-
});
|
|
202
|
-
document.getElementById("bullseye-workspace").remove();
|
|
203
|
-
drawBar(served, labels);
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
if (again.chosen !== "" && again.chosen !== remembered && again.chosen !== again.current && window.sessionStorage.getItem(moved) !== again.chosen && again.workspaces[again.chosen] !== undefined && again.workspaces[again.chosen][page] !== undefined && !transientWorkspace(again, again.chosen)) {
|
|
207
|
-
window.sessionStorage.setItem(moved, again.chosen);
|
|
208
|
-
pickerNavigate(again.workspaces[again.chosen][page]);
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
179
|
});
|
|
213
180
|
}
|
|
214
181
|
|
|
@@ -227,7 +194,6 @@ const PICKER_SOURCE = String.raw `
|
|
|
227
194
|
}
|
|
228
195
|
if (!commit()) return;
|
|
229
196
|
served.current = picked;
|
|
230
|
-
window.sessionStorage.setItem(moved, picked);
|
|
231
197
|
pickerNavigate(served.workspaces[picked][page]);
|
|
232
198
|
}, function () {
|
|
233
199
|
if (!latest()) return;
|
|
@@ -422,7 +388,7 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
|
|
|
422
388
|
var pickerNavigate = window.location.assign.bind(window.location);
|
|
423
389
|
var pickerPlaced = function () {};
|
|
424
390
|
var pickerSave = function (served, picked) {
|
|
425
|
-
return
|
|
391
|
+
return Promise.resolve({ ok: true });
|
|
426
392
|
};
|
|
427
393
|
var themeMissing = script.getAttribute("data-theme") === "missing";
|
|
428
394
|
var stateKey = "bullseye-webhost:" + page;
|
|
@@ -729,7 +695,7 @@ const PICKER_PAGE_SOURCE = String.raw `(function () {
|
|
|
729
695
|
var pickerNavigate = window.location.assign.bind(window.location);
|
|
730
696
|
var pickerPlaced = function () {};
|
|
731
697
|
var pickerSave = function (served, picked) {
|
|
732
|
-
return
|
|
698
|
+
return Promise.resolve({ ok: true });
|
|
733
699
|
};
|
|
734
700
|
` + PICKER_SOURCE + String.raw `
|
|
735
701
|
baseStyles();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-notify-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.416",
|
|
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",
|