pub struct RawRequest {
pub id: String,
pub command: String,
pub lsp_hints: Option<Value>,
pub session_id: Option<String>,
pub params: Value,
}Expand description
Inbound request envelope.
Two-stage parse: deserialize this first to get id + command, then
dispatch on command and pull specific params from the flattened params.
Fields§
§id: StringUnique while pending on one standalone connection, across all sessions. Reusing an ID is allowed after the earlier response has completed.
command: String§lsp_hints: Option<Value>Optional LSP hints from the plugin (R031 forward compatibility).
session_id: Option<String>Optional session namespace for undo/checkpoint isolation.
When the plugin passes session_id, Rust partitions backup/checkpoint
state by it so concurrent OpenCode sessions sharing one bridge can’t
see or restore each other’s snapshots. When absent, falls back to
DEFAULT_SESSION_ID.
params: ValueAll remaining fields are captured here for per-command deserialization.
Implementations§
Source§impl RawRequest
impl RawRequest
Sourcepub fn session(&self) -> &str
pub fn session(&self) -> &str
Session namespace for this request, falling back to DEFAULT_SESSION_ID
when the plugin didn’t supply one.
Sourcepub fn worker_session(&self) -> bool
pub fn worker_session(&self) -> bool
Whether the caller is a delegated worker (subagent) session rather than a primary one.
The plugins attach worker_session: true to every request from a
worker, next to session_id; it is absent (false) for a primary
session and for any caller that predates it. A worker cannot be woken
once its turn ends, so the text it is shown must never promise a later
reminder or tell it to end its turn. The field normally sits at the top
level; it is also read from a nested params object, the shape some
in-process requests are built in.
Sourcepub fn host_tool_names(&self) -> HostToolNames
pub fn host_tool_names(&self) -> HostToolNames
The names the caller’s host registered AFT’s command and patch tools
under (see crate::host_tool_names), for reply text that tells the
agent which tool to call. Read from the host_tool_names envelope field,
at the top level or in a nested params object like
RawRequest::worker_session. Absent, or not a valid map, gives the
default names: the field only changes how text is worded, so a bad value
is logged and never fails the request.
Sourcepub fn sent_host_tool_names(&self) -> Option<HostToolNames>
pub fn sent_host_tool_names(&self) -> Option<HostToolNames>
The names from the host_tool_names envelope field, or None when the
request has no usable field. Lets a caller forward the names onward
only when the request carried them.
Trait Implementations§
Source§impl Clone for RawRequest
impl Clone for RawRequest
Source§impl Debug for RawRequest
impl Debug for RawRequest
Source§impl<'de> Deserialize<'de> for RawRequest
impl<'de> Deserialize<'de> for RawRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Forget for RawRequest
impl Freeze for RawRequest
impl Move for RawRequest
impl RefUnwindSafe for RawRequest
impl Send for RawRequest
impl Sync for RawRequest
impl Unpin for RawRequest
impl UnsafeUnpin for RawRequest
impl UnwindSafe for RawRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more