Skip to main content

IpcPayload

Enum IpcPayload 

Source
pub enum IpcPayload {
Show 19 variants RawJson(Value), UserInput { text: String, session_id: String, context: Option<Value>, }, AgentResponse { text: String, is_final: bool, session_id: String, }, ApprovalRequired { request_id: String, action: String, resource: String, reason: String, }, ApprovalResponse { request_id: String, decision: String, reason: Option<String>, }, OnboardingRequired { capsule_id: String, fields: Vec<OnboardingField>, }, LlmRequest { request_id: Uuid, model: String, messages: Vec<Message>, tools: Vec<LlmToolDefinition>, system: String, }, LlmStreamEvent { request_id: Uuid, event: StreamEvent, }, LlmResponse { request_id: Uuid, response: LlmResponse, }, ToolExecuteRequest { call_id: String, tool_name: String, arguments: Value, }, ToolExecuteResult { call_id: String, result: ToolCallResult, }, ToolCancelRequest { call_ids: Vec<String>, }, SelectionRequired { request_id: String, title: String, options: Vec<SelectionOption>, callback_topic: String, }, ElicitRequest { request_id: Uuid, capsule_id: String, field: OnboardingField, }, ElicitResponse { request_id: Uuid, value: Option<String>, values: Option<Vec<String>>, }, Connect, Disconnect { reason: Option<String>, }, Custom { data: Value, }, Unknown,
}
Expand description

Standardized cross-boundary payload schemas.

Variants§

§

RawJson(Value)

Raw, arbitrary JSON.

§

UserInput

User input provided via a frontend (CLI, Telegram).

Fields

§text: String

The raw text input.

§session_id: String

Session ID for conversation continuity. Defaults to "default".

§context: Option<Value>

Optional extra context.

§

AgentResponse

A response generated by an agent.

Fields

§text: String

The text output.

§is_final: bool

True if this is the final response in a chain.

§session_id: String

Session ID for multi-session attribution.

§

ApprovalRequired

An interceptor or capsule request for capability approval.

Fields

§request_id: String

Opaque correlation ID.

§action: String

The action being requested (e.g. “git push”).

§resource: String

The resource target (e.g. full command string).

§reason: String

Justification.

§

ApprovalResponse

Response to an ApprovalRequired.

Fields

§request_id: String

Must match the request_id from the originating request.

§decision: String

The user’s decision.

§reason: Option<String>

Optional reason for the decision.

§

OnboardingRequired

A capsule needs environment variables to be provided by the user.

Fields

§capsule_id: String

The ID of the capsule requiring onboarding.

§fields: Vec<OnboardingField>

Rich field descriptors for each missing env var.

§

LlmRequest

Request an LLM provider capsule to generate a response.

Fields

§request_id: Uuid

The unique ID of the request, used for routing the response stream back.

§model: String

The requested model name (e.g. “claude-3-5-sonnet”).

§messages: Vec<Message>

The conversation history.

§tools: Vec<LlmToolDefinition>

The tools available to the model.

§system: String

The system prompt.

§

LlmStreamEvent

A stream event from an LLM provider capsule.

Fields

§request_id: Uuid

The unique ID of the request this stream belongs to.

§event: StreamEvent

The actual stream event (TokenDelta, ToolCallStart, etc).

§

LlmResponse

The final, non-streaming LLM response.

Fields

§request_id: Uuid

The unique ID of the request this response belongs to.

§response: LlmResponse

The final response object.

§

ToolExecuteRequest

Request the Tool Router capsule to execute a tool.

Fields

§call_id: String

The unique ID of the tool call.

§tool_name: String

The name of the tool to execute.

§arguments: Value

The JSON arguments.

§

ToolExecuteResult

The result of a tool execution.

Fields

§call_id: String

The unique ID of the tool call.

§result: ToolCallResult

The result of the execution.

§

ToolCancelRequest

Request cancellation of in-flight tool executions.

Fields

§call_ids: Vec<String>

The call IDs of the tool invocations to cancel.

§

SelectionRequired

A capsule is requesting the user to select from a list of options.

Fields

§request_id: String

Opaque ID so the capsule can correlate the response.

§title: String

Title/prompt shown above the list.

§options: Vec<SelectionOption>

The selectable options.

§callback_topic: String

IPC topic to publish the user’s choice back on.

§

ElicitRequest

A lifecycle hook is requesting user input via the elicit API.

Fields

§request_id: Uuid

Correlation ID.

§capsule_id: String

The capsule requesting input.

§field: OnboardingField

Field descriptor reusing the onboarding schema.

§

ElicitResponse

Response to an ElicitRequest.

Fields

§request_id: Uuid

Must match the request_id from the originating request.

§value: Option<String>

The user’s input. None if the user cancelled.

§values: Option<Vec<String>>

For Array-type fields, the collected items.

§

Connect

A client has connected.

§

Disconnect

A client is disconnecting gracefully.

Fields

§reason: Option<String>

Optional reason for disconnection (e.g. “quit”, “timeout”).

§

Custom

Arbitrary JSON data for unstructured plugins.

Fields

§data: Value

Raw data.

§

Unknown

Unrecognized payload type from a newer protocol version.

Implementations§

Source§

impl IpcPayload

Source

pub fn is_known_tag(tag: &str) -> bool

Returns true if tag matches a known serde variant name.

Source

pub fn from_json_value(data: Value) -> Self

Deserialize a JSON Value into an IpcPayload, falling back to Custom for unrecognised or missing type tags.

Source

pub fn to_guest_bytes(&self) -> Result<Vec<u8>, Error>

Serialize only the guest-facing payload data.

Custom and RawJson payloads return the inner data value directly (no type wrapper). Structured variants return the full tagged serialization.

§Errors

Returns serde_json::Error if serialization fails.

Trait Implementations§

Source§

impl Clone for IpcPayload

Source§

fn clone(&self) -> IpcPayload

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for IpcPayload

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for IpcPayload

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for IpcPayload

Source§

fn eq(&self, other: &IpcPayload) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for IpcPayload

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for IpcPayload

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, 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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,