rea-agents 6.5.0 → 6.7.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.
- package/README.md +12 -3
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/bridge/android/ReaJadxBridge.java +167 -23
- package/bridge/cutter/rea_bridge.py +19 -10
- package/bridge/ghidra/ReaGhidraBridge.java +98 -66
- package/bridge/hopper_bridge.py +9 -1
- package/bridge/native/rea_lldb_tracer.py +48 -4
- package/bridge/pwndbg/core_context.py +15 -2
- package/dist/adb/AdbCommand.js +148 -0
- package/dist/adb/AdbConfiguration.js +26 -4
- package/dist/adb/AdbInputSnapshot.js +126 -0
- package/dist/adb/AdbProvider.js +765 -248
- package/dist/adb/AdbShellOutput.js +92 -21
- package/dist/android/AndroidTargetSnapshot.js +7 -7
- package/dist/android/JadxAnalysis.js +27 -32
- package/dist/android/JadxConfiguration.js +173 -125
- package/dist/android/JadxDoctor.js +11 -3
- package/dist/android/JadxFailure.js +154 -0
- package/dist/android/JadxInterruption.js +13 -0
- package/dist/android/JadxJavaProbe.js +246 -0
- package/dist/android/JadxMcpTransport.js +48 -15
- package/dist/android/JadxProtocol.js +29 -2
- package/dist/android/JadxProvider.js +171 -96
- package/dist/android/JadxRelease.js +5 -1
- package/dist/android/JadxSession.js +35 -14
- package/dist/apktool/ApktoolCommandCleanup.js +134 -0
- package/dist/apktool/ApktoolCommandOutput.js +22 -0
- package/dist/apktool/ApktoolConfiguration.js +162 -44
- package/dist/apktool/ApktoolDecodeOutput.js +29 -23
- package/dist/apktool/ApktoolDecodedInventory.js +52 -0
- package/dist/apktool/ApktoolProvider.js +254 -335
- package/dist/apktool/ApktoolStringTables.js +178 -0
- package/dist/apktool/ApktoolWorkspace.js +162 -0
- package/dist/application/AnalysisDocument.js +19 -4
- package/dist/application/AnalysisProvider.js +15 -1
- package/dist/application/AppBundleExecutable.js +11 -4
- package/dist/application/BinaryTargetResolver.js +9 -2
- package/dist/application/BrowserObservationService.js +54 -20
- package/dist/application/BrowserScenarioCaptureService.js +26 -6
- package/dist/application/CapabilityInventory.js +14 -8
- package/dist/application/ClaudeDesktopConfigLocation.js +5 -5
- package/dist/application/ClientConfigurationCleanup.js +73 -0
- package/dist/application/ClientConfigurationDocument.js +170 -128
- package/dist/application/ClientConfigurationPublication.js +167 -0
- package/dist/application/ClientRegistrationEnvironment.js +31 -1
- package/dist/application/ClientRegistrationIdentity.js +54 -39
- package/dist/application/ClientRegistrationStatus.js +123 -48
- package/dist/application/DirectAnalysis.js +15 -2
- package/dist/application/DirectAnalysisCleanup.js +5 -1
- package/dist/application/DirectAnalysisStatus.js +1 -1
- package/dist/application/Doctor.js +83 -9
- package/dist/application/DoctorDiagnostics.js +25 -4
- package/dist/application/DoctorProviderIds.js +7 -1
- package/dist/application/DshCordisPatch.js +1 -1
- package/dist/application/EnhancedTools.js +9 -21
- package/dist/application/HermesClientHome.js +20 -0
- package/dist/application/HermesConfigurationYaml.js +43 -3
- package/dist/application/HopperDownload.js +11 -3
- package/dist/application/HopperReleaseFeed.js +71 -0
- package/dist/application/InvestigationProviders.js +4 -3
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LinuxHopper.js +96 -71
- package/dist/application/LinuxHopperPublisher.js +656 -0
- package/dist/application/MacHopper.js +182 -66
- package/dist/application/MipsElfMetadata.js +1 -1
- package/dist/application/MsixPackageStorage.js +13 -6
- package/dist/application/ProviderOperationExecution.js +13 -20
- package/dist/application/ReconstructionObligationCandidates.js +17 -2
- package/dist/application/ReconstructionObligationLedgerEvaluation.js +4 -0
- package/dist/application/ReconstructionObligationLedgerService.js +5 -3
- package/dist/application/ReconstructionObligationOriginalCases.js +8 -0
- package/dist/application/ReferenceSourceImportEntries.js +160 -18
- package/dist/application/ReferenceSourceImportPolicy.js +5 -3
- package/dist/application/ReferenceSourceVcsAdapter.js +3 -1
- package/dist/application/RegularFileRead.js +107 -88
- package/dist/application/Setup.js +23 -11
- package/dist/application/SetupClientConfiguration.js +155 -89
- package/dist/application/SetupClients.js +22 -13
- package/dist/application/SetupHost.js +90 -34
- package/dist/application/SetupInstallFailure.js +18 -3
- package/dist/application/SetupPlan.js +15 -5
- package/dist/application/SetupRecoveryBackup.js +40 -13
- package/dist/application/SetupRegistrationEnvironment.js +12 -0
- package/dist/application/SetupSkill.js +10 -30
- package/dist/application/SourceLimitations.js +35 -0
- package/dist/application/SupportedClients.js +4 -4
- package/dist/application/Uninstall.js +91 -36
- package/dist/application/UpdateCommandProgress.js +66 -0
- package/dist/application/UpdateMaintenance.js +7 -2
- package/dist/application/UpdateRuntime.js +60 -30
- package/dist/application/WebModuleTraceService.js +35 -22
- package/dist/application/WebNetworkCaptureService.js +8 -5
- package/dist/application/WebRuntimeService.js +41 -8
- package/dist/application/WebScriptExportService.js +6 -4
- package/dist/application/WebSourceLocationService.js +3 -4
- package/dist/application/WorkflowEvidence.js +11 -4
- package/dist/application/analysisView/AnalysisViewService.js +9 -52
- package/dist/application/android/AndroidAnalysisService.js +5 -4
- package/dist/application/android/AndroidSearchEvidenceSummary.js +6 -8
- package/dist/application/artifacts/ArtifactComparisonEvidence.js +32 -0
- package/dist/application/binary/AnalysisProviderEvaluation.js +14 -11
- package/dist/application/binary/AnalysisProviderRegistry.js +340 -50
- package/dist/application/binary/BinarySession.js +73 -34
- package/dist/application/binary/BinarySessionRecords.js +3 -0
- package/dist/application/binary/BinarySessionStatus.js +3 -4
- package/dist/application/binary/CompositeProvider.js +75 -30
- package/dist/application/binary/LazyAnalysisProvider.js +6 -68
- package/dist/application/binary/SessionProviderRouter.js +11 -2
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +3 -4
- package/dist/application/binaryDiagnostics/PeResourcesService.js +22 -5
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +3 -4
- package/dist/application/captures/PacketCaptureService.js +3 -2
- package/dist/application/closeOwnedWebResources.js +32 -2
- package/dist/application/electron/ElectronFuseService.js +8 -43
- package/dist/application/evm/EvmInterfaceEvidence.js +11 -0
- package/dist/application/evm/EvmInterfaceService.js +4 -15
- package/dist/application/firmware/FirmwareAnalysisService.js +4 -3
- package/dist/application/go/GoBinaryService.js +4 -5
- package/dist/application/investigation/EvidenceLedger.js +3 -4
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +14 -2
- package/dist/application/javascript/ElectronEvidence.js +1 -2
- package/dist/application/javascript/ElectronObservationService.js +41 -7
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +6 -0
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +35 -17
- package/dist/application/javascript/JavaScriptArtifactAnalysisTypes.js +30 -1
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +3 -2
- package/dist/application/javascript/JavaScriptArtifactGraphEvidence.js +3 -3
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +41 -11
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +18 -8
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +84 -24
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +15 -3
- package/dist/application/javascript/JavaScriptModuleRelationships.js +1 -1
- package/dist/application/javascript/JavaScriptRuntimeObservationEvidence.js +1 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +33 -10
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +4 -5
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +103 -24
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +13 -4
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +23 -3
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +18 -5
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +4 -6
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +5 -8
- package/dist/application/native/NativeCallRoutes.js +40 -23
- package/dist/application/native/NativeUiActionTrace.js +8 -0
- package/dist/application/native/NativeValueTrace.js +8 -0
- package/dist/application/reverse/ReverseEngineeringService.js +2 -2
- package/dist/application/rust/RustBinaryService.js +6 -4
- package/dist/application/signals/SignalRecordingService.js +3 -2
- package/dist/application/wasm/WasmArtifactService.js +4 -5
- package/dist/artifacts/AnalysisCleanupLease.js +119 -0
- package/dist/artifacts/ArtifactFileOperation.js +150 -0
- package/dist/artifacts/ArtifactHash.js +2 -1
- package/dist/artifacts/ArtifactProvider.js +16 -5
- package/dist/artifacts/ArtifactReader.js +50 -4
- package/dist/artifacts/ArtifactResourceScope.js +80 -6
- package/dist/artifacts/AsarArtifactReader.js +12 -11
- package/dist/artifacts/AsarEntryStream.js +49 -17
- package/dist/artifacts/DirectoryArtifactReader.js +28 -7
- package/dist/artifacts/MachOSliceArtifactReader.js +70 -13
- package/dist/artifacts/NativeDmgArtifactReader.js +112 -13
- package/dist/artifacts/SafeOutputTree.js +5 -3
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +1 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +10 -16
- package/dist/artifacts/ZipArtifactReader.js +34 -14
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +3 -1
- package/dist/artifacts/apple/DylibFileAccess.js +106 -0
- package/dist/artifacts/apple/DylibResolutionReader.js +64 -155
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +52 -9
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +25 -24
- package/dist/artifacts/apple/KeyedArchiveReader.js +20 -11
- package/dist/artifacts/apple/MachoLoadCommandReader.js +17 -2
- package/dist/artifacts/apple/PlistNumberLiterals.js +104 -116
- package/dist/artifacts/extraction/ArtifactExtraction.js +15 -12
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +9 -11
- package/dist/artifacts/inventory/ArtifactInventory.js +2 -2
- package/dist/artifacts/inventory/classify.js +4 -2
- package/dist/artifacts/inventory/hashStableRootArtifact.js +14 -7
- package/dist/artifacts/inventory/scanCanonical.js +3 -4
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +3 -1
- package/dist/artifacts/readArtifactFileChunks.js +9 -0
- package/dist/artifacts/readStableArtifact.js +12 -34
- package/dist/browser/BrowserScenarioPartialObservation.js +14 -48
- package/dist/browser/CdpBrowserProvider.js +81 -30
- package/dist/browser/CdpCaptureDocuments.js +99 -131
- package/dist/browser/CdpCaptureDomSvg.js +31 -60
- package/dist/browser/CdpCaptureValues.js +12 -0
- package/dist/browser/CdpConnection.js +133 -27
- package/dist/browser/CdpElectronInspection.js +60 -60
- package/dist/browser/CdpElectronProvider.js +56 -4
- package/dist/browser/CdpElectronScriptEvents.js +4 -1
- package/dist/browser/CdpElectronScripts.js +2 -5
- package/dist/browser/CdpElectronWorkers.js +13 -2
- package/dist/browser/CdpPageCapture.js +2 -1
- package/dist/browser/CdpPageCaptureScripts.js +14 -10
- package/dist/browser/CdpPageCaptureWorkers.js +45 -14
- package/dist/browser/CdpSafeMetadata.js +23 -19
- package/dist/browser/CdpSnapshotNodes.js +103 -0
- package/dist/browser/CdpSnapshotStrings.js +0 -6
- package/dist/browser/CdpTargetSession.js +52 -10
- package/dist/browser/CdpTargetSessionOwner.js +198 -0
- package/dist/browser/ElectronCaptureCleanup.js +82 -0
- package/dist/browser/ElectronProcessCleanup.js +91 -0
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +71 -16
- package/dist/browser/PlaywrightElectronActiveActions.js +53 -5
- package/dist/browser/PlaywrightElectronActiveFuses.js +86 -0
- package/dist/browser/PlaywrightElectronActiveProjection.js +5 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +140 -151
- package/dist/browser/PlaywrightExecutionBoundary.js +4 -2
- package/dist/browser/PlaywrightScenarioBrowser.js +236 -90
- package/dist/browser/PlaywrightScenarioEvents.js +135 -48
- package/dist/browser/PlaywrightScenarioServiceWorkers.js +121 -34
- package/dist/browser/PlaywrightScenarioSession.js +95 -22
- package/dist/browser/PlaywrightScenarioStorage.js +15 -7
- package/dist/browser/StructuredFieldToken.js +53 -0
- package/dist/browser/WebArtifactCleanup.js +53 -0
- package/dist/browser/WebSourceMapFetcher.js +19 -10
- package/dist/browser/assets/WebArtifactReads.js +6 -2
- package/dist/browser/assets/WebSourceLocationArtifacts.js +12 -3
- package/dist/browser/execution/CdpRuntimeSession.js +36 -7
- package/dist/browser/execution/CdpWebRuntimeProvider.js +22 -4
- package/dist/browser/history/CaptureFailures.js +7 -2
- package/dist/browser/history/HarCapture.js +42 -11
- package/dist/browser/history/SazMetadata.js +10 -47
- package/dist/browser/modules/NativeModuleResolver.js +108 -58
- package/dist/browser/modules/WebModuleArtifacts.js +12 -3
- package/dist/browser/network/PlaywrightNetworkContent.js +40 -17
- package/dist/browser/network/PlaywrightScenarioNetwork.js +182 -73
- package/dist/captures/TsharkCaptureProvider.js +13 -6
- package/dist/catalogIdentity.js +19 -14
- package/dist/cli/adbCommands.js +18 -19
- package/dist/cli/androidCommands.js +2 -14
- package/dist/cli/apktoolCommands.js +4 -14
- package/dist/cli/binaryDiagnosticsCommands.js +5 -5
- package/dist/cli/browserAdvancedCommands.js +11 -4
- package/dist/cli/browserCommands.js +21 -12
- package/dist/cli/captureCommands.js +4 -4
- package/dist/cli/cliResultOutput.js +175 -89
- package/dist/cli/coreBinaryCommands.js +4 -3
- package/dist/cli/cutterCommands.js +51 -13
- package/dist/cli/electronCommands.js +34 -13
- package/dist/cli/evmCommands.js +6 -15
- package/dist/cli/finishAnalysisCommand.js +10 -2
- package/dist/cli/firmwareCommands.js +6 -14
- package/dist/cli/flutterCommands.js +2 -18
- package/dist/cli/fridaCommands.js +8 -0
- package/dist/cli/goCommands.js +2 -2
- package/dist/cli/javascriptRecoveryCommands.js +14 -26
- package/dist/cli/jebCommands.js +2 -14
- package/dist/cli/options.js +6 -0
- package/dist/cli/pcapCommands.js +2 -20
- package/dist/cli/rustCommands.js +6 -7
- package/dist/cli/setupCommands.js +4 -3
- package/dist/cli/signalCommands.js +4 -4
- package/dist/cli/sqliteCommands.js +17 -44
- package/dist/cli/wasmCommands.js +7 -18
- package/dist/cli/webModuleCommands.js +19 -34
- package/dist/cli/webNetworkCaptureCommands.js +3 -2
- package/dist/cli/webRuntimeCommands.js +15 -6
- package/dist/cli/webSourceLocationCommands.js +14 -33
- package/dist/cli-runtime/AnalysisCleanupLease-CWfTGYKd.js +103 -0
- package/dist/cli-runtime/{AnalysisProvider-D0Us2OTk.js → AnalysisProvider-BGrYaMVo.js} +14 -3
- package/dist/cli-runtime/{AnalysisSnapshotCache-BXS0wRd2.js → AnalysisSnapshotCache-BjRlXeUS.js} +14 -13
- package/dist/cli-runtime/ArtifactFileOperation-Dg4BcoEM.js +122 -0
- package/dist/cli-runtime/{ArtifactReader-BXkffc1D.js → ArtifactReader-DMwm42bk.js} +29 -6
- package/dist/cli-runtime/ArtifactResourceScope-CokZGcII.js +175 -0
- package/dist/cli-runtime/{AsarHeader-CnzOzYEH.js → AsarHeader-BxwU17DJ.js} +1 -1
- package/dist/cli-runtime/{BinarySessionStatus-DnMxMk-r.js → BinarySessionStatus-DRhjr7Vb.js} +4 -3
- package/dist/cli-runtime/{BinaryTargetResolver-CVIJ_s1A.js → BinaryTargetResolver-tuCTjBlQ.js} +38 -108
- package/dist/cli-runtime/{BoundedFileBytes-BU30odTm.js → BoundedFileBytes-DRtiQNAQ.js} +7 -3
- package/dist/cli-runtime/{CdpTargetSession-DGX5pV9w.js → CdpTargetSession-CQ08KHbh.js} +318 -43
- package/dist/cli-runtime/ClientConfigPath-Dn-V_GUf.js +255 -0
- package/dist/cli-runtime/{ClientConfigurationDocument-ffQ9X0Se.js → ClientConfigurationDocument-C9T8MNGc.js} +206 -142
- package/dist/cli-runtime/{ClientRegistrationStatus-DszCyPEU.js → ClientRegistrationStatus-PnD29RTX.js} +112 -36
- package/dist/cli-runtime/{CurrentEntrypointPath-D5FRNdkq.js → CurrentEntrypointPath-m7QCIVN0.js} +1 -1
- package/dist/cli-runtime/{DirectAnalysis-BgvAtpN3.js → DirectAnalysis-C5NyUryV.js} +76 -23
- package/dist/cli-runtime/DirectoryArtifactReader-CokAJ8vo.js +448 -0
- package/dist/cli-runtime/{Doctor-DIpf_I7N.js → Doctor-DrkWsav4.js} +105 -25
- package/dist/cli-runtime/{ElectronFileScope-dpHm2nrS.js → ElectronFileScope-AP7VoVr7.js} +204 -149
- package/dist/cli-runtime/ElectronFuseFailures-DsjXR7Xp.js +609 -0
- package/dist/cli-runtime/{ExecFileOutput-BEQs-lDD.js → ExecFileOutput-D6KLYTve.js} +11 -9
- package/dist/cli-runtime/{InterfaceBuilderDecodeBudget-D4omRUe4.js → InterfaceBuilderDecodeBudget-CW1IO3dG.js} +40 -21
- package/dist/cli-runtime/{InventoryProjectionEvidence-DIsI4DJ6.js → InventoryProjectionEvidence-DTH5QAqL.js} +3 -3
- package/dist/cli-runtime/{InvestigationProviders-DoQRIHii.js → InvestigationProviders-CFh4a64d.js} +3 -2
- package/dist/cli-runtime/{JavaScriptApplicationEvidenceGraph-D5aI_FSJ.js → JavaScriptApplicationEvidenceGraph-gOmPB2L6.js} +6 -6
- package/dist/cli-runtime/{JavaScriptApplicationWorkflowEvidence-Bz4-V0Ct.js → JavaScriptApplicationWorkflowEvidence-WZgtK_Ok.js} +2 -2
- package/dist/cli-runtime/JebMcpEndpoint-BEalGZh9.js +710 -0
- package/dist/cli-runtime/{JsonFiles-DQa1PRKy.js → JsonFiles-uvd6ZyQi.js} +10 -118
- package/dist/cli-runtime/KunaInstallation-P0j3x851.js +1781 -0
- package/dist/cli-runtime/MacHopperPaths-bGzqjF1Z.js +34 -0
- package/dist/cli-runtime/{MachoLoadCommandReader-C7e074Ze.js → MachoLoadCommandReader-CZm6N5vF.js} +12 -192
- package/dist/cli-runtime/{ManagedSnapshot-rqyBHcdL.js → ManagedSnapshot-CPE9C3OD.js} +406 -110
- package/dist/cli-runtime/OwnedCommandCleanup-BN_V6Erc.js +187 -0
- package/dist/cli-runtime/OwnedRegularFile-D1f5nUCx.js +256 -0
- package/dist/cli-runtime/OwnedStagedOutput-D31dOozz.js +126 -0
- package/dist/cli-runtime/{PrivateRuntimeRoot-DAy0PiBM.js → PrivateRuntimeRoot-Cd23u6jd.js} +39 -6
- package/dist/cli-runtime/ProcessOwnership-CtrNr6ee.js +545 -0
- package/dist/cli-runtime/{ProcessOwnership-DXC5-UWt.js → ProcessOwnershipObservation-C006iCtZ.js} +149 -607
- package/dist/cli-runtime/{ProviderDeadline-8m2pFRDc.js → ProviderDeadline-rSuH4Pm8.js} +27 -1
- package/dist/cli-runtime/ProviderOperationExecution-CmU-XrQr.js +38 -0
- package/dist/cli-runtime/{snapshotEnvironment-D_tWyOub.js → ProviderProcess-D87A7ctp.js} +117 -160
- package/dist/cli-runtime/RegularFileRead-mbgGYtxe.js +125 -0
- package/dist/cli-runtime/{SafeOutputTree-D6U15GXd.js → SafeOutputTree-i904hd_2.js} +21 -20
- package/dist/cli-runtime/{SetupHost-FkYWswsq.js → SetupHost-CMPmPraB.js} +365 -195
- package/dist/cli-runtime/SharedStartupAttempt-BxKyf3Uv.js +1424 -0
- package/dist/cli-runtime/StableFileHash-Ame_h3lY.js +61 -0
- package/dist/cli-runtime/{SupportedClients-DaX6Lt2d.js → SupportedClients-DMafjitv.js} +89 -72
- package/dist/cli-runtime/{Update-CbTC_eg1.js → Update-DAsASWlE.js} +1 -1
- package/dist/cli-runtime/{AbortablePromise-BVBemxbD.js → WindowsBatchCommand-Cx9kaVNf.js} +2 -28
- package/dist/cli-runtime/WindowsNativeLoader-BqyZO0ZD.js +142 -0
- package/dist/cli-runtime/{ZipArtifactReader-B8ZgNe4D.js → ZipArtifactReader-Jed69LEL.js} +20 -16
- package/dist/cli-runtime/{analysisErrorCleanup-Do6YeeoD.js → analysisErrorCleanup-COdAmDsb.js} +4 -3
- package/dist/cli-runtime/{appleArchiveFormat-tVoI2ykA.js → appleArchiveFormat-Bb3G5CCI.js} +13 -7
- package/dist/cli-runtime/{application__DirectAnalysisStatus-DpOejOf0.js → application__DirectAnalysisStatus-F74bu9oy.js} +10 -10
- package/dist/cli-runtime/{application__EnhancedTools-oFE2bOjs.js → application__EnhancedTools-Bg51b0Yp.js} +84 -51
- package/dist/cli-runtime/{application__FunctionAnalysisEvidence-B6osuhvW.js → application__FunctionAnalysisEvidence-DBWIaYCh.js} +3 -3
- package/dist/cli-runtime/{application__ReconstructionCoverageService-DN3wTFQj.js → application__ReconstructionCoverageService-AEPNpZqJ.js} +3 -3
- package/dist/cli-runtime/{application__ReconstructionObligationLedgerService-CKcTppX9.js → application__ReconstructionObligationLedgerService-Cl9cPEZf.js} +22 -9
- package/dist/cli-runtime/{application__Setup-XpMaRNjy.js → application__Setup-DwQzEewK.js} +30 -18
- package/dist/cli-runtime/{application__Uninstall-_23pU2yB.js → application__Uninstall-BOf9oyvQ.js} +78 -37
- package/dist/cli-runtime/{application__UpdateRuntime-DPvY8ohd.js → application__UpdateRuntime-CzWkRJHa.js} +119 -29
- package/dist/cli-runtime/{application__android__AndroidApplicationService-CFgIFPM4.js → application__android__AndroidApplicationService-shW_aKlj.js} +3 -3
- package/dist/cli-runtime/{application__apple__AppleApplicationService-Db6QCsun.js → application__apple__AppleApplicationService-DIv6d3wB.js} +3 -3
- package/dist/cli-runtime/{application__harmony__HarmonyApplicationService-CFjocHoK.js → application__harmony__HarmonyApplicationService-OIUFVQFV.js} +3 -3
- package/dist/cli-runtime/{application__javascript__ElectronActiveObservationService-CmVDUI_Z.js → application__javascript__ElectronActiveObservationService-wvCh72hK.js} +3 -3
- package/dist/cli-runtime/application__javascript__ElectronObservationService-SydXPCwM.js +88 -0
- package/dist/cli-runtime/{application__javascript__JavaScriptApplicationService-CCkp8KBh.js → application__javascript__JavaScriptApplicationService-o0uEsjEc.js} +1120 -316
- package/dist/cli-runtime/{application__javascript__JavaScriptApplicationWorkflowService-lPy0tzr3.js → application__javascript__JavaScriptApplicationWorkflowService-BAheG_71.js} +51 -44
- package/dist/cli-runtime/{application__javascript__JavaScriptRuntimeReconciliationService-DWleA8K9.js → application__javascript__JavaScriptRuntimeReconciliationService-Cnn4GP8q.js} +5 -5
- package/dist/cli-runtime/{application__javascript__JavaScriptSemanticTraceService-DkALH4rL.js → application__javascript__JavaScriptSemanticTraceService-CmvLfV1A.js} +6 -6
- package/dist/cli-runtime/{artifacts__ArtifactProvider-zXI0QjSL.js → artifacts__ArtifactProvider-wx2K0F2I.js} +377 -359
- package/dist/cli-runtime/{binary-BVOr2mgE.js → binary-CWVNJhAC.js} +8561 -3159
- package/dist/cli-runtime/{catalogIdentity-DLoXgfIR.js → catalogIdentity-DAEEsOdX.js} +260 -81
- package/dist/cli-runtime/cli.js +6177 -3556
- package/dist/cli-runtime/{cliOutput-BC1BdAcB.js → cliOutput-CgSuw782.js} +47 -6
- package/dist/cli-runtime/cliOutput.js +2 -2
- package/dist/cli-runtime/cliResultOutput-10sd6xGx.js +1453 -0
- package/dist/cli-runtime/cliResultOutput.js +2 -1
- package/dist/cli-runtime/{composition__browserScenario-DHXC1a8n.js → composition__browserScenario-BtPb1c1y.js} +843 -356
- package/dist/cli-runtime/{composition__electronObservation-GecK2EID.js → composition__electronObservation-Bk8R6DJo.js} +128 -69
- package/dist/cli-runtime/{composition__electronScenario-CEZnVrAL.js → composition__electronScenario-BVF0qStH.js} +398 -135
- package/dist/cli-runtime/{cutterToolContracts-TZH9EHr5.js → cutterToolContracts-BQtG_Nzo.js} +195 -62
- package/dist/cli-runtime/{doctorRuntime-BE5ZX8it.js → doctorRuntime-B__SIpm-.js} +241 -21
- package/dist/cli-runtime/{dotnet__ManagedStaticProvider-C8_yZCDc.js → dotnet__ManagedStaticProvider-DO5Yzcp4.js} +1 -1
- package/dist/cli-runtime/{errorSchemas-CTRmvMl3.js → errorSchemas-Ixz_q7qt.js} +58 -4
- package/dist/cli-runtime/homeDirectory-DC_DeJIg.js +18 -0
- package/dist/cli-runtime/{javascriptApplicationAnalysis-HgMzVMQw.js → javascriptApplicationAnalysis-Dk6yBV8g.js} +688 -668
- package/dist/cli-runtime/{javascriptExportReturnShapeProjection-Dg00g35t.js → javascriptExportReturnShapeProjection-CObOIiQ6.js} +3 -3
- package/dist/cli-runtime/{javascriptExportShapeComparisonSchemas-BYnoIqIk.js → javascriptExportShapeComparisonSchemas-DpwuBenh.js} +5 -3
- package/dist/cli-runtime/{javascriptRuntimeReconciliation-DNjDoL3S.js → javascriptRuntimeReconciliation-C6ZgWMys.js} +61 -59
- package/dist/cli-runtime/{javascriptRuntimeReconciliationSchemas-BWpGWNcI.js → javascriptRuntimeReconciliationSchemas-D6tZKUQs.js} +2 -2
- package/dist/cli-runtime/{javascriptSemanticTraceSchemas-BTCNcvbc.js → javascriptSemanticTraceSchemas-C7m0b6_w.js} +3 -3
- package/dist/cli-runtime/{lipo-DSWP6fv-.js → lipo-DPQ6qurH.js} +9 -11
- package/dist/cli-runtime/{logger-CQQCI4a2.js → logger-BuDJ9xxO.js} +2 -2
- package/dist/cli-runtime/{machoContainer-C8BIkkq3.js → machoContainer-Cy98bkFm.js} +180 -0
- package/dist/cli-runtime/{managedApplicationGraph-B08jb3jq.js → managedApplicationGraph-BazVqpJv.js} +16 -10
- package/dist/cli-runtime/{managedToolContracts-D60QmIYj.js → managedToolContracts-BuFkMBH5.js} +2 -2
- package/dist/cli-runtime/mcpDoctor.js +8 -6
- package/dist/cli-runtime/mcpStartupPolicy-imCbM3qo.js +28 -0
- package/dist/cli-runtime/{native__NativeMacOSProvider-YBTvUeJO.js → native__NativeMacOSProvider-DTcRhuGA.js} +1384 -757
- package/dist/cli-runtime/{officialToolContracts-CCFF0an9.js → officialToolContracts-CzzVLx8I.js} +74 -53
- package/dist/cli-runtime/peMachine-B9ggfSJJ.js +95 -0
- package/dist/cli-runtime/propertyListKeys-D5dSASEy.js +355 -0
- package/dist/cli-runtime/{providerCleanupError-Ceq8f0wK.js → providerCleanupError-BhsJyAhk.js} +3 -5
- package/dist/cli-runtime/readArtifactFileChunks-BbTL_PtB.js +129 -0
- package/dist/cli-runtime/{reconstructionObligationLedgerSchemas-Bao0xMr-.js → reconstructionObligationLedgerSchemas-Bi6sect1.js} +6329 -3651
- package/dist/cli-runtime/{scanCanonical-KP4T9jSl.js → scanCanonical-CcDFUr-w.js} +233 -363
- package/dist/cli-runtime/snapshotEnvironment-Yvx5qwsl.js +196 -0
- package/dist/cli-runtime/{toolContracts-D2FOG_Nb.js → toolContracts-CJzEyZ38.js} +126 -52
- package/dist/cli-runtime/{toolOutputSchemaGroups-DRiYs1je.js → toolOutputSchemaGroups-BqdSzySu.js} +768 -589
- package/dist/cli-runtime/{workflowInputError-n8Oo-bLA.js → workflowInputError-BP8z9Wxl.js} +2 -2
- package/dist/cli.js +10 -0
- package/dist/cliBrowserScenarioCommands.js +2 -3
- package/dist/cliLogging.js +22 -7
- package/dist/cliObservationOptions.js +3 -0
- package/dist/cliOutput.js +68 -3
- package/dist/composition/binary.js +15 -2
- package/dist/composition/directAnalysis.js +8 -0
- package/dist/composition/javascriptAnalysisWorkerProcess.js +4 -5
- package/dist/composition/jeb.js +32 -21
- package/dist/config/environment.js +36 -2
- package/dist/config/mcpInputSchemaProfile.js +1 -1
- package/dist/config/parseConfig.js +7 -3
- package/dist/contracts/adb/adbToolContracts.js +2 -2
- package/dist/contracts/analysisViewApiSurfaceExample.js +4 -4
- package/dist/contracts/analysisViewToolContracts.js +42 -1
- package/dist/contracts/android/androidToolContracts.js +1 -1
- package/dist/contracts/apktool/apktoolToolContracts.js +5 -1
- package/dist/contracts/artifactComparisonExample.js +18 -14
- package/dist/contracts/artifactToolContracts.js +2 -1
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/browserToolContracts.js +12 -1
- package/dist/contracts/compactInputSchema.js +13 -6
- package/dist/contracts/fridaToolContracts.js +5 -4
- package/dist/contracts/gdbToolContracts.js +2 -3
- package/dist/contracts/inputSchemaPresentation.js +173 -79
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +1 -0
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +1 -0
- package/dist/contracts/jsonSchemaKeywords.js +29 -0
- package/dist/contracts/managed/managedWorkflowExamples.js +3 -0
- package/dist/contracts/managed/managedWorkflowToolContracts.js +1 -1
- package/dist/contracts/mobileApplicationGraphExamples.js +15 -12
- package/dist/contracts/officialToolContracts.js +2 -2
- package/dist/contracts/rizinDebugToolContracts.js +3 -2
- package/dist/contracts/sessionToolContracts.js +3 -3
- package/dist/contracts/toolEffects.js +6 -2
- package/dist/contracts/toolOutputSchemaGroups.js +7 -4
- package/dist/contracts/toolOutputSchemaPrimitives.js +7 -0
- package/dist/contracts/toolSchemaMetadata.js +99 -27
- package/dist/cutter/CutterBridgeClient.js +206 -67
- package/dist/cutter/CutterBridgeService.js +52 -4
- package/dist/doctorRuntime.js +25 -4
- package/dist/domain/adb/adbDeviceAnalysis.js +19 -1
- package/dist/domain/analysisErrorBase.js +59 -2
- package/dist/domain/analysisErrorCleanup.js +3 -1
- package/dist/domain/analysisErrorCore.js +13 -0
- package/dist/domain/analysisErrorPresentation.js +23 -4
- package/dist/domain/analysisErrorProjection.js +44 -28
- package/dist/domain/analysisSearch.js +26 -0
- package/dist/domain/analysisSnapshot.js +11 -11
- package/dist/domain/analysisView/WebNetworkApiSurfaceAccumulator.js +4 -65
- package/dist/domain/analysisView/analysisView.js +25 -0
- package/dist/domain/analysisView/analysisViewDataAdmission.js +86 -0
- package/dist/domain/analysisView/artifactInventoryView.js +4 -18
- package/dist/domain/analysisView/javascriptApplicationCoverage.js +27 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +100 -27
- package/dist/domain/analysisView/javascriptFactsView.js +92 -0
- package/dist/domain/analysisView/javascriptModuleReferences.js +37 -0
- package/dist/domain/analysisView/managedMemberView.js +6 -0
- package/dist/domain/android/androidApplication.js +8 -7
- package/dist/domain/apktool/apktoolResourceAnalysis.js +52 -2
- package/dist/domain/apple/appleApplication.js +41 -60
- package/dist/domain/apple/appleBundleAnatomy.js +56 -68
- package/dist/domain/apple/dylibResolution.js +5 -1
- package/dist/domain/apple/interfaceBuilderGraph.js +29 -8
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +11 -4
- package/dist/domain/apple/jvmClassFile.js +226 -0
- package/dist/domain/apple/keyedArchive.js +39 -17
- package/dist/domain/apple/machoContainer.js +3 -0
- package/dist/domain/apple/plistNumbers.js +67 -5
- package/dist/domain/apple/plistValue.js +89 -18
- package/dist/domain/artifactComparison.js +7 -5
- package/dist/domain/artifactGraph.js +4 -12
- package/dist/domain/artifactInspection.js +6 -17
- package/dist/domain/artifactInventoryEvidence.js +68 -60
- package/dist/domain/binaryTarget.js +11 -26
- package/dist/domain/binaryTargetTypes.js +10 -0
- package/dist/domain/browserNetworkEvidence.js +20 -3
- package/dist/domain/browserObservation.js +5 -28
- package/dist/domain/browserObservationError.js +4 -4
- package/dist/domain/browserScenarioCapture.js +11 -2
- package/dist/domain/browserScenarioCaptureLimits.js +34 -0
- package/dist/domain/browserScenarioCaptureValues.js +50 -0
- package/dist/domain/browserScenarioDiffEvidence.js +1 -3
- package/dist/domain/browserScenarioValues.js +5 -1
- package/dist/domain/captures/packetCapture.js +2 -1
- package/dist/domain/dosMz.js +14 -5
- package/dist/domain/electron/electronFuseEvidence.js +42 -0
- package/dist/domain/elfFixedHeader.js +24 -0
- package/dist/domain/evidence.js +7 -6
- package/dist/domain/evidenceBundle.js +9 -2
- package/dist/domain/explicitSensitiveFailure.js +3 -0
- package/dist/domain/fileSnapshotObservation.js +25 -0
- package/dist/domain/fixedTupleSchema.js +9 -0
- package/dist/domain/functionCallCoverage.js +6 -6
- package/dist/domain/functionComparisonDimensions.js +38 -11
- package/dist/domain/functionComparisonNormalization.js +17 -9
- package/dist/domain/functionDossierEvidence.js +4 -3
- package/dist/domain/harmony/harmonyApplication.js +8 -8
- package/dist/domain/hopperErrors.js +4 -2
- package/dist/domain/hopperValues.js +27 -4
- package/dist/domain/javascript/electronActiveObservation.js +1 -0
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +80 -20
- package/dist/domain/javascript/electronStaticAnalysisValues.js +0 -20
- package/dist/domain/javascript/electronStaticOptionObjects.js +45 -0
- package/dist/domain/javascript/electronWrappedCallPaths.js +70 -17
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +20 -4
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +4 -0
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +3 -0
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +3 -1
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +49 -21
- package/dist/domain/javascript/javascriptAstFingerprint.js +41 -10
- package/dist/domain/javascript/javascriptAstValues.js +83 -5
- package/dist/domain/javascript/javascriptBundledRequireOrigin.js +23 -36
- package/dist/domain/javascript/javascriptCommonJsExportReceivers.js +231 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +14 -4
- package/dist/domain/javascript/javascriptFeatureSeed.js +1 -1
- package/dist/domain/javascript/javascriptGraphqlOperations.js +382 -0
- package/dist/domain/javascript/javascriptModuleDeclaration.js +20 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +7 -11
- package/dist/domain/javascript/javascriptRpcEndpoints.js +7 -171
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +9 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +35 -12
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +50 -45
- package/dist/domain/javascript/javascriptSemanticAmbientWrites.js +284 -24
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +452 -182
- package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +37 -20
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +55 -27
- package/dist/domain/javascript/javascriptSemanticCalls.js +4 -4
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +134 -50
- package/dist/domain/javascript/javascriptSemanticCoverage.js +5 -1
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +7 -13
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +33 -10
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +1 -1
- package/dist/domain/javascript/javascriptSemanticEvaluationOrder.js +126 -0
- package/dist/domain/javascript/javascriptSemanticExpressionShapes.js +111 -0
- package/dist/domain/javascript/javascriptSemanticGetterQueries.js +147 -0
- package/dist/domain/javascript/javascriptSemanticGetterResults.js +264 -0
- package/dist/domain/javascript/javascriptSemanticGraph.js +18 -1
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +13 -0
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +3 -2
- package/dist/domain/javascript/javascriptSemanticMapOperations.js +51 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +215 -81
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +395 -118
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +241 -328
- package/dist/domain/javascript/javascriptSemanticObjects.js +33 -27
- package/dist/domain/javascript/javascriptSemanticOpaqueEffects.js +163 -0
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +11 -1
- package/dist/domain/javascript/javascriptSemanticProjection.js +44 -67
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +2 -1
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +1 -1
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +45 -7
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +3 -19
- package/dist/domain/javascript/javascriptSemanticResources.js +27 -4
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +78 -37
- package/dist/domain/javascript/javascriptSemanticReturns.js +2 -2
- package/dist/domain/javascript/javascriptSemanticState.js +191 -42
- package/dist/domain/javascript/javascriptSemanticValues.js +167 -41
- package/dist/domain/javascript/javascriptSourceParser.js +54 -9
- package/dist/domain/javascript/javascriptStaticAnalysis.js +24 -13
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +276 -16
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +33 -25
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +3 -0
- package/dist/domain/javascript/javascriptStaticAnalysisTypes.js +1 -1
- package/dist/domain/javascript/javascriptSymbolicBindings.js +424 -142
- package/dist/domain/javascript/javascriptSymbolicControlFlow.js +4 -0
- package/dist/domain/javascript/javascriptSymbolicValues.js +12 -1
- package/dist/domain/javascript/sourceToBundleSignals.js +3 -0
- package/dist/domain/managed/managedApplicationGraphNodes.js +14 -9
- package/dist/domain/managed/managedArtifact.js +26 -0
- package/dist/domain/managed/managedMemberComparison.js +3 -0
- package/dist/domain/managed/managedMemberComparisonCoverage.js +14 -1
- package/dist/domain/managed/managedMemberComparisonItems.js +124 -52
- package/dist/domain/managed/managedMemberComparisonMatch.js +76 -72
- package/dist/domain/managed/managedMemberSignatureIdentity.js +40 -0
- package/dist/domain/managed/managedNativeVerificationMatch.js +5 -5
- package/dist/domain/managed/managedNativeVerificationSchemas.js +2 -2
- package/dist/domain/mobileApplicationGraphProjection.js +33 -18
- package/dist/domain/native/bytePattern.js +21 -0
- package/dist/domain/native/nativeAotPe.js +29 -2
- package/dist/domain/native/nativeAotSnapshotObservation.js +18 -0
- package/dist/domain/native/nativeCallPartialObservation.js +14 -12
- package/dist/domain/native/nativeLoadImage.js +13 -0
- package/dist/domain/native/objcSwiftMetadata.js +15 -8
- package/dist/domain/native/peResources.js +6 -2
- package/dist/domain/peMachine.js +2 -0
- package/dist/domain/process/processComparison.js +3 -3
- package/dist/domain/process/processTraceDimensionProjection.js +1 -1
- package/dist/domain/process/processTraceEvaluation.js +65 -24
- package/dist/domain/propertyListKeys.js +84 -69
- package/dist/domain/propertyListXml.js +149 -0
- package/dist/domain/providerAdapterError.js +2 -0
- package/dist/domain/providerCleanupError.js +2 -4
- package/dist/domain/rawBinary.js +11 -2
- package/dist/domain/reconstructionCoverage.js +35 -23
- package/dist/domain/reconstructionCoverageEvaluation.js +36 -36
- package/dist/domain/reconstructionCoverageEvidence.js +26 -0
- package/dist/domain/reconstructionVerification.js +40 -26
- package/dist/domain/referenceSourceImportParsing.js +4 -0
- package/dist/domain/referenceSourcePathIdentity.js +2 -0
- package/dist/domain/referenceSourceRequireBindings.js +40 -101
- package/dist/domain/relationshipCoverage.js +4 -5
- package/dist/domain/sqlite/sqliteDatabase.js +2 -1
- package/dist/domain/symbolAnalysis.js +9 -8
- package/dist/domain/webBundleAnalyzerInspection.js +65 -25
- package/dist/domain/webCaptureDiff.js +124 -41
- package/dist/domain/webInventory.js +28 -14
- package/dist/domain/webModuleTrace.js +22 -0
- package/dist/domain/webScriptExportError.js +2 -3
- package/dist/domain/xmlDocument.js +41 -0
- package/dist/domain/zipPackageFormat.js +0 -4
- package/dist/dotnet/ManagedArtifactInspector.js +2 -4
- package/dist/dotnet/ManagedDecodeBudget.js +21 -1
- package/dist/dotnet/ManagedMemberInspector.js +31 -6
- package/dist/dotnet/ManagedMemberInspectorCore.js +63 -12
- package/dist/dotnet/ManagedMemberRows.js +8 -8
- package/dist/dotnet/ManagedMetadataHeaps.js +0 -1
- package/dist/dotnet/ManagedMetadataLayout.js +17 -15
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +20 -19
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +7 -8
- package/dist/dotnet/ManagedPeReader.js +5 -0
- package/dist/dotnet/ManagedSnapshot.js +25 -20
- package/dist/dotnet/ManagedTypeNameDigests.js +177 -0
- package/dist/dotnet/ManagedTypeNames.js +6 -46
- package/dist/dotnet/ManagedTypeNesting.js +25 -0
- package/dist/dotnet/ManagedTypeReferences.js +94 -0
- package/dist/electron/ElectronFuseFailures.js +105 -0
- package/dist/electron/ElectronFusePath.js +4 -3
- package/dist/electron/ElectronFuseProvider.js +67 -92
- package/dist/electron/ElectronFuseReader.js +46 -30
- package/dist/evm/EvmoleFailures.js +1 -0
- package/dist/evm/EvmoleInterfaceProvider.js +13 -16
- package/dist/filesystem/OwnedRegularFile.js +116 -0
- package/dist/filesystem/OwnedStagedOutput.js +28 -11
- package/dist/filesystem/RegularFile.js +20 -8
- package/dist/filesystem/StableFileHash.js +56 -38
- package/dist/filesystem/callerPath.js +26 -0
- package/dist/filesystem/readFileHandleChunks.js +55 -5
- package/dist/filesystem/readStableFileBytes.js +85 -0
- package/dist/firmware/FirmwareCommand.js +13 -7
- package/dist/firmware/FirmwareFailures.js +56 -0
- package/dist/firmware/FirmwareFiles.js +128 -98
- package/dist/firmware/FirmwareProvider.js +120 -65
- package/dist/firmware/FirmwarePublication.js +26 -11
- package/dist/flutter/DartElf.js +27 -0
- package/dist/flutter/FlutterBuildProvider.js +44 -4
- package/dist/gdb/GdbSessionManager.js +202 -14
- package/dist/generatedPackageMetadata.js +1 -1
- package/dist/ghidra/GhidraAnalysisProfile.js +24 -10
- package/dist/ghidra/GhidraAnalysisSeeds.js +39 -55
- package/dist/ghidra/GhidraBridgeSources.js +12 -0
- package/dist/ghidra/GhidraClient.js +362 -148
- package/dist/ghidra/GhidraClientStartup.js +5 -3
- package/dist/ghidra/GhidraClientWire.js +5 -2
- package/dist/ghidra/GhidraDiagnostics.js +16 -5
- package/dist/ghidra/GhidraDoctor.js +45 -14
- package/dist/ghidra/GhidraDosSnapshot.js +83 -0
- package/dist/ghidra/GhidraExecutableHeader.js +54 -0
- package/dist/ghidra/GhidraFileArtifacts.js +93 -0
- package/dist/ghidra/GhidraFunctionValues.js +1 -0
- package/dist/ghidra/GhidraInstallation.js +143 -142
- package/dist/ghidra/GhidraInstallationPolicy.js +20 -79
- package/dist/ghidra/GhidraInstallationProperties.js +57 -0
- package/dist/ghidra/GhidraInventoryValues.js +22 -6
- package/dist/ghidra/GhidraJavaLaunch.js +11 -4
- package/dist/ghidra/GhidraJavaProbe.js +267 -0
- package/dist/ghidra/GhidraJavaProperties.js +9 -7
- package/dist/ghidra/GhidraLanguageCatalog.js +12 -7
- package/dist/ghidra/GhidraLauncher.js +128 -65
- package/dist/ghidra/GhidraLoadImageAttest.js +75 -78
- package/dist/ghidra/GhidraLoadImageValues.js +39 -29
- package/dist/ghidra/GhidraMipsProfile.js +13 -5
- package/dist/ghidra/GhidraNativeAotSnapshotOwner.js +221 -0
- package/dist/ghidra/GhidraPeProfile.js +88 -18
- package/dist/ghidra/GhidraProvider.js +219 -32
- package/dist/ghidra/GhidraProviderCapabilities.js +17 -4
- package/dist/ghidra/GhidraProviderClient.js +199 -239
- package/dist/ghidra/GhidraPspExtension.js +104 -34
- package/dist/ghidra/GhidraPspProfile.js +4 -1
- package/dist/ghidra/GhidraRawBinaryLanguage.js +13 -4
- package/dist/ghidra/GhidraReleasePolicy.js +93 -0
- package/dist/ghidra/GhidraRequestQueue.js +64 -40
- package/dist/ghidra/GhidraSessionError.js +152 -19
- package/dist/ghidra/GhidraSessionValues.js +13 -3
- package/dist/ghidra/GhidraSocketConnection.js +25 -11
- package/dist/ghidra/GhidraTargetSnapshot.js +67 -50
- package/dist/ghidra/GhidraTransport.js +86 -63
- package/dist/ghidra/extensions/GhidraExtensions.js +30 -45
- package/dist/go/GoBinaryProvider.js +89 -60
- package/dist/go/GoElfImage.js +3 -3
- package/dist/hopper/BridgeLauncher.js +43 -4
- package/dist/hopper/HopperAnalysisProfile.js +4 -2
- package/dist/hopper/HopperCleanup.js +14 -1
- package/dist/hopper/HopperClient.js +135 -63
- package/dist/hopper/HopperProvider.js +4 -7
- package/dist/hopper/HopperProviderCapabilities.js +2 -1
- package/dist/hopper/HopperRegexSearch.js +21 -60
- package/dist/ida/IdaBusyHealth.js +36 -2
- package/dist/ida/IdaMcpConnection.js +17 -11
- package/dist/ida/IdaNativeProtocol.js +1 -9
- package/dist/ida/IdaOperationRunner.js +8 -26
- package/dist/ida/IdaProtocolValues.js +2 -1
- package/dist/ida/IdaProvider.js +18 -2
- package/dist/ida/IdaSessionClient.js +54 -12
- package/dist/inspector/V8InspectorCaptureProjection.js +7 -0
- package/dist/inspector/V8InspectorProvider.js +2 -0
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +25 -4
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +4 -3
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +3 -2
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +7 -1
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +1 -1
- package/dist/javascript/recovery/RecoveryFiles.js +57 -8
- package/dist/jeb/JebMcpConnection.js +129 -70
- package/dist/jeb/JebMcpConnectionOwner.js +116 -0
- package/dist/jeb/JebMcpDeadline.js +46 -0
- package/dist/jeb/JebProvider.js +77 -51
- package/dist/kuna/KunaAddress.js +11 -0
- package/dist/kuna/KunaCommand.js +217 -0
- package/dist/kuna/KunaConfiguration.js +90 -0
- package/dist/kuna/KunaDoctor.js +198 -0
- package/dist/kuna/KunaInstallation.js +137 -0
- package/dist/kuna/KunaJson.js +23 -0
- package/dist/kuna/KunaJsonStream.js +433 -0
- package/dist/kuna/KunaLimits.js +5 -0
- package/dist/kuna/KunaProjectCache.js +804 -0
- package/dist/kuna/KunaProjectExport.js +202 -0
- package/dist/kuna/KunaProjectFiles.js +191 -0
- package/dist/kuna/KunaProjectReader.js +115 -0
- package/dist/kuna/KunaProvider.js +217 -0
- package/dist/kuna/KunaProviderCapabilities.js +102 -0
- package/dist/kuna/KunaQueryErrors.js +12 -0
- package/dist/kuna/KunaQueryWork.js +113 -0
- package/dist/kuna/KunaReferenceFiles.js +258 -0
- package/dist/kuna/KunaReferenceQueries.js +211 -0
- package/dist/kuna/KunaRelease.js +10 -0
- package/dist/kuna/KunaRunSlots.js +56 -0
- package/dist/kuna/KunaSessionClient.js +1162 -0
- package/dist/kuna/KunaStringInventory.js +145 -0
- package/dist/kuna/KunaStringQueries.js +133 -0
- package/dist/kuna/KunaTargetCommands.js +205 -0
- package/dist/kuna/KunaUnavailable.js +11 -0
- package/dist/main/processShutdown.js +17 -0
- package/dist/main/transport.js +21 -1
- package/dist/main.js +2 -12
- package/dist/mcp/AnalysisProvider-BABWbLoM.js +38 -0
- package/dist/mcp/{AnalysisSnapshotFiles-BAbiJQOc.js → AnalysisSnapshotFiles-BXz0c37-.js} +39 -28
- package/dist/mcp/{ProcessOwnership-Bl_3ejLe.js → ArtifactFileOperation-64cQKI7B.js} +274 -72
- package/dist/mcp/{ArtifactProvider-DViCU_rn.js → ArtifactProvider-Dx6pmil1.js} +371 -354
- package/dist/mcp/ArtifactProviderMetadata-UCJr2oZW.js +167 -0
- package/dist/mcp/{ArtifactReader-OyM03Gjn.js → ArtifactReader-BrnwNaKY.js} +29 -6
- package/dist/mcp/ArtifactResourceScope-zi3Dkqzy.js +175 -0
- package/dist/mcp/{AsarHeader-WsPgoooH.js → AsarHeader-B_IbppTz.js} +1 -1
- package/dist/mcp/{BinarySessionStatus-B4P9gf-S.js → BinarySessionStatus-CZ9nnXMt.js} +5 -4
- package/dist/mcp/{BinaryTargetResolver-BMaE_0H1.js → BinaryTargetResolver-BUncASDP.js} +146 -215
- package/dist/mcp/BoundedFileBytes-DYt5q9G2.js +43 -0
- package/dist/mcp/{CdpCaptureDocuments-HDiF2O7k.js → CdpCaptureDocuments-Y2uFcBpl.js} +194 -145
- package/dist/mcp/{CdpCaptureValues-M-j6CIh1.js → CdpCaptureValues-tNIg-gQK.js} +12 -5
- package/dist/mcp/{CdpConnection-BpDfz4MK.js → CdpEndpoint-BrhMhpSi.js} +352 -281
- package/dist/mcp/{CdpOptionalCommand-BPjRD9Kz.js → CdpOptionalCommand-PZZhlqxv.js} +2 -2
- package/dist/mcp/CdpTargetSession-BmmDC3XO.js +290 -0
- package/dist/mcp/{DirectAnalysis-DrafbXke.js → DirectAnalysis-B9KuCHTG.js} +29 -21
- package/dist/mcp/{DirectAnalysisStatus-CjjeDLzW.js → DirectAnalysisStatus-BgzopkIt.js} +7 -7
- package/dist/mcp/{ElectronFileScope-BPG_YoyU.js → ElectronFileScope-FXtK0d6I.js} +1 -1
- package/dist/mcp/ElectronFuseFailures-uZ_wOV6T.js +610 -0
- package/dist/mcp/MachoLoadCommandReader-C2VGgHA3.js +330 -0
- package/dist/mcp/{ManagedStaticProvider-BthZbKyZ.js → ManagedStaticProvider-CZuoPme2.js} +429 -131
- package/dist/mcp/{NativeMacOSProvider-Bh79k8dI.js → NativeMacOSProvider-CMguKrvN.js} +1376 -748
- package/dist/mcp/{NativeMacOSProviderMetadata-N1lPOaY_.js → NativeMacOSProviderMetadata-B_RH4KXF.js} +97 -7
- package/dist/mcp/{ProviderDeadline-DskQ94YD.js → OwnedCommand-BW1jBSt9.js} +436 -127
- package/dist/mcp/ProcedureAddressResolution-H6Qwpb_Y.js +59 -0
- package/dist/mcp/{WorkflowEvidence-umWrB_wm.js → WorkflowEvidence-CO4C7ALz.js} +16 -9
- package/dist/mcp/analysisErrorCleanup-Q344SnTO.js +34 -0
- package/dist/mcp/analysisErrorCore-BIEP7tvF.js +509 -0
- package/dist/mcp/{analysisErrorProjection-BN0EPM-3.js → analysisErrorProjection-B8teQwwD.js} +80 -30
- package/dist/mcp/{artifactToolContracts-Di4qZlEt.js → artifactToolContracts-C9dRDo-D.js} +6 -4
- package/dist/mcp/{browserObservation-C0s4i8UI.js → browserObservation-DUraZs62.js} +272 -107
- package/dist/mcp/{browserObservationError-CyLugqX4.js → browserObservationError-C5okJ5el.js} +27 -4
- package/dist/mcp/{browserObservationSchemas-tgqjH7aA.js → browserObservationSchemas-DwGGxBpu.js} +3 -3
- package/dist/mcp/{browserScenario-CAQ8Fns9.js → browserScenario-BRUz7yN0.js} +844 -358
- package/dist/mcp/{browserScenarioCapture-CTNFN-FI.js → browserScenarioCapture-CiMAsMx8.js} +127 -11
- package/dist/mcp/{InterfaceBuilderDecodeBudget-5F2AkxJT.js → callerPath-CpPnMZyN.js} +91 -65
- package/dist/mcp/{electronActiveObservation-lDvQTMR0.js → electronActiveObservation-DV0Ffy9X.js} +1 -0
- package/dist/mcp/electronFuses-D5SS7XXw.js +367 -0
- package/dist/mcp/{electronObservation-i7LcILQ-.js → electronObservation-DsN-NqY1.js} +134 -75
- package/dist/mcp/{electronObservation-DFOFEood.js → electronObservation-wOYWwqgF.js} +3 -3
- package/dist/mcp/{electronScenario-nCzE6IfJ.js → electronScenario-CYrt2zBK.js} +395 -135
- package/dist/mcp/{emptyArraySchema-tL6Qymyd.js → emptyArraySchema-C0o2Sxwp.js} +2 -2
- package/dist/mcp/{enhancedInputs-DgdEnzHy.js → enhancedInputs-6CCgB3VB.js} +1 -1
- package/dist/mcp/{javascriptRuntimeObservation-61NhCf7H.js → javascriptRuntimeObservation-BVbhkO2-.js} +12 -9
- package/dist/mcp/{javascriptRuntimeObservation-PIUoLfX6.js → javascriptRuntimeObservation-Cu0Yedqq.js} +2 -2
- package/dist/mcp/{lipo-Bnkoq_6W.js → lipo-DSTgUqL1.js} +11 -118
- package/dist/mcp/{logger-BQY5ulYv.js → logger-BGdGHadX.js} +2 -2
- package/dist/mcp/machoContainer-CMSxUBlK.js +605 -0
- package/dist/mcp/{main-kBXHZ8S5.js → main-Cx-Z7m_n.js} +16788 -5902
- package/dist/mcp/main.js +1 -1
- package/dist/mcp/{managedToolContracts-CK--I_s7.js → managedToolContracts-CSlbKJP-.js} +3 -3
- package/dist/mcp/{nativeValueTrace-DR9UE62L.js → nativeValueTrace-BEZbDieM.js} +2630 -2468
- package/dist/mcp/{officialToolContracts-B67NJ2tC.js → officialToolContracts-CauCcSsc.js} +74 -55
- package/dist/mcp/peMachine-aP1iYnHq.js +95 -0
- package/dist/mcp/propertyListKeys-BfCo0k4w.js +356 -0
- package/dist/mcp/providerCleanupError-DIRHxzWo.js +125 -0
- package/dist/mcp/{providerOperationHealth-CTYa3iLf.js → providerOperationHealth-9DRSGM8N.js} +24 -1
- package/dist/mcp/{scanCanonical-CRXSpule.js → scanCanonical-CF3ATd1V.js} +269 -463
- package/dist/mcp/{serverIdentity-Cio4iFV3.js → serverIdentity-BK0Ejd_Y.js} +262 -83
- package/dist/mcp/{sourceMapEnvelope-C0uJlrOh.js → sourceMapEnvelope-DAaRUIGj.js} +4 -4
- package/dist/mcp/{toolContracts-BW05wpcr.js → toolContracts-BPoHQdlC.js} +541 -327
- package/dist/mcp/{toolOutputSchemaGroups-ColvNZ1r.js → toolOutputSchemaGroups-MJ_f-PMK.js} +2551 -2354
- package/dist/mcp/{webContentArtifact-Dzjc1z-R.js → webContentArtifact-DfGkgDcI.js} +2 -17
- package/dist/mcp/{webRuntime-K__NYzXm.js → webRuntime-ccyhkRru.js} +2 -2
- package/dist/mcp/{webSourceLocation-DbMAT2J9.js → webSourceLocation-DKIum0vJ.js} +6451 -4414
- package/dist/mcpDoctor.js +4 -2
- package/dist/mcpStartupPolicy.js +18 -3
- package/dist/native/AppleDispatchMetadata.js +76 -27
- package/dist/native/AppleMachoFixups.js +20 -10
- package/dist/native/AppleObjcCategories.js +12 -1
- package/dist/native/AppleObjcDispatchFacets.js +21 -12
- package/dist/native/AppleObjcProperties.js +61 -17
- package/dist/native/AppleObjcProtocols.js +25 -7
- package/dist/native/AppleSwiftVtables.js +2 -0
- package/dist/native/CommandRunner.js +13 -9
- package/dist/native/LldbCallTracer.js +232 -178
- package/dist/native/LldbReadbackFiles.js +70 -0
- package/dist/native/LldbRetainedObservations.js +28 -56
- package/dist/native/NativeCallObservation.js +53 -52
- package/dist/native/NativeCallTarget.js +95 -0
- package/dist/native/NativeMacOSProvider.js +240 -171
- package/dist/native/NativeMachoInspection.js +21 -7
- package/dist/native/NativePlistSource.js +179 -0
- package/dist/native/NativeUiCleanupError.js +30 -0
- package/dist/native/NativeUiHelperRuntime.js +48 -35
- package/dist/native/NativeUiObservation.js +67 -45
- package/dist/native/SignatureTargetBinding.js +72 -53
- package/dist/native/parsers/demangle.js +16 -12
- package/dist/native/parsers/machoUuid.js +4 -4
- package/dist/native/parsers/otool.js +57 -17
- package/dist/native/parsers/plist.js +40 -25
- package/dist/native/pe/PeResourceLayout.js +22 -7
- package/dist/native/pe/PeResourceParser.js +10 -9
- package/dist/native/pe/PeResourcesProvider.js +63 -16
- package/dist/native/pwndbg/CoreFileMappingAuthority.js +51 -0
- package/dist/native/pwndbg/PwndbgCoreContext.js +26 -15
- package/dist/native/pwntools/PwntoolsDecoder.js +116 -53
- package/dist/native/pwntools/PwntoolsFailures.js +17 -3
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +11 -1
- package/dist/objdump/ObjdumpCommand.js +5 -2
- package/dist/pcap/PcapOutput.js +38 -2
- package/dist/pcap/PcapProvider.js +45 -15
- package/dist/pcap/PcapSnapshot.js +24 -4
- package/dist/process/ArtifactAnalysisResources.js +145 -52
- package/dist/process/BoundedFileBytes.js +8 -3
- package/dist/process/CurrentEntrypointPath.js +3 -1
- package/dist/process/DarwinProcessRunTokenReader.js +174 -63
- package/dist/process/DetachedPgpSignature.js +57 -0
- package/dist/process/ExecFileOutput.js +14 -11
- package/dist/{hopper/HopperTargetLease.js → process/HopperLease.js} +10 -0
- package/dist/process/LinuxResourceLimits.js +4 -24
- package/dist/process/OwnedCommand.js +109 -14
- package/dist/process/ProviderProcess.js +129 -10
- package/dist/process/RegexMatcher.js +96 -0
- package/dist/process/SharedStartupAttempt.js +59 -0
- package/dist/process/WindowsAuthority.js +1 -1
- package/dist/process/capture/FilesystemSnapshot.js +3 -2
- package/dist/process/capture/ProcessCaptureError.js +55 -17
- package/dist/process/capture/ProcessCaptureLifecycle.js +17 -20
- package/dist/process/capture/ProcessCaptureProgress.js +5 -3
- package/dist/process/capture/ProcessHarness.js +17 -3
- package/dist/process/snapshotEnvironment.js +8 -8
- package/dist/{application/binary → providers}/AnalysisClientCleanup.js +3 -3
- package/dist/providers/AnalysisClientCreation.js +193 -0
- package/dist/providers/AnalysisClientFailure.js +191 -0
- package/dist/providers/DeferredAnalysisClient.js +48 -0
- package/dist/providers/OwnedCommandCleanup.js +65 -0
- package/dist/providers/ProviderInspectionScope.js +10 -0
- package/dist/recordedCatalogDigests.js +2 -0
- package/dist/reference/ReferenceSourceReader.js +64 -0
- package/dist/reference/ReferenceSourceReaderEntries.js +12 -3
- package/dist/reference/ReferenceSourceReaderFile.js +2 -1
- package/dist/rizin/RizinCommand.js +2 -2
- package/dist/rizin/RizinDebugSessionManager.js +249 -210
- package/dist/rust/RustBinaryProvider.js +55 -23
- package/dist/server/EvidenceMcpServer.js +2 -2
- package/dist/server/contractToolHandler.js +17 -11
- package/dist/server/createServer.js +27 -8
- package/dist/server/promptCompletion.js +24 -22
- package/dist/server/registerArtifactComparisonTool.js +13 -2
- package/dist/server/registerBrowserScenarioTool.js +7 -5
- package/dist/server/registerBrowserTools.js +2 -4
- package/dist/server/registerCutterTools.js +2 -3
- package/dist/server/registerElectronTools.js +2 -13
- package/dist/server/registerFridaTools.js +8 -12
- package/dist/server/registerInvestigationTools.js +20 -20
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -4
- package/dist/server/registerManagedWorkflowTools/evidence.js +14 -7
- package/dist/server/registerProcessComparisonTool.js +3 -0
- package/dist/server/registerSessionStatusTool.js +13 -6
- package/dist/server/registerSessionTools.js +16 -29
- package/dist/server/runDerivedOperation.js +2 -0
- package/dist/signals/SigrokRecordingProvider.js +13 -6
- package/dist/sqlite/SqliteDatabaseFailures.js +25 -12
- package/dist/sqlite/SqliteDatabaseInspection.js +27 -12
- package/dist/sqlite/SqliteDatabaseSnapshot.js +58 -32
- package/dist/sqlite/SqliteDatabaseWorkerExecution.js +18 -3
- package/dist/wasm/WabtArtifactProvider.js +64 -42
- package/dist/wasm/WabtFailures.js +19 -1
- package/dist/wasm/WabtRuntime.js +58 -0
- package/dist/wasm/WasmGlueAdapter.js +20 -7
- package/dist/windows/WindowsNativeLoader.js +16 -2
- package/dist/windows/WindowsPrivateRuntime.js +44 -1
- package/licenses/npm-dependencies.txt +146 -1
- package/licenses/npm-runtime-notices.txt +175 -1
- package/native/windows/README.md +44 -7
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +11 -3
- package/scripts/electron-active-hook-boundaries.cjs +15 -2
- package/scripts/electron-active-hook.cjs +408 -46
- package/scripts/hopper-demo-x11.py +12 -10
- package/scripts/rea.mjs +62 -15
- package/skills/reverse-engineer-anything/SKILL.md +21 -7
- package/skills/reverse-engineer-anything/references/android-applications.md +3 -1
- package/skills/reverse-engineer-anything/references/javascript-applications.md +44 -1
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +30 -10
- package/dist/cli-runtime/ArtifactResourceScope-DQWTcUwE.js +0 -114
- package/dist/cli-runtime/ClientConfigPath-c6jr6INc.js +0 -36
- package/dist/cli-runtime/IdaConfiguration-CtGP7EKo.js +0 -1094
- package/dist/cli-runtime/JebMcpEndpoint-DUytrn5G.js +0 -428
- package/dist/cli-runtime/MacHopperPaths-CwL5lYPX.js +0 -434
- package/dist/cli-runtime/OwnedCommand-Cj9GhmPR.js +0 -112
- package/dist/cli-runtime/RegularFile-B_6KPCNQ.js +0 -139
- package/dist/cli-runtime/RegularFileRead-DVlC5faM.js +0 -125
- package/dist/cli-runtime/analysisErrorPresentation-DGt7TdsH.js +0 -497
- package/dist/cli-runtime/application__javascript__ElectronObservationService-DEsR8KDN.js +0 -63
- package/dist/cli-runtime/artifactOperationError-B7n03FbD.js +0 -27
- package/dist/cli-runtime/browserObservationError-Dx6xRTjb.js +0 -40
- package/dist/cli-runtime/cliResultOutput-DsRMI8CJ.js +0 -780
- package/dist/cli-runtime/mcpStartupPolicy-CVVSOmRc.js +0 -21
- package/dist/cli-runtime/propertyListKeys-G8e74YWb.js +0 -248
- package/dist/cli-runtime/providerAdapterError-DAjhICdr.js +0 -25
- package/dist/cli-runtime/readFileHandleChunks-dp60iZ6v.js +0 -38
- package/dist/hopper/HopperRegexWorker.js +0 -27
- package/dist/mcp/ArtifactProviderMetadata-b7pOK5_t.js +0 -76
- package/dist/mcp/ArtifactResourceScope-P3tq5z8Z.js +0 -162
- package/dist/mcp/BoundedFileBytes-DuczXiQZ.js +0 -68
- package/dist/mcp/CdpTargetSession-BsPoKhEU.js +0 -86
- package/dist/mcp/ProcedureAddressResolution-CQpuwm1h.js +0 -19
- package/dist/mcp/analysisErrorCore-DXRTvF_m.js +0 -235
- package/dist/mcp/artifactOperationError-CkHMMaf7.js +0 -27
- package/dist/mcp/digests-BFoWUT_-.js +0 -223
- package/dist/mcp/propertyListKeys-DD25WsjI.js +0 -553
- package/dist/mcp/providerAdapterError-sDxToNal.js +0 -25
- package/dist/mcp/unicodeCodePointOrder-BezCbTpg.js +0 -26
|
@@ -1,29 +1,85 @@
|
|
|
1
1
|
import { __esmMin } from "./rolldown-runtime-DXoylpqc.js";
|
|
2
|
-
import { PLAYWRIGHT_RESPONSE_BODY_PROVENANCE_LIMITATION, browserObservationEndpointSchema, browserScenarioCaptureSchema, browserScenarioEventSchema, browserScenarioStepSchema, browserStepArtifactsSchema, classifyBrowserScenarioCompleteness, err, init_browserNetworkEvidence, init_browserObservation, init_browserScenarioCapture, init_browserScenarioCaptureValues, init_result, isLiteralLoopbackHostname, ok, sanitizeBrowserUrl } from "./reconstructionObligationLedgerSchemas-
|
|
3
|
-
import { AnalysisCancelledError, AnalysisError, AnalysisTimeoutError, init_analysisErrorBase, init_analysisErrorCore } from "./errorSchemas-
|
|
4
|
-
import {
|
|
5
|
-
import { BrowserObservationError, init_browserObservationError } from "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { DEFAULT_BROWSER_SCENARIO_CAPTURE_LIMITS, PLAYWRIGHT_RESPONSE_BODY_PROVENANCE_LIMITATION, browserObservationEndpointSchema, browserScenarioCaptureSchema, browserScenarioEventSchema, browserScenarioStepSchema, browserStepArtifactsSchema, classifyBrowserScenarioCompleteness, err, init_browserNetworkEvidence, init_browserObservation, init_browserScenarioCapture, init_browserScenarioCaptureLimits, init_browserScenarioCaptureValues, init_result, isLiteralLoopbackHostname, ok, sanitizeBrowserUrl } from "./reconstructionObligationLedgerSchemas-Bi6sect1.js";
|
|
3
|
+
import { AnalysisCancelledError, AnalysisError, AnalysisTimeoutError, init_analysisErrorBase, init_analysisErrorCore } from "./errorSchemas-Ixz_q7qt.js";
|
|
4
|
+
import { AnalysisCleanupLease, AnalysisCleanupLeaseGroup, init_AnalysisCleanupLease } from "./AnalysisCleanupLease-CWfTGYKd.js";
|
|
5
|
+
import { BrowserObservationError, ProviderAdapterError, init_browserObservationError, init_providerAdapterError } from "./cliResultOutput-10sd6xGx.js";
|
|
6
|
+
import { analysisErrorWithCleanupFailure, init_analysisErrorCleanup } from "./analysisErrorCleanup-COdAmDsb.js";
|
|
7
|
+
import { ProviderCleanupError, init_providerCleanupError } from "./providerCleanupError-BhsJyAhk.js";
|
|
8
|
+
import { CdpConnection, attachCdpTargetSession, init_CdpConnection, init_CdpEndpoint, init_CdpTargetSession, openCdpEndpoint, withCdpDiscoveryDeadline } from "./CdpTargetSession-CQ08KHbh.js";
|
|
8
9
|
import { PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY, init_providerIdentities } from "./providerIdentities-Ao1XTvwx.js";
|
|
9
10
|
import { z } from "zod";
|
|
10
11
|
import { join, resolve } from "node:path";
|
|
11
12
|
import { createHash, randomUUID } from "node:crypto";
|
|
12
|
-
import { chmod, mkdtemp, rm } from "node:fs/promises";
|
|
13
13
|
import { tmpdir } from "node:os";
|
|
14
|
+
import { chmod, mkdtemp, rm } from "node:fs/promises";
|
|
15
|
+
|
|
16
|
+
//#region dist/browser/PlaywrightExecutionBoundary.js
|
|
17
|
+
var OPERATION$5, PLAYWRIGHT_CLEANUP_CONFIRMATION_TIMEOUT_MS, withPlaywrightExecutionBoundary;
|
|
18
|
+
function init_PlaywrightExecutionBoundary() {
|
|
19
|
+
return (init_PlaywrightExecutionBoundary = __esmMin((() => {
|
|
20
|
+
init_analysisErrorCore();
|
|
21
|
+
OPERATION$5 = "capture_browser_scenario";
|
|
22
|
+
PLAYWRIGHT_CLEANUP_CONFIRMATION_TIMEOUT_MS = 3e4;
|
|
23
|
+
withPlaywrightExecutionBoundary = (work, timeoutMs, signal) => {
|
|
24
|
+
if (timeoutMs !== undefined && timeoutMs <= 0) return Promise.reject(new AnalysisTimeoutError(OPERATION$5, timeoutMs));
|
|
25
|
+
if (signal?.aborted === true) return Promise.reject(new AnalysisCancelledError(OPERATION$5, { cause: signal.reason }));
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
let settled = false;
|
|
28
|
+
let timer;
|
|
29
|
+
const deadline = timeoutMs === undefined ? undefined : performance.now() + timeoutMs;
|
|
30
|
+
const scheduleTimeout = () => {
|
|
31
|
+
if (deadline === undefined) return;
|
|
32
|
+
const remaining = deadline - performance.now();
|
|
33
|
+
if (remaining <= 0) {
|
|
34
|
+
fail(new AnalysisTimeoutError(OPERATION$5, timeoutMs ?? 0));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
timer = setTimeout(scheduleTimeout, Math.min(remaining, 2147483647));
|
|
38
|
+
timer.unref();
|
|
39
|
+
};
|
|
40
|
+
const cleanup = () => {
|
|
41
|
+
if (timer !== undefined) clearTimeout(timer);
|
|
42
|
+
signal?.removeEventListener("abort", onAbort);
|
|
43
|
+
};
|
|
44
|
+
const succeed = (value) => {
|
|
45
|
+
if (settled) return;
|
|
46
|
+
settled = true;
|
|
47
|
+
cleanup();
|
|
48
|
+
resolve(value);
|
|
49
|
+
};
|
|
50
|
+
const fail = (error) => {
|
|
51
|
+
if (settled) return;
|
|
52
|
+
settled = true;
|
|
53
|
+
cleanup();
|
|
54
|
+
reject(error);
|
|
55
|
+
};
|
|
56
|
+
const onAbort = () => {
|
|
57
|
+
fail(new AnalysisCancelledError(OPERATION$5, { cause: signal?.reason }));
|
|
58
|
+
};
|
|
59
|
+
scheduleTimeout();
|
|
60
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
61
|
+
if (signal?.aborted === true) {
|
|
62
|
+
onAbort();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
void work().then(succeed, fail);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
})))();
|
|
69
|
+
}
|
|
14
70
|
|
|
71
|
+
//#endregion
|
|
15
72
|
//#region dist/browser/BrowserScenarioPartialObservation.js
|
|
16
|
-
var OPERATION$
|
|
73
|
+
var OPERATION$4, browserScenarioLimitations, browserScenarioCaptureData, browserScenarioCleanupObservation, browserScenarioOperationFailure;
|
|
17
74
|
function init_BrowserScenarioPartialObservation() {
|
|
18
75
|
return (init_BrowserScenarioPartialObservation = __esmMin((() => {
|
|
19
76
|
init_browserNetworkEvidence();
|
|
20
77
|
init_analysisErrorBase();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
init_browserObservationError();
|
|
78
|
+
init_analysisErrorCleanup();
|
|
79
|
+
init_providerCleanupError();
|
|
24
80
|
init_providerAdapterError();
|
|
25
81
|
init_providerIdentities();
|
|
26
|
-
OPERATION$
|
|
82
|
+
OPERATION$4 = "capture_browser_scenario";
|
|
27
83
|
browserScenarioLimitations = (session, scenario, events) => {
|
|
28
84
|
const capturedResponseBody = scenario.capture.network.response_body && events.some((event) => event.kind === "network-content" && event.phase === "response" && event.body.state === "captured" && (event.body.representation === "playwright-response-body-bytes" || event.body.representation === "browser-decoded-response-bytes"));
|
|
29
85
|
return [
|
|
@@ -36,7 +92,11 @@ function init_BrowserScenarioPartialObservation() {
|
|
|
36
92
|
"Storage values are hashed only after declared-secret redaction.",
|
|
37
93
|
...scenario.storage.local_storage.length === 0 && scenario.storage.session_storage.length === 0 ? [] : ["Non-cookie storage seeds use CDP pre-script instrumentation; only pauses in the scenario's private seed script are resumed by this observer."],
|
|
38
94
|
...session.eventLimitations?.() ?? [],
|
|
39
|
-
...session.mode === "connect" ? [
|
|
95
|
+
...session.mode === "connect" ? [
|
|
96
|
+
"CDP attachment cannot recover pre-attach events or guarantee launch-time context options.",
|
|
97
|
+
`Attached locale ${scenario.environment.locale} applies to Intl formatting only; navigator.language(s) and Accept-Language remain caller-controlled. Use launch mode for matching page and request languages.`,
|
|
98
|
+
"Detaching a CDP page session may clear caller-owned navigator.platform emulation. REA cannot snapshot the caller's complete user-agent/client-hint state before attachment; use launch mode to avoid mutating that external browser."
|
|
99
|
+
] : []
|
|
40
100
|
];
|
|
41
101
|
};
|
|
42
102
|
browserScenarioCaptureData = (input) => {
|
|
@@ -54,7 +114,8 @@ function init_BrowserScenarioPartialObservation() {
|
|
|
54
114
|
action_count: input.scenario.actions.length,
|
|
55
115
|
secret_references: input.scenario.secrets.map(({ secret_id: id }) => id).sort(),
|
|
56
116
|
network_content: input.scenario.capture.network,
|
|
57
|
-
event_families: [...new Set(input.scenario.capture.events)].sort()
|
|
117
|
+
event_families: [...new Set(input.scenario.capture.events)].sort(),
|
|
118
|
+
limits: input.scenario.capture.limits
|
|
58
119
|
},
|
|
59
120
|
duration_ms: Math.max(0, Math.round(performance.now() - input.startedAt)),
|
|
60
121
|
steps: [...input.steps],
|
|
@@ -67,53 +128,39 @@ function init_BrowserScenarioPartialObservation() {
|
|
|
67
128
|
resources: cause instanceof AnalysisError && cause.cleanupResources.length > 0 ? cause.cleanupResources : ["browser_transport"]
|
|
68
129
|
};
|
|
69
130
|
browserScenarioOperationFailure = (cause, partialObservation, cleanupFailure) => {
|
|
70
|
-
const primary = cause instanceof AnalysisError ? cause : new ProviderAdapterError(PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY.id, OPERATION$
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
...primary.capturedOutput === undefined ? {} : { capturedOutput: primary.capturedOutput },
|
|
78
|
-
...primary.cleanup === undefined ? {} : { cleanup: primary.cleanup }
|
|
79
|
-
};
|
|
80
|
-
if (cleanupCause === undefined) {
|
|
81
|
-
if (primary instanceof AnalysisCancelledError) return new AnalysisCancelledError(primary.operation, retainedOptions);
|
|
82
|
-
if (primary instanceof AnalysisTimeoutError) return new AnalysisTimeoutError(primary.operation, primary.timeoutMs, retainedOptions);
|
|
83
|
-
if (primary instanceof BrowserObservationError) return new BrowserObservationError(primary.operation, primary.reason, {
|
|
84
|
-
...retainedOptions,
|
|
85
|
-
...primary.userMessage === undefined ? {} : { detail: primary.userMessage }
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
const cleanup = cleanupObservation ?? primary.cleanup;
|
|
89
|
-
return new ProviderAdapterError(PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY.id, OPERATION$5, {
|
|
90
|
-
...retainedOptions,
|
|
91
|
-
cause: cleanupCause === undefined ? primary : new AggregateError([primary, cleanupCause], "Browser scenario operation and cleanup both failed", { cause: primary }),
|
|
92
|
-
userMessage: primaryProjection.message,
|
|
93
|
-
...cleanup === undefined ? {} : { cleanup },
|
|
94
|
-
diagnostics: {
|
|
95
|
-
primary_error: primaryProjection,
|
|
96
|
-
...cleanupCause === undefined ? {} : { cleanup_error: projectAnalysisError(cleanupCause) }
|
|
97
|
-
}
|
|
131
|
+
const primary = cause instanceof AnalysisError ? cause : new ProviderAdapterError(PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY.id, OPERATION$4, { cause });
|
|
132
|
+
primary.retainPartialObservation(partialObservation);
|
|
133
|
+
if (cleanupFailure === undefined) return primary;
|
|
134
|
+
const observation = browserScenarioCleanupObservation(cleanupFailure.cause);
|
|
135
|
+
const cleanup = cleanupFailure.cause instanceof AnalysisError && cleanupFailure.cause.cleanupIncomplete ? cleanupFailure.cause : new ProviderCleanupError(PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY.id, observation.resources, { reason: observation.reason }, {
|
|
136
|
+
operation: "close_browser_scenario",
|
|
137
|
+
cause: cleanupFailure.cause
|
|
98
138
|
});
|
|
139
|
+
return analysisErrorWithCleanupFailure(primary, cleanup, OPERATION$4).bindCleanupDependencies([primary, cleanup]);
|
|
99
140
|
};
|
|
100
141
|
})))();
|
|
101
142
|
}
|
|
102
143
|
|
|
103
144
|
//#endregion
|
|
104
145
|
//#region dist/browser/PlaywrightBrowserScenarioProvider.js
|
|
105
|
-
var OPERATION$
|
|
146
|
+
var OPERATION$3, signalIsAborted, SNAPSHOT_KINDS, requestedForStep, unavailableArtifacts, stepCompleteness, createStep, initialStep, executeStep, globalCompleteness, runScenario, PlaywrightBrowserScenarioProvider;
|
|
106
147
|
function init_PlaywrightBrowserScenarioProvider() {
|
|
107
148
|
return (init_PlaywrightBrowserScenarioProvider = __esmMin((() => {
|
|
149
|
+
init_PlaywrightExecutionBoundary();
|
|
150
|
+
init_analysisErrorCleanup();
|
|
151
|
+
init_AnalysisCleanupLease();
|
|
152
|
+
init_providerCleanupError();
|
|
108
153
|
init_browserScenarioCapture();
|
|
109
154
|
init_browserScenarioCaptureValues();
|
|
110
155
|
init_analysisErrorBase();
|
|
156
|
+
init_analysisErrorCore();
|
|
111
157
|
init_browserObservationError();
|
|
112
158
|
init_providerAdapterError();
|
|
113
159
|
init_result();
|
|
114
160
|
init_BrowserScenarioPartialObservation();
|
|
115
161
|
init_providerIdentities();
|
|
116
|
-
OPERATION$
|
|
162
|
+
OPERATION$3 = "capture_browser_scenario";
|
|
163
|
+
signalIsAborted = (signal) => signal?.aborted === true;
|
|
117
164
|
SNAPSHOT_KINDS = [
|
|
118
165
|
"screenshot",
|
|
119
166
|
"dom",
|
|
@@ -236,7 +283,7 @@ function init_PlaywrightBrowserScenarioProvider() {
|
|
|
236
283
|
return classifyBrowserScenarioCompleteness(missing, truncated);
|
|
237
284
|
};
|
|
238
285
|
runScenario = async (openSession, scenario, options, retainCleanup) => {
|
|
239
|
-
if (options.signal?.aborted
|
|
286
|
+
if (options.signal?.aborted) throw new BrowserObservationError(OPERATION$3, "cancelled", { cause: options.signal.reason });
|
|
240
287
|
const startedAt = performance.now();
|
|
241
288
|
const session = await openSession(scenario, {
|
|
242
289
|
...options.signal === undefined ? {} : { signal: options.signal },
|
|
@@ -277,13 +324,23 @@ function init_PlaywrightBrowserScenarioProvider() {
|
|
|
277
324
|
cleanup: await session.close()
|
|
278
325
|
};
|
|
279
326
|
} catch (cause) {
|
|
327
|
+
const cleanup = browserScenarioCleanupObservation(cause);
|
|
328
|
+
const failure = new BrowserObservationError(OPERATION$3, "cleanup_failed", {
|
|
329
|
+
cause,
|
|
330
|
+
cleanup
|
|
331
|
+
});
|
|
332
|
+
retainCleanup(session.cleanupLease);
|
|
333
|
+
new AnalysisCleanupLeaseGroup(failure, [session.cleanupLease]);
|
|
280
334
|
cleanupOutcome = {
|
|
281
335
|
ok: false,
|
|
282
|
-
cause
|
|
336
|
+
cause: failure
|
|
283
337
|
};
|
|
284
|
-
retainCleanup(() => session.close());
|
|
285
338
|
}
|
|
286
339
|
if (!cleanupOutcome.ok) {
|
|
340
|
+
if (operationOutcome.ok && options.signal?.aborted) operationOutcome = {
|
|
341
|
+
ok: false,
|
|
342
|
+
cause: new AnalysisCancelledError(OPERATION$3, { cause: options.signal.reason })
|
|
343
|
+
};
|
|
287
344
|
const cleanup = browserScenarioCleanupObservation(cleanupOutcome.cause);
|
|
288
345
|
const partialObservation = {
|
|
289
346
|
kind: "browser-scenario-observation",
|
|
@@ -297,12 +354,14 @@ function init_PlaywrightBrowserScenarioProvider() {
|
|
|
297
354
|
})
|
|
298
355
|
};
|
|
299
356
|
if (!operationOutcome.ok) throw browserScenarioOperationFailure(operationOutcome.cause, partialObservation, { cause: cleanupOutcome.cause });
|
|
300
|
-
|
|
357
|
+
const failure = new BrowserObservationError(OPERATION$3, "cleanup_failed", {
|
|
301
358
|
cause: cleanupOutcome.cause,
|
|
302
359
|
cleanup,
|
|
303
360
|
partialObservation,
|
|
304
361
|
detail: `Browser scenario cleanup could not be confirmed: ${cleanup.reason}. Collected steps and events are retained in partial_observation. Review the reported resources before retrying.`
|
|
305
362
|
});
|
|
363
|
+
if (cleanupOutcome.cause instanceof AnalysisError && cleanupOutcome.cause.cleanupIncomplete) failure.bindCleanupDependencies([cleanupOutcome.cause]);
|
|
364
|
+
throw failure;
|
|
306
365
|
}
|
|
307
366
|
if (!operationOutcome.ok) throw browserScenarioOperationFailure(operationOutcome.cause, {
|
|
308
367
|
kind: "browser-scenario-observation",
|
|
@@ -316,7 +375,7 @@ function init_PlaywrightBrowserScenarioProvider() {
|
|
|
316
375
|
})
|
|
317
376
|
});
|
|
318
377
|
const completeness = globalCompleteness(scenario, session, steps);
|
|
319
|
-
|
|
378
|
+
const capture = browserScenarioCaptureSchema.parse({
|
|
320
379
|
...browserScenarioCaptureData({
|
|
321
380
|
session,
|
|
322
381
|
scenario,
|
|
@@ -326,6 +385,17 @@ function init_PlaywrightBrowserScenarioProvider() {
|
|
|
326
385
|
}),
|
|
327
386
|
completeness
|
|
328
387
|
});
|
|
388
|
+
if (signalIsAborted(options.signal)) throw new AnalysisCancelledError(OPERATION$3, {
|
|
389
|
+
cause: options.signal?.reason,
|
|
390
|
+
partialObservation: {
|
|
391
|
+
kind: "browser-scenario-observation",
|
|
392
|
+
capture: {
|
|
393
|
+
...capture,
|
|
394
|
+
limitations: [...capture.limitations, "Scenario capture was cancelled; collected steps, observations, and cleanup state are retained."]
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
return capture;
|
|
329
399
|
};
|
|
330
400
|
PlaywrightBrowserScenarioProvider = class {
|
|
331
401
|
openSession;
|
|
@@ -348,13 +418,21 @@ function init_PlaywrightBrowserScenarioProvider() {
|
|
|
348
418
|
async #captureScenario(scenario, options) {
|
|
349
419
|
const pending = await this.#retryCleanup();
|
|
350
420
|
if (pending !== undefined) return err(pending);
|
|
421
|
+
const retained = [];
|
|
351
422
|
try {
|
|
352
|
-
return ok(await runScenario(this.openSession, scenario, options, (
|
|
353
|
-
this.#pendingCleanup.add(
|
|
423
|
+
return ok(await runScenario(this.openSession, scenario, options, (lease) => {
|
|
424
|
+
this.#pendingCleanup.add(lease);
|
|
425
|
+
retained.push(lease);
|
|
354
426
|
}));
|
|
355
427
|
} catch (cause) {
|
|
356
|
-
|
|
357
|
-
|
|
428
|
+
const primary = cause instanceof AnalysisError ? cause : new ProviderAdapterError(PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY.id, OPERATION$3, { cause });
|
|
429
|
+
if (retained.length === 0) return err(primary);
|
|
430
|
+
const cleanup = new ProviderCleanupError(PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY.id, retained.flatMap((lease) => lease.cleanupResources ?? []), { reason: "Browser scenario cleanup capabilities remain retained." }, {
|
|
431
|
+
operation: OPERATION$3,
|
|
432
|
+
cause
|
|
433
|
+
});
|
|
434
|
+
new AnalysisCleanupLeaseGroup(cleanup, retained);
|
|
435
|
+
return err(analysisErrorWithCleanupFailure(primary, cleanup, OPERATION$3).bindCleanupDependencies([primary, cleanup]));
|
|
358
436
|
}
|
|
359
437
|
}
|
|
360
438
|
async close() {
|
|
@@ -369,7 +447,7 @@ function init_PlaywrightBrowserScenarioProvider() {
|
|
|
369
447
|
return this.#closePromise;
|
|
370
448
|
}
|
|
371
449
|
#closedError() {
|
|
372
|
-
return new BrowserObservationError(OPERATION$
|
|
450
|
+
return new BrowserObservationError(OPERATION$3, "cleanup_failed", {
|
|
373
451
|
detail: "Browser scenario provider is closing.",
|
|
374
452
|
cleanup: {
|
|
375
453
|
reason: "Provider is closing",
|
|
@@ -378,15 +456,26 @@ function init_PlaywrightBrowserScenarioProvider() {
|
|
|
378
456
|
});
|
|
379
457
|
}
|
|
380
458
|
async #retryCleanup() {
|
|
459
|
+
const failures = [];
|
|
381
460
|
for (const pending of this.#pendingCleanup) {
|
|
382
461
|
try {
|
|
383
|
-
await pending();
|
|
462
|
+
await withPlaywrightExecutionBoundary(() => pending.release(), PLAYWRIGHT_CLEANUP_CONFIRMATION_TIMEOUT_MS);
|
|
384
463
|
this.#pendingCleanup.delete(pending);
|
|
385
464
|
} catch (cause) {
|
|
386
|
-
|
|
465
|
+
const failure = new ProviderCleanupError(PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY.id, pending.cleanupResources ?? [], { reason: cause instanceof Error ? cause.message : String(cause) }, {
|
|
466
|
+
operation: OPERATION$3,
|
|
467
|
+
cause
|
|
468
|
+
});
|
|
469
|
+
new AnalysisCleanupLeaseGroup(failure, [pending]);
|
|
470
|
+
failures.push(failure);
|
|
387
471
|
}
|
|
388
472
|
}
|
|
389
|
-
return undefined;
|
|
473
|
+
if (failures.length === 0) return undefined;
|
|
474
|
+
if (failures.length === 1) return failures[0];
|
|
475
|
+
return new ProviderCleanupError(PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY.id, failures.flatMap((failure) => failure.cleanupResources), { reason: "One or more browser scenario resources remain owned." }, {
|
|
476
|
+
operation: OPERATION$3,
|
|
477
|
+
cause: new AggregateError(failures, "Browser scenario cleanup failed")
|
|
478
|
+
}).bindCleanupDependencies(failures);
|
|
390
479
|
}
|
|
391
480
|
};
|
|
392
481
|
})))();
|
|
@@ -611,120 +700,80 @@ function init_BrowserScenarioSecrets() {
|
|
|
611
700
|
})))();
|
|
612
701
|
}
|
|
613
702
|
|
|
614
|
-
//#endregion
|
|
615
|
-
//#region dist/browser/PlaywrightExecutionBoundary.js
|
|
616
|
-
var OPERATION$3, withPlaywrightExecutionBoundary;
|
|
617
|
-
function init_PlaywrightExecutionBoundary() {
|
|
618
|
-
return (init_PlaywrightExecutionBoundary = __esmMin((() => {
|
|
619
|
-
init_analysisErrorCore();
|
|
620
|
-
OPERATION$3 = "capture_browser_scenario";
|
|
621
|
-
withPlaywrightExecutionBoundary = (work, timeoutMs, signal) => {
|
|
622
|
-
if (timeoutMs !== undefined && timeoutMs <= 0) return Promise.reject(new AnalysisTimeoutError(OPERATION$3, timeoutMs));
|
|
623
|
-
if (signal?.aborted === true) return Promise.reject(new AnalysisCancelledError(OPERATION$3));
|
|
624
|
-
return new Promise((resolve, reject) => {
|
|
625
|
-
let settled = false;
|
|
626
|
-
let timer;
|
|
627
|
-
const deadline = timeoutMs === undefined ? undefined : performance.now() + timeoutMs;
|
|
628
|
-
const scheduleTimeout = () => {
|
|
629
|
-
if (deadline === undefined) return;
|
|
630
|
-
const remaining = deadline - performance.now();
|
|
631
|
-
if (remaining <= 0) {
|
|
632
|
-
fail(new AnalysisTimeoutError(OPERATION$3, timeoutMs ?? 0));
|
|
633
|
-
return;
|
|
634
|
-
}
|
|
635
|
-
timer = setTimeout(scheduleTimeout, Math.min(remaining, 2147483647));
|
|
636
|
-
timer.unref();
|
|
637
|
-
};
|
|
638
|
-
const cleanup = () => {
|
|
639
|
-
if (timer !== undefined) clearTimeout(timer);
|
|
640
|
-
signal?.removeEventListener("abort", onAbort);
|
|
641
|
-
};
|
|
642
|
-
const succeed = (value) => {
|
|
643
|
-
if (settled) return;
|
|
644
|
-
settled = true;
|
|
645
|
-
cleanup();
|
|
646
|
-
resolve(value);
|
|
647
|
-
};
|
|
648
|
-
const fail = (error) => {
|
|
649
|
-
if (settled) return;
|
|
650
|
-
settled = true;
|
|
651
|
-
cleanup();
|
|
652
|
-
reject(error);
|
|
653
|
-
};
|
|
654
|
-
const onAbort = () => {
|
|
655
|
-
fail(new AnalysisCancelledError(OPERATION$3));
|
|
656
|
-
};
|
|
657
|
-
scheduleTimeout();
|
|
658
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
659
|
-
if (signal?.aborted === true) {
|
|
660
|
-
onAbort();
|
|
661
|
-
return;
|
|
662
|
-
}
|
|
663
|
-
void work().then(succeed, fail);
|
|
664
|
-
});
|
|
665
|
-
};
|
|
666
|
-
})))();
|
|
667
|
-
}
|
|
668
|
-
|
|
669
703
|
//#endregion
|
|
670
704
|
//#region dist/browser/PlaywrightScenarioBrowser.js
|
|
671
|
-
var OPERATION$2,
|
|
705
|
+
var OPERATION$2, throwIfScenarioCancelled$1, PlaywrightScenarioBrowserCleanupOwner, attachedScenarioAdmissions, releaseAttachedScenario, createAttachedScenarioRelease, attachedScenarioLeaseKey, acquireAttachedScenario, allowedBrowserEnvironment, findConnectedPage, AttachedScenarioEnvironmentOwner, failBrowserScenarioOperation, openAttachedScenarioBrowser, openPlaywrightScenarioBrowser;
|
|
672
706
|
function init_PlaywrightScenarioBrowser() {
|
|
673
707
|
return (init_PlaywrightScenarioBrowser = __esmMin((() => {
|
|
708
|
+
init_providerIdentities();
|
|
709
|
+
init_analysisErrorCleanup();
|
|
710
|
+
init_providerAdapterError();
|
|
711
|
+
init_AnalysisCleanupLease();
|
|
674
712
|
init_analysisErrorBase();
|
|
675
713
|
init_browserObservation();
|
|
676
714
|
init_browserObservationError();
|
|
677
715
|
init_PlaywrightExecutionBoundary();
|
|
678
716
|
OPERATION$2 = "capture_browser_scenario";
|
|
679
|
-
CLEANUP_CONFIRMATION_TIMEOUT_MS = 3e4;
|
|
680
717
|
throwIfScenarioCancelled$1 = (signal) => {
|
|
681
|
-
if (signal?.aborted === true) throw new BrowserObservationError(OPERATION$2, "cancelled");
|
|
718
|
+
if (signal?.aborted === true) throw new BrowserObservationError(OPERATION$2, "cancelled", { cause: signal?.reason });
|
|
682
719
|
};
|
|
683
720
|
PlaywrightScenarioBrowserCleanupOwner = class {
|
|
684
721
|
resources;
|
|
685
722
|
#browserClosed = false;
|
|
686
723
|
#profileRemoved;
|
|
687
|
-
#closePromise;
|
|
688
724
|
#eventFinalizationPromise;
|
|
725
|
+
#eventsFinalized = false;
|
|
726
|
+
cleanupLease;
|
|
689
727
|
/** Keep the narrow provider actions needed to release one opened browser. */
|
|
690
728
|
constructor(resources) {
|
|
691
729
|
this.resources = resources;
|
|
692
730
|
this.#profileRemoved = resources.removeProfile === undefined;
|
|
731
|
+
this.cleanupLease = new AnalysisCleanupLease(() => this.#closeResources().finally(() => this.resources.onSettled?.(this.#browserClosed)), this);
|
|
693
732
|
}
|
|
694
733
|
get browserClosed() {
|
|
695
734
|
return this.#browserClosed;
|
|
696
735
|
}
|
|
736
|
+
get cleanupResources() {
|
|
737
|
+
return [
|
|
738
|
+
...!this.#eventsFinalized ? ["browser_events"] : [],
|
|
739
|
+
...!this.#browserClosed ? ["browser_transport"] : [],
|
|
740
|
+
...!this.#profileRemoved ? ["browser_profile"] : []
|
|
741
|
+
];
|
|
742
|
+
}
|
|
743
|
+
/** Await actual resource release, including a late browser acknowledgement. */
|
|
744
|
+
release(finishEvents) {
|
|
745
|
+
this.#prepareEvents(finishEvents);
|
|
746
|
+
return this.cleanupLease.release();
|
|
747
|
+
}
|
|
697
748
|
close(finishEvents) {
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
}
|
|
706
|
-
return this.#awaitCleanup(cleanup);
|
|
749
|
+
return this.#awaitCleanup(this.release(finishEvents));
|
|
750
|
+
}
|
|
751
|
+
#prepareEvents(finishEvents) {
|
|
752
|
+
this.#eventFinalizationPromise ??= Promise.resolve().then(async () => {
|
|
753
|
+
await finishEvents?.();
|
|
754
|
+
this.#eventsFinalized = true;
|
|
755
|
+
});
|
|
707
756
|
}
|
|
708
757
|
async #awaitCleanup(cleanup) {
|
|
709
758
|
try {
|
|
710
|
-
await withPlaywrightExecutionBoundary(() => cleanup,
|
|
759
|
+
await withPlaywrightExecutionBoundary(() => cleanup, PLAYWRIGHT_CLEANUP_CONFIRMATION_TIMEOUT_MS);
|
|
711
760
|
} catch (cause) {
|
|
712
|
-
|
|
761
|
+
const failure = new BrowserObservationError(OPERATION$2, "cleanup_failed", {
|
|
713
762
|
cause,
|
|
714
763
|
cleanup: {
|
|
715
764
|
reason: cause instanceof Error ? cause.message : String(cause),
|
|
716
|
-
resources:
|
|
765
|
+
resources: this.cleanupResources
|
|
717
766
|
}
|
|
718
767
|
});
|
|
768
|
+
new AnalysisCleanupLeaseGroup(failure, [this.cleanupLease]);
|
|
769
|
+
throw failure;
|
|
719
770
|
}
|
|
720
771
|
}
|
|
721
|
-
async #closeResources(
|
|
772
|
+
async #closeResources() {
|
|
722
773
|
const failures = [];
|
|
723
|
-
|
|
724
|
-
await finishEvents?.();
|
|
725
|
-
});
|
|
774
|
+
this.#prepareEvents();
|
|
726
775
|
try {
|
|
727
|
-
await
|
|
776
|
+
await this.#eventFinalizationPromise;
|
|
728
777
|
} catch (cause) {
|
|
729
778
|
failures.push(cause);
|
|
730
779
|
}
|
|
@@ -758,7 +807,7 @@ function init_PlaywrightScenarioBrowser() {
|
|
|
758
807
|
}
|
|
759
808
|
if (waiter.onAbort !== undefined) waiter.signal?.removeEventListener("abort", waiter.onAbort);
|
|
760
809
|
if (waiter.signal?.aborted === true) {
|
|
761
|
-
waiter.reject(new BrowserObservationError(OPERATION$2, "cancelled"));
|
|
810
|
+
waiter.reject(new BrowserObservationError(OPERATION$2, "cancelled", { cause: waiter.signal.reason }));
|
|
762
811
|
releaseAttachedScenario(key, admission);
|
|
763
812
|
return;
|
|
764
813
|
}
|
|
@@ -778,7 +827,7 @@ function init_PlaywrightScenarioBrowser() {
|
|
|
778
827
|
return JSON.stringify([discovery.href, targetId]);
|
|
779
828
|
};
|
|
780
829
|
acquireAttachedScenario = (scenario, signal) => {
|
|
781
|
-
if (signal?.aborted === true) return Promise.reject(new BrowserObservationError(OPERATION$2, "cancelled"));
|
|
830
|
+
if (signal?.aborted === true) return Promise.reject(new BrowserObservationError(OPERATION$2, "cancelled", { cause: signal?.reason }));
|
|
782
831
|
const key = attachedScenarioLeaseKey(scenario.cdp_endpoint, scenario.target_id);
|
|
783
832
|
const admission = attachedScenarioAdmissions.get(key) ?? {
|
|
784
833
|
active: false,
|
|
@@ -809,7 +858,7 @@ function init_PlaywrightScenarioBrowser() {
|
|
|
809
858
|
if (index < 0) return;
|
|
810
859
|
admission.waiters.splice(index, 1);
|
|
811
860
|
signal.removeEventListener("abort", onAbort);
|
|
812
|
-
reject(new BrowserObservationError(OPERATION$2, "cancelled"));
|
|
861
|
+
reject(new BrowserObservationError(OPERATION$2, "cancelled", { cause: signal?.reason }));
|
|
813
862
|
if (!admission.active && admission.waiters.length === 0) releaseAttachedScenario(key, admission);
|
|
814
863
|
};
|
|
815
864
|
waiter.onAbort = onAbort;
|
|
@@ -865,51 +914,156 @@ function init_PlaywrightScenarioBrowser() {
|
|
|
865
914
|
}
|
|
866
915
|
throw new BrowserObservationError(OPERATION$2, "target_not_found");
|
|
867
916
|
};
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
917
|
+
AttachedScenarioEnvironmentOwner = class AttachedScenarioEnvironmentOwner {
|
|
918
|
+
page;
|
|
919
|
+
session;
|
|
920
|
+
#mediaOverride = false;
|
|
921
|
+
#deviceMetricsOverride = false;
|
|
922
|
+
#localeOverride = false;
|
|
923
|
+
#timezoneOverride = false;
|
|
924
|
+
#detached = false;
|
|
925
|
+
#application;
|
|
926
|
+
constructor(page, session) {
|
|
927
|
+
this.page = page;
|
|
928
|
+
this.session = session;
|
|
929
|
+
}
|
|
930
|
+
static async create(context, page) {
|
|
931
|
+
return new AttachedScenarioEnvironmentOwner(page, await context.newCDPSession(page));
|
|
932
|
+
}
|
|
933
|
+
get restored() {
|
|
934
|
+
return !this.#mediaOverride && !this.#deviceMetricsOverride && !this.#localeOverride && !this.#timezoneOverride;
|
|
935
|
+
}
|
|
936
|
+
get targetClosed() {
|
|
937
|
+
return this.page.isClosed();
|
|
938
|
+
}
|
|
939
|
+
apply(environment, signal) {
|
|
940
|
+
const application = this.#application ?? this.#applyEnvironment(environment, signal);
|
|
941
|
+
this.#application = application;
|
|
942
|
+
return application;
|
|
943
|
+
}
|
|
944
|
+
async #applyEnvironment(environment, signal) {
|
|
945
|
+
await this.page.emulateMedia({
|
|
946
|
+
colorScheme: environment.color_scheme,
|
|
947
|
+
reducedMotion: environment.reduced_motion
|
|
948
|
+
});
|
|
949
|
+
this.#mediaOverride = true;
|
|
950
|
+
throwIfScenarioCancelled$1(signal);
|
|
951
|
+
await this.session.send("Emulation.setDeviceMetricsOverride", {
|
|
952
|
+
width: environment.viewport.width,
|
|
953
|
+
height: environment.viewport.height,
|
|
954
|
+
deviceScaleFactor: environment.viewport.device_scale_factor,
|
|
955
|
+
mobile: false,
|
|
956
|
+
dontSetVisibleSize: true
|
|
957
|
+
});
|
|
958
|
+
this.#deviceMetricsOverride = true;
|
|
959
|
+
throwIfScenarioCancelled$1(signal);
|
|
960
|
+
await this.session.send("Emulation.setLocaleOverride", { locale: environment.locale });
|
|
961
|
+
this.#localeOverride = true;
|
|
962
|
+
throwIfScenarioCancelled$1(signal);
|
|
963
|
+
await this.session.send("Emulation.setTimezoneOverride", { timezoneId: environment.timezone });
|
|
964
|
+
this.#timezoneOverride = true;
|
|
965
|
+
throwIfScenarioCancelled$1(signal);
|
|
966
|
+
}
|
|
967
|
+
async close() {
|
|
968
|
+
if (this.#detached) return;
|
|
969
|
+
try {
|
|
970
|
+
await this.#application;
|
|
971
|
+
} catch {}
|
|
972
|
+
const failures = [];
|
|
973
|
+
if (this.#timezoneOverride) {
|
|
974
|
+
try {
|
|
975
|
+
await this.session.send("Emulation.setTimezoneOverride", { timezoneId: "" });
|
|
976
|
+
this.#timezoneOverride = false;
|
|
977
|
+
} catch (cause) {
|
|
978
|
+
failures.push(cause);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
if (this.#localeOverride) {
|
|
982
|
+
try {
|
|
983
|
+
await this.session.send("Emulation.setLocaleOverride", { locale: "" });
|
|
984
|
+
this.#localeOverride = false;
|
|
985
|
+
} catch (cause) {
|
|
986
|
+
failures.push(cause);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
if (this.#deviceMetricsOverride) {
|
|
990
|
+
try {
|
|
991
|
+
await this.session.send("Emulation.clearDeviceMetricsOverride");
|
|
992
|
+
this.#deviceMetricsOverride = false;
|
|
993
|
+
} catch (cause) {
|
|
994
|
+
failures.push(cause);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
if (this.#mediaOverride) {
|
|
998
|
+
try {
|
|
999
|
+
await this.page.emulateMedia({
|
|
1000
|
+
colorScheme: null,
|
|
1001
|
+
reducedMotion: null
|
|
1002
|
+
});
|
|
1003
|
+
this.#mediaOverride = false;
|
|
1004
|
+
} catch (cause) {
|
|
1005
|
+
failures.push(cause);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
if (failures.length === 1) throw failures[0];
|
|
1009
|
+
if (failures.length > 1) throw new AggregateError(failures, "Attached browser environment restoration failed");
|
|
1010
|
+
await this.session.detach();
|
|
1011
|
+
this.#detached = true;
|
|
1012
|
+
}
|
|
887
1013
|
};
|
|
888
|
-
failBrowserScenarioOperation = async (cleanup, primaryFailure
|
|
1014
|
+
failBrowserScenarioOperation = async (cleanup, primaryFailure) => {
|
|
889
1015
|
try {
|
|
890
|
-
await cleanup();
|
|
891
|
-
} catch (
|
|
892
|
-
const
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
1016
|
+
await withPlaywrightExecutionBoundary(() => cleanup.release(), PLAYWRIGHT_CLEANUP_CONFIRMATION_TIMEOUT_MS);
|
|
1017
|
+
} catch (cause) {
|
|
1018
|
+
const primary = primaryFailure instanceof AnalysisError ? primaryFailure : new ProviderAdapterError(PLAYWRIGHT_BROWSER_SCENARIO_PROVIDER_IDENTITY.id, OPERATION$2, { cause: primaryFailure });
|
|
1019
|
+
const failure = new BrowserObservationError(OPERATION$2, "cleanup_failed", {
|
|
1020
|
+
cause,
|
|
1021
|
+
cleanup: {
|
|
1022
|
+
reason: cause instanceof Error ? cause.message : String(cause),
|
|
1023
|
+
resources: cleanup.cleanupResources ?? []
|
|
1024
|
+
}
|
|
899
1025
|
});
|
|
1026
|
+
new AnalysisCleanupLeaseGroup(failure, [cleanup]);
|
|
1027
|
+
throw analysisErrorWithCleanupFailure(primary, failure, OPERATION$2).bindCleanupDependencies([primary, failure]);
|
|
900
1028
|
}
|
|
901
1029
|
throw primaryFailure;
|
|
902
1030
|
};
|
|
903
1031
|
openAttachedScenarioBrowser = async (browserRequest, environment, launcher, signal, retainCleanup) => {
|
|
904
1032
|
const lease = await acquireAttachedScenario(browserRequest, signal);
|
|
905
1033
|
let cleanupOwner;
|
|
1034
|
+
let environmentOwner;
|
|
906
1035
|
try {
|
|
907
1036
|
const priorOwner = lease.admission.cleanupOwner;
|
|
908
1037
|
if (priorOwner !== undefined) await priorOwner.close();
|
|
909
1038
|
throwIfScenarioCancelled$1(signal);
|
|
910
1039
|
const browser = await launcher.connectOverCDP(browserRequest.cdp_endpoint);
|
|
911
1040
|
const cleanup = new PlaywrightScenarioBrowserCleanupOwner({
|
|
912
|
-
closeBrowser: () =>
|
|
1041
|
+
closeBrowser: async () => {
|
|
1042
|
+
let environmentFailure;
|
|
1043
|
+
const ownedEnvironment = environmentOwner;
|
|
1044
|
+
if (ownedEnvironment !== undefined) {
|
|
1045
|
+
try {
|
|
1046
|
+
await ownedEnvironment.close();
|
|
1047
|
+
environmentOwner = undefined;
|
|
1048
|
+
} catch (cause) {
|
|
1049
|
+
environmentFailure = cause;
|
|
1050
|
+
const browserConnected = browser.isConnected();
|
|
1051
|
+
if (ownedEnvironment.targetClosed || !browserConnected) {
|
|
1052
|
+
environmentOwner = undefined;
|
|
1053
|
+
if (!browserConnected) return;
|
|
1054
|
+
} else if (!ownedEnvironment.restored) {
|
|
1055
|
+
throw cause;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
try {
|
|
1060
|
+
await browser.close();
|
|
1061
|
+
environmentOwner = undefined;
|
|
1062
|
+
} catch (browserFailure) {
|
|
1063
|
+
if (environmentFailure !== undefined) throw new AggregateError([environmentFailure, browserFailure], "Attached browser environment cleanup failed");
|
|
1064
|
+
throw browserFailure;
|
|
1065
|
+
}
|
|
1066
|
+
},
|
|
913
1067
|
onSettled: (browserClosed) => {
|
|
914
1068
|
if (browserClosed && lease.admission.cleanupOwner === cleanup) lease.admission.cleanupOwner = undefined;
|
|
915
1069
|
lease.release();
|
|
@@ -921,7 +1075,9 @@ function init_PlaywrightScenarioBrowser() {
|
|
|
921
1075
|
throwIfScenarioCancelled$1(signal);
|
|
922
1076
|
const target = await withPlaywrightExecutionBoundary(() => findConnectedPage(browser, browserRequest.target_id, signal), undefined, signal);
|
|
923
1077
|
throwIfScenarioCancelled$1(signal);
|
|
924
|
-
await withPlaywrightExecutionBoundary(() =>
|
|
1078
|
+
const configuredEnvironment = await withPlaywrightExecutionBoundary(() => AttachedScenarioEnvironmentOwner.create(target.context, target.page), undefined, signal);
|
|
1079
|
+
environmentOwner = configuredEnvironment;
|
|
1080
|
+
await withPlaywrightExecutionBoundary(() => configuredEnvironment.apply(environment, signal), undefined, signal);
|
|
925
1081
|
return {
|
|
926
1082
|
...target,
|
|
927
1083
|
browser,
|
|
@@ -934,11 +1090,11 @@ function init_PlaywrightScenarioBrowser() {
|
|
|
934
1090
|
throw cause;
|
|
935
1091
|
}
|
|
936
1092
|
const cleanup = cleanupOwner;
|
|
937
|
-
const
|
|
1093
|
+
const recovery = cleanup.cleanupLease;
|
|
938
1094
|
try {
|
|
939
|
-
return await failBrowserScenarioOperation(
|
|
1095
|
+
return await failBrowserScenarioOperation(recovery, cause);
|
|
940
1096
|
} catch (failure) {
|
|
941
|
-
if (failure !== cause) retainCleanup?.(
|
|
1097
|
+
if (failure !== cause) retainCleanup?.(recovery);
|
|
942
1098
|
throw failure;
|
|
943
1099
|
}
|
|
944
1100
|
}
|
|
@@ -972,13 +1128,13 @@ function init_PlaywrightScenarioBrowser() {
|
|
|
972
1128
|
args: process.platform === "android" ? ["--no-sandbox", "--single-process"] : []
|
|
973
1129
|
});
|
|
974
1130
|
} catch (cause) {
|
|
975
|
-
const cleanup = () => rm(profilePath, {
|
|
1131
|
+
const cleanup = new AnalysisCleanupLease(() => rm(profilePath, {
|
|
976
1132
|
recursive: true,
|
|
977
1133
|
force: true,
|
|
978
1134
|
maxRetries: 3
|
|
979
|
-
});
|
|
1135
|
+
}), ["browser_profile"]);
|
|
980
1136
|
try {
|
|
981
|
-
return await failBrowserScenarioOperation(cleanup, cause
|
|
1137
|
+
return await failBrowserScenarioOperation(cleanup, cause);
|
|
982
1138
|
} catch (failure) {
|
|
983
1139
|
if (failure !== cause) options.retainCleanup?.(cleanup);
|
|
984
1140
|
throw failure;
|
|
@@ -1004,11 +1160,11 @@ function init_PlaywrightScenarioBrowser() {
|
|
|
1004
1160
|
cleanup
|
|
1005
1161
|
};
|
|
1006
1162
|
} catch (cause) {
|
|
1007
|
-
const
|
|
1163
|
+
const recovery = cleanup.cleanupLease;
|
|
1008
1164
|
try {
|
|
1009
|
-
return await failBrowserScenarioOperation(
|
|
1165
|
+
return await failBrowserScenarioOperation(recovery, cause);
|
|
1010
1166
|
} catch (failure) {
|
|
1011
|
-
if (failure !== cause) options.retainCleanup?.(
|
|
1167
|
+
if (failure !== cause) options.retainCleanup?.(recovery);
|
|
1012
1168
|
throw failure;
|
|
1013
1169
|
}
|
|
1014
1170
|
}
|
|
@@ -1267,9 +1423,9 @@ function init_PlaywrightNetworkContent() {
|
|
|
1267
1423
|
"cookie",
|
|
1268
1424
|
"set-cookie"
|
|
1269
1425
|
]);
|
|
1270
|
-
errorMessage = (cause, secrets) => {
|
|
1426
|
+
errorMessage = (cause, secrets, maxMetadataAllocationBytes) => {
|
|
1271
1427
|
const message = cause instanceof Error && cause.message !== "" ? cause.message : "Network read failed";
|
|
1272
|
-
return secrets.redactionAllocationCost(message.length) <=
|
|
1428
|
+
return secrets.redactionAllocationCost(message.length) <= maxMetadataAllocationBytes ? secrets.redact(message) : "Network read failed; diagnostic exceeds the allocation budget.";
|
|
1273
1429
|
};
|
|
1274
1430
|
captureNetworkHeaders = async (source, secrets, options) => {
|
|
1275
1431
|
try {
|
|
@@ -1277,9 +1433,9 @@ function init_PlaywrightNetworkContent() {
|
|
|
1277
1433
|
let cost = 0;
|
|
1278
1434
|
for (const { name, value } of headers) {
|
|
1279
1435
|
cost += secrets.redactionAllocationCost(name.length + value.length) + 128;
|
|
1280
|
-
if (cost >
|
|
1436
|
+
if (cost > options.maxHeaderAllocationBytes) return {
|
|
1281
1437
|
state: "unavailable",
|
|
1282
|
-
message:
|
|
1438
|
+
message: `Headers exceed the ${String(options.maxHeaderAllocationBytes)}-byte allocation budget.`
|
|
1283
1439
|
};
|
|
1284
1440
|
}
|
|
1285
1441
|
return {
|
|
@@ -1298,31 +1454,51 @@ function init_PlaywrightNetworkContent() {
|
|
|
1298
1454
|
} catch (cause) {
|
|
1299
1455
|
return {
|
|
1300
1456
|
state: "unavailable",
|
|
1301
|
-
message: errorMessage(cause, secrets)
|
|
1457
|
+
message: errorMessage(cause, secrets, options.maxMetadataAllocationBytes)
|
|
1302
1458
|
};
|
|
1303
1459
|
}
|
|
1304
1460
|
};
|
|
1305
|
-
captureNetworkBody = async (read, phase, source, secrets, options) => {
|
|
1461
|
+
captureNetworkBody = async (read, phase, source, secrets, options, preflight) => {
|
|
1306
1462
|
try {
|
|
1307
1463
|
const observed = await withPlaywrightExecutionBoundary(read, options.timeoutMs, options.signal);
|
|
1308
1464
|
if (observed === null) return { state: "not_exposed" };
|
|
1309
|
-
|
|
1465
|
+
const maxBodyBytes = options.maxBodyBytes;
|
|
1466
|
+
if (observed.length > maxBodyBytes) return {
|
|
1310
1467
|
state: "unavailable",
|
|
1311
|
-
reason: "body-
|
|
1312
|
-
message:
|
|
1468
|
+
reason: "body-size-limit",
|
|
1469
|
+
message: `Playwright materialized the body before its ${String(maxBodyBytes)}-byte retained-body budget was checked.`,
|
|
1470
|
+
limit_bytes: maxBodyBytes,
|
|
1471
|
+
observed_bytes: observed.length
|
|
1313
1472
|
};
|
|
1314
|
-
|
|
1473
|
+
const bodyAllocationCost = secrets.redactionAllocationCost(observed.length);
|
|
1474
|
+
const base64AllocationCost = Math.ceil(observed.length / 3) * 4 * 8 + 2;
|
|
1475
|
+
const maxBodyAllocationBytes = options.maxBodyAllocationBytes;
|
|
1476
|
+
const observedBodyAllocationBytes = Math.max(bodyAllocationCost, base64AllocationCost);
|
|
1477
|
+
if (observedBodyAllocationBytes > maxBodyAllocationBytes) return {
|
|
1315
1478
|
state: "unavailable",
|
|
1316
|
-
reason: "body-
|
|
1317
|
-
message: "Body redaction exceeds the allocation budget."
|
|
1479
|
+
reason: "body-allocation-limit",
|
|
1480
|
+
message: "Body redaction exceeds the selected network body allocation budget.",
|
|
1481
|
+
limit_allocation_bytes: maxBodyAllocationBytes,
|
|
1482
|
+
observed_allocation_bytes: observedBodyAllocationBytes
|
|
1318
1483
|
};
|
|
1319
|
-
const retained = secrets.redactBytes(observed);
|
|
1320
1484
|
const contentType = source.headers()["content-type"];
|
|
1321
|
-
if (contentType !== undefined && secrets.redactionAllocationCost(contentType.length) >
|
|
1485
|
+
if (contentType !== undefined && secrets.redactionAllocationCost(contentType.length) > options.maxHeaderAllocationBytes) return {
|
|
1322
1486
|
state: "unavailable",
|
|
1323
|
-
reason: "body-
|
|
1324
|
-
message: "Content type exceeds the
|
|
1487
|
+
reason: "body-allocation-limit",
|
|
1488
|
+
message: "Content type exceeds the selected network header allocation budget.",
|
|
1489
|
+
limit_allocation_bytes: options.maxHeaderAllocationBytes,
|
|
1490
|
+
observed_allocation_bytes: secrets.redactionAllocationCost(contentType.length)
|
|
1325
1491
|
};
|
|
1492
|
+
const admission = preflight?.({
|
|
1493
|
+
observedBytes: observed.length,
|
|
1494
|
+
allocationBytes: observedBodyAllocationBytes,
|
|
1495
|
+
mediaType: contentType
|
|
1496
|
+
});
|
|
1497
|
+
if (admission?.status === "omitted") return {
|
|
1498
|
+
state: "omitted",
|
|
1499
|
+
reason: admission.reason
|
|
1500
|
+
};
|
|
1501
|
+
const retained = secrets.redactBytes(observed);
|
|
1326
1502
|
return {
|
|
1327
1503
|
state: "captured",
|
|
1328
1504
|
representation: phase === "request" ? "browser-exposed-request-bytes" : "playwright-response-body-bytes",
|
|
@@ -1337,7 +1513,7 @@ function init_PlaywrightNetworkContent() {
|
|
|
1337
1513
|
return {
|
|
1338
1514
|
state: "unavailable",
|
|
1339
1515
|
reason: cause instanceof AnalysisCancelledError ? "cancelled" : cause instanceof AnalysisTimeoutError ? "body-read-timeout" : "body-read-failed",
|
|
1340
|
-
message: errorMessage(cause, secrets)
|
|
1516
|
+
message: errorMessage(cause, secrets, options.maxMetadataAllocationBytes)
|
|
1341
1517
|
};
|
|
1342
1518
|
}
|
|
1343
1519
|
};
|
|
@@ -1353,15 +1529,29 @@ function init_PlaywrightScenarioNetwork() {
|
|
|
1353
1529
|
PlaywrightScenarioNetwork = class {
|
|
1354
1530
|
options;
|
|
1355
1531
|
transactions = new Map();
|
|
1532
|
+
omittedRequests = new WeakSet();
|
|
1533
|
+
omittedPhases = new WeakMap();
|
|
1534
|
+
totalTransactions = 0;
|
|
1535
|
+
omittedTransactionCount = 0;
|
|
1536
|
+
firstOmittedTransaction = 0;
|
|
1537
|
+
lastOmittedTransaction = 0;
|
|
1538
|
+
/** One request and one response-content job at most per admitted transaction. */
|
|
1356
1539
|
pending = [];
|
|
1540
|
+
queuedReads = [];
|
|
1357
1541
|
gaps = new Set();
|
|
1358
1542
|
accepting = true;
|
|
1359
1543
|
activeReads = 0;
|
|
1360
1544
|
readOptions;
|
|
1545
|
+
limits;
|
|
1361
1546
|
constructor(options) {
|
|
1362
1547
|
this.options = options;
|
|
1548
|
+
this.limits = options.limits;
|
|
1363
1549
|
this.readOptions = {
|
|
1364
1550
|
timeoutMs: options.readTimeoutMs ?? 5e3,
|
|
1551
|
+
maxBodyBytes: this.limits.max_network_body_bytes,
|
|
1552
|
+
maxBodyAllocationBytes: this.limits.max_network_body_allocation_bytes,
|
|
1553
|
+
maxHeaderAllocationBytes: this.limits.max_network_header_allocation_bytes,
|
|
1554
|
+
maxMetadataAllocationBytes: this.limits.max_network_metadata_allocation_bytes,
|
|
1365
1555
|
...options.signal === undefined ? {} : { signal: options.signal }
|
|
1366
1556
|
};
|
|
1367
1557
|
}
|
|
@@ -1369,28 +1559,50 @@ function init_PlaywrightScenarioNetwork() {
|
|
|
1369
1559
|
request(request) {
|
|
1370
1560
|
if (!this.accepting) return;
|
|
1371
1561
|
const transaction = this.transaction(request);
|
|
1372
|
-
if (transaction === undefined
|
|
1373
|
-
|
|
1562
|
+
if (transaction === undefined) {
|
|
1563
|
+
this.omitOmittedTransactionPhase(request, "request");
|
|
1564
|
+
if (this.options.selection.request_body || this.options.selection.header_values) this.omitOmittedTransactionContent(request, "request");
|
|
1565
|
+
return;
|
|
1566
|
+
}
|
|
1567
|
+
if (transaction.requestObserved) return;
|
|
1568
|
+
if (!this.admitMetadata(transaction, "request", request)) return;
|
|
1374
1569
|
transaction.requestObserved = true;
|
|
1375
|
-
const
|
|
1570
|
+
const admission = this.options.emit({
|
|
1376
1571
|
...this.metadata(request, transaction),
|
|
1377
1572
|
kind: "request",
|
|
1378
1573
|
status: null,
|
|
1379
1574
|
failure: null
|
|
1380
1575
|
});
|
|
1381
|
-
if (
|
|
1382
|
-
|
|
1576
|
+
if (admission.status === "omitted") {
|
|
1577
|
+
this.options.omitNetwork(transaction.id, "request", admission.reason);
|
|
1578
|
+
return;
|
|
1579
|
+
}
|
|
1580
|
+
const sequence = admission.sequence;
|
|
1581
|
+
if (this.options.selection.request_body || this.options.selection.header_values) this.collect(transaction, sequence, "request", request, (headers) => this.options.selection.request_body ? captureNetworkBody(async () => request.postDataBuffer(), "request", request, this.options.secrets, this.readOptions, (body) => this.options.admitContentBody({
|
|
1582
|
+
transactionId: transaction.id,
|
|
1583
|
+
sourceEventSequence: sequence,
|
|
1584
|
+
phase: "request",
|
|
1585
|
+
headers,
|
|
1586
|
+
observedBytes: body.observedBytes,
|
|
1587
|
+
allocationBytes: body.allocationBytes,
|
|
1588
|
+
mediaType: body.mediaType
|
|
1589
|
+
})) : Promise.resolve({ state: "not_requested" }), this.options.selection.header_values);
|
|
1383
1590
|
}
|
|
1384
1591
|
/** Observe response metadata without starting a potentially unfinished body read. */
|
|
1385
1592
|
response(response) {
|
|
1386
1593
|
if (!this.accepting) return;
|
|
1387
1594
|
const request = response.request();
|
|
1388
1595
|
const transaction = this.transaction(request);
|
|
1389
|
-
if (transaction === undefined
|
|
1596
|
+
if (transaction === undefined) {
|
|
1597
|
+
this.omitOmittedTransactionPhase(request, "response");
|
|
1598
|
+
this.observeOmittedTransactionPhase(request, "response");
|
|
1599
|
+
return;
|
|
1600
|
+
}
|
|
1601
|
+
if (!this.admitMetadata(transaction, "response", request, undefined, [], [{
|
|
1390
1602
|
source: response,
|
|
1391
1603
|
url: response.url()
|
|
1392
1604
|
}])) return;
|
|
1393
|
-
const
|
|
1605
|
+
const admission = this.options.emit({
|
|
1394
1606
|
...this.metadata(request, transaction),
|
|
1395
1607
|
kind: "response",
|
|
1396
1608
|
url: this.options.secrets.sanitizeUrl(response.url()),
|
|
@@ -1398,7 +1610,11 @@ function init_PlaywrightScenarioNetwork() {
|
|
|
1398
1610
|
header_names: this.headerNames(response),
|
|
1399
1611
|
failure: null
|
|
1400
1612
|
});
|
|
1401
|
-
if (
|
|
1613
|
+
if (admission.status === "omitted") {
|
|
1614
|
+
this.options.omitNetwork(transaction.id, "response", admission.reason);
|
|
1615
|
+
return;
|
|
1616
|
+
}
|
|
1617
|
+
const sequence = admission.sequence;
|
|
1402
1618
|
transaction.response = {
|
|
1403
1619
|
source: response,
|
|
1404
1620
|
sequence
|
|
@@ -1408,15 +1624,22 @@ function init_PlaywrightScenarioNetwork() {
|
|
|
1408
1624
|
finished(request) {
|
|
1409
1625
|
if (!this.accepting) return;
|
|
1410
1626
|
const transaction = this.transaction(request);
|
|
1411
|
-
if (transaction === undefined
|
|
1627
|
+
if (transaction === undefined) {
|
|
1628
|
+
this.omitOmittedTransactionPhase(request, "request-finished");
|
|
1629
|
+
const observed = this.omittedPhases.get(request);
|
|
1630
|
+
if (observed?.has("response") && (this.options.selection.response_body || this.options.selection.header_values)) this.omitOmittedTransactionContent(request, "response");
|
|
1631
|
+
return;
|
|
1632
|
+
}
|
|
1633
|
+
if (!this.admitMetadata(transaction, "request-finished", request)) return;
|
|
1412
1634
|
transaction.terminal = "finished";
|
|
1413
|
-
const
|
|
1635
|
+
const admission = this.options.emit({
|
|
1414
1636
|
...this.metadata(request, transaction),
|
|
1415
1637
|
kind: "request-finished",
|
|
1416
1638
|
status: null,
|
|
1417
1639
|
failure: null
|
|
1418
1640
|
});
|
|
1419
|
-
if (
|
|
1641
|
+
if (admission.status === "omitted") {
|
|
1642
|
+
this.options.omitNetwork(transaction.id, "request-finished", admission.reason);
|
|
1420
1643
|
transaction.responseScheduled = true;
|
|
1421
1644
|
return;
|
|
1422
1645
|
}
|
|
@@ -1426,18 +1649,22 @@ function init_PlaywrightScenarioNetwork() {
|
|
|
1426
1649
|
failed(request) {
|
|
1427
1650
|
if (!this.accepting) return;
|
|
1428
1651
|
const transaction = this.transaction(request);
|
|
1429
|
-
if (transaction === undefined)
|
|
1652
|
+
if (transaction === undefined) {
|
|
1653
|
+
this.omitOmittedTransactionPhase(request, "request-failed");
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1430
1656
|
transaction.terminal = "failed";
|
|
1431
1657
|
const failure = request.failure()?.errorText || "Unknown request failure";
|
|
1432
|
-
if (!this.admitMetadata(request, undefined, [failure])) return;
|
|
1658
|
+
if (!this.admitMetadata(transaction, "request-failed", request, undefined, [failure])) return;
|
|
1433
1659
|
const message = this.options.secrets.redact(failure);
|
|
1434
|
-
const
|
|
1660
|
+
const admission = this.options.emit({
|
|
1435
1661
|
...this.metadata(request, transaction),
|
|
1436
1662
|
kind: "request-failed",
|
|
1437
1663
|
status: null,
|
|
1438
1664
|
failure: message
|
|
1439
1665
|
});
|
|
1440
|
-
if (
|
|
1666
|
+
if (admission.status === "omitted") {
|
|
1667
|
+
this.options.omitNetwork(transaction.id, "request-failed", admission.reason);
|
|
1441
1668
|
transaction.responseScheduled = true;
|
|
1442
1669
|
return;
|
|
1443
1670
|
}
|
|
@@ -1447,25 +1674,26 @@ function init_PlaywrightScenarioNetwork() {
|
|
|
1447
1674
|
message
|
|
1448
1675
|
});
|
|
1449
1676
|
}
|
|
1450
|
-
/** Stop observing, mark unfinished transactions, and
|
|
1677
|
+
/** Stop observing, mark unfinished transactions, and drain admitted content reads. */
|
|
1451
1678
|
async finish() {
|
|
1452
1679
|
if (!this.accepting) {
|
|
1453
|
-
await
|
|
1680
|
+
await this.settlePendingReads();
|
|
1454
1681
|
return;
|
|
1455
1682
|
}
|
|
1456
1683
|
this.accepting = false;
|
|
1457
1684
|
for (const [request, transaction] of this.transactions) {
|
|
1458
1685
|
if (transaction.terminal === undefined) {
|
|
1459
|
-
if (!this.admitMetadata(request)) continue;
|
|
1686
|
+
if (!this.admitMetadata(transaction, "request-unfinished", request)) continue;
|
|
1460
1687
|
this.gaps.add("Some network requests had not completed when capture ended; later activity is unknown.");
|
|
1461
|
-
const
|
|
1688
|
+
const admission = this.options.emit({
|
|
1462
1689
|
...this.metadata(request, transaction),
|
|
1463
1690
|
kind: "request-unfinished",
|
|
1464
1691
|
status: null,
|
|
1465
1692
|
failure: null,
|
|
1466
1693
|
reason: this.options.signal?.aborted === true ? "cancelled" : "capture-ended"
|
|
1467
1694
|
});
|
|
1468
|
-
if (
|
|
1695
|
+
if (admission.status === "omitted") {
|
|
1696
|
+
this.options.omitNetwork(transaction.id, "request-unfinished", admission.reason);
|
|
1469
1697
|
transaction.responseScheduled = true;
|
|
1470
1698
|
continue;
|
|
1471
1699
|
}
|
|
@@ -1476,23 +1704,43 @@ function init_PlaywrightScenarioNetwork() {
|
|
|
1476
1704
|
});
|
|
1477
1705
|
}
|
|
1478
1706
|
}
|
|
1479
|
-
await
|
|
1707
|
+
await this.settlePendingReads();
|
|
1708
|
+
}
|
|
1709
|
+
async settlePendingReads() {
|
|
1710
|
+
const results = await Promise.allSettled(this.pending);
|
|
1711
|
+
const failed = results.find((result) => result.status === "rejected");
|
|
1712
|
+
if (failed !== undefined) throw failed.reason;
|
|
1480
1713
|
}
|
|
1481
1714
|
/** Missing selected content contributes to aggregate completeness. */
|
|
1482
1715
|
limitations() {
|
|
1483
1716
|
return [...this.gaps];
|
|
1484
1717
|
}
|
|
1718
|
+
omittedTransactionRange() {
|
|
1719
|
+
return this.omittedTransactionCount === 0 ? null : {
|
|
1720
|
+
first_transaction_id: `request-${String(this.firstOmittedTransaction)}`,
|
|
1721
|
+
last_transaction_id: `request-${String(this.lastOmittedTransaction)}`,
|
|
1722
|
+
count: this.omittedTransactionCount,
|
|
1723
|
+
reason: "max-network-transactions"
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1485
1726
|
transaction(request) {
|
|
1486
1727
|
const known = this.transactions.get(request);
|
|
1487
1728
|
if (known !== undefined) return known;
|
|
1488
|
-
if (this.
|
|
1489
|
-
|
|
1729
|
+
if (this.omittedRequests.has(request)) return undefined;
|
|
1730
|
+
this.totalTransactions += 1;
|
|
1731
|
+
const id = `request-${String(this.totalTransactions)}`;
|
|
1732
|
+
if (this.transactions.size >= this.limits.max_network_transactions) {
|
|
1733
|
+
this.omittedRequests.add(request);
|
|
1734
|
+
if (this.omittedTransactionCount === 0) this.firstOmittedTransaction = this.totalTransactions;
|
|
1735
|
+
this.lastOmittedTransaction = this.totalTransactions;
|
|
1736
|
+
this.omittedTransactionCount += 1;
|
|
1737
|
+
this.gaps.add(`Network collection reached its ${String(this.limits.max_network_transactions)}-transaction resource budget; omitted transaction IDs are listed in events.omissions.network_transaction_range.`);
|
|
1490
1738
|
return undefined;
|
|
1491
1739
|
}
|
|
1492
1740
|
const predecessor = request.redirectedFrom();
|
|
1493
1741
|
const predecessorTransaction = predecessor === null ? undefined : this.transactions.get(predecessor);
|
|
1494
1742
|
const transaction = {
|
|
1495
|
-
id
|
|
1743
|
+
id,
|
|
1496
1744
|
redirectedFrom: predecessorTransaction?.id ?? null,
|
|
1497
1745
|
redirectedFromState: predecessor === null ? "root" : predecessorTransaction === undefined ? "unknown" : undefined,
|
|
1498
1746
|
responseScheduled: false,
|
|
@@ -1501,23 +1749,35 @@ function init_PlaywrightScenarioNetwork() {
|
|
|
1501
1749
|
this.transactions.set(request, transaction);
|
|
1502
1750
|
return transaction;
|
|
1503
1751
|
}
|
|
1504
|
-
admitProducerStrings(values) {
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
if (cost > 1024 * 1024) {
|
|
1510
|
-
this.gaps.add("Some network metadata exceeded its allocation budget and was omitted.");
|
|
1511
|
-
return false;
|
|
1512
|
-
}
|
|
1513
|
-
collected.push(value);
|
|
1514
|
-
}
|
|
1515
|
-
if (this.options.admitText?.(collected) ?? true) return true;
|
|
1516
|
-
this.gaps.add("Some network metadata was omitted because the aggregate browser event budget was reached; affected transactions are incomplete.");
|
|
1752
|
+
admitProducerStrings(transaction, kind, values) {
|
|
1753
|
+
const admission = this.options.admitText(kind, values);
|
|
1754
|
+
if (admission.status === "retained") return true;
|
|
1755
|
+
this.options.omitNetwork(transaction.id, kind, admission.reason);
|
|
1756
|
+
this.gaps.add(`Network ${kind} metadata was omitted for ${transaction.id} because ${admission.reason} was reached; network coverage is incomplete.`);
|
|
1517
1757
|
return false;
|
|
1518
1758
|
}
|
|
1519
|
-
|
|
1520
|
-
|
|
1759
|
+
omitOmittedTransactionPhase(request, kind) {
|
|
1760
|
+
if (!this.omittedRequests.has(request)) return;
|
|
1761
|
+
if (!this.observeOmittedTransactionPhase(request, kind)) return;
|
|
1762
|
+
this.options.omitEvent(kind, "max-network-transactions");
|
|
1763
|
+
}
|
|
1764
|
+
observeOmittedTransactionPhase(request, phase) {
|
|
1765
|
+
let observed = this.omittedPhases.get(request);
|
|
1766
|
+
if (observed === undefined) {
|
|
1767
|
+
observed = new Set();
|
|
1768
|
+
this.omittedPhases.set(request, observed);
|
|
1769
|
+
}
|
|
1770
|
+
if (observed.has(phase)) return false;
|
|
1771
|
+
observed.add(phase);
|
|
1772
|
+
return true;
|
|
1773
|
+
}
|
|
1774
|
+
omitOmittedTransactionContent(request, phase) {
|
|
1775
|
+
if (!this.omittedRequests.has(request)) return;
|
|
1776
|
+
if (!this.observeOmittedTransactionPhase(request, `network-content:${phase}`)) return;
|
|
1777
|
+
this.options.omitEvent("network-content", "max-network-transactions");
|
|
1778
|
+
}
|
|
1779
|
+
admitMetadata(transaction, kind, source, url, additionalStrings = [], additionalSources = []) {
|
|
1780
|
+
return this.admitProducerStrings(transaction, kind, this.metadataStrings(source, url, additionalStrings, additionalSources));
|
|
1521
1781
|
}
|
|
1522
1782
|
*metadataStrings(source, url, additionalStrings, additionalSources) {
|
|
1523
1783
|
yield* this.retainedMetadataStrings(source, source.headers(), url);
|
|
@@ -1556,34 +1816,26 @@ function init_PlaywrightScenarioNetwork() {
|
|
|
1556
1816
|
const response = transaction.response;
|
|
1557
1817
|
if (response === undefined || transaction.responseScheduled || !this.options.selection.response_body && !this.options.selection.header_values) return;
|
|
1558
1818
|
transaction.responseScheduled = true;
|
|
1559
|
-
this.collect(transaction, response.sequence, "response", response.source, () => this.options.selection.response_body ? unavailable === undefined ? captureNetworkBody(() => response.source.body(), "response", response.source, this.options.secrets, this.readOptions
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
message
|
|
1578
|
-
} : { state: "not_requested" }
|
|
1579
|
-
});
|
|
1580
|
-
return;
|
|
1581
|
-
}
|
|
1582
|
-
this.activeReads += 1;
|
|
1583
|
-
const headers = this.options.selection.header_values ? captureNetworkHeaders(source, this.options.secrets, this.readOptions) : Promise.resolve({ state: "not_requested" });
|
|
1584
|
-
this.pending.push(Promise.all([headers, body()]).then(([retainedHeaders, retainedBody]) => {
|
|
1819
|
+
this.collect(transaction, response.sequence, "response", response.source, (headers) => this.options.selection.response_body ? unavailable === undefined ? captureNetworkBody(() => response.source.body(), "response", response.source, this.options.secrets, this.readOptions, (body) => this.options.admitContentBody({
|
|
1820
|
+
transactionId: transaction.id,
|
|
1821
|
+
sourceEventSequence: response.sequence,
|
|
1822
|
+
phase: "response",
|
|
1823
|
+
headers,
|
|
1824
|
+
observedBytes: body.observedBytes,
|
|
1825
|
+
allocationBytes: body.allocationBytes,
|
|
1826
|
+
mediaType: body.mediaType
|
|
1827
|
+
})) : Promise.resolve(unavailable) : Promise.resolve({ state: "not_requested" }), this.options.selection.header_values);
|
|
1828
|
+
}
|
|
1829
|
+
collect(transaction, sequence, phase, source, body, includeHeaders) {
|
|
1830
|
+
const collect = async () => {
|
|
1831
|
+
const retainedHeaders = includeHeaders ? await captureNetworkHeaders(source, this.options.secrets, this.readOptions) : { state: "not_requested" };
|
|
1832
|
+
const retainedBody = await body(retainedHeaders);
|
|
1833
|
+
if (retainedBody.state === "omitted") {
|
|
1834
|
+
this.options.omitNetwork(transaction.id, "network-content", retainedBody.reason);
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1585
1837
|
if (retainedHeaders.state === "unavailable" || retainedBody.state === "unavailable" || retainedBody.state === "not_exposed") this.gaps.add("Some selected network content was unavailable; per-transaction content states retain the reason.");
|
|
1586
|
-
this.options.emit({
|
|
1838
|
+
const admission = this.options.emit({
|
|
1587
1839
|
kind: "network-content",
|
|
1588
1840
|
transaction_id: transaction.id,
|
|
1589
1841
|
source_event_sequence: sequence,
|
|
@@ -1591,24 +1843,40 @@ function init_PlaywrightScenarioNetwork() {
|
|
|
1591
1843
|
headers: retainedHeaders,
|
|
1592
1844
|
body: retainedBody
|
|
1593
1845
|
});
|
|
1594
|
-
|
|
1595
|
-
|
|
1846
|
+
if (admission.status === "omitted") this.options.omitNetwork(transaction.id, "network-content", admission.reason);
|
|
1847
|
+
};
|
|
1848
|
+
this.pending.push(new Promise((resolve, reject) => {
|
|
1849
|
+
this.queuedReads.push({
|
|
1850
|
+
run: collect,
|
|
1851
|
+
resolve,
|
|
1852
|
+
reject
|
|
1853
|
+
});
|
|
1854
|
+
this.pumpContentReads();
|
|
1596
1855
|
}));
|
|
1597
1856
|
}
|
|
1857
|
+
pumpContentReads() {
|
|
1858
|
+
while (this.activeReads < 16 && this.queuedReads.length > 0) {
|
|
1859
|
+
const job = this.queuedReads.shift();
|
|
1860
|
+
if (job === undefined) return;
|
|
1861
|
+
this.activeReads += 1;
|
|
1862
|
+
void job.run().then(job.resolve, job.reject).finally(() => {
|
|
1863
|
+
this.activeReads -= 1;
|
|
1864
|
+
this.pumpContentReads();
|
|
1865
|
+
});
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1598
1868
|
};
|
|
1599
1869
|
})))();
|
|
1600
1870
|
}
|
|
1601
1871
|
|
|
1602
1872
|
//#endregion
|
|
1603
1873
|
//#region dist/browser/PlaywrightScenarioEvents.js
|
|
1604
|
-
var
|
|
1874
|
+
var MAX_LISTENER_OWNERS, allocationCost, PlaywrightScenarioEvents;
|
|
1605
1875
|
function init_PlaywrightScenarioEvents() {
|
|
1606
1876
|
return (init_PlaywrightScenarioEvents = __esmMin((() => {
|
|
1607
1877
|
init_browserScenarioCaptureValues();
|
|
1878
|
+
init_browserScenarioCaptureLimits();
|
|
1608
1879
|
init_PlaywrightScenarioNetwork();
|
|
1609
|
-
MAX_EVENT_COST = 4 * 1024 * 1024;
|
|
1610
|
-
MAX_CAPTURE_COST = 16 * 1024 * 1024;
|
|
1611
|
-
MAX_EVENTS = 1e4;
|
|
1612
1880
|
MAX_LISTENER_OWNERS = 2048;
|
|
1613
1881
|
allocationCost = (value, remaining) => {
|
|
1614
1882
|
if (typeof value === "string") return value.length * 8 + 2;
|
|
@@ -1626,10 +1894,13 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1626
1894
|
items = [];
|
|
1627
1895
|
retainedCost = 0;
|
|
1628
1896
|
dropped = 0;
|
|
1897
|
+
omittedKinds = new Map();
|
|
1898
|
+
omittedNetwork = new Map();
|
|
1629
1899
|
stepIndex = 0;
|
|
1630
1900
|
sequence = 0;
|
|
1631
1901
|
enabled;
|
|
1632
1902
|
secrets;
|
|
1903
|
+
limits;
|
|
1633
1904
|
ownsContext;
|
|
1634
1905
|
pages = new WeakSet();
|
|
1635
1906
|
incompleteFamilies = new Set();
|
|
@@ -1646,6 +1917,7 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1646
1917
|
this.enabled = new Set(options.enabled);
|
|
1647
1918
|
if (network.request_body || network.response_body || network.header_values) this.enabled = new Set([...this.enabled, "network"]);
|
|
1648
1919
|
this.secrets = options.secrets;
|
|
1920
|
+
this.limits = options.limits ?? DEFAULT_BROWSER_SCENARIO_CAPTURE_LIMITS;
|
|
1649
1921
|
this.ownsContext = options.ownsContext === true;
|
|
1650
1922
|
this.pages.add(options.page);
|
|
1651
1923
|
if (this.ownsContext && this.enabled.size > 0) {
|
|
@@ -1658,9 +1930,13 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1658
1930
|
const context = options.context ?? options.page.context();
|
|
1659
1931
|
const collector = new PlaywrightScenarioNetwork({
|
|
1660
1932
|
selection: network,
|
|
1933
|
+
limits: this.limits,
|
|
1661
1934
|
secrets: options.secrets,
|
|
1662
1935
|
emit: (event) => this.push(event),
|
|
1663
|
-
admitText: (values) => this.admitProducerText(values),
|
|
1936
|
+
admitText: (kind, values) => this.admitProducerText(kind, values, true),
|
|
1937
|
+
admitContentBody: (input) => this.admitContentBody(input),
|
|
1938
|
+
omitNetwork: (id, kind, reason) => this.omitNetwork(id, kind, reason),
|
|
1939
|
+
omitEvent: (kind, reason) => this.omitEvent(kind, reason),
|
|
1664
1940
|
...options.signal === undefined ? {} : { signal: options.signal }
|
|
1665
1941
|
});
|
|
1666
1942
|
this.network = collector;
|
|
@@ -1723,27 +1999,45 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1723
1999
|
limitations() {
|
|
1724
2000
|
const popupGaps = [...this.incompleteFamilies].map((family) => `Popup ${family} events before Page discovery are unavailable; later events are retained.`);
|
|
1725
2001
|
const gaps = [...popupGaps, ...this.network?.limitations() ?? []];
|
|
1726
|
-
if (this.dropped > 0) gaps.push("Browser event collection reached
|
|
2002
|
+
if (this.dropped > 0) gaps.push("Browser event collection reached a selected resource budget; per-kind omissions and affected network transaction IDs are listed in events.omissions, and event coverage is incomplete.");
|
|
1727
2003
|
return this.enabled.has("network") && !this.ownsContext ? ["Shared-context network capture excludes requests without a known root or descendant Page frame.", ...gaps] : gaps;
|
|
1728
2004
|
}
|
|
1729
2005
|
result() {
|
|
2006
|
+
const omittedKinds = new Map([...this.omittedKinds].map(([kind, omission]) => [kind, {
|
|
2007
|
+
count: omission.count,
|
|
2008
|
+
reasons: new Set(omission.reasons)
|
|
2009
|
+
}]));
|
|
1730
2010
|
return {
|
|
1731
2011
|
retained: this.items.length,
|
|
1732
2012
|
dropped: this.dropped,
|
|
1733
|
-
items: this.items
|
|
2013
|
+
items: this.items,
|
|
2014
|
+
omissions: {
|
|
2015
|
+
by_kind: [...omittedKinds].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([kind, omission]) => ({
|
|
2016
|
+
kind,
|
|
2017
|
+
count: omission.count,
|
|
2018
|
+
reasons: [...omission.reasons].sort()
|
|
2019
|
+
})),
|
|
2020
|
+
network_transactions: [...this.omittedNetwork].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([transaction_id, omission]) => ({
|
|
2021
|
+
transaction_id,
|
|
2022
|
+
omitted_kinds: [...omission.kinds].sort(),
|
|
2023
|
+
reasons: [...omission.reasons].sort()
|
|
2024
|
+
})),
|
|
2025
|
+
network_transaction_range: this.network?.omittedTransactionRange() ?? null
|
|
2026
|
+
}
|
|
1734
2027
|
};
|
|
1735
2028
|
}
|
|
1736
2029
|
push(event) {
|
|
1737
|
-
if (this.sealed) return 0;
|
|
1738
2030
|
this.sequence += 1;
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
2031
|
+
const cost = allocationCost(event, this.limits.max_event_allocation_bytes) + 128;
|
|
2032
|
+
const reason = this.admissionReason(cost);
|
|
2033
|
+
if (this.sealed || reason !== undefined) {
|
|
2034
|
+
const finalReason = reason ?? "max-events";
|
|
2035
|
+
this.omitEvent(event.kind, finalReason);
|
|
2036
|
+
return {
|
|
2037
|
+
status: "omitted",
|
|
2038
|
+
sequence: this.sequence,
|
|
2039
|
+
reason: finalReason
|
|
2040
|
+
};
|
|
1747
2041
|
}
|
|
1748
2042
|
this.retainedCost += cost;
|
|
1749
2043
|
const parsed = browserScenarioEventSchema.parse({
|
|
@@ -1752,34 +2046,106 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1752
2046
|
step_index: this.stepIndex
|
|
1753
2047
|
});
|
|
1754
2048
|
this.items.push(parsed);
|
|
1755
|
-
return
|
|
2049
|
+
return {
|
|
2050
|
+
status: "retained",
|
|
2051
|
+
sequence: this.sequence
|
|
2052
|
+
};
|
|
1756
2053
|
}
|
|
1757
|
-
admitText(...values) {
|
|
1758
|
-
return this.admitProducerText(values);
|
|
2054
|
+
admitText(kind, ...values) {
|
|
2055
|
+
return this.admitProducerText(kind, values, false).status === "retained";
|
|
1759
2056
|
}
|
|
1760
2057
|
/** Admit conservative output cost before running redaction or cloning. */
|
|
1761
|
-
admitProducerText(values) {
|
|
1762
|
-
if (this.sealed) return false;
|
|
2058
|
+
admitProducerText(kind, values, networkMetadata) {
|
|
1763
2059
|
let cost = 4096;
|
|
1764
2060
|
for (const value of values) {
|
|
1765
2061
|
cost += this.secrets.redactionAllocationCost(value.length);
|
|
1766
|
-
if (cost > MAX_EVENT_COST || cost > MAX_CAPTURE_COST - this.retainedCost) {
|
|
1767
|
-
this.sequence += 1;
|
|
1768
|
-
this.dropped += 1;
|
|
1769
|
-
return false;
|
|
1770
|
-
}
|
|
1771
2062
|
}
|
|
1772
|
-
|
|
2063
|
+
const reason = networkMetadata && cost > this.limits.max_network_metadata_allocation_bytes ? "max-network-metadata-allocation-bytes" : this.admissionReason(cost);
|
|
2064
|
+
if (reason !== undefined) {
|
|
1773
2065
|
this.sequence += 1;
|
|
1774
|
-
this.
|
|
1775
|
-
return
|
|
2066
|
+
this.omitEvent(kind, reason);
|
|
2067
|
+
return {
|
|
2068
|
+
status: "omitted",
|
|
2069
|
+
sequence: this.sequence,
|
|
2070
|
+
reason
|
|
2071
|
+
};
|
|
1776
2072
|
}
|
|
1777
|
-
return
|
|
2073
|
+
return {
|
|
2074
|
+
status: "retained",
|
|
2075
|
+
sequence: this.sequence + 1
|
|
2076
|
+
};
|
|
1778
2077
|
}
|
|
1779
|
-
|
|
1780
|
-
if (this.sealed) return
|
|
1781
|
-
if (this.
|
|
2078
|
+
admissionReason(cost) {
|
|
2079
|
+
if (this.sealed || this.items.length >= this.limits.max_events) return "max-events";
|
|
2080
|
+
if (cost > this.limits.max_event_allocation_bytes) return "max-event-allocation-bytes";
|
|
2081
|
+
if (cost > this.limits.max_total_event_allocation_bytes - this.retainedCost) return "max-total-event-allocation-bytes";
|
|
2082
|
+
return undefined;
|
|
2083
|
+
}
|
|
2084
|
+
admitContentBody(input) {
|
|
2085
|
+
const kind = "network-content";
|
|
2086
|
+
const eventCost = allocationCost({
|
|
2087
|
+
kind,
|
|
2088
|
+
sequence: this.sequence + 1,
|
|
2089
|
+
step_index: this.stepIndex,
|
|
2090
|
+
transaction_id: input.transactionId,
|
|
2091
|
+
source_event_sequence: input.sourceEventSequence,
|
|
2092
|
+
phase: input.phase,
|
|
2093
|
+
headers: input.headers,
|
|
2094
|
+
body: {
|
|
2095
|
+
state: "captured",
|
|
2096
|
+
representation: input.phase === "request" ? "browser-exposed-request-bytes" : "playwright-response-body-bytes",
|
|
2097
|
+
encoding: "base64",
|
|
2098
|
+
content: null,
|
|
2099
|
+
bytes: input.observedBytes,
|
|
2100
|
+
sha256: "0".repeat(64),
|
|
2101
|
+
media_type: null,
|
|
2102
|
+
redacted: false
|
|
2103
|
+
}
|
|
2104
|
+
}, this.limits.max_event_allocation_bytes) - 64 + input.allocationBytes + (input.mediaType === undefined ? 0 : Math.max(input.mediaType.length * 8 + 2, this.secrets.redactionAllocationCost(input.mediaType.length))) + 128;
|
|
2105
|
+
const reason = this.admissionReason(eventCost);
|
|
2106
|
+
if (reason !== undefined) {
|
|
2107
|
+
this.sequence += 1;
|
|
2108
|
+
this.omitEvent(kind, reason);
|
|
2109
|
+
return {
|
|
2110
|
+
status: "omitted",
|
|
2111
|
+
sequence: this.sequence,
|
|
2112
|
+
reason
|
|
2113
|
+
};
|
|
2114
|
+
}
|
|
2115
|
+
return {
|
|
2116
|
+
status: "retained",
|
|
2117
|
+
sequence: this.sequence + 1
|
|
2118
|
+
};
|
|
2119
|
+
}
|
|
2120
|
+
omitEvent(kind, reason) {
|
|
1782
2121
|
this.dropped += 1;
|
|
2122
|
+
let omission = this.omittedKinds.get(kind);
|
|
2123
|
+
if (omission === undefined) {
|
|
2124
|
+
omission = {
|
|
2125
|
+
count: 0,
|
|
2126
|
+
reasons: new Set()
|
|
2127
|
+
};
|
|
2128
|
+
this.omittedKinds.set(kind, omission);
|
|
2129
|
+
}
|
|
2130
|
+
omission.count += 1;
|
|
2131
|
+
omission.reasons.add(reason);
|
|
2132
|
+
}
|
|
2133
|
+
omitNetwork(transactionId, kind, reason) {
|
|
2134
|
+
let omission = this.omittedNetwork.get(transactionId);
|
|
2135
|
+
if (omission === undefined) {
|
|
2136
|
+
omission = {
|
|
2137
|
+
kinds: new Set(),
|
|
2138
|
+
reasons: new Set()
|
|
2139
|
+
};
|
|
2140
|
+
this.omittedNetwork.set(transactionId, omission);
|
|
2141
|
+
}
|
|
2142
|
+
omission.kinds.add(kind);
|
|
2143
|
+
omission.reasons.add(reason);
|
|
2144
|
+
}
|
|
2145
|
+
admitOwner(kind) {
|
|
2146
|
+
if (this.stopListeners.size < MAX_LISTENER_OWNERS) return true;
|
|
2147
|
+
this.sequence += 1;
|
|
2148
|
+
this.omitEvent(kind, "max-listener-owners");
|
|
1783
2149
|
return false;
|
|
1784
2150
|
}
|
|
1785
2151
|
retainListener(owner, stop) {
|
|
@@ -1810,7 +2176,7 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1810
2176
|
}
|
|
1811
2177
|
if (this.enabled.has("page-errors")) {
|
|
1812
2178
|
const onError = (error) => {
|
|
1813
|
-
if (!this.admitText(error.message, error.stack ?? "")) return;
|
|
2179
|
+
if (!this.admitText("page-error", error.message, error.stack ?? "")) return;
|
|
1814
2180
|
this.push({
|
|
1815
2181
|
kind: "page-error",
|
|
1816
2182
|
message: this.secrets.redact(error.message),
|
|
@@ -1858,7 +2224,7 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1858
2224
|
console(message) {
|
|
1859
2225
|
const rawText = message.text();
|
|
1860
2226
|
const location = message.location();
|
|
1861
|
-
if (!this.admitText(rawText, location.url, message.type())) return;
|
|
2227
|
+
if (!this.admitText("console", rawText, location.url, message.type())) return;
|
|
1862
2228
|
this.push({
|
|
1863
2229
|
kind: "console",
|
|
1864
2230
|
level: this.secrets.redact(message.type()),
|
|
@@ -1867,8 +2233,8 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1867
2233
|
});
|
|
1868
2234
|
}
|
|
1869
2235
|
webSocket(socket) {
|
|
1870
|
-
if (!this.admitOwner()) return;
|
|
1871
|
-
if (!this.admitText(socket.url())) return;
|
|
2236
|
+
if (!this.admitOwner("websocket-opened")) return;
|
|
2237
|
+
if (!this.admitText("websocket-opened", socket.url())) return;
|
|
1872
2238
|
const url = this.safeUrl(socket.url());
|
|
1873
2239
|
this.push({
|
|
1874
2240
|
kind: "websocket-opened",
|
|
@@ -1904,7 +2270,7 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1904
2270
|
});
|
|
1905
2271
|
return;
|
|
1906
2272
|
}
|
|
1907
|
-
if (!this.admitText(payload)) return;
|
|
2273
|
+
if (!this.admitText(kind, payload)) return;
|
|
1908
2274
|
const text = this.secrets.redact(payload);
|
|
1909
2275
|
this.push({
|
|
1910
2276
|
kind,
|
|
@@ -1916,7 +2282,7 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1916
2282
|
});
|
|
1917
2283
|
}
|
|
1918
2284
|
frame(kind, frame) {
|
|
1919
|
-
if (!this.admitText(frame.url(), frame.name())) return;
|
|
2285
|
+
if (!this.admitText(kind, frame.url(), frame.name())) return;
|
|
1920
2286
|
this.push({
|
|
1921
2287
|
kind,
|
|
1922
2288
|
url: frame.url() === "" ? null : this.safeUrl(frame.url()),
|
|
@@ -1924,7 +2290,7 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1924
2290
|
});
|
|
1925
2291
|
}
|
|
1926
2292
|
worker(worker) {
|
|
1927
|
-
if (!this.admitOwner() || !this.admitText(worker.url())) return;
|
|
2293
|
+
if (!this.admitOwner("worker-created") || !this.admitText("worker-created", worker.url())) return;
|
|
1928
2294
|
const details = {
|
|
1929
2295
|
url: this.safeUrl(worker.url()),
|
|
1930
2296
|
name: null
|
|
@@ -1945,7 +2311,7 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1945
2311
|
}
|
|
1946
2312
|
popup(page) {
|
|
1947
2313
|
if (this.pages.has(page)) return;
|
|
1948
|
-
if (!this.admitOwner() || !this.admitText(page.url())) return;
|
|
2314
|
+
if (!this.admitOwner("popup-opened") || !this.admitText("popup-opened", page.url())) return;
|
|
1949
2315
|
this.pages.add(page);
|
|
1950
2316
|
for (const family of [
|
|
1951
2317
|
"frames",
|
|
@@ -1963,7 +2329,7 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1963
2329
|
...opened
|
|
1964
2330
|
});
|
|
1965
2331
|
const onClose = () => {
|
|
1966
|
-
if (!this.admitText(page.url())) return;
|
|
2332
|
+
if (!this.admitText("popup-closed", page.url())) return;
|
|
1967
2333
|
this.push({
|
|
1968
2334
|
kind: "popup-closed",
|
|
1969
2335
|
url: page.url() === "" ? null : this.safeUrl(page.url()),
|
|
@@ -1976,7 +2342,7 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1976
2342
|
this.observePage(page);
|
|
1977
2343
|
}
|
|
1978
2344
|
download(download) {
|
|
1979
|
-
if (this.admitText(download.suggestedFilename(), download.url())) this.push({
|
|
2345
|
+
if (this.admitText("download-cancelled", download.suggestedFilename(), download.url())) this.push({
|
|
1980
2346
|
kind: "download-cancelled",
|
|
1981
2347
|
suggested_filename: this.secrets.redact(download.suggestedFilename()),
|
|
1982
2348
|
url: this.safeUrl(download.url())
|
|
@@ -1994,6 +2360,7 @@ function init_PlaywrightScenarioEvents() {
|
|
|
1994
2360
|
var breakpointResponse, scriptIdentifierResponse, storageKeyResponse, targetInfoResponse, STORAGE_EVENT_METHODS, attachedTargetEvent, targetSessionEvent, nestedMessageEvent, nestedProtocolMessage, executionContextEvent, scriptParsedEvent, pausedEvent, evaluationResponse, STORAGE_CLEANUP_TIMEOUT_MS, PlaywrightScenarioStorage;
|
|
1995
2361
|
function init_PlaywrightScenarioStorage() {
|
|
1996
2362
|
return (init_PlaywrightScenarioStorage = __esmMin((() => {
|
|
2363
|
+
init_AnalysisCleanupLease();
|
|
1997
2364
|
init_browserObservationError();
|
|
1998
2365
|
init_PlaywrightExecutionBoundary();
|
|
1999
2366
|
breakpointResponse = z.object({ breakpointId: z.string() });
|
|
@@ -2060,6 +2427,7 @@ function init_PlaywrightScenarioStorage() {
|
|
|
2060
2427
|
#generation = 0;
|
|
2061
2428
|
#closed = false;
|
|
2062
2429
|
#cleanupCompleted = false;
|
|
2430
|
+
#loadingStopped = false;
|
|
2063
2431
|
#failure;
|
|
2064
2432
|
#closePromise;
|
|
2065
2433
|
#detachPromise;
|
|
@@ -2093,8 +2461,9 @@ function init_PlaywrightScenarioStorage() {
|
|
|
2093
2461
|
detached = true;
|
|
2094
2462
|
}
|
|
2095
2463
|
};
|
|
2096
|
-
|
|
2097
|
-
|
|
2464
|
+
const cleanup = new AnalysisCleanupLease(lateCleanup, ["browser_storage_transport"]);
|
|
2465
|
+
retainCleanup?.(cleanup);
|
|
2466
|
+
void withPlaywrightExecutionBoundary(() => cleanup.release(), STORAGE_CLEANUP_TIMEOUT_MS).catch(() => undefined);
|
|
2098
2467
|
}
|
|
2099
2468
|
throw cause;
|
|
2100
2469
|
}
|
|
@@ -2110,9 +2479,9 @@ function init_PlaywrightScenarioStorage() {
|
|
|
2110
2479
|
}
|
|
2111
2480
|
async initializeRoot(page, context) {
|
|
2112
2481
|
const rootInfo = targetInfoResponse.parse(await this.cdp.send("Target.getTargetInfo"));
|
|
2482
|
+
if (this.#closed) return;
|
|
2113
2483
|
const root = this.createTarget(undefined, rootInfo.targetInfo.targetId, (method, params) => this.cdp.send(method, params));
|
|
2114
2484
|
this.#targets.set("", root);
|
|
2115
|
-
if (this.#closed) return;
|
|
2116
2485
|
this.listen(page, context);
|
|
2117
2486
|
const ready = this.initializeTarget(root);
|
|
2118
2487
|
root.ready = ready;
|
|
@@ -2359,7 +2728,7 @@ function init_PlaywrightScenarioStorage() {
|
|
|
2359
2728
|
}
|
|
2360
2729
|
}
|
|
2361
2730
|
close(stopLoading = false) {
|
|
2362
|
-
if (this.#cleanupCompleted) return Promise.resolve();
|
|
2731
|
+
if (this.#cleanupCompleted) return Promise.resolve({ loadingStopped: this.#loadingStopped });
|
|
2363
2732
|
if (this.#closePromise !== undefined) return this.#closePromise;
|
|
2364
2733
|
const closing = this.closeResources(stopLoading).catch((cause) => {
|
|
2365
2734
|
throw new BrowserObservationError("capture_browser_scenario", "cleanup_failed", {
|
|
@@ -2379,10 +2748,13 @@ function init_PlaywrightScenarioStorage() {
|
|
|
2379
2748
|
async closeResources(stopLoading) {
|
|
2380
2749
|
this.#closed = true;
|
|
2381
2750
|
let stopLoadingFailure;
|
|
2382
|
-
if (stopLoading) {
|
|
2751
|
+
if (stopLoading && !this.#loadingStopped) {
|
|
2383
2752
|
try {
|
|
2384
2753
|
const root = this.#targets.get("");
|
|
2385
|
-
if (root !== undefined)
|
|
2754
|
+
if (root !== undefined) {
|
|
2755
|
+
await withPlaywrightExecutionBoundary(() => root.send("Page.stopLoading"), STORAGE_CLEANUP_TIMEOUT_MS);
|
|
2756
|
+
this.#loadingStopped = true;
|
|
2757
|
+
}
|
|
2386
2758
|
} catch (cause) {
|
|
2387
2759
|
stopLoadingFailure = { cause };
|
|
2388
2760
|
}
|
|
@@ -2413,6 +2785,7 @@ function init_PlaywrightScenarioStorage() {
|
|
|
2413
2785
|
this.#replies.clear();
|
|
2414
2786
|
this.#cleanupCompleted = true;
|
|
2415
2787
|
if (stopLoadingFailure !== undefined) throw stopLoadingFailure.cause;
|
|
2788
|
+
return { loadingStopped: this.#loadingStopped };
|
|
2416
2789
|
}
|
|
2417
2790
|
};
|
|
2418
2791
|
})))();
|
|
@@ -2420,7 +2793,7 @@ function init_PlaywrightScenarioStorage() {
|
|
|
2420
2793
|
|
|
2421
2794
|
//#endregion
|
|
2422
2795
|
//#region dist/browser/PlaywrightScenarioServiceWorkers.js
|
|
2423
|
-
var OPERATION$1, scriptResponse, attachedEvent, detachedEvent, PlaywrightScenarioServiceWorkers;
|
|
2796
|
+
var OPERATION$1, POLICY_CLEANUP_CONFIRMATION_TIMEOUT_MS, scriptResponse, restorationResponse, attachedEvent, detachedEvent, PlaywrightScenarioServiceWorkers;
|
|
2424
2797
|
function init_PlaywrightScenarioServiceWorkers() {
|
|
2425
2798
|
return (init_PlaywrightScenarioServiceWorkers = __esmMin((() => {
|
|
2426
2799
|
init_browserObservation();
|
|
@@ -2430,7 +2803,9 @@ function init_PlaywrightScenarioServiceWorkers() {
|
|
|
2430
2803
|
init_CdpTargetSession();
|
|
2431
2804
|
init_PlaywrightExecutionBoundary();
|
|
2432
2805
|
OPERATION$1 = "capture_browser_scenario";
|
|
2806
|
+
POLICY_CLEANUP_CONFIRMATION_TIMEOUT_MS = 5e3;
|
|
2433
2807
|
scriptResponse = z.object({ identifier: z.string() });
|
|
2808
|
+
restorationResponse = z.object({ result: z.object({ value: z.literal("policy_owned").nullable() }) });
|
|
2434
2809
|
attachedEvent = z.object({
|
|
2435
2810
|
sessionId: z.string(),
|
|
2436
2811
|
targetInfo: z.object({ type: z.string() })
|
|
@@ -2450,6 +2825,7 @@ function init_PlaywrightScenarioServiceWorkers() {
|
|
|
2450
2825
|
#closed = false;
|
|
2451
2826
|
#released = false;
|
|
2452
2827
|
#detached = false;
|
|
2828
|
+
#loadingStopped = false;
|
|
2453
2829
|
#removeListener;
|
|
2454
2830
|
#setup = new AbortController();
|
|
2455
2831
|
constructor(page, endpoint, targetId) {
|
|
@@ -2479,6 +2855,7 @@ function init_PlaywrightScenarioServiceWorkers() {
|
|
|
2479
2855
|
if (targetInfo.type === "iframe") this.addTarget(sessionId);
|
|
2480
2856
|
} else if (event.method === "Target.detachedFromTarget") {
|
|
2481
2857
|
const id = detachedEvent.parse(event.params).sessionId;
|
|
2858
|
+
this.#targets.get(id)?.markDetached();
|
|
2482
2859
|
this.#targets.delete(id);
|
|
2483
2860
|
if (id === this.#session?.sessionId) this.#detached = true;
|
|
2484
2861
|
}
|
|
@@ -2490,8 +2867,15 @@ function init_PlaywrightScenarioServiceWorkers() {
|
|
|
2490
2867
|
await withPlaywrightExecutionBoundary(() => this.assertBlocked(), undefined, this.#setup.signal);
|
|
2491
2868
|
}
|
|
2492
2869
|
addTarget(id) {
|
|
2870
|
+
this.#targets.get(id)?.markDetached();
|
|
2871
|
+
let markDetached = () => undefined;
|
|
2872
|
+
const detached = new Promise((resolve) => {
|
|
2873
|
+
markDetached = resolve;
|
|
2874
|
+
});
|
|
2493
2875
|
const target = {
|
|
2494
2876
|
id,
|
|
2877
|
+
detached,
|
|
2878
|
+
markDetached,
|
|
2495
2879
|
ready: Promise.resolve()
|
|
2496
2880
|
};
|
|
2497
2881
|
this.#targets.set(id, target);
|
|
@@ -2547,35 +2931,79 @@ function init_PlaywrightScenarioServiceWorkers() {
|
|
|
2547
2931
|
async settle() {
|
|
2548
2932
|
for (;;) {
|
|
2549
2933
|
const targets = [...this.#targets.values()];
|
|
2550
|
-
await Promise.all(targets.map(
|
|
2551
|
-
try {
|
|
2552
|
-
await target.ready;
|
|
2553
|
-
} catch (cause) {
|
|
2554
|
-
if (this.#targets.get(target.id) === target) throw cause;
|
|
2555
|
-
}
|
|
2556
|
-
}));
|
|
2934
|
+
await Promise.all(targets.map((target) => this.settleTarget(target)));
|
|
2557
2935
|
if (targets.length === this.#targets.size && targets.every((target) => this.#targets.get(target.id) === target)) return;
|
|
2558
2936
|
}
|
|
2559
2937
|
}
|
|
2938
|
+
async settleTarget(target) {
|
|
2939
|
+
try {
|
|
2940
|
+
await Promise.race([target.ready, target.detached]);
|
|
2941
|
+
} catch (cause) {
|
|
2942
|
+
if (this.#targets.get(target.id) === target) throw cause;
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
async settleTargetForRestore(target) {
|
|
2946
|
+
try {
|
|
2947
|
+
await Promise.race([target.ready, target.detached]);
|
|
2948
|
+
} catch {}
|
|
2949
|
+
}
|
|
2950
|
+
restorationScript() {
|
|
2951
|
+
return `(() => {
|
|
2952
|
+
const restore = globalThis[${this.restoreKey}];
|
|
2953
|
+
if (typeof restore === "function" && restore(${this.secret}) === true) return null;
|
|
2954
|
+
const register = globalThis.ServiceWorkerContainer?.prototype.register;
|
|
2955
|
+
return typeof register === "function" && Object.hasOwn(register, Symbol.for(${this.marker}))
|
|
2956
|
+
? "policy_owned"
|
|
2957
|
+
: null;
|
|
2958
|
+
})()`;
|
|
2959
|
+
}
|
|
2960
|
+
async restoreMainFrame(id) {
|
|
2961
|
+
const { result } = restorationResponse.parse(await this.send(id, "Runtime.evaluate", {
|
|
2962
|
+
expression: this.restorationScript(),
|
|
2963
|
+
returnByValue: true
|
|
2964
|
+
}));
|
|
2965
|
+
if (result.value === "policy_owned") throw new Error("service-worker policy restoration could not be confirmed");
|
|
2966
|
+
}
|
|
2967
|
+
async restorePlaywrightFrame(frame) {
|
|
2968
|
+
try {
|
|
2969
|
+
const failure = await frame.evaluate(this.restorationScript());
|
|
2970
|
+
if (failure === "policy_owned") throw new Error("service-worker policy restoration could not be confirmed");
|
|
2971
|
+
if (failure !== null) throw new BrowserObservationError(OPERATION$1, "protocol_error");
|
|
2972
|
+
} catch (cause) {
|
|
2973
|
+
if (!this.page.isClosed() && !frame.isDetached()) throw cause;
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
async stopMainFrame(frame) {
|
|
2977
|
+
try {
|
|
2978
|
+
await frame.evaluate("globalThis.stop()");
|
|
2979
|
+
this.#loadingStopped = true;
|
|
2980
|
+
} catch (cause) {
|
|
2981
|
+
if (!this.page.isClosed() && !frame.isDetached()) throw cause;
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2560
2984
|
async assertBlocked() {
|
|
2561
2985
|
if (this.#session !== undefined) await this.settle();
|
|
2562
2986
|
for (const frame of this.page.frames()) {
|
|
2563
|
-
let
|
|
2987
|
+
let failure;
|
|
2564
2988
|
try {
|
|
2565
|
-
|
|
2566
|
-
if (!("serviceWorker" in navigator)) return
|
|
2989
|
+
failure = await frame.evaluate(`(async () => {
|
|
2990
|
+
if (!("serviceWorker" in navigator)) return null;
|
|
2567
2991
|
const serviceWorker = navigator.serviceWorker;
|
|
2568
2992
|
if (${this.#session !== undefined} &&
|
|
2569
2993
|
(!Object.hasOwn(serviceWorker.register, Symbol.for(${this.marker})) ||
|
|
2570
|
-
typeof globalThis[${this.restoreKey}] !== "function")) return
|
|
2571
|
-
if (serviceWorker.controller !== null) return
|
|
2572
|
-
return (await serviceWorker.getRegistrations()).length > 0
|
|
2994
|
+
typeof globalThis[${this.restoreKey}] !== "function")) return "policy_unprotected";
|
|
2995
|
+
if (serviceWorker.controller !== null) return "service_worker_blocked";
|
|
2996
|
+
return (await serviceWorker.getRegistrations()).length > 0
|
|
2997
|
+
? "service_worker_blocked"
|
|
2998
|
+
: null;
|
|
2573
2999
|
})()`);
|
|
2574
3000
|
} catch (cause) {
|
|
2575
3001
|
if (frame.isDetached()) continue;
|
|
2576
3002
|
throw cause;
|
|
2577
3003
|
}
|
|
2578
|
-
if (
|
|
3004
|
+
if (failure === "policy_unprotected") throw new BrowserObservationError(OPERATION$1, "target_not_allowed");
|
|
3005
|
+
if (failure === "service_worker_blocked") throw new BrowserObservationError(OPERATION$1, "service_worker_blocked");
|
|
3006
|
+
if (failure !== null) throw new BrowserObservationError(OPERATION$1, "protocol_error");
|
|
2579
3007
|
}
|
|
2580
3008
|
}
|
|
2581
3009
|
close(stopLoading = false) {
|
|
@@ -2587,7 +3015,7 @@ function init_PlaywrightScenarioServiceWorkers() {
|
|
|
2587
3015
|
}, () => {
|
|
2588
3016
|
if (this.#restoration === restoration) this.#restoration = undefined;
|
|
2589
3017
|
});
|
|
2590
|
-
return withPlaywrightExecutionBoundary(() => restoration,
|
|
3018
|
+
return withPlaywrightExecutionBoundary(() => restoration, POLICY_CLEANUP_CONFIRMATION_TIMEOUT_MS);
|
|
2591
3019
|
}
|
|
2592
3020
|
async restore(stopLoading) {
|
|
2593
3021
|
await this.#initialization?.catch(() => undefined);
|
|
@@ -2595,8 +3023,16 @@ function init_PlaywrightScenarioServiceWorkers() {
|
|
|
2595
3023
|
const session = this.#session;
|
|
2596
3024
|
if (session === undefined) return;
|
|
2597
3025
|
if (!this.page.isClosed()) {
|
|
2598
|
-
|
|
2599
|
-
|
|
3026
|
+
const mainFrame = this.page.mainFrame();
|
|
3027
|
+
if (stopLoading && !this.#loadingStopped) {
|
|
3028
|
+
if (!this.#detached && session.sessionId !== undefined) {
|
|
3029
|
+
await this.send(session.sessionId, "Page.stopLoading");
|
|
3030
|
+
this.#loadingStopped = true;
|
|
3031
|
+
} else {
|
|
3032
|
+
await this.stopMainFrame(mainFrame);
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
await Promise.all([...this.#targets.values()].map((target) => this.settleTargetForRestore(target)));
|
|
2600
3036
|
for (const target of this.#targets.values()) {
|
|
2601
3037
|
if (!this.#detached && target.identifier !== undefined) {
|
|
2602
3038
|
try {
|
|
@@ -2607,19 +3043,16 @@ function init_PlaywrightScenarioServiceWorkers() {
|
|
|
2607
3043
|
delete target.identifier;
|
|
2608
3044
|
}
|
|
2609
3045
|
}
|
|
3046
|
+
if (!this.#detached && session.sessionId !== undefined) {
|
|
3047
|
+
await this.restoreMainFrame(session.sessionId);
|
|
3048
|
+
} else {
|
|
3049
|
+
await this.restorePlaywrightFrame(mainFrame);
|
|
3050
|
+
}
|
|
2610
3051
|
for (const frame of this.page.frames()) {
|
|
3052
|
+
if (frame === mainFrame) continue;
|
|
2611
3053
|
if (frame.isDetached()) continue;
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
const restore = globalThis[${this.restoreKey}];
|
|
2615
|
-
if (typeof restore === "function" && restore(${this.secret}) === true) return;
|
|
2616
|
-
const register = globalThis.ServiceWorkerContainer?.prototype.register;
|
|
2617
|
-
if (typeof register === "function" && Object.hasOwn(register, Symbol.for(${this.marker})))
|
|
2618
|
-
throw new Error("service-worker policy restoration could not be confirmed");
|
|
2619
|
-
})()`);
|
|
2620
|
-
} catch (cause) {
|
|
2621
|
-
if (!frame.isDetached()) throw cause;
|
|
2622
|
-
}
|
|
3054
|
+
if (frame.url().length === 0) continue;
|
|
3055
|
+
await this.restorePlaywrightFrame(frame);
|
|
2623
3056
|
}
|
|
2624
3057
|
}
|
|
2625
3058
|
if (!this.page.isClosed() && !this.#detached && session.sessionId !== undefined) {
|
|
@@ -2639,6 +3072,8 @@ function init_PlaywrightScenarioServiceWorkers() {
|
|
|
2639
3072
|
var OPERATION, throwIfScenarioCancelled, throwCleanupFailures, installCookies, initializePage, PlaywrightScenarioSession;
|
|
2640
3073
|
function init_PlaywrightScenarioSession() {
|
|
2641
3074
|
return (init_PlaywrightScenarioSession = __esmMin((() => {
|
|
3075
|
+
init_AnalysisCleanupLease();
|
|
3076
|
+
init_analysisErrorBase();
|
|
2642
3077
|
init_browserObservationError();
|
|
2643
3078
|
init_BrowserScenarioSecrets();
|
|
2644
3079
|
init_PlaywrightScenarioBrowser();
|
|
@@ -2651,7 +3086,7 @@ function init_PlaywrightScenarioSession() {
|
|
|
2651
3086
|
init_BrowserScenarioPartialObservation();
|
|
2652
3087
|
OPERATION = "capture_browser_scenario";
|
|
2653
3088
|
throwIfScenarioCancelled = (signal) => {
|
|
2654
|
-
if (signal?.aborted === true) throw new BrowserObservationError(OPERATION, "cancelled");
|
|
3089
|
+
if (signal?.aborted === true) throw new BrowserObservationError(OPERATION, "cancelled", { cause: signal?.reason });
|
|
2655
3090
|
};
|
|
2656
3091
|
throwCleanupFailures = (failures) => {
|
|
2657
3092
|
if (failures.length === 1) throw failures[0];
|
|
@@ -2685,6 +3120,9 @@ function init_PlaywrightScenarioSession() {
|
|
|
2685
3120
|
serviceWorkers;
|
|
2686
3121
|
signal;
|
|
2687
3122
|
#storageReleased = false;
|
|
3123
|
+
#stopLoading = false;
|
|
3124
|
+
cleanupLease;
|
|
3125
|
+
#policyStopsLoading = false;
|
|
2688
3126
|
constructor(opened, options) {
|
|
2689
3127
|
this.opened = opened;
|
|
2690
3128
|
this.mode = options.mode;
|
|
@@ -2696,25 +3134,48 @@ function init_PlaywrightScenarioSession() {
|
|
|
2696
3134
|
this.signal = options.signal;
|
|
2697
3135
|
this.version = opened.browser.version();
|
|
2698
3136
|
this.initialUrl = opened.page.url();
|
|
3137
|
+
this.cleanupLease = new AnalysisCleanupLease(async () => {
|
|
3138
|
+
await this.#closeResources();
|
|
3139
|
+
}, { get cleanupResources() {
|
|
3140
|
+
return opened.cleanup.cleanupResources;
|
|
3141
|
+
} });
|
|
2699
3142
|
}
|
|
2700
3143
|
static async open(scenario, environment, options) {
|
|
2701
3144
|
throwIfScenarioCancelled(options.signal);
|
|
2702
3145
|
const secrets = BrowserScenarioSecrets.resolve(scenario, environment);
|
|
2703
3146
|
if (secrets === undefined) throw new BrowserObservationError(OPERATION, "secret_unavailable");
|
|
2704
3147
|
const startedAt = performance.now();
|
|
3148
|
+
const openingCleanup = new Set();
|
|
2705
3149
|
const opening = openPlaywrightScenarioBrowser(scenario, environment, {
|
|
2706
3150
|
signal: options.signal,
|
|
2707
|
-
|
|
3151
|
+
retainCleanup: (lease) => {
|
|
3152
|
+
openingCleanup.add(lease);
|
|
3153
|
+
options.retainCleanup?.(lease);
|
|
3154
|
+
}
|
|
2708
3155
|
});
|
|
2709
3156
|
let opened;
|
|
2710
3157
|
try {
|
|
2711
3158
|
opened = await withPlaywrightExecutionBoundary(() => opening, undefined, options.signal);
|
|
2712
3159
|
} catch (cause) {
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
3160
|
+
let lateOpened;
|
|
3161
|
+
let openingFailure;
|
|
3162
|
+
const cleanup = new AnalysisCleanupLease(async () => {
|
|
3163
|
+
try {
|
|
3164
|
+
lateOpened = await opening;
|
|
3165
|
+
} catch (cause) {
|
|
3166
|
+
openingFailure = cause instanceof AnalysisError && !(options.signal?.aborted === true && cause === options.signal.reason) ? cause : undefined;
|
|
3167
|
+
const results = await Promise.allSettled([...openingCleanup].map((lease) => lease.release()));
|
|
3168
|
+
const failures = results.flatMap((result) => result.status === "rejected" ? [result.reason] : []);
|
|
3169
|
+
throwCleanupFailures(failures);
|
|
3170
|
+
if (openingFailure?.cleanupIncomplete === true) throw openingFailure;
|
|
3171
|
+
return;
|
|
3172
|
+
}
|
|
3173
|
+
await lateOpened.cleanup.release();
|
|
3174
|
+
}, { get cleanupResources() {
|
|
3175
|
+
return lateOpened?.cleanup.cleanupResources ?? openingFailure?.cleanupResources;
|
|
3176
|
+
} });
|
|
3177
|
+
options.retainCleanup?.(cleanup);
|
|
3178
|
+
void withPlaywrightExecutionBoundary(() => cleanup.release(), 1e3).catch(() => undefined);
|
|
2718
3179
|
throw cause;
|
|
2719
3180
|
}
|
|
2720
3181
|
const session = await this.initializeSession(opened, scenario, secrets, options);
|
|
@@ -2734,7 +3195,7 @@ function init_PlaywrightScenarioSession() {
|
|
|
2734
3195
|
} catch (failure) {
|
|
2735
3196
|
cleanup = "incomplete";
|
|
2736
3197
|
cleanupFailure = { cause: failure };
|
|
2737
|
-
options.retainCleanup?.(
|
|
3198
|
+
options.retainCleanup?.(session.cleanupLease);
|
|
2738
3199
|
}
|
|
2739
3200
|
throw browserScenarioOperationFailure(cause, {
|
|
2740
3201
|
kind: "browser-scenario-observation",
|
|
@@ -2771,6 +3232,7 @@ function init_PlaywrightScenarioSession() {
|
|
|
2771
3232
|
enabled: new Set(scenario.capture.events),
|
|
2772
3233
|
secrets,
|
|
2773
3234
|
network: scenario.capture.network,
|
|
3235
|
+
limits: scenario.capture.limits,
|
|
2774
3236
|
...options.signal === undefined ? {} : { signal: options.signal }
|
|
2775
3237
|
});
|
|
2776
3238
|
return new PlaywrightScenarioSession(opened, {
|
|
@@ -2783,25 +3245,29 @@ function init_PlaywrightScenarioSession() {
|
|
|
2783
3245
|
});
|
|
2784
3246
|
} catch (cause) {
|
|
2785
3247
|
let storageReleased = false;
|
|
3248
|
+
const storageStopsLoading = storage !== undefined && options.signal?.aborted === true;
|
|
3249
|
+
let policyStopsLoading = !storageStopsLoading;
|
|
2786
3250
|
const cleanup = async () => {
|
|
2787
3251
|
let storageFailure;
|
|
2788
3252
|
let policyFailure;
|
|
2789
3253
|
let browserFailure;
|
|
2790
3254
|
if (!storageReleased) {
|
|
2791
3255
|
try {
|
|
2792
|
-
await storage?.close(
|
|
3256
|
+
const result = await storage?.close(storageStopsLoading);
|
|
3257
|
+
if (storageStopsLoading && result?.loadingStopped !== true) policyStopsLoading = true;
|
|
2793
3258
|
} catch (failure) {
|
|
2794
3259
|
storageFailure = { cause: failure };
|
|
3260
|
+
policyStopsLoading = true;
|
|
2795
3261
|
}
|
|
2796
3262
|
}
|
|
2797
3263
|
try {
|
|
2798
|
-
if (!opened.cleanup.browserClosed) await serviceWorkers?.close(
|
|
3264
|
+
if (!opened.cleanup.browserClosed) await serviceWorkers?.close(policyStopsLoading);
|
|
2799
3265
|
} catch (failure) {
|
|
2800
3266
|
policyFailure = { cause: failure };
|
|
2801
3267
|
}
|
|
2802
3268
|
if (policyFailure === undefined) {
|
|
2803
3269
|
try {
|
|
2804
|
-
await opened.cleanup.
|
|
3270
|
+
await opened.cleanup.release(events === undefined ? undefined : () => events?.finish() ?? Promise.resolve());
|
|
2805
3271
|
} catch (failure) {
|
|
2806
3272
|
browserFailure = { cause: failure };
|
|
2807
3273
|
}
|
|
@@ -2819,10 +3285,11 @@ function init_PlaywrightScenarioSession() {
|
|
|
2819
3285
|
...browserFailure === undefined ? [] : [browserFailure.cause]
|
|
2820
3286
|
]);
|
|
2821
3287
|
};
|
|
3288
|
+
const recovery = new AnalysisCleanupLease(cleanup, opened.cleanup);
|
|
2822
3289
|
try {
|
|
2823
|
-
return await failBrowserScenarioOperation(
|
|
3290
|
+
return await failBrowserScenarioOperation(recovery, cause);
|
|
2824
3291
|
} catch (failure) {
|
|
2825
|
-
if (failure !== cause) options.retainCleanup?.(
|
|
3292
|
+
if (failure !== cause) options.retainCleanup?.(recovery);
|
|
2826
3293
|
throw failure;
|
|
2827
3294
|
}
|
|
2828
3295
|
}
|
|
@@ -2868,24 +3335,45 @@ function init_PlaywrightScenarioSession() {
|
|
|
2868
3335
|
}), undefined, signal);
|
|
2869
3336
|
}
|
|
2870
3337
|
async close(stopLoading = this.signal?.aborted === true) {
|
|
3338
|
+
this.#stopLoading ||= stopLoading;
|
|
3339
|
+
try {
|
|
3340
|
+
await withPlaywrightExecutionBoundary(() => this.cleanupLease.release(), PLAYWRIGHT_CLEANUP_CONFIRMATION_TIMEOUT_MS);
|
|
3341
|
+
} catch (cause) {
|
|
3342
|
+
const error = new BrowserObservationError(OPERATION, "cleanup_failed", {
|
|
3343
|
+
cause,
|
|
3344
|
+
cleanup: {
|
|
3345
|
+
reason: cause instanceof Error ? cause.message : String(cause),
|
|
3346
|
+
resources: this.cleanupLease.cleanupResources ?? []
|
|
3347
|
+
}
|
|
3348
|
+
});
|
|
3349
|
+
new AnalysisCleanupLeaseGroup(error, [this.cleanupLease]);
|
|
3350
|
+
throw error;
|
|
3351
|
+
}
|
|
3352
|
+
return this.mode === "launch" ? "terminated-owned-process" : "disconnected-external";
|
|
3353
|
+
}
|
|
3354
|
+
async #closeResources() {
|
|
3355
|
+
const stopLoading = this.#stopLoading || this.signal?.aborted === true;
|
|
2871
3356
|
let storageFailure;
|
|
2872
3357
|
let policyFailure;
|
|
2873
3358
|
let browserFailure;
|
|
3359
|
+
if (stopLoading && this.storage === undefined) this.#policyStopsLoading = true;
|
|
2874
3360
|
if (!this.#storageReleased) {
|
|
2875
3361
|
try {
|
|
2876
|
-
await this.storage?.close(stopLoading);
|
|
3362
|
+
const result = await this.storage?.close(stopLoading);
|
|
3363
|
+
if (stopLoading && result?.loadingStopped !== true) this.#policyStopsLoading = true;
|
|
2877
3364
|
} catch (failure) {
|
|
2878
3365
|
storageFailure = { cause: failure };
|
|
3366
|
+
if (stopLoading) this.#policyStopsLoading = true;
|
|
2879
3367
|
}
|
|
2880
3368
|
}
|
|
2881
3369
|
try {
|
|
2882
|
-
if (!this.opened.cleanup.browserClosed) await this.serviceWorkers?.close(
|
|
3370
|
+
if (!this.opened.cleanup.browserClosed) await this.serviceWorkers?.close(this.#policyStopsLoading);
|
|
2883
3371
|
} catch (failure) {
|
|
2884
3372
|
policyFailure = { cause: failure };
|
|
2885
3373
|
}
|
|
2886
3374
|
if (policyFailure === undefined) {
|
|
2887
3375
|
try {
|
|
2888
|
-
await this.opened.cleanup.
|
|
3376
|
+
await this.opened.cleanup.release(() => this.eventCapture.finish());
|
|
2889
3377
|
} catch (failure) {
|
|
2890
3378
|
browserFailure = { cause: failure };
|
|
2891
3379
|
}
|
|
@@ -2902,7 +3390,6 @@ function init_PlaywrightScenarioSession() {
|
|
|
2902
3390
|
...this.#storageReleased || storageFailure === undefined ? [] : [storageFailure.cause],
|
|
2903
3391
|
...browserFailure === undefined ? [] : [browserFailure.cause]
|
|
2904
3392
|
]);
|
|
2905
|
-
return this.mode === "launch" ? "terminated-owned-process" : "disconnected-external";
|
|
2906
3393
|
}
|
|
2907
3394
|
redactError(error) {
|
|
2908
3395
|
return this.secrets.redact(error instanceof Error ? error.message : "browser action failed");
|