Introduce a transport-adapter layer and refactor the bridge abstractions to be transport-agnostic. Added BridgeAdapter and BridgeAdapterHost (packages/core/src/bridge/adapter.ts) plus concrete InjectBridge/InjectBridgeAdapter and ProtocolBridge/ProtocolBridgeAdapter implementations (new files). Made Bridge an abstract base exposing kind/id and abstract sendRawPacket, moved transport-specific PID/sender logic into InjectBridge. Reworked BridgeManager to register/start adapters, manage bridges by id/uin, pick a primary per-UIN (inject preferred over protocol), and provide a host API for adapters to add/remove bridges. Updated index bootstrapping to register adapters and wire the WebUI to the inject adapter's HookManager. Adjusted tests and OneBot code to remove PID tracking from OneBotInstance/OneBotManager and to instantiate InjectBridge in tests. Also exported new entry points in package.json for adapter/bridge modules. This decouples transports from manager logic and adds a stubbed protocol runtime for future pure-protocol support.
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import protobufVitePlugin from '@snowluma/proton/vite';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
export default defineConfig({
|
|
plugins: [protobufVitePlugin({ root: path.resolve(__dirname, '../..') })],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src')
|
|
}
|
|
},
|
|
test: {
|
|
include: ['tests/**/*.test.ts'],
|
|
environment: 'node',
|
|
// Suppress the logger's file transport during tests so the suite
|
|
// doesn't litter cwd with logs/snowluma-*.log files. Tests that
|
|
// explicitly cover file output set their own SNOWLUMA_LOG_FILE='1'
|
|
// + SNOWLUMA_LOG_DIR=<tmp>.
|
|
//
|
|
// Run at debug level so tests asserting on debug-level log entries
|
|
// (e.g. action dispatch entry lines) actually see them via the
|
|
// ring buffer / subscribers, which sit behind the console-level gate.
|
|
env: {
|
|
SNOWLUMA_LOG_FILE: '0',
|
|
SNOWLUMA_LOG_LEVEL: 'debug'
|
|
}
|
|
}
|
|
});
|