Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListConversations ¶
func ListConversations(reg ConversationLister) dispatch.Handler
ListConversations returns a dispatch.Handler that answers a list_conversations request with a conversations envelope. The handler reads the registry, projects each row to a protocol.ConversationSummary, sorts by LastUsedAt asc / ID asc (mirroring Registry.Save), and replies via Conn.Reply (which stamps id, ts, and in_reply_to).
func RegisterPushToken ¶
func RegisterPushToken(reg *devices.Registry, registryPath string, logger *slog.Logger) dispatch.Handler
RegisterPushToken returns a dispatch.Handler that processes a register_push_token frame from the phone. reg is the devices registry; registryPath is the canonical on-disk path passed to Save; logger is the daemon's slog logger used for every branch's structured event.
SECURITY:
- The push token (p.Token, dev.PushToken) is opaque infrastructure data (FCM/APNs registration id); not a secret on par with the device auth token. It is logged at INFO when a write happens (as a side-effect of the write event) and never as a field value at any level.
- The Device.Name is logged on every authenticated branch. The unauth branch has no name to log; that is the only path without it.
Concurrency: the handler is stateless beyond the closure capture. reg's mutex serialises UpdatePushRegistration and Save independently; two concurrent calls for the same TokenHash interleave at the mutex boundary with documented last-writer-wins semantics.
func SendMessage ¶
func SendMessage(w TurnWriter, logger *slog.Logger) dispatch.Handler
SendMessage returns a dispatch.Handler that processes a send_message frame from the phone. w is the per-conn write surface (the bootstrap session in production); logger is the daemon's slog logger used for every branch's structured event.
SECURITY:
- payload.Text reaches the supervised claude child's stdin verbatim via TurnWriter. No transformation, no length cap beyond the transport's WS read ceiling (1 MiB; see internal/transport).
- payload.Text is NEVER logged at any level. conversation_id and message_id (phone-supplied opaque ids) are logged on ack and unknown-conversation paths only.
Types ¶
type ConversationLister ¶
type ConversationLister interface {
List(filter ...conversations.ListFilter) []conversations.Conversation
}
ConversationLister is the minimal surface this handler consumes from the conversations registry. *conversations.Registry satisfies it structurally; no adapter required. The variadic shape mirrors conversations.Registry.List exactly so structural matching holds.
type TurnWriter ¶
TurnWriter is the minimal write-surface the send_message handler needs. *sessions.Session satisfies it via a one-line passthrough to Supervisor.WriteUserTurn. The interface lives in this package so handlers/ stays free of internal/sessions and internal/supervisor imports.