import { ConfirmExternalIdentityLinkRequest, ExternalIdentityLink, ExternalIdentityLinkPage, ExternalIdentityReference, type ExternalIdentity } from "@opengeni/contracts/external-identities"; import { type Database } from "./database.js"; export declare class ExternalIdentityLinkConflictError extends Error { readonly name = "ExternalIdentityLinkConflictError"; constructor(); } /** Internal persistence seam. The API must prove a host external actor and * freeze its key permission ceiling before calling. No login is provisioned. */ export declare function beginExternalIdentityLink(db: Database, identity: ExternalIdentity, raw: unknown): Promise<{ link: { id: string; accountId: string; externalIdentityId: string; externalIdentity?: { externalId: string; source: string; } | undefined; nativeSubjectId: string | null; status: "active" | "expired" | "pending" | "revoked"; revision: number; permissions: ("account:admin" | "account:read" | "agents:manage" | "agents:read" | "api_keys:manage" | "artifacts:publish" | "artifacts:read" | "billing:manage" | "billing:read" | "capabilities:manage" | "codemode:call" | "connections:personal" | "connections:read" | "connections:write" | "documents:manage" | "documents:search" | "enrollments:manage" | "enrollments:read" | "environments:manage" | "environments:use" | "files:read" | "files:upload" | "files:write" | "github:manage" | "github:use" | "goals:manage" | "mcp_servers:attach" | "members:manage" | "rigs:manage" | "rigs:use" | "scheduled_tasks:manage" | "scheduled_tasks:run" | "secrets:list" | "secrets:read" | "secrets:use" | "secrets:write" | "sessions:control" | "sessions:create" | "sessions:read" | "stream:acknowledge" | "stream:control" | "stream:view" | "terminal:attach" | "tool_credentials:write" | "usage_allowances:manage" | "variable-sets:attach" | "variable-sets:list" | "variable-sets:manage" | "variable-sets:read" | "variable-sets:use" | "variable-sets:write" | "workspace:admin" | "workspace:create" | "workspace:read")[]; expiresAt: string | null; }; challenge: string; confirmBefore: string; }>; /** Caller proves either exact host identity or native login, never a caller's * claimed subject. The challenge is intentionally absent from every read. */ export declare function getExternalIdentityLink(db: Database, input: { accountId: string; linkId: string; subjectId: string; }): Promise; /** Bounded inventory of the verified participant's links. Neither account-wide * access nor a supplied cursor reveals another participant's pending requests. */ export declare function listExternalIdentityLinks(db: Database, input: { accountId: string; subjectId: string; cursor?: string; }): Promise; /** Consent-screen projection, only after canonical native login admission. * The short-lived challenge proves which host request the human is approving. */ export declare function previewExternalIdentityLink(db: Database, input: { accountId: string; linkId: string; challenge: string; }): Promise<{ link: ExternalIdentityLink; externalIdentity: ExternalIdentityReference; } | null>; /** Must only receive the canonical native-session subject after explicit UI * consent. Possession of the challenge alone is not native authentication. */ export declare function confirmExternalIdentityLink(db: Database, input: { accountId: string; linkId: string; nativeSubjectId: string; request: ConfirmExternalIdentityLinkRequest; }): Promise; export declare function revokeExternalIdentityLink(db: Database, input: { accountId: string; linkId: string; subjectId: string; expectedRevision: number; }): Promise; /** Live linked admission primitive. It retains membership/link locks when * called in an open transaction. Never uses old creator audit as authority. */ export declare function resolveExternalIdentityLink(db: Database, input: { identity: ExternalIdentity; linkId: string; expectedRevision: number; }): Promise<{ link: ExternalIdentityLink; personalWorkspaceId: string; } | null>;