export declare const TIKTOK_SEARCH_PLAN_VERSION = "tiktok-search-plan-v1"; export declare const TIKTOK_PRODUCT_IDENTITY_VERSION = "tiktok-product-identity-v1"; export type TikTokProductIdentity = { version: typeof TIKTOK_PRODUCT_IDENTITY_VERSION; inputDigest: string; imageCount: number; productLabel: string; categoryTerms: string[]; excludedCategoryTerms: string[]; visualEvidence: string[]; canonicalCategory?: string; variantTerms?: string[]; }; export type TikTokSearchScope = "same-theme" | "same-category" | "product-demo"; export type TikTokSearchPlan = { version: typeof TIKTOK_SEARCH_PLAN_VERSION; strategy?: "commerce-hit-v1"; productLabel: string; categoryTerms: string[]; themeTerms: string[]; queries: { query: string; scope: TikTokSearchScope; }[]; productIdentity?: TikTokProductIdentity; }; export declare function hasSearchTerm(text: string, term: string): boolean; export declare function hasCategoryTextEvidence(text: string, term: string): boolean; declare const validationReasons: { readonly invalid_json: "返回内容不是有效 JSON"; readonly invalid_fields: "计划字段或版本不符合约定"; readonly product_label: "商品名称须为 1–120 字的单行纯文本"; readonly category_terms: "品类词须为 1–4 个、每个不超过 40 字的单行纯文本"; readonly theme_terms: "主题词须为 0–4 个、每个不超过 40 字的单行纯文本"; readonly query_count: "搜索词数量不符合本轮策略"; readonly query_scope: "搜索范围标记不符合约定"; readonly scope_order: "须依次排列同主题、同品类和商品演示短词"; readonly query_text: "短词须为不超过 64 字且不含标签的单行纯文本"; readonly query_words: "短词超过 8 个词"; readonly category_missing: "短词未原样包含已提炼的品类词"; readonly theme_missing: "同主题短词未原样包含已提炼的主题词"; readonly duplicate_query: "存在重复搜索短词"; readonly scope_missing: "缺少同主题、同品类或商品演示范围"; readonly untranslated: "当地搜索词仍含未翻译的中文"; readonly identity_changed: "修正时改变了原商品名称或已确认的品类词"; readonly visual_identity: "图文商品身份凭据无效或类别被改变"; readonly excluded_category: "搜索词包含图文识别排除的近邻品类"; readonly canonical_category_query: "同品类搜索须包含不叠加变体属性的规范小类目短词"; }; export type TikTokSearchPlanValidation = { reason: keyof typeof validationReasons; queryIndex?: number; }; export declare class TikTokSearchPlanValidationError extends Error { readonly reason: TikTokSearchPlanValidation["reason"]; readonly queryIndex?: number | undefined; constructor(reason: TikTokSearchPlanValidation["reason"], queryIndex?: number | undefined); } export declare function validateTikTokSearchPlan(input: unknown): TikTokSearchPlan; export declare function validTikTokProductIdentity(value: unknown): value is TikTokProductIdentity; /** Text evidence only, never a claim that the video actually shows this SKU. */ export declare function searchMatchEvidence(title: string | null, plan: TikTokSearchPlan): { readonly level: "unknown" | "category" | "theme"; readonly terms: readonly string[]; }; export declare function compareSearchCandidates(a: { title: string | null; metrics: { likes: number | null; }; commerceEvidence: unknown[]; }, b: typeof a, plan?: TikTokSearchPlan): number; export declare const tikTokSearchPlanSchema: { type: string; additionalProperties: boolean; required: string[]; properties: { productLabel: { type: string; minLength: number; maxLength: number; }; categoryTerms: { type: string; minItems: number; maxItems: number; items: { type: string; minLength: number; maxLength: number; }; }; themeTerms: { type: string; maxItems: number; items: { type: string; minLength: number; maxLength: number; }; }; queries: { type: string; minItems: number; maxItems: number; items: { type: string; additionalProperties: boolean; required: string[]; properties: { query: { type: string; minLength: number; maxLength: number; }; scope: { type: string; enum: string[]; }; }; }; }; }; }; export declare const commerceCategoryPlanSchema: { properties: { themeTerms: { type: string; maxItems: number; items: { type: string; }; }; queries: { minItems: number; maxItems: number; items: { properties: { query: { type: string; minLength: number; maxLength: number; }; scope: { type: string; enum: string[]; }; }; type: string; additionalProperties: boolean; required: string[]; }; type: string; }; productLabel: { type: string; minLength: number; maxLength: number; }; categoryTerms: { type: string; minItems: number; maxItems: number; items: { type: string; minLength: number; maxLength: number; }; }; }; type: string; additionalProperties: boolean; required: string[]; }; export {};