pub enum Policy {
SafetyHandoff {
intents: Vec<String>,
},
Redact {
keys: Vec<String>,
},
Commit {
tool: String,
idempotency_key: Option<String>,
compensate_with: Option<String>,
},
}Expand description
A reusable, cross-cutting policy aspect.
Variants§
SafetyHandoff
Hand off (terminate the conversation) when any of these intents is
detected (the intent:{name} flag becomes true). Lowered to a safety
digression with Resume::Terminate.
Redact
Redact these state keys wherever state leaves the process: the durable
journal sink, persistence snapshots and extraction events carry
[redacted] instead (see State::redact_keys). In-process reads see
the real value. Pairs with #[slot(pii)]. Transcript text is a
separate concern: see Live::redaction.
Commit
Commit-tool governance for a confirm-before-act tool, enforced at
connect by a CommitGuard: a call whose idempotency key already
succeeded returns the first result without running again, and a failed
call runs the compensating tool with the same arguments.
Implementations§
Source§impl Policy
impl Policy
Sourcepub fn safety_handoff<I, S>(intents: I) -> Self
pub fn safety_handoff<I, S>(intents: I) -> Self
Terminate/hand off when any of intents is detected.
Sourcepub fn commit(tool: impl Into<String>) -> CommitPolicy
pub fn commit(tool: impl Into<String>) -> CommitPolicy
Begin a commit-governance policy for tool.
Sourcepub fn redacted_keys(&self) -> &[String]
pub fn redacted_keys(&self) -> &[String]
The state keys this policy marks for redaction (empty for non-redact).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Policy
impl<'de> Deserialize<'de> for Policy
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>,
Source§impl From<CommitPolicy> for Policy
impl From<CommitPolicy> for Policy
Source§fn from(c: CommitPolicy) -> Self
fn from(c: CommitPolicy) -> Self
Source§impl JsonSchema for Policy
impl JsonSchema for Policy
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for Policy
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnwindSafe for Policy
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].