@deepseek-ai/dsh-client-ui-chat 0.1.6-alpha.2 → 0.1.7-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 +2 -2
- package/README.md +83 -10
- package/README.zh.md +81 -10
- package/lib/client.js +5260 -1541
- package/lib/index.js +37 -10
- package/lib/types/chat-settings.d.ts +41 -8
- package/lib/types/client/chat/AssistantMarkdown.d.ts +15 -12
- package/lib/types/client/chat/AssistantNodeView.d.ts +5 -2
- package/lib/types/client/chat/ChatGroupSeat.d.ts +14 -0
- package/lib/types/client/chat/ChatNodeSeat.d.ts +11 -5
- package/lib/types/client/chat/ChatView.d.ts +1 -1
- package/lib/types/client/chat/GenericCommandCard.d.ts +6 -1
- package/lib/types/client/chat/ReasoningRow.d.ts +11 -5
- package/lib/types/client/chat/StatsPills.d.ts +4 -4
- package/lib/types/client/chat/TurnNavigator.d.ts +11 -9
- package/lib/types/client/chat/TurnTailNodeView.d.ts +4 -4
- package/lib/types/client/chat/TurnTriggerNodeView.d.ts +4 -0
- package/lib/types/client/chat/TurnUsagePanel.d.ts +1 -16
- package/lib/types/client/chat/message-chrome.d.ts +9 -6
- package/lib/types/client/chat/register-node-renderers.d.ts +8 -1
- package/lib/types/client/chat/render-entry.d.ts +9 -0
- package/lib/types/client/chat/step-process.d.ts +11 -0
- package/lib/types/client/chat/turn-trigger.d.ts +15 -0
- package/lib/types/client/chat/use-chat-navigation.d.ts +69 -0
- package/lib/types/client/chat/use-chat-reading.d.ts +96 -0
- package/lib/types/client/chat/use-chat-scroll.d.ts +35 -0
- package/lib/types/client/chat/use-chat-viewport.d.ts +144 -0
- package/lib/types/client/chat/use-disclosure.d.ts +15 -0
- package/lib/types/client/chat/use-process-scroll.d.ts +23 -0
- package/lib/types/client/chat/use-scroll-follow.d.ts +105 -0
- package/lib/types/client/contract/chat-nodes.d.ts +0 -2
- package/lib/types/client/contract/chat-visibility.d.ts +9 -0
- package/lib/types/client/contract/process-groups.d.ts +23 -0
- package/lib/types/client/contract/slots.d.ts +55 -11
- package/lib/types/client/contract/snapshot.d.ts +14 -1
- package/lib/types/client/contract/turn-metrics.d.ts +1 -20
- package/lib/types/client/contract/turn-process.d.ts +7 -0
- package/lib/types/client/conversation-nodes/assistant.d.ts +1 -2
- package/lib/types/client/conversation-nodes/chat-snapshot-builder.d.ts +9 -2
- package/lib/types/client/conversation-nodes/inbox.d.ts +16 -6
- package/lib/types/client/conversation-nodes/message.d.ts +5 -1
- package/lib/types/client/conversation-nodes/process-activity.d.ts +10 -0
- package/lib/types/client/conversation-nodes/process-groups.d.ts +27 -0
- package/lib/types/client/index.d.ts +3 -1
- package/lib/types/client/locale.d.ts +106 -12
- package/lib/types/client/performance-usage.d.ts +19 -0
- package/lib/types/client/presentation-policy.d.ts +35 -0
- package/lib/types/client/settings/LinkOpeningRow.d.ts +24 -0
- package/lib/types/client/settings/PerformanceUsageRow.d.ts +18 -0
- package/lib/types/client/settings/PreferenceRow.d.ts +17 -0
- package/lib/types/client/settings/TranscriptViewRow.d.ts +6 -6
- package/lib/types/client/transcript-view.d.ts +8 -5
- package/lib/types/index.d.ts +26 -4
- package/package.json +40 -37
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { ChatScrollPosition, ChatViewSlotProps } from '../contract/slots.ts';
|
|
2
|
+
import type { ChatViewport, ViewportLanding, ViewportScroll } from './use-chat-viewport.ts';
|
|
3
|
+
import { type ScrollFollow } from './use-scroll-follow.ts';
|
|
4
|
+
/** Reading facts that affect Chat chrome and initial rail placement. */
|
|
5
|
+
export interface ChatReadingState {
|
|
6
|
+
readonly initialized: boolean;
|
|
7
|
+
readonly followingTail: boolean;
|
|
8
|
+
readonly activeTurn: number | null;
|
|
9
|
+
}
|
|
10
|
+
/** Settled reader position delivered to history-navigation policy. */
|
|
11
|
+
export interface ReadingSample {
|
|
12
|
+
readonly position: ChatScrollPosition | null;
|
|
13
|
+
readonly movedByReader: boolean;
|
|
14
|
+
readonly followingTail: boolean;
|
|
15
|
+
}
|
|
16
|
+
type PositionStore = ChatViewSlotProps['chatScroll'];
|
|
17
|
+
/** Owns reading policy and its cancellable sampling work, without DOM access. */
|
|
18
|
+
export declare class ChatReading {
|
|
19
|
+
private readonly viewport;
|
|
20
|
+
private store;
|
|
21
|
+
private state;
|
|
22
|
+
private readonly onChange;
|
|
23
|
+
private readonly follow;
|
|
24
|
+
private sampleTimer;
|
|
25
|
+
private probeFrame;
|
|
26
|
+
private sampled;
|
|
27
|
+
constructor(viewport: ChatViewport, store: PositionStore, state: ChatReadingState, onChange: (state: ChatReadingState) => void, follow: ScrollFollow);
|
|
28
|
+
/**
|
|
29
|
+
* Expose pending reader ownership to navigation and resize handlers.
|
|
30
|
+
* @returns whether reader input still awaits interval or scrollend sampling.
|
|
31
|
+
*/
|
|
32
|
+
get pending(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Expose the active follow policy.
|
|
35
|
+
* @returns whether content growth retains bottom-follow ownership.
|
|
36
|
+
*/
|
|
37
|
+
get followingTail(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Adopt the committed Session's scroll memory.
|
|
40
|
+
* @param store - scroll memory for the current Session.
|
|
41
|
+
*/
|
|
42
|
+
setStore(store: PositionStore): void;
|
|
43
|
+
/**
|
|
44
|
+
* Connect history policy to settled reading observations.
|
|
45
|
+
* @param sampled - receives settled reader positions.
|
|
46
|
+
* @returns a disposer that disconnects only this listener.
|
|
47
|
+
*/
|
|
48
|
+
connect(sampled: (sample: ReadingSample) => void): () => void;
|
|
49
|
+
/** Cancel timers and animation frames and detach the sample listener. */
|
|
50
|
+
dispose(): void;
|
|
51
|
+
/** Release bottom follow and pending sampling for an explicit navigation. */
|
|
52
|
+
pauseFollowing(): void;
|
|
53
|
+
/** Land at the current floor and clear saved reader position. */
|
|
54
|
+
followTail(): void;
|
|
55
|
+
/** Restore the Session's semantic position, or follow the tail when none is saved. */
|
|
56
|
+
restore(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Adopt a known landing without rediscovering its anchor.
|
|
59
|
+
* @param landing - measured navigation result that replaces pending reader input.
|
|
60
|
+
*/
|
|
61
|
+
acceptNavigation(landing: ViewportLanding): void;
|
|
62
|
+
/**
|
|
63
|
+
* Retain reading policy while history changes the anchor's geometry.
|
|
64
|
+
* @param landing - compensated position that retains the current reading policy.
|
|
65
|
+
*/
|
|
66
|
+
preservePosition(landing: ViewportLanding): void;
|
|
67
|
+
/**
|
|
68
|
+
* Handle pinned layout movement and reader arrivals at the floor immediately.
|
|
69
|
+
* @param scroll - attributed scroll delivery; other reader movement remains pending until sampled.
|
|
70
|
+
*/
|
|
71
|
+
readonly onScroll: (scroll: ViewportScroll) => void;
|
|
72
|
+
/** Settle pending reader movement at the browser's scrollend. */
|
|
73
|
+
readonly onScrollEnd: () => void;
|
|
74
|
+
/** Reconcile a layout change without overriding unsampled reader input. */
|
|
75
|
+
onResize(): void;
|
|
76
|
+
/** Resolve the active turn from tail ownership or a coalesced reading-line probe. */
|
|
77
|
+
refreshActiveTurn(): void;
|
|
78
|
+
private commit;
|
|
79
|
+
private publish;
|
|
80
|
+
private cancelPending;
|
|
81
|
+
private readonly probe;
|
|
82
|
+
private readonly flushSample;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Retain reading policy and expose only changes in visible reading state.
|
|
86
|
+
* @param viewport - turn-aware DOM operations.
|
|
87
|
+
* @param store - Session-owned semantic scroll memory.
|
|
88
|
+
* @param initialTurn - latest loaded turn before the first landing.
|
|
89
|
+
* @returns the reading owner and its React-visible state.
|
|
90
|
+
*/
|
|
91
|
+
export declare function useChatReading(viewport: ChatViewport, store: PositionStore, initialTurn: number | null): {
|
|
92
|
+
reading: ChatReading;
|
|
93
|
+
state: ChatReadingState;
|
|
94
|
+
};
|
|
95
|
+
export {};
|
|
96
|
+
//# sourceMappingURL=use-chat-reading.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Composes viewport operations, reading policy, and history navigation for Chat. */
|
|
2
|
+
import { type RefObject } from 'react';
|
|
3
|
+
import type { ChatSnapshot } from '../contract/snapshot.ts';
|
|
4
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts';
|
|
5
|
+
import { type ChatNavigation, type ChatNavigationInput } from './use-chat-navigation.ts';
|
|
6
|
+
import { type ChatReadingState } from './use-chat-reading.ts';
|
|
7
|
+
/** Committed content and Session operations used to reconcile scroll ownership. */
|
|
8
|
+
export interface ChatScrollInput extends ChatNavigationInput {
|
|
9
|
+
readonly chatScroll: ChatViewSlotProps['chatScroll'];
|
|
10
|
+
readonly ready: boolean;
|
|
11
|
+
readonly order: readonly string[];
|
|
12
|
+
readonly lastKey: string | null;
|
|
13
|
+
readonly lastIsUser: boolean;
|
|
14
|
+
readonly steeringId: string | null;
|
|
15
|
+
readonly submissionId: string | null;
|
|
16
|
+
readonly running: boolean;
|
|
17
|
+
readonly loadedTurns: ReturnType<ChatSnapshot['navigation']['items']>;
|
|
18
|
+
}
|
|
19
|
+
interface ChatScrollState extends ChatReadingState {
|
|
20
|
+
readonly listRef: RefObject<HTMLDivElement>;
|
|
21
|
+
readonly columnRef: RefObject<HTMLDivElement>;
|
|
22
|
+
readonly busyTurn: number | null;
|
|
23
|
+
readonly navigateToTurn: ChatNavigation['navigateToTurn'];
|
|
24
|
+
readonly loadEarlier: ChatNavigation['loadEarlier'];
|
|
25
|
+
readonly returnToBottom: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Coordinate scroll policy after Chat content commits.
|
|
29
|
+
* New submitted input supersedes pending reader sampling.
|
|
30
|
+
* @param input - current Chat content, scroll memory, and history operations.
|
|
31
|
+
* @returns element refs, visible reading state, and navigation callbacks.
|
|
32
|
+
*/
|
|
33
|
+
export declare function useChatScroll(input: ChatScrollInput): ChatScrollState;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=use-chat-scroll.d.ts.map
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/** Turn-aware DOM scrolling and geometry, without history-loading or follow policy. */
|
|
2
|
+
import { type RefObject } from 'react';
|
|
3
|
+
import type { ChatScrollPosition } from '../contract/slots.ts';
|
|
4
|
+
import type { ChatSnapshot } from '../contract/snapshot.ts';
|
|
5
|
+
import { ScrollFollow, type ViewportMetrics } from './use-scroll-follow.ts';
|
|
6
|
+
export type { ViewportMetrics } from './use-scroll-follow.ts';
|
|
7
|
+
/** Scroll geometry attributed against the last acknowledged position. */
|
|
8
|
+
export interface ViewportScroll {
|
|
9
|
+
readonly metrics: ViewportMetrics;
|
|
10
|
+
readonly movedByReader: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Actual clamped scroll result, including any known semantic anchor and turn. */
|
|
13
|
+
export interface ViewportLanding {
|
|
14
|
+
readonly metrics: ViewportMetrics;
|
|
15
|
+
readonly position: ChatScrollPosition | null;
|
|
16
|
+
readonly turn: number | null;
|
|
17
|
+
}
|
|
18
|
+
interface ViewportEvents {
|
|
19
|
+
scroll: (event: ViewportScroll) => void;
|
|
20
|
+
scrollEnd: () => void;
|
|
21
|
+
resize: () => void;
|
|
22
|
+
interact: () => void;
|
|
23
|
+
}
|
|
24
|
+
/** Owns one Chat scrollport's DOM operations, event listeners, and size observer. */
|
|
25
|
+
export declare class ChatViewport {
|
|
26
|
+
private elements;
|
|
27
|
+
private observer;
|
|
28
|
+
private events;
|
|
29
|
+
private turns;
|
|
30
|
+
private observation;
|
|
31
|
+
private paging;
|
|
32
|
+
/**
|
|
33
|
+
* Bind to the containing scrollport and observe content and viewport sizes.
|
|
34
|
+
* @param list - Chat root inside an optional shared conversation scrollport.
|
|
35
|
+
* @param column - ordered outer Node/Group boxes; its size changes invalidate cached landings.
|
|
36
|
+
*/
|
|
37
|
+
attach(list: HTMLElement, column: HTMLElement): void;
|
|
38
|
+
/** Disconnect DOM resources and clear observations for the detached view. */
|
|
39
|
+
detach(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Connect business policy without changing DOM listener ownership.
|
|
42
|
+
* @param events - business handlers for scroll and layout changes.
|
|
43
|
+
* @returns a disposer that disconnects only these handlers.
|
|
44
|
+
*/
|
|
45
|
+
connect(events: ViewportEvents): () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Adopt the loaded turn anchors without querying the DOM.
|
|
48
|
+
* @param turns - ordered loaded turns from the committed Chat snapshot.
|
|
49
|
+
*/
|
|
50
|
+
updateTurns(turns: ReturnType<ChatSnapshot['navigation']['items']>): void;
|
|
51
|
+
/**
|
|
52
|
+
* Resolve the tail from the committed turn index.
|
|
53
|
+
* @returns the latest loaded turn, or null for an empty window.
|
|
54
|
+
*/
|
|
55
|
+
get latestTurn(): number | null;
|
|
56
|
+
/** Discard geometry-dependent landing knowledge while retaining scroll attribution. */
|
|
57
|
+
invalidate(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Accept a sampled reader position without retaining a known landing.
|
|
60
|
+
* @param metrics - settled reader position used as the next attribution baseline.
|
|
61
|
+
*/
|
|
62
|
+
acknowledge(metrics: ViewportMetrics): void;
|
|
63
|
+
/**
|
|
64
|
+
* Compare the current scroll geometry with the last acknowledged position.
|
|
65
|
+
* @returns current metrics and movement attribution, or null while detached.
|
|
66
|
+
*/
|
|
67
|
+
readScroll(): ViewportScroll | null;
|
|
68
|
+
private metrics;
|
|
69
|
+
private anchor;
|
|
70
|
+
/**
|
|
71
|
+
* Capture visible transcript content, excluding Turn controls that relocate when history expands.
|
|
72
|
+
* @returns a visible semantic anchor, or null when no anchor can be resolved.
|
|
73
|
+
*/
|
|
74
|
+
capturePosition(): ChatScrollPosition | null;
|
|
75
|
+
/**
|
|
76
|
+
* Approximate the active Turn by binary-searching outer Node/Group boxes.
|
|
77
|
+
* Gaps retain the last visited Turn candidate, not necessarily the immediate predecessor.
|
|
78
|
+
* A known landing bypasses measurement while its position is unchanged.
|
|
79
|
+
* @param metrics - reusable scroll metrics; omitted callers request a fresh read.
|
|
80
|
+
* @returns the Turn near the reading line, or null while detached or empty.
|
|
81
|
+
*/
|
|
82
|
+
readVisibleTurn(metrics?: ViewportMetrics | null): number | null;
|
|
83
|
+
/**
|
|
84
|
+
* Align a known loaded turn and return its actual clamped position.
|
|
85
|
+
* A split Node anchor selects its first visible part.
|
|
86
|
+
* @param turn - loaded turn to align below the scrollport's top edge.
|
|
87
|
+
* @returns the actual landing, or null when its anchor is unavailable.
|
|
88
|
+
*/
|
|
89
|
+
scrollToTurn(turn: number): ViewportLanding | null;
|
|
90
|
+
/**
|
|
91
|
+
* Align the nearest available fallback for an unavailable turn anchor.
|
|
92
|
+
* @param turn - minimum turn number for a mounted fallback row.
|
|
93
|
+
* @returns the fallback landing, or null when no eligible row exists.
|
|
94
|
+
*/
|
|
95
|
+
scrollToTurnAtOrAfter(turn: number): ViewportLanding | null;
|
|
96
|
+
/**
|
|
97
|
+
* Restore a semantic anchor with a raw-position fallback.
|
|
98
|
+
* @param position - semantic scroll memory; raw top is used only if its row is absent.
|
|
99
|
+
* @returns the actual landing, or null while detached.
|
|
100
|
+
*/
|
|
101
|
+
restore(position: ChatScrollPosition): ViewportLanding | null;
|
|
102
|
+
/** Retain the first eligible transcript seat in DOM order; selection reads no geometry. */
|
|
103
|
+
beginPaging(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Retain one old row and its inner/outer offsets for paging and later content growth.
|
|
106
|
+
* @param position - an explicit landing to retain; omitted callers capture the current reading position.
|
|
107
|
+
*/
|
|
108
|
+
beginPreserving(position?: ChatScrollPosition | null): void;
|
|
109
|
+
private retain;
|
|
110
|
+
/** Release paging ownership and its content-size observation. */
|
|
111
|
+
stopPreserving(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Expose retained paging ownership to navigation and resize policy.
|
|
114
|
+
* @returns whether a paging row is retained for subsequent layout changes.
|
|
115
|
+
*/
|
|
116
|
+
get preserving(): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Compensate inner scrolling first, then the outer scrollport, within their actual scroll ranges.
|
|
119
|
+
* An inner write pauses its bound follow controller so the reading anchor takes priority.
|
|
120
|
+
* @returns the actual landing, or null when no visible retained row remains.
|
|
121
|
+
*/
|
|
122
|
+
preserve(): ViewportLanding | null;
|
|
123
|
+
/**
|
|
124
|
+
* Align the scrollport with its current floor.
|
|
125
|
+
* @param follow - independent follow intent and scrolling controller.
|
|
126
|
+
* @returns the actual floor landing, or null while detached.
|
|
127
|
+
*/
|
|
128
|
+
scrollToBottom(follow: ScrollFollow): ViewportLanding | null;
|
|
129
|
+
private align;
|
|
130
|
+
private write;
|
|
131
|
+
private readonly onScroll;
|
|
132
|
+
private readonly onScrollEnd;
|
|
133
|
+
private readonly onIntent;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Bind viewport resource ownership to the component's layout lifetime.
|
|
137
|
+
* @returns one viewport owner and the element refs attached for this mount.
|
|
138
|
+
*/
|
|
139
|
+
export declare function useChatViewport(): {
|
|
140
|
+
viewport: ChatViewport;
|
|
141
|
+
listRef: RefObject<HTMLDivElement>;
|
|
142
|
+
columnRef: RefObject<HTMLDivElement>;
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=use-chat-viewport.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
|
|
2
|
+
import type { UseDisclosure } from '../contract/slots.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Own one initially collapsed disclosure without an external subscription.
|
|
5
|
+
* @param version - reset generation; unchanged generations retain local open state.
|
|
6
|
+
* @returns the open state, an explicit setter, and a toggle action.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useDisclosure(version?: number): ReturnType<UseDisclosure>;
|
|
9
|
+
/**
|
|
10
|
+
* Bind a Hook without subscribing until a component calls it.
|
|
11
|
+
* @param reset - stable source whose version advances when the seat is hidden by its Turn.
|
|
12
|
+
* @returns a Hook with independent open state for each invocation.
|
|
13
|
+
*/
|
|
14
|
+
export declare function bindDisclosure(reset: ObservableSnapshot<number>): UseDisclosure;
|
|
15
|
+
//# sourceMappingURL=use-disclosure.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Capped process-group scrolling and fades over the shared follow controller. */
|
|
2
|
+
import { type DOMAttributes, type RefObject } from 'react';
|
|
3
|
+
interface ScrollEdges {
|
|
4
|
+
readonly canScrollUp: boolean;
|
|
5
|
+
readonly canScrollDown: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Observe one group's body and content without coupling its follow intent to the outer transcript.
|
|
9
|
+
* Wheel, touchstart, any pointerdown, and unprevented scroll keys interrupt active animations,
|
|
10
|
+
* including events from editable controls; subsequent position sampling determines follow intent.
|
|
11
|
+
* @param bodyRef - capped scrolling body.
|
|
12
|
+
* @param contentRef - uncapped content whose size reports growth.
|
|
13
|
+
* @param open - local disclosure state.
|
|
14
|
+
* @param grouped - whether the display mode retains the group's height cap.
|
|
15
|
+
* @returns edge fades, DOM event bindings, and one-shot positioning for manual opening.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useProcessScroll(bodyRef: RefObject<HTMLDivElement>, contentRef: RefObject<HTMLDivElement>, open: boolean, grouped: boolean): {
|
|
18
|
+
edges: ScrollEdges;
|
|
19
|
+
events: Pick<DOMAttributes<HTMLDivElement>, 'onScroll' | 'onWheel' | 'onTouchStart' | 'onPointerDown' | 'onKeyDown'>;
|
|
20
|
+
initialize: (position: 'top' | 'bottom') => void;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=use-process-scroll.d.ts.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/** Scroll position, maximum top, and viewport height from one geometry read. */
|
|
2
|
+
export interface ViewportMetrics {
|
|
3
|
+
readonly top: number;
|
|
4
|
+
readonly floor: number;
|
|
5
|
+
readonly height: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Read one scrollport without measuring its children.
|
|
9
|
+
* @param element - scrolling element.
|
|
10
|
+
* @returns current position and range.
|
|
11
|
+
*/
|
|
12
|
+
export declare function scrollMetrics(element: HTMLElement): ViewportMetrics;
|
|
13
|
+
/** One scrollport's follow intent; native animation progress does not count as reader movement. */
|
|
14
|
+
export declare class ScrollFollow {
|
|
15
|
+
private following;
|
|
16
|
+
private readonly threshold;
|
|
17
|
+
private static readonly owners;
|
|
18
|
+
private target;
|
|
19
|
+
private sampledTop;
|
|
20
|
+
/**
|
|
21
|
+
* @param following - initial follow intent.
|
|
22
|
+
* @param threshold - accepted distance from the floor, in pixels.
|
|
23
|
+
*/
|
|
24
|
+
constructor(following: boolean, threshold: number);
|
|
25
|
+
/**
|
|
26
|
+
* Find the mounted controller for reading-position compensation.
|
|
27
|
+
* @param element - scrollport with an optional follow owner.
|
|
28
|
+
* @returns its controller, when bound.
|
|
29
|
+
*/
|
|
30
|
+
static forElement(element: HTMLElement): ScrollFollow | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Share this controller with reading-position compensation for the same scrollport.
|
|
33
|
+
* @param element - owned scrollport.
|
|
34
|
+
* @returns release the association on unmount or close.
|
|
35
|
+
*/
|
|
36
|
+
bind(element: HTMLElement): () => void;
|
|
37
|
+
/**
|
|
38
|
+
* Expose follow intent independently of the current offset.
|
|
39
|
+
* @returns whether content growth should follow the floor.
|
|
40
|
+
*/
|
|
41
|
+
get active(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Expose outstanding native motion before accepting reader input.
|
|
44
|
+
* @returns whether a native follow animation has an outstanding target.
|
|
45
|
+
*/
|
|
46
|
+
get animating(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Classify bottom arrivals using this scrollport's own tolerance.
|
|
49
|
+
* @param metrics - current scroll geometry.
|
|
50
|
+
* @returns whether the position is within the follow threshold.
|
|
51
|
+
*/
|
|
52
|
+
nearBottom(metrics: ViewportMetrics): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Commit caller-owned follow decisions without moving the scrollport.
|
|
55
|
+
* @param active - externally committed follow intent.
|
|
56
|
+
*/
|
|
57
|
+
setFollowing(active: boolean): void;
|
|
58
|
+
/** Adopt the next visible layout as a fresh reader position. */
|
|
59
|
+
reset(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Adopt delivered scrolling while retaining intent during native animation.
|
|
62
|
+
* @param metrics - current geometry.
|
|
63
|
+
* @param movedByReader - caller attribution; omitted callers compare the last sampled position.
|
|
64
|
+
* @returns updated follow intent.
|
|
65
|
+
*/
|
|
66
|
+
sample(metrics: ViewportMetrics, movedByReader?: boolean): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Settle native scrolling; an off-target stop releases follow intent.
|
|
69
|
+
* @param metrics - actual geometry delivered at scrollend.
|
|
70
|
+
* @returns follow intent after completing or interrupting native motion.
|
|
71
|
+
*/
|
|
72
|
+
settle(metrics: ViewportMetrics): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Position immediately and adopt the resulting follow intent.
|
|
75
|
+
* @param element - scrolling element.
|
|
76
|
+
* @param metrics - geometry before positioning.
|
|
77
|
+
* @param top - requested offset, clamped to the measured range.
|
|
78
|
+
* @returns geometry after positioning.
|
|
79
|
+
*/
|
|
80
|
+
jump(element: HTMLElement, metrics: ViewportMetrics, top: number): ViewportMetrics;
|
|
81
|
+
/**
|
|
82
|
+
* Follow the measured floor, respecting reduced motion for smooth requests.
|
|
83
|
+
* An outstanding smooth target finishes before another is issued.
|
|
84
|
+
* Within-tolerance positioning is immediate while no animation is outstanding.
|
|
85
|
+
* @param element - scrolling element.
|
|
86
|
+
* @param metrics - current geometry.
|
|
87
|
+
* @param behavior - native animation for growth, or immediate positioning.
|
|
88
|
+
* @returns current geometry; smooth requests retain their starting position until native scroll delivery.
|
|
89
|
+
*/
|
|
90
|
+
toBottom(element: HTMLElement, metrics: ViewportMetrics, behavior: 'instant' | 'smooth'): ViewportMetrics;
|
|
91
|
+
/**
|
|
92
|
+
* Cancel native motion before a reader gesture; only subsequent actual movement changes follow intent.
|
|
93
|
+
* @param element - scrolling element.
|
|
94
|
+
* @param metrics - position at interruption.
|
|
95
|
+
*/
|
|
96
|
+
interrupt(element: HTMLElement, metrics: ViewportMetrics): void;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Retain one independent follow controller without React updates for scroll samples.
|
|
100
|
+
* @param initial - initial follow intent.
|
|
101
|
+
* @param threshold - accepted distance from the floor, in pixels.
|
|
102
|
+
* @returns the stable controller shared by the caller's scroll and resize handlers.
|
|
103
|
+
*/
|
|
104
|
+
export declare function useScrollFollow(initial: boolean, threshold: number): ScrollFollow;
|
|
105
|
+
//# sourceMappingURL=use-scroll-follow.d.ts.map
|
|
@@ -76,8 +76,6 @@ export interface TurnTailChatData {
|
|
|
76
76
|
readonly closing: FinalAssistantChatData | null;
|
|
77
77
|
/** Whether non-rendered later evidence makes the closing seq non-tail. */
|
|
78
78
|
readonly branchUnavailable: boolean;
|
|
79
|
-
readonly ttftMs?: number;
|
|
80
|
-
readonly tokensPerSecond?: number;
|
|
81
79
|
/** Exact per-Turn accounting; absent when the loaded evidence is incomplete. */
|
|
82
80
|
readonly tokenUsage?: TurnTokenUsage;
|
|
83
81
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Chat-only row visibility; durable events and trajectory inspection remain intact. */
|
|
2
|
+
import type { ChatNode } from './chat-nodes.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Exclude system prompts, ordinary Context, and permission commands from visible Chat rows.
|
|
5
|
+
* @param node - projected Chat node.
|
|
6
|
+
* @returns whether the node contributes a visible Chat row.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isVisibleChatNode(node: ChatNode): boolean;
|
|
9
|
+
//# sourceMappingURL=chat-visibility.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Business data for Chat process groups; source Nodes remain in the Chat store. */
|
|
2
|
+
export type ProcessActivity = 'read' | 'search' | 'edit' | 'commands' | 'code' | 'webSearch' | 'webFetch' | 'subagents' | 'plan' | 'questions' | 'tools';
|
|
3
|
+
/** Distinct-call category ranking and the current live task detail. */
|
|
4
|
+
export interface ProcessActivitySummary {
|
|
5
|
+
readonly counts: readonly {
|
|
6
|
+
readonly kind: ProcessActivity;
|
|
7
|
+
readonly count: number;
|
|
8
|
+
}[];
|
|
9
|
+
readonly running: ProcessActivity | undefined;
|
|
10
|
+
readonly runningDetail: string;
|
|
11
|
+
}
|
|
12
|
+
/** Presentation facts for one group between independent replies or input. */
|
|
13
|
+
export interface ProcessGroupData {
|
|
14
|
+
readonly turn: number;
|
|
15
|
+
readonly closed: boolean;
|
|
16
|
+
readonly summary: ProcessActivitySummary;
|
|
17
|
+
}
|
|
18
|
+
declare module '@deepseek-ai/dsh-client-ui-conversation/client' {
|
|
19
|
+
interface ConversationGroupDataMap {
|
|
20
|
+
chat: ProcessGroupData;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=process-groups.d.ts.map
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
/** Chat-owned Slot declarations and composed component props. */
|
|
2
2
|
import type { MessageId } from '@deepseek-ai/dsh-llm/brand';
|
|
3
3
|
import type { SessionId, SessionSeq } from '@deepseek-ai/dsh-session/types';
|
|
4
|
-
import type { CommandNode, CompactionSummaryNode, ConversationLocationDataStore, ConversationTurnDataMap, MessageImageLoader, MessageImagesOwnerProps, RenderMessageImages, TurnLocation } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
4
|
+
import type { CommandNode, CompactionSummaryNode, ConversationLocationDataStore, ConversationTurnDataMap, ConversationGroupData, GroupSnapshot, MessageImageLoader, MessageImagesOwnerProps, RenderMessageImages, TurnLocation } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
5
5
|
import type { InjectFace, KeyedSnapshotSelectorHook, PropsLocale, PropsRenderSlots, PropsRuntime, PropsStore, SlotHookFactory, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots';
|
|
6
|
-
import type {
|
|
6
|
+
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
|
|
7
7
|
import type { MarkdownFileMentions } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
8
8
|
import type { createChatStore } from '../stores.ts';
|
|
9
|
+
import type { ChatPresentationPolicy } from '../presentation-policy.ts';
|
|
9
10
|
import type { ToolCallId } from './store.ts';
|
|
10
11
|
import type { ChatConversationViewNode, ChatNode, ChatNodeKind } from './chat-nodes.ts';
|
|
11
12
|
import type { ChatNodeProcessSource, ChatNodeSource, ChatSnapshot, ChatTurnProcessPresentation } from './snapshot.ts';
|
|
12
13
|
import type { TurnProcessSpec } from './turn-process.ts';
|
|
13
|
-
import type {
|
|
14
|
+
import type { PerformanceUsageMode } from '../../chat-settings.ts';
|
|
14
15
|
/** Selector hook over the current Conversation binding's Chat target. */
|
|
15
16
|
export type UseChat = SnapshotSelectorHook<ChatSnapshot>;
|
|
16
17
|
/** Per-key selector hook over one Chat Node. */
|
|
17
18
|
export type UseChatNode = KeyedSnapshotSelectorHook<ChatConversationViewNode | undefined>;
|
|
18
19
|
/** Per-key selector hook over one Chat Node's Turn-process presentation. */
|
|
19
20
|
export type UseChatNodeProcess = KeyedSnapshotSelectorHook<ChatTurnProcessPresentation | undefined>;
|
|
21
|
+
/**
|
|
22
|
+
* Selector hook over the live presentation policy. Callers select one field or
|
|
23
|
+
* a derived conclusion, never the whole policy, so a mode change re-renders
|
|
24
|
+
* only components whose selected value changed.
|
|
25
|
+
*/
|
|
26
|
+
export type UsePresentation = SnapshotSelectorHook<ChatPresentationPolicy>;
|
|
20
27
|
/** Where in a file an open should land. */
|
|
21
28
|
export interface OpenFileOptions {
|
|
22
29
|
/** 1-based line to reveal; absent = the file's beginning. */
|
|
@@ -50,19 +57,38 @@ declare module '@deepseek-ai/cordis' {
|
|
|
50
57
|
}
|
|
51
58
|
/** Hook constrained to business data published on the current Chat Node's Turn. */
|
|
52
59
|
export type UseChatNodeTurnData = <Key extends Extract<keyof ConversationTurnDataMap, string>>(key: Key) => Readonly<ConversationTurnDataMap[Key]> | undefined;
|
|
53
|
-
/**
|
|
54
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Subscribe to enclosing-Turn resets and own one initially collapsed disclosure.
|
|
62
|
+
* Each invocation has independent open state; display-mode changes do not reset it.
|
|
63
|
+
* @returns the current open state, explicit setter, and toggle action.
|
|
64
|
+
*/
|
|
65
|
+
export type UseDisclosure = () => {
|
|
66
|
+
readonly expanded: boolean;
|
|
67
|
+
/** @param open - whether this disclosure is expanded. */
|
|
68
|
+
readonly setExpanded: (open: boolean) => void;
|
|
69
|
+
readonly toggle: () => void;
|
|
70
|
+
};
|
|
71
|
+
/** Stable sources bound to one rendered Chat Node. */
|
|
72
|
+
export interface ChatNodeHookContext {
|
|
73
|
+
readonly turnData: ConversationLocationDataStore<ConversationTurnDataMap> | undefined;
|
|
74
|
+
readonly disclosureReset: ObservableSnapshot<number>;
|
|
75
|
+
}
|
|
76
|
+
/** Slot-level Hook factories for keyed Chat renderers. */
|
|
77
|
+
export interface ChatNodeInjected {
|
|
55
78
|
hooks: {
|
|
56
79
|
turnData: SlotHookFactory<'conversation.chat.node', UseChatNodeTurnData>;
|
|
80
|
+
disclosure: SlotHookFactory<'conversation.chat.node', UseDisclosure>;
|
|
57
81
|
};
|
|
58
82
|
}
|
|
59
83
|
/** Stable owner currency delivered to a keyed Chat renderer. */
|
|
60
84
|
export interface ChatNodeOwnerProps {
|
|
85
|
+
/** Renderer-owned Node portion selected by the grouping Definition. */
|
|
86
|
+
groupPart?: string;
|
|
61
87
|
cwd?: string | undefined;
|
|
62
88
|
/** Open the current source file of a skill referenced by a sent message. */
|
|
63
89
|
openSkill: (name: string) => void;
|
|
64
90
|
openFile: (path: string, options?: OpenFileOptions) => void;
|
|
65
|
-
inspectCall: (callId: ToolCallId) => void;
|
|
91
|
+
inspectCall: ((callId: ToolCallId) => void) | undefined;
|
|
66
92
|
forkAt: (seq: number) => void;
|
|
67
93
|
/**
|
|
68
94
|
* Session-authorized image loader, down-threaded from the Chat view so a
|
|
@@ -78,11 +104,20 @@ export interface ChatNodeOwnerProps {
|
|
|
78
104
|
}
|
|
79
105
|
/** Shared presentation state for one Turn-process answer generation. */
|
|
80
106
|
export interface TurnProcessOwnerProps {
|
|
107
|
+
/** Process content eligible to share one Turn-level disclosure. */
|
|
108
|
+
readonly hasContent: boolean;
|
|
81
109
|
readonly spec: TurnProcessSpec;
|
|
82
110
|
readonly foldable: boolean;
|
|
83
111
|
readonly open: boolean;
|
|
84
112
|
setOpen(open: boolean): void;
|
|
85
113
|
}
|
|
114
|
+
/** Shared presentation policy source for renderers that depend on the work-details mode. */
|
|
115
|
+
export interface PresentationInjected {
|
|
116
|
+
hooks: {
|
|
117
|
+
/** Live presentation policy derived from the accepted work-details mode. */
|
|
118
|
+
presentation: ObservableSnapshot<ChatPresentationPolicy>;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
86
121
|
/** Full props of one keyed Chat renderer. */
|
|
87
122
|
export type ChatNodeViewProps<Kind extends ChatNodeKind = ChatNodeKind> = PropsRuntime<'conversation.chat.node', Kind> & PropsLocale<'chat'>;
|
|
88
123
|
/** Command-row owner share. */
|
|
@@ -100,21 +135,30 @@ export interface ChatScrollPosition {
|
|
|
100
135
|
readonly anchorTop: number;
|
|
101
136
|
readonly scrollTop: number;
|
|
102
137
|
}
|
|
138
|
+
/** Shared settings source for the performance row, composer, and turn tail. */
|
|
139
|
+
export interface PerformanceUsageInjected {
|
|
140
|
+
hooks: {
|
|
141
|
+
/** Accepted performance and usage detail preference. */
|
|
142
|
+
performanceUsage: ObservableSnapshot<PerformanceUsageMode>;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
103
145
|
/** Business callbacks injected into the Chat view. */
|
|
104
146
|
export interface ChatViewInjected {
|
|
105
147
|
hooks: {
|
|
106
|
-
/**
|
|
107
|
-
|
|
148
|
+
/** Live presentation policy derived from the accepted work-details mode. */
|
|
149
|
+
presentation: ObservableSnapshot<ChatPresentationPolicy>;
|
|
108
150
|
};
|
|
109
151
|
keyedHooks: {
|
|
110
152
|
/** Resolve the stable source for one Chat Node key. */
|
|
111
153
|
chatNode: (key: string) => ChatNodeSource;
|
|
112
154
|
/** Resolve the stable Turn-process source for one Chat Node key. */
|
|
113
155
|
chatNodeProcess: (key: string) => ChatNodeProcessSource;
|
|
156
|
+
/** Resolve one optional group without subscribing the root View to its data. */
|
|
157
|
+
chatGroup: (key: string) => ObservableSnapshot<GroupSnapshot<ConversationGroupData<'chat'>> | undefined> | undefined;
|
|
114
158
|
};
|
|
115
159
|
/** Open the current source file of a skill referenced by a sent message. */
|
|
116
160
|
openSkill: (name: string) => void;
|
|
117
|
-
/** Open one HTTP(S) message link
|
|
161
|
+
/** Open one HTTP(S) message link at the selected destination, using an external tab if Sidebar Browser is unavailable. */
|
|
118
162
|
openExternalLink: (url: string) => void;
|
|
119
163
|
openFile: (path: string, options?: OpenFileOptions) => Promise<void>;
|
|
120
164
|
loadOlder: () => void;
|
|
@@ -156,8 +200,8 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
156
200
|
node: ChatNode<Kind>;
|
|
157
201
|
};
|
|
158
202
|
};
|
|
159
|
-
hookContext:
|
|
160
|
-
inject:
|
|
203
|
+
hookContext: ChatNodeHookContext;
|
|
204
|
+
inject: ChatNodeInjected;
|
|
161
205
|
};
|
|
162
206
|
/**
|
|
163
207
|
* Renderer for one consecutive group of durable message images. The owner
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ConversationNode, ConversationTimelineSnapshot, PartialAssistant, RunningToolCall } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
2
|
-
import type { ChatConversationViewNode } from './chat-nodes.ts';
|
|
2
|
+
import type { ChatConversationViewNode, ChatNodeDataMap, ChatNodeKind } from './chat-nodes.ts';
|
|
3
|
+
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
|
|
3
4
|
import type { TurnProcessSpec } from './turn-process.ts';
|
|
4
5
|
export type { AssistantBlock, AssistantMessageNode, AssistantProviderMetadataView, AssistantRequestConfig, AssistantTiming, CommandNode, CompactionSummaryNode, ContextMessageNode, ConversationNode, ModelRetryNode, PartialAssistant, RunningToolCall, SteeringMessageNode, TodoItem, ToolCallBlock, ToolResultNode, TurnErrorNode, TurnMaxTokensNode, UnknownSurfaceNode, UserMessageNode, } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
5
6
|
/** Per-key observable used by one mounted Chat Node Seat. */
|
|
@@ -22,6 +23,14 @@ export interface ChatNodeStore {
|
|
|
22
23
|
get(key: string): ChatConversationViewNode | undefined;
|
|
23
24
|
/** @param key - stable Conversation Context key. @returns its identity-stable observable source. */
|
|
24
25
|
source(key: string): ChatNodeSource;
|
|
26
|
+
/**
|
|
27
|
+
* Observe one Turn's data for a single Node kind, including hidden Nodes, in anchor order.
|
|
28
|
+
* Other Turns and kinds do not notify this source.
|
|
29
|
+
* @param turn - resolved owning Turn.
|
|
30
|
+
* @param kind - business Node kind.
|
|
31
|
+
* @returns an identity-stable source whose array changes only with its members.
|
|
32
|
+
*/
|
|
33
|
+
turnDataSource<Kind extends ChatNodeKind>(turn: number, kind: Kind): ObservableSnapshot<readonly ChatNodeDataMap[Kind][]>;
|
|
25
34
|
/** @param key - stable Conversation Context key. @returns its Turn-process presentation source. */
|
|
26
35
|
processSource(key: string): ChatNodeProcessSource;
|
|
27
36
|
/** @returns all currently materialized Nodes without imposing render order. */
|
|
@@ -58,8 +67,12 @@ export interface ChatLocationNodeIndex {
|
|
|
58
67
|
export interface ChatTurnProcessPresentation {
|
|
59
68
|
readonly turn: number;
|
|
60
69
|
readonly spec: TurnProcessSpec;
|
|
70
|
+
/** Whether the loaded window contains this Turn's `turn/start`; folding is decided per Turn on this fact. */
|
|
71
|
+
readonly turnStarted: boolean;
|
|
61
72
|
readonly turnClosed: boolean;
|
|
62
73
|
readonly hasExternalProcess: boolean;
|
|
74
|
+
/** A visible input after process output prevents one disclosure from hiding its surrounding groups. */
|
|
75
|
+
readonly hasInterleavedInput: boolean;
|
|
63
76
|
readonly compactAnswer: boolean;
|
|
64
77
|
}
|
|
65
78
|
/** Compatibility projection backing StatsPills and the legacy top-level snapshot fields. */
|