refactor(packages): rename @snowluma/bridge → @snowluma/protocol

The package previously named "bridge" houses the protocol-byte layer
(OIDB cmds, msg-push decoders, highway uploaders, element-builder,
event bus). The name "bridge" suggested transport/lifecycle, which it
isn't — that role lives in core/hook and core/bridge/manager. Rename
to match what's actually inside.

This is a pure rename: zero logic changes, all 73 import sites updated
mechanically and TS-verified. core/onebot dependencies key updated.
ESLint override path adjusted for the moved oidb-services directory.

Rename detection threshold: git log --find-renames=20% recommended
when following history across this commit — content-replacement
(@snowluma/bridge → @snowluma/protocol) dropped per-file similarity
below git's default 50% on import-heavy files.
This commit is contained in:
DrSmoothl committed 2026-05-23 23:31:03 +08:00
1 parent 98296fcec5
commit c16064d7e3
238 files changed
+247 -284

No files matched your search

+1 -1
View File
@@ -40,9 +40,9 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@snowluma/bridge": "workspace:*",
"@snowluma/common": "workspace:*",
"@snowluma/onebot": "workspace:*",
"@snowluma/protocol": "workspace:*",
"@snowluma/proto-defs": "workspace:*",
"@snowluma/proton": "workspace:*",
"@snowluma/sqlite": "workspace:*",
+8 -8
View File
@@ -13,14 +13,14 @@ import type {
GroupRequestInfo,
QQGroupInfo,
UserProfileInfo,
} from '@snowluma/bridge/qq-info';
import { FetchFriendListPage } from '@snowluma/bridge/oidb-services/contacts/fetch-friend-list-page';
import { FetchGroupList } from '@snowluma/bridge/oidb-services/contacts/fetch-group-list';
import { FetchGroupMemberListPage } from '@snowluma/bridge/oidb-services/contacts/fetch-group-member-list-page';
import { FetchUserProfile } from '@snowluma/bridge/oidb-services/contacts/fetch-user-profile';
import { FetchUserProfileByUid } from '@snowluma/bridge/oidb-services/contacts/fetch-user-profile-by-uid';
import { FetchGroupRequests } from '@snowluma/bridge/oidb-services/contacts/fetch-group-requests';
import { FetchDownloadRkeys } from '@snowluma/bridge/oidb-services/contacts/fetch-download-rkeys';
} from '@snowluma/protocol/qq-info';
import { FetchFriendListPage } from '@snowluma/protocol/oidb-services/contacts/fetch-friend-list-page';
import { FetchGroupList } from '@snowluma/protocol/oidb-services/contacts/fetch-group-list';
import { FetchGroupMemberListPage } from '@snowluma/protocol/oidb-services/contacts/fetch-group-member-list-page';
import { FetchUserProfile } from '@snowluma/protocol/oidb-services/contacts/fetch-user-profile';
import { FetchUserProfileByUid } from '@snowluma/protocol/oidb-services/contacts/fetch-user-profile-by-uid';
import { FetchGroupRequests } from '@snowluma/protocol/oidb-services/contacts/fetch-group-requests';
import { FetchDownloadRkeys } from '@snowluma/protocol/oidb-services/contacts/fetch-download-rkeys';
// ─── Helpers (previously in bridge-contacts.ts) ───────────────────
+5 -5
View File
@@ -1,17 +1,17 @@
// ExtrasApi — facade over Tier-2 napcat-parity OIDB cmds (group
// todo CRUD / stranger status decode / AI voice list + synthesis).
// Every method is a one-line forwarder to a self-contained namespace
// under @snowluma/bridge/oidb-services/extras.
// under @snowluma/protocol/oidb-services/extras.
import type { MediaIndexNode } from './shared';
import type { BridgeContext } from '../bridge-context';
import { GroupTodo } from '@snowluma/bridge/oidb-services/extras/group-todo';
import { GetStrangerStatus, type StrangerStatus as NamespaceStrangerStatus } from '@snowluma/bridge/oidb-services/extras/get-stranger-status';
import { GroupTodo } from '@snowluma/protocol/oidb-services/extras/group-todo';
import { GetStrangerStatus, type StrangerStatus as NamespaceStrangerStatus } from '@snowluma/protocol/oidb-services/extras/get-stranger-status';
import {
FetchAiVoiceList,
type AiVoiceCategory as NamespaceAiVoiceCategory,
} from '@snowluma/bridge/oidb-services/extras/fetch-ai-voice-list';
import { FetchAiVoice } from '@snowluma/bridge/oidb-services/extras/fetch-ai-voice';
} from '@snowluma/protocol/oidb-services/extras/fetch-ai-voice-list';
import { FetchAiVoice } from '@snowluma/protocol/oidb-services/extras/fetch-ai-voice';
// ─────────────── public types (re-exported from bridge.ts as before) ───
+3 -3
View File
@@ -23,9 +23,9 @@ import type { FileExtra, PushMsg, PushMsgBody } from '@snowluma/proto-defs/messa
import type { PacketInfo } from '@snowluma/common/protocol-types';
import type { BridgeContext } from '../bridge-context';
import type { Bridge } from '../bridge';
import { buildSendElems } from '@snowluma/bridge/element-builder';
import type { ForwardNodePayload, MessageElement } from '@snowluma/bridge/events';
import { parseMsgPush } from '@snowluma/bridge/msg-push';
import { buildSendElems } from '@snowluma/protocol/element-builder';
import type { ForwardNodePayload, MessageElement } from '@snowluma/protocol/events';
import { parseMsgPush } from '@snowluma/protocol/msg-push';
import { resolveSelfUid, toInt } from './shared';
function asBridge(ctx: BridgeContext): Bridge { return ctx as unknown as Bridge; }
+4 -4
View File
@@ -1,15 +1,15 @@
// FriendApi — facade over friend-roster OIDB cmds. Every method is a
// one-line forwarder to a self-contained namespace under
// @snowluma/bridge/oidb-services/friend. The `delete()` facade method
// @snowluma/protocol/oidb-services/friend. The `delete()` facade method
// adds a best-effort friend-list cache invalidation after the OIDB
// call succeeds — that side-effect stays on the facade because it
// reaches into `ctx.apis.contacts`, which the namespace deliberately
// can't see.
import type { BridgeContext } from '../bridge-context';
import { HandleFriendRequest } from '@snowluma/bridge/oidb-services/friend/handle-friend-request';
import { DeleteFriend } from '@snowluma/bridge/oidb-services/friend/delete-friend';
import { SetFriendRemark } from '@snowluma/bridge/oidb-services/friend/set-friend-remark';
import { HandleFriendRequest } from '@snowluma/protocol/oidb-services/friend/handle-friend-request';
import { DeleteFriend } from '@snowluma/protocol/oidb-services/friend/delete-friend';
import { SetFriendRemark } from '@snowluma/protocol/oidb-services/friend/set-friend-remark';
export class FriendApi {
constructor(private readonly ctx: BridgeContext) {}
+15 -15
View File
@@ -2,27 +2,27 @@
// cmds (mute / kick / admin / card / name / title / leave / join-policy
// / add-request handling / @everyone budget). Every method is a
// one-line forwarder to a self-contained namespace under
// @snowluma/bridge/oidb-services/group-admin.
// @snowluma/protocol/oidb-services/group-admin.
//
// The Apis facade keeps `bridge.apis.groupAdmin.X()` as the ergonomic
// call site; the per-(cmd, subcmd) namespaces own the wire shape and
// minimal capability surface.
import type { BridgeContext } from '../bridge-context';
import { MuteMember } from '@snowluma/bridge/oidb-services/group-admin/mute-member';
import { MuteAll } from '@snowluma/bridge/oidb-services/group-admin/mute-all';
import { SetAddOption } from '@snowluma/bridge/oidb-services/group-admin/set-add-option';
import { SetSearch } from '@snowluma/bridge/oidb-services/group-admin/set-search';
import { SetAddRequest } from '@snowluma/bridge/oidb-services/group-admin/set-add-request';
import { KickMember } from '@snowluma/bridge/oidb-services/group-admin/kick-member';
import { KickMembers } from '@snowluma/bridge/oidb-services/group-admin/kick-members';
import { LeaveGroup } from '@snowluma/bridge/oidb-services/group-admin/leave-group';
import { SetAdmin } from '@snowluma/bridge/oidb-services/group-admin/set-admin';
import { SetMemberCard } from '@snowluma/bridge/oidb-services/group-admin/set-member-card';
import { SetGroupName } from '@snowluma/bridge/oidb-services/group-admin/set-group-name';
import { SetSpecialTitle } from '@snowluma/bridge/oidb-services/group-admin/set-special-title';
import { SetGroupRemark } from '@snowluma/bridge/oidb-services/group-admin/set-group-remark';
import { GetAtAllRemain } from '@snowluma/bridge/oidb-services/group-admin/get-at-all-remain';
import { MuteMember } from '@snowluma/protocol/oidb-services/group-admin/mute-member';
import { MuteAll } from '@snowluma/protocol/oidb-services/group-admin/mute-all';
import { SetAddOption } from '@snowluma/protocol/oidb-services/group-admin/set-add-option';
import { SetSearch } from '@snowluma/protocol/oidb-services/group-admin/set-search';
import { SetAddRequest } from '@snowluma/protocol/oidb-services/group-admin/set-add-request';
import { KickMember } from '@snowluma/protocol/oidb-services/group-admin/kick-member';
import { KickMembers } from '@snowluma/protocol/oidb-services/group-admin/kick-members';
import { LeaveGroup } from '@snowluma/protocol/oidb-services/group-admin/leave-group';
import { SetAdmin } from '@snowluma/protocol/oidb-services/group-admin/set-admin';
import { SetMemberCard } from '@snowluma/protocol/oidb-services/group-admin/set-member-card';
import { SetGroupName } from '@snowluma/protocol/oidb-services/group-admin/set-group-name';
import { SetSpecialTitle } from '@snowluma/protocol/oidb-services/group-admin/set-special-title';
import { SetGroupRemark } from '@snowluma/protocol/oidb-services/group-admin/set-group-remark';
import { GetAtAllRemain } from '@snowluma/protocol/oidb-services/group-admin/get-at-all-remain';
export class GroupAdminApi {
constructor(private readonly ctx: BridgeContext) {}
+1 -1
View File
@@ -17,7 +17,7 @@ import type {
} from '@snowluma/proto-defs/oidb-actions/group-album';
import type { BridgeContext } from '../bridge-context';
import type { Bridge } from '../bridge';
import { getGroupAlbumList, uploadImageToGroupAlbum } from '@snowluma/bridge/web/group-album';
import { getGroupAlbumList, uploadImageToGroupAlbum } from '@snowluma/protocol/web/group-album';
// `getCookies` is part of WebApi — go through the hub so we don't
// duplicate the cookie acquisition flow.
+20 -20
View File
@@ -2,7 +2,7 @@
// download URL resolvers.
//
// Single-OIDB-call methods are one-line forwarders to namespaces
// under @snowluma/bridge/oidb-services/group-file. The multi-stage
// under @snowluma/protocol/oidb-services/group-file. The multi-stage
// methods (`upload` / `uploadPrivate`) stay here because they
// orchestrate three discrete legs (OIDB preflight → highway PUT →
// follow-on OIDB publish or message send) plus the upload-cache
@@ -13,28 +13,28 @@ import { toHexUpper } from '@snowluma/common/hex';
import { createLogger } from '@snowluma/common/logger';
import type { BridgeContext } from '../bridge-context';
import type { Bridge } from '../bridge';
import { fetchHighwaySession, uploadHighwayHttp } from '@snowluma/bridge/highway';
import { computeHashes, computeMd5, FILE_UPLOAD_MAX_BYTES, loadBinarySource } from '@snowluma/bridge/highway/utils';
import { fetchHighwaySession, uploadHighwayHttp } from '@snowluma/protocol/highway';
import { computeHashes, computeMd5, FILE_UPLOAD_MAX_BYTES, loadBinarySource } from '@snowluma/protocol/highway/utils';
import type { FileUploadExt } from '@snowluma/proto-defs/highway';
import { resolveSelfUid, toInt, type MediaIndexNode } from './shared';
import { PublishGroupFile } from '@snowluma/bridge/oidb-services/group-file/publish-group-file';
import { GetGroupFileCount } from '@snowluma/bridge/oidb-services/group-file/get-group-file-count';
import { UploadGroupFileRequest } from '@snowluma/bridge/oidb-services/group-file/upload-group-file-request';
import { UploadPrivateFileRequest } from '@snowluma/bridge/oidb-services/group-file/upload-private-file-request';
import { ListGroupFilesPage } from '@snowluma/bridge/oidb-services/group-file/list-group-files-page';
import { GetGroupFileUrl } from '@snowluma/bridge/oidb-services/group-file/get-group-file-url';
import { GetPrivateFileUrl } from '@snowluma/bridge/oidb-services/group-file/get-private-file-url';
import { DeleteGroupFile } from '@snowluma/bridge/oidb-services/group-file/delete-group-file';
import { MoveGroupFile } from '@snowluma/bridge/oidb-services/group-file/move-group-file';
import { CreateGroupFolder } from '@snowluma/bridge/oidb-services/group-file/create-group-folder';
import { DeleteGroupFolder } from '@snowluma/bridge/oidb-services/group-file/delete-group-folder';
import { RenameGroupFolder } from '@snowluma/bridge/oidb-services/group-file/rename-group-folder';
import { GetGroupPttUrl } from '@snowluma/bridge/oidb-services/group-file/get-group-ptt-url';
import { GetPrivatePttUrl } from '@snowluma/bridge/oidb-services/group-file/get-private-ptt-url';
import { GetGroupVideoUrl } from '@snowluma/bridge/oidb-services/group-file/get-group-video-url';
import { GetPrivateVideoUrl } from '@snowluma/bridge/oidb-services/group-file/get-private-video-url';
import { ensureRetCodeZero } from '@snowluma/bridge/oidb-services/shared';
import { PublishGroupFile } from '@snowluma/protocol/oidb-services/group-file/publish-group-file';
import { GetGroupFileCount } from '@snowluma/protocol/oidb-services/group-file/get-group-file-count';
import { UploadGroupFileRequest } from '@snowluma/protocol/oidb-services/group-file/upload-group-file-request';
import { UploadPrivateFileRequest } from '@snowluma/protocol/oidb-services/group-file/upload-private-file-request';
import { ListGroupFilesPage } from '@snowluma/protocol/oidb-services/group-file/list-group-files-page';
import { GetGroupFileUrl } from '@snowluma/protocol/oidb-services/group-file/get-group-file-url';
import { GetPrivateFileUrl } from '@snowluma/protocol/oidb-services/group-file/get-private-file-url';
import { DeleteGroupFile } from '@snowluma/protocol/oidb-services/group-file/delete-group-file';
import { MoveGroupFile } from '@snowluma/protocol/oidb-services/group-file/move-group-file';
import { CreateGroupFolder } from '@snowluma/protocol/oidb-services/group-file/create-group-folder';
import { DeleteGroupFolder } from '@snowluma/protocol/oidb-services/group-file/delete-group-folder';
import { RenameGroupFolder } from '@snowluma/protocol/oidb-services/group-file/rename-group-folder';
import { GetGroupPttUrl } from '@snowluma/protocol/oidb-services/group-file/get-group-ptt-url';
import { GetPrivatePttUrl } from '@snowluma/protocol/oidb-services/group-file/get-private-ptt-url';
import { GetGroupVideoUrl } from '@snowluma/protocol/oidb-services/group-file/get-group-video-url';
import { GetPrivateVideoUrl } from '@snowluma/protocol/oidb-services/group-file/get-private-video-url';
import { ensureRetCodeZero } from '@snowluma/protocol/oidb-services/shared';
const log = createLogger('GroupFile');
+7 -7
View File
@@ -1,18 +1,18 @@
// InteractionApi — facade over interactive-engagement OIDB cmds
// (poke / like / reaction / essence / emoji-like-list). Every method
// is a one-line forwarder to a self-contained namespace under
// @snowluma/bridge/oidb-services. The facade exists purely to keep
// @snowluma/protocol/oidb-services. The facade exists purely to keep
// the `bridge.apis.interaction.X(...)` ergonomic call style; all wire
// work (envelope build / encode / send / decode) lives in the
// namespace files.
import type { BridgeContext } from '../bridge-context';
import { SendPoke } from '@snowluma/bridge/oidb-services/interaction/send-poke';
import { SendLike } from '@snowluma/bridge/oidb-services/interaction/send-like';
import { SetEssence } from '@snowluma/bridge/oidb-services/interaction/set-essence';
import { SetReaction } from '@snowluma/bridge/oidb-services/reaction/set-reaction';
import { FetchReactionSummary } from '@snowluma/bridge/oidb-services/reaction/fetch-reaction-summary';
import { GetEmojiLikes } from '@snowluma/bridge/oidb-services/reaction/get-emoji-likes';
import { SendPoke } from '@snowluma/protocol/oidb-services/interaction/send-poke';
import { SendLike } from '@snowluma/protocol/oidb-services/interaction/send-like';
import { SetEssence } from '@snowluma/protocol/oidb-services/interaction/set-essence';
import { SetReaction } from '@snowluma/protocol/oidb-services/reaction/set-reaction';
import { FetchReactionSummary } from '@snowluma/protocol/oidb-services/reaction/fetch-reaction-summary';
import { GetEmojiLikes } from '@snowluma/protocol/oidb-services/reaction/get-emoji-likes';
export class InteractionApi {
constructor(private readonly ctx: BridgeContext) {}
+2 -2
View File
@@ -22,8 +22,8 @@ import type {
GroupRecallRequest,
SsoReadedReportReq,
} from '@snowluma/proto-defs/oidb-actions/base';
import type { MessageElement } from '@snowluma/bridge/events';
import { buildSendElems } from '@snowluma/bridge/element-builder';
import type { MessageElement } from '@snowluma/protocol/events';
import { buildSendElems } from '@snowluma/protocol/element-builder';
import type { BridgeContext } from '../bridge-context';
// `Bridge` is imported as a type only so we can narrow `ctx` back to
// the concrete Bridge instance when passing it to `buildSendElems`
+3 -3
View File
@@ -10,9 +10,9 @@ import type {
} from '@snowluma/proto-defs/oidb-actions/base';
import type { BridgeContext } from '../bridge-context';
// Migrated OIDB cmds — facade methods are one-line forwarders.
import { TranslateEnToZh } from '@snowluma/bridge/oidb-services/misc/translate-en-to-zh';
import { ClickInlineKeyboardButton } from '@snowluma/bridge/oidb-services/misc/click-inline-keyboard-button';
import { SendGroupSign } from '@snowluma/bridge/oidb-services/misc/send-group-sign';
import { TranslateEnToZh } from '@snowluma/protocol/oidb-services/misc/translate-en-to-zh';
import { ClickInlineKeyboardButton } from '@snowluma/protocol/oidb-services/misc/click-inline-keyboard-button';
import { SendGroupSign } from '@snowluma/protocol/oidb-services/misc/send-group-sign';
export class MiscApi {
constructor(private readonly ctx: BridgeContext) {}
+7 -7
View File
@@ -12,14 +12,14 @@ import type {
} from '@snowluma/proto-defs/oidb-actions/base';
import type { BridgeContext } from '../bridge-context';
import type { Bridge } from '../bridge';
import { fetchHighwaySession, uploadHighwayHttp } from '@snowluma/bridge/highway';
import { computeHashes, loadBinarySource } from '@snowluma/bridge/highway/utils';
import { fetchHighwaySession, uploadHighwayHttp } from '@snowluma/protocol/highway';
import { computeHashes, loadBinarySource } from '@snowluma/protocol/highway/utils';
// Migrated OIDB cmds — facade methods are one-line forwarders.
import { SetProfile } from '@snowluma/bridge/oidb-services/profile/set-profile';
import { SetSelfLongNick } from '@snowluma/bridge/oidb-services/profile/set-self-long-nick';
import { SetInputStatus } from '@snowluma/bridge/oidb-services/profile/set-input-status';
import { GetLike } from '@snowluma/bridge/oidb-services/profile/get-like';
import { GetUnidirectionalFriendList } from '@snowluma/bridge/oidb-services/profile/get-unidirectional-friend-list';
import { SetProfile } from '@snowluma/protocol/oidb-services/profile/set-profile';
import { SetSelfLongNick } from '@snowluma/protocol/oidb-services/profile/set-self-long-nick';
import { SetInputStatus } from '@snowluma/protocol/oidb-services/profile/set-input-status';
import { GetLike } from '@snowluma/protocol/oidb-services/profile/get-like';
import { GetUnidirectionalFriendList } from '@snowluma/protocol/oidb-services/profile/get-unidirectional-friend-list';
function asBridge(ctx: BridgeContext): Bridge { return ctx as unknown as Bridge; }
+6 -6
View File
@@ -6,19 +6,19 @@
import type { BridgeContext } from '../bridge-context';
import type { Bridge } from '../bridge';
import { getGroupEssenceMsg, getGroupEssenceMsgAll } from '@snowluma/bridge/web/group-essence';
import { getHonorListWebAPI, WebHonorType } from '@snowluma/bridge/web/group-honor';
import { getGroupEssenceMsg, getGroupEssenceMsgAll } from '@snowluma/protocol/web/group-essence';
import { getHonorListWebAPI, WebHonorType } from '@snowluma/protocol/web/group-honor';
import {
deleteGroupNotice as deleteGroupNoticeHttp,
getGroupNoticeWebAPI,
setGroupNoticeWebAPI,
uploadGroupNoticeImage,
} from '@snowluma/bridge/web/group-notice';
import { RequestUtil } from '@snowluma/bridge/web/request-util';
} from '@snowluma/protocol/web/group-notice';
import { RequestUtil } from '@snowluma/protocol/web/request-util';
// Migrated OIDB cmds — the two private helpers below are thin
// forwarders into the namespaces.
import { ForceFetchClientKey, type ClientKeyInfo as NamespaceClientKeyInfo } from '@snowluma/bridge/oidb-services/web/force-fetch-client-key';
import { GetPskey } from '@snowluma/bridge/oidb-services/web/get-pskey';
import { ForceFetchClientKey, type ClientKeyInfo as NamespaceClientKeyInfo } from '@snowluma/protocol/oidb-services/web/force-fetch-client-key';
import { GetPskey } from '@snowluma/protocol/oidb-services/web/get-pskey';
function asBridge(ctx: BridgeContext): Bridge { return ctx as unknown as Bridge; }
+6 -6
View File
@@ -1,6 +1,6 @@
// Api-layer extension of @snowluma/bridge's slim BridgeContext.
// Api-layer extension of @snowluma/protocol's slim BridgeContext.
//
// The slim interface in @snowluma/bridge has the protocol-layer
// The slim interface in @snowluma/protocol has the protocol-layer
// surface (identity / events / sendRawPacket / resolveUserUid / next*
// sequence helpers / upload-metadata cache). This file extends it
// with `apis: ApiHub` — the typed bag of Api classes that lives ONLY
@@ -10,10 +10,10 @@
// The 13 Api classes (apis/<area>.ts) import `BridgeContext` from
// here, which gives them `this.ctx.apis.message.sendGroup(...)` type-
// safety alongside the protocol-layer fields. Highway uploaders,
// element-builder, msg-push parsers (all in @snowluma/bridge) import
// the slim version directly from `@snowluma/bridge/bridge-context`.
// element-builder, msg-push parsers (all in @snowluma/protocol) import
// the slim version directly from `@snowluma/protocol/bridge-context`.
import type { BridgeContext as BaseBridgeContext } from '@snowluma/bridge/bridge-context';
import type { BridgeContext as BaseBridgeContext } from '@snowluma/protocol/bridge-context';
import type { ApiHub } from './apis';
export interface BridgeContext extends BaseBridgeContext {
@@ -24,4 +24,4 @@ export interface BridgeContext extends BaseBridgeContext {
// `import type { UploadedFileMeta } from '<…>/bridge-context'` (or
// from bridge.ts via re-export) keeps working without callers having
// to learn the new package path.
export type { UploadedFileMeta } from '@snowluma/bridge/bridge-context';
export type { UploadedFileMeta } from '@snowluma/protocol/bridge-context';
+4 -4
View File
@@ -1,9 +1,9 @@
import type { PacketSender, SendPacketResult } from '@snowluma/common/packet-sender';
import type { PacketInfo } from '@snowluma/common/protocol-types';
import type { BridgeInterface } from './bridge-interface';
import { IdentityService } from '@snowluma/bridge/identity-service';
import { MSG_PUSH_CMD, parseMsgPush } from '@snowluma/bridge/msg-push';
import { IncomingPacketPipeline, type CmdParser } from '@snowluma/bridge/packet-pipeline';
import { IdentityService } from '@snowluma/protocol/identity-service';
import { MSG_PUSH_CMD, parseMsgPush } from '@snowluma/protocol/msg-push';
import { IncomingPacketPipeline, type CmdParser } from '@snowluma/protocol/packet-pipeline';
// qq-info types are no longer used directly in this file — they live
// inside the Api classes that own those fetches (apis/contacts.ts).
import { type ApiHub, buildApiHub } from './apis';
@@ -35,7 +35,7 @@ import type { GroupFilesResult } from './apis/group-file';
// actions/profile.ts removed — moved to apis/profile.ts::ProfileApi.
// `bridge-contacts.ts` removed — its 6 functions are now methods on
// `apis.contacts` (see `apis/contacts.ts::ContactsApi`).
import { BridgeEventBus } from '@snowluma/bridge/event-bus';
import { BridgeEventBus } from '@snowluma/protocol/event-bus';
// web-actions/* removed — moved to apis/web.ts::WebApi.
export { AiVoiceChatType };
export type { AiVoiceCategory, StrangerStatus };
+1 -1
View File
@@ -2,7 +2,7 @@ import type { PacketSender } from '@snowluma/common/packet-sender';
import type { PacketInfo } from '@snowluma/common/protocol-types';
import { createLogger } from '@snowluma/common/logger';
import { Bridge } from './bridge';
import { IdentityService } from '@snowluma/bridge/identity-service';
import { IdentityService } from '@snowluma/protocol/identity-service';
export type SessionStartedCallback = (uin: string, bridge: Bridge) => void;
export type SessionClosedCallback = (uin: string) => void;
+1 -1
View File
@@ -14,7 +14,7 @@ import type {
} from '@snowluma/proto-defs/oidb-actions/media';
// Post-namespace migration: ExtrasApi forwards 6 OIDB cmds through
// namespaces under @snowluma/bridge/oidb-services/extras. Tests assert
// namespaces under @snowluma/protocol/oidb-services/extras. Tests assert
// against bridge.sendRawPacket directly.
import { ExtrasApi, AiVoiceChatType } from '../../src/bridge/apis/extras';
import { mockBridge } from './_helpers';
@@ -25,7 +25,7 @@
import { describe, it, expect, vi } from 'vitest';
vi.mock('@snowluma/bridge/bridge-oidb', () => ({
vi.mock('@snowluma/protocol/bridge-oidb', () => ({
runOidb: vi.fn(async () => new Uint8Array()),
makeOidbEnvelope: vi.fn((_oidbCmd, _subCmd, body) => ({ body })),
encodeOidbEnv: vi.fn(() => new Uint8Array()),
@@ -40,7 +40,7 @@ vi.mock('@snowluma/bridge/bridge-oidb', () => ({
const { buildSendElemsMock } = vi.hoisted(() => ({
buildSendElemsMock: vi.fn(async (_elements: unknown[], _ctx?: Record<string, unknown>) => []),
}));
vi.mock('@snowluma/bridge/element-builder', () => ({
vi.mock('@snowluma/protocol/element-builder', () => ({
buildSendElems: buildSendElemsMock,
}));
@@ -29,13 +29,13 @@ import type { Elem } from '@snowluma/proto-defs/element';
// Mock highway uploads only — they're irrelevant for text-only nodes
// but the import would otherwise pull in the native ffmpeg addon.
vi.mock('@snowluma/bridge/highway/image-upload', () => ({
vi.mock('@snowluma/protocol/highway/image-upload', () => ({
uploadImageMsgInfo: vi.fn(async () => new Uint8Array()),
}));
vi.mock('@snowluma/bridge/highway/ptt-upload', () => ({
vi.mock('@snowluma/protocol/highway/ptt-upload', () => ({
uploadPttMsgInfo: vi.fn(async () => new Uint8Array()),
}));
vi.mock('@snowluma/bridge/highway/video-upload', () => ({
vi.mock('@snowluma/protocol/highway/video-upload', () => ({
uploadVideoMsgInfo: vi.fn(async () => new Uint8Array()),
}));
+2 -2
View File
@@ -1,6 +1,6 @@
import { describe, it, expect, vi } from 'vitest';
vi.mock('@snowluma/bridge/bridge-oidb', () => ({
vi.mock('@snowluma/protocol/bridge-oidb', () => ({
runOidb: vi.fn(async () => new Uint8Array()),
makeOidbEnvelope: vi.fn((_oidbCmd, _subCmd, body) => ({ body })),
encodeOidbEnv: vi.fn(() => new Uint8Array()),
@@ -10,7 +10,7 @@ vi.mock('@snowluma/bridge/bridge-oidb', () => ({
// element-builder reaches into protoEncode with element-specific schemas
// that we don't want to construct manually in tests; stub it to return
// a benign placeholder.
vi.mock('@snowluma/bridge/element-builder', () => ({
vi.mock('@snowluma/protocol/element-builder', () => ({
buildSendElems: vi.fn(async () => []),
}));
+1 -1
View File
@@ -8,7 +8,7 @@ import type {
} from '@snowluma/proto-defs/oidb-actions/base';
// Post-namespace migration: FriendApi is a thin facade over the
// namespaces under @snowluma/bridge/oidb-services/friend. Tests assert
// namespaces under @snowluma/protocol/oidb-services/friend. Tests assert
// against the bridge mock's sendRawPacket directly — no need for
// module-level bridge-oidb mocks anymore.
import { FriendApi } from '../../src/bridge/apis/friend';
@@ -19,7 +19,7 @@ import type {
} from '@snowluma/proto-defs/oidb-actions/base';
// Post-namespace migration: GroupAdminApi forwards through namespaces
// under @snowluma/bridge/oidb-services/group-admin. Tests assert
// under @snowluma/protocol/oidb-services/group-admin. Tests assert
// against bridge.sendRawPacket directly — no module-level mocks.
import { GroupAdminApi } from '../../src/bridge/apis/group-admin';
import { mockBridge } from './_helpers';
@@ -15,19 +15,19 @@ import type {
} from '@snowluma/proto-defs/oidb-actions/media';
// Post-namespace migration: GroupFileApi forwards single-OIDB methods
// through namespaces under @snowluma/bridge/oidb-services/group-file.
// through namespaces under @snowluma/protocol/oidb-services/group-file.
// The multi-stage methods (`upload` / `uploadPrivate`) keep their
// orchestration on the facade; we assert against bridge.sendRawPacket
// directly. Highway calls (fetchHighwaySession / uploadHighwayHttp)
// and the file-source loader are still module-mocked because the
// facade owns those calls directly.
vi.mock('@snowluma/bridge/highway', () => ({
vi.mock('@snowluma/protocol/highway', () => ({
fetchHighwaySession: vi.fn(async () => ({})),
uploadHighwayHttp: vi.fn(async () => undefined),
}));
vi.mock('@snowluma/bridge/highway/utils', () => ({
vi.mock('@snowluma/protocol/highway/utils', () => ({
loadBinarySource: vi.fn(async (_src: string, fallback: string) => ({
bytes: new Uint8Array([1, 2, 3]),
fileName: `${fallback}.bin`,
@@ -37,7 +37,7 @@ vi.mock('@snowluma/bridge/highway/utils', () => ({
FILE_UPLOAD_MAX_BYTES: 4 * 1024 * 1024 * 1024,
}));
import * as highwayClient from '@snowluma/bridge/highway';
import * as highwayClient from '@snowluma/protocol/highway';
import { GroupFileApi } from '../../src/bridge/apis/group-file';
import { mockBridge } from './_helpers';
@@ -6,7 +6,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
vi.mock('@snowluma/bridge/bridge-oidb', () => ({
vi.mock('@snowluma/protocol/bridge-oidb', () => ({
runOidb: vi.fn(async () => new Uint8Array()),
makeOidbEnvelope: vi.fn((_oidbCmd, _subCmd, body) => ({ body })),
encodeOidbEnv: vi.fn(() => new Uint8Array()),
+1 -1
View File
@@ -7,7 +7,7 @@ import type {
} from '@snowluma/proto-defs/oidb-actions/base';
// Post-namespace migration: MiscApi forwards 3 OIDB cmds through
// @snowluma/bridge/oidb-services/misc namespaces. The non-OIDB
// @snowluma/protocol/oidb-services/misc namespaces. The non-OIDB
// `getMiniAppArk` (LightAppSvc) stays inline on the facade. Tests
// hit bridge.sendRawPacket directly.
import { MiscApi } from '../../src/bridge/apis/misc';
+8 -8
View File
@@ -14,9 +14,9 @@ import type {
// the module object is a no-op — proton has already inlined the call.
// We mock `runOidb` (non-generic) to return real proton-encoded bytes
// that the production-side codec actually decodes.
vi.mock('@snowluma/bridge/bridge-oidb', async () => {
const actual = await vi.importActual<typeof import('@snowluma/bridge/bridge-oidb')>(
'@snowluma/bridge/bridge-oidb',
vi.mock('@snowluma/protocol/bridge-oidb', async () => {
const actual = await vi.importActual<typeof import('@snowluma/protocol/bridge-oidb')>(
'@snowluma/protocol/bridge-oidb',
);
return {
...actual,
@@ -25,19 +25,19 @@ vi.mock('@snowluma/bridge/bridge-oidb', async () => {
};
});
vi.mock('@snowluma/bridge/highway', () => ({
vi.mock('@snowluma/protocol/highway', () => ({
fetchHighwaySession: vi.fn(async () => ({})),
uploadHighwayHttp: vi.fn(async () => undefined),
}));
vi.mock('@snowluma/bridge/highway/utils', () => ({
vi.mock('@snowluma/protocol/highway/utils', () => ({
loadBinarySource: vi.fn(async () => ({ bytes: new Uint8Array([1, 2, 3]), fileName: 'avatar.bin' })),
computeHashes: vi.fn(() => ({ md5: new Uint8Array(16), sha1: new Uint8Array(20) })),
computeMd5: vi.fn(() => new Uint8Array(16)),
}));
import * as oidb from '@snowluma/bridge/bridge-oidb';
import * as highwayClient from '@snowluma/bridge/highway';
import * as oidb from '@snowluma/protocol/bridge-oidb';
import * as highwayClient from '@snowluma/protocol/highway';
import { ProfileApi } from '../../src/bridge/apis/profile';
import { mockBridge } from './_helpers';
@@ -159,7 +159,7 @@ describe('apis/profile', () => {
it('setGroupAvatar rejects an empty file before hitting highway', async () => {
const bridge = mockBridge();
const { loadBinarySource } = await import('@snowluma/bridge/highway/utils');
const { loadBinarySource } = await import('@snowluma/protocol/highway/utils');
vi.mocked(loadBinarySource).mockResolvedValueOnce({
bytes: new Uint8Array(0), fileName: 'empty.png',
} as any);
+2 -2
View File
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from 'vitest';
import { BridgeEventBus } from '@snowluma/bridge/event-bus';
import type { FriendMessage, GroupMessage } from '@snowluma/bridge/events';
import { BridgeEventBus } from '@snowluma/protocol/event-bus';
import type { FriendMessage, GroupMessage } from '@snowluma/protocol/events';
function makeFriendMessage(): FriendMessage {
return {
@@ -1,8 +1,8 @@
import { describe, expect, it } from 'vitest';
import { Bridge } from '../src/bridge/bridge';
import { IdentityService } from '@snowluma/bridge/identity-service';
import type { GroupMemberInfo, QQGroupInfo } from '@snowluma/bridge/qq-info';
import type { GroupMemberJoin, QQEventVariant } from '@snowluma/bridge/events';
import { IdentityService } from '@snowluma/protocol/identity-service';
import type { GroupMemberInfo, QQGroupInfo } from '@snowluma/protocol/qq-info';
import type { GroupMemberJoin, QQEventVariant } from '@snowluma/protocol/events';
import type { PacketInfo } from '@snowluma/common/protocol-types';
const SELF_UIN = '10001';
@@ -4,14 +4,14 @@ import type { SendPacketResult } from '@snowluma/common/packet-sender';
import type { SendMessageRequest, SendMessageResponse } from '@snowluma/proto-defs/action';
import type { FileExtra } from '@snowluma/proto-defs/message';
vi.mock('@snowluma/bridge/element-builder', () => ({
vi.mock('@snowluma/protocol/element-builder', () => ({
buildSendElems: vi.fn(async () => [{ text: { str: 'stub media elem' } }]),
}));
describe('Bridge private media routing', () => {
it('includes resolved uid in the final c2c send request for media messages', async () => {
const { Bridge } = await import('../src/bridge/bridge');
const { IdentityService } = await import('@snowluma/bridge/identity-service');
const { IdentityService } = await import('@snowluma/protocol/identity-service');
class TestBridge extends Bridge {
capturedBody: Uint8Array | null = null;
@@ -60,7 +60,7 @@ describe('Bridge private media routing', () => {
// implementation wrote c2c routing + richText.notOnlineFile +
// c2cCmd=11 — the QQ-NT server rejected every c2c file send.
const { Bridge } = await import('../src/bridge/bridge');
const { IdentityService } = await import('@snowluma/bridge/identity-service');
const { IdentityService } = await import('@snowluma/protocol/identity-service');
class TestBridge extends Bridge {
capturedBody: Uint8Array | null = null;
+4 -4
View File
@@ -17,17 +17,17 @@
import { describe, expect, it, vi } from 'vitest';
import { inflateSync } from 'zlib';
vi.mock('@snowluma/bridge/highway/image-upload', () => ({
vi.mock('@snowluma/protocol/highway/image-upload', () => ({
uploadImageMsgInfo: vi.fn(async () => new Uint8Array([7, 8, 9])),
}));
vi.mock('@snowluma/bridge/highway/ptt-upload', () => ({
vi.mock('@snowluma/protocol/highway/ptt-upload', () => ({
uploadPttMsgInfo: vi.fn(async () => new Uint8Array([4, 5, 6])),
}));
vi.mock('@snowluma/bridge/highway/video-upload', () => ({
vi.mock('@snowluma/protocol/highway/video-upload', () => ({
uploadVideoMsgInfo: vi.fn(async () => new Uint8Array([1, 2, 3])),
}));
import { buildSendElems } from '@snowluma/bridge/element-builder';
import { buildSendElems } from '@snowluma/protocol/element-builder';
const fakeBridge = {} as any;
+2 -2
View File
@@ -12,8 +12,8 @@ import {
formatMessageSegments,
formatReply,
formatUser,
} from '@snowluma/bridge/format';
import type { QQEventVariant } from '@snowluma/bridge/events';
} from '@snowluma/protocol/format';
import type { QQEventVariant } from '@snowluma/protocol/events';
// ─── Test fakes (just the find* surface event-format uses) ───
+1 -1
View File
@@ -3,7 +3,7 @@ import os from 'os';
import path from 'path';
import { pathToFileURL } from 'url';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { loadBinarySource, resolveLocalFilePath } from '@snowluma/bridge/highway/utils';
import { loadBinarySource, resolveLocalFilePath } from '@snowluma/protocol/highway/utils';
describe('highway source paths', () => {
it('normalizes file URLs with an extra leading slash on POSIX', () => {
@@ -5,13 +5,13 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
vi.mock('@snowluma/bridge/highway/pipeline', () => ({
vi.mock('@snowluma/protocol/highway/pipeline', () => ({
runNtv2Upload: vi.fn(async () => ({ msgInfo: { msgInfoBody: [], extBizInfo: {} } })),
finalizeMediaMsgInfo: vi.fn(() => new Uint8Array([0xCA, 0xFE])),
hexToBytes: vi.fn((hex: string) => new Uint8Array(hex.length / 2)),
}));
vi.mock('@snowluma/bridge/highway/utils', () => ({
vi.mock('@snowluma/protocol/highway/utils', () => ({
loadBinarySource: vi.fn(async () => ({ bytes: new Uint8Array([1, 2, 3]), fileName: 'src.jpg' })),
computeHashes: vi.fn(() => ({
md5: new Uint8Array(16),
@@ -22,9 +22,9 @@ vi.mock('@snowluma/bridge/highway/utils', () => ({
detectImageFormat: vi.fn(() => ({ format: 1000, width: 800, height: 600 })),
}));
import * as pipeline from '@snowluma/bridge/highway/pipeline';
import { uploadImageMsgInfo } from '@snowluma/bridge/highway/image-upload';
import { GROUP_IMAGE_CMD_ID, PRIVATE_IMAGE_CMD_ID } from '@snowluma/bridge/highway';
import * as pipeline from '@snowluma/protocol/highway/pipeline';
import { uploadImageMsgInfo } from '@snowluma/protocol/highway/image-upload';
import { GROUP_IMAGE_CMD_ID, PRIVATE_IMAGE_CMD_ID } from '@snowluma/protocol/highway';
describe('image-upload', () => {
beforeEach(() => {
@@ -24,8 +24,8 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
vi.mock('@snowluma/bridge/highway', async () => {
const real = await vi.importActual<typeof import('@snowluma/bridge/highway')>('@snowluma/bridge/highway');
vi.mock('@snowluma/protocol/highway', async () => {
const real = await vi.importActual<typeof import('@snowluma/protocol/highway')>('@snowluma/protocol/highway');
return {
...real,
// Only the TCP/HTTP transport is mocked — we keep real
@@ -40,8 +40,8 @@ vi.mock('@snowluma/bridge/highway', async () => {
};
});
import * as highway from '@snowluma/bridge/highway';
import { runNtv2Upload, type MediaSubFileUpload } from '@snowluma/bridge/highway/pipeline';
import * as highway from '@snowluma/protocol/highway';
import { runNtv2Upload, type MediaSubFileUpload } from '@snowluma/protocol/highway/pipeline';
import type { OidbBase } from '@snowluma/proto-defs/oidb';
import type {
NTV2UploadRichMediaReq,
+3 -3
View File
@@ -8,7 +8,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
vi.mock('@snowluma/bridge/highway', () => ({
vi.mock('@snowluma/protocol/highway', () => ({
fetchHighwaySession: vi.fn(async () => ({ sessionId: 'fake-session' })),
uploadHighwayHttp: vi.fn(async () => undefined),
buildHighwayExtend: vi.fn(() => new Uint8Array([0xAA, 0xBB])),
@@ -16,14 +16,14 @@ vi.mock('@snowluma/bridge/highway', () => ({
GROUP_IMAGE_CMD_ID: 1004,
}));
import * as highway from '@snowluma/bridge/highway';
import * as highway from '@snowluma/protocol/highway';
import {
finalizeMediaMsgInfo,
hexToBytes,
makeClientRandomId,
runNtv2Upload,
type MediaSubFileUpload,
} from '@snowluma/bridge/highway/pipeline';
} from '@snowluma/protocol/highway/pipeline';
import type { OidbBase } from '@snowluma/proto-defs/oidb';
import type { EncodableMediaMsgInfo, NTV2UploadRichMediaReq, NTV2UploadRichMediaResp } from '@snowluma/proto-defs/highway';
@@ -7,14 +7,14 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
vi.mock('@snowluma/bridge/highway/pipeline', () => ({
vi.mock('@snowluma/protocol/highway/pipeline', () => ({
runNtv2Upload: vi.fn(async () => ({ msgInfo: { msgInfoBody: [], extBizInfo: {} } })),
finalizeMediaMsgInfo: vi.fn(() => new Uint8Array([0xAA, 0xBB])),
hexToBytes: vi.fn((hex: string) => new Uint8Array(hex.length / 2)),
}));
import * as pipeline from '@snowluma/bridge/highway/pipeline';
import { uploadPttMsgInfo, GROUP_PTT_CMD_ID, PRIVATE_PTT_CMD_ID } from '@snowluma/bridge/highway/ptt-upload';
import * as pipeline from '@snowluma/protocol/highway/pipeline';
import { uploadPttMsgInfo, GROUP_PTT_CMD_ID, PRIVATE_PTT_CMD_ID } from '@snowluma/protocol/highway/ptt-upload';
const FINGERPRINT = {
noByteFallback: true,
@@ -11,20 +11,20 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
vi.mock('@snowluma/bridge/highway/pipeline', () => ({
vi.mock('@snowluma/protocol/highway/pipeline', () => ({
runNtv2Upload: vi.fn(async () => ({ msgInfo: { msgInfoBody: [], extBizInfo: {} } })),
finalizeMediaMsgInfo: vi.fn(() => new Uint8Array([0x12, 0x34])),
hexToBytes: vi.fn((hex: string) => new Uint8Array(hex.length / 2)),
}));
import * as pipeline from '@snowluma/bridge/highway/pipeline';
import * as pipeline from '@snowluma/protocol/highway/pipeline';
import {
uploadVideoMsgInfo,
GROUP_VIDEO_CMD_ID,
GROUP_VIDEO_THUMB_CMD_ID,
PRIVATE_VIDEO_CMD_ID,
PRIVATE_VIDEO_THUMB_CMD_ID,
} from '@snowluma/bridge/highway/video-upload';
} from '@snowluma/protocol/highway/video-upload';
const FINGERPRINT = {
noByteFallback: true,
+2 -2
View File
@@ -1,8 +1,8 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
import fs from 'fs';
import path from 'path';
import { IdentityService } from '@snowluma/bridge/identity-service';
import type { GroupMemberInfo, QQGroupInfo, UserProfileInfo } from '@snowluma/bridge/qq-info';
import { IdentityService } from '@snowluma/protocol/identity-service';
import type { GroupMemberInfo, QQGroupInfo, UserProfileInfo } from '@snowluma/protocol/qq-info';
const SELF_UIN = '10001';
const GROUP_ID = 123456789;
+4 -4
View File
@@ -1,8 +1,8 @@
import { describe, expect, it } from 'vitest';
import { protobuf_encode } from '@snowluma/proton';
import { parseMsgPush, MSG_PUSH_CMD } from '@snowluma/bridge/msg-push';
import { IdentityService } from '@snowluma/bridge/identity-service';
import type { GroupMemberInfo, QQGroupInfo } from '@snowluma/bridge/qq-info';
import { parseMsgPush, MSG_PUSH_CMD } from '@snowluma/protocol/msg-push';
import { IdentityService } from '@snowluma/protocol/identity-service';
import type { GroupMemberInfo, QQGroupInfo } from '@snowluma/protocol/qq-info';
// Proton's call-site analyzer keys off the literal type identifier
// printed in `protobuf_encode<X>` — it walks imports by *original*
// name (not alias). If both `import { X } from 'proto/notify'` and
@@ -18,7 +18,7 @@ import type {
import type { PushMsg } from '@snowluma/proto-defs/message';
import type {
GroupMemberJoin, FriendAddEvent, QQEventVariant,
} from '@snowluma/bridge/events';
} from '@snowluma/protocol/events';
// Local alias for the event-side recall type — derived via Extract so
// we avoid an `import { FriendRecall as X }` that collides with the
@@ -13,7 +13,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { protobuf_encode } from '@snowluma/proton';
import { subscribeLogs, type LogEntry } from '@snowluma/common/logger';
vi.mock('@snowluma/bridge/highway', () => ({
vi.mock('@snowluma/protocol/highway', () => ({
fetchHighwaySession: vi.fn(async () => ({ sessionId: 'fake-session' })),
uploadHighwayHttp: vi.fn(async () => undefined),
buildHighwayExtend: vi.fn(() => new Uint8Array([0xAA, 0xBB])),
@@ -24,12 +24,12 @@ vi.mock('@snowluma/bridge/highway', () => ({
import {
runNtv2Upload,
type MediaSubFileUpload,
} from '@snowluma/bridge/highway/pipeline';
} from '@snowluma/protocol/highway/pipeline';
import type { OidbBase } from '@snowluma/proto-defs/oidb';
import type { NTV2UploadRichMediaResp } from '@snowluma/proto-defs/highway';
import { MsgPushRegistry } from '@snowluma/bridge/msg-push/registry';
import type { MsgPushContext } from '@snowluma/bridge/msg-push/context';
import { decodeEvent0x2DC } from '@snowluma/bridge/msg-push/decoders/event-0x2dc';
import { MsgPushRegistry } from '@snowluma/protocol/msg-push/registry';
import type { MsgPushContext } from '@snowluma/protocol/msg-push/context';
import { decodeEvent0x2DC } from '@snowluma/protocol/msg-push/decoders/event-0x2dc';
function encodeOidbResponse(body: unknown): Buffer {
return Buffer.from(protobuf_encode<OidbBase<NTV2UploadRichMediaResp>>({