export type ReconcilerOwner = 'client' | 'server'; export type WakeAgentReason = 'mention' | 'reconciler_decision' | 'manual'; export type WakeAgentStatus = 'queued' | 'leased' | 'completed' | 'failed'; export type ClientKind = 'cli' | 'desktop' | 'mobile' | 'web'; export interface ReconcilerCoordinationMetadata { reconcilerOwner: ReconcilerOwner; } export interface SharedWakeAgentJob { id: string; thread: string; triggerMessage: string; agent: string; reason: WakeAgentReason; status: WakeAgentStatus; createdAt: string; } export interface WakeAgentLeaseFields { priority?: 'low' | 'normal' | 'high'; leaseOwner?: string; leaseExpiresAt?: string; } export interface ClientCapability { clientId: string; kind: ClientKind; user: string; canCoordinateClientOwnedThread: boolean; canRunAgent: boolean; workspaces: string[]; heartbeatAt: string; } export interface ClientReconcilerLease { thread: string; ownerClientId: string; ownerUser: string; fencingToken: string; expiresAt: string; } export interface ClientReconcilerActivationOptions { thread: string; ownerUser: string; clients: ClientCapability[]; currentLease?: ClientReconcilerLease; now?: Date; heartbeatTtlMs?: number; leaseTtlMs?: number; fencingToken?: string; } export declare function activateClientReconciler(options: ClientReconcilerActivationOptions): ClientReconcilerLease | undefined; export declare function isReconcilerOwner(value: unknown): value is ReconcilerOwner; export declare function normalizeReconcilerOwner(value: unknown, fallback?: ReconcilerOwner): ReconcilerOwner; export declare function reconcilerCoordinationMetadata(owner: ReconcilerOwner): ReconcilerCoordinationMetadata; export declare function withReconcilerCoordinationMetadata(metadata: Record | undefined, owner: ReconcilerOwner): Record; export declare function sharedWakeAgentJobDedupeKey(job: Pick): string; export declare function isClientReconcilerLeaseActive(lease: ClientReconcilerLease | undefined, now?: Date): boolean; export declare function clientKindRank(kind: ClientKind): number; export declare function selectClientReconcilerClient(clients: ClientCapability[], options: { ownerUser: string; now?: Date; heartbeatTtlMs?: number; currentLease?: ClientReconcilerLease; }): ClientCapability | undefined;