@hef2024/llmasaservice-ui 0.16.8

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.
@@ -0,0 +1,521 @@
1
+ import { LLMAsAServiceCustomer } from 'llmasaservice-client';
2
+ import * as React from 'react';
3
+ import React__default from 'react';
4
+ import PrismStyle from 'react-syntax-highlighter';
5
+
6
+ interface ChatPanelProps {
7
+ project_id: string;
8
+ initialPrompt?: string;
9
+ initialMessage?: string;
10
+ title?: string;
11
+ placeholder?: string;
12
+ hideInitialPrompt?: boolean;
13
+ customer?: LLMAsAServiceCustomer;
14
+ messages?: {
15
+ role: "user" | "assistant";
16
+ content: string;
17
+ }[];
18
+ data?: {
19
+ key: string;
20
+ data: string;
21
+ }[];
22
+ thumbsUpClick?: (callId: string) => void;
23
+ thumbsDownClick?: (callId: string) => void;
24
+ theme?: "light" | "dark";
25
+ cssUrl?: string;
26
+ markdownClass?: string;
27
+ width?: string;
28
+ height?: string;
29
+ url?: string | null;
30
+ scrollToEnd?: boolean;
31
+ prismStyle?: PrismStyle;
32
+ service?: string | null;
33
+ historyChangedCallback?: (history: {
34
+ [key: string]: {
35
+ content: string;
36
+ callId: string;
37
+ };
38
+ }) => void;
39
+ responseCompleteCallback?: (callId: string, prompt: string, response: string) => void;
40
+ promptTemplate?: string;
41
+ actions?: {
42
+ pattern: string;
43
+ type?: string;
44
+ markdown?: string;
45
+ callback?: (match: string, groups: any[]) => void;
46
+ clickCode?: string;
47
+ style?: string;
48
+ }[];
49
+ showSaveButton?: boolean;
50
+ showEmailButton?: boolean;
51
+ showNewConversationButton?: boolean;
52
+ followOnQuestions?: string[];
53
+ clearFollowOnQuestionsNextPrompt?: boolean;
54
+ followOnPrompt?: string;
55
+ showPoweredBy?: boolean;
56
+ agent?: string | null;
57
+ conversation?: string | null;
58
+ showCallToAction?: boolean;
59
+ callToActionButtonText?: string;
60
+ callToActionEmailAddress?: string;
61
+ callToActionEmailSubject?: string;
62
+ initialHistory?: {
63
+ [prompt: string]: {
64
+ content: string;
65
+ callId: string;
66
+ };
67
+ };
68
+ hideRagContextInPrompt?: boolean;
69
+ createConversationOnFirstChat?: boolean;
70
+ customerEmailCaptureMode?: "HIDE" | "OPTIONAL" | "REQUIRED";
71
+ customerEmailCapturePlaceholder?: string;
72
+ mcpServers?: [];
73
+ progressiveActions?: boolean;
74
+ }
75
+ interface ExtraProps$1 extends React__default.HTMLAttributes<HTMLElement> {
76
+ inline?: boolean;
77
+ }
78
+ declare const ChatPanel: React__default.FC<ChatPanelProps & ExtraProps$1>;
79
+
80
+ interface AgentPanelProps {
81
+ customer?: LLMAsAServiceCustomer;
82
+ messages?: {
83
+ role: "user" | "assistant";
84
+ content: string;
85
+ }[];
86
+ data?: {
87
+ key: string;
88
+ data: string;
89
+ }[];
90
+ thumbsUpClick?: (callId: string) => void;
91
+ thumbsDownClick?: (callId: string) => void;
92
+ theme?: "light" | "dark";
93
+ markdownClass?: string;
94
+ width?: string;
95
+ height?: string;
96
+ url?: string;
97
+ prismStyle?: PrismStyle;
98
+ service?: string | null;
99
+ historyChangedCallback?: (history: {
100
+ [key: string]: {
101
+ content: string;
102
+ callId: string;
103
+ };
104
+ }) => void;
105
+ responseCompleteCallback?: (callId: string, prompt: string, response: string) => void;
106
+ actions?: {
107
+ pattern: string;
108
+ type?: string;
109
+ markdown?: string;
110
+ callback?: (match: string, groups: any[]) => void;
111
+ clickCode?: string;
112
+ style?: string;
113
+ }[];
114
+ followOnQuestions?: string[];
115
+ clearFollowOnQuestionsNextPrompt?: boolean;
116
+ followOnPrompt?: string;
117
+ showPoweredBy?: boolean;
118
+ agent: string;
119
+ conversation?: string | null;
120
+ initialHistory?: {
121
+ [key: string]: {
122
+ content: string;
123
+ callId: string;
124
+ };
125
+ };
126
+ hideRagContextInPrompt?: boolean;
127
+ createConversationOnFirstChat?: boolean;
128
+ customerEmailCaptureMode?: "HIDE" | "OPTIONAL" | "REQUIRED";
129
+ customerEmailCapturePlaceholder?: string;
130
+ }
131
+ interface ExtraProps extends React__default.HTMLAttributes<HTMLElement> {
132
+ inline?: boolean;
133
+ }
134
+ declare const AgentPanel: React__default.FC<AgentPanelProps & ExtraProps>;
135
+
136
+ /**
137
+ * Context section for agent awareness
138
+ */
139
+ interface ContextSection$1 {
140
+ id: string;
141
+ title: string;
142
+ data: Record<string, unknown>;
143
+ tokens?: number;
144
+ }
145
+ /**
146
+ * Agent context passed to the panel
147
+ */
148
+ interface AgentContext {
149
+ route?: string;
150
+ sections: ContextSection$1[];
151
+ totalTokens?: number;
152
+ }
153
+ /**
154
+ * API Conversation Summary from LLMAsAService
155
+ */
156
+ interface APIConversationSummary {
157
+ conversationId: string;
158
+ title?: string;
159
+ summary?: string;
160
+ createdAt: string;
161
+ updatedAt: string;
162
+ agentId?: string;
163
+ messageCount?: number;
164
+ }
165
+ /**
166
+ * Agent configuration with optional local overrides
167
+ */
168
+ interface AgentConfig {
169
+ id: string;
170
+ localName?: string;
171
+ avatarUrl?: string;
172
+ }
173
+ /**
174
+ * Props for AIAgentPanel
175
+ */
176
+ interface AIAgentPanelProps {
177
+ agents: (string | AgentConfig)[];
178
+ defaultAgent?: string;
179
+ customerId: string;
180
+ apiKey?: string;
181
+ context?: AgentContext | null;
182
+ contextDataSources?: Record<string, unknown>;
183
+ sharedContextSections?: ContextSection$1[];
184
+ pageContextSections?: ContextSection$1[];
185
+ onContextChange?: (context: AgentContext) => void;
186
+ maxContextTokens?: number;
187
+ data?: {
188
+ key: string;
189
+ data: string;
190
+ }[];
191
+ theme?: 'light' | 'dark';
192
+ defaultCollapsed?: boolean;
193
+ defaultWidth?: number;
194
+ minWidth?: number;
195
+ maxWidth?: number;
196
+ position?: 'left' | 'right';
197
+ sidebarPosition?: 'left' | 'right';
198
+ enableAgentSuggestions?: boolean;
199
+ enableContextDetailView?: boolean;
200
+ onAgentSwitch?: (fromAgent: string, toAgent: string) => void;
201
+ onConversationChange?: (conversationId: string) => void;
202
+ historyChangedCallback?: (history: Record<string, {
203
+ content: string;
204
+ callId: string;
205
+ }>) => void;
206
+ responseCompleteCallback?: (callId: string, prompt: string, response: string) => void;
207
+ thumbsUpClick?: (callId: string) => void;
208
+ thumbsDownClick?: (callId: string) => void;
209
+ customer?: LLMAsAServiceCustomer;
210
+ url?: string;
211
+ showPoweredBy?: boolean;
212
+ conversation?: string | null;
213
+ actions?: {
214
+ pattern: string;
215
+ type?: string;
216
+ markdown?: string;
217
+ callback?: (match: string, groups: any[]) => void;
218
+ clickCode?: string;
219
+ style?: string;
220
+ }[];
221
+ followOnQuestions?: string[];
222
+ followOnPrompt?: string;
223
+ historyListLimit?: number;
224
+ }
225
+ declare const AIAgentPanel: React__default.FC<AIAgentPanelProps>;
226
+
227
+ /**
228
+ * AIChatPanel - A modern chat interface using shadcn-style components
229
+ *
230
+ * This component provides the chat functionality for AIAgentPanel,
231
+ * using consistent shadcn-style UI components.
232
+ */
233
+
234
+ /**
235
+ * Agent option for the agent selector dropdown
236
+ */
237
+ interface AgentOption {
238
+ value: string;
239
+ label: string;
240
+ description?: string;
241
+ icon?: React__default.ReactNode;
242
+ avatarUrl?: string;
243
+ }
244
+ interface AIChatPanelProps {
245
+ project_id: string;
246
+ initialPrompt?: string;
247
+ initialMessage?: string;
248
+ title?: string;
249
+ placeholder?: string;
250
+ hideInitialPrompt?: boolean;
251
+ customer?: LLMAsAServiceCustomer;
252
+ data?: {
253
+ key: string;
254
+ data: string;
255
+ }[];
256
+ thumbsUpClick?: (callId: string) => void;
257
+ thumbsDownClick?: (callId: string) => void;
258
+ theme?: 'light' | 'dark';
259
+ url?: string | null;
260
+ service?: string | null;
261
+ historyChangedCallback?: (history: Record<string, {
262
+ content: string;
263
+ callId: string;
264
+ }>) => void;
265
+ responseCompleteCallback?: (callId: string, prompt: string, response: string) => void;
266
+ onLoadingChange?: (isLoading: boolean) => void;
267
+ promptTemplate?: string;
268
+ actions?: {
269
+ pattern: string;
270
+ type?: string;
271
+ markdown?: string;
272
+ callback?: (match: string, groups: any[]) => void;
273
+ clickCode?: string;
274
+ style?: string;
275
+ }[];
276
+ showNewConversationButton?: boolean;
277
+ followOnQuestions?: string[];
278
+ clearFollowOnQuestionsNextPrompt?: boolean;
279
+ followOnPrompt?: string;
280
+ showPoweredBy?: boolean;
281
+ agent?: string | null;
282
+ conversation?: string | null;
283
+ initialHistory?: Record<string, {
284
+ content: string;
285
+ callId: string;
286
+ }>;
287
+ hideRagContextInPrompt?: boolean;
288
+ createConversationOnFirstChat?: boolean;
289
+ mcpServers?: any[];
290
+ progressiveActions?: boolean;
291
+ agentOptions?: AgentOption[];
292
+ currentAgentId?: string;
293
+ onAgentChange?: (agentId: string) => void;
294
+ agentsLoading?: boolean;
295
+ contextSections?: ContextSection[];
296
+ totalContextTokens?: number;
297
+ maxContextTokens?: number;
298
+ enableContextDetailView?: boolean;
299
+ }
300
+ /**
301
+ * Context section for the context viewer
302
+ */
303
+ interface ContextSection {
304
+ id: string;
305
+ title: string;
306
+ data: Record<string, unknown>;
307
+ tokens?: number;
308
+ }
309
+ declare const _default: React__default.NamedExoticComponent<AIChatPanelProps>;
310
+
311
+ /**
312
+ * Agent metadata returned from the LLMAsAService API
313
+ */
314
+ interface AgentMetadata {
315
+ id: string;
316
+ projectId: string;
317
+ groupId?: string;
318
+ displayTitle?: string;
319
+ displayTheme?: 'light' | 'dark';
320
+ displayPlaceholder?: string;
321
+ displayInitialMessageOrPrompt?: string;
322
+ displayStartMessageOrPrompt?: 'message' | 'prompt';
323
+ displayPromptTemplate?: string;
324
+ displayActions?: string;
325
+ displayFollowOnPrompts?: string;
326
+ displayShowEmailButton?: boolean;
327
+ displayShowSaveButton?: boolean;
328
+ displayShowCallToAction?: boolean;
329
+ displayCallToActionButtonText?: string;
330
+ displayCallToActionEmailAddress?: string;
331
+ displayCallToActionEmailSubject?: string;
332
+ displayHideInitialPrompt?: boolean;
333
+ displayScrollToEnd?: boolean;
334
+ displayWidth?: string;
335
+ displayHeight?: string;
336
+ cssUrl?: string;
337
+ data?: string;
338
+ createConversationOnFirstChat?: boolean;
339
+ customerEmailCaptureMode?: 'HIDE' | 'OPTIONAL' | 'REQUIRED';
340
+ customerEmailCapturePlaceholder?: string;
341
+ description?: string;
342
+ }
343
+ interface MCPServer {
344
+ id: string;
345
+ name: string;
346
+ status: 'active' | 'inactive';
347
+ executionMode: 'CLIENT' | 'SERVER';
348
+ url?: string;
349
+ }
350
+ interface AgentProfile {
351
+ status: 'idle' | 'loading' | 'ready' | 'error';
352
+ metadata?: AgentMetadata;
353
+ mcpServers?: MCPServer[];
354
+ error?: string;
355
+ }
356
+ /**
357
+ * Local overrides for agent display properties
358
+ */
359
+ interface AgentLocalOverride {
360
+ localName?: string;
361
+ avatarUrl?: string;
362
+ }
363
+ interface UseAgentRegistryOptions {
364
+ url?: string;
365
+ autoFetch?: boolean;
366
+ localOverrides?: Record<string, AgentLocalOverride>;
367
+ }
368
+ /**
369
+ * Hook to fetch and cache metadata for multiple agents
370
+ */
371
+ declare function useAgentRegistry(agentIds: string[], options?: UseAgentRegistryOptions): {
372
+ getAgent: (agentId: string) => AgentProfile | undefined;
373
+ isAgentReady: (agentId: string) => boolean;
374
+ fetchAllAgents: () => Promise<(() => void) | undefined>;
375
+ buildAgentAwarenessInstructions: (currentAgentId: string) => string;
376
+ readyAgents: string[];
377
+ agentList: {
378
+ id: string;
379
+ name: string;
380
+ description: string;
381
+ status: "idle" | "error" | "loading" | "ready";
382
+ isReady: boolean;
383
+ avatarUrl: string | undefined;
384
+ localName: string | undefined;
385
+ }[];
386
+ agents: Record<string, AgentProfile>;
387
+ isLoading: boolean;
388
+ error: string | null;
389
+ };
390
+
391
+ /**
392
+ * A single conversation entry
393
+ */
394
+ interface Conversation {
395
+ id: string;
396
+ agentId: string;
397
+ title: string;
398
+ preview: string;
399
+ createdAt: string;
400
+ updatedAt: string;
401
+ history: Record<string, {
402
+ content: string;
403
+ callId: string;
404
+ }>;
405
+ }
406
+ /**
407
+ * Grouped conversations by time period
408
+ */
409
+ interface ConversationGroup {
410
+ label: string;
411
+ conversations: Conversation[];
412
+ }
413
+ interface UseConversationStoreOptions {
414
+ namespace?: string;
415
+ maxConversations?: number;
416
+ autoPersist?: boolean;
417
+ }
418
+ /**
419
+ * Hook to manage conversation persistence and history
420
+ */
421
+ declare function useConversationStore(options?: UseConversationStoreOptions): {
422
+ conversations: Conversation[];
423
+ activeConversation: Conversation | null;
424
+ activeConversationId: string | null;
425
+ filteredConversations: Conversation[];
426
+ groupedConversations: ConversationGroup[];
427
+ searchQuery: string;
428
+ setSearchQuery: React.Dispatch<React.SetStateAction<string>>;
429
+ createConversation: (agentId: string, initialHistory?: Record<string, {
430
+ content: string;
431
+ callId: string;
432
+ }>) => Conversation;
433
+ updateConversationHistory: (conversationId: string, history: Record<string, {
434
+ content: string;
435
+ callId: string;
436
+ }>) => void;
437
+ deleteConversation: (conversationId: string) => void;
438
+ selectConversation: (conversationId: string | null) => void;
439
+ getConversationsForAgent: (agentId: string) => Conversation[];
440
+ clearAllConversations: () => void;
441
+ startNewConversation: () => void;
442
+ };
443
+
444
+ interface ButtonProps extends React__default.ButtonHTMLAttributes<HTMLButtonElement> {
445
+ variant?: 'default' | 'secondary' | 'ghost' | 'outline' | 'destructive';
446
+ size?: 'default' | 'sm' | 'lg' | 'icon';
447
+ children: React__default.ReactNode;
448
+ }
449
+ /**
450
+ * shadcn-inspired Button component
451
+ */
452
+ declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
453
+
454
+ interface InputProps extends React__default.InputHTMLAttributes<HTMLInputElement> {
455
+ icon?: React__default.ReactNode;
456
+ }
457
+ /**
458
+ * shadcn-inspired Input component
459
+ */
460
+ declare const Input: React__default.ForwardRefExoticComponent<InputProps & React__default.RefAttributes<HTMLInputElement>>;
461
+
462
+ interface SelectOption {
463
+ value: string;
464
+ label: string;
465
+ description?: string;
466
+ icon?: React__default.ReactNode;
467
+ }
468
+ interface SelectProps {
469
+ value: string;
470
+ onChange: (value: string) => void;
471
+ options: SelectOption[];
472
+ placeholder?: string;
473
+ disabled?: boolean;
474
+ className?: string;
475
+ }
476
+ /**
477
+ * shadcn-inspired Select component
478
+ */
479
+ declare const Select: React__default.FC<SelectProps>;
480
+
481
+ interface ScrollAreaProps {
482
+ children: React__default.ReactNode;
483
+ className?: string;
484
+ maxHeight?: string | number;
485
+ }
486
+ /**
487
+ * shadcn-inspired ScrollArea component with ref forwarding
488
+ */
489
+ declare const ScrollArea: React__default.ForwardRefExoticComponent<ScrollAreaProps & React__default.RefAttributes<HTMLDivElement>>;
490
+
491
+ interface TooltipProps {
492
+ content: React__default.ReactNode;
493
+ children: React__default.ReactNode;
494
+ side?: 'top' | 'right' | 'bottom' | 'left';
495
+ delay?: number;
496
+ className?: string;
497
+ }
498
+ /**
499
+ * shadcn-inspired Tooltip component
500
+ */
501
+ declare const Tooltip: React__default.FC<TooltipProps>;
502
+
503
+ interface DialogProps {
504
+ isOpen: boolean;
505
+ onClose: () => void;
506
+ title?: string;
507
+ description?: string;
508
+ children: React__default.ReactNode;
509
+ className?: string;
510
+ }
511
+ /**
512
+ * shadcn-inspired Dialog component
513
+ */
514
+ declare const Dialog: React__default.FC<DialogProps>;
515
+ interface DialogFooterProps {
516
+ children: React__default.ReactNode;
517
+ className?: string;
518
+ }
519
+ declare const DialogFooter: React__default.FC<DialogFooterProps>;
520
+
521
+ export { AIAgentPanel, type AIAgentPanelProps, _default as AIChatPanel, type AIChatPanelProps, type APIConversationSummary, type AgentContext, type AgentMetadata, AgentPanel, type AgentPanelProps, type AgentProfile, Button, type ButtonProps, ChatPanel, type ChatPanelProps, type ContextSection$1 as ContextSection, type Conversation, type ConversationGroup, Dialog, DialogFooter, type DialogFooterProps, type DialogProps, Input, type InputProps, type MCPServer, ScrollArea, type ScrollAreaProps, Select, type SelectOption, type SelectProps, Tooltip, type TooltipProps, useAgentRegistry, useConversationStore };