import type { MachineView, Session, SessionMachineAccess } from "@opengeni/sdk"; import type { OpenGeniText } from "./messages/runtime.js"; /** Whether a Connected Machine can take work right now. Offline, reconnecting * and enrolling machines cannot; a machine without screen-control consent can * still run compute. */ export declare function isMachineComputeSelectable(state: string): boolean; /** A machine-list response is useful only while it names the session's current pointer. */ export declare function currentSessionMachineAccess(access: SessionMachineAccess | null | undefined, activeSandboxId: string | null | undefined): SessionMachineAccess | null; export type SessionAdmissionReason = { /** The public reason; unknown future reasons arrive as their own string. */ reason: string; /** The refusal was a permission check (SQLSTATE 42501). */ permissionDenied: boolean; }; /** * The admission block a person should see, or null. Older servers omit the * projection, and a stale block on a session that is no longer waiting is * ignored. Never exposes raw database diagnostics. */ export declare function sessionAdmissionReason(session: Pick & { admissionBlock?: unknown; }): SessionAdmissionReason | null; /** The saved message was refused because only the machine's owner may start work on it. */ export declare function sessionAdmissionNeedsDifferentMachine(reason: SessionAdmissionReason | null, access: SessionMachineAccess | null | undefined): boolean; /** * Machines that can take the saved message. Accepted messages keep the * personal-resource permissions they were sent with, so a personal machine * chosen now could not run them: offer the session's own cloud machine and * workspace or organization machines that are reachable. */ export declare function savedMessageMachineChoices(machines: readonly MachineView[]): MachineView[]; export type SessionAdmissionCopy = { title: string; body: string; next: string; /** The recheck button label. */ action: string; }; /** Words for an admission block that is not (or not known to be) a machine-owner refusal. */ export declare function sessionAdmissionCopy(t: OpenGeniText, { reason, permissionDenied }: SessionAdmissionReason): SessionAdmissionCopy; /** After a refusal, the session moved to another machine: the saved message can be rechecked there. */ export declare function sessionAdmissionMachineChangedCopy(t: OpenGeniText): SessionAdmissionCopy; export type PersonalMachineCopy = { /** Whose machine this chat runs on, and who may start work there. */ explanation: string; /** What happens to the person's words, and the ways forward. */ next: string; /** A message the person can send the owner themselves; null for the owner. */ ownerRequest: string | null; /** "Copy request to …" button label; null for the owner. */ copyRequest: string | null; }; /** * Explain a chat that runs on a personal machine. `queued` is a saved message * the runtime refused; otherwise it is a draft the person has not sent yet. */ export declare function personalMachineCopy(t: OpenGeniText, access: Pick, { queued }: { queued: boolean; }): PersonalMachineCopy; /** Stream, detail, and mutation receipts can arrive in different orders. */ export declare function admissionRecheckControl(sessionControl: Session["effectiveControl"], ...observed: (Session["effectiveControl"] | null | undefined)[]): Session["effectiveControl"]; export declare function admissionControlNeedsRefresh(control: Session["effectiveControl"], ...observed: (Session["effectiveControl"] | null | undefined)[]): boolean; /** * Recheck a blocked session: one fenced Resume (the server refuses it if the * session's control changed since `control` was read), then every read. A * rejected Resume refreshes the reads and is never replayed, so the saved * message cannot be sent twice. */ export declare function recheckSessionAdmission({ control, refreshOnly, resume, refresh, }: { control: Session["effectiveControl"]; refreshOnly: boolean; resume: (control: Session["effectiveControl"]) => Promise; refresh: (() => Promise)[]; }): Promise;