pub struct Pending {
pub id: i64,
pub run_id: i64,
pub step: u32,
pub act: String,
pub target: String,
pub content: Option<String>,
pub resolved: Option<String>,
}Expand description
An action paused awaiting a human decision, persisted so it outlives the process that requested it.
use io_harness::Store;
let store = Store::memory()?;
let run_id = store.start_run("update the deploy config", "deploy/prod.yaml")?;
// The agent asked to write a production file, the policy said `Ask`, and the
// approver deferred. The payload is stored with it, because resuming has to
// replay exactly what was approved and not whatever the model would say now.
let request_id = store.put_pending(run_id, 2, "write", "deploy/prod.yaml", Some("replicas: 4"))?;
// This process may now exit. A reviewer — a web UI, a CLI, a person the next
// morning — reads the request back and decides.
let pending = store.pending(request_id)?.expect("just written");
assert_eq!((pending.act.as_str(), pending.target.as_str()), ("write", "deploy/prod.yaml"));
assert_eq!(pending.content.as_deref(), Some("replicas: 4"));
assert!(pending.resolved.is_none(), "nobody has decided yet");
store.resolve_pending(request_id, "approve")?;
assert_eq!(store.pending(request_id)?.unwrap().resolved.as_deref(), Some("approve"));
// `resume_with_decision` then continues the run from here.Fields§
§id: i64The request id, as returned by Store::put_pending.
run_id: i64The run this action belongs to.
step: u32The step it paused on.
act: String"read", "write", or "exec".
target: StringThe target path or binary.
content: Option<String>The write payload, needed to replay exactly what was approved.
resolved: Option<String>None while pending; otherwise "approve" or "deny".
Trait Implementations§
impl Eq for Pending
impl StructuralPartialEq for Pending
Auto Trait Implementations§
impl Freeze for Pending
impl RefUnwindSafe for Pending
impl Send for Pending
impl Sync for Pending
impl Unpin for Pending
impl UnsafeUnpin for Pending
impl UnwindSafe for Pending
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.