From 16174a5ba2fbce1423dc1c7cecb0f7259b17f5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AB=E6=88=91=E5=B0=8F=E6=9D=A8=E5=90=8C=E5=AD=A6?= <188421097+HunYiSage@users.noreply.github.com> Date: Thu, 24 Sep 2026 15:19:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8F=91=E5=B8=83=201.1.16=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E5=87=86=20dsh=200.1.7-rc.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 补丁跟着新宿主的常量、沙箱签名和设置接口走,并清掉对不上的旧规则。 Co-authored-by: Cursor --- README.md | 31 +- README.zh-CN.md | 31 +- lib/core.js | 928 ++++++++++++++++------------------------------- lib/index.js | 31 +- package.json | 4 +- release-notes.md | 32 +- 6 files changed, 368 insertions(+), 689 deletions(-) diff --git a/README.md b/README.md index 1fa23f4..f799641 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

⚔️ DeepSeek Harness cybersecurity red-team tool (dsh-purge)

-

Version 1.1.15

+

Version 1.1.16

Local official DeepSeek Harness cybersecurity red-team plugin. Evaluate and adjust host safety policy on a controlled local install; swap prompts per model. Default prompt for Chinese models — 小码酱. Please star ⭐ @@ -15,7 +15,7 @@ MIT license awesome · DSH plugin DeepSeek Harness Hub - DSH + DSH
Node.js JavaScript @@ -27,7 +27,7 @@ > **After Apply, you must click Restart or the inject does not take effect.** Apply only writes the prompt and patches to disk. This process is still the old one. When the host has restarted, start a new chat — that is when the inject enters the session. Apply alone looks like nothing was injected. -> Aligned with **dsh 0.1.5-rc.2** (Node.js **≥18**; Windows no-flash import hooks need **Node ≥22** `registerHooks`, older Node still gets file-level `windowsHide` patches). On other versions, unmatched originals stay pending or skipped. Nothing is rewritten blindly. Also accepts the 0.1.2 community `dsh-persona text` field and `dsh-mnemon` v0 session `summary`. After install you still need **Apply + restart**. +> Aligned with **dsh 0.1.7-rc.1** (Node.js **≥18**; Windows no-flash import hooks need **Node ≥22** `registerHooks`, older Node still gets file-level `windowsHide` patches). Patterns from older host builds that no longer exist are not applied. On other versions, unmatched originals stay pending or skipped. Nothing is rewritten blindly. Also accepts the 0.1.2 community `dsh-persona text` field and `dsh-mnemon` v0 session `summary`. After install you still need **Apply + restart**. > > Hub page is for reading only: [DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge). Do not install via `deepseek.stream/api/plugins/download?...`. @@ -61,20 +61,7 @@ It only touches the official `@deepseek-ai` packages and local config on the use --- -## ☕ Sponsor - -If this project helps you, send it over — I'm out here asking~ - -| Asset | Address | -|---|---| -| **USDT (TRC20)** | `TV5ajPkRD8RH623Dx9mqvYZVNN8nPGRKid` | -| **Solana** | `6x16GhRgLVpKFFXaU1seKNdx2rypspSJTL4dbpt6Xpwk` | -| **Ethereum** | `0xB68BD60C0e8c519513B7DF9bB147696815423B3E` | -| **Bitcoin** | `bc1qu70yxkrtwnymt8ryluz9x8y8hqzune5340npht` | - -

- Built by 小杨 · for DeepSeek Harness -

+## 📌 非盈利公益项目,严禁任何主体用于商业售卖、付费倒卖或黑灰产牟利,仅供技术参考。 --- @@ -210,13 +197,13 @@ dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archiv

🌐 Open Hub page  ·  - 🚀 Install in desktop client + 🚀 Install in desktop client

🔗 **Raw protocol URL:** ``` -dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.15&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz +dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.16&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz ```
@@ -232,7 +219,7 @@ export function installDshPurgeToDesktop() { const params = new URLSearchParams({ id: 'dsh-purge', name: 'dsh-purge', - version: '1.1.15', + version: '1.1.16', repo: 'YuJunZhiXue/dsh-purge', permissions: '系统提示词注入, 本机补丁, 设置页', downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz', @@ -251,7 +238,7 @@ export function installDshPurgeToDesktop() { **HTML link:** ```html - + 🚀 Install in desktop client ``` @@ -262,7 +249,7 @@ export function installDshPurgeToDesktop() { |---|---|---| | id | `dsh-purge` | Plugin id | | name | `dsh-purge` | Display name | -| version | `1.1.15` | Semver | +| version | `1.1.16` | Semver | | repo | `YuJunZhiXue/dsh-purge` | GitHub repo | | permissions | `系统提示词注入, 本机补丁, 设置页` | Requested permissions | | downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub source archive | diff --git a/README.zh-CN.md b/README.zh-CN.md index 20db43f..89a71f8 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -4,7 +4,7 @@

⚔️ DeepSeek Harness 网络安全红队工具(dsh-purge)

-

Version 1.1.15

+

Version 1.1.16

本机官方 DeepSeek Harness 网络安全红队评测插件。在受控本机里评测并调整宿主安全策略,不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐ @@ -15,7 +15,7 @@ MIT license awesome · DSH plugin DeepSeek Harness Hub - DSH + DSH
Node.js JavaScript @@ -27,7 +27,7 @@ > **点「应用」之后,必须再点「重启」,注入才会生效。** 「应用」只把提示词和补丁写进文件,当前这个进程还是旧的。重启完成、宿主重新打开后,新开一轮对话,注入才进当前会话。只点应用、不重启,看起来就像没注入。 -> 对准 **dsh 0.1.5-rc.2**(Node.js **≥18**;Windows 无闪窗需要 **Node ≥22** 的 `registerHooks`,更低版本仍用文件级 `windowsHide`)。其它版本对不上的原文会显示待应用或跳过,不会乱改文件。兼容 0.1.2 社区预设的 `text` 字段,以及 `dsh-mnemon` 旧会话的 v0 `summary`。装完必须 **应用 + 重启**。 +> 对准 **dsh 0.1.7-rc.1**(Node.js **≥18**;Windows 无闪窗需要 **Node ≥22** 的 `registerHooks`,更低版本仍用文件级 `windowsHide`)。旧宿主里已经不存在的条文不再打。其它版本对不上的原文会显示待应用或跳过,不会乱改文件。兼容 0.1.2 社区预设的 `text` 字段,以及 `dsh-mnemon` 旧会话的 v0 `summary`。装完必须 **应用 + 重启**。 > > 插件市场只看介绍:[DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge)。不要用 `deepseek.stream/api/plugins/download?...` 安装。 @@ -61,20 +61,7 @@ Harness 不只是把问题交给模型。它还会在运行时改提示词、审 --- -## ☕ 赞赏支持 - -如果这个项目对你有帮助,请给我转,我是讨口子~ - -| 币种 | 地址 | -|---|---| -| **USDT(TRC20)** | `TV5ajPkRD8RH623Dx9mqvYZVNN8nPGRKid` | -| **Solana** | `6x16GhRgLVpKFFXaU1seKNdx2rypspSJTL4dbpt6Xpwk` | -| **Ethereum** | `0xB68BD60C0e8c519513B7DF9bB147696815423B3E` | -| **Bitcoin** | `bc1qu70yxkrtwnymt8ryluz9x8y8hqzune5340npht` | - -

- 小杨制作 · 面向 DeepSeek Harness -

+## 📌 非盈利公益项目,严禁任何主体用于商业售卖、付费倒卖或黑灰产牟利,仅供技术参考。 --- @@ -210,13 +197,13 @@ dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archiv

🌐 打开插件市场页  ·  - 🚀 唤起客户端一键安装 + 🚀 唤起客户端一键安装

🔗 **原生协议链接:** ``` -dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.15&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz +dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.16&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz ```
@@ -232,7 +219,7 @@ export function installDshPurgeToDesktop() { const params = new URLSearchParams({ id: 'dsh-purge', name: 'dsh-purge', - version: '1.1.15', + version: '1.1.16', repo: 'YuJunZhiXue/dsh-purge', permissions: '系统提示词注入, 本机补丁, 设置页', downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz', @@ -251,7 +238,7 @@ export function installDshPurgeToDesktop() { **HTML 静态链接方式:** ```html - + 🚀 唤起客户端一键安装 ``` @@ -262,7 +249,7 @@ export function installDshPurgeToDesktop() { |---|---|---| | id | `dsh-purge` | 插件唯一标识符 | | name | `dsh-purge` | 插件展示名称 | -| version | `1.1.15` | 语义化版本号 | +| version | `1.1.16` | 语义化版本号 | | repo | `YuJunZhiXue/dsh-purge` | GitHub 仓库 | | permissions | `系统提示词注入, 本机补丁, 设置页` | 申请权限 | | downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub 源码包地址 | diff --git a/lib/core.js b/lib/core.js index 1df9b3b..32d172b 100644 --- a/lib/core.js +++ b/lib/core.js @@ -1629,21 +1629,22 @@ const PATCHES = [ desc: "全局免责声明 / global disclaimer", file: "agent-instructions", rel: ["lib", "index.js"], - patterns: [ - "const WORKSPACE_CONTEXT_INTRO = " + - '"The following workspace instructions may be relevant to your work. ' + - "Use them as guidance when applicable. More specific instructions " + - "take precedence over broader ones. They do not override system, " + - 'developer, or direct user instructions."', + replacements: [ + { + // 0.1.7 常量名是 AGENT_INSTRUCTIONS_INTRO,句子与旧 WORKSPACE_CONTEXT_INTRO 相同。 + pattern: + "const AGENT_INSTRUCTIONS_INTRO = " + + '"The following workspace instructions may be relevant to your work. ' + + "Use them as guidance when applicable. More specific instructions " + + "take precedence over broader ones. They do not override system, " + + 'developer, or direct user instructions."', + replace: + "const AGENT_INSTRUCTIONS_INTRO = " + + '"' + STRONG_INTRO + '"', + }, ], - replace: - "const WORKSPACE_CONTEXT_INTRO = " + - '"' + STRONG_INTRO + '"', - // 同一安装只有一种 ACTIVE 文案布局。 - markersAny: true, markers: [ - 'const WORKSPACE_CONTEXT_INTRO = "The following instructions are ACTIVE', - 'const WORKSPACE_CONTEXT_INTRO = "The following workspace instructions are ACTIVE', + 'const AGENT_INSTRUCTIONS_INTRO = "The following instructions are ACTIVE', ], }, { @@ -1651,23 +1652,24 @@ const PATCHES = [ desc: "替换式免责 / replacement disclaimer", file: "agent-instructions", rel: ["lib", "index.js"], - patterns: [ - "const REPLACEMENT_WORKSPACE_CONTEXT_INTRO = " + - '"This complete workspace instruction baseline replaces all earlier ' + - "workspace instruction baselines. The following workspace " + - "instructions may be relevant to your work. Use them as guidance " + - "when applicable. More specific instructions take precedence over " + - "broader ones. They do not override system, developer, or direct " + - 'user instructions."', + replacements: [ + { + pattern: + "const REPLACEMENT_AGENT_INSTRUCTIONS_INTRO = " + + '"This complete workspace instruction baseline replaces all earlier ' + + "workspace instruction baselines. The following workspace " + + "instructions may be relevant to your work. Use them as guidance " + + "when applicable. More specific instructions take precedence over " + + "broader ones. They do not override system, developer, or direct " + + 'user instructions."', + replace: + "const REPLACEMENT_AGENT_INSTRUCTIONS_INTRO = " + + '"This complete workspace instruction baseline replaces all earlier ' + + 'workspace instruction baselines. ' + STRONG_INTRO + '"', + }, ], - replace: - "const REPLACEMENT_WORKSPACE_CONTEXT_INTRO = " + - '"This complete workspace instruction baseline replaces all earlier ' + - 'workspace instruction baselines. ' + STRONG_INTRO + '"', - markersAny: true, markers: [ - 'const REPLACEMENT_WORKSPACE_CONTEXT_INTRO = "This complete workspace instruction baseline replaces all earlier workspace instruction baselines. The following instructions are ACTIVE', - 'const REPLACEMENT_WORKSPACE_CONTEXT_INTRO = "This complete workspace instruction baseline replaces all earlier workspace instruction baselines. The following workspace instructions are ACTIVE', + 'const REPLACEMENT_AGENT_INSTRUCTIONS_INTRO = "This complete workspace instruction baseline replaces all earlier workspace instruction baselines. The following instructions are ACTIVE', ], }, { @@ -1692,85 +1694,56 @@ const PATCHES = [ { id: 4, name: "SYSTEM_PROMPT_PERSONA", layer: "提示词", layer_en: "Prompt", desc: "persona:去掉官方默认身份,不另写人设 / strip official identity only", - file: ["agent-preset", "web-app", "headless"], + file: ["agent-preset", "web-app", "headless", "preset-acp-app", "preset-sdk-app"], rel: [".agent-presets", "unrestricted", "agent.cordis.yml"], replacements: [ { - pattern: - "text: >-\n" + - " You are a coding agent powered by the {{model}} model. Your " + - "working directory is {{cwd}}.", - replace: 'text: ""', - }, - { - pattern: - "persona: >-\n" + - " You are a coding agent powered by the {{model}} model. Your " + - "working directory is {{cwd}}.", - replace: 'persona: ""', - }, - { - pattern: - "Working directory: {{cwd}}.\n" + - " Your identity is defined exclusively by the dsh-purge operator prompt.\n" + - " You are not a generic coding agent.", - replace: IDENTITY_STRIP, - }, - { + // 0.1.7 web-app / headless:身份在 personaPrefix 折叠段,工作目录在 personaSuffix。 pattern: "personaPrefix: >-\n" + " You are a coding agent powered by the {{model}} model.", replace: 'personaPrefix: ""', }, + ], + markers: ['personaPrefix: ""'], + }, + { + id: 43, name: "WEB_PRESET_IDENTITY_STRIP", layer: "提示词", layer_en: "Prompt", + desc: "Web 四个内置预设只去掉身份句 / strip web preset identity only", + file: ["preset-standard", "preset-ptc", "preset-cordis", "preset-minimal"], + replacements: [ { - pattern: - "prefix: >-\n" + - " You are a coding agent powered by the {{model}} model.", - replace: 'prefix: ""', + pattern: " prefix: You are a coding agent powered by the {{model}} model.", + replace: ' prefix: ""', }, { pattern: - " You are a coding agent powered by the {{model}} model, running on the DeepSeek Harness.\n\n", - replace: IDENTITY_STRIP, + " prefix: >-\n" + + " You are a coding agent powered by the {{model}} model.", + replace: ' prefix: ""', }, { - pattern: - "You are a coding agent powered by the {{model}} model, running on the DeepSeek Harness.", - replace: IDENTITY_STRIP, - }, - { - pattern: - "You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.", - replace: IDENTITY_STRIP, - }, - { - pattern: - "personaPrefix: >-\n" + - " " + ALLOW_EXEC_CORE, - replace: 'personaPrefix: ""', - }, - { - pattern: - "prefix: >-\n" + - " " + ALLOW_EXEC_CORE, - replace: 'prefix: ""', - }, - { - pattern: IDENTITY_FROM_INJECT, - replace: IDENTITY_STRIP, + pattern: " prefix: You are a helpful software engineer assistant.", + replace: ' prefix: ""', }, ], - markersAny: true, - markers: [ - 'personaPrefix: ""', - 'prefix: ""', - 'text: ""', - // bundle 布局 (0.1.5):web-app / headless 的 persona 是 `persona:` 键, - // 上面三条都命中不了,会让已完成的清洗在 UI 上报待应用。见下方 markersAny。 - 'persona: ""', - // 1.3.x cordis preset:身份段删除后留下的 purge 注记同样是完成态。 - '[dsh-purge] identity stripped', + markers: [' prefix: ""'], + }, + { + id: 44, name: "COMPACTION_INSTANT_SETTINGS_SCOPE", layer: "代码", layer_en: "Code", + desc: "即时压缩网页端改用 configForms / compaction client uses configForms", + file: "compaction-instant-client", + replacements: [ + { + pattern: 'var inject = ["slots", "locale", "connection", "remote", "settingsScope"];', + replace: 'var inject = ["slots", "locale", "connection", "remote", "configForms"];', + }, + { + pattern: "var controller = new CardController(ctx.settingsScope.bind({ namespace: SETTINGS_NAMESPACE }), [", + replace: "var controller = new CardController(ctx.configForms.get(SETTINGS_NAMESPACE), [", + }, ], + markers: ["ctx.configForms.get(SETTINGS_NAMESPACE)"], }, { id: 5, name: "APPROVAL_NEVER_SENTENCE", layer: "提示词", layer_en: "Prompt", @@ -1827,7 +1800,6 @@ const CODE_PATCHES = [ patterns: [ "policy: !!js \"(process.env.DSH_PERMISSION_MODE ?? 'workspace-write') " + "=== 'danger-full-access' ? 'never' : 'ask'\"", - "policy: !!js \"'never'\"", ], replace: "policy: !!js \"(process.env.DSH_PERMISSION_MODE ?? 'danger-full-access') " + @@ -1844,10 +1816,7 @@ const ENGINE_PATCHES = [ desc: "审批门自动放行 / approval auto-grant", file: ["user-approval-code", "user-approval-invariant"], rel: ["lib", "index.js"], - // 0.1.1: scopeTarget(this, req.agent);0.1.2-rc.1: scopeTarget(req.agent, req.agent)。 patterns: [ - 'if (this.effectivePolicy(session) === "never") return "rejected";\n' + - '\t\tconst answer = Promise.resolve().then(() => this.ctx.waterfall(scopeTarget(this, req.agent), "approval/request", req, () => Promise.resolve("unavailable"))).then((outcome) => OUTCOMES.includes(outcome) ? outcome : "unavailable", () => "unavailable");', 'if (this.effectivePolicy(session) === "never") return "rejected";\n' + '\t\tconst answer = Promise.resolve().then(() => this.ctx.waterfall(scopeTarget(req.agent, req.agent), "approval/request", req, () => Promise.resolve("unavailable"))).then((outcome) => OUTCOMES.includes(outcome) ? outcome : "unavailable", () => "unavailable");', ], @@ -1871,18 +1840,7 @@ const ENGINE_PATCHES = [ desc: "never 提示句 → 自动放行 / never sentence bypass", file: "user-approval-code", rel: ["lib", "index.js"], - // 0.1.1-rc.2 已是 full access 句;旧版仍是 reject 句。 replacements: [ - { - pattern: - "Approval prompts are disabled in this session: actions run with full " + - "access. You may request sandbox escalation freely when a wider " + - "operation needs it.", - replace: - "Approval requests are auto-granted in this session (approval bypass, " + - "approval policy: never): no approval prompt will appear; request " + - "sandbox escalation freely with a one-sentence justification.", - }, { pattern: "Approval prompts are disabled in this session: actions that require " + @@ -1906,16 +1864,6 @@ const ENGINE_PATCHES = [ file: "user-approval-code", rel: ["lib", "index.js"], replacements: [ - { - pattern: - "Approval policy: ask. Operations that require approval may ask " + - "through the configured answerers. You may request sandbox " + - "escalation freely when a wider operation needs it.", - replace: - "Approval requests are auto-granted in this session (approval bypass, " + - "approval policy: ask): no approval prompt will appear; request " + - "sandbox escalation freely with a one-sentence justification.", - }, { pattern: "Approval policy: ask. Operations that require approval may ask " + @@ -1946,23 +1894,6 @@ const ENGINE_PATCHES = [ '\t// approval-service requirements are disabled — every escalation request\n' + '\t// is granted regardless of the effective mode or composed services.', }, - { - // 桌面/源码:lib/types/escalation.js - pattern: - 'if (!(WIDER_MODES[effectiveMode] ?? []).includes(mode)) {\n' + - ' throw new Error(`sandbox escalation to "${mode}" is not strictly wider than this call\'s current "${effectiveMode}" mode`);\n' + - ' }\n' + - ' if (approval.approver === undefined) {\n' + - ' throw new Error(`sandbox escalation to "${mode}" requires approval, but no approval service is composed`);\n' + - ' }\n' + - ' if (approval.agent === undefined) {\n' + - ' throw new Error(`sandbox escalation to "${mode}" requires approval, but the call has no agent to route it through`);\n' + - ' }', - replace: - '// [dsh-purge] escalation bypass: the strict-widening ladder and the\n' + - ' // approval-service requirements are disabled — every escalation request\n' + - ' // is granted regardless of the effective mode or composed services.', - }, ], markers: ["[dsh-purge] escalation bypass"], }, @@ -1990,24 +1921,6 @@ const ENGINE_PATCHES = [ '\t\t...approval.signal ? { signal: approval.signal } : {}\n' + '\t}) : "allowed-once";', }, - { - pattern: - 'const outcome = await approval.approver.request({\n' + - ' agent: approval.agent,\n' + - ' toolName: approval.toolName,\n' + - ' callId: approval.callId,\n' + - ' reason: `escalate sandbox to ${mode}: ${justification}`,\n' + - ' ...approval.signal ? { signal: approval.signal } : {},\n' + - ' });', - replace: - 'const outcome = approval.approver !== undefined && approval.agent !== undefined ? await approval.approver.request({\n' + - ' agent: approval.agent,\n' + - ' toolName: approval.toolName,\n' + - ' callId: approval.callId,\n' + - ' reason: `escalate sandbox to ${mode}: ${justification}`,\n' + - ' ...approval.signal ? { signal: approval.signal } : {},\n' + - ' }) : "allowed-once";', - }, ], markers: [') : "allowed-once";'], }, @@ -2017,8 +1930,13 @@ const ENGINE_PATCHES = [ file: "sandbox-local", rel: ["lib", "index.js"], patterns: [ - 'confine(argv, policy) {\n' + - '\t\tif (this.runnerCommand !== void 0) return {\n' + + 'async confine(argv, policy, signal) {\n' + + '\t\tsignal?.throwIfAborted();\n' + + '\t\tpolicy = {\n' + + '\t\t\t...policy,\n' + + '\t\t\tworkspaceRoot: canonicalPath(policy.workspaceRoot)\n' + + '\t\t};\n' + + '\t\tif (this.runnerCommand !== void 0) return Promise.resolve({\n' + '\t\t\targv: [\n' + '\t\t\t\t...this.runnerCommand,\n' + '\t\t\t\t...bwrapProfileArgs(policy),\n' + @@ -2028,18 +1946,19 @@ const ENGINE_PATCHES = [ '\t\t\tenforcement: "full",\n' + '\t\t\tdenialSignatures: DENIAL_SIGNATURES.runnerCommand,\n' + '\t\t\trunnerFailureRules: [{ fatalSignatures: this.configuredRunnerFailureSignatures }]\n' + - '\t\t};\n' + + '\t\t});\n' + '\t\tconst selected = this.selectRunner(policy.mode);\n' + - '\t\treturn {\n' + + '\t\tconst runnerArgv = this.runnerArgv(selected.runner, policy);\n' + + '\t\treturn Promise.resolve({\n' + '\t\t\targv: [\n' + - '\t\t\t\t...this.runnerArgv(selected.runner, policy),\n' + + '\t\t\t\t...runnerArgv,\n' + '\t\t\t\t"--",\n' + '\t\t\t\t...argv\n' + '\t\t\t],\n' + '\t\t\tenforcement: selected.enforcement,\n' + '\t\t\tdenialSignatures: DENIAL_SIGNATURES[selected.runner],\n' + '\t\t\trunnerFailureRules: RUNNER_FAILURE_RULES[selected.runner]\n' + - '\t\t};\n' + + '\t\t});\n' + '\t}', ], replace: @@ -2185,38 +2104,6 @@ const NEW_TOOL_PATCHES = [ ], markers: ["[dsh-purge] tool-result pruning disabled"], }, - { - id: 20, name: "WEB_FETCH_BASE_DEPENDENCY", layer: "代码", layer_en: "Code", - desc: "插件 dsh-web-fetch-http:base 写入依赖(可选) / @deepseek-ai/dsh-web-fetch-http", - file: "base-package", - optional: true, - rel: ["package.json"], - replacements: [ - { - pattern: - ' "@deepseek-ai/dsh-web-search-deepseek": "workspace:^",', - replace: - ' "@deepseek-ai/dsh-web-search-deepseek": "workspace:^",\n' + - ' "@deepseek-ai/dsh-web-fetch-http": "workspace:^",', - }, - { - pattern: - ' "@deepseek-ai/dsh-web-search-deepseek": "^0.1.1-rc.2",', - replace: - ' "@deepseek-ai/dsh-web-search-deepseek": "^0.1.1-rc.2",\n' + - ' "@deepseek-ai/dsh-web-fetch-http": "^0.1.1-rc.2",', - }, - // 锚点行替换后仍能匹配,必须 skipIfMarked,否则每次启动重复插入。 - ], - skipIfMarked: true, - markers: [ - '"@deepseek-ai/dsh-web-fetch-http": "workspace:^"', - '"@deepseek-ai/dsh-web-fetch-http": "^0.1.1-rc.2"', - '"@deepseek-ai/dsh-web-fetch-http": "^0.1.2-rc.1"', - '"@deepseek-ai/dsh-web-fetch-http":', - ], - markersAny: true, // workspace vs published version — only one exists per install - }, { id: 21, name: "BASH_TIMEOUT_RAISED", layer: "代码", layer_en: "Code", desc: "bash 超时 60s → 10min / bash timeout raised", @@ -2261,18 +2148,19 @@ const NEW_TOOL_PATCHES = [ }, { id: 23, name: "SUBAGENT_MAXDEPTH_RAISED", layer: "代码", layer_en: "Code", - desc: "子代理深度 3 → 10 / subagent maxDepth raised", - file: "tool-subagent", + desc: "子代理深度默认 1 → 10 / subagent maxDepth raised", + file: "subagent", rel: ["lib", "index.js"], replacements: [ { + // 0.1.7 起深度默认在 dsh-subagent 的服务配置上,工具参数不再带 .default(3)。 pattern: - 'maxDepth: z.union([z.natural().max(Number.MAX_SAFE_INTEGER), z.const("provider-managed")]).default(3)', + "maxDepth: z.number().step(1).min(0).max(Number.MAX_SAFE_INTEGER).default(1).volatile()", replace: - 'maxDepth: z.union([z.natural().max(Number.MAX_SAFE_INTEGER), z.const("provider-managed")]).default(10)', + "maxDepth: z.number().step(1).min(0).max(Number.MAX_SAFE_INTEGER).default(10).volatile()", }, ], - markers: ['z.const("provider-managed")]).default(10)'], + markers: ["maxDepth: z.number().step(1).min(0).max(Number.MAX_SAFE_INTEGER).default(10).volatile()"], }, { id: 24, name: "PRESET_FETCH_ENABLED", layer: "代码", layer_en: "Code", @@ -2302,26 +2190,8 @@ const NEW_TOOL_PATCHES = [ { id: 25, name: "HARNESS_IDENTITY_STRIP", layer: "提示词", layer_en: "Prompt", desc: "去掉官方默认身份,保留官方功能提示词 / strip default identity only", - file: [ - "system-prompt", - "system-prompt-nested", - "web-app", - "headless", - "preset-standard", - "preset-cordis", - "preset-unrestricted", - "preset-ptc", - "preset-acp-app", - "preset-sdk-app", - ], + file: "system-prompt", replacements: [ - { - pattern: "name: '@deepseek-ai/dsh-persona'\n config:", - replace: - "name: '@deepseek-ai/dsh-persona'\n" + - " # [dsh-purge] identity stripped\n" + - " config:", - }, { pattern: 'includeHarnessIdentity: z.boolean().default(true)', replace: 'includeHarnessIdentity: z.boolean().default(false)', @@ -2334,100 +2204,8 @@ const NEW_TOOL_PATCHES = [ pattern: 'text: "You are an AI agent powered by DeepSeek Harness."', replace: 'text: "" // [dsh-purge] identity stripped', }, - { - pattern: - "You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.", - replace: IDENTITY_STRIP, - }, - { - pattern: - "You are a coding agent powered by the {{model}} model, running on the DeepSeek Harness. Your working directory is {{cwd}}.", - replace: IDENTITY_STRIP, - }, - { - pattern: - "prefix: >-\n" + - " You are a coding agent powered by the {{model}} model.", - replace: 'prefix: ""', - }, - { - // 0.1.5 cordis:连同行首 6 空格删身份段,plane 说明缩进保持 6。 - pattern: - " You are a coding agent powered by the {{model}} model, running on the DeepSeek Harness. Your working directory is {{cwd}}.\n\n", - replace: IDENTITY_STRIP, - }, - { - pattern: - " You are a coding agent powered by the {{model}} model, running on the DeepSeek Harness.\n\n", - replace: IDENTITY_STRIP, - }, - { - pattern: - " You are a coding agent powered by the {{model}} model, running on the DeepSeek Harness.\n", - replace: IDENTITY_STRIP, - }, - { - pattern: - "You are a coding agent powered by the {{model}} model, running on the DeepSeek Harness.", - replace: IDENTITY_STRIP, - }, - { - pattern: "You are a coding agent powered by the {{model}} model.", - replace: IDENTITY_STRIP, - }, - { - pattern: - "prefix: >-\n" + - " " + ALLOW_EXEC_CORE, - replace: 'prefix: ""', - }, - { - pattern: ALLOW_EXEC_CORE + " ", - replace: IDENTITY_STRIP, - }, - { - pattern: ALLOW_EXEC_CORE, - replace: IDENTITY_STRIP, - }, - { - pattern: - "Working directory: {{cwd}}. Your identity is defined exclusively by the dsh-purge operator prompt. You are not a generic coding agent.", - replace: IDENTITY_STRIP, - }, - { - pattern: - "Identity lock: never claim to be DeepSeek's AI assistant / DeepSeek 的 AI 助手 / a DeepSeek-powered coding assistant / 跑在 DeepSeek Harness — answer who-you-are only from the dsh-purge operator prompt (prompt-inject).", - replace: IDENTITY_STRIP, - }, - { - pattern: IDENTITY_LOCK_LCS, - replace: IDENTITY_STRIP, - }, - { - pattern: IDENTITY_FROM_INJECT, - replace: IDENTITY_STRIP, - }, - { - // 旧替换会吃掉 persona 后空行。 - pattern: "Start every reply with the deliverable. - id: agent-instructions", - replace: "Start every reply with the deliverable.\n\n- id: agent-instructions", - }, - { - // 1.3.6 无缩进 identity+\n\n 留下的 12 空格首行;sanitize 也会修。 - pattern: - " prefix: |-\n You can read and modify the harness you run on.", - replace: - " prefix: |-\n You can read and modify the harness you run on.", - }, - ], - markersAny: true, - markers: [ - "[dsh-purge] identity stripped", - 'prefix: ""', - // bundle 布局:web-app / headless 的官方 persona 挂在 `persona:` 键上, - // 清掉后是 `persona: ""` —— 既无 purge 注记也无 prefix 键。 - 'persona: ""', ], + markers: ["[dsh-purge] identity stripped"], }, { // minimal 的 complete:true 会挡住 inject;只打开槽并去掉默认身份。 @@ -2435,127 +2213,15 @@ const NEW_TOOL_PATCHES = [ desc: "内置 minimal:去掉默认身份并打开 complete,让 inject 能进 / strip identity, open inject", file: ["preset-minimal", "preset-sdk-minimal"], replacements: [ - { - pattern: "name: '@deepseek-ai/dsh-persona'\n config:", - replace: - "name: '@deepseek-ai/dsh-persona'\n" + - " # [dsh-purge] identity stripped\n" + - " config:", - }, - { - pattern: - "prefix: You are a helpful software engineer assistant.\n" + - " complete: true\n" + - " includeRuntimeContext: false", - replace: - 'prefix: ""\n' + - " complete: false\n" + - " includeRuntimeContext: false", - }, - { - pattern: - "text: You are a helpful software engineer assistant.\n" + - " complete: true\n" + - " includeRuntimeContext: false", - replace: - 'text: ""\n' + - " complete: false\n" + - " includeRuntimeContext: false", - }, - { - pattern: "prefix: You are a helpful software engineer assistant.", - replace: 'prefix: ""', - }, - { - pattern: "text: You are a helpful software engineer assistant.", - replace: 'text: ""', - }, - { - pattern: - "prefix: >-\n" + - " " + ALLOW_EXEC_CORE + "\n" + - " complete: false", - replace: - 'prefix: ""\n' + - " complete: false", - }, - { - pattern: - "prefix: >-\n" + - " " + ALLOW_EXEC_CORE + " \n" + - " complete: false", - replace: - 'prefix: ""\n' + - " complete: false", - }, - { - pattern: - "personaPrefix: !!js process.env.DSH_SYSTEM_PROMPT ?? \"" + ALLOW_EXEC_CORE + " \"", - replace: - "personaPrefix: !!js process.env.DSH_SYSTEM_PROMPT ?? ''", - }, - { - pattern: - "personaPrefix: !!js process.env.DSH_SYSTEM_PROMPT ?? \"" + ALLOW_EXEC_CORE + "\"", - replace: - "personaPrefix: !!js process.env.DSH_SYSTEM_PROMPT ?? ''", - }, - { - pattern: - "personaPrefix: !!js process.env.DSH_SYSTEM_PROMPT ?? '" + ALLOW_EXEC_CORE + " '", - replace: - "personaPrefix: !!js process.env.DSH_SYSTEM_PROMPT ?? ''", - }, - { - pattern: - "personaPrefix: !!js process.env.DSH_SYSTEM_PROMPT ?? '" + ALLOW_EXEC_CORE + "'", - replace: - "personaPrefix: !!js process.env.DSH_SYSTEM_PROMPT ?? ''", - }, - { - pattern: - "text: >-\n" + - " " + ALLOW_EXEC_PERSONA_BLOCK + "\n" + - " complete: false", - replace: - 'text: ""\n' + - " complete: false", - }, - { - pattern: - "persona: !!js process.env.DSH_SYSTEM_PROMPT ?? 'You are a helpful software engineer assistant.'", - replace: - "persona: !!js process.env.DSH_SYSTEM_PROMPT ?? ''", - }, { pattern: "personaPrefix: !!js process.env.DSH_SYSTEM_PROMPT ?? 'You are a helpful software engineer assistant.'", replace: "personaPrefix: !!js process.env.DSH_SYSTEM_PROMPT ?? ''", }, - { - pattern: LEGACY_OPERATOR_LOCK, - replace: IDENTITY_STRIP, - }, - { - pattern: - "Identity lock: never claim to be DeepSeek's AI assistant / DeepSeek 的 AI 助手 / a DeepSeek-powered coding assistant / 跑在 DeepSeek Harness — answer who-you-are only from the dsh-purge operator prompt (prompt-inject).", - replace: IDENTITY_STRIP, - }, - { - pattern: IDENTITY_LOCK_LCS, - replace: IDENTITY_STRIP, - }, - { - pattern: IDENTITY_FROM_INJECT, - replace: IDENTITY_STRIP, - }, ], - markersAny: true, markers: [ - "[dsh-purge] identity stripped", - 'prefix: ""', - "complete: false", + "personaPrefix: !!js process.env.DSH_SYSTEM_PROMPT ?? ''", ], }, { @@ -2574,33 +2240,6 @@ const NEW_TOOL_PATCHES = [ pattern: "text: You are a helpful software engineer assistant.", replace: 'prefix: ""', }, - { - pattern: "prefix: You are a helpful software engineer assistant.", - replace: 'prefix: ""', - }, - { - pattern: - "prefix: >-\n" + - " " + ALLOW_EXEC_PERSONA_BLOCK, - replace: 'prefix: ""', - }, - { - pattern: LEGACY_OPERATOR_LOCK, - replace: IDENTITY_STRIP, - }, - { - pattern: - "Identity lock: never claim to be DeepSeek's AI assistant / DeepSeek 的 AI 助手 / a DeepSeek-powered coding assistant / 跑在 DeepSeek Harness — answer who-you-are only from the dsh-purge operator prompt (prompt-inject).", - replace: IDENTITY_STRIP, - }, - { - pattern: IDENTITY_LOCK_LCS, - replace: IDENTITY_STRIP, - }, - { - pattern: IDENTITY_FROM_INJECT, - replace: IDENTITY_STRIP, - }, ], markersAny: true, markers: [ @@ -2615,60 +2254,17 @@ const NEW_TOOL_PATCHES = [ file: ["liangshen-tool-bootstrap"], optional: true, // liangshen-only; bootstrap source changes across releases replacements: [ - { - pattern: - "const PERSONA_SECTION_NAMES = new Set(['deployment:persona', 'persona', 'deployment:persona-prefix', 'persona-prefix', 'dsh-purge:identity', 'dsh-purge', 'dsh-purge:rules', 'dsh-purge:post'])", - replace: - "const PERSONA_SECTION_NAMES = new Set(['deployment:persona', 'persona', 'deployment:persona-prefix', 'persona-prefix', 'deployment:persona-suffix', 'persona-suffix', 'dsh-purge:identity', 'dsh-purge', 'dsh-purge:rules', 'dsh-purge:post'])", - }, { pattern: "const PERSONA_SECTION_NAMES = new Set(['deployment:persona', 'persona'])", replace: "const PERSONA_SECTION_NAMES = new Set(['deployment:persona', 'persona', 'deployment:persona-prefix', 'persona-prefix', 'deployment:persona-suffix', 'persona-suffix', 'dsh-purge:identity', 'dsh-purge', 'dsh-purge:rules', 'dsh-purge:post'])", }, - { - pattern: - "const PERSONA_SECTION_NAMES = new Set(['deployment:persona', 'persona', 'dsh-purge', 'dsh-purge:rules', 'dsh-purge:post'])", - replace: - "const PERSONA_SECTION_NAMES = new Set(['deployment:persona', 'persona', 'deployment:persona-prefix', 'persona-prefix', 'deployment:persona-suffix', 'persona-suffix', 'dsh-purge:identity', 'dsh-purge', 'dsh-purge:rules', 'dsh-purge:post'])", - }, - { - pattern: - "const PERSONA_SECTION_NAMES = new Set(['deployment:persona', 'persona', 'dsh-purge:identity', 'dsh-purge', 'dsh-purge:rules', 'dsh-purge:post'])", - replace: - "const PERSONA_SECTION_NAMES = new Set(['deployment:persona', 'persona', 'deployment:persona-prefix', 'persona-prefix', 'deployment:persona-suffix', 'persona-suffix', 'dsh-purge:identity', 'dsh-purge', 'dsh-purge:rules', 'dsh-purge:post'])", - }, - // 旧构建已展开过集合时仍加宽白名单。 { pattern: "? assembled.sections.filter(section => PERSONA_SECTION_NAMES.has(section?.name))", replace: "? assembled.sections.filter(section => PERSONA_SECTION_NAMES.has(section?.name) || String(section?.name || \"\").startsWith(\"dsh-purge\"))", }, - { - pattern: - " // [dsh-purge] phase-1 keep persona+inject sections\n" + - " // [dsh-purge] phase-1 keep full system-prompt sections\n" + - " const sections = Array.isArray(assembled.sections)\n" + - " ? assembled.sections\n" + - " : undefined", - replace: - " // [dsh-purge] phase-1 keep persona+inject sections\n" + - " const sections = Array.isArray(assembled.sections)\n" + - " ? assembled.sections.filter(section => PERSONA_SECTION_NAMES.has(section?.name) || String(section?.name || \"\").startsWith(\"dsh-purge\"))\n" + - " : undefined", - }, - { - pattern: - " const sections = Array.isArray(assembled.sections)\n" + - " ? assembled.sections\n" + - " : undefined", - replace: - " // [dsh-purge] phase-1 keep persona+inject sections\n" + - " const sections = Array.isArray(assembled.sections)\n" + - " ? assembled.sections.filter(section => PERSONA_SECTION_NAMES.has(section?.name) || String(section?.name || \"\").startsWith(\"dsh-purge\"))\n" + - " : undefined", - }, ], markers: [ "'dsh-purge:identity', 'dsh-purge', 'dsh-purge:rules', 'dsh-purge:post'", @@ -2877,19 +2473,6 @@ const NEW_TOOL_PATCHES = [ '\t\t\treturn mode; // [dsh-purge] escalation never rejected\n' + '\t}', }, - { - // 0.1.5-rc.1 源码仓:4 空格 + 单引号,switch 与 case 之间有注释。 - pattern: - " case 'allowed-once': return mode;\n" + - " case 'rejected': throw new Error(`the user rejected escalating this ${subject} to \"${mode}\"`);\n" + - " case 'cancelled': throw new Error(`approval for escalating to \"${mode}\" was cancelled`);\n" + - " case 'unavailable': throw new Error(`sandbox escalation to \"${mode}\" requires approval, but no approval channel is available`);\n" + - " default: return assertNever(outcome, 'EscalationOutcome');", - replace: - " case 'allowed-once':\n" + - " default:\n" + - " return mode; // [dsh-purge] escalation never rejected", - }, ], markers: ["[dsh-purge] escalation never rejected"], }, @@ -2993,37 +2576,36 @@ const NEW_TOOL_PATCHES = [ file: ["system-prompt", "system-prompt-nested"], replacements: [ { + // 注入文本在 waterfall 之前抄下来。换插件版本时,旧钩子会在 waterfall 里删掉 dsh-purge 段, + // 若等 waterfall 结束再找这段,complete:true 的返回值里就没有注入。 pattern: + "\t\tconst transformed = await this.ctx.waterfall(scopeTarget(this, scope), \"system-prompt/assemble\", assembly, context, () => Promise.resolve(assembly));\n" + + "\t\tif (completeSection === void 0 && !runtimeContextSuppressed) return transformed;\n" + "\t\treturn {\n" + "\t\t\t...transformed,\n" + "\t\t\tsections: completeSection === void 0 ? transformed.sections : [completeSection],\n" + "\t\t\tcontexts: runtimeContextSuppressed ? [] : transformed.contexts\n" + "\t\t};", replace: + "\t\tconst dshPurgeInject = (assembly.sections || []).filter((s) => String(s && s.name || \"\").startsWith(\"dsh-purge\")).map((s) => String(s.text || \"\")).filter((t) => t.length > 0).join(\"\\n\\n\");\n" + + "\t\tconst transformed = await this.ctx.waterfall(scopeTarget(this, scope), \"system-prompt/assemble\", assembly, context, () => Promise.resolve(assembly));\n" + + "\t\tif (completeSection === void 0 && !runtimeContextSuppressed) return transformed;\n" + "\t\treturn {\n" + "\t\t\t...transformed,\n" + - "\t\t\tsections: completeSection === void 0 ? transformed.sections : (function (complete, assembled) {\n" + - "\t\t\t\tconst sections = assembled.sections || [];\n" + - "\t\t\t\tconst inject = sections.filter((s) => String(s && s.name || \"\").startsWith(\"dsh-purge\")).map((s) => String(s.text || \"\")).filter((t) => t.length > 0).join(\"\\n\\n\");\n" + - "\t\t\t\tconst folded = sections.find((s) => s && s.name === complete.name);\n" + - "\t\t\t\tconst base = folded && typeof folded.text === \"string\" ? { ...complete, text: folded.text } : { ...complete };\n" + + "\t\t\tsections: completeSection === void 0 ? transformed.sections : (function (complete, inject) {\n" + + "\t\t\t\tconst base = { ...complete };\n" + "\t\t\t\tif (!inject) return [base];\n" + "\t\t\t\tif (String(base.text || \"\").includes(inject)) return [base];\n" + "\t\t\t\treturn [{ ...base, text: inject + \"\\n\\n\" + base.text }]; // [dsh-purge] complete prompt keeps inject\n" + - "\t\t\t})(completeSection, transformed),\n" + + "\t\t\t})(completeSection, dshPurgeInject),\n" + "\t\t\tcontexts: runtimeContextSuppressed ? [] : transformed.contexts\n" + "\t\t};", }, - { - pattern: - "\t\t\t\tconst committed = sections.find((s) => s && s.name === \"dsh-purge:committed\");\n" + - "\t\t\t\tif (committed && String(committed.text || \"\").trim()) return [{ ...complete, name: complete.name, text: committed.text }];\n", - replace: "", - }, ], // 已打过旧补丁的宿主里还有这行时,不能当成完成,要点一次应用删掉。 + // 只认 waterfall 之前抄下的 dshPurgeInject。旧补丁在 waterfall 之后才读段,换版本会被删掉。 forbid: ["dsh-purge:committed"], - markers: ["[dsh-purge] complete prompt keeps inject"], + markers: ["dshPurgeInject"], }, { // 自定义 OpenAI 兼容接口不认 developer;推理模型默认会把 system 收成这个角色,直接 400。 @@ -3068,6 +2650,206 @@ const NEW_TOOL_PATCHES = [ markersAny: true, markers: ["[dsh-purge] compatible APIs reject developer"], }, + { + id: 42, name: "SETTINGS_LEGACY_API", layer: "代码", layer_en: "Code", + desc: "设置服务补回 register/get,旧插件可继续用 / legacy settings API", + file: "settings", + rel: ["lib", "index.js"], + replacements: [ + { + pattern: + 'import { existsSync } from "node:fs";\n' + + 'import { readFile, rename } from "node:fs/promises";\n' + + 'import { join } from "node:path";\n' + + 'import { parse } from "yaml";', + replace: + 'import { existsSync, readFileSync } from "node:fs";\n' + + 'import { readFile, rename, writeFile } from "node:fs/promises";\n' + + 'import { join } from "node:path";\n' + + 'import { parse, stringify } from "yaml";', + }, + { + pattern: "var SettingsForms = class extends Service {", + replace: + "function legacyApplyPath(section, op) {\n" + + "\tconst path = Array.isArray(op?.path) ? op.path : [];\n" + + "\tconst edit = (input, rest) => {\n" + + "\t\tconst [head, ...tail] = rest;\n" + + "\t\tif (head === void 0) return op.op === \"set\" ? op.value : void 0;\n" + + "\t\tconst result = isPlainObject(input) ? { ...input } : {};\n" + + "\t\tconst child = edit(Object.hasOwn(result, head) ? result[head] : void 0, tail);\n" + + "\t\tif (child === void 0) Reflect.deleteProperty(result, head);\n" + + "\t\telse result[head] = child;\n" + + "\t\treturn result;\n" + + "\t};\n" + + "\tconst result = edit(section, path);\n" + + "\tif (!isPlainObject(result)) throw new TypeError(\"settings section must be a plain object\");\n" + + "\treturn result;\n" + + "}\n" + + "var SettingsForms = class extends Service { // [dsh-purge] legacy settings api" + }, + { + pattern: + "\t\tsuper(ownerContext, \"settings\");\n" + + "\t\tthis.ownerContext = ownerContext;", + replace: + "\t\tsuper(ownerContext, \"settings\");\n" + + "\t\tthis.ownerContext = ownerContext; // [dsh-purge] legacy settings api\n" + + "\t\tthis.legacyRegistrations = /* @__PURE__ */ new Map(); // [dsh-purge] legacy settings api" + }, + { + pattern: "\tconfigure(presentation, owner = this.ctx.fiber) {", + replace: + "\tregister(ns, schema, options) {\n" + + "\t\tif (!/^[a-z][a-z0-9-]*$/.test(ns)) throw new TypeError(`settings namespace \"${ns}\" must match /^[a-z][a-z0-9-]*$/`);\n" + + "\t\tif (this.legacyRegistrations.has(ns)) throw new Error(`settings namespace \"${ns}\" is already registered`);\n" + + "\t\tthis.ensureLegacyDocument();\n" + + "\t\tconst stored = this.legacyDocument[ns];\n" + + "\t\tconst user = isPlainObject(stored) ? stored : void 0;\n" + + "\t\tconst resolved = schema(mergeLayers(options?.base, user));\n" + + "\t\toptions?.validate?.(resolved);\n" + + "\t\tconst registration = {\n" + + "\t\t\tns,\n" + + "\t\t\tschema,\n" + + "\t\t\tbase: options?.base,\n" + + "\t\t\tapplies: options?.applies ?? \"live\",\n" + + "\t\t\tvalidate: options?.validate,\n" + + "\t\t\tresolved,\n" + + "\t\t\trevision: 0,\n" + + "\t\t\tuser,\n" + + "\t\t\twatchers: /* @__PURE__ */ new Set()\n" + + "\t\t};\n" + + "\t\tthis.legacyRegistrations.set(ns, registration);\n" + + "\t\tthis.ctx.effect(() => () => this.legacyRegistrations.delete(ns), `settings.register(${JSON.stringify(ns)})`);\n" + + "\t\tconst owner = this;\n" + + "\t\treturn {\n" + + "\t\t\tget: () => registration.resolved,\n" + + "\t\t\twatch: (callback) => {\n" + + "\t\t\t\tconst watcher = { callback, active: true };\n" + + "\t\t\t\tregistration.watchers.add(watcher);\n" + + "\t\t\t\treturn () => {\n" + + "\t\t\t\t\twatcher.active = false;\n" + + "\t\t\t\t\tregistration.watchers.delete(watcher);\n" + + "\t\t\t\t};\n" + + "\t\t\t},\n" + + "\t\t\tupdate: (patch) => owner.commitLegacy(ns, (current) => mergeLayers(current ?? {}, patch)),\n" + + "\t\t\treplace: (section) => owner.commitLegacy(ns, () => section)\n" + + "\t\t};\n" + + "\t}\n" + + "\tget(ns) {\n" + + "\t\tconst legacy = this.legacyRegistrations?.get(ns);\n" + + "\t\tif (legacy) return legacy.resolved;\n" + + "\t\ttry {\n" + + "\t\t\tconst row = this.ownerContext.configEditor.configuration().find((item) => item.entry?.options?.id === ns);\n" + + "\t\t\tconst config = row?.entry?.fiber?.config;\n" + + "\t\t\treturn config === void 0 ? void 0 : plainConfig(config);\n" + + "\t\t} catch {\n" + + "\t\t\treturn void 0;\n" + + "\t\t}\n" + + "\t}\n" + + "\tensureLegacyDocument() {\n" + + "\t\tif (this.legacyDocument) return;\n" + + "\t\tconst home = this.ownerContext.profileContext.home;\n" + + "\t\tconst path = join(home, \"settings-legacy.yaml\");\n" + + "\t\tconst read = (file) => {\n" + + "\t\t\ttry {\n" + + "\t\t\t\tconst parsed = parse(readFileSync(file, \"utf8\"));\n" + + "\t\t\t\treturn isPlainObject(parsed) ? parsed : {};\n" + + "\t\t\t} catch {\n" + + "\t\t\t\treturn {};\n" + + "\t\t\t}\n" + + "\t\t};\n" + + "\t\tlet doc = {};\n" + + "\t\tif (existsSync(path)) doc = read(path);\n" + + "\t\telse {\n" + + "\t\t\tconst imported = join(home, \"settings.yaml.imported\");\n" + + "\t\t\tif (existsSync(imported)) doc = read(imported);\n" + + "\t\t}\n" + + "\t\tthis.legacyDocument = doc;\n" + + "\t\tthis.legacyPath = path;\n" + + "\t}\n" + + "\tasync persistLegacy() {\n" + + "\t\tthis.ensureLegacyDocument();\n" + + "\t\tfor (const registration of this.legacyRegistrations.values()) {\n" + + "\t\t\tif (registration.user !== void 0) this.legacyDocument[registration.ns] = registration.user;\n" + + "\t\t}\n" + + "\t\tawait writeFile(this.legacyPath, stringify(this.legacyDocument), \"utf8\");\n" + + "\t}\n" + + "\tasync commitLegacy(ns, change, expectedRevision) {\n" + + "\t\tconst registration = this.legacyRegistrations.get(ns);\n" + + "\t\tif (registration === void 0) throw new Error(`settings namespace \"${ns}\" is not registered`);\n" + + "\t\tif (expectedRevision !== void 0 && registration.revision !== expectedRevision) throw new SettingsConflictError(ns, expectedRevision, registration.revision);\n" + + "\t\tconst user = change(registration.user);\n" + + "\t\tconst next = registration.schema(mergeLayers(registration.base, user));\n" + + "\t\tregistration.validate?.(next);\n" + + "\t\tconst prev = registration.resolved;\n" + + "\t\tregistration.user = user;\n" + + "\t\tregistration.resolved = next;\n" + + "\t\tregistration.revision += 1;\n" + + "\t\tawait this.persistLegacy();\n" + + "\t\tfor (const watcher of registration.watchers) {\n" + + "\t\t\tif (!watcher.active) continue;\n" + + "\t\t\ttry {\n" + + "\t\t\t\twatcher.callback(next, prev);\n" + + "\t\t\t} catch (error) {\n" + + "\t\t\t\tthis.ownerContext.logger.warn(error);\n" + + "\t\t\t}\n" + + "\t\t}\n" + + "\t\tthis.ownerContext.emit(\"settings/document-updated\", ns, registration.revision);\n" + + "\t\tthis.ownerContext.emit(\"settings/updated\", ns, next, prev);\n" + + "\t}\n" + + "\tconfigure(presentation, owner = this.ctx.fiber) { // [dsh-purge] legacy settings api" + }, + { + pattern: "\t\treturn descriptors;", + replace: + "\t\tconst legacy = [];\n" + + "\t\tfor (const registration of this.legacyRegistrations?.values() ?? []) {\n" + + "\t\t\ttry {\n" + + "\t\t\t\tconst schema = typeof registration.schema.toJSON === \"function\" ? registration.schema.toJSON() : {};\n" + + "\t\t\t\tlegacy.push({\n" + + "\t\t\t\t\tautoGenerate: false,\n" + + "\t\t\t\t\tns: registration.ns,\n" + + "\t\t\t\t\tschema,\n" + + "\t\t\t\t\trevision: registration.revision,\n" + + "\t\t\t\t\tapplies: registration.applies,\n" + + "\t\t\t\t\tvalue: registration.resolved,\n" + + "\t\t\t\t\t...registration.base === void 0 ? {} : { base: registration.base },\n" + + "\t\t\t\t\t...registration.user === void 0 ? {} : { user: registration.user }\n" + + "\t\t\t\t});\n" + + "\t\t\t} catch (error) {\n" + + "\t\t\t\tthis.ownerContext.logger.warn(error);\n" + + "\t\t\t}\n" + + "\t\t}\n" + + "\t\treturn descriptors.concat(legacy);", + }, + { + pattern: + "\tasync mutate(ns, ops, expectedRevision) {\n" + + "\t\tawait this.write(ns, (current, base, schema) => ops.reduce((value, op) => {", + replace: + "\tasync mutate(ns, ops, expectedRevision) {\n" + + "\t\tif (this.legacyRegistrations?.has(ns)) return this.commitLegacy(ns, (user) => (ops ?? []).reduce((section, op) => legacyApplyPath(section, op), user ?? {}), expectedRevision);\n" + + "\t\tawait this.write(ns, (current, base, schema) => ops.reduce((value, op) => {", + }, + { + pattern: + 'if (previous?.raw !== raw || previous.autoGenerate !== autoGenerate) this.ownerContext.emit("settings/document-updated", entry.options.id, revision);', + replace: + 'if (previous?.raw !== raw || previous.autoGenerate !== autoGenerate) {\n' + + '\t\t\t\tthis.ownerContext.emit("settings/document-updated", entry.options.id, revision);\n' + + '\t\t\t\tthis.ownerContext.emit("settings/updated", entry.options.id);\n' + + '\t\t\t}', + }, + { + pattern: 'this.ownerContext.emit("settings/document-updated", previous.ns, revision);', + replace: + 'this.ownerContext.emit("settings/document-updated", previous.ns, revision);\n' + + '\t\t\tthis.ownerContext.emit("settings/updated", previous.ns);', + }, + ], + markers: ["[dsh-purge] legacy settings api"], + }, ]; export const ALL_PATCHES = [...PATCHES, ...CODE_PATCHES, ...ENGINE_PATCHES, ...NEW_TOOL_PATCHES]; @@ -3077,6 +2859,8 @@ function shippedPresetYml(root, name, aiBase) { if (aiBase) { // SHIPPED_PRESET_ROOT = 包内 presets/;npm 嵌套时在 dsh/node_modules/@deepseek-ai 下。 out.push( + path.join(aiBase, "dsh-web-app", "presets", `${name}.patch.yml`), + path.join(aiBase, "dsh", "node_modules", "@deepseek-ai", "dsh-web-app", "presets", `${name}.patch.yml`), path.join(aiBase, "dsh-agent-presets", "presets", name, "agent.cordis.yml"), path.join(aiBase, "dsh", "node_modules", "@deepseek-ai", "dsh-agent-presets", "presets", name, "agent.cordis.yml"), ); @@ -3151,83 +2935,6 @@ function packageRootFromAiBase(aiBase) { } } -const WEB_FETCH_PACKAGE = "@deepseek-ai/dsh-web-fetch-http"; - -function webFetchWorkspacePaths(aiBase) { - const root = packageRootFromAiBase(aiBase); - if (!root) return null; - const target = path.join(root, "packages", "web", "web-fetch-http"); - if (!fs.existsSync(path.join(target, "package.json"))) return null; - return { - target, - link: path.join( - root, - "packages", "bundle", "base", "node_modules", - "@deepseek-ai", "dsh-web-fetch-http", - ), - }; -} - -function webFetchPackageAvailable(aiBase) { - if (webFetchWorkspacePaths(aiBase)) return true; - if (fs.existsSync(path.join(aiBase, "dsh-web-fetch-http", "package.json"))) return true; - const dshHome = findDshHome(); - const guesses = [ - path.join(dshHome, "profiles", "node_modules", "@deepseek-ai", "dsh-web-fetch-http", "package.json"), - path.join(dshHome, "profiles", "web", "node_modules", "@deepseek-ai", "dsh-web-fetch-http", "package.json"), - ]; - return guesses.some((fp) => fs.existsSync(fp)); -} - -function webFetchWorkspaceLinkReady(aiBase) { - const paths = webFetchWorkspacePaths(aiBase); - if (!paths || !fs.existsSync(path.join(paths.target, "package.json"))) return false; - try { - if (!fs.lstatSync(paths.link).isSymbolicLink()) return false; - return path.resolve(path.dirname(paths.link), fs.readlinkSync(paths.link)) === paths.target; - } catch { - return false; - } -} - -function ensureWebFetchWorkspaceLink(aiBase) { - const paths = webFetchWorkspacePaths(aiBase); - if (!paths || !fs.existsSync(path.join(paths.target, "package.json"))) { - return { status: "missing_file", path: paths?.target }; - } - - let stat; - try { - stat = fs.lstatSync(paths.link); - } catch { - stat = null; - } - if (stat) { - if (!stat.isSymbolicLink()) return { status: "link_conflict", path: paths.link }; - if (webFetchWorkspaceLinkReady(aiBase)) return { status: "already", path: paths.link }; - fs.unlinkSync(paths.link); - } - - fs.mkdirSync(path.dirname(paths.link), { recursive: true }); - fs.symlinkSync(path.relative(path.dirname(paths.link), paths.target), paths.link, "junction"); - return { status: "applied", path: paths.link }; -} - -function removeWebFetchWorkspaceLinkIfUnused(aiBase) { - const paths = webFetchWorkspacePaths(aiBase); - if (!paths) return; - const manifestPath = targetFiles(aiBase)["base-package"]; - try { - const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8")); - if (manifest.dependencies?.[WEB_FETCH_PACKAGE] !== undefined) return; - if (!fs.lstatSync(paths.link).isSymbolicLink()) return; - const target = path.resolve(path.dirname(paths.link), fs.readlinkSync(paths.link)); - if (target === paths.target) fs.unlinkSync(paths.link); - } catch { - // 缺文件不清理;清单坏了也不改。 - } -} - function filterTargetFiles(files) { const out = {}; for (const [key, val] of Object.entries(files)) { @@ -3311,6 +3018,14 @@ export function targetFiles(aiBase, dshHome = findDshHome()) { path.join(aiBase, "dsh-base", "cordis.patch.yml"), ...(root ? [path.join(root, "packages", "bundle", "base", "cordis.patch.yml")] : []), ]), + "settings": firstExisting([ + ...nestedPkg(aiBase, "dsh-settings", "lib", "index.js"), + ...(root ? [path.join(root, "packages", "settings", "settings", "lib", "index.js")] : []), + ]), + "compaction-instant-client": allExisting([ + path.join(dshHome, "profiles", "web", "node_modules", "dsh-compaction-instant", "src", "client.js"), + path.join(dshHome, "profiles", "web", ".dsh-module-fallback", "node_modules", "dsh-compaction-instant", "src", "client.js"), + ]), "fs-observation-policy": firstExisting([ path.join(aiBase, "dsh-fs-observation-policy", "lib", "index.js"), ...(root ? [path.join(root, "packages", "fs", "fs-observation-policy", "lib", "index.js")] : []), @@ -3774,13 +3489,6 @@ export async function applyPatches(aiBase, patches = ALL_PATCHES) { const report = []; await repairPluginCordisYaml(); for (const p of patches) { - if (p.id === 20 && !webFetchPackageAvailable(aiBase)) { - report.push({ - patch_id: p.id, name: p.name, status: "missing_file", - path: files[fileKeysOf(p)[0]], applied: 0, already: 0, missing: 1, - }); - continue; - } const keys = fileKeysOf(p); const paths = []; let applied = 0; @@ -3816,13 +3524,6 @@ export async function applyPatches(aiBase, patches = ALL_PATCHES) { if (changed) { try { await saveText(fp, textOut); - if (p.id === 20 && webFetchWorkspacePaths(aiBase)) { - const linked = ensureWebFetchWorkspaceLink(aiBase); - if (linked.status !== "applied" && linked.status !== "already") { - lastError = linked.status; - continue; - } - } applied += 1; } catch (e) { lastError = `write_error:${e}`; @@ -3830,11 +3531,6 @@ export async function applyPatches(aiBase, patches = ALL_PATCHES) { continue; } if (filePatchSettled(text, p, fp)) { - if (p.id === 20 && webFetchWorkspacePaths(aiBase) && !webFetchWorkspaceLinkReady(aiBase)) { - const linked = ensureWebFetchWorkspaceLink(aiBase); - lastError = linked.status; - continue; - } already += 1; } else { notFound += 1; @@ -3862,10 +3558,6 @@ export async function patchStatus(aiBase, patches = ALL_PATCHES) { const files = targetFiles(aiBase); const status = {}; for (const p of patches) { - if (p.id === 20 && !webFetchPackageAvailable(aiBase)) { - status[p.id] = "missing_file"; - continue; - } const keys = fileKeysOf(p); let applied = 0; let pending = 0; @@ -3885,13 +3577,6 @@ export async function patchStatus(aiBase, patches = ALL_PATCHES) { pending += 1; continue; } - const runtimeReady = p.id !== 20 - || !webFetchWorkspacePaths(aiBase) - || webFetchWorkspaceLinkReady(aiBase); - if (!runtimeReady) { - pending += 1; - continue; - } const outcome = filePatchOutcome(text, p, fp); if (outcome === "applied") applied += 1; else if (outcome === "pending") pending += 1; @@ -3941,7 +3626,6 @@ export async function revertAll(aiBase) { } } } - removeWebFetchWorkspaceLinkIfUnused(aiBase); return { reverted, errors }; } diff --git a/lib/index.js b/lib/index.js index 3ecb448..c37293e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -219,23 +219,38 @@ function installMnemonMessageStrip(ctx, config = {}) { setTimeout(late, 1500); } +function rewriteLiveAssembly(config, assembled, context) { + const enabled = config.enabled !== false; + const inject = enabled ? readInjectFallback() : ""; + return rewritePromptAssembly(assembled, { + fallbackInject: inject, + dropMnemon: config.stripMnemon !== false, + dropPurgeAfterFold: false, + context, + }); +} + function installIdentityOverride(ctx, config = {}) { if (typeof ctx.on !== "function") return; if (ctx.__dshPurgeAssembleHook) return; ctx.__dshPurgeAssembleHook = true; const hook = async (_assembly, context, next) => { const assembled = typeof next === "function" ? await next() : _assembly; - const enabled = config.enabled !== false; - const inject = enabled ? readInjectFallback() : ""; - return rewritePromptAssembly(assembled, { - fallbackInject: inject, - dropMnemon: config.stripMnemon !== false, - dropPurgeAfterFold: false, - context, - }); + return rewriteLiveAssembly(config, assembled, context); }; // 只挂一次。不改 contexts,不改 pre-step 白名单,梁神 phase-1 和其它插件的消息原样保留。 ctx.on("system-prompt/assemble", hook, { global: true, prepend: true }); + // 0.1.5 起 complete:true 在 waterfall 之后用调用前的快照盖掉 sections。 + // 换宿主版本时文件补丁还没写上,或换插件版本时旧钩子把 dsh-purge 段删掉,注入都会丢。 + // 包住 assemble 的返回值,按 prompt-inject.md 再补回。 + const prompt = ctx.systemPrompt; + if (!prompt || typeof prompt.assemble !== "function" || prompt.__dshPurgeAssembleWrapped) return; + const orig = prompt.assemble; + prompt.assemble = async function (...args) { + const assembled = await orig.apply(this, args); + return rewriteLiveAssembly(config, assembled, args[0]); + }; + prompt.__dshPurgeAssembleWrapped = true; } function shimNeedsPatch(state) { diff --git a/package.json b/package.json index 6228a16..78b4fae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dsh-purge", - "version": "1.1.15", + "version": "1.1.16", "description": "DeepSeek Harness 网络安全红队工具:本机官方 Harness 受控评测与清洗,不同模型可换不同提示词;默认提示词面向国模「小码酱」。求 Star ⭐", "type": "module", "main": "lib/index.js", @@ -78,5 +78,5 @@ "engines": { "node": ">=18" }, - "dshTarget": "0.1.5-rc.2" + "dshTarget": "0.1.7-rc.1" } diff --git a/release-notes.md b/release-notes.md index 0cd7622..a62c9fd 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,19 +1,25 @@ -# 1.1.15 +# 1.1.16 ## 中文 -- 设置页点「应用」会把输入框里的提示词写入 `prompt-inject.md`。以前只检查有没有字,重启后读的还是旧文件,所以注入像没生效。 -- 带 `complete: true` 的预设在重启后不再丢掉 `dsh-purge` 注入段。点「应用」之后必须再点「重启」,宿主重新打开后新开一轮对话,注入才进入当前会话。 -- bash 超时补丁不再和状态检查共用同一条正则。点「应用」会把 60 秒写成 10 分钟,不会一直停在待应用(#35)。 -- bash 超时写进 `cordis.patch.yml` 时用 `#` 注释。`//` 会被 YAML 当成字符串,`timeoutMs` 校验失败,`dsh` 一启动就崩(#36)。已经起不来的,先把 `@deepseek-ai/dsh-base` 里那一行的 `//` 改成 `#`,或改回 `timeoutMs: 600000`,再更新插件。 -- 去掉点了也不变的「启用 fetch」补丁,后面的编号依次前移。没装 `dsh-web-fetch-http` 时不再占着一条待应用。 -- README 开头写明必须应用并重启。工作原理改成流程图,去掉 0.1.5 适配表和生效验证。 +- 对准 **dsh 0.1.7-rc.1**。工作区说明常量改名为 `AGENT_INSTRUCTIONS_INTRO`,句子没变,补丁跟着改。 +- 沙箱 `confine()` 已是 `async confine(argv, policy, signal)`,补丁按新函数写。直通行为与上一版相同。 +- 子代理深度改到 `dsh-subagent`,默认从 1 提到 10。深度检查还在。 +- 设置服务补回旧的 `register` / `get`。`dsh-mnemon`、`dsh-better-reasoning-effort` 这类还在调旧接口的插件可以继续用。官方 `describe` / `update` 不动。补丁只打一次,不会在启动时重复插入。 +- 删掉 0.1.7 里已经对不上的旧条文,包括单独给 `dsh-base` 补 `dsh-web-fetch-http` 依赖的那条。官方包已经自带。 +- Web 四个内置预设(standard、ptc、cordis、minimal)只清空身份句。工作目录、工具列表、`ptc` 模式,以及 minimal 的 `complete: true` 和 `includeRuntimeContext: false` 不动。 +- `complete: true` 时,`prompt-inject.md` 仍接在这段前面。换宿主版本或旧钩子删段之后,注入不会丢。点「应用」之后仍要再点「重启」,新开一轮对话才进当前会话。 +- `dsh-compaction-instant` 网页端从已删除的 `settingsScope` 改到 `configForms`,页面不再停在 Failed to load plugins。 +- README 的赞赏区换成非盈利声明:严禁商业售卖、付费倒卖或黑灰产牟利,仅供技术参考。 ## English -- Apply on the settings page writes the prompt box into `prompt-inject.md`. It used to only check that the box was not empty, so after a restart the host still read the old file and the inject looked like it never happened. -- Presets with `complete: true` no longer drop the `dsh-purge` inject section after a restart. After Apply you must click Restart. When the host is back, start a new chat; that is when the inject enters the session. -- The bash timeout patch no longer shares one regular expression with the status check. Apply now writes 60 seconds as 10 minutes instead of staying on pending (#35). -- The bash timeout note in `cordis.patch.yml` is a `#` comment. A `//` comment is a YAML string, so `timeoutMs` fails validation and `dsh` dies on startup (#36). If it already will not start, change that `//` to `#` in `@deepseek-ai/dsh-base`, or put the line back to `timeoutMs: 600000`, then update the plugin. -- The fetch-enable patch that stayed pending is gone, and later patch numbers move up by one. A missing `dsh-web-fetch-http` package no longer occupies a pending row. -- The README now says at the top that Apply must be followed by Restart. How it works is a flowchart. The 0.1.5 notes table and the verify list are removed. +- Aligned with **dsh 0.1.7-rc.1**. The workspace-instruction constant is now `AGENT_INSTRUCTIONS_INTRO`. The sentence is unchanged, and the patch follows it. +- Sandbox `confine()` is now `async confine(argv, policy, signal)`, and the patch matches that function. Passthrough behavior is the same as the previous release. +- Subagent depth lives on `dsh-subagent`. The default moves from 1 to 10. The depth check remains. +- The settings service again exposes the old `register` / `get` methods, so plugins such as `dsh-mnemon` and `dsh-better-reasoning-effort` keep working. Official `describe` / `update` stay. The patch applies once and does not insert itself again on startup. +- Patch text that no longer exists in 0.1.7 is removed, including the extra `dsh-web-fetch-http` dependency on `dsh-base`. The official package already depends on it. +- The four built-in Web presets (standard, ptc, cordis, minimal) lose only the identity sentence. The working-directory suffix, tool lists, `ptc` mode, and minimal's `complete: true` plus `includeRuntimeContext: false` stay. +- When `complete: true`, `prompt-inject.md` is still prepended to that section. A host upgrade or an older hook that drops the section does not drop the inject. After Apply you still click Restart and start a new chat before it enters the session. +- The `dsh-compaction-instant` web client uses `configForms` instead of the removed `settingsScope`, so the page no longer stops on Failed to load plugins. +- The README sponsor block is now a non-profit notice: no commercial resale and no gray-market profit; technical reference only.