rea-agents 6.0.0 → 6.2.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 +26 -18
- package/bridge/android/ReaJadxBridge.java +14 -5
- package/bridge/ghidra/ReaGhidraBridge.java +205 -51
- package/bridge/hopper_bridge.py +314 -127
- package/bridge/mitmproxy/capture.py +0 -2
- package/bridge/native/rea_lldb_tracer.py +630 -94
- package/bridge/process/ProcessRunTokenReader.swift +39 -5
- package/bridge/pwntools/recorded_crash_impl.py +4 -0
- package/dist/android/JadxConfiguration.js +274 -31
- package/dist/android/JadxMcpTransport.js +18 -2
- package/dist/android/JadxProtocol.js +6 -0
- package/dist/android/JadxProvider.js +76 -37
- package/dist/android/JadxSession.js +23 -4
- package/dist/application/AnalysisContextQueries.js +8 -35
- package/dist/application/AnalysisDocument.js +32 -0
- package/dist/application/AppBundleExecutable.js +67 -21
- package/dist/application/BinaryTargetResolver.js +5 -3
- package/dist/application/BrowserEvidence.js +3 -8
- package/dist/application/BrowserScenarioEvidence.js +2 -18
- package/dist/application/CallPathTracing.js +19 -3
- package/dist/application/CapabilityInventory.js +48 -11
- package/dist/application/ClientConfigurationDocument.js +917 -8
- package/dist/application/ClientRegistrationIdentity.js +26 -5
- package/dist/application/ClientRegistrationStatus.js +29 -14
- package/dist/application/DirectAnalysis.js +56 -51
- package/dist/application/DirectAnalysisCleanup.js +72 -0
- package/dist/application/DirectAnalysisStatus.js +4 -5
- package/dist/application/Doctor.js +19 -21
- package/dist/application/DoctorDiagnostics.js +1 -2
- package/dist/application/DoctorScope.js +25 -13
- package/dist/application/EnhancedLiteralTracing.js +22 -25
- package/dist/application/EnhancedTools.js +64 -17
- package/dist/application/EvidenceBundleFiles.js +30 -13
- package/dist/application/FunctionAnalysisEvidence.js +2 -3
- package/dist/application/InventoryProjectionEvidence.js +4 -3
- package/dist/application/InvestigationProviders.js +11 -2
- package/dist/application/JsonFiles.js +83 -28
- package/dist/application/LinuxHopper.js +9 -6
- package/dist/application/MacHopper.js +15 -18
- package/dist/application/ProcedureAddressResolution.js +11 -0
- package/dist/application/RealHopperAssertions.js +0 -11
- package/dist/application/ReconstructionCoverageService.js +7 -4
- package/dist/application/ReconstructionObligationCandidates.js +1 -1
- package/dist/application/ReconstructionObligationLedgerService.js +4 -3
- package/dist/application/ReferenceSourceImportEntries.js +1 -1
- package/dist/application/Setup.js +21 -17
- package/dist/application/SetupClientConfiguration.js +10 -15
- package/dist/application/SetupHost.js +21 -29
- package/dist/application/SetupPlan.js +11 -9
- package/dist/application/SupportedClients.js +34 -1
- package/dist/application/Uninstall.js +82 -29
- package/dist/application/Update.js +18 -3
- package/dist/application/UpdateMaintenance.js +7 -5
- package/dist/application/UpdateRuntime.js +57 -36
- package/dist/application/WebModuleTraceService.js +4 -2
- package/dist/application/WebNetworkCaptureService.js +4 -2
- package/dist/application/WebRuntimeService.js +5 -3
- package/dist/application/WebScriptExportService.js +32 -6
- package/dist/application/WebSourceLocationService.js +4 -2
- package/dist/application/WorkflowEvidence.js +105 -0
- package/dist/application/XrefsAddressResolution.js +45 -0
- package/dist/application/analysisView/AnalysisViewService.js +76 -0
- package/dist/application/binary/AnalysisClientCleanup.js +30 -5
- package/dist/application/binary/AnalysisProviderEvaluation.js +22 -7
- package/dist/application/binary/AnalysisProviderRegistry.js +4 -6
- package/dist/application/binary/AnalysisSnapshotCache.js +13 -14
- package/dist/application/binary/BinarySession.js +161 -93
- package/dist/application/binary/BinarySessionComposition.js +1 -3
- package/dist/application/binary/BinarySessionExecution.js +3 -5
- package/dist/application/binary/BinarySessionOpen.js +4 -4
- package/dist/application/binary/BinarySessionRecords.js +26 -4
- package/dist/application/binary/BinarySessionStatus.js +18 -7
- package/dist/application/binary/CompositeProvider.js +16 -17
- package/dist/application/binary/LazyAnalysisProvider.js +8 -5
- package/dist/application/binary/SessionProviderRouter.js +27 -135
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +4 -2
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +4 -2
- package/dist/application/evm/EvmInterfaceService.js +4 -2
- package/dist/application/homebrew.js +48 -0
- package/dist/application/investigation/EvidenceLedger.js +21 -7
- package/dist/application/investigation/InvestigationRecords.js +8 -0
- package/dist/application/javascript/ElectronActiveEvidence.js +9 -13
- package/dist/application/javascript/JavaScriptAnalysisControl.js +34 -0
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +21 -4
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +19 -2
- package/dist/application/javascript/JavaScriptApplicationService.js +27 -15
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +5 -5
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +10 -7
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +44 -10
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +11 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +9 -0
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +8 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +12 -3
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +0 -1
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +49 -19
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +56 -8
- package/dist/application/javascript/JavaScriptModuleRelationships.js +38 -9
- package/dist/application/javascript/JavaScriptRecoveryService.js +4 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +6 -4
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +63 -61
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +1 -2
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +1 -5
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +75 -46
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +64 -19
- package/dist/application/managed/ManagedApplicationGraphService.js +4 -3
- package/dist/application/managed/ManagedMemberComparisonService.js +9 -5
- package/dist/application/managed/ManagedNativeVerificationService.js +6 -4
- package/dist/application/managed/ManagedReconstructionService.js +4 -3
- package/dist/application/process/ProcessCli.js +25 -17
- package/dist/application/process/ProcessEvidence.js +4 -4
- package/dist/application/workflowInputError.js +18 -0
- package/dist/artifacts/ArtifactProvider.js +48 -13
- package/dist/artifacts/ArtifactReader.js +31 -0
- package/dist/artifacts/DirectoryArtifactReader.js +2 -1
- package/dist/artifacts/MachOSliceArtifactReader.js +106 -15
- package/dist/artifacts/NativeDmgArtifactReader.js +73 -21
- package/dist/artifacts/SafeOutputTree.js +16 -2
- package/dist/artifacts/ZipArtifactReader.js +11 -4
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +26 -5
- package/dist/artifacts/apple/DylibResolutionReader.js +17 -7
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +176 -56
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +195 -0
- package/dist/artifacts/apple/KeyedArchiveReader.js +55 -23
- package/dist/artifacts/apple/MachoLoadCommandReader.js +92 -31
- package/dist/artifacts/apple/NibArchive.js +81 -14
- package/dist/artifacts/apple/NibViewHierarchy.js +10 -3
- package/dist/artifacts/apple/PlistNumberLiterals.js +164 -0
- package/dist/artifacts/extraction/ArtifactExtraction.js +78 -21
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +79 -68
- package/dist/artifacts/inventory/ArtifactInventory.js +0 -1
- package/dist/artifacts/inventory/reader.js +3 -3
- package/dist/artifacts/inventory/scanCanonical.js +59 -38
- package/dist/artifacts/inventory/scanReader.js +5 -9
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +6 -2
- package/dist/browser/BrowserScenarioPartialObservation.js +106 -0
- package/dist/browser/CdpBrowserProvider.js +2 -3
- package/dist/browser/CdpCaptureCompleteness.js +2 -0
- package/dist/browser/CdpCaptureEventHandlers.js +78 -15
- package/dist/browser/CdpCaptureEventTypes.js +5 -1
- package/dist/browser/CdpCaptureEvents.js +25 -1
- package/dist/browser/CdpCaptureValues.js +20 -0
- package/dist/browser/CdpConnection.js +30 -11
- package/dist/browser/CdpElectronProvider.js +0 -2
- package/dist/browser/CdpElectronScriptEvents.js +2 -8
- package/dist/browser/CdpElectronScripts.js +2 -3
- package/dist/browser/CdpOptionalCommand.js +2 -3
- package/dist/browser/CdpPageCapture.js +23 -1
- package/dist/browser/CdpPageCaptureScripts.js +2 -3
- package/dist/browser/CdpSafeMetadata.js +10 -10
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +59 -44
- package/dist/browser/PlaywrightElectronActiveActions.js +34 -79
- package/dist/browser/PlaywrightElectronActiveProjection.js +141 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +133 -130
- package/dist/browser/PlaywrightScenarioArtifacts.js +1 -1
- package/dist/browser/PlaywrightScenarioBrowser.js +139 -39
- package/dist/browser/PlaywrightScenarioEvents.js +1 -1
- package/dist/browser/PlaywrightScenarioSession.js +39 -22
- package/dist/browser/WebSourceMapFetcher.js +426 -72
- package/dist/browser/assets/LocalWebScriptArtifacts.js +2 -2
- package/dist/browser/assets/ScriptCaptureAdapters.js +1 -1
- package/dist/browser/history/CaptureFailures.js +41 -1
- package/dist/browser/history/CaptureRelease.js +5 -0
- package/dist/browser/history/HarCaptureAdapter.js +3 -3
- package/dist/browser/history/HarJson.js +3 -2
- package/dist/browser/history/HistoricalCaptureDecoder.js +4 -2
- package/dist/browser/history/MitmproxyCaptureAdapter.js +4 -2
- package/dist/catalogIdentity.js +0 -1
- package/dist/cli/analysisSelector.js +23 -0
- package/dist/cli/analysisViewCommands.js +36 -0
- package/dist/cli/applicationCommands.js +2 -3
- package/dist/cli/artifactCommands.js +11 -12
- package/dist/cli/coreAnalysisCommands.js +3 -3
- package/dist/cli/coreBinaryCommands.js +100 -37
- package/dist/cli/coreNativeCommands.js +9 -10
- package/dist/cli/electronCommands.js +10 -9
- package/dist/cli/interactiveSetup.js +6 -6
- package/dist/cli/javascriptApplicationAnalysis.js +7 -3
- package/dist/cli/jsonOutput.js +4 -99
- package/dist/cli/managedCommands.js +7 -8
- package/dist/cli/nativeCallCommands.js +3 -5
- package/dist/cli/omittableDefaults.js +50 -0
- package/dist/cli/processCommands.js +3 -2
- package/dist/cli/setupCommands.js +16 -15
- package/dist/cli/utilityCommands.js +9 -9
- package/dist/cli/webRuntimeCommands.js +8 -8
- package/dist/cli.js +18 -9
- package/dist/cliBrowserScenarioCommands.js +2 -2
- package/dist/cliCommandNames.js +1 -1
- package/dist/cliJsonInput.js +24 -5
- package/dist/cliOutput.js +0 -38
- package/dist/composition/auxiliaryAnalysisProviders.js +27 -23
- package/dist/composition/binary.js +9 -9
- package/dist/composition/browserScenario.js +2 -1
- package/dist/composition/directAnalysis.js +20 -13
- package/dist/composition/electronScenario.js +1 -1
- package/dist/composition/optionalObservationProviders.js +12 -7
- package/dist/config/environment.js +10 -0
- package/dist/config/ghidraStartupTimeout.js +12 -0
- package/dist/config/homeDirectory.js +12 -0
- package/dist/config/mcpResponseBudget.js +30 -0
- package/dist/config/parseConfig.js +8 -3
- package/dist/config/parsers.js +19 -22
- package/dist/contracts/analysisViewToolContracts.js +56 -0
- package/dist/contracts/applicationToolContracts.js +5 -4
- package/dist/contracts/artifactComparisonExample.js +2 -2
- package/dist/contracts/artifactToolContracts.js +1 -1
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/browserToolContracts.js +19 -15
- package/dist/contracts/enhancedInputs.js +7 -5
- package/dist/contracts/enhancedToolContracts.js +7 -6
- package/dist/contracts/evm/evmToolContracts.js +1 -1
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/hopperMemoryContracts.js +2 -5
- package/dist/contracts/inputSchemaPresentation.js +90 -0
- package/dist/contracts/investigationExamples.js +4 -3
- package/dist/contracts/javascript/electronToolContracts.js +2 -2
- package/dist/contracts/javascript/javascriptApplicationWorkflowExamples.js +0 -20
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +245 -0
- package/dist/contracts/javascript/javascriptRuntimeObservationToolContracts.js +1 -1
- package/dist/contracts/managed/managedToolContracts.js +7 -14
- package/dist/contracts/managed/managedWorkflowToolContracts.js +1 -1
- package/dist/contracts/mobileApplicationGraphExamples.js +3 -3
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +1 -1
- package/dist/contracts/native/nativeToolContracts.js +5 -3
- package/dist/contracts/officialToolContracts.js +16 -16
- package/dist/contracts/promptContracts.js +5 -5
- package/dist/contracts/providerSelection.js +1 -1
- package/dist/contracts/sessionLifecycleInputs.js +3 -7
- package/dist/contracts/sessionStatusContract.js +2 -4
- package/dist/contracts/sessionToolContracts.js +18 -8
- package/dist/contracts/sessionToolSchemas.js +3 -19
- package/dist/contracts/toolContractExamples.js +0 -1
- package/dist/contracts/toolContractHelpers.js +4 -1
- package/dist/contracts/toolContracts.js +2 -0
- package/dist/contracts/toolEffects.js +1 -1
- package/dist/contracts/toolOutputSchemaGroups.js +160 -115
- package/dist/contracts/toolOutputSchemaPrimitives.js +28 -20
- package/dist/contracts/toolSchemaMetadata.js +41 -33
- package/dist/contracts/webNetworkCaptureToolContracts.js +2 -2
- package/dist/contracts/webRuntimeToolContracts.js +1 -1
- package/dist/contracts/webScriptToolContracts.js +1 -1
- package/dist/doctorRuntime.js +7 -5
- package/dist/domain/analysisErrorBase.js +8 -3
- package/dist/domain/analysisErrorCore.js +6 -1
- package/dist/domain/analysisErrorPresentation.js +90 -20
- package/dist/domain/analysisErrorProjection.js +130 -32
- package/dist/domain/analysisSnapshot.js +29 -31
- package/dist/domain/analysisView/analysisView.js +243 -0
- package/dist/domain/analysisView/analysisViewCoverage.js +19 -0
- package/dist/domain/analysisView/binaryLayoutView.js +159 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +238 -0
- package/dist/domain/android/androidAnalysis.js +2 -4
- package/dist/domain/android/androidApplication.js +18 -10
- package/dist/domain/apple/appleApplication.js +42 -15
- package/dist/domain/apple/dyldEnvironment.js +73 -0
- package/dist/domain/apple/dylibResolution.js +130 -12
- package/dist/domain/apple/dylibResolutionFindings.js +9 -7
- package/dist/domain/apple/interfaceBuilderGraph.js +25 -14
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +13 -3
- package/dist/domain/apple/keyedArchive.js +35 -3
- package/dist/domain/apple/machoContainer.js +54 -0
- package/dist/domain/apple/plistNumbers.js +76 -0
- package/dist/domain/artifactComparison.js +15 -6
- package/dist/domain/artifactGraph.js +16 -3
- package/dist/domain/artifactIdentity.js +29 -0
- package/dist/domain/artifactInventoryEvidence.js +28 -40
- package/dist/domain/artifactOperationError.js +3 -3
- package/dist/domain/artifactPartialObservation.js +1 -0
- package/dist/domain/artifactPathSyntax.js +49 -0
- package/dist/domain/binaryTarget.js +39 -13
- package/dist/domain/bridgeCandidateProjection.js +71 -0
- package/dist/domain/browserCaptureComparison.js +13 -49
- package/dist/domain/browserCompleteness.js +1 -0
- package/dist/domain/browserNetworkEvidence.js +10 -4
- package/dist/domain/browserObservation.js +0 -1
- package/dist/domain/browserObservationError.js +24 -5
- package/dist/domain/browserObservationSchemas.js +14 -3
- package/dist/domain/browserScenario.js +0 -1
- package/dist/domain/browserScenarioCapture.js +1 -2
- package/dist/domain/browserScenarioDiff.js +0 -2
- package/dist/domain/browserScenarioDiffEvidence.js +0 -12
- package/dist/domain/browserScenarioDiffValues.js +2 -2
- package/dist/domain/browserScenarioValues.js +5 -10
- package/dist/domain/bundleComparison.js +3 -2
- package/dist/domain/callPath.js +8 -9
- package/dist/domain/callPathSchemas.js +2 -2
- package/dist/domain/canonicalJsonDigestSteps.js +133 -0
- package/dist/domain/canonicalOrdering.js +9 -5
- package/dist/domain/changedBehavior.js +9 -9
- package/dist/domain/comparisonSourceEvidence.js +40 -0
- package/dist/domain/completionLedgerGeneration.js +2 -1
- package/dist/domain/configurationErrors.js +13 -1
- package/dist/domain/conformancePackage.js +4 -3
- package/dist/domain/evidence.js +65 -36
- package/dist/domain/evidenceBundle.js +47 -8
- package/dist/domain/evidenceCompletionLedger.js +2 -1
- package/dist/domain/evidenceErrors.js +12 -1
- package/dist/domain/explicitSensitiveFailure.js +17 -1
- package/dist/domain/firmware/firmwareAnalysis.js +6 -7
- package/dist/domain/functionComparison.js +4 -5
- package/dist/domain/functionComparisonDimensions.js +120 -87
- package/dist/domain/functionComparisonNormalization.js +23 -34
- package/dist/domain/functionComparisonResults.js +1 -4
- package/dist/domain/functionComparisonSchemas.js +2 -8
- package/dist/domain/functionDossierEvidence.js +2 -37
- package/dist/domain/hopperErrors.js +23 -2
- package/dist/domain/hopperValues.js +51 -8
- package/dist/domain/immutableJson.js +114 -0
- package/dist/domain/inputIssueProjection.js +3 -0
- package/dist/domain/javascript/electronActiveObservation.js +47 -64
- package/dist/domain/javascript/electronObservation.js +14 -3
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +10 -9
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +2 -1
- package/dist/domain/javascript/electronStaticAnalysisNative.js +2 -1
- package/dist/domain/javascript/electronStaticAnalysisValues.js +6 -12
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +71 -23
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +2 -0
- package/dist/domain/javascript/javascriptApplicationGraph.js +39 -3
- package/dist/domain/javascript/javascriptApplicationGraphSchemas.js +9 -2
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +5 -2
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +2 -1
- package/dist/domain/javascript/javascriptAstValues.js +20 -0
- package/dist/{application/javascript/JavaScriptReturnShapeProjection.js → domain/javascript/javascriptExportReturnShapeProjection.js} +4 -4
- package/dist/domain/javascript/javascriptExportShapeComparison.js +7 -1
- package/dist/domain/javascript/javascriptExportShapeComparisonIdentity.js +6 -1
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +29 -1
- package/dist/domain/javascript/javascriptExportShapeSelection.js +5 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +67 -14
- package/dist/domain/javascript/javascriptFeatureSeed.js +20 -0
- package/dist/domain/javascript/javascriptFeatureTraversal.js +0 -1
- package/dist/domain/javascript/javascriptNativeHandoff.js +1 -1
- package/dist/domain/javascript/javascriptRecovery.js +3 -8
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +0 -1
- package/dist/domain/javascript/javascriptRuntimeObservation.js +10 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +1 -1
- package/dist/domain/javascript/javascriptRuntimeReconciliationParsing.js +3 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +0 -1
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +106 -5
- package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +2 -1
- package/dist/domain/javascript/javascriptSemanticCalls.js +2 -1
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +2 -1
- package/dist/domain/javascript/javascriptSemanticCoverage.js +6 -5
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +9 -17
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +23 -6
- package/dist/domain/javascript/javascriptSemanticGraph.js +98 -43
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +1 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +77 -20
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +21 -27
- package/dist/domain/javascript/javascriptSemanticObjects.js +83 -42
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +18 -21
- package/dist/domain/javascript/javascriptSemanticProjection.js +2 -3
- package/dist/domain/javascript/javascriptSemanticPromises.js +2 -1
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -4
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +77 -0
- package/dist/domain/javascript/javascriptSemanticResources.js +1 -1
- package/dist/domain/javascript/javascriptSemanticReturns.js +32 -17
- package/dist/domain/javascript/javascriptSemanticSlots.js +72 -0
- package/dist/domain/javascript/javascriptSemanticValues.js +126 -61
- package/dist/domain/javascript/javascriptSourceMapPaths.js +104 -0
- package/dist/domain/javascript/javascriptSourceParser.js +6 -2
- package/dist/domain/javascript/javascriptStaticAnalysis.js +22 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +5 -3
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +16 -5
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +66 -7
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +28 -17
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +3 -2
- package/dist/domain/javascript/sourceToBundleComparison.js +12 -3
- package/dist/domain/javascript/sourceToBundleSignals.js +47 -19
- package/dist/domain/jsonSerialization.js +109 -0
- package/dist/domain/jsonValue.js +90 -6
- package/dist/domain/localPath.js +6 -0
- package/dist/domain/managed/managedApplicationGraph.js +10 -10
- package/dist/domain/managed/managedArtifact.js +6 -4
- package/dist/domain/managed/managedInspectionEvidence.js +16 -0
- package/dist/domain/managed/managedMemberComparison.js +2 -9
- package/dist/domain/managed/managedMemberComparisonMatch.js +5 -9
- package/dist/domain/managed/managedNativeVerification.js +3 -11
- package/dist/domain/managed/managedNativeVerificationMatch.js +9 -3
- package/dist/domain/native/binaryLayout.js +2 -3
- package/dist/domain/native/fileOffsetPartialObservation.js +1 -0
- package/dist/domain/native/nativeApiBoundary.js +1 -1
- package/dist/domain/native/nativeCallObservation.js +37 -13
- package/dist/domain/native/nativeCallPartialObservation.js +33 -0
- package/dist/domain/native/nativeInstruction.js +7 -0
- package/dist/domain/native/recordedCrash.js +2 -3
- package/dist/domain/offsetDateTime.js +17 -0
- package/dist/domain/process/processCapture.js +21 -16
- package/dist/domain/process/processCaptureCoverage.js +67 -0
- package/dist/domain/process/processCaptureExample.js +2 -1
- package/dist/domain/process/processCaptureParsing.js +1 -34
- package/dist/domain/process/processCaptureValidation.js +81 -13
- package/dist/domain/process/processComparison.js +79 -26
- package/dist/domain/process/processObservation.js +10 -2
- package/dist/domain/process/processScenario.js +35 -12
- package/dist/domain/process/processTraceComparison.js +0 -2
- package/dist/domain/process/processTraceDimensionProjection.js +1 -1
- package/dist/domain/process/processTraceEvaluation.js +15 -11
- package/dist/domain/process/processTraceSpecification.js +3 -4
- package/dist/domain/propertyListKeys.js +1 -1
- package/dist/domain/propertyListXmlText.js +19 -0
- package/dist/domain/providerAdapterError.js +3 -1
- package/dist/domain/providerOperationHealth.js +54 -0
- package/dist/domain/reconstructionCoverage.js +5 -2
- package/dist/domain/reconstructionObligationLedgerSchemas.js +2 -1
- package/dist/domain/reconstructionReadinessSchemas.js +2 -1
- package/dist/domain/reconstructionVerification.js +9 -46
- package/dist/domain/reconstructionVerificationSchemas.js +4 -3
- package/dist/domain/referenceSourceGraph.js +20 -21
- package/dist/domain/staticRuntimeCorrelation.js +8 -45
- package/dist/domain/stringPatterns.js +6 -0
- package/dist/domain/swiftSymbolClassification.js +61 -0
- package/dist/domain/symbolAnalysis.js +66 -18
- package/dist/domain/webBundleAnalysis.js +20 -8
- package/dist/domain/webBundleAnalyzerInspection.js +13 -8
- package/dist/domain/webBundleAnalyzerResult.js +41 -2
- package/dist/domain/webCaptureDiff.js +0 -1
- package/dist/domain/webCaptureDiffSchemas.js +6 -3
- package/dist/domain/webEventListeners.js +3 -2
- package/dist/domain/webExecution.js +3 -2
- package/dist/domain/webRuntime.js +19 -7
- package/dist/domain/webScriptExport.js +1 -1
- package/dist/domain/webSourceLocation.js +1 -0
- package/dist/dotnet/ManagedArtifactInspector.js +2 -19
- package/dist/dotnet/ManagedMemberInspector.js +12 -18
- package/dist/dotnet/ManagedMemberInspectorCore.js +47 -44
- package/dist/dotnet/ManagedMemberRows.js +75 -62
- package/dist/dotnet/ManagedMetadataInventory.js +16 -22
- package/dist/dotnet/ManagedMethodBodyReader.js +4 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +109 -94
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +12 -21
- package/dist/dotnet/ManagedReaderFailure.js +16 -0
- package/dist/dotnet/ManagedStaticProvider.js +3 -5
- package/dist/evaluation/AgentEvaluationFixtures.js +250 -0
- package/dist/evaluation/AgentEvaluationReport.js +28 -0
- package/dist/evaluation/CodexAgentEval.js +12 -8
- package/dist/evaluation/KnownAnswerEvaluation.js +281 -0
- package/dist/evm/EvmoleInterfaceProvider.js +2 -1
- package/dist/firmware/FirmwareCommand.js +9 -5
- package/dist/firmware/FirmwareFiles.js +1 -1
- package/dist/firmware/FirmwareProvider.js +4 -4
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +7 -5
- package/dist/ghidra/GhidraClient.js +126 -34
- package/dist/ghidra/GhidraClientStartup.js +0 -2
- package/dist/ghidra/GhidraDiagnostics.js +7 -7
- package/dist/ghidra/GhidraDoctor.js +6 -5
- package/dist/ghidra/GhidraFunctionValues.js +13 -12
- package/dist/ghidra/GhidraInstallation.js +58 -33
- package/dist/ghidra/GhidraInventoryValues.js +14 -4
- package/dist/ghidra/GhidraJavaLaunch.js +66 -0
- package/dist/ghidra/GhidraLauncher.js +47 -22
- package/dist/ghidra/GhidraProvider.js +6 -2
- package/dist/ghidra/GhidraProviderCapabilities.js +20 -2
- package/dist/ghidra/GhidraProviderClient.js +36 -15
- package/dist/ghidra/GhidraSessionError.js +13 -7
- package/dist/ghidra/GhidraSessionRoot.js +39 -0
- package/dist/ghidra/GhidraTargetSnapshot.js +47 -12
- package/dist/ghidra/GhidraTransport.js +20 -0
- package/dist/ghidra/extensions/GhidraExtensions.js +17 -10
- package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +8 -2
- package/dist/hopper/BridgeLauncher.js +65 -56
- package/dist/hopper/HopperAnalysisProfile.js +65 -12
- package/dist/hopper/HopperCleanup.js +63 -22
- package/dist/hopper/HopperClient.js +288 -59
- package/dist/hopper/HopperFileOffset.js +237 -0
- package/dist/hopper/HopperMachOImage.js +197 -0
- package/dist/hopper/HopperOperationStage.js +6 -0
- package/dist/hopper/HopperProvider.js +71 -19
- package/dist/hopper/HopperProviderCapabilities.js +19 -1
- package/dist/hopper/HopperRegexSearch.js +134 -0
- package/dist/hopper/HopperRegexWorker.js +27 -0
- package/dist/hopper/HopperRequestQueue.js +68 -19
- package/dist/hopper/HopperTargetLease.js +133 -49
- package/dist/hopper/LinuxPrivateDisplayProbe.js +6 -0
- package/dist/ida/IdaConfiguration.js +8 -3
- package/dist/ida/IdaInput.js +1 -7
- package/dist/ida/IdaMcpConnection.js +8 -4
- package/dist/ida/IdaOperationRunner.js +3 -3
- package/dist/ida/IdaProvider.js +8 -12
- package/dist/ida/IdaSessionClient.js +20 -18
- package/dist/ida/IdaWorkspace.js +12 -13
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -1
- package/dist/inspector/V8InspectorCaptureProjection.js +9 -4
- package/dist/inspector/V8InspectorProvider.js +82 -36
- package/dist/javascript/recovery/WakaruCommand.js +7 -2
- package/dist/javascript/recovery/WakaruExecution.js +5 -2
- package/dist/javascript/sourceMaps/DecodedSourceMap.js +47 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +16 -0
- package/dist/javascript/sourceMaps/SourceMapFormat.js +79 -31
- package/dist/javascript/sourceMaps/TraceSourceMap.js +14 -28
- package/dist/main/shutdown.js +11 -3
- package/dist/main/startup.js +9 -2
- package/dist/main/transport.js +22 -2
- package/dist/main.js +11 -18
- package/dist/mcpDoctor.js +62 -2
- package/dist/native/AppleDispatchCoverage.js +47 -6
- package/dist/native/AppleDispatchDecodeFacts.js +6 -0
- package/dist/native/AppleDispatchMetadata.js +6 -3
- package/dist/native/AppleMachoFixups.js +48 -24
- package/dist/native/AppleMachoSelection.js +48 -22
- package/dist/native/AppleObjcCategories.js +6 -2
- package/dist/native/AppleObjcDispatchFacets.js +5 -2
- package/dist/native/AppleObjcProperties.js +2 -1
- package/dist/native/AppleSwiftDispatchFacets.js +27 -21
- package/dist/native/AppleSwiftVtables.js +21 -15
- package/dist/native/CommandRunner.js +87 -88
- package/dist/native/LldbCallTracer.js +372 -103
- package/dist/native/LldbRetainedObservations.js +178 -0
- package/dist/native/NativeCallObservation.js +62 -3
- package/dist/native/NativeMacOSProvider.js +122 -31
- package/dist/native/NativeUiHelperRuntime.js +11 -2
- package/dist/native/NativeUiObservation.js +2 -2
- package/dist/native/SignatureTargetBinding.js +155 -0
- package/dist/native/parsers/lipo.js +71 -1
- package/dist/native/pwndbg/PwndbgCoreContext.js +25 -5
- package/dist/native/pwntools/PwntoolsDecoder.js +2 -1
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +2 -0
- package/dist/process/DarwinProcessRunTokenReader.js +23 -10
- package/dist/process/ExecFileOutput.js +108 -6
- package/dist/process/OwnedCommand.js +7 -2
- package/dist/process/PrivateRuntimeRoot.js +10 -5
- package/dist/process/ProcessOwnership.js +204 -57
- package/dist/process/ProcessOwnershipObservation.js +60 -9
- package/dist/process/ProviderProcess.js +39 -10
- package/dist/process/capture/FilesystemSnapshot.js +50 -13
- package/dist/process/capture/ProcessCaptureError.js +15 -2
- package/dist/process/capture/ProcessCaptureLifecycle.js +235 -81
- package/dist/process/capture/ProcessFilesystemEffects.js +33 -3
- package/dist/process/capture/ProcessHarness.js +21 -25
- package/dist/process/capture/ProcessNormalization.js +20 -2
- package/dist/process/capture/ProcessSampling.js +25 -2
- package/dist/process/capture/TerminalRenderer.js +14 -0
- package/dist/process/snapshotEnvironment.js +14 -0
- package/dist/server/EvidenceMcpServer.js +157 -0
- package/dist/server/createServer.js +61 -41
- package/dist/server/mcpClientMetadata.js +12 -5
- package/dist/server/promptCompletion.js +3 -8
- package/dist/server/registerAnalysisViewTool.js +15 -0
- package/dist/server/registerAndroidTools.js +2 -5
- package/dist/server/registerApplicationTools/compareExportShapes.js +4 -5
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +4 -5
- package/dist/server/registerApplicationTools/coverage.js +1 -2
- package/dist/server/registerApplicationTools/helpers.js +1 -4
- package/dist/server/registerApplicationTools/obligationLedger.js +4 -5
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -4
- package/dist/server/registerApplicationTools/traceFeature.js +4 -5
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +13 -10
- package/dist/server/registerBinaryDiagnosticsTools.js +2 -5
- package/dist/server/registerBrowserScenarioTool.js +3 -6
- package/dist/server/registerBrowserTools.js +13 -18
- package/dist/server/registerBundleComparisonTool.js +5 -7
- package/dist/server/registerCloseLifecycleTool.js +9 -20
- package/dist/server/registerElectronTools.js +10 -15
- package/dist/server/registerEnhancedTools.js +36 -77
- package/dist/server/registerEvidenceTools.js +3 -6
- package/dist/server/registerEvmTools.js +2 -5
- package/dist/server/registerFirmwareTools.js +2 -5
- package/dist/server/registerFunctionComparisonTool.js +15 -12
- package/dist/server/registerInvestigationTools.js +16 -17
- package/dist/server/registerJavaScriptRecoveryTool.js +2 -5
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +6 -8
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +5 -8
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +4 -7
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +6 -9
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +6 -9
- package/dist/server/registerOfficialTools.js +4 -21
- package/dist/server/registerProcessComparisonTool.js +74 -48
- package/dist/server/registerRecordedCrashTools.js +2 -5
- package/dist/server/registerSessionRecordTools.js +19 -24
- package/dist/server/registerSessionStatusTool.js +19 -6
- package/dist/server/registerSessionTools.js +20 -18
- package/dist/server/registerWebModuleTool.js +2 -5
- package/dist/server/registerWebNetworkCaptureTool.js +2 -5
- package/dist/server/registerWebRuntimeTools.js +4 -9
- package/dist/server/registerWebScriptTool.js +2 -5
- package/dist/server/registerWebSourceLocationTool.js +2 -5
- package/dist/server/runDerivedOperation.js +15 -3
- package/dist/server/sessionAvailabilityPolicy.js +0 -1
- package/dist/server/toolRegistrationOptions.js +2 -2
- package/dist/server/toolResult.js +75 -51
- package/dist/server/toolResultEncoding.js +34 -0
- package/dist/windows/WindowsNativeLoader.js +1 -0
- package/dist/windows/WindowsOwnedProcess.js +60 -15
- package/dist/windows/WindowsPrivateRuntime.js +7 -8
- package/install.sh +1 -1
- package/native/windows/README.md +3 -1
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +44 -30
- package/scripts/electron-active-hook-boundaries.cjs +18 -20
- package/scripts/electron-active-hook.cjs +241 -37
- package/scripts/rea.mjs +3 -6
- package/skills/reverse-engineer-anything/SKILL.md +12 -3
- package/skills/reverse-engineer-anything/references/android-applications.md +6 -3
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -4
- package/skills/reverse-engineer-anything/references/javascript-applications.md +20 -3
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +9 -0
- package/dist/config.js +0 -1
- package/dist/contracts/browserCaptureToolInputSchema.js +0 -43
- package/dist/contracts/process/processCaptureExample.js +0 -2
- package/dist/contracts/toolOutputSchemas.js +0 -2
- package/dist/ghidra/GhidraDefaults.js +0 -2
- package/dist/main/reload.js +0 -12
- package/dist/main/state.js +0 -3
- package/dist/server/sessionToolPolicies.js +0 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { WEB_SOURCE_MAP_LIMITS } from "../../domain/webSourceLocation.js";
|
|
3
|
+
import { hasValidSourceMapContents } from "../../domain/sourceMapContents.js";
|
|
3
4
|
const leafSchema = z.object({
|
|
4
5
|
version: z.literal(3),
|
|
5
6
|
file: z.string().nullable().optional(),
|
|
@@ -48,9 +49,21 @@ const addOffset = (base, offset) => {
|
|
|
48
49
|
throw new SourceMapFormatFailure("limit", "Indexed offset exceeds the 262144 generated-row decoder budget.");
|
|
49
50
|
return result;
|
|
50
51
|
};
|
|
51
|
-
const
|
|
52
|
+
const consumeRecords = (budget, count) => {
|
|
53
|
+
if (count > WEB_SOURCE_MAP_LIMITS.decodedRecords - budget.records)
|
|
54
|
+
throw new SourceMapFormatFailure("limit", `Source-map structure exceeds the ${WEB_SOURCE_MAP_LIMITS.decodedRecords}-record decoder budget.`);
|
|
55
|
+
budget.records += count;
|
|
56
|
+
};
|
|
57
|
+
const addSections = (node, pending, budget, options) => {
|
|
58
|
+
options.check?.();
|
|
59
|
+
const header = mapHeaderSchema.parse(node.value);
|
|
60
|
+
if (!Array.isArray(header.sections))
|
|
61
|
+
throw new SourceMapFormatFailure("format", "Indexed source-map sections must be an array.");
|
|
62
|
+
consumeRecords(budget, header.sections.length);
|
|
52
63
|
const sections = indexedSchema.parse(node.value).sections;
|
|
53
64
|
for (const [index, section] of sections.entries()) {
|
|
65
|
+
if ((index & 255) === 0)
|
|
66
|
+
options.check?.();
|
|
54
67
|
const previous = sections[index - 1];
|
|
55
68
|
if (previous !== undefined && compare(section.offset, previous.offset) <= 0)
|
|
56
69
|
throw new SourceMapFormatFailure("format", "Indexed section offsets must be strictly increasing.");
|
|
@@ -81,7 +94,7 @@ const addSections = (node, pending) => {
|
|
|
81
94
|
});
|
|
82
95
|
}
|
|
83
96
|
};
|
|
84
|
-
const inspectMappingLayout = (mappings) => {
|
|
97
|
+
const inspectMappingLayout = (mappings, check) => {
|
|
85
98
|
let lines = 1;
|
|
86
99
|
let segments = 0;
|
|
87
100
|
let components = 0;
|
|
@@ -94,7 +107,10 @@ const inspectMappingLayout = (mappings) => {
|
|
|
94
107
|
if (inSegment && ![1, 4, 5].includes(components))
|
|
95
108
|
throw new SourceMapFormatFailure("format", "Source-map segment requires one, four or five VLQ components.");
|
|
96
109
|
};
|
|
110
|
+
let index = 0;
|
|
97
111
|
for (const character of mappings) {
|
|
112
|
+
if ((index++ & 0x3fff) === 0)
|
|
113
|
+
check?.();
|
|
98
114
|
if (character === "," || character === ";") {
|
|
99
115
|
finish();
|
|
100
116
|
inSegment = false;
|
|
@@ -123,6 +139,35 @@ const inspectMappingLayout = (mappings) => {
|
|
|
123
139
|
finish();
|
|
124
140
|
return { lines, segments };
|
|
125
141
|
};
|
|
142
|
+
const inspectLeaf = (node, budget, options) => {
|
|
143
|
+
options.check?.();
|
|
144
|
+
consumeRecords(budget, 1);
|
|
145
|
+
if (typeof node.value !== "object" ||
|
|
146
|
+
node.value === null ||
|
|
147
|
+
Array.isArray(node.value))
|
|
148
|
+
return leafSchema.parse(node.value);
|
|
149
|
+
const rawMap = node.value;
|
|
150
|
+
const rawSources = rawMap.sources;
|
|
151
|
+
const rawNames = rawMap.names;
|
|
152
|
+
const rawContents = rawMap.sourcesContent;
|
|
153
|
+
consumeRecords(budget, Array.isArray(rawSources) ? rawSources.length : 0);
|
|
154
|
+
consumeRecords(budget, Array.isArray(rawNames) ? rawNames.length : 0);
|
|
155
|
+
consumeRecords(budget, Array.isArray(rawContents) ? rawContents.length : 0);
|
|
156
|
+
options.check?.();
|
|
157
|
+
if (options.profile === "browser-collection" && !Array.isArray(rawNames))
|
|
158
|
+
throw new SourceMapFormatFailure("format", "Source-map leaf requires a names array.");
|
|
159
|
+
if (options.profile === "browser-collection" &&
|
|
160
|
+
!hasValidSourceMapContents(Array.isArray(rawSources) ? rawSources.length : 0, rawContents))
|
|
161
|
+
throw new SourceMapFormatFailure("format", "Source-map sourcesContent must align with its source declarations.");
|
|
162
|
+
options.check?.();
|
|
163
|
+
const leaf = leafSchema.parse(node.value);
|
|
164
|
+
const layout = inspectMappingLayout(leaf.mappings, options.check);
|
|
165
|
+
consumeRecords(budget, layout.segments + layout.lines);
|
|
166
|
+
if (layout.segments > WEB_SOURCE_MAP_LIMITS.decodedSegments ||
|
|
167
|
+
node.offset.line + layout.lines > WEB_SOURCE_MAP_LIMITS.decodedRows)
|
|
168
|
+
throw new SourceMapFormatFailure("limit", "Source-map layout exceeds the 262144 segment/generated-row decoder budget.");
|
|
169
|
+
return leaf;
|
|
170
|
+
};
|
|
126
171
|
/** Validate structure before allocation, retaining raw declarations and section boundaries. */
|
|
127
172
|
export const inspectSourceMap = (text) => {
|
|
128
173
|
const withoutBom = text.replace(/^\uFEFF/u, "");
|
|
@@ -130,53 +175,56 @@ export const inspectSourceMap = (text) => {
|
|
|
130
175
|
? withoutBom.slice(withoutBom.indexOf("\n") + 1)
|
|
131
176
|
: withoutBom;
|
|
132
177
|
const value = JSON.parse(jsonText);
|
|
178
|
+
const inspected = inspectSourceMapValue(value);
|
|
179
|
+
const normalized = inspected.format === "regular"
|
|
180
|
+
? inspected.leaves[0]?.map
|
|
181
|
+
: {
|
|
182
|
+
version: 3,
|
|
183
|
+
sections: inspected.leaves.map((leaf) => ({
|
|
184
|
+
offset: leaf.offset,
|
|
185
|
+
map: leaf.map,
|
|
186
|
+
})),
|
|
187
|
+
};
|
|
188
|
+
return {
|
|
189
|
+
jsonText: JSON.stringify(normalized),
|
|
190
|
+
...inspected,
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
/** Return validated leaves when a consumer needs decoded rows after preflight. */
|
|
194
|
+
export const inspectSourceMapValue = (value, options = {}) => {
|
|
195
|
+
options.check?.();
|
|
133
196
|
const root = mapHeaderSchema.parse(value);
|
|
134
197
|
const declarations = [];
|
|
135
198
|
const leaves = [];
|
|
136
199
|
const pending = [
|
|
137
200
|
{ value, path: [], offset: { line: 0, column: 0 }, stop: null },
|
|
138
201
|
];
|
|
139
|
-
|
|
202
|
+
const budget = options.budget ?? { records: 0 };
|
|
140
203
|
while (pending.length > 0) {
|
|
204
|
+
options.check?.();
|
|
141
205
|
const node = pending.pop();
|
|
142
206
|
if (node === undefined)
|
|
143
207
|
break;
|
|
144
208
|
if (node.path.length > WEB_SOURCE_MAP_LIMITS.sectionDepth)
|
|
145
209
|
throw new SourceMapFormatFailure("limit", "Indexed source-map nesting exceeds the 64-level decoder stack budget.");
|
|
146
210
|
if (mapHeaderSchema.parse(node.value).sections !== undefined) {
|
|
147
|
-
addSections(node, pending);
|
|
211
|
+
addSections(node, pending, budget, options);
|
|
148
212
|
continue;
|
|
149
213
|
}
|
|
150
|
-
const leaf =
|
|
151
|
-
const layout = inspectMappingLayout(leaf.mappings);
|
|
152
|
-
segmentCount += layout.segments;
|
|
153
|
-
if (segmentCount > WEB_SOURCE_MAP_LIMITS.decodedSegments ||
|
|
154
|
-
node.offset.line + layout.lines > WEB_SOURCE_MAP_LIMITS.decodedRows)
|
|
155
|
-
throw new SourceMapFormatFailure("limit", "Source-map layout exceeds the 262144 segment/generated-row decoder budget.");
|
|
214
|
+
const leaf = inspectLeaf(node, budget, options);
|
|
156
215
|
leaves.push({ map: leaf, offset: node.offset, stop: node.stop });
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
216
|
+
if (options.profile !== "browser-collection")
|
|
217
|
+
for (const [sourceIndex, source] of leaf.sources.entries())
|
|
218
|
+
declarations.push({
|
|
219
|
+
sectionPath: node.path,
|
|
220
|
+
sourceIndex,
|
|
221
|
+
source,
|
|
222
|
+
root: leaf.sourceRoot ?? null,
|
|
223
|
+
content: leaf.sourcesContent?.[sourceIndex] ?? null,
|
|
224
|
+
ignored: (leaf.ignoreList ?? leaf.x_google_ignoreList ?? []).includes(sourceIndex),
|
|
225
|
+
});
|
|
166
226
|
}
|
|
167
|
-
// Absolute leaves adapt nested first-line column offsets before upstream AnyMap.
|
|
168
|
-
// Raw map bytes and the original section/source identities are retained separately.
|
|
169
|
-
const normalized = root.sections === undefined
|
|
170
|
-
? leaves[0]?.map
|
|
171
|
-
: {
|
|
172
|
-
version: 3,
|
|
173
|
-
sections: leaves.map((leaf) => ({
|
|
174
|
-
offset: leaf.offset,
|
|
175
|
-
map: leaf.map,
|
|
176
|
-
})),
|
|
177
|
-
};
|
|
178
227
|
return {
|
|
179
|
-
jsonText: JSON.stringify(normalized),
|
|
180
228
|
format: root.sections === undefined ? "regular" : "indexed",
|
|
181
229
|
reportedFile: root.file ?? null,
|
|
182
230
|
declarations,
|
|
@@ -6,10 +6,21 @@ import { z } from "zod";
|
|
|
6
6
|
import { webSourceOffset } from "../../domain/webSourcePosition.js";
|
|
7
7
|
import { webSourceMapReportSchema, WEB_SOURCE_MAP_LIMITS, } from "../../domain/webSourceLocation.js";
|
|
8
8
|
import { inspectSourceMap, SourceMapFormatFailure, } from "./SourceMapFormat.js";
|
|
9
|
+
import { decodeValidatedSourceMapLeaves, isBeforeSourceMapLeafStop, } from "./DecodedSourceMap.js";
|
|
9
10
|
/** Decode with the pinned upstream codec; preserve every equal-position candidate. */
|
|
10
11
|
export const traceSourceMap = (text, url, position) => {
|
|
11
12
|
const inspected = inspectSourceMap(text);
|
|
12
|
-
const
|
|
13
|
+
const map = new AnyMap(inspected.jsonText, url);
|
|
14
|
+
const decodedLeaves = decodeValidatedSourceMapLeaves(inspected.leaves, url);
|
|
15
|
+
for (const { leaf, rows } of decodedLeaves)
|
|
16
|
+
for (const [line, row] of rows.entries())
|
|
17
|
+
for (const segment of row)
|
|
18
|
+
if (!isBeforeSourceMapLeafStop(leaf, line, segment[0]))
|
|
19
|
+
throw new SourceMapFormatFailure("format", "Embedded source-map mappings overlap the following section boundary.");
|
|
20
|
+
const rows = inspected.format === "regular"
|
|
21
|
+
? (decodedLeaves[0]?.rows ?? [])
|
|
22
|
+
: decodedMappings(map);
|
|
23
|
+
validateFlattenedRows(inspected, rows, map);
|
|
13
24
|
const matched = greatestPosition(rows, position);
|
|
14
25
|
const segments = matched === null
|
|
15
26
|
? []
|
|
@@ -48,38 +59,13 @@ export const traceSourceMap = (text, url, position) => {
|
|
|
48
59
|
diagnostics: [],
|
|
49
60
|
});
|
|
50
61
|
};
|
|
51
|
-
const
|
|
52
|
-
let regularRows;
|
|
53
|
-
for (const leaf of inspected.leaves) {
|
|
54
|
-
const decoded = decodedMappings(new TraceMap(JSON.stringify(leaf.map), url));
|
|
55
|
-
if (inspected.format === "regular")
|
|
56
|
-
regularRows = decoded;
|
|
57
|
-
for (const [line, row] of decoded.entries())
|
|
58
|
-
for (const segment of row) {
|
|
59
|
-
if (segment.some((value) => !Number.isSafeInteger(value) || value < 0) ||
|
|
60
|
-
(segment.length !== 1 && segment[1] >= leaf.map.sources.length) ||
|
|
61
|
-
(segment.length === 5 && segment[4] >= leaf.map.names.length))
|
|
62
|
-
throw new SourceMapFormatFailure("format", "Decoded section-local position, source index or name index is invalid.");
|
|
63
|
-
const generatedLine = leaf.offset.line + line;
|
|
64
|
-
const generatedColumn = segment[0] + (line === 0 ? leaf.offset.column : 0);
|
|
65
|
-
if (leaf.stop !== null &&
|
|
66
|
-
(generatedLine > leaf.stop.line ||
|
|
67
|
-
(generatedLine === leaf.stop.line &&
|
|
68
|
-
generatedColumn >= leaf.stop.column)))
|
|
69
|
-
throw new SourceMapFormatFailure("format", "Embedded source-map mappings overlap the following section boundary.");
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const map = new AnyMap(inspected.jsonText, url);
|
|
73
|
-
const rows = regularRows ?? decodedMappings(map);
|
|
62
|
+
const validateFlattenedRows = (inspected, rows, map) => {
|
|
74
63
|
for (const row of rows)
|
|
75
64
|
for (const segment of row) {
|
|
76
|
-
if (
|
|
77
|
-
segment.some((v) => !Number.isSafeInteger(v) || v < 0) ||
|
|
78
|
-
(segment.length !== 1 && segment[1] >= inspected.declarations.length) ||
|
|
65
|
+
if ((segment.length !== 1 && segment[1] >= inspected.declarations.length) ||
|
|
79
66
|
(segment.length === 5 && segment[4] >= map.names.length))
|
|
80
67
|
throw new SourceMapFormatFailure("format", "Decoded mapping has invalid component count, position, source index or name index.");
|
|
81
68
|
}
|
|
82
|
-
return { map, rows };
|
|
83
69
|
};
|
|
84
70
|
const greatestPosition = (rows, position) => {
|
|
85
71
|
for (let line = Math.min(position.line - 1, rows.length - 1); line >= 0; line -= 1) {
|
package/dist/main/shutdown.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
2
|
+
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
|
1
3
|
import { MCP_SHUTDOWN_FAILED } from "./messages.js";
|
|
2
4
|
export const createShutdown = (input) => {
|
|
3
|
-
const { handle, session,
|
|
5
|
+
const { handle, session, dependencies, serverLogger } = input;
|
|
4
6
|
let shutdownPromise;
|
|
5
7
|
let unregisterShutdown = () => undefined;
|
|
6
8
|
const shutdown = async () => {
|
|
7
9
|
shutdownPromise ??= (async () => {
|
|
8
|
-
unregisterReload();
|
|
9
10
|
unregisterShutdown();
|
|
10
11
|
const results = await Promise.allSettled([
|
|
11
12
|
handle.close(),
|
|
12
13
|
input.closeAndroid?.(),
|
|
13
|
-
session.close({ retainProviderDocuments: true })
|
|
14
|
+
session.close({ retainProviderDocuments: true }).then((closed) => {
|
|
15
|
+
if (!closed.ok)
|
|
16
|
+
throw closed.error;
|
|
17
|
+
}),
|
|
14
18
|
]);
|
|
15
19
|
for (const result of results)
|
|
16
20
|
if (result.status === "rejected")
|
|
@@ -24,12 +28,16 @@ export const createShutdown = (input) => {
|
|
|
24
28
|
dependencies.setExitCode(1);
|
|
25
29
|
serverLogger.error(MCP_SHUTDOWN_FAILED);
|
|
26
30
|
dependencies.writeStderr(`${MCP_SHUTDOWN_FAILED}\n`);
|
|
31
|
+
if (cause instanceof AnalysisError)
|
|
32
|
+
dependencies.writeStderr(`${projectAnalysisError(cause).message}\n`);
|
|
27
33
|
});
|
|
28
34
|
};
|
|
29
35
|
unregisterShutdown = dependencies.registerShutdown(requestShutdown);
|
|
30
36
|
return { shutdown, request: requestShutdown };
|
|
31
37
|
};
|
|
32
38
|
const describeShutdownFailure = (cause) => {
|
|
39
|
+
if (cause instanceof AnalysisError)
|
|
40
|
+
return { analysis_error: projectAnalysisError(cause) };
|
|
33
41
|
if (cause instanceof Error) {
|
|
34
42
|
const code = "code" in cause ? cause.code : undefined;
|
|
35
43
|
return {
|
package/dist/main/startup.js
CHANGED
|
@@ -7,8 +7,15 @@ export const openInitialTarget = async (session, config, serverLogger, writeStde
|
|
|
7
7
|
});
|
|
8
8
|
if (opened.ok)
|
|
9
9
|
return { ok: true };
|
|
10
|
-
await session.close();
|
|
11
|
-
serverLogger.error({
|
|
10
|
+
const closed = await session.close();
|
|
11
|
+
serverLogger.error({
|
|
12
|
+
error: projectAnalysisError(opened.error),
|
|
13
|
+
...(closed.ok
|
|
14
|
+
? {}
|
|
15
|
+
: { cleanup_error: projectAnalysisError(closed.error) }),
|
|
16
|
+
}, "Initial target failed to open");
|
|
12
17
|
writeStderr(`${projectAnalysisError(opened.error).message}\n`);
|
|
18
|
+
if (!closed.ok)
|
|
19
|
+
writeStderr(`${projectAnalysisError(closed.error).message}\n`);
|
|
13
20
|
return { ok: false, exitCode: 1 };
|
|
14
21
|
};
|
package/dist/main/transport.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createAndroidAnalysisProvider } from "../composition/android.js";
|
|
2
2
|
import { createServer } from "../server/createServer.js";
|
|
3
|
+
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
|
3
4
|
import { MCP_CONNECTION_LOST, MCP_CONNECTION_START_FAILED, } from "./messages.js";
|
|
4
5
|
export const startMcpTransport = async (dependencies, session, serverContext) => {
|
|
5
6
|
const { serverLogger } = serverContext;
|
|
@@ -26,10 +27,12 @@ export const startMcpTransport = async (dependencies, session, serverContext) =>
|
|
|
26
27
|
try {
|
|
27
28
|
handle = dependencies.serve(() => {
|
|
28
29
|
// The SDK can discard a discovery probe and construct a replacement server.
|
|
29
|
-
const android = createAndroidAnalysisProvider(
|
|
30
|
+
const android = createAndroidAnalysisProvider(serverContext.environment);
|
|
30
31
|
androidProviders.push(android);
|
|
31
32
|
return (dependencies.createServer ?? createServer)(session, session, {
|
|
32
33
|
logger: serverContext.logger,
|
|
34
|
+
environment: serverContext.environment,
|
|
35
|
+
delivery: serverContext.delivery,
|
|
33
36
|
...optionalProviders,
|
|
34
37
|
androidAnalysis: android,
|
|
35
38
|
});
|
|
@@ -41,11 +44,28 @@ export const startMcpTransport = async (dependencies, session, serverContext) =>
|
|
|
41
44
|
});
|
|
42
45
|
}
|
|
43
46
|
catch (cause) {
|
|
44
|
-
await Promise.allSettled([
|
|
47
|
+
const [binaryCleanup, androidCleanup] = await Promise.allSettled([
|
|
48
|
+
session.close(),
|
|
49
|
+
closeAndroid(),
|
|
50
|
+
]);
|
|
45
51
|
serverLogger.error({
|
|
46
52
|
error: cause instanceof Error ? cause.message : String(cause),
|
|
47
53
|
}, MCP_CONNECTION_START_FAILED);
|
|
48
54
|
dependencies.writeStderr(`${MCP_CONNECTION_START_FAILED}\n`);
|
|
55
|
+
if (binaryCleanup.status === "fulfilled" && !binaryCleanup.value.ok) {
|
|
56
|
+
const cleanupError = projectAnalysisError(binaryCleanup.value.error);
|
|
57
|
+
serverLogger.error({ cleanup_error: cleanupError }, "Binary provider cleanup failed after MCP startup");
|
|
58
|
+
dependencies.writeStderr(`${cleanupError.message}\n`);
|
|
59
|
+
}
|
|
60
|
+
for (const cleanup of [binaryCleanup, androidCleanup]) {
|
|
61
|
+
if (cleanup.status === "rejected") {
|
|
62
|
+
const reason = cleanup.reason instanceof Error
|
|
63
|
+
? cleanup.reason.message
|
|
64
|
+
: String(cleanup.reason);
|
|
65
|
+
serverLogger.error({ cleanup_error: reason }, "Provider cleanup rejected after MCP startup");
|
|
66
|
+
dependencies.writeStderr(`Provider cleanup failed: ${reason}\n`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
49
69
|
return { ok: false };
|
|
50
70
|
}
|
|
51
71
|
return { ok: true, handle, closeAndroid };
|
package/dist/main.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { snapshotEnvironment } from "./process/snapshotEnvironment.js";
|
|
2
3
|
import { pathToFileURL } from "node:url";
|
|
3
4
|
import { realpathSync } from "node:fs";
|
|
4
5
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
5
|
-
import { parseConfig } from "./config.js";
|
|
6
|
+
import { parseConfig } from "./config/parseConfig.js";
|
|
6
7
|
import { createBinarySession } from "./composition/binary.js";
|
|
7
8
|
import { createLogger } from "./logger.js";
|
|
8
9
|
import { projectAnalysisError } from "./domain/analysisErrorProjection.js";
|
|
9
10
|
import { SERVER_START_FAILED } from "./main/messages.js";
|
|
10
|
-
import { createRuntimeState } from "./main/state.js";
|
|
11
11
|
import { openInitialTarget } from "./main/startup.js";
|
|
12
12
|
import { startMcpTransport } from "./main/transport.js";
|
|
13
|
-
import { loadOptionalObservationProviders } from "./composition/optionalObservationProviders.js";
|
|
14
|
-
import {
|
|
13
|
+
import { createOptionalObservationFactories, loadOptionalObservationProviders, } from "./composition/optionalObservationProviders.js";
|
|
14
|
+
import { createToolResultDelivery } from "./server/toolResult.js";
|
|
15
15
|
import { createShutdown } from "./main/shutdown.js";
|
|
16
16
|
const runtimeDependencies = () => ({
|
|
17
17
|
env: process.env,
|
|
@@ -32,10 +32,6 @@ const runtimeDependencies = () => ({
|
|
|
32
32
|
process.stdin.off("close", handler);
|
|
33
33
|
};
|
|
34
34
|
},
|
|
35
|
-
registerReload: (handler) => {
|
|
36
|
-
process.on("SIGHUP", handler);
|
|
37
|
-
return () => process.off("SIGHUP", handler);
|
|
38
|
-
},
|
|
39
35
|
});
|
|
40
36
|
/**
|
|
41
37
|
* Start the long-lived MCP adapter and install idempotent shutdown handlers.
|
|
@@ -43,35 +39,32 @@ const runtimeDependencies = () => ({
|
|
|
43
39
|
* signals close bridge resources without assuming ownership of the Hopper app.
|
|
44
40
|
*/
|
|
45
41
|
export const run = async (dependencies = runtimeDependencies()) => {
|
|
46
|
-
const
|
|
42
|
+
const environment = snapshotEnvironment(dependencies.env);
|
|
43
|
+
const config = parseConfig(environment);
|
|
47
44
|
if (!config.ok) {
|
|
48
45
|
dependencies.writeStderr(`${projectAnalysisError(config.error).message}\n`);
|
|
49
46
|
return 1;
|
|
50
47
|
}
|
|
51
48
|
const logger = createLogger("mcp", config.value.logLevel);
|
|
52
49
|
const serverLogger = logger.child({ layer: "server" });
|
|
53
|
-
const session = createBinarySession(config.value, logger);
|
|
50
|
+
const session = createBinarySession(config.value, logger, environment);
|
|
54
51
|
const opened = await openInitialTarget(session, config.value, serverLogger, dependencies.writeStderr);
|
|
55
52
|
if (!opened.ok)
|
|
56
53
|
return opened.exitCode;
|
|
57
|
-
const runtimeState = createRuntimeState(config.value);
|
|
58
54
|
const transport = await startMcpTransport(dependencies, session, {
|
|
59
55
|
logger,
|
|
60
56
|
serverLogger,
|
|
61
|
-
|
|
57
|
+
environment,
|
|
58
|
+
delivery: createToolResultDelivery(config.value.mcpMaxResponseBytes),
|
|
59
|
+
loadOptionalProviders: dependencies.loadOptionalProviders ??
|
|
60
|
+
(() => loadOptionalObservationProviders(createOptionalObservationFactories(environment))),
|
|
62
61
|
});
|
|
63
62
|
if (!transport.ok)
|
|
64
63
|
return 1;
|
|
65
|
-
const unregisterReload = registerConfigReload({
|
|
66
|
-
dependencies,
|
|
67
|
-
runtimeState,
|
|
68
|
-
serverLogger,
|
|
69
|
-
});
|
|
70
64
|
createShutdown({
|
|
71
65
|
handle: transport.handle,
|
|
72
66
|
closeAndroid: transport.closeAndroid,
|
|
73
67
|
session,
|
|
74
|
-
unregisterReload,
|
|
75
68
|
dependencies,
|
|
76
69
|
serverLogger,
|
|
77
70
|
});
|
package/dist/mcpDoctor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client } from "@modelcontextprotocol/client";
|
|
2
2
|
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
|
3
|
-
import { Formatter } from "incur";
|
|
3
|
+
import { Formatter, Help, z } from "incur";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
5
|
import { CATALOG_IDENTITY } from "./catalogIdentity.js";
|
|
6
6
|
import { PROMPT_CONTRACTS } from "./contracts/promptContracts.js";
|
|
@@ -8,6 +8,36 @@ import { TOOL_CONTRACTS } from "./contracts/toolContracts.js";
|
|
|
8
8
|
import { PRODUCT_IDENTITY } from "./identity.js";
|
|
9
9
|
import { MCP_STARTUP_POLICY } from "./mcpStartupPolicy.js";
|
|
10
10
|
const OUTPUT_FORMATS = ["toon", "json", "yaml", "md", "jsonl"];
|
|
11
|
+
/**
|
|
12
|
+
* Canonical `rea mcp doctor` options. This schema is the single source of
|
|
13
|
+
* truth: the argument parser accepts exactly these options (plus the `-h`
|
|
14
|
+
* alias below) and the help renderer lists them. Keep them in sync by
|
|
15
|
+
* changing this schema, not either consumer.
|
|
16
|
+
*/
|
|
17
|
+
const MCP_DOCTOR_OPTIONS = z.object({
|
|
18
|
+
format: z.enum(OUTPUT_FORMATS).optional().describe("Output format"),
|
|
19
|
+
json: z.boolean().optional().describe("Emit the report as JSON"),
|
|
20
|
+
fullOutput: z.boolean().optional().describe("Show the full output envelope"),
|
|
21
|
+
help: z.boolean().optional().describe("Show help"),
|
|
22
|
+
});
|
|
23
|
+
const MCP_DOCTOR_ALIAS = { help: "h" };
|
|
24
|
+
const MCP_DOCTOR_COMMAND = "rea mcp doctor";
|
|
25
|
+
const MCP_DOCTOR_DESCRIPTION = "Validate MCP server startup and tool listing";
|
|
26
|
+
/** Help flags derived from `MCP_DOCTOR_OPTIONS` plus its alias. */
|
|
27
|
+
const HELP_FLAGS = new Set(["--help", "-h"]);
|
|
28
|
+
/**
|
|
29
|
+
* Answer an advertised help request without starting a diagnostic session.
|
|
30
|
+
* Global options are hidden because this dispatcher entry accepts only the
|
|
31
|
+
* options above; the hint says so explicitly instead of implying full
|
|
32
|
+
* Incur parity.
|
|
33
|
+
*/
|
|
34
|
+
const renderMcpDoctorHelp = () => Help.formatCommand(MCP_DOCTOR_COMMAND, {
|
|
35
|
+
description: MCP_DOCTOR_DESCRIPTION,
|
|
36
|
+
hideGlobalOptions: true,
|
|
37
|
+
options: MCP_DOCTOR_OPTIONS,
|
|
38
|
+
alias: MCP_DOCTOR_ALIAS,
|
|
39
|
+
hint: "This entry accepts only the options above.",
|
|
40
|
+
});
|
|
11
41
|
/** Diagnose the actual production stdio adapter with one startup-bounded SDK session. */
|
|
12
42
|
export const runProductionMcpDoctor = async (options) => {
|
|
13
43
|
const deadline = Date.now() + (options.deadlineMs ?? MCP_STARTUP_POLICY.doctorDeadlineMs);
|
|
@@ -117,11 +147,14 @@ const inspectProductionMcpSession = async (client, deadline, signal) => {
|
|
|
117
147
|
*/
|
|
118
148
|
export const runProductionMcpDoctorCli = async (arguments_, input) => {
|
|
119
149
|
const parsed = parseOutputArguments(arguments_);
|
|
120
|
-
if (!parsed.ok)
|
|
150
|
+
if (!parsed.ok) {
|
|
151
|
+
if (parsed.help)
|
|
152
|
+
return { output: `${renderMcpDoctorHelp()}\n`, exitCode: 0 };
|
|
121
153
|
return {
|
|
122
154
|
output: `${Formatter.format({ code: "VALIDATION_ERROR", message: parsed.message }, parsed.format)}\n`,
|
|
123
155
|
exitCode: 1,
|
|
124
156
|
};
|
|
157
|
+
}
|
|
125
158
|
const result = await runProductionMcpDoctor({
|
|
126
159
|
command: process.execPath,
|
|
127
160
|
args: [resolve(input.dispatcherPath), "mcp"],
|
|
@@ -174,6 +207,12 @@ const parseIdentityToolResult = (input) => {
|
|
|
174
207
|
};
|
|
175
208
|
};
|
|
176
209
|
const parseOutputArguments = (arguments_) => {
|
|
210
|
+
// Help wins over output selection and validation errors, but only when it
|
|
211
|
+
// appears in option position. A token consumed as `--format`'s value is
|
|
212
|
+
// not a flag, so `--format --help` reports an invalid format instead of
|
|
213
|
+
// masking the typo with usage.
|
|
214
|
+
if (hasHelpInOptionPosition(arguments_))
|
|
215
|
+
return { ok: false, help: true };
|
|
177
216
|
let format = "toon";
|
|
178
217
|
for (let index = 0; index < arguments_.length; index += 1) {
|
|
179
218
|
const argument = arguments_[index];
|
|
@@ -191,6 +230,7 @@ const parseOutputArguments = (arguments_) => {
|
|
|
191
230
|
if (!isOutputFormat(candidate))
|
|
192
231
|
return {
|
|
193
232
|
ok: false,
|
|
233
|
+
help: false,
|
|
194
234
|
format,
|
|
195
235
|
message: `Invalid output format: ${candidate ?? "missing"}`,
|
|
196
236
|
};
|
|
@@ -199,14 +239,34 @@ const parseOutputArguments = (arguments_) => {
|
|
|
199
239
|
}
|
|
200
240
|
if (argument === "--full-output")
|
|
201
241
|
continue;
|
|
242
|
+
if (HELP_FLAGS.has(argument ?? ""))
|
|
243
|
+
return { ok: false, help: true };
|
|
202
244
|
return {
|
|
203
245
|
ok: false,
|
|
246
|
+
help: false,
|
|
204
247
|
format,
|
|
205
248
|
message: `Unknown mcp doctor option: ${argument ?? "missing"}`,
|
|
206
249
|
};
|
|
207
250
|
}
|
|
208
251
|
return { ok: true, format };
|
|
209
252
|
};
|
|
253
|
+
/**
|
|
254
|
+
* Report whether `--help`/`-h` appears in option position. Tokens consumed
|
|
255
|
+
* as `--format`'s value are skipped so `--format --help` stays an invalid
|
|
256
|
+
* format error instead of silently becoming a help request.
|
|
257
|
+
*/
|
|
258
|
+
const hasHelpInOptionPosition = (arguments_) => {
|
|
259
|
+
for (let index = 0; index < arguments_.length; index += 1) {
|
|
260
|
+
const argument = arguments_[index];
|
|
261
|
+
if (argument === "--format") {
|
|
262
|
+
index += 1;
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
if (HELP_FLAGS.has(argument ?? ""))
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
return false;
|
|
269
|
+
};
|
|
210
270
|
const isOutputFormat = (value) => OUTPUT_FORMATS.some((candidate) => candidate === value);
|
|
211
271
|
const requestOptions = (deadline, signal) => ({
|
|
212
272
|
signal,
|
|
@@ -7,7 +7,7 @@ const describeFixups = (fixups) => {
|
|
|
7
7
|
};
|
|
8
8
|
/** Append the per-facet coverage of one Apple dispatch metadata decode. */
|
|
9
9
|
export const pushDispatchCoverage = (input) => {
|
|
10
|
-
const { result, failures, examined, categoriesExamined, truncated, fixups } = input;
|
|
10
|
+
const { result, failures, categoryIssues, examined, categoriesExamined, truncated, fixups, vtables, swift, } = input;
|
|
11
11
|
result.coverage.push({
|
|
12
12
|
facet: "objc_class_method_ivar_metadata",
|
|
13
13
|
status: failures.length > 0 || truncated ? "partial" : "complete",
|
|
@@ -30,21 +30,25 @@ export const pushDispatchCoverage = (input) => {
|
|
|
30
30
|
examined: result.relative_pointers.length,
|
|
31
31
|
decoded: result.relative_pointers.filter((item) => item.decode.status === "decoded").length,
|
|
32
32
|
});
|
|
33
|
-
const categoryFailures =
|
|
33
|
+
const categoryFailures = categoryIssues.map(({ code, location, message }) => `${code}${location === undefined ? "" : ` at ${location}`}: ${message}`);
|
|
34
34
|
result.coverage.push({
|
|
35
35
|
facet: "objc_properties_categories",
|
|
36
|
-
status:
|
|
36
|
+
status: truncated ||
|
|
37
|
+
categoryFailures.length > 0 ||
|
|
37
38
|
result.objc_categories.some(({ decode }) => decode.status !== "decoded")
|
|
38
39
|
? "partial"
|
|
39
40
|
: "complete",
|
|
40
|
-
reason: categoryFailures.join("; ") || null,
|
|
41
|
+
reason: [...categoryFailures, ...(truncated ? ["max_records_reached"] : [])].join("; ") || null,
|
|
41
42
|
examined: categoriesExamined,
|
|
42
43
|
decoded: result.objc_categories.filter(({ decode }) => decode.status === "decoded").length,
|
|
43
44
|
});
|
|
44
45
|
result.coverage.push({
|
|
45
46
|
facet: "pointer_fixups",
|
|
46
|
-
status: fixups.
|
|
47
|
-
reason: [
|
|
47
|
+
status: fixups.issues.length > 0 ? "partial" : "complete",
|
|
48
|
+
reason: [
|
|
49
|
+
describeFixups(fixups),
|
|
50
|
+
...fixups.issues.map(({ code, location, message }) => `${code}${location === undefined ? "" : ` at ${location}`}: ${message}`),
|
|
51
|
+
].join("; "),
|
|
48
52
|
examined: 0,
|
|
49
53
|
decoded: 0,
|
|
50
54
|
});
|
|
@@ -55,4 +59,41 @@ export const pushDispatchCoverage = (input) => {
|
|
|
55
59
|
examined: 0,
|
|
56
60
|
decoded: 0,
|
|
57
61
|
});
|
|
62
|
+
result.coverage.push({
|
|
63
|
+
facet: "swift_conformances_static_witness_slots",
|
|
64
|
+
status: swift.exhaustive &&
|
|
65
|
+
!truncated &&
|
|
66
|
+
!result.swift_conformances.some(({ decode }) => decode.status !== "decoded") &&
|
|
67
|
+
!result.swift_dispatch_slots.some(({ table_kind, decode }) => table_kind === "witness_table" && decode.status !== "decoded")
|
|
68
|
+
? "complete"
|
|
69
|
+
: "partial",
|
|
70
|
+
reason: [
|
|
71
|
+
...swift.issues.map(formatIssue),
|
|
72
|
+
...(truncated ? ["max_records_reached"] : []),
|
|
73
|
+
...(result.swift_conformances.some(({ decode }) => decode.status !== "decoded") ||
|
|
74
|
+
result.swift_dispatch_slots.some(({ table_kind, decode }) => table_kind === "witness_table" && decode.status !== "decoded")
|
|
75
|
+
? ["swift_records_unresolved"]
|
|
76
|
+
: []),
|
|
77
|
+
].join("; ") || null,
|
|
78
|
+
examined: swift.examined,
|
|
79
|
+
decoded: swift.decoded,
|
|
80
|
+
});
|
|
81
|
+
result.coverage.push({
|
|
82
|
+
facet: "swift_class_vtable_descriptors",
|
|
83
|
+
status: vtables.exhaustive &&
|
|
84
|
+
!truncated &&
|
|
85
|
+
!result.swift_dispatch_slots.some(({ table_kind, decode }) => table_kind === "class_vtable" && decode.status !== "decoded")
|
|
86
|
+
? "complete"
|
|
87
|
+
: "partial",
|
|
88
|
+
reason: [
|
|
89
|
+
...vtables.issues.map(formatIssue),
|
|
90
|
+
...(truncated ? ["max_records_reached"] : []),
|
|
91
|
+
...(result.swift_dispatch_slots.some(({ table_kind, decode }) => table_kind === "class_vtable" && decode.status !== "decoded")
|
|
92
|
+
? ["vtable_implementations_unresolved"]
|
|
93
|
+
: []),
|
|
94
|
+
].join("; ") || null,
|
|
95
|
+
examined: vtables.examined,
|
|
96
|
+
decoded: vtables.decoded,
|
|
97
|
+
});
|
|
58
98
|
};
|
|
99
|
+
const formatIssue = ({ code, location, message }) => `${code}${location === undefined ? "" : ` at ${location}`}: ${message}`;
|