import type { CreateAgentOptions, LettaCodeClientSessionOptions, LettaCodeModelEntry, ListMessagesOptions, ListMessagesResult, ListModelsResult, MessageContentItem, RecoverPendingApprovalsOptions, RecoverPendingApprovalsResult, ReasoningEffort, SDKErrorCode, SDKQueueItem, SendMessage, SessionDeviceStatus, SkillSource, UpdateModelOptions, UpdateModelResult } from "./types.js"; export type RuntimeScope = { agent_id: string; conversation_id: string; }; export type ProtocolMessage = Record & { type: string; request_id?: string; runtime?: RuntimeScope; }; export type RuntimeSessionMode = { kind: "create-agent"; options: CreateAgentOptions; } | { kind: "session"; agentId?: string; conversationId?: string; newConversation?: boolean; defaultConversation?: boolean; options: LettaCodeClientSessionOptions; }; export type RuntimeTurnResult = { runtime: RuntimeScope; stopReason: string | null; runIds: string[]; success?: boolean; detail?: string; errorCode?: SDKErrorCode; recoverable?: boolean; }; export type RuntimeSendTurnOptions = { clientMessageId: string; /** Caller-supplied OTID for the user message, when one was provided. */ otid?: string; }; export type RuntimeRequestOptions = { timeoutMs?: number; predicate?: (message: ProtocolMessage) => boolean; }; export interface RemoteClientRuntimeController { onMessage(handler: (message: ProtocolMessage, channel?: string) => void): () => void; send(command: Record): void; sendTurnMessage(runtime: RuntimeScope, message: SendMessage, options: RuntimeSendTurnOptions): void; abort(runtime: RuntimeScope): Promise; request(type: string, body: Record, options?: RuntimeRequestOptions): Promise; recoverPendingApprovals(runtime: RuntimeScope, options?: RecoverPendingApprovalsOptions): Promise; listMessages(conversationId: string, options?: ListMessagesOptions): Promise; listModels(): Promise; updateModel(runtime: RuntimeScope, payload: { model_id?: string; model_handle?: string; }): Promise; close(): void; } export type RuntimeSessionInit = { controller: RemoteClientRuntimeController; runtime: RuntimeScope; model?: string | null; modelSettings?: Record | null; tools?: string[]; /** Effective runtime skill source override, when explicitly requested. */ skillSources?: SkillSource[]; }; export type RemoteClientSessionCoreConfig = { label: string; requestTimeoutMs?: number; }; type ReflectionSettings = { trigger: "off" | "step-count" | "compaction-event"; step_count: number; }; export type UpdateModelPayload = { model_id?: string; model_handle?: string; }; export type NormalizedUpdateModelInput = { model?: string; modelId?: string; modelHandle?: string; reasoningEffort?: ReasoningEffort; }; export type TurnTracker = { id: number; runtime: RuntimeScope; clientMessageId: string; /** Caller-supplied OTID for this turn's user message, when one was provided. */ otid?: string; queuedAt: number; startedAt: number; assistantText: string; runIds: Set; observedTurnEvidence: boolean; observedRequiresApprovalStop: boolean; pendingTerminal: RuntimeTurnResult | null; abortRequested: boolean; timeout: ReturnType | null; }; type LegacyPermissionMode = "default" | "bypassPermissions" | "fullAccess"; export declare function normalizePermissionMode(mode: LettaCodeClientSessionOptions["permissionMode"] | LegacyPermissionMode | undefined): LettaCodeClientSessionOptions["permissionMode"] | undefined; export declare function mapPermissionMode(mode: LettaCodeClientSessionOptions["permissionMode"] | LegacyPermissionMode | undefined): string | undefined; export declare function isUnrestrictedPermissionMode(mode: LettaCodeClientSessionOptions["permissionMode"] | LegacyPermissionMode | undefined): boolean; export declare function ensureSuccess(message: Record, fallback: string): void; export declare function toSdkErrorCode(value: string | null | undefined): SDKErrorCode | undefined; export declare function isFailureStopReason(value: string | null | undefined): boolean; export declare function normalizeUpdateModelInput(update: string | UpdateModelOptions): NormalizedUpdateModelInput; export declare function modelPayloadWithoutReasoning(input: NormalizedUpdateModelInput): UpdateModelPayload; export declare function toBaseModelHandle(handle: string | undefined, byokProviderAliases: Record | undefined): string | undefined; export declare function getContextWindow(value: Record | null | undefined): number | undefined; export declare function getReasoningEffort(entry: LettaCodeModelEntry): string | undefined; export declare function sameContextCandidates(candidates: LettaCodeModelEntry[], contextWindow: number | undefined): LettaCodeModelEntry[]; export declare function isApprovalConflictSignal(params: { detail?: string; message?: string; stopReason?: string | null; }): boolean; export declare function resolveDreamingSettings(dreaming: LettaCodeClientSessionOptions["dreaming"]): ReflectionSettings | null; export declare function extractTextFromContent(content: unknown): string | null; export declare function toolInputFromArguments(args: unknown): { input: Record; raw?: string; }; export declare function firstToolCall(delta: Record): Record | undefined; export declare function firstToolReturn(delta: Record): Record | undefined; export declare function sameRuntime(message: ProtocolMessage, runtime: RuntimeScope): boolean; export declare function streamDeltaRecord(message: ProtocolMessage): Record | null; export declare function streamDeltaMessageType(delta: Record): string | undefined; export declare function streamDeltaRunId(delta: Record): string | undefined; export declare function streamDeltaOtid(delta: Record): string | null | undefined; export declare function streamDeltaSeqId(delta: Record): number | undefined; export declare function streamDeltaStopReason(delta: Record): string | null | undefined; export declare function loopStatusValue(message: ProtocolMessage): string | undefined; export declare function loopStatusRunIds(message: ProtocolMessage): string[]; export declare function turnFinishedRecord(message: ProtocolMessage): { runId?: string; stopReason: string; error?: string; } | null; export declare function queueItems(message: ProtocolMessage): SDKQueueItem[]; export declare function deviceStatusRecord(message: ProtocolMessage): Record | null; export declare function toSessionDeviceStatus(status: Record): SessionDeviceStatus | null; export declare function normalizeSendMessage(message: SendMessage): string | MessageContentItem[]; /** * Validate a caller-supplied OTID. Empty/whitespace-only values would silently * defeat correlation, so they are rejected instead of being dropped. */ export declare function normalizeCallerOtid(otid: string | undefined): string | undefined; /** Wire correlation options for a tracked turn. */ export declare function turnSendOptions(turn: TurnTracker): RuntimeSendTurnOptions; export {}; //# sourceMappingURL=remote-session-protocol.d.ts.map