import type { SendPacketResult } from '../protocol/packet-sender'; import type { ApiHub } from './apis'; import type { GroupFilesResult } from './actions/group-file'; import type { MediaIndexNode } from './actions/shared'; import type { ClientKeyInfo, DownloadRKeyInfo, UploadedFileMeta, } from './bridge'; import type { BridgeEventBus } from './event-bus'; import type { ForwardNodePayload } from './events'; import type { IdentityService } from './identity-service'; import type { WebHonorType } from './web/group-honor'; export interface BridgeInterface { // ─── Shared state ─── readonly identity: IdentityService; readonly events: BridgeEventBus; readonly activePid: number | null; /** * Typed Api hub — `apis.message.sendGroup(...)`, `apis.message.recallGroup(...)`, * etc. The shape of `ApiHub` grows commit-by-commit as the #6 * refactor moves the remaining areas (group-admin, group-file, * profile, …) off Bridge and onto their dedicated Api classes. */ readonly apis: ApiHub; // ─── Resolution ─── resolveUserUid(uin: number, groupId?: number): Promise; // ─── Raw packet (deliberate escape hatch for `send_packet` action) ─── // OneBot clients use this to debug or invoke commands SnowLuma has no // typed wrapper for. Every other method on this interface eventually // routes through here. sendRawPacket(serviceCmd: string, body: Uint8Array, timeoutMs?: number): Promise; // ─── Send-side protocol helpers (used by Api classes) ─── nextMessageRandom(): number; nextClientSequence(): number; // ─── Send (messages) ─── // Moved to `apis.message.{sendGroup, sendPrivate, sendC2cFile, // recallGroup, recallPrivate, markGroupRead, markPrivateRead}`. // ─── Fetch (contacts / profile / system) — moved to apis.contacts ─── // ─── Group admin (moved to apis.groupAdmin) ─── setGroupReaction(groupId: number, sequence: number, code: string, isSet: boolean): Promise; setGroupEssence(groupId: number, sequence: number, random: number, enable: boolean): Promise; // ─── Friend ─── setFriendAddRequest(uidOrFlag: string, approve: boolean): Promise; deleteFriend(userId: number, block?: boolean): Promise; setFriendRemark(userId: number, remark: string): Promise; // ─── Files ─── uploadGroupFile(groupId: number, file: string, name?: string, folderId?: string, uploadFile?: boolean): Promise<{ fileId: string | null }>; uploadPrivateFile(userId: number, file: string, name?: string, uploadFile?: boolean): Promise<{ fileId: string | null }>; /** * Publish a previously-uploaded group file as a chat message via * `OidbSvcTrpcTcp.0x6d9_4`. The atomic upload+publish flow inside * `uploadGroupFile` already does this, but the OneBot send-message * path needs it too for {type:'file', file_id} segments. */ sendGroupFileMessage(groupId: number, fileId: string): Promise; /** Cache file metadata so a later send_msg with just `file_id` can rehydrate it. */ rememberUploadedFile(meta: UploadedFileMeta): void; recallUploadedFile(fileId: string): UploadedFileMeta | undefined; fetchGroupFiles(groupId: number, folderId?: string): Promise; fetchGroupFileUrl(groupId: number, fileId: string, busId?: number): Promise; fetchPrivateFileUrl(userId: number, fileId: string, fileHash: string): Promise; fetchGroupPttUrlByNode(groupId: number, node: MediaIndexNode): Promise; fetchPrivatePttUrlByNode(node: MediaIndexNode): Promise; fetchGroupVideoUrlByNode(groupId: number, node: MediaIndexNode): Promise; fetchPrivateVideoUrlByNode(node: MediaIndexNode): Promise; deleteGroupFile(groupId: number, fileId: string): Promise; moveGroupFile(groupId: number, fileId: string, parentDirectory: string, targetDirectory: string): Promise; createGroupFileFolder(groupId: number, name: string, parentId?: string): Promise; deleteGroupFileFolder(groupId: number, folderId: string): Promise; renameGroupFileFolder(groupId: number, folderId: string, newFolderName: string): Promise; fetchGroupFileCount(groupId: number): Promise<{ fileCount: number; maxCount: number }>; // ─── Group Album ─── getGroupAlbumList(groupId: number): Promise; uploadImageToGroupAlbum(groupId: number, albumId: string, albumName: string, filePath: string): Promise; getGroupAlbumMediaList(groupId: number, albumId: string, attachInfo?: string): Promise; commentGroupAlbumMedia(groupId: number, albumId: string, lloc: string, content: string): Promise; deleteGroupAlbumMedia(groupId: number, albumId: string, lloc: string): Promise; likeGroupAlbumMedia(groupId: number, albumId: string, batchId: string, lloc: string | undefined, isLike: boolean): Promise; // ─── Forward ─── uploadForwardNodes(nodes: ForwardNodePayload[], groupId?: number, userId?: number): Promise; fetchForwardNodes(resId: string): Promise; // ─── Message ops (moved to apis.message) ─── // ─── Interaction ─── sendPoke(isGroup: boolean, peerUin: number, targetUin?: number): Promise; sendLike(userId: number, count: number): Promise; getEmojiLikes(groupId: number, sequence: number, emojiId: string, emojiType?: number, count?: number, cookie?: string): Promise<{ users: Array<{ uin: number }>; cookie: string; isLast: boolean }>; // ─── Web-backed ─── getGroupHonorInfo(groupId: number, type: WebHonorType | string): Promise; forceFetchClientKey(): Promise; getGroupEssence(groupId: number, pageStart?: number, pageLimit?: number): Promise; getGroupEssenceAll(groupId: number): Promise; sendGroupNotice(groupId: number, content: string, options?: any): Promise; getGroupNotice(groupId: number): Promise; deleteGroupNotice(groupId: number, fid: string): Promise; getCookiesStr(domain: string): Promise; getCsrfToken(): Promise; getCredentials(domain: string): Promise; // ─── Personal profile ─── setOnlineStatus(status: number, extStatus?: number, batteryStatus?: number): Promise; setDiyOnlineStatus(faceId: number, wording: string, faceType: number): Promise; setProfile(nickname?: string, personalNote?: string): Promise; setSelfLongNick(longNick: string): Promise; setInputStatus(userId: number, eventType: number): Promise; setAvatar(source: string): Promise; setGroupAvatar(groupId: number, source: string): Promise; fetchCustomFace(count?: number): Promise; getProfileLike(userId?: number, start?: number, limit?: number): Promise; getUnidirectionalFriendList(): Promise; // ─── Misc ─── translateEn2Zh(words: string[]): Promise; getMiniAppArk(type: string, title: string, desc: string, picUrl: string, jumpUrl: string): Promise; clickInlineKeyboardButton(groupId: number, botAppid: number, buttonId: string, callbackData: string, msgSeq: number): Promise; sendGroupSign(groupId: number): Promise; // ─── Tier-2 napcat parity extras ─── setGroupTodo(groupId: number, msgSeq: bigint | number | string): Promise; completeGroupTodo(groupId: number, msgSeq: bigint | number | string): Promise; cancelGroupTodo(groupId: number, msgSeq: bigint | number | string): Promise; getStrangerStatus(uin: number): Promise<{ status: number; ext_status: number } | null>; fetchAiVoiceList(groupId: number, chatType: number): Promise }>>; fetchAiVoice(groupId: number, voiceId: string, text: string, chatType: number): Promise; }