export class MemoryStore {
constructor() { this.items = []; this.scans = new Map(); }
cacheGet(k) { return this.scans.get(k) ?? null; }
cachePut(k, v) { this.scans.set(k, v); return true; }
head() { const r = this.items.at(-1); return r ? { seq: r.chain.seq, hash: r.integrity.hash } : null; }
append(r) { const h = this.head() || { seq: 0, hash: null }; if (r.chain.seq !== h.seq + 1 || (r.chain.prev_hash ?? null) !== (h.hash ?? null)) return false; this.items.push(r); return true; }
list() { return [...this.items]; }
}
agentgate-source: code mirror on Cloudflare Pages. All repos