import { BadRequestError } from "./errors.js"; /** * Acquire a synchronous file lock with bounded retries on `ELOCKED`. * * Shared by all settings handlers that persist to `settings.json` so * concurrent writes from different namespaces (observational-memory, * agent) cannot interleave and corrupt the file. */ export declare function acquireLockSyncWithRetry(path: string): () => void; /** * Async twin of {@link acquireLockSyncWithRetry}. Uses `proper-lockfile`'s * promise API and sleeps between `ELOCKED` attempts instead of busy-waiting * so the relay event loop stays responsive while another request holds the * settings lock. */ export declare function acquireLockWithRetry(path: string): Promise<() => Promise>; /** * Resolve the `settings.json` path for a given agent directory. * Falls back to the default agent dir (`~/.spectral/agent`) when * `agentDir` is omitted. */ export declare function settingsFilePath(agentDir?: string): string; /** * Read-persist cycle for a single namespace inside `settings.json`, * guarded by a file-level lock so concurrent writes across namespaces * are serialized. * * - Reads the **entire** file (preserving all top-level keys). * - Extracts `parsed[namespace]` (or `{}` if absent). * - Passes the current namespace object to `fn`. If `fn` returns * `undefined`, no write occurs. Otherwise the returned object * replaces the namespace and the full file is written back. * * The lock is acquired **before** writing (and also before reading if * the file already exists) so we never observe a half-written file. */ export declare function withSettingsLock(opts: { agentDir?: string; settingsPath?: string; namespace: string; }, fn: (current: Record) => Record | undefined): void; /** * Async twin of {@link withSettingsLock} for the relay REST path. * * Reads and writes through `node:fs/promises` and acquires the lock * asynchronously so the event loop is never blocked while waiting on * another settings write. */ export declare function withSettingsLockAsync(opts: { agentDir?: string; settingsPath?: string; namespace: string; }, fn: (current: Record) => Record | undefined): Promise; /** Re-exported for handler convenience. */ export { BadRequestError }; //# sourceMappingURL=settings-lock.d.ts.map