@unisphere/genie-types 1.46.0 → 1.47.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
@@ -1499,6 +1499,112 @@ var AnswerModelEnum;
1499
1499
  AnswerModelEnum["Smart"] = "smart";
1500
1500
  })(AnswerModelEnum || (AnswerModelEnum = {}));
1501
1501
 
1502
+ const avatarRuntimeConnectSettingsSchema = {
1503
+ type: 'object',
1504
+ optional: true,
1505
+ properties: {
1506
+ context: {
1507
+ type: 'object',
1508
+ optional: true,
1509
+ properties: {
1510
+ type: {
1511
+ type: 'literal',
1512
+ value: 'thread'
1513
+ },
1514
+ threadId: {
1515
+ type: 'primitive',
1516
+ value: 'string'
1517
+ },
1518
+ messageId: {
1519
+ type: 'primitive',
1520
+ value: 'string',
1521
+ optional: true
1522
+ }
1523
+ }
1524
+ },
1525
+ dynamicVariables: {
1526
+ type: 'object',
1527
+ optional: true,
1528
+ allowUnknownProperties: true,
1529
+ properties: {}
1530
+ },
1531
+ onThreadIdChange: {
1532
+ type: 'function',
1533
+ optional: true
1534
+ },
1535
+ kickOffPhrase: {
1536
+ type: 'primitive',
1537
+ value: 'string',
1538
+ optional: true
1539
+ }
1540
+ }
1541
+ };
1542
+ /**
1543
+ * Audio device types for avatar connections.
1544
+ */
1545
+ var DeviceType;
1546
+ (function (DeviceType) {
1547
+ /** Microphone input device */
1548
+ DeviceType["AudioInput"] = "audioinput";
1549
+ /** Speaker/headphone output device */
1550
+ DeviceType["AudioOutput"] = "audiooutput";
1551
+ })(DeviceType || (DeviceType = {}));
1552
+ /**
1553
+ * Avatar connection lifecycle states.
1554
+ */
1555
+ var AvatarConnectionStatus;
1556
+ (function (AvatarConnectionStatus) {
1557
+ /** No connection established yet */
1558
+ AvatarConnectionStatus["NotConnected"] = "notConnected";
1559
+ /** Establishing connection */
1560
+ AvatarConnectionStatus["Connecting"] = "connecting";
1561
+ /** Successfully connected */
1562
+ AvatarConnectionStatus["Connected"] = "connected";
1563
+ /** Not connected */
1564
+ AvatarConnectionStatus["Disconnected"] = "disconnected";
1565
+ /** Closing connection */
1566
+ AvatarConnectionStatus["Disconnecting"] = "disconnecting";
1567
+ /** Connection error occurred */
1568
+ AvatarConnectionStatus["Error"] = "error";
1569
+ })(AvatarConnectionStatus || (AvatarConnectionStatus = {}));
1570
+ var DisconnectReasons;
1571
+ (function (DisconnectReasons) {
1572
+ DisconnectReasons["UserRequested"] = "UserRequested";
1573
+ DisconnectReasons["WebsocketConnectionFailed"] = "WebsocketConnectionFailed";
1574
+ DisconnectReasons["WebsocketDisconnected"] = "WebsocketDisconnected";
1575
+ DisconnectReasons["PeerRemoved"] = "PeerRemoved";
1576
+ DisconnectReasons["NoAgentsAvailable"] = "NoAgentsAvailable";
1577
+ DisconnectReasons["ExceededTierLimits"] = "ExceededTierLimits";
1578
+ DisconnectReasons["BadRequest"] = "BadRequest";
1579
+ DisconnectReasons["UnsupportedClient"] = "UnsupportedClient";
1580
+ DisconnectReasons["ConnectionError"] = "ConnectionError";
1581
+ DisconnectReasons["UserMediaInitializationFailed"] = "UserMediaInitializationFailed";
1582
+ DisconnectReasons["ASRConnectionFailed"] = "ASRConnectionFailed";
1583
+ DisconnectReasons["DestroyFailed"] = "DestroyFailed";
1584
+ DisconnectReasons["ConversationEnded"] = "ConversationEnded";
1585
+ DisconnectReasons["AgentResponseTimeout"] = "AgentResponseTimeout";
1586
+ DisconnectReasons["UnknownReason"] = "UnknownReason";
1587
+ DisconnectReasons["DevicesPermissionDenied"] = "DevicesPermissionDenied";
1588
+ DisconnectReasons["JoinRoomTimeout"] = "JoinRoomTimeout";
1589
+ DisconnectReasons["ConnectionTimeout"] = "ConnectionTimeout";
1590
+ DisconnectReasons["PlayerConnectionFailed"] = "PlayerConnectionFailed";
1591
+ })(DisconnectReasons || (DisconnectReasons = {}));
1592
+ const isAvatarConnectionProxyInternalType = x => {
1593
+ var _a;
1594
+ return '__webSocket' in x && typeof ((_a = x.__webSocket) === null || _a === void 0 ? void 0 : _a.onChanges) === 'function';
1595
+ };
1596
+ const multipleAvatarBehaviorSchema = {
1597
+ type: 'object',
1598
+ optional: true,
1599
+ allowUnknownProperties: true,
1600
+ properties: {
1601
+ preventDisconnections: {
1602
+ type: 'primitive',
1603
+ value: 'boolean'
1604
+ }
1605
+ }
1606
+ };
1607
+
1502
1608
  const chatCustomizationSchemaProperties = {
1503
1609
  // @deprecated - no longer supported
1504
1610
  context: {
@@ -1577,6 +1683,7 @@ const chatCustomizationSchemaProperties = {
1577
1683
  }
1578
1684
  }
1579
1685
  },
1686
+ multipleAvatarBehavior: multipleAvatarBehaviorSchema,
1580
1687
  theme: {
1581
1688
  type: 'object',
1582
1689
  optional: true,
@@ -2444,7 +2551,8 @@ const avatarRuntimeSettingsSchema = {
2444
2551
  optional: true
2445
2552
  },
2446
2553
  kaltura: kalturaSchema,
2447
- features: featuresSchema
2554
+ features: featuresSchema,
2555
+ multipleAvatarBehavior: multipleAvatarBehaviorSchema
2448
2556
  }
2449
2557
  },
2450
2558
  // serverConfig: 'studio'
@@ -2471,7 +2579,8 @@ const avatarRuntimeSettingsSchema = {
2471
2579
  optional: true
2472
2580
  },
2473
2581
  kaltura: kalturaSchema,
2474
- features: featuresSchema
2582
+ features: featuresSchema,
2583
+ multipleAvatarBehavior: multipleAvatarBehaviorSchema
2475
2584
  }
2476
2585
  }]
2477
2586
  };
@@ -2487,101 +2596,6 @@ const avatarRuntimeChatVisualSettingsSchema = {
2487
2596
  }
2488
2597
  };
2489
2598
 
2490
- const avatarRuntimeConnectSettingsSchema = {
2491
- type: 'object',
2492
- optional: true,
2493
- properties: {
2494
- context: {
2495
- type: 'object',
2496
- optional: true,
2497
- properties: {
2498
- type: {
2499
- type: 'literal',
2500
- value: 'thread'
2501
- },
2502
- threadId: {
2503
- type: 'primitive',
2504
- value: 'string'
2505
- },
2506
- messageId: {
2507
- type: 'primitive',
2508
- value: 'string',
2509
- optional: true
2510
- }
2511
- }
2512
- },
2513
- dynamicVariables: {
2514
- type: 'object',
2515
- optional: true,
2516
- allowUnknownProperties: true,
2517
- properties: {}
2518
- },
2519
- onThreadIdChange: {
2520
- type: 'function',
2521
- optional: true
2522
- },
2523
- kickOffPhrase: {
2524
- type: 'primitive',
2525
- value: 'string',
2526
- optional: true
2527
- }
2528
- }
2529
- };
2530
- /**
2531
- * Audio device types for avatar connections.
2532
- */
2533
- var DeviceType;
2534
- (function (DeviceType) {
2535
- /** Microphone input device */
2536
- DeviceType["AudioInput"] = "audioinput";
2537
- /** Speaker/headphone output device */
2538
- DeviceType["AudioOutput"] = "audiooutput";
2539
- })(DeviceType || (DeviceType = {}));
2540
- /**
2541
- * Avatar connection lifecycle states.
2542
- */
2543
- var AvatarConnectionStatus;
2544
- (function (AvatarConnectionStatus) {
2545
- /** No connection established yet */
2546
- AvatarConnectionStatus["NotConnected"] = "notConnected";
2547
- /** Establishing connection */
2548
- AvatarConnectionStatus["Connecting"] = "connecting";
2549
- /** Successfully connected */
2550
- AvatarConnectionStatus["Connected"] = "connected";
2551
- /** Not connected */
2552
- AvatarConnectionStatus["Disconnected"] = "disconnected";
2553
- /** Closing connection */
2554
- AvatarConnectionStatus["Disconnecting"] = "disconnecting";
2555
- /** Connection error occurred */
2556
- AvatarConnectionStatus["Error"] = "error";
2557
- })(AvatarConnectionStatus || (AvatarConnectionStatus = {}));
2558
- var DisconnectReasons;
2559
- (function (DisconnectReasons) {
2560
- DisconnectReasons["UserRequested"] = "UserRequested";
2561
- DisconnectReasons["WebsocketConnectionFailed"] = "WebsocketConnectionFailed";
2562
- DisconnectReasons["WebsocketDisconnected"] = "WebsocketDisconnected";
2563
- DisconnectReasons["PeerRemoved"] = "PeerRemoved";
2564
- DisconnectReasons["NoAgentsAvailable"] = "NoAgentsAvailable";
2565
- DisconnectReasons["ExceededTierLimits"] = "ExceededTierLimits";
2566
- DisconnectReasons["BadRequest"] = "BadRequest";
2567
- DisconnectReasons["UnsupportedClient"] = "UnsupportedClient";
2568
- DisconnectReasons["ConnectionError"] = "ConnectionError";
2569
- DisconnectReasons["UserMediaInitializationFailed"] = "UserMediaInitializationFailed";
2570
- DisconnectReasons["ASRConnectionFailed"] = "ASRConnectionFailed";
2571
- DisconnectReasons["DestroyFailed"] = "DestroyFailed";
2572
- DisconnectReasons["ConversationEnded"] = "ConversationEnded";
2573
- DisconnectReasons["AgentResponseTimeout"] = "AgentResponseTimeout";
2574
- DisconnectReasons["UnknownReason"] = "UnknownReason";
2575
- DisconnectReasons["DevicesPermissionDenied"] = "DevicesPermissionDenied";
2576
- DisconnectReasons["JoinRoomTimeout"] = "JoinRoomTimeout";
2577
- DisconnectReasons["ConnectionTimeout"] = "ConnectionTimeout";
2578
- DisconnectReasons["PlayerConnectionFailed"] = "PlayerConnectionFailed";
2579
- })(DisconnectReasons || (DisconnectReasons = {}));
2580
- const isAvatarConnectionProxyInternalType = x => {
2581
- var _a;
2582
- return '__webSocket' in x && typeof ((_a = x.__webSocket) === null || _a === void 0 ? void 0 : _a.onChanges) === 'function';
2583
- };
2584
-
2585
2599
  const avatarRuntimeContainedVisualSettingsSchema = {
2586
2600
  type: 'object',
2587
2601
  properties: {
@@ -4045,4 +4059,4 @@ function isTextBlock(b) {
4045
4059
  }
4046
4060
  const hasSources = blocks => blocks.some(b => b.type === 'unisphere-tool' && b.runtimeName === 'sources-tool');
4047
4061
 
4048
- export { AVATAR_DEFAULT_CAPABILITIES, AnswerModelEnum, AnswerTypeEnum, AvatarConnectionStatus, AvatarRuntimeName, CHAT_CONTEXT_TYPE, CHAT_CONTEXT_TYPE_GLOBAL, CHAT_DEFAULT_CAPABILITIES, ChatRuntimeName, ChatThreadRuntimeName, DeviceType, DisconnectReasons, SUPPORTED_LAYOUT_TYPES, agentModeSchema, avatarContainerModeSchema, avatarRuntimeChatVisualSettingsSchema, avatarRuntimeConnectSettingsSchema, avatarRuntimeContainedVisualSettingsSchema, avatarRuntimeFloaterVisualSettingsSchema, avatarRuntimeHeadFloaterVisualSettingsSchema, avatarRuntimeHeadlessVisualSettingsSchema, avatarRuntimeSettingsSchema, bannerVisualSettingsSchema, blockVisualContextSchema, chatContextSchema, chatCustomizationSchema, chatCustomizationSchemaProperties, chatRuntimePlayerPluginSettingsSchema, chatRuntimeSettingsSchema, chatThreadRuntimeContainedVisualSettingsSchema, chatThreadRuntimeSettingsSchema, containedVisualSettingsSchema, dynamicVariablesSchema, floaterCTAVisualSettingsSchema, floaterVisualSettingsSchema, getAvatarDefaultCapabilities, getChatDefaultCapabilities, getResolvedRuntimeName, getResolvedWidgetName, getSourceUrlSchema, hasSources, integrationsSchema, isAvatarConnectionProxyInternalType, isFlashcardBlock, isFlashcardElement, isFollowupsBlock, isFollowupsElement, isPDFSourceItem, isSourcesBlock, isSourcesElement, isTextBlock, isTextFlashcard, isVideoGalleryFlashcard, isVideoSourceItem, pageVisualSettingsSchema, popupVisualSettingsSchema, resolveActiveContextType, schemaVersionSchema, shareUrlSchema, widgetName };
4062
+ export { AVATAR_DEFAULT_CAPABILITIES, AnswerModelEnum, AnswerTypeEnum, AvatarConnectionStatus, AvatarRuntimeName, CHAT_CONTEXT_TYPE, CHAT_CONTEXT_TYPE_GLOBAL, CHAT_DEFAULT_CAPABILITIES, ChatRuntimeName, ChatThreadRuntimeName, DeviceType, DisconnectReasons, SUPPORTED_LAYOUT_TYPES, agentModeSchema, avatarContainerModeSchema, avatarRuntimeChatVisualSettingsSchema, avatarRuntimeConnectSettingsSchema, avatarRuntimeContainedVisualSettingsSchema, avatarRuntimeFloaterVisualSettingsSchema, avatarRuntimeHeadFloaterVisualSettingsSchema, avatarRuntimeHeadlessVisualSettingsSchema, avatarRuntimeSettingsSchema, bannerVisualSettingsSchema, blockVisualContextSchema, chatContextSchema, chatCustomizationSchema, chatCustomizationSchemaProperties, chatRuntimePlayerPluginSettingsSchema, chatRuntimeSettingsSchema, chatThreadRuntimeContainedVisualSettingsSchema, chatThreadRuntimeSettingsSchema, containedVisualSettingsSchema, dynamicVariablesSchema, floaterCTAVisualSettingsSchema, floaterVisualSettingsSchema, getAvatarDefaultCapabilities, getChatDefaultCapabilities, getResolvedRuntimeName, getResolvedWidgetName, getSourceUrlSchema, hasSources, integrationsSchema, isAvatarConnectionProxyInternalType, isFlashcardBlock, isFlashcardElement, isFollowupsBlock, isFollowupsElement, isPDFSourceItem, isSourcesBlock, isSourcesElement, isTextBlock, isTextFlashcard, isVideoGalleryFlashcard, isVideoSourceItem, multipleAvatarBehaviorSchema, pageVisualSettingsSchema, popupVisualSettingsSchema, resolveActiveContextType, schemaVersionSchema, shareUrlSchema, widgetName };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/genie-types",
3
- "version": "1.46.0",
3
+ "version": "1.47.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 { AgentData, AgentScreenShareInfo, AgentTapToTalkInfo, AvatarConnectionStatus, CaptionConfig, CaptionState, DisconnectReasons } from './shared-types';
5
+ import { AgentData, AgentScreenShareInfo, AgentTapToTalkInfo, AvatarConnectionStatus, CaptionConfig, CaptionState, DisconnectReasons, MultipleAvatarBehavior } from './shared-types';
6
6
  import { ChatEntry } from './chat-types';
7
7
  /** Runtime name constant for avatar experiences */
8
8
  export declare const AvatarRuntimeName: "avatar";
@@ -81,6 +81,8 @@ export type AvatarRuntime = UnisphereRuntimeBaseType<AvatarRuntimeSettings> & {
81
81
  setIsPreviewMode(value: boolean): void;
82
82
  /** Sync context selector visibility from the chat customization settings */
83
83
  setContextSelectorVisible(value: boolean): void;
84
+ /** Sync multiple-avatar behavior from the chat customization settings */
85
+ setMultipleAvatarBehavior(value: MultipleAvatarBehavior | undefined): void;
84
86
  /** Observable mute state
85
87
  * @deprecated Use `audioState` instead, which provides both mute and speaking state
86
88
  */
@@ -193,6 +195,8 @@ export type AvatarRuntimeSettings = {
193
195
  };
194
196
  /** Full URL to POST client-tool-call responses to (e.g. `https://genie.example.com/assistant/tool_response`). Required for client tool calls to receive a response. Applies to both `manual` and `studio` modes. */
195
197
  clientToolResponseUrl?: string;
198
+ /** What happens when several avatars share the page and one is already in a call. Defaults to `{ preventDisconnections: false }`. */
199
+ multipleAvatarBehavior?: MultipleAvatarBehavior;
196
200
  } & (({
197
201
  serverConfig?: 'manual';
198
202
  } & Omit<AvatarServerConfig, 'ks'>) | {
@@ -327,6 +327,20 @@ export interface AvatarConnectionProxyType {
327
327
  setCaptionFilter(filter: ((text: string) => string) | null): void;
328
328
  }
329
329
  export declare const isAvatarConnectionProxyInternalType: (x: any) => x is AvatarConnectionProxInternalType;
330
+ export interface MultipleAvatarBehavior {
331
+ /**
332
+ * true: while one avatar is in a call, other avatars on the page cannot start one.
333
+ * false (default): starting a call asks the user to confirm, then ends the other avatar's call.
334
+ * The flag of the avatar that owns the active call decides.
335
+ */
336
+ preventDisconnections: boolean;
337
+ }
338
+ export declare const multipleAvatarBehaviorSchema: ValidatorSchema;
339
+ /** Page-wide record of the avatar that currently owns a call (shared across workspaces and iframes) */
340
+ export interface ActiveAvatarSession {
341
+ id: string;
342
+ preventDisconnections: boolean;
343
+ }
330
344
  /**
331
345
  * Public surface of `AvatarClientManager` (from `@kaltura-sdk/avatar-client`).
332
346
  * Import this instead of the concrete class when a consumer only needs to
@@ -442,6 +456,17 @@ export interface AvatarClientManagerType {
442
456
  /** Observable preview mode flag */
443
457
  readonly isPreviewMode: TinyDataStoreConsumer<boolean>;
444
458
  setIsPreviewMode(value: boolean): void;
459
+ /** Observable behavior when several avatars share a page */
460
+ readonly multipleAvatarBehavior: TinyDataStoreConsumer<MultipleAvatarBehavior>;
461
+ setMultipleAvatarBehavior(value: MultipleAvatarBehavior | undefined): void;
462
+ /** Another avatar (any workspace/iframe on the page) currently owns the call; null when none */
463
+ readonly activeSessionConflict: TinyDataStoreConsumer<ActiveAvatarSession | null>;
464
+ /** True while a `connect()` is held because another avatar is in a call: the user either confirms ending that call or, when it is protected (`preventDisconnections`), can only dismiss */
465
+ readonly isTakeoverPending: TinyDataStoreConsumer<boolean>;
466
+ /** End the other avatar's call and run the pending `connect()`; no-op when that call is protected */
467
+ confirmTakeover(): void;
468
+ /** Drop the pending `connect()` and keep the other avatar's call */
469
+ cancelTakeover(): void;
445
470
  /** Observable context selector visibility */
446
471
  readonly contextSelectorVisible: TinyDataStoreConsumer<boolean>;
447
472
  setContextSelectorVisible(value: boolean): void;
@@ -1,6 +1,7 @@
1
1
  import { ValidatorSchema } from '@unisphere/core';
2
2
  import { ChatBranding } from './chat-runtime';
3
3
  import { AnswerTypeEnum } from './types';
4
+ import { MultipleAvatarBehavior } from './avatar-runtime/shared-types';
4
5
  /**
5
6
  * Chat UI customization options.
6
7
  *
@@ -49,6 +50,8 @@ export interface ChatCustomization {
49
50
  /** Target attribute for links rendered in markdown content (defaults to '_blank') */
50
51
  linkTarget?: string;
51
52
  };
53
+ /** What happens when several avatars share the page and one is already in a call */
54
+ multipleAvatarBehavior?: MultipleAvatarBehavior;
52
55
  /** New conversation thread settings
53
56
  * @deprecated
54
57
  * */