import type { MachineView } from "../../../machines.js"; /** Who can use the machine: the person connecting it, or the whole workspace. */ export type ConnectMachineScope = "user" | "workspace"; /** * The choice that reconnects a machine without changing who can use it. A * command cannot carry organization access, so an organization machine maps to * This workspace (pairing with a code is the way to keep organization access). */ export declare function connectScopeFor(machine: Pick): ConnectMachineScope; /** The choices a connect command is minted for. Both are baked into the token. */ export type ConnectChoice = { scope: ConnectMachineScope; allowScreenControl: boolean; }; export type MintedConnectToken = ConnectChoice & { /** The workspace it was minted for; a command is never shown for another. */ workspaceId: string; value: string; expiresAt: string; expiresInSeconds: number; }; /** * Mints a single-use connect command in this browser for the current choices. * Every request remembers the choices it was made for and only the latest * request may settle, so a slow response for an earlier choice never shows. * The command is usable only while its token matches the current choices, and * the server's echo of what it granted is checked rather than trusted blindly. */ export declare function useConnectToken(workspaceId: string, choice: ConnectChoice): { token: MintedConnectToken | null; minting: boolean; error: string | null; retry: () => void; }; /** "2:05 PM" for today, otherwise a date and time; relative when unparseable. */ export declare function formatConnectExpiry(expiresAt: string, expiresInSeconds: number): string; export type ConnectMachineDialogProps = { open: boolean; onOpenChange: (open: boolean) => void; workspaceId: string; /** The deployment origin the commands dial (the API origin, else this page). */ origin: string; /** Return to this chat after opening the installed app. */ sessionId?: string | undefined; /** The workspace's machines, polled by the host while the dialog is open. */ machines: readonly MachineView[]; machinesLoading: boolean; /** The latest machines load failure, if any. Success waits for a good load. */ machinesError?: unknown | undefined; /** A personal workspace: "This workspace" is still only its owner. */ personalWorkspace?: boolean | undefined; /** Who can use it, to start with (a reconnect keeps the machine's access). */ defaultScope?: ConnectMachineScope | undefined; /** Screen control's starting value (on when reconnecting to turn it on). */ defaultAllowScreenControl?: boolean | undefined; /** Called once when a machine comes online while the dialog is open. */ onConnected?: ((machine: MachineView) => void) | undefined; /** * From a chat: finish by moving the chat onto the new machine through the * existing attach flow. Without it, the dialog finishes with Done. */ useInChat?: { canUse: boolean; onUse: (machine: MachineView) => void; } | undefined; }; /** * Connect a machine: choose who can use it and whether agents may control its * screen, copy one command for the machine's OS, and stay here until the * machine connects. Shared by the Machines page and the chat's machine card. */ export declare function ConnectMachineDialog({ open, onOpenChange, ...body }: ConnectMachineDialogProps): import("react").JSX.Element;