import { Pool } from "pg"; import type { Issue, RunRecord } from "./domain.js"; import { WorkStore } from "./work/store.js"; export interface EventRecord { sequence: number; runId: string | null; kind: string; payload: unknown; createdAt: string; } export interface ProjectState { id: string; paused: boolean; blocked: string | null; } export interface InvocationRecord { id: string; runId: string; executionId: string; projectId: string; step: string; stepId: number; attempt: number; provider: string; sessionId: string | null; resumedFrom?: string; sessionState: "pending" | "available" | "unavailable"; requested: unknown; effective: unknown; prompt: string; taskPrompt?: import("./prompts.js").ResolvedPrompt; outputContract?: string; validationError?: string; outcome: string; startedAt: string; finishedAt?: string; log: string; } interface RetryAdmission { commandId?: string; checkSafety: (previous: RunRecord) => Promise<{ checkout: string; branchTemplate: string; issue?: Issue; }>; } interface RecoveryAdmission { commandId?: string; checkSafety: (run: RunRecord) => Promise; } /** Public persisted query surface. All queries work without a running executor. */ export declare class Store { readonly scope: string; private readonly redact; readonly workItems: WorkStore; readonly pool: Pool; private readonly db; private readonly admission; private ownership?; constructor(databaseUrl: string, scope: string, redact?: (text: string) => string); initialize(): Promise; acquire(keys: string[], onLost: () => void): Promise; release(): Promise; close(): Promise; registerProject(id: string): Promise; projects(): Promise; project(id: string): Promise; setProject(id: string, change: { paused?: boolean; blocked?: string | null; }): Promise; insertRun(run: RunRecord): Promise; blockProject(id: string, reason: string): Promise; /** * Admit a retry and its events atomically. Safety checks run under the project * lock only for new admissions; they must not write through this Store. */ admitRetry(runId: string, admission: RetryAdmission): Promise; /** Persist recovery intent before dispatch; the command ID is its durable DBOS ID. */ admitRecovery(runId: string, admission: RecoveryAdmission): Promise; recoveryPlan(runId: string): Promise<{ eligible: boolean; reason: string | null; fromStep: string; reuses: string; checks: string; }>; run(id: string): Promise; runs(): Promise; patchRun(id: string, patch: Partial): Promise; saveInvocation(record: InvocationRecord): Promise; invocations(runId: string): Promise; emit(runId: string | null, kind: string, payload: unknown): Promise; private event; events(after?: number, runId?: string): Promise; subscribe(listener: (event: EventRecord) => void, options?: { after?: number; intervalMs?: number; }): () => void; request(kind: "pause" | "resume" | "stop" | "retry" | "retry-refresh" | "recover" | "reload", target: string): Promise; commands(): Promise>; finishCommand(id: string, error?: string): Promise; } export {};