适配 DSH 0.2.2-alpha.2 并移除旧版兼容

This commit is contained in:
yexi committed 2026-10-28 15:53:51 +08:00
1 parent ab63f682d8
commit 13b6772f16
8 files changed
+15 -370

No files matched your search

+5 -16
View File
@@ -32,7 +32,6 @@
*/
import z from '@deepseek-ai/schemastery'
import { renderPrompt } from '@deepseek-ai/dsh-system-prompt'
import { createScope } from '@deepseek-ai/dsh-scope'
import {
ANCHORS, PRESETS, PRESET_RULES, contractFingerprint, fuseSections, fusedMinimalPrompt, renderPreview,
} from './rules.js'
@@ -90,8 +89,8 @@ export function apply(ctx, config) {
}
/**
* Read the standing assembly of a preset using the registry's scope lease
* (or a temporary mounted scope fallback). In rosterless profiles, assemble
* Read the standing assembly of a preset using the registry's scope lease.
* In rosterless profiles, assemble
* the global host layer directly.
*/
async function presetAssembly(presetId) {
@@ -101,21 +100,11 @@ export function apply(ctx, config) {
if (presets === undefined) {
return await ctx.systemPrompt.assemble({})
}
if (typeof presets.acquireScope === 'function') {
const lease = await presets.acquireScope(presetId)
try {
return await ctx.systemPrompt.assemble({ scope: lease.key })
} finally {
await lease[Symbol.asyncDispose]()
}
}
const key = {}
const scope = createScope(ctx, key)
const lease = await presets.acquireScope(presetId)
try {
await presets.mount(scope.ctx, presetId)
return await ctx.systemPrompt.assemble({ scope: key })
return await ctx.systemPrompt.assemble({ scope: lease.key })
} finally {
await scope.dispose()
await lease[Symbol.asyncDispose]()
}
}
+2 -2
View File
@@ -16,8 +16,8 @@ export const ANCHORS = {
identity: 'You are an AI agent powered by DeepSeek Harness.',
personaStandard: 'You are a coding agent powered by the {{model}} model.',
personaMinimal: 'You are a helpful software engineer assistant.',
// 只识别原生计划模式段;审批条件和完整正文保持官方内容,兼容本机 Desktop 的旧文案。
planPrefix: 'You are in plan mode. Stay in plan mode until ',
// 匹配当前官方计划模式首句;旧版本提示词不在适配范围内。
planPrefix: 'You are in plan mode. Stay in plan mode until the user approves your plan through exit_plan_mode or switches the session mode.',
ptcOnly: '`run_code` is the only tool you can call directly — a tool call naming any other tool fails. Reach every tool the SDK declares below from inside the program.',
structuredOutputPrefix: 'When you have your final answer, you MUST report it by calling the `structured_output` tool',
structuredOutputFull: 'When you have your final answer, you MUST report it by calling the `structured_output` tool with arguments matching its parameter schema exactly. Do not finish with a plain text answer: only the tool call counts as your result.',