@deepseek-ai/dsh-client-ui-chat 0.2.1-rc.3 → 0.2.2-alpha.2
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.i18n.yaml +14 -14
- package/README.md +23 -11
- package/README.zh.md +23 -11
- package/lib/assets/running-whale@2x-06738fa29b2f.png +0 -0
- package/lib/client.js +2368 -236
- package/lib/index.js +6 -0
- package/lib/types/chat-settings.d.ts +13 -0
- package/lib/types/client/chat/AssistantMarkdown.d.ts +3 -1
- package/lib/types/client/chat/ChatFlow.d.ts +1 -1
- package/lib/types/client/chat/ChatView.d.ts +1 -1
- package/lib/types/client/chat/MessageItem.d.ts +12 -3
- package/lib/types/client/chat/ReasoningRow.d.ts +2 -1
- package/lib/types/client/chat/RunningStatus.d.ts +8 -3
- package/lib/types/client/chat/flow-motion.d.ts +8 -1
- package/lib/types/client/chat/text-interaction.d.ts +19 -0
- package/lib/types/client/chat/text-selection.d.ts +20 -0
- package/lib/types/client/chat/use-chat-reading.d.ts +2 -1
- package/lib/types/client/chat/use-chat-scroll.d.ts +2 -0
- package/lib/types/client/chat/use-chat-viewport.d.ts +34 -1
- package/lib/types/client/contract/group-tree.d.ts +4 -4
- package/lib/types/client/contract/slots.d.ts +46 -4
- package/lib/types/client/contract/snapshot.d.ts +2 -1
- package/lib/types/client/conversation-nodes/inbox.d.ts +6 -1
- package/lib/types/client/conversation-nodes/message.d.ts +5 -0
- package/lib/types/client/conversation-nodes/turn-process.d.ts +13 -1
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/locale.d.ts +1196 -0
- package/lib/types/client/presentation-policy.d.ts +13 -9
- package/lib/types/client/settings/TranscriptViewRow.d.ts +8 -3
- package/lib/types/client/transcript-view.d.ts +8 -1
- package/lib/types/index.d.ts +5 -1
- package/locale/de.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/package.json +47 -41
package/README.i18n.yaml
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
en: 02bd72c12ada3218
|
|
10
10
|
zh: 331b3a38b3ddfc6e
|
|
11
11
|
/deepseek-ai-dsh-client-ui-chat/summary:
|
|
12
|
-
en:
|
|
13
|
-
zh:
|
|
12
|
+
en: 4f2d50107db6c4f8
|
|
13
|
+
zh: ea7ccfcce8f1849e
|
|
14
14
|
/deepseek-ai-dsh-client-ui-chat/table-of-contents:
|
|
15
15
|
en: 41cd21266011d571
|
|
16
16
|
zh: 3172d1a2acbb27b7
|
|
17
17
|
/deepseek-ai-dsh-client-ui-chat/reference-previews:
|
|
18
|
-
en:
|
|
19
|
-
zh:
|
|
18
|
+
en: 1333217883f84d52
|
|
19
|
+
zh: 234a23bc2e793283
|
|
20
20
|
/deepseek-ai-dsh-client-ui-chat/hidden-chat-rows:
|
|
21
21
|
en: cbf1f0a2205046a5
|
|
22
22
|
zh: 2e59d0815351349f
|
|
@@ -24,20 +24,20 @@
|
|
|
24
24
|
en: 41dcd70e14ebe9cc
|
|
25
25
|
zh: ededead572b59037
|
|
26
26
|
/deepseek-ai-dsh-client-ui-chat/turn-token-usage:
|
|
27
|
-
en:
|
|
28
|
-
zh:
|
|
27
|
+
en: cfdfe3d99d3f4e09
|
|
28
|
+
zh: 9330bad3d3f7a689
|
|
29
29
|
/deepseek-ai-dsh-client-ui-chat/completed-turn-footer:
|
|
30
|
-
en:
|
|
31
|
-
zh:
|
|
30
|
+
en: 382821ca3ffa60dd
|
|
31
|
+
zh: 9840ffa07c13082a
|
|
32
32
|
/deepseek-ai-dsh-client-ui-chat/turn-process-folding:
|
|
33
|
-
en:
|
|
34
|
-
zh:
|
|
33
|
+
en: b0d806604bc17006
|
|
34
|
+
zh: 18dabe5dc2d0d419
|
|
35
35
|
/deepseek-ai-dsh-client-ui-chat/grouped-rendering:
|
|
36
|
-
en:
|
|
37
|
-
zh:
|
|
36
|
+
en: 3afad0b4c6bf9ce0
|
|
37
|
+
zh: d8179ba4ee9fcd61
|
|
38
38
|
/deepseek-ai-dsh-client-ui-chat/scroll-ownership:
|
|
39
|
-
en:
|
|
40
|
-
zh:
|
|
39
|
+
en: 91e1f5f12ca51211
|
|
40
|
+
zh: b92090966d58b82c
|
|
41
41
|
/deepseek-ai-dsh-client-ui-chat/model-experience:
|
|
42
42
|
en: c17b4dd43a61c569
|
|
43
43
|
zh: f7414309810c3a08
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Desktop product events use the optional [product analytics service](../product-a
|
|
|
10
10
|
|
|
11
11
|
## Summary
|
|
12
12
|
|
|
13
|
-
Use this package to render a browser chat from recorded Session conversations, including historical images, localized actions, and restored scroll position. Work-details modes control reasoning previews and process visibility without hiding
|
|
13
|
+
Use this package to render a browser chat from recorded Session conversations, including historical images, localized actions, and restored scroll position. Work-details modes control reasoning previews and process visibility without hiding Assistant replies; Verbose keeps completed-turn process rows visible. Local transcript and steering submissions appear immediately, remain in their original surface, and disappear atomically when authoritative Session records arrive, while queued submissions stay outside Chat. The package does not assemble or modify model requests.
|
|
14
14
|
|
|
15
15
|
File-mention providers receive the viewed Session ID with the closing-turn owner, so links into inherited history can address the fork itself.
|
|
16
16
|
|
|
@@ -33,6 +33,8 @@ File-mention providers receive the viewed Session ID with the closing-turn owner
|
|
|
33
33
|
<a id="reference-previews"></a>
|
|
34
34
|
## Reference previews
|
|
35
35
|
|
|
36
|
+
Image drag actions arrive through the image entry’s inject face from [ui-file-drag](../ui-file-drag/README.md).
|
|
37
|
+
|
|
36
38
|
Sent generic-file attachments retain the draft's [file-card radius](../../../docs/ui-radius.md#radius-scale).
|
|
37
39
|
|
|
38
40
|
`ChatView` supplies file and HTTP(S) navigation through the existing `MarkdownDelegateProvider` around its node list, passing `requestOpenFile`, `openExternalLink`, and `fileImages` directly. Its file opener retains Chat's failure feedback and retry handling. Assistant Markdown file links open in the right Sidebar after the message settles, including references to unmodified files. Relative paths resolve in the viewed Session's workspace; absolute paths retain the same Session's filesystem access. `#L24` and `#L24-L30` navigate to the first specified line and reuse an existing file tab. Missing files show the preview's error state.
|
|
@@ -41,7 +43,9 @@ Native message images use separate user and output positions. The `conversation.
|
|
|
41
43
|
|
|
42
44
|
The session-scoped `conversation.chat.user.content` Factory renders only the user content stack: text, extra blocks, image/file attachments in input order, and reference summaries. Its [`UserContentInput`](src/client/contract/slots.ts) carries prepared `content`, transform `facts`, display props, and explicit `loadImage`; node-owned injections provide reference actions. It calls the shared `conversation.user.text` Factory for text and its own image Slot for images. Direct callers need a Session binding and supply their own row wrapper.
|
|
43
45
|
|
|
44
|
-
`UserStyleBubble` and the [source-specific wrappers](<src/client/chat/MessageItem.tsx#
|
|
46
|
+
`UserStyleBubble` and the [source-specific wrappers](<src/client/chat/MessageItem.tsx#L164-L340>) retain the user row, keys, pending/echo markers, timestamps, copy controls, and other message actions. The content Factory reads neither source-specific models nor private Context, and is not a global user-content override entry point.
|
|
47
|
+
|
|
48
|
+
The official user and steering renderer declares the session-scoped `conversation.chat.user.before` chain slot at its `user` registration and renders it directly above the bubble with `renderSlotChain`; the `steering` registration shares the renderer without owning the seat. Owner props carry the durable message `source` and row `kind`; each entry’s `select` matches its own sources, and the first non-null result reaches the elected component as `matched`. No match displays no content. Entries own their markup and copy; Chat does not interpret message sources.
|
|
45
49
|
|
|
46
50
|
Standalone Markdown images show contained previews and open the shared image lightbox; local paths resolve against the viewed workspace after settlement. Image file links keep their sidebar activation and show a thumbnail after hover dwell or keyboard focus. Escape dismisses the thumbnail. Failed images retain a localized status and their description; no duplicate-image filtering is applied.
|
|
47
51
|
|
|
@@ -68,10 +72,12 @@ A completed Turn shows an expandable usage row only when the loaded window inclu
|
|
|
68
72
|
|
|
69
73
|
Settings → General → Performance & usage appears after Send behavior while busy and before Session Log upload, and stores `ui-chat.performanceUsage` as `detailed` (default) or `compact`. Compact shows only available output speed and cache-hit percentage beneath the composer, without interactive statistic dialogs or per-Turn usage. Detailed exposes session statistics and per-Turn token usage. Neither mode shows elapsed time in the completed-turn footer. The preference changes presentation only; accounting and Session events remain intact.
|
|
70
74
|
|
|
71
|
-
The composer statistics are two `conversation.composer.dock` list entries: `activity` (order 0, turn and step counts and output speed, with LLM time, tool time, and TTFT) and `usage` (order 1, token total and cache hit). The controls follow the shared [statistics-control radius](../../../docs/ui-radius.md#radius-scale). Another plugin replaces one control by registering the same id and the same `order`; the dock orders rows by `order`, while a lower `priority` picks the replacement: a dynamic plugin receives one automatically, and a statically composed plugin passes it explicitly. A new id adds a control. Each control carries its id in `data-composer-stat`. An open statistics dialog closes on Escape or on a pointerdown or click outside it, so activating another control by pointer or keyboard swaps dialogs instead of stacking them.
|
|
75
|
+
The composer statistics are two `conversation.composer.dock` list entries: `activity` (order 0, turn and step counts and output speed, with LLM time, tool time, and TTFT) and `usage` (order 1, token total and cache hit). The controls follow the shared [statistics-control radius](../../../docs/ui-radius.md#radius-scale). Another plugin replaces one control by registering the same id and the same `order`; the dock orders rows by `order`, while a lower `priority` picks the replacement: a dynamic plugin receives one automatically, and a statically composed plugin passes it explicitly. A new id adds a control. Each control carries its id in `data-composer-stat`. An open statistics dialog closes on Escape or on a pointerdown or click outside it, so activating another control by pointer or keyboard swaps dialogs instead of stacking them. When an ellipsis cuts off a reading, a tooltip shows the full reading. A dialog control shows it on hover or keyboard focus, but not while its dialog is open; a reading without a dialog shows it on hover, click, or tap. The session statistics dialog heads its rows with the turn and step counts.
|
|
72
76
|
|
|
73
77
|
Explicit selections update every consumer immediately; accepted Host settings reconcile the live value, so a refused or pending write keeps the selected mode until the Host answers.
|
|
74
78
|
|
|
79
|
+
In narrow browser settings, preference labels use a smaller gutter before their controls. Windows and macOS desktop windows retain the standard spacing.
|
|
80
|
+
|
|
75
81
|
Preference menus restore focus to their trigger without scrolling before publishing a new selection.
|
|
76
82
|
|
|
77
83
|
<a id="completed-turn-footer"></a>
|
|
@@ -79,7 +85,7 @@ Preference menus restore focus to their trigger without scrolling before publish
|
|
|
79
85
|
|
|
80
86
|
Artifact extensions can subscribe to one Turn and Node kind through `ChatNodeStore.turnDataSource`. The source includes hidden Nodes and exposes their business data in anchor order. Membership updates incrementally; only observed collections materialize ordered arrays, and unrelated Turns or kinds do not notify them.
|
|
81
87
|
|
|
82
|
-
The completed-turn action footer follows the recorded Turn end. Its action row starts 20px below preceding prose or extension content. Actions remain visible only on the latest Turn when its final visible content is a reply; other endings and historical Turns reveal actions on hover or keyboard focus. Devices without hover keep actions visible.
|
|
88
|
+
The completed-turn action footer follows the recorded Turn end. Its action row starts 20px below preceding prose or extension content. Actions remain visible only on the latest Turn when its final visible content is a reply; other endings and historical Turns reveal actions on hover or keyboard focus. Devices without hover keep actions visible. An unavailable branch action opens its explanation on click or tap without creating a branch.
|
|
83
89
|
|
|
84
90
|
-----
|
|
85
91
|
|
|
@@ -90,9 +96,9 @@ During uninterrupted following, local transcript and steering echoes remain moun
|
|
|
90
96
|
|
|
91
97
|
When Chat ends with an open Turn control and that Turn has no visible input, the first local transcript echo precedes the control. Other echoes remain at the flow tail. The control and echoes share one keyed list, so arrival of the control preserves the echo's mounted identity. Durable inputs replace their matching echoes in the same render.
|
|
92
98
|
|
|
93
|
-
Work-details modes control process-group display and reasoning previews. Compact, Standard, and Detailed fold eligible completed Turns
|
|
99
|
+
Work-details modes control process-group display and reasoning previews. Compact, Standard, and Detailed fold eligible completed Turns while keeping every Assistant reply visible, or only the final answer under Final answer only; Verbose retains the duration/status header without a collapse action and shows historical process rows directly. The [business-rule reference](src/client/conversation-nodes/README.md#display-modes) contains the mode table, title behavior, whole-Turn eligibility, clocks, and disclosure resets.
|
|
94
100
|
|
|
95
|
-
The Settings
|
|
101
|
+
The Settings rows below Work details offer an [independent collapse-timing preference](src/client/conversation-nodes/README.md#collapse-timing) and a [Replies After Collapse preference](src/client/conversation-nodes/README.md#folded-replies) (`ui-chat.foldedReplies`, hidden in Verbose), both saved through the same Host profile configuration.
|
|
96
102
|
|
|
97
103
|
-----
|
|
98
104
|
|
|
@@ -107,11 +113,11 @@ The Chat Builder publishes `bottomSource` per Node: true for visible Nodes belon
|
|
|
107
113
|
|
|
108
114
|
Live tool deltas share reasoning's frame-batched publication; durable calls and results publish immediately. Native and nested results retain event presentation metadata, so historical file and command labels use the operation’s location. Repeated deltas retain the Tool node when observed argument answers, the anchor, location, and visibility are unchanged. The Definition supplies the same lazy argument reader to tool rows and group detail, without tool-specific registration.
|
|
109
115
|
|
|
110
|
-
The process group uses a stable `div` layout box, a scroll body, and an uncapped content box that reports growth inside the body. Business styles must adapt spacing within and across groups, including hidden or empty members and the answer-spacing exception. The `conversation.chat.flow` slot adds a `display: contents` DOM anchor; row selectors match that anchor directly, without repeating its column ancestry. The running status shares the rows' parent, so its divider uses the same visible-sibling rules. The anchor contributes no spacing of its own. CSS variables do not belong in the Group Definition.
|
|
116
|
+
The process group uses a stable `div` layout box, a scroll body, and an uncapped content box that reports growth inside the body. Business styles must adapt spacing within and across groups, including hidden or empty members and the answer-spacing exception. The `conversation.chat.flow` slot adds a `display: contents` DOM anchor; row selectors match that anchor directly, without repeating its column ancestry. The running status shares the rows' parent, so its divider uses the same visible-sibling rules. The anchor contributes no spacing of its own. The earlier-history control directly precedes the flow anchor; their sibling relationship supplies the leading gap. CSS variables do not belong in the Group Definition.
|
|
111
117
|
|
|
112
|
-
Running group titles, reasoning previews, tool and command rows, the active retry line, and the bottom running status use the shared [TextShimmer](../ui-primitives/README.md#component-catalog). Each row’s text shares one left-to-right highlight, including collapsed group titles; icons and hover chevrons retain their base appearance.
|
|
118
|
+
Running group titles, reasoning previews, tool and command rows, the active retry line, and the bottom running status use the shared [TextShimmer](../ui-primitives/README.md#component-catalog). Each row’s text shares one left-to-right highlight, including collapsed group titles; icons and hover chevrons retain their base appearance. Ordinary flow rows sit 4px apart. An expanded group title has 8px before its content, Assistant responses have 12px from adjacent process rows, and completed-Turn duration/status controls have 16px from their input and from a directly following visible row. A reply that follows the control after folded rows keeps the 12px reply gap, so folding never changes its spacing. Hidden and empty rows, including retained empty slot anchors, add no gap. The running “Deep diving” text retains its blue base while its theme-specific highlight sweeps across it.
|
|
113
119
|
|
|
114
|
-
The running status shows a whale whose APNG mask inherits the text color. CSS selects the static SVG when reduced motion or forced colors are active, or alpha masks are unsupported. The
|
|
120
|
+
The running status shows a whale whose APNG mask inherits the text color. CSS selects the static SVG when reduced motion or forced colors are active, or alpha masks are unsupported. The APNG is a [package asset](../AGENTS.md#dependency-declaration) referenced by the plugin stylesheet; React does not pass image data through DOM styles.
|
|
115
121
|
|
|
116
122
|
Scroll-edge fades initialize when `ResizeObserver` reports the open group's layout; opening the group performs no immediate scroll-dimension read in a layout effect.
|
|
117
123
|
|
|
@@ -130,7 +136,7 @@ Process rows share one text and icon color in every Work details mode: tertiary
|
|
|
130
136
|
|
|
131
137
|
Chat waits for initial history before automatic content, scroll, or size updates initialize reading state. Running Sessions restore their initial visibility and position before fold animations become eligible.
|
|
132
138
|
|
|
133
|
-
Chat restores semantic anchors across history prepend and renderer remounts, with browser scroll anchoring disabled on its scrollport only while following the tail. Pinned scroll deliveries without reader movement, and reader input that reaches the floor within subpixel rounding, update follow ownership immediately, before subsequent layout changes can invalidate their floor. Other reader movement remains pending until the sampling interval or `scrollend`, even inside the follow threshold, so layout growth cannot erase small scroll gestures. Under completion-time folding, submitting transcript input or steering immediately restores tail following and clears an older pending reader sample. While the reader is pinned to the floor, `ResizeObserver` follows the new floor and selects the latest loaded Turn without reading row geometry. Once the reader moves away, flow-height changes preserve the top position and the reading-line geometry selects the active Turn. Turn-rail previews paint above sticky Markdown code-block banners, while the rail frame remains inside the transcript band above the composer.
|
|
139
|
+
Chat restores semantic anchors across history prepend and renderer remounts, with browser scroll anchoring disabled on its scrollport only while following the tail. Pinned scroll deliveries without reader movement, and reader input that reaches the floor within subpixel rounding, update follow ownership immediately, before subsequent layout changes can invalidate their floor. Other reader movement remains pending until the sampling interval or `scrollend`, even inside the follow threshold, so layout growth cannot erase small scroll gestures. Under completion-time folding, submitting transcript input or steering immediately restores tail following and clears an older pending reader sample. Under next-message folding, transcript input that no fold batch carries lands on one native animation; steering lands at once under either timing, because the running Turn keeps streaming above its echo. While the reader is pinned to the floor, `ResizeObserver` follows the new floor and selects the latest loaded Turn without reading row geometry. Once the reader moves away, flow-height changes preserve the top position and the reading-line geometry selects the active Turn. Turn-rail previews paint above sticky Markdown code-block banners, while the rail frame remains inside the transcript band above the composer.
|
|
134
140
|
|
|
135
141
|
The turn rail and back-to-bottom button sit outside the clipped transcript. They use the shared conversation scrollport for sticky positioning, or the Chat frame for absolute positioning when Chat owns its scrollport. The rail hides when the transcript's available width, excluding its horizontal padding, is at most 900px; the browser viewport width is not the criterion.
|
|
136
142
|
|
|
@@ -138,7 +144,9 @@ The transcript root uses `overflow-x: visible; overflow-y: clip`: vertical overf
|
|
|
138
144
|
|
|
139
145
|
Outer transcript following and each open capped group's following are independent. Native animation progress retains follow intent; only that scrollport's own `scrollend` settles its animation. Browsers without `scrollend` may retain the native follow target until a later bottom-aligned update or reader gesture. A reader gesture interrupts the animation, and actual movement determines whether following remains enabled. Scroll chaining can move the outer transcript, which then applies its own distance threshold. The back-to-bottom button restores only outer following.
|
|
140
146
|
|
|
141
|
-
Next-message folding moves every batch of closing rows and the scrollport on one frame clock, with browser scroll anchoring disabled during the fold; there is no separate reserve-then-follow path. A row that starts closing or revealing while a batch runs keeps its size until that batch settles and then changes in the next batch; a batch continues each row from the size it already has. The batch lands at the tail when this client's own input caused it (including a subagent child's continuation) or when the reader was following; otherwise the reader's visible content stays still, whoever sent the message. Content above the reading line never slides back down: when the retained answer and the new content cannot fill the viewport, only that deficit remains as bottom space, and new content fills it before following advances again. Reader gestures cancel the automatic target and active native following; resize cannot revive it in the same fold, but new submitted input can. Acknowledged scrolling releases only space that can be removed without clamping the reader. Unloading Chat cancels waiting callbacks and row transitions. Reduced-motion users receive immediate visibility and positioning changes.
|
|
147
|
+
Next-message folding moves every batch of closing rows and the scrollport on one frame clock, with browser scroll anchoring disabled during the fold; there is no separate reserve-then-follow path. A row that starts closing or revealing while a batch runs keeps its size until that batch settles and then changes in the next batch; a batch continues each row from the size it already has. The batch lands at the tail when this client's own input caused it (including a subagent child's continuation) or when the reader was following; otherwise the reader's visible content stays still, whoever sent the message. When a batch takes over following because content changed, such as a Turn ending while a next input waits, content that grew outside the batch since the last paint moves the scroll position before the first frame, as following does for streaming growth, so the batch animates only its own rows; growth that arrives with the reader's own input lands on the batch's animation. Content above the reading line never slides back down: when the retained answer and the new content cannot fill the viewport, only that deficit remains as bottom space, and new content fills it before following advances again. Reader gestures cancel the automatic target and active native following; resize cannot revive it in the same fold, but new submitted input can. Acknowledged scrolling releases only space that can be removed without clamping the reader. Unloading Chat cancels waiting callbacks and row transitions. Reduced-motion users receive immediate visibility and positioning changes.
|
|
148
|
+
|
|
149
|
+
Completion-time folding closes a Turn's work rows at once. When the reader follows the tail, the first row visible before the close keeps its screen position, or, when that row closed, the first surviving row that followed it on screen, else the nearest surviving row above it; bottom space fills the gap, at most half the scrollport, and later growth takes that space before following advances.
|
|
142
150
|
|
|
143
151
|
Changing Work details clears reserved bottom space after active folds finish and reconciles the scroll range with the selected mode. Readers already following the tail stay at the new bottom; other readers are not forced to follow.
|
|
144
152
|
|
|
@@ -172,6 +180,10 @@ Active-Turn highlighting is approximate: `readVisibleTurn` binary-searches the f
|
|
|
172
180
|
|
|
173
181
|
-----
|
|
174
182
|
|
|
183
|
+
The Chat view detects selection and context-menu gestures on business nodes marked with `data-text-interaction-source`. Both selection endpoints must resolve to the same source container. Displayed user content and settled Assistant text or reasoning participate; tools, injected context, streaming or interrupted Assistant text, and Markdown controls do not.
|
|
184
|
+
|
|
185
|
+
`ctx.uiConversation.interactions` dispatches eligible gestures to plugin registrations and supplies their component to the Chat view. The action surface is absolutely positioned inside the existing Chat column, above the composer seat and its dock. Its wrapper preserves the component's outer stroke and shadow; components own internal scrolling. Scrolling the selection outside that visible region temporarily hides the surface; returning restores it. Chat owns viewport visibility, placement, outside pointer presses, Escape, new selections, source invalidation, and disposal; explicit dismissal preserves browser selection and layout changes do not reopen the surface. [Message quotes](../../session/message-quotes/README.md) owns quotation eligibility and insertion.
|
|
186
|
+
|
|
175
187
|
<a id="model-experience"></a>
|
|
176
188
|
## Model Experience
|
|
177
189
|
|
package/README.zh.md
CHANGED
|
@@ -10,7 +10,7 @@ kind: "package-reference"
|
|
|
10
10
|
|
|
11
11
|
## 概述
|
|
12
12
|
|
|
13
|
-
使用本包可在浏览器中渲染已记录的 Session
|
|
13
|
+
使用本包可在浏览器中渲染已记录的 Session 对话,包括历史图片、本地化操作和滚动位置恢复。工作步骤展示模式控制思考预览与过程显隐,不隐藏 Assistant 回复;完全展开模式保持已完成轮次的过程行可见。本地 transcript(文本记录)与 steering(中途引导)提交会立即显示并保留在原区域,在权威会话记录到达时原子地消失,而排队中的提交始终不进入 Chat。本包不组装或修改模型请求。
|
|
14
14
|
|
|
15
15
|
文件提及提供方同时接收当前查看的会话 ID 与收尾轮次的属主信息,因此继承历史中的链接可以指向 fork 自身。
|
|
16
16
|
|
|
@@ -33,6 +33,8 @@ kind: "package-reference"
|
|
|
33
33
|
<a id="reference-previews"></a>
|
|
34
34
|
## 引用预览
|
|
35
35
|
|
|
36
|
+
图片拖放回调通过图片入口的注入接口从 [ui-file-drag](../ui-file-drag/README.zh.md) 获取。
|
|
37
|
+
|
|
36
38
|
已发送的普通文件附件保留草稿中的[文件卡片圆角](../../../docs/ui-radius.zh.md#radius-scale)。
|
|
37
39
|
|
|
38
40
|
`ChatView` 通过节点列表外围既有的 `MarkdownDelegateProvider` 提供文件及 HTTP(S) 导航,直接传入 `requestOpenFile`、`openExternalLink` 和 `fileImages`。文件打开动作保留 Chat 的失败反馈与重试处理。Assistant Markdown 文件链接在消息落定后可于右侧栏打开,包括未修改文件的引用。相对路径基于当前查看的 Session 工作区解析;绝对路径仍使用同一 Session 的文件系统访问。`#L24` 和 `#L24-L30` 定位到指定起始行,并复用现有文件标签。文件缺失时显示预览错误状态。
|
|
@@ -41,7 +43,9 @@ kind: "package-reference"
|
|
|
41
43
|
|
|
42
44
|
Session 作用域的 `conversation.chat.user.content` Factory 只渲染用户内容区域:文本、额外内容块、按输入顺序排列的图片/文件附件及引用摘要。[`UserContentInput`](src/client/contract/slots.ts) 携带预处理的 `content`、变换 `facts`、显示 props 和显式 `loadImage`;引用动作由节点自己的 Injection 提供。正文调用共享 `conversation.user.text` Factory,图片调用自身拥有的图片 Slot。直接调用需要 Session 绑定,行包装层由调用方提供。
|
|
43
45
|
|
|
44
|
-
`UserStyleBubble` 和[各来源包装层](<src/client/chat/MessageItem.tsx#
|
|
46
|
+
`UserStyleBubble` 和[各来源包装层](<src/client/chat/MessageItem.tsx#L164-L340>) 保留用户行、key、pending/echo 标记、时间、复制控件及其他消息操作。内容 Factory 不读取来源专属模型或私有 Context,也不是全局用户内容替换入口。
|
|
47
|
+
|
|
48
|
+
官方 user 与 steering 共用的渲染器在 `user` 注册项上声明 session-scoped `conversation.chat.user.before` chain slot,并在气泡上方直接通过 `renderSlotChain` 渲染;`steering` 注册项复用该渲染器但不拥有该槽位。owner props 携带 Session 记录的持久化消息 `source` 与行 `kind`;各条目的 `select` 匹配自己负责的来源,首个非 null 结果作为 `matched` 交给获选组件。无匹配时不显示内容。条目自行拥有标记和文案;Chat 不解析消息来源。
|
|
45
49
|
|
|
46
50
|
独立的 Markdown 图片以内嵌预览显示,点击打开共享图片浮层;本地路径在消息落定后基于当前查看的工作区解析。图片文件链接保持点击打开侧栏,鼠标停留或键盘聚焦时显示缩略图,Esc 关闭缩略图。图片加载失败时保留本地化状态与图片说明;不执行重复图片过滤。
|
|
47
51
|
|
|
@@ -68,10 +72,12 @@ Assistant 尝试结束且没有可见消息时,Chat 隐藏已发布的 Node,
|
|
|
68
72
|
|
|
69
73
|
设置 → 通用设置 → 性能与用量位于繁忙时的发送行为之后、Session Log 上传之前,将 `ui-chat.performanceUsage` 保存为 `detailed`(默认)或 `compact`。简洁模式仅在输入框下方显示可用的输出速度和缓存命中率,不显示统计交互卡片或每轮用量。详细模式提供会话统计和每轮 token 用量。两种模式的已完成轮次页脚均不显示耗时。该偏好仅影响展示,记账和 Session 事件保持完整。
|
|
70
74
|
|
|
71
|
-
输入框统计信息由两个 `conversation.composer.dock` 列表条目组成:`activity`(order 0,轮次数、步骤数与输出速度,以及 LLM 耗时、工具耗时与 TTFT)和 `usage`(order 1,token 总量与缓存命中)。这些控件遵循公共的[统计控件圆角规则](../../../docs/ui-radius.zh.md#radius-scale)。其他插件以相同的 id 和相同的 `order` 注册即可替换某个控件;dock 按 `order` 排列各行,更低的 `priority` 决定由替换者渲染:动态插件会自动获得,静态组合的插件需显式传入。以新 id 注册则新增控件。每个控件在 `data-composer-stat` 中携带其 id。按下 Escape,或在已打开的对话框之外发生 pointerdown
|
|
75
|
+
输入框统计信息由两个 `conversation.composer.dock` 列表条目组成:`activity`(order 0,轮次数、步骤数与输出速度,以及 LLM 耗时、工具耗时与 TTFT)和 `usage`(order 1,token 总量与缓存命中)。这些控件遵循公共的[统计控件圆角规则](../../../docs/ui-radius.zh.md#radius-scale)。其他插件以相同的 id 和相同的 `order` 注册即可替换某个控件;dock 按 `order` 排列各行,更低的 `priority` 决定由替换者渲染:动态插件会自动获得,静态组合的插件需显式传入。以新 id 注册则新增控件。每个控件在 `data-composer-stat` 中携带其 id。按下 Escape,或在已打开的对话框之外发生 pointerdown 或点击时,该对话框会关闭,因此用指针或键盘激活另一个控件会切换对话框,而不会叠加两个。读数被省略号截断时,提示气泡会显示完整读数。带对话框的控件在悬停或键盘聚焦时显示,对话框打开期间不显示;没有对话框的读数在悬停、点击或轻触时显示。会话统计对话框的标题行显示轮次数与步骤数。
|
|
72
76
|
|
|
73
77
|
明确选择会立即更新所有使用方;Host 接受的设置会校正实时值,因此写入被拒绝或尚未应答时保持所选模式,直到 Host 应答。
|
|
74
78
|
|
|
79
|
+
窄屏浏览器设置中,偏好标签与控件的间距缩小;Windows 和 macOS 桌面窗口保留标准间距。
|
|
80
|
+
|
|
75
81
|
偏好菜单在发布新选择之前,先将焦点还给触发按钮,且不引起滚动。
|
|
76
82
|
|
|
77
83
|
<a id="completed-turn-footer"></a>
|
|
@@ -79,7 +85,7 @@ Assistant 尝试结束且没有可见消息时,Chat 隐藏已发布的 Node,
|
|
|
79
85
|
|
|
80
86
|
产物扩展可通过 `ChatNodeStore.turnDataSource` 订阅一个 Turn 中指定类型的节点数据。来源包含隐藏节点,并按锚点顺序提供其业务数据。成员关系增量更新;只有被订阅的集合才生成有序数组,其他 Turn 或类型的更新不通知该集合。
|
|
81
87
|
|
|
82
|
-
已完成轮次的操作页脚位于记录的轮次结束之后。操作行与前方正文或扩展内容相隔 20px
|
|
88
|
+
已完成轮次的操作页脚位于记录的轮次结束之后。操作行与前方正文或扩展内容相隔 20px。只有最新轮次且最后可见内容为回复时,操作常显;其他结尾及历史轮次在悬停或键盘聚焦时显示操作。不支持悬停的设备始终显示操作。分支操作不可用时,鼠标或触摸点击可查看原因,不会创建分支。
|
|
83
89
|
|
|
84
90
|
-----
|
|
85
91
|
|
|
@@ -90,9 +96,9 @@ Assistant 尝试结束且没有可见消息时,Chat 隐藏已发布的 Node,
|
|
|
90
96
|
|
|
91
97
|
Chat 末尾为进行中的 Turn 控制行,且该轮尚无可见输入时,第一条本地 transcript 回显显示在控制行前。其他回显保留在正文末尾。控制行与回显共用一个 keyed 列表,因此控制行到达时不会重新挂载回显。持久输入在同一次渲染中替换匹配的回显。
|
|
92
98
|
|
|
93
|
-
|
|
99
|
+
工作步骤展示模式控制过程组显示与推理预览。简洁、标准、详细模式收起符合条件的已完成轮次,保留所有 Assistant 回复可见,选「仅最终回答」时只保留最终答案;完全展开模式保留时长或状态抬头,但不支持收起,历史过程行直接显示。[业务规则明细](src/client/conversation-nodes/README.zh.md#display-modes) 统一说明模式表、组头行为、整轮折叠资格、时钟与开合重置。
|
|
94
100
|
|
|
95
|
-
工作步骤展示下方的设置行提供[独立的收起时机设置](src/client/conversation-nodes/README.zh.md#collapse-timing)
|
|
101
|
+
工作步骤展示下方的设置行提供[独立的收起时机设置](src/client/conversation-nodes/README.zh.md#collapse-timing)和[「收起后显示的回复」设置](src/client/conversation-nodes/README.zh.md#folded-replies)(`ui-chat.foldedReplies`,完全展开模式下隐藏),二者都通过相同的 Host profile 配置保存。
|
|
96
102
|
|
|
97
103
|
-----
|
|
98
104
|
|
|
@@ -107,11 +113,11 @@ Chat Builder 按节点发布 `bottomSource`:节点可见且属于已加载的
|
|
|
107
113
|
|
|
108
114
|
实时工具 delta 与推理共用按帧合并的发布节奏;持久调用和结果立即发布。原生与嵌套结果保留事件中的展示元数据,使历史文件与命令标签使用执行时的位置。当已读取参数的答案、锚点、位置及可见性均未变化时,重复 delta 保持 Tool 节点不变。Definition 向工具行和分组详情提供同一个懒计算参数读器,无需按工具注册。
|
|
109
115
|
|
|
110
|
-
过程组使用稳定的 `div` 布局盒子、滚动正文及不限高的内容盒子,后者报告正文内部的内容增长。业务样式必须适配组内及组边界间距,处理隐藏或空成员以及回答前的间距特例。`conversation.chat.flow` 插槽添加一个 `display: contents` DOM
|
|
116
|
+
过程组使用稳定的 `div` 布局盒子、滚动正文及不限高的内容盒子,后者报告正文内部的内容增长。业务样式必须适配组内及组边界间距,处理隐藏或空成员以及回答前的间距特例。`conversation.chat.flow` 插槽添加一个 `display: contents` DOM 锚点;行选择器直接匹配该锚点,不重复匹配其正文容器祖先。运行状态与各行共享父级,使分隔线使用同一套可见兄弟节点规则。锚点自身不产生间距。更早历史控件紧邻流锚点之前,两者的兄弟关系决定首行间距。CSS 变量不属于 Group Definition。
|
|
111
117
|
|
|
112
|
-
运行中的分组标题、思考预览、工具与命令行、当前重试行以及底部运行状态使用共享的 [TextShimmer](../ui-primitives/README.zh.md#component-catalog)
|
|
118
|
+
运行中的分组标题、思考预览、工具与命令行、当前重试行以及底部运行状态使用共享的 [TextShimmer](../ui-primitives/README.zh.md#component-catalog)。每行的文字共用一道从左到右的高光,包括折叠的分组标题;图标和悬停箭头保留底色。普通流程行之间相隔 4px;展开的分组标题与内容之间相隔 8px;Assistant 回复与相邻过程行之间相隔 12px;每轮完成/耗时控件与其输入、以及紧随其后的可见行之间保留 16px。控件与回复之间隔着已收起的行时,回复保持 12px 回复间距,因此折叠不会改变它的间距。隐藏行与空行(包括保留的空 slot 锚点)不产生间距。“深度求索”运行文字保留蓝色底色,并使用主题专用高光扫过文字。
|
|
113
119
|
|
|
114
|
-
运行状态显示一只鲸鱼,其 APNG 遮罩继承文字颜色。启用减少动态效果或强制颜色模式、或浏览器不支持 alpha 遮罩时,CSS 选择静态 SVG
|
|
120
|
+
运行状态显示一只鲸鱼,其 APNG 遮罩继承文字颜色。启用减少动态效果或强制颜色模式、或浏览器不支持 alpha 遮罩时,CSS 选择静态 SVG。APNG 是插件样式表引用的[包资源](../AGENTS.md#dependency-declaration);React 不通过 DOM 样式传递图片数据。
|
|
115
121
|
|
|
116
122
|
滚动边缘渐隐在 `ResizeObserver` 报告已展开组的布局后初始化;展开组时不会在 layout effect 中立即读取滚动尺寸。
|
|
117
123
|
|
|
@@ -130,7 +136,7 @@ Chat 节点 slot 为推理与工具注入绑定重置来源的 `useDisclosure`
|
|
|
130
136
|
|
|
131
137
|
Chat 等待初始历史就绪后,才允许自动内容、滚动或尺寸更新初始化阅读状态。进行中的 Session 先恢复初始显隐和位置,再允许折叠动画。
|
|
132
138
|
|
|
133
|
-
Chat 会在历史前插与 renderer 重新挂载时恢复语义锚点,并且只在跟随底部时禁用自己滚动区域的浏览器自动锚定。没有读者移动的贴底滚动事件,以及到达底部(容许小于 1px 的取整误差)的读者输入,会立即更新跟随归属,避免后续布局变化使其底部位置失效。其他读者移动即使位于跟随阈值内,也保持待处理直到采样周期或 `scrollend`,防止布局增长抵消小幅滚动操作。采用完成时收起时,提交正文输入或 steering
|
|
139
|
+
Chat 会在历史前插与 renderer 重新挂载时恢复语义锚点,并且只在跟随底部时禁用自己滚动区域的浏览器自动锚定。没有读者移动的贴底滚动事件,以及到达底部(容许小于 1px 的取整误差)的读者输入,会立即更新跟随归属,避免后续布局变化使其底部位置失效。其他读者移动即使位于跟随阈值内,也保持待处理直到采样周期或 `scrollend`,防止布局增长抵消小幅滚动操作。采用完成时收起时,提交正文输入或 steering 会立即恢复跟随底部,并清除先前待处理的读者滚动采样。采用下次消息时收起时,没有折叠批次承载的正文输入用一次原生动画落到底部;steering 在两种时机下都立即落到底部,因为运行中的 Turn 仍在其回显上方持续输出。读者跟随底部时,`ResizeObserver` 追随新的底部,并且无需读取行几何就选中最后一个已加载轮次;读者离开底部后,高度变化会保持顶部位置,再由阅读线几何选择活跃轮次。轮次导航预览位于 Markdown 代码块粘性头栏上方,而导航外框始终处于 composer 上方的 transcript 区域内。
|
|
134
140
|
|
|
135
141
|
轮次轨道与回到底部按钮位于正文裁剪层外。它们相对共享会话滚动容器做 sticky 定位;Chat 自己持有滚动容器时,则相对 Chat 外框做 absolute 定位。正文扣除水平内边距后的可用宽度不超过 900px 时,隐藏轮次轨道;判断依据不是浏览器视口宽度。
|
|
136
142
|
|
|
@@ -138,7 +144,9 @@ Chat 会在历史前插与 renderer 重新挂载时恢复语义锚点,并且
|
|
|
138
144
|
|
|
139
145
|
外层文本记录与每个已展开限高组的跟随状态彼此独立。原生动画的中间滚动保留跟随意图;只有该滚动容器自身的 `scrollend` 才结束其动画。不支持 `scrollend` 的浏览器可能保留原生跟随目标,直到后续贴底更新或读者手势将其结束。读者手势中断动画,是否继续跟随由实际位移决定。滚动传递可以带动外层,外层再按自身离底距离判断。回到底部按钮只恢复外层跟随。
|
|
140
146
|
|
|
141
|
-
下次消息触发的折叠中,每一批收起行与滚动容器在同一个帧时钟上推进,折叠期间禁用浏览器滚动锚定;不存在「先预留、再跟随」的另一条路径。批次运行期间开始收起或展开的行先保持当前尺寸,等当前批次落定后在下一批中变化;批次从每一行已有的尺寸继续。由本客户端自己的输入(包括子代理会话的 continuation
|
|
147
|
+
下次消息触发的折叠中,每一批收起行与滚动容器在同一个帧时钟上推进,折叠期间禁用浏览器滚动锚定;不存在「先预留、再跟随」的另一条路径。批次运行期间开始收起或展开的行先保持当前尺寸,等当前批次落定后在下一批中变化;批次从每一行已有的尺寸继续。由本客户端自己的输入(包括子代理会话的 continuation)触发、或读者原本在跟尾时,这一批落到底部;其余情况下,无论消息由谁发出,读者正在看的内容保持不动。批次因内容变化接管跟随时(例如下一条输入在等待时一轮结束),上次绘制以来批次之外的内容增长在第一帧之前由滚动位置吸收,与跟随吸收流式增长的方式相同,批次只为自己的行做动画;随读者自己的输入到达的增长则随批次动画落定。阅读线以上的内容不会回滑:保留的正文和新内容填不满视口时,只把差额保留为底部空间,后续新增内容先填满它,再继续跟尾。读者手势取消自动目标及进行中的原生跟随;同一次折叠中的尺寸变化不能恢复它,但新提交的输入可以。已确认的滚动只释放不会造成位置钳制的多余空间。卸载 Chat 时取消等待回调和行过渡。启用减少动态效果偏好时,可见性和定位立即变化。
|
|
148
|
+
|
|
149
|
+
完成时收起会一次性收起一轮的工作行。读者跟随底部时,收起前第一个可见行保持屏幕位置;若该行本身被收起,则由收起前在屏幕上位于其后的第一个保留行保持不动,没有这样的行时才由其上方最近的保留行保持不动。底部空间填补空缺,最多半个滚动区域高度,后续增长先占用这部分空间,跟随才继续前进。
|
|
142
150
|
|
|
143
151
|
切换工作步骤展示档位时,当前折叠结束后清空底部预留空间,并按所选档位调整滚动范围。原本跟随底部的读者保持在新的底部;其他读者不会被强制拉回底部。
|
|
144
152
|
|
|
@@ -172,6 +180,10 @@ Chat 会在历史前插与 renderer 重新挂载时恢复语义锚点,并且
|
|
|
172
180
|
|
|
173
181
|
-----
|
|
174
182
|
|
|
183
|
+
Chat view 在标记了 `data-text-interaction-source` 的业务节点上检测选区和右键手势。选区两端必须定位到同一个来源容器。已展示的用户内容和已完成的 Assistant 文本或 reasoning 参与交互;Tool、注入上下文、流式或中断的 Assistant 文本以及 Markdown 控件不参与。
|
|
184
|
+
|
|
185
|
+
`ctx.uiConversation.interactions` 将有效手势分发给插件注册项,并把对应组件交给 Chat view。操作展示位置在已有 Chat 列内绝对定位,限制在 composer seat 及其 dock 上方。外层容器保留组件的外描边与阴影,内部滚动由组件负责。选区滚出该可见范围时暂时隐藏操作,滚回后恢复。Chat 负责视口可见性、定位、外部指针按下、Escape、新选区、来源失效与卸载清理;主动关闭保留浏览器选区,布局变化不会重新打开操作。[Message quotes](../../session/message-quotes/README.zh.md) 负责引用的接管条件和插入。
|
|
186
|
+
|
|
175
187
|
<a id="model-experience"></a>
|
|
176
188
|
## 模型体验
|
|
177
189
|
|
|
Binary file
|