import type { RemediationResult } from './remediation-contract.js'; export interface InternalizationIntegrityRemediationOptions { workspaceDir: string; } export declare class InternalizationIntegrityRemediation { private readonly dbPath; constructor(opts: InternalizationIntegrityRemediationOptions); repair(params: { dryRun: boolean; }): RemediationResult; private detectBrokenDreamers; /** * Detect tasks that are still 'leased' with an expired lease. * These are tasks where the lease owner crashed or the runner failed * before releasing/renewing the lease. */ private detectStuckLeases; /** * Detect runs that are 'running' but their owning task is no longer * in 'leased' state. These are orphan runs from crashed/completed * runners that didn't properly close the run record. */ private detectOrphanedRuns; /** * Detect run rows that fail TypeBox schema validation against * RunRecordSchema — the exact failure mode that throws MalformedRunError * from SqliteRunStore and historically blocked runner recovery. * * Detection reuses SqliteRunStore.rowToRecord() (the SAME validation used * by production reads — EP-01: no duplicated schema logic that can drift). * rowToRecord throws PDRuntimeError{storage_unavailable} for invalid rows; * we capture the validation message. */ private detectMalformedRuns; private getTaskStatus; private getRunStatus; private requeueTask; /** * Force-expire a stuck lease: set task to 'pending' and mark the latest * running run as 'failed' with a reason. */ private forceExpireAndMarkRunFailed; /** * Mark an orphaned running run as 'failed'. When the owning task still * exists and is in a terminal/failed/retry_wait state, the run should * reflect the terminal outcome. */ private markOrphanedRunFailed; /** * Quarantine a schema-malformed run row: mark it failed + storage_unavailable. * * Conservative by design: * - NEVER deletes the row (audit history preserved) * - NEVER marks as succeeded (would forge a successful run) * - The reason records the validation error so operators can trace root cause */ private quarantineMalformedRun; private findExistingSuccessor; private createPhilosopherSuccessor; /** * Helper to check if input_payload and output_payload exist in the database. */ private static checkRunsSchema; /** * Helper to update a run row under a database transaction with pre-write * and post-write schema validation checks. Rollback is triggered on error. */ private safeUpdateRunRow; /** * Helper to insert a run row under a database transaction with pre-write * and post-write schema validation checks. Rollback is triggered on error. */ private safeInsertRunRow; /** * Detect tasks that succeeded but have no succeeded run record. */ private detectSucceededTasksWithoutSucceededRun; /** * Supplements a canonical succeeded run for a succeeded task. * Resolves runtime kind from task's existing runs or defaults to 'openclaw'. */ private supplementSucceededRun; } //# sourceMappingURL=internalization-integrity-remediation.d.ts.map