dsh-concierge 0.0.0-stage → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ # dsh-concierge: settings page that checks app and plugin updates.
2
+ - insert:
3
+ - id: dsh-concierge
4
+ name: 'dsh-concierge'
package/docs/DETAIL.md ADDED
@@ -0,0 +1,129 @@
1
+ # Maintenance center
2
+
3
+ Settings → Maintenance center is split into five tabs: **Update** (app version, updates and the auto-update switch), **Plugins** (installed list, search, update / rollback / enable / uninstall), **Tools** (the safety switch at the top, then GitHub sources, install from npm, the GitHub token and the folder shortcuts — every input and the open-plugins / open-config / open-safe-mode buttons live here), **Performance** (FPS, long tasks and the degrade switches), **Typewriter** (gradual reveal, stream throttle and speed) and **About** (intro, version and a collapsible changelog).
4
+
5
+ Versioning: every release bumps the last digit (`0.1.1` → `0.1.2` → …). The changelog lives in `CHANGELOG.md` at the repo root; the About page reads it and `package.json` from the Host, so no code changes are needed for a release note.
6
+
7
+ ## What it checks
8
+
9
+ - **App**: reads `app-update.yml` from the installed desktop app's `resources` directory, follows the generic update feed it names (for example `https://download.deepseek.com/dsh-desk/feeds/win-x64/nightly.yml`) and compares the feed's `version` with the installed app version. When a new version exists, the desktop card shows **Check again / Update / Cancel**: Update calls the shell's own updater (`window.dshDesktop.updates.open()`), and the panel itself never opens a window; Cancel only hides the card until the next check. The Web surface has no native updater and falls back to the download page. The card also links to the GitHub releases page for a manual download.
10
+ - **npm plugins**: asks the plugin manager's `listVersions` for the installed registry copy, using the same registry and compatibility checks the plugin manager uses.
11
+ - **GitHub plugins**: for a plugin installed from a Git repository, asks GitHub for the latest release tag (falling back to tags), resolves the tag to a full commit, and compares that version with the installed one.
12
+
13
+ ## Updating
14
+
15
+ The **Update** button calls the plugin manager's `updateBundle`, so pnpm, the compatibility check, rollback of a failed installation and the restart outcome are owned by the plugin manager. A registry plugin updates to the exact newer version. A GitHub plugin updates to the Git spec that pins the resolved commit. The page reports when a restart is required.
16
+
17
+ **Update all** runs the same operation for every plugin that reports an update, one at a time.
18
+
19
+ **Auto-update** applies the same operation automatically after a check that finds updates. The switch is stored in the browser, and is on by default.
20
+
21
+ When a batch update finishes (auto-update or **Update all**), a result banner appears at the top of the page: one row per plugin with its version change and **Updated / Failed**, plus a hint to restart DSH. **Got it** dismisses it. The banner lives in the frame-wide overlay, so it survives closing the settings page until dismissed.
22
+
23
+ A single update uses the same top popup: with a restart it reads "Update finished — restart required" with a **Restart app** button; without one it reads "Update finished" with a **Reload UI** button. The detail names the plugin and its new version, and **Got it** dismisses it.
24
+
25
+ A detected update is announced as the same top banner, never as a popup: **Update available** with the version change and **Update / Got it**; only pressing Update enters the desktop shell's own update flow.
26
+
27
+ The app itself is only shown as updatable when the desktop shell reports an update (a newer feed/mirror version alone does not count), and only then does the Update button call the shell's updater.
28
+
29
+ Once the app update starts downloading, the top banner switches to a progress state: **Downloading update** with the version and percentage, and a 3px progress bar along the banner's bottom edge (light track, brand fill). Installing/starting shows a looping animation instead of a percentage, and the banner disappears when the phase ends.
30
+
31
+ Each npm-installed plugin row also has a **Rollback** button that lists every published version on the mirror (up to 50, current version marked); **Install** switches to that version. Rollback removes and reinstalls the package (the manager's update API only accepts newer versions) and restores the previous version if the install fails. GitHub and local installs are not supported yet.
32
+
33
+ When an update needs a restart (host-module plugins), the notice and the batch result banner offer **Restart app**. The sidebar foot also carries a **Reload & restart** dropdown with **Reload UI** and **Restart app** inside it.
34
+
35
+ - **Reload UI** only reloads the page and client plugins (`location.reload()`).
36
+ - **Restart app** calls the update center's own `POST /dsh-concierge/restart`: the Host creates a PowerShell helper through WMI (outside the app's process tree), which kills the Electron main process and relaunches the app, retrying up to 3 times and logging to `~/.dsh/update-center/restart.log`. It no longer depends on dsh-desktop-restart.
37
+
38
+ ## GitHub sources (multiple)
39
+
40
+ The plugins tab starts with a **GitHub sources** card: enter `owner/repo` or a full GitHub URL and press **Add**; any number of repos can be watched. Each source is checked against its latest release (falling back to tags):
41
+
42
+ - not installed → "latest x.y.z · not installed" with an **Install** button;
43
+ - installed → "latest · installed version", marked **update** when newer, with a **Reinstall** button;
44
+ - **Remove** only drops the watch entry, it never uninstalls the plugin.
45
+
46
+ The list lives in `~/.dsh/update-center/github-sources.json`.
47
+
48
+ Some plugins install in several steps (install, restart, configure in settings, restart again — `XRH66/dsh-memory-starter` is one). Each source row has a **Steps** button: it reads the numbered items of the repository README's quick-start / install section and shows them as a checklist with **Restart app** and **Open repo** buttons; the checklist opens automatically after installing from that row.
49
+
50
+ ## Install from Git
51
+
52
+ The plugins tab has an input: paste a GitHub URL (`https://github.com/owner/repo` or `github:owner/repo`) and it installs. The install resolves the repository HEAD to a full commit first, so the plugin lands as a pinned Git install that later checks and rollbacks can recognise.
53
+
54
+ Git plugins follow "GitHub releases (falling back to tags) → download → install": updates call `updateBundle` with the pinned spec, and fall back to "remove + reinstall from the target spec" when the manager refuses the spec form. Rollback lists up to 100 tags, newest first.
55
+
56
+ ## Local plugins
57
+
58
+ Local installs (`link:` / `file:`) have no registry and no release feed, so the source itself is inspected:
59
+
60
+ - a source directory's `package.json` version is compared with the installed one;
61
+ - a Git checkout records its current commit, and a changed commit or version offers a reinstall;
62
+ - `link:` installs are already live, so they only report that;
63
+ - a `.tgz` source has its inner `package.json` version read and its size+mtime remembered; a replaced tarball reports "source tarball updated" and can be reinstalled in one click (remove + install from the original spec).
64
+
65
+ ## Install and uninstall
66
+
67
+ - **Install from npm**: a card on the plugins tab takes a package name (`dsh-pet`) or name plus version (`dsh-pet@0.4.9`).
68
+ - **Uninstall**: every row ends with **Uninstall**; the first click becomes **Confirm uninstall?** and only the second one removes the plugin. The maintenance center itself has no uninstall button.
69
+ - **Ignore this version**: skip an update without disabling the plugin; the row then shows "Ignored x.y.z" with an **Unignore** button. The list is stored in the browser.
70
+ - **What's new**: GitHub-installed plugins with release notes get a **What's new** toggle that expands the release body.
71
+ - **Diagnosis**: common plugin-manager codes (`invalid-spec`, `incompatible-version`, `pendingBuilds`, `not-removable`, `bundle-in-use`, …) are translated into a plain-language hint and next step.
72
+
73
+ ## Safe mode
74
+
75
+ When a broken plugin keeps the app from starting, the plugin itself never gets to run — so on startup it writes scripts to `~/.dsh/update-center/`:
76
+
77
+ - **`safe-mode.cmd`** backs up the profile's `package.json` and `cordis.patch.yml` into `safe-backup/`, filters `dsh.profile.bundles` down to official bundles (`@deepseek-ai/*`), then launches the app;
78
+ - **`restore-mode.cmd`** restores the backup and restarts;
79
+ - **`safe-launch.cmd`** is the automatic version: it starts the app, watches it for 30 seconds, and if the process did not survive it backs up, switches to safe mode and starts again.
80
+
81
+ Point the desktop shortcut at `safe-launch.cmd` and a failed start lands in safe mode on its own.
82
+
83
+ The **Automatic safe mode** switch in the Tools tab's Safety card (stored as `safeModeAuto` in `~/.dsh/update-center/settings.json`, on by default) controls that behaviour: on, `safe-launch.cmd` watches the first 30 seconds and falls back; off, it only starts the app. Flipping it rewrites the scripts immediately.
84
+
85
+ All scripts need the app closed and no administrator rights; the `.ps1` files carry a UTF-8 BOM so Windows PowerShell 5.1 reads the Chinese text correctly.
86
+
87
+ ## GitHub token
88
+
89
+ The update tab takes a GitHub token (`ghp_…` / `github_pat_…`), stored in `~/.dsh/update-center/settings.json`:
90
+
91
+ - without one the GitHub API allows 60 requests/hour per IP, which a few sources exhaust;
92
+ - with one it is 5,000 requests/hour per account.
93
+
94
+ A public-repo read-only token is enough. The `GITHUB_TOKEN` / `GH_TOKEN` environment variables take precedence. Saving applies immediately, no restart.
95
+
96
+ ## Background check
97
+
98
+ The client plugin stays loaded and checks for updates every 10 minutes; when plugins can be updated it shows a top banner ("N plugin update(s) available"), at most once an hour, dismissible with **Got it**.
99
+
100
+ ## Enable, disable and roll back
101
+
102
+ Every plugin row also carries **Enable / Disable**, which goes through the plugin manager's `setPluginEnabled` and applies immediately (a few plugins need a restart). Registry plugins can roll back to any published version (up to 100); GitHub plugins roll back to any tag in the repository; local directory or tarball installs have no version list to roll back to.
103
+
104
+ If a plugin failed to load after the last update, the Host disables it on the next start and the page shows a banner ("N plugins failed to load and were disabled") with **Enable all**.
105
+
106
+ The plugins tab header has **Open plugins folder** and **Open config**, which open the profile's `node_modules` and `cordis.patch.yml`.
107
+
108
+ ## Chat performance
109
+
110
+ Four numbers: FPS (5-second average, shown as "current / screen refresh" — the ceiling follows the display refresh rate, detected among 60/75/90/100/120/144/165/240 or set by hand in the **Refresh rate** row), rendered chat rows, long-task count and total blocking time over the last 10 seconds, plus an 80-second bar history of long tasks and its peak. Four switches:
111
+
112
+ - **Auto degrade**: below 75% of the refresh rate for two seconds, `<html>` gets `data-dsh-perf="low"`, which drops animations, transitions, `backdrop-filter` and shadows inside the conversation; three seconds above 90% restore it.
113
+ - **Long-chat lite**: above 60 rows, `data-dsh-perf="long"` drops animations and transitions in the chat flow.
114
+ - **Force lite**: always stay in lite mode.
115
+ - **Skip offscreen rows**: enabled only above 40 rendered rows; each row gets `content-visibility: auto` with its **measured height** in `contain-intrinsic-size: auto <height>px` (not a fixed placeholder), applied from idle time in small slices so the scan itself does not jank; turn it off if scrolling ever misbehaves.
116
+
117
+ The conversation area no longer uses `backdrop-filter` at all: it sits on a static pre-blurred copy of the wallpaper (`#dsh-concierge-frost`), which is rasterised once and then only composited. Streaming therefore costs no extra blur work, and there is no runtime toggle to drop.
118
+
119
+
120
+ ## Typewriter
121
+
122
+ The page ends with a **Typewriter** card: a reveal switch and a speed slider (10–240 characters per second). It wraps the built-in `assistant-step` renderer and only paces the streaming text block; reasoning, tool rows and images stay native. The inner render commits at most every 50ms, and it stands down on low frame rates.
123
+
124
+ ## Limits
125
+
126
+ - The app itself is never replaced from this page.
127
+ - GitHub requests are unauthenticated unless `GITHUB_TOKEN` or `GH_TOKEN` is set in the Host environment, so they share GitHub's anonymous rate limit.
128
+ - Plugins installed from a local directory or tarball are listed but not checked.
129
+ - Results are cached for five minutes; **Check for updates** bypasses the cache.
@@ -0,0 +1,135 @@
1
+ # 维护中心
2
+
3
+ 设置 → 维护中心 分成五个标签页:**更新**(应用本体版本与更新、自动更新开关)、**插件**(已装插件列表、搜索、更新 / 回退 / 启停 / 卸载)、**工具**(安全开关在最上面,下面依次是 GitHub 来源、从 npm 安装、GitHub Token、目录与配置——所有输入框和「打开插件目录 / 打开配置 / 打开安全模式目录」都集中在这里)、**性能**(帧率、长任务与降级开关)、**打字机**(逐字显示、流式节流与速度)、**关于**(介绍、版本号、可折叠的更新日志)。
4
+
5
+ 版本号规则:每次发版最后一位 +1(`0.1.1` → `0.1.2` → …),更新日志写在仓库根的 `CHANGELOG.md`,「关于」页直接从宿主读它和 `package.json`,不用改代码。
6
+
7
+ ## 检查什么
8
+
9
+ - **应用本体**:读取桌面版安装目录 `resources` 下的 `app-update.yml`,按它声明的通用更新源(例如 `https://download.deepseek.com/dsh-desk/feeds/win-x64/nightly.yml`)取最新 `version`,与已安装版本比较。发现新版本时,桌面端卡片显示「重新检测 / 更新 / 取消」:更新调用桌面壳自己的更新流程(`window.dshDesktop.updates.open()`),面板自身不会弹出任何窗口;取消只是收起这张卡片,下次检查再出现。Web 端没有原生更新器,退化为打开下载页。卡片上另有一个 GitHub 发布页链接,方便手动下载。
10
+ - **npm 插件**:调用插件管理器的 `listVersions`,用与插件管理器相同的源和兼容性检查读取新版本。
11
+ - **GitHub 插件**:对从 Git 仓库安装的插件,向 GitHub 查询最新发布标签(没有发布时退回标签列表),把标签解析成完整 commit,再与已安装版本比较。
12
+
13
+ ## 更新
14
+
15
+ 「更新」按钮调用插件管理器的 `updateBundle`,pnpm、兼容性检查、失败回滚和重启结论都由插件管理器负责。npm 插件更新到指定的新版本;GitHub 插件更新到固定了目标 commit 的 Git spec。需要重启时页面会说明。
16
+
17
+ 「全部更新」会对每个有更新的插件依次执行同样的操作。
18
+
19
+ 「自动更新」开关打开后,每次检查发现有可更新项就自动执行全部更新;开关状态保存在浏览器本地,默认开启。
20
+
21
+ 应用本体只在桌面端自己报告有更新时才显示新版本(镜像或官方 feed 上出现新版本、但桌面端没有更新时不算),也只有这时才提供「更新」按钮去调用桌面壳的更新入口。自动更新关闭时发现插件可更新,同样会在页面顶部以横幅提示。
22
+
23
+ 顶部横幅显示「发现新版本」和版本变化,带「更新」「知道了」两个按钮;不弹窗,点「更新」才进入桌面壳自己的更新流程。
24
+
25
+ 应用更新开始下载后,顶部横幅会切换成进度样式:标题「正在下载更新」,下一行是版本号和百分比,卡片底边嵌一条 3px 进度条(浅色轨道 + 品牌色填充)。安装 / 启动阶段没有百分比,底边改成来回滚动的动画;结束或失败后横幅消失。
26
+
27
+ npm 安装的插件行尾还有一个「回退」按钮,展开后列出该插件在镜像上的全部已发布版本(最多 50 个,当前版本会标出来),点「安装」就能切到任意旧版本。回退走「先移除再安装」的路径(pluginManager 的更新接口只接受更新的版本),安装失败时会自动装回原来的版本;GitHub 和本地安装的插件暂不支持回退。
28
+
29
+ 更新需要重启时(host 模块类插件),通知条和批量更新的结果横幅上会出现「重启应用」按钮;侧边栏底部有一个「刷新与重启」下拉,里面是「刷新界面」和「重启应用」。
30
+
31
+ - **刷新界面**:只重载页面和客户端插件(`location.reload()`),不碰 Host;
32
+ - **重启应用**:调用更新中心自己的 `POST /dsh-concierge/restart`,由 Host 用 WMI 创建一个脱离应用进程树的 PowerShell 助手,先杀掉 Electron 主进程、再拉起应用;拉起失败会自动重试 3 次,过程写到 `~/.dsh/update-center/restart.log`。不再依赖 dsh-desktop-restart。
33
+
34
+ 批量更新(自动更新或「全部更新」)完成后,页面顶部会弹出一条结果横幅:逐行列出插件的版本变化和「已更新 / 失败」,并提示重启 DSH 后生效;点「知道了」关闭。横幅挂在 frame 级浮层上,关掉设置页后仍然保留,直到手动关闭。
35
+
36
+ 单个插件更新后同样走顶部弹窗:需要重启时标题是「更新完成,需要重启」,右侧「重启应用」;只需要刷新时标题是「更新完成」,右侧「刷新界面」。副行都是插件名和版本变化,不想现在动就点「知道了」。
37
+
38
+ ## GitHub 来源(可添加多个)
39
+
40
+ 插件页顶部有一张「GitHub 来源」卡片:输入 `owner/repo` 或完整 GitHub 地址点「添加」,可以加多个。每个来源会持续检测 GitHub 上的最新 release(没有 release 时退回 tags):
41
+
42
+ - 未安装的显示「最新 x.y.z · 未安装」,可以点「安装」;
43
+ - 已安装的显示「最新 · 已装版本」,有新版本时标「有更新」,可以点「重新安装」;
44
+ - 每行都有「移除」,只移除监控项,不会卸载插件。
45
+
46
+ 来源列表存在 `~/.dsh/update-center/github-sources.json`。
47
+
48
+ 有些插件是分步骤安装的(装完还要重启、去设置里配置、再重启验证,比如 `XRH66/dsh-memory-starter`)。每个来源行有一个「步骤」按钮:读仓库 README 里「快速开始 / 安装」章节的编号步骤,展开成清单,并附「重启应用」和「打开仓库」两个按钮;从来源行安装成功后会自动展开。
49
+
50
+ ## 从 Git 安装
51
+
52
+ 插件页顶部有一个输入框:填 GitHub 仓库地址(`https://github.com/owner/repo` 或 `github:owner/repo`)就能装。安装时会把仓库 HEAD 解析成完整 commit 再交给插件管理器,这样装出来的插件是「固定 commit 的 Git 安装」,之后能被更新检测和回退识别。装完自动出现在插件列表里,参与后续的检测与更新。
53
+
54
+ Git 插件走「GitHub releases(没有 release 时退回 tags)→ 下载 → 安装」的流程:更新调用 `updateBundle` 并带上固定 commit 的 spec;如果管理器因为 spec 形式不一致拒绝,会自动退回「移除 + 按目标 spec 重装」。回退时会列出仓库里最多 100 个 tag,按版本号排序。
55
+
56
+ ## 本地插件
57
+
58
+ 本地安装(`link:` / `file:`)的插件没有 registry,也没有 release feed,所以直接看源:
59
+
60
+ - 源是目录时,读它的 `package.json` 版本,比已装版本新就提示重装;
61
+ - 源是 Git 仓库时,记录当前提交;提交或版本变化时提示重装;
62
+ - `link:` 安装的代码本来就实时生效,只做提示,不提示重装;
63
+ - 源是压缩包(`.tgz`)时,读取包内 `package.json` 的版本;同时记录文件大小和修改时间,压缩包被替换时提示「源压缩包已更新」,可以一键重装(重装走「移除 + 按原 spec 安装」)。
64
+
65
+ ## 安装与卸载
66
+
67
+ - **从 npm 安装**:插件页有一张卡片,填包名(`dsh-pet`)或包名加版本(`dsh-pet@0.4.9`)就能装。
68
+ - **卸载**:每个插件行尾有「卸载」,点一次变成「确认卸载?」再点才真的卸;维护中心自己那行没有卸载按钮。
69
+ - **忽略此版本**:不想升某个版本时点「忽略此版本」,之后显示「已忽略 x.y.z」,可以随时「取消忽略」;忽略记录存在浏览器本地。
70
+ - **更新内容**:GitHub 安装的插件如果有 release 说明,行上会多一个「更新内容」按钮,展开就是这段说明。
71
+ - **错误诊断**:安装/卸载失败时,常见的插件管理器错误码(`invalid-spec`、`incompatible-version`、`pendingBuilds`、`not-removable`、`bundle-in-use` 等)会直接翻成中文提示和下一步动作。
72
+
73
+ ## 安全模式
74
+
75
+ 如果某个插件损坏、应用起不来,插件本身也没机会运行——所以本插件在启动时会把几个脚本写到 `~/.dsh/update-center/`:
76
+
77
+ - **`safe-mode.cmd`**:双击后先把 profile 的 `package.json` 和 `cordis.patch.yml` 备份到 `safe-backup/`,再把 `dsh.profile.bundles` 过滤成只留官方插件(`@deepseek-ai/*`),然后启动应用;
78
+ - **`restore-mode.cmd`**:应用退出后双击,恢复备份并重启;
79
+ - **`safe-launch.cmd`**:**自动版**——启动应用后观察 30 秒,如果进程没活下来就判定启动失败,自动备份、切到安全模式再重启一次;启动正常则什么都不做。
80
+
81
+ 把桌面快捷方式指向 `safe-launch.cmd`,以后应用起不来会自动落到安全模式,不用手动判断。
82
+
83
+ `safe-launch` 同时负责**自动恢复**:连续两次观察到启动正常后,自动把备份的插件配置放回去并重启一次(连续两次恢复失败后停止自动尝试;手动 `restore-mode` 会清零计数)。
84
+
85
+ 「工具」页最上面的「安全」卡片里有一个 **自动安全模式** 开关(存在 `~/.dsh/update-center/settings.json` 的 `safeModeAuto`,默认开):开着时 `safe-launch.cmd` 会观察 30 秒并在失败时自动切安全模式;关掉后它只负责启动应用,不再自动切。开关一变,脚本会立刻重写,不需要重启。
86
+
87
+ 所有脚本都要求应用已完全退出,不需要管理员权限;`.ps1` 带 UTF-8 BOM,Windows PowerShell 5.1 读中文不会乱码。
88
+
89
+ ## GitHub Token
90
+
91
+ 更新页可以填一个 GitHub token(`ghp_…` / `github_pat_…`),存在 `~/.dsh/update-center/settings.json`:
92
+
93
+ - 不带 token:GitHub API 每小时 60 次(按 IP),几条 GitHub 来源就够用完;
94
+ - 带 token:每小时 5000 次(按账号)。
95
+
96
+ 只读公开仓库的 token 就够(classic 全不勾权限,或 fine-grained 只给 public repo 读)。环境变量 `GITHUB_TOKEN` / `GH_TOKEN` 优先级更高,设了环境变量时页面里的输入会被覆盖。保存后立即生效,不用重启。
97
+
98
+ ## 后台检查
99
+
100
+ 客户端插件常驻,每 10 分钟检查一次更新;发现可更新插件时在顶部弹一条「发现 N 个插件更新」,一小时内最多提示一次,点「知道了」收起。
101
+
102
+ ## 插件启停与回退
103
+
104
+ 每个插件行尾除了「更新 / 回退」,还有「启用 / 禁用」:禁用走 pluginManager 的 `setPluginEnabled`,立即生效(个别插件需要重启)。npm 插件可以回退到镜像上的任意历史版本(最多 100 个);GitHub 安装的插件可以回退到仓库里的任意 tag;本地目录或压缩包装的插件没有可回退的版本。
105
+
106
+ 如果上次更新后某个插件加载失败,Host 会在下次启动时把它禁用;页面顶部会提示「有 N 个插件加载失败被禁用」并给出「全部启用」。
107
+
108
+ 插件页右上角有「打开插件目录」和「打开配置」,直接打开 profile 的 `node_modules` 和 `cordis.patch.yml`。
109
+
110
+ ## 聊天性能
111
+
112
+ 统计四项:帧率(5 秒平均,显示为「当前 / 屏幕刷新率」——上限由屏幕刷新率决定,自动识别 60/75/90/100/120/144/165/240,也可以在「刷新率」一行手动指定)、消息行数、最近 10 秒的长任务次数与累计阻塞毫秒,外加最近 80 秒的长任务条形历史和峰值。四个开关:
113
+
114
+ - **自动降级**:平均帧率连续 2 秒低于刷新率的 75% 时,给 `<html>` 加 `data-dsh-perf="low"`,关掉聊天区的动画、过渡、`backdrop-filter` 和阴影;连续 3 秒高于 90% 恢复。
115
+ - **长对话精简**:消息行超过 60 条时加 `data-dsh-perf="long"`,关掉聊天流里的动画和过渡。
116
+ - **强制精简**:不看帧率,始终按精简模式走。
117
+ - **启动加速**:把应用目录、`~/.dsh`、插件目录加进 Windows Defender 排除项。宿主没有管理员权限,所以打开开关时它会写一个脚本并请求 UAC 提权执行,结果回写到 `~/.dsh/update-center/startup-boost.json`,页面轮询这个文件显示状态。
118
+ - **屏幕外行跳过**:默认关。只在消息行超过 40 条时启用;按每行的**真实高度**写 `contain-intrinsic-size: auto <height>px`(不是固定占位),只处理真正在屏幕外的行,并在空闲时间分片扫描。Chromium 上 `content-visibility` 有已知的重绘和滚动抖动问题,聊天本身已经虚拟化了行,所以默认不开,长对话明显卡顿时再打开。
119
+
120
+ 会话区已经不再挂 `backdrop-filter`:它下面是一份壁纸的静态预模糊副本(`#dsh-concierge-frost`),只栅格化一次、之后只做合成。所以流式输出不会带来额外的模糊开销,也没有「流式时临时关模糊」这个开关。
121
+
122
+
123
+ ## 打字机
124
+
125
+ 页面底部还有一张「打字机」卡片:「逐字显示」开关、**流式节流**开关和速度滑杆(10–240 字/秒)。
126
+
127
+ - **逐字显示**:默认关。它包装内置的 `assistant-step` 渲染器,只把流式中的那段文字按字符预算逐字显示,思考、工具调用、图片保持原样;内层渲染最多每 50ms 提交一次,低帧率时自动让位。
128
+ - **流式节流**:默认开。流式输出时,把应用「每个 token 一次」的渲染合并成每 80ms 一次提交。Markdown 每 token 重新解析一遍是流式聊天闪烁的主因,节流能把重绘次数降到十分之一左右,肉眼几乎看不出延迟。
129
+
130
+ ## 限制
131
+
132
+ - 不会从本页替换应用本体。
133
+ - 未在 Host 环境设置 `GITHUB_TOKEN` 或 `GH_TOKEN` 时,GitHub 请求是匿名的,受 GitHub 匿名速率限制。
134
+ - 从本地目录或压缩包安装的插件只列出,不检查更新。
135
+ - 结果缓存 5 分钟;「检查更新」会跳过缓存。
@@ -0,0 +1,147 @@
1
+ # 玻璃皮肤的背景层:谁在画、怎么改
2
+
3
+ 这份笔记记的是「改了半天没生效」踩过的坑。写于 2026-11-24,对应版本 `0.17.6`。
4
+
5
+ ## 零、改完先确认:这一版到底跑起来没有
6
+
7
+ **这个 profile 没有 HMR**(`~/.dsh/profiles/desktop/node_modules/@deepseek-ai` 下没有 hmr 包),客户端改动**必须完整重启**:
8
+
9
+ | 改了什么 | 生效方式 |
10
+ |---|---|
11
+ | 宿主半(`index.js`、路由) | 重启 |
12
+ | **客户端半(`client.js`、样式)** | **重启**(刷新只是重新请求同一个旧 bundle) |
13
+ | 配置 / patch | 热生效 |
14
+
15
+ 判断「到底加载的是不是这一版」最快的办法:临时加一条一眼能看见的 CSS(比如窗口左上角一块洋红方块写版本号),重启后看它有没有出现。别靠感觉判断。
16
+
17
+ ## 一、颜色有两个入口,只有一个能改
18
+
19
+ DSH 的 `--dsw-*` token 有两条落地路径([token-map.md](https://raw.githubusercontent.com/Cenuon/dsh-opencode-ui/66066534874a3f5479df10c2959bba42d787e961/docs/token-map.md)):
20
+
21
+ | 路径 | 写入位置 | 谁写 |
22
+ |---|---|---|
23
+ | 静态样式表 | `document.head` 里的 `<style>` | `installThemeStyles(ctx)` |
24
+ | **内联样式** | **`document.body.style`** | `ThemePresenter.apply(snapshot)` |
25
+
26
+ `ctx.theme.overrideTokens()` 的叠加层最终**经 ThemePresenter 写成 body 内联样式**,而内联样式的优先级高于任何样式表规则(含 `!important`)。
27
+
28
+ **结论:token 只能用 `overrideTokens` 改,CSS 里写 `--dsw-xxx: … !important` 是无效的。**
29
+
30
+ ## 二、背景一共 5 层,各有钩子
31
+
32
+ 实测自 [dsh-theme-mist 视觉规范](https://raw.githubusercontent.com/ffyfox/dsh-theme-mist/078c7dfc4e2523935f11be0754080076b5c02a0b/docs/visual-spec.md)(0.2.1 / 0.2.2 双版本确认):
33
+
34
+ | 层 | 节点 | 驱动它的 token |
35
+ |---|---|---|
36
+ | 1 AppFrame | `[id='root'] > div[data-slot='root'] > div` | `--dsw-alias-bg-base` |
37
+ | 2 SidebarCol | `[data-slot='root'] > div > :has(> [data-slot='sidebar'])` | `--dsw-specific-sidebar-fill` |
38
+ | 3 SidebarRoot | `[data-slot='sidebar'] > :first-child` | 同上 |
39
+ | 4 ConversationRoot | `[data-slot='main.conversation'] > div` | `--dsw-alias-bg-base` |
40
+ | 5 **ComposerSeat** | **`[data-composer-seat]`**(仅 `[data-phase=active]`) | `--dsw-alias-bg-base`(36px 渐变的**终点色**) |
41
+
42
+ 第 5 层是踩坑最多的地方,见下。
43
+
44
+ ## 三、输入框座位:半透明的 token 会毁掉渐隐
45
+
46
+ 应用给座位挂的规则:
47
+
48
+ ```css
49
+ [data-composer-seat] {
50
+ background: linear-gradient(180deg,
51
+ color-mix(in srgb, var(--dsw-alias-bg-base) 0%, transparent) 0px,
52
+ var(--dsw-alias-bg-base) 36px);
53
+ }
54
+ ```
55
+
56
+ 玻璃皮肤把 `--dsw-alias-bg-base` 设成半透明(0.42)之后,**渐变的「实色端」也半透明了**——座位底下没有底,壁纸/预模糊层直接透上来,看着就是「输入框底下垫了一张磨砂纸」。
57
+
58
+ 这是官方记录过的坑:[dsh-web#98](https://github.com/zhu1090093659/dsh-web/issues/98),官方修法是:
59
+
60
+ > `fix(skins): opaque composer seat fade for background skins (#98)`
61
+ > Override the composerSeat fade to **the skin body color below the 36px fade band**
62
+ > — [commit 4138d4d](https://github.com/zhu1090093659/dsh-web/commit/4138d4dadc344ab2a9b04566150a8b0efadcd7b2)
63
+
64
+ 落到我们的样式:
65
+
66
+ ```css
67
+ html[data-dsh-glass="1"] [data-composer-seat],
68
+ html[data-dsh-glass="1"] [class*="_composerSeat"] {
69
+ background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0, var(--dsh-canvas) 36px) !important;
70
+ }
71
+ ```
72
+
73
+ **要点**:终点必须是**不透明**色(`--dsh-canvas`),不能继续用 `bg-base`。用半透明盖半透明,等于没盖——这是当时连着几版「改了没效果」的原因。
74
+
75
+ ## 四、顶部那 40px 不是页面画的
76
+
77
+ 标题栏那条是 `_frame` 的 `padding-top`,底色取 `--dsw-specific-sidebar-fill`;再往上是 Windows 的 WCO 遮罩,颜色来自主进程的 `chromeFallbackFill()`。
78
+
79
+ - 页面侧:`html[data-windows-titlebar]` 加在 **`html` 本身**上,选择器不能当后代找;
80
+ - 系统侧:`scripts/patch-titlebar-color.mjs` 把 `"#1b1b1c" : "#f9fafb"` 换成 `"#0e1116" : "#eef3fa"`(等长替换 3 处)。
81
+
82
+ ## 五、窗口本身是两层
83
+
84
+ 窗口是 `backgroundColor: #00000000` + `backgroundMaterial: acrylic`:DWM 在窗口后面画一份桌面模糊,页面再画自己的磨砂。**页面只要有一块透明,两层就会叠在一起**,看着又灰又脏。
85
+
86
+ - 想只留网页层:`scripts/patch-window-opaque.mjs`(把 `"#00000000"` 换成不透明的 `"#ffeef3fa"`,等长替换 27 处,跳过库里的 `NULL_COLOR` 哨兵值);
87
+ - 想只留系统层:把页面壁纸层置空,但顶部那条改不了,不推荐。
88
+
89
+ ## 六、排查顺序(下次别再猜)
90
+
91
+ 1. **先确认这一版跑起来了**:加一条显眼的临时 CSS(洋红方块 + 版本号),重启看它出现没有。没出现就别往下查——你改的根本不是跑的那份代码;
92
+ 2. **再确认插件加载了**:Client 的 `Slots.listSubTree` 查一个槽位的 `occupants`,看 `active` 是不是 `true`。控制台里 `import failed` 可能只是历史消息;
93
+ 3. 再确认 token 生效:token 在 `body` 内联样式里,`getComputedStyle` 查 body 上的变量值;
94
+ 4. 最后才改 CSS——而且要认准上面那张表的钩子,别用类名猜。
95
+
96
+ ## 七、两个「整条声明被丢弃」的坑(都踩过)
97
+
98
+ CSS 里一个值不合法,坏的不是那一个值,是**整条声明**。玻璃皮肤上踩过两次,症状都是「改了完全没反应」:
99
+
100
+ 1. **多层 `background-image` 里混进非法层**:壁纸层原本是
101
+ ```css
102
+ background-image: var(--dsh-grain, none), radial-gradient(…), radial-gradient(…), linear-gradient(…);
103
+ ```
104
+ 颗粒是 SVG data URI(带引号和逗号),`var()` 一替换进去,整条 `background-image` 被判非法 → 全部丢弃 → 壁纸永远不画。`background-color` 是另一条属性,所以「纯色能画、渐变画不了」。
105
+ **结论:壁纸层用单层 `background`;要叠多层就用伪元素,每个元素只一条 `background`。**
106
+
107
+ 2. **`element.style.backgroundImage = ''` 清不掉内联样式**:CSSOM 会忽略空值。清内联必须用 `removeProperty('background-image')`。否则上一次写进去的 `url(坏壁纸)` 会一直盖住样式表里的渐变,图片又加载失败 → 那一层什么都不画 → 露出窗口底色。
108
+
109
+ ## 八、body 有不透明背景
110
+
111
+ 应用 boot 时写:
112
+
113
+ ```js
114
+ const LIGHT_BACKGROUND = "#fff"; // 深色 #151517
115
+ body { background-color: #fff }
116
+ ```
117
+
118
+ 壁纸层是 `z-index: -1`,**正好被 body 那层不透明背景盖住**。玻璃皮肤必须让开:
119
+
120
+ ```css
121
+ html[data-dsh-glass="1"],
122
+ html[data-dsh-glass="1"] body,
123
+ html[data-dsh-glass="1"] #root { background: transparent !important; }
124
+ ```
125
+
126
+ ## 九、先看报错,再谈样式(今天最贵的一条)
127
+
128
+ **症状**:设置页「界面没了」——面板区域一片空,只剩遮罩盖着聊天,后面的文字隐约可见。
129
+
130
+ **误判路径**(走了两个多小时):以为是面板背景变透 → 调 `--dsw-alias-bg-layer-2` → 补 `bg-l1`/`bg-l2`/`bg-elevated` → 加 `solid()` 免缩放 → 涂实遮罩。全打偏。
131
+
132
+ **真因**:
133
+
134
+ ```js
135
+ React.useEffect(() => { … }, [autoUpdate]) // 先用
136
+ const [autoUpdate, setAutoUpdate] = React.useState(…) // 后声明
137
+ ```
138
+
139
+ `const` 在初始化前处于暂时性死区(TDZ),渲染到这里直接抛
140
+ `Cannot access 'autoUpdate' before initialization`——**整个组件崩掉**,所以那块什么都没渲染。看起来像「样式变透了」,实际是「组件没了」。
141
+
142
+ **教训**:
143
+
144
+ 1. 改完先看浏览器控制台有没有红字。有报错就别动样式——样式救不了崩溃的组件;
145
+ 2. 「界面变透 / 变空 / 少一块」优先怀疑**渲染失败**,而不是颜色;
146
+ 3. 只改过一处却出问题,先查自己改的那一处,别去翻无关的 token;
147
+ 4. 同一个症状连试三次没解决,就换方法——今天的三层补丁加起来不如一行挪位置。
@@ -0,0 +1,126 @@
1
+ # 密钥与安全模式
2
+
3
+ 这份文档讲两件事:**GitHub Token 怎么申请、插件从哪里读**,以及**插件把应用搞崩时怎么进安全模式**。
4
+
5
+ ---
6
+
7
+ ## 一、GitHub Token
8
+
9
+ ### 为什么要配
10
+
11
+ 维护中心要查 GitHub 上的插件版本(releases / tags / commits)、读仓库 README 生成安装步骤、检测你添加的 GitHub 来源。GitHub 对 API 请求有限流:
12
+
13
+ | 身份 | 上限 |
14
+ |---|---|
15
+ | 匿名(不带 token) | 60 次/小时,按 IP 算 |
16
+ | 带 token | 5,000 次/小时,按账号算 |
17
+
18
+ 不配也能用,只是几条来源加几次刷新就可能把匿名额度用完,界面会提示「GitHub 速率限制」。
19
+
20
+ ### 两种 token 怎么申请
21
+
22
+ GitHub 现在有两种个人访问令牌,**任选一种**,只读公开仓库就够。
23
+
24
+ #### 方式一:细粒度 token(推荐)
25
+
26
+ 1. 打开 <https://github.com/settings/personal-access-tokens/new>
27
+ 2. **Token name**:随便填,例如 `dsh-concierge`
28
+ 3. **Expiration**:选有效期(30 天 / 90 天 / 自定义)
29
+ 4. **Repository access**:选 **Public repositories (read-only)**
30
+ 5. **Permissions**:一个都不用勾(读公开仓库的 releases/tags 是默认能力)
31
+ 6. 点 **Generate token**,复制生成的 `github_pat_…`
32
+
33
+ #### 方式二:经典 token
34
+
35
+ 1. 打开 <https://github.com/settings/tokens>
36
+ 2. **Generate new token (classic)**
37
+ 3. **Note**:随便填;**Expiration**:选有效期
38
+ 4. **Scopes**:一个都不勾
39
+ 5. 点 **Generate token**,复制生成的 `ghp_…`
40
+
41
+ > 两种 token 生成后**只显示一次**,关掉页面就看不到了,记得当场复制。
42
+
43
+ ### 插件从哪里读
44
+
45
+ 按这个顺序,前一个存在就用前一个:
46
+
47
+ | 顺序 | 来源 | 读取时机 |
48
+ |---|---|---|
49
+ | 1 | 环境变量 `GITHUB_TOKEN` | 每次请求时读,改了要重启应用 |
50
+ | 2 | 环境变量 `GH_TOKEN` | 同上 |
51
+ | 3 | `~/.dsh/update-center/settings.json` 里的 `githubToken` | 启动时读一次;页面保存后立即生效,不用重启 |
52
+
53
+ 页面里填的写进第 3 项。如果同时设了环境变量,页面会提示「已从环境变量读取,这里的输入会被覆盖」。
54
+
55
+ ### 怎么填
56
+
57
+ 设置 → 维护中心 → **插件** → **GitHub 来源**卡片下面那张 **GitHub Token** → 粘贴 → 保存。已配置时会显示掩码(例如 `ghp_…7890`),旁边有「清除」。卡片下面就是说明:为什么要配、怎么申请、插件从哪里读。
58
+
59
+ ### 额度用完了怎么办
60
+
61
+ - 等一小时(额度按小时滚动);
62
+ - 或者配 token;
63
+ - 或者减少 GitHub 来源、少点「检查更新」。
64
+
65
+ ---
66
+
67
+ ## 二、安全模式
68
+
69
+ ### 什么时候用
70
+
71
+ 某个插件损坏(更新后不兼容、代码有 bug)导致应用**起不来**时。这种情况下插件自己也没机会运行,所以维护中心会在启动时把恢复脚本写到 `~/.dsh/update-center/`,用脚本在**应用外面**先把坏的第三方插件停掉,再启动。
72
+
73
+ ### 三个脚本
74
+
75
+ | 脚本 | 作用 |
76
+ |---|---|
77
+ | `safe-launch.cmd` | **自动版**:启动应用 → 观察 30 秒 → 进程没活下来就判定启动失败 → 备份配置、只留官方插件(`@deepseek-ai/*`)→ 重启进安全模式 |
78
+ | `safe-mode.cmd` | **手动版**:直接备份配置、只留官方插件、启动应用 |
79
+ | `restore-mode.cmd` | 恢复:把 `safe-backup/` 里的 `package.json` 和 `cordis.patch.yml` 拷回去,然后重启 |
80
+
81
+ **自动恢复**:用 `safe-launch` 启动时,如果连续两次观察到「启动正常」,它会自动把备份的插件配置放回去并重启一次——不用手动双击 `restore-mode.cmd`。恢复后如果又崩,下次启动会重新落回安全模式;连续两次恢复失败后就不再自动尝试,等你手动处理。手动跑 `restore-mode.cmd` 会把自动恢复的计数清零。
82
+
83
+ 每个 `.cmd` 都有一个同名的 `.vbs` 静默版:双击后**不弹命令窗口**,全程在后台跑。代价是看不到过程输出,出问题时只能看结果(应用有没有起来、配置有没有改)。要观察过程就用 `.cmd`。
84
+
85
+ 安全模式做的事很简单:把 profile 的 `dsh.profile.bundles` 过滤成只剩官方插件。第三方插件(包括维护中心自己)临时不加载。
86
+
87
+ ### 怎么用自动版
88
+
89
+ 把桌面快捷方式的「目标」从应用 exe 改成:
90
+
91
+ ```
92
+ C:\Users\<你>\.dsh\update-center\safe-launch.cmd
93
+ ```
94
+
95
+ 之后每次双击快捷方式启动,都会自动检测:启动失败就落到安全模式,正常启动什么都不做。
96
+
97
+ > 副作用:每次启动会多一个命令行窗口,观察 30 秒后自动消失。
98
+
99
+ ### 恢复
100
+
101
+ 确认应用能正常启动后,**先完全退出应用**,再双击 `restore-mode.cmd`。它会恢复原来的插件配置并重新启动。
102
+
103
+ 想手动恢复也可以:把 `~/.dsh/update-center/safe-backup/` 里的两个文件拷回 `~/.dsh/profiles/desktop/`。
104
+
105
+ ### 注意事项
106
+
107
+ - 所有脚本都要求应用**已完全退出**,否则会提示先退出;
108
+ - 不需要管理员权限;
109
+ - `.ps1` 带 UTF-8 BOM,Windows PowerShell 5.1 读中文不会乱码;
110
+ - 恢复用的备份只有一份,每次进安全模式会覆盖上一次的备份——如果你在安全模式下又手动改过配置,恢复前先自己再备份一次。
111
+
112
+ ---
113
+
114
+ ## 常见问题
115
+
116
+ **Q:填了 token 还是提示速率限制?**
117
+ 先看页面提示是不是「已从环境变量读取」——如果是,环境变量里的 token 优先,页面里填的无效。也可能是 token 过期或权限不够,重新生成一个。
118
+
119
+ **Q:安全模式启动了,但插件列表全没了?**
120
+ 这是预期行为:安全模式只加载官方插件。双击 `restore-mode.cmd` 恢复。
121
+
122
+ **Q:`safe-launch.cmd` 每次都要等 30 秒窗口?**
123
+ 窗口只是观察期,应用本身已经启动,可以正常使用,30 秒后窗口自动关。
124
+
125
+ **Q:能把安全模式做成开机自动检测吗?**
126
+ 可以,但需要常驻进程或计划任务,维护中心没有这么做——它只在启动时写脚本,不常驻。