/** * Copyright (c) 2025 Elara AI Pty Ltd * Licensed under BSL 1.1. See LICENSE for details. */ import type { ExecutionStateStore, TaskStatusDetails, ExecutionStatusDetails } from './interfaces.js'; import { type DataflowExecutionState, type ExecutionEvent, type TaskStatus } from '../types.js'; /** * File-based state store for local filesystem persistence. * * @remarks * - Uses atomic writes (write to temp, then rename) for durability * - State is stored in beast2 binary format for type safety * - Events are stored inline in the execution state * - Thread-safe for concurrent access within a single process (via file locking) * - Suitable for local CLI and API server usage */ export declare class FileStateStore implements ExecutionStateStore { private readonly workspacesDir; /** * Create a new FileStateStore. * * @param workspacesDir - Path to the workspaces directory (e.g., repo/workspaces) */ constructor(workspacesDir: string); /** * Get the path to a workspace's directory. */ private workspacePath; /** * Get the path to a workspace's execution state file. */ private statePath; /** * Get the path to a workspace's execution counter file. */ private counterPath; create(state: DataflowExecutionState): Promise; read(repo: string, workspace: string, id: string): Promise; readLatest(_repo: string, workspace: string): Promise; update(state: DataflowExecutionState): Promise; updateTaskStatus(repo: string, workspace: string, executionId: string, task: string, status: TaskStatus, details?: TaskStatusDetails): Promise; updateStatus(repo: string, workspace: string, executionId: string, status: 'running' | 'completed' | 'failed' | 'cancelled', details?: ExecutionStatusDetails): Promise; recordEvent(repo: string, workspace: string, executionId: string, event: ExecutionEvent): Promise; getEventsSince(repo: string, workspace: string, executionId: string, sinceSeq: number): Promise; nextExecutionId(_repo: string, workspace: string): Promise; delete(_repo: string, workspace: string, executionId: string): Promise; /** * Check if an incomplete execution exists for a workspace. * * An execution is incomplete if its status is 'running'. * This is used to detect crash recovery scenarios. * * @param repo - Repository identifier * @param workspace - Workspace name * @returns The incomplete execution if one exists, null otherwise */ getIncompleteExecution(repo: string, workspace: string): Promise; /** * Write a binary file atomically using temp file + rename. */ private atomicWrite; /** * Write a text file atomically using temp file + rename. */ private atomicWriteText; } //# sourceMappingURL=FileStateStore.d.ts.map