import { describe, it, expect } from 'vitest'; import { ALL_TOOLS } from '../tools.js'; describe('ALL_TOOLS registry', () => { // v1.13.3: tools must be alpha-sorted at module load. llama.cpp's prompt // cache hits on byte-identical prefixes; the tool list lives near the // top of the system prompt, so any order drift invalidates every cached // turn. The registry sort is the single source of truth; downstream // helpers (toolJsonSchemas, TOOLS_BY_NAME, buildAiTools) inherit it. it('exports tools in alphabetical order by name', () => { const names = ALL_TOOLS.map((t) => t.name); expect(names).toEqual([...names].sort((a, b) => a.localeCompare(b))); }); });