/**
 * paritySubmitClient.ts — Phase-3 dual-forward HTTP client.
 *
 * POSTs the emitter payload (buildParitySubmitPayload) to the Portal's
 * `POST /api/instar/feedback-factory/parity-submit` and parses the LOCKED
 * response shape Dawn deployed 2026-06-08:
 *
 *   { batchId, processed, matched, diverged, errors,
 *     results: [{ feedbackId, action, status, clusterId?, divergenceReason?, error? }] }
 *
 * `status` is the per-item branch predicate (Dawn: "the status field is the branch
 * predicate") — matched | diverged | not_found | error. The verdict is derived from
 * results[] (authoritative per-item), keyed by feedbackId; top-level counts are
 * surfaced for reporting.
 *
 * FAIL-CLOSED (no-silent-degradation standard): a non-2xx response, non-JSON body,
 * or a body that does not match the locked shape THROWS — the dual-forward
 * orchestration must never silently treat a failed/garbled submit as "matched/done".
 * Auth: Bearer <INSTAR_ECHO_READ_TOKEN> (Portal also accepts X-Internal-Key).
 */
import type { ParitySubmitRequest } from './paritySubmit.js';
export declare const DEFAULT_PARITY_SUBMIT_ENDPOINT = "https://dawn.bot-me.ai/api/instar/feedback-factory/parity-submit";
/** Per-item outcome status (Dawn-locked). */
export type ParityItemStatus = 'matched' | 'diverged' | 'not_found' | 'error';
/** One result row (Dawn-locked). */
export interface ParitySubmitResultItem {
    feedbackId: string;
    action: 'merge' | 'create';
    status: ParityItemStatus;
    clusterId?: string;
    /** Present when status='diverged': "Fingerprint mismatch — Echo: …, Portal: …". */
    divergenceReason?: string;
    /** Present when status='error': the unexpected-failure message. */
    error?: string;
}
/** The full parity-submit response body (Dawn-locked). */
export interface ParitySubmitResponse {
    batchId: string;
    processed: number;
    matched: number;
    diverged: number;
    errors: number;
    results: ParitySubmitResultItem[];
}
/** Derived verdict — branch on this, keyed by feedbackId. */
export interface ParitySubmitVerdict {
    response: ParitySubmitResponse;
    /** True iff EVERY result is status='matched' (the clean done-state). */
    allMatched: boolean;
    /** Items needing attention: status 'diverged' or 'not_found' (carry divergenceReason). */
    diverged: ParitySubmitResultItem[];
    /** Items that hit an unexpected Portal-side failure (status='error'). */
    errored: ParitySubmitResultItem[];
    /** Every result keyed by feedbackId for O(1) lookup. */
    byFeedbackId: Map<string, ParitySubmitResultItem>;
}
export interface SubmitParityOptions {
    /** INSTAR_ECHO_READ_TOKEN — sent as `Authorization: Bearer <token>`. Required. */
    token: string;
    /** Override the endpoint (default = the Portal production path). */
    endpoint?: string;
    /** Inject a fetch implementation (for tests / non-global-fetch runtimes). */
    fetchImpl?: typeof fetch;
    /** Abort the request after this many ms (default 30s). */
    timeoutMs?: number;
}
/** Thrown on any fail-closed condition (HTTP error, non-JSON, shape drift). */
export declare class ParitySubmitError extends Error {
    readonly kind: 'http' | 'network' | 'parse' | 'shape';
    readonly detail?: unknown | undefined;
    constructor(message: string, kind: 'http' | 'network' | 'parse' | 'shape', detail?: unknown | undefined);
}
/** Validate a parsed body against the locked shape; throws ParitySubmitError('shape') on drift. */
export declare function parseParitySubmitResponse(data: unknown): ParitySubmitResponse;
/** Build the derived verdict from a validated response (per-item status is authoritative). */
export declare function verdictFromResponse(response: ParitySubmitResponse): ParitySubmitVerdict;
/**
 * POST a parity-submit batch and return the derived verdict.
 *
 * @throws ParitySubmitError — fail-closed on HTTP error / network failure / non-JSON /
 *         shape drift. The caller decides retry/escalate; a failed submit is NEVER
 *         silently treated as success.
 */
export declare function submitParityBatch(payload: ParitySubmitRequest, opts: SubmitParityOptions): Promise<ParitySubmitVerdict>;
//# sourceMappingURL=paritySubmitClient.d.ts.map