/** * Backend platform tool types. * * The artifact pipeline (image/video) used by the browser platform is reused via * `ArtifactType` in core; backend additionally needs HTTP_BODY for response * bodies that spill to disk. Until a separate enum is introduced upstream, large * bodies still ride the `IMAGE`/`VIDEO`-prefixed presigned-URL flow with a * generic mimeType — collector events keep the right mimeType so consumers can * tell them apart. */ export interface MessageRecord { /** Frame kind. Control frames (ping/pong) only appear when includeControlFrames is true. */ kind: 'text' | 'binary' | 'ping' | 'pong'; /** Decoded text payload (for text frames). */ data?: string; /** Byte size of binary payload. */ binarySizeBytes?: number; /** Path of spilled binary payload when above the maxFrameBytes threshold. */ binaryFilePath?: string; /** Wall-clock timestamp (ms). */ ts: number; /** Milliseconds since the WebSocket open event. */ relativeMs: number; } export interface CloseFrame { code: number; reason: string; initiator: 'client' | 'server'; } export type WSConnectionState = 'opening' | 'open' | 'closing' | 'closed'; export interface WSConnectionStats { messagesSent: number; messagesReceived: number; bytesSent: number; bytesReceived: number; bufferOverflowed: number; }