import type { AgentStartedStreamEvent, MessageStreamEvent } from "#protocol/message.js"; import { ClientAgentSession } from "#client/agent-session.js"; import { MessageResponse } from "#client/message-response.js"; import type { InputResponse } from "#shared/input.js"; import type { CancelSessionResult, ClearResult, ClientSessionState, CompactResult, ClientRedirectPolicy, CreateSessionOptions, RespondTurnOptions, ResetResult, SendTurnInput, SendTurnOptions, SessionSnapshot, StreamOptions } from "#client/types.js"; declare const followSession: unique symbol; interface FollowSessionOptions extends StreamOptions { readonly headers?: Readonly>; readonly onCaughtUp?: () => void; readonly resolveReconnectPolicy?: () => StreamOptions["streamReconnectPolicy"]; readonly resolveHeaders?: () => Readonly> | undefined; } /** * Internal interface that a {@link ClientSession} uses to access client-level * configuration without depending on the full {@link Client} class. */ export interface ClientSessionContext { readonly host: string; readonly redirect?: ClientRedirectPolicy; resolveHeaders(perRequest?: Readonly>): Promise; } /** One fixed, ID-addressed conversation with an eve agent. */ export declare class ClientSession { #private; /** @internal */ constructor(context: ClientSessionContext, state: ClientSessionState); /** @internal */ static create(context: ClientSessionContext, input: SendTurnInput & CreateSessionOptions): Promise<{ readonly response: MessageResponse; readonly session: ClientSession; }>; /** @internal */ static prewarm(context: ClientSessionContext, options?: CreateSessionOptions): Promise; /** Current fixed session identity and durable stream cursor. */ get state(): ClientSessionState; /** Reads a finite prefix through the durable tail without advancing this handle. */ snapshot(options?: { readonly signal?: AbortSignal; }): Promise; /** Sends a message to this exact session ID. */ send(message: SendTurnInput["message"], options?: SendTurnOptions): Promise>; /** Answers pending input requests on this exact session ID. */ respond(inputResponses: readonly InputResponse[], options?: RespondTurnOptions): Promise>; /** Requests cooperative cancellation of this session's active turn. */ cancel(options?: { readonly signal?: AbortSignal; readonly turnId?: string; }): Promise; /** Queues removal of this session's durable model-message history. */ clear(): Promise; /** Queues context compaction without sending model input. */ compact(): Promise; /** Terminally retires this exact session ID. The handle remains pinned to it. */ reset(options?: { readonly reason?: string; readonly signal?: AbortSignal; }): Promise; /** Opens this session's durable event stream from its stored cursor. */ stream(options?: StreamOptions): AsyncIterable; /** * The session an agent run opened, as this session's stream announced it. * Pass an `agent.started` event from this session, then follow the child * with `stream()`; reads use this session's host and credentials, for local * and remote agents alike. */ agent(started: AgentStartedStreamEvent): ClientAgentSession; [followSession](options: FollowSessionOptions): AsyncIterable; } /** @internal Follow continuously while the frontend owns the session. */ export declare function followClientSession(session: ClientSession, options: FollowSessionOptions): AsyncIterable; export {};