rea-agents 3.2.1 → 4.0.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 +183 -332
- package/bridge/ghidra/ReaGhidraBridge.java +561 -74
- package/bridge/hopper_bridge.py +70 -27
- package/bridge/native/ReaNativeUI.swift +157 -0
- package/dist/application/AnalysisContextQueries.js +19 -5
- package/dist/application/AnalysisSnapshotCache.js +30 -11
- package/dist/application/AppleAssetCatalogAnalysis.js +171 -0
- package/dist/application/ArtifactExtractionDestination.js +0 -12
- package/dist/application/ArtifactGraphConstruction.js +44 -11
- package/dist/application/ArtifactInventory/classify.js +7 -15
- package/dist/application/ArtifactInventory/hash.js +4 -2
- package/dist/application/ArtifactInventory/policy.js +2 -17
- package/dist/application/ArtifactInventory/reader.js +3 -3
- package/dist/application/ArtifactInventory/scanCanonical.js +2 -2
- package/dist/application/ArtifactInventory/scanReader.js +12 -4
- package/dist/application/ArtifactInventory/types.js +0 -3
- package/dist/application/BinarySession.js +28 -43
- package/dist/application/BinarySessionExecution.js +37 -1
- package/dist/application/BinaryTargetResolver.js +50 -4
- package/dist/application/BrowserEvidence.js +36 -7
- package/dist/application/BrowserObservationService.js +17 -44
- package/dist/application/BrowserScenarioCaptureService.js +2 -35
- package/dist/application/BrowserScenarioEvidence.js +13 -9
- package/dist/application/CapabilityClientRequirements.js +2 -11
- package/dist/application/CapabilityInventory.js +21 -35
- package/dist/application/ClientConfigurationDocument.js +84 -7
- package/dist/application/ClientRegistrationIdentity.js +32 -0
- package/dist/application/ClientRegistrationStatus.js +59 -6
- package/dist/application/DirectAnalysis.js +37 -58
- package/dist/application/DirectAnalysisStatus.js +4 -4
- package/dist/application/Doctor.js +89 -80
- package/dist/application/DoctorDiagnostics.js +2 -26
- package/dist/application/DoctorScope.js +8 -14
- package/dist/application/ElectronActiveEvidence.js +10 -27
- package/dist/application/ElectronActiveObservationService.js +9 -36
- package/dist/application/ElectronBoundaryAnalysis.js +2 -0
- package/dist/application/ElectronBoundaryGraphNative.js +1 -1
- package/dist/application/ElectronEvidence.js +8 -3
- package/dist/application/ElectronObservationService.js +9 -25
- package/dist/application/EnhancedLiteralTracing.js +4 -8
- package/dist/application/EnhancedTools.js +15 -35
- package/dist/application/FilesystemSnapshot.js +7 -8
- package/dist/application/JavaScriptApplicationEvidenceGraph.js +2 -1
- package/dist/application/JavaScriptApplicationWorkflowService.js +31 -7
- package/dist/application/JavaScriptArtifactAnalysis.js +6 -4
- package/dist/application/JavaScriptArtifactFiles.js +5 -0
- package/dist/application/JavaScriptArtifactPathResolution.js +179 -47
- package/dist/application/JavaScriptRuntimeObservationEvidence.js +6 -3
- package/dist/application/JavaScriptRuntimeObservationService.js +9 -25
- package/dist/application/JavaScriptRuntimeReconciliationService.js +45 -4
- package/dist/application/JavaScriptSemanticGraphAsyncProjection.js +11 -0
- package/dist/application/JavaScriptSemanticGraphChildProcessProjection.js +11 -0
- package/dist/application/JavaScriptSemanticGraphDataProjection.js +11 -0
- package/dist/application/JavaScriptSemanticGraphFlowProjection.js +14 -5
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LazyAnalysisProvider.js +27 -6
- package/dist/application/ManagedMemberComparisonService.js +19 -6
- package/dist/application/NativeApiInspection.js +2 -0
- package/dist/application/NativeCallRoutes.js +72 -0
- package/dist/application/NativeDispatchMetadataInspection.js +33 -0
- package/dist/application/NativeUiActionTrace.js +73 -49
- package/dist/application/NativeValueTrace.js +320 -0
- package/dist/application/ProcessCaptureCapability.js +32 -5
- package/dist/application/ProcessCaptureEnvironment.js +9 -26
- package/dist/application/ProcessCaptureError.js +1 -5
- package/dist/application/ProcessCaptureJournal.js +3 -40
- package/dist/application/ProcessCaptureLifecycle.js +102 -111
- package/dist/application/ProcessCli.js +18 -25
- package/dist/application/ProcessEvidence.js +5 -7
- package/dist/application/ProcessFilesystemEffects.js +36 -0
- package/dist/application/ProcessHarness.js +41 -120
- package/dist/application/ProcessNormalization.js +2 -17
- package/dist/application/ProcessScenarioRuntimeValidation.js +76 -0
- package/dist/application/ReferenceSourceImport.js +3 -4
- package/dist/application/Setup.js +236 -84
- package/dist/application/SetupClientConfiguration.js +14 -9
- package/dist/application/SetupPlan.js +138 -86
- package/dist/application/SetupSkill.js +0 -1
- package/dist/application/SupportedClients.js +102 -21
- package/dist/application/Uninstall.js +31 -20
- package/dist/application/Update.js +93 -0
- package/dist/application/UpdateMaintenance.js +108 -0
- package/dist/application/UpdateRuntime.js +126 -0
- package/dist/application/runtime.js +13 -2
- package/dist/artifacts/ArtifactPaths.js +6 -8
- package/dist/artifacts/ArtifactProvider.js +94 -41
- package/dist/artifacts/AsarArtifactReader.js +19 -4
- package/dist/artifacts/KeyedArchiveReader.js +110 -0
- package/dist/artifacts/MachOSliceArtifactReader.js +53 -5
- package/dist/artifacts/ZipArtifactReader.js +18 -1
- package/dist/browser/BrowserScenarioSecrets.js +28 -1
- package/dist/browser/CdpBrowserProvider.js +36 -15
- package/dist/browser/CdpCaptureDocuments.js +22 -8
- package/dist/browser/CdpCaptureEventHandlers.js +14 -5
- package/dist/browser/CdpCaptureEventHelpers.js +13 -0
- package/dist/browser/CdpCaptureEvents.js +10 -1
- package/dist/browser/CdpElectronInspection.js +5 -10
- package/dist/browser/CdpElectronProvider.js +1 -5
- package/dist/browser/CdpElectronScripts.js +1 -1
- package/dist/browser/CdpEndpoint.js +3 -2
- package/dist/browser/CdpObservationSession.js +14 -10
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpPageCaptureScripts.js +1 -1
- package/dist/browser/CdpSafeMetadata.js +5 -4
- package/dist/browser/CdpScreenshot.js +16 -5
- package/dist/browser/CdpTargetSession.js +25 -4
- package/dist/browser/CdpWebMcpDiscovery.js +93 -20
- package/dist/browser/JavaScriptRuntimeScope.js +28 -2
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +9 -8
- package/dist/browser/PlaywrightElectronActiveActions.js +3 -10
- package/dist/browser/PlaywrightElectronActiveProvider.js +5 -5
- package/dist/browser/PlaywrightScenarioActions.js +1 -1
- package/dist/browser/PlaywrightScenarioArtifacts.js +13 -25
- package/dist/browser/PlaywrightScenarioBrowser.js +28 -25
- package/dist/browser/PlaywrightScenarioEvents.js +82 -93
- package/dist/browser/PlaywrightScenarioSession.js +27 -123
- package/dist/browser/PngVisualDiff.js +22 -3
- package/dist/browser/V8InspectorCaptureProjection.js +7 -1
- package/dist/browser/V8InspectorProvider.js +60 -7
- package/dist/browser/WebSourceMapFetcher.js +99 -53
- package/dist/cli/artifactCommands.js +56 -12
- package/dist/cli/coreAnalysisCommands.js +110 -0
- package/dist/cli/managedCommands.js +1 -31
- package/dist/cli/setupCommands.js +16 -14
- package/dist/cli/utilityCommands.js +61 -4
- package/dist/cli.js +5 -7
- package/dist/cliApplicationCommands.js +0 -83
- package/dist/cliBrowserAdvancedCommands.js +7 -11
- package/dist/cliBrowserCommands.js +15 -23
- package/dist/cliBrowserContext.js +3 -24
- package/dist/cliBrowserScenarioCommands.js +2 -10
- package/dist/cliCommandNames.js +82 -7
- package/dist/cliElectronCommands.js +10 -36
- package/dist/cliJavaScriptRuntimeCommands.js +6 -30
- package/dist/cliJsonInput.js +4 -2
- package/dist/cliLogging.js +16 -7
- package/dist/cliObservationOptions.js +1 -1
- package/dist/cliOutput.js +2 -4
- package/dist/cliProcessCommands.js +6 -33
- package/dist/cliSetup.js +90 -160
- package/dist/config/environment.js +2 -78
- package/dist/config/parseConfig.js +18 -109
- package/dist/config/parsers.js +0 -23
- package/dist/contracts/applicationToolContracts.js +1 -118
- package/dist/contracts/artifactToolContracts.js +11 -19
- package/dist/contracts/browserScenarioToolContracts.js +1 -5
- package/dist/contracts/browserToolContracts.js +9 -16
- package/dist/contracts/electronToolContracts.js +5 -6
- package/dist/contracts/enhancedInputs.js +3 -2
- package/dist/contracts/errorSchemas.js +16 -40
- package/dist/contracts/functionWorkflowToolContracts.js +2 -2
- package/dist/contracts/javascriptApplicationWorkflowExamples.js +2 -2
- package/dist/contracts/javascriptRuntimeObservationToolContracts.js +4 -4
- package/dist/contracts/javascriptRuntimeReconciliationExample.js +1 -1
- package/dist/contracts/managedToolContracts.js +7 -4
- package/dist/contracts/managedWorkflowExamples.js +0 -22
- package/dist/contracts/managedWorkflowToolContracts.js +16 -31
- package/dist/contracts/nativeToolContracts.js +9 -0
- package/dist/contracts/promptContracts.js +6 -6
- package/dist/contracts/sessionToolSchemas.js +3 -3
- package/dist/contracts/toolContractExamples.js +4 -3
- package/dist/contracts/toolContracts.js +18 -7
- package/dist/contracts/toolEffects.js +34 -21
- package/dist/contracts/toolOutputSchemaGroups.js +18 -5
- package/dist/contracts/toolOutputSchemaPrimitives.js +9 -6
- package/dist/contracts/toolSchemaMetadata.js +5 -8
- package/dist/doctorRuntime.js +0 -41
- package/dist/domain/analysisErrorPresentation.js +4 -28
- package/dist/domain/analysisErrorProjection.js +33 -50
- package/dist/domain/analysisProfile.js +1 -1
- package/dist/domain/analysisSnapshot.js +77 -3
- package/dist/domain/androidApplication.js +5 -4
- package/dist/domain/appleApplication.js +5 -4
- package/dist/domain/appleAssetCatalog.js +127 -0
- package/dist/domain/artifactComparison.js +7 -11
- package/dist/domain/artifactGraph.js +8 -6
- package/dist/domain/artifactInspection.js +13 -12
- package/dist/domain/binaryTarget.js +23 -9
- package/dist/domain/browserObservation.js +43 -24
- package/dist/domain/browserObservationSchemas.js +2 -1
- package/dist/domain/browserScenario.js +7 -107
- package/dist/domain/browserScenarioCapture.js +0 -1
- package/dist/domain/browserScenarioCaptureValues.js +5 -4
- package/dist/domain/browserScenarioDiff.js +1 -3
- package/dist/domain/browserScenarioValues.js +16 -107
- package/dist/domain/bundleComparison.js +18 -17
- package/dist/domain/callPathSchemas.js +17 -7
- package/dist/domain/changedBehavior.js +2 -3
- package/dist/domain/comparisonSemantics.js +19 -0
- package/dist/domain/completionLedgerGeneration.js +3 -2
- package/dist/domain/conformancePackage.js +2 -1
- package/dist/domain/conformanceTrustGate.js +3 -5
- package/dist/domain/customProtocolCapture.js +2 -2
- package/dist/domain/digests.js +30 -0
- package/dist/domain/dosMz.js +83 -0
- package/dist/domain/electronActiveObservation.js +7 -5
- package/dist/domain/electronObservation.js +3 -2
- package/dist/domain/electronStaticAnalysisNative.js +15 -6
- package/dist/domain/emptyArraySchema.js +3 -0
- package/dist/domain/errors.js +10 -28
- package/dist/domain/evidence.js +5 -3
- package/dist/domain/evidenceCompletionLedger.js +3 -2
- package/dist/domain/functionComparisonNormalization.js +24 -18
- package/dist/domain/functionComparisonResults.js +3 -7
- package/dist/domain/functionComparisonSchemas.js +3 -2
- package/dist/domain/hopperValues.js +108 -8
- package/dist/domain/javascriptApplicationAnalysis.js +4 -7
- package/dist/domain/javascriptApplicationEvidenceSchemas.js +4 -3
- package/dist/domain/javascriptApplicationGraphSchemas.js +8 -7
- package/dist/domain/javascriptApplicationVersionComparisonSchemas.js +9 -7
- package/dist/domain/javascriptApplicationVersionItems.js +12 -18
- package/dist/domain/javascriptAstValues.js +4 -0
- package/dist/domain/javascriptExportShapeComparison.js +1 -6
- package/dist/domain/javascriptExportShapeComparisonSchemas.js +6 -10
- package/dist/domain/javascriptExportShapeVariants.js +15 -2
- package/dist/domain/javascriptFeatureTraceSchemas.js +8 -7
- package/dist/domain/javascriptRuntimeObservation.js +14 -2
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +8 -0
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +4 -2
- package/dist/domain/javascriptRuntimeReconciliationResult.js +6 -4
- package/dist/domain/javascriptRuntimeReconciliationRuntime.js +15 -4
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +19 -18
- package/dist/domain/javascriptRuntimeStaticCandidates.js +18 -6
- package/dist/domain/javascriptSemanticAnalysis.js +57 -19
- package/dist/domain/javascriptSemanticAsyncEffects.js +39 -40
- package/dist/domain/javascriptSemanticCalls.js +46 -27
- package/dist/domain/javascriptSemanticChildProcesses.js +43 -50
- package/dist/domain/javascriptSemanticDataEffectHelpers.js +91 -18
- package/dist/domain/javascriptSemanticDataEffects.js +22 -10
- package/dist/domain/javascriptSemanticGraphSchemas.js +8 -6
- package/dist/domain/javascriptSemanticObjects.js +13 -3
- package/dist/domain/javascriptSemanticProjection.js +144 -38
- package/dist/domain/javascriptSemanticPromises.js +14 -27
- package/dist/domain/javascriptSemanticQuerySchemas.js +6 -9
- package/dist/domain/javascriptSemanticResources.js +2 -5
- package/dist/domain/javascriptSemanticState.js +4 -0
- package/dist/domain/javascriptSemanticTraceSchemas.js +2 -1
- package/dist/domain/javascriptSemanticTraversal.js +13 -5
- package/dist/domain/javascriptSemanticValues.js +10 -9
- package/dist/domain/javascriptSourceParser.js +5 -1
- package/dist/domain/javascriptStaticAnalysisCalls.js +8 -5
- package/dist/domain/javascriptStaticAnalysisHelpers.js +16 -7
- package/dist/domain/keyedArchive.js +181 -0
- package/dist/domain/managedApplicationGraph.js +4 -3
- package/dist/domain/managedArtifact.js +2 -1
- package/dist/domain/managedMemberComparison.js +18 -13
- package/dist/domain/managedMemberComparisonCoverage.js +2 -1
- package/dist/domain/managedMemberComparisonItems.js +27 -7
- package/dist/domain/managedMemberComparisonMatch.js +22 -6
- package/dist/domain/managedNativeVerificationMatch.js +2 -2
- package/dist/domain/managedNativeVerificationSchemas.js +7 -5
- package/dist/domain/managedReconstruction.js +6 -5
- package/dist/domain/nativeApiBoundary.js +7 -0
- package/dist/domain/nativeDataType.js +51 -0
- package/dist/domain/nativeInspection.js +0 -1
- package/dist/domain/nativeInstruction.js +82 -0
- package/dist/domain/nativeInvestigationGraph.js +9 -5
- package/dist/domain/nativeUiObservation.js +123 -0
- package/dist/domain/nativeValueFlow.js +17 -0
- package/dist/domain/nativeValueTrace.js +64 -0
- package/dist/domain/objcSwiftMetadata.js +39 -0
- package/dist/domain/peInspection.js +1 -0
- package/dist/domain/processCapture.js +5 -55
- package/dist/domain/processCaptureExample.js +0 -9
- package/dist/domain/processCaptureValidation.js +13 -144
- package/dist/domain/processComparison.js +3 -25
- package/dist/domain/processObservation.js +0 -29
- package/dist/domain/processScenario.js +28 -228
- package/dist/domain/processTraceDimensionProjection.js +0 -15
- package/dist/domain/processTraceEvaluation.js +0 -6
- package/dist/domain/protocolCapture.js +8 -36
- package/dist/domain/reconstructionCoverage.js +3 -2
- package/dist/domain/reconstructionObligationLedgerSchemas.js +4 -12
- package/dist/domain/reconstructionReadinessSchemas.js +4 -3
- package/dist/domain/reconstructionVerification.js +2 -1
- package/dist/domain/reconstructionVerificationSchemas.js +6 -13
- package/dist/domain/referenceSourceClassification.js +0 -110
- package/dist/domain/referenceSourceGraph.js +15 -5
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/runtimeIdentification.js +6 -5
- package/dist/domain/sourceMapContents.js +5 -0
- package/dist/domain/sourceToBundleComparison.js +3 -10
- package/dist/domain/sourceToBundleComparisonSchemas.js +7 -6
- package/dist/domain/sourceToBundleSignals.js +9 -3
- package/dist/domain/staticRuntimeCorrelation.js +5 -11
- package/dist/domain/webBundleAnalysis.js +17 -9
- package/dist/domain/webBundleAnalyzer.js +1 -1
- package/dist/domain/webCaptureDiff.js +5 -11
- package/dist/domain/webCaptureDiffSchemas.js +2 -1
- package/dist/domain/webMcpDiscovery.js +2 -1
- package/dist/dotnet/ManagedMemberInspectorCore.js +15 -7
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +57 -40
- package/dist/dotnet/ManagedMemberRows.js +2 -0
- package/dist/dotnet/ManagedMethodBodyReader.js +15 -8
- package/dist/dotnet/ManagedPeReader.js +2 -0
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +15 -5
- package/dist/ghidra/GhidraClient.js +38 -8
- package/dist/ghidra/GhidraFunctionValues.js +56 -20
- package/dist/ghidra/GhidraInstallation.js +7 -4
- package/dist/ghidra/GhidraInventoryValues.js +44 -9
- package/dist/ghidra/GhidraLauncher.js +18 -3
- package/dist/ghidra/GhidraProvider.js +23 -2
- package/dist/ghidra/GhidraRequestQueue.js +45 -4
- package/dist/ghidra/GhidraSessionValues.js +5 -0
- package/dist/hopper/HopperAnalysisProfile.js +2 -0
- package/dist/hopper/HopperProvider.js +29 -6
- package/dist/hopper/HopperTargetLease.js +18 -4
- package/dist/logger.js +0 -13
- package/dist/main/messages.js +0 -1
- package/dist/main/reload.js +3 -32
- package/dist/main/shutdown.js +1 -2
- package/dist/main/transport.js +0 -17
- package/dist/main.js +0 -10
- package/dist/native/AppleDispatchMetadata.js +582 -0
- package/dist/native/AppleObjcProtocols.js +88 -0
- package/dist/native/AppleSwiftVtables.js +86 -0
- package/dist/native/CommandRunner.js +1 -1
- package/dist/native/NativeHostCapabilities.js +23 -0
- package/dist/native/NativeMacOSProvider.js +61 -9
- package/dist/native/NativeMachoInspection.js +39 -6
- package/dist/native/NativeUiHelperRuntime.js +42 -0
- package/dist/native/NativeUiObservation.js +174 -0
- package/dist/native/parsers/codesign.js +4 -1
- package/dist/native/parsers/dyldInfo.js +51 -25
- package/dist/native/parsers/lipo.js +13 -4
- package/dist/native/parsers/otool.js +84 -39
- package/dist/native/parsers/plist.js +2 -1
- package/dist/process/ExecFileOutput.js +5 -1
- package/dist/process/ProcessOwnership.js +69 -33
- package/dist/process/ProcessOwnershipObservation.js +31 -12
- package/dist/process/ProviderProcess.js +4 -2
- package/dist/reference/ReferenceSourceReaderEntries.js +48 -31
- package/dist/reference/ReferenceSourceReaderErrors.js +24 -0
- package/dist/reference/ReferenceSourceReaderFile.js +11 -5
- package/dist/reference/ReferenceSourceReaderValidate.js +22 -8
- package/dist/server/createServer.js +7 -62
- package/dist/server/registerApplicationTools/helpers.js +2 -9
- package/dist/server/registerApplicationTools.js +0 -4
- package/dist/server/registerArtifactComparisonTool.js +1 -1
- package/dist/server/registerBrowserScenarioTool.js +4 -2
- package/dist/server/registerBrowserTools.js +7 -7
- package/dist/server/registerBundleComparisonTool.js +1 -1
- package/dist/server/registerCloseLifecycleTool.js +1 -1
- package/dist/server/registerElectronTools.js +10 -4
- package/dist/server/registerEnhancedTools.js +20 -12
- package/dist/server/registerEvidenceTools.js +4 -28
- package/dist/server/registerFunctionComparisonTool.js +1 -1
- package/dist/server/registerInvestigationTools.js +6 -6
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -2
- package/dist/server/registerManagedTools.js +28 -14
- package/dist/server/registerManagedWorkflowTools.js +0 -2
- package/dist/server/registerProcessComparisonTool.js +1 -3
- package/dist/server/registerSessionRecordTools.js +9 -9
- package/dist/server/registerSessionStatusTool.js +1 -1
- package/dist/server/registerSessionTools.js +28 -57
- package/dist/server/sessionAvailabilityPolicy.js +2 -3
- package/dist/server/sessionToolPolicies.js +0 -4
- package/dist/server/toolResult.js +8 -10
- package/package.json +32 -22
- package/skills/reverse-engineer-anything/SKILL.md +15 -11
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +3 -2
- package/skills/reverse-engineer-anything/references/javascript-applications.md +3 -2
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +8 -6
- package/skills/reverse-engineer-anything/references/runtime-observation.md +15 -11
- package/dist/application/CommandShimReplay.js +0 -152
- package/dist/application/ConfiguredRoots.js +0 -19
- package/dist/application/InstrumentedJavaScriptReplayHost.js +0 -36
- package/dist/application/JavaScriptReplayPermission.js +0 -16
- package/dist/application/JavaScriptReplayPlanning.js +0 -207
- package/dist/application/JavaScriptReplayService.js +0 -274
- package/dist/application/LoopbackReplay.js +0 -389
- package/dist/application/LoopbackReplayRecorder.js +0 -129
- package/dist/application/ManagedRuntimeCorrelationService.js +0 -104
- package/dist/application/NodeRuntimeCharacterizationService.js +0 -191
- package/dist/application/PermissionAuthority.js +0 -268
- package/dist/application/PermissionConfiguration.js +0 -26
- package/dist/application/PermissionFailure.js +0 -5
- package/dist/application/ProcessCaptureAuthority.js +0 -24
- package/dist/application/ProcessCapturePermission.js +0 -13
- package/dist/application/ProcessCheckpoints.js +0 -178
- package/dist/application/ProcessReactiveCoordinator.js +0 -223
- package/dist/application/ProcessReactiveEffects.js +0 -153
- package/dist/application/ProcessReactiveHarness.js +0 -106
- package/dist/application/ProcessReactiveObservations.js +0 -105
- package/dist/application/ProjectPermissionStore.js +0 -199
- package/dist/application/RuntimeExecutableDiagnostics.js +0 -198
- package/dist/application/Upgrade.js +0 -134
- package/dist/browser/SensitiveTextCapture.js +0 -8
- package/dist/cliPolicyCommands.js +0 -185
- package/dist/config/browserScenario.js +0 -77
- package/dist/config/electronAutomation.js +0 -35
- package/dist/config/javascriptReplay.js +0 -41
- package/dist/config/managedRuntime.js +0 -25
- package/dist/config/passiveObservation.js +0 -87
- package/dist/config/permissions.js +0 -23
- package/dist/config/processCapture.js +0 -47
- package/dist/contracts/replayMachineExample.js +0 -37
- package/dist/domain/javascriptExportInstrumentation.js +0 -95
- package/dist/domain/javascriptReplay.js +0 -360
- package/dist/domain/managedRuntimeCorrelation.js +0 -181
- package/dist/domain/nodeRuntimeCharacterization.js +0 -63
- package/dist/domain/permissionPolicy.js +0 -176
- package/dist/domain/processCaptureReactiveSchema.js +0 -68
- package/dist/domain/processCaptureReactiveValidation.js +0 -180
- package/dist/domain/processReactiveCheckpointDataflow.js +0 -32
- package/dist/domain/processReactiveMatching.js +0 -196
- package/dist/domain/processReactiveRuntime.js +0 -116
- package/dist/domain/processReactiveScenario.js +0 -296
- package/dist/domain/processReactiveScenarioPreflight.js +0 -95
- package/dist/domain/processReactiveTransition.js +0 -187
- package/dist/domain/replayMachine.js +0 -320
- package/dist/domain/replayMachineRun.js +0 -168
- package/dist/domain/replayMachineRuntime.js +0 -296
- package/dist/domain/replayMachineValues.js +0 -84
- package/dist/domain/runtimeCharacterization.js +0 -84
- package/dist/replay/JavaScriptReplayWorker.js +0 -382
- package/dist/replay/JavaScriptReplayWorkerTypes.js +0 -1
- package/dist/replay/LinuxJavaScriptReplayRunner.js +0 -216
- package/dist/replay/LinuxJavaScriptReplaySandbox.js +0 -121
- package/dist/replay/LinuxRuntimeClosure.js +0 -44
- package/dist/replay/LinuxSeccompPolicy.js +0 -40
- package/dist/replay/ReplayOutcome.js +0 -104
- package/dist/replay/ReplayProcessLifecycle.js +0 -96
- package/dist/replay/ReplaySeccompFile.js +0 -29
- package/dist/replay/ReplayWorkerProtocol.js +0 -58
- package/dist/replay/SystemJavaScriptReplayHost.js +0 -153
- package/dist/server/ProcessCaptureElicitation.js +0 -153
- package/dist/server/registerApplicationTools/characterization.js +0 -46
- package/dist/server/registerApplicationTools/controlledReplay.js +0 -31
- package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +0 -29
- package/dist/server/registerReplayMachineTool.js +0 -14
- package/skills/reverse-engineer-anything/references/controlled-replay.md +0 -12
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import canonicalize from "canonicalize";
|
|
2
|
-
import { createHash } from "node:crypto";
|
|
3
|
-
const REPLAY_POLICY_VERSION = "linux-bwrap-systemd-v1";
|
|
4
|
-
const REPLAY_POLICY_DOCUMENT = Object.freeze({
|
|
5
|
-
version: REPLAY_POLICY_VERSION,
|
|
6
|
-
namespaces: ["user", "pid", "network", "ipc", "uts", "cgroup"],
|
|
7
|
-
capabilities: "drop-all",
|
|
8
|
-
network: "none",
|
|
9
|
-
filesystem: "minimal-read-only-runtime-plus-private-tmpfs",
|
|
10
|
-
seccomp: "rea-linux-x86_64-v1",
|
|
11
|
-
resource_manager: "systemd-user-cgroup-v2",
|
|
12
|
-
nested_user_namespaces: false,
|
|
13
|
-
});
|
|
14
|
-
const assertReplayManifestWithinProtocolLimit = (input) => {
|
|
15
|
-
if (new TextEncoder().encode(JSON.stringify(input)).byteLength >
|
|
16
|
-
input.limits.protocol_bytes)
|
|
17
|
-
throw new RangeError("Replay plan input exceeds its protocol byte limit");
|
|
18
|
-
};
|
|
19
|
-
/** Read, normalize, and content-address every input to one replay experiment. */
|
|
20
|
-
export const prepareReplayPlan = async (input, policy, host) => {
|
|
21
|
-
assertReplayManifestWithinProtocolLimit(input);
|
|
22
|
-
const cases = replayCases(input).map((item) => ({
|
|
23
|
-
...item,
|
|
24
|
-
sha256: digestJson(item.arguments),
|
|
25
|
-
}));
|
|
26
|
-
if (new TextEncoder().encode(JSON.stringify(cases.map(({ arguments: args }) => args))).byteLength > input.limits.input_bytes)
|
|
27
|
-
throw new RangeError("Replay case inputs exceed the aggregate byte limit");
|
|
28
|
-
await host.probe(policy);
|
|
29
|
-
const [runtime, bubblewrap, systemdRun, systemctl, shell, worker, runtimeFiles, left, right,] = await Promise.all([
|
|
30
|
-
host.identifyExecutable(policy.nodePath, ["--version"]),
|
|
31
|
-
host.identifyExecutable(policy.bubblewrapPath, ["--version"]),
|
|
32
|
-
host.identifyExecutable(policy.systemdRunPath, ["--version"]),
|
|
33
|
-
host.identifyExecutable(policy.systemctlPath, ["--version"]),
|
|
34
|
-
host.identifyExecutable(policy.shellPath, ["--version"]),
|
|
35
|
-
host.identifyWorker(),
|
|
36
|
-
host.identifyRuntimeClosure(policy.nodePath),
|
|
37
|
-
prepareSide(input.left, input.limits.module_bytes, host),
|
|
38
|
-
input.right === undefined
|
|
39
|
-
? Promise.resolve(undefined)
|
|
40
|
-
: prepareSide(input.right, input.limits.module_bytes, host),
|
|
41
|
-
]);
|
|
42
|
-
const withoutDigest = {
|
|
43
|
-
policy_version: REPLAY_POLICY_VERSION,
|
|
44
|
-
policy_sha256: digestJson(REPLAY_POLICY_DOCUMENT),
|
|
45
|
-
network: "none",
|
|
46
|
-
filesystem: {
|
|
47
|
-
host_writes: false,
|
|
48
|
-
private_tmpfs_bytes: input.limits.tmpfs_bytes,
|
|
49
|
-
},
|
|
50
|
-
runtime: {
|
|
51
|
-
executable: runtime,
|
|
52
|
-
worker,
|
|
53
|
-
read_only_files: runtimeFiles.map((item) => ({
|
|
54
|
-
source_path: item.sourcePath,
|
|
55
|
-
destination_path: item.destinationPath,
|
|
56
|
-
sha256: item.sha256,
|
|
57
|
-
})),
|
|
58
|
-
},
|
|
59
|
-
sandbox: {
|
|
60
|
-
bubblewrap,
|
|
61
|
-
systemd_run: systemdRun,
|
|
62
|
-
systemctl,
|
|
63
|
-
shell,
|
|
64
|
-
seccomp_sha256: host.seccompDigest(),
|
|
65
|
-
},
|
|
66
|
-
left: left.commitment,
|
|
67
|
-
...(right === undefined ? {} : { right: right.commitment }),
|
|
68
|
-
cases,
|
|
69
|
-
determinism: input.determinism,
|
|
70
|
-
limits: input.limits,
|
|
71
|
-
effects: [
|
|
72
|
-
"Execute selected extracted modules in a disposable Linux OS sandbox",
|
|
73
|
-
"Create and remove one private cgroup and mount namespace",
|
|
74
|
-
"Retain bounded return, exception, termination, and diagnostic evidence",
|
|
75
|
-
"Perform no host filesystem writes and expose no host or external network",
|
|
76
|
-
...(input.reproducer_export === undefined
|
|
77
|
-
? []
|
|
78
|
-
: ["Write one reproducer after sandbox cleanup"]),
|
|
79
|
-
],
|
|
80
|
-
reproducer_export: input.reproducer_export === undefined
|
|
81
|
-
? null
|
|
82
|
-
: {
|
|
83
|
-
path: input.reproducer_export.path,
|
|
84
|
-
include_sources: input.reproducer_export.include_sources,
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
const publicPlan = {
|
|
88
|
-
...withoutDigest,
|
|
89
|
-
plan_digest: digestJson(withoutDigest),
|
|
90
|
-
};
|
|
91
|
-
return {
|
|
92
|
-
publicPlan,
|
|
93
|
-
leftSources: left.sources,
|
|
94
|
-
...(right === undefined ? {} : { rightSources: right.sources }),
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
const prepareSide = async (side, maximumBytes, host) => {
|
|
98
|
-
const aliases = new Set(side.modules.map(({ alias }) => alias));
|
|
99
|
-
if (aliases.size !== side.modules.length || !aliases.has(side.entry_alias))
|
|
100
|
-
throw new TypeError("Replay manifest aliases or entry alias are invalid");
|
|
101
|
-
for (const module of side.modules)
|
|
102
|
-
for (const dependency of Object.values(module.dependencies))
|
|
103
|
-
if (!aliases.has(dependency))
|
|
104
|
-
throw new TypeError(`Undeclared replay dependency alias: ${dependency}`);
|
|
105
|
-
const loaded = [];
|
|
106
|
-
let totalBytes = 0;
|
|
107
|
-
for (const module of side.modules) {
|
|
108
|
-
const remaining = maximumBytes - totalBytes;
|
|
109
|
-
if (remaining <= 0)
|
|
110
|
-
throw new RangeError("Replay module bytes exceed the aggregate limit");
|
|
111
|
-
const source = await host.readSource(module.path, remaining);
|
|
112
|
-
if (source.bytes.byteLength > remaining)
|
|
113
|
-
throw new RangeError("Replay module bytes exceed the aggregate limit");
|
|
114
|
-
totalBytes += source.bytes.byteLength;
|
|
115
|
-
loaded.push({ module, source });
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
commitment: {
|
|
119
|
-
modules: loaded.map(({ module, source }) => ({
|
|
120
|
-
alias: module.alias,
|
|
121
|
-
canonical_path: source.canonicalPath,
|
|
122
|
-
format: module.format,
|
|
123
|
-
role: module.role,
|
|
124
|
-
byte_count: source.bytes.byteLength,
|
|
125
|
-
sha256: digestBytes(source.bytes),
|
|
126
|
-
dependencies: module.dependencies,
|
|
127
|
-
})),
|
|
128
|
-
entry_alias: side.entry_alias,
|
|
129
|
-
entry_export: side.entry_export,
|
|
130
|
-
},
|
|
131
|
-
sources: Object.fromEntries(loaded.map(({ module, source }) => [
|
|
132
|
-
module.alias,
|
|
133
|
-
new TextDecoder("utf-8", { fatal: true }).decode(source.bytes),
|
|
134
|
-
])),
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
const replayCases = (input) => {
|
|
138
|
-
const explicit = input.cases.map((item) => ({
|
|
139
|
-
case_id: item.case_id,
|
|
140
|
-
arguments: item.arguments,
|
|
141
|
-
}));
|
|
142
|
-
if (input.generator === undefined)
|
|
143
|
-
return uniqueCases(explicit);
|
|
144
|
-
let state = input.generator.seed || 0x9e37_79b9;
|
|
145
|
-
const next = () => {
|
|
146
|
-
state ^= state << 13;
|
|
147
|
-
state ^= state >>> 17;
|
|
148
|
-
state ^= state << 5;
|
|
149
|
-
return state >>> 0;
|
|
150
|
-
};
|
|
151
|
-
const corpus = boundaryCorpus(input.generator.preset);
|
|
152
|
-
const generated = Array.from({ length: input.generator.count }, (_, index) => ({
|
|
153
|
-
case_id: `generated-${input.generator?.preset ?? "boundary"}-${String(index)}`,
|
|
154
|
-
arguments: [corpus[next() % corpus.length] ?? ""],
|
|
155
|
-
}));
|
|
156
|
-
return uniqueCases([...explicit, ...generated]);
|
|
157
|
-
};
|
|
158
|
-
const uniqueCases = (cases) => {
|
|
159
|
-
const ids = new Set();
|
|
160
|
-
for (const item of cases) {
|
|
161
|
-
if (ids.has(item.case_id))
|
|
162
|
-
throw new TypeError(`Duplicate replay case ID: ${item.case_id}`);
|
|
163
|
-
ids.add(item.case_id);
|
|
164
|
-
}
|
|
165
|
-
return cases;
|
|
166
|
-
};
|
|
167
|
-
const boundaryCorpus = (preset) => {
|
|
168
|
-
if (preset === "sanitizer-boundaries")
|
|
169
|
-
return [
|
|
170
|
-
"",
|
|
171
|
-
"<script>alert(1)</script>",
|
|
172
|
-
"<img src=x onerror=alert(1)>",
|
|
173
|
-
"javascript:alert(1)",
|
|
174
|
-
"<b>ok</b>",
|
|
175
|
-
"\u0000",
|
|
176
|
-
];
|
|
177
|
-
if (preset === "clipboard-boundaries")
|
|
178
|
-
return [
|
|
179
|
-
"",
|
|
180
|
-
"plain",
|
|
181
|
-
"a\r\nb",
|
|
182
|
-
"a\nb",
|
|
183
|
-
"\t",
|
|
184
|
-
"😀",
|
|
185
|
-
"text/html",
|
|
186
|
-
"text/plain",
|
|
187
|
-
];
|
|
188
|
-
return [
|
|
189
|
-
"",
|
|
190
|
-
" ",
|
|
191
|
-
"\n",
|
|
192
|
-
"# heading",
|
|
193
|
-
"**bold**",
|
|
194
|
-
"[x](javascript:y)",
|
|
195
|
-
"`code`",
|
|
196
|
-
"😀",
|
|
197
|
-
"\u0000",
|
|
198
|
-
"a".repeat(1024),
|
|
199
|
-
];
|
|
200
|
-
};
|
|
201
|
-
export const digestBytes = (value) => createHash("sha256").update(value).digest("hex");
|
|
202
|
-
export const digestJson = (value) => {
|
|
203
|
-
const encoded = canonicalize(value);
|
|
204
|
-
if (encoded === undefined)
|
|
205
|
-
throw new TypeError("Replay commitment is not canonical JSON");
|
|
206
|
-
return createHash("sha256").update(encoded).digest("hex");
|
|
207
|
-
};
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { projectPermissionFailure } from "./PermissionFailure.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import writeFileAtomic from "write-file-atomic";
|
|
4
|
-
import { controlledReplayInputSchema, replayExecutionResultSchema, controlledReplayOutputSchema, replayEvidenceSchema, } from "../domain/javascriptReplay.js";
|
|
5
|
-
import { AnalysisCapabilityUnavailableError, AnalysisCancelledError, AnalysisInputError, AnalysisProtocolError, ReplayPlanStaleError, } from "../domain/errors.js";
|
|
6
|
-
import { createEvidence } from "../domain/evidence.js";
|
|
7
|
-
import { projectInputIssues } from "../domain/inputIssueProjection.js";
|
|
8
|
-
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
9
|
-
import { err, ok } from "../domain/result.js";
|
|
10
|
-
import { replayPermissionRequest } from "./JavaScriptReplayPermission.js";
|
|
11
|
-
import { digestBytes, prepareReplayPlan, } from "./JavaScriptReplayPlanning.js";
|
|
12
|
-
const OPERATION = "run_controlled_replay";
|
|
13
|
-
const isAborted = (signal) => signal?.aborted === true;
|
|
14
|
-
/** Plan or execute one content-bound extracted-module replay experiment. */
|
|
15
|
-
export const runControlledReplay = async (dependencies, rawInput, options = {}) => {
|
|
16
|
-
const parsed = controlledReplayInputSchema.safeParse(rawInput);
|
|
17
|
-
if (!parsed.success)
|
|
18
|
-
return err(new AnalysisInputError(OPERATION, { cause: parsed.error }, projectInputIssues(parsed.error.issues, rawInput)));
|
|
19
|
-
return runControlledReplayValidated(dependencies, parsed.data, options);
|
|
20
|
-
};
|
|
21
|
-
/** Plan or execute replay input already parsed by a trusted adapter. */
|
|
22
|
-
export const runControlledReplayValidated = async (dependencies, input, options = {}) => {
|
|
23
|
-
const authorized = await authorizeReplay(dependencies, dependencies.policy(), input, options.signal);
|
|
24
|
-
if (!authorized.ok)
|
|
25
|
-
return authorized;
|
|
26
|
-
const prepared = await prepareValidatedReplay(dependencies, authorized.value, input, options.signal);
|
|
27
|
-
if (!prepared.ok)
|
|
28
|
-
return prepared;
|
|
29
|
-
if (isAborted(options.signal))
|
|
30
|
-
return err(new AnalysisCancelledError(OPERATION));
|
|
31
|
-
if (input.mode === "plan")
|
|
32
|
-
return ok(asJson({
|
|
33
|
-
phase: "plan",
|
|
34
|
-
plan: prepared.value.publicPlan,
|
|
35
|
-
source_evidence: [],
|
|
36
|
-
evidence: null,
|
|
37
|
-
}));
|
|
38
|
-
if (input.plan_digest !== prepared.value.publicPlan.plan_digest)
|
|
39
|
-
return err(new ReplayPlanStaleError(input.plan_digest, prepared.value.publicPlan.plan_digest));
|
|
40
|
-
const exportContext = await authorizeReproducerExport(input);
|
|
41
|
-
if (!exportContext.ok)
|
|
42
|
-
return exportContext;
|
|
43
|
-
const executed = await executeValidatedReplay({
|
|
44
|
-
runner: dependencies.runner,
|
|
45
|
-
policy: authorized.value,
|
|
46
|
-
prepared: prepared.value,
|
|
47
|
-
exportContext: exportContext.value,
|
|
48
|
-
options,
|
|
49
|
-
});
|
|
50
|
-
if (!executed.ok)
|
|
51
|
-
return executed;
|
|
52
|
-
try {
|
|
53
|
-
return ok(buildReplayOutput(prepared.value, executed.value.executed, executed.value.sourceEvidence));
|
|
54
|
-
}
|
|
55
|
-
catch (cause) {
|
|
56
|
-
return err(new AnalysisProtocolError(cause instanceof z.ZodError
|
|
57
|
-
? "Controlled replay produced an invalid bounded result"
|
|
58
|
-
: "Controlled replay could not establish or clean up its sandbox", { cause }));
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const authorizeReplay = async (dependencies, policy, input, signal) => {
|
|
62
|
-
if (policy.status === "disabled")
|
|
63
|
-
return err(new AnalysisCapabilityUnavailableError("rea-javascript-replay", OPERATION, "controlled replay is disabled; configure exact roots and executables before enabling it"));
|
|
64
|
-
if (dependencies.authority === undefined)
|
|
65
|
-
return err(new AnalysisCapabilityUnavailableError("rea-javascript-replay", OPERATION, "JavaScript replay permission policy is not configured"));
|
|
66
|
-
if (isAborted(signal))
|
|
67
|
-
return err(new AnalysisCancelledError(OPERATION));
|
|
68
|
-
const request = replayPermissionRequest(input, policy);
|
|
69
|
-
const authorized = input.mode === "plan"
|
|
70
|
-
? await dependencies.authority.explain(request, "read")
|
|
71
|
-
: await dependencies.authority.authorize(request, "read");
|
|
72
|
-
if (!authorized.ok)
|
|
73
|
-
return err(projectPermissionFailure(authorized.error));
|
|
74
|
-
return ok(policy);
|
|
75
|
-
};
|
|
76
|
-
const prepareValidatedReplay = async (dependencies, policy, input, signal) => {
|
|
77
|
-
if (isAborted(signal))
|
|
78
|
-
return err(new AnalysisCancelledError(OPERATION));
|
|
79
|
-
try {
|
|
80
|
-
return ok(await prepareReplayPlan(input, policy, dependencies.host));
|
|
81
|
-
}
|
|
82
|
-
catch (cause) {
|
|
83
|
-
return err(new AnalysisCapabilityUnavailableError("rea-javascript-replay", OPERATION, cause instanceof Error ? cause.message : "replay planning failed"));
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
const authorizeReproducerExport = (input) => {
|
|
87
|
-
if (input.reproducer_export === undefined)
|
|
88
|
-
return ok(undefined);
|
|
89
|
-
return ok({
|
|
90
|
-
path: input.reproducer_export.path,
|
|
91
|
-
includeSources: input.reproducer_export.include_sources === true,
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
const executeValidatedReplay = async (context) => {
|
|
95
|
-
const { runner, policy, prepared, exportContext, options } = context;
|
|
96
|
-
await options.progress?.report({
|
|
97
|
-
phase: OPERATION,
|
|
98
|
-
completed: 0,
|
|
99
|
-
total: 1,
|
|
100
|
-
message: "Admitting approved modules into the isolated replay worker",
|
|
101
|
-
});
|
|
102
|
-
if (isAborted(options.signal))
|
|
103
|
-
return err(new AnalysisCancelledError(OPERATION));
|
|
104
|
-
try {
|
|
105
|
-
let executed = replayExecutionResultSchema.parse(await runner.execute(prepared, policy, options.signal));
|
|
106
|
-
await options.progress?.report({
|
|
107
|
-
phase: OPERATION,
|
|
108
|
-
completed: 1,
|
|
109
|
-
total: 1,
|
|
110
|
-
message: "Controlled replay stopped and sandbox cleanup was observed",
|
|
111
|
-
terminal: true,
|
|
112
|
-
});
|
|
113
|
-
if (executed.termination === "cancelled")
|
|
114
|
-
return err(new AnalysisCancelledError(OPERATION));
|
|
115
|
-
executed = await applyReproducerExport(executed, exportContext, prepared);
|
|
116
|
-
const sourceEvidence = buildSourceEvidence(prepared, executed);
|
|
117
|
-
return ok({ executed, sourceEvidence });
|
|
118
|
-
}
|
|
119
|
-
catch (cause) {
|
|
120
|
-
return err(new AnalysisProtocolError(cause instanceof z.ZodError
|
|
121
|
-
? "Controlled replay produced an invalid bounded result"
|
|
122
|
-
: "Controlled replay could not establish or clean up its sandbox", { cause }));
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
const applyReproducerExport = async (executed, exportContext, prepared) => {
|
|
126
|
-
if (exportContext === undefined || executed.cleanup.state !== "complete")
|
|
127
|
-
return executed;
|
|
128
|
-
const manifest = {
|
|
129
|
-
plan: prepared.publicPlan,
|
|
130
|
-
result: executed,
|
|
131
|
-
sources: exportContext.includeSources
|
|
132
|
-
? {
|
|
133
|
-
left: prepared.leftSources,
|
|
134
|
-
...(prepared.rightSources === undefined
|
|
135
|
-
? {}
|
|
136
|
-
: { right: prepared.rightSources }),
|
|
137
|
-
}
|
|
138
|
-
: null,
|
|
139
|
-
};
|
|
140
|
-
const encoded = Buffer.from(`${JSON.stringify(manifest, null, 2)}\n`);
|
|
141
|
-
try {
|
|
142
|
-
await writeFileAtomic(exportContext.path, encoded, {
|
|
143
|
-
mode: 0o600,
|
|
144
|
-
});
|
|
145
|
-
return replayExecutionResultSchema.parse({
|
|
146
|
-
...executed,
|
|
147
|
-
reproducer: {
|
|
148
|
-
state: "written",
|
|
149
|
-
path: exportContext.path,
|
|
150
|
-
sha256: digestBytes(encoded),
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
catch (cause) {
|
|
155
|
-
return replayExecutionResultSchema.parse({
|
|
156
|
-
...executed,
|
|
157
|
-
limitations: [
|
|
158
|
-
...executed.limitations,
|
|
159
|
-
"Replay completed, but the separately approved reproducer export failed.",
|
|
160
|
-
],
|
|
161
|
-
reproducer: {
|
|
162
|
-
state: "failed",
|
|
163
|
-
path: exportContext.path,
|
|
164
|
-
error: cause instanceof Error
|
|
165
|
-
? cause.message
|
|
166
|
-
: "unknown reproducer export failure",
|
|
167
|
-
},
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
const buildSourceEvidence = (prepared, executed) => {
|
|
172
|
-
const leftCount = prepared.publicPlan.cases.length;
|
|
173
|
-
return [
|
|
174
|
-
createReplayEvidence(prepared, executed, "left", executed.outcomes.slice(0, leftCount)),
|
|
175
|
-
...(prepared.publicPlan.right === undefined
|
|
176
|
-
? []
|
|
177
|
-
: [
|
|
178
|
-
createReplayEvidence(prepared, executed, "right", executed.outcomes.slice(leftCount)),
|
|
179
|
-
]),
|
|
180
|
-
];
|
|
181
|
-
};
|
|
182
|
-
const buildReplayOutput = (prepared, executed, sourceEvidence) => {
|
|
183
|
-
const subject = prepared.publicPlan.left.modules[0];
|
|
184
|
-
const evidence = createEvidence(subject === undefined
|
|
185
|
-
? undefined
|
|
186
|
-
: {
|
|
187
|
-
path: subject.canonical_path,
|
|
188
|
-
sha256: subject.sha256,
|
|
189
|
-
format: "javascript",
|
|
190
|
-
}, {
|
|
191
|
-
id: "rea-javascript-replay",
|
|
192
|
-
name: "REA isolated JavaScript replay",
|
|
193
|
-
version: "1",
|
|
194
|
-
}, {
|
|
195
|
-
predicateType: "javascript-controlled-replay",
|
|
196
|
-
operation: OPERATION,
|
|
197
|
-
parameters: {
|
|
198
|
-
replay_plan: jsonValueSchema.parse(JSON.parse(JSON.stringify(prepared.publicPlan))),
|
|
199
|
-
},
|
|
200
|
-
result: jsonValueSchema.parse(JSON.parse(JSON.stringify(executed))),
|
|
201
|
-
rawResult: jsonValueSchema.parse(JSON.parse(JSON.stringify({
|
|
202
|
-
cases: prepared.publicPlan.cases,
|
|
203
|
-
outcomes: executed.outcomes,
|
|
204
|
-
stderr: executed.stderr,
|
|
205
|
-
}))),
|
|
206
|
-
confidence: executed.comparison === undefined ? "observed" : "derived",
|
|
207
|
-
authority: "controlled-replay",
|
|
208
|
-
environment: {
|
|
209
|
-
id: prepared.publicPlan.plan_digest,
|
|
210
|
-
platform: process.platform,
|
|
211
|
-
architecture: process.arch,
|
|
212
|
-
isolation: "container",
|
|
213
|
-
},
|
|
214
|
-
limitations: executed.limitations,
|
|
215
|
-
locations: prepared.publicPlan.left.modules.map((module) => ({
|
|
216
|
-
kind: "artifact-path",
|
|
217
|
-
path: module.canonical_path,
|
|
218
|
-
})),
|
|
219
|
-
evidenceLinks: sourceEvidence.map(({ evidence_id: id }) => id),
|
|
220
|
-
});
|
|
221
|
-
return asJson({
|
|
222
|
-
phase: "execute",
|
|
223
|
-
plan: null,
|
|
224
|
-
source_evidence: sourceEvidence.map((item) => replayEvidenceSchema.parse(item)),
|
|
225
|
-
evidence: replayEvidenceSchema.parse(evidence),
|
|
226
|
-
});
|
|
227
|
-
};
|
|
228
|
-
const createReplayEvidence = (prepared, executed, side, outcomes) => {
|
|
229
|
-
const manifest = side === "left" ? prepared.publicPlan.left : prepared.publicPlan.right;
|
|
230
|
-
const subject = manifest?.modules[0];
|
|
231
|
-
const result = replayExecutionResultSchema.parse({
|
|
232
|
-
...executed,
|
|
233
|
-
outcomes,
|
|
234
|
-
comparison: undefined,
|
|
235
|
-
reproducer: null,
|
|
236
|
-
});
|
|
237
|
-
return createEvidence(subject === undefined
|
|
238
|
-
? undefined
|
|
239
|
-
: {
|
|
240
|
-
path: subject.canonical_path,
|
|
241
|
-
sha256: subject.sha256,
|
|
242
|
-
format: "javascript",
|
|
243
|
-
}, {
|
|
244
|
-
id: "rea-javascript-replay",
|
|
245
|
-
name: "REA isolated JavaScript replay",
|
|
246
|
-
version: "1",
|
|
247
|
-
}, {
|
|
248
|
-
predicateType: "javascript-controlled-replay-observation",
|
|
249
|
-
operation: OPERATION,
|
|
250
|
-
parameters: {
|
|
251
|
-
replay_plan: jsonValueSchema.parse(JSON.parse(JSON.stringify(prepared.publicPlan))),
|
|
252
|
-
side,
|
|
253
|
-
},
|
|
254
|
-
result: jsonValueSchema.parse(JSON.parse(JSON.stringify(result))),
|
|
255
|
-
rawResult: jsonValueSchema.parse(JSON.parse(JSON.stringify({ cases: prepared.publicPlan.cases, outcomes }))),
|
|
256
|
-
confidence: "observed",
|
|
257
|
-
authority: "controlled-replay",
|
|
258
|
-
environment: {
|
|
259
|
-
id: prepared.publicPlan.plan_digest,
|
|
260
|
-
platform: process.platform,
|
|
261
|
-
architecture: process.arch,
|
|
262
|
-
isolation: "container",
|
|
263
|
-
},
|
|
264
|
-
limitations: executed.limitations,
|
|
265
|
-
locations: (manifest?.modules ?? []).map((module) => ({
|
|
266
|
-
kind: "artifact-path",
|
|
267
|
-
path: module.canonical_path,
|
|
268
|
-
})),
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
const asJson = (value) => {
|
|
272
|
-
const serialized = JSON.parse(JSON.stringify(controlledReplayOutputSchema.parse(value)));
|
|
273
|
-
return jsonValueSchema.parse(serialized);
|
|
274
|
-
};
|