@unisphere/genie-types 1.27.0-head.0 → 1.27.0-head.2

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
@@ -1,5 +1,3 @@
1
- import { createUseTranslation } from '@unisphere/ui-i18n-react';
2
-
3
1
  /** Widget name constant for all Genie experiences */
4
2
  const widgetName = 'unisphere.widget.genie';
5
3
 
@@ -1125,6 +1123,14 @@ const CHAT_CONTEXT_TYPE = {
1125
1123
  category: 'category',
1126
1124
  'ancestor-category': 'ancestor_category'
1127
1125
  };
1126
+ const resolveActiveContextType = context => {
1127
+ return context ? {
1128
+ contextId: context.id,
1129
+ contextType: CHAT_CONTEXT_TYPE[context.type]
1130
+ } : {
1131
+ contextType: CHAT_CONTEXT_TYPE_GLOBAL
1132
+ };
1133
+ };
1128
1134
  const CHAT_CONTEXT_TYPE_GLOBAL = 'global';
1129
1135
  const chatContextSchema = {
1130
1136
  type: 'orByType',
@@ -2143,6 +2149,12 @@ const featuresSchema = {
2143
2149
  type: 'primitive',
2144
2150
  value: 'string',
2145
2151
  optional: true
2152
+ },
2153
+ dynamicVariables: {
2154
+ type: 'object',
2155
+ properties: {},
2156
+ allowUnknownProperties: true,
2157
+ optional: true
2146
2158
  }
2147
2159
  }
2148
2160
  };
@@ -2331,7 +2343,7 @@ var DisconnectReasons;
2331
2343
  })(DisconnectReasons || (DisconnectReasons = {}));
2332
2344
  const isAvatarConnectionProxyInternalType = x => {
2333
2345
  var _a;
2334
- return '_directEventToServer' in x && 'webSocket' in x && typeof ((_a = x.webSocket) === null || _a === void 0 ? void 0 : _a.onChanges) === 'function';
2346
+ return '__webSocket' in x && typeof ((_a = x.__webSocket) === null || _a === void 0 ? void 0 : _a.onChanges) === 'function';
2335
2347
  };
2336
2348
 
2337
2349
  var iterators = {};
@@ -3295,16 +3307,4 @@ const blockVisualContextSchema = {
3295
3307
  }
3296
3308
  };
3297
3309
 
3298
- var en = {
3299
-
3300
- };
3301
-
3302
- const supportedLanguages = ['en-US', 'he-IL'];
3303
-
3304
- const useTranslation = createUseTranslation({
3305
- packageName: '@unisphere/genie-types',
3306
- defaultTranslations: en,
3307
- supportedLanguages
3308
- });
3309
-
3310
- export { AVATAR_DEFAULT_CAPABILITIES, AnswerModelEnum, AnswerTypeEnum, AvatarConnectionStatus, AvatarRuntimeName, CHAT_CONTEXT_TYPE, CHAT_CONTEXT_TYPE_GLOBAL, CHAT_DEFAULT_CAPABILITIES, ChatRuntimeName, DeviceType, DisconnectReasons, SUPPORTED_LAYOUT_TYPES, agentModeSchema, avatarContainerModeSchema, avatarRuntimeChatVisualSettingsSchema, avatarRuntimeContainedVisualSettingsSchema, avatarRuntimeFloaterVisualSettingsSchema, avatarRuntimeHeadFloaterVisualSettingsSchema, avatarRuntimeSettingsSchema, bannerVisualSettingsSchema, blockVisualContextSchema, chatContextSchema, chatCustomizationSchema, chatRuntimePlayerPluginSettingsSchema, chatRuntimeSettingsSchema, containedVisualSettingsSchema, floaterCTAVisualSettingsSchema, floaterVisualSettingsSchema, getAvatarDefaultCapabilities, getChatDefaultCapabilities, getResolvedRuntimeName, getResolvedWidgetName, getSourceUrlSchema, integrationsSchema, isAvatarConnectionProxyInternalType, pageVisualSettingsSchema, popupVisualSettingsSchema, schemaVersionSchema, shareUrlSchema, useTranslation, widgetName };
3310
+ export { AVATAR_DEFAULT_CAPABILITIES, AnswerModelEnum, AnswerTypeEnum, AvatarConnectionStatus, AvatarRuntimeName, CHAT_CONTEXT_TYPE, CHAT_CONTEXT_TYPE_GLOBAL, CHAT_DEFAULT_CAPABILITIES, ChatRuntimeName, DeviceType, DisconnectReasons, SUPPORTED_LAYOUT_TYPES, agentModeSchema, avatarContainerModeSchema, avatarRuntimeChatVisualSettingsSchema, avatarRuntimeContainedVisualSettingsSchema, avatarRuntimeFloaterVisualSettingsSchema, avatarRuntimeHeadFloaterVisualSettingsSchema, avatarRuntimeSettingsSchema, bannerVisualSettingsSchema, blockVisualContextSchema, chatContextSchema, chatCustomizationSchema, chatRuntimePlayerPluginSettingsSchema, chatRuntimeSettingsSchema, containedVisualSettingsSchema, floaterCTAVisualSettingsSchema, floaterVisualSettingsSchema, getAvatarDefaultCapabilities, getChatDefaultCapabilities, getResolvedRuntimeName, getResolvedWidgetName, getSourceUrlSchema, integrationsSchema, isAvatarConnectionProxyInternalType, 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.27.0-head.0",
3
+ "version": "1.27.0-head.2",
4
4
  "author": "kaltura",
5
5
  "license": "AGPL-3.0",
6
6
  "repository": {
@@ -12,8 +12,7 @@
12
12
  "@kaltura-sdk/rtc-core": "^1.25.13",
13
13
  "@unisphere/core": "^1.99.0",
14
14
  "@unisphere/runtime": "^1.98.0",
15
- "@unisphere/runtime-js": "^1.96.0",
16
- "@unisphere/ui-i18n-react": "^1.70.1"
15
+ "@unisphere/runtime-js": "^1.96.0"
17
16
  },
18
17
  "module": "./index.esm.js",
19
18
  "type": "module",
package/src/index.d.ts CHANGED
@@ -5,4 +5,3 @@ export * from './lib/types';
5
5
  export * from './lib/avatar-runtime';
6
6
  export * from './lib/chat-customizations-types';
7
7
  export * from './lib/general-visual-types';
8
- export { useTranslation } from './lib/use-translation';
@@ -11,8 +11,12 @@ export interface AvatarServiceType extends UnisphereService {
11
11
  readonly visualBridge: AvatarVisualBridgeType;
12
12
  readonly connection: TinyDataStoreConsumer<AvatarConnectionProxyType | null>;
13
13
  connect(options?: {
14
- threadId?: string;
15
- messageId?: string;
14
+ context?: {
15
+ type: 'thread';
16
+ threadId: string;
17
+ messageId?: string;
18
+ };
19
+ dynamicVariables?: Record<string, unknown>;
16
20
  }): void;
17
21
  getKalturaPlayerParams(): {
18
22
  kalturaServerURI: string;
@@ -1,10 +1,16 @@
1
- import { TinyDataStoreConsumer, TinyPubSub, ValidatorSchema } from '@unisphere/core';
1
+ 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 } from './shared-types';
5
+ import { CaptionConfig, CaptionState } from './shared-types';
6
6
  /** Runtime name constant for avatar experiences */
7
7
  export declare const AvatarRuntimeName: "avatar";
8
+ export interface Captions {
9
+ state: TinyDataStoreConsumer<CaptionState | null>;
10
+ toggle(): void;
11
+ setReplacements(replacements: Record<string, string> | null): void;
12
+ setFilter(filter: ((text: string) => string) | null): void;
13
+ }
8
14
  /**
9
15
  * Avatar runtime interface for interactive AI avatar experiences.
10
16
  *
@@ -16,13 +22,20 @@ export type AvatarRuntime = UnisphereRuntimeBaseType<AvatarRuntimeSettings> & {
16
22
  readonly runtimeName: typeof AvatarRuntimeName;
17
23
  /** Establish connection to the avatar service */
18
24
  connect(params?: {
19
- threadId?: string;
20
- messageId?: string;
25
+ context?: {
26
+ type: 'thread';
27
+ threadId: string;
28
+ messageId?: string;
29
+ };
30
+ dynamicVariables?: Record<string, unknown>;
21
31
  }): void;
22
32
  /** Disconnect from the avatar service */
23
33
  disconnect(): void;
24
34
  /** Observable connection status */
25
35
  isConnected: TinyDataStoreConsumer<boolean>;
36
+ isPaused: TinyDataStoreConsumer<boolean>;
37
+ captions: Captions;
38
+ registerClientTools(tools: Record<string, (variables: unknown) => undefined | null | Record<string, unknown> | Promise<Record<string, unknown>>>): void;
26
39
  /** Observable chat panel open state */
27
40
  isChatPanelOpen: TinyDataStoreConsumer<boolean>;
28
41
  /** Update chat panel open state */
@@ -41,15 +54,6 @@ export type AvatarRuntime = UnisphereRuntimeBaseType<AvatarRuntimeSettings> & {
41
54
  unmute(): void;
42
55
  /** Send a text question to the avatar */
43
56
  askViaText(question: string): void;
44
- /** Send setDynamicPrompt event to the CM */
45
- setDynamicPrompt(data: unknown): void;
46
- /**
47
- * Subscribe to tool-call events from the avatar's WebSocket.
48
- * Emits for every tool call (e.g. navigate_to_slide) without interfering
49
- * with internal GenUI rendering. The host app can register handlers to
50
- * react to specific tool names.
51
- */
52
- readonly onToolCall: TinyPubSub<AvatarToolCallEvent>['consumer'];
53
57
  };
54
58
  /** Event emitted when the avatar brain invokes a tool call */
55
59
  export interface AvatarToolCallEvent {
@@ -81,8 +85,6 @@ export type AvatarServerConfig = {
81
85
  agentMode?: boolean;
82
86
  /** Enable audio noise reduction for clearer audio */
83
87
  noiseReductionEnabled?: boolean;
84
- /** Genie service server URL */
85
- genieServerUrl?: string;
86
88
  /** Kaltura sesssion */
87
89
  ks: string;
88
90
  };
@@ -116,6 +118,8 @@ export type AvatarRuntimeSettings = {
116
118
  captions?: boolean | CaptionConfig;
117
119
  /** Phrase sent automatically when avatar signals a blank kickoff turn */
118
120
  kickOffPhrase?: string;
121
+ /** Dynamic request variables */
122
+ dynamicVariables?: Record<string, unknown>;
119
123
  };
120
124
  } & (({
121
125
  serverConfig?: 'manual';
@@ -1,6 +1,7 @@
1
1
  import { TinyDataStoreConsumer } from '@unisphere/core';
2
2
  import { DeviceEnumerationResult } from '@kaltura-sdk/rtc-core';
3
3
  import type { ChatEntry } from './chat-types';
4
+ import { ChatContext } from '../chat-runtime';
4
5
  /**
5
6
  * Audio device types for avatar connections.
6
7
  */
@@ -66,6 +67,14 @@ export type AgentScreenShareInfo = {
66
67
  stream: MediaStream | null;
67
68
  analysisReady: boolean;
68
69
  };
70
+ /**
71
+ * Agent kaltura context data
72
+ */
73
+ export type AgentKalturaContextData = {
74
+ active: boolean;
75
+ everywhere: boolean;
76
+ data: ChatContext | null;
77
+ };
69
78
  /**
70
79
  * Content data for avatar tool integrations.
71
80
  *
@@ -130,14 +139,12 @@ export interface CaptionConfig {
130
139
  * @internal
131
140
  */
132
141
  export interface AvatarConnectionProxInternalType {
133
- /** Send direct event to server */
134
- _directEventToServer(message: string, data: any): void;
135
142
  /** Set local content state */
136
- _setLocalContent(content: any): void;
143
+ __setLocalContent(content: any): void;
137
144
  /** Handle player errors */
138
- onPlayerError(error: Error): void;
145
+ __onPlayerError(error: Error): void;
139
146
  /** WebSocket connection observable */
140
- webSocket: TinyDataStoreConsumer<SimplifiedSocket | null>;
147
+ __webSocket: TinyDataStoreConsumer<SimplifiedSocket | null>;
141
148
  }
142
149
  export declare enum DisconnectReasons {
143
150
  UserRequested = "UserRequested",
@@ -181,6 +188,8 @@ export interface AvatarConnectionProxyType {
181
188
  readonly content: TinyDataStoreConsumer<AvatarContentData | null>;
182
189
  /** Observable agent state and analytics */
183
190
  readonly agentData: TinyDataStoreConsumer<AgentData | null>;
191
+ /** Observable agent kaltura context data */
192
+ readonly kalturaContext: TinyDataStoreConsumer<AgentKalturaContextData | null>;
184
193
  /** Observable available audio devices */
185
194
  readonly devicesList: TinyDataStoreConsumer<{
186
195
  audioInput: MediaDeviceInfo[];
@@ -207,8 +216,6 @@ export interface AvatarConnectionProxyType {
207
216
  readonly id: string;
208
217
  /** Send text message to avatar */
209
218
  sendAskViaText(text: string): void;
210
- /** Send custom event to avatar */
211
- sendDirectEvent(message: string, data: unknown): void;
212
219
  /** Terminate the avatar connection */
213
220
  destroy(): void;
214
221
  /** Start screen sharing */
@@ -14,6 +14,13 @@ export declare const AVATAR_DEFAULT_CAPABILITIES: GenieCapabilities;
14
14
  export declare const getChatDefaultCapabilities: (context?: ChatContext) => GenieCapabilities;
15
15
  export declare const getAvatarDefaultCapabilities: (context?: ChatContext) => GenieCapabilities;
16
16
  export declare const CHAT_CONTEXT_TYPE: Record<ChatContext['type'], string>;
17
+ export declare const resolveActiveContextType: (context: ChatContext | undefined) => {
18
+ contextId: string;
19
+ contextType: string;
20
+ } | {
21
+ contextType: string;
22
+ contextId?: undefined;
23
+ };
17
24
  export declare const CHAT_CONTEXT_TYPE_GLOBAL = "global";
18
25
  export type ChatContext = {
19
26
  type: 'entry';
File without changes
@@ -1 +0,0 @@
1
- {}
@@ -1 +0,0 @@
1
- export declare const supportedLanguages: string[];
@@ -1,5 +0,0 @@
1
- export declare const useTranslation: () => {
2
- t: (key: string, options?: {
3
- [x: string]: string | number;
4
- } | undefined) => string;
5
- };