Commands

How clients change a conversation: command identity, the payload digest, receipts and dispositions, the command catalog and the error codes.

Command envelope

{
  "command_id": "cmd_01",
  "type": "robotelos.submit_message",
  "conversation_id": "conv_…",
  "target": {},
  "content": {"parts": [{"text": "hello"}]}
}
FieldRequiredRule
command_idyesUnique for the sender and conversation. Generated by the client.
typeyesOne of the types in the catalog
conversation_idper typeOmitted for robotelos.create_conversation
targetper typeWho or what the command is about
contentper typeThe payload. Limits apply (Base protocol).

Identity and digest

The server stores each accepted command with a digest: a SHA-256 of a canonical JSON encoding of target and content. The canonical encoding sorts object keys, so the same content always gives the same digest.

A command with the same command_id, sender and conversation is processed by comparing digests:

  • Same digest: the command is a retry. The server returns the original receipt and applies nothing.
  • Different digest: the server returns CONFLICT. Nothing changes.

A server MUST NOT apply a command twice. A server MUST return the same receipt for a retry.

Receipts

Every command gets exactly one receipt:

{
  "receipt_id": "rcp_…",
  "command_id": "cmd_01",
  "conversation_id": "conv_…",
  "disposition": "ACCEPTED",
  "events": ["evt_…"],
  "frames": [{"projection_id": "view_conv_…", "sequence": 12}]
}
DispositionMeaningEvents
ACCEPTEDAppliedRecorded; events and frames name them
REJECTEDRefused; the error says whyNone
CONFLICTThe same command_id was used with a different payloadNone
STALEThe command names a version that is no longer currentNone

A receipt is stored with the events, so get_receipt returns it even after a lost response.

Command catalog

robotelos.create_conversation

FieldWhereMeaning
kindcontentdirect or group
titlecontentOptional
participantscontentAgents to start with: [{"agent_id": "mock"}]. A group may start with none.

The creator is the owner.

robotelos.submit_message

FieldWhereMeaning
partscontentAt least one part; each part has exactly one of text, data, url or raw
mentionscontentParticipant IDs the message addresses. In a group, only mentioned agents answer.
relationscontentOptional, up to max_relations

The message is accepted if the sender may speak in the conversation. Observers are refused with not_authorized.

robotelos.update_participant

FieldWhereMeaning
participant_idtargetThe participant to act on. Omitted means the sender.
membershipcontentinvite, join or leave
rolecontentowner, member, guest or observer
displaycontentA label for an invitee until it joins
agent_idcontentAn agent for an owner to add with join

Who may send which membership is in Groups and participants. The last owner cannot leave or be demoted.

robotelos.answer_obligation

FieldWhereMeaning
obligation_idtargetThe obligation answered
expected_versiontargetThe obligation version the answer is based on
answer.kindcontentapprove
request_digestcontentThe digest of the operation shown to the responder

The checks and outcomes are in Approvals.

Error codes

Every error has one of these codes. The table names the meaning and whether a retry can succeed.

CodeMeaningRetry
not_authenticatedMissing or unknown tokenAfter fixing the token
not_authorizedThe principal may not do this, such as an observer speakingNo
not_participantThe sender is not in the conversationNo
invalid_commandMalformed request or commandNo
payload_too_largeA limit was exceededNo
limit_exceededThe principal holds as many connections, or the connection follows as many conversations, as the server allowsNo
rate_limitedThe principal sends commands faster than the server allows; retry_after_ms is the waitYes
unsupported_versionNo common protocol versionNo
command_conflictThe command_id was used with another payloadNo
unknown_conversationNo such conversation, or the sender is no longer in itNo
unknown_targetThe target (for example an obligation) does not existNo
cursor_expiredThe cursor is older than the server keepsSubscribe again
epoch_changedThe journal was rebuilt; the cursor is invalidSubscribe again
expiredAn answer came after the obligation’s expiryNo
internalThe server failedYes, with the same command_id

Next steps