/**
 * AsyncLocalStorage-backed carrier for the current request's caller
 * identity. The HTTP transport populates this on every authenticated
 * request; the tool dispatcher reads it to decide which grant to
 * consult and to tag audit rows. Stdio callers (the Claude Desktop
 * default) don't populate it — the dispatcher treats a missing context
 * as the local/trusted caller and bypasses the grant gate.
 *
 * AsyncLocalStorage propagates through awaited async calls within the
 * same request, so the dispatcher can read the context without needing
 * it threaded through every function.
 */
import { AsyncLocalStorage } from "async_hooks";
const storage = new AsyncLocalStorage();
export function runWithCaller(ctx, fn) {
    return storage.run(ctx, fn);
}
export function currentCaller() {
    return storage.getStore();
}
//# sourceMappingURL=caller-context.js.map