WireServeServer class final

The protocol server for one agent session. Constructed by the host boot (AgentCli.runWireServe), fed engine events via handleAgentEvent, and driven by transports through attach.

Constructors

WireServeServer({required Future<void> runPrompt(String text), required void steer(String text), required void abort(), required bool isBusy(), AgentWireProtocol? protocol, void onLog(String line)?, RedactionPipeline? redactionPipeline})
Creates a server. The closures are the engine seams: runPrompt runs one user turn (redaction, settle, persistence are the CLI's business), steer/abort/isBusy mirror the live agent.

Properties

attached → bool
Whether a client is attached (handshake complete).
no setter
hashCode → int
The hash code for this object.
no setterinherited
pendingRequestIds → List<String>
Every pending request id, oldest first (diagnostics/tests).
no setter
redactionPipeline → RedactionPipeline?
Masks the stuck events' captured-output detail before a frame leaves for the attached client — tool_call_stuck frames land in external bridges, the same secret-bearing surface the session record's redaction targets (gh-1054 review round 2). Optional: hosts without a pipeline pass details through (test hosts).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

answerAsk(List<AskQuestion> questions) → Future<List<AskAnswer>?>
The ask tool's surface: emits ask_request, resolves with the client's answers; null = the client cancelled.
answerSecret(String name, String reason) → Future<RequestSecretResult?>
The request_secret tool's surface: emits secret_request, resolves with the granted result; null = the client declined.
approvalPrompt(ApprovalRequest request) → Future<ApprovalDecision>
The approval-gate surface: emits an approval_request frame and resolves when the client's approval_response echoes the id.
attach(Stream<Map<String, dynamic>> frames, WireFrameSink send) → Future<void>
Serves one client until it detaches (its frame stream ends or errors) or the server shuts down. A second simultaneous attach is rejected with already_attached before its handshake is read.
handleAgentEvent(AgentEvent event) → void
Forwards one engine event to the attached client as a wire frame. Without a client events are dropped — the session file is the replay surface, not the wire.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
protocolError(String code, String message, WireFrameSink send) → void
A transport-level decode failure (a malformed NDJSON line): the documented rule is a loud bad_frame error frame — the SAME code the core answers schema-invalid frames with — and the connection STAYS ALIVE; one bad line never kills the stream (review #1113 r2, BLOCKING #1). Valid pre-handshake too: the version is fixed at construction.
shutdown() → Future<void>
Resolves every pending request to its safe refusal, detaches the client, and refuses further attaches. Idempotent.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited