feat(agent): choose provider, model, and effort through agent/model

Rename agent/route to agent/model and make its result a complete
ModelSelection, so each step fixes its provider, model, and reasoning
effort before prompt preparation, agent/pre-step, tool conditions, and
every request attempt. agent/request may change only sampling controls;
returning another provider, model, or reasoning effort fails the step.

installModelSelection installs one agent/model listener and
ModelSelectionRef drops assembled. The pre-step payload, AssembleContext,
and ToolActivationContext carry modelSelection. Webhook initial
selection and the CLI mock effort switch move to agent/model.
This commit is contained in:
Yichen Jiang committed 2026-10-13 10:58:57 +08:00
1 parent 06d1caf82f
commit 043539da05
106 files changed
+693 -738

No files matched your search

@@ -1675,7 +1675,7 @@ describe('default one-shot summarizer', () => {
describe('automatic listener and loader composition', () => {
function preStep(ctx: Context, owner: Agent, signal = SIGNAL) {
return agentEvents(ctx, owner).waterfall(
'agent/pre-step', { messages: [], turn: 1, step: 1, route: { provider: 'test', model: 'test' }, signal },
'agent/pre-step', { messages: [], turn: 1, step: 1, modelSelection: { provider: 'test', model: 'test' }, signal },
() => Promise.resolve({ kind: 'enter' as const, messages: [] }),
)
}