dsh-sidebar-suite 0.1.3 → 0.2.4

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.
package/DETAIL.md CHANGED
@@ -1,64 +1,137 @@
1
- # 侧栏布局大师 · Sidebar Suite
2
-
3
- > **中文**:左侧栏里「扩展」和「工作区」永远在抢同一块高度。装了几插件之后,找一个入口要滚半天;项目一多,扩展就被挤没。这个插件把它们理顺成三种布局,一键切换,而且**默认布局就在本页最上方**,打开详情页第一眼就能改。
4
- >
5
- > **English**: The panels group and the workspaces group fight for the same vertical space in the DSH sidebar. Once you install a few plugins, finding anything means scrolling; add more projects and the panels vanish entirely. Sidebar Suite gives you three clean layouts, switches them in one click, and puts the **startup-default picker at the very top of this page** — no scrolling, no YAML editing.
6
-
7
- ---
8
-
9
- ## 三种布局 / Three layouts
10
-
11
- | 模式 / Mode | 中文 | English |
12
- | --- | --- | --- |
13
- | `a` 折叠 / Fold | 两组各自收起,想留哪块留哪块。 | Each group folds independently — keep exactly what you need. |
14
- | `b` 标签页 / Toggle (**默认 / default**) | 两组共用一栏,用顶部按钮互斥切换,侧栏再长也不打架。 | Both groups share one space; the bar swaps between them. The sidebar stays short. |
15
- | `c` 浮层 / Overlay | 工作区常驻,扩展以浮层盖在上面,随时展开/收起。 | Workspaces stay put; panels open as a floating layer you can show or hide. |
16
-
17
- 每张布局卡片都画了示意图,选中的那张标着「当前默认 / Current」。点一下就通过官方配置层写入,**立刻生效、下次启动照旧**。
18
- Each card draws a small diagram of its layout, and the selected one is marked as the current default. A click writes through the official config layer — **effective immediately and on every future launch**.
19
-
20
- ## 为什么好用 / Why you'll like it
21
-
22
- - **设置项置顶 / Settings first** — 图形化设置被提到详情页最上方,长说明、版本信息、组件列表都排在它后面。The graphical defaults are pinned above the long description, version info and component list.
23
- - **会话与默认分离 / Session ≠ default** — 侧栏上临时换布局只影响本次会话,不写盘;只有详情页的设置会改默认值。Switching from the sidebar bar is session-only; only this page changes the startup default.
24
- - **零侵入 / Zero rewrites** — 只往 `<html>` 上写属性、加一条控制栏,绝不重构宿主 DOM,React 重绘后自动重新挂载。Only `<html>` attributes and one control bar; the host's markup is never restructured, and everything re-resolves after React rebuilds.
25
- - **中英双语 / Bilingual** — 界面文案、详情内容、设置说明全部中英对照。UI labels, this document and the settings copy are all bilingual.
26
- - **不联网 / Offline** — 收款码随插件打包由宿主本地提供,配置只落在本机 profile。The QR ships with the bundle and is served locally; config stays in your profile.
27
-
28
- ## 支持作者 / Support the author
29
-
30
- 如果这个插件让你每天少滚几次侧栏,欢迎请作者喝杯咖啡 —— **完全自愿,无任何回报承诺,也没有付费墙**。
31
- If this plugin saves you a few scrolls every day, you can buy the author a coffee. **Entirely voluntary, no rewards promised, no paywall.**
32
-
33
- ![微信支付收款码 / WeChat Pay QR code](assets/wechat-pay.jpg)
34
-
35
- **微信支付 / WeChat Pay** — 打开微信「扫一扫」即可 / open WeChat → Scan.
36
- 作者本机另外把同一个码登记进了 **dsh-tip-jar 打赏罐**;那份注册表属于本机配置,**不随本插件分发**。
37
- The author also registers the same QR locally in the **dsh-tip-jar** sponsor centre; that registry is **not shipped with this bundle**.
38
-
39
- ---
40
-
41
- ## 控制栏在哪 / Where the controls are
42
-
43
- 侧栏顶部一排文字按钮:`折叠 · 标签页 · 浮层 │ 显示工作区 / 展开扩展 · 换布局`。
44
- A single row of text buttons sits at the top of the sidebar. `换布局 / Cycle` is hidden below 300 px and can be turned off with `showQuickSwitch: false`.
45
-
46
- ## 安装与生效 / Install & apply
47
-
48
- ```sh
49
- dsh plugin --profile desktop add dsh-sidebar-suite
50
- ```
51
-
52
- 本地开发可把包名换成本目录路径或 `.tgz` 安装包。已在 **DSH 0.2.2-rc.1(desktop profile)** 验证。
53
- For local development, point the same command at this folder or a packed `.tgz`. Tested on **DSH 0.2.2-rc.1 (desktop profile)**.
54
-
55
- **客户端代码不会热重载 / the client half is not hot-reloaded** — 安装或改动文件后请完全退出并重新打开 DSH / fully quit and reopen DSH after installing or editing files.
56
-
57
- > 组合包自带的 `cordis.patch.yml` 会自动挂载,不要再往 profile 的 `cordis.patch.yml` 里加同名行,否则会加载两次。
58
- > The bundle patch mounts the plugin automatically; do not add a manual mount line or it loads twice.
59
-
60
- ## 已知限制 / Known limits
61
-
62
- - `[data-slot="sidebar.workspaces"]` 与 `panelList` 是宿主的半稳定约定;若宿主改版,插件会退化成「有控制栏但无效果」而不是抛错。These host markup contracts are semi-stable; a host change degrades gracefully instead of throwing.
63
- - 浮层定位依赖 `:has()`,需要 Chromium 内核(DSH 桌面端即是)。Overlay positioning uses `:has()`, so it needs a Chromium-based client.
64
- - 标签页模式会整块隐藏工作区区域,里面的其它入口也一并隐藏 —— 这是「一组一栏」的刻意设计。Toggle mode hides the whole workspaces region, including anything else the host renders inside it.
1
+ # 侧栏布局大师 · Sidebar Suite
2
+
3
+ > **中文**:**这是一款专门针对改进 DSH 左侧栏体验的插件。** 左侧栏里「扩展」和「工作区」永远在抢同一块高度;装了几个插件之后,找一个入口要滚半天;项目一多,扩展就被挤没。它只解决这一处,但要把它做到**既强实用、又好看**:三种布局一键切换、**默认布局就在本页最上方**、会话列表默认全部展开、临时会话用完即删;界面全程沿用宿主原生配色、圆角与间距,不另起一套皮肤。
4
+ >
5
+ > **English**: **This is a plugin dedicated to improving the DSH sidebar experience.** The panels group and the workspaces group fight for the same vertical space; once you install a few plugins, finding anything means scrolling; add more projects and the panels vanish entirely. It fixes only that one surface, but fixes it properly — **seriously practical and native-looking**: three layouts in one click, the **startup-default picker at the very top of this page**, an always-expanded session list, disposable temporary sessions, and a UI built entirely from the host's own colours, radii and spacing instead of a custom skin.
6
+
7
+ ---
8
+
9
+ ## 三种布局 / Three layouts
10
+
11
+ | 模式 / Mode | 中文 | English |
12
+ | --- | --- | --- |
13
+ | `a` 折叠 / Fold | 两组各自收起,想留哪块留哪块。 | Each group folds independently — keep exactly what you need. |
14
+ | `b` 标签页 / Toggle (**默认 / default**) | 两组共用一栏,用顶部按钮互斥切换,侧栏再长也不打架。 | Both groups share one space; the bar swaps between them. The sidebar stays short. |
15
+ | `c` 浮层 / Overlay | 工作区常驻,扩展以浮层盖在上面,随时展开/收起。 | Workspaces stay put; panels open as a floating layer you can show or hide. |
16
+
17
+ 每张布局卡片都画了示意图,选中的那张标着「当前默认 / Current」。点一下就通过官方配置层写入,**立刻生效、下次启动照旧**。
18
+ Each card draws a small diagram of its layout, and the selected one is marked as the current default. A click writes through the official config layer — **effective immediately and on every future launch**.
19
+
20
+ ## 这是一款什么插件 / What this plugin is
21
+
22
+ **定位 / Focus**:只做左侧栏。不改会话内容、不换模型、不做独立面板、不接云端服务 —— 把「找得到、切得快、看着顺」这一件事做透。
23
+ **In one line**: this is a **sidebar-experience plugin**, and nothing else. It does not touch your conversations, swap models, add a floating dashboard or call a server; it makes the one strip on the left findable, fast and calm.
24
+
25
+ ### 强实用性 / Seriously practical
26
+
27
+ - **设置项置顶 / Settings first** — 图形化设置被提到详情页最上方,长说明、版本信息、组件列表都排在它后面;打开页面第一眼就能改启动默认布局。The graphical defaults are pinned above the long description, version info and component list.
28
+ - **会话与默认分离 / Session ≠ default** — 侧栏上临时换布局只影响本次会话,不写盘;只有详情页的设置会改默认值。Switching from the sidebar bar is session-only; only this page changes the startup default.
29
+ - **零侵入 / Zero rewrites** — 只往 `<html>` 上写属性、加一条控制栏,绝不重构宿主 DOM,React 重绘后自动重新挂载,也不影响 `dsh-deepseek-chat` 这类别的插件。Only `<html>` attributes and one control bar; the host's markup is never restructured, everything re-resolves after React rebuilds, and other sidebar plugins keep working.
30
+ - **会话不用再点「展开其余」/ No more "Show N more"** — 会话列表默认全部展开,折叠按钮也不再显示;按宿主自己的按钮展开、不改宿主 DOM。`EXPAND_ALL_SESSIONS=off` 可恢复原样。Every session is shown and the host's overflow control is hidden, driven through the host's own button; `EXPAND_ALL_SESSIONS=off` restores DSH's folding.
31
+ - **临时会话 / Temporary session** — 点「临时」在左侧栏开一个**真正的 DSH 会话**(原生窗口、当前模型与工具链、可并行多任务),退出 DSH 时或每天定时自动删除;两个开关都在本页顶部,改完立即生效。Opens a real DSH session in the sidebar, with the native window and current model/toolchain, then removes it on quit or on a daily schedule — both switches live at the top of this page.
32
+ - **反馈有确定入口 / Feedback that reaches someone** — 详情页底部三个按钮:复制报告(自动带上版本、系统、布局、最近错误)、预填的 GitHub Issue、插件市场规定的评论区。Three channels at the bottom of this page, with version, OS, layout and last error already filled in.
33
+ - **不联网 / Offline** — 收款码随插件打包由宿主本地提供,配置只落在本机 profile。The QR ships with the bundle and is served locally; config stays in your profile.
34
+ - **中英双语 / Bilingual** — 界面文案、详情内容、设置说明全部中英对照。UI labels, this document and the settings copy are all bilingual.
35
+
36
+ ### 美观性 / Looks native
37
+
38
+ - **不另起一套皮肤 / No custom skin** — 颜色、边框、文字层级全部取宿主的设计变量(`--dsw-alias-*`),深色 / 浅色主题自动跟随,侧栏里不会出现一块「外来的」色块。Colours, borders and text levels come from the host's own design tokens, so light and dark themes both look native.
39
+ - **视觉重量对齐 / Same visual weight** — 控制栏用 11px 细字号、6px 圆角、1px 分隔线,和宿主按钮同一量级;选中态只加一层浅底色和半粗字重,不用刺眼高亮。The bar uses 11 px text, 6 px radii and a 1 px divider; the active state is a subtle tint plus medium weight.
40
+ - **看得懂的示意图 / Diagrams, not words** — 三张布局卡各画一个 36×24 的迷你侧栏示意,选中的那张标「当前默认」,不用读说明也能分辨。Each layout card draws a 36×24 mini sidebar and marks the current default.
41
+ - **不遮挡、不闪烁 / No jumps** — 隐藏分组用 `display:none` + `aria-hidden` + `inert`,切换是纯 CSS 显隐,不卸载重建节点;浮层用 10px 圆角和柔和阴影盖在工作区上方,不把内容挤走。Pure-CSS show/hide, no unmounting; the overlay uses a 10 px radius and a soft shadow.
42
+ - **标记不破坏行高 / Unobtrusive badges** — 「临时」标签由 CSS `::after` 画在会话行上,不插入新节点,行高、缩进、悬停态跟原生会话完全一致。The TEMP badge is a CSS pseudo-element, so rows keep their native height, indent and hover state.
43
+ - **克制 / Restrained** — 没有弹窗、没有引导蒙层、没有独立设置窗口;新增内容只收在侧栏顶部一排按钮和本页原有的卡片里。No popups, no onboarding overlay, no separate settings window.
44
+
45
+ ## 支持作者 / Support the author
46
+
47
+ 如果这个插件让你每天少滚几次侧栏,欢迎请作者喝杯咖啡 —— **完全自愿,无任何回报承诺,也没有付费墙**。
48
+ If this plugin saves you a few scrolls every day, you can buy the author a coffee. **Entirely voluntary, no rewards promised, no paywall.**
49
+
50
+ ![微信支付收款码 / WeChat Pay QR code](assets/wechat-pay.jpg)
51
+
52
+ **微信支付 / WeChat Pay** — 打开微信「扫一扫」即可 / open WeChat → Scan.
53
+ 作者本机另外把同一个码登记进了 **dsh-tip-jar 打赏罐**;那份注册表属于本机配置,**不随本插件分发**。
54
+ The author also registers the same QR locally in the **dsh-tip-jar** sponsor centre; that registry is **not shipped with this bundle**.
55
+
56
+ ---
57
+
58
+ ## 反馈 / Feedback
59
+
60
+ 插件详情页最下面有一块「反馈 · Feedback」:写一句描述,然后选三个按钮之一 ——「复制反馈内容」把「描述 + 环境」整段放进剪贴板;「在 GitHub 提 issue」打开一个**已填好标题和正文**的 issue 页面;「插件市场评论区」打开 `dsh-market` 规定的那条插件讨论。
61
+ The plugin detail page ends with a **Feedback** box: describe the problem, then **Copy report**, **Open an issue** (pre-filled), or **Marketplace comments** — the discussion thread the plugin market defines for this plugin.
62
+
63
+ DSH 宿主没有第三方插件的反馈字段(插件管理详情页不读 `bugs`);`package.json` 的 `bugs.url` 是 npm 标准字段,只给工具/网页用。市场这一侧由 `dsh-market` 规定:每个插件一条 GitHub Discussion,落在公开目录仓库 `awesome-dsh-plugin/awesome-dsh-plugin`,标题带 `plugin:YONAN1269/dsh-sidebar-suite`。所以本插件直接接了这条,而不是再自造第四个入口。
64
+ DSH itself defines no feedback field for third-party bundles; the market's `dsh-market` does: one GitHub Discussion per plugin in the public catalog repository, keyed on `plugin:<owner/repo>`.
65
+
66
+ 自动带上的环境信息:插件版本(读自 `package.json`)、DSH 桌面客户端版本、Node / Electron、操作系统与位数、当前默认布局、临时按钮模式、临时会话数、后端路由条数、最近一次清理结果、最近一次错误。
67
+ The report always carries: plugin version (read from `package.json`, so it cannot drift from the code you run), desktop client version, Node / Electron, OS and arch, current layout, Temp-button mode, tracked session count, registered route count, the last cleanup result and the last error.
68
+
69
+ - 草稿存在浏览器本地 `localStorage` 的 `dsh-sidebar-suite:feedback-draft`,关掉页面再回来还在。 / The draft lives in `localStorage`, so closing the page does not lose it.
70
+ - 用不了 GitHub 就走剪贴板 —— 粘到任何能联系到作者的地方即可(**复制不会自动发送**)。 / No GitHub account? The clipboard path works with any channel; copied text is never sent automatically.
71
+ - **作者在哪收到 / Where the author sees it**:issue 进本仓库 [Issues](https://github.com/YONAN1269/dsh-sidebar-suite/issues)(仓库所有者默认自动 watch,会收到通知;也可在仓库页 `Watch` → `All Activity` 确认);市场评论进 [目录仓库的 Discussions](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/discussions?discussions_q=%22plugin%3AYONAN1269%2Fdsh-sidebar-suite%22)(**不在本仓库**,作者需要 watch 那条讨论);统一收件箱 [github.com/notifications](https://github.com/notifications)。
72
+ - 市场评论区第一次打开可能显示「There are no matching discussions.」——说明还没人留言;回 DSH 插件市场点该插件卡片的「评论」,第一条留言会自动建帖。 / If the marketplace thread is empty, press "评论 / Comments" on the plugin card inside the market — the first comment creates the discussion.
73
+ - 直接开网页:[Issues](https://github.com/YONAN1269/dsh-sidebar-suite/issues/new/choose)(问题)、[Discussions](https://github.com/YONAN1269/dsh-sidebar-suite/discussions)(用法讨论)。
74
+
75
+ ---
76
+
77
+ ## 控制栏在哪 / Where the controls are
78
+
79
+ 侧栏顶部一排文字按钮:`折叠 · 标签页 · 浮层 │ 显示工作区 / 展开扩展 · 换布局`。
80
+ A single row of text buttons sits at the top of the sidebar. `换布局 / Cycle` is hidden below 300 px and can be turned off with `showQuickSwitch: false`.
81
+
82
+ ## 安装与生效 / Install & apply
83
+
84
+ ```sh
85
+ dsh plugin --profile desktop add dsh-sidebar-suite
86
+ ```
87
+
88
+ 本地开发可把包名换成本目录路径或 `.tgz` 安装包。已在 **DSH 0.2.2-rc.1(desktop profile)** 验证。
89
+ For local development, point the same command at this folder or a packed `.tgz`. Tested on **DSH 0.2.2-rc.1 (desktop profile)**.
90
+
91
+ **客户端代码不会热重载 / the client half is not hot-reloaded** — 安装或改动文件后请完全退出并重新打开 DSH / fully quit and reopen DSH after installing or editing files.
92
+
93
+ > 组合包自带的 `cordis.patch.yml` 会自动挂载,不要再往 profile 的 `cordis.patch.yml` 里加同名行,否则会加载两次。
94
+ > The bundle patch mounts the plugin automatically; do not add a manual mount line or it loads twice.
95
+
96
+ ## 已知限制 / Known limits
97
+
98
+ - `[data-slot="sidebar.workspaces"]` 与 `panelList` 是宿主的半稳定约定;若宿主改版,插件会退化成「有控制栏但无效果」而不是抛错。These host markup contracts are semi-stable; a host change degrades gracefully instead of throwing.
99
+ - 浮层定位依赖 `:has()`,需要 Chromium 内核(DSH 桌面端即是)。Overlay positioning uses `:has()`, so it needs a Chromium-based client.
100
+ - 标签页模式会整块隐藏工作区区域,里面的其它入口也一并隐藏 —— 这是「一组一栏」的刻意设计。Toggle mode hides the whole workspaces region, including anything else the host renders inside it.
101
+
102
+ ## 临时会话 / Temporary session(0.2.0)
103
+
104
+ 「临时」按钮创建的**是一个真正的 DSH 会话**,因此:在左侧栏可见、用原生会话窗口、继承当前模型和工具链、可以随意切换任务;只有「退出即删除」这一点是插件加的。
105
+
106
+ 实现路径(全部在 `app.asar` 0.2.2-rc.1 上核实):
107
+
108
+ - **创建**:Client 半调用 `ctx.get('uiWorkspace').createNamed({ workspaceId })` 再 `openSession(id)` —— 与宿主「新会话」按钮同一条链路(`dsh-client-ui-workspace` 的 `createInWorkspace` → `sessions.create` → `session/create`)。不传 `sessionId`,所以不会复用你已有的空白会话。
109
+ - **标记**:把会话 id POST 给 Host 半,写进 `~/.dsh/dsh-sidebar-suite/temp-sessions.json`;侧栏行按 `data-row-key="session:<id>"` 打 `data-dsbs-temp-row` 属性,用 CSS `::after` 画「临时」标签(只加属性、不加节点,React 重渲染不会弄丢)。
110
+ - **删除**:Host 半删 `~/.dsh/sessions/<项目>/<id>/` 与 `storages/session_projcache/sessions/session-<id>.json`。两道保险:`process.on('exit')` 同步删;下次启动时对残留 id 再删一遍。删除失败(文件被占用)才退回 `workspaceRegistry.archiveSession()` 先隐藏,并在下次启动重试。
111
+
112
+ **为什么必须自己删**:`dsh-api-remotes` 暴露了 `session/create`、`session/rename`、`workspace/archiveSession`、`workspace/unarchiveSession`,但**没有 session delete**;`dsh-session-query-sqlite` 只在自己内部 `DELETE FROM persisted_sessions`,那是索引维护,不是用户可用的删除。所以「官方删除」并不存在。
113
+
114
+ **为什么删除是安全的**:`dsh-session-query-sqlite` 的 `_reconcile()` 会拿「磁盘上实际存在的会话」和索引行对比,多出来的行直接 `persistentDeletes`,因此删目录之后搜索索引会自愈,不会留下点不开的幽灵会话。
115
+
116
+ 配置:`SHOW_TEMP_BUTTON` / `TEMP_IN_CHAT_MODE` / `TEMP_BUTTON_STYLE` / `DELETE_ON_EXIT` / `SCHEDULE_DELETE` / `SCHEDULE_TIME` / `MAX_KEPT`,记事本改等号右边,完全退出并重开 DSH 生效。
117
+
118
+ **详情页设置(0.2.2)**:插件详情页顶部卡片新增「临时会话自动删除」区块 —— 「退出 DSH 时删除」和「每天定时清理 + 时间」两个独立开关。它不走 `configForms`,而是 `GET/POST /api/dsh-temp-session.config` 交给 Host 半执行,因为**只有一个数据源**:`temp-session-config.txt`。Host 半按行替换(`KEY=value` 只换 `= ` 右边),注释、空行、键顺序原样保留,用户手写的内容不会丢;缺失的键追加到末尾。保存后立即 `restartScheduler()`,无需重启。
119
+
120
+ **定时清理(0.2.2)的实现要点**:
121
+
122
+ - 调度器是 `setInterval(30s)` + `computeNextRun(HH:MM)`,`timer.unref()` 保证它不会把宿主进程吊住;每次 apply/保存都先 `stopScheduler()` 再重建,避免重载后出现两个定时器。
123
+ - 触发时调用 `purgeAll('scheduled', { skipActiveMs: 3min })`:**最近 3 分钟内有写入的会话跳过**(打开着的会话会持续写转写文件),并把重试时间设到 5 分钟后(`scheduled-retry`),而不是干等到明天。
124
+ - 没有可靠的「这个会话是否打开」信号可以从 bundle 里读到,所以用文件 mtime 代替:这是有意保守的选择 —— 删掉一个正在打开的会话,宿主的窗口会指向一个已经不存在的目录。
125
+ - 退出删除(`DELETE_ON_EXIT`)不受 `skipActiveMs` 保护:退出本身就是用户要求清理,而且进程马上消失,没有「下次再说」的机会。
126
+ - 两个开关互相独立,可以同时开:白天不关 DSH 的人要「每晚 3 点清」,每天关机的人要「退出即清」。
127
+
128
+ **限制 / Limits**
129
+
130
+ - 退出前会话仍写在磁盘上(原生窗口的前提)。
131
+ - 强杀 DSH 时退出钩子来不及跑,残留会话在下一次启动时删除。
132
+ - 文件被占用导致删不掉时,先归档隐藏,下一次启动再删。
133
+ - CHAT 官网模式下临时按钮默认隐藏(那条链路是 DeepSeek 网页账号,和 DSH 会话不是一回事);`TEMP_IN_CHAT_MODE=show` 可强显,`TEMP_BUTTON_STYLE=own` 可完全避开与侧栏顶部控件的抢位。
134
+
135
+ **侧栏顶部按钮的 DOM 约束(0.2.1)**:`dsh-deepseek-chat` 的侧栏适配器(`lib/client.js` 里的 `attachSidebarAdapter`)会从 `sidebar.brand.name` 插槽往上走五层,然后要求侧栏根节点下 `<button>` 子元素**恰好 1 个**(`controls()` 里的 `buttons.length === 1 && buttons[0] === row.nextElementSibling`)。0.2.0 把「临时」按钮作为根节点的第 2 个 `<button>` 插进去,适配器直接 `return null`,于是它在切换器下渲染「当前侧栏不兼容:顶部新会话仍使用 HARNESS」并且不再接管「新会话」。0.2.1 把按钮装进 `[data-dsbs-temp-slot]`(`<div>`),根节点的 `<button>` 计数回到 1,适配器恢复。回归测试见 `_probe/chat-compat.mjs`:它从插件 bundle 里抽出真实的 `attachSidebarAdapter` 跑一遍假 DOM。
136
+
137
+ Plain English: the Temp button now creates a real DSH session (sidebar entry, native conversation window, real tools and model) and deletes it on quit — synchronously from `process.on('exit')`, plus a sweep on the next launch for anything a hard kill left behind. DSH has no public session-delete API, so the plugin removes the session directory itself and the search index reconciles on its own.
package/README.md CHANGED
@@ -1,90 +1,210 @@
1
- # 侧栏布局大师 · Sidebar Suite
2
-
3
- > 让左侧栏从「抢地盘」变成「听你的」。三种布局、一键切换、零改动宿主结构,默认布局在插件详情页顶部直接改。
4
- > Tame the DSH sidebar: three layouts, one click, zero DOM rewrites — set your startup default right at the top of the plugin page.
5
-
6
- **中文**:DSH 左侧栏把「扩展面板」和「工作区」堆在同一列,互相抢高度。本项目提供三种布局解决这个问题,并带来一个中英双语、带图形化设置的详情页。
7
- **English**: The panels group and the workspaces group compete for the same vertical space. This bundle offers three layouts for them and ships a bilingual detail page with a graphical settings picker.
8
-
9
- 详情页长文档见 [DETAIL.md](DETAIL.md)(中英双语 / bilingual, 含收款码 / includes the payment QR)。
10
- The full detail document is [DETAIL.md](DETAIL.md).
11
-
12
- ## 三种布局 / Three layouts
13
-
14
- | 模式 / Mode | 中文 | English |
15
- | --- | --- | --- |
16
- | `a` 折叠 / Fold | 两组各自收起。 | Each group folds on its own. |
17
- | `b` 标签页 / Toggle(默认 / default) | 两组共用一栏,标签互斥切换。 | The groups share one space; the bar switches between them. |
18
- | `c` 浮层 / Overlay | 工作区常驻,扩展以浮层展开。 | Workspaces stay put; panels open as an overlay. |
19
-
20
- ## 默认模式 / Default mode
21
-
22
- `config.mode`(profile 的 `cordis.patch.yml`)是**启动默认**。在侧栏控制栏上临时切换只影响本次会话,不写盘、不进 `localStorage`;下次启动回到配置里的默认值。
23
- `config.mode` in the profile patch is the **startup default**. Choosing a layout from the control bar is session-only: it is deliberately not persisted, so the next launch returns to the configured default.
24
-
25
- ```yaml
26
- # ~/.dsh/profiles/desktop/cordis.patch.yml
27
- - id: dsh-sidebar-suite
28
- config:
29
- mode: b # a = fold, b = tabs, c = overlay
30
- showQuickSwitch: false
31
- ```
32
-
33
- 在**插件详情页顶部的图形化设置**里改 `mode` 会通过官方 `configForms` 控制器写入,立刻成为新的启动默认,无需改文件、无需重启。其它字段(`tab`、`foldExt`、`foldWs`、`showQuickSwitch`)仍按控制栏的操作正常持久化。
34
- Changing `mode` in the **graphical settings card pinned at the top of the plugin page** writes through the host `configForms` controller, so it becomes the startup default immediately — no file editing, no restart. The other fields still persist from the bar.
35
-
36
- ## 图形化设置页 / Graphical settings page
37
-
38
- 组合包注册了 `plugins.bundle.config` 这个 keyed slot(key = 包名),因此打开 **插件 → dsh-sidebar-suite** 会在详情页看到三张布局卡片。宿主把 `configForms` 传进来,卡片读写同一个控制器;设置区通过 `order:-1` 被提到详情页所有分区的最上方,并且只在 `[data-plugin-detail="dsh-sidebar-suite"]` 范围内生效,不会影响别的插件。
39
- The bundle registers the `plugins.bundle.config` keyed slot. The settings section is lifted above every other detail section with `order:-1`, scoped to this bundle's own detail page only.
40
-
41
- React 与 slots 服务都是可选依赖:任一不可用时跳过注册,侧栏控制栏照常工作。
42
- React and the slots service are optional; if either is missing, registration is skipped and the sidebar bar keeps working.
43
-
44
- ## 收款码 / Payment QR
45
-
46
- ![微信支付收款码 / WeChat Pay QR](assets/wechat-pay.jpg)
47
-
48
- 微信「扫一扫」即可,**完全自愿、无任何回报承诺**。作者本机另外用 `dsh-tip-jar` 登记了同一个码;那份注册表属于本机配置,**不随本插件分发**。
49
- Scan with WeChat Pay — **purely voluntary, no rewards promised**. The author also registers the same QR locally via `dsh-tip-jar`; that local registry is **not shipped with this bundle**.
50
-
51
- ## 控制栏 / Where the controls are
52
-
53
- 侧栏顶部一排文字按钮:`折叠 · 标签页 · 浮层 │ 显示工作区 / 展开扩展 · 换布局`。
54
- `换布局 / Cycle` 在侧栏窄于 300px 时隐藏,可用 `showQuickSwitch: false` 彻底移除。
55
- A single row of text buttons at the top of the sidebar. `Cycle` hides below 300 px and can be removed with `showQuickSwitch: false`.
56
-
57
- ## 实现要点 / How it works
58
-
59
- - 所有持久状态写在 `<html>` 属性上:`data-dsbs-mode`、`data-dsbs-tab`、`data-dsbs-fold-ext`、`data-dsbs-fold-ws`、`data-dsbs-pop`、`data-dsbs-quick`、`data-dsbs-rail`、`data-dsbs-narrow`。CSS 负责显隐,插件不重构宿主 DOM。All state lives in `<html>` attributes; CSS owns visibility.
60
- - 每次 sync 都重新解析 `[data-slot="sidebar.workspaces"]` 与 `nav.panelList`,因为 React 会在切换会话时重建侧栏。Both host nodes are resolved on every sync, never cached.
61
- - 隐藏的组用 `display:none` + `aria-hidden` + `inert`,不卸载;组内菜单先收到 `Escape`,恢复时派发 `resize` 供浮层重新测量。Hidden groups are not unmounted; open menus get an `Escape` first and a `resize` is dispatched on restore.
62
- - 同一页面重复 apply 时只有第一个实例持有控制栏;旧客户端留下的 `[data-dsbs-bar]` 会在下次 sync 被清掉。Only one run owns the bar; stale bars from older client generations are removed.
63
- - 官方配置服务不可用时降级到 `localStorage["dsh-sidebar-suite:state"]`,并在控制栏提示。Falls back to `localStorage` when the config service is unavailable.
64
-
65
- ## 安装 / Install
66
-
67
- 从 npm 安装 / Install from npm:
68
-
69
- ```sh
70
- dsh plugin --profile desktop add dsh-sidebar-suite
71
- ```
72
-
73
- 本地开发时也可以把命令里的包名换成本目录路径,或 `pnpm pack` 产出的 `.tgz`。
74
- For local development, point the same command at this folder or a packed `.tgz` instead.
75
-
76
- **已在 DSH 0.2.2-rc.1(desktop profile)验证 / Tested on DSH 0.2.2-rc.1 (desktop profile).**
77
- 本包刻意不声明 `engines.dsh`:当前 DSH 是预发布版,semver 默认规则会把常规版本范围误判为不兼容。
78
- This bundle deliberately omits `engines.dsh`: DSH is currently a prerelease, and semver's default rules would reject any ordinary range.
79
-
80
- 组合包 patch 会自动挂载,**不要**再往 profile 的 `cordis.patch.yml` 加同名行,否则加载两次。
81
- The bundle patch mounts the plugin; do not also add a manual mount line.
82
-
83
- 客户端代码不热重载:安装或改动文件后请完全退出并重新打开 DSH。
84
- The client half is not hot-reloaded — fully quit and reopen DSH after installing or editing files.
85
-
86
- ## 已知限制 / Known limits
87
-
88
- - `[data-slot="sidebar.workspaces"]` 与 `panelList` 是半稳定宿主约定,变动时插件降级而不抛错。These host contracts are semi-stable; changes degrade gracefully.
89
- - 浮层定位依赖 `:has()`,需要 Chromium 内核。Overlay positioning needs `:has()` (Chromium-based client).
90
- - 标签页模式整块隐藏工作区区域,区域内其它入口也一并隐藏,这是刻意的「一组一栏」设计。Toggle hides the whole workspaces region, which is intentional.
1
+ # 侧栏布局大师 · Sidebar Suite
2
+
3
+ > 让左侧栏从「抢地盘」变成「听你的」。三种布局、一键切换、零改动宿主结构,默认布局在插件详情页顶部直接改。
4
+ > Tame the DSH sidebar: three layouts, one click, zero DOM rewrites — set your startup default right at the top of the plugin page.
5
+
6
+ **中文**:DSH 左侧栏把「扩展面板」和「工作区」堆在同一列,互相抢高度。本项目提供三种布局解决这个问题,并带来一个中英双语、带图形化设置的详情页。
7
+ **English**: The panels group and the workspaces group compete for the same vertical space. This bundle offers three layouts for them and ships a bilingual detail page with a graphical settings picker.
8
+
9
+ 详情页长文档见 [DETAIL.md](DETAIL.md)(中英双语 / bilingual, 含收款码 / includes the payment QR)。
10
+ The full detail document is [DETAIL.md](DETAIL.md).
11
+
12
+ ## 这是一款什么插件 / What this plugin is
13
+
14
+ **这是一款专门针对改进 DSH 左侧栏体验的插件。** 不碰会话内容、不换模型、不做独立面板、不接云端服务 —— 只把左侧栏「找得到、切得快、看着顺」这一件事做透。
15
+ **This is a plugin dedicated to improving the DSH sidebar experience.** It touches nothing but the left strip: no model swapping, no extra dashboard, no server calls.
16
+
17
+ | 设计取向 / Design goal | 落在哪 / What it means |
18
+ | --- | --- |
19
+ | **强实用性 / Seriously practical** | 三种布局一键切换、默认布局在详情页顶部直接改、会话列表默认全展开(不用再点「展开其余」)、「临时」开真会话且退出 / 每天定时自动删除、详情页三种反馈入口 |
20
+ | **美观性 / Looks native** | 颜色与层级全取宿主设计变量、深浅主题自动跟随;细字号控制栏、迷你布局示意图、「临时」用 CSS 标签不破坏行高;不重构宿主 DOM、不弹窗、不另起一套皮肤 |
21
+
22
+ 完整的「强实用性 / 美观性」逐条说明见 [DETAIL.md](DETAIL.md) 的「这是一款什么插件」一节。
23
+ The point-by-point list of both design goals is in the "What this plugin is" section of [DETAIL.md](DETAIL.md).
24
+
25
+ ## 反馈 / Feedback
26
+
27
+ 遇到问题、想加功能,或者只是觉得哪块不好用,都欢迎。**四个入口,任选一个**:
28
+
29
+ | 想做什么 | 去哪 |
30
+ | --- | --- |
31
+ | 报一个问题 / 提一个想法 | [新建 issue](https://github.com/YONAN1269/dsh-sidebar-suite/issues/new/choose)(作者默认能收到) |
32
+ | 聊用法、问问题、看别人怎么用 | [Discussions](https://github.com/YONAN1269/dsh-sidebar-suite/discussions) |
33
+ | **在插件市场里留言** | [本插件的市场评论区](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/discussions?discussions_q=%22plugin%3AYONAN1269%2Fdsh-sidebar-suite%22) —— `dsh-market` 给每个插件规定的反馈入口,插件卡片上的「评论」打开的就是这一条 |
34
+ | 不想开 GitHub,或者网速不好 | **插件详情页最下面的「反馈」框**:写一句 → 点「复制反馈内容」→ 粘到任何能联系到我的地方 |
35
+
36
+ 详情页的「反馈」框有三个按钮:**复制反馈内容**、**在 GitHub 提 issue**、**插件市场评论区**。报告会自动打包 **插件版本、DSH 客户端版本、系统、当前布局、临时按钮模式、临时会话数、后端路由数、最近一次清理结果、最近一次错误**,省掉「你是什么环境」这一轮往返。
37
+
38
+ > DSH 宿主本身**没有**给第三方插件规定反馈字段(核对过 `app.asar` 的插件管理详情页:不读取 `bugs`、也没有反馈按钮);`package.json` 里的 `bugs.url` 是 npm 的标准字段,只给工具/网页用。真正由「插件市场」规定的是 `dsh-market` 的评论区,所以本插件把它接进了详情页,而不是再自造一个入口。
39
+
40
+ ### 作者在哪收到 / Where the author sees it
41
+
42
+ | 用户点了什么 | 反馈落在哪 | 作者怎么收到 |
43
+ | --- | --- | --- |
44
+ | 在 GitHub 提 issue | `YONAN1269/dsh-sidebar-suite` → [Issues](https://github.com/YONAN1269/dsh-sidebar-suite/issues) | GitHub 官方说明「By default, you also automatically watch all repositories that you create and are owned by your personal account」,仓库所有者默认会收到通知。确认入口:仓库页右上角 `Watch` → `All Activity`(或 `Custom` 勾上 `Issues`);统一看 [github.com/notifications](https://github.com/notifications) |
45
+ | 插件市场评论区 | `awesome-dsh-plugin/awesome-dsh-plugin` → Discussions,标题带 `plugin:YONAN1269/dsh-sidebar-suite` | **不在本仓库**,作者需要 watch 那个仓库或那条讨论才会收到通知。giscus 官方:「If a matching discussion cannot be found, the giscus bot will automatically create a discussion the first time someone leaves a comment or reaction.」 |
46
+ | 复制反馈内容 | 只进剪贴板 | **不会自动发送**,用户粘到微信 / QQ / 邮件才算送达 |
47
+
48
+ **第一次还没有讨论时**:上面那条市场评论区的搜索页会显示「There are no matching discussions.」。这是正常的 —— 回 DSH 的插件市场,找到 `dsh-sidebar-suite` 卡片点「评论」,giscus 会在第一条留言时自动建帖(官方原文:「If a matching discussion cannot be found, the giscus bot will automatically create a discussion the first time someone leaves a comment or reaction.」)。详情页的按钮指向的正是市场自己用的那条链接。
49
+
50
+ > Report a bug, request a feature, or just say something feels off. Use **Issues** for bugs, **Discussions** for questions, **marketplace comments** for the channel the plugin market actually defines, or the **Feedback** box on the plugin detail page, which packs your version, OS, layout and last error into copyable text.
51
+
52
+ ## 三种布局 / Three layouts
53
+
54
+ | 模式 / Mode | 中文 | English |
55
+ | --- | --- | --- |
56
+ | `a` 折叠 / Fold | 两组各自收起。 | Each group folds on its own. |
57
+ | `b` 标签页 / Toggle(默认 / default) | 两组共用一栏,标签互斥切换。 | The groups share one space; the bar switches between them. |
58
+ | `c` 浮层 / Overlay | 工作区常驻,扩展以浮层展开。 | Workspaces stay put; panels open as an overlay. |
59
+
60
+ ## 默认模式 / Default mode
61
+
62
+ `config.mode`(profile 的 `cordis.patch.yml`)是**启动默认**。在侧栏控制栏上临时切换只影响本次会话,不写盘、不进 `localStorage`;下次启动回到配置里的默认值。
63
+ `config.mode` in the profile patch is the **startup default**. Choosing a layout from the control bar is session-only: it is deliberately not persisted, so the next launch returns to the configured default.
64
+
65
+ ```yaml
66
+ # ~/.dsh/profiles/desktop/cordis.patch.yml
67
+ - id: dsh-sidebar-suite
68
+ config:
69
+ mode: b # a = fold, b = tabs, c = overlay
70
+ showQuickSwitch: false
71
+ ```
72
+
73
+ 在**插件详情页顶部的图形化设置**里改 `mode` 会通过官方 `configForms` 控制器写入,立刻成为新的启动默认,无需改文件、无需重启。其它字段(`tab`、`foldExt`、`foldWs`、`showQuickSwitch`)仍按控制栏的操作正常持久化。
74
+ Changing `mode` in the **graphical settings card pinned at the top of the plugin page** writes through the host `configForms` controller, so it becomes the startup default immediately — no file editing, no restart. The other fields still persist from the bar.
75
+
76
+ ## 图形化设置页 / Graphical settings page
77
+
78
+ 组合包注册了 `plugins.bundle.config` 这个 keyed slot(key = 包名),因此打开 **插件 → dsh-sidebar-suite** 会在详情页看到三张布局卡片。宿主把 `configForms` 传进来,卡片读写同一个控制器;设置区通过 `order:-1` 被提到详情页所有分区的最上方,并且只在 `[data-plugin-detail="dsh-sidebar-suite"]` 范围内生效,不会影响别的插件。
79
+ The bundle registers the `plugins.bundle.config` keyed slot. The settings section is lifted above every other detail section with `order:-1`, scoped to this bundle's own detail page only.
80
+
81
+ React 与 slots 服务都是可选依赖:任一不可用时跳过注册,侧栏控制栏照常工作。
82
+ React and the slots service are optional; if either is missing, registration is skipped and the sidebar bar keeps working.
83
+
84
+ ## 收款码 / Payment QR
85
+
86
+ ![微信支付收款码 / WeChat Pay QR](assets/wechat-pay.jpg)
87
+
88
+ 微信「扫一扫」即可,**完全自愿、无任何回报承诺**。作者本机另外用 `dsh-tip-jar` 登记了同一个码;那份注册表属于本机配置,**不随本插件分发**。
89
+ Scan with WeChat Pay — **purely voluntary, no rewards promised**. The author also registers the same QR locally via `dsh-tip-jar`; that local registry is **not shipped with this bundle**.
90
+
91
+ ## 控制栏 / Where the controls are
92
+
93
+ 侧栏顶部一排文字按钮:`折叠 · 标签页 · 浮层 │ 显示工作区 / 展开扩展 · 换布局`。
94
+ `换布局 / Cycle` 在侧栏窄于 300px 时隐藏,可用 `showQuickSwitch: false` 彻底移除。
95
+ A single row of text buttons at the top of the sidebar. `Cycle` hides below 300 px and can be removed with `showQuickSwitch: false`.
96
+
97
+ ## 实现要点 / How it works
98
+
99
+ - 所有持久状态写在 `<html>` 属性上:`data-dsbs-mode`、`data-dsbs-tab`、`data-dsbs-fold-ext`、`data-dsbs-fold-ws`、`data-dsbs-pop`、`data-dsbs-quick`、`data-dsbs-rail`、`data-dsbs-narrow`。CSS 负责显隐,插件不重构宿主 DOM。All state lives in `<html>` attributes; CSS owns visibility.
100
+ - 每次 sync 都重新解析 `[data-slot="sidebar.workspaces"]` 与 `nav.panelList`,因为 React 会在切换会话时重建侧栏。Both host nodes are resolved on every sync, never cached.
101
+ - 隐藏的组用 `display:none` + `aria-hidden` + `inert`,不卸载;组内菜单先收到 `Escape`,恢复时派发 `resize` 供浮层重新测量。Hidden groups are not unmounted; open menus get an `Escape` first and a `resize` is dispatched on restore.
102
+ - 同一页面重复 apply 时只有第一个实例持有控制栏;旧客户端留下的 `[data-dsbs-bar]` 会在下次 sync 被清掉。Only one run owns the bar; stale bars from older client generations are removed.
103
+ - 官方配置服务不可用时降级到 `localStorage["dsh-sidebar-suite:state"]`,并在控制栏提示。Falls back to `localStorage` when the config service is unavailable.
104
+
105
+ ## 安装 / Install
106
+
107
+ 从 npm 安装 / Install from npm:
108
+
109
+ ```sh
110
+ dsh plugin --profile desktop add dsh-sidebar-suite
111
+ ```
112
+
113
+ 本地开发时也可以把命令里的包名换成本目录路径,或 `pnpm pack` 产出的 `.tgz`。
114
+ For local development, point the same command at this folder or a packed `.tgz` instead.
115
+
116
+ **已在 DSH 0.2.2-rc.1(desktop profile)验证 / Tested on DSH 0.2.2-rc.1 (desktop profile).**
117
+ 本包刻意不声明 `engines.dsh`:当前 DSH 是预发布版,semver 默认规则会把常规版本范围误判为不兼容。
118
+ This bundle deliberately omits `engines.dsh`: DSH is currently a prerelease, and semver's default rules would reject any ordinary range.
119
+
120
+ 组合包 patch 会自动挂载,**不要**再往 profile 的 `cordis.patch.yml` 加同名行,否则加载两次。
121
+ The bundle patch mounts the plugin; do not also add a manual mount line.
122
+
123
+ 客户端代码不热重载:安装或改动文件后请完全退出并重新打开 DSH。
124
+ The client half is not hot-reloaded — fully quit and reopen DSH after installing or editing files.
125
+
126
+ ## 已知限制 / Known limits
127
+
128
+ - `[data-slot="sidebar.workspaces"]` 与 `panelList` 是半稳定宿主约定,变动时插件降级而不抛错。These host contracts are semi-stable; changes degrade gracefully.
129
+ - 浮层定位依赖 `:has()`,需要 Chromium 内核。Overlay positioning needs `:has()` (Chromium-based client).
130
+ - 标签页模式整块隐藏工作区区域,区域内其它入口也一并隐藏,这是刻意的「一组一栏」设计。Toggle hides the whole workspaces region, which is intentional.
131
+
132
+ ## 会话列表默认全部展开 / Always-expanded session list(0.2.4)
133
+
134
+ DSH 自己的会话列表每个工作区只先显示 5 条,剩下的折叠成「**展开其余 N 个会话**」按钮。装了本插件之后这个折叠已经没有意义,所以默认:
135
+
136
+ - 每次侧栏刷新都把每个工作区的会话**全部展开**:按宿主自己的按钮走,不改宿主 DOM。
137
+ - 「展开其余 N 个会话」/「收起」按钮**整块隐藏**。
138
+ - 想恢复 DSH 原来的折叠:把 `temp-session-config.txt` 的 **`EXPAND_ALL_SESSIONS=on` 改成 `off`**,保存后彻底退出 DSH 再重开。
139
+
140
+ 依据(在 `app.asar` 里逐字核对过 `@deepseek-ai/dsh-client-ui-workspace/lib/client.js`):文案 `sessions.expand` = `展开其余 {n} 个会话`,按钮是 `<button data-row-key="overflow:<group>">`,点一次把该组水位线抬高 5 条,全部显示后 `aria-expanded` 变为 `true` 且文案变成「收起」。
141
+
142
+ > The host folds session lists after five rows. This plugin presses the host's own overflow button until nothing is hidden, then hides that control entirely. Set `EXPAND_ALL_SESSIONS=off` in `temp-session-config.txt` to restore DSH's folding.
143
+
144
+ ## 临时会话 / Temporary session(0.2.0)
145
+
146
+ 点「**临时**」= **在左侧栏里开一个真正的 DSH 会话**。
147
+
148
+ - **它就在左侧栏里**,和别的会话并排,可以随时切走做别的事、再切回来(多任务)。
149
+ - **用的是 DSH 原生会话窗口**:原生消息流、原生输入框、原生的工具调用/文件读写/命令执行,模型就是你当前在 DSH 里选的那个。插件不再自己画窗口,也不再自己调模型。
150
+ - 唯一的区别是**退出 DSH 时它会被删掉**。行首会有一个「**临时**」小标签,方便你一眼认出来。
151
+
152
+ ### 它是怎么被删掉的(说清楚,不夸大)
153
+
154
+ DSH **没有公开的「删除会话」接口**(我核对过 `app.asar`:`session/create`、`session/rename`、`workspace/archiveSession` 都有,就是没有 delete;官方界面上的「归档」只是把会话从列表里藏起来,文件还在磁盘上)。所以删除是插件自己做的,两道保险:
155
+
156
+ 1. **退出时**:进程退出事件里同步删掉会话目录(`~/.dsh/sessions/<项目>/<会话ID>/`)。
157
+ 2. **下次启动时**:再扫一遍上次的记录,把没删干净的补删。这是保底,所以即使用任务管理器强杀 DSH,下次打开也会清掉。
158
+
159
+ 被删掉的会话在 DSH 的搜索索引里也会同步消失(`dsh-session-query-sqlite` 会按磁盘上实际存在的会话重建索引)。
160
+
161
+ **说人话的边界**:在退出之前,这个会话和普通会话一样是写在磁盘上的(否则就没法用原生窗口、也没法中途切换)。如果你要的是「连磁盘都不许写」,那只有 0.1.x 的纯内存方案能做的,代价是不在侧栏、不能多任务——你这次要的正好相反。
162
+
163
+ ### 删除时机:详情页直接设(0.2.2)
164
+
165
+ 插件详情页(**插件 → dsh-sidebar-suite → 最上面那张卡**)的「临时会话自动删除」区块可以图形化设置,两个开关互相独立:
166
+
167
+ - **退出 DSH 时删除**(默认开)
168
+ - **每天定时清理**(默认关)+ 一个时间选择框(`HH:MM`,本机时间,例如 `03:00`)。DSH 一直开着、几天不关,也不会越积越多。
169
+
170
+ 改动**立即生效,不用重启**:卡片把值写回 `temp-session-config.txt`(只替换等号右边的值,注释和顺序原样保留),后端随即重排定时器。
171
+
172
+ **正在使用的会话不会被误删**:定时清理会跳过最近 3 分钟内有写入的会话(打开着的会话一直在写转写文件),5 分钟后再试一次。退出时的删除不受这个保护影响 —— 退出本来就是你要求清理。
173
+
174
+ ### 配置(记事本可改)
175
+
176
+ `temp-session-config.txt`,只改等号右边,保存后**完全退出并重开 DSH** 生效。
177
+
178
+ | 键 | 默认 | 作用 |
179
+ | --- | --- | --- |
180
+ | `SHOW_TEMP_BUTTON` | `on` | 是否显示「临时」按钮 |
181
+ | `TEMP_IN_CHAT_MODE` | `hide` | 装了 `dsh-deepseek-chat` 时,处于 CHAT 官网模式要不要显示按钮 |
182
+ | `TEMP_BUTTON_STYLE` | `pair` | `pair` = 和「新会话」并排;`own` = 单独占一行,完全不动「新会话」 |
183
+ | `EXPAND_ALL_SESSIONS` | `on` | 会话列表全部展开并隐藏「展开其余 N 个会话」;`off` = 恢复宿主折叠 |
184
+ | `DELETE_ON_EXIT` | `on` | 退出时删除;改 `off` 就不再删,临时会话等于普通会话 |
185
+ | `SCHEDULE_DELETE` | `off` | 每天定时清理;`on` = 到点把临时会话删掉 |
186
+ | `SCHEDULE_TIME` | `03:00` | 定时清理的时间(24 小时制 `HH:MM`,本机时间) |
187
+ | `MAX_KEPT` | `20` | 最多同时保留几个临时会话,超了先删最早的 |
188
+
189
+ ### 和 dsh-deepseek-chat(CHAT / HARNESS 切换)的冲突,三个方案
190
+
191
+ 那个插件在 **CHAT 官网模式**下会把侧栏和主区域换成 DeepSeek 官网网页,并且自己在侧栏顶部加了一行 CHAT/HARNESS 切换。
192
+
193
+ **0.2.0 撞到过一个真实的坑(0.2.1 已修)**:它接管侧栏之前会先「认」一遍侧栏的结构 —— 要求侧栏根节点下**正好只有 1 个 `<button>`**(就是「新会话」那一个)。0.2.0 把「临时」按钮直接插在「新会话」旁边,根节点下就成了 2 个 `<button>`,它认不出来,于是:
194
+
195
+ - 在切换器下面弹一句「**当前侧栏不兼容:顶部新会话仍使用 HARNESS**」;
196
+ - 不再接管顶部的新会话按钮。
197
+
198
+ 0.2.1 的改法:「临时」按钮不直接站在根节点下,而是装进自己的一层 `<div data-dsbs-temp-slot>` 里。根节点下的 `<button>` 依旧只有 1 个,那个插件正常识别,提示消失,CHAT / HARNESS 照常切换。
199
+
200
+ 万一日后还有别的插件也来数根节点的按钮,按下面三档走:
201
+
202
+ 1. **默认:自动让开(推荐)**。检测到它在 CHAT 模式,插件就给 `<html>` 打标记:隐藏「临时」按钮,并把所有缩窄「新会话」的 CSS 全部失效,那一行完整还给官网侧栏;切回 HARNESS 自动恢复。
203
+ 2. **还是挤**:把 `TEMP_BUTTON_STYLE` 改成 `own`。这时「临时」按钮自己单独占一行,**完全不改「新会话」的宽度和高度**,零侵入,和任何改侧栏顶部的插件都不会抢位置。
204
+ 3. **最省心**:如果你基本不用 CHAT 官网模式,直接在插件管理里把 `dsh-deepseek-chat` 关掉。
205
+
206
+ 另外要说明:**CHAT 官网模式和 HARNESS 是两条链路**(一个是 DeepSeek 网页账号,一个是 DSH 本地会话)。临时会话现在是 DSH 会话,所以在 CHAT 模式下它本来就该让位——这不是 bug,是两个东西不该同时占同一块地方。
207
+
208
+ ### 历史修复(现在都不需要了)
209
+
210
+ 0.1.5 的「没识别出文本块」、0.1.6 的「没有模型」、0.1.7 的 `HTTP 404 · not found`,根因都出在「插件自己调宿主模型、自己注册路由」这条路上。0.2.0 不再自己调模型(临时会话直接用原生会话的模型与工具),路由也只剩「记录/删除」这一件事,那一整类问题随之消失。