import type { HandlerContext } from "../types/index.js"; import { type CacheKeyContext } from "./schemas/index.js"; import { currentRequestContext } from "../platform/request-context-access.js"; type MultiProjectRequestContextType = NonNullable>; export type { CacheKeyContext }; export interface RegistryScopeContext { scopeId: string; /** Whether completed discovery is safe to retain for this immutable source. */ immutable: boolean; } /** * Check whether a registry scope belongs to a raw project ID. * * The project ID is always encoded before matching. Treating it as a possible * complete scope ID would make a delimiter-bearing project ID ambiguous with a * different project's scope. */ export declare function isRegistryScopeForProject(scopeId: string, projectId: string): boolean; /** Build a canonical, delimiter-safe registry scope for a versioned source. */ export declare function buildVersionedRegistryScopeId(projectId: string, mode: CacheKeyContext["mode"], versionId: string): string; export declare function getContentHashKey(prefix: string, filePath: string, contentHash: string, suffix?: string): string; export declare function runWithCacheKeyContext(ctx: CacheKeyContext, fn: () => T): T; /** * Suppress an inherited explicit cache scope for a callback. This is used when * a restored tenant has a mutable source (for example, a production * environment without a pinned release) that cannot safely use distributed * caching. Ambient request context remains available for in-process registry * isolation. */ export declare function runWithoutCacheKeyContext(fn: () => T): T; export declare function getCurrentCacheKeyContext(): CacheKeyContext; export declare function tryGetCacheKeyContext(): CacheKeyContext | null; /** * Returns a stable scope identifier for in-process registry isolation. * * Unlike tryGetCacheKeyContext(), this function does NOT return null when the * request context lacks a field that would be required for a safe distributed * cache key (e.g. productionMode=true without a releaseId). For in-process * registries (ProjectScopedRegistryManager), project identity and the active * content source still provide a safe process-local scope. Collapsing to * "__default__" would let concurrent projects overwrite one another's * registered skills, tools, and agents. * * Returns null only when no project identity is available at all (e.g. CLI / * local dev without a multi-project context), in which case the caller should * fall back to DEFAULT_SCOPE_ID. */ export declare function tryGetRegistryScopeContext(): RegistryScopeContext | null; export declare function tryGetRegistryScopeId(): string | null; /** * Return an opaque identity for the active hosted request. * * Registry managers use the token only as a WeakMap key so a request keeps the * exact registry generation it first observed, even if that scope is replaced * while the request is still running. */ export declare function tryGetRegistryScopeOwner(): object | null; export declare function getProjectScopedKey(prefix: string, resourceKey: string): string | null; export declare function getProjectScopedKeyAlways(prefix: string, resourceKey: string): string | null; export declare function extractCacheKeyContext(handlerCtx: HandlerContext): CacheKeyContext | null; export type { MultiProjectRequestContextType as MultiProjectRequestContext }; //# sourceMappingURL=cache-key-builder.d.ts.map