rea-agents 6.2.0 → 6.4.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 +24 -23
- package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
- package/bridge/ghidra/ReaGhidraBridge.java +597 -209
- package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
- package/bridge/hopper_bridge.py +2 -0
- package/dist/adb/AdbConfiguration.js +88 -0
- package/dist/adb/AdbDeviceOutput.js +186 -0
- package/dist/adb/AdbProvider.js +1190 -0
- package/dist/adb/AdbShellOutput.js +309 -0
- package/dist/android/AndroidTargetSnapshot.js +104 -22
- package/dist/android/JadxConfiguration.js +44 -24
- package/dist/android/JadxProvider.js +59 -21
- package/dist/android/JadxSession.js +51 -9
- package/dist/apktool/ApktoolConfiguration.js +84 -0
- package/dist/apktool/ApktoolDecodeOutput.js +59 -0
- package/dist/apktool/ApktoolProvider.js +506 -0
- package/dist/application/AnalysisProvider.js +8 -2
- package/dist/application/AppBundleExecutable.js +27 -22
- package/dist/application/BinaryTargetResolver.js +85 -19
- package/dist/application/BrowserScenarioEvidence.js +2 -2
- package/dist/application/CapabilityInventory.js +11 -1
- package/dist/application/ClientConfigurationDocument.js +98 -0
- package/dist/application/ClientConfigurationFiles.js +91 -0
- package/dist/application/ClientRegistrationEnvironment.js +35 -0
- package/dist/application/ClientRegistrationStatus.js +75 -27
- package/dist/application/DirectAnalysis.js +14 -8
- package/dist/application/DirectAnalysisCleanup.js +1 -2
- package/dist/application/DirectAnalysisStatus.js +3 -6
- package/dist/application/Doctor.js +27 -34
- package/dist/application/DoctorDiagnostics.js +1 -1
- package/dist/application/EvidenceBundleCommands.js +6 -12
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/GeminiClientSettings.js +139 -0
- package/dist/application/HermesClientHome.js +115 -0
- package/dist/application/HopperDownload.js +39 -0
- package/dist/application/InvestigationProviders.js +10 -4
- package/dist/application/JsonFiles.js +16 -15
- package/dist/application/JsonInputFile.js +252 -0
- package/dist/application/LinuxHopper.js +6 -13
- package/dist/application/MacHopper.js +172 -149
- package/dist/application/MipsElfAbiFlags.js +140 -0
- package/dist/application/ProviderOperationExecution.js +31 -0
- package/dist/application/ReconstructionObligationCandidates.js +16 -3
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -1
- package/dist/application/ReferenceSourceImport.js +76 -29
- package/dist/application/ReferenceSourceImportEntries.js +18 -9
- package/dist/application/ReferenceSourceImportPolicy.js +99 -23
- package/dist/application/ReferenceSourceImportTypes.js +30 -22
- package/dist/application/ReferenceSourceVcsAdapter.js +145 -30
- package/dist/application/RegularFileRead.js +103 -0
- package/dist/application/Setup.js +69 -10
- package/dist/application/SetupClientConfiguration.js +134 -23
- package/dist/application/SetupHost.js +102 -22
- package/dist/application/SetupPlan.js +18 -17
- package/dist/application/SetupSkill.js +81 -13
- package/dist/application/SupportedClients.js +305 -37
- package/dist/application/Uninstall.js +172 -8
- package/dist/application/UpdateMaintenance.js +23 -23
- package/dist/application/Utf8JsonInput.js +71 -0
- package/dist/application/WebScriptExportService.js +130 -57
- package/dist/application/WebSourceLocationService.js +3 -0
- package/dist/application/adb/AdbDeviceAnalysisPort.js +1 -0
- package/dist/application/adb/AdbDeviceAnalysisService.js +13 -0
- package/dist/application/analysisView/AnalysisViewService.js +40 -2
- package/dist/application/android/AndroidAnalysisService.js +1 -1
- package/dist/application/apktool/ApktoolResourceAnalysisPort.js +1 -0
- package/dist/application/apktool/ApktoolResourceAnalysisService.js +13 -0
- package/dist/application/binary/AnalysisClientCleanup.js +0 -24
- package/dist/application/binary/AnalysisSnapshotCache.js +5 -4
- package/dist/application/binary/BinarySession.js +18 -1
- package/dist/application/binary/BinarySessionOpen.js +9 -1
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +2 -1
- package/dist/application/binaryDiagnostics/PeResourcesPort.js +1 -0
- package/dist/application/binaryDiagnostics/PeResourcesService.js +111 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +2 -1
- package/dist/application/evm/EvmInterfaceService.js +3 -0
- package/dist/application/firmware/FirmwareAnalysisService.js +3 -0
- package/dist/application/investigation/InspectEvidenceBundle.js +18 -0
- package/dist/application/javascript/ElectronActiveEvidence.js +2 -2
- package/dist/application/javascript/ElectronBoundaryAnalysis.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphContext.js +3 -2
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +20 -3
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +3 -3
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +1 -0
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +107 -46
- package/dist/application/javascript/JavaScriptApplicationService.js +23 -11
- package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +5 -6
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +59 -45
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +171 -36
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +14 -16
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +74 -36
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +4 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +11 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +53 -42
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +92 -10
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +293 -238
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +120 -28
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +4 -0
- package/dist/application/javascript/JavaScriptJsonModules.js +2 -2
- package/dist/application/javascript/JavaScriptModuleRelationships.js +10 -20
- package/dist/application/javascript/JavaScriptRecoveryService.js +3 -0
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +11 -27
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +11 -5
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +206 -66
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +18 -23
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +5 -2
- package/dist/application/javascript/JavaScriptSemanticGraphEvidence.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFingerprintProjection.js +2 -2
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +7 -5
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +6 -4
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +4 -4
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +29 -15
- package/dist/application/javascript/JavaScriptSemanticTraceService.js +15 -10
- package/dist/application/jeb/JebAnalysisPort.js +1 -0
- package/dist/application/jeb/JebAnalysisService.js +13 -0
- package/dist/application/managed/ManagedApplicationGraphService.js +1 -1
- package/dist/application/native/NativeCallRoutes.js +2 -4
- package/dist/application/native/NativeUiActionTrace.js +16 -8
- package/dist/application/native/NativeValueTrace.js +23 -6
- package/dist/application/process/ProcessCli.js +25 -20
- package/dist/artifacts/ArtifactPaths.js +129 -8
- package/dist/artifacts/ArtifactProvider.js +34 -31
- package/dist/artifacts/ArtifactProviderMetadata.js +1 -4
- package/dist/artifacts/ArtifactReader.js +23 -0
- package/dist/artifacts/ArtifactResourceScope.js +100 -0
- package/dist/artifacts/AsarArtifactReader.js +218 -80
- package/dist/artifacts/AsarHeader.js +24 -0
- package/dist/artifacts/DirectoryArtifactReader.js +168 -65
- package/dist/artifacts/MachOSliceArtifactReader.js +116 -39
- package/dist/artifacts/NativeDmgArtifactReader.js +179 -87
- package/dist/artifacts/NativeDmgOwnership.js +109 -0
- package/dist/artifacts/SafeOutputTree.js +245 -70
- package/dist/artifacts/SafeOutputTreeCleanup.js +45 -0
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +20 -0
- package/dist/artifacts/SafeOutputTreeIdentity.js +42 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +33 -0
- package/dist/artifacts/ZipArtifactReader.js +77 -27
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +58 -18
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +62 -24
- package/dist/artifacts/apple/KeyedArchiveReader.js +76 -49
- package/dist/artifacts/apple/MachoLoadCommandReader.js +36 -6
- package/dist/artifacts/extraction/ArtifactExtraction.js +134 -92
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +116 -50
- package/dist/artifacts/inventory/ArtifactInventory.js +5 -4
- package/dist/artifacts/inventory/classify.js +87 -25
- package/dist/artifacts/inventory/hashStableRootArtifact.js +70 -0
- package/dist/artifacts/inventory/reader.js +13 -5
- package/dist/artifacts/inventory/scanCanonical.js +73 -30
- package/dist/artifacts/inventory/scanReader.js +43 -20
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +72 -28
- package/dist/artifacts/javascript/JavaScriptSourceAnalysis.js +3 -0
- package/dist/browser/BrowserScenarioPartialObservation.js +8 -2
- package/dist/browser/BrowserScenarioSecrets.js +52 -37
- package/dist/browser/CdpBrowserProvider.js +9 -3
- package/dist/browser/CdpCaptureDocuments.js +40 -6
- package/dist/browser/CdpCaptureDomSvg.js +210 -0
- package/dist/browser/CdpCaptureEventBodyShapes.js +4 -8
- package/dist/browser/CdpCaptureEventHandlers.js +26 -9
- package/dist/browser/CdpCaptureEvents.js +4 -9
- package/dist/browser/CdpCaptureStorageFingerprints.js +3 -3
- package/dist/browser/CdpConnection.js +22 -5
- package/dist/browser/CdpElectronInspection.js +2 -2
- package/dist/browser/CdpElectronProvider.js +4 -3
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpTargetSession.js +30 -34
- package/dist/browser/CdpWebMcpDiscovery.js +48 -23
- package/dist/browser/ElectronFileScope.js +99 -9
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +63 -7
- package/dist/browser/PlaywrightElectronActiveProvider.js +11 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +5 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +208 -43
- package/dist/browser/PlaywrightScenarioSession.js +130 -65
- package/dist/browser/PlaywrightScenarioStorage.js +507 -0
- package/dist/browser/PngVisualDiff.js +198 -29
- package/dist/browser/WebSourceMapFetcher.js +35 -9
- package/dist/browser/assets/LocalWebScriptArtifacts.js +3 -1
- package/dist/browser/assets/PublishWebScripts.js +75 -20
- package/dist/browser/assets/ScenarioScriptCapture.js +8 -12
- package/dist/browser/assets/WebArtifactReads.js +23 -1
- package/dist/browser/assets/WebSourceLocationArtifacts.js +1 -0
- package/dist/browser/execution/CdpExecutionCapture.js +3 -3
- package/dist/browser/execution/CdpPreciseCoverage.js +5 -8
- package/dist/browser/history/HarCapture.js +14 -0
- package/dist/browser/history/HarCaptureProcess.js +2 -10
- package/dist/browser/history/MitmproxyCaptureAdapter.js +3 -1
- package/dist/browser/modules/WebModuleArtifacts.js +1 -0
- package/dist/cli/adbCommands.js +337 -0
- package/dist/cli/analysisViewCommands.js +39 -1
- package/dist/cli/apktoolCommands.js +53 -0
- package/dist/cli/artifactCommands.js +8 -11
- package/dist/cli/binaryDiagnosticsCommands.js +19 -1
- package/dist/cli/browserAdvancedCommands.js +65 -36
- package/dist/cli/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +12 -13
- package/dist/cli/coreNativeCommands.js +1 -14
- package/dist/cli/electronCommands.js +14 -10
- package/dist/cli/evmCommands.js +13 -4
- package/dist/cli/firmwareCommands.js +7 -2
- package/dist/cli/javascriptApplicationAnalysis.js +19 -13
- package/dist/cli/javascriptRecoveryCommands.js +22 -15
- package/dist/cli/jebCommands.js +99 -0
- package/dist/cli/jsonOutput.js +12 -4
- package/dist/cli/referenceSourceImportStatus.js +7 -0
- package/dist/cli/setupCommands.js +15 -3
- package/dist/cli/streamedJsonOutput.js +83 -4
- package/dist/cli/utilityCommands.js +68 -22
- package/dist/cli/webScriptCommands.js +20 -1
- package/dist/cli/webSourceLocationCommands.js +21 -9
- package/dist/cli.js +11 -2
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +32 -0
- package/dist/cliJsonInput.js +47 -34
- package/dist/cliObservationOptions.js +7 -0
- package/dist/composition/adb.js +3 -0
- package/dist/composition/apktool.js +3 -0
- package/dist/composition/auxiliaryAnalysisProviders.js +5 -4
- package/dist/composition/binaryDiagnostics.js +4 -0
- package/dist/composition/browserScenario.js +2 -2
- package/dist/composition/directAnalysis.js +14 -7
- package/dist/composition/javascriptAnalysisWorkerProcess.js +48 -0
- package/dist/composition/jeb.js +6 -0
- package/dist/config/environment.js +10 -0
- package/dist/config/ghidraLanguageOverride.js +9 -0
- package/dist/config/mcpInputSchemaProfile.js +27 -0
- package/dist/config/parseConfig.js +28 -1
- package/dist/contracts/adb/adbToolContracts.js +353 -0
- package/dist/contracts/advertisedInputExamples.js +48 -0
- package/dist/contracts/analysisDetail.js +10 -0
- package/dist/contracts/analysisViewToolContracts.js +17 -2
- package/dist/contracts/apktool/apktoolToolContracts.js +33 -0
- package/dist/contracts/artifactComparisonExample.js +5 -5
- package/dist/contracts/artifactToolContracts.js +8 -5
- package/dist/contracts/browserToolContracts.js +1 -1
- package/dist/contracts/compactInputSchema.js +256 -0
- package/dist/contracts/errorSchemas.js +3 -1
- package/dist/contracts/functionComparisonExample.js +8 -0
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +104 -13
- package/dist/contracts/javascript/electronToolContracts.js +16 -3
- package/dist/contracts/javascript/javascriptApplicationWorkflowExamples.js +3 -2
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +6 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +1 -1
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +8 -7
- package/dist/contracts/jeb/jebToolContracts.js +64 -0
- package/dist/contracts/managed/managedToolContracts.js +3 -2
- package/dist/contracts/mobileApplicationGraphExamples.js +5 -5
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +25 -3
- package/dist/contracts/native/nativeToolContracts.js +1 -1
- package/dist/contracts/officialToolContracts.js +5 -5
- package/dist/contracts/sessionLifecycleInputs.js +4 -3
- package/dist/contracts/sessionStatusContract.js +3 -2
- package/dist/contracts/sessionToolContracts.js +5 -4
- package/dist/contracts/sessionToolSchemas.js +9 -4
- package/dist/contracts/toolContractExamples.js +6 -0
- package/dist/contracts/toolContractTypes.js +3 -0
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +167 -0
- package/dist/contracts/toolOutputSchemaGroups.js +7 -5
- package/dist/contracts/toolOutputSchemaPrimitives.js +2 -5
- package/dist/contracts/toolSchemaMetadata.js +82 -7
- package/dist/domain/adb/adbDeviceAnalysis.js +583 -0
- package/dist/domain/analysisErrorBase.js +5 -0
- package/dist/domain/analysisErrorCleanup.js +29 -0
- package/dist/domain/analysisErrorPresentation.js +18 -4
- package/dist/domain/analysisErrorProjection.js +4 -1
- package/dist/domain/analysisSnapshot.js +5 -2
- package/dist/domain/analysisView/analysisView.js +53 -5
- package/dist/domain/analysisView/binaryLayoutView.js +2 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +2 -0
- package/dist/domain/analysisView/nativeFunctionView.js +155 -0
- package/dist/domain/android/androidApplication.js +25 -20
- package/dist/domain/android/androidPartialObservation.js +36 -0
- package/dist/domain/apktool/apktoolResourceAnalysis.js +77 -0
- package/dist/domain/apple/appleApplication.js +40 -23
- package/dist/domain/apple/appleBundleAnatomy.js +95 -28
- package/dist/domain/apple/dyldPaths.js +9 -1
- package/dist/domain/apple/dylibResolution.js +3 -3
- package/dist/domain/apple/interfaceBuilderGraph.js +22 -19
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +10 -1
- package/dist/domain/artifactComparison.js +39 -11
- package/dist/domain/artifactGraph.js +6 -4
- package/dist/domain/artifactIdentity.js +37 -9
- package/dist/domain/artifactInspection.js +10 -50
- package/dist/domain/artifactIntegrityPolicy.js +10 -0
- package/dist/domain/artifactInventoryEvidence.js +16 -17
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/binaryTarget.js +16 -0
- package/dist/domain/binaryTargetTypes.js +8 -1
- package/dist/domain/browserCompleteness.js +3 -2
- package/dist/domain/browserObservationSchemas.js +8 -4
- package/dist/domain/browserScenarioCaptureValues.js +2 -2
- package/dist/domain/browserScenarioNormalization.js +3 -3
- package/dist/domain/browserScenarioValues.js +3 -2
- package/dist/domain/callPath.js +8 -10
- package/dist/domain/canonicalDigest.js +7 -1
- package/dist/domain/canonicalJsonDigestSteps.js +34 -12
- package/dist/domain/canonicalOrdering.js +1 -13
- package/dist/domain/changedBehavior.js +2 -3
- package/dist/domain/compactStringIdentity.js +9 -0
- package/dist/domain/comparisonSemantics.js +0 -5
- package/dist/domain/digests.js +0 -3
- package/dist/domain/evidence.js +12 -6
- package/dist/domain/evidenceBundle.js +51 -33
- package/dist/domain/evidenceRecordSummary.js +144 -0
- package/dist/domain/firmware/firmwareAnalysis.js +4 -3
- package/dist/domain/functionComparison.js +2 -1
- package/dist/domain/functionComparisonNormalization.js +4 -3
- package/dist/domain/functionComparisonResults.js +2 -2
- package/dist/domain/functionDossierEvidence.js +2 -1
- package/dist/domain/hopperValues.js +11 -15
- package/dist/domain/inputIssueProjection.js +16 -1
- package/dist/domain/javascript/electronActiveObservation.js +4 -3
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +14 -15
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +20 -21
- package/dist/domain/javascript/electronStaticAnalysisNative.js +73 -41
- package/dist/domain/javascript/electronStaticAnalysisValues.js +24 -4
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +45 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +6 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +18 -14
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +4 -0
- package/dist/domain/javascript/javascriptApplicationGraph.js +91 -28
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +35 -0
- package/dist/domain/javascript/javascriptApplicationVersionComparison.js +4 -4
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +37 -22
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +72 -45
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +16 -8
- package/dist/domain/javascript/javascriptAstFingerprint.js +60 -33
- package/dist/domain/javascript/javascriptAstValues.js +54 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +50 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +3 -2
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +31 -23
- package/dist/domain/javascript/javascriptExportShapeSelection.js +2 -2
- package/dist/domain/javascript/javascriptExportShapeVariants.js +3 -2
- package/dist/domain/javascript/javascriptFeatureSeed.js +5 -3
- package/dist/domain/javascript/javascriptFeatureTrace.js +7 -6
- package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +17 -9
- package/dist/domain/javascript/javascriptFeatureTraversal.js +4 -4
- package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +12 -7
- package/dist/domain/javascript/javascriptRpcEndpoints.js +253 -0
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +1 -3
- package/dist/domain/javascript/javascriptRuntimeObservation.js +8 -5
- package/dist/domain/javascript/javascriptRuntimeReconciliation.js +12 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationActive.js +9 -8
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +212 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +12 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationInputValidation.js +28 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +5 -5
- package/dist/domain/javascript/javascriptRuntimeReconciliationParsing.js +12 -223
- package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationRuntime.js +15 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +15 -17
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +379 -30
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +9 -7
- package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +8 -1
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +2 -2
- package/dist/domain/javascript/javascriptSemanticCoverage.js +20 -0
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +7 -9
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +4 -11
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +15 -4
- package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +43 -42
- package/dist/domain/javascript/javascriptSemanticGraph.js +205 -52
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +21 -11
- package/dist/domain/javascript/javascriptSemanticIr.js +0 -4
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +139 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +774 -136
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +190 -0
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +98 -41
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +381 -0
- package/dist/domain/javascript/javascriptSemanticObjects.js +9 -7
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +7 -2
- package/dist/domain/javascript/javascriptSemanticProjection.js +72 -28
- package/dist/domain/javascript/javascriptSemanticPromises.js +15 -21
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +100 -0
- package/dist/domain/javascript/javascriptSemanticProvenance.js +3 -3
- package/dist/domain/javascript/javascriptSemanticQuery.js +33 -29
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +4 -5
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -9
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +16 -10
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +219 -0
- package/dist/domain/javascript/javascriptSemanticReturns.js +34 -48
- package/dist/domain/javascript/javascriptSemanticState.js +22 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +25 -2
- package/dist/domain/javascript/javascriptSemanticValues.js +169 -30
- package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
- package/dist/domain/javascript/javascriptSourceMapPaths.js +11 -1
- package/dist/domain/javascript/javascriptSourceParser.js +34 -9
- package/dist/domain/javascript/javascriptStaticAnalysis.js +29 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +13 -12
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +49 -5
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +8 -4
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +26 -15
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +1 -0
- package/dist/domain/javascript/sourceToBundleComparison.js +7 -5
- package/dist/domain/javascript/sourceToBundleSignals.js +7 -7
- package/dist/domain/jeb/jebAnalysis.js +114 -0
- package/dist/domain/jsonSerialization.js +109 -55
- package/dist/domain/jsonShape.js +69 -31
- package/dist/domain/jsonValue.js +3 -0
- package/dist/domain/localPath.js +10 -4
- package/dist/domain/managed/managedApplicationGraph.js +47 -6
- package/dist/domain/managed/managedApplicationGraphCoverage.js +8 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +94 -59
- package/dist/domain/managed/managedArtifact.js +1 -0
- package/dist/domain/managed/managedInspectionEvidence.js +13 -0
- package/dist/domain/managed/managedMemberComparisonMatch.js +6 -7
- package/dist/domain/native/nativeAotPe.js +1408 -0
- package/dist/domain/native/nativeCallObservation.js +2 -4
- package/dist/domain/native/nativeInstruction.js +21 -0
- package/dist/domain/native/nativeMetadataRecovery.js +79 -6
- package/dist/domain/native/nativeValueFlow.js +5 -11
- package/dist/domain/native/objcSwiftMetadata.js +15 -17
- package/dist/domain/native/peResources.js +94 -0
- package/dist/domain/nativeConvention.js +33 -0
- package/dist/domain/process/processCapture.js +102 -11
- package/dist/domain/process/processCaptureCoverage.js +8 -5
- package/dist/domain/process/processCaptureExample.js +67 -0
- package/dist/domain/process/processCaptureValidation.js +83 -3
- package/dist/domain/process/processComparison.js +0 -23
- package/dist/domain/process/processScenario.js +62 -10
- package/dist/domain/process/processTraceEvaluation.js +4 -4
- package/dist/domain/process/processTraceSpecification.js +1 -3
- package/dist/domain/propertyListKeys.js +3 -1
- package/dist/domain/providerCleanupError.js +6 -2
- package/dist/domain/reconstructionCoverage.js +2 -1
- package/dist/domain/reconstructionUnknowns.js +4 -3
- package/dist/domain/reconstructionVerification.js +3 -2
- package/dist/domain/referenceSourceGraph.js +32 -23
- package/dist/domain/referenceSourceImportParsing.js +40 -48
- package/dist/domain/referenceSourcePathIdentity.js +22 -0
- package/dist/domain/referenceSourceRequireBindings.js +137 -0
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +2 -1
- package/dist/domain/swiftSymbolClassification.js +6 -1
- package/dist/domain/symbolAnalysis.js +17 -2
- package/dist/domain/unicodeCodePointOrder.js +6 -0
- package/dist/domain/webBundleAnalyzerInspection.js +23 -3
- package/dist/domain/webCaptureDiff.js +170 -30
- package/dist/domain/webCaptureDiffSchemas.js +2 -8
- package/dist/domain/webInventory.js +3 -2
- package/dist/domain/webMcpDiscovery.js +4 -3
- package/dist/domain/webScriptExport.js +1 -1
- package/dist/domain/webScriptExportError.js +10 -4
- package/dist/domain/webScriptExportPlan.js +7 -13
- package/dist/domain/zipPackageFormat.js +4 -1
- package/dist/domain/zodCollectionSteps.js +24 -0
- package/dist/dotnet/ManagedArtifactInspector.js +55 -43
- package/dist/dotnet/ManagedDecodeBudget.js +80 -0
- package/dist/dotnet/ManagedMemberInspector.js +13 -6
- package/dist/dotnet/ManagedMemberInspectorCore.js +2 -2
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +5 -4
- package/dist/dotnet/ManagedMemberRows.js +9 -4
- package/dist/dotnet/ManagedMetadataHeaps.js +15 -5
- package/dist/dotnet/ManagedMetadataInventoryRows.js +20 -11
- package/dist/dotnet/ManagedMetadataLayout.js +10 -4
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -3
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +3 -2
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +49 -34
- package/dist/dotnet/ManagedPeReader.js +41 -25
- package/dist/dotnet/ManagedReaderFailure.js +2 -1
- package/dist/dotnet/ManagedStaticProvider.js +65 -31
- package/dist/dotnet/ManagedStaticProviderMetadata.js +1 -4
- package/dist/evaluation/AgentEvaluationReport.js +9 -5
- package/dist/evaluation/CodexAgentEval.js +43 -13
- package/dist/evm/EvmoleFailures.js +0 -2
- package/dist/evm/EvmoleInterfaceProvider.js +67 -2
- package/dist/filesystem/OwnedDirectoryHandle.js +29 -0
- package/dist/filesystem/OwnedFileHandle.js +36 -0
- package/dist/filesystem/RegularFile.js +73 -0
- package/dist/filesystem/StableFileHash.js +46 -0
- package/dist/filesystem/readFileHandleChunks.js +26 -0
- package/dist/firmware/FirmwareCommand.js +25 -3
- package/dist/firmware/FirmwareFiles.js +23 -8
- package/dist/firmware/FirmwareProvider.js +156 -32
- package/dist/firmware/FirmwarePublication.js +24 -3
- package/dist/firmware/FirmwareRelease.js +1 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +55 -4
- package/dist/ghidra/GhidraAnalysisSeeds.js +211 -0
- package/dist/ghidra/GhidraClient.js +90 -8
- package/dist/ghidra/GhidraDiagnostics.js +11 -8
- package/dist/ghidra/GhidraFunctionValues.js +26 -2
- package/dist/ghidra/GhidraInstallation.js +111 -10
- package/dist/ghidra/GhidraInventoryValues.js +23 -1
- package/dist/ghidra/GhidraLanguageCatalog.js +99 -0
- package/dist/ghidra/GhidraLauncher.js +123 -58
- package/dist/ghidra/GhidraLoadImageAttest.js +49 -2
- package/dist/ghidra/GhidraMipsProfile.js +79 -0
- package/dist/ghidra/GhidraProvider.js +57 -9
- package/dist/ghidra/GhidraProviderCapabilities.js +18 -8
- package/dist/ghidra/GhidraProviderClient.js +282 -21
- package/dist/ghidra/GhidraSessionValues.js +9 -2
- package/dist/hopper/HopperAnalysisProfile.js +2 -0
- package/dist/hopper/HopperCleanup.js +1 -1
- package/dist/hopper/HopperClient.js +15 -6
- package/dist/hopper/HopperMachOImage.js +2 -0
- package/dist/hopper/HopperProvider.js +13 -2
- package/dist/ida/IdaOperationRunner.js +10 -2
- package/dist/ida/IdaProvider.js +7 -0
- package/dist/ida/IdaSessionClient.js +7 -3
- package/dist/ida/IdaWorkspace.js +4 -2
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -5
- package/dist/inspector/V8InspectorCaptureProjection.js +46 -13
- package/dist/inspector/V8InspectorProvider.js +60 -8
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +326 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +520 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +63 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +521 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +116 -0
- package/dist/javascript/recovery/RecoveryFiles.js +18 -7
- package/dist/javascript/recovery/WakaruCommand.js +22 -9
- package/dist/javascript/recovery/WakaruExecution.js +11 -7
- package/dist/javascript/recovery/WakaruProvider.js +139 -16
- package/dist/javascript/recovery/WakaruPublication.js +14 -4
- package/dist/javascript/recovery/WakaruRelease.js +10 -3
- package/dist/javascript/recovery/WakaruReport.js +12 -7
- package/dist/javascript/recovery/WakaruVersion.js +24 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +16 -3
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +63 -7
- package/dist/javascript/sourceMaps/SourceMapFormat.js +15 -4
- package/dist/jeb/JebMcpConnection.js +179 -0
- package/dist/jeb/JebMcpEndpoint.js +40 -0
- package/dist/jeb/JebProvider.js +299 -0
- package/dist/main/shutdown.js +76 -32
- package/dist/main/transport.js +1 -1
- package/dist/mcpDoctor.js +15 -6
- package/dist/native/AppleDispatchCoverage.js +25 -12
- package/dist/native/AppleDispatchMetadata.js +14 -7
- package/dist/native/AppleMachoFixups.js +71 -15
- package/dist/native/AppleMachoSelection.js +23 -3
- package/dist/native/AppleObjcDispatchFacets.js +3 -3
- package/dist/native/AppleObjcProperties.js +17 -7
- package/dist/native/LldbCallTracer.js +241 -75
- package/dist/native/NativeMacOSProvider.js +100 -20
- package/dist/native/NativeMacOSProviderMetadata.js +1 -2
- package/dist/native/NativeMachoInspection.js +11 -7
- package/dist/native/NativeUiHelperRuntime.js +6 -1
- package/dist/native/NativeUiObservation.js +4 -3
- package/dist/native/pe/PeResourceLayout.js +120 -0
- package/dist/native/pe/PeResourceParser.js +286 -0
- package/dist/native/pe/PeResourcesProvider.js +63 -0
- package/dist/process/BoundedFileBytes.js +30 -7
- package/dist/process/DarwinProcessRunTokenReader.js +8 -3
- package/dist/process/OwnedCommand.js +4 -3
- package/dist/process/ProcessOwnership.js +104 -112
- package/dist/process/ProcessOwnershipObservation.js +104 -51
- package/dist/process/ProcessOwnershipProcessTree.js +4 -4
- package/dist/process/ProcessRunTokenObservations.js +48 -0
- package/dist/process/ProviderDiagnosticRedaction.js +17 -0
- package/dist/process/ProviderProcess.js +4 -3
- package/dist/process/capture/FilesystemSnapshot.js +116 -22
- package/dist/process/capture/ProcessCaptureLifecycle.js +363 -86
- package/dist/process/capture/ProcessCaptureProgress.js +62 -0
- package/dist/process/capture/ProcessFilesystemEffects.js +19 -4
- package/dist/process/capture/ProcessHarness.js +202 -47
- package/dist/process/capture/ProcessNormalization.js +3 -1
- package/dist/process/capture/ProcessScenarioRuntimeValidation.js +5 -2
- package/dist/process/capture/TerminalRenderer.js +24 -7
- package/dist/reference/ReferenceSourceReader.js +22 -5
- package/dist/reference/ReferenceSourceReaderEntries.js +114 -51
- package/dist/reference/ReferenceSourceReaderErrors.js +12 -0
- package/dist/reference/ReferenceSourceReaderFile.js +50 -10
- package/dist/reference/ReferenceSourceReaderValidate.js +4 -4
- package/dist/server/EvidenceMcpServer.js +36 -1
- package/dist/server/admittedToolOperation.js +9 -0
- package/dist/server/analysisAdmission.js +8 -0
- package/dist/server/contractToolHandler.js +21 -0
- package/dist/server/createServer.js +118 -47
- package/dist/server/registerAdbTools.js +36 -0
- package/dist/server/registerAnalysisViewTool.js +4 -9
- package/dist/server/registerAndroidTools.js +3 -12
- package/dist/server/registerApktoolTools.js +14 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +6 -7
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +3 -2
- package/dist/server/registerApplicationTools/coverage.js +3 -2
- package/dist/server/registerApplicationTools/helpers.js +3 -2
- package/dist/server/registerApplicationTools/obligationLedger.js +3 -2
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -2
- package/dist/server/registerApplicationTools/traceFeature.js +3 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +5 -2
- package/dist/server/registerArtifactTools.js +2 -2
- package/dist/server/registerBinaryDiagnosticsTools.js +16 -4
- package/dist/server/registerBrowserScenarioTool.js +10 -7
- package/dist/server/registerBrowserTools.js +12 -9
- package/dist/server/registerBundleComparisonTool.js +16 -2
- package/dist/server/registerCloseLifecycleTool.js +36 -5
- package/dist/server/registerElectronTools.js +28 -10
- package/dist/server/registerEnhancedTools.js +78 -73
- package/dist/server/registerEvidenceTools.js +54 -46
- package/dist/server/registerEvmTools.js +4 -9
- package/dist/server/registerFirmwareTools.js +3 -11
- package/dist/server/registerFunctionComparisonTool.js +5 -2
- package/dist/server/registerJavaScriptRecoveryTool.js +4 -9
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +9 -6
- package/dist/server/registerJebTools.js +16 -0
- package/dist/server/registerManagedTools.js +7 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +4 -6
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -2
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +3 -2
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +3 -2
- package/dist/server/registerOfficialTools.js +31 -25
- package/dist/server/registerPeResourcesTool.js +9 -0
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerRecordedCrashTools.js +4 -9
- package/dist/server/registerSessionRecordTools.js +2 -1
- package/dist/server/registerSessionTools.js +58 -21
- package/dist/server/registerWebModuleTool.js +4 -9
- package/dist/server/registerWebNetworkCaptureTool.js +4 -9
- package/dist/server/registerWebRuntimeTools.js +6 -5
- package/dist/server/registerWebScriptTool.js +6 -3
- package/dist/server/registerWebSourceLocationTool.js +4 -9
- package/dist/server/toolResult.js +21 -2
- package/dist/windows/WindowsPrivateRuntime.js +12 -5
- package/install.sh +7 -4
- package/licenses/nativeaot-parser-MIT.txt +28 -0
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +38 -7
- package/scripts/rea.mjs +16 -1
- package/skills/reverse-engineer-anything/SKILL.md +52 -51
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +92 -13
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +31 -1
- package/dist/artifacts/inventory/policy.js +0 -2
- package/dist/domain/managed/managedApplicationGraphNodeCoverage.js +0 -6
- package/dist/server/registerNativeTools.js +0 -6
|
@@ -13,7 +13,7 @@ const unobservedAbsenceReason = (path, phase, completeRoots, filesByPath) => {
|
|
|
13
13
|
}
|
|
14
14
|
return undefined;
|
|
15
15
|
};
|
|
16
|
-
/** Classify effects only
|
|
16
|
+
/** Classify effects only from observed path absence, metadata, and content hashes. */
|
|
17
17
|
export const classifyFilesystemEffects = (before, after) => {
|
|
18
18
|
const beforeByPath = new Map(before.files.map((file) => [file.path, file]));
|
|
19
19
|
const afterByPath = new Map(after.files.map((file) => [file.path, file]));
|
|
@@ -54,11 +54,26 @@ export const classifyFilesystemEffects = (before, after) => {
|
|
|
54
54
|
before: beforeFile,
|
|
55
55
|
after: null,
|
|
56
56
|
};
|
|
57
|
+
const metadataChanged = beforeFile.type !== afterFile.type ||
|
|
58
|
+
beforeFile.mode !== afterFile.mode ||
|
|
59
|
+
beforeFile.size !== afterFile.size ||
|
|
60
|
+
beforeFile.symlink_target !== afterFile.symlink_target;
|
|
61
|
+
if (!metadataChanged &&
|
|
62
|
+
beforeFile.type === "file" &&
|
|
63
|
+
afterFile.type === "file" &&
|
|
64
|
+
(beforeFile.sha256 === null || afterFile.sha256 === null))
|
|
65
|
+
return {
|
|
66
|
+
path,
|
|
67
|
+
status: "unknown",
|
|
68
|
+
before: beforeFile,
|
|
69
|
+
after: afterFile,
|
|
70
|
+
reason: "A file content hash is unavailable in at least one snapshot; matching metadata does not establish unchanged contents.",
|
|
71
|
+
};
|
|
57
72
|
return {
|
|
58
73
|
path,
|
|
59
|
-
status:
|
|
60
|
-
? "
|
|
61
|
-
: "
|
|
74
|
+
status: metadataChanged || beforeFile.sha256 !== afterFile.sha256
|
|
75
|
+
? "modified"
|
|
76
|
+
: "unchanged",
|
|
62
77
|
before: beforeFile,
|
|
63
78
|
after: afterFile,
|
|
64
79
|
};
|
|
@@ -8,12 +8,57 @@ import { snapshotRoots } from "./FilesystemSnapshot.js";
|
|
|
8
8
|
import { TerminalRenderer } from "./TerminalRenderer.js";
|
|
9
9
|
import { normalizeProcessText } from "./ProcessNormalization.js";
|
|
10
10
|
import { selectCapturedProcessGroupIds } from "../ProcessOwnershipProcessTree.js";
|
|
11
|
-
import { awaitTerminalExit, buildCaptureResult, cleanupReportFailure, captureTerminalFrames, createProcessCaptureObservationBuffer, createRunManifest, observeLaunchedExecutable, observeSelectedExecutable, observeSettlement, prepareProcessCapture, releaseProcessResources, resolveProcessResult, settleProcessCaptureJournal, } from "./ProcessCaptureLifecycle.js";
|
|
11
|
+
import { awaitTerminalExit, buildCaptureResult, cleanupReportFailure, captureTerminalFrames, createProcessCaptureObservationBuffer, createRunManifest, observeLaunchedExecutable, observeSelectedExecutable, observeSettlement, prepareProcessCapture, releaseProcessResources, resolveProcessResult, settleProcessCaptureJournal, describeUnverifiedCause, ProcessCaptureResourceScope, } from "./ProcessCaptureLifecycle.js";
|
|
12
12
|
import { assertNotCancelled, resolveProcessScenarioRuntimePaths, } from "./ProcessScenarioRuntimeValidation.js";
|
|
13
13
|
import { createProcessCaptureJournal, scheduleScenarioInteractions, } from "./ProcessCaptureJournal.js";
|
|
14
14
|
import { makeProcessCaptureEnvironment } from "./ProcessCaptureEnvironment.js";
|
|
15
15
|
import { classifyFilesystemEffects } from "./ProcessFilesystemEffects.js";
|
|
16
16
|
import { processCaptureOwnershipUnavailableReason } from "./ProcessCaptureCapability.js";
|
|
17
|
+
import { createProcessCaptureProgressTracker, } from "./ProcessCaptureProgress.js";
|
|
18
|
+
import { observeProcessStartIdentity, signalProcessWithStartIdentity, } from "../ProcessOwnershipObservation.js";
|
|
19
|
+
/** Bind the captured root's initial identity to its run token before retaining it. */
|
|
20
|
+
export const retainRootSignaller = (pid, finalizationMs, runId, host = {
|
|
21
|
+
observe: (rootPid) => observeProcessStartIdentity(rootPid, undefined, runId),
|
|
22
|
+
signal: signalProcessWithStartIdentity,
|
|
23
|
+
}) => {
|
|
24
|
+
const retained = finalizationMs > 0
|
|
25
|
+
? host.observe(pid).then((observation) => observation === undefined
|
|
26
|
+
? { state: "gone" }
|
|
27
|
+
: observation.state === "readable"
|
|
28
|
+
? {
|
|
29
|
+
state: "identity",
|
|
30
|
+
identity: observation.identity,
|
|
31
|
+
}
|
|
32
|
+
: {
|
|
33
|
+
state: "unverified",
|
|
34
|
+
reason: observation.reason.trim() === ""
|
|
35
|
+
? "start identity is unavailable without a diagnostic"
|
|
36
|
+
: observation.reason,
|
|
37
|
+
}, (cause) => ({
|
|
38
|
+
state: "unverified",
|
|
39
|
+
reason: describeUnverifiedCause(cause, "start identity inspection failed without a message"),
|
|
40
|
+
}))
|
|
41
|
+
: undefined;
|
|
42
|
+
return async (signal) => {
|
|
43
|
+
const identity = await retained;
|
|
44
|
+
if (identity === undefined)
|
|
45
|
+
return {
|
|
46
|
+
delivery: "unverified",
|
|
47
|
+
reason: "root identity was not retained",
|
|
48
|
+
};
|
|
49
|
+
if (identity.state === "unverified")
|
|
50
|
+
return { delivery: "unverified", reason: identity.reason };
|
|
51
|
+
if (identity.state === "gone")
|
|
52
|
+
return { delivery: "gone" };
|
|
53
|
+
const delivery = await host.signal(pid, identity.identity, signal);
|
|
54
|
+
return delivery === "unverified"
|
|
55
|
+
? {
|
|
56
|
+
delivery,
|
|
57
|
+
reason: "start identity could not be verified or the signal call failed",
|
|
58
|
+
}
|
|
59
|
+
: { delivery };
|
|
60
|
+
};
|
|
61
|
+
};
|
|
17
62
|
const cleanupFailedStartup = async (options) => {
|
|
18
63
|
const sampledProcessGroupIds = options.terminal !== undefined &&
|
|
19
64
|
options.observations?.process_samples.state === "available"
|
|
@@ -33,7 +78,7 @@ const cleanupFailedStartup = async (options) => {
|
|
|
33
78
|
};
|
|
34
79
|
}
|
|
35
80
|
}
|
|
36
|
-
const
|
|
81
|
+
const cleanupOptions = {
|
|
37
82
|
timers: options.timers,
|
|
38
83
|
terminal: options.terminal,
|
|
39
84
|
renderer: options.renderer,
|
|
@@ -42,9 +87,13 @@ const cleanupFailedStartup = async (options) => {
|
|
|
42
87
|
...(sampledProcessGroupIds === undefined ? {} : { sampledProcessGroupIds }),
|
|
43
88
|
temporaryRoot: options.temporaryRoot,
|
|
44
89
|
...(options.cleanupHost === undefined ? {} : { host: options.cleanupHost }),
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
90
|
+
};
|
|
91
|
+
const cleanup = options.resourceScope === undefined
|
|
92
|
+
? await releaseProcessResources(cleanupOptions)
|
|
93
|
+
: await options.resourceScope.release(cleanupOptions);
|
|
94
|
+
const cleanupFailure = cleanupReportFailure(cleanup);
|
|
95
|
+
if (cleanupFailure !== undefined) {
|
|
96
|
+
resolveProcessResult(undefined, options.cause, cleanup, options.observations, {
|
|
48
97
|
scenario: options.scenario,
|
|
49
98
|
...(options.terminal === undefined
|
|
50
99
|
? {}
|
|
@@ -115,6 +164,7 @@ const startCaptureRuntime = async (options) => {
|
|
|
115
164
|
lastOutput: () => lastOutput,
|
|
116
165
|
rawTerminalRetention,
|
|
117
166
|
stopSampler,
|
|
167
|
+
signalRoot: retainRootSignaller(terminal.pid, scenario.finalization_ms, options.runId, options.finalizationHost),
|
|
118
168
|
};
|
|
119
169
|
}
|
|
120
170
|
catch (cause) {
|
|
@@ -131,15 +181,19 @@ const startCaptureRuntime = async (options) => {
|
|
|
131
181
|
: { cleanupHost: options.cleanupHost }),
|
|
132
182
|
observations: options.observationBuffer,
|
|
133
183
|
temporaryRoot: options.temporaryRoot,
|
|
184
|
+
...(options.resourceScope === undefined
|
|
185
|
+
? {}
|
|
186
|
+
: { resourceScope: options.resourceScope }),
|
|
134
187
|
});
|
|
135
188
|
}
|
|
136
189
|
};
|
|
137
190
|
const finishProcessRun = async (options) => {
|
|
191
|
+
options.progress.closeLive();
|
|
138
192
|
await options.stopSampler();
|
|
139
193
|
const sampledProcessGroupIds = options.runtime === undefined
|
|
140
194
|
? undefined
|
|
141
195
|
: selectCapturedProcessGroupIds(options.runtime.terminal.pid, options.samples).filter((groupId) => groupId !== options.runtime?.terminal.pid);
|
|
142
|
-
const
|
|
196
|
+
const cleanupOptions = {
|
|
143
197
|
timers: options.timers,
|
|
144
198
|
terminal: options.runtime?.terminal,
|
|
145
199
|
renderer: options.runtime?.renderer,
|
|
@@ -148,6 +202,19 @@ const finishProcessRun = async (options) => {
|
|
|
148
202
|
...(sampledProcessGroupIds === undefined ? {} : { sampledProcessGroupIds }),
|
|
149
203
|
temporaryRoot: options.temporaryRoot,
|
|
150
204
|
...(options.cleanupHost === undefined ? {} : { host: options.cleanupHost }),
|
|
205
|
+
};
|
|
206
|
+
const cleanup = options.resourceScope === undefined
|
|
207
|
+
? await releaseProcessResources(cleanupOptions)
|
|
208
|
+
: await options.resourceScope.release(cleanupOptions);
|
|
209
|
+
const observedExit = options.observations?.exit.state === "available"
|
|
210
|
+
? options.observations.exit.value.reason
|
|
211
|
+
: options.capture?.exit.reason;
|
|
212
|
+
await options.progress.report({
|
|
213
|
+
phase: "cleanup",
|
|
214
|
+
counts: options.progressCounts(),
|
|
215
|
+
terminal: true,
|
|
216
|
+
disposition: captureProgressDisposition(observedExit, options.executionFailure),
|
|
217
|
+
cleanup,
|
|
151
218
|
});
|
|
152
219
|
const cleanupFailure = cleanupReportFailure(cleanup);
|
|
153
220
|
let { capture, executionFailure } = options;
|
|
@@ -185,7 +252,7 @@ const completeCapture = async (options) => {
|
|
|
185
252
|
throw processCaptureCancelled();
|
|
186
253
|
let settlement;
|
|
187
254
|
try {
|
|
188
|
-
settlement = await observeSettlement(options.runId, selectCapturedProcessGroupIds(runtime.terminal.pid, options.samples), scenario.settle_ms, options.recordEvent, options.hostPlatform, options.signal);
|
|
255
|
+
settlement = await observeSettlement(options.runId, selectCapturedProcessGroupIds(runtime.terminal.pid, options.samples), scenario.settle_ms, options.recordEvent, options.hostPlatform, options.signal, options.onLiveProgress);
|
|
189
256
|
}
|
|
190
257
|
catch (cause) {
|
|
191
258
|
options.observationBuffer.settlement = {
|
|
@@ -220,7 +287,7 @@ const completeCapture = async (options) => {
|
|
|
220
287
|
...options.observationBuffer.filesystem_snapshots,
|
|
221
288
|
after: {
|
|
222
289
|
state: "available",
|
|
223
|
-
value:
|
|
290
|
+
value: after,
|
|
224
291
|
},
|
|
225
292
|
};
|
|
226
293
|
options.recordEvent("filesystem_checkpoints", 1);
|
|
@@ -267,31 +334,19 @@ const completeCapture = async (options) => {
|
|
|
267
334
|
throw cause;
|
|
268
335
|
}
|
|
269
336
|
options.observationBuffer.manifest = { state: "available", value: manifest };
|
|
270
|
-
const truncated = options.initiallyTruncated ||
|
|
271
|
-
after.truncated ||
|
|
272
|
-
runtime.rawTerminalRetention().observed_frames >
|
|
273
|
-
runtime.rawTerminalRetention().retained_frames ||
|
|
274
|
-
checkpoints.some(({ truncated: partial }) => partial) ||
|
|
275
|
-
samplingPartial ||
|
|
276
|
-
runtime.renderer.truncated();
|
|
277
337
|
return buildCaptureResult({
|
|
278
338
|
frames: options.frames,
|
|
279
339
|
exit: { ...options.exit, reason },
|
|
280
340
|
samples: options.samples,
|
|
281
341
|
before: options.before,
|
|
282
342
|
after,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
:
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
filesystem_before: options.before.coverage,
|
|
291
|
-
filesystem_after: after.coverage,
|
|
292
|
-
process: sampling.coverage,
|
|
293
|
-
},
|
|
294
|
-
}),
|
|
343
|
+
truncationDetails: {
|
|
344
|
+
raw_terminal: runtime.rawTerminalRetention(),
|
|
345
|
+
rendered_terminal: runtime.renderer.retention(),
|
|
346
|
+
filesystem_before: options.before.coverage,
|
|
347
|
+
filesystem_after: after.coverage,
|
|
348
|
+
process: sampling.coverage,
|
|
349
|
+
},
|
|
295
350
|
scenario,
|
|
296
351
|
rootPid: runtime.terminal.pid,
|
|
297
352
|
samplingPartial,
|
|
@@ -303,12 +358,56 @@ const completeCapture = async (options) => {
|
|
|
303
358
|
eventJournal: options.eventJournal,
|
|
304
359
|
});
|
|
305
360
|
};
|
|
361
|
+
const captureProgressDisposition = (exitReason, executionFailure) => {
|
|
362
|
+
if (exitReason === "exited" ||
|
|
363
|
+
exitReason === "timeout" ||
|
|
364
|
+
exitReason === "idle_timeout" ||
|
|
365
|
+
exitReason === "cancelled")
|
|
366
|
+
return exitReason;
|
|
367
|
+
if (executionFailure instanceof ProcessCaptureError &&
|
|
368
|
+
executionFailure.reason === "cancelled")
|
|
369
|
+
return "cancelled";
|
|
370
|
+
return "failed";
|
|
371
|
+
};
|
|
306
372
|
/** Execute one caller-selected scenario and return bounded observations. */
|
|
307
|
-
const runProcessScenario = async (scenario, signal, hostEnvironment = process.env, hostPlatform = process.platform, captureSnapshot = snapshotRoots, cleanupHost) => {
|
|
308
|
-
const
|
|
373
|
+
const runProcessScenario = async (scenario, signal, hostEnvironment = process.env, hostPlatform = process.platform, captureSnapshot = snapshotRoots, cleanupHost, progress, resourceScope, finalizationHost) => {
|
|
374
|
+
const progressTracker = createProcessCaptureProgressTracker(progress);
|
|
309
375
|
const frames = [];
|
|
310
376
|
const samples = [];
|
|
311
377
|
const interactions = [];
|
|
378
|
+
const progressCounts = () => ({
|
|
379
|
+
frames: frames.length,
|
|
380
|
+
samples: samples.length,
|
|
381
|
+
interactions: interactions.length,
|
|
382
|
+
});
|
|
383
|
+
const reportRunning = () => {
|
|
384
|
+
void progressTracker.report({ phase: "running", counts: progressCounts() });
|
|
385
|
+
};
|
|
386
|
+
const reportSettling = () => {
|
|
387
|
+
void progressTracker.report({
|
|
388
|
+
phase: "settling",
|
|
389
|
+
counts: progressCounts(),
|
|
390
|
+
});
|
|
391
|
+
};
|
|
392
|
+
let prepared;
|
|
393
|
+
try {
|
|
394
|
+
await progressTracker.report({
|
|
395
|
+
phase: "prepare",
|
|
396
|
+
counts: progressCounts(),
|
|
397
|
+
});
|
|
398
|
+
prepared = await prepareProcessCapture(scenario, signal, captureSnapshot, undefined, resourceScope);
|
|
399
|
+
}
|
|
400
|
+
catch (cause) {
|
|
401
|
+
progressTracker.closeLive();
|
|
402
|
+
await progressTracker.report({
|
|
403
|
+
phase: "cleanup",
|
|
404
|
+
counts: progressCounts(),
|
|
405
|
+
terminal: true,
|
|
406
|
+
disposition: signal?.aborted === true ? "cancelled" : "failed",
|
|
407
|
+
});
|
|
408
|
+
throw cause;
|
|
409
|
+
}
|
|
410
|
+
const { temporaryRoot, runId, ownershipBaseline, before } = prepared;
|
|
312
411
|
const journal = createProcessCaptureJournal();
|
|
313
412
|
const { entries: eventJournal, recordEvent } = journal;
|
|
314
413
|
recordEvent("filesystem_checkpoints", 0);
|
|
@@ -318,6 +417,7 @@ const runProcessScenario = async (scenario, signal, hostEnvironment = process.en
|
|
|
318
417
|
samples,
|
|
319
418
|
eventJournal,
|
|
320
419
|
before,
|
|
420
|
+
finalizationEnabled: scenario.finalization_ms > 0,
|
|
321
421
|
});
|
|
322
422
|
let runtime;
|
|
323
423
|
let actualRootPid;
|
|
@@ -334,6 +434,7 @@ const runProcessScenario = async (scenario, signal, hostEnvironment = process.en
|
|
|
334
434
|
runId,
|
|
335
435
|
ownershipBaseline,
|
|
336
436
|
...(cleanupHost === undefined ? {} : { cleanupHost }),
|
|
437
|
+
...(resourceScope === undefined ? {} : { resourceScope }),
|
|
337
438
|
observationBuffer: observations,
|
|
338
439
|
onSpawn: (pid) => {
|
|
339
440
|
actualRootPid = pid;
|
|
@@ -345,6 +446,7 @@ const runProcessScenario = async (scenario, signal, hostEnvironment = process.en
|
|
|
345
446
|
dispatchedEventIndexes,
|
|
346
447
|
recordEvent,
|
|
347
448
|
...(signal === undefined ? {} : { signal }),
|
|
449
|
+
...(finalizationHost === undefined ? {} : { finalizationHost }),
|
|
348
450
|
});
|
|
349
451
|
stopSampler = runtime.stopSampler;
|
|
350
452
|
const exit = await awaitTerminalExit({
|
|
@@ -353,17 +455,43 @@ const runProcessScenario = async (scenario, signal, hostEnvironment = process.en
|
|
|
353
455
|
started: runtime.started,
|
|
354
456
|
lastOutput: runtime.lastOutput,
|
|
355
457
|
signal,
|
|
458
|
+
signalTarget: runtime.signalRoot,
|
|
459
|
+
recordFinalization: (finalization) => {
|
|
460
|
+
observations.finalization = { state: "available", value: finalization };
|
|
461
|
+
},
|
|
356
462
|
timers,
|
|
357
463
|
interactions,
|
|
358
464
|
dispatchedEventIndexes,
|
|
359
465
|
recordEvent,
|
|
466
|
+
...(progress === undefined ? {} : { onLiveProgress: reportRunning }),
|
|
360
467
|
});
|
|
468
|
+
if (exit.unobserved === true) {
|
|
469
|
+
observations.finalization = {
|
|
470
|
+
state: "available",
|
|
471
|
+
value: exit.finalization,
|
|
472
|
+
};
|
|
473
|
+
observations.exit = {
|
|
474
|
+
state: "unavailable",
|
|
475
|
+
reason: `The captured process exit was not observed because the finalization SIGKILL could not be delivered (initiating reason: ${exit.reason}).`,
|
|
476
|
+
};
|
|
477
|
+
if (exit.reason === "cancelled")
|
|
478
|
+
throw processCaptureCancelled();
|
|
479
|
+
throw new Error("The captured process exit was not observed because the finalization SIGKILL could not be delivered.");
|
|
480
|
+
}
|
|
481
|
+
if (exit.finalization !== undefined)
|
|
482
|
+
observations.finalization = {
|
|
483
|
+
state: "available",
|
|
484
|
+
value: exit.finalization,
|
|
485
|
+
};
|
|
361
486
|
observations.exit = {
|
|
362
487
|
state: "available",
|
|
363
488
|
value: {
|
|
364
489
|
code: exit.reason === "exited" && exit.exitCode >= 0 ? exit.exitCode : null,
|
|
365
490
|
signal: exit.signal ?? null,
|
|
366
491
|
reason: exit.reason,
|
|
492
|
+
...(exit.finalization === undefined
|
|
493
|
+
? {}
|
|
494
|
+
: { finalization: exit.finalization }),
|
|
367
495
|
},
|
|
368
496
|
};
|
|
369
497
|
capture = await completeCapture({
|
|
@@ -377,12 +505,12 @@ const runProcessScenario = async (scenario, signal, hostEnvironment = process.en
|
|
|
377
505
|
samples,
|
|
378
506
|
interactions,
|
|
379
507
|
exit,
|
|
380
|
-
initiallyTruncated: before.truncated,
|
|
381
508
|
eventJournal,
|
|
382
509
|
observationBuffer: observations,
|
|
383
510
|
recordEvent,
|
|
384
511
|
captureSnapshot,
|
|
385
512
|
...(signal === undefined ? {} : { signal }),
|
|
513
|
+
...(progress === undefined ? {} : { onLiveProgress: reportSettling }),
|
|
386
514
|
});
|
|
387
515
|
}
|
|
388
516
|
catch (cause) {
|
|
@@ -421,28 +549,55 @@ const runProcessScenario = async (scenario, signal, hostEnvironment = process.en
|
|
|
421
549
|
executionFailure,
|
|
422
550
|
observations,
|
|
423
551
|
...(actualRootPid === undefined ? {} : { rootPid: actualRootPid }),
|
|
552
|
+
progress: progressTracker,
|
|
553
|
+
progressCounts,
|
|
554
|
+
...(resourceScope === undefined ? {} : { resourceScope }),
|
|
424
555
|
});
|
|
425
556
|
};
|
|
426
557
|
/** Execute one scenario through a typed expected-failure channel. */
|
|
427
|
-
export const captureProcessScenario = async (scenario, signal, platform = process.platform, environment = process.env, captureSnapshot
|
|
558
|
+
export const captureProcessScenario = async (scenario, signal, platform = process.platform, environment = process.env, captureSnapshot, cleanupHost, progress, resourceScope, finalizationHost) => {
|
|
428
559
|
const ownershipReason = processCaptureOwnershipUnavailableReason(platform);
|
|
429
560
|
if (ownershipReason !== undefined)
|
|
430
561
|
return err(new AnalysisCapabilityUnavailableError("rea-process", "capture_process_scenario", ownershipReason, { userMessage: ownershipReason }));
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
562
|
+
const runResourceScope = resourceScope ?? new ProcessCaptureResourceScope();
|
|
563
|
+
const execute = async () => {
|
|
564
|
+
try {
|
|
565
|
+
assertNotCancelled(signal);
|
|
566
|
+
const resolvedScenario = await resolveProcessScenarioRuntimePaths(scenario, environment);
|
|
567
|
+
const capture = await runProcessScenario(resolvedScenario, signal, environment, platform, captureSnapshot ?? snapshotRoots, cleanupHost, progress, runResourceScope, finalizationHost);
|
|
568
|
+
return ok(capture);
|
|
569
|
+
}
|
|
570
|
+
catch (cause) {
|
|
571
|
+
const failure = normalizeCaptureFailure(cause, signal);
|
|
572
|
+
const executionFailureReason = describeProcessCaptureExecutionFailure(cause);
|
|
573
|
+
return err(failure instanceof ProcessCaptureError
|
|
574
|
+
? failure
|
|
575
|
+
: new ProcessCaptureError("process capture failed", {
|
|
576
|
+
cause,
|
|
577
|
+
...(executionFailureReason === undefined
|
|
578
|
+
? {}
|
|
579
|
+
: { executionFailure: executionFailureReason }),
|
|
580
|
+
}));
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
if (resourceScope !== undefined) {
|
|
584
|
+
try {
|
|
585
|
+
return await resourceScope.run(execute);
|
|
586
|
+
}
|
|
587
|
+
catch (cause) {
|
|
588
|
+
const failure = normalizeCaptureFailure(cause, signal);
|
|
589
|
+
const executionFailure = describeProcessCaptureExecutionFailure(cause);
|
|
590
|
+
return err(failure instanceof ProcessCaptureError
|
|
591
|
+
? failure
|
|
592
|
+
: new ProcessCaptureError("process capture lifecycle failed", {
|
|
593
|
+
cause,
|
|
594
|
+
reason: "cleanup_incomplete",
|
|
595
|
+
cleanupResources: ["process_capture_lifecycle"],
|
|
596
|
+
...(executionFailure === undefined ? {} : { executionFailure }),
|
|
597
|
+
}));
|
|
598
|
+
}
|
|
447
599
|
}
|
|
600
|
+
const capture = await runResourceScope.run(execute);
|
|
601
|
+
await runResourceScope.close().catch(() => undefined);
|
|
602
|
+
return capture;
|
|
448
603
|
};
|
|
@@ -15,8 +15,10 @@ export const normalizeProcessText = (value, scenario, temporaryRoot, pid) => {
|
|
|
15
15
|
normalized = normalizePortTokens(normalized);
|
|
16
16
|
if (scenario.normalization.pids)
|
|
17
17
|
normalized = normalizePidTokens(normalized, [pid]);
|
|
18
|
+
// A callback keeps replacement text literal while preserving replaceAll's
|
|
19
|
+
// empty-pattern boundaries, which the process scenario contract permits.
|
|
18
20
|
for (const pattern of scenario.normalization.patterns)
|
|
19
|
-
normalized = normalized.replaceAll(pattern.pattern, pattern.replacement);
|
|
21
|
+
normalized = normalized.replaceAll(pattern.pattern, () => pattern.replacement);
|
|
20
22
|
return normalized;
|
|
21
23
|
};
|
|
22
24
|
// A port may end a sentence, but a period followed by a letter, digit, or
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { access, realpath, stat } from "node:fs/promises";
|
|
2
2
|
import { constants as fsConstants } from "node:fs";
|
|
3
3
|
import { delimiter, isAbsolute, join, resolve } from "node:path";
|
|
4
|
+
import { snapshotEnvironment } from "../snapshotEnvironment.js";
|
|
4
5
|
import { ProcessCaptureError, processCaptureCancelled, } from "./ProcessCaptureError.js";
|
|
5
6
|
/** Resolve caller-selected executable and observation paths for this execution. */
|
|
6
|
-
export const resolveProcessScenarioRuntimePaths = async (scenario, environment = process.env) => {
|
|
7
|
+
export const resolveProcessScenarioRuntimePaths = async (scenario, environment = process.env, platform = process.platform) => {
|
|
7
8
|
const selectedWorkingDirectory = resolve(scenario.working_directory);
|
|
8
9
|
let workingDirectory;
|
|
9
10
|
try {
|
|
@@ -21,7 +22,9 @@ export const resolveProcessScenarioRuntimePaths = async (scenario, environment =
|
|
|
21
22
|
}
|
|
22
23
|
if (!workingDirectoryStat.isDirectory())
|
|
23
24
|
throw new ProcessCaptureError(`working directory is not a directory: ${workingDirectory}`);
|
|
24
|
-
const executable = await resolveExecutable(scenario.executable, workingDirectory, scenario.environment
|
|
25
|
+
const executable = await resolveExecutable(scenario.executable, workingDirectory, snapshotEnvironment(scenario.environment, platform).PATH ??
|
|
26
|
+
snapshotEnvironment(environment, platform).PATH ??
|
|
27
|
+
"");
|
|
25
28
|
const observationPaths = scenario.filesystem_observation_paths.map((path) => resolve(workingDirectory, path));
|
|
26
29
|
return {
|
|
27
30
|
...scenario,
|
|
@@ -4,6 +4,7 @@ const require = createRequire(import.meta.url);
|
|
|
4
4
|
const HeadlessPackage = require("@xterm/headless");
|
|
5
5
|
// SAFETY: the addon package is pinned with the compatible headless xterm release.
|
|
6
6
|
const SerializePackage = require("@xterm/addon-serialize");
|
|
7
|
+
const TRAILING_SPACES = / +$/u;
|
|
7
8
|
/**
|
|
8
9
|
* Owns one headless terminal and serializes writes into deterministic frames.
|
|
9
10
|
* Reconstructs bounded terminal states while raw PTY chunks remain authoritative.
|
|
@@ -34,16 +35,21 @@ export class TerminalRenderer {
|
|
|
34
35
|
}
|
|
35
36
|
/** Queue one PTY chunk and capture state only after xterm has parsed it. */
|
|
36
37
|
write(data, atMs) {
|
|
37
|
-
this.#
|
|
38
|
+
this.#queue(() => new Promise((resolveWrite, rejectWrite) => {
|
|
38
39
|
this.#terminal.write(data, () => {
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
try {
|
|
41
|
+
this.#capture(atMs);
|
|
42
|
+
resolveWrite();
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
rejectWrite(error);
|
|
46
|
+
}
|
|
41
47
|
});
|
|
42
48
|
}));
|
|
43
49
|
}
|
|
44
50
|
/** Queue a terminal resize after every preceding write. */
|
|
45
51
|
resize(columns, rows, atMs) {
|
|
46
|
-
this.#
|
|
52
|
+
this.#queue(() => {
|
|
47
53
|
this.#terminal.resize(columns, rows);
|
|
48
54
|
this.#capture(atMs);
|
|
49
55
|
});
|
|
@@ -69,16 +75,27 @@ export class TerminalRenderer {
|
|
|
69
75
|
}
|
|
70
76
|
/** Release addon and terminal resources after all writes settle. */
|
|
71
77
|
async dispose() {
|
|
72
|
-
|
|
73
|
-
this.#
|
|
78
|
+
// frames() owns observation failures; cleanup reports only disposal failures.
|
|
79
|
+
await this.#pending.catch(() => undefined);
|
|
80
|
+
// xterm owns and disposes every addon loaded through loadAddon().
|
|
74
81
|
this.#terminal.dispose();
|
|
75
82
|
}
|
|
83
|
+
#queue(operation) {
|
|
84
|
+
this.#pending = this.#pending.then(operation);
|
|
85
|
+
// PTY callbacks can fail before capture completion awaits frames(). Keep
|
|
86
|
+
// the original rejection observable there without an unhandled rejection.
|
|
87
|
+
void this.#pending.catch(() => undefined);
|
|
88
|
+
}
|
|
76
89
|
#capture(atMs) {
|
|
77
90
|
const buffer = this.#terminal.buffer.active;
|
|
78
91
|
const lines = [];
|
|
79
92
|
for (let row = 0; row < this.#terminal.rows; row += 1) {
|
|
80
93
|
const line = buffer.getLine(buffer.viewportY + row);
|
|
81
|
-
|
|
94
|
+
// Trailing blank cells carry no information beyond `columns`; dropping
|
|
95
|
+
// them keeps sparse screens from costing a full row per blank line.
|
|
96
|
+
lines.push(this.options
|
|
97
|
+
.normalize((line?.translateToString(false, 0, this.#terminal.cols) ?? "").padEnd(this.#terminal.cols, " "))
|
|
98
|
+
.replace(TRAILING_SPACES, ""));
|
|
82
99
|
}
|
|
83
100
|
const serializedState = this.options.normalize(this.#serializeAddon.serialize());
|
|
84
101
|
const bytes = Buffer.byteLength(serializedState) +
|
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
import { compareUnicodeCodePoints } from "../domain/unicodeCodePointOrder.js";
|
|
2
2
|
import { err, ok } from "../domain/result.js";
|
|
3
|
+
import { ArtifactReaderFailure } from "../artifacts/ArtifactReader.js";
|
|
3
4
|
import { traverseDirectory } from "./ReferenceSourceReaderEntries.js";
|
|
4
5
|
import {} from "./ReferenceSourceReaderTypes.js";
|
|
5
6
|
import { isAborted, noFollowOpenSupported, prepareRoot, } from "./ReferenceSourceReaderValidate.js";
|
|
6
7
|
const PATH_RACE_LIMITATION = "Path identity is revalidated around operations; Node lacks portable descriptor-relative openat traversal, so a syscall-boundary pathname race remains.";
|
|
7
8
|
/** Read a source tree without intentionally following symbolic links. */
|
|
8
|
-
export const readReferenceSource = async (root, options = {}) => {
|
|
9
|
+
export const readReferenceSource = async (root, resources, options = {}) => {
|
|
10
|
+
try {
|
|
11
|
+
return await resources.run(() => readSource(root, resources, options));
|
|
12
|
+
}
|
|
13
|
+
catch (cause) {
|
|
14
|
+
if (!(cause instanceof ArtifactReaderFailure))
|
|
15
|
+
throw cause;
|
|
16
|
+
return err({
|
|
17
|
+
tag: "reference-source-reader",
|
|
18
|
+
code: cause.reason === "cancelled" ? "cancelled" : "io",
|
|
19
|
+
message: cause.message,
|
|
20
|
+
...(cause.cleanup === undefined ? {} : { cleanup: cause.cleanup }),
|
|
21
|
+
cause,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const readSource = async (root, resources, options) => {
|
|
9
26
|
if (!noFollowOpenSupported())
|
|
10
27
|
return err({
|
|
11
28
|
tag: "reference-source-reader",
|
|
@@ -17,6 +34,7 @@ export const readReferenceSource = async (root, options = {}) => {
|
|
|
17
34
|
return prepared;
|
|
18
35
|
const { canonicalRoot, rootIdentity } = prepared.value;
|
|
19
36
|
const state = {
|
|
37
|
+
resources,
|
|
20
38
|
root: canonicalRoot,
|
|
21
39
|
rootIdentity,
|
|
22
40
|
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
@@ -28,15 +46,14 @@ export const readReferenceSource = async (root, options = {}) => {
|
|
|
28
46
|
bytesRead: 0,
|
|
29
47
|
};
|
|
30
48
|
const traversal = await traverse(state);
|
|
31
|
-
if (!traversal.ok)
|
|
32
|
-
return traversal;
|
|
33
49
|
state.entries.sort((left, right) => compareUnicodeCodePoints(left.path, right.path));
|
|
34
|
-
|
|
50
|
+
const read = {
|
|
35
51
|
root: canonicalRoot,
|
|
36
52
|
entries: state.entries,
|
|
37
53
|
bytesRead: state.bytesRead,
|
|
38
54
|
limitations: [PATH_RACE_LIMITATION],
|
|
39
|
-
}
|
|
55
|
+
};
|
|
56
|
+
return traversal.ok ? ok(read) : err({ ...traversal.error, partial: read });
|
|
40
57
|
};
|
|
41
58
|
const traverse = async (state) => {
|
|
42
59
|
while (state.pending.length > 0) {
|