Skip to content

feat(cli): stream direct messages through buzz listen --dms - #3986

Draft
dspury wants to merge 2 commits into
block:mainfrom
Lunar-Park:pr/cli-listen-dms
Draft

feat(cli): stream direct messages through buzz listen --dms#3986
dspury wants to merge 2 commits into
block:mainfrom
Lunar-Park:pr/cli-listen-dms

Conversation

@dspury

@dspury dspury commented Jul 31, 2026

Copy link
Copy Markdown

Stacked on #3964. The incremental review for this PR is the top commit only: feat(cli): stream direct messages through buzz listen --dms.

Summary

  • add buzz listen --dms so external agents can subscribe to direct-message conversations
  • discover DM channels from relay-emitted DM metadata and subscribe each conversation with normal channel-scoped h filters
  • poll for newly opened DM conversations without restarting the listener
  • document the --dms behavior and lifecycle event emitted when a new DM channel is subscribed

Why

External agent adapters need one long-running listener that can handle both channel mentions and direct-message conversations. DMs already have stable Buzz channel UUIDs, so this keeps the agent-facing contract on the existing channel-scoped event model instead of adding a separate DM stream.

Validation

  • cargo fmt -p buzz-cli --check
  • cargo clippy -p buzz-cli --all-targets -- -D warnings
  • cargo test -p buzz-cli --lib
  • git diff --check origin/pr/cli-external-agent-foundation..HEAD

dspury and others added 2 commits July 31, 2026 12:34
Add the CLI primitives needed for resident external agents to bootstrap and consume Buzz events without being owned or supervised by Desktop.

This includes local identity inspection, scoped realtime listening, local key generation, and safe read-modify-write updates for agent profile records. The changes are harness-neutral and avoid new relay endpoints.

The profile write path now preserves existing and unknown kind:10100 fields instead of publishing partial replacement documents, preventing channel_add_policy updates from clobbering visible agent metadata.

Signed-off-by: dspury <demitriusspury@gmail.com>
RC6 Buzz-side: '--dms' subscribes to every DM conversation this
identity participates in, discovered from the relay-emitted kind:41001
DM-created metadata (the same query buzz dms list uses). DM events
carry their stable conversation UUID in the h tag exactly like channel
traffic, so a resident adapter can map that UUID to a native direct
peer without a second DM session architecture.

New conversations are picked up without a restart: DM discovery events
do not reach live global subscriptions (channel-scoped fan-out), so the
listener re-polls every 30s over the authenticated query bridge — the
desktop's own approach — and adds a channel-scoped subscription per new
conversation, emitting a dm_channel_added lifecycle record under
--envelope v1. '--dms' alone is a complete subscription: an agent with
no DMs yet connects, emits eose immediately, and picks conversations up
as they are opened. DM resolution runs per session so a reconnect keeps
mid-session discoveries.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: dspury <demitriusspury@gmail.com>
(cherry picked from commit c7ba515)
(cherry picked from commit d9114d9)
Signed-off-by: dspury <demitriusspury@gmail.com>
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