import { type GreprApiClient } from './grepr-api-client.js'; import { type SchemaInvestigationTranscript, type SchemaTranscriptTurn } from '../openapi/openApiTypes.js'; type InvestigationReader = Pick; type TurnsReader = Pick; export interface TurnsPage { investigationId: string; turns: SchemaTranscriptTurn[]; hasMore: boolean; nextAfterSeq: number; } /** Validate the cursor contract instead of silently treating a malformed response as empty. */ export declare function readTurnsPage(client: TurnsReader, investigationId: string, afterSeq: number, pageSize: number, signal?: AbortSignal): Promise; export interface ReadFailure { message: string; status?: number; } interface ReadOptions { timeoutMs: number; signal?: AbortSignal; } /** One deadline includes auth, requests, retries and polling sleeps. */ export declare class ReadDeadline { private readonly options; private readonly controller; private readonly timer; reason: 'timeout' | 'interrupted' | undefined; lastError: ReadFailure | undefined; private readonly interrupt; constructor(options: ReadOptions); private stop; close(): void; sleep(ms: number): Promise; read(read: (signal: AbortSignal) => Promise): Promise; /** Run a single request within the deadline, without retrying failures. */ readOnce(read: (signal: AbortSignal) => Promise): Promise; } interface CaptureOptions extends ReadOptions { maxTurns?: number; all?: boolean; } export interface TranscriptCapture { investigation: SchemaInvestigationTranscript | null; investigationId: string; turns: SchemaTranscriptTurn[]; coverage: { afterSeq: number; lastSeq: number; turnCount: number; hasMore: boolean | null; limitReached: boolean; reason: 'caught-up' | 'limit' | 'timeout' | 'interrupted'; startedAt: string; capturedAt: string; lastError?: ReadFailure; }; } /** Captures available history with an explicit bound; never claims an atomic final snapshot. */ export declare function captureTranscript(client: InvestigationReader, investigationId: string, options: CaptureOptions): Promise; export type InvestigationEvent = { type: 'status'; investigationId: string; investigation: SchemaInvestigationTranscript; } | { type: 'turn'; investigationId: string; turn: SchemaTranscriptTurn; } | { type: 'end'; investigationId: string; nextAfterSeq: number; reason: 'paused' | 'terminal' | 'timeout' | 'interrupted'; lastError?: ReadFailure; }; /** Follow is a local reader. Cancelling iteration or its signal never controls the investigation. */ export declare function followInvestigation(client: InvestigationReader, investigationId: string, options: ReadOptions & { afterSeq?: number; pageSize?: number; }): AsyncGenerator; export {}; //# sourceMappingURL=investigation-transcript.d.ts.map