MemoryReceiptStore
@totemsdk/agent-policy / MemoryReceiptStore
Class: MemoryReceiptStore
In-memory receipt store with optional JSON-file persistence.
Example
// In-memory only
const store = new MemoryReceiptStore();
// With file persistence
const store = new MemoryReceiptStore({ filePath: './data/receipts.jsonl' });
Implements
Constructors
Constructor
new MemoryReceiptStore(
opts?):MemoryReceiptStore
Parameters
opts?
filePath?
string
Returns
MemoryReceiptStore
Methods
count()
count():
Promise<number>
Total number of stored receipts.
Returns
Promise<number>
Implementation of
get()
get(
receiptId):Promise<AgentReceipt|null>
Retrieve a receipt by receiptId.
Parameters
receiptId
string
Returns
Promise<AgentReceipt | null>
Implementation of
list()
list(
limit?,offset?):Promise<AgentReceipt[]>
List all receipts, newest first.
Parameters
limit?
number = 50
offset?
number = 0
Returns
Promise<AgentReceipt[]>
Implementation of
save()
save(
receipt):Promise<string>
Persist a receipt. Returns a receiptId for retrieval.
Parameters
receipt
Returns
Promise<string>