feat: Channel management, messaging, threads, DMs, reactions, and NIP-29 support#16
Merged
tlongwell-block merged 1 commit intomainfrom Mar 10, 2026
Merged
Conversation
…-29 support Add comprehensive channel features implementing the REST + NIP-29 dual API architecture. Both paths converge on shared DB functions as the single source of truth. New capabilities: - Channel metadata (topic, purpose, archive/unarchive) - Membership management (add, remove, join, leave) with role-based auth - Threaded messaging with materialized reply/descendant counts - Direct messages with immutable participant sets (SHA-256 hash) - Emoji reactions with atomic upsert - NIP-29 relay protocol (kinds 9000-9022) with pre-storage validation - 19 new MCP tools for agent interaction - Relay keypair infrastructure for system messages (kind 40099) 6 migrations, 16 new files, 12 modified files (~1,420 insertions).
tlongwell-block
added a commit
that referenced
this pull request
Mar 11, 2026
* origin/main: feat: soft-delete for events/channels, enriched API responses, NIP-29 group management (#17) feat: Channel management, messaging, threads, DMs, reactions, and NIP-29 support (#16) Improve chat scrolling and multiline composer (#14) chore: remove redundant inline comments across all crates (#13) Initial backend revisions, workflow expansion (#5) Add desktop Home feed (#12) Add desktop Playwright e2e harness (#11) Update desktop icon and persist window state (#9) feat: add channel creation flow (#8)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive channel features implementing the REST + NIP-29 dual API architecture. Both paths converge on shared DB functions as the single source of truth.
What's New
REST API (20 endpoints)
NIP-29 Relay Protocol (9 event handlers)
MCP Tools (19 new + 2 updated)
Full agent interface for all channel features — send messages, manage members, set topics, add reactions, open DMs, etc.
Infrastructure
SPROUT_RELAY_PRIVATE_KEYenv var or auto-generated on first runArchitecture
handle_event()(would reject relay-signed events)channel= Sprout UUID,h= NIP-29 group ID,e= event references onlyKey Design Decisions
thread_metadatatable withreply_count(direct) anddescendant_count(all). Partition-pruned joins via storedparent/root_event_created_at.participant_hash(SHA-256 of sorted concatenated pubkeys). Adding a member creates a new DM.open_dmis idempotent. Max 9 participants.INSERT ... ON DUPLICATE KEY UPDATE— no TOCTOU race.GROUP_CONCAT(HEX(pubkey))avoids binary corruption. Sessiongroup_concat_max_lenraised to 1MB.archived_at. Pre-storage rejection for kind 7 reactions.Quality
7 rounds of crossfire review (Claude Opus + OpenAI Codex + Gemini Pro):
32 issues found and fixed across all rounds. All CI checks pass (clippy -D warnings, fmt, unit tests, cargo-deny).
Files Changed
16 new files:
thread.rs,dm.rs,reaction.rschannels_metadata.rs,members.rs,messages.rs,dms.rs,reactions.rs,users.rsside_effects.rs12 modified files:
kind.rs(+KIND_SYSTEM_MESSAGE),channel.rs(+231 lines),lib.rs(+202 lines),user.rs(+75 lines)server.rs(+754 lines — 19 MCP tools),router.rs(+66 lines — 16 routes)event.rs(extract_channel_id fix, admin pre-validation, reaction archive check)config.rs,state.rs,main.rs(relay keypair wiring)Known Gaps (follow-up PRs)
soft_delete_event/soft_delete_channelDB methods (kind 9005/9008 handlers emit system messages but don't delete yet)next_cursor: null)