@nextclaw/agent-chat-ui 0.1.1 → 0.2.1
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/dist/index.d.ts +50 -13
- package/dist/index.js +1387 -257
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
3
|
|
|
4
4
|
type ChatTexts = {
|
|
5
5
|
slashLoadingLabel: string;
|
|
@@ -22,6 +22,24 @@ type ChatSelectedItem = {
|
|
|
22
22
|
key: string;
|
|
23
23
|
label: string;
|
|
24
24
|
};
|
|
25
|
+
type ChatComposerTokenKind = 'skill' | 'file';
|
|
26
|
+
type ChatComposerTextNode = {
|
|
27
|
+
id: string;
|
|
28
|
+
type: 'text';
|
|
29
|
+
text: string;
|
|
30
|
+
};
|
|
31
|
+
type ChatComposerTokenNode = {
|
|
32
|
+
id: string;
|
|
33
|
+
type: 'token';
|
|
34
|
+
tokenKind: ChatComposerTokenKind;
|
|
35
|
+
tokenKey: string;
|
|
36
|
+
label: string;
|
|
37
|
+
};
|
|
38
|
+
type ChatComposerNode = ChatComposerTextNode | ChatComposerTokenNode;
|
|
39
|
+
type ChatComposerSelection = {
|
|
40
|
+
start: number;
|
|
41
|
+
end: number;
|
|
42
|
+
};
|
|
25
43
|
type ChatToolbarIcon = 'sparkles' | 'brain';
|
|
26
44
|
type ChatToolbarAccessoryIcon = ChatToolbarIcon | 'paperclip';
|
|
27
45
|
type ChatToolbarSelectOption = {
|
|
@@ -45,6 +63,7 @@ type ChatToolbarAccessory = {
|
|
|
45
63
|
key: string;
|
|
46
64
|
label: string;
|
|
47
65
|
icon?: ChatToolbarAccessoryIcon;
|
|
66
|
+
iconOnly?: boolean;
|
|
48
67
|
disabled?: boolean;
|
|
49
68
|
tooltip?: string;
|
|
50
69
|
onClick?: () => void;
|
|
@@ -104,17 +123,15 @@ type ChatSlashMenuProps = {
|
|
|
104
123
|
onSetActiveIndex: (index: number) => void;
|
|
105
124
|
};
|
|
106
125
|
type ChatInputBarProps = {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
hint?: ChatInlineHint | null;
|
|
114
|
-
selectedItems: {
|
|
115
|
-
items: ChatSelectedItem[];
|
|
116
|
-
onRemove: (key: string) => void;
|
|
126
|
+
composer: {
|
|
127
|
+
nodes: ChatComposerNode[];
|
|
128
|
+
placeholder: string;
|
|
129
|
+
disabled: boolean;
|
|
130
|
+
onNodesChange: (nodes: ChatComposerNode[]) => void;
|
|
131
|
+
onSlashQueryChange?: (query: string | null) => void;
|
|
117
132
|
};
|
|
133
|
+
slashMenu: Pick<ChatSlashMenuProps, 'isLoading' | 'items' | 'texts'>;
|
|
134
|
+
hint?: ChatInlineHint | null;
|
|
118
135
|
toolbar: ChatInputBarToolbarProps;
|
|
119
136
|
};
|
|
120
137
|
type ChatMessageRole = 'user' | 'assistant' | 'tool' | 'system' | 'message';
|
|
@@ -160,7 +177,7 @@ type ChatMessageTexts = {
|
|
|
160
177
|
type ChatMessageListProps = {
|
|
161
178
|
messages: ChatMessageViewModel[];
|
|
162
179
|
isSending: boolean;
|
|
163
|
-
|
|
180
|
+
hasAssistantDraft: boolean;
|
|
164
181
|
texts: ChatMessageTexts;
|
|
165
182
|
className?: string;
|
|
166
183
|
};
|
|
@@ -209,4 +226,24 @@ declare function useStickyBottomScroll(params: UseStickyBottomScrollParams): Use
|
|
|
209
226
|
|
|
210
227
|
declare function copyText(text: string): Promise<boolean>;
|
|
211
228
|
|
|
212
|
-
|
|
229
|
+
declare function createChatComposerTextNode(text?: string): ChatComposerTextNode;
|
|
230
|
+
declare function createChatComposerTokenNode(params: {
|
|
231
|
+
tokenKind: ChatComposerTokenKind;
|
|
232
|
+
tokenKey: string;
|
|
233
|
+
label: string;
|
|
234
|
+
}): ChatComposerTokenNode;
|
|
235
|
+
declare function createEmptyChatComposerNodes(): ChatComposerNode[];
|
|
236
|
+
declare function createChatComposerNodesFromText(text: string): ChatComposerNode[];
|
|
237
|
+
declare function normalizeChatComposerNodes(nodes: ChatComposerNode[]): ChatComposerNode[];
|
|
238
|
+
declare function serializeChatComposerDocument(nodes: ChatComposerNode[]): string;
|
|
239
|
+
declare function serializeChatComposerPlainText(nodes: ChatComposerNode[]): string;
|
|
240
|
+
declare function extractChatComposerTokenKeys(nodes: ChatComposerNode[], tokenKind: ChatComposerTokenKind): string[];
|
|
241
|
+
declare function replaceChatComposerRange(nodes: ChatComposerNode[], start: number, end: number, replacement: ChatComposerNode[]): ChatComposerNode[];
|
|
242
|
+
declare function removeChatComposerTokenNodes(nodes: ChatComposerNode[], predicate: (node: ChatComposerTokenNode) => boolean): ChatComposerNode[];
|
|
243
|
+
declare function resolveChatComposerSlashTrigger(nodes: ChatComposerNode[], selection: ChatComposerSelection | null): {
|
|
244
|
+
query: string;
|
|
245
|
+
start: number;
|
|
246
|
+
end: number;
|
|
247
|
+
} | null;
|
|
248
|
+
|
|
249
|
+
export { type ChatComposerNode, type ChatComposerSelection, type ChatComposerTextNode, type ChatComposerTokenKind, type ChatComposerTokenNode, type ChatInlineHint, ChatInputBar, type ChatInputBarActionsProps, type ChatInputBarProps, type ChatInputBarToolbarProps, ChatMessageList, type ChatMessageListProps, type ChatMessagePartViewModel, type ChatMessageRole, type ChatMessageTexts, type ChatMessageViewModel, type ChatSelectedItem, type ChatSkillPickerOption, type ChatSkillPickerProps, type ChatSlashItem, type ChatSlashMenuProps, type ChatTexts, type ChatToolPartViewModel, type ChatToolbarAccessory, type ChatToolbarAccessoryIcon, type ChatToolbarIcon, type ChatToolbarSelect, type ChatToolbarSelectOption, copyText, createChatComposerNodesFromText, createChatComposerTextNode, createChatComposerTokenNode, createEmptyChatComposerNodes, extractChatComposerTokenKeys, normalizeChatComposerNodes, removeChatComposerTokenNodes, replaceChatComposerRange, resolveChatComposerSlashTrigger, serializeChatComposerDocument, serializeChatComposerPlainText, useActiveItemScroll, useCopyFeedback, useElementWidth, useStickyBottomScroll };
|