/** * Copyright (c) 2025 Elara AI Pty Ltd * Licensed under BSL 1.1. See LICENSE for details. */ import type { ExecutionStatus } from '@elaraai/e3-types'; import type { StorageBackend, LogChunk } from './storage/interfaces.js'; /** * Compute the combined hash of input hashes. * * Used to create a unique identifier for an execution based on its inputs. * The order of inputs matters - different orderings produce different hashes. * * @param inputHashes - Array of input dataset hashes * @returns Combined SHA256 hash */ export declare function inputsHash(inputHashes: string[]): string; /** * Get execution status for a specific execution. * * @param storage - Storage backend * @param repo - Repository identifier (for local storage, the path to e3 repository directory) * @param taskHash - Hash of the task object * @param inHash - Combined hash of input hashes * @param executionId - Execution ID (UUIDv7) * @returns ExecutionStatus or null if execution doesn't exist * @throws {ExecutionCorruptError} If status file exists but cannot be decoded */ export declare function executionGet(storage: StorageBackend, repo: string, taskHash: string, inHash: string, executionId: string): Promise; /** * Get the latest execution status (lexicographically greatest executionId). * * @param storage - Storage backend * @param repo - Repository identifier (for local storage, the path to e3 repository directory) * @param taskHash - Hash of the task object * @param inHash - Combined hash of input hashes * @returns ExecutionStatus or null if no executions exist */ export declare function executionGetLatest(storage: StorageBackend, repo: string, taskHash: string, inHash: string): Promise; /** * Get the latest successful output hash for a completed execution. * This is the primary cache lookup function. * * @param storage - Storage backend * @param repo - Repository identifier (for local storage, the path to e3 repository directory) * @param taskHash - Hash of the task object * @param inHash - Combined hash of input hashes * @returns Output hash or null if no successful execution exists */ export declare function executionGetOutput(storage: StorageBackend, repo: string, taskHash: string, inHash: string): Promise; /** * List all execution IDs for a (taskHash, inputsHash) pair. * * @param storage - Storage backend * @param repo - Repository identifier (for local storage, the path to e3 repository directory) * @param taskHash - Hash of the task object * @param inHash - Combined hash of input hashes * @returns Array of execution IDs (sorted lexicographically ascending) */ export declare function executionListIds(storage: StorageBackend, repo: string, taskHash: string, inHash: string): Promise; /** * List all input hashes that have executions for a given task. * * @param storage - Storage backend * @param repo - Repository identifier (for local storage, the path to e3 repository directory) * @param taskHash - Hash of the task object * @returns Array of input hashes */ export declare function executionListForTask(storage: StorageBackend, repo: string, taskHash: string): Promise; /** * List all executions in the repository. * * @param storage - Storage backend * @param repo - Repository identifier (for local storage, the path to e3 repository directory) * @returns Array of { taskHash, inputsHash } objects */ export declare function executionList(storage: StorageBackend, repo: string): Promise>; /** * Result of finding the current execution for a task */ export interface CurrentExecutionRef { /** Hash of the task object */ taskHash: string; /** Combined hash of input hashes */ inputsHash: string; /** Execution ID (UUIDv7) */ executionId: string; /** True if this matches the current workspace input state */ isCurrent: boolean; } /** * Find the execution reference for a task in a workspace. * * This looks up the task's current input hashes from the workspace state * and finds the matching execution. If no execution exists for the current * inputs, falls back to the most recent execution. * * @param storage - Storage backend * @param repo - Repository identifier (for local storage, the path to e3 repository directory) * @param ws - Workspace name * @param taskName - Task name * @returns Execution reference or null if no executions exist */ export declare function executionFindCurrent(storage: StorageBackend, repo: string, ws: string, taskName: string): Promise; /** * Options for reading execution logs */ export interface LogReadOptions { /** Byte offset to start reading from (default: 0) */ offset?: number; /** Maximum bytes to read (default: 64KB) */ limit?: number; } export type { LogChunk }; /** * Read execution logs with pagination support. * * @param storage - Storage backend * @param repo - Repository identifier (for local storage, the path to e3 repository directory) * @param taskHash - Hash of the task object * @param inHash - Combined hash of input hashes * @param executionId - Execution ID (UUIDv7) * @param stream - Which log stream to read ('stdout' or 'stderr') * @param options - Pagination options * @returns Log chunk with data and metadata */ export declare function executionReadLog(storage: StorageBackend, repo: string, taskHash: string, inHash: string, executionId: string, stream: 'stdout' | 'stderr', options?: LogReadOptions): Promise; /** * Evaluate command IR to get exec args. * * The IR is an East function: (inputs: Array, output: String) -> Array * * @param storage - Storage backend * @param repo - Repository identifier (for local storage, the path to e3 repository directory) * @param commandIrHash - Hash of the IR object * @param inputPaths - Paths to staged input files * @param outputPath - Path where output should be written * @returns Array of strings to exec */ export declare function evaluateCommandIr(storage: StorageBackend, repo: string, commandIrHash: string, inputPaths: string[], outputPath: string): Promise; //# sourceMappingURL=executions.d.ts.map