omni-notify-mcp 1.3.489 → 1.3.490
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/notify.js
CHANGED
|
@@ -1096,7 +1096,7 @@ function ingestDropFolder() {
|
|
|
1096
1096
|
rejectDrop(path, name, err instanceof Error ? err.message : String(err));
|
|
1097
1097
|
continue;
|
|
1098
1098
|
}
|
|
1099
|
-
taken.push({ path, marker, entry });
|
|
1099
|
+
taken.push({ path, marker, name, entry });
|
|
1100
1100
|
queued = true;
|
|
1101
1101
|
}
|
|
1102
1102
|
finally {
|
|
@@ -1112,6 +1112,8 @@ function ingestDropFolder() {
|
|
|
1112
1112
|
retryUnreadDrops(unread);
|
|
1113
1113
|
if (taken.length === 0)
|
|
1114
1114
|
return;
|
|
1115
|
+
for (const { entry, name } of taken)
|
|
1116
|
+
copyUrgentAlertToChat(entry.text, name);
|
|
1115
1117
|
persistInboxQueue(taken.map(({ entry }) => entry));
|
|
1116
1118
|
for (const { path, marker } of taken) {
|
|
1117
1119
|
unlinkSync(path);
|
|
@@ -1120,6 +1122,32 @@ function ingestDropFolder() {
|
|
|
1120
1122
|
log("·", "inbox-drop", `queued ${taken.length} message${taken.length === 1 ? "" : "s"} from ${INBOX_DROP_IN_DIR}`);
|
|
1121
1123
|
syncInboxFromDisk();
|
|
1122
1124
|
}
|
|
1125
|
+
const URGENT_ALERT_TIER = /\[(WARN|CRITICAL)\]/;
|
|
1126
|
+
// GATE: the largest slice of an urgent alert sent in one chat message, under Telegram's 4096-character cap; slices are cut at exact offsets so the chat receives the drop's text unchanged.
|
|
1127
|
+
const COPY_PART_CHARS = 4000;
|
|
1128
|
+
function copyUrgentAlertToChat(text, drop) {
|
|
1129
|
+
const headline = text.split("\n")[0];
|
|
1130
|
+
const refuse = (where, err) => recordReach("telegram", false, "an urgent alert copy", `NOT copied from ${drop} to ${where} (${headline}): ${err instanceof Error ? err.message : String(err)}`);
|
|
1131
|
+
void (async () => {
|
|
1132
|
+
const tg = loadConfig().telegram;
|
|
1133
|
+
if (tg?.copyUrgentAlerts !== true || !URGENT_ALERT_TIER.test(text))
|
|
1134
|
+
return;
|
|
1135
|
+
if (!Array.isArray(tg.chatIds))
|
|
1136
|
+
throw new Error("telegram.chatIds is not a list");
|
|
1137
|
+
for (const chat of tg.chatIds) {
|
|
1138
|
+
void (async () => {
|
|
1139
|
+
for (let at = 0; at < text.length;) {
|
|
1140
|
+
let end = Math.min(at + COPY_PART_CHARS, text.length);
|
|
1141
|
+
if (end < text.length && /[\uD800-\uDBFF]/.test(text[end - 1]))
|
|
1142
|
+
end--; // never cut a surrogate pair (an emoji) in two
|
|
1143
|
+
await telegramSendTo(tg.token, chat, text.slice(at, end));
|
|
1144
|
+
at = end;
|
|
1145
|
+
}
|
|
1146
|
+
recordReach("telegram", true, "an urgent alert copy", `copied to chat ${chat}: ${headline}`);
|
|
1147
|
+
})().catch((err) => refuse(`chat ${chat}`, err)); // OWNER: the copy is an extra leg; its refusal is recorded with the drop and the headline while Slack and email keep their own legs
|
|
1148
|
+
}
|
|
1149
|
+
})().catch((err) => refuse("the telegram chats", err)); // OWNER: a config that cannot be read or a chat list that is not a list is the copy's own refusal, recorded; the drop still queues
|
|
1150
|
+
}
|
|
1123
1151
|
function ingestInboxEntry(entry, source) {
|
|
1124
1152
|
const waiters = takeWaitersFor(entry.tag);
|
|
1125
1153
|
if (waiters.length > 0) {
|
|
@@ -1303,6 +1331,14 @@ function telegramContext(msg) {
|
|
|
1303
1331
|
// NULL-OK: field replied is OPTIONAL and therefore it is ok to check for NULL
|
|
1304
1332
|
if (replied !== undefined)
|
|
1305
1333
|
lines.push(`He is replying to this earlier message in the chat: «${replied.slice(0, 800)}»`);
|
|
1334
|
+
const sender = msg.from;
|
|
1335
|
+
// NULL-OK: field sender is OPTIONAL and therefore it is ok to check for NULL
|
|
1336
|
+
if (sender !== undefined) {
|
|
1337
|
+
const name = [sender.first_name, sender.last_name].filter((part) => typeof part === "string" && part.length > 0).join(" ");
|
|
1338
|
+
const username = typeof sender.username === "string" && sender.username.length > 0 ? ` @${sender.username}` : "";
|
|
1339
|
+
const senderId = sender.id === undefined ? "" : ` (id ${String(sender.id)})`;
|
|
1340
|
+
lines.push(`Telegram sender: ${name || "unnamed"}${username}${senderId}`);
|
|
1341
|
+
}
|
|
1306
1342
|
return [...lines, ...openAsksContext()];
|
|
1307
1343
|
}
|
|
1308
1344
|
/** Every question another session waits on, told to the one chat's conversation so it can pass his answer on. */
|
|
@@ -1605,14 +1641,18 @@ async function startTelegramListener() {
|
|
|
1605
1641
|
tgLastErrorCount = 0;
|
|
1606
1642
|
}
|
|
1607
1643
|
for (const update of updates) {
|
|
1608
|
-
POLL_CURSORS.set(cursorKey, String(update.update_id));
|
|
1609
|
-
tgPollOffset = update.update_id + 1;
|
|
1610
1644
|
tgLastUpdateAt = Date.now();
|
|
1645
|
+
let acted = true;
|
|
1611
1646
|
await takeTelegramUpdate(token, update).catch((err) => {
|
|
1612
|
-
|
|
1647
|
+
acted = false;
|
|
1648
|
+
// OWNER: ITER/LOOP — one update that cannot be acted on is logged with its reason and remains pending for retry before later updates are read.
|
|
1613
1649
|
const classified = err instanceof TelegramRefused || err instanceof TelegramUnreachable || err instanceof TelegramUnknown;
|
|
1614
1650
|
log("·", "telegram", `update ${update.update_id} was not acted on, its reply NOT DELIVERED: ${err instanceof Error ? err.message : String(err)}${classified || !(err instanceof Error) ? "" : `\n${err.stack}`}`);
|
|
1615
1651
|
});
|
|
1652
|
+
if (!acted)
|
|
1653
|
+
break;
|
|
1654
|
+
POLL_CURSORS.set(cursorKey, String(update.update_id));
|
|
1655
|
+
tgPollOffset = update.update_id + 1;
|
|
1616
1656
|
}
|
|
1617
1657
|
}
|
|
1618
1658
|
catch (err) {
|
|
@@ -492,7 +492,7 @@ class ServedWebview {
|
|
|
492
492
|
* message runs under. `saidOnce` says a failure that persists across the watch's ticks is told to this browser once.
|
|
493
493
|
*/
|
|
494
494
|
viewerOf(socket) {
|
|
495
|
-
const viewer = { search: socket.at, base: socket.base, signal: socket.viewLife.signal, post: (message) => postTo([socket], message, this.served) };
|
|
495
|
+
const viewer = { search: socket.at, base: socket.base, ownerApproved: socket.ownerApproved === true, signal: socket.viewLife.signal, post: (message) => postTo([socket], message, this.served) };
|
|
496
496
|
viewer.guard = (work, options = {}) => this.guarded(socket, viewer, work, options.saidOnce === true);
|
|
497
497
|
return viewer;
|
|
498
498
|
}
|
|
@@ -1133,6 +1133,18 @@ class WebHost {
|
|
|
1133
1133
|
socket.end("HTTP/1.1 403 Forbidden\r\nConnection: close\r\n\r\n");
|
|
1134
1134
|
return;
|
|
1135
1135
|
}
|
|
1136
|
+
if (this.screenOwnerProved) {
|
|
1137
|
+
try {
|
|
1138
|
+
socket.ownerApproved = this.screenOwnerProved(request, this.port);
|
|
1139
|
+
}
|
|
1140
|
+
catch (err) {
|
|
1141
|
+
if (!(err instanceof Error))
|
|
1142
|
+
throw err;
|
|
1143
|
+
console.error("Screen owner proof refused:", err.message);
|
|
1144
|
+
socket.end("HTTP/1.1 403 Forbidden\r\nConnection: close\r\n\r\n");
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1136
1148
|
socket.base = base;
|
|
1137
1149
|
const accept = crypto.createHash("sha1").update(key + WS_GUID).digest("base64");
|
|
1138
1150
|
socket.write(`HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: ${accept}\r\n\r\n`);
|
|
@@ -1179,6 +1191,7 @@ class ServiceHost extends WebHost {
|
|
|
1179
1191
|
this.listed = options.workspaces;
|
|
1180
1192
|
this.current = options.currentOf;
|
|
1181
1193
|
this.machine = options.machine === true;
|
|
1194
|
+
this.screenOwnerProved = options.screenOwnerProved;
|
|
1182
1195
|
}
|
|
1183
1196
|
/** Takes the page requests and sockets of `server`, which already listens on `port` for the service. */
|
|
1184
1197
|
answerOn(server, port) {
|
|
@@ -1247,32 +1260,32 @@ function indexPage(host, base) {
|
|
|
1247
1260
|
const rows = [...host.pages.values()]
|
|
1248
1261
|
.map((page) => `<li><a href="${escapeAttribute(base === undefined ? page.url : `${base}/${encodeURIComponent(page.name)}/${page.search}`)}">${page.live ? "🟢" : "⚪"} ${escapeAttribute(page.title)}</a></li>`)
|
|
1249
1262
|
.join("");
|
|
1250
|
-
return `<!DOCTYPE html><html><head><meta charset="utf-8">${PHONE_VIEWPORT}<title>${escapeAttribute(host.extension)}</title></head>
|
|
1263
|
+
return `<!DOCTYPE html><html><head><meta charset="utf-8">${PHONE_VIEWPORT}<title>${escapeAttribute(host.extension)}</title></head>
|
|
1251
1264
|
<body style="font:14px system-ui,sans-serif;padding:24px;background:#1e1e1e;color:#ccc"><div>${escapeAttribute(host.extension)} · ${escapeAttribute(host.label)}</div><ul>${rows}</ul></body></html>`;
|
|
1252
1265
|
}
|
|
1253
1266
|
function closedPage(extension, page) {
|
|
1254
|
-
return `<!DOCTYPE html><html><head><meta charset="utf-8">${PHONE_VIEWPORT}<title>${escapeAttribute(extension)} · ${escapeAttribute(page.title)}</title></head>
|
|
1255
|
-
<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>
|
|
1256
|
-
<script>${CONNECTION_SOURCE}</script><script>(function () {
|
|
1257
|
-
var WHAT = "this page's live connection to its host";
|
|
1258
|
-
var kept = window.bullseyeConnection.keep({
|
|
1259
|
-
what: WHAT, path: "/__bullseye/health",
|
|
1260
|
-
open: function () { return new WebSocket((location.protocol === "https:" ? "wss:" : "ws:") + "//" + location.host + "/__bullseye/ws?page=${encodeURIComponent(page.name)}"); },
|
|
1261
|
-
attach: function (connect, later) {
|
|
1262
|
-
fetch("/__bullseye/health", { cache: "no-store", signal: AbortSignal.timeout(8000) }).then(function (r) {
|
|
1263
|
-
if (r.ok) connect(); else if (r.status === 401) window.bullseyeConnection.signInAgain(); else later();
|
|
1264
|
-
}, later);
|
|
1265
|
-
},
|
|
1266
|
-
opened: function () {
|
|
1267
|
-
document.getElementById("said").textContent = "";
|
|
1268
|
-
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(); }, function (error) { console.warn("[Bullseye connection] Page availability unread: " + error.message); });
|
|
1269
|
-
},
|
|
1270
|
-
message: function (socket, event) { if (JSON.parse(String(event.data)).type === "reload") location.reload(); },
|
|
1271
|
-
down: function () { document.getElementById("said").textContent = "⏳ Reconnecting"; },
|
|
1272
|
-
closed: function () { return false; },
|
|
1273
|
-
ping: function (socket) { socket.send('{"type":"ping"}'); }
|
|
1274
|
-
});
|
|
1275
|
-
kept.connect();
|
|
1267
|
+
return `<!DOCTYPE html><html><head><meta charset="utf-8">${PHONE_VIEWPORT}<title>${escapeAttribute(extension)} · ${escapeAttribute(page.title)}</title></head>
|
|
1268
|
+
<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>
|
|
1269
|
+
<script>${CONNECTION_SOURCE}</script><script>(function () {
|
|
1270
|
+
var WHAT = "this page's live connection to its host";
|
|
1271
|
+
var kept = window.bullseyeConnection.keep({
|
|
1272
|
+
what: WHAT, path: "/__bullseye/health",
|
|
1273
|
+
open: function () { return new WebSocket((location.protocol === "https:" ? "wss:" : "ws:") + "//" + location.host + "/__bullseye/ws?page=${encodeURIComponent(page.name)}"); },
|
|
1274
|
+
attach: function (connect, later) {
|
|
1275
|
+
fetch("/__bullseye/health", { cache: "no-store", signal: AbortSignal.timeout(8000) }).then(function (r) {
|
|
1276
|
+
if (r.ok) connect(); else if (r.status === 401) window.bullseyeConnection.signInAgain(); else later();
|
|
1277
|
+
}, later);
|
|
1278
|
+
},
|
|
1279
|
+
opened: function () {
|
|
1280
|
+
document.getElementById("said").textContent = "";
|
|
1281
|
+
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(); }, function (error) { console.warn("[Bullseye connection] Page availability unread: " + error.message); });
|
|
1282
|
+
},
|
|
1283
|
+
message: function (socket, event) { if (JSON.parse(String(event.data)).type === "reload") location.reload(); },
|
|
1284
|
+
down: function () { document.getElementById("said").textContent = "⏳ Reconnecting"; },
|
|
1285
|
+
closed: function () { return false; },
|
|
1286
|
+
ping: function (socket) { socket.send('{"type":"ping"}'); }
|
|
1287
|
+
});
|
|
1288
|
+
kept.connect();
|
|
1276
1289
|
})();</script></body></html>`;
|
|
1277
1290
|
}
|
|
1278
1291
|
function codeDefect(err) {
|
|
@@ -29,7 +29,7 @@ function run(file, args) {
|
|
|
29
29
|
if (failed === null)
|
|
30
30
|
resolve(out);
|
|
31
31
|
else
|
|
32
|
-
reject(failed.killed ? new OsCallTimedOut(callFailed(file, args, failed, err).message) : callFailed(file, args, failed, err));
|
|
32
|
+
reject(failed.killed ? new OsCallTimedOut(callFailed(file, args, failed, err).message) : Object.assign(callFailed(file, args, failed, err), { exitCode: failed.code }));
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -46,9 +46,10 @@ async function runRepeatable(file, args) {
|
|
|
46
46
|
await new Promise((resolve) => setTimeout(resolve, 1_000 * tried));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
/** The
|
|
50
|
-
const sessionQuery = () => [path.join(system32(), "
|
|
51
|
-
|
|
49
|
+
/** The quser query whose rows are the logon sessions on this machine, console, remote desktop and disconnected alike; an ssh-only box has none, because its ssh logons run in session 0. It replaces a tasklist USERNAME filter, which opens every process's owner and does not return under the Least-privilege token on a busy box. */
|
|
50
|
+
const sessionQuery = () => [path.join(system32(), "quser.exe"), []];
|
|
51
|
+
/** Whether quser's rows name a logon session of this account — "No User exists" (exit 1, no rows) is none. */
|
|
52
|
+
const listsThisAccount = (rows) => rows.split(/\r?\n/).slice(1).some((row) => row.replace(/^[\s>]+/, "").split(/\s+/)[0].toLowerCase() === os.userInfo().username.toLowerCase());
|
|
52
53
|
/** The tasklist query of this process's own row, which any token may read: the account's USERNAME filter opens every process's owner and does not return under the login session's own Least-privilege token. */
|
|
53
54
|
const ownRowQuery = () => [path.join(system32(), "tasklist.exe"), ["/fi", `PID eq ${process.pid}`, "/fo", "csv", "/nh"]];
|
|
54
55
|
/** The Windows session in this process's own tasklist row. */
|
|
@@ -66,7 +67,14 @@ async function userSessionOpen() {
|
|
|
66
67
|
if (sessionIn(await runRepeatable(own, ownArgs)) !== 0)
|
|
67
68
|
return true;
|
|
68
69
|
const [file, args] = sessionQuery();
|
|
69
|
-
|
|
70
|
+
try {
|
|
71
|
+
return listsThisAccount(await runRepeatable(file, args));
|
|
72
|
+
}
|
|
73
|
+
catch (failed) {
|
|
74
|
+
if (failed.exitCode === 1)
|
|
75
|
+
return false;
|
|
76
|
+
throw failed;
|
|
77
|
+
}
|
|
70
78
|
}
|
|
71
79
|
/** userSessionOpen, for a caller that cannot wait on the event loop. */
|
|
72
80
|
function userSessionOpenSync() {
|
|
@@ -75,19 +83,26 @@ function userSessionOpenSync() {
|
|
|
75
83
|
const call = ([file, args]) => execFileSync(file, args, { windowsHide: true, encoding: "utf8", timeout: OS_CALL_MS });
|
|
76
84
|
if (sessionIn(call(ownRowQuery())) !== 0)
|
|
77
85
|
return true;
|
|
78
|
-
|
|
86
|
+
try {
|
|
87
|
+
return listsThisAccount(call(sessionQuery()));
|
|
88
|
+
}
|
|
89
|
+
catch (failed) {
|
|
90
|
+
if (failed.status === 1)
|
|
91
|
+
return false;
|
|
92
|
+
throw failed;
|
|
93
|
+
}
|
|
79
94
|
}
|
|
80
95
|
const xmlText = (text) => text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
81
96
|
const quoted = (part) => (/[\s"]/.test(part) ? `"${part.replace(/"/g, '\\"')}"` : part);
|
|
82
97
|
/** The task's definition: the account's interactive token at the Least-privilege run level and Normal priority — the default below-normal priority leaves a program it starts unscheduled on a busy box — no trigger; the program runs under a headless console host, so a console program draws no window. A definition file, never /tr, because /tr stops at 261 characters. */
|
|
83
98
|
function taskXml(user, file, args) {
|
|
84
|
-
return `<?xml version="1.0" encoding="UTF-16"?>
|
|
85
|
-
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
86
|
-
<RegistrationInfo><Description>Starts a Bullseye program in the logged-on user's own session, from a resident server that runs with no window.</Description></RegistrationInfo>
|
|
87
|
-
<Principals><Principal id="Author"><UserId>${xmlText(user)}</UserId><LogonType>InteractiveToken</LogonType><RunLevel>LeastPrivilege</RunLevel></Principal></Principals>
|
|
88
|
-
<Settings><MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy><DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries><StopIfGoingOnBatteries>false</StopIfGoingOnBatteries><ExecutionTimeLimit>PT0S</ExecutionTimeLimit><Priority>4</Priority><Enabled>true</Enabled></Settings>
|
|
89
|
-
<Actions Context="Author"><Exec><Command>${xmlText(path.join(system32(), "conhost.exe"))}</Command><Arguments>${xmlText(["--headless", file, ...args].map(quoted).join(" "))}</Arguments></Exec></Actions>
|
|
90
|
-
</Task>
|
|
99
|
+
return `<?xml version="1.0" encoding="UTF-16"?>
|
|
100
|
+
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
101
|
+
<RegistrationInfo><Description>Starts a Bullseye program in the logged-on user's own session, from a resident server that runs with no window.</Description></RegistrationInfo>
|
|
102
|
+
<Principals><Principal id="Author"><UserId>${xmlText(user)}</UserId><LogonType>InteractiveToken</LogonType><RunLevel>LeastPrivilege</RunLevel></Principal></Principals>
|
|
103
|
+
<Settings><MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy><DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries><StopIfGoingOnBatteries>false</StopIfGoingOnBatteries><ExecutionTimeLimit>PT0S</ExecutionTimeLimit><Priority>4</Priority><Enabled>true</Enabled></Settings>
|
|
104
|
+
<Actions Context="Author"><Exec><Command>${xmlText(path.join(system32(), "conhost.exe"))}</Command><Arguments>${xmlText(["--headless", file, ...args].map(quoted).join(" "))}</Arguments></Exec></Actions>
|
|
105
|
+
</Task>
|
|
91
106
|
`;
|
|
92
107
|
}
|
|
93
108
|
let launches = 0;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const { execFile } = require("child_process");
|
|
3
3
|
const crypto = require("crypto");
|
|
4
4
|
const fs = require("fs");
|
|
5
|
+
const { isIP } = require("net");
|
|
5
6
|
const os = require("os");
|
|
6
7
|
const path = require("path");
|
|
7
8
|
/** #3849 — the BullseyeVSC checkout, which owns every Bullseye service and holds the one workspace list they all read. */
|
|
@@ -773,4 +774,65 @@ function savedSettings(tool) {
|
|
|
773
774
|
throw err;
|
|
774
775
|
}
|
|
775
776
|
}
|
|
776
|
-
|
|
777
|
+
const SSH_ALIAS = /^[a-z0-9_.][a-z0-9_.-]*$/i;
|
|
778
|
+
const remoteHostsFile = () => path.join(os.homedir(), ".bullseye", "settings", "fv-hosts.json");
|
|
779
|
+
const sshDestination = (name) => SSH_ALIAS.test(name) || isIP(name) === 6;
|
|
780
|
+
function remoteAlias(name) {
|
|
781
|
+
return sshDestination(name)
|
|
782
|
+
&& name.toLowerCase() !== os.hostname().toLowerCase()
|
|
783
|
+
&& !/^(?:localhost\.?|0\.0\.0\.0|::1?)$/i.test(name)
|
|
784
|
+
&& !(isIP(name) === 4 && name.startsWith("127."));
|
|
785
|
+
}
|
|
786
|
+
function sshHostAliases(config = path.join(os.homedir(), ".ssh", "config")) {
|
|
787
|
+
const raw = readBytesOf(config, "SSH config");
|
|
788
|
+
if (raw === undefined)
|
|
789
|
+
return [];
|
|
790
|
+
const names = new Map();
|
|
791
|
+
for (const line of raw.toString("utf8").split(/\r?\n/)) {
|
|
792
|
+
const name = /^\s*Host\s+(\S+)/i.exec(line)?.[1];
|
|
793
|
+
if (name !== undefined && sshDestination(name) && !/^hp-laptop$/i.test(name) && !names.has(name.toLowerCase()))
|
|
794
|
+
names.set(name.toLowerCase(), name);
|
|
795
|
+
}
|
|
796
|
+
return [...names.values()];
|
|
797
|
+
}
|
|
798
|
+
function readRemoteHostChoices(file) {
|
|
799
|
+
const bytes = readBytesOf(file, "FleetView hosts");
|
|
800
|
+
if (bytes === undefined)
|
|
801
|
+
return {};
|
|
802
|
+
const choices = parsedBox(file, bytes);
|
|
803
|
+
if (Object.entries(choices).some(([name, enabled]) => !sshDestination(name) || name !== name.toLowerCase() || typeof enabled !== "boolean")) {
|
|
804
|
+
throw new SyntaxError(`FleetView hosts in ${file} must map lowercase SSH aliases to true or false`);
|
|
805
|
+
}
|
|
806
|
+
return choices;
|
|
807
|
+
}
|
|
808
|
+
function remoteHostChoices() {
|
|
809
|
+
const current = workspaceTurn();
|
|
810
|
+
current.remoteHostChoices ??= readRemoteHostChoices(remoteHostsFile());
|
|
811
|
+
return current.remoteHostChoices;
|
|
812
|
+
}
|
|
813
|
+
function remoteHosts() {
|
|
814
|
+
const hosts = new Map(sshHostAliases().map((name) => [name.toLowerCase(), name]));
|
|
815
|
+
for (const [name, enabled] of Object.entries(remoteHostChoices())) {
|
|
816
|
+
const alias = name.toLowerCase();
|
|
817
|
+
if (enabled && remoteAlias(alias))
|
|
818
|
+
hosts.set(alias, hosts.get(alias) ?? alias);
|
|
819
|
+
else
|
|
820
|
+
hosts.delete(alias);
|
|
821
|
+
}
|
|
822
|
+
return [...hosts.values()];
|
|
823
|
+
}
|
|
824
|
+
function setRemoteHost(typed, enabled) {
|
|
825
|
+
const name = typeof typed === "string" ? typed.trim().toLowerCase() : "";
|
|
826
|
+
if (!sshDestination(name))
|
|
827
|
+
throw new SyntaxError("Enter an SSH alias, hostname or IP address without a user name, port, spaces or wildcards.");
|
|
828
|
+
if (enabled && !remoteAlias(name))
|
|
829
|
+
throw new SyntaxError("Enter a host other than this machine.");
|
|
830
|
+
const file = remoteHostsFile();
|
|
831
|
+
underLock(file, () => {
|
|
832
|
+
const choices = readRemoteHostChoices(file);
|
|
833
|
+
writeAtomically(file, `${JSON.stringify({ schema: SETTINGS_SCHEMA, box: { ...choices, [name]: enabled } }, null, 2)}\n`);
|
|
834
|
+
});
|
|
835
|
+
delete workspaceTurn().remoteHostChoices;
|
|
836
|
+
return name;
|
|
837
|
+
}
|
|
838
|
+
module.exports = { vscRoot, workspacesFile, publishWorkspaces, WorkspacesUndefined, listedWorkspaces, workspacesHere, listBase, saveWorkspaces, sameRoot, SettingsUndefined, SettingsMoved, SettingsLocked, WorkspaceNotListed, settingsFile, readSettings, savedSettings, AutoStartUnread, savedAutoStart, writeAutoStart, autoStartOnAt, autoStartOff, toolHome, settingsBase, writeSettings, setSettings, publishSettings, alive, sshHostAliases, remoteHostsFile, remoteHostChoices, remoteHosts, setRemoteHost };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-notify-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.490",
|
|
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",
|