Centralized model config (config.ts MODELS) + extraction seam logging

MODELS in config.ts is now THE single tuning table: model id + OpenRouter
reasoning effort for teacher/researcher/demoBuilder/visualMaker/extractor/
auditor. .env.local is secrets-only (LH_* model vars removed; all sub-agents
previously had NO reasoning setting -> provider-default unbounded thinking,
the extraction token burn). One factory (src/agent/models.ts modelFor) wires
all six call sites; test injection unchanged. EXTRACTION.everyNQuizAnswers
moved to a config literal too. Plus the §5 one-line-per-seam logging in the
extraction pipeline: pipeline start, extractor/auditor start + per-step,
audit kept, merged — previously silent until completion, which made live
runs look like they never fired.
This commit is contained in:
Amos
2026-09-01 01:47:47 +03:00
parent 5dab8d12d4
commit 59fc2ef863
11 changed files with 94 additions and 43 deletions
+17
View File
@@ -0,0 +1,17 @@
import { openrouter } from "@openrouter/ai-sdk-provider";
import type { LanguageModel } from "ai";
import { MODELS, type ModelRole } from "../../config.ts";
/**
* The one factory every agent's model comes from. Model choice and thinking
* budget live in config.ts (MODELS) — the single tuning table; this module
* only wires them to OpenRouter. `effort: "none"` is OpenRouter's off-switch
* for reasoning tokens; higher levels let the model think longer (and bill
* accordingly).
*/
export function modelFor(role: ModelRole): LanguageModel {
const spec = MODELS[role];
return openrouter(spec.model, {
reasoning: { enabled: true, effort: spec.effort },
});
}