/** * `vincentt dx --send` — the one place anything from the journal leaves the * machine. * * The journal itself is local and unconditional. Sending is neither: it happens * only when a creator types this flag, and only after they have been shown the * exact payload. That ordering is the whole consent model — a report is an act, * not a background transmission — so nothing in this file may be called from a * path the creator did not ask for. * * What goes: the SHAPE of the friction (skeleton, counts, timing, error class * names) plus the CLI version and platform. What never goes: the raw journal, * flag values, paths, error messages, or anything about which project this was. * The server re-validates all of it — a client that leaked a value cannot * persist it by asking — but the boundary is drawn here first, because a payload * that needs server-side scrubbing was built wrong. */ import type { Cluster } from "./clusters.js"; /** A finding as it goes on the wire. Mirrors the API's dxFindingRequest. */ export interface WireFinding { kind: "error" | "repetition"; skeleton: string; calls: number; errors: number; spanMs: number; errorClasses?: string[]; note?: string; } export interface WireReport { cliVersion: string; platform: string; findings: WireFinding[]; } /** * The server bounds a report at 50 findings and refuses the whole thing past * that, so the worst clusters are sent rather than the request rejected. They * arrive ranked, so this is a head, not a sample. */ export declare const MAX_SENT_FINDINGS = 50; export declare function platformTag(): string; /** * Build the wire payload from ranked clusters. * * Every field here is derived from the journal's own skeletonized entries — this * function reads counts and timings, never values. If a future journal field * carries content, it must not be added to this mapping without the same * scrutiny the skeleton got. */ export declare function buildReport(clusters: Cluster[], cliVersion: string, note?: string): WireReport; /** * Render the payload for the creator to read BEFORE it is sent. * * This is not a summary of the payload — it is the payload, formatted. A preview * that paraphrased what would be sent would be exactly the wrong thing to show * someone deciding whether to send it. */ export declare function renderPayload(report: WireReport): string[]; export interface SendResult { ref: string; findings: number; expiresAt: string; } export declare class DXSendError extends Error { readonly status?: number | undefined; constructor(message: string, status?: number | undefined); } /** * POST the report. The caller has already shown the payload and had it accepted. */ export declare function postReport(apiUrl: string, pat: string, report: WireReport, fetchImpl?: typeof fetch): Promise;