rea-agents 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -30
- package/bridge/ghidra/ReaGhidraBridge.java +358 -15
- package/bridge/ghidra/ReaGhidraExtensions.java +113 -0
- package/bridge/ghidra/ReaGhidraPrepareCom.java +32 -0
- package/dist/android/AndroidTargetSnapshot.js +34 -0
- package/dist/android/JadxAnalysis.js +191 -0
- package/dist/android/JadxConfiguration.js +41 -0
- package/dist/android/JadxMcpTransport.js +145 -0
- package/dist/android/JadxProtocol.js +101 -0
- package/dist/android/JadxProvider.js +170 -0
- package/dist/android/JadxRelease.js +19 -0
- package/dist/android/JadxSession.js +97 -0
- package/dist/application/AnalysisContextQueries.js +2 -1
- package/dist/application/AnalysisProviderEvaluation.js +5 -3
- package/dist/application/AnalysisProviderRegistry.js +2 -1
- package/dist/application/AnalysisSnapshotCache.js +4 -1
- package/dist/application/AnalysisSnapshotFiles.js +1 -1
- package/dist/application/AndroidAnalysisPort.js +1 -0
- package/dist/application/AndroidAnalysisService.js +37 -0
- package/dist/application/ArtifactExtraction.js +7 -4
- package/dist/application/ArtifactGraphConstruction.js +10 -17
- package/dist/application/ArtifactInventory/scanCanonical.js +8 -7
- package/dist/application/BinarySession.js +16 -3
- package/dist/application/BinarySessionExecution.js +4 -1
- package/dist/application/BinarySessionOpen.js +3 -2
- package/dist/application/BinarySessionRecords.js +9 -3
- package/dist/application/BinaryTargetResolver.js +25 -6
- 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 +18 -0
- package/dist/application/ClientConfigPath.js +3 -1
- package/dist/application/ClientConfigurationDocument.js +11 -1
- package/dist/application/ClientRegistrationStatus.js +8 -1
- package/dist/application/CompositeProvider.js +1 -1
- package/dist/application/DirectAnalysis.js +23 -7
- package/dist/application/DirectAnalysisStatus.js +3 -3
- package/dist/application/Doctor.js +48 -8
- package/dist/application/DoctorDiagnostics.js +7 -5
- package/dist/application/DoctorScope.js +1 -1
- package/dist/application/ElectronActiveEvidence.js +2 -2
- package/dist/application/ElectronActiveObservationService.js +2 -1
- package/dist/application/ElectronBoundaryAnalysis.js +1 -1
- package/dist/application/ElectronObservationService.js +2 -1
- package/dist/application/EnhancedLiteralTracing.js +2 -1
- package/dist/application/EnhancedToolTypes.js +2 -1
- package/dist/application/EnhancedTools.js +3 -1
- package/dist/application/EvidenceBundleCommands.js +2 -1
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/EvidenceInputResolver.js +30 -0
- package/dist/application/EvidenceLedger.js +2 -1
- package/dist/application/FirmwareAnalysisPort.js +1 -0
- package/dist/application/FirmwareAnalysisService.js +35 -0
- package/dist/application/FunctionAnalysisEvidence.js +32 -0
- package/dist/application/InventoryProjectionEvidence.js +2 -1
- package/dist/application/JavaScriptApplicationService.js +50 -3
- package/dist/application/JavaScriptApplicationWorkflowService.js +2 -1
- package/dist/application/JavaScriptArtifactAnalysis.js +4 -2
- package/dist/application/JavaScriptArtifactFiles.js +4 -2
- package/dist/application/JavaScriptArtifactPathResolution.js +6 -2
- package/dist/application/JavaScriptJsonModules.js +3 -2
- package/dist/application/JavaScriptModuleRelationships.js +4 -2
- package/dist/application/JavaScriptRuntimeObservationService.js +2 -1
- package/dist/application/JavaScriptRuntimeReconciliationService.js +2 -1
- package/dist/application/JavaScriptSemanticGraphProjection.js +1 -1
- package/dist/application/JavaScriptSemanticTraceService.js +2 -1
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LazyAnalysisProvider.js +3 -1
- package/dist/application/LinuxHopper.js +12 -4
- package/dist/application/MacHopper.js +20 -7
- package/dist/application/ManagedApplicationGraphService.js +2 -1
- package/dist/application/ManagedMemberComparisonService.js +3 -1
- package/dist/application/ManagedNativeVerificationService.js +2 -1
- package/dist/application/ManagedReconstructionService.js +2 -1
- package/dist/application/NativeCallRoutes.js +1 -1
- package/dist/application/NativeDispatchMetadataInspection.js +1 -1
- package/dist/application/NativeUiActionTrace.js +2 -1
- package/dist/application/NativeValueTrace.js +1 -1
- package/dist/application/ProcessCaptureError.js +1 -1
- package/dist/application/ProcessCaptureJournal.js +3 -1
- package/dist/application/ProcessCaptureLifecycle.js +6 -3
- package/dist/application/ProcessCli.js +9 -5
- package/dist/application/ProcessEvidence.js +2 -6
- package/dist/application/ProcessHarness.js +3 -2
- package/dist/application/ProcessNormalization.js +12 -5
- package/dist/application/ProcessSampling.js +3 -1
- package/dist/application/ReconstructionCoverageService.js +2 -1
- package/dist/application/ReconstructionObligationLedgerService.js +2 -1
- package/dist/application/ReferenceSourceImportEntries.js +2 -0
- package/dist/application/ReferenceSourceImportPolicy.js +4 -2
- package/dist/application/ReferenceSourceVcsAdapter.js +35 -4
- package/dist/application/SessionProviderRouter.js +4 -1
- package/dist/application/Setup.js +1 -128
- package/dist/application/SetupClientConfiguration.js +17 -6
- package/dist/application/SetupHost.js +111 -0
- 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 +9 -4
- package/dist/application/UpdateRuntime.js +5 -2
- package/dist/application/WindowsCapabilities.js +7 -7
- package/dist/application/runtime.js +3 -1
- package/dist/artifacts/ArtifactProvider.js +3 -1
- package/dist/artifacts/DirectoryArtifactReader.js +2 -0
- package/dist/artifacts/NativeDmgArtifactReader.js +10 -3
- package/dist/artifacts/NibArchive.js +4 -2
- package/dist/artifacts/SafeOutputTree.js +26 -10
- package/dist/artifacts/ZipArtifactReader.js +1 -0
- package/dist/browser/BrowserProcessStartup.js +3 -1
- package/dist/browser/CdpAuthorizedMainFrame.js +1 -1
- package/dist/browser/CdpBrowserProvider.js +4 -1
- package/dist/browser/CdpCaptureDocuments.js +3 -1
- package/dist/browser/CdpCaptureEventHandlers.js +6 -2
- package/dist/browser/CdpCaptureStorageFingerprints.js +1 -1
- package/dist/browser/CdpCaptureValues.js +6 -2
- package/dist/browser/CdpConnection.js +8 -6
- package/dist/browser/CdpElectronInspection.js +3 -3
- package/dist/browser/CdpElectronProvider.js +4 -1
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpEndpoint.js +22 -10
- package/dist/browser/CdpObservationSession.js +2 -1
- package/dist/browser/CdpOptionalCommand.js +1 -1
- package/dist/browser/CdpPageCapture.js +2 -1
- package/dist/browser/CdpSafeMetadata.js +53 -8
- package/dist/browser/CdpScreenshot.js +1 -1
- package/dist/browser/CdpTargetSession.js +8 -5
- package/dist/browser/CdpWebMcpDiscovery.js +1 -1
- package/dist/browser/ElectronFileScope.js +9 -3
- package/dist/browser/JavaScriptRuntimeScope.js +3 -1
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +3 -1
- package/dist/browser/PlaywrightElectronActiveActions.js +1 -1
- package/dist/browser/PlaywrightElectronActiveProvider.js +6 -2
- 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 +6 -2
- package/dist/browser/PlaywrightScenarioSession.js +5 -2
- package/dist/browser/V8InspectorEndpoint.js +2 -1
- package/dist/browser/V8InspectorProvider.js +6 -1
- package/dist/browser/WebSourceMapFetcher.js +24 -11
- package/dist/cli/androidCommands.js +81 -0
- package/dist/{cliApplicationCommands.js → cli/applicationCommands.js} +18 -16
- package/dist/{cliBrowserAdvancedCommands.js → cli/browserAdvancedCommands.js} +13 -16
- package/dist/{cliBrowserCommands.js → cli/browserCommands.js} +9 -9
- package/dist/cli/commandCancellation.js +24 -0
- package/dist/cli/coreAnalysisCommands.js +110 -17
- package/dist/{cliElectronCommands.js → cli/electronCommands.js} +14 -13
- package/dist/cli/firmwareCommands.js +75 -0
- package/dist/{cliSetup.js → cli/interactiveSetup.js} +1 -1
- package/dist/cli/javascriptApplicationAnalysis.js +1 -1
- package/dist/cli/managedCommands.js +1 -1
- package/dist/cli/managedProjectGraphCommand.js +1 -1
- package/dist/cli/options.js +7 -1
- package/dist/{cliProcessCommands.js → cli/processCommands.js} +3 -3
- package/dist/cli/referenceSourceImportStatus.js +10 -0
- package/dist/cli/setupCommands.js +4 -2
- package/dist/cli/utilityCommands.js +3 -2
- package/dist/cli.js +10 -15
- package/dist/cliBrowserContext.js +1 -1
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +11 -2
- package/dist/cliEvidenceCommands.js +2 -1
- package/dist/cliJavaScriptRuntimeCommands.js +2 -1
- package/dist/cliJsonInput.js +26 -11
- package/dist/cliLogging.js +2 -1
- package/dist/cliOutput.js +15 -16
- package/dist/config/environment.js +11 -1
- package/dist/config/parseConfig.js +7 -1
- package/dist/config/parsers.js +1 -1
- package/dist/contracts/androidToolContracts.js +77 -0
- package/dist/contracts/applicationToolContracts.js +32 -5
- package/dist/contracts/applicationWorkflowInputContracts.js +13 -13
- package/dist/contracts/artifactComparisonExample.js +7 -14
- package/dist/contracts/enhancedToolContracts.js +31 -0
- package/dist/contracts/errorSchemas.js +4 -2
- package/dist/contracts/evidenceInputContracts.js +13 -0
- package/dist/contracts/firmwareToolContracts.js +38 -0
- 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 +7 -130
- package/dist/contracts/toolEffects.js +43 -0
- package/dist/contracts/toolOutputSchemaGroups.js +4 -0
- package/dist/contracts/toolOutputSchemaPrimitives.js +1 -0
- package/dist/doctorRuntime.js +5 -1
- package/dist/domain/analysisErrorBase.js +33 -0
- package/dist/domain/analysisErrorCore.js +60 -0
- package/dist/domain/analysisErrorPresentation.js +22 -2
- package/dist/domain/analysisErrorProjection.js +24 -3
- package/dist/domain/analysisSnapshot.js +1 -0
- package/dist/domain/androidAnalysis.js +141 -0
- package/dist/domain/appleAssetCatalog.js +1 -1
- package/dist/domain/artifactGraph.js +1 -0
- package/dist/domain/artifactInspection.js +19 -17
- package/dist/domain/artifactInventoryEvidence.js +20 -25
- package/dist/domain/artifactOperationError.js +16 -0
- package/dist/domain/browserObservation.js +12 -4
- package/dist/domain/browserObservationError.js +23 -0
- package/dist/domain/browserScenario.js +1 -1
- package/dist/domain/browserScenarioCapture.js +1 -1
- package/dist/domain/browserScenarioDiff.js +1 -1
- package/dist/domain/browserScenarioNormalization.js +6 -11
- package/dist/domain/browserScenarioValues.js +3 -1
- package/dist/domain/callPath.js +47 -7
- 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/configurationErrors.js +25 -0
- package/dist/domain/dosCom.js +8 -0
- package/dist/domain/electronActiveObservation.js +3 -1
- package/dist/domain/electronStaticAnalysisBrowser.js +13 -23
- package/dist/domain/electronStaticAnalysisNative.js +2 -1
- package/dist/domain/electronStaticAnalysisValues.js +23 -3
- package/dist/domain/evidence.js +3 -11
- package/dist/domain/evidenceErrors.js +30 -0
- package/dist/domain/firmwareAnalysis.js +121 -0
- package/dist/domain/functionComparison.js +4 -2
- package/dist/domain/functionComparisonDimensions.js +6 -4
- package/dist/domain/functionComparisonNormalization.js +8 -1
- package/dist/domain/functionComparisonResults.js +1 -4
- package/dist/domain/hopperErrors.js +78 -0
- package/dist/domain/hopperValues.js +2 -1
- package/dist/domain/interfaceBuilderGraph.js +3 -1
- package/dist/domain/javascriptApplicationChangeGraph.js +2 -2
- package/dist/domain/javascriptApplicationGraph.js +13 -22
- package/dist/domain/javascriptApplicationVersionComparison.js +3 -11
- package/dist/domain/javascriptApplicationVersionItems.js +3 -3
- package/dist/domain/javascriptApplicationVersionKeys.js +1 -1
- package/dist/domain/javascriptAstFingerprint.js +1 -1
- package/dist/domain/javascriptExportShapeComparison.js +1 -2
- package/dist/domain/javascriptExportShapeSelection.js +1 -1
- package/dist/domain/javascriptExportShapeVariants.js +7 -3
- package/dist/domain/javascriptFeatureSeed.js +29 -9
- package/dist/domain/javascriptFeatureTrace.js +9 -13
- package/dist/domain/javascriptFeatureTraversal.js +2 -1
- package/dist/domain/javascriptNativeHandoff.js +2 -1
- package/dist/domain/javascriptRuntimeLoadState.js +2 -2
- package/dist/domain/javascriptRuntimeReconciliationActive.js +3 -10
- package/dist/domain/javascriptRuntimeReconciliationGraph.js +2 -2
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +4 -3
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +8 -14
- package/dist/domain/javascriptRuntimeReconciliationResult.js +4 -4
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +5 -2
- package/dist/domain/javascriptRuntimeStaticCandidates.js +8 -4
- package/dist/domain/javascriptSemanticAnalysis.js +40 -3
- package/dist/domain/javascriptSemanticCallResolution.js +2 -1
- package/dist/domain/javascriptSemanticChildProcesses.js +2 -1
- package/dist/domain/javascriptSemanticDataEffects.js +2 -1
- package/dist/domain/javascriptSemanticFingerprints.js +1 -1
- package/dist/domain/javascriptSemanticGraph.js +23 -28
- package/dist/domain/javascriptSemanticPrimitives.js +9 -2
- package/dist/domain/javascriptSemanticProjection.js +2 -1
- package/dist/domain/javascriptSemanticPromises.js +2 -1
- package/dist/domain/javascriptSemanticProvenance.js +1 -1
- package/dist/domain/javascriptSemanticQuery.js +7 -8
- package/dist/domain/javascriptSemanticQueryAssessment.js +1 -2
- package/dist/domain/javascriptSemanticQueryIdentity.js +1 -2
- package/dist/domain/javascriptSemanticReturns.js +2 -1
- package/dist/domain/javascriptSemanticValues.js +50 -16
- package/dist/domain/javascriptSourceParser.js +4 -2
- package/dist/domain/javascriptStaticAnalysis.js +1 -1
- package/dist/domain/javascriptStaticAnalysisBundler.js +2 -1
- package/dist/domain/javascriptStaticAnalysisCalls.js +14 -6
- package/dist/domain/javascriptStaticAnalysisHelpers.js +31 -4
- package/dist/domain/jsonShape.js +6 -2
- package/dist/domain/managedMemberComparison.js +1 -0
- package/dist/domain/managedMemberComparisonItems.js +2 -0
- package/dist/domain/managedNativeVerificationMatch.js +5 -3
- package/dist/domain/nativeDataType.js +2 -0
- package/dist/domain/nativeFunctionAnnotations.js +43 -0
- package/dist/domain/nativeLoadImage.js +95 -0
- package/dist/domain/nativeMetadataRecovery.js +55 -0
- package/dist/domain/processCapture.js +0 -1
- package/dist/domain/processEvidenceProvider.js +11 -0
- package/dist/domain/processTraceComparison.js +1 -1
- package/dist/domain/providerAdapterError.js +17 -0
- package/dist/domain/providerCleanupError.js +1 -1
- package/dist/domain/providerSelectionError.js +44 -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 +4 -7
- package/dist/domain/safeJson.js +13 -0
- package/dist/domain/sourceToBundleComparison.js +5 -7
- package/dist/domain/sourceToBundleSignals.js +6 -6
- package/dist/domain/staticRuntimeCorrelation.js +9 -7
- package/dist/domain/unknownRegistryError.js +10 -0
- package/dist/domain/webBundleAnalyzerAst.js +22 -5
- package/dist/domain/webBundleAnalyzerInspection.js +20 -14
- package/dist/dotnet/ManagedMemberRows.js +1 -1
- package/dist/dotnet/ManagedMetadataHeaps.js +3 -2
- package/dist/dotnet/ManagedMetadataInventoryRows.js +4 -2
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -1
- package/dist/dotnet/ManagedStaticProvider.js +3 -1
- package/dist/firmware/FirmwareCommand.js +163 -0
- package/dist/firmware/FirmwareFiles.js +190 -0
- package/dist/firmware/FirmwareProvider.js +258 -0
- package/dist/firmware/FirmwarePublication.js +84 -0
- package/dist/firmware/FirmwareRelease.js +32 -0
- package/dist/firmware/FirmwareReports.js +223 -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 +10 -4
- package/dist/ghidra/GhidraInstallation.js +10 -4
- package/dist/ghidra/GhidraInventoryValues.js +39 -2
- package/dist/ghidra/GhidraLauncher.js +91 -26
- package/dist/ghidra/GhidraLoadImageValues.js +199 -0
- package/dist/ghidra/GhidraProvider.js +129 -13
- package/dist/ghidra/GhidraProviderCapabilities.js +52 -15
- package/dist/ghidra/GhidraRequestQueue.js +2 -2
- 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 +84 -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 -4
- package/dist/hopper/HopperRequestQueue.js +7 -3
- 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 +6 -2
- 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 +60 -0
- package/dist/ida/IdaSessionClient.js +306 -0
- package/dist/ida/IdaWorkspace.js +54 -0
- package/dist/main/shutdown.js +21 -1
- package/dist/main/startup.js +1 -1
- package/dist/main/transport.js +8 -4
- package/dist/main.js +5 -2
- package/dist/native/AppleDispatchMetadata.js +31 -10
- package/dist/native/NativeMacOSProvider.js +87 -15
- package/dist/native/NativeMachoInspection.js +42 -12
- package/dist/native/NativeUiHelperRuntime.js +7 -1
- package/dist/native/NativeUiObservation.js +6 -2
- package/dist/native/parsers/demangle.js +1 -1
- package/dist/native/parsers/dyldInfo.js +3 -3
- package/dist/native/parsers/otool.js +4 -1
- package/dist/native/parsers/plist.js +11 -3
- 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 +24 -7
- package/dist/process/ProviderRunLineage.js +1 -1
- package/dist/process/WindowsAuthority.js +20 -1
- package/dist/reference/ReferenceSourceReaderEntries.js +5 -1
- package/dist/reference/ReferenceSourceReaderFile.js +1 -0
- package/dist/server/createServer.js +25 -2
- 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 +5 -1
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +7 -2
- package/dist/server/registerApplicationTools/compareVersions.js +5 -1
- package/dist/server/registerApplicationTools/traceFeature.js +7 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +7 -2
- 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/registerManagedTools.js +1 -1
- package/dist/server/registerManagedWorkflowTools/evidence.js +1 -1
- package/dist/server/registerOfficialTools.js +4 -1
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerSessionTools.js +3 -1
- package/dist/server/runDerivedOperation.js +1 -1
- package/dist/server/sessionAvailabilityPolicy.js +3 -0
- 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 +168 -0
- package/dist/windows/WindowsPrivateRuntime.js +137 -0
- package/install.sh +4 -6
- package/native/windows/README.md +102 -0
- package/native/windows/build/manifest.json +9 -0
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +38 -24
- package/scripts/rea.mjs +1 -1
- 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 +52 -4
- package/dist/browser/CdpCanonicalJsonDigest.js +0 -9
- package/dist/domain/errors.js +0 -324
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, AnalysisInputError, AnalysisTimeoutError, ArtifactOperationError, BinaryTargetError, BrowserObservationError, EvidenceFileError, EvidenceReferenceError, HopperCancelledError, HopperProcessError, HopperRemoteError, HopperTimeoutError, ProviderAdapterError, ProviderSelectionError, UnknownRegistryError, } from "./errors.js";
|
|
2
1
|
import { analysisErrorCategory, analysisErrorRemediationAction, analysisErrorUserMessage, assertKnownAnalysisErrorTag, } from "./analysisErrorPresentation.js";
|
|
2
|
+
import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, AnalysisInputError, AnalysisOutputError, AnalysisTimeoutError, } from "./analysisErrorCore.js";
|
|
3
|
+
import { ArtifactOperationError } from "./artifactOperationError.js";
|
|
4
|
+
import { BinaryTargetError } from "./configurationErrors.js";
|
|
5
|
+
import { BrowserObservationError } from "./browserObservationError.js";
|
|
6
|
+
import { EvidenceFileError, EvidenceReferenceError } from "./evidenceErrors.js";
|
|
7
|
+
import { HopperCancelledError, HopperProcessError, HopperRemoteError, HopperTimeoutError, } from "./hopperErrors.js";
|
|
8
|
+
import { ProviderAdapterError } from "./providerAdapterError.js";
|
|
9
|
+
import { ProviderSelectionError } from "./providerSelectionError.js";
|
|
10
|
+
import { UnknownRegistryError } from "./unknownRegistryError.js";
|
|
11
|
+
import {} from "./analysisErrorBase.js";
|
|
3
12
|
/** Project expected failures into exhaustive, secret-safe caller fields. */
|
|
4
13
|
export const projectAnalysisError = (error) => {
|
|
5
14
|
assertKnownAnalysisErrorTag(error._tag);
|
|
@@ -111,6 +120,8 @@ const errorDetails = (error) => requestErrorDetails(error) ??
|
|
|
111
120
|
providerErrorDetails(error) ??
|
|
112
121
|
lifecycleErrorDetails(error);
|
|
113
122
|
const requestErrorDetails = (error) => {
|
|
123
|
+
if (error instanceof AnalysisOutputError)
|
|
124
|
+
return { operation: error.operation, reason: error.reason };
|
|
114
125
|
if (error instanceof AnalysisInputError && error.issues.length > 0)
|
|
115
126
|
return {
|
|
116
127
|
operation: error.operation,
|
|
@@ -154,7 +165,11 @@ const artifactStateErrorDetails = (error) => {
|
|
|
154
165
|
};
|
|
155
166
|
const providerErrorDetails = (error) => {
|
|
156
167
|
if (error instanceof AnalysisCapabilityUnavailableError)
|
|
157
|
-
return {
|
|
168
|
+
return {
|
|
169
|
+
provider_id: error.providerId,
|
|
170
|
+
operation: error.operation,
|
|
171
|
+
reason: error.reason,
|
|
172
|
+
};
|
|
158
173
|
if (error instanceof ProviderSelectionError)
|
|
159
174
|
return {
|
|
160
175
|
operation: error.operation,
|
|
@@ -261,7 +276,13 @@ const lifecycleErrorDetails = (error) => {
|
|
|
261
276
|
error.userCategory === "cancelled")
|
|
262
277
|
return { operation: "process_capture", cleanup: "complete" };
|
|
263
278
|
if (error instanceof BinaryTargetError)
|
|
264
|
-
return {
|
|
279
|
+
return {
|
|
280
|
+
path: error.path,
|
|
281
|
+
reason: error.reason,
|
|
282
|
+
...(error.constraint === undefined
|
|
283
|
+
? {}
|
|
284
|
+
: { constraint: error.constraint }),
|
|
285
|
+
};
|
|
265
286
|
return undefined;
|
|
266
287
|
};
|
|
267
288
|
const RETRYABLE_CODES = new Set([
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const target = {
|
|
3
|
+
path: z
|
|
4
|
+
.string()
|
|
5
|
+
.min(1)
|
|
6
|
+
.describe("Local APK path; the target is never executed"),
|
|
7
|
+
};
|
|
8
|
+
const classTarget = {
|
|
9
|
+
...target,
|
|
10
|
+
class_name: z.string().min(1).describe("Exact fully qualified class name"),
|
|
11
|
+
};
|
|
12
|
+
/** Caller intent for static Android inspection, independent of its engine. */
|
|
13
|
+
export const androidInputSchemas = {
|
|
14
|
+
inspect_android_package: z.strictObject(target),
|
|
15
|
+
search_android_classes: z.strictObject({
|
|
16
|
+
...target,
|
|
17
|
+
query: z
|
|
18
|
+
.string()
|
|
19
|
+
.describe("Case-sensitive class-name substring; empty lists all classes"),
|
|
20
|
+
}),
|
|
21
|
+
inspect_android_class: z.strictObject(classTarget),
|
|
22
|
+
inspect_android_method: z.strictObject({
|
|
23
|
+
...classTarget,
|
|
24
|
+
method_name: z.string().min(1),
|
|
25
|
+
overload_index: z
|
|
26
|
+
.number()
|
|
27
|
+
.int()
|
|
28
|
+
.nonnegative()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Explicit index among same-name methods; required when ambiguous"),
|
|
31
|
+
}),
|
|
32
|
+
trace_android_references: z.strictObject({
|
|
33
|
+
...classTarget,
|
|
34
|
+
method_name: z
|
|
35
|
+
.string()
|
|
36
|
+
.min(1)
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("Omit for class references; ambiguous overloaded methods are unsupported"),
|
|
39
|
+
}),
|
|
40
|
+
};
|
|
41
|
+
/** Validate operation and input together so their types remain correlated. */
|
|
42
|
+
export const androidRequestSchema = z.discriminatedUnion("operation", [
|
|
43
|
+
z.strictObject({
|
|
44
|
+
operation: z.literal("inspect_android_package"),
|
|
45
|
+
input: androidInputSchemas.inspect_android_package,
|
|
46
|
+
}),
|
|
47
|
+
z.strictObject({
|
|
48
|
+
operation: z.literal("search_android_classes"),
|
|
49
|
+
input: androidInputSchemas.search_android_classes,
|
|
50
|
+
}),
|
|
51
|
+
z.strictObject({
|
|
52
|
+
operation: z.literal("inspect_android_class"),
|
|
53
|
+
input: androidInputSchemas.inspect_android_class,
|
|
54
|
+
}),
|
|
55
|
+
z.strictObject({
|
|
56
|
+
operation: z.literal("inspect_android_method"),
|
|
57
|
+
input: androidInputSchemas.inspect_android_method,
|
|
58
|
+
}),
|
|
59
|
+
z.strictObject({
|
|
60
|
+
operation: z.literal("trace_android_references"),
|
|
61
|
+
input: androidInputSchemas.trace_android_references,
|
|
62
|
+
}),
|
|
63
|
+
]);
|
|
64
|
+
const textCoverage = z.strictObject({
|
|
65
|
+
status: z.enum(["complete", "partial"]),
|
|
66
|
+
text: z.string(),
|
|
67
|
+
reported_total_bytes: z.number().int().nonnegative().nullable(),
|
|
68
|
+
});
|
|
69
|
+
const method = z.strictObject({
|
|
70
|
+
name: z.string(),
|
|
71
|
+
reported_signature: z.string(),
|
|
72
|
+
overload_index: z.number().int().nonnegative(),
|
|
73
|
+
is_constructor: z.boolean(),
|
|
74
|
+
dex_descriptor: z.null(),
|
|
75
|
+
});
|
|
76
|
+
const engine = z.strictObject({
|
|
77
|
+
name: z.string().min(1),
|
|
78
|
+
version: z.string().nullable(),
|
|
79
|
+
artifact_sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
80
|
+
source_revision: z.string().nullable(),
|
|
81
|
+
worker_count: z.number().int().positive(),
|
|
82
|
+
heap_limit_mib: z.number().int().positive().nullable(),
|
|
83
|
+
});
|
|
84
|
+
const common = { engine };
|
|
85
|
+
/** Portable observations with explicit decompiler and identity limitations. */
|
|
86
|
+
export const androidResultSchemas = {
|
|
87
|
+
inspect_android_package: z.strictObject({
|
|
88
|
+
...common,
|
|
89
|
+
package_name: z.string().nullable(),
|
|
90
|
+
version_name: z.string().nullable(),
|
|
91
|
+
version_code: z.string().nullable(),
|
|
92
|
+
min_sdk: z.string().nullable(),
|
|
93
|
+
target_sdk: z.string().nullable(),
|
|
94
|
+
permissions: z.array(z.string()),
|
|
95
|
+
manifest: textCoverage,
|
|
96
|
+
class_count: z.number().int().nonnegative(),
|
|
97
|
+
resource_count: z.number().int().nonnegative(),
|
|
98
|
+
signature_verification: z.literal("not_performed"),
|
|
99
|
+
}),
|
|
100
|
+
search_android_classes: z.strictObject({
|
|
101
|
+
...common,
|
|
102
|
+
query: z.string(),
|
|
103
|
+
total_classes: z.number().int().nonnegative(),
|
|
104
|
+
matches: z.array(z.string()),
|
|
105
|
+
coverage: z.literal("complete"),
|
|
106
|
+
}),
|
|
107
|
+
inspect_android_class: z.strictObject({
|
|
108
|
+
...common,
|
|
109
|
+
class_name: z.string(),
|
|
110
|
+
methods: z.array(method),
|
|
111
|
+
fields: z.array(z.strictObject({ name: z.string(), reported_type: z.string() })),
|
|
112
|
+
inner_classes: z.array(z.string()),
|
|
113
|
+
}),
|
|
114
|
+
inspect_android_method: z.strictObject({
|
|
115
|
+
...common,
|
|
116
|
+
class_name: z.string(),
|
|
117
|
+
method: method,
|
|
118
|
+
overload_count: z.number().int().positive(),
|
|
119
|
+
representation: z.enum(["java", "smali"]),
|
|
120
|
+
body_status: z.enum(["available", "not_available"]),
|
|
121
|
+
fell_back: z.boolean(),
|
|
122
|
+
markers: z.array(z.string()),
|
|
123
|
+
source: textCoverage,
|
|
124
|
+
}),
|
|
125
|
+
trace_android_references: z.strictObject({
|
|
126
|
+
...common,
|
|
127
|
+
class_name: z.string(),
|
|
128
|
+
method_name: z.string().nullable(),
|
|
129
|
+
total: z.number().int().nonnegative(),
|
|
130
|
+
references: z.array(z.strictObject({
|
|
131
|
+
kind: z.string(),
|
|
132
|
+
name: z.string(),
|
|
133
|
+
reported_full_name: z.string(),
|
|
134
|
+
containing_class: z.string(),
|
|
135
|
+
top_class: z.string(),
|
|
136
|
+
source_line: z.null(),
|
|
137
|
+
dex_offset: z.null(),
|
|
138
|
+
})),
|
|
139
|
+
coverage: z.literal("complete"),
|
|
140
|
+
}),
|
|
141
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { jsonValueSchema } from "./jsonValue.js";
|
|
3
|
-
import { AnalysisOutputError } from "./
|
|
3
|
+
import { AnalysisOutputError } from "./analysisErrorCore.js";
|
|
4
4
|
/** Caller-controlled page bounds for compiled Apple asset metadata. */
|
|
5
5
|
export const appleAssetCatalogInputSchema = z.strictObject({
|
|
6
6
|
offset: z.number().int().min(0).default(0),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import canonicalize from "canonicalize";
|
|
3
1
|
import { z } from "zod";
|
|
4
2
|
import { artifactInventoryResultSchema, } from "./artifactGraph.js";
|
|
3
|
+
import { canonicalDigest } from "./comparisonSemantics.js";
|
|
4
|
+
import { uniqueSorted } from "./canonicalOrdering.js";
|
|
5
5
|
import { evidenceSchema, parseEvidence } from "./evidence.js";
|
|
6
6
|
import { jsonValueSchema } from "./jsonValue.js";
|
|
7
7
|
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
@@ -137,10 +137,10 @@ export const createArtifactInspection = (inventoryInput) => {
|
|
|
137
137
|
},
|
|
138
138
|
substeps: [
|
|
139
139
|
{
|
|
140
|
-
substep_id: `ais_${
|
|
140
|
+
substep_id: `ais_${canonicalDigest({
|
|
141
141
|
operation: "inventory_artifact",
|
|
142
142
|
evidence_id: inventoryEvidence.evidence_id,
|
|
143
|
-
})}`,
|
|
143
|
+
}, "Artifact inspection")}`,
|
|
144
144
|
operation: "inventory_artifact",
|
|
145
145
|
status: "completed",
|
|
146
146
|
evidence_id: inventoryEvidence.evidence_id,
|
|
@@ -175,7 +175,7 @@ export const createArtifactInspection = (inventoryInput) => {
|
|
|
175
175
|
};
|
|
176
176
|
return artifactInspectionResultSchema.parse({
|
|
177
177
|
...semantic,
|
|
178
|
-
inspection_id: `ai_${
|
|
178
|
+
inspection_id: `ai_${canonicalDigest(semantic, "Artifact inspection")}`,
|
|
179
179
|
});
|
|
180
180
|
};
|
|
181
181
|
const parseInventoryEvidence = (input) => {
|
|
@@ -197,7 +197,10 @@ const observation = (kind, subject, value, evidenceId) => {
|
|
|
197
197
|
value: jsonValueSchema.parse(value),
|
|
198
198
|
evidence_id: evidenceId,
|
|
199
199
|
};
|
|
200
|
-
return {
|
|
200
|
+
return {
|
|
201
|
+
observation_id: `aio_${canonicalDigest(semantic, "Artifact inspection")}`,
|
|
202
|
+
...semantic,
|
|
203
|
+
};
|
|
201
204
|
};
|
|
202
205
|
const allRelationships = (inventory, evidenceId) => inventory.edges.map((edge) => {
|
|
203
206
|
const semantic = {
|
|
@@ -209,7 +212,7 @@ const allRelationships = (inventory, evidenceId) => inventory.edges.map((edge) =
|
|
|
209
212
|
evidence_id: evidenceId,
|
|
210
213
|
};
|
|
211
214
|
return {
|
|
212
|
-
relationship_id: `air_${
|
|
215
|
+
relationship_id: `air_${canonicalDigest(semantic, "Artifact inspection")}`,
|
|
213
216
|
...semantic,
|
|
214
217
|
};
|
|
215
218
|
});
|
|
@@ -230,7 +233,10 @@ const allHypotheses = (inventory, evidenceId) => {
|
|
|
230
233
|
basis_evidence_ids: [evidenceId],
|
|
231
234
|
limitation: "Format classification proposes a bounded follow-up; it is not semantic proof.",
|
|
232
235
|
};
|
|
233
|
-
return {
|
|
236
|
+
return {
|
|
237
|
+
hypothesis_id: `aih_${canonicalDigest(semantic, "Artifact inspection")}`,
|
|
238
|
+
...semantic,
|
|
239
|
+
};
|
|
234
240
|
});
|
|
235
241
|
};
|
|
236
242
|
const contradictions = (inventory, evidenceId) => inventory.integrity_contradictions.map((value) => {
|
|
@@ -242,7 +248,7 @@ const contradictions = (inventory, evidenceId) => inventory.integrity_contradict
|
|
|
242
248
|
evidence_id: evidenceId,
|
|
243
249
|
};
|
|
244
250
|
return {
|
|
245
|
-
contradiction_id: `aic_${
|
|
251
|
+
contradiction_id: `aic_${canonicalDigest(semantic, "Artifact inspection")}`,
|
|
246
252
|
...semantic,
|
|
247
253
|
};
|
|
248
254
|
});
|
|
@@ -301,17 +307,13 @@ const branch = (reason, detail, nextProbe, evidenceId) => {
|
|
|
301
307
|
next_probe: nextProbe,
|
|
302
308
|
evidence_id: evidenceId,
|
|
303
309
|
};
|
|
304
|
-
return {
|
|
310
|
+
return {
|
|
311
|
+
branch_id: `aib_${canonicalDigest(semantic, "Artifact inspection")}`,
|
|
312
|
+
...semantic,
|
|
313
|
+
};
|
|
305
314
|
};
|
|
306
315
|
const inspectionCoverage = (_inventory, omissions) => {
|
|
307
316
|
if (Object.values(omissions).some((count) => count > 0))
|
|
308
317
|
return "truncated";
|
|
309
318
|
return "complete-within-substeps";
|
|
310
319
|
};
|
|
311
|
-
const digestCanonical = (value) => {
|
|
312
|
-
const encoded = canonicalize(value);
|
|
313
|
-
if (encoded === undefined)
|
|
314
|
-
throw new TypeError("Artifact inspection could not canonicalize");
|
|
315
|
-
return createHash("sha256").update(encoded).digest("hex");
|
|
316
|
-
};
|
|
317
|
-
const uniqueSorted = (values) => [...new Set(values)].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import canonicalize from "canonicalize";
|
|
3
1
|
import { artifactInventoryResultSchema, } from "./artifactGraph.js";
|
|
2
|
+
import { canonicalDigest, canonicalJson } from "./comparisonSemantics.js";
|
|
4
3
|
import { parseEvidence } from "./evidence.js";
|
|
5
4
|
import { artifactInspectionResultSchema } from "./artifactInspection.js";
|
|
6
5
|
/** Parse, merge, and verify inventory Evidence pages. */
|
|
@@ -29,7 +28,8 @@ const validateInventoryPage = (inventory) => {
|
|
|
29
28
|
assertUnique(inventory.occurrences.map(({ logical_path: path }) => path), "logical path");
|
|
30
29
|
assertUnique(inventory.edges.map(({ edge_id: id }) => id), "edge ID");
|
|
31
30
|
for (const node of inventory.nodes)
|
|
32
|
-
if (node.artifact_id !==
|
|
31
|
+
if (node.artifact_id !==
|
|
32
|
+
`art_${canonicalDigest({ sha256: node.sha256 }, "Artifact inventory")}`)
|
|
33
33
|
throw new TypeError("Artifact node ID is not content-addressed");
|
|
34
34
|
};
|
|
35
35
|
const assembleInventorySet = (pages) => {
|
|
@@ -38,16 +38,17 @@ const assembleInventorySet = (pages) => {
|
|
|
38
38
|
const first = pages[0];
|
|
39
39
|
if (first === undefined)
|
|
40
40
|
throw new TypeError("Artifact inventory requires Evidence pages");
|
|
41
|
-
const manifestJson = canonicalJson(first.inventory.manifest);
|
|
41
|
+
const manifestJson = canonicalJson(first.inventory.manifest, "Artifact inventory");
|
|
42
42
|
const nodes = new Map();
|
|
43
43
|
const occurrences = new Map();
|
|
44
44
|
const paths = new Map();
|
|
45
45
|
const edges = new Map();
|
|
46
46
|
for (const page of pages) {
|
|
47
|
-
if (canonicalJson(page.inventory.manifest) !==
|
|
47
|
+
if (canonicalJson(page.inventory.manifest, "Artifact inventory") !==
|
|
48
|
+
manifestJson)
|
|
48
49
|
throw new TypeError("Artifact inventory pages do not share one manifest");
|
|
49
|
-
if (canonicalJson(page.inventory.integrity_contradictions) !==
|
|
50
|
-
canonicalJson(first.inventory.integrity_contradictions))
|
|
50
|
+
if (canonicalJson(page.inventory.integrity_contradictions, "Artifact inventory") !==
|
|
51
|
+
canonicalJson(first.inventory.integrity_contradictions, "Artifact inventory"))
|
|
51
52
|
throw new TypeError("Artifact inventory pages do not share integrity contradictions");
|
|
52
53
|
for (const node of page.inventory.nodes)
|
|
53
54
|
mergeExact(nodes, node.artifact_id, node, "node");
|
|
@@ -99,27 +100,27 @@ const validateCompleteInventory = (inventory) => {
|
|
|
99
100
|
if (!nodeIds.has(contradiction.parent_artifact_id) ||
|
|
100
101
|
!occurrenceIds.has(contradiction.occurrence_id))
|
|
101
102
|
throw new TypeError("Integrity contradiction references a missing graph member");
|
|
102
|
-
const expectedId = `ic_${
|
|
103
|
+
const expectedId = `ic_${canonicalDigest({
|
|
103
104
|
root_artifact_id: inventory.manifest.root_artifact_id,
|
|
104
105
|
logical_path: contradiction.logical_path,
|
|
105
106
|
declared_sha256: contradiction.declared_sha256,
|
|
106
107
|
observed_sha256: contradiction.observed_sha256,
|
|
107
|
-
})}`;
|
|
108
|
+
}, "Artifact inventory")}`;
|
|
108
109
|
if (contradiction.contradiction_id !== expectedId)
|
|
109
110
|
throw new TypeError("Integrity contradiction ID does not match its identity");
|
|
110
111
|
}
|
|
111
|
-
const graphSha256 =
|
|
112
|
+
const graphSha256 = canonicalDigest({
|
|
112
113
|
nodes: inventory.nodes,
|
|
113
114
|
occurrences: inventory.occurrences,
|
|
114
115
|
edges: inventory.edges,
|
|
115
116
|
integrity_contradictions: inventory.integrityContradictions,
|
|
116
|
-
});
|
|
117
|
+
}, "Artifact inventory");
|
|
117
118
|
if (graphSha256 !== inventory.manifest.graph_sha256)
|
|
118
119
|
throw new TypeError("Artifact graph commitment does not match its members");
|
|
119
|
-
const manifestId = `agm_${
|
|
120
|
+
const manifestId = `agm_${canonicalDigest({
|
|
120
121
|
root_artifact_id: inventory.manifest.root_artifact_id,
|
|
121
122
|
graph_sha256: graphSha256,
|
|
122
|
-
})}`;
|
|
123
|
+
}, "Artifact inventory")}`;
|
|
123
124
|
if (manifestId !== inventory.manifest.manifest_id)
|
|
124
125
|
throw new TypeError("Artifact manifest ID does not match its commitment");
|
|
125
126
|
};
|
|
@@ -130,12 +131,12 @@ const validateOccurrence = (occurrence, inventory, nodeIds, occurrenceIds) => {
|
|
|
130
131
|
!occurrenceIds.has(occurrence.parent_occurrence_id))
|
|
131
132
|
throw new TypeError("Artifact occurrence references a missing parent");
|
|
132
133
|
const expectedId = occurrence.logical_path === "."
|
|
133
|
-
? `occ_${
|
|
134
|
-
: `occ_${
|
|
134
|
+
? `occ_${canonicalDigest({ root: inventory.manifest.root_artifact_id }, "Artifact inventory")}`
|
|
135
|
+
: `occ_${canonicalDigest({
|
|
135
136
|
root_artifact_id: inventory.manifest.root_artifact_id,
|
|
136
137
|
logical_path: occurrence.logical_path,
|
|
137
138
|
entry_kind: occurrence.entry_kind,
|
|
138
|
-
})}`;
|
|
139
|
+
}, "Artifact inventory")}`;
|
|
139
140
|
if (occurrence.occurrence_id !== expectedId)
|
|
140
141
|
throw new TypeError("Artifact occurrence ID does not match its identity");
|
|
141
142
|
};
|
|
@@ -151,13 +152,14 @@ const validateEdge = (edge, nodeIds, occurrenceIds) => {
|
|
|
151
152
|
occurrence_id: edge.occurrence_id,
|
|
152
153
|
logical_path: edge.logical_path,
|
|
153
154
|
};
|
|
154
|
-
if (edge.edge_id !== `edge_${
|
|
155
|
+
if (edge.edge_id !== `edge_${canonicalDigest(semantic, "Artifact inventory")}`)
|
|
155
156
|
throw new TypeError("Artifact edge ID does not match its identity");
|
|
156
157
|
};
|
|
157
158
|
const mergeExact = (output, key, value, label) => {
|
|
158
159
|
const previous = output.get(key);
|
|
159
160
|
if (previous !== undefined &&
|
|
160
|
-
canonicalJson(previous) !==
|
|
161
|
+
canonicalJson(previous, "Artifact inventory") !==
|
|
162
|
+
canonicalJson(value, "Artifact inventory"))
|
|
161
163
|
throw new TypeError(`Artifact inventory has conflicting ${label} pages`);
|
|
162
164
|
output.set(key, value);
|
|
163
165
|
};
|
|
@@ -165,10 +167,3 @@ const assertUnique = (values, label) => {
|
|
|
165
167
|
if (new Set(values).size !== values.length)
|
|
166
168
|
throw new TypeError(`Artifact inventory contains a duplicate ${label}`);
|
|
167
169
|
};
|
|
168
|
-
const digestCanonical = (value) => createHash("sha256").update(canonicalJson(value)).digest("hex");
|
|
169
|
-
const canonicalJson = (value) => {
|
|
170
|
-
const encoded = canonicalize(value);
|
|
171
|
-
if (encoded === undefined)
|
|
172
|
-
throw new TypeError("Artifact inventory could not canonicalize graph data");
|
|
173
|
-
return encoded;
|
|
174
|
-
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AnalysisError } from "./analysisErrorBase.js";
|
|
2
|
+
/** Artifact inventory or extraction failed a typed safety boundary. */
|
|
3
|
+
export class ArtifactOperationError extends AnalysisError {
|
|
4
|
+
operation;
|
|
5
|
+
reason;
|
|
6
|
+
artifactDetails;
|
|
7
|
+
_tag = "ArtifactOperationError";
|
|
8
|
+
constructor(operation, reason, artifactDetails) {
|
|
9
|
+
super(artifactDetails === undefined
|
|
10
|
+
? `Artifact ${operation} failed: ${reason}`
|
|
11
|
+
: `Artifact ${operation} failed: ${reason} at ${artifactDetails.logicalPath} (declared_sha256=${artifactDetails.declaredSha256 ?? "unavailable"}, calculated_sha256=${artifactDetails.calculatedSha256 ?? "unavailable"}, unpacked=${String(artifactDetails.unpacked)})`);
|
|
12
|
+
this.operation = operation;
|
|
13
|
+
this.reason = reason;
|
|
14
|
+
this.artifactDetails = artifactDetails;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -5,7 +5,9 @@ const parseExactOrigin = (value) => {
|
|
|
5
5
|
try {
|
|
6
6
|
url = new URL(value);
|
|
7
7
|
}
|
|
8
|
-
catch {
|
|
8
|
+
catch (cause) {
|
|
9
|
+
// Invalid input is represented by the undefined return.
|
|
10
|
+
void cause;
|
|
9
11
|
return undefined;
|
|
10
12
|
}
|
|
11
13
|
if ((url.protocol !== "http:" && url.protocol !== "https:") ||
|
|
@@ -44,7 +46,9 @@ export const browserEndpointSchema = z
|
|
|
44
46
|
try {
|
|
45
47
|
url = new URL(value);
|
|
46
48
|
}
|
|
47
|
-
catch {
|
|
49
|
+
catch (cause) {
|
|
50
|
+
// Invalid input is reported through the zod issue.
|
|
51
|
+
void cause;
|
|
48
52
|
context.addIssue({ code: "custom", message: "Invalid CDP endpoint URL" });
|
|
49
53
|
return z.NEVER;
|
|
50
54
|
}
|
|
@@ -122,7 +126,9 @@ export const sanitizeBrowserUrl = (value) => {
|
|
|
122
126
|
try {
|
|
123
127
|
parsed = new URL(value);
|
|
124
128
|
}
|
|
125
|
-
catch {
|
|
129
|
+
catch (cause) {
|
|
130
|
+
// Unparseable input is preserved verbatim in the sanitized result.
|
|
131
|
+
void cause;
|
|
126
132
|
return {
|
|
127
133
|
url: value,
|
|
128
134
|
origin: null,
|
|
@@ -165,7 +171,9 @@ const removeUrlUserInfo = (value, parsed) => {
|
|
|
165
171
|
? candidate
|
|
166
172
|
: credentialFreeHref(parsed);
|
|
167
173
|
}
|
|
168
|
-
catch {
|
|
174
|
+
catch (cause) {
|
|
175
|
+
// Fallback to the already-sanitized href when the candidate is invalid.
|
|
176
|
+
void cause;
|
|
169
177
|
return credentialFreeHref(parsed);
|
|
170
178
|
}
|
|
171
179
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AnalysisError } from "./analysisErrorBase.js";
|
|
2
|
+
import { AnalysisCancelledError } from "./analysisErrorCore.js";
|
|
3
|
+
/** A bounded passive browser observation failed at its CDP boundary. */
|
|
4
|
+
export class BrowserObservationError extends AnalysisError {
|
|
5
|
+
operation;
|
|
6
|
+
reason;
|
|
7
|
+
_tag = "BrowserObservationError";
|
|
8
|
+
cleanupIncomplete;
|
|
9
|
+
cleanupResources;
|
|
10
|
+
userCategory;
|
|
11
|
+
constructor(operation, reason, options) {
|
|
12
|
+
super(`Browser observation ${operation} failed: ${reason}`, options);
|
|
13
|
+
this.operation = operation;
|
|
14
|
+
this.reason = reason;
|
|
15
|
+
this.cleanupIncomplete = reason === "cleanup_failed";
|
|
16
|
+
this.cleanupResources =
|
|
17
|
+
reason === "cleanup_failed" ? ["browser_transport"] : [];
|
|
18
|
+
this.userCategory =
|
|
19
|
+
reason === "cancelled" || options?.cause instanceof AnalysisCancelledError
|
|
20
|
+
? "cancelled"
|
|
21
|
+
: undefined;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { browserScenarioActionSchema, browserScenarioBrowserSchema, browserScenarioCaptureSchema, browserScenarioEnvironmentSchema, browserScenarioSecretSchema, browserScenarioStorageSchema, browserScenarioUrlSchema, } from "./browserScenarioValues.js";
|
|
3
|
-
export {
|
|
3
|
+
export {} from "./browserScenarioValues.js";
|
|
4
4
|
export const browserScenarioInputSchema = z.strictObject({
|
|
5
5
|
browser: browserScenarioBrowserSchema.describe("Required launch/connect selection. Launch uses the selected executable and an owned temporary profile; connect uses one loopback CDP endpoint and target."),
|
|
6
6
|
start_url: browserScenarioUrlSchema.describe("Required initial HTTP(S) URL. Query values must be declared separately as public literals or secret references."),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { browserScenarioCompletenessSchema, browserScenarioEventSchema, browserScenarioStepSchema, } from "./browserScenarioCaptureValues.js";
|
|
3
|
-
export { classifyBrowserScenarioCompleteness,
|
|
3
|
+
export { classifyBrowserScenarioCompleteness, browserScenarioEventSchema, browserScenarioStepSchema, browserStepArtifactsSchema, } from "./browserScenarioCaptureValues.js";
|
|
4
4
|
/** Step-indexed browser scenario observation. */
|
|
5
5
|
export const browserScenarioCaptureSchema = z
|
|
6
6
|
.strictObject({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {} from "./browserScenarioCapture.js";
|
|
2
2
|
import { actionState, artifactEvidenceState, captured, eventEvidenceState, eventsFor, screenshotProjection, } from "./browserScenarioDiffEvidence.js";
|
|
3
3
|
import { browserScenarioDiffSchema, } from "./browserScenarioDiffValues.js";
|
|
4
|
-
import { commitBrowserScenarioNormalization,
|
|
4
|
+
import { commitBrowserScenarioNormalization, digestNormalizedScenarioValue, } from "./browserScenarioNormalization.js";
|
|
5
5
|
export { browserScenarioDiffSchema, compareBrowserScenariosInputSchema, } from "./browserScenarioDiffValues.js";
|
|
6
6
|
/** Compare scenario steps by stable step ID and apply only committed literal rules. */
|
|
7
7
|
export const compareBrowserScenarios = (input) => {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import canonicalize from "canonicalize";
|
|
1
|
+
import { canonicalDigest } from "./comparisonSemantics.js";
|
|
3
2
|
const BUILT_IN_RULES = [
|
|
4
3
|
"ignore_step_elapsed_ms",
|
|
5
4
|
"ignore_event_sequence",
|
|
@@ -16,17 +15,13 @@ export const commitBrowserScenarioNormalization = (input) => {
|
|
|
16
15
|
}))
|
|
17
16
|
.sort((left, right) => left.rule_id < right.rule_id ? -1 : left.rule_id > right.rule_id ? 1 : 0);
|
|
18
17
|
const commitment = { built_in_rules: [...BUILT_IN_RULES], rules };
|
|
19
|
-
return {
|
|
18
|
+
return {
|
|
19
|
+
...commitment,
|
|
20
|
+
sha256: canonicalDigest(commitment, "Browser scenario"),
|
|
21
|
+
};
|
|
20
22
|
};
|
|
21
23
|
/** Digest one artifact after applying committed exact-literal rules. */
|
|
22
|
-
export const digestNormalizedScenarioValue = (value, artifact, rules) =>
|
|
23
|
-
/** Compute a canonical SHA-256 commitment for JSON-compatible domain data. */
|
|
24
|
-
export const digestCanonicalJson = (value) => {
|
|
25
|
-
const encoded = canonicalize(value);
|
|
26
|
-
if (encoded === undefined)
|
|
27
|
-
throw new TypeError("Expected canonical JSON");
|
|
28
|
-
return createHash("sha256").update(encoded).digest("hex");
|
|
29
|
-
};
|
|
24
|
+
export const digestNormalizedScenarioValue = (value, artifact, rules) => canonicalDigest(normalize(value, artifact, rules), "Browser scenario");
|
|
30
25
|
const normalize = (value, artifact, rules) => {
|
|
31
26
|
if (artifact === "screenshot")
|
|
32
27
|
return value;
|
|
@@ -12,7 +12,9 @@ const browserScenarioBaseUrlSchema = z
|
|
|
12
12
|
try {
|
|
13
13
|
url = new URL(value);
|
|
14
14
|
}
|
|
15
|
-
catch {
|
|
15
|
+
catch (cause) {
|
|
16
|
+
// Invalid input is reported through the zod issue.
|
|
17
|
+
void cause;
|
|
16
18
|
context.addIssue({ code: "custom", message: "Invalid browser URL" });
|
|
17
19
|
return z.NEVER;
|
|
18
20
|
}
|