pub struct ScriptedAcpClient { /* private fields */ }Expand description
In-memory scripted acp client fixture for SDK conformance tests. Use it to script deterministic behavior in memory; any transcript or endpoint mutation is documented on the method that performs it.
Implementations§
Source§impl ScriptedAcpClient
impl ScriptedAcpClient
Sourcepub fn new(endpoint: JsonRpcLineEndpoint) -> Self
pub fn new(endpoint: JsonRpcLineEndpoint) -> Self
Creates a new testing::protocol::acp value with explicit caller-provided inputs. This constructor is data-only and performs no I/O or external side effects.
Sourcepub fn endpoint(&self) -> &JsonRpcLineEndpoint
pub fn endpoint(&self) -> &JsonRpcLineEndpoint
Returns the endpoint currently held by this value. This reads scripted protocol state or a queued response without contacting an external process.
Sourcepub fn initialize(&mut self) -> Result<JsonRpcId, AgentError>
pub fn initialize(&mut self) -> Result<JsonRpcId, AgentError>
Initialize. This appends the corresponding JSON-RPC frame to the scripted ACP mock transcript and returns the request id when applicable.
Sourcepub fn new_session(
&mut self,
cwd: impl Into<String>,
) -> Result<JsonRpcId, AgentError>
pub fn new_session( &mut self, cwd: impl Into<String>, ) -> Result<JsonRpcId, AgentError>
Queues an ACP session/new request in the scripted client transcript.
This mutates only the in-memory JSON-RPC endpoint and returns the request id; no live ACP
server, journal, event bus, or process is contacted.
Sourcepub fn prompt(
&mut self,
session_id: impl Into<String>,
prompt: impl Into<String>,
) -> Result<JsonRpcId, AgentError>
pub fn prompt( &mut self, session_id: impl Into<String>, prompt: impl Into<String>, ) -> Result<JsonRpcId, AgentError>
Prompt. This appends the corresponding JSON-RPC frame to the in-memory test endpoint transcript.
Sourcepub fn cancel(&self, session_id: impl Into<String>) -> Result<(), AgentError>
pub fn cancel(&self, session_id: impl Into<String>) -> Result<(), AgentError>
Cancel. This appends the corresponding JSON-RPC frame to the scripted ACP mock transcript and returns the request id when applicable.
Sourcepub fn handle_next(
&mut self,
endpoint: &JsonRpcLineEndpoint,
) -> Result<bool, AgentError>
pub fn handle_next( &mut self, endpoint: &JsonRpcLineEndpoint, ) -> Result<bool, AgentError>
Handle next. This consumes one queued JSON-RPC frame from the in-memory endpoint and mutates only scripted mock state.
Sourcepub fn response(&self) -> Result<JsonRpcResponse, AgentError>
pub fn response(&self) -> Result<JsonRpcResponse, AgentError>
Returns the response currently held by this value. This reads scripted protocol state or a queued response without contacting an external process.
Sourcepub fn notification(&self) -> Result<JsonRpcNotification, AgentError>
pub fn notification(&self) -> Result<JsonRpcNotification, AgentError>
Returns notification for this testing::protocol::acp value without performing external I/O.
Trait Implementations§
Source§impl Clone for ScriptedAcpClient
impl Clone for ScriptedAcpClient
Source§fn clone(&self) -> ScriptedAcpClient
fn clone(&self) -> ScriptedAcpClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more