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

@@ -14,7 +14,7 @@ export function apply(ctx) {
render(_args, value) { return [{ type: 'text', text: value }] },
},
async execute() { return 'pong' },
}, { when: async ({ route }) => active && route.provider === 'deepseek-official' })
}, { when: async ({ modelSelection }) => active && modelSelection.provider === 'deepseek-official' })
ctx.on('tools/post-execute', async (exec, result, next) => {
const downstream = await next()
if (result.isError) return downstream