import type { KtxFileStorePort } from '../core/file-store.js'; export interface UpsertPageParams { scope: string; scopeId: string | null; pageKey: string; summary: string; usageMode: string; sortOrder: number; searchText: string; embedding: number[] | null; contentHash?: string | null; sourceRunId?: string | null; } export interface KnowledgeIndexPageListing { id?: string; page_key: string; summary: string; scope: string; scope_id: string | null; tags: string[]; } export interface KnowledgeIndexPort { upsertPage(params: UpsertPageParams): Promise; applyDiffTransactional(params: { runId: string; upserts: UpsertPageParams[]; deletes: Array<{ scope: string; scopeId: string | null; pageKey: string }>; }): Promise; getExistingSearchTexts( scope: string, scopeId: string | null, ): Promise>; deleteStale(scope: string, scopeId: string | null, keepKeys: string[]): Promise; deleteByScope(scope: string, scopeId: string | null): Promise; deleteByKey(scope: string, scopeId: string | null, pageKey: string): Promise; findPageByKey( scope: string, scopeId: string | null, pageKey: string, ): Promise<{ id?: string; page_key: string } | null | undefined>; listPagesForUser(userId: string): Promise; getUserPageCount(userId: string): Promise; incrementUsageCount(pageIds: string[]): Promise; searchRRF( userId: string, queryEmbedding: number[] | null, queryText: string, limit: number, ): Promise>; } export interface KnowledgeEventPort { createEvent(params: { blockId: string | null; eventType: string; actorId: string; chatId?: string | null; messageId?: string | null; payload: Record; }): Promise; } export interface KnowledgeGitDiffPort { diffNameStatus( fromSha: string, toSha: string, pathPrefix?: string, ): Promise>; getFileAtCommit(path: string, sha: string): Promise; } export type WikiFileStorePort = KtxFileStorePort;