//#region src/integrations/identity.d.ts /** * Per-callback identity resolution shared by the framework integrations. * * Handlers are commonly created once and reused across requests, so identity * is never captured at construction. Each callback resolves, in order: * * 1. identity passed explicitly to the handler's constructor; * 2. the active SessionContext (`session.run()`, middleware, ...); * 3. the identity already resolved for the same run (or its parent run); * 4. a fresh anonymous identity for the run: random session ID and device ID, * no user ID — so unrelated callers are never merged under a constant ID. */ interface ExplicitIdentity { userId?: string | null; deviceId?: string | null; sessionId?: string | null; agentId?: string | null; parentAgentId?: string | null; env?: string | null; traceId?: string | null; } interface ResolvedIdentity { userId: string | undefined; deviceId: string | undefined; sessionId: string; agentId: string | undefined; parentAgentId: string | undefined; env: string | undefined; traceId: string | undefined; /** True only while the active session is inside `runAs` / `runAsSync`. */ skipAutoUserTracking: boolean; } /** * Resolve identity for one callback. `prior` is the identity already * resolved for this run, if any; it only fills fields that neither the * explicit options nor the active context provide. */ declare function resolveIdentity(explicit: ExplicitIdentity, prior?: ResolvedIdentity | null): ResolvedIdentity; /** * Tracks the identity resolved for each in-flight run so that the start and * end callbacks of a run (and child runs) agree, without letting one run's * identity leak into another. Bounded so abandoned runs cannot grow memory. */ declare class RunIdentities { private readonly _explicit; private readonly _runs; constructor(explicit: ExplicitIdentity); /** Resolve identity for a callback belonging to `runId`. */ resolve(runId?: string | null, parentRunId?: string | null): ResolvedIdentity; /** Forget a finished run. */ end(runId?: string | null): void; /** @internal Number of runs currently tracked. */ get size(): number; private _remember; } //#endregion export { ExplicitIdentity, ResolvedIdentity, RunIdentities, resolveIdentity }; //# sourceMappingURL=identity.d.ts.map