omp packages

pi-multinotify0.2.0

Desktop and email notifications with token-routed email replies for pi

firechickenmp4 Published 1 day ago MIT ~279 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-multinotify

Pi desktop and email notifications, with optional authenticated email replies routed back to the originating session.

Features

  • Desktop notifications through notify-send on Linux and toast notifications on Windows 10/11.
  • Plain-text and rendered HTML email through SMTP.
  • Independent desktop, email, and reply switches.
  • Per-session deduplication and channel failure isolation.
  • Email replies authorized by a sender allowlist and an unguessable per-message route token.
  • Persistent local reply queue with restart deduplication.
  • Optional systemd user service for incremental IMAP polling.

Install

pi install npm:pi-multinotify

For local development:

pi install /absolute/path/to/pi-multinotify

Node.js 22.18 or newer is required. Desktop notifications require notify-send on Linux; on Windows they run through the bundled Windows PowerShell 5.1. Other platforms report an unsupported-platform failure while email keeps working.

Configure

Copy config.example.json to ~/.pi/agent/notify-email.json and replace every example value. Keep the file private because it contains an SMTP credential.

{
  "smtp": {
    "host": "smtp.example.com",
    "port": 465,
    "secure": true,
    "user": "pi@example.com",
    "pass": "app-password",
    "from": "pi <pi@example.com>"
  },
  "imap": {
    "host": "imap.example.com",
    "port": 993,
    "secure": true,
    "mailbox": "INBOX"
  },
  "to": ["you@example.com"],
  "reply": {
    "allowedFrom": ["you@example.com"]
  }
}

IMAP defaults to the SMTP username and password; set imap.user and imap.pass only when they differ.

~/.pi/agent/notify.json stores channel switches and polling policy. See notify.example.json. Desktop urgency defaults to critical; set it to normal for the previous timeout-based behavior. On Windows, critical shows a long toast and low/normal a short one. Email replies are disabled by default.

The legacy ~/.pi/agent/email-switch.json is read when notify.json has no email setting. /email and the notify_email and email_switch tools remain available.

Commands

/notify status
/notify desktop on|off
/notify desktop urgency low|normal|critical
/notify email on|off
/notify reply on|off
/notify test desktop
/notify test email
/email on|off|status

Email replies

  1. Install the systemd user unit from the package directory:

    node /absolute/path/to/pi-multinotify/scripts/install-service.mjs
    systemctl --user daemon-reload
    
  2. Validate the local account configuration without connecting to IMAP:

    node /absolute/path/to/pi-multinotify/replyd.mjs --check
    
  3. Enable replies in pi with /notify reply on, then start the service:

    systemctl --user enable --now pi-multinotify-reply.service
    

The first poll records the current mailbox cursor without importing historical messages. Later polls process only new UIDs. To perform one explicit poll, run replyd.mjs --once.

Replies are matched by In-Reply-To/References, with the subject route token as a fallback. The sender must exactly match reply.allowedFrom; authorization relies on both this check and the unguessable route token rather than SPF/DKIM validation. Empty replies, quoted-only replies, expired routes, and unauthorized messages are ignored. A running session receives replies immediately or as follow-up messages while busy; a stopped session receives them when resumed. When a reply arrives while a question tool form is waiting, pi-multinotify first tries the in-process pi-code:question:v1 channel: a numeric reply such as 2 (or 1,3 for multi-select) selects those options directly, and any other non-numeric text becomes the custom answer. If that channel is unavailable or refuses the reply, pi-multinotify falls back to sending one Escape keypress through tmux or wezterm to cancel the form, delivering the reply as a follow-up once the turn ends; other dialogs such as permission confirmations are left untouched, and batch forms asking several questions at once always use the Escape fallback. Without either mechanism, the reply stays queued until the form is dismissed manually.

Automatic notifications use TUI/RPC lifecycle events. The waiting-input notification refers to extension UI prompts such as select, confirm, and input dialogs.

After upgrading the package, rerun scripts/install-service.mjs --force so the systemd unit points to the current package and Node.js paths. If you upgraded from the old package name, the script reports the leftover pi-multinotity-reply.service unit; disable and remove it before you enable the new one.

Development

npm install
npm test
npm run typecheck
npm run test:coverage
npm run pack:check

PI_NOTIFY_EMAIL_DRY=1 enables the existing email dry-run mode for extension testing.