f0a1552
ZhenYi
feat(chat): add chat module with room management, message handling, and session revocation
f0a1552
// Public API of the shared/ws segment — the app-level realtime WebSocket for
// `GET /ws/v1` (gitdataai/app/im). The connection belongs to the whole
// app rather than to a chat session, which is why it lives in shared instead of
// inside the chat feature.
//
// Typical usage:
// const ws = new ChatWsClient()
// ws.onFrame(frame => { if (frame.type === 'event') ... })
// ws.onIssue(issue => ...) // limits, gaps, revoked access, drift
// ws.onStatus(status => ...) // includes terminal 'auth_required'
// ws.start()
// ws.subscribe(roomId) // answers with a `history` snapshot
// ws.sendTyping(roomId, threadId) // throttled to the server's 3s window
// ws.typingUsers(roomId) // honours the event's ttl_secs
export { ChatWsClient, type ChatWsClientOptions, type WsClientIssue } from './client'
export { TypingRegistry, type WsTypingEvent } from './typing'
export { ChatRealtimeHub, getRealtimeHub, resetRealtimeHub } from './hub'
export {
sendTypingSignal,
useRoomWatch,
useTypingIndicators,
useWsFrames,
useWsIssues,
useWsStatus,
useWsUserEvents,
useWsUserId,
} from './react'
export {
fetchWsJwt,
isWsJwtError,
requestWsJwt,
WsJwtError,
type WsJwt,
type WsJwtFailureKind,
} from './jwt'
export {
asServerFrame,
classifyWsError,
isNotificationUserEvent,
isSubscribeError,
parseServerFrame,
roomEventSeq,
WS_BYE_MESSAGES,
WS_CLIENT_OPS,
WS_ERROR_MESSAGES,
WS_RESYNC_REASONS,
WS_ROOM_EVENT_KINDS,
WS_SERVER_DEFAULTS,
WS_SERVER_FRAME_TYPES,
WS_USER_EVENT_KINDS,
type ClientFrame,
type RoomEvent,
type ServerFrame,
type UserEvent,
type WsByeMessage,
type WsErrorMessage,
type WsMessage,
type WsNotification,
type WsReactionSummary,
type WsResyncReason,
type WsServerErrorKind,
type WsStatus,
type WsSubscribeFrame,
type WsTypingIndicator,
type WsTypingFrame,
type WsUnsubscribeFrame,
type WsResyncFrame,
type WsPingFrame,
} from './protocol'