Files
rea/src/browser/CdpCaptureEventState.ts
T
morluto 0bd14ca16c fix(browser): preserve uncertain main-frame navigation identity
Own CDP frame applicability and identity at the parsed event boundary. Preserve malformed or incomplete main-frame facts, recognize replacement roots, and carry the same document identity through captures, screenshots, timelines, and execution windows.

Validation: full check:ci and docs:check; 763 browser and dispatch tests passed, 6 skipped. Independent source and fixture-lifecycle review passed. Local real-Chrome behavior was not exercised.

Closes #5665
2026-10-21 07:16:47 +08:00

38 lines
1.7 KiB
TypeScript

import type { InspectWebPageInput } from "../domain/browserObservation.js";
import type { WebPageInspection } from "../domain/browserObservationSchemas.js";
import type { CdpCaptureCompleteness } from "./CdpCaptureCompleteness.js";
import type { CapturedScript, NetworkState } from "./CdpCaptureEventTypes.js";
export interface CdpCaptureEventsState {
readonly input: InspectWebPageInput;
readonly allowedOrigins: ReadonlySet<string>;
readonly scripts: Map<string, CapturedScript>;
readonly scriptMetadataBudgetOmissionsById: Map<string, true>;
rejectedScriptMetadataBudgetCount: number;
rejectedSourceMapMetadataBudgetCount: number;
readonly scriptMetadataBytesById: Map<string, number>;
retainedScriptMetadataBytes: number;
readonly executionContextFrames: Map<string, string>;
readonly network: Map<string, NetworkState>;
readonly networkRequestTimestamps: Map<string, number>;
readonly malformedRedirectRequestIds: Set<string>;
readonly webSocketConnectionsById: Map<
string,
WebPageInspection["network"]["websocket_connections"][number]
>;
console: WebPageInspection["console"]["events"];
responseMetadata: WebPageInspection["metadata"]["responses"];
agentHints: WebPageInspection["metadata"]["agent_hints"];
readonly completeness: CdpCaptureCompleteness;
originViolation: boolean;
navigationDuringCapture: boolean;
unknownRootIdentity: boolean;
mainFrameId: string | undefined;
/**
* Identity of the document last observed in the main frame. `frameNavigated`
* re-fires for the same document, so this is what distinguishes a real
* document change from a duplicate event.
*/
committedDocument: string | undefined;
}