/** * Child file read operations for ChildWriter. * * Extracts read, merge, and path-resolution methods that don't need * direct queue infrastructure. Used by ChildWriter for all read-path * operations on child session `.json` files. * * @module session-tracker/persistence/child-reader */ import type { ChildSessionRecord } from "../types.js"; import type { HierarchyIndex } from "./hierarchy-index.js"; /** * Gets the absolute path to a child session `.json` file. * * @param projectRoot - Absolute path to the project root. * @param parentSessionID - The parent session identifier. * @param childSessionID - The child session identifier. * @returns Absolute path to the child `.json` file. */ export declare function getChildFilePath(projectRoot: string, parentSessionID: string, childSessionID: string): string; /** * Reads and parses an existing child session `.json` file. * * @param projectRoot - Absolute path to the project root. * @param parentSessionID - The parent session identifier. * @param childSessionID - The child session identifier. * @returns The parsed child session record. * @throws If the file does not exist or cannot be parsed. */ export declare function readChildFile(projectRoot: string, parentSessionID: string, childSessionID: string): Promise; /** * Reads an existing child file if it exists (returns undefined on failure). * * @param projectRoot - Absolute path to the project root. * @param parentSessionID - The directory-owning parent session ID. * @param childSessionID - The child session identifier. * @returns Existing child record, or `undefined` when no file exists. */ export declare function readExistingChildFile(projectRoot: string, parentSessionID: string, childSessionID: string): Promise; /** * Checks if a child session `.json` file exists on disk. * * Resolves via hierarchy index (D-03 root main directory) first, * then falls back to scanning all session-tracker subdirectories. * * @param projectRoot - Absolute path to the project root. * @param hierarchyIndex - Optional hierarchy index for root main resolution. * @param parentSessionID - The parent session ID. * @param childSessionID - The child session ID. * @param resolveWriteParent - Function to resolve the correct write parent. * @returns True if the file exists on disk. */ export declare function childFileExists(projectRoot: string, _hierarchyIndex: HierarchyIndex | undefined, parentSessionID: string, childSessionID: string, resolveWriteParent: (childID: string, immediateParentID: string) => string): Promise; /** * Reads a child session record from disk using only the child session ID. * * Resolves the parent directory via hierarchy index, then falls back to * scanning all session-tracker subdirectories if the index is unavailable. * * @param projectRoot - Absolute path to the project root. * @param hierarchyIndex - Optional hierarchy index for parent resolution. * @param sessionID - The child session identifier to look up. * @returns The parsed child session record, or `undefined` if not found. */ export declare function readChildData(projectRoot: string, hierarchyIndex: HierarchyIndex | undefined, sessionID: string): Promise; /** * Merges new child metadata into an existing record without losing live data. * * @param existing - Existing child record from disk, if any. * @param metadata - New metadata to apply. * @returns Merged child record safe to write back to disk. */ export declare function mergeChildRecord(existing: ChildSessionRecord | undefined, metadata: ChildSessionRecord): ChildSessionRecord; //# sourceMappingURL=child-reader.d.ts.map