mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
fix(headless): compose the one-shot agent from the preset roster again
The agent-default-model refactor moved the headless runner off the api-proxy create path onto a direct agents.create, which silently dropped the preset composition the stack had put on every dsh run session: the header lost its agentPreset and the agent ran on the host composition alone. Resolve the default preset up front (optional service — a roster- less composition keeps the pre-preset behavior), record it on the header, and mount it in setup where a broken composition still fails the run.
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
"peerDependencies": {
|
||||
"@deepseek-ai/dsh-agent": "^0.0.1",
|
||||
"@deepseek-ai/dsh-agent-default-model": "^0.0.1",
|
||||
"@deepseek-ai/dsh-agent-presets": "^0.0.1",
|
||||
"@deepseek-ai/dsh-invariants": "^0.0.1",
|
||||
"@deepseek-ai/dsh-llm": "^0.0.1",
|
||||
"@deepseek-ai/dsh-session": "^0.0.1",
|
||||
@@ -47,6 +48,7 @@
|
||||
"@cordisjs/plugin-loader": "workspace:^",
|
||||
"@deepseek-ai/dsh-agent": "workspace:^",
|
||||
"@deepseek-ai/dsh-agent-default-model": "workspace:^",
|
||||
"@deepseek-ai/dsh-agent-presets": "workspace:^",
|
||||
"@deepseek-ai/dsh-invariants": "workspace:^",
|
||||
"@deepseek-ai/dsh-llm": "workspace:^",
|
||||
"@deepseek-ai/dsh-session": "workspace:^",
|
||||
|
||||
@@ -13,6 +13,8 @@ import z from 'schemastery'
|
||||
import { installModelSelection } from '@deepseek-ai/dsh-agent'
|
||||
import type { ModelSelectionRef } from '@deepseek-ai/dsh-agent'
|
||||
import type {} from '@deepseek-ai/dsh-agent-default-model'
|
||||
// Empty type import carries the agentPresets Context merge for the optional roster read.
|
||||
import type {} from '@deepseek-ai/dsh-agent-presets'
|
||||
import { createUserMessage } from '@deepseek-ai/dsh-llm'
|
||||
import { SessionId } from '@deepseek-ai/dsh-session'
|
||||
import type { SessionEvent } from '@deepseek-ai/dsh-session'
|
||||
@@ -106,13 +108,24 @@ async function run(ctx: Context, task: string, io: HeadlessIo): Promise<void> {
|
||||
if (agents === undefined || defaultModel === undefined || sessions === undefined) return
|
||||
|
||||
const selection = defaultModel.currentSelection()
|
||||
// A one-shot run composes its agent from the same preset roster `dsh web`
|
||||
// offers: the default preset both lands on the header (the log states what
|
||||
// the agent ran) and mounts in setup, where a broken composition still
|
||||
// fails the creation. A composition with no roster keeps the pre-preset
|
||||
// behavior — the agent runs on the host composition alone.
|
||||
const presets = ctx.get('agentPresets')
|
||||
const presetId = presets === undefined ? undefined : (await presets.resolve()).id
|
||||
const { agent } = await agents.create({
|
||||
sessionId: SessionId(`session-${randomUUID()}`),
|
||||
meta: { cwd: process.cwd() },
|
||||
meta: {
|
||||
cwd: process.cwd(),
|
||||
...presetId === undefined ? {} : { agentPreset: presetId },
|
||||
},
|
||||
agentOptions: { provider: selection.provider, model: selection.model },
|
||||
setup: (agentCtx) => {
|
||||
setup: async (agentCtx) => {
|
||||
const selected: ModelSelectionRef = { current: selection, assembled: undefined }
|
||||
installModelSelection(agentCtx, selected)
|
||||
if (presets !== undefined) await presets.mount(agentCtx, presetId)
|
||||
},
|
||||
})
|
||||
await agent.whenIdle()
|
||||
|
||||
@@ -23,11 +23,14 @@
|
||||
{
|
||||
"path": "../../core/agent-default-model"
|
||||
},
|
||||
{
|
||||
"path": "../../core/session"
|
||||
},
|
||||
{
|
||||
"path": "../../llm/llm"
|
||||
},
|
||||
{
|
||||
"path": "../../core/session"
|
||||
"path": "../../preset/agent-presets"
|
||||
},
|
||||
{
|
||||
"path": "../../support/invariants"
|
||||
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -1342,6 +1342,9 @@ importers:
|
||||
'@deepseek-ai/dsh-agent-default-model':
|
||||
specifier: workspace:^
|
||||
version: link:../../core/agent-default-model
|
||||
'@deepseek-ai/dsh-agent-presets':
|
||||
specifier: workspace:^
|
||||
version: link:../../preset/agent-presets
|
||||
'@deepseek-ai/dsh-invariants':
|
||||
specifier: workspace:^
|
||||
version: link:../../support/invariants
|
||||
|
||||
Reference in New Issue
Block a user