mirror of
https://github.com/block/buzz.git
synced 2026-11-30 21:21:48 +00:00
## Summary Adds NIP-SL (Send Later) and a "Deferred actions" section to NIP-FI. This change is specification only: the relay, schema and clients are untouched. **NIP-SL** - An author signs an ordinary message dated for its release time `T` and submits it inside a private, author-signed instruction (`kind:30360`). The relay stores the message as an ordinary event between `T` and `T + release_window`, so the timestamp rule and the signer rule stay as they are. - The relay reports how the send ended in an author-only status (`kind:30361`) signed with its NIP-11 `self` key: `sent`, `failed`, `missed` or `cancelled`. - Edit, change the time, send now and cancel are replacements of the instruction under a generation compare-and-swap. Release and cancel are one conditional change, so a confirmed cancel is never followed by a post. - NIP-11 discovery through `supported_extensions` (`buzz-send-later`) and a `send_later` descriptor that carries the limits. Recommended limits: 120 days ahead, 100 pending per author per community, a 900 second release window, 7 days of text retention for failed or missed sends, 30 days of status retention. - The document also specifies the acceptance checks with their `OK` messages, the events that end a send early (ban, disconnect, channel deletion, operator withdrawal), retention, read access and the complete read a client derives state from. **NIP-FI** - A relay that stores actions it executes without a live session writes a disconnect record for each disconnect command and cancels the pending actions whose admission the record fences, in one atomic change, before it closes a connection or answers `200`. The record carries the command's scope, and each action stores the issuer, owner and verified `iat` of its admitting assertion, so a `revoke_through` cutoff applies to pending actions as it does to sessions. - A command answered `503`, or not answered, is retried with a freshly signed command. The deny set is unchanged. - A relay accepts no deferred action while a process that answers disconnect commands for the same storage does not apply the section. **Design choices worth a reviewer's eye** - Both kinds are readable only by the author. The owner of an agent cannot read the agent's instructions or statuses. A pending message is stored in the clear, as a posted one is. - Each send stores the owner verified at acceptance, and release uses it, because there is no request at release to take an owner from. - A relay keeps at most `max_pending` ended instructions per author, so the instruction read fits in one request. Past that bound, the text of a failed send or the record of an author's own cancel can be deleted before its retention period ends. - A disconnect covers the target key and every agent key it owns. Nothing else in NIP-FI ends an accepted send, and release does not evaluate issuer policy again. - A released message carries `created_at` `T` and can arrive up to `release_window` later. A reader whose read state is a `created_at` frontier displays it and counts it as read; the document states this limitation and what read state removes it. - Channels, threads and DMs of the listed kinds are in scope. Forum posts and recurring sends are left for later work. **Follow-up** - Relay implementation, including registration of kinds 30360 and 30361 in the kind registry and removal of the unused placeholder kinds 40006 and 40007 from ingest. - Client implementation. ### Related issue The "Deferred actions" section builds on the disconnect contract of #9860 (retry with a freshly signed command) and #9917 (`revoke_through` and "Deny scope"), both on main. ### Testing Documentation only. `git diff --check` passes, every section link in NIP-SL resolves to a heading, the link to "Deferred actions" in NIP-FI resolves, and kinds 30360 and 30361 are unused in `crates/buzz-core/src/kind.rs`. To review: read `docs/nips/NIP-SL.md` top to bottom, then the "Deferred actions" section of `docs/nips/NIP-FI.md`. --------- Signed-off-by: Kalvin Chau <kalvin@block.xyz> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>