import { type CurrentChatBotAppMapping, type CurrentChatBotAppResolution, type CurrentChatBotMember } from '../im/lark/client.js'; export type ExactChatGrantOperation = 'grant' | 'revoke' | 'readback'; export interface ExactChatGrantInput { operation: unknown; receiverLarkAppId: string; chatId: unknown; subjectOpenIds: unknown; } export interface ExactChatGrantByLarkAppIdsInput { operation: unknown; receiverLarkAppId: string; chatId: unknown; subjectLarkAppIds: unknown; } export type ExactChatGrantRequestInput = ExactChatGrantInput | ExactChatGrantByLarkAppIdsInput; export interface ExactChatGrantSubjectResult { subjectOpenId: string; chatGrantActive: boolean; changed: boolean; grantsTalk: boolean; grantsOperate: false; } export interface ExactChatGrantSuccess { ok: true; operation: ExactChatGrantOperation; permissionSource: 'chatGrant'; talkOnly: true; receiverLarkAppId: string; chatId: string; grantsTalk: boolean; grantsOperate: false; subjects: ExactChatGrantSubjectResult[]; subjectMappings?: CurrentChatBotAppMapping[]; } export interface ExactChatGrantFailure { ok: false; status: number; error: string; message: string; invalidSubjectOpenIds?: string[]; invalidSubjectLarkAppIds?: string[]; partial?: ExactChatGrantSubjectResult[]; } type GrantMutationResult = { ok: true; created: boolean; } | { ok: false; reason: string; }; type RevokeMutationResult = { ok: true; removed: boolean; } | { ok: false; reason: string; }; export interface ExactChatGrantDeps { getOwnerOpenId(larkAppId: string): string | undefined; getReceiverBotOpenId(larkAppId: string): string | undefined; listCurrentChatBotMembers(larkAppId: string, chatId: string): Promise; resolveCurrentChatBotOpenIdsByLarkAppIds(receiverLarkAppId: string, chatId: string, subjectLarkAppIds: string[]): Promise; addChatGrant(larkAppId: string, chatId: string, openId: string): Promise; removeChatGrant(larkAppId: string, chatId: string, openId: string): Promise; listGrantedOpenIds(larkAppId: string, chatId: string): string[]; } export declare const MAX_EXACT_CHAT_GRANT_SUBJECTS = 50; /** * Validate and apply one exact chat-grant batch. For grants, every target is * validated against one live membership snapshot before the first mutation, * so a bad or stale subject cannot produce a partially-authorized batch. */ export declare function applyExactChatGrant(input: ExactChatGrantInput, deps?: ExactChatGrantDeps): Promise; /** * Resolve stable subject app ids inside the receiver daemon, then delegate the * actual membership validation, mutation, and readback contract to the existing * exact open-id grant primitive. */ export declare function applyExactChatGrantByLarkAppIds(input: ExactChatGrantByLarkAppIdsInput, deps?: ExactChatGrantDeps): Promise; /** Shared endpoint entry point; callers must provide exactly one subject form. */ export declare function applyExactChatGrantRequest(input: ExactChatGrantRequestInput, deps?: ExactChatGrantDeps): Promise; export {}; //# sourceMappingURL=exact-chat-grant.d.ts.map