/** * @file Chrome native messaging host entry point. Chrome launches this script * as a subprocess when the extension calls * `chrome.runtime.connectNative('dev.socket.trusted-publisher-host')`. The * protocol is length-prefixed binary over stdin/stdout: incoming: [4-byte LE * uint32 length][UTF-8 JSON message] outgoing: [4-byte LE uint32 * length][UTF-8 JSON response] The host handles one request type: { type: * 'get-api-token' } → { token: string } | { error: string } The host NEVER * logs to stdout (Chrome treats any stdout byte outside the length-prefixed * protocol as a message boundary error). All diagnostics go to stderr only. * Detection: Chrome passes the extension origin as `process.argv[2]` * (`chrome-extension:///`). The `NATIVE_MESSAGING_HOST` constant in * `src/constants/platform.ts` captures this check so other modules can skip * TTY-only paths when running in this context. */ import type { Readable, Writable } from 'node:stream'; export declare function handleOne(stdin?: Readable | undefined, stdout?: Writable | undefined): Promise; export declare function readExact(length: number, stream?: Readable | undefined): Promise; export declare function runHost(): Promise; export declare function writeMessage(obj: unknown, stream?: Writable | undefined): void;