export declare const SYNC_MANIFEST_FILE = ".funnelsgrove-sync.json"; export declare const LEGACY_OFFER_SETS_GENERATED_PATH = "src/config/offer-sets.generated.ts"; export type SyncManifestFile = { path: string; hash: string; }; export type SyncManifest = { version: 1; workspaceId: string; funnelId: string; draftVersionId: string; files: SyncManifestFile[]; }; export type SyncManifestInput = Omit; export type SourceFile = { path: string; content: string; contentType?: string; contentEncoding?: 'base64'; }; export type SafeRootWriteHooks = { beforeDirectoryCreate?: (relativeDirectoryPath: string) => void | Promise; afterDirectoryEntrySync?: (relativeDirectoryPath: string) => void | Promise; }; export type ChangedSourceFiles = { currentManifest: SyncManifest; deletedPaths: string[]; files: SourceFile[]; }; export type SourceFilePatchBatch = { deletedPaths: string[]; files: SourceFile[]; }; export type SourceRebaseConflictKind = 'add-add' | 'delete-modify' | 'modify-delete' | 'modify-modify'; export type SourceRebaseConflict = { path: string; kind: SourceRebaseConflictKind; }; export type SourceTextMerge = (input: { path: string; base: string; local: string; remote: string; }) => Promise<{ content: string; clean: boolean; }>; export type SourceRebaseResult = { files: SourceFile[]; conflicts: SourceRebaseConflict[]; }; export type SourceCandidateOperation = { type: 'create' | 'modify'; path: string; content: string; contentType?: string; sha256: string; } | { type: 'delete'; path: string; } | { type: 'rename'; path: string; oldPath: string; }; export type SourceCandidateApi = { begin: (input: { workspaceId: string; funnelId: string; baseDraftVersionId: string | null; idempotencyKey: string; }) => Promise<{ candidateId: string; status: 'staging' | 'validating' | 'committed' | 'aborted' | 'expired' | 'failed'; baseDraftVersionId: string | null; }>; stage: (input: { workspaceId: string; candidateId: string; idempotencyKey: string; operations: SourceCandidateOperation[]; }) => Promise; finalize: (input: { workspaceId: string; candidateId: string; message?: string; }) => Promise; abort: (input: { workspaceId: string; candidateId: string; }) => Promise; }; export declare const DEFAULT_PATCH_BATCH_CONTENT_CHARS = 12000000; export declare const DEFAULT_SOURCE_CANDIDATE_BATCH_CONTENT_BYTES = 12000000; export declare const MAX_SOURCE_CANDIDATE_OPERATIONS: number; export declare const MAX_SOURCE_CANDIDATE_FILE_BYTES: number; export declare const MAX_SOURCE_CANDIDATE_PATH_CHARACTERS = 1024; export declare const MAX_SOURCE_CANDIDATE_TOTAL_BYTES: number; export type SyncDownLocalLifecycle = { recoverMigration: () => Promise; recoverDocs: () => Promise; refreshDocs: () => Promise; writeSyncState: () => Promise; }; export declare function runSyncDownLocalLifecycle(lifecycle: SyncDownLocalLifecycle): Promise; export declare const assertSafeRootFileWriteTarget: (rootDir: string, relativePath: string) => Promise; export declare const readSafeRootFile: (rootDir: string, relativePath: string) => Promise; export declare const removeSafeRootFile: (rootDir: string, relativePath: string) => Promise; export declare const writeSafeRootFile: (rootDir: string, relativePath: string, content: string | Buffer, hooks?: SafeRootWriteHooks) => Promise; export declare function normalizeSyncPath(filePath: string): string; export declare function assertSafeSyncPath(filePath: string): string; export declare function shouldSyncFile(filePath: string): boolean; export declare function filterSyncableSourceFiles(files: readonly SourceFile[]): SourceFile[]; export declare function buildSyncManifest(rootDir: string, input: SyncManifestInput): Promise; export declare function buildCommittedSyncManifest(input: { workspaceId: string; funnelId: string; draftVersionId: string; files: readonly SyncManifestFile[]; }): SyncManifest; export declare function buildDownloadedSyncManifest(input: SyncManifestInput & { files: readonly SourceFile[]; }): SyncManifest; export declare function writeSyncManifest(rootDir: string, manifest: SyncManifest): Promise; export declare function ensureGitignore(rootDir: string): Promise; export declare function writeLocalEnvFile(rootDir: string, envFile: string | null | undefined): Promise; export declare function readSyncManifest(rootDir: string): Promise; export declare function collectSourceSnapshot(rootDir: string): Promise<{ manifestFiles: SyncManifestFile[]; sourceFiles: SourceFile[]; }>; export declare function collectSourceFiles(rootDir: string): Promise; export declare const sourceFileBytes: (file: SourceFile) => Buffer; export declare function rebaseSourceFiles(input: { baseFiles: readonly SourceFile[]; localFiles: readonly SourceFile[]; remoteFiles: readonly SourceFile[]; remoteOwnedPaths?: ReadonlySet; mergeText?: SourceTextMerge; }): Promise; export declare function replaceSourceFiles(input: { rootDir: string; currentFiles: readonly SourceFile[]; nextFiles: readonly SourceFile[]; }): Promise; export declare function writeSourceRebaseBackup(input: { rootDir: string; files: readonly SourceFile[]; manifest: SyncManifest; remoteDraftVersionId: string; }): Promise; export declare function collectChangedSourceFiles(rootDir: string, previousManifest: SyncManifest): Promise; export declare function hasLocalSourceChanges(rootDir: string, previousManifest: SyncManifest): Promise; export declare function chunkChangedSourceFiles(changes: Pick, maxContentChars?: number): SourceFilePatchBatch[]; export declare function buildSourceCandidateOperations(input: { previousFiles: readonly SyncManifestFile[]; files: readonly SourceFile[]; deletedPaths: readonly string[]; }): SourceCandidateOperation[]; export declare function runSourceCandidateSync(input: { workspaceId: string; funnelId: string; baseDraftVersionId: string | null; message?: string; operations: readonly SourceCandidateOperation[]; api: SourceCandidateApi; maxOperationsPerBatch?: number; maxContentBytesPerBatch?: number; signal?: AbortSignal; }): Promise; export declare function formatSyncUploadSummary(changes: Pick, largestFileLimit?: number): string[]; export declare function writeSourceFiles(rootDir: string, files: SourceFile[]): Promise;