@apteva/apteva-kit 0.1.3 → 0.1.9
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.mts +82 -6
- package/dist/index.d.ts +82 -6
- package/dist/index.js +1349 -200
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1336 -187
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -81,6 +81,7 @@ interface ListItem {
|
|
|
81
81
|
description?: string;
|
|
82
82
|
image?: string;
|
|
83
83
|
metadata?: Record<string, any>;
|
|
84
|
+
backgroundColor?: string;
|
|
84
85
|
}
|
|
85
86
|
interface ChartWidget extends Widget {
|
|
86
87
|
type: 'chart';
|
|
@@ -165,9 +166,12 @@ interface ChatProps {
|
|
|
165
166
|
agentId: string;
|
|
166
167
|
threadId?: string | null;
|
|
167
168
|
initialMessages?: Message[];
|
|
169
|
+
context?: string;
|
|
170
|
+
useMock?: boolean;
|
|
168
171
|
onThreadChange?: (threadId: string) => void;
|
|
169
172
|
onMessageSent?: (message: Message) => void;
|
|
170
173
|
onAction?: (action: ActionEvent) => void;
|
|
174
|
+
onFileUpload?: (files: FileList) => void;
|
|
171
175
|
theme?: 'light' | 'dark' | 'auto';
|
|
172
176
|
placeholder?: string;
|
|
173
177
|
showHeader?: boolean;
|
|
@@ -179,17 +183,23 @@ interface ChatProps {
|
|
|
179
183
|
interface CommandProps {
|
|
180
184
|
agentId: string;
|
|
181
185
|
command?: string;
|
|
182
|
-
context?:
|
|
186
|
+
context?: string;
|
|
183
187
|
autoExecute?: boolean;
|
|
184
188
|
allowInput?: boolean;
|
|
185
189
|
placeholder?: string;
|
|
186
190
|
submitButtonText?: string;
|
|
187
191
|
variant?: 'default' | 'compact';
|
|
192
|
+
useMock?: boolean;
|
|
193
|
+
planMode?: boolean;
|
|
194
|
+
onPlanModeChange?: (enabled: boolean) => void;
|
|
195
|
+
enableFileUpload?: boolean;
|
|
188
196
|
onStart?: () => void;
|
|
189
197
|
onProgress?: (progress: number) => void;
|
|
190
198
|
onChunk?: (chunk: string) => void;
|
|
191
199
|
onComplete?: (result: CommandResult) => void;
|
|
192
200
|
onError?: (error: Error) => void;
|
|
201
|
+
onFileUpload?: (files: FileList) => void;
|
|
202
|
+
onAction?: (action: ActionEvent) => void;
|
|
193
203
|
loadingText?: string;
|
|
194
204
|
showProgress?: boolean;
|
|
195
205
|
enableStreaming?: boolean;
|
|
@@ -206,6 +216,7 @@ interface PromptProps {
|
|
|
206
216
|
agentId: string;
|
|
207
217
|
placeholder?: string;
|
|
208
218
|
initialValue?: string;
|
|
219
|
+
useMock?: boolean;
|
|
209
220
|
submitOn?: 'enter' | 'button' | 'blur';
|
|
210
221
|
debounceMs?: number;
|
|
211
222
|
minLength?: number;
|
|
@@ -222,6 +233,7 @@ interface StreamProps {
|
|
|
222
233
|
prompt: string;
|
|
223
234
|
context?: Record<string, any>;
|
|
224
235
|
autoStart?: boolean;
|
|
236
|
+
useMock?: boolean;
|
|
225
237
|
onStart?: () => void;
|
|
226
238
|
onChunk?: (chunk: string) => void;
|
|
227
239
|
onComplete?: (fullText: string) => void;
|
|
@@ -269,13 +281,13 @@ interface UseAptevaKitReturn {
|
|
|
269
281
|
error: Error | null;
|
|
270
282
|
}
|
|
271
283
|
|
|
272
|
-
declare function Chat({ agentId, threadId, initialMessages, onThreadChange, onMessageSent, onAction, placeholder, showHeader, headerTitle, className, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
284
|
+
declare function Chat({ agentId, threadId, initialMessages, context, onThreadChange, onMessageSent, onAction, onFileUpload, placeholder, showHeader, headerTitle, className, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
273
285
|
|
|
274
|
-
declare function Command({ agentId, command: initialCommand, context, autoExecute, allowInput, placeholder, submitButtonText, variant, onStart, onProgress, onChunk, onComplete, onError, loadingText, showProgress, enableStreaming, resultRenderer, className, }: CommandProps): react_jsx_runtime.JSX.Element;
|
|
286
|
+
declare function Command({ agentId, command: initialCommand, context, autoExecute, allowInput, placeholder, submitButtonText, variant, useMock, planMode, onPlanModeChange, enableFileUpload, onStart, onProgress, onChunk, onComplete, onError, onFileUpload, onAction, loadingText, showProgress, enableStreaming, resultRenderer, className, }: CommandProps): react_jsx_runtime.JSX.Element;
|
|
275
287
|
|
|
276
|
-
declare function Prompt({ agentId, placeholder, initialValue, submitOn, debounceMs, minLength, maxLength, onSubmit, onResult, onChange, variant, showSuggestions, className, }: PromptProps): react_jsx_runtime.JSX.Element;
|
|
288
|
+
declare function Prompt({ agentId, placeholder, initialValue, useMock, submitOn, debounceMs, minLength, maxLength, onSubmit, onResult, onChange, variant, showSuggestions, className, }: PromptProps): react_jsx_runtime.JSX.Element;
|
|
277
289
|
|
|
278
|
-
declare function Stream({ agentId, prompt, context, autoStart, onStart, onChunk, onComplete, onError, variant, showCursor, typingSpeed, className, }: StreamProps): react_jsx_runtime.JSX.Element;
|
|
290
|
+
declare function Stream({ agentId, prompt, context, autoStart, useMock, onStart, onChunk, onComplete, onError, variant, showCursor, typingSpeed, className, }: StreamProps): react_jsx_runtime.JSX.Element;
|
|
279
291
|
|
|
280
292
|
declare function Widgets({ widgets, onAction, onWidgetMount, layout, spacing, columns, className, }: WidgetsProps): react_jsx_runtime.JSX.Element;
|
|
281
293
|
|
|
@@ -301,10 +313,74 @@ declare function Threads({ threads, currentThreadId, onThreadSelect, onThreadDel
|
|
|
301
313
|
|
|
302
314
|
declare function getThemeScript(): string;
|
|
303
315
|
|
|
316
|
+
interface AptevaClientConfig {
|
|
317
|
+
apiUrl?: string;
|
|
318
|
+
apiKey?: string;
|
|
319
|
+
}
|
|
320
|
+
interface ChatMessage {
|
|
321
|
+
role: 'user' | 'assistant' | 'system';
|
|
322
|
+
content: string;
|
|
323
|
+
}
|
|
324
|
+
interface ChatRequest {
|
|
325
|
+
agent_id: string;
|
|
326
|
+
message: string | Array<{
|
|
327
|
+
type: 'text' | 'image' | 'document';
|
|
328
|
+
text?: string;
|
|
329
|
+
source?: {
|
|
330
|
+
type: 'base64';
|
|
331
|
+
media_type: string;
|
|
332
|
+
data: string;
|
|
333
|
+
};
|
|
334
|
+
}>;
|
|
335
|
+
thread_id?: string;
|
|
336
|
+
stream?: boolean;
|
|
337
|
+
system?: string;
|
|
338
|
+
}
|
|
339
|
+
interface ChatResponse {
|
|
340
|
+
message: string;
|
|
341
|
+
thread_id: string;
|
|
342
|
+
widgets?: any[];
|
|
343
|
+
}
|
|
344
|
+
interface StreamChunk {
|
|
345
|
+
type: 'token' | 'widget' | 'complete';
|
|
346
|
+
content?: string;
|
|
347
|
+
widget?: any;
|
|
348
|
+
thread_id?: string;
|
|
349
|
+
}
|
|
350
|
+
declare class AptevaClient {
|
|
351
|
+
private config;
|
|
352
|
+
constructor();
|
|
353
|
+
/**
|
|
354
|
+
* Update client configuration (optional - users can override defaults)
|
|
355
|
+
*/
|
|
356
|
+
configure(config: AptevaClientConfig): void;
|
|
357
|
+
/**
|
|
358
|
+
* Get current configuration
|
|
359
|
+
*/
|
|
360
|
+
getConfig(): AptevaClientConfig;
|
|
361
|
+
/**
|
|
362
|
+
* Send a chat message to an agent
|
|
363
|
+
*/
|
|
364
|
+
chat(request: ChatRequest): Promise<ChatResponse>;
|
|
365
|
+
/**
|
|
366
|
+
* Send a chat message with streaming response
|
|
367
|
+
*/
|
|
368
|
+
chatStream(request: ChatRequest, onChunk: (chunk: StreamChunk) => void, onComplete?: (threadId: string) => void, onError?: (error: Error) => void): Promise<void>;
|
|
369
|
+
/**
|
|
370
|
+
* Create a new thread
|
|
371
|
+
*/
|
|
372
|
+
createThread(agentId: string, metadata?: Record<string, any>): Promise<string>;
|
|
373
|
+
/**
|
|
374
|
+
* Get thread messages
|
|
375
|
+
*/
|
|
376
|
+
getThreadMessages(threadId: string): Promise<ChatMessage[]>;
|
|
377
|
+
}
|
|
378
|
+
declare const aptevaClient: AptevaClient;
|
|
379
|
+
|
|
304
380
|
declare function cn(...inputs: ClassValue[]): string;
|
|
305
381
|
|
|
306
382
|
declare const mockMessages: Message[];
|
|
307
383
|
declare const mockThreads: Thread[];
|
|
308
384
|
declare const mockWidgets: Widget[];
|
|
309
385
|
|
|
310
|
-
export { type Action, type ActionEvent, type AptevaKitControl, Button, type ButtonGroupWidget, type ButtonWidget, Card, type CardWidget, type ChartWidget, Chat, type ChatProps, Command, type CommandProps, type CommandResult, type FormField, type FormWidget, type GalleryWidget, type ImageWidget, List, type ListItem, type ListWidget, type MapWidget, type Message, Prompt, type PromptProps, type SendMessageParams, Stream, type StreamProps, type Thread, Threads, type ThreadsProps, type UseAptevaKitReturn, type Widget, Widgets, type WidgetsProps, cn, getThemeScript, mockMessages, mockThreads, mockWidgets };
|
|
386
|
+
export { type Action, type ActionEvent, AptevaClient, type AptevaClientConfig, type AptevaKitControl, Button, type ButtonGroupWidget, type ButtonWidget, Card, type CardWidget, type ChartWidget, Chat, type ChatMessage, type ChatProps, type ChatRequest, type ChatResponse, Command, type CommandProps, type CommandResult, type FormField, type FormWidget, type GalleryWidget, type ImageWidget, List, type ListItem, type ListWidget, type MapWidget, type Message, Prompt, type PromptProps, type SendMessageParams, Stream, type StreamChunk, type StreamProps, type Thread, Threads, type ThreadsProps, type UseAptevaKitReturn, type Widget, Widgets, type WidgetsProps, aptevaClient, cn, getThemeScript, mockMessages, mockThreads, mockWidgets };
|
package/dist/index.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ interface ListItem {
|
|
|
81
81
|
description?: string;
|
|
82
82
|
image?: string;
|
|
83
83
|
metadata?: Record<string, any>;
|
|
84
|
+
backgroundColor?: string;
|
|
84
85
|
}
|
|
85
86
|
interface ChartWidget extends Widget {
|
|
86
87
|
type: 'chart';
|
|
@@ -165,9 +166,12 @@ interface ChatProps {
|
|
|
165
166
|
agentId: string;
|
|
166
167
|
threadId?: string | null;
|
|
167
168
|
initialMessages?: Message[];
|
|
169
|
+
context?: string;
|
|
170
|
+
useMock?: boolean;
|
|
168
171
|
onThreadChange?: (threadId: string) => void;
|
|
169
172
|
onMessageSent?: (message: Message) => void;
|
|
170
173
|
onAction?: (action: ActionEvent) => void;
|
|
174
|
+
onFileUpload?: (files: FileList) => void;
|
|
171
175
|
theme?: 'light' | 'dark' | 'auto';
|
|
172
176
|
placeholder?: string;
|
|
173
177
|
showHeader?: boolean;
|
|
@@ -179,17 +183,23 @@ interface ChatProps {
|
|
|
179
183
|
interface CommandProps {
|
|
180
184
|
agentId: string;
|
|
181
185
|
command?: string;
|
|
182
|
-
context?:
|
|
186
|
+
context?: string;
|
|
183
187
|
autoExecute?: boolean;
|
|
184
188
|
allowInput?: boolean;
|
|
185
189
|
placeholder?: string;
|
|
186
190
|
submitButtonText?: string;
|
|
187
191
|
variant?: 'default' | 'compact';
|
|
192
|
+
useMock?: boolean;
|
|
193
|
+
planMode?: boolean;
|
|
194
|
+
onPlanModeChange?: (enabled: boolean) => void;
|
|
195
|
+
enableFileUpload?: boolean;
|
|
188
196
|
onStart?: () => void;
|
|
189
197
|
onProgress?: (progress: number) => void;
|
|
190
198
|
onChunk?: (chunk: string) => void;
|
|
191
199
|
onComplete?: (result: CommandResult) => void;
|
|
192
200
|
onError?: (error: Error) => void;
|
|
201
|
+
onFileUpload?: (files: FileList) => void;
|
|
202
|
+
onAction?: (action: ActionEvent) => void;
|
|
193
203
|
loadingText?: string;
|
|
194
204
|
showProgress?: boolean;
|
|
195
205
|
enableStreaming?: boolean;
|
|
@@ -206,6 +216,7 @@ interface PromptProps {
|
|
|
206
216
|
agentId: string;
|
|
207
217
|
placeholder?: string;
|
|
208
218
|
initialValue?: string;
|
|
219
|
+
useMock?: boolean;
|
|
209
220
|
submitOn?: 'enter' | 'button' | 'blur';
|
|
210
221
|
debounceMs?: number;
|
|
211
222
|
minLength?: number;
|
|
@@ -222,6 +233,7 @@ interface StreamProps {
|
|
|
222
233
|
prompt: string;
|
|
223
234
|
context?: Record<string, any>;
|
|
224
235
|
autoStart?: boolean;
|
|
236
|
+
useMock?: boolean;
|
|
225
237
|
onStart?: () => void;
|
|
226
238
|
onChunk?: (chunk: string) => void;
|
|
227
239
|
onComplete?: (fullText: string) => void;
|
|
@@ -269,13 +281,13 @@ interface UseAptevaKitReturn {
|
|
|
269
281
|
error: Error | null;
|
|
270
282
|
}
|
|
271
283
|
|
|
272
|
-
declare function Chat({ agentId, threadId, initialMessages, onThreadChange, onMessageSent, onAction, placeholder, showHeader, headerTitle, className, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
284
|
+
declare function Chat({ agentId, threadId, initialMessages, context, onThreadChange, onMessageSent, onAction, onFileUpload, placeholder, showHeader, headerTitle, className, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
273
285
|
|
|
274
|
-
declare function Command({ agentId, command: initialCommand, context, autoExecute, allowInput, placeholder, submitButtonText, variant, onStart, onProgress, onChunk, onComplete, onError, loadingText, showProgress, enableStreaming, resultRenderer, className, }: CommandProps): react_jsx_runtime.JSX.Element;
|
|
286
|
+
declare function Command({ agentId, command: initialCommand, context, autoExecute, allowInput, placeholder, submitButtonText, variant, useMock, planMode, onPlanModeChange, enableFileUpload, onStart, onProgress, onChunk, onComplete, onError, onFileUpload, onAction, loadingText, showProgress, enableStreaming, resultRenderer, className, }: CommandProps): react_jsx_runtime.JSX.Element;
|
|
275
287
|
|
|
276
|
-
declare function Prompt({ agentId, placeholder, initialValue, submitOn, debounceMs, minLength, maxLength, onSubmit, onResult, onChange, variant, showSuggestions, className, }: PromptProps): react_jsx_runtime.JSX.Element;
|
|
288
|
+
declare function Prompt({ agentId, placeholder, initialValue, useMock, submitOn, debounceMs, minLength, maxLength, onSubmit, onResult, onChange, variant, showSuggestions, className, }: PromptProps): react_jsx_runtime.JSX.Element;
|
|
277
289
|
|
|
278
|
-
declare function Stream({ agentId, prompt, context, autoStart, onStart, onChunk, onComplete, onError, variant, showCursor, typingSpeed, className, }: StreamProps): react_jsx_runtime.JSX.Element;
|
|
290
|
+
declare function Stream({ agentId, prompt, context, autoStart, useMock, onStart, onChunk, onComplete, onError, variant, showCursor, typingSpeed, className, }: StreamProps): react_jsx_runtime.JSX.Element;
|
|
279
291
|
|
|
280
292
|
declare function Widgets({ widgets, onAction, onWidgetMount, layout, spacing, columns, className, }: WidgetsProps): react_jsx_runtime.JSX.Element;
|
|
281
293
|
|
|
@@ -301,10 +313,74 @@ declare function Threads({ threads, currentThreadId, onThreadSelect, onThreadDel
|
|
|
301
313
|
|
|
302
314
|
declare function getThemeScript(): string;
|
|
303
315
|
|
|
316
|
+
interface AptevaClientConfig {
|
|
317
|
+
apiUrl?: string;
|
|
318
|
+
apiKey?: string;
|
|
319
|
+
}
|
|
320
|
+
interface ChatMessage {
|
|
321
|
+
role: 'user' | 'assistant' | 'system';
|
|
322
|
+
content: string;
|
|
323
|
+
}
|
|
324
|
+
interface ChatRequest {
|
|
325
|
+
agent_id: string;
|
|
326
|
+
message: string | Array<{
|
|
327
|
+
type: 'text' | 'image' | 'document';
|
|
328
|
+
text?: string;
|
|
329
|
+
source?: {
|
|
330
|
+
type: 'base64';
|
|
331
|
+
media_type: string;
|
|
332
|
+
data: string;
|
|
333
|
+
};
|
|
334
|
+
}>;
|
|
335
|
+
thread_id?: string;
|
|
336
|
+
stream?: boolean;
|
|
337
|
+
system?: string;
|
|
338
|
+
}
|
|
339
|
+
interface ChatResponse {
|
|
340
|
+
message: string;
|
|
341
|
+
thread_id: string;
|
|
342
|
+
widgets?: any[];
|
|
343
|
+
}
|
|
344
|
+
interface StreamChunk {
|
|
345
|
+
type: 'token' | 'widget' | 'complete';
|
|
346
|
+
content?: string;
|
|
347
|
+
widget?: any;
|
|
348
|
+
thread_id?: string;
|
|
349
|
+
}
|
|
350
|
+
declare class AptevaClient {
|
|
351
|
+
private config;
|
|
352
|
+
constructor();
|
|
353
|
+
/**
|
|
354
|
+
* Update client configuration (optional - users can override defaults)
|
|
355
|
+
*/
|
|
356
|
+
configure(config: AptevaClientConfig): void;
|
|
357
|
+
/**
|
|
358
|
+
* Get current configuration
|
|
359
|
+
*/
|
|
360
|
+
getConfig(): AptevaClientConfig;
|
|
361
|
+
/**
|
|
362
|
+
* Send a chat message to an agent
|
|
363
|
+
*/
|
|
364
|
+
chat(request: ChatRequest): Promise<ChatResponse>;
|
|
365
|
+
/**
|
|
366
|
+
* Send a chat message with streaming response
|
|
367
|
+
*/
|
|
368
|
+
chatStream(request: ChatRequest, onChunk: (chunk: StreamChunk) => void, onComplete?: (threadId: string) => void, onError?: (error: Error) => void): Promise<void>;
|
|
369
|
+
/**
|
|
370
|
+
* Create a new thread
|
|
371
|
+
*/
|
|
372
|
+
createThread(agentId: string, metadata?: Record<string, any>): Promise<string>;
|
|
373
|
+
/**
|
|
374
|
+
* Get thread messages
|
|
375
|
+
*/
|
|
376
|
+
getThreadMessages(threadId: string): Promise<ChatMessage[]>;
|
|
377
|
+
}
|
|
378
|
+
declare const aptevaClient: AptevaClient;
|
|
379
|
+
|
|
304
380
|
declare function cn(...inputs: ClassValue[]): string;
|
|
305
381
|
|
|
306
382
|
declare const mockMessages: Message[];
|
|
307
383
|
declare const mockThreads: Thread[];
|
|
308
384
|
declare const mockWidgets: Widget[];
|
|
309
385
|
|
|
310
|
-
export { type Action, type ActionEvent, type AptevaKitControl, Button, type ButtonGroupWidget, type ButtonWidget, Card, type CardWidget, type ChartWidget, Chat, type ChatProps, Command, type CommandProps, type CommandResult, type FormField, type FormWidget, type GalleryWidget, type ImageWidget, List, type ListItem, type ListWidget, type MapWidget, type Message, Prompt, type PromptProps, type SendMessageParams, Stream, type StreamProps, type Thread, Threads, type ThreadsProps, type UseAptevaKitReturn, type Widget, Widgets, type WidgetsProps, cn, getThemeScript, mockMessages, mockThreads, mockWidgets };
|
|
386
|
+
export { type Action, type ActionEvent, AptevaClient, type AptevaClientConfig, type AptevaKitControl, Button, type ButtonGroupWidget, type ButtonWidget, Card, type CardWidget, type ChartWidget, Chat, type ChatMessage, type ChatProps, type ChatRequest, type ChatResponse, Command, type CommandProps, type CommandResult, type FormField, type FormWidget, type GalleryWidget, type ImageWidget, List, type ListItem, type ListWidget, type MapWidget, type Message, Prompt, type PromptProps, type SendMessageParams, Stream, type StreamChunk, type StreamProps, type Thread, Threads, type ThreadsProps, type UseAptevaKitReturn, type Widget, Widgets, type WidgetsProps, aptevaClient, cn, getThemeScript, mockMessages, mockThreads, mockWidgets };
|