5 of profile.ts's methods were thin OIDB wrappers — migrated to the
new namespace pattern. The 5 non-OIDB methods (setOnlineStatus /
setDiyOnlineStatus / setAvatar / setGroupAvatar / fetchCustomFace)
stay on the facade unchanged — they hit `trpc.qq_new_tech.*`,
Highway, or `Faceroam.OpReq` directly and aren't in scope for the
OIDB-namespace refactor.
New namespaces (each with focused Pick<BridgeContext, …> deps):
- SetProfile (0x112A_2) — needs identity for uin
- SetSelfLongNick (0x112A_2) — same cmd different proto, ditto
- SetInputStatus (0xCD4_1) — needs resolveUserUid
- GetLike (0x7ED_12) — needs identity + resolveUserUid
- GetUnidirectionalFriendList (0xE17_0) — needs identity; non-standard
wire name handled via the new
wireName override on OidbCallSpec
Infrastructure tweak:
- OidbCallSpec gains an optional `wireName(cmd, sub) → string`. Most
cmds use the default `OidbSvcTrpcTcp.0xNNNN_N` scheme; 0xe17_0
routes through `MQUpdateSvc_com_qq_ti.web.OidbSvc.0xe17_0`.
Test mock updates:
- profile.test.ts moves the migrated cmds onto bridge.sendRawPacket
mock (the new path bypasses the bridge-oidb runOidb mock). Non-OIDB
cmds (setOnlineStatus, setAvatar, etc.) keep their existing mocks.
- 36 new namespace-level tests in @snowluma/bridge covering serialize
branches, deserialize edge cases, deps resolution, and e2e wire
routing.
Verification:
- pnpm -r typecheck: green
- @snowluma/bridge: 12 files / 118 tests
- @snowluma/core: 33 files / 302 tests
Wire shape unchanged across migrated cmds — same bytes produced.
181 lines
6.6 KiB
JSON
181 lines
6.6 KiB
JSON
{
|
|
"name": "@snowluma/bridge",
|
|
"version": "1.9.1",
|
|
"private": true,
|
|
"type": "module",
|
|
"description": "SnowLuma bridge — the protocol-layer between QQ wire bytes and typed events. Owns: identity service (uid↔uin cache with SQLite persistence), event bus, packet pipeline (incoming SSO packet → QQEventVariant), msg-push decoders, element-builder (MessageElement → wire elems[]), highway upload protocol (file/image/video/ptt), OIDB envelope helper, and the event/notice/request type vocabulary. Consumers (@snowluma/core, @snowluma/onebot) talk to this package through `BridgeContext` for runtime calls and the standalone classes (IdentityService, BridgeEventBus, IncomingPacketPipeline) for composition. Per-file subpath exports mirror the legacy `core/src/bridge/*` layout 1:1 so the previous `import { …} from '../bridge/<x>'` collapses to `import { … } from '@snowluma/bridge/<x>'`.",
|
|
"main": "./src/index.ts",
|
|
"types": "./src/index.ts",
|
|
"exports": {
|
|
".": {
|
|
"types": "./src/index.ts",
|
|
"default": "./src/index.ts"
|
|
},
|
|
"./events": {
|
|
"types": "./src/events.ts",
|
|
"default": "./src/events.ts"
|
|
},
|
|
"./event-bus": {
|
|
"types": "./src/event-bus.ts",
|
|
"default": "./src/event-bus.ts"
|
|
},
|
|
"./identity-service": {
|
|
"types": "./src/identity-service.ts",
|
|
"default": "./src/identity-service.ts"
|
|
},
|
|
"./packet-pipeline": {
|
|
"types": "./src/packet-pipeline.ts",
|
|
"default": "./src/packet-pipeline.ts"
|
|
},
|
|
"./element-builder": {
|
|
"types": "./src/element-builder.ts",
|
|
"default": "./src/element-builder.ts"
|
|
},
|
|
"./bridge-oidb": {
|
|
"types": "./src/bridge-oidb.ts",
|
|
"default": "./src/bridge-oidb.ts"
|
|
},
|
|
"./oidb-service": {
|
|
"types": "./src/oidb-service.ts",
|
|
"default": "./src/oidb-service.ts"
|
|
},
|
|
"./oidb-services/reaction/set-reaction": {
|
|
"types": "./src/oidb-services/reaction/set-reaction.ts",
|
|
"default": "./src/oidb-services/reaction/set-reaction.ts"
|
|
},
|
|
"./oidb-services/reaction/fetch-reaction-summary": {
|
|
"types": "./src/oidb-services/reaction/fetch-reaction-summary.ts",
|
|
"default": "./src/oidb-services/reaction/fetch-reaction-summary.ts"
|
|
},
|
|
"./oidb-services/reaction/get-emoji-likes": {
|
|
"types": "./src/oidb-services/reaction/get-emoji-likes.ts",
|
|
"default": "./src/oidb-services/reaction/get-emoji-likes.ts"
|
|
},
|
|
"./oidb-services/interaction/send-poke": {
|
|
"types": "./src/oidb-services/interaction/send-poke.ts",
|
|
"default": "./src/oidb-services/interaction/send-poke.ts"
|
|
},
|
|
"./oidb-services/interaction/send-like": {
|
|
"types": "./src/oidb-services/interaction/send-like.ts",
|
|
"default": "./src/oidb-services/interaction/send-like.ts"
|
|
},
|
|
"./oidb-services/interaction/set-essence": {
|
|
"types": "./src/oidb-services/interaction/set-essence.ts",
|
|
"default": "./src/oidb-services/interaction/set-essence.ts"
|
|
},
|
|
"./oidb-services/profile/set-profile": {
|
|
"types": "./src/oidb-services/profile/set-profile.ts",
|
|
"default": "./src/oidb-services/profile/set-profile.ts"
|
|
},
|
|
"./oidb-services/profile/set-self-long-nick": {
|
|
"types": "./src/oidb-services/profile/set-self-long-nick.ts",
|
|
"default": "./src/oidb-services/profile/set-self-long-nick.ts"
|
|
},
|
|
"./oidb-services/profile/set-input-status": {
|
|
"types": "./src/oidb-services/profile/set-input-status.ts",
|
|
"default": "./src/oidb-services/profile/set-input-status.ts"
|
|
},
|
|
"./oidb-services/profile/get-like": {
|
|
"types": "./src/oidb-services/profile/get-like.ts",
|
|
"default": "./src/oidb-services/profile/get-like.ts"
|
|
},
|
|
"./oidb-services/profile/get-unidirectional-friend-list": {
|
|
"types": "./src/oidb-services/profile/get-unidirectional-friend-list.ts",
|
|
"default": "./src/oidb-services/profile/get-unidirectional-friend-list.ts"
|
|
},
|
|
"./bridge-context": {
|
|
"types": "./src/bridge-context.ts",
|
|
"default": "./src/bridge-context.ts"
|
|
},
|
|
"./qq-info": {
|
|
"types": "./src/qq-info.ts",
|
|
"default": "./src/qq-info.ts"
|
|
},
|
|
"./format": {
|
|
"types": "./src/format.ts",
|
|
"default": "./src/format.ts"
|
|
},
|
|
"./msg-push": {
|
|
"types": "./src/msg-push/index.ts",
|
|
"default": "./src/msg-push/index.ts"
|
|
},
|
|
"./msg-push/registry": {
|
|
"types": "./src/msg-push/registry.ts",
|
|
"default": "./src/msg-push/registry.ts"
|
|
},
|
|
"./msg-push/context": {
|
|
"types": "./src/msg-push/context.ts",
|
|
"default": "./src/msg-push/context.ts"
|
|
},
|
|
"./msg-push/decoders/event-0x2dc": {
|
|
"types": "./src/msg-push/decoders/event-0x2dc.ts",
|
|
"default": "./src/msg-push/decoders/event-0x2dc.ts"
|
|
},
|
|
"./highway": {
|
|
"types": "./src/highway/highway-client.ts",
|
|
"default": "./src/highway/highway-client.ts"
|
|
},
|
|
"./highway/utils": {
|
|
"types": "./src/highway/utils.ts",
|
|
"default": "./src/highway/utils.ts"
|
|
},
|
|
"./highway/pipeline": {
|
|
"types": "./src/highway/pipeline.ts",
|
|
"default": "./src/highway/pipeline.ts"
|
|
},
|
|
"./highway/image-upload": {
|
|
"types": "./src/highway/image-upload.ts",
|
|
"default": "./src/highway/image-upload.ts"
|
|
},
|
|
"./highway/ptt-upload": {
|
|
"types": "./src/highway/ptt-upload.ts",
|
|
"default": "./src/highway/ptt-upload.ts"
|
|
},
|
|
"./highway/video-upload": {
|
|
"types": "./src/highway/video-upload.ts",
|
|
"default": "./src/highway/video-upload.ts"
|
|
},
|
|
"./highway/ffmpeg-addon": {
|
|
"types": "./src/highway/ffmpeg-addon.ts",
|
|
"default": "./src/highway/ffmpeg-addon.ts"
|
|
},
|
|
"./web/group-album": {
|
|
"types": "./src/web/group-album.ts",
|
|
"default": "./src/web/group-album.ts"
|
|
},
|
|
"./web/group-essence": {
|
|
"types": "./src/web/group-essence.ts",
|
|
"default": "./src/web/group-essence.ts"
|
|
},
|
|
"./web/group-honor": {
|
|
"types": "./src/web/group-honor.ts",
|
|
"default": "./src/web/group-honor.ts"
|
|
},
|
|
"./web/group-notice": {
|
|
"types": "./src/web/group-notice.ts",
|
|
"default": "./src/web/group-notice.ts"
|
|
},
|
|
"./web/request-util": {
|
|
"types": "./src/web/request-util.ts",
|
|
"default": "./src/web/request-util.ts"
|
|
}
|
|
},
|
|
"scripts": {
|
|
"test": "vitest run",
|
|
"bench": "vitest bench --run",
|
|
"typecheck": "tsc --noEmit"
|
|
},
|
|
"dependencies": {
|
|
"@snowluma/common": "workspace:*",
|
|
"@snowluma/proto-defs": "workspace:*",
|
|
"@snowluma/proton": "workspace:*",
|
|
"@snowluma/sqlite": "workspace:*"
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "^24.12.2",
|
|
"typescript": "catalog:",
|
|
"vite": "catalog:",
|
|
"vitest": "^4.1.4"
|
|
}
|
|
}
|