refactor(packages): extract @snowluma/bridge (hook + QQ lifecycle)

Split the QQ NT client lifecycle / hook injection layer out of
@snowluma/core into its own self-contained package. The new bridge
package owns:
  - native hook addon loader (injector)
  - HookManager + per-PID HookSession orchestration
  - PipeWatcher for QQ process discovery
  - QqHookClient pipe protocol
  - qq-port-probe for early UIN sniffing

The hook layer used to type its main collaborator as
`BridgeManager` directly. To keep the new package free of any
dependency on @snowluma/core, the cross-package coupling is now
expressed via a 3-method `BridgeManagerSink` interface that lives
in the bridge package. BridgeManager (in core) satisfies the
interface structurally with no source changes; the top-level
app/webui still inject it the same way.

Pure file relocation otherwise: git mv preserves history at 100%
on every file, the only logic edit is the interface introduction
in hook-manager.ts and an updated `nativeSearchDirs()` offset
(one fewer `..` since hook now lives at packages/bridge/src
instead of packages/core/src/hook).
This commit is contained in:
DrSmoothl committed 2026-05-23 23:40:57 +08:00
1 parent c16064d7e3
commit f53df5e313
22 files changed
+161 -30

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ import { randomBytes } from 'crypto';
import type { OneBotManager } from '@snowluma/onebot/manager';
import { loadOneBotConfig, saveOneBotConfig } from '@snowluma/onebot/config';
import type { OneBotConfig } from '@snowluma/onebot/types';
import type { HookManager, HookProcessInfo } from '../hook/hook-manager';
import type { HookManager, HookProcessInfo } from '@snowluma/bridge';
import path from 'path';
import { existsSync, readFileSync } from 'fs';
import { fileURLToPath } from 'url';