import { type Database } from "./database.js"; export declare const SOURCE_PLACEMENT_CHANGED = "source_placement_changed"; export type TerminalizeStaleConnectedInteractionPlacementResult = { sourcePlacementChanged: boolean; changed: boolean; browserSessionIds: string[]; computerSessionIds: string[]; revision: number; }; /** A browser or Desktop that its source task's move left `lost` while its * controller still holds a running generation on the former machine. */ export type LostConnectedInteractionController = { resource: "browser_session" | "computer_session"; resourceId: string; connectedSandboxId: string; controllerGeneration: string; placementInstanceId: string; }; /** The browsers and Desktops one task started on one Connected Machine that * its move left `lost` while their controller still holds processes there. */ export type SourceFormerPlacementResources = { connectedSandboxId: string; browserSessionIds: string[]; computerSessionIds: string[]; }; /** * Find the browsers and Desktops a task's move left `lost` on Connected * Machines it no longer runs on, whose controller binding was never released * because ending them there failed (the machine was offline or refused). Live * resources are not listed: a task that returns to a machine keeps using * what it left running there. Retirement is fenced again per resource, so a * stale read here cannot end anything the task's current machine still holds. */ export declare function listSourceFormerPlacementResources(db: Database, input: { accountId: string; workspaceId: string; sourceSessionId: string; }): Promise; /** List the resources a source task's move left `lost` on one Connected * Machine whose controller binding was never released, so their processes can * be ended there. */ export declare function listLostConnectedInteractionControllers(db: Database, input: { accountId: string; workspaceId: string; connectedSandboxId: string; browserSessionIds: readonly string[]; computerSessionIds: readonly string[]; }): Promise; /** Record that the former machine ended this lost resource's exact controller * generation. The resource stays `lost` with its failure code; only the * binding to processes that no longer exist is released. Returns false when * the row no longer holds that generation. */ export declare function releaseLostConnectedInteractionController(db: Database, input: { accountId: string; workspaceId: string; resource: LostConnectedInteractionController["resource"]; resourceId: string; expectedControllerGeneration: string; }): Promise; /** * Reconcile interaction resources after their source task moves away from a * Connected Machine. The source row is the race fence: a stale route lookup * may never retire resources while that machine is still the active placement. * Browser and Desktop resources are settled together because headed browsers * can share one physical controller with a linked Desktop. */ export declare function terminalizeStaleConnectedInteractionPlacement(db: Database, input: { accountId: string; workspaceId: string; sourceSessionId: string; connectedSandboxId: string; }): Promise;