obi-sdk 0.19.50-beta.2 → 0.19.50-beta.4

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.
@@ -0,0 +1,22 @@
1
+ import type { TextStreamData } from "@obi/obi-client";
2
+ export type UseAgentCaptionsFromStreamsOptions = {
3
+ /** Delay in ms before displaying captions (used to sync with avatar video audio delay) */
4
+ delayMs?: number;
5
+ };
6
+ /**
7
+ * Hook that returns the current transcription caption for the remote agent from text streams.
8
+ *
9
+ * Accumulates text until it reaches MAX_CAPTION_LENGTH, then lingers briefly
10
+ * on the current text before clearing to start fresh. This creates a readable
11
+ * caption experience without needing timing data from the server.
12
+ *
13
+ * This hook matches the behavior of obi-meet's useAgentCaptions exactly but
14
+ * consumes TextStreamData[] directly instead of using LiveKit React hooks.
15
+ *
16
+ * @param streams - Array of text stream data from ObiSession's captions event
17
+ * @param options.delayMs - Optional delay before displaying captions to sync with audio
18
+ */
19
+ export declare function useAgentCaptionsFromStreams(streams: TextStreamData[], options?: UseAgentCaptionsFromStreamsOptions): {
20
+ caption: string;
21
+ hasCaption: boolean;
22
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obi-sdk",
3
- "version": "0.19.50-beta.2",
3
+ "version": "0.19.50-beta.4",
4
4
  "description": "JavaScript SDK for Obi",
5
5
  "type": "module",
6
6
  "main": "dist/obi-sdk.umd.js",