pub struct ScriptedAcpAgent { /* private fields */ }Expand description
In-memory scripted acp agent 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 ScriptedAcpAgent
impl ScriptedAcpAgent
Sourcepub fn new(session_id: impl Into<String>) -> Self
pub fn new(session_id: impl Into<String>) -> 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 with_prompt_output(
self,
prompt: impl Into<String>,
output: impl Into<String>,
) -> Self
pub fn with_prompt_output( self, prompt: impl Into<String>, output: impl Into<String>, ) -> Self
Returns this value with its prompt output setting replaced. The method follows builder-style data construction and does not execute external work.
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 request_file_read(
&mut self,
endpoint: &JsonRpcLineEndpoint,
session_id: impl Into<String>,
path: impl Into<String>,
) -> Result<JsonRpcId, AgentError>
pub fn request_file_read( &mut self, endpoint: &JsonRpcLineEndpoint, session_id: impl Into<String>, path: impl Into<String>, ) -> Result<JsonRpcId, AgentError>
Request file read. This appends the corresponding JSON-RPC frame to the in-memory test endpoint transcript.
Sourcepub fn request_terminal_create(
&mut self,
endpoint: &JsonRpcLineEndpoint,
session_id: impl Into<String>,
command: impl Into<String>,
) -> Result<JsonRpcId, AgentError>
pub fn request_terminal_create( &mut self, endpoint: &JsonRpcLineEndpoint, session_id: impl Into<String>, command: impl Into<String>, ) -> Result<JsonRpcId, AgentError>
Request terminal create. This appends the corresponding JSON-RPC frame to the in-memory test endpoint transcript.
Sourcepub fn request_permission(
&mut self,
endpoint: &JsonRpcLineEndpoint,
session_id: impl Into<String>,
tool_call_id: impl Into<String>,
) -> Result<JsonRpcId, AgentError>
pub fn request_permission( &mut self, endpoint: &JsonRpcLineEndpoint, session_id: impl Into<String>, tool_call_id: impl Into<String>, ) -> Result<JsonRpcId, AgentError>
Request permission. This appends the corresponding JSON-RPC frame to the in-memory test endpoint transcript.
Sourcepub fn response(
&self,
endpoint: &JsonRpcLineEndpoint,
) -> Result<JsonRpcResponse, AgentError>
pub fn response( &self, endpoint: &JsonRpcLineEndpoint, ) -> 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 cancelled_sessions(&self) -> BTreeSet<String>
pub fn cancelled_sessions(&self) -> BTreeSet<String>
Cancelled sessions. This reads the scripted ACP mock cancellation set without sending a frame.
Trait Implementations§
Source§impl Clone for ScriptedAcpAgent
impl Clone for ScriptedAcpAgent
Source§fn clone(&self) -> ScriptedAcpAgent
fn clone(&self) -> ScriptedAcpAgent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more