import { Locale, HaiResult } from '@h-ai/core'; import { OutputFormat } from './browser.js'; /** * 本地解析任务仅携带文件内容、格式和调用语言。 * @example 模块内部上下文 * ```ts * const job: FileParseJob = { type: 'html', content: '

Report

', format: 'text', locale: 'en-US' } * ``` */ type FileParseJob = { format: OutputFormat; locale: Locale; limits?: { maxTextLength: number; maxZipEntries: number; maxExpandedBytes: number; }; } & ({ type: 'text'; content: string | Uint8Array; } | { type: 'html'; content: string | Uint8Array; } | { type: 'pdf'; content: Uint8Array; maxPages?: number; } | { type: 'docx'; content: Uint8Array; }); /** * 本地解析成功后附带正文和 PDF 页数。 * @example 模块内部上下文 * ```ts * const reply: FileParseReply = ok({ text: 'Report', pageCount: 1 }) * ``` */ type FileParseReply = HaiResult<{ text: string; pageCount?: number; truncated?: boolean; }>; export type { FileParseJob, FileParseReply };