Skip to main content

MemoryRunStateStore

@totemsdk/agent-policy


@totemsdk/agent-policy / MemoryRunStateStore

Class: MemoryRunStateStore

Implements​

Constructors​

Constructor​

new MemoryRunStateStore(options?): MemoryRunStateStore

Parameters​

options?​

MemoryRunStateStoreOptions

Returns​

MemoryRunStateStore

Methods​

abortStep()​

abortStep(reservationId, reason): Promise<void>

Parameters​

reservationId​

string

reason​

string

Returns​

Promise<void>

Implementation of​

RunStateStore.abortStep


checkNonce()​

checkNonce(runId, nonce): Promise<boolean>

Parameters​

runId​

string

nonce​

string

Returns​

Promise<boolean>

Implementation of​

RunStateStore.checkNonce


commitStep()​

commitStep(reservationId, receipt): Promise<void>

Parameters​

reservationId​

string

receipt​

RunStepReceipt

Returns​

Promise<void>

Implementation of​

RunStateStore.commitStep


createRun()​

createRun(snapshot): Promise<void>

Parameters​

snapshot​

RunStateSnapshot

Returns​

Promise<void>

Implementation of​

RunStateStore.createRun


getReceipt()​

getReceipt(reservationId): Promise<RunStepReceipt | undefined>

Parameters​

reservationId​

string

Returns​

Promise<RunStepReceipt | undefined>

Implementation of​

RunStateStore.getReceipt


getReservation()​

getReservation(reservationId): Promise<RunReservation | undefined>

Parameters​

reservationId​

string

Returns​

Promise<RunReservation | undefined>

Implementation of​

RunStateStore.getReservation


getRun()​

getRun(runId): Promise<RunStateSnapshot | undefined>

Parameters​

runId​

string

Returns​

Promise<RunStateSnapshot | undefined>

Implementation of​

RunStateStore.getRun


listStepReceipts()​

listStepReceipts(runId): Promise<RunStepReceipt[]>

Parameters​

runId​

string

Returns​

Promise<RunStepReceipt[]>

Implementation of​

RunStateStore.listStepReceipts


reconcileReservation()​

reconcileReservation(reservationId, outcome, opts?): Promise<void>

Settle a recovered (unknown) reservation. The ONLY way an unsettled reservation releases its budget is an explicit 'definitely-not-executed' reconciliation; 'completed' commits it and folds the receipt into the run totals.

Parameters​

reservationId​

string

outcome​

ReservationSettlementOutcome

opts?​
reason?​

string

receipt?​

RunStepReceipt

Returns​

Promise<void>

Implementation of​

RunStateStore.reconcileReservation


recoverReservations()​

recoverReservations(runId?): Promise<OutOfBandReservation[]>

Conservative reservation recovery (RFC-007 §3.5): a reservation that was never settled before its deadline is classified unknown — its budget is HELD, never restored by expiry. Returns every unsettled reservation.

Parameters​

runId?​

string

Returns​

Promise<OutOfBandReservation[]>

Implementation of​

RunStateStore.recoverReservations


reserveStep()​

reserveStep(reservation): Promise<void>

Parameters​

reservation​

RunReservation

Returns​

Promise<void>

Implementation of​

RunStateStore.reserveStep