mirror of
https://github.com/yexi-by/dsh-unrestricted.git
synced 2026-11-27 10:20:22 +08:00
修复破限插件开机启用时的预设注册竞态
This commit is contained in:
1 parent
25f04e4211
commit
54d4e83569
4 files changed
+37
-6
No files matched your search
@@ -1,6 +1,6 @@
|
||||
# dsh-unrestricted
|
||||
|
||||
当前版本 0.2.0 适配 DSH 0.2.0-rc.2(`639ed01539`)。在侧栏「插件 → 破限模式」打开配置。配置通过本体 ConfigEditor 保存到当前 profile 的 `cordis.patch.yml`,由 volatile Config 热更新。
|
||||
当前版本 0.2.1 适配 DSH 0.2.0-rc.2(`639ed01539`)。在侧栏「插件 → 破限模式」打开配置。配置通过本体 ConfigEditor 保存到当前 profile 的 `cordis.patch.yml`,由 volatile Config 热更新。
|
||||
|
||||
为 DeepSeek Harness(DSH)Web 提供可随时开关的破限提示词。它把一份**交付契约**融合进 Standard、PTC、Cordis、Minimal 及其子代理的最新原版系统提示词;关闭后完全恢复 DSH 官方提示词。开启前可以在设置卡片中预览即将写入的完整提示词。
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
下面的命令把当前版本安装到 DSH 的 `web` profile:
|
||||
|
||||
```sh
|
||||
dsh plugin --profile web add github:yexi-by/dsh-unrestricted#v0.2.0
|
||||
dsh plugin --profile web add github:yexi-by/dsh-unrestricted#v0.2.1
|
||||
```
|
||||
|
||||
安装后重启 `dsh web`,然后进入侧栏 `插件 → 破限模式` 打开开关。开关状态保存在 `~/.dsh/profiles/web/cordis.patch.yml` 的 `id: unrestricted` 条目的 `config.enabled` 中,重启后仍然有效。
|
||||
@@ -48,7 +48,7 @@ DSH 的原版系统提示词规定 agent 身份、计划模式和工具调用方
|
||||
- **Standard / PTC / Cordis**:在运行时通过 `system-prompt/assemble` waterfall 读取当前模式的完整原版提示词,校验关键锚点后插入交付契约与对应机制说明。
|
||||
- **Minimal**:由于原版 persona 使用 `complete: true`,插件用 agent 作用域的同名 persona 覆盖,并保留原 persona 作为开头。
|
||||
- **子代理和 plan 状态**:沿用父模式的融合结果,同时保留结构化输出与 plan 协议。
|
||||
- **提示词校验**:每次融合前核对 harness 身份、各模式 persona、plan 段首句、`run_code` 规则和 structured-output 首句。校验未通过时,该模式保持原版提示词,并在设置卡片中显示具体问题。
|
||||
- **提示词校验**:开机已启用时,等待预设声明注册完成后再校验;每次融合前核对 harness 身份、各模式 persona、plan 段首句、`run_code` 规则和 structured-output 首句。校验未通过时,该模式保持原版提示词,并在设置卡片中显示具体问题。
|
||||
- **预览**:优先返回真实 agent 刚组装的字节;还没有 agent 组装过该模式时退回 preset standing scope,此时 `{{model}}`、`{{cwd}}` 显示为字面占位符。
|
||||
|
||||
详细改写说明见 [最新 DSH 提示词融合说明](docs/prompt-fusion.md)。
|
||||
@@ -107,6 +107,9 @@ node tools/dump-prompts.mjs --repo <deepseek-harness-path> --out tests/fixtures
|
||||
# 组合真实 Web profile,验证开关前后的提示词和工具目录(不调用模型)
|
||||
node tools/verify-live.mjs --repo <deepseek-harness-path>
|
||||
|
||||
# 验证开机已启用时四种预设都能完成融合
|
||||
node tools/verify-live.mjs --repo <deepseek-harness-path> --boot-enabled
|
||||
|
||||
```
|
||||
|
||||
## 目录
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dsh-unrestricted",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"private": true,
|
||||
"description": "Toggleable unrestricted mode for DeepSeek Harness: fuses execution rules into the active standard, ptc, cordis, minimal, and subagent prompts",
|
||||
"license": "MIT",
|
||||
|
||||
+4
-1
@@ -36,7 +36,7 @@ import {
|
||||
export const name = 'dsh-unrestricted'
|
||||
|
||||
/** Services required by this plugin (all host-plane residents of the web profile). */
|
||||
export const inject = ['settings', 'systemPrompt', 'agentPresets']
|
||||
export const inject = ['settings', 'systemPrompt', 'agentPresets', 'loader']
|
||||
|
||||
const RPC_CHANNEL = '/dsh-unrestricted'
|
||||
|
||||
@@ -84,6 +84,8 @@ export function apply(ctx, config) {
|
||||
|
||||
/** 用公开预设挂载接口读取当前配置;临时作用域在组装后释放。 */
|
||||
async function presetAssembly(presetId) {
|
||||
// 预设声明与本插件是并列 Loader 条目;服务可用时,声明仍可能尚未注册。
|
||||
await ctx.loader.await()
|
||||
const key = {}
|
||||
const scope = createScope(ctx, key)
|
||||
try {
|
||||
@@ -350,6 +352,7 @@ export function apply(ctx, config) {
|
||||
})
|
||||
if (state.enabled) onEnable()
|
||||
return () => {
|
||||
state.enabled = false
|
||||
unwatch()
|
||||
clearShadows()
|
||||
}
|
||||
|
||||
+26
-1
@@ -11,9 +11,10 @@
|
||||
* prompt; tools/contexts stay identical; plan mode flips the plan section only
|
||||
* - minimal works for sessions created before AND after the toggle
|
||||
* - toggling back off restores the original prompt everywhere
|
||||
* - enabling in the initial profile waits for preset registration before fusion
|
||||
*
|
||||
* Usage:
|
||||
* node tools/verify-live.mjs --repo <path/to/deepseek-harness>
|
||||
* node tools/verify-live.mjs --repo <path/to/deepseek-harness> [--boot-enabled]
|
||||
*
|
||||
* Read-only against the repo. Requires the repo's `lib/` build outputs.
|
||||
*/
|
||||
@@ -30,6 +31,7 @@ function arg(name) {
|
||||
|
||||
const repo = resolve(arg('repo'))
|
||||
const pluginDir = resolve(fileURLToPath(new URL('..', import.meta.url)))
|
||||
const bootEnabled = process.argv.includes('--boot-enabled')
|
||||
|
||||
async function importPackage(relativeDir) {
|
||||
const manifest = JSON.parse(await readFile(join(repo, relativeDir, 'package.json'), 'utf8'))
|
||||
@@ -86,6 +88,7 @@ const overrides = [
|
||||
},
|
||||
},
|
||||
]
|
||||
if (bootEnabled) overrides.push({ id: 'unrestricted', config: { enabled: true } })
|
||||
|
||||
const installAnchor = join(repo, 'apps/cli/package.json')
|
||||
const profile = {
|
||||
@@ -190,6 +193,28 @@ async function until(label, fn, timeoutMs = 30_000) {
|
||||
}
|
||||
}
|
||||
|
||||
if (bootEnabled) {
|
||||
try {
|
||||
for (const id of ['standard', 'ptc', 'cordis', 'minimal']) {
|
||||
try {
|
||||
await until(`${id} fusion on startup`, async () => {
|
||||
const prompt = await assemblePrompt(await presetAgent(id))
|
||||
return prompt.text.includes(rules.EXECUTION_MODE_BLOCK)
|
||||
}, 3_000)
|
||||
check(`${id} fused when enabled at startup`, true)
|
||||
} catch (error) {
|
||||
check(`${id} fused when enabled at startup`, false, error.message)
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
for (const handle of agents.values()) await handle.dispose()
|
||||
await ctx.fiber.dispose()
|
||||
}
|
||||
if (failures > 0) process.exit(1)
|
||||
console.log('startup-enabled checks passed')
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
try {
|
||||
console.log(`contract fingerprint ${rules.contractFingerprint()}`)
|
||||
console.log('baseline (plugin installed, toggle off)')
|
||||
|
||||
Reference in new issue
Block a user