@makolabs/ripple 0.4.1-0 → 0.5.0

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.
Files changed (59) hide show
  1. package/README.md +165 -205
  2. package/dist/adapters/ai/OpenAIAdapter.d.ts +115 -0
  3. package/dist/adapters/ai/OpenAIAdapter.js +568 -0
  4. package/dist/adapters/ai/index.d.ts +3 -0
  5. package/dist/adapters/ai/index.js +3 -0
  6. package/dist/adapters/ai/types.d.ts +108 -0
  7. package/dist/adapters/ai/types.js +31 -0
  8. package/dist/adapters/storage/BaseAdapter.js +31 -31
  9. package/dist/ai/AIChatInterface.svelte +435 -0
  10. package/dist/ai/AIChatInterface.svelte.d.ts +18 -0
  11. package/dist/ai/ChatInput.svelte +211 -0
  12. package/dist/ai/ChatInput.svelte.d.ts +18 -0
  13. package/dist/ai/CodeRenderer.svelte +174 -0
  14. package/dist/ai/CodeRenderer.svelte.d.ts +8 -0
  15. package/dist/ai/ComposeDropdown.svelte +171 -0
  16. package/dist/ai/ComposeDropdown.svelte.d.ts +9 -0
  17. package/dist/ai/MermaidRenderer.svelte +89 -0
  18. package/dist/ai/MermaidRenderer.svelte.d.ts +7 -0
  19. package/dist/ai/MessageBox.svelte +403 -0
  20. package/dist/ai/MessageBox.svelte.d.ts +12 -0
  21. package/dist/ai/ThinkingDisplay.svelte +275 -0
  22. package/dist/ai/ThinkingDisplay.svelte.d.ts +9 -0
  23. package/dist/ai/ai-chat-interface.d.ts +161 -0
  24. package/dist/ai/ai-chat-interface.js +63 -0
  25. package/dist/ai/content-detector.d.ts +41 -0
  26. package/dist/ai/content-detector.js +153 -0
  27. package/dist/config/ai.d.ts +13 -0
  28. package/dist/config/ai.js +43 -0
  29. package/dist/elements/accordion/accordion.js +1 -1
  30. package/dist/elements/badge/Badge.svelte +14 -3
  31. package/dist/elements/dropdown/Dropdown.svelte +2 -2
  32. package/dist/elements/dropdown/Select.svelte +1 -1
  33. package/dist/elements/progress/Progress.svelte +7 -10
  34. package/dist/file-browser/FileBrowser.svelte +1 -1
  35. package/dist/forms/DateRange.svelte +18 -16
  36. package/dist/forms/NumberInput.svelte +1 -1
  37. package/dist/forms/RadioInputs.svelte +1 -1
  38. package/dist/forms/RadioPill.svelte +1 -1
  39. package/dist/forms/Tags.svelte +2 -2
  40. package/dist/helper/date.d.ts +1 -0
  41. package/dist/helper/date.js +6 -0
  42. package/dist/index.d.ts +65 -1
  43. package/dist/index.js +11 -0
  44. package/dist/layout/activity-list/ActivityList.svelte +94 -0
  45. package/dist/layout/activity-list/ActivityList.svelte.d.ts +4 -0
  46. package/dist/layout/activity-list/activity-list.d.ts +152 -0
  47. package/dist/layout/activity-list/activity-list.js +59 -0
  48. package/dist/layout/card/Card.svelte +1 -5
  49. package/dist/layout/card/metric-card.d.ts +18 -18
  50. package/dist/layout/table/Cells.svelte +1 -7
  51. package/dist/layout/table/Cells.svelte.d.ts +1 -1
  52. package/dist/modal/Modal.svelte +4 -2
  53. package/dist/modal/Modal.svelte.d.ts +1 -1
  54. package/dist/modal/modal.d.ts +19 -18
  55. package/dist/modal/modal.js +7 -6
  56. package/dist/sonner/sonner.svelte +1 -7
  57. package/dist/types/markdown.d.ts +14 -0
  58. package/dist/utils/Portal.svelte +1 -1
  59. package/package.json +128 -121
package/README.md CHANGED
@@ -144,21 +144,21 @@ Components use standardized enums for colors, sizes, and variants:
144
144
 
145
145
  ```typescript
146
146
  // Colors available for most components
147
- Color.DEFAULT // 'default'
148
- Color.PRIMARY // 'primary'
149
- Color.SECONDARY // 'secondary'
150
- Color.INFO // 'info'
151
- Color.SUCCESS // 'success'
152
- Color.WARNING // 'warning'
153
- Color.DANGER // 'danger'
147
+ Color.DEFAULT; // 'default'
148
+ Color.PRIMARY; // 'primary'
149
+ Color.SECONDARY; // 'secondary'
150
+ Color.INFO; // 'info'
151
+ Color.SUCCESS; // 'success'
152
+ Color.WARNING; // 'warning'
153
+ Color.DANGER; // 'danger'
154
154
 
155
155
  // Sizes available for most components
156
- Size.XS // 'xs'
157
- Size.SM // 'sm'
158
- Size.BASE // 'base'
159
- Size.LG // 'lg'
160
- Size.XL // 'xl'
161
- Size.XXL // '2xl'
156
+ Size.XS; // 'xs'
157
+ Size.SM; // 'sm'
158
+ Size.BASE; // 'base'
159
+ Size.LG; // 'lg'
160
+ Size.XL; // 'xl'
161
+ Size.XXL; // '2xl'
162
162
  ```
163
163
 
164
164
  ### Consistent Props Pattern
@@ -191,21 +191,10 @@ Buttons come with different variants, colors, sizes, and shapes:
191
191
  <Button variant="link" color={Color.INFO}>Link Button</Button>
192
192
 
193
193
  <!-- Button with onclick handler -->
194
- <Button
195
- color={Color.SUCCESS}
196
- onclick={() => console.log('Button clicked')}
197
- >
198
- Click Me
199
- </Button>
194
+ <Button color={Color.SUCCESS} onclick={() => console.log('Button clicked')}>Click Me</Button>
200
195
 
201
196
  <!-- Button as link -->
202
- <Button
203
- href="https://example.com"
204
- target="_blank"
205
- color={Color.PRIMARY}
206
- >
207
- Visit Website
208
- </Button>
197
+ <Button href="https://example.com" target="_blank" color={Color.PRIMARY}>Visit Website</Button>
209
198
 
210
199
  <!-- Button sizes -->
211
200
  <Button size={Size.XS}>Extra Small</Button>
@@ -233,51 +222,43 @@ Modals with different sizes and custom content:
233
222
  let isOpen = false;
234
223
  </script>
235
224
 
236
- <Button onclick={() => isOpen = true}>Open Modal</Button>
225
+ <Button onclick={() => (isOpen = true)}>Open Modal</Button>
237
226
 
238
227
  <!-- Basic modal -->
239
- <Modal
240
- open={isOpen}
241
- title="Basic Modal"
242
- size={Size.BASE}
243
- onClose={() => isOpen = false}
244
- >
245
- <p>Modal content goes here</p>
228
+ <Modal open={isOpen} title="Basic Modal" size={Size.BASE} onClose={() => (isOpen = false)}>
229
+ <p>Modal content goes here</p>
246
230
  </Modal>
247
231
 
248
232
  <!-- Modal with different size -->
249
- <Modal
250
- open={isOpen}
251
- title="Large Modal"
252
- size={Size.XL}
253
- onClose={() => isOpen = false}
254
- >
255
- <p>This modal is larger and provides more content space</p>
233
+ <Modal open={isOpen} title="Large Modal" size={Size.XL} onClose={() => (isOpen = false)}>
234
+ <p>This modal is larger and provides more content space</p>
256
235
  </Modal>
257
236
 
258
237
  <!-- Modal with custom header and footer -->
259
- <Modal
260
- open={isOpen}
261
- onClose={() => isOpen = false}
262
- size={Size.BASE}
263
- >
264
- <svelte:fragment slot="header">
265
- <div class="flex items-center">
266
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 16 16">
267
- <path d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
268
- </svg>
269
- <h3 class="text-lg font-medium">Custom Header</h3>
270
- </div>
271
- </svelte:fragment>
272
-
273
- <p>Modal with custom header and footer</p>
274
-
275
- <svelte:fragment slot="footer">
276
- <div class="flex justify-end space-x-2">
277
- <Button variant="outline" onclick={() => isOpen = false}>Cancel</Button>
278
- <Button color={Color.PRIMARY}>Save Changes</Button>
279
- </div>
280
- </svelte:fragment>
238
+ <Modal open={isOpen} onClose={() => (isOpen = false)} size={Size.BASE}>
239
+ <svelte:fragment slot="header">
240
+ <div class="flex items-center">
241
+ <svg
242
+ xmlns="http://www.w3.org/2000/svg"
243
+ width="24"
244
+ height="24"
245
+ fill="currentColor"
246
+ viewBox="0 0 16 16"
247
+ >
248
+ <path d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
249
+ </svg>
250
+ <h3 class="text-lg font-medium">Custom Header</h3>
251
+ </div>
252
+ </svelte:fragment>
253
+
254
+ <p>Modal with custom header and footer</p>
255
+
256
+ <svelte:fragment slot="footer">
257
+ <div class="flex justify-end space-x-2">
258
+ <Button variant="outline" onclick={() => (isOpen = false)}>Cancel</Button>
259
+ <Button color={Color.PRIMARY}>Save Changes</Button>
260
+ </div>
261
+ </svelte:fragment>
281
262
  </Modal>
282
263
 
283
264
  <!-- TODO: Remove position prop from Modal component in future versions -->
@@ -293,18 +274,14 @@ Drawers can slide in from different edges of the screen:
293
274
  let isDrawerOpen = false;
294
275
  </script>
295
276
 
296
- <Button onclick={() => isDrawerOpen = true}>Open Drawer</Button>
277
+ <Button onclick={() => (isDrawerOpen = true)}>Open Drawer</Button>
297
278
 
298
- <Drawer
299
- open={isDrawerOpen}
300
- position="right"
301
- onClose={() => isDrawerOpen = false}
302
- >
303
- <div class="p-4">
304
- <h3 class="text-lg font-medium mb-4">Drawer Title</h3>
305
- <p class="mb-4">This is a drawer that slides in from the side of the screen.</p>
306
- <Button onclick={() => isDrawerOpen = false}>Close Drawer</Button>
307
- </div>
279
+ <Drawer open={isDrawerOpen} position="right" onClose={() => (isDrawerOpen = false)}>
280
+ <div class="p-4">
281
+ <h3 class="mb-4 text-lg font-medium">Drawer Title</h3>
282
+ <p class="mb-4">This is a drawer that slides in from the side of the screen.</p>
283
+ <Button onclick={() => (isDrawerOpen = false)}>Close Drawer</Button>
284
+ </div>
308
285
  </Drawer>
309
286
  ```
310
287
 
@@ -315,22 +292,22 @@ A component for consistent page headers:
315
292
  ```svelte
316
293
  <script lang="ts">
317
294
  import { PageHeader, Button, Color } from '@makolabs/ripple';
318
-
295
+
319
296
  const breadcrumbs = [
320
- { label: 'Dashboard', href: '#' },
321
- { label: 'Projects', href: '#' },
322
- { label: 'Current Project' }
297
+ { label: 'Dashboard', href: '#' },
298
+ { label: 'Projects', href: '#' },
299
+ { label: 'Current Project' }
323
300
  ];
324
301
  </script>
325
302
 
326
- <PageHeader
327
- title="Project Dashboard"
328
- description="View and manage your project details"
329
- breadcrumbs={breadcrumbs}
303
+ <PageHeader
304
+ title="Project Dashboard"
305
+ description="View and manage your project details"
306
+ {breadcrumbs}
330
307
  >
331
- <svelte:fragment slot="actions">
332
- <Button color={Color.PRIMARY}>New Project</Button>
333
- </svelte:fragment>
308
+ <svelte:fragment slot="actions">
309
+ <Button color={Color.PRIMARY}>New Project</Button>
310
+ </svelte:fragment>
334
311
  </PageHeader>
335
312
  ```
336
313
 
@@ -347,7 +324,7 @@ Cards can be customized with different styles:
347
324
  <p>Card content goes here</p>
348
325
  </Card>
349
326
 
350
- <StatsCard
327
+ <StatsCard
351
328
  label="Monthly Sales"
352
329
  value="$865,000"
353
330
  previousValue="$750,000"
@@ -370,33 +347,33 @@ Tables for displaying structured data with pagination and sorting:
370
347
  ```svelte
371
348
  <script lang="ts">
372
349
  import { Table, Color, Size } from '@makolabs/ripple';
373
-
350
+
374
351
  let data = [
375
- { id: 1, name: 'John Doe', email: 'john@example.com', status: 'Active' },
376
- { id: 2, name: 'Jane Smith', email: 'jane@example.com', status: 'Inactive' },
377
- { id: 3, name: 'Robert Johnson', email: 'robert@example.com', status: 'Active' }
352
+ { id: 1, name: 'John Doe', email: 'john@example.com', status: 'Active' },
353
+ { id: 2, name: 'Jane Smith', email: 'jane@example.com', status: 'Inactive' },
354
+ { id: 3, name: 'Robert Johnson', email: 'robert@example.com', status: 'Active' }
378
355
  ];
379
-
356
+
380
357
  const columns = [
381
- { key: 'name', label: 'Name', sortable: true },
382
- { key: 'email', label: 'Email', sortable: true },
383
- { key: 'status', label: 'Status' }
358
+ { key: 'name', label: 'Name', sortable: true },
359
+ { key: 'email', label: 'Email', sortable: true },
360
+ { key: 'status', label: 'Status' }
384
361
  ];
385
-
362
+
386
363
  let selected = [];
387
364
  let sort = { column: 'name', direction: 'asc' };
388
365
  </script>
389
366
 
390
- <Table
391
- data={data}
392
- {columns}
393
- color={Color.PRIMARY}
394
- size={Size.BASE}
395
- pageSize={10}
396
- selectable={true}
397
- bind:selected={selected}
398
- bind:sort={sort}
399
- striped={true}
367
+ <Table
368
+ {data}
369
+ {columns}
370
+ color={Color.PRIMARY}
371
+ size={Size.BASE}
372
+ pageSize={10}
373
+ selectable={true}
374
+ bind:selected
375
+ bind:sort
376
+ striped={true}
400
377
  />
401
378
  ```
402
379
 
@@ -407,38 +384,38 @@ Tabs for organizing content into different views:
407
384
  ```svelte
408
385
  <script lang="ts">
409
386
  import { TabGroup, TabContent, Color, Size } from '@makolabs/ripple';
410
-
387
+
411
388
  const tabs = [
412
- { value: 'overview', label: 'Overview' },
413
- { value: 'details', label: 'Details' },
414
- { value: 'settings', label: 'Settings' }
389
+ { value: 'overview', label: 'Overview' },
390
+ { value: 'details', label: 'Details' },
391
+ { value: 'settings', label: 'Settings' }
415
392
  ];
416
-
393
+
417
394
  let activeTab = 'overview';
418
-
395
+
419
396
  function handleTabChange(value) {
420
- console.log(`Tab changed to ${value}`);
397
+ console.log(`Tab changed to ${value}`);
421
398
  }
422
399
  </script>
423
400
 
424
- <TabGroup
425
- tabs={tabs}
426
- bind:selected={activeTab}
427
- onchange={handleTabChange}
428
- color={Color.PRIMARY}
429
- size={Size.BASE}
401
+ <TabGroup
402
+ {tabs}
403
+ bind:selected={activeTab}
404
+ onchange={handleTabChange}
405
+ color={Color.PRIMARY}
406
+ size={Size.BASE}
430
407
  >
431
- <TabContent value="overview" persisted>
432
- <p>Overview content here</p>
433
- </TabContent>
434
-
435
- <TabContent value="details" persisted>
436
- <p>Details content here</p>
437
- </TabContent>
438
-
439
- <TabContent value="settings" persisted>
440
- <p>Settings content here</p>
441
- </TabContent>
408
+ <TabContent value="overview" persisted>
409
+ <p>Overview content here</p>
410
+ </TabContent>
411
+
412
+ <TabContent value="details" persisted>
413
+ <p>Details content here</p>
414
+ </TabContent>
415
+
416
+ <TabContent value="settings" persisted>
417
+ <p>Settings content here</p>
418
+ </TabContent>
442
419
  </TabGroup>
443
420
  ```
444
421
 
@@ -464,28 +441,22 @@ Dropdown selector for choosing from a list of options:
464
441
  ```svelte
465
442
  <script lang="ts">
466
443
  import { Select, Size } from '@makolabs/ripple';
467
-
444
+
468
445
  const items = [
469
- { label: 'Option 1', value: 'option1' },
470
- { label: 'Option 2', value: 'option2' },
471
- { label: 'Option 3', value: 'option3', disabled: true },
472
- { label: 'Option 4', value: 'option4' }
446
+ { label: 'Option 1', value: 'option1' },
447
+ { label: 'Option 2', value: 'option2' },
448
+ { label: 'Option 3', value: 'option3', disabled: true },
449
+ { label: 'Option 4', value: 'option4' }
473
450
  ];
474
-
451
+
475
452
  let selected = 'option1';
476
-
453
+
477
454
  function handleSelect(event) {
478
- console.log('Selected:', event.value);
455
+ console.log('Selected:', event.value);
479
456
  }
480
457
  </script>
481
458
 
482
- <Select
483
- {items}
484
- bind:value={selected}
485
- class="w-64"
486
- size={Size.BASE}
487
- onselect={handleSelect}
488
- />
459
+ <Select {items} bind:value={selected} class="w-64" size={Size.BASE} onselect={handleSelect} />
489
460
  ```
490
461
 
491
462
  ### Dropdown Component
@@ -496,40 +467,35 @@ Menu dropdown for actions and navigation:
496
467
  <script lang="ts">
497
468
  import { Dropdown, Size } from '@makolabs/ripple';
498
469
  import FluentChevronDown16Filled from '$icons/FluentChevronDown16Filled.svelte';
499
-
470
+
500
471
  const sections = [
501
- {
502
- items: [
503
- {
504
- label: 'Edit',
505
- icon: FluentPen16Filled,
506
- onclick: () => console.log('Edit clicked')
507
- },
508
- {
509
- label: 'Duplicate',
510
- icon: FluentPenSparkle24Filled,
511
- onclick: () => console.log('Duplicate clicked')
512
- }
513
- ]
514
- },
515
- {
516
- items: [
517
- {
518
- label: 'Delete',
519
- icon: FluentDelete24Filled,
520
- onclick: () => console.log('Delete clicked')
521
- }
522
- ]
523
- }
472
+ {
473
+ items: [
474
+ {
475
+ label: 'Edit',
476
+ icon: FluentPen16Filled,
477
+ onclick: () => console.log('Edit clicked')
478
+ },
479
+ {
480
+ label: 'Duplicate',
481
+ icon: FluentPenSparkle24Filled,
482
+ onclick: () => console.log('Duplicate clicked')
483
+ }
484
+ ]
485
+ },
486
+ {
487
+ items: [
488
+ {
489
+ label: 'Delete',
490
+ icon: FluentDelete24Filled,
491
+ onclick: () => console.log('Delete clicked')
492
+ }
493
+ ]
494
+ }
524
495
  ];
525
496
  </script>
526
497
 
527
- <Dropdown
528
- sections={sections}
529
- label="Actions"
530
- size={Size.BASE}
531
- icon={FluentChevronDown16Filled}
532
- />
498
+ <Dropdown {sections} label="Actions" size={Size.BASE} icon={FluentChevronDown16Filled} />
533
499
  ```
534
500
 
535
501
  ## Component Composition
@@ -538,39 +504,32 @@ Ripple UI components are designed to work together seamlessly:
538
504
 
539
505
  ```svelte
540
506
  <script lang="ts">
541
- import { Card, TabGroup, TabContent, Button, Color, Size } from '@makolabs/ripple';
542
-
543
- const tabs = [
544
- { value: 'overview', label: 'Overview' },
545
- { value: 'details', label: 'Details' },
546
- { value: 'settings', label: 'Settings' }
547
- ];
548
-
549
- let activeTab = 'overview';
507
+ import { Card, TabGroup, TabContent, Button, Color, Size } from '@makolabs/ripple';
508
+
509
+ const tabs = [
510
+ { value: 'overview', label: 'Overview' },
511
+ { value: 'details', label: 'Details' },
512
+ { value: 'settings', label: 'Settings' }
513
+ ];
514
+
515
+ let activeTab = 'overview';
550
516
  </script>
551
517
 
552
518
  <Card title="Project Information" color={Color.PRIMARY}>
553
- <TabGroup
554
- tabs={tabs}
555
- bind:selected={activeTab}
556
- color={Color.INFO}
557
- size={Size.BASE}
558
- >
559
- <TabContent value="overview">
560
- <p>Project overview content here...</p>
561
- <Button variant="solid" color={Color.SUCCESS} size={Size.SM}>
562
- Take Action
563
- </Button>
564
- </TabContent>
565
-
566
- <TabContent value="details">
567
- <p>Project details content here...</p>
568
- </TabContent>
569
-
570
- <TabContent value="settings">
571
- <p>Project settings content here...</p>
572
- </TabContent>
573
- </TabGroup>
519
+ <TabGroup {tabs} bind:selected={activeTab} color={Color.INFO} size={Size.BASE}>
520
+ <TabContent value="overview">
521
+ <p>Project overview content here...</p>
522
+ <Button variant="solid" color={Color.SUCCESS} size={Size.SM}>Take Action</Button>
523
+ </TabContent>
524
+
525
+ <TabContent value="details">
526
+ <p>Project details content here...</p>
527
+ </TabContent>
528
+
529
+ <TabContent value="settings">
530
+ <p>Project settings content here...</p>
531
+ </TabContent>
532
+ </TabGroup>
574
533
  </Card>
575
534
  ```
576
535
 
@@ -589,7 +548,7 @@ You can still import specific component types when needed:
589
548
  ```svelte
590
549
  <script lang="ts">
591
550
  import { Button, type ButtonProps } from '@makolabs/ripple';
592
-
551
+
593
552
  // Create a custom button with specific props
594
553
  const myButton: ButtonProps = {
595
554
  variant: 'outline',
@@ -600,3 +559,4 @@ You can still import specific component types when needed:
600
559
  </script>
601
560
 
602
561
  <Button {...myButton}>Custom Button</Button>
562
+ ```
@@ -0,0 +1,115 @@
1
+ import type { ChatResponse, ChatMessage, StreamingCallback } from '../../index.js';
2
+ import type { AIAdapter, AIContext } from './types.js';
3
+ /**
4
+ * Configuration for OpenAI adapter
5
+ */
6
+ export interface OpenAIAdapterConfig {
7
+ /**
8
+ * OpenAI API key
9
+ */
10
+ apiKey: string;
11
+ /**
12
+ * Model to use (defaults to gpt-4-turbo-preview)
13
+ */
14
+ model?: string;
15
+ /**
16
+ * Base URL for API calls (defaults to OpenAI's API)
17
+ */
18
+ baseUrl?: string;
19
+ /**
20
+ * System prompt for the AI
21
+ */
22
+ systemPrompt?: string;
23
+ /**
24
+ * Temperature for responses (0-2, defaults to 0.7)
25
+ */
26
+ temperature?: number;
27
+ /**
28
+ * Maximum tokens in response (defaults to 4000)
29
+ */
30
+ maxTokens?: number;
31
+ /**
32
+ * Whether to maintain conversation history (defaults to true)
33
+ */
34
+ maintainHistory?: boolean;
35
+ /**
36
+ * Maximum number of messages to keep in history (defaults to 20)
37
+ */
38
+ maxHistoryLength?: number;
39
+ }
40
+ /**
41
+ * OpenAI adapter with simple sliding window memory
42
+ * Handles communication with OpenAI's GPT models with AI-generated summaries
43
+ */
44
+ export declare class OpenAIAdapter implements AIAdapter {
45
+ private config;
46
+ private messages;
47
+ private summary;
48
+ private userProfile;
49
+ private maxMessages;
50
+ constructor(config: OpenAIAdapterConfig);
51
+ getName(): string;
52
+ isConfigured(): boolean;
53
+ private getDefaultSystemPrompt;
54
+ private getCodeRules;
55
+ private getMermaidRules;
56
+ private buildConditionalSystemPrompt;
57
+ sendMessage(message: string, context?: AIContext): Promise<ChatResponse>;
58
+ sendMessageStream(message: string, onStream: StreamingCallback, context?: AIContext): Promise<ChatResponse>;
59
+ getHistory(): ChatMessage[];
60
+ clearHistory(): void;
61
+ setSystemPrompt(prompt: string): void;
62
+ getSystemPrompt(): string;
63
+ /**
64
+ * Update configuration
65
+ */
66
+ updateConfig(newConfig: Partial<OpenAIAdapterConfig>): void;
67
+ /**
68
+ * Get current configuration (without API key for security)
69
+ */
70
+ getConfig(): Omit<OpenAIAdapterConfig, 'apiKey'>;
71
+ /**
72
+ * Add message to memory with sliding window + AI summary logic
73
+ */
74
+ private addToMemory;
75
+ /**
76
+ * Create AI summary and truncate old messages
77
+ */
78
+ private createSummaryAndTruncate;
79
+ /**
80
+ * Generate summary using OpenAI
81
+ */
82
+ private generateSummaryWithAI;
83
+ /**
84
+ * Build memory context from summary + recent messages
85
+ */
86
+ private buildMemoryContext;
87
+ /**
88
+ * Extract user information
89
+ */
90
+ private extractUserInfo;
91
+ /**
92
+ * Save to localStorage
93
+ */
94
+ private saveToStorage;
95
+ /**
96
+ * Load from localStorage
97
+ */
98
+ private loadFromStorage;
99
+ private generateId;
100
+ /**
101
+ * Build enhanced system prompt with memory context
102
+ */
103
+ private buildEnhancedSystemPrompt;
104
+ /**
105
+ * Get memory statistics
106
+ */
107
+ getMemoryStats(): {
108
+ totalMessages: number;
109
+ hasSummary: boolean;
110
+ };
111
+ /**
112
+ * Get the context that will be sent to AI
113
+ */
114
+ getContextForAI(): string;
115
+ }