omni-notify-mcp 1.3.457 → 1.3.459

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.
@@ -92,6 +92,7 @@ header{order:-2}
92
92
  .conv tbody tr:focus-visible{outline:2px solid var(--me);outline-offset:-2px}
93
93
  .conv tbody tr.sel{background:rgba(11,95,255,.12)}
94
94
  .conv td{white-space:nowrap;text-overflow:ellipsis}
95
+ .conv td.k-name{white-space:normal;overflow-wrap:anywhere;font-weight:600}
95
96
  .conv td.statecell{white-space:normal;overflow-wrap:normal;font-weight:600}
96
97
  .conv td.statecell[data-state=closed]{color:var(--mut);font-weight:400}
97
98
  .conv td.timecell{font-size:12px;font-variant-numeric:tabular-nums}
@@ -179,12 +180,12 @@ input:not([type=checkbox]):not([type=radio]),select{min-height:40px}
179
180
  .conv tbody tr.sel{background:var(--agent);border-color:var(--me);box-shadow:inset 3px 0 0 var(--me)}
180
181
  .conv td,.conv td:last-child{display:flex;gap:6px;align-items:baseline;min-width:0;border:0;border-bottom:1px solid var(--line);border-left:1px solid var(--line);padding:5px 8px;font-size:14px;white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere}
181
182
  .conv td[data-label]::before{content:attr(data-label);flex:none;min-width:38px;color:var(--mut);font-size:11px;letter-spacing:.04em;text-transform:uppercase}
182
- .conv td.checkcell{grid-row:1/span 5;border-left:0;padding:0;align-items:stretch;background:var(--agent)}
183
+ .conv td.checkcell{grid-row:1/span 6;border-left:0;padding:0;align-items:stretch;background:var(--agent)}
183
184
  .conv td.checkcell input{appearance:none;-webkit-appearance:none;width:40px;height:auto;min-height:44px;margin:0;border:0;border-radius:0;background:linear-gradient(var(--bg),var(--bg)) center/18px 18px no-repeat,linear-gradient(var(--mut),var(--mut)) center/22px 22px no-repeat}
184
185
  .conv td.checkcell input:checked{background:linear-gradient(#fff,#fff) center/8px 8px no-repeat,linear-gradient(var(--me),var(--me)) center/22px 22px no-repeat}
185
186
  .conv td.timecell{flex-wrap:wrap;gap:0 6px}.conv td.timecell .day,.conv td.timecell .ms,.conv td.timecell .age::before{display:none}
186
187
  .conv td.timecell .age{order:1;color:var(--fg);white-space:nowrap}.conv td.timecell .at{order:2;color:var(--mut);font-size:12px;white-space:nowrap}
187
- .conv td.k-process{grid-column:2/-1;order:4}.conv td.k-id{grid-column:2/-1;order:5;align-items:center}
188
+ .conv td.k-name{grid-column:2/-1}.conv td.k-process{grid-column:2/-1;order:4}.conv td.k-id{grid-column:2/-1;order:5;align-items:center}
188
189
  .conv td.k-id .idrow{flex:1 1 0;overflow:visible}
189
190
  .conv .conv-id{flex:1 1 0;white-space:normal;overflow:visible;overflow-wrap:anywhere}
190
191
  .conv td.actions,.conv td.actions:last-child{grid-column:1/-1;order:6;display:block;border-left:0;border-bottom:0;padding:6px 8px}
@@ -480,6 +481,7 @@ async function listView() {
480
481
  };
481
482
  var cols = [
482
483
  { key: "", check: true, name: "", min: 34, weight: 0 },
484
+ { key: "name", name: "Name", min: 180, weight: 2.2 },
483
485
  { key: "project", name: "Project", min: 104, weight: 1.3 },
484
486
  { key: "state", name: "State", min: 96, weight: 1.1, state: true },
485
487
  { key: "origin", name: "From", min: 72, weight: 0.7 },
@@ -492,6 +494,7 @@ async function listView() {
492
494
  ];
493
495
  var keyOf = function (col) { return col.key || "_check"; };
494
496
  var value = function (c, key) {
497
+ if (key === "name") return (c.title || "").toLowerCase();
495
498
  if (key === "project") return c.project ? base(c.project).toLowerCase() : "";
496
499
  if (key === "state") return c.state;
497
500
  if (key === "provider") return c.provider;
@@ -513,6 +516,7 @@ async function listView() {
513
516
  };
514
517
  var stateText = function (c) { return c.state; };
515
518
  var textOf = function (c, col) {
519
+ if (col.key === "name") return c.title || "";
516
520
  if (col.key === "project") return c.project ? base(c.project) : "No project";
517
521
  if (col.key === "state") return stateText(c);
518
522
  if (col.key === "provider") return c.provider;
@@ -524,6 +528,7 @@ async function listView() {
524
528
  return "";
525
529
  };
526
530
  var titleOf = function (c, col) {
531
+ if (col.key === "name") return (c.title || "") + "\\n" + c.id;
527
532
  if (col.key === "project") return c.project || "";
528
533
  if (col.key === "provider") return c.provider;
529
534
  if (col.key === "id") return c.id;
@@ -9,7 +9,7 @@
9
9
  * once a passkey is enrolled the gateway token is honoured only on a request from this machine.
10
10
  */
11
11
  import { createServer } from "http";
12
- import { GatewayError, conversationReading, providerStartupReading, archiveConversation, conversationOwner, deleteConversation, listProjects, monotonicMs, scopedConversation, viewerOfHeaders, createdOn, creatorOf, openConversation, readConversation, requireConversationEnabled, sendToConversation, setConversationProject, shelvedConversations, startConversation, stopConversation, unarchiveConversation, waitForEvents, } from "./conversationOwner.js";
12
+ import { GatewayError, conversationReading, describeConversation, providerStartupReading, archiveConversation, conversationOwner, deleteConversation, listProjects, monotonicMs, scopedConversation, viewerOfHeaders, createdOn, creatorOf, openConversation, readConversation, requireConversationEnabled, sendToConversation, setConversationProject, shelvedConversations, startConversation, stopConversation, unarchiveConversation, waitForEvents, } from "./conversationOwner.js";
13
13
  import { CHAT_HEADERS } from "./chatPage.js";
14
14
  import { isIconPath, serveIcon } from "./iconDoor.js";
15
15
  import { handleMcp } from "./mcpDoor.js";
@@ -161,7 +161,7 @@ async function route(req, url, arrivedAt) {
161
161
  scopedConversation(id, viewer);
162
162
  if (id === undefined) {
163
163
  if (method === "GET")
164
- return { status: 200, body: { conversations: shelvedConversations(shelfOf(url), viewer) } };
164
+ return { status: 200, body: { conversations: shelvedConversations(shelfOf(url), viewer).map(describeConversation) } };
165
165
  if (method === "POST") {
166
166
  const body = await readJson(req);
167
167
  const model = typeof body.model === "string" && body.model.length > 0 ? body.model : undefined;
@@ -263,11 +263,9 @@ export class EmailAgentInbox {
263
263
  return this.answer({ messageId: thread.messageIds.at(-1), references: thread.messageIds.slice(0, -1) }, thread.subject, text);
264
264
  }
265
265
  /** One answer, mailed to his own account as a reply in the thread of the mail it answers; replying to it reaches the agent again. */
266
- async answer(mail, subject, text) {
267
- const { user, pass } = this.account();
268
- const server = this.smtpServer();
269
- const transport = createTransport({ ...server, auth: { user: user, pass: pass } });
270
- const message = {
266
+ answer(mail, subject, text) {
267
+ const { user } = this.account();
268
+ return this.mail({
271
269
  from: { name: "BN agent", address: user },
272
270
  to: user,
273
271
  replyTo: agentAddress(user),
@@ -276,7 +274,23 @@ export class EmailAgentInbox {
276
274
  references: [...mail.references, mail.messageId],
277
275
  headers: { [AGENT_HEADER]: "answer" },
278
276
  text,
279
- };
277
+ });
278
+ }
279
+ /** #4581 — the `email` priority's one channel: a notification mailed whole to his own account, its first line the subject. */
280
+ notifyOwner(text) {
281
+ const { user } = this.account();
282
+ return this.mail({ from: { name: "BullseyeNotify", address: user }, to: user, subject: text.split("\n", 1)[0].replace(/\*/g, "").trim() || "BullseyeNotify", text });
283
+ }
284
+ /** #4581 — logs in to the account's SMTP server and sends nothing; throws why the login failed. */
285
+ async verify() {
286
+ const { user, pass } = this.account();
287
+ await createTransport({ ...this.smtpServer(), auth: { user: user, pass: pass } }).verify();
288
+ }
289
+ /** Sends one mail through the account's SMTP server, retrying a transient refusal; throws why it did not go. */
290
+ async mail(message) {
291
+ const { user, pass } = this.account();
292
+ const server = this.smtpServer();
293
+ const transport = createTransport({ ...server, auth: { user: user, pass: pass } });
280
294
  for (let attempt = 1;; attempt++) {
281
295
  try {
282
296
  await transport.sendMail(message);
@@ -284,7 +298,7 @@ export class EmailAgentInbox {
284
298
  }
285
299
  catch (err) {
286
300
  if (attempt >= SMTP_ATTEMPTS || !transientSmtp(err))
287
- throw new Error(`${server.host} did not take the answer after ${attempt} attempt(s): ${err instanceof Error ? err.message : String(err)}`);
301
+ throw new Error(`${server.host} did not take the mail after ${attempt} attempt(s): ${err instanceof Error ? err.message : String(err)}`);
288
302
  await new Promise((resolve) => setTimeout(resolve, 2000 * 2 ** (attempt - 1)));
289
303
  }
290
304
  }
@@ -15,6 +15,8 @@ export function formatIdleReading(reading) {
15
15
  : `idle: could not measure — ${reading.why} — user activity unknown, so activity gating is skipped`;
16
16
  }
17
17
  const EVERY_PRIORITY = ["low", "normal", "high"];
18
+ /** #4581 — every priority a caller may name: the three that fan out, and `email`, which reaches the one email channel and nothing else. */
19
+ export const PRIORITIES = [...EVERY_PRIORITY, "email"];
18
20
  // GATE: which priorities reach each channel, in send order, and what an at-keyboard user holds back — a channel is never attempted for a priority outside its list
19
21
  const CHANNEL_ROUTES = [
20
22
  { channel: "desktop", priorities: ["normal", "high"], atKeyboard: "desktopSignal" },
@@ -24,9 +26,10 @@ const CHANNEL_ROUTES = [
24
26
  { channel: "slack", priorities: EVERY_PRIORITY, atKeyboard: "channelLog" },
25
27
  { channel: "teams", priorities: EVERY_PRIORITY, atKeyboard: "heldBack" },
26
28
  { channel: "sms", priorities: ["high"], atKeyboard: "heldBack" },
29
+ { channel: "email", priorities: ["email"], atKeyboard: "heldBack" },
27
30
  ];
28
31
  export function describePriorityRouting() {
29
- return EVERY_PRIORITY
32
+ return PRIORITIES
30
33
  .map((priority) => `${priority}=${CHANNEL_ROUTES.filter((route) => route.priorities.includes(priority)).map((route) => route.channel).join("+")}`)
31
34
  .join("; ");
32
35
  }
@@ -42,12 +45,12 @@ export function computeDesktopOnlyMode(priority, policy, ctx) {
42
45
  reason: "DND active — every priority is held, no channel was attempted",
43
46
  };
44
47
  }
45
- if (priority === "high") {
48
+ if (priority === "high" || priority === "email") {
46
49
  return {
47
50
  desktopOnly: false,
48
51
  idle: ctx.idle,
49
52
  idleKnown,
50
- reason: "priority=high — every enabled channel is used and activity gating is waived",
53
+ reason: `priority=${priority} — every enabled channel of that priority is used and activity gating is waived`,
51
54
  };
52
55
  }
53
56
  // The measurement FAILED: a deliberate fail-open. Stated as its own branch so
@@ -108,6 +111,7 @@ export async function sendWithRouting(options) {
108
111
  slack: options.enableSlack,
109
112
  teams: options.enableTeams,
110
113
  sms: options.enableSms,
114
+ email: options.enableEmail,
111
115
  };
112
116
  const decision = computeDesktopOnlyMode(priority, policy, ctx);
113
117
  if (decision.suppressedReason === "dnd") {
package/dist/notify.js CHANGED
@@ -450,6 +450,7 @@ async function sendNotification(message, priority, client, buttons) {
450
450
  enableDiscord: able.discord,
451
451
  enableSlack: able.slack,
452
452
  enableTeams: able.teams,
453
+ enableEmail: able.email,
453
454
  senders: measuredSends({
454
455
  desktop: async () => {
455
456
  if (cfg.desktop?.tts) {
@@ -568,6 +569,7 @@ async function sendNotification(message, priority, client, buttons) {
568
569
  if (!r.ok)
569
570
  throw new Error(`Teams ${r.status}: ${await r.text()}`);
570
571
  },
572
+ email: () => (mailInbox ??= emailAgentInbox()).notifyOwner(message),
571
573
  }),
572
574
  });
573
575
  if (result.suppressedReason) {
@@ -1682,22 +1684,35 @@ async function probeTelegramReach(token) {
1682
1684
  return { ok: false, at: Date.now(), by: "a getMe probe", detail: err instanceof Error ? err.message : String(err) };
1683
1685
  }
1684
1686
  }
1687
+ async function probeEmailReach() {
1688
+ try {
1689
+ await (mailInbox ??= emailAgentInbox()).verify();
1690
+ return { ok: true, at: Date.now(), by: "an SMTP login check", detail: "the email account's SMTP server took its login" };
1691
+ }
1692
+ catch (err) {
1693
+ if (!(err instanceof Error))
1694
+ throw err;
1695
+ // OWNER: a throwing probe would take down the caller that asked for it, and no caller may die of a dead channel — the server's refusal is RECORDED as a reading and rendered (a console line and the delivery report). Nothing leaves this catch.
1696
+ return { ok: false, at: Date.now(), by: "an SMTP login check", detail: err.message };
1697
+ }
1698
+ }
1685
1699
  // The measurement is taken where the transport is; a probe that fails is a RESULT
1686
1700
  // recorded here, never a throw that takes the caller with it.
1687
1701
  function measureReach(channel, cfg) {
1688
1702
  const probing = channel === "telegram"
1689
1703
  ? (cfg.telegram?.token ? probeTelegramReach(cfg.telegram.token) : null)
1690
- : null;
1704
+ : channel === "email" ? probeEmailReach() : null;
1691
1705
  if (!probing)
1692
1706
  return null;
1693
1707
  return probing.then((reach) => { recordReach(channel, reach.ok, reach.by, reach.detail); return reach; });
1694
1708
  }
1709
+ // The channels an `ask` question can ride and wait for its answer on.
1710
+ function askableChannels(cfg) {
1711
+ return cfg.telegram?.enabled && cfg.telegram.token && cfg.telegram.chatIds?.length ? ["telegram"] : [];
1712
+ }
1695
1713
  // The channels whose transport this process can verify by itself.
1696
1714
  function probeableChannels(cfg) {
1697
- const channels = [];
1698
- if (cfg.telegram?.enabled && cfg.telegram.token && cfg.telegram.chatIds?.length)
1699
- channels.push("telegram");
1700
- return channels;
1715
+ return [...askableChannels(cfg), ...(emailDeliverable(cfg) ? ["email"] : [])];
1701
1716
  }
1702
1717
  // The measurement must EXIST before anything reads it, so a channel is measured
1703
1718
  // the moment its config does: at boot, and again on every config write — which is
@@ -1768,8 +1783,13 @@ function deliverableChannels(cfg, secrets = loadSecrets()) {
1768
1783
  slack: !!(cfg.slack?.enabled && ((cfg.slack.channels?.length && (cfg.slack.botToken || slackCreds(secrets).token)) || cfg.slack.webhookUrl)),
1769
1784
  teams: !!(cfg.teams?.enabled && cfg.teams.webhookUrl),
1770
1785
  sms: smsDeliverable(cfg),
1786
+ email: emailDeliverable(cfg),
1771
1787
  };
1772
1788
  }
1789
+ /** #4581 — the email channel can carry a mail: the account the agent's email door signs in with is configured. */
1790
+ function emailDeliverable(cfg) {
1791
+ return !!(cfg.email?.host && cfg.email.user && cfg.email.pass);
1792
+ }
1773
1793
  /** The SMS channel can carry a text: enabled, credentialed and naming a number. */
1774
1794
  function smsDeliverable(cfg) {
1775
1795
  return !!(cfg.sms?.enabled && cfg.sms.accessKeyId && cfg.sms.secretAccessKey && cfg.sms.region && cfg.sms.to?.length);
@@ -2283,7 +2303,8 @@ function drainInboxFor(tag) {
2283
2303
  // nobody must not be swallowed by the part before it.
2284
2304
  async function sendChunked(message, priority, clientId) {
2285
2305
  const outcomes = [];
2286
- const parts = splitForNotify(message);
2306
+ // #4581 — an email carries the whole message, so the email priority is one mail, never one per part
2307
+ const parts = priority === "email" ? [message] : splitForNotify(message);
2287
2308
  const buttons = decisionButtons(message);
2288
2309
  for (const [i, chunk] of parts.entries()) {
2289
2310
  outcomes.push(await sendNotification(withLead(`[${clientId}]`, chunk), priority, clientId, i === parts.length - 1 ? buttons : undefined));
@@ -2486,8 +2507,8 @@ export function createMcpServer(clientId, sessionTag) {
2486
2507
  "is split for you into numbered '(1/N) ...' parts, each 500 characters or less, and " +
2487
2508
  "delivered in order. Never truncate to fit a part.", {
2488
2509
  message: z.string().max(5000).describe("Notification message — up to 5000 chars; the server splits it into numbered parts"),
2489
- priority: z.enum(["low", "normal", "high"]).default("normal")
2490
- .describe(`Channels per priority, each only when enabled: ${describePriorityRouting()} — high also bypasses activity gating (it never overrides DND)`),
2510
+ priority: z.enum(["low", "normal", "high", "email"]).default("normal")
2511
+ .describe(`Channels per priority, each only when enabled: ${describePriorityRouting()} — high and email also bypass activity gating (neither overrides DND); email sends the whole message as one mail, the last step for a board decision nothing else got answered`),
2491
2512
  answers: z.string().max(2000).optional()
2492
2513
  .describe("The user's own words, verbatim, of the request this notification answers. Required unless the message is a board decision carrying its decision link."),
2493
2514
  }, async ({ message, priority, answers }) => {
@@ -2556,7 +2577,7 @@ export function createMcpServer(clientId, sessionTag) {
2556
2577
  // whether a token is present — a revoked token satisfied the config check
2557
2578
  // for four months and every question rode it into the void.
2558
2579
  // #4451: only a channel that is switched on, with its token and chats, is a candidate — measureReach alone reads the token, so a Telegram switched off in settings was still probed, found alive, and asked through.
2559
- const askCandidates = probeableChannels(cfg);
2580
+ const askCandidates = askableChannels(cfg);
2560
2581
  const askSkipNotes = [];
2561
2582
  const askFormatNotes = [];
2562
2583
  // Measured now, per candidate: what cannot carry is absent from `canCarry`.