/** * LLM 请求/响应日志格式化的共享基础能力。 * * 关键点(中文) * - 这里只放与 provider 无关的 JSON/文本抽取能力。 * - 请求侧和响应侧各自的业务规则放到独立模块,避免继续堆成单文件巨石。 */ import type { JsonObject, JsonValue } from "../../types/common/Json.js"; /** * 允许被识别为日志 payload 的解析结果。 */ export type ParsedPayload = JsonObject | JsonValue[]; export declare function is_json_object(value: JsonValue | null | undefined): value is JsonObject; export declare function get_string_field(objectValue: JsonObject, field: string): string | undefined; export declare function get_object_field(objectValue: JsonObject, field: string): JsonObject | undefined; export declare function get_array_field(objectValue: JsonObject, field: string): JsonValue[] | undefined; export declare function safe_json_parse(input: string | undefined): ParsedPayload | null; export declare function truncate(text: string, maxChars: number): string; export declare function stringify_compact(value: JsonValue | object | undefined, maxChars: number): string; export declare function to_inline_log_value(value: string, maxChars: number): string; export declare function format_log_field(key: string, value: string): string; export declare function push_labeled_text_block(out: string[], label: "system" | "user" | "assistant" | "tool" | "tool_result", text: string, maxChars: number, attrs?: string[]): void; export declare function parse_info_block_text(value: string): { info: Record; body: string; } | null; export declare function build_info_attrs(info: Record): string[]; export declare function content_to_text(content: JsonValue | undefined, maxChars: number): string; export declare function parse_possible_json_object(value: JsonValue | undefined): JsonObject | undefined; export declare function extract_function_call_exec_command_cmd(message: JsonObject): string | undefined; export declare function extract_messages(payload: JsonObject): JsonObject[] | null; export declare function extract_system_for_log(payload: JsonObject | undefined): JsonValue | undefined; //# sourceMappingURL=FormatShared.d.ts.map