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§

AttachOffer
Whether the owner can take a conversation over in its agent’s own terminal now, as attach would answer it at this moment.
AttachPage
The screen of a conversation the owner took over in its agent’s own terminal, as attach and attach_io return it: the rows that changed since the client’s after, never the terminal’s raw output.
AttachRow
One row of a taken-over terminal’s screen.
AttachSpan
A run of cells of one row of a taken-over terminal, all in one style. Its text is display-only: printable characters, never an escape sequence, with values that look like credentials masked.
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.
JobOutcome
A reviewed job’s review outcome and landing status, which clients show as SCV’s own lines apart from the model’s summary.
JobReport
A finished background job’s result, as the server reports it: to the model in a report turn’s prompt, or to the client in ServerEvent::BackgroundReported when the model could not report it.
JobResult
A background job’s result, for a job_result request: where it stands and, once it has ended, its agent’s reply or error, bounded by MAX_JOB_RESULT_BYTES. The reply and error are untrusted delegated-agent text.
LandingSummary
What a reviewed job’s builder landed, and who backs that.
MailAction
One mail action, as scv mail status lists it: IDs, kinds, states, and times only, never a code, a handle, an address, or mail text.
MailCounts
An email account’s activity, as counts only.
OpenFinding
A blocking finding still open when the review ended.
PeerInfo
A client’s or server’s name and version, exchanged at initialize.
ProjectEvent
One durable event, exposed for audit and recovery inspection.
ProjectReport
A report generated from observed ledger state.
ProjectRun
A run tracked by the project ledger.
ProjectSummary
A compact project record suitable for status output.
ProjectTask
A project task and its dependency/progress evidence.
QueueEntry
A prompt waiting for the running turn to finish.
Refusal
What a reviewer that declined said.
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.
RestorableSession
A session whose queued prompts SCV kept when its process stopped (a restart or crash), which a new session can restore.
RestoredQueue
What session.start restored from a session that stopped.
ReviewSummary
How a reviewed job’s review ended.
RunEvent
One entry of a run’s activity log. Text is display-only: agent messages and short tool lines with credential-like values redacted, never tool output.
RunLogPage
Part of a run’s activity log, after a position.
Step
How much of a buffer FrameDecoder::feed used, and what it completed.
TriedReviewer
One reviewer agent a reviewed job tried.
TurnOrigin
Why the server started a turn on its own.
Usage
Tokens a turn used, as the provider reported them.
WorkbenchApproval
An approval request a background job relayed while the owner watches the workbench, waiting for the owner’s answer.
WorkbenchJob
One background job, from the instance’s job ledger and, while it runs, its live state.
WorkbenchRun
One delegated run (an agent process) and what it is doing.
WorkbenchSession
One SCV session the workbench knows: a live daemon session, the workbench’s own host for jobs the owner starts, or one that ended.
WorkbenchSnapshot
Everything the workbench shows, at one moment.
WorktreeInfo
A worktree SCV created, as scv agents worktrees lists it.
WorktreeRef
A git worktree SCV created for one job, so its agent works apart from the repository’s own checkout.

Enums§

AgentState
What a delegated run, a background job, or a session is doing, as far as SCV can tell. A state a client does not know parses as unknown, which also means SCV itself cannot tell.
AttachColor
A color of a cell of a taken-over terminal: one of the terminal’s 256 indexed colors, or a direct RGB color.
AttachState
Where a conversation stands for the owner’s takeover of it in its agent’s own terminal (attach).
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.
JobOrigin
Who started a background job.
JobStatus
Where a background job stands, with the strings the model reads in the job tools’ results.
LandMode
When a reviewed call allows its builder to land.
LandingEvidence
Who backs a landed status. SCV runs no git, so a landing is only ever the builder’s report or a reviewer’s check of it.
LandingStatus
Where a reviewed job’s landing stands.
OriginKind
What a server-started turn is for.
Overflow
What a decoder does with a line longer than its limit.
ProjectPhase
The lifecycle phase observed for a durable project.
ProjectResponse
Payload returned by a project command.
ProjectRunStatus
A delegated run’s observed state.
ProjectStatus
The reducer’s current project status.
ProjectTaskStatus
A task’s observed state.
Purpose
What a chat account carries.
RemoteTools
Who may use tools through a remote bridge account.
ReviewOutcome
How a reviewed job’s review ended.
ReviewerResult
How one reviewer attempt ended.
RunEventKind
What one line of a run’s activity log records.
SendMode
How workbench_send hands the owner’s prompt to a conversation that is running a turn.
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_JOB_RESULT_BYTES
The most bytes of a job’s reply, and of its error, a JobResult carries; a longer one is cut at a character boundary and flagged truncated. The ledger itself keeps up to 8 KiB of each.
MAX_SYSTEM_PROMPT_BYTES
Longest session.start system_prompt, in bytes.
MAX_TURN_ATTACHMENTS
Files one turn.start may attach.
PROTOCOL_VERSION
The protocol version. Client and server must speak the same one.

Functions§

describe_outcome
outcome as a report states it, without the job: always a Review line, then any open findings indented, then what each reviewer that declined said, quoted and attributed, then a Landing line.
describe_reports
reports as people and the model read them: for each job, a line naming it, its agent, conversation, and status, then its task, a reviewed job’s outcome lines (describe_outcome), and its reply.
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.
outcome_notice
outcome as a client shows it, in SCV’s words alone: the Review line, any open findings, and the Landing line, the two prefixed with the job, such as job-4 · Review: approved · round 2 of 3 · reviewer claude. Reviewers’ refusals are left to the report, which quotes them.
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.