MCPcopy
hub / github.com/CopilotKit/CopilotKit / InMemoryActionStore

Class InMemoryActionStore

packages/bot/src/action-store.ts:15–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14/** @deprecated Configure `createBot({ state })` instead. Action snapshots are stored via `StateStore.kv`. */
15export class InMemoryActionStore implements ActionStore {
16 private map = new Map<string, { snap: ActionSnapshot; expiresAt?: number }>();
17 async put(id: string, snap: ActionSnapshot, ttlMs?: number): Promise<void> {
18 this.map.set(id, {
19 snap,
20 expiresAt: ttlMs ? Date.now() + ttlMs : undefined,
21 });
22 }
23 async get(id: string): Promise<ActionSnapshot | undefined> {
24 const e = this.map.get(id);
25 if (!e) return undefined;
26 if (e.expiresAt !== undefined && Date.now() > e.expiresAt) {
27 this.map.delete(id);
28 return undefined;
29 }
30 return e.snap;
31 }
32 async delete(id: string): Promise<void> {
33 this.map.delete(id);
34 }
35}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…