dsh-prompt-predict 0.2.2 → 0.2.3

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 CHANGED
@@ -6,14 +6,27 @@ All notable changes to this project are documented here. The format follows
6
6
 
7
7
  [中文](CHANGELOG_zh.md)
8
8
 
9
+ ## [0.2.3] — 2026-10-18
10
+
9
11
  ### Fixed
10
12
 
11
- - **The suggestion is now an in-dock row instead of a fixed overlay.** DSH `0.2.1-rc.2` stopped
12
- exposing the composer draft through the slot's `useInput`, so the overlay kept showing while
13
- typing; and because it was positioned from `getBoundingClientRect` it vanished whenever that
14
- measurement failed. The row lives in `conversation.composer.dock` — space the host allocates —
15
- and hides on the first printable keypress, which needs no draft state.
16
- - Verified on DSH `0.2.1-rc.2`.
13
+ - **The suggestion is visible again.** `0.2.2` drew it as a row inside `conversation.composer.dock`;
14
+ the row rendered in tests and `Tab` accepted it, but it was **invisible in the real app**, so
15
+ rendering went back to the original overlay.
16
+ - **The ghost text disappears as soon as you start typing.** DSH `0.2.1-rc.2` stopped exposing the
17
+ composer draft through the slot's `useInput` (it now returns the Lexical input state), so the
18
+ overlay stayed on screen and sat on top of what you were writing. It now hides on the first
19
+ printable keypress, which needs no draft state at all, and comes back with the next prediction.
20
+ - Verified end to end on DSH `0.2.1-rc.2`: the suggestion appears after a reply, and the first
21
+ keystroke removes it.
22
+
23
+ ## [0.2.2] — 2026-10-18 (deprecated)
24
+
25
+ ### Changed
26
+
27
+ - The suggestion was drawn as a row inside `conversation.composer.dock` instead of a fixed overlay.
28
+ **Deprecated:** that row turned out not to be visible in the real app. Use `0.2.3` instead.
29
+
17
30
 
18
31
  ## [0.2.1] — 2026-10-17
19
32
 
package/CHANGELOG_zh.md CHANGED
@@ -5,13 +5,24 @@
5
5
 
6
6
  [English](CHANGELOG.md)
7
7
 
8
+ ## [0.2.3] — 2026-10-18
9
+
8
10
  ### 修复
9
11
 
10
- - **建议改为在 composer dock 内的一行,不再用 fixed 覆盖层。** DSH `0.2.1-rc.2` 不再通过 slot 的
11
- `useInput` 暴露草稿,覆盖层会在打字时继续显示;而它靠 `getBoundingClientRect` 定位,一旦算不出
12
- 坐标就整个消失。新实现放在 `conversation.composer.dock`(宿主分配好的空间),并在第一个可打印
13
- 按键时隐藏——不依赖草稿状态。
14
- - 已在 DSH `0.2.1-rc.2` 上验证。
12
+ - **建议重新可见。** `0.2.2` 把它画成 `conversation.composer.dock` 里的一行;这一行在测试里能渲染、
13
+ `Tab` 也能采纳,但在**真实 app 里看不见**,所以渲染退回原来的覆盖层。
14
+ - **一开始打字,ghost 提示就消失。** DSH `0.2.1-rc.2` 不再通过 slot 的 `useInput` 暴露草稿
15
+ (现在返回的是 Lexical 输入态),覆盖层会一直留在屏幕上、压住你正在写的内容。现在改为在第一个
16
+ 可打印按键时隐藏——完全不依赖草稿状态——下一次预测到达时再出现。
17
+ - 已在 DSH `0.2.1-rc.2` 上端到端验证:回复结束后出现建议,第一个按键后消失。
18
+
19
+ ## [0.2.2] — 2026-10-18(已弃用)
20
+
21
+ ### 变更
22
+
23
+ - 建议改为画在 `conversation.composer.dock` 内的一行,不再是 fixed 覆盖层。
24
+ **已弃用:** 这一行在真实 app 里看不见。请使用 `0.2.3`。
25
+
15
26
 
16
27
  ## [0.2.1] — 2026-10-17
17
28
 
package/README.md CHANGED
@@ -57,7 +57,7 @@ The plugin is published on npm. Options are ordered by convenience.
57
57
  **Or the dsh CLI** — pin any published version with pnpm's `@version` syntax:
58
58
 
59
59
  ```bash
60
- dsh plugin --profile desktop add dsh-prompt-predict@0.2.1
60
+ dsh plugin --profile desktop add dsh-prompt-predict@0.2.3
61
61
  ```
62
62
 
63
63
  Replace `--profile` with your own profile (usually `desktop` on the desktop app, `web` for the web build), then **restart DSH**.
@@ -77,8 +77,8 @@ tarball that is on npm (`shasum` matches the registry), which is handy for offli
77
77
  pinning an artifact you can verify:
78
78
 
79
79
  ```bash
80
- gh release download v0.2.1 --repo ferrisching/dsh-prompt-predict --pattern '*.tgz'
81
- dsh plugin --profile desktop add ./dsh-prompt-predict-0.2.1.tgz
80
+ gh release download v0.2.3 --repo ferrisching/dsh-prompt-predict --pattern '*.tgz'
81
+ dsh plugin --profile desktop add ./dsh-prompt-predict-0.2.3.tgz
82
82
  ```
83
83
 
84
84
  Same caveat as the CLI route above: add `"dsh-prompt-predict"` to `dsh.profile.bundles` yourself,
@@ -188,7 +188,7 @@ For model selection, `provider` / `model` set to `auto` means "follow the sessio
188
188
  ```bash
189
189
  git clone https://github.com/ferrisching/dsh-prompt-predict.git
190
190
  cd dsh-prompt-predict
191
- npm test # 66 cases: 51 host-side + 15 client render smoke tests
191
+ npm test # 71 cases: 51 host-side + 20 client render smoke tests
192
192
  ```
193
193
 
194
194
  ```
@@ -203,7 +203,7 @@ npm test # 66 cases: 51 host-side + 15 client render smoke tests
203
203
  │ └── client.js Client: composer ghost-text overlay + settings page
204
204
  ├── test/
205
205
  │ ├── predict.mjs 51 cases: trimming, cleanup, route inheritance, settings validation, degrade-retry, dedup, bilingual errors, HTTP end-to-end
206
- │ └── client-render.mjs 15 cases: renders the ghost overlay and settings page through a tiny React stand-in, incl. both locales and dictionary self-checks
206
+ │ └── client-render.mjs 20 cases: renders the ghost overlay and settings page through a tiny React stand-in, incl. both locales and dictionary self-checks
207
207
  ├── scripts/
208
208
  │ └── install.sh One-shot install / upgrade
209
209
  ├── cordis.patch.yml Plugin mount patch
package/README_zh.md CHANGED
@@ -57,7 +57,7 @@
57
57
  **或者用 dsh CLI**——想装某个已发布版本就用 pnpm 的 `@版本` 语法:
58
58
 
59
59
  ```bash
60
- dsh plugin --profile desktop add dsh-prompt-predict@0.2.1
60
+ dsh plugin --profile desktop add dsh-prompt-predict@0.2.3
61
61
  ```
62
62
 
63
63
  `--profile` 换成你自己的 profile(桌面端一般是 `desktop`,Web 端是 `web`),**装完重启 DSH 生效**。
@@ -75,8 +75,8 @@ dsh plugin --profile desktop add dsh-prompt-predict@0.2.1
75
75
  **完全一致**的 tarball(`shasum` 与 registry 相同),适合离线机器或需要自行校验产物的场景:
76
76
 
77
77
  ```bash
78
- gh release download v0.2.1 --repo ferrisching/dsh-prompt-predict --pattern '*.tgz'
79
- dsh plugin --profile desktop add ./dsh-prompt-predict-0.2.1.tgz
78
+ gh release download v0.2.3 --repo ferrisching/dsh-prompt-predict --pattern '*.tgz'
79
+ dsh plugin --profile desktop add ./dsh-prompt-predict-0.2.3.tgz
80
80
  ```
81
81
 
82
82
  与上面 CLI 路径同样的注意点:请自己把 `"dsh-prompt-predict"` 加进 `dsh.profile.bundles`,
@@ -186,7 +186,7 @@ pnpm add /path/to/dsh-prompt-predict
186
186
  ```bash
187
187
  git clone https://github.com/ferrisching/dsh-prompt-predict.git
188
188
  cd dsh-prompt-predict
189
- npm test # 66 项:51 项 Host 端 + 15 项客户端渲染冒烟
189
+ npm test # 71 项:51 项 Host 端 + 20 项客户端渲染冒烟
190
190
  ```
191
191
 
192
192
  ```
@@ -201,7 +201,7 @@ npm test # 66 项:51 项 Host 端 + 15 项客户端渲染冒烟
201
201
  │ └── client.js 客户端:输入框 ghost text 覆盖层 + 设置页
202
202
  ├── test/
203
203
  │ ├── predict.mjs 51 项用例:文本裁剪、建议清洗、路由继承、设置校验、降级重试、去重、双语错误、接口端到端
204
- │ └── client-render.mjs 15 项用例:极简 React 替身渲染 ghost 覆盖层与设置页,含中英双语与词典自检
204
+ │ └── client-render.mjs 20 项用例:极简 React 替身渲染 ghost 覆盖层与设置页,含中英双语与词典自检
205
205
  ├── scripts/
206
206
  │ └── install.sh 一键安装 / 升级
207
207
  ├── cordis.patch.yml 插件挂载补丁
package/client/client.js CHANGED
@@ -513,37 +513,9 @@ window.__ModuleLoader__.load({
513
513
 
514
514
  // 建议直接以灰色 ghost text 覆盖在 Lexical 输入框首字符处。
515
515
  if (!enabled || dismissedByDraft.current || !visibleSuggestion) return null;
516
- // 在 composer dock 的流内渲染一行建议(不再用 fixed 覆盖层):
517
- // dock 是宿主分配了空间的位置,不依赖 findElement 算坐标,也不会压在草稿文字上。
518
- return h("div", {
519
- "data-prompt-predict-row": "true",
520
- role: "status",
521
- "aria-live": "polite",
522
- style: {
523
- display: "flex", alignItems: "center", gap: 8, minWidth: 0,
524
- padding: "2px 4px", fontSize: 12, lineHeight: "18px", color: "#9aa3b2",
525
- },
526
- },
527
- h("span", {
528
- style: { flex: 1, minWidth: 0, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" },
529
- }, visibleSuggestion),
530
- h("button", {
531
- type: "button", onClick: accept, title: tt(t, "ghost.acceptHint"),
532
- style: {
533
- flex: "none", padding: "0 7px", height: 19, borderRadius: 5,
534
- border: "1px solid var(--dsw-alias-border-l1, #d1d5db)", background: "var(--dsw-alias-bg-secondary, #f8fafc)",
535
- color: "#9aa3b2", fontSize: 10, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", cursor: "pointer",
536
- },
537
- }, "Tab"),
538
- h("button", {
539
- type: "button", onClick: reroll, title: tt(t, "ghost.reroll"),
540
- style: {
541
- flex: "none", width: 19, height: 19, padding: 0, borderRadius: 5,
542
- border: "1px solid var(--dsw-alias-border-l1, #d1d5db)", background: "var(--dsw-alias-bg-secondary, #f8fafc)",
543
- color: "#9aa3b2", fontSize: 11, lineHeight: 1, cursor: "pointer",
544
- },
545
- }, "↻"),
546
- h("span", { style: { flex: "none", fontSize: 10, whiteSpace: "nowrap" } }, tt(t, "ghost.dismiss")));
516
+ // 回到覆盖层:它在真实环境里是可见的(dock 内联行实测看不见)。
517
+ // 「打字即隐藏」由上面的 typedSince 信号负责,不再依赖草稿状态。
518
+ return h(GhostOverlay, { suggestion: visibleSuggestion, sessionId: sessionId, onAccept: accept, onReroll: reroll, t: t });
547
519
  }
548
520
 
549
521
  // ================= 设置页 =================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-prompt-predict",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "输入框提示词联想插件:助手回复结束后预测你的下一句话,以灰色 ghost text 浮在输入框里,Tab 采纳、Esc 忽略 | Codex-style composer prompt predictions for DeepSeek Harness: your next message ghosted into the composer, accepted with Tab.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",