Skip to main content

Runtime

Struct Runtime 

Source
pub struct Runtime { /* private fields */ }

Implementations§

Source§

impl Runtime

Source

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.

Source

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.

Source

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).

Source

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

Source

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.

Source

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.

Source

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

Source

pub async fn thread_start( &self, p: ThreadStartParams, ) -> Result<ThreadHandle, RpcError>

Source

pub async fn thread_resume( &self, thread_id: &str, p: ThreadStartParams, ) -> Result<ThreadHandle, RpcError>

Source

pub async fn thread_fork( &self, thread_id: &str, ) -> Result<ThreadHandle, RpcError>

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

pub async fn turn_interrupt( &self, thread_id: &str, turn_id: &str, ) -> Result<(), RpcError>

Interrupt one in-flight turn for a thread. Allocation: one JSON object with thread + turn id. Complexity: O(1).

Source

pub async fn turn_interrupt_with_timeout( &self, thread_id: &str, turn_id: &str, timeout_duration: Duration, ) -> Result<(), RpcError>

Interrupt one in-flight turn with explicit RPC timeout. Allocation: one JSON object with thread + turn id. Complexity: O(1).

Source§

impl Runtime

Source

pub async fn take_server_request_rx( &self, ) -> Result<Receiver<ServerRequest>, RuntimeError>

Source

pub async fn respond_approval_ok( &self, approval_id: &str, result: Value, ) -> Result<(), RuntimeError>

Source

pub async fn respond_approval_err( &self, approval_id: &str, err: RpcErrorObject, ) -> Result<(), RuntimeError>

Source§

impl Runtime

Source

pub async fn call_raw( &self, method: &str, params: Value, ) -> Result<Value, RpcError>

Source

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.

Source

pub async fn call_validated_with_mode( &self, method: &str, params: Value, mode: RpcValidationMode, ) -> Result<Value, RpcError>

JSON-RPC call with explicit validation mode.

Source

pub async fn call_typed_validated<P, R>( &self, method: &str, params: P, ) -> Result<R, RpcError>

Typed JSON-RPC call with known-method contract validation.

Source

pub async fn call_typed_validated_with_mode<P, R>( &self, method: &str, params: P, mode: RpcValidationMode, ) -> Result<R, RpcError>

Typed JSON-RPC call with explicit validation mode.

Source

pub async fn notify_raw( &self, method: &str, params: Value, ) -> Result<(), RuntimeError>

Source

pub async fn notify_validated( &self, method: &str, params: Value, ) -> Result<(), RuntimeError>

JSON-RPC notify with known-method request validation.

Source

pub async fn notify_validated_with_mode( &self, method: &str, params: Value, mode: RpcValidationMode, ) -> Result<(), RuntimeError>

JSON-RPC notify with explicit validation mode.

Source

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.

Source

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

Source

pub async fn spawn_local(cfg: RuntimeConfig) -> Result<Self, RuntimeError>

Source

pub fn subscribe_live(&self) -> Receiver<Envelope>

Source

pub fn is_initialized(&self) -> bool

Source

pub fn state_snapshot(&self) -> Arc<RuntimeState>

Source

pub fn initialize_result_snapshot(&self) -> Option<Value>

Source

pub fn server_user_agent(&self) -> Option<String>

Source

pub fn metrics_snapshot(&self) -> RuntimeMetricsSnapshot

Source

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.

Source

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.

Source

pub async fn shutdown(&self) -> Result<(), RuntimeError>

Trait Implementations§

Source§

impl Clone for Runtime

Source§

fn clone(&self) -> Runtime

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more