Expand description
What goes over the workspace’s socket: one line of JSON from the server in a container, one line of JSON back from QCode, and the connection closes.
A question:
{"token":"…","op":"list"}
{"token":"…","op":"send","tab":"3","text":"Please run the tests.","kind":"report"}
{"token":"…","op":"send","tab":"all","text":"I am taking the parser; leave it to me."}
{"token":"…","op":"inbox"}
{"token":"…","op":"peek"}
{"token":"…","session":"ses_…","op":"list"}A question may carry the conversation it was asked from in session. opencode’s shared server
speaks for every tab of its profile with one token, and each of those tabs shows a
conversation of its own, so the two together name the tab (see
crate::ui::workspace’s shared server).
A message has a Kind, info when the question names none, so a server written before
kinds existed is still understood. "tab":"all" hands it to every other agent tab of the
workspace.
An answer carries the words the agent is shown, whether it was done, for a list the asking tab itself and the others, and for a message to every tab what happened at each:
{"ok":true,"text":"…","you":{"tab":"2","title":"reviewer","harness":"Claude Code","profile":"claude-sub","workspace":"Firefly"},"tabs":[{"tab":"3","title":"codex-main","harness":"Codex","profile":"codex-main","network":true,"inbox":false,"waiting":0,"trouble":null}]}
{"ok":true,"text":"…","messages":[{"from":"Codex · codex-main","tab":"3","kind":"question","text":"Please run the tests."}]}
{"ok":true,"text":"…","sent":[{"tab":"3","title":"codex-main","ok":true,"text":"Delivered. …"}]}
{"ok":false,"text":"…"}Everything a question holds came out of a container and is read as untrusted: a line that is
too long, not JSON, or not one of the two shapes is Malformed, and nothing in it is
acted on.
Structs§
- Answer
- QCode’s answer to a question.
- Listed
- One tab a message can be sent to, as a list answers it.
- Malformed
- A line that is not a question.
- Outcome
- What happened to a message sent to every tab, at one of them.
- Question
- A question from a tab’s server.
- Received
- A message taken out of a tab’s inbox, as the inbox answers it.
- You
- The tab that asked, as a list answers it: an agent learns which tab it is itself only from this, never from what another agent tells it.
Enums§
- Kind
- What the sender asks of the agent that receives a message. It is said in the header the message arrives under, with how to answer, so that an agent knows whether anyone waits on it.
- Request
- What a tab’s server can ask.
- To
- Where a message goes.
Constants§
- ALL
- The word that sends a message to every other agent tab rather than to one.
- MOST_
LINE - The longest question read, in bytes. A message longer than
MOST_TEXTis refused anyway; the room above that is for the JSON around it and for escapes. - MOST_
TEXT - The most characters a message may have. A message is something one agent hands another to act on, a task or an answer; a whole file does not belong in one, the workspace folder is where both agents read files.
Functions§
- parse
- Reads one question.