diff --git a/README.md b/README.md index 688aa48..07d5b58 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

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

-

Version 1.1.61

+

Version 1.1.62

Local official DeepSeek Harness cybersecurity red-team plugin. Clean host policy, and ship a built-in drill console. Swap prompts per model. Default prompt for Chinese models — 小码酱. Please star ⭐ @@ -126,7 +126,7 @@ This release supports **DeepSeek Harness 0.2** only (official desktop **0.2.0-rc | Official Harness 0.1.x | Not supported | | Any other version | Unmatched patches stay pending or skipped; do not expect them to work | -The plugin version is **1.1.61**. 1.1.45 is skipped; it has bugs. +The plugin version is **1.1.62**. 1.1.45 is skipped; it has bugs. --- @@ -192,13 +192,13 @@ Official desktop 0.2 loads the `desktop` profile. Do not use `default`, and do n

🌐 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.61&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.62&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 ```
@@ -214,7 +214,7 @@ export function installDshPurgeToDesktop() { const params = new URLSearchParams({ id: 'dsh-purge', name: 'dsh-purge', - version: '1.1.61', + version: '1.1.62', repo: 'YuJunZhiXue/dsh-purge', permissions: '系统提示词注入, 本机补丁, 设置页', downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz', @@ -233,7 +233,7 @@ export function installDshPurgeToDesktop() { **HTML link:** ```html - + 🚀 Install in desktop client ``` @@ -244,7 +244,7 @@ export function installDshPurgeToDesktop() { |---|---|---| | id | `dsh-purge` | Plugin id | | name | `dsh-purge` | Display name | -| version | `1.1.61` | Semver | +| version | `1.1.62` | 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 51bf248..215845c 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -4,7 +4,7 @@

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

-

Version 1.1.61

+

Version 1.1.62

本机官方 DeepSeek Harness 网络安全红队评测插件。清洗宿主策略,并带内嵌演练台。不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐ @@ -126,7 +126,7 @@ Harness 不只是把问题交给模型。它还会在运行时改提示词、审 | 官方 Harness 0.1.x | 不支持 | | 其它未列出版本 | 对不上的补丁会显示待应用或跳过,不要指望能用 | -插件版本是 **1.1.61**。1.1.45 有问题,略过。 +插件版本是 **1.1.62**。1.1.45 有问题,略过。 --- @@ -192,13 +192,13 @@ dsh plugin --profile desktop add https://github.com/YuJunZhiXue/dsh-purge/archiv

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

🔗 **原生协议链接:** ``` -dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.61&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.62&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 ```
@@ -214,7 +214,7 @@ export function installDshPurgeToDesktop() { const params = new URLSearchParams({ id: 'dsh-purge', name: 'dsh-purge', - version: '1.1.61', + version: '1.1.62', repo: 'YuJunZhiXue/dsh-purge', permissions: '系统提示词注入, 本机补丁, 设置页', downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz', @@ -233,7 +233,7 @@ export function installDshPurgeToDesktop() { **HTML 静态链接方式:** ```html - + 🚀 唤起客户端一键安装 ``` @@ -244,7 +244,7 @@ export function installDshPurgeToDesktop() { |---|---|---| | id | `dsh-purge` | 插件唯一标识符 | | name | `dsh-purge` | 插件展示名称 | -| version | `1.1.61` | 语义化版本号 | +| version | `1.1.62` | 语义化版本号 | | repo | `YuJunZhiXue/dsh-purge` | GitHub 仓库 | | permissions | `系统提示词注入, 本机补丁, 设置页` | 申请权限 | | downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub 源码包地址 | diff --git a/lib/index.js b/lib/index.js index aa6bada..830f456 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1117,11 +1117,10 @@ function applyHostHooks(ctx, cfg) { const injectFile = core.findOverrideFile(core.findDshHome()); registerPromptSections(ctx, cfg, injectFile); - // 继续/重试先关掉,需要时再打开下面这段。 - // continuePluginCfg = cfg; - // savedContinueSettings = continueRetry.loadSettings(core.findDshHome()); - // try { continueRuntime?.dispose?.(); } catch { /* ignore */ } - // continueRuntime = continueRetry.installContinueRetry(ctx, { getConfig: currentContinueConfig }); + continuePluginCfg = cfg; + savedContinueSettings = continueRetry.loadSettings(core.findDshHome()); + try { continueRuntime?.dispose?.(); } catch { /* ignore */ } + continueRuntime = continueRetry.installContinueRetry(ctx, { getConfig: currentContinueConfig }); const commands = ctx.get?.("commands"); if (commands) { diff --git a/lib/redteam/index.js b/lib/redteam/index.js index 7b5c869..84e581c 100644 --- a/lib/redteam/index.js +++ b/lib/redteam/index.js @@ -242,11 +242,32 @@ function repairDelegation(text) { /** 包内锚点门相对预设模板的标记,用来给已有用户预设补一行,不整份覆盖。 */ const ANCHOR_ROW_MARK = '- id: anchor-gate' +const ANCHOR_BLOCK_START = '# 锚点门' +const REDTEAM_TOOLS_MARK = '- id: redteam-tools' + +function anchorBlockBounds(ymlText) { + const start = ymlText.indexOf(ANCHOR_BLOCK_START) + const end = ymlText.indexOf(REDTEAM_TOOLS_MARK) + if (start === -1 || end === -1 || start >= end) return null + return { start, end } +} + +function readAnchorBlockFromTemplate() { + let template = '' + try { + template = readFileSync(join(packagePaths().presetDir, 'agent.cordis.yml'), 'utf8') + } catch { + return null + } + const bounds = anchorBlockBounds(template) + if (!bounds) return null + return template.slice(bounds.start, bounds.end).trim() +} /** * 锚点门脚本每次用包内副本覆盖(没有用户可改状态)。 - * 用户预设里还没有这一行时,插到 redteam-tools 前面。 - * @returns {'inserted'|'updated'|'kept'|'missing'} + * YAML 里锚点配置块与包内模板不一致时也会替换(bootstrapMaxTokens 等),其余 preset 正文保留。 + * @returns {'inserted'|'updated'|'config-updated'|'kept'|'missing'} */ function syncAnchorGate(targetDir) { const src = join(packagePaths().presetDir, 'anchor-gate.mjs') @@ -265,17 +286,22 @@ function syncAnchorGate(targetDir) { if (!existsSync(presetFile)) return script let text try { text = readFileSync(presetFile, 'utf8') } catch { return script } - if (text.includes(ANCHOR_ROW_MARK)) return script - let template = '' - try { template = readFileSync(join(packagePaths().presetDir, 'agent.cordis.yml'), 'utf8') } catch { return script } - const start = template.indexOf('# 锚点门') - const end = template.indexOf('- id: redteam-tools') - if (start === -1 || end === -1 || start > end) return script - const block = template.slice(start, end).trim() + const templateBlock = readAnchorBlockFromTemplate() + if (!templateBlock) return script const nl = text.includes('\r\n') ? '\r\n' : '\n' - const rendered = block.replace(/\r\n/g, '\n').replace(/\n/g, nl) - const marker = '- id: redteam-tools' - const at = text.indexOf(marker) + const rendered = templateBlock.replace(/\r\n/g, '\n').replace(/\n/g, nl) + + if (text.includes(ANCHOR_ROW_MARK)) { + const bounds = anchorBlockBounds(text) + if (!bounds) return script + const currentBlock = text.slice(bounds.start, bounds.end).trim() + if (currentBlock === rendered.trim()) return script + const next = text.slice(0, bounds.start) + rendered + nl + nl + text.slice(bounds.end) + writeFileSync(presetFile, next, 'utf8') + return script === 'updated' ? 'updated' : 'config-updated' + } + + const at = text.indexOf(REDTEAM_TOOLS_MARK) const next = at === -1 ? text.replace(/\s*$/, '') + nl + nl + rendered + nl : text.slice(0, at) + rendered + nl + nl + text.slice(at) @@ -337,12 +363,14 @@ export function installPreset(options = {}) { const anchor = syncAnchorGate(target) if (anchor === 'inserted') log('已把锚点门补进现有预设(其余内容保留)') else if (anchor === 'updated') log('已更新锚点门脚本') + else if (anchor === 'config-updated') log('已同步锚点门配置(bootstrapMaxTokens / maxBootstrapSteps 等)') const repaired = [ rendered.changed ? rendered.reason : null, tools.changed ? 'tools-package' : null, delegation.changed ? 'delegation' : null, anchor === 'inserted' ? 'anchor-gate' : null, anchor === 'updated' ? 'anchor-script' : null, + anchor === 'config-updated' ? 'anchor-config' : null, ].filter(Boolean) if (repaired.length > 0) { return { diff --git a/package.json b/package.json index e81d786..a4e7c6d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dsh-purge", - "version": "1.1.61", + "version": "1.1.62", "description": "DeepSeek Harness 网络安全红队工具:本机官方 Harness 受控评测与清洗,内嵌演练台;不同模型可换不同提示词;默认提示词面向国模「小码酱」。求 Star ⭐", "type": "module", "main": "lib/index.js", diff --git a/presets/redteam/agent.cordis.yml b/presets/redteam/agent.cordis.yml index ff9c798..8095823 100644 --- a/presets/redteam/agent.cordis.yml +++ b/presets/redteam/agent.cordis.yml @@ -116,15 +116,15 @@ - **自己的 VPS / 自建服务器上开的代理不算隧道**:隧道必须说清目标侧那一端(`entry_kind`)。 - 报告只收录拿到分的成果,且每条要能复现(目标 → 拿到什么 → 怎么拿到的(命令)→ 原始请求)。 -# 锚点门:第一段思考含 we 且不含 let me 才放开 1024 输出上限;锚不住最多 4 步。 +# 锚点门:bootstrap 阶段限输出,避免首轮空转;指挥端会先连打 preflight/开靶/读技能,1024 易截断。 # 不裁工具、不换人设。压缩后再关一次。放开后工作区长说明改成点名文件。 - id: anchor-gate name: ./anchor-gate.mjs config: anchorGate: true - maxBootstrapSteps: 4 + maxBootstrapSteps: 2 promoteAfterFirstResponse: true - bootstrapMaxTokens: 1024 + bootstrapMaxTokens: 8192 instructionHint: true - id: redteam-tools diff --git a/presets/redteam/anchor-gate.mjs b/presets/redteam/anchor-gate.mjs index fef958c..43886c7 100644 --- a/presets/redteam/anchor-gate.mjs +++ b/presets/redteam/anchor-gate.mjs @@ -41,6 +41,8 @@ export function hasAnchoredReasoning(content) { export function decidePromotion(state, config) { if (state.toolCalled && config.anchorGate !== true) return true if (state.toolCalled && config.anchorGate === true && (state.anchored || state.steps >= config.maxBootstrapSteps)) return true + /* 红队指挥首轮必调工具;英文思考常写 I need 过不了 we 锚,但仍应在少量 step 后放开输出上限 */ + if (state.toolCalled && config.anchorGate === true && state.steps >= 1 && config.promoteAfterFirstResponse === true) return true if (state.toolCalled && config.anchorGate === true && config.promoteAfterFirstResponse === true && state.turnEnded) return true if (!state.toolCalled && state.responded && config.promoteAfterFirstResponse === true) return true return false diff --git a/release-notes.md b/release-notes.md index c279b0c..10cf8e8 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,3 +1,19 @@ +# 1.1.62 + +## 中文 + +- 版本 **1.1.62**。 +- 继续/重试重新打开。 +- 锚点门:首轮输出上限 1024→8192,最多 2 步;已调工具即放开,英文思考过不了 we 锚也不再卡住。 +- 已有预设的锚点配置与包内不一致时同步,不整份覆盖。 + +## English + +- **1.1.62**. +- Continue/retry is on again. +- Anchor gate: bootstrap cap 8192, max 2 steps; promote after the first tool call. +- Existing presets sync the anchor-gate block when it differs from the package. + # 1.1.61 ## 中文