UNPKG

il2cpp-dump-analyzer-mcp

Version:

Agentic RAG system for analyzing IL2CPP dump.cs files from Unity games

97 lines (96 loc) 3.55 kB
/** * Real dump.cs Test Setup Utility * Provides infrastructure for testing MCP tools with actual dump.cs content * Uses existing Enhanced IL2CPP Parser, IL2CPP Code Chunker, and Vector Store */ import { Document } from '@langchain/core/documents'; import { EnhancedIL2CPPParser } from '../../parser/enhanced-il2cpp-parser'; import { IL2CPPCodeChunker } from '../../embeddings/chunker'; import { XenovaEmbeddings } from '../../embeddings/xenova-embeddings'; import { MemoryVectorStore } from 'langchain/vectorstores/memory'; /** * Mock embeddings for testing that doesn't require actual model loading */ declare class MockEmbeddings { initialize(): Promise<void>; embedDocuments(texts: string[]): Promise<number[][]>; embedQuery(text: string): Promise<number[]>; private createMockEmbedding; } import { IL2CPPClass, IL2CPPEnum, IL2CPPInterface } from '../../parser/enhanced-types'; /** * Real data test configuration */ export interface RealDataTestConfig { dumpFilePath?: string; useCache?: boolean; chunkSize?: number; chunkOverlap?: number; maxDocuments?: number; useDirectContent?: boolean; dumpContent?: string; } /** * Real data test context */ export interface RealDataTestContext { vectorStore: MemoryVectorStore; parser: EnhancedIL2CPPParser; chunker: IL2CPPCodeChunker; embeddings: MockEmbeddings | XenovaEmbeddings; documents: Document[]; classes: IL2CPPClass[]; enums: IL2CPPEnum[]; interfaces: IL2CPPInterface[]; monoBehaviours: IL2CPPClass[]; } /** * Setup real data test environment using actual dump.cs file */ export declare function setupRealDataTest(config?: RealDataTestConfig): Promise<RealDataTestContext>; /** * Clear cached test context (useful for testing different configurations) */ export declare function clearTestCache(): void; /** * Get statistics about the real data test environment */ export declare function getTestDataStatistics(context: RealDataTestContext): Record<string, any>; /** * Helper functions for finding specific entities in real data */ /** * Find a class by name in the real data */ export declare function findClassByName(context: RealDataTestContext, className: string): IL2CPPClass | undefined; /** * Find an enum by name in the real data */ export declare function findEnumByName(context: RealDataTestContext, enumName: string): IL2CPPEnum | undefined; /** * Find MonoBehaviours by name pattern */ export declare function findMonoBehavioursByPattern(context: RealDataTestContext, pattern: string): IL2CPPClass[]; /** * Find classes by namespace */ export declare function findClassesByNamespace(context: RealDataTestContext, namespace: string): IL2CPPClass[]; /** * Get sample entities for testing (returns a few real entities for test validation) */ export declare function getSampleEntities(context: RealDataTestContext): { sampleClass: IL2CPPClass | undefined; sampleEnum: IL2CPPEnum | undefined; sampleMonoBehaviour: IL2CPPClass | undefined; sampleInterface: IL2CPPInterface | undefined; }; /** * Create a mock vector store interface that uses the real data * This allows existing tests to work with real data without major changes */ export declare function createRealDataVectorStore(context: RealDataTestContext): { similaritySearch: (query: string, k?: number) => Promise<Document[]>; searchWithFilter: (query: string, filter: Record<string, any>, k?: number) => Promise<Document[]>; addDocuments: (documents: Document[]) => Promise<void>; }; export {};