import { type RemoteWorkspaceContext } from "./remote-workspace-selection.js"; import type { RemoteCustomerRole } from "./remote-profile.js"; export type LeaveRemoteWorkspace = Readonly<{ expectedRole: RemoteCustomerRole; confirm: true; }>; export type RemoteWorkspaceLeaveResult = { organizationId: string; membershipId: string; removed: true; signInRequired: true; }; export declare class WorkspaceLeaveInputError extends Error { constructor(); } export declare function workspaceLeaveInput(context: RemoteWorkspaceContext, input: LeaveRemoteWorkspace): { context: Readonly<{ userId: string; membershipId: string; }>; input: { expectedRole: RemoteCustomerRole; confirm: true; }; body: { membershipId: string; expectedRole: RemoteCustomerRole; }; }; export declare const workspaceLeaveFailures: { readonly INVALID_REQUEST: readonly [400, "Provide the exact current membership and expected role."]; readonly ACCOUNT_UNAVAILABLE: readonly [403, "Account is unavailable."]; readonly INTERACTIVE_SESSION_REQUIRED: readonly [403, "Fresh interactive sign-in is required to leave a workspace."]; readonly MEMBERSHIP_ROLE_CHANGED: readonly [409, "Your role changed. Sign in and inspect the workspace before leaving."]; readonly LAST_OWNER_REQUIRED: readonly [409, "The workspace must retain another active owner."]; readonly LAST_WORKSPACE_REQUIRED: readonly [409, "Another available workspace is required before leaving."]; readonly MEMBERSHIP_BUSY: readonly [503, "Membership is busy. Inspect the workspace before another leave action."]; }; export type RemoteWorkspaceLeaveErrorCode = keyof typeof workspaceLeaveFailures; export declare class RemoteWorkspaceLeaveError extends Error { readonly code: RemoteWorkspaceLeaveErrorCode; readonly status: number; constructor(code: RemoteWorkspaceLeaveErrorCode); } export declare class RemoteWorkspaceLeaveUnconfirmedError extends Error { readonly code = "WORKSPACE_LEAVE_UNCONFIRMED"; constructor(); } export declare function workspaceLeaveFailure(value: unknown, status: number): RemoteWorkspaceLeaveErrorCode | null; export declare function parseWorkspaceLeaveResult(value: unknown, membershipId: string, organizationId: string): RemoteWorkspaceLeaveResult; /** A configured profile may constrain an explicit leave, never retarget it. */ export declare function workspaceLeaveProfileContext(membershipId: string, userId: string | undefined, profile?: RemoteWorkspaceContext): RemoteWorkspaceContext;