Expand description
Dependency-light wire types shared by SCV clients and the server.
ClientMessage is everything a client sends and ServerEvent
everything the server answers, one JSON object per line (FrameDecoder
bounds each line). Additive fields, and new values of the enums that
parse unknown values as Unknown (ErrorCode, ToolErrorKind,
ServerEvent), keep PROTOCOL_VERSION; a breaking change bumps it.
This crate holds no runtime policy and does no I/O.
Structs§
- Attachment
- A file a client attaches to its turn, already saved on the daemon’s host, such as a photo or document a chat user sent.
- ChatLog
- A conversation’s chat log under the server’s history directory,
<channel>/<account>/<conversation>. Each part is at most 64 bytes of ASCII letters, digits,-, and_. - Component
Health - The health of one channel account.
- Confirm
Info - A yes/no question to the owner in chat (
scv confirm). - Daemon
Status - What
scv statusshows: the daemon, its components, and its delegations. - Delegation
Info - One running delegated agent.
- Delegation
Summary - Delegated agent runs of the daemon’s SCV instance.
- Frame
Decoder - Splits a byte stream into bounded lines.
- JobChange
- A background job a tool call started, or whose result the call showed
the model (
tool.completed.jobs). A session’s clients keep it open while its jobs run, since closing the session cancels them. - Peer
Info - A client’s or server’s name and version, exchanged at
initialize. - Queue
Entry - A prompt waiting for the running turn to finish.
- Reply
Attachment - A file the model attached to its reply with
CHAT_ATTACH_TOOL, as the tool’s successfultool.completedoutput reports it. - Restart
Info - A restart into a newly installed release, waiting for owner work to end.
- Step
- How much of a buffer
FrameDecoder::feedused, and what it completed. - Turn
Origin - Why the server started a turn on its own.
- Usage
- Tokens a turn used, as the provider reported them.
Enums§
- Client
Message - A message from client to server. Serialized as one JSON object per line,
tagged by
type(such asturn.start). - Component
State - Where a daemon component (a channel account) is in its lifecycle.
- Confirm
State - Where a question to the owner stands.
- Daemon
Command - What a
daemon.controlmessage asks the daemon to do. - Error
Code - Why a request (
error) or a turn (turn.failed) failed. - Frame
- One result of decoding.
- JobStatus
- Where a background job stands, with the strings the model reads in the job tools’ results.
- Origin
Kind - What a server-started turn is for.
- Overflow
- What a decoder does with a line longer than its limit.
- Remote
Tools - Who may use tools through a remote bridge account.
- Senders
- Whose messages a remote bridge account answers.
- Server
Event - A message from server to client. Serialized as one JSON object per line,
tagged by
type(such asturn.completed). Turn events carry the session’s consecutiveseq. - Tool
Error Kind - Why a tool call failed (
tool.completed.error). The model reads the call’s output either way; this tells a client how to show it.
Constants§
- CHAT_
ATTACH_ TOOL - The tool a chat session’s model calls to send a file with its reply.
- DEFAULT_
CONFIRM_ SECONDS - How long a question to the owner waits for an answer unless the asker says otherwise.
- MAX_
CHANNEL_ NAME_ BYTES - The longest
session.startchannel name. - MAX_
CONFIRM_ SECONDS - The longest a question to the owner may wait: the default ceiling of a
delegated agent’s own tool call (
tools.max_timeout_seconds), which is how a delegated agent asks. - MAX_
TURN_ ATTACHMENTS - Files one
turn.startmay attach. - PROTOCOL_
VERSION - The protocol version. Client and server must speak the same one.
Functions§
- encode_
frame - Encode
messageas one frame: its JSON and a\n. - job_
agent - The agent a background job runs, such as
codex:agentwhen it is set, otherwise what followsagent_in the delegatingtool, as SCV 0.3.0 and older named it (agent_codex), otherwisetoolitself. - reply_
attachment - The attachment a successful
CHAT_ATTACH_TOOLcall reports: its output is{"attached": {...}, ...}. Anything else isNone. - trim_
line - Strip a line’s trailing
\r(and\n) and check it againstmax_bytes: the rule for peers that may send CRLF and whose limit excludes the line ending.Nonemeans too large.