prismcast 1.12.0 → 1.13.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 (631) hide show
  1. package/dist/app.d.ts +41 -1
  2. package/dist/app.js +164 -76
  3. package/dist/app.js.map +1 -1
  4. package/dist/browser/blockedPage.d.ts +0 -1
  5. package/dist/browser/browserSupervisor.d.ts +34 -5
  6. package/dist/browser/browserSupervisor.js +39 -12
  7. package/dist/browser/browserSupervisor.js.map +1 -1
  8. package/dist/browser/cdp.d.ts +58 -6
  9. package/dist/browser/cdp.js +147 -9
  10. package/dist/browser/cdp.js.map +1 -1
  11. package/dist/browser/channelSelection.d.ts +18 -6
  12. package/dist/browser/channelSelection.js +47 -36
  13. package/dist/browser/channelSelection.js.map +1 -1
  14. package/dist/browser/consent.d.ts +33 -4
  15. package/dist/browser/consent.js +87 -50
  16. package/dist/browser/consent.js.map +1 -1
  17. package/dist/browser/display.d.ts +0 -1
  18. package/dist/browser/hlsPlaylistObserver.d.ts +3 -2
  19. package/dist/browser/hlsPlaylistObserver.js +11 -6
  20. package/dist/browser/hlsPlaylistObserver.js.map +1 -1
  21. package/dist/browser/index.d.ts +273 -59
  22. package/dist/browser/index.js +768 -255
  23. package/dist/browser/index.js.map +1 -1
  24. package/dist/browser/launchGovernor.d.ts +0 -1
  25. package/dist/browser/login.d.ts +11 -10
  26. package/dist/browser/login.js +42 -33
  27. package/dist/browser/login.js.map +1 -1
  28. package/dist/browser/manifestInterceptor.d.ts +14 -5
  29. package/dist/browser/manifestInterceptor.js +26 -13
  30. package/dist/browser/manifestInterceptor.js.map +1 -1
  31. package/dist/browser/navigation.d.ts +28 -0
  32. package/dist/browser/navigation.js +57 -0
  33. package/dist/browser/navigation.js.map +1 -0
  34. package/dist/browser/pageStaleness.d.ts +1 -2
  35. package/dist/browser/pageStaleness.js +9 -9
  36. package/dist/browser/pageStaleness.js.map +1 -1
  37. package/dist/browser/precaching.d.ts +27 -13
  38. package/dist/browser/precaching.js +219 -73
  39. package/dist/browser/precaching.js.map +1 -1
  40. package/dist/browser/tabCapture.d.ts +97 -0
  41. package/dist/browser/tabCapture.js +314 -0
  42. package/dist/browser/tabCapture.js.map +1 -0
  43. package/dist/browser/tabNetworkObserver.d.ts +0 -1
  44. package/dist/browser/tabSelection.d.ts +117 -0
  45. package/dist/browser/tabSelection.js +547 -0
  46. package/dist/browser/tabSelection.js.map +1 -0
  47. package/dist/browser/tuning/cache.d.ts +0 -1
  48. package/dist/browser/tuning/comcastPolymer.d.ts +0 -1
  49. package/dist/browser/tuning/comcastPolymer.js +18 -19
  50. package/dist/browser/tuning/comcastPolymer.js.map +1 -1
  51. package/dist/browser/tuning/cox.d.ts +0 -1
  52. package/dist/browser/tuning/directv.d.ts +0 -1
  53. package/dist/browser/tuning/directv.js +12 -13
  54. package/dist/browser/tuning/directv.js.map +1 -1
  55. package/dist/browser/tuning/fox.d.ts +0 -1
  56. package/dist/browser/tuning/fox.js +2 -2
  57. package/dist/browser/tuning/fox.js.map +1 -1
  58. package/dist/browser/tuning/gridSearch.d.ts +0 -1
  59. package/dist/browser/tuning/hbo.d.ts +0 -1
  60. package/dist/browser/tuning/hbo.js +2 -2
  61. package/dist/browser/tuning/hbo.js.map +1 -1
  62. package/dist/browser/tuning/hulu.d.ts +14 -2
  63. package/dist/browser/tuning/hulu.js +150 -24
  64. package/dist/browser/tuning/hulu.js.map +1 -1
  65. package/dist/browser/tuning/shared.d.ts +1 -2
  66. package/dist/browser/tuning/shared.js +1 -1
  67. package/dist/browser/tuning/sling.d.ts +0 -1
  68. package/dist/browser/tuning/sling.js +17 -22
  69. package/dist/browser/tuning/sling.js.map +1 -1
  70. package/dist/browser/tuning/spectrum.d.ts +0 -1
  71. package/dist/browser/tuning/thumbnailRow.d.ts +0 -1
  72. package/dist/browser/tuning/tileClick.d.ts +0 -1
  73. package/dist/browser/tuning/xfinity.d.ts +0 -1
  74. package/dist/browser/tuning/youtubeTv.d.ts +0 -1
  75. package/dist/browser/tuning/youtubeTv.js +1 -2
  76. package/dist/browser/tuning/youtubeTv.js.map +1 -1
  77. package/dist/browser/video.d.ts +55 -33
  78. package/dist/browser/video.js +213 -169
  79. package/dist/browser/video.js.map +1 -1
  80. package/dist/browser/windowSync.d.ts +45 -0
  81. package/dist/browser/windowSync.js +153 -0
  82. package/dist/browser/windowSync.js.map +1 -0
  83. package/dist/channels/index.d.ts +7 -1
  84. package/dist/channels/index.js +24 -8
  85. package/dist/channels/index.js.map +1 -1
  86. package/dist/config/channelForm.d.ts +0 -1
  87. package/dist/config/channelIdentity.d.ts +27 -0
  88. package/dist/config/channelIdentity.js +72 -0
  89. package/dist/config/channelIdentity.js.map +1 -0
  90. package/dist/config/channelSort.d.ts +25 -0
  91. package/dist/config/channelSort.js +101 -0
  92. package/dist/config/channelSort.js.map +1 -0
  93. package/dist/config/consistencyProbe.d.ts +0 -1
  94. package/dist/config/consistencyProbe.js +1 -1
  95. package/dist/config/consistencyProbe.js.map +1 -1
  96. package/dist/config/health.d.ts +3 -2
  97. package/dist/config/health.js +41 -31
  98. package/dist/config/health.js.map +1 -1
  99. package/dist/config/index.d.ts +12 -1
  100. package/dist/config/index.js +77 -31
  101. package/dist/config/index.js.map +1 -1
  102. package/dist/config/paths.d.ts +17 -2
  103. package/dist/config/paths.js +21 -1
  104. package/dist/config/paths.js.map +1 -1
  105. package/dist/config/persistence.context.d.ts +0 -1
  106. package/dist/config/persistence.d.ts +8 -4
  107. package/dist/config/persistence.js +143 -82
  108. package/dist/config/persistence.js.map +1 -1
  109. package/dist/config/presets.d.ts +0 -1
  110. package/dist/config/profiles.d.ts +9 -4
  111. package/dist/config/profiles.js +39 -6
  112. package/dist/config/profiles.js.map +1 -1
  113. package/dist/config/providerLineups.d.ts +0 -1
  114. package/dist/config/providerLineups.js +0 -3
  115. package/dist/config/providerLineups.js.map +1 -1
  116. package/dist/config/reactivity.d.ts +0 -1
  117. package/dist/config/servicePacks.d.ts +0 -1
  118. package/dist/config/services.d.ts +1 -47
  119. package/dist/config/services.js +4 -135
  120. package/dist/config/services.js.map +1 -1
  121. package/dist/config/sites.d.ts +0 -9
  122. package/dist/config/sites.js +82 -98
  123. package/dist/config/sites.js.map +1 -1
  124. package/dist/config/userChannels.d.ts +22 -29
  125. package/dist/config/userChannels.js +47 -65
  126. package/dist/config/userChannels.js.map +1 -1
  127. package/dist/config/userConfig.d.ts +19 -4
  128. package/dist/config/userConfig.js +123 -25
  129. package/dist/config/userConfig.js.map +1 -1
  130. package/dist/config/userProfiles.d.ts +2 -3
  131. package/dist/config/userProfiles.js +16 -13
  132. package/dist/config/userProfiles.js.map +1 -1
  133. package/dist/hdhr/channelMap.d.ts +0 -1
  134. package/dist/hdhr/deviceId.d.ts +0 -1
  135. package/dist/hdhr/discover.d.ts +0 -1
  136. package/dist/hdhr/getHandlers.d.ts +0 -1
  137. package/dist/hdhr/identity.d.ts +0 -1
  138. package/dist/hdhr/index.d.ts +0 -1
  139. package/dist/hdhr/protocol.d.ts +1 -2
  140. package/dist/hdhr/protocol.js +1 -1
  141. package/dist/hdhr/tunerState.d.ts +0 -1
  142. package/dist/hdhr/udp.d.ts +0 -1
  143. package/dist/hdhr/udp.js +16 -4
  144. package/dist/hdhr/udp.js.map +1 -1
  145. package/dist/identity.d.ts +0 -1
  146. package/dist/index.d.ts +0 -1
  147. package/dist/index.js +10 -3
  148. package/dist/index.js.map +1 -1
  149. package/dist/native/codecInference.d.ts +5 -4
  150. package/dist/native/codecInference.js +12 -7
  151. package/dist/native/codecInference.js.map +1 -1
  152. package/dist/native/decrypt.d.ts +10 -3
  153. package/dist/native/decrypt.js +9 -5
  154. package/dist/native/decrypt.js.map +1 -1
  155. package/dist/native/index.d.ts +26 -24
  156. package/dist/native/index.js +26 -20
  157. package/dist/native/index.js.map +1 -1
  158. package/dist/native/probe.d.ts +7 -10
  159. package/dist/native/probe.js +41 -37
  160. package/dist/native/probe.js.map +1 -1
  161. package/dist/native/proxy.d.ts +3 -4
  162. package/dist/native/proxy.js +91 -69
  163. package/dist/native/proxy.js.map +1 -1
  164. package/dist/native/tokenExpiry.d.ts +0 -1
  165. package/dist/routes/assets.d.ts +0 -1
  166. package/dist/routes/auth.d.ts +0 -1
  167. package/dist/routes/auth.js +1 -1
  168. package/dist/routes/auth.js.map +1 -1
  169. package/dist/routes/cdp.d.ts +11 -5
  170. package/dist/routes/cdp.js +91 -63
  171. package/dist/routes/cdp.js.map +1 -1
  172. package/dist/routes/channels.d.ts +0 -1
  173. package/dist/routes/clientActions.d.ts +0 -1
  174. package/dist/routes/components.d.ts +0 -1
  175. package/dist/routes/config/channels/endpoints/browse.d.ts +0 -1
  176. package/dist/routes/config/channels/endpoints/bulk.d.ts +0 -1
  177. package/dist/routes/config/channels/endpoints/bulk.js +3 -3
  178. package/dist/routes/config/channels/endpoints/bulk.js.map +1 -1
  179. package/dist/routes/config/channels/endpoints/crud.d.ts +0 -1
  180. package/dist/routes/config/channels/endpoints/crud.js +4 -3
  181. package/dist/routes/config/channels/endpoints/crud.js.map +1 -1
  182. package/dist/routes/config/channels/endpoints/importExport.d.ts +0 -1
  183. package/dist/routes/config/channels/endpoints/importExport.js +7 -3
  184. package/dist/routes/config/channels/endpoints/importExport.js.map +1 -1
  185. package/dist/routes/config/channels/endpoints/predefined.d.ts +0 -1
  186. package/dist/routes/config/channels/endpoints/prefs.d.ts +0 -1
  187. package/dist/routes/config/channels/endpoints/prefs.js +1 -1
  188. package/dist/routes/config/channels/endpoints/prefs.js.map +1 -1
  189. package/dist/routes/config/channels/endpoints/service.d.ts +0 -1
  190. package/dist/routes/config/channels/endpoints/service.js +8 -5
  191. package/dist/routes/config/channels/endpoints/service.js.map +1 -1
  192. package/dist/routes/config/channels/endpoints/tags.d.ts +0 -1
  193. package/dist/routes/config/channels/endpoints/tags.js +3 -3
  194. package/dist/routes/config/channels/endpoints/tags.js.map +1 -1
  195. package/dist/routes/config/channels/healthBridge.d.ts +4 -1
  196. package/dist/routes/config/channels/healthBridge.js +9 -5
  197. package/dist/routes/config/channels/healthBridge.js.map +1 -1
  198. package/dist/routes/config/channels/http/handler.d.ts +0 -1
  199. package/dist/routes/config/channels/http/playlistHint.d.ts +0 -1
  200. package/dist/routes/config/channels/http/serviceWarning.d.ts +0 -1
  201. package/dist/routes/config/channels/http/serviceWarning.js +1 -1
  202. package/dist/routes/config/channels/http/serviceWarning.js.map +1 -1
  203. package/dist/routes/config/channels/index.d.ts +0 -1
  204. package/dist/routes/config/channels/setup.d.ts +0 -1
  205. package/dist/routes/config/channels/table.d.ts +0 -1
  206. package/dist/routes/config/channels/table.js +66 -134
  207. package/dist/routes/config/channels/table.js.map +1 -1
  208. package/dist/routes/config/http/envelope.d.ts +1 -2
  209. package/dist/routes/config/index.d.ts +5 -5
  210. package/dist/routes/config/index.js +7 -5
  211. package/dist/routes/config/index.js.map +1 -1
  212. package/dist/routes/config/services.d.ts +0 -1
  213. package/dist/routes/config/services.js +17 -19
  214. package/dist/routes/config/services.js.map +1 -1
  215. package/dist/routes/config/settings.d.ts +6 -15
  216. package/dist/routes/config/settings.js +16 -35
  217. package/dist/routes/config/settings.js.map +1 -1
  218. package/dist/routes/debug.d.ts +0 -1
  219. package/dist/routes/debug.js +1 -1
  220. package/dist/routes/debug.js.map +1 -1
  221. package/dist/routes/health.d.ts +16 -8
  222. package/dist/routes/health.js +27 -12
  223. package/dist/routes/health.js.map +1 -1
  224. package/dist/routes/hls.d.ts +0 -1
  225. package/dist/routes/icons.d.ts +0 -1
  226. package/dist/routes/index.d.ts +0 -1
  227. package/dist/routes/logs.d.ts +3 -2
  228. package/dist/routes/logs.js +54 -14
  229. package/dist/routes/logs.js.map +1 -1
  230. package/dist/routes/mpegts.d.ts +0 -1
  231. package/dist/routes/play.d.ts +0 -1
  232. package/dist/routes/playlist.d.ts +0 -1
  233. package/dist/routes/playlist.js +2 -1
  234. package/dist/routes/playlist.js.map +1 -1
  235. package/dist/routes/root/content.d.ts +0 -1
  236. package/dist/routes/root/content.js +32 -11
  237. package/dist/routes/root/content.js.map +1 -1
  238. package/dist/routes/root/index.d.ts +10 -1
  239. package/dist/routes/root/index.js +17 -7
  240. package/dist/routes/root/index.js.map +1 -1
  241. package/dist/routes/root/scripts/channels.d.ts +0 -1
  242. package/dist/routes/root/scripts/channels.js +10 -20
  243. package/dist/routes/root/scripts/channels.js.map +1 -1
  244. package/dist/routes/root/scripts/clientEscape.d.ts +0 -1
  245. package/dist/routes/root/scripts/clientEscape.js +1 -1
  246. package/dist/routes/root/scripts/clientUrl.d.ts +0 -1
  247. package/dist/routes/root/scripts/config.d.ts +0 -1
  248. package/dist/routes/root/scripts/config.js +8 -29
  249. package/dist/routes/root/scripts/config.js.map +1 -1
  250. package/dist/routes/root/scripts/index.d.ts +0 -1
  251. package/dist/routes/root/scripts/shared.d.ts +0 -1
  252. package/dist/routes/root/scripts/shared.js +16 -13
  253. package/dist/routes/root/scripts/shared.js.map +1 -1
  254. package/dist/routes/root/scripts/status.d.ts +0 -1
  255. package/dist/routes/root/scripts/status.handlers.d.ts +3 -1
  256. package/dist/routes/root/scripts/status.handlers.js +52 -26
  257. package/dist/routes/root/scripts/status.handlers.js.map +1 -1
  258. package/dist/routes/root/styles.d.ts +0 -1
  259. package/dist/routes/root/styles.js +10 -18
  260. package/dist/routes/root/styles.js.map +1 -1
  261. package/dist/routes/services.d.ts +0 -1
  262. package/dist/routes/services.js +1 -1
  263. package/dist/routes/services.js.map +1 -1
  264. package/dist/routes/sse.d.ts +3 -2
  265. package/dist/routes/sse.js +7 -3
  266. package/dist/routes/sse.js.map +1 -1
  267. package/dist/routes/streams.d.ts +4 -2
  268. package/dist/routes/streams.js +8 -5
  269. package/dist/routes/streams.js.map +1 -1
  270. package/dist/routes/theme.d.ts +0 -1
  271. package/dist/routes/theme.js +3 -3
  272. package/dist/routes/theme.js.map +1 -1
  273. package/dist/routes/ui.d.ts +0 -1
  274. package/dist/routes/ui.js +5 -5
  275. package/dist/routes/ui.js.map +1 -1
  276. package/dist/routes/upgrade.d.ts +0 -1
  277. package/dist/routes/upgrade.js +2 -1
  278. package/dist/routes/upgrade.js.map +1 -1
  279. package/dist/service/commands.context.d.ts +0 -1
  280. package/dist/service/commands.context.js +7 -1
  281. package/dist/service/commands.context.js.map +1 -1
  282. package/dist/service/commands.d.ts +0 -1
  283. package/dist/service/generators.context.d.ts +0 -1
  284. package/dist/service/generators.d.ts +0 -1
  285. package/dist/service/index.d.ts +0 -1
  286. package/dist/streaming/captureLock.d.ts +1 -2
  287. package/dist/streaming/captureLock.js +8 -7
  288. package/dist/streaming/captureLock.js.map +1 -1
  289. package/dist/streaming/captureSession.d.ts +0 -1
  290. package/dist/streaming/clients.d.ts +4 -3
  291. package/dist/streaming/clients.js +5 -4
  292. package/dist/streaming/clients.js.map +1 -1
  293. package/dist/streaming/codec.d.ts +0 -1
  294. package/dist/streaming/fmp4Segmenter.d.ts +11 -6
  295. package/dist/streaming/fmp4Segmenter.js +39 -17
  296. package/dist/streaming/fmp4Segmenter.js.map +1 -1
  297. package/dist/streaming/hls.d.ts +96 -3
  298. package/dist/streaming/hls.js +282 -171
  299. package/dist/streaming/hls.js.map +1 -1
  300. package/dist/streaming/hlsResume.d.ts +8 -5
  301. package/dist/streaming/hlsResume.js +10 -8
  302. package/dist/streaming/hlsResume.js.map +1 -1
  303. package/dist/streaming/hlsSegments.d.ts +11 -8
  304. package/dist/streaming/hlsSegments.js +38 -18
  305. package/dist/streaming/hlsSegments.js.map +1 -1
  306. package/dist/streaming/lifecycle.d.ts +5 -4
  307. package/dist/streaming/lifecycle.js +43 -13
  308. package/dist/streaming/lifecycle.js.map +1 -1
  309. package/dist/streaming/monitor.d.ts +14 -3
  310. package/dist/streaming/monitor.js +447 -234
  311. package/dist/streaming/monitor.js.map +1 -1
  312. package/dist/streaming/mp4Parser.d.ts +0 -1
  313. package/dist/streaming/mpegts.d.ts +11 -1
  314. package/dist/streaming/mpegts.js +92 -28
  315. package/dist/streaming/mpegts.js.map +1 -1
  316. package/dist/streaming/playlistBuilder.d.ts +0 -1
  317. package/dist/streaming/preroll.d.ts +34 -15
  318. package/dist/streaming/preroll.js +32 -30
  319. package/dist/streaming/preroll.js.map +1 -1
  320. package/dist/streaming/pretune.d.ts +2 -3
  321. package/dist/streaming/pretune.js +45 -45
  322. package/dist/streaming/pretune.js.map +1 -1
  323. package/dist/streaming/pretuneTimers.d.ts +16 -12
  324. package/dist/streaming/pretuneTimers.js +27 -37
  325. package/dist/streaming/pretuneTimers.js.map +1 -1
  326. package/dist/streaming/recovery.d.ts +97 -9
  327. package/dist/streaming/recovery.js +96 -18
  328. package/dist/streaming/recovery.js.map +1 -1
  329. package/dist/streaming/registry.d.ts +102 -15
  330. package/dist/streaming/registry.js +90 -5
  331. package/dist/streaming/registry.js.map +1 -1
  332. package/dist/streaming/setup.d.ts +90 -32
  333. package/dist/streaming/setup.js +379 -248
  334. package/dist/streaming/setup.js.map +1 -1
  335. package/dist/streaming/showInfo.d.ts +8 -4
  336. package/dist/streaming/showInfo.js +54 -45
  337. package/dist/streaming/showInfo.js.map +1 -1
  338. package/dist/streaming/statusEmitter.d.ts +5 -3
  339. package/dist/streaming/statusEmitter.js +20 -8
  340. package/dist/streaming/statusEmitter.js.map +1 -1
  341. package/dist/types/channels.d.ts +0 -1
  342. package/dist/types/channels.js +0 -4
  343. package/dist/types/channels.js.map +1 -1
  344. package/dist/types/config.d.ts +0 -1
  345. package/dist/types/index.d.ts +4 -4
  346. package/dist/types/index.js +2 -1
  347. package/dist/types/index.js.map +1 -1
  348. package/dist/types/profiles.d.ts +51 -9
  349. package/dist/types/profiles.js +35 -1
  350. package/dist/types/profiles.js.map +1 -1
  351. package/dist/types/selection.d.ts +10 -1
  352. package/dist/types/shared.d.ts +0 -1
  353. package/dist/types/streaming.d.ts +8 -1
  354. package/dist/types/streaming.js +7 -0
  355. package/dist/types/streaming.js.map +1 -1
  356. package/dist/upgrade/commands.context.d.ts +0 -1
  357. package/dist/upgrade/commands.d.ts +0 -1
  358. package/dist/upgrade/commands.js +1 -1
  359. package/dist/upgrade/commands.js.map +1 -1
  360. package/dist/upgrade/detection.context.d.ts +0 -1
  361. package/dist/upgrade/detection.d.ts +1 -2
  362. package/dist/upgrade/index.d.ts +0 -1
  363. package/dist/upgrade/lifecycle.context.d.ts +2 -1
  364. package/dist/upgrade/lifecycle.context.js +9 -4
  365. package/dist/upgrade/lifecycle.context.js.map +1 -1
  366. package/dist/upgrade/lifecycle.d.ts +0 -1
  367. package/dist/upgrade/pathHandle.d.ts +0 -1
  368. package/dist/utils/bootSession.context.d.ts +0 -1
  369. package/dist/utils/bootSession.context.js +3 -2
  370. package/dist/utils/bootSession.context.js.map +1 -1
  371. package/dist/utils/bootSession.d.ts +0 -1
  372. package/dist/utils/chromeFetch.d.ts +0 -1
  373. package/dist/utils/cliOutput.d.ts +0 -1
  374. package/dist/utils/debugFilter.d.ts +0 -1
  375. package/dist/utils/debugFilter.js +5 -3
  376. package/dist/utils/debugFilter.js.map +1 -1
  377. package/dist/utils/delay.d.ts +65 -13
  378. package/dist/utils/delay.js +96 -23
  379. package/dist/utils/delay.js.map +1 -1
  380. package/dist/utils/errors.d.ts +0 -11
  381. package/dist/utils/errors.js +3 -14
  382. package/dist/utils/errors.js.map +1 -1
  383. package/dist/utils/evaluate.d.ts +11 -3
  384. package/dist/utils/evaluate.js +4 -3
  385. package/dist/utils/evaluate.js.map +1 -1
  386. package/dist/utils/ffmpeg.context.d.ts +0 -1
  387. package/dist/utils/ffmpeg.d.ts +1 -1
  388. package/dist/utils/ffmpeg.js +2 -1
  389. package/dist/utils/ffmpeg.js.map +1 -1
  390. package/dist/utils/fileLogger.d.ts +26 -7
  391. package/dist/utils/fileLogger.js +241 -102
  392. package/dist/utils/fileLogger.js.map +1 -1
  393. package/dist/utils/format.d.ts +36 -4
  394. package/dist/utils/format.js +66 -12
  395. package/dist/utils/format.js.map +1 -1
  396. package/dist/utils/index.d.ts +1 -2
  397. package/dist/utils/index.js +1 -1
  398. package/dist/utils/index.js.map +1 -1
  399. package/dist/utils/logEmitter.d.ts +0 -1
  400. package/dist/utils/logger.d.ts +0 -1
  401. package/dist/utils/m3u.d.ts +0 -1
  402. package/dist/utils/markup.d.ts +0 -1
  403. package/dist/utils/memo.d.ts +0 -1
  404. package/dist/utils/morganStream.d.ts +2 -3
  405. package/dist/utils/morganStream.js +6 -8
  406. package/dist/utils/morganStream.js.map +1 -1
  407. package/dist/utils/network.d.ts +0 -1
  408. package/dist/utils/never.d.ts +8 -0
  409. package/dist/utils/never.js +20 -0
  410. package/dist/utils/never.js.map +1 -0
  411. package/dist/utils/pid.d.ts +0 -1
  412. package/dist/utils/platform.d.ts +0 -1
  413. package/dist/utils/processInspector.context.d.ts +32 -2
  414. package/dist/utils/processInspector.context.js +117 -1
  415. package/dist/utils/processInspector.context.js.map +1 -1
  416. package/dist/utils/processInspector.d.ts +0 -32
  417. package/dist/utils/processInspector.js +10 -117
  418. package/dist/utils/processInspector.js.map +1 -1
  419. package/dist/utils/retry.d.ts +5 -4
  420. package/dist/utils/retry.js +43 -33
  421. package/dist/utils/retry.js.map +1 -1
  422. package/dist/utils/runtimeIdentity.context.d.ts +0 -1
  423. package/dist/utils/runtimeIdentity.context.js +3 -1
  424. package/dist/utils/runtimeIdentity.context.js.map +1 -1
  425. package/dist/utils/runtimeIdentity.d.ts +1 -1
  426. package/dist/utils/runtimeIdentity.js +1 -1
  427. package/dist/utils/runtimeIdentity.js.map +1 -1
  428. package/dist/utils/sanitize.d.ts +8 -1
  429. package/dist/utils/sanitize.js +19 -0
  430. package/dist/utils/sanitize.js.map +1 -1
  431. package/dist/utils/streamContext.d.ts +0 -1
  432. package/dist/utils/timing.d.ts +3 -4
  433. package/dist/utils/timing.js +4 -4
  434. package/dist/utils/timing.js.map +1 -1
  435. package/dist/utils/version.d.ts +14 -8
  436. package/dist/utils/version.js +35 -24
  437. package/dist/utils/version.js.map +1 -1
  438. package/package.json +7 -7
  439. package/dist/app.d.ts.map +0 -1
  440. package/dist/browser/blockedPage.d.ts.map +0 -1
  441. package/dist/browser/browserSupervisor.d.ts.map +0 -1
  442. package/dist/browser/cdp.d.ts.map +0 -1
  443. package/dist/browser/channelSelection.d.ts.map +0 -1
  444. package/dist/browser/consent.d.ts.map +0 -1
  445. package/dist/browser/display.d.ts.map +0 -1
  446. package/dist/browser/hlsPlaylistObserver.d.ts.map +0 -1
  447. package/dist/browser/index.d.ts.map +0 -1
  448. package/dist/browser/launchGovernor.d.ts.map +0 -1
  449. package/dist/browser/login.d.ts.map +0 -1
  450. package/dist/browser/manifestInterceptor.d.ts.map +0 -1
  451. package/dist/browser/pageStaleness.d.ts.map +0 -1
  452. package/dist/browser/precaching.d.ts.map +0 -1
  453. package/dist/browser/tabNetworkObserver.d.ts.map +0 -1
  454. package/dist/browser/tuning/cache.d.ts.map +0 -1
  455. package/dist/browser/tuning/comcastPolymer.d.ts.map +0 -1
  456. package/dist/browser/tuning/cox.d.ts.map +0 -1
  457. package/dist/browser/tuning/directv.d.ts.map +0 -1
  458. package/dist/browser/tuning/fox.d.ts.map +0 -1
  459. package/dist/browser/tuning/gridSearch.d.ts.map +0 -1
  460. package/dist/browser/tuning/hbo.d.ts.map +0 -1
  461. package/dist/browser/tuning/hulu.d.ts.map +0 -1
  462. package/dist/browser/tuning/shared.d.ts.map +0 -1
  463. package/dist/browser/tuning/sling.d.ts.map +0 -1
  464. package/dist/browser/tuning/spectrum.d.ts.map +0 -1
  465. package/dist/browser/tuning/thumbnailRow.d.ts.map +0 -1
  466. package/dist/browser/tuning/tileClick.d.ts.map +0 -1
  467. package/dist/browser/tuning/xfinity.d.ts.map +0 -1
  468. package/dist/browser/tuning/youtubeTv.d.ts.map +0 -1
  469. package/dist/browser/video.d.ts.map +0 -1
  470. package/dist/channels/index.d.ts.map +0 -1
  471. package/dist/config/channelForm.d.ts.map +0 -1
  472. package/dist/config/consistencyProbe.d.ts.map +0 -1
  473. package/dist/config/health.d.ts.map +0 -1
  474. package/dist/config/index.d.ts.map +0 -1
  475. package/dist/config/paths.d.ts.map +0 -1
  476. package/dist/config/persistence.context.d.ts.map +0 -1
  477. package/dist/config/persistence.d.ts.map +0 -1
  478. package/dist/config/presets.d.ts.map +0 -1
  479. package/dist/config/profiles.d.ts.map +0 -1
  480. package/dist/config/providerLineups.d.ts.map +0 -1
  481. package/dist/config/reactivity.d.ts.map +0 -1
  482. package/dist/config/servicePacks.d.ts.map +0 -1
  483. package/dist/config/services.d.ts.map +0 -1
  484. package/dist/config/sites.d.ts.map +0 -1
  485. package/dist/config/userChannels.d.ts.map +0 -1
  486. package/dist/config/userConfig.d.ts.map +0 -1
  487. package/dist/config/userProfiles.d.ts.map +0 -1
  488. package/dist/hdhr/channelMap.d.ts.map +0 -1
  489. package/dist/hdhr/deviceId.d.ts.map +0 -1
  490. package/dist/hdhr/discover.d.ts.map +0 -1
  491. package/dist/hdhr/getHandlers.d.ts.map +0 -1
  492. package/dist/hdhr/identity.d.ts.map +0 -1
  493. package/dist/hdhr/index.d.ts.map +0 -1
  494. package/dist/hdhr/protocol.d.ts.map +0 -1
  495. package/dist/hdhr/tunerState.d.ts.map +0 -1
  496. package/dist/hdhr/udp.d.ts.map +0 -1
  497. package/dist/identity.d.ts.map +0 -1
  498. package/dist/index.d.ts.map +0 -1
  499. package/dist/native/codecInference.d.ts.map +0 -1
  500. package/dist/native/decrypt.d.ts.map +0 -1
  501. package/dist/native/index.d.ts.map +0 -1
  502. package/dist/native/probe.d.ts.map +0 -1
  503. package/dist/native/proxy.d.ts.map +0 -1
  504. package/dist/native/tokenExpiry.d.ts.map +0 -1
  505. package/dist/routes/assets.d.ts.map +0 -1
  506. package/dist/routes/auth.d.ts.map +0 -1
  507. package/dist/routes/cdp.d.ts.map +0 -1
  508. package/dist/routes/channels.d.ts.map +0 -1
  509. package/dist/routes/clientActions.d.ts.map +0 -1
  510. package/dist/routes/components.d.ts.map +0 -1
  511. package/dist/routes/config/channels/endpoints/browse.d.ts.map +0 -1
  512. package/dist/routes/config/channels/endpoints/bulk.d.ts.map +0 -1
  513. package/dist/routes/config/channels/endpoints/crud.d.ts.map +0 -1
  514. package/dist/routes/config/channels/endpoints/importExport.d.ts.map +0 -1
  515. package/dist/routes/config/channels/endpoints/predefined.d.ts.map +0 -1
  516. package/dist/routes/config/channels/endpoints/prefs.d.ts.map +0 -1
  517. package/dist/routes/config/channels/endpoints/service.d.ts.map +0 -1
  518. package/dist/routes/config/channels/endpoints/tags.d.ts.map +0 -1
  519. package/dist/routes/config/channels/healthBridge.d.ts.map +0 -1
  520. package/dist/routes/config/channels/http/handler.d.ts.map +0 -1
  521. package/dist/routes/config/channels/http/playlistHint.d.ts.map +0 -1
  522. package/dist/routes/config/channels/http/serviceWarning.d.ts.map +0 -1
  523. package/dist/routes/config/channels/index.d.ts.map +0 -1
  524. package/dist/routes/config/channels/setup.d.ts.map +0 -1
  525. package/dist/routes/config/channels/table.d.ts.map +0 -1
  526. package/dist/routes/config/http/envelope.d.ts.map +0 -1
  527. package/dist/routes/config/index.d.ts.map +0 -1
  528. package/dist/routes/config/services.d.ts.map +0 -1
  529. package/dist/routes/config/settings.d.ts.map +0 -1
  530. package/dist/routes/debug.d.ts.map +0 -1
  531. package/dist/routes/health.d.ts.map +0 -1
  532. package/dist/routes/hls.d.ts.map +0 -1
  533. package/dist/routes/icons.d.ts.map +0 -1
  534. package/dist/routes/index.d.ts.map +0 -1
  535. package/dist/routes/logs.d.ts.map +0 -1
  536. package/dist/routes/mpegts.d.ts.map +0 -1
  537. package/dist/routes/play.d.ts.map +0 -1
  538. package/dist/routes/playlist.d.ts.map +0 -1
  539. package/dist/routes/root/content.d.ts.map +0 -1
  540. package/dist/routes/root/index.d.ts.map +0 -1
  541. package/dist/routes/root/scripts/channels.d.ts.map +0 -1
  542. package/dist/routes/root/scripts/clientEscape.d.ts.map +0 -1
  543. package/dist/routes/root/scripts/clientUrl.d.ts.map +0 -1
  544. package/dist/routes/root/scripts/config.d.ts.map +0 -1
  545. package/dist/routes/root/scripts/index.d.ts.map +0 -1
  546. package/dist/routes/root/scripts/shared.d.ts.map +0 -1
  547. package/dist/routes/root/scripts/status.d.ts.map +0 -1
  548. package/dist/routes/root/scripts/status.handlers.d.ts.map +0 -1
  549. package/dist/routes/root/styles.d.ts.map +0 -1
  550. package/dist/routes/services.d.ts.map +0 -1
  551. package/dist/routes/sse.d.ts.map +0 -1
  552. package/dist/routes/streams.d.ts.map +0 -1
  553. package/dist/routes/theme.d.ts.map +0 -1
  554. package/dist/routes/ui.d.ts.map +0 -1
  555. package/dist/routes/upgrade.d.ts.map +0 -1
  556. package/dist/service/commands.context.d.ts.map +0 -1
  557. package/dist/service/commands.d.ts.map +0 -1
  558. package/dist/service/generators.context.d.ts.map +0 -1
  559. package/dist/service/generators.d.ts.map +0 -1
  560. package/dist/service/index.d.ts.map +0 -1
  561. package/dist/streaming/captureLock.d.ts.map +0 -1
  562. package/dist/streaming/captureSession.d.ts.map +0 -1
  563. package/dist/streaming/clients.d.ts.map +0 -1
  564. package/dist/streaming/codec.d.ts.map +0 -1
  565. package/dist/streaming/fmp4Segmenter.d.ts.map +0 -1
  566. package/dist/streaming/hls.d.ts.map +0 -1
  567. package/dist/streaming/hlsResume.d.ts.map +0 -1
  568. package/dist/streaming/hlsSegments.d.ts.map +0 -1
  569. package/dist/streaming/lifecycle.d.ts.map +0 -1
  570. package/dist/streaming/monitor.d.ts.map +0 -1
  571. package/dist/streaming/mp4Parser.d.ts.map +0 -1
  572. package/dist/streaming/mpegts.d.ts.map +0 -1
  573. package/dist/streaming/playlistBuilder.d.ts.map +0 -1
  574. package/dist/streaming/preroll.d.ts.map +0 -1
  575. package/dist/streaming/pretune.d.ts.map +0 -1
  576. package/dist/streaming/pretuneTimers.d.ts.map +0 -1
  577. package/dist/streaming/recovery.d.ts.map +0 -1
  578. package/dist/streaming/registry.d.ts.map +0 -1
  579. package/dist/streaming/setup.d.ts.map +0 -1
  580. package/dist/streaming/showInfo.d.ts.map +0 -1
  581. package/dist/streaming/statusEmitter.d.ts.map +0 -1
  582. package/dist/types/channels.d.ts.map +0 -1
  583. package/dist/types/config.d.ts.map +0 -1
  584. package/dist/types/index.d.ts.map +0 -1
  585. package/dist/types/profiles.d.ts.map +0 -1
  586. package/dist/types/selection.d.ts.map +0 -1
  587. package/dist/types/shared.d.ts.map +0 -1
  588. package/dist/types/streaming.d.ts.map +0 -1
  589. package/dist/upgrade/commands.context.d.ts.map +0 -1
  590. package/dist/upgrade/commands.d.ts.map +0 -1
  591. package/dist/upgrade/detection.context.d.ts.map +0 -1
  592. package/dist/upgrade/detection.d.ts.map +0 -1
  593. package/dist/upgrade/index.d.ts.map +0 -1
  594. package/dist/upgrade/lifecycle.context.d.ts.map +0 -1
  595. package/dist/upgrade/lifecycle.d.ts.map +0 -1
  596. package/dist/upgrade/pathHandle.d.ts.map +0 -1
  597. package/dist/utils/bootSession.context.d.ts.map +0 -1
  598. package/dist/utils/bootSession.d.ts.map +0 -1
  599. package/dist/utils/chromeFetch.d.ts.map +0 -1
  600. package/dist/utils/cliOutput.d.ts.map +0 -1
  601. package/dist/utils/clock.d.ts +0 -15
  602. package/dist/utils/clock.d.ts.map +0 -1
  603. package/dist/utils/clock.js +0 -31
  604. package/dist/utils/clock.js.map +0 -1
  605. package/dist/utils/debugFilter.d.ts.map +0 -1
  606. package/dist/utils/delay.d.ts.map +0 -1
  607. package/dist/utils/errors.d.ts.map +0 -1
  608. package/dist/utils/evaluate.d.ts.map +0 -1
  609. package/dist/utils/ffmpeg.context.d.ts.map +0 -1
  610. package/dist/utils/ffmpeg.d.ts.map +0 -1
  611. package/dist/utils/fileLogger.d.ts.map +0 -1
  612. package/dist/utils/format.d.ts.map +0 -1
  613. package/dist/utils/index.d.ts.map +0 -1
  614. package/dist/utils/logEmitter.d.ts.map +0 -1
  615. package/dist/utils/logger.d.ts.map +0 -1
  616. package/dist/utils/m3u.d.ts.map +0 -1
  617. package/dist/utils/markup.d.ts.map +0 -1
  618. package/dist/utils/memo.d.ts.map +0 -1
  619. package/dist/utils/morganStream.d.ts.map +0 -1
  620. package/dist/utils/network.d.ts.map +0 -1
  621. package/dist/utils/pid.d.ts.map +0 -1
  622. package/dist/utils/platform.d.ts.map +0 -1
  623. package/dist/utils/processInspector.context.d.ts.map +0 -1
  624. package/dist/utils/processInspector.d.ts.map +0 -1
  625. package/dist/utils/retry.d.ts.map +0 -1
  626. package/dist/utils/runtimeIdentity.context.d.ts.map +0 -1
  627. package/dist/utils/runtimeIdentity.d.ts.map +0 -1
  628. package/dist/utils/sanitize.d.ts.map +0 -1
  629. package/dist/utils/streamContext.d.ts.map +0 -1
  630. package/dist/utils/timing.d.ts.map +0 -1
  631. package/dist/utils/version.d.ts.map +0 -1
@@ -1,12 +1,14 @@
1
- import type { MediaContainer, Nullable, ResolvedSiteProfile, StreamingMode } from "../types/index.ts";
1
+ import type { MediaContainer, Nullable, ResolvedSiteProfile } from "../types/index.ts";
2
2
  import type { CaptureCodec } from "./codec.ts";
3
3
  import type { CaptureSession } from "./captureSession.ts";
4
4
  import { EventEmitter } from "node:events";
5
+ import type { FMP4SegmenterResult } from "./fmp4Segmenter.ts";
5
6
  import type { ManifestInterceptionResult } from "../browser/manifestInterceptor.ts";
6
7
  import type { MonitorHandle } from "./recovery.ts";
7
8
  import type { NativeProxy } from "../native/proxy.ts";
8
9
  import type { Page } from "puppeteer-core";
9
10
  import type { ProbeCacheIdentity } from "../native/probe.ts";
11
+ import type { RefreshedFeedMetadata } from "../native/index.ts";
10
12
  /**
11
13
  * Typed event map for segment notifications. MPEG-TS consumers and lifecycle handlers subscribe to these events. Using a typed interface ensures event names and
12
14
  * argument types are checked at compile time, preventing misspelled event names or incorrect payloads.
@@ -30,6 +32,13 @@ export interface SegmentEmitter extends EventEmitter {
30
32
  * signature names the type rather than restating the literal pair.
31
33
  */
32
34
  export type InitSegmentTrack = "audio" | "video";
35
+ /**
36
+ * The HTTP status and user-facing message a failed stream setup answers its clients with.
37
+ */
38
+ export interface SetupFailureStatus {
39
+ readonly statusCode: number;
40
+ readonly userMessage: string;
41
+ }
33
42
  /**
34
43
  * HLS segment and playlist storage for a stream. This includes the fMP4 initialization segment (codec configuration), media segments (.m4s files), and the current
35
44
  * playlist content. The playlistReady promise allows callers to wait for the first playlist to be generated.
@@ -59,9 +68,10 @@ export interface HLSState {
59
68
  prerollBaseUrl: Nullable<string>;
60
69
  prerollCodec: Nullable<CaptureCodec>;
61
70
  prerollSegmentCount: number;
62
- prerollStartTime: Nullable<Date>;
63
- prerollTimer: Nullable<ReturnType<typeof setTimeout>>;
71
+ prerollStartTime: Nullable<number>;
72
+ prerollTimer: Nullable<Disposable>;
64
73
  resumeSegmentIndex: number;
74
+ setupFailure: Nullable<SetupFailureStatus>;
65
75
  }
66
76
  /**
67
77
  * Stream-specific information for idle detection.
@@ -70,32 +80,46 @@ export interface StreamInfo {
70
80
  lastPlaylistRequest: number;
71
81
  storeKey: string;
72
82
  }
83
+ /**
84
+ * The identity of a capture-mode stream: the screen-capture pipeline and the encoder facts that describe what it is producing.
85
+ */
86
+ export interface CaptureStreamIdentity {
87
+ readonly captureCodec: Nullable<string>;
88
+ readonly captureSession: Nullable<CaptureSession>;
89
+ readonly hardwareAccelerated: boolean;
90
+ readonly mode: "capture";
91
+ }
92
+ /**
93
+ * The identity of a native-mode stream: the HLS proxy relaying the service's own segments, and the manifest facts that describe the feed it is bound to.
94
+ */
95
+ export interface NativeStreamIdentity {
96
+ readonly captureCodec: Nullable<string>;
97
+ readonly mode: "native";
98
+ readonly nativeBandwidth: number;
99
+ readonly nativeContainer: Nullable<MediaContainer>;
100
+ readonly nativeProxy: NativeProxy;
101
+ readonly nativeResolution: Nullable<string>;
102
+ readonly reestablishManifest: (page: Page) => Promise<Nullable<ManifestInterceptionResult>>;
103
+ }
104
+ export type StreamIdentity = CaptureStreamIdentity | NativeStreamIdentity;
73
105
  /**
74
106
  * Registry entry for an active stream. This is the single source of truth for all stream data, including browser state, HLS segments, and the segmenter reference.
75
107
  */
76
108
  export interface StreamRegistryEntry {
77
- captureCodec: Nullable<string>;
78
- captureSession: Nullable<CaptureSession>;
79
109
  channelName: Nullable<string>;
80
110
  clientAddress: Nullable<string>;
81
- hardwareAccelerated: boolean;
82
111
  hls: HLSState;
83
112
  id: number;
113
+ identity: StreamIdentity;
84
114
  mpegTsClientCount: number;
85
- nativeBandwidth: number;
86
- nativeContainer: Nullable<MediaContainer>;
87
- nativeProxy: Nullable<NativeProxy>;
88
- nativeResolution: Nullable<string>;
89
115
  info: StreamInfo;
90
116
  page: Nullable<Page>;
91
117
  preTuned: boolean;
92
118
  probeIdentity: Nullable<ProbeCacheIdentity>;
93
119
  profile: Nullable<ResolvedSiteProfile>;
94
- reestablishManifest: Nullable<(page: Page) => Promise<Nullable<ManifestInterceptionResult>>>;
95
- startTime: Date;
120
+ startTime: number;
96
121
  monitor: Nullable<MonitorHandle>;
97
122
  streamIdStr: string;
98
- streamingMode: StreamingMode;
99
123
  url: string;
100
124
  }
101
125
  /**
@@ -129,11 +153,65 @@ export declare function getAllStreams(): StreamRegistryEntry[];
129
153
  * @returns The number of active streams.
130
154
  */
131
155
  export declare function getStreamCount(): number;
156
+ /**
157
+ * Reports whether any registered stream is in capture mode. The browser window's visibility policy reads this, so it is evaluated fresh on every call - the answer
158
+ * flips with every stream start and end, and a cached copy would be stale exactly when it matters.
159
+ *
160
+ * Registry presence is the test rather than a live captureSession reference. A pending entry registers in capture mode before physical capture starts, and an entry
161
+ * leaves the registry only after teardown, so membership brackets the entire window during which Chrome is reading the compositor. The capture session attaches
162
+ * partway through establishment, which would leave the predicate reading false across the whole tune - the moment the window most needs to be visible.
163
+ * @returns True when at least one registered stream is in capture mode.
164
+ */
165
+ export declare function hasActiveCaptureStreams(): boolean;
166
+ /**
167
+ * Reports whether any registered stream has been established on the browser. A stream is established once its entry holds its page, in either mode - a capture
168
+ * reads that page's compositor output and a native relay keeps its page for re-establishment - and from that moment it depends on the browser the page lives in.
169
+ * A pending entry holds no page, so a tune that has released its page to wait on a relaunch does not count itself among the reasons that relaunch cannot run.
170
+ *
171
+ * It is deliberately narrower than hasActiveCaptureStreams beside it, which counts pending entries on purpose: the window has to be on screen for the whole tune,
172
+ * whereas the question here is what a browser teardown would destroy.
173
+ * @returns True when at least one registered stream holds a page.
174
+ */
175
+ export declare function hasEstablishedStreams(): boolean;
176
+ /**
177
+ * Builds the identity a stream is born with: capture mode, with no pipeline and no encoder facts yet. The literal exists here alone so the pending birth and the
178
+ * native fallback's pre-flip declare the same shape rather than hand-copying it.
179
+ * @returns A capture identity in its pending state.
180
+ */
181
+ export declare function makePendingCaptureIdentity(): CaptureStreamIdentity;
182
+ /**
183
+ * Narrows a stream entry to capture mode. Published alongside the segment-health readers so consumers outside the streaming layer ask the registry what a stream
184
+ * is rather than reaching into its identity themselves.
185
+ * @param entry - The stream registry entry to test.
186
+ * @returns True when the entry carries a capture identity, narrowing it for the caller.
187
+ */
188
+ export declare function isCaptureIdentity(entry: StreamRegistryEntry): entry is StreamRegistryEntry & {
189
+ identity: CaptureStreamIdentity;
190
+ };
191
+ /**
192
+ * Reports whether a stream is encoding on the local GPU. Hardware acceleration is a capture-mode fact, so native streams answer false: they pass the service's own
193
+ * segments through and encode nothing locally. The status projections read it here rather than each narrowing the identity themselves.
194
+ * @param entry - The stream registry entry to query.
195
+ * @returns True when the stream is capturing with hardware-accelerated encoding.
196
+ */
197
+ export declare function isHardwareAccelerated(entry: StreamRegistryEntry): boolean;
198
+ /**
199
+ * Records the quality a token refresh has bound this stream to. The registry owns the mechanics because two layers relay the same refresh - the native upgrade in
200
+ * hls.ts and the monitor's L2 recovery - and a hand-copied guard-then-spread in each would be two chances to get it wrong.
201
+ *
202
+ * The narrow happens here, freshly, because both callers invoke this from an asynchronous callback that can fire long after any earlier check: a refresh that
203
+ * completes while a capture fallback is mid-flight finds a capture identity and is skipped. Skipping is right in every case - quality metadata for a stream
204
+ * midway through a fallback is moot, and a fallback that fails restores the proxy, whose next refresh writes the quality again.
205
+ * @param entry - The stream registry entry to update.
206
+ * @param refreshed - The quality facts of the freshly bound feed.
207
+ */
208
+ export declare function applyNativeQualityRefresh(entry: StreamRegistryEntry, refreshed: RefreshedFeedMetadata): void;
132
209
  /**
133
210
  * Updates the last playlist request timestamp for a stream. This should be called whenever a playlist or segment is requested to keep the idle timeout accurate.
134
211
  * @param id - The numeric stream ID.
212
+ * @param now - The instant of the request.
135
213
  */
136
- export declare function updateLastAccess(id: number): void;
214
+ export declare function updateLastAccess(id: number, now: number): void;
137
215
  /**
138
216
  * Creates the initial HLS state for a new stream. This sets up empty segment storage and the playlist readiness signaling mechanism.
139
217
  * @returns A new HLSState object ready to receive segments.
@@ -167,6 +245,16 @@ export declare function getStreamMemoryUsage(entry: StreamRegistryEntry): Stream
167
245
  * @returns Total memory usage in bytes across all streams.
168
246
  */
169
247
  export declare function getTotalSegmentMemory(): number;
248
+ /**
249
+ * Returns the fMP4 segmenter producing a stream's segments, or null when there is none: a native stream relays the service's own segments, and a capture stream
250
+ * has no segmenter until createCaptureSegmenter wires one. This is the single place the capture-identity narrow and the pipeline walk are written, so the several
251
+ * consumers that read segment indices, init segments, and session statistics all ask the same question the same way.
252
+ *
253
+ * An absent entry is accepted because callers routinely look the stream up and read its segmenter in one expression; a stream that is gone has no segmenter.
254
+ * @param entry - The stream registry entry to query, or undefined when the lookup found nothing.
255
+ * @returns The attached segmenter, or null.
256
+ */
257
+ export declare function getStreamSegmenter(entry: StreamRegistryEntry | undefined): Nullable<FMP4SegmenterResult>;
170
258
  /**
171
259
  * Returns whether the last segment contained video traf boxes. Used by the monitor to distinguish dead capture pipelines (audio-only, no video trafs) from legitimate
172
260
  * small segments produced by static content (video trafs present but low-bitrate). Returns null if the segmenter does not exist or the video trackId is unknown.
@@ -182,4 +270,3 @@ export declare function getLastSegmentHasVideo(entry: StreamRegistryEntry): Null
182
270
  */
183
271
  export declare function getLastSegmentSize(entry: StreamRegistryEntry): Nullable<number>;
184
272
  export {};
185
- //# sourceMappingURL=registry.d.ts.map
@@ -48,14 +48,83 @@ export function getAllStreams() {
48
48
  export function getStreamCount() {
49
49
  return streamRegistry.size;
50
50
  }
51
+ /**
52
+ * Reports whether any registered stream is in capture mode. The browser window's visibility policy reads this, so it is evaluated fresh on every call - the answer
53
+ * flips with every stream start and end, and a cached copy would be stale exactly when it matters.
54
+ *
55
+ * Registry presence is the test rather than a live captureSession reference. A pending entry registers in capture mode before physical capture starts, and an entry
56
+ * leaves the registry only after teardown, so membership brackets the entire window during which Chrome is reading the compositor. The capture session attaches
57
+ * partway through establishment, which would leave the predicate reading false across the whole tune - the moment the window most needs to be visible.
58
+ * @returns True when at least one registered stream is in capture mode.
59
+ */
60
+ export function hasActiveCaptureStreams() {
61
+ return getAllStreams().some(isCaptureIdentity);
62
+ }
63
+ /**
64
+ * Reports whether any registered stream has been established on the browser. A stream is established once its entry holds its page, in either mode - a capture
65
+ * reads that page's compositor output and a native relay keeps its page for re-establishment - and from that moment it depends on the browser the page lives in.
66
+ * A pending entry holds no page, so a tune that has released its page to wait on a relaunch does not count itself among the reasons that relaunch cannot run.
67
+ *
68
+ * It is deliberately narrower than hasActiveCaptureStreams beside it, which counts pending entries on purpose: the window has to be on screen for the whole tune,
69
+ * whereas the question here is what a browser teardown would destroy.
70
+ * @returns True when at least one registered stream holds a page.
71
+ */
72
+ export function hasEstablishedStreams() {
73
+ return getAllStreams().some((entry) => entry.page !== null);
74
+ }
75
+ // Identity.
76
+ /**
77
+ * Builds the identity a stream is born with: capture mode, with no pipeline and no encoder facts yet. The literal exists here alone so the pending birth and the
78
+ * native fallback's pre-flip declare the same shape rather than hand-copying it.
79
+ * @returns A capture identity in its pending state.
80
+ */
81
+ export function makePendingCaptureIdentity() {
82
+ return { captureCodec: null, captureSession: null, hardwareAccelerated: false, mode: "capture" };
83
+ }
84
+ /**
85
+ * Narrows a stream entry to capture mode. Published alongside the segment-health readers so consumers outside the streaming layer ask the registry what a stream
86
+ * is rather than reaching into its identity themselves.
87
+ * @param entry - The stream registry entry to test.
88
+ * @returns True when the entry carries a capture identity, narrowing it for the caller.
89
+ */
90
+ export function isCaptureIdentity(entry) {
91
+ return entry.identity.mode === "capture";
92
+ }
93
+ /**
94
+ * Reports whether a stream is encoding on the local GPU. Hardware acceleration is a capture-mode fact, so native streams answer false: they pass the service's own
95
+ * segments through and encode nothing locally. The status projections read it here rather than each narrowing the identity themselves.
96
+ * @param entry - The stream registry entry to query.
97
+ * @returns True when the stream is capturing with hardware-accelerated encoding.
98
+ */
99
+ export function isHardwareAccelerated(entry) {
100
+ return (entry.identity.mode === "capture") && entry.identity.hardwareAccelerated;
101
+ }
102
+ /**
103
+ * Records the quality a token refresh has bound this stream to. The registry owns the mechanics because two layers relay the same refresh - the native upgrade in
104
+ * hls.ts and the monitor's L2 recovery - and a hand-copied guard-then-spread in each would be two chances to get it wrong.
105
+ *
106
+ * The narrow happens here, freshly, because both callers invoke this from an asynchronous callback that can fire long after any earlier check: a refresh that
107
+ * completes while a capture fallback is mid-flight finds a capture identity and is skipped. Skipping is right in every case - quality metadata for a stream
108
+ * midway through a fallback is moot, and a fallback that fails restores the proxy, whose next refresh writes the quality again.
109
+ * @param entry - The stream registry entry to update.
110
+ * @param refreshed - The quality facts of the freshly bound feed.
111
+ */
112
+ export function applyNativeQualityRefresh(entry, refreshed) {
113
+ const identity = entry.identity;
114
+ if (identity.mode !== "native") {
115
+ return;
116
+ }
117
+ entry.identity = { ...identity, captureCodec: refreshed.codec, nativeBandwidth: refreshed.bandwidth, nativeResolution: refreshed.resolution };
118
+ }
51
119
  /**
52
120
  * Updates the last playlist request timestamp for a stream. This should be called whenever a playlist or segment is requested to keep the idle timeout accurate.
53
121
  * @param id - The numeric stream ID.
122
+ * @param now - The instant of the request.
54
123
  */
55
- export function updateLastAccess(id) {
124
+ export function updateLastAccess(id, now) {
56
125
  const entry = streamRegistry.get(id);
57
126
  if (entry) {
58
- entry.info.lastPlaylistRequest = Date.now();
127
+ entry.info.lastPlaylistRequest = now;
59
128
  }
60
129
  }
61
130
  /**
@@ -92,6 +161,7 @@ export function createHLSState() {
92
161
  segmentBytes: 0,
93
162
  segmentEmitter,
94
163
  segments: new Map(),
164
+ setupFailure: null,
95
165
  signalInitSegmentReady,
96
166
  signalPlaylistReady,
97
167
  videoPlaylist: ""
@@ -106,7 +176,7 @@ export function createHLSState() {
106
176
  */
107
177
  export function cancelPrerollTimer(hls) {
108
178
  if (hls.prerollTimer) {
109
- clearTimeout(hls.prerollTimer);
179
+ hls.prerollTimer[Symbol.dispose]();
110
180
  hls.prerollTimer = null;
111
181
  }
112
182
  }
@@ -139,6 +209,21 @@ export function getTotalSegmentMemory() {
139
209
  return total;
140
210
  }
141
211
  // Segment Health.
212
+ /**
213
+ * Returns the fMP4 segmenter producing a stream's segments, or null when there is none: a native stream relays the service's own segments, and a capture stream
214
+ * has no segmenter until createCaptureSegmenter wires one. This is the single place the capture-identity narrow and the pipeline walk are written, so the several
215
+ * consumers that read segment indices, init segments, and session statistics all ask the same question the same way.
216
+ *
217
+ * An absent entry is accepted because callers routinely look the stream up and read its segmenter in one expression; a stream that is gone has no segmenter.
218
+ * @param entry - The stream registry entry to query, or undefined when the lookup found nothing.
219
+ * @returns The attached segmenter, or null.
220
+ */
221
+ export function getStreamSegmenter(entry) {
222
+ if (entry?.identity.mode !== "capture") {
223
+ return null;
224
+ }
225
+ return entry.identity.captureSession?.segmenter ?? null;
226
+ }
142
227
  /**
143
228
  * Returns whether the last segment contained video traf boxes. Used by the monitor to distinguish dead capture pipelines (audio-only, no video trafs) from legitimate
144
229
  * small segments produced by static content (video trafs present but low-bitrate). Returns null if the segmenter does not exist or the video trackId is unknown.
@@ -146,7 +231,7 @@ export function getTotalSegmentMemory() {
146
231
  * @returns True if video trafs were present, false if absent, null if unknown.
147
232
  */
148
233
  export function getLastSegmentHasVideo(entry) {
149
- return entry.captureSession?.segmenter?.getLastSegmentHasVideo() ?? null;
234
+ return getStreamSegmenter(entry)?.getLastSegmentHasVideo() ?? null;
150
235
  }
151
236
  /**
152
237
  * Gets the size in bytes of the last segment stored for a stream. Used by the monitor to detect dead capture pipelines that produce empty segments (18 bytes observed)
@@ -155,6 +240,6 @@ export function getLastSegmentHasVideo(entry) {
155
240
  * @returns Segment size in bytes, or null if no segmenter exists.
156
241
  */
157
242
  export function getLastSegmentSize(entry) {
158
- return entry.captureSession?.segmenter?.getLastSegmentSize() ?? null;
243
+ return getStreamSegmenter(entry)?.getLastSegmentSize() ?? null;
159
244
  }
160
245
  //# sourceMappingURL=registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/streaming/registry.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgQ3C,SAAS;AAET,0EAA0E;AAC1E,MAAM,cAAc,GAAG,IAAI,GAAG,EAA+B,CAAC;AAE9D,6EAA6E;AAC7E,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB,cAAc;AAEd;;;GAGG;AACH,MAAM,UAAU,eAAe;IAE7B,OAAO,EAAE,eAAe,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B;IAEvD,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAU;IAEzC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,EAAU;IAElC,OAAO,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAChC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa;IAE3B,OAAO,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc;IAE5B,OAAO,cAAc,CAAC,IAAI,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,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AACH,MAAM,UAAU,kBAAkB,CAAC,KAA0B;IAE3D,OAAO,kBAAkB,CAAC,KAAK,CAAC,EAAE,kBAAkB,EAAE,IAAI,IAAI,CAAC;AACjE,CAAC"}
@@ -1,15 +1,33 @@
1
1
  import type { Browser, Frame, Page } from "puppeteer-core";
2
- import { getCurrentBrowser, getStream } from "../browser/index.ts";
2
+ import { acquireCaptureStream, emulateCaptureSurface, getBrowserInstance, getCaptureImpairment, getCurrentBrowser, installActivationHeal, noteBrowserCaptureImpaired, syncWindowVisibility } from "../browser/index.ts";
3
+ import type { CaptureStream } from "../browser/index.ts";
4
+ import { spawnFFmpeg } from "../utils/index.ts";
3
5
  import type { ManifestInterceptionResult, ManifestInterceptorHandle } from "../browser/manifestInterceptor.ts";
4
6
  import type { MonitorHandle, TabReplacementResult } from "./recovery.ts";
5
7
  import type { Nullable, ResolvedChannel, ResolvedSiteProfile, TuneResult, UrlValidationResult } from "../types/index.ts";
6
8
  import { initializePlayback } from "../browser/video.ts";
7
9
  import type { CaptureSession } from "./captureSession.ts";
10
+ import type { Clock } from "homebridge-plugin-utils";
8
11
  import type { InitializePlaybackOptions } from "../browser/video.ts";
9
12
  import type { ProbeCacheIdentity } from "../native/probe.ts";
13
+ import { openSharedWindowTab } from "../browser/tabSelection.ts";
14
+ import { reaffirmCaptureSurface } from "../browser/cdp.ts";
10
15
  import { startOverlayHandling } from "../browser/consent.ts";
11
16
  export declare const STREAM_INIT_TIMEOUT_MESSAGE = "Stream initialization timed out.";
12
17
  export declare const CAPTURE_PROBE_TIMEOUT_MESSAGE = "Capture probe timed out.";
18
+ /**
19
+ * Retires a raw capture stream: destroys it so the stop request goes out while the browser is still connected, then waits for the extension to confirm the
20
+ * recording stopped before the caller closes the page. This is the destroy-and-confirm core shared by the mid-life probe's success teardown and every path that
21
+ * must retire a capture stream produced after its caller had already abandoned the turn. It is the async sibling of captureSession.ts's disposer, which tears the
22
+ * composed FFmpeg pipeline down synchronously: this helper awaits the confirmation because a page close follows it directly, and unlike the composed disposer it
23
+ * is used on abandoned paths where the page may already be closed, so the stop side is then best-effort.
24
+ *
25
+ * It never throws. A confirmation that does not arrive inside the ceiling is warned about and then stepped past, because holding a page open for a browser that
26
+ * has stopped answering helps nobody.
27
+ * @param stream - The raw capture stream to retire.
28
+ * @param clock - Clock bounding the stop confirmation. Defaults to the system clock; tests inject a virtual clock.
29
+ */
30
+ export declare function retireRawStream(stream: CaptureStream, clock?: Clock): Promise<void>;
13
31
  /**
14
32
  * Thrown by createPageWithCapture when an establishment that navigated to a resolved direct watch URL failed on evidence against that URL - the coordinator's own
15
33
  * verdict, read from invalidateDirectUrl, never re-derived here. It says one thing to the caller: the hint has already been evicted, and a fresh attempt down the
@@ -56,7 +74,7 @@ export interface StreamSetupResult {
56
74
  profile: ResolvedSiteProfile;
57
75
  profileName: string;
58
76
  serviceName: string;
59
- startTime: Date;
77
+ startTime: number;
60
78
  monitor: MonitorHandle;
61
79
  streamId: string;
62
80
  url: string;
@@ -87,7 +105,6 @@ export declare function withSignInGuidance(userMessage: string, channelKey: Null
87
105
  */
88
106
  export interface CreatePageWithCaptureOptions {
89
107
  comment?: string;
90
- numericStreamId: number;
91
108
  onFFmpegError?: (error: Error) => void;
92
109
  persistResolution?: (resolvedSelector: string) => Promise<void>;
93
110
  profile: ResolvedSiteProfile;
@@ -97,6 +114,7 @@ export interface CreatePageWithCaptureOptions {
97
114
  tabReplacement?: boolean;
98
115
  url: string;
99
116
  _pageClosedRetries?: number;
117
+ _refusalRetried?: boolean;
100
118
  }
101
119
  /**
102
120
  * Result from creating a page with capture. Contains everything needed to create a segmenter and continue with stream setup.
@@ -124,9 +142,16 @@ export declare function generateStreamId(channelName: string | undefined, url: s
124
142
  */
125
143
  export declare function validateStreamUrl(url: string | undefined): UrlValidationResult;
126
144
  export interface CreatePageWithCaptureDeps {
145
+ readonly acquireCaptureStream: typeof acquireCaptureStream;
146
+ readonly awaitCaptureVerdict: (error: unknown) => Promise<Nullable<CaptureProbeOutcome>>;
147
+ readonly emulateCaptureSurface: typeof emulateCaptureSurface;
127
148
  readonly getCurrentBrowser: typeof getCurrentBrowser;
128
- readonly getStream: typeof getStream;
149
+ readonly installActivationHeal: typeof installActivationHeal;
150
+ readonly openSharedWindowTab: typeof openSharedWindowTab;
151
+ readonly reaffirmCaptureSurface: typeof reaffirmCaptureSurface;
152
+ readonly spawnFFmpeg: typeof spawnFFmpeg;
129
153
  readonly startOverlayHandling: typeof startOverlayHandling;
154
+ readonly syncWindowVisibility: typeof syncWindowVisibility;
130
155
  }
131
156
  /**
132
157
  * Creates a browser page with media capture and navigates to the URL. This is the reusable core function used by both initial stream setup and tab replacement
@@ -135,6 +160,8 @@ export interface CreatePageWithCaptureDeps {
135
160
  * - Initializing media capture (native fMP4 or Matroska+FFmpeg)
136
161
  * - Navigating to the URL with retry
137
162
  * - Setting up video playback via navigateToPage() + initializePlayback()
163
+ * - Re-entering itself once, on a fresh page through a freshly acquired browser, when Chrome refuses the capture start and the mid-life probe's verdict says a
164
+ * second attempt has something to start from
138
165
  *
139
166
  * The caller is responsible for:
140
167
  * - Creating the segmenter and attaching it to the capture session via captureSession.attachSegmenter()
@@ -144,7 +171,7 @@ export interface CreatePageWithCaptureDeps {
144
171
  *
145
172
  * @param options - Options for page and capture creation.
146
173
  * @param deps - The injected browser and overlay-poll collaborators; defaults to defaultCreatePageWithCaptureDeps. Threaded so a test drives this function without a
147
- * live Chrome by substituting the shared-browser accessor, the capture launcher, and the static-capture overlay poll.
174
+ * live Chrome by substituting the shared-browser accessor, the capture acquisition, and the static-capture overlay poll.
148
175
  * @returns The page, context, and capture session (which owns the raw capture stream and any FFmpeg child).
149
176
  * @throws Error if page creation, capture initialization, or navigation fails.
150
177
  */
@@ -195,7 +222,7 @@ export interface EstablishChannelPlaybackOptions {
195
222
  */
196
223
  export declare function establishChannelPlayback(page: Page, profile: ResolvedSiteProfile, handle: Nullable<ManifestInterceptorHandle>, options: EstablishChannelPlaybackOptions, deps?: EstablishChannelPlaybackDeps): Promise<TuneResult>;
197
224
  /**
198
- * Adjudicates what an establishment's interception selected: finalize it against the honest direct-tune kind, then confirm the manifest belongs to the channel
225
+ * Adjudicates what an establishment's interception selected: finalize it against the accurate direct-tune kind, then confirm the manifest belongs to the channel
199
226
  * the profile names. The tune path and the native refresh capability both run this, so finalize-then-verify is written exactly once.
200
227
  *
201
228
  * The stage hands on the interception promise rather than a resolved result, which is what keeps verifyManifestSelection's latency rule holding - its provider
@@ -235,39 +262,70 @@ export interface ReestablishChannelManifestOptions {
235
262
  }
236
263
  export declare function reestablishChannelManifest(options: ReestablishChannelManifestOptions): Promise<Nullable<ManifestInterceptionResult>>;
237
264
  /**
238
- * Verifies that a freshly-launched Chrome instance can actually capture, by running a real getStream against a throwaway page on it. This is the capability tier of
239
- * the browser launch gate: browser/index.ts injects it via setCaptureProbe and runs it inside launchReadyBrowser, so a browser is published as ready only after its
240
- * capture capability is verified - at boot AND at every relaunch, not just startup. It exercises the exact getStream path that hangs when the puppeteer-stream
241
- * extension is unregistered, so a dead extension is detected immediately rather than causing every subsequent stream request to hang.
265
+ * Verifies that a freshly-launched Chrome instance can actually capture, by running a real capture acquisition against a throwaway page on it. This is the
266
+ * capability tier of the browser launch gate: browser/index.ts injects it via setCaptureProbe and runs it inside launchReadyBrowser, so a browser is published as
267
+ * ready only after its capture capability is verified - at boot AND at every relaunch, not just startup. It exercises the exact acquisition path that fails when
268
+ * the capture extension is unregistered, so a dead extension is detected immediately rather than causing every subsequent stream request to fail.
242
269
  *
243
- * Each attempt creates a temporary page, attempts a short capture, and tears down both cleanly. A 500ms delay after destroying the capture stream allows
244
- * puppeteer-stream's fire-and-forget STOP_RECORDING chain to complete before closing the page, preventing a stale capture cascade on the first real request.
270
+ * Each attempt creates a temporary page, attempts a short capture, and tears down both cleanly. The teardown waits for the extension to confirm the recording
271
+ * stopped, bounded by a ceiling, before closing the page, so Chrome's tabCapture state is released rather than lingering into the first real request.
245
272
  *
246
273
  * After a system reboot or a fresh relaunch, Chrome's display stack or capture extension may not be ready immediately. The probe retries up to PROBE_MAX_ATTEMPTS
247
274
  * times with a delay between attempts, giving the system time to settle before giving up. At boot this prevents a rapid restart storm where the service manager
248
275
  * relaunches PrismCast repeatedly, each attempt orphaning a Chrome process; at relaunch it provides in-launch settling before the supervisor counts a launch failure.
249
- *
250
- * If stale capture state is detected, the process exits immediately - a Chrome restart cannot fix the leaked module-level mutex, only a fresh process can.
251
276
  * @param browser - The Chrome instance to verify (the local instance being launched, passed in rather than re-acquired to avoid re-entering the launch in flight).
252
277
  */
253
278
  export declare function verifyCaptureSystem(browser: Browser): Promise<void>;
254
279
  /**
255
- * Pure decision for whether a mid-life capture-infrastructure failure warrants re-verifying the browser. Re-verification is warranted iff no other re-verification
256
- * is already in flight, a browser is published to probe, and the failing stream is the only active stream - any other active stream means either the browser is
257
- * demonstrably capturing (so this failure is stream-specific - never invalidate) or those streams will trip their own circuit breakers and drain, after which a
258
- * later failure reaches the zero-other case. An empty registry (setup failed before the stream was registered) satisfies the isolation check vacuously and is the
259
- * common real-world shape of this failure.
260
- * @param inputs - The decision inputs.
261
- * @param inputs.activeStreamIds - The ids of every stream currently in the registry.
262
- * @param inputs.failingStreamId - The id of the stream whose setup just failed, excluded from the isolation check.
263
- * @param inputs.hasBrowser - Whether a browser instance is currently published to probe.
264
- * @param inputs.reverificationInProgress - Whether a re-verification is already deciding the browser's fate.
265
- * @returns True when the failure should trigger a re-verification probe.
280
+ * What one mid-life capture probe established about the browser. A `captured` outcome is the browser proving it can still start a capture; `failed` is the verdict
281
+ * the mark rests on; `inconclusive` is the probe never having run, which is evidence of neither.
266
282
  */
267
- export declare function shouldReverifyCapture(inputs: {
268
- activeStreamIds: readonly number[];
269
- failingStreamId: number;
270
- hasBrowser: boolean;
271
- reverificationInProgress: boolean;
272
- }): boolean;
273
- //# sourceMappingURL=setup.d.ts.map
283
+ export type CaptureProbeOutcome = {
284
+ readonly kind: "captured";
285
+ } | {
286
+ readonly kind: "failed";
287
+ readonly reason: string;
288
+ } | {
289
+ readonly kind: "inconclusive";
290
+ readonly reason: string;
291
+ };
292
+ /**
293
+ * Classifies a throw from the probe's run on the capture lock into a verdict or the absence of one. A turn-wait timeout means the probe never got to run: with
294
+ * other streams tuning at the same moment it queued behind their legitimate acquisitions, and a lock that is busy says something about load, not about the browser
295
+ * - a holder that is genuinely hung marks the browser through its own wedge. Every other value, the outer deadline above all, means the probe held its turn and its
296
+ * own acquisition did not settle, which is exactly the failure the mark exists for. Pure and total, so the distinction the detector rests on is pinnable without a
297
+ * browser.
298
+ * @param error - The value the lock run threw.
299
+ * @returns The outcome the detector acts on.
300
+ */
301
+ export declare function classifyCaptureProbeFailure(error: unknown): CaptureProbeOutcome;
302
+ /**
303
+ * The collaborators the verdict is reached through: the published-browser read, the mark already recorded against it, the mark this verdict may record, and the
304
+ * probe that decides. Injected as a default parameter in the shape CreatePageWithCaptureDeps uses, so a test drives the one shared slot and the awaited mark
305
+ * without a capture lock, a browser, or a Chrome behind them.
306
+ */
307
+ export interface CaptureVerdictDeps {
308
+ readonly getBrowserInstance: typeof getBrowserInstance;
309
+ readonly getCaptureImpairment: typeof getCaptureImpairment;
310
+ readonly noteBrowserCaptureImpaired: typeof noteBrowserCaptureImpaired;
311
+ readonly probe: (browser: Browser) => Promise<CaptureProbeOutcome>;
312
+ }
313
+ /**
314
+ * Passive mid-life capture-death detection, called from the stream-setup failure path when the failure carries a capture-infrastructure signature. It re-verifies
315
+ * the browser's capture capability with a lock-serialized probe and, on a confirmed failure, marks the browser: its running captures continue, new capture starts
316
+ * are refused at acquire(), and the adapter relaunches it once nothing depends on it. Any refused start is worth a probe - a browser that is demonstrably
317
+ * capturing for someone else can still be unable to start another - while a browser that already carries a mark needs no second verdict, so the reason on record
318
+ * is handed back instead.
319
+ *
320
+ * The returned promise settles only once everything the verdict set in motion has settled, the relaunch a `failed` outcome triggers included. That is the whole
321
+ * reason a caller can act on it: a tune that re-acquired the browser the instant the mark landed would meet the retiring instance's drain, where acquire() rejects
322
+ * rather than joins, while one that waits for this promise meets the fresh browser or a refusal that means what it says. The promise never rejects; the absence of
323
+ * a verdict is a null rather than a throw.
324
+ *
325
+ * It is deliberately not async: every caller in a burst has to hand back the SAME promise object, because what they are waiting on is the browser's one verdict
326
+ * rather than their own call's. An async wrapper would give each caller a distinct promise that merely adopts it, and the shared identity the single-flight slot
327
+ * exists to provide would stop being observable at this boundary.
328
+ * @param deps - The injected collaborators; defaults to the production ones.
329
+ * @returns The verdict, or null when no browser is published to reach one about.
330
+ */
331
+ export declare function noteCaptureInfrastructureFailure(deps?: CaptureVerdictDeps): Promise<Nullable<CaptureProbeOutcome>>;