@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
21 lines • 1.08 kB
TypeScript
import { type ToolChildMessage } from "./protocol.ts";
export type ToolChildCodecErrorCode = "tool_child_frame_too_large" | "tool_child_truncated" | "tool_child_malformed" | "tool_child_encode_invalid";
export declare class ToolChildCodecError extends Error {
readonly code: ToolChildCodecErrorCode;
constructor(code: ToolChildCodecErrorCode, message: string);
}
/** A frame is a 4-byte big-endian body length followed by that many bytes of UTF-8 JSON. No delimiter, no NDJSON. */
export declare const FRAME_HEADER_BYTES = 4;
export declare function encodeFrame(message: ToolChildMessage): Uint8Array;
/**
* Incremental decoder for one channel direction. A length header above the cap is refused as soon as its four bytes
* arrive, before any body buffer exists. Any codec error is terminal: the stream is never resynchronized, so nothing
* after a bad frame can be silently skipped.
*/
export declare class FrameDecoder {
#private;
get bufferedBytes(): number;
push(chunk: Uint8Array): ToolChildMessage[];
end(): void;
}
//# sourceMappingURL=codec.d.ts.map