import type { ActiveConversationRunStatus, AppendConversationRunEventsResponse, ConversationRunAppendCursorResyncResult, ConversationRunAppendFailureOutcome, ConversationRunAppendRecoveryOutcome, ConversationRunEventQueueController, ConversationRunProjection, CreateConversationAgentRunInput, FinalizeConversationAgentRunInput, TerminalConversationRunStatus } from "./durable-contracts.js"; export { AppendConversationRunEventsResponseSchema, CompleteConversationRunResponseSchema, ConversationRunProjectionSchema, ConversationRunStatusSchema, ConversationRunTargetsSchema, CreateConversationRunAcceptedSchema, getAppendConversationRunEventsResponseSchema, getCompleteConversationRunResponseSchema, getConversationRunProjectionSchema, getConversationRunStatusSchema, getConversationRunTargetsSchema, getCreateConversationRunAcceptedSchema, resolveConversationRunTargets, } from "./durable-contracts.js"; export { AppendConversationRunEventsError, isCursorMismatchConversationRunAppendError, isIgnorableConversationRunAppendError, isPermanentAuthConversationRunAppendError, parseAppendConversationRunEventsErrorBody, } from "./durable-append-errors.js"; export type { ActiveConversationRunStatus, AppendConversationRunEventsResponse, ConversationAgentRunUsage, ConversationRunAppendCursorResyncResult, ConversationRunAppendExecutionOutcome, ConversationRunAppendFailureOutcome, ConversationRunAppendRecoveryOutcome, ConversationRunBatchFlushOutcome, ConversationRunEventQueueController, ConversationRunProjection, ConversationRunQueueFlushOutcome, ConversationRunTargets, CreateConversationAgentRunInput, FinalizeConversationAgentRunInput, TerminalConversationRunStatus, } from "./durable-contracts.js"; type ConversationRunApiFetch = typeof globalThis.fetch; /** Error shape for conversation run terminal state. */ export declare class ConversationRunTerminalStateError extends Error { readonly status: TerminalConversationRunStatus; readonly run: ConversationRunProjection; constructor(run: ConversationRunProjection, status: TerminalConversationRunStatus); } /** Check whether a conversation run status is active. */ export declare function isActiveConversationRunStatus(status: ConversationRunProjection["status"]): status is ActiveConversationRunStatus; /** Check whether a conversation run projection can accept more events. */ export declare function isAppendableConversationRunProjection(run: ConversationRunProjection): boolean; /** * The run reached a terminal status server-side. Both this and a `waiting_for_tool` * projection are non-appendable, but only this one means the run can never be * completed either, so the two must not share a stop reason * (veryfront-issue-inbox#743). */ export declare function isTerminalConversationRunProjection(run: ConversationRunProjection): boolean; /** Resync conversation run append cursor helper. */ export declare function resyncConversationRunAppendCursor(input: { authToken: string; apiUrl: string; conversationId: string; runId: string; previousLatestExternalEventSequence: number; abortSignal?: AbortSignal; /** Host-owned transport used by trusted capability-backed callers. */ fetch?: ConversationRunApiFetch; }): Promise<{ result: ConversationRunAppendCursorResyncResult; run: ConversationRunProjection; }>; /** Recover conversation run cursor mismatch helper. */ export declare function recoverConversationRunCursorMismatch(input: { error: unknown; authToken: string; apiUrl: string; conversationId: string; runId: string; latestEventId: number; latestExternalEventSequence: number; cursorResyncsThisFlush: number; maxCursorResyncsPerFlush: number; cursorMode?: "external_sequence" | "durable_event_id"; abortSignal?: AbortSignal; /** Host-owned transport used by trusted capability-backed callers. */ fetch?: ConversationRunApiFetch; }): Promise<{ outcome: ConversationRunAppendRecoveryOutcome; latestEventId: number; latestExternalEventSequence: number; disableReason?: "cursor_resyncs_exhausted" | "cursor_mismatch_ambiguous" | "non_appendable" | "run_terminal"; run?: ConversationRunProjection; }>; /** Recover conversation run append failure helper. */ export declare function recoverConversationRunAppendFailure(input: { error: unknown; authToken: string; apiUrl: string; conversationId: string; runId: string; latestEventId: number; latestExternalEventSequence: number; cursorResyncsThisFlush: number; maxCursorResyncsPerFlush: number; cursorMode?: "external_sequence" | "durable_event_id"; abortSignal?: AbortSignal; /** Host-owned transport used by trusted capability-backed callers. */ fetch?: ConversationRunApiFetch; }): Promise<{ outcome: ConversationRunAppendFailureOutcome; latestEventId: number; latestExternalEventSequence: number; disableReason?: "cursor_resyncs_exhausted" | "cursor_mismatch_ambiguous" | "non_appendable" | "ignorable_append_rejection" | "run_terminal" | "payload_too_large" | "auth_rejected"; errorMessage?: string; retryCause?: "timeout"; run?: ConversationRunProjection; }>; /** Recover conversation run append execution helper. */ export declare function recoverConversationRunAppendExecution(input: { error: unknown; authToken: string; apiUrl: string; conversationId: string; runId: string; latestEventId: number; latestExternalEventSequence: number; remainingEvents: unknown[]; pendingEvents: unknown[]; cursorResyncsThisFlush: number; consecutiveFailures: number; maxCursorResyncsPerFlush: number; cursorMode?: "external_sequence" | "durable_event_id"; abortSignal?: AbortSignal; /** Host-owned transport used by trusted capability-backed callers. */ fetch?: ConversationRunApiFetch; }): Promise<{ outcome: "resumed"; latestEventId: number; latestExternalEventSequence: number; pendingEvents: unknown[]; consecutiveFailures: number; } | { outcome: "stopped"; latestEventId: number; latestExternalEventSequence: number; disableReason?: "cursor_resyncs_exhausted" | "cursor_mismatch_ambiguous" | "non_appendable" | "ignorable_append_rejection" | "run_terminal" | "payload_too_large" | "auth_rejected"; } | { outcome: "retry_scheduled"; latestEventId: number; latestExternalEventSequence: number; pendingEvents: unknown[]; consecutiveFailures: number; errorMessage: string; retryCause?: "timeout"; }>; /** Flush conversation run event batches. */ export declare function flushConversationRunEventBatches(input: { authToken: string; apiUrl: string; conversationId: string; runId: string; latestEventId: number; latestExternalEventSequence: number; events: unknown[]; pendingEvents?: unknown[]; maxEventsPerBatch: number; maxBatchPayloadBytes?: number; cursorResyncsThisFlush?: number; consecutiveFailures?: number; maxCursorResyncsPerFlush: number; abortSignal?: AbortSignal; onAppendRequest?: () => void; /** Host-owned transport used by trusted capability-backed callers. */ fetch?: ConversationRunApiFetch; }): Promise<{ outcome: "flushed"; latestEventId: number; latestExternalEventSequence: number; } | { outcome: "resumed" | "retry_scheduled"; latestEventId: number; latestExternalEventSequence: number; pendingEvents: unknown[]; consecutiveFailures: number; errorMessage?: string; retryCause?: "timeout"; } | { outcome: "stopped"; latestEventId: number; latestExternalEventSequence: number; disableReason?: "cursor_resyncs_exhausted" | "cursor_mismatch_ambiguous" | "non_appendable" | "ignorable_append_rejection" | "run_terminal" | "payload_too_large" | "auth_rejected"; }>; /** Flush conversation run event queue. */ export declare function flushConversationRunEventQueue(input: { authToken: string; apiUrl: string; conversationId: string; runId: string; latestEventId: number; latestExternalEventSequence: number; events: unknown[]; maxEventsPerBatch: number; maxBatchPayloadBytes?: number; maxCursorResyncsPerFlush: number; consecutiveFailures?: number; abortSignal?: AbortSignal; onAppendRequest?: () => void; /** Host-owned transport used by trusted capability-backed callers. */ fetch?: ConversationRunApiFetch; }): Promise<{ outcome: "flushed"; latestEventId: number; latestExternalEventSequence: number; } | { outcome: "stopped"; latestEventId: number; latestExternalEventSequence: number; disableReason?: "cursor_resyncs_exhausted" | "cursor_mismatch_ambiguous" | "non_appendable" | "ignorable_append_rejection" | "run_terminal" | "payload_too_large" | "auth_rejected"; } | { outcome: "retry_scheduled"; latestEventId: number; latestExternalEventSequence: number; pendingEvents: unknown[]; consecutiveFailures: number; errorMessage: string; retryCause?: "timeout"; }>; /** Create conversation run event queue controller. */ export declare function createConversationRunEventQueueController(input: { authToken: string; apiUrl: string; conversationId: string; runId: string; latestEventId: number; latestExternalEventSequence: number; maxEventsPerBatch: number; maxBatchPayloadBytes?: number; maxCursorResyncsPerFlush?: number; /** Host-owned transport used by trusted capability-backed callers. */ fetch?: ConversationRunApiFetch; }): ConversationRunEventQueueController; /** Return conversation run. */ export declare function getConversationRun(input: { authToken: string; apiUrl: string; conversationId: string; runId: string; abortSignal?: AbortSignal; /** Host-owned transport used by trusted capability-backed callers. */ fetch?: ConversationRunApiFetch; }): Promise; /** Monitor conversation run status helper. */ export declare function monitorConversationRunStatus(input: { authToken: string; apiUrl: string; conversationId: string; runId: string; abortSignal?: AbortSignal; pollIntervalMs: number; onTerminal: (error: ConversationRunTerminalStateError) => void | Promise; onPollError?: (error: unknown) => void | Promise; }): Promise; /** Append conversation run events. */ export declare function appendConversationRunEvents(input: { authToken: string; apiUrl: string; conversationId: string; runId: string; expectedPreviousEventId?: number; expectedPreviousExternalEventSequence?: number; events: unknown[]; abortSignal?: AbortSignal; /** Host-owned transport used by trusted capability-backed callers. */ fetch?: ConversationRunApiFetch; }): Promise; /** Create conversation agent run. */ export declare function createConversationAgentRun(input: CreateConversationAgentRunInput): Promise; /** Finalize conversation agent run helper. */ export declare function finalizeConversationAgentRun(input: FinalizeConversationAgentRunInput): Promise; //# sourceMappingURL=durable.d.ts.map