Files
SnowLuma/packages/protocol/package.json
T
DrSmoothl 3db89d0bd0 refactor(protocol,core): converge self-uid resolution to one impl
「取自己 uid」原本散成 5 份、3 种错误文案:core/apis/shared.ts::resolveSelfUid、
group-file/message 各内联手抄一份、get-like 跨包再抄一份。收敛成 protocol 单一
resolveSelfUid(ctx: Pick<BridgeContext,'identity'|'resolveUserUid'>)。

阶段 1(行为不变):
- 新增 protocol/self-uid.ts(依赖方向 core→protocol 要求权威实现下沉 protocol;
  Bridge 与 OIDB service Deps 都满足 Pick 切片)。
- core/apis/shared.ts 改为 re-export 它(现有 resolveSelfUid(bridge) 调用点不变)。
- get-like/group-file/message 三处内联手抄 → 全调权威实现。
- 唯一副作用:message 的错误文案统一为 'self uid is unavailable'(无测试依赖旧文案)。

flash-transfer/forward 的 ?? '' 空串 bug 留待阶段 2;group-admin 合成本地事件保持不动。
全仓 12 包 typecheck Done、protocol/core(471)/onebot(516) 全绿;对抗性 Agent 确认
toInt/Number 边界无实际差异(identity.uin 恒为正整数串)、5 处等价。
2026-07-01 19:12:05 +08:00

105 lines
3.4 KiB
JSON

{
"license": "SEE LICENSE IN LICENSE",
"name": "@snowluma/protocol",
"version": "1.11.0",
"private": true,
"type": "module",
"description": "SnowLuma protocol — 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/protocol/<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"
},
"./element-manifest": {
"types": "./src/element-manifest.ts",
"default": "./src/element-manifest.ts"
},
"./self-uid": {
"types": "./src/self-uid.ts",
"default": "./src/self-uid.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/*": {
"types": "./src/oidb-services/*.ts",
"default": "./src/oidb-services/*.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/*": {
"types": "./src/msg-push/*.ts",
"default": "./src/msg-push/*.ts"
},
"./highway": {
"types": "./src/highway/highway-client.ts",
"default": "./src/highway/highway-client.ts"
},
"./highway/*": {
"types": "./src/highway/*.ts",
"default": "./src/highway/*.ts"
},
"./web/*": {
"types": "./src/web/*.ts",
"default": "./src/web/*.ts"
}
},
"scripts": {
"test": "vitest run",
"bench": "vitest bench --run",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@snowluma/common": "workspace:*",
"@snowluma/proto-defs": "workspace:*",
"@snowluma/proton": "workspace:*"
},
"devDependencies": {
"@types/node": "^24.12.2",
"typescript": "catalog:",
"vite": "catalog:",
"vitest": "^4.1.4"
}
}