/**
 * DataObjectStore — file-based CRUD service for the Unified DataObject Model.
 *
 * Persists DataObjects as individual JSON files organised by namespace:
 * - scope=agent  → `{projectPath}/.crewly/agents/{owner_id}/data/{id}.json`
 * - scope=project → `{projectPath}/.crewly/data/{namespace}/{id}.json`
 * - scope=global  → `~/.crewly/data/{namespace}/{id}.json`
 *
 * @see specs/crewly-data-architecture-v2.md
 */
import { DataObject, CreateDataObjectInput, DataObjectFilters } from './data-object.types.js';
/**
 * File-based CRUD store for DataObjects.
 *
 * Uses a singleton pattern consistent with other Crewly services.
 * Each DataObject is stored as a separate JSON file so that
 * concurrent agents can write without lock contention.
 */
export declare class DataObjectStore {
    private static instance;
    private static instanceProjectPath;
    private projectPath;
    private logger;
    /**
     * @param projectPath - Absolute path to the Crewly project root.
     *   Used to resolve scope-based storage directories.
     */
    constructor(projectPath: string);
    /**
     * Returns the singleton DataObjectStore instance.
     *
     * If `projectPath` differs from the current instance, a new one is created.
     *
     * @param projectPath - Absolute path to the Crewly project root
     * @returns Singleton DataObjectStore
     */
    static getInstance(projectPath: string): DataObjectStore;
    /**
     * Clears the singleton (useful for tests).
     */
    static clearInstance(): void;
    /**
     * Creates a new DataObject, persists it to disk, and returns it.
     *
     * Generates a UUID, sets timestamps, and applies sensible defaults.
     *
     * @param input - Fields for the new DataObject
     * @returns The persisted DataObject
     */
    create(input: CreateDataObjectInput): Promise<DataObject>;
    /**
     * Retrieves a DataObject by its ID.
     *
     * Scans all namespace directories because the caller may not know
     * the namespace. For hot-path lookups, prefer `listByNamespace`.
     *
     * @param id - UUID of the DataObject
     * @returns The DataObject, or null if not found
     */
    getById(id: string): Promise<DataObject | null>;
    /**
     * Lists DataObjects matching the supplied filters.
     *
     * @param filters - Optional field constraints
     * @returns Array of matching DataObjects
     */
    list(filters?: DataObjectFilters): Promise<DataObject[]>;
    /**
     * Applies a partial update to an existing DataObject.
     *
     * Only the fields present in `patch` are overwritten; the rest
     * are preserved. `metadata.updated_at` is always refreshed.
     *
     * @param id - UUID of the DataObject to update
     * @param patch - Fields to overwrite
     * @returns The updated DataObject
     * @throws Error if the DataObject does not exist
     */
    update(id: string, patch: Partial<DataObject>): Promise<DataObject>;
    /**
     * Deletes a DataObject by ID.
     *
     * @param id - UUID of the DataObject to delete
     * @returns true if the object existed and was deleted, false otherwise
     */
    delete(id: string): Promise<boolean>;
    /**
     * Lists all DataObjects within a given namespace.
     *
     * @param namespace - The namespace to scan, e.g. "marketing/steve-inputs"
     * @returns Array of DataObjects in that namespace
     */
    listByNamespace(namespace: string): Promise<DataObject[]>;
    /**
     * Resolves the absolute file path for a DataObject based on its scope.
     *
     * @param obj - The DataObject (or partial with scope, namespace, owner_id, id)
     * @returns Absolute path to the JSON file
     */
    private filePath;
    /**
     * Persists a DataObject to its resolved file path using atomic writes.
     */
    private persist;
    /**
     * Safely deletes a file, ignoring ENOENT errors.
     */
    private safeDelete;
    /**
     * Lists entries in a directory, returning empty array if it doesn't exist.
     */
    private safeReaddir;
    /**
     * Checks if a directory exists.
     */
    private dirExists;
    /**
     * Reads all DataObject JSON files from a single directory.
     */
    private readAllFromDir;
    /**
     * Recursively reads all DataObject JSON files from a directory tree
     * up to a configurable depth. Handles both shallow (data/{ns}/)
     * and deep (agents/{owner}/data/) hierarchies.
     *
     * @param dir - Root directory to scan
     * @param maxDepth - Maximum directory depth to descend (default 3)
     */
    private readAllRecursive;
    /**
     * Reads all DataObjects from a base directory tree.
     */
    private readAllFromBase;
    /**
     * Searches for a specific ID within a base directory tree (recursive).
     */
    private findInBase;
    /**
     * Recursively searches for a DataObject by ID in a directory tree.
     */
    private findInDir;
    /**
     * Tries to read and parse a single DataObject JSON file.
     * Returns null on any failure.
     */
    private tryReadFile;
    /**
     * Returns all possible base directories to scan.
     */
    private allBaseDirs;
    /**
     * Narrows base directories based on scope filter, if provided.
     */
    private baseDirsForFilters;
    /**
     * Tests whether a DataObject matches all non-undefined filter fields.
     */
    private matchesFilters;
}
//# sourceMappingURL=data-object-store.service.d.ts.map