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,22 +1,24 @@
|
|
|
1
1
|
import { parseClientConfiguration, serializeClientConfiguration, clientServerPath, legacyClientServerPath, withClientServers, } from "./ClientConfigurationDocument.js";
|
|
2
|
-
import { copyFile, lstat,
|
|
2
|
+
import { copyFile, lstat, realpath, rm } from "node:fs/promises";
|
|
3
3
|
import { constants as fsConstants } from "node:fs";
|
|
4
4
|
import { homeDirectoryFromEnvironment } from "../config/homeDirectory.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import writeFileAtomic from "write-file-atomic";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { PRODUCT_IDENTITY } from "../identity.js";
|
|
9
|
-
import {
|
|
9
|
+
import { isManagedSkillManifest, MANAGED_SKILL_FILES, readSkillFile, skillDestinations, } from "./SetupSkill.js";
|
|
10
10
|
import { isOwnedClientRegistrationCommand } from "./ClientRegistrationIdentity.js";
|
|
11
11
|
import { resolveClientConfigTransactionPath } from "./ClientConfigPath.js";
|
|
12
|
+
import { readRegularFileText } from "./RegularFileRead.js";
|
|
12
13
|
import { manualRegistrationRemediation, supportedClients, } from "./SupportedClients.js";
|
|
13
14
|
const systemFileSystem = {
|
|
14
|
-
readText: (path) =>
|
|
15
|
+
readText: (path) => readRegularFileText(path),
|
|
16
|
+
readRegularText: readSkillFile,
|
|
15
17
|
copy: (source, destination) => copyFile(source, destination, fsConstants.COPYFILE_EXCL),
|
|
16
18
|
writeText: (path, contents) => writeFileAtomic(path, contents, { encoding: "utf8" }),
|
|
17
19
|
stat: (path) => lstat(path),
|
|
18
20
|
realpath: (path) => realpath(path),
|
|
19
|
-
remove: (path) => rm(path, { recursive
|
|
21
|
+
remove: (path, recursive = true) => rm(path, { recursive }),
|
|
20
22
|
};
|
|
21
23
|
/** Whether any requested REA-owned uninstall action failed. */
|
|
22
24
|
export const isUninstallFailure = (result) => {
|
|
@@ -57,11 +59,12 @@ export const runUninstall = async (purgeData, host = systemUninstallHost()) => {
|
|
|
57
59
|
status: "retained",
|
|
58
60
|
detail: "Hopper is not owned by REA uninstall.",
|
|
59
61
|
});
|
|
62
|
+
const reported = collapseUninstallItems(items);
|
|
60
63
|
return {
|
|
61
|
-
status:
|
|
64
|
+
status: reported.some(({ status }) => status === "failed")
|
|
62
65
|
? "failed"
|
|
63
66
|
: "complete",
|
|
64
|
-
items,
|
|
67
|
+
items: reported,
|
|
65
68
|
};
|
|
66
69
|
};
|
|
67
70
|
/**
|
|
@@ -88,7 +91,12 @@ const removeAll = async (clients, purgeData, host) => {
|
|
|
88
91
|
export const systemUninstallHost = (selectedHome = undefined, fileSystem = systemFileSystem, environment = process.env, platform = process.platform) => {
|
|
89
92
|
const home = selectedHome ?? homeDirectoryFromEnvironment(environment, platform);
|
|
90
93
|
return {
|
|
91
|
-
clients: () => Promise.resolve(supportedClients(home, platform, environment))
|
|
94
|
+
clients: () => Promise.resolve(supportedClients(home, platform, environment).flatMap((client) => client.configPaths === undefined
|
|
95
|
+
? [client]
|
|
96
|
+
: client.configPaths.map((configPath) => ({
|
|
97
|
+
...client,
|
|
98
|
+
configPath,
|
|
99
|
+
})))),
|
|
92
100
|
inspectClient: async (client) => {
|
|
93
101
|
const read = await readClientConfiguration(client, fileSystem);
|
|
94
102
|
return read.kind === "item" && read.item.status === "failed"
|
|
@@ -96,7 +104,7 @@ export const systemUninstallHost = (selectedHome = undefined, fileSystem = syste
|
|
|
96
104
|
: undefined;
|
|
97
105
|
},
|
|
98
106
|
removeClient: (client) => removeClient(client, fileSystem),
|
|
99
|
-
removeSkill: () => removeManagedSkills(home, fileSystem, environment),
|
|
107
|
+
removeSkill: () => removeManagedSkills(home, fileSystem, environment, platform),
|
|
100
108
|
purgeData: async () => [
|
|
101
109
|
await removeManagedPath(join(home, ".rea/cache"), "cache", fileSystem),
|
|
102
110
|
await removeManagedPath(join(home, ".rea/state"), "state", fileSystem),
|
|
@@ -104,6 +112,8 @@ export const systemUninstallHost = (selectedHome = undefined, fileSystem = syste
|
|
|
104
112
|
};
|
|
105
113
|
};
|
|
106
114
|
const readClientConfiguration = async (client, fileSystem) => {
|
|
115
|
+
if (client.configPathError !== undefined)
|
|
116
|
+
return itemRead(item(client.name, "failed", client.configPathError));
|
|
107
117
|
if (client.format === "unsupported")
|
|
108
118
|
return itemRead(item(client.name, "skipped", manualRegistrationRemediation(client.name) ??
|
|
109
119
|
"This client has no documented local MCP configuration boundary."));
|
|
@@ -225,8 +235,8 @@ const removeManagedPath = async (path, name, fileSystem) => {
|
|
|
225
235
|
: item(name, "failed", "This item could not be removed. Check file permissions, then rerun uninstall.");
|
|
226
236
|
}
|
|
227
237
|
};
|
|
228
|
-
const removeManagedSkills = async (home, fileSystem, environment) => {
|
|
229
|
-
const results = await Promise.all(skillDestinations(home, undefined,
|
|
238
|
+
const removeManagedSkills = async (home, fileSystem, environment, platform) => {
|
|
239
|
+
const results = await Promise.all(skillDestinations(home, undefined, environment, platform).map(({ client, path }) => removeManagedSkill(path, client === "claude_code" ? "Claude Code skill" : "skill", fileSystem)));
|
|
230
240
|
const failed = results.find(({ status }) => status === "failed");
|
|
231
241
|
if (failed !== undefined)
|
|
232
242
|
return item("skill", "failed", results
|
|
@@ -241,7 +251,145 @@ const removeManagedSkills = async (home, fileSystem, environment) => {
|
|
|
241
251
|
.map(({ name, status: resultStatus, detail }) => `${name}: ${resultStatus} (${detail})`)
|
|
242
252
|
.join(" "));
|
|
243
253
|
};
|
|
254
|
+
const removeManagedSkill = async (path, name, fileSystem) => {
|
|
255
|
+
let root;
|
|
256
|
+
try {
|
|
257
|
+
root = await fileSystem.stat(path);
|
|
258
|
+
}
|
|
259
|
+
catch (cause) {
|
|
260
|
+
return isMissing(cause)
|
|
261
|
+
? item(name, "skipped", "Skill directory does not exist.")
|
|
262
|
+
: item(name, "failed", "Skill directory could not be inspected.");
|
|
263
|
+
}
|
|
264
|
+
if (root.isSymbolicLink())
|
|
265
|
+
return item(name, "retained", "Skill directory is a symbolic link.");
|
|
266
|
+
if (root.isDirectory?.() !== true)
|
|
267
|
+
return item(name, "retained", "Skill path is not a directory.");
|
|
268
|
+
const manifestPath = join(path, "SKILL.md");
|
|
269
|
+
try {
|
|
270
|
+
const manifest = await fileSystem.stat(manifestPath);
|
|
271
|
+
if (manifest.isSymbolicLink())
|
|
272
|
+
return item(name, "retained", "Skill manifest is a symbolic link.");
|
|
273
|
+
if (manifest.isFile?.() !== true)
|
|
274
|
+
return item(name, "retained", "Skill manifest is not a regular file.");
|
|
275
|
+
}
|
|
276
|
+
catch (cause) {
|
|
277
|
+
return isMissing(cause)
|
|
278
|
+
? item(name, "retained", "Skill ownership could not be established.")
|
|
279
|
+
: item(name, "failed", "Skill manifest could not be inspected.");
|
|
280
|
+
}
|
|
281
|
+
let content;
|
|
282
|
+
try {
|
|
283
|
+
content = await (fileSystem.readRegularText?.(manifestPath) ??
|
|
284
|
+
fileSystem.readText(manifestPath));
|
|
285
|
+
}
|
|
286
|
+
catch (cause) {
|
|
287
|
+
return isMissing(cause)
|
|
288
|
+
? item(name, "retained", "Skill ownership could not be established.")
|
|
289
|
+
: item(name, "failed", "Skill manifest could not be read.");
|
|
290
|
+
}
|
|
291
|
+
if (!isManagedSkillManifest(content))
|
|
292
|
+
return item(name, "retained", "Skill manifest is not REA-owned.");
|
|
293
|
+
const manifestName = "SKILL.md";
|
|
294
|
+
const otherFiles = MANAGED_SKILL_FILES.filter((relativePath) => relativePath !== manifestName);
|
|
295
|
+
const results = [];
|
|
296
|
+
for (const relativePath of otherFiles)
|
|
297
|
+
results.push(await removeManagedSkillFile(path, relativePath, name, fileSystem));
|
|
298
|
+
if (results.some(({ status }) => status === "failed" || status === "retained"))
|
|
299
|
+
results.push(item(name, "retained", "REA ownership manifest was retained because a managed file could not be safely removed."));
|
|
300
|
+
else
|
|
301
|
+
results.push(await removeManagedSkillFile(path, manifestName, name, fileSystem));
|
|
302
|
+
const failed = results.find(({ status }) => status === "failed");
|
|
303
|
+
if (failed !== undefined)
|
|
304
|
+
return item(name, "failed", results.map(({ detail }) => detail).join(" "));
|
|
305
|
+
const removed = results.some(({ status }) => status === "removed");
|
|
306
|
+
return item(name, removed ? "removed" : "skipped", "REA-managed skill files were removed; other files were preserved.");
|
|
307
|
+
};
|
|
308
|
+
const removeManagedSkillFile = async (root, relativePath, name, fileSystem) => {
|
|
309
|
+
const segments = relativePath.split(/[\\/]/u);
|
|
310
|
+
let parent = root;
|
|
311
|
+
for (const segment of segments.slice(0, -1)) {
|
|
312
|
+
parent = join(parent, segment);
|
|
313
|
+
try {
|
|
314
|
+
const stats = await fileSystem.stat(parent);
|
|
315
|
+
if (stats.isSymbolicLink() || stats.isDirectory?.() !== true)
|
|
316
|
+
return item(name, "retained", `Managed path parent was retained: ${parent}.`);
|
|
317
|
+
}
|
|
318
|
+
catch (cause) {
|
|
319
|
+
return isMissing(cause)
|
|
320
|
+
? item(name, "skipped", `${join(parent, segments.at(-1) ?? "")} does not exist.`)
|
|
321
|
+
: item(name, "failed", `Managed path parent could not be inspected: ${parent}.`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const target = join(root, relativePath);
|
|
325
|
+
let stats;
|
|
326
|
+
try {
|
|
327
|
+
stats = await fileSystem.stat(target);
|
|
328
|
+
}
|
|
329
|
+
catch (cause) {
|
|
330
|
+
return isMissing(cause)
|
|
331
|
+
? item(name, "skipped", `${target} does not exist.`)
|
|
332
|
+
: item(name, "failed", `Managed file could not be inspected: ${target}.`);
|
|
333
|
+
}
|
|
334
|
+
if (stats.isSymbolicLink())
|
|
335
|
+
return item(name, "retained", `Managed file is a symbolic link: ${target}.`);
|
|
336
|
+
if (stats.isFile?.() !== true)
|
|
337
|
+
return item(name, "retained", `Managed path is not a regular file: ${target}.`);
|
|
338
|
+
try {
|
|
339
|
+
await fileSystem.remove(target, false);
|
|
340
|
+
return item(name, "removed", `Removed ${target}.`);
|
|
341
|
+
}
|
|
342
|
+
catch (cause) {
|
|
343
|
+
return isMissing(cause)
|
|
344
|
+
? item(name, "skipped", `${target} does not exist.`)
|
|
345
|
+
: item(name, "failed", `Managed file could not be removed: ${target}.`);
|
|
346
|
+
}
|
|
347
|
+
};
|
|
244
348
|
const item = (name, status, detail) => ({ name, status, detail });
|
|
349
|
+
/**
|
|
350
|
+
* Layered clients are removed file by file, but callers look up one status by
|
|
351
|
+
* client name. A missing earlier file must not hide a later removal.
|
|
352
|
+
*/
|
|
353
|
+
const collapseUninstallItems = (items) => {
|
|
354
|
+
const collapsed = [];
|
|
355
|
+
for (const next of items) {
|
|
356
|
+
const index = collapsed.findIndex(({ name }) => name === next.name);
|
|
357
|
+
const current = collapsed[index];
|
|
358
|
+
if (current === undefined) {
|
|
359
|
+
collapsed.push(next);
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
collapsed[index] = mergeUninstallItems(current, next);
|
|
363
|
+
}
|
|
364
|
+
return collapsed;
|
|
365
|
+
};
|
|
366
|
+
const mergeUninstallItems = (current, next) => {
|
|
367
|
+
const status = preferredUninstallStatus(current.status, next.status);
|
|
368
|
+
const details = [current, next]
|
|
369
|
+
.filter((entry) => entry.status === status ||
|
|
370
|
+
(status === "removed" && entry.status === "retained"))
|
|
371
|
+
.map(({ detail }) => detail);
|
|
372
|
+
return item(current.name, status, [...new Set(details)].join(" "));
|
|
373
|
+
};
|
|
374
|
+
const preferredUninstallStatus = (current, next) => uninstallStatusPriority(next) > uninstallStatusPriority(current)
|
|
375
|
+
? next
|
|
376
|
+
: current;
|
|
377
|
+
const uninstallStatusPriority = (status) => {
|
|
378
|
+
switch (status) {
|
|
379
|
+
case "failed":
|
|
380
|
+
return 3;
|
|
381
|
+
case "removed":
|
|
382
|
+
return 2;
|
|
383
|
+
case "retained":
|
|
384
|
+
return 1;
|
|
385
|
+
case "skipped":
|
|
386
|
+
return 0;
|
|
387
|
+
default: {
|
|
388
|
+
const exhaustive = status;
|
|
389
|
+
throw new TypeError(`Unhandled uninstall item status: ${String(exhaustive)}`);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
245
393
|
const registrationSchema = z
|
|
246
394
|
.object({ command: z.string(), args: z.array(z.string()) })
|
|
247
395
|
.passthrough();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { join } from "node:path";
|
|
3
1
|
import { z } from "zod";
|
|
4
2
|
import { PRODUCT_IDENTITY } from "../identity.js";
|
|
5
3
|
import { isOwnedClientRegistrationCommand } from "./ClientRegistrationIdentity.js";
|
|
6
4
|
import { readClientRegistrationStatuses } from "./ClientRegistrationStatus.js";
|
|
7
5
|
import { clientServerForcedEnabled, clientServerListedDisabled, effectiveClientServer, parseClientConfiguration, } from "./ClientConfigurationDocument.js";
|
|
8
6
|
import { supportedClients } from "./SupportedClients.js";
|
|
7
|
+
import { existingSkillDestinations } from "./SetupSkill.js";
|
|
8
|
+
import { readRegularFileText } from "./RegularFileRead.js";
|
|
9
9
|
const setupPlanSchema = z.object({
|
|
10
10
|
status: z.literal("planned"),
|
|
11
11
|
plannedActions: z.array(z.object({
|
|
@@ -20,7 +20,7 @@ const setupPlanSchema = z.object({
|
|
|
20
20
|
commands: z.array(z.string()).optional(),
|
|
21
21
|
})),
|
|
22
22
|
});
|
|
23
|
-
/** Discover owned registrations and
|
|
23
|
+
/** Discover owned registrations and REA skills without writes. */
|
|
24
24
|
export const existingMaintenanceScope = async (home, entryPoint, environment) => {
|
|
25
25
|
const registrations = await readClientRegistrationStatuses(home, entryPoint, {
|
|
26
26
|
environment,
|
|
@@ -34,7 +34,7 @@ export const existingMaintenanceScope = async (home, entryPoint, environment) =>
|
|
|
34
34
|
const client = supported.find(({ name }) => name === registration.client);
|
|
35
35
|
if (client === undefined)
|
|
36
36
|
continue;
|
|
37
|
-
const parsed = parseClientConfiguration(await
|
|
37
|
+
const parsed = parseClientConfiguration(await readRegularFileText(client.configPath), client.format);
|
|
38
38
|
const enabled = z
|
|
39
39
|
.object({
|
|
40
40
|
enabled: z.boolean().optional(),
|
|
@@ -48,23 +48,18 @@ export const existingMaintenanceScope = async (home, entryPoint, environment) =>
|
|
|
48
48
|
!clientServerListedDisabled(parsed, PRODUCT_IDENTITY.mcpServerKey))
|
|
49
49
|
clients.push(client.name);
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
skill
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
catch (cause) {
|
|
59
|
-
if (!(cause instanceof Error && "code" in cause && cause.code === "ENOENT"))
|
|
60
|
-
throw cause;
|
|
61
|
-
}
|
|
62
|
-
return { clients, skill };
|
|
51
|
+
const skillDestinations = await existingSkillDestinations(home, environment);
|
|
52
|
+
return {
|
|
53
|
+
clients,
|
|
54
|
+
skill: skillDestinations.length > 0,
|
|
55
|
+
skillDestinations,
|
|
56
|
+
};
|
|
63
57
|
};
|
|
64
58
|
/** Ask the verified new executable to plan only existing REA integrations. */
|
|
65
59
|
export const planIntegrationMaintenance = async (home, entryPoint, environment, execute) => {
|
|
66
60
|
try {
|
|
67
61
|
const scope = await existingMaintenanceScope(home, entryPoint, environment);
|
|
62
|
+
const skillDestinations = scope.skillDestinations ?? [];
|
|
68
63
|
if (scope.clients.length === 0 && !scope.skill)
|
|
69
64
|
return { status: "current", plannedActions: [] };
|
|
70
65
|
const command = [
|
|
@@ -72,6 +67,7 @@ export const planIntegrationMaintenance = async (home, entryPoint, environment,
|
|
|
72
67
|
entryPoint,
|
|
73
68
|
"setup",
|
|
74
69
|
...scope.clients.flatMap((client) => ["--client", client]),
|
|
70
|
+
...skillDestinations.flatMap(({ client }) => ["--skill-client", client]),
|
|
75
71
|
`--skill=${String(scope.skill)}`,
|
|
76
72
|
];
|
|
77
73
|
const execution = await execute([...command, "--dry-run", "--json"]);
|
|
@@ -85,11 +81,11 @@ export const planIntegrationMaintenance = async (home, entryPoint, environment,
|
|
|
85
81
|
};
|
|
86
82
|
if (plan.data.plannedActions.length === 0)
|
|
87
83
|
return { status: "current", plannedActions: [] };
|
|
88
|
-
const allowedIds = new Set(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
const allowedIds = new Set(scope.clients.map((client) => `configure_client:${client}`));
|
|
85
|
+
const skillTargets = new Set(skillDestinations.map(({ path }) => path));
|
|
86
|
+
if (plan.data.plannedActions.some((action) => action.kind === "install_skill"
|
|
87
|
+
? !skillTargets.has(action.target)
|
|
88
|
+
: !allowedIds.has(action.id)))
|
|
93
89
|
return {
|
|
94
90
|
status: "unavailable",
|
|
95
91
|
remediation: "The updated setup plan included an integration outside the existing REA maintenance scope.",
|
|
@@ -3,6 +3,11 @@ import { AnalysisResourceConstraintError } from "../domain/analysisErrorCore.js"
|
|
|
3
3
|
import { safeParseJson } from "../domain/safeJson.js";
|
|
4
4
|
/** Recovery that preserves complete, authenticated Evidence workflow inputs. */
|
|
5
5
|
export const JSON_INPUT_RESOURCE_REMEDIATION = "Provide a smaller valid JSON value. For Evidence workflows, re-analyze a smaller selection of the original target and use its complete Evidence; splitting JSON text or trimming Evidence fields does not produce valid workflow input.";
|
|
6
|
+
/**
|
|
7
|
+
* Strict JSON input keeps rejecting a leading byte-order mark, but names it:
|
|
8
|
+
* the parser's own message quotes the invisible U+FEFF as the bad token.
|
|
9
|
+
*/
|
|
10
|
+
export const JSON_BYTE_ORDER_MARK_MESSAGE = "JSON input begins with a UTF-8 byte-order mark (EF BB BF), which strict JSON input does not accept. Save the file as UTF-8 without a byte-order mark.";
|
|
6
11
|
/** Decode JSON bytes without confusing a runtime string limit with malformed input. */
|
|
7
12
|
export const parseUtf8Json = (bytes, operation, path, boundary = "json-input") => {
|
|
8
13
|
const stringLimitFailure = (cause, decodedUnits) => new AnalysisResourceConstraintError(operation, "memory", "JSON input exceeds the runtime's maximum decoded string length", {
|
|
@@ -60,5 +65,7 @@ export const parseUtf8Json = (bytes, operation, path, boundary = "json-input") =
|
|
|
60
65
|
cause,
|
|
61
66
|
};
|
|
62
67
|
}
|
|
68
|
+
if (text.startsWith("\uFEFF"))
|
|
69
|
+
return { ok: false, error: JSON_BYTE_ORDER_MARK_MESSAGE, cause: undefined };
|
|
63
70
|
return safeParseJson(text);
|
|
64
71
|
};
|
|
@@ -6,26 +6,28 @@ import { publishWebScripts } from "../browser/assets/PublishWebScripts.js";
|
|
|
6
6
|
import { selectScriptCapture } from "../browser/assets/ScriptCaptureAdapters.js";
|
|
7
7
|
import { AnalysisAccessDeniedError, AnalysisCancelledError, AnalysisInputError, AnalysisOutputError, } from "../domain/analysisErrorCore.js";
|
|
8
8
|
import { createEvidence } from "../domain/evidence.js";
|
|
9
|
+
import { analysisErrorWithCleanupFailure } from "../domain/analysisErrorCleanup.js";
|
|
9
10
|
import { analysisInputErrorFromIssues } from "../domain/inputIssueProjection.js";
|
|
10
11
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
11
12
|
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
13
|
+
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
|
|
12
14
|
import { err, ok } from "../domain/result.js";
|
|
13
15
|
import { safeParseJson } from "../domain/safeJson.js";
|
|
14
16
|
import { exportWebScriptsInputSchema, } from "../domain/webScriptExport.js";
|
|
15
17
|
import { WebScriptExportError } from "../domain/webScriptExportError.js";
|
|
16
18
|
import { WEB_SCRIPT_EXPORT_PROVIDER as PROVIDER } from "./InvestigationProviders.js";
|
|
17
|
-
import { readRegularFile } from "./RegularFileRead.js";
|
|
18
|
-
import { NonRegularFileReadError } from "../filesystem/RegularFile.js";
|
|
19
|
+
import { readRegularFile, RegularFileCleanupFailure, retryRegularFileCleanup, } from "./RegularFileRead.js";
|
|
20
|
+
import { NonRegularFileReadError, RegularFileChangedError, } from "../filesystem/RegularFile.js";
|
|
19
21
|
const OPERATION = "export_web_scripts";
|
|
20
22
|
/** Export one local capture through the shared CLI/MCP application workflow. */
|
|
21
|
-
export const exportWebScripts = async (rawInput, options = {}) => {
|
|
23
|
+
export const exportWebScripts = async (rawInput, resources, options = {}) => {
|
|
22
24
|
const input = exportWebScriptsInputSchema.safeParse(rawInput);
|
|
23
25
|
return input.success
|
|
24
|
-
? exportWebScriptsValidated(input.data, options)
|
|
26
|
+
? exportWebScriptsValidated(input.data, resources, options)
|
|
25
27
|
: err(analysisInputErrorFromIssues(OPERATION, input.error.issues, rawInput));
|
|
26
28
|
};
|
|
27
29
|
/** Publish input already parsed by a named adapter contract. */
|
|
28
|
-
export const exportWebScriptsValidated = async (input, options = {}) => {
|
|
30
|
+
export const exportWebScriptsValidated = async (input, resources, options = {}) => {
|
|
29
31
|
if (!isAbsolute(input.capture_path) || !isAbsolute(input.output_directory))
|
|
30
32
|
return err(new AnalysisInputError(OPERATION, undefined, [
|
|
31
33
|
{
|
|
@@ -36,16 +38,16 @@ export const exportWebScriptsValidated = async (input, options = {}) => {
|
|
|
36
38
|
]));
|
|
37
39
|
try {
|
|
38
40
|
options.signal?.throwIfAborted();
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
41
|
-
return
|
|
42
|
-
const bytes =
|
|
43
|
-
const loaded = parseCapture(bytes);
|
|
44
|
-
if (!loaded.ok)
|
|
45
|
-
return loaded;
|
|
41
|
+
const prepared = await prepareCapture(input.capture_path, resources, options.signal);
|
|
42
|
+
if (!prepared.ok)
|
|
43
|
+
return prepared;
|
|
44
|
+
const { bytes, loaded } = prepared.value;
|
|
46
45
|
options.signal?.throwIfAborted();
|
|
47
46
|
const sha256 = createHash("sha256").update(bytes).digest("hex");
|
|
48
|
-
const result = await publishWebScripts(input, loaded
|
|
47
|
+
const result = await publishWebScripts(input, loaded, sha256, {
|
|
48
|
+
resources,
|
|
49
|
+
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
50
|
+
});
|
|
49
51
|
return ok(createEvidence({ path: input.capture_path, sha256, format: "file" }, PROVIDER, {
|
|
50
52
|
predicateType: "rea.web-script-export",
|
|
51
53
|
operation: OPERATION,
|
|
@@ -59,71 +61,132 @@ export const exportWebScriptsValidated = async (input, options = {}) => {
|
|
|
59
61
|
authority: "historical-reference",
|
|
60
62
|
limitations: result.limitations,
|
|
61
63
|
locations: [{ kind: "artifact-path", path: result.manifest.path }],
|
|
62
|
-
evidenceLinks: loaded.
|
|
63
|
-
? []
|
|
64
|
-
: [loaded.value.sourceEvidenceId],
|
|
64
|
+
evidenceLinks: loaded.sourceEvidenceId === null ? [] : [loaded.sourceEvidenceId],
|
|
65
65
|
}));
|
|
66
66
|
}
|
|
67
67
|
catch (cause) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return err(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
: typeof cause === "string"
|
|
89
|
-
? cause
|
|
90
|
-
: "Unknown script export failure",
|
|
91
|
-
},
|
|
92
|
-
}));
|
|
68
|
+
return err(mapExportFailure(cause, input, options.signal));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const prepareCapture = async (path, resources, signal) => {
|
|
72
|
+
const read = await resources.run(() => readCapture(path, resources, signal));
|
|
73
|
+
if (!read.ok)
|
|
74
|
+
return read;
|
|
75
|
+
const cleanup = read.value.cleanup;
|
|
76
|
+
const loaded = parseCapture(read.value.bytes, cleanup === undefined || cleanup.incomplete
|
|
77
|
+
? undefined
|
|
78
|
+
: { cause: cleanup.cause });
|
|
79
|
+
if (!loaded.ok)
|
|
80
|
+
return err(cleanup?.incomplete === true
|
|
81
|
+
? incompleteCaptureCleanup(loaded.error, path, cleanup)
|
|
82
|
+
: loaded.error);
|
|
83
|
+
if (cleanup !== undefined) {
|
|
84
|
+
const primary = new WebScriptExportError("io", path, `Capture handle close failed: ${cleanup.reason}`, { cause: cleanup.cause });
|
|
85
|
+
return err(cleanup.incomplete
|
|
86
|
+
? incompleteCaptureCleanup(primary, path, cleanup)
|
|
87
|
+
: primary);
|
|
93
88
|
}
|
|
89
|
+
return ok({ bytes: read.value.bytes, loaded: loaded.value });
|
|
90
|
+
};
|
|
91
|
+
const mapExportFailure = (cause, input, signal) => {
|
|
92
|
+
if (cause instanceof WebScriptExportError)
|
|
93
|
+
return cause;
|
|
94
|
+
if (cause instanceof ArtifactReaderFailure && cause.cleanup !== undefined)
|
|
95
|
+
return analysisErrorWithCleanupFailure(new WebScriptExportError(cause.reason, input.output_directory, cause.message, { cause }), new ProviderCleanupError(PROVIDER.id, cause.cleanup.resources, { reason: cause.cleanup.reason }, { cause, operation: OPERATION }), OPERATION);
|
|
96
|
+
if (signal?.aborted === true)
|
|
97
|
+
return new AnalysisCancelledError(OPERATION, { cause });
|
|
98
|
+
if (cause instanceof ArtifactReaderFailure)
|
|
99
|
+
return new WebScriptExportError(cause.reason, input.output_directory, cause.message, { cause });
|
|
100
|
+
if (cause instanceof z.ZodError)
|
|
101
|
+
return new AnalysisOutputError(OPERATION, cause.message, { cause });
|
|
102
|
+
if (cause instanceof Error &&
|
|
103
|
+
"code" in cause &&
|
|
104
|
+
typeof cause.code === "string")
|
|
105
|
+
return new WebScriptExportError("io", `${input.capture_path} → ${input.output_directory}`, cause.message, { cause });
|
|
106
|
+
return new ProviderAdapterError(PROVIDER.id, OPERATION, {
|
|
107
|
+
cause,
|
|
108
|
+
diagnostics: {
|
|
109
|
+
capture_path: input.capture_path,
|
|
110
|
+
output_directory: input.output_directory,
|
|
111
|
+
error_name: cause instanceof Error ? cause.name : "UnknownError",
|
|
112
|
+
error_message: cause instanceof Error
|
|
113
|
+
? cause.message
|
|
114
|
+
: typeof cause === "string"
|
|
115
|
+
? cause
|
|
116
|
+
: "Unknown script export failure",
|
|
117
|
+
},
|
|
118
|
+
});
|
|
94
119
|
};
|
|
95
120
|
/**
|
|
96
121
|
* Read the caller-selected capture. A missing, non-file or unreadable
|
|
97
122
|
* selection is a caller or host-permission failure, not an export failure.
|
|
98
123
|
*/
|
|
99
|
-
const readCapture = async (path, signal) => {
|
|
124
|
+
const readCapture = async (path, resources, signal) => {
|
|
100
125
|
try {
|
|
101
|
-
return ok(await readRegularFile(path, signal));
|
|
126
|
+
return ok({ bytes: await readRegularFile(path, { signal }) });
|
|
102
127
|
}
|
|
103
128
|
catch (cause) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
? `Selected capture is a directory, not a file: ${path}`
|
|
120
|
-
: `Selected capture could not be read (${code}): ${path}`,
|
|
121
|
-
},
|
|
122
|
-
]));
|
|
123
|
-
throw cause;
|
|
129
|
+
if (cause instanceof RegularFileCleanupFailure) {
|
|
130
|
+
const retry = await retryRegularFileCleanup(cause, resources);
|
|
131
|
+
const cleanup = {
|
|
132
|
+
reason: retry.cleanup?.reason ?? errorMessage(cause.cleanupCause),
|
|
133
|
+
incomplete: retry.cleanup !== undefined,
|
|
134
|
+
cause: cause.cleanupCause,
|
|
135
|
+
};
|
|
136
|
+
if (cause.outcome.kind === "completed")
|
|
137
|
+
return ok({ bytes: cause.outcome.value, cleanup });
|
|
138
|
+
const primary = captureReadFailure(path, cause.outcome.cause, signal, retry.cleanup === undefined ? { cause: cause.cleanupCause } : undefined);
|
|
139
|
+
return err(retry.cleanup === undefined
|
|
140
|
+
? primary
|
|
141
|
+
: incompleteCaptureCleanup(primary, path, cleanup));
|
|
142
|
+
}
|
|
143
|
+
return err(captureReadFailure(path, cause, signal));
|
|
124
144
|
}
|
|
125
145
|
};
|
|
126
|
-
const
|
|
146
|
+
const captureReadFailure = (path, cause, signal, closeFailure) => {
|
|
147
|
+
const causeWithClose = closeFailure === undefined
|
|
148
|
+
? cause
|
|
149
|
+
: new AggregateError([cause, closeFailure.cause], "Capture read and file-handle close both failed", { cause });
|
|
150
|
+
if (signal?.aborted === true)
|
|
151
|
+
return new AnalysisCancelledError(OPERATION, { cause: causeWithClose });
|
|
152
|
+
const code = cause instanceof Error && "code" in cause ? String(cause.code) : "";
|
|
153
|
+
if (code === "EACCES" || code === "EPERM")
|
|
154
|
+
return new AnalysisAccessDeniedError(OPERATION, path, code, {
|
|
155
|
+
cause: causeWithClose,
|
|
156
|
+
});
|
|
157
|
+
if (cause instanceof NonRegularFileReadError ||
|
|
158
|
+
cause instanceof RegularFileChangedError ||
|
|
159
|
+
code === "ENOENT" ||
|
|
160
|
+
code === "ENOTDIR" ||
|
|
161
|
+
code === "EISDIR" ||
|
|
162
|
+
code === "ENXIO")
|
|
163
|
+
return new AnalysisInputError(OPERATION, { cause: causeWithClose }, [
|
|
164
|
+
{
|
|
165
|
+
path: ["capture_path"],
|
|
166
|
+
reason: "invalid_value",
|
|
167
|
+
message: cause instanceof NonRegularFileReadError && code !== "EISDIR"
|
|
168
|
+
? cause.message
|
|
169
|
+
: code === "EISDIR"
|
|
170
|
+
? `Selected capture is a directory, not a file: ${path}`
|
|
171
|
+
: `Selected capture could not be read (${code}): ${path}`,
|
|
172
|
+
},
|
|
173
|
+
]);
|
|
174
|
+
if (code !== "")
|
|
175
|
+
return new WebScriptExportError("io", path, errorMessage(cause), {
|
|
176
|
+
cause: causeWithClose,
|
|
177
|
+
});
|
|
178
|
+
return new ProviderAdapterError(PROVIDER.id, OPERATION, {
|
|
179
|
+
cause: causeWithClose,
|
|
180
|
+
diagnostics: {
|
|
181
|
+
capture_path: path,
|
|
182
|
+
error_name: cause instanceof Error ? cause.name : "UnknownError",
|
|
183
|
+
error_message: cause instanceof Error ? cause.message : String(cause),
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
const incompleteCaptureCleanup = (primary, path, cleanup) => analysisErrorWithCleanupFailure(primary, new ProviderCleanupError(PROVIDER.id, [path], { reason: cleanup.reason }, { cause: cleanup.cause, operation: OPERATION }), OPERATION);
|
|
188
|
+
const errorMessage = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
189
|
+
const parseCapture = (bytes, closeFailure) => {
|
|
127
190
|
try {
|
|
128
191
|
const text = new TextDecoder("utf-8", {
|
|
129
192
|
fatal: true,
|
|
@@ -135,7 +198,10 @@ const parseCapture = (bytes) => {
|
|
|
135
198
|
return ok(selectScriptCapture(json.value));
|
|
136
199
|
}
|
|
137
200
|
catch (cause) {
|
|
138
|
-
|
|
201
|
+
const causeWithClose = closeFailure === undefined
|
|
202
|
+
? cause
|
|
203
|
+
: new AggregateError([cause, closeFailure.cause], "Capture parse and file-handle close both failed", { cause });
|
|
204
|
+
return err(new AnalysisInputError(OPERATION, { cause: causeWithClose }, [
|
|
139
205
|
{
|
|
140
206
|
path: ["capture_path"],
|
|
141
207
|
reason: "invalid_format",
|
|
@@ -35,6 +35,9 @@ export class WebSourceLocationService {
|
|
|
35
35
|
this.artifacts = artifacts;
|
|
36
36
|
this.decoder = decoder;
|
|
37
37
|
}
|
|
38
|
+
close() {
|
|
39
|
+
return this.decoder.close?.() ?? Promise.resolve();
|
|
40
|
+
}
|
|
38
41
|
/** Shared CLI/MCP workflow preserves raw declarations and every equal-position match. */
|
|
39
42
|
async trace(rawInput, options) {
|
|
40
43
|
if (options?.signal?.aborted)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { adbRequestSchema, } from "../../domain/adb/adbDeviceAnalysis.js";
|
|
2
|
+
import { executeProviderOperation } from "../ProviderOperationExecution.js";
|
|
3
|
+
/** Shared CLI/MCP admission, execution, and Evidence composition for ADB. */
|
|
4
|
+
export class AdbDeviceAnalysisService {
|
|
5
|
+
provider;
|
|
6
|
+
constructor(provider) {
|
|
7
|
+
this.provider = provider;
|
|
8
|
+
}
|
|
9
|
+
/** Run one caller-selected ADB request and retain device provenance inline. */
|
|
10
|
+
async execute(operation, input, options) {
|
|
11
|
+
return executeProviderOperation(operation, input, options, adbRequestSchema, this.provider, "observed");
|
|
12
|
+
}
|
|
13
|
+
}
|