dsh-client-ui-latest
v0.1.0
Published
DSH web client plugin: a "最新 / Latest" button that jumps to and follows the latest conversation (and its newest message) with one click.
Maintainers
Readme
dsh-client-ui-latest
DSH(DeepSeek Harness)Web 客户端插件:「最新」按钮 — 一键跳转并追踪到最新对话。
点击「最新」后:
- 如果当前打开的不是最新对话,自动打开最新会话(按最近更新时间排序);
- 把会话滚动到最新一条消息,并在随后的 8 秒内持续追踪(新消息流式输出时自动钉在底部);
- 用户向上滚动(滚轮向上 / 拖动滚动条)会立即解除追踪;
- 当前会话就是最新对话时,点击只回到最新消息。
界面入口
| 位置 | 行为 | | --- | --- | | 会话标题栏操作区「最新」按钮 | 始终可用;有更新的对话时显示提示圆点与「最新对话:<标题>」提示 | | 输入框工具行(发送键左侧)图标按钮 | 仅在存在更新的对话时出现,点击跳转 |
原理
DSH 的双面客户端插件(dsh.client 声明):
- node half(
lib/index.js):空的 cordisapply,让插件进入 Loader 行; - browser half(
lib/client.js):通过window.__ModuleLoader__.load({ id, factory })注册, 导出apply(ctx)与inject;dsh-client-modules的 node half 扫描到package.json的dsh.client声明后,将exports["./client"]作为/plugins/<id>/client.js提供给浏览器,并注入到window.__DSH_BOOT__。
UI 复用会话标准插槽(由 @deepseek-ai/dsh-client-ui-conversation 声明):
conversation.session.header.actions— 标题栏操作区;conversation.input.right— 输入框工具行右端。
追踪实现:监听 [data-conversation-scroll] 滚动容器(聊天视图自带的滚动视口),
用 ResizeObserver 在内容增长时钉到 scrollHeight,滚轮上滑或滚动条上拖即解除。
安装(本地 profile)
# 1. 安装到 web profile(推荐用 dsh plugin 转发 pnpm)
dsh plugin --profile web add file:C:/path/to/dsh-client-ui-latest
# 2. 在 ~/.dsh/profiles/web/cordis.patch.yml 中加入浏览器插件行(见下)
# 3. 重启 dsh web 生效(GUI 设置页 → 运行时依赖 → 重启 dsh)# ~/.dsh/profiles/web/cordis.patch.yml
- insert:
- id: ui-latest
name: dsh-client-ui-latest发布到 npm
# 1. 登录 npm
npm login
# 2. 发布(建议先改成正式包名,如 @your-scope/dsh-client-ui-latest)
npm publish
# 3. 用户安装
dsh plugin --profile web add @your-scope/dsh-client-ui-latest发布清单(package.json 关键字段):
| 字段 | 说明 |
| --- | --- |
| exports["./client"] | 浏览器 half 入口,dsh-client-modules 按此路径提供 /plugins/<id>/client.js |
| dsh.client.platform | 必须是 "web" 才会进入浏览器插件清单 |
| dsh.client.inject | 所依赖的 @deepseek-ai/* 客户端包(进入 boot 图的注入边) |
| peerDependencies | 只声明 peer 依赖,不打包任何 @deepseek-ai/* 依赖 |
注意:dsh.client 包必须保持零 runtime dependencies —— 浏览器 half 只允许
require 平台种子模块(react、react/jsx-runtime、
@deepseek-ai/dsh-client-ui-primitives 等),其余能力通过
ctx 服务(slots / sessions / locale)获取。
