export type PooledExternalSessionEntry = { fingerprint: string; resource: T; /** Optional native runtime session/thread id for cross-conversation lock tracking. */ nativeSessionId?: string; /** Optional host CLI binary path; if replaced/upgraded on disk, the pooled process is evicted. */ executablePath?: string; isAlive: () => boolean; dispose: (force?: boolean) => Promise; }; /** * Attempt to check out a warm external runtime process for `conversationId`. * Waits for any in-flight disposal of the same conversation or native session before returning, * preventing a newly spawned process from racing a shutting-down writer process. * Returns `undefined` on cache miss, config fingerprint mismatch, dead process, or DB reopen. */ export declare function checkoutPooledExternalSession(conversationId: string, fingerprint: string, options?: { nativeSessionId?: string; }): Promise; /** * Return a healthy external runtime process to the idle pool for fast reuse on subsequent turns. */ export declare function checkinPooledExternalSession(conversationId: string, entry: PooledExternalSessionEntry, idleTtlMs?: number): void; /** Close and evict any pooled external runtime process for `conversationId`, awaiting in-flight disposals. */ export declare function disposePooledExternalSession(conversationId: string, force?: boolean): Promise; /** Close and evict any idle pooled external runtime processes holding `nativeSessionId`. */ export declare function disposePooledExternalSessionsByNativeId(nativeSessionId: string, force?: boolean): Promise; /** Close and evict every pooled external runtime process (used on shutdown). */ export declare function disposeAllPooledExternalSessions(force?: boolean): Promise; export declare function getPooledExternalSessionCount(): number;