/** * Inbound event dedupe (spec §7.1.4): chat platforms and the broker are both * at-least-once, so every ingress event id is checked against a TTL store * before any work detaches. */ /** Seen-key store consulted once per inbound event; hosts may inject their own. */ export interface DedupeStore { /** Returns true if key was already seen inside the TTL; records it otherwise. Atomic. */ seen(key: string): boolean; } /** Options for {@link TtlDedupeStore}. */ export type TtlDedupeStoreOptions = { /** How long a key counts as seen. Default 600 000 (10 min). */ ttlMs?: number; /** Clock override for tests. Default `Date.now`. */ now?: () => number; }; /** * In-memory {@link DedupeStore} with per-key TTL expiry. * * A hit does NOT refresh the key's expiry — only a miss records. Expired * entries are swept opportunistically; because keys are deleted before being * re-recorded, map insertion order stays expiry order and the sweep stops at * the first live entry (amortized O(1) per call). */ export declare class TtlDedupeStore implements DedupeStore { private readonly ttlMs; private readonly now; /** key → expiry timestamp (ms); insertion order == expiry order. */ private readonly entries; constructor(opts?: TtlDedupeStoreOptions); seen(key: string): boolean; private sweep; } /** Options for {@link TtlCache}. */ export type TtlCacheOptions = { /** How long an entry stays retrievable after its last `set`. */ ttlMs: number; /** Hard size backstop — oldest entries evict first once exceeded. */ maxEntries: number; /** Clock override for tests. Default `Date.now`. */ now?: () => number; }; /** * Expiring, size-bounded string-keyed value cache — backs the engine's * egress-ref / reply-ref / delivered-content registries. Same sweep * discipline as {@link TtlDedupeStore}: delete-before-set keeps map insertion * order equal to expiry order, so every call physically prunes expired * entries from the front in amortized O(1). */ export declare class TtlCache { private readonly ttlMs; private readonly maxEntries; private readonly now; /** key → value + expiry timestamp (ms); insertion order == expiry order. */ private readonly entries; constructor(opts: TtlCacheOptions); /** Records `value` under `key`, refreshing its TTL; evicts oldest past `maxEntries`. */ set(key: string, value: V): void; /** The live value under `key`, or undefined when absent or expired. */ get(key: string): V | undefined; has(key: string): boolean; /** Physical entry count (post-sweep entries only shrink via set/get/has calls). */ get size(): number; private sweep; } //# sourceMappingURL=dedupe.d.ts.map