import type { ProdDebugConfig } from "../lib/prod-debug.js";
export type ScenarioPriority = "low" | "medium" | "high" | "critical";
export type RunStatus = "pending" | "running" | "passed" | "failed" | "cancelled";
export type ResultStatus = "passed" | "failed" | "error" | "skipped" | "flaky";
export type ModelPreset = "quick" | "thorough" | "deep" | "cerebras-fast" | "cerebras-smart";
export type BrowserEngine = "playwright" | "playwright-firefox" | "playwright-webkit" | "lightpanda" | "bun" | "cdp";
export type AuthStrategy = "form-login" | "bearer" | "cookie" | "oauth" | "custom_script";
export type WorkflowExecutionTarget = "local" | "sandbox";
export type LegacyWorkflowExecutionTarget = WorkflowExecutionTarget | "connector:e2b";
export type WorkflowSandboxCleanup = "delete" | "stop" | "keep";
export type WorkflowSandboxSyncStrategy = "archive" | "rsync";
export type AssertionType = "visible" | "not_visible" | "text_contains" | "text_equals" | "element_count" | "no_console_errors" | "url_contains" | "title_contains" | "no_a11y_violations" | "cookie_exists" | "cookie_value" | "cookie_not_exists" | "local_storage_exists" | "local_storage_value" | "local_storage_not_exists" | "session_storage_value" | "session_storage_not_exists";
export interface Assertion {
    type: AssertionType;
    selector?: string;
    expected?: string | number;
    description?: string;
}
export declare const MODEL_MAP: Record<ModelPreset, string>;
export interface ProjectRow {
    id: string;
    name: string;
    path: string | null;
    description: string | null;
    base_url: string | null;
    port: number | null;
    settings: string | null;
    created_at: string;
    updated_at: string;
}
export interface AgentRow {
    id: string;
    name: string;
    description: string | null;
    role: string | null;
    metadata: string | null;
    created_at: string;
    last_seen_at: string;
}
export interface ScenarioRow {
    id: string;
    short_id: string;
    project_id: string | null;
    name: string;
    description: string;
    steps: string;
    tags: string;
    priority: ScenarioPriority;
    model: string | null;
    timeout_ms: number | null;
    target_path: string | null;
    requires_auth: number;
    auth_config: string | null;
    metadata: string | null;
    assertions: string;
    persona_id: string | null;
    scenario_type: string;
    required_role: string | null;
    version: number;
    created_at: string;
    updated_at: string;
    last_passed_at: string | null;
    last_passed_url: string | null;
    parameters: string | null;
}
export interface RunRow {
    id: string;
    project_id: string | null;
    status: RunStatus;
    url: string;
    model: string;
    headed: number;
    parallel: number;
    total: number;
    passed: number;
    failed: number;
    started_at: string;
    finished_at: string | null;
    metadata: string | null;
    is_baseline: number;
    samples: number;
    flakiness_threshold: number;
    pr_number: number | null;
    pr_title: string | null;
    pr_branch: string | null;
    pr_base_branch: string | null;
    pr_commit_sha: string | null;
    pr_url: string | null;
    gh_app_installation_id: string | null;
}
export interface FailureAnalysis {
    type: "selector_not_found" | "assertion_failed" | "timeout" | "auth_error" | "network_error" | "eval_failed" | "unknown";
    affectedElement?: string;
    affectedUrl?: string;
    expected?: string;
    actual?: string;
    stepNumber?: number;
    confidence: "high" | "medium" | "low";
}
export interface ResultRow {
    id: string;
    run_id: string;
    scenario_id: string;
    status: ResultStatus;
    reasoning: string | null;
    error: string | null;
    steps_completed: number;
    steps_total: number;
    duration_ms: number;
    model: string;
    tokens_used: number;
    cost_cents: number;
    metadata: string | null;
    created_at: string;
    persona_id: string | null;
    persona_name: string | null;
    failure_analysis: string | null;
    har_path: string | null;
}
export interface ScreenshotRow {
    id: string;
    result_id: string;
    step_number: number;
    action: string;
    file_path: string;
    width: number;
    height: number;
    timestamp: string;
    description: string | null;
    page_url: string | null;
    thumbnail_path: string | null;
}
export interface ScheduleRow {
    id: string;
    project_id: string | null;
    name: string;
    cron_expression: string;
    url: string;
    scenario_filter: string;
    model: string | null;
    headed: number;
    parallel: number;
    timeout_ms: number | null;
    enabled: number;
    last_run_id: string | null;
    last_run_at: string | null;
    next_run_at: string | null;
    created_at: string;
    updated_at: string;
}
export interface Project {
    id: string;
    name: string;
    path: string | null;
    description: string | null;
    baseUrl: string | null;
    port: number | null;
    settings: Record<string, unknown>;
    createdAt: string;
    updatedAt: string;
}
export interface CreateProjectInput {
    name: string;
    path?: string;
    description?: string;
    baseUrl?: string;
    port?: number;
    settings?: Record<string, unknown>;
}
export interface UpdateProjectInput {
    name?: string;
    description?: string;
    baseUrl?: string;
    port?: number;
    settings?: Record<string, unknown>;
}
export interface Agent {
    id: string;
    name: string;
    description: string | null;
    role: string | null;
    metadata: Record<string, unknown> | null;
    createdAt: string;
    lastSeenAt: string;
}
export interface Scenario {
    id: string;
    shortId: string;
    projectId: string | null;
    name: string;
    description: string;
    steps: string[];
    tags: string[];
    priority: ScenarioPriority;
    model: string | null;
    timeoutMs: number | null;
    targetPath: string | null;
    requiresAuth: boolean;
    authConfig: AuthConfig | null;
    metadata: Record<string, unknown> | null;
    assertions: Assertion[];
    personaId: string | null;
    scenarioType: "browser" | "eval" | "api" | "pipeline";
    requiredRole: string | null;
    version: number;
    createdAt: string;
    updatedAt: string;
    lastPassedAt: string | null;
    lastPassedUrl: string | null;
    parameters: Record<string, unknown> | null;
    flakinessScore?: number | null;
    recentRunCount?: number;
}
export interface Run {
    id: string;
    projectId: string | null;
    status: RunStatus;
    url: string;
    model: string;
    headed: boolean;
    parallel: number;
    total: number;
    passed: number;
    failed: number;
    startedAt: string;
    finishedAt: string | null;
    metadata: Record<string, unknown> | null;
    isBaseline: boolean;
    samples: number;
    flakinessThreshold: number;
    prNumber: number | null;
    prTitle: string | null;
    prBranch: string | null;
    prBaseBranch: string | null;
    prCommitSha: string | null;
    prUrl: string | null;
    ghAppInstallationId: string | null;
}
export interface Result {
    id: string;
    runId: string;
    scenarioId: string;
    status: ResultStatus;
    reasoning: string | null;
    error: string | null;
    stepsCompleted: number;
    stepsTotal: number;
    durationMs: number;
    model: string;
    tokensUsed: number;
    costCents: number;
    metadata: Record<string, unknown> | null;
    createdAt: string;
    personaId: string | null;
    personaName: string | null;
    failureAnalysis: FailureAnalysis | null;
    harPath: string | null;
}
export interface Screenshot {
    id: string;
    resultId: string;
    stepNumber: number;
    action: string;
    filePath: string;
    width: number;
    height: number;
    timestamp: string;
    description: string | null;
    pageUrl: string | null;
    thumbnailPath: string | null;
}
export interface Schedule {
    id: string;
    projectId: string | null;
    name: string;
    cronExpression: string;
    url: string;
    scenarioFilter: {
        tags?: string[];
        priority?: ScenarioPriority;
        scenarioIds?: string[];
    };
    model: string | null;
    headed: boolean;
    parallel: number;
    timeoutMs: number | null;
    enabled: boolean;
    lastRunId: string | null;
    lastRunAt: string | null;
    nextRunAt: string | null;
    createdAt: string;
    updatedAt: string;
}
export interface CreateScenarioInput {
    name: string;
    description: string;
    steps?: string[];
    tags?: string[];
    priority?: ScenarioPriority;
    model?: string;
    timeoutMs?: number;
    targetPath?: string;
    requiresAuth?: boolean;
    authConfig?: AuthConfig;
    assertions?: Assertion[];
    metadata?: Record<string, unknown>;
    projectId?: string;
    parameters?: Record<string, unknown>;
}
export interface UpdateScenarioInput {
    name?: string;
    description?: string;
    steps?: string[];
    tags?: string[];
    priority?: ScenarioPriority;
    model?: string;
    timeoutMs?: number;
    targetPath?: string;
    requiresAuth?: boolean;
    authConfig?: AuthConfig;
    assertions?: Assertion[];
    metadata?: Record<string, unknown>;
    parameters?: Record<string, unknown>;
}
export interface CreateRunInput {
    url: string;
    scenarioIds?: string[];
    tags?: string[];
    priority?: ScenarioPriority;
    model?: string;
    headed?: boolean;
    parallel?: number;
    timeout?: number;
    projectId?: string;
    samples?: number;
    flakinessThreshold?: number;
    prNumber?: number;
    prTitle?: string;
    prBranch?: string;
    prBaseBranch?: string;
    prCommitSha?: string;
    prUrl?: string;
    ghAppInstallationId?: string;
}
export interface ScenarioFilter {
    projectId?: string;
    tags?: string[];
    priority?: ScenarioPriority;
    search?: string;
    sort?: "date" | "priority" | "name";
    desc?: boolean;
    limit?: number;
    offset?: number;
}
export type RunSortField = "date" | "duration" | "cost";
export interface RunFilter {
    projectId?: string;
    status?: RunStatus;
    since?: string;
    until?: string;
    sort?: "date" | "duration" | "cost";
    desc?: boolean;
    limit?: number;
    offset?: number;
}
export interface CreateScheduleInput {
    name: string;
    cronExpression: string;
    url: string;
    scenarioFilter?: {
        tags?: string[];
        priority?: ScenarioPriority;
        scenarioIds?: string[];
    };
    model?: string;
    headed?: boolean;
    parallel?: number;
    timeoutMs?: number;
    projectId?: string;
}
export interface WorkflowScenarioFilter {
    scenarioIds?: string[];
    tags?: string[];
    priority?: ScenarioPriority;
}
export interface WorkflowExecutionConfig {
    target: WorkflowExecutionTarget;
    provider?: "e2b" | "daytona" | "modal" | string;
    sandboxImage?: string;
    sandboxRemoteDir?: string;
    sandboxCleanup?: WorkflowSandboxCleanup;
    sandboxSyncStrategy?: WorkflowSandboxSyncStrategy;
    setupCommand?: string;
    packageSpec?: string;
    timeoutMs?: number;
    env?: Record<string, string>;
}
export interface WorkflowExecutionInput {
    target?: LegacyWorkflowExecutionTarget;
    provider?: "e2b" | "daytona" | "modal" | string;
    connector?: "e2b" | string;
    operation?: string;
    sandboxImage?: string;
    sandboxTemplate?: string;
    sandboxRemoteDir?: string;
    sandboxCleanup?: WorkflowSandboxCleanup;
    sandboxSyncStrategy?: WorkflowSandboxSyncStrategy;
    setupCommand?: string;
    packageSpec?: string;
    timeoutMs?: number;
    env?: Record<string, string>;
}
export interface WorkflowGoal {
    prompt: string;
    successCriteria: string[];
    maxIterations: number;
}
export interface WorkflowRow {
    id: string;
    project_id: string | null;
    name: string;
    description: string | null;
    scenario_filter: string;
    persona_ids: string;
    goal: string | null;
    execution: string;
    settings: string;
    enabled: number;
    created_at: string;
    updated_at: string;
}
export interface TestingWorkflow {
    id: string;
    projectId: string | null;
    name: string;
    description: string | null;
    scenarioFilter: WorkflowScenarioFilter;
    personaIds: string[];
    goal: WorkflowGoal | null;
    execution: WorkflowExecutionConfig;
    settings: Record<string, unknown>;
    enabled: boolean;
    createdAt: string;
    updatedAt: string;
}
export interface CreateTestingWorkflowInput {
    name: string;
    description?: string;
    projectId?: string;
    scenarioFilter?: WorkflowScenarioFilter;
    personaIds?: string[];
    goal?: Partial<WorkflowGoal> | null;
    execution?: WorkflowExecutionInput;
    settings?: Record<string, unknown>;
    enabled?: boolean;
}
export interface UpdateTestingWorkflowInput {
    name?: string;
    description?: string | null;
    scenarioFilter?: WorkflowScenarioFilter;
    personaIds?: string[];
    goal?: Partial<WorkflowGoal> | null;
    execution?: WorkflowExecutionInput;
    settings?: Record<string, unknown>;
    enabled?: boolean;
}
export declare function workflowExecutionFromValue(value: unknown): WorkflowExecutionConfig;
export declare function workflowFromRow(row: WorkflowRow): TestingWorkflow;
export interface UpdateScheduleInput {
    name?: string;
    cronExpression?: string;
    url?: string;
    scenarioFilter?: {
        tags?: string[];
        priority?: ScenarioPriority;
        scenarioIds?: string[];
    };
    model?: string;
    headed?: boolean;
    parallel?: number;
    timeoutMs?: number;
    enabled?: boolean;
}
export interface ScheduleFilter {
    projectId?: string;
    enabled?: boolean;
    limit?: number;
    offset?: number;
}
export interface AuthConfig {
    email?: string;
    password?: string;
    loginPath?: string;
    tokenHeader?: string;
    token?: string;
}
export interface BrowserConfig {
    headless: boolean;
    viewport: {
        width: number;
        height: number;
    };
    userAgent?: string;
    locale?: string;
    timeout: number;
}
export interface ScreenshotConfig {
    dir: string;
    format: "png" | "jpeg";
    quality: number;
    fullPage: boolean;
}
export interface TestersConfig {
    defaultModel: string;
    defaultImageModel: string;
    models: Record<ModelPreset, string>;
    browser: BrowserConfig;
    screenshots: ScreenshotConfig;
    anthropicApiKey?: string;
    todosDbPath?: string;
    judgeModel?: string;
    judgeProvider?: string;
    selfHeal?: boolean;
    conversationsSpace?: string;
    defaultMaxCostCents?: number;
    prodDebug?: ProdDebugConfig;
}
export declare function projectFromRow(row: ProjectRow): Project;
export declare function agentFromRow(row: AgentRow): Agent;
export declare function scenarioFromRow(row: ScenarioRow): Scenario;
export declare function runFromRow(row: RunRow): Run;
export declare function resultFromRow(row: ResultRow): Result;
export declare function screenshotFromRow(row: ScreenshotRow): Screenshot;
export declare function scheduleFromRow(row: ScheduleRow): Schedule;
export declare class ScenarioNotFoundError extends Error {
    constructor(id: string);
}
export declare class RunNotFoundError extends Error {
    constructor(id: string);
}
export declare class ResultNotFoundError extends Error {
    constructor(id: string);
}
export declare class VersionConflictError extends Error {
    constructor(entity: string, id: string);
}
export declare class BrowserError extends Error {
    constructor(message: string);
}
export declare class AIClientError extends Error {
    constructor(message: string);
}
export declare class TodosConnectionError extends Error {
    constructor(message: string);
}
export declare class ProjectNotFoundError extends Error {
    constructor(id: string);
}
export declare class AgentNotFoundError extends Error {
    constructor(id: string);
}
export declare class ScheduleNotFoundError extends Error {
    constructor(id: string);
}
export type ScanIssueType = "console_error" | "network_error" | "broken_link" | "performance" | "pii_leak" | "injection";
export type ScanIssueSeverity = "critical" | "high" | "medium" | "low";
export type ScanIssueStatus = "open" | "resolved" | "regressed";
/** A single issue found during a page scan. */
export interface ScanIssue {
    type: ScanIssueType;
    severity: ScanIssueSeverity;
    pageUrl: string;
    message: string;
    detail?: Record<string, unknown>;
}
/** Result from running one scanner against one or more pages. */
export interface ScanResult {
    url: string;
    pages: string[];
    scannedAt: string;
    durationMs: number;
    issues: ScanIssue[];
}
/** Persisted scan issue record (with deduplication fields). */
export interface PersistedScanIssue {
    id: string;
    fingerprint: string;
    type: ScanIssueType;
    severity: ScanIssueSeverity;
    pageUrl: string;
    message: string;
    detail: Record<string, unknown> | null;
    status: ScanIssueStatus;
    occurrenceCount: number;
    firstSeenAt: string;
    lastSeenAt: string;
    resolvedAt: string | null;
    todoTaskId: string | null;
    projectId: string | null;
}
/** DB row for scan_issues table. */
export interface ScanIssueRow {
    id: string;
    fingerprint: string;
    type: string;
    severity: string;
    page_url: string;
    message: string;
    detail: string | null;
    status: string;
    occurrence_count: number;
    first_seen_at: string;
    last_seen_at: string;
    resolved_at: string | null;
    todo_task_id: string | null;
    project_id: string | null;
}
export declare function scanIssueFromRow(row: ScanIssueRow): PersistedScanIssue;
export declare class BudgetExceededError extends Error {
    constructor(estimatedCents: number, capCents: number);
}
export declare class ApiCheckNotFoundError extends Error {
    constructor(id: string);
}
export declare class FlowNotFoundError extends Error {
    constructor(id: string);
}
export declare class DependencyCycleError extends Error {
    constructor(scenarioId: string, dependsOn: string);
}
export interface FlowRow {
    id: string;
    project_id: string | null;
    name: string;
    description: string | null;
    scenario_ids: string;
    created_at: string;
    updated_at: string;
}
export interface Flow {
    id: string;
    projectId: string | null;
    name: string;
    description: string | null;
    scenarioIds: string[];
    createdAt: string;
    updatedAt: string;
}
export declare function flowFromRow(row: FlowRow): Flow;
export interface CreateFlowInput {
    name: string;
    description?: string;
    scenarioIds: string[];
    projectId?: string;
}
export declare class PersonaNotFoundError extends Error {
    constructor(id: string);
}
export interface PersonaRow {
    id: string;
    short_id: string;
    project_id: string | null;
    name: string;
    description: string;
    role: string;
    instructions: string;
    traits: string;
    goals: string;
    metadata: string | null;
    enabled: number;
    version: number;
    created_at: string;
    updated_at: string;
    behaviors: string;
    expertise_level: string;
    demographics: string;
    pain_points: string;
    auth_email: string | null;
    auth_password: string | null;
    auth_login_path: string | null;
    auth_cookies: string | null;
    auth_strategy: string | null;
    auth_headers: string | null;
    auth_script: string | null;
}
export interface PersonaAuth {
    email: string;
    password: string;
    loginPath: string;
    cookies: Record<string, unknown>[] | null;
    strategy: AuthStrategy;
    headers?: Record<string, string>;
    customScript?: string;
}
export interface AuthProfile {
    strategy: AuthStrategy;
    email?: string;
    password?: string;
    loginPath?: string;
    emailFieldSelector?: string;
    passwordFieldSelector?: string;
    submitSelector?: string;
    postLoginWaitFor?: string;
    bearerToken?: string;
    cookies?: {
        name: string;
        value: string;
        domain?: string;
        path?: string;
    }[];
    oauthProvider?: string;
    customScript?: string;
    headers?: Record<string, string>;
}
export interface Persona {
    id: string;
    shortId: string;
    projectId: string | null;
    name: string;
    description: string;
    role: string;
    instructions: string;
    traits: string[];
    goals: string[];
    behaviors: string[];
    expertiseLevel: string;
    demographics: Record<string, unknown>;
    painPoints: string[];
    metadata: Record<string, unknown> | null;
    enabled: boolean;
    version: number;
    createdAt: string;
    updatedAt: string;
    auth: PersonaAuth | null;
}
export interface CreatePersonaInput {
    name: string;
    role: string;
    description?: string;
    instructions?: string;
    traits?: string[];
    goals?: string[];
    behaviors?: string[];
    expertiseLevel?: string;
    demographics?: Record<string, unknown>;
    painPoints?: string[];
    projectId?: string;
    enabled?: boolean;
    metadata?: Record<string, unknown>;
    authEmail?: string;
    authPassword?: string;
    authLoginPath?: string;
    authStrategy?: AuthStrategy;
    authHeaders?: Record<string, string>;
    authCustomScript?: string;
}
export interface UpdatePersonaInput {
    name?: string;
    role?: string;
    description?: string;
    instructions?: string;
    traits?: string[];
    goals?: string[];
    behaviors?: string[];
    expertiseLevel?: string;
    demographics?: Record<string, unknown>;
    painPoints?: string[];
    enabled?: boolean;
    metadata?: Record<string, unknown>;
    authEmail?: string;
    authPassword?: string;
    authLoginPath?: string;
    authCookies?: Record<string, unknown>[] | null;
    authStrategy?: AuthStrategy;
    authHeaders?: Record<string, string>;
    authCustomScript?: string;
}
export interface PersonaFilter {
    projectId?: string;
    enabled?: boolean;
    globalOnly?: boolean;
    limit?: number;
    offset?: number;
}
export declare function personaFromRow(row: PersonaRow): Persona;
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
export type ApiCheckStatus = 'passed' | 'failed' | 'error';
export interface ApiCheckRow {
    id: string;
    short_id: string;
    project_id: string | null;
    name: string;
    description: string;
    method: HttpMethod;
    url: string;
    headers: string;
    body: string | null;
    expected_status: number;
    expected_body_contains: string | null;
    expected_response_time_ms: number | null;
    timeout_ms: number;
    tags: string;
    enabled: number;
    version: number;
    created_at: string;
    updated_at: string;
}
export interface ApiCheckResultRow {
    id: string;
    check_id: string;
    run_id: string | null;
    status: ApiCheckStatus;
    status_code: number | null;
    response_time_ms: number | null;
    response_body: string | null;
    response_headers: string;
    error: string | null;
    assertions_passed: string;
    assertions_failed: string;
    metadata: string | null;
    created_at: string;
}
export interface ApiCheck {
    id: string;
    shortId: string;
    projectId: string | null;
    name: string;
    description: string;
    method: HttpMethod;
    url: string;
    headers: Record<string, string>;
    body: string | null;
    expectedStatus: number;
    expectedBodyContains: string | null;
    expectedResponseTimeMs: number | null;
    timeoutMs: number;
    tags: string[];
    enabled: boolean;
    version: number;
    createdAt: string;
    updatedAt: string;
}
export interface ApiCheckResult {
    id: string;
    checkId: string;
    runId: string | null;
    status: ApiCheckStatus;
    statusCode: number | null;
    responseTimeMs: number | null;
    responseBody: string | null;
    responseHeaders: Record<string, string>;
    error: string | null;
    assertionsPassed: string[];
    assertionsFailed: string[];
    metadata: Record<string, unknown> | null;
    createdAt: string;
}
export interface CreateApiCheckInput {
    name: string;
    method?: HttpMethod;
    url: string;
    headers?: Record<string, string>;
    body?: string;
    expectedStatus?: number;
    expectedBodyContains?: string;
    expectedResponseTimeMs?: number;
    timeoutMs?: number;
    tags?: string[];
    description?: string;
    projectId?: string;
    enabled?: boolean;
}
export interface UpdateApiCheckInput {
    name?: string;
    method?: HttpMethod;
    url?: string;
    headers?: Record<string, string>;
    body?: string;
    expectedStatus?: number;
    expectedBodyContains?: string;
    expectedResponseTimeMs?: number;
    timeoutMs?: number;
    tags?: string[];
    description?: string;
    enabled?: boolean;
}
export interface ApiCheckFilter {
    projectId?: string;
    enabled?: boolean;
    tags?: string[];
    limit?: number;
    offset?: number;
}
export declare function apiCheckFromRow(row: ApiCheckRow): ApiCheck;
export declare function apiCheckResultFromRow(row: ApiCheckResultRow): ApiCheckResult;
//# sourceMappingURL=index.d.ts.map