Show event label and first paragraph in notifications

This commit is contained in:
Ian Gulliver
2026-10-20 21:49:01 -07:00
parent da824b9728
commit c67c215118
3 changed files with 33 additions and 13 deletions
+1 -1
View File
@@ -352,7 +352,7 @@ A user who is away has byre answer their agents' questions instead of waiting (`
The running macOS app posts notifications for events on its SSE stream, raised by the app itself (`notifyInbox`, `notifyError`, `notifyTurn` and `notifyTask` in `mac/Sources/Byre/Notifications.swift`, through `UNUserNotificationCenter`). With the app not running, nothing notifies; closing its window leaves it running.
- **Preferences.** The `users.notify_*` boolean columns hold what notifies the user, returned as `notification_prefs` on `GET /api/me` and set with `PUT /api/me/notifications`: `questions` (`inbox.created`, on by default), `reports` (task turns that end with `summary: true` on `turn.ended`, labelled "Turn summaries"), `ready` (`task.ready`), `discard` (`task.discard_suggested`), `merge_problems` (`task.merge_stopped` and `task.merge_after_review_dropped`), `workflows` (`task.workflow_finished`), `errors` (`session.error`) and `rate_limits` (`session.rate_limited`). Migration `080-normalize-notification-preferences` moves existing JSON preferences into those columns and drops the JSON column; a missing key becomes off. New users have only questions enabled. The app checks them against each event as it arrives.
- **Content.** The title is `byre · <task title>` and the body the first line of the question, turn summary, ready-to-merge overview, discard or merge-problem reason, workflow output, or error (or "Rate limited"), cut at 200 characters. The notification's identifier is the question's ID, `turn-<seq>` for a turn summary, `workflow-<seq>` for a finished workflow, `error-<seq>` for an error or rate limit, and `task-<task id>` for ready to merge, suggests discard and merge problems, so each task shows at most one of those three at a time.
- **Content.** The title is `byre · <task title>`, the subtitle what happened (`Question`, `Turn finished`, `Ready to merge`, `Suggests discard`, `Merge stopped`, `Didn't merge after the review`, `Finished <workflow>`, `Error` or `Rate limited`), and the body the first paragraph of the question, turn summary, ready-to-merge overview, discard or merge-problem reason, workflow output, or error (empty for a rate limit): the first run of lines that aren't blank, Markdown headings, fences or HTML tags, with list and quote markers dropped and inline Markdown rendered to plain text, joined with spaces and cut at 200 characters. The notification's identifier is the question's ID, `turn-<seq>` for a turn summary, `workflow-<seq>` for a finished workflow, `error-<seq>` for an error or rate limit, and `task-<task id>` for ready to merge, suggests discard and merge problems, so each task shows at most one of those three at a time.
- **Clearing.** A delivered notification leaves Notification Center once it is dealt with anywhere, on this Mac, another one or by the lead: an `inbox.updated` event whose item is no longer `open` removes the item's notification (`clearInbox`), a `summary.read` event removes that task's `turn-<seq>` notifications up to its `seq` (`clearTurns`), and `task.merged`, `task.discarded`, `snapshot.created` (unless its `trigger` is `answer`) and `inbox.created` remove the task's `task-<task id>` notification (`clearTask`); the last two are the events that clear the task's ready state on the server.
- **Clicking** a notification activates the app, shows its window and points the right pane at the item's task.