UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

30 lines • 1.71 kB
import { type MessagePort } from "node:worker_threads"; export interface WebViewServiceConnection { readonly clientId: string; /** Transfer this into the kernel worker; it is the only handle to the client's views. */ readonly port: MessagePort; /** Closes every view created through `port`; afterwards the port is dead. */ release(): Promise<void>; } export interface WebViewBroker { /** Hand this to exactly one worker thread (workerData + transferList). */ readonly port: MessagePort; dispose(): Promise<void>; } /** * Main-thread side of one worker thread's route to the WebView service (RPC session workers run the * eval kernel host off the main thread). Clients connected through a broker belong to it: it can * release only those, and they are all released when the worker exits or the broker is disposed. */ export declare function createWebViewBroker(): WebViewBroker | undefined; /** Worker-thread side: install the broker port the main thread passed in `workerData`. */ export declare function registerWebViewBroker(port: unknown): void; /** * Connects an eval kernel to the main-thread WebView service: directly on the main thread, through * the thread's broker in a worker. Rejects when neither route exists (e.g. not running on Bun). * With a `scope`, the client belongs to that execution scope and `releaseWebViewScope` ends it. */ export declare function connectWebViewService(scope?: string): Promise<WebViewServiceConnection>; /** Closes every view of one execution scope's clients on this thread's route; other scopes keep theirs. */ export declare function releaseWebViewScope(scope: string): Promise<void>; //# sourceMappingURL=webview-broker.d.ts.map