omni-notify-mcp 1.3.501 → 1.3.503

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.
@@ -12,6 +12,7 @@ import { CONFIG_DIR, GatewayError, writeRecordFile } from "../gatewaySettings.js
12
12
  import { clusterCall } from "../agentGateway.js";
13
13
  import { MESSENGER_SETUPS } from "../messaging/setup.js";
14
14
  import { extensionModule } from "./extensionModule.js";
15
+ import { devSection } from "./servedDev.js";
15
16
  import { TELEGRAM_PARSE_MODES } from "../messaging/telegramFormat.js";
16
17
  const channelReading = () => extensionModule("channelReading.cjs");
17
18
  const CONFIG_PATH = join(CONFIG_DIR, "config.json");
@@ -292,6 +293,8 @@ export async function panelState() {
292
293
  guide: g.guide === undefined ? undefined : { summary: g.guide.summary, steps: g.guide.steps, next: nextStep(g, cfg) },
293
294
  rows: g.rows.map((r) => ({ path: r.path, label: r.label, kind: r.kind, hint: r.hint, choices: r.choices, value: readAt(cfg, r.path) ?? r.fallback })),
294
295
  })),
296
+ // #5077 — the shared DEV control's face and entries and the newer-build notice, produced by the service with no window.
297
+ ...devSection(),
295
298
  };
296
299
  }
297
300
  /**
@@ -8,6 +8,7 @@ import { PACKAGE_HOMEPAGE } from "../gatewaySettings.js";
8
8
  import { NOTICE_SCRIPT, PAGE_STYLE } from "./signInDoor/chatPage.js";
9
9
  import { ICON_HEAD } from "./signInDoor/iconDoor.js";
10
10
  import { CONNECTION_SOURCE, PICKER_PAGE_SOURCE } from "../shared/webhost/webviewShim.js";
11
+ import { renderBuildNotice, renderCascadingMenu } from "../shared/dev/devControls.js";
11
12
  export const PANEL_PAGES = ["settings", "public-access"];
12
13
  const LINKS = {
13
14
  tunnels: "https://dash.cloudflare.com/?to=/:account/tunnels",
@@ -65,6 +66,10 @@ h3{margin:0 0 6px;font-size:14px}.mark{display:inline-block;width:1.6em}
65
66
  textarea{width:100%;box-sizing:border-box}
66
67
  .note{overflow-wrap:anywhere}.note:empty{display:none}.note[data-severity=good]{color:var(--ok)}.note[data-severity=warning]{color:var(--warn)}.note[data-severity=error]{color:var(--bad)}
67
68
  .wrap>.nline{margin:0 0 10px;border:1px solid var(--line);border-radius:8px;overflow:hidden}
69
+ .devbar{display:flex;gap:8px;align-items:flex-start;margin:0 0 10px}
70
+ .devbar:empty{display:none}
71
+ .bnotice{margin:0 0 10px;border:1px solid var(--warn);border-radius:8px;padding:6px 10px;display:flex;gap:8px;align-items:center;overflow-wrap:anywhere}
72
+ .bnotice[hidden]{display:none}
68
73
  #signin{display:none;margin:12px 0}#signin.show{display:block}#signin button{margin-top:8px}
69
74
  code{background:var(--agent);padding:0 4px;border-radius:3px;overflow-wrap:anywhere}
70
75
  summary{cursor:pointer}
@@ -159,10 +164,17 @@ document.addEventListener('visibilitychange',function(){if(document.visibilitySt
159
164
  const NAV_KEEPS_WORKSPACE = `
160
165
  document.querySelectorAll("nav a[href^='/']").forEach(function (a) { a.search = location.search; });
161
166
  `;
167
+ /*
168
+ * #5077 — THE SHARED DEV RENDERERS, EMBEDDED, NEVER RE-DRAWN. The 🛠 DEV button's cascade and the newer-build strip are
169
+ * the shared module's own functions (`renderCascadingMenu`, `renderBuildNotice` at vscode-extension/src/shared/devControls.js),
170
+ * embedded here by their source (`toString()`) so this page cannot drift from what every other Bullseye panel draws. The
171
+ * entries themselves arrive as data in the state (`dev`, `devGroups`), never copied into this file.
172
+ */
173
+ const SHARED_DEV_SOURCE = `window.renderCascadingMenu=${renderCascadingMenu.toString()};window.renderBuildNotice=${renderBuildNotice.toString()};`;
162
174
  function shell(title, here, body, script) {
163
175
  const nav = [["/", "💬", "Conversations"], ["/settings", "⚙️", "Settings"], ["/public-access", "🌐", "Public access"]]
164
176
  .map(([href, icon, text]) => `<a class="tab${href === here ? " here" : ""}" href="${href}">${icon}<span class="lbl"> ${text}</span></a>`).join("");
165
- 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><header><nav>${nav}</nav><span class="grow"></span><button id="refresh" type="button" aria-label="Refresh" onclick="location.reload()">🔄<span class="lbl"> Refresh</span></button><a id="help" class="tab" aria-label="Help" href="${PACKAGE_HOMEPAGE}" target="_blank" rel="noopener">❓<span class="lbl"> Help</span></a></header><div id="status" role="status"></div><main class="wrap"><div id="signin"></div>${body}</main><script>${CONNECTION_SOURCE}</script><script>${SIGN_IN}${NOTICE_SCRIPT}liveStart(document.getElementById("status"));${NAV_KEEPS_WORKSPACE}${script}${notificationStatusScript("call")}</script><script data-page="${here.slice(1)}">${PICKER_PAGE_SOURCE}</script></body></html>`;
177
+ 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><header><nav>${nav}</nav><span class="grow"></span><button id="refresh" type="button" aria-label="Refresh" onclick="location.reload()">🔄<span class="lbl"> Refresh</span></button><a id="help" class="tab" aria-label="Help" href="${PACKAGE_HOMEPAGE}" target="_blank" rel="noopener">❓<span class="lbl"> Help</span></a></header><div id="status" role="status"></div><main class="wrap"><div id="signin"></div>${body}</main><script>${CONNECTION_SOURCE}</script><script>${SHARED_DEV_SOURCE}</script><script>${SIGN_IN}${NOTICE_SCRIPT}liveStart(document.getElementById("status"));${NAV_KEEPS_WORKSPACE}${script}${notificationStatusScript("call")}</script><script data-page="${here.slice(1)}">${PICKER_PAGE_SOURCE}</script></body></html>`;
166
178
  }
167
179
  const SETTINGS_SCRIPT = `
168
180
  var root = document.getElementById("root"), stateLine = noticeLine(document.getElementById("state")), drawn = "";
@@ -229,9 +241,31 @@ function setupRow(g) {
229
241
  var reason = el("div", "hint", failed[g.messenger] || "");
230
242
  cell.colSpan = 2; cell.append(button, working, reason, facts); row.append(cell); return row;
231
243
  }
232
- function shownOf(s) { return JSON.stringify([s.state, s.conversation, s.groups, s.configPath]); }
244
+ function shownOf(s) { return JSON.stringify([s.state, s.conversation, s.groups, s.configPath, s.dev, s.build]); }
245
+ function drawBuildNotice(s) {
246
+ var mount = document.getElementById("buildnotice"), notice = s.build && s.build.notice;
247
+ if (!notice) { mount.hidden = true; mount.textContent = ""; mount.removeAttribute("data-be-tip"); mount.style.display = "none"; return; }
248
+ mount.hidden = false;
249
+ // renderBuildNotice sets mount.style.display itself (inline-flex), so the strip is cleared back to it whenever a notice is drawn.
250
+ window.renderBuildNotice(document, mount, notice);
251
+ mount.setAttribute("data-be-tip", notice.tooltip);
252
+ }
253
+ function pressDev(action) {
254
+ return call("POST", "/v1/dev-action", { action: action }).then(function () { say("good", "✅ DEV " + action); }, function (e) { say("error", "⚠️ " + plainWhy(e)); });
255
+ }
256
+ function drawDev(s) {
257
+ var host = document.getElementById("dev"); host.textContent = "";
258
+ var view = s.dev; if (!view) return;
259
+ var mount = el("div", "dev-menu");
260
+ var open = el("button", "", view.button.glyph + " " + view.button.label);
261
+ open.title = view.button.tooltip; open.setAttribute("aria-label", view.button.tooltip);
262
+ open.onclick = function () { if (mount.childElementCount > 0) { mount.textContent = ""; return; } window.renderCascadingMenu(document, open, mount, pressDev, { groups: s.devGroups }); };
263
+ host.append(open, mount);
264
+ }
233
265
  function draw(s) {
234
266
  drawn = shownOf(s);
267
+ drawBuildNotice(s);
268
+ drawDev(s);
235
269
  root.textContent = "";
236
270
  stateLine.set(s.state.icon + " " + s.state.label.toUpperCase(), s.state.text, s.state.severity);
237
271
  fileButton.title = s.configPath;
@@ -405,7 +439,7 @@ function start() { clearInterval(beat); liveWatch({ period: STEPS_REFRESH_MS, sa
405
439
  if (!token) needSignIn(); else start();
406
440
  `;
407
441
  export function settingsHtml() {
408
- return shell("BN Settings", "/settings", `<div id="state"></div><div id="root">⏳ Loading…</div>`, SETTINGS_SCRIPT);
442
+ return shell("BN Settings", "/settings", `<div id="buildnotice" class="bnotice" hidden></div><div id="dev" class="devbar"></div><div id="state"></div><div id="root">⏳ Loading…</div>`, SETTINGS_SCRIPT);
409
443
  }
410
444
  export function publicAccessHtml() {
411
445
  return shell("BN Public access", "/public-access", `<div id="banner"></div>${STEPS_HTML}`, PUBLIC_ACCESS_SCRIPT);
@@ -24,6 +24,7 @@ import { isIconPath, serveIcon } from "./signInDoor/iconDoor.js";
24
24
  import { MCP_PATH, accessGranted, challenge, grantClient, handleOAuth, isOAuthPath, publicBase } from "./signInDoor/oauthDoor.js";
25
25
  import { bearer, bearerAdmitted, fromThisMachine, handlePasskey, isPasskeyPath, localOnly, refusalOfRequest, sessionExpiresAt, sessionSignIn, tokenProves } from "./signInDoor/passkeyDoor.js";
26
26
  import { configFile, panelState, reinstallMessenger, saveConfigFile, saveSetting } from "./panel.js";
27
+ import { devAction } from "./servedDev.js";
27
28
  import { PANEL_PAGES, panelHtml } from "./panelPage.js";
28
29
  import { configureMcpHosts } from "./mcpHosts.js";
29
30
  import { readGatewayInstall, readNewestGatewayInstall, startGatewayInstall } from "./gatewayInstall.js";
@@ -283,6 +284,11 @@ async function route(req, url, token) {
283
284
  const body = await readJson(req);
284
285
  return { status: 200, body: saveSetting(body.path, body.value) };
285
286
  }
287
+ // #5077 — one press of the served page's DEV control: run by a running BullseyeNotify window through its act door, refused in words when none is open.
288
+ if (path === "/v1/dev-action" && method === "POST") {
289
+ const body = await readJson(req);
290
+ return { status: 200, body: await devAction(String(body.action)) };
291
+ }
286
292
  if (path === "/v1/settings/file" && method === "GET")
287
293
  return { status: 200, body: configFile() };
288
294
  if (path === "/v1/settings/file" && method === "POST") {
@@ -0,0 +1,195 @@
1
+ /**
2
+ * #5077 — THE SHARED DEV CONTROL AND THE NEWER-BUILD NOTICE, PRODUCED WITH NO VS CODE WINDOW.
3
+ *
4
+ * #5058 made BullseyeNotify's window frame its own served Settings page and deleted the panel's local draw — and with it
5
+ * the only producers of the shared control's view (`DevControls.view()` / `notice()`). The DEV control is still activated
6
+ * in the window (`extension.js` calls `devControls`), but nothing draws its pulldown; the newer-build strip went the same
7
+ * way. #5029 restored exactly these two controls on DeepAgent's served page; this is the same shape for BN.
8
+ *
9
+ * The SHARED module (BullseyeShared's `dev-controls/devControls.js`, synced into the service's `src/shared/dev/`) is not
10
+ * re-implemented here: this file only SUPPLIES the host it asks its six facts of — the running build and its stamp, the
11
+ * installed build and its stamp, and this extension's own checkout — read off the disk a process with no editor has. The
12
+ * button's face, its entries and the notice's wording all come from the shared module, so the served page and a window's
13
+ * panel can never drift.
14
+ */
15
+ import { createRequire } from "module";
16
+ import * as fs from "node:fs";
17
+ import * as os from "node:os";
18
+ import * as path from "node:path";
19
+ import * as http from "node:http";
20
+ import { GatewayError } from "../gatewaySettings.js";
21
+ import { actWindows } from "../shared/webhost/bullseyeWebHost.js";
22
+ const require_ = createRequire(import.meta.url);
23
+ const shared = require_("../shared/dev/devControls.js");
24
+ /** BN's extension id, used only when no manifest on disk names one — every real lookup reads the manifest. */
25
+ const FALLBACK_ID = "menihillel.bullseye-notify";
26
+ const EXTENSION_NAME = "BullseyeNotify";
27
+ function readManifest(file) {
28
+ if (!fs.existsSync(file))
29
+ return undefined;
30
+ try {
31
+ return JSON.parse(fs.readFileSync(file, "utf8"));
32
+ }
33
+ catch {
34
+ // OWNER: a page draw is this read's trigger root — a manifest that is not readable JSON costs the DEV button and its
35
+ // notice that draw, never the page, and the next draw re-reads it.
36
+ return undefined;
37
+ }
38
+ }
39
+ /** The folder the service runs out of — the daemon's own package root, exactly as `process.argv[1]` names it. */
40
+ function runningRoot() {
41
+ const bundle = process.argv[1] ?? "";
42
+ return bundle === "" ? "" : path.resolve(path.dirname(bundle), "..");
43
+ }
44
+ /** Where VS Code keeps installed extensions, each target's own directory (stable, Insiders, remote, OSS). */
45
+ function extensionRoots() {
46
+ const home = os.homedir();
47
+ return [".vscode", ".vscode-insiders", ".vscode-server", ".vscode-oss"].map((dir) => path.join(home, dir, "extensions"));
48
+ }
49
+ /** The installed BN extension folder, newest version first, or undefined — a folder named `<id>-<version>` under a known extensions dir. */
50
+ function installedFolder(id) {
51
+ const wanted = id.toLowerCase();
52
+ const found = [];
53
+ for (const root of extensionRoots()) {
54
+ if (!fs.existsSync(root))
55
+ continue;
56
+ for (const name of fs.readdirSync(root)) {
57
+ const at = path.join(root, name);
58
+ if (!name.toLowerCase().startsWith(wanted + "-") || !fs.statSync(at, { throwIfNoEntry: false })?.isDirectory())
59
+ continue;
60
+ const manifest = readManifest(path.join(at, "package.json"));
61
+ if (manifest === undefined)
62
+ continue;
63
+ if (`${manifest.publisher}.${manifest.name}`.toLowerCase() !== wanted)
64
+ continue;
65
+ found.push({ dir: at, version: String(manifest.version ?? "") });
66
+ }
67
+ }
68
+ found.sort((a, b) => b.version.localeCompare(a.version, undefined, { numeric: true }));
69
+ return found[0]?.dir;
70
+ }
71
+ /** A cached read of what is on disk — the checkout walk stats every level, so one page draw does not repeat it. */
72
+ let held;
73
+ function locate() {
74
+ const root = runningRoot();
75
+ if (root === "")
76
+ return undefined;
77
+ const repoExt = path.join(root, "vscode-extension");
78
+ const repoManifest = readManifest(path.join(repoExt, "package.json"));
79
+ // The extension's own manifest names the id; the installed folder is only read when no checkout sits beside the daemon.
80
+ const installed = repoManifest === undefined ? undefined : installedFolder(`${repoManifest.publisher}.${repoManifest.name}`);
81
+ const installedManifest = installed === undefined ? undefined : readManifest(path.join(installed, "package.json"));
82
+ const id = repoManifest !== undefined ? `${repoManifest.publisher}.${repoManifest.name}` : FALLBACK_ID;
83
+ // RUNNING is the build this service ships — the extension build it was cut with, in lockstep by the release driver.
84
+ const runningManifest = repoManifest ?? installedManifest;
85
+ if (runningManifest === undefined)
86
+ return undefined;
87
+ const io = { fs, path };
88
+ let cached;
89
+ let walked = false;
90
+ return {
91
+ id,
92
+ runningVersion: String(runningManifest.version ?? ""),
93
+ runningStamp: () => shared.buildStamp(runningManifest),
94
+ installedVersion: () => (installedManifest === undefined ? null : String(installedManifest.version ?? "")),
95
+ installedStamp: () => (installedManifest === undefined ? null : shared.buildStamp(installedManifest)),
96
+ checkout: () => {
97
+ if (!walked) {
98
+ walked = true;
99
+ // OWNER: a page draw is this search's trigger root — a search that cannot run costs the button its draw, never the page.
100
+ try {
101
+ cached = shared.devCheckout(id, [root, path.join(os.homedir(), "Desktop", "BullseyeVSC")], io);
102
+ }
103
+ catch {
104
+ cached = undefined;
105
+ }
106
+ }
107
+ return cached;
108
+ },
109
+ };
110
+ }
111
+ function sources() {
112
+ const root = runningRoot();
113
+ if (held !== undefined && held.key === root)
114
+ return held.sources;
115
+ const answer = locate();
116
+ held = { key: root, sources: answer };
117
+ return answer;
118
+ }
119
+ /** The served page's own DEV view, groups and build notice, driven off one set of sources — the seam a test fixtures. */
120
+ export function devSectionFor(found) {
121
+ const control = new shared.DevControls({
122
+ label: `${EXTENSION_NAME} DEV`,
123
+ runningVersion: found.runningVersion,
124
+ runningStamp: found.runningStamp,
125
+ installedVersion: found.installedVersion,
126
+ installedStamp: found.installedStamp,
127
+ checkout: found.checkout,
128
+ info: () => undefined,
129
+ showError: () => undefined,
130
+ });
131
+ let dev;
132
+ // OWNER: a page draw is this draw's trigger root — a search that could not run hides the button from THIS draw and the next draw re-reads, never takes the page down.
133
+ try {
134
+ dev = control.view();
135
+ }
136
+ catch {
137
+ dev = undefined;
138
+ }
139
+ let notice = null;
140
+ // OWNER: a page draw is this read's trigger root — a stamp that could not be read costs the notice its facts (the shared control renders the reason in their place), never the page.
141
+ try {
142
+ notice = control.notice();
143
+ }
144
+ catch (cause) {
145
+ if (!(cause instanceof shared.DevStepError))
146
+ throw cause;
147
+ notice = null;
148
+ }
149
+ return dev === undefined ? { devGroups: shared.GROUPS, build: { notice } } : { dev, devGroups: shared.GROUPS, build: { notice } };
150
+ }
151
+ /** The one source of the served page's DEV view, its groups and its build notice — the shared module's own answers, driven headlessly off the disk. */
152
+ export function devSection() {
153
+ const found = sources();
154
+ return found === undefined ? { devGroups: shared.GROUPS, build: { notice: null } } : devSectionFor(found);
155
+ }
156
+ /** One POST to a running BN window's act door, answered as `{ status, body }`; a window that will not answer THROWS in words. */
157
+ function askWindow(port, actToken, body) {
158
+ const sent = JSON.stringify(body);
159
+ return new Promise((resolve, reject) => {
160
+ const req = http.request({ host: "127.0.0.1", port, path: "/__bullseye/act", method: "POST", timeout: 300_000, headers: { "content-type": "application/json", "content-length": Buffer.byteLength(sent), "x-bullseye-act": actToken } }, (res) => {
161
+ let text = "";
162
+ res.setEncoding("utf8");
163
+ res.on("data", (chunk) => (text += chunk));
164
+ res.on("end", () => {
165
+ try {
166
+ resolve({ status: res.statusCode ?? 0, body: text === "" ? null : JSON.parse(text) });
167
+ }
168
+ catch (err) {
169
+ if (!(err instanceof SyntaxError))
170
+ throw err;
171
+ reject(new Error(`the BullseyeNotify window answered the DEV press with a body that is not JSON — ${err.message}`));
172
+ }
173
+ });
174
+ });
175
+ req.on("timeout", () => { req.destroy(new Error("the BullseyeNotify window did not answer the DEV press in time")); });
176
+ req.on("error", reject);
177
+ req.end(sent);
178
+ });
179
+ }
180
+ /**
181
+ * #5077 — one press of the shared DEV control from the served page. The entries build, install and reload this extension,
182
+ * which only a running BullseyeNotify window holds a real `DevControls` to do, so the press goes through the window's own
183
+ * act door (the one loopback channel the shared web host already answers). With no window open the refusal is plain words.
184
+ */
185
+ export async function devAction(action) {
186
+ const windows = actWindows("bullseye-notify");
187
+ if (windows.length === 0)
188
+ throw new GatewayError(409, `the DEV control is run by a running BullseyeNotify window, and none is open on this computer — open VS Code here to run "${action}"`);
189
+ const window = windows[0];
190
+ const answer = await askWindow(window.port, window.actToken, { op: "dev", action });
191
+ const body = answer.body;
192
+ if (answer.status !== 200 || body?.ok !== true)
193
+ throw new GatewayError(409, body?.message ?? `the BullseyeNotify window did not take the DEV press (HTTP ${answer.status})`);
194
+ return { ok: true, action };
195
+ }
@@ -864,6 +864,35 @@ const SHIM_SOURCE = CONNECTION_SOURCE + ";" + String.raw `(function () {
864
864
  });
865
865
  };
866
866
 
867
+ // #237 — a link that means an act: an anchor whose own markup names it (data-bullseye-command + data-bullseye-args, or
868
+ // data-bullseye-file + data-bullseye-line) carries its target on the anchor, never in its display text. Inside a window the
869
+ // page is framed, so the click stops and the act reaches the frame; a plain browser is never framed, so the link navigates.
870
+ function actAnchorOf(node) {
871
+ for (var el = node; el !== null && el !== document && el.nodeType === 1; el = el.parentNode) {
872
+ if (el.hasAttribute("data-bullseye-command") || el.hasAttribute("data-bullseye-file")) {
873
+ return el;
874
+ }
875
+ }
876
+ return null;
877
+ }
878
+
879
+ function actOf(anchor) {
880
+ if (anchor.hasAttribute("data-bullseye-command")) {
881
+ return { type: "__bullseyeAct", command: anchor.getAttribute("data-bullseye-command"), args: anchor.getAttribute("data-bullseye-args") || "[]" };
882
+ }
883
+ return { type: "__bullseyeAct", file: anchor.getAttribute("data-bullseye-file"), line: Number(anchor.getAttribute("data-bullseye-line") || "0") };
884
+ }
885
+
886
+ document.addEventListener("click", function (event) {
887
+ if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
888
+ if (!framedPage || window.parent === window) return;
889
+ var anchor = actAnchorOf(event.target);
890
+ if (anchor === null) return;
891
+ event.preventDefault();
892
+ event.stopPropagation();
893
+ window.parent.postMessage(actOf(anchor), "*");
894
+ });
895
+
867
896
  function start() {
868
897
  baseStyles();
869
898
  kept.connect();
@@ -998,6 +1027,13 @@ const NATIVE_PICKER_SOURCE = String.raw `(function () {
998
1027
  framedUp();
999
1028
  return;
1000
1029
  }
1030
+ // #237 — a link the framed page turned into the act it means: the frame hands it to the extension host, which performs it (a
1031
+ // VS Code command, or the file opened at its line).
1032
+ if (reply?.type === "__bullseyeAct") {
1033
+ if (api === undefined) acquireVsCodeApi();
1034
+ api.postMessage(reply);
1035
+ return;
1036
+ }
1001
1037
  if (reply?.type === "__bullseyeWorkspaceRefresh" && api !== undefined) {
1002
1038
  workspacePicker();
1003
1039
  return;