@deepseek-ai/dsh-client-ui-chat 0.2.1-alpha.1 → 0.2.1-alpha.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.
Files changed (44) hide show
  1. package/README.i18n.yaml +12 -12
  2. package/README.md +32 -10
  3. package/README.zh.md +32 -10
  4. package/lib/client.js +5764 -5695
  5. package/lib/index.js +11 -1
  6. package/lib/types/chat-settings.d.ts +13 -0
  7. package/lib/types/client/apply.d.ts +5 -0
  8. package/lib/types/client/chat/AssistantMarkdown.d.ts +7 -6
  9. package/lib/types/client/chat/AssistantNodeView.d.ts +3 -3
  10. package/lib/types/client/chat/ChatFlow.d.ts +4 -0
  11. package/lib/types/client/chat/ChatGroupSeat.d.ts +4 -3
  12. package/lib/types/client/chat/ChatNodeSeat.d.ts +11 -8
  13. package/lib/types/client/chat/ChatView.d.ts +1 -1
  14. package/lib/types/client/chat/MessageItem.d.ts +10 -9
  15. package/lib/types/client/chat/ReasoningContent.d.ts +16 -0
  16. package/lib/types/client/chat/ReasoningRow.d.ts +5 -3
  17. package/lib/types/client/chat/TurnTailNodeView.d.ts +1 -1
  18. package/lib/types/client/chat/UserContent.d.ts +9 -0
  19. package/lib/types/client/chat/flow-motion.d.ts +103 -0
  20. package/lib/types/client/chat/searchable-hidden.d.ts +10 -2
  21. package/lib/types/client/chat/turn-trigger.d.ts +1 -1
  22. package/lib/types/client/chat/use-chat-reading.d.ts +22 -4
  23. package/lib/types/client/chat/use-chat-scroll.d.ts +9 -1
  24. package/lib/types/client/chat/use-chat-viewport.d.ts +63 -4
  25. package/lib/types/client/chat/use-scroll-follow.d.ts +4 -3
  26. package/lib/types/client/contract/chat-nodes.d.ts +8 -0
  27. package/lib/types/client/contract/group-tree.d.ts +32 -0
  28. package/lib/types/client/contract/slots.d.ts +133 -20
  29. package/lib/types/client/contract/snapshot.d.ts +5 -0
  30. package/lib/types/client/contract/store.d.ts +3 -1
  31. package/lib/types/client/contract/turn-process.d.ts +0 -2
  32. package/lib/types/client/conversation-nodes/common.d.ts +12 -1
  33. package/lib/types/client/conversation-nodes/group-tree-segments.d.ts +42 -0
  34. package/lib/types/client/index.d.ts +2 -1
  35. package/lib/types/client/locale.d.ts +12 -2
  36. package/lib/types/client/performance-usage.d.ts +2 -2
  37. package/lib/types/client/presentation-policy.d.ts +14 -15
  38. package/lib/types/client/settings/TranscriptViewRow.d.ts +7 -2
  39. package/lib/types/client/stores.d.ts +11 -1
  40. package/lib/types/client/transcript-view.d.ts +9 -1
  41. package/lib/types/index.d.ts +5 -1
  42. package/locale/en.json +5 -0
  43. package/locale/zh.json +6 -0
  44. package/package.json +44 -44
@@ -17,9 +17,20 @@ export interface ViewportLanding {
17
17
  }
18
18
  interface ViewportEvents {
19
19
  scroll: (event: ViewportScroll) => void;
20
- scrollEnd: () => void;
20
+ scrollEnd: (outer: boolean) => void;
21
21
  resize: () => void;
22
22
  interact: () => void;
23
+ /** Any reading gesture, before paging ownership is consulted. */
24
+ intent?: () => void;
25
+ }
26
+ /** Reading policy that fold batches consult and report tail landings to. */
27
+ export interface FoldReader {
28
+ /** Follow intent at batch start selects the tail landing; tail landings commit it. */
29
+ readonly follow: ScrollFollow;
30
+ /** @param landing - the actual geometry after a batch landed at the tail. */
31
+ readonly landedAtTail: (landing: ViewportLanding) => void;
32
+ /** @returns whether reader movement awaits sampling; until then follow intent is undecided. */
33
+ readonly pending: () => boolean;
23
34
  }
24
35
  /** Owns one Chat scrollport's DOM operations, event listeners, and size observer. */
25
36
  export declare class ChatViewport {
@@ -29,6 +40,13 @@ export declare class ChatViewport {
29
40
  private turns;
30
41
  private observation;
31
42
  private paging;
43
+ private reader;
44
+ /** The pending or running fold batch lands at the tail. */
45
+ private tailRequested;
46
+ /** Switches the running batch to a tail landing; null while no batch runs. */
47
+ private retarget;
48
+ /** Transition state and row callbacks owned by this viewport's attachment. */
49
+ readonly motion: import("./flow-motion.ts").FlowMotion;
32
50
  /**
33
51
  * Bind to the containing scrollport and observe content and viewport sizes.
34
52
  * @param list - Chat root inside an optional shared conversation scrollport.
@@ -55,6 +73,45 @@ export declare class ChatViewport {
55
73
  get latestTurn(): number | null;
56
74
  /** Discard geometry-dependent landing knowledge while retaining scroll attribution. */
57
75
  invalidate(): void;
76
+ private spacerHeight;
77
+ private setSpacer;
78
+ /**
79
+ * Connect the reading policy that fold batches consult.
80
+ * @param reader - follow intent and the tail-landing commit.
81
+ * @returns a disposer that disconnects only this reader.
82
+ */
83
+ bindReader(reader: FoldReader): () => void;
84
+ /**
85
+ * Land the pending or running fold batch at the tail instead of starting a separate scroll.
86
+ * @param follow - follow controller whose native animation yields to the batch.
87
+ * @returns whether a fold owns the tail movement.
88
+ */
89
+ followInputFold(follow: ScrollFollow): boolean;
90
+ /**
91
+ * Drive one fold batch on its frame clock. A tail landing ends at the floor, never above the reader's
92
+ * compensated position; a reader landing keeps the visible content still. Both install only the room
93
+ * the landing lacks.
94
+ * @returns the batch driver, or null while detached or without a reading policy.
95
+ */
96
+ private foldDriver;
97
+ /**
98
+ * Find the first visible top-level row at or below the scrollport top that holds no batch box.
99
+ * Binary search over the ordered top-level rows reads O(log n) boxes.
100
+ * @returns the reference row, or null when every visible row folds.
101
+ */
102
+ private readingReference;
103
+ /** Clear fold reservations after a display-mode change, allowing the scroll range to shrink. */
104
+ resetBelow(): void;
105
+ /**
106
+ * Give reserved room back after acknowledged scrolling or content growth without clamping the reader.
107
+ * Holds still during folds and unsampled movement; following includes the room that remains.
108
+ */
109
+ reclaimBelow(): void;
110
+ /**
111
+ * Stop an outstanding native follow animation at its current position before a reading gesture.
112
+ * @param follow - follow controller bound to this scrollport.
113
+ */
114
+ interruptFollow(follow: ScrollFollow): void;
58
115
  /**
59
116
  * Accept a sampled reader position without retaining a known landing.
60
117
  * @param metrics - settled reader position used as the next attribution baseline.
@@ -121,11 +178,13 @@ export declare class ChatViewport {
121
178
  */
122
179
  preserve(): ViewportLanding | null;
123
180
  /**
124
- * Align the scrollport with its current floor.
181
+ * Align with the physical floor, including fold room that newer content has not yet filled.
125
182
  * @param follow - independent follow intent and scrolling controller.
126
- * @returns the actual floor landing, or null while detached.
183
+ * @param behavior - immediate positioning, or one native animation for a reader-caused tail change.
184
+ * @returns the actual floor landing, or null while detached. A smooth landing reports the starting
185
+ * position; native scroll delivery moves it.
127
186
  */
128
- scrollToBottom(follow: ScrollFollow): ViewportLanding | null;
187
+ scrollToBottom(follow: ScrollFollow, behavior?: 'instant' | 'smooth'): ViewportLanding | null;
129
188
  private align;
130
189
  private write;
131
190
  private readonly onScroll;
@@ -1,4 +1,4 @@
1
- /** Scroll position, maximum top, and viewport height from one geometry read. */
1
+ /** Scroll position, caller-supplied floor, and viewport height; raw measurements use the physical floor. */
2
2
  export interface ViewportMetrics {
3
3
  readonly top: number;
4
4
  readonly floor: number;
@@ -80,11 +80,12 @@ export declare class ScrollFollow {
80
80
  jump(element: HTMLElement, metrics: ViewportMetrics, top: number): ViewportMetrics;
81
81
  /**
82
82
  * Follow the measured floor, respecting reduced motion for smooth requests.
83
- * An outstanding smooth target finishes before another is issued.
83
+ * Smooth requests preserve an outstanding target; immediate follow updates
84
+ * retarget active motion when content changes the floor.
84
85
  * Within-tolerance positioning is immediate while no animation is outstanding.
85
86
  * @param element - scrolling element.
86
87
  * @param metrics - current geometry.
87
- * @param behavior - native animation for growth, or immediate positioning.
88
+ * @param behavior - native animation for growth, or immediate positioning unless motion is already active.
88
89
  * @returns current geometry; smooth requests retain their starting position until native scroll delivery.
89
90
  */
90
91
  toBottom(element: HTMLElement, metrics: ViewportMetrics, behavior: 'instant' | 'smooth'): ViewportMetrics;
@@ -1,10 +1,18 @@
1
1
  import type { AssistantBlock, AssistantMessageNode, CommandNode, CompactionSummaryNode, ConversationLocation, ConversationViewNode, ModelRetryNode, RunningToolCall, ToolCallBlock } from '@deepseek-ai/dsh-client-ui-conversation/client';
2
+ import type { ChatGroupTree } from './group-tree.ts';
2
3
  /** Final Chat render unit produced by a Chat business Definition. */
3
4
  export interface ChatConversationViewNode extends ConversationViewNode {
4
5
  readonly target: 'chat';
5
6
  readonly anchorSeq: number;
6
7
  readonly location: ConversationLocation;
7
8
  readonly visibility: 'visible' | 'hidden';
9
+ /**
10
+ * Group-tree position, visible or hidden; absence joins the surrounding step
11
+ * run. An `exchange` Node's Turn and every later Turn before the next opening
12
+ * Turn form one exchange; the latest loaded exchange starts at the last loaded
13
+ * opening Turn, or at the first loaded Turn when none is loaded.
14
+ */
15
+ readonly groupTree?: ChatGroupTree | undefined;
8
16
  }
9
17
  /** Merge-extensible payload registry keyed by final Chat renderer kind. */
10
18
  export interface ChatNodeDataMap {
@@ -0,0 +1,32 @@
1
+ import type { ChatConversationViewNode } from './chat-nodes.ts';
2
+ /**
3
+ * Chat group-tree positions from the outermost inward; a Node at a position
4
+ * also has the effect of every inner position.
5
+ * - `exchange`: the Node's Turn opens an exchange, the run of Turns that lasts
6
+ * until the next opening Turn.
7
+ * - `input`: the Node is an input of its Turn. An input before the Turn's
8
+ * process is the Turn's opening input; a later one is interleaved and keeps
9
+ * the whole Turn open.
10
+ * - `turn`: the Node stays in its Turn outside the Turn's process disclosure.
11
+ * - `process`: the Node stays in the process disclosure outside step runs.
12
+ * - absent: the Node joins the step run around it.
13
+ *
14
+ * The Definition that builds a Node chooses its position, and step runs, the
15
+ * process disclosure, and Turn inputs are selected by position. An
16
+ * `assistant-step` Node places its rows without one: its reasoning row joins
17
+ * the step run and its reply row stands outside it.
18
+ *
19
+ * Whole-Turn folding also exempts the finalized answer's reply. That exemption
20
+ * comes from the Turn's process specification (`answerAnchorSeq` and
21
+ * `answerStep`), not from a position, because which step answers changes as
22
+ * later steps arrive.
23
+ */
24
+ export type ChatGroupTree = 'exchange' | 'input' | 'turn' | 'process';
25
+ /**
26
+ * Test whether a Node stands at a group-tree position or outside it.
27
+ * @param node - Chat Node.
28
+ * @param position - group-tree position to compare against.
29
+ * @returns whether the Node's position is `position` or an outer one.
30
+ */
31
+ export declare function isAtOrOutside(node: Pick<ChatConversationViewNode, 'groupTree'>, position: ChatGroupTree): boolean;
32
+ //# sourceMappingURL=group-tree.d.ts.map
@@ -1,12 +1,17 @@
1
1
  /** Chat-owned Slot declarations and composed component props. */
2
+ import type { RefObject } from 'react';
2
3
  import type { MessageId } from '@deepseek-ai/dsh-llm/brand';
3
4
  import type { SessionId, SessionSeq } from '@deepseek-ai/dsh-session/types';
4
- import type { CommandNode, CompactionSummaryNode, ConversationLocationDataStore, ConversationTurnDataMap, ConversationGroupData, GroupSnapshot, MessageImageLoader, MessageImagesOwnerProps, RenderMessageImages, TurnLocation } from '@deepseek-ai/dsh-client-ui-conversation/client';
5
- import type { HostObservable, InjectFace, KeyedSnapshotSelectorHook, PropsLocale, PropsRenderSlots, PropsRuntime, PropsStore, SlotHookFactory, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots';
5
+ import type { PendingSubmission } from '@deepseek-ai/dsh-api-session-controller/client';
6
+ import type { FileAttachmentRef } from '@deepseek-ai/dsh-attachment';
7
+ import type { InboxState } from '@deepseek-ai/dsh-agent/types';
8
+ import type { CommandNode, CompactionSummaryNode, ConversationLocationDataStore, ConversationTurnDataMap, ConversationGroupData, GroupSnapshot, MessageImageLoader, MessageImageSource, MessageImagesOwnerProps, RenderEntry, TurnLocation, UserTextFacts, UserTextInput } from '@deepseek-ai/dsh-client-ui-conversation/client';
9
+ import type { HostObservable, InjectFace, KeyedSnapshotSelectorHook, PropsLocale, PropsRenderSlots, PropsRuntime, PropsRenderFactories, PropsStore, SlotHookFactory, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots';
6
10
  import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
7
- import type { MarkdownFileMentions } from '@deepseek-ai/dsh-client-ui-primitives';
11
+ import type { MarkdownFileMentions, MarkdownLabels } from '@deepseek-ai/dsh-client-ui-primitives';
8
12
  import type { createChatStore } from '../stores.ts';
9
13
  import type { ChatPresentationPolicy } from '../presentation-policy.ts';
14
+ import type { FlowMotionRows } from '../chat/flow-motion.ts';
10
15
  import type { ToolCallId } from './store.ts';
11
16
  import type { ChatConversationViewNode, ChatNode, ChatNodeKind } from './chat-nodes.ts';
12
17
  import type { ChatNodeProcessSource, ChatNodeSource, ChatSnapshot, ChatTurnProcessPresentation } from './snapshot.ts';
@@ -48,6 +53,18 @@ export interface QuotaNoticeState {
48
53
  /** Per-publication sequence; the host keys its surface by it. */
49
54
  seq: number;
50
55
  }
56
+ /** Original model-provided reasoning offered to the expanded Body Slot. */
57
+ export interface ReasoningBodyOwnerProps {
58
+ /** Complete or streaming reasoning text. */
59
+ readonly text: string;
60
+ /** Whether the reasoning tail is still streaming. */
61
+ readonly running: boolean;
62
+ }
63
+ /** Session-independent original or derived display input to the Content Factory. */
64
+ export interface ReasoningContentInput extends ReasoningBodyOwnerProps {
65
+ /** Localized Markdown controls, used unchanged when supplied; omission uses Chat's defaults. */
66
+ readonly labels?: MarkdownLabels;
67
+ }
51
68
  /** Owner currency of one quota notice offered to the frame-wide chain. */
52
69
  export interface QuotaNoticeOwnerProps {
53
70
  /** Stable failure code retained in the Session log. */
@@ -109,16 +126,42 @@ export type UseDisclosure = () => {
109
126
  readonly setExpanded: (open: boolean) => void;
110
127
  readonly toggle: () => void;
111
128
  };
112
- /** Stable sources bound to one rendered Chat Node. */
129
+ /**
130
+ * Searchable process hiding bound to the current node render's viewport.
131
+ * @param hidden - desired hidden state.
132
+ * @param reveal - browser-find and focus-protection callback.
133
+ * @returns the stable process-container ref.
134
+ */
135
+ export type UseGroupAction = (hidden: boolean, reveal: () => void) => RefObject<HTMLDivElement>;
136
+ /**
137
+ * Plain header visibility bound to the flow's viewport, including growth on reveal.
138
+ * @param ref - stable header element.
139
+ * @param hidden - desired hidden state.
140
+ */
141
+ export type UseGroupHeaderAction = (ref: RefObject<HTMLElement | null>, hidden: boolean) => void;
142
+ /** Viewport capability supplied once for each rendered Chat flow. */
143
+ export interface ChatFlowHookContext {
144
+ readonly motion: FlowMotionRows;
145
+ }
146
+ /** Flow-wide behavior hooks bound to one viewport, independently of Session identity. */
147
+ export interface ChatFlowInjected {
148
+ hooks: {
149
+ groupAction: SlotHookFactory<'conversation.chat.flow', UseGroupAction>;
150
+ groupHeaderAction: SlotHookFactory<'conversation.chat.flow', UseGroupHeaderAction>;
151
+ };
152
+ }
153
+ /** Stable sources and capabilities bound to one rendered Chat Node. */
113
154
  export interface ChatNodeHookContext {
114
155
  readonly turnData: ConversationLocationDataStore<ConversationTurnDataMap> | undefined;
115
156
  readonly disclosureReset: ObservableSnapshot<number>;
157
+ readonly useGroupAction: UseGroupAction;
116
158
  }
117
159
  /** Slot-level Hook factories for keyed Chat renderers. */
118
160
  export interface ChatNodeInjected {
119
161
  hooks: {
120
162
  turnData: SlotHookFactory<'conversation.chat.node', UseChatNodeTurnData>;
121
163
  disclosure: SlotHookFactory<'conversation.chat.node', UseDisclosure>;
164
+ groupAction: SlotHookFactory<'conversation.chat.node', UseGroupAction>;
122
165
  };
123
166
  }
124
167
  /** Stable owner currency delivered to a keyed Chat renderer. */
@@ -126,23 +169,38 @@ export interface ChatNodeOwnerProps {
126
169
  /** Renderer-owned Node portion selected by the grouping Definition. */
127
170
  groupPart?: string;
128
171
  cwd?: string | undefined;
129
- /** Open the current source file of a skill referenced by a sent message. */
130
- openSkill: (name: string) => void;
131
172
  openFile: (path: string, options?: OpenFileOptions) => void;
132
173
  inspectCall: ((callId: ToolCallId) => void) | undefined;
133
174
  forkAt: (seq: number) => void;
134
- /**
135
- * Session-authorized image loader, down-threaded from the Chat view so a
136
- * chat-node renderer can render the attachment presentation slot directly
137
- * with only the durable references plus this loader, instead of receiving a
138
- * rendering closure.
139
- */
175
+ /** Session-authorized image loader supplied by the Chat view. */
140
176
  loadImage: MessageImageLoader;
141
- renderMessageImages: RenderMessageImages;
142
177
  fileMentions: (owner: TurnTailOwnerProps) => MarkdownFileMentions | undefined;
143
178
  /** Turn-process state when this Node belongs to a projected Turn. */
144
179
  turnProcess?: TurnProcessOwnerProps | undefined;
145
180
  }
181
+ /** One attachment in the original user-message display order. */
182
+ export type UserContentAttachment = {
183
+ readonly type: 'image';
184
+ readonly image: MessageImageSource;
185
+ } | {
186
+ readonly type: 'file';
187
+ readonly file: FileAttachmentRef;
188
+ };
189
+ /** Prepared user contents without row identity, admission state, time, or actions. */
190
+ export interface UserContentData {
191
+ readonly text: string;
192
+ readonly attachments: readonly UserContentAttachment[];
193
+ /** Blocks not represented by text or attachment presentation. */
194
+ readonly extraBlocks: readonly unknown[];
195
+ /** Labels displayed in the caller-provided reference summary. */
196
+ readonly referenceLabels?: readonly string[];
197
+ }
198
+ /** Public content rendering input; reference renderers own their injected actions. */
199
+ export interface UserContentInput extends Pick<ChatNodeOwnerProps, 'loadImage'>, Pick<UserTextInput, 'interactive' | 'ellipsis'> {
200
+ readonly content: UserContentData;
201
+ /** Transform inputs passed unchanged to UserText, separate from summary and rendering props. */
202
+ readonly facts: Readonly<Partial<UserTextFacts>>;
203
+ }
146
204
  /** Shared presentation state for one Turn-process answer generation. */
147
205
  export interface TurnProcessOwnerProps {
148
206
  /** Process content eligible to share one Turn-level disclosure. */
@@ -160,7 +218,7 @@ export interface PresentationInjected {
160
218
  };
161
219
  }
162
220
  /** Full props of one keyed Chat renderer. */
163
- export type ChatNodeViewProps<Kind extends ChatNodeKind = ChatNodeKind> = PropsRuntime<'conversation.chat.node', Kind> & PropsLocale<'chat'>;
221
+ export type ChatNodeViewProps<Kind extends ChatNodeKind = ChatNodeKind> = PropsRuntime<'conversation.chat.node', Kind> & PropsLocale<'chat'> & PropsRenderFactories;
164
222
  /** Command-row owner share. */
165
223
  export interface CommandRowOwnerProps {
166
224
  node: CommandNode;
@@ -192,13 +250,13 @@ export interface ChatViewInjected {
192
250
  keyedHooks: {
193
251
  /** Resolve the stable source for one Chat Node key. */
194
252
  chatNode: (key: string) => ChatNodeSource;
253
+ /** Observe assembler-owned bottom membership for one Node. */
254
+ chatNodeBottom: (key: string) => ObservableSnapshot<boolean>;
195
255
  /** Resolve the stable Turn-process source for one Chat Node key. */
196
256
  chatNodeProcess: (key: string) => ChatNodeProcessSource;
197
257
  /** Resolve one optional group without subscribing the root View to its data. */
198
258
  chatGroup: (key: string) => ObservableSnapshot<GroupSnapshot<ConversationGroupData<'chat'>> | undefined> | undefined;
199
259
  };
200
- /** Open the current source file of a skill referenced by a sent message. */
201
- openSkill: (name: string) => void;
202
260
  /** Open one HTTP(S) message link at the selected destination, using an external tab if Sidebar Browser is unavailable. */
203
261
  openExternalLink: (url: string) => void;
204
262
  openFile: (path: string, options?: OpenFileOptions) => Promise<void>;
@@ -213,10 +271,21 @@ export interface ChatViewInjected {
213
271
  forkAt: (seq: number) => void;
214
272
  fileMentions: (owner: TurnTailOwnerProps) => MarkdownFileMentions | undefined;
215
273
  }
274
+ /** Existing Session-owned node sources shared by the view and its flow renderer. */
275
+ export type ChatFlowDataInjected = Pick<ChatViewInjected, 'hooks' | 'keyedHooks'>;
276
+ /** Ordered rows and reconciled local echoes rendered inside one Chat viewport. */
277
+ export interface ChatFlowOwnerProps extends Pick<ChatNodeOwnerProps, 'cwd' | 'openFile' | 'inspectCall' | 'forkAt' | 'loadImage' | 'fileMentions'> {
278
+ readonly entries: readonly RenderEntry[];
279
+ readonly pendingInputs: readonly (PendingSubmission | InboxState['next-step'][number])[];
280
+ readonly lastInputTurn: number | undefined;
281
+ readonly deferCollapse: boolean;
282
+ }
283
+ /** Full props of the Chat-owned flow renderer. */
284
+ export type ChatFlowSlotProps = PropsRuntime<'conversation.chat.flow'> & PropsRenderSlots<'conversation.chat.node'> & PropsRenderFactories & PropsStore<ChatStore> & InjectFace<ChatFlowDataInjected> & PropsLocale<'chat'>;
216
285
  /** Full Chat view props. */
217
- export type ChatViewSlotProps = PropsRuntime<'conversation.view'> & PropsRenderSlots<'conversation.chat.node' | 'conversation.message.images'> & PropsStore<ChatStore> & InjectFace<ChatViewInjected> & PropsLocale<'chat'>;
218
- /** Full props of the durable-message image renderer. */
219
- export type MessageImagesProps = PropsRuntime<'conversation.message.images'> & PropsLocale<'conversation'>;
286
+ export type ChatViewSlotProps = PropsRuntime<'conversation.view'> & PropsRenderSlots<'conversation.chat.flow'> & PropsStore<ChatStore> & InjectFace<ChatViewInjected> & PropsLocale<'chat'>;
287
+ /** Full props shared by the user and output image entries. */
288
+ export type MessageImagesProps = PropsRuntime<'conversation.chat.user.images' | 'conversation.chat.message.images'> & PropsRenderFactories;
220
289
  declare module '@deepseek-ai/dsh-client-ui-slots' {
221
290
  interface SessionStandardProps {
222
291
  /** Selector hook over the current Conversation binding's Chat target. */
@@ -226,7 +295,35 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
226
295
  /** Chat target, transcript node, statistics, and details copy. */
227
296
  chat: import('../locale.ts').ChatKey;
228
297
  }
298
+ interface SlotFactoryMap {
299
+ /** Prepared user text, attachments, and references inside a caller-owned message row. */
300
+ 'conversation.chat.user.content': {
301
+ scope: 'session';
302
+ props: UserContentInput;
303
+ locale: 'chat';
304
+ children: {
305
+ 'conversation.chat.user.images': {
306
+ kind: 'single';
307
+ scope: 'session';
308
+ };
309
+ };
310
+ };
311
+ /** Session-independent reasoning Markdown with Chat labels and compact typography. */
312
+ 'conversation.chat.reasoning.content': {
313
+ scope: 'root';
314
+ props: ReasoningContentInput;
315
+ locale: 'chat';
316
+ };
317
+ }
229
318
  interface SlotMap {
319
+ /** Ordered Chat rows and local echoes with viewport-bound visibility hooks. */
320
+ 'conversation.chat.flow': {
321
+ kind: 'single';
322
+ scope: 'session';
323
+ owner: ChatFlowOwnerProps;
324
+ hookContext: ChatFlowHookContext;
325
+ inject: ChatFlowInjected;
326
+ };
230
327
  /**
231
328
  * Final Chat node renderer, keyed by `ChatNodeKind`. The component receives
232
329
  * the typed node, shared Chat actions, and Turn-data hook. Reusing a key
@@ -249,7 +346,13 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
249
346
  * supplies image references, an authorized loader, and alignment. A
250
347
  * registration replaces the shipped gallery; without one, images are omitted.
251
348
  */
252
- 'conversation.message.images': {
349
+ 'conversation.chat.message.images': {
350
+ kind: 'single';
351
+ scope: 'session';
352
+ owner: MessageImagesOwnerProps;
353
+ };
354
+ /** User-message images, including pending and local-echo previews, independently replaceable from output images. */
355
+ 'conversation.chat.user.images': {
253
356
  kind: 'single';
254
357
  scope: 'session';
255
358
  owner: MessageImagesOwnerProps;
@@ -264,6 +367,16 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
264
367
  scope: 'session';
265
368
  owner: CommandRowOwnerProps;
266
369
  };
370
+ /**
371
+ * Expanded reasoning body with the unchanged model text. The official entry
372
+ * has priority 100 and calls the reasoning Content Factory; smaller priority
373
+ * values replace it. Contributions must preserve access to the original text.
374
+ */
375
+ 'conversation.chat.reasoning.body': {
376
+ kind: 'single';
377
+ scope: 'session';
378
+ owner: ReasoningBodyOwnerProps;
379
+ };
267
380
  /**
268
381
  * Ordered feature contributions before a completed Turn's action row. Each
269
382
  * entry receives the Turn, closing sequence, and file opener. A fresh `id`
@@ -23,6 +23,11 @@ export interface ChatNodeStore {
23
23
  get(key: string): ChatConversationViewNode | undefined;
24
24
  /** @param key - stable Conversation Context key. @returns its identity-stable observable source. */
25
25
  source(key: string): ChatNodeSource;
26
+ /**
27
+ * @param key - Chat Node identity.
28
+ * @returns whether the visible Node belongs to the latest loaded exchange (see `ChatConversationViewNode.groupTree`).
29
+ */
30
+ bottomSource(key: string): ObservableSnapshot<boolean>;
26
31
  /**
27
32
  * Observe one Turn's data for a single Node kind, including hidden Nodes, in anchor order.
28
33
  * Other Turns and kinds do not notify this source.
@@ -1,10 +1,12 @@
1
1
  /** Chat-owned per-Session view state. */
2
2
  /** Tool call identity as carried by Chat nodes. */
3
3
  export type ToolCallId = string;
4
- /** One manually expanded Turn answer generation. */
4
+ /** One manual whole-Turn disclosure choice for a Turn answer generation. */
5
5
  export interface TurnProcessViewEntry {
6
6
  readonly turn: number;
7
7
  readonly answerStep: number;
8
+ /** Explicitly collapsed; absent means explicitly opened. */
9
+ readonly collapsed?: true;
8
10
  }
9
11
  /** Per-Session state shared only by the Chat view and details surface. */
10
12
  export interface ChatStoreState {
@@ -15,8 +15,6 @@ export interface TurnProcessSpec {
15
15
  /** Tool calls whose configured name identifies a subagent delegation. */
16
16
  readonly subagentCount: number;
17
17
  }
18
- /** Chat Node kinds that remain independent of a Turn's process disclosure. */
19
- export declare const TURN_PROCESS_INDEPENDENT_KINDS: ReadonlySet<string>;
20
18
  /**
21
19
  * Compare immutable Turn-process specifications by their published fields.
22
20
  * @param left - previous specification.
@@ -1,5 +1,6 @@
1
1
  import type { ConversationLocation, ConversationNodeContext } from '@deepseek-ai/dsh-client-ui-conversation/client';
2
2
  import type { ChatNode, ChatNodeDataMap, ChatNodeKind } from '../contract/chat-nodes.ts';
3
+ import type { ChatGroupTree } from '../contract/group-tree.ts';
3
4
  /**
4
5
  * Relative positions in one durable event's seq neighborhood: interrupted
5
6
  * Assistant, its follow-up Nodes, then follow-ups to an ordinary final. The
@@ -19,18 +20,28 @@ export declare const CHAT_SYNTHETIC_SEQ_OFFSETS: {
19
20
  * @returns start or first-match Location, otherwise unresolved.
20
21
  */
21
22
  export declare function contextLocation(context: ConversationNodeContext): ConversationLocation;
23
+ /**
24
+ * Read the Turn and Step a Location resolves to.
25
+ * @param location - engine-owned Location.
26
+ * @returns resolved coordinates; Session-level and unresolved Locations have none.
27
+ */
28
+ export declare function locationCoordinates(location: ConversationLocation): {
29
+ turn?: number;
30
+ step?: number;
31
+ };
22
32
  /**
23
33
  * Build one final Chat target Node with the engine-owned stable key.
24
34
  * @param context - assembled business Context.
25
35
  * @param kind - Chat renderer dispatch key.
26
36
  * @param anchorSeq - sortable render position.
27
37
  * @param data - renderer-owned payload.
28
- * @param options - optional Location and visibility overrides.
38
+ * @param options - optional Location, visibility, and group-tree overrides.
29
39
  * @returns final Chat view Node.
30
40
  */
31
41
  export declare function chatNode<Kind extends ChatNodeKind>(context: ConversationNodeContext, kind: Kind, anchorSeq: number, data: ChatNodeDataMap[Kind], options?: {
32
42
  readonly location?: ConversationLocation;
33
43
  readonly visibility?: 'visible' | 'hidden';
44
+ readonly groupTree?: ChatGroupTree | undefined;
34
45
  }): ChatNode<Kind>;
35
46
  /**
36
47
  * Read a finite non-negative integer from a structurally narrowed payload.
@@ -0,0 +1,42 @@
1
+ import type { ChatConversationViewNode } from '../contract/chat-nodes.ts';
2
+ import { type ChatGroupTree } from '../contract/group-tree.ts';
3
+ /**
4
+ * Loaded Turns split into consecutive segments at the Turns holding a Node at
5
+ * one group-tree position, visible or hidden. The latest segment starts at the
6
+ * last such Turn, or at the first loaded Turn when none is loaded. Node changes
7
+ * update per-Turn counts without scanning the loaded Nodes; `settle` returns at
8
+ * once while the start holds and otherwise reads loaded Turns only from the
9
+ * earlier of the previous and new starts.
10
+ */
11
+ export declare class GroupTreeSegments {
12
+ private readonly position;
13
+ /** Opening Node count by owning Turn. */
14
+ private readonly openings;
15
+ private latestOpening;
16
+ private latestStart;
17
+ /** @param position - group-tree position whose Nodes open a segment. */
18
+ constructor(position: ChatGroupTree);
19
+ /**
20
+ * Account one Node change.
21
+ * @param previous - replaced Node; absent for an addition.
22
+ * @param next - replacing Node; absent for a removal.
23
+ */
24
+ track(previous: ChatConversationViewNode | undefined, next: ChatConversationViewNode | undefined): void;
25
+ /**
26
+ * Test latest-segment membership as of the last `settle`.
27
+ * @param turn - owning Turn, when resolved.
28
+ * @returns whether the Turn belongs to the latest segment.
29
+ */
30
+ inLatest(turn: number | undefined): boolean;
31
+ /**
32
+ * Move the latest segment start for the currently loaded Turns.
33
+ * @param turnOrder - loaded Turns in ascending timeline order.
34
+ * @returns loaded Turns that entered or left the latest segment, in ascending order.
35
+ */
36
+ settle(turnOrder: readonly number[]): readonly number[];
37
+ private openingTurn;
38
+ private lastOpeningTurn;
39
+ /** @returns the Turn's opening count after the change; zero removes the Turn. */
40
+ private adjust;
41
+ }
42
+ //# sourceMappingURL=group-tree-segments.d.ts.map
@@ -14,11 +14,12 @@ export type {} from './conversation-nodes/turn-process.ts';
14
14
  export type {} from './conversation-nodes/turn-tail.ts';
15
15
  export type { AssistantBlock, AssistantMessageNode, AssistantProviderMetadataView, AssistantRequestConfig, AssistantTiming, ChatLocationNodeIndex, ChatNodeProcessSource, ChatNodeSource, ChatNodeStore, ChatSnapshot, ChatTurnNavigationIndex, ChatTurnProcessPresentation, CommandNode, CompactionSummaryNode, ContextMessageNode, ConversationNode, LegacyConversationSlice, ModelRetryNode, PartialAssistant, PreparingToolCall, RunningToolCall, StartedToolCall, SteeringMessageNode, ToolArgs, ToolCallBlock, ToolResultNode, TurnErrorNode, TurnMaxTokensNode, TurnNavigationItem, UnknownSurfaceNode, UserMessageNode, } from './contract/snapshot.ts';
16
16
  export type { AssistantChatData, ChatConversationViewNode, ChatNode, ChatNodeKind, FinalAssistantChatData, ManualCompactionChatData, RetryChatData, ToolChatData, TurnProcessChatData, TurnTailChatData, } from './contract/chat-nodes.ts';
17
+ export type { ChatGroupTree } from './contract/group-tree.ts';
17
18
  export type { ChatStoreState, ToolCallId, TurnProcessViewEntry } from './contract/store.ts';
18
19
  export type { TranscriptViewRowInjected, TranscriptViewRowProps } from './settings/TranscriptViewRow.tsx';
19
20
  export type { TranscriptViewMode } from '../chat-settings.ts';
20
21
  export type { ChatPresentationPolicy } from './presentation-policy.ts';
21
- export type { AssistantActionOwnerProps, ChatFileMentions, ChatNodeHookContext, ChatNodeInjected, ChatNodeOwnerProps, ChatNodeViewProps, ChatScrollPosition, ChatStore, ChatViewInjected, ChatViewSlotProps, CommandRowOwnerProps, CommandRowProps, MessageImagesProps, OpenFileOptions, PresentationInjected, QuotaNoticeCode, QuotaNoticeHostProps, QuotaNoticeInjected, QuotaNoticeOwnerProps, QuotaNoticeState, TurnProcessOwnerProps, TurnTailOwnerProps, UseChat, UseChatNodeTurnData, UseDisclosure, UsePresentation, } from './contract/slots.ts';
22
+ export type { AssistantActionOwnerProps, ChatFileMentions, ChatNodeHookContext, ChatNodeInjected, ChatNodeOwnerProps, ChatNodeViewProps, ChatScrollPosition, ChatStore, ChatViewInjected, ChatViewSlotProps, ChatFlowDataInjected, ChatFlowHookContext, ChatFlowInjected, ChatFlowOwnerProps, ChatFlowSlotProps, UseGroupHeaderAction, CommandRowOwnerProps, CommandRowProps, MessageImagesProps, OpenFileOptions, PresentationInjected, QuotaNoticeCode, QuotaNoticeHostProps, QuotaNoticeInjected, QuotaNoticeOwnerProps, QuotaNoticeState, ReasoningBodyOwnerProps, ReasoningContentInput, UserContentAttachment, UserContentData, UserContentInput, TurnProcessOwnerProps, TurnTailOwnerProps, UseChat, UseChatNodeTurnData, UseDisclosure, UsePresentation, UseGroupAction, } from './contract/slots.ts';
22
23
  export type { TurnProcessSpec, } from './contract/turn-process.ts';
23
24
  export type { ChatKey } from './locale.ts';
24
25
  export type { ConversationContext, ConversationContextOriginKind } from './model/conversation-context.ts';
@@ -100,6 +100,10 @@ export declare const zh: {
100
100
  'settings.links.newTab': string;
101
101
  'settings.transcript.title': string;
102
102
  'settings.transcript.description': string;
103
+ 'settings.collapse.title': string;
104
+ 'settings.collapse.description': string;
105
+ 'settings.collapse.completion': string;
106
+ 'settings.collapse.nextInput': string;
103
107
  'settings.transcript.compact': string;
104
108
  'settings.transcript.standard': string;
105
109
  'settings.transcript.detailed': string;
@@ -159,8 +163,9 @@ export declare const zh: {
159
163
  'message.retry.delay': string;
160
164
  'message.retry.failure': string;
161
165
  'message.failure.auth': string;
162
- 'message.accountStopped': string;
166
+ 'message.taskStopped': string;
163
167
  'message.failure.accountSignedOut': string;
168
+ 'message.failure.interrupted': string;
164
169
  'message.failure.accountSignInRequired': string;
165
170
  'message.failure.quota': string;
166
171
  'message.turnError': string;
@@ -291,6 +296,10 @@ export declare const en: {
291
296
  'settings.links.newTab': string;
292
297
  'settings.transcript.title': string;
293
298
  'settings.transcript.description': string;
299
+ 'settings.collapse.title': string;
300
+ 'settings.collapse.description': string;
301
+ 'settings.collapse.completion': string;
302
+ 'settings.collapse.nextInput': string;
294
303
  'settings.transcript.compact': string;
295
304
  'settings.transcript.standard': string;
296
305
  'settings.transcript.detailed': string;
@@ -350,8 +359,9 @@ export declare const en: {
350
359
  'message.retry.delay': string;
351
360
  'message.retry.failure': string;
352
361
  'message.failure.auth': string;
353
- 'message.accountStopped': string;
362
+ 'message.taskStopped': string;
354
363
  'message.failure.accountSignedOut': string;
364
+ 'message.failure.interrupted': string;
355
365
  'message.failure.accountSignInRequired': string;
356
366
  'message.failure.quota': string;
357
367
  'message.turnError': string;
@@ -6,12 +6,12 @@ export declare class PerformanceUsagePolicy {
6
6
  private readonly unsubscribe;
7
7
  /** Current choice, reconciled with accepted Host settings when available. */
8
8
  readonly mode: import("@deepseek-ai/dsh-client-store").SnapshotStore<"compact" | "detailed">;
9
- /** @param host - Chat settings scope, durable on loopback and memory-only elsewhere. */
9
+ /** @param host - Chat settings scope persisted through the Host. */
10
10
  constructor(host: ConfigForm<ChatSettings>);
11
11
  /** Release the accepted-value subscription. */
12
12
  dispose(): void;
13
13
  /**
14
- * Publish a choice immediately and persist it when the scope supports writes.
14
+ * Publish a choice immediately and queue its Host write.
15
15
  * @param mode - Statistics detail selected by the user.
16
16
  */
17
17
  setMode(mode: PerformanceUsageMode): void;