mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-12 04:01:20 +00:00
refactor(agent): make runtime identity explicit
This commit is contained in:
@@ -380,12 +380,14 @@ export class ApiSessionAgentController {
|
||||
readonly setup: AgentSetup
|
||||
}> {
|
||||
const presets = this.ctx.get('agentPresets')
|
||||
if (presets === undefined) return { setup: (agentCtx) => { this.installSelection(agentCtx) } }
|
||||
if (presets === undefined) {
|
||||
return { setup: (_agentCtx, agent) => { this.installSelection(agent) } }
|
||||
}
|
||||
const resolvedId = (await presets.resolve(presetId)).id
|
||||
return {
|
||||
agentPreset: resolvedId,
|
||||
setup: async (agentCtx) => {
|
||||
this.installSelection(agentCtx)
|
||||
setup: async (agentCtx, agent) => {
|
||||
this.installSelection(agent)
|
||||
await presets.mount(agentCtx, resolvedId)
|
||||
},
|
||||
}
|
||||
@@ -494,9 +496,7 @@ export class ApiSessionAgentController {
|
||||
return { provider, model }
|
||||
}
|
||||
|
||||
private installSelection(agentCtx: Context): void {
|
||||
const agent = agentCtx.agent
|
||||
if (agent === undefined) throw new Error('api-session: Agent setup has no scoped Agent')
|
||||
private installSelection(agent: Agent): void {
|
||||
this.selectionFor(agent)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user