Skip to main content

ToolCallPermit

Struct ToolCallPermit 

Source
pub struct ToolCallPermit<'c> { /* private fields */ }
Expand description

Live permission to execute a tool call.

Persist ToolCallPermit::intent (when present) before executing: for Effect::Write tools that ordering is the whole reconciliation story. Then execute and redeem with the output.

Implementations§

Source§

impl ToolCallPermit<'_>

Source

pub fn intent(&self) -> Option<&Emitted>

The intent event to persist before executing, or None when the intent is already in the log (a read or idempotent call being re-executed after a crash).

Source

pub fn seq(&self) -> SequenceNumber

The position of the intent this call correlates to.

Source

pub fn effect(&self) -> Effect

The effect class of the call being executed.

Source

pub fn idempotency_key(&self) -> Option<&str>

The idempotency key to execute under. For a re-executed idempotent call this is the recorded key, surfaced so the retry collapses into the original attempt at the provider.

Source

pub fn record(self, output: Value) -> Emitted

Records the tool’s output, returning the completion event to persist.

Source

pub fn record_deduplicated(self, output: Value, origin: DedupOrigin) -> Emitted

Records a completion that copied its output from an equal call already committed elsewhere, naming that call as the origin.

The caller redeems the permit this way instead of record when it decided, live and before executing, that this call is a duplicate: nothing ran, and output is the origin’s recorded output. The recorded DedupOrigin is what keeps the log honest about which of two equal completions witnessed the effect.

This cursor makes no such decision and cannot: it sees one run’s log and deduplication is a fact about the whole store. The decision belongs to the IO edge (salvor-runtime), and the origin arrives here already determined. Replay of the resulting log never consults the origin.

Trait Implementations§

Source§

impl<'c> Debug for ToolCallPermit<'c>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'c> !UnwindSafe for ToolCallPermit<'c>

§

impl<'c> Freeze for ToolCallPermit<'c>

§

impl<'c> RefUnwindSafe for ToolCallPermit<'c>

§

impl<'c> Send for ToolCallPermit<'c>

§

impl<'c> Sync for ToolCallPermit<'c>

§

impl<'c> Unpin for ToolCallPermit<'c>

§

impl<'c> UnsafeUnpin for ToolCallPermit<'c>

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.