/** * Per-request/job context, propagated through the whole call stack via AsyncLocalStorage. * Packages extend it via module augmentation: * * declare module '@basaltkit/core' { * interface RequestContext { * tenant?: { id: string } * } * } */ export interface RequestContext { requestId?: string; correlationId?: string; [key: string]: unknown; } /** Returns the active context. Throws ContextUnavailableError outside of a scope. */ export declare function ctx(): RequestContext; /** Returns the active context or undefined — for code that needs a fallback. */ export declare function tryCtx(): RequestContext | undefined; /** Runs `fn` with the given context active (including across awaits and callbacks). */ export declare function runWithContext(context: RequestContext, fn: () => T): T;