@opencx/widget-react-headless 5.7.0 → 5.7.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 CHANGED
@@ -86,9 +86,19 @@ import { fetch as expoFetch } from 'expo/fetch';
86
86
  ```
87
87
 
88
88
  1. `streamingFetch`: React Native's built-in fetch cannot read a response
89
- while it arrives. Every other request keeps using the global fetch.
90
- 2. Globals the stream reader uses: `structuredClone` and `TextDecoderStream`.
91
- Install polyfills for them at startup, before the widget is imported.
89
+ while it arrives. Expo SDK 57 installs `expo/fetch` as the global fetch
90
+ (unless `EXPO_PUBLIC_USE_RN_FETCH` is set), so there `streamingFetch` can
91
+ be left out. Every other request keeps using the global fetch. If you wrap
92
+ `expoFetch` (to add headers or logging), return its response unchanged.
93
+ React Native's global `Response` has no readable body, so the widget
94
+ cannot read a response rebuilt with `new Response(...)`. It then reads the
95
+ reply again through the global fetch and logs a warning once; where the
96
+ global fetch cannot stream either, the reply appears once it is saved.
97
+ 2. Globals: the widget needs `crypto.getRandomValues`, which React Native does
98
+ not provide. Install `react-native-get-random-values` and import it first
99
+ in your entry file. The stream reader also uses `structuredClone` and
100
+ `TextDecoderStream`; Expo SDK 57 has both, and older runtimes need
101
+ polyfills installed at startup, before the widget is imported.
92
102
  3. Resuming a dropped reply: browsers resume when the tab is visible again or
93
103
  the network returns. React Native has neither event, so call
94
104
  `useAgentChatUi().resumeInterruptedTurn()` when `AppState` becomes