@qilin-agent/client-ui-chat 0.0.0-stage → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.i18n.yaml +55 -0
- package/README.md +122 -2
- package/README.zh.md +124 -0
- package/lib/client.js +13227 -0
- package/lib/index.js +54 -0
- package/lib/types/chat-settings.d.ts +47 -0
- package/lib/types/client/apply.d.ts +10 -0
- package/lib/types/client/chat/ApprovalCommand.d.ts +20 -0
- package/lib/types/client/chat/AssistantMarkdown.d.ts +47 -0
- package/lib/types/client/chat/AssistantNodeView.d.ts +7 -0
- package/lib/types/client/chat/ChatGroupSeat.d.ts +14 -0
- package/lib/types/client/chat/ChatNodeSeat.d.ts +22 -0
- package/lib/types/client/chat/ChatView.d.ts +7 -0
- package/lib/types/client/chat/CommandNodeView.d.ts +9 -0
- package/lib/types/client/chat/CompactionCommandCard.d.ts +8 -0
- package/lib/types/client/chat/CompactionItem.d.ts +19 -0
- package/lib/types/client/chat/ContextBody.d.ts +131 -0
- package/lib/types/client/chat/ContextInjectionRow.d.ts +26 -0
- package/lib/types/client/chat/GenericCommandCard.d.ts +9 -0
- package/lib/types/client/chat/MessageIconActions.d.ts +37 -0
- package/lib/types/client/chat/MessageItem.d.ts +42 -0
- package/lib/types/client/chat/ReasoningRow.d.ts +20 -0
- package/lib/types/client/chat/RunningSeal.d.ts +6 -0
- package/lib/types/client/chat/RunningStatus.d.ts +13 -0
- package/lib/types/client/chat/StatsPills.d.ts +71 -0
- package/lib/types/client/chat/SystemPromptRow.d.ts +22 -0
- package/lib/types/client/chat/TurnNavigator.d.ts +28 -0
- package/lib/types/client/chat/TurnProcessNodeView.d.ts +4 -0
- package/lib/types/client/chat/TurnTailNodeView.d.ts +7 -0
- package/lib/types/client/chat/TurnTriggerNodeView.d.ts +4 -0
- package/lib/types/client/chat/TurnUsagePanel.d.ts +15 -0
- package/lib/types/client/chat/message-chrome.d.ts +50 -0
- package/lib/types/client/chat/register-node-renderers.d.ts +14 -0
- package/lib/types/client/chat/render-entry.d.ts +9 -0
- package/lib/types/client/chat/searchable-hidden.d.ts +9 -0
- package/lib/types/client/chat/stat-dialog.d.ts +20 -0
- package/lib/types/client/chat/step-process.d.ts +11 -0
- package/lib/types/client/chat/token-format.d.ts +25 -0
- package/lib/types/client/chat/turn-assistant.d.ts +8 -0
- package/lib/types/client/chat/turn-rail-items.d.ts +37 -0
- package/lib/types/client/chat/turn-trigger.d.ts +15 -0
- package/lib/types/client/chat/use-calendar-day.d.ts +6 -0
- package/lib/types/client/chat/use-chat-navigation.d.ts +69 -0
- package/lib/types/client/chat/use-chat-reading.d.ts +102 -0
- package/lib/types/client/chat/use-chat-scroll.d.ts +35 -0
- package/lib/types/client/chat/use-chat-viewport.d.ts +169 -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/chat/use-turn-data.d.ts +9 -0
- package/lib/types/client/contract/assistant-content.d.ts +9 -0
- package/lib/types/client/contract/chat-nodes.d.ts +108 -0
- package/lib/types/client/contract/chat-visibility.d.ts +10 -0
- package/lib/types/client/contract/process-groups.d.ts +25 -0
- package/lib/types/client/contract/slots.d.ts +258 -0
- package/lib/types/client/contract/snapshot.d.ts +105 -0
- package/lib/types/client/contract/store.d.ts +13 -0
- package/lib/types/client/contract/turn-metrics.d.ts +19 -0
- package/lib/types/client/contract/turn-process.d.ts +40 -0
- package/lib/types/client/conversation-nodes/assistant.d.ts +36 -0
- package/lib/types/client/conversation-nodes/chat-snapshot-builder.d.ts +103 -0
- package/lib/types/client/conversation-nodes/command.d.ts +53 -0
- package/lib/types/client/conversation-nodes/common.d.ts +41 -0
- package/lib/types/client/conversation-nodes/compaction.d.ts +21 -0
- package/lib/types/client/conversation-nodes/event-projection.d.ts +63 -0
- package/lib/types/client/conversation-nodes/fallback.d.ts +16 -0
- package/lib/types/client/conversation-nodes/inbox.d.ts +40 -0
- package/lib/types/client/conversation-nodes/message.d.ts +42 -0
- package/lib/types/client/conversation-nodes/process-activity.d.ts +9 -0
- package/lib/types/client/conversation-nodes/process-groups.d.ts +27 -0
- package/lib/types/client/conversation-nodes/register.d.ts +7 -0
- package/lib/types/client/conversation-nodes/request-prompt.d.ts +44 -0
- package/lib/types/client/conversation-nodes/retry.d.ts +22 -0
- package/lib/types/client/conversation-nodes/tool.d.ts +23 -0
- package/lib/types/client/conversation-nodes/turn-error.d.ts +30 -0
- package/lib/types/client/conversation-nodes/turn-max-tokens.d.ts +22 -0
- package/lib/types/client/conversation-nodes/turn-navigation.d.ts +17 -0
- package/lib/types/client/conversation-nodes/turn-process-presentation.d.ts +30 -0
- package/lib/types/client/conversation-nodes/turn-process.d.ts +34 -0
- package/lib/types/client/conversation-nodes/turn-tail.d.ts +28 -0
- package/lib/types/client/index.d.ts +38 -0
- package/lib/types/client/locale.d.ts +378 -0
- package/lib/types/client/markdown-labels.d.ts +10 -0
- package/lib/types/client/model/conversation-context.d.ts +21 -0
- package/lib/types/client/model/tool-call-tree.d.ts +45 -0
- package/lib/types/client/performance-usage.d.ts +20 -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 +22 -0
- package/lib/types/client/settings/PreferenceRow.d.ts +18 -0
- package/lib/types/client/settings/TranscriptViewRow.d.ts +22 -0
- package/lib/types/client/stores.d.ts +20 -0
- package/lib/types/client/transcript-view.d.ts +25 -0
- package/lib/types/index.d.ts +6 -0
- package/package.json +106 -3
|
@@ -0,0 +1,169 @@
|
|
|
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 resized;
|
|
32
|
+
private readerIntent;
|
|
33
|
+
private paging;
|
|
34
|
+
/**
|
|
35
|
+
* Bind to the containing scrollport and observe content and viewport sizes.
|
|
36
|
+
* @param list - Chat root inside an optional shared conversation scrollport.
|
|
37
|
+
* @param column - ordered outer Node/Group boxes; its size changes invalidate cached landings.
|
|
38
|
+
*/
|
|
39
|
+
attach(list: HTMLElement, column: HTMLElement): void;
|
|
40
|
+
/** Disconnect DOM resources and clear observations for the detached view. */
|
|
41
|
+
detach(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Connect business policy without changing DOM listener ownership.
|
|
44
|
+
* @param events - business handlers for scroll and layout changes.
|
|
45
|
+
* @returns a disposer that disconnects only these handlers.
|
|
46
|
+
*/
|
|
47
|
+
connect(events: ViewportEvents): () => void;
|
|
48
|
+
/**
|
|
49
|
+
* Adopt the loaded turn anchors without querying the DOM.
|
|
50
|
+
* @param turns - ordered loaded turns from the committed Chat snapshot.
|
|
51
|
+
*/
|
|
52
|
+
updateTurns(turns: ReturnType<ChatSnapshot['navigation']['items']>): void;
|
|
53
|
+
/**
|
|
54
|
+
* Resolve the tail from the committed turn index.
|
|
55
|
+
* @returns the latest loaded turn, or null for an empty window.
|
|
56
|
+
*/
|
|
57
|
+
get latestTurn(): number | null;
|
|
58
|
+
/** Discard geometry-dependent landing knowledge while retaining scroll attribution. */
|
|
59
|
+
invalidate(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Accept a sampled reader position without retaining a known landing.
|
|
62
|
+
* @param metrics - settled reader position used as the next attribution baseline.
|
|
63
|
+
*/
|
|
64
|
+
acknowledge(metrics: ViewportMetrics): void;
|
|
65
|
+
/**
|
|
66
|
+
* Consume the pending transcript resize.
|
|
67
|
+
* A delivery that arrives with one is the browser's layout compensation,
|
|
68
|
+
* not a reader choice, so it must not re-anchor the semantic position.
|
|
69
|
+
* @returns whether the transcript resized since the previous sample.
|
|
70
|
+
*/
|
|
71
|
+
consumeResize(): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Consume reader input recorded since the previous sample.
|
|
74
|
+
* Geometry alone cannot separate a reader scroll from the browser's layout
|
|
75
|
+
* compensation, so a transcript that moved with reader input present is the
|
|
76
|
+
* reader's own choice.
|
|
77
|
+
* @returns whether wheel, touch, pointer, key, or find-in-page input arrived.
|
|
78
|
+
*/
|
|
79
|
+
consumeReaderIntent(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Compare the current scroll geometry with the last acknowledged position.
|
|
82
|
+
* @returns current metrics and movement attribution, or null while detached.
|
|
83
|
+
*/
|
|
84
|
+
readScroll(): ViewportScroll | null;
|
|
85
|
+
private metrics;
|
|
86
|
+
private anchor;
|
|
87
|
+
/**
|
|
88
|
+
* Capture visible transcript content, excluding Turn controls that relocate when history expands.
|
|
89
|
+
* @returns a visible semantic anchor, or null when no anchor can be resolved.
|
|
90
|
+
*/
|
|
91
|
+
capturePosition(): ChatScrollPosition | null;
|
|
92
|
+
/**
|
|
93
|
+
* Approximate the active Turn by binary-searching outer Node/Group boxes.
|
|
94
|
+
* Gaps retain the last visited Turn candidate, not necessarily the immediate predecessor.
|
|
95
|
+
* A known landing bypasses measurement while its position is unchanged.
|
|
96
|
+
* @param metrics - reusable scroll metrics; omitted callers request a fresh read.
|
|
97
|
+
* @returns the Turn near the reading line, or null while detached or empty.
|
|
98
|
+
*/
|
|
99
|
+
readVisibleTurn(metrics?: ViewportMetrics | null): number | null;
|
|
100
|
+
/**
|
|
101
|
+
* Align a known loaded turn and return its actual clamped position.
|
|
102
|
+
* A split Node anchor selects its first visible part.
|
|
103
|
+
* @param turn - loaded turn to align below the scrollport's top edge.
|
|
104
|
+
* @returns the actual landing, or null when its anchor is unavailable.
|
|
105
|
+
*/
|
|
106
|
+
scrollToTurn(turn: number): ViewportLanding | null;
|
|
107
|
+
/**
|
|
108
|
+
* Align the nearest available fallback for an unavailable turn anchor.
|
|
109
|
+
* @param turn - minimum turn number for a mounted fallback row.
|
|
110
|
+
* @returns the fallback landing, or null when no eligible row exists.
|
|
111
|
+
*/
|
|
112
|
+
scrollToTurnAtOrAfter(turn: number): ViewportLanding | null;
|
|
113
|
+
/**
|
|
114
|
+
* Restore a semantic anchor with a raw-position fallback.
|
|
115
|
+
* @param position - semantic scroll memory; raw top is used only if its row is absent.
|
|
116
|
+
* @returns the actual landing, or null while detached.
|
|
117
|
+
*/
|
|
118
|
+
restore(position: ChatScrollPosition): ViewportLanding | null;
|
|
119
|
+
/**
|
|
120
|
+
* Re-align the reader's own settled row after a layout change moved it.
|
|
121
|
+
* A missing row leaves the scrollport untouched: the raw position is only
|
|
122
|
+
* meaningful for the row it was sampled against.
|
|
123
|
+
* @param position - semantic position sampled while the reader owned the transcript.
|
|
124
|
+
* @returns the actual landing, or null when the row is absent or still aligned.
|
|
125
|
+
*/
|
|
126
|
+
restoreReaderRow(position: ChatScrollPosition | null): ViewportLanding | null;
|
|
127
|
+
/** Retain the first eligible transcript seat in DOM order; selection reads no geometry. */
|
|
128
|
+
beginPaging(): void;
|
|
129
|
+
/**
|
|
130
|
+
* Retain one old row and its inner/outer offsets for paging and later content growth.
|
|
131
|
+
* @param position - an explicit landing to retain; omitted callers capture the current reading position.
|
|
132
|
+
*/
|
|
133
|
+
beginPreserving(position?: ChatScrollPosition | null): void;
|
|
134
|
+
private retain;
|
|
135
|
+
/** Release paging ownership and its content-size observation. */
|
|
136
|
+
stopPreserving(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Expose retained paging ownership to navigation and resize policy.
|
|
139
|
+
* @returns whether a paging row is retained for subsequent layout changes.
|
|
140
|
+
*/
|
|
141
|
+
get preserving(): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Compensate inner scrolling first, then the outer scrollport, within their actual scroll ranges.
|
|
144
|
+
* An inner write pauses its bound follow controller so the reading anchor takes priority.
|
|
145
|
+
* @returns the actual landing, or null when no visible retained row remains.
|
|
146
|
+
*/
|
|
147
|
+
preserve(): ViewportLanding | null;
|
|
148
|
+
/**
|
|
149
|
+
* Align the scrollport with its current floor.
|
|
150
|
+
* @param follow - independent follow intent and scrolling controller.
|
|
151
|
+
* @returns the actual floor landing, or null while detached.
|
|
152
|
+
*/
|
|
153
|
+
scrollToBottom(follow: ScrollFollow): ViewportLanding | null;
|
|
154
|
+
private align;
|
|
155
|
+
private write;
|
|
156
|
+
private readonly onScroll;
|
|
157
|
+
private readonly onScrollEnd;
|
|
158
|
+
private readonly onIntent;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Bind viewport resource ownership to the component's layout lifetime.
|
|
162
|
+
* @returns one viewport owner and the element refs attached for this mount.
|
|
163
|
+
*/
|
|
164
|
+
export declare function useChatViewport(): {
|
|
165
|
+
viewport: ChatViewport;
|
|
166
|
+
listRef: RefObject<HTMLDivElement>;
|
|
167
|
+
columnRef: RefObject<HTMLDivElement>;
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=use-chat-viewport.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ObservableSnapshot } from '@qilin-agent/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
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConversationLocationDataStore, ConversationTurnDataMap } from '@qilin-agent/client-ui-conversation/client';
|
|
2
|
+
/**
|
|
3
|
+
* Subscribe to one value from a Turn's keyed Location-data store.
|
|
4
|
+
* @param data - current Turn data store, or absence for a Node outside a Turn.
|
|
5
|
+
* @param key - declaration-merged business key.
|
|
6
|
+
* @returns the current value for that key.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useTurnDataValue<Key extends Extract<keyof ConversationTurnDataMap, string>>(data: ConversationLocationDataStore<ConversationTurnDataMap> | undefined, key: Key): Readonly<ConversationTurnDataMap[Key]> | undefined;
|
|
9
|
+
//# sourceMappingURL=use-turn-data.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AssistantBlock } from '@qilin-agent/client-ui-conversation/client';
|
|
2
|
+
/**
|
|
3
|
+
* Test whether Assistant blocks contain a user-facing reply rather than only
|
|
4
|
+
* reasoning or Tool-call protocol material.
|
|
5
|
+
* @param blocks - Assistant content blocks.
|
|
6
|
+
* @returns whether the blocks contain visible reply content.
|
|
7
|
+
*/
|
|
8
|
+
export declare function hasAssistantReplyContent(blocks: readonly AssistantBlock[]): boolean;
|
|
9
|
+
//# sourceMappingURL=assistant-content.d.ts.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { AssistantBlock, AssistantMessageNode, CommandNode, CompactionSummaryNode, ConversationLocation, ConversationViewNode, ModelRetryNode, RunningToolCall, ToolCallBlock } from '@qilin-agent/client-ui-conversation/client';
|
|
2
|
+
/** Final Chat render unit produced by a Chat business Definition. */
|
|
3
|
+
export interface ChatConversationViewNode extends ConversationViewNode {
|
|
4
|
+
readonly target: 'chat';
|
|
5
|
+
readonly anchorSeq: number;
|
|
6
|
+
readonly location: ConversationLocation;
|
|
7
|
+
readonly visibility: 'visible' | 'hidden';
|
|
8
|
+
}
|
|
9
|
+
/** Merge-extensible payload registry keyed by final Chat renderer kind. */
|
|
10
|
+
export interface ChatNodeDataMap {
|
|
11
|
+
}
|
|
12
|
+
/** Renderer kinds contributed by the currently installed Chat business modules. */
|
|
13
|
+
export type ChatNodeKind = Extract<keyof ChatNodeDataMap, string>;
|
|
14
|
+
/** Final Chat Node narrowed to one registered renderer kind and payload. */
|
|
15
|
+
export type ChatNode<Kind extends ChatNodeKind = ChatNodeKind> = {
|
|
16
|
+
[RegisteredKind in Kind]: ChatConversationViewNode & {
|
|
17
|
+
readonly kind: RegisteredKind;
|
|
18
|
+
readonly data: ChatNodeDataMap[RegisteredKind];
|
|
19
|
+
};
|
|
20
|
+
}[Kind];
|
|
21
|
+
/** Final Assistant row payload shared by streaming and settled states. */
|
|
22
|
+
export interface AssistantChatData {
|
|
23
|
+
readonly status: 'running' | 'settled' | 'interrupted';
|
|
24
|
+
readonly turn: number;
|
|
25
|
+
readonly step: number;
|
|
26
|
+
readonly blocks: readonly AssistantBlock[];
|
|
27
|
+
readonly time: number;
|
|
28
|
+
readonly usage?: unknown;
|
|
29
|
+
readonly finalNode?: AssistantMessageNode;
|
|
30
|
+
}
|
|
31
|
+
/** Settled or interrupted Assistant payload with its durable presentation node. */
|
|
32
|
+
export type FinalAssistantChatData = AssistantChatData & {
|
|
33
|
+
readonly finalNode: AssistantMessageNode;
|
|
34
|
+
};
|
|
35
|
+
/** Root Tool row payload; the root lifecycle owns all recursive subcalls. */
|
|
36
|
+
export interface ToolChatData {
|
|
37
|
+
readonly root: ToolCallBlock;
|
|
38
|
+
}
|
|
39
|
+
/** One manual command and its correlated compaction transaction. */
|
|
40
|
+
export interface ManualCompactionChatData {
|
|
41
|
+
readonly command: CommandNode;
|
|
42
|
+
readonly compaction: CompactionSummaryNode | null;
|
|
43
|
+
}
|
|
44
|
+
/** One durable retry chain rendered as a single row. */
|
|
45
|
+
export interface RetryChatData {
|
|
46
|
+
readonly attempts: readonly ModelRetryNode[];
|
|
47
|
+
readonly current: ModelRetryNode;
|
|
48
|
+
}
|
|
49
|
+
/** One provider/model route that contributed a billed request attempt. */
|
|
50
|
+
export interface TurnTokenUsageRoute {
|
|
51
|
+
readonly provider: string;
|
|
52
|
+
readonly model: string;
|
|
53
|
+
}
|
|
54
|
+
/** Exact provider-reported token accounting for every attempt in one completed Turn. */
|
|
55
|
+
export interface TurnTokenUsage {
|
|
56
|
+
/** Sum of uncached prompt input across all attempts. */
|
|
57
|
+
readonly uncachedInputTokens: number;
|
|
58
|
+
readonly outputTokens: number;
|
|
59
|
+
/** Exact aggregate prompt plus output total across all attempts. */
|
|
60
|
+
readonly totalTokens: number;
|
|
61
|
+
/** Present only when every attempt reported the bucket. */
|
|
62
|
+
readonly cacheReadTokens?: number;
|
|
63
|
+
/** Present only when every attempt reported the bucket. */
|
|
64
|
+
readonly cacheWriteTokens?: number;
|
|
65
|
+
/** Output subset, present only when every attempt reported it. */
|
|
66
|
+
readonly reasoningTokens?: number;
|
|
67
|
+
/** Present only when every billed attempt has provider/model attribution. */
|
|
68
|
+
readonly routes?: readonly TurnTokenUsageRoute[];
|
|
69
|
+
}
|
|
70
|
+
/** Turn-local footer row that owns actions and optional feature contributions. */
|
|
71
|
+
export interface TurnTailChatData {
|
|
72
|
+
readonly turn: number;
|
|
73
|
+
readonly seq: number;
|
|
74
|
+
readonly time: number;
|
|
75
|
+
/** Last finalized content-bearing Assistant in this Turn. */
|
|
76
|
+
readonly closing: FinalAssistantChatData | null;
|
|
77
|
+
/** Whether non-rendered later evidence makes the closing seq non-tail. */
|
|
78
|
+
readonly branchUnavailable: boolean;
|
|
79
|
+
/** Exact per-Turn accounting; absent when the loaded evidence is incomplete. */
|
|
80
|
+
readonly tokenUsage?: TurnTokenUsage;
|
|
81
|
+
}
|
|
82
|
+
/** Turn-level process disclosure projected before the finalized answer. */
|
|
83
|
+
export interface TurnProcessChatData {
|
|
84
|
+
readonly turn: number;
|
|
85
|
+
readonly controlAnchorSeq: number;
|
|
86
|
+
readonly processStartSeq: number;
|
|
87
|
+
readonly answerAnchorSeq: number | null;
|
|
88
|
+
readonly answerStep: number | null;
|
|
89
|
+
readonly inlineReasoning: boolean;
|
|
90
|
+
readonly messageCount: number;
|
|
91
|
+
readonly toolCallCount: number;
|
|
92
|
+
readonly subagentCount: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Test whether a Tool root has settled.
|
|
96
|
+
* @param block - Tool root lifecycle value.
|
|
97
|
+
* @returns whether the root carries its final result.
|
|
98
|
+
*/
|
|
99
|
+
export declare function isSettledTool(block: ToolCallBlock): block is Extract<ToolCallBlock, {
|
|
100
|
+
kind: 'tool-result';
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Test whether a Tool root is still running.
|
|
104
|
+
* @param block - Tool root lifecycle value.
|
|
105
|
+
* @returns whether the root lacks a final result.
|
|
106
|
+
*/
|
|
107
|
+
export declare function isRunningTool(block: ToolCallBlock): block is RunningToolCall;
|
|
108
|
+
//# sourceMappingURL=chat-nodes.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
* Context containing tool changes retains its notice row.
|
|
6
|
+
* @param node - projected Chat node.
|
|
7
|
+
* @returns whether the node contributes a visible Chat row.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isVisibleChatNode(node: ChatNode): boolean;
|
|
10
|
+
//# sourceMappingURL=chat-visibility.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Business data for Chat process groups; source Nodes remain in the Chat store. */
|
|
2
|
+
export type ProcessActivity = 'read' | 'readImage' | 'search' | 'write' | '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
|
+
/** Present only while the selected live activity has not reached tool/call. */
|
|
12
|
+
readonly preparing?: true;
|
|
13
|
+
}
|
|
14
|
+
/** Presentation facts for one group between independent replies or input. */
|
|
15
|
+
export interface ProcessGroupData {
|
|
16
|
+
readonly turn: number;
|
|
17
|
+
readonly closed: boolean;
|
|
18
|
+
readonly summary: ProcessActivitySummary;
|
|
19
|
+
}
|
|
20
|
+
declare module '@qilin-agent/client-ui-conversation/client' {
|
|
21
|
+
interface ConversationGroupDataMap {
|
|
22
|
+
chat: ProcessGroupData;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=process-groups.d.ts.map
|