rea-agents 6.2.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 +24 -23
- package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
- package/bridge/ghidra/ReaGhidraBridge.java +597 -209
- package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
- package/bridge/hopper_bridge.py +2 -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 +59 -21
- package/dist/android/JadxSession.js +51 -9
- 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 +85 -19
- package/dist/application/BrowserScenarioEvidence.js +2 -2
- package/dist/application/CapabilityInventory.js +11 -1
- package/dist/application/ClientConfigurationDocument.js +98 -0
- package/dist/application/ClientConfigurationFiles.js +91 -0
- package/dist/application/ClientRegistrationEnvironment.js +35 -0
- package/dist/application/ClientRegistrationStatus.js +75 -27
- package/dist/application/DirectAnalysis.js +14 -8
- package/dist/application/DirectAnalysisCleanup.js +1 -2
- package/dist/application/DirectAnalysisStatus.js +3 -6
- package/dist/application/Doctor.js +27 -34
- package/dist/application/DoctorDiagnostics.js +1 -1
- package/dist/application/EvidenceBundleCommands.js +6 -12
- package/dist/application/EvidenceBundleFiles.js +1 -1
- 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 +10 -4
- package/dist/application/JsonFiles.js +16 -15
- package/dist/application/JsonInputFile.js +252 -0
- package/dist/application/LinuxHopper.js +6 -13
- 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 +16 -3
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -1
- 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 +103 -0
- package/dist/application/Setup.js +69 -10
- package/dist/application/SetupClientConfiguration.js +134 -23
- package/dist/application/SetupHost.js +102 -22
- package/dist/application/SetupPlan.js +18 -17
- package/dist/application/SetupSkill.js +81 -13
- package/dist/application/SupportedClients.js +305 -37
- package/dist/application/Uninstall.js +172 -8
- package/dist/application/UpdateMaintenance.js +23 -23
- package/dist/application/Utf8JsonInput.js +71 -0
- package/dist/application/WebScriptExportService.js +130 -57
- 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/android/AndroidAnalysisService.js +1 -1
- 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/AnalysisSnapshotCache.js +5 -4
- package/dist/application/binary/BinarySession.js +18 -1
- package/dist/application/binary/BinarySessionOpen.js +9 -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/ElectronActiveEvidence.js +2 -2
- package/dist/application/javascript/ElectronBoundaryAnalysis.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphContext.js +3 -2
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +20 -3
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +3 -3
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +1 -0
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +107 -46
- package/dist/application/javascript/JavaScriptApplicationService.js +23 -11
- package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +5 -6
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +59 -45
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +171 -36
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +14 -16
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +74 -36
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +4 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +11 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +53 -42
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +92 -10
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +293 -238
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +120 -28
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +4 -0
- package/dist/application/javascript/JavaScriptJsonModules.js +2 -2
- package/dist/application/javascript/JavaScriptModuleRelationships.js +10 -20
- package/dist/application/javascript/JavaScriptRecoveryService.js +3 -0
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +11 -27
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +11 -5
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +206 -66
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +18 -23
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +5 -2
- package/dist/application/javascript/JavaScriptSemanticGraphEvidence.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFingerprintProjection.js +2 -2
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +7 -5
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +6 -4
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +4 -4
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +29 -15
- package/dist/application/javascript/JavaScriptSemanticTraceService.js +15 -10
- 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/NativeCallRoutes.js +2 -4
- 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 +34 -31
- package/dist/artifacts/ArtifactProviderMetadata.js +1 -4
- package/dist/artifacts/ArtifactReader.js +23 -0
- package/dist/artifacts/ArtifactResourceScope.js +100 -0
- package/dist/artifacts/AsarArtifactReader.js +218 -80
- 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 +179 -87
- package/dist/artifacts/NativeDmgOwnership.js +109 -0
- 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 +76 -49
- package/dist/artifacts/apple/MachoLoadCommandReader.js +36 -6
- package/dist/artifacts/extraction/ArtifactExtraction.js +134 -92
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +116 -50
- package/dist/artifacts/inventory/ArtifactInventory.js +5 -4
- package/dist/artifacts/inventory/classify.js +87 -25
- package/dist/artifacts/inventory/hashStableRootArtifact.js +70 -0
- package/dist/artifacts/inventory/reader.js +13 -5
- package/dist/artifacts/inventory/scanCanonical.js +73 -30
- package/dist/artifacts/inventory/scanReader.js +43 -20
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +72 -28
- 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 +9 -3
- 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/CdpCaptureStorageFingerprints.js +3 -3
- package/dist/browser/CdpConnection.js +22 -5
- package/dist/browser/CdpElectronInspection.js +2 -2
- package/dist/browser/CdpElectronProvider.js +4 -3
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpTargetSession.js +30 -34
- package/dist/browser/CdpWebMcpDiscovery.js +48 -23
- package/dist/browser/ElectronFileScope.js +99 -9
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +63 -7
- package/dist/browser/PlaywrightElectronActiveProvider.js +11 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +5 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +208 -43
- package/dist/browser/PlaywrightScenarioSession.js +130 -65
- package/dist/browser/PlaywrightScenarioStorage.js +507 -0
- package/dist/browser/PngVisualDiff.js +198 -29
- package/dist/browser/WebSourceMapFetcher.js +35 -9
- package/dist/browser/assets/LocalWebScriptArtifacts.js +3 -1
- package/dist/browser/assets/PublishWebScripts.js +75 -20
- package/dist/browser/assets/ScenarioScriptCapture.js +8 -12
- 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/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +12 -13
- package/dist/cli/coreNativeCommands.js +1 -14
- package/dist/cli/electronCommands.js +14 -10
- package/dist/cli/evmCommands.js +13 -4
- package/dist/cli/firmwareCommands.js +7 -2
- package/dist/cli/javascriptApplicationAnalysis.js +19 -13
- package/dist/cli/javascriptRecoveryCommands.js +22 -15
- package/dist/cli/jebCommands.js +99 -0
- package/dist/cli/jsonOutput.js +12 -4
- package/dist/cli/referenceSourceImportStatus.js +7 -0
- package/dist/cli/setupCommands.js +15 -3
- package/dist/cli/streamedJsonOutput.js +83 -4
- package/dist/cli/utilityCommands.js +68 -22
- package/dist/cli/webScriptCommands.js +20 -1
- package/dist/cli/webSourceLocationCommands.js +21 -9
- package/dist/cli.js +11 -2
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +32 -0
- package/dist/cliJsonInput.js +47 -34
- package/dist/cliObservationOptions.js +7 -0
- package/dist/composition/adb.js +3 -0
- package/dist/composition/apktool.js +3 -0
- package/dist/composition/auxiliaryAnalysisProviders.js +5 -4
- package/dist/composition/binaryDiagnostics.js +4 -0
- package/dist/composition/browserScenario.js +2 -2
- package/dist/composition/directAnalysis.js +14 -7
- 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/artifactComparisonExample.js +5 -5
- package/dist/contracts/artifactToolContracts.js +8 -5
- package/dist/contracts/browserToolContracts.js +1 -1
- package/dist/contracts/compactInputSchema.js +256 -0
- package/dist/contracts/errorSchemas.js +3 -1
- package/dist/contracts/functionComparisonExample.js +8 -0
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +104 -13
- package/dist/contracts/javascript/electronToolContracts.js +16 -3
- package/dist/contracts/javascript/javascriptApplicationWorkflowExamples.js +3 -2
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +6 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +1 -1
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +8 -7
- package/dist/contracts/jeb/jebToolContracts.js +64 -0
- package/dist/contracts/managed/managedToolContracts.js +3 -2
- package/dist/contracts/mobileApplicationGraphExamples.js +5 -5
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +25 -3
- package/dist/contracts/native/nativeToolContracts.js +1 -1
- package/dist/contracts/officialToolContracts.js +5 -5
- package/dist/contracts/sessionLifecycleInputs.js +4 -3
- package/dist/contracts/sessionStatusContract.js +3 -2
- package/dist/contracts/sessionToolContracts.js +5 -4
- package/dist/contracts/sessionToolSchemas.js +9 -4
- 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 +7 -5
- package/dist/contracts/toolOutputSchemaPrimitives.js +2 -5
- package/dist/contracts/toolSchemaMetadata.js +82 -7
- package/dist/domain/adb/adbDeviceAnalysis.js +583 -0
- package/dist/domain/analysisErrorBase.js +5 -0
- package/dist/domain/analysisErrorCleanup.js +29 -0
- package/dist/domain/analysisErrorPresentation.js +18 -4
- package/dist/domain/analysisErrorProjection.js +4 -1
- package/dist/domain/analysisSnapshot.js +5 -2
- package/dist/domain/analysisView/analysisView.js +53 -5
- 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/android/androidPartialObservation.js +36 -0
- 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 +3 -3
- package/dist/domain/apple/interfaceBuilderGraph.js +22 -19
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +10 -1
- package/dist/domain/artifactComparison.js +39 -11
- package/dist/domain/artifactGraph.js +6 -4
- package/dist/domain/artifactIdentity.js +37 -9
- package/dist/domain/artifactInspection.js +10 -50
- package/dist/domain/artifactIntegrityPolicy.js +10 -0
- package/dist/domain/artifactInventoryEvidence.js +16 -17
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/binaryTarget.js +16 -0
- package/dist/domain/binaryTargetTypes.js +8 -1
- package/dist/domain/browserCompleteness.js +3 -2
- package/dist/domain/browserObservationSchemas.js +8 -4
- package/dist/domain/browserScenarioCaptureValues.js +2 -2
- package/dist/domain/browserScenarioNormalization.js +3 -3
- package/dist/domain/browserScenarioValues.js +3 -2
- package/dist/domain/callPath.js +8 -10
- package/dist/domain/canonicalDigest.js +7 -1
- package/dist/domain/canonicalJsonDigestSteps.js +34 -12
- package/dist/domain/canonicalOrdering.js +1 -13
- package/dist/domain/changedBehavior.js +2 -3
- package/dist/domain/compactStringIdentity.js +9 -0
- package/dist/domain/comparisonSemantics.js +0 -5
- package/dist/domain/digests.js +0 -3
- package/dist/domain/evidence.js +12 -6
- package/dist/domain/evidenceBundle.js +51 -33
- package/dist/domain/evidenceRecordSummary.js +144 -0
- package/dist/domain/firmware/firmwareAnalysis.js +4 -3
- package/dist/domain/functionComparison.js +2 -1
- package/dist/domain/functionComparisonNormalization.js +4 -3
- package/dist/domain/functionComparisonResults.js +2 -2
- package/dist/domain/functionDossierEvidence.js +2 -1
- package/dist/domain/hopperValues.js +11 -15
- package/dist/domain/inputIssueProjection.js +16 -1
- package/dist/domain/javascript/electronActiveObservation.js +4 -3
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +14 -15
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +20 -21
- package/dist/domain/javascript/electronStaticAnalysisNative.js +73 -41
- package/dist/domain/javascript/electronStaticAnalysisValues.js +24 -4
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +45 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +6 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +18 -14
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +4 -0
- package/dist/domain/javascript/javascriptApplicationGraph.js +91 -28
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +35 -0
- package/dist/domain/javascript/javascriptApplicationVersionComparison.js +4 -4
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +37 -22
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +72 -45
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +16 -8
- package/dist/domain/javascript/javascriptAstFingerprint.js +60 -33
- package/dist/domain/javascript/javascriptAstValues.js +54 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +50 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +3 -2
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +31 -23
- package/dist/domain/javascript/javascriptExportShapeSelection.js +2 -2
- package/dist/domain/javascript/javascriptExportShapeVariants.js +3 -2
- package/dist/domain/javascript/javascriptFeatureSeed.js +5 -3
- package/dist/domain/javascript/javascriptFeatureTrace.js +7 -6
- package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +17 -9
- package/dist/domain/javascript/javascriptFeatureTraversal.js +4 -4
- package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +12 -7
- package/dist/domain/javascript/javascriptRpcEndpoints.js +253 -0
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +1 -3
- package/dist/domain/javascript/javascriptRuntimeObservation.js +8 -5
- package/dist/domain/javascript/javascriptRuntimeReconciliation.js +12 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationActive.js +9 -8
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +212 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +12 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationInputValidation.js +28 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +5 -5
- package/dist/domain/javascript/javascriptRuntimeReconciliationParsing.js +12 -223
- package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationRuntime.js +15 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +15 -17
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +379 -30
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +9 -7
- package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +8 -1
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +2 -2
- package/dist/domain/javascript/javascriptSemanticCoverage.js +20 -0
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +7 -9
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +4 -11
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +15 -4
- package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +43 -42
- package/dist/domain/javascript/javascriptSemanticGraph.js +205 -52
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +21 -11
- package/dist/domain/javascript/javascriptSemanticIr.js +0 -4
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +139 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +774 -136
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +190 -0
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +98 -41
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +381 -0
- package/dist/domain/javascript/javascriptSemanticObjects.js +9 -7
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +7 -2
- package/dist/domain/javascript/javascriptSemanticProjection.js +72 -28
- package/dist/domain/javascript/javascriptSemanticPromises.js +15 -21
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +100 -0
- package/dist/domain/javascript/javascriptSemanticProvenance.js +3 -3
- package/dist/domain/javascript/javascriptSemanticQuery.js +33 -29
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +4 -5
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -9
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +16 -10
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +219 -0
- package/dist/domain/javascript/javascriptSemanticReturns.js +34 -48
- package/dist/domain/javascript/javascriptSemanticState.js +22 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +25 -2
- package/dist/domain/javascript/javascriptSemanticValues.js +169 -30
- package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
- package/dist/domain/javascript/javascriptSourceMapPaths.js +11 -1
- package/dist/domain/javascript/javascriptSourceParser.js +34 -9
- package/dist/domain/javascript/javascriptStaticAnalysis.js +29 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +13 -12
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +49 -5
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +8 -4
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +26 -15
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +1 -0
- package/dist/domain/javascript/sourceToBundleComparison.js +7 -5
- package/dist/domain/javascript/sourceToBundleSignals.js +7 -7
- package/dist/domain/jeb/jebAnalysis.js +114 -0
- package/dist/domain/jsonSerialization.js +109 -55
- package/dist/domain/jsonShape.js +69 -31
- package/dist/domain/jsonValue.js +3 -0
- package/dist/domain/localPath.js +10 -4
- package/dist/domain/managed/managedApplicationGraph.js +47 -6
- package/dist/domain/managed/managedApplicationGraphCoverage.js +8 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +94 -59
- package/dist/domain/managed/managedArtifact.js +1 -0
- package/dist/domain/managed/managedInspectionEvidence.js +13 -0
- package/dist/domain/managed/managedMemberComparisonMatch.js +6 -7
- package/dist/domain/native/nativeAotPe.js +1408 -0
- package/dist/domain/native/nativeCallObservation.js +2 -4
- package/dist/domain/native/nativeInstruction.js +21 -0
- package/dist/domain/native/nativeMetadataRecovery.js +79 -6
- package/dist/domain/native/nativeValueFlow.js +5 -11
- package/dist/domain/native/objcSwiftMetadata.js +15 -17
- package/dist/domain/native/peResources.js +94 -0
- package/dist/domain/nativeConvention.js +33 -0
- package/dist/domain/process/processCapture.js +102 -11
- package/dist/domain/process/processCaptureCoverage.js +8 -5
- package/dist/domain/process/processCaptureExample.js +67 -0
- package/dist/domain/process/processCaptureValidation.js +83 -3
- package/dist/domain/process/processComparison.js +0 -23
- package/dist/domain/process/processScenario.js +62 -10
- package/dist/domain/process/processTraceEvaluation.js +4 -4
- package/dist/domain/process/processTraceSpecification.js +1 -3
- package/dist/domain/propertyListKeys.js +3 -1
- package/dist/domain/providerCleanupError.js +6 -2
- package/dist/domain/reconstructionCoverage.js +2 -1
- package/dist/domain/reconstructionUnknowns.js +4 -3
- package/dist/domain/reconstructionVerification.js +3 -2
- package/dist/domain/referenceSourceGraph.js +32 -23
- package/dist/domain/referenceSourceImportParsing.js +40 -48
- package/dist/domain/referenceSourcePathIdentity.js +22 -0
- package/dist/domain/referenceSourceRequireBindings.js +137 -0
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +2 -1
- package/dist/domain/swiftSymbolClassification.js +6 -1
- package/dist/domain/symbolAnalysis.js +17 -2
- package/dist/domain/unicodeCodePointOrder.js +6 -0
- package/dist/domain/webBundleAnalyzerInspection.js +23 -3
- package/dist/domain/webCaptureDiff.js +170 -30
- package/dist/domain/webCaptureDiffSchemas.js +2 -8
- package/dist/domain/webInventory.js +3 -2
- package/dist/domain/webMcpDiscovery.js +4 -3
- package/dist/domain/webScriptExport.js +1 -1
- 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 +5 -4
- 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 +65 -31
- package/dist/dotnet/ManagedStaticProviderMetadata.js +1 -4
- 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 +73 -0
- 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 +90 -8
- package/dist/ghidra/GhidraDiagnostics.js +11 -8
- package/dist/ghidra/GhidraFunctionValues.js +26 -2
- package/dist/ghidra/GhidraInstallation.js +111 -10
- package/dist/ghidra/GhidraInventoryValues.js +23 -1
- package/dist/ghidra/GhidraLanguageCatalog.js +99 -0
- package/dist/ghidra/GhidraLauncher.js +123 -58
- 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/HopperCleanup.js +1 -1
- 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 +10 -2
- package/dist/ida/IdaProvider.js +7 -0
- package/dist/ida/IdaSessionClient.js +7 -3
- package/dist/ida/IdaWorkspace.js +4 -2
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -5
- package/dist/inspector/V8InspectorCaptureProjection.js +46 -13
- package/dist/inspector/V8InspectorProvider.js +60 -8
- 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/main/shutdown.js +76 -32
- package/dist/main/transport.js +1 -1
- 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/AppleObjcDispatchFacets.js +3 -3
- package/dist/native/AppleObjcProperties.js +17 -7
- package/dist/native/LldbCallTracer.js +241 -75
- package/dist/native/NativeMacOSProvider.js +100 -20
- package/dist/native/NativeMacOSProviderMetadata.js +1 -2
- 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 +104 -51
- 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 +116 -22
- package/dist/process/capture/ProcessCaptureLifecycle.js +363 -86
- package/dist/process/capture/ProcessCaptureProgress.js +62 -0
- package/dist/process/capture/ProcessFilesystemEffects.js +19 -4
- package/dist/process/capture/ProcessHarness.js +202 -47
- 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/analysisAdmission.js +8 -0
- package/dist/server/contractToolHandler.js +21 -0
- package/dist/server/createServer.js +118 -47
- 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 +6 -7
- 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/helpers.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/registerArtifactTools.js +2 -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 +36 -5
- package/dist/server/registerElectronTools.js +28 -10
- package/dist/server/registerEnhancedTools.js +78 -73
- package/dist/server/registerEvidenceTools.js +54 -46
- 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/registerManagedTools.js +7 -4
- 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/registerOfficialTools.js +31 -25
- 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 +58 -21
- 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 +38 -7
- 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 +31 -1
- package/dist/artifacts/inventory/policy.js +0 -2
- package/dist/domain/managed/managedApplicationGraphNodeCoverage.js +0 -6
- package/dist/server/registerNativeTools.js +0 -6
|
@@ -17,6 +17,7 @@ const supportedClientIds = SUPPORTED_CLIENT_DEFINITIONS.map(({ name }) => name);
|
|
|
17
17
|
const supportedClientSchema = z
|
|
18
18
|
.string()
|
|
19
19
|
.refine((candidate) => supportedClientIds.some((name) => name === candidate), "Unsupported agent integration");
|
|
20
|
+
const skillClientSchema = z.union([z.literal("shared"), supportedClientSchema]);
|
|
20
21
|
/** Register setup, doctor, uninstall, and update CLI commands. */
|
|
21
22
|
export const registerSetupCommands = (cli, logger, environment) => {
|
|
22
23
|
registerSetupCommand(cli, logger, environment);
|
|
@@ -40,6 +41,10 @@ const registerSetupCommand = (cli, logger, environment) => {
|
|
|
40
41
|
.array(supportedClientSchema)
|
|
41
42
|
.default([])
|
|
42
43
|
.describe("Agent integration to configure; repeat for multiple agents"),
|
|
44
|
+
skillClient: z
|
|
45
|
+
.array(skillClientSchema)
|
|
46
|
+
.default([])
|
|
47
|
+
.describe("Existing client skill destination to update; repeatable"),
|
|
43
48
|
allDetected: z
|
|
44
49
|
.boolean()
|
|
45
50
|
.default(false)
|
|
@@ -91,7 +96,6 @@ const registerMaintenanceCommands = (cli, logger, environment) => {
|
|
|
91
96
|
.default(false)
|
|
92
97
|
.describe("Also remove REA caches and state"),
|
|
93
98
|
}),
|
|
94
|
-
alias: { purgeData: "purge-data" },
|
|
95
99
|
run: ({ options }) => logCliCommand(logger, "uninstall", () => runUninstall(options.purgeData, systemUninstallHost(homeDirectoryFromEnvironment(environment, process.platform), undefined, environment)), isUninstallFailure),
|
|
96
100
|
});
|
|
97
101
|
cli.command(CLI_COMMANDS.update, {
|
|
@@ -112,8 +116,12 @@ const runSetupCommand = async (input, environment) => {
|
|
|
112
116
|
};
|
|
113
117
|
const setupRunOptions = (input, interactive, hasExplicitScope) => {
|
|
114
118
|
const { options } = input;
|
|
115
|
-
const agentIntegrationSelected = options.allDetected ||
|
|
116
|
-
|
|
119
|
+
const agentIntegrationSelected = options.allDetected ||
|
|
120
|
+
options.client.length > 0 ||
|
|
121
|
+
options.skillClient.length > 0;
|
|
122
|
+
const hasSelectedClients = hasExplicitScope &&
|
|
123
|
+
!options.allDetected &&
|
|
124
|
+
(options.client.length > 0 || options.skillClient.length > 0);
|
|
117
125
|
return {
|
|
118
126
|
approved: options.yes && !options.dryRun,
|
|
119
127
|
installHopper: options.installHopper,
|
|
@@ -122,6 +130,9 @@ const setupRunOptions = (input, interactive, hasExplicitScope) => {
|
|
|
122
130
|
allDetectedClients: options.allDetected,
|
|
123
131
|
proposeHopper: interactive || options.installHopper,
|
|
124
132
|
...(hasSelectedClients ? { clientIds: options.client } : {}),
|
|
133
|
+
...(options.skillClient.length > 0
|
|
134
|
+
? { skillClientIds: options.skillClient }
|
|
135
|
+
: {}),
|
|
125
136
|
...(hasExplicitScope
|
|
126
137
|
? { installSkill: options.skill ?? agentIntegrationSelected }
|
|
127
138
|
: {}),
|
|
@@ -145,6 +156,7 @@ const setupIsInteractive = (options, formatExplicit) => !options.yes &&
|
|
|
145
156
|
process.stderr.isTTY === true;
|
|
146
157
|
const setupHasExplicitScope = (options) => options.allDetected ||
|
|
147
158
|
options.client.length > 0 ||
|
|
159
|
+
options.skillClient.length > 0 ||
|
|
148
160
|
options.skill !== undefined ||
|
|
149
161
|
options.installHopper;
|
|
150
162
|
const doctorScope = (options) => options.client.length === 0 &&
|
|
@@ -1,18 +1,70 @@
|
|
|
1
|
+
import { constants } from "node:buffer";
|
|
1
2
|
import {} from "node:stream";
|
|
2
|
-
import { Filter } from "incur";
|
|
3
|
+
import { Cli, Filter } from "incur";
|
|
3
4
|
import { parseCliOutputArguments } from "../cliOutput.js";
|
|
4
|
-
import {
|
|
5
|
+
import { AnalysisResourceConstraintError } from "../domain/analysisErrorCore.js";
|
|
6
|
+
import { projectAnalysisError, } from "../domain/analysisErrorProjection.js";
|
|
7
|
+
import { jsonOutputParts, writeJsonOutput } from "./jsonOutput.js";
|
|
8
|
+
const registeredCommands = Cli.toCommands;
|
|
9
|
+
/** Install formatting once, after registration, for every ordinary CLI result. */
|
|
10
|
+
export const streamCliCommandResults = (cli, output) => {
|
|
11
|
+
const commands = registeredCommands.get(cli);
|
|
12
|
+
if (commands !== undefined)
|
|
13
|
+
wrapCommands(commands, [], output);
|
|
14
|
+
};
|
|
15
|
+
const wrapCommands = (commands, parents, output) => {
|
|
16
|
+
for (const [name, entry] of commands) {
|
|
17
|
+
const path = [...parents, name];
|
|
18
|
+
if ("_group" in entry) {
|
|
19
|
+
wrapCommands(entry.commands, path, output);
|
|
20
|
+
if (entry.root !== undefined)
|
|
21
|
+
wrapCommand(entry.root, path.join(" "), output);
|
|
22
|
+
}
|
|
23
|
+
else if (!("_alias" in entry) && !("_fetch" in entry))
|
|
24
|
+
wrapCommand(entry, path.join(" "), output);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const wrapCommand = (command, name, output) => {
|
|
28
|
+
const run = command.run;
|
|
29
|
+
command.run = (context) => {
|
|
30
|
+
const started = performance.now();
|
|
31
|
+
const result = run(context);
|
|
32
|
+
// Generator results and Incur's sentinel responses retain their own protocol.
|
|
33
|
+
if (typeof result === "object" &&
|
|
34
|
+
result !== null &&
|
|
35
|
+
Symbol.asyncIterator in result)
|
|
36
|
+
return result;
|
|
37
|
+
return Promise.resolve(result).then(async (value) => {
|
|
38
|
+
if (typeof value === "object" &&
|
|
39
|
+
value !== null &&
|
|
40
|
+
Symbol.for("incur.sentinel") in value)
|
|
41
|
+
return value;
|
|
42
|
+
if (!(await output.write(value, {
|
|
43
|
+
command: name,
|
|
44
|
+
format: context.format,
|
|
45
|
+
duration: `${Math.round(performance.now() - started)}ms`,
|
|
46
|
+
})))
|
|
47
|
+
return value;
|
|
48
|
+
if (output.error !== undefined)
|
|
49
|
+
return context.error({
|
|
50
|
+
code: output.error.code,
|
|
51
|
+
message: output.error.message,
|
|
52
|
+
});
|
|
53
|
+
return undefined;
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
};
|
|
5
57
|
/** Preserve Incur's JSON controls while streaming the complete result. */
|
|
6
58
|
export const createStreamedCliJsonOutput = (arguments_, destination) => {
|
|
7
59
|
const options = parseCliOutputArguments(arguments_);
|
|
8
60
|
if (options.parseError ||
|
|
9
|
-
options.tokenCount ||
|
|
10
61
|
options.tokenWindow ||
|
|
11
62
|
(options.format !== "json" && options.format !== "jsonl"))
|
|
12
63
|
return undefined;
|
|
13
64
|
const format = options.format;
|
|
14
65
|
let handled = false;
|
|
15
66
|
let failed = false;
|
|
67
|
+
let error;
|
|
16
68
|
return {
|
|
17
69
|
get handled() {
|
|
18
70
|
return handled;
|
|
@@ -20,6 +72,9 @@ export const createStreamedCliJsonOutput = (arguments_, destination) => {
|
|
|
20
72
|
get failed() {
|
|
21
73
|
return failed;
|
|
22
74
|
},
|
|
75
|
+
get error() {
|
|
76
|
+
return error;
|
|
77
|
+
},
|
|
23
78
|
async write(value, metadata) {
|
|
24
79
|
if (metadata.format !== format)
|
|
25
80
|
return false;
|
|
@@ -30,6 +85,26 @@ export const createStreamedCliJsonOutput = (arguments_, destination) => {
|
|
|
30
85
|
command: metadata.command,
|
|
31
86
|
duration: metadata.duration,
|
|
32
87
|
};
|
|
88
|
+
if (options.tokenCount) {
|
|
89
|
+
// Incur/tokenx materialize the formatted value. Measure its UTF-16
|
|
90
|
+
// expansion before allowing that allocation, independently of UTF-8 bytes.
|
|
91
|
+
let characters = 0;
|
|
92
|
+
if (filtered !== undefined &&
|
|
93
|
+
filtered !== null &&
|
|
94
|
+
typeof filtered !== "function" &&
|
|
95
|
+
typeof filtered !== "symbol")
|
|
96
|
+
for (const part of jsonOutputParts(filtered, format))
|
|
97
|
+
characters += part.length;
|
|
98
|
+
characters = Math.max(0, characters - 1);
|
|
99
|
+
if (characters <= constants.MAX_STRING_LENGTH)
|
|
100
|
+
return false;
|
|
101
|
+
error = projectAnalysisError(new AnalysisResourceConstraintError(metadata.command, "memory", "Token counting requires a formatted string larger than the runtime permits.", {
|
|
102
|
+
formatted_characters: characters,
|
|
103
|
+
max_string_characters: constants.MAX_STRING_LENGTH,
|
|
104
|
+
}, {
|
|
105
|
+
remediationAction: "Remove --token-count to stream the complete JSON result, or narrow it with --filter-output.",
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
33
108
|
const document = options.fullOutput
|
|
34
109
|
? filtered === undefined
|
|
35
110
|
? { ok: true, meta }
|
|
@@ -44,7 +119,11 @@ export const createStreamedCliJsonOutput = (arguments_, destination) => {
|
|
|
44
119
|
// document from Incur's error formatter.
|
|
45
120
|
handled = true;
|
|
46
121
|
try {
|
|
47
|
-
await writeJsonOutput(
|
|
122
|
+
await writeJsonOutput(error === undefined
|
|
123
|
+
? document
|
|
124
|
+
: options.fullOutput
|
|
125
|
+
? { ok: false, error, meta }
|
|
126
|
+
: error, destination, format);
|
|
48
127
|
}
|
|
49
128
|
catch (cause) {
|
|
50
129
|
failed = true;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from "incur";
|
|
2
|
+
import { ArtifactReaderFailure } from "../artifacts/ArtifactReader.js";
|
|
3
|
+
import { ArtifactResourceScope } from "../artifacts/ArtifactResourceScope.js";
|
|
2
4
|
import { importReferenceSource } from "../application/ReferenceSourceImport.js";
|
|
3
5
|
import { projectReferenceSourceImportError } from "../application/ReferenceSourceImportTypes.js";
|
|
4
6
|
import { parseConfig } from "../config/parseConfig.js";
|
|
@@ -54,10 +56,6 @@ export const registerUtilityCommands = (cli, logger, environment, analysis) => {
|
|
|
54
56
|
.default(500)
|
|
55
57
|
.describe("Maximum accessibility nodes per capture"),
|
|
56
58
|
}),
|
|
57
|
-
alias: {
|
|
58
|
-
windowId: "window-id",
|
|
59
|
-
maxNodes: "max-nodes",
|
|
60
|
-
},
|
|
61
59
|
run: ({ args, options }) => logCliCommand(logger, command, async () => {
|
|
62
60
|
const parameters = {
|
|
63
61
|
pid: options.pid,
|
|
@@ -97,7 +95,7 @@ const invalidNativeUiScenarioInput = (operation, issues) => ({
|
|
|
97
95
|
error: "Application workflow failed",
|
|
98
96
|
...projectAnalysisError(new AnalysisInputError(operation, undefined, issues)),
|
|
99
97
|
});
|
|
100
|
-
const registerCapabilityCommands = (cli, logger, {
|
|
98
|
+
const registerCapabilityCommands = (cli, logger, { runSessionStatus }) => {
|
|
101
99
|
for (const command of [
|
|
102
100
|
CLI_COMMANDS.capabilities,
|
|
103
101
|
CLI_COMMANDS.providers,
|
|
@@ -106,9 +104,7 @@ const registerCapabilityCommands = (cli, logger, { runProviderStatus, runCapabil
|
|
|
106
104
|
description: command === "capabilities"
|
|
107
105
|
? "List provider capabilities and side effects"
|
|
108
106
|
: "List configured analysis providers",
|
|
109
|
-
run: () => logCliCommand(logger, command, () =>
|
|
110
|
-
? runProviderStatus(logger)
|
|
111
|
-
: runCapabilityStatus(logger)),
|
|
107
|
+
run: () => logCliCommand(logger, command, () => runSessionStatus(logger)),
|
|
112
108
|
});
|
|
113
109
|
}
|
|
114
110
|
};
|
|
@@ -131,9 +127,8 @@ const registerNativeCommands = (cli, logger, runProviderAnalysis) => {
|
|
|
131
127
|
relativePath: z
|
|
132
128
|
.string()
|
|
133
129
|
.optional()
|
|
134
|
-
.describe("Plist path relative to the app root (default:
|
|
130
|
+
.describe("Plist path relative to the app root, or an absolute path (default: the bundle's Info.plist)"),
|
|
135
131
|
}),
|
|
136
|
-
alias: { relativePath: "relative-path" },
|
|
137
132
|
run: ({ args, options }) => logCliCommand(logger, "inspect-plist", () => runProviderAnalysis(args.path, "inspect_plist", options.relativePath === undefined
|
|
138
133
|
? {}
|
|
139
134
|
: { path: options.relativePath }, logger)),
|
|
@@ -162,19 +157,70 @@ const registerReferenceSourceCommand = (cli, logger, environment) => {
|
|
|
162
157
|
error: "Import failed",
|
|
163
158
|
...projectAnalysisError(config.error),
|
|
164
159
|
};
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
return runReferenceSourceImport(args.root, config.value.referenceSourcePolicy);
|
|
161
|
+
}, isReferenceSourceImportCliFailure),
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
const runReferenceSourceImport = async (root, policy) => {
|
|
165
|
+
const resources = new ArtifactResourceScope();
|
|
166
|
+
let outcome;
|
|
167
|
+
try {
|
|
168
|
+
outcome = {
|
|
169
|
+
kind: "result",
|
|
170
|
+
imported: await importReferenceSource({
|
|
171
|
+
root,
|
|
167
172
|
caller: "rea-cli",
|
|
168
|
-
policy
|
|
173
|
+
policy,
|
|
169
174
|
importer: PRODUCT_IDENTITY.packageName,
|
|
170
175
|
importerVersion: null,
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
}, resources),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
catch (cause) {
|
|
180
|
+
outcome = { kind: "thrown", cause };
|
|
181
|
+
}
|
|
182
|
+
let closeOutcome;
|
|
183
|
+
try {
|
|
184
|
+
await resources.close();
|
|
185
|
+
closeOutcome = { kind: "closed" };
|
|
186
|
+
}
|
|
187
|
+
catch (cause) {
|
|
188
|
+
closeOutcome = { kind: "failed", cause };
|
|
189
|
+
}
|
|
190
|
+
if (outcome.kind === "thrown") {
|
|
191
|
+
if (closeOutcome.kind === "failed")
|
|
192
|
+
throw new AggregateError([outcome.cause, closeOutcome.cause], "Reference source import and cleanup both failed", { cause: outcome.cause });
|
|
193
|
+
throw outcome.cause;
|
|
194
|
+
}
|
|
195
|
+
const imported = outcome.imported;
|
|
196
|
+
if (!imported.ok) {
|
|
197
|
+
const cleanup = closeOutcome.kind === "closed"
|
|
198
|
+
? imported.error.cleanup
|
|
199
|
+
: mergeReferenceSourceCleanup(imported.error.cleanup, ArtifactReaderFailure.cleanupObservation(closeOutcome.cause, "reference source"));
|
|
200
|
+
return {
|
|
201
|
+
error: "Import failed",
|
|
202
|
+
...projectReferenceSourceImportError({
|
|
203
|
+
...imported.error,
|
|
204
|
+
...(cleanup === undefined ? {} : { cleanup }),
|
|
205
|
+
}),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
if (closeOutcome.kind === "failed")
|
|
209
|
+
return {
|
|
210
|
+
error: "Import failed",
|
|
211
|
+
...projectReferenceSourceImportError({
|
|
212
|
+
tag: "reference-source-import",
|
|
213
|
+
code: "io",
|
|
214
|
+
message: "Reference source cleanup failed after import",
|
|
215
|
+
cleanup: ArtifactReaderFailure.cleanupObservation(closeOutcome.cause, "reference source"),
|
|
216
|
+
cause: closeOutcome.cause,
|
|
217
|
+
}),
|
|
218
|
+
};
|
|
219
|
+
return imported.value;
|
|
180
220
|
};
|
|
221
|
+
const mergeReferenceSourceCleanup = (first, second) => first === undefined
|
|
222
|
+
? second
|
|
223
|
+
: {
|
|
224
|
+
reason: `${first.reason}; ${second.reason}`,
|
|
225
|
+
resources: [...new Set([...first.resources, ...second.resources])],
|
|
226
|
+
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Cli, z } from "incur";
|
|
2
2
|
import { exportWebScripts } from "../application/WebScriptExportService.js";
|
|
3
|
+
import { ArtifactReaderFailure } from "../artifacts/ArtifactReader.js";
|
|
4
|
+
import { ArtifactResourceScope } from "../artifacts/ArtifactResourceScope.js";
|
|
3
5
|
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
|
4
6
|
import { logCliCommand } from "../cliLogging.js";
|
|
7
|
+
import { analysisErrorWithCleanupFailure } from "../domain/analysisErrorCleanup.js";
|
|
5
8
|
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
|
9
|
+
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
|
|
6
10
|
/** Register the local captured-script export CLI workflow. */
|
|
7
11
|
export const registerWebScriptCommands = (cli, logger) => {
|
|
8
12
|
cli.command(CLI_COMMANDS.exportWebScripts, {
|
|
@@ -16,10 +20,25 @@ export const registerWebScriptCommands = (cli, logger) => {
|
|
|
16
20
|
.describe("Absolute absent directory for verified scripts and manifest"),
|
|
17
21
|
}),
|
|
18
22
|
run: ({ args }) => logCliCommand(logger, CLI_COMMANDS.exportWebScripts, async () => {
|
|
23
|
+
const resources = new ArtifactResourceScope();
|
|
19
24
|
const result = await exportWebScripts({
|
|
20
25
|
capture_path: args.capturePath,
|
|
21
26
|
output_directory: args.outputDirectory,
|
|
22
|
-
});
|
|
27
|
+
}, resources);
|
|
28
|
+
try {
|
|
29
|
+
await resources.close();
|
|
30
|
+
}
|
|
31
|
+
catch (cause) {
|
|
32
|
+
const cleanup = ArtifactReaderFailure.cleanupObservation(cause, "Web script export resources");
|
|
33
|
+
const failure = new ProviderCleanupError("web-script-export", cleanup.resources, { reason: cleanup.reason }, { cause, operation: "export_web_scripts" });
|
|
34
|
+
const error = result.ok
|
|
35
|
+
? failure
|
|
36
|
+
: analysisErrorWithCleanupFailure(result.error, failure, "export_web_scripts");
|
|
37
|
+
return {
|
|
38
|
+
error: "Script export failed",
|
|
39
|
+
...projectAnalysisError(error),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
23
42
|
return result.ok
|
|
24
43
|
? result.value
|
|
25
44
|
: {
|
|
@@ -29,14 +29,26 @@ export const registerWebSourceLocationCommands = (cli, logger, environment) => {
|
|
|
29
29
|
.min(0)
|
|
30
30
|
.describe("Zero-based UTF-16 generated column"),
|
|
31
31
|
}),
|
|
32
|
-
run: ({ args }) => withCommandCancellation(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
run: ({ args }) => withCommandCancellation(async (signal) => {
|
|
33
|
+
try {
|
|
34
|
+
return await logCliCommand(logger, CLI_COMMANDS.traceWebSourceLocation, async () => {
|
|
35
|
+
const result = await service.trace({
|
|
36
|
+
manifest_path: args.manifestPath,
|
|
37
|
+
script_index: args.scriptIndex,
|
|
38
|
+
source_map: {
|
|
39
|
+
path: args.sourceMapPath,
|
|
40
|
+
url: args.sourceMapUrl,
|
|
41
|
+
},
|
|
42
|
+
generated_position: { line: args.line, column: args.column },
|
|
43
|
+
}, { signal });
|
|
44
|
+
return result.ok
|
|
45
|
+
? result.value
|
|
46
|
+
: projectAnalysisError(result.error);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
await service.close();
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
41
53
|
});
|
|
42
54
|
};
|
package/dist/cli.js
CHANGED
|
@@ -14,6 +14,9 @@ import { registerArtifactCommands } from "./cli/artifactCommands.js";
|
|
|
14
14
|
import { registerManagedCommands } from "./cli/managedCommands.js";
|
|
15
15
|
import { registerFirmwareCommands } from "./cli/firmwareCommands.js";
|
|
16
16
|
import { registerAndroidCommands } from "./cli/androidCommands.js";
|
|
17
|
+
import { registerApktoolCommands } from "./cli/apktoolCommands.js";
|
|
18
|
+
import { registerJebCommands } from "./cli/jebCommands.js";
|
|
19
|
+
import { registerAdbCommands } from "./cli/adbCommands.js";
|
|
17
20
|
import { registerEvidenceCommands } from "./cliEvidenceCommands.js";
|
|
18
21
|
import { registerProcessCommands } from "./cli/processCommands.js";
|
|
19
22
|
import { registerBrowserCommands } from "./cli/browserCommands.js";
|
|
@@ -29,6 +32,7 @@ import { registerElectronCommands } from "./cli/electronCommands.js";
|
|
|
29
32
|
import { registerJavaScriptRuntimeObservationCommands } from "./cliJavaScriptRuntimeCommands.js";
|
|
30
33
|
import { registerApplicationCommands } from "./cli/applicationCommands.js";
|
|
31
34
|
import { presentOmittableDefaults } from "./cli/omittableDefaults.js";
|
|
35
|
+
import { streamCliCommandResults, } from "./cli/streamedJsonOutput.js";
|
|
32
36
|
/**
|
|
33
37
|
* Build the one-shot Incur CLI without starting Hopper at import time.
|
|
34
38
|
* Analysis commands acquire and close their own sessions; bare `mcp` and
|
|
@@ -50,12 +54,15 @@ export const createCli = (selectedEnvironment = process.env, resultOutput) => {
|
|
|
50
54
|
sync: false,
|
|
51
55
|
});
|
|
52
56
|
registerSetupCommands(cli, logger, environment);
|
|
53
|
-
registerCoreAnalysisCommands(cli, logger, analysis.runDirectAnalysis
|
|
57
|
+
registerCoreAnalysisCommands(cli, logger, analysis.runDirectAnalysis);
|
|
54
58
|
registerUtilityCommands(cli, logger, environment, analysis);
|
|
55
59
|
registerEvmCommands(cli, logger, environment);
|
|
56
60
|
registerArtifactCommands(cli, logger, analysis.runProviderAnalysis);
|
|
57
61
|
registerManagedCommands(cli, logger, analysis.runProviderAnalysis);
|
|
58
62
|
registerAndroidCommands(cli, logger, environment);
|
|
63
|
+
registerApktoolCommands(cli, logger, environment);
|
|
64
|
+
registerJebCommands(cli, logger, environment);
|
|
65
|
+
registerAdbCommands(cli, logger, environment);
|
|
59
66
|
registerFirmwareCommands(cli, logger, environment);
|
|
60
67
|
registerBinaryDiagnosticsCommands(cli, logger, environment);
|
|
61
68
|
registerAnalysisViewCommands(cli, logger);
|
|
@@ -70,9 +77,11 @@ export const createCli = (selectedEnvironment = process.env, resultOutput) => {
|
|
|
70
77
|
registerJavaScriptRecoveryCommands(cli, logger, environment);
|
|
71
78
|
registerAdvancedBrowserCommands(cli, logger);
|
|
72
79
|
registerBrowserScenarioCommands(cli, logger, environment);
|
|
73
|
-
registerElectronCommands(cli, logger, environment
|
|
80
|
+
registerElectronCommands(cli, logger, environment);
|
|
74
81
|
registerJavaScriptRuntimeObservationCommands(cli, logger);
|
|
75
82
|
registerApplicationCommands(cli, logger);
|
|
76
83
|
presentOmittableDefaults(cli);
|
|
84
|
+
if (resultOutput !== undefined)
|
|
85
|
+
streamCliCommandResults(cli, resultOutput);
|
|
77
86
|
return cli;
|
|
78
87
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Cli } from "incur";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { captureBrowserScenario } from "./application/BrowserScenarioCaptureService.js";
|
|
4
|
-
import { createBrowserScenarioProvider } from "./composition/browserScenario.js";
|
|
5
4
|
import { CLI_COMMANDS } from "./cliCommandNames.js";
|
|
6
5
|
import { parseCliJsonInput, resolveCliJsonPaths } from "./cliJsonInput.js";
|
|
7
6
|
import { logCliCommand } from "./cliLogging.js";
|
|
@@ -26,6 +25,8 @@ export const registerBrowserScenarioCommands = (cli, logger, environment) => {
|
|
|
26
25
|
const scenario = browserScenarioSchema.safeParse(resolveCliJsonPaths(input.value, [["browser", "executable_path"]]));
|
|
27
26
|
if (!scenario.success)
|
|
28
27
|
return cliError(new AnalysisInputError(OPERATION, { cause: scenario.error }, projectInputIssues(scenario.error.issues, input.value)));
|
|
28
|
+
// Load Playwright only for this command, not during CLI startup.
|
|
29
|
+
const { createBrowserScenarioProvider } = await import("./composition/browserScenario.js");
|
|
29
30
|
const result = await captureBrowserScenario(createBrowserScenarioProvider(environment), scenario.data);
|
|
30
31
|
return result.ok ? result.value : cliError(result.error);
|
|
31
32
|
}),
|
package/dist/cliCommandNames.js
CHANGED
|
@@ -41,14 +41,46 @@ export const CLI_COMMANDS = Object.freeze({
|
|
|
41
41
|
inspectManagedArtifact: "inspect-managed-artifact",
|
|
42
42
|
inspectRecordedCrash: "inspect-recorded-crash",
|
|
43
43
|
inspectBinaryLayout: "inspect-binary-layout",
|
|
44
|
+
inspectPeResources: "inspect-pe-resources",
|
|
44
45
|
inspectAnalysisView: "inspect-analysis-view",
|
|
46
|
+
inspectEvidenceBundle: "inspect-evidence-bundle",
|
|
45
47
|
inspectFirmwareRegions: "inspect-firmware-regions",
|
|
46
48
|
extractFirmware: "extract-firmware",
|
|
47
49
|
inspectAndroidPackage: "inspect-android-package",
|
|
50
|
+
inspectApktoolClient: "inspect-apktool-client",
|
|
51
|
+
decodeAndroidResources: "decode-android-resources",
|
|
52
|
+
inspectAdbClient: "inspect-adb-client",
|
|
53
|
+
listAdbDevices: "list-adb-devices",
|
|
54
|
+
inspectAdbDevice: "inspect-adb-device",
|
|
55
|
+
listAdbPackages: "list-adb-packages",
|
|
56
|
+
pullAdbPackage: "pull-adb-package",
|
|
57
|
+
readAdbLogcat: "read-adb-logcat",
|
|
58
|
+
inspectAdbPackage: "inspect-adb-package",
|
|
59
|
+
pullAdbFile: "pull-adb-file",
|
|
60
|
+
pushAdbFile: "push-adb-file",
|
|
61
|
+
captureAdbScreen: "capture-adb-screen",
|
|
62
|
+
listAdbProcesses: "list-adb-processes",
|
|
63
|
+
listAdbDirectory: "list-adb-directory",
|
|
64
|
+
listAdbFeatures: "list-adb-features",
|
|
65
|
+
listAdbServices: "list-adb-services",
|
|
66
|
+
inspectAdbDisplay: "inspect-adb-display",
|
|
67
|
+
inspectAdbWindow: "inspect-adb-window",
|
|
68
|
+
readAdbSetting: "read-adb-setting",
|
|
69
|
+
collectAdbBugreport: "collect-adb-bugreport",
|
|
70
|
+
resolveAdbPackages: "resolve-adb-packages",
|
|
71
|
+
installAdbPackage: "install-adb-package",
|
|
72
|
+
uninstallAdbPackage: "uninstall-adb-package",
|
|
73
|
+
startAdbApp: "start-adb-app",
|
|
74
|
+
startAdbActivity: "start-adb-activity",
|
|
75
|
+
stopAdbApp: "stop-adb-app",
|
|
48
76
|
searchAndroidClasses: "search-android-classes",
|
|
49
77
|
inspectAndroidClass: "inspect-android-class",
|
|
50
78
|
inspectAndroidMethod: "inspect-android-method",
|
|
51
79
|
traceAndroidReferences: "trace-android-references",
|
|
80
|
+
inspectJebClient: "inspect-jeb-client",
|
|
81
|
+
openJebProject: "open-jeb-project",
|
|
82
|
+
listJebUnits: "list-jeb-units",
|
|
83
|
+
decompileJebItem: "decompile-jeb-item",
|
|
52
84
|
inspectManagedMembers: "inspect-managed-members",
|
|
53
85
|
inspectManagedNativeBoundaries: "inspect-managed-native-boundaries",
|
|
54
86
|
compareManagedMembers: "compare-managed-members",
|
package/dist/cliJsonInput.js
CHANGED
|
@@ -1,29 +1,52 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
1
|
import { resolve } from "node:path";
|
|
3
|
-
import {
|
|
2
|
+
import { readJsonInputFile } from "./application/JsonInputFile.js";
|
|
3
|
+
import { NonRegularFileReadError } from "./filesystem/RegularFile.js";
|
|
4
|
+
import { AnalysisAccessDeniedError, AnalysisInputError, } from "./domain/analysisErrorCore.js";
|
|
4
5
|
import { projectAnalysisError } from "./domain/analysisErrorProjection.js";
|
|
5
6
|
import { safeParseJson } from "./domain/safeJson.js";
|
|
6
7
|
/** Parse inline JSON or one local JSON file for a CLI workflow. */
|
|
7
8
|
export const parseCliJsonInput = async (value, operation) => {
|
|
8
|
-
const inline =
|
|
9
|
-
if (inline
|
|
10
|
-
return { ok: true, value: inline };
|
|
9
|
+
const inline = safeParseJson(value);
|
|
10
|
+
if (inline.ok)
|
|
11
|
+
return { ok: true, value: inline.value };
|
|
11
12
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const parsed = await readJsonInputFile(value, operation);
|
|
14
|
+
return parsed.ok
|
|
15
|
+
? { ok: true, value: parsed.value }
|
|
16
|
+
: {
|
|
17
|
+
ok: false,
|
|
18
|
+
error: {
|
|
19
|
+
error: "Application workflow failed",
|
|
20
|
+
...projectAnalysisError(parsed.error),
|
|
21
|
+
input_path: value,
|
|
22
|
+
input_reason: parsed.error._tag === "AnalysisInputError"
|
|
23
|
+
? "invalid-json"
|
|
24
|
+
: "too-large",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
18
27
|
}
|
|
19
28
|
catch (cause) {
|
|
29
|
+
const systemCode = accessDeniedSystemCode(cause);
|
|
30
|
+
if (systemCode !== undefined)
|
|
31
|
+
return jsonAccessDeniedError(value, operation, systemCode, cause);
|
|
20
32
|
if (["{", "["].includes(value.trimStart()[0] ?? "") &&
|
|
21
33
|
cannotBeAnExistingFile(cause) &&
|
|
22
34
|
!hasExplicitJsonFileExtension(value))
|
|
23
35
|
return { ok: false, error: inputError(operation) };
|
|
36
|
+
if (!(cause instanceof Error) ||
|
|
37
|
+
!("code" in cause) ||
|
|
38
|
+
typeof cause.code !== "string")
|
|
39
|
+
throw cause;
|
|
24
40
|
return jsonFileError(value, operation, "read-failed", cause);
|
|
25
41
|
}
|
|
26
42
|
};
|
|
43
|
+
const accessDeniedSystemCode = (cause) => {
|
|
44
|
+
if (!(cause instanceof Error) || !("code" in cause))
|
|
45
|
+
return undefined;
|
|
46
|
+
return cause.code === "EACCES" || cause.code === "EPERM"
|
|
47
|
+
? cause.code
|
|
48
|
+
: undefined;
|
|
49
|
+
};
|
|
27
50
|
/**
|
|
28
51
|
* Resolve named string fields of CLI-supplied JSON against the operator
|
|
29
52
|
* working directory. Each entry is a key path from the document root; only
|
|
@@ -62,27 +85,6 @@ const cannotBeAnExistingFile = (cause) => typeof cause === "object" &&
|
|
|
62
85
|
cause.code === "ENAMETOOLONG" ||
|
|
63
86
|
cause.code === "ENOTDIR");
|
|
64
87
|
const hasExplicitJsonFileExtension = (value) => value.toLowerCase().endsWith(".json");
|
|
65
|
-
const parseJson = (value) => {
|
|
66
|
-
let text;
|
|
67
|
-
if (typeof value === "string") {
|
|
68
|
-
text = value;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
try {
|
|
72
|
-
text = new TextDecoder("utf-8", {
|
|
73
|
-
fatal: true,
|
|
74
|
-
ignoreBOM: true,
|
|
75
|
-
}).decode(value);
|
|
76
|
-
}
|
|
77
|
-
catch (cause) {
|
|
78
|
-
// Decoding failure means the bytes are not valid UTF-8 JSON input.
|
|
79
|
-
void cause;
|
|
80
|
-
return undefined;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
const parsed = safeParseJson(text);
|
|
84
|
-
return parsed.ok ? parsed.value : undefined;
|
|
85
|
-
};
|
|
86
88
|
const inputError = (operation) => ({
|
|
87
89
|
error: "Application workflow failed",
|
|
88
90
|
...projectAnalysisError(new AnalysisInputError(operation, undefined, [
|
|
@@ -100,7 +102,16 @@ const jsonFileError = (path, operation, reason, cause) => ({
|
|
|
100
102
|
input_reason: reason,
|
|
101
103
|
},
|
|
102
104
|
});
|
|
103
|
-
|
|
105
|
+
const jsonAccessDeniedError = (path, operation, systemCode, cause) => ({
|
|
106
|
+
ok: false,
|
|
107
|
+
error: {
|
|
108
|
+
error: "Application workflow failed",
|
|
109
|
+
...projectAnalysisError(new AnalysisAccessDeniedError(operation, path, systemCode, { cause })),
|
|
110
|
+
input_path: path,
|
|
111
|
+
input_reason: "read-failed",
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
/** Preserve file-selection and system failures alongside the requested path. */
|
|
104
115
|
const readFailureIssue = (path, cause) => {
|
|
105
116
|
const code = typeof cause === "object" &&
|
|
106
117
|
cause !== null &&
|
|
@@ -111,6 +122,8 @@ const readFailureIssue = (path, cause) => {
|
|
|
111
122
|
return {
|
|
112
123
|
path: [],
|
|
113
124
|
reason: "invalid_value",
|
|
114
|
-
message:
|
|
125
|
+
message: cause instanceof NonRegularFileReadError && cause.code === "ENOTFILE"
|
|
126
|
+
? `The JSON input must be a regular file${code}: ${path ?? ""}`
|
|
127
|
+
: `The JSON input file could not be read${code}: ${path ?? ""}`,
|
|
115
128
|
};
|
|
116
129
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "incur";
|
|
2
|
+
import { javaScriptAnalysisResourceControlsSchema } from "./domain/javascript/javascriptAnalysisResourceControls.js";
|
|
2
3
|
/** Accept an agent-selected browser observation duration without an artificial ceiling. */
|
|
3
4
|
export const observationDuration = (fallback, minimum = 0) => z
|
|
4
5
|
.number()
|
|
@@ -53,8 +54,14 @@ export const electronPageInspectionOptions = z.object({
|
|
|
53
54
|
.describe("Include JavaScript source text"),
|
|
54
55
|
});
|
|
55
56
|
export const javascriptApplicationOptions = z.object({
|
|
57
|
+
maxHeapMb: javaScriptAnalysisResourceControlsSchema.shape.max_heap_mb,
|
|
58
|
+
analysisTimeoutMs: javaScriptAnalysisResourceControlsSchema.shape.analysis_timeout_ms,
|
|
56
59
|
artifactFormat: z
|
|
57
60
|
.enum(["auto", "asar", "directory"])
|
|
58
61
|
.default("auto")
|
|
59
62
|
.describe("Application artifact format"),
|
|
63
|
+
integrityPolicy: z
|
|
64
|
+
.enum(["fail", "record-and-continue"])
|
|
65
|
+
.default("fail")
|
|
66
|
+
.describe("Behavior when declared application integrity does not match"),
|
|
60
67
|
});
|