dsh-wdx-relief 0.3.0 → 0.3.1
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/CHANGELOG.md +9 -0
- package/README.md +12 -1
- package/RELEASING.md +18 -3
- package/client/client.js +334 -212
- package/cordis.patch.yml +1 -1
- package/docs/guide.md +25 -10
- package/index.js +1 -1
- package/package.json +15 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.1 — 2026-11-09
|
|
4
|
+
|
|
5
|
+
- 保留 Codex 式输入框灰字预测:建议仍注册在 `conversation.input.overlay`,不改成输入框外的一行。
|
|
6
|
+
- 样式改为随 React 组件挂载/卸载,移除模块级 `document.head` 副作用;移除内联颜色 fallback。
|
|
7
|
+
- 配置页改用官方 `SettingsFormModel` + `SettingsForm`:编辑先暂存,点「保存」才写入;离开页面丢弃草稿。
|
|
8
|
+
- 修正 `dsh.client.inject`:补上 `ui-plugin-manager`,保留 `ui-settings`(`configForms` 的提供方);移除 `immediately`。
|
|
9
|
+
- 打包元数据:`@deepseek-ai/schemastery` 改为运行时依赖;Cordis 保持 peer/dev 同范围;`engines.dsh` 增加 `<0.3.0` 上界;图标改用 SVG。
|
|
10
|
+
- 修正 RELEASING.md 中被占位符替换的版本示例。
|
|
11
|
+
|
|
3
12
|
## 0.3.0 — 2026-11-09
|
|
4
13
|
|
|
5
14
|
- 精简回复设置:长度 3 档(短/标准/详细);风格 5 选 1(默认/专业/亲和/直接/跟随我的风格);保留「便于行动」开关和自定义指令。
|
package/README.md
CHANGED
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
- **回复风格**:长度 **短 / 标准 / 详细**;风格 **默认 / 专业 / 亲和 / 直接 / 跟随我的风格**;可加最多 2000 字的自定义指令。
|
|
12
12
|
- **便于行动**(默认开启):先给结果和下一步;能一句说清的不写一段,术语先用白话说明;保留风险、失败条件和已授权该做的工作。
|
|
13
13
|
|
|
14
|
+
## 运行要求
|
|
15
|
+
|
|
16
|
+
- DSH Web profile;插件依赖 `connection` 与 `sessions` 服务。
|
|
17
|
+
- 已配置默认模型。预测会把最近几轮对话作为 prompt 发给当前默认模型;结果只用于输入框建议,不写入会话日志,也不触发 agent loop。
|
|
18
|
+
|
|
14
19
|
## 安装
|
|
15
20
|
|
|
16
21
|
在 DSH 侧边栏 **插件 → 添加插件** 输入:
|
|
@@ -25,7 +30,13 @@ dsh-wdx-relief
|
|
|
25
30
|
plugin_manager install_bundle target = "dsh-wdx-relief"
|
|
26
31
|
```
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
或命令行:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
dsh plugin --profile <profile> add dsh-wdx-relief
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
安装后启用;客户端模块会在下次页面加载时挂载。
|
|
29
40
|
|
|
30
41
|
本地开发时用 `link:` 安装当前目录的方式见 [docs/guide.md](docs/guide.md)。
|
|
31
42
|
|
package/RELEASING.md
CHANGED
|
@@ -21,6 +21,20 @@
|
|
|
21
21
|
返回 404 才表示可用;如果被占用,把 `package.json` 的 `name` 改成
|
|
22
22
|
`@wdxtub/dsh-wdx-relief`,并同步改本文命令。
|
|
23
23
|
|
|
24
|
+
## 浏览器 2FA 发布(固定方式)
|
|
25
|
+
|
|
26
|
+
npm 账号开启了 `auth-and-writes` 2FA,非交互运行 `npm publish` 会直接报 `EOTP`。
|
|
27
|
+
本仓库用 `expect` 提供 PTY,让 npm 走浏览器认证:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
expect scripts/publish-npm.exp > /tmp/npm-publish-pty.log 2>&1 &
|
|
31
|
+
tail -f /tmp/npm-publish-pty.log
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
看到 `AUTH_BROWSER_OPENED` 后,在浏览器的 npm 认证页完成 2FA/Passkey;npm 会自动
|
|
35
|
+
取到 OTP 并继续发布。不要重复启动另一个发布。没有浏览器窗口时,从日志里取出
|
|
36
|
+
`https://www.npmjs.com/auth/cli/...` 手动打开。
|
|
37
|
+
|
|
24
38
|
## 首次发布
|
|
25
39
|
|
|
26
40
|
先提交干净(`npm version` 需要干净的工作区):
|
|
@@ -35,7 +49,7 @@ npm pack --dry-run
|
|
|
35
49
|
npm pack
|
|
36
50
|
# 插件页 → 添加插件 → 输入 tarball 绝对路径 → 安装 → 立即启用
|
|
37
51
|
|
|
38
|
-
|
|
52
|
+
expect scripts/publish-npm.exp
|
|
39
53
|
git tag -a v0.1.0 -m "v0.1.0"
|
|
40
54
|
git push origin main --tags
|
|
41
55
|
```
|
|
@@ -57,11 +71,12 @@ git status
|
|
|
57
71
|
# 更新 CHANGELOG.md 并提交
|
|
58
72
|
npm test
|
|
59
73
|
npm version minor -m "chore: release v%s"
|
|
60
|
-
|
|
74
|
+
expect scripts/publish-npm.exp
|
|
61
75
|
git push --follow-tags
|
|
62
76
|
```
|
|
63
77
|
|
|
64
|
-
|
|
78
|
+
预发布:把 `scripts/publish-npm.exp` 里的 `npm publish` 参数改为 `--tag next`,
|
|
79
|
+
或直接运行:
|
|
65
80
|
|
|
66
81
|
```bash
|
|
67
82
|
npm version 0.2.0-rc.1
|
package/client/client.js
CHANGED
|
@@ -7,7 +7,13 @@
|
|
|
7
7
|
* 2. `plugins.bundle.config`:侧边栏「插件」里 dsh-wdx-relief 的配置页(预测 + 回复风格)。
|
|
8
8
|
*
|
|
9
9
|
* 预测由 Host 侧 `/api/wdx-relief/predict` 生成;这里只负责节流触发、
|
|
10
|
-
*
|
|
10
|
+
* 渲染建议、处理 Tab/Escape,以及开关的读写。
|
|
11
|
+
*
|
|
12
|
+
* 约束:
|
|
13
|
+
* - 工厂函数不产生模块级副作用;样式随组件挂载,卸载时由 React 移除。
|
|
14
|
+
* - 配置页使用官方 SettingsFormModel / SettingsForm 的暂存-保存模型。
|
|
15
|
+
* - 输入框灰字是用户选择的 Codex 式体验,定位会测量 composer 布局;
|
|
16
|
+
* 这是本插件已知的宿主 DOM 耦合点。
|
|
11
17
|
*/
|
|
12
18
|
window.__ModuleLoader__.load({
|
|
13
19
|
id: 'dsh-wdx-relief',
|
|
@@ -22,23 +28,24 @@ window.__ModuleLoader__.load({
|
|
|
22
28
|
var h = React.createElement
|
|
23
29
|
var useState = React.useState
|
|
24
30
|
var useEffect = React.useEffect
|
|
25
|
-
var useLayoutEffect = React.useLayoutEffect
|
|
26
31
|
var useRef = React.useRef
|
|
32
|
+
var useLayoutEffect = React.useLayoutEffect
|
|
27
33
|
|
|
28
34
|
var NS = 'wdx-relief'
|
|
29
35
|
var RPC_PATH = '/api/wdx-relief/predict'
|
|
36
|
+
var MAX_CUSTOM_CHARS = 2000
|
|
30
37
|
var SWITCH = primitives && primitives.Switch
|
|
31
38
|
var MENU = primitives && primitives.Menu
|
|
32
39
|
var CHEVRON = primitives && primitives.IconChevronDownOutlineRegular
|
|
40
|
+
var SETTINGS_FORM = primitives && primitives.SettingsForm
|
|
41
|
+
var SETTINGS_FORM_MODEL = primitives && primitives.SettingsFormModel
|
|
42
|
+
|
|
43
|
+
var VERBOSITY_OPTIONS = ['low', 'medium', 'high']
|
|
44
|
+
var STYLE_OPTIONS = ['default', 'professional', 'friendly', 'blunt', 'follow']
|
|
33
45
|
|
|
34
46
|
// ------------------------------------------------------------------ CSS
|
|
35
47
|
|
|
36
48
|
var CSS = [
|
|
37
|
-
'.wdxr-row{border-bottom:.5px solid var(--dsw-alias-border-l2);justify-content:space-between;align-items:center;gap:24px;padding:16px 0;display:flex}',
|
|
38
|
-
'.wdxr-text{min-width:0}',
|
|
39
|
-
'.wdxr-title{font-size:14px;line-height:20px}',
|
|
40
|
-
'.wdxr-desc{color:var(--dsw-alias-label-secondary);margin-top:4px;font-size:12px;line-height:18px}',
|
|
41
|
-
'.wdxr-error{color:var(--dsw-alias-state-error-primary);margin-top:4px;font-size:12px;line-height:18px}',
|
|
42
49
|
'.wdxs-page{width:100%;display:flex;flex-direction:column;color:var(--dsw-alias-label-primary)}',
|
|
43
50
|
'.wdxs-intro{color:var(--dsw-alias-label-tertiary);margin:-4px 0 4px;font-size:12px;line-height:18px}',
|
|
44
51
|
'.wdxs-groupHead{color:var(--dsw-alias-label-secondary);margin:24px 0 0;font-size:13px;font-weight:600;line-height:20px}',
|
|
@@ -49,6 +56,8 @@ window.__ModuleLoader__.load({
|
|
|
49
56
|
'.wdxs-rowText{flex:1;min-width:0}',
|
|
50
57
|
'.wdxs-title{font-size:14px;line-height:20px}',
|
|
51
58
|
'.wdxs-desc{color:var(--dsw-alias-label-secondary);margin-top:4px;font-size:12px;line-height:18px}',
|
|
59
|
+
'.wdxs-reset{color:var(--dsw-alias-label-tertiary);background:none;border:0;padding:0;margin-top:6px;font:inherit;font-size:12px;line-height:18px;cursor:pointer;text-decoration:underline}',
|
|
60
|
+
'@media (hover:hover){.wdxs-reset:hover{color:var(--dsw-alias-label-primary)}}',
|
|
52
61
|
'.wdxs-select{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform);height:36px;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;align-items:center;gap:12px;padding:0 14px;font:inherit;font-size:14px;line-height:22px;display:inline-flex}',
|
|
53
62
|
'@media (hover:hover){.wdxs-select:hover{background:var(--dsw-alias-interactive-bg-hover)}}',
|
|
54
63
|
'.wdxs-chevron{flex:none}',
|
|
@@ -56,16 +65,11 @@ window.__ModuleLoader__.load({
|
|
|
56
65
|
'.wdxs-textarea{box-sizing:border-box;width:100%;min-height:104px;resize:vertical;border-radius:var(--dsw-radius-md);border:.5px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-primary);outline:none;margin-top:10px;padding:10px 12px;font:inherit;font-size:13px;line-height:20px}',
|
|
57
66
|
'.wdxs-textarea:focus-visible{border-color:var(--dsw-alias-state-business-primary)}',
|
|
58
67
|
'.wdxs-textarea::placeholder{color:var(--dsw-alias-label-caption)}',
|
|
59
|
-
'.wdxs-
|
|
60
|
-
'.wdxs-error{color:var(--dsw-alias-state-error-primary);margin-top:6px;font-size:12px;line-height:18px}',
|
|
68
|
+
'.wdxs-fallback{border:0;padding:0;margin:0}',
|
|
61
69
|
].join('')
|
|
62
70
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
tag.dataset.plugin = 'dsh-wdx-relief'
|
|
66
|
-
tag.dataset.pluginCss = 'dsh-wdx-relief'
|
|
67
|
-
tag.textContent = CSS
|
|
68
|
-
document.head.appendChild(tag)
|
|
71
|
+
function PluginStyles() {
|
|
72
|
+
return h('style', { 'data-plugin-css': NS }, CSS)
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
// -------------------------------------------------------------- locale
|
|
@@ -97,12 +101,17 @@ window.__ModuleLoader__.load({
|
|
|
97
101
|
'reply.custom.title': '自定义指令',
|
|
98
102
|
'reply.custom.description': '补充只影响回复表达的指令,优先级高于上面的长度和风格',
|
|
99
103
|
'reply.custom.placeholder': '例如:先给结论;用中文解释术语;不要使用「首先/其次」。',
|
|
100
|
-
'reply.saved': '已保存',
|
|
101
|
-
'reply.saveError': '保存失败,请重试',
|
|
102
104
|
'settings.title': '显示预测消息',
|
|
103
105
|
'settings.description': '根据对话预测你接下来要发送的消息',
|
|
104
|
-
'settings.
|
|
105
|
-
'
|
|
106
|
+
'settings.summary': '预测下一句,并设置回复长度、风格和便于行动。',
|
|
107
|
+
'prediction.label': '下一句',
|
|
108
|
+
'prediction.accept': '按 Tab 填入预测',
|
|
109
|
+
'form.unavailable': '配置暂不可用。',
|
|
110
|
+
'form.readOnly': '当前部署只读。',
|
|
111
|
+
'form.saveFailed': '本部署没有接受这些值;已保留供你修改。',
|
|
112
|
+
'form.save': '保存',
|
|
113
|
+
'form.saving': '保存中…',
|
|
114
|
+
'form.reset': '恢复默认',
|
|
106
115
|
}
|
|
107
116
|
|
|
108
117
|
var en = {
|
|
@@ -132,12 +141,25 @@ window.__ModuleLoader__.load({
|
|
|
132
141
|
'reply.custom.title': 'Custom instructions',
|
|
133
142
|
'reply.custom.description': 'Extra instructions about expression; override the length and style settings above',
|
|
134
143
|
'reply.custom.placeholder': 'e.g. Lead with the conclusion; explain terms in one Chinese sentence; avoid "firstly/secondly".',
|
|
135
|
-
'reply.saved': 'Saved',
|
|
136
|
-
'reply.saveError': 'Could not save. Try again.',
|
|
137
144
|
'settings.title': 'Show predicted messages',
|
|
138
145
|
'settings.description': 'Predict what you might send next based on the conversation',
|
|
139
|
-
'settings.
|
|
140
|
-
'
|
|
146
|
+
'settings.summary': 'Predict the next message, and set reply length, style, and actionable replies.',
|
|
147
|
+
'prediction.label': 'Next',
|
|
148
|
+
'prediction.accept': 'Press Tab to insert the prediction',
|
|
149
|
+
'form.unavailable': 'Configuration is unavailable.',
|
|
150
|
+
'form.readOnly': 'This deployment stores settings read-only.',
|
|
151
|
+
'form.saveFailed': 'The deployment did not accept these values; they were left for you to correct.',
|
|
152
|
+
'form.save': 'Save',
|
|
153
|
+
'form.saving': 'Saving…',
|
|
154
|
+
'form.reset': 'Reset to default',
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function tr(t, key, fallback) {
|
|
158
|
+
if (t) {
|
|
159
|
+
var value = t(key)
|
|
160
|
+
if (value !== key) return value
|
|
161
|
+
}
|
|
162
|
+
return fallback
|
|
141
163
|
}
|
|
142
164
|
|
|
143
165
|
// --------------------------------------------------------------- host
|
|
@@ -165,11 +187,13 @@ window.__ModuleLoader__.load({
|
|
|
165
187
|
return typeof value === 'string' && value !== '' ? value : null
|
|
166
188
|
}
|
|
167
189
|
|
|
168
|
-
//
|
|
190
|
+
// ---------------------------------------------------------- prediction
|
|
169
191
|
|
|
170
192
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
193
|
+
* 输入框里的灰字预测(Codex 式)。
|
|
194
|
+
* 这是用户明确选择保留的体验:建议叠在空输入框的光标起点上,而不是变成输入框外的一行。
|
|
195
|
+
* 定位仍读取 composer 的布局矩形;这是该视觉方案的代价,组件只在
|
|
196
|
+
* `conversation.input.overlay` 自己的浮层里读写,不改动宿主 DOM 的结构。
|
|
173
197
|
*/
|
|
174
198
|
function PredictionOverlay(props) {
|
|
175
199
|
var useSession = props.useSession
|
|
@@ -331,8 +355,7 @@ window.__ModuleLoader__.load({
|
|
|
331
355
|
visible
|
|
332
356
|
? h('div', {
|
|
333
357
|
'data-wdx-prediction': true,
|
|
334
|
-
'
|
|
335
|
-
title: t ? t('hint.accept') : undefined,
|
|
358
|
+
title: tr(t, 'prediction.accept', 'Press Tab to insert the prediction'),
|
|
336
359
|
style: {
|
|
337
360
|
position: 'absolute',
|
|
338
361
|
top: box.top + 'px',
|
|
@@ -348,8 +371,9 @@ window.__ModuleLoader__.load({
|
|
|
348
371
|
}, [
|
|
349
372
|
h('span', {
|
|
350
373
|
key: 'text',
|
|
374
|
+
'aria-hidden': true,
|
|
351
375
|
style: {
|
|
352
|
-
color: 'var(--dsw-alias-label-caption
|
|
376
|
+
color: 'var(--dsw-alias-label-caption)',
|
|
353
377
|
fontSize: box.fontSize,
|
|
354
378
|
lineHeight: box.lineHeight,
|
|
355
379
|
fontFamily: box.fontFamily,
|
|
@@ -361,14 +385,20 @@ window.__ModuleLoader__.load({
|
|
|
361
385
|
opacity: 0.9,
|
|
362
386
|
},
|
|
363
387
|
}, suggestion),
|
|
364
|
-
h('
|
|
388
|
+
h('button', {
|
|
365
389
|
key: 'key',
|
|
390
|
+
type: 'button',
|
|
391
|
+
title: tr(t, 'prediction.accept', 'Press Tab to insert the prediction'),
|
|
392
|
+
'aria-label': tr(t, 'prediction.accept', 'Press Tab to insert the prediction') + ': ' + suggestion,
|
|
366
393
|
onPointerDown: function (event) {
|
|
367
394
|
if (event.button !== 0) return
|
|
368
395
|
event.preventDefault()
|
|
369
396
|
event.stopPropagation()
|
|
370
397
|
accept()
|
|
371
398
|
},
|
|
399
|
+
onClick: function (event) {
|
|
400
|
+
if (event.detail === 0) accept()
|
|
401
|
+
},
|
|
372
402
|
style: {
|
|
373
403
|
pointerEvents: 'auto',
|
|
374
404
|
cursor: 'pointer',
|
|
@@ -378,8 +408,9 @@ window.__ModuleLoader__.load({
|
|
|
378
408
|
lineHeight: '18px',
|
|
379
409
|
padding: '0 4px',
|
|
380
410
|
borderRadius: '4px',
|
|
381
|
-
border: '0.5px solid var(--dsw-alias-border-l2
|
|
382
|
-
|
|
411
|
+
border: '0.5px solid var(--dsw-alias-border-l2)',
|
|
412
|
+
background: 'transparent',
|
|
413
|
+
color: 'var(--dsw-alias-label-caption)',
|
|
383
414
|
fontSize: '10px',
|
|
384
415
|
fontFamily: 'ui-monospace, Menlo, monospace',
|
|
385
416
|
opacity: 0.75,
|
|
@@ -389,29 +420,153 @@ window.__ModuleLoader__.load({
|
|
|
389
420
|
: null)
|
|
390
421
|
}
|
|
391
422
|
|
|
392
|
-
//
|
|
423
|
+
// --------------------------------------------------------- settings UI
|
|
393
424
|
|
|
394
|
-
|
|
425
|
+
function oneOf(value, allowed) {
|
|
426
|
+
return typeof value === 'string' && allowed.indexOf(value) !== -1 ? value : undefined
|
|
427
|
+
}
|
|
395
428
|
|
|
396
|
-
function
|
|
397
|
-
|
|
398
|
-
var
|
|
399
|
-
if (value
|
|
429
|
+
function readConfig(scope) {
|
|
430
|
+
try {
|
|
431
|
+
var snapshot = scope.getSnapshot()
|
|
432
|
+
if (snapshot && snapshot.value && typeof snapshot.value === 'object') return snapshot.value
|
|
433
|
+
} catch (error) {
|
|
434
|
+
// 配置尚未就绪时按默认值显示。
|
|
435
|
+
}
|
|
436
|
+
return {}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function legacyStyle(scope) {
|
|
440
|
+
var value = readConfig(scope)
|
|
441
|
+
if (value.writingStyle === true) return 'follow'
|
|
442
|
+
if (value.baseStyle === 'professional' || value.baseStyle === 'friendly' || value.baseStyle === 'blunt') return value.baseStyle
|
|
443
|
+
return 'default'
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function booleanText(value) {
|
|
447
|
+
return value === false ? 'false' : 'true'
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function parseBoolean(text) {
|
|
451
|
+
if (text === 'true') return { kind: 'set', value: true }
|
|
452
|
+
if (text === 'false') return { kind: 'set', value: false }
|
|
453
|
+
return undefined
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function choiceField(name, allowed, fallback) {
|
|
457
|
+
return {
|
|
458
|
+
field: name,
|
|
459
|
+
format: function (value) {
|
|
460
|
+
return oneOf(value, allowed) || fallback
|
|
461
|
+
},
|
|
462
|
+
parse: function (text) {
|
|
463
|
+
var value = oneOf(text, allowed)
|
|
464
|
+
return value === undefined ? undefined : { kind: 'set', value: value }
|
|
465
|
+
},
|
|
400
466
|
}
|
|
401
|
-
return fallback
|
|
402
467
|
}
|
|
403
468
|
|
|
404
|
-
function
|
|
469
|
+
function createSettingsModel(scope) {
|
|
470
|
+
var model = new SETTINGS_FORM_MODEL(scope, [
|
|
471
|
+
{ field: 'enabled', format: booleanText, parse: parseBoolean },
|
|
472
|
+
choiceField('verbosity', VERBOSITY_OPTIONS, 'low'),
|
|
473
|
+
{ field: 'actionable', format: booleanText, parse: parseBoolean },
|
|
474
|
+
{
|
|
475
|
+
field: 'style',
|
|
476
|
+
format: function (value) {
|
|
477
|
+
return oneOf(value, STYLE_OPTIONS) || legacyStyle(scope)
|
|
478
|
+
},
|
|
479
|
+
parse: function (text) {
|
|
480
|
+
var value = oneOf(text, STYLE_OPTIONS)
|
|
481
|
+
return value === undefined ? undefined : { kind: 'set', value: value }
|
|
482
|
+
},
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
field: 'customInstructions',
|
|
486
|
+
format: function (value) {
|
|
487
|
+
return typeof value === 'string' ? value.slice(0, MAX_CUSTOM_CHARS) : ''
|
|
488
|
+
},
|
|
489
|
+
parse: function (text) {
|
|
490
|
+
var value = text.slice(0, MAX_CUSTOM_CHARS)
|
|
491
|
+
return value === '' ? { kind: 'clear' } : { kind: 'set', value: value }
|
|
492
|
+
},
|
|
493
|
+
},
|
|
494
|
+
])
|
|
495
|
+
|
|
496
|
+
var store = model.bind(function () {
|
|
497
|
+
return {
|
|
498
|
+
...model.shell(),
|
|
499
|
+
enabled: model.field('enabled'),
|
|
500
|
+
verbosity: model.field('verbosity'),
|
|
501
|
+
actionable: model.field('actionable'),
|
|
502
|
+
style: model.field('style'),
|
|
503
|
+
customInstructions: model.field('customInstructions'),
|
|
504
|
+
}
|
|
505
|
+
})
|
|
506
|
+
|
|
507
|
+
return { model: model, store: store }
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function FieldText(props) {
|
|
511
|
+
var t = props.t
|
|
512
|
+
return h('div', { className: 'wdxs-rowText' }, [
|
|
513
|
+
h('div', { key: 'title', className: 'wdxs-title' }, props.title),
|
|
514
|
+
props.description ? h('div', { key: 'desc', className: 'wdxs-desc' }, props.description) : null,
|
|
515
|
+
props.overridden
|
|
516
|
+
? h('button', {
|
|
517
|
+
key: 'reset',
|
|
518
|
+
type: 'button',
|
|
519
|
+
className: 'wdxs-reset',
|
|
520
|
+
onClick: props.onReset,
|
|
521
|
+
}, tr(t, 'form.reset', '恢复默认'))
|
|
522
|
+
: null,
|
|
523
|
+
])
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
function ToggleField(props) {
|
|
527
|
+
var field = props.field
|
|
528
|
+
var checked = field.text !== 'false'
|
|
529
|
+
var disabled = props.disabled === true
|
|
530
|
+
return h('div', { className: 'wdxs-row' }, [
|
|
531
|
+
h(FieldText, {
|
|
532
|
+
key: 'text',
|
|
533
|
+
t: props.t,
|
|
534
|
+
title: props.title,
|
|
535
|
+
description: props.description,
|
|
536
|
+
overridden: field.overridden === true,
|
|
537
|
+
onReset: props.onReset,
|
|
538
|
+
}),
|
|
539
|
+
SWITCH
|
|
540
|
+
? h(SWITCH, {
|
|
541
|
+
key: 'switch',
|
|
542
|
+
checked: checked,
|
|
543
|
+
label: props.title,
|
|
544
|
+
disabled: disabled,
|
|
545
|
+
onChange: function (next) { props.onChange(next) },
|
|
546
|
+
})
|
|
547
|
+
: h('button', {
|
|
548
|
+
key: 'fallback',
|
|
549
|
+
type: 'button',
|
|
550
|
+
'aria-pressed': checked,
|
|
551
|
+
disabled: disabled,
|
|
552
|
+
onClick: function () { props.onChange(!checked) },
|
|
553
|
+
className: 'wdxs-select',
|
|
554
|
+
}, checked ? 'On' : 'Off'),
|
|
555
|
+
])
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function SelectField(props) {
|
|
405
559
|
var [open, setOpen] = useState(false)
|
|
406
560
|
var options = props.options
|
|
407
561
|
var selected = options.filter(function (option) { return option.id === props.value })[0] || options[0]
|
|
562
|
+
var disabled = props.disabled === true
|
|
408
563
|
var anchor = h('button', {
|
|
409
564
|
type: 'button',
|
|
410
565
|
className: 'wdxs-select',
|
|
411
566
|
'aria-label': props.title || undefined,
|
|
412
567
|
'aria-haspopup': 'menu',
|
|
413
568
|
'aria-expanded': open,
|
|
414
|
-
disabled:
|
|
569
|
+
disabled: disabled,
|
|
415
570
|
onClick: function () { setOpen(function (value) { return !value }) },
|
|
416
571
|
}, [
|
|
417
572
|
h('span', { key: 'label' }, selected ? (selected.text || selected.label) : ''),
|
|
@@ -437,130 +592,75 @@ window.__ModuleLoader__.load({
|
|
|
437
592
|
key: 'select',
|
|
438
593
|
className: 'wdxs-select',
|
|
439
594
|
value: props.value,
|
|
440
|
-
disabled:
|
|
595
|
+
disabled: disabled,
|
|
441
596
|
onChange: function (event) { props.onChange(event.target.value) },
|
|
442
597
|
}, options.map(function (option) {
|
|
443
598
|
return h('option', { key: option.id, value: option.id }, option.label)
|
|
444
599
|
}))
|
|
445
600
|
|
|
446
|
-
|
|
447
601
|
return h('div', { className: 'wdxs-row' }, [
|
|
448
|
-
h(
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
602
|
+
h(FieldText, {
|
|
603
|
+
key: 'text',
|
|
604
|
+
t: props.t,
|
|
605
|
+
title: props.title,
|
|
606
|
+
description: props.description,
|
|
607
|
+
overridden: props.overridden === true,
|
|
608
|
+
onReset: props.onReset,
|
|
609
|
+
}),
|
|
452
610
|
control,
|
|
453
611
|
])
|
|
454
612
|
}
|
|
455
613
|
|
|
456
|
-
function
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
h('div', { key: 'title', className: 'wdxs-title' }, props.title),
|
|
460
|
-
props.description ? h('div', { key: 'desc', className: 'wdxs-desc' }, props.description) : null,
|
|
461
|
-
]),
|
|
462
|
-
SWITCH
|
|
463
|
-
? h(SWITCH, {
|
|
464
|
-
key: 'switch',
|
|
465
|
-
checked: props.value === true,
|
|
466
|
-
label: props.title,
|
|
467
|
-
onChange: props.onChange,
|
|
468
|
-
})
|
|
469
|
-
: h('button', {
|
|
470
|
-
key: 'fallback',
|
|
471
|
-
type: 'button',
|
|
472
|
-
'aria-pressed': props.value === true,
|
|
473
|
-
onClick: function () { props.onChange(props.value !== true) },
|
|
474
|
-
className: 'wdxs-select',
|
|
475
|
-
}, props.value === true ? 'On' : 'Off'),
|
|
476
|
-
])
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
function CustomInstructionsRow(props) {
|
|
480
|
-
var value = typeof props.value === 'string' ? props.value : ''
|
|
481
|
-
var [draft, setDraft] = useState(value)
|
|
482
|
-
var focused = useRef(false)
|
|
483
|
-
var timer = useRef(null)
|
|
484
|
-
|
|
485
|
-
useEffect(function () {
|
|
486
|
-
if (!focused.current) setDraft(value)
|
|
487
|
-
}, [value])
|
|
488
|
-
|
|
489
|
-
useEffect(function () {
|
|
490
|
-
return function () {
|
|
491
|
-
if (timer.current !== null) clearTimeout(timer.current)
|
|
492
|
-
}
|
|
493
|
-
}, [])
|
|
494
|
-
|
|
495
|
-
function commit(next) {
|
|
496
|
-
if (next === value) return
|
|
497
|
-
props.onChange(next)
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
function schedule(next) {
|
|
501
|
-
var clipped = next.slice(0, 2000)
|
|
502
|
-
setDraft(clipped)
|
|
503
|
-
if (timer.current !== null) clearTimeout(timer.current)
|
|
504
|
-
timer.current = setTimeout(function () {
|
|
505
|
-
timer.current = null
|
|
506
|
-
commit(clipped)
|
|
507
|
-
}, 700)
|
|
508
|
-
}
|
|
509
|
-
|
|
614
|
+
function CustomTextField(props) {
|
|
615
|
+
var field = props.field
|
|
616
|
+
var disabled = props.disabled === true
|
|
510
617
|
return h('div', { className: 'wdxs-custom' }, [
|
|
511
|
-
h(
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
618
|
+
h(FieldText, {
|
|
619
|
+
key: 'text',
|
|
620
|
+
t: props.t,
|
|
621
|
+
title: props.title,
|
|
622
|
+
description: props.description,
|
|
623
|
+
overridden: field.overridden === true,
|
|
624
|
+
onReset: props.onReset,
|
|
625
|
+
}),
|
|
515
626
|
h('textarea', {
|
|
516
627
|
key: 'input',
|
|
517
628
|
className: 'wdxs-textarea',
|
|
518
|
-
value:
|
|
519
|
-
maxLength:
|
|
629
|
+
value: field.text,
|
|
630
|
+
maxLength: MAX_CUSTOM_CHARS,
|
|
520
631
|
placeholder: props.placeholder,
|
|
521
632
|
spellCheck: false,
|
|
522
|
-
|
|
523
|
-
onChange: function (event) {
|
|
524
|
-
onBlur: function () {
|
|
525
|
-
focused.current = false
|
|
526
|
-
if (timer.current !== null) {
|
|
527
|
-
clearTimeout(timer.current)
|
|
528
|
-
timer.current = null
|
|
529
|
-
}
|
|
530
|
-
commit(draft)
|
|
531
|
-
},
|
|
633
|
+
disabled: disabled,
|
|
634
|
+
onChange: function (event) { props.onChange(event.target.value) },
|
|
532
635
|
}),
|
|
533
636
|
])
|
|
534
637
|
}
|
|
535
638
|
|
|
536
639
|
function BundleSettingsPage(props) {
|
|
537
|
-
var useSettings = props.useSettings
|
|
538
|
-
var setField = props.setField
|
|
539
640
|
var t = props.t
|
|
540
|
-
|
|
541
|
-
var value = settings && settings.value ? settings.value : {}
|
|
542
|
-
var [error, setError] = useState('')
|
|
543
|
-
var [saved, setSaved] = useState(false)
|
|
544
|
-
var savedTimer = useRef(null)
|
|
641
|
+
if (props.view === 'summary') return tr(t, 'settings.summary', '预测下一句,并设置回复长度、风格和便于行动。')
|
|
545
642
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
643
|
+
var useSettings = props.useSettings
|
|
644
|
+
var state = useSettings ? useSettings(function (s) { return s }) : undefined
|
|
645
|
+
if (!state) return null
|
|
646
|
+
|
|
647
|
+
var disabled = state.writable === false || state.saving === true
|
|
648
|
+
var emptyField = { text: '', overridden: false, invalid: false }
|
|
649
|
+
var enabled = state.enabled || emptyField
|
|
650
|
+
var verbosity = state.verbosity || emptyField
|
|
651
|
+
var actionable = state.actionable || emptyField
|
|
652
|
+
var style = state.style || emptyField
|
|
653
|
+
var customInstructions = state.customInstructions || emptyField
|
|
654
|
+
|
|
655
|
+
function edit(name, value) {
|
|
656
|
+
if (typeof props.edit === 'function') props.edit(name, value)
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
function reset(name) {
|
|
660
|
+
if (typeof props.resetField === 'function') props.resetField(name)
|
|
561
661
|
}
|
|
562
662
|
|
|
563
|
-
var verbosityOptions =
|
|
663
|
+
var verbosityOptions = VERBOSITY_OPTIONS.map(function (id) {
|
|
564
664
|
return { id: id, label: tr(t, 'reply.verbosity.' + id, id) }
|
|
565
665
|
})
|
|
566
666
|
var styleOptions = STYLE_OPTIONS.map(function (id) {
|
|
@@ -575,70 +675,93 @@ window.__ModuleLoader__.load({
|
|
|
575
675
|
}
|
|
576
676
|
})
|
|
577
677
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
678
|
+
var formLabels = {
|
|
679
|
+
unavailable: tr(t, 'form.unavailable', '配置暂不可用。'),
|
|
680
|
+
readOnly: tr(t, 'form.readOnly', '当前部署只读。'),
|
|
681
|
+
saveFailed: tr(t, 'form.saveFailed', '保存失败,请重试。'),
|
|
682
|
+
save: tr(t, 'form.save', '保存'),
|
|
683
|
+
saving: tr(t, 'form.saving', '保存中…'),
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
var Form = SETTINGS_FORM || function (formProps) {
|
|
687
|
+
return h('div', { className: 'wdxs-fallback' }, formProps.children)
|
|
584
688
|
}
|
|
585
689
|
|
|
586
690
|
return h('div', { className: 'wdxs-page' }, [
|
|
691
|
+
h(PluginStyles, { key: 'style' }),
|
|
587
692
|
h('div', { key: 'intro', className: 'wdxs-intro' }, tr(t, 'reply.intro', '')),
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
693
|
+
h(Form, {
|
|
694
|
+
key: 'form',
|
|
695
|
+
labels: formLabels,
|
|
696
|
+
state: state,
|
|
697
|
+
onSave: function () { if (typeof props.save === 'function') props.save() },
|
|
698
|
+
onDiscard: function () { if (typeof props.discard === 'function') props.discard() },
|
|
699
|
+
}, [
|
|
700
|
+
h('div', { key: 'input', className: 'wdxs-group' }, [
|
|
701
|
+
h('div', { key: 'head', className: 'wdxs-groupHead' }, tr(t, 'reply.group.input', '输入')),
|
|
702
|
+
h(ToggleField, {
|
|
703
|
+
key: 'prediction',
|
|
704
|
+
t: t,
|
|
705
|
+
title: tr(t, 'settings.title', '显示预测消息'),
|
|
706
|
+
description: tr(t, 'settings.description', '根据对话预测你接下来要发送的消息'),
|
|
707
|
+
field: enabled,
|
|
708
|
+
disabled: disabled,
|
|
709
|
+
onChange: function (next) { edit('enabled', String(next)) },
|
|
710
|
+
onReset: function () { reset('enabled') },
|
|
711
|
+
}),
|
|
712
|
+
]),
|
|
713
|
+
h('div', { key: 'length', className: 'wdxs-group' }, [
|
|
714
|
+
h('div', { key: 'head', className: 'wdxs-groupHead' }, tr(t, 'reply.group.length', '回复长度')),
|
|
715
|
+
h(SelectField, {
|
|
716
|
+
key: 'verbosity',
|
|
717
|
+
t: t,
|
|
718
|
+
title: tr(t, 'reply.verbosity.title', '输出详细程度'),
|
|
719
|
+
description: tr(t, 'reply.verbosity.description', ''),
|
|
720
|
+
options: verbosityOptions,
|
|
721
|
+
value: verbosity.text || 'low',
|
|
722
|
+
overridden: verbosity.overridden === true,
|
|
723
|
+
disabled: disabled,
|
|
724
|
+
onChange: function (next) { edit('verbosity', next) },
|
|
725
|
+
onReset: function () { reset('verbosity') },
|
|
726
|
+
}),
|
|
727
|
+
]),
|
|
728
|
+
h('div', { key: 'writing', className: 'wdxs-group' }, [
|
|
729
|
+
h('div', { key: 'head', className: 'wdxs-groupHead' }, tr(t, 'reply.group.writing', '写作')),
|
|
730
|
+
h(ToggleField, {
|
|
731
|
+
key: 'actionable',
|
|
732
|
+
t: t,
|
|
733
|
+
title: tr(t, 'reply.actionable.title', '便于行动'),
|
|
734
|
+
description: tr(t, 'reply.actionable.description', ''),
|
|
735
|
+
field: actionable,
|
|
736
|
+
disabled: disabled,
|
|
737
|
+
onChange: function (next) { edit('actionable', String(next)) },
|
|
738
|
+
onReset: function () { reset('actionable') },
|
|
739
|
+
}),
|
|
740
|
+
h(SelectField, {
|
|
741
|
+
key: 'style',
|
|
742
|
+
t: t,
|
|
743
|
+
title: tr(t, 'reply.style.title', '回复风格'),
|
|
744
|
+
description: tr(t, 'reply.style.description', ''),
|
|
745
|
+
options: styleOptions,
|
|
746
|
+
value: style.text,
|
|
747
|
+
overridden: style.overridden === true,
|
|
748
|
+
disabled: disabled,
|
|
749
|
+
onChange: function (next) { edit('style', next) },
|
|
750
|
+
onReset: function () { reset('style') },
|
|
751
|
+
}),
|
|
752
|
+
]),
|
|
753
|
+
h(CustomTextField, {
|
|
754
|
+
key: 'custom',
|
|
755
|
+
t: t,
|
|
756
|
+
title: tr(t, 'reply.custom.title', '自定义指令'),
|
|
757
|
+
description: tr(t, 'reply.custom.description', ''),
|
|
758
|
+
placeholder: tr(t, 'reply.custom.placeholder', ''),
|
|
759
|
+
field: customInstructions,
|
|
760
|
+
disabled: disabled,
|
|
761
|
+
onChange: function (next) { edit('customInstructions', next) },
|
|
762
|
+
onReset: function () { reset('customInstructions') },
|
|
628
763
|
}),
|
|
629
764
|
]),
|
|
630
|
-
|
|
631
|
-
h(CustomInstructionsRow, {
|
|
632
|
-
key: 'custom',
|
|
633
|
-
title: tr(t, 'reply.custom.title', '自定义指令'),
|
|
634
|
-
description: tr(t, 'reply.custom.description', ''),
|
|
635
|
-
placeholder: tr(t, 'reply.custom.placeholder', ''),
|
|
636
|
-
value: typeof value.customInstructions === 'string' ? value.customInstructions : '',
|
|
637
|
-
onChange: function (next) { update('customInstructions', next) },
|
|
638
|
-
}),
|
|
639
|
-
|
|
640
|
-
error ? h('div', { key: 'error', className: 'wdxs-error', role: 'alert' }, error) : null,
|
|
641
|
-
saved && !error ? h('div', { key: 'saved', className: 'wdxs-status', role: 'status' }, tr(t, 'reply.saved', '已保存')) : null,
|
|
642
765
|
])
|
|
643
766
|
}
|
|
644
767
|
|
|
@@ -653,10 +776,17 @@ window.__ModuleLoader__.load({
|
|
|
653
776
|
}, 'wdx-relief: dictionaries')
|
|
654
777
|
|
|
655
778
|
var form = ctx.configForms.get(NS)
|
|
779
|
+
var settings = createSettingsModel(form)
|
|
780
|
+
ctx.effect(function () {
|
|
781
|
+
return function () { settings.model.dispose() }
|
|
782
|
+
}, 'wdx-relief: settings form')
|
|
783
|
+
|
|
784
|
+
// 预测组件只需要只读的配置快照;配置页使用上面的暂存 model。
|
|
656
785
|
var formSource = {
|
|
657
786
|
getSnapshot: function () { return form.getSnapshot() },
|
|
658
787
|
subscribe: function (listener) { return form.subscribe(listener) },
|
|
659
788
|
}
|
|
789
|
+
|
|
660
790
|
ctx.slots.inject('conversation.input.overlay', function () {
|
|
661
791
|
return ctx.slots.register({
|
|
662
792
|
name: 'conversation.input.overlay',
|
|
@@ -669,27 +799,19 @@ window.__ModuleLoader__.load({
|
|
|
669
799
|
}, PredictionOverlay)
|
|
670
800
|
})
|
|
671
801
|
|
|
672
|
-
var configInjected = function () {
|
|
673
|
-
return {
|
|
674
|
-
hooks: { settings: formSource },
|
|
675
|
-
setField: function (field, next) {
|
|
676
|
-
return form.set(field, next).then(function (accepted) {
|
|
677
|
-
if (accepted !== true) throw new Error('settings write refused')
|
|
678
|
-
return accepted
|
|
679
|
-
})
|
|
680
|
-
},
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
|
|
684
802
|
ctx.slots.inject('plugins.bundle.config', function () {
|
|
685
803
|
return ctx.slots.register({
|
|
686
804
|
name: 'plugins.bundle.config',
|
|
687
805
|
key: 'dsh-wdx-relief',
|
|
688
806
|
locale: NS,
|
|
689
|
-
inject:
|
|
807
|
+
inject: function () {
|
|
808
|
+
return {
|
|
809
|
+
hooks: { settings: settings.store },
|
|
810
|
+
...settings.model.actions(),
|
|
811
|
+
}
|
|
812
|
+
},
|
|
690
813
|
}, BundleSettingsPage)
|
|
691
814
|
})
|
|
692
|
-
|
|
693
815
|
}
|
|
694
816
|
|
|
695
817
|
exports.name = name
|
package/cordis.patch.yml
CHANGED
package/docs/guide.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# WDX Relief 开发与验证
|
|
2
2
|
|
|
3
|
-

|
|
4
|
+
|
|
5
|
+
> 截图为 0.3.0;0.3.1 起配置页改为「先编辑、再保存」,底部会多出保存按钮。
|
|
4
6
|
|
|
5
7
|
## 独立 web profile 安装
|
|
6
8
|
|
|
@@ -15,12 +17,15 @@ dsh plugin --profile web add link:/path/to/dsh-wdx-relief
|
|
|
15
17
|
|
|
16
18
|
## 配置页在哪里
|
|
17
19
|
|
|
18
|
-
`
|
|
19
|
-
`
|
|
20
|
-
|
|
20
|
+
配置页通过 `ctx.slots.inject('plugins.bundle.config', …)` 注册,key 是包名 `dsh-wdx-relief`;
|
|
21
|
+
`dsh.client.inject` 因此声明 `@deepseek-ai/dsh-client-ui-plugin-manager`;同时保留
|
|
22
|
+
`@deepseek-ai/dsh-client-ui-settings`,因为 `configForms` 由它提供。插件管理页加载后,bundle 页面在 README 下方渲染这个 keyed slot;插件关闭时
|
|
23
|
+
整个浏览器半身卸载,配置页也随之消失。
|
|
21
24
|
|
|
22
|
-
所有字段都是 Host `Config` 的 `.volatile()`
|
|
23
|
-
|
|
25
|
+
所有字段都是 Host `Config` 的 `.volatile()` 引用。客户端用
|
|
26
|
+
`SettingsFormModel(ctx.configForms.get('wdx-relief'), …)` 暂存编辑,点 **保存** 才通过
|
|
27
|
+
`form.mutate()` 写入;离开页面会丢弃未保存草稿。写入落到 profile 的 `cordis.patch.yml`,
|
|
28
|
+
HMR 生效。
|
|
24
29
|
|
|
25
30
|
| 字段 | 默认 | 说明 |
|
|
26
31
|
|---|---|---|
|
|
@@ -44,12 +49,13 @@ bundle 层只声明入口和预测开关,其余字段由 schema 默认值提
|
|
|
44
49
|
|
|
45
50
|
## 输入预测
|
|
46
51
|
|
|
47
|
-
1.
|
|
52
|
+
1. 客户端注册在 `conversation.input.overlay`,观察 `useSession.running`、`useInput` 和设置;
|
|
48
53
|
空闲、空输入时以 350ms 防抖请求 `POST /api/wdx-relief/predict`。
|
|
49
54
|
2. Host 用 `ctx.sessions.get(sessionId).deriveMessages()` 取最近几轮真人用户/助手文本,
|
|
50
55
|
要求最后一条是助手消息;用 `agentDefaultModel` 的最低推理档位生成一条短句。
|
|
51
56
|
3. 结果按 `session.seq` 缓存;客户端把灰字绝对定位到 `[data-composer-input]` 的文字起点,
|
|
52
57
|
Tab 通过标准 prop `inputActions.setDraft()` 写入 Lexical 编辑器。
|
|
58
|
+
这条 Codex 式体验依赖 composer 的布局矩形,是本插件已知的 DOM 耦合点。
|
|
53
59
|
|
|
54
60
|
## 回复风格
|
|
55
61
|
|
|
@@ -71,7 +77,7 @@ Host 在 `ctx.systemPrompt` 注册:
|
|
|
71
77
|
按内容比例组织(句 > 段 > 清单)、术语先用白话说明、保留风险与失败条件、不复述、
|
|
72
78
|
不把已获授权的工作交回用户。
|
|
73
79
|
|
|
74
|
-
## 实机验证记录(DSH 0.2.2-rc.1
|
|
80
|
+
## 实机验证记录(DSH 0.2.2-rc.1,历史配置页)
|
|
75
81
|
|
|
76
82
|
- 侧边栏「插件」→ **WDX Relief** bundle 页出现配置区:输入开关、回复长度、便于行动开关、回复风格、自定义指令;
|
|
77
83
|
- 下拉框、开关、textarea 均可写入;关闭再打开设置后保持;`--dump-config` 能看到 `verbosity`、`actionable`、`style`、`customInstructions`;
|
|
@@ -79,11 +85,20 @@ Host 在 `ctx.systemPrompt` 注册:
|
|
|
79
85
|
- 输入框灰字出现、打字隐藏、清空重现,Tab 真正写入 Lexical;
|
|
80
86
|
- 关闭预测开关后不再发预测请求;
|
|
81
87
|
- Host 日志确认预测路由与 `wdx-relief:reply-style` prompt section 注册成功;
|
|
82
|
-
-
|
|
88
|
+
- Node 单测通过。
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## 0.3.1 验证
|
|
92
|
+
|
|
93
|
+
- `conversation.input.overlay` 下 `wdx-prediction`(registrant `wdx-relief`,active);保持 Codex 式输入框灰字。
|
|
94
|
+
- `plugins.bundle.config` 下 `dsh-wdx-relief` 条目仍 active。
|
|
95
|
+
- 配置页改用 `SettingsFormModel` 暂存、`SettingsForm` 保存;`node --test` 27 项通过。
|
|
96
|
+
- `npm pack --dry-run` 确认 `client/client.js`、`locale`、`icon.svg`、`cordis.patch.yml` 都在发布文件里。
|
|
97
|
+
- 浏览器内交互(实际点击、保存、开关、Tab)尚未在本次会话中用浏览器控制复核。
|
|
83
98
|
|
|
84
99
|
## 已知限制
|
|
85
100
|
|
|
86
101
|
- 回复风格是 prompt 软约束,不是硬截断;复杂任务仍可能写长。
|
|
87
102
|
- 写作风格只看当前对话;没有跨会话风格档案,也不读取工作区文件或外部应用。
|
|
88
103
|
- 风格设置全局生效,暂不支持 per-session。
|
|
89
|
-
- 灰字定位依赖 composer 的 DOM
|
|
104
|
+
- 灰字定位依赖 composer 的 DOM 属性(`data-composer-card/input/placeholder`),DSH 改版时需要同步。
|
package/index.js
CHANGED
|
@@ -23,7 +23,7 @@ export const Config = Schema.object({
|
|
|
23
23
|
enabled: Schema.boolean()
|
|
24
24
|
.default(true)
|
|
25
25
|
.volatile()
|
|
26
|
-
.description('
|
|
26
|
+
.description('根据对话在输入框下方显示下一条消息预测,Tab 填入'),
|
|
27
27
|
verbosity: Schema.union(VERBOSITY_VALUES)
|
|
28
28
|
.default('low')
|
|
29
29
|
.volatile()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-wdx-relief",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Take the friction out of daily DSH work: predicted next messages in the composer, plus reply length, tone, and writing style controls.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"./client": "./client/client.js",
|
|
10
10
|
"./package.json": "./package.json",
|
|
11
11
|
"./locale/*.json": "./locale/*.json",
|
|
12
|
-
"./icon": "./icon.
|
|
12
|
+
"./icon": "./icon.svg"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"index.js",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"client": {
|
|
33
33
|
"platform": "web",
|
|
34
34
|
"inject": [
|
|
35
|
-
"@deepseek-ai/dsh-client-ui-settings",
|
|
36
35
|
"@deepseek-ai/dsh-client-ui-conversation",
|
|
36
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
37
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager",
|
|
37
38
|
"@deepseek-ai/dsh-client-locale"
|
|
38
|
-
]
|
|
39
|
-
"immediately": true
|
|
39
|
+
]
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
@@ -44,16 +44,15 @@
|
|
|
44
44
|
"prepublishOnly": "npm test"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@deepseek-ai/cordis": "^4.0.1"
|
|
48
|
-
"@deepseek-ai/schemastery": "^3.19.0"
|
|
47
|
+
"@deepseek-ai/cordis": "^4.0.1"
|
|
49
48
|
},
|
|
50
49
|
"engines": {
|
|
51
50
|
"node": ">=22",
|
|
52
|
-
"dsh": ">=0.2.0"
|
|
51
|
+
"dsh": ">=0.2.0 <0.3.0"
|
|
53
52
|
},
|
|
54
53
|
"license": "MIT",
|
|
55
54
|
"devDependencies": {
|
|
56
|
-
"@deepseek-ai/
|
|
55
|
+
"@deepseek-ai/cordis": "^4.0.1"
|
|
57
56
|
},
|
|
58
57
|
"author": "wdxtub",
|
|
59
58
|
"keywords": [
|
|
@@ -63,9 +62,11 @@
|
|
|
63
62
|
"prediction",
|
|
64
63
|
"reply-style",
|
|
65
64
|
"web-ui",
|
|
66
|
-
"productivity"
|
|
65
|
+
"productivity",
|
|
66
|
+
"dsh-plugin",
|
|
67
|
+
"dsh-bundle"
|
|
67
68
|
],
|
|
68
|
-
"icon": "./icon.
|
|
69
|
+
"icon": "./icon.svg",
|
|
69
70
|
"repository": {
|
|
70
71
|
"type": "git",
|
|
71
72
|
"url": "git+https://github.com/wdxtub/dsh-wdx-relief.git"
|
|
@@ -77,5 +78,8 @@
|
|
|
77
78
|
"publishConfig": {
|
|
78
79
|
"access": "public",
|
|
79
80
|
"registry": "https://registry.npmjs.org/"
|
|
81
|
+
},
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"@deepseek-ai/schemastery": "3.19.0"
|
|
80
84
|
}
|
|
81
85
|
}
|