prismcast 1.12.0 → 1.12.1

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 (293) hide show
  1. package/dist/app.d.ts +41 -0
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js +156 -69
  4. package/dist/app.js.map +1 -1
  5. package/dist/browser/browserSupervisor.d.ts +30 -1
  6. package/dist/browser/browserSupervisor.d.ts.map +1 -1
  7. package/dist/browser/browserSupervisor.js +39 -12
  8. package/dist/browser/browserSupervisor.js.map +1 -1
  9. package/dist/browser/cdp.d.ts +58 -5
  10. package/dist/browser/cdp.d.ts.map +1 -1
  11. package/dist/browser/cdp.js +146 -9
  12. package/dist/browser/cdp.js.map +1 -1
  13. package/dist/browser/channelSelection.d.ts +2 -2
  14. package/dist/browser/channelSelection.d.ts.map +1 -1
  15. package/dist/browser/channelSelection.js +5 -5
  16. package/dist/browser/channelSelection.js.map +1 -1
  17. package/dist/browser/consent.d.ts +16 -0
  18. package/dist/browser/consent.d.ts.map +1 -1
  19. package/dist/browser/consent.js +67 -15
  20. package/dist/browser/consent.js.map +1 -1
  21. package/dist/browser/hlsPlaylistObserver.js +2 -2
  22. package/dist/browser/hlsPlaylistObserver.js.map +1 -1
  23. package/dist/browser/index.d.ts +212 -48
  24. package/dist/browser/index.d.ts.map +1 -1
  25. package/dist/browser/index.js +612 -199
  26. package/dist/browser/index.js.map +1 -1
  27. package/dist/browser/login.d.ts +4 -4
  28. package/dist/browser/login.d.ts.map +1 -1
  29. package/dist/browser/login.js +19 -19
  30. package/dist/browser/login.js.map +1 -1
  31. package/dist/browser/manifestInterceptor.js +1 -1
  32. package/dist/browser/pageStaleness.d.ts +1 -1
  33. package/dist/browser/pageStaleness.d.ts.map +1 -1
  34. package/dist/browser/pageStaleness.js +9 -9
  35. package/dist/browser/pageStaleness.js.map +1 -1
  36. package/dist/browser/precaching.d.ts +23 -11
  37. package/dist/browser/precaching.d.ts.map +1 -1
  38. package/dist/browser/precaching.js +188 -49
  39. package/dist/browser/precaching.js.map +1 -1
  40. package/dist/browser/tabCapture.d.ts +100 -0
  41. package/dist/browser/tabCapture.d.ts.map +1 -0
  42. package/dist/browser/tabCapture.js +320 -0
  43. package/dist/browser/tabCapture.js.map +1 -0
  44. package/dist/browser/tabSelection.d.ts +117 -0
  45. package/dist/browser/tabSelection.d.ts.map +1 -0
  46. package/dist/browser/tabSelection.js +546 -0
  47. package/dist/browser/tabSelection.js.map +1 -0
  48. package/dist/browser/tuning/comcastPolymer.js +2 -2
  49. package/dist/browser/tuning/comcastPolymer.js.map +1 -1
  50. package/dist/browser/tuning/directv.js +1 -1
  51. package/dist/browser/tuning/directv.js.map +1 -1
  52. package/dist/browser/tuning/hbo.js +2 -2
  53. package/dist/browser/tuning/hbo.js.map +1 -1
  54. package/dist/browser/tuning/hulu.d.ts.map +1 -1
  55. package/dist/browser/tuning/hulu.js +9 -6
  56. package/dist/browser/tuning/hulu.js.map +1 -1
  57. package/dist/browser/tuning/shared.d.ts +1 -1
  58. package/dist/browser/tuning/shared.js +1 -1
  59. package/dist/browser/tuning/youtubeTv.d.ts.map +1 -1
  60. package/dist/browser/tuning/youtubeTv.js +1 -2
  61. package/dist/browser/tuning/youtubeTv.js.map +1 -1
  62. package/dist/browser/video.d.ts +33 -13
  63. package/dist/browser/video.d.ts.map +1 -1
  64. package/dist/browser/video.js +113 -52
  65. package/dist/browser/video.js.map +1 -1
  66. package/dist/browser/windowSync.d.ts +46 -0
  67. package/dist/browser/windowSync.d.ts.map +1 -0
  68. package/dist/browser/windowSync.js +153 -0
  69. package/dist/browser/windowSync.js.map +1 -0
  70. package/dist/channels/index.d.ts +7 -0
  71. package/dist/channels/index.d.ts.map +1 -1
  72. package/dist/channels/index.js +24 -8
  73. package/dist/channels/index.js.map +1 -1
  74. package/dist/config/consistencyProbe.js +1 -1
  75. package/dist/config/consistencyProbe.js.map +1 -1
  76. package/dist/config/health.d.ts.map +1 -1
  77. package/dist/config/health.js +0 -3
  78. package/dist/config/health.js.map +1 -1
  79. package/dist/config/index.d.ts +12 -0
  80. package/dist/config/index.d.ts.map +1 -1
  81. package/dist/config/index.js +77 -31
  82. package/dist/config/index.js.map +1 -1
  83. package/dist/config/paths.d.ts +17 -1
  84. package/dist/config/paths.d.ts.map +1 -1
  85. package/dist/config/paths.js +21 -1
  86. package/dist/config/paths.js.map +1 -1
  87. package/dist/config/persistence.d.ts +8 -3
  88. package/dist/config/persistence.d.ts.map +1 -1
  89. package/dist/config/persistence.js +143 -82
  90. package/dist/config/persistence.js.map +1 -1
  91. package/dist/config/profiles.d.ts.map +1 -1
  92. package/dist/config/profiles.js +2 -3
  93. package/dist/config/profiles.js.map +1 -1
  94. package/dist/config/providerLineups.d.ts.map +1 -1
  95. package/dist/config/providerLineups.js +0 -3
  96. package/dist/config/providerLineups.js.map +1 -1
  97. package/dist/config/services.js +1 -1
  98. package/dist/config/services.js.map +1 -1
  99. package/dist/config/sites.d.ts.map +1 -1
  100. package/dist/config/sites.js +77 -58
  101. package/dist/config/sites.js.map +1 -1
  102. package/dist/config/userChannels.d.ts +0 -1
  103. package/dist/config/userChannels.d.ts.map +1 -1
  104. package/dist/config/userChannels.js +1 -5
  105. package/dist/config/userChannels.js.map +1 -1
  106. package/dist/config/userConfig.d.ts +15 -3
  107. package/dist/config/userConfig.d.ts.map +1 -1
  108. package/dist/config/userConfig.js +119 -25
  109. package/dist/config/userConfig.js.map +1 -1
  110. package/dist/config/userProfiles.d.ts.map +1 -1
  111. package/dist/config/userProfiles.js +10 -11
  112. package/dist/config/userProfiles.js.map +1 -1
  113. package/dist/hdhr/protocol.d.ts +1 -1
  114. package/dist/hdhr/protocol.js +1 -1
  115. package/dist/hdhr/udp.d.ts.map +1 -1
  116. package/dist/hdhr/udp.js +16 -4
  117. package/dist/hdhr/udp.js.map +1 -1
  118. package/dist/index.js +10 -3
  119. package/dist/index.js.map +1 -1
  120. package/dist/native/index.d.ts +1 -1
  121. package/dist/native/index.js +3 -3
  122. package/dist/native/probe.js +1 -1
  123. package/dist/native/proxy.d.ts +1 -1
  124. package/dist/native/proxy.js +5 -5
  125. package/dist/native/proxy.js.map +1 -1
  126. package/dist/routes/cdp.js +1 -1
  127. package/dist/routes/config/channels/endpoints/bulk.js +2 -2
  128. package/dist/routes/config/channels/endpoints/bulk.js.map +1 -1
  129. package/dist/routes/config/channels/endpoints/crud.js +1 -1
  130. package/dist/routes/config/channels/endpoints/crud.js.map +1 -1
  131. package/dist/routes/config/channels/endpoints/tags.js +3 -3
  132. package/dist/routes/config/channels/endpoints/tags.js.map +1 -1
  133. package/dist/routes/config/channels/healthBridge.d.ts +4 -0
  134. package/dist/routes/config/channels/healthBridge.d.ts.map +1 -1
  135. package/dist/routes/config/channels/healthBridge.js +9 -5
  136. package/dist/routes/config/channels/healthBridge.js.map +1 -1
  137. package/dist/routes/config/channels/table.d.ts.map +1 -1
  138. package/dist/routes/config/channels/table.js +64 -133
  139. package/dist/routes/config/channels/table.js.map +1 -1
  140. package/dist/routes/config/http/envelope.d.ts +1 -1
  141. package/dist/routes/config/index.d.ts +5 -4
  142. package/dist/routes/config/index.d.ts.map +1 -1
  143. package/dist/routes/config/index.js +5 -4
  144. package/dist/routes/config/index.js.map +1 -1
  145. package/dist/routes/config/services.d.ts.map +1 -1
  146. package/dist/routes/config/services.js +13 -16
  147. package/dist/routes/config/services.js.map +1 -1
  148. package/dist/routes/config/settings.d.ts +6 -14
  149. package/dist/routes/config/settings.d.ts.map +1 -1
  150. package/dist/routes/config/settings.js +14 -34
  151. package/dist/routes/config/settings.js.map +1 -1
  152. package/dist/routes/debug.js +1 -1
  153. package/dist/routes/debug.js.map +1 -1
  154. package/dist/routes/health.d.ts +15 -6
  155. package/dist/routes/health.d.ts.map +1 -1
  156. package/dist/routes/health.js +22 -10
  157. package/dist/routes/health.js.map +1 -1
  158. package/dist/routes/logs.d.ts.map +1 -1
  159. package/dist/routes/logs.js +50 -12
  160. package/dist/routes/logs.js.map +1 -1
  161. package/dist/routes/root/content.d.ts.map +1 -1
  162. package/dist/routes/root/content.js +32 -11
  163. package/dist/routes/root/content.js.map +1 -1
  164. package/dist/routes/root/index.d.ts +10 -0
  165. package/dist/routes/root/index.d.ts.map +1 -1
  166. package/dist/routes/root/index.js +17 -7
  167. package/dist/routes/root/index.js.map +1 -1
  168. package/dist/routes/root/scripts/channels.d.ts.map +1 -1
  169. package/dist/routes/root/scripts/channels.js +9 -19
  170. package/dist/routes/root/scripts/channels.js.map +1 -1
  171. package/dist/routes/root/scripts/clientEscape.js +1 -1
  172. package/dist/routes/root/scripts/config.js +3 -3
  173. package/dist/routes/root/scripts/config.js.map +1 -1
  174. package/dist/routes/root/scripts/shared.d.ts.map +1 -1
  175. package/dist/routes/root/scripts/shared.js +16 -13
  176. package/dist/routes/root/scripts/shared.js.map +1 -1
  177. package/dist/routes/root/scripts/status.handlers.d.ts +3 -0
  178. package/dist/routes/root/scripts/status.handlers.d.ts.map +1 -1
  179. package/dist/routes/root/scripts/status.handlers.js +49 -24
  180. package/dist/routes/root/scripts/status.handlers.js.map +1 -1
  181. package/dist/routes/root/styles.d.ts.map +1 -1
  182. package/dist/routes/root/styles.js +10 -18
  183. package/dist/routes/root/styles.js.map +1 -1
  184. package/dist/routes/theme.js +3 -3
  185. package/dist/routes/theme.js.map +1 -1
  186. package/dist/routes/ui.js +5 -5
  187. package/dist/routes/ui.js.map +1 -1
  188. package/dist/streaming/captureLock.js +2 -2
  189. package/dist/streaming/captureLock.js.map +1 -1
  190. package/dist/streaming/fmp4Segmenter.d.ts +9 -5
  191. package/dist/streaming/fmp4Segmenter.d.ts.map +1 -1
  192. package/dist/streaming/fmp4Segmenter.js +28 -7
  193. package/dist/streaming/fmp4Segmenter.js.map +1 -1
  194. package/dist/streaming/hls.d.ts +62 -2
  195. package/dist/streaming/hls.d.ts.map +1 -1
  196. package/dist/streaming/hls.js +161 -117
  197. package/dist/streaming/hls.js.map +1 -1
  198. package/dist/streaming/hlsSegments.d.ts +2 -1
  199. package/dist/streaming/hlsSegments.d.ts.map +1 -1
  200. package/dist/streaming/hlsSegments.js +19 -4
  201. package/dist/streaming/hlsSegments.js.map +1 -1
  202. package/dist/streaming/lifecycle.d.ts.map +1 -1
  203. package/dist/streaming/lifecycle.js +25 -7
  204. package/dist/streaming/lifecycle.js.map +1 -1
  205. package/dist/streaming/monitor.d.ts +11 -1
  206. package/dist/streaming/monitor.d.ts.map +1 -1
  207. package/dist/streaming/monitor.js +386 -179
  208. package/dist/streaming/monitor.js.map +1 -1
  209. package/dist/streaming/mpegts.d.ts +11 -0
  210. package/dist/streaming/mpegts.d.ts.map +1 -1
  211. package/dist/streaming/mpegts.js +69 -21
  212. package/dist/streaming/mpegts.js.map +1 -1
  213. package/dist/streaming/preroll.js +3 -3
  214. package/dist/streaming/preroll.js.map +1 -1
  215. package/dist/streaming/recovery.d.ts +90 -4
  216. package/dist/streaming/recovery.d.ts.map +1 -1
  217. package/dist/streaming/recovery.js +86 -11
  218. package/dist/streaming/recovery.js.map +1 -1
  219. package/dist/streaming/registry.d.ts +79 -10
  220. package/dist/streaming/registry.d.ts.map +1 -1
  221. package/dist/streaming/registry.js +73 -2
  222. package/dist/streaming/registry.js.map +1 -1
  223. package/dist/streaming/setup.d.ts +56 -30
  224. package/dist/streaming/setup.d.ts.map +1 -1
  225. package/dist/streaming/setup.js +290 -224
  226. package/dist/streaming/setup.js.map +1 -1
  227. package/dist/streaming/statusEmitter.d.ts +4 -1
  228. package/dist/streaming/statusEmitter.d.ts.map +1 -1
  229. package/dist/streaming/statusEmitter.js +19 -7
  230. package/dist/streaming/statusEmitter.js.map +1 -1
  231. package/dist/types/channels.d.ts.map +1 -1
  232. package/dist/types/channels.js +0 -4
  233. package/dist/types/channels.js.map +1 -1
  234. package/dist/types/index.d.ts +3 -2
  235. package/dist/types/index.d.ts.map +1 -1
  236. package/dist/types/index.js +2 -1
  237. package/dist/types/index.js.map +1 -1
  238. package/dist/types/profiles.d.ts +50 -8
  239. package/dist/types/profiles.d.ts.map +1 -1
  240. package/dist/types/profiles.js +35 -1
  241. package/dist/types/profiles.js.map +1 -1
  242. package/dist/types/streaming.d.ts +8 -0
  243. package/dist/types/streaming.d.ts.map +1 -1
  244. package/dist/types/streaming.js +7 -0
  245. package/dist/types/streaming.js.map +1 -1
  246. package/dist/upgrade/commands.js +1 -1
  247. package/dist/upgrade/commands.js.map +1 -1
  248. package/dist/upgrade/detection.d.ts +1 -1
  249. package/dist/utils/bootSession.context.js +1 -1
  250. package/dist/utils/bootSession.context.js.map +1 -1
  251. package/dist/utils/debugFilter.d.ts.map +1 -1
  252. package/dist/utils/debugFilter.js +5 -3
  253. package/dist/utils/debugFilter.js.map +1 -1
  254. package/dist/utils/delay.d.ts +31 -1
  255. package/dist/utils/delay.d.ts.map +1 -1
  256. package/dist/utils/delay.js +39 -3
  257. package/dist/utils/delay.js.map +1 -1
  258. package/dist/utils/errors.d.ts +0 -10
  259. package/dist/utils/errors.d.ts.map +1 -1
  260. package/dist/utils/errors.js +3 -14
  261. package/dist/utils/errors.js.map +1 -1
  262. package/dist/utils/ffmpeg.d.ts +1 -0
  263. package/dist/utils/ffmpeg.d.ts.map +1 -1
  264. package/dist/utils/ffmpeg.js +2 -1
  265. package/dist/utils/ffmpeg.js.map +1 -1
  266. package/dist/utils/fileLogger.d.ts +23 -5
  267. package/dist/utils/fileLogger.d.ts.map +1 -1
  268. package/dist/utils/fileLogger.js +230 -99
  269. package/dist/utils/fileLogger.js.map +1 -1
  270. package/dist/utils/format.d.ts +24 -1
  271. package/dist/utils/format.d.ts.map +1 -1
  272. package/dist/utils/format.js +37 -1
  273. package/dist/utils/format.js.map +1 -1
  274. package/dist/utils/index.d.ts +1 -0
  275. package/dist/utils/index.d.ts.map +1 -1
  276. package/dist/utils/index.js +1 -0
  277. package/dist/utils/index.js.map +1 -1
  278. package/dist/utils/morganStream.d.ts +2 -2
  279. package/dist/utils/morganStream.d.ts.map +1 -1
  280. package/dist/utils/morganStream.js +6 -8
  281. package/dist/utils/morganStream.js.map +1 -1
  282. package/dist/utils/never.d.ts +9 -0
  283. package/dist/utils/never.d.ts.map +1 -0
  284. package/dist/utils/never.js +20 -0
  285. package/dist/utils/never.js.map +1 -0
  286. package/dist/utils/sanitize.d.ts +8 -0
  287. package/dist/utils/sanitize.d.ts.map +1 -1
  288. package/dist/utils/sanitize.js +19 -0
  289. package/dist/utils/sanitize.js.map +1 -1
  290. package/dist/utils/version.d.ts +9 -4
  291. package/dist/utils/version.d.ts.map +1 -1
  292. package/dist/utils/version.js.map +1 -1
  293. package/package.json +5 -5
package/dist/app.d.ts CHANGED
@@ -1,4 +1,45 @@
1
+ import type { IncomingMessage } from "node:http";
2
+ import type { Nullable } from "./types/index.ts";
1
3
  import type { ParsedArgs } from "./index.ts";
4
+ /**
5
+ * Records a request's arrival time. Registered ahead of the logger so both readers of the elapsed time measure from the moment the request reached the app rather
6
+ * than from whenever the logger happened to see it.
7
+ * @param req - The incoming request.
8
+ * @param _res - The response, unused.
9
+ * @param next - The next middleware in the chain.
10
+ */
11
+ export declare function stampRequestStart(req: IncomingMessage, _res: unknown, next: () => void): void;
12
+ /**
13
+ * Renders a request's elapsed time in milliseconds with three decimals, matching the shape morgan's own timing token produces, or an empty string when the request
14
+ * carries no stamp. An unstamped request is the ordering case: a request that reached morgan without passing the stamping middleware has no time to report, and an
15
+ * empty rendering leaves the log line's shape intact rather than printing a fabricated zero.
16
+ * @param req - The incoming request.
17
+ * @returns The elapsed milliseconds as a fixed-3 string, or an empty string.
18
+ */
19
+ export declare function elapsedMillis(req: IncomingMessage): string;
20
+ /**
21
+ * Decides whether errors mode skips a request. Errors mode logs 4xx and 5xx only, minus the expected non-errors: a 404 for an asset the browser asked
22
+ * for on its own, and a 503 carrying Retry-After, which announces a temporary unavailability the server chose rather than a fault.
23
+ * @param request - The response status, the request URL, and whether a Retry-After header is present.
24
+ * @returns True when the request should not be logged.
25
+ */
26
+ export declare function skipInErrorsMode(request: {
27
+ hasRetryAfter: boolean;
28
+ statusCode: number;
29
+ url: string;
30
+ }): boolean;
31
+ /**
32
+ * Decides whether filtered mode skips a request. Errors, slow requests, and the streaming and management endpoints are always logged; the high-frequency polling
33
+ * endpoints and the landing page are skipped when they succeed; everything else is logged. A request with no elapsed reading is treated as not slow, so the
34
+ * remaining rules decide it.
35
+ * @param request - The elapsed milliseconds (null when unstamped), the response status, and the request URL.
36
+ * @returns True when the request should not be logged.
37
+ */
38
+ export declare function skipInFilteredMode(request: {
39
+ elapsedMs: Nullable<number>;
40
+ statusCode: number;
41
+ url: string;
42
+ }): boolean;
2
43
  /**
3
44
  * Releases the server instance slot if this process owns it. Called during graceful shutdown and from the process exit handler. The ownership check is
4
45
  * structural (release() reads the on-disk record and refuses to remove a file belonging to a different PID), so a rejected-duplicate startup whose exit
package/dist/app.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA0X7C;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAU1C;AAuDD;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAuOvE"}
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAU,MAAM,WAAW,CAAC;AAgBzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAuO7C;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI,CAK7F;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAK1D;AAmBD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IAAE,aAAa,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAgB9G;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAAE,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CA4BrH;AAmJD;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAU1C;AAuDD;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwOvE"}
package/dist/app.js CHANGED
@@ -3,10 +3,11 @@
3
3
  * app.ts: Express application builder for PrismCast.
4
4
  */
5
5
  import { CONFIG, displayConfiguration, initializeConfiguration, persistCoercedConfig, validateConfiguration } from "./config/index.js";
6
- import { LOG, claim, createMorganStream, formatError, formatTimestamp, getCurrentPattern, getPackageVersion, isDebugLogging, release, resolveFFmpegPath, setConsoleLogging, startUpdateChecking, stopUpdateChecking } from "./utils/index.js";
7
- import { closeBrowser, ensureDataDirectory, getCurrentBrowser, killStaleChrome, minimizeBrowserWindow, prepareExtension, setGracefulShutdown, setLoginModeEndObserver, startBrowserRestartChecking, startStalePageCleanup, stopBrowserRestartChecking, stopStalePageCleanup } from "./browser/index.js";
6
+ import { LOG, boundedWait, claim, createMorganStream, formatError, formatTimestamp, getCurrentPattern, getPackageVersion, isDebugLogging, release, resolveFFmpegPath, setConsoleLogging, startUpdateChecking, stopUpdateChecking } from "./utils/index.js";
7
+ import { closeBrowser, ensureDataDirectory, getCurrentBrowser, killStaleChrome, prepareExtension, setGracefulShutdown, setLoginModeEndObserver, startBrowserRestartChecking, startStalePageCleanup, stopBrowserRestartChecking, stopStalePageCleanup, syncWindowVisibility } from "./browser/index.js";
8
8
  import { ensureAllMigrated, snapshotAllForRelease } from "./config/persistence.js";
9
9
  import { flushHealthStateNow, loadHealthState } from "./config/health.js";
10
+ import { getAllStreams, isCaptureIdentity } from "./streaming/registry.js";
10
11
  import { getDebugEnv, getLogFilePath, getServerPidFilePath } from "./config/paths.js";
11
12
  import { initializeFileLogger, shutdownFileLogger } from "./utils/fileLogger.js";
12
13
  import { loadResumeState, saveResumeState } from "./streaming/hlsResume.js";
@@ -19,7 +20,6 @@ import { cleanupIdleStreams } from "./streaming/hls.js";
19
20
  import compression from "compression";
20
21
  import express from "express";
21
22
  import { generatePreroll } from "./streaming/preroll.js";
22
- import { getAllStreams } from "./streaming/registry.js";
23
23
  import { initializeUserChannels } from "./config/userChannels.js";
24
24
  import { initializeUserProfiles } from "./config/userProfiles.js";
25
25
  import { installHealthBridge } from "./routes/config/channels/healthBridge.js";
@@ -38,6 +38,9 @@ let usingConsoleLogging = false;
38
38
  /* The HTTP server instance is stored globally so it can be closed during graceful shutdown.
39
39
  */
40
40
  let server = null;
41
+ // How long shutdown waits for the HTTP server to finish closing. The bound keeps a socket the close cannot reach from holding the process open through its own
42
+ // shutdown, exactly as the file logger's drain bound does for a wedged filesystem operation.
43
+ const SERVER_CLOSE_BOUND_MS = 5000;
41
44
  /* The background-service teardown stack. Each long-lived background service (stale-page sweep, browser-restart watchdog, idle cleanup, show-info/pretune polling,
42
45
  * update check) registers its stop here at the moment it starts in startServer(); graceful shutdown disposes the stack wholesale, so a future service cannot be
43
46
  * started without also being torn down. An AsyncDisposableStack is used (rather than the synchronous DisposableStack) so the teardown awaits each registered stop -
@@ -98,7 +101,7 @@ function setupGracefulShutdown() {
98
101
  // via drop_until_next_sequence when the playlist range would otherwise jump past it.
99
102
  const resumeEntries = [];
100
103
  for (const stream of streams) {
101
- const segmenter = stream.captureSession?.segmenter;
104
+ const segmenter = isCaptureIdentity(stream) ? stream.identity.captureSession?.segmenter : undefined;
102
105
  if (stream.info.storeKey && segmenter) {
103
106
  resumeEntries.push({
104
107
  channelName: stream.info.storeKey,
@@ -119,20 +122,36 @@ function setupGracefulShutdown() {
119
122
  await closeBrowser();
120
123
  // Release the server instance slot so the next startup does not see a stale identity file.
121
124
  releaseInstanceSlot();
122
- // Close the HTTP server.
125
+ /* Close the HTTP server. The close is awaited so its own line lands while the file logger is still open, which the shutdown below ends. Connections are
126
+ * destroyed first because the status and log SSE streams (routes/streams.ts and routes/logs.ts) hold their sockets open with a heartbeat, and the close
127
+ * waits on every one of them; the CDP proxy's WebSocket clients have already closed themselves with 1001 in response to the browser disconnect above. An
128
+ * in-flight request ends with the process either way, because the exit follows immediately.
129
+ */
123
130
  try {
124
131
  if (server) {
125
- server.close(() => {
126
- LOG.info("HTTP server closed successfully.");
132
+ const { promise: closed, resolve } = Promise.withResolvers();
133
+ server.close((error) => {
134
+ if (error) {
135
+ LOG.error("Error closing server during shutdown: %s.", formatError(error));
136
+ }
137
+ else {
138
+ LOG.info("HTTP server closed successfully.");
139
+ }
140
+ resolve(true);
127
141
  });
142
+ server.closeAllConnections();
143
+ if ((await boundedWait(closed, SERVER_CLOSE_BOUND_MS)) === null) {
144
+ LOG.warn("The HTTP server did not close within %sms. Continuing the shutdown.", SERVER_CLOSE_BOUND_MS);
145
+ }
128
146
  }
129
147
  }
130
148
  catch (error) {
131
149
  LOG.error("Error closing server during shutdown: %s.", formatError(error));
132
150
  }
133
- // Shut down file logger if in use.
151
+ // Shut down file logger if in use. Awaited because shutdown drains the outstanding write chain before its final synchronous flush, and the process exit below
152
+ // would otherwise cut that drain short.
134
153
  if (!usingConsoleLogging) {
135
- shutdownFileLogger();
154
+ await shutdownFileLogger();
136
155
  }
137
156
  process.exit(0);
138
157
  }
@@ -143,6 +162,109 @@ function setupGracefulShutdown() {
143
162
  void shutdown();
144
163
  });
145
164
  }
165
+ // HTTP request logging.
166
+ /* Every request's elapsed time comes from one stamp taken by the middleware below, and both readers of that time - the log line's token and the filtered mode's
167
+ * slow-request rule - derive from it. A single stamp is what lets the two agree: a rule that consulted a different clock than the line it decides to print could
168
+ * hold back a request the line would have reported as slow.
169
+ *
170
+ * process.hrtime.bigint() is the monotonic source, so a system clock adjustment mid-request cannot produce a negative or wildly inflated elapsed reading. The
171
+ * stamps are held in a WeakMap keyed on the request object rather than on a property of it, so a request that never reaches the logger is collected with no
172
+ * bookkeeping and no risk of a stale entry outliving its connection.
173
+ */
174
+ const requestStartStamps = new WeakMap();
175
+ // Requests slower than this are always logged in filtered mode, whatever their path. A second is the threshold at which a response stops feeling immediate to a
176
+ // client, which is the point at which it is worth a log line even on an endpoint the filter otherwise suppresses.
177
+ const SLOW_REQUEST_MS = 1000;
178
+ // Browser-initiated asset requests that return 404. These are noise from browsers automatically requesting files that do not exist.
179
+ const BROWSER_ASSET_PATTERNS = ["/apple-touch-icon", "/favicon", "/robots.txt", "/site.webmanifest"];
180
+ // High-frequency polling endpoints, skipped in filtered mode when they succeed.
181
+ const FILTERED_SKIP_PATTERNS = ["/logs", "/health", "/favicon", "/logo.png", "/logo.svg"];
182
+ // Streaming and management endpoints, always logged in filtered mode because they mark what the server is actually doing.
183
+ const FILTERED_IMPORTANT_PATTERNS = ["/stream", "/streams", "/config", "/playlist", "/debug"];
184
+ /**
185
+ * Records a request's arrival time. Registered ahead of the logger so both readers of the elapsed time measure from the moment the request reached the app rather
186
+ * than from whenever the logger happened to see it.
187
+ * @param req - The incoming request.
188
+ * @param _res - The response, unused.
189
+ * @param next - The next middleware in the chain.
190
+ */
191
+ export function stampRequestStart(req, _res, next) {
192
+ requestStartStamps.set(req, process.hrtime.bigint());
193
+ next();
194
+ }
195
+ /**
196
+ * Renders a request's elapsed time in milliseconds with three decimals, matching the shape morgan's own timing token produces, or an empty string when the request
197
+ * carries no stamp. An unstamped request is the ordering case: a request that reached morgan without passing the stamping middleware has no time to report, and an
198
+ * empty rendering leaves the log line's shape intact rather than printing a fabricated zero.
199
+ * @param req - The incoming request.
200
+ * @returns The elapsed milliseconds as a fixed-3 string, or an empty string.
201
+ */
202
+ export function elapsedMillis(req) {
203
+ const elapsed = elapsedMillisValue(req);
204
+ return (elapsed === null) ? "" : elapsed.toFixed(3);
205
+ }
206
+ /**
207
+ * Reads a request's elapsed time in milliseconds from its start stamp, or null when the request carries no stamp.
208
+ * @param req - The incoming request.
209
+ * @returns The elapsed milliseconds, or null.
210
+ */
211
+ function elapsedMillisValue(req) {
212
+ const startedAt = requestStartStamps.get(req);
213
+ if (startedAt === undefined) {
214
+ return null;
215
+ }
216
+ return Number(process.hrtime.bigint() - startedAt) / 1000000;
217
+ }
218
+ /**
219
+ * Decides whether errors mode skips a request. Errors mode logs 4xx and 5xx only, minus the expected non-errors: a 404 for an asset the browser asked
220
+ * for on its own, and a 503 carrying Retry-After, which announces a temporary unavailability the server chose rather than a fault.
221
+ * @param request - The response status, the request URL, and whether a Retry-After header is present.
222
+ * @returns True when the request should not be logged.
223
+ */
224
+ export function skipInErrorsMode(request) {
225
+ // Skip all non-error responses. In errors-only mode we log only 4xx and 5xx statuses, so any successful response is skipped here.
226
+ if (request.statusCode < 400) {
227
+ return true;
228
+ }
229
+ // Skip 404s for browser asset requests (favicon, apple-touch-icon, etc.).
230
+ if ((request.statusCode === 404) && BROWSER_ASSET_PATTERNS.some((pattern) => request.url.startsWith(pattern))) {
231
+ return true;
232
+ }
233
+ // Skip 503s with Retry-After header. These indicate expected temporary unavailability (e.g., stream starting up) rather than a real error.
234
+ return (request.statusCode === 503) && request.hasRetryAfter;
235
+ }
236
+ /**
237
+ * Decides whether filtered mode skips a request. Errors, slow requests, and the streaming and management endpoints are always logged; the high-frequency polling
238
+ * endpoints and the landing page are skipped when they succeed; everything else is logged. A request with no elapsed reading is treated as not slow, so the
239
+ * remaining rules decide it.
240
+ * @param request - The elapsed milliseconds (null when unstamped), the response status, and the request URL.
241
+ * @returns True when the request should not be logged.
242
+ */
243
+ export function skipInFilteredMode(request) {
244
+ // Always log errors.
245
+ if (request.statusCode >= 400) {
246
+ return false;
247
+ }
248
+ // Always log slow requests.
249
+ if ((request.elapsedMs !== null) && (request.elapsedMs > SLOW_REQUEST_MS)) {
250
+ return false;
251
+ }
252
+ // Always log streaming and management endpoints.
253
+ if (FILTERED_IMPORTANT_PATTERNS.some((pattern) => request.url.startsWith(pattern))) {
254
+ return false;
255
+ }
256
+ // Skip high-frequency endpoints when successful.
257
+ if (FILTERED_SKIP_PATTERNS.some((pattern) => request.url.startsWith(pattern))) {
258
+ return true;
259
+ }
260
+ // Skip successful requests to the root landing page, and log everything else.
261
+ return request.url === "/";
262
+ }
263
+ /* The token is defined once for the process, at module load. morgan's token registry is global to the module, so registering inside the app builder would re-register
264
+ * on every build - harmless today because the definition is constant, but a registration whose count tracks how often the app is assembled is the kind of coupling
265
+ * that only shows up once a second build carries different state.
266
+ */
267
+ morgan.token("elapsed", elapsedMillis);
146
268
  /* The buildApp function creates and configures the Express application with all middleware and routes. This is separated from the server startup to allow for
147
269
  * testing and flexibility in deployment.
148
270
  */
@@ -178,65 +300,29 @@ async function buildApp() {
178
300
  // Configure Morgan for HTTP request logging based on httpLogLevel configuration. Morgan output goes through morganStream which handles timestamp formatting
179
301
  // consistently for both console and file logging modes.
180
302
  if (CONFIG.logging.httpLogLevel !== "none") {
181
- const morganFormat = ":method :url from :remote-addr responded :status in :response-time ms.";
303
+ const morganFormat = ":method :url from :remote-addr responded :status in :elapsed ms.";
182
304
  const morganStream = createMorganStream();
183
- // Patterns for browser-initiated asset requests that return 404. These are noise from browsers automatically requesting files that don't exist.
184
- const browserAssetPatterns = ["/apple-touch-icon", "/favicon", "/robots.txt", "/site.webmanifest"];
305
+ // Stamp each request's arrival before morgan sees it, so the elapsed token and the filtered mode's slow-request rule read the same start time.
306
+ app.use(stampRequestStart);
185
307
  if (CONFIG.logging.httpLogLevel === "errors") {
186
308
  // Log requests with 4xx or 5xx status codes, but skip 404s for common browser asset requests.
187
309
  app.use(morgan(morganFormat, {
188
- skip: (req, res) => {
189
- // Skip all non-error responses. In errors-only mode we log only 4xx and 5xx statuses, so any successful response is skipped here.
190
- if (res.statusCode < 400) {
191
- return true;
192
- }
193
- // Skip 404s for browser asset requests (favicon, apple-touch-icon, etc.).
194
- if (res.statusCode === 404) {
195
- const url = req.originalUrl || req.url;
196
- if (browserAssetPatterns.some((pattern) => url.startsWith(pattern))) {
197
- return true;
198
- }
199
- }
200
- // Skip 503s with Retry-After header. These indicate expected temporary unavailability (e.g., stream starting up) rather than a real error.
201
- if ((res.statusCode === 503) && res.getHeader("Retry-After")) {
202
- return true;
203
- }
204
- return false;
205
- },
310
+ skip: (req, res) => skipInErrorsMode({
311
+ hasRetryAfter: res.getHeader("Retry-After") !== undefined,
312
+ statusCode: res.statusCode,
313
+ url: req.originalUrl || req.url
314
+ }),
206
315
  stream: morganStream
207
316
  }));
208
317
  }
209
318
  else if (CONFIG.logging.httpLogLevel === "filtered") {
210
319
  // Log important requests while skipping high-frequency polling endpoints. We always log errors, slow requests, and critical endpoints.
211
- const skipPatterns = ["/logs", "/health", "/favicon", "/logo.png", "/logo.svg"];
212
320
  app.use(morgan(morganFormat, {
213
- skip: (req, res) => {
214
- // Always log errors.
215
- if (res.statusCode >= 400) {
216
- return false;
217
- }
218
- // Always log slow requests (over 1 second).
219
- const responseTime = parseFloat(res.getHeader("X-Response-Time") || "0");
220
- if (responseTime > 1000) {
221
- return false;
222
- }
223
- // Always log streaming and management endpoints.
224
- const url = req.originalUrl || req.url;
225
- const importantPatterns = ["/stream", "/streams", "/config", "/playlist", "/debug"];
226
- if (importantPatterns.some((pattern) => url.startsWith(pattern))) {
227
- return false;
228
- }
229
- // Skip high-frequency endpoints when successful.
230
- if (skipPatterns.some((pattern) => url.startsWith(pattern))) {
231
- return true;
232
- }
233
- // Skip successful requests to the root landing page.
234
- if ((url === "/") && (res.statusCode < 400)) {
235
- return true;
236
- }
237
- // Log everything else.
238
- return false;
239
- },
321
+ skip: (req, res) => skipInFilteredMode({
322
+ elapsedMs: elapsedMillisValue(req),
323
+ statusCode: res.statusCode,
324
+ url: req.originalUrl || req.url
325
+ }),
240
326
  stream: morganStream
241
327
  }));
242
328
  }
@@ -404,12 +490,13 @@ export async function startServer(parsedArgs) {
404
490
  // claimInstanceSlot() exits with a precise diagnostic when a live holder is detected; on success the identity file holds our PID and boot session ID. If
405
491
  // startup subsequently fails, the exit handler calls releaseInstanceSlot() to remove the stale file.
406
492
  claimInstanceSlot();
407
- // Initialize file logger if not using console logging. This must happen after config loading (to resolve the log file path) and after ensureDataDirectory()
408
- // (to create the parent directory). All startup log messages that should appear in the log file must come after this point.
493
+ // Initialize file logger if not using console logging. Initialization follows configuration loading, which resolves the log file path and the size cap, and
494
+ // ensureDataDirectory(), which creates the parent directory. Every line logged before this point is held by the logger and written by its first flush, so
495
+ // the startup messages above are under no ordering constraint.
409
496
  if (!parsedArgs.consoleLogging) {
410
497
  await initializeFileLogger(getLogFilePath(CONFIG), CONFIG.logging.maxSize);
411
498
  }
412
- // Log the version and active configuration as the first messages captured by the file logger.
499
+ // Log the version and the active configuration, once the logger is up to record them.
413
500
  displayConfiguration();
414
501
  // Log the debug filter status after the file logger is ready so the message is captured.
415
502
  if (isDebugLogging()) {
@@ -455,10 +542,10 @@ export async function startServer(parsedArgs) {
455
542
  loadResumeState();
456
543
  killStaleChrome();
457
544
  // Warm up the browser. getCurrentBrowser() launches Chrome through the capture-readiness supervisor, whose launch gate runs the real capture probe (the
458
- // capability tier) at every launch - including this one. So a successful warm-up already means capture is verified. A stale-capture mutex exits the process from
459
- // inside the probe, and any other gate failure rejects here and aborts startup.
545
+ // capability tier) at every launch - including this one. So a successful warm-up already means capture is verified. A browser that cannot capture rejects the
546
+ // warm-up and aborts startup.
460
547
  try {
461
- await getCurrentBrowser();
548
+ await getCurrentBrowser("page");
462
549
  }
463
550
  catch (error) {
464
551
  LOG.error("Failed to initialize browser during startup: %s.", formatError(error));
@@ -467,11 +554,11 @@ export async function startServer(parsedArgs) {
467
554
  // Generate the preroll fMP4 segment for immediate HLS response during stream startup. This runs after browser launch because the preroll has to be encoded in the
468
555
  // codec capture will actually produce, and that choice reads the GPU capabilities the launch-time capability probe caches.
469
556
  await generatePreroll();
470
- // Minimize the browser window to reduce GPU usage and desktop clutter. The browser must be visible (not headless) for capture to work, but minimizing it reduces
471
- // resource consumption. CDP allows us to control window state without affecting capture. We defer minimization until after the browser capability probe and the
472
- // launch-gate capture probe complete: the GPU probe wants an environment representative of the one capture runs in, and the display advisory reads the bounds
473
- // the OS granted the window, which a minimized window does not report.
474
- await minimizeBrowserWindow();
557
+ // Settle the window against the visibility policy. Nothing is streaming yet, so this leaves it minimized: the desktop stays clear and the GPU stays idle until a
558
+ // capture stream needs the window on screen. We defer the sync until after the browser capability probe and the launch-gate capture probe complete, because the
559
+ // GPU probe wants an environment representative of the one capture runs in and the capture probe acquires a real capture, both of which want the window as the
560
+ // launch left it.
561
+ await syncWindowVisibility();
475
562
  // Start the background services and register each one's stop on an AsyncDisposableStack the moment it starts, so graceful shutdown can dispose them all wholesale
476
563
  // and a future service cannot be started without also being torn down. These are order-independent background loops/timers, so LIFO disposal order is immaterial.
477
564
  // HDHR is intentionally not a member (it is torn down first in shutdown so its sockets release before the rest), and the browser-launch-scoped precache cycle is
package/dist/app.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEvI,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,iBAAiB,EACrJ,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,YA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,EAAE,CAAC,CAAC;IACzC,kBAAkB,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAE7C,uCAAuC;IACvC,IAAI,CAAC;QAEH,MAAM,GAAG,GAAG,MAAM,QAAQ,EAAE,CAAC;QAE7B,6JAA6J;QAC7J,mHAAmH;QACnH,MAAM,GAAG,MAAM,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAErC,4JAA4J;QAC5J,mIAAmI;QACnI,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAAC,OAAM,KAAK,EAAE,CAAC;QAEd,wJAAwJ;QACxJ,GAAG,CAAC,KAAK,CAAC,+CAA+C,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QAE/E,MAAM,KAAK,CAAC;IACd,CAAC;IAED,0JAA0J;IAC1J,yBAAyB;IACzB,MAAM,eAAe,EAAE,CAAC;AAC1B,CAAC"}
@@ -1,11 +1,29 @@
1
1
  import type { LaunchGovernorPolicy } from "./launchGovernor.ts";
2
2
  import type { Browser } from "puppeteer-core";
3
3
  import type { Nullable } from "../types/index.ts";
4
+ /**
5
+ * The record of a browser that can no longer start a capture while the captures it is already running continue. `reason` is the text of the failure that produced
6
+ * the verdict - the probe's message or the description of the wedge - and `since` is the supervisor's clock at the moment the mark was recorded.
7
+ */
8
+ export interface CaptureImpairment {
9
+ readonly reason: string;
10
+ readonly since: number;
11
+ }
12
+ /**
13
+ * What a caller needs the browser for. A "page" caller opens a tab and drives it - precaching, the startup warm-up, the relaunch that follows a restart - while a
14
+ * "capture" caller goes on to start a tab capture for a stream. Naming the purpose at acquire() is what lets a browser that can no longer start captures keep
15
+ * serving the work it can still do.
16
+ */
17
+ export type BrowserPurpose = "capture" | "page";
4
18
  /**
5
19
  * The browser lifecycle. The Browser reference lives inside the `ready` variant, so "is it ready" cannot desync from "do we have a browser" the way a separate
6
20
  * boolean flag could, and illegal states (ready-and-launching) are unrepresentable. `degraded` is the governor's OPEN state (cooling, not serving); `trialing` is
7
21
  * its HALF-OPEN state (one launch in flight after the cooldown elapsed). `closing` is a teardown of a still-running Chrome draining to completion, and its `until`
8
22
  * is the conservative bound that requests rejected mid-drain carry as their retry horizon.
23
+ *
24
+ * The `ready` variant's `impairment` is the guarantee's second half: a published browser is capture-ready, or it carries the record that says it no longer is.
25
+ * Because only `ready` can hold that member, the mark cannot outlive the instance it describes - a relaunch publishes a fresh `ready` whose impairment is null, and
26
+ * no state reached in between can carry one forward.
9
27
  */
10
28
  export type BrowserLifecycle = {
11
29
  readonly kind: "absent";
@@ -15,6 +33,7 @@ export type BrowserLifecycle = {
15
33
  } | {
16
34
  readonly kind: "ready";
17
35
  readonly browser: Browser;
36
+ readonly impairment: Nullable<CaptureImpairment>;
18
37
  readonly launchTime: number;
19
38
  } | {
20
39
  readonly kind: "degraded";
@@ -46,10 +65,12 @@ export interface BrowserSupervisorPorts {
46
65
  * methods feed lifecycle events; noteSustainedHealth() drives the health-gated governor reset; inspect() exposes the state for the adapter and tests.
47
66
  */
48
67
  export interface BrowserSupervisor {
49
- readonly acquire: () => Promise<Browser>;
68
+ readonly acquire: (purpose: BrowserPurpose) => Promise<Browser>;
69
+ readonly captureImpairment: () => Nullable<CaptureImpairment>;
50
70
  readonly current: () => Nullable<Browser>;
51
71
  readonly currentLaunchTime: () => Nullable<number>;
52
72
  readonly inspect: () => BrowserLifecycle;
73
+ readonly noteCaptureImpaired: (browser: Browser, reason: string) => boolean;
53
74
  readonly noteReadinessLost: () => void;
54
75
  readonly noteSustainedHealth: () => boolean;
55
76
  readonly noteTeardownBegun: (teardown: Promise<void>, drainBoundMs: number) => void;
@@ -70,6 +91,14 @@ export declare class BrowserUnavailableError extends Error {
70
91
  export declare class BrowserSupersededError extends Error {
71
92
  constructor();
72
93
  }
94
+ /**
95
+ * 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
96
+ * 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.
97
+ */
98
+ export declare class BrowserCaptureImpairedError extends Error {
99
+ readonly impairment: CaptureImpairment;
100
+ constructor(impairment: CaptureImpairment);
101
+ }
73
102
  /**
74
103
  * 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
75
104
  * instance and routes all browser access through it.
@@ -1 +1 @@
1
- {"version":3,"file":"browserSupervisor.d.ts","sourceRoot":"","sources":["../../src/browser/browserSupervisor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAuB,MAAM,qBAAqB,CAAC;AAErF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAalD;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,GAClE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAClF;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC9E;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,GACjE;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,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AM,KAAK,IAAI,CAAC;CACrF;AAED;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAEhD,SAAgB,UAAU,EAAE,MAAM,CAAC;gBAEvB,UAAU,EAAE,MAAM;CAO/B;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;;CAQhD;AAED;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,KAAK;IAEpD,SAAgB,UAAU,EAAE,iBAAiB,CAAC;gBAElC,UAAU,EAAE,iBAAiB;CAO1C;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,GAAG,iBAAiB,CAmPxF"}
@@ -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