omni-notify-mcp 1.3.492 → 1.3.493
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/agentGateway.js +1 -1
- package/dist/gateway/chatPage.js +1 -1
- package/dist/gateway/gatewayInstall.js +1 -1
- package/dist/gateway/oauthDoor.js +1 -1
- package/dist/gateway/panel.js +2 -1
- package/dist/gateway/panelPage.js +1 -1
- package/dist/gateway/passkeyDoor.js +2 -1
- package/dist/gateway/publicAccess.js +1 -1
- package/dist/gateway/restDoor.js +1 -1
- package/dist/gateway/tunnel.js +1 -1
- package/dist/gatewaySettings.js +68 -0
- package/dist/notify.js +3 -57
- package/package.json +1 -1
package/dist/agentGateway.js
CHANGED
|
@@ -14,7 +14,7 @@ import { homedir } from "os";
|
|
|
14
14
|
import { join } from "path";
|
|
15
15
|
import { setTimeout as delay } from "node:timers/promises";
|
|
16
16
|
import { choicesOf, StreamedReply } from "./messaging/messenger.js";
|
|
17
|
-
import { GatewayError, readGatewaySettings } from "./
|
|
17
|
+
import { GatewayError, readGatewaySettings } from "./gatewaySettings.js";
|
|
18
18
|
import { toolLine } from "./shared/toolLine.js";
|
|
19
19
|
export const AGENT_PREFIX = "!";
|
|
20
20
|
/** The key of Meni's direct-message chat with the bot on Slack (#4453): one conversation, as his Telegram chat is; a Slack channel thread keeps its own. */
|
package/dist/gateway/chatPage.js
CHANGED
|
@@ -6,7 +6,7 @@ import { homedir } from "os";
|
|
|
6
6
|
import { dirname, join } from "path";
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
8
|
import { extensionModule, extensionModulePath } from "./extensionModule.js";
|
|
9
|
-
import { CONFIG_DIR, GatewayError } from "../
|
|
9
|
+
import { CONFIG_DIR, GatewayError } from "../gatewaySettings.js";
|
|
10
10
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
11
11
|
const RUNS = join(CONFIG_DIR, "gateway", "installs");
|
|
12
12
|
const RUN_ID = /^[0-9a-f-]{36}$/;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash, createHmac, timingSafeEqual } from "crypto";
|
|
2
2
|
import { existsSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
3
3
|
import { join } from "path";
|
|
4
|
-
import { CONFIG_DIR, GatewayError } from "../
|
|
4
|
+
import { CONFIG_DIR, GatewayError } from "../gatewaySettings.js";
|
|
5
5
|
import { ICON_HEAD, logoUri } from "./iconDoor.js";
|
|
6
6
|
import { HOST_RE, LOOPBACK_HOSTS, PASSKEY_SCRIPT, approvalStands, digest, doorState, escapeHtml, mint, fromThisMachine, sessionApproval, tokenProves, tokenStands } from "./passkeyDoor.js";
|
|
7
7
|
export const MCP_PATH = "/mcp";
|
package/dist/gateway/panel.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
import { createHash } from "crypto";
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync } from "fs";
|
|
9
9
|
import { dirname, join } from "path";
|
|
10
|
-
import { CHAT_PROVIDERS,
|
|
10
|
+
import { CHAT_PROVIDERS, deliveryReport, isDndActive } from "../notify.js";
|
|
11
|
+
import { CONFIG_DIR, GatewayError, writeRecordFile } from "../gatewaySettings.js";
|
|
11
12
|
import { clusterCall } from "../agentGateway.js";
|
|
12
13
|
import { MESSENGER_SETUPS } from "../messaging/setup.js";
|
|
13
14
|
import { extensionModule } from "./extensionModule.js";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* to one (`POST /v1/settings`, `POST /v1/conversation-switch`, `POST /v1/public-access/<step>`). The VS Code panel frames
|
|
5
5
|
* these very pages, so the panel and a browser with every editor closed show the same thing from the same service.
|
|
6
6
|
*/
|
|
7
|
-
import { PACKAGE_HOMEPAGE } from "../
|
|
7
|
+
import { PACKAGE_HOMEPAGE } from "../gatewaySettings.js";
|
|
8
8
|
import { NOTICE_SCRIPT, PAGE_STYLE } from "./chatPage.js";
|
|
9
9
|
import { ICON_HEAD } from "./iconDoor.js";
|
|
10
10
|
import { CONNECTION_SOURCE, PICKER_PAGE_SOURCE } from "../shared/webhost/webviewShim.js";
|
|
@@ -6,7 +6,8 @@ import { hostname, uptime } from "os";
|
|
|
6
6
|
import { join } from "path";
|
|
7
7
|
import { generateAuthenticationOptions, generateRegistrationOptions, verifyAuthenticationResponse, verifyRegistrationResponse } from "@simplewebauthn/server";
|
|
8
8
|
import QRCode from "qrcode";
|
|
9
|
-
import {
|
|
9
|
+
import { smsReachesOwner, textOwner } from "../notify.js";
|
|
10
|
+
import { CONFIG_DIR, GatewayError, readGatewaySettings } from "../gatewaySettings.js";
|
|
10
11
|
import { ICON_HEAD } from "./iconDoor.js";
|
|
11
12
|
const PASSKEY_PREFIX = "/passkey/";
|
|
12
13
|
const ENROL_PATH = "/passkey/enrol";
|
|
@@ -12,7 +12,7 @@ import { homedir } from "os";
|
|
|
12
12
|
import { basename, dirname, join } from "path";
|
|
13
13
|
import { execFile } from "child_process";
|
|
14
14
|
import { promisify } from "util";
|
|
15
|
-
import { CONFIG_DIR, GatewayError } from "../
|
|
15
|
+
import { CONFIG_DIR, GatewayError } from "../gatewaySettings.js";
|
|
16
16
|
import { GATEWAY_STATE_FILE, TUNNEL_BINARY } from "./tunnel.js";
|
|
17
17
|
import { readConfig, writeConfigValue } from "./panel.js";
|
|
18
18
|
const run = promisify(execFile);
|
package/dist/gateway/restDoor.js
CHANGED
|
@@ -18,7 +18,7 @@ import { createRequire } from "module";
|
|
|
18
18
|
import { isAbsolute, join, relative } from "path";
|
|
19
19
|
import { createServer, request as httpRequest } from "http";
|
|
20
20
|
import { WebSocket, WebSocketServer } from "ws";
|
|
21
|
-
import { CONFIG_DIR, GatewayError } from "../
|
|
21
|
+
import { CONFIG_DIR, GatewayError } from "../gatewaySettings.js";
|
|
22
22
|
import { CHAT_HEADERS } from "./chatPage.js";
|
|
23
23
|
import { isIconPath, serveIcon } from "./iconDoor.js";
|
|
24
24
|
import { MCP_PATH, accessGranted, challenge, grantClient, handleOAuth, isOAuthPath, publicBase } from "./oauthDoor.js";
|
package/dist/gateway/tunnel.js
CHANGED
|
@@ -13,7 +13,7 @@ import { execFileSync, spawn } from "child_process";
|
|
|
13
13
|
import { existsSync, mkdirSync, readFileSync, readlinkSync, renameSync, writeFileSync } from "fs";
|
|
14
14
|
import { homedir } from "os";
|
|
15
15
|
import { join } from "path";
|
|
16
|
-
import { CONFIG_DIR } from "../
|
|
16
|
+
import { CONFIG_DIR } from "../gatewaySettings.js";
|
|
17
17
|
// Read by src/gateway/publicAccess.ts, which names both paths by the same rule.
|
|
18
18
|
export const GATEWAY_STATE_FILE = "gateway-state.json";
|
|
19
19
|
export const TUNNEL_BINARY = join(CONFIG_DIR, "cloudflared", process.platform === "win32" ? "cloudflared.exe" : "cloudflared");
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #4247 — the leaf every BullseyeNotif door shares with notify: where BN's config lives, the gateway's token settings,
|
|
3
|
+
* the refusal type every door answers with, the atomic record write and the installed build's version.
|
|
4
|
+
* It imports nothing of BN's own, so the doors (oauthDoor, restDoor, tunnel, publicAccess, gatewayInstall, panelPage,
|
|
5
|
+
* agentGateway) no longer reach into notify.ts for it; passkeyDoor's one remaining tie to notify.ts is the SMS sign-in
|
|
6
|
+
* code (smsReachesOwner, textOwner) and notifyDoor's is the MCP server it serves.
|
|
7
|
+
* notify.ts re-exports every name here, so a caller that still imports them from notify.js reads the same values.
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
|
|
10
|
+
import { homedir } from "os";
|
|
11
|
+
import { join } from "path";
|
|
12
|
+
import { fileURLToPath } from "url";
|
|
13
|
+
export const MANIFEST_PATH = fileURLToPath(new URL("../package.json", import.meta.url));
|
|
14
|
+
/** The build the extension has installed beside this bundle now; it moves when a window activates a newer extension and mirrors it. */
|
|
15
|
+
export function installedVersion() {
|
|
16
|
+
return JSON.parse(readFileSync(MANIFEST_PATH, "utf8")).version;
|
|
17
|
+
}
|
|
18
|
+
/** The build this process is running, read once at load. */
|
|
19
|
+
export const PACKAGE_VERSION = installedVersion();
|
|
20
|
+
export const PACKAGE_HOMEPAGE = JSON.parse(readFileSync(MANIFEST_PATH, "utf8")).homepage;
|
|
21
|
+
export const CONFIG_DIR = process.env.NOTIFY_MCP_CONFIG_DIR || join(homedir(), ".notify-mcp");
|
|
22
|
+
export const CONFIG_PATH = join(CONFIG_DIR, "config.json");
|
|
23
|
+
export const DEFAULT_GATEWAY_PORT = 7470;
|
|
24
|
+
/** A refused request, answered to its caller with this status and these words by whichever door it reached. */
|
|
25
|
+
export class GatewayError extends Error {
|
|
26
|
+
status;
|
|
27
|
+
facts;
|
|
28
|
+
/** `facts` ride beside the words in the refusal's body, so a caller acts on what was refused without parsing the message. */
|
|
29
|
+
constructor(status, message, facts = {}) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.status = status;
|
|
32
|
+
this.facts = facts;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** A rename Windows refuses while a reader holds the destination open for a moment. */
|
|
36
|
+
const RENAME_REFUSED = new Set(["EPERM", "EACCES", "EBUSY"]);
|
|
37
|
+
// GATE: five tries, waiting 10, 20, 40 and 80 ms — 150 ms at the outside — so a write a reader's lock refuses for a moment still lands, and one it refuses for good fails exactly as a single attempt did.
|
|
38
|
+
const RENAME_TRIES = 5;
|
|
39
|
+
const RENAME_FIRST_WAIT_MS = 10;
|
|
40
|
+
/** Writes one of BN's own files — config.json, the daemon's beat — staged beside itself and renamed over the old one, so no reader sees half of it; a refused rename is tried again. */
|
|
41
|
+
export function writeRecordFile(final, text) {
|
|
42
|
+
const staged = `${final}.${process.pid}.tmp`;
|
|
43
|
+
for (let attempt = 0;; attempt++) {
|
|
44
|
+
try {
|
|
45
|
+
writeFileSync(staged, text);
|
|
46
|
+
renameSync(staged, final);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
if (!RENAME_REFUSED.has(err.code ?? "") || attempt === RENAME_TRIES - 1) {
|
|
51
|
+
rmSync(staged, { force: true });
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, RENAME_FIRST_WAIT_MS << attempt);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** The token is mandatory: a door that is open to the home network never starts without one. */
|
|
59
|
+
export function readGatewaySettings() {
|
|
60
|
+
if (!existsSync(CONFIG_PATH))
|
|
61
|
+
return undefined;
|
|
62
|
+
const section = JSON.parse(readFileSync(CONFIG_PATH, "utf8")).agentGateway;
|
|
63
|
+
if (!section || typeof section.token !== "string" || section.token.length === 0)
|
|
64
|
+
return undefined;
|
|
65
|
+
const host = typeof section.host === "string" && section.host.length > 0 ? section.host : undefined;
|
|
66
|
+
const hosts = Array.isArray(section.hosts) && section.hosts.length > 0 ? section.hosts.map(String) : undefined;
|
|
67
|
+
return { token: section.token, port: typeof section.port === "number" ? section.port : DEFAULT_GATEWAY_PORT, ...(host === undefined ? {} : { host }), ...(hosts === undefined ? {} : { hosts }) };
|
|
68
|
+
}
|
package/dist/notify.js
CHANGED
|
@@ -14,7 +14,6 @@ import { createServer as createNetServer } from "net";
|
|
|
14
14
|
import { readFileSync, writeFileSync, existsSync, mkdirSync, mkdtempSync, readdirSync, statSync, unlinkSync, linkSync, renameSync, rmSync, watch } from "fs";
|
|
15
15
|
import { homedir, networkInterfaces, hostname, tmpdir } from "os";
|
|
16
16
|
import { join, basename, dirname } from "path";
|
|
17
|
-
import { fileURLToPath } from "url";
|
|
18
17
|
import { spawnSync, spawn } from "child_process";
|
|
19
18
|
import { PinpointSMSVoiceV2Client, SendTextMessageCommand } from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
20
19
|
import { SQSClient } from "@aws-sdk/client-sqs";
|
|
@@ -36,14 +35,9 @@ import { StoryTopics, shippedStory, storyOfMessage } from "./messaging/storyTopi
|
|
|
36
35
|
import { BoardDoorRefused, buttonPick, decisionButtons, decisionLink, decisionReply, PICK_DATA, pickByDigit, replySaid } from "./messaging/decisionDigit.js";
|
|
37
36
|
import { z } from "zod";
|
|
38
37
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return JSON.parse(readFileSync(MANIFEST_PATH, "utf8")).version;
|
|
43
|
-
}
|
|
44
|
-
/** The build this process is running, read once at load. */
|
|
45
|
-
export const PACKAGE_VERSION = installedVersion();
|
|
46
|
-
export const PACKAGE_HOMEPAGE = JSON.parse(readFileSync(MANIFEST_PATH, "utf8")).homepage;
|
|
38
|
+
import { CONFIG_DIR, CONFIG_PATH, DEFAULT_GATEWAY_PORT, GatewayError, MANIFEST_PATH, PACKAGE_VERSION, installedVersion, readGatewaySettings } from "./gatewaySettings.js";
|
|
39
|
+
// #4247 — these live in the gatewaySettings leaf so the doors can leave this repo without notify.ts; re-exported for every caller that still names notify.js.
|
|
40
|
+
export { CONFIG_DIR, DEFAULT_GATEWAY_PORT, GatewayError, PACKAGE_HOMEPAGE, PACKAGE_VERSION, readGatewaySettings, writeRecordFile } from "./gatewaySettings.js";
|
|
47
41
|
/**
|
|
48
42
|
* The identity one chat reports and the tag its messages are routed by: `<machine>-<workspace>[-<session>]`.
|
|
49
43
|
* The HTTP door derives it from the headers its client sends: the workspace is walked up from the project folder,
|
|
@@ -80,54 +74,6 @@ export function sessionIdentity(from) {
|
|
|
80
74
|
const session = (from.sessionId ?? "").replace(/[^a-zA-Z0-9]/g, "").toLowerCase().slice(0, 6);
|
|
81
75
|
return `${cleanId(hostname())}-${workspace || "agent"}${session ? `-${session}` : ""}`;
|
|
82
76
|
}
|
|
83
|
-
export const CONFIG_DIR = process.env.NOTIFY_MCP_CONFIG_DIR || join(homedir(), ".notify-mcp");
|
|
84
|
-
const CONFIG_PATH = join(CONFIG_DIR, "config.json");
|
|
85
|
-
export const DEFAULT_GATEWAY_PORT = 7470;
|
|
86
|
-
/** A refused request, answered to its caller with this status and these words by whichever door it reached. */
|
|
87
|
-
export class GatewayError extends Error {
|
|
88
|
-
status;
|
|
89
|
-
facts;
|
|
90
|
-
/** `facts` ride beside the words in the refusal's body, so a caller acts on what was refused without parsing the message. */
|
|
91
|
-
constructor(status, message, facts = {}) {
|
|
92
|
-
super(message);
|
|
93
|
-
this.status = status;
|
|
94
|
-
this.facts = facts;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/** A rename Windows refuses while a reader holds the destination open for a moment. */
|
|
98
|
-
const RENAME_REFUSED = new Set(["EPERM", "EACCES", "EBUSY"]);
|
|
99
|
-
// GATE: five tries, waiting 10, 20, 40 and 80 ms — 150 ms at the outside — so a write a reader's lock refuses for a moment still lands, and one it refuses for good fails exactly as a single attempt did.
|
|
100
|
-
const RENAME_TRIES = 5;
|
|
101
|
-
const RENAME_FIRST_WAIT_MS = 10;
|
|
102
|
-
/** Writes one of BN's own files — config.json, the daemon's beat — staged beside itself and renamed over the old one, so no reader sees half of it; a refused rename is tried again. */
|
|
103
|
-
export function writeRecordFile(final, text) {
|
|
104
|
-
const staged = `${final}.${process.pid}.tmp`;
|
|
105
|
-
for (let attempt = 0;; attempt++) {
|
|
106
|
-
try {
|
|
107
|
-
writeFileSync(staged, text);
|
|
108
|
-
renameSync(staged, final);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
catch (err) {
|
|
112
|
-
if (!RENAME_REFUSED.has(err.code ?? "") || attempt === RENAME_TRIES - 1) {
|
|
113
|
-
rmSync(staged, { force: true });
|
|
114
|
-
throw err;
|
|
115
|
-
}
|
|
116
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, RENAME_FIRST_WAIT_MS << attempt);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
/** The token is mandatory: a door that is open to the home network never starts without one. */
|
|
121
|
-
export function readGatewaySettings() {
|
|
122
|
-
if (!existsSync(CONFIG_PATH))
|
|
123
|
-
return undefined;
|
|
124
|
-
const section = JSON.parse(readFileSync(CONFIG_PATH, "utf8")).agentGateway;
|
|
125
|
-
if (!section || typeof section.token !== "string" || section.token.length === 0)
|
|
126
|
-
return undefined;
|
|
127
|
-
const host = typeof section.host === "string" && section.host.length > 0 ? section.host : undefined;
|
|
128
|
-
const hosts = Array.isArray(section.hosts) && section.hosts.length > 0 ? section.hosts.map(String) : undefined;
|
|
129
|
-
return { token: section.token, port: typeof section.port === "number" ? section.port : DEFAULT_GATEWAY_PORT, ...(host === undefined ? {} : { host }), ...(hosts === undefined ? {} : { hosts }) };
|
|
130
|
-
}
|
|
131
77
|
// GATE: the Slack API base may be moved ONLY under the test gate, so a suite can drive a real Slack call against a socket it owns; without the gate the value is api.slack.com and no environment can redirect it.
|
|
132
78
|
const SLACK_API_BASE = process.env.NOTIFY_MCP_TEST_ENDPOINTS === "1" && process.env.NOTIFY_SLACK_API
|
|
133
79
|
? process.env.NOTIFY_SLACK_API.replace(/\/+$/, "")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-notify-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.493",
|
|
4
4
|
"homepage": "https://www.npmjs.com/package/omni-notify-mcp",
|
|
5
5
|
"description": "Reach your AI agents from anywhere — and let them reach you. One resident process on 127.0.0.1:7475 serves the whole tool surface to Claude Code, GitHub Copilot Chat and Codex: desktop, Telegram, Slack, ntfy, Discord, Teams and SMS are configured in one file, and agents notify you when long work finishes or a decision is needed, ask you a question and wait for your answer, and receive and reply to the messages you send them — with Do Not Disturb and idle detection deciding what actually gets through.",
|
|
6
6
|
"main": "dist/daemon.js",
|