@m6d/cortex-react-native 0.2.0 → 0.3.0
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 +24 -3
- package/assets/report.html +33 -33
- package/dist/index.d.ts +6 -1
- package/dist/index.js +156 -22
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ A block that cannot draw says so in its place, with a chart's own rows when it h
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
|
-
npx expo install @m6d/cortex-react-native @google-cloud/recaptcha-enterprise-react-native @maplibre/maplibre-react-native expo-asset expo-clipboard expo-document-picker expo-file-system expo-image-picker expo-location expo-secure-store expo-sharing expo-web-browser react-native-safe-area-context react-native-svg react-native-webview
|
|
18
|
+
npx expo install @m6d/cortex-react-native @google-cloud/recaptcha-enterprise-react-native @maplibre/maplibre-react-native expo-asset expo-clipboard expo-document-picker expo-file-system expo-image-picker expo-location expo-secure-store expo-sharing expo-web-browser react-native-audio-api react-native-safe-area-context react-native-svg react-native-webview
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
`expo install` picks the native modules' versions that match your Expo SDK. Your package manager adds the other peers, Vega and beautiful-mermaid among them. Add MapLibre's config plugin to `app.json` (`"plugins": ["@maplibre/maplibre-react-native"]`).
|
|
@@ -69,10 +69,31 @@ Give hex: `#rrggbb` or `#rgb`, and `#rrggbbaa` or `#rgba` for a color with an al
|
|
|
69
69
|
|
|
70
70
|
A tool can ask the end user to connect an account. The sign-in runs in the system browser's auth session and comes back to your app on `returnScheme`. Use a domain you control, reversed and lowercase, as the sample's `dev.m6d.cortex.sample.reactnative`: Cortex refuses a scheme without a dot. Register it as your app's scheme (`scheme` in `app.json`), and list it under the environment's **Settings** in the Cortex console, among its app return schemes. Without it, the connect card says the app cannot connect accounts and offers only Not now. The widget closes the session when the card goes away or the sign-in runs out.
|
|
71
71
|
|
|
72
|
+
## Voice calls
|
|
73
|
+
|
|
74
|
+
On an agent that takes calls, the send button reads **Talk** while the composer is empty, as on the web. The call runs through react-native-audio-api: the microphone at 24 kHz with the platform's echo cancellation (Apple's voice processing on iOS, the voice communication input on Android), and the agent's replies on the speaker. Add its config plugin to `app.json` with your microphone sentence, and the Android permissions a call needs:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
[
|
|
78
|
+
"react-native-audio-api",
|
|
79
|
+
{
|
|
80
|
+
"iosMicrophonePermission": "Uses the microphone for voice calls with the assistant.",
|
|
81
|
+
"iosBackgroundMode": false,
|
|
82
|
+
"androidForegroundService": false,
|
|
83
|
+
"androidPermissions": [
|
|
84
|
+
"android.permission.RECORD_AUDIO",
|
|
85
|
+
"android.permission.MODIFY_AUDIO_SETTINGS"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The widget asks for the microphone on the first Talk. A user who refused it is told to allow it in Settings; a microphone that cannot start says none was found.
|
|
92
|
+
|
|
72
93
|
## Requirements
|
|
73
94
|
|
|
74
95
|
- Expo SDK 58 or later. `expo/fetch` streams the chat's server-sent events, and Expo installs the full `URL` the widget needs.
|
|
75
|
-
- The native modules installed above, in the app's own dependencies. Expo Go ships all but reCAPTCHA Enterprise's and
|
|
76
|
-
- A development build for maps and reCAPTCHA Enterprise, whose native modules Expo Go lacks; in Expo Go a map says it could not be drawn. Give the app's Podfile static frameworks, as Google's SDK requires: `expo-build-properties` with `{ "ios": { "useFrameworks": "static" } }` in `app.json`, as the sample does. Create an iOS key and an Android key in Google Cloud, and enter each in the agent's end-user authentication, with the app's bundle ID and package name.
|
|
96
|
+
- The native modules installed above, in the app's own dependencies. Expo Go ships all but reCAPTCHA Enterprise's, MapLibre's and react-native-audio-api's.
|
|
97
|
+
- A development build for maps, calls and reCAPTCHA Enterprise, whose native modules Expo Go lacks; in Expo Go a map says it could not be drawn, and a call that voice is unavailable. Give the app's Podfile static frameworks, as Google's SDK requires: `expo-build-properties` with `{ "ios": { "useFrameworks": "static" } }` in `app.json`, as the sample does. Create an iOS key and an Android key in Google Cloud, and enter each in the agent's end-user authentication, with the app's bundle ID and package name.
|
|
77
98
|
|
|
78
99
|
The visitor an anonymous agent signs in is kept in the device's keychain (iOS) or keystore (Android) through `expo-secure-store`, so it stays the same visitor across launches. Files a reader picks upload from the device as they are; a file the chat holds saves through the share sheet. The widget keeps its temporary files in a `cortex` folder of the app's cache and deletes each once done with it.
|