pub struct Runtime { /* private fields */ }Implementations§
Source§impl Runtime
impl Runtime
Sourcepub async fn command_exec(
&self,
p: CommandExecParams,
) -> Result<CommandExecResponse, RpcError>
pub async fn command_exec( &self, p: CommandExecParams, ) -> Result<CommandExecResponse, RpcError>
Run one standalone command in the app-server sandbox. Allocation: JSON params + decoded response payload. Complexity: O(n), n = argv/env size + buffered output size.
Sourcepub async fn command_exec_write(
&self,
p: CommandExecWriteParams,
) -> Result<CommandExecWriteResponse, RpcError>
pub async fn command_exec_write( &self, p: CommandExecWriteParams, ) -> Result<CommandExecWriteResponse, RpcError>
Write stdin bytes to a running standalone command or close stdin. Allocation: serialized params + empty response object. Complexity: O(n), n = payload size.
Sourcepub async fn command_exec_resize(
&self,
p: CommandExecResizeParams,
) -> Result<CommandExecResizeResponse, RpcError>
pub async fn command_exec_resize( &self, p: CommandExecResizeParams, ) -> Result<CommandExecResizeResponse, RpcError>
Resize one PTY-backed standalone command by client process id. Allocation: serialized params + empty response object. Complexity: O(1).
Sourcepub async fn command_exec_terminate(
&self,
p: CommandExecTerminateParams,
) -> Result<CommandExecTerminateResponse, RpcError>
pub async fn command_exec_terminate( &self, p: CommandExecTerminateParams, ) -> Result<CommandExecTerminateResponse, RpcError>
Terminate one standalone command by client process id. Allocation: serialized params + empty response object. Complexity: O(1).
Source§impl Runtime
impl Runtime
Sourcepub async fn run_prompt_simple(
&self,
cwd: impl Into<String>,
prompt: impl Into<String>,
) -> Result<PromptRunResult, PromptRunError>
pub async fn run_prompt_simple( &self, cwd: impl Into<String>, prompt: impl Into<String>, ) -> Result<PromptRunResult, PromptRunError>
Run one prompt with safe default policies using only cwd + prompt.
Side effects: same as run_prompt. Allocation: params object + two Strings.
Complexity: O(n), n = input string lengths + streamed turn output size.
Sourcepub async fn run_prompt(
&self,
p: PromptRunParams,
) -> Result<PromptRunResult, PromptRunError>
pub async fn run_prompt( &self, p: PromptRunParams, ) -> Result<PromptRunResult, PromptRunError>
Run one prompt end-to-end and return the final assistant text. Side effects: sends thread/turn RPC calls and consumes live event stream. Allocation: O(n), n = prompt length + attachment count + streamed text.
Sourcepub async fn run_prompt_in_thread(
&self,
thread_id: &str,
p: PromptRunParams,
) -> Result<PromptRunResult, PromptRunError>
pub async fn run_prompt_in_thread( &self, thread_id: &str, p: PromptRunParams, ) -> Result<PromptRunResult, PromptRunError>
Continue an existing thread with one additional prompt turn. Side effects: sends thread/resume + turn/start RPC calls and consumes live event stream. Allocation: O(n), n = prompt length + attachment count + streamed text.
Source§impl Runtime
impl Runtime
pub async fn thread_start( &self, p: ThreadStartParams, ) -> Result<ThreadHandle, RpcError>
pub async fn thread_resume( &self, thread_id: &str, p: ThreadStartParams, ) -> Result<ThreadHandle, RpcError>
pub async fn thread_fork( &self, thread_id: &str, ) -> Result<ThreadHandle, RpcError>
Sourcepub async fn thread_archive(&self, thread_id: &str) -> Result<(), RpcError>
pub async fn thread_archive(&self, thread_id: &str) -> Result<(), RpcError>
Archive a thread (logical close on server side). Allocation: one JSON object with thread id. Complexity: O(1).
Sourcepub async fn thread_read(
&self,
p: ThreadReadParams,
) -> Result<ThreadReadResponse, RpcError>
pub async fn thread_read( &self, p: ThreadReadParams, ) -> Result<ThreadReadResponse, RpcError>
Read one thread by id. Allocation: serialized params + decoded response object. Complexity: O(n), n = thread payload size.
Sourcepub async fn thread_list(
&self,
p: ThreadListParams,
) -> Result<ThreadListResponse, RpcError>
pub async fn thread_list( &self, p: ThreadListParams, ) -> Result<ThreadListResponse, RpcError>
List persisted threads with optional filters and pagination. Allocation: serialized params + decoded list payload. Complexity: O(n), n = number of returned threads.
Sourcepub async fn thread_loaded_list(
&self,
p: ThreadLoadedListParams,
) -> Result<ThreadLoadedListResponse, RpcError>
pub async fn thread_loaded_list( &self, p: ThreadLoadedListParams, ) -> Result<ThreadLoadedListResponse, RpcError>
List currently loaded thread ids from in-memory sessions. Allocation: serialized params + decoded list payload. Complexity: O(n), n = number of returned ids.
Sourcepub async fn skills_list(
&self,
p: SkillsListParams,
) -> Result<SkillsListResponse, RpcError>
pub async fn skills_list( &self, p: SkillsListParams, ) -> Result<SkillsListResponse, RpcError>
List skills for one or more working directories. Allocation: serialized params + decoded inventory payload. Complexity: O(n), n = number of returned cwd entries + skill metadata size.
Sourcepub async fn thread_rollback(
&self,
p: ThreadRollbackParams,
) -> Result<ThreadRollbackResponse, RpcError>
pub async fn thread_rollback( &self, p: ThreadRollbackParams, ) -> Result<ThreadRollbackResponse, RpcError>
Roll back the last num_turns turns from a thread.
Allocation: serialized params + decoded response payload.
Complexity: O(n), n = rolled thread payload size.
Source§impl Runtime
impl Runtime
pub async fn take_server_request_rx( &self, ) -> Result<Receiver<ServerRequest>, RuntimeError>
pub async fn respond_approval_ok( &self, approval_id: &str, result: Value, ) -> Result<(), RuntimeError>
pub async fn respond_approval_err( &self, approval_id: &str, err: RpcErrorObject, ) -> Result<(), RuntimeError>
Source§impl Runtime
impl Runtime
pub async fn call_raw( &self, method: &str, params: Value, ) -> Result<Value, RpcError>
Sourcepub async fn call_validated(
&self,
method: &str,
params: Value,
) -> Result<Value, RpcError>
pub async fn call_validated( &self, method: &str, params: Value, ) -> Result<Value, RpcError>
JSON-RPC call with contract validation for known methods. Validation covers request params before send and result shape after receive.
Sourcepub async fn call_validated_with_mode(
&self,
method: &str,
params: Value,
mode: RpcValidationMode,
) -> Result<Value, RpcError>
pub async fn call_validated_with_mode( &self, method: &str, params: Value, mode: RpcValidationMode, ) -> Result<Value, RpcError>
JSON-RPC call with explicit validation mode.
Sourcepub async fn call_typed_validated<P, R>(
&self,
method: &str,
params: P,
) -> Result<R, RpcError>where
P: Serialize,
R: DeserializeOwned,
pub async fn call_typed_validated<P, R>(
&self,
method: &str,
params: P,
) -> Result<R, RpcError>where
P: Serialize,
R: DeserializeOwned,
Typed JSON-RPC call with known-method contract validation.
Sourcepub async fn call_typed_validated_with_mode<P, R>(
&self,
method: &str,
params: P,
mode: RpcValidationMode,
) -> Result<R, RpcError>where
P: Serialize,
R: DeserializeOwned,
pub async fn call_typed_validated_with_mode<P, R>(
&self,
method: &str,
params: P,
mode: RpcValidationMode,
) -> Result<R, RpcError>where
P: Serialize,
R: DeserializeOwned,
Typed JSON-RPC call with explicit validation mode.
pub async fn notify_raw( &self, method: &str, params: Value, ) -> Result<(), RuntimeError>
Sourcepub async fn notify_validated(
&self,
method: &str,
params: Value,
) -> Result<(), RuntimeError>
pub async fn notify_validated( &self, method: &str, params: Value, ) -> Result<(), RuntimeError>
JSON-RPC notify with known-method request validation.
Sourcepub async fn notify_validated_with_mode(
&self,
method: &str,
params: Value,
mode: RpcValidationMode,
) -> Result<(), RuntimeError>
pub async fn notify_validated_with_mode( &self, method: &str, params: Value, mode: RpcValidationMode, ) -> Result<(), RuntimeError>
JSON-RPC notify with explicit validation mode.
Sourcepub async fn notify_typed_validated<P>(
&self,
method: &str,
params: P,
) -> Result<(), RuntimeError>where
P: Serialize,
pub async fn notify_typed_validated<P>(
&self,
method: &str,
params: P,
) -> Result<(), RuntimeError>where
P: Serialize,
Typed JSON-RPC notify with known-method request validation.
Sourcepub async fn notify_typed_validated_with_mode<P>(
&self,
method: &str,
params: P,
mode: RpcValidationMode,
) -> Result<(), RuntimeError>where
P: Serialize,
pub async fn notify_typed_validated_with_mode<P>(
&self,
method: &str,
params: P,
mode: RpcValidationMode,
) -> Result<(), RuntimeError>where
P: Serialize,
Typed JSON-RPC notify with explicit validation mode.
Source§impl Runtime
impl Runtime
pub async fn spawn_local(cfg: RuntimeConfig) -> Result<Self, RuntimeError>
pub fn subscribe_live(&self) -> Receiver<Envelope>
pub fn is_initialized(&self) -> bool
pub fn state_snapshot(&self) -> Arc<RuntimeState>
pub fn initialize_result_snapshot(&self) -> Option<Value>
pub fn server_user_agent(&self) -> Option<String>
pub fn metrics_snapshot(&self) -> RuntimeMetricsSnapshot
Sourcepub fn hook_report_snapshot(&self) -> HookReport
pub fn hook_report_snapshot(&self) -> HookReport
Return latest hook report snapshot (last completed hook-enabled call wins). Allocation: clones report payload. Complexity: O(i), i = issue count.
Sourcepub fn register_hooks(&self, hooks: RuntimeHookConfig)
pub fn register_hooks(&self, hooks: RuntimeHookConfig)
Register additional lifecycle hooks into running runtime. Duplicate hook names are ignored. Allocation: O(n) for dedup snapshot. Complexity: O(n + m), n=existing, m=incoming.