Files
ChatLab/packages/node-runtime/src/semantic-index/index.ts
T

142 lines
4.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 语义索引模块(Phase 1)
*
* 独立于 dormant 的旧 `ai/rag` 模块,按 chunking-decision-final.md 重新实现:
* 向量存储、parent/child chunker、embedding provider、混合召回与后台预热。
*/
export { EmbeddingIndexStore } from './store'
export type { LoadSqliteVec } from './store'
export {
EMBEDDING_INDEX_SCHEMA,
CHUNK_VECTOR_INDEX_TABLE,
CHUNK_VECTOR_INDEX_INDEXES,
SEMANTIC_INDEX_SESSION_TABLE,
vecTableName,
vecTableSchema,
} from './schema'
export { SemanticIndexStateStore } from './session-state-store'
export type {
SemanticIndexSessionState,
SemanticIndexStatus,
SemanticIndexCleanupStatus,
EnableParams,
ProgressPatch,
} from './session-state-store'
export type {
ChunkRecord,
ChunkInsert,
ChunkStatus,
DenseQueryParams,
DenseQueryResult,
MessageToChunkParams,
} from './types'
export {
CHUNKER_VERSION,
STRATEGY_ID,
DEFAULT_CHUNKER_CONFIG,
computeChunkerConfigHash,
computeDbPathHash,
composeChunkId,
deriveParentId,
parseParentBounds,
} from './chunker-config'
export type { ChunkerConfig } from './chunker-config'
export { estimateTokens } from './tokens'
export {
SemanticIndexConfigStore,
defaultSemanticIndexConfig,
isSemanticIndexConfigured,
resolveModelId,
clampSearchMaxResults,
SEMANTIC_INDEX_CONFIG_VERSION,
SEARCH_MAX_RESULTS_DEFAULT,
SEARCH_MAX_RESULTS_MIN,
SEARCH_MAX_RESULTS_MAX,
DEFAULT_SEMANTIC_INDEX_MODEL_DOWNLOAD_SOURCE,
} from './config'
export type {
SemanticIndexConfig,
SemanticIndexConfigInput,
SemanticIndexMode,
SemanticIndexLocalConfig,
SemanticIndexApiConfig,
SemanticIndexModelDownloadSource,
} from './config'
export { createEmbedder } from './embedder-factory'
export type { EmbedderFactoryDeps } from './embedder-factory'
export {
SemanticIndexService,
createSemanticIndexService,
persistSemanticIndexConfig,
resolveSemanticIndexApiKeySet,
SEMANTIC_INDEX_AUTH_PROFILE,
SEMANTIC_INDEX_DB_FILE,
SEMANTIC_INDEX_CONFIG_FILE,
} from './service'
export type { SemanticIndexRuntime, MaybePromise } from './runtime'
export {
createLocalEmbeddingRuntimeManager,
LOCAL_EMBEDDING_RUNTIME_PACKAGE,
LOCAL_EMBEDDING_RUNTIME_VERSION,
} from './embedding/local-runtime'
export type {
LocalEmbeddingRuntimeConfig,
LocalEmbeddingRuntimeInstallMode,
LocalEmbeddingRuntimeManagerOptions,
LocalEmbeddingRuntimeStatus,
} from './embedding/local-runtime'
export {
SemanticIndexWorkerClient,
createSemanticIndexWorkerClient,
createSemanticIndexWorkerRuntimeClient,
} from './worker-client'
export type {
SemanticIndexWorkerClientOptions,
SemanticIndexWorkerRuntimeClientOptions,
SemanticIndexWorkerTransport,
SemanticIndexWorkerTransportFactory,
} from './worker-client'
export { createSemanticIndexWorkerThreadTransport } from './worker-thread-transport'
export type { SemanticIndexWorkerThreadTransportOptions, SemanticIndexWorkerLike } from './worker-thread-transport'
export { StaticPathProvider, snapshotPathProvider } from './static-path-provider'
export type { StaticPathProviderSnapshot } from './static-path-provider'
export type {
SemanticIndexServiceOptions,
SemanticIndexSessionStatus,
SemanticSearchResult,
SemanticSearchReason,
SemanticSearchToolResult,
SemanticSearchToolSource,
SemanticSearchToolOptions,
} from './service'
export { runWarmup } from './warmup/runner'
export type {
SemanticMessageSource,
StopSignal,
WarmupRunnerOptions,
WarmupResult,
WarmupStatus,
} from './warmup/runner'
export { SemanticIndexJobQueue } from './warmup/job-queue'
export type { SemanticIndexJob, SemanticIndexJobType, JobContext, JobExecutor } from './warmup/job-queue'
export { reciprocalRankFusion } from './retrieval/rrf'
export type { RrfResult } from './retrieval/rrf'
export { hybridSearch } from './retrieval/hybrid-search'
export type { FtsSearcher, HybridSearchDeps, HybridSearchParams, HybridSearchResult } from './retrieval/hybrid-search'
export { createChatDbMessageSource } from './chat-db/message-source'
export { createChatDbMessageRangeReader } from './chat-db/message-range-reader'
export { createChatDbFtsSearcher, extractFtsKeywords } from './chat-db/fts-searcher'
export { assembleEvidence, formatEvidenceMessages } from './retrieval/evidence'
export type {
EvidenceMessage,
MessageRangeReader,
EvidenceHit,
EvidenceBudget,
EvidenceBlock,
EvidenceResult,
} from './retrieval/evidence'
export { chunkMessages, isSemanticVoid } from './chunker'
export type { ChunkMessageInput, ChunkSource, ChunkMessagesInput, ChildChunk, ChunkResult } from './chunker'
export * as embedding from './embedding'