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<'_>
impl ToolCallPermit<'_>
Sourcepub fn intent(&self) -> Option<&Emitted>
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).
Sourcepub fn seq(&self) -> SequenceNumber
pub fn seq(&self) -> SequenceNumber
The position of the intent this call correlates to.
Sourcepub fn idempotency_key(&self) -> Option<&str>
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.
Sourcepub fn record(self, output: Value) -> Emitted
pub fn record(self, output: Value) -> Emitted
Records the tool’s output, returning the completion event to persist.
Sourcepub fn record_deduplicated(self, output: Value, origin: DedupOrigin) -> Emitted
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.