@rapidaai/react 1.1.27

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 (60) hide show
  1. package/LICENSE +21 -0
  2. package/dist/chunk-32YFHJN5.mjs +59 -0
  3. package/dist/chunk-32YFHJN5.mjs.map +1 -0
  4. package/dist/chunk-3YJ3G4GZ.mjs +77 -0
  5. package/dist/chunk-3YJ3G4GZ.mjs.map +1 -0
  6. package/dist/chunk-AB3ZXSEN.mjs +27569 -0
  7. package/dist/chunk-AB3ZXSEN.mjs.map +1 -0
  8. package/dist/chunk-GFACTURU.mjs +50 -0
  9. package/dist/chunk-GFACTURU.mjs.map +1 -0
  10. package/dist/chunk-Q4OXFE34.mjs +88 -0
  11. package/dist/chunk-Q4OXFE34.mjs.map +1 -0
  12. package/dist/chunk-WT7OUEDJ.mjs +50 -0
  13. package/dist/chunk-WT7OUEDJ.mjs.map +1 -0
  14. package/dist/components/connection-status.d.mts +7 -0
  15. package/dist/components/connection-status.d.ts +7 -0
  16. package/dist/components/connection-status.js +25321 -0
  17. package/dist/components/connection-status.js.map +1 -0
  18. package/dist/components/connection-status.mjs +34 -0
  19. package/dist/components/connection-status.mjs.map +1 -0
  20. package/dist/components/device-selector.d.mts +5 -0
  21. package/dist/components/device-selector.d.ts +5 -0
  22. package/dist/components/device-selector.js +26800 -0
  23. package/dist/components/device-selector.js.map +1 -0
  24. package/dist/components/device-selector.mjs +99 -0
  25. package/dist/components/device-selector.mjs.map +1 -0
  26. package/dist/components/live-transcript.d.mts +16 -0
  27. package/dist/components/live-transcript.d.ts +16 -0
  28. package/dist/components/live-transcript.js +25376 -0
  29. package/dist/components/live-transcript.js.map +1 -0
  30. package/dist/components/live-transcript.mjs +9 -0
  31. package/dist/components/live-transcript.mjs.map +1 -0
  32. package/dist/components/text/conversations/index.d.mts +2 -0
  33. package/dist/components/text/conversations/index.d.ts +2 -0
  34. package/dist/components/text/conversations/index.js +25344 -0
  35. package/dist/components/text/conversations/index.js.map +1 -0
  36. package/dist/components/text/conversations/index.mjs +9 -0
  37. package/dist/components/text/conversations/index.mjs.map +1 -0
  38. package/dist/components/text/index.d.mts +2 -0
  39. package/dist/components/text/index.d.ts +2 -0
  40. package/dist/components/text/index.js +25344 -0
  41. package/dist/components/text/index.js.map +1 -0
  42. package/dist/components/text/index.mjs +9 -0
  43. package/dist/components/text/index.mjs.map +1 -0
  44. package/dist/components/visualization/agent-multiband-audio-visualizer.d.mts +18 -0
  45. package/dist/components/visualization/agent-multiband-audio-visualizer.d.ts +18 -0
  46. package/dist/components/visualization/agent-multiband-audio-visualizer.js +119 -0
  47. package/dist/components/visualization/agent-multiband-audio-visualizer.js.map +1 -0
  48. package/dist/components/visualization/agent-multiband-audio-visualizer.mjs +8 -0
  49. package/dist/components/visualization/agent-multiband-audio-visualizer.mjs.map +1 -0
  50. package/dist/index-0bkcyQsE.d.mts +79 -0
  51. package/dist/index-0bkcyQsE.d.ts +79 -0
  52. package/dist/index.d.mts +17707 -0
  53. package/dist/index.d.ts +17707 -0
  54. package/dist/index.js +66000 -0
  55. package/dist/index.js.map +1 -0
  56. package/dist/index.mjs +38213 -0
  57. package/dist/index.mjs.map +1 -0
  58. package/dist/styles/index.css +656 -0
  59. package/package.json +117 -0
  60. package/readme.md +127 -0
package/package.json ADDED
@@ -0,0 +1,117 @@
1
+ {
2
+ "name": "@rapidaai/react",
3
+ "version": "1.1.27",
4
+ "description": "An easy to use react client for building generative ai application using Rapida platform.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+ssh://git@github.com/rapidaai/rapida-react.git"
8
+ },
9
+ "keywords": [
10
+ "rapida",
11
+ "generative",
12
+ "ai",
13
+ "voice",
14
+ "audioai",
15
+ "chatbot",
16
+ "voicebot",
17
+ "rapida-sdk",
18
+ "rapiadai",
19
+ "voiceai"
20
+ ],
21
+ "author": "Prashant Srivastav <prashant@rapida.ai>",
22
+ "license": "MIT",
23
+ "bugs": {
24
+ "url": "https://github.com/rapidaai/rapida-react/issues"
25
+ },
26
+ "homepage": "https://github.com/rapidaai/rapida-react#readme",
27
+ "peerDependencies": {
28
+ "react": ">=16.8.0",
29
+ "react-dom": ">=16.8.0"
30
+ },
31
+ "babel": {
32
+ "sourceType": "unambiguous",
33
+ "presets": [
34
+ [
35
+ "@babel/preset-env",
36
+ {
37
+ "targets": {
38
+ "chrome": 100,
39
+ "firefox": 91,
40
+ "safari": 15,
41
+ "edge": 100,
42
+ "opera": 85,
43
+ "ios": 15,
44
+ "android": 100,
45
+ "samsung": 16,
46
+ "ie": 11
47
+ }
48
+ }
49
+ ],
50
+ [
51
+ "@babel/preset-react",
52
+ {
53
+ "runtime": "automatic"
54
+ }
55
+ ],
56
+ "@babel/preset-typescript"
57
+ ]
58
+ },
59
+ "devDependencies": {
60
+ "@babel/cli": "^7.26.4",
61
+ "@babel/core": "^7.26.8",
62
+ "@babel/plugin-transform-private-property-in-object": "^7.21.11",
63
+ "@babel/preset-env": "^7.24.6",
64
+ "@babel/preset-react": "^7.26.3",
65
+ "@babel/preset-typescript": "^7.26.0",
66
+ "@swc/core": "^1.10.16",
67
+ "@types/node": "^22.17.2",
68
+ "@types/react": "^19.0.8",
69
+ "autoprefixer": "^10.4.20",
70
+ "babel-loader": "^9.2.1",
71
+ "postcss": "^8.5.2",
72
+ "postcss-loader": "^8.1.1",
73
+ "postcss-preset-env": "^10.1.4",
74
+ "react": "^19.0.0",
75
+ "react-dom": "19.0.0",
76
+ "tailwindcss": "^3.4.17",
77
+ "tailwindcss-patch": "^5.0.2",
78
+ "ts-loader": "^9.5.2",
79
+ "ts-node": "^10.9.2",
80
+ "tslib": "^2.6.2",
81
+ "tsup": "^8.4.0",
82
+ "typescript": "^5.7.3",
83
+ "unplugin-tailwindcss-mangle": "^4.0.2"
84
+ },
85
+ "main": "dist/index.js",
86
+ "module": "dist/index.esm.js",
87
+ "types": "dist/index.d.ts",
88
+ "files": [
89
+ "dist"
90
+ ],
91
+ "scripts": {
92
+ "dev": "tsx watch src/index.ts",
93
+ "build": "tsup && postcss src/styles/tailwindcss.css -o dist/styles/index.css",
94
+ "clean": "rm -rf dist",
95
+ "preview": "tsx src/index.ts",
96
+ "prepublishOnly": "npm run build"
97
+ },
98
+ "dependencies": {
99
+ "@emotion/is-prop-valid": "^1.3.1",
100
+ "@grpc/grpc-js": "^1.13.4",
101
+ "@improbable-eng/grpc-web": "^0.15.0",
102
+ "@tailwindcss/postcss": "^4.0.6",
103
+ "clsx": "^2.1.1",
104
+ "css-loader": "^7.1.2",
105
+ "esbuild-css-modules-plugin": "^3.1.4",
106
+ "events": "^3.3.0",
107
+ "google-protobuf": "^3.21.4",
108
+ "moment": "^2.30.1",
109
+ "react-hook-form": "^7.54.2",
110
+ "rxjs": "^7.8.1",
111
+ "style-loader": "^4.0.0",
112
+ "styled-components": "^6.1.15",
113
+ "tailwind-merge": "^3.0.1",
114
+ "ts-protoc-gen": "^0.15.1-pre.a71b34e",
115
+ "typed-emitter": "^2.1.0"
116
+ }
117
+ }
package/readme.md ADDED
@@ -0,0 +1,127 @@
1
+ # VoiceAgent Library
2
+
3
+ ## Overview
4
+
5
+ The `VoiceAgent` library provides a set of components, hooks, and utilities for integrating AI-powered voice assistants into applications. It supports real-time messaging, audio device management, and connection handling for seamless interaction.
6
+
7
+ ## Installation
8
+
9
+ To install the package, run:
10
+
11
+ ```sh
12
+ npm install rapida-react@latest
13
+ ```
14
+
15
+ or using Yarn:
16
+
17
+ ```sh
18
+ yarn add rapida-react@latest
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Import the necessary components and hooks from `rapida-react@latest`:
24
+
25
+ ```tsx
26
+ import {
27
+ Channel,
28
+ ConnectionState,
29
+ MediaDeviceFailure,
30
+ ConnectionConfig,
31
+ AgentConfig,
32
+ } from "rapida-react";
33
+
34
+ import {
35
+ BrandIcon,
36
+ UserIcon,
37
+ MessagingAction,
38
+ ConversationMessages,
39
+ VoiceAgent,
40
+ VoiceAgentContext,
41
+ useConnectAgent,
42
+ useDisconnectAgent,
43
+ useInputModeToggleAgent,
44
+ useMicInputToggleAgent,
45
+ useSpeakerOuputToggleAgent,
46
+ useMultiband3DSpeakerTrackVolume,
47
+ useMultibandMicrophoneTrackVolume,
48
+ useSelectInputDeviceAgent,
49
+ } from "rapida-react";
50
+ ```
51
+
52
+ ## Example
53
+
54
+ Here is an example of how to use `VoiceAgentContext.Provider` to set up a voice agent:
55
+
56
+ ```tsx
57
+ <VoiceAgentContext.Provider
58
+ value={
59
+ new VoiceAgent(
60
+ new ConnectionConfig({
61
+ authorization: YOUR_TOKEN,
62
+ }),
63
+ new AgentConfig(ASSISTANT_ID).addArgument("key", "val")
64
+ )
65
+ }
66
+ >
67
+ <ConversationMessages
68
+ userIcon={UserIcon}
69
+ brandIcon={BrandIcon}
70
+ className="h-full overflow-auto !pb-40 no-scrollbar"
71
+ intialConversations={[
72
+ {
73
+ role: "system",
74
+ messages: [
75
+ "I am Yuuki",
76
+ "An AI-powered coach to help you master the toughest challenges at your workplace.",
77
+ ],
78
+ },
79
+ ]}
80
+ />
81
+ <div className="absolute bottom-0 right-0 left-0">
82
+ <MessagingAction
83
+ className="h-[8rem]"
84
+ placeholder="How can I help you overcome a challenge?"
85
+ />
86
+ </div>
87
+ </VoiceAgentContext.Provider>
88
+ ```
89
+
90
+ ## Available Exports
91
+
92
+ The following components, hooks, and utilities are available for import:
93
+
94
+ ### Types & Configurations
95
+
96
+ - `Channel`: Defines communication channels.
97
+ - `ConnectionState`: Represents the state of a voice agent connection.
98
+ - `MediaDeviceFailure`: Handles media device errors.
99
+ - `ConnectionConfig`: Configures the connection settings for a voice agent.
100
+ - `AgentConfig`: Configures the agent settings, including parameters and keywords.
101
+
102
+ ### Components
103
+
104
+ - `BrandIcon`: Displays the brand's representative icon.
105
+ - `UserIcon`: Displays the user's representative icon.
106
+ - `MessagingAction`: A messaging input component for user interactions.
107
+ - `ConversationMessages`: Manages and displays the conversation flow.
108
+
109
+ ### Context
110
+
111
+ - `VoiceAgent`: The core AI voice agent instance.
112
+ - `VoiceAgentContext`: Provides the voice agent's context for managing interactions.
113
+
114
+ ### Hooks
115
+
116
+ - `useConnectAgent`: Establishes a connection to the voice agent.
117
+ - `useDisconnectAgent`: Disconnects the agent from the session.
118
+ - `useInputModeToggleAgent`: Toggles between different input modes.
119
+ - `useMicInputToggleAgent`: Enables or disables microphone input.
120
+ - `useSpeakerOuputToggleAgent`: Enables or disables speaker output.
121
+ - `useMultiband3DSpeakerTrackVolume`: Adjusts multiband volume for speaker tracks.
122
+ - `useMultibandMicrophoneTrackVolume`: Adjusts multiband volume for microphone tracks.
123
+ - `useSelectInputDeviceAgent`: Selects and manages input audio devices.
124
+
125
+ ## License
126
+
127
+ This project is licensed under the MIT License.