@kaltura-sdk/avatars 1.16.2 → 1.17.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.
Files changed (20) hide show
  1. package/index.esm.js +722 -382
  2. package/package.json +5 -5
  3. package/src/lib/avatar-client-manager/avatar-client-manager.d.ts +4 -1
  4. package/src/lib/avatar-client-manager/machines/avatar-connection/actions/context/set-progress-bar-data.d.ts +2 -0
  5. package/src/lib/avatar-client-manager/machines/avatar-connection/actions/context/track-pushed-progress-bar.d.ts +2 -0
  6. package/src/lib/avatar-client-manager/machines/avatar-connection/actions/context/track-pushed-stage-content.d.ts +2 -0
  7. package/src/lib/avatar-client-manager/machines/avatar-connection/avatar-connection-machine.d.ts +12 -0
  8. package/src/lib/avatar-client-manager/machines/avatar-connection/guards/is-request-variables-stale.d.ts +4 -0
  9. package/src/lib/avatar-client-manager/machines/avatar-connection/guards/is-stage-variable-stale.d.ts +4 -0
  10. package/src/lib/avatar-client-manager/machines/avatar-connection/states/connected-state.d.ts +5 -1
  11. package/src/lib/avatar-client-manager/machines/avatar-connection/states/connected-states/content-state.d.ts +5 -1
  12. package/src/lib/avatar-client-manager/machines/avatar-connection/types/context.d.ts +5 -1
  13. package/src/lib/avatar-client-manager/machines/avatar-connection/types/events.d.ts +6 -1
  14. package/src/lib/avatar-client-manager/machines/avatar-connection/utils/build-progress-bar-variable.d.ts +3 -0
  15. package/src/lib/avatar-client-manager/machines/avatar-connection/utils/build-stage-variable.d.ts +3 -0
  16. package/src/lib/avatar-client-manager/machines/avatar-connection/utils/index.d.ts +5 -0
  17. package/src/lib/avatar-client-manager/machines/avatar-connection/utils/is-deep-equal.d.ts +1 -0
  18. package/src/lib/avatar-client-manager/machines/avatar-connection/utils/parse-progress-bar.d.ts +2 -0
  19. package/src/lib/avatar-client-manager/machines/avatar-connection/utils/parse-stage-directive.d.ts +2 -0
  20. package/src/lib/avatar-client-manager/machines/avatar-connection/utils/resolve-persistent-content.d.ts +13 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaltura-sdk/avatars",
3
- "version": "1.16.2",
3
+ "version": "1.17.0",
4
4
  "author": "kaltura",
5
5
  "license": "AGPL-3.0",
6
6
  "repository": {
@@ -9,14 +9,14 @@
9
9
  },
10
10
  "types": "./src/index.d.ts",
11
11
  "dependencies": {
12
- "@kaltura-sdk/rtc-avatar": "^1.33.1",
13
- "@kaltura-sdk/rtc-core": "^1.26.1",
12
+ "@kaltura-sdk/rtc-avatar": "^1.33.4",
13
+ "@kaltura-sdk/rtc-core": "^1.26.2",
14
14
  "@local/genie-shared-utils": "^1.0.0",
15
15
  "@unisphere/core": "^1.99.0",
16
- "@unisphere/genie-types": "^1.39.6",
16
+ "@unisphere/genie-types": "^1.42.0",
17
17
  "@unisphere/notifications-core": "^1.25.0",
18
18
  "@unisphere/runtime": "^1.98.0",
19
- "@unisphere/runtime-js": "^1.96.0",
19
+ "@unisphere/runtime-js": "^1.98.0",
20
20
  "immer": "^10.1.1",
21
21
  "js-yaml": "^4.1.0",
22
22
  "socket.io-client": "^4.8.1",
@@ -1,6 +1,6 @@
1
1
  import { UnisphereLoggerType } from '@unisphere/core';
2
2
  import { KalturaAnalyticsServiceType, PubSubServiceType } from '@unisphere/runtime';
3
- import { AgentData, AgentKalturaContextData, AgentScreenShareInfo, AgentTapToTalkInfo, AvatarClientManagerType, AvatarConnectionProxInternalType, AvatarConnectionProxyType, AvatarConnectionStatus, AvatarContentData, AvatarRuntimeSettings, CaptionConfig, Captions, ChatEntry, ClientToolCallLogEntry, DisconnectReasons } from '@unisphere/genie-types';
3
+ import { AgentData, AgentKalturaContextData, AgentProgressBar, AgentScreenShareInfo, AgentTapToTalkInfo, AvatarClientManagerType, AvatarConnectionProxInternalType, AvatarConnectionProxyType, AvatarConnectionStatus, AvatarContentData, AvatarRuntimeSettings, CaptionConfig, Captions, ChatEntry, ClientToolCallLogEntry, DisconnectReasons } from '@unisphere/genie-types';
4
4
  import { type AvatarClientToolsInput, type AvatarConnectionActor } from './machines/avatar-connection';
5
5
  import { AvatarClientManagerActions } from './types';
6
6
  import { DeviceType } from '@kaltura-sdk/rtc-core';
@@ -39,6 +39,7 @@ export declare class AvatarClientManager extends ActorManager<AvatarConnectionAc
39
39
  private readonly _chatLog;
40
40
  private readonly _clientToolCallLog;
41
41
  private readonly _screenShareInfo;
42
+ private readonly _progressBar;
42
43
  private readonly _tapToTalkInfo;
43
44
  private readonly _captions;
44
45
  private readonly _kalturaContext;
@@ -122,6 +123,7 @@ export declare class AvatarClientManager extends ActorManager<AvatarConnectionAc
122
123
  sendAgentTurnRecoveryRequest(speechId: string, messageId: string): void;
123
124
  clearContent(): void;
124
125
  setLocalContent(content: AvatarContentData): void;
126
+ get progressBar(): import("@unisphere/core").TinyDataStoreConsumer<AgentProgressBar | null>;
125
127
  get screenShareInfo(): import("@unisphere/core").TinyDataStoreConsumer<AgentScreenShareInfo | null>;
126
128
  startScreenShare(): void;
127
129
  stopScreenShare(): void;
@@ -155,6 +157,7 @@ export declare class AvatarClientManager extends ActorManager<AvatarConnectionAc
155
157
  captions?: boolean | CaptionConfig | undefined;
156
158
  kickOffPhrase?: string | undefined;
157
159
  dynamicVariables?: Record<string, unknown> | undefined;
160
+ persistentContent?: boolean | undefined;
158
161
  } | undefined>;
159
162
  get agentPreviewUrl(): import("@unisphere/core").TinyDataStoreConsumer<string | null>;
160
163
  get agentPreviewImageUrl(): import("@unisphere/core").TinyDataStoreConsumer<string | null>;
@@ -0,0 +1,2 @@
1
+ import { AvatarConnectionMachineAction } from '../../types';
2
+ export declare const setProgressBarData: AvatarConnectionMachineAction;
@@ -0,0 +1,2 @@
1
+ import { AvatarConnectionMachineAction } from '../../types';
2
+ export declare const trackPushedProgressBar: AvatarConnectionMachineAction;
@@ -0,0 +1,2 @@
1
+ import { AvatarConnectionMachineAction } from '../../types';
2
+ export declare const trackPushedStageContent: AvatarConnectionMachineAction;
@@ -347,6 +347,15 @@ export declare const avatarConnectionMachine: import("xstate").StateMachine<Avat
347
347
  } | {
348
348
  type: "setContentData";
349
349
  params: unknown;
350
+ } | {
351
+ type: "setProgressBarData";
352
+ params: unknown;
353
+ } | {
354
+ type: "trackPushedStageContent";
355
+ params: unknown;
356
+ } | {
357
+ type: "trackPushedProgressBar";
358
+ params: unknown;
350
359
  } | {
351
360
  type: "sendAskViaText";
352
361
  params: {
@@ -544,6 +553,9 @@ export declare const avatarConnectionMachine: import("xstate").StateMachine<Avat
544
553
  } | {
545
554
  type: "hadAvatarTypeInTurn";
546
555
  params: unknown;
556
+ } | {
557
+ type: "isRequestVariablesStale";
558
+ params: unknown;
547
559
  } | {
548
560
  type: "hasMoreRecoveryRetries";
549
561
  params: unknown;
@@ -0,0 +1,4 @@
1
+ import { AvatarConnectionMachineContext } from '../types';
2
+ export declare const isRequestVariablesStale: ({ context, }: {
3
+ context: AvatarConnectionMachineContext;
4
+ }) => boolean;
@@ -0,0 +1,4 @@
1
+ import { AvatarConnectionMachineContext } from '../types';
2
+ export declare const isStageVariableStale: ({ context, }: {
3
+ context: AvatarConnectionMachineContext;
4
+ }) => boolean;
@@ -82,12 +82,16 @@ export declare const connectedState: {
82
82
  logger: import("@unisphere/core").UnisphereLoggerType;
83
83
  };
84
84
  }[];
85
+ always: {
86
+ guard: "isRequestVariablesStale";
87
+ actions: readonly ["sendUpdateGenieContext", "trackPushedStageContent", "trackPushedProgressBar"];
88
+ };
85
89
  on: {
86
90
  SetContent: {
87
91
  actions: readonly ["setContentData"];
88
92
  };
89
93
  AgentRawTextMessageCompleted: {
90
- actions: readonly ["setContentData"];
94
+ actions: readonly ["setContentData", "setProgressBarData"];
91
95
  };
92
96
  };
93
97
  };
@@ -10,12 +10,16 @@ export declare const contentState: {
10
10
  logger: import("@unisphere/core").UnisphereLoggerType;
11
11
  };
12
12
  }[];
13
+ always: {
14
+ guard: "isRequestVariablesStale";
15
+ actions: readonly ["sendUpdateGenieContext", "trackPushedStageContent", "trackPushedProgressBar"];
16
+ };
13
17
  on: {
14
18
  SetContent: {
15
19
  actions: readonly ["setContentData"];
16
20
  };
17
21
  AgentRawTextMessageCompleted: {
18
- actions: readonly ["setContentData"];
22
+ actions: readonly ["setContentData", "setProgressBarData"];
19
23
  };
20
24
  };
21
25
  };
@@ -4,7 +4,7 @@ import { clientConfigurationSchema } from './schemas';
4
4
  import { z } from 'zod/mini';
5
5
  import { KalturaAnalyticsServiceType, PubSubServiceType } from '@unisphere/runtime';
6
6
  import { AvatarRuntimeSettings, CaptionConfig, CaptionState, ClientToolCallLogEntry, DisconnectReasons, GenieCapabilities, ChatContext } from '@unisphere/genie-types';
7
- import { ChatEntry, UnisphereChatBlock } from '@unisphere/genie-types';
7
+ import { AgentProgressBar, ChatEntry, UnisphereChatBlock } from '@unisphere/genie-types';
8
8
  import { AvatarClientToolsRegistry, GetAvatarClientToolHandler } from './input';
9
9
  export interface AvatarConnectionMachineContext {
10
10
  logger: UnisphereLoggerType;
@@ -33,6 +33,7 @@ export interface AvatarConnectionMachineContext {
33
33
  chat?: boolean;
34
34
  captions?: boolean | CaptionConfig;
35
35
  kickOffPhrase?: string;
36
+ persistentContent?: boolean;
36
37
  };
37
38
  serverUrl: string;
38
39
  turnServerUrl: string;
@@ -64,6 +65,9 @@ export interface AvatarConnectionMachineContext {
64
65
  webrtcUrl: string | null;
65
66
  threadId: string | null;
66
67
  content: UnisphereChatBlock | null;
68
+ pushedStageContent: UnisphereChatBlock | null;
69
+ progressBar: AgentProgressBar | null;
70
+ pushedProgressBar: AgentProgressBar | null;
67
71
  chatLog: ChatEntry[];
68
72
  clientToolCallLog: ClientToolCallLogEntry[];
69
73
  awaitingInternalAskEcho: boolean;
@@ -2,7 +2,7 @@ import { DoneActorEvent, ErrorActorEvent } from 'xstate';
2
2
  import { ChatEntry, UnisphereChatBlock } from '@unisphere/genie-types';
3
3
  import { askPermissionsSchema, clientConfigurationSchema, conversationEndedSchema, conversationTimeWarningSchema, joinCompleteSchema, noAgentSchema, onServerConnectedSchema, showAgentSchema, showStartSpeechSchema, stvFinishedTalkingSchema, stvNewSessionSchema, stvStartedTalkingSchema } from './schemas';
4
4
  import z from 'zod';
5
- import { CaptionState, ClientToolCallLogEntry, DisconnectReasons } from '@unisphere/genie-types';
5
+ import { AgentProgressBar, CaptionState, ClientToolCallLogEntry, DisconnectReasons } from '@unisphere/genie-types';
6
6
  export declare enum AvatarConnectionMachineEventTypes {
7
7
  Disconnect = "Disconnect",
8
8
  WebsocketReconnected = "WebsocketReconnected",
@@ -130,11 +130,16 @@ export type AgentThreadIdReceivedEvent = {
130
130
  type: AvatarConnectionMachineEventTypes.AgentThreadIdReceived;
131
131
  payload: string;
132
132
  };
133
+ export type StageDirective = 'clear';
133
134
  export type AgentRawTextMessageCompletedEvent = {
134
135
  type: AvatarConnectionMachineEventTypes.AgentRawTextMessageCompleted;
135
136
  messageId: string;
136
137
  speechId: string;
137
138
  blocks: UnisphereChatBlock[];
139
+ /** Set when the message carried a ```stage``` control fence */
140
+ stageDirective?: StageDirective;
141
+ /** Set when the message carried a valid ```ui-progress-bar``` fence */
142
+ progressBar?: AgentProgressBar;
138
143
  };
139
144
  export type AgentRecoveryTurnCompletedEvent = {
140
145
  type: AvatarConnectionMachineEventTypes.AgentRecoveryTurnCompleted;
@@ -0,0 +1,3 @@
1
+ import { AgentProgressBar } from '@unisphere/genie-types';
2
+ export declare const PROGRESS_BAR_VARIABLE_NAME = "progress_bar";
3
+ export declare const buildProgressBarVariable: (progressBar: AgentProgressBar | null) => string;
@@ -0,0 +1,3 @@
1
+ import { UnisphereChatBlock } from '@unisphere/genie-types';
2
+ export declare const STAGE_VARIABLE_NAME = "avatar_stage";
3
+ export declare const buildStageVariable: (content: UnisphereChatBlock | null) => string;
@@ -1,2 +1,7 @@
1
1
  export * from './resolve-capabilities';
2
2
  export * from './agent-raw-text-blocks-creator';
3
+ export * from './parse-stage-directive';
4
+ export * from './parse-progress-bar';
5
+ export * from './is-deep-equal';
6
+ export * from './build-stage-variable';
7
+ export * from './resolve-persistent-content';
@@ -0,0 +1 @@
1
+ export declare const isDeepEqual: (a: unknown, b: unknown) => boolean;
@@ -0,0 +1,2 @@
1
+ import { AgentProgressBar } from '@unisphere/genie-types';
2
+ export declare const parseProgressBar: (text: string) => AgentProgressBar | null;
@@ -0,0 +1,2 @@
1
+ import { StageDirective } from '../types/events';
2
+ export declare const parseStageDirective: (text: string) => StageDirective | null;
@@ -0,0 +1,13 @@
1
+ import { UnisphereChatBlock } from '@unisphere/genie-types';
2
+ import { StageDirective } from '../types/events';
3
+ /**
4
+ * Persistent-stage reducer for a completed agent message. Returns the current
5
+ * reference when nothing should change so downstream stores skip the update.
6
+ * Same tool re-emitted keeps the current block id (React key), so the visual is
7
+ * updated in place rather than remounted.
8
+ */
9
+ export declare const resolvePersistentContent: ({ current, incoming, stageDirective, }: {
10
+ current: UnisphereChatBlock | null;
11
+ incoming: UnisphereChatBlock | undefined;
12
+ stageDirective?: StageDirective;
13
+ }) => UnisphereChatBlock | null;