// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import * as MessagesAPI from '../agents/messages'; import { MessagesArrayPage } from '../agents/messages'; import { APIPromise } from '../../core/api-promise'; import { ArrayPage, type ArrayPageParams, PagePromise } from '../../core/pagination'; import { Stream } from '../../core/streaming'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; export class Messages extends APIResource { /** * Get response messages associated with a run. */ list( runID: string, query: MessageListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList(path`/v1/runs/${runID}/messages`, ArrayPage, { query, ...options, }); } /** * Retrieve Stream For Run */ stream( runID: string, body: MessageStreamParams | undefined = {}, options?: RequestOptions, ): APIPromise> { return this._client.post(path`/v1/runs/${runID}/stream`, { body, ...options, stream: true, }) as APIPromise>; } } export type MessageStreamResponse = unknown; export interface MessageListParams extends ArrayPageParams {} export interface MessageStreamParams { /** * Agent ID for agent-direct mode with 'default' conversation. Use with * conversation_id='default' in the URL path. */ agent_id?: string | null; /** * Number of entries to read per batch. */ batch_size?: number | null; /** * Whether to include periodic keepalive ping messages in the stream to prevent * connection timeouts. */ include_pings?: boolean | null; /** * Offline threading ID to look up the run_id. Bypasses active run lookup if run_id * not provided. */ otid?: string | null; /** * Seconds to wait between polls when no new data. */ poll_interval?: number | null; /** * Run ID to stream directly, bypassing run lookup. Use for recovery from duplicate * requests. */ run_id?: string | null; /** * Sequence id to use as a cursor for pagination. Response will start streaming * after this chunk sequence id */ starting_after?: number; } export declare namespace Messages { export { type MessageStreamResponse as MessageStreamResponse, type MessageListParams as MessageListParams, type MessageStreamParams as MessageStreamParams, }; } export { type MessagesArrayPage };