import type { Annotation } from "../../runDirectory/annotations.js"; import type { EventEnvelope } from "../../statelog/wireTypes.js"; /** * What the server holds for a trace, as proven by the server: * - `missing`: no such trace. * - `empty`: the trace exists with no log rows. * - `live`: only rows without a bulk `sequence` (streamed while running). * - `bulk-prefix`: every row is sequenced and they are exactly * `0..nextSequence-1`, so an upload may resume at `nextSequence`. * - `invalid`: mixed live and bulk rows, or duplicate or gapped sequences; * nothing can be added without risking a duplicated or torn trace. */ export type RemoteTraceState = { kind: "missing"; } | { kind: "empty"; } | { kind: "live"; eventCount: number; } | { kind: "bulk-prefix"; eventCount: number; nextSequence: number; } | { kind: "invalid"; eventCount: number; reason: string; }; /** One event with its position in the trace's file, 0-based. */ export type SequencedEvent = { sequence: number; envelope: EventEnvelope; }; export type EvalUploadClient = { traceUploadState(traceId: string): Promise; /** At most `EVENTS_PER_REQUEST` events. An empty list creates the trace. */ postEvents(traceId: string, events: readonly SequencedEvent[]): Promise; /** Upsert by deterministic id; the server recomputes the id before writing. */ postAnnotations(rows: readonly Annotation[]): Promise; }; export declare const EVENTS_PER_REQUEST = 500; export declare class EvalUploadError extends Error { readonly status: number | undefined; constructor(message: string, status?: number); } export declare function createEvalUploadClient(origin: string, projectSlug: string, apiKey: string): EvalUploadClient;