基础设施
本地代理,使用 TypeSafe Jev 根据消息选择 Claude 模型和计算资源,路由子代理,保持主聊天缓存不变。
Local proxy that picks the Claude model and effort per message using TypeSafe Jev. Routes subagents, leaves your cached main chat alone.
typesafeApiUrl: "https://api.typesafe.ai",链接指向我们抓取当天的那个 commit,行号是准的。
下面是从这个项目源码里原样取出来的 question 组合。
model选项Which model tier fits the task in `latest_user_message`?
what — The hardest and longest work: ambiguous goals that need research and planning before code, large refactors or migrations across a codebase, architecture with many tradeoffs, tasks where a mistake is very costly and hard to undo.not_for — Anything with a clear, bounded scope, even if difficult (opus).effort选项How much deliberation does the task in `latest_user_message` need before answering or acting?
what — Correctness dominates cost and time: security analysis, complex algorithms, large migrations, anything hard to undo.not_for — Anything that is merely difficult (xhigh).is_followup是/否Is `latest_user_message` a short continuation of `previous_assistant_reply` that only makes sense given that reply: a confirmation ('yes', 'do it', 'go ahead', 'continue'), a choice among options the assistant offered, or a small tweak to what was just proposed?
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
model: { type: 'choice', instructions: 'Which model tier fits the task in `latest_user_message`?',
criteria: { what: 'The hardest and longest work: ambiguous goals that need research and planning before code, large refactors or migrations across a codebase, architecture with many tradeoffs, tasks where a mistake is very costly and hard to undo.', not_for: 'Anything with a clear, bounded scope, even if difficult (opus).' } },
effort: { type: 'choice', instructions: 'How much deliberation does the task in `latest_user_message` need before answering or acting?',
criteria: { what: 'Correctness dominates cost and time: security analysis, complex algorithms, large migrations, anything hard to undo.', not_for: 'Anything that is merely difficult (xhigh).' } },
is_followup: { type: 'boolean', instructions: 'Is `latest_user_message` a short continuation of `previous_assistant_reply` that only makes sense given that reply: a confirmation (\'yes\', \'do it\', \'go ahead\', \'continue\'), a choice among options the assistant offered, or a small tweak to what was just proposed?' },
},
});