feat(messaging-ui): channels — browse, join, leave, create (contract + mock + UI)
Adds a third membership beyond dm/group: a discoverable, joinable room. - contract: Membership += 'channel'; Conversation.topic; ChannelSummary + CreateChannelInput; optional adapter methods browseChannels/createChannel/ joinChannel/leaveChannel (capability-degrading — absent hides the UI) - MockAdapter implements them (seeds a joined public, a joinable public, and a private channel); listConversations now returns only threads I'm in - useChannels hook (browse/create/join/leave + supported flag) - UI: sidebar sections (Channels vs Direct messages), a + that opens a ChannelBrowser (join + create), # / lock glyphs; themeable styles - KernelClientAdapter passes channel membership + topic through - 4 channel tests (mock browse/join/create + render browse→join); 52 total green Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import type {
|
||||
Attachment,
|
||||
ChannelSummary,
|
||||
Conversation,
|
||||
CreateChannelInput,
|
||||
Membership,
|
||||
Message,
|
||||
MessageEvent,
|
||||
@@ -53,4 +55,20 @@ export interface MessagingAdapter {
|
||||
|
||||
/** Absent => treated as always connected (e.g. a pure-REST adapter). */
|
||||
isConnected?(): boolean;
|
||||
|
||||
// ── Channels (optional capability) ──────────────────────────────
|
||||
// A channel is just a third membership beyond dm/group: a discoverable, joinable room.
|
||||
// Implement all four to enable the channels UI; absent => the UI hides channels entirely.
|
||||
|
||||
/** Discoverable channels in the caller's scope, each flagged `joined`. */
|
||||
browseChannels?(): Promise<ChannelSummary[]>;
|
||||
|
||||
/** Create a channel; the creator joins as admin. Returns the new thread id. */
|
||||
createChannel?(input: CreateChannelInput): Promise<{ threadId: string }>;
|
||||
|
||||
/** Join a (public) channel by id. */
|
||||
joinChannel?(threadId: string): Promise<void>;
|
||||
|
||||
/** Leave a channel by id. */
|
||||
leaveChannel?(threadId: string): Promise<void>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user