export type SandboxExecutionStatus = "queued" | "running" | "succeeded" | "failed" | "timed_out"; export interface SandboxExecutionRow { id: string; owner: string; orgId: string | null; threadId: string | null; runtime: string; code: string; status: SandboxExecutionStatus; timeoutMs: number; maxOutputChars: number; attemptCount: number; maxAttempts: number; claimToken: string | null; leaseExpiresAt: number | null; stdout: string; stderr: string; stdoutTruncated: boolean; stderrTruncated: boolean; exitCode: number | null; timedOut: boolean; error: string | null; bridgeToolsUsed: string[]; allowedActionNames: string[] | undefined; createdAt: number; startedAt: number | null; finishedAt: number | null; updatedAt: number; } export interface CreateSandboxExecutionInput { owner: string; orgId?: string | null; threadId?: string | null; code: string; timeoutMs: number; maxOutputChars: number; maxAttempts?: number; runtime?: string; allowedActionNames?: readonly string[]; } export interface FinalizeSandboxExecutionInput { status: Extract; stdout?: string; stderr?: string; exitCode?: number | null; timedOut?: boolean; error?: string | null; bridgeToolsUsed?: string[]; } export declare const SANDBOX_EXECUTION_DEFAULT_MAX_ATTEMPTS = 2; export declare const SANDBOX_EXECUTION_MAX_STORED_OUTPUT_CHARS = 200000; export declare const sandboxExecutionsStore: import("../../db/store-registry.js").Store; export declare function ensureTable(): Promise; export declare function resetSandboxExecutionsStoreForTests(): void; export declare function createSandboxExecution(input: CreateSandboxExecutionInput): Promise; export declare function getSandboxExecutionForOwner(id: string, owner: string): Promise; export declare function getSandboxExecutionInternal(id: string): Promise; export declare function claimSandboxExecution(id: string, claimToken: string, leaseMs: number, now?: number): Promise; export declare function renewSandboxExecutionLease(id: string, claimToken: string, leaseMs: number, now?: number): Promise; /** * Write the terminal result. Single-writer safe: only the executor whose * claim token still matches the row (i.e. it was not reclaimed after a lease * expiry) can finalize. Returns false when the row was already finalized or * reclaimed — the caller must discard its result. */ export declare function finalizeSandboxExecution(id: string, claimToken: string, input: FinalizeSandboxExecutionInput, now?: number): Promise; export declare function failExpiredSandboxExecution(id: string, error: string, now?: number): Promise; export interface DueSandboxExecution { id: string; status: SandboxExecutionStatus; attemptCount: number; maxAttempts: number; leaseExpiresAt: number | null; } export declare function listDueSandboxExecutions(options: { limit?: number; queuedOlderThanMs?: number; now?: number; }): Promise;