import type { Database } from "bun:sqlite";
import { type ArtifactIntegrityReport } from "../lib/artifact-store.js";
import { type TaskFile } from "./task-files.js";
export type TaskRunStatus = "running" | "completed" | "failed" | "cancelled";
export type TaskRunEventType = "started" | "progress" | "claim" | "comment" | "command" | "file" | "artifact" | "completed" | "failed" | "cancelled";
export type TaskRunCommandStatus = "passed" | "failed" | "unknown";
export interface TaskRun {
    id: string;
    task_id: string;
    agent_id: string | null;
    title: string | null;
    status: TaskRunStatus;
    summary: string | null;
    metadata: Record<string, unknown>;
    started_at: string;
    completed_at: string | null;
    created_at: string;
    updated_at: string;
}
export interface TaskRunEvent {
    id: string;
    run_id: string;
    task_id: string;
    event_type: TaskRunEventType;
    message: string | null;
    data: Record<string, unknown>;
    agent_id: string | null;
    created_at: string;
}
export interface TaskRunCommand {
    id: string;
    run_id: string;
    task_id: string;
    command: string;
    status: TaskRunCommandStatus;
    exit_code: number | null;
    output_summary: string | null;
    artifact_path: string | null;
    agent_id: string | null;
    started_at: string | null;
    completed_at: string | null;
    created_at: string;
}
export interface TaskRunArtifact {
    id: string;
    run_id: string;
    task_id: string;
    path: string;
    artifact_type: string | null;
    description: string | null;
    size_bytes: number | null;
    sha256: string | null;
    metadata: Record<string, unknown>;
    agent_id: string | null;
    created_at: string;
}
export interface TaskRunLedger {
    run: TaskRun;
    events: TaskRunEvent[];
    commands: TaskRunCommand[];
    artifacts: TaskRunArtifact[];
    files: TaskFile[];
}
export { redactEvidenceText } from "../lib/redaction.js";
export declare function resolveTaskRunId(idOrPrefix: string, db?: Database): string;
export declare function getTaskRun(runId: string, db?: Database): TaskRun | null;
export interface StartTaskRunInput {
    task_id: string;
    agent_id?: string;
    title?: string;
    summary?: string;
    metadata?: Record<string, unknown>;
    claim?: boolean;
    started_at?: string;
}
export declare function startTaskRun(input: StartTaskRunInput, db?: Database): TaskRun;
export interface AddTaskRunEventInput {
    run_id: string;
    event_type: TaskRunEventType;
    message?: string;
    data?: Record<string, unknown>;
    agent_id?: string;
    created_at?: string;
}
export declare function addTaskRunEvent(input: AddTaskRunEventInput, db?: Database): TaskRunEvent;
export interface AddTaskRunCommandInput {
    run_id: string;
    command: string;
    status?: TaskRunCommandStatus;
    exit_code?: number;
    output_summary?: string;
    artifact_path?: string;
    tokens?: number;
    cost_usd?: number;
    duration_ms?: number;
    agent_id?: string;
    started_at?: string;
    completed_at?: string;
}
export declare function addTaskRunCommand(input: AddTaskRunCommandInput, db?: Database): TaskRunCommand;
export interface AddTaskRunFileInput {
    run_id: string;
    path: string;
    status?: TaskFile["status"];
    note?: string;
    agent_id?: string;
}
export declare function addTaskRunFile(input: AddTaskRunFileInput, db?: Database): TaskFile;
export interface AddTaskRunArtifactInput {
    run_id: string;
    path: string;
    artifact_type?: string;
    description?: string;
    size_bytes?: number;
    sha256?: string;
    metadata?: Record<string, unknown>;
    store_content?: boolean;
    retention_days?: number;
    agent_id?: string;
}
export declare function addTaskRunArtifact(input: AddTaskRunArtifactInput, db?: Database): TaskRunArtifact;
export declare function verifyTaskRunArtifacts(runId: string, db?: Database): ArtifactIntegrityReport[];
export interface FinishTaskRunInput {
    run_id: string;
    status: Exclude<TaskRunStatus, "running">;
    summary?: string;
    agent_id?: string;
    completed_at?: string;
}
export declare function finishTaskRun(input: FinishTaskRunInput, db?: Database): TaskRun;
export declare function listTaskRuns(taskId?: string, db?: Database): TaskRun[];
export declare function getTaskRunLedger(runId: string, db?: Database): TaskRunLedger;
//# sourceMappingURL=task-runs.d.ts.map