omni-notify-mcp 1.3.382 → 1.3.384
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/cliSession.js +13 -4
- package/dist/gateway/copilotProvider.js +16 -0
- package/dist/gateway/nativeTerminal.js +8 -1
- package/dist/gateway/panel.js +23 -1
- package/dist/gateway/panelPage.js +25 -1
- package/dist/gateway/sessionDriver.js +1 -1
- package/dist/gateway/terminalPage.js +2 -0
- package/dist/notify.js +2 -2
- package/package.json +1 -1
|
@@ -69,6 +69,7 @@ export class CliSession {
|
|
|
69
69
|
/** Starts the CLI with its own arguments for this session, held by the person BN's door serves. */
|
|
70
70
|
launch(args, env) {
|
|
71
71
|
this.terminal = openDrivenTerminal(terminalHolder(), { id: this.spec.id, provider: this.provider, project: this.spec.project, cmd: this.spec.cli.cmd, args: [...this.spec.cli.args, ...args], env, cols: 100, rows: 30 });
|
|
72
|
+
this.terminal.onClosing(() => { this.ending = true; clearInterval(this.turn?.enter); });
|
|
72
73
|
}
|
|
73
74
|
/** Called last in a session's constructor, once all it reads is set: the CLI ending ends the turn it held. */
|
|
74
75
|
watchEnd() {
|
|
@@ -134,14 +135,16 @@ export class CliSession {
|
|
|
134
135
|
return;
|
|
135
136
|
turn.sink.pid(this.terminal.info().pid);
|
|
136
137
|
await this.ready();
|
|
137
|
-
if (this.turn !== turn)
|
|
138
|
+
if (this.ending || this.turn !== turn)
|
|
138
139
|
return;
|
|
139
140
|
if (this.restored > 0)
|
|
140
141
|
await this.terminal.input("\x15".repeat(this.restored * CLEARS_PER_LINE + 1), false);
|
|
141
142
|
this.restored = 0;
|
|
142
143
|
await this.terminal.input(`\x1b[200~${CLI_COMMAND_START.test(turn.prompt) ? ` ${turn.prompt}` : turn.prompt}\x1b[201~`, false);
|
|
144
|
+
if (this.ending || this.turn !== turn)
|
|
145
|
+
return;
|
|
143
146
|
const press = () => {
|
|
144
|
-
if (this.turn === turn && !turn.taken && !this.terminal.info().ended)
|
|
147
|
+
if (!this.ending && this.turn === turn && !turn.taken && !this.terminal.info().ended)
|
|
145
148
|
void this.terminal.input("\r", false).catch((err) => this.settle(turn, () => turn.reject(new AgentTurnFailed(`Enter could not be pressed in the agent's CLI: ${err.message}`))));
|
|
146
149
|
};
|
|
147
150
|
press();
|
|
@@ -184,7 +187,6 @@ export class CliSession {
|
|
|
184
187
|
return new AgentTurnFailed(`the agent's CLI ended without an answer while ${how}: ${said.slice(0, 300)}`, `❌ The agent's CLI ended without an answer while ${how}: ${said.slice(0, 300)}`);
|
|
185
188
|
}
|
|
186
189
|
end() {
|
|
187
|
-
this.ending = true;
|
|
188
190
|
this.terminal.close().catch((err) => {
|
|
189
191
|
// OWNER: the driver's free/stop is the trigger root and cannot wait on the kill — a CLI the machine refuses to end is reported here and stays listed with that refusal on its terminal row.
|
|
190
192
|
this.terminal.refuse(err.message);
|
|
@@ -240,6 +242,7 @@ export class LoggedCliSession extends CliSession {
|
|
|
240
242
|
/** Every line submitted through this CLI's terminal — by the browser or by the driver — while its log is not found yet. */
|
|
241
243
|
submitted = [];
|
|
242
244
|
unacknowledged = [];
|
|
245
|
+
diagnostic;
|
|
243
246
|
/** The last failure to read the log reported, so a failure that repeats on every read is reported once. */
|
|
244
247
|
lastReported;
|
|
245
248
|
reader;
|
|
@@ -266,7 +269,9 @@ export class LoggedCliSession extends CliSession {
|
|
|
266
269
|
this.settled = new Promise((resolve) => { this.markSettled = resolve; });
|
|
267
270
|
this.terminal.onOutput(() => {
|
|
268
271
|
clearTimeout(this.still);
|
|
269
|
-
|
|
272
|
+
const turn = this.turn;
|
|
273
|
+
this.still = setTimeout(() => void this.terminal.screenText().then((text) => { if (this.turn === turn)
|
|
274
|
+
this.diagnostic = turn?.taken === false ? this.cli.startupDiagnostic?.(text, this.unacknowledged) : undefined; if (text !== "")
|
|
270
275
|
this.markSettled(); }), SETTLED_MS);
|
|
271
276
|
});
|
|
272
277
|
this.reader = setInterval(() => this.tick(), READ_EVERY_MS);
|
|
@@ -274,7 +279,9 @@ export class LoggedCliSession extends CliSession {
|
|
|
274
279
|
this.watchEnd();
|
|
275
280
|
}
|
|
276
281
|
get pendingInput() { return this.unacknowledged.length > 0; }
|
|
282
|
+
get startupDiagnostic() { return this.turn?.taken === false ? this.diagnostic : undefined; }
|
|
277
283
|
closed() {
|
|
284
|
+
this.diagnostic = undefined;
|
|
278
285
|
clearInterval(this.reader);
|
|
279
286
|
clearTimeout(this.still);
|
|
280
287
|
this.markSettled();
|
|
@@ -288,6 +295,7 @@ export class LoggedCliSession extends CliSession {
|
|
|
288
295
|
return this.settled;
|
|
289
296
|
}
|
|
290
297
|
newTurn(turn) {
|
|
298
|
+
this.diagnostic = undefined;
|
|
291
299
|
return turn;
|
|
292
300
|
}
|
|
293
301
|
/** The log of this session, once there is one: a resumed one read from where it stood when this CLI started. */
|
|
@@ -378,6 +386,7 @@ export class LoggedCliSession extends CliSession {
|
|
|
378
386
|
this.spec.learned(news.id);
|
|
379
387
|
return;
|
|
380
388
|
case "taken": {
|
|
389
|
+
this.diagnostic = undefined;
|
|
381
390
|
const acknowledged = this.unacknowledged.findIndex((line) => sameText(news.text, line));
|
|
382
391
|
if (acknowledged >= 0)
|
|
383
392
|
this.unacknowledged.splice(acknowledged, 1);
|
|
@@ -107,6 +107,21 @@ class CopilotLog {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
+
/** This exact safe line is a displayed diagnostic, never an inferred authentication state. */
|
|
111
|
+
export function copilotStartupDiagnostic(screen, submitted) {
|
|
112
|
+
const line = "You must be logged in to send messages. Please run /login";
|
|
113
|
+
if (submitted.some((prompt) => prompt.includes(line)))
|
|
114
|
+
return undefined;
|
|
115
|
+
const rows = screen.split("\n").slice(-12).map((row) => row.trim());
|
|
116
|
+
const refusal = rows.map((row) => row.replace(/^✗\s*/, "").startsWith(line)).lastIndexOf(true);
|
|
117
|
+
if (refusal < 0)
|
|
118
|
+
return undefined;
|
|
119
|
+
const newerPrompt = rows.slice(refusal + 1).some((row) => {
|
|
120
|
+
const prompt = /^[❯>]\s*(.*)$/.exec(row)?.[1];
|
|
121
|
+
return prompt !== undefined && prompt !== "" && prompt !== "Type @ to mention files or / for commands";
|
|
122
|
+
});
|
|
123
|
+
return newerPrompt ? undefined : `Copilot native CLI displayed: "${line}"`;
|
|
124
|
+
}
|
|
110
125
|
function copilotCli(configDir) {
|
|
111
126
|
return {
|
|
112
127
|
provider: copilotProvider,
|
|
@@ -116,6 +131,7 @@ function copilotCli(configDir) {
|
|
|
116
131
|
...(resumes ? ["--resume", spec.sessionId] : []),
|
|
117
132
|
],
|
|
118
133
|
log: new CopilotLog(configDir),
|
|
134
|
+
startupDiagnostic: copilotStartupDiagnostic,
|
|
119
135
|
refusal: (spec) => copilotProvider.refusal(spec.project, spec.model, spec.cli),
|
|
120
136
|
};
|
|
121
137
|
}
|
|
@@ -155,6 +155,11 @@ export class NativeTerminal {
|
|
|
155
155
|
this.key = id;
|
|
156
156
|
track(this);
|
|
157
157
|
}
|
|
158
|
+
/** A Close begins: the owning driver stops submitting input before this terminal starts shutting down. */
|
|
159
|
+
onClosing(listener) { if (this.closing !== undefined)
|
|
160
|
+
listener();
|
|
161
|
+
else
|
|
162
|
+
this.events.once("closing", listener); }
|
|
158
163
|
/** The CLI ended — it exited, was closed or could not run — told once, the moment it is known. */
|
|
159
164
|
onEnded(listener) { if (this.ended)
|
|
160
165
|
listener();
|
|
@@ -317,8 +322,10 @@ export class NativeTerminal {
|
|
|
317
322
|
/** One close per terminal: every later caller — a second tab, a reap after an exit, a failure — awaits the same
|
|
318
323
|
* promise, so the record is removed, the screen disposed and the spool deleted exactly once. */
|
|
319
324
|
close() {
|
|
320
|
-
if (!this.closing)
|
|
325
|
+
if (!this.closing) {
|
|
326
|
+
this.events.emit("closing");
|
|
321
327
|
this.closing = this.finish().catch((error) => { this.closing = undefined; throw error; });
|
|
328
|
+
}
|
|
322
329
|
return this.closing;
|
|
323
330
|
}
|
|
324
331
|
async finish() {
|
package/dist/gateway/panel.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
8
8
|
import { dirname, join } from "path";
|
|
9
|
-
import { CONFIG_DIR } from "../notify.js";
|
|
9
|
+
import { CONFIG_DIR, deliveryReport, isDndActive } from "../notify.js";
|
|
10
10
|
import { GatewayError, conversationEnabled, setConversationEnabled } from "./conversations.js";
|
|
11
11
|
const CHANNEL_KEYS = ["desktop", "telegram", "slack", "sms", "ntfy", "discord", "teams"];
|
|
12
12
|
const CONFIG_PATH = join(CONFIG_DIR, "config.json");
|
|
@@ -144,6 +144,26 @@ function channelState(cfg, unreadable) {
|
|
|
144
144
|
return { severity: "warning", label: "Muted", icon: "🔕", text: `Master mute is ON — nothing is delivered. Enabled: ${on.join(", ")}.` };
|
|
145
145
|
return { severity: "good", label: "Enabled", icon: "🔔", text: `Enabled: ${on.join(", ")}. Whether each can carry is not measured here.` };
|
|
146
146
|
}
|
|
147
|
+
export function notificationHold(cfg) {
|
|
148
|
+
const release = [];
|
|
149
|
+
const causes = [];
|
|
150
|
+
if (cfg.muteAll === true) {
|
|
151
|
+
release.push(['muteAll']);
|
|
152
|
+
causes.push('Master mute');
|
|
153
|
+
}
|
|
154
|
+
if (readAt(cfg, ['dnd', 'enabled']) === true) {
|
|
155
|
+
release.push(['dnd', 'enabled']);
|
|
156
|
+
causes.push('Do not disturb');
|
|
157
|
+
}
|
|
158
|
+
const dnd = cfg.dnd;
|
|
159
|
+
if (isDndActive({ dnd: { ...dnd, enabled: false } })) {
|
|
160
|
+
release.push(['dnd', 'schedule', 'enabled']);
|
|
161
|
+
causes.push('Quiet hours');
|
|
162
|
+
}
|
|
163
|
+
return { active: release.length > 0, release, text: causes.length > 0
|
|
164
|
+
? causes.join(' + ') + ' holds every notification, every priority including high / CRITICAL. No channel is attempted.'
|
|
165
|
+
: 'No all-notification hold is active.' };
|
|
166
|
+
}
|
|
147
167
|
/** Everything the Settings page draws, in one reading: the channel state, every group with its rows' current values and next-step line, and the conversation switch. */
|
|
148
168
|
export function panelState() {
|
|
149
169
|
let cfg;
|
|
@@ -159,6 +179,8 @@ export function panelState() {
|
|
|
159
179
|
}
|
|
160
180
|
return {
|
|
161
181
|
state: channelState(cfg, unreadable),
|
|
182
|
+
hold: unreadable === undefined ? notificationHold(cfg) : undefined,
|
|
183
|
+
delivery: unreadable === undefined ? deliveryReport() : undefined,
|
|
162
184
|
configPath: CONFIG_PATH,
|
|
163
185
|
conversation: conversationSwitchRead(),
|
|
164
186
|
groups: unreadable !== undefined ? [] : SETTINGS.map((g) => ({
|
|
@@ -93,13 +93,37 @@ async function call(method, path, body) {
|
|
|
93
93
|
return j;
|
|
94
94
|
}
|
|
95
95
|
`;
|
|
96
|
+
/** Both service screens draw the same hold and measured delivery contract. */
|
|
97
|
+
export function notificationStatusScript(request) {
|
|
98
|
+
return `(function(){
|
|
99
|
+
var box=document.createElement('section');box.id='notification-status';box.setAttribute('aria-label','Notification delivery');box.style.cssText='flex:none;margin:8px 12px;padding:8px;border:1px solid var(--line);border-radius:6px;overflow-wrap:anywhere';
|
|
100
|
+
(document.querySelector('header')||document.querySelector('nav')).after(box);
|
|
101
|
+
async function refresh(){
|
|
102
|
+
if(!token){box.hidden=true;return;}box.hidden=false;
|
|
103
|
+
try{
|
|
104
|
+
var model=await ${request}('GET','/v1/panel');box.replaceChildren();
|
|
105
|
+
if(!model.hold||!model.delivery){box.textContent='⚠️ Notification status is unavailable — the service did not answer the hold and delivery reading.';return;}
|
|
106
|
+
if(model.hold.active){
|
|
107
|
+
var held=document.createElement('p');held.textContent='🔕 '+model.hold.text;held.setAttribute('role','status');held.style.fontWeight='700';
|
|
108
|
+
var release=document.createElement('button');release.textContent='🔔 Release notifications';release.onclick=async function(){release.disabled=true;try{for(var path of model.hold.release)await ${request}('POST','/v1/settings',{path:path,value:false});await refresh();}catch(error){box.textContent='⚠️ Hold was not released — '+error.message;}};box.append(held,release);
|
|
109
|
+
}
|
|
110
|
+
var state=document.createElement('p');state.textContent='🟢 Process: '+model.delivery.process+' · Delivery: '+(model.delivery.healthy?'all configured channels measured able to carry':'needs a channel reading or repair');box.append(state);
|
|
111
|
+
var details=document.createElement('details'),summary=document.createElement('summary');summary.textContent='📋 Channel readings';details.append(summary);
|
|
112
|
+
var reason=document.createElement('p');reason.textContent=model.delivery.reason;details.append(reason);
|
|
113
|
+
var table=document.createElement('table');table.style.cssText='width:100%;table-layout:fixed;border-collapse:collapse';var head=document.createElement('tr');['Channel','Measured state'].forEach(function(text){var cell=document.createElement('th');cell.textContent=text;head.append(cell);});table.append(head);
|
|
114
|
+
model.delivery.carriage.forEach(function(reading){var row=document.createElement('tr');[reading.channel,reading.state==='unmeasured'?'UNMEASURED — no carriage reading':reading.state+(reading.detail?' — '+reading.detail:'')].forEach(function(text){var cell=document.createElement('td');cell.textContent=text;cell.style.cssText='padding:4px;vertical-align:top;overflow-wrap:anywhere';row.append(cell);});table.append(row);});details.append(table);box.append(details);
|
|
115
|
+
}catch(error){box.replaceChildren();box.textContent='⚠️ Notification status could not be read — '+error.message;}
|
|
116
|
+
}
|
|
117
|
+
refresh();setInterval(refresh,5000);
|
|
118
|
+
})();`;
|
|
119
|
+
}
|
|
96
120
|
const NAV_KEEPS_WORKSPACE = `
|
|
97
121
|
document.querySelectorAll("nav a").forEach(function (a) { a.search = location.search; });
|
|
98
122
|
`;
|
|
99
123
|
function shell(title, here, body, script) {
|
|
100
124
|
const nav = [["/", "💬 Conversations"], ["/settings", "⚙️ Settings"], ["/public-access", "🌐 Public access"]]
|
|
101
125
|
.map(([href, text]) => `<a href="${href}"${href === here ? ' class="here"' : ""}>${text}</a>`).join("");
|
|
102
|
-
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${title}</title>${ICON_HEAD}<style>${PAGE_STYLE}${PANEL_STYLE}</style></head><body><nav>${nav}</nav><div class="wrap"><div id="signin"></div>${body}</div><script>${SIGN_IN}${NAV_KEEPS_WORKSPACE}${script}</script><script data-page="${here.slice(1)}">${PICKER_PAGE_SOURCE}</script></body></html>`;
|
|
126
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${title}</title>${ICON_HEAD}<style>${PAGE_STYLE}${PANEL_STYLE}</style></head><body><nav>${nav}</nav><div class="wrap"><div id="signin"></div>${body}</div><script>${SIGN_IN}${NAV_KEEPS_WORKSPACE}${script}${notificationStatusScript("call")}</script><script data-page="${here.slice(1)}">${PICKER_PAGE_SOURCE}</script></body></html>`;
|
|
103
127
|
}
|
|
104
128
|
const SETTINGS_SCRIPT = `
|
|
105
129
|
var root = document.getElementById("root"), said = document.getElementById("said");
|
|
@@ -247,7 +247,7 @@ export class SessionDriver {
|
|
|
247
247
|
const live = this.lives.get(id);
|
|
248
248
|
const terminal = consoleSession(id)?.info();
|
|
249
249
|
const pid = terminal?.pid;
|
|
250
|
-
return { working: live !== undefined && (live.busy || live.session.working === true), pendingInput: live?.session.pendingInput === true, nativePid: pid !== undefined && pidAlive(pid) ? pid : undefined, inputVersion: terminal?.inputVersion, nativeModel: live?.session.nativeModel };
|
|
250
|
+
return { working: live !== undefined && (live.busy || live.session.working === true), pendingInput: live?.session.pendingInput === true, nativePid: pid !== undefined && pidAlive(pid) ? pid : undefined, inputVersion: terminal?.inputVersion, nativeModel: live?.session.nativeModel, startupDiagnostic: live?.session.startupDiagnostic };
|
|
251
251
|
}
|
|
252
252
|
/** No turn running and none in line: the store can pass to another process without losing an answer. */
|
|
253
253
|
quiet() {
|
|
@@ -4,6 +4,7 @@ import { fileURLToPath } from "url";
|
|
|
4
4
|
import { CONVERSATIONS_VIEWS, PAGE_STYLE, SIGN_IN_SCRIPT, servingLine, storedStamp } from "./chatPage.js";
|
|
5
5
|
import { PASSKEY_SCRIPT } from "./passkeyDoor.js";
|
|
6
6
|
import { PROVIDER_CHOICES } from "./providers.js";
|
|
7
|
+
import { notificationStatusScript } from "./panelPage.js";
|
|
7
8
|
import { ICON_HEAD } from "./iconDoor.js";
|
|
8
9
|
const require = createRequire(import.meta.url);
|
|
9
10
|
function asset(name, installed) {
|
|
@@ -291,5 +292,6 @@ function home(){
|
|
|
291
292
|
}
|
|
292
293
|
window.addEventListener("popstate",function(event){render(event.state&&event.state.bn?event.state:rootState());});
|
|
293
294
|
startSignIn();
|
|
295
|
+
${notificationStatusScript("api")}
|
|
294
296
|
</script></body></html>`;
|
|
295
297
|
}
|
package/dist/notify.js
CHANGED
|
@@ -141,7 +141,7 @@ function defaultConfig() {
|
|
|
141
141
|
* Returns true if notifications should be suppressed right now based on DND config.
|
|
142
142
|
* Every priority is held while DND is active — including high.
|
|
143
143
|
*/
|
|
144
|
-
function isDndActive(cfg) {
|
|
144
|
+
export function isDndActive(cfg) {
|
|
145
145
|
const dnd = cfg.dnd ?? {};
|
|
146
146
|
if (dnd.enabled === true)
|
|
147
147
|
return true; // manual toggle wins
|
|
@@ -1522,7 +1522,7 @@ function refreshReach(cfg = loadConfig()) {
|
|
|
1522
1522
|
// present — which is what `channelsThatCanCarry` held in this exact spot while
|
|
1523
1523
|
// nothing ever called it: the decision belonged to a caller that no longer
|
|
1524
1524
|
// exists, so the surface Meni reads answered "healthy" from liveness alone.
|
|
1525
|
-
function deliveryReport() {
|
|
1525
|
+
export function deliveryReport() {
|
|
1526
1526
|
const cfg = loadConfig();
|
|
1527
1527
|
secretsReadFailure = null;
|
|
1528
1528
|
const able = deliverableChannels(cfg, loadSecretsForReport());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-notify-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.384",
|
|
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",
|