import { ApiClient } from "./api-client.js"; export type ResolutionSource = "flag" | "env" | "roster"; /** One entry in the server roster (GET sessions). The server is the single * source of truth for which conversations exist and are live; the CLI keeps no * local conversation store. */ export interface RosterEntry { conversationId: string; previousConversationIds?: string[]; workflowId?: string; status: string; startedAt: number; title?: string; workspaceId: string; } export interface ResolvedConversation { conversationId: string; source: ResolutionSource; } /** * Resolve the conversation a command acts on, per the locked resolution order: * --conversation > CLOUDCRUISE_CONVERSATION > roster (sole-survivor). * * Explicit ids skip the roster entirely and overrule workspace scope (the * backend still authorizes via RLS). The implicit path fetches the server * roster, scopes it to the active workspace, and succeeds only when exactly one * live conversation is in scope โ€” >1 forces the caller to pass --conversation * rather than silently picking newest (neutralizes the cross-client default * footgun). */ export declare function resolveConversation(client: ApiClient, opts: { conversation?: string; }, workspaceId: string | undefined): Promise; export interface Reconciled { result: T; /** The conversation actually acted on โ€” the chain tip after any follow. */ conversationId: string; /** Present only when a follow happened; the dead id the caller held. */ reconciledFrom?: string; } /** * Run an action against a conversation, auto-following a cleared/restarted * conversation to its live chain tip when the command is eligible (ยง5 matrix). * * A held id that was cleared/restarted 404s with CONVERSATION_NOT_FOUND. For * eligible reads/send/save we follow the successor (from the enriched 404, or a * roster fallback) and retry, reporting reconciledFrom. For ineligible commands * (respond/interrupt/end) we surface the successor on stderr and re-throw so the * caller never acts on the wrong turn โ€” following `end` would destroy the live * successor. Whole-chain-dead (no successor) always re-throws -> exit 4. */ export declare function withAutoFollow(client: ApiClient, conversationId: string, eligible: boolean, workspaceId: string | undefined, action: (id: string) => Promise): Promise>; /** Merge the reconcile fields onto a command's output object: the tip as * `conversationId`, and `reconciledFrom` when a follow happened. */ export declare function withReconcileFields(result: object, r: Reconciled): Record;