rea-agents 1.7.0 → 2.1.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 +112 -59
- package/bridge/ghidra/ReaGhidraBridge.java +96 -11
- package/dist/application/ArtifactExtraction.js +1 -1
- package/dist/application/ArtifactInventory/classify.js +42 -0
- package/dist/application/ArtifactInventory/hash.js +43 -0
- package/dist/application/ArtifactInventory/reader.js +41 -0
- package/dist/application/ArtifactInventory/scanCanonical.js +155 -0
- package/dist/application/ArtifactInventory/scanReader.js +124 -0
- package/dist/application/ArtifactInventory/types.js +10 -0
- package/dist/application/ArtifactInventory.js +9 -351
- package/dist/application/AuthorizedArtifactInventory.js +2 -2
- package/dist/application/BinarySession.js +47 -270
- package/dist/application/BinarySessionExecution.js +28 -0
- package/dist/application/BinarySessionOpen.js +39 -0
- package/dist/application/BinarySessionRecords.js +149 -0
- package/dist/application/BinarySessionStatus.js +75 -0
- package/dist/application/CapabilityInventory.js +42 -2
- package/dist/application/ClientRegistrationStatus.js +1 -1
- package/dist/application/CrossVersionInventory.js +8 -2
- package/dist/application/CrossVersionInvestigation.js +11 -29
- package/dist/application/CrossVersionInvestigationCollections.js +23 -0
- package/dist/application/DirectAnalysis.js +47 -44
- package/dist/application/Doctor.js +165 -197
- package/dist/application/DoctorDiagnostics.js +180 -0
- package/dist/application/ElectronBoundaryAnalysis.js +112 -0
- package/dist/application/ElectronBoundaryGraph.js +9 -0
- package/dist/application/ElectronBoundaryGraphContext.js +62 -0
- package/dist/application/ElectronBoundaryGraphIpc.js +242 -0
- package/dist/application/ElectronBoundaryGraphNative.js +86 -0
- package/dist/application/ElectronBoundaryGraphWindows.js +223 -0
- package/dist/application/EnhancedToolPagination.js +22 -0
- package/dist/application/EnhancedToolTypes.js +4 -0
- package/dist/application/EnhancedTools.js +58 -50
- package/dist/application/InstrumentedJavaScriptReplayHost.js +36 -0
- package/dist/application/InvestigationProviders.js +30 -0
- package/dist/application/InvestigationWorkspaceStore.js +24 -10
- package/dist/application/JavaScriptApplicationEvidence.js +26 -0
- package/dist/application/JavaScriptApplicationEvidenceGraph.js +89 -0
- package/dist/application/JavaScriptApplicationService.js +74 -0
- package/dist/application/JavaScriptApplicationWorkflowEvidence.js +29 -0
- package/dist/application/JavaScriptApplicationWorkflowService.js +90 -0
- package/dist/application/JavaScriptArtifactAnalysis.js +52 -7
- package/dist/application/JavaScriptArtifactFiles.js +6 -2
- package/dist/application/JavaScriptArtifactGraphBuilder.js +82 -17
- package/dist/application/JavaScriptArtifactGraphBundlers.js +225 -0
- package/dist/application/JavaScriptArtifactGraphContext.js +37 -36
- package/dist/application/JavaScriptArtifactGraphDocuments.js +27 -4
- package/dist/application/JavaScriptArtifactGraphEvidence.js +24 -14
- package/dist/application/JavaScriptArtifactGraphFindings.js +54 -8
- package/dist/application/JavaScriptArtifactGraphStructure.js +29 -101
- package/dist/application/JavaScriptArtifactPathResolution.js +269 -0
- package/dist/application/JavaScriptArtifactReconstruction.js +4 -1
- package/dist/application/JavaScriptArtifactReconstructionInput.js +2 -83
- package/dist/application/JavaScriptJsonModules.js +39 -0
- package/dist/application/JavaScriptModuleRelationships.js +262 -0
- package/dist/application/JavaScriptReplayPermission.js +16 -0
- package/dist/application/JavaScriptReplayPlanning.js +201 -0
- package/dist/application/JavaScriptReplayService.js +292 -0
- package/dist/application/JavaScriptRuntimeReconciliationEvidence.js +25 -0
- package/dist/application/JavaScriptRuntimeReconciliationService.js +27 -0
- package/dist/application/LinuxHopper.js +10 -0
- package/dist/application/MacHopper.js +22 -11
- package/dist/application/ManagedApplicationGraphService.js +55 -0
- package/dist/application/ManagedMemberComparisonService.js +122 -0
- package/dist/application/ManagedNativeVerificationService.js +39 -0
- package/dist/application/ManagedReconstructionService.js +58 -0
- package/dist/application/ManagedRuntimeCorrelationService.js +103 -0
- package/dist/application/NodeRuntimeCharacterizationService.js +196 -0
- package/dist/application/PermissionAuthority.js +106 -63
- package/dist/application/ProcessCaptureCapability.js +1 -1
- package/dist/application/ProcessCapturePermission.js +13 -0
- package/dist/application/ProcessCli.js +2 -12
- package/dist/application/ProcessHarness.js +1 -1
- package/dist/application/ProcessSampling.js +15 -11
- package/dist/application/ProjectPermissionStore.js +49 -9
- package/dist/application/RealHopperAssertions.js +76 -0
- package/dist/application/ReconstructionCoverageService.js +69 -0
- package/dist/application/ReconstructionCoverageWorkspaceStore.js +31 -0
- package/dist/application/RuntimeExecutableDiagnostics.js +172 -0
- package/dist/application/Setup.js +147 -259
- package/dist/application/SetupClientConfiguration.js +220 -0
- package/dist/application/SetupClients.js +24 -2
- package/dist/application/SetupPlan.js +123 -12
- package/dist/application/SetupSkill.js +26 -12
- package/dist/application/SupportedClients.js +1 -0
- package/dist/application/Uninstall.js +6 -3
- package/dist/application/WindowsCapabilities.js +86 -0
- package/dist/application/runtime.js +2 -0
- package/dist/artifacts/AsarArtifactReader.js +11 -0
- package/dist/browser/BrowserProcessStartup.js +88 -0
- package/dist/browser/CdpCaptureDocuments.js +12 -8
- package/dist/browser/CdpCaptureEventBodyShapes.js +75 -0
- package/dist/browser/CdpCaptureEventHandlers.js +336 -0
- package/dist/browser/CdpCaptureEventHelpers.js +71 -0
- package/dist/browser/CdpCaptureEventState.js +1 -0
- package/dist/browser/CdpCaptureEventTypes.js +1 -0
- package/dist/browser/CdpCaptureEvents.js +46 -464
- package/dist/browser/CdpElectronInspection.js +106 -162
- package/dist/browser/CdpElectronProvider.js +5 -1
- package/dist/browser/CdpElectronScriptEvents.js +69 -0
- package/dist/browser/CdpElectronScripts.js +94 -0
- package/dist/browser/CdpElectronWorkers.js +56 -0
- package/dist/browser/CdpObservationSession.js +51 -8
- package/dist/browser/CdpPageCapture.js +12 -129
- package/dist/browser/CdpPageCaptureScripts.js +97 -0
- package/dist/browser/CdpPageCaptureWorkers.js +46 -0
- package/dist/browser/CdpWebMcpDiscovery.js +38 -14
- package/dist/browser/PngVisualDiff.js +9 -2
- package/dist/catalogIdentity.js +8 -1
- package/dist/cli/artifactCommands.js +82 -0
- package/dist/cli/coreAnalysisCommands.js +232 -0
- package/dist/cli/managedCommands.js +397 -0
- package/dist/cli/managedProjectGraphCommand.js +24 -0
- package/dist/cli/options.js +9 -0
- package/dist/cli/setupCommands.js +108 -0
- package/dist/cli/types.js +1 -0
- package/dist/cli/utilityCommands.js +122 -0
- package/dist/cli.js +13 -383
- package/dist/cliApplicationCommands.js +176 -0
- package/dist/cliBrowserAdvancedCommands.js +73 -16
- package/dist/cliBrowserCommands.js +39 -115
- package/dist/cliCommandNames.js +17 -0
- package/dist/cliElectronCommands.js +100 -27
- package/dist/cliEvidenceCommands.js +13 -2
- package/dist/cliInvestigationCommands.js +53 -10
- package/dist/cliJsonInput.js +54 -0
- package/dist/cliObservationOptions.js +137 -0
- package/dist/cliPolicyCommands.js +80 -46
- package/dist/cliSetup.js +289 -0
- package/dist/config/environment.js +107 -0
- package/dist/config/parseConfig.js +228 -0
- package/dist/config/parsers.js +68 -0
- package/dist/config/permissions.js +30 -0
- package/dist/config/types.js +1 -0
- package/dist/config.js +1 -292
- package/dist/contracts/applicationToolContracts.js +225 -0
- package/dist/contracts/artifactToolContracts.js +5 -9
- package/dist/contracts/browserToolContracts.js +14 -62
- package/dist/contracts/electronToolContracts.js +45 -19
- package/dist/contracts/errorSchemas.js +1 -0
- package/dist/contracts/investigationExamples.js +0 -6
- package/dist/contracts/javascriptApplicationWorkflowExamples.js +46 -0
- package/dist/contracts/javascriptRuntimeReconciliationExample.js +208 -0
- package/dist/contracts/managedToolContracts.js +153 -0
- package/dist/contracts/managedWorkflowExamples.js +346 -0
- package/dist/contracts/managedWorkflowToolContracts.js +203 -0
- package/dist/contracts/nativeToolContracts.js +2 -6
- package/dist/contracts/promptContracts.js +18 -2
- package/dist/contracts/providerSelection.js +2 -0
- package/dist/contracts/toolContractExamples.js +10 -25
- package/dist/contracts/toolContracts.js +49 -47
- package/dist/contracts/toolEffects.js +174 -0
- package/dist/contracts/toolOutputSchemaGroups.js +232 -0
- package/dist/contracts/toolOutputSchemaPrimitives.js +327 -0
- package/dist/contracts/toolOutputSchemas.js +2 -535
- package/dist/doctorRuntime.js +42 -1
- package/dist/domain/analysisErrorPresentation.js +234 -0
- package/dist/domain/analysisErrorProjection.js +284 -0
- package/dist/domain/artifactComparison.js +37 -19
- package/dist/domain/binaryTarget.js +87 -37
- package/dist/domain/browserObservation.js +1 -282
- package/dist/domain/browserObservationSchemas.js +286 -0
- package/dist/domain/bundleComparison.js +4 -4
- package/dist/domain/electronObservation.js +13 -0
- package/dist/domain/electronStaticAnalysis.js +9 -0
- package/dist/domain/electronStaticAnalysisBrowser.js +206 -0
- package/dist/domain/electronStaticAnalysisIpc.js +171 -0
- package/dist/domain/electronStaticAnalysisNative.js +164 -0
- package/dist/domain/electronStaticAnalysisTypes.js +1 -0
- package/dist/domain/electronStaticAnalysisValues.js +103 -0
- package/dist/domain/errors.js +32 -448
- package/dist/domain/functionComparison.js +4 -165
- package/dist/domain/functionComparisonDimensions.js +164 -0
- package/dist/domain/functionComparisonSchemas.js +3 -8
- package/dist/domain/inputIssueProjection.js +52 -0
- package/dist/domain/javascriptApplicationAnalysis.js +155 -0
- package/dist/domain/javascriptApplicationChangeGraph.js +231 -0
- package/dist/domain/javascriptApplicationEvidenceSchemas.js +18 -0
- package/dist/domain/javascriptApplicationGraph.js +2 -1
- package/dist/domain/javascriptApplicationGraphSchemas.js +7 -0
- package/dist/domain/javascriptApplicationVersionComparison.js +116 -0
- package/dist/domain/javascriptApplicationVersionComparisonSchemas.js +139 -0
- package/dist/domain/javascriptApplicationVersionItems.js +233 -0
- package/dist/domain/javascriptApplicationVersionKeys.js +170 -0
- package/dist/domain/javascriptExportInstrumentation.js +97 -0
- package/dist/domain/javascriptFeatureSeed.js +140 -0
- package/dist/domain/javascriptFeatureTrace.js +232 -0
- package/dist/domain/javascriptFeatureTraceSchemas.js +136 -0
- package/dist/domain/javascriptFeatureTraversal.js +100 -0
- package/dist/domain/javascriptNativeHandoff.js +85 -0
- package/dist/domain/javascriptReplay.js +361 -0
- package/dist/domain/javascriptRuntimeLoadState.js +106 -0
- package/dist/domain/javascriptRuntimeReconciliation.js +42 -0
- package/dist/domain/javascriptRuntimeReconciliationGraph.js +169 -0
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +247 -0
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +160 -0
- package/dist/domain/javascriptRuntimeReconciliationResult.js +119 -0
- package/dist/domain/javascriptRuntimeReconciliationRuntime.js +316 -0
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +245 -0
- package/dist/domain/javascriptRuntimeStaticCandidates.js +193 -0
- package/dist/domain/javascriptSemanticAnalysis.js +386 -0
- package/dist/domain/javascriptSemanticIr.js +30 -0
- package/dist/domain/javascriptSemanticProjection.js +366 -0
- package/dist/domain/javascriptSemanticState.js +40 -0
- package/dist/domain/javascriptSemanticTraversal.js +22 -0
- package/dist/domain/javascriptSemanticValues.js +352 -0
- package/dist/domain/javascriptStaticAnalysis.js +26 -254
- package/dist/domain/javascriptStaticAnalysisBundler.js +209 -0
- package/dist/domain/javascriptStaticAnalysisCalls.js +180 -0
- package/dist/domain/javascriptStaticAnalysisFindings.js +39 -0
- package/dist/domain/javascriptStaticAnalysisHelpers.js +81 -2
- package/dist/domain/javascriptStaticAnalysisState.js +6 -0
- package/dist/domain/knownPageCoverage.js +21 -0
- package/dist/domain/managedApplicationGraph.js +206 -0
- package/dist/domain/managedApplicationGraphCoverage.js +170 -0
- package/dist/domain/managedApplicationGraphNodeCoverage.js +6 -0
- package/dist/domain/managedApplicationGraphNodes.js +336 -0
- package/dist/domain/managedArtifact.js +452 -0
- package/dist/domain/managedMemberComparison.js +211 -0
- package/dist/domain/managedMemberComparisonCoverage.js +72 -0
- package/dist/domain/managedMemberComparisonMatch.js +356 -0
- package/dist/domain/managedNativeVerification.js +46 -0
- package/dist/domain/managedNativeVerificationMatch.js +272 -0
- package/dist/domain/managedNativeVerificationSchemas.js +141 -0
- package/dist/domain/managedReconstruction.js +196 -0
- package/dist/domain/managedRuntimeCorrelation.js +184 -0
- package/dist/domain/nodeRuntimeCharacterization.js +66 -0
- package/dist/domain/permissionPolicy.js +2 -0
- package/dist/domain/reconstructionCoverage.js +387 -0
- package/dist/domain/reconstructionCoverageEvaluation.js +212 -0
- package/dist/domain/reconstructionVerificationSchemas.js +9 -3
- package/dist/domain/runtimeCharacterization.js +85 -0
- package/dist/domain/webBundleAnalyzer.js +3 -409
- package/dist/domain/webBundleAnalyzerAst.js +77 -0
- package/dist/domain/webBundleAnalyzerInspection.js +307 -0
- package/dist/domain/webBundleAnalyzerResult.js +120 -0
- package/dist/dotnet/ManagedArtifactInspector.js +339 -0
- package/dist/dotnet/ManagedMemberInspector.js +153 -0
- package/dist/dotnet/ManagedMemberInspectorCore.js +297 -0
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +427 -0
- package/dist/dotnet/ManagedMemberRows.js +120 -0
- package/dist/dotnet/ManagedMetadataHeaps.js +131 -0
- package/dist/dotnet/ManagedMetadataInventory.js +104 -0
- package/dist/dotnet/ManagedMetadataInventoryRows.js +292 -0
- package/dist/dotnet/ManagedMetadataLayout.js +259 -0
- package/dist/dotnet/ManagedMetadataRowSizes.js +54 -0
- package/dist/dotnet/ManagedMethodBodyReader.js +143 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +311 -0
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +143 -0
- package/dist/dotnet/ManagedPeReader.js +188 -0
- package/dist/dotnet/ManagedReaderFailure.js +10 -0
- package/dist/dotnet/ManagedStaticProvider.js +203 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraClient.js +76 -91
- package/dist/ghidra/GhidraClientStartup.js +29 -0
- package/dist/ghidra/GhidraClientWire.js +34 -0
- package/dist/ghidra/GhidraDefaults.js +1 -1
- package/dist/ghidra/GhidraDiagnostics.js +6 -1
- package/dist/ghidra/GhidraInstallation.js +20 -15
- package/dist/ghidra/GhidraLauncher.js +93 -29
- package/dist/ghidra/GhidraProvider.js +67 -161
- package/dist/ghidra/GhidraProviderCapabilities.js +173 -0
- package/dist/ghidra/GhidraSessionValues.js +2 -0
- package/dist/ghidra/GhidraSocketConnection.js +44 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +30 -0
- package/dist/ghidra/GhidraTransport.js +71 -0
- package/dist/identity.js +3 -2
- package/dist/main/messages.js +5 -0
- package/dist/main/reload.js +49 -0
- package/dist/main/shutdown.js +25 -0
- package/dist/main/startup.js +14 -0
- package/dist/main/state.js +26 -0
- package/dist/main/transport.js +61 -0
- package/dist/main/types.js +1 -0
- package/dist/main.js +35 -132
- package/dist/process/PrivateRuntimeRoot.js +3 -2
- package/dist/process/ProcessOwnership.js +35 -0
- package/dist/process/ProviderProcess.js +2 -0
- package/dist/replay/JavaScriptReplayWorker.js +300 -0
- package/dist/replay/LinuxJavaScriptReplayRunner.js +217 -0
- package/dist/replay/LinuxJavaScriptReplaySandbox.js +140 -0
- package/dist/replay/LinuxRuntimeClosure.js +46 -0
- package/dist/replay/LinuxSeccompPolicy.js +40 -0
- package/dist/replay/ReplayOutcome.js +95 -0
- package/dist/replay/ReplayProcessLifecycle.js +71 -0
- package/dist/replay/ReplayWorkerProtocol.js +55 -0
- package/dist/replay/SystemJavaScriptReplayHost.js +182 -0
- package/dist/server/ProcessCaptureElicitation.js +157 -0
- package/dist/server/createServer.js +158 -41
- package/dist/server/registerApplicationTools/characterization.js +57 -0
- package/dist/server/registerApplicationTools/compareVersions.js +34 -0
- package/dist/server/registerApplicationTools/controlledReplay.js +38 -0
- package/dist/server/registerApplicationTools/coverage.js +84 -0
- package/dist/server/registerApplicationTools/helpers.js +42 -0
- package/dist/server/registerApplicationTools/traceFeature.js +26 -0
- package/dist/server/registerApplicationTools/types.js +1 -0
- package/dist/server/registerApplicationTools.js +13 -0
- package/dist/server/registerArtifactComparisonTool.js +16 -9
- package/dist/server/registerBrowserTools.js +61 -60
- package/dist/server/registerBundleComparisonTool.js +17 -20
- package/dist/server/registerElectronTools.js +39 -12
- package/dist/server/registerEnhancedTools.js +52 -15
- package/dist/server/registerEvidenceResources.js +54 -0
- package/dist/server/registerEvidenceTools.js +5 -1
- package/dist/server/registerFunctionComparisonTool.js +14 -7
- package/dist/server/registerInvestigationTools/helpers.js +74 -0
- package/dist/server/registerInvestigationTools/types.js +1 -0
- package/dist/server/registerInvestigationTools.js +103 -132
- package/dist/server/registerManagedTools.js +6 -0
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +65 -0
- package/dist/server/registerManagedWorkflowTools/contract.js +8 -0
- package/dist/server/registerManagedWorkflowTools/evidence.js +43 -0
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +39 -0
- package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +39 -0
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +52 -0
- package/dist/server/registerManagedWorkflowTools/types.js +1 -0
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +75 -0
- package/dist/server/registerManagedWorkflowTools.js +13 -0
- package/dist/server/registerOfficialTools.js +81 -67
- package/dist/server/registerProcessComparisonTool.js +25 -47
- package/dist/server/registerSessionRecordTools.js +137 -0
- package/dist/server/registerSessionStatusTool.js +9 -8
- package/dist/server/registerSessionTools.js +77 -216
- package/dist/server/sessionAvailabilityPolicy.js +10 -0
- package/dist/server/sessionEvidence.js +14 -19
- package/dist/server/toolInputValidation.js +77 -0
- package/dist/server/toolRegistrationOptions.js +177 -2
- package/dist/server/toolResult.js +30 -17
- package/package.json +21 -14
- package/scripts/rea.mjs +1 -1
- package/skills/{rea-analysis → reverse-engineer-anything}/SKILL.md +75 -6
- package/scripts/prepare-node-pty.mjs +0 -35
- package/scripts/rebuild-native.mjs +0 -22
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { managedOutputSchemas } from "./toolOutputSchemas.js";
|
|
3
|
+
import { toolContractMetadata } from "./toolEffects.js";
|
|
4
|
+
/** Exact caller boundary for execution-free PE/CLI triage and identity. */
|
|
5
|
+
export const managedArtifactInputSchema = z.object({
|
|
6
|
+
reference_offset: z.number().int().min(0).default(0),
|
|
7
|
+
reference_limit: z.number().int().min(1).max(500).default(100),
|
|
8
|
+
resource_offset: z.number().int().min(0).default(0),
|
|
9
|
+
resource_limit: z.number().int().min(1).max(500).default(100),
|
|
10
|
+
attribute_offset: z.number().int().min(0).default(0),
|
|
11
|
+
attribute_limit: z.number().int().min(1).max(500).default(100),
|
|
12
|
+
max_file_bytes: z
|
|
13
|
+
.number()
|
|
14
|
+
.int()
|
|
15
|
+
.min(4_096)
|
|
16
|
+
.max(1_073_741_824)
|
|
17
|
+
.default(268_435_456),
|
|
18
|
+
max_metadata_bytes: z
|
|
19
|
+
.number()
|
|
20
|
+
.int()
|
|
21
|
+
.min(256)
|
|
22
|
+
.max(268_435_456)
|
|
23
|
+
.default(67_108_864),
|
|
24
|
+
max_table_rows: z.number().int().min(1).max(1_000_000).default(100_000),
|
|
25
|
+
max_heap_item_bytes: z
|
|
26
|
+
.number()
|
|
27
|
+
.int()
|
|
28
|
+
.min(1)
|
|
29
|
+
.max(16_777_216)
|
|
30
|
+
.default(1_048_576),
|
|
31
|
+
});
|
|
32
|
+
/** Exact caller boundary for execution-free metadata/signature/IL inspection. */
|
|
33
|
+
export const managedMemberInputSchema = z.object({
|
|
34
|
+
type_offset: z.number().int().min(0).default(0),
|
|
35
|
+
type_limit: z.number().int().min(1).max(500).default(100),
|
|
36
|
+
method_offset: z.number().int().min(0).default(0),
|
|
37
|
+
method_limit: z.number().int().min(1).max(500).default(100),
|
|
38
|
+
field_offset: z.number().int().min(0).default(0),
|
|
39
|
+
field_limit: z.number().int().min(1).max(500).default(100),
|
|
40
|
+
member_ref_offset: z.number().int().min(0).default(0),
|
|
41
|
+
member_ref_limit: z.number().int().min(1).max(500).default(100),
|
|
42
|
+
edge_offset: z.number().int().min(0).default(0),
|
|
43
|
+
edge_limit: z.number().int().min(1).max(1_000).default(250),
|
|
44
|
+
instruction_anchor_limit: z.number().int().min(0).max(500).default(100),
|
|
45
|
+
max_file_bytes: z
|
|
46
|
+
.number()
|
|
47
|
+
.int()
|
|
48
|
+
.min(4_096)
|
|
49
|
+
.max(1_073_741_824)
|
|
50
|
+
.default(268_435_456),
|
|
51
|
+
max_metadata_bytes: z
|
|
52
|
+
.number()
|
|
53
|
+
.int()
|
|
54
|
+
.min(256)
|
|
55
|
+
.max(268_435_456)
|
|
56
|
+
.default(67_108_864),
|
|
57
|
+
max_table_rows: z.number().int().min(1).max(1_000_000).default(100_000),
|
|
58
|
+
max_heap_item_bytes: z
|
|
59
|
+
.number()
|
|
60
|
+
.int()
|
|
61
|
+
.min(1)
|
|
62
|
+
.max(16_777_216)
|
|
63
|
+
.default(1_048_576),
|
|
64
|
+
max_method_body_bytes: z
|
|
65
|
+
.number()
|
|
66
|
+
.int()
|
|
67
|
+
.min(1)
|
|
68
|
+
.max(16_777_216)
|
|
69
|
+
.default(1_048_576),
|
|
70
|
+
max_method_instructions: z.number().int().min(1).max(100_000).default(10_000),
|
|
71
|
+
});
|
|
72
|
+
/** Exact caller boundary for execution-free managed/native boundary inspection. */
|
|
73
|
+
export const managedNativeBoundaryInputSchema = z.object({
|
|
74
|
+
module_ref_offset: z.number().int().min(0).default(0),
|
|
75
|
+
module_ref_limit: z.number().int().min(1).max(500).default(100),
|
|
76
|
+
import_offset: z.number().int().min(0).default(0),
|
|
77
|
+
import_limit: z.number().int().min(1).max(500).default(100),
|
|
78
|
+
implementation_offset: z.number().int().min(0).default(0),
|
|
79
|
+
implementation_limit: z.number().int().min(1).max(500).default(100),
|
|
80
|
+
max_file_bytes: z
|
|
81
|
+
.number()
|
|
82
|
+
.int()
|
|
83
|
+
.min(4_096)
|
|
84
|
+
.max(1_073_741_824)
|
|
85
|
+
.default(268_435_456),
|
|
86
|
+
max_metadata_bytes: z
|
|
87
|
+
.number()
|
|
88
|
+
.int()
|
|
89
|
+
.min(256)
|
|
90
|
+
.max(268_435_456)
|
|
91
|
+
.default(67_108_864),
|
|
92
|
+
max_table_rows: z.number().int().min(1).max(1_000_000).default(100_000),
|
|
93
|
+
max_heap_item_bytes: z
|
|
94
|
+
.number()
|
|
95
|
+
.int()
|
|
96
|
+
.min(1)
|
|
97
|
+
.max(16_777_216)
|
|
98
|
+
.default(1_048_576),
|
|
99
|
+
});
|
|
100
|
+
const outputSchema = managedOutputSchemas.inspect_managed_artifact;
|
|
101
|
+
if (outputSchema === undefined)
|
|
102
|
+
throw new Error("Missing managed output schema for inspect_managed_artifact");
|
|
103
|
+
const memberOutputSchema = managedOutputSchemas.inspect_managed_members;
|
|
104
|
+
if (memberOutputSchema === undefined)
|
|
105
|
+
throw new Error("Missing managed output schema for inspect_managed_members");
|
|
106
|
+
const nativeBoundaryOutputSchema = managedOutputSchemas.inspect_managed_native_boundaries;
|
|
107
|
+
if (nativeBoundaryOutputSchema === undefined)
|
|
108
|
+
throw new Error("Missing managed output schema for inspect_managed_native_boundaries");
|
|
109
|
+
/** Read-only managed artifact contracts. */
|
|
110
|
+
export const MANAGED_TOOL_CONTRACTS = [
|
|
111
|
+
{
|
|
112
|
+
name: "inspect_managed_artifact",
|
|
113
|
+
...toolContractMetadata("inspect_managed_artifact"),
|
|
114
|
+
description: "Classify the active PE/CLI artifact and inventory exact assembly/module identity, target framework evidence, references, resources, and custom attributes without loading or executing target code. Returns bounded pages and explicit partial or malformed coverage.",
|
|
115
|
+
kind: "managed-provider",
|
|
116
|
+
inputSchema: managedArtifactInputSchema,
|
|
117
|
+
outputSchema,
|
|
118
|
+
examples: [
|
|
119
|
+
{
|
|
120
|
+
title: "Example inspect managed artifact request",
|
|
121
|
+
input: {},
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "inspect_managed_members",
|
|
127
|
+
...toolContractMetadata("inspect_managed_members"),
|
|
128
|
+
description: "Inspect bounded PE/CLI metadata members, signatures, raw CIL hashes, limited member-result-v1 decoded-instruction-tuple hashes, separately reported exception regions, call edges, and field-access anchors without loading or executing target code. Metadata tokens are reported as build-local coordinates bound to the artifact SHA-256 and MVID; the v1 tuple hash does not resolve them or fully commit control flow.",
|
|
129
|
+
kind: "managed-provider",
|
|
130
|
+
inputSchema: managedMemberInputSchema,
|
|
131
|
+
outputSchema: memberOutputSchema,
|
|
132
|
+
examples: [
|
|
133
|
+
{
|
|
134
|
+
title: "Example inspect managed members request",
|
|
135
|
+
input: { method_limit: 25, edge_limit: 100 },
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "inspect_managed_native_boundaries",
|
|
141
|
+
...toolContractMetadata("inspect_managed_native_boundaries"),
|
|
142
|
+
description: "Inspect PE/CLI ModuleRef, ImplMap/PInvoke declarations, CLI native-header indicators, and non-IL method implementation flags without loading or executing target code. Results are managed declarations and degraded native-boundary observations, not verified native exports or addresses.",
|
|
143
|
+
kind: "managed-provider",
|
|
144
|
+
inputSchema: managedNativeBoundaryInputSchema,
|
|
145
|
+
outputSchema: nativeBoundaryOutputSchema,
|
|
146
|
+
examples: [
|
|
147
|
+
{
|
|
148
|
+
title: "Example inspect managed/native boundary request",
|
|
149
|
+
input: { import_limit: 50, implementation_limit: 50 },
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
];
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { createEvidence } from "../domain/evidence.js";
|
|
2
|
+
const MANAGED_STATIC_EXAMPLE_PROVIDER = {
|
|
3
|
+
id: "rea-dotnet-static",
|
|
4
|
+
name: "REA managed static analysis provider",
|
|
5
|
+
version: "1",
|
|
6
|
+
};
|
|
7
|
+
const NATIVE_EXAMPLE_PROVIDER = {
|
|
8
|
+
id: "native-macos",
|
|
9
|
+
name: "REA native macOS provider",
|
|
10
|
+
version: "1",
|
|
11
|
+
};
|
|
12
|
+
const emptyManagedMembers = (sha256, mvid) => ({
|
|
13
|
+
schema_version: 1,
|
|
14
|
+
artifact: {
|
|
15
|
+
path: `/examples/${sha256.slice(0, 8)}.dll`,
|
|
16
|
+
sha256,
|
|
17
|
+
byte_length: 4096,
|
|
18
|
+
format: "pe",
|
|
19
|
+
},
|
|
20
|
+
module: {
|
|
21
|
+
name: "Example.dll",
|
|
22
|
+
generation: 0,
|
|
23
|
+
mvid,
|
|
24
|
+
enc_id: null,
|
|
25
|
+
enc_base_id: null,
|
|
26
|
+
token: "0x00000001",
|
|
27
|
+
row_offset: 0,
|
|
28
|
+
},
|
|
29
|
+
metadata: {
|
|
30
|
+
status: "complete",
|
|
31
|
+
version: "v4.0.30319",
|
|
32
|
+
table_row_counts: {},
|
|
33
|
+
},
|
|
34
|
+
identity_scope: {
|
|
35
|
+
token_identity: "build-local",
|
|
36
|
+
requires_artifact_sha256: sha256,
|
|
37
|
+
requires_mvid: mvid,
|
|
38
|
+
},
|
|
39
|
+
types: emptyPage(100),
|
|
40
|
+
fields: emptyPage(100),
|
|
41
|
+
methods: emptyPage(100),
|
|
42
|
+
member_refs: emptyPage(100),
|
|
43
|
+
call_edges: emptyPage(250),
|
|
44
|
+
field_accesses: emptyPage(250),
|
|
45
|
+
coverage: { state: "complete", issues: [] },
|
|
46
|
+
limitations: [],
|
|
47
|
+
});
|
|
48
|
+
const emptyPage = (limit) => ({
|
|
49
|
+
items: [],
|
|
50
|
+
offset: 0,
|
|
51
|
+
limit,
|
|
52
|
+
total: 0,
|
|
53
|
+
returned: 0,
|
|
54
|
+
dropped: 0,
|
|
55
|
+
complete: true,
|
|
56
|
+
});
|
|
57
|
+
const evidence = (result) => createEvidence(undefined, MANAGED_STATIC_EXAMPLE_PROVIDER, {
|
|
58
|
+
operation: "inspect_managed_members",
|
|
59
|
+
parameters: {},
|
|
60
|
+
result,
|
|
61
|
+
rawResult: null,
|
|
62
|
+
limitations: result.limitations,
|
|
63
|
+
});
|
|
64
|
+
const runtimeMembers = () => {
|
|
65
|
+
const result = emptyManagedMembers("2".repeat(64), "11112222-3333-4444-9555-666677778888");
|
|
66
|
+
return {
|
|
67
|
+
...result,
|
|
68
|
+
methods: {
|
|
69
|
+
...result.methods,
|
|
70
|
+
items: [
|
|
71
|
+
{
|
|
72
|
+
token: "0x06000001",
|
|
73
|
+
row_offset: 128,
|
|
74
|
+
declaring_type_token: "0x02000001",
|
|
75
|
+
declaring_type: "Example.Program",
|
|
76
|
+
name: "Main",
|
|
77
|
+
rva: 8192,
|
|
78
|
+
impl_flags: 0,
|
|
79
|
+
flags: 22,
|
|
80
|
+
signature: {
|
|
81
|
+
raw_length: 3,
|
|
82
|
+
raw_sha256: "3".repeat(64),
|
|
83
|
+
kind: "method",
|
|
84
|
+
parse_status: "decoded",
|
|
85
|
+
calling_convention: "default",
|
|
86
|
+
generic_parameter_count: 0,
|
|
87
|
+
parameter_count: 0,
|
|
88
|
+
return_type: "void",
|
|
89
|
+
parameter_types: [],
|
|
90
|
+
field_type: null,
|
|
91
|
+
issue: null,
|
|
92
|
+
},
|
|
93
|
+
body: {
|
|
94
|
+
status: "present",
|
|
95
|
+
header_format: "tiny",
|
|
96
|
+
rva: 8192,
|
|
97
|
+
file_offset: 512,
|
|
98
|
+
max_stack: 8,
|
|
99
|
+
init_locals: false,
|
|
100
|
+
local_var_sig_token: null,
|
|
101
|
+
il_size: 1,
|
|
102
|
+
il_sha256: "4".repeat(64),
|
|
103
|
+
normalized_il_sha256: "5".repeat(64),
|
|
104
|
+
instruction_count: 1,
|
|
105
|
+
decoded_instruction_count: 1,
|
|
106
|
+
truncated_instructions: 0,
|
|
107
|
+
opcode_counts: { ret: 1 },
|
|
108
|
+
anchors: [],
|
|
109
|
+
exception_regions: [],
|
|
110
|
+
issue: null,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
total: 1,
|
|
115
|
+
returned: 1,
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
/** Minimal valid managed member comparison request for public contracts. */
|
|
120
|
+
export const MANAGED_MEMBER_COMPARISON_EXAMPLE = {
|
|
121
|
+
left: evidence(emptyManagedMembers("0".repeat(64), "00112233-4455-6677-8899-aabbccddeeff")),
|
|
122
|
+
right: evidence(emptyManagedMembers("1".repeat(64), "ffeeddcc-bbaa-4988-9766-554433221100")),
|
|
123
|
+
limits: {
|
|
124
|
+
max_method_matches: 100,
|
|
125
|
+
max_field_matches: 50,
|
|
126
|
+
max_candidates: 25,
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
const runtimeExampleEvidence = evidence(runtimeMembers());
|
|
130
|
+
/** Minimal valid managed application graph projection request. */
|
|
131
|
+
export const MANAGED_APPLICATION_GRAPH_EXAMPLE = {
|
|
132
|
+
managed_members: runtimeExampleEvidence,
|
|
133
|
+
limits: {
|
|
134
|
+
max_types: 100,
|
|
135
|
+
max_methods: 100,
|
|
136
|
+
max_fields: 100,
|
|
137
|
+
max_pinvoke_imports: 100,
|
|
138
|
+
max_native_implementations: 100,
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
const boundaryEvidence = () => {
|
|
142
|
+
const result = {
|
|
143
|
+
schema_version: 1,
|
|
144
|
+
artifact: {
|
|
145
|
+
path: "/examples/ManagedInterop.exe",
|
|
146
|
+
sha256: "6".repeat(64),
|
|
147
|
+
byte_length: 8192,
|
|
148
|
+
format: "pe",
|
|
149
|
+
},
|
|
150
|
+
module: {
|
|
151
|
+
name: "ManagedInterop.exe",
|
|
152
|
+
generation: 0,
|
|
153
|
+
mvid: "00112233-4455-4677-8899-aabbccddeeff",
|
|
154
|
+
enc_id: null,
|
|
155
|
+
enc_base_id: null,
|
|
156
|
+
token: "0x00000001",
|
|
157
|
+
row_offset: 0,
|
|
158
|
+
},
|
|
159
|
+
metadata: {
|
|
160
|
+
status: "complete",
|
|
161
|
+
version: "v4.0.30319",
|
|
162
|
+
table_row_counts: {},
|
|
163
|
+
},
|
|
164
|
+
identity_scope: {
|
|
165
|
+
token_identity: "build-local",
|
|
166
|
+
requires_artifact_sha256: "6".repeat(64),
|
|
167
|
+
requires_mvid: "00112233-4455-4677-8899-aabbccddeeff",
|
|
168
|
+
},
|
|
169
|
+
cli_native: {
|
|
170
|
+
il_only: true,
|
|
171
|
+
requires_32bit: false,
|
|
172
|
+
strong_name_signed: false,
|
|
173
|
+
native_entry_point: false,
|
|
174
|
+
ready_to_run_signature: false,
|
|
175
|
+
managed_native_header_rva: 0,
|
|
176
|
+
managed_native_header_size: 0,
|
|
177
|
+
},
|
|
178
|
+
module_refs: {
|
|
179
|
+
items: [
|
|
180
|
+
{
|
|
181
|
+
token: "0x1a000001",
|
|
182
|
+
row_offset: 256,
|
|
183
|
+
name: "nativehelper.dll",
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
offset: 0,
|
|
187
|
+
limit: 100,
|
|
188
|
+
total: 1,
|
|
189
|
+
returned: 1,
|
|
190
|
+
dropped: 0,
|
|
191
|
+
complete: true,
|
|
192
|
+
},
|
|
193
|
+
pinvoke_imports: {
|
|
194
|
+
items: [
|
|
195
|
+
{
|
|
196
|
+
token: "0x1c000001",
|
|
197
|
+
row_offset: 288,
|
|
198
|
+
mapping_flags: 0,
|
|
199
|
+
mapping_flags_hex: "0x0000",
|
|
200
|
+
member_token: "0x06000001",
|
|
201
|
+
member_kind: "method",
|
|
202
|
+
member_name: "OpenNative",
|
|
203
|
+
import_name: "open_native",
|
|
204
|
+
import_scope_token: "0x1a000001",
|
|
205
|
+
import_scope_name: "nativehelper.dll",
|
|
206
|
+
no_mangle: true,
|
|
207
|
+
char_set: "not-specified",
|
|
208
|
+
call_convention: "cdecl",
|
|
209
|
+
supports_last_error: false,
|
|
210
|
+
best_fit: "assembly-default",
|
|
211
|
+
throw_on_unmappable_char: "assembly-default",
|
|
212
|
+
verification: "managed-declaration-only",
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
offset: 0,
|
|
216
|
+
limit: 100,
|
|
217
|
+
total: 1,
|
|
218
|
+
returned: 1,
|
|
219
|
+
dropped: 0,
|
|
220
|
+
complete: true,
|
|
221
|
+
},
|
|
222
|
+
native_implementations: emptyPage(100),
|
|
223
|
+
summary: {
|
|
224
|
+
module_ref_count: 1,
|
|
225
|
+
pinvoke_import_count: 1,
|
|
226
|
+
native_implementation_count: 0,
|
|
227
|
+
ready_to_run: false,
|
|
228
|
+
mixed_mode_or_native_header: false,
|
|
229
|
+
},
|
|
230
|
+
coverage: { state: "complete", issues: [] },
|
|
231
|
+
limitations: [],
|
|
232
|
+
};
|
|
233
|
+
return createEvidence(undefined, MANAGED_STATIC_EXAMPLE_PROVIDER, {
|
|
234
|
+
operation: "inspect_managed_native_boundaries",
|
|
235
|
+
parameters: {},
|
|
236
|
+
result,
|
|
237
|
+
rawResult: null,
|
|
238
|
+
limitations: result.limitations,
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
const nativeExportEvidence = () => {
|
|
242
|
+
const result = {
|
|
243
|
+
format: "mach-o",
|
|
244
|
+
endian: "little",
|
|
245
|
+
word_size: 64,
|
|
246
|
+
file_type: "dylib",
|
|
247
|
+
flags: [],
|
|
248
|
+
uuid: null,
|
|
249
|
+
entrypoints: coverage([]),
|
|
250
|
+
architectures: coverage([]),
|
|
251
|
+
build_metadata: coverage([]),
|
|
252
|
+
load_commands: coverage([]),
|
|
253
|
+
dependencies: coverage([]),
|
|
254
|
+
imports: coverage([]),
|
|
255
|
+
exports: coverage([
|
|
256
|
+
{
|
|
257
|
+
name: "open_native",
|
|
258
|
+
address: "0x1000",
|
|
259
|
+
weak: false,
|
|
260
|
+
reexport: false,
|
|
261
|
+
source: "nm",
|
|
262
|
+
},
|
|
263
|
+
]),
|
|
264
|
+
segments: coverage([]),
|
|
265
|
+
provenance: [],
|
|
266
|
+
limitations: [],
|
|
267
|
+
};
|
|
268
|
+
return createEvidence({
|
|
269
|
+
path: "/examples/nativehelper.dll",
|
|
270
|
+
sha256: "7".repeat(64),
|
|
271
|
+
format: "mach-o",
|
|
272
|
+
architecture: "x86_64",
|
|
273
|
+
}, NATIVE_EXAMPLE_PROVIDER, {
|
|
274
|
+
operation: "inspect_macho",
|
|
275
|
+
parameters: {},
|
|
276
|
+
result,
|
|
277
|
+
rawResult: null,
|
|
278
|
+
limitations: result.limitations,
|
|
279
|
+
});
|
|
280
|
+
};
|
|
281
|
+
const coverage = (items) => ({
|
|
282
|
+
items: [...items],
|
|
283
|
+
total: items.length,
|
|
284
|
+
exhaustive: true,
|
|
285
|
+
limitations: [],
|
|
286
|
+
});
|
|
287
|
+
/** Minimal valid managed decompiler reconstruction import request. */
|
|
288
|
+
export const MANAGED_RECONSTRUCTION_IMPORT_EXAMPLE = {
|
|
289
|
+
static_members: runtimeExampleEvidence,
|
|
290
|
+
decompiler: {
|
|
291
|
+
name: "ilspycmd",
|
|
292
|
+
version: "9.1.0.7988",
|
|
293
|
+
family: "ilspy",
|
|
294
|
+
executable_sha256: null,
|
|
295
|
+
options: ["--disable-updatecheck", "--type", "Example.Program"],
|
|
296
|
+
},
|
|
297
|
+
methods: [
|
|
298
|
+
{
|
|
299
|
+
token: "0x06000001",
|
|
300
|
+
signature_sha256: "3".repeat(64),
|
|
301
|
+
normalized_il_sha256: "5".repeat(64),
|
|
302
|
+
reconstruction: {
|
|
303
|
+
kind: "decompiled-csharp",
|
|
304
|
+
language: "csharp",
|
|
305
|
+
text: "internal static void Main() { }",
|
|
306
|
+
source_path: "/examples/Example.Program.cs",
|
|
307
|
+
start_line: 1,
|
|
308
|
+
end_line: 1,
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
notes: [
|
|
313
|
+
"Synthetic example only; decompiler output is imported as inference.",
|
|
314
|
+
],
|
|
315
|
+
};
|
|
316
|
+
/** Minimal valid managed/native verification request. */
|
|
317
|
+
export const MANAGED_NATIVE_VERIFICATION_EXAMPLE = {
|
|
318
|
+
managed_boundaries: boundaryEvidence(),
|
|
319
|
+
native_observations: [nativeExportEvidence()],
|
|
320
|
+
limits: {
|
|
321
|
+
max_native_observations: 20,
|
|
322
|
+
max_candidates_per_import: 25,
|
|
323
|
+
},
|
|
324
|
+
};
|
|
325
|
+
/** Minimal valid managed runtime-correlation planning request. */
|
|
326
|
+
export const MANAGED_RUNTIME_CORRELATION_EXAMPLE = {
|
|
327
|
+
static_members: runtimeExampleEvidence,
|
|
328
|
+
method: {
|
|
329
|
+
token: "0x06000001",
|
|
330
|
+
signature_sha256: "3".repeat(64),
|
|
331
|
+
normalized_il_sha256: "5".repeat(64),
|
|
332
|
+
},
|
|
333
|
+
requested_effect: "attach",
|
|
334
|
+
host: {
|
|
335
|
+
os: "linux",
|
|
336
|
+
clr_family: "dotnet",
|
|
337
|
+
architecture: "x86_64",
|
|
338
|
+
},
|
|
339
|
+
bounds: {
|
|
340
|
+
timeout_ms: 5_000,
|
|
341
|
+
max_threads: 32,
|
|
342
|
+
max_output_bytes: 65_536,
|
|
343
|
+
allow_network: false,
|
|
344
|
+
allow_ui: false,
|
|
345
|
+
},
|
|
346
|
+
};
|