rea-agents 5.0.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +157 -650
- package/bridge/mitmproxy/capture.py +210 -0
- package/bridge/native/rea_lldb_tracer.py +303 -0
- package/bridge/process/ProcessRunTokenReader.swift +263 -0
- package/bridge/process/ProcessRunTokenReaderMain.swift +35 -0
- package/bridge/pwndbg/core_context.py +101 -0
- package/bridge/pwndbg/launch.py +39 -0
- package/bridge/pwndbg/launch_impl.py +34 -0
- package/bridge/pwntools/decoder_runtime.py +59 -0
- package/bridge/pwntools/layout.py +39 -0
- package/bridge/pwntools/layout_impl.py +309 -0
- package/bridge/pwntools/recorded_crash.py +39 -0
- package/bridge/pwntools/recorded_crash_impl.py +143 -0
- package/dist/android/JadxProvider.js +1 -0
- package/dist/application/CapabilityInventory.js +21 -0
- package/dist/application/DirectAnalysis.js +97 -23
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/ReconstructionObligationCandidates.js +5 -1
- package/dist/application/WebNetworkCapturePort.js +1 -0
- package/dist/application/WebNetworkCaptureService.js +132 -0
- package/dist/application/WindowsCapabilities.js +1 -1
- package/dist/application/binary/AnalysisSnapshotCache.js +49 -6
- package/dist/application/binary/BinarySession.js +38 -10
- package/dist/application/binary/BinarySessionOpen.js +16 -3
- package/dist/application/binary/BinarySessionRecords.js +20 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutPort.js +1 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +57 -0
- package/dist/application/binaryDiagnostics/RecordedCrashPort.js +1 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +60 -0
- package/dist/application/evm/EvmInterfacePort.js +1 -0
- package/dist/application/evm/EvmInterfaceService.js +62 -0
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +1 -2
- package/dist/application/javascript/JavaScriptApplicationService.js +15 -2
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +42 -23
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +26 -2
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +74 -24
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +23 -10
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +145 -70
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +14 -15
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +41 -1
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -9
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +118 -12
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +5 -5
- package/dist/application/{ProcessCli.js → process/ProcessCli.js} +10 -10
- package/dist/application/{ProcessEvidence.js → process/ProcessEvidence.js} +4 -4
- package/dist/artifacts/ArtifactProvider.js +30 -3
- package/dist/artifacts/ArtifactProviderMetadata.js +2 -1
- package/dist/artifacts/ZipArtifactReader.js +3 -0
- package/dist/artifacts/apple/DylibResolutionReader.js +259 -0
- package/dist/artifacts/apple/MachoLoadCommandReader.js +294 -0
- package/dist/{application → artifacts/extraction}/ArtifactExtraction.js +10 -10
- package/dist/{application → artifacts/inventory}/ArtifactGraphConstruction.js +3 -3
- package/dist/{application → artifacts/inventory}/ArtifactInventory.js +4 -4
- package/dist/{application/ArtifactInventory → artifacts/inventory}/classify.js +2 -2
- package/dist/{application/ArtifactInventory → artifacts/inventory}/reader.js +5 -5
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanCanonical.js +3 -3
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanReader.js +5 -5
- package/dist/artifacts/readStableArtifact.js +20 -4
- package/dist/browser/CdpCaptureEventHandlers.js +90 -2
- package/dist/browser/CdpCaptureEvents.js +9 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +12 -3
- package/dist/browser/history/CaptureFailures.js +101 -0
- package/dist/browser/history/CaptureFormatError.js +10 -0
- package/dist/browser/history/CaptureRedaction.js +65 -0
- package/dist/browser/history/CaptureRelease.js +12 -0
- package/dist/browser/history/HarCapture.js +165 -0
- package/dist/browser/history/HarCaptureAdapter.js +20 -0
- package/dist/browser/history/HarCaptureProcess.js +57 -0
- package/dist/browser/history/HarJson.js +91 -0
- package/dist/browser/history/HarSchema.js +72 -0
- package/dist/browser/history/HistoricalCaptureDecoder.js +186 -0
- package/dist/browser/history/HistoricalCaptureFormatAdapter.js +1 -0
- package/dist/browser/history/MitmproxyCaptureAdapter.js +42 -0
- package/dist/cli/artifactCommands.js +26 -1
- package/dist/cli/binaryDiagnosticsCommands.js +39 -0
- package/dist/cli/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +8 -8
- package/dist/cli/electronCommands.js +16 -9
- package/dist/cli/evmCommands.js +24 -0
- package/dist/cli/firmwareCommands.js +6 -3
- package/dist/cli/javascriptApplicationAnalysis.js +16 -3
- package/dist/cli/jsonOutput.js +133 -0
- package/dist/cli/nativeCallCommands.js +35 -0
- package/dist/cli/processCommands.js +1 -1
- package/dist/cli/streamedJsonOutput.js +56 -0
- package/dist/cli/utilityCommands.js +2 -0
- package/dist/cli/webNetworkCaptureCommands.js +40 -0
- package/dist/cli.js +9 -3
- package/dist/cliBrowserScenarioCommands.js +2 -2
- package/dist/cliCommandNames.js +6 -0
- package/dist/cliJsonInput.js +30 -1
- package/dist/cliOutput.js +21 -6
- package/dist/composition/binaryDiagnostics.js +8 -0
- package/dist/composition/evm.js +4 -0
- package/dist/composition/webNetworkCaptures.js +6 -0
- package/dist/contracts/artifactToolContracts.js +6 -0
- package/dist/contracts/browserCaptureToolInputSchema.js +43 -0
- package/dist/contracts/browserToolContracts.js +4 -3
- package/dist/contracts/errorSchemas.js +8 -1
- package/dist/contracts/evm/evmToolContracts.js +20 -0
- package/dist/contracts/investigationExamples.js +2 -2
- package/dist/contracts/managed/managedToolContracts.js +7 -3
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +42 -0
- package/dist/contracts/native/nativeToolContracts.js +17 -1
- package/dist/contracts/officialToolContracts.js +12 -9
- package/dist/contracts/process/processCaptureExample.js +2 -0
- package/dist/contracts/sessionLifecycleInputs.js +22 -5
- package/dist/contracts/sessionStatusContract.js +10 -2
- package/dist/contracts/sessionToolContracts.js +8 -1
- package/dist/contracts/sessionToolSchemas.js +10 -3
- package/dist/contracts/toolContractExamples.js +1 -1
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +30 -0
- package/dist/contracts/toolOutputSchemaGroups.js +5 -1
- package/dist/contracts/toolOutputSchemaPrimitives.js +1 -1
- package/dist/contracts/webNetworkCaptureToolContracts.js +24 -0
- package/dist/domain/analysisErrorBase.js +15 -0
- package/dist/domain/analysisErrorCore.js +59 -5
- package/dist/domain/analysisErrorPresentation.js +29 -1
- package/dist/domain/analysisErrorProjection.js +52 -2
- package/dist/domain/analysisSnapshot.js +166 -2
- package/dist/domain/apple/dyldPaths.js +81 -0
- package/dist/domain/apple/dylibResolution.js +367 -0
- package/dist/domain/apple/dylibResolutionFindings.js +75 -0
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/browserObservation.js +1 -1
- package/dist/domain/browserObservationSchemas.js +13 -0
- package/dist/domain/browserScenarioValues.js +9 -2
- package/dist/domain/callPathSchemas.js +1 -1
- package/dist/domain/canonicalDigest.js +13 -1
- package/dist/domain/changedBehavior.js +3 -3
- package/dist/domain/comparisonStatus.js +2 -30
- package/dist/domain/conformanceTrustGate.js +0 -16
- package/dist/domain/evidence.js +17 -5
- package/dist/domain/evm/evmInterface.js +63 -0
- package/dist/domain/explicitSensitiveFailure.js +92 -0
- package/dist/domain/explicitSensitiveValues.js +10 -0
- package/dist/domain/firmware/firmwareAnalysis.js +8 -1
- package/dist/domain/javascript/electronActiveObservation.js +9 -4
- package/dist/domain/javascript/htmlArtifactReferences.js +40 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +21 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +0 -10
- package/dist/domain/javascript/javascriptSemanticGraph.js +21 -5
- package/dist/domain/jsonValue.js +4 -0
- package/dist/domain/localPath.js +2 -0
- package/dist/domain/native/binaryLayout.js +357 -0
- package/dist/domain/native/nativeCallObservation.js +164 -0
- package/dist/domain/native/objcSwiftMetadata.js +0 -39
- package/dist/domain/native/recordedCrash.js +266 -0
- package/dist/domain/native/recordedCrashNoteCoverage.js +73 -0
- package/dist/domain/{processCapture.js → process/processCapture.js} +139 -2
- package/dist/domain/{processCaptureExample.js → process/processCaptureExample.js} +5 -0
- package/dist/domain/process/processCaptureParsing.js +54 -0
- package/dist/domain/{processCaptureValidation.js → process/processCaptureValidation.js} +18 -2
- package/dist/domain/{processComparison.js → process/processComparison.js} +1 -1
- package/dist/domain/{processObservation.js → process/processObservation.js} +1 -1
- package/dist/domain/{processTraceSpecification.js → process/processTraceSpecification.js} +1 -1
- package/dist/domain/providerSelectionError.js +4 -2
- package/dist/domain/reconstructionVerification.js +3 -3
- package/dist/domain/reconstructionVerificationSchemas.js +1 -1
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +3 -3
- package/dist/domain/webCaptureDiff.js +1 -0
- package/dist/domain/webNetworkCapture.js +118 -0
- package/dist/domain/webNetworkCaptureCoordinates.js +58 -0
- package/dist/dotnet/ManagedExceptionRegionValidation.js +41 -0
- package/dist/dotnet/ManagedMemberInspector.js +4 -2
- package/dist/dotnet/ManagedMemberInspectorCore.js +38 -32
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +23 -7
- package/dist/dotnet/ManagedMemberRows.js +14 -3
- package/dist/dotnet/ManagedMetadataHeaps.js +20 -2
- package/dist/dotnet/ManagedMetadataInventory.js +38 -28
- package/dist/dotnet/ManagedMetadataInventoryRows.js +24 -10
- package/dist/dotnet/ManagedMethodBodyReader.js +7 -1
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +15 -3
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +3 -1
- package/dist/dotnet/ManagedPeReader.js +11 -0
- package/dist/evm/EvmBytecodeCarrier.js +21 -0
- package/dist/evm/EvmWorkerLimits.js +40 -0
- package/dist/evm/EvmoleFailures.js +126 -0
- package/dist/evm/EvmoleInterfaceAdapter.js +53 -0
- package/dist/evm/EvmoleInterfaceProvider.js +273 -0
- package/dist/evm/EvmoleInterfaceWorker.js +87 -0
- package/dist/evm/EvmoleRelease.js +16 -0
- package/dist/firmware/FirmwareCommand.js +1 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraLauncher.js +1 -0
- package/dist/ghidra/GhidraProvider.js +2 -2
- package/dist/ghidra/GhidraProviderCapabilities.js +1 -1
- package/dist/hopper/BridgeLauncher.js +2 -0
- package/dist/hopper/LinuxPrivateDisplayProbe.js +4 -2
- package/dist/javascript/recovery/WakaruCommand.js +3 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +1 -0
- package/dist/native/CommandRunner.js +2 -1
- package/dist/native/LldbCallTracer.js +278 -0
- package/dist/native/NativeCallObservation.js +135 -0
- package/dist/native/NativeMacOSProvider.js +19 -3
- package/dist/native/NativeMacOSProviderMetadata.js +8 -3
- package/dist/native/pwndbg/PwndbgCoreContext.js +160 -0
- package/dist/native/pwntools/PwntoolsDecoder.js +203 -0
- package/dist/native/pwntools/PwntoolsFailures.js +180 -0
- package/dist/native/pwntools/PwntoolsLayoutProvider.js +36 -0
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +75 -0
- package/dist/native/pwntools/PwntoolsRelease.js +19 -0
- package/dist/native/pwntools/PwntoolsResourceLimits.js +76 -0
- package/dist/native/pwntools/RecordedCrashSourceBindings.js +46 -0
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +101 -0
- package/dist/process/DarwinProcessRunTokenReader.js +294 -0
- package/dist/process/OwnedCommand.js +113 -0
- package/dist/process/ProcessOwnership.js +263 -33
- package/dist/process/ProcessOwnershipObservation.js +161 -24
- package/dist/process/ProviderProcess.js +30 -3
- package/dist/{application → process/capture}/ProcessCaptureCapability.js +15 -0
- package/dist/{application → process/capture}/ProcessCaptureError.js +17 -1
- package/dist/process/capture/ProcessCaptureLifecycle.js +615 -0
- package/dist/{application → process/capture}/ProcessHarness.js +195 -29
- package/dist/{application → process/capture}/ProcessSampling.js +2 -2
- package/dist/server/createServer.js +22 -0
- package/dist/server/promptCompletion.js +10 -3
- package/dist/server/registerBinaryDiagnosticsTools.js +17 -0
- package/dist/server/registerEvidenceTools.js +1 -1
- package/dist/server/registerEvmTools.js +17 -0
- package/dist/server/registerProcessComparisonTool.js +1 -1
- package/dist/server/registerRecordedCrashTools.js +17 -0
- package/dist/server/registerSessionTools.js +2 -2
- package/dist/server/registerWebNetworkCaptureTool.js +28 -0
- package/dist/server/sessionAvailabilityPolicy.js +3 -0
- package/dist/server/sessionToolPolicies.js +1 -1
- package/dist/server/toolResult.js +1 -1
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +37 -9
- package/scripts/rea.mjs +11 -3
- package/skills/reverse-engineer-anything/SKILL.md +23 -3
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +29 -0
- package/third_party/README.md +60 -0
- package/third_party/evmole/LICENSE +21 -0
- package/third_party/evmole/README.md +22 -0
- package/third_party/pwndbg/LICENSE.md +21 -0
- package/third_party/pwndbg/README.md +23 -0
- package/third_party/pwntools/README.md +40 -0
- package/dist/application/AuthorizedArtifactInventory.js +0 -7
- package/dist/application/ProcessCaptureLifecycle.js +0 -299
- package/dist/application/StoreFileLock.js +0 -124
- package/dist/contracts/processCaptureExample.js +0 -2
- package/dist/domain/bytecodeProvider.js +0 -178
- package/dist/domain/customProtocolCapture.js +0 -137
- package/dist/domain/eventProcessTree.js +0 -225
- package/dist/domain/mobileApplicationInvestigation.js +0 -159
- package/dist/domain/packageAnalysis.js +0 -123
- package/dist/domain/peInspection.js +0 -197
- package/dist/domain/processCaptureParsing.js +0 -21
- package/dist/domain/protocolCapture.js +0 -217
- package/dist/domain/runtimeIdentification.js +0 -212
- package/dist/generatedMcpToolCatalog.js +0 -37
- /package/dist/application/{ArtifactExtractionDestination.js → artifacts/ArtifactExtractionDestination.js} +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/policy.js +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/types.js +0 -0
- /package/dist/domain/{processEvidenceProvider.js → process/processEvidenceProvider.js} +0 -0
- /package/dist/domain/{processScenario.js → process/processScenario.js} +0 -0
- /package/dist/domain/{processTraceComparison.js → process/processTraceComparison.js} +0 -0
- /package/dist/domain/{processTraceDimensionProjection.js → process/processTraceDimensionProjection.js} +0 -0
- /package/dist/domain/{processTraceEvaluation.js → process/processTraceEvaluation.js} +0 -0
- /package/dist/{application → process/capture}/FilesystemSnapshot.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureEnvironment.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureJournal.js +0 -0
- /package/dist/{application → process/capture}/ProcessFilesystemEffects.js +0 -0
- /package/dist/{application → process/capture}/ProcessNormalization.js +0 -0
- /package/dist/{application → process/capture}/ProcessScenarioRuntimeValidation.js +0 -0
- /package/dist/{application → process/capture}/ProcessTimer.js +0 -0
- /package/dist/{application → process/capture}/TerminalRenderer.js +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { nativeCallObservationInputSchema } from "../../domain/native/nativeCallObservation.js";
|
|
2
3
|
import { nativeUiObservationInputSchema, nativeUiScenarioInputSchema, } from "../../domain/native/nativeUiObservation.js";
|
|
3
4
|
import { nativeOutputSchemas } from "../toolOutputSchemas.js";
|
|
4
5
|
import { jsonValueSchema } from "../../domain/jsonValue.js";
|
|
@@ -16,15 +17,29 @@ const examples = {
|
|
|
16
17
|
steps: [{ kind: "wait", milliseconds: 100 }],
|
|
17
18
|
},
|
|
18
19
|
demangle_swift: { symbols: ["$s4Test3fooyyF"] },
|
|
20
|
+
observe_native_calls: {
|
|
21
|
+
breakpoints: [
|
|
22
|
+
{
|
|
23
|
+
kind: "objc-method",
|
|
24
|
+
class_name: "NSURLSession",
|
|
25
|
+
selector: "dataTaskWithRequest:completionHandler:",
|
|
26
|
+
},
|
|
27
|
+
{ kind: "function", name: "open", module: "libsystem_kernel.dylib" },
|
|
28
|
+
],
|
|
29
|
+
arguments: ["--help"],
|
|
30
|
+
duration_ms: 5000,
|
|
31
|
+
backtrace_frames: 4,
|
|
32
|
+
},
|
|
19
33
|
};
|
|
20
34
|
const native = (name, description, inputSchema) => {
|
|
21
35
|
const outputSchema = requireOutputSchema(nativeOutputSchemas, name);
|
|
36
|
+
const strictInputSchema = inputSchema.strict();
|
|
22
37
|
return {
|
|
23
38
|
name,
|
|
24
39
|
...toolContractMetadata(name),
|
|
25
40
|
description,
|
|
26
41
|
kind: "native-provider",
|
|
27
|
-
inputSchema,
|
|
42
|
+
inputSchema: strictInputSchema,
|
|
28
43
|
outputSchema,
|
|
29
44
|
examples: [
|
|
30
45
|
{
|
|
@@ -47,6 +62,7 @@ export const swiftSymbolsSchema = z
|
|
|
47
62
|
export const NATIVE_TOOL_CONTRACTS = [
|
|
48
63
|
native("observe_native_ui", "Observe an already-running native app by PID and window ID, bound to the active Mach-O target. Captures a bounded accessibility tree and selected-window screenshot; OS permission denial fails without broad capture or target launch.", nativeUiObservationInputSchema),
|
|
49
64
|
native("capture_native_ui_scenario", "Run selected-element press, increment/decrement scroll, AXValue text entry and bounded wait steps in one exact native app window. Returns ordered before/after captures and action/capture failures. Actions can change app data, network activity and persistent state; application state is left as-is and restoration is not attempted.", nativeUiScenarioInputSchema),
|
|
65
|
+
native("observe_native_calls", "Launch the active Mach-O as an owned process under LLDB and record each entry into caller-selected functions or Objective-C methods: thread, module, symbol, load and file address, raw argument registers, selector, receiver class and optional caller frames. Every hit auto-continues. No expression is evaluated and no other process is attached. The process is killed when max_events or duration_ms is reached; exit status, captured stdout/stderr, unresolved breakpoints and limitations are returned inline. The process runs with the current user's permissions and may change files, show UI or use the network. A hardened-runtime target needs the get-task-allow entitlement.", nativeCallObservationInputSchema),
|
|
50
66
|
native("inspect_macho", "Inspect Mach-O slices, load commands, imports, exports, dependencies, build metadata, segments, sections, permissions, and exact command provenance without launching Hopper.", z.object({})),
|
|
51
67
|
native("inspect_signature", "Inspect the active artifact's code-signing identity, hashes, authorities, requirements, entitlements, hardened-runtime state, and exact command provenance.", z.object({})),
|
|
52
68
|
native("inspect_plist", "Parse Info.plist from the active artifact by default, or pass any local plist path. Returns normalized JSON rather than plutil text.", z.object({
|
|
@@ -8,15 +8,18 @@ import { nativeInstructionInputSchema } from "../domain/native/nativeInstruction
|
|
|
8
8
|
import { functionInstructionInputSchema } from "./functionInstructionContract.js";
|
|
9
9
|
import { HOPPER_MEMORY_TOOL_DEFINITIONS } from "./hopperMemoryContracts.js";
|
|
10
10
|
import { analysisSearchInput } from "./analysisSearchContract.js";
|
|
11
|
-
const official = (name, description, inputSchema) =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
const official = (name, description, inputSchema) => {
|
|
12
|
+
const strictInputSchema = inputSchema.strict();
|
|
13
|
+
return {
|
|
14
|
+
name,
|
|
15
|
+
...toolContractMetadata(name),
|
|
16
|
+
description,
|
|
17
|
+
kind: "official-proxy",
|
|
18
|
+
inputSchema: strictInputSchema,
|
|
19
|
+
outputSchema: requireOutputSchema(officialOutputSchemas, name),
|
|
20
|
+
examples: examplesFor(name, strictInputSchema),
|
|
21
|
+
};
|
|
22
|
+
};
|
|
20
23
|
/** Bridge operations exposed without additional application composition. */
|
|
21
24
|
export const OFFICIAL_TOOL_CONTRACTS = [
|
|
22
25
|
official("annotate_native_function", "Atomically update one function name and/or entry comments, read them back, and return a refreshed complete function dossier. Ghidra changes its ephemeral session analysis database only; original executable bytes remain unchanged. Empty comment text clears that comment. Edits remain available to subsequent MCP calls until close; CLI returns the updated dossier before discarding its session. Invalid edits roll back the entire operation. Windows P0 and providers without this capability are unsupported.", nativeFunctionAnnotationsInputSchema),
|
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
import { executableFormatHintSchema } from "../domain/dosCom.js";
|
|
2
|
+
import { isAbsoluteLocalPath } from "../domain/localPath.js";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
import { analysisProviderSelectorSchema } from "./providerSelection.js";
|
|
5
|
+
/** Caller-supplied analysis snapshot path; must name its destination absolutely. */
|
|
6
|
+
const snapshotPathSchema = z
|
|
7
|
+
.string()
|
|
8
|
+
.min(1)
|
|
9
|
+
.refine(isAbsoluteLocalPath, {
|
|
10
|
+
message: "snapshot_path must be an absolute local filesystem path (for example /tmp/rea/analysis.json or C:\\rea\\analysis.json)",
|
|
11
|
+
})
|
|
12
|
+
.describe("Absolute local filesystem path for the analysis snapshot; relative paths are rejected.");
|
|
13
|
+
/** Caller-supplied analysis target path; must name the target absolutely. */
|
|
14
|
+
const binaryTargetPathSchema = z
|
|
15
|
+
.string()
|
|
16
|
+
.min(1)
|
|
17
|
+
.refine(isAbsoluteLocalPath, {
|
|
18
|
+
message: "path must be an absolute local filesystem path (for example /tmp/fixture.bin or C:\\analysis\\fixture.bin)",
|
|
19
|
+
})
|
|
20
|
+
.describe("Absolute local filesystem path for the analysis target; relative paths are rejected.");
|
|
4
21
|
/** Input contract for opening a target with an optional staged snapshot. */
|
|
5
|
-
export const openBinaryInputSchema = z.
|
|
6
|
-
path:
|
|
22
|
+
export const openBinaryInputSchema = z.strictObject({
|
|
23
|
+
path: binaryTargetPathSchema,
|
|
7
24
|
format: executableFormatHintSchema
|
|
8
25
|
.optional()
|
|
9
26
|
.describe("Explicit headerless DOS COM interpretation; omission preserves header-based detection"),
|
|
10
27
|
provider_id: analysisProviderSelectorSchema.optional(),
|
|
11
|
-
snapshot_path:
|
|
28
|
+
snapshot_path: snapshotPathSchema.optional(),
|
|
12
29
|
});
|
|
13
30
|
/** Input contract for closing a target after an optional atomic snapshot. */
|
|
14
|
-
export const closeBinaryInputSchema = z.
|
|
15
|
-
snapshot_path:
|
|
31
|
+
export const closeBinaryInputSchema = z.strictObject({
|
|
32
|
+
snapshot_path: snapshotPathSchema.optional(),
|
|
16
33
|
overwrite: z.boolean().default(false),
|
|
17
34
|
});
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { isAbsoluteLocalPath } from "../domain/localPath.js";
|
|
2
3
|
/** Optional expectations used to compare the live session with its caller. */
|
|
3
|
-
export const binarySessionInputSchema = z.
|
|
4
|
+
export const binarySessionInputSchema = z.strictObject({
|
|
4
5
|
expected_package_version: z.string().min(1).optional(),
|
|
5
6
|
expected_catalog_digest: z
|
|
6
7
|
.string()
|
|
7
8
|
.regex(/^[a-f0-9]{64}$/u)
|
|
8
9
|
.optional(),
|
|
9
|
-
expected_server_path: z
|
|
10
|
+
expected_server_path: z
|
|
11
|
+
.string()
|
|
12
|
+
.min(1)
|
|
13
|
+
.refine(isAbsoluteLocalPath, {
|
|
14
|
+
message: "expected_server_path must be an absolute local filesystem path (for example /opt/rea/dist/main.js)",
|
|
15
|
+
})
|
|
16
|
+
.describe("Absolute local filesystem path expected for the running server; relative paths are rejected.")
|
|
17
|
+
.optional(),
|
|
10
18
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { isAbsoluteLocalPath } from "../domain/localPath.js";
|
|
2
3
|
import { sessionOutputSchemas, requireOutputSchema, } from "./toolOutputSchemas.js";
|
|
3
4
|
import { addressContextInputSchema, artifactComparisonInputSchema, binarySessionInputSchema, bundleComparisonInputSchema, callPathInputSchema, changedBehaviorInputSchema, closeBinaryInputSchema, functionComparisonInputSchema, importEvidenceBundleInputSchema, listUnknownsInputSchema, navigationContextInputSchema, openBinaryInputSchema, processComparisonInputSchema, processScenarioSchema, reconstructionVerificationInputSchema, recordUnknownInputSchema, getEvidenceBundleInputSchema, staticRuntimeCorrelationInputSchema, updateUnknownInputSchema, verifyUnknownResolutionInputSchema, } from "./sessionToolSchemas.js";
|
|
4
5
|
import { examplesFor } from "./toolContractHelpers.js";
|
|
@@ -14,7 +15,13 @@ const session = (name, description, inputSchema) => ({
|
|
|
14
15
|
});
|
|
15
16
|
/** Session-owned Evidence bundle export options. */
|
|
16
17
|
export const exportEvidenceBundleInputSchema = z.strictObject({
|
|
17
|
-
path: z
|
|
18
|
+
path: z
|
|
19
|
+
.string()
|
|
20
|
+
.min(1)
|
|
21
|
+
.refine(isAbsoluteLocalPath, {
|
|
22
|
+
message: "path must be an absolute local filesystem path (for example /tmp/rea/evidence.json or C:\\rea\\evidence.json)",
|
|
23
|
+
})
|
|
24
|
+
.describe("Absolute local filesystem path for the exported evidence bundle; relative paths are rejected."),
|
|
18
25
|
overwrite: z.boolean().default(false),
|
|
19
26
|
});
|
|
20
27
|
/** Target lifecycle tools available only on the long-lived MCP adapter. */
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { isAbsoluteLocalPath } from "../domain/localPath.js";
|
|
2
3
|
import { artifactComparisonInputSchema } from "../domain/artifactComparison.js";
|
|
3
4
|
import { bundleComparisonInputSchema } from "../domain/bundleComparison.js";
|
|
4
5
|
import { callPathInputSchema } from "../domain/callPath.js";
|
|
5
6
|
import { changedBehaviorInputSchema } from "../domain/changedBehavior.js";
|
|
6
7
|
import { functionComparisonInputSchema } from "../domain/functionComparison.js";
|
|
7
8
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
8
|
-
import { processScenarioSchema } from "../domain/processCapture.js";
|
|
9
|
-
import { processTraceSpecificationSchema } from "../domain/processTraceComparison.js";
|
|
9
|
+
import { processScenarioSchema } from "../domain/process/processCapture.js";
|
|
10
|
+
import { processTraceSpecificationSchema } from "../domain/process/processTraceComparison.js";
|
|
10
11
|
import { recordUnknownInputSchema } from "../domain/residualUnknown.js";
|
|
11
12
|
import { reconstructionVerificationInputSchema } from "../domain/reconstructionVerification.js";
|
|
12
13
|
import { staticRuntimeCorrelationInputSchema } from "../domain/staticRuntimeCorrelation.js";
|
|
@@ -28,7 +29,13 @@ export const addressContextInputSchema = z.strictObject({
|
|
|
28
29
|
});
|
|
29
30
|
/** Session-owned Evidence bundle import options. */
|
|
30
31
|
export const importEvidenceBundleInputSchema = z.strictObject({
|
|
31
|
-
path: z
|
|
32
|
+
path: z
|
|
33
|
+
.string()
|
|
34
|
+
.min(1)
|
|
35
|
+
.refine(isAbsoluteLocalPath, {
|
|
36
|
+
message: "path must be an absolute local filesystem path (for example /tmp/evidence.json or C:\\rea\\evidence.json)",
|
|
37
|
+
})
|
|
38
|
+
.describe("Absolute local filesystem path for the evidence bundle to import; relative paths are rejected."),
|
|
32
39
|
});
|
|
33
40
|
/** Evidence references for deterministic process comparison. */
|
|
34
41
|
export const processComparisonInputSchema = z.strictObject({
|
|
@@ -47,7 +47,7 @@ export const TOOL_EXAMPLE_OVERRIDES = {
|
|
|
47
47
|
open_binary: { path: "/tmp/fixture" },
|
|
48
48
|
export_evidence_bundle: { path: "/tmp/evidence.json" },
|
|
49
49
|
inspect_address_context: { address: "0x1000" },
|
|
50
|
-
import_evidence_bundle: { path: "evidence.json" },
|
|
50
|
+
import_evidence_bundle: { path: "/tmp/evidence.json" },
|
|
51
51
|
capture_process_scenario: {
|
|
52
52
|
executable: "/usr/bin/true",
|
|
53
53
|
working_directory: "/tmp",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { EVM_TOOL_CONTRACTS } from "./evm/evmToolContracts.js";
|
|
2
|
+
import { BINARY_DIAGNOSTICS_TOOL_CONTRACTS } from "./native/binaryDiagnosticsToolContracts.js";
|
|
1
3
|
import { NATIVE_TOOL_CONTRACTS } from "./native/nativeToolContracts.js";
|
|
2
4
|
import { ARTIFACT_TOOL_CONTRACTS } from "./artifactToolContracts.js";
|
|
3
5
|
import { MANAGED_TOOL_CONTRACTS } from "./managed/managedToolContracts.js";
|
|
@@ -10,6 +12,7 @@ import { JAVASCRIPT_RUNTIME_OBSERVATION_TOOL_CONTRACTS } from "./javascript/java
|
|
|
10
12
|
import { APPLICATION_TOOL_CONTRACTS } from "./applicationToolContracts.js";
|
|
11
13
|
import { WEB_SCRIPT_TOOL_CONTRACTS } from "./webScriptToolContracts.js";
|
|
12
14
|
import { WEB_RUNTIME_TOOL_CONTRACTS } from "./webRuntimeToolContracts.js";
|
|
15
|
+
import { WEB_NETWORK_CAPTURE_TOOL_CONTRACTS } from "./webNetworkCaptureToolContracts.js";
|
|
13
16
|
import { JAVASCRIPT_RECOVERY_TOOL_CONTRACTS } from "./javascript/javascriptRecoveryToolContracts.js";
|
|
14
17
|
import { OFFICIAL_TOOL_CONTRACTS } from "./officialToolContracts.js";
|
|
15
18
|
import { ENHANCED_TOOL_CONTRACTS } from "./enhancedToolContracts.js";
|
|
@@ -19,7 +22,9 @@ export const TOOL_CONTRACTS = [
|
|
|
19
22
|
...OFFICIAL_TOOL_CONTRACTS,
|
|
20
23
|
...ENHANCED_TOOL_CONTRACTS,
|
|
21
24
|
...NATIVE_TOOL_CONTRACTS,
|
|
25
|
+
...BINARY_DIAGNOSTICS_TOOL_CONTRACTS,
|
|
22
26
|
...ARTIFACT_TOOL_CONTRACTS,
|
|
27
|
+
...EVM_TOOL_CONTRACTS,
|
|
23
28
|
...MANAGED_TOOL_CONTRACTS,
|
|
24
29
|
...ANDROID_TOOL_CONTRACTS,
|
|
25
30
|
...FIRMWARE_TOOL_CONTRACTS,
|
|
@@ -30,6 +35,7 @@ export const TOOL_CONTRACTS = [
|
|
|
30
35
|
...APPLICATION_TOOL_CONTRACTS,
|
|
31
36
|
...WEB_SCRIPT_TOOL_CONTRACTS,
|
|
32
37
|
...WEB_RUNTIME_TOOL_CONTRACTS,
|
|
38
|
+
...WEB_NETWORK_CAPTURE_TOOL_CONTRACTS,
|
|
33
39
|
...JAVASCRIPT_RECOVERY_TOOL_CONTRACTS,
|
|
34
40
|
...SESSION_TOOL_CONTRACTS,
|
|
35
41
|
];
|
|
@@ -18,6 +18,16 @@ const browserEvidence = effects({
|
|
|
18
18
|
const sessionEvidence = effects({ mutatesSession: true });
|
|
19
19
|
/** Explicit effect audit for every public tool. */
|
|
20
20
|
export const TOOL_EFFECTS = {
|
|
21
|
+
inspect_evm_interface: effects({
|
|
22
|
+
mutatesSession: true,
|
|
23
|
+
writesFilesystem: true,
|
|
24
|
+
launchesProcess: true,
|
|
25
|
+
}),
|
|
26
|
+
inspect_web_network_capture: effects({
|
|
27
|
+
mutatesSession: true,
|
|
28
|
+
writesFilesystem: true,
|
|
29
|
+
launchesProcess: true,
|
|
30
|
+
}),
|
|
21
31
|
observe_web_execution: effects({
|
|
22
32
|
mutatesTarget: true,
|
|
23
33
|
mutatesSession: true,
|
|
@@ -37,6 +47,16 @@ export const TOOL_EFFECTS = {
|
|
|
37
47
|
launchesProcess: true,
|
|
38
48
|
accessesNetwork: true,
|
|
39
49
|
}),
|
|
50
|
+
inspect_recorded_crash: effects({
|
|
51
|
+
mutatesSession: true,
|
|
52
|
+
writesFilesystem: true,
|
|
53
|
+
launchesProcess: true,
|
|
54
|
+
}),
|
|
55
|
+
inspect_binary_layout: effects({
|
|
56
|
+
mutatesSession: true,
|
|
57
|
+
writesFilesystem: true,
|
|
58
|
+
launchesProcess: true,
|
|
59
|
+
}),
|
|
40
60
|
inspect_firmware_regions: effects({
|
|
41
61
|
mutatesSession: true,
|
|
42
62
|
launchesProcess: true,
|
|
@@ -152,6 +172,15 @@ export const TOOL_EFFECTS = {
|
|
|
152
172
|
mayDiscardData: true,
|
|
153
173
|
idempotent: false,
|
|
154
174
|
}),
|
|
175
|
+
// The owned process can change files, show UI and use the network.
|
|
176
|
+
observe_native_calls: effects({
|
|
177
|
+
mutatesSession: true,
|
|
178
|
+
writesFilesystem: true,
|
|
179
|
+
launchesProcess: true,
|
|
180
|
+
accessesNetwork: true,
|
|
181
|
+
changesUiState: true,
|
|
182
|
+
idempotent: false,
|
|
183
|
+
}),
|
|
155
184
|
inspect_macho: nativeEvidence,
|
|
156
185
|
inspect_signature: nativeEvidence,
|
|
157
186
|
inspect_plist: nativeEvidence,
|
|
@@ -171,6 +200,7 @@ export const TOOL_EFFECTS = {
|
|
|
171
200
|
decode_interface_builder: evidence,
|
|
172
201
|
inspect_asset_catalog: nativeEvidence,
|
|
173
202
|
inspect_keyed_archive: evidence,
|
|
203
|
+
trace_dylib_resolution: evidence,
|
|
174
204
|
inspect_managed_artifact: evidence,
|
|
175
205
|
inspect_managed_members: evidence,
|
|
176
206
|
inspect_managed_native_boundaries: evidence,
|
|
@@ -4,17 +4,19 @@ import { nativeLoadImageSchema } from "../domain/native/nativeLoadImage.js";
|
|
|
4
4
|
import { nativeUiResultSchema } from "../domain/native/nativeUiObservation.js";
|
|
5
5
|
import { nativeValueTraceSchema } from "../domain/native/nativeValueTrace.js";
|
|
6
6
|
import { nativeDataTypeSchema } from "../domain/native/nativeDataType.js";
|
|
7
|
+
import { nativeCallObservationResultSchema } from "../domain/native/nativeCallObservation.js";
|
|
7
8
|
import { nativeInstructionSchema, nativeCallTargetsSchema, } from "../domain/native/nativeInstruction.js";
|
|
8
9
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
9
10
|
import { residualUnknownSchema } from "../domain/residualUnknown.js";
|
|
10
11
|
import { evidenceBundleSchema } from "../domain/evidenceBundle.js";
|
|
11
|
-
import { processCaptureComparisonSchema, processCaptureSchema, } from "../domain/processCapture.js";
|
|
12
|
+
import { processCaptureComparisonSchema, processCaptureSchema, } from "../domain/process/processCapture.js";
|
|
12
13
|
import { functionInstructionWindowSchema, referenceKindSchema, } from "../domain/hopperValues.js";
|
|
13
14
|
import { nativeApiInspectionResultSchema } from "../domain/native/nativeApiBoundary.js";
|
|
14
15
|
import { demangleSwiftSchema, inspectMachoSchema, inspectPlistSchema, inspectSignatureSchema, listArchitecturesSchema, } from "../domain/native/nativeInspection.js";
|
|
15
16
|
import { artifactExtractionResultSchema } from "../domain/artifactGraph.js";
|
|
16
17
|
import { artifactInspectionResultSchema } from "../domain/artifactInspection.js";
|
|
17
18
|
import { interfaceBuilderAnalysisSchema } from "../domain/apple/interfaceBuilderGraph.js";
|
|
19
|
+
import { dylibResolutionResultSchema } from "../domain/apple/dylibResolution.js";
|
|
18
20
|
import { keyedArchiveResultSchema } from "../domain/apple/keyedArchive.js";
|
|
19
21
|
import { appleAssetCatalogResultSchema } from "../domain/apple/appleAssetCatalog.js";
|
|
20
22
|
import { managedArtifactInspectionSchema, managedMemberInspectionSchema, managedNativeBoundaryInspectionSchema, } from "../domain/managed/managedArtifact.js";
|
|
@@ -235,6 +237,7 @@ export const enhancedOutputSchemas = {
|
|
|
235
237
|
export const nativeOutputSchemas = {
|
|
236
238
|
observe_native_ui: resultOf(nativeUiResultSchema),
|
|
237
239
|
capture_native_ui_scenario: resultOf(nativeUiResultSchema),
|
|
240
|
+
observe_native_calls: resultOf(nativeCallObservationResultSchema),
|
|
238
241
|
inspect_macho: resultOf(inspectMachoSchema),
|
|
239
242
|
inspect_signature: resultOf(inspectSignatureSchema),
|
|
240
243
|
inspect_plist: resultOf(inspectPlistSchema),
|
|
@@ -248,6 +251,7 @@ export const artifactOutputSchemas = {
|
|
|
248
251
|
decode_interface_builder: resultOf(interfaceBuilderAnalysisSchema),
|
|
249
252
|
inspect_keyed_archive: resultOf(keyedArchiveResultSchema),
|
|
250
253
|
inspect_asset_catalog: resultOf(appleAssetCatalogResultSchema),
|
|
254
|
+
trace_dylib_resolution: resultOf(dylibResolutionResultSchema),
|
|
251
255
|
};
|
|
252
256
|
/** Exact Evidence schema for execution-free managed static analysis. */
|
|
253
257
|
export const managedOutputSchemas = {
|
|
@@ -305,7 +305,7 @@ export const sessionProvider = z
|
|
|
305
305
|
negotiated_protocol_version: z.string().nullable(),
|
|
306
306
|
client: z.object({ name: z.string(), version: z.string() }).nullable(),
|
|
307
307
|
skill: z.object({ name: z.string(), expected_version: z.string() }),
|
|
308
|
-
catalog: z.record(z.string(),
|
|
308
|
+
catalog: z.record(z.string(), jsonValueSchema),
|
|
309
309
|
protocol_features: z.object({
|
|
310
310
|
progress: z.boolean(),
|
|
311
311
|
cancellation: z.boolean(),
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { inspectWebNetworkCaptureInputSchema, webNetworkCaptureSchema, } from "../domain/webNetworkCapture.js";
|
|
2
|
+
import { toolContractMetadata } from "./toolEffects.js";
|
|
3
|
+
import { evidenceResultOf } from "./toolOutputSchemas.js";
|
|
4
|
+
/** Historical inspection is distinct from live browser capture and runtime authority. */
|
|
5
|
+
export const WEB_NETWORK_CAPTURE_TOOL_CONTRACTS = [
|
|
6
|
+
{
|
|
7
|
+
name: "inspect_web_network_capture",
|
|
8
|
+
...toolContractMetadata("inspect_web_network_capture"),
|
|
9
|
+
description: "Inspect retained local HAR 1.2 or native mitmproxy capture records without contacting recorded URLs. Returns original ordinals, pointers/byte ranges, preserved producer fields, precise numeric representations and exact exposed binary bytes inline. Excludes known transport credentials and explicitly marked values. Decodes every record before optional ordinal selection; malformed or oversized captures return no partial success. Duplicate HAR members are invalid; prototype-named __proto__ members are unsupported by the current shared JSON boundary. Uses pinned upstream parsers, owned temporary files and bounded offline processes. Native mitmproxy requires caller-supplied mitmdump 12.2.3 on Linux. Browser transaction IDs, runtime attribution and original bytes of HAR Unicode text remain unknown.",
|
|
10
|
+
kind: "browser-provider",
|
|
11
|
+
inputSchema: inspectWebNetworkCaptureInputSchema,
|
|
12
|
+
outputSchema: evidenceResultOf(webNetworkCaptureSchema),
|
|
13
|
+
examples: [
|
|
14
|
+
{
|
|
15
|
+
title: "Inspect historical HAR entries",
|
|
16
|
+
input: {
|
|
17
|
+
capture_path: "/captures/session.har",
|
|
18
|
+
format: "har",
|
|
19
|
+
record_ordinals: [0, 2],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
];
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
const ANALYSIS_ERROR_TAGS = [
|
|
3
3
|
"AnalysisProtocolError",
|
|
4
4
|
"AnalysisInputError",
|
|
5
|
+
"AnalysisAccessDeniedError",
|
|
6
|
+
"AnalysisArtifactChangedError",
|
|
5
7
|
"AnalysisOutputError",
|
|
6
8
|
"AnalysisCapabilityUnavailableError",
|
|
9
|
+
"AnalysisUnsupportedTargetError",
|
|
7
10
|
"AnalysisCancelledError",
|
|
8
11
|
"AnalysisTimeoutError",
|
|
12
|
+
"AnalysisResourceConstraintError",
|
|
9
13
|
"ProviderSelectionError",
|
|
10
14
|
"ProviderAdapterError",
|
|
11
15
|
"BrowserObservationError",
|
|
@@ -26,8 +30,19 @@ const ANALYSIS_ERROR_TAGS = [
|
|
|
26
30
|
];
|
|
27
31
|
/** Base class for expected analysis, provider, and session failures. */
|
|
28
32
|
export class AnalysisError extends Error {
|
|
33
|
+
capturedOutput;
|
|
34
|
+
constructor(message, options) {
|
|
35
|
+
super(message, options);
|
|
36
|
+
this.capturedOutput =
|
|
37
|
+
options?.capturedOutput === undefined
|
|
38
|
+
? undefined
|
|
39
|
+
: { ...options.capturedOutput };
|
|
40
|
+
}
|
|
29
41
|
userMessage = undefined;
|
|
30
42
|
userCategory = undefined;
|
|
31
43
|
cleanupIncomplete = false;
|
|
32
44
|
cleanupResources = [];
|
|
45
|
+
executionFailure = undefined;
|
|
46
|
+
partialObservation = undefined;
|
|
47
|
+
cleanupReport = undefined;
|
|
33
48
|
}
|
|
@@ -1,4 +1,32 @@
|
|
|
1
|
-
import { AnalysisError } from "./analysisErrorBase.js";
|
|
1
|
+
import { AnalysisError, } from "./analysisErrorBase.js";
|
|
2
|
+
/** A readable supplied artifact lies outside this operation's supported target formats. */
|
|
3
|
+
export class AnalysisUnsupportedTargetError extends AnalysisError {
|
|
4
|
+
operation;
|
|
5
|
+
path;
|
|
6
|
+
reason;
|
|
7
|
+
_tag = "AnalysisUnsupportedTargetError";
|
|
8
|
+
constructor(operation, path, reason, options) {
|
|
9
|
+
super(`Unsupported target for ${operation} at ${path}: ${reason}`, options);
|
|
10
|
+
this.operation = operation;
|
|
11
|
+
this.path = path;
|
|
12
|
+
this.reason = reason;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Provider reported a resource failure, distinct from malformed input or unsupported coverage. */
|
|
16
|
+
export class AnalysisResourceConstraintError extends AnalysisError {
|
|
17
|
+
operation;
|
|
18
|
+
resource;
|
|
19
|
+
reason;
|
|
20
|
+
reportedLimits;
|
|
21
|
+
_tag = "AnalysisResourceConstraintError";
|
|
22
|
+
constructor(operation, resource, reason, reportedLimits, options) {
|
|
23
|
+
super(`Resource constraint during ${operation}: ${reason}`, options);
|
|
24
|
+
this.operation = operation;
|
|
25
|
+
this.resource = resource;
|
|
26
|
+
this.reason = reason;
|
|
27
|
+
this.reportedLimits = reportedLimits;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
2
30
|
/** Provider-neutral invalid analysis input or output at an application boundary. */
|
|
3
31
|
export class AnalysisProtocolError extends AnalysisError {
|
|
4
32
|
_tag = "AnalysisProtocolError";
|
|
@@ -44,8 +72,8 @@ export class AnalysisCapabilityUnavailableError extends AnalysisError {
|
|
|
44
72
|
export class AnalysisCancelledError extends AnalysisError {
|
|
45
73
|
operation;
|
|
46
74
|
_tag = "AnalysisCancelledError";
|
|
47
|
-
constructor(operation) {
|
|
48
|
-
super(`Analysis operation was cancelled: ${operation}
|
|
75
|
+
constructor(operation, options) {
|
|
76
|
+
super(`Analysis operation was cancelled: ${operation}`, options);
|
|
49
77
|
this.operation = operation;
|
|
50
78
|
}
|
|
51
79
|
}
|
|
@@ -54,9 +82,35 @@ export class AnalysisTimeoutError extends AnalysisError {
|
|
|
54
82
|
operation;
|
|
55
83
|
timeoutMs;
|
|
56
84
|
_tag = "AnalysisTimeoutError";
|
|
57
|
-
constructor(operation, timeoutMs) {
|
|
58
|
-
super(`Analysis operation timed out after ${String(timeoutMs)}ms: ${operation}
|
|
85
|
+
constructor(operation, timeoutMs, options) {
|
|
86
|
+
super(`Analysis operation timed out after ${String(timeoutMs)}ms: ${operation}`, options);
|
|
59
87
|
this.operation = operation;
|
|
60
88
|
this.timeoutMs = timeoutMs;
|
|
61
89
|
}
|
|
62
90
|
}
|
|
91
|
+
/** Host filesystem permissions denied the selected read; this is not malformed caller input. */
|
|
92
|
+
export class AnalysisAccessDeniedError extends AnalysisError {
|
|
93
|
+
operation;
|
|
94
|
+
path;
|
|
95
|
+
systemCode;
|
|
96
|
+
_tag = "AnalysisAccessDeniedError";
|
|
97
|
+
constructor(operation, path, systemCode, options) {
|
|
98
|
+
super(`Host filesystem read access denied (${systemCode}) for ${path} during ${operation}`, options);
|
|
99
|
+
this.operation = operation;
|
|
100
|
+
this.path = path;
|
|
101
|
+
this.systemCode = systemCode;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** Selected artifact acquisition observed a change, so no stable identity can be reported. */
|
|
105
|
+
export class AnalysisArtifactChangedError extends AnalysisError {
|
|
106
|
+
operation;
|
|
107
|
+
path;
|
|
108
|
+
reason;
|
|
109
|
+
_tag = "AnalysisArtifactChangedError";
|
|
110
|
+
constructor(operation, path, reason, options) {
|
|
111
|
+
super(`Selected artifact changed during acquisition: ${reason}`, options);
|
|
112
|
+
this.operation = operation;
|
|
113
|
+
this.path = path;
|
|
114
|
+
this.reason = reason;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalysisInputError } from "./analysisErrorCore.js";
|
|
1
|
+
import { AnalysisAccessDeniedError, AnalysisArtifactChangedError, AnalysisInputError, AnalysisUnsupportedTargetError, AnalysisResourceConstraintError, } from "./analysisErrorCore.js";
|
|
2
2
|
import { ArtifactOperationError } from "./artifactOperationError.js";
|
|
3
3
|
import { BinaryTargetError, ConfigurationError, NoBinaryOpenError, } from "./configurationErrors.js";
|
|
4
4
|
import { BrowserObservationError } from "./browserObservationError.js";
|
|
@@ -9,6 +9,14 @@ import { UnknownRegistryError } from "./unknownRegistryError.js";
|
|
|
9
9
|
import {} from "./analysisErrorBase.js";
|
|
10
10
|
import {} from "./analysisErrorProjection.js";
|
|
11
11
|
export const analysisErrorRemediationAction = (error) => {
|
|
12
|
+
if (error instanceof AnalysisUnsupportedTargetError)
|
|
13
|
+
return "Select a target supported by this operation or choose an operation supporting the reported target format.";
|
|
14
|
+
if (error instanceof AnalysisResourceConstraintError)
|
|
15
|
+
return error.resource === "cpu"
|
|
16
|
+
? "Review the reported worker CPU limits and observed signal. Retry with sufficient CPU time or a smaller artifact; REA retains tighter inherited limits."
|
|
17
|
+
: error.resource === "file-size"
|
|
18
|
+
? "Review the reported worker file-size limits and write failure. Retry with a sufficient file-size allowance for the evidence reply; REA retains tighter inherited limits."
|
|
19
|
+
: "Review the reported worker memory limits and available host memory. Retry with sufficient memory or a smaller artifact; REA retains tighter inherited limits.";
|
|
12
20
|
if (error instanceof HopperTimeoutError)
|
|
13
21
|
return error.providerState === "busy"
|
|
14
22
|
? "Check binary_session.analysis_activity, wait for the active Hopper request to finish, then retry."
|
|
@@ -26,6 +34,10 @@ export const analysisErrorRemediationAction = (error) => {
|
|
|
26
34
|
if (error instanceof BinaryTargetError &&
|
|
27
35
|
error.constraint === "directory_requires_file")
|
|
28
36
|
return "For a JavaScript/Electron application directory, call analyze_javascript_application with input_path or run `rea analyze <directory>`. For binary analysis, select its executable file.";
|
|
37
|
+
if (error instanceof AnalysisAccessDeniedError)
|
|
38
|
+
return "Check the current process's read access to the selected path. Retry with a readable local file.";
|
|
39
|
+
if (error instanceof AnalysisArtifactChangedError)
|
|
40
|
+
return "Wait until the selected file is stable, then retry this operation.";
|
|
29
41
|
if (error instanceof AnalysisInputError)
|
|
30
42
|
return "Correct the listed arguments and retry.";
|
|
31
43
|
if (error instanceof UnknownRegistryError && error.reason === "not-found")
|
|
@@ -73,17 +85,29 @@ const artifactErrorCategory = (reason) => {
|
|
|
73
85
|
};
|
|
74
86
|
const STATIC_ERROR_CATEGORIES = {
|
|
75
87
|
AnalysisInputError: "invalid_input",
|
|
88
|
+
AnalysisAccessDeniedError: "unavailable",
|
|
89
|
+
AnalysisArtifactChangedError: "integrity_mismatch",
|
|
76
90
|
AnalysisCapabilityUnavailableError: "unsupported_provider",
|
|
91
|
+
AnalysisUnsupportedTargetError: "unsupported_target",
|
|
77
92
|
ProviderSelectionError: "unsupported_provider",
|
|
78
93
|
EvidenceIntegrityError: "integrity_mismatch",
|
|
79
94
|
AnalysisCancelledError: "cancelled",
|
|
80
95
|
HopperCancelledError: "cancelled",
|
|
81
96
|
AnalysisTimeoutError: "timeout",
|
|
97
|
+
AnalysisResourceConstraintError: "resource_constraint",
|
|
82
98
|
HopperTimeoutError: "timeout",
|
|
83
99
|
NoBinaryOpenError: "unavailable",
|
|
84
100
|
BinaryTargetError: "unavailable",
|
|
85
101
|
};
|
|
86
102
|
export const analysisErrorUserMessage = (error) => {
|
|
103
|
+
if (error instanceof AnalysisUnsupportedTargetError)
|
|
104
|
+
return error.message;
|
|
105
|
+
if (error instanceof AnalysisResourceConstraintError)
|
|
106
|
+
return error.reason;
|
|
107
|
+
if (error instanceof AnalysisAccessDeniedError)
|
|
108
|
+
return "Host filesystem permissions denied read access to the selected path.";
|
|
109
|
+
if (error instanceof AnalysisArtifactChangedError)
|
|
110
|
+
return "The selected artifact changed during acquisition; no stable snapshot was decoded.";
|
|
87
111
|
if (error instanceof AnalysisInputError)
|
|
88
112
|
return "Analysis input is invalid. Check the arguments and try again.";
|
|
89
113
|
const hopperMessage = hopperErrorUserMessage(error);
|
|
@@ -202,10 +226,14 @@ const evidenceFileMessage = (reason) => {
|
|
|
202
226
|
const KNOWN_ERROR_TAGS = {
|
|
203
227
|
AnalysisProtocolError: true,
|
|
204
228
|
AnalysisInputError: true,
|
|
229
|
+
AnalysisAccessDeniedError: true,
|
|
230
|
+
AnalysisArtifactChangedError: true,
|
|
205
231
|
AnalysisOutputError: true,
|
|
206
232
|
AnalysisCapabilityUnavailableError: true,
|
|
233
|
+
AnalysisUnsupportedTargetError: true,
|
|
207
234
|
AnalysisCancelledError: true,
|
|
208
235
|
AnalysisTimeoutError: true,
|
|
236
|
+
AnalysisResourceConstraintError: true,
|
|
209
237
|
ProviderSelectionError: true,
|
|
210
238
|
ProviderAdapterError: true,
|
|
211
239
|
BrowserObservationError: true,
|