esap-aiui-react 1.0.0 → 1.0.1
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 +123 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# AIUI React SDK
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/esap-aiui-react)
|
|
4
|
+
[](https://www.npmjs.com/package/esap-aiui-react)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
|
-
[](https://github.com/espai/aiui-react
|
|
7
|
+
[](https://github.com/espai/aiui-react/pulls)
|
|
8
8
|
|
|
9
9
|
**Zero-configuration voice and chat control for React applications through autonomous semantic UI discovery.**
|
|
10
10
|
|
|
@@ -26,11 +26,11 @@ The SDK implements a **hybrid discovery engine** combining MutationObserver-base
|
|
|
26
26
|
- **Privacy-preserving architecture** — Client-side filtering with configurable redaction patterns
|
|
27
27
|
- **Multi-backend AI support** — Compatible with OpenAI GPT-4, Anthropic Claude, Google Gemini, and local models
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
## Architecture
|
|
31
31
|
|
|
32
32
|

|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
### Protocol Design
|
|
35
35
|
|
|
36
36
|
The SDK implements a multi-channel WebSocket architecture to optimize for both latency and bandwidth:
|
|
@@ -46,7 +46,7 @@ This separation prevents JSON parsing overhead from blocking time-sensitive audi
|
|
|
46
46
|
## Installation
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
npm install
|
|
49
|
+
npm install esap-aiui-react
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
### Prerequisites
|
|
@@ -151,17 +151,121 @@ your-application/
|
|
|
151
151
|
│ ├── worklet-processor.js # Microphone input processor
|
|
152
152
|
│ └── index.html
|
|
153
153
|
├── src/
|
|
154
|
+
│ ├── aiui.config.json # AIUI configuration (REQUIRED)
|
|
154
155
|
│ └── App.tsx
|
|
155
156
|
└── package.json
|
|
156
157
|
```
|
|
157
158
|
|
|
159
|
+
### Required: AIUI Configuration File
|
|
160
|
+
|
|
161
|
+
You **must create** an `aiui.config.json` file in your **`src/`** directory. This file defines how the AIUI SDK connects to your backend and which actions are allowed on each page.
|
|
162
|
+
|
|
163
|
+
#### Create `src/aiui.config.json`:
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"applicationId": "your-app-name",
|
|
168
|
+
"serverUrl": "http://localhost:8000",
|
|
169
|
+
"apiKey": "your-secret-key",
|
|
170
|
+
|
|
171
|
+
"pages": [
|
|
172
|
+
{
|
|
173
|
+
"route": "/",
|
|
174
|
+
"title": "Home Page",
|
|
175
|
+
"safeActions": ["click", "fill", "navigate"],
|
|
176
|
+
"dangerousActions": []
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"route": "/dashboard",
|
|
180
|
+
"title": "Dashboard",
|
|
181
|
+
"safeActions": ["view", "filter", "export"],
|
|
182
|
+
"dangerousActions": ["delete"]
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"route": "/users/:id/edit",
|
|
186
|
+
"title": "Edit User",
|
|
187
|
+
"safeActions": ["edit", "save"],
|
|
188
|
+
"dangerousActions": ["delete user", "deactivate"]
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
|
|
192
|
+
"safetyRules": {
|
|
193
|
+
"requireConfirmation": [
|
|
194
|
+
"delete user",
|
|
195
|
+
"delete item",
|
|
196
|
+
"cancel order"
|
|
197
|
+
],
|
|
198
|
+
"blockedSelectors": [
|
|
199
|
+
"input[type=\"password\"]",
|
|
200
|
+
"[data-sensitive=\"true\"]",
|
|
201
|
+
".admin-only"
|
|
202
|
+
],
|
|
203
|
+
"allowedDomains": [
|
|
204
|
+
"localhost",
|
|
205
|
+
"yourdomain.com"
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
"privacy": {
|
|
210
|
+
"exposePasswords": false,
|
|
211
|
+
"exposeCreditCards": false,
|
|
212
|
+
"redactPatterns": [
|
|
213
|
+
"[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}",
|
|
214
|
+
"\\b\\d{3}[-.]?\\d{3}[-.]?\\d{4}\\b"
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
#### Configuration Properties:
|
|
221
|
+
|
|
222
|
+
| Property | Required | Description |
|
|
223
|
+
|----------|----------|-------------|
|
|
224
|
+
| `applicationId` | ✅ | Unique identifier for your application |
|
|
225
|
+
| `serverUrl` | ✅ | Backend API endpoint (WebSocket server URL) |
|
|
226
|
+
| `apiKey` | ✅ | Authentication key for backend connection |
|
|
227
|
+
| `pages` | ✅ | Array of page routes with allowed actions |
|
|
228
|
+
| `safetyRules` | ❌ | Safety configurations for dangerous actions |
|
|
229
|
+
| `privacy` | ❌ | Privacy settings for sensitive data |
|
|
230
|
+
|
|
231
|
+
#### Page Configuration Details:
|
|
232
|
+
|
|
233
|
+
Each page in the `pages` array defines:
|
|
234
|
+
- `route`: URL path (supports dynamic routes like `/users/:id`)
|
|
235
|
+
- `title`: Human-readable page name
|
|
236
|
+
- `safeActions`: Actions users can perform via voice/chat (e.g., "click submit", "fill email")
|
|
237
|
+
- `dangerousActions`: Actions requiring user confirmation before execution
|
|
238
|
+
|
|
239
|
+
#### Load the configuration in your app:
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
import { AIUIProvider } from 'esap-aiui-react';
|
|
243
|
+
import aiuiConfig from './aiui.config.json';
|
|
244
|
+
|
|
245
|
+
function App() {
|
|
246
|
+
return (
|
|
247
|
+
<AIUIProvider config={aiuiConfig}>
|
|
248
|
+
<YourApplication />
|
|
249
|
+
</AIUIProvider>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
**Why this file is required:**
|
|
255
|
+
- ✅ Backend connection - SDK needs `serverUrl` and `apiKey` to connect
|
|
256
|
+
- ✅ Route mapping - Defines which actions are available on each page
|
|
257
|
+
- ✅ Security - Prevents dangerous actions without confirmation
|
|
258
|
+
- ✅ Navigation - Enables voice commands like "navigate to dashboard"
|
|
259
|
+
|
|
260
|
+
Without this file, the SDK cannot connect to your backend or understand your application's structure.
|
|
261
|
+
|
|
158
262
|
## Quick Start
|
|
159
263
|
|
|
160
264
|
### Basic Integration
|
|
161
265
|
|
|
162
266
|
```tsx
|
|
163
|
-
import { AIUIProvider, useAIUI } from '
|
|
164
|
-
import type { AIUIConfig } from '
|
|
267
|
+
import { AIUIProvider, useAIUI } from 'esap-aiui-react';
|
|
268
|
+
import type { AIUIConfig } from 'esap-aiui-react';
|
|
165
269
|
|
|
166
270
|
const config: AIUIConfig = {
|
|
167
271
|
applicationId: 'production-app-v1',
|
|
@@ -204,7 +308,7 @@ function App() {
|
|
|
204
308
|
### Voice Control Component
|
|
205
309
|
|
|
206
310
|
```tsx
|
|
207
|
-
import { useAIUI } from '
|
|
311
|
+
import { useAIUI } from 'esap-aiui-react';
|
|
208
312
|
|
|
209
313
|
function VoiceController() {
|
|
210
314
|
const {
|
|
@@ -238,7 +342,7 @@ function VoiceController() {
|
|
|
238
342
|
### Chat Interface Component
|
|
239
343
|
|
|
240
344
|
```tsx
|
|
241
|
-
import { useAIUI } from '
|
|
345
|
+
import { useAIUI } from 'esap-aiui-react';
|
|
242
346
|
import { useState } from 'react';
|
|
243
347
|
|
|
244
348
|
function ChatController() {
|
|
@@ -486,7 +590,7 @@ interface ChatMessage {
|
|
|
486
590
|
Execute UI actions programmatically without voice input:
|
|
487
591
|
|
|
488
592
|
```typescript
|
|
489
|
-
import { useAIUI } from '
|
|
593
|
+
import { useAIUI } from 'esap-aiui-react';
|
|
490
594
|
|
|
491
595
|
function DataTable() {
|
|
492
596
|
const { executeAction } = useAIUI();
|
|
@@ -536,7 +640,7 @@ function DataTable() {
|
|
|
536
640
|
Combine both voice and chat interfaces for flexible user interaction:
|
|
537
641
|
|
|
538
642
|
```tsx
|
|
539
|
-
import { useAIUI } from '
|
|
643
|
+
import { useAIUI } from 'esap-aiui-react';
|
|
540
644
|
import { useState } from 'react';
|
|
541
645
|
|
|
542
646
|
function AIAssistant() {
|
|
@@ -751,7 +855,7 @@ The `data-select-options` attribute defines available options using `|||` as a d
|
|
|
751
855
|
### Programmatic Navigation
|
|
752
856
|
|
|
753
857
|
```typescript
|
|
754
|
-
import { useAIUI } from '
|
|
858
|
+
import { useAIUI } from 'esap-aiui-react';
|
|
755
859
|
|
|
756
860
|
function NavigationHandler() {
|
|
757
861
|
const { executeAction } = useAIUI();
|
|
@@ -1267,8 +1371,8 @@ We welcome contributions from the community. Please review our contribution guid
|
|
|
1267
1371
|
|
|
1268
1372
|
```bash
|
|
1269
1373
|
# Clone repository
|
|
1270
|
-
git clone https://github.com/espai/aiui-react
|
|
1271
|
-
cd aiui-react
|
|
1374
|
+
git clone https://github.com/espai/aiui-react.git
|
|
1375
|
+
cd aiui-react
|
|
1272
1376
|
|
|
1273
1377
|
# Install dependencies
|
|
1274
1378
|
npm install
|
|
@@ -1329,7 +1433,7 @@ If you use AIUI in academic research, please cite:
|
|
|
1329
1433
|
title={AIUI: Autonomous Voice-Controlled UI Framework with Zero-Configuration Semantic Discovery},
|
|
1330
1434
|
author={Atik, Md Mahabube Alahi},
|
|
1331
1435
|
year={2025},
|
|
1332
|
-
url={https://www.npmjs.com/package
|
|
1436
|
+
url={https://www.npmjs.com/package/esap-aiui-react},
|
|
1333
1437
|
version={1.0.21}
|
|
1334
1438
|
}
|
|
1335
1439
|
```
|
|
@@ -1349,8 +1453,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
1349
1453
|
## Support
|
|
1350
1454
|
|
|
1351
1455
|
**Community Support:**
|
|
1352
|
-
- GitHub Issues: [Report bugs and request features](https://github.com/espai/aiui-react
|
|
1353
|
-
- GitHub Discussions: [Community Q&A and ideas](https://github.com/espai/aiui-react
|
|
1456
|
+
- GitHub Issues: [Report bugs and request features](https://github.com/espai/aiui-react/issues)
|
|
1457
|
+
- GitHub Discussions: [Community Q&A and ideas](https://github.com/espai/aiui-react/discussions)
|
|
1354
1458
|
- Stack Overflow: Tag questions with `aiui-react`
|
|
1355
1459
|
|
|
1356
1460
|
**Commercial Support:**
|
|
@@ -1377,4 +1481,4 @@ Special thanks to early adopters who provided production feedback and contribute
|
|
|
1377
1481
|
|
|
1378
1482
|
---
|
|
1379
1483
|
|
|
1380
|
-
**Built with precision for voice-first web experiences.**
|
|
1484
|
+
**Built with precision for voice-first web experiences.**
|
package/package.json
CHANGED