Skip to main content

Crate scv_protocol

Crate scv_protocol 

Source
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 _.
ComponentHealth
The health of one channel account.
ConfirmInfo
A yes/no question to the owner in chat (scv confirm).
DaemonStatus
What scv status shows: the daemon, its components, and its delegations.
DelegationInfo
One running delegated agent.
DelegationSummary
Delegated agent runs of the daemon’s SCV instance.
FrameDecoder
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.
PeerInfo
A client’s or server’s name and version, exchanged at initialize.
QueueEntry
A prompt waiting for the running turn to finish.
ReplyAttachment
A file the model attached to its reply with CHAT_ATTACH_TOOL, as the tool’s successful tool.completed output reports it.
RestartInfo
A restart into a newly installed release, waiting for owner work to end.
Step
How much of a buffer FrameDecoder::feed used, and what it completed.
TurnOrigin
Why the server started a turn on its own.
Usage
Tokens a turn used, as the provider reported them.

Enums§

ClientMessage
A message from client to server. Serialized as one JSON object per line, tagged by type (such as turn.start).
ComponentState
Where a daemon component (a channel account) is in its lifecycle.
ConfirmState
Where a question to the owner stands.
DaemonCommand
What a daemon.control message asks the daemon to do.
ErrorCode
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.
OriginKind
What a server-started turn is for.
Overflow
What a decoder does with a line longer than its limit.
RemoteTools
Who may use tools through a remote bridge account.
Senders
Whose messages a remote bridge account answers.
ServerEvent
A message from server to client. Serialized as one JSON object per line, tagged by type (such as turn.completed). Turn events carry the session’s consecutive seq.
ToolErrorKind
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.start channel 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.start may attach.
PROTOCOL_VERSION
The protocol version. Client and server must speak the same one.

Functions§

encode_frame
Encode message as one frame: its JSON and a \n.
job_agent
The agent a background job runs, such as codex: agent when it is set, otherwise what follows agent_ in the delegating tool, as SCV 0.3.0 and older named it (agent_codex), otherwise tool itself.
reply_attachment
The attachment a successful CHAT_ATTACH_TOOL call reports: its output is {"attached": {...}, ...}. Anything else is None.
trim_line
Strip a line’s trailing \r (and \n) and check it against max_bytes: the rule for peers that may send CRLF and whose limit excludes the line ending. None means too large.