import type { AxiosInstance } from 'axios'; export interface CheckResult { id: string; checkId: string; name: string; hasFailures: boolean; hasErrors: boolean; isDegraded: boolean | null; overMaxResponseTime: boolean | null; runLocation: string; startedAt: string; stoppedAt: string; created_at: string; responseTime: number; checkRunId: number; attempts: number; resultType: 'FINAL' | 'ATTEMPT'; sequenceId?: string | null; errorGroupIds?: string[] | null; apiCheckResult?: ApiCheckResult | null; browserCheckResult?: BrowserCheckResult | null; multiStepCheckResult?: MultiStepCheckResult | null; agenticCheckResult?: AgenticCheckResult | null; tracerouteCheckResult?: TracerouteCheckResult | null; grpcCheckResult?: GrpcCheckResult | null; sslCheckResult?: SslCheckResult | null; } export interface ApiCheckAssertion { source: string; comparison: string; target: string | number; property?: string; } export interface ApiCheckResult { assertions: ApiCheckAssertion[] | null; request: { method: string; url: string; data: string; headers: Record; params: Record; }; response: { status: number; statusText: string; body: string; headers: Record | null; timings: { socket: number; lookup: number; connect: number; response: number; end: number; } | null; timingPhases: { wait: number; dns: number; tcp: number; firstByte: number; download: number; total: number; } | null; }; requestError: string | null; jobLog: unknown | null; jobAssets: string[] | null; pcapDataUrl: string | null; } export interface WebVitalEntry { score: 'GOOD' | 'NEEDS_IMPROVEMENT' | 'POOR'; value: number; } export interface BrowserCheckResult { type: string; traceSummary: { consoleErrors: number; networkErrors: number; documentErrors: number; userScriptErrors: number; }; errors: string[]; pages: Array<{ url: string; webVitals: { CLS?: WebVitalEntry; FCP?: WebVitalEntry; LCP?: WebVitalEntry; TBT?: WebVitalEntry; TTFB?: WebVitalEntry; }; }>; startTime: number; endTime: number; runtimeVersion: string; jobLog: Array<{ time: number; msg: string; level: string; }> | null; jobAssets: string[] | null; playwrightTestVideos?: string[]; playwrightTestTraces?: string[]; playwrightTestJsonReportFile?: string; } export interface MultiStepCheckResult { errors: string[]; startTime: number; endTime: number; runtimeVersion: string; jobLog: Array<{ time: number; msg: string; level: string; }> | null; jobAssets: string[] | null; playwrightTestTraces?: string[]; playwrightTestJsonReportFile?: string; } export interface AgenticAssertion { condition?: string | null; passed?: boolean | null; actual?: string | null; expected?: string | null; } export interface AgenticSuggestion { summary?: string | null; prompt?: string | null; secrets?: string[] | null; category?: 'credentials' | 'endpoint' | 'configuration' | null; } export interface AgenticStep { type?: 'tool_call' | 'tool_result' | 'message' | null; name?: string | null; input?: Record | null; output?: string | null; timestamp?: string | null; sequenceNumber?: number | null; } /** * The agentic check result shape returned by the public API for AGENTIC * checks. Every field is optional/nullable on purpose: the agentic product * is still early-stage, and the backend may reshape this payload under a * new API version. Consumers should degrade gracefully when fields are * missing rather than assume a particular structure. * * Note: `model`, `costUsd`, and `tokensUsed` exist in the runner's raw * metadata but are intentionally NOT part of the public response shape. * The backend strips them from the serialized response today, and the CLI * does not render them even if they ever re-appear on an envelope it * receives. */ export interface AgenticCheckResult { summary?: string | null; prompt?: string | null; assertions?: AgenticAssertion[] | null; suggestions?: AgenticSuggestion[] | null; steps?: AgenticStep[] | null; errors?: Array<{ error?: { message?: string | null; } | null; }> | null; artifactManifest?: Record | null; jobLog?: unknown | null; jobAssets?: string[] | null; } export interface TracerouteCheckResult { totalHops?: number | null; destinationReached?: boolean | null; finalHopLatency?: Record | null; timingPhases?: Record | null; requestError?: string | null; request?: Record | null; assertions?: Array> | null; response?: { hostname?: string | null; resolvedIp?: string | null; totalHops?: number | null; destinationReached?: boolean | null; truncationReason?: string | null; finalHopLatency?: Record | null; hops?: Array> | null; protocol?: string | null; probeProtocol?: string | null; } | null; } export interface GrpcCheckResult { grpcStatusCode?: number | null; healthStatus?: number | null; timingPhases?: Record | null; requestError?: string | null; request?: Record | null; assertions?: Array> | null; response?: { grpcMode?: string | null; host?: string | null; resolvedIp?: string | null; port?: number | null; grpcMethod?: string | null; responseMessage?: string | null; grpcStatusCode?: number | null; grpcStatusMessage?: string | null; healthStatus?: number | null; healthStatusLabel?: string | null; metadata?: Array> | null; discoveredMethods?: string[] | null; requestError?: string | null; timingPhases?: Record | null; } | null; } export interface SslCheckResult { tlsVersion?: string | null; cipherSuite?: string | null; daysUntilExpiry?: number | null; handshakeTimeMs?: number | null; chainTrusted?: boolean | null; hostnameVerified?: boolean | null; baselineVerdict?: string | null; baselineGrade?: string | null; failureCategory?: string | null; requestError?: string | null; request?: Record | null; assertions?: Array> | null; response?: { resolvedIp?: string | null; protocol?: string | null; cipherSuite?: string | null; handshakeTimeMs?: number | null; hostnameVerified?: boolean | null; chainTrusted?: boolean | null; daysUntilExpiry?: number | null; ocspStapled?: boolean | null; securityBaseline?: Record | null; certificate?: Record | null; chain?: Array> | null; } | null; } export interface CheckResultsPage { length: number; entries: CheckResult[]; nextId: string | null; } export type CheckResultField = 'id' | 'name' | 'checkId' | 'hasFailures' | 'hasErrors' | 'isDegraded' | 'isCancelled' | 'overMaxResponseTime' | 'runLocation' | 'startedAt' | 'stoppedAt' | 'created_at' | 'createdAt' | 'responseTime' | 'apiCheckResult' | 'browserCheckResult' | 'multiStepCheckResult' | 'agenticCheckResult' | 'tracerouteCheckResult' | 'grpcCheckResult' | 'sslCheckResult' | 'playwrightCheckResult' | 'checkRunId' | 'attempts' | 'resultType' | 'sequenceId' | 'traceId' | 'errorGroupIds'; export interface ListCheckResultsParams { limit?: number; nextId?: string; from?: number; to?: number; hasFailures?: boolean; resultType?: 'FINAL' | 'ATTEMPT' | 'ALL'; fields?: CheckResultField[]; } declare class CheckResults { api: AxiosInstance; constructor(api: AxiosInstance); getAll(checkId: string, params?: ListCheckResultsParams): Promise>; get(checkId: string, checkResultId: string): Promise>; } export default CheckResults;