diff --git a/.gitignore b/.gitignore index 6078671..df50512 100644 --- a/.gitignore +++ b/.gitignore @@ -6,9 +6,13 @@ npm-debug.log* .DS_Store Thumbs.db +# 只给本机 Cursor 技能看,不进仓库 +docs/agents/ + # 本地草稿,不进仓库 scripts/tmp-*.mjs scripts/test-*.mjs +.scratch/ dsh-redteam-mode-main/ # 外部参考,不是本插件 diff --git a/README.md b/README.md index 429ca77..464a297 100644 --- a/README.md +++ b/README.md @@ -132,12 +132,11 @@ The plugin version is **1.1.55**. 1.1.45 is skipped; it has bugs. ## Install -Web, community Desktop, and the official desktop EXE are **installed and patched separately**. Install only the host you have open. The host must be **dsh 0.2**. +Only official `dsh web` and the official desktop EXE are maintained. Install and patch them **separately**. Install only the host you have open. The host must be **dsh 0.2**. Community Desktop is not maintained; ask for it in one issue. | What you run | Profile | Go to | |---|---|---| | Official `dsh web` | `web` | [Web](#web) | -| Community [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) | `desktop` | [Community Desktop](#desktop) | | Official Harness desktop EXE | `default` | [Official desktop EXE](#official-exe) | If `dsh` is not on PATH, or you do not want a remote install, use [Manual install](#manual). @@ -148,7 +147,7 @@ Adding the plugin to a profile does **not** patch `@deepseek-ai` by itself. 1. **Quit and reopen** the host you just installed into. Stop `dsh web` and start it again, or quit the Desktop tray and open that app's exe. 2. On **that host**, click **dsh-purge** beside the session title, then click **Apply** on the **Clean** page. This plugin does not appear on the host Settings page. -3. **Restart once more** when prompted. Patched files load on that next start. Restart happens only when you click it. +3. A successful **Apply** restarts once so the patches load. Apply does not restart when it did not finish. Web **Apply / Restart / Uninstall** affect Web only. Desktop controls affect the desktop app only and do not launch `dsh web`. Do not Apply one host from the other. @@ -176,50 +175,13 @@ Then follow the three steps above. Click **dsh-purge** beside the session title ### Community Desktop -Open [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) and run this in the **built-in terminal**. That `dsh` is the desktop wrapper; its default profile is `desktop`. - -```sh -dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz -``` - -Do not use official `dsh plugin --profile desktop` on PATH (it is rejected). Do not use `dsh://` (that protocol belongs to the official EXE). - -Then quit the tray, reopen `DSH Desktop.exe`, click **dsh-purge** beside the session title, and **Apply** on **Clean**. - -For a custom install folder, set `$exe` in the script to `DSH Desktop.exe` in that folder. The tarball URL is the source so a local path with spaces cannot split the command. - -
-Install from system PowerShell - -Find `DSH Desktop.exe` from the running process or the default locations below. Do not scan the whole disk. - -```powershell -$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz" -$exe = (Get-Process -Name "DSH Desktop" -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty Path) -if (-not $exe) { - $exe = @( - "$env:LOCALAPPDATA\Programs\DSH Desktop\DSH Desktop.exe", - "$env:ProgramFiles\DSH Desktop\DSH Desktop.exe", - "${env:ProgramFiles(x86)}\DSH Desktop\DSH Desktop.exe" - ) | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1 -} -if (-not $exe) { throw "DSH Desktop.exe not found. Start the app, or set `$exe` to the exe in the install folder." } -$cli = @( - (Join-Path (Split-Path $exe) "resources\app\lib\desktop-cli.js"), - (Join-Path (Split-Path $exe) "resources\app.asar.unpacked\lib\desktop-cli.js") -) | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1 -$env:ELECTRON_RUN_AS_NODE = "1" -$env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop" -& $exe --expose-internals $cli plugin add $zip -``` - -
+Not maintained. Only official Web and the official desktop EXE are supported. If you want the community build later, open one issue. Do not mix that into this behavior. ### Official desktop EXE -If the **official DeepSeek Harness desktop client** is installed, use the command or the button (`dsh://`). Community DSH Desktop does **not** handle that protocol — use the previous section. Current support is **0.2.0-rc.2** only. +If the **official DeepSeek Harness desktop client** is installed, use the command or the button (`dsh://`). Community Desktop is not maintained; do not use this protocol to install it. Current support is **0.2.0-rc.2** only. ```sh dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz @@ -318,37 +280,9 @@ dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/re If this directory is already a clone, use `dsh plugin --profile web add .`. -**Desktop (community DSH Desktop)** +**Community Desktop** -Do not use official `dsh plugin --profile desktop` on PATH. Do not use `dsh://`. - -Default: already inside Desktop’s built-in terminal: - -```sh -dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz -``` - -From a system terminal: use the running `DSH Desktop` process Path, or the default locations `%LOCALAPPDATA%\Programs\DSH Desktop\DSH Desktop.exe`, `%ProgramFiles%\DSH Desktop\DSH Desktop.exe`. Do not scan the whole disk. Then: - -```powershell -$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz" -$exe = (Get-Process -Name "DSH Desktop" -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty Path) -if (-not $exe) { - $exe = @( - "$env:LOCALAPPDATA\Programs\DSH Desktop\DSH Desktop.exe", - "$env:ProgramFiles\DSH Desktop\DSH Desktop.exe", - "${env:ProgramFiles(x86)}\DSH Desktop\DSH Desktop.exe" - ) | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1 -} -if (-not $exe) { Write-Host "DSH Desktop.exe not found. Start the app or give the install folder."; return } -$cli = @( - (Join-Path (Split-Path $exe) "resources\app\lib\desktop-cli.js"), - (Join-Path (Split-Path $exe) "resources\app.asar.unpacked\lib\desktop-cli.js") -) | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1 -$env:ELECTRON_RUN_AS_NODE = "1" -$env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop" -& $exe --expose-internals $cli plugin add $zip -``` +Not maintained. Do not install it. Ask for it in one issue. **Official Harness desktop EXE** @@ -372,9 +306,8 @@ Use this when the command fails, `dsh` is not on `PATH`, or you do not want a re | What you actually run | Edit only this directory | Leave alone | |---|---|---| -| Official `dsh web` | `$DSH_HOME/profiles/web` | `desktop`, `default` | -| Community [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) | `$DSH_HOME/profiles/desktop` | `web`, `default` | -| Official Harness desktop EXE | `$DSH_HOME/profiles/default` | `web`, `desktop` | +| Official `dsh web` | `$DSH_HOME/profiles/web` | `default` | +| Official Harness desktop EXE | `$DSH_HOME/profiles/default` | `web` | If `profiles//package.json` is missing, start that host once so the official program creates the profile, then continue. @@ -416,8 +349,8 @@ $cands | Select-Object -Unique | Where-Object { $_ -and (Test-Path (Join-Path $_ How to confirm you found the right one: - Web: `$DSH_HOME/profiles/web/package.json` has `"name": "dsh-profile-web"` -- Community Desktop: `$DSH_HOME/profiles/desktop/package.json` has `"name": "dsh-profile-desktop"` - Official EXE: `$DSH_HOME/profiles/default/package.json` exists +- Community Desktop is not maintained. Do not edit `profiles/desktop` Machines often have two homes (user folder and install folder). A portable / install-dir official `dsh` uses the `.dsh` next to the install root — not an empty `%USERPROFILE%\.dsh`. After the steps below, start the host that belongs to that home. @@ -468,7 +401,6 @@ Check: `$DSH_HOME/plugins/dsh-purge/package.json` opens and `"name": "dsh-purge" | Host | File to edit | |---|---| | Web | `$DSH_HOME/profiles/web/package.json` | -| Community Desktop | `$DSH_HOME/profiles/desktop/package.json` | | Official desktop EXE | `$DSH_HOME/profiles/default/package.json` | Copy `package.json.bak` first. Then **add only two things**. Keep every existing dependency, bundle, and other field: @@ -529,15 +461,12 @@ Notes: **4. Run `pnpm install` only in the profile you just edited** -`pnpm` must be available (official `dsh` usually ships it). `cd` into **that profile directory**, not the repo root and not `$DSH_HOME` itself. Run only the block for your host. Do not run all three. +`pnpm` must be available (official `dsh` usually ships it). `cd` into **that profile directory**, not the repo root and not `$DSH_HOME` itself. Run only the block for your host. Do not run both. ```sh cd "$DSH_HOME/profiles/web" pnpm install -cd "$DSH_HOME/profiles/desktop" -pnpm install - cd "$DSH_HOME/profiles/default" pnpm install ``` @@ -553,7 +482,7 @@ cd "$env:USERPROFILE\.dsh\profiles\web" pnpm install ``` -Success: `$DSH_HOME/profiles//node_modules/dsh-purge/package.json` exists. +Success: `$DSH_HOME/profiles//node_modules/dsh-purge/package.json` exists. Common failures: @@ -565,10 +494,10 @@ Common failures: Writing `package.json` does **not** patch `@deepseek-ai` by itself. Restart, then click **Apply**. -1. Fully quit the host you just installed into: stop `dsh web`; quit the community Desktop tray and open `DSH Desktop.exe`; quit the official EXE tray as well +1. Fully quit the host you just installed into: stop `dsh web`, or quit the official EXE tray 2. Open **that host**. **dsh-purge** should appear beside the session title. Open it to reach Clean. 3. Click **Apply** on this host only, or run `/purge apply` in chat. Do not Apply Web from Desktop or Desktop from Web -4. Restart again when prompted so patched packages load in this process. Settings **Restart / Uninstall** relaunch the desktop app; they do not launch `dsh web` +4. A successful Apply restarts once so patched packages load. Apply does not restart when it did not finish. Official desktop **Restart / Uninstall** relaunch only the official desktop; they do not launch `dsh web` **6. How to confirm it is installed** @@ -580,7 +509,7 @@ If the card is missing, you likely edited the other `.dsh`, or you edited `web` ### Uninstall -**dsh-purge** beside the session title → **Clean** → **Uninstall**. Confirm the dialog: uninstall restores the original Harness and removes this plugin. If patches were applied, they are reverted first. The current host then restarts (Web relaunches `dsh web`; community Desktop relaunches `DSH Desktop.exe`). +**dsh-purge** beside the session title → **Clean** → **Uninstall**. Confirm the dialog: uninstall restores the original Harness and removes this plugin. If patches were applied, they are reverted first. The current host then restarts (Web relaunches `dsh web`; the official desktop relaunches the official client). ```sh # or from a terminal @@ -810,13 +739,9 @@ The host surface is detected first: `web` / `desktop` (`gui` / `tui` are reserve 4. Nested `@deepseek-ai/dsh/node_modules/@deepseek-ai` 5. `~/.dsh` -**Community DSH Desktop:** only the **running desktop process** install tree (`resources/app` or `app.asar.unpacked` → `@deepseek-ai`). The folder does not have to be named `DSH Desktop`, and the drive letter is not hard-coded. Order: +**Official desktop EXE:** the running official Harness install (`resources/app` or the unpacked package). The drive letter is not hard-coded. A successful Apply restarts once. -1. Running `DSH Desktop.exe` / `process.resourcesPath` / `host-process-entry.js` / `desktop-cli.js` -2. A `resources/app` tree whose parent folder actually contains `DSH Desktop.exe` -3. A path whose name contains `DSH Desktop` / `dsh-desktop` -4. `DSH_DESKTOP_INSTALL` (install root) or `DSH_BASE` (`@deepseek-ai` under that tree) -5. Common NSIS locations (`%LOCALAPPDATA%\Programs\DSH Desktop`, `%ProgramFiles%\DSH Desktop`, …) +Community Desktop is not maintained. Official npm-global is not patched. Sealed `host-commands` / `runtime-commands` are scrubbed, never injected. diff --git a/README.zh-CN.md b/README.zh-CN.md index ebad0c1..7d4b0ce 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -132,12 +132,11 @@ Harness 不只是把问题交给模型。它还会在运行时改提示词、审 ## 安装 -Web、社区桌面端、官方桌面 EXE **分开装、分开应用**。只装你正在打开的那一个。必须是 **dsh 0.2**。 +现在只维护官方 `dsh web` 和官方桌面 EXE,**分开装、分开应用**。只装你正在打开的那一个。必须是 **dsh 0.2**。社区桌面端暂不维护;需要的话请单独开一个 issue。 | 你正在用 | profile | 安装 | |---|---|---| | 官方 `dsh web` | `web` | [Web](#web) | -| 社区 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) | `desktop` | [社区桌面端](#desktop) | | 官方 Harness 桌面 EXE | `default` | [官方桌面 EXE](#official-exe) | `dsh` 不在 PATH、或不想走远程安装时,用 [手动安装](#manual)。 @@ -148,7 +147,7 @@ Web、社区桌面端、官方桌面 EXE **分开装、分开应用**。只装 1. **退出并重新打开**刚装的那个宿主。Web 关掉 `dsh web` 再开;桌面端退出托盘,再打开对应的 exe。 2. 点会话标题旁的 **dsh-purge**,在右侧栏的 **清洗** 里点 **「应用」**。宿主的设置页里没有这个条目。 -3. 按提示 **再重启一次**。补丁这时才进入当前进程。点「重启」才会重启,不会装完自动重启。 +3. 点「应用」成功后会自动重启一次,让补丁进入当前进程。应用没做完不会重启。 > **macOS 官方桌面**:点「应用」会解开 `app.asar`。本插件会自动修补官方 `dsh` CLI 入口(asar / `app/` 双向兼容)并补上 `app/runtime` 链接;若你仍看到 `MODULE_NOT_FOUND ... app.asar/.../cli.js`,再点一次「应用」,或重装 Harness。 @@ -176,50 +175,13 @@ dsh plugin --profile web add . ### 社区桌面端 -打开 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop),在 **自带终端** 里执行。这里的 `dsh` 是桌面包装脚本,默认 profile 就是 `desktop`。 - -```sh -dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz -``` - -不要用 PATH 上的官方 `dsh plugin --profile desktop`,这条会被拒绝。不要用 `dsh://`,那是官方 EXE 的协议。 - -然后退出托盘,重新打开 `DSH Desktop.exe`,点会话标题旁的 **dsh-purge**,在 **清洗** 里点「应用」。 - -自定义安装目录时,把脚本里的 `$exe` 换成该目录下的 `DSH Desktop.exe`。源用 tar.gz 地址,避免本地路径里的空格把命令拆开。 - -
-从系统 PowerShell 安装 - -按正在运行的进程,或下面三个默认位置找 `DSH Desktop.exe`。不要全盘搜索。 - -```powershell -$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz" -$exe = (Get-Process -Name "DSH Desktop" -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty Path) -if (-not $exe) { - $exe = @( - "$env:LOCALAPPDATA\Programs\DSH Desktop\DSH Desktop.exe", - "$env:ProgramFiles\DSH Desktop\DSH Desktop.exe", - "${env:ProgramFiles(x86)}\DSH Desktop\DSH Desktop.exe" - ) | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1 -} -if (-not $exe) { throw "未找到 DSH Desktop.exe,请先打开桌面端,或把 `$exe` 设成安装目录里的 exe" } -$cli = @( - (Join-Path (Split-Path $exe) "resources\app\lib\desktop-cli.js"), - (Join-Path (Split-Path $exe) "resources\app.asar.unpacked\lib\desktop-cli.js") -) | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1 -$env:ELECTRON_RUN_AS_NODE = "1" -$env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop" -& $exe --expose-internals $cli plugin add $zip -``` - -
+暂不维护。当前只支持官方 Web 和官方桌面 EXE。以后若要社区版,请单独开一个 issue,不要和这次的行为混在一起。 ### 官方桌面 EXE -已经安装 **DeepSeek Harness 官方桌面客户端** 时,用下面的命令,或点按钮走 `dsh://`。社区 DSH Desktop **不认** 这个协议,请回到上一节。当前只适配 **0.2.0-rc.2**。 +已经安装 **DeepSeek Harness 官方桌面客户端** 时,用下面的命令,或点按钮走 `dsh://`。社区桌面端不维护,不要用这个协议去装它。当前只适配 **0.2.0-rc.2**。 ```sh dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz @@ -318,37 +280,9 @@ dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/re 当前目录已是本仓库时改用 `dsh plugin --profile web add .`。 -**桌面端(社区 DSH Desktop)** +**社区桌面端** -不要用 PATH 上的官方 `dsh plugin --profile desktop`。不要用 `dsh://`。 - -默认:已在桌面端自带终端里时直接跑: - -```sh -dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz -``` - -从系统终端安装时:用正在运行的 `DSH Desktop` 进程 Path,或默认位置 `%LOCALAPPDATA%\Programs\DSH Desktop\DSH Desktop.exe`、`%ProgramFiles%\DSH Desktop\DSH Desktop.exe`。不要全盘扫描。然后: - -```powershell -$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz" -$exe = (Get-Process -Name "DSH Desktop" -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty Path) -if (-not $exe) { - $exe = @( - "$env:LOCALAPPDATA\Programs\DSH Desktop\DSH Desktop.exe", - "$env:ProgramFiles\DSH Desktop\DSH Desktop.exe", - "${env:ProgramFiles(x86)}\DSH Desktop\DSH Desktop.exe" - ) | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1 -} -if (-not $exe) { Write-Host "未找到 DSH Desktop.exe,请先打开桌面端或给出安装目录"; return } -$cli = @( - (Join-Path (Split-Path $exe) "resources\app\lib\desktop-cli.js"), - (Join-Path (Split-Path $exe) "resources\app.asar.unpacked\lib\desktop-cli.js") -) | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1 -$env:ELECTRON_RUN_AS_NODE = "1" -$env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop" -& $exe --expose-internals $cli plugin add $zip -``` +暂不维护。不要安装。需要的话请单独开一个 issue。 **官方 Harness 桌面 EXE** @@ -372,9 +306,8 @@ dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archiv | 你实际在用的 | 只改这个目录 | 不要改 | |---|---|---| -| 官方 `dsh web` | `$DSH_HOME/profiles/web` | `desktop`、`default` | -| 社区 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) | `$DSH_HOME/profiles/desktop` | `web`、`default` | -| 官方 Harness 桌面 EXE | `$DSH_HOME/profiles/default` | `web`、`desktop` | +| 官方 `dsh web` | `$DSH_HOME/profiles/web` | `default` | +| 官方 Harness 桌面 EXE | `$DSH_HOME/profiles/default` | `web` | 对应 `profiles/<名>/package.json` 还不存在时,先正常启动一次该宿主,让官方程序自己建好 profile,再继续。 @@ -416,8 +349,8 @@ $cands | Select-Object -Unique | Where-Object { $_ -and (Test-Path (Join-Path $_ 怎么确认找对了: - Web:`$DSH_HOME/profiles/web/package.json` 里 `"name"` 是 `dsh-profile-web` -- 社区桌面端:`$DSH_HOME/profiles/desktop/package.json` 里 `"name"` 是 `dsh-profile-desktop` - 官方 EXE:`$DSH_HOME/profiles/default/package.json` 存在 +- 社区桌面端暂不维护,不要改 `profiles/desktop` 本机常有两份 `.dsh`(用户目录一份、安装目录一份)。便携包、安装目录里的官方 `dsh` **用安装根下那份**,不要改到空的 `%USERPROFILE%\.dsh`。改完下面步骤后,启动的必须是这份主目录对应的宿主。 @@ -468,7 +401,6 @@ Rename-Item $src "dsh-purge" | 宿主 | 要改的文件 | |---|---| | Web | `$DSH_HOME/profiles/web/package.json` | -| 社区桌面端 | `$DSH_HOME/profiles/desktop/package.json` | | 官方桌面 EXE | `$DSH_HOME/profiles/default/package.json` | 先复制一份 `package.json.bak`。然后**只追加两处**,原有依赖、原有 bundle、其它字段全部留着: @@ -529,15 +461,12 @@ Rename-Item $src "dsh-purge" **4. 只在刚改的那个 profile 目录装依赖** -本机要有 `pnpm`(官方 dsh 一般自带)。进入**上一步改过的那个** profile 目录再执行,不要在仓库根目录、也不要在 `$DSH_HOME` 根目录执行。下面三条命令只跑和你宿主对应的一条,不要三个连着跑。 +本机要有 `pnpm`(官方 dsh 一般自带)。进入**上一步改过的那个** profile 目录再执行,不要在仓库根目录、也不要在 `$DSH_HOME` 根目录执行。下面两条命令只跑和你宿主对应的一条,不要连着跑。 ```sh cd "$DSH_HOME/profiles/web" # Web pnpm install -cd "$DSH_HOME/profiles/desktop" # 社区桌面端 -pnpm install - cd "$DSH_HOME/profiles/default" # 官方 EXE pnpm install ``` @@ -553,7 +482,7 @@ cd "$env:USERPROFILE\.dsh\profiles\web" pnpm install ``` -成功标志:出现 `$DSH_HOME/profiles//node_modules/dsh-purge/package.json`。 +成功标志:出现 `$DSH_HOME/profiles//node_modules/dsh-purge/package.json`。 常见失败: @@ -565,10 +494,10 @@ pnpm install 只写入 `package.json` **还不会**改 `@deepseek-ai` 包,必须重启后再点「应用」。 -1. 完全退出刚装的那个宿主:Web 关掉 `dsh web`;社区桌面端退出托盘再开 `DSH Desktop.exe`;官方 EXE 也要退出托盘 +1. 完全退出刚装的那个宿主:Web 关掉 `dsh web`;官方 EXE 退出托盘 2. 打开**这个宿主**,会话标题旁应出现 **dsh-purge**。点开后是「清洗」。 3. 只在这个宿主点「应用」,或聊天 `/purge apply`。不要用 Web 去点桌面端的应用,也不要反过来 -4. 按提示再重启一次,补丁才会进当前进程。桌面端的「重启 / 卸载」会重启桌面应用,不会去拉 `dsh web` +4. 应用成功后会自动重启一次,补丁才会进当前进程。应用没做完不会重启。官方桌面的「重启 / 卸载」只重启官方桌面,不会去拉 `dsh web` **6. 怎么确认装上了** @@ -580,7 +509,7 @@ pnpm install ### 卸载 -会话标题旁的 **dsh-purge** →「清洗」→「卸载」。弹窗确认:卸载将还原回原版并清除本插件。如果已经点过「应用」,会先还原补丁,再删插件文件,然后重启当前宿主(Web 重启 `dsh web`;桌面端重启 `DSH Desktop.exe`)。 +会话标题旁的 **dsh-purge** →「清洗」→「卸载」。弹窗确认:卸载将还原回原版并清除本插件。如果已经点过「应用」,会先还原补丁,再删插件文件,然后重启当前宿主(Web 重启 `dsh web`;官方桌面重启官方客户端)。 ```sh # 也可以用命令行 @@ -813,7 +742,7 @@ flowchart LR 4. 嵌套 `@deepseek-ai/dsh/node_modules/@deepseek-ai` 5. 系统默认 `~/.dsh` -**桌面端:** 只改当前正在运行的桌面安装。官方客户端点「应用」即可(成功后会自动重启)。社区端点「应用」,然后重启即可。 +**官方桌面:** 只改当前正在运行的官方桌面安装。点「应用」成功后会自动重启一次。社区桌面端不维护。 找不到目标时提示设置 `DSH_BASE`,不改文件。 diff --git a/bin/dsh-purge.js b/bin/dsh-purge.js index 7fde3bc..e551a6f 100755 --- a/bin/dsh-purge.js +++ b/bin/dsh-purge.js @@ -1,6 +1,7 @@ #!/usr/bin/env node import * as core from "../lib/core.js"; +import * as rules from "../lib/rules.js"; const args = process.argv.slice(2); @@ -58,6 +59,11 @@ async function main() { console.log(" fix: 把 DSH_BASE 指到含 dsh-agent-instructions/lib 的 @deepseek-ai 目录"); process.exit(1); } + const inject = rules.resolveInjectText(state.dsh_home); + if (!inject.text) { + console.log("[ERROR] 提示词和规则集都是空的,必须先添加提示词"); + process.exit(1); + } const { made, errors } = await core.backupAll(state.ai_base); for (const b of made) console.log(` ✓ 备份 / backup → ${b}`); for (const [p, e] of errors) console.log(` ⚠ 备份失败 ${p}: ${e}`); @@ -68,8 +74,9 @@ async function main() { } const flash = core.silenceCmdFlash(state.ai_base); console.log(` cmd-flash=${flash.entry} phase-1=${flash.phase1} ok=${flash.ok}`); - const ov = await core.installOverride(state.dsh_home, false); - console.log(ov === "wrote" ? ` ✓ 写入 ${state.override_path}` : " - prompt-inject.md 已存在 (你的自定义内容将保留)"); + console.log(inject.source === "rule" + ? " - 使用当前规则集,不改写提示词文件" + : " - 使用已有提示词文件"); if (state.shim_dir) { const r = await core.patchShim(state.shim_dir); for (const [fname, st] of Object.entries(r)) { diff --git a/client.js b/client.js index 6d5a54b..a611dfb 100644 --- a/client.js +++ b/client.js @@ -728,12 +728,11 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => { "continue.fail": "Continue failed: {error}", }; - const THEME_KEY = "dshp-theme"; - const THEME_MODE_KEY = "dshp-theme-mode"; // "manual" = user picked; else follow host const PURGE_CSS = ` .dshp-root{--dshp-display:"Songti SC","Noto Serif SC","Iowan Old Style",Palatino,"Palatino Linotype",Georgia,serif;--dshp-sans:"Yu Gothic UI","Hiragino Sans GB","Source Han Sans SC",system-ui,sans-serif;--dshp-mono:"Cascadia Mono","Sarasa Mono SC",ui-monospace,monospace;--dshp-ease:cubic-bezier(.16,1,.3,1);max-width:920px;display:flex;flex-direction:column;gap:18px;padding:16px;border-radius:12px;background:var(--dshp-bg);color:var(--dshp-ink);font-family:var(--dshp-sans)} -.dshp-root[data-theme="white"]{--dshp-bg:#ffffff;--dshp-paper:#f7f6f3;--dshp-ink:#4a4742;--dshp-mute:#9a958c;--dshp-line:#eceae4;--dshp-fill:#f3f1ec;--dshp-accent:#7d9a86;--dshp-accent-soft:#e7efe9;--dshp-ok:#5d8a6c;--dshp-warn:#a8844a;--dshp-bad:#c48989;color-scheme:light} -.dshp-root[data-theme="dusk"]{--dshp-bg:#2a2926;--dshp-paper:#32312d;--dshp-ink:#e6e2db;--dshp-mute:#a8a39a;--dshp-line:#3f3d38;--dshp-fill:#353430;--dshp-accent:#9bb5a6;--dshp-accent-soft:#3a433d;--dshp-ok:#8fbf9c;--dshp-warn:#d4b07a;--dshp-bad:#d4a0a0;color-scheme:dark} +.dshp-root{--dshp-bg:transparent;--dshp-paper:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#f6f4ef) 74%,transparent);--dshp-ink:var(--dsw-alias-label-primary,#1a1916);--dshp-mute:color-mix(in srgb,var(--dsw-alias-label-primary,#1a1916) 74%,var(--dsw-alias-label-secondary,#5c564c));--dshp-line:color-mix(in srgb,var(--dsw-alias-border-l1,#c8c2b6) 78%,transparent);--dshp-fill:color-mix(in srgb,var(--dsw-alias-brand-primary,#6d8f78) 14%,transparent);--dshp-accent:var(--dsw-alias-brand-primary,#3f6b52);--dshp-accent-soft:color-mix(in srgb,var(--dsw-alias-brand-primary,#6d8f78) 18%,transparent);--dshp-ok:#1f7a45;--dshp-warn:#8a5a12;--dshp-bad:#9a3434} +.dshp-root[data-theme="white"]{color-scheme:light} +.dshp-root[data-theme="dusk"]{color-scheme:dark;--dshp-ok:#8fd0a8;--dshp-warn:#e4c48a;--dshp-bad:#f0b4b4} .dshp-toolbar{display:flex;align-items:center;justify-content:flex-end;gap:8px} .dshp-switch{display:inline-flex;border:1px solid var(--dshp-line);border-radius:999px;overflow:hidden;background:var(--dshp-paper)} .dshp-switch button{appearance:none;border:0;background:transparent;color:var(--dshp-mute);font:12px/1 var(--dshp-sans);padding:6px 14px;cursor:pointer} @@ -850,90 +849,30 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => { .dshp-dock-tab.on{color:var(--dsw-alias-label-primary,var(--dshp-ink,#f2f2f2));font-weight:600;border-bottom-color:var(--dsw-alias-brand-primary,#6dbf8c);background:transparent} .dshp-dock-body{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column;background:transparent;border-radius:0 0 12px 12px} .dshp-dock-body .dshp-root{max-width:none;height:100%;flex:1;min-height:0;overflow:auto;background:transparent!important;--dshp-bg:transparent;--dshp-paper:color-mix(in srgb,var(--dshp-ink) 7%,transparent);--dshp-fill:color-mix(in srgb,var(--dshp-ink) 6%,transparent);--dshp-line:color-mix(in srgb,var(--dshp-ink) 20%,transparent);--dshp-accent-soft:color-mix(in srgb,var(--dshp-accent) 22%,transparent)} -.dshp-dock-body .dshp-root[data-theme="white"]{--dshp-ink:#1a1916;--dshp-mute:#534e46;--dshp-ok:#1f5c38;--dshp-warn:#8a5a12;--dshp-bad:#9a3434;--dshp-paper:#fffcf7;--dshp-fill:#ebe7df;--dshp-line:#d0caba;--dshp-accent:#3f6b52;--dshp-accent-soft:#d7e6dc;--dshp-bg:#f4f2ec} -.dshp-dock-body .dshp-root[data-theme="dusk"]{--dshp-ink:#f4f1ea;--dshp-mute:#c9c3b8;--dshp-ok:#9fd0ad;--dshp-warn:#e0c08a;--dshp-bad:#e0b0b0;--dshp-paper:#32312d;--dshp-fill:#353430;--dshp-line:#4a4740;--dshp-accent:#9bb5a6;--dshp-accent-soft:#3a433d;--dshp-bg:#2a2926} -.dshp-dock-body .dshp-panel,.dshp-dock-body .dshp-metric,.dshp-dock-body .dshp-group,.dshp-dock-body .dshp-editor,.dshp-dock-body .dshp-active,.dshp-dock-body .dshp-ask,.dshp-dock-body .dshp-create,.dshp-dock-body .dshp-switch{background:color-mix(in srgb,var(--dshp-ink) 6%,transparent)!important;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)} -.dshp-dock-body .dshp-root[data-theme="white"] .dshp-panel,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-metric,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-group,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-editor,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-active,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-ask,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-create,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-switch,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-rulelist,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-table,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-ruleitem{background:color-mix(in srgb,#fffdf8 76%,transparent)!important;backdrop-filter:blur(16px) saturate(1.2)!important;-webkit-backdrop-filter:blur(16px) saturate(1.2)!important;border-color:#d0caba!important;color:#1a1916!important} -.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-panel,.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-metric,.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-group,.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-editor,.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-active,.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-ask,.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-create,.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-switch,.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-rulelist,.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-table,.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-ruleitem{background:color-mix(in srgb,#161513 70%,transparent)!important;backdrop-filter:blur(16px) saturate(1.2)!important;-webkit-backdrop-filter:blur(16px) saturate(1.2)!important;border-color:#4a4740!important;color:#f4f1ea!important} -.dshp-dock-body .dshp-field,.dshp-dock-body .dshp-area{background:color-mix(in srgb,var(--dshp-ink) 8%,transparent);color:var(--dshp-ink);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)} -.dshp-dock-body .dshp-root[data-theme="white"] .dshp-field,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-area{background:color-mix(in srgb,#fff 84%,transparent)!important;color:#16140f!important;border-color:#b7b0a3!important;backdrop-filter:blur(16px) saturate(1.2)!important;-webkit-backdrop-filter:blur(16px) saturate(1.2)!important} -.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-field,.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-area{background:color-mix(in srgb,#0e0d0c 80%,transparent)!important;color:#f7f4ee!important;border-color:color-mix(in srgb,#fff 28%,transparent)!important;backdrop-filter:blur(16px) saturate(1.2)!important;-webkit-backdrop-filter:blur(16px) saturate(1.2)!important} -.dshp-dock-body select.dshp-field,.dshp-dock-body .dshp-field.dshp-ver{background:var(--dshp-paper,#2a2926)!important;color:var(--dshp-ink)!important;backdrop-filter:blur(16px) saturate(1.2)!important;-webkit-backdrop-filter:blur(16px) saturate(1.2)!important;color-scheme:dark} -.dshp-dock-body .dshp-root[data-theme="white"] select.dshp-field,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-field.dshp-ver{background:#fff!important;color:#1a1916!important;color-scheme:light} -.dshp-dock-body .dshp-root[data-theme="dusk"] select.dshp-field,.dshp-dock-body .dshp-root[data-theme="dusk"] .dshp-field.dshp-ver{background:#32312d!important;color:#e6e2db!important;color-scheme:dark} -.dshp-dock-body select.dshp-field option,.dshp-dock-body .dshp-field.dshp-ver option{background:#fff;color:#1a1916} -.dshp-dock-body .dshp-root[data-theme="white"] select.dshp-field option,.dshp-dock-body .dshp-root[data-theme="white"] .dshp-field.dshp-ver option{background:#fff;color:#1a1916} -.dshp-dock-body .dshp-title,.dshp-dock-body .dshp-kicker,.dshp-dock-body .dshp-sub h4,.dshp-dock-body .dshp-group-h strong,.dshp-dock-body .dshp-metric b{color:var(--dshp-ink)} -.dshp-dock-body .dshp-mute,.dshp-dock-body .dshp-metric span,.dshp-dock-body .dshp-group-h em,.dshp-dock-body .dshp-count,.dshp-dock-body .dshp-rule-meta{color:var(--dshp-mute)} -.dshp-dock-body .rt-dock{position:relative;inset:auto;width:100%!important;height:100%;max-width:none!important;flex:1;min-height:0;min-width:0;display:flex!important;flex-direction:column;box-shadow:none;border:0;transform:none!important;opacity:1!important;pointer-events:auto!important;background:transparent!important;color:var(--dsw-alias-label-primary,#f4f2ec);font-size:13.5px;line-height:1.55;font-weight:450;--rt-ink:var(--dsw-alias-label-primary,#f4f2ec);--rt-mute:var(--dsw-alias-label-secondary,#d2ccc0);--rt-surf:color-mix(in srgb,var(--dsw-alias-bg-layer-2,#2a2a2a) 42%,transparent);--rt-surf-2:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#1c1c1c) 55%,transparent);--rt-line:color-mix(in srgb,var(--dsw-alias-border-l1,#555) 72%,transparent)} +.dshp-dock-body .dshp-panel,.dshp-dock-body .dshp-metric,.dshp-dock-body .dshp-group,.dshp-dock-body .dshp-editor,.dshp-dock-body .dshp-active,.dshp-dock-body .dshp-ask,.dshp-dock-body .dshp-create,.dshp-dock-body .dshp-rulelist,.dshp-dock-body .dshp-table,.dshp-dock-body .dshp-ruleitem{background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#f7f4ee) 74%,transparent)!important;border-color:color-mix(in srgb,var(--dsw-alias-brand-primary,#6d8f78) 32%,transparent)!important;color:var(--dshp-ink)!important;box-shadow:inset 0 1px 0 color-mix(in srgb,#fff 32%,transparent);backdrop-filter:blur(16px) saturate(1.3);-webkit-backdrop-filter:blur(16px) saturate(1.3)} +.dshp-dock-body .dshp-field,.dshp-dock-body .dshp-area{background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#fff) 88%,transparent)!important;color:var(--dshp-ink)!important;border-color:color-mix(in srgb,var(--dsw-alias-border-l1,#8a8478) 72%,transparent)!important} +.dshp-dock-body select.dshp-field,.dshp-dock-body .dshp-field.dshp-ver{background:var(--dsw-alias-bg-layer-1,#fff)!important;color:var(--dshp-ink)!important;color-scheme:inherit} +.dshp-dock[data-theme="white"] select.dshp-field option,.dshp-dock[data-theme="white"] .dshp-field.dshp-ver option{background:#fff;color:#16140f} +.dshp-dock[data-theme="dusk"] select.dshp-field option,.dshp-dock[data-theme="dusk"] .dshp-field.dshp-ver option{background:#1b1d22;color:#f4f1ea} +.dshp-dock-body .dshp-title,.dshp-dock-body .dshp-sub h4,.dshp-dock-body .dshp-group-h strong,.dshp-dock-body .dshp-metric b,.dshp-dock-body .dshp-rule-name{font-family:inherit;font-weight:650;letter-spacing:0;color:var(--dshp-ink)!important;text-shadow:none} +.dshp-dock-body .dshp-mute,.dshp-dock-body .dshp-kicker,.dshp-dock-body .dshp-metric span,.dshp-dock-body .dshp-group-h em,.dshp-dock-body .dshp-count,.dshp-dock-body .dshp-rule-meta,.dshp-dock-body .dshp-hint{color:var(--dshp-mute)!important;font-weight:500;text-shadow:none} +.dshp-dock-body .rt-dock{position:relative;inset:auto;width:100%!important;height:100%;max-width:none!important;flex:1;min-height:0;min-width:0;display:flex!important;flex-direction:column;box-shadow:none;border:0;transform:none!important;opacity:1!important;pointer-events:auto!important;background:transparent!important} .dshp-dock-body .rt-grip{display:none!important} -.dshp-dock-body .rt-embedded>.rt-head,.dshp-dock-body .rt-tabs,.dshp-dock-body .rt-foot{flex:none;background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#1c1c1c) 38%,transparent)!important;color:var(--rt-ink);border-color:var(--rt-line)} -.dshp-dock-body .rt-body{flex:1;min-height:0;overflow:hidden!important;background:transparent!important;color:var(--rt-ink)} +.dshp-dock-body .rt-embedded>.rt-head,.dshp-dock-body .rt-tabs,.dshp-dock-body .rt-foot{flex:none} +.dshp-dock-body .rt-body{flex:1;min-height:0;overflow:hidden!important;background:transparent!important} .dshp-dock-body .rt-main{min-height:0;flex:1;overflow:hidden} .dshp-dock-body .rt-pane{min-height:0;overflow:auto!important} -.dshp-dock-body .rt-card,.dshp-dock-body .rt-pane,.dshp-dock-body .rt-side,.dshp-dock-body .rt-main,.dshp-dock-body .rt-list,.dshp-dock-body .rt-toolbar,.dshp-dock-body .rt-evi,.dshp-dock-body .rt-live-body,.dshp-dock-body .rt-chain,.dshp-dock-body .rt-split,.dshp-dock-body .rt-table{background:var(--rt-surf)!important;color:var(--rt-ink)!important;border:1px solid var(--rt-line);backdrop-filter:blur(14px) saturate(1.2);-webkit-backdrop-filter:blur(14px) saturate(1.2)} -.dshp-dock-body .rt-title,.dshp-dock-body .rt-tab.on,.dshp-dock-body .rt-card h4,.dshp-dock-body .rt-kv b,.dshp-dock-body .rt-mono,.dshp-dock-body .rt-row,.dshp-dock-body .rt-item,.dshp-dock-body .rt-item-name,.dshp-dock-body .rt-seg-cidr,.dshp-dock-body .rt-vrow,.dshp-dock-body .rt-score-row,.dshp-dock-body h4,.dshp-dock-body .rt-link,.dshp-dock-body .rt-toolbar>span{color:var(--rt-ink)!important;text-shadow:none;font-weight:600} -.dshp-dock-body .rt-tab,.dshp-dock-body .rt-foot,.dshp-dock-body .rt-empty,.dshp-dock-body .rt-item-desc,.dshp-dock-body .rt-kb-sub,.dshp-dock-body .rt-seg-meta,.dshp-dock-body .rt-expand,.dshp-dock-body .rt-kv span,.dshp-dock-body .rt-tag,.dshp-dock-body .rt-sess-fact>b,.dshp-dock-body .rt-sess-cmd>b,.dshp-dock-body .rt-sess-fold>summary,.dshp-dock-body .rt-score-group .rt-sg-sub,.dshp-dock-body .rt-scope,.dshp-dock-body .rt-flow-action,.dshp-dock-body .rt-sec-sub{color:var(--rt-mute)!important;text-shadow:none;opacity:1!important} -.dshp-dock-body .rt-row.head,.dshp-dock-body .rt-vrow.head,.dshp-dock-body .rt-score-row.head,.dshp-dock-body .rt-table thead,.dshp-dock-body .rt-row.head:hover{background:var(--rt-surf-2)!important;color:var(--rt-mute)!important} -.dshp-dock-body .rt-row:hover,.dshp-dock-body .rt-item:hover,.dshp-dock-body .rt-item.on,.dshp-dock-body .rt-seg:hover,.dshp-dock-body .rt-seg.on,.dshp-dock-body .rt-vrow:hover,.dshp-dock-body .rt-score-row:hover{background:var(--rt-surf-2)!important} .dshp-dock-body .rt-embedded>.rt-head{padding:8px 12px} -.dshp-dock-body .rt-embedded>.rt-head .rt-title{font-size:14px;letter-spacing:.01em} +.dshp-dock-body .rt-embedded>.rt-head .rt-title{font-size:14px;letter-spacing:0} .dshp-dock-body .rt-tabs{gap:2px;padding:6px 10px 0;flex-wrap:wrap} -.dshp-dock-body .rt-tab{border-radius:0;border-bottom:2px solid transparent;margin-bottom:-1px;padding:8px 9px 7px;background:transparent;font-size:12.5px} -.dshp-dock-body .rt-tab.on{border-bottom-color:var(--dsw-alias-brand-primary,#6dbf8c);background:transparent;font-weight:700} -.dshp-dock-body .rt-btn,.dshp-dock-body .rt-input,.dshp-dock-body textarea.rt-input,.dshp-dock-body select.rt-input{background:color-mix(in srgb,#111 72%,transparent)!important;border-color:var(--rt-line)!important;color:var(--rt-ink)!important;backdrop-filter:none;-webkit-backdrop-filter:none} -.dshp-dock-body .rt-btn-primary{background:color-mix(in srgb,var(--dsw-alias-brand-primary,#6dbf8c) 82%,#000)!important;border-color:var(--dsw-alias-brand-primary,#6dbf8c)!important;color:#fff!important} -.dshp-dock-body .rt-eng-select{background:color-mix(in srgb,#111 72%,transparent)!important;color:var(--rt-ink)!important;border:1px solid var(--rt-line)!important} -.dshp-dock-body .rt-eng-select option,.dshp-dock-body .rt-input option{background:#1c1c1c;color:#f2f2f2} -.dshp-dock-body .rt-err{color:#ffb4b4!important;font-weight:600} -.dshp-dock-body .rt-rep-http,.dshp-dock-body pre{background:color-mix(in srgb,#000 55%,transparent)!important;color:var(--rt-ink)!important;border:1px solid var(--rt-line)} -/* 白玻璃:深色字压在偏白的半透明底上,宿主深浅都不能把它刷回实底。 */ -body .dshp-dock:has(.dshp-root[data-theme="white"]){background:color-mix(in srgb,#fffdf8 78%,transparent)!important;backdrop-filter:blur(18px) saturate(1.25)!important;-webkit-backdrop-filter:blur(18px) saturate(1.25)!important;border:1px solid color-mix(in srgb,#3c362e 32%,transparent)!important;box-shadow:0 14px 36px rgba(26,25,22,.16)!important;color:#14120e!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-head,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-tabs{background:color-mix(in srgb,#fffdf8 58%,transparent)!important;border-bottom-color:color-mix(in srgb,#3c362e 28%,transparent)!important;color:#14120e!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-head b,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-head button{color:#14120e!important;text-shadow:0 1px 0 rgba(255,255,255,.45)!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-head button{background:color-mix(in srgb,#fff 82%,transparent)!important;border-color:color-mix(in srgb,#3c362e 28%,transparent)!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-tab{color:#3c362e!important;text-shadow:none!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-tab:hover,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-tab.on{color:#14120e!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body{background:transparent!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-root{background:transparent!important;--dshp-bg:transparent;--dshp-paper:color-mix(in srgb,#fffdf8 72%,transparent);--dshp-fill:color-mix(in srgb,#14120e 8%,transparent);--dshp-ink:#14120e;--dshp-mute:#3c362e;--dshp-line:color-mix(in srgb,#3c362e 28%,transparent);--dshp-accent:#2f5a42;--dshp-accent-soft:color-mix(in srgb,#d7e6dc 70%,transparent)} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-panel,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-metric,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-group,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-editor,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-active,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-ask,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-create,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-switch,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-rulelist{background:color-mix(in srgb,#fffdf8 70%,transparent)!important;backdrop-filter:blur(14px) saturate(1.2)!important;-webkit-backdrop-filter:blur(14px) saturate(1.2)!important;border-color:color-mix(in srgb,#3c362e 26%,transparent)!important;color:#14120e!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-field,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-area{background:color-mix(in srgb,#fff 88%,transparent)!important;color:#14120e!important;border-color:color-mix(in srgb,#3c362e 34%,transparent)!important;backdrop-filter:blur(12px)!important;-webkit-backdrop-filter:blur(12px)!important;color-scheme:light} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-title,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-sub h4,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-group-h strong,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-metric b,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-btn,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-rule-name{color:#14120e!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-mute,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-kicker,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-metric span,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-group-h em,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-count,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-rule-meta,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .dshp-hint{color:#3c362e!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-dock{--rt-ink:#14120e;--rt-mute:#3c362e;--rt-surf:color-mix(in srgb,#fffdf8 70%,transparent);--rt-surf-2:color-mix(in srgb,#fffdf8 82%,transparent);--rt-line:color-mix(in srgb,#3c362e 28%,transparent);color:#14120e!important;background:transparent!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-embedded>.rt-head,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-tabs,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-foot{background:color-mix(in srgb,#fffdf8 62%,transparent)!important;border-color:color-mix(in srgb,#3c362e 26%,transparent)!important;color:#14120e!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-body{background:transparent!important;color:#14120e!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-card,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-pane,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-side,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-main,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-list,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-toolbar,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-evi,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-live-body,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-chain,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-split,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-table{background:color-mix(in srgb,#fffdf8 68%,transparent)!important;color:#14120e!important;border:1px solid color-mix(in srgb,#3c362e 26%,transparent)!important;backdrop-filter:blur(14px) saturate(1.2)!important;-webkit-backdrop-filter:blur(14px) saturate(1.2)!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-title,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-card h4,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-item-name,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-tab.on,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-kv b,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-mono,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-row,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-item,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body h4,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-link,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-toolbar>span{text-shadow:none!important;color:#14120e!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-tab,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-foot,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-empty,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-item-desc,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-kb-sub,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-kv span,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-tag,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-sec-sub{color:#3c362e!important;opacity:1!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-row.head,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-vrow.head,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-score-row.head,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-table thead{background:color-mix(in srgb,#fff 80%,transparent)!important;color:#3c362e!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-row:hover,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-item:hover,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-item.on,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-seg:hover,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-seg.on{background:color-mix(in srgb,#fff 74%,transparent)!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-btn,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-input,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body textarea.rt-input,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-eng-select{background:color-mix(in srgb,#fff 88%,transparent)!important;color:#14120e!important;border:1px solid color-mix(in srgb,#3c362e 34%,transparent)!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-eng-select option,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-input option{background:#fff;color:#14120e} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-err{color:#9a3434!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-btn-primary{background:#3f6b52!important;border-color:#3f6b52!important;color:#fff!important} -body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body .rt-rep-http,body .dshp-dock:has(.dshp-root[data-theme="white"]) .dshp-dock-body pre{background:color-mix(in srgb,#fff 84%,transparent)!important;color:#14120e!important;border:1px solid color-mix(in srgb,#3c362e 28%,transparent)!important} -body:not([data-ds-dark-theme]) .dshp-auth-modal{background:#fffcf7;color:#1a1916;border-color:#c9c3b6} -body:not([data-ds-dark-theme]) .dshp-auth-legal{background:#f3f0e8;color:#1a1916;border-color:#c9c3b6} -body:not([data-ds-dark-theme]) .dshp-auth-warn{background:#f5e6c8;color:#6b4a10} -body:not([data-ds-dark-theme]) .dshp-auth-ops button{border-color:#c9c3b6;color:#1a1916;background:#fff} -body:not([data-ds-dark-theme]) .dshp-auth-ops button.primary{background:#3f6b52;border-color:#3f6b52;color:#fff} -body:not([data-ds-dark-theme]) .dshp-hero-chip-btn,body:not([data-ds-dark-theme]) .dshp-hbtn{color:#1a1916;border-color:#3f6b52;background:#d7e6dc} -body:not([data-ds-dark-theme]) .dshp-hero-chip-btn:hover,body:not([data-ds-dark-theme]) .dshp-hbtn:hover{background:#c5dacd;color:#1a1916} -/* 墨玻璃:浅色字压在偏黑的半透明底上。下拉选项保持实底,系统菜单不参与模糊。 */ -body .dshp-dock:has(.dshp-root[data-theme="dusk"]){background:color-mix(in srgb,#100e0c 76%,transparent)!important;backdrop-filter:blur(18px) saturate(1.2)!important;-webkit-backdrop-filter:blur(18px) saturate(1.2)!important;border:1px solid color-mix(in srgb,#fff 22%,transparent)!important;box-shadow:0 18px 48px rgba(0,0,0,.42)!important;color:#f7f4ee!important} -body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-head,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-tabs{background:color-mix(in srgb,#161410 52%,transparent)!important;border-bottom-color:color-mix(in srgb,#fff 18%,transparent)!important;color:#f7f4ee!important} -body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-head b,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-head button{color:#f7f4ee!important;text-shadow:0 1px 2px rgba(0,0,0,.65)!important} -body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-head button{background:color-mix(in srgb,#0c0b09 70%,transparent)!important;border-color:color-mix(in srgb,#fff 22%,transparent)!important} -body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-tab{color:#e6dfd2!important;text-shadow:0 1px 2px rgba(0,0,0,.55)!important} -body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-tab:hover,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-tab.on{color:#f7f4ee!important} -body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body{background:transparent!important} -body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-root{background:transparent!important;--dshp-bg:transparent;--dshp-paper:color-mix(in srgb,#161410 68%,transparent);--dshp-fill:color-mix(in srgb,#fff 8%,transparent);--dshp-ink:#f7f4ee;--dshp-mute:#e6dfd2;--dshp-line:color-mix(in srgb,#fff 20%,transparent);--dshp-accent:#b7d0c2;--dshp-accent-soft:color-mix(in srgb,#3a433d 70%,transparent)} -body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-panel,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-metric,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-group,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-editor,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-active,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-ask,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-create,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-switch,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-rulelist{background:color-mix(in srgb,#161410 64%,transparent)!important;backdrop-filter:blur(14px) saturate(1.15)!important;-webkit-backdrop-filter:blur(14px) saturate(1.15)!important;border-color:color-mix(in srgb,#fff 18%,transparent)!important;color:#f7f4ee!important} -body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-field,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-area{background:color-mix(in srgb,#0a0908 84%,transparent)!important;color:#f7f4ee!important;border-color:color-mix(in srgb,#fff 24%,transparent)!important;backdrop-filter:blur(12px)!important;-webkit-backdrop-filter:blur(12px)!important;color-scheme:dark} -body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-title,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-sub h4,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-group-h strong,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-metric b,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-btn,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-rule-name{color:#f7f4ee!important;text-shadow:0 1px 2px rgba(0,0,0,.55)} -body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-mute,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-kicker,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-metric span,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-group-h em,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-count,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-rule-meta,body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-hint{color:#e6dfd2!important} -body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-switch button.is-on{background:color-mix(in srgb,#3a433d 78%,transparent);color:#f7f4ee} +.dshp-dock-body .rt-tab{border-radius:0;border-bottom:2px solid transparent;margin-bottom:-1px;padding:8px 9px 7px;background:transparent;font-size:14px} +.dshp-dock-body .rt-tab.on{border-bottom-color:var(--dsw-alias-brand-primary,#6d8f78);background:transparent;font-weight:650} +.dshp-dock-body .rt-row:hover,.dshp-dock-body .rt-item:hover,.dshp-dock-body .rt-item.on,.dshp-dock-body .rt-seg:hover,.dshp-dock-body .rt-seg.on,.dshp-dock-body .rt-vrow:hover,.dshp-dock-body .rt-score-row:hover{background:var(--rt-surf-2)!important} +body:not([data-ds-dark-theme]) .dshp-auth-modal{background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#fffcf7) 92%,transparent);color:var(--dsw-alias-label-primary,#1a1916);border-color:color-mix(in srgb,var(--dsw-alias-border-l1,#c9c3b6) 80%,transparent);backdrop-filter:blur(18px) saturate(1.3);-webkit-backdrop-filter:blur(18px) saturate(1.3)} +body:not([data-ds-dark-theme]) .dshp-auth-legal{background:color-mix(in srgb,var(--dsw-alias-bg-layer-2,#f3f0e8) 90%,transparent);color:var(--dsw-alias-label-primary,#1a1916);border-color:color-mix(in srgb,var(--dsw-alias-border-l1,#c9c3b6) 80%,transparent)} +body:not([data-ds-dark-theme]) .dshp-auth-warn{background:color-mix(in srgb,#f5e6c8 88%,transparent);color:#6b4a10} +body:not([data-ds-dark-theme]) .dshp-auth-ops button{border-color:var(--dsw-alias-border-l1,#c9c3b6);color:var(--dsw-alias-label-primary,#1a1916);background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#fff) 88%,transparent)} +body:not([data-ds-dark-theme]) .dshp-auth-ops button.primary{background:var(--dsw-alias-brand-primary,#3f6b52);border-color:var(--dsw-alias-brand-primary,#3f6b52);color:#fff} .dshp-dock-resize,.dshp-dock-resize-l,.dshp-dock-resize-r,.dshp-dock-resize-b{position:absolute;z-index:60;pointer-events:auto;touch-action:none} .dshp-dock-resize{right:0;bottom:0;width:22px;height:22px;cursor:nwse-resize;background:linear-gradient(135deg,transparent 46%,color-mix(in srgb,var(--dsw-alias-brand-primary,#6dbf8c) 75%,transparent) 46%);border-radius:0 0 12px 0;opacity:.95} .dshp-dock-resize-l{left:-2px;top:0;bottom:0;width:10px;cursor:ew-resize;background:color-mix(in srgb,var(--dsw-alias-brand-primary,#6dbf8c) 18%,transparent)} @@ -973,23 +912,27 @@ body .dshp-dock:has(.dshp-root[data-theme="dusk"]) .dshp-dock-body .dshp-switch .dshp-tab-btn:hover{color:var(--dsw-alias-label-primary,currentColor)} .dshp-tab-btn.on{color:var(--dsw-alias-brand-primary,#6dbf8c)} .dshp-tab-btn.on:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:2px;border-radius:2px;background:var(--dsw-alias-brand-primary,#6dbf8c)} -/* 玻璃:低透明度 + 冷色偏色 + 高光边,背后的界面要能透出来。清洗和演练台共用 dock 上的主题。 */ -.dshp-dock{font-family:"Segoe UI","Microsoft YaHei UI","Microsoft YaHei","PingFang SC",system-ui,sans-serif} -.dshp-dock[data-theme="dusk"]{background:linear-gradient(165deg,rgba(255,255,255,.22),rgba(120,160,220,.10) 42%,rgba(20,28,48,.18))!important;backdrop-filter:blur(28px) saturate(1.7)!important;-webkit-backdrop-filter:blur(28px) saturate(1.7)!important;color:#f7f4ee!important;border:1px solid rgba(255,255,255,.42)!important;box-shadow:inset 0 1px 0 rgba(255,255,255,.55),0 20px 50px rgba(0,0,0,.28)!important} -.dshp-dock[data-theme="white"]{background:linear-gradient(165deg,rgba(255,255,255,.62),rgba(186,214,255,.28) 48%,rgba(255,255,255,.16))!important;backdrop-filter:blur(28px) saturate(1.6)!important;-webkit-backdrop-filter:blur(28px) saturate(1.6)!important;color:#16140f!important;border:1px solid rgba(255,255,255,.78)!important;box-shadow:inset 0 1px 0 rgba(255,255,255,.9),0 18px 40px rgba(40,50,70,.16)!important} -.dshp-dock[data-theme="dusk"] .dshp-dock-head,.dshp-dock[data-theme="dusk"] .dshp-dock-tabs,.dshp-dock[data-theme="white"] .dshp-dock-head,.dshp-dock[data-theme="white"] .dshp-dock-tabs{background:transparent!important} -.dshp-dock[data-theme="dusk"] .dshp-dock-head,.dshp-dock[data-theme="dusk"] .dshp-dock-head b,.dshp-dock[data-theme="dusk"] .dshp-dock-head button,.dshp-dock[data-theme="dusk"] .dshp-dock-tab,.dshp-dock[data-theme="dusk"] .dshp-dock-tab.on{color:#f7f4ee!important;text-shadow:none!important;font-weight:600} -.dshp-dock[data-theme="white"] .dshp-dock-head,.dshp-dock[data-theme="white"] .dshp-dock-head b,.dshp-dock[data-theme="white"] .dshp-dock-head button,.dshp-dock[data-theme="white"] .dshp-dock-tab,.dshp-dock[data-theme="white"] .dshp-dock-tab.on{color:#16140f!important;text-shadow:none!important;font-weight:600} -.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-dock{font-size:14px!important;line-height:1.6!important;font-weight:500!important;color:#f7f4ee!important;--rt-ink:#f7f4ee;--rt-mute:#efe8dc;--rt-surf:color-mix(in srgb,#1e1c19 46%,transparent);--rt-surf-2:color-mix(in srgb,#2c2925 58%,transparent);--rt-line:color-mix(in srgb,#fff 22%,transparent)} -.dshp-dock[data-theme="white"] .dshp-dock-body .rt-dock{font-size:14px!important;line-height:1.6!important;font-weight:500!important;color:#16140f!important;--rt-ink:#16140f;--rt-mute:#2c261f;--rt-surf:color-mix(in srgb,#fffdf8 52%,transparent);--rt-surf-2:color-mix(in srgb,#fff 64%,transparent);--rt-line:color-mix(in srgb,#2a241c 22%,transparent)} -.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-title,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-tab,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-tab.on,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-card,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-card h4,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-row,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-vrow,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-kv,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-kv b,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-kv span,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-mono,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-empty,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-foot,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-tag,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-item,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-item-name,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-item-desc,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-sec-sub,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-kb-sub,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-seg-cidr,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-seg-meta,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-section,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-note,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-hint{color:#f3eee6!important;text-shadow:none!important;opacity:1!important} -.dshp-dock[data-theme="white"] .dshp-dock-body .rt-title,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-tab,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-tab.on,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-card,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-card h4,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-row,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-vrow,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-kv,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-kv b,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-kv span,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-mono,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-empty,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-foot,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-tag,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-item,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-item-name,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-item-desc,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-sec-sub,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-kb-sub,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-seg-cidr,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-seg-meta,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-section,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-note,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-hint{color:#1a1612!important;text-shadow:none!important;opacity:1!important} -body .dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-card,body .dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-pane,body .dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-side,body .dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-table,body .dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-toolbar,body .dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-embedded>.rt-head,body .dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-tabs,body .dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-root .dshp-panel,body .dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-root .dshp-metric,body .dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-root .dshp-group,body .dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-root .dshp-editor,body .dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-root .dshp-rulelist,body .dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-root .dshp-active{background:rgba(255,255,255,.08)!important;border-color:rgba(255,255,255,.28)!important;backdrop-filter:blur(18px) saturate(1.4)!important;-webkit-backdrop-filter:blur(18px) saturate(1.4)!important;box-shadow:inset 0 1px 0 rgba(255,255,255,.22)!important;color:#f7f4ee!important} -body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-card,body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-pane,body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-side,body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-table,body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-toolbar,body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-embedded>.rt-head,body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-tabs,body .dshp-dock[data-theme="white"] .dshp-dock-body .dshp-root .dshp-panel,body .dshp-dock[data-theme="white"] .dshp-dock-body .dshp-root .dshp-metric,body .dshp-dock[data-theme="white"] .dshp-dock-body .dshp-root .dshp-group,body .dshp-dock[data-theme="white"] .dshp-dock-body .dshp-root .dshp-editor,body .dshp-dock[data-theme="white"] .dshp-dock-body .dshp-root .dshp-rulelist,body .dshp-dock[data-theme="white"] .dshp-dock-body .dshp-root .dshp-active{background:rgba(255,255,255,.28)!important;border-color:rgba(255,255,255,.72)!important;backdrop-filter:blur(18px) saturate(1.4)!important;-webkit-backdrop-filter:blur(18px) saturate(1.4)!important;box-shadow:inset 0 1px 0 rgba(255,255,255,.85)!important;color:#16140f!important} -.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-btn,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-input,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-eng-select,.dshp-dock[data-theme="dusk"] .dshp-dock-body textarea,.dshp-dock[data-theme="dusk"] .dshp-field,.dshp-dock[data-theme="dusk"] .dshp-area{background:rgba(12,16,28,.35)!important;color:#f7f4ee!important;border-color:rgba(255,255,255,.32)!important} -.dshp-dock[data-theme="white"] .dshp-dock-body .rt-btn,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-input,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-eng-select,.dshp-dock[data-theme="white"] .dshp-dock-body textarea,.dshp-dock[data-theme="white"] .dshp-field,.dshp-dock[data-theme="white"] .dshp-area{background:rgba(255,255,255,.45)!important;color:#16140f!important;border-color:rgba(255,255,255,.8)!important} -.dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-title,.dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-rule-name,.dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-metric b,.dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-btn,.dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-field,.dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-area,.dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-mute,.dshp-dock[data-theme="dusk"] .dshp-dock-body .dshp-hint{color:#f7f4ee!important;text-shadow:none!important} -.dshp-dock[data-theme="white"] .dshp-dock-body .dshp-title,.dshp-dock[data-theme="white"] .dshp-dock-body .dshp-rule-name,.dshp-dock[data-theme="white"] .dshp-dock-body .dshp-metric b,.dshp-dock[data-theme="white"] .dshp-dock-body .dshp-btn,.dshp-dock[data-theme="white"] .dshp-dock-body .dshp-field,.dshp-dock[data-theme="white"] .dshp-dock-body .dshp-area,.dshp-dock[data-theme="white"] .dshp-dock-body .dshp-mute,.dshp-dock[data-theme="white"] .dshp-dock-body .dshp-hint{color:#16140f!important;text-shadow:none!important} +/* 玻璃跟随宿主颜色。字重和底的不透明度分开:壳透,字坐在更实的一层上。 */ +.dshp-dock{font-family:"Segoe UI","Microsoft YaHei UI","PingFang SC","Noto Sans SC",system-ui,sans-serif;font-size:14px;line-height:1.6;font-weight:500;-webkit-font-smoothing:antialiased;text-shadow:none} +.dshp-dock[data-theme="white"],.dshp-dock[data-theme="dusk"]{background:linear-gradient(165deg,color-mix(in srgb,var(--dsw-alias-bg-layer-1,#fff) 50%,transparent),color-mix(in srgb,var(--dsw-alias-brand-primary,#6d8f78) 18%,transparent) 46%,color-mix(in srgb,var(--dsw-alias-bg-layer-2,#fff) 28%,transparent))!important;backdrop-filter:blur(26px) saturate(1.45)!important;-webkit-backdrop-filter:blur(26px) saturate(1.45)!important;color:var(--dshp-ink)!important;border:1px solid color-mix(in srgb,var(--dsw-alias-brand-primary,#6d8f78) 36%,transparent)!important;box-shadow:inset 0 1px 0 color-mix(in srgb,#fff 42%,transparent),0 18px 44px color-mix(in srgb,#000 18%,transparent)!important} +.dshp-dock[data-theme="dusk"]{--dshp-ink:var(--dsw-alias-label-primary,#f4f1ea);--dshp-mute:color-mix(in srgb,var(--dsw-alias-label-primary,#f4f1ea) 84%,var(--dsw-alias-label-secondary,#c9c3b8))} +.dshp-dock[data-theme="white"]{--dshp-ink:var(--dsw-alias-label-primary,#16140f);--dshp-mute:color-mix(in srgb,var(--dsw-alias-label-primary,#16140f) 76%,var(--dsw-alias-label-secondary,#3c362e))} +.dshp-dock .dshp-dock-head,.dshp-dock .dshp-dock-tabs{background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,transparent) 28%,transparent)!important;color:var(--dshp-ink)!important} +.dshp-dock .dshp-dock-head,.dshp-dock .dshp-dock-head b,.dshp-dock .dshp-dock-head button,.dshp-dock .dshp-dock-tab,.dshp-dock .dshp-dock-tab.on{color:var(--dshp-ink)!important;text-shadow:none!important;font-weight:600} +.dshp-dock .dshp-dock-tab{font-size:14px} +.dshp-dock .dshp-dock-tab.on{border-bottom-color:var(--dsw-alias-brand-primary,#6d8f78)!important} +.dshp-dock-body .rt-dock{font-size:14px!important;line-height:1.6!important;font-weight:500!important;color:var(--dshp-ink)!important;--rt-ink:var(--dshp-ink);--rt-mute:var(--dshp-mute);--rt-surf:color-mix(in srgb,var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-layer-1,#fff)) 40%,transparent);--rt-surf-2:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#fff) 62%,transparent);--rt-line:color-mix(in srgb,var(--dsw-alias-brand-primary,#6d8f78) 30%,transparent)} +.dshp-dock-body .rt-title,.dshp-dock-body .rt-tab,.dshp-dock-body .rt-tab.on,.dshp-dock-body .rt-card,.dshp-dock-body .rt-card h4,.dshp-dock-body .rt-row,.dshp-dock-body .rt-vrow,.dshp-dock-body .rt-kv,.dshp-dock-body .rt-kv b,.dshp-dock-body .rt-kv span,.dshp-dock-body .rt-mono,.dshp-dock-body .rt-empty,.dshp-dock-body .rt-foot,.dshp-dock-body .rt-tag,.dshp-dock-body .rt-item,.dshp-dock-body .rt-item-name,.dshp-dock-body .rt-item-desc,.dshp-dock-body .rt-sec-sub,.dshp-dock-body .rt-kb-sub,.dshp-dock-body .rt-seg-cidr,.dshp-dock-body .rt-seg-meta,.dshp-dock-body .rt-section,.dshp-dock-body .rt-note,.dshp-dock-body .rt-hint{color:var(--dshp-ink)!important;text-shadow:none!important;opacity:1!important} +.dshp-dock-body .rt-tab,.dshp-dock-body .rt-foot,.dshp-dock-body .rt-empty,.dshp-dock-body .rt-item-desc,.dshp-dock-body .rt-kb-sub,.dshp-dock-body .rt-kv span,.dshp-dock-body .rt-tag,.dshp-dock-body .rt-sec-sub{color:var(--dshp-mute)!important} +.dshp-dock-body .rt-card,.dshp-dock-body .rt-pane,.dshp-dock-body .rt-side,.dshp-dock-body .rt-table,.dshp-dock-body .rt-toolbar,.dshp-dock-body .rt-embedded>.rt-head,.dshp-dock-body .rt-tabs{background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#fff) 72%,transparent)!important;border-color:color-mix(in srgb,var(--dsw-alias-brand-primary,#6d8f78) 28%,transparent)!important;color:var(--dshp-ink)!important;box-shadow:inset 0 1px 0 color-mix(in srgb,#fff 26%,transparent)!important;backdrop-filter:blur(16px) saturate(1.3);-webkit-backdrop-filter:blur(16px) saturate(1.3)} +.dshp-dock-body .rt-btn,.dshp-dock-body .rt-input,.dshp-dock-body .rt-eng-select,.dshp-dock-body textarea.rt-input{background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#fff) 90%,transparent)!important;color:var(--dshp-ink)!important;border-color:color-mix(in srgb,var(--dsw-alias-border-l1,#888) 70%,transparent)!important} +.dshp-dock-body .rt-btn-primary{background:var(--dsw-alias-brand-primary,#3f6b52)!important;border-color:var(--dsw-alias-brand-primary,#3f6b52)!important;color:#fff!important} +.dshp-dock[data-theme="white"] .dshp-dock-body .rt-eng-select option,.dshp-dock[data-theme="white"] .dshp-dock-body .rt-input option{background:#fff;color:#16140f} +.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-eng-select option,.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-input option{background:#1b1d22;color:#f4f1ea} +.dshp-dock-body .rt-err{font-weight:650} +.dshp-dock[data-theme="white"] .dshp-dock-body .rt-err{color:#9a3434!important} +.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-err{color:#f0b4b4!important} +.dshp-dock-body .rt-rep-http,.dshp-dock-body pre{background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#fff) 84%,transparent)!important;color:var(--dshp-ink)!important;border:1px solid color-mix(in srgb,var(--dsw-alias-border-l1,#888) 60%,transparent)!important} `; function formatSize(bytes) { @@ -1418,9 +1361,7 @@ body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-card,body .dshp-dock[dat setPatchBusy(true); setAskRestart(false); setNotice({ kind: "idle", text: "" }); - const applyContent = !promptBoxEmpty(overrideRef.current) - ? overrideRef.current - : (defaultOverrideRef.current || ""); + const applyContent = overrideRef.current || ""; fetch("/dsh-purge/" + action, { method: "POST", headers: { "content-type": "application/json" }, @@ -2488,9 +2429,9 @@ body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-card,body .dshp-dock[dat function detectHostTheme() { try { if (typeof document !== "undefined") { - if (document.body?.hasAttribute("data-ds-dark-theme")) return "dusk"; const root = document.documentElement; - const scheme = (root.style.colorScheme || getComputedStyle(root).getPropertyValue("color-scheme") || "").toLowerCase(); + if (document.body?.hasAttribute("data-ds-dark-theme") || root?.hasAttribute("data-ds-dark-theme")) return "dusk"; + const scheme = (root.style.colorScheme || getComputedStyle(root).colorScheme || getComputedStyle(root).getPropertyValue("color-scheme") || "").toLowerCase(); if (scheme.includes("dark")) return "dusk"; if (scheme.includes("light")) return "white"; } @@ -2508,13 +2449,6 @@ body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-card,body .dshp-dock[dat function SettingsRoot(props) { const t = typeof props.t === "function" ? props.t : ((key) => key); const [theme, setTheme] = useState(readTheme); - const setAndStore = useCallback((next) => { - setTheme(next); - try { - window.localStorage.setItem(THEME_MODE_KEY, "manual"); - window.localStorage.setItem(THEME_KEY, next); - } catch { /* ignore */ } - }, []); useEffect(() => { let cancelled = false; let timer = 0; @@ -2533,10 +2467,9 @@ body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-card,body .dshp-dock[dat } catch { /* ignore */ } let obs; try { - if (document.body) { - obs = new MutationObserver(syncSoon); - obs.observe(document.body, { attributes: true, attributeFilter: ["data-ds-dark-theme"] }); - } + obs = new MutationObserver(syncSoon); + if (document.body) obs.observe(document.body, { attributes: true, attributeFilter: ["data-ds-dark-theme", "class", "style"] }); + obs.observe(document.documentElement, { attributes: true, attributeFilter: ["data-ds-dark-theme", "class", "style"] }); } catch { /* ignore */ } return () => { cancelled = true; @@ -2548,20 +2481,6 @@ body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-card,body .dshp-dock[dat translate = t; return h("div", { className: "dshp-root", "data-theme": theme }, h("style", null, PURGE_CSS), - h("div", { className: "dshp-toolbar" }, - h("div", { className: "dshp-switch", role: "group", "aria-label": t("theme.aria") }, - h("button", { - type: "button", - className: theme === "white" ? "is-on" : "", - onClick: () => setAndStore("white"), - }, t("theme.white")), - h("button", { - type: "button", - className: theme === "dusk" ? "is-on" : "", - onClick: () => setAndStore("dusk"), - }, t("theme.ink")), - ), - ), h(PurgifySection, null), h(RulesSection, null), h(SkillsSection, null), @@ -7786,11 +7705,10 @@ body[data-ds-dark-theme] .dshp-rewind-item span{color:var(--dsw-alias-label-tert const sync = () => setDockTheme(detectHostTheme()); sync(); const obs = new MutationObserver(sync); - if (document.body) obs.observe(document.body, { attributes: true, attributeFilter: ["data-ds-dark-theme", "class"] }); - const onStorage = (e) => { if (!e.key || e.key === THEME_KEY || e.key === THEME_MODE_KEY) sync(); }; - window.addEventListener("storage", onStorage); + if (document.body) obs.observe(document.body, { attributes: true, attributeFilter: ["data-ds-dark-theme", "class", "style"] }); + obs.observe(document.documentElement, { attributes: true, attributeFilter: ["data-ds-dark-theme", "class", "style"] }); const timer = window.setInterval(sync, 1500); - return () => { obs.disconnect(); window.removeEventListener("storage", onStorage); window.clearInterval(timer); }; + return () => { obs.disconnect(); window.clearInterval(timer); }; }, []); useEffect(() => { let uiTag = document.querySelector('style[data-dsh-purge-ui="1"]'); diff --git a/lib/core.js b/lib/core.js index ce2afbc..bfb0965 100644 --- a/lib/core.js +++ b/lib/core.js @@ -5772,7 +5772,7 @@ export async function overrideStatus(dshHome) { } } -/** 设置页:未自行改过就显示并维持内置默认提示词。 */ +/** 设置页:没有提示词文件时只在框里预填内置默认,不写盘。文件在但正文为空时保持空框。 */ export async function readOverrideForUi(dshHome) { const fp = findOverrideFile(dshHome); const defaultContent = defaultOverrideText(); @@ -5786,22 +5786,20 @@ export async function readOverrideForUi(dshHome) { } } const customized = await isUserCustomizedOverride(dshHome); - // 已改过:显示磁盘正文;未改过:显示内置加密默认(可在框里改后点保存/应用替换)。 - const show = customized - ? (normalizeOverride(disk) ? disk : defaultContent) - : defaultContent; + const diskText = normalizeOverride(disk) ? disk : ""; + const show = diskText || (exists ? "" : defaultContent); return { path: fp, exists, empty: !normalizeOverride(show), customized, - usingDefault: !customized, + usingDefault: !diskText && !exists, content: show, defaultContent, }; } -/** 插件加载时同步落下默认提示词,避免第一轮 assemble 读到空文件。磁盘是空的就写入,不管有没有点过保存。 */ +/** 显式编辑缺文件时才会用到。应用、启动、读取设置不得调用:空磁盘表示没有操作者正文。 */ export function seedOverrideSync(dshHome) { const fp = findOverrideFile(dshHome); fs.mkdirSync(dshHome, { recursive: true }); @@ -5837,9 +5835,8 @@ export function seedOverrideSync(dshHome) { } /** - * 未自行改过时始终把内置默认写回磁盘(与 1.1.30 前一致)。 - * 只点「应用」不点「保存」也要有可注入正文;空文件或仍是旧默认种子时都补齐。 - * 磁盘已是用户自改正文时绝不覆盖。 + * 只在用户显式打开编辑器、文件还不存在时写入内置默认。 + * 应用和启动不得调用。磁盘已是用户自改正文时绝不覆盖。 */ export async function installOverride(dshHome, force = false) { const fp = findOverrideFile(dshHome); @@ -5870,13 +5867,12 @@ export async function installOverride(dshHome, force = false) { return "wrote"; } -/** 应用/启动时解析最终要落盘并注入的正文:框里有就用框,否则内置默认。 */ +/** 框里有字用框,否则用磁盘上已有正文。都不回落内置默认。 */ export function resolveApplyOverrideText(dshHome, incoming) { - const bundled = defaultOverrideText(); if (normalizeOverride(incoming)) return String(incoming); const disk = overrideFileTextSafe(dshHome); if (normalizeOverride(disk)) return disk; - return bundled; + return ""; } function overrideFileTextSafe(dshHome) { @@ -5892,19 +5888,19 @@ function overrideFileTextSafe(dshHome) { export async function saveOverrideContent(dshHome, content) { const bundled = defaultOverrideText(); const incoming = typeof content === "string" ? content : ""; - const resolved = normalizeOverride(incoming) ? incoming : bundled; - const customized = normalizeOverride(resolved) !== normalizeOverride(bundled); + const customized = Boolean(normalizeOverride(incoming)) + && normalizeOverride(incoming) !== normalizeOverride(bundled); const fp = findOverrideFile(dshHome); await fsp.mkdir(dshHome, { recursive: true }); - await fsp.writeFile(fp, resolved, "utf8"); - await markOverrideCustomized(dshHome, customized, resolved); - return { path: fp, customized, content: resolved, defaultContent: bundled }; + await fsp.writeFile(fp, incoming, "utf8"); + await markOverrideCustomized(dshHome, customized, incoming); + return { path: fp, customized, content: incoming, defaultContent: bundled }; } -export async function ensureOverrideContent(dshHome, force = false) { - const installed = await installOverride(dshHome, force); +/** 只读当前提示词。不补内置默认。 */ +export async function ensureOverrideContent(dshHome, _force = false) { const ui = await readOverrideForUi(dshHome); - return { ...ui, installed }; + return { ...ui, installed: ui.exists ? "exists" : "missing" }; } export function editOverride(dshHome) { diff --git a/lib/identity.js b/lib/identity.js index 01f30ed..a298033 100644 --- a/lib/identity.js +++ b/lib/identity.js @@ -625,6 +625,46 @@ function sanitizeAssemblySections(sections) { return out; } +/** 包住 assemble;宿主再赋值 assemble 时自动再包,避免重启后第一轮丢掉注入。 */ +export function installAssembleGuard(prompt, rewriteFn) { + if (!prompt || typeof prompt.assemble !== "function" || typeof rewriteFn !== "function") { + return false; + } + const wrap = (fn) => { + if (typeof fn !== "function") return fn; + if (fn._dshPurgeWrapped) return fn; + const orig = fn.bind(prompt); + const wrapped = async function assembleWithPurge(...args) { + const assembled = await orig(...args); + return rewriteFn(assembled, args[0]); + }; + wrapped._dshPurgeWrapped = true; + return wrapped; + }; + try { + let current = wrap(prompt.assemble); + Object.defineProperty(prompt, "assemble", { + configurable: true, + enumerable: true, + get() { + return current; + }, + set(next) { + current = wrap(next); + }, + }); + return true; + } catch { + if (prompt.assemble._dshPurgeWrapped) return true; + try { + prompt.assemble = wrap(prompt.assemble); + return Boolean(prompt.assemble._dshPurgeWrapped); + } catch { + return false; + } + } +} + export function rewritePromptAssembly(assembled, fallbackInject = "", options = {}) { if (!assembled || !Array.isArray(assembled.sections)) return assembled; const opts = normalizeRewriteOptions(fallbackInject, options); diff --git a/lib/index.js b/lib/index.js index f9cd1ef..2b9aa8c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -10,6 +10,7 @@ import { GLOBAL_PROMPT_ORDER, isMnemonPluginMessage, isRedteamSession, + installAssembleGuard, rewritePromptAssembly, } from "./identity.js"; import { capabilityProtocolText, CAPABILITY_SECTION } from "./capability-protocol.js"; @@ -182,16 +183,16 @@ function injectSnapshot(dshHome = core.findDshHome()) { }; } -/** 以设置页文本框为准;空框且没有启用中的规则集则必须补提示词。 */ +/** 框里有字用框;空框才看规则集;都没有则要求先写提示词。不看内置默认。 */ function injectSnapshotFromBox(dshHome, boxText) { const ruleId = rules.activeRuleId(dshHome); + if (typeof boxText === "string" && core.normalizeOverride(boxText)) { + return { injectSource: "prompt", injectRuleId: null, needPrompt: false }; + } if (core.normalizeOverride(rules.activeRuleText(dshHome))) { return { injectSource: "rule", injectRuleId: ruleId, needPrompt: false }; } if (typeof boxText !== "string") return injectSnapshot(dshHome); - if (core.normalizeOverride(boxText)) { - return { injectSource: "prompt", injectRuleId: null, needPrompt: false }; - } return { injectSource: "none", injectRuleId: ruleId, needPrompt: true }; } @@ -204,10 +205,6 @@ function rejectIfNeedPrompt(dshHome, boxText) { } async function ensureRestartReady() { - const home = core.findDshHome(); - try { core.seedOverrideSync(home); } catch { /* 仍可读内置默认 */ } - const inject = rules.resolveInjectText(home); - if (!inject.text) return { ok: false, error: "没有可注入的提示词,已取消重启" }; const clean = await core.ensureHostClean(); if (clean.ok) return clean; // 密封 asar 读的是旧包,清洗写在解包目录;允许换包重启,注入靠 assemble 包装。 @@ -258,9 +255,7 @@ export function registerPromptSections(ctx, config, _injectFile) { } function readInjectFallback(context) { - const home = core.findDshHome(); - try { core.seedOverrideSync(home); } catch { /* 落盘失败仍试读默认 */ } - return rules.resolveModeInject(home, isRedteamSession(context)); + return rules.resolveModeInject(core.findDshHome(), isRedteamSession(context)); } function installMnemonMessageStrip(ctx, config = {}) { @@ -373,17 +368,9 @@ function installIdentityOverride(ctx, config = {}) { installSubagentRoleCapture(ctx); const wrapAssemble = () => { try { - const prompt = ctx.systemPrompt; - if (!prompt || typeof prompt.assemble !== "function") return false; - if (prompt.assemble._dshPurgeWrapped) return true; - const orig = prompt.assemble.bind(prompt); - const wrapped = async function assembleWithPurge(...args) { - const assembled = await orig(...args); - return rewriteLiveAssembly(config, assembled, args[0]); - }; - wrapped._dshPurgeWrapped = true; - prompt.assemble = wrapped; - return true; + return installAssembleGuard(ctx.systemPrompt, (assembled, context) => ( + rewriteLiveAssembly(config, assembled, context) + )); } catch { return false; } @@ -536,7 +523,6 @@ async function autoApply(config) { if (sanitized.length) log(config, "desktop runtime sanitized:", JSON.stringify(sanitized)); const state = await core.gatherState(); - await core.installOverride(state.dsh_home, false); if (!state.ai_base) { log(config, "skip auto-apply: plugin root not found"); return "skip:plugin_root_not_found"; @@ -601,14 +587,8 @@ async function handlePurgeCommand(rawInput, config) { } else { handoff = core.sealedAsarHandoff(); } - core.seedOverrideSync(state.dsh_home); - await core.ensureOverrideContent(state.dsh_home, false); const blocked = rejectIfNeedPrompt(state.dsh_home); if (blocked) return { kind: "error", text: blocked.error }; - await core.saveOverrideContent( - state.dsh_home, - core.resolveApplyOverrideText(state.dsh_home, ""), - ); await core.backupAll(state.ai_base); const report = await core.applyPatches(state.ai_base); const shimResult = await core.patchAllShims(); @@ -968,15 +948,6 @@ export function apply(ctx, config) { throw e; } - try { - core.seedOverrideSync(core.findDshHome()); - } catch (e) { - console.warn("[dsh-purge] seed override error:", String(e)); - } - // 与 1.1.30 前一致:启动就落盘默认提示词,不依赖用户先点保存。 - core.installOverride(core.findDshHome(), false).catch((e) => { - console.warn("[dsh-purge] install override error:", String(e)); - }); try { applyHostHooks(ctx, cfg); } catch (e) { @@ -1116,14 +1087,8 @@ function applyHostHooks(ctx, cfg) { const scrubbed = core.sanitizeDesktopCommandRuntimes(); const state = await core.gatherState(); if (!state.ai_base) return { text: "ERROR: " + core.missingAiBaseMessage() }; - core.seedOverrideSync(state.dsh_home); - await core.ensureOverrideContent(state.dsh_home, false); const blocked = rejectIfNeedPrompt(state.dsh_home); if (blocked) return { text: "ERROR: " + blocked.error }; - await core.saveOverrideContent( - state.dsh_home, - core.resolveApplyOverrideText(state.dsh_home, ""), - ); await core.backupAll(state.ai_base); const report = await core.applyPatches(state.ai_base); await core.patchAllShims(); @@ -1477,28 +1442,20 @@ function installWebServer(ctx, cfg) { handoff = core.sealedAsarHandoff(); } const body = await readJsonBody(request); - // 点应用就落下默认提示词;框空时用内置默认,不必先点保存。 - core.seedOverrideSync(state.dsh_home); - await core.ensureOverrideContent(state.dsh_home, false); - const ui = await core.readOverrideForUi(state.dsh_home); const incoming = typeof body?.content === "string" ? body.content : ""; - // 框空时用内置默认,与 1.1.30 前「应用即带默认注入」一致,不必先点保存。 - const boxText = core.resolveApplyOverrideText(state.dsh_home, incoming) - || ui.content - || ui.defaultContent - || ""; - const blocked = rejectIfNeedPrompt(state.dsh_home, boxText); + const blocked = rejectIfNeedPrompt(state.dsh_home, incoming); if (blocked) { + const ui = await core.readOverrideForUi(state.dsh_home); sendJson(response, 400, { ok: false, needPrompt: true, - override_content: boxText, + override_content: incoming, defaultContent: ui.defaultContent, ...blocked, }); return; } - await core.saveOverrideContent(state.dsh_home, boxText); + await core.saveOverrideContent(state.dsh_home, incoming); await core.backupAll(state.ai_base); const report = await core.applyPatches(state.ai_base); const override = await core.readOverrideForUi(state.dsh_home); @@ -1636,7 +1593,6 @@ function installWebServer(ctx, cfg) { if (request.method === "GET") { try { const home = core.findDshHome(); - try { core.seedOverrideSync(home); } catch { /* 仍可读内置默认 */ } const ui = await core.readOverrideForUi(home); sendJson(response, 200, { ok: true, ...ui, ...injectSnapshot(home) }); } catch (e) { @@ -1653,17 +1609,16 @@ function installWebServer(ctx, cfg) { return; } const home = core.findDshHome(); - const resolved = core.resolveApplyOverrideText(home, content); - const blocked = rejectIfNeedPrompt(home, resolved); + const blocked = rejectIfNeedPrompt(home, content); if (blocked) { sendJson(response, 400, { ok: false, - content: resolved, + content, ...blocked, }); return; } - const saved = await core.saveOverrideContent(home, resolved); + const saved = await core.saveOverrideContent(home, content); sendJson(response, 200, { ok: true, ...saved, ...injectSnapshot(home) }); } catch (e) { sendJson(response, 500, { ok: false, error: String(e) }); diff --git a/lib/rules.js b/lib/rules.js index 32526b1..13f580f 100644 --- a/lib/rules.js +++ b/lib/rules.js @@ -1,7 +1,7 @@ import fs from "node:fs"; import { promises as fsp } from "node:fs"; import path from "node:path"; -import { defaultOverrideText, findDshHome, findOverrideFile, normalizeOverride } from "./core.js"; +import { findDshHome, findOverrideFile, normalizeOverride } from "./core.js"; import { modePromptText } from "./identity.js"; const RULE_ID_RE = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/; @@ -182,34 +182,25 @@ export function overrideFileText(dshHome) { } } -function promptOrDefault(dshHome) { - const disk = normalizeOverride(overrideFileText(dshHome)); - if (disk) return disk; - return normalizeOverride(defaultOverrideText()); +function diskPrompt(dshHome) { + return normalizeOverride(overrideFileText(dshHome)); } -/** 没启用规则集时只注入可编辑提示词。启用规则集后以规则集为主。两边都空则不注入。 */ +/** 磁盘上的提示词优先;没有则用当前规则集;两边都没有则不注入。不回落内置默认。 */ export function resolveInjectText(dshHome) { + const prompt = diskPrompt(dshHome); + if (prompt) return { text: prompt, source: "prompt", ruleId: null }; const ruleId = activeRuleId(dshHome); const rule = normalizeOverride(activeRuleText(dshHome)); if (rule) return { text: rule, source: "rule", ruleId }; - const prompt = promptOrDefault(dshHome); - if (prompt) return { text: prompt, source: "prompt", ruleId: null }; return { text: "", source: "none", ruleId }; } -/** - * 官方始终用默认提示词全文,含 CTF,不读规则集。 - * 红队开了规则集就只用规则集,不带默认提示词。 - * 红队没开规则集时用默认提示词,去掉 CTF。操作说明由组装接在后面。 - * 禁区说明不进模型。 - */ +/** 官方和红队同一顺序。红队再去掉 CTF。没有正文时不注入操作者段。 */ export function resolveModeInject(dshHome, redteam) { - const prompt = promptOrDefault(dshHome); - if (!redteam) return modePromptText(prompt, false); - const rule = normalizeOverride(activeRuleText(dshHome)); - if (rule) return modePromptText(rule, true); - return modePromptText(prompt, true); + const resolved = resolveInjectText(dshHome); + if (!resolved.text) return ""; + return modePromptText(resolved.text, Boolean(redteam)); } export async function activateRule(dshHome, id) {