@rqmii_immersive/agent-react-sdk 5.6.8 → 5.6.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +216 -0
  3. package/package.json +5 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rqmii Immersive
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,216 @@
1
+ # @rqmii_immersive/agent-react-sdk
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@rqmii_immersive/agent-react-sdk.svg)](https://www.npmjs.com/package/@rqmii_immersive/agent-react-sdk)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Standalone React SDK for **Rqmii Agent** realtime multimodal AI sessions. Power your web applications with interactive conversational AI agents featuring text chat, streaming low-latency voice, and 3D cloud-streamed avatars.
7
+
8
+ ---
9
+
10
+ ## Features
11
+
12
+ - 💬 **Ready-to-use Chat Widget**: `<RqmiiAgentChat />` with custom theming, accent colors, multi-language support (40+ languages), feedback ratings, and markdown rendering.
13
+ - 🚀 **Next.js & SEO Optimized**: `<RqmiiAgentChatLazy />` from `@rqmii_immersive/agent-react-sdk/lazy` provides on-demand dynamic importing with zero impact on Core Web Vitals (LCP/INP) and crawler HTML.
14
+ - 🎙️ **Realtime Voice & Audio**: Low-latency PCM stream playback, microphone capture, Push-To-Talk (`useRqmiiPressToTalk`), and Voice Activity Detection (`useRqmiiVAD`).
15
+ - 🤖 **Interactive Cloud Avatars**: Cloud-rendered 3D avatar streaming powered by Unreal Engine Pixel Streaming (`RqmiiCloudAvatarPlayer`) and interactive 3D WebGL Orb.
16
+ - 🧩 **Headless Hooks & Provider**: Build custom AI interfaces with granular hooks (`useRqmiiAgent`, `useRqmiiConnection`, `useRqmiiMessages`, `useRqmiiVoice`, `useRqmiiAvatar`, `useRqmiiEvents`).
17
+ - 🔄 **Built-in Resilience**: Automatic reconnection with exponential backoff, state recovery, and typed event emitter system.
18
+ - 📦 **Full TypeScript Support**: Built entirely in TypeScript with complete type definitions included.
19
+
20
+ ---
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ npm install @rqmii_immersive/agent-react-sdk
26
+ ```
27
+
28
+ ### Peer Dependencies
29
+
30
+ Install the required peer dependencies in your React project:
31
+
32
+ ```bash
33
+ npm install react react-dom lucide-react
34
+ ```
35
+
36
+ > **Note:** If you use the 3D Orb component, install the optional 3D dependencies:
37
+ > ```bash
38
+ > npm install three @react-three/fiber @react-three/drei
39
+ > ```
40
+
41
+ ---
42
+
43
+ ## Quick Start
44
+
45
+ ### 1. Ready-to-Use Chat Widget
46
+
47
+ Import the widget and its stylesheet to add a fully-featured AI chat to your app:
48
+
49
+ ```tsx
50
+ import '@rqmii_immersive/agent-react-sdk/style.css';
51
+ import { RqmiiAgentChat } from '@rqmii_immersive/agent-react-sdk/ui';
52
+
53
+ export default function App() {
54
+ return (
55
+ <RqmiiAgentChat
56
+ publicChatId="YOUR_PUBLIC_CHAT_ID"
57
+ // Optional: custom backend endpoints (defaults to production Rqmii endpoints)
58
+ // wsUrl="wss://your-ws-server"
59
+ // restUrl="https://your-api-server"
60
+ />
61
+ );
62
+ }
63
+ ```
64
+
65
+ ### 2. Next.js / Performance-Friendly Lazy Widget
66
+
67
+ For marketing and landing pages where SEO and Core Web Vitals matter, load the chat widget lazily:
68
+
69
+ ```tsx
70
+ 'use client';
71
+
72
+ import '@rqmii_immersive/agent-react-sdk/style.css';
73
+ import { RqmiiAgentChatLazy } from '@rqmii_immersive/agent-react-sdk/lazy';
74
+
75
+ export default function AgentWidget() {
76
+ return (
77
+ <RqmiiAgentChatLazy
78
+ publicChatId="YOUR_PUBLIC_CHAT_ID"
79
+ loadOn="idle" // Options: 'idle' | 'load' | 'interaction' | 'immediate'
80
+ />
81
+ );
82
+ }
83
+ ```
84
+
85
+ | `loadOn` Strategy | Behavior |
86
+ | ----------------- | -------- |
87
+ | `idle` (default) | Downloads when the browser is idle after page load. |
88
+ | `load` | Downloads immediately after the window `load` event. |
89
+ | `interaction` | Downloads on the first user interaction (pointer, scroll, touch, key). |
90
+ | `immediate` | Downloads on component mount. |
91
+
92
+ ### 3. Auto-Connecting Room (`RqmiiAgentRoom`)
93
+
94
+ If you are building your own UI but want automated session connection and state management:
95
+
96
+ ```tsx
97
+ import { RqmiiAgentRoom, useRqmiiMessages, useRqmiiConnection } from '@rqmii_immersive/agent-react-sdk';
98
+
99
+ function ChatUI() {
100
+ const { connectionState, isConnected } = useRqmiiConnection();
101
+ const { messages, sendTextMessage } = useRqmiiMessages();
102
+
103
+ return (
104
+ <div>
105
+ <p>Status: {connectionState}</p>
106
+ <div className="messages">
107
+ {messages.map((m) => (
108
+ <div key={m.id} className={m.role}>
109
+ <strong>{m.role}: </strong>{m.text}
110
+ </div>
111
+ ))}
112
+ </div>
113
+ <button onClick={() => sendTextMessage('Hello!')}>Send</button>
114
+ </div>
115
+ );
116
+ }
117
+
118
+ export default function App() {
119
+ return (
120
+ <RqmiiAgentRoom
121
+ wsUrl="wss://your-ws-server"
122
+ restUrl="https://your-api-server"
123
+ session={{ mode: 'initialize', apiKey: 'YOUR_API_KEY', language: 'en' }}
124
+ connect
125
+ >
126
+ <ChatUI />
127
+ </RqmiiAgentRoom>
128
+ );
129
+ }
130
+ ```
131
+
132
+ ### 4. Cloud Avatar Streaming
133
+
134
+ Stream high-fidelity Unreal Engine cloud avatars with low latency:
135
+
136
+ ```tsx
137
+ import {
138
+ RqmiiAgentRoom,
139
+ RqmiiCloudAvatarPlayer,
140
+ useRqmiiAvatar,
141
+ } from '@rqmii_immersive/agent-react-sdk';
142
+
143
+ function AvatarView() {
144
+ const { cloudStreamState, isAvatarSpeaking } = useRqmiiAvatar();
145
+
146
+ return (
147
+ <div>
148
+ <div>Stream State: {cloudStreamState}</div>
149
+ <div>Avatar Speaking: {isAvatarSpeaking ? 'Yes' : 'No'}</div>
150
+ <RqmiiCloudAvatarPlayer muted={false} />
151
+ </div>
152
+ );
153
+ }
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Package Entry Points
159
+
160
+ | Entry Point | Content |
161
+ | ----------- | ------- |
162
+ | `@rqmii_immersive/agent-react-sdk` | Core provider (`RqmiiAgentProvider`), `RqmiiAgentRoom`, headless hooks, constants, types, and audio capture. |
163
+ | `@rqmii_immersive/agent-react-sdk/ui` | Pre-built UI components: `<RqmiiAgentChat>`, preview widgets, markdown renderer, language tools, avatar players. |
164
+ | `@rqmii_immersive/agent-react-sdk/lazy` | Code-split lazy chat launcher `<RqmiiAgentChatLazy>` for Next.js & SSR frameworks. |
165
+ | `@rqmii_immersive/agent-react-sdk/style.css` | Default styles for the chat interface and UI components. |
166
+
167
+ ---
168
+
169
+ ## Hooks Reference
170
+
171
+ | Hook | Purpose |
172
+ | ---- | ------- |
173
+ | `useRqmiiAgent()` | Full SDK context value and state. |
174
+ | `useRqmiiConnection()` | Connection status, session state, `initializeSession`, `joinDesktopSession`, and `disconnect`. |
175
+ | `useRqmiiSession()` | Boolean flags for session lifecycle (`isInitializing`, `isSessionReady`, `isTerminating`, `isExpired`). |
176
+ | `useRqmiiMessages()` | Message history (`messages`), `sendTextMessage`, and `clearMessages`. |
177
+ | `useRqmiiVoice()` | Voice controls: `sendAudioChunk`, `endAudioStream`, `interrupt`, and live transcript state. |
178
+ | `useRqmiiAvatar()` | Cloud avatar streaming state and speaking indicators. |
179
+ | `useRqmiiPressToTalk(options)` | Push-To-Talk microphone recorder handlers and recording state. |
180
+ | `useRqmiiVAD(options)` | Voice Activity Detection (VAD) with automatic utterance boundaries. |
181
+ | `useRqmiiEvents(event, handler, deps)` | Typed subscription to SDK lifecycle and realtime events. |
182
+ | `useRqmiiAudioElement(ref)` | Connects output audio playback to an HTMLAudioElement. |
183
+
184
+ ---
185
+
186
+ ## Event System
187
+
188
+ Subscribe to realtime SDK events using `useRqmiiEvents` or the `events` emitter from `useRqmiiAgent`:
189
+
190
+ ```tsx
191
+ import { useRqmiiEvents } from '@rqmii_immersive/agent-react-sdk';
192
+
193
+ function EventLogger() {
194
+ useRqmiiEvents('message:received', (message) => {
195
+ console.log('New message received:', message);
196
+ });
197
+
198
+ useRqmiiEvents('session:ready', (data) => {
199
+ console.log('Session is ready:', data);
200
+ });
201
+
202
+ useRqmiiEvents('credits:exhausted', () => {
203
+ console.warn('Credits exhausted');
204
+ });
205
+
206
+ return null;
207
+ }
208
+ ```
209
+
210
+ Supported events: `session:ready`, `session:joined`, `session:terminated`, `session:expired`, `message:received`, `message:sent`, `audio:playing`, `audio:stopped`, `avatar:speaking`, `avatar:speaking_done`, `connection:connected`, `connection:disconnected`, `connection:reconnecting`, `connection:failed`, `transcript`, `partial_transcript`, `interrupted`, `credits:exhausted`, `error`.
211
+
212
+ ---
213
+
214
+ ## License
215
+
216
+ This project is licensed under the [MIT License](LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rqmii_immersive/agent-react-sdk",
3
- "version": "5.6.8",
3
+ "version": "5.6.9",
4
4
  "description": "Standalone React SDK for Rqmii Agent realtime sessions",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -27,7 +27,9 @@
27
27
  "./style.css": "./dist/agent-react-sdk.css"
28
28
  },
29
29
  "files": [
30
- "dist"
30
+ "dist",
31
+ "README.md",
32
+ "LICENSE"
31
33
  ],
32
34
  "sideEffects": [
33
35
  "*.css",
@@ -94,5 +96,5 @@
94
96
  "publishConfig": {
95
97
  "access": "public"
96
98
  },
97
- "license": "UNLICENSED"
99
+ "license": "MIT"
98
100
  }