UNPKG

@code-yeongyu/senpi

Version:

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

76 lines • 2.42 kB
/** * Messages on one kernel client's MessagePort to the main-thread WebView service. The eval * kernel's worker side (`senpi-codemode/src/kernels/js/worker-webview-client.js`) is plain * JavaScript and mirrors these shapes; keep the two in sync. */ export declare const WEBVIEW_METHODS: readonly ["navigate", "evaluate", "screenshot", "click", "type", "press", "scroll", "scrollTo", "resize", "goBack", "goForward", "reload", "cdp"]; export type WebViewMethod = (typeof WEBVIEW_METHODS)[number]; export interface WebViewState { readonly url: string; readonly title: string; readonly loading: boolean; } export interface WebViewWireError { readonly name: string; readonly message: string; readonly code?: string; } export type ClientToService = { readonly kind: "create"; readonly id: number; readonly viewId: string; readonly options: Readonly<Record<string, unknown>>; readonly captureConsole: boolean; } | { readonly kind: "call"; readonly id: number; readonly viewId: string; readonly method: WebViewMethod; readonly args: readonly unknown[]; } | { readonly kind: "close"; readonly viewId: string; } | { readonly kind: "listen"; readonly viewId: string; readonly event: string; } | { readonly kind: "close-all"; readonly id: number; }; export type WebViewEvent = { readonly type: "console"; readonly args: readonly unknown[]; } | { readonly type: "navigated"; readonly url: string; readonly title: string; } | { readonly type: "navigation-failed"; readonly error: WebViewWireError; } | { readonly type: "dom"; readonly name: string; readonly data: unknown; }; export type ServiceToClient = { readonly kind: "reply"; readonly id: number; readonly ok: true; readonly value: unknown; readonly state?: WebViewState; } | { readonly kind: "reply"; readonly id: number; readonly ok: false; readonly error: WebViewWireError; readonly state?: WebViewState; } | { readonly kind: "event"; readonly viewId: string; readonly event: WebViewEvent; }; /** Parses one message from a kernel worker; anything else is dropped at this boundary. */ export declare function parseClientMessage(value: unknown): ClientToService | undefined; export declare function wireError(error: unknown): WebViewWireError; //# sourceMappingURL=webview-wire.d.ts.map