// KBDB Worker 型別定義 export type Bindings = { // 插件不碰 DB/Vectorize/AI — 全走基本盤 API(API-as-Wall)。 // 語意搜尋/embedding 屬基本盤 optional embed 模組,不在插件。 KBDB_BASE_URL?: string; // 基本盤 arcrun/kbdb API 網址(leo: 可設定,先留空) KBDB_INTERNAL_TOKEN?: string; ENVIRONMENT: string; API_KEY?: string; }; // Hono Context 變數:auth middleware 設定,route handler 使用 export type Variables = { namespace: string | null; // null = internal(無限制),string = partner 的 org_namespace partner_id: string; // 'internal' 或 partner record_id }; export type EntityType = 'person' | 'event' | 'product' | 'market' | 'org'; export type Triplet = { id: string; subject: string; predicate: string; object: string; source_block_id: string | null; confidence: number; clusters: string[]; // 所屬的知識群集,用於跨領域偵測 bridge_score: number; // 跨越的 cluster 數量,Scout 發現指標 subject_entity_type: EntityType | null; // 主體 entity 類型(人格疊加局勢分析用) object_entity_type: EntityType | null; // 客體 entity 類型 created_at: number; updated_at: number; }; // 圖遍歷結果 export type GraphNode = { node: string; level: number; edges: Triplet[]; }; // --- Entity Normalization 型別 --- export type Entity = { id: string; canonical: string; aliases: string[]; }; export type PendingAlias = { id: string; raw_name: string; candidate_entity_id: string; candidate_canonical: string; similarity: number; created_at: number; };