@jcy2387/dsh-conversation-ui 0.1.0-rc.12

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.
Files changed (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +123 -0
  3. package/README.md +123 -0
  4. package/conversation-ui-off.yml +3 -0
  5. package/cordis.patch.yml +10 -0
  6. package/lib/client.js +3672 -0
  7. package/lib/client.js.map +1 -0
  8. package/lib/index.js +302 -0
  9. package/package.json +182 -0
  10. package/src/boot-config.ts +28 -0
  11. package/src/client/AnimatedDisclosure.tsx +89 -0
  12. package/src/client/ConversationCard.module.css +253 -0
  13. package/src/client/ConversationCard.tsx +122 -0
  14. package/src/client/DeliverablesCard.module.css +187 -0
  15. package/src/client/DeliverablesCard.tsx +142 -0
  16. package/src/client/FollowHost.tsx +25 -0
  17. package/src/client/ToolActivityGroup.tsx +341 -0
  18. package/src/client/TurnPreludeUserNodeView.tsx +258 -0
  19. package/src/client/TurnProcessMember.tsx +92 -0
  20. package/src/client/TypewriterAssistantNodeView.module.css +1260 -0
  21. package/src/client/TypewriterAssistantNodeView.tsx +390 -0
  22. package/src/client/TypewriterToolNodeView.tsx +916 -0
  23. package/src/client/conversation-ui-card-controller.ts +162 -0
  24. package/src/client/conversation-ui-settings-api.ts +65 -0
  25. package/src/client/deliverables.ts +263 -0
  26. package/src/client/index.ts +242 -0
  27. package/src/client/locales.ts +74 -0
  28. package/src/client/teleprompterGlide.ts +590 -0
  29. package/src/client/turnElapsed.ts +27 -0
  30. package/src/client/turnProcessFold.ts +224 -0
  31. package/src/client/useConversationContent.ts +471 -0
  32. package/src/client/useFpsGuard.ts +84 -0
  33. package/src/config.ts +44 -0
  34. package/src/css-modules.d.ts +9 -0
  35. package/src/index.ts +2 -0
  36. package/src/package-meta.ts +39 -0
  37. package/src/plugin.ts +155 -0
  38. package/src/profile-installation.ts +121 -0
  39. package/src/settings-api.ts +33 -0
  40. package/src/settings.ts +30 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-codex-suite contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,123 @@
1
+ # @jcy2387/dsh-conversation-ui
2
+
3
+ [![CI](https://github.com/DamonBao/dsh-codex-suite/actions/workflows/ci.yml/badge.svg)](https://github.com/DamonBao/dsh-codex-suite/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+
6
+ English | [简体中文](README.md)
7
+
8
+ A Codex-style conversation UI enhancement plugin for DeepSeek Harness (DSH): the Web chat is re-rendered as one ordered event stream — process updates, thinking, tool activity, retries, workflows, and the final answer appear in the order they happened, while viewport follow stays smooth. This package is the Conversation UI package of the [DSH Codex Suite](../../README.md) monorepo.
9
+
10
+ **The package is fully independent from the Codex Provider** and can be installed alone to enhance conversations with any model.
11
+
12
+ ## Features
13
+
14
+ ### Event stream and turn structure
15
+
16
+ - **Instant turn feedback:** an elapsed timer and a thinking placeholder appear the moment you submit — no more staring at a blank screen.
17
+ - **Process vs. answer:** each turn's process content (Think, tools, retries…) is grouped into its own section; once the final answer lands successfully, the process section **auto-collapses** and stays expandable by hand.
18
+ - **Natural ordering:** Think, Tool, Retry, Workflow, Compaction, Command, and context-injection rows keep their real order instead of being regrouped away.
19
+
20
+ ### Semantic tool activity
21
+
22
+ - Search, file read, edit, shell, database, web, skill, and agent tools each render a distinct icon, so the activity stream is scannable at a glance; groups collapse and expand.
23
+
24
+ ### Two streaming reveal modes
25
+
26
+ | Mode | Behavior |
27
+ | --- | --- |
28
+ | `teleprompter` (default) | Content appears as instant snapshots that glide smoothly upward — read it like a teleprompter. |
29
+ | `typewriter` | Progressive reveal by grapheme cluster, safe for CJK text and emoji. |
30
+
31
+ - Three smoothing presets: `realtime` (snappier), `balanced` (default), `silky` (extra smooth). Presets shape the reveal cadence — EMA-smoothed arrival rate, buffer targets, catch-up ceilings, and the settle drain after the input idles — so long replies never dump whole paragraphs at once and fast streams never stutter.
32
+ - `typewriter` mode also exposes a fixed reveal rate via `revealCharsPerSec`.
33
+
34
+ ### Smart viewport follow
35
+
36
+ - New content is followed smoothly within speed bounds: at least `scrollSpeedPxPerSec`, at most `maxScrollSpeedPxPerSec` (a large lag never teleports).
37
+ - Scrolling upward to read **releases the follow**; returning to the bottom resumes it.
38
+ - Respects `prefers-reduced-motion`; when the frame rate degrades, an FPS guard skips DOM commits for offscreen replies so visible frames stay fluid.
39
+
40
+ ### Deliverables card
41
+
42
+ - Every finished turn ends with a **deliverables** card: produced files and websites with added/removed line counts.
43
+
44
+ ### Plugin settings card
45
+
46
+ - A durable **Auto-expand thinking** toggle in *Settings → Plugins → Plugin configuration* (live; no restart needed).
47
+ - The card also shows the current version and installation kind (npm / local development); npm installs get a one-click update action (restart required after updating).
48
+ - Localized in Chinese and English.
49
+
50
+ ## Install
51
+
52
+ Published package:
53
+
54
+ ```sh
55
+ dsh plugin --profile web add @jcy2387/dsh-conversation-ui
56
+ dsh web
57
+ ```
58
+
59
+ Local development copy:
60
+
61
+ ```sh
62
+ dsh plugin --profile web add link:/path/to/dsh-codex-suite/packages/conversation-ui
63
+ dsh web
64
+ ```
65
+
66
+ Alternatively install the [`@jcy2387/dsh-suite`](../all/README.md) bundle to enable both the Codex Provider and this plugin.
67
+
68
+ No further steps are needed: the event-stream renderer activates automatically for new conversations, and existing sessions are untouched.
69
+
70
+ ## Configuration
71
+
72
+ Profile patch ID: `conversation-ui`. Set values in the profile's `cordis.patch.yml` overlay (the suite bundle defaults to `mode: teleprompter`, `preset: balanced`).
73
+
74
+ | Option | Range | Default | Notes |
75
+ | --- | --- | --- | --- |
76
+ | `mode` | `teleprompter` \| `typewriter` | `teleprompter` | Reveal style of assistant content. |
77
+ | `preset` | `realtime` \| `balanced` \| `silky` | `balanced` | Smoothing cadence preset. |
78
+ | `revealCharsPerSec` | 5–200 | `80` | Fixed reveal rate for `typewriter` mode. |
79
+ | `scrollSpeedPxPerSec` | 1–200 | `48` | Minimum viewport-follow speed. |
80
+ | `maxScrollSpeedPxPerSec` | 1–2000 | `1000` | Follow speed ceiling; prevents teleporting after a large lag. |
81
+
82
+ Overlay example:
83
+
84
+ ```yaml
85
+ - id: conversation-ui
86
+ name: '@jcy2387/dsh-conversation-ui'
87
+ config:
88
+ mode: typewriter
89
+ preset: silky
90
+ revealCharsPerSec: 60
91
+ ```
92
+
93
+ User preferences such as *Auto-expand thinking* do not go through the overlay: change them in **Settings → Plugins → Plugin configuration** — they apply immediately and persist across restarts.
94
+
95
+ ### Temporarily disable
96
+
97
+ The package ships a [`conversation-ui-off.yml`](conversation-ui-off.yml) overlay that disables the plugin (restoring the stock chat renderer) without uninstalling it:
98
+
99
+ ```yaml
100
+ - id: conversation-ui
101
+ disabled: true
102
+ ```
103
+
104
+ ## Architecture
105
+
106
+ The package ships two halves that cooperate over one very narrow config channel:
107
+
108
+ - **Host half** (`src/`): a Cordis plugin. It validates the config schema, injects the validated value into every served index HTML (the boot global `window.__DSH_CONVERSATION_UI_CONFIG__`), and registers the user-settings namespace plus a loopback-only settings RPC (read/write preferences, report installation kind, trigger an npm update).
109
+ - **Web half** (`src/client/`): React views. It registers at low priority to shadow the `assistant-step` node view with the Codex-style presentation, wraps every other growing chat row (tool cards, retries, workflows…) in place so they share the follow engine, adds the turn-tail deliverables card, and mounts the plugin configuration card in Settings. The stream still renders with defaults when locale, connection, or the settings service is absent.
110
+
111
+ ## Development
112
+
113
+ ```sh
114
+ pnpm --filter @jcy2387/dsh-conversation-ui typecheck
115
+ pnpm --filter @jcy2387/dsh-conversation-ui test
116
+ pnpm --filter @jcy2387/dsh-conversation-ui build
117
+ ```
118
+
119
+ Tests run on vitest + Testing Library, covering the stream-smoothing hook, follow and folding behavior, and the settings card (both client and host sides). See the [monorepo README](../../README.md) for workspace-wide commands.
120
+
121
+ ## License
122
+
123
+ [MIT](LICENSE) © jcy2387
package/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # @jcy2387/dsh-conversation-ui
2
+
3
+ [![CI](https://github.com/DamonBao/dsh-codex-suite/actions/workflows/ci.yml/badge.svg)](https://github.com/DamonBao/dsh-codex-suite/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+
6
+ [English](README.en.md) | 简体中文
7
+
8
+ DeepSeek Harness(DSH)的 Codex 风格对话界面增强插件:把 Web 对话重绘为一条有序事件流 —— 过程答复、思考、Tool 活动、重试、工作流与最终答复按发生顺序呈现,同时保持平滑的视口跟随。本包是 [DSH Codex Suite](../../README.zh.md) Monorepo 的对话 UI 包。
9
+
10
+ **本包与 Codex Provider 完全独立**,可以单独安装并服务任意模型。
11
+
12
+ ## 功能
13
+
14
+ ### 事件流与 Turn 组织
15
+
16
+ - **Turn 开始即反馈:** 提交后立刻显示处理计时器和「思考中」占位,不再对着空白等待。
17
+ - **过程与结论分离:** 每个 Turn 的过程内容(Think、Tool、重试等)归入独立过程区;最终答复成功落地后过程区**自动折叠**,需要时可手动展开。
18
+ - **自然顺序保持:** Think、Tool、Retry、Workflow、Compaction、Command 和上下文注入按真实发生顺序排列,不会被分组打散。
19
+
20
+ ### 语义化 Tool 活动
21
+
22
+ - 搜索、文件读取、编辑、命令、数据库、网页、技能、Agent 等工具各有专属图标,活动流一眼可扫;工具组可折叠/展开。
23
+
24
+ ### 两种流式揭示模式
25
+
26
+ | 模式 | 行为 |
27
+ | --- | --- |
28
+ | `teleprompter`(默认) | 内容即时快照呈现,整段向上平滑滑动,像提词器一样阅读。 |
29
+ | `typewriter` | 按字素(grapheme)渐进揭示,对中文、emoji 等宽字符安全。 |
30
+
31
+ - 三档平滑预设:`realtime`(更跟手)、`balanced`(默认)、`silky`(更绵密)。预设控制揭示节奏曲线:到达速率的 EMA 平滑、缓冲目标、追速上限和停顿后的收尾排空速度,让长回复不会整段砸出、快流不会卡顿。
32
+ - `typewriter` 模式另有固定揭示速度 `revealCharsPerSec` 可调。
33
+
34
+ ### 智能视口跟随
35
+
36
+ - 新内容以限速平滑跟随:最低 `scrollSpeedPxPerSec`、最高 `maxScrollSpeedPxPerSec`(大滞后不瞬移)。
37
+ - 用户向上滚动阅读时**自动释放跟随**,回到底部后恢复。
38
+ - 尊重 `prefers-reduced-motion`;帧率退化时暂停离屏内容的 DOM 提交(FPS 守卫),保住可见帧的流畅。
39
+
40
+ ### 产物卡片
41
+
42
+ - 每个完成的 Turn 尾部列出**产物**:生成的文件与站点,附增删行数,产出成果一目了然。
43
+
44
+ ### 插件设置卡片
45
+
46
+ - 在 **设置 → 插件 → 插件配置** 中提供持久化的「自动展开思考」开关(实时生效,无需重启)。
47
+ - 卡片同时显示当前版本与安装形态(npm / 本地开发),npm 安装支持一键更新(更新后需重启)。
48
+ - 界面中英文本地化。
49
+
50
+ ## 安装
51
+
52
+ 已发布版本:
53
+
54
+ ```sh
55
+ dsh plugin --profile web add @jcy2387/dsh-conversation-ui
56
+ dsh web
57
+ ```
58
+
59
+ 本地开发版本:
60
+
61
+ ```sh
62
+ dsh plugin --profile web add link:/path/to/dsh-codex-suite/packages/conversation-ui
63
+ dsh web
64
+ ```
65
+
66
+ 也可以安装 [`@jcy2387/dsh-suite`](../all/README.md) 组合包,一次启用 Codex Provider 与本插件。
67
+
68
+ 安装后无需任何操作:发起新对话即自动启用事件流渲染,历史会话不受影响。
69
+
70
+ ## 配置
71
+
72
+ Profile patch ID:`conversation-ui`。在 profile 的 `cordis.patch.yml` overlay 中设置(组合包默认值为 `mode: teleprompter`、`preset: balanced`)。
73
+
74
+ | 选项 | 范围 | 默认 | 说明 |
75
+ | --- | --- | --- | --- |
76
+ | `mode` | `teleprompter` \| `typewriter` | `teleprompter` | 助手内容的揭示模式。 |
77
+ | `preset` | `realtime` \| `balanced` \| `silky` | `balanced` | 平滑节奏预设。 |
78
+ | `revealCharsPerSec` | 5–200 | `80` | `typewriter` 模式的固定揭示速度。 |
79
+ | `scrollSpeedPxPerSec` | 1–200 | `48` | 视口跟随的最低速度。 |
80
+ | `maxScrollSpeedPxPerSec` | 1–2000 | `1000` | 视口跟随的速度上限。 |
81
+
82
+ Overlay 示例:
83
+
84
+ ```yaml
85
+ - id: conversation-ui
86
+ name: '@jcy2387/dsh-conversation-ui'
87
+ config:
88
+ mode: typewriter
89
+ preset: silky
90
+ revealCharsPerSec: 60
91
+ ```
92
+
93
+ 「自动展开思考」等用户偏好不走 overlay:在 **设置 → 插件 → 插件配置** 中修改,保存即生效并跨重启持久化。
94
+
95
+ ### 临时禁用
96
+
97
+ 包内自带 [`conversation-ui-off.yml`](conversation-ui-off.yml) overlay,可在不卸载包的情况下禁用插件(回到原生对话渲染):
98
+
99
+ ```yaml
100
+ - id: conversation-ui
101
+ disabled: true
102
+ ```
103
+
104
+ ## 架构
105
+
106
+ 本包由两半组成,通过一条极窄的配置通道协作:
107
+
108
+ - **Host 半**(`src/`):Cordis 插件。负责校验配置 schema,并把校验后的配置注入每个服务出的 index HTML(启动配置全局变量 `window.__DSH_CONVERSATION_UI_CONFIG__`);同时注册用户设置命名空间与一条仅限 loopback 的设置 RPC(读取/写入偏好、查询安装形态、触发 npm 更新)。
109
+ - **Web 半**(`src/client/`):React 视图。以低优先级注册替换 `assistant-step` 节点视图实现 Codex 风格助手呈现;其余增长的对话行(Tool 卡片、重试、工作流等)原位包装以共享跟随引擎;在 Turn 尾部注册产物卡片;并在设置页挂载插件配置卡片。缺少 locale / connection / 设置服务时仍以默认配置运行流式渲染。
110
+
111
+ ## 开发
112
+
113
+ ```sh
114
+ pnpm --filter @jcy2387/dsh-conversation-ui typecheck
115
+ pnpm --filter @jcy2387/dsh-conversation-ui test
116
+ pnpm --filter @jcy2387/dsh-conversation-ui build
117
+ ```
118
+
119
+ 测试基于 vitest + Testing Library,覆盖流式揭示 hook、跟随与折叠行为、设置卡片(客户端与 Host 两侧)。工作区级命令见 [Monorepo README](../../README.zh.md)。
120
+
121
+ ## 许可证
122
+
123
+ [MIT](LICENSE) © jcy2387
@@ -0,0 +1,3 @@
1
+ # Optional profile overlay: disable the Conversation UI plugin without removing it.
2
+ - id: conversation-ui
3
+ disabled: true
@@ -0,0 +1,10 @@
1
+ # Applied when this package appears in a profile's dsh.profile.bundles list.
2
+ - insert:
3
+ - id: conversation-ui
4
+ name: '@jcy2387/dsh-conversation-ui'
5
+ config:
6
+ mode: teleprompter
7
+ preset: balanced
8
+ revealCharsPerSec: 80
9
+ scrollSpeedPxPerSec: 48
10
+ maxScrollSpeedPxPerSec: 1000