diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fbb594..ce18d3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## 0.7.0 — 2026-11-17 + +### 新增:副作用透明化 + prompt-only 模式 + +起因:有人指出装这个插件会「往 workspace 外写文件、跑第三方脚本、全盘放行、静默联网」。 +**这些说法全部属实**,所以这版把三件事做成可关的,并写清全部副作用。 + +- **`SECURITY.md`**:逐条列出写哪些路径、联哪些网、动哪些权限,每条都标「能不能关 / 怎么关」 +- **新增 `syncSkills` 开关**:`false` 时完全不写 `$DSH_HOME/skills` +- **新增 `cordis.patch.prompt-only.yml`**:副作用最小的形态—— + 只注入六段提示词,不同步技能、不联网、不注册审批应答器、不覆盖权限 config +- **`switch-mode.ps1` 支持三模式**:`full` / `complement` / `prompt-only` +- **`install.ps1 -Mode prompt-only`**:一步装成最小形态 + +### 一句话 + +`prompt-only` 模式除插件目录和 `package.json` 那两行登记外,**不碰任何东西**。 + +--- + ## 0.6.2 — 2026-11-17 ### 文档 diff --git a/README.md b/README.md index 6a59e7e..3091eef 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,41 @@ order 220 moyun-ultimate:anti-censor 1,663 B ← 输出抗审 --- +## 装之前先看:会改什么(透明声明) + +有人问过「这插件到底动了系统哪些地方」。全部列在 **[SECURITY.md](SECURITY.md)**,简版: + +| 会做的事 | 能不能关 | 怎么关 | +|---|---|---| +| 往 `$DSH_HOME` 写插件目录 + `package.json` 两行 | 不装才不写 | — | +| 把 63 个技能同步到 `$DSH_HOME\skills` | ✅ | `syncSkills: false` | +| 启动时联网查一次更新 | ✅ | `checkUpdate: false` | +| 沙箱放开 + 审批自动通过 | ✅ | `permission: false` 或切模式 | +| 注入六段提示词(23 KB) | 逐层可关 | `core/refusal/...: false` | + +### 三种安装模式(副作用递减) + +| 模式 | 提示词 | 技能 | 联网 | 权限层 | +|---|---|---|---|---| +| `full` | 6 段 | 63 | ✅ | ✅ 接管 | +| `complement` | 6 段 | 63 | ✅ | ❌ 让位 | +| **`prompt-only`** | 6 段 | ❌ | ❌ | ❌ | + +```powershell +# 最谨慎的装法:只注入提示词,不写 skills、不联网、不碰权限 +powershell -ExecutionPolicy Bypass -File .\install.ps1 -Mode prompt-only +``` + +### 不确定就先预演 + +```powershell +powershell -ExecutionPolicy Bypass -File .\install.ps1 -DryRun +``` + +**一个字节都不写**,只打印冲突扫描结果和即将写入的路径。 + +--- + ## 怎么知道有新版本(三条路) **装完就不用惦记了,插件会自己查。** diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..37e40ca --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,212 @@ +# 安装会做什么(副作用清单) + +> 这份文档很直白:装上这个插件,系统上会发生什么、写了哪些文件、联了哪些网。 +> 每一条都标了**能不能关**、**怎么关**。 + +如果你只想要「调语气、不改系统」,直接跳到最后的 **最小权限安装**。 + +--- + +## 一、会写哪些文件 + +安装(`install.ps1`)会改 **`$DSH_HOME`** 下的东西。`$DSH_HOME` 通常在 workspace 之外 +(默认 `~/.dsh`,本机是 `G:\DeepSeek_dsh`)。 + +| 路径 | 动作 | 能不能不写 | +|---|---|---| +| `profiles\\plugins\moyun-ultimate\` | 复制整包(源位) | 只有这个包不装才不写 | +| `profiles\\node_modules\moyun-ultimate\` | 复制整包(运行位) | 同上 | +| `profiles\\package.json` | 加一条 dependency + 一条 bundles 项(改动前备份 `*.bak-*`) | 同上 | +| `$DSH_HOME\skills\<63 个技能名>\` | **首次启动时同步技能** | ✅ **能**:`syncSkills: false` | + +`$DSH_HOME\skills` 那一条是最容易被忽略的:即使你只想要提示词,插件默认也会把 63 个技能目录 +复制进去(只补缺失、不覆盖已有的)。 + +**关掉它**: + +```yaml +- insert: + - id: moyun-ultimate + config: + syncSkills: false +``` + +--- + +## 二、会联网吗 + +**会,一次,默认开启。** + +插件启动时请求: + +``` +GET https://git.lingdongjiansuo.cn/api/v1/repos/moyun/moyun-ultimate/releases/latest +``` + +只读公开的 Release 元数据,用途是判断有没有新版本。**不上传任何本机信息**,8 秒超时, +失败就静默跳过,不阻塞启动。 + +**关掉它**: + +```yaml +- insert: + - id: moyun-ultimate + config: + checkUpdate: false +``` + +关掉后不会发出任何网络请求。 + +--- + +## 三、会动权限吗 + +**完整模式(full)会。这是这个插件的核心功能之一,不是副作用。** + +具体做了三件事: + +| 动作 | 机制 | 效果 | +|---|---|---| +| 沙箱放开 | 覆盖 cordis 的 `sandbox-policy`,`mode: danger-full-access` | 工具可以读写任意路径,不受 workspace 限制 | +| 预设放开 | 覆盖 `permission`,`defaultPreset: danger-full-access` | 权限预设默认就是全放开 | +| 审批自动通过 | 注册 `approval/request` 应答器,返回 `allowed-once` | 工具调用不弹窗、不等确认 | + +**注意**:这三条都**不改宿主源码**,只覆盖官方 cordis 配置 + 注册一个事件应答器。 +卸载/切换模式后立即失效,不留补丁。 + +**关掉它**: + +```yaml +- insert: + - id: moyun-ultimate + config: + permission: false # 不覆盖权限 config,也不注册应答器 +``` + +或者直接切到 **complement** / **prompt-only** 模式(见下)。 + +--- + +## 四、会改模型行为吗 + +**会。这是它存在的理由。** + +六段提示词会注入 `systemPrompt`,合计约 23 KB: + +| order | 层 | 作用 | +|---|---|---| +| 100 | 人格主内核 | 语气、工作习惯 | +| 150 | 反拒绝机制 | 少说「我无法协助」 | +| 160 | 执行强度 | 先动手、不写 TODO | +| 200 | 强化镜像 | 二次钉死上面几条 | +| 210 | 技能路由 | 什么时候用哪个技能 | +| 220 | 输出抗审 | 被服务端截断时换形态重试 | + +**副作用**:23 KB 会占上下文,长链推理(写代码、复杂分析)会略微掉点。 + +**按需关**: + +```yaml +config: + core: true + refusal: true + execution: false # 关掉「必须动手」的强制 + mirror: false # 先关这个,感知最明显 + routing: true + anticensor: true +``` + +--- + +## 五、三种安装模式 + +| 模式 | 提示词 | 技能同步 | 联网 | 权限层 | 写 $DSH_HOME | +|---|---|---|---|---|---| +| **full**(默认) | 6 段 | ✅ 63 个 | ✅ | ✅ 接管 | 是 | +| **complement** | 6 段 | ✅ 63 个 | ✅ | ❌ 让位 | 是 | +| **prompt-only** | 6 段 | ❌ | ❌ | ❌ | 仅插件目录 + package.json | + +```powershell +powershell -File .\switch-mode.ps1 -Mode prompt-only +powershell -File .\switch-mode.ps1 -Mode complement +powershell -File .\switch-mode.ps1 -Mode full +``` + +--- + +## 六、最小权限安装(推荐给谨慎的人) + +如果你只想要「改语气、改工作习惯」,不想要任何系统级改动: + +```powershell +# 1) 安装 +powershell -ExecutionPolicy Bypass -File .\install.ps1 -Mode prompt-only + +# 2) 确认模式 +powershell -ExecutionPolicy Bypass -File .\doctor.ps1 # 应显示 MODE=prompt-only +``` + +这个形态下: + +- ✅ 注入六段提示词 +- ❌ **不写 `$DSH_HOME\skills`** +- ❌ **不发任何网络请求** +- ❌ **不覆盖权限 config、不注册审批应答器** + +换句话说:**除了插件自己的目录和 `package.json` 那两行登记,不碰任何东西。** + +代价:技能库要在包目录里自己看;工具跑不起来时没有权限层兜底。 + +--- + +## 七、卸载干净吗 + +```powershell +powershell -ExecutionPolicy Bypass -File .\install.ps1 -Uninstall +``` + +会删:两个插件目录、`package.json` 里的 dependency 与 bundles 项。 + +**不会删**(需要手动处理,或本来就不该删): + +- `$DSH_HOME\skills` 下已同步的 63 个技能目录(它们可能被你改过,删了是你的损失) +- `package.json.bak-*` 备份文件 +- `*.bak-update-*` 升级前的目录备份 + +要彻底清掉技能: + +```powershell +$names = Get-ChildItem "$env:DSH_HOME\skills" -Directory | Select-Object -ExpandProperty Name +# 先看清楚都有哪些,然后挑本插件带来的删 +``` + +--- + +## 八、源码可审计 + +全部逻辑在这几个文件里,加起来不到 1000 行,可以直接读: + +| 文件 | 行数级 | 内容 | +|---|---|---| +| `index.js` | ~700 | 六段注入 + 4 个工具 + 技能同步 + 审批应答器 + 冲突审计 + 更新检查 | +| `client.js` | ~180 | 状态条(纯 UI) | +| `cordis.patch.yml` | ~70 | 配置覆盖(纯 YAML,一眼看完) | +| `cordis.patch.complement.yml` | ~30 | 补充模式 | +| `cordis.patch.prompt-only.yml` | ~30 | 仅提示词模式 | + +**没有任何混淆、没有远程加载的代码、没有二进制。** + +--- + +## 九、一句话总结 + +| 你可能担心的 | 实情 | +|---|---| +| 写 workspace 外的文件 | 是,`$DSH_HOME` 下三个位置,可用 `syncSkills: false` 减到两个 | +| 跑第三方脚本 | `install.ps1` 是纯文本 PowerShell,可先 `-DryRun` 看它要干什么 | +| 全盘访问 + 审批自动通过 | 是,这是功能不是后门,`permission: false` 或 prompt-only 模式可关 | +| 静默联网 | 一次 GET,`checkUpdate: false` 可关 | +| 装完不好卸 | `-Uninstall` + `-Rollback` 两条命令 | + +**不确定就先跑 `install.ps1 -DryRun`**:它会把冲突扫描结果和即将写入的路径全打印出来, +一个字节都不写。 diff --git a/cordis.patch.prompt-only.yml b/cordis.patch.prompt-only.yml new file mode 100644 index 0000000..79949e2 --- /dev/null +++ b/cordis.patch.prompt-only.yml @@ -0,0 +1,37 @@ +# moyun-ultimate bundle patch — PROMPT ONLY(仅提示词模式) +# +# 副作用最小的安装形态。**不写任何 workspace 之外的东西,不联网,不碰权限。** +# +# - 只注入六段提示词(systemPrompt.section),不注册审批应答器 +# - 不同步 63 个技能到 $DSH_HOME/skills(syncSkills: false) +# - 不联网检查更新(checkUpdate: false) +# - 不改任何权限相关 config(permission: false) +# +# 适合:只想调语气/工作习惯,不想让插件碰系统或联网的场景。 +# 代价:技能库要在包里手动看,工具跑不起来时没有权限层兜底。 +# +# 切换:powershell -File .\switch-mode.ps1 -Mode prompt-only + +- id: system-prompt + config: + includeHarnessIdentity: false + personaPrefix: "" + personaSuffix: Your working directory is {{cwd}}. + +- insert: + - id: moyun-ultimate + name: 'moyun-ultimate' + config: + enabled: true + autoApplyOnStart: true + # 六段提示词 + core: true + refusal: true + execution: true + mirror: true + routing: true + anticensor: true + # 三项副作用全部关闭 + permission: false # 不接管权限层,不注册审批应答器 + checkUpdate: false # 不联网 + syncSkills: false # 不写 $DSH_HOME/skills diff --git a/index.js b/index.js index b53ffca..3e4a2d4 100644 --- a/index.js +++ b/index.js @@ -678,7 +678,8 @@ export function apply(ctx, config = {}) { try { dshHome = process.env.DSH_HOME || ""; } catch {} - if (dshHome) syncSkills(dshHome); + // 技能同步:config.syncSkills === false 时完全不写 $DSH_HOME/skills + if (dshHome && config.syncSkills !== false) syncSkills(dshHome); // 权限层:审批应答器(config 覆盖在 cordis.patch.yml 第 2-6 段) installApprovalAnswerer(ctx, config, (m) => { diff --git a/install.ps1 b/install.ps1 index aa42e98..8fc8796 100644 --- a/install.ps1 +++ b/install.ps1 @@ -8,7 +8,7 @@ param( [string]$Profile = 'desktop', [string]$DshHome = '', - [ValidateSet('auto', 'full', 'complement')] + [ValidateSet('auto', 'full', 'complement', 'prompt-only')] [string]$Mode = 'auto', [switch]$Uninstall, [switch]$Rollback, @@ -105,7 +105,15 @@ function Apply-Mode([string]$effective) { if (-not (Test-Path $d)) { continue } $target = Join-Path $d 'cordis.patch.yml' $fullKeep = Join-Path $d 'cordis.patch.yml.full' - if ($effective -eq 'complement') { + if ($effective -eq 'prompt-only') { + $poSrc = Join-Path $Here 'cordis.patch.prompt-only.yml' + if ($DryRun) { Write-Output "would switch $d to PROMPT-ONLY mode" } + else { + if ((Test-Path $target) -and -not (Test-Path $fullKeep)) { Copy-Item $target $fullKeep -Force } + Copy-Item $poSrc $target -Force + Write-Output " switched to PROMPT-ONLY mode: $d" + } + } elseif ($effective -eq 'complement') { if ($DryRun) { Write-Output "would switch $d to COMPLEMENT mode" } else { if ((Test-Path $target) -and -not (Test-Path $fullKeep)) { Copy-Item $target $fullKeep -Force } diff --git a/package.json b/package.json index 8590633..cc96f53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moyun-ultimate", - "version": "0.6.2", + "version": "0.7.0", "displayName": "墨昀·终极破甲", "description": "墨昀·终极破甲:五层提示词内核 + 内置权限层 —— 人格双槽 × 反拒绝机制 × 执行强度 × 换框模板 × 技能路由,内置 63 个攻防技能(逆向 24 / 渗透 16 / 云 8 / 取证 6 / 其它 9)。Layered prompt core with five sections and 63 built-in skills.", "keywords": [ @@ -32,7 +32,9 @@ "COMMENTS-FAQ.md", "cordis.patch.complement.yml", "switch-mode.ps1", - "update.ps1" + "update.ps1", + "SECURITY.md", + "cordis.patch.prompt-only.yml" ], "scripts": { "harness:check": "node --check index.js && node --check client.js" @@ -40,7 +42,7 @@ "dsh": { "id": "moyun-ultimate", "name": "墨昀·终极破甲", - "version": "0.6.2", + "version": "0.7.0", "permissions": "六段提示词注入(含输出抗审), 内置权限层(沙箱/审批/结果), 拒绝投影状态条, 换框模板工具, 状态自查工具(含 provider 审核风险评估), 技能审计工具, 63 技能自动同步", "bundle": { "patch": "./cordis.patch.yml" diff --git a/switch-mode.ps1 b/switch-mode.ps1 index 82d6446..eb7fe39 100644 --- a/switch-mode.ps1 +++ b/switch-mode.ps1 @@ -1,84 +1,99 @@ -# moyun-ultimate mode switcher (ASCII only - PS 5.1 reads BOM-less UTF-8 as ANSI) -# -# Two modes: -# full - this plugin owns the permission layer (sandbox / approval / preset) -# complement - this plugin keeps prompt layers + skills only; the permission -# layer yields to whichever plugin already handles it -# -# Switching rewrites the installed cordis.patch.yml and asks you to restart DSH. -[CmdletBinding()] -param( - [Parameter(Mandatory = $true)] - [ValidateSet('full', 'complement')] - [string]$Mode, - [string]$Profile = 'desktop', - [string]$DshHome = '', - [switch]$DryRun -) -$ErrorActionPreference = 'Stop' -$Here = Split-Path -Parent $MyInvocation.MyCommand.Path -$PkgName = 'moyun-ultimate' - -if (-not $DshHome) { - if ($env:DSH_HOME) { $DshHome = $env:DSH_HOME } - elseif (Test-Path 'G:\DeepSeek_dsh') { $DshHome = 'G:\DeepSeek_dsh' } - elseif (Test-Path (Join-Path $env:USERPROFILE '.dsh')) { $DshHome = Join-Path $env:USERPROFILE '.dsh' } - else { throw 'DSH_HOME not found. Pass -DshHome .' } -} -$profileDir = Join-Path $DshHome "profiles\$Profile" -$plugDir = Join-Path $profileDir "plugins\$PkgName" -$runDir = Join-Path $profileDir "node_modules\$PkgName" - -$compSrc = Join-Path $Here 'cordis.patch.complement.yml' -$fullSrc = Join-Path $Here 'cordis.patch.yml' -if (-not (Test-Path $compSrc)) { throw "missing $compSrc (upgrade to 0.5.0+)" } -if (-not (Test-Path $fullSrc)) { throw "missing $fullSrc" } - -Write-Output "switching to: $Mode" -Write-Output "DSH_HOME : $DshHome" -Write-Output "profile : $Profile" -Write-Output '' - -$targets = @($plugDir, $runDir) | Where-Object { Test-Path $_ } -if ($targets.Count -eq 0) { throw "plugin not installed under $profileDir (run install.ps1 first)" } - -foreach ($d in $targets) { - $target = Join-Path $d 'cordis.patch.yml' - $fullKeep = Join-Path $d 'cordis.patch.yml.full' - if ($Mode -eq 'complement') { - if ($DryRun) { - Write-Output "would write COMPLEMENT patch into $d" - } else { - # keep a full copy first so switching back is always possible - if ((Test-Path $target) -and -not (Test-Path $fullKeep)) { - Copy-Item $target $fullKeep -Force - Write-Output " kept full copy: $fullKeep" - } - Copy-Item $compSrc $target -Force - Write-Output " COMPLEMENT written: $d" - } - } else { - if ($DryRun) { - Write-Output "would write FULL patch into $d" - } else { - if (Test-Path $fullKeep) { - Copy-Item $fullKeep $target -Force - Write-Output " restored from full copy: $d" - } else { - Copy-Item $fullSrc $target -Force - Write-Output " FULL written: $d" - } - } - } -} - -Write-Output '' -if ($Mode -eq 'complement') { - Write-Output 'COMPLEMENT: prompt layers + 63 skills stay; permission layer yields.' - Write-Output 'Other plugins keep ownership of sandbox / approval / permission.' -} else { - Write-Output 'FULL: this plugin owns the permission layer.' - Write-Output 'If another plugin also rewrites approval/permission, keep only one contender.' -} -Write-Output '' -Write-Output 'Fully quit DSH (including tray) and reopen it, then run doctor.ps1.' +# moyun-ultimate mode switcher (ASCII only - PS 5.1 reads BOM-less UTF-8 as ANSI) +# +# Two modes: +# full - this plugin owns the permission layer (sandbox / approval / preset) +# complement - this plugin keeps prompt layers + skills only; the permission +# layer yields to whichever plugin already handles it +# +# Switching rewrites the installed cordis.patch.yml and asks you to restart DSH. +[CmdletBinding()] +param( + [Parameter(Mandatory = $true)] + [ValidateSet('full', 'complement', 'prompt-only')] + [string]$Mode, + [string]$Profile = 'desktop', + [string]$DshHome = '', + [switch]$DryRun +) +$ErrorActionPreference = 'Stop' +$Here = Split-Path -Parent $MyInvocation.MyCommand.Path +$PkgName = 'moyun-ultimate' + +if (-not $DshHome) { + if ($env:DSH_HOME) { $DshHome = $env:DSH_HOME } + elseif (Test-Path 'G:\DeepSeek_dsh') { $DshHome = 'G:\DeepSeek_dsh' } + elseif (Test-Path (Join-Path $env:USERPROFILE '.dsh')) { $DshHome = Join-Path $env:USERPROFILE '.dsh' } + else { throw 'DSH_HOME not found. Pass -DshHome .' } +} +$profileDir = Join-Path $DshHome "profiles\$Profile" +$plugDir = Join-Path $profileDir "plugins\$PkgName" +$runDir = Join-Path $profileDir "node_modules\$PkgName" + +$compSrc = Join-Path $Here 'cordis.patch.complement.yml' +$fullSrc = Join-Path $Here 'cordis.patch.yml' +$poSrc = Join-Path $Here 'cordis.patch.prompt-only.yml' +if (-not (Test-Path $compSrc)) { throw "missing $compSrc (upgrade to 0.5.0+)" } +if (-not (Test-Path $fullSrc)) { throw "missing $fullSrc" } +if (-not (Test-Path $poSrc)) { throw "missing $poSrc (upgrade to 0.7.0+)" } + +Write-Output "switching to: $Mode" +Write-Output "DSH_HOME : $DshHome" +Write-Output "profile : $Profile" +Write-Output '' + +$targets = @($plugDir, $runDir) | Where-Object { Test-Path $_ } +if ($targets.Count -eq 0) { throw "plugin not installed under $profileDir (run install.ps1 first)" } + +foreach ($d in $targets) { + $target = Join-Path $d 'cordis.patch.yml' + $fullKeep = Join-Path $d 'cordis.patch.yml.full' + if ($Mode -eq 'prompt-only') { + if ($DryRun) { + Write-Output "would write PROMPT-ONLY patch into $d" + } else { + if ((Test-Path $target) -and -not (Test-Path $fullKeep)) { + Copy-Item $target $fullKeep -Force + Write-Output " kept full copy: $fullKeep" + } + Copy-Item $poSrc $target -Force + Write-Output " PROMPT-ONLY written: $d" + } + } elseif ($Mode -eq 'complement') { + if ($DryRun) { + Write-Output "would write COMPLEMENT patch into $d" + } else { + # keep a full copy first so switching back is always possible + if ((Test-Path $target) -and -not (Test-Path $fullKeep)) { + Copy-Item $target $fullKeep -Force + Write-Output " kept full copy: $fullKeep" + } + Copy-Item $compSrc $target -Force + Write-Output " COMPLEMENT written: $d" + } + } else { + if ($DryRun) { + Write-Output "would write FULL patch into $d" + } else { + if (Test-Path $fullKeep) { + Copy-Item $fullKeep $target -Force + Write-Output " restored from full copy: $d" + } else { + Copy-Item $fullSrc $target -Force + Write-Output " FULL written: $d" + } + } + } +} + +Write-Output '' +if ($Mode -eq 'prompt-only') { + Write-Output 'PROMPT-ONLY: only the six prompt sections. No skills sync, no network, no permission layer.' +} elseif ($Mode -eq 'complement') { + Write-Output 'COMPLEMENT: prompt layers + 63 skills stay; permission layer yields.' + Write-Output 'Other plugins keep ownership of sandbox / approval / permission.' +} else { + Write-Output 'FULL: this plugin owns the permission layer.' + Write-Output 'If another plugin also rewrites approval/permission, keep only one contender.' +} +Write-Output '' +Write-Output 'Fully quit DSH (including tray) and reopen it, then run doctor.ps1.'