@apteva/apteva-kit 0.1.7 → 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 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,6 +166,8 @@ 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;
@@ -180,18 +183,23 @@ interface ChatProps {
180
183
  interface CommandProps {
181
184
  agentId: string;
182
185
  command?: string;
183
- context?: Record<string, any>;
186
+ context?: string;
184
187
  autoExecute?: boolean;
185
188
  allowInput?: boolean;
186
189
  placeholder?: string;
187
190
  submitButtonText?: string;
188
191
  variant?: 'default' | 'compact';
192
+ useMock?: boolean;
193
+ planMode?: boolean;
194
+ onPlanModeChange?: (enabled: boolean) => void;
195
+ enableFileUpload?: boolean;
189
196
  onStart?: () => void;
190
197
  onProgress?: (progress: number) => void;
191
198
  onChunk?: (chunk: string) => void;
192
199
  onComplete?: (result: CommandResult) => void;
193
200
  onError?: (error: Error) => void;
194
201
  onFileUpload?: (files: FileList) => void;
202
+ onAction?: (action: ActionEvent) => void;
195
203
  loadingText?: string;
196
204
  showProgress?: boolean;
197
205
  enableStreaming?: boolean;
@@ -208,6 +216,7 @@ interface PromptProps {
208
216
  agentId: string;
209
217
  placeholder?: string;
210
218
  initialValue?: string;
219
+ useMock?: boolean;
211
220
  submitOn?: 'enter' | 'button' | 'blur';
212
221
  debounceMs?: number;
213
222
  minLength?: number;
@@ -224,6 +233,7 @@ interface StreamProps {
224
233
  prompt: string;
225
234
  context?: Record<string, any>;
226
235
  autoStart?: boolean;
236
+ useMock?: boolean;
227
237
  onStart?: () => void;
228
238
  onChunk?: (chunk: string) => void;
229
239
  onComplete?: (fullText: string) => void;
@@ -271,13 +281,13 @@ interface UseAptevaKitReturn {
271
281
  error: Error | null;
272
282
  }
273
283
 
274
- declare function Chat({ agentId, threadId, initialMessages, onThreadChange, onMessageSent, onAction, onFileUpload, 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;
275
285
 
276
- declare function Command({ agentId, command: initialCommand, context, autoExecute, allowInput, placeholder, submitButtonText, variant, onStart, onProgress, onChunk, onComplete, onError, onFileUpload, 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;
277
287
 
278
- 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;
279
289
 
280
- 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;
281
291
 
282
292
  declare function Widgets({ widgets, onAction, onWidgetMount, layout, spacing, columns, className, }: WidgetsProps): react_jsx_runtime.JSX.Element;
283
293
 
@@ -303,10 +313,74 @@ declare function Threads({ threads, currentThreadId, onThreadSelect, onThreadDel
303
313
 
304
314
  declare function getThemeScript(): string;
305
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
+
306
380
  declare function cn(...inputs: ClassValue[]): string;
307
381
 
308
382
  declare const mockMessages: Message[];
309
383
  declare const mockThreads: Thread[];
310
384
  declare const mockWidgets: Widget[];
311
385
 
312
- 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,6 +166,8 @@ 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;
@@ -180,18 +183,23 @@ interface ChatProps {
180
183
  interface CommandProps {
181
184
  agentId: string;
182
185
  command?: string;
183
- context?: Record<string, any>;
186
+ context?: string;
184
187
  autoExecute?: boolean;
185
188
  allowInput?: boolean;
186
189
  placeholder?: string;
187
190
  submitButtonText?: string;
188
191
  variant?: 'default' | 'compact';
192
+ useMock?: boolean;
193
+ planMode?: boolean;
194
+ onPlanModeChange?: (enabled: boolean) => void;
195
+ enableFileUpload?: boolean;
189
196
  onStart?: () => void;
190
197
  onProgress?: (progress: number) => void;
191
198
  onChunk?: (chunk: string) => void;
192
199
  onComplete?: (result: CommandResult) => void;
193
200
  onError?: (error: Error) => void;
194
201
  onFileUpload?: (files: FileList) => void;
202
+ onAction?: (action: ActionEvent) => void;
195
203
  loadingText?: string;
196
204
  showProgress?: boolean;
197
205
  enableStreaming?: boolean;
@@ -208,6 +216,7 @@ interface PromptProps {
208
216
  agentId: string;
209
217
  placeholder?: string;
210
218
  initialValue?: string;
219
+ useMock?: boolean;
211
220
  submitOn?: 'enter' | 'button' | 'blur';
212
221
  debounceMs?: number;
213
222
  minLength?: number;
@@ -224,6 +233,7 @@ interface StreamProps {
224
233
  prompt: string;
225
234
  context?: Record<string, any>;
226
235
  autoStart?: boolean;
236
+ useMock?: boolean;
227
237
  onStart?: () => void;
228
238
  onChunk?: (chunk: string) => void;
229
239
  onComplete?: (fullText: string) => void;
@@ -271,13 +281,13 @@ interface UseAptevaKitReturn {
271
281
  error: Error | null;
272
282
  }
273
283
 
274
- declare function Chat({ agentId, threadId, initialMessages, onThreadChange, onMessageSent, onAction, onFileUpload, 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;
275
285
 
276
- declare function Command({ agentId, command: initialCommand, context, autoExecute, allowInput, placeholder, submitButtonText, variant, onStart, onProgress, onChunk, onComplete, onError, onFileUpload, 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;
277
287
 
278
- 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;
279
289
 
280
- 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;
281
291
 
282
292
  declare function Widgets({ widgets, onAction, onWidgetMount, layout, spacing, columns, className, }: WidgetsProps): react_jsx_runtime.JSX.Element;
283
293
 
@@ -303,10 +313,74 @@ declare function Threads({ threads, currentThreadId, onThreadSelect, onThreadDel
303
313
 
304
314
  declare function getThemeScript(): string;
305
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
+
306
380
  declare function cn(...inputs: ClassValue[]): string;
307
381
 
308
382
  declare const mockMessages: Message[];
309
383
  declare const mockThreads: Thread[];
310
384
  declare const mockWidgets: Widget[];
311
385
 
312
- 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 };