import type { Binding, BindingKey, Manifest } from "./types.js"; import type { SnapshotRef } from "../types/reviewWire.js"; import type { SignedInAccess } from "../signedInRequest.mjs"; import type { SourceApi } from "./api.mjs"; export interface SourceStore { read(key: BindingKey): Promise; write(binding: Binding): Promise; } export type SourceResult = | { at: "ready"; snapshot: SnapshotRef } | { at: "unavailable"; reason: string }; export interface SourceOptions { access: SignedInAccess; spaceId: string; /** Parse project exclusions with gitignore rules on every source capture. The default uses strict project-relative patterns. */ ignoreSyntax?: import("../sourceIgnore.mjs").SourceIgnoreSyntax; expectedReferencedHiddenDigest?: string; /** Only verify a published snapshot. Never start or recover an upload. */ reuseOnly?: boolean; store?: SourceStore; enabled?: () => boolean; fingerprint?: (path: string) => Promise; /** Host-owned Desktop bindings may be read for exact reuse, never overwritten. */ existingBinding?: (key: BindingKey) => Promise; fetchImpl?: typeof fetch; signal?: AbortSignal; verificationTimeoutMs?: number; onProgress?: (bytes: number) => void; /** Test/host seams; the default is the authenticated v3 client. */ api?: SourceApi; wait?: (ms: number, signal?: AbortSignal) => Promise; } export interface SourceRun { binding: Binding; manifest: Manifest; api: SourceApi; store: SourceStore; fetchImpl: typeof fetch; signal: AbortSignal; wait: (ms: number, signal?: AbortSignal) => Promise; timeoutMs: number; onProgress: (bytes: number) => void; }