/** * Flat-file metadata read/write. * * Architecture: * - Session metadata stored in project-specific directories * - Path: ~/.agent-orchestrator/{hash}-{projectId}/sessions/{sessionName} * - Session files use user-facing names (int-1) not tmux names (a3b4c5d6e7f8-int-1) * - Metadata includes tmuxName field to map user-facing → tmux name * * Format: key=value pairs (one per line), compatible with bash scripts * * Example file contents: * project=integrator * worktree=/Users/foo/.agent-orchestrator/a3b4c5d6e7f8-integrator/worktrees/int-1 * branch=feat/INT-1234 * status=working * tmuxName=a3b4c5d6e7f8-int-1 * pr=https://github.com/org/repo/pull/42 * issue=INT-1234 */ import type { SessionId, SessionMetadata } from "./types.js"; /** * Read metadata for a session. Returns null if the file doesn't exist. */ export declare function readMetadata(dataDir: string, sessionId: SessionId): SessionMetadata | null; /** * Read raw metadata as a string record (for arbitrary keys). */ export declare function readMetadataRaw(dataDir: string, sessionId: SessionId): Record | null; /** * Write full metadata for a session (overwrites existing file). */ export declare function writeMetadata(dataDir: string, sessionId: SessionId, metadata: SessionMetadata): void; /** * Update specific fields in a session's metadata. * Reads existing file, merges updates, writes back. */ export declare function updateMetadata(dataDir: string, sessionId: SessionId, updates: Partial>): void; /** * Delete a session's metadata file. * Optionally archive it to an `archive/` subdirectory. */ export declare function deleteMetadata(dataDir: string, sessionId: SessionId, archive?: boolean): void; /** * Read the latest archived metadata for a session. * Archive files are named `_` inside `/archive/`. * Returns null if no archived metadata exists. */ export declare function readArchivedMetadataRaw(dataDir: string, sessionId: SessionId): Record | null; export declare function updateArchivedMetadata(dataDir: string, sessionId: SessionId, updates: Partial>): boolean; /** * List all session IDs that have metadata files. */ export declare function listMetadata(dataDir: string): SessionId[]; /** * Atomically reserve a session ID by creating its metadata file with O_EXCL. * Returns true if the ID was successfully reserved, false if it already exists. */ export declare function reserveSessionId(dataDir: string, sessionId: SessionId): boolean; //# sourceMappingURL=metadata.d.ts.map