import type { EffectiveRoleValue, RoleProfileEntryLike } from './role-profile-match.js'; export interface BotInfo { larkAppId: string; botName: string; inChat: boolean; hasRole: boolean; hasMessageListener?: boolean; oncallChat: unknown; } export interface DashboardBot { larkAppId: string; botName: string; botAvatarUrl?: string; } export interface GroupInfo { chatId: string; name?: string; memberBots: BotInfo[]; } export type RoleInjectMode = 'every' | 'once'; export interface RoleData { chatId: string; content: string | null; byteLength: number; hasRole: boolean; injectMode?: RoleInjectMode; dispatchCompletionEnabled?: boolean; effectiveContent?: string | null; effectiveSource?: string; hasEffectiveRole?: boolean; } export interface MessageListenerData { enabled: boolean; name?: string; replyCardTitle?: string; workingDir?: string; prompt: string; senderPolicy?: { mode?: 'all_except_excluded' | 'include_only'; includeSenderOpenIds?: string[]; excludeSenderOpenIds?: string[]; excludeSenderKinds?: Record; includeSenderTypes?: Array<'user' | 'bot'>; excludeSenderTypes?: Array<'user' | 'bot'>; excludeSelf?: boolean; }; messagePolicy?: { includeMsgTypes?: string[]; scope?: 'top_level'; }; } export interface MessageListenerPreviewItem { messageId: string; createTime?: string; messageText: string; messageTitle?: string; msgType: string; senderOpenId?: string; senderName?: string; senderType: 'user' | 'bot'; } export type MessageListenerRunPreviewState = 'triggered' | 'running' | 'replied' | 'failed'; export interface MessageListenerRunPreviewResult { runId?: string; messageId: string; ok: boolean; state?: MessageListenerRunPreviewState; action?: string; sessionId?: string; triggerId?: string; error?: string; replyMessageId?: string; createdAt?: string; updatedAt?: string; finishedAt?: string; } export interface MessageListenerPreviewResponse { ok: boolean; requestedLimit: number; matches: MessageListenerPreviewItem[]; runId?: string; results?: MessageListenerRunPreviewResult[]; error?: string; } export interface MessageListenerRunPreviewStatusResponse { ok: boolean; runId?: string; results?: MessageListenerRunPreviewResult[]; error?: string; } export interface GroupMemberDisplay { openId: string; name: string; memberType: 'user' | 'bot' | 'unknown'; } export interface RoleProfileSummary { profileId: string; entryCount: number; updatedAt: number | null; botEntries?: Array<{ larkAppId: string; hasEntry: boolean; }>; } export interface RoleProfileEntry { profileId: string; larkAppId: string; content: string; byteLength: number; updatedAt: number | null; } export interface RoleProfileEntryData { profileId: string; larkAppId: string; content: string | null; byteLength: number; hasEntry: boolean; } export interface RoleProfileContext { entriesByProfile: Map; effectiveRolesByBot: Map; } export interface RoleProfileApplyResult { larkAppId: string; ok: boolean; status: number; error?: unknown; wouldRefuse?: boolean; } export declare const MAX_ROLE_BYTES = 32768; export declare const ROLE_WARN_BYTES: number; export declare const MAX_MESSAGE_LISTENER_PROMPT_BYTES = 32768; export declare const MESSAGE_LISTENER_WARN_BYTES: number; export declare const DEFAULT_MESSAGE_LISTENER_PREVIEW_LIMIT = 5; export declare const MAX_MESSAGE_LISTENER_PREVIEW_LIMIT = 20; export declare function isValidProfileId(profileId: string): boolean; export declare function hashChatId(hash?: string): string | null; export declare function roleKey(larkAppId: string, chatId: string): string; export declare function byteLength(s: string): number; export declare function botRoleCount(group: GroupInfo): number; export declare function botInChatCount(group: GroupInfo): number; export declare function profileHasEntry(profile: RoleProfileSummary, larkAppId: string): boolean; export declare function entryForBot(entries: RoleProfileEntry[], larkAppId: string | null): RoleProfileEntry | undefined; export declare function filterRoleGroups(groups: GroupInfo[], filter: string): GroupInfo[]; export declare function filterRoleProfiles(profiles: RoleProfileSummary[], filter: string): RoleProfileSummary[]; export declare function loadGroups(): Promise<{ groups: GroupInfo[]; bots: DashboardBot[]; }>; export declare function loadProfiles(): Promise; export declare function loadProfileEntries(profileId: string): Promise; export declare function loadRole(larkAppId: string, chatId: string): Promise; export declare function saveRole(larkAppId: string, chatId: string, content: string, injectMode: RoleInjectMode, dispatchCompletionEnabled: boolean): Promise; /** Persist only the injection mode (no content) — used when toggling the mode * select, which can apply even to a chat whose role comes from the team default. */ export declare function saveInjectMode(larkAppId: string, chatId: string, injectMode: RoleInjectMode): Promise; export declare function saveDispatchCompletionEnabled(larkAppId: string, chatId: string, dispatchCompletionEnabled: boolean): Promise; export declare function deleteRole(larkAppId: string, chatId: string): Promise; export declare function loadMessageListener(larkAppId: string, chatId: string): Promise; export declare function saveMessageListener(larkAppId: string, chatId: string, listener: MessageListenerData): Promise; export declare function deleteMessageListener(larkAppId: string, chatId: string): Promise; export declare function normalizeListenerPreviewLimit(limit: number): number; export declare function formatListenerPreviewTime(createTime: string | undefined): string; export declare function previewMessageListener(larkAppId: string, chatId: string, listener: MessageListenerData, limit: number): Promise; export declare function runMessageListenerPreview(larkAppId: string, chatId: string, listener: MessageListenerData, limit: number): Promise; export declare function loadMessageListenerRunPreviewStatus(larkAppId: string, chatId: string, runId: string): Promise; export declare function loadGroupMemberDisplays(larkAppId: string, chatId: string): Promise; export declare function loadProfileEntry(profileId: string, larkAppId: string): Promise; export declare function saveProfileEntry(profileId: string, larkAppId: string, content: string): Promise; export declare function deleteProfileEntry(profileId: string, larkAppId: string): Promise; export declare function loadRoleProfileContext(groups: GroupInfo[], profiles: RoleProfileSummary[]): Promise; export declare function applyRoleProfile(input: { profileId: string; chatId: string; larkAppId: string; force: boolean; preview: boolean; }): Promise; //# sourceMappingURL=roles.d.ts.map