/** * IAssetKindRegistry — contract for the frozen-state asset kind registry. * * Library-bound, not process-global. Follows a frozen-state machine: * - register() is valid only in the "open" state * - First read operation auto-freezes the registry * - freeze() is idempotent * * Conflicts on registration are hard errors (A4): * - Same kind registered twice → AssetKindConflictError * - Overlapping glob patterns → AssetKindPatternConflictError * - Multiple providers match a path → AssetKindPathAmbiguityError * * Design decisions A3, A4: locked in Phase 1.7 planning. */ import type { ManifestValidationResult } from "@skaile/workspaces/types/manifests"; import type { AssetKindFileFilter, AssetKindRequiresEdge, IAssetKindProvider } from "./asset-kind-provider.js"; /** * Thrown when a kind is registered that already exists in the registry. */ export declare class AssetKindConflictError extends Error { readonly kind: string; constructor(kind: string); } /** * Thrown when a provider's discovery patterns overlap with an * already-registered provider's patterns. */ export declare class AssetKindPatternConflictError extends Error { readonly newKind: string; readonly existingKind: string; readonly conflictingPattern: string; constructor(newKind: string, existingKind: string, conflictingPattern: string); } /** * Thrown at discovery time when multiple providers claim the same path. * This indicates a bug in matchesPath implementations — should be caught * earlier by pattern conflict detection, but serves as a runtime safety net. */ export declare class AssetKindPathAmbiguityError extends Error { readonly path: string; readonly matchingKinds: string[]; constructor(path: string, matchingKinds: string[]); } /** * Thrown when register() is called on a frozen registry. */ export declare class AssetKindRegistryFrozenError extends Error { constructor(); } /** * Frozen-state asset kind registry. * * Lifecycle: * 1. Created in "open" state * 2. Providers registered via register() * 3. First read operation (getProvider, getAllProviders, resolveKind, * validateManifest, defaultFileFilter, extractRequires) auto-freezes * 4. No further registrations allowed * * Implementations: AssetKindRegistry in @skaile/discovery. */ export interface IAssetKindRegistry { /** Whether the registry is frozen (no further registrations allowed). */ readonly frozen: boolean; /** * Register a provider. Must be called before the registry is frozen. * @throws AssetKindConflictError if kind already registered * @throws AssetKindPatternConflictError if patterns overlap * @throws AssetKindRegistryFrozenError if registry is frozen */ register(provider: IAssetKindProvider): void; /** * Explicitly freeze the registry. Idempotent — calling on an already-frozen * registry is a no-op. */ freeze(): void; /** Get a provider by kind name. Returns undefined for unregistered kinds. */ getProvider(kind: string): IAssetKindProvider | undefined; /** Get all registered providers (snapshot, not live). */ getAllProviders(): IAssetKindProvider[]; /** Get all registered kind names. */ getAllKinds(): string[]; /** * Resolve a relative path to an asset kind. * @throws AssetKindPathAmbiguityError if multiple providers match * @returns The kind string, or undefined if no provider matches */ resolveKind(relativePath: string): string | undefined; /** * Validate a manifest for a given kind. * @returns Validation result, or a failure if the kind is unregistered */ validateManifest(kind: string, data: unknown): ManifestValidationResult; /** * Compute the default file filter for an asset. * @returns The file filter, or undefined if the kind is unregistered */ defaultFileFilter(kind: string, manifestPath: string): AssetKindFileFilter | undefined; /** * Extract requires edges from a manifest. * @returns The edges, or an empty array if the kind has no extractRequires */ extractRequires(kind: string, assetRef: string, manifest: Record): AssetKindRequiresEdge[]; } //# sourceMappingURL=asset-kind-registry.d.ts.map