pub struct Grant {
pub plugin_id: String,
pub session_id: String,
pub run_id: String,
pub max_cost_usd: Option<f64>,
/* private fields */
}Expand description
An ephemeral allowlist and deadline, never persisted. Public identity fields are host bookkeeping, not values the plugin may update via subsequent replies.
Fields§
§plugin_id: String§session_id: String§run_id: String§max_cost_usd: Option<f64>(E-P0, §5 decision 3) Plugin-proposed per-run USD cap. The effective
cap is min(this, config) — enforced by P7.
Implementations§
Source§impl Grant
impl Grant
Sourcepub fn from_start(
plugin_id: &str,
session_id: &str,
reply: Reply,
) -> Result<(Grant, Proposal), String>
pub fn from_start( plugin_id: &str, session_id: &str, reply: Reply, ) -> Result<(Grant, Proposal), String>
The caller MUST establish explicit user intent and permission first.
Sourcepub fn apply_context_mode(
&self,
runtime: &Runtime,
) -> Result<Option<String>, String>
pub fn apply_context_mode( &self, runtime: &Runtime, ) -> Result<Option<String>, String>
Apply only after the frontend accepted an explicit start and all grant checks passed. Uses exactly the ordinary /context command’s validation, not a raw config mutation or permission/recall bypass.
pub fn feedback_enabled(&self) -> bool
pub fn time_checkpoints_enabled(&self) -> bool
pub fn expired(&self) -> bool
pub fn deadline(&self) -> Option<Instant>
pub fn models(&self) -> &[Selection]
Sourcepub fn effective_cost_cap(&self, host_cap: Option<f64>) -> Option<f64>
pub fn effective_cost_cap(&self, host_cap: Option<f64>) -> Option<f64>
(E-P7, §S3 decision 3) The effective per-run cost ceiling: the lower of
the plugin-proposed max_cost_usd and a host-imposed cap. The plugin may
only lower, never raise, the host limit. None on either side means “no
limit from that side”; the result is None only when both are absent.
pub fn accept(&self, reply: Reply) -> Result<Option<Proposal>, String>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Grant
impl RefUnwindSafe for Grant
impl Send for Grant
impl Sync for Grant
impl Unpin for Grant
impl UnsafeUnpin for Grant
impl UnwindSafe for Grant
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> 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