Skip to content

feat(push): operational push notifications (ntfy) for agent events#119

Merged
oratis merged 1 commit into
mainfrom
feat/push-ntfy
Jun 19, 2026
Merged

feat(push): operational push notifications (ntfy) for agent events#119
oratis merged 1 commit into
mainfrom
feat/push-ntfy

Conversation

@oratis

@oratis oratis commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Stacked on #117#115#114#113. Retarget to main once those merge.

What

Operational push (the "agent done / errored / needs-permission" + "Reve left a note" alerts the iOS plan calls for). Opt-in, event-scoped — not proactive emotional outreach (that stays a ROADMAP non-goal); think CI notification.

Transport is pluggable, and ntfy works today with zero Apple infrastructure — delivery is a plain HTTP POST to a topic on ntfy.sh (or your self-hosted server), so the privacy-first path the plan recommended is fully functional now. apns is the iOS-native path and needs an Apple push key, so it's a clearly-marked stub.

src/web/push.ts:

  • subscriptions (~/.lisa/push.json): { kind: "ntfy"|"apns", target, server?, prefs }; prefs = {done, error, permission, idle, advisor} (advisor off by default).
  • agentPushEvents(prev, next)pure trigger: fires on →done, →error (high), and a newly-appearing pendingPermission.
  • sendNtfy(...) — injectable fetch; PushBridge throttles per (session, kind) and fans out to matching subscriptions on hub update events + Reve idle_message.
  • Payloads are low-sensitivity metadata only (agent · project · state · reason) — never prompts, replies, or terminal output.

Endpoints: POST /api/push/register (authed — a phone self-registers), POST /api/push/unregister, GET /api/push/list, POST /api/push/prefs.

Also fixed a latent throttle edge (default lastSent of 0 suppressed the first event when now() was small) → -Infinity.

Verification

  • npm run typecheck + npm run build clean; 753 tests / 752 pass / 1 skip / 0 fail (12 new: prefs, the pure trigger's transitions/edge-dedup, ntfy POST shape via mock fetch, bridge pref-filtering + throttle, storage).
  • Live-checked the endpoints: register → list → prefs → unregister, plus 400 on a missing target.
  • Not exercised live: an actual POST to a real ntfy server (external publish) and APNs delivery (needs an Apple key). The ntfy send path is covered by the mock-fetch unit test.

🤖 Generated with Claude Code

- src/web/push.ts: per-device push subscriptions (ntfy topic or apns token) + prefs (~/.lisa/push.json); agentPushEvents() pure trigger (done/error/permission transitions); sendNtfy() — a plain HTTP POST to a topic, so it works with zero Apple infra; PushBridge throttles + delivers on hub 'update' + Reve idle messages. APNs is a documented stub (needs an Apple push key). Payloads carry low-sensitivity metadata only.

- server: bridge wired into hub.on('update') + the idle_message broadcasts; POST /api/push/{register,unregister,prefs}, GET /api/push/list (register authed so a phone self-registers).

Fixed a latent throttle edge (first event was suppressed when now() < throttleMs).

Verified: typecheck + build clean; 753 tests pass (12 new); live-checked register/list/prefs/unregister; the ntfy send is covered by a mock-fetch unit test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@oratis oratis changed the base branch from feat/device-pairing to main June 19, 2026 05:08
@oratis oratis merged commit 0c8211e into main Jun 19, 2026
1 check passed
oratis added a commit that referenced this pull request Jun 19, 2026
docs(ios): sync the iOS companion plan with shipped backend (#113#119)
@oratis oratis deleted the feat/push-ntfy branch June 19, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant