/** * Default afterResponse hook: writes one row to hazo_llm_api_log per LLM call. * * Failures are swallowed (logged as warn) — the hook MUST NOT throw, so it never * disrupts the calling service function. */ import type { HazoConnect } from "../hazo_connect/types.js"; import type { Logger, AfterResponseHook } from "../llm_api/types.js"; export interface DefaultLogWriterOpts { /** HazoConnect instance providing raw_sql access to hazo_llm_api_log. */ connect: HazoConnect; /** Logger for warning on write failures. */ logger: Logger; /** * Optional callback returning consumer-defined key/value pairs stored in * context_json. Runs once per call, failures are swallowed. */ extract_context?: (ctx: { service_type: string; provider: string; request_params: Record; }) => Record | Promise>; } /** * Build an afterResponse hook that writes one row to hazo_llm_api_log per call. * * The returned hook: * - Never throws (all errors are caught and logged as warn) * - Computes cost via the bundled pricing table * - Captures prompt_area/prompt_key from request params when present * - Reads session_id/reference from hazo_logs AsyncLocalStorage when available * - Merges consumer-supplied context via extract_context option */ export declare function create_default_after_response_hook(opts: DefaultLogWriterOpts): AfterResponseHook; //# sourceMappingURL=log_writer.d.ts.map