Files
SnowLuma/packages/bridge/package.json
T
DrSmoothl 80afa31f5c refactor(oidb): migrate extras.ts OIDB cmds to namespaces
5 logical OIDB cmds → 4 namespace files (group todo's 3 sub-cmds
collapse into one namespace with a dynamic resolver):

  - GroupTodo          (0xF90_1/2/3) — set/complete/cancel via the
                                       new `action` discriminator
  - GetStrangerStatus  (0xFE1_2)     — uinForm=true; preserves the
                                       (status*10, ext_status) decode
                                       quirk verbatim
  - FetchAiVoiceList   (0x929D_0)
  - FetchAiVoice       (0x929B_0)    — single poll; retry loop
                                       stays on the facade so callers
                                       can plug their own back-off

Facade keeps the 6 public methods (setGroupTodo / completeGroupTodo /
cancelGroupTodo / getStrangerStatus / fetchAiVoiceList / fetchAiVoice)
as one-line forwarders; only `getStrangerStatus` wraps in try/catch
to preserve its "return null on transport failure" contract, and
`fetchAiVoice` keeps the polling loop.

30 new namespace-level tests; extras.test.ts moved onto the
sendRawPacket assertion model.

Verification:
  - typecheck green
  - @snowluma/bridge: 24 files / 195 tests
  - @snowluma/core: 302 tests
Wire bytes unchanged.
2026-05-22 23:45:13 +08:00

229 lines
8.8 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"
},
"./oidb-services/friend/handle-friend-request": {
"types": "./src/oidb-services/friend/handle-friend-request.ts",
"default": "./src/oidb-services/friend/handle-friend-request.ts"
},
"./oidb-services/friend/delete-friend": {
"types": "./src/oidb-services/friend/delete-friend.ts",
"default": "./src/oidb-services/friend/delete-friend.ts"
},
"./oidb-services/friend/set-friend-remark": {
"types": "./src/oidb-services/friend/set-friend-remark.ts",
"default": "./src/oidb-services/friend/set-friend-remark.ts"
},
"./oidb-services/misc/translate-en-to-zh": {
"types": "./src/oidb-services/misc/translate-en-to-zh.ts",
"default": "./src/oidb-services/misc/translate-en-to-zh.ts"
},
"./oidb-services/misc/click-inline-keyboard-button": {
"types": "./src/oidb-services/misc/click-inline-keyboard-button.ts",
"default": "./src/oidb-services/misc/click-inline-keyboard-button.ts"
},
"./oidb-services/misc/send-group-sign": {
"types": "./src/oidb-services/misc/send-group-sign.ts",
"default": "./src/oidb-services/misc/send-group-sign.ts"
},
"./oidb-services/web/force-fetch-client-key": {
"types": "./src/oidb-services/web/force-fetch-client-key.ts",
"default": "./src/oidb-services/web/force-fetch-client-key.ts"
},
"./oidb-services/web/get-pskey": {
"types": "./src/oidb-services/web/get-pskey.ts",
"default": "./src/oidb-services/web/get-pskey.ts"
},
"./oidb-services/extras/group-todo": {
"types": "./src/oidb-services/extras/group-todo.ts",
"default": "./src/oidb-services/extras/group-todo.ts"
},
"./oidb-services/extras/get-stranger-status": {
"types": "./src/oidb-services/extras/get-stranger-status.ts",
"default": "./src/oidb-services/extras/get-stranger-status.ts"
},
"./oidb-services/extras/fetch-ai-voice-list": {
"types": "./src/oidb-services/extras/fetch-ai-voice-list.ts",
"default": "./src/oidb-services/extras/fetch-ai-voice-list.ts"
},
"./oidb-services/extras/fetch-ai-voice": {
"types": "./src/oidb-services/extras/fetch-ai-voice.ts",
"default": "./src/oidb-services/extras/fetch-ai-voice.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"
}
}