MCPcopy Index your code
hub / github.com/BlockRunAI/ClawRouter / InMemorySpendControlStorage

Class InMemorySpendControlStorage

src/spend-control.ts:133–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133export class InMemorySpendControlStorage implements SpendControlStorage {
134 private data: { limits: SpendLimits; history: SpendRecord[] } | null = null;
135
136 load(): { limits: SpendLimits; history: SpendRecord[] } | null {
137 return this.data
138 ? {
139 limits: { ...this.data.limits },
140 history: this.data.history.map((r) => ({ ...r })),
141 }
142 : null;
143 }
144
145 save(data: { limits: SpendLimits; history: SpendRecord[] }): void {
146 this.data = {
147 limits: { ...data.limits },
148 history: data.history.map((r) => ({ ...r })),
149 };
150 }
151}
152
153export interface SpendControlOptions {
154 storage?: SpendControlStorage;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected