import type { Tracer } from "@opentelemetry/api";
import type { FSWatcher } from "vite";
import { type RootNode } from "@superblocksteam/library-shared";
import type { ApiDeleteRequest, ApiManualDeleteRequest, ApiManualUpdateRequest, ApiUpdateRequest, ApiUpdateResponse, RenameApiRequest, RenameElementRequest, DeleteMeLibraryApi, StaticScope } from "@superblocksteam/library-shared/types";
import { TracedEventEmitter } from "@superblocksteam/shared";
import type { TemplateRenderer } from "./ai-service/template-renderer.js";
import { type ErrorEventMap } from "./errors/error-handler.js";
import { SourceTracker } from "./source-tracker.js";
import type { SourceKind } from "./source-tracker.js";
import type { GenerationNumberSequence } from "./util/generation-number-sequence.js";
import type { OperationQueue } from "./util/operation-queue.js";
type EventMap = {
    fileChanged: [path: string, content: string];
    renameComponent: [path: string];
    renameEntity: [path: string];
    addPage: [path: string, navigateToRoute?: string];
    deletePage: [path: string];
    renamePage: [path: string];
    routerChange: [routerFilePath: string];
    apiUpdate: [payload: ApiUpdateRequest];
    apiManualUpdate: [payload: ApiManualUpdateRequest, rename?: boolean];
    apiDelete: [payload: ApiDeleteRequest];
    apiManualDelete: [payload: ApiManualDeleteRequest];
    appFactsChanged: [];
} & ErrorEventMap;
type ApiFile = DeleteMeLibraryApi & {
    stepPathMap: Record<string, string>;
    scopeId: string;
};
export type HydratedRoute = {
    path: string;
    component: string;
};
export type RouteChange = {
    route: string;
    routeTestParams: Record<string, string>;
};
export declare class FileSystemManager extends TracedEventEmitter<EventMap> {
    protected rootDir: string | undefined;
    protected tsFiles: Record<string, string>;
    protected apiFiles: Record<string, ApiFile>;
    protected sourceTracker: SourceTracker | undefined;
    protected fsOperationQueue: OperationQueue;
    protected readonly generationNumberSequence: GenerationNumberSequence;
    protected routeChangesQueue: RouteChange[];
    protected pageAdditionQueue: Set<string>;
    routerFilePath: string | null;
    protected watcher: FSWatcher | undefined;
    registeredComponentPaths: Record<string, string>;
    private renameManager;
    private readonly _tracer;
    private transactionNonce;
    private pendingTransactions;
    private processedTransactions;
    private debouncedFileUpdateHandlers;
    private debouncedAppFactsChanged;
    private templateRenderer?;
    constructor(fsOperationQueue: OperationQueue, generationNumberSequence: GenerationNumberSequence, tracer: Tracer);
    get appFilePath(): string;
    get rootScopeFilePath(): string;
    watch(watcher: FSWatcher, rootPath: string): Promise<void>;
    initializeSourceTracker(): void;
    getPropertyCode(itemId: string, propertyName: string): Promise<string | null>;
    getFileWithIds(filePath: string): Promise<string | null>;
    private handleFileChange;
    deleteTsFile(filePath: string): Promise<void>;
    getTsFilePaths(): string[];
    getSourceTracker(): SourceTracker | undefined;
    /**
     * Set the template renderer for YAML→TS transformations.
     * Called by AiService after initialization.
     */
    setTemplateRenderer(templateRenderer: TemplateRenderer): void;
    writeFile(path: string, content: string, kind?: "api" | "ts"): Promise<void>;
    readFile(path: string): string | undefined;
    setFileContents(path: string, contents: string): Promise<void>;
    private writeChanges;
    getLocalBindingEntities(path: string): string[];
    getPageRootNodes(filePath: string): Promise<RootNode[] | undefined>;
    getAppRootNodes(): Promise<RootNode[] | undefined>;
    private collectAllImports;
    getRootNodesForFile(filePath: string): Promise<RootNode[] | undefined>;
    getScope(filePath: string): StaticScope | undefined;
    getScope(filePath: string, fallback: true): StaticScope;
    private flushTransactions;
    private trackTransaction;
    private getProcessedTransactionsWithNonce;
    get routeChange(): RouteChange | undefined;
    handleRenameElement: (payload: RenameElementRequest) => Promise<void>;
    private handleRenameComponent;
    getRelativeRoutePath(filePath: string): string;
    handleUpdateApi: (payload: ApiUpdateRequest) => Promise<ApiUpdateResponse>;
    handleDeleteApi: (payload: ApiDeleteRequest) => Promise<{
        deletedApis: {
            apiName: string;
            pageName?: string;
            scopeId?: string;
        }[];
    }>;
    handleRenameApi: (payload: RenameApiRequest) => Promise<void>;
    removeApiData(filePath: string): Promise<void>;
    getApiFiles(): Record<string, {
        api: DeleteMeLibraryApi;
        scopeId: string;
    }>;
    private createClientApi;
    private addApiToScope;
    private processApiFileUpdates;
    private updateInternalApiData;
    private renameIdentifierInApis;
    private getApisInScope;
    private isSkillFile;
}
export declare class MockFileSyncManager extends FileSystemManager {
    tsFiles: Record<string, string>;
    apiFiles: Record<string, ApiFile>;
    watch(_watcher: FSWatcher, _path: string): Promise<void>;
    writeFile(path: string, content: string, kind: SourceKind): Promise<void>;
    mockFileChange(path: string, content: string): void;
    handleUpdateApi: (payload: ApiUpdateRequest) => Promise<{
        api: DeleteMeLibraryApi;
        generationNumber: number;
        scopeId: string;
    }>;
}
export {};
//# sourceMappingURL=file-system-manager.d.ts.map