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:
40
ts/interfaces/ipc.ts
Normal file
40
ts/interfaces/ipc.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Management request sent to the Rust binary via stdin.
|
||||
*/
|
||||
export interface IManagementRequest {
|
||||
id: string;
|
||||
method: string;
|
||||
params: Record<string, any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Management response received from the Rust binary via stdout.
|
||||
*/
|
||||
export interface IManagementResponse {
|
||||
id: string;
|
||||
success: boolean;
|
||||
result?: any;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Management event received from the Rust binary (unsolicited, no id field).
|
||||
*/
|
||||
export interface IManagementEvent {
|
||||
event: string;
|
||||
data: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Definition of a single command supported by a Rust binary.
|
||||
*/
|
||||
export interface ICommandDefinition<TParams = any, TResult = any> {
|
||||
params: TParams;
|
||||
result: TResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map of command names to their definitions.
|
||||
* Used to type-safe the bridge's sendCommand method.
|
||||
*/
|
||||
export type TCommandMap = Record<string, ICommandDefinition>;
|
||||
Reference in New Issue
Block a user