UNPKG

@nanocollective/nanocoder

Version:

A local-first CLI coding agent that brings the power of agentic coding tools like Claude Code and Gemini CLI to local models or controlled APIs like OpenRouter

67 lines 1.96 kB
/** * Index manager for efficient log entry lookups */ /** * Manages indexes for log entries */ export class IndexManager { indexes = new Map(); /** * Update indexes when entry is added or removed */ updateIndexes(entry, add) { // Update correlation ID index if (entry.correlationId) { if (!this.indexes.has('correlationId')) { this.indexes.set('correlationId', new Set()); } // biome-ignore lint/style/noNonNullAssertion: Index exists after set above const index = this.indexes.get('correlationId'); if (add) { index.add(entry.correlationId); } else { index.delete(entry.correlationId); } } // Update source index if (entry.source) { if (!this.indexes.has('source')) { this.indexes.set('source', new Set()); } // biome-ignore lint/style/noNonNullAssertion: Index exists after set above const index = this.indexes.get('source'); if (add) { index.add(entry.source); } else { index.delete(entry.source); } } // Update level index if (!this.indexes.has('level')) { this.indexes.set('level', new Set()); } // biome-ignore lint/style/noNonNullAssertion: Index exists after set above const levelIndex = this.indexes.get('level'); if (add) { levelIndex.add(entry.level); } else { levelIndex.delete(entry.level); } } /** * Clear all indexes */ clear() { this.indexes.clear(); } /** * Get all values for a specific index */ getIndexValues(indexName) { return this.indexes.get(indexName); } } //# sourceMappingURL=index-manager.js.map