@openai/agents-openai
Version:
The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.
43 lines (42 loc) • 2.54 kB
TypeScript
export type WebSocketMessageValue = string | Blob | ArrayBuffer | ArrayBufferView;
export type ResponsesWebSocketKeepAliveOptions = {
/**
* Time in milliseconds between keepalive pings sent by the client.
*
* Set to null to disable client keepalive pings.
*/
pingIntervalMs?: number | null;
/**
* Time in milliseconds to wait for a pong response before closing the socket.
*
* Set to null to keep pings enabled but disable heartbeat timeouts.
*/
pingTimeoutMs?: number | null;
};
export declare const RESPONSES_WEBSOCKET_ERROR_MESSAGES: {
readonly connection_closed_before_opening: "Responses websocket connection closed before opening.";
readonly connection_closed_before_terminal_response_event: "Responses websocket connection closed before a terminal response event.";
readonly pong_timeout: "Responses websocket pong timeout.";
readonly socket_not_open: "Responses websocket is not open.";
};
export type ResponsesWebSocketInternalErrorCode = keyof typeof RESPONSES_WEBSOCKET_ERROR_MESSAGES;
export declare class ResponsesWebSocketInternalError extends Error {
readonly code: ResponsesWebSocketInternalErrorCode;
constructor(code: ResponsesWebSocketInternalErrorCode, message?: string);
}
export declare function throwIfAborted(signal: AbortSignal | undefined): void;
export declare function withAbortSignal<T>(promise: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number | undefined, errorMessage: string): Promise<T>;
export declare function webSocketFrameToText(frame: WebSocketMessageValue): Promise<string>;
export declare function shouldWrapNoEventWebSocketError(error: unknown): boolean;
export declare function isWebSocketNotOpenError(error: unknown): boolean;
export declare class ResponsesWebSocketConnection {
#private;
constructor(socket: WebSocket, keepAliveOptions?: ResponsesWebSocketKeepAliveOptions);
static connect(url: string, headers: Record<string, string>, signal: AbortSignal | undefined, timeoutMs?: number, timeoutErrorMessage?: string, keepAliveOptions?: ResponsesWebSocketKeepAliveOptions): Promise<ResponsesWebSocketConnection>;
waitForOpen(signal: AbortSignal | undefined, timeoutMs?: number, timeoutErrorMessage?: string): Promise<void>;
send(data: string): Promise<void>;
isReusable(): boolean;
nextFrame(signal: AbortSignal | undefined): Promise<WebSocketMessageValue | null>;
close(): Promise<void>;
}