pub struct ControlRequest {
pub ty: ControlRequestType,
pub request_id: String,
pub request: ControlRequestKind,
}Expand description
A control request emitted by the claude binary. The SDK must respond
with a matching ControlResponse carrying the same request_id.
Fields§
§ty: ControlRequestTypeFixed discriminant "control_request".
request_id: StringOpaque id correlating request to response.
request: ControlRequestKindThe request body.
Implementations§
Source§impl ControlRequest
impl ControlRequest
Sourcepub(crate) fn build_response(
&self,
behavior: AllowBehavior,
) -> Result<ControlResponse, Error>
pub(crate) fn build_response( &self, behavior: AllowBehavior, ) -> Result<ControlResponse, Error>
Helper: build a control_response envelope corresponding to this
request given an allow/deny behaviour.
§Errors
serde_json::Error if the decision can’t be serialised (practically
impossible for valid decisions).
Sourcepub(crate) fn original_tool_input(&self) -> Option<&Value>
pub(crate) fn original_tool_input(&self) -> Option<&Value>
For a CanUseTool request, return a reference to the original
input JSON. Used to echo the original input back in an allow
response when the callback supplied no override (the CLI always
populates updatedInput).
Trait Implementations§
Source§impl Clone for ControlRequest
impl Clone for ControlRequest
Source§impl Debug for ControlRequest
impl Debug for ControlRequest
Source§impl<'de> Deserialize<'de> for ControlRequest
impl<'de> Deserialize<'de> for ControlRequest
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ControlRequest
impl RefUnwindSafe for ControlRequest
impl Send for ControlRequest
impl Sync for ControlRequest
impl Unpin for ControlRequest
impl UnsafeUnpin for ControlRequest
impl UnwindSafe for ControlRequest
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
Mutably borrows from an owned value. Read more