@foisit/vue-wrapper 2.0.1 β†’ 2.4.2

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/README.md CHANGED
@@ -7,39 +7,38 @@
7
7
 
8
8
  Transform your Vue app into an intelligent, voice-ready platform. Foisit provides a drop-in AI layer that understands natural language, manages multi-step workflows, and executes actionsβ€”all with zero backend required.
9
9
 
10
- > [!NOTE]
11
- > πŸŽ™οΈ **Voice Support Status**: Voice recognition and responses are currently in development and will be released in a future update. The current version focuses on high-performance text-based interactions and AI intent matching.
10
+ > [!NOTE] > **Voice Support Status**: Voice recognition and responses are currently in development and will be released in a future update. The current version focuses on high-performance text-based interactions and AI intent matching.
12
11
 
13
12
  ---
14
13
 
15
- ## πŸ“‹ Table of Contents
14
+ ## Table of Contents
16
15
 
17
- - [Features](#-features)
18
- - [Installation](#-installation)
19
- - [Quick Start](#-quick-start)
20
- - [Core Concepts](#-core-concepts)
21
- - [API Reference](#-api-reference)
22
- - [Advanced Usage](#-advanced-usage)
23
- - [Examples](#-examples)
24
- - [TypeScript Support](#-typescript-support)
25
- - [Best Practices](#-best-practices)
16
+ - [Features](#features)
17
+ - [Installation](#installation)
18
+ - [Quick Start](#quick-start)
19
+ - [Core Concepts](#core-concepts)
20
+ - [API Reference](#api-reference)
21
+ - [Advanced Usage](#advanced-usage)
22
+ - [Examples](#examples)
23
+ - [TypeScript Support](#typescript-support)
24
+ - [Best Practices](#best-practices)
26
25
 
27
26
  ---
28
27
 
29
- ## ✨ Features
28
+ ## Features
30
29
 
31
- - **🧠 Natural Language Understanding** - AI-powered intent matching using GPT-4o mini (proxied securely)
32
- - **πŸ“ Smart Slot Filling** - Auto-generates forms for missing parameters
33
- - **⚠️ Critical Action Protection** - Built-in confirmation dialogs for dangerous operations
34
- - **🎨 Premium UI** - Glassmorphic overlay with dark/light mode support
35
- - **πŸ”’ Zero Backend Required** - Secure proxy architecture keeps API keys server-side
36
- - **⚑ Vue Native** - Uses Composition API, `provide/inject`, and Vue 3 patterns
37
- - **🎯 Type-Safe** - Full TypeScript support with comprehensive types
38
- - **πŸ“± Responsive** - Works flawlessly on desktop and mobile
30
+ - **Natural Language Understanding** - AI-powered intent matching using GPT-4o mini (proxied securely)
31
+ - **Smart Slot Filling** - Auto-generates forms for missing parameters
32
+ - **Critical Action Protection** - Built-in confirmation dialogs for dangerous operations
33
+ - **Premium UI** - Glassmorphic overlay with dark/light mode support
34
+ - **Zero Backend Required** - Secure proxy architecture keeps API keys server-side
35
+ - **Vue Native** - Uses Composition API, `provide/inject`, and Vue 3 patterns
36
+ - **Type-Safe** - Full TypeScript support with comprehensive types
37
+ - **Responsive** - Works flawlessly on desktop and mobile
39
38
 
40
39
  ---
41
40
 
42
- ## πŸš€ Installation
41
+ ## Installation
43
42
 
44
43
  ```bash
45
44
  npm install @foisit/vue-wrapper
@@ -55,7 +54,7 @@ npm install @foisit/vue-wrapper
55
54
 
56
55
  ---
57
56
 
58
- ## 🏁 Quick Start
57
+ ## Quick Start
59
58
 
60
59
  ### Step 1: Wrap Your App
61
60
 
@@ -106,7 +105,7 @@ const openAssistant = () => {
106
105
 
107
106
  ---
108
107
 
109
- ## 🎯 Core Concepts
108
+ ## Core Concepts
110
109
 
111
110
  ### 1. Commands
112
111
 
@@ -137,30 +136,85 @@ Define parameters and Foisit will automatically generate forms to collect them:
137
136
  }
138
137
  ```
139
138
 
139
+ **Enterprise-safe param collection controls**
140
+
141
+ - `collectRequiredViaForm` (default: true): when true, any missing/invalid required params are collected via a form (no conversational guessing).
142
+ - `allowAiParamExtraction` (default: true): when false, AI-extracted params are ignored and the assistant always asks the user for required fields.
143
+
144
+ Example:
145
+
146
+ ```javascript
147
+ {
148
+ command: 'secure create user',
149
+ description: 'No AI guessing, form-only',
150
+ collectRequiredViaForm: true,
151
+ allowAiParamExtraction: false,
152
+ parameters: [
153
+ { name: 'fullName', type: 'string', required: true },
154
+ { name: 'email', type: 'string', required: true },
155
+ { name: 'age', type: 'number', required: true, min: 18 },
156
+ ],
157
+ action: (params) => userService.create(params),
158
+ }
159
+ ```
160
+
140
161
  **Supported Parameter Types:**
141
162
 
142
163
  - `string` - Text input
143
164
  - `number` - Numeric input
144
165
  - `date` - Date picker
145
166
  - `select` - Dropdown (static or async options)
167
+ - `file` - File upload input
168
+
169
+ ### 3. File Parameters
170
+
171
+ Collect files via the built-in form UI and receive them in your command `action`.
172
+
173
+ ```javascript
174
+ {
175
+ command: 'upload file',
176
+ description: 'Pick a file and return it to the action',
177
+ parameters: [
178
+ {
179
+ name: 'attachment',
180
+ type: 'file',
181
+ required: true,
182
+ accept: ['image/*', 'audio/*', 'video/*'],
183
+ multiple: false,
184
+ // delivery: 'file' | 'base64' (default: 'file')
185
+ delivery: 'file',
186
+ },
187
+ ],
188
+ action: async (params) => {
189
+ const file = params?.attachment;
190
+ if (!file) return { type: 'error', message: 'No file provided.' };
191
+ return {
192
+ type: 'success',
193
+ message: `File received. Name: ${file.name}, Type: ${file.type || 'unknown'}, Size: ${file.size} bytes`,
194
+ };
195
+ },
196
+ }
197
+ ```
146
198
 
147
- ### 3. Critical Actions
199
+ `FileParameter` supports validations like `maxFiles`, `maxSizeBytes`, `maxTotalBytes`, and media/image constraints like `maxDurationSec`, `maxWidth`, and `maxHeight`.
200
+
201
+ ### 4. Critical Actions
148
202
 
149
203
  Protect dangerous operations with automatic confirmation dialogs:
150
204
 
151
205
  ```javascript
152
206
  {
153
207
  command: 'delete all data',
154
- critical: true, // πŸ”’ Requires confirmation
208
+ critical: true, // Requires confirmation
155
209
  description: 'Permanently delete all application data',
156
210
  action: async () => {
157
211
  await dataService.deleteAll();
158
- return 'βœ… All data deleted successfully.';
212
+ return 'All data deleted successfully.';
159
213
  }
160
214
  }
161
215
  ```
162
216
 
163
- ### 4. Select Parameters (Static)
217
+ ### 5. Select Parameters (Static)
164
218
 
165
219
  Provide predefined options:
166
220
 
@@ -180,7 +234,7 @@ Provide predefined options:
180
234
  }
181
235
  ```
182
236
 
183
- ### 5. Dynamic Select Parameters
237
+ ### 6. Dynamic Select Parameters
184
238
 
185
239
  Load options from APIs:
186
240
 
@@ -204,7 +258,7 @@ Load options from APIs:
204
258
 
205
259
  ---
206
260
 
207
- ## πŸ“˜ API Reference
261
+ ## API Reference
208
262
 
209
263
  ### `AssistantService` (via `inject`)
210
264
 
@@ -237,7 +291,7 @@ const openWithCallbacks = () => {
237
291
 
238
292
  ##### `addCommand(command, action?)`
239
293
 
240
- Dynamically add a command at runtime.
294
+ Dynamically add or update a command at runtime. Commands registered with `addCommand` apply immediately for the running session; they are stored in memory and are not automatically persisted across page reloads.
241
295
 
242
296
  ```vue
243
297
  <script setup>
@@ -275,6 +329,23 @@ onMounted(() => {
275
329
  </script>
276
330
  ```
277
331
 
332
+ ### Dynamic Updates (Add / Remove / Update commands at runtime) βœ…
333
+
334
+ - Use `addCommand` to add or replace a command for the current runtime.
335
+ - Use `removeCommand(commandPhrase)` to unregister a command immediately.
336
+ - When adding temporary commands inside components, remove them in `onUnmounted` (or equivalent) to avoid leaving stale commands behind.
337
+
338
+ Example β€” register and remove a temporary command:
339
+
340
+ ```vue
341
+ import { onMounted, onUnmounted, inject } from 'vue'; const assistant = inject('assistantService'); onMounted(() => { assistant?.addCommand('temp action', () => 'Temporary action'); }); onUnmounted(() => { assistant?.removeCommand('temp action'); });
342
+ ```
343
+
344
+ Notes:
345
+
346
+ - Commands with optional parameters can return a `form` InteractiveResponse to prompt the user when no params are provided.
347
+ - Commands are not persisted by default; to persist them, re-register at app startup.
348
+
278
349
  ##### `removeCommand(commandPhrase)`
279
350
 
280
351
  Remove a registered command.
@@ -294,7 +365,7 @@ console.log('Available commands:', commands);
294
365
 
295
366
  ---
296
367
 
297
- ## πŸ”§ Configuration Options
368
+ ## Configuration Options
298
369
 
299
370
  ### `AssistantConfig`
300
371
 
@@ -330,7 +401,7 @@ interface AssistantConfig {
330
401
 
331
402
  ---
332
403
 
333
- ## 🎨 Advanced Usage
404
+ ## Advanced Usage
334
405
 
335
406
  ### Example 1: Multi-Step Booking System with Reactive State
336
407
 
@@ -371,7 +442,7 @@ onMounted(() => {
371
442
  bookings.value.push(booking);
372
443
  return {
373
444
  type: 'success',
374
- message: `βœ… Appointment booked for ${params.date}!`,
445
+ message: `Appointment booked for ${params.date}!`,
375
446
  };
376
447
  },
377
448
  });
@@ -486,7 +557,7 @@ onMounted(() => {
486
557
 
487
558
  ---
488
559
 
489
- ## πŸ“ TypeScript Support
560
+ ## TypeScript Support
490
561
 
491
562
  ### Full Type Definitions
492
563
 
@@ -520,7 +591,7 @@ const myCommand: AssistantCommand = {
520
591
 
521
592
  ---
522
593
 
523
- ## 🎯 Best Practices
594
+ ## Best Practices
524
595
 
525
596
  ### 1. Use `onMounted` for Commands
526
597
 
@@ -576,7 +647,7 @@ action: async (params) => {
576
647
 
577
648
  ---
578
649
 
579
- ## πŸ§ͺ Testing
650
+ ## Testing
580
651
 
581
652
  ### Unit Testing with Vitest
582
653
 
@@ -601,7 +672,7 @@ test('renders assistant', () => {
601
672
 
602
673
  ---
603
674
 
604
- ## πŸ”— Related Packages
675
+ ## Related Packages
605
676
 
606
677
  - **[@foisit/core](../core)** - Core engine (auto-installed)
607
678
  - **[@foisit/angular-wrapper](../angular-wrapper)** - Angular integration
@@ -609,7 +680,7 @@ test('renders assistant', () => {
609
680
 
610
681
  ---
611
682
 
612
- ## πŸ› Troubleshooting
683
+ ## Troubleshooting
613
684
 
614
685
  ### Assistant service is undefined
615
686
 
@@ -625,23 +696,23 @@ Make sure you're using Vue 3.3+ and have proper type definitions.
625
696
 
626
697
  ---
627
698
 
628
- ## πŸ“„ License
699
+ ## License
629
700
 
630
701
  MIT Β© [Foisit](https://github.com/boluwatifee4/foisit)
631
702
 
632
703
  ---
633
704
 
634
- ## 🀝 Contributing
705
+ ## Contributing
635
706
 
636
707
  Contributions are welcome! Please read our [Contributing Guide](../../CONTRIBUTING.md) first.
637
708
 
638
709
  ---
639
710
 
640
- ## πŸ“¬ Support
711
+ ## Support
641
712
 
642
- - πŸ“§ Email: support@foisit.com
643
- - πŸ’¬ Discord: [Join our community](https://discord.gg/foisit)
644
- - πŸ› Issues: [GitHub Issues](https://github.com/boluwatifee4/foisit/issues)
713
+ - Email: support@foisit.com
714
+ - Discord: [Join our community](https://discord.gg/foisit)
715
+ - Issues: [GitHub Issues](https://github.com/boluwatifee4/foisit/issues)
645
716
 
646
717
  ---
647
718
 
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { default as AssistantProvider } from './lib/components/AssistantProvider.vue';
2
+ export { useAssistant } from './lib/composables/useAssistant';
3
+ export { AssistantService } from './lib/services/AssistantService';