Files
deepseek-harness/packages/client/ui-renderer/README.zh.md
T
imccyu 6e77ea0131 feat(web): boot past failed optional client plugins (#7733)
* feat(web): boot past failed optional client plugins

The Web client boot audit now follows Host startup strictness. An
inactive entry on the global required list (module system, Session
transport, renderer, application frame, Session view, and sidebar)
still rejects startup and the report marks the required entries.
Other inactive entries produce one console warning and the
application mounts without them. The boot page no longer draws a
failed entry before the audit decides.

* fix(web): audit boot entries whose creation rejects and name activation errors

ClientEntries.start() now logs a row whose Loader creation rejects, such
as a module that exports no plugin, and leaves it inactive for the boot
audit, as the Host Loader group does. The audit awaits only failed
fibers to report their recorded activation error. Notes, READMEs, and
the Web client subsystem page describe the browser boot audit; tests
cover invalid exports, carrier presentation of optional failures, and
required names absent from the boot graph.

* test(web): fail test carriers and e2e on inactive client entries

The product boot only warns about inactive entries outside its required
list, but tests must still surface every plugin that fails. TestClient
and createClientTest now require every roster entry to activate unless
a case passes allowInactiveEntries. The watchConsole tripwire, the
real-host smoke, and the assembled jsdom boot treat a web boot warning
as a failure with no opt-out.

Docs: the Web README names Session control, notes that an entry without
a fiber is reported as an import failure like the Host audit's "failed
to import", and the startup strictness note lists the browser tests.
2026-11-02 16:20:50 +00:00

5.7 KiB
Raw Blame History

description, kind
description kind
浏览器 UI 渲染器:普通 Slot 与可复用 Component Factory 的 React 绑定、ctx.uiRenderer 与组装后的 dsh Web 应用根。 package-reference

@deepseek-ai/dsh-client-ui-renderer

English | 中文

概述

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,就需要它。

目录


使用本包

本包属于基础设施:Web 外壳与启动内核是它仅有的直接消费方。只要组合需要 React 渲染的 GUI,就需要它——dsh-client-web 加载名册,等待名册稳定且启动审计通过,然后调用 ctx.uiRenderer.mount(container)。

挂载做什么

mount(container) 会安装 slot 渲染器、在存在时 hydrate 现有启动 DOM、在下一次绘制前把组装后的应用渲染进容器,并返回一个卸载 React 根的 disposer。渲染器执行全程序唯一一次上下文级 renderSlot('root') 调用;注册的根占用方拥有产品布局与文档元数据。

对业务插件

业务插件注册普通 Slot entry 或可复用 Component Factory;渲染器在渲染位置把运行时的会话与 Workspace observable source 绑定为 selector 钩子。插件通过推导出的 Component props 收到标准 scope props——它绝不导入渲染器,也不触碰 React 内部机制。每个由 renderer 创建的 Component 都能渲染 Factory occurrence,Factory 也能暴露由调用方选择的局部 Component,而无需在包之间共享实现值。


理解实现

实现细节——点击展开

本包实现一条边界:对象层(运行时,无 React)拥有业务状态;这里是 ctx 到 React 集成唯一发生的位置——slot 渲染器、SessionProvider 与 useSyncExternalStore 适配器。

激活与挂载

插件在 slots、sessions 与 layout 就绪后激活;它安装 createSlotRenderer() 并 reflect uiRenderer 服务。mountApp 会查找启动内核的 [data-dsh-boot] 元素:存在时经 BootHandoff(一个保留加载 DOM 的单帧透传)hydrate,否则创建全新的根节点并同步提交渲染。

Slot 绑定

createSlotRenderer 把 slot 注册表连接到 React:普通 entry list 与 Factory definition 成为响应式 source,每个 outlet 或 occurrence 经已安装的渲染器渲染。业务插件通过带类型的 hooks 传递裸 observable source;渲染器经 uSES 适配器在渲染位置完成绑定。Factory Store factory 保持 lazy,直到 occurrence 首次物化时才创建 handle;其 exclusive handle 拒绝持久化,渲染期记录保持弱引用,幂等 effect 仅强引用 mounted occurrences,同时在 effect replay 期间保留 identity。Factory 错误使用普通监督通道且不会 abdicate 共享 definition:definition 及其 fallback 局部 Component 的失败归属 definition,调用方所选局部 Component 的失败归属调用方 registration,每个边界随自身 scope incarnation 重置。

身份

React、React DOM、Cordis、ui-slots 与 ui-primitives 通过 Web 外壳的静态模块表保持同一浏览器身份;本包则以动态客户端 bundle 的形式加载。


进一步探索

以下页面覆盖周边机制与组合模型。

  • ui-slots——本渲染器绑定到 React 的 slot 注册表纯核心。
  • web——加载名册并调用 mount 的外壳。
  • ui-session——提供本渲染器所绑定标准会话 source 与钩子的适配器。
  • Web 客户端架构——加载链、对象层与分层红线。
  • slot 系统标准——权威组合模型。
  • Component Factory——可复用 definitions、局部 Component 选择与 occurrence 生命周期。

模型体验

无。该包是浏览器端渲染组装层,不注册任何面向模型的内容。

KV Cache 影响

无;该包既不组装也不发送提供方请求。

已知限制与延期工作

这些限制说明应用首帧何时出现、按区域就绪能走多远;它们是当前包约束。

  • 应用首帧会等待整个客户端名册:启动内核只在 loader 名册稳定且启动审计通过后交出挂载点;按区域就绪仍属暂缓事项。
  • slot 渲染没有 Suspense 集成或逐 entry 惰性加载:完整插件名册稳定后,渲染器才挂载根节点。

开发备注

维护者的工作上下文——点击展开

无。