omni-notify-mcp 1.3.383 → 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.
@@ -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
- this.still = setTimeout(() => void this.terminal.screenText().then((text) => { if (text !== "")
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() {
@@ -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() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-notify-mcp",
3
- "version": "1.3.383",
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",