Quellcode durchsuchen

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.
Yichen Jiang vor 1 Monat
Ursprung
Commit
d5af34b022

+ 1 - 1
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"}}

+ 0 - 2
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:^",

+ 2 - 15
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<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(),
-      ...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()

+ 1 - 4
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"

+ 0 - 3
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