export interface RequestContext { projectSlug: string; projectId?: string; token: string; productionMode: boolean; /** Release ID for production mode (mutually exclusive with branch) */ releaseId?: string | null; /** Branch name for preview mode (mutually exclusive with releaseId) */ branch?: string | null; /** Actual environment name from API (e.g., "Development", "Production") */ environmentName?: string | null; /** * Request-scoped file content cache. * Deduplicates file fetches within a single HTTP request. * This is especially important in preview mode where the persistent cache is disabled. */ fileCache?: Map; } export declare const asyncLocalStorage: any; export declare function getCurrentRequestContext(): RequestContext | null; /** * Wraps a callback to preserve the current AsyncLocalStorage context. * * esbuild communicates with its Go binary via a child process. When esbuild's * plugin callbacks (onResolve, onLoad) fire, they run in the child process's * message handler context, which does NOT inherit the AsyncLocalStorage store * from the original caller. This utility captures the current store and * re-enters it inside the callback, so that the correct project adapter can be resolved. */ export declare function wrapWithCurrentContext unknown>(fn: T): T; export declare function getRequestScopedFile(cacheKey: string): string | undefined; export declare function setRequestScopedFile(cacheKey: string, content: string): void; export declare function clearRequestScopedFileCache(): number; /** * Run a function within a request context. * Standalone version that doesn't require an adapter instance. * Used by workflow workers and other components that need to establish context. */ export declare function runWithRequestContext(options: { projectSlug: string; token: string; projectId?: string; productionMode?: boolean; releaseId?: string | null; branch?: string | null; environmentName?: string | null; }, fn: () => Promise): Promise; /** Run an operation without inheriting a credential-bearing filesystem context. */ export declare function runWithoutRequestContext(fn: () => T): T; /** * Typed global interface for the multi-project adapter module. * Registered on globalThis to avoid circular dependencies between * cache-key-builder / cache backends and the FS adapter layer. */ interface VfMultiProjectAdapterGlobal { getCurrentRequestContext: () => RequestContext | null; getRequestScopedFile: (cacheKey: string) => string | undefined; setRequestScopedFile: (cacheKey: string, content: string) => void; clearRequestScopedFileCache: () => number; } declare global { var __vf_multi_project_adapter: VfMultiProjectAdapterGlobal | undefined; } export {}; //# sourceMappingURL=request-context.d.ts.map