asyncapi: 3.1.0 info: title: OpenBot live channels version: 0.1.0 license: name: MIT url: https://opensource.org/license/mit description: >- Everything live in OpenBot runs on WebSockets, and this file describes every one of them: a Bot's run as it streams into a conversation, what changed in a person's conversations, a Bot's screen, its terminal, a voice call, and what the Recorder captures. It is the companion of api/openapi.yaml, which describes the REST API, and the two are one API: the REST operations hand out what a socket needs, and the sockets carry what changes afterwards. A run streams through CopilotKit Intelligence's realtime gateway, which OpenBot uses as it ships, and so does what the Recorder captures. A voice call's socket is the voice service's own. The other sockets are served by OpenBot itself, under the organization's address like every REST resource (/api/v2/organizations/{organizationId}/...), and are signed in to the same three ways: the web app's session, an API key, or an app's access token. A browser cannot set a header on a WebSocket, so the web app uses its session; everything else sends Authorization: Bearer on the request that opens the socket. A voice call that the server sets up over WebRTC has no socket to describe: its audio and its events travel on a peer connection, which is outside what AsyncAPI describes. The REST operation that starts a call says which of the two a deployment uses. Every operation is written from the server's side, as AsyncAPI has it: `send` is a message the server sends and a client receives, `receive` is a message a client sends. This file is the single source of truth for the sockets. A change that breaks an existing client fails the pull request, and the frames a real server sends are checked against it. defaultContentType: application/json servers: openbot: host: 127.0.0.1:3001 protocol: ws description: >- An OpenBot server on this machine (the default local port). The sockets are on the same address as the REST API, over wss wherever the API is served over https. security: - $ref: "#/components/securitySchemes/webSession" intelligenceGateway: host: 127.0.0.1:4401 pathname: /client protocol: ws description: >- CopilotKit Intelligence's realtime gateway, where runs stream. Its address is never configured in a client: the REST answer that carries a join token carries the address to dial with it (realtime.clientUrl). Where Intelligence runs beside an OpenBot, that address is OpenBot's own, so a client dials one host: either /api/intelligence/client, which OpenBot relays, or /client, which the deployment's edge sends straight to the gateway. OpenBot also relays it at an address that names the organization, /api/v2/organizations/{organizationId}/realtime, which the channels that start with "organization" describe. The relayed address also asks who is connecting, with the same credential that made the join token: the web app's session, an app's access token (conversations:read) or an API key, the last two as Authorization: Bearer on the request that opens the socket, or a key in an x-api-key header. So a script that holds only an API key mints a join token with it and opens the socket with it. A credential that is not valid is answered 401 before the socket opens. A join token the gateway refuses, because it was used already or has expired, closes the relayed socket with code 1008 and the reason "This join token has been used or has expired. Ask for a new one."; 1011 means the gateway could not be reached at all. security: - $ref: "#/components/securitySchemes/joinToken" voiceService: host: api.x.ai pathname: /v1/realtime protocol: wss description: >- The voice service's realtime socket, for a deployment whose calls run on Grok Voice. It is not OpenBot's: a client dials it directly, with the address and the one-call secret the REST operation that starts a call answers, and OpenBot carries none of the audio. security: - $ref: "#/components/securitySchemes/voiceClientSecret" channels: conversationEvents: address: /api/v2/organizations/{organizationId}/conversation-events title: Conversation events description: >- What changed in the signed-in person's conversations, as it happens: a new message, a Bot starting or finishing work, a rename, a pin, a removal. And, on a socket opened with the capability data-changed, what else changed that the person sees, as a hint to read it again (dataChanged): their approvals, what needs them, the Bots, a Bot's Activity, the routines, a Bot's computer, the artifacts shared with them, the components, what a Bot holds, how Bots reach them, and their memory. One socket per signed-in person and tab. The server only ever sends; anything a client sends is ignored. Nothing is replayed: on opening the socket, and again on a resync message, a client reads its conversations afresh over REST, and whatever else it shows. servers: - $ref: "#/servers/openbot" parameters: organizationId: $ref: "#/components/parameters/organizationId" bindings: ws: method: GET query: type: object properties: capabilities: type: string maxLength: 1024 description: >- Which newer messages the app understands, as the OpenBot-Capabilities header lists them on a request: lowercase tokens separated by spaces. A browser can't set a header on a WebSocket, so it is sent here. Optional: a socket opened without it is sent what every release reads. The tokens this socket reads: conversation-work-turn, a conversation's work can name the person's own turn (ConversationWork); data-changed, the socket is sent dataChanged; and artifact-activity, the socket is sent artifactActivity. bindingVersion: 0.1.0 messages: conversationActivity: $ref: "#/components/messages/ConversationActivity" conversationResync: $ref: "#/components/messages/ConversationResync" dataChanged: $ref: "#/components/messages/DataChanged" artifactActivity: $ref: "#/components/messages/ArtifactActivity" artifactEvents: address: /api/v2/organizations/{organizationId}/artifacts/{artifactId}/events title: Artifact events description: >- What changed about one artifact while somebody has it open: who may see it changed, it was renamed, or the viewer's own access ended. Opened by every open viewer of an artifact, on the app's address or on the artifacts address (the host of the artifact's link). Signed in the way the viewer is: the web app's session on either address, the cookie an invitation's code set on the artifacts address, or nothing at all for an artifact anyone with the link can view. On the app's address it also takes an app's access token or an API key, as Authorization: Bearer (or a key in an x-api-key header) on the request that opens the socket, as OpenBot Desktop's window sends its token. The credential opens what it opens on the artifact's REST operations, with the same scope (artifacts:read) in the same organization. A credential that is not good here, because it belongs to another organization, lacks the scope, or has run out, opens what nothing at all opens. A viewer who can't view the artifact is refused before the socket opens, as one that does not exist (404). When the viewer's access ends (the artifact was unshared with them, taken off public, deleted, or an admin turned public links or outside invitations off), the server sends artifactAccessEnded and closes the socket with code 4403. The server only ever sends; anything a client sends is ignored. Nothing is replayed: on opening the socket a client reads the artifact afresh over REST. servers: - $ref: "#/servers/openbot" parameters: organizationId: $ref: "#/components/parameters/organizationId" artifactId: $ref: "#/components/parameters/artifactId" bindings: ws: method: GET bindingVersion: 0.1.0 messages: artifactAccessChanged: $ref: "#/components/messages/ArtifactAccessChanged" artifactAccessEnded: $ref: "#/components/messages/ArtifactAccessEnded" botScreen: address: /api/v2/organizations/{organizationId}/computers/{botId}/screen title: A Bot's screen description: >- The screen of a Bot's computer, live, and the person's mouse and keyboard going back to it. Frames are whole pictures, so a viewer shows the newest and needs nothing before it. Input is taken only while the person has control of the computer. One viewer at a time per person and Bot: a newer one replaces the older, which is told so. An app whose access token may watch a Bot's computer and not use it (computers:read without computers:write) is sent the screen, and its input is answered with an input error and goes no further. servers: - $ref: "#/servers/openbot" parameters: organizationId: $ref: "#/components/parameters/organizationId" botId: $ref: "#/components/parameters/botId" bindings: ws: method: GET bindingVersion: 0.1.0 messages: screenHello: $ref: "#/components/messages/ScreenHello" screenFrame: $ref: "#/components/messages/ScreenFrame" screenError: $ref: "#/components/messages/ScreenError" screenInputError: $ref: "#/components/messages/ScreenInputError" screenFrameReceived: $ref: "#/components/messages/ScreenFrameReceived" screenViewSize: $ref: "#/components/messages/ScreenViewSize" screenMouse: $ref: "#/components/messages/ScreenMouse" screenWheel: $ref: "#/components/messages/ScreenWheel" screenKey: $ref: "#/components/messages/ScreenKey" screenText: $ref: "#/components/messages/ScreenText" windowsComputerScreen: address: /api/v2/organizations/{organizationId}/windows-computer/screen title: A Windows computer's screen description: >- Experimental. The screen of the caller's Windows computer, live: the whole screen, not masked, so whatever is open on it is shown, other programs and notifications included. Frames are whole pictures, so a viewer shows the newest and needs nothing before it. The person's mouse and keyboard go back to it only while they hold control, which they take and hand back with the Windows computer operations in the REST API; while the Bot holds it, input is answered with an input error and goes no further. Positions are in the screen's own pixels, the frame's width and height. Only the person the Windows computer is set up for may watch it. One viewer at a time: a newer one replaces the older, which is told so. An app whose access token may watch and not use computers (computers:read without computers:write) is sent the screen, and its input is answered with an input error. servers: - $ref: "#/servers/openbot" parameters: organizationId: $ref: "#/components/parameters/organizationId" bindings: ws: method: GET bindingVersion: 0.1.0 messages: screenHello: $ref: "#/components/messages/ScreenHello" screenFrame: $ref: "#/components/messages/ScreenFrame" screenError: $ref: "#/components/messages/ScreenError" screenInputError: $ref: "#/components/messages/ScreenInputError" screenFrameReceived: $ref: "#/components/messages/ScreenFrameReceived" screenMouse: $ref: "#/components/messages/ScreenMouse" screenWheel: $ref: "#/components/messages/ScreenWheel" screenKey: $ref: "#/components/messages/ScreenKey" screenText: $ref: "#/components/messages/ScreenText" windowsComputerLink: address: /api/v2/organizations/{organizationId}/windows-computer/link title: A Windows computer's link to OpenBot description: >- Experimental. The one connection a Windows computer keeps open to OpenBot, opened BY the Windows computer, so OpenBot never reaches into its network: OpenBot's program on it dials out with the credential it got for an enrollment code (exchangeWindowsComputerEnrollmentCode), and dials again whenever the link drops. organizationId is `default` or the computer's own organization. Everything OpenBot asks of the computer travels on it: OpenBot sends a request, the computer answers it by its id; OpenBot opens a stream (the live screen), and both sides send on it until either closes it. A newer link from the same computer replaces the older, which is told so and closed. A link from a disconnected computer is refused before it opens. servers: - $ref: "#/servers/openbot" parameters: organizationId: $ref: "#/components/parameters/organizationId" bindings: ws: method: GET bindingVersion: 0.1.0 messages: linkHello: $ref: "#/components/messages/LinkHello" linkRequest: $ref: "#/components/messages/LinkRequest" linkResponse: $ref: "#/components/messages/LinkResponse" linkOpen: $ref: "#/components/messages/LinkOpen" linkData: $ref: "#/components/messages/LinkData" linkClose: $ref: "#/components/messages/LinkClose" linkBye: $ref: "#/components/messages/LinkBye" linkPing: $ref: "#/components/messages/LinkPing" linkPong: $ref: "#/components/messages/LinkPong" botTerminal: address: /api/v2/organizations/{organizationId}/computers/{botId}/terminal title: A Bot's terminal description: >- The terminal on a Bot's computer. The terminal's own bytes arrive as binary frames; everything else is a JSON text frame. A snapshot message means "clear, and draw what follows", and ready means the viewer is live. Typing is taken only while the person has control of the computer. An app whose access token may watch a Bot's computer and not use it is sent the terminal, and its typing and resizing are answered with an error and go no further. servers: - $ref: "#/servers/openbot" parameters: organizationId: $ref: "#/components/parameters/organizationId" botId: $ref: "#/components/parameters/botId" bindings: ws: method: GET bindingVersion: 0.1.0 messages: terminalOutput: $ref: "#/components/messages/TerminalOutput" terminalSnapshot: $ref: "#/components/messages/TerminalSnapshot" terminalReady: $ref: "#/components/messages/TerminalReady" terminalError: $ref: "#/components/messages/TerminalError" terminalInput: $ref: "#/components/messages/TerminalInput" terminalResize: $ref: "#/components/messages/TerminalResize" terminalAck: $ref: "#/components/messages/TerminalAck" threadStream: address: /websocket title: A conversation's runs description: >- A Bot's runs in one conversation thread, as AG-UI events, on the gateway's socket for clients. The socket speaks the Phoenix Channels protocol, version 2: every frame is a JSON array of five items, [join reference, reference, topic, event, payload]. The topic is the one the REST answer gave as realtime.topic, and a join token opens exactly one thread. The topic names the thread as the gateway knows it, which in an organization other than default is not the threadId a client has, so a client uses the topic as given and never makes one from threadId. A client joins the topic, and the gateway answers with connected, then replays what the thread already holds as ag_ui_event messages, then says replay_complete, and from there on sends events as they happen. A run in progress is replayed from its start, so a reload, or a second tab or device of the same person, shows the whole of it. Every event carries an id (metadata.cpki_event_id): a client that reconnects sends the last one it saw and is sent only what came after, and it drops any id it has already drawn. servers: - $ref: "#/servers/intelligenceGateway" bindings: ws: method: GET query: type: object required: - join_token - vsn properties: join_token: type: string description: >- The join token from the REST answer. It works once and for about half a minute, so every connection, and every reconnection, starts with a new one. vsn: type: string const: 2.0.0 description: The Phoenix Channels protocol version. bindingVersion: 0.1.0 messages: threadJoin: $ref: "#/components/messages/ThreadJoin" threadReply: $ref: "#/components/messages/ThreadReply" threadHeartbeat: $ref: "#/components/messages/ThreadHeartbeat" threadConnected: $ref: "#/components/messages/ThreadConnected" threadAgUiEvent: $ref: "#/components/messages/ThreadAgUiEvent" threadReplayComplete: $ref: "#/components/messages/ThreadReplayComplete" threadStreamIdle: $ref: "#/components/messages/ThreadStreamIdle" threadReplayFailed: $ref: "#/components/messages/ThreadReplayFailed" threadExpired: $ref: "#/components/messages/ThreadExpired" threadStopRun: $ref: "#/components/messages/ThreadStopRun" threadLeave: $ref: "#/components/messages/ThreadLeave" threadClose: $ref: "#/components/messages/ThreadClose" threadError: $ref: "#/components/messages/ThreadError" trajectoryCapture: address: /websocket title: What the Recorder captures description: >- The Recorder sending what a person does in their browser, as they record it, on the gateway's socket for clients: the same socket and frames as a conversation's runs, on the topic trajectory:{trajectoryId}. The Recorder asks OpenBot for a pass first, which carries a join token for one trajectory and the address to dial, and asks again for every connection. It joins the topic, then sends its events in batches, each answered by a reply; a batch with no reply is sent again, and the gateway drops what it already holds by each event's sequence number. servers: - $ref: "#/servers/intelligenceGateway" bindings: ws: method: GET query: type: object required: - join_token - vsn properties: join_token: type: string description: The join token from the Recorder's pass. It works once. vsn: type: string const: 2.0.0 description: The Phoenix Channels protocol version. bindingVersion: 0.1.0 messages: trajectoryJoin: $ref: "#/components/messages/TrajectoryJoin" trajectoryEvents: $ref: "#/components/messages/TrajectoryEvents" trajectoryReply: $ref: "#/components/messages/TrajectoryReply" organizationThreadStream: address: /api/v2/organizations/{organizationId}/realtime/websocket title: A conversation's runs, at the organization's address description: >- The gateway's socket for clients, relayed by OpenBot at an address that names the organization, like every other address under /api/v2. It carries exactly what a conversation's runs carry on the gateway's own address: the same Phoenix Channels frames, topics, join tokens and replay. A REST answer whose realtime.clientUrl is /api/v2/organizations/{organizationId}/realtime on this server is dialled here, with /websocket added as on the gateway. It is opened as the relayed address is, by the web app's session, an app's access token (conversations:read) or an API key, and the caller must be a member of the organization the address names. One they are not in is refused before the socket opens, as one that does not exist. The organization's gateway is the one the socket reaches. servers: - $ref: "#/servers/openbot" parameters: organizationId: $ref: "#/components/parameters/organizationId" bindings: ws: method: GET query: type: object required: - join_token - vsn properties: join_token: type: string description: >- The join token from the REST answer. It works once and for about half a minute, so every connection, and every reconnection, starts with a new one. vsn: type: string const: 2.0.0 description: The Phoenix Channels protocol version. bindingVersion: 0.1.0 messages: threadJoin: $ref: "#/components/messages/ThreadJoin" threadReply: $ref: "#/components/messages/ThreadReply" threadHeartbeat: $ref: "#/components/messages/ThreadHeartbeat" threadConnected: $ref: "#/components/messages/ThreadConnected" threadAgUiEvent: $ref: "#/components/messages/ThreadAgUiEvent" threadReplayComplete: $ref: "#/components/messages/ThreadReplayComplete" threadStreamIdle: $ref: "#/components/messages/ThreadStreamIdle" threadReplayFailed: $ref: "#/components/messages/ThreadReplayFailed" threadExpired: $ref: "#/components/messages/ThreadExpired" threadStopRun: $ref: "#/components/messages/ThreadStopRun" threadLeave: $ref: "#/components/messages/ThreadLeave" threadClose: $ref: "#/components/messages/ThreadClose" threadError: $ref: "#/components/messages/ThreadError" organizationTrajectoryCapture: address: /api/v2/organizations/{organizationId}/realtime/websocket title: What the Recorder captures, at the organization's address description: >- The same socket as a conversation's runs at the organization's address, on the topic trajectory:{trajectoryId}: what the Recorder captures, exactly as it travels on the gateway's own address. The Recorder dials it when its pass's realtime.clientUrl names this address. servers: - $ref: "#/servers/openbot" parameters: organizationId: $ref: "#/components/parameters/organizationId" bindings: ws: method: GET query: type: object required: - join_token - vsn properties: join_token: type: string description: The join token from the Recorder's pass. It works once. vsn: type: string const: 2.0.0 description: The Phoenix Channels protocol version. bindingVersion: 0.1.0 messages: trajectoryJoin: $ref: "#/components/messages/TrajectoryJoin" trajectoryEvents: $ref: "#/components/messages/TrajectoryEvents" trajectoryReply: $ref: "#/components/messages/TrajectoryReply" voiceCall: address: / title: A voice call description: >- A call with a Bot on the voice service's realtime socket: the person's audio in, the Bot's audio and its words out, as JSON events. Every event has a type, and the events are the voice service's own, described in its documentation (https://docs.x.ai/docs/guides/voice). A client sends session.update first, with the session the REST answer carried, then input_audio_buffer.append with the person's audio as base64 PCM at 24 kHz, input_audio_buffer.clear when muted, and conversation.item.truncate when the person talks over the Bot. It receives, among others, session.updated, response.created, input_audio_buffer.speech_started, response.output_audio.delta with the Bot's audio, and response.output_audio_transcript.delta and .done with its words. servers: - $ref: "#/servers/voiceService" bindings: ws: method: GET query: type: object required: - model properties: model: type: string description: The voice model, as the REST answer's address names it. bindingVersion: 0.1.0 messages: voiceClientEvent: $ref: "#/components/messages/VoiceClientEvent" voiceServiceEvent: $ref: "#/components/messages/VoiceServiceEvent" operations: sendConversationEvents: action: send title: Tell a person what changed in their conversations summary: A conversation the person is in changed, or everything may have. security: - $ref: "#/components/securitySchemes/webSession" - $ref: "#/components/securitySchemes/apiKey" - $ref: "#/components/securitySchemes/conversationsRead" channel: $ref: "#/channels/conversationEvents" messages: - $ref: "#/channels/conversationEvents/messages/conversationActivity" - $ref: "#/channels/conversationEvents/messages/conversationResync" - $ref: "#/channels/conversationEvents/messages/dataChanged" - $ref: "#/channels/conversationEvents/messages/artifactActivity" sendArtifactEvents: action: send title: Tell an artifact's open viewers that its access changed summary: >- Who may see the artifact changed, or this viewer's access ended and the socket is about to close. security: - $ref: "#/components/securitySchemes/webSession" - $ref: "#/components/securitySchemes/artifactInvite" - $ref: "#/components/securitySchemes/apiKey" channel: $ref: "#/channels/artifactEvents" messages: - $ref: "#/channels/artifactEvents/messages/artifactAccessChanged" - $ref: "#/channels/artifactEvents/messages/artifactAccessEnded" sendBotScreen: action: send title: Show a Bot's screen summary: The screen's pictures, and why something could not be shown or done. security: - $ref: "#/components/securitySchemes/webSession" - $ref: "#/components/securitySchemes/apiKey" - $ref: "#/components/securitySchemes/computersRead" channel: $ref: "#/channels/botScreen" messages: - $ref: "#/channels/botScreen/messages/screenHello" - $ref: "#/channels/botScreen/messages/screenFrame" - $ref: "#/channels/botScreen/messages/screenError" - $ref: "#/channels/botScreen/messages/screenInputError" receiveBotScreenInput: action: receive title: Take a person's mouse and keyboard summary: The person's input to the Bot's computer, and each picture's receipt. security: - $ref: "#/components/securitySchemes/webSession" - $ref: "#/components/securitySchemes/apiKey" - $ref: "#/components/securitySchemes/computersWrite" channel: $ref: "#/channels/botScreen" messages: - $ref: "#/channels/botScreen/messages/screenFrameReceived" - $ref: "#/channels/botScreen/messages/screenViewSize" - $ref: "#/channels/botScreen/messages/screenMouse" - $ref: "#/channels/botScreen/messages/screenWheel" - $ref: "#/channels/botScreen/messages/screenKey" - $ref: "#/channels/botScreen/messages/screenText" sendWindowsComputerScreen: action: send title: Show a Windows computer's screen summary: The screen's pictures, and why something could not be shown or done. security: - $ref: "#/components/securitySchemes/webSession" - $ref: "#/components/securitySchemes/apiKey" - $ref: "#/components/securitySchemes/computersRead" channel: $ref: "#/channels/windowsComputerScreen" messages: - $ref: "#/channels/windowsComputerScreen/messages/screenHello" - $ref: "#/channels/windowsComputerScreen/messages/screenFrame" - $ref: "#/channels/windowsComputerScreen/messages/screenError" - $ref: "#/channels/windowsComputerScreen/messages/screenInputError" receiveWindowsComputerScreenInput: action: receive title: Take a person's mouse and keyboard summary: The person's input to their Windows computer, and each picture's receipt. security: - $ref: "#/components/securitySchemes/webSession" - $ref: "#/components/securitySchemes/apiKey" - $ref: "#/components/securitySchemes/computersWrite" channel: $ref: "#/channels/windowsComputerScreen" messages: - $ref: "#/channels/windowsComputerScreen/messages/screenFrameReceived" - $ref: "#/channels/windowsComputerScreen/messages/screenMouse" - $ref: "#/channels/windowsComputerScreen/messages/screenWheel" - $ref: "#/channels/windowsComputerScreen/messages/screenKey" - $ref: "#/channels/windowsComputerScreen/messages/screenText" sendWindowsComputerLink: action: send title: Ask a Windows computer summary: Requests to the Windows computer, streams opened on it, what goes on them, and why the link ends. security: - $ref: "#/components/securitySchemes/windowsComputerCredential" channel: $ref: "#/channels/windowsComputerLink" messages: - $ref: "#/channels/windowsComputerLink/messages/linkRequest" - $ref: "#/channels/windowsComputerLink/messages/linkOpen" - $ref: "#/channels/windowsComputerLink/messages/linkData" - $ref: "#/channels/windowsComputerLink/messages/linkClose" - $ref: "#/channels/windowsComputerLink/messages/linkBye" - $ref: "#/channels/windowsComputerLink/messages/linkPong" receiveWindowsComputerLink: action: receive title: Hear from a Windows computer summary: The computer's hello, its answers, and what it sends on a stream. security: - $ref: "#/components/securitySchemes/windowsComputerCredential" channel: $ref: "#/channels/windowsComputerLink" messages: - $ref: "#/channels/windowsComputerLink/messages/linkHello" - $ref: "#/channels/windowsComputerLink/messages/linkResponse" - $ref: "#/channels/windowsComputerLink/messages/linkData" - $ref: "#/channels/windowsComputerLink/messages/linkClose" - $ref: "#/channels/windowsComputerLink/messages/linkPing" sendBotTerminal: action: send title: Show a Bot's terminal summary: The terminal's bytes, and when to clear, when it is live and what went wrong. security: - $ref: "#/components/securitySchemes/webSession" - $ref: "#/components/securitySchemes/apiKey" - $ref: "#/components/securitySchemes/computersRead" channel: $ref: "#/channels/botTerminal" messages: - $ref: "#/channels/botTerminal/messages/terminalOutput" - $ref: "#/channels/botTerminal/messages/terminalSnapshot" - $ref: "#/channels/botTerminal/messages/terminalReady" - $ref: "#/channels/botTerminal/messages/terminalError" receiveBotTerminalInput: action: receive title: Take a person's typing summary: What the person typed, the size of their terminal, and how much they have drawn. security: - $ref: "#/components/securitySchemes/webSession" - $ref: "#/components/securitySchemes/apiKey" - $ref: "#/components/securitySchemes/computersWrite" channel: $ref: "#/channels/botTerminal" messages: - $ref: "#/channels/botTerminal/messages/terminalInput" - $ref: "#/channels/botTerminal/messages/terminalResize" - $ref: "#/channels/botTerminal/messages/terminalAck" sendThreadStream: action: send title: Stream a conversation's runs summary: The thread's AG-UI events, replayed and then live, with the markers between. channel: $ref: "#/channels/threadStream" messages: - $ref: "#/channels/threadStream/messages/threadReply" - $ref: "#/channels/threadStream/messages/threadConnected" - $ref: "#/channels/threadStream/messages/threadAgUiEvent" - $ref: "#/channels/threadStream/messages/threadReplayComplete" - $ref: "#/channels/threadStream/messages/threadStreamIdle" - $ref: "#/channels/threadStream/messages/threadReplayFailed" - $ref: "#/channels/threadStream/messages/threadExpired" - $ref: "#/channels/threadStream/messages/threadClose" - $ref: "#/channels/threadStream/messages/threadError" receiveThreadCommands: action: receive title: Join a thread, keep the socket alive, stop a run, leave summary: What a client sends on the gateway's socket. channel: $ref: "#/channels/threadStream" messages: - $ref: "#/channels/threadStream/messages/threadJoin" - $ref: "#/channels/threadStream/messages/threadHeartbeat" - $ref: "#/channels/threadStream/messages/threadStopRun" - $ref: "#/channels/threadStream/messages/threadLeave" receiveTrajectoryEvents: action: receive title: Take what the Recorder captured summary: The Recorder joins a trajectory's topic and sends its events in batches. channel: $ref: "#/channels/trajectoryCapture" messages: - $ref: "#/channels/trajectoryCapture/messages/trajectoryJoin" - $ref: "#/channels/trajectoryCapture/messages/trajectoryEvents" sendTrajectoryReplies: action: send title: Answer the Recorder summary: The gateway's answer to a join and to each batch. channel: $ref: "#/channels/trajectoryCapture" messages: - $ref: "#/channels/trajectoryCapture/messages/trajectoryReply" sendOrganizationThreadStream: action: send title: Stream a conversation's runs, at the organization's address summary: The thread's AG-UI events, replayed and then live, with the markers between. security: - $ref: "#/components/securitySchemes/webSession" - $ref: "#/components/securitySchemes/apiKey" - $ref: "#/components/securitySchemes/conversationsRead" channel: $ref: "#/channels/organizationThreadStream" messages: - $ref: "#/channels/organizationThreadStream/messages/threadReply" - $ref: "#/channels/organizationThreadStream/messages/threadConnected" - $ref: "#/channels/organizationThreadStream/messages/threadAgUiEvent" - $ref: "#/channels/organizationThreadStream/messages/threadReplayComplete" - $ref: "#/channels/organizationThreadStream/messages/threadStreamIdle" - $ref: "#/channels/organizationThreadStream/messages/threadReplayFailed" - $ref: "#/channels/organizationThreadStream/messages/threadExpired" - $ref: "#/channels/organizationThreadStream/messages/threadClose" - $ref: "#/channels/organizationThreadStream/messages/threadError" receiveOrganizationThreadCommands: action: receive title: Join a thread, keep the socket alive, stop a run, leave, at the organization's address summary: What a client sends on the organization's relayed socket. security: - $ref: "#/components/securitySchemes/webSession" - $ref: "#/components/securitySchemes/apiKey" - $ref: "#/components/securitySchemes/conversationsRead" channel: $ref: "#/channels/organizationThreadStream" messages: - $ref: "#/channels/organizationThreadStream/messages/threadJoin" - $ref: "#/channels/organizationThreadStream/messages/threadHeartbeat" - $ref: "#/channels/organizationThreadStream/messages/threadStopRun" - $ref: "#/channels/organizationThreadStream/messages/threadLeave" receiveOrganizationTrajectoryEvents: action: receive title: Take what the Recorder captured, at the organization's address summary: The Recorder joins a trajectory's topic and sends its events in batches. channel: $ref: "#/channels/organizationTrajectoryCapture" messages: - $ref: "#/channels/organizationTrajectoryCapture/messages/trajectoryJoin" - $ref: "#/channels/organizationTrajectoryCapture/messages/trajectoryEvents" sendOrganizationTrajectoryReplies: action: send title: Answer the Recorder, at the organization's address summary: The gateway's answer to a join and to each batch. channel: $ref: "#/channels/organizationTrajectoryCapture" messages: - $ref: "#/channels/organizationTrajectoryCapture/messages/trajectoryReply" receiveVoiceCall: action: receive title: Take a person's side of a call summary: The session, the person's audio, and what they interrupt. channel: $ref: "#/channels/voiceCall" messages: - $ref: "#/channels/voiceCall/messages/voiceClientEvent" sendVoiceCall: action: send title: Send a Bot's side of a call summary: The Bot's audio and words, and what the voice service heard. channel: $ref: "#/channels/voiceCall" messages: - $ref: "#/channels/voiceCall/messages/voiceServiceEvent" components: securitySchemes: webSession: type: httpApiKey in: cookie name: better-auth.session_token description: >- The web app's server-side session, sent with the request that opens the socket. Served over HTTPS the cookie is __Secure-better-auth.session_token. A single-user install signs its one person in without a cookie. A request from another site is refused before the socket opens. windowsComputerCredential: type: http scheme: bearer bearerFormat: OpenBot Windows computer credential description: >- A Windows computer's own credential, made when it exchanged an enrollment code (exchangeWindowsComputerEnrollmentCode), sent as Authorization: Bearer on the request that opens its link. OpenBot accepts it nowhere else. It ends when the computer is disconnected, including by another Windows computer being connected for the same person. apiKey: type: http scheme: bearer description: >- An API key a person made for automation, sent as Authorization: Bearer on the request that opens the socket. It acts as that person, with everything they may do. conversationsRead: type: oauth2 description: >- An access token one of OpenBot's apps holds (Desktop, mobile, the CLI), from OAuth 2.1 authorization code with PKCE, sent as Authorization: Bearer on the request that opens the socket. The person allowed the app to see their conversations. flows: authorizationCode: authorizationUrl: http://127.0.0.1:3001/api/auth/oauth2/authorize tokenUrl: http://127.0.0.1:3001/api/auth/oauth2/token refreshUrl: http://127.0.0.1:3001/api/auth/oauth2/token availableScopes: conversations:read: Read the signed-in person's conversations, and watch a Bot's runs in them. scopes: - conversations:read computersRead: type: oauth2 description: >- An app's access token, as above. The person allowed the app to watch their Bots' screens and terminals. flows: authorizationCode: authorizationUrl: http://127.0.0.1:3001/api/auth/oauth2/authorize tokenUrl: http://127.0.0.1:3001/api/auth/oauth2/token refreshUrl: http://127.0.0.1:3001/api/auth/oauth2/token availableScopes: computers:read: Watch the signed-in person's Bots' screens and terminals. computers:write: Use the mouse and keyboard on the signed-in person's Bots' computers. scopes: - computers:read computersWrite: type: oauth2 description: >- An app's access token, as above. The person allowed the app to use their Bots' computers as well as watch them. flows: authorizationCode: authorizationUrl: http://127.0.0.1:3001/api/auth/oauth2/authorize tokenUrl: http://127.0.0.1:3001/api/auth/oauth2/token refreshUrl: http://127.0.0.1:3001/api/auth/oauth2/token availableScopes: computers:read: Watch the signed-in person's Bots' screens and terminals. computers:write: Use the mouse and keyboard on the signed-in person's Bots' computers. scopes: - computers:read - computers:write artifactInvite: type: httpApiKey in: cookie name: openbot-artifact-invite description: >- The cookie the artifacts address sets when somebody outside the organization uses an invitation's code (redeemArtifactInvite). It lets that browser view the one artifact the invitation is for, and nothing else. Served over HTTPS the cookie is __Host-openbot-artifact-invite. joinToken: type: httpApiKey in: query name: join_token description: >- A join token for one thread or one trajectory, handed out by OpenBot to somebody who may have it. It works once and for about half a minute. voiceClientSecret: type: httpApiKey in: header name: Sec-WebSocket-Protocol description: >- The one-call secret from the REST operation that starts a call, sent as the socket's subprotocol: xai-client-secret.{secret}. parameters: organizationId: description: >- The organization, by its id or its slug, which the caller must be a member of. One the caller is not in answers as one that does not exist, default included. botId: description: The Bot whose computer it is. artifactId: description: The artifact, by the id its link carries. messages: ArtifactAccessChanged: name: artifactAccessChanged title: Artifact access changed summary: >- Who may see or edit the artifact changed, or it was renamed. Read its sharing, the viewer's own access and the artifact again. payload: $ref: "#/components/schemas/ArtifactAccessChanged" ArtifactAccessEnded: name: artifactAccessEnded title: Artifact access ended summary: >- The viewer can no longer view the artifact. Close it; the socket closes next. payload: $ref: "#/components/schemas/ArtifactAccessEnded" ConversationActivity: name: conversationActivity title: Conversation activity summary: One conversation changed. payload: $ref: "#/components/schemas/ConversationActivity" DataChanged: name: dataChanged title: Data changed summary: >- Something the person sees outside their conversations changed. Read it again. payload: $ref: "#/components/schemas/DataChanged" ArtifactActivity: name: artifactActivity title: Artifact activity summary: >- Something changed on an artifact the person has open: its comments, who else has it open, or a page's shared data. payload: $ref: "#/components/schemas/ArtifactActivity" ConversationResync: name: conversationResync title: Resync summary: >- Changes may have been missed, and they cannot be sent again. Read the conversations afresh. payload: $ref: "#/components/schemas/ConversationResync" ScreenHello: name: screenHello title: Hello summary: The first message, saying how the stream is paced. payload: $ref: "#/components/schemas/ScreenHello" ScreenFrame: name: screenFrame title: Frame summary: The screen as it is now, as one picture. payload: $ref: "#/components/schemas/ScreenFrame" ScreenError: name: screenError title: Screen error summary: The screen cannot be shown, and why. payload: $ref: "#/components/schemas/ScreenError" ScreenInputError: name: screenInputError title: Input error summary: The person's input was not applied, and why. payload: $ref: "#/components/schemas/ScreenInputError" ScreenFrameReceived: name: screenFrameReceived title: Frame received summary: >- The viewer drew a frame and is ready for the next. Sent once per frame when hello said frames are confirmed. payload: $ref: "#/components/schemas/ScreenFrameReceived" ScreenViewSize: name: screenViewSize title: View size summary: >- How large the viewer draws the screen, so frames come sharp at that size and no larger. Sent only when hello said viewSize, again whenever the size changes. A viewer that only watches may send it too. payload: $ref: "#/components/schemas/ScreenViewSize" ScreenMouse: name: screenMouse title: Mouse summary: A mouse button pressed or released, or the pointer moved. payload: $ref: "#/components/schemas/ScreenMouse" ScreenWheel: name: screenWheel title: Wheel summary: The wheel turned. payload: $ref: "#/components/schemas/ScreenWheel" ScreenKey: name: screenKey title: Key summary: A key went down or came up. payload: $ref: "#/components/schemas/ScreenKey" ScreenText: name: screenText title: Text summary: Text to type as it is, such as a paste. payload: $ref: "#/components/schemas/ScreenText" TerminalOutput: name: terminalOutput title: Terminal output summary: The terminal's own bytes, in a binary frame, to write as they are. contentType: application/octet-stream payload: type: string format: binary TerminalSnapshot: name: terminalSnapshot title: Snapshot summary: Clear the terminal; the bytes that follow draw it as it is now. payload: $ref: "#/components/schemas/TerminalSnapshot" TerminalReady: name: terminalReady title: Ready summary: The snapshot is over and the viewer is live. payload: $ref: "#/components/schemas/TerminalReady" TerminalError: name: terminalError title: Terminal error summary: Something was refused or failed, and whether trying again can help. payload: $ref: "#/components/schemas/TerminalError" TerminalInput: name: terminalInput title: Input summary: What the person typed. payload: $ref: "#/components/schemas/TerminalInput" TerminalResize: name: terminalResize title: Resize summary: The size the viewer's terminal fits, which the shell takes. payload: $ref: "#/components/schemas/TerminalResize" TerminalAck: name: terminalAck title: Acknowledge summary: How many bytes the viewer has drawn since it last said, which paces the output. payload: $ref: "#/components/schemas/TerminalAck" ThreadJoin: name: threadJoin title: Join a thread summary: Ask for the thread's events, from the start or from the last one seen. payload: $ref: "#/components/schemas/ThreadJoinFrame" ThreadReply: name: threadReply title: Reply summary: The gateway's answer to a join, a heartbeat or a stop. payload: $ref: "#/components/schemas/ThreadReplyFrame" ThreadHeartbeat: name: threadHeartbeat title: Heartbeat summary: Keeps the socket open. Sent at least every 30 seconds. payload: $ref: "#/components/schemas/ThreadHeartbeatFrame" ThreadConnected: name: threadConnected title: Connected summary: The join was accepted; the replay follows. payload: $ref: "#/components/schemas/ThreadConnectedFrame" ThreadAgUiEvent: name: threadAgUiEvent title: AG-UI event summary: One event of a run, replayed or live. payload: $ref: "#/components/schemas/ThreadAgUiEventFrame" ThreadReplayComplete: name: threadReplayComplete title: Replay complete summary: Everything the thread already held has been sent; what follows is live. payload: $ref: "#/components/schemas/ThreadReplayCompleteFrame" ThreadStreamIdle: name: threadStreamIdle title: Stream idle summary: No run is in progress in the thread. payload: $ref: "#/components/schemas/ThreadStreamIdleFrame" ThreadReplayFailed: name: threadReplayFailed title: Replay failed summary: The thread's events could not be replayed. Read its messages over REST and join again. payload: $ref: "#/components/schemas/ThreadReplayFailedFrame" ThreadExpired: name: threadExpired title: Expired summary: The connection's time is up. Ask for a new join token and connect again. payload: $ref: "#/components/schemas/ThreadExpiredFrame" ThreadStopRun: name: threadStopRun title: Stop a run summary: Stop the run in progress, keeping what it has written. payload: $ref: "#/components/schemas/ThreadStopRunFrame" ThreadLeave: name: threadLeave title: Leave a thread summary: Stop receiving the thread's events, keeping the socket. payload: $ref: "#/components/schemas/ThreadLeaveFrame" ThreadClose: name: threadClose title: Closed summary: The gateway closed the thread's topic, after a leave or at the end of the connection's time. payload: $ref: "#/components/schemas/ThreadCloseFrame" ThreadError: name: threadError title: Topic error summary: The thread's topic failed on the gateway. Ask for a new join token and connect again. payload: $ref: "#/components/schemas/ThreadErrorFrame" TrajectoryJoin: name: trajectoryJoin title: Join a trajectory summary: Open the trajectory's topic before sending to it. payload: $ref: "#/components/schemas/TrajectoryJoinFrame" TrajectoryEvents: name: trajectoryEvents title: Captured events summary: One batch of what the person did, oldest first. payload: $ref: "#/components/schemas/TrajectoryEventsFrame" TrajectoryReply: name: trajectoryReply title: Reply summary: Whether the join or the batch was taken. payload: $ref: "#/components/schemas/TrajectoryReplyFrame" VoiceClientEvent: name: voiceClientEvent title: An event from the person's side summary: The session, the person's audio, a mute, or an interruption. payload: $ref: "#/components/schemas/VoiceEvent" VoiceServiceEvent: name: voiceServiceEvent title: An event from the voice service summary: The Bot's audio or words, or what the service heard and did. payload: $ref: "#/components/schemas/VoiceEvent" LinkHello: name: linkHello title: Hello summary: The Windows computer's first message on a new link. payload: $ref: "#/components/schemas/LinkHello" LinkRequest: name: linkRequest title: Request summary: Something OpenBot asks of the Windows computer, answered by its id. payload: $ref: "#/components/schemas/LinkRequest" LinkResponse: name: linkResponse title: Response summary: The Windows computer's answer to a request. payload: $ref: "#/components/schemas/LinkResponse" LinkOpen: name: linkOpen title: Open a stream summary: OpenBot opens a stream on the Windows computer, such as its live screen. payload: $ref: "#/components/schemas/LinkOpen" LinkData: name: linkData title: Stream data summary: One message on an open stream, either way. payload: $ref: "#/components/schemas/LinkData" LinkClose: name: linkClose title: Close a stream summary: Either side ends a stream. payload: $ref: "#/components/schemas/LinkClose" LinkPing: name: linkPing title: Ping summary: >- The computer checks the link is alive. A link the computer hears nothing on for a while is presumed dead, and dialled again. payload: $ref: "#/components/schemas/LinkPing" LinkPong: name: linkPong title: Pong summary: OpenBot's answer to a ping. payload: $ref: "#/components/schemas/LinkPong" LinkBye: name: linkBye title: Bye summary: OpenBot ends the link, and why, just before closing it. payload: $ref: "#/components/schemas/LinkBye" schemas: ConversationActivity: type: object description: >- One conversation changed. Every message carries the conversation's newest message; the optional members say what else this one is about. required: - channelId - memberIds - lastMessage - lastMessageAt - lastMessageAgentId properties: channelId: type: string description: The conversation. organizationId: type: string description: >- The organization the conversation is in. A client ignores a message for an organization other than the one it shows. Absent from a server that sends only the socket's own organization's. memberIds: type: array description: The people this message was sent to. items: type: string lastMessage: type: - string - "null" description: The newest message's text on one line, or null when there is none. lastMessageAt: type: - string - "null" format: date-time description: When the newest message was written. lastMessageAgentId: type: - string - "null" description: The Bot that wrote the newest message, or null when a person did. firstLine: type: string description: A Bot's reply, its first line as plain text. Only on a Bot's message. summary: type: - string - "null" description: What the conversation is called now. Null when its name was cleared. opening: type: string description: A person's first words, which name the conversation until it has a summary. deleted: type: boolean const: true description: The conversation was removed for everybody in it. pinned: type: boolean description: This person pinned or unpinned the conversation. busy: type: boolean description: >- A turn started (true) or ended (false) in the conversation. Also true, for a socket opened without the capability conversation-work-turn, while the server is carrying a turn there. work: type: array description: >- Everything the conversation is waiting on right now, the whole list. Sent only to the person whose work it is. items: $ref: "#/components/schemas/ConversationWork" workAt: type: string description: >- When work was read, in UTC to the microsecond and of fixed width, so two compare as text. Messages can arrive out of order: keep the list with the latest stamp. ConversationWork: type: object description: Something a conversation is waiting on. required: - kind - key - botId - botName - since properties: kind: type: string x-extensible-enum: - handoff - routine - turn description: >- A Bot that was asked and has not answered yet (handoff), a routine that is running (routine), or the person's own turn, which the server is carrying on with no page open (turn), between one run and the next too. A kind the app doesn't know is still work. turn is sent only to a socket opened with the capability conversation-work-turn; any other is sent work without it, and busy true while the turn goes on. key: type: string description: Stable for this piece of work, so two asks of one Bot are two entries. botId: type: string description: The Bot that was asked, the Bot the routine runs as, or the Bot answering the turn. botName: type: - string - "null" description: The Bot's name when the work started. routineId: type: string description: The routine. Only on a routine. since: type: string format: date-time description: When the work started. For a turn, when the server took it on. DataChanged: type: object description: >- Something the person sees outside their conversations changed: a hint to read it again over REST, never the data itself, so a missed one costs only freshness, and a resync covers it. It names no conversation: a client tells it from a conversation's activity by `changed`, and from a resync by having no `resync`. Sent to the people who see what changed, in the organization it changed in, and only on a socket opened with the capability data-changed: releases up to v0.0.7 read every message on this socket as a conversation's activity. At most one a second to a socket: the first at once, and whatever changes in the rest of that second in one more when it is up, its kinds added together. A client reads again only what it shows, and may read once for several messages that come close together. required: - changed - organizationId properties: changed: type: array minItems: 1 description: >- What changed. `approvals`: the person's approval inbox, its approvals or its questions (listApprovals, listQuestions). `needsYou`: what waits on the person, their check-in items and their tasks (listCheckInItems, listTasks). `bots`: a Bot was made, changed, removed, published, paused or resumed, or the person hid it, pinned it or changed how it may reach them (listBots, getBot, getBotLifecycle). `activity`: what a Bot is doing for the person changed, when a piece of its work (a follow-up, a routine or a goal and their runs, a hop to another Bot, a wait on the person) is scheduled, changed, handed over, stopped or finished (getBotActivity); never for each message or step of a turn. `routines`: a routine was made, changed or removed, or one of its runs started or ended (listRoutines, listRoutineRuns). `computers`: a Bot's computer changed hands or is changing them (the Bot, or a person, has control; a request for a person; the Bot asking a person to type a secret), or it started, woke or went to sleep (getComputerControl, and the botScreen channel, which a viewer may open again). A client reads a value it doesn't know as nothing it shows, and ignores it. `artifacts`: an artifact was shared with the person or unshared, directly or through a team, or one they can see changed who it is open to (the artifacts shared with them, and an artifact's sharing, getArtifactSharing). `components`: a component the person's Bots draw was added, changed, published or unpublished, held back from a Bot or given back, or given data to read (listComponents, listBotComponents); named with the Bot when only one Bot's components changed. `grants`: what a Bot holds changed, an app's actions or a skill given to it or taken away (listBotGrants), or a request for an app or for a Bot's use of a shared account was made or decided (listAppAccessRequests, listSharedUseRequests, getBotSharedUse). `deliveries`: how the person's Bots reach them outside OpenBot changed, a Slack, Teams or phone destination linked or removed, a phone registered for push notifications or removed, or something sent to them (listDestinations, listDevices, listDeliveries). `memory`: what the person's Bots remember about them changed, a fact formed, changed or forgotten, or a memory source added, read or changed (listMemories, listMemorySources). Which of these a server sends is in its deployment answer (dataChanged in getDeployment). items: type: string x-extensible-enum: - approvals - needsYou - bots - activity - routines - computers - artifacts - components - grants - deliveries - memory organizationId: type: string description: >- The organization it changed in, which is the one the socket was opened in. A client ignores a message for an organization other than the one it shows. botId: type: string description: >- The Bot it is about, when it is about one: a client showing another Bot need not read again. Absent when it is about several, or none. ArtifactAccessChanged: type: object description: >- A hint that who may see or edit the artifact changed, or that it was renamed: read its sharing (getArtifactSharing) and the artifact again. Sent to every open viewer who can still view it, so an editor made a viewer stops offering to edit, and an open viewer shows the new title. required: - artifactId - organizationId properties: artifactId: type: string description: The artifact. organizationId: type: string description: The organization it belongs to. ArtifactAccessEnded: type: object description: >- The viewer can no longer view the artifact. A client closes it and shows why. The server closes the socket with code 4403 right after. required: - artifactId - organizationId - reason properties: artifactId: type: string description: The artifact. organizationId: type: string description: The organization it belongs to. reason: type: string description: >- Why. unshared: it is no longer shared with the viewer, or no longer open to them. deleted: the artifact was deleted. policy: an admin turned public links or outside invitations off. signedOut: the viewer's sign-in ended. A client reads a value it doesn't know as unshared. x-extensible-enum: - unshared - deleted - policy - signedOut ArtifactActivity: type: object description: >- Something changed on an artifact the person has open in OpenBot: a hint to read it again over REST, except who has it open, which it carries whole. Sent only to the people who have the artifact open (joinArtifactPresence), in the organization it changed in, and only on a socket opened with the capability artifact-activity. Nothing is replayed: a viewer reads the threads, the viewers and any shared data it shows again when the socket opens and on a resync. required: - artifactId - organizationId - artifactChanged properties: artifactId: type: string description: The artifact. organizationId: type: string description: >- The organization it changed in. A client ignores a message for an organization other than the one it shows. artifactChanged: type: array minItems: 1 description: >- What changed. `comments`: a thread was started, answered, resolved, reopened, sent to a Bot or deleted (listArtifactCommentThreads, getArtifactCommentThread). `presence`: somebody opened or closed it; viewers is the whole list now. `pageData`: a page's shared document was written or deleted (listArtifactPageDocuments, getArtifactPageDocument). A client ignores a value it doesn't know. items: type: string x-extensible-enum: - comments - presence - pageData threadId: type: string description: The thread, when comments changed in one. documentKey: type: string description: The shared document's key, when pageData changed. viewers: type: array description: Who has it open now, longest open first, when presence changed. items: type: object required: - personId - name - image - since properties: personId: type: string name: type: - string - "null" image: type: - string - "null" since: type: string format: date-time ConversationResync: type: object required: - resync additionalProperties: false properties: resync: type: boolean const: true ScreenHello: type: object required: - type - confirmFrames properties: type: type: string const: hello confirmFrames: type: boolean description: >- When true, the next frame is sent only after the viewer says it received the last. viewSize: type: boolean description: >- When true, the viewer may say how large it draws the screen (view-size), and frames are sent at that size, up to the most detail the screen has. Absent or false, frames come at the screen's own width and height in pixels, and a view-size is not sent. ScreenFrame: type: object required: - type - data - width - height properties: type: type: string const: frame data: type: string contentEncoding: base64 contentMediaType: image/jpeg description: >- The picture, a JPEG in base64. It can have more pixels than width and height, when the viewer asked for a sharper picture (view-size); it always shows the whole screen. width: type: number description: The screen's width in pixels, which mouse positions are measured in. height: type: number description: The screen's height in pixels. ScreenError: type: object required: - type - error properties: type: type: string const: error error: type: string description: Why, in words a person can read. ScreenInputError: type: object required: - type - error properties: type: type: string const: input-error error: type: string description: Why, in words a person can read. ScreenFrameReceived: type: object required: - type additionalProperties: false properties: type: type: string const: frame-received ScreenViewSize: type: object required: - type - width - height additionalProperties: false properties: type: type: string const: view-size width: type: number exclusiveMinimum: 0 description: >- How wide the viewer draws the screen, in the viewer's own device pixels: its width on the page times the display's pixel ratio. height: type: number exclusiveMinimum: 0 description: How tall the viewer draws the screen, in the same pixels. ScreenMouse: type: object required: - type - event - x - "y" properties: type: type: string const: mouse event: type: string enum: - pressed - released - moved x: type: number description: Across, in the screen's pixels. "y": type: number description: Down, in the screen's pixels. button: type: string enum: - none - left - right - middle description: The button this is about; none for a move with nothing held. buttons: type: integer description: "Every button held, as a sum: left 1, right 2, middle 4." clickCount: type: integer description: 1 for a click, 2 for a double click. modifiers: type: integer description: "The modifier keys held, as a sum: Alt 1, Control 2, Meta 4, Shift 8." ScreenWheel: type: object required: - type - x - "y" - deltaX - deltaY properties: type: type: string const: wheel x: type: number "y": type: number deltaX: type: number deltaY: type: number modifiers: type: integer ScreenKey: type: object required: - type - event - key - code properties: type: type: string const: key event: type: string enum: - down - up key: type: string description: The key's value, as KeyboardEvent.key has it. code: type: string description: The physical key, as KeyboardEvent.code has it. text: type: string description: The text the key types, when it types any. windowsVirtualKeyCode: type: integer description: The key's legacy key code, for keys that need one. modifiers: type: integer ScreenText: type: object required: - type - text properties: type: type: string const: text text: type: string TerminalSnapshot: type: object required: - type - cols - rows properties: type: type: string const: snapshot cols: type: integer description: The terminal's width in columns. rows: type: integer description: The terminal's height in rows. TerminalReady: type: object required: - type properties: type: type: string const: ready TerminalError: type: object required: - type - error properties: type: type: string const: error error: type: string description: Why, in words a person can read. fatal: type: boolean description: True when connecting again will not help. TerminalInput: type: object required: - type - data properties: type: type: string const: input data: type: string maxLength: 65536 description: What the person typed or pasted. TerminalResize: type: object required: - type - cols - rows properties: type: type: string const: resize cols: type: integer minimum: 1 rows: type: integer minimum: 1 TerminalAck: type: object required: - type - bytes properties: type: type: string const: ack bytes: type: integer minimum: 0 PhoenixReference: type: - string - "null" description: >- A reference the sender chose. A reply repeats the reference of the message it answers; a message the gateway sends on its own has null. ThreadTopic: type: string pattern: ^thread:.+$ description: >- The thread, as thread: and the gateway's name for it: the topic the REST answer gave (realtime.topic), used as given. ThreadJoinFrame: type: array description: "[join reference, reference, topic, \"phx_join\", payload]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/ThreadTopic" - type: string const: phx_join - type: object properties: stream_mode: type: string enum: - connect - run description: >- connect, the default, replays what the thread holds and then goes live; run follows one run from its start. run_id: type: - string - "null" description: The run to follow, in run mode. last_seen_event_id: type: - string - "null" description: >- The id of the last event this client drew, so the replay starts after it. Null, or left out, replays from the start. ThreadHeartbeatFrame: type: array description: "[null, reference, \"phoenix\", \"heartbeat\", {}]" minItems: 5 maxItems: 5 items: - type: "null" - $ref: "#/components/schemas/PhoenixReference" - type: string const: phoenix - type: string const: heartbeat - type: object ThreadReplyFrame: type: array description: "[join reference, reference, topic, \"phx_reply\", {status, response}]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - type: string description: The thread's topic, or phoenix for a heartbeat's reply. - type: string const: phx_reply - type: object required: - status - response properties: status: type: string enum: - ok - error response: type: object description: Empty on ok. On error, reason says why. properties: reason: type: string ThreadConnectedFrame: type: array description: "[join reference, null, topic, \"connected\", payload]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/ThreadTopic" - type: string const: connected - type: object required: - thread_id properties: thread_id: type: string user_id: type: string description: The person the join token was made for, as the gateway names them. organization_id: type: string description: The gateway's own organization for this OpenBot. ThreadAgUiEventFrame: type: array description: "[join reference, null, topic, \"ag_ui_event\", event]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/ThreadTopic" - type: string const: ag_ui_event - $ref: "#/components/schemas/AgUiEvent" AgUiEvent: type: object description: >- One AG-UI event, with every member the AG-UI protocol gives its type (see https://docs.ag-ui.com/concepts/events), plus its id, and where it belongs when the gateway says. An event may come without thread_id, run_id and organization_id: the topic it arrives on is its thread. required: - type properties: type: type: string description: The AG-UI event type, such as RUN_STARTED, TEXT_MESSAGE_CONTENT or RUN_FINISHED. thread_id: type: string run_id: type: string organization_id: type: string metadata: type: object properties: cpki_event_id: type: string description: >- The event's id, unique in the thread and ordered. Send the last one seen when joining again, and drop an id already drawn. ThreadControlPayload: type: object required: - thread_id properties: thread_id: type: string organization_id: type: string latestEventId: type: - string - "null" description: The id of the last event sent before this marker, or null when there was none. historyWindow: type: object description: Present when the replay was cut to the thread's most recent events. properties: policyVersion: type: integer selectedEventCount: type: integer completeness: type: string ThreadReplayCompleteFrame: type: array description: "[join reference, null, topic, \"replay_complete\", payload]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/ThreadTopic" - type: string const: replay_complete - $ref: "#/components/schemas/ThreadControlPayload" ThreadStreamIdleFrame: type: array description: "[join reference, null, topic, \"stream_idle\", payload]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/ThreadTopic" - type: string const: stream_idle - $ref: "#/components/schemas/ThreadControlPayload" ThreadReplayFailedFrame: type: array description: "[join reference, null, topic, \"replay_failed\", payload]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/ThreadTopic" - type: string const: replay_failed - type: object required: - reason properties: reason: type: string retryable: type: boolean latestEventId: type: - string - "null" ThreadExpiredFrame: type: array description: "[join reference, null, topic, \"expired\", {reason}]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/ThreadTopic" - type: string const: expired - type: object required: - reason properties: reason: type: string ThreadStopRunFrame: type: array description: "[join reference, reference, topic, \"stop_run\", {run_id}]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/ThreadTopic" - type: string const: stop_run - type: object required: - run_id properties: run_id: type: string description: The run to stop. ThreadLeaveFrame: type: array description: "[join reference, reference, topic, \"phx_leave\", {}]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/ThreadTopic" - type: string const: phx_leave - type: object ThreadCloseFrame: type: array description: "[join reference, reference, topic, \"phx_close\", {}]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/ThreadTopic" - type: string const: phx_close - type: object ThreadErrorFrame: type: array description: "[join reference, reference, topic, \"phx_error\", {}]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/ThreadTopic" - type: string const: phx_error - type: object TrajectoryTopic: type: string pattern: ^trajectory:.+$ description: The trajectory, as trajectory:{trajectoryId}. TrajectoryJoinFrame: type: array description: "[join reference, reference, topic, \"phx_join\", {}]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/TrajectoryTopic" - type: string const: phx_join - type: object TrajectoryEventsFrame: type: array description: "[join reference, reference, topic, \"events\", {events, dropped}]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/TrajectoryTopic" - type: string const: events - type: object required: - events - dropped properties: events: type: array description: >- AG-UI custom events, each with the sequence number the Recorder gave it. A whole batch is at most 65,536 bytes. items: type: object required: - type properties: type: type: string dropped: type: integer minimum: 0 description: How many events the Recorder had to let go since it last said. TrajectoryReplyFrame: type: array description: "[join reference, reference, topic, \"phx_reply\", {status, response}]" minItems: 5 maxItems: 5 items: - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/PhoenixReference" - $ref: "#/components/schemas/TrajectoryTopic" - type: string const: phx_reply - type: object required: - status - response properties: status: type: string enum: - ok - error response: type: object description: On error, reason says why. VoiceEvent: type: object description: >- One event of the voice service's realtime protocol. Its other members depend on its type and are the voice service's to define. required: - type properties: type: type: string description: The event's name, such as session.update or response.output_audio.delta. LinkHello: type: object required: - type - version - contract properties: type: type: string const: hello version: type: string description: The version of OpenBot's program on the Windows computer. contract: type: integer minimum: 1 description: The version of the requests it understands. LinkRequest: type: object required: - type - id - method - path properties: type: type: string const: request id: type: string description: Unique on this link. The response carries it back. method: type: string enum: - GET - POST - PUT path: type: string description: What is asked, with its query, such as /desktop/snapshot. seat: $ref: "#/components/schemas/LinkSeat" body: description: The request's JSON body, when it has one. LinkResponse: type: object required: - type - id - status properties: type: type: string const: response id: type: string status: type: integer minimum: 100 maximum: 599 description: As an HTTP status. body: description: The answer's JSON body, when it has one. LinkOpen: type: object required: - type - stream - path properties: type: type: string const: open stream: type: string description: Unique on this link, chosen by OpenBot. path: type: string description: The stream to open, such as /desktop/screen. seat: $ref: "#/components/schemas/LinkSeat" LinkData: type: object required: - type - stream - data properties: type: type: string const: data stream: type: string data: type: string description: One text message of the stream, as it is. LinkClose: type: object required: - type - stream properties: type: type: string const: close stream: type: string code: type: integer description: A WebSocket close code, when there is one to give. reason: type: string maxLength: 120 LinkBye: type: object required: - type - reason properties: type: type: string const: bye reason: type: string x-extensible-enum: - replaced - disconnected - shutting_down description: >- replaced: a newer link from the same computer took over. disconnected: the computer was disconnected from OpenBot, so its credential no longer works. shutting_down: OpenBot is stopping; dial again. LinkSeat: type: object description: Who a request or a stream is for, the person and their Bot, so the computer can refuse any other. required: - personId - botId properties: personId: type: string botId: type: string LinkPing: type: object required: - type properties: type: type: string const: ping LinkPong: type: object required: - type properties: type: type: string const: pong