适配 DSH 0.2.1-alpha.2 并核对原生功能分工

This commit is contained in:
yexi committed 2026-10-09 20:45:12 +08:00
1 parent feafd8b1df
commit 70008e2c54
31 files changed
+2459 -276

No files matched your search

+6 -4
View File
@@ -47,6 +47,8 @@ const BASE_PATCH = join(repo, 'packages/bundle/base/cordis.patch.yml')
const INSTALL_ANCHOR = join(repo, 'apps/cli/package.json')
const home = await mkdtemp(join(tmpdir(), 'dsh-prompt-dump-'))
const workspace = join(home, 'workspace')
await mkdir(workspace)
const overrides = [
{ id: 'storage-json', config: { root: join(home, 'storages') } },
@@ -54,7 +56,6 @@ const overrides = [
{ id: 'webserver', inject: [], config: { host: '127.0.0.1', port: 0 } },
{ id: 'web-runtime', disabled: true },
{ id: 'session-telemetry-otel', disabled: true },
{ id: 'skill-badge', disabled: false },
{ id: 'modules', disabled: true },
{ id: 'connection', inject: ['webServer'], config: { trustedHosts: [] } },
{ id: 'open-in-app', disabled: true },
@@ -120,10 +121,11 @@ const meta = {
async function dumpAgent(label, agent) {
const assembly = await ctx.systemPrompt.assemble({ agent, scope: agent })
const rendered = renderPrompt(assembly)
// WorkingDirectory 验证实际目录;仅在落盘时将临时路径换为固定夹具路径。
const rendered = renderPrompt(assembly).replaceAll(workspace, FIXTURE_CWD)
await writeFile(join(out, `original-${label}.md`), rendered)
await writeFile(join(out, `sections-${label}.json`), JSON.stringify(
assembly.sections.map(section => ({ name: section.name, text: section.text })),
assembly.sections.map(section => ({ name: section.name, text: section.text.replaceAll(workspace, FIXTURE_CWD) })),
null, 2,
) + '\n')
await writeFile(join(out, `tools-${label}.json`), JSON.stringify(
@@ -142,7 +144,7 @@ let dumpIndex = 0
async function withPreset(id, fn) {
const handle = await ctx.agents.create({
sessionId: SessionId(`dump-${id}-${dumpIndex++}`),
meta: { cwd: FIXTURE_CWD },
meta: { cwd: workspace },
agentOptions: { provider: 'deepseek', model: 'deepseek-chat' },
setup: agentCtx => ctx.agentPresets.mount(agentCtx, id).then(() => undefined),
})
+4 -5
View File
@@ -69,7 +69,6 @@ const overrides = [
{ id: 'webserver', inject: [], config: { host: '127.0.0.1', port: 0 } },
{ id: 'web-runtime', disabled: true },
{ id: 'session-telemetry-otel', disabled: true },
{ id: 'skill-badge', disabled: false },
{ id: 'modules', disabled: true },
{ id: 'connection', inject: ['webServer'], config: { trustedHosts: [] } },
{ id: 'open-in-app', disabled: true },
@@ -127,7 +126,7 @@ function check(label, condition, detail = '') {
}
const AGENT_OPTIONS = { provider: 'deepseek', model: 'deepseek-chat' }
const AGENT_META = { cwd: 'C:\\fixture\\workspace' }
const AGENT_META = { cwd: home }
const agents = new Map()
async function presetAgent(id, suffix = '') {
@@ -303,8 +302,8 @@ try {
check('minimal tools unchanged', minimalAfter.tools === baseline.minimal.tools)
// Deploy preview: the card reads the contract from the same standing scope
// the probes use. A standing scope has no agent, so it binds no {{model}} /
// {{cwd}} and carries none of the agent-only sections (context:file-reference,
// the probes use. A standing scope has no agent, so it binds no {{model}}
// and carries none of the agent-only sections (context:file-reference,
// tool:subagent) — the preview is the contract's placement, not a byte copy of
// a live request. Both facts are pinned here.
console.log('deploy preview')
@@ -315,7 +314,7 @@ try {
const previewPersona = standardPreview.indexOf('You are a coding agent powered by the')
const previewBlock = standardPreview.indexOf(rules.EXECUTION_MODE_BLOCK)
check('preview places the contract behind the persona', previewPersona >= 0 && previewBlock > previewPersona)
check('preview leaves the unbound slots literal', standardPreview.includes('{{model}}') && standardPreview.includes('{{cwd}}'))
check('preview leaves the unbound model slot literal', standardPreview.includes('{{model}}'))
check('the live prompt itself has no literal slots left', !/\{\{\w+\}\}/.test(liveStandard))
// Filling the slots must land on the live prefix: identity, persona, contract.
const filledPreview = standardPreview.replaceAll('{{model}}', 'deepseek-chat').replaceAll('{{cwd}}', AGENT_META.cwd)