Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

727 B
Raw Blame
import { readFileSync } from 'node:fs';
import { createRequire, wrap } from 'node:module';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { runInThisContext } from 'node:vm';

// These browser scripts also expose CommonJS exports. Load that branch
// explicitly even though the application's package.json declares ESM.
export function loadCommonJS(relativePath) {
    const filename = fileURLToPath(new URL(relativePath, import.meta.url));
    const module = { exports: {} };
    const evaluate = runInThisContext(wrap(readFileSync(filename, 'utf8')), { filename });
    evaluate(module.exports, createRequire(filename), module, filename, dirname(filename));
    return module.exports;
}