@webex/plugin-meetings 3.12.0 → 3.13.0-next.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.
Files changed (354) hide show
  1. package/.sdd/manifest.json +1312 -0
  2. package/.sdd/templates/.source.json +30 -0
  3. package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
  4. package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
  5. package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
  6. package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
  7. package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
  8. package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
  9. package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
  10. package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
  11. package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
  12. package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
  13. package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
  14. package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
  15. package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
  16. package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
  17. package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
  18. package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
  19. package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
  20. package/.sdd/templates/component-repo/template-map.json +112 -0
  21. package/AGENTS.md +135 -0
  22. package/ai-docs/ARCHITECTURE.md +208 -0
  23. package/ai-docs/CONTRACTS.md +267 -0
  24. package/ai-docs/DATA_MODEL.md +64 -0
  25. package/ai-docs/GETTING_STARTED.md +73 -0
  26. package/ai-docs/GLOSSARY.md +56 -0
  27. package/ai-docs/REVIEW_CHECKLIST.md +45 -0
  28. package/ai-docs/RULES.md +79 -0
  29. package/ai-docs/SECURITY.md +74 -0
  30. package/ai-docs/SERVICE_STATE.md +59 -0
  31. package/ai-docs/SPEC_INDEX.md +85 -0
  32. package/ai-docs/TEST_INDEX.md +45 -0
  33. package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
  34. package/ai-docs/patterns/defensive-error-propagation.md +55 -0
  35. package/ai-docs/patterns/event-scope-emission.md +46 -0
  36. package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
  37. package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
  38. package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
  39. package/assets/README.md +28 -0
  40. package/assets/e2ee-0.0.1.js +2 -0
  41. package/assets/e2ee-0.0.1.wasm +0 -0
  42. package/babel.config.js +17 -1
  43. package/dist/aiEnableRequest/index.js +15 -2
  44. package/dist/aiEnableRequest/index.js.map +1 -1
  45. package/dist/annotation/index.js +55 -19
  46. package/dist/annotation/index.js.map +1 -1
  47. package/dist/assets/e2ee-0.0.1.js +2 -0
  48. package/dist/assets/e2ee-0.0.1.wasm +0 -0
  49. package/dist/breakouts/breakout.js +8 -3
  50. package/dist/breakouts/breakout.js.map +1 -1
  51. package/dist/breakouts/events.js +29 -14
  52. package/dist/breakouts/events.js.map +1 -1
  53. package/dist/breakouts/index.js +128 -7
  54. package/dist/breakouts/index.js.map +1 -1
  55. package/dist/common/errors/webex-errors.js +54 -5
  56. package/dist/common/errors/webex-errors.js.map +1 -1
  57. package/dist/common/wasm-loader.js +174 -0
  58. package/dist/common/wasm-loader.js.map +1 -0
  59. package/dist/config.js +5 -2
  60. package/dist/config.js.map +1 -1
  61. package/dist/constants.js +39 -11
  62. package/dist/constants.js.map +1 -1
  63. package/dist/controls-options-manager/constants.js +11 -1
  64. package/dist/controls-options-manager/constants.js.map +1 -1
  65. package/dist/controls-options-manager/index.js +67 -29
  66. package/dist/controls-options-manager/index.js.map +1 -1
  67. package/dist/controls-options-manager/util.js +91 -0
  68. package/dist/controls-options-manager/util.js.map +1 -1
  69. package/dist/e2ee/E2eeManager.js +91 -0
  70. package/dist/e2ee/E2eeManager.js.map +1 -0
  71. package/dist/e2ee/E2eeSignaling.js +200 -0
  72. package/dist/e2ee/E2eeSignaling.js.map +1 -0
  73. package/dist/e2ee/MediaEncryptionService.js +75 -0
  74. package/dist/e2ee/MediaEncryptionService.js.map +1 -0
  75. package/dist/e2ee/mls.js +558 -0
  76. package/dist/e2ee/mls.js.map +1 -0
  77. package/dist/e2ee/types.js +59 -0
  78. package/dist/e2ee/types.js.map +1 -0
  79. package/dist/e2ee/wasm.d.js +7 -0
  80. package/dist/e2ee/wasm.d.js.map +1 -0
  81. package/dist/hashTree/constants.js +13 -1
  82. package/dist/hashTree/constants.js.map +1 -1
  83. package/dist/hashTree/hashTreeParser.js +1245 -404
  84. package/dist/hashTree/hashTreeParser.js.map +1 -1
  85. package/dist/hashTree/utils.js +42 -0
  86. package/dist/hashTree/utils.js.map +1 -1
  87. package/dist/index.js +8 -0
  88. package/dist/index.js.map +1 -1
  89. package/dist/interceptors/dataChannelAuthToken.js +58 -16
  90. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  91. package/dist/interceptors/locusRetry.js +24 -9
  92. package/dist/interceptors/locusRetry.js.map +1 -1
  93. package/dist/interpretation/index.js +55 -12
  94. package/dist/interpretation/index.js.map +1 -1
  95. package/dist/interpretation/interpretation.types.js +7 -0
  96. package/dist/interpretation/interpretation.types.js.map +1 -0
  97. package/dist/interpretation/siLanguage.js +1 -1
  98. package/dist/locus-info/controlsUtils.js +4 -1
  99. package/dist/locus-info/controlsUtils.js.map +1 -1
  100. package/dist/locus-info/index.js +914 -196
  101. package/dist/locus-info/index.js.map +1 -1
  102. package/dist/locus-info/infoUtils.js +36 -5
  103. package/dist/locus-info/infoUtils.js.map +1 -1
  104. package/dist/locus-info/types.js +20 -0
  105. package/dist/locus-info/types.js.map +1 -1
  106. package/dist/media/MediaConnectionAwaiter.js +229 -166
  107. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  108. package/dist/media/index.js +8 -2
  109. package/dist/media/index.js.map +1 -1
  110. package/dist/media/properties.js +4 -5
  111. package/dist/media/properties.js.map +1 -1
  112. package/dist/meeting/in-meeting-actions.js +5 -1
  113. package/dist/meeting/in-meeting-actions.js.map +1 -1
  114. package/dist/meeting/index.js +1931 -887
  115. package/dist/meeting/index.js.map +1 -1
  116. package/dist/meeting/locusMediaRequest.js +229 -82
  117. package/dist/meeting/locusMediaRequest.js.map +1 -1
  118. package/dist/meeting/muteState.js +10 -1
  119. package/dist/meeting/muteState.js.map +1 -1
  120. package/dist/meeting/request.js +5 -2
  121. package/dist/meeting/request.js.map +1 -1
  122. package/dist/meeting/util.js +42 -3
  123. package/dist/meeting/util.js.map +1 -1
  124. package/dist/meeting/voicea-meeting.js +2 -1
  125. package/dist/meeting/voicea-meeting.js.map +1 -1
  126. package/dist/meeting-info/meeting-info-v2.js +12 -5
  127. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  128. package/dist/meetings/index.js +342 -129
  129. package/dist/meetings/index.js.map +1 -1
  130. package/dist/meetings/meetings.types.js +6 -1
  131. package/dist/meetings/meetings.types.js.map +1 -1
  132. package/dist/meetings/request.js +39 -0
  133. package/dist/meetings/request.js.map +1 -1
  134. package/dist/meetings/util.js +116 -18
  135. package/dist/meetings/util.js.map +1 -1
  136. package/dist/member/index.js +10 -0
  137. package/dist/member/index.js.map +1 -1
  138. package/dist/member/types.js.map +1 -1
  139. package/dist/member/util.js +30 -0
  140. package/dist/member/util.js.map +1 -1
  141. package/dist/members/index.js +101 -43
  142. package/dist/members/index.js.map +1 -1
  143. package/dist/members/util.js +8 -1
  144. package/dist/members/util.js.map +1 -1
  145. package/dist/metrics/constants.js +11 -1
  146. package/dist/metrics/constants.js.map +1 -1
  147. package/dist/multistream/codec/constants.js +63 -0
  148. package/dist/multistream/codec/constants.js.map +1 -0
  149. package/dist/multistream/mediaRequestManager.js +62 -15
  150. package/dist/multistream/mediaRequestManager.js.map +1 -1
  151. package/dist/multistream/receiveSlot.js +9 -0
  152. package/dist/multistream/receiveSlot.js.map +1 -1
  153. package/dist/multistream/remoteMediaManager.js +32 -4
  154. package/dist/multistream/remoteMediaManager.js.map +1 -1
  155. package/dist/multistream/sendSlotManager.js +127 -3
  156. package/dist/multistream/sendSlotManager.js.map +1 -1
  157. package/dist/reachability/clusterReachability.js.map +1 -1
  158. package/dist/reachability/index.js +121 -83
  159. package/dist/reachability/index.js.map +1 -1
  160. package/dist/reachability/reachability.types.js +2 -0
  161. package/dist/reachability/reachability.types.js.map +1 -1
  162. package/dist/reachability/util.js +45 -0
  163. package/dist/reachability/util.js.map +1 -1
  164. package/dist/reactions/reactions.type.js.map +1 -1
  165. package/dist/recording-controller/index.js +1 -3
  166. package/dist/recording-controller/index.js.map +1 -1
  167. package/dist/roap/turnDiscovery.js +8 -1
  168. package/dist/roap/turnDiscovery.js.map +1 -1
  169. package/dist/types/annotation/index.d.ts +19 -0
  170. package/dist/types/common/errors/webex-errors.d.ts +36 -2
  171. package/dist/types/common/wasm-loader.d.ts +55 -0
  172. package/dist/types/config.d.ts +5 -2
  173. package/dist/types/constants.d.ts +15 -2
  174. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  175. package/dist/types/controls-options-manager/index.d.ts +16 -0
  176. package/dist/types/e2ee/E2eeManager.d.ts +23 -0
  177. package/dist/types/e2ee/E2eeSignaling.d.ts +94 -0
  178. package/dist/types/e2ee/MediaEncryptionService.d.ts +27 -0
  179. package/dist/types/e2ee/mls.d.ts +191 -0
  180. package/dist/types/e2ee/types.d.ts +104 -0
  181. package/dist/types/hashTree/constants.d.ts +2 -0
  182. package/dist/types/hashTree/hashTreeParser.d.ts +230 -18
  183. package/dist/types/hashTree/utils.d.ts +18 -0
  184. package/dist/types/index.d.ts +4 -0
  185. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  186. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  187. package/dist/types/locus-info/index.d.ts +151 -15
  188. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  189. package/dist/types/locus-info/types.d.ts +28 -1
  190. package/dist/types/media/MediaConnectionAwaiter.d.ts +66 -49
  191. package/dist/types/media/properties.d.ts +6 -2
  192. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  193. package/dist/types/meeting/index.d.ts +247 -13
  194. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  195. package/dist/types/meeting/request.d.ts +1 -0
  196. package/dist/types/meeting/util.d.ts +12 -1
  197. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  198. package/dist/types/meetings/index.d.ts +44 -19
  199. package/dist/types/meetings/meetings.types.d.ts +15 -0
  200. package/dist/types/meetings/request.d.ts +14 -0
  201. package/dist/types/member/index.d.ts +1 -0
  202. package/dist/types/member/types.d.ts +1 -0
  203. package/dist/types/member/util.d.ts +9 -0
  204. package/dist/types/members/index.d.ts +15 -2
  205. package/dist/types/members/util.d.ts +1 -5
  206. package/dist/types/metrics/constants.d.ts +10 -0
  207. package/dist/types/multistream/codec/constants.d.ts +7 -0
  208. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  209. package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
  210. package/dist/types/multistream/sendSlotManager.d.ts +28 -2
  211. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  212. package/dist/types/reachability/index.d.ts +10 -3
  213. package/dist/types/reachability/reachability.types.d.ts +7 -0
  214. package/dist/types/reachability/util.d.ts +17 -0
  215. package/dist/types/reactions/reactions.type.d.ts +3 -0
  216. package/dist/webinar/index.js +539 -245
  217. package/dist/webinar/index.js.map +1 -1
  218. package/package.json +26 -24
  219. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  220. package/src/aiEnableRequest/index.ts +16 -0
  221. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  222. package/src/annotation/index.ts +61 -29
  223. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  224. package/src/breakouts/breakout.ts +3 -1
  225. package/src/breakouts/events.ts +33 -11
  226. package/src/breakouts/index.ts +145 -3
  227. package/src/common/errors/webex-errors.ts +56 -3
  228. package/src/common/wasm-loader.ts +124 -0
  229. package/src/config.ts +9 -3
  230. package/src/constants.ts +23 -4
  231. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  232. package/src/controls-options-manager/constants.ts +14 -1
  233. package/src/controls-options-manager/index.ts +87 -28
  234. package/src/controls-options-manager/util.ts +81 -1
  235. package/src/e2ee/E2eeManager.ts +58 -0
  236. package/src/e2ee/E2eeSignaling.ts +215 -0
  237. package/src/e2ee/MediaEncryptionService.ts +41 -0
  238. package/src/e2ee/mls.ts +548 -0
  239. package/src/e2ee/types.ts +114 -0
  240. package/src/e2ee/wasm.d.ts +153 -0
  241. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  242. package/src/hashTree/constants.ts +16 -0
  243. package/src/hashTree/hashTreeParser.ts +1021 -214
  244. package/src/hashTree/utils.ts +36 -0
  245. package/src/index.ts +7 -0
  246. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  247. package/src/interceptors/dataChannelAuthToken.ts +59 -12
  248. package/src/interceptors/locusRetry.ts +26 -5
  249. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  250. package/src/interpretation/index.ts +65 -10
  251. package/src/interpretation/interpretation.types.ts +11 -0
  252. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  253. package/src/locus-info/controlsUtils.ts +3 -1
  254. package/src/locus-info/index.ts +907 -184
  255. package/src/locus-info/infoUtils.ts +41 -6
  256. package/src/locus-info/types.ts +33 -1
  257. package/src/media/MediaConnectionAwaiter.ts +229 -196
  258. package/src/media/ai-docs/media-spec.md +267 -0
  259. package/src/media/index.ts +10 -1
  260. package/src/media/properties.ts +8 -3
  261. package/src/meeting/ai-docs/meeting-spec.md +404 -0
  262. package/src/meeting/in-meeting-actions.ts +8 -0
  263. package/src/meeting/index.ts +1237 -254
  264. package/src/meeting/locusMediaRequest.ts +106 -6
  265. package/src/meeting/muteState.ts +10 -1
  266. package/src/meeting/request.ts +11 -0
  267. package/src/meeting/util.ts +53 -8
  268. package/src/meeting/voicea-meeting.ts +1 -1
  269. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  270. package/src/meeting-info/meeting-info-v2.ts +11 -4
  271. package/src/meetings/ai-docs/meetings-spec.md +298 -0
  272. package/src/meetings/index.ts +242 -80
  273. package/src/meetings/meetings.types.ts +19 -0
  274. package/src/meetings/request.ts +43 -0
  275. package/src/meetings/util.ts +117 -4
  276. package/src/member/ai-docs/member-spec.md +196 -0
  277. package/src/member/index.ts +10 -0
  278. package/src/member/types.ts +1 -0
  279. package/src/member/util.ts +29 -0
  280. package/src/members/ai-docs/members-spec.md +256 -0
  281. package/src/members/index.ts +70 -7
  282. package/src/members/util.ts +12 -4
  283. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  284. package/src/metrics/constants.ts +11 -0
  285. package/src/multistream/ai-docs/multistream-spec.md +295 -0
  286. package/src/multistream/codec/constants.ts +58 -0
  287. package/src/multistream/mediaRequestManager.ts +119 -28
  288. package/src/multistream/receiveSlot.ts +18 -0
  289. package/src/multistream/remoteMediaManager.ts +23 -1
  290. package/src/multistream/sendSlotManager.ts +112 -4
  291. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  292. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  293. package/src/reachability/clusterReachability.ts +3 -2
  294. package/src/reachability/index.ts +47 -16
  295. package/src/reachability/reachability.types.ts +11 -0
  296. package/src/reachability/util.ts +36 -0
  297. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  298. package/src/reactions/reactions.type.ts +3 -0
  299. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  300. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  301. package/src/recording-controller/index.ts +1 -2
  302. package/src/roap/ai-docs/roap-spec.md +241 -0
  303. package/src/roap/turnDiscovery.ts +9 -1
  304. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  305. package/src/webinar/index.ts +333 -73
  306. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  307. package/test/unit/spec/annotation/index.ts +214 -182
  308. package/test/unit/spec/breakouts/breakout.ts +9 -3
  309. package/test/unit/spec/breakouts/events.ts +120 -2
  310. package/test/unit/spec/breakouts/index.ts +336 -15
  311. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  312. package/test/unit/spec/common/wasm-loader.ts +171 -0
  313. package/test/unit/spec/controls-options-manager/index.js +244 -29
  314. package/test/unit/spec/controls-options-manager/util.js +165 -0
  315. package/test/unit/spec/e2ee/E2eeManager.ts +82 -0
  316. package/test/unit/spec/e2ee/E2eeSignaling.ts +172 -0
  317. package/test/unit/spec/e2ee/MediaEncryptionService.ts +43 -0
  318. package/test/unit/spec/e2ee/mls.ts +765 -0
  319. package/test/unit/spec/hashTree/hashTreeParser.ts +3126 -238
  320. package/test/unit/spec/hashTree/utils.ts +125 -1
  321. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +179 -1
  322. package/test/unit/spec/interceptors/locusRetry.ts +234 -5
  323. package/test/unit/spec/interpretation/index.ts +119 -4
  324. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  325. package/test/unit/spec/locus-info/index.js +1880 -136
  326. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  327. package/test/unit/spec/media/MediaConnectionAwaiter.ts +479 -17
  328. package/test/unit/spec/media/index.ts +92 -0
  329. package/test/unit/spec/media/properties.ts +26 -26
  330. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  331. package/test/unit/spec/meeting/index.js +3697 -501
  332. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  333. package/test/unit/spec/meeting/muteState.js +81 -0
  334. package/test/unit/spec/meeting/request.js +12 -0
  335. package/test/unit/spec/meeting/utils.js +206 -16
  336. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  337. package/test/unit/spec/meeting-info/index.js +2 -3
  338. package/test/unit/spec/meeting-info/meetinginfov2.js +88 -11
  339. package/test/unit/spec/meetings/index.js +606 -53
  340. package/test/unit/spec/meetings/request.js +141 -0
  341. package/test/unit/spec/meetings/utils.js +402 -51
  342. package/test/unit/spec/member/index.js +7 -0
  343. package/test/unit/spec/member/util.js +89 -0
  344. package/test/unit/spec/members/index.js +216 -0
  345. package/test/unit/spec/members/request.js +37 -1
  346. package/test/unit/spec/members/utils.js +63 -0
  347. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  348. package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
  349. package/test/unit/spec/multistream/sendSlotManager.ts +165 -38
  350. package/test/unit/spec/reachability/index.ts +128 -46
  351. package/test/unit/spec/reachability/util.ts +31 -0
  352. package/test/unit/spec/recording-controller/index.js +9 -8
  353. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  354. package/test/unit/spec/webinar/index.ts +982 -328
@@ -0,0 +1,191 @@
1
+ /*!
2
+ * Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+ import type { E2eeKey, E2eeRosterMember, E2eeSignalingSource, IMlsHttpClient, MLSConfig, SframeParams } from './types';
5
+ import type { ModuleInstance } from './wasm';
6
+ /** Payloads for each event emitted by {@link MLS}. */
7
+ export interface MLSEventMap {
8
+ joinSuccess: {
9
+ epoch: number;
10
+ securityCode: string;
11
+ sframe: SframeParams;
12
+ key: E2eeKey;
13
+ };
14
+ joinFailure: {
15
+ reason: string;
16
+ };
17
+ mediaEncryptionRequestFailure: {
18
+ errorCode: number;
19
+ message: string;
20
+ };
21
+ newKey: E2eeKey;
22
+ useKey: {
23
+ epoch: number;
24
+ };
25
+ purgeKeys: {
26
+ epoch: number;
27
+ };
28
+ rosterAdded: E2eeRosterMember[];
29
+ rosterRemoved: {
30
+ urls: string[];
31
+ };
32
+ leaderChanged: {
33
+ isLeader: boolean;
34
+ };
35
+ evicted: void;
36
+ versionNegotiated: {
37
+ version: number;
38
+ };
39
+ securityCodeChanged: {
40
+ code: string;
41
+ };
42
+ }
43
+ export type MLSEvent = keyof MLSEventMap;
44
+ /**
45
+ * Pure MLS protocol engine wrapping the WebE2EE WASM module. It has no webex/HTTP/LLM
46
+ * dependencies: all I/O flows through the injected {@link IMlsHttpClient}, and all outputs are
47
+ * emitted as typed events. This keeps it unit-testable in isolation.
48
+ */
49
+ export default class MLS {
50
+ private readonly loadModule;
51
+ private readonly httpClient;
52
+ private readonly emitter;
53
+ private readonly transactions;
54
+ private e2ee;
55
+ private lastSecurityCode;
56
+ /**
57
+ * @param {Object} deps
58
+ * @param {IMlsHttpClient} deps.httpClient - Transport for the engine's protocol requests.
59
+ * @param {Function} deps.loadModule - Loads the WASM module instance; supplied by the integration layer.
60
+ */
61
+ constructor({ httpClient, loadModule, }: {
62
+ httpClient: IMlsHttpClient;
63
+ loadModule: () => Promise<ModuleInstance>;
64
+ });
65
+ /**
66
+ * Subscribe to an engine event.
67
+ * @param {MLSEvent} event
68
+ * @param {Function} listener
69
+ * @returns {void}
70
+ */
71
+ on<K extends MLSEvent>(event: K, listener: (payload: MLSEventMap[K]) => void): void;
72
+ /**
73
+ * Unsubscribe from an engine event.
74
+ * @param {MLSEvent} event
75
+ * @param {Function} listener
76
+ * @returns {void}
77
+ */
78
+ off<K extends MLSEvent>(event: K, listener: (payload: MLSEventMap[K]) => void): void;
79
+ /**
80
+ * @param {MLSEvent} event
81
+ * @param {*} [payload]
82
+ * @returns {void}
83
+ */
84
+ private emitEvent;
85
+ /**
86
+ * Loads the WASM module, instantiates the engine, wires its callbacks, and applies credentials,
87
+ * trust anchors and timeouts. Must be called before {@link join}.
88
+ * @param {MLSConfig} config
89
+ * @returns {Promise<void>}
90
+ */
91
+ initialize(config: MLSConfig): Promise<void>;
92
+ /**
93
+ * @returns {void}
94
+ */
95
+ private setupCallbacks;
96
+ /**
97
+ * Sends an engine HTTP request through the injected {@link IMlsHttpClient}, converting between
98
+ * the engine's JSON bytes and the client's objects. Conversion failures reject so the engine's
99
+ * request is completed as failed.
100
+ * @param {string} url - The absolute request URL provided by the engine.
101
+ * @param {Uint8Array} body - JSON request payload as bytes (owned copy, not a WASM memory view).
102
+ * @returns {Promise<Uint8Array>} JSON response payload as bytes.
103
+ */
104
+ private sendHttpRequest;
105
+ /**
106
+ * @param {string} url - Request URL, used only for logging.
107
+ * @param {Uint8Array} body - JSON request payload as bytes.
108
+ * @returns {unknown} the parsed request body.
109
+ * @throws {Error} when the bytes are not valid JSON.
110
+ */
111
+ private static decodeRequestBody;
112
+ /**
113
+ * @param {string} url - Request URL, used only for logging.
114
+ * @param {unknown} response - Response object from the HTTP client.
115
+ * @returns {Uint8Array} the response serialized as JSON bytes.
116
+ * @throws {Error} when the response cannot be serialized to JSON.
117
+ */
118
+ private static encodeResponseBody;
119
+ /**
120
+ * Hands a media-encryption service request outcome back to the engine. libe2ee throws
121
+ * `e2ee_negotiation_failure` out of this call when it can't recover from the service's error code
122
+ * or fails to process a successful response; this surfaces in JS as an opaque value with no
123
+ * message. That is unrecoverable for the in-flight operation, so it is reported as
124
+ * `mediaEncryptionRequestFailure` instead of escaping as an unhandled rejection.
125
+ * @param {number} handlerId
126
+ * @param {boolean} success
127
+ * @param {Uint8Array} body
128
+ * @param {number} errorCode - Media-encryption service error code, or 0 when not applicable.
129
+ * @param {string} message
130
+ * @returns {void}
131
+ */
132
+ private completeHttpRequest;
133
+ /**
134
+ * @param {*} error - Rejection from the HTTP client.
135
+ * @returns {number} the media-encryption service error code from the response body, or 0.
136
+ */
137
+ private static getMesErrorCode;
138
+ /**
139
+ * @returns {void}
140
+ */
141
+ private emitSecurityCodeIfChanged;
142
+ /**
143
+ * Starts the MLS join.
144
+ * @returns {void}
145
+ */
146
+ join(): void;
147
+ /**
148
+ * Leaves the MLS group.
149
+ * @returns {void}
150
+ */
151
+ leave(): void;
152
+ /**
153
+ * Forwards an incoming MLS protocol event (from the signaling channel) to the engine.
154
+ * @param {Uint8Array} eventData
155
+ * @param {E2eeSignalingSource} source - Which channel the event arrived on, logged for diagnostics.
156
+ * @returns {void}
157
+ */
158
+ handleEvent(eventData: Uint8Array, source: E2eeSignalingSource): void;
159
+ /**
160
+ * Tells the engine whether the signaling channel was already connected before join.
161
+ * @param {boolean} connected
162
+ * @returns {void}
163
+ */
164
+ setLlmConnectedBeforeJoin(connected: boolean): void;
165
+ /**
166
+ * Notifies the engine that the signaling channel is now connected.
167
+ * @returns {void}
168
+ */
169
+ llmConnected(): void;
170
+ /**
171
+ * @returns {string} the current security code, or '' if not initialized.
172
+ */
173
+ getSecurityCode(): string;
174
+ /**
175
+ * @returns {E2eeRosterMember[]} the current MLS roster, or [] if not initialized.
176
+ */
177
+ getRoster(): E2eeRosterMember[];
178
+ /**
179
+ * @returns {boolean} whether this client is the group leader.
180
+ */
181
+ isLeader(): boolean;
182
+ /**
183
+ * @returns {WebE2EEInstance}
184
+ */
185
+ private assertInitialized;
186
+ /**
187
+ * @param {RosterMember} member - raw WASM roster member.
188
+ * @returns {E2eeRosterMember}
189
+ */
190
+ private static toRosterMember;
191
+ }
@@ -0,0 +1,104 @@
1
+ /*!
2
+ * Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+ /**
5
+ * SDK-facing shapes used by the isolated MLS protocol engine. Integration-specific meeting,
6
+ * identity-plugin and signaling types are added by the later adapter phases.
7
+ */
8
+ /** Credential-validation outcome from the MLS roster. Keep ordinals in sync with libe2ee. */
9
+ export declare const E2eeValidationResult: {
10
+ readonly Success: 0;
11
+ readonly PartialSuccess: 1;
12
+ readonly Failure: 2;
13
+ readonly ParseError: 3;
14
+ readonly UnknownIssuer: 4;
15
+ readonly UnknownPublicKey: 5;
16
+ readonly InvalidSignature: 6;
17
+ readonly Expired: 7;
18
+ readonly Inactive: 8;
19
+ readonly Revoked: 9;
20
+ readonly UnsupportedCaType: 10;
21
+ readonly InvalidKeypackageSignature: 11;
22
+ readonly UnsupportedCredentialType: 12;
23
+ readonly MissingDisplayNameExtension: 13;
24
+ };
25
+ export type E2eeValidationResult = (typeof E2eeValidationResult)[keyof typeof E2eeValidationResult];
26
+ /** Identity type attached to the leaf certificate. Keep ordinals in sync with libe2ee. */
27
+ export declare const E2eeIdentityType: {
28
+ readonly WebexAnonymousIdentity: 0;
29
+ readonly WebexMachineIdentity: 1;
30
+ readonly WebexUserIdentity: 2;
31
+ readonly ExternalVerifiedIdentity: 3;
32
+ };
33
+ export type E2eeIdentityType = (typeof E2eeIdentityType)[keyof typeof E2eeIdentityType];
34
+ /** A media-encryption (SFrame) key for an MLS epoch. */
35
+ export interface E2eeKey {
36
+ epoch: number;
37
+ baseKey: Uint8Array;
38
+ index: number;
39
+ indexBits: number;
40
+ canEncrypt: boolean;
41
+ }
42
+ /** SFrame parameters negotiated for an MLS group. */
43
+ export interface SframeParams {
44
+ cipherSuite: number;
45
+ epochBits: number;
46
+ }
47
+ /** Parsed certificate information returned with a roster member. */
48
+ export interface E2eeCertificateInfo {
49
+ primaryName: string;
50
+ commonName: string;
51
+ organizationName: string;
52
+ emailAddresses: string[];
53
+ domainNames: string[];
54
+ notBefore: number;
55
+ notAfter: number;
56
+ signatureAlgorithm: string;
57
+ publicKeyAlgorithm: string;
58
+ identityType?: E2eeIdentityType;
59
+ der: Uint8Array;
60
+ }
61
+ export interface E2eeIdentityResult {
62
+ result: E2eeValidationResult;
63
+ certificateChain: E2eeCertificateInfo[];
64
+ failedCertIndex?: number;
65
+ }
66
+ /** A member of the MLS roster and its credential-validation result. */
67
+ export interface E2eeRosterMember {
68
+ url: string;
69
+ displayName: string;
70
+ deviceType: string;
71
+ validationResult: E2eeValidationResult;
72
+ identityResults?: E2eeIdentityResult[];
73
+ }
74
+ /** Credentials and trust anchors consumed by the WASM engine. */
75
+ export interface MLSConfig {
76
+ participantId: string;
77
+ deviceUrl: string;
78
+ deviceType?: string;
79
+ correlationId: string;
80
+ displayName: string;
81
+ serviceUrl: string;
82
+ credentials?: {
83
+ privateKey: Uint8Array;
84
+ certChain: Uint8Array[];
85
+ };
86
+ trustAnchors?: {
87
+ webexCaRoots?: string;
88
+ domainNameRoots?: string;
89
+ userIdentityRoots?: string;
90
+ domainNameRootsP7b?: Uint8Array;
91
+ };
92
+ joinTimeout?: number;
93
+ coalesceWindow?: number;
94
+ }
95
+ /**
96
+ * HTTP transport the MLS engine uses for its protocol requests. Implemented by
97
+ * MediaEncryptionService (which routes to webex.request); injected so the engine stays pure.
98
+ * Bodies are plain JS objects: MLS converts the engine's JSON bytes to/from objects at its boundary.
99
+ */
100
+ export interface IMlsHttpClient {
101
+ request(url: string, body: unknown): Promise<unknown>;
102
+ }
103
+ /** Signaling transport that delivered an MLS protocol message. */
104
+ export type E2eeSignalingSource = 'llm' | 'mercury';
@@ -7,3 +7,5 @@ export declare const DataSetNames: {
7
7
  SELF: string;
8
8
  UNJOINED: string;
9
9
  };
10
+ export declare const DATA_SET_INIT_PRIORITY: string[];
11
+ export declare const LLM_DATASET_NAMES: string[];
@@ -1,7 +1,13 @@
1
+ import type { LocusSyncLatencyEventName } from '@webex/internal-plugin-metrics';
1
2
  import HashTree from './hashTree';
2
3
  import { Enum } from '../constants';
3
4
  import { HtMeta, HashTreeObject } from './types';
4
5
  import { LocusDTO } from '../locus-info/types';
6
+ export declare enum SyncAllBackoffType {
7
+ NONE = "none",
8
+ ONLY_LLM = "onlyLLM",
9
+ ALL = "all"
10
+ }
5
11
  export interface DataSet {
6
12
  url: string;
7
13
  root: string;
@@ -13,9 +19,11 @@ export interface DataSet {
13
19
  maxMs: number;
14
20
  exponent: number;
15
21
  };
22
+ heartbeatIntervalMs?: number;
16
23
  }
17
24
  export interface RootHashMessage {
18
25
  dataSets: Array<DataSet>;
26
+ heartbeatIntervalMs?: number;
19
27
  }
20
28
  export interface HashTreeMessage {
21
29
  dataSets: Array<DataSet>;
@@ -38,22 +46,63 @@ interface InternalDataSet extends DataSet {
38
46
  hashTree?: HashTree;
39
47
  timer?: ReturnType<typeof setTimeout>;
40
48
  heartbeatWatchdogTimer?: ReturnType<typeof setTimeout>;
49
+ syncAbortController?: AbortController;
41
50
  }
42
51
  type WebexRequestMethod = (options: Record<string, any>) => Promise<any>;
52
+ type GenerateTrackingId = () => string | undefined;
43
53
  export declare const LocusInfoUpdateType: {
44
54
  readonly OBJECTS_UPDATED: "OBJECTS_UPDATED";
45
55
  readonly MEETING_ENDED: "MEETING_ENDED";
56
+ readonly LOCUS_NOT_FOUND: "LOCUS_NOT_FOUND";
46
57
  };
47
58
  export type LocusInfoUpdateType = Enum<typeof LocusInfoUpdateType>;
48
- export type LocusInfoUpdateCallback = (updateType: LocusInfoUpdateType, data?: {
49
- updatedObjects: HashTreeObject[];
50
- }) => void;
59
+ interface LocusUpdatePayloads {
60
+ [LocusInfoUpdateType.OBJECTS_UPDATED]: {
61
+ updatedObjects: HashTreeObject[];
62
+ };
63
+ [LocusInfoUpdateType.MEETING_ENDED]: unknown;
64
+ [LocusInfoUpdateType.LOCUS_NOT_FOUND]: unknown;
65
+ }
66
+ export type LocusInfoUpdate = {
67
+ [K in keyof LocusUpdatePayloads]: {
68
+ updateType: K;
69
+ } & LocusUpdatePayloads[K];
70
+ }[keyof LocusUpdatePayloads];
71
+ export type LocusInfoUpdateCallback = (update: LocusInfoUpdate) => void;
72
+ export type SyncLatencyTracker = {
73
+ saveLatency: (key: 'internal.client.locus.sync.random.backoff', value: number, options: {
74
+ meetingId: string;
75
+ dataSetName: string;
76
+ }) => void;
77
+ saveTimestamp: (options: {
78
+ key: LocusSyncLatencyEventName;
79
+ options: {
80
+ meetingId: string;
81
+ dataSetName: string;
82
+ trackingId?: string;
83
+ };
84
+ }) => void;
85
+ clearLocusSyncLatency: (dataSetName: string, meetingId: string, trackingId?: string) => void;
86
+ };
87
+ export type HashTreeParserCallbacks = {
88
+ locusInfoUpdateCallback: LocusInfoUpdateCallback;
89
+ syncLatencyTracker?: SyncLatencyTracker;
90
+ generateTrackingId?: GenerateTrackingId;
91
+ isLlmExpected: () => boolean;
92
+ };
51
93
  /**
52
94
  * This error is thrown if we receive information that the meeting has ended while we're processing some hash messages.
53
95
  * It's handled internally by HashTreeParser and results in MEETING_ENDED being sent up.
54
96
  */
55
97
  export declare class MeetingEndedError extends Error {
56
98
  }
99
+ /**
100
+ * This error is thrown when a 404 is received from Locus hash tree endpoints, indicating that the locus URL
101
+ * is no longer valid (e.g. participant moved to a breakout room, or meeting ended).
102
+ * It's handled internally by HashTreeParser and results in LOCUS_NOT_FOUND being sent up.
103
+ */
104
+ export declare class LocusNotFoundError extends Error {
105
+ }
57
106
  /**
58
107
  * Parses hash tree eventing locus data
59
108
  */
@@ -61,11 +110,19 @@ declare class HashTreeParser {
61
110
  dataSets: Record<string, InternalDataSet>;
62
111
  visibleDataSetsUrl: string;
63
112
  webexRequest: WebexRequestMethod;
64
- locusInfoUpdateCallback: LocusInfoUpdateCallback;
113
+ private callbacks;
114
+ private syncLatencyMeetingId;
65
115
  visibleDataSets: VisibleDataSetInfo[];
66
116
  debugId: string;
67
- heartbeatIntervalMs?: number;
68
117
  private excludedDataSets;
118
+ state: 'active' | 'stopped';
119
+ private syncQueue;
120
+ private isSyncInProgress;
121
+ private syncAllBackoffType;
122
+ private dataSetsSyncedDuringBackoff;
123
+ private syncQueueProcessingPromise;
124
+ private topLevelHeartbeatIntervalMs?;
125
+ private pendingLlmWatchdogDataSetNames;
69
126
  /**
70
127
  * Constructor for HashTreeParser
71
128
  * @param {Object} options
@@ -78,10 +135,20 @@ declare class HashTreeParser {
78
135
  };
79
136
  metadata: Metadata | null;
80
137
  webexRequest: WebexRequestMethod;
81
- locusInfoUpdateCallback: LocusInfoUpdateCallback;
138
+ callbacks: HashTreeParserCallbacks;
82
139
  debugId: string;
83
140
  excludedDataSets?: string[];
141
+ syncLatencyMeetingId: string;
84
142
  });
143
+ /**
144
+ * Sets the visible data sets list for the HashTreeParser. This method should be called only at the start, to initialize
145
+ * the visible data sets, before any message processsing, so for example from the constructor or when resuming the parser.
146
+ *
147
+ * @param {Array<VisibleDataSetInfo>} visibleDataSets - The visible data sets to set
148
+ * @param {Array<DataSet>} dataSets - The "dataSets" list from Locus (yes, Locus sends visibleDataSets and dataSets as separate lists and they can differ)
149
+ * @returns {void}
150
+ */
151
+ private setVisibleDataSets;
85
152
  /**
86
153
  * Checks if the given data set name is in the list of visible data sets
87
154
  * @param {string} dataSetName data set name to check
@@ -110,14 +177,6 @@ declare class HashTreeParser {
110
177
  * @returns {Promise}
111
178
  */
112
179
  private initializeNewVisibleDataSet;
113
- /**
114
- * Sends a special sync request to Locus with all leaves empty - this is a way to get all the data for a given dataset.
115
- *
116
- * @param {string} datasetName - name of the dataset for which to send the request
117
- * @param {string} debugText - text to include in logs
118
- * @returns {Promise}
119
- */
120
- private sendInitializationSyncRequestToLocus;
121
180
  /**
122
181
  * Queries Locus for all up-to-date information about all visible data sets
123
182
  *
@@ -183,6 +242,13 @@ declare class HashTreeParser {
183
242
  * @returns {void}
184
243
  */
185
244
  private handleRootHashHeartBeatMessage;
245
+ /**
246
+ * Handles known errors that can happen during syncs
247
+ *
248
+ * @param {any} error - The error to handle
249
+ * @returns {boolean} true if the error was recognized and handled, false otherwise
250
+ */
251
+ private handleSyncErrors;
186
252
  /**
187
253
  * Asynchronously initializes new visible data sets
188
254
  *
@@ -218,6 +284,14 @@ declare class HashTreeParser {
218
284
  * @returns {void}
219
285
  */
220
286
  private updateDataSetInfo;
287
+ /**
288
+ * Updates the leaf count for a data set, resizing its hash tree accordingly.
289
+ *
290
+ * @param {InternalDataSet} dataSet - The data set to update
291
+ * @param {number} newLeafCount - The new leaf count
292
+ * @returns {void}
293
+ */
294
+ private updateDataSetLeafCount;
221
295
  /**
222
296
  * Checks for changes in the visible data sets based on the updated objects.
223
297
  * @param {HashTreeObject[]} updatedObjects - The list of updated hash tree objects.
@@ -270,6 +344,15 @@ declare class HashTreeParser {
270
344
  * @returns {void}
271
345
  */
272
346
  handleMessage(message: HashTreeMessage, debugText?: string): void;
347
+ /**
348
+ * Checks if Locus sync latency metrics should be collected for a dataset.
349
+ *
350
+ * @param {string} dataSetName dataset name
351
+ * @param {boolean} [isInitialization=false] whether this is an initialization sync
352
+ * @returns {boolean}
353
+ */
354
+ private shouldCollectSyncMetrics;
355
+ private saveSyncBackoffLatency;
273
356
  /**
274
357
  * Calls the updateInfo callback if there are any updates to report
275
358
  *
@@ -284,15 +367,103 @@ declare class HashTreeParser {
284
367
  * @returns {number} - A weighted backoff time based on the provided configuration, using algorithm supplied by Locus team
285
368
  */
286
369
  private getWeightedBackoffTime;
370
+ /**
371
+ * Returns a copy of a hash tree message restricted to a single dataset, keeping only the
372
+ * requested dataset and the elements belonging to it. Used to strip out datasets that Locus
373
+ * may include in a sync response but that we didn't request (e.g. "unjoined" sharing elements
374
+ * with "main"), which would otherwise be applied once per dataset.
375
+ *
376
+ * @param {HashTreeMessage} message the sync response message
377
+ * @param {string} dataSetName the dataset that was requested
378
+ * @returns {HashTreeMessage} a new message containing only the requested dataset
379
+ */
380
+ private filterMessageToDataSet;
287
381
  /**
288
382
  * Performs a sync for the given data set.
289
383
  *
290
384
  * @param {InternalDataSet} dataSet - The data set to sync
291
- * @param {string} rootHash - Our current root hash for this data set
292
385
  * @param {string} reason - The reason for the sync (used for logging)
386
+ * @param {boolean} [isInitialization] - Whether this is an initialization sync (sends empty leaves data instead of comparing hashes)
293
387
  * @returns {Promise<void>}
294
388
  */
295
389
  private performSync;
390
+ /**
391
+ * Cancels any pending or in-flight syncs for the specified data sets.
392
+ * This removes matching entries from the sync queue and aborts any in-flight sync HTTP requests.
393
+ *
394
+ * @param {string[]} dataSetNames - The names of the data sets to cancel syncs for
395
+ * @returns {void}
396
+ */
397
+ private cancelPendingSyncsForDataSets;
398
+ /**
399
+ * If a syncAllDatasets backoff sleep is in progress, marks the given data sets to be skipped
400
+ * after the sleep completes.
401
+ *
402
+ * @param {string[]} dataSetNames - The names of the data sets to mark
403
+ * @returns {void}
404
+ */
405
+ private markDataSetsForSyncAllBackoffSkip;
406
+ /**
407
+ * Aborts any in-flight sync HTTP requests for the specified data sets.
408
+ *
409
+ * @param {string[]} dataSetNames - The names of the data sets whose syncs should be aborted
410
+ * @returns {void}
411
+ */
412
+ private abortInFlightSyncs;
413
+ /**
414
+ * Enqueues a sync for the given data set. If the data set is already in the queue, the request is ignored.
415
+ * This ensures that all syncs are executed sequentially and no more than 1 sync runs at a time.
416
+ *
417
+ * @param {string} dataSetName - The name of the data set to sync
418
+ * @param {string} reason - The reason for the sync (used for logging)
419
+ * @param {boolean} [isInitialization=false] - Whether this is an initialization sync (uses empty leaves data instead of hash comparison)
420
+ * @returns {void}
421
+ */
422
+ private enqueueSyncForDataset;
423
+ /**
424
+ * Processes the sync queue sequentially. Only one instance of this method runs at a time.
425
+ *
426
+ * @returns {Promise<void>}
427
+ */
428
+ private processSyncQueue;
429
+ /**
430
+ * sets the backoff type for syncAllDatasets calls, which determines the scope of datasets that will be synced after the backoff delay.
431
+ *
432
+ * @param {boolean} onlyLLM - Whether the backoff is for a syncAllDatasets call that is syncing only LLM datasets
433
+ * @returns {void}
434
+ */
435
+ private setSyncAllBackoffType;
436
+ /**
437
+ * Checks if a syncAll backoff is already in progress. If so, upgrades the scope from
438
+ * onlyLLM to all datasets when the new call has a broader scope.
439
+ *
440
+ * @param {boolean} onlyLLM - Whether the current call is for LLM datasets only
441
+ * @returns {boolean} true if a backoff is already pending (caller should return early)
442
+ */
443
+ private tryUpgradePendingBackoff;
444
+ /**
445
+ * Syncs all data sets that have hash trees, one by one in sequence, using the priority order
446
+ * provided by sortByInitPriority().
447
+ *
448
+ * If a call is already waiting in the backoff delay phase, a new call with a broader scope
449
+ * (onlyLLM=false) will upgrade the pending scope, and the dataset list will be computed after
450
+ * the backoff using the upgraded scope. After the backoff, the sync queue handles deduplication
451
+ * so no guard is needed.
452
+ *
453
+ * @param {Object} [options={}] - Options for syncing
454
+ * @param {boolean} [options.onlyLLM=false] - Whether to sync only LLM based data sets
455
+ * @returns {Promise<void>}
456
+ */
457
+ syncAllDatasets(options?: {
458
+ onlyLLM?: boolean;
459
+ }): Promise<void>;
460
+ /**
461
+ * Returns the list of data sets that have hash trees, sorted by the priority order provided by sortByInitPriority().
462
+ *
463
+ * @param {boolean} onlyLLM - Whether to include only LLM based data sets
464
+ * @returns {Array<{name: string, backoff: {maxMs: number, exponent: number}}>} The sorted list of data sets with their backoff configurations
465
+ */
466
+ private getSortedDataSetsWithHashTrees;
296
467
  /**
297
468
  * Runs the sync algorithm for the given data set.
298
469
  *
@@ -310,25 +481,66 @@ declare class HashTreeParser {
310
481
  * @returns {void}
311
482
  */
312
483
  private resetHeartbeatWatchdogs;
484
+ /**
485
+ * Re-evaluates heartbeat watchdog timers for LLM data sets. While LLM is not expected,
486
+ * resetHeartbeatWatchdogs skips setting watchdog timers for LLM data sets and records them in
487
+ * pendingLlmWatchdogDataSetNames. This must be called when LLM transitions to expected (e.g. self
488
+ * reports JOINED) to arm the watchdogs for those pending data sets (avoids a timing issue where
489
+ * the "main"/"atd-active"/"atd-unmuted" data set arrives before the self update). The pending set
490
+ * is consumed and cleared here.
491
+ * @returns {void}
492
+ */
493
+ reevaluateLlmWatchdogs(): void;
313
494
  /**
314
495
  * Stops all timers for the data sets to prevent any further sync attempts.
315
496
  * @returns {void}
316
497
  */
317
498
  private stopAllTimers;
499
+ /**
500
+ * Stops the HashTreeParser, preventing it from processing any further messages and clearing all timers.
501
+ * It also clears all the hash trees, so if the parser is resumed later, it will need to do a sync
502
+ * to be up-to-date.
503
+ * @returns {void}
504
+ */
505
+ stop(): void;
506
+ /**
507
+ * Cleans up the HashTreeParser, stopping all timers and clearing all internal state.
508
+ * After calling this, the parser should not be used anymore.
509
+ * @returns {void}
510
+ */
511
+ cleanUp(): void;
512
+ /**
513
+ * Resumes the HashTreeParser that was previously stopped, using a hash tree message.
514
+ * @param {HashTreeMessage} message - The message to resume with, it must contain metadata with visible data sets info
515
+ * @returns {void}
516
+ */
517
+ resumeFromMessage(message: HashTreeMessage): void;
518
+ /**
519
+ * Resumes the HashTreeParser that was previously stopped, using a Locus API response.
520
+ * Unlike resumeFromMessage(), this does not require metadata/dataSets in the input,
521
+ * as it fetches all necessary information from Locus via initializeFromGetLociResponse.
522
+ * @param {LocusDTO} locus - locus object from an API response
523
+ * @returns {Promise}
524
+ */
525
+ resumeFromApiResponse(locus: LocusDTO): Promise<void>;
318
526
  private checkForSentinelHttpResponse;
319
527
  /**
320
528
  * Gets the current hashes from the locus for a specific data set.
321
529
  * @param {string} dataSetName
322
530
  * @param {string} currentRootHash
323
- * @returns {string[]}
531
+ * @param {Object} [trackingIds] tracking ids for the /hashtree request
532
+ * @param {string} [trackingIds.requestTrackingId] tracking id forced onto the /hashtree HTTP request header (kept distinct from the /sync request's tracking id)
533
+ * @param {string} [trackingIds.metricTrackingId] tracking id (the /sync request's) under which the hashtree latency milestones are recorded, so they belong to the same sync latency record
534
+ * @returns {Object|null} An object containing the hashes and leaf count, or null if the hashes match and no sync is needed
324
535
  */
325
536
  private getHashesFromLocus;
326
537
  /**
327
538
  * Sends a sync request to Locus for the specified data set.
328
539
  *
329
540
  * @param {InternalDataSet} dataSet The data set to sync.
330
- * @param {Record<number, LeafDataItem[]>} mismatchedLeavesData The mismatched leaves data to include in the sync request.
331
- * @returns {Promise<HashTreeMessage|null>}
541
+ * @param {Object} options Either `{ isInitialization: true }` for init syncs (uses leafCount=1 with empty leaf data) or `{ mismatchedLeavesData }` for normal syncs.
542
+ * @param {string} [trackingId] tracking id
543
+ * @returns {Promise<HashTreeMessage | null>}
332
544
  */
333
545
  private sendSyncRequestToLocus;
334
546
  }
@@ -20,3 +20,21 @@ export declare function isMetadata(object: HashTreeObject): boolean;
20
20
  * @returns {void}
21
21
  */
22
22
  export declare const deleteNestedObjectsWithHtMeta: (currentLocusPart: any, parent?: any, currentKey?: string | number) => void;
23
+ /**
24
+ * Reorders items so that those matching the given priority list come first (in priority order),
25
+ * followed by everything else in their original order.
26
+ *
27
+ * @param {Array<T>} items - The items to reorder
28
+ * @param {string[]} priority - Ordered list of names that should come first
29
+ * @returns {Array<T>} A new array with prioritized items first
30
+ */
31
+ export declare function sortByInitPriority<T extends {
32
+ name: string;
33
+ }>(items: T[], priority: string[]): T[];
34
+ /**
35
+ * Sleeps for the specified amount of milliseconds
36
+ *
37
+ * @param {number} ms amount of milliseconds to sleep
38
+ * @returns {Promise<void>} A promise that resolves after the specified delay
39
+ */
40
+ export declare function sleep(ms: number): Promise<void>;