rea-agents 6.3.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
- package/bridge/ghidra/ReaGhidraBridge.java +597 -209
- package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
- package/dist/adb/AdbConfiguration.js +88 -0
- package/dist/adb/AdbDeviceOutput.js +186 -0
- package/dist/adb/AdbProvider.js +1190 -0
- package/dist/adb/AdbShellOutput.js +309 -0
- package/dist/android/AndroidTargetSnapshot.js +104 -22
- package/dist/android/JadxConfiguration.js +44 -24
- package/dist/android/JadxProvider.js +51 -19
- package/dist/apktool/ApktoolConfiguration.js +84 -0
- package/dist/apktool/ApktoolDecodeOutput.js +59 -0
- package/dist/apktool/ApktoolProvider.js +506 -0
- package/dist/application/AnalysisProvider.js +8 -2
- package/dist/application/AppBundleExecutable.js +27 -22
- package/dist/application/BinaryTargetResolver.js +22 -2
- package/dist/application/CapabilityInventory.js +11 -1
- package/dist/application/ClientConfigurationDocument.js +70 -0
- package/dist/application/ClientConfigurationFiles.js +91 -0
- package/dist/application/ClientRegistrationEnvironment.js +35 -0
- package/dist/application/ClientRegistrationStatus.js +66 -31
- package/dist/application/DirectAnalysis.js +2 -2
- package/dist/application/DirectAnalysisCleanup.js +1 -1
- package/dist/application/DirectAnalysisStatus.js +1 -1
- package/dist/application/Doctor.js +5 -3
- package/dist/application/DoctorDiagnostics.js +1 -1
- package/dist/application/EvidenceBundleCommands.js +6 -12
- package/dist/application/GeminiClientSettings.js +139 -0
- package/dist/application/HermesClientHome.js +115 -0
- package/dist/application/HopperDownload.js +39 -0
- package/dist/application/InvestigationProviders.js +6 -0
- package/dist/application/JsonFiles.js +6 -5
- package/dist/{cliJsonFile.js → application/JsonInputFile.js} +108 -35
- package/dist/application/LinuxHopper.js +4 -12
- package/dist/application/MacHopper.js +172 -149
- package/dist/application/MipsElfAbiFlags.js +140 -0
- package/dist/application/ProviderOperationExecution.js +31 -0
- package/dist/application/ReconstructionObligationCandidates.js +9 -3
- package/dist/application/ReferenceSourceImport.js +76 -29
- package/dist/application/ReferenceSourceImportEntries.js +18 -9
- package/dist/application/ReferenceSourceImportPolicy.js +99 -23
- package/dist/application/ReferenceSourceImportTypes.js +30 -22
- package/dist/application/ReferenceSourceVcsAdapter.js +145 -30
- package/dist/application/RegularFileRead.js +93 -7
- package/dist/application/Setup.js +54 -6
- package/dist/application/SetupClientConfiguration.js +116 -16
- package/dist/application/SetupHost.js +102 -24
- package/dist/application/SetupPlan.js +5 -8
- package/dist/application/SetupSkill.js +58 -39
- package/dist/application/SupportedClients.js +290 -65
- package/dist/application/Uninstall.js +158 -10
- package/dist/application/UpdateMaintenance.js +17 -21
- package/dist/application/Utf8JsonInput.js +7 -0
- package/dist/application/WebScriptExportService.js +131 -65
- package/dist/application/WebSourceLocationService.js +3 -0
- package/dist/application/adb/AdbDeviceAnalysisPort.js +1 -0
- package/dist/application/adb/AdbDeviceAnalysisService.js +13 -0
- package/dist/application/analysisView/AnalysisViewService.js +40 -2
- package/dist/application/apktool/ApktoolResourceAnalysisPort.js +1 -0
- package/dist/application/apktool/ApktoolResourceAnalysisService.js +13 -0
- package/dist/application/binary/AnalysisClientCleanup.js +0 -24
- package/dist/application/binary/BinarySession.js +2 -1
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +2 -1
- package/dist/application/binaryDiagnostics/PeResourcesPort.js +1 -0
- package/dist/application/binaryDiagnostics/PeResourcesService.js +111 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +2 -1
- package/dist/application/evm/EvmInterfaceService.js +3 -0
- package/dist/application/firmware/FirmwareAnalysisService.js +3 -0
- package/dist/application/investigation/InspectEvidenceBundle.js +18 -0
- package/dist/application/javascript/ElectronBoundaryGraphContext.js +3 -2
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +19 -6
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +3 -3
- package/dist/application/javascript/JavaScriptApplicationService.js +22 -11
- package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +5 -6
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +171 -30
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +14 -16
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +67 -19
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +4 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +11 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +19 -16
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +92 -10
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +258 -235
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +115 -26
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +4 -1
- package/dist/application/javascript/JavaScriptModuleRelationships.js +6 -4
- package/dist/application/javascript/JavaScriptRecoveryService.js +3 -0
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +9 -3
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +199 -61
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +12 -19
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +4 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -3
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +5 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +19 -8
- package/dist/application/jeb/JebAnalysisPort.js +1 -0
- package/dist/application/jeb/JebAnalysisService.js +13 -0
- package/dist/application/managed/ManagedApplicationGraphService.js +1 -1
- package/dist/application/native/NativeUiActionTrace.js +16 -8
- package/dist/application/native/NativeValueTrace.js +23 -6
- package/dist/application/process/ProcessCli.js +25 -20
- package/dist/artifacts/ArtifactPaths.js +129 -8
- package/dist/artifacts/ArtifactProvider.js +20 -15
- package/dist/artifacts/ArtifactReader.js +23 -0
- package/dist/artifacts/ArtifactResourceScope.js +100 -0
- package/dist/artifacts/AsarArtifactReader.js +176 -102
- package/dist/artifacts/AsarHeader.js +24 -0
- package/dist/artifacts/DirectoryArtifactReader.js +168 -65
- package/dist/artifacts/MachOSliceArtifactReader.js +116 -39
- package/dist/artifacts/NativeDmgArtifactReader.js +29 -22
- package/dist/artifacts/SafeOutputTree.js +245 -70
- package/dist/artifacts/SafeOutputTreeCleanup.js +45 -0
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +20 -0
- package/dist/artifacts/SafeOutputTreeIdentity.js +42 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +33 -0
- package/dist/artifacts/ZipArtifactReader.js +77 -27
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +58 -18
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +62 -24
- package/dist/artifacts/apple/KeyedArchiveReader.js +32 -13
- package/dist/artifacts/extraction/ArtifactExtraction.js +110 -86
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +110 -43
- package/dist/artifacts/inventory/ArtifactInventory.js +5 -4
- package/dist/artifacts/inventory/classify.js +75 -32
- package/dist/artifacts/inventory/hashStableRootArtifact.js +48 -15
- package/dist/artifacts/inventory/reader.js +13 -5
- package/dist/artifacts/inventory/scanCanonical.js +62 -25
- package/dist/artifacts/inventory/scanReader.js +38 -11
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +15 -9
- package/dist/artifacts/javascript/JavaScriptSourceAnalysis.js +3 -0
- package/dist/browser/BrowserScenarioPartialObservation.js +8 -2
- package/dist/browser/BrowserScenarioSecrets.js +52 -37
- package/dist/browser/CdpBrowserProvider.js +5 -0
- package/dist/browser/CdpCaptureDocuments.js +40 -6
- package/dist/browser/CdpCaptureDomSvg.js +210 -0
- package/dist/browser/CdpCaptureEventBodyShapes.js +4 -8
- package/dist/browser/CdpCaptureEventHandlers.js +26 -9
- package/dist/browser/CdpCaptureEvents.js +4 -9
- package/dist/browser/CdpConnection.js +22 -5
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpTargetSession.js +30 -34
- package/dist/browser/CdpWebMcpDiscovery.js +32 -10
- package/dist/browser/ElectronFileScope.js +99 -9
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +60 -4
- package/dist/browser/PlaywrightElectronActiveProvider.js +11 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +5 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +69 -7
- package/dist/browser/PlaywrightScenarioSession.js +127 -54
- package/dist/browser/PlaywrightScenarioStorage.js +507 -0
- package/dist/browser/PngVisualDiff.js +198 -29
- package/dist/browser/WebSourceMapFetcher.js +3 -3
- package/dist/browser/assets/LocalWebScriptArtifacts.js +3 -1
- package/dist/browser/assets/PublishWebScripts.js +75 -20
- package/dist/browser/assets/WebArtifactReads.js +23 -1
- package/dist/browser/assets/WebSourceLocationArtifacts.js +1 -0
- package/dist/browser/execution/CdpExecutionCapture.js +3 -3
- package/dist/browser/execution/CdpPreciseCoverage.js +5 -8
- package/dist/browser/history/HarCapture.js +14 -0
- package/dist/browser/history/HarCaptureProcess.js +2 -10
- package/dist/browser/history/MitmproxyCaptureAdapter.js +3 -1
- package/dist/browser/modules/WebModuleArtifacts.js +1 -0
- package/dist/cli/adbCommands.js +337 -0
- package/dist/cli/analysisViewCommands.js +39 -1
- package/dist/cli/apktoolCommands.js +53 -0
- package/dist/cli/artifactCommands.js +8 -11
- package/dist/cli/binaryDiagnosticsCommands.js +19 -1
- package/dist/cli/browserAdvancedCommands.js +65 -36
- package/dist/cli/coreBinaryCommands.js +0 -5
- package/dist/cli/coreNativeCommands.js +1 -14
- package/dist/cli/electronCommands.js +6 -1
- package/dist/cli/evmCommands.js +13 -4
- package/dist/cli/firmwareCommands.js +7 -2
- package/dist/cli/javascriptApplicationAnalysis.js +17 -1
- package/dist/cli/javascriptRecoveryCommands.js +22 -15
- package/dist/cli/jebCommands.js +99 -0
- package/dist/cli/jsonOutput.js +11 -4
- package/dist/cli/referenceSourceImportStatus.js +7 -0
- package/dist/cli/setupCommands.js +15 -3
- package/dist/cli/utilityCommands.js +66 -18
- package/dist/cli/webScriptCommands.js +20 -1
- package/dist/cli/webSourceLocationCommands.js +21 -9
- package/dist/cli.js +6 -0
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +32 -0
- package/dist/cliJsonInput.js +2 -2
- package/dist/cliObservationOptions.js +3 -0
- package/dist/composition/adb.js +3 -0
- package/dist/composition/apktool.js +3 -0
- package/dist/composition/binaryDiagnostics.js +4 -0
- package/dist/composition/directAnalysis.js +12 -4
- package/dist/composition/javascriptAnalysisWorkerProcess.js +48 -0
- package/dist/composition/jeb.js +6 -0
- package/dist/config/environment.js +10 -0
- package/dist/config/ghidraLanguageOverride.js +9 -0
- package/dist/config/mcpInputSchemaProfile.js +27 -0
- package/dist/config/parseConfig.js +28 -1
- package/dist/contracts/adb/adbToolContracts.js +353 -0
- package/dist/contracts/advertisedInputExamples.js +48 -0
- package/dist/contracts/analysisDetail.js +10 -0
- package/dist/contracts/analysisViewToolContracts.js +17 -2
- package/dist/contracts/apktool/apktoolToolContracts.js +33 -0
- package/dist/contracts/artifactToolContracts.js +8 -5
- package/dist/contracts/browserToolContracts.js +1 -1
- package/dist/contracts/compactInputSchema.js +256 -0
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +10 -10
- package/dist/contracts/javascript/electronToolContracts.js +15 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +1 -1
- package/dist/contracts/jeb/jebToolContracts.js +64 -0
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +25 -3
- package/dist/contracts/officialToolContracts.js +5 -5
- package/dist/contracts/sessionToolContracts.js +2 -2
- package/dist/contracts/sessionToolSchemas.js +6 -2
- package/dist/contracts/toolContractExamples.js +6 -0
- package/dist/contracts/toolContractTypes.js +3 -0
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +167 -0
- package/dist/contracts/toolOutputSchemaGroups.js +5 -3
- package/dist/contracts/toolSchemaMetadata.js +82 -7
- package/dist/domain/adb/adbDeviceAnalysis.js +583 -0
- package/dist/domain/analysisErrorCleanup.js +29 -0
- package/dist/domain/analysisErrorPresentation.js +18 -6
- package/dist/domain/analysisErrorProjection.js +4 -1
- package/dist/domain/analysisSnapshot.js +2 -1
- package/dist/domain/analysisView/analysisView.js +52 -2
- package/dist/domain/analysisView/binaryLayoutView.js +2 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +2 -0
- package/dist/domain/analysisView/nativeFunctionView.js +155 -0
- package/dist/domain/android/androidApplication.js +25 -20
- package/dist/domain/apktool/apktoolResourceAnalysis.js +77 -0
- package/dist/domain/apple/appleApplication.js +40 -23
- package/dist/domain/apple/appleBundleAnatomy.js +95 -28
- package/dist/domain/apple/dyldPaths.js +9 -1
- package/dist/domain/apple/dylibResolution.js +2 -2
- package/dist/domain/apple/interfaceBuilderGraph.js +22 -19
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +10 -1
- package/dist/domain/artifactComparison.js +35 -7
- package/dist/domain/artifactGraph.js +5 -3
- package/dist/domain/artifactIdentity.js +30 -2
- package/dist/domain/artifactInspection.js +3 -43
- package/dist/domain/artifactIntegrityPolicy.js +10 -0
- package/dist/domain/artifactInventoryEvidence.js +11 -12
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/binaryTarget.js +16 -0
- package/dist/domain/binaryTargetTypes.js +8 -1
- package/dist/domain/browserObservationSchemas.js +8 -4
- package/dist/domain/canonicalJsonDigestSteps.js +34 -12
- package/dist/domain/compactStringIdentity.js +9 -0
- package/dist/domain/evidence.js +2 -1
- package/dist/domain/evidenceRecordSummary.js +144 -0
- package/dist/domain/inputIssueProjection.js +16 -1
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +12 -13
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +11 -20
- package/dist/domain/javascript/electronStaticAnalysisNative.js +70 -40
- package/dist/domain/javascript/electronStaticAnalysisValues.js +16 -0
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +45 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +4 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +6 -6
- package/dist/domain/javascript/javascriptApplicationGraph.js +79 -18
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +35 -0
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +28 -12
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +9 -1
- package/dist/domain/javascript/javascriptAstFingerprint.js +58 -31
- package/dist/domain/javascript/javascriptAstValues.js +32 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +50 -0
- package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +6 -1
- package/dist/domain/javascript/javascriptRpcEndpoints.js +253 -0
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +1 -3
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +7 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +8 -11
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +190 -33
- package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +8 -1
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +15 -4
- package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +42 -41
- package/dist/domain/javascript/javascriptSemanticGraph.js +69 -23
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +2 -10
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +40 -7
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +341 -87
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +78 -35
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +381 -0
- package/dist/domain/javascript/javascriptSemanticObjects.js +7 -1
- package/dist/domain/javascript/javascriptSemanticProjection.js +52 -14
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +77 -0
- package/dist/domain/javascript/javascriptSemanticQuery.js +27 -29
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +1 -3
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +219 -0
- package/dist/domain/javascript/javascriptSemanticReturns.js +13 -23
- package/dist/domain/javascript/javascriptSemanticState.js +22 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +19 -1
- package/dist/domain/javascript/javascriptSemanticValues.js +47 -19
- package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
- package/dist/domain/javascript/javascriptStaticAnalysis.js +29 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +8 -6
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +49 -5
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +8 -4
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +1 -0
- package/dist/domain/jeb/jebAnalysis.js +114 -0
- package/dist/domain/jsonShape.js +63 -52
- package/dist/domain/jsonValue.js +3 -0
- package/dist/domain/managed/managedApplicationGraph.js +37 -0
- package/dist/domain/managed/managedApplicationGraphCoverage.js +8 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +32 -22
- package/dist/domain/managed/managedArtifact.js +1 -0
- package/dist/domain/managed/managedInspectionEvidence.js +13 -0
- package/dist/domain/native/nativeAotPe.js +1408 -0
- package/dist/domain/native/nativeInstruction.js +21 -0
- package/dist/domain/native/nativeMetadataRecovery.js +79 -6
- package/dist/domain/native/peResources.js +94 -0
- package/dist/domain/nativeConvention.js +33 -0
- package/dist/domain/process/processCapture.js +91 -1
- package/dist/domain/process/processCaptureExample.js +24 -0
- package/dist/domain/process/processCaptureValidation.js +79 -0
- package/dist/domain/process/processScenario.js +59 -7
- package/dist/domain/propertyListKeys.js +3 -1
- package/dist/domain/referenceSourceGraph.js +25 -16
- package/dist/domain/referenceSourceImportParsing.js +6 -3
- package/dist/domain/referenceSourcePathIdentity.js +22 -0
- package/dist/domain/referenceSourceRequireBindings.js +137 -0
- package/dist/domain/webBundleAnalyzerInspection.js +14 -2
- package/dist/domain/webCaptureDiff.js +102 -4
- package/dist/domain/webScriptExportError.js +10 -4
- package/dist/domain/webScriptExportPlan.js +7 -13
- package/dist/domain/zipPackageFormat.js +4 -1
- package/dist/domain/zodCollectionSteps.js +24 -0
- package/dist/dotnet/ManagedArtifactInspector.js +55 -43
- package/dist/dotnet/ManagedDecodeBudget.js +80 -0
- package/dist/dotnet/ManagedMemberInspector.js +13 -6
- package/dist/dotnet/ManagedMemberInspectorCore.js +2 -2
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +4 -2
- package/dist/dotnet/ManagedMemberRows.js +9 -4
- package/dist/dotnet/ManagedMetadataHeaps.js +15 -5
- package/dist/dotnet/ManagedMetadataInventoryRows.js +20 -11
- package/dist/dotnet/ManagedMetadataLayout.js +10 -4
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -3
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +3 -2
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +49 -34
- package/dist/dotnet/ManagedPeReader.js +41 -25
- package/dist/dotnet/ManagedReaderFailure.js +2 -1
- package/dist/dotnet/ManagedStaticProvider.js +55 -24
- package/dist/evaluation/AgentEvaluationReport.js +9 -5
- package/dist/evaluation/CodexAgentEval.js +43 -13
- package/dist/evm/EvmoleFailures.js +0 -2
- package/dist/evm/EvmoleInterfaceProvider.js +67 -2
- package/dist/filesystem/OwnedDirectoryHandle.js +29 -0
- package/dist/filesystem/OwnedFileHandle.js +36 -0
- package/dist/filesystem/RegularFile.js +33 -1
- package/dist/filesystem/StableFileHash.js +46 -0
- package/dist/filesystem/readFileHandleChunks.js +26 -0
- package/dist/firmware/FirmwareCommand.js +25 -3
- package/dist/firmware/FirmwareFiles.js +23 -8
- package/dist/firmware/FirmwareProvider.js +156 -32
- package/dist/firmware/FirmwarePublication.js +24 -3
- package/dist/firmware/FirmwareRelease.js +1 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +55 -4
- package/dist/ghidra/GhidraAnalysisSeeds.js +211 -0
- package/dist/ghidra/GhidraClient.js +76 -4
- package/dist/ghidra/GhidraDiagnostics.js +11 -8
- package/dist/ghidra/GhidraFunctionValues.js +26 -2
- package/dist/ghidra/GhidraInstallation.js +1 -1
- package/dist/ghidra/GhidraInventoryValues.js +23 -1
- package/dist/ghidra/GhidraLanguageCatalog.js +99 -0
- package/dist/ghidra/GhidraLauncher.js +80 -39
- package/dist/ghidra/GhidraLoadImageAttest.js +49 -2
- package/dist/ghidra/GhidraMipsProfile.js +79 -0
- package/dist/ghidra/GhidraProvider.js +57 -9
- package/dist/ghidra/GhidraProviderCapabilities.js +18 -8
- package/dist/ghidra/GhidraProviderClient.js +282 -21
- package/dist/ghidra/GhidraSessionValues.js +9 -2
- package/dist/hopper/HopperAnalysisProfile.js +2 -0
- package/dist/hopper/HopperClient.js +15 -6
- package/dist/hopper/HopperMachOImage.js +2 -0
- package/dist/hopper/HopperProvider.js +13 -2
- package/dist/ida/IdaOperationRunner.js +8 -2
- package/dist/ida/IdaProvider.js +7 -0
- package/dist/ida/IdaSessionClient.js +3 -1
- package/dist/ida/IdaWorkspace.js +4 -2
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +326 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +520 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +63 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +521 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +116 -0
- package/dist/javascript/recovery/RecoveryFiles.js +18 -7
- package/dist/javascript/recovery/WakaruCommand.js +22 -9
- package/dist/javascript/recovery/WakaruExecution.js +11 -7
- package/dist/javascript/recovery/WakaruProvider.js +139 -16
- package/dist/javascript/recovery/WakaruPublication.js +14 -4
- package/dist/javascript/recovery/WakaruRelease.js +10 -3
- package/dist/javascript/recovery/WakaruReport.js +12 -7
- package/dist/javascript/recovery/WakaruVersion.js +24 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +16 -3
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +63 -7
- package/dist/javascript/sourceMaps/SourceMapFormat.js +15 -4
- package/dist/jeb/JebMcpConnection.js +179 -0
- package/dist/jeb/JebMcpEndpoint.js +40 -0
- package/dist/jeb/JebProvider.js +299 -0
- package/dist/mcpDoctor.js +15 -6
- package/dist/native/AppleDispatchCoverage.js +25 -12
- package/dist/native/AppleDispatchMetadata.js +14 -7
- package/dist/native/AppleMachoFixups.js +71 -15
- package/dist/native/AppleMachoSelection.js +23 -3
- package/dist/native/NativeMacOSProvider.js +91 -16
- package/dist/native/NativeMachoInspection.js +11 -7
- package/dist/native/NativeUiHelperRuntime.js +6 -1
- package/dist/native/NativeUiObservation.js +4 -3
- package/dist/native/pe/PeResourceLayout.js +120 -0
- package/dist/native/pe/PeResourceParser.js +286 -0
- package/dist/native/pe/PeResourcesProvider.js +63 -0
- package/dist/process/BoundedFileBytes.js +30 -7
- package/dist/process/DarwinProcessRunTokenReader.js +8 -3
- package/dist/process/OwnedCommand.js +4 -3
- package/dist/process/ProcessOwnership.js +104 -112
- package/dist/process/ProcessOwnershipObservation.js +96 -39
- package/dist/process/ProcessOwnershipProcessTree.js +4 -4
- package/dist/process/ProcessRunTokenObservations.js +48 -0
- package/dist/process/ProviderDiagnosticRedaction.js +17 -0
- package/dist/process/ProviderProcess.js +4 -3
- package/dist/process/capture/FilesystemSnapshot.js +28 -4
- package/dist/process/capture/ProcessCaptureLifecycle.js +350 -59
- package/dist/process/capture/ProcessCaptureProgress.js +62 -0
- package/dist/process/capture/ProcessHarness.js +194 -26
- package/dist/process/capture/ProcessNormalization.js +3 -1
- package/dist/process/capture/ProcessScenarioRuntimeValidation.js +5 -2
- package/dist/process/capture/TerminalRenderer.js +24 -7
- package/dist/reference/ReferenceSourceReader.js +22 -5
- package/dist/reference/ReferenceSourceReaderEntries.js +114 -51
- package/dist/reference/ReferenceSourceReaderErrors.js +12 -0
- package/dist/reference/ReferenceSourceReaderFile.js +50 -10
- package/dist/reference/ReferenceSourceReaderValidate.js +4 -4
- package/dist/server/EvidenceMcpServer.js +36 -1
- package/dist/server/admittedToolOperation.js +9 -0
- package/dist/server/contractToolHandler.js +21 -0
- package/dist/server/createServer.js +97 -25
- package/dist/server/registerAdbTools.js +36 -0
- package/dist/server/registerAnalysisViewTool.js +4 -9
- package/dist/server/registerAndroidTools.js +3 -12
- package/dist/server/registerApktoolTools.js +14 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +4 -6
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +3 -2
- package/dist/server/registerApplicationTools/coverage.js +3 -2
- package/dist/server/registerApplicationTools/obligationLedger.js +3 -2
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -2
- package/dist/server/registerApplicationTools/traceFeature.js +3 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +5 -2
- package/dist/server/registerBinaryDiagnosticsTools.js +16 -4
- package/dist/server/registerBrowserScenarioTool.js +10 -7
- package/dist/server/registerBrowserTools.js +12 -9
- package/dist/server/registerBundleComparisonTool.js +16 -2
- package/dist/server/registerCloseLifecycleTool.js +32 -3
- package/dist/server/registerElectronTools.js +28 -10
- package/dist/server/registerEvmTools.js +4 -9
- package/dist/server/registerFirmwareTools.js +3 -11
- package/dist/server/registerFunctionComparisonTool.js +5 -2
- package/dist/server/registerJavaScriptRecoveryTool.js +4 -9
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +9 -6
- package/dist/server/registerJebTools.js +16 -0
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +4 -6
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -2
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +3 -2
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +3 -2
- package/dist/server/registerPeResourcesTool.js +9 -0
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerRecordedCrashTools.js +4 -9
- package/dist/server/registerSessionRecordTools.js +2 -1
- package/dist/server/registerSessionTools.js +49 -18
- package/dist/server/registerWebModuleTool.js +4 -9
- package/dist/server/registerWebNetworkCaptureTool.js +4 -9
- package/dist/server/registerWebRuntimeTools.js +6 -5
- package/dist/server/registerWebScriptTool.js +6 -3
- package/dist/server/registerWebSourceLocationTool.js +4 -9
- package/dist/server/toolResult.js +21 -2
- package/dist/windows/WindowsPrivateRuntime.js +12 -5
- package/install.sh +7 -4
- package/licenses/nativeaot-parser-MIT.txt +28 -0
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +33 -5
- package/scripts/rea.mjs +16 -1
- package/skills/reverse-engineer-anything/SKILL.md +52 -51
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +92 -13
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +22 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { admitManagedProjection } from "./ManagedDecodeBudget.js";
|
|
1
2
|
import { managedNativeBoundaryInspectionSchema, } from "../domain/managed/managedArtifact.js";
|
|
2
3
|
import { readManagedMetadataInventory, readManagedResourceDirectory, } from "./ManagedMetadataInventory.js";
|
|
3
4
|
import { readManagedMetadataLayout, } from "./ManagedMetadataLayout.js";
|
|
@@ -10,7 +11,7 @@ import { buildNativeBoundaryInspection, cliNative, nativeBoundarySummary, native
|
|
|
10
11
|
* the header is absent (`not-managed`) or unreadable (`malformed`).
|
|
11
12
|
*/
|
|
12
13
|
const emptyInspection = (target, bytes, classification, { native = null, issues = [], } = {}) => {
|
|
13
|
-
return managedNativeBoundaryInspectionSchema.parse({
|
|
14
|
+
return managedNativeBoundaryInspectionSchema.parse(admitManagedProjection({
|
|
14
15
|
artifact: {
|
|
15
16
|
path: target.path,
|
|
16
17
|
sha256: target.sha256,
|
|
@@ -19,7 +20,11 @@ const emptyInspection = (target, bytes, classification, { native = null, issues
|
|
|
19
20
|
},
|
|
20
21
|
module: null,
|
|
21
22
|
metadata: {
|
|
22
|
-
status:
|
|
23
|
+
status: issues.some((issue) => issue.code === "resource-limit")
|
|
24
|
+
? "partial"
|
|
25
|
+
: classification === "malformed"
|
|
26
|
+
? "malformed"
|
|
27
|
+
: "absent",
|
|
23
28
|
version: null,
|
|
24
29
|
table_row_counts: {},
|
|
25
30
|
},
|
|
@@ -42,7 +47,7 @@ const emptyInspection = (target, bytes, classification, { native = null, issues
|
|
|
42
47
|
"No CLI metadata was admitted; native boundary declarations are unavailable.",
|
|
43
48
|
"Static inspection does not load or execute target code, so native export resolution is not performed.",
|
|
44
49
|
],
|
|
45
|
-
});
|
|
50
|
+
}));
|
|
46
51
|
};
|
|
47
52
|
const readBoundaryInventory = (bytes, pe, cli, issues) => {
|
|
48
53
|
const metadataOffset = pe.rvaToOffset(cli.metadata.rva, cli.metadata.size, "cli.metadata");
|
|
@@ -79,35 +84,45 @@ export const inspectManagedNativeBoundariesBytes = (bytes, target) => {
|
|
|
79
84
|
issues: [cause.issue],
|
|
80
85
|
});
|
|
81
86
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
87
|
+
try {
|
|
88
|
+
const heapExtent = Math.max(layout.strings.size, layout.blob.size);
|
|
89
|
+
issues.push(...inventory.issues);
|
|
90
|
+
const moduleRefs = parseModuleRefs(bytes, layout, heapExtent, issues);
|
|
91
|
+
const members = new Map([
|
|
92
|
+
...parseFields(bytes, layout, heapExtent, issues),
|
|
93
|
+
...parseMethods(bytes, layout, heapExtent, issues),
|
|
94
|
+
]);
|
|
95
|
+
const imports = parseImplMaps({
|
|
96
|
+
bytes,
|
|
97
|
+
layout,
|
|
98
|
+
heapExtent,
|
|
99
|
+
modules: moduleRefs,
|
|
100
|
+
members,
|
|
101
|
+
issues,
|
|
102
|
+
});
|
|
103
|
+
const pinvokeTokens = new Set(imports
|
|
104
|
+
.map(({ member_token }) => member_token)
|
|
105
|
+
.filter((token) => token !== null));
|
|
106
|
+
const implementations = nativeImplementations(members.values(), pinvokeTokens);
|
|
107
|
+
return buildNativeBoundaryInspection({
|
|
108
|
+
target,
|
|
109
|
+
bytes,
|
|
110
|
+
pe,
|
|
111
|
+
layout,
|
|
112
|
+
inventory,
|
|
113
|
+
moduleRefs,
|
|
114
|
+
imports,
|
|
115
|
+
implementations,
|
|
116
|
+
native: cliNative(pe),
|
|
117
|
+
issues,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
catch (cause) {
|
|
121
|
+
if (!(cause instanceof ManagedReaderFailure))
|
|
122
|
+
throw cause;
|
|
123
|
+
return emptyInspection(target, bytes, "malformed", {
|
|
124
|
+
native: cliNative(pe),
|
|
125
|
+
issues: [...issues, cause.issue],
|
|
126
|
+
});
|
|
127
|
+
}
|
|
113
128
|
};
|
|
@@ -29,25 +29,51 @@ const architectureFor = (machine) => {
|
|
|
29
29
|
throw managedFailure("invalid-directory", "pe.machine", `Unsupported PE machine 0x${machine.toString(16).padStart(4, "0")}`);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
/** Resolve one section identity for both exact reads and available-byte queries. */
|
|
33
|
+
const resolveRva = (mapping) => {
|
|
33
34
|
const { bytes, sections, rva, size, scope } = mapping;
|
|
34
|
-
if (rva
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
if (!Number.isSafeInteger(rva) ||
|
|
36
|
+
!Number.isSafeInteger(size) ||
|
|
37
|
+
rva < 0 ||
|
|
38
|
+
size < 0 ||
|
|
39
|
+
rva > 0xffff_ffff ||
|
|
40
|
+
(size > 0 && size > 0x1_0000_0000 - rva))
|
|
41
|
+
throw managedFailure("invalid-directory", scope, `${scope} has an invalid RVA range`);
|
|
42
|
+
// VirtualSize owns RVA containment; raw size also includes alignment padding.
|
|
43
|
+
const selected = sections.find((section) => {
|
|
40
44
|
const within = rva - section.virtualAddress;
|
|
41
|
-
|
|
45
|
+
return (section.virtualSize > 0 &&
|
|
46
|
+
within >= 0 &&
|
|
47
|
+
within < section.virtualSize &&
|
|
48
|
+
size <= section.virtualSize - within);
|
|
49
|
+
});
|
|
50
|
+
if (selected === undefined)
|
|
51
|
+
throw managedFailure("invalid-directory", scope, `${scope} RVA is not covered by one PE section`);
|
|
52
|
+
for (const section of sections) {
|
|
53
|
+
if (section === selected || section.virtualSize === 0)
|
|
42
54
|
continue;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
const end = section.virtualAddress + section.virtualSize;
|
|
56
|
+
const intersects = size === 0
|
|
57
|
+
? rva >= section.virtualAddress && rva < end
|
|
58
|
+
: rva < end && rva + size > section.virtualAddress;
|
|
59
|
+
if (intersects)
|
|
60
|
+
throw managedFailure("invalid-directory", scope, `${scope} RVA range has ambiguous overlapping PE section mappings`);
|
|
48
61
|
}
|
|
49
|
-
|
|
62
|
+
const within = rva - selected.virtualAddress;
|
|
63
|
+
if (within > selected.rawSize || size > selected.rawSize - within)
|
|
64
|
+
throw managedFailure("invalid-directory", scope, `${scope} occupies virtual bytes without file-backed data`);
|
|
65
|
+
const offset = add(selected.rawOffset, within, scope);
|
|
66
|
+
requireRange(bytes, offset, size, scope);
|
|
67
|
+
let available = Math.min(selected.virtualSize - within, selected.rawSize - within, bytes.length - offset, 0x1_0000_0000 - rva);
|
|
68
|
+
// A future overlap ends the uniquely mapped extent even if the current byte is unique.
|
|
69
|
+
for (const section of sections)
|
|
70
|
+
if (section !== selected &&
|
|
71
|
+
section.virtualAddress > rva &&
|
|
72
|
+
section.virtualSize > 0)
|
|
73
|
+
available = Math.min(available, section.virtualAddress - rva);
|
|
74
|
+
return { offset, available };
|
|
50
75
|
};
|
|
76
|
+
const mapRva = (mapping) => mapping.rva === 0 && mapping.size === 0 ? 0 : resolveRva(mapping).offset;
|
|
51
77
|
const readDirectory = (bytes, offset) => {
|
|
52
78
|
requireRange(bytes, offset, 8, "pe.data-directory");
|
|
53
79
|
return {
|
|
@@ -186,16 +212,6 @@ export const readManagedPeLayout = (bytes) => {
|
|
|
186
212
|
cliDirectoryPresent,
|
|
187
213
|
cliIssue,
|
|
188
214
|
rvaToOffset: (rva, size, scope) => mapRva({ bytes, sections, rva, size, scope }),
|
|
189
|
-
rvaAvailableBytes: (rva, scope) => {
|
|
190
|
-
mapRva({ bytes, sections, rva, size: 1, scope });
|
|
191
|
-
for (const section of sections) {
|
|
192
|
-
if (rva < section.virtualAddress)
|
|
193
|
-
continue;
|
|
194
|
-
const within = rva - section.virtualAddress;
|
|
195
|
-
if (within < section.rawSize)
|
|
196
|
-
return Math.min(section.rawSize - within, bytes.length - section.rawOffset - within);
|
|
197
|
-
}
|
|
198
|
-
throw managedFailure("invalid-directory", scope, `${scope} RVA is not covered by file-backed PE section data`);
|
|
199
|
-
},
|
|
215
|
+
rvaAvailableBytes: (rva, scope) => resolveRva({ bytes, sections, rva, size: 1, scope }).available,
|
|
200
216
|
};
|
|
201
217
|
};
|
|
@@ -14,7 +14,8 @@ export const readManagedValue = (operation, issues) => {
|
|
|
14
14
|
return operation();
|
|
15
15
|
}
|
|
16
16
|
catch (cause) {
|
|
17
|
-
if (!(cause instanceof ManagedReaderFailure)
|
|
17
|
+
if (!(cause instanceof ManagedReaderFailure) ||
|
|
18
|
+
cause.issue.code === "resource-limit")
|
|
18
19
|
throw cause;
|
|
19
20
|
issues.push(cause.issue);
|
|
20
21
|
return undefined;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { createReadStream } from "node:fs";
|
|
3
|
-
import { readFile } from "node:fs/promises";
|
|
4
2
|
import { createAnalysisExecution, } from "../application/AnalysisProvider.js";
|
|
5
3
|
import { managedStaticCapabilities } from "./ManagedStaticProviderMetadata.js";
|
|
6
4
|
import { MANAGED_STATIC_PROVIDER } from "../application/InvestigationProviders.js";
|
|
7
5
|
import { MANAGED_TOOL_CONTRACTS, managedTargetInputSchema, } from "../contracts/managed/managedToolContracts.js";
|
|
8
|
-
import {
|
|
6
|
+
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
7
|
+
import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, AnalysisResourceConstraintError, } from "../domain/analysisErrorCore.js";
|
|
9
8
|
import { EvidenceIntegrityError } from "../domain/evidenceErrors.js";
|
|
10
9
|
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
11
10
|
import { err, ok } from "../domain/result.js";
|
|
12
11
|
import { inspectManagedArtifactBytes } from "./ManagedArtifactInspector.js";
|
|
13
12
|
import { inspectManagedMembersBytes } from "./ManagedMemberInspector.js";
|
|
14
13
|
import { inspectManagedNativeBoundariesBytes } from "./ManagedNativeBoundaryInspector.js";
|
|
14
|
+
import { openRegularFile } from "../filesystem/RegularFile.js";
|
|
15
|
+
import { readBoundedFileBytes } from "../process/BoundedFileBytes.js";
|
|
16
|
+
// This provider eagerly retains the full PE snapshot. Keep its input resource
|
|
17
|
+
// policy separate from decoded metadata/output capacity; it is not a PE format limit.
|
|
18
|
+
const MAX_MANAGED_SNAPSHOT_BYTES = 128 * 1024 * 1024;
|
|
19
|
+
const snapshotCapacityError = (operation) => new AnalysisResourceConstraintError(operation, "memory", "Managed static inspection requires an eagerly retained PE snapshot within its input byte budget.", { max_snapshot_bytes: MAX_MANAGED_SNAPSHOT_BYTES });
|
|
15
20
|
/** Execution-free managed PE/CLI auxiliary provider. */
|
|
16
21
|
export class ManagedStaticProvider {
|
|
17
22
|
#capabilities = managedStaticCapabilities();
|
|
@@ -43,8 +48,8 @@ class ManagedStaticClient {
|
|
|
43
48
|
return err(new AnalysisCancelledError(operation));
|
|
44
49
|
const snapshot = this.#snapshotBytes;
|
|
45
50
|
const observed = snapshot === undefined
|
|
46
|
-
? await readManagedSnapshot(this.target.path, options?.signal)
|
|
47
|
-
: await hashManagedSource(this.target.path, options?.signal);
|
|
51
|
+
? await readManagedSnapshot(this.target.path, operation, options?.signal)
|
|
52
|
+
: await hashManagedSource(this.target.path, operation, options?.signal);
|
|
48
53
|
if (observed.sha256 !== this.target.sha256)
|
|
49
54
|
return err(new EvidenceIntegrityError(`Managed artifact digest changed after open: expected ${this.target.sha256}, observed ${observed.sha256} at ${this.target.path}`));
|
|
50
55
|
const bytes = snapshot ?? observed.bytes;
|
|
@@ -62,6 +67,8 @@ class ManagedStaticClient {
|
|
|
62
67
|
catch (cause) {
|
|
63
68
|
if (options?.signal?.aborted === true)
|
|
64
69
|
return err(new AnalysisCancelledError(operation));
|
|
70
|
+
if (cause instanceof AnalysisError)
|
|
71
|
+
return err(cause);
|
|
65
72
|
return err(new ProviderAdapterError(MANAGED_STATIC_PROVIDER.id, operation, {
|
|
66
73
|
cause,
|
|
67
74
|
}));
|
|
@@ -72,27 +79,51 @@ class ManagedStaticClient {
|
|
|
72
79
|
return Promise.resolve(ok(null));
|
|
73
80
|
}
|
|
74
81
|
}
|
|
75
|
-
const readManagedSnapshot = async (path, signal) => {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
const readManagedSnapshot = async (path, operation, signal) => {
|
|
83
|
+
const handle = await openRegularFile(path, { symlinks: "follow", signal });
|
|
84
|
+
try {
|
|
85
|
+
const metadata = await handle.stat();
|
|
86
|
+
if (metadata.size > MAX_MANAGED_SNAPSHOT_BYTES)
|
|
87
|
+
throw snapshotCapacityError(operation);
|
|
88
|
+
const bytes = await readBoundedFileBytes(handle, MAX_MANAGED_SNAPSHOT_BYTES, signal);
|
|
89
|
+
if (bytes === undefined)
|
|
90
|
+
throw snapshotCapacityError(operation);
|
|
91
|
+
signal?.throwIfAborted();
|
|
92
|
+
return {
|
|
93
|
+
byteLength: bytes.length,
|
|
94
|
+
sha256: createHash("sha256").update(bytes).digest("hex"),
|
|
95
|
+
bytes,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
await handle.close();
|
|
100
|
+
}
|
|
82
101
|
};
|
|
83
|
-
const hashManagedSource = async (path, signal) => {
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
const hashManagedSource = async (path, operation, signal) => {
|
|
103
|
+
const handle = await openRegularFile(path, { symlinks: "follow", signal });
|
|
104
|
+
try {
|
|
105
|
+
if ((await handle.stat()).size > MAX_MANAGED_SNAPSHOT_BYTES)
|
|
106
|
+
throw snapshotCapacityError(operation);
|
|
107
|
+
const digest = createHash("sha256");
|
|
108
|
+
let byteLength = 0;
|
|
109
|
+
const stream = handle.createReadStream({
|
|
110
|
+
autoClose: false,
|
|
111
|
+
...(signal === undefined ? {} : { signal }),
|
|
112
|
+
});
|
|
113
|
+
for await (const chunk of stream) {
|
|
114
|
+
signal?.throwIfAborted();
|
|
115
|
+
if (!Buffer.isBuffer(chunk))
|
|
116
|
+
throw new TypeError("Managed source stream returned non-buffer data");
|
|
117
|
+
if (chunk.length > MAX_MANAGED_SNAPSHOT_BYTES - byteLength)
|
|
118
|
+
throw snapshotCapacityError(operation);
|
|
119
|
+
byteLength += chunk.length;
|
|
120
|
+
digest.update(chunk);
|
|
121
|
+
}
|
|
122
|
+
return { byteLength, sha256: digest.digest("hex") };
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
await handle.close();
|
|
94
126
|
}
|
|
95
|
-
return { byteLength, sha256: digest.digest("hex") };
|
|
96
127
|
};
|
|
97
128
|
const isManagedOperation = (operation) => MANAGED_TOOL_CONTRACTS.some(({ name }) => name === operation);
|
|
98
129
|
const inspectManagedOperation = (operation, parameters, bytes, target) => {
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
/** Require configured facts to pass while preserving workflow and execution gates. */
|
|
2
2
|
export const agentEvaluationPassed = (result) => result.exitCode === 0 &&
|
|
3
|
-
result.
|
|
3
|
+
(result.expectedFirstTool === null
|
|
4
|
+
? !result.naturalUse
|
|
5
|
+
: result.naturalUse) &&
|
|
4
6
|
result.correctFirstTool &&
|
|
5
7
|
result.repeatedCallCount === 0 &&
|
|
6
8
|
result.inputValidationFailureCount === 0 &&
|
|
7
9
|
result.requiredToolSubsequenceMet &&
|
|
8
10
|
result.inputTokens > 0 &&
|
|
9
|
-
(result.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
result.
|
|
11
|
+
(result.expectedFirstTool === null
|
|
12
|
+
? result.targetClarificationPassed === true
|
|
13
|
+
: result.factualCorrectness === "passed" ||
|
|
14
|
+
(result.factualCorrectness === "not_assessed" &&
|
|
15
|
+
result.answerHeuristicsMet &&
|
|
16
|
+
result.epistemicCuePresent));
|
|
13
17
|
/** Keep assessed fixture outcomes and scenarios without truth oracles distinct. */
|
|
14
18
|
export const summarizeFactualCorrectness = (results) => {
|
|
15
19
|
const passed = results.filter(({ factualCorrectness }) => factualCorrectness === "passed").length;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { evaluateKnownAnswers, } from "./KnownAnswerEvaluation.js";
|
|
2
2
|
import { compareUnicodeCodePoints } from "../domain/unicodeCodePointOrder.js";
|
|
3
|
+
import { TOOL_CONTRACTS } from "../contracts/toolContracts.js";
|
|
3
4
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
5
|
const record = (value) => isRecord(value) ? value : undefined;
|
|
5
6
|
const textValue = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
|
|
@@ -20,19 +21,38 @@ const evidenceIdsFrom = (value) => {
|
|
|
20
21
|
return [];
|
|
21
22
|
return [...new Set(encoded.match(/ev_[a-f0-9]{64}/gu) ?? [])];
|
|
22
23
|
};
|
|
23
|
-
const
|
|
24
|
-
if (item.status === "failed" ||
|
|
25
|
-
(item.error !== undefined && item.error !== null))
|
|
26
|
-
return true;
|
|
24
|
+
const toolResultError = (item) => {
|
|
27
25
|
const result = record(item.result ?? item.output);
|
|
28
26
|
const structured = record(result?.structured_content ?? result?.structuredContent);
|
|
29
|
-
|
|
27
|
+
const direct = record(structured?.error ?? result?.error ?? item.error);
|
|
28
|
+
if (direct !== undefined || structured !== undefined)
|
|
29
|
+
return direct;
|
|
30
|
+
// Codex preserves some REA failures only as one complete JSON text block.
|
|
31
|
+
// A client-truncated preview or SDK prose is not a structured error record.
|
|
32
|
+
const content = result?.content;
|
|
33
|
+
if (!Array.isArray(content) || content.length !== 1)
|
|
34
|
+
return undefined;
|
|
35
|
+
const block = record(content[0]);
|
|
36
|
+
if (block?.type !== "text" || typeof block.text !== "string")
|
|
37
|
+
return undefined;
|
|
38
|
+
try {
|
|
39
|
+
return record(record(JSON.parse(block.text))?.error);
|
|
40
|
+
}
|
|
41
|
+
catch (cause) {
|
|
42
|
+
if (cause instanceof SyntaxError || cause instanceof RangeError)
|
|
43
|
+
return undefined;
|
|
44
|
+
throw cause;
|
|
45
|
+
}
|
|
30
46
|
};
|
|
31
|
-
const
|
|
47
|
+
const toolResultFailed = (item, error) => {
|
|
48
|
+
if (item.status === "failed" ||
|
|
49
|
+
(item.error !== undefined && item.error !== null))
|
|
50
|
+
return true;
|
|
32
51
|
const result = record(item.result ?? item.output);
|
|
33
52
|
const structured = record(result?.structured_content ?? result?.structuredContent);
|
|
34
|
-
|
|
35
|
-
|
|
53
|
+
return (result?.isError === true ||
|
|
54
|
+
structured?.error !== undefined ||
|
|
55
|
+
error !== undefined);
|
|
36
56
|
};
|
|
37
57
|
const callFromItem = (value) => {
|
|
38
58
|
const item = record(value);
|
|
@@ -41,14 +61,15 @@ const callFromItem = (value) => {
|
|
|
41
61
|
const tool = textValue(item.tool) ?? textValue(item.name);
|
|
42
62
|
if (tool === undefined)
|
|
43
63
|
return undefined;
|
|
64
|
+
const error = toolResultError(item);
|
|
44
65
|
return {
|
|
45
66
|
id: textValue(item.id) ?? null,
|
|
46
67
|
server: textValue(item.server) ?? textValue(item.server_name) ?? null,
|
|
47
68
|
tool,
|
|
48
69
|
arguments: item.arguments ?? item.input ?? {},
|
|
49
70
|
evidenceIds: evidenceIdsFrom(item.result ?? item.output),
|
|
50
|
-
error: toolResultFailed(item),
|
|
51
|
-
errorCode:
|
|
71
|
+
error: toolResultFailed(item, error),
|
|
72
|
+
errorCode: textValue(error?.code) ?? null,
|
|
52
73
|
};
|
|
53
74
|
};
|
|
54
75
|
const agentTextFromItem = (value) => {
|
|
@@ -106,12 +127,21 @@ export const evaluateCodexEvents = (events, expectedFirstTool, options = {}) =>
|
|
|
106
127
|
consumeEvent(state, event);
|
|
107
128
|
const reaCalls = state.calls.filter(({ server }) => server === null || server.toLowerCase() === "rea");
|
|
108
129
|
const signatures = new Map();
|
|
130
|
+
let targetRevision = 0;
|
|
109
131
|
for (const call of reaCalls) {
|
|
110
|
-
|
|
132
|
+
// A status read before and after a successful target lifecycle change is
|
|
133
|
+
// useful verification, not a duplicate analysis or unchanged failed retry.
|
|
134
|
+
const context = call.tool === "binary_session" ? `${String(targetRevision)}:` : "";
|
|
135
|
+
const signature = `${context}${call.tool}:${JSON.stringify(canonicalValue(call.arguments))}`;
|
|
111
136
|
signatures.set(signature, (signatures.get(signature) ?? 0) + 1);
|
|
137
|
+
if (!call.error &&
|
|
138
|
+
(call.tool === "open_binary" || call.tool === "close_binary"))
|
|
139
|
+
targetRevision += 1;
|
|
112
140
|
}
|
|
113
141
|
const repeatedCallCount = [...signatures.values()].reduce((total, count) => total + Math.max(0, count - 1), 0);
|
|
114
|
-
const inputValidationFailureCount = reaCalls.filter((
|
|
142
|
+
const inputValidationFailureCount = reaCalls.filter((call) => call.errorCode === "invalid_request" ||
|
|
143
|
+
(call.error &&
|
|
144
|
+
TOOL_CONTRACTS.find(({ name }) => name === call.tool)?.inputSchema.safeParse(call.arguments).success === false)).length;
|
|
115
145
|
const requiredToolSubsequenceMet = containsOrderedSubsequence(reaCalls.filter(({ error }) => !error).map(({ tool }) => tool), options.requiredToolSubsequence ?? []);
|
|
116
146
|
const finalMessage = state.finalMessages.at(-1) ?? "";
|
|
117
147
|
const evidenceIds = [
|
|
@@ -124,7 +154,7 @@ export const evaluateCodexEvents = (events, expectedFirstTool, options = {}) =>
|
|
|
124
154
|
const factualAssessment = evaluateKnownAnswers(events, finalMessage, options.fixtureClaims);
|
|
125
155
|
return {
|
|
126
156
|
naturalUse: reaCalls.length > 0,
|
|
127
|
-
correctFirstTool: reaCalls[0]?.tool === expectedFirstTool,
|
|
157
|
+
correctFirstTool: (reaCalls[0]?.tool ?? null) === expectedFirstTool,
|
|
128
158
|
firstTool: reaCalls[0]?.tool ?? null,
|
|
129
159
|
reaCalls,
|
|
130
160
|
repeatedCallCount,
|
|
@@ -24,8 +24,6 @@ export const evmInterfaceFailure = (cause, phase, path, workerLimits, limiter =
|
|
|
24
24
|
message: cause.message,
|
|
25
25
|
exit_code: cause.snapshot?.exitCode ?? null,
|
|
26
26
|
signal: cause.snapshot?.signal ?? null,
|
|
27
|
-
stdout: cause.snapshot?.stdout.text ?? null,
|
|
28
|
-
stderr: cause.snapshot?.stderr.text ?? null,
|
|
29
27
|
},
|
|
30
28
|
}, { operation: "inspect_evm_interface", cause });
|
|
31
29
|
if (cause.reason === "cancelled")
|
|
@@ -44,14 +44,29 @@ export class EvmoleInterfaceProvider {
|
|
|
44
44
|
environment;
|
|
45
45
|
launcher;
|
|
46
46
|
createRuntime;
|
|
47
|
+
#tail = Promise.resolve();
|
|
48
|
+
#closing = false;
|
|
49
|
+
#closePromise;
|
|
50
|
+
#pendingCleanup;
|
|
47
51
|
constructor(environment = process.env, launcher, createRuntime = () => PrivateRuntimeRoot.create({ prefix: "rea-evm-interface-" })) {
|
|
48
52
|
this.environment = environment;
|
|
49
53
|
this.launcher = launcher;
|
|
50
54
|
this.createRuntime = createRuntime;
|
|
51
55
|
}
|
|
52
56
|
/** Bind recovered interface candidates to both original carrier and decoded byte identity. */
|
|
53
|
-
|
|
57
|
+
inspect(input, options) {
|
|
58
|
+
if (this.#closing)
|
|
59
|
+
return Promise.resolve(err(this.#closedError()));
|
|
60
|
+
const operation = this.#tail.then(() => this.#closing ? err(this.#closedError()) : this.#inspect(input, options));
|
|
61
|
+
this.#tail = operation.then(() => undefined, () => undefined);
|
|
62
|
+
return operation;
|
|
63
|
+
}
|
|
64
|
+
async #inspect(input, options) {
|
|
65
|
+
const pending = await this.#retire();
|
|
66
|
+
if (pending !== undefined)
|
|
67
|
+
return err(pending);
|
|
54
68
|
let root;
|
|
69
|
+
let processOwner;
|
|
55
70
|
let retainedOutput;
|
|
56
71
|
let phase = "configuration";
|
|
57
72
|
let workerLimits;
|
|
@@ -221,6 +236,8 @@ export class EvmoleInterfaceProvider {
|
|
|
221
236
|
}));
|
|
222
237
|
}
|
|
223
238
|
catch (cause) {
|
|
239
|
+
if (cause instanceof OwnedCommandFailure)
|
|
240
|
+
processOwner = cause.cleanupOwner;
|
|
224
241
|
let fileFailure;
|
|
225
242
|
if (cause instanceof OwnedCommandFailure &&
|
|
226
243
|
cause.snapshot?.exitCode === EVM_FILE_SIZE_FAILURE_EXIT &&
|
|
@@ -249,12 +266,20 @@ export class EvmoleInterfaceProvider {
|
|
|
249
266
|
: { capturedOutput: retainedOutput })
|
|
250
267
|
: evmInterfaceFailure(cause, phase, input.path, workerLimits, limiter, fileFailure));
|
|
251
268
|
}
|
|
269
|
+
if (processOwner !== undefined) {
|
|
270
|
+
this.#pendingCleanup = { root, process: processOwner };
|
|
271
|
+
// The command failure already owns this cleanup diagnostic and its resources.
|
|
272
|
+
return result;
|
|
273
|
+
}
|
|
252
274
|
if (root !== undefined) {
|
|
253
275
|
try {
|
|
254
276
|
await root.close();
|
|
255
277
|
}
|
|
256
278
|
catch (cause) {
|
|
257
|
-
|
|
279
|
+
const retainedRoot = root;
|
|
280
|
+
this.#pendingCleanup = { root: retainedRoot, process: undefined };
|
|
281
|
+
root = undefined;
|
|
282
|
+
return err(new ProviderCleanupError(EVMOLE_PROVIDER_IDENTITY.id, [retainedRoot.path], {
|
|
258
283
|
reason: cause instanceof Error ? cause.message : String(cause),
|
|
259
284
|
previous_error: result.ok
|
|
260
285
|
? null
|
|
@@ -271,4 +296,44 @@ export class EvmoleInterfaceProvider {
|
|
|
271
296
|
: { capturedOutput: retainedOutput }))
|
|
272
297
|
: result;
|
|
273
298
|
}
|
|
299
|
+
async close() {
|
|
300
|
+
this.#closing = true;
|
|
301
|
+
this.#closePromise ??= this.#tail
|
|
302
|
+
.then(async () => {
|
|
303
|
+
const failure = await this.#retire();
|
|
304
|
+
if (failure !== undefined)
|
|
305
|
+
throw failure;
|
|
306
|
+
})
|
|
307
|
+
.catch((cause) => {
|
|
308
|
+
this.#closePromise = undefined;
|
|
309
|
+
throw cause;
|
|
310
|
+
});
|
|
311
|
+
return this.#closePromise;
|
|
312
|
+
}
|
|
313
|
+
#closedError() {
|
|
314
|
+
return new ProviderCleanupError(EVMOLE_PROVIDER_IDENTITY.id, [], { reason: "Provider is closing" }, { operation: OPERATION });
|
|
315
|
+
}
|
|
316
|
+
async #retire() {
|
|
317
|
+
const pending = this.#pendingCleanup;
|
|
318
|
+
if (pending === undefined)
|
|
319
|
+
return undefined;
|
|
320
|
+
if (pending.process !== undefined) {
|
|
321
|
+
const stopped = await pending.process.stop();
|
|
322
|
+
if (stopped.status === "incomplete")
|
|
323
|
+
return new ProviderCleanupError(EVMOLE_PROVIDER_IDENTITY.id, [pending.process.launch.ownership?.runId ?? "owned-worker"], { reason: stopped.reason }, { operation: OPERATION });
|
|
324
|
+
pending.process = undefined;
|
|
325
|
+
}
|
|
326
|
+
if (pending.root !== undefined) {
|
|
327
|
+
const root = pending.root;
|
|
328
|
+
try {
|
|
329
|
+
await root.close();
|
|
330
|
+
pending.root = undefined;
|
|
331
|
+
}
|
|
332
|
+
catch (cause) {
|
|
333
|
+
return new ProviderCleanupError(EVMOLE_PROVIDER_IDENTITY.id, [root.path], { reason: cause instanceof Error ? cause.message : String(cause) }, { operation: OPERATION, cause });
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
this.#pendingCleanup = undefined;
|
|
337
|
+
return undefined;
|
|
338
|
+
}
|
|
274
339
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Dir.close invalidates Node's private handle before its native close settles. */
|
|
2
|
+
export class OwnedDirectoryHandle {
|
|
3
|
+
handle;
|
|
4
|
+
#state = { kind: "open" };
|
|
5
|
+
constructor(handle) {
|
|
6
|
+
this.handle = handle;
|
|
7
|
+
}
|
|
8
|
+
close() {
|
|
9
|
+
if (this.#state.kind === "closed")
|
|
10
|
+
return Promise.resolve();
|
|
11
|
+
if (this.#state.kind === "closing")
|
|
12
|
+
return this.#state.attempt;
|
|
13
|
+
if (this.#state.kind === "failed")
|
|
14
|
+
return Promise.reject(this.#state.cause);
|
|
15
|
+
const attempt = Promise.resolve().then(async () => {
|
|
16
|
+
try {
|
|
17
|
+
await this.handle.close();
|
|
18
|
+
this.#state = { kind: "closed" };
|
|
19
|
+
}
|
|
20
|
+
catch (cause) {
|
|
21
|
+
// Dir has no public validity signal with which to authorize a retry.
|
|
22
|
+
this.#state = { kind: "failed", cause };
|
|
23
|
+
throw cause;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
this.#state = { kind: "closing", attempt };
|
|
27
|
+
return attempt;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** One file handle whose close result must remain truthful across retries. */
|
|
2
|
+
export class OwnedFileHandle {
|
|
3
|
+
handle;
|
|
4
|
+
#state = { kind: "open" };
|
|
5
|
+
constructor(handle) {
|
|
6
|
+
this.handle = handle;
|
|
7
|
+
}
|
|
8
|
+
/** Close the owned handle, retaining an unconfirmed close as a sticky failure. */
|
|
9
|
+
close() {
|
|
10
|
+
if (this.#state.kind === "closed")
|
|
11
|
+
return Promise.resolve();
|
|
12
|
+
if (this.#state.kind === "closing")
|
|
13
|
+
return this.#state.attempt;
|
|
14
|
+
if (this.#state.kind === "failed")
|
|
15
|
+
return Promise.reject(this.#state.cause);
|
|
16
|
+
if (this.handle.fd < 0) {
|
|
17
|
+
const cause = new Error("File handle was invalidated before this owner confirmed its close");
|
|
18
|
+
this.#state = { kind: "failed", cause };
|
|
19
|
+
return Promise.reject(cause);
|
|
20
|
+
}
|
|
21
|
+
const attempt = Promise.resolve().then(() => this.#attemptClose());
|
|
22
|
+
this.#state = { kind: "closing", attempt };
|
|
23
|
+
return attempt;
|
|
24
|
+
}
|
|
25
|
+
async #attemptClose() {
|
|
26
|
+
try {
|
|
27
|
+
await this.handle.close();
|
|
28
|
+
this.#state = { kind: "closed" };
|
|
29
|
+
}
|
|
30
|
+
catch (cause) {
|
|
31
|
+
this.#state =
|
|
32
|
+
this.handle.fd < 0 ? { kind: "failed", cause } : { kind: "open" };
|
|
33
|
+
throw cause;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|