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,4 +1,5 @@
1
1
  import { canAttemptLaunch, createLaunchGovernorState, noteLaunchFailure, noteLaunchSuccess, noteReadinessLost, noteSustainedHealth } from "./launchGovernor.js";
2
+ import { assertNever } from "../utils/index.js";
2
3
  /**
3
4
  * Error thrown by acquire() while the governor is cooling (degraded). Carries the timestamp until which launches are blocked so the adapter can surface a
4
5
  * Retry-After and a 503-class back-off rather than spawning Chrome. Distinct from a launch failure (which rejects with the underlying launch error).
@@ -22,6 +23,18 @@ export class BrowserSupersededError extends Error {
22
23
  this.name = "BrowserSupersededError";
23
24
  }
24
25
  }
26
+ /**
27
+ * Thrown by acquire() for a capture purpose on a browser that can no longer start captures. The caller maps it to the same 503 back-off class as
28
+ * BrowserUnavailableError, and it carries no retry horizon because the relaunch that cures it waits on the browser's own streams draining rather than on a clock.
29
+ */
30
+ export class BrowserCaptureImpairedError extends Error {
31
+ impairment;
32
+ constructor(impairment) {
33
+ super("The browser can no longer start captures and is waiting to relaunch.");
34
+ this.impairment = impairment;
35
+ this.name = "BrowserCaptureImpairedError";
36
+ }
37
+ }
25
38
  /**
26
39
  * Creates a browser supervisor over the injected ports. The returned object owns the lifecycle and governor state for the process lifetime; the adapter holds one
27
40
  * instance and routes all browser access through it.
@@ -78,7 +91,7 @@ export function createBrowserSupervisor(ports) {
78
91
  throw new BrowserSupersededError();
79
92
  }
80
93
  noteLaunchSuccess(governor, ports.now());
81
- transition({ browser, kind: "ready", launchTime: ports.now() });
94
+ transition({ browser, impairment: null, kind: "ready", launchTime: ports.now() });
82
95
  return browser;
83
96
  }
84
97
  /* Begins a launch in the given phase (launching for a normal acquire, trialing for a post-cooldown trial) and publishes the in-flight promise into the state so
@@ -92,9 +105,14 @@ export function createBrowserSupervisor(ports) {
92
105
  transition({ kind, promise });
93
106
  return promise;
94
107
  }
95
- async function acquire() {
108
+ async function acquire(purpose) {
96
109
  switch (state.kind) {
97
110
  case "ready": {
111
+ // A marked browser still opens pages, so only a capture purpose is refused. Refusing here rather than launching is what keeps a second Chrome away from the
112
+ // profile lock this instance still holds while it serves the captures it started; the relaunch is the adapter's to schedule once nothing depends on it.
113
+ if ((purpose === "capture") && state.impairment) {
114
+ throw new BrowserCaptureImpairedError(state.impairment);
115
+ }
98
116
  return state.browser;
99
117
  }
100
118
  // Join the launch already in flight rather than starting a second one - the single-flight guarantee.
@@ -127,6 +145,23 @@ export function createBrowserSupervisor(ports) {
127
145
  }
128
146
  }
129
147
  }
148
+ function captureImpairment() {
149
+ return (state.kind === "ready") ? state.impairment : null;
150
+ }
151
+ /* Records the capture impairment against the published ready browser, and reports whether this call is the one that recorded it.
152
+ *
153
+ * The identity guard is what makes a verdict safe to act on late: the caller confirmed a specific instance, and a disconnect plus relaunch during that
154
+ * confirmation can have replaced it, so a mark aimed at a superseded instance is dropped rather than applied to the healthy browser that took its place. The
155
+ * first mark wins for a reason of its own - the adapter's alarm and its status emit both belong to this transition, so a second verdict against the same
156
+ * instance must not fire either of them again.
157
+ */
158
+ function handleCaptureImpaired(browser, reason) {
159
+ if ((state.kind !== "ready") || (state.browser !== browser) || (state.impairment !== null)) {
160
+ return false;
161
+ }
162
+ transition({ ...state, impairment: { reason, since: ports.now() } });
163
+ return true;
164
+ }
130
165
  function current() {
131
166
  return (state.kind === "ready") ? state.browser : null;
132
167
  }
@@ -172,15 +207,7 @@ export function createBrowserSupervisor(ports) {
172
207
  }
173
208
  return noteSustainedHealth(governor, ports.now(), ports.policy());
174
209
  }
175
- return { acquire, current, currentLaunchTime, inspect: () => state, noteReadinessLost: handleReadinessLost, noteSustainedHealth: noteSustainedHealthTick,
176
- noteTeardownBegun: handleTeardownBegun };
177
- }
178
- /**
179
- * Exhaustiveness guard for the lifecycle switch: referencing a `never` makes the compiler flag any unhandled variant if the union grows.
180
- * @param value - The unreachable value.
181
- * @returns Never returns.
182
- */
183
- function assertNever(value) {
184
- throw new Error("Unhandled browser lifecycle state: " + JSON.stringify(value));
210
+ return { acquire, captureImpairment, current, currentLaunchTime, inspect: () => state, noteCaptureImpaired: handleCaptureImpaired,
211
+ noteReadinessLost: handleReadinessLost, noteSustainedHealth: noteSustainedHealthTick, noteTeardownBegun: handleTeardownBegun };
185
212
  }
186
213
  //# sourceMappingURL=browserSupervisor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"browserSupervisor.js","sourceRoot":"","sources":["../../src/browser/browserSupervisor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAgFhK;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAEhC,UAAU,CAAS;IAEnC,YAAY,UAAkB;QAE5B,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAEnF,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAE/C;QAEE,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAEhE,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAA6B;I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C,CAAC;IACpE,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,mBAAmB,EAAE,qBAAqB;QAC/H,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAC;AACnI,CAAC"}
@@ -1,4 +1,8 @@
1
1
  import type { CDPSession, Page } from "puppeteer-core";
2
+ import type { Clock } from "homebridge-plugin-utils";
3
+ import type { Nullable } from "../types/index.ts";
4
+ export declare const WINDOW_STATE_POLL_MS = 25;
5
+ export declare const WINDOW_RESTORE_CEILING_MS = 2000;
2
6
  /**
3
7
  * Executes a CDP (Chrome DevTools Protocol) operation with proper session lifecycle management. This helper handles the common pattern of:
4
8
  * 1. Creating a CDP session attached to the page's target
@@ -13,16 +17,64 @@ import type { CDPSession, Page } from "puppeteer-core";
13
17
  * @returns The result of the operation, or undefined if the page was closed or an error occurred.
14
18
  */
15
19
  export declare function withCDPSession<T>(page: Page, operation: (session: CDPSession, windowId: number) => Promise<T>): Promise<T | undefined>;
20
+ export interface WindowPlacement {
21
+ readonly height: number;
22
+ readonly left: number;
23
+ readonly top: number;
24
+ readonly width: number;
25
+ readonly windowState: string;
26
+ }
16
27
  /**
17
- * Minimizes the browser window to reduce GPU usage and keep the desktop clear. Minimizing does not interrupt capture: the capture extension reads the compositor's
18
- * surface rather than the visible display, and that surface is the page's emulated viewport, which the window's presentation state does not touch.
28
+ * Reads the window state Chrome reports for the window a page belongs to. Resolves null whenever the state cannot be read at all - a closed page, a target that
29
+ * yields no window ID, or a CDP failure withCDPSession absorbs - so a caller logging this as a diagnostic never has to tell a missing session apart from a
30
+ * missing report.
31
+ * @param page - The Puppeteer page whose window is read.
32
+ * @returns The window state Chrome reports, or null when it cannot be read.
33
+ */
34
+ export declare function readWindowState(page: Page): Promise<Nullable<string>>;
35
+ /**
36
+ * Reads the full placement - frame and state - of the window a page belongs to, for a caller that means to put a second window in the same spot. Resolves null
37
+ * whenever the placement cannot be read completely: a closed page, a target that yields no window ID, a CDP failure withCDPSession absorbs, or a response
38
+ * missing any one of the four numbers or the state. That strictness lives here rather than in the shared read, because a partial frame is useless to the one
39
+ * consumer this exists for while a partial response is still a perfectly good state report.
40
+ *
41
+ * Mirroring the shared window's own placement is what keeps a second window from disturbing the profile: Chrome persists the window placement it will relaunch
42
+ * at from the last window whose bounds changed, within seconds and regardless of which window the user is working in, and any exit that does not flush that
43
+ * preference - a crash, a forced kill, and the relaunch that follows a crash - carries those bounds into the next launch. A window opened anywhere else writes
44
+ * its own frame there and the shared window comes back at it (measured 2026-08-31).
45
+ * @param page - The Puppeteer page whose window is read.
46
+ * @returns The window's placement, or null when it cannot be read completely.
47
+ */
48
+ export declare function readWindowPlacement(page: Page): Promise<Nullable<WindowPlacement>>;
49
+ /**
50
+ * Minimizes the browser window, which keeps the desktop clear and the GPU idle while nothing is capturing. Only the window-visibility executor should call this:
51
+ * the window has to stay on screen for as long as any capture stream is reading the compositor, and that decision belongs to decideWindowVisibility in
52
+ * windowSync.ts.
19
53
  * @param page - The Puppeteer page object.
20
54
  */
21
55
  export declare function minimizeWindow(page: Page): Promise<void>;
22
56
  /**
23
- * Un-minimizes the browser window, restoring it to normal state. This is used when the user needs to interact with the browser, such as during the authentication
24
- * login flow where the user must complete TV provider authentication in the visible browser window.
57
+ * Un-minimizes the browser window, restoring it to normal state. The window belongs on screen while a capture stream is reading the compositor's output for it, and
58
+ * while a user is completing TV provider authentication in it. The capability probe calls this directly to make its environment representative of the one capture
59
+ * runs in; every other caller goes through the window-visibility executor, which owns the policy.
60
+ *
61
+ * The contract is a confirmed state, not a fired command: this resolves once Chrome reports the window restored, or once the ceiling lapses with a warning and the
62
+ * window left in whatever state it does report. On macOS a restore runs asynchronously against the acknowledgement of the command that asked for it, and a capture
63
+ * requested against a window still mid-restore is the shape of the 2026-08-26 through 08-28 capture-start failures. A window already on screen confirms on its
64
+ * first read, so the confirmation costs one round trip on the common path.
25
65
  * @param page - The Puppeteer page object.
66
+ * @param clock - Clock driving the confirmation cadence and its elapsed measurement. Defaults to the system clock; tests inject a virtual clock.
67
+ */
68
+ export declare function unminimizeWindow(page: Page, clock?: Clock): Promise<void>;
69
+ /**
70
+ * Re-issues a capture page's own declared device metrics. Chrome composes the capture of a selected tab from the window's fitted presentation rather than from the
71
+ * emulated surface, and the override event is what re-selects the composition target: a capture composing the window's view of the page returns to the full
72
+ * emulated surface, and a capture already composing that surface is left exactly as it was. Callable at any time, from anywhere, at any frequency, because the
73
+ * values sent are the ones Puppeteer has already declared on this page - nothing about the page's emulation changes.
74
+ *
75
+ * The command is issued raw rather than through page.setViewport, which drops an override whose values match the standing one. It is the event, not a change of
76
+ * values, that does the work here.
77
+ * @param page - The page to re-affirm. A page carrying no explicitly declared density is left alone.
78
+ * @throws Whatever the CDP send rejects with. Each trigger site decides whether that matters to it.
26
79
  */
27
- export declare function unminimizeWindow(page: Page): Promise<void>;
28
- //# sourceMappingURL=cdp.d.ts.map
80
+ export declare function reaffirmCaptureSurface(page: Page): Promise<void>;
@@ -1,10 +1,15 @@
1
- import { LOG, delay, formatError } from "../utils/index.js";
1
+ import { LOG, delay, formatError, pollUntil } from "../utils/index.js";
2
+ import { systemClock } from "homebridge-plugin-utils";
2
3
  /* The Chrome DevTools Protocol (CDP) provides low-level access to Chrome's internal state and capabilities. While Puppeteer abstracts most common operations, some
3
4
  * features require direct CDP access:
4
5
  *
5
- * - Window presentation: moving the shared browser window between its normal and minimized states. That state is the only window property this application
6
- * drives. The surface a page renders at belongs to Puppeteer's viewport, which emulates the configured quality preset on every page independently of how large
7
- * the OS window is, so window bounds carry no capture meaning...minimizing is about desktop clutter and GPU cost alone.
6
+ * - Window presentation: moving the shared browser window between its normal and minimized states, and reading the state Chrome reports for it. That state is the
7
+ * only window property this application drives, and it is not cosmetic: Chrome's tab capture consumes the compositor's output for the shared window, and a
8
+ * minimized window's output is not composed for capture to read. Which state the window should be in is decided in one place, by decideWindowVisibility in
9
+ * windowSync.ts; these primitives only carry it out and report back what Chrome says came of it.
10
+ *
11
+ * - Capture surface re-affirmation: re-issuing a capture page's own declared device metrics, which is what moves that capture's composition target back to the
12
+ * emulated surface.
8
13
  *
9
14
  * - Browser-level operations: Operations that affect the browser rather than a specific page, like getting the window ID for a page's target.
10
15
  *
@@ -15,6 +20,13 @@ import { LOG, delay, formatError } from "../utils/index.js";
15
20
  *
16
21
  * The withCDPSession helper encapsulates the common pattern of creating a session, getting the window ID, performing an operation, and handling errors.
17
22
  */
23
+ // The wait between one read of the window's state and the next while a restore is in flight. This is a cadence rather than a settle - nothing is being given time
24
+ // to happen, Chrome is simply being asked again - and the measured macOS restore completes in roughly a quarter second, so a genuine restore costs about ten reads
25
+ // and a window already on screen costs exactly one.
26
+ export const WINDOW_STATE_POLL_MS = 25;
27
+ // The bound on how long a restore may take to report itself complete. Eight times the measured restore, so a lapse is a genuine fault worth a warning rather than
28
+ // a slow-but-healthy transition. Lapsing never blocks the caller: capture proceeds against whatever state Chrome reports.
29
+ export const WINDOW_RESTORE_CEILING_MS = 2000;
18
30
  /**
19
31
  * Executes a CDP (Chrome DevTools Protocol) operation with proper session lifecycle management. This helper handles the common pattern of:
20
32
  * 1. Creating a CDP session attached to the page's target
@@ -59,8 +71,72 @@ export async function withCDPSession(page, operation) {
59
71
  }
60
72
  }
61
73
  /**
62
- * Minimizes the browser window to reduce GPU usage and keep the desktop clear. Minimizing does not interrupt capture: the capture extension reads the compositor's
63
- * surface rather than the visible display, and that surface is the page's emulated viewport, which the window's presentation state does not touch.
74
+ * Reads the bounds Chrome reports for a window, through a session that is already open. Private to this module and the one place the frame is read: the state
75
+ * derivation below, the restore confirmation, and the page-level placement read all take their answer from this single call, so no other site composes the
76
+ * request. A response carrying no bounds reads as null rather than throwing, because an absent report is an answer every derivation already branches on. The
77
+ * frame comes back for a minimized window too - Chrome reports the frame it is resting at, which is exactly what a window created beside it needs.
78
+ * @param session - An open CDP session attached to the page's target.
79
+ * @param windowId - The browser window ID that session resolved.
80
+ * @returns The bounds Chrome reports, with every field as optional as Chrome leaves it, or null when the response carries none.
81
+ */
82
+ async function readWindowBoundsWith(session, windowId) {
83
+ const response = await session.send("Browser.getWindowBounds", { windowId });
84
+ return response?.bounds ?? null;
85
+ }
86
+ /**
87
+ * Reads the window state Chrome reports for a window, through a session that is already open. Private to this module: the restore confirmation below and the
88
+ * page-level readWindowState both ask Chrome through the shared read above, so no other site composes the request. A response carrying no bounds, or bounds
89
+ * carrying no state, reads as null rather than throwing, because an absent report is an answer its callers already branch on.
90
+ * @param session - An open CDP session attached to the page's target.
91
+ * @param windowId - The browser window ID that session resolved.
92
+ * @returns The window state Chrome reports, or null when the response carries none.
93
+ */
94
+ async function readWindowStateWith(session, windowId) {
95
+ return (await readWindowBoundsWith(session, windowId))?.windowState ?? null;
96
+ }
97
+ /**
98
+ * Reads the window state Chrome reports for the window a page belongs to. Resolves null whenever the state cannot be read at all - a closed page, a target that
99
+ * yields no window ID, or a CDP failure withCDPSession absorbs - so a caller logging this as a diagnostic never has to tell a missing session apart from a
100
+ * missing report.
101
+ * @param page - The Puppeteer page whose window is read.
102
+ * @returns The window state Chrome reports, or null when it cannot be read.
103
+ */
104
+ export async function readWindowState(page) {
105
+ return (await withCDPSession(page, readWindowStateWith)) ?? null;
106
+ }
107
+ /**
108
+ * Reads the full placement - frame and state - of the window a page belongs to, for a caller that means to put a second window in the same spot. Resolves null
109
+ * whenever the placement cannot be read completely: a closed page, a target that yields no window ID, a CDP failure withCDPSession absorbs, or a response
110
+ * missing any one of the four numbers or the state. That strictness lives here rather than in the shared read, because a partial frame is useless to the one
111
+ * consumer this exists for while a partial response is still a perfectly good state report.
112
+ *
113
+ * Mirroring the shared window's own placement is what keeps a second window from disturbing the profile: Chrome persists the window placement it will relaunch
114
+ * at from the last window whose bounds changed, within seconds and regardless of which window the user is working in, and any exit that does not flush that
115
+ * preference - a crash, a forced kill, and the relaunch that follows a crash - carries those bounds into the next launch. A window opened anywhere else writes
116
+ * its own frame there and the shared window comes back at it (measured 2026-08-31).
117
+ * @param page - The Puppeteer page whose window is read.
118
+ * @returns The window's placement, or null when it cannot be read completely.
119
+ */
120
+ export async function readWindowPlacement(page) {
121
+ return (await withCDPSession(page, async (session, windowId) => {
122
+ const bounds = await readWindowBoundsWith(session, windowId);
123
+ if (!bounds) {
124
+ return null;
125
+ }
126
+ const { height, left, top, width, windowState } = bounds;
127
+ // Each field's presence is a type test rather than a truthiness test: a window flush against the top or the left edge of the screen reports that
128
+ // coordinate as 0, which a truthiness test would discard as a missing placement.
129
+ if ((typeof height !== "number") || (typeof left !== "number") || (typeof top !== "number") || (typeof width !== "number") ||
130
+ (typeof windowState !== "string")) {
131
+ return null;
132
+ }
133
+ return { height, left, top, width, windowState };
134
+ })) ?? null;
135
+ }
136
+ /**
137
+ * Minimizes the browser window, which keeps the desktop clear and the GPU idle while nothing is capturing. Only the window-visibility executor should call this:
138
+ * the window has to stay on screen for as long as any capture stream is reading the compositor, and that decision belongs to decideWindowVisibility in
139
+ * windowSync.ts.
64
140
  * @param page - The Puppeteer page object.
65
141
  */
66
142
  export async function minimizeWindow(page) {
@@ -81,11 +157,18 @@ export async function minimizeWindow(page) {
81
157
  });
82
158
  }
83
159
  /**
84
- * Un-minimizes the browser window, restoring it to normal state. This is used when the user needs to interact with the browser, such as during the authentication
85
- * login flow where the user must complete TV provider authentication in the visible browser window.
160
+ * Un-minimizes the browser window, restoring it to normal state. The window belongs on screen while a capture stream is reading the compositor's output for it, and
161
+ * while a user is completing TV provider authentication in it. The capability probe calls this directly to make its environment representative of the one capture
162
+ * runs in; every other caller goes through the window-visibility executor, which owns the policy.
163
+ *
164
+ * The contract is a confirmed state, not a fired command: this resolves once Chrome reports the window restored, or once the ceiling lapses with a warning and the
165
+ * window left in whatever state it does report. On macOS a restore runs asynchronously against the acknowledgement of the command that asked for it, and a capture
166
+ * requested against a window still mid-restore is the shape of the 2026-08-26 through 08-28 capture-start failures. A window already on screen confirms on its
167
+ * first read, so the confirmation costs one round trip on the common path.
86
168
  * @param page - The Puppeteer page object.
169
+ * @param clock - Clock driving the confirmation cadence and its elapsed measurement. Defaults to the system clock; tests inject a virtual clock.
87
170
  */
88
- export async function unminimizeWindow(page) {
171
+ export async function unminimizeWindow(page, clock = systemClock) {
89
172
  // Early exit if the page is already closed.
90
173
  if (page.isClosed()) {
91
174
  return;
@@ -96,6 +179,61 @@ export async function unminimizeWindow(page) {
96
179
  bounds: { windowState: "normal" },
97
180
  windowId
98
181
  });
182
+ // Confirm the restore against Chrome's own report rather than against the acknowledgement above, which arrives while the window manager is still working.
183
+ const startedAt = clock.now();
184
+ const outcome = await pollUntil({ cadenceMs: WINDOW_STATE_POLL_MS, ceilingMs: WINDOW_RESTORE_CEILING_MS, clock,
185
+ read: () => readWindowStateWith(session, windowId), until: (state) => state === "normal" });
186
+ if (outcome.status === "lapsed") {
187
+ /* A lapse is reported and then stepped past. The window's presentation is the caller's precondition, not its permission: blocking capture on a window that
188
+ * will not report itself restored would convert a presentation fault into a stream failure, which is strictly worse than capturing against a window whose
189
+ * state we have named in the log.
190
+ */
191
+ LOG.warn("The browser window did not report a completed restore within %dms; continuing with the window in its reported state.", WINDOW_RESTORE_CEILING_MS, { windowState: outcome.value });
192
+ }
193
+ else {
194
+ LOG.debug("browser:lifecycle", "The window reported its restore complete after %dms (%d reads).", clock.now() - startedAt, outcome.reads);
195
+ }
99
196
  });
100
197
  }
198
+ /**
199
+ * Re-issues a capture page's own declared device metrics. Chrome composes the capture of a selected tab from the window's fitted presentation rather than from the
200
+ * emulated surface, and the override event is what re-selects the composition target: a capture composing the window's view of the page returns to the full
201
+ * emulated surface, and a capture already composing that surface is left exactly as it was. Callable at any time, from anywhere, at any frequency, because the
202
+ * values sent are the ones Puppeteer has already declared on this page - nothing about the page's emulation changes.
203
+ *
204
+ * The command is issued raw rather than through page.setViewport, which drops an override whose values match the standing one. It is the event, not a change of
205
+ * values, that does the work here.
206
+ * @param page - The page to re-affirm. A page carrying no explicitly declared density is left alone.
207
+ * @throws Whatever the CDP send rejects with. Each trigger site decides whether that matters to it.
208
+ */
209
+ export async function reaffirmCaptureSurface(page) {
210
+ /* An explicitly declared, positive density is precisely the mark of a capture page, which is what makes this function safe to fire at any page from any trigger.
211
+ * A page PrismCast has not emulated carries no viewport at all and falls out on the first test; a page emulated for layout declares the display's own density
212
+ * through Chrome's disable value of 0, which the positive test excludes. The narrowing runs in two steps because the send forwards the page's own dimensions as
213
+ * well: the record is nullable, and its density is optional where CDP's field is required.
214
+ */
215
+ const viewport = page.viewport();
216
+ if (!viewport) {
217
+ return;
218
+ }
219
+ const deviceScaleFactor = viewport.deviceScaleFactor;
220
+ if ((typeof deviceScaleFactor !== "number") || !(deviceScaleFactor > 0)) {
221
+ return;
222
+ }
223
+ const session = await page.createCDPSession();
224
+ try {
225
+ await session.send("Emulation.setDeviceMetricsOverride", { deviceScaleFactor, height: viewport.height, mobile: false, width: viewport.width });
226
+ }
227
+ finally {
228
+ /* The detach carries a catch of its own. A page that dies mid-send takes its session with it, and a throw raised out of this finally would replace the send's
229
+ * rejection with a detach failure the caller can do nothing about - the send's own reason has to reach the caller unaltered.
230
+ */
231
+ try {
232
+ await session.detach();
233
+ }
234
+ catch {
235
+ // The session is already gone, which is the state the detach was asking for.
236
+ }
237
+ }
238
+ }
101
239
  //# sourceMappingURL=cdp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cdp.js","sourceRoot":"","sources":["../../src/browser/cdp.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5D;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAU,EACV,SAAgE;IAGhE,oHAAoH;IACpH,IAAG,IAAI,CAAC,QAAQ,EAAE,EAAE,C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,CAAC,KAAK,UAAU,sBAAsB,CAAC,IAAU;IAErD;;;;OAIG;IACH,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IAEjC,IAAG,CAAC,QAAQ,EAAE,CAAC;QAEb,OAAO;IACT,CAAC;IAED,MAAM,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC;IAErD,IAAG,CAAC,OAAO,iBAAiB,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC,EAAE,CAAC;QAEvE,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAE9C,IAAI,CAAC;QAEH,MAAM,OAAO,CAAC,IAAI,CAAC,oCAAoC,EAAE,EAAE,iBAAiB,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IACjJ,CAAC;YAAS,CAAC;QAET;;WAEG;QACH,IAAI,CAAC;YAEH,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;QACzB,CAAC;QAAC,MAAM,CAAC;YAEP,6EAA6E;QAC/E,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,4 +1,5 @@
1
- import type { ChannelSelectorResult, Nullable, ProviderModule, ResolvedSiteProfile } from "../types/index.ts";
1
+ import type { ChannelSelectorResult, Nullable, ProviderModule, ResolvedSiteProfile, StrategyNavigator } from "../types/index.ts";
2
+ import type { Clock } from "homebridge-plugin-utils";
2
3
  import type { Page } from "puppeteer-core";
3
4
  /**
4
5
  * Returns a direct watch URL for the channel specified in the profile, if one can be resolved. Looks up the strategy entry's resolveDirectUrl hook and calls it
@@ -32,8 +33,8 @@ export declare function resolveDirectUrl(profile: ResolvedSiteProfile, page: Pag
32
33
  */
33
34
  export declare function invalidateDirectUrl(profile: ResolvedSiteProfile, cause: unknown): boolean;
34
35
  /**
35
- * Clears all channel selection caches. Called by relinquishBrowserReadiness() in browser/index.ts (shared by the disconnect handler and invalidateBrowser)
36
- * whenever the browser is torn down, since cached state (guide row positions, discovered page URLs, watch URLs) may be stale in a new browser session.
36
+ * Clears all channel selection caches. Called by browser/index.ts wherever a browser session ends - the disconnect handler's readiness relinquish and the restart
37
+ * routine's relaunch - since cached state (guide row positions, discovered page URLs, watch URLs) may be stale in a new browser session.
37
38
  */
38
39
  export declare function clearChannelSelectionCaches(): void;
39
40
  /**
@@ -50,6 +51,13 @@ export declare function getProviderBySlug(slug: string): ProviderModule | undefi
50
51
  * @returns The matching provider module or undefined.
51
52
  */
52
53
  export declare function getProviderByStrategy(strategyName: string): ProviderModule | undefined;
54
+ /**
55
+ * Returns the strategy's own navigator for the given profile, when its provider declares one. The navigation and reload functions in video.ts read this ahead of
56
+ * every document load, so a provider that owns its route into its site is honored on every path without the callers knowing which provider it is.
57
+ * @param profile - The resolved site profile.
58
+ * @returns The navigator, or undefined when the strategy loads its pages by URL.
59
+ */
60
+ export declare function getStrategyNavigator(profile: ResolvedSiteProfile): StrategyNavigator | undefined;
53
61
  /**
54
62
  * Returns all registered provider module slugs. Used for validation in the checkboxList setting for precache providers.
55
63
  * @returns Array of provider slugs.
@@ -110,6 +118,11 @@ export { logAvailableChannels, normalizeChannelName, resolveMatchSelector, scrol
110
118
  * Options that callers may supply to selectChannel(). All fields are optional; selectChannel() may be called with no options.
111
119
  */
112
120
  export interface SelectChannelOptions {
121
+ /**
122
+ * The clock the pre-selection scroll poll's cadence and ceiling read. Defaults to the system clock, so a caller that holds no clock passes nothing. The tune
123
+ * orchestrator threads its own clock here, while the provider strategies behind the shared strategy types keep running on the poll policy's default.
124
+ */
125
+ readonly clock?: Clock;
113
126
  /**
114
127
  * Callback invoked when the resolution layer converts a category selector to a concrete per-user channel identifier. The framework calls this with the resolved
115
128
  * call sign so the caller can persist the value to the user's channel store. After persistence, subsequent tunes start with the concrete selector and skip the
@@ -122,7 +135,7 @@ export interface SelectChannelOptions {
122
135
  * Null/undefined means "do not persist." The resolution still happens and the resolved selector is used for this tune; it just isn't saved. Useful for ad-hoc
123
136
  * tunes (no associated channel record) and for testing.
124
137
  */
125
- persistResolution?: (resolvedSelector: string) => Promise<void>;
138
+ readonly persistResolution?: (resolvedSelector: string) => Promise<void>;
126
139
  }
127
140
  /**
128
141
  * Selects a channel from a multi-channel player UI using the strategy specified in the profile. This is the main entry point for channel selection, called by
@@ -140,8 +153,7 @@ export interface SelectChannelOptions {
140
153
  * - Strategy dispatch based on profile.channelSelection.strategy.
141
154
  * @param page - The Puppeteer page object.
142
155
  * @param profile - The resolved site profile containing channelSelection config and channelSelector slug.
143
- * @param options - Optional callbacks for the resolution layer. Currently the only field is persistResolution.
156
+ * @param options - The clock the scroll poll runs on and the resolution layer's persistence callback. See SelectChannelOptions.
144
157
  * @returns Result object with success status and optional failure reason.
145
158
  */
146
159
  export declare function selectChannel(page: Page, profile: ResolvedSiteProfile, options?: SelectChannelOptions): Promise<ChannelSelectorResult>;
147
- //# sourceMappingURL=channelSelection.d.ts.map