import { JsonValue } from './types.js';

declare const RIDDLE_PROOF_PROFILE_VERSION: "riddle-proof.profile.v1";
declare const RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION: "riddle-proof.profile-evidence.v1";
declare const RIDDLE_PROOF_PROFILE_RESULT_VERSION: "riddle-proof.profile-result.v1";
declare const RIDDLE_PROOF_PROFILE_STATUSES: readonly ["passed", "product_regression", "proof_insufficient", "environment_blocked", "configuration_error", "needs_human_review"];
declare const RIDDLE_PROOF_PROFILE_CHECK_TYPES: readonly ["route_loaded", "url_search_param_equals", "url_search_param_absent", "selector_visible", "selector_absent", "selector_count_at_least", "selector_count_equals", "selector_count_equal", "selector_count_eq", "dialog_count_equals", "dialog_accept_count_equals", "dialog_dismiss_count_equals", "selector_text_visible", "selector_text_absent", "selector_text_order", "observe_within", "frame_text_visible", "frame_url_equals", "frame_url_matches", "frame_no_horizontal_overflow", "text_visible", "text_absent", "http_status", "link_status", "artifact_link_status", "route_inventory", "no_horizontal_overflow", "no_mobile_horizontal_overflow", "no_fatal_console_errors", "no_console_warnings"];
declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "tap", "tap_until", "drag", "press", "key_down", "key_up", "fill", "set_input_value", "set_range_value", "deterministic_runtime", "canvas_signature", "assert_text_visible", "assert_text_absent", "assert_selector_count", "assert_window_value", "assert_window_number", "local_storage", "session_storage", "clear_storage", "clear_console", "dialog_response", "screenshot", "wait", "wait_for_selector", "wait_for_text", "window_eval", "window_call", "window_call_until"];
type RiddleProofProfileStatus = typeof RIDDLE_PROOF_PROFILE_STATUSES[number];
type RiddleProofProfileCheckType = typeof RIDDLE_PROOF_PROFILE_CHECK_TYPES[number];
type RiddleProofProfileSetupActionType = typeof RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES[number];
declare const RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES: readonly ["aborted", "accessdenied", "addressunreachable", "blockedbyclient", "blockedbyresponse", "connectionaborted", "connectionclosed", "connectionfailed", "connectionrefused", "connectionreset", "internetdisconnected", "namenotresolved", "timedout", "failed"];
type RiddleProofProfileNetworkAbortErrorCode = typeof RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES[number];
type RiddleProofProfileRunner = "riddle" | "local-playwright" | "browserless" | "github-actions" | (string & {});
type RiddleProofProfileFailureAction = "fail" | "neutral" | "review";
type RiddleProofProfileBaselinePolicy = "invariant_only" | "production_comparison" | "last_accepted_artifact" | "golden_reference_artifact" | (string & {});
interface RiddleProofArtifactBodyAssertionInput {
    artifact_text: string;
    candidates: string[];
    required?: string[];
}
interface RiddleProofArtifactBodyAssertionResult {
    version: "riddle-proof.artifact-body-assertions.v1";
    ok: boolean;
    body_contains: string[];
    present_candidates: string[];
    missing_candidates: string[];
    missing_required: string[];
    warnings: string[];
}
interface RiddleProofProfileHttpStatusPreflightFetchResponse {
    status?: number;
    statusText?: string;
    headers?: {
        get?: (name: string) => string | null;
    };
    arrayBuffer?: () => Promise<ArrayBuffer>;
    text?: () => Promise<string>;
}
type RiddleProofProfileHttpStatusPreflightFetch = (url: string, init?: Record<string, unknown>) => Promise<RiddleProofProfileHttpStatusPreflightFetchResponse>;
type RiddleProofProfileJsonValueType = "array" | "boolean" | "null" | "number" | "object" | "string";
interface RiddleProofProfileHttpStatusBodyJsonAssertion {
    label?: string;
    path: string;
    exists?: boolean;
    equals?: JsonValue;
    not_equals?: JsonValue;
    contains?: JsonValue;
    type?: RiddleProofProfileJsonValueType;
}
interface RiddleProofProfileHttpStatusBodyJsonAssertionResult {
    label: string;
    path: string;
    ok: boolean;
    exists: boolean;
    observed?: JsonValue;
    observed_sample?: JsonValue;
    observed_length?: number;
    observed_key_count?: number;
    observed_omitted_count?: number;
    observed_type: RiddleProofProfileJsonValueType | "missing";
    expected_exists?: boolean;
    equals?: JsonValue;
    not_equals?: JsonValue;
    contains?: JsonValue;
    type?: RiddleProofProfileJsonValueType;
    errors?: string[];
}
interface RiddleProofProfileHttpStatusPreflightOptions {
    fetchImpl?: RiddleProofProfileHttpStatusPreflightFetch;
    target_url?: string;
}
interface RiddleProofProfileHttpStatusPreflightCheckResult {
    index: number;
    label: string;
    url: string;
    method: string;
    ok: boolean;
    status: number | null;
    status_text: string;
    error: string | null;
    content_type: string | null;
    content_length: number | null;
    bytes: number | null;
    body_contains: Record<string, boolean> | null;
    body_contains_missing: string[];
    body_not_contains: Record<string, boolean> | null;
    body_not_contains_found: string[];
    body_not_patterns: Record<string, boolean> | null;
    body_not_patterns_found: string[];
    body_json_assertions: RiddleProofProfileHttpStatusBodyJsonAssertionResult[] | null;
    body_json_assertions_failed: RiddleProofProfileHttpStatusBodyJsonAssertionResult[];
}
interface RiddleProofProfileHttpStatusPreflightResult {
    version: "riddle-proof.profile-http-status-preflight.v1";
    ok: boolean;
    profile_name: string;
    target_url: string;
    checked: number;
    failed: number;
    checks: RiddleProofProfileHttpStatusPreflightCheckResult[];
    summary: string;
}
declare function deriveRiddleProofArtifactBodyAssertions(input: RiddleProofArtifactBodyAssertionInput): RiddleProofArtifactBodyAssertionResult;
interface RiddleProofProfileViewport {
    name: string;
    width: number;
    height: number;
}
interface RiddleProofProfileSetupAction {
    type: RiddleProofProfileSetupActionType;
    selector?: string;
    frame_selector?: string;
    frame_index?: number;
    full_page?: boolean;
    force?: boolean;
    fallback_to_tap?: boolean;
    click_count?: number;
    coordinate_mode?: "pixels" | "ratio";
    pointer_type?: "mouse" | "touch" | "pen";
    from_x?: number;
    from_y?: number;
    to_x?: number;
    to_y?: number;
    duration_ms?: number;
    steps?: number;
    key?: string;
    hold_ms?: number;
    value?: string;
    value_json?: JsonValue;
    random_queue?: number[];
    now?: number;
    advance_ms?: number;
    append?: boolean;
    restore?: boolean;
    label?: string;
    script?: string;
    path?: string;
    args?: JsonValue[];
    expect_return?: JsonValue;
    store_return_to?: string;
    capture_return?: boolean;
    return_summary_fields?: RiddleProofProfileReturnSummaryField[];
    compare_to?: string;
    expect_changed?: boolean;
    until_path?: string;
    until_expected_value?: JsonValue;
    expected_path?: string;
    expected_url?: string;
    max_calls?: number;
    tap_burst_size?: number;
    settle_ms?: number;
    interval_ms?: number;
    expected_value?: JsonValue;
    min_value?: number;
    max_value?: number;
    text?: string;
    pattern?: string;
    flags?: string;
    accept?: boolean;
    prompt_text?: string;
    message_text?: string;
    message_pattern?: string;
    index?: number;
    expected_count?: number;
    ms?: number;
    timeout_ms?: number;
    after_ms?: number;
    repeat?: number;
    reload?: boolean;
    storage?: "local" | "session" | "both";
    viewports?: string[];
    optional?: boolean;
    continue_on_failure?: boolean;
}
interface RiddleProofProfileReturnSummaryField {
    path: string;
    label?: string;
}
interface RiddleProofProfileNetworkMockResponse {
    label?: string;
    status: number;
    content_type?: string;
    headers?: Record<string, string>;
    body?: string;
    body_json?: JsonValue;
    delay_ms?: number;
    abort?: boolean;
    abort_error_code?: RiddleProofProfileNetworkAbortErrorCode;
    capture_request_body?: boolean;
    request_body_contains?: string[];
    request_body_patterns?: string[];
    request_body_not_contains?: string[];
    request_body_not_patterns?: string[];
}
interface RiddleProofProfileNetworkMock extends RiddleProofProfileNetworkMockResponse {
    label: string;
    url: string;
    method?: string;
    responses?: RiddleProofProfileNetworkMockResponse[];
    repeat_responses?: boolean;
    sequence_scope?: "global" | "viewport";
    required_hit_count?: number;
    max_hit_count?: number;
    forbidden?: boolean;
    required?: boolean;
    capture_request_body?: boolean;
    request_body_contains?: string[];
    request_body_patterns?: string[];
    request_body_not_contains?: string[];
    request_body_not_patterns?: string[];
}
interface RiddleProofProfileRouteInventoryRoute {
    name?: string;
    path: string;
}
interface RiddleProofProfileTarget {
    url?: string;
    route?: string;
    viewports: RiddleProofProfileViewport[];
    auth?: "none" | (string & {});
    timeout_sec?: number;
    wait_for_selector?: string;
    wait_ms?: number;
    screenshot_full_page?: boolean;
    setup_actions?: RiddleProofProfileSetupAction[];
    network_mocks?: RiddleProofProfileNetworkMock[];
}
interface RiddleProofProfileCheck {
    type: RiddleProofProfileCheckType;
    label?: string;
    expected_path?: string;
    param?: string;
    expected_value?: string;
    expected_url?: string;
    expected_routes?: RiddleProofProfileRouteInventoryRoute[];
    selector?: string;
    url?: string;
    method?: string;
    headers?: Record<string, string>;
    body?: string;
    body_json?: JsonValue;
    body_contains?: string[];
    body_not_contains?: string[];
    body_not_patterns?: string[];
    body_json_assertions?: RiddleProofProfileHttpStatusBodyJsonAssertion[];
    expected_texts?: string[];
    link_selector?: string;
    source_selector?: string;
    route_path_prefix?: string;
    route_ready_selector?: string;
    route_ready_text?: string;
    route_ready_pattern?: string;
    route_ready_flags?: string;
    text?: string;
    pattern?: string;
    flags?: string;
    viewports?: string[];
    allowed_console_texts?: string[];
    allowed_console_patterns?: string[];
    allowed_page_error_texts?: string[];
    allowed_page_error_patterns?: string[];
    min_count?: number;
    expected_count?: number;
    expected_status?: number;
    allowed_statuses?: number[];
    max_links?: number;
    same_origin_only?: boolean;
    dedupe?: boolean;
    require_nonzero_bytes?: boolean;
    min_bytes?: number;
    allowed_content_types?: string[];
    allow_get_fallback?: boolean;
    max_overflow_px?: number;
    timeout_ms?: number;
    run_direct_routes?: boolean;
    run_clickthroughs?: boolean;
    run_all_viewports?: boolean;
    require_unique_routes?: boolean;
    allow_unexpected_routes?: boolean;
    save_route_screenshots?: boolean;
}
interface RiddleProofProfile {
    version: typeof RIDDLE_PROOF_PROFILE_VERSION;
    name: string;
    target: RiddleProofProfileTarget;
    checks: RiddleProofProfileCheck[];
    artifacts: string[];
    baseline_policy: RiddleProofProfileBaselinePolicy;
    failure_policy: Partial<Record<RiddleProofProfileStatus, RiddleProofProfileFailureAction>>;
    metadata?: Record<string, JsonValue>;
}
interface RiddleProofProfileRouteEvidence {
    requested: string;
    observed: string;
    expected_path?: string;
    matched: boolean;
    http_status?: number | null;
    error?: string;
}
interface RiddleProofProfileBoundsOffender {
    selector?: string | null;
    tag?: string | null;
    text?: string | null;
    overflow?: number;
    overflow_px?: number;
    left_overflow_px?: number;
    right_overflow_px?: number;
    bounds_overflow_px?: number;
    clipped?: Record<string, unknown>;
    rect?: Record<string, unknown>;
    bounds?: Record<string, unknown>;
    viewport_width?: number;
    viewportWidth?: number;
    [key: string]: unknown;
}
interface RiddleProofProfileViewportEvidence {
    name: string;
    width: number;
    height: number;
    url?: string;
    route: RiddleProofProfileRouteEvidence;
    title?: string;
    body_text_length?: number;
    body_text_sample?: string;
    scroll_width?: number;
    client_width?: number;
    overflow_px?: number;
    bounds_overflow_px?: number;
    overflow_offenders?: RiddleProofProfileBoundsOffender[];
    selectors?: Record<string, {
        count: number;
        visible_count: number;
    }>;
    frames?: Record<string, Record<string, JsonValue>>;
    text_sequences?: Record<string, Record<string, JsonValue>>;
    text_matches?: Record<string, boolean>;
    text_match_samples?: Record<string, string[]>;
    text_case_insensitive_samples?: Record<string, string[]>;
    observations?: Record<string, Record<string, JsonValue>>;
    http_statuses?: Record<string, Record<string, JsonValue>>;
    link_statuses?: Record<string, Record<string, JsonValue>>;
    route_inventory?: Record<string, JsonValue>;
    setup_action_results?: Array<Record<string, JsonValue>>;
    screenshot_label?: string;
    screenshot_full_page?: boolean | null;
    navigation_error?: string;
    wait_error?: string;
}
interface RiddleProofProfileEvidence {
    version: typeof RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION;
    profile_name: string;
    target_url: string;
    baseline_policy: RiddleProofProfileBaselinePolicy;
    captured_at: string;
    viewports: RiddleProofProfileViewportEvidence[];
    console: {
        events: Array<{
            type: string;
            text: string;
            location?: JsonValue;
        }>;
        fatal_count: number;
    };
    page_errors: Array<{
        message: string;
    }>;
    network_mocks?: Array<Record<string, JsonValue>>;
    dom_summary?: Record<string, JsonValue>;
}
interface RiddleProofProfileCheckResult {
    type: RiddleProofProfileCheckType | (string & {});
    label?: string;
    status: "passed" | "failed" | "skipped" | "needs_human_review";
    evidence: Record<string, JsonValue>;
    message?: string;
}
interface RiddleProofProfileResult {
    version: typeof RIDDLE_PROOF_PROFILE_RESULT_VERSION;
    profile_name: string;
    runner: RiddleProofProfileRunner;
    status: RiddleProofProfileStatus;
    baseline_policy: RiddleProofProfileBaselinePolicy;
    route: RiddleProofProfileRouteEvidence;
    artifacts: {
        screenshots: string[];
        console?: string;
        proof_json?: string;
        dom_summary?: string;
        riddle_artifacts?: RiddleProofProfileArtifactRef[];
    };
    checks: RiddleProofProfileCheckResult[];
    summary: string;
    captured_at: string;
    metadata?: Record<string, JsonValue>;
    warnings?: string[];
    evidence?: RiddleProofProfileEvidence;
    riddle?: {
        mode?: "split-viewports" | (string & {});
        job_id?: string;
        job_count?: number;
        status?: string | null;
        terminal?: boolean;
        created_at?: string | null;
        submitted_at?: string | null;
        completed_at?: string | null;
        queue_elapsed_ms?: number | null;
        pre_submission_elapsed_ms?: number;
        elapsed_ms?: number;
        attempt?: number;
        attempts?: number;
        timed_out?: boolean;
        retry_count?: number;
        stale_job_ids?: string[];
        artifact_recovery?: boolean;
        split_jobs?: Array<{
            viewport: string;
            job_id?: string;
            status?: string | null;
            terminal?: boolean;
            queue_elapsed_ms?: number | null;
            pre_submission_elapsed_ms?: number;
            elapsed_ms?: number;
            attempt?: number;
            attempts?: number;
            timed_out?: boolean;
            retry_count?: number;
            stale_job_ids?: string[];
            artifact_recovery?: boolean;
        }>;
    };
    environment_blocker?: Record<string, JsonValue>;
    error?: string;
}
interface RiddleProofProfileArtifactRef {
    name: string;
    url?: string;
    path?: string;
    kind?: string;
    content_type?: string;
    source?: string;
}
interface NormalizeRiddleProofProfileOptions {
    url?: string;
    route?: string;
    viewports?: RiddleProofProfileViewport[];
}
declare function slugifyRiddleProofProfileName(value: string): string;
declare function collectRiddleProofProfileWarnings(profile: RiddleProofProfile): string[];
declare function normalizeRiddleProofProfile(input: unknown, options?: NormalizeRiddleProofProfileOptions): RiddleProofProfile;
declare function resolveRiddleProofProfileTargetUrl(profile: RiddleProofProfile): string;
declare function resolveRiddleProofProfileTimeoutSec(profile: RiddleProofProfile, requestedTimeoutSec?: number): number | undefined;
declare function preflightRiddleProofProfileHttpStatusChecks(profile: RiddleProofProfile, options?: RiddleProofProfileHttpStatusPreflightOptions): Promise<RiddleProofProfileHttpStatusPreflightResult>;
declare function resolveRiddleProofProfileRouteUrl(targetUrl: string, route: string): string;
interface RiddleProofProfileArtifactCompleteness {
    ok: boolean;
    required: string[];
    observed: string[];
    missing: string[];
}
declare function assessRiddleProofProfileArtifactCompleteness(profile: RiddleProofProfile, result: RiddleProofProfileResult, artifacts: RiddleProofProfileArtifactRef[]): RiddleProofProfileArtifactCompleteness;
declare function applyRiddleProofProfileArtifactCompleteness(profile: RiddleProofProfile, result: RiddleProofProfileResult, artifacts: RiddleProofProfileArtifactRef[] | undefined): RiddleProofProfileResult;
declare function assessRiddleProofProfileEvidence(profile: RiddleProofProfile, evidence: RiddleProofProfileEvidence | undefined, options?: {
    runner?: RiddleProofProfileRunner;
    riddle?: RiddleProofProfileResult["riddle"];
    artifacts?: RiddleProofProfileArtifactRef[];
}): RiddleProofProfileResult;
declare function summarizeRiddleProofProfileResult(input: {
    profile_name: string;
    status: RiddleProofProfileStatus;
    checks: RiddleProofProfileCheckResult[];
    viewports: RiddleProofProfileViewportEvidence[];
}): string;
declare function profileStatusExitCode(profile: RiddleProofProfile, status: RiddleProofProfileStatus): 0 | 1;
declare function createRiddleProofProfileConfigurationError(name: string, error: unknown, runner?: RiddleProofProfileRunner): RiddleProofProfileResult;
declare function createRiddleProofProfileEnvironmentBlockedResult(input: {
    profile: RiddleProofProfile;
    runner?: RiddleProofProfileRunner;
    error?: unknown;
    environmentBlocker?: Record<string, JsonValue>;
    riddle?: RiddleProofProfileResult["riddle"];
    artifacts?: RiddleProofProfileArtifactRef[];
}): RiddleProofProfileResult;
declare function createRiddleProofProfileInsufficientResult(input: {
    profile: RiddleProofProfile;
    runner?: RiddleProofProfileRunner;
    error?: unknown;
    riddle?: RiddleProofProfileResult["riddle"];
    artifacts?: RiddleProofProfileArtifactRef[];
}): RiddleProofProfileResult;
declare function buildRiddleProofProfileScript(profile: RiddleProofProfile): string;
declare function collectRiddleProfileArtifactRefs(input: unknown): RiddleProofProfileArtifactRef[];
declare function extractRiddleProofProfileResult(input: unknown): RiddleProofProfileResult | undefined;

export { type NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, type RiddleProofArtifactBodyAssertionInput, type RiddleProofArtifactBodyAssertionResult, type RiddleProofProfile, type RiddleProofProfileArtifactCompleteness, type RiddleProofProfileArtifactRef, type RiddleProofProfileBaselinePolicy, type RiddleProofProfileBoundsOffender, type RiddleProofProfileCheck, type RiddleProofProfileCheckResult, type RiddleProofProfileCheckType, type RiddleProofProfileEvidence, type RiddleProofProfileFailureAction, type RiddleProofProfileHttpStatusBodyJsonAssertion, type RiddleProofProfileHttpStatusBodyJsonAssertionResult, type RiddleProofProfileHttpStatusPreflightCheckResult, type RiddleProofProfileHttpStatusPreflightFetch, type RiddleProofProfileHttpStatusPreflightFetchResponse, type RiddleProofProfileHttpStatusPreflightOptions, type RiddleProofProfileHttpStatusPreflightResult, type RiddleProofProfileJsonValueType, type RiddleProofProfileNetworkAbortErrorCode, type RiddleProofProfileNetworkMock, type RiddleProofProfileNetworkMockResponse, type RiddleProofProfileResult, type RiddleProofProfileReturnSummaryField, type RiddleProofProfileRouteEvidence, type RiddleProofProfileRouteInventoryRoute, type RiddleProofProfileRunner, type RiddleProofProfileSetupAction, type RiddleProofProfileSetupActionType, type RiddleProofProfileStatus, type RiddleProofProfileTarget, type RiddleProofProfileViewport, type RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult };
