@prettier-ai/dsh-client-ui-renderer 0.1.2-alpha.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/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +104 -0
- package/README.zh.md +104 -0
- package/lib/client.js +1449 -0
- package/lib/index.js +6 -0
- package/lib/invariant.js +34 -0
- package/lib/types/client/app.d.ts +18 -0
- package/lib/types/client/bind.d.ts +11 -0
- package/lib/types/client/bindings.d.ts +53 -0
- package/lib/types/client/index.d.ts +38 -0
- package/lib/types/client/registry.d.ts +222 -0
- package/lib/types/client/scoped-slots.d.ts +9 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/invariant.d.ts +16 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
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.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/client/ui-renderer/README.md
|
|
5
|
+
README.md: 1069a86d27e2bed71078e29c890bec150e32e82a
|
|
6
|
+
README.zh.md: b2d5002d214b726e4c864b501137f8c071c6d9f7
|
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Browser UI renderer: React slot bindings, ctx.uiRenderer, and the assembled application root for the dsh web client."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-client-ui-renderer
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
`dsh-client-ui-renderer` mounts the assembled dsh web client GUI: after the complete client plugin roster settles, the boot kernel calls `ctx.uiRenderer.mount(container)`, which hydrates the framework-free boot page and switches to the full React application before the next paint. Business plugins stay plain React components that receive session and workspace data through typed props and never wire subscriptions themselves — the renderer binds the runtime's bare observable sources into selector hooks at the slot outlets. The web shell and the boot kernel are its only direct consumers, so a composition needs it exactly when it wants a React-rendered GUI.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
18
|
+
- [Further Exploration](#further-exploration)
|
|
19
|
+
- [Model Experience](#model-experience)
|
|
20
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
21
|
+
- [Dev Note](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## Use this package
|
|
27
|
+
|
|
28
|
+
This package is infrastructure: the web shell and the boot kernel are its only direct consumers. A composition needs it whenever it wants a React-rendered GUI — `dsh-client-web` loads the roster, waits for every entry to activate, then calls `ctx.uiRenderer.mount(container)`.
|
|
29
|
+
|
|
30
|
+
### What mounting does
|
|
31
|
+
|
|
32
|
+
`mount(container)` installs the slot renderer, hydrates the existing boot DOM when present, renders the assembled application into the container before the next paint, and returns a disposer that unmounts the React root. The renderer performs the sole context-level `renderSlot('root')` call; the registered root occupant owns product layout and document metadata.
|
|
33
|
+
|
|
34
|
+
### For business plugins
|
|
35
|
+
|
|
36
|
+
A business plugin registers a component through the slot system; the renderer binds the runtime's session and workspace observable sources into selector hooks at the outlet. The plugin receives the standard session props (session id, conversation snapshot hooks) through its composed props — it never imports the renderer or touches React internals.
|
|
37
|
+
|
|
38
|
+
-----
|
|
39
|
+
|
|
40
|
+
<a id="understand-the-implementation"></a>
|
|
41
|
+
## Understand the implementation
|
|
42
|
+
|
|
43
|
+
<details>
|
|
44
|
+
<summary>Implementation internals — click to expand</summary>
|
|
45
|
+
|
|
46
|
+
The package realizes one boundary: the object layer (runtime, React-free) owns business state; this renderer is the only place ctx-to-React integration happens — slot renderer, `SessionProvider`, and the `useSyncExternalStore` adapter.
|
|
47
|
+
|
|
48
|
+
### Activation and mount
|
|
49
|
+
|
|
50
|
+
The plugin activates after `slots`, `sessions`, and `layout`; it installs `createSlotRenderer()` and reflects the `uiRenderer` service. `mountApp` looks for the boot kernel's `[data-dsh-boot]` element: when present it hydrates through `BootHandoff` (a one-frame pass-through that preserves the loading DOM), otherwise it creates a fresh root and flushes the render synchronously.
|
|
51
|
+
|
|
52
|
+
### Slot bindings
|
|
53
|
+
|
|
54
|
+
`createSlotRenderer` connects the slot registry to React: entry lists become reactive sources, and each outlet renders through the installed renderer. Business plugins pass bare observable sources through typed slot `hooks`; the renderer binds them at the outlet via the uSES adapter.
|
|
55
|
+
|
|
56
|
+
### Identity
|
|
57
|
+
|
|
58
|
+
React, React DOM, Cordis, ui-slots, and ui-primitives retain one browser identity through the web shell's static module table; this package arrives as a dynamic client bundle.
|
|
59
|
+
|
|
60
|
+
</details>
|
|
61
|
+
|
|
62
|
+
-----
|
|
63
|
+
|
|
64
|
+
<a id="further-exploration"></a>
|
|
65
|
+
## Further Exploration
|
|
66
|
+
|
|
67
|
+
These pages cover the surrounding machinery and the composition model.
|
|
68
|
+
|
|
69
|
+
- [ui-slots](../ui-slots/README.md) — the slot registry pure core this renderer binds to React.
|
|
70
|
+
- [web](../web/README.md) — the shell that loads the roster and calls `mount`.
|
|
71
|
+
- [ui-session](../ui-session/README.md) — the adapter that supplies the standard Session sources and hooks this renderer binds.
|
|
72
|
+
- [Web client architecture](../../../.agents/notes/implemented/architecture/2026-07-19-gui-web-client-architecture.md) — the loading chain, object layer, and layering red lines.
|
|
73
|
+
- [Slot system standard](../../../.agents/notes/implemented/architecture/2026-07-22-slot-type-chain-implementation.md) — the definitive composition model.
|
|
74
|
+
|
|
75
|
+
-----
|
|
76
|
+
|
|
77
|
+
<a id="model-experience"></a>
|
|
78
|
+
## Model Experience
|
|
79
|
+
|
|
80
|
+
None, as the package is a browser-side render assembly that registers nothing model-facing.
|
|
81
|
+
|
|
82
|
+
#### KV Cache effect
|
|
83
|
+
|
|
84
|
+
None; this package neither assembles nor sends a provider request.
|
|
85
|
+
|
|
86
|
+
## Known Limitations and Deferred Work
|
|
87
|
+
|
|
88
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
These limits define when the application frame appears and how far per-region readiness goes; they are current package constraints.
|
|
92
|
+
|
|
93
|
+
- **The first application frame waits for every client entry** — the boot kernel hands over the mount point only after the loader roster settles; per-region readiness remains deferred.
|
|
94
|
+
- **Slot rendering has no Suspense integration or per-entry lazy loading** — the complete plugin roster settles before the renderer mounts the root.
|
|
95
|
+
|
|
96
|
+
<a id="dev-note"></a>
|
|
97
|
+
### Dev Note
|
|
98
|
+
|
|
99
|
+
<details>
|
|
100
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
101
|
+
|
|
102
|
+
None.
|
|
103
|
+
|
|
104
|
+
</details>
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "浏览器 UI 渲染器:React slot 绑定、ctx.uiRenderer 与 dsh Web 客户端组装后应用的应用根。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-client-ui-renderer
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
`dsh-client-ui-renderer` 挂载组装完成的 dsh Web 客户端 GUI:完整客户端插件名册稳定后,启动内核调用 `ctx.uiRenderer.mount(container)`,它会 hydrate 不依赖框架的启动页,并在下一次绘制前切换到完整的 React 应用。业务插件仍是接收类型化 props 的普通 React 组件,通过 props 获取会话与 Workspace 数据,永远不需要自行接线订阅——渲染器在 slot outlet 处把运行时的裸 observable source 绑定为 selector 钩子。Web 外壳与启动内核是它仅有的直接消费方,因此只要组合需要 React 渲染的 GUI,就需要它。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用本包](#use-this-package)
|
|
17
|
+
- [理解实现](#understand-the-implementation)
|
|
18
|
+
- [进一步探索](#further-exploration)
|
|
19
|
+
- [模型体验](#model-experience)
|
|
20
|
+
- [已知限制与延期工作](#known-limitations-and-deferred-work)
|
|
21
|
+
- [开发备注](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## 使用本包
|
|
27
|
+
|
|
28
|
+
本包属于基础设施:Web 外壳与启动内核是它仅有的直接消费方。只要组合需要 React 渲染的 GUI,就需要它——`dsh-client-web` 加载名册,等待每个 entry 激活,然后调用 `ctx.uiRenderer.mount(container)`。
|
|
29
|
+
|
|
30
|
+
### 挂载做什么
|
|
31
|
+
|
|
32
|
+
`mount(container)` 会安装 slot 渲染器、在存在时 hydrate 现有启动 DOM、在下一次绘制前把组装后的应用渲染进容器,并返回一个卸载 React 根的 disposer。渲染器执行全程序唯一一次上下文级 `renderSlot('root')` 调用;注册的根占用方拥有产品布局与文档元数据。
|
|
33
|
+
|
|
34
|
+
### 对业务插件
|
|
35
|
+
|
|
36
|
+
业务插件通过 slot 系统注册组件;渲染器在 outlet 处把运行时的会话与 Workspace observable source 绑定为 selector 钩子。插件通过其组合 props 收到标准会话 props(session id、对话快照钩子)——它绝不导入渲染器,也不触碰 React 内部机制。
|
|
37
|
+
|
|
38
|
+
-----
|
|
39
|
+
|
|
40
|
+
<a id="understand-the-implementation"></a>
|
|
41
|
+
## 理解实现
|
|
42
|
+
|
|
43
|
+
<details>
|
|
44
|
+
<summary>实现细节——点击展开</summary>
|
|
45
|
+
|
|
46
|
+
本包实现一条边界:对象层(runtime,无 React)拥有业务状态;这里是 ctx 到 React 集成唯一发生的位置——slot 渲染器、`SessionProvider` 与 `useSyncExternalStore` 适配器。
|
|
47
|
+
|
|
48
|
+
### 激活与挂载
|
|
49
|
+
|
|
50
|
+
插件在 `slots`、`sessions` 与 `layout` 就绪后激活;它安装 `createSlotRenderer()` 并 reflect `uiRenderer` 服务。`mountApp` 会查找启动内核的 `[data-dsh-boot]` 元素:存在时经 `BootHandoff`(一个保留加载 DOM 的单帧透传)hydrate,否则创建全新 root 并同步 flush 渲染。
|
|
51
|
+
|
|
52
|
+
### Slot 绑定
|
|
53
|
+
|
|
54
|
+
`createSlotRenderer` 把 slot 注册表连接到 React:条目列表成为响应式 source,每个 outlet 经已安装的渲染器渲染。业务插件通过带类型的 slot `hooks` 传递裸 observable source;渲染器经 uSES 适配器在 outlet 处完成绑定。
|
|
55
|
+
|
|
56
|
+
### 身份
|
|
57
|
+
|
|
58
|
+
React、React DOM、Cordis、ui-slots 与 ui-primitives 通过 Web 外壳的静态模块表保持同一浏览器身份;本包则以动态客户端 bundle 到达。
|
|
59
|
+
|
|
60
|
+
</details>
|
|
61
|
+
|
|
62
|
+
-----
|
|
63
|
+
|
|
64
|
+
<a id="further-exploration"></a>
|
|
65
|
+
## 进一步探索
|
|
66
|
+
|
|
67
|
+
以下页面覆盖周边机制与组合模型。
|
|
68
|
+
|
|
69
|
+
- [ui-slots](../ui-slots/README.zh.md)——本渲染器绑定到 React 的 slot 注册表纯核心。
|
|
70
|
+
- [web](../web/README.zh.md)——加载名册并调用 `mount` 的外壳。
|
|
71
|
+
- [ui-session](../ui-session/README.zh.md)——提供本渲染器所绑定标准 Session source 与 hook 的适配器。
|
|
72
|
+
- [Web 客户端架构](../../../.agents/notes/implemented/architecture/2026-07-19-gui-web-client-architecture.zh.md)——加载链、对象层与分层红线。
|
|
73
|
+
- [slot 系统标准](../../../.agents/notes/implemented/architecture/2026-07-22-slot-type-chain-implementation.zh.md)——权威组合模型。
|
|
74
|
+
|
|
75
|
+
-----
|
|
76
|
+
|
|
77
|
+
<a id="model-experience"></a>
|
|
78
|
+
## 模型体验
|
|
79
|
+
|
|
80
|
+
无。该包是浏览器端渲染组装层,不注册任何面向模型的内容。
|
|
81
|
+
|
|
82
|
+
#### KV Cache 影响
|
|
83
|
+
|
|
84
|
+
无;该包既不组装也不发送提供方请求。
|
|
85
|
+
|
|
86
|
+
## 已知限制与延期工作
|
|
87
|
+
|
|
88
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
这些限制说明应用首帧何时出现、按区域就绪能走多远;它们是当前包约束。
|
|
92
|
+
|
|
93
|
+
- **应用首帧会等待全部客户端 entry**:启动内核只在 loader 名册稳定后交出挂载点;按区域就绪仍属暂缓事项。
|
|
94
|
+
- **slot 渲染没有 Suspense 集成或逐 entry 惰性加载**:完整插件名册稳定后,渲染器才挂载根节点。
|
|
95
|
+
|
|
96
|
+
<a id="dev-note"></a>
|
|
97
|
+
### 开发备注
|
|
98
|
+
|
|
99
|
+
<details>
|
|
100
|
+
<summary>维护者的工作上下文——点击展开</summary>
|
|
101
|
+
|
|
102
|
+
无。
|
|
103
|
+
|
|
104
|
+
</details>
|