feat(rustbridge): add RustBridge and RustBinaryLocator with typed IPC interfaces, plugins, tests and mock runner; export from index; add npm registries
This commit is contained in:
42
ts/interfaces/config.ts
Normal file
42
ts/interfaces/config.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Minimal logger interface for the bridge.
|
||||
*/
|
||||
export interface IRustBridgeLogger {
|
||||
log(level: string, message: string, data?: Record<string, any>): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for locating a Rust binary.
|
||||
*/
|
||||
export interface IBinaryLocatorOptions {
|
||||
/** Name of the binary (e.g., 'rustproxy') */
|
||||
binaryName: string;
|
||||
/** Environment variable to check for explicit binary path (e.g., 'SMARTPROXY_RUST_BINARY') */
|
||||
envVarName?: string;
|
||||
/** Prefix for platform-specific npm packages (e.g., '@push.rocks/smartproxy') */
|
||||
platformPackagePrefix?: string;
|
||||
/** Additional local paths to search (defaults to ./rust/target/release/<binaryName> and ./rust/target/debug/<binaryName>) */
|
||||
localPaths?: string[];
|
||||
/** Whether to search the system PATH (default: true) */
|
||||
searchSystemPath?: boolean;
|
||||
/** Explicit binary path override - skips all other search */
|
||||
binaryPath?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for the RustBridge.
|
||||
*/
|
||||
export interface IRustBridgeOptions extends IBinaryLocatorOptions {
|
||||
/** CLI arguments passed to the binary (default: ['--management']) */
|
||||
cliArgs?: string[];
|
||||
/** Timeout for individual requests in ms (default: 30000) */
|
||||
requestTimeoutMs?: number;
|
||||
/** Timeout for the ready event during spawn in ms (default: 10000) */
|
||||
readyTimeoutMs?: number;
|
||||
/** Additional environment variables for the child process */
|
||||
env?: Record<string, string>;
|
||||
/** Name of the ready event emitted by the Rust binary (default: 'ready') */
|
||||
readyEventName?: string;
|
||||
/** Optional logger instance */
|
||||
logger?: IRustBridgeLogger;
|
||||
}
|
||||
Reference in New Issue
Block a user