Files
deepseek-harness/snapshots/session/model-switch-compaction/driver.mjs
T
Yichen Jiang 0789f36a26 docs(compaction): address review comments on summary-route wording and the snapshot fixture
State the fallback order consistently, qualify it for sessions without an assistant message, document the unavailable-answering-model limit and the tool-declaration source, share the system prompt sidecar, and align the recorded task with the scenario.
2026-11-12 17:54:23 +08:00

22 lines
816 B
JavaScript

/**
* Test-only request routing to a second model after tool execution. The
* `model-switch-compaction` and `model-switch-overflow-recovery` scenarios both load it.
*/
export const name = 'model-switch-compaction-driver'
export const inject = ['tools']
/**
* Select the smaller model after the first tool call, before the next step prepares.
* @param {import('@deepseek-ai/cordis').Context} ctx - composition context.
*/
export function apply(ctx) {
ctx.on('tools/execute', async (exec, next) => {
const result = await next()
if (exec.name === 'bash' && !result.isError) {
if (exec.agent === undefined) throw new Error('model-switch compaction requires a calling Agent')
exec.agent.model.select({ provider: 'deepseek-official', model: 'deepseek-v4-pro' })
}
return result
})
}