import { PreviewOwner } from './surfaceState'; export interface RunIdentityCache { /** * The owner this run was FIRST seen under. Subsequent calls return that same * owner however many times the caller re-reads, and whoever is signed in by * then — which is the entire point. */ ownerFor(runId: string): PreviewOwner; /** * The owner of a run that has already SETTLED — remembered if we pinned it * while it ran, otherwise the current owner — and RELEASED either way. * * ★★★ THIS EXISTS BECAUSE HOLDING SETTLED RUNS MADE EVICTION REACHABLE. * Terminal processing entries persist by design, and the bridge meets one for * every conversation the user opens, so storing them filled the map with * history. Releasing here is the other half: a settled run can never need its * identity again — the transitions mark it ended and consume every later tick * without emitting — so an entry that stays only crowds out a run that is * still live. With both, the map holds ONLY runs believed to be running, and * `DEFAULT_LIMIT` has to cover concurrent turns rather than session history. * * ★ A miss is not a failure: a settled entry we never saw running is either * history, which is consumed without emitting so the identity is never used, * or a synchronous failure that settled in this very tick — where the current * owner IS the run's owner, and reading it now is correct rather than the * self-agreeing guard it would be for a live run. */ ownerForSettled(runId: string): PreviewOwner; /** Test seam: how many runs are currently remembered. */ size(): number; } export declare function createRunIdentityCache(readOwner?: () => PreviewOwner, limit?: number, /** ★ Injected so expiry is testable without waiting four hours. */ now?: () => number, maxAgeMs?: number): RunIdentityCache; /** * The instance the bridge uses. * * ★ Module scope is deliberate and is what makes this survive a remount. It is * shared by every panel on the page, which is safe: run ids carry the * conversation id, so two panels on two conversations cannot collide, and two * panels on the SAME conversation are the same run and want the same answer. */ export declare const runIdentities: RunIdentityCache; //# sourceMappingURL=runIdentity.d.ts.map