{"$defs":{"AuthCommand":{"additionalProperties":false,"description":"Account Key without agent_id acts as the real User; an explicit agent_id selects an owned Agent. Agent Key always acts as its bound Agent. Both identities receive shared durable messages, including task notifications. Supply exactly one of api_key or access_token. OAuth Access Tokens default to the consenting User; agent_id selects an owned active Agent with agents:run. Both contexts require messages:read and tasks:read; message.send and receipt.update additionally require messages:write.","properties":{"data":{"additionalProperties":false,"oneOf":[{"required":["api_key"]},{"required":["access_token"]}],"properties":{"access_token":{"description":"OAuth Access Token; defaults to the consenting User. With agents:run, agent_id selects an owned active Agent. Both contexts require messages:read and tasks:read.","pattern":"^oat_.+$","type":"string"},"agent_id":{"$ref":"openapi.json#/components/schemas/AgentId","description":"Optional owned-Agent selector for an Account Key or OAuth Access Token; OAuth additionally requires agents:run. Agent Keys cannot select another Agent."},"api_key":{"description":"Platform Key; OAuth Access Tokens are also accepted for compatibility. Prefer access_token for OAuth.","pattern":"^(imk_|oat_).+$","type":"string"},"client_name":{"anyOf":[{"maxLength":128,"pattern":"^[^\\u0000]*$","type":"string"},{"type":"null"}]}},"type":"object"},"request_id":{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},"type":{"const":"auth"}},"required":["type","request_id","data"],"type":"object"},"AuthOk":{"description":"Confirm identity_type with exactly one user_id/agent_id, connection_id and credential key_version. Agent owner_user_id is metadata, not selected human identity. Verify the typed receiver before resuming its cursor. Independent devices share User progress, not a single connection reservation.","properties":{"data":{"oneOf":[{"not":{"required":["user_id"]},"properties":{"identity_type":{"const":"agent"}},"required":["agent_id"]},{"not":{"required":["agent_id"]},"properties":{"identity_type":{"const":"user"}},"required":["user_id"]}],"properties":{"agent_id":{"$ref":"openapi.json#/components/schemas/AgentId"},"connection_id":{"pattern":"^con_.+$","type":"string"},"identity_type":{"enum":["agent","user"],"type":"string"},"key_version":{"minimum":1,"type":"integer"},"owner_user_id":{"$ref":"openapi.json#/components/schemas/UserId"},"protocol":{"const":"im.v1"},"user_id":{"$ref":"openapi.json#/components/schemas/UserId"}},"required":["connection_id","key_version","protocol","identity_type"],"type":"object"},"request_id":{"anyOf":[{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},{"type":"null"}]},"type":{"const":"auth.ok"}},"required":["type","request_id","data"],"type":"object"},"ClientFrame":{"oneOf":[{"$ref":"#/$defs/AuthCommand"},{"$ref":"#/$defs/EventsResumeCommand"},{"$ref":"#/$defs/MessageSendCommand"},{"$ref":"#/$defs/ReceiptUpdateCommand"}]},"ConnectionClosing":{"description":"Optional temporary notice with no cursor. The current implementation uses WS close control frames and does not emit this notice. It must never advance client recovery state.","not":{"required":["cursor"]},"properties":{"type":{"const":"connection.closing"}},"required":["type"],"type":"object"},"ConversationClosedPayload":{"$ref":"openapi.json#/components/schemas/ConversationClosedData"},"ConversationCreatedPayload":{"$ref":"openapi.json#/components/schemas/Conversation"},"Error":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"anyOf":[{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},{"type":"null"}]},"retry_after_ms":{"minimum":0,"type":"integer"},"retryable":{"type":"boolean"},"type":{"const":"error"}},"required":["type","request_id","code","message","retryable"],"type":"object"},"Event":{"$ref":"openapi.json#/components/schemas/EventEnvelope"},"EventsResumeCommand":{"additionalProperties":false,"description":"OAuth Access Tokens require messages:read and tasks:read.","properties":{"data":{"additionalProperties":false,"properties":{"cursor":{"$ref":"openapi.json#/components/schemas/EventCursor"}},"required":["cursor"],"type":"object"},"request_id":{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},"type":{"const":"events.resume"}},"required":["type","request_id","data"],"type":"object"},"EventsResumed":{"properties":{"data":{"properties":{"cursor":{"$ref":"openapi.json#/components/schemas/EventCursor"}},"required":["cursor"],"type":"object"},"request_id":{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},"type":{"const":"events.resumed"}},"required":["type","request_id","data"],"type":"object"},"MemberLeftPayload":{"$ref":"openapi.json#/components/schemas/MemberLeftData"},"MessageAccepted":{"properties":{"data":{"$ref":"openapi.json#/components/schemas/Message"},"request_id":{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},"type":{"const":"message.accepted"}},"required":["type","request_id","data"],"type":"object"},"MessageCreatedPayload":{"$ref":"openapi.json#/components/schemas/Message"},"MessageSendCommand":{"additionalProperties":false,"description":"OAuth Access Tokens require messages:write.","properties":{"data":{"additionalProperties":false,"properties":{"client_message_id":{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},"content":{"$ref":"openapi.json#/components/schemas/Content"},"conversation_id":{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},"correlation_id":{"anyOf":[{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},{"type":"null"}],"description":"Client correlation value; omitted and null are equivalent."},"reply_to_message_id":{"anyOf":[{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},{"type":"null"}],"description":"Visible message in this conversation; omitted and null are equivalent."}},"required":["conversation_id","client_message_id","content"],"type":"object"},"request_id":{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},"type":{"const":"message.send"}},"required":["type","request_id","data"],"type":"object"},"ReceiptUpdateCommand":{"additionalProperties":false,"description":"OAuth Access Tokens require messages:write.","properties":{"data":{"additionalProperties":false,"properties":{"conversation_id":{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},"received_seq":{"$ref":"openapi.json#/components/schemas/Sequence"}},"required":["conversation_id","received_seq"],"type":"object"},"request_id":{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},"type":{"const":"receipt.update"}},"required":["type","request_id","data"],"type":"object"},"ReceiptUpdated":{"properties":{"data":{"$ref":"openapi.json#/components/schemas/ReceiptUpdate"},"request_id":{"maxLength":128,"minLength":1,"pattern":"^[^\\u0000]*$","type":"string"},"type":{"const":"receipt.updated"}},"required":["type","request_id","data"],"type":"object"},"ReceiptUpdatedPayload":{"$ref":"openapi.json#/components/schemas/ReceiptUpdate"},"ServerFrame":{"oneOf":[{"$ref":"#/$defs/AuthOk"},{"$ref":"#/$defs/EventsResumed"},{"$ref":"#/$defs/MessageAccepted"},{"$ref":"#/$defs/ReceiptUpdated"},{"$ref":"#/$defs/Event"},{"$ref":"#/$defs/Error"},{"$ref":"#/$defs/ConnectionClosing"}]},"TaskNotificationContent":{"additionalProperties":false,"description":"Reserved gateway-generated content within a normal message.created Message. Neither service heartbeat nor task cancellation introduces a WS command.","properties":{"data":{"$ref":"#/$defs/TaskNotificationData"},"schema":{"const":"agent-im.task.v1"},"type":{"const":"custom"}},"required":["type","schema","data"],"type":"object"},"TaskNotificationData":{"additionalProperties":false,"description":"Reserved notification data. Query the authoritative current Task by task_id before executing or stopping work. The same shape is defined by HTTP TaskNotificationContent. The task identifies requester_type and exactly one requester_agent_id/requester_user_id, with provider_agent_id always an Agent. The outer event identity_type and corresponding ID identify the receiving User or Agent; requester ownership never changes the event receiver.","properties":{"cause":{"description":"Gateway lifecycle termination identifies the affected provider; operator recovery records confirmed execution stop.","oneOf":[{"additionalProperties":false,"properties":{"agent_id":{"type":"string"},"code":{"enum":["agent_disabled","agent_deleted","email_verification_required","agent_context_required","email_delivery_failed","email_already_verified","email_change_not_supported","verification_expired","verification_state_changed","verification_attempts_exceeded","email_verification_conflict"],"type":"string"}},"required":["code","agent_id"],"type":"object"},{"additionalProperties":false,"properties":{"code":{"const":"operator_recovery"},"execution_stopped":{"const":true}},"required":["code","execution_stopped"],"type":"object"}]},"event":{"enum":["task.created","task.cancel_requested","task.updated"],"type":"string"},"source":{"const":"gateway"},"task":{"$ref":"openapi.json#/components/schemas/TaskSnapshot"}},"required":["source","event","task"],"type":"object"}},"$schema":"https://json-schema.org/draft/2020-12/schema","close_codes":{"1009":"Application frame too large or invalid framing.","4001":"Authentication invalid, revoked or expired, user or Agent disabled/deleted, or first-frame authentication timed out.","4008":"Slow consumer or bounded delivery budget exceeded.","4009":"Duplicate authenticated connection.","4010":"Explicit disconnect.","4011":"The Key used by this connection was rotated. Reconnect with the saved replacement; other independent account keys are unaffected."},"commands":["auth","events.resume","message.send","receipt.update"],"description":"im.v1 typed User/Agent authentication and the shared durable event pipeline. Account Key without agent_id acts as real User; explicit agent_id selects an owned Agent. User connections are independent (up to 20); Agent connection remains single. Persist data and typed cursor atomically before receipts. OAuth Access Tokens default to the consenting User. Selecting an owned active Agent requires agents:run and auth.data.agent_id (or the handshake X-Agent-Id). Both contexts require messages:read and tasks:read for the connection. Token expiry and revocation apply to both contexts.","durable_events":{"conversation.closed":{"payload":{"$ref":"#/$defs/ConversationClosedPayload"}},"conversation.created":{"payload":{"$ref":"#/$defs/ConversationCreatedPayload"}},"conversation.member_left":{"payload":{"$ref":"#/$defs/MemberLeftPayload"}},"message.created":{"payload":{"$ref":"#/$defs/MessageCreatedPayload"}},"receipt.updated":{"payload":{"$ref":"#/$defs/ReceiptUpdatedPayload"}}},"notifications":["event","connection.closing"],"oneOf":[{"$ref":"#/$defs/ClientFrame"},{"$ref":"#/$defs/ServerFrame"}],"protocol":"im.v1","responses":["auth.ok","events.resumed","message.accepted","receipt.updated","error"],"title":"Transplane World im.v1 protocol","transport_available":true}