SnowLuma is a TypeScript + native-module hybrid. TypeScript handles runtime orchestration, the OneBot implementation, the protocol bridge, the SDK, and the WebUI; native modules cover the hook, injection, and the high-performance WebSocket implementation.
pnpm workspace with five packages:
Entry point: packages/core/src/index.ts.
What the runtime creates:
HookManager — discovers QQ main processes and injects the native addon. With hookAutoLoad: true, every new PID gets injected automatically.BridgeManager — decodes hook messages from the named pipe into bridge events; caches rkey / contacts / group members.OneBotManager — owns OneBotInstances keyed by UIN; each instance has its own MessageStore, MediaStore, and NetworkManager.initWebUI — full builds boot the WebUI; default port 5099 (override via runtime.json.webuiPort).The native hook module is loaded via process.dlopen(). Source lives in the separate dev/nnphook repo.
Filename convention:
Load search paths:
Native addon API:
getAllMainProcess — enumerate QQ main processes.loadModuleManual — manually map the injection module into the target process.unloadModuleManual — unload an injected module.Default target process is QQ.exe on Windows, qq on Linux.
When the bridge detects a QQ session starting:
config/onebot_<uin>.json (or copy from global if missing).OneBotInstance.networks.* config.When the session closes the matching instance is released.
@snowluma/websocket is the in-repo WebSocket implementation; its surface tracks ws closely while routing through a native fast path.
Exports:
WebSocket — client constructor.WebSocketServer — server constructor.Server — alias for WebSocketServer.InternalWebSocket — internal connection implementation.Loads its own platform-specific .node from the same native/ search paths.
@snowluma/sdk is a typed OneBot client for downstream consumers — standalone-publishable to npm and independent of the SnowLuma runtime. It's built inside the monorepo (see pnpm build:sdk / build:all below); for consumer-side usage see the SDK docs.
Full distribution:
Runs, in order:
@snowluma/core full build@snowluma/sdkwebuiOutput goes to the repo root dist/.
The docs site lives in a separate repo: SnowLuma/SnowLumaDocs. Local development usually checks it out at dev/SnowLumaDocs/ alongside SnowLuma.
Stack: Rspress + React + TypeScript + MDX + KaTeX.
The OneBot API reference is generated by the docs repo's pnpm api:generate (also wired to prebuild) from docs/public/api/catalog.json — one page per action, plus a category overview and a searchable landing page. catalog.json is the action catalog produced by the main repo's collectActionDocs() (same shape as @snowluma/mcp's CatalogAction); the main repo's sync-docs-catalog workflow commits it here automatically via the SnowLuma bot on release — no manual upkeep.
BridgeManager — every OneBot action should reach NTQQ through BridgeInterface. Keeps the OneBot layer decoupled and testable..node and the injectable library.vitest; see packages/core/tests/.defineAction (optionally returnsSchema to describe data); catalog.json is kept in sync by the sync-docs-catalog workflow, so the API reference never drifts. Run pnpm api:generate locally to preview.