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

49 lines 1.62 kB
import { modelDatabase } from '../model-database/model-database.js'; export class ModelMatchingEngine { static instance; static getInstance() { if (!ModelMatchingEngine.instance) { ModelMatchingEngine.instance = new ModelMatchingEngine(); } return ModelMatchingEngine.instance; } /** * Get all models - sync version (from cache) */ getModels() { const allModels = modelDatabase.getAllModels(); return this.processModels(allModels); } /** * Get all models - async version for fresh data */ async getModelsAsync() { const allModels = await modelDatabase.getAllModelsAsync(); return this.processModels(allModels); } /** * Process models into categorized lists */ processModels(allModels) { // Open models (open weights) - sorted by newest const openModels = allModels .filter(m => m.local) .sort((a, b) => b.created - a.created); // Proprietary models - sorted by newest const proprietaryModels = allModels .filter(m => !m.local) .sort((a, b) => b.created - a.created); // Latest models (all, sorted by newest) - top 50 const latestModels = [...allModels] .sort((a, b) => b.created - a.created) .slice(0, 50); return { allModels, openModels, proprietaryModels, latestModels, }; } } export const modelMatchingEngine = ModelMatchingEngine.getInstance(); //# sourceMappingURL=model-engine.js.map