dsh-sticky-user-bubble 0.1.3
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/CHANGELOG.md +64 -0
- package/LICENSE +21 -0
- package/PUBLISHING.md +26 -0
- package/README.md +92 -0
- package/client.js +1396 -0
- package/cordis.patch.yml +3 -0
- package/lib/index.js +77 -0
- package/package.json +74 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.1.3] - Unreleased
|
|
6
|
+
|
|
7
|
+
### Compatibility
|
|
8
|
+
|
|
9
|
+
- Declare the DSH compatibility range a second time in the official `package.json#engines.dsh` field (new in DSH 0.1.6) and guard it against `dshCompatibility.range` in the manifest test.
|
|
10
|
+
|
|
11
|
+
- Re-audited the Session/Chat snapshot, Slot, core DOM-marker, and geometry contracts against DSH `0.1.6-alpha.1`: the chat row markup (`data-chat-flow`, `data-chat-anchor-key`/`-flow-key`/`-flow-kind`), the `.EvIC1a_*` flow CSS, `[data-conversation-scroll]`, and `[data-composer-seat]` are emitted by unchanged code; the only new DOM shape is that `@`/slash reference chips now render as a `<button>` when they activate something, which the clone already neutralizes (it clears `tabindex` and sets `tabIndex = -1` on every copied element). Moved the supported line to `>=0.1.6-alpha.1 <0.1.7`; `0.1.6-alpha.1` is individually verified.
|
|
12
|
+
- Audited DSH `0.1.5-alpha.1` Session, Chat, Slot, client-module, and DOM contracts; narrowed the supported line to `>=0.1.5-alpha.1 <0.1.6` with same-line capability-check warnings.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Prefers explicit user-bubble markers when available and otherwise combines authoritative message text, paint, padding, and geometry to identify the source bubble.
|
|
17
|
+
- Observes the active source bubble, its bounded ancestor chain to the scrollport, theme attributes, stylesheet nodes, font loading, the visual viewport, and existing conversation geometry through one coalesced measurement scheduler.
|
|
18
|
+
- Records a non-visual compatibility state on the clone host and fails closed for detached sources, invalid measurements, unsupported root layouts, and geometry mismatches.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Hand the top slot over to the next user card instead of covering it: once that card's leading edge comes within the flow gap, the clone moves up with it, keeps that spacing, is clipped at the scrollport edge, and is gone when the card reaches the reading line.
|
|
23
|
+
- Cap the hover/focus expansion by the free room above the next user card: a long pinned message stops at the card's reserved gap, scrolls internally beyond it, stays collapsed when no room is left, and tightens as the card approaches even while it is already expanded.
|
|
24
|
+
- Measures unclamped clone content at its real width so fixed source `height` and `min-height` values do not determine three-line overflow or expanded height.
|
|
25
|
+
- Uses actual rendered line boxes when available, falling back to computed line height only when the browser cannot expose line rectangles.
|
|
26
|
+
- Copies a bounded set of computed text and visual styles to cloned descendants so ancestor-dependent styling survives the move into `shell.overlay` more reliably.
|
|
27
|
+
- Caps exceptionally long expanded bubbles to the available conversation viewport and makes the expanded bubble internally scrollable.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- Stop the collapse/expand flicker while the conversation streams. A resized flow (every token of an answer resizes it), source attribute or theme change replaced the rendered clone, and the fresh clone started collapsed until the browser's hover recompute expanded it again. Layout resizes now take the ordinary comparison path instead of forcing a rebuild, and the hover/focus intent lives in an effect-level ref that a rebuild carries over to its successor (restoring focus when the keyboard owned the expansion).
|
|
32
|
+
- Cap the expanded bubble by the composer, not just by the scrollport. The composer is sticky at the bottom *inside* the conversation scrollport, so a long pinned message expanded with no following card ran down over the input card and the frame's status bar. `availableHeight` now ends at the `[data-composer-seat]` top minus the usual 16px (falling back to the previous viewport limit when that seat is missing).
|
|
33
|
+
- Move the capped expansion's inner scrolling off the bubble root and onto the content wrapper. The scrollbar used to sit on the bubble's border, crossing the rounded corners, at the global brightness. It now stays inside the bubble's padding, uses DSH's dimmed in-card thumb (`l2`, like the composer card), and the wrapper is an input target only while it owns the scrollbar.
|
|
34
|
+
- Gate the pinned clone on the bubble's real paint boundary instead of the reading line. Visibility was compared against `scrollport.top + readingInset`, which sits 16px below the scrollport's clip edge in the audited layout, so the clone appeared while the original bubble's bottom padding and corners were still fully visible. The clone now waits until the bubble's bottom leaves the scrollport clip edge, narrowed by any clipping or independently scrolling ancestor.
|
|
35
|
+
- Pins user messages that contain an `@`/slash token: the core renderer projects the token into a reference chip that shows only the token's last path segment, so the rendered bubble text never matched the raw snapshot text and that row failed closed as `bubble-not-found`. Bubble text is now rebuilt through each chip's `title` attribute before comparing.
|
|
36
|
+
- Reads the audited DSH Chat target through `uiConversation.binding(id).target('chat')` instead of assuming lifecycle snapshots still contain `chat`.
|
|
37
|
+
- Searches the authoritative user row when the audited DSH line omits the legacy `data-time-hover-root` marker, while retaining the marker path for older bundles.
|
|
38
|
+
- Filters clone-host mutations from the document observer so compatibility refreshes cannot create a self-triggering render loop.
|
|
39
|
+
|
|
40
|
+
## [0.1.1]
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- Makes the pinned bubble clickable and keyboard-accessible, scrolling the conversation back to the corresponding original user or steering message.
|
|
45
|
+
- Limits long pinned bubbles to three lines with an ellipsis, then reveals the complete content while hovered or keyboard-focused.
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- Applies line clamping to a padding-free inner wrapper so Chromium cannot reveal part of a fourth line inside the bubble's bottom padding.
|
|
50
|
+
|
|
51
|
+
## [0.1.0]
|
|
52
|
+
|
|
53
|
+
### Added
|
|
54
|
+
|
|
55
|
+
- Pins the active user or steering message bubble at the top of the DSH Web conversation while its original bubble has scrolled above the reading edge.
|
|
56
|
+
- Uses live conversation/Chat snapshots to resolve message text and the core conversation data attributes to locate the rendered row.
|
|
57
|
+
- Reuses the rendered bubble's measured geometry and computed visual styles so the pinned copy follows the native bubble across widths and themes.
|
|
58
|
+
- Fails closed when the expected chat markers or a measurable text bubble are absent.
|
|
59
|
+
- Cleans up slot registrations, scroll listeners, observers, scheduled frames, and session subscriptions on unload.
|
|
60
|
+
- Adds official profile metadata, local link installation, release checks, and Node 20/22-compatible tests.
|
|
61
|
+
|
|
62
|
+
### Fixed
|
|
63
|
+
|
|
64
|
+
- Interprets measured DOMRect dimensions as border-box totals so the cloned bubble does not add the native content-box padding a second time.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek Harness plugin 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/PUBLISHING.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Publishing Checklist
|
|
2
|
+
|
|
3
|
+
This checkout is a local release candidate for `dsh-sticky-user-bubble@0.1.3`. Its supported DSH release line is `>=0.1.5-alpha.1 <0.1.6`; `0.1.5-alpha.1` is source-verified. Do not publish to npm without a separate package-name and version decision.
|
|
4
|
+
|
|
5
|
+
## Candidate gate
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run publish:check
|
|
9
|
+
npm pack --ignore-scripts
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The pack check uses an exact file allowlist. The package must contain the Host entry, browser bundle, profile patch, documentation, license, and manifest only.
|
|
13
|
+
|
|
14
|
+
## Local profile install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
./install.sh
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The script uses DSH's official profile manager with a `link:` dependency. It does not edit the user's profile patch directly.
|
|
21
|
+
|
|
22
|
+
## Runtime verification
|
|
23
|
+
|
|
24
|
+
After installing a composition or changing the Host/client bundle, restart `dsh web` in the user's terminal when no client-plugin watcher has been confirmed, then refresh the page. Verify the profile dump contains `dsh-sticky-user-bubble` and the Web boot graph includes `@deepseek-ai/dsh-client-ui-chat`, then check a long conversation at desktop and narrow widths.
|
|
25
|
+
|
|
26
|
+
The client must hide the pinned copy at the top of a conversation, show the corresponding user bubble only after it has fully left the painted band, hand the slot over to the next user card (keeping the message gap, never covering that card), switch in both scroll directions, navigate back to the original message when activated, clamp long copies to three lines without fourth-line leakage, restore natural content height only within the room left by the next card and the composer (`[data-composer-seat]`), keep the in-bubble scrollbar inside the bubble padding, and disappear for stale snapshots, unsupported layouts, ambiguous bubble candidates, or missing core markers. Repeat the smoke test with altered font size, line height, padding, a gradient/small-radius bubble, fixed source height, theme changes, and a narrow viewport.
|
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# dsh-sticky-user-bubble
|
|
2
|
+
|
|
3
|
+
一个面向 DeepSeek Harness Web 的客户端插件:阅读长对话时,当当前用户气泡已经完整滚出对话顶部(原气泡不再有任何可见部分)后,插件会在顶部固定显示同一条原生用户气泡。固定内容直接来自原气泡的 DOM 克隆,因此不会把用户发言强行称为“问题”,也不会改写正文排版。
|
|
4
|
+
|
|
5
|
+
## 功能
|
|
6
|
+
|
|
7
|
+
- 固定当前已完整滚出对话可视区顶部的用户或 durable steering 消息气泡。
|
|
8
|
+
- 向上、向下滚动时按真实消息顺序切换;原气泡仍有任何可见部分(包括底部内边距和圆角)时保持隐藏,不会出现原气泡与副本同时可见。
|
|
9
|
+
- 下一条用户卡片进入顶部区域时,固定气泡像列表 sticky 标题一样被它顶出去(超出对话顶边的部分被裁掉),不会盖住新卡片;让位过程始终保持与对话一致的消息间距(跟随该行的 `--dsh-chat-flow-gap`,不小于 16px),新卡片到达阅读线时固定气泡完全消失。
|
|
10
|
+
- 点击固定气泡会平滑滚动到对应的原始用户输入位置;同时支持键盘聚焦后按 `Enter` 或空格键跳转。
|
|
11
|
+
- 固定气泡超过三行时默认只显示三行并以省略号截断,鼠标移入或键盘聚焦时恢复完整内容;展开高度同时受**输入框顶部**和「下一条用户卡片上方空间」限制(超出部分在气泡内部滚动),空间只剩消息间距时保持三行不展开,因此展开既不会盖住新卡片,也不会压住输入卡片与底部状态栏。
|
|
12
|
+
- 内部滚动发生在气泡 padding 之内的内容区:滚动条不会压住气泡的圆角边框,并沿用 DSH「卡片内滚动区域」的约定使用更暗的 `l2` 滑块颜色(与 composer 输入卡片一致)。
|
|
13
|
+
- 会话仍在进行(思维链、工具调用、回答流式增长)时不会打断阅读:展开状态不会因为会话更新而反复收起再展开,clone 重建时 hover/focus 意图会被继承。
|
|
14
|
+
- 使用当前 DSH 独立 `ChatSnapshot.order` 和 `chat.nodes.get(key)` 校验消息归属;同时保留旧版嵌套 `snapshot.chat` 兼容路径,不把 DOM 中的未知行当作用户消息。
|
|
15
|
+
- 使用 DSH 核心公开的 `data-conversation-scroll`、`data-chat-flow`、`data-chat-anchor-key`、`data-chat-flow-kind` 标记定位(阅读区下界另用 `data-composer-seat`),不替换会话 Slot 或消息渲染器;若未来出现专用 user-bubble marker 会优先使用。
|
|
16
|
+
- 副本的显示条件只看原气泡是否仍被绘制:以 scrollport 的实际裁剪边界为准(并被中间任何裁剪或独立滚动祖先的 padding box 顶部收窄),与固定副本所在的顶部内边距线无关。
|
|
17
|
+
- 从原生气泡读取实际 DOMRect 和计算样式,并向克隆后代复制有边界的文本/视觉样式集,降低祖先选择器在 `shell.overlay` 中失效造成的差异。
|
|
18
|
+
- 先以真实宽度、自然高度测量不可见克隆,再用实际文本行框确定第三行边界;外部固定 `height`/`min-height` 不再决定是否截断或完整展开高度。
|
|
19
|
+
- 通过有边界的 `MutationObserver`、`ResizeObserver`、当前 source 到 scrollport 的祖先样式属性、页面主题、样式表、字体加载、visual viewport 和窗口尺寸监听,在同一动画帧调度器内重新测量。
|
|
20
|
+
- 极长内容展开时限制在当前对话可用高度内并允许内部滚动,避免固定气泡伸出视口。
|
|
21
|
+
- 保留 DSH 原生的手动历史分页:更早消息仍由用户点击“加载更早”;旧消息进入当前窗口后,固定气泡自动重新归组和定位,无需刷新页面。
|
|
22
|
+
- 固定副本位于独立的 `shell.overlay` 层,除气泡本身外均点击穿透;克隆内部节点会移除 ID、ARIA 引用、核心聊天标记和交互属性,避免引用链接或控件被二次触发。
|
|
23
|
+
- 找不到预期核心标记、当前快照过期、气泡不可测量、结构存在歧义或克隆几何自检失败时自动隐藏,并在 host 上保留非视觉状态码供诊断。
|
|
24
|
+
|
|
25
|
+
## 已知边界
|
|
26
|
+
|
|
27
|
+
- 当前 DSH 的圆角气泡没有稳定的专用 `data-*` 标记,也不再保证存在旧版 `data-time-hover-root`。没有这些 marker 时,插件在权威用户行内部用消息文本、paint、padding 和几何联合评分;候选存在歧义时 fail closed。
|
|
28
|
+
- wrapper 无法可靠保留 flex/grid/table 根布局、垂直书写、root transform 或非 1 zoom,因此这些布局会隐藏固定气泡并记录 `unsupported-*` 状态,而不是显示近似布局。
|
|
29
|
+
- Shadow DOM、canvas、关键伪元素内容以及非 DOM 气泡不在当前架构支持范围内。
|
|
30
|
+
- 第三方 `!important` 规则如果主动覆盖 clone 的关键属性,几何自检能发现一部分但不能保证全部识别;原消息始终不受影响。
|
|
31
|
+
- 通过 `CSSStyleSheet.insertRule()` 等方式静默修改 CSSOM 且不产生 DOM、字体或尺寸事件时,不保证立即刷新;后续滚动、resize 或其他受观察事件会重新测量根样式。
|
|
32
|
+
- 尚未持久化的 pending steering 行目前没有核心行锚点,因此会等到它成为 durable 节点后再参与切换。
|
|
33
|
+
- 尚未点击“加载更早”的历史消息不在当前 `ChatSnapshot` 和 DOM 窗口内,不能提前参与固定气泡切换;插件有意不自动调用 `loadOlder()`。
|
|
34
|
+
- 纯图片消息没有文本气泡时不会伪造文字副本;原消息保持不变。
|
|
35
|
+
- 这是纯客户端行为,不提供开关、历史数据或 Host 路由。
|
|
36
|
+
|
|
37
|
+
## 要求
|
|
38
|
+
|
|
39
|
+
- DeepSeek Harness Web `>=0.1.5-alpha.1 <0.1.6`;`0.1.5-alpha.1` 已逐版本验证,同线后续版本带警告并继续依赖客户端结构与能力检查;旧版嵌套快照仍保留兼容读取。
|
|
40
|
+
- Node.js 20 或更高版本,用于安装和发布检查。
|
|
41
|
+
- 不需要额外的运行时 npm 依赖。
|
|
42
|
+
|
|
43
|
+
## 本地安装
|
|
44
|
+
|
|
45
|
+
从当前源码目录执行:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm run publish:check
|
|
49
|
+
./install.sh
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
安装脚本通过 DSH 官方 profile manager 加入 `link:` 依赖,不直接改写用户的 `cordis.patch.yml`:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
dsh plugin --profile web add "link:$PWD" --config.minimumReleaseAge=0
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
修改 `package.json`、`cordis.patch.yml` 或 Host 入口后,请在用户终端重启 `dsh web`,然后刷新页面。只修改客户端源码时,如果当前部署没有运行 client-plugin watcher,同样需要重启并刷新。
|
|
59
|
+
|
|
60
|
+
## 卸载
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
./uninstall.sh
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
卸载只移除 profile 依赖和 bundle 层,不修改 DSH 源码、会话历史或用户配置。
|
|
67
|
+
|
|
68
|
+
## 开发检查
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm run check
|
|
72
|
+
npm test
|
|
73
|
+
npm run pack:check
|
|
74
|
+
npm run publish:check
|
|
75
|
+
npm pack --ignore-scripts
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 实现概要
|
|
79
|
+
|
|
80
|
+
1. `shell.overlay` 是唯一 UI 注册点,采用独立 ID `dsh-sticky-user-bubble`,不替换任何已有 Slot occupant。
|
|
81
|
+
2. 根 overlay 通过 `useSessions` 得到当前会话 ID,用 `sessions.binding(id).session` 的 `subscribe/getSnapshot` 读取生命周期状态,并用 `uiConversation.binding(id).target('chat')` 读取当前 `ChatSnapshot`。
|
|
82
|
+
3. 每次测量先用生命周期状态和 Chat snapshot 建立用户节点索引,再在当前可见 flow 中按 DOM 顺序寻找最后一个已跨过阅读边界的 durable `user`/`steering` 行;副本只在原气泡完全离开绘制区后显示,并在下一条用户卡片逼近时让位(保留消息间距、被对话顶边裁切)。
|
|
83
|
+
4. 在该行内优先查找专用 marker,否则在整行权威边界内用消息文本、paint、padding 和几何选择唯一可信气泡;无法唯一确定时隐藏。
|
|
84
|
+
5. 克隆会先以真实宽度、自然高度和 `visibility:hidden` 挂入 overlay,递归复制有边界的后代样式,并通过 `Range.getClientRects()` 或 computed line-height 得出三行边界。
|
|
85
|
+
6. 渲染前检查 source 连接、根布局、宽度、内容宽度和高度;不支持的结构只在 host 上记录状态码,不显示 clone。
|
|
86
|
+
7. source、flow、主题属性、样式表、字体和 viewport 变化统一合并到一个动画帧;clone host 自身的 DOM 变化被过滤。
|
|
87
|
+
8. 点击或键盘激活固定气泡时,按原节点与当前 scrollport 的实时坐标写入目标 `scrollTop`;普通测量和滚动跟踪不会改写滚动位置。
|
|
88
|
+
9. 插件停止或会话/视图改变时清除克隆、监听器、观察器和待处理动画帧。
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
MIT
|