Skip to main content

OutboxStore

Struct OutboxStore 

Source
pub struct OutboxStore { /* private fields */ }

Implementations§

Source§

impl OutboxStore

Source

pub fn default_root() -> Result<PathBuf>

Source

pub fn open(root: impl Into<PathBuf>) -> Result<Self>

Source

pub fn open_existing_default() -> Option<Self>

Open at the default location only if it already exists — for read paths that must not create state as a side effect.

Source

pub fn root(&self) -> &Path

Source

pub fn stage( &self, tool: &str, kind: OutboxKind, args: Value, taint: Taint, session_id: Option<String>, workspace: Option<PathBuf>, ) -> Result<OutboxItem>

Stage a drafted call. No lock: the id is fresh, so there is no state to race on, and the agent loop must never wait on a review session.

Source

pub fn items(&self) -> Result<Vec<OutboxItem>>

Every item, oldest first.

Source

pub fn item(&self, id: &str) -> Result<OutboxItem>

Find one item by id or unique prefix. Ambiguity is an error rather than a guess, same as session and proposal lookup.

Source

pub fn item_exact(&self, id: &str) -> Result<Option<OutboxItem>>

One item by its exact store-minted id — a single file read, never a directory scan. For the hot paths (a button press on an event loop) that already hold the full id and must not pay items()’s read-and-parse of every draft ever staged. Prefix lookup stays OutboxStore::item’s business.

The id is validated by shape before it is joined onto the store root: ids arrive here from button payloads, and a value shaped like a path (../…) must be refused, not resolved. A hostile shape is an error; a missing item is Ok(None); a torn file is an error, so a caller that maps errors to “unreadable” keeps failing closed.

Source

pub fn update_args(&self, id: &str, args: Value) -> Result<OutboxItem>

Replace a pending item’s release arguments. args_before is untouched — it is the baseline the learning capture diffs against.

Source

pub fn resolve( &self, id: &str, status: &str, reason: Option<String>, ) -> Result<OutboxItem>

Resolve a pending item as sent or rejected, in place — the file is its own audit record, so nothing moves to an archive.

Source

pub fn record_error(&self, id: &str, error: &str) -> Result<()>

Record a failed release attempt. The item stays pending: the draft is still good, and the next send retries.

Source

pub fn lock(&self) -> Result<OutboxLock>

Writer lock for read-modify-write paths (edit, send, reject). Taken before reading the item acted on; never held across $EDITOR.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more