Enhanced Chat Stream
POST /api/chat/enhanced/stream
SSE-stream a single chat reply through the M17 dispatcher pipeline.
Routing-shell + per-handler-summary text comes from the Authored Library; the chunk also carries the dispatched handler id, intent id, classifier confidence, and (when available) a HandlerInvocationLog row id so the frontend can render the “via {agent} → {handler}” caption + open the analysis-pane dispatch detail.
Request Body required
Section titled “Request Body required ”M17 chat dispatch request — replaces EnhancedChatRequest.
ChatDispatchRequest is the contract for dispatching a user query through the M17 chat
pipeline: classify the message intent via divinity/intent-classify,
route to the matched DE handler, render the per-handler summary
through the Authored Library, and return a chat-bubble-shaped reply.
Fields:
message: User’s chat message content (required).
project_id: Project context identifier (active project).
thread_id: Existing thread ID to continue a conversation. New
threads are auto-created when this is omitted.
conversation_id: Deprecated alias for thread_id. Frontend
still sends it for back-compat with old persisted threads;
the dispatcher service treats either as authoritative.
agent: Divine agent the user wants to address explicitly
(hawken / lagan / lorekeeper / gamemaster /
worldknowledge / ishvana). Pass-through to the
dispatcher’s selected_agent.
selected_agent: Same field as agent under the M17 name —
both are accepted; selected_agent wins when both set.
selected_handler_id: Pre-supplied DE handler id
(divinity/<name>) that bypasses the intent classifier.
Used by the intent-suggestion chip on the frontend to force
the user’s accepted choice.
confidence_floor: Minimum classifier confidence required to
dispatch the matched handler. Below this floor the
dispatcher emits the no_route_low_confidence reply.
skip_user_persist: Skip persisting the user message before
dispatch. Used by the Writers’ Room fan-out so the user
message isn’t recorded N times (one per agent).
images: Image attachments (preserved for context-aware handlers
that accept image inputs).
context: Ambient user context (active document, browser URL,
etc.) forwarded to handlers that consume it.
writers_room: Render this as a Writers’ Room reply — fan out
to multiple agents in parallel.
requested_at: Timestamp when the request was created.
Used By: - POST /api/chat/enhanced/stream endpoint (single agent dispatch) - POST /api/chat/writers-room/stream endpoint (parallel fan-out) - Intent-suggestion chip accept handler (forced-handler path)
object
User message
Minimum classifier confidence to dispatch a routed handler
Base64-encoded image attached to a chat message.
object
MIME type (image/png, image/jpeg, image/gif, image/webp)
Base64-encoded image data
Ambient author context attached to a freeform agent request.
Skip user message persistence (used by WR to avoid duplicates)
Chat dispatch request timestamp
Responses
Section titled “ Responses ”Successful Response
Validation Error