export declare class HookInput { readonly session_id: string; readonly cwd: string; readonly hook_event_name: string; readonly tool_name: string; readonly tool_input: { readonly file_path: string; readonly offset?: number; readonly limit?: number; }; readonly tool_result?: string; constructor(opts: { session_id: string; cwd: string; hook_event_name: string; tool_name: string; tool_input: { file_path: string; offset?: number; limit?: number; }; tool_result?: string; }); } export declare class HookOutput { readonly exitCode: number; readonly stderr: string; constructor(exitCode: number, stderr: string); } /** * Reads stdin with a size guard. Throws if input exceeds MAX_STDIN_BYTES. * Accumulates raw buffers to avoid corrupting multi-byte UTF-8 characters * that may be split across chunk boundaries. */ export declare function readStdin(): Promise; /** * Parses and validates hook input from a raw JSON string. * Returns a frozen HookInput instance. */ export declare function parseHookInput(raw: string): HookInput; /** * Returns a cwd-relative path, or null if the path is outside the cwd. * Prevents path traversal attacks and handles the path.relative() edge case * where paths outside cwd produce absolute or '../' prefixed results. */ export declare function safeRelativePath(cwd: string, filePath: string): string | null; /** * Wraps a hook's main function with stdin reading, input parsing, * and error handling. Logs full stack traces on failure. */ export declare function runHook(handler: (input: HookInput) => HookOutput | Promise, failExitCode: number): void; //# sourceMappingURL=shared.d.ts.map