@zerospacegg/anrubic
Version:
Anrubic - ZeroSpace.gg MCP Server for AI agents to access game data
49 lines (48 loc) • 1.2 kB
TypeScript
export interface LoreChunk {
id: string;
title: string;
content: string;
startLine: number;
endLine: number;
section: string;
subsection?: string;
}
export interface TokenEntry {
token: string;
chunks: Array<{
chunkId: string;
frequency: number;
positions: number[];
}>;
totalFrequency: number;
}
export interface LoreIndex {
chunks: Record<string, LoreChunk>;
unigrams: Record<string, TokenEntry>;
digraphs: Record<string, TokenEntry>;
metadata: {
totalChunks: number;
totalTokens: number;
totalDigraphs: number;
lastUpdated: string;
sourceFile: string;
};
}
export interface SearchResult {
chunk: LoreChunk;
score: number;
matchedTokens: string[];
context: string;
}
/**
* Build complete lore index from markdown file
*/
export declare function buildLoreIndex(filePath: string): LoreIndex;
/**
* Search the lore index for relevant chunks
*/
export declare function searchLore(index: LoreIndex, query: string, limit?: number): SearchResult[];
/**
* Get lore index statistics for debugging
*/
export declare function getLoreStats(index: LoreIndex): any;