import type { IAgentRuntime, Memory, Role, UUID, World } from "./types";
export type RoleName = "OWNER" | "ADMIN" | "USER" | "GUEST";
export type RoleGrantSource = "owner" | "manual" | "connector_admin";
export declare const ROLE_RANK: Record<RoleName, number>;
export type RolesWorldMetadata = {
    ownership?: {
        ownerId?: string;
    };
    roles?: Record<string, RoleName>;
    roleSources?: Record<string, RoleGrantSource>;
};
export type ConnectorAdminWhitelist = Record<string, string[]>;
export type RolesConfig = {
    connectorAdmins?: ConnectorAdminWhitelist;
};
export type RoleCheckResult = {
    entityId: UUID;
    role: RoleName;
    isOwner: boolean;
    isAdmin: boolean;
    canManageRoles: boolean;
};
export interface ServerOwnershipState {
    servers: {
        [serverId: string]: World;
    };
}
declare const CONNECTOR_ID_FIELDS: readonly ["userId", "id", "username", "userName"];
type ConnectorIdField = (typeof CONNECTOR_ID_FIELDS)[number];
type ConnectorAdminMatch = {
    connector: string;
    matchedValue: string;
    matchedField: ConnectorIdField;
};
type ResolveEntityRoleOptions = {
    liveEntityMetadata?: Record<string, unknown> | null;
    liveEntityId?: string;
};
export declare function getUserServerRole(runtime: IAgentRuntime, entityId: string, serverId: string): Promise<Role>;
export declare function findWorldsForOwner(runtime: IAgentRuntime, entityId: string): Promise<World[] | null>;
export declare function getConfiguredOwnerEntityIds(runtime: IAgentRuntime): string[];
export declare function hasConfiguredCanonicalOwner(runtime: IAgentRuntime): boolean;
export declare function resolveCanonicalOwnerId(runtime: IAgentRuntime, metadata?: RolesWorldMetadata): string | null;
export declare function setConnectorAdminWhitelist(runtime: IAgentRuntime, whitelist: ConnectorAdminWhitelist | Record<string, unknown> | undefined): void;
export declare function getConnectorAdminWhitelist(runtime: IAgentRuntime): ConnectorAdminWhitelist;
export declare function matchEntityToConnectorAdminWhitelist(entityMetadata: Record<string, unknown> | null | undefined, whitelist: ConnectorAdminWhitelist | Record<string, unknown> | undefined): ConnectorAdminMatch | null;
export declare function normalizeRole(raw: string | undefined | null): RoleName;
export declare function getEntityRole(metadata: RolesWorldMetadata | undefined, entityId: string): RoleName;
export declare function getLiveEntityMetadataFromMessage(message: Memory): Record<string, unknown> | undefined;
export declare function resolveEntityRole(runtime: IAgentRuntime, _world: Awaited<ReturnType<IAgentRuntime["getWorld"]>>, metadata: RolesWorldMetadata | undefined, entityId: string, options?: ResolveEntityRoleOptions): Promise<RoleName>;
export declare function checkSenderPrivateAccess(runtime: IAgentRuntime, message: Memory): Promise<{
    entityId: UUID;
    role: RoleName;
    isOwner: boolean;
    isAdmin: boolean;
    canManageRoles: boolean;
    hasPrivateAccess: boolean;
    accessRole: RoleName | null;
    accessSource: "owner" | "manual" | "linked_manual" | null;
} | null>;
export declare function canModifyRole(actorRole: RoleName, targetCurrentRole: RoleName, newRole: RoleName): boolean;
export declare function resolveWorldForMessage(runtime: IAgentRuntime, message: Memory): Promise<{
    world: Awaited<ReturnType<IAgentRuntime["getWorld"]>>;
    metadata: RolesWorldMetadata;
} | null>;
export declare function resolveCanonicalOwnerIdForMessage(runtime: IAgentRuntime, message: Memory): Promise<string | null>;
export declare function checkSenderRole(runtime: IAgentRuntime, message: Memory): Promise<RoleCheckResult | null>;
export declare function setEntityRole(runtime: IAgentRuntime, message: Memory, targetEntityId: string, newRole: RoleName, source?: RoleGrantSource): Promise<Record<string, RoleName>>;
export {};
//# sourceMappingURL=roles.d.ts.map