From d5af34b0222ea7b512f9915b39ef08ae9f38980a Mon Sep 17 00:00:00 2001 From: Yichen Jiang Date: Sun, 9 Aug 2026 23:12:29 +0800 Subject: [PATCH] fix(headless): align the one-shot runner with the direct rosterless profile The shipped headless profile is base + headless (the direct-core front door), and its installation-owned migration rewrites the old three-bundle tuple down to that template, so a one-shot run composes no preset roster. The runner's optional preset composition was compensating in the wrong direction: it re-added roster reads the shipped profile never satisfies, and its golden pinned a header field only a roster-bearing deployment produces. The runner, the headless bundle manifest, and the dsh-run golden return to the direct shape; skills in a direct run flow through the base host rows' global layer, which is what the repository-plugin e2e proves. --- .../snapshots/dsh-run/session.expected.jsonl | 2 +- packages/bundle/headless/package.json | 2 -- packages/bundle/headless/src/index.ts | 17 ++--------------- packages/bundle/headless/tsconfig.json | 5 +---- pnpm-lock.yaml | 3 --- 5 files changed, 4 insertions(+), 25 deletions(-) diff --git a/examples/headless-agent/tests/snapshots/dsh-run/session.expected.jsonl b/examples/headless-agent/tests/snapshots/dsh-run/session.expected.jsonl index a132241c96..260ae241b0 100644 --- a/examples/headless-agent/tests/snapshots/dsh-run/session.expected.jsonl +++ b/examples/headless-agent/tests/snapshots/dsh-run/session.expected.jsonl @@ -1,4 +1,4 @@ -{"type":"session","version":0,"id":"{{sessionId}}","createdAt":0,"cwd":"{{cwd}}","delegationDepth":0,"agentPreset":"standard"} +{"type":"session","version":0,"id":"{{sessionId}}","createdAt":0,"cwd":"{{cwd}}","delegationDepth":0} {"type":"permission/preset","seq":0,"time":0,"data":{"preset":"danger-full-access"}} {"type":"sandbox/mode","seq":1,"time":0,"data":{"mode":"danger-full-access"}} {"type":"approval/policy","seq":2,"time":0,"data":{"policy":"never"}} diff --git a/packages/bundle/headless/package.json b/packages/bundle/headless/package.json index 4bd58a0451..bc461e4c72 100644 --- a/packages/bundle/headless/package.json +++ b/packages/bundle/headless/package.json @@ -38,7 +38,6 @@ "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", @@ -48,7 +47,6 @@ "@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:^", diff --git a/packages/bundle/headless/src/index.ts b/packages/bundle/headless/src/index.ts index 14b5200339..2ea68c441b 100644 --- a/packages/bundle/headless/src/index.ts +++ b/packages/bundle/headless/src/index.ts @@ -13,8 +13,6 @@ 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' @@ -108,24 +106,13 @@ async function run(ctx: Context, task: string, io: HeadlessIo): Promise { 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(), - ...presetId === undefined ? {} : { agentPreset: presetId }, - }, + meta: { cwd: process.cwd() }, agentOptions: { provider: selection.provider, model: selection.model }, - setup: async (agentCtx) => { + setup: (agentCtx) => { const selected: ModelSelectionRef = { current: selection, assembled: undefined } installModelSelection(agentCtx, selected) - if (presets !== undefined) await presets.mount(agentCtx, presetId) }, }) await agent.whenIdle() diff --git a/packages/bundle/headless/tsconfig.json b/packages/bundle/headless/tsconfig.json index af59a30336..9ae3212f6b 100644 --- a/packages/bundle/headless/tsconfig.json +++ b/packages/bundle/headless/tsconfig.json @@ -23,14 +23,11 @@ { "path": "../../core/agent-default-model" }, - { - "path": "../../core/session" - }, { "path": "../../llm/llm" }, { - "path": "../../preset/agent-presets" + "path": "../../core/session" }, { "path": "../../support/invariants" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a29370d273..ea741e98c1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1342,9 +1342,6 @@ 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