dsh-genui 0.1.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 +64 -0
- package/README.zh-CN.md +66 -0
- package/cordis.patch.yml +8 -0
- package/lib/client.js +259139 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +6133 -0
- package/package.json +69 -0
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# dsh-genui
|
|
2
|
+
|
|
3
|
+
[中文文档](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Installable [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) **bundle**: GenUI system prompt + Vue card rendering for assistant `` ```schemaJson `` `` blocks.
|
|
6
|
+
|
|
7
|
+
Does **not** modify harness source. Uses Cordis slot shadowing (`conversation.chat.node` / `assistant-step` at `priority: -1`), same shape as other out-of-tree plugins (see harness [publish tutorial](../deepseek-harness/docs/user/develop/basic/publish.md)).
|
|
8
|
+
|
|
9
|
+
The web profile conversation UI is React. This plugin keeps that slot in React and hosts each card as a **light-DOM Web Component** (`<dsh-genui-card>`) whose internals are `@opentiny/genui-sdk-vue` + OpenTiny Vue materials.
|
|
10
|
+
|
|
11
|
+
## Dependencies
|
|
12
|
+
|
|
13
|
+
GenUI packages (`@opentiny/genui-sdk-*`, `@opentiny/tiny-schema-renderer`) are pinned in `devDependencies` and resolved from npm at build time. Built artifacts (`lib/index.js`, `lib/client.js`) **inline** GenUI + TinyVue so `dsh plugin add` does not need those packages in the profile.
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
Node.js + pnpm, and a `dsh` CLI that can boot `--profile web` (harness source: `pnpm dsh`, or an installed CLI).
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
dsh plugin --profile web add dsh-genui
|
|
23
|
+
dsh --profile web --dump-config # expect "# == dsh-genui"
|
|
24
|
+
dsh --profile web
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Local development (link a checkout instead of the registry package):
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
pnpm install && pnpm build && pnpm test
|
|
31
|
+
dsh plugin --profile web add /path/to/dsh-genui
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Remove:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
dsh plugin --profile web remove dsh-genui
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Behavior
|
|
41
|
+
|
|
42
|
+
| Half | Behavior |
|
|
43
|
+
|---|---|
|
|
44
|
+
| **Host** (`lib/index.js`) | `genPrompt('Vue', materialsMeta)` → `systemPrompt.section({ name: 'genui:cards' })` |
|
|
45
|
+
| **Client** (`lib/client.js`) | Shadows `assistant-step`; splits text on `` ```schemaJson `` ``; renders `<dsh-genui-card>` (Vue `GenuiRenderer`) |
|
|
46
|
+
|
|
47
|
+
Session log unchanged: schema stays inside assistant message text (model-visible ⟺ logged).
|
|
48
|
+
|
|
49
|
+
Vue is **inlined** in the client bundle (not a harness platform module). Custom-element props such as `customActions` are set from React via element properties (React 18 would stringify objects as attributes).
|
|
50
|
+
|
|
51
|
+
## Known limitations
|
|
52
|
+
|
|
53
|
+
- Shadows the **entire** assistant row; track upstream `AssistantNodeView` changes.
|
|
54
|
+
- Client bundle is large (~11MB uncompressed) because TinyVue + materials are inlined.
|
|
55
|
+
- GenUI prompt is long — keep the bundle opt-in.
|
|
56
|
+
- Peer APIs (`ui-primitives`, slots) come from the running web profile, not this package.
|
|
57
|
+
- Custom element uses **light DOM** (`shadowRoot: false`) so TinyVue teleports and theme CSS apply.
|
|
58
|
+
|
|
59
|
+
## Develop
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
pnpm test # splitAssistantText
|
|
63
|
+
pnpm build # regenerate lib/
|
|
64
|
+
```
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# dsh-genui
|
|
2
|
+
|
|
3
|
+
[English](README.md)
|
|
4
|
+
|
|
5
|
+
可安装的 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) **插件包**:GenUI 系统提示词 + 对助手消息中 `` ```schemaJson `` `` 代码块的 Vue 卡片渲染。
|
|
6
|
+
|
|
7
|
+
**不修改** Harness 源码。通过 Cordis 插槽遮蔽(`conversation.chat.node` / `assistant-step`,`priority: -1`)接入,形态与其他仓库外插件一致(参见 Harness [发布教程](../deepseek-harness/docs/user/develop/basic/publish.md))。
|
|
8
|
+
|
|
9
|
+
Web profile 的对话 UI 基于 React。本插件保留该插槽的 React 实现,并将每张卡片托管为 **light DOM Web Component**(`<dsh-genui-card>`),内部使用 `@opentiny/genui-sdk-vue` 与 OpenTiny Vue 物料。
|
|
10
|
+
|
|
11
|
+
## 依赖说明
|
|
12
|
+
|
|
13
|
+
GenUI 相关包(`@opentiny/genui-sdk-*`、`@opentiny/tiny-schema-renderer`)在 `devDependencies` 中固定版本,构建时从 npm 安装。产物(`lib/index.js`、`lib/client.js`)会**内联** GenUI 与 TinyVue,因此 `dsh plugin add` 后 profile 无需再安装这些包。
|
|
14
|
+
|
|
15
|
+
## 前置条件
|
|
16
|
+
|
|
17
|
+
Node.js + pnpm,以及能启动 `--profile web` 的 `dsh` CLI(Harness 源码中可用 `pnpm dsh`,或已全局安装的 CLI)。
|
|
18
|
+
|
|
19
|
+
## 安装
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
dsh plugin --profile web add dsh-genui
|
|
23
|
+
dsh --profile web --dump-config # 应出现 "# == dsh-genui"
|
|
24
|
+
dsh --profile web
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
本地开发(用本地目录代替 registry 包):
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
pnpm install && pnpm build && pnpm test
|
|
31
|
+
dsh plugin --profile web add /path/to/dsh-genui
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
卸载:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
dsh plugin --profile web remove dsh-genui
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 行为说明
|
|
41
|
+
|
|
42
|
+
| 部分 | 行为 |
|
|
43
|
+
|---|---|
|
|
44
|
+
| **Host**(`lib/index.js`) | `genPrompt('Vue', materialsMeta)` → `systemPrompt.section({ name: 'genui:cards' })` |
|
|
45
|
+
| **Client**(`lib/client.js`) | 遮蔽 `assistant-step`;按 `` ```schemaJson `` `` 切分文本;渲染 `<dsh-genui-card>`(Vue `GenuiRenderer`) |
|
|
46
|
+
|
|
47
|
+
会话日志不变:schema 仍保留在助手消息文本内(模型可见 ⟺ 已记录)。
|
|
48
|
+
|
|
49
|
+
Vue **内联**在 client bundle 中(非 Harness 平台模块)。`customActions` 等自定义元素属性由 React 通过 element properties 设置(React 18 若走 attribute 会把对象序列化为字符串)。
|
|
50
|
+
|
|
51
|
+
## 已知限制
|
|
52
|
+
|
|
53
|
+
- 遮蔽**整条**助手消息行;需关注上游 `AssistantNodeView` 变更。
|
|
54
|
+
- Client bundle 体积较大(未压缩约 11MB),因内联了 TinyVue 与物料。
|
|
55
|
+
- GenUI 提示词较长——建议保持该 bundle 为可选安装。
|
|
56
|
+
- Peer API(`ui-primitives`、插槽等)来自运行中的 web profile,非本包提供。
|
|
57
|
+
- 自定义元素使用 **light DOM**(`shadowRoot: false`),以便 TinyVue teleport 与主题 CSS 生效。
|
|
58
|
+
|
|
59
|
+
## 开发
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
pnpm test # splitAssistantText
|
|
63
|
+
pnpm build # 重新生成 lib/
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
更多场景与效果说明见 [docs/promotion.md](docs/promotion.md)。
|