export const AI_FUNC_PATTERN: RegExp; export const AI_VAR_PATTERN: RegExp; export const AI_DEPENDENCY_FILE_BYTES: number; export const AI_DEPENDENCY_TOTAL_BYTES: number; export const AiDslErrorCodes: Readonly<{ AI_DSL_FUNC_INVALID: 'AI_DSL_FUNC_INVALID'; AI_DSL_FUNC_DUPLICATE: 'AI_DSL_FUNC_DUPLICATE'; AI_DSL_DESC_MISSING: 'AI_DSL_DESC_MISSING'; AI_DSL_VAR_INVALID: 'AI_DSL_VAR_INVALID'; AI_DSL_DEP_MISSING: 'AI_DSL_DEP_MISSING'; AI_DSL_DEP_ESCAPED: 'AI_DSL_DEP_ESCAPED'; AI_DSL_DEP_EXT: 'AI_DSL_DEP_EXT'; AI_DSL_DEP_TOO_LARGE: 'AI_DSL_DEP_TOO_LARGE'; AI_DSL_OPTION_UNKNOWN: 'AI_DSL_OPTION_UNKNOWN'; }>; export type AiDslErrorCode = (typeof AiDslErrorCodes)[keyof typeof AiDslErrorCodes]; export interface AiFuncDisplay { pending: string; done: string; error: string; } export interface AiFuncDsl { func: string; desc: string; in: Record; out: Record; dep?: Record; /** 注册为助手工具后的 Widget 三态文案;缺省用通用文案。 */ display?: AiFuncDisplay; options?: { model?: string; maxOutputTokens?: number; timeoutMs?: number; /** 是否注册为助手工具,缺省 true。 */ assistantTool?: boolean; }; } export interface ParsedAiDependency { file: string; desc: string; bytes: number; content: string; } export interface ParsedAiFuncDsl { sourceFile: string; dsl: AiFuncDsl; dependencies: ParsedAiDependency[]; } export class AiDslValidationError extends Error { readonly code: AiDslErrorCode; readonly file: string; readonly field: string; constructor(code: AiDslErrorCode, file: string, field: string, message: string); } export class AiApiDslParser { constructor(allowedExtensions: readonly string[]); parseFile(absolutePath: string, aiApiRoot?: string): ParsedAiFuncDsl; }