feat(cli): stream direct messages through buzz listen --dms - #3986
Draft
dspury wants to merge 2 commits into
Draft
feat(cli): stream direct messages through buzz listen --dms#3986dspury wants to merge 2 commits into
dspury wants to merge 2 commits into
Conversation
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>
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.
Stacked on #3964. The incremental review for this PR is the top commit only:
feat(cli): stream direct messages through buzz listen --dms.Summary
buzz listen --dmsso external agents can subscribe to direct-message conversationshfilters--dmsbehavior and lifecycle event emitted when a new DM channel is subscribedWhy
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 --checkcargo clippy -p buzz-cli --all-targets -- -D warningscargo test -p buzz-cli --libgit diff --check origin/pr/cli-external-agent-foundation..HEAD