@centive/aria-sdk 0.7.9 → 0.8.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 +81 -338
- package/dist/components/AriaAssistant.d.ts.map +1 -1
- package/dist/components/AriaStandaloneUI.d.ts.map +1 -1
- package/dist/index.d.ts +48 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1240 -2667
- package/dist/index.js.map +1 -1
- package/dist/lib/AriaSessionManager.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Aria
|
|
1
|
+
# Aria SDK
|
|
2
2
|
|
|
3
|
-
A production-ready
|
|
3
|
+
A production-ready SDK for integrating [Anam AI](https://docs.anam.ai/) into your web application. Simple initialization, automatic session management, and a beautiful AI assistant interface.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@centive/aria-sdk)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -43,19 +43,19 @@ npm install react@^18.0.0 react-dom@^18.0.0 @anam-ai/js-sdk@^4.7.0
|
|
|
43
43
|
| **Tool Call Indicators** | Visual feedback when AI executes functions |
|
|
44
44
|
| **Theme Support** | Light and dark themes |
|
|
45
45
|
|
|
46
|
-
## Configuration
|
|
46
|
+
## Configuration
|
|
47
47
|
|
|
48
48
|
```typescript
|
|
49
|
-
|
|
49
|
+
Aria.init({
|
|
50
50
|
// Required
|
|
51
|
-
websocketUrl: string
|
|
52
|
-
userId: string
|
|
51
|
+
websocketUrl: string, // Your backend WebSocket URL
|
|
52
|
+
userId: string, // Unique user identifier
|
|
53
53
|
|
|
54
54
|
// Optional
|
|
55
|
-
theme?: 'light' | 'dark'
|
|
56
|
-
triggerLabel?: string
|
|
57
|
-
onError?: (error: Error) => void
|
|
58
|
-
}
|
|
55
|
+
theme?: 'light' | 'dark', // UI theme (default: 'light')
|
|
56
|
+
triggerLabel?: string, // Button label (default: 'Talk to Aria')
|
|
57
|
+
onError?: (error: Error) => void, // Error callback
|
|
58
|
+
});
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
### Example with All Options
|
|
@@ -67,19 +67,32 @@ Aria.init({
|
|
|
67
67
|
websocketUrl: 'wss://api.example.com/ws',
|
|
68
68
|
userId: 'user_123',
|
|
69
69
|
theme: 'dark',
|
|
70
|
-
triggerLabel: '
|
|
70
|
+
triggerLabel: 'Need Help?',
|
|
71
71
|
onError: (error) => {
|
|
72
72
|
console.error('Aria SDK error:', error);
|
|
73
|
-
// Send to your error tracking service
|
|
74
73
|
},
|
|
75
74
|
});
|
|
76
75
|
```
|
|
77
76
|
|
|
78
|
-
##
|
|
77
|
+
## API Reference
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
| Method | Description |
|
|
80
|
+
|--------|-------------|
|
|
81
|
+
| `Aria.init(config)` | Initialize the SDK |
|
|
82
|
+
| `Aria.open(mode?)` | Open assistant widget (`'user'` or `'websocket'`) |
|
|
83
|
+
| `Aria.close()` | Close assistant widget |
|
|
84
|
+
| `Aria.minimize()` | Minimize to compact state |
|
|
85
|
+
| `Aria.maximize()` | Restore from minimized |
|
|
86
|
+
| `Aria.destroy()` | Cleanup and remove SDK |
|
|
87
|
+
| `Aria.isInitialized()` | Check if SDK is initialized |
|
|
88
|
+
| `Aria.isOpen()` | Check if widget is open |
|
|
89
|
+
| `Aria.isConnected()` | Check WebSocket connection |
|
|
90
|
+
| `Aria.getSessionId()` | Get current session ID |
|
|
91
|
+
| `Aria.refreshSession()` | Manually refresh session |
|
|
92
|
+
|
|
93
|
+
### Programmatic Control
|
|
82
94
|
|
|
95
|
+
```typescript
|
|
83
96
|
// Open the assistant
|
|
84
97
|
Aria.open();
|
|
85
98
|
|
|
@@ -89,44 +102,28 @@ Aria.open('websocket');
|
|
|
89
102
|
// Close the assistant
|
|
90
103
|
Aria.close();
|
|
91
104
|
|
|
92
|
-
// Minimize
|
|
105
|
+
// Minimize/maximize
|
|
93
106
|
Aria.minimize();
|
|
94
|
-
|
|
95
|
-
// Maximize from minimized state
|
|
96
107
|
Aria.maximize();
|
|
97
108
|
|
|
98
109
|
// Check status
|
|
99
|
-
Aria.
|
|
100
|
-
Aria.
|
|
101
|
-
|
|
102
|
-
Aria.getSessionId(); // string | null
|
|
110
|
+
if (Aria.isConnected()) {
|
|
111
|
+
console.log('Session ID:', Aria.getSessionId());
|
|
112
|
+
}
|
|
103
113
|
|
|
104
|
-
// Cleanup
|
|
114
|
+
// Cleanup when done
|
|
105
115
|
Aria.destroy();
|
|
106
116
|
```
|
|
107
117
|
|
|
108
|
-
---
|
|
109
|
-
|
|
110
118
|
## Backend Requirements
|
|
111
119
|
|
|
112
|
-
The SDK connects to your backend via WebSocket. Your backend
|
|
113
|
-
|
|
114
|
-
### 1. WebSocket Server
|
|
120
|
+
The SDK connects to your backend via WebSocket. Your backend handles:
|
|
115
121
|
|
|
116
|
-
|
|
122
|
+
1. **User Authentication** - Validate the connecting user
|
|
123
|
+
2. **Session Token Generation** - Create Anam AI sessions
|
|
124
|
+
3. **Persona Configuration** - Control AI behavior server-side (avatar, voice, LLM, system prompt)
|
|
117
125
|
|
|
118
|
-
|
|
119
|
-
wss://your-server.com/ws
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### 2. Session Token Generation
|
|
123
|
-
|
|
124
|
-
When a user connects, your backend should:
|
|
125
|
-
1. Authenticate the user
|
|
126
|
-
2. Call the Anam AI API to create a session
|
|
127
|
-
3. Return the session token to the SDK
|
|
128
|
-
|
|
129
|
-
**Expected Response Format:**
|
|
126
|
+
### Expected Response Format
|
|
130
127
|
|
|
131
128
|
```json
|
|
132
129
|
{
|
|
@@ -135,21 +132,13 @@ When a user connects, your backend should:
|
|
|
135
132
|
"session_data": {
|
|
136
133
|
"session_id": "sess_abc123",
|
|
137
134
|
"token": "eyJhbGciOiJIUzI1NiIs...",
|
|
138
|
-
"expires_at": "2026-01-
|
|
135
|
+
"expires_at": "2026-01-27T12:00:00Z"
|
|
139
136
|
},
|
|
140
137
|
"time_taken": 1234
|
|
141
138
|
}
|
|
142
139
|
```
|
|
143
140
|
|
|
144
|
-
###
|
|
145
|
-
|
|
146
|
-
**Important:** Persona configuration (avatar, voice, LLM, system prompt) is controlled by your backend, not the frontend. This provides:
|
|
147
|
-
|
|
148
|
-
- **Security**: Frontend cannot manipulate AI behavior
|
|
149
|
-
- **Flexibility**: Change personas based on user roles, context, or A/B testing
|
|
150
|
-
- **Centralization**: Manage all configurations in one place
|
|
151
|
-
|
|
152
|
-
**Backend Example (Node.js):**
|
|
141
|
+
### Backend Example (Node.js)
|
|
153
142
|
|
|
154
143
|
```javascript
|
|
155
144
|
const WebSocket = require('ws');
|
|
@@ -162,7 +151,6 @@ wss.on('connection', (ws) => {
|
|
|
162
151
|
const data = JSON.parse(message);
|
|
163
152
|
|
|
164
153
|
if (data.user_trigger !== undefined) {
|
|
165
|
-
// Create Anam session with persona config
|
|
166
154
|
const session = await createAnamSession(data.userId);
|
|
167
155
|
|
|
168
156
|
ws.send(JSON.stringify({
|
|
@@ -180,336 +168,91 @@ wss.on('connection', (ws) => {
|
|
|
180
168
|
});
|
|
181
169
|
|
|
182
170
|
async function createAnamSession(userId) {
|
|
183
|
-
// Get persona config based on user context
|
|
184
|
-
const personaConfig = getPersonaForUser(userId);
|
|
185
|
-
|
|
186
171
|
const response = await axios.post('https://api.anam.ai/v1/sessions', {
|
|
187
|
-
persona:
|
|
172
|
+
persona: {
|
|
173
|
+
name: 'Aria',
|
|
174
|
+
avatarId: 'your-avatar-id',
|
|
175
|
+
voiceId: 'your-voice-id',
|
|
176
|
+
llmId: 'your-llm-id',
|
|
177
|
+
systemPrompt: 'You are Aria, a helpful AI assistant.',
|
|
178
|
+
},
|
|
188
179
|
}, {
|
|
189
180
|
headers: { 'Authorization': `Bearer ${process.env.ANAM_API_KEY}` }
|
|
190
181
|
});
|
|
191
182
|
|
|
192
183
|
return response.data;
|
|
193
184
|
}
|
|
194
|
-
|
|
195
|
-
function getPersonaForUser(userId) {
|
|
196
|
-
// Your business logic here
|
|
197
|
-
return {
|
|
198
|
-
name: 'Aria',
|
|
199
|
-
avatarId: 'your-avatar-id',
|
|
200
|
-
voiceId: 'your-voice-id',
|
|
201
|
-
llmId: 'your-llm-id',
|
|
202
|
-
systemPrompt: 'You are Aria, a helpful AI assistant.',
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
185
|
```
|
|
206
186
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
**Frontend → Backend:**
|
|
210
|
-
|
|
211
|
-
| Message | Description |
|
|
212
|
-
|---------|-------------|
|
|
213
|
-
| `{ user_trigger: true }` | User clicked trigger button |
|
|
214
|
-
| `{ user_trigger: false }` | Auto-preload session |
|
|
215
|
-
| `{ type: 'message_history', ... }` | Conversation history |
|
|
216
|
-
| `{ type: 'session_end', ... }` | User ended session |
|
|
217
|
-
|
|
218
|
-
**Backend → Frontend:**
|
|
219
|
-
|
|
220
|
-
| Message | Description |
|
|
221
|
-
|---------|-------------|
|
|
222
|
-
| Session response | Token and session data |
|
|
223
|
-
| `{ type: 'trigger_event', data: {...} }` | Open assistant in center mode |
|
|
224
|
-
| Acknowledgments | Confirm message receipt |
|
|
225
|
-
|
|
226
|
-
### 5. Trigger Events (Optional)
|
|
227
|
-
|
|
228
|
-
Send events from your backend to open the assistant automatically:
|
|
229
|
-
|
|
230
|
-
```json
|
|
231
|
-
{
|
|
232
|
-
"type": "trigger_event",
|
|
233
|
-
"data": {
|
|
234
|
-
"message": "Incoming support request",
|
|
235
|
-
"caller": "John Doe",
|
|
236
|
-
"eventType": "support_call"
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
```
|
|
187
|
+
## Session Persistence
|
|
240
188
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
## What the SDK Handles Automatically
|
|
244
|
-
|
|
245
|
-
You don't need to manage any of these - the SDK handles them internally:
|
|
246
|
-
|
|
247
|
-
| Feature | How It Works |
|
|
248
|
-
|---------|--------------|
|
|
249
|
-
| **WebSocket Connection** | Connects on `init()`, maintains connection |
|
|
250
|
-
| **Auto-Reconnect** | Exponential backoff (1s → 30s max), up to 10 attempts |
|
|
251
|
-
| **Session Refresh** | Refreshes 5 minutes before expiry |
|
|
252
|
-
| **Tab Visibility** | Only refreshes when tab is active |
|
|
253
|
-
| **Session Persistence** | Survives page navigation, widget close/reopen |
|
|
254
|
-
| **Error Recovery** | Automatic retries with backoff |
|
|
255
|
-
| **UI Rendering** | Mounts trigger button and widget to DOM |
|
|
256
|
-
|
|
257
|
-
---
|
|
258
|
-
|
|
259
|
-
## Security Best Practices
|
|
260
|
-
|
|
261
|
-
### Do
|
|
262
|
-
|
|
263
|
-
- Use secure WebSocket connections (`wss://`) in production
|
|
264
|
-
- Validate user IDs on your backend
|
|
265
|
-
- Store Anam API keys only on the backend
|
|
266
|
-
- Implement proper CORS configuration
|
|
267
|
-
- Use environment variables for sensitive data
|
|
268
|
-
|
|
269
|
-
### Don't
|
|
270
|
-
|
|
271
|
-
- Expose Anam API keys in frontend code
|
|
272
|
-
- Trust user-provided data without validation
|
|
273
|
-
- Allow arbitrary persona configuration from frontend
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## Legacy React Provider API
|
|
278
|
-
|
|
279
|
-
For existing applications using the Provider pattern, it's still supported but deprecated:
|
|
189
|
+
For video sessions to persist across page navigation, initialize the SDK at the **root level** of your application:
|
|
280
190
|
|
|
281
191
|
```tsx
|
|
282
|
-
//
|
|
283
|
-
import {
|
|
192
|
+
// App.tsx - Correct placement
|
|
193
|
+
import { Aria } from '@centive/aria-sdk';
|
|
194
|
+
|
|
195
|
+
// Initialize once at app startup
|
|
196
|
+
Aria.init({
|
|
197
|
+
websocketUrl: 'wss://your-server.com/ws',
|
|
198
|
+
userId: 'user_123',
|
|
199
|
+
});
|
|
284
200
|
|
|
285
201
|
function App() {
|
|
286
202
|
return (
|
|
287
|
-
<
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
</
|
|
203
|
+
<Router>
|
|
204
|
+
<Routes>
|
|
205
|
+
<Route path="/" element={<HomePage />} />
|
|
206
|
+
<Route path="/dashboard" element={<DashboardPage />} />
|
|
207
|
+
</Routes>
|
|
208
|
+
</Router>
|
|
293
209
|
);
|
|
294
210
|
}
|
|
295
211
|
```
|
|
296
212
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
---
|
|
300
|
-
|
|
301
|
-
## Browser Support
|
|
302
|
-
|
|
303
|
-
- Chrome/Edge (latest)
|
|
304
|
-
- Firefox (latest)
|
|
305
|
-
- Safari (latest)
|
|
306
|
-
- Opera (latest)
|
|
307
|
-
|
|
308
|
-
Requires WebRTC support for video streaming.
|
|
309
|
-
|
|
310
|
-
---
|
|
213
|
+
## Bundler Configuration
|
|
311
214
|
|
|
312
|
-
|
|
215
|
+
The `@anam-ai/js-sdk` requires a Buffer polyfill. See the [Integration Guide](./INTEGRATION.md#3-configure-your-bundler) for Vite, Webpack, and Next.js configurations.
|
|
313
216
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
This error occurs because `@anam-ai/js-sdk` uses Node.js's `Buffer` which isn't available in browser environments by default.
|
|
317
|
-
|
|
318
|
-
**Fix for Vite users:**
|
|
319
|
-
|
|
320
|
-
1. Install the buffer polyfill:
|
|
217
|
+
**Quick fix for Vite:**
|
|
321
218
|
|
|
322
219
|
```bash
|
|
323
220
|
npm install buffer
|
|
324
221
|
```
|
|
325
222
|
|
|
326
|
-
2. Create or update your `vite.config.ts`:
|
|
327
|
-
|
|
328
|
-
```typescript
|
|
329
|
-
import { defineConfig } from 'vite'
|
|
330
|
-
import react from '@vitejs/plugin-react'
|
|
331
|
-
|
|
332
|
-
export default defineConfig({
|
|
333
|
-
plugins: [react()],
|
|
334
|
-
define: {
|
|
335
|
-
global: 'globalThis',
|
|
336
|
-
},
|
|
337
|
-
resolve: {
|
|
338
|
-
alias: {
|
|
339
|
-
buffer: 'buffer/',
|
|
340
|
-
},
|
|
341
|
-
},
|
|
342
|
-
optimizeDeps: {
|
|
343
|
-
include: ['buffer'],
|
|
344
|
-
esbuildOptions: {
|
|
345
|
-
define: {
|
|
346
|
-
global: 'globalThis',
|
|
347
|
-
},
|
|
348
|
-
},
|
|
349
|
-
},
|
|
350
|
-
})
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
3. Add the Buffer polyfill to your app's entry point (e.g., `main.tsx` or `index.tsx`):
|
|
354
|
-
|
|
355
223
|
```typescript
|
|
356
|
-
//
|
|
224
|
+
// main.tsx (at the very top)
|
|
357
225
|
import { Buffer } from 'buffer';
|
|
358
226
|
globalThis.Buffer = Buffer;
|
|
359
|
-
|
|
360
|
-
// Then your other imports
|
|
361
|
-
import React from 'react';
|
|
362
|
-
import ReactDOM from 'react-dom/client';
|
|
363
|
-
// ...
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
**Fix for Webpack users:**
|
|
367
|
-
|
|
368
|
-
1. Install the buffer polyfill:
|
|
369
|
-
|
|
370
|
-
```bash
|
|
371
|
-
npm install buffer
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
2. Add to your `webpack.config.js`:
|
|
375
|
-
|
|
376
|
-
```javascript
|
|
377
|
-
const webpack = require('webpack');
|
|
378
|
-
|
|
379
|
-
module.exports = {
|
|
380
|
-
// ... other config
|
|
381
|
-
resolve: {
|
|
382
|
-
fallback: {
|
|
383
|
-
buffer: require.resolve('buffer/'),
|
|
384
|
-
},
|
|
385
|
-
},
|
|
386
|
-
plugins: [
|
|
387
|
-
new webpack.ProvidePlugin({
|
|
388
|
-
Buffer: ['buffer', 'Buffer'],
|
|
389
|
-
}),
|
|
390
|
-
],
|
|
391
|
-
};
|
|
392
227
|
```
|
|
393
228
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
1. Install the buffer polyfill:
|
|
397
|
-
|
|
398
|
-
```bash
|
|
399
|
-
npm install buffer
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
2. Update your `next.config.js`:
|
|
403
|
-
|
|
404
|
-
```javascript
|
|
405
|
-
/** @type {import('next').NextConfig} */
|
|
406
|
-
const nextConfig = {
|
|
407
|
-
webpack: (config) => {
|
|
408
|
-
config.resolve.fallback = {
|
|
409
|
-
...config.resolve.fallback,
|
|
410
|
-
buffer: require.resolve('buffer/'),
|
|
411
|
-
};
|
|
412
|
-
return config;
|
|
413
|
-
},
|
|
414
|
-
};
|
|
415
|
-
|
|
416
|
-
module.exports = nextConfig;
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
3. Add to your `_app.tsx` or root layout:
|
|
420
|
-
|
|
421
|
-
```typescript
|
|
422
|
-
import { Buffer } from 'buffer';
|
|
423
|
-
if (typeof window !== 'undefined') {
|
|
424
|
-
globalThis.Buffer = Buffer;
|
|
425
|
-
}
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
---
|
|
429
|
-
|
|
430
|
-
### "WebSocket connection failed"
|
|
431
|
-
|
|
432
|
-
- Check that your backend WebSocket server is running
|
|
433
|
-
- Verify the `websocketUrl` is correct
|
|
434
|
-
- Check browser console for CORS errors
|
|
435
|
-
|
|
436
|
-
### "Session token expired"
|
|
437
|
-
|
|
438
|
-
- The SDK auto-refreshes tokens, but if you see this:
|
|
439
|
-
- Check your backend is returning valid `expires_at` timestamps
|
|
440
|
-
- Ensure your Anam API key is valid
|
|
441
|
-
|
|
442
|
-
### "Not initialized" errors
|
|
443
|
-
|
|
444
|
-
- Call `Aria.init()` before using other methods
|
|
445
|
-
- Check that `init()` completed without errors
|
|
446
|
-
|
|
447
|
-
### UI not appearing
|
|
448
|
-
|
|
449
|
-
- Ensure you're not blocking the SDK's DOM elements with CSS
|
|
450
|
-
- Check browser console for React rendering errors
|
|
451
|
-
|
|
452
|
-
### "Cannot read properties of undefined (reading 'S')" error
|
|
453
|
-
|
|
454
|
-
This error typically occurs when the `@anam-ai/js-sdk` package isn't properly configured in your bundler.
|
|
455
|
-
|
|
456
|
-
**For Vite users**, add the following to your `vite.config.ts`:
|
|
457
|
-
|
|
458
|
-
```typescript
|
|
459
|
-
import { defineConfig } from 'vite'
|
|
460
|
-
import react from '@vitejs/plugin-react'
|
|
461
|
-
|
|
462
|
-
export default defineConfig({
|
|
463
|
-
plugins: [react()],
|
|
464
|
-
optimizeDeps: {
|
|
465
|
-
exclude: ['@anam-ai/js-sdk']
|
|
466
|
-
},
|
|
467
|
-
build: {
|
|
468
|
-
commonjsOptions: {
|
|
469
|
-
exclude: ['@anam-ai/js-sdk']
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
})
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
**For Webpack users**, you may need to add `@anam-ai/js-sdk` to your externals or configure it as a non-bundled dependency.
|
|
229
|
+
## Security Best Practices
|
|
476
230
|
|
|
477
|
-
|
|
231
|
+
- Use secure WebSocket connections (`wss://`) in production
|
|
232
|
+
- Store Anam API keys only on the backend
|
|
233
|
+
- Validate user IDs on your backend
|
|
234
|
+
- Never expose API keys in frontend code
|
|
478
235
|
|
|
479
|
-
##
|
|
236
|
+
## Browser Support
|
|
480
237
|
|
|
481
|
-
|
|
238
|
+
- Chrome/Edge (latest)
|
|
239
|
+
- Firefox (latest)
|
|
240
|
+
- Safari (latest)
|
|
241
|
+
- Opera (latest)
|
|
482
242
|
|
|
483
|
-
|
|
484
|
-
|--------|-------------|
|
|
485
|
-
| `init(config)` | Initialize the SDK |
|
|
486
|
-
| `destroy()` | Cleanup and remove SDK |
|
|
487
|
-
| `open(mode?)` | Open assistant widget |
|
|
488
|
-
| `close()` | Close assistant widget |
|
|
489
|
-
| `minimize()` | Minimize to compact state |
|
|
490
|
-
| `maximize()` | Restore from minimized |
|
|
491
|
-
| `isInitialized()` | Check if SDK is initialized |
|
|
492
|
-
| `isOpen()` | Check if widget is open |
|
|
493
|
-
| `isConnected()` | Check WebSocket connection |
|
|
494
|
-
| `getSessionId()` | Get current session ID |
|
|
495
|
-
| `refreshSession()` | Manually refresh session |
|
|
496
|
-
|
|
497
|
-
---
|
|
243
|
+
Requires WebRTC support for video streaming.
|
|
498
244
|
|
|
499
245
|
## Documentation
|
|
500
246
|
|
|
501
|
-
- [
|
|
247
|
+
- [Integration Guide](./INTEGRATION.md) - Complete integration documentation
|
|
502
248
|
- [WebSocket Events](./WEBSOCKET_EVENTS.md) - Message specifications
|
|
503
|
-
- [
|
|
504
|
-
|
|
505
|
-
---
|
|
249
|
+
- [Type Reference](./TYPE_REFERENCE.md) - TypeScript types
|
|
250
|
+
- [Anam AI Docs](https://docs.anam.ai/) - Platform documentation
|
|
506
251
|
|
|
507
252
|
## License
|
|
508
253
|
|
|
509
254
|
MIT © Centive
|
|
510
255
|
|
|
511
|
-
---
|
|
512
|
-
|
|
513
256
|
## Support
|
|
514
257
|
|
|
515
258
|
- [GitHub Issues](https://github.com/centive/aria-sdk/issues)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaAssistant.d.ts","sourceRoot":"","sources":["../../src/components/AriaAssistant.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOhC,UAAU,kBAAkB;IAC1B,uDAAuD;IACvD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"AriaAssistant.d.ts","sourceRoot":"","sources":["../../src/components/AriaAssistant.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOhC,UAAU,kBAAkB;IAC1B,uDAAuD;IACvD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA8DhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaStandaloneUI.d.ts","sourceRoot":"","sources":["../../src/components/AriaStandaloneUI.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA4C,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgB1E,OAAO,KAAK,EAOV,KAAK,EACN,MAAM,SAAS,CAAC;AAOjB,UAAU,qBAAqB;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,WAAW,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"AriaStandaloneUI.d.ts","sourceRoot":"","sources":["../../src/components/AriaStandaloneUI.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA4C,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgB1E,OAAO,KAAK,EAOV,KAAK,EACN,MAAM,SAAS,CAAC;AAOjB,UAAU,qBAAqB;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,WAAW,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA+gBtD,CAAC;AAk5BF,eAAe,gBAAgB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,52 @@
|
|
|
1
1
|
import './lib-styles.css';
|
|
2
|
+
/**
|
|
3
|
+
* Main entry point for the Aria SDK.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import { Aria } from '@centive/aria-sdk';
|
|
8
|
+
*
|
|
9
|
+
* // Initialize the SDK
|
|
10
|
+
* Aria.init({
|
|
11
|
+
* websocketUrl: 'wss://your-server.com/ws',
|
|
12
|
+
* userId: 'user_123',
|
|
13
|
+
* theme: 'light',
|
|
14
|
+
* onError: (err) => console.error(err),
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Programmatic control
|
|
18
|
+
* Aria.open(); // Open the assistant
|
|
19
|
+
* Aria.close(); // Close the assistant
|
|
20
|
+
* Aria.minimize(); // Minimize to compact state
|
|
21
|
+
* Aria.maximize(); // Restore from minimized
|
|
22
|
+
* Aria.destroy(); // Cleanup when done
|
|
23
|
+
*
|
|
24
|
+
* // Status checks
|
|
25
|
+
* Aria.isInitialized(); // true/false
|
|
26
|
+
* Aria.isOpen(); // true/false
|
|
27
|
+
* Aria.isConnected(); // true/false
|
|
28
|
+
* Aria.getSessionId(); // string | null
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
2
31
|
export { AriaCore as Aria } from './lib/AriaCore';
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export { Badge } from './components/ui/badge';
|
|
22
|
-
export { Dialog, DialogContent, DialogHeader, DialogTitle, DialogClose } from './components/ui/dialog';
|
|
23
|
-
export { cn } from './lib/utils';
|
|
32
|
+
/**
|
|
33
|
+
* Configuration for initializing the Aria SDK.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* import type { AriaInitConfig } from '@centive/aria-sdk';
|
|
38
|
+
*
|
|
39
|
+
* const config: AriaInitConfig = {
|
|
40
|
+
* websocketUrl: 'wss://your-server.com/ws',
|
|
41
|
+
* userId: 'user_123',
|
|
42
|
+
* theme: 'dark',
|
|
43
|
+
* triggerLabel: 'Help',
|
|
44
|
+
* onError: (err) => console.error(err),
|
|
45
|
+
* };
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export type { AriaInitConfig, Theme } from './types';
|
|
49
|
+
export type { SessionData, SessionSuccessResponse, SessionErrorResponse, SessionResponse, SessionErrorType, WebSocketTriggerEvent, UserTriggerMessage, MessageHistoryEvent, MessageStreamEvent, SessionEndEvent, AnamMessage, MessageHistoryAckResponse, MessageStreamAckResponse, SessionEndAckResponse, SessionEndErrorResponse, GenericAckResponse, MissingFieldsErrorResponse, FrontendToBackendMessage, BackendToFrontendMessage, } from './types';
|
|
24
50
|
export { decodeJWT, extractSessionIdFromToken, isJWT, getTokenInfo, isTokenExpired } from './lib/tokenUtils';
|
|
51
|
+
export type { TokenInfo } from './types';
|
|
25
52
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAM1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,QAAQ,IAAI,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAMlD;;;;;;;;;;;;;;;GAeG;AACH,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAMrD,YAAY,EAEV,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAGhB,qBAAqB,EAGrB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,WAAW,EAGX,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,0BAA0B,EAG1B,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAMjB,OAAO,EACL,SAAS,EACT,yBAAyB,EACzB,KAAK,EACL,YAAY,EACZ,cAAc,EACf,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|