@unisphere/genie-types 1.32.0 → 1.33.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/index.esm.js CHANGED
@@ -2376,6 +2376,8 @@ var DeviceType;
2376
2376
  */
2377
2377
  var AvatarConnectionStatus;
2378
2378
  (function (AvatarConnectionStatus) {
2379
+ /** No connection established yet */
2380
+ AvatarConnectionStatus["NotConnected"] = "notConnected";
2379
2381
  /** Establishing connection */
2380
2382
  AvatarConnectionStatus["Connecting"] = "connecting";
2381
2383
  /** Successfully connected */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/genie-types",
3
- "version": "1.32.0",
3
+ "version": "1.33.0",
4
4
  "author": "kaltura",
5
5
  "license": "AGPL-3.0",
6
6
  "repository": {
@@ -2,7 +2,7 @@ import { TinyDataStoreConsumer, ValidatorSchema } from '@unisphere/core';
2
2
  import { UnisphereRuntimeBaseType } from '@unisphere/runtime';
3
3
  import { widgetName } from '../widget-types';
4
4
  import { ChatContext, GenieCapabilities } from '../chat-runtime/shared-settings';
5
- import { CaptionConfig, CaptionState } from './shared-types';
5
+ import { AvatarConnectionStatus, CaptionConfig, CaptionState } from './shared-types';
6
6
  /** Runtime name constant for avatar experiences */
7
7
  export declare const AvatarRuntimeName: "avatar";
8
8
  export interface Captions {
@@ -11,6 +11,10 @@ export interface Captions {
11
11
  setReplacements(replacements: Record<string, string> | null): void;
12
12
  setFilter(filter: ((text: string) => string) | null): void;
13
13
  }
14
+ export type DeprecatedAvatarRuntime = {
15
+ /** @deprecated Observable connection object exists */
16
+ isConnected: TinyDataStoreConsumer<boolean>;
17
+ };
14
18
  /**
15
19
  * Avatar runtime interface for interactive AI avatar experiences.
16
20
  *
@@ -31,15 +35,29 @@ export type AvatarRuntime = UnisphereRuntimeBaseType<AvatarRuntimeSettings> & {
31
35
  }): void;
32
36
  /** Disconnect from the avatar service */
33
37
  disconnect(): void;
38
+ /** Reconnect to the avatar service */
39
+ reconnect(): void;
34
40
  /** Observable connection status */
35
- isConnected: TinyDataStoreConsumer<boolean>;
36
- /** Observable active state — true from connect() call until fully disconnected */
37
- isActive: TinyDataStoreConsumer<boolean>;
41
+ connectionStatus: TinyDataStoreConsumer<AvatarConnectionStatus>;
42
+ /** Pause the avatar interaction (interrupts avatar) */
43
+ pause(): void;
44
+ /** Pause the avatar interaction after it finishes current turn (doesn't interrupt avatar) */
45
+ pauseAfterSpeaking(): void;
46
+ /** Resume the avatar's interaction */
47
+ resume(): void;
48
+ /** Observable paused state of the avatar */
38
49
  isPaused: TinyDataStoreConsumer<boolean>;
50
+ /** Start talking in tap-to-talk mode for the avatar */
51
+ startTapToTalk(): void;
52
+ /** Stop talking tap-to-talk mode for the avatar */
53
+ endTapToTalk(): void;
54
+ /** Captions management API for the avatar runtime */
39
55
  captions: Captions;
56
+ /** Client tools registration API for the avatar runtime */
40
57
  registerClientTools<TMap extends Record<string, unknown>>(tools: {
41
58
  [K in keyof TMap]: (args: TMap[K]) => undefined | null | Record<string, unknown> | Promise<Record<string, unknown>>;
42
59
  }): void;
60
+ /** Unregister client tools by name */
43
61
  unregisterClientTools(...names: string[]): void;
44
62
  /** Observable chat panel open state */
45
63
  isChatPanelOpen: TinyDataStoreConsumer<boolean>;
@@ -2,6 +2,7 @@ import { TinyDataStoreConsumer } from '@unisphere/core';
2
2
  import { DeviceEnumerationResult } from '@kaltura-sdk/rtc-core';
3
3
  import type { ChatEntry } from './chat-types';
4
4
  import { ChatContext } from '../chat-runtime';
5
+ import type { Captions } from './runtime-types';
5
6
  /**
6
7
  * Audio device types for avatar connections.
7
8
  */
@@ -15,6 +16,8 @@ export declare enum DeviceType {
15
16
  * Avatar connection lifecycle states.
16
17
  */
17
18
  export declare enum AvatarConnectionStatus {
19
+ /** No connection established yet */
20
+ NotConnected = "notConnected",
18
21
  /** Establishing connection */
19
22
  Connecting = "connecting",
20
23
  /** Successfully connected */
@@ -101,6 +104,8 @@ export type AvatarContentData<TSettings = any> = ({
101
104
  threadId?: string;
102
105
  /** Associated message ID */
103
106
  messageId?: string;
107
+ /** Associated speech ID */
108
+ speechId?: string;
104
109
  /** Optional new title for the content */
105
110
  newTitle?: string;
106
111
  /** Content type identifier */
@@ -126,6 +131,8 @@ export type AvatarContentData<TSettings = any> = ({
126
131
  threadId?: string;
127
132
  /** Associated message ID */
128
133
  messageId?: string;
134
+ /** Associated speech ID */
135
+ speechId?: string;
129
136
  /** Optional new title for the content */
130
137
  newTitle?: string;
131
138
  /** Content type identifier: a general (non tool-specific) error */
@@ -196,6 +203,8 @@ export declare enum DisconnectReasons {
196
203
  PlayerConnectionFailed = "PlayerConnectionFailed"
197
204
  }
198
205
  /**
206
+ * @deprecated Use `AvatarClientManager` instead. This interface will be removed in future versions.
207
+ *
199
208
  * Avatar connection proxy for managing avatar session state and interactions.
200
209
  *
201
210
  * Provides observable properties for connection state and methods for
@@ -246,6 +255,8 @@ export interface AvatarConnectionProxyType {
246
255
  readonly id: string;
247
256
  /** Send text message to avatar */
248
257
  sendAskViaText(text: string): void;
258
+ /** Request the backend reprocess a turn that produced no avatar response */
259
+ sendAgentTurnRecoveryRequest(speechId: string, messageId: string): void;
249
260
  /** Terminate the avatar connection */
250
261
  destroy(): void;
251
262
  /** Start screen sharing */
@@ -272,3 +283,140 @@ export interface AvatarConnectionProxyType {
272
283
  setCaptionFilter(filter: ((text: string) => string) | null): void;
273
284
  }
274
285
  export declare const isAvatarConnectionProxyInternalType: (x: any) => x is AvatarConnectionProxInternalType;
286
+ /**
287
+ * Public surface of `AvatarClientManager` (from `@local/genie-avatar-client-react`).
288
+ * Import this instead of the concrete class when a consumer only needs to
289
+ * read state or call the public API — e.g. UI components, other packages.
290
+ * Supersedes the deprecated `AvatarConnectionProxyType`/
291
+ * `AvatarConnectionProxInternalType` facade above.
292
+ */
293
+ export interface AvatarClientManagerType {
294
+ /**
295
+ * @deprecated Use this interface's own getters/methods directly
296
+ * (`connectionStatus`, `pause`/`resume`, `tapToTalkStart`/`tapToTalkEnd`,
297
+ * etc). Kept only for existing consumers that still read through
298
+ * `.connection` — remove once they're migrated off it.
299
+ */
300
+ readonly connection: TinyDataStoreConsumer<(AvatarConnectionProxyType & AvatarConnectionProxInternalType) | null>;
301
+ /** Observable connection status */
302
+ readonly connectionStatus: TinyDataStoreConsumer<AvatarConnectionStatus>;
303
+ /** Observable player URL */
304
+ readonly playerUrl: TinyDataStoreConsumer<string | null>;
305
+ /** Observable session identifier */
306
+ readonly sessionId: TinyDataStoreConsumer<string | null>;
307
+ /** Observable cast mode from server */
308
+ readonly castMode: TinyDataStoreConsumer<string | null>;
309
+ /** Observable TURN server URL */
310
+ readonly turnServerURL: TinyDataStoreConsumer<string | null>;
311
+ /** Observable disconnect information */
312
+ readonly disconnectData: TinyDataStoreConsumer<{
313
+ reason: DisconnectReasons;
314
+ error?: Error;
315
+ suppressNotification?: boolean;
316
+ skipDisconnect?: boolean;
317
+ } | null>;
318
+ /** Observable agent state and analytics */
319
+ readonly agentData: TinyDataStoreConsumer<AgentData>;
320
+ /** Establish a connection */
321
+ connect(options?: {
322
+ context?: {
323
+ type: 'thread';
324
+ threadId: string;
325
+ messageId?: string;
326
+ };
327
+ dynamicVariables?: Record<string, unknown>;
328
+ }): void;
329
+ /** Tear down the current connection */
330
+ disconnect(): void;
331
+ /** Reconnect using the last `connect()` options */
332
+ reconnect(): void;
333
+ /** Observable paused state */
334
+ readonly isPaused: TinyDataStoreConsumer<boolean>;
335
+ /** Pause the avatar immediately */
336
+ pause(): void;
337
+ /** Resume the avatar */
338
+ resume(): void;
339
+ /** Pause the avatar once it finishes the current speech */
340
+ pauseAfterSpeaking(): void;
341
+ /** Observable content data */
342
+ readonly content: TinyDataStoreConsumer<AvatarContentData | null>;
343
+ /** Observable chat log entries */
344
+ readonly chatLog: TinyDataStoreConsumer<ChatEntry[]>;
345
+ /** Send text message to avatar */
346
+ askViaText(text: string): void;
347
+ /** Request the backend reprocess a turn that produced no avatar response */
348
+ sendAgentTurnRecoveryRequest(speechId: string, messageId: string): void;
349
+ /** Clear current visual content */
350
+ clearContent(): void;
351
+ /** Set current visual content directly */
352
+ setLocalContent(content: AvatarContentData | null): void;
353
+ /** Observable screen share info state */
354
+ readonly screenShareInfo: TinyDataStoreConsumer<AgentScreenShareInfo | null>;
355
+ /** Start screen sharing */
356
+ startScreenShare(): void;
357
+ /** Stop screen sharing */
358
+ stopScreenShare(): void;
359
+ /** Observable tap-to-talk mode state */
360
+ readonly tapToTalkInfo: TinyDataStoreConsumer<AgentTapToTalkInfo | null>;
361
+ /** Start a tap-to-talk recording */
362
+ tapToTalkStart(): void;
363
+ /** End the current tap-to-talk recording */
364
+ tapToTalkEnd(): void;
365
+ /** Enable/disable tap-to-talk mode */
366
+ toggleTapToTalkMode(enabled: boolean): void;
367
+ /** Caption state + controls */
368
+ readonly captions: Captions;
369
+ /** Toggle caption visibility on/off (no effect when feature is disabled) */
370
+ toggleCaptions(): void;
371
+ /** Update word replacements for the caption filter at runtime */
372
+ setCaptionReplacements(replacements: Record<string, string> | null): void;
373
+ /** Set or clear a custom post-processing filter for captions */
374
+ setCaptionFilter(filter: ((text: string) => string) | null): void;
375
+ /** Observable agent Kaltura context data */
376
+ readonly kalturaContext: TinyDataStoreConsumer<AgentKalturaContextData | null>;
377
+ /** Activate/deactivate Kaltura context */
378
+ toggleKalturaContext(active: boolean): void;
379
+ /** Update dynamic variables sent to the agent */
380
+ updateDynamicVariables(data: Record<string, unknown>): void;
381
+ /** Register client-side tool handlers */
382
+ registerClientTools(config: Record<string, unknown>): void;
383
+ /** Unregister client-side tool handlers by name */
384
+ unregisterClientTools(...names: string[]): void;
385
+ /** Observable persistent thread identifier */
386
+ readonly threadId: TinyDataStoreConsumer<string | null>;
387
+ /** Set the thread identifier used for the next `connect()` */
388
+ setExternalThreadId(id: string | null): void;
389
+ /** Observable preview mode flag */
390
+ readonly isPreviewMode: TinyDataStoreConsumer<boolean>;
391
+ setIsPreviewMode(value: boolean): void;
392
+ /** Observable feature flags from runtime settings */
393
+ readonly features: TinyDataStoreConsumer<{
394
+ screenShare?: boolean;
395
+ chat?: boolean;
396
+ captions?: boolean | CaptionConfig;
397
+ kickOffPhrase?: string;
398
+ dynamicVariables?: Record<string, unknown>;
399
+ } | undefined>;
400
+ /** Observable preview loading video URL */
401
+ readonly agentPreviewUrl: TinyDataStoreConsumer<string | null>;
402
+ /** Observable preview image URL */
403
+ readonly agentPreviewImageUrl: TinyDataStoreConsumer<string | null>;
404
+ /** Observable server URL for the current connection */
405
+ readonly serverUrl: TinyDataStoreConsumer<string | null>;
406
+ /** Observable local audio mute/speaking state */
407
+ readonly audioState: TinyDataStoreConsumer<{
408
+ muted: boolean;
409
+ isSpeaking: boolean;
410
+ }>;
411
+ /** Observable local audio volume level */
412
+ readonly audioVolumeLevel: TinyDataStoreConsumer<number>;
413
+ /** Observable available audio devices */
414
+ readonly devicesList: TinyDataStoreConsumer<UserDevicesList | null>;
415
+ joinSTV(videoContainerId: string, sessionId: string, stvUrl: string, onConnected: () => void): Promise<void>;
416
+ leaveSTV(): void;
417
+ changeDevice(deviceType: DeviceType, deviceId: string): Promise<boolean>;
418
+ toggleMuteAudio(muted: boolean): Promise<void>;
419
+ onPlayerReady(): void;
420
+ onPlayerError(error: Error): void;
421
+ stop(): void;
422
+ }