@leiyi-works/dsh-feature-tweaks 0.2.0 → 0.3.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.
- package/README.md +23 -8
- package/cordis.patch.yml +18 -3
- package/index.js +68 -10
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @leiyi-works/dsh-feature-tweaks · 功能微调
|
|
2
2
|
|
|
3
|
-
> DeepSeek Harness(DSH)plugin: a bundle patch that collects version-to-version functional/default tweaks (overrides official rows by id, never touches core packages). Currently: new root sessions start with Agent Teams enabled; a configurable "Reload page" shortcut (F5 on desktop), moved here from dsh-sidebar-folders 0.13.4.
|
|
3
|
+
> DeepSeek Harness(DSH)plugin: a bundle patch that collects version-to-version functional/default tweaks (overrides official rows by id, never touches core packages). Currently: new root sessions start with Agent Teams enabled; a configurable "Reload page" shortcut (F5 on desktop), moved here from dsh-sidebar-folders 0.13.4; quitting the desktop app no longer asks just because scheduled tasks are armed.
|
|
4
4
|
|
|
5
5
|
DSH 每次版本变化都会带来或多或少的官方行为差异、默认值不合意的地方。本包是这些**功能层面微调**的固定落点:按官方行 id 覆盖配置、或补一行,**不改任何核心包**。
|
|
6
6
|
|
|
@@ -17,9 +17,20 @@ DSH 每次版本变化都会带来或多或少的官方行为差异、默认值
|
|
|
17
17
|
|---|---|---|---|---|
|
|
18
18
|
| 1 | `agent-team` | `defaultEnabled: false` | `defaultEnabled: true` | 新根会话(含普通 fork)在第一次模型步前默认开「智能体团队协作」;已在会话里保存过选择的会话不受影响;单会话仍可在「模型与推理等级」菜单里手动关 |
|
|
19
19
|
| 2 | `feature-tweaks.reload` | 桌面壳不绑刷新键(开发构建才有 Reload 菜单) | 桌面端 F5 / 网页端 Ctrl+Shift+R | 整页刷新快捷键,可配置;带「启动后插件已重建就先别刷新」的保护。从 `dsh-sidebar-folders` 0.13.4 迁移过来 |
|
|
20
|
+
| 3 | 桌面壳的退出确认(`quit-inspection` 应答) | 有活动定时任务就弹「应用关闭期间,定时任务不会运行」确认框 | 定时任务不计入退出确认 | 退出只在**确实有任务在跑**时确认;定时任务不再触发确认,文案也不再提它。详见下文 |
|
|
20
21
|
|
|
21
22
|
团队模式会往上下文注入协作提示词和 `team_task_*` 工具,**token 开销更高**;简单任务随手关掉即可。
|
|
22
23
|
|
|
24
|
+
### 退出不再因定时任务确认
|
|
25
|
+
|
|
26
|
+
- **改了什么**:桌面端(托盘「退出」、菜单退出、关闭窗口后托盘退出都算)在退出前会问 Host 两件事——有没有任务正在跑、有没有已排期的定时任务。官方只要有任一项就弹原生确认框。本包拦下 Host 的这条应答,把「有定时任务」恒置为否。
|
|
27
|
+
- **新行为**:
|
|
28
|
+
- 只有定时任务、没有任务在跑 → **直接退出,不再弹框**;
|
|
29
|
+
- 确有任务在跑 → 仍然确认,文案落到官方的「当前正在运行的任务将会中断」,不再附带「且应用关闭期间,定时任务不会运行」。
|
|
30
|
+
- **代价**:应用关闭期间定时任务不会触发,错过的会在下次启动后补发最近一次(这是 DSH 本来的行为,只是不再每次退出都提示)。介意就把本包整体移除。
|
|
31
|
+
- **不影响**:定时任务本身照常创建/触发;`workspace/session-activity` 里的 `schedule` 族照常上报,所以「归档有定时任务的会话」仍会被拒绝;`dsh web` / headless 没有这条 IPC,补丁自动跳过。
|
|
32
|
+
- **诊断**:插件启动时 `~/.dsh/data/feature-tweaks-diag.log` 会记一行 `quit-inspection-patch-ready`;每次真的拦下定时任务再记一行 `quit-inspection-scheduled-tasks-ignored`。
|
|
33
|
+
|
|
23
34
|
### 刷新页面快捷键(F5)
|
|
24
35
|
|
|
25
36
|
- **键位**:桌面端 <kbd>F5</kbd>,网页端 <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>R</kbd>;快捷键服务要求同一个组合只能有一个注册者,所以 F5 只在本包里注册(已从 `dsh-sidebar-folders` 移除)。
|
|
@@ -30,26 +41,27 @@ DSH 每次版本变化都会带来或多或少的官方行为差异、默认值
|
|
|
30
41
|
## 安装
|
|
31
42
|
|
|
32
43
|
```powershell
|
|
33
|
-
dsh plugin --profile <profile> add @leiyi-works/dsh-feature-tweaks@0.
|
|
44
|
+
dsh plugin --profile <profile> add @leiyi-works/dsh-feature-tweaks@0.3.0
|
|
34
45
|
```
|
|
35
46
|
|
|
36
47
|
装完后确认 profile 的 `dsh.profile.bundles` 含 `@leiyi-works/dsh-feature-tweaks`,且排在 `@deepseek-ai/dsh-base` 之后。**重启 DSH** 生效(配置在启动时合成)。
|
|
37
48
|
|
|
38
49
|
## 实现机制
|
|
39
50
|
|
|
40
|
-
|
|
51
|
+
本包以配置为主,其中两项需要运行时代码:
|
|
41
52
|
|
|
42
53
|
- `cordis.patch.yml` —— bundle patch,在 `dsh-base` 插入官方行之后按 id 覆盖。效果与手改 profile 的 `cordis.patch.yml` 完全一致,但能整体启停、单独删除、换机/重装后随插件恢复。
|
|
43
|
-
- `index.js` —— Host 行 `feature-tweaks`:让 bundle
|
|
54
|
+
- `index.js` —— Host 行 `feature-tweaks`:让 bundle 在插件页显示为运行中,提供刷新快捷键的安全探针路由 `GET /__dsh-feature-tweaks/reload-safe`(返回 live Client 模块图的 revs 和启动后被重建的 bundle),并包装 `process.send`、把桌面壳 `quit-inspection` 应答里的 `scheduledTasks` 改写成 false(仅桌面端有这条 IPC;其它 Host 自动跳过)。
|
|
44
55
|
- `client.js` —— Web 侧半边:注册「刷新页面」快捷键、F5 兜底监听、安全刷新逻辑;诊断日志写到 `<DSH_HOME>/data/feature-tweaks-diag.log`。
|
|
45
56
|
|
|
46
57
|
**关键坑**:loader 的 patch 会**整段替换**目标行的 `config`(不是深合并)。覆盖时必须把该行原本的其它字段一起重述——例如 `agent-team` 要带上 `maxTasks: 256`,否则会退回 schema 默认值。
|
|
47
58
|
|
|
48
59
|
## 新增一项微调(维护者)
|
|
49
60
|
|
|
50
|
-
1.
|
|
51
|
-
2.
|
|
52
|
-
3.
|
|
61
|
+
1. 配置类:在 `cordis.patch.yml` 末尾按注释模板追加一段(官方默认 → 本包值 → 理由);
|
|
62
|
+
2. 代码类:改 `index.js` / `client.js`,并在 `cordis.patch.yml` 文末「代码侧微调」里补一条说明;
|
|
63
|
+
3. README 的「现有微调」表加一行;
|
|
64
|
+
4. 升版本号 → 发布 → profile 更新依赖 → 重启验证。
|
|
53
65
|
|
|
54
66
|
行 id 与官方包名的对照可以看 `~/.dsh/profiles/<profile>/node_modules/@deepseek-ai/dsh-base/cordis.patch.yml` 的 `insert` 列表。
|
|
55
67
|
|
|
@@ -60,11 +72,14 @@ dsh plugin --profile <profile> add @leiyi-works/dsh-feature-tweaks@0.2.0
|
|
|
60
72
|
- 手动关掉某一会话的开关后,该会话保持关闭。
|
|
61
73
|
- 桌面端按 <kbd>F5</kbd> 应刷新页面;设置 → 快捷键里能看到「刷新页面」并改了生效。
|
|
62
74
|
- 若刚装/更新过插件,按 F5 应弹出「请完全退出 DSH 再打开一次」而不是刷新(这是保护,不是故障);重启后再按即正常刷新。
|
|
75
|
+
- 退出确认:先建一个有定时任务的会话(让它处于已排期状态),再点托盘「退出」——应直接退出、不再弹「应用关闭期间,定时任务不会运行」。若有任务正在跑,仍会弹确认,但文案只有「当前正在运行的任务将会中断」。
|
|
76
|
+
- 日志佐证:重启后 `~/.dsh/data/feature-tweaks-diag.log` 里有 `quit-inspection-patch-ready`;每次拦下定任务再退出时多一行 `quit-inspection-scheduled-tasks-ignored`。
|
|
63
77
|
|
|
64
78
|
## 撤回
|
|
65
79
|
|
|
66
80
|
- **整体**:从 profile 的 `dsh.profile.bundles` 移除 `@leiyi-works/dsh-feature-tweaks`,一步回到官方默认;
|
|
67
|
-
-
|
|
81
|
+
- **单项(配置类)**:在 profile 的 `cordis.patch.yml`(更晚应用)里把对应行覆盖回去;
|
|
82
|
+
- **退出确认**:删掉 `index.js` 里 `apply()` 开头对 `installQuitInspectionTweak(ctx)` 的调用(或改回不包装 `process.send`)后重启;
|
|
68
83
|
- **刷新快捷键**:设置 → 快捷键里清除「刷新页面」绑定即可,不影响本包其它微调;
|
|
69
84
|
- **单会话**:团队那一项直接在「模型与推理等级」菜单里关(仅本会话生效)。
|
|
70
85
|
|
package/cordis.patch.yml
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
# 不改任何核心包,也不和界面类的 dsh-ui-tweaks 混在一起(界面/DOM 归 ui-tweaks,
|
|
6
6
|
# 功能/默认值归本包)。
|
|
7
7
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
8
|
+
# 机制:本包以 bundle patch 为主——只提供一份在 dsh-base 之后叠加的 bundle
|
|
9
|
+
# patch,效果与手改 profile 的 cordis.patch.yml 相同,但能整体启停、单独删除,
|
|
10
|
+
# 换机/重装 DSH 后随插件一起恢复。改运行时行为、没有对应配置行的微调(文末
|
|
11
|
+
# 「代码侧微调」)落在 index.js / client.js。
|
|
11
12
|
#
|
|
12
13
|
# 维护约定:
|
|
13
14
|
# 1. 一项微调 = 一个 patch 条目 + 上面一段注释(官方默认是什么、本包改成什么、
|
|
@@ -38,6 +39,20 @@
|
|
|
38
39
|
maxTasks: 256
|
|
39
40
|
defaultEnabled: true
|
|
40
41
|
|
|
42
|
+
# ── 代码侧微调(不落在 patch 里,见 index.js / client.js)───────────────────
|
|
43
|
+
# 下面两项改的是运行时行为,不是某一行配置,所以在包里用代码实现;
|
|
44
|
+
# 它们与上面的 patch 条目互不影响:
|
|
45
|
+
#
|
|
46
|
+
# a. 「刷新页面」快捷键:桌面端 F5 / 网页端 Ctrl+Shift+R,由 client.js 注册,
|
|
47
|
+
# index.js 提供 /__dsh-feature-tweaks/reload-safe 探针。
|
|
48
|
+
#
|
|
49
|
+
# b. 桌面端退出不再因定时任务弹确认:Electron 壳退出前会向 Host 发
|
|
50
|
+
# `quit-inspection` 询问「有任务在跑吗 / 有已排期的定时任务吗」,只有其中
|
|
51
|
+
# 任一项为真就弹原生确认框。index.js 拦截这条应答,把 scheduledTasks 恒
|
|
52
|
+
# 置为 false:只有定时任务时直接静默退出;确有任务在跑时仍确认,文案自动
|
|
53
|
+
# 落到官方的「当前正在运行的任务将会中断」。定时任务本身、以及
|
|
54
|
+
# workspace/session-activity 的活动判定(会话归档拒绝)都不受影响。
|
|
55
|
+
#
|
|
41
56
|
# ── 后续新增的微调追加在下面,格式示例 ──────────────────────────────────────
|
|
42
57
|
# - id: <官方行 id>
|
|
43
58
|
# name: "<官方包名>"
|
package/index.js
CHANGED
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
* dsh-feature-tweaks — Host half.
|
|
3
3
|
*
|
|
4
4
|
* Most tweaks live in this package's `cordis.patch.yml` (a bundle patch that
|
|
5
|
-
* overrides official rows by id). This row is the Host half for the
|
|
6
|
-
*
|
|
7
|
-
* @leiyi-works/dsh-sidebar-folders 0.13.4 in 0.2.0).
|
|
5
|
+
* overrides official rows by id). This row is the Host half for the tweaks that
|
|
6
|
+
* need runtime code:
|
|
8
7
|
*
|
|
9
|
-
* The
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
8
|
+
* 1. The "Reload page" shortcut (moved here from
|
|
9
|
+
* @leiyi-works/dsh-sidebar-folders 0.13.4 in 0.2.0). The Desktop shell keeps
|
|
10
|
+
* the boot manifest it captured at startup, so a page reload after a Client
|
|
11
|
+
* bundle was rebuilt asks for a stale artifact and fails the boot audit (the
|
|
12
|
+
* "应用无法启动" dialog). The shortcut therefore asks
|
|
13
|
+
* `GET /__dsh-feature-tweaks/reload-safe` first and gets `{ ok, revs, changed }`:
|
|
14
|
+
* `revs` is the live Client module graph, `changed` lists bundles rebuilt since
|
|
15
|
+
* this Host started. A differing revision is exactly what a reload would fail,
|
|
16
|
+
* so the Client half explains the restart instead of reloading blindly.
|
|
17
|
+
*
|
|
18
|
+
* 2. Quitting from the Desktop shell (tray or menu) no longer asks just because
|
|
19
|
+
* scheduled tasks are armed — see `installQuitInspectionTweak` below.
|
|
16
20
|
*
|
|
17
21
|
* Diagnostics: <DSH_HOME>/data/feature-tweaks-diag.log
|
|
18
22
|
*/
|
|
@@ -26,6 +30,8 @@ export const name = 'feature-tweaks'
|
|
|
26
30
|
const ROUTE_PREFIX = '/__dsh-feature-tweaks'
|
|
27
31
|
/** Upper bound for one diagnostic body, in bytes. */
|
|
28
32
|
const MAX_BODY_BYTES = 64 * 1024
|
|
33
|
+
/** Marks an already wrapped `process.send`, so re-applying the plugin cannot stack wrappers. */
|
|
34
|
+
const QUIT_INSPECTION_PATCH = Symbol.for('dsh-feature-tweaks.quit-inspection')
|
|
29
35
|
|
|
30
36
|
/** Absolute path of the Client-half diagnostics log. */
|
|
31
37
|
function diagFile() {
|
|
@@ -72,12 +78,64 @@ function readBody(req) {
|
|
|
72
78
|
})
|
|
73
79
|
}
|
|
74
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Quit tweak: armed scheduled tasks no longer add a confirmation to quitting.
|
|
83
|
+
*
|
|
84
|
+
* The Desktop shell asks this Host (`quit-inspection`) before every quit whether
|
|
85
|
+
* running tasks or armed scheduled reminders would be disturbed, and shows a
|
|
86
|
+
* native box when either half is true. A scheduled task only misses its delivery
|
|
87
|
+
* while the app is closed — it becomes due again on the next start and nothing is
|
|
88
|
+
* lost — so warning about it on every quit is noise. Rewriting `scheduledTasks` to
|
|
89
|
+
* false in that single IPC reply leaves `activeTasks` untouched: quitting is
|
|
90
|
+
* silent when nothing is running, and work that is actually running still asks,
|
|
91
|
+
* with the shell's own "当前正在运行的任务将会中断" wording.
|
|
92
|
+
*
|
|
93
|
+
* Nothing else changes: the `schedule` family stays in
|
|
94
|
+
* `workspace/session-activity`, so archiving a Session with armed reminders is
|
|
95
|
+
* still refused, and the schedule service itself is not touched.
|
|
96
|
+
*/
|
|
97
|
+
function installQuitInspectionTweak(ctx) {
|
|
98
|
+
const hostProcess = typeof process === 'object' && process !== null ? process : undefined
|
|
99
|
+
if (hostProcess === undefined || typeof hostProcess.send !== 'function') {
|
|
100
|
+
// `dsh web` / headless hosts own no Desktop shell IPC channel; nothing to rewrite.
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
const originalSend = hostProcess.send
|
|
104
|
+
if (originalSend[QUIT_INSPECTION_PATCH] === true) return
|
|
105
|
+
const patchedSend = function send(message, ...rest) {
|
|
106
|
+
let outgoing = message
|
|
107
|
+
try {
|
|
108
|
+
if (outgoing !== null && typeof outgoing === 'object'
|
|
109
|
+
&& outgoing.type === 'quit-inspection'
|
|
110
|
+
&& outgoing.scheduledTasks === true) {
|
|
111
|
+
outgoing = { ...outgoing, scheduledTasks: false }
|
|
112
|
+
void appendDiag('quit-inspection-scheduled-tasks-ignored')
|
|
113
|
+
}
|
|
114
|
+
} catch {
|
|
115
|
+
// A failed rewrite must never break the IPC channel.
|
|
116
|
+
}
|
|
117
|
+
return originalSend.call(hostProcess, outgoing, ...rest)
|
|
118
|
+
}
|
|
119
|
+
patchedSend[QUIT_INSPECTION_PATCH] = true
|
|
120
|
+
hostProcess.send = patchedSend
|
|
121
|
+
ctx.effect(() => () => {
|
|
122
|
+
if (hostProcess.send === patchedSend) hostProcess.send = originalSend
|
|
123
|
+
}, 'feature-tweaks: quit inspection ignores scheduled tasks')
|
|
124
|
+
void appendDiag('quit-inspection-patch-ready')
|
|
125
|
+
}
|
|
126
|
+
|
|
75
127
|
/**
|
|
76
128
|
* Host plugin entry.
|
|
77
129
|
* @param ctx - Host root context; the Web carrier and Client module graph are
|
|
78
130
|
* optional so a headless profile still mounts the row.
|
|
79
131
|
*/
|
|
80
132
|
export function apply(ctx) {
|
|
133
|
+
try {
|
|
134
|
+
installQuitInspectionTweak(ctx)
|
|
135
|
+
} catch (error) {
|
|
136
|
+
void appendDiag('quit-inspection-patch-failed: ' + String(error?.message ?? error))
|
|
137
|
+
}
|
|
138
|
+
|
|
81
139
|
// Client bundles rebuilt since this Host started. The desktop shell keeps the
|
|
82
140
|
// boot manifest captured at startup, so a page reload after a rebuild asks
|
|
83
141
|
// for a stale artifact and fails the boot audit; the reload key asks this
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Feature tweaks",
|
|
4
|
-
"description": "Cross-version fixes for DSH behaviour and defaults, kept apart from dsh-ui-tweaks (which owns UI and DOM tweaks): the bundle overrides official rows by id in its own patch, never in core packages. Currently: new root sessions start with Agent Teams enabled; a configurable Reload page shortcut (F5 on desktop), moved here from dsh-sidebar-folders 0.13.4."
|
|
4
|
+
"description": "Cross-version fixes for DSH behaviour and defaults, kept apart from dsh-ui-tweaks (which owns UI and DOM tweaks): the bundle overrides official rows by id in its own patch, never in core packages. Currently: new root sessions start with Agent Teams enabled; a configurable Reload page shortcut (F5 on desktop), moved here from dsh-sidebar-folders 0.13.4; quitting the desktop app no longer asks just because scheduled tasks are armed."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "功能微调",
|
|
4
|
-
"description": "功能微调:DSH 跨版本的功能/默认值修补合集(与界面微调 dsh-ui-tweaks 分开)。官方版本变化带来的行为差异、默认值不合意的地方,都在这里按官方行 id 覆盖,不改核心包。当前含:新根会话默认开启「智能体团队协作」;「刷新页面」快捷键(桌面端 F5,从 dsh-sidebar-folders 0.13.4
|
|
4
|
+
"description": "功能微调:DSH 跨版本的功能/默认值修补合集(与界面微调 dsh-ui-tweaks 分开)。官方版本变化带来的行为差异、默认值不合意的地方,都在这里按官方行 id 覆盖,不改核心包。当前含:新根会话默认开启「智能体团队协作」;「刷新页面」快捷键(桌面端 F5,从 dsh-sidebar-folders 0.13.4 迁移);桌面端退出不再因定时任务弹出确认。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leiyi-works/dsh-feature-tweaks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"title": "功能微调",
|
|
6
|
-
"description": "功能微调:DSH 跨版本的功能/默认值修补合集(与界面微调 dsh-ui-tweaks 分开)。官方版本变化带来的行为差异、默认值不合意的地方,都在这里按官方行 id 覆盖,不改核心包。当前含:新根会话默认开启「智能体团队协作」;「刷新页面」快捷键(桌面端 F5,从 dsh-sidebar-folders 0.13.4
|
|
6
|
+
"description": "功能微调:DSH 跨版本的功能/默认值修补合集(与界面微调 dsh-ui-tweaks 分开)。官方版本变化带来的行为差异、默认值不合意的地方,都在这里按官方行 id 覆盖,不改核心包。当前含:新根会话默认开启「智能体团队协作」;「刷新页面」快捷键(桌面端 F5,从 dsh-sidebar-folders 0.13.4 迁移过来);桌面端退出不再因定时任务弹出确认。",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./index.js",
|
|
9
9
|
"./client": "./client.js",
|