@webex/plugin-meetings 3.12.0-auth-prejoin-fetch.1 → 3.12.0-llmrefactor.10
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/dist/aiEnableRequest/index.js +1 -1
- package/dist/annotation/index.js +53 -17
- package/dist/annotation/index.js.map +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +35 -9
- package/dist/breakouts/index.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +101 -48
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/interceptors/dataChannelAuthToken.js +41 -59
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/index.js +27 -2
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/types.js +2 -1
- package/dist/locus-info/types.js.map +1 -1
- package/dist/meeting/index.js +913 -921
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/util.js +5 -1
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting/voicea-meeting.js +2 -1
- package/dist/meeting/voicea-meeting.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +36 -92
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +33 -93
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/meetings.types.js.map +1 -1
- package/dist/types/annotation/index.d.ts +19 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +12 -0
- package/dist/types/locus-info/index.d.ts +6 -0
- package/dist/types/locus-info/types.d.ts +1 -0
- package/dist/types/meeting/index.d.ts +47 -20
- package/dist/types/meeting/util.d.ts +3 -1
- package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -24
- package/dist/types/meetings/index.d.ts +2 -13
- package/dist/types/meetings/meetings.types.d.ts +1 -15
- package/dist/webinar/index.js +298 -255
- package/dist/webinar/index.js.map +1 -1
- package/package.json +21 -21
- package/src/annotation/index.ts +55 -25
- package/src/breakouts/index.ts +33 -11
- package/src/hashTree/hashTreeParser.ts +67 -3
- package/src/interceptors/dataChannelAuthToken.ts +48 -77
- package/src/locus-info/index.ts +20 -0
- package/src/locus-info/types.ts +1 -0
- package/src/meeting/index.ts +318 -332
- package/src/meeting/util.ts +2 -2
- package/src/meeting/voicea-meeting.ts +1 -1
- package/src/meeting-info/meeting-info-v2.ts +18 -74
- package/src/meetings/index.ts +6 -70
- package/src/meetings/meetings.types.ts +1 -17
- package/src/webinar/index.ts +168 -188
- package/test/unit/spec/annotation/index.ts +214 -182
- package/test/unit/spec/breakouts/index.ts +126 -25
- package/test/unit/spec/hashTree/hashTreeParser.ts +212 -1
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +81 -99
- package/test/unit/spec/locus-info/index.js +79 -0
- package/test/unit/spec/meeting/index.js +979 -701
- package/test/unit/spec/meeting/utils.js +16 -2
- package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
- package/test/unit/spec/meeting-info/meetinginfov2.js +0 -210
- package/test/unit/spec/meetings/index.js +5 -231
- package/test/unit/spec/webinar/index.ts +886 -718
|
@@ -110,6 +110,7 @@ export type HashTreeParserCallbacks = {
|
|
|
110
110
|
locusInfoUpdateCallback: LocusInfoUpdateCallback;
|
|
111
111
|
syncLatencyTracker?: SyncLatencyTracker;
|
|
112
112
|
generateTrackingId?: GenerateTrackingId;
|
|
113
|
+
isLlmExpected: () => boolean;
|
|
113
114
|
};
|
|
114
115
|
|
|
115
116
|
const SYNC_METRICS_DATA_SETS = [
|
|
@@ -176,6 +177,9 @@ class HashTreeParser {
|
|
|
176
177
|
private syncQueueProcessingPromise: Promise<void> = Promise.resolve();
|
|
177
178
|
// top-level heartbeat interval from the most recent message, used as fallback when dataset-level value is missing
|
|
178
179
|
private topLevelHeartbeatIntervalMs?: number;
|
|
180
|
+
// LLM data sets that were received while LLM was not expected, so their heartbeat watchdog was
|
|
181
|
+
// skipped; reevaluateLlmWatchdogs() arms these once LLM becomes expected and then clears this set
|
|
182
|
+
private pendingLlmWatchdogDataSetNames: Set<string> = new Set();
|
|
179
183
|
/**
|
|
180
184
|
* Constructor for HashTreeParser
|
|
181
185
|
* @param {Object} options
|
|
@@ -1222,11 +1226,11 @@ class HashTreeParser {
|
|
|
1222
1226
|
// emitted only from the LLM message path, so no completion happens here.
|
|
1223
1227
|
const updatedObjects = this.parseMessage(message, debugText);
|
|
1224
1228
|
|
|
1225
|
-
this.resetHeartbeatWatchdogs(message.dataSets);
|
|
1226
1229
|
this.callLocusInfoUpdateCallback({
|
|
1227
1230
|
updateType: LocusInfoUpdateType.OBJECTS_UPDATED,
|
|
1228
1231
|
updatedObjects,
|
|
1229
1232
|
});
|
|
1233
|
+
this.resetHeartbeatWatchdogs(message.dataSets);
|
|
1230
1234
|
}
|
|
1231
1235
|
}
|
|
1232
1236
|
|
|
@@ -1876,7 +1880,22 @@ class HashTreeParser {
|
|
|
1876
1880
|
// dataset-level heartbeatIntervalMs takes priority; fall back to top-level common value
|
|
1877
1881
|
const heartbeatIntervalMs = dataSet?.heartbeatIntervalMs ?? this.topLevelHeartbeatIntervalMs;
|
|
1878
1882
|
|
|
1879
|
-
if (!dataSet?.hashTree || !heartbeatIntervalMs) {
|
|
1883
|
+
if (!dataSet?.hashTree || !this.isVisibleDataSet(dataSet.name) || !heartbeatIntervalMs) {
|
|
1884
|
+
// eslint-disable-next-line no-continue
|
|
1885
|
+
continue;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
if (
|
|
1889
|
+
LLM_DATASET_NAMES.includes(dataSet.name) &&
|
|
1890
|
+
this.callbacks.isLlmExpected &&
|
|
1891
|
+
!this.callbacks.isLlmExpected()
|
|
1892
|
+
) {
|
|
1893
|
+
LoggerProxy.logger.info(
|
|
1894
|
+
`HashTreeParser#resetHeartbeatWatchdogs --> ${this.debugId} skipping heartbeat watchdog timer for data set "${dataSet.name}" because LLM is disconnected`
|
|
1895
|
+
);
|
|
1896
|
+
|
|
1897
|
+
// remember it so reevaluateLlmWatchdogs() can arm the watchdog once LLM becomes expected
|
|
1898
|
+
this.pendingLlmWatchdogDataSetNames.add(dataSet.name);
|
|
1880
1899
|
// eslint-disable-next-line no-continue
|
|
1881
1900
|
continue;
|
|
1882
1901
|
}
|
|
@@ -1888,7 +1907,7 @@ class HashTreeParser {
|
|
|
1888
1907
|
dataSet.heartbeatWatchdogTimer = undefined;
|
|
1889
1908
|
|
|
1890
1909
|
LoggerProxy.logger.warn(
|
|
1891
|
-
`HashTreeParser#resetHeartbeatWatchdogs --> ${this.debugId} Heartbeat watchdog fired for data set "${dataSet.name}" - no heartbeat received within expected interval, initiating sync`
|
|
1910
|
+
`HashTreeParser#resetHeartbeatWatchdogs --> ${this.debugId} Heartbeat watchdog fired for data set "${dataSet.name}" - no heartbeat received within expected interval(heartbeatIntervalMs=${heartbeatIntervalMs}, backoffTime=${backoffTime}), initiating sync`
|
|
1892
1911
|
);
|
|
1893
1912
|
|
|
1894
1913
|
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.HASH_TREE_HEARTBEAT_WATCHDOG_EXPIRED, {
|
|
@@ -1904,6 +1923,50 @@ class HashTreeParser {
|
|
|
1904
1923
|
}
|
|
1905
1924
|
}
|
|
1906
1925
|
|
|
1926
|
+
/**
|
|
1927
|
+
* Re-evaluates heartbeat watchdog timers for LLM data sets. While LLM is not expected,
|
|
1928
|
+
* resetHeartbeatWatchdogs skips setting watchdog timers for LLM data sets and records them in
|
|
1929
|
+
* pendingLlmWatchdogDataSetNames. This must be called when LLM transitions to expected (e.g. self
|
|
1930
|
+
* reports JOINED) to arm the watchdogs for those pending data sets (avoids a timing issue where
|
|
1931
|
+
* the "main"/"atd-active"/"atd-unmuted" data set arrives before the self update). The pending set
|
|
1932
|
+
* is consumed and cleared here.
|
|
1933
|
+
* @returns {void}
|
|
1934
|
+
*/
|
|
1935
|
+
reevaluateLlmWatchdogs(): void {
|
|
1936
|
+
if (this.state === 'stopped') {
|
|
1937
|
+
return;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
if (this.pendingLlmWatchdogDataSetNames.size === 0) {
|
|
1941
|
+
return;
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
// consume the pending set - these LLM data sets were received while LLM was not expected
|
|
1945
|
+
const pendingDataSetNames = [...this.pendingLlmWatchdogDataSetNames];
|
|
1946
|
+
this.pendingLlmWatchdogDataSetNames.clear();
|
|
1947
|
+
|
|
1948
|
+
const dataSetsNeedingWatchdog = pendingDataSetNames
|
|
1949
|
+
.map((name) => this.dataSets[name])
|
|
1950
|
+
.filter((dataSet): dataSet is InternalDataSet => {
|
|
1951
|
+
if (!dataSet?.hashTree || dataSet.heartbeatWatchdogTimer) {
|
|
1952
|
+
return false;
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
return this.isVisibleDataSet(dataSet.name);
|
|
1956
|
+
});
|
|
1957
|
+
|
|
1958
|
+
if (dataSetsNeedingWatchdog.length > 0) {
|
|
1959
|
+
LoggerProxy.logger.info(
|
|
1960
|
+
`HashTreeParser#reevaluateLlmWatchdogs --> ${
|
|
1961
|
+
this.debugId
|
|
1962
|
+
} LLM became expected, setting heartbeat watchdog timers for data sets: ${dataSetsNeedingWatchdog
|
|
1963
|
+
.map((ds) => ds.name)
|
|
1964
|
+
.join(', ')}`
|
|
1965
|
+
);
|
|
1966
|
+
this.resetHeartbeatWatchdogs(dataSetsNeedingWatchdog);
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1907
1970
|
/**
|
|
1908
1971
|
* Stops all timers for the data sets to prevent any further sync attempts.
|
|
1909
1972
|
* @returns {void}
|
|
@@ -1936,6 +1999,7 @@ class HashTreeParser {
|
|
|
1936
1999
|
this.topLevelHeartbeatIntervalMs = undefined;
|
|
1937
2000
|
this.syncAllBackoffType = SyncAllBackoffType.NONE;
|
|
1938
2001
|
this.dataSetsSyncedDuringBackoff = new Set();
|
|
2002
|
+
this.pendingLlmWatchdogDataSetNames = new Set();
|
|
1939
2003
|
Object.values(this.dataSets).forEach((dataSet) => {
|
|
1940
2004
|
dataSet.syncAbortController?.abort();
|
|
1941
2005
|
dataSet.syncAbortController = undefined;
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import {Interceptor} from '@webex/http-core';
|
|
6
|
+
|
|
7
|
+
// @ts-ignore - internal-plugin-llm types
|
|
6
8
|
import LLMChannel from '@webex/internal-plugin-llm';
|
|
7
9
|
import LoggerProxy from '../common/logs/logger-proxy';
|
|
10
|
+
import Meeting from '../meeting';
|
|
8
11
|
import {DATA_CHANNEL_AUTH_HEADER, MAX_RETRY, RETRY_INTERVAL, RETRY_KEY} from './constant';
|
|
9
12
|
import {isJwtTokenExpired} from './utils';
|
|
10
|
-
import {LLM_DEFAULT_SESSION, LLM_PRACTICE_SESSION, LOCUS_URL} from '../constants';
|
|
11
13
|
|
|
12
14
|
const retryCountMap = new Map();
|
|
13
15
|
interface HttpLikeError extends Error {
|
|
@@ -40,93 +42,62 @@ export default class DataChannelAuthTokenInterceptor extends Interceptor {
|
|
|
40
42
|
return this.internal.llm.isDataChannelTokenEnabled();
|
|
41
43
|
},
|
|
42
44
|
|
|
43
|
-
// Route refresh by request URL
|
|
44
|
-
// 1)
|
|
45
|
-
// 2) If
|
|
46
|
-
// If
|
|
45
|
+
// Route refresh by request URL:
|
|
46
|
+
// 1) Find the LLM channel that matches the request URL
|
|
47
|
+
// 2) If found, use its refresh handler
|
|
48
|
+
// 3) If no channel matches, fall back to finding the meeting by locusUrl
|
|
47
49
|
refreshDataChannelToken: async (requestUrl?: string) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (typeof requestUrl === 'string') {
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
sessionId = this.internal.llm.getSessionIdByDatachannelUrl?.(requestUrl);
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
const channel = this.internal.llm.getChannelByDatachannelUrl(requestUrl);
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
if (channel) {
|
|
54
|
+
// Channel found - use its refresh handler
|
|
55
|
+
const result = await channel.refreshDataChannelToken();
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
meeting = this.meetings?.getMeetingByType?.(LOCUS_URL, locusUrl);
|
|
62
|
-
}
|
|
57
|
+
if (!result?.body) {
|
|
58
|
+
throw new Error('DataChannel token refresh returned no payload');
|
|
63
59
|
}
|
|
64
60
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
// where connections are not yet populated (e.g. if setRefreshHandler
|
|
70
|
-
// is called on a session that has no connection entry at all).
|
|
71
|
-
// @ts-ignore
|
|
72
|
-
const allMeetings = this.meetings?.getAllMeetings?.() || {};
|
|
73
|
-
|
|
74
|
-
meeting = Object.values(allMeetings).find((activeMeeting: any) => {
|
|
75
|
-
const info = activeMeeting?.locusInfo?.info || {};
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
(info.practiceSessionDatachannelUrl &&
|
|
79
|
-
LLMChannel.matchesDatachannelRequestUrl(
|
|
80
|
-
requestUrl,
|
|
81
|
-
info.practiceSessionDatachannelUrl
|
|
82
|
-
)) ||
|
|
83
|
-
(info.datachannelUrl &&
|
|
84
|
-
LLMChannel.matchesDatachannelRequestUrl(requestUrl, info.datachannelUrl))
|
|
85
|
-
);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
if (!sessionId) {
|
|
89
|
-
// @ts-ignore
|
|
90
|
-
const info = meeting?.locusInfo?.info || {};
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
info.practiceSessionDatachannelUrl &&
|
|
94
|
-
LLMChannel.matchesDatachannelRequestUrl(
|
|
95
|
-
requestUrl,
|
|
96
|
-
info.practiceSessionDatachannelUrl
|
|
97
|
-
)
|
|
98
|
-
) {
|
|
99
|
-
sessionId = LLM_PRACTICE_SESSION;
|
|
100
|
-
} else if (
|
|
101
|
-
info.datachannelUrl &&
|
|
102
|
-
LLMChannel.matchesDatachannelRequestUrl(requestUrl, info.datachannelUrl)
|
|
103
|
-
) {
|
|
104
|
-
sessionId = LLM_DEFAULT_SESSION;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
61
|
+
const {datachannelToken} = result.body;
|
|
62
|
+
channel.setDatachannelToken(datachannelToken);
|
|
63
|
+
|
|
64
|
+
return datachannelToken;
|
|
108
65
|
}
|
|
109
66
|
|
|
110
|
-
|
|
67
|
+
// No channel found - fallback to finding meeting by matching datachannel URLs
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
const allMeetings: Record<string, Meeting> = this.meetings?.getAllMeetings() || {};
|
|
70
|
+
|
|
71
|
+
const meeting = Object.values(allMeetings).find((activeMeeting) => {
|
|
72
|
+
const info = activeMeeting?.locusInfo?.info || {};
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
(info.practiceSessionDatachannelUrl &&
|
|
76
|
+
LLMChannel.matchesDatachannelRequestUrl(
|
|
77
|
+
requestUrl,
|
|
78
|
+
info.practiceSessionDatachannelUrl
|
|
79
|
+
)) ||
|
|
80
|
+
(info.datachannelUrl &&
|
|
81
|
+
LLMChannel.matchesDatachannelRequestUrl(requestUrl, info.datachannelUrl))
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
|
|
111
85
|
if (meeting) {
|
|
112
|
-
result = await meeting.refreshDataChannelToken();
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
86
|
+
const result = await meeting.refreshDataChannelToken();
|
|
87
|
+
|
|
88
|
+
if (!result?.body) {
|
|
89
|
+
throw new Error('DataChannel token refresh returned no payload');
|
|
90
|
+
}
|
|
117
91
|
|
|
118
|
-
|
|
119
|
-
|
|
92
|
+
const {datachannelToken} = result.body;
|
|
93
|
+
|
|
94
|
+
// Store token on the meeting's LLM channel if available
|
|
95
|
+
meeting.setLLMChannelDataToken(datachannelToken);
|
|
96
|
+
|
|
97
|
+
return datachannelToken;
|
|
120
98
|
}
|
|
121
|
-
const {datachannelToken, dataChannelTokenType} = result.body;
|
|
122
|
-
const tokenStoreKey = dataChannelTokenType || sessionId;
|
|
123
|
-
const ownerMeetingId =
|
|
124
|
-
// @ts-ignore
|
|
125
|
-
meeting?.id || this.internal.llm.getOwnerMeetingId?.(tokenStoreKey);
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
this.internal.llm.setDatachannelToken(datachannelToken, tokenStoreKey, ownerMeetingId);
|
|
128
99
|
|
|
129
|
-
|
|
100
|
+
throw new Error('No LLM channel or meeting found for request URL');
|
|
130
101
|
},
|
|
131
102
|
});
|
|
132
103
|
}
|
package/src/locus-info/index.ts
CHANGED
|
@@ -538,6 +538,15 @@ export default class LocusInfo extends EventsScope {
|
|
|
538
538
|
this.updateLinks(locus.links);
|
|
539
539
|
}
|
|
540
540
|
|
|
541
|
+
/**
|
|
542
|
+
* Whether we expect to receive updates over the LLM connection. This is used by hash tree parsers
|
|
543
|
+
* to decide whether to arm heartbeat watchdog timers for LLM data sets.
|
|
544
|
+
* @returns {boolean}
|
|
545
|
+
*/
|
|
546
|
+
private isLlmExpected(): boolean {
|
|
547
|
+
return this.parsedLocus.self?.joinedWith?.state === 'JOINED';
|
|
548
|
+
}
|
|
549
|
+
|
|
541
550
|
/**
|
|
542
551
|
* Creates a HashTreeParser instance for a given locusUrl and stores it in the map.
|
|
543
552
|
* @param {Object} params
|
|
@@ -568,6 +577,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
568
577
|
callbacks: {
|
|
569
578
|
locusInfoUpdateCallback: this.updateFromHashTree.bind(this, locusUrl),
|
|
570
579
|
syncLatencyTracker: this.callbacks.syncLatencyTracker,
|
|
580
|
+
isLlmExpected: () => this.isLlmExpected(),
|
|
571
581
|
// Reuse webex-core's tracking-id interceptor sequence (exposed publicly via
|
|
572
582
|
// webexTrackingIdSequenceNumbers) so Locus requests share the client's unified
|
|
573
583
|
// ${sessionId}_${sequence} tracking id space instead of minting an unrelated id. Fall
|
|
@@ -2713,6 +2723,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
2713
2723
|
*/
|
|
2714
2724
|
updateSelf(self: any) {
|
|
2715
2725
|
if (self) {
|
|
2726
|
+
const wasLlmExpected = this.isLlmExpected();
|
|
2716
2727
|
// @ts-ignore
|
|
2717
2728
|
const parsedSelves = SelfUtils.getSelves(
|
|
2718
2729
|
this.parsedLocus.self,
|
|
@@ -2992,6 +3003,15 @@ export default class LocusInfo extends EventsScope {
|
|
|
2992
3003
|
this.parsedLocus.self = parsedSelves.current;
|
|
2993
3004
|
// @ts-ignore
|
|
2994
3005
|
this.self = self;
|
|
3006
|
+
|
|
3007
|
+
// If LLM just became expected (self reported JOINED), some hash tree parsers may have skipped
|
|
3008
|
+
// arming heartbeat watchdog timers for LLM data sets whose messages arrived before this
|
|
3009
|
+
// update. Re-evaluate them now so those watchdogs get armed.
|
|
3010
|
+
if (!wasLlmExpected && this.isLlmExpected()) {
|
|
3011
|
+
this.hashTreeParsers.forEach((entry) => {
|
|
3012
|
+
entry.parser.reevaluateLlmWatchdogs();
|
|
3013
|
+
});
|
|
3014
|
+
}
|
|
2995
3015
|
} else {
|
|
2996
3016
|
this.compareAndUpdateFlags.compareHostAndSelf = false;
|
|
2997
3017
|
}
|