rea-agents 4.0.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +257 -96
- package/bridge/android/ReaJadxBridge.java +247 -0
- package/bridge/ghidra/ReaGhidraBridge.java +358 -15
- package/bridge/ghidra/ReaGhidraExtensions.java +113 -0
- package/bridge/ghidra/ReaGhidraPrepareCom.java +32 -0
- package/bridge/native/NativeUIChildren.swift +27 -0
- package/bridge/native/ReaNativeUI.swift +30 -16
- package/dist/android/AndroidTargetSnapshot.js +36 -0
- package/dist/android/JadxAnalysis.js +193 -0
- package/dist/android/JadxConfiguration.js +57 -0
- package/dist/android/JadxMcpTransport.js +172 -0
- package/dist/android/JadxProtocol.js +109 -0
- package/dist/android/JadxProvider.js +259 -0
- package/dist/android/JadxRelease.js +27 -0
- package/dist/android/JadxSession.js +111 -0
- package/dist/application/AnalysisContextQueries.js +2 -1
- package/dist/application/AppBundleExecutable.js +141 -0
- package/dist/application/ArtifactExtraction.js +7 -4
- package/dist/application/ArtifactGraphConstruction.js +10 -17
- package/dist/application/ArtifactInventory/classify.js +1 -1
- package/dist/application/ArtifactInventory/scanCanonical.js +9 -8
- package/dist/application/ArtifactInventory/scanReader.js +1 -1
- package/dist/application/ArtifactInventory.js +1 -1
- package/dist/application/BinaryTargetResolver.js +32 -68
- package/dist/application/BrowserObservationService.js +2 -1
- package/dist/application/BrowserScenarioCaptureService.js +2 -1
- package/dist/application/BrowserScenarioEvidence.js +2 -2
- package/dist/application/CallPathTracing.js +2 -1
- package/dist/application/CapabilityInventory.js +78 -2
- package/dist/application/ClientConfigPath.js +3 -1
- package/dist/application/ClientConfigurationDocument.js +83 -13
- package/dist/application/ClientRegistrationStatus.js +15 -9
- package/dist/application/DirectAnalysis.js +35 -21
- package/dist/application/DirectAnalysisStatus.js +7 -8
- package/dist/application/Doctor.js +48 -8
- package/dist/application/DoctorDiagnostics.js +9 -7
- package/dist/application/DoctorScope.js +1 -1
- package/dist/application/EnhancedLiteralTracing.js +2 -1
- package/dist/application/EnhancedToolTypes.js +2 -1
- package/dist/application/EnhancedTools.js +7 -5
- package/dist/application/EvidenceBundleCommands.js +3 -2
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/EvidenceInputResolver.js +30 -0
- package/dist/application/FilesystemSnapshot.js +20 -5
- package/dist/application/FunctionAnalysisEvidence.js +32 -0
- package/dist/application/InventoryProjectionEvidence.js +2 -1
- package/dist/application/InvestigationProviders.js +6 -0
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LinuxHopper.js +20 -6
- package/dist/application/MacHopper.js +20 -7
- package/dist/application/OptionalObservationProviders.js +3 -0
- package/dist/application/ProcessCaptureCapability.js +1 -1
- package/dist/application/ProcessCaptureError.js +1 -1
- package/dist/application/ProcessCaptureJournal.js +3 -1
- package/dist/application/ProcessCaptureLifecycle.js +8 -5
- package/dist/application/ProcessCli.js +14 -6
- package/dist/application/ProcessEvidence.js +2 -6
- package/dist/application/ProcessHarness.js +23 -11
- package/dist/application/ProcessNormalization.js +12 -5
- package/dist/application/ProcessSampling.js +3 -1
- package/dist/application/ReconstructionCoverageService.js +4 -7
- package/dist/application/ReconstructionObligationCandidates.js +5 -2
- package/dist/application/ReconstructionObligationLedgerService.js +2 -1
- package/dist/application/ReferenceSourceImport.js +2 -0
- package/dist/application/ReferenceSourceImportEntries.js +22 -3
- package/dist/application/ReferenceSourceImportPolicy.js +4 -2
- package/dist/application/ReferenceSourceImportTypes.js +5 -0
- package/dist/application/ReferenceSourceVcsAdapter.js +35 -4
- package/dist/application/Setup.js +11 -130
- package/dist/application/SetupClientConfiguration.js +36 -22
- package/dist/application/SetupHost.js +126 -0
- package/dist/application/SetupPlan.js +1 -1
- package/dist/application/SetupRegistrationEnvironment.js +1 -2
- package/dist/application/SetupSkill.js +9 -3
- package/dist/application/SetupTypes.js +17 -0
- package/dist/application/StoreFileLock.js +7 -2
- package/dist/application/SupportedClients.js +8 -0
- package/dist/application/Uninstall.js +32 -21
- package/dist/application/UpdateMaintenance.js +3 -3
- package/dist/application/UpdateRuntime.js +5 -2
- package/dist/application/ValidateSelectedWebScript.js +27 -0
- package/dist/application/WebModuleTraceService.js +209 -0
- package/dist/application/WebRuntimeService.js +73 -0
- package/dist/application/WebScriptExportService.js +115 -0
- package/dist/application/WebSourceLocationService.js +160 -0
- package/dist/application/WindowsCapabilities.js +7 -7
- package/dist/application/android/AndroidAnalysisService.js +37 -0
- package/dist/application/{AndroidApplicationService.js → android/AndroidApplicationService.js} +3 -3
- package/dist/application/{AppleApplicationService.js → apple/AppleApplicationService.js} +5 -5
- package/dist/application/{AnalysisClientCleanup.js → binary/AnalysisClientCleanup.js} +2 -2
- package/dist/application/{AnalysisProviderEvaluation.js → binary/AnalysisProviderEvaluation.js} +8 -6
- package/dist/application/{AnalysisProviderRegistry.js → binary/AnalysisProviderRegistry.js} +5 -4
- package/dist/application/{AnalysisSnapshotCache.js → binary/AnalysisSnapshotCache.js} +8 -7
- package/dist/application/{AnalysisSnapshotFiles.js → binary/AnalysisSnapshotFiles.js} +4 -4
- package/dist/application/{BinarySession.js → binary/BinarySession.js} +26 -11
- package/dist/application/{BinarySessionComposition.js → binary/BinarySessionComposition.js} +2 -1
- package/dist/application/{BinarySessionExecution.js → binary/BinarySessionExecution.js} +9 -4
- package/dist/application/{BinarySessionOpen.js → binary/BinarySessionOpen.js} +7 -6
- package/dist/application/{BinarySessionRecords.js → binary/BinarySessionRecords.js} +34 -40
- package/dist/application/{CompositeProvider.js → binary/CompositeProvider.js} +2 -2
- package/dist/application/{LazyAnalysisProvider.js → binary/LazyAnalysisProvider.js} +6 -4
- package/dist/application/{SessionProviderRouter.js → binary/SessionProviderRouter.js} +7 -4
- package/dist/application/firmware/FirmwareAnalysisPort.js +1 -0
- package/dist/application/firmware/FirmwareAnalysisService.js +35 -0
- package/dist/application/{EvidenceLedger.js → investigation/EvidenceLedger.js} +44 -6
- package/dist/application/investigation/InvestigationRecordPort.js +1 -0
- package/dist/application/investigation/InvestigationRecords.js +69 -0
- package/dist/application/{UnknownEvidence.js → investigation/UnknownEvidence.js} +1 -1
- package/dist/application/{ElectronActiveEvidence.js → javascript/ElectronActiveEvidence.js} +4 -4
- package/dist/application/javascript/ElectronActiveObservationPort.js +1 -0
- package/dist/application/{ElectronActiveObservationService.js → javascript/ElectronActiveObservationService.js} +3 -2
- package/dist/application/{ElectronBoundaryAnalysis.js → javascript/ElectronBoundaryAnalysis.js} +1 -1
- package/dist/application/{ElectronBoundaryGraphContext.js → javascript/ElectronBoundaryGraphContext.js} +1 -1
- package/dist/application/{ElectronEvidence.js → javascript/ElectronEvidence.js} +2 -2
- package/dist/application/javascript/ElectronObservationPort.js +1 -0
- package/dist/application/{ElectronObservationService.js → javascript/ElectronObservationService.js} +3 -2
- package/dist/application/{JavaScriptApplicationEvidence.js → javascript/JavaScriptApplicationEvidence.js} +3 -3
- package/dist/application/{JavaScriptApplicationEvidenceGraph.js → javascript/JavaScriptApplicationEvidenceGraph.js} +5 -5
- package/dist/application/javascript/JavaScriptApplicationService.js +99 -0
- package/dist/application/{JavaScriptApplicationWorkflowEvidence.js → javascript/JavaScriptApplicationWorkflowEvidence.js} +3 -3
- package/dist/application/{JavaScriptApplicationWorkflowService.js → javascript/JavaScriptApplicationWorkflowService.js} +12 -11
- package/dist/application/{JavaScriptArtifactAnalysis.js → javascript/JavaScriptArtifactAnalysis.js} +12 -26
- package/dist/application/javascript/JavaScriptArtifactAnalysisTypes.js +1 -0
- package/dist/application/{JavaScriptArtifactGraphAccumulator.js → javascript/JavaScriptArtifactGraphAccumulator.js} +16 -2
- package/dist/application/{JavaScriptArtifactGraphBuilder.js → javascript/JavaScriptArtifactGraphBuilder.js} +2 -2
- package/dist/application/{JavaScriptArtifactGraphContext.js → javascript/JavaScriptArtifactGraphContext.js} +1 -1
- package/dist/application/{JavaScriptArtifactGraphDocuments.js → javascript/JavaScriptArtifactGraphDocuments.js} +1 -1
- package/dist/application/{JavaScriptArtifactGraphFindings.js → javascript/JavaScriptArtifactGraphFindings.js} +20 -7
- package/dist/application/{JavaScriptArtifactGraphStructure.js → javascript/JavaScriptArtifactGraphStructure.js} +1 -1
- package/dist/application/{JavaScriptArtifactPathResolution.js → javascript/JavaScriptArtifactPathResolution.js} +12 -14
- package/dist/application/{JavaScriptArtifactReconstruction.js → javascript/JavaScriptArtifactReconstruction.js} +4 -8
- package/dist/application/{JavaScriptJsonModules.js → javascript/JavaScriptJsonModules.js} +3 -2
- package/dist/application/{JavaScriptModuleRelationships.js → javascript/JavaScriptModuleRelationships.js} +5 -3
- package/dist/application/javascript/JavaScriptRecoveryPort.js +1 -0
- package/dist/application/javascript/JavaScriptRecoveryService.js +52 -0
- package/dist/application/{JavaScriptReturnShapeProjection.js → javascript/JavaScriptReturnShapeProjection.js} +3 -3
- package/dist/application/{JavaScriptRuntimeObservationEvidence.js → javascript/JavaScriptRuntimeObservationEvidence.js} +2 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationPort.js +1 -0
- package/dist/application/{JavaScriptRuntimeObservationService.js → javascript/JavaScriptRuntimeObservationService.js} +3 -2
- package/dist/application/{JavaScriptRuntimeReconciliationEvidence.js → javascript/JavaScriptRuntimeReconciliationEvidence.js} +3 -3
- package/dist/application/{JavaScriptRuntimeReconciliationService.js → javascript/JavaScriptRuntimeReconciliationService.js} +6 -5
- package/dist/application/{JavaScriptSemanticGraphAsyncProjection.js → javascript/JavaScriptSemanticGraphAsyncProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphBuilder.js → javascript/JavaScriptSemanticGraphBuilder.js} +5 -3
- package/dist/application/{JavaScriptSemanticGraphChildProcessProjection.js → javascript/JavaScriptSemanticGraphChildProcessProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphConstruction.js → javascript/JavaScriptSemanticGraphConstruction.js} +3 -2
- package/dist/application/{JavaScriptSemanticGraphDataProjection.js → javascript/JavaScriptSemanticGraphDataProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphFingerprintProjection.js → javascript/JavaScriptSemanticGraphFingerprintProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphFlowProjection.js → javascript/JavaScriptSemanticGraphFlowProjection.js} +2 -2
- package/dist/application/{JavaScriptSemanticGraphObjectProjection.js → javascript/JavaScriptSemanticGraphObjectProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphProjection.js → javascript/JavaScriptSemanticGraphProjection.js} +2 -2
- package/dist/application/{JavaScriptSemanticGraphResourceProjection.js → javascript/JavaScriptSemanticGraphResourceProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticTraceService.js → javascript/JavaScriptSemanticTraceService.js} +6 -5
- package/dist/application/{ManagedApplicationGraphService.js → managed/ManagedApplicationGraphService.js} +7 -6
- package/dist/application/{ManagedMemberComparisonService.js → managed/ManagedMemberComparisonService.js} +10 -8
- package/dist/application/{ManagedNativeVerificationService.js → managed/ManagedNativeVerificationService.js} +7 -6
- package/dist/application/{ManagedReconstructionService.js → managed/ManagedReconstructionService.js} +7 -6
- package/dist/application/{NativeApiInspection.js → native/NativeApiInspection.js} +1 -1
- package/dist/application/{NativeCallRoutes.js → native/NativeCallRoutes.js} +3 -3
- package/dist/application/{NativeDispatchMetadataInspection.js → native/NativeDispatchMetadataInspection.js} +4 -4
- package/dist/application/{NativeUiActionTrace.js → native/NativeUiActionTrace.js} +7 -6
- package/dist/application/{NativeValueTrace.js → native/NativeValueTrace.js} +6 -6
- package/dist/{application/ArtifactInventory/hash.js → artifacts/ArtifactHash.js} +4 -2
- package/dist/artifacts/ArtifactPaths.js +3 -3
- package/dist/artifacts/ArtifactProvider.js +10 -38
- package/dist/artifacts/ArtifactProviderMetadata.js +36 -0
- package/dist/artifacts/AsarArtifactReader.js +195 -23
- package/dist/artifacts/AsarEntryStream.js +76 -0
- package/dist/artifacts/DirectoryArtifactReader.js +43 -7
- package/dist/artifacts/NativeDmgArtifactReader.js +171 -12
- package/dist/artifacts/SafeOutputTree.js +26 -10
- package/dist/artifacts/ZipArtifactReader.js +1 -0
- package/dist/{application → artifacts/apple}/AppleAssetCatalogAnalysis.js +4 -4
- package/dist/{application → artifacts/apple}/InterfaceBuilderAnalysis.js +125 -51
- package/dist/artifacts/{KeyedArchiveReader.js → apple/KeyedArchiveReader.js} +21 -27
- package/dist/artifacts/{NibArchive.js → apple/NibArchive.js} +4 -2
- package/dist/artifacts/apple/NibViewHierarchy.js +150 -0
- package/dist/{application → artifacts/javascript}/JavaScriptArtifactFiles.js +30 -7
- package/dist/artifacts/javascript/JavaScriptArtifactReader.js +6 -0
- package/dist/artifacts/readStableArtifact.js +52 -0
- package/dist/browser/BrowserProcessStartup.js +3 -1
- package/dist/browser/BrowserScenarioSecrets.js +50 -8
- package/dist/browser/CdpAuthorizedMainFrame.js +5 -5
- package/dist/browser/CdpAuthorizedTarget.js +22 -0
- package/dist/browser/CdpBrowserProvider.js +8 -16
- package/dist/browser/CdpCaptureDocuments.js +36 -22
- package/dist/browser/CdpCaptureEventBodyShapes.js +3 -3
- package/dist/browser/CdpCaptureEventHandlers.js +32 -28
- package/dist/browser/CdpCaptureEventHelpers.js +6 -6
- package/dist/browser/CdpCaptureStorage.js +10 -8
- package/dist/browser/CdpCaptureStorageFingerprints.js +25 -23
- package/dist/browser/CdpCaptureValues.js +8 -4
- package/dist/browser/CdpCommandRejection.js +17 -0
- package/dist/browser/CdpConnection.js +59 -17
- package/dist/browser/CdpElectronInspection.js +13 -13
- package/dist/browser/CdpElectronProvider.js +7 -7
- package/dist/browser/CdpElectronScriptEvents.js +6 -6
- package/dist/browser/CdpElectronScripts.js +4 -4
- package/dist/browser/CdpElectronWorkers.js +4 -4
- package/dist/browser/CdpEndpoint.js +22 -10
- package/dist/browser/CdpObservationSession.js +20 -24
- package/dist/browser/CdpOptionalCommand.js +1 -1
- package/dist/browser/CdpPageCapture.js +6 -5
- package/dist/browser/CdpPageCaptureScripts.js +2 -2
- package/dist/browser/CdpPageCaptureWorkers.js +9 -9
- package/dist/browser/CdpSafeMetadata.js +101 -18
- package/dist/browser/CdpScreenshot.js +6 -6
- package/dist/browser/CdpTargetEvents.js +8 -0
- package/dist/browser/CdpTargetSession.js +10 -7
- package/dist/browser/CdpWebMcpDiscovery.js +23 -17
- package/dist/browser/ElectronFileScope.js +9 -3
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +10 -7
- package/dist/browser/PlaywrightElectronActiveActions.js +1 -1
- package/dist/browser/PlaywrightElectronActiveProvider.js +9 -8
- package/dist/browser/PlaywrightExecutionBoundary.js +1 -1
- package/dist/browser/PlaywrightScenarioArtifacts.js +10 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +3 -1
- package/dist/browser/PlaywrightScenarioEvents.js +65 -53
- package/dist/browser/PlaywrightScenarioSession.js +13 -3
- package/dist/browser/WebSourceMapFetcher.js +55 -58
- package/dist/browser/assets/LocalWebScriptArtifacts.js +87 -0
- package/dist/browser/assets/PageScriptCapture.js +32 -0
- package/dist/browser/assets/PublishWebScripts.js +74 -0
- package/dist/browser/assets/ScenarioScriptCapture.js +76 -0
- package/dist/browser/assets/ScriptCaptureAdapters.js +57 -0
- package/dist/browser/assets/WebArtifactReads.js +56 -0
- package/dist/browser/assets/WebSourceLocationArtifacts.js +40 -0
- package/dist/browser/execution/CdpEventListeners.js +79 -0
- package/dist/browser/execution/CdpExecutionCapture.js +135 -0
- package/dist/browser/execution/CdpExecutionCollection.js +57 -0
- package/dist/browser/execution/CdpExecutionWindow.js +100 -0
- package/dist/browser/execution/CdpListenerSelector.js +22 -0
- package/dist/browser/execution/CdpPreciseCoverage.js +48 -0
- package/dist/browser/execution/CdpRuntimeInitiator.js +18 -0
- package/dist/browser/execution/CdpRuntimeProtocol.js +106 -0
- package/dist/browser/execution/CdpRuntimeRequests.js +81 -0
- package/dist/browser/execution/CdpRuntimeSession.js +163 -0
- package/dist/browser/execution/CdpRuntimeSources.js +223 -0
- package/dist/browser/execution/CdpWebRuntimeProvider.js +51 -0
- package/dist/browser/modules/NativeModuleResolver.js +210 -0
- package/dist/browser/modules/WebModuleArtifacts.js +40 -0
- package/dist/browser/network/PlaywrightNetworkContent.js +71 -0
- package/dist/browser/network/PlaywrightScenarioNetwork.js +180 -0
- package/dist/browser/providerIdentities.js +24 -0
- package/dist/catalogIdentity.js +23 -15
- package/dist/cli/androidCommands.js +91 -0
- package/dist/{cliApplicationCommands.js → cli/applicationCommands.js} +49 -16
- package/dist/cli/artifactCommands.js +1 -1
- package/dist/{cliBrowserAdvancedCommands.js → cli/browserAdvancedCommands.js} +39 -24
- package/dist/{cliBrowserCommands.js → cli/browserCommands.js} +9 -9
- package/dist/cli/commandCancellation.js +24 -0
- package/dist/cli/coreAnalysisCommands.js +5 -400
- package/dist/cli/coreBinaryCommands.js +211 -0
- package/dist/cli/coreNativeCommands.js +293 -0
- package/dist/{cliElectronCommands.js → cli/electronCommands.js} +20 -24
- package/dist/cli/firmwareCommands.js +75 -0
- package/dist/{cliSetup.js → cli/interactiveSetup.js} +1 -1
- package/dist/cli/javascriptApplicationAnalysis.js +2 -2
- package/dist/cli/javascriptRecoveryCommands.js +45 -0
- package/dist/cli/managedCommands.js +5 -5
- package/dist/cli/managedProjectGraphCommand.js +2 -2
- package/dist/cli/options.js +7 -1
- package/dist/{cliProcessCommands.js → cli/processCommands.js} +3 -3
- package/dist/cli/referenceSourceImportStatus.js +15 -0
- package/dist/cli/setupCommands.js +4 -2
- package/dist/cli/utilityCommands.js +50 -25
- package/dist/cli/webModuleCommands.js +56 -0
- package/dist/cli/webRuntimeCommands.js +60 -0
- package/dist/cli/webScriptCommands.js +31 -0
- package/dist/cli/webSourceLocationCommands.js +42 -0
- package/dist/cli.js +20 -15
- package/dist/cliBrowserContext.js +5 -3
- package/dist/cliBrowserScenarioCommands.js +6 -4
- package/dist/cliCommandNames.js +19 -2
- package/dist/cliEvidenceCommands.js +2 -1
- package/dist/cliJavaScriptRuntimeCommands.js +8 -5
- package/dist/cliJsonInput.js +35 -13
- package/dist/cliLogging.js +2 -1
- package/dist/cliOutput.js +52 -27
- package/dist/composition/android.js +3 -0
- package/dist/composition/auxiliaryAnalysisProviders.js +30 -0
- package/dist/composition/binary.js +25 -0
- package/dist/composition/browserObservation.js +3 -0
- package/dist/composition/browserScenario.js +3 -0
- package/dist/composition/directAnalysis.js +17 -0
- package/dist/composition/electronObservation.js +3 -0
- package/dist/composition/electronScenario.js +3 -0
- package/dist/composition/firmware.js +3 -0
- package/dist/composition/javascriptRecovery.js +3 -0
- package/dist/composition/javascriptRuntimeObservation.js +3 -0
- package/dist/composition/optionalObservationProviders.js +49 -0
- package/dist/composition/webModules.js +5 -0
- package/dist/composition/webRuntime.js +4 -0
- package/dist/composition/webSourceLocations.js +5 -0
- package/dist/config/environment.js +11 -1
- package/dist/config/parseConfig.js +29 -4
- package/dist/config/parsers.js +1 -1
- package/dist/contracts/android/androidToolContracts.js +77 -0
- package/dist/contracts/applicationToolContracts.js +75 -13
- package/dist/contracts/artifactComparisonExample.js +7 -14
- package/dist/contracts/artifactToolContracts.js +2 -2
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/enhancedInputs.js +1 -1
- package/dist/contracts/enhancedToolContracts.js +31 -0
- package/dist/contracts/errorSchemas.js +4 -2
- package/dist/contracts/evidenceInputContracts.js +13 -0
- package/dist/contracts/firmware/firmwareToolContracts.js +38 -0
- package/dist/contracts/{applicationWorkflowInputContracts.js → javascript/applicationWorkflowInputContracts.js} +18 -18
- package/dist/contracts/{electronToolContracts.js → javascript/electronToolContracts.js} +6 -6
- package/dist/contracts/{javascriptApplicationWorkflowExamples.js → javascript/javascriptApplicationWorkflowExamples.js} +3 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +23 -0
- package/dist/contracts/{javascriptRuntimeObservationToolContracts.js → javascript/javascriptRuntimeObservationToolContracts.js} +3 -3
- package/dist/contracts/{javascriptRuntimeReconciliationExample.js → javascript/javascriptRuntimeReconciliationExample.js} +5 -5
- package/dist/contracts/{managedToolContracts.js → managed/managedToolContracts.js} +3 -3
- package/dist/contracts/{managedWorkflowExamples.js → managed/managedWorkflowExamples.js} +1 -1
- package/dist/contracts/{managedWorkflowToolContracts.js → managed/managedWorkflowToolContracts.js} +6 -6
- package/dist/contracts/mobileApplicationGraphExamples.js +105 -0
- package/dist/contracts/{nativeToolContracts.js → native/nativeToolContracts.js} +14 -7
- package/dist/contracts/officialToolContracts.js +66 -0
- package/dist/contracts/promptContracts.js +1 -1
- package/dist/contracts/sessionLifecycleInputs.js +4 -0
- package/dist/contracts/sessionToolContracts.js +43 -0
- package/dist/contracts/sessionToolSchemas.js +1 -1
- package/dist/contracts/toolContractExamples.js +5 -0
- package/dist/contracts/toolContractTypes.js +2 -0
- package/dist/contracts/toolContracts.js +18 -135
- package/dist/contracts/toolEffects.js +75 -0
- package/dist/contracts/toolOutputSchemaGroups.js +20 -16
- package/dist/contracts/toolOutputSchemaPrimitives.js +1 -0
- package/dist/contracts/webRuntimeToolContracts.js +43 -0
- package/dist/contracts/webScriptToolContracts.js +68 -0
- package/dist/doctorRuntime.js +5 -1
- package/dist/domain/analysisErrorBase.js +33 -0
- package/dist/domain/analysisErrorCore.js +62 -0
- package/dist/domain/analysisErrorPresentation.js +22 -2
- package/dist/domain/analysisErrorProjection.js +25 -3
- package/dist/domain/analysisSnapshot.js +1 -0
- package/dist/domain/android/androidAnalysis.js +141 -0
- package/dist/domain/{androidApplication.js → android/androidApplication.js} +7 -6
- package/dist/domain/apple/appleApplication.js +277 -0
- package/dist/domain/{appleAssetCatalog.js → apple/appleAssetCatalog.js} +2 -2
- package/dist/domain/apple/appleBundleAnatomy.js +236 -0
- package/dist/domain/{interfaceBuilderGraph.js → apple/interfaceBuilderGraph.js} +47 -312
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +411 -0
- package/dist/domain/{keyedArchive.js → apple/keyedArchive.js} +10 -9
- package/dist/domain/apple/plistValue.js +35 -0
- package/dist/domain/artifactGraph.js +1 -0
- package/dist/domain/artifactInspection.js +19 -17
- package/dist/domain/artifactInventoryEvidence.js +32 -27
- package/dist/domain/artifactInventorySnapshot.js +1 -0
- package/dist/domain/artifactOperationError.js +20 -0
- package/dist/domain/artifactPathSyntax.js +26 -0
- package/dist/domain/browserNetworkEvidence.js +82 -0
- package/dist/domain/browserObservation.js +12 -4
- package/dist/domain/browserObservationError.js +25 -0
- package/dist/domain/browserObservationSchemas.js +2 -1
- package/dist/domain/browserScenario.js +1 -1
- package/dist/domain/browserScenarioCapture.js +23 -1
- package/dist/domain/browserScenarioCaptureValues.js +25 -0
- package/dist/domain/browserScenarioDiff.js +7 -4
- package/dist/domain/browserScenarioDiffEvidence.js +35 -1
- package/dist/domain/browserScenarioNormalization.js +6 -11
- package/dist/domain/browserScenarioValues.js +15 -2
- package/dist/domain/browserSession.js +2 -7
- package/dist/domain/bundleComparison.js +2 -1
- package/dist/domain/callPath.js +86 -38
- package/dist/domain/canonicalDigest.js +65 -0
- package/dist/domain/canonicalOrdering.js +11 -0
- package/dist/domain/changedBehavior.js +8 -7
- package/dist/domain/comparisonSemantics.js +2 -4
- package/dist/domain/comparisonStatus.js +39 -0
- package/dist/domain/configurationErrors.js +25 -0
- package/dist/domain/dosCom.js +8 -0
- package/dist/domain/evidence.js +3 -11
- package/dist/domain/evidenceBundle.js +98 -35
- package/dist/domain/evidenceErrors.js +30 -0
- package/dist/domain/firmware/firmwareAnalysis.js +121 -0
- package/dist/domain/functionComparison.js +4 -2
- package/dist/domain/functionComparisonDimensions.js +6 -4
- package/dist/domain/functionComparisonNormalization.js +13 -8
- package/dist/domain/functionComparisonResults.js +1 -4
- package/dist/domain/hopperErrors.js +78 -0
- package/dist/domain/hopperValues.js +4 -3
- package/dist/domain/inputIssueProjection.js +17 -2
- package/dist/domain/{electronActiveObservation.js → javascript/electronActiveObservation.js} +3 -1
- package/dist/domain/{electronObservation.js → javascript/electronObservation.js} +5 -11
- package/dist/domain/{electronStaticAnalysisBrowser.js → javascript/electronStaticAnalysisBrowser.js} +15 -24
- package/dist/domain/{electronStaticAnalysisIpc.js → javascript/electronStaticAnalysisIpc.js} +2 -2
- package/dist/domain/{electronStaticAnalysisNative.js → javascript/electronStaticAnalysisNative.js} +12 -12
- package/dist/domain/javascript/electronStaticAnalysisTypes.js +1 -0
- package/dist/domain/{electronStaticAnalysisValues.js → javascript/electronStaticAnalysisValues.js} +24 -4
- package/dist/domain/{javascriptApplicationAnalysis.js → javascript/javascriptApplicationAnalysis.js} +2 -2
- package/dist/domain/{javascriptApplicationChangeGraph.js → javascript/javascriptApplicationChangeGraph.js} +2 -2
- package/dist/domain/{javascriptApplicationEvidenceSchemas.js → javascript/javascriptApplicationEvidenceSchemas.js} +6 -4
- package/dist/domain/{javascriptApplicationGraph.js → javascript/javascriptApplicationGraph.js} +13 -22
- package/dist/domain/{javascriptApplicationGraphSchemas.js → javascript/javascriptApplicationGraphSchemas.js} +2 -2
- package/dist/domain/{javascriptApplicationVersionComparison.js → javascript/javascriptApplicationVersionComparison.js} +3 -11
- package/dist/domain/{javascriptApplicationVersionComparisonSchemas.js → javascript/javascriptApplicationVersionComparisonSchemas.js} +3 -3
- package/dist/domain/{javascriptApplicationVersionItems.js → javascript/javascriptApplicationVersionItems.js} +4 -4
- package/dist/domain/{javascriptApplicationVersionKeys.js → javascript/javascriptApplicationVersionKeys.js} +16 -9
- package/dist/domain/javascript/javascriptArtifactFiles.js +1 -0
- package/dist/domain/{javascriptAstFingerprint.js → javascript/javascriptAstFingerprint.js} +38 -22
- package/dist/domain/javascript/javascriptAstValues.js +23 -0
- package/dist/domain/{javascriptExportShapeComparison.js → javascript/javascriptExportShapeComparison.js} +1 -2
- package/dist/domain/{javascriptExportShapeComparisonSchemas.js → javascript/javascriptExportShapeComparisonSchemas.js} +2 -2
- package/dist/domain/{javascriptExportShapeSelection.js → javascript/javascriptExportShapeSelection.js} +1 -1
- package/dist/domain/{javascriptExportShapeVariants.js → javascript/javascriptExportShapeVariants.js} +7 -3
- package/dist/domain/{javascriptFeatureSeed.js → javascript/javascriptFeatureSeed.js} +32 -11
- package/dist/domain/{javascriptFeatureTrace.js → javascript/javascriptFeatureTrace.js} +9 -13
- package/dist/domain/{javascriptFeatureTraceSchemas.js → javascript/javascriptFeatureTraceSchemas.js} +32 -18
- package/dist/domain/{javascriptFeatureTraversal.js → javascript/javascriptFeatureTraversal.js} +7 -2
- package/dist/domain/{javascriptNativeHandoff.js → javascript/javascriptNativeHandoff.js} +2 -1
- package/dist/domain/javascript/javascriptRecovery.js +88 -0
- package/dist/domain/{javascriptRuntimeLoadState.js → javascript/javascriptRuntimeLoadState.js} +2 -2
- package/dist/domain/{javascriptRuntimeObservation.js → javascript/javascriptRuntimeObservation.js} +2 -2
- package/dist/domain/{javascriptRuntimeReconciliationActive.js → javascript/javascriptRuntimeReconciliationActive.js} +5 -12
- package/dist/domain/{javascriptRuntimeReconciliationGraph.js → javascript/javascriptRuntimeReconciliationGraph.js} +2 -2
- package/dist/domain/{javascriptRuntimeReconciliationMatching.js → javascript/javascriptRuntimeReconciliationMatching.js} +4 -3
- package/dist/domain/{javascriptRuntimeReconciliationParsing.js → javascript/javascriptRuntimeReconciliationParsing.js} +11 -17
- package/dist/domain/{javascriptRuntimeReconciliationResult.js → javascript/javascriptRuntimeReconciliationResult.js} +4 -4
- package/dist/domain/{javascriptRuntimeReconciliationSchemas.js → javascript/javascriptRuntimeReconciliationSchemas.js} +8 -5
- package/dist/domain/{javascriptRuntimeStaticCandidates.js → javascript/javascriptRuntimeStaticCandidates.js} +8 -4
- package/dist/domain/{javascriptSemanticAnalysis.js → javascript/javascriptSemanticAnalysis.js} +80 -17
- package/dist/domain/{javascriptSemanticAsyncEffects.js → javascript/javascriptSemanticAsyncEffects.js} +2 -1
- package/dist/domain/{javascriptSemanticCallResolution.js → javascript/javascriptSemanticCallResolution.js} +11 -5
- package/dist/domain/{javascriptSemanticCalls.js → javascript/javascriptSemanticCalls.js} +7 -4
- package/dist/domain/{javascriptSemanticChildProcesses.js → javascript/javascriptSemanticChildProcesses.js} +5 -2
- package/dist/domain/{javascriptSemanticDataEffectHelpers.js → javascript/javascriptSemanticDataEffectHelpers.js} +7 -6
- package/dist/domain/{javascriptSemanticDataEffects.js → javascript/javascriptSemanticDataEffects.js} +9 -6
- package/dist/domain/{javascriptSemanticFingerprints.js → javascript/javascriptSemanticFingerprints.js} +40 -16
- package/dist/domain/{javascriptSemanticGraph.js → javascript/javascriptSemanticGraph.js} +23 -28
- package/dist/domain/{javascriptSemanticGraphSchemas.js → javascript/javascriptSemanticGraphSchemas.js} +3 -3
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +116 -0
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +53 -0
- package/dist/domain/{javascriptSemanticObjects.js → javascript/javascriptSemanticObjects.js} +5 -5
- package/dist/domain/{javascriptSemanticPrimitives.js → javascript/javascriptSemanticPrimitives.js} +9 -2
- package/dist/domain/{javascriptSemanticProjection.js → javascript/javascriptSemanticProjection.js} +32 -44
- package/dist/domain/{javascriptSemanticPromises.js → javascript/javascriptSemanticPromises.js} +77 -21
- package/dist/domain/{javascriptSemanticProvenance.js → javascript/javascriptSemanticProvenance.js} +4 -1
- package/dist/domain/{javascriptSemanticQuery.js → javascript/javascriptSemanticQuery.js} +7 -8
- package/dist/domain/{javascriptSemanticQueryAssessment.js → javascript/javascriptSemanticQueryAssessment.js} +1 -2
- package/dist/domain/{javascriptSemanticQueryIdentity.js → javascript/javascriptSemanticQueryIdentity.js} +1 -2
- package/dist/domain/{javascriptSemanticQuerySchemas.js → javascript/javascriptSemanticQuerySchemas.js} +3 -3
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +25 -0
- package/dist/domain/{javascriptSemanticResources.js → javascript/javascriptSemanticResources.js} +2 -1
- package/dist/domain/{javascriptSemanticReturns.js → javascript/javascriptSemanticReturns.js} +2 -1
- package/dist/domain/{javascriptSemanticTraceSchemas.js → javascript/javascriptSemanticTraceSchemas.js} +2 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +55 -0
- package/dist/domain/javascript/javascriptSemanticValueTypes.js +1 -0
- package/dist/domain/{javascriptSemanticValues.js → javascript/javascriptSemanticValues.js} +118 -60
- package/dist/domain/{javascriptSourceParser.js → javascript/javascriptSourceParser.js} +4 -2
- package/dist/domain/{javascriptStaticAnalysis.js → javascript/javascriptStaticAnalysis.js} +8 -5
- package/dist/domain/{javascriptStaticAnalysisBundler.js → javascript/javascriptStaticAnalysisBundler.js} +15 -11
- package/dist/domain/{javascriptStaticAnalysisCalls.js → javascript/javascriptStaticAnalysisCalls.js} +16 -8
- package/dist/domain/{javascriptStaticAnalysisHelpers.js → javascript/javascriptStaticAnalysisHelpers.js} +261 -43
- package/dist/domain/{sourceToBundleComparison.js → javascript/sourceToBundleComparison.js} +6 -8
- package/dist/domain/{sourceToBundleComparisonSchemas.js → javascript/sourceToBundleComparisonSchemas.js} +4 -4
- package/dist/domain/{sourceToBundleSignals.js → javascript/sourceToBundleSignals.js} +7 -7
- package/dist/domain/jsonShape.js +6 -2
- package/dist/domain/{managedApplicationGraph.js → managed/managedApplicationGraph.js} +4 -4
- package/dist/domain/{managedApplicationGraphNodes.js → managed/managedApplicationGraphNodes.js} +1 -1
- package/dist/domain/{managedArtifact.js → managed/managedArtifact.js} +1 -1
- package/dist/domain/{managedMemberComparison.js → managed/managedMemberComparison.js} +5 -4
- package/dist/domain/{managedMemberComparisonCoverage.js → managed/managedMemberComparisonCoverage.js} +2 -1
- package/dist/domain/{managedMemberComparisonItems.js → managed/managedMemberComparisonItems.js} +99 -40
- package/dist/domain/{managedMemberComparisonMatch.js → managed/managedMemberComparisonMatch.js} +22 -11
- package/dist/domain/{managedNativeVerification.js → managed/managedNativeVerification.js} +1 -1
- package/dist/domain/{managedNativeVerificationMatch.js → managed/managedNativeVerificationMatch.js} +8 -6
- package/dist/domain/{managedNativeVerificationSchemas.js → managed/managedNativeVerificationSchemas.js} +6 -5
- package/dist/domain/{managedReconstruction.js → managed/managedReconstruction.js} +3 -3
- package/dist/domain/{nativeDataType.js → native/nativeDataType.js} +2 -0
- package/dist/domain/native/nativeFunctionAnnotations.js +43 -0
- package/dist/domain/{nativeInspection.js → native/nativeInspection.js} +1 -1
- package/dist/domain/{nativeInvestigationGraph.js → native/nativeInvestigationGraph.js} +13 -4
- package/dist/domain/native/nativeLoadImage.js +95 -0
- package/dist/domain/native/nativeMetadataRecovery.js +55 -0
- package/dist/domain/{nativeUiObservation.js → native/nativeUiObservation.js} +20 -6
- package/dist/domain/{objcSwiftMetadata.js → native/objcSwiftMetadata.js} +17 -0
- package/dist/domain/processCapture.js +4 -3
- package/dist/domain/processEvidenceProvider.js +11 -0
- package/dist/domain/processScenario.js +17 -17
- package/dist/domain/processTraceComparison.js +1 -1
- package/dist/domain/propertyListKeys.js +69 -0
- package/dist/domain/providerAdapterError.js +17 -0
- package/dist/domain/providerCleanupError.js +6 -3
- package/dist/domain/providerSelectionError.js +44 -0
- package/dist/domain/reconstructionCoverageEvaluation.js +46 -24
- package/dist/domain/reconstructionCoverageInput.js +7 -0
- package/dist/domain/reconstructionUnknowns.js +1 -1
- package/dist/domain/reconstructionVerification.js +22 -8
- package/dist/domain/referenceSourceClassification.js +5 -6
- package/dist/domain/referenceSourceGraph.js +9 -17
- package/dist/domain/referenceSourceImportParsing.js +38 -23
- package/dist/domain/runtimeIdentification.js +1 -1
- package/dist/domain/runtimeVersion.js +6 -7
- package/dist/domain/safeJson.js +13 -0
- package/dist/domain/sourceMapEnvelope.js +38 -0
- package/dist/domain/staticRuntimeCorrelation.js +9 -7
- package/dist/domain/unicodeCodePointOrder.js +11 -6
- package/dist/domain/unknownRegistryError.js +10 -0
- package/dist/domain/webBundleAnalyzerAst.js +23 -38
- package/dist/domain/webBundleAnalyzerInspection.js +29 -20
- package/dist/domain/webEventListeners.js +28 -0
- package/dist/domain/webExecution.js +74 -0
- package/dist/domain/webMcpDiscovery.js +1 -7
- package/dist/domain/webModuleImports.js +104 -0
- package/dist/domain/webModuleTrace.js +106 -0
- package/dist/domain/webRuntime.js +69 -0
- package/dist/domain/webScreenshot.js +1 -7
- package/dist/domain/webScriptArtifacts.js +39 -0
- package/dist/domain/webScriptExport.js +86 -0
- package/dist/domain/webScriptExportError.js +13 -0
- package/dist/domain/webScriptExportPlan.js +108 -0
- package/dist/domain/webSourceLocation.js +106 -0
- package/dist/domain/webSourcePosition.js +21 -0
- package/dist/dotnet/ManagedArtifactInspector.js +1 -1
- package/dist/dotnet/ManagedMemberInspector.js +1 -1
- package/dist/dotnet/ManagedMemberInspectorCore.js +34 -0
- package/dist/dotnet/ManagedMemberRows.js +6 -4
- package/dist/dotnet/ManagedMetadataHeaps.js +3 -2
- package/dist/dotnet/ManagedMetadataInventoryRows.js +4 -2
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -1
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +22 -16
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +56 -50
- package/dist/dotnet/ManagedStaticProvider.js +6 -34
- package/dist/dotnet/ManagedStaticProviderMetadata.js +36 -0
- package/dist/evaluation/CodexAgentEval.js +2 -1
- package/dist/firmware/FirmwareCommand.js +163 -0
- package/dist/firmware/FirmwareFiles.js +190 -0
- package/dist/firmware/FirmwareProvider.js +264 -0
- package/dist/firmware/FirmwarePublication.js +84 -0
- package/dist/firmware/FirmwareRelease.js +32 -0
- package/dist/firmware/FirmwareReports.js +235 -0
- package/dist/firmware/FirmwareVersion.js +80 -0
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +5 -5
- package/dist/ghidra/GhidraAnalysisProfile.js +37 -8
- package/dist/ghidra/GhidraClient.js +52 -6
- package/dist/ghidra/GhidraDiagnostics.js +3 -0
- package/dist/ghidra/GhidraDoctor.js +38 -14
- package/dist/ghidra/GhidraFunctionValues.js +14 -8
- package/dist/ghidra/GhidraInstallation.js +48 -38
- package/dist/ghidra/GhidraInstallationPolicy.js +140 -0
- package/dist/ghidra/GhidraInventoryValues.js +39 -2
- package/dist/ghidra/GhidraLauncher.js +102 -29
- package/dist/ghidra/GhidraLoadImageAttest.js +36 -0
- package/dist/ghidra/GhidraLoadImageValues.js +199 -0
- package/dist/ghidra/GhidraProvider.js +47 -149
- package/dist/ghidra/GhidraProviderCapabilities.js +58 -28
- package/dist/ghidra/GhidraProviderClient.js +209 -0
- package/dist/ghidra/GhidraRequestQueue.js +2 -2
- package/dist/ghidra/GhidraResponseBuffer.js +7 -1
- package/dist/ghidra/GhidraSessionError.js +31 -4
- package/dist/ghidra/GhidraSessionValues.js +10 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +16 -2
- package/dist/ghidra/GhidraTransport.js +12 -0
- package/dist/ghidra/extensions/GhidraExtensionFailures.js +20 -0
- package/dist/ghidra/extensions/GhidraExtensions.js +170 -0
- package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +21 -0
- package/dist/ghidra/extensions/nativeaot/NativeAotReport.js +100 -0
- package/dist/hopper/BridgeLauncher.js +4 -2
- package/dist/hopper/HopperAnalysisProfile.js +7 -2
- package/dist/hopper/HopperCleanup.js +55 -9
- package/dist/hopper/HopperClient.js +14 -4
- package/dist/hopper/HopperProcessDiagnostic.js +1 -1
- package/dist/hopper/HopperProvider.js +8 -50
- package/dist/hopper/HopperProviderCapabilities.js +73 -0
- package/dist/hopper/HopperRequestQueue.js +7 -3
- package/dist/hopper/HopperResponseStream.js +7 -1
- package/dist/hopper/HopperSessionValues.js +1 -1
- package/dist/hopper/HopperSocketConnection.js +1 -1
- package/dist/hopper/HopperTargetLease.js +23 -15
- package/dist/hopper/LinuxPrivateDisplayDiagnostic.js +7 -8
- package/dist/hopper/LinuxPrivateDisplayProbe.js +10 -6
- package/dist/hopper/protocol.js +8 -8
- package/dist/ida/IdaConfiguration.js +56 -0
- package/dist/ida/IdaDoctor.js +53 -0
- package/dist/ida/IdaInput.js +62 -0
- package/dist/ida/IdaMcpConnection.js +111 -0
- package/dist/ida/IdaOperationRunner.js +299 -0
- package/dist/ida/IdaProtocolValues.js +178 -0
- package/dist/ida/IdaProvider.js +126 -0
- package/dist/ida/IdaProviderCapabilities.js +52 -0
- package/dist/ida/IdaSessionClient.js +318 -0
- package/dist/ida/IdaWorkspace.js +54 -0
- package/dist/{browser → inspector}/JavaScriptRuntimeScope.js +19 -6
- package/dist/{browser → inspector}/V8InspectorCaptureProjection.js +46 -8
- package/dist/{browser → inspector}/V8InspectorEndpoint.js +3 -2
- package/dist/{browser → inspector}/V8InspectorProvider.js +16 -14
- package/dist/inspector/providerIdentity.js +6 -0
- package/dist/javascript/recovery/RecoveryFiles.js +122 -0
- package/dist/javascript/recovery/WakaruCommand.js +116 -0
- package/dist/javascript/recovery/WakaruExecution.js +100 -0
- package/dist/javascript/recovery/WakaruProvider.js +96 -0
- package/dist/javascript/recovery/WakaruPublication.js +102 -0
- package/dist/javascript/recovery/WakaruRelease.js +29 -0
- package/dist/javascript/recovery/WakaruReport.js +134 -0
- package/dist/javascript/sourceMaps/SourceMapCodecProcess.js +37 -0
- package/dist/javascript/sourceMaps/SourceMapCodecProtocol.js +20 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +176 -0
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +61 -0
- package/dist/javascript/sourceMaps/SourceMapFormat.js +185 -0
- package/dist/javascript/sourceMaps/TraceSourceMap.js +138 -0
- package/dist/main/shutdown.js +29 -3
- package/dist/main/startup.js +1 -1
- package/dist/main/transport.js +32 -11
- package/dist/main.js +9 -20
- package/dist/native/AppleDispatchCoverage.js +58 -0
- package/dist/native/AppleDispatchMetadata.js +73 -490
- package/dist/native/AppleMachoFixups.js +292 -0
- package/dist/native/AppleMachoSelection.js +188 -0
- package/dist/native/AppleObjcCategories.js +59 -0
- package/dist/native/AppleObjcDispatchFacets.js +257 -0
- package/dist/native/AppleObjcProperties.js +68 -0
- package/dist/native/AppleObjcProtocols.js +2 -1
- package/dist/native/AppleSwiftDispatchFacets.js +150 -0
- package/dist/native/NativeMacOSProvider.js +204 -72
- package/dist/native/NativeMacOSProviderMetadata.js +42 -0
- package/dist/native/NativeMachoInspection.js +87 -26
- package/dist/native/NativeUiHelperRuntime.js +14 -4
- package/dist/native/NativeUiObservation.js +14 -6
- package/dist/native/NativeUiOutputBudget.js +8 -0
- package/dist/native/parsers/codesign.js +40 -5
- package/dist/native/parsers/demangle.js +6 -2
- package/dist/native/parsers/dyldInfo.js +16 -7
- package/dist/native/parsers/echoedPath.js +14 -0
- package/dist/native/parsers/lipo.js +14 -0
- package/dist/native/parsers/otool.js +5 -2
- package/dist/native/parsers/plist.js +174 -11
- package/dist/process/ExecFileOutput.js +2 -0
- package/dist/process/PrivateRuntimeRoot.js +13 -3
- package/dist/process/ProcessOwnership.js +5 -73
- package/dist/process/ProcessOwnershipObservation.js +62 -2
- package/dist/process/ProcessOwnershipProcessTree.js +13 -0
- package/dist/process/ProviderProcess.js +62 -24
- package/dist/process/ProviderRunLineage.js +1 -1
- package/dist/process/WindowsAuthority.js +20 -1
- package/dist/reference/ReferenceSourceReaderEntries.js +11 -2
- package/dist/reference/ReferenceSourceReaderFile.js +1 -0
- package/dist/server/createServer.js +67 -2
- package/dist/server/mcpClientMetadata.js +6 -3
- package/dist/server/mcpProgress.js +2 -1
- package/dist/server/promptCompletion.js +3 -3
- package/dist/server/registerAndroidTools.js +30 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +7 -3
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +9 -4
- package/dist/server/registerApplicationTools/compareVersions.js +7 -3
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +43 -0
- package/dist/server/registerApplicationTools/traceFeature.js +8 -3
- package/dist/server/registerApplicationTools/traceSemantics.js +8 -3
- package/dist/server/registerApplicationTools.js +2 -0
- package/dist/server/registerBrowserScenarioTool.js +6 -2
- package/dist/server/registerBrowserTools.js +13 -2
- package/dist/server/registerCloseLifecycleTool.js +1 -1
- package/dist/server/registerElectronTools.js +21 -7
- package/dist/server/registerEnhancedTools.js +28 -1
- package/dist/server/registerFirmwareTools.js +22 -0
- package/dist/server/registerFunctionComparisonTool.js +1 -1
- package/dist/server/registerInvestigationTools/helpers.js +2 -1
- package/dist/server/registerJavaScriptRecoveryTool.js +17 -0
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +9 -4
- package/dist/server/registerManagedTools.js +4 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +2 -2
- package/dist/server/registerManagedWorkflowTools/contract.js +1 -1
- package/dist/server/registerManagedWorkflowTools/evidence.js +1 -1
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +1 -1
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +1 -1
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +2 -2
- package/dist/server/registerNativeTools.js +1 -1
- package/dist/server/registerOfficialTools.js +4 -1
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerPrompts.js +5 -1
- package/dist/server/registerSessionTools.js +4 -2
- package/dist/server/registerWebModuleTool.js +17 -0
- package/dist/server/registerWebRuntimeTools.js +31 -0
- package/dist/server/registerWebScriptTool.js +18 -0
- package/dist/server/registerWebSourceLocationTool.js +17 -0
- package/dist/server/runDerivedOperation.js +1 -1
- package/dist/server/sessionAvailabilityPolicy.js +24 -9
- package/dist/server/sessionEvidence.js +1 -1
- package/dist/server/toolResult.js +2 -1
- package/dist/windows/WindowsNativeLoader.js +108 -0
- package/dist/windows/WindowsOwnedProcess.js +170 -0
- package/dist/windows/WindowsPrivateRuntime.js +137 -0
- package/install.sh +16 -8
- package/native/windows/README.md +107 -0
- package/native/windows/build/manifest.json +9 -0
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +70 -35
- package/scripts/hopper-demo-x11.py +67 -8
- package/scripts/rea.mjs +10 -2
- package/scripts/verify-windows-native-artifact.mjs +39 -0
- package/skills/reverse-engineer-anything/SKILL.md +92 -24
- package/skills/reverse-engineer-anything/references/android-applications.md +31 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +19 -2
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +61 -4
- package/dist/application/JavaScriptApplicationService.js +0 -52
- package/dist/application/runtime.js +0 -51
- package/dist/browser/CdpCanonicalJsonDigest.js +0 -9
- package/dist/domain/appleApplication.js +0 -181
- package/dist/domain/errors.js +0 -324
- package/dist/domain/javascriptAstValues.js +0 -13
- package/dist/domain/javascriptSemanticTraversal.js +0 -30
- package/dist/native/NativeHostCapabilities.js +0 -23
- /package/dist/application/{BinarySessionPort.js → DirectAnalysisDependencies.js} +0 -0
- /package/dist/application/{ElectronActiveObservationPort.js → WebModulePorts.js} +0 -0
- /package/dist/application/{ElectronObservationPort.js → WebRuntimePort.js} +0 -0
- /package/dist/application/{JavaScriptArtifactAnalysisTypes.js → WebScriptArtifactPort.js} +0 -0
- /package/dist/application/{JavaScriptRuntimeObservationPort.js → WebSourceLocationPorts.js} +0 -0
- /package/dist/{domain/electronStaticAnalysisTypes.js → application/android/AndroidAnalysisPort.js} +0 -0
- /package/dist/application/{AbortablePromise.js → binary/AbortablePromise.js} +0 -0
- /package/dist/{domain/javascriptSemanticValueTypes.js → application/binary/BinarySessionPort.js} +0 -0
- /package/dist/application/{BinarySessionStatus.js → binary/BinarySessionStatus.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraph.js → javascript/ElectronBoundaryGraph.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraphIpc.js → javascript/ElectronBoundaryGraphIpc.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraphNative.js → javascript/ElectronBoundaryGraphNative.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraphWindows.js → javascript/ElectronBoundaryGraphWindows.js} +0 -0
- /package/dist/application/{JavaScriptArtifactGraphBundlers.js → javascript/JavaScriptArtifactGraphBundlers.js} +0 -0
- /package/dist/application/{JavaScriptArtifactGraphEvidence.js → javascript/JavaScriptArtifactGraphEvidence.js} +0 -0
- /package/dist/application/{JavaScriptArtifactReconstructionInput.js → javascript/JavaScriptArtifactReconstructionInput.js} +0 -0
- /package/dist/application/{JavaScriptSemanticGraphEvidence.js → javascript/JavaScriptSemanticGraphEvidence.js} +0 -0
- /package/dist/application/{JavaScriptSemanticGraphValueProjection.js → javascript/JavaScriptSemanticGraphValueProjection.js} +0 -0
- /package/dist/domain/{electronStaticAnalysis.js → javascript/electronStaticAnalysis.js} +0 -0
- /package/dist/domain/{javascriptExportShapeComparisonIdentity.js → javascript/javascriptExportShapeComparisonIdentity.js} +0 -0
- /package/dist/domain/{javascriptRuntimeReconciliation.js → javascript/javascriptRuntimeReconciliation.js} +0 -0
- /package/dist/domain/{javascriptRuntimeReconciliationRuntime.js → javascript/javascriptRuntimeReconciliationRuntime.js} +0 -0
- /package/dist/domain/{javascriptSemanticCoverage.js → javascript/javascriptSemanticCoverage.js} +0 -0
- /package/dist/domain/{javascriptSemanticDerivedAnalysis.js → javascript/javascriptSemanticDerivedAnalysis.js} +0 -0
- /package/dist/domain/{javascriptSemanticGraphSerialization.js → javascript/javascriptSemanticGraphSerialization.js} +0 -0
- /package/dist/domain/{javascriptSemanticIr.js → javascript/javascriptSemanticIr.js} +0 -0
- /package/dist/domain/{javascriptSemanticQueryRelations.js → javascript/javascriptSemanticQueryRelations.js} +0 -0
- /package/dist/domain/{javascriptSemanticState.js → javascript/javascriptSemanticState.js} +0 -0
- /package/dist/domain/{javascriptStaticAnalysisFindings.js → javascript/javascriptStaticAnalysisFindings.js} +0 -0
- /package/dist/domain/{javascriptStaticAnalysisState.js → javascript/javascriptStaticAnalysisState.js} +0 -0
- /package/dist/domain/{javascriptStaticAnalysisTypes.js → javascript/javascriptStaticAnalysisTypes.js} +0 -0
- /package/dist/domain/{managedApplicationGraphCoverage.js → managed/managedApplicationGraphCoverage.js} +0 -0
- /package/dist/domain/{managedApplicationGraphNodeCoverage.js → managed/managedApplicationGraphNodeCoverage.js} +0 -0
- /package/dist/domain/{nativeApiBoundary.js → native/nativeApiBoundary.js} +0 -0
- /package/dist/domain/{nativeInstruction.js → native/nativeInstruction.js} +0 -0
- /package/dist/domain/{nativeValueFlow.js → native/nativeValueFlow.js} +0 -0
- /package/dist/domain/{nativeValueTrace.js → native/nativeValueTrace.js} +0 -0
|
@@ -22,15 +22,17 @@ func attribute(_ element: AXUIElement, _ key: String) -> CFTypeRef? {
|
|
|
22
22
|
var value: CFTypeRef?
|
|
23
23
|
return AXUIElementCopyAttributeValue(element, key as CFString, &value) == .success ? value : nil
|
|
24
24
|
}
|
|
25
|
-
func childCount(_ element: AXUIElement) ->
|
|
25
|
+
func childCount(_ element: AXUIElement) -> ChildCount {
|
|
26
26
|
var count = 0
|
|
27
|
-
|
|
27
|
+
let status = AXUIElementGetAttributeValueCount(element, kAXChildrenAttribute as CFString, &count)
|
|
28
|
+
return captureChildCount(status: status.rawValue, success: AXError.success.rawValue, value: count)
|
|
28
29
|
}
|
|
29
|
-
func children(_ element: AXUIElement,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
func children(_ element: AXUIElement, count: Int) -> ChildBatch<AXUIElement> {
|
|
31
|
+
captureChildValues(requestedCount: count) {
|
|
32
|
+
var value: CFArray?
|
|
33
|
+
guard AXUIElementCopyAttributeValues(element, kAXChildrenAttribute as CFString, 0, count, &value) == .success else { return nil }
|
|
34
|
+
return value as? [AXUIElement]
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
37
|
func text(_ element: AXUIElement, _ key: String) -> Any { (attribute(element, key) as? String) ?? NSNull() as Any }
|
|
36
38
|
func windowBounds(_ element: AXUIElement) -> CGRect? {
|
|
@@ -87,7 +89,11 @@ func observe(_ request: Request) async throws -> [String: Any] {
|
|
|
87
89
|
var element = root
|
|
88
90
|
for index in action.path ?? [] {
|
|
89
91
|
var selectedChild: CFArray?
|
|
90
|
-
|
|
92
|
+
let count = childCount(element)
|
|
93
|
+
guard let available = count.value else {
|
|
94
|
+
try fail("element-count-unavailable", "Cannot validate selected accessibility path because child count failed with AXError \(count.error ?? -1)")
|
|
95
|
+
}
|
|
96
|
+
guard index >= 0 && index < available,
|
|
91
97
|
AXUIElementCopyAttributeValues(element, kAXChildrenAttribute as CFString, index, 1, &selectedChild) == .success,
|
|
92
98
|
let item = (selectedChild as? [AXUIElement])?.first else { try fail("element-missing", "Selected accessibility path no longer exists") }
|
|
93
99
|
element = item
|
|
@@ -103,21 +109,29 @@ func observe(_ request: Request) async throws -> [String: Any] {
|
|
|
103
109
|
}
|
|
104
110
|
guard outcome == .success else { try fail("action-failed", "Accessibility action failed with AXError \(outcome.rawValue)") }
|
|
105
111
|
}
|
|
106
|
-
var nodes: [[String: Any]] = []; var truncated = false
|
|
112
|
+
var nodes: [[String: Any]] = []; var truncated = false; var gaps: [String] = []
|
|
107
113
|
if request.accessibility, let root = selected {
|
|
108
114
|
var pending: [(AXUIElement, [Int])] = [(root, [])]
|
|
109
115
|
while let (element, path) = pending.popLast() {
|
|
110
116
|
if nodes.count >= request.max_nodes { truncated = true; break }
|
|
111
|
-
let
|
|
117
|
+
let childCountResult = childCount(element)
|
|
112
118
|
var actions: CFArray?
|
|
113
119
|
AXUIElementCopyActionNames(element, &actions)
|
|
114
|
-
nodes.append(["path": path, "role": text(element, kAXRoleAttribute), "title": text(element, kAXTitleAttribute), "value": text(element, kAXValueAttribute), "actions": actions as? [String] ?? [], "children_count":
|
|
120
|
+
nodes.append(["path": path, "role": text(element, kAXRoleAttribute), "title": text(element, kAXTitleAttribute), "value": text(element, kAXValueAttribute), "actions": actions as? [String] ?? [], "children_count": childCountResult.value.map { $0 as Any } ?? NSNull()])
|
|
121
|
+
guard let totalChildren = childCountResult.value else {
|
|
122
|
+
truncated = true
|
|
123
|
+
gaps.append("AX child count unavailable at path \(path): AXError \(childCountResult.error ?? -1)")
|
|
124
|
+
continue
|
|
125
|
+
}
|
|
115
126
|
if path.count >= 32 { if totalChildren > 0 { truncated = true }; continue }
|
|
116
127
|
let available = max(0, request.max_nodes - nodes.count - pending.count)
|
|
117
128
|
let count = min(available, totalChildren)
|
|
118
|
-
let
|
|
129
|
+
let batch = children(element, count: count)
|
|
130
|
+
if !batch.complete { truncated = true }
|
|
119
131
|
if totalChildren > count { truncated = true }
|
|
120
|
-
for index in (
|
|
132
|
+
for (index, item) in batch.values.enumerated().reversed() {
|
|
133
|
+
pending.append((item, path + [index]))
|
|
134
|
+
}
|
|
121
135
|
}
|
|
122
136
|
}
|
|
123
137
|
var screenshot: Any = NSNull()
|
|
@@ -139,18 +153,18 @@ func observe(_ request: Request) async throws -> [String: Any] {
|
|
|
139
153
|
}
|
|
140
154
|
screenshot = ["mime_type": "image/png", "base64": png.base64EncodedString(), "sha256": SHA256.hash(data: png).map({ String(format: "%02x", $0) }).joined(), "width": image.width, "height": image.height]
|
|
141
155
|
}
|
|
142
|
-
return ["window": ["pid": request.pid, "window_id": request.window_id, "executable": request.executable, "launch_time": launch, "title": window[kCGWindowName as String] as? String ?? ""], "nodes": nodes, "truncated": truncated, "screenshot": screenshot, "gaps": request.accessibility ?
|
|
156
|
+
return ["window": ["pid": request.pid, "window_id": request.window_id, "executable": request.executable, "launch_time": launch, "title": window[kCGWindowName as String] as? String ?? ""], "nodes": nodes, "truncated": truncated, "screenshot": screenshot, "gaps": request.accessibility ? gaps : ["Accessibility capture was disabled"]]
|
|
143
157
|
}
|
|
144
158
|
Task { @MainActor in
|
|
145
159
|
do {
|
|
146
160
|
let request = try JSONDecoder().decode(Request.self, from: Data(CommandLine.arguments[1].utf8))
|
|
147
161
|
let result = try await observe(request)
|
|
148
|
-
let output = try
|
|
162
|
+
let output = try serializeHelperOutput(["ok": true, "result": result])
|
|
149
163
|
FileHandle.standardOutput.write(output)
|
|
150
164
|
} catch {
|
|
151
165
|
let failure = error as? BoundaryFailure
|
|
152
166
|
let output: [String: Any] = ["ok": false, "code": failure?.code ?? "capture-failed", "message": failure?.message ?? error.localizedDescription]
|
|
153
|
-
if let data = try?
|
|
167
|
+
if let data = try? serializeHelperOutput(output) { FileHandle.standardOutput.write(data) }
|
|
154
168
|
}
|
|
155
169
|
exit(0)
|
|
156
170
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { constants, createReadStream } from "node:fs";
|
|
2
|
+
import { chmod, copyFile } from "node:fs/promises";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { AnalysisInputError, AnalysisCapabilityUnavailableError, } from "../domain/analysisErrorCore.js";
|
|
6
|
+
/** Stream a local file digest without retaining the APK or JAR in memory. */
|
|
7
|
+
export const hashAndroidFile = async (path) => {
|
|
8
|
+
const hash = createHash("sha256");
|
|
9
|
+
for await (const chunk of createReadStream(path))
|
|
10
|
+
hash.update(chunk);
|
|
11
|
+
return hash.digest("hex");
|
|
12
|
+
};
|
|
13
|
+
/** Bind decompiler input to the admitted artifact, even if the original changes. */
|
|
14
|
+
export const snapshotAndroidTarget = async (path, sha256, root, operation) => {
|
|
15
|
+
const snapshot = join(root, "target.apk");
|
|
16
|
+
await copyFile(path, snapshot, constants.COPYFILE_EXCL);
|
|
17
|
+
await chmod(snapshot, 0o400);
|
|
18
|
+
if ((await hashAndroidFile(snapshot)) !== sha256)
|
|
19
|
+
throw new AnalysisInputError(operation, undefined, [
|
|
20
|
+
{
|
|
21
|
+
path: ["path"],
|
|
22
|
+
reason: "invalid_value",
|
|
23
|
+
message: "APK bytes changed after admission; retry against a stable file.",
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
return snapshot;
|
|
27
|
+
};
|
|
28
|
+
/** Fingerprint the actual immutable engine bytes executed for this observation. */
|
|
29
|
+
export const snapshotAndroidEngine = async (source, sha256, root, operation) => {
|
|
30
|
+
const path = join(root, "engine.jar");
|
|
31
|
+
await copyFile(source, path, constants.COPYFILE_EXCL);
|
|
32
|
+
await chmod(path, 0o400);
|
|
33
|
+
if ((await hashAndroidFile(path)) !== sha256)
|
|
34
|
+
throw new AnalysisCapabilityUnavailableError("jadx", operation, "REA_JADX_MCP_JAR bytes changed during admission; retry with a stable engine file.");
|
|
35
|
+
return { path, sha256 };
|
|
36
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { androidResultSchemas } from "../domain/android/androidAnalysis.js";
|
|
2
|
+
import { AnalysisCapabilityUnavailableError, AnalysisInputError, AnalysisOutputError, } from "../domain/analysisErrorCore.js";
|
|
3
|
+
import { jadxAppSchema, jadxClassPageSchema, jadxClassSchema, jadxLoadSchema, jadxMethodSchema, jadxXrefsSchema, normalizeJadxText, } from "./JadxProtocol.js";
|
|
4
|
+
import { JADX_RELEASE } from "./JadxRelease.js";
|
|
5
|
+
const methodsOf = (summary) => {
|
|
6
|
+
const seen = new Map();
|
|
7
|
+
return summary.methods.map((method) => {
|
|
8
|
+
const index = seen.get(method.name) ?? 0;
|
|
9
|
+
seen.set(method.name, index + 1);
|
|
10
|
+
return {
|
|
11
|
+
name: method.name,
|
|
12
|
+
reported_signature: method.signature,
|
|
13
|
+
overload_index: index,
|
|
14
|
+
is_constructor: method.is_constructor,
|
|
15
|
+
dex_descriptor: null,
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const inputFailure = (request, field, message) => {
|
|
20
|
+
throw new AnalysisInputError(request.operation, undefined, [
|
|
21
|
+
{ path: [field], reason: "invalid_value", message },
|
|
22
|
+
]);
|
|
23
|
+
};
|
|
24
|
+
const classSummary = async (tools, request) => {
|
|
25
|
+
const raw = await tools.json("get_class_summary", {
|
|
26
|
+
class_name: request.input.class_name,
|
|
27
|
+
});
|
|
28
|
+
if (raw !== null &&
|
|
29
|
+
typeof raw === "object" &&
|
|
30
|
+
!Array.isArray(raw) &&
|
|
31
|
+
typeof raw.error === "string")
|
|
32
|
+
throw new AnalysisOutputError(request.operation, `JADX class summary failed: ${raw.error}`);
|
|
33
|
+
const summary = jadxClassSchema.safeParse(raw);
|
|
34
|
+
if (!summary.success)
|
|
35
|
+
throw new AnalysisOutputError(request.operation, "JADX class summary failed or was malformed; negative counts are not an empty class", { cause: summary.error });
|
|
36
|
+
const value = summary.data;
|
|
37
|
+
if (value.full_name !== request.input.class_name)
|
|
38
|
+
inputFailure(request, "class_name", `Exact class ${request.input.class_name} resolved to ${value.full_name}; use the fully qualified class name from search_android_classes.`);
|
|
39
|
+
if (value.method_count !== value.methods.length ||
|
|
40
|
+
value.field_count !== value.fields.length ||
|
|
41
|
+
value.inner_class_count !== value.inner_classes.length)
|
|
42
|
+
throw new AnalysisOutputError(request.operation, "JADX class member counts do not match the returned inventory");
|
|
43
|
+
return value;
|
|
44
|
+
};
|
|
45
|
+
const inspectPackage = async (tools, loaded, engine) => {
|
|
46
|
+
const app = jadxAppSchema.parse(await tools.json("get_app_info", {}));
|
|
47
|
+
const manifest = normalizeJadxText(await tools.text("get_android_manifest", {}));
|
|
48
|
+
return androidResultSchemas.inspect_android_package.parse({
|
|
49
|
+
engine,
|
|
50
|
+
package_name: app.package || null,
|
|
51
|
+
version_name: app.version_name || null,
|
|
52
|
+
version_code: app.version_code || null,
|
|
53
|
+
min_sdk: app.min_sdk || null,
|
|
54
|
+
target_sdk: app.target_sdk || null,
|
|
55
|
+
permissions: app.permissions,
|
|
56
|
+
manifest,
|
|
57
|
+
class_count: loaded.class_count,
|
|
58
|
+
resource_count: loaded.resource_count,
|
|
59
|
+
signature_verification: "not_performed",
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const searchClasses = async (tools, request, loaded, engine) => {
|
|
63
|
+
const classes = [];
|
|
64
|
+
const pageSize = 4096;
|
|
65
|
+
let total;
|
|
66
|
+
do {
|
|
67
|
+
const page = jadxClassPageSchema.parse(await tools.json("list_classes", {
|
|
68
|
+
offset: classes.length,
|
|
69
|
+
limit: pageSize,
|
|
70
|
+
}));
|
|
71
|
+
if ((total !== undefined && total !== page.total) ||
|
|
72
|
+
page.offset !== classes.length ||
|
|
73
|
+
page.limit !== pageSize ||
|
|
74
|
+
page.items.length > pageSize)
|
|
75
|
+
throw new AnalysisOutputError(request.operation, "JADX class pagination changed identity or counts");
|
|
76
|
+
total = page.total;
|
|
77
|
+
classes.push(...page.items);
|
|
78
|
+
if (classes.length > total ||
|
|
79
|
+
(page.items.length === 0 && classes.length < total))
|
|
80
|
+
throw new AnalysisOutputError(request.operation, "JADX class pagination is incomplete");
|
|
81
|
+
} while (classes.length < total);
|
|
82
|
+
if (new Set(classes).size !== classes.length || total !== loaded.class_count)
|
|
83
|
+
throw new AnalysisOutputError(request.operation, "JADX class inventory is duplicated or differs from the loaded class count");
|
|
84
|
+
return androidResultSchemas.search_android_classes.parse({
|
|
85
|
+
engine,
|
|
86
|
+
query: request.input.query,
|
|
87
|
+
total_classes: total,
|
|
88
|
+
matches: classes.filter((name) => name.includes(request.input.query)),
|
|
89
|
+
coverage: "complete",
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
const matchingMethods = (summary, request) => {
|
|
93
|
+
const candidates = methodsOf(summary).filter((method) => method.name === request.input.method_name);
|
|
94
|
+
if (request.input.method_name !== undefined && candidates.length === 0)
|
|
95
|
+
inputFailure(request, "method_name", `Method ${summary.full_name}.${request.input.method_name} was not found; inspect_android_class lists available methods.`);
|
|
96
|
+
return candidates;
|
|
97
|
+
};
|
|
98
|
+
const inspectMethod = async (tools, request, summary, engine) => {
|
|
99
|
+
const candidates = matchingMethods(summary, request);
|
|
100
|
+
if (candidates.length > 1 && request.input.overload_index === undefined)
|
|
101
|
+
inputFailure(request, "overload_index", `Select one of ${candidates.length} overloads: ${candidates.map((method) => `${method.overload_index}: ${method.reported_signature}`).join("; ")}`);
|
|
102
|
+
const index = request.input.overload_index ?? 0;
|
|
103
|
+
const selected = candidates[index];
|
|
104
|
+
if (selected === undefined)
|
|
105
|
+
inputFailure(request, "overload_index", `Index ${index} is outside the ${candidates.length} matching overloads.`);
|
|
106
|
+
const body = jadxMethodSchema.parse(await tools.json("get_method_body", {
|
|
107
|
+
class_name: summary.full_name,
|
|
108
|
+
method_name: request.input.method_name,
|
|
109
|
+
overload_index: index,
|
|
110
|
+
smali_fallback: true,
|
|
111
|
+
}));
|
|
112
|
+
if (body.class_name !== summary.full_name ||
|
|
113
|
+
body.method_name !== request.input.method_name ||
|
|
114
|
+
body.overload_index !== index ||
|
|
115
|
+
body.overload_count !== candidates.length)
|
|
116
|
+
throw new AnalysisOutputError(request.operation, "JADX returned a different method or overload inventory");
|
|
117
|
+
if (body.body.startsWith("// ERROR:"))
|
|
118
|
+
throw new AnalysisOutputError(request.operation, `JADX did not produce method source: ${body.body}`);
|
|
119
|
+
if (body.mode === "smali" && candidates.length > 1)
|
|
120
|
+
throw new AnalysisCapabilityUnavailableError("jadx", request.operation, `JADX ${JADX_RELEASE.version} smali fallback joins all same-name overloads for ${summary.full_name}.${request.input.method_name}; it cannot establish source for only overload ${index}.`);
|
|
121
|
+
return androidResultSchemas.inspect_android_method.parse({
|
|
122
|
+
engine,
|
|
123
|
+
class_name: summary.full_name,
|
|
124
|
+
method: selected,
|
|
125
|
+
overload_count: candidates.length,
|
|
126
|
+
representation: body.mode,
|
|
127
|
+
body_status: body.body.length === 0 ||
|
|
128
|
+
body.body ===
|
|
129
|
+
"// method exists but has no decompiled body (native/abstract)"
|
|
130
|
+
? "not_available"
|
|
131
|
+
: "available",
|
|
132
|
+
fell_back: body.fell_back,
|
|
133
|
+
markers: body.markers,
|
|
134
|
+
source: normalizeJadxText(body.body),
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
/** Normalize only the selected analyst outcome and reject ambiguous engine selectors. */
|
|
138
|
+
export const analyzeJadxRequest = async (tools, request, loaded, engine) => {
|
|
139
|
+
if (request.operation === "inspect_android_package")
|
|
140
|
+
return inspectPackage(tools, loaded, engine);
|
|
141
|
+
if (request.operation === "search_android_classes")
|
|
142
|
+
return searchClasses(tools, request, loaded, engine);
|
|
143
|
+
const summary = await classSummary(tools, request);
|
|
144
|
+
if (request.operation === "inspect_android_class")
|
|
145
|
+
return androidResultSchemas.inspect_android_class.parse({
|
|
146
|
+
engine,
|
|
147
|
+
class_name: summary.full_name,
|
|
148
|
+
methods: methodsOf(summary),
|
|
149
|
+
fields: summary.fields.map((field) => ({
|
|
150
|
+
name: field.name,
|
|
151
|
+
reported_type: field.type,
|
|
152
|
+
})),
|
|
153
|
+
inner_classes: summary.inner_classes,
|
|
154
|
+
});
|
|
155
|
+
if (request.operation === "inspect_android_method")
|
|
156
|
+
return inspectMethod(tools, request, summary, engine);
|
|
157
|
+
return traceReferences(tools, request, summary, engine);
|
|
158
|
+
};
|
|
159
|
+
const traceReferences = async (tools, request, summary, engine) => {
|
|
160
|
+
const methodName = request.input.method_name;
|
|
161
|
+
const candidates = matchingMethods(summary, request);
|
|
162
|
+
if (candidates.length > 1)
|
|
163
|
+
throw new AnalysisCapabilityUnavailableError("jadx", request.operation, `References require a unique method name; ${summary.full_name}.${methodName} has ${candidates.length} overloads. No unambiguous reference result is available.`);
|
|
164
|
+
const expectedTarget = methodName === undefined
|
|
165
|
+
? summary.full_name
|
|
166
|
+
: `${summary.full_name}.${methodName}`;
|
|
167
|
+
const xrefs = jadxXrefsSchema.parse(await tools.json(methodName === undefined ? "get_xrefs_to_class" : "get_xrefs_to_method", {
|
|
168
|
+
class_name: summary.full_name,
|
|
169
|
+
...(methodName === undefined ? {} : { method_name: methodName }),
|
|
170
|
+
limit: 2_147_483_647,
|
|
171
|
+
resolve_line: false,
|
|
172
|
+
}));
|
|
173
|
+
if (xrefs.target !== expectedTarget ||
|
|
174
|
+
xrefs.total !== xrefs.count ||
|
|
175
|
+
xrefs.count !== xrefs.items.length)
|
|
176
|
+
throw new AnalysisOutputError(request.operation, "JADX references are incomplete or refer to another target");
|
|
177
|
+
return androidResultSchemas.trace_android_references.parse({
|
|
178
|
+
engine,
|
|
179
|
+
class_name: summary.full_name,
|
|
180
|
+
method_name: methodName ?? null,
|
|
181
|
+
total: xrefs.total,
|
|
182
|
+
references: xrefs.items.map((reference) => ({
|
|
183
|
+
kind: reference.kind,
|
|
184
|
+
name: reference.name,
|
|
185
|
+
reported_full_name: reference.full_name,
|
|
186
|
+
containing_class: reference.containing_class,
|
|
187
|
+
top_class: reference.top_class,
|
|
188
|
+
source_line: null,
|
|
189
|
+
dex_offset: null,
|
|
190
|
+
})),
|
|
191
|
+
coverage: "complete",
|
|
192
|
+
});
|
|
193
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { access, realpath, stat } from "node:fs/promises";
|
|
2
|
+
import { constants } from "node:fs";
|
|
3
|
+
import { isAbsolute, join } from "node:path";
|
|
4
|
+
import { AnalysisCapabilityUnavailableError } from "../domain/analysisErrorCore.js";
|
|
5
|
+
import { JADX_JAR_CONFIGURATION_REMEDIATION } from "./JadxRelease.js";
|
|
6
|
+
/** Admit explicit local tooling without installing or changing host configuration. */
|
|
7
|
+
export const resolveJadxConfiguration = async (environment, operation) => {
|
|
8
|
+
const unavailable = (reason) => new AnalysisCapabilityUnavailableError("jadx", operation, reason);
|
|
9
|
+
if (process.platform !== "linux" && process.platform !== "darwin")
|
|
10
|
+
throw unavailable(`Android JADX subprocess ownership is unsupported on ${process.platform}; use Linux or macOS. The metadata bridge has real-provider verification on macOS arm64.`);
|
|
11
|
+
const jar = environment.REA_JADX_MCP_JAR;
|
|
12
|
+
if (environment.JAVA_HOME !== undefined && !isAbsolute(environment.JAVA_HOME))
|
|
13
|
+
throw unavailable("JAVA_HOME must select an existing JDK by absolute path; omit it to use java on PATH.");
|
|
14
|
+
if (jar === undefined || !isAbsolute(jar))
|
|
15
|
+
throw unavailable(JADX_JAR_CONFIGURATION_REMEDIATION);
|
|
16
|
+
const java = environment.JAVA_HOME === undefined
|
|
17
|
+
? "java"
|
|
18
|
+
: join(environment.JAVA_HOME, "bin", "java");
|
|
19
|
+
try {
|
|
20
|
+
await access(jar, constants.R_OK);
|
|
21
|
+
if (!(await stat(jar)).isFile())
|
|
22
|
+
throw unavailable(`REA_JADX_MCP_JAR is not a regular file: ${jar}`);
|
|
23
|
+
}
|
|
24
|
+
catch (cause) {
|
|
25
|
+
if (cause instanceof AnalysisCapabilityUnavailableError)
|
|
26
|
+
throw cause;
|
|
27
|
+
throw unavailable(`Cannot read REA_JADX_MCP_JAR ${jar}: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
28
|
+
}
|
|
29
|
+
if (environment.JAVA_HOME !== undefined) {
|
|
30
|
+
try {
|
|
31
|
+
await access(java, constants.R_OK | constants.X_OK);
|
|
32
|
+
if (!(await stat(java)).isFile())
|
|
33
|
+
throw unavailable(`JAVA_HOME java is not a regular file: ${java}`);
|
|
34
|
+
}
|
|
35
|
+
catch (cause) {
|
|
36
|
+
if (cause instanceof AnalysisCapabilityUnavailableError)
|
|
37
|
+
throw cause;
|
|
38
|
+
throw unavailable(`Cannot execute JAVA_HOME java ${java}: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const jvmArguments = [];
|
|
42
|
+
for (const [name, prefix, suffix] of [
|
|
43
|
+
["REA_JADX_HEAP_MIB", "-Xmx", "m"],
|
|
44
|
+
["REA_JADX_ACTIVE_PROCESSOR_COUNT", "-XX:ActiveProcessorCount=", ""],
|
|
45
|
+
]) {
|
|
46
|
+
const value = environment[name];
|
|
47
|
+
if (value === undefined)
|
|
48
|
+
continue;
|
|
49
|
+
if (!/^[1-9]\d*$/u.test(value) || !Number.isSafeInteger(Number(value)))
|
|
50
|
+
throw unavailable(`${name} must be a positive safe integer; received ${value}.`);
|
|
51
|
+
if (name === "REA_JADX_ACTIVE_PROCESSOR_COUNT" &&
|
|
52
|
+
Number(value) > 2_147_483_647)
|
|
53
|
+
throw unavailable(`${name} exceeds the JVM's signed 32-bit processor-count range.`);
|
|
54
|
+
jvmArguments.push(`${prefix}${value}${suffix}`);
|
|
55
|
+
}
|
|
56
|
+
return { jar: await realpath(jar), java, jvmArguments };
|
|
57
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { deserializeMessage, serializeMessage, } from "@modelcontextprotocol/client";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { ProviderProcessSupervisor, spawnOwnedProviderProcess, } from "../process/ProviderProcess.js";
|
|
4
|
+
import { cleanupOwnedProcessGroup } from "../process/ProcessOwnership.js";
|
|
5
|
+
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
|
|
6
|
+
const MAX_FRAME_BYTES = 8 * 1024 * 1024;
|
|
7
|
+
const MAX_OPERATION_BYTES = 32 * 1024 * 1024;
|
|
8
|
+
/** SDK-framed stdio with REA-owned process cleanup rather than an unowned child. */
|
|
9
|
+
export class JadxMcpTransport {
|
|
10
|
+
options;
|
|
11
|
+
launcher;
|
|
12
|
+
onclose;
|
|
13
|
+
onerror;
|
|
14
|
+
onmessage;
|
|
15
|
+
runId = randomUUID();
|
|
16
|
+
#spawned;
|
|
17
|
+
#supervisor;
|
|
18
|
+
#frameBuffer = Buffer.alloc(0);
|
|
19
|
+
#frameLength = 0;
|
|
20
|
+
#bytes = 0;
|
|
21
|
+
#started = false;
|
|
22
|
+
#closed = false;
|
|
23
|
+
#closePromise;
|
|
24
|
+
#starting;
|
|
25
|
+
#failure = null;
|
|
26
|
+
constructor(options, launcher = spawnOwnedProviderProcess) {
|
|
27
|
+
this.options = options;
|
|
28
|
+
this.launcher = launcher;
|
|
29
|
+
}
|
|
30
|
+
/** Acquires exactly one protocol process after the SDK installs callbacks. */
|
|
31
|
+
start() {
|
|
32
|
+
if (this.#started || this.#closed)
|
|
33
|
+
throw new Error("JADX transport cannot be restarted");
|
|
34
|
+
this.#started = true;
|
|
35
|
+
this.#starting = this.#acquire();
|
|
36
|
+
return this.#starting;
|
|
37
|
+
}
|
|
38
|
+
async #acquire() {
|
|
39
|
+
const spawned = await this.launcher({
|
|
40
|
+
...this.options,
|
|
41
|
+
runId: this.runId,
|
|
42
|
+
stdin: "pipe",
|
|
43
|
+
});
|
|
44
|
+
this.#spawned = spawned;
|
|
45
|
+
this.#supervisor = new ProviderProcessSupervisor({
|
|
46
|
+
...spawned,
|
|
47
|
+
ownsProcessLifetime: true,
|
|
48
|
+
cleanup: spawned.cleanup ??
|
|
49
|
+
(() => cleanupOwnedProcessGroup(spawned.ownership)),
|
|
50
|
+
}, { captureStdout: false });
|
|
51
|
+
if (spawned.process.stdin === undefined ||
|
|
52
|
+
spawned.process.stdin === null ||
|
|
53
|
+
spawned.process.stdout === null)
|
|
54
|
+
throw new Error("JADX launcher did not supply protocol stdin/stdout");
|
|
55
|
+
spawned.process.stdout.on("data", this.#read);
|
|
56
|
+
spawned.process.stderr?.on("data", this.#countStderr);
|
|
57
|
+
spawned.process.on("error", this.#error);
|
|
58
|
+
spawned.process.once("exit", this.#exit);
|
|
59
|
+
spawned.process.stdin.on("error", this.#error);
|
|
60
|
+
if (this.#closed)
|
|
61
|
+
throw new Error("JADX transport closed during startup");
|
|
62
|
+
}
|
|
63
|
+
/** Writes SDK-serialized messages and observes stream backpressure. */
|
|
64
|
+
async send(message) {
|
|
65
|
+
const input = this.#spawned?.process.stdin;
|
|
66
|
+
if (this.#closed || input === undefined || input === null)
|
|
67
|
+
throw new Error("JADX protocol process is not writable");
|
|
68
|
+
await new Promise((resolve, reject) => {
|
|
69
|
+
input.write(serializeMessage(message), (cause) => cause === null || cause === undefined ? resolve() : reject(cause));
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/** Verifies owned process exit before declaring the transport closed. */
|
|
73
|
+
close() {
|
|
74
|
+
this.#closePromise ??= this.#stop();
|
|
75
|
+
return this.#closePromise;
|
|
76
|
+
}
|
|
77
|
+
/** Captured provider stderr without persisting inherited environment values. */
|
|
78
|
+
diagnostics() {
|
|
79
|
+
return this.#supervisor?.snapshot().stderr.text ?? "";
|
|
80
|
+
}
|
|
81
|
+
/** Preserve the failed protocol/resource constraint after the SDK closes requests. */
|
|
82
|
+
failureReason() {
|
|
83
|
+
return this.#failure;
|
|
84
|
+
}
|
|
85
|
+
/** Scope both the byte budget and diagnostic retention to the next serialized request. */
|
|
86
|
+
beginOperation() {
|
|
87
|
+
this.#bytes = 0;
|
|
88
|
+
this.#supervisor?.resetOutput();
|
|
89
|
+
}
|
|
90
|
+
async #stop() {
|
|
91
|
+
this.#closed = true;
|
|
92
|
+
this.#frameBuffer = Buffer.alloc(0);
|
|
93
|
+
this.#frameLength = 0;
|
|
94
|
+
// A cancellation may race acquisition. Join it before inspecting ownership.
|
|
95
|
+
await this.#starting?.catch(() => undefined);
|
|
96
|
+
const process = this.#spawned?.process;
|
|
97
|
+
process?.stdout?.off("data", this.#read);
|
|
98
|
+
process?.stderr?.off("data", this.#countStderr);
|
|
99
|
+
process?.off("error", this.#error);
|
|
100
|
+
process?.off("exit", this.#exit);
|
|
101
|
+
process?.stdin?.off("error", this.#error);
|
|
102
|
+
const stopped = await this.#supervisor?.stop();
|
|
103
|
+
this.onclose?.();
|
|
104
|
+
if (stopped?.status === "incomplete")
|
|
105
|
+
throw new ProviderCleanupError("jadx", [this.runId], {
|
|
106
|
+
reason: stopped.reason,
|
|
107
|
+
stderr: this.diagnostics(),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
#error = (error) => {
|
|
111
|
+
this.onerror?.(error);
|
|
112
|
+
};
|
|
113
|
+
#exit = () => {
|
|
114
|
+
this.onclose?.();
|
|
115
|
+
};
|
|
116
|
+
#countStderr = (chunk) => {
|
|
117
|
+
this.#bytes += Buffer.byteLength(chunk);
|
|
118
|
+
if (this.#bytes > MAX_OPERATION_BYTES)
|
|
119
|
+
this.#fail(new Error(`JADX operation output exceeds ${MAX_OPERATION_BYTES} bytes; no complete result is available`));
|
|
120
|
+
};
|
|
121
|
+
#read = (chunk) => {
|
|
122
|
+
if (this.#closed)
|
|
123
|
+
return;
|
|
124
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
125
|
+
this.#bytes += bytes.length;
|
|
126
|
+
if (this.#bytes > MAX_OPERATION_BYTES) {
|
|
127
|
+
this.#fail(new Error(`JADX operation output exceeds ${MAX_OPERATION_BYTES} bytes; no complete result is available`));
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
let offset = 0;
|
|
132
|
+
while (offset < bytes.length) {
|
|
133
|
+
const newline = bytes.indexOf(10, offset);
|
|
134
|
+
const end = newline === -1 ? bytes.length : newline;
|
|
135
|
+
const fragment = bytes.subarray(offset, end);
|
|
136
|
+
const frameBytes = this.#frameLength + fragment.length;
|
|
137
|
+
if (frameBytes > MAX_FRAME_BYTES)
|
|
138
|
+
throw new Error(`JADX MCP frame exceeds ${MAX_FRAME_BYTES} bytes`);
|
|
139
|
+
this.#appendFrame(fragment, frameBytes);
|
|
140
|
+
if (newline === -1)
|
|
141
|
+
return;
|
|
142
|
+
const line = this.#frameBuffer
|
|
143
|
+
.subarray(0, this.#frameLength)
|
|
144
|
+
.toString("utf8");
|
|
145
|
+
this.#frameBuffer = Buffer.alloc(0);
|
|
146
|
+
this.#frameLength = 0;
|
|
147
|
+
this.onmessage?.(deserializeMessage(line));
|
|
148
|
+
offset = newline + 1;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch (cause) {
|
|
152
|
+
this.#fail(cause instanceof Error ? cause : new Error(String(cause)));
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
#appendFrame(fragment, frameBytes) {
|
|
156
|
+
if (frameBytes > this.#frameBuffer.length) {
|
|
157
|
+
const capacity = Math.min(MAX_FRAME_BYTES, Math.max(frameBytes, this.#frameBuffer.length * 2, 1));
|
|
158
|
+
const grown = Buffer.allocUnsafe(capacity);
|
|
159
|
+
this.#frameBuffer.copy(grown, 0, 0, this.#frameLength);
|
|
160
|
+
this.#frameBuffer = grown;
|
|
161
|
+
}
|
|
162
|
+
fragment.copy(this.#frameBuffer, this.#frameLength);
|
|
163
|
+
this.#frameLength = frameBytes;
|
|
164
|
+
}
|
|
165
|
+
#fail(error) {
|
|
166
|
+
this.#failure ??= error.message;
|
|
167
|
+
this.onerror?.(error);
|
|
168
|
+
// Closing immediately rejects the SDK's outstanding request. The owner
|
|
169
|
+
// awaits close again and retains a cleanup failure in the returned Result.
|
|
170
|
+
void this.close().catch((cause) => this.onerror?.(cause instanceof Error ? cause : new Error(String(cause))));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AnalysisOutputError } from "../domain/analysisErrorCore.js";
|
|
3
|
+
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
4
|
+
const count = z.number().int().nonnegative();
|
|
5
|
+
/** Values observed inside the exact JVM producing the analysis. */
|
|
6
|
+
export const jadxRuntimeSchema = z.object({
|
|
7
|
+
engine_reported_version: z.string().min(1),
|
|
8
|
+
max_heap_bytes: z.number().int().positive().safe(),
|
|
9
|
+
available_processors: z.number().int().positive(),
|
|
10
|
+
java_version: z.string().min(1),
|
|
11
|
+
metadata_scope: z.literal("parsed_members"),
|
|
12
|
+
});
|
|
13
|
+
export const jadxLoadSchema = z.object({
|
|
14
|
+
state: z.literal("LOADED"),
|
|
15
|
+
apk_path: z.string(),
|
|
16
|
+
class_count: count,
|
|
17
|
+
resource_count: count,
|
|
18
|
+
threads: z.literal(1),
|
|
19
|
+
resources: z.literal("full"),
|
|
20
|
+
});
|
|
21
|
+
export const jadxAppSchema = z.object({
|
|
22
|
+
package: z.string(),
|
|
23
|
+
version_name: z.string(),
|
|
24
|
+
version_code: z.string(),
|
|
25
|
+
min_sdk: z.string(),
|
|
26
|
+
target_sdk: z.string(),
|
|
27
|
+
permissions: z.array(z.string()),
|
|
28
|
+
});
|
|
29
|
+
export const jadxClassPageSchema = z.object({
|
|
30
|
+
total: count,
|
|
31
|
+
offset: count,
|
|
32
|
+
limit: count,
|
|
33
|
+
items: z.array(z.string()),
|
|
34
|
+
});
|
|
35
|
+
export const jadxClassSchema = z.object({
|
|
36
|
+
full_name: z.string(),
|
|
37
|
+
name: z.string(),
|
|
38
|
+
method_count: count,
|
|
39
|
+
field_count: count,
|
|
40
|
+
inner_class_count: count,
|
|
41
|
+
methods: z.array(z.object({
|
|
42
|
+
name: z.string(),
|
|
43
|
+
signature: z.string(),
|
|
44
|
+
is_constructor: z.boolean(),
|
|
45
|
+
def_pos: z.number().int(),
|
|
46
|
+
})),
|
|
47
|
+
fields: z.array(z.object({ name: z.string(), type: z.string(), def_pos: z.number().int() })),
|
|
48
|
+
inner_classes: z.array(z.string()),
|
|
49
|
+
});
|
|
50
|
+
export const jadxMethodSchema = z.object({
|
|
51
|
+
class_name: z.string(),
|
|
52
|
+
method_name: z.string(),
|
|
53
|
+
full_name: z.string(),
|
|
54
|
+
overload_index: count,
|
|
55
|
+
overload_count: count,
|
|
56
|
+
mode: z.enum(["java", "smali"]),
|
|
57
|
+
fell_back: z.boolean(),
|
|
58
|
+
markers: z.array(z.string()),
|
|
59
|
+
body: z.string(),
|
|
60
|
+
});
|
|
61
|
+
export const jadxXrefsSchema = z.object({
|
|
62
|
+
target: z.string(),
|
|
63
|
+
total: count,
|
|
64
|
+
count,
|
|
65
|
+
resolve_line: z.literal(false),
|
|
66
|
+
items: z.array(z.object({
|
|
67
|
+
kind: z.string(),
|
|
68
|
+
name: z.string(),
|
|
69
|
+
full_name: z.string(),
|
|
70
|
+
containing_class: z.string(),
|
|
71
|
+
top_class: z.string(),
|
|
72
|
+
def_pos: z.number().int(),
|
|
73
|
+
})),
|
|
74
|
+
});
|
|
75
|
+
const toolResponse = z.object({
|
|
76
|
+
content: z
|
|
77
|
+
.array(z.object({ type: z.literal("text"), text: z.string() }))
|
|
78
|
+
.length(1),
|
|
79
|
+
isError: z.boolean().optional(),
|
|
80
|
+
});
|
|
81
|
+
/** Parse the upstream text-only envelope, preserving errors at the producing boundary. */
|
|
82
|
+
export const parseJadxEnvelope = (response, operation) => {
|
|
83
|
+
const parsed = toolResponse.safeParse(response);
|
|
84
|
+
if (!parsed.success || parsed.data.content[0] === undefined)
|
|
85
|
+
throw new AnalysisOutputError(operation, "JADX returned an unsupported MCP content envelope");
|
|
86
|
+
return {
|
|
87
|
+
text: parsed.data.content[0].text,
|
|
88
|
+
failed: parsed.data.isError === true,
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
/** Decode an upstream JSON text payload without trusting its contents. */
|
|
92
|
+
export const parseJadxJson = (text, operation) => {
|
|
93
|
+
try {
|
|
94
|
+
return jsonValueSchema.parse(JSON.parse(text));
|
|
95
|
+
}
|
|
96
|
+
catch (cause) {
|
|
97
|
+
throw new AnalysisOutputError(operation, "JADX returned malformed JSON text", { cause });
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
/** Upstream byte truncation is reported rather than promoted to a complete source. */
|
|
101
|
+
export const normalizeJadxText = (text) => {
|
|
102
|
+
const marker = /\n\n\.\.\. \[truncated: exceeds (\d+) bytes, total (\d+) bytes\]$/u.exec(text);
|
|
103
|
+
const total = marker?.[2] === undefined ? null : Number(marker[2]);
|
|
104
|
+
return {
|
|
105
|
+
status: marker === null ? "complete" : "partial",
|
|
106
|
+
text,
|
|
107
|
+
reported_total_bytes: total !== null && Number.isSafeInteger(total) ? total : null,
|
|
108
|
+
};
|
|
109
|
+
};
|