5.6.2.2 Conversations
The Conversations domain of moochat. Threads between a user and an agent: conversations, their messages and the tool calls of each turn. A message is authorized as its own sender; a tool that writes waits for the user's confirmation. Answers stream over the WebSocket /conversations/v1/live; this API loads the state and sends messages. It is one API, with its own contract and its own version.
5.6.2.2.1 Versions¶
| Version | Status | Prod URL | Contract |
|---|---|---|---|
v1 |
Proposed | https://moochat.moonitoring.com/conversations/v1 |
conversations/v1/openapi.yaml |
The resources follow the data model. Sending a message answers 202 with the turn id: the assistant's message arrives through the live socket and is then readable here. Every operation needs moochat.moochat.access and the entitlement feature named by the agent, moochat.chat for MooChat (D6).
5.6.2.2.2 Operations¶
Every operation names who calls it and the capability it checks (x-moonitoring-audience, x-moonitoring-capability in the contract); every capability is in the catalog of the data model (req 1002, 1006). Lists are paged by cursor, writes that create something carry an Idempotency-Key, errors are Problem Details.
| Operation | Request | Who | Capability |
|---|---|---|---|
| List my conversations | GET /conversations |
Organization users, staff or clients | moochat.moochat.access, entitlement moochat.chat |
| Open a conversation | POST /conversations |
Organization users, staff or clients | moochat.moochat.access, entitlement moochat.chat |
| Read a conversation | GET /conversations/{conversation_id} |
Organization users, staff or clients | moochat.moochat.access, entitlement moochat.chat |
| Rename a conversation | PATCH /conversations/{conversation_id} |
Organization users, staff or clients | moochat.moochat.access, entitlement moochat.chat |
| Archive a conversation | POST /conversations/{conversation_id}/archive |
Organization users, staff or clients | moochat.moochat.access, entitlement moochat.chat |
| List messages | GET /conversations/{conversation_id}/messages |
Organization users, staff or clients | moochat.moochat.access, entitlement moochat.chat |
| Send a message | POST /conversations/{conversation_id}/messages |
Organization users, staff or clients | moochat.moochat.access, entitlement moochat.chat |
| List a message's tool calls | GET /messages/{message_id}/tool-calls |
Organization users, staff or clients | moochat.moochat.access, entitlement moochat.chat |
| Confirm a write tool | POST /tool-calls/{call_id}/confirm |
Organization users, staff or clients | moochat.moochat.access, entitlement moochat.chat |
| Refuse a write tool | POST /tool-calls/{call_id}/refuse |
Organization users, staff or clients | moochat.moochat.access, entitlement moochat.chat |
5.6.2.2.3 Live Updates¶
A WebSocket at /conversations/v1/live follows the rules for live updates. An answer is produced token by token and may stop to ask the user to confirm a write tool. The socket streams text_delta, tool_call, pending_confirmation and turn_completed frames for the conversations the user has open; sendMessage returns at once with the turn id, and the stored messages are read through listMessages. Every moochat instance receives conversation.turn.completed.v1 through Pub/Sub and forwards it to its own connections. The connection is authenticated with the same token as REST, closed when the screen is not visible, and reconnects with growing delays.
5.6.2.2.4 Contract v1¶
Proposed version
v1 is a proposal for review: its endpoints, errors and capabilities were designed from the requirements and the flows and are not confirmed. It leaves proposal with its first release; from then on it changes only as described in Every API Is Versioned.