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,360 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { evidenceEnvelopeSchema } from "./evidence.js";
|
|
3
|
-
const digestSchema = z.string().regex(/^[a-f0-9]{64}$/u);
|
|
4
|
-
const absolutePathSchema = z.string().startsWith("/");
|
|
5
|
-
const aliasSchema = z
|
|
6
|
-
.string()
|
|
7
|
-
.min(1)
|
|
8
|
-
.regex(/^[A-Za-z0-9_./:@-]+$/u);
|
|
9
|
-
const replayModuleSchema = z
|
|
10
|
-
.object({
|
|
11
|
-
alias: aliasSchema,
|
|
12
|
-
path: absolutePathSchema,
|
|
13
|
-
format: z.enum(["esm", "commonjs-factory"]),
|
|
14
|
-
role: z.enum(["module", "stub"]).default("module"),
|
|
15
|
-
dependencies: z.record(z.string().min(1), aliasSchema).default({}),
|
|
16
|
-
})
|
|
17
|
-
.strict();
|
|
18
|
-
const replaySideSchema = z
|
|
19
|
-
.object({
|
|
20
|
-
modules: z.array(replayModuleSchema).min(1),
|
|
21
|
-
entry_alias: aliasSchema,
|
|
22
|
-
entry_export: z.string().min(1).default("default"),
|
|
23
|
-
})
|
|
24
|
-
.strict();
|
|
25
|
-
const explicitCaseSchema = z
|
|
26
|
-
.object({
|
|
27
|
-
case_id: z.string().min(1),
|
|
28
|
-
arguments: z.array(z.json()),
|
|
29
|
-
})
|
|
30
|
-
.strict();
|
|
31
|
-
const generatorSchema = z
|
|
32
|
-
.object({
|
|
33
|
-
preset: z.enum([
|
|
34
|
-
"parser-boundaries",
|
|
35
|
-
"sanitizer-boundaries",
|
|
36
|
-
"clipboard-boundaries",
|
|
37
|
-
]),
|
|
38
|
-
seed: z.number().int().min(0).max(0xffff_ffff),
|
|
39
|
-
count: z.number().int().safe().min(1),
|
|
40
|
-
})
|
|
41
|
-
.strict();
|
|
42
|
-
const replayLimitsSchema = z
|
|
43
|
-
.object({
|
|
44
|
-
wall_time_ms: z.number().int().safe().min(1).default(3_000),
|
|
45
|
-
memory_bytes: z
|
|
46
|
-
.number()
|
|
47
|
-
.int()
|
|
48
|
-
.safe()
|
|
49
|
-
.positive()
|
|
50
|
-
.default(128 * 1024 * 1024),
|
|
51
|
-
tasks: z.number().int().safe().min(1).default(8),
|
|
52
|
-
cpu_quota_percent: z.number().int().safe().min(1).default(50),
|
|
53
|
-
tmpfs_bytes: z
|
|
54
|
-
.number()
|
|
55
|
-
.int()
|
|
56
|
-
.safe()
|
|
57
|
-
.min(1)
|
|
58
|
-
.default(16 * 1024 * 1024),
|
|
59
|
-
module_bytes: z
|
|
60
|
-
.number()
|
|
61
|
-
.int()
|
|
62
|
-
.safe()
|
|
63
|
-
.min(1)
|
|
64
|
-
.default(4 * 1024 * 1024),
|
|
65
|
-
input_bytes: z
|
|
66
|
-
.number()
|
|
67
|
-
.int()
|
|
68
|
-
.safe()
|
|
69
|
-
.min(1)
|
|
70
|
-
.default(256 * 1024),
|
|
71
|
-
protocol_bytes: z
|
|
72
|
-
.number()
|
|
73
|
-
.int()
|
|
74
|
-
.safe()
|
|
75
|
-
.min(1)
|
|
76
|
-
.default(16 * 1024 * 1024),
|
|
77
|
-
output_bytes: z
|
|
78
|
-
.number()
|
|
79
|
-
.int()
|
|
80
|
-
.safe()
|
|
81
|
-
.min(1)
|
|
82
|
-
.default(512 * 1024),
|
|
83
|
-
stderr_bytes: z
|
|
84
|
-
.number()
|
|
85
|
-
.int()
|
|
86
|
-
.safe()
|
|
87
|
-
.min(0)
|
|
88
|
-
.default(32 * 1024),
|
|
89
|
-
result_depth: z.number().int().safe().min(1).default(16),
|
|
90
|
-
result_nodes: z.number().int().safe().min(1).default(10_000),
|
|
91
|
-
})
|
|
92
|
-
.strict();
|
|
93
|
-
const determinismSchema = z
|
|
94
|
-
.object({
|
|
95
|
-
clock_iso: z.iso.datetime().default("2000-01-01T00:00:00.000Z"),
|
|
96
|
-
random_seed: z.number().int().min(0).max(0xffff_ffff).default(0),
|
|
97
|
-
locale: z.literal("en-US").default("en-US"),
|
|
98
|
-
timezone: z.literal("UTC").default("UTC"),
|
|
99
|
-
platform: z.literal("linux").default("linux"),
|
|
100
|
-
})
|
|
101
|
-
.strict();
|
|
102
|
-
const controlledReplayInputShape = {
|
|
103
|
-
left: replaySideSchema,
|
|
104
|
-
right: replaySideSchema.optional(),
|
|
105
|
-
cases: z.array(explicitCaseSchema).default([]),
|
|
106
|
-
generator: generatorSchema.optional(),
|
|
107
|
-
determinism: determinismSchema.default({
|
|
108
|
-
clock_iso: "2000-01-01T00:00:00.000Z",
|
|
109
|
-
random_seed: 0,
|
|
110
|
-
locale: "en-US",
|
|
111
|
-
timezone: "UTC",
|
|
112
|
-
platform: "linux",
|
|
113
|
-
}),
|
|
114
|
-
limits: replayLimitsSchema.default({
|
|
115
|
-
wall_time_ms: 3_000,
|
|
116
|
-
memory_bytes: 128 * 1024 * 1024,
|
|
117
|
-
tasks: 8,
|
|
118
|
-
cpu_quota_percent: 50,
|
|
119
|
-
tmpfs_bytes: 16 * 1024 * 1024,
|
|
120
|
-
module_bytes: 4 * 1024 * 1024,
|
|
121
|
-
input_bytes: 256 * 1024,
|
|
122
|
-
protocol_bytes: 16 * 1024 * 1024,
|
|
123
|
-
output_bytes: 512 * 1024,
|
|
124
|
-
stderr_bytes: 32 * 1024,
|
|
125
|
-
result_depth: 16,
|
|
126
|
-
result_nodes: 10_000,
|
|
127
|
-
}),
|
|
128
|
-
reproducer_export: z
|
|
129
|
-
.strictObject({
|
|
130
|
-
path: absolutePathSchema,
|
|
131
|
-
include_sources: z.boolean().default(false),
|
|
132
|
-
})
|
|
133
|
-
.optional(),
|
|
134
|
-
};
|
|
135
|
-
/** Parse a replay request that can only construct a plan. */
|
|
136
|
-
export const controlledReplayPlanInputSchema = z.strictObject({
|
|
137
|
-
...controlledReplayInputShape,
|
|
138
|
-
mode: z.literal("plan"),
|
|
139
|
-
});
|
|
140
|
-
/** Parse a replay request carrying the digest for one exact plan. */
|
|
141
|
-
export const controlledReplayExecutionInputSchema = z.strictObject({
|
|
142
|
-
...controlledReplayInputShape,
|
|
143
|
-
mode: z.literal("execute"),
|
|
144
|
-
plan_digest: digestSchema,
|
|
145
|
-
});
|
|
146
|
-
/** Parse a controlled replay request into its legal plan or execution state. */
|
|
147
|
-
export const controlledReplayInputSchema = z
|
|
148
|
-
.discriminatedUnion("mode", [
|
|
149
|
-
controlledReplayPlanInputSchema,
|
|
150
|
-
controlledReplayExecutionInputSchema,
|
|
151
|
-
])
|
|
152
|
-
.superRefine((value, context) => {
|
|
153
|
-
if (value.cases.length === 0 && value.generator === undefined)
|
|
154
|
-
context.addIssue({
|
|
155
|
-
code: "custom",
|
|
156
|
-
path: ["cases"],
|
|
157
|
-
message: "At least one explicit or generated case is required",
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
const moduleCommitmentSchema = z
|
|
161
|
-
.object({
|
|
162
|
-
alias: aliasSchema,
|
|
163
|
-
canonical_path: z.string().min(1),
|
|
164
|
-
format: z.enum(["esm", "commonjs-factory"]),
|
|
165
|
-
role: z.enum(["module", "stub"]),
|
|
166
|
-
byte_count: z.number().int().min(0),
|
|
167
|
-
sha256: digestSchema,
|
|
168
|
-
dependencies: z.record(z.string(), aliasSchema),
|
|
169
|
-
})
|
|
170
|
-
.strict();
|
|
171
|
-
const runtimeIdentitySchema = z
|
|
172
|
-
.object({
|
|
173
|
-
path: z.string().min(1),
|
|
174
|
-
version: z.string().min(1),
|
|
175
|
-
sha256: digestSchema,
|
|
176
|
-
})
|
|
177
|
-
.strict();
|
|
178
|
-
const runtimeFileIdentitySchema = z
|
|
179
|
-
.object({
|
|
180
|
-
source_path: z.string().min(1),
|
|
181
|
-
destination_path: z.string().min(1),
|
|
182
|
-
sha256: digestSchema,
|
|
183
|
-
})
|
|
184
|
-
.strict();
|
|
185
|
-
const replayPlanSchema = z
|
|
186
|
-
.object({
|
|
187
|
-
plan_digest: digestSchema,
|
|
188
|
-
policy_version: z.literal("linux-bwrap-systemd-v1"),
|
|
189
|
-
policy_sha256: digestSchema,
|
|
190
|
-
network: z.literal("none"),
|
|
191
|
-
filesystem: z
|
|
192
|
-
.object({
|
|
193
|
-
host_writes: z.literal(false),
|
|
194
|
-
private_tmpfs_bytes: z.number().int().nonnegative(),
|
|
195
|
-
})
|
|
196
|
-
.strict(),
|
|
197
|
-
runtime: z
|
|
198
|
-
.object({
|
|
199
|
-
executable: runtimeIdentitySchema,
|
|
200
|
-
worker: runtimeIdentitySchema,
|
|
201
|
-
read_only_files: z.array(runtimeFileIdentitySchema).min(1),
|
|
202
|
-
})
|
|
203
|
-
.strict(),
|
|
204
|
-
sandbox: z
|
|
205
|
-
.object({
|
|
206
|
-
bubblewrap: runtimeIdentitySchema,
|
|
207
|
-
systemd_run: runtimeIdentitySchema,
|
|
208
|
-
systemctl: runtimeIdentitySchema,
|
|
209
|
-
shell: runtimeIdentitySchema,
|
|
210
|
-
seccomp_sha256: digestSchema,
|
|
211
|
-
})
|
|
212
|
-
.strict(),
|
|
213
|
-
left: z
|
|
214
|
-
.object({
|
|
215
|
-
modules: z.array(moduleCommitmentSchema),
|
|
216
|
-
entry_alias: aliasSchema,
|
|
217
|
-
entry_export: z.string(),
|
|
218
|
-
})
|
|
219
|
-
.strict(),
|
|
220
|
-
right: z
|
|
221
|
-
.object({
|
|
222
|
-
modules: z.array(moduleCommitmentSchema),
|
|
223
|
-
entry_alias: aliasSchema,
|
|
224
|
-
entry_export: z.string(),
|
|
225
|
-
})
|
|
226
|
-
.strict()
|
|
227
|
-
.optional(),
|
|
228
|
-
cases: z.array(z
|
|
229
|
-
.object({
|
|
230
|
-
case_id: z.string(),
|
|
231
|
-
arguments: z.array(z.json()),
|
|
232
|
-
sha256: digestSchema,
|
|
233
|
-
})
|
|
234
|
-
.strict()),
|
|
235
|
-
determinism: determinismSchema,
|
|
236
|
-
limits: replayLimitsSchema,
|
|
237
|
-
effects: z.array(z.string()),
|
|
238
|
-
reproducer_export: z
|
|
239
|
-
.object({
|
|
240
|
-
path: z.string().min(1),
|
|
241
|
-
include_sources: z.boolean(),
|
|
242
|
-
})
|
|
243
|
-
.strict()
|
|
244
|
-
.nullable(),
|
|
245
|
-
})
|
|
246
|
-
.strict();
|
|
247
|
-
const replayOutcomeFacts = {
|
|
248
|
-
case_id: z.string(),
|
|
249
|
-
input_sha256: digestSchema,
|
|
250
|
-
};
|
|
251
|
-
const replayExceptionSchema = z
|
|
252
|
-
.object({
|
|
253
|
-
name: z.string(),
|
|
254
|
-
message: z.string(),
|
|
255
|
-
stack: z.string().nullable(),
|
|
256
|
-
})
|
|
257
|
-
.strict();
|
|
258
|
-
const replayOutcomeSchema = z.discriminatedUnion("outcome", [
|
|
259
|
-
z.strictObject({
|
|
260
|
-
...replayOutcomeFacts,
|
|
261
|
-
outcome: z.literal("return"),
|
|
262
|
-
value: z.json(),
|
|
263
|
-
output_sha256: digestSchema,
|
|
264
|
-
truncated: z.literal(false),
|
|
265
|
-
}),
|
|
266
|
-
z.strictObject({
|
|
267
|
-
...replayOutcomeFacts,
|
|
268
|
-
outcome: z.enum(["exception", "serialization_error", "denied"]),
|
|
269
|
-
exception: z.object(replayExceptionSchema.shape).strict(),
|
|
270
|
-
output_sha256: digestSchema,
|
|
271
|
-
truncated: z.literal(false),
|
|
272
|
-
}),
|
|
273
|
-
z.strictObject({
|
|
274
|
-
...replayOutcomeFacts,
|
|
275
|
-
outcome: z.enum(["timeout", "oom", "crash", "cancelled"]),
|
|
276
|
-
output_sha256: z.null(),
|
|
277
|
-
truncated: z.literal(false),
|
|
278
|
-
}),
|
|
279
|
-
z.strictObject({
|
|
280
|
-
...replayOutcomeFacts,
|
|
281
|
-
outcome: z.literal("protocol_error"),
|
|
282
|
-
output_sha256: z.null(),
|
|
283
|
-
truncated: z.literal(true),
|
|
284
|
-
}),
|
|
285
|
-
]);
|
|
286
|
-
export const replayExecutionResultSchema = z
|
|
287
|
-
.object({
|
|
288
|
-
plan_digest: digestSchema,
|
|
289
|
-
outcomes: z.array(replayOutcomeSchema),
|
|
290
|
-
comparison: z
|
|
291
|
-
.array(z
|
|
292
|
-
.object({
|
|
293
|
-
case_id: z.string(),
|
|
294
|
-
status: z.enum(["equal", "changed", "unknown"]),
|
|
295
|
-
left_index: z.number().int(),
|
|
296
|
-
right_index: z.number().int(),
|
|
297
|
-
})
|
|
298
|
-
.strict())
|
|
299
|
-
.optional(),
|
|
300
|
-
stderr: z.string(),
|
|
301
|
-
termination: z.enum([
|
|
302
|
-
"completed",
|
|
303
|
-
"timeout",
|
|
304
|
-
"oom",
|
|
305
|
-
"crash",
|
|
306
|
-
"cancelled",
|
|
307
|
-
"protocol_error",
|
|
308
|
-
]),
|
|
309
|
-
cleanup: z
|
|
310
|
-
.object({
|
|
311
|
-
state: z.enum(["complete", "incomplete"]),
|
|
312
|
-
residual_resources: z.array(z.string()),
|
|
313
|
-
})
|
|
314
|
-
.strict(),
|
|
315
|
-
limitations: z.array(z.string()),
|
|
316
|
-
reproducer: z
|
|
317
|
-
.discriminatedUnion("state", [
|
|
318
|
-
z
|
|
319
|
-
.object({
|
|
320
|
-
state: z.literal("written"),
|
|
321
|
-
path: z.string(),
|
|
322
|
-
sha256: digestSchema,
|
|
323
|
-
})
|
|
324
|
-
.strict(),
|
|
325
|
-
z
|
|
326
|
-
.object({
|
|
327
|
-
state: z.literal("failed"),
|
|
328
|
-
path: z.string(),
|
|
329
|
-
error: z.string(),
|
|
330
|
-
})
|
|
331
|
-
.strict(),
|
|
332
|
-
])
|
|
333
|
-
.nullable(),
|
|
334
|
-
})
|
|
335
|
-
.strict();
|
|
336
|
-
export const replayEvidenceSchema = evidenceEnvelopeSchema
|
|
337
|
-
.omit({ normalized_result: true })
|
|
338
|
-
.extend({ normalized_result: replayExecutionResultSchema });
|
|
339
|
-
/** A replay plan result with no claimed runtime observation. */
|
|
340
|
-
export const controlledReplayPlanOutputSchema = z.strictObject({
|
|
341
|
-
phase: z.literal("plan"),
|
|
342
|
-
plan: replayPlanSchema,
|
|
343
|
-
source_evidence: z
|
|
344
|
-
.array(replayEvidenceSchema)
|
|
345
|
-
.length(0)
|
|
346
|
-
.brand(),
|
|
347
|
-
evidence: z.null(),
|
|
348
|
-
});
|
|
349
|
-
/** An executed replay result with its required source and aggregate Evidence. */
|
|
350
|
-
export const controlledReplayExecutionOutputSchema = z.strictObject({
|
|
351
|
-
phase: z.literal("execute"),
|
|
352
|
-
plan: z.null(),
|
|
353
|
-
source_evidence: z.array(replayEvidenceSchema).min(1),
|
|
354
|
-
evidence: replayEvidenceSchema,
|
|
355
|
-
});
|
|
356
|
-
/** Parse replay output into its legal plan or execution state. */
|
|
357
|
-
export const controlledReplayOutputSchema = z.discriminatedUnion("phase", [
|
|
358
|
-
controlledReplayPlanOutputSchema,
|
|
359
|
-
controlledReplayExecutionOutputSchema,
|
|
360
|
-
]);
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import canonicalize from "canonicalize";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { evidenceSchema, parseEvidence } from "./evidence.js";
|
|
5
|
-
import { cliMetadataGuidSchema, managedMemberInspectionSchema, } from "./managedArtifact.js";
|
|
6
|
-
const digestSchema = z.string().regex(/^[a-f0-9]{64}$/u);
|
|
7
|
-
const evidenceIdSchema = z.string().regex(/^ev_[a-f0-9]{64}$/u);
|
|
8
|
-
const tokenSchema = z.string().regex(/^0x[0-9a-f]{8}$/u);
|
|
9
|
-
const boundedTextSchema = z.string().min(1);
|
|
10
|
-
const managedRuntimeEffectSchema = z.enum([
|
|
11
|
-
"attach",
|
|
12
|
-
"load",
|
|
13
|
-
"debugger",
|
|
14
|
-
"reflection",
|
|
15
|
-
"instrumentation",
|
|
16
|
-
]);
|
|
17
|
-
const managedRuntimeHostSchema = z.strictObject({
|
|
18
|
-
os: z.enum(["linux", "macos", "windows"]),
|
|
19
|
-
clr_family: z.enum(["dotnet", "dotnet-framework", "mono", "unknown"]),
|
|
20
|
-
architecture: z.enum(["x86", "x86_64", "arm", "arm64"]),
|
|
21
|
-
});
|
|
22
|
-
const managedRuntimeBoundsSchema = z.strictObject({
|
|
23
|
-
timeout_ms: z.number().int().min(1).default(5_000),
|
|
24
|
-
max_threads: z.number().int().min(1).default(32),
|
|
25
|
-
max_output_bytes: z.number().int().min(0).default(65_536),
|
|
26
|
-
allow_network: z.literal(false).default(false),
|
|
27
|
-
allow_ui: z.literal(false).default(false),
|
|
28
|
-
});
|
|
29
|
-
export const managedRuntimeCorrelationInputSchema = z.strictObject({
|
|
30
|
-
static_members: evidenceSchema,
|
|
31
|
-
method: z.strictObject({
|
|
32
|
-
token: tokenSchema,
|
|
33
|
-
signature_sha256: digestSchema,
|
|
34
|
-
normalized_il_sha256: digestSchema.nullable(),
|
|
35
|
-
}),
|
|
36
|
-
requested_effect: managedRuntimeEffectSchema,
|
|
37
|
-
host: managedRuntimeHostSchema,
|
|
38
|
-
bounds: managedRuntimeBoundsSchema.default({
|
|
39
|
-
timeout_ms: 5_000,
|
|
40
|
-
max_threads: 32,
|
|
41
|
-
max_output_bytes: 65_536,
|
|
42
|
-
allow_network: false,
|
|
43
|
-
allow_ui: false,
|
|
44
|
-
}),
|
|
45
|
-
});
|
|
46
|
-
export const managedRuntimeCorrelationResultSchema = z.strictObject({
|
|
47
|
-
correlation_id: z.string().regex(/^mrc_[a-f0-9]{64}$/u),
|
|
48
|
-
phase: z.literal("admission-plan"),
|
|
49
|
-
executed: z.literal(false),
|
|
50
|
-
authority_model: z.strictObject({
|
|
51
|
-
capability: z.literal("managed_runtime"),
|
|
52
|
-
permission_grant_id: z.string().min(1),
|
|
53
|
-
default_enabled: z.literal(false),
|
|
54
|
-
per_call_approval_required: z.literal(true),
|
|
55
|
-
}),
|
|
56
|
-
static_observation: z.strictObject({
|
|
57
|
-
evidence_id: evidenceIdSchema,
|
|
58
|
-
artifact_sha256: digestSchema,
|
|
59
|
-
artifact_path: z.string().min(1),
|
|
60
|
-
byte_length: z.number().int().min(0),
|
|
61
|
-
module_name: z.string().nullable(),
|
|
62
|
-
mvid: cliMetadataGuidSchema.nullable(),
|
|
63
|
-
metadata_status: z.enum(["absent", "complete", "partial", "malformed"]),
|
|
64
|
-
}),
|
|
65
|
-
method_lock: z.strictObject({
|
|
66
|
-
token: tokenSchema,
|
|
67
|
-
declaring_type: z.string().nullable(),
|
|
68
|
-
name: z.string(),
|
|
69
|
-
signature_sha256: digestSchema,
|
|
70
|
-
normalized_il_sha256: digestSchema.nullable(),
|
|
71
|
-
body_sha256: digestSchema.nullable(),
|
|
72
|
-
il_size: z.number().int().min(0),
|
|
73
|
-
body_status: z.enum([
|
|
74
|
-
"present",
|
|
75
|
-
"partial",
|
|
76
|
-
"absent",
|
|
77
|
-
"malformed",
|
|
78
|
-
"too-large",
|
|
79
|
-
]),
|
|
80
|
-
exact_build_required: z.literal(true),
|
|
81
|
-
}),
|
|
82
|
-
requested_runtime: z.strictObject({
|
|
83
|
-
effect: managedRuntimeEffectSchema,
|
|
84
|
-
host: managedRuntimeHostSchema,
|
|
85
|
-
executable_path: z.string().min(1),
|
|
86
|
-
network: z.literal("none"),
|
|
87
|
-
filesystem: z.literal("owned-artifacts-only"),
|
|
88
|
-
}),
|
|
89
|
-
effect_taxonomy: z.strictObject({
|
|
90
|
-
attaches_process: z.boolean(),
|
|
91
|
-
loads_target: z.boolean(),
|
|
92
|
-
uses_debugger: z.boolean(),
|
|
93
|
-
uses_reflection: z.boolean(),
|
|
94
|
-
instruments_code: z.boolean(),
|
|
95
|
-
invokes_target_code: z.literal(false),
|
|
96
|
-
}),
|
|
97
|
-
bounds: managedRuntimeBoundsSchema,
|
|
98
|
-
unsupported_until_executor_exists: z.literal(true),
|
|
99
|
-
evidence_links: z.array(evidenceIdSchema).length(1),
|
|
100
|
-
limitations: z.array(boundedTextSchema),
|
|
101
|
-
});
|
|
102
|
-
const sha256 = (value) => {
|
|
103
|
-
const serialized = canonicalize(value);
|
|
104
|
-
if (serialized === undefined)
|
|
105
|
-
throw new TypeError("Managed runtime correlation canonicalization failed");
|
|
106
|
-
return createHash("sha256").update(serialized).digest("hex");
|
|
107
|
-
};
|
|
108
|
-
/** Authenticate static managed Evidence and build a non-executing runtime plan. */
|
|
109
|
-
export const planManagedRuntimeCorrelation = (input, executablePath, permissionGrantId) => {
|
|
110
|
-
const staticEvidence = parseEvidence(input.static_members);
|
|
111
|
-
if (staticEvidence.operation !== "inspect_managed_members")
|
|
112
|
-
throw new TypeError("Evidence operation is not inspect_managed_members");
|
|
113
|
-
const members = managedMemberInspectionSchema.parse(staticEvidence.normalized_result);
|
|
114
|
-
const method = members.methods.find((item) => item.token === input.method.token &&
|
|
115
|
-
item.signature.raw_sha256 === input.method.signature_sha256 &&
|
|
116
|
-
item.body.status === "present" &&
|
|
117
|
-
item.body.normalized_il_sha256 !== null &&
|
|
118
|
-
input.method.normalized_il_sha256 !== null &&
|
|
119
|
-
item.body.normalized_il_sha256 === input.method.normalized_il_sha256);
|
|
120
|
-
if (method === undefined)
|
|
121
|
-
throw new TypeError("Requested method lock does not match a static managed member observation");
|
|
122
|
-
const withoutId = {
|
|
123
|
-
phase: "admission-plan",
|
|
124
|
-
executed: false,
|
|
125
|
-
authority_model: {
|
|
126
|
-
capability: "managed_runtime",
|
|
127
|
-
permission_grant_id: permissionGrantId,
|
|
128
|
-
default_enabled: false,
|
|
129
|
-
per_call_approval_required: true,
|
|
130
|
-
},
|
|
131
|
-
static_observation: {
|
|
132
|
-
evidence_id: staticEvidence.evidence_id,
|
|
133
|
-
artifact_sha256: members.artifact.sha256,
|
|
134
|
-
artifact_path: members.artifact.path,
|
|
135
|
-
byte_length: members.artifact.byte_length,
|
|
136
|
-
module_name: members.module?.name ?? null,
|
|
137
|
-
mvid: members.module?.mvid ?? null,
|
|
138
|
-
metadata_status: members.metadata.status,
|
|
139
|
-
},
|
|
140
|
-
method_lock: {
|
|
141
|
-
token: method.token,
|
|
142
|
-
declaring_type: method.declaring_type,
|
|
143
|
-
name: method.name,
|
|
144
|
-
signature_sha256: method.signature.raw_sha256,
|
|
145
|
-
normalized_il_sha256: method.body.normalized_il_sha256,
|
|
146
|
-
body_sha256: method.body.il_sha256,
|
|
147
|
-
il_size: method.body.il_size,
|
|
148
|
-
body_status: method.body.status,
|
|
149
|
-
exact_build_required: true,
|
|
150
|
-
},
|
|
151
|
-
requested_runtime: {
|
|
152
|
-
effect: input.requested_effect,
|
|
153
|
-
host: input.host,
|
|
154
|
-
executable_path: executablePath,
|
|
155
|
-
network: "none",
|
|
156
|
-
filesystem: "owned-artifacts-only",
|
|
157
|
-
},
|
|
158
|
-
effect_taxonomy: effectTaxonomy(input.requested_effect),
|
|
159
|
-
bounds: input.bounds,
|
|
160
|
-
unsupported_until_executor_exists: true,
|
|
161
|
-
evidence_links: [staticEvidence.evidence_id],
|
|
162
|
-
limitations: [
|
|
163
|
-
"This operation admits and records a runtime-correlation plan only; it did not attach, load, debug, reflect, instrument, invoke, or execute target code.",
|
|
164
|
-
"Runtime agreement would be a separate runtime observation and would not retroactively turn static inference into a byte observation.",
|
|
165
|
-
"The exact artifact SHA-256, MVID, method signature, and normalized IL shape must match before any future executor can run.",
|
|
166
|
-
"Network and UI effects are not admitted by this contract.",
|
|
167
|
-
],
|
|
168
|
-
};
|
|
169
|
-
return managedRuntimeCorrelationResultSchema.parse({
|
|
170
|
-
...withoutId,
|
|
171
|
-
correlation_id: `mrc_${sha256(withoutId)}`,
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
const effectTaxonomy = (effect) => ({
|
|
175
|
-
attaches_process: effect === "attach",
|
|
176
|
-
loads_target: effect === "load" || effect === "reflection",
|
|
177
|
-
uses_debugger: effect === "debugger",
|
|
178
|
-
uses_reflection: effect === "reflection",
|
|
179
|
-
instruments_code: effect === "instrumentation",
|
|
180
|
-
invokes_target_code: false,
|
|
181
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { controlledReplayExecutionOutputSchema, controlledReplayPlanInputSchema, controlledReplayPlanOutputSchema, } from "./javascriptReplay.js";
|
|
3
|
-
import { javascriptExportInstrumentationInputSchema, javascriptExportTransformationManifestSchema, } from "./javascriptExportInstrumentation.js";
|
|
4
|
-
import { runtimeCharacterizationPlanSchema } from "./runtimeCharacterization.js";
|
|
5
|
-
import { evidenceRecordSchema } from "./evidence.js";
|
|
6
|
-
const digestSchema = z.string().regex(/^[a-f0-9]{64}$/u);
|
|
7
|
-
const nodeCharacterizationExpectedEffectSchema = z.enum([
|
|
8
|
-
"pure",
|
|
9
|
-
"observation-only",
|
|
10
|
-
]);
|
|
11
|
-
const nodeRuntimeCharacterizationPlanSchema = runtimeCharacterizationPlanSchema.extend({
|
|
12
|
-
expected_effect: nodeCharacterizationExpectedEffectSchema,
|
|
13
|
-
});
|
|
14
|
-
export const nodeCharacterizationPreparationInputSchema = z
|
|
15
|
-
.strictObject({
|
|
16
|
-
selected_alias: z.string().min(1),
|
|
17
|
-
expected_effect: nodeCharacterizationExpectedEffectSchema,
|
|
18
|
-
instrumentation: javascriptExportInstrumentationInputSchema,
|
|
19
|
-
replay: controlledReplayPlanInputSchema,
|
|
20
|
-
})
|
|
21
|
-
.superRefine((input, context) => {
|
|
22
|
-
const selected = input.replay.left.modules.filter(({ alias }) => alias === input.selected_alias);
|
|
23
|
-
if (selected.length !== 1 ||
|
|
24
|
-
selected[0]?.path !== input.instrumentation.artifact_path ||
|
|
25
|
-
selected[0]?.format !== "commonjs-factory")
|
|
26
|
-
context.addIssue({
|
|
27
|
-
code: "custom",
|
|
28
|
-
path: ["selected_alias"],
|
|
29
|
-
message: "Selected alias must identify exactly one commonjs-factory instrumented artifact",
|
|
30
|
-
});
|
|
31
|
-
if (input.replay.left.entry_alias !== input.selected_alias)
|
|
32
|
-
context.addIssue({
|
|
33
|
-
code: "custom",
|
|
34
|
-
path: ["replay", "left", "entry_alias"],
|
|
35
|
-
message: "Instrumented alias must be the characterization entry",
|
|
36
|
-
});
|
|
37
|
-
if (input.replay.left.entry_export !==
|
|
38
|
-
input.instrumentation.selection.export_name)
|
|
39
|
-
context.addIssue({
|
|
40
|
-
code: "custom",
|
|
41
|
-
path: ["replay", "left", "entry_export"],
|
|
42
|
-
message: "Replay entry export must match the instrumented export",
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
export const nodeCharacterizationExecutionInputSchema = z.strictObject({
|
|
46
|
-
approved_plan_sha256: digestSchema,
|
|
47
|
-
preparation: nodeCharacterizationPreparationInputSchema,
|
|
48
|
-
});
|
|
49
|
-
export const nodeCharacterizationPreparationOutputSchema = z.strictObject({
|
|
50
|
-
phase: z.literal("preparation"),
|
|
51
|
-
plan: nodeRuntimeCharacterizationPlanSchema,
|
|
52
|
-
transformation: javascriptExportTransformationManifestSchema,
|
|
53
|
-
transformation_evidence: evidenceRecordSchema,
|
|
54
|
-
replay: controlledReplayPlanOutputSchema,
|
|
55
|
-
});
|
|
56
|
-
export const nodeCharacterizationExecutionOutputSchema = z.strictObject({
|
|
57
|
-
phase: z.literal("execution"),
|
|
58
|
-
plan: nodeRuntimeCharacterizationPlanSchema,
|
|
59
|
-
transformation: javascriptExportTransformationManifestSchema,
|
|
60
|
-
transformation_evidence: evidenceRecordSchema,
|
|
61
|
-
evidence: evidenceRecordSchema,
|
|
62
|
-
replay: controlledReplayExecutionOutputSchema,
|
|
63
|
-
});
|