Refactor Bridge APIs, slim Bridge and reorder imports

Move and standardize API implementations under bridge/apis, slim down the Bridge class (remove inline action implementations, caches and large comment blocks) and relocate related types/exports. Clean up and reorder imports across many bridge/api modules, normalize constructors, add logger imports where needed, and adjust WebUI routing/import ordering. These changes centralize API logic, reduce Bridge surface area, and tidy module boundaries and imports.
This commit is contained in:
手瓜一十雪 committed 2026-05-24 13:13:23 +08:00
1 parent a52a9724cb
commit a49e507e15
22 files changed
+144 -452

No files matched your search

+1 -20
View File
@@ -1,27 +1,8 @@
// Api-layer extension of @snowluma/protocol's slim BridgeContext.
//
// 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
// in @snowluma/core, so the bridge package never sees it (avoiding
// a bridge → core cycle).
//
// 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/protocol) import
// the slim version directly from `@snowluma/protocol/bridge-context`.
import type { BridgeContext as BaseBridgeContext } from '@snowluma/protocol/bridge-context';
import type { ApiHub } from './apis';
export interface BridgeContext extends BaseBridgeContext {
readonly apis: ApiHub;
}
// Re-export `UploadedFileMeta` from the slim package so existing
// `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/protocol/bridge-context';