Files
22d8e6950b feat(desktop): surface buried agent replies to the viewer in the channel timeline
The channel timeline renders only root-level entries, so agent replies
addressed to a human inside threads are invisible where that human reads
the channel. surfaceReplies projects nested agent replies that p-tag the
VIEWER, collapseSurfacedReplies folds each thread's buried replies into one
representative (the most-recent reply) carrying the group count.

Two constraints keep the projection from flooding the timeline in this
team's threading model, where nearly every message is a nested reply:

- Viewer-only: only replies p-tagging the reader surface, and an
  unresolved viewer fails closed (surfaces nothing) rather than falling
  back to "any human".
- Per-thread collapse: a busy thread contributes one pill, not dozens.

Each collapsed pill is ATTACHED to its thread-root message and renders as
a pill directly below that root (the same visual grammar as the
thread-summary row), driven from the entry side via buildSurfacedByRoot
keyed by the thread root id. The pill lives and dies with its root: a
surfaced thread whose root is not a rendered entry (off-window, or a
broadcast-rooted subthread whose NIP-10 root marker points elsewhere)
contributes no pill rather than a detached orphan.

The pill is self-explanatory: "{author} replied to you" followed by a
single-line snippet of the most-recent reply (surfacedReplyLabel collapses
whitespace and truncates), with a quiet "· N replies" suffix for a thread
with more than one buried reply. Clicking navigates via
goChannel({messageId, threadRootId}) to the most-recent surfaced reply.

De-dupe stays strict body-match so an agent's unrelated earlier root post
cannot suppress a genuinely new nested reply; agent-to-agent replies are
excluded.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-06-24 16:18:35 -04:00
..