/** * Per-principal execution context (AsyncLocalStorage). The brain-call tracer fires for EVERY model * call — including council/team sub-tasks that run on the shared `subRunner` (a per-task tracer can't * reach those). To attribute spend to the right principal we wrap a task's execution in this ALS: * `node:async_hooks` propagates the store through every `await`, so a sub-task spawned inside a tool * call still reads the originating principal. Absent store = unattributed (dev / no principal). */ import { AsyncLocalStorage } from "node:async_hooks"; export declare const principalContext: AsyncLocalStorage; /** Run `fn` with `principal` as the ambient context (no-op wrapper when principal is undefined). */ export declare function withPrincipal(principal: string | undefined, fn: () => T): T; /** The principal attributed to the current async execution, if any. */ export declare function currentPrincipal(): string | undefined; //# sourceMappingURL=principal-context.d.ts.map