mirror of
https://github.com/morluto/rea.git
synced 2026-11-03 05:16:16 +00:00
* feat(captures): make the HAR/SAZ/qlog decoder heap configurable REA_CAPTURE_DECODER_OLD_GENERATION_MIB keeps the 192 MiB default and refuses values outside 8 to 16384 MiB instead of falling back. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(captures): defer decoder startup and share one parsed heap Invalid REA_CAPTURE_DECODER_OLD_GENERATION_MIB threw while CLI commands were registered, so doctor and help never ran. Build the capture service only when inspect-web-network-capture runs. Resolve the heap once in composition and pass that fact to each Node adapter. Limitation and memory-failure reports use the selected adapter's heap, so a decoder built with a different environment does not describe another limit. Mock captureDecoderProcessMemoryLimitBytes in the Node adapter test so a Windows Bun host still exercises the unavailable-bound refusal. Co-authored-by: morluto <morluto@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com>
24 lines
1.0 KiB
TypeScript
24 lines
1.0 KiB
TypeScript
import { WebNetworkCaptureService } from "../application/WebNetworkCaptureService.js";
|
|
import { HistoricalCaptureDecoder } from "../browser/history/HistoricalCaptureDecoder.js";
|
|
import { NodeCaptureAdapter } from "../browser/history/NodeCaptureAdapter.js";
|
|
import { MitmproxyCaptureAdapter } from "../browser/history/MitmproxyCaptureAdapter.js";
|
|
import { resolveCaptureDecoderHeap } from "../config/captureDecoderHeap.js";
|
|
|
|
/** Compose offline format adapters without import-time reads, installation or process startup. */
|
|
export const createWebNetworkCaptureService = (
|
|
environment: Readonly<NodeJS.ProcessEnv> = process.env,
|
|
): WebNetworkCaptureService => {
|
|
const heap = resolveCaptureDecoderHeap(environment);
|
|
return new WebNetworkCaptureService(
|
|
new HistoricalCaptureDecoder(
|
|
[
|
|
new NodeCaptureAdapter("har", environment, heap),
|
|
new NodeCaptureAdapter("saz", environment, heap),
|
|
new NodeCaptureAdapter("qlog", environment, heap),
|
|
new MitmproxyCaptureAdapter(environment),
|
|
],
|
|
environment,
|
|
),
|
|
);
|
|
};
|