rea-agents 1.6.0 → 2.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 -66
- package/bridge/ghidra/ReaGhidraBridge.java +2075 -0
- package/bridge/hopper_bridge.py +13 -3
- package/dist/application/AbortablePromise.js +25 -0
- package/dist/application/AnalysisProvider.js +3 -0
- package/dist/application/AnalysisProviderEvaluation.js +60 -0
- package/dist/application/AnalysisProviderRegistry.js +228 -0
- package/dist/application/AnalysisSnapshotCache.js +41 -21
- package/dist/application/AnalysisSnapshotFiles.js +5 -6
- package/dist/application/BinarySession.js +218 -101
- package/dist/application/CapabilityInventory.js +18 -0
- package/dist/application/CompositeProvider.js +20 -8
- package/dist/application/CrossVersionInvestigation.js +10 -6
- package/dist/application/DirectAnalysis.js +49 -35
- package/dist/application/Doctor.js +110 -8
- package/dist/application/ElectronBoundaryAnalysis.js +96 -0
- package/dist/application/ElectronBoundaryGraph.js +9 -0
- package/dist/application/ElectronBoundaryGraphContext.js +62 -0
- package/dist/application/ElectronBoundaryGraphIpc.js +242 -0
- package/dist/application/ElectronBoundaryGraphNative.js +86 -0
- package/dist/application/ElectronBoundaryGraphWindows.js +199 -0
- package/dist/application/EnhancedTools.js +39 -14
- package/dist/application/InvestigationProviders.js +41 -0
- package/dist/application/JavaScriptApplicationEvidence.js +26 -0
- package/dist/application/JavaScriptApplicationEvidenceGraph.js +89 -0
- package/dist/application/JavaScriptApplicationService.js +74 -0
- package/dist/application/JavaScriptApplicationWorkflowEvidence.js +29 -0
- package/dist/application/JavaScriptApplicationWorkflowService.js +90 -0
- package/dist/application/JavaScriptArtifactAnalysis.js +305 -0
- package/dist/application/JavaScriptArtifactAnalysisTypes.js +1 -0
- package/dist/application/JavaScriptArtifactFiles.js +231 -0
- package/dist/application/JavaScriptArtifactGraphAccumulator.js +54 -0
- package/dist/application/JavaScriptArtifactGraphBuilder.js +144 -0
- package/dist/application/JavaScriptArtifactGraphContext.js +205 -0
- package/dist/application/JavaScriptArtifactGraphDocuments.js +108 -0
- package/dist/application/JavaScriptArtifactGraphEvidence.js +99 -0
- package/dist/application/JavaScriptArtifactGraphFindings.js +271 -0
- package/dist/application/JavaScriptArtifactGraphStructure.js +409 -0
- package/dist/application/JavaScriptArtifactReconstruction.js +77 -0
- package/dist/application/JavaScriptArtifactReconstructionInput.js +18 -0
- package/dist/application/JavaScriptReplayPlanning.js +201 -0
- package/dist/application/JavaScriptReplayService.js +266 -0
- package/dist/application/JavaScriptRuntimeReconciliationEvidence.js +25 -0
- package/dist/application/JavaScriptRuntimeReconciliationService.js +27 -0
- package/dist/application/MacHopper.js +20 -4
- package/dist/application/ManagedApplicationGraphService.js +55 -0
- package/dist/application/ManagedMemberComparisonService.js +122 -0
- package/dist/application/ManagedNativeVerificationService.js +39 -0
- package/dist/application/ManagedReconstructionService.js +58 -0
- package/dist/application/ManagedRuntimeCorrelationService.js +103 -0
- package/dist/application/PermissionAuthority.js +1 -1
- package/dist/application/ProcessCaptureLifecycle.js +1 -1
- package/dist/application/ProcessHarness.js +1 -1
- package/dist/application/ProcessSampling.js +16 -12
- package/dist/application/ProjectPermissionStore.js +1 -0
- package/dist/application/SessionProviderRouter.js +219 -0
- package/dist/application/Setup.js +84 -60
- package/dist/application/SetupClients.js +1 -1
- package/dist/application/SetupPlan.js +9 -2
- package/dist/application/SupportedClients.js +40 -16
- package/dist/application/Upgrade.js +1 -1
- package/dist/application/runtime.js +11 -6
- package/dist/artifacts/AsarArtifactReader.js +23 -3
- package/dist/browser/CdpBrowserProvider.js +4 -2
- package/dist/browser/CdpCaptureEvents.js +49 -0
- package/dist/browser/CdpElectronInspection.js +106 -162
- package/dist/browser/CdpElectronProvider.js +9 -3
- package/dist/browser/CdpElectronScriptEvents.js +69 -0
- package/dist/browser/CdpElectronScripts.js +94 -0
- package/dist/browser/CdpElectronWorkers.js +56 -0
- package/dist/browser/CdpEndpoint.js +14 -1
- package/dist/browser/CdpPageCapture.js +8 -4
- package/dist/catalogIdentity.js +6 -42
- package/dist/cli.js +446 -34
- package/dist/cliApplicationCommands.js +62 -0
- package/dist/cliBrowserAdvancedCommands.js +5 -4
- package/dist/cliBrowserCommands.js +5 -4
- package/dist/cliCommandNames.js +56 -0
- package/dist/cliElectronCommands.js +106 -3
- package/dist/cliEvidenceCommands.js +4 -3
- package/dist/cliInvestigationCommands.js +2 -1
- package/dist/cliJsonInput.js +54 -0
- package/dist/cliPolicyCommands.js +2 -1
- package/dist/cliProcessCommands.js +3 -2
- package/dist/config.js +101 -2
- package/dist/contracts/applicationToolContracts.js +91 -0
- package/dist/contracts/artifactToolContracts.js +5 -9
- package/dist/contracts/browserToolContracts.js +14 -62
- package/dist/contracts/electronToolContracts.js +45 -19
- package/dist/contracts/enhancedInputs.js +2 -2
- package/dist/contracts/errorSchemas.js +1 -0
- package/dist/contracts/investigationExamples.js +0 -6
- package/dist/contracts/javascriptApplicationWorkflowExamples.js +46 -0
- package/dist/contracts/javascriptRuntimeReconciliationExample.js +208 -0
- package/dist/contracts/managedToolContracts.js +153 -0
- package/dist/contracts/managedWorkflowExamples.js +346 -0
- package/dist/contracts/managedWorkflowToolContracts.js +203 -0
- package/dist/contracts/nativeToolContracts.js +2 -6
- package/dist/contracts/promptContracts.js +18 -2
- package/dist/contracts/providerSelection.js +28 -0
- package/dist/contracts/sessionLifecycleInputs.js +2 -0
- package/dist/contracts/toolContractExamples.js +10 -25
- package/dist/contracts/toolContracts.js +69 -65
- package/dist/contracts/toolEffects.js +160 -0
- package/dist/contracts/toolOutputSchemas.js +152 -42
- package/dist/doctorRuntime.js +47 -0
- package/dist/domain/analysisProfile.js +78 -0
- package/dist/domain/analysisSnapshot.js +92 -46
- package/dist/domain/artifactComparison.js +3 -4
- package/dist/domain/artifactGraph.js +1 -0
- package/dist/domain/binaryTarget.js +4 -29
- package/dist/domain/browserObservation.js +3 -0
- package/dist/domain/bundleComparison.js +4 -4
- package/dist/domain/electronObservation.js +13 -0
- package/dist/domain/electronStaticAnalysis.js +9 -0
- package/dist/domain/electronStaticAnalysisBrowser.js +194 -0
- package/dist/domain/electronStaticAnalysisIpc.js +171 -0
- package/dist/domain/electronStaticAnalysisNative.js +164 -0
- package/dist/domain/electronStaticAnalysisTypes.js +1 -0
- package/dist/domain/electronStaticAnalysisValues.js +103 -0
- package/dist/domain/errors.js +148 -7
- package/dist/domain/evidence.js +44 -5
- package/dist/domain/evidenceBundle.js +9 -7
- package/dist/domain/functionComparison.js +9 -3
- package/dist/domain/functionComparisonNormalization.js +37 -0
- package/dist/domain/functionComparisonSchemas.js +3 -8
- package/dist/domain/functionDossierEvidence.js +4 -1
- package/dist/domain/hopperValues.js +66 -9
- package/dist/domain/inputIssueProjection.js +52 -0
- package/dist/domain/investigationWorkspace.js +2 -1
- package/dist/domain/javascriptApplicationAnalysis.js +155 -0
- package/dist/domain/javascriptApplicationChangeGraph.js +231 -0
- package/dist/domain/javascriptApplicationEvidenceSchemas.js +379 -0
- package/dist/domain/javascriptApplicationGraph.js +282 -0
- package/dist/domain/javascriptApplicationGraphSchemas.js +139 -0
- package/dist/domain/javascriptApplicationVersionComparison.js +116 -0
- package/dist/domain/javascriptApplicationVersionComparisonSchemas.js +139 -0
- package/dist/domain/javascriptApplicationVersionItems.js +221 -0
- package/dist/domain/javascriptApplicationVersionKeys.js +170 -0
- package/dist/domain/javascriptAstFingerprint.js +143 -0
- package/dist/domain/javascriptFeatureSeed.js +140 -0
- package/dist/domain/javascriptFeatureTrace.js +232 -0
- package/dist/domain/javascriptFeatureTraceSchemas.js +136 -0
- package/dist/domain/javascriptFeatureTraversal.js +88 -0
- package/dist/domain/javascriptNativeHandoff.js +85 -0
- package/dist/domain/javascriptReplay.js +361 -0
- package/dist/domain/javascriptRuntimeLoadState.js +106 -0
- package/dist/domain/javascriptRuntimeReconciliation.js +42 -0
- package/dist/domain/javascriptRuntimeReconciliationGraph.js +169 -0
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +247 -0
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +160 -0
- package/dist/domain/javascriptRuntimeReconciliationResult.js +119 -0
- package/dist/domain/javascriptRuntimeReconciliationRuntime.js +316 -0
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +245 -0
- package/dist/domain/javascriptRuntimeStaticCandidates.js +191 -0
- package/dist/domain/javascriptStaticAnalysis.js +346 -0
- package/dist/domain/javascriptStaticAnalysisFindings.js +39 -0
- package/dist/domain/javascriptStaticAnalysisHelpers.js +274 -0
- package/dist/domain/javascriptStaticAnalysisState.js +23 -0
- package/dist/domain/javascriptStaticAnalysisTypes.js +1 -0
- package/dist/domain/managedApplicationGraph.js +556 -0
- package/dist/domain/managedArtifact.js +444 -0
- package/dist/domain/managedMemberComparison.js +565 -0
- package/dist/domain/managedNativeVerification.js +408 -0
- package/dist/domain/managedReconstruction.js +183 -0
- package/dist/domain/managedRuntimeCorrelation.js +175 -0
- package/dist/domain/reconstructionVerificationSchemas.js +1 -3
- package/dist/dotnet/ManagedArtifactInspector.js +318 -0
- package/dist/dotnet/ManagedMemberInspector.js +887 -0
- package/dist/dotnet/ManagedMetadataHeaps.js +131 -0
- package/dist/dotnet/ManagedMetadataInventory.js +368 -0
- package/dist/dotnet/ManagedMetadataLayout.js +322 -0
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +391 -0
- package/dist/dotnet/ManagedPeReader.js +157 -0
- package/dist/dotnet/ManagedReaderFailure.js +10 -0
- package/dist/dotnet/ManagedStaticProvider.js +203 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +37 -0
- package/dist/ghidra/GhidraClient.js +400 -0
- package/dist/ghidra/GhidraClientTypes.js +1 -0
- package/dist/ghidra/GhidraDefaults.js +20 -0
- package/dist/ghidra/GhidraDiagnostics.js +43 -0
- package/dist/ghidra/GhidraDoctor.js +59 -0
- package/dist/ghidra/GhidraFunctionValues.js +264 -0
- package/dist/ghidra/GhidraInstallation.js +239 -0
- package/dist/ghidra/GhidraInventoryValues.js +217 -0
- package/dist/ghidra/GhidraLauncher.js +139 -0
- package/dist/ghidra/GhidraProvider.js +366 -0
- package/dist/ghidra/GhidraRequestQueue.js +98 -0
- package/dist/ghidra/GhidraResponseBuffer.js +31 -0
- package/dist/ghidra/GhidraResponseRouter.js +24 -0
- package/dist/ghidra/GhidraSessionError.js +39 -0
- package/dist/ghidra/GhidraSessionValues.js +62 -0
- package/dist/ghidra/GhidraSocketConnection.js +46 -0
- package/dist/ghidra/protocol.js +69 -0
- package/dist/hopper/BridgeLauncher.js +19 -54
- package/dist/hopper/HopperAnalysisProfile.js +106 -0
- package/dist/hopper/HopperClient.js +154 -162
- package/dist/hopper/HopperProvider.js +99 -7
- package/dist/hopper/HopperSessionValues.js +27 -0
- package/dist/hopper/HopperSocketConnection.js +31 -0
- package/dist/main.js +14 -0
- package/dist/native/NativeMacOSProvider.js +3 -1
- package/dist/process/PendingOperations.js +59 -0
- package/dist/process/PrivateRuntimeRoot.js +33 -0
- package/dist/process/ProviderDeadline.js +95 -0
- package/dist/process/ProviderProcess.js +275 -0
- package/dist/replay/JavaScriptReplayWorker.js +286 -0
- package/dist/replay/LinuxJavaScriptReplayRunner.js +434 -0
- package/dist/replay/LinuxRuntimeClosure.js +46 -0
- package/dist/replay/LinuxSeccompPolicy.js +40 -0
- package/dist/replay/ReplayWorkerProtocol.js +55 -0
- package/dist/replay/SystemJavaScriptReplayHost.js +182 -0
- package/dist/server/createServer.js +53 -0
- package/dist/server/promptCompletion.js +9 -3
- package/dist/server/registerApplicationTools.js +115 -0
- package/dist/server/registerArtifactComparisonTool.js +16 -9
- package/dist/server/registerBrowserTools.js +33 -8
- package/dist/server/registerBundleComparisonTool.js +17 -20
- package/dist/server/registerElectronTools.js +45 -3
- package/dist/server/registerEnhancedTools.js +67 -19
- package/dist/server/registerEvidenceTools.js +5 -1
- package/dist/server/registerFunctionComparisonTool.js +14 -7
- package/dist/server/registerInvestigationTools.js +21 -17
- package/dist/server/registerManagedTools.js +6 -0
- package/dist/server/registerManagedWorkflowTools.js +277 -0
- package/dist/server/registerOfficialTools.js +11 -8
- package/dist/server/registerProcessComparisonTool.js +25 -47
- package/dist/server/registerSessionStatusTool.js +7 -7
- package/dist/server/registerSessionTools.js +57 -87
- package/dist/server/sessionEvidence.js +14 -19
- package/dist/server/toolInputValidation.js +77 -0
- package/dist/server/toolRegistrationOptions.js +79 -2
- package/dist/server/toolResult.js +25 -17
- package/package.json +17 -7
- package/scripts/rea.mjs +36 -2
- package/skills/rea-analysis/SKILL.md +59 -3
- /package/dist/{application → process}/ProcessOwnership.js +0 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compareManagedMembersInputSchema } from "../domain/managedMemberComparison.js";
|
|
3
|
+
import { managedNativeVerificationInputSchema } from "../domain/managedNativeVerification.js";
|
|
4
|
+
import { managedReconstructionImportInputSchema } from "../domain/managedReconstruction.js";
|
|
5
|
+
import { managedRuntimeCorrelationInputSchema } from "../domain/managedRuntimeCorrelation.js";
|
|
6
|
+
import { projectManagedApplicationGraphInputSchema } from "../domain/managedApplicationGraph.js";
|
|
7
|
+
import { managedWorkflowOutputSchemas } from "./toolOutputSchemas.js";
|
|
8
|
+
import { MANAGED_MEMBER_COMPARISON_EXAMPLE, MANAGED_NATIVE_VERIFICATION_EXAMPLE, MANAGED_APPLICATION_GRAPH_EXAMPLE, MANAGED_RECONSTRUCTION_IMPORT_EXAMPLE, MANAGED_RUNTIME_CORRELATION_EXAMPLE, } from "./managedWorkflowExamples.js";
|
|
9
|
+
import { toolContractMetadata } from "./toolEffects.js";
|
|
10
|
+
const evidenceIdSchema = z.string().regex(/^ev_[a-f0-9]{64}$/u);
|
|
11
|
+
const managedEvidenceIdSchema = evidenceIdSchema.describe("Session-owned inspect_managed_members Evidence ID");
|
|
12
|
+
const managedArtifactEvidenceIdSchema = evidenceIdSchema.describe("Session-owned inspect_managed_artifact Evidence ID");
|
|
13
|
+
const managedBoundaryEvidenceIdSchema = evidenceIdSchema.describe("Session-owned inspect_managed_native_boundaries Evidence ID");
|
|
14
|
+
const nativeObservationEvidenceIdSchema = evidenceIdSchema.describe("Session-owned inspect_macho or analyze_function Evidence ID");
|
|
15
|
+
/** MCP references for comparing two session-owned managed observations. */
|
|
16
|
+
export const compareManagedMembersReferenceInputSchema = z
|
|
17
|
+
.strictObject({
|
|
18
|
+
left_evidence_id: managedEvidenceIdSchema,
|
|
19
|
+
right_evidence_id: managedEvidenceIdSchema,
|
|
20
|
+
limits: compareManagedMembersInputSchema.shape.limits,
|
|
21
|
+
unknown_registry_approved: compareManagedMembersInputSchema.shape.unknown_registry_approved,
|
|
22
|
+
})
|
|
23
|
+
.superRefine((input, context) => {
|
|
24
|
+
if (input.left_evidence_id === input.right_evidence_id)
|
|
25
|
+
context.addIssue({
|
|
26
|
+
code: "custom",
|
|
27
|
+
path: ["right_evidence_id"],
|
|
28
|
+
message: "Managed member Evidence must be distinct",
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
/** MCP reference for planning from one session-owned managed observation. */
|
|
32
|
+
export const managedRuntimeCorrelationReferenceInputSchema = managedRuntimeCorrelationInputSchema
|
|
33
|
+
.omit({ static_members: true })
|
|
34
|
+
.extend({ static_members_evidence_id: managedEvidenceIdSchema });
|
|
35
|
+
/** MCP reference for importing reconstruction against session Evidence. */
|
|
36
|
+
export const managedReconstructionReferenceInputSchema = managedReconstructionImportInputSchema
|
|
37
|
+
.omit({ static_members: true })
|
|
38
|
+
.extend({ static_members_evidence_id: managedEvidenceIdSchema });
|
|
39
|
+
/** MCP references for managed/native verification from session Evidence. */
|
|
40
|
+
export const managedNativeVerificationReferenceInputSchema = z
|
|
41
|
+
.strictObject({
|
|
42
|
+
managed_boundaries_evidence_id: managedBoundaryEvidenceIdSchema,
|
|
43
|
+
native_observation_evidence_ids: z
|
|
44
|
+
.array(nativeObservationEvidenceIdSchema)
|
|
45
|
+
.min(1)
|
|
46
|
+
.max(50)
|
|
47
|
+
.describe("Unique session-owned native observation Evidence IDs"),
|
|
48
|
+
limits: managedNativeVerificationInputSchema.shape.limits,
|
|
49
|
+
unknown_registry_approved: managedNativeVerificationInputSchema.shape.unknown_registry_approved,
|
|
50
|
+
})
|
|
51
|
+
.superRefine((input, context) => {
|
|
52
|
+
const ids = new Set();
|
|
53
|
+
for (const [index, evidenceId,] of input.native_observation_evidence_ids.entries()) {
|
|
54
|
+
if (evidenceId === input.managed_boundaries_evidence_id)
|
|
55
|
+
context.addIssue({
|
|
56
|
+
code: "custom",
|
|
57
|
+
path: ["native_observation_evidence_ids", index],
|
|
58
|
+
message: "Native observation Evidence must be distinct from managed boundary Evidence",
|
|
59
|
+
});
|
|
60
|
+
if (ids.has(evidenceId))
|
|
61
|
+
context.addIssue({
|
|
62
|
+
code: "custom",
|
|
63
|
+
path: ["native_observation_evidence_ids", index],
|
|
64
|
+
message: "Native observation Evidence IDs must be unique",
|
|
65
|
+
});
|
|
66
|
+
ids.add(evidenceId);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
/** MCP references for projecting managed Evidence into an application graph. */
|
|
70
|
+
export const managedApplicationGraphReferenceInputSchema = z
|
|
71
|
+
.strictObject({
|
|
72
|
+
managed_artifact_evidence_id: managedArtifactEvidenceIdSchema.optional(),
|
|
73
|
+
managed_members_evidence_id: managedEvidenceIdSchema.optional(),
|
|
74
|
+
managed_native_boundaries_evidence_id: managedBoundaryEvidenceIdSchema.optional(),
|
|
75
|
+
limits: projectManagedApplicationGraphInputSchema.shape.limits,
|
|
76
|
+
})
|
|
77
|
+
.superRefine((input, context) => {
|
|
78
|
+
const ids = [
|
|
79
|
+
input.managed_artifact_evidence_id,
|
|
80
|
+
input.managed_members_evidence_id,
|
|
81
|
+
input.managed_native_boundaries_evidence_id,
|
|
82
|
+
].filter((id) => id !== undefined);
|
|
83
|
+
if (ids.length === 0)
|
|
84
|
+
context.addIssue({
|
|
85
|
+
code: "custom",
|
|
86
|
+
message: "At least one managed Evidence ID is required",
|
|
87
|
+
});
|
|
88
|
+
if (new Set(ids).size !== ids.length)
|
|
89
|
+
context.addIssue({
|
|
90
|
+
code: "custom",
|
|
91
|
+
message: "Managed application graph Evidence IDs must be unique",
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
const comparisonOutputSchema = managedWorkflowOutputSchemas.compare_managed_members;
|
|
95
|
+
if (comparisonOutputSchema === undefined)
|
|
96
|
+
throw new Error("Missing managed workflow output schema for compare_managed_members");
|
|
97
|
+
const runtimeOutputSchema = managedWorkflowOutputSchemas.plan_managed_runtime_correlation;
|
|
98
|
+
if (runtimeOutputSchema === undefined)
|
|
99
|
+
throw new Error("Missing managed workflow output schema for plan_managed_runtime_correlation");
|
|
100
|
+
const reconstructionOutputSchema = managedWorkflowOutputSchemas.import_managed_reconstruction;
|
|
101
|
+
if (reconstructionOutputSchema === undefined)
|
|
102
|
+
throw new Error("Missing managed workflow output schema for import_managed_reconstruction");
|
|
103
|
+
const nativeVerificationOutputSchema = managedWorkflowOutputSchemas.verify_managed_native_boundaries;
|
|
104
|
+
if (nativeVerificationOutputSchema === undefined)
|
|
105
|
+
throw new Error("Missing managed workflow output schema for verify_managed_native_boundaries");
|
|
106
|
+
const managedApplicationGraphOutputSchema = managedWorkflowOutputSchemas.project_managed_application_graph;
|
|
107
|
+
if (managedApplicationGraphOutputSchema === undefined)
|
|
108
|
+
throw new Error("Missing managed workflow output schema for project_managed_application_graph");
|
|
109
|
+
/** Provider-neutral managed-code workflow contracts. */
|
|
110
|
+
export const MANAGED_WORKFLOW_TOOL_CONTRACTS = [
|
|
111
|
+
{
|
|
112
|
+
name: "compare_managed_members",
|
|
113
|
+
...toolContractMetadata("compare_managed_members"),
|
|
114
|
+
description: "Compare two authenticated inspect_managed_members Evidence records using unique-only CIL/signature and structural method-shape tiers. Names are reported as observations but are not used as a matching basis; metadata tokens are remapped as build-local coordinates bound to each artifact SHA-256 and MVID.",
|
|
115
|
+
kind: "application",
|
|
116
|
+
inputSchema: compareManagedMembersReferenceInputSchema,
|
|
117
|
+
outputSchema: comparisonOutputSchema,
|
|
118
|
+
examples: [
|
|
119
|
+
{
|
|
120
|
+
title: "Compare two managed member observations",
|
|
121
|
+
input: {
|
|
122
|
+
left_evidence_id: MANAGED_MEMBER_COMPARISON_EXAMPLE.left.evidence_id,
|
|
123
|
+
right_evidence_id: MANAGED_MEMBER_COMPARISON_EXAMPLE.right.evidence_id,
|
|
124
|
+
limits: MANAGED_MEMBER_COMPARISON_EXAMPLE.limits,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "verify_managed_native_boundaries",
|
|
131
|
+
...toolContractMetadata("verify_managed_native_boundaries"),
|
|
132
|
+
description: "Verify managed P/Invoke/native-boundary declarations against authenticated native export or function Evidence without executing managed code or translating managed metadata tokens into native addresses. The workflow preserves declaration-only, verified, inferred, contradicted, and unresolved states.",
|
|
133
|
+
kind: "application",
|
|
134
|
+
inputSchema: managedNativeVerificationReferenceInputSchema,
|
|
135
|
+
outputSchema: nativeVerificationOutputSchema,
|
|
136
|
+
examples: [
|
|
137
|
+
{
|
|
138
|
+
title: "Verify a managed P/Invoke declaration against native Evidence",
|
|
139
|
+
input: {
|
|
140
|
+
managed_boundaries_evidence_id: MANAGED_NATIVE_VERIFICATION_EXAMPLE.managed_boundaries.evidence_id,
|
|
141
|
+
native_observation_evidence_ids: MANAGED_NATIVE_VERIFICATION_EXAMPLE.native_observations.map(({ evidence_id: evidenceId }) => evidenceId),
|
|
142
|
+
limits: MANAGED_NATIVE_VERIFICATION_EXAMPLE.limits,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "import_managed_reconstruction",
|
|
149
|
+
...toolContractMetadata("import_managed_reconstruction"),
|
|
150
|
+
description: "Import decompiler-produced managed reconstruction against authenticated inspect_managed_members Evidence. The workflow locks each method to artifact SHA-256, MVID, metadata token, signature hash, and normalized IL hash, records the decompiler identity and options, and marks C# or pseudocode as analyst inference rather than canonical byte observation.",
|
|
151
|
+
kind: "application",
|
|
152
|
+
inputSchema: managedReconstructionReferenceInputSchema,
|
|
153
|
+
outputSchema: reconstructionOutputSchema,
|
|
154
|
+
examples: [
|
|
155
|
+
{
|
|
156
|
+
title: "Import a decompiler reconstruction for one managed method",
|
|
157
|
+
input: {
|
|
158
|
+
static_members_evidence_id: MANAGED_RECONSTRUCTION_IMPORT_EXAMPLE.static_members.evidence_id,
|
|
159
|
+
decompiler: MANAGED_RECONSTRUCTION_IMPORT_EXAMPLE.decompiler,
|
|
160
|
+
methods: MANAGED_RECONSTRUCTION_IMPORT_EXAMPLE.methods,
|
|
161
|
+
notes: MANAGED_RECONSTRUCTION_IMPORT_EXAMPLE.notes,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: "plan_managed_runtime_correlation",
|
|
168
|
+
...toolContractMetadata("plan_managed_runtime_correlation"),
|
|
169
|
+
description: "Prepare a separately authorized managed runtime-correlation admission plan from authenticated inspect_managed_members Evidence. The operation is default-disabled, requires the managed_runtime permission ceiling and grant, locks the exact artifact SHA-256, MVID, method signature, and normalized IL shape, distinguishes attach/load/debugger/reflection/instrumentation effects, and records that no target code was executed.",
|
|
170
|
+
kind: "application",
|
|
171
|
+
inputSchema: managedRuntimeCorrelationReferenceInputSchema,
|
|
172
|
+
outputSchema: runtimeOutputSchema,
|
|
173
|
+
examples: [
|
|
174
|
+
{
|
|
175
|
+
title: "Plan an exact-build managed runtime correlation",
|
|
176
|
+
input: {
|
|
177
|
+
static_members_evidence_id: MANAGED_RUNTIME_CORRELATION_EXAMPLE.static_members.evidence_id,
|
|
178
|
+
method: MANAGED_RUNTIME_CORRELATION_EXAMPLE.method,
|
|
179
|
+
requested_effect: MANAGED_RUNTIME_CORRELATION_EXAMPLE.requested_effect,
|
|
180
|
+
host: MANAGED_RUNTIME_CORRELATION_EXAMPLE.host,
|
|
181
|
+
bounds: MANAGED_RUNTIME_CORRELATION_EXAMPLE.bounds,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "project_managed_application_graph",
|
|
188
|
+
...toolContractMetadata("project_managed_application_graph"),
|
|
189
|
+
description: "Project authenticated managed artifact, member, and native-boundary Evidence into the provider-neutral application graph without executing managed code, loading assemblies, or translating managed metadata tokens to native addresses. The graph preserves managed static observations as managed-specific nodes linked to source Evidence.",
|
|
190
|
+
kind: "application",
|
|
191
|
+
inputSchema: managedApplicationGraphReferenceInputSchema,
|
|
192
|
+
outputSchema: managedApplicationGraphOutputSchema,
|
|
193
|
+
examples: [
|
|
194
|
+
{
|
|
195
|
+
title: "Project static managed observations into an application graph",
|
|
196
|
+
input: {
|
|
197
|
+
managed_members_evidence_id: MANAGED_APPLICATION_GRAPH_EXAMPLE.managed_members.evidence_id,
|
|
198
|
+
limits: MANAGED_APPLICATION_GRAPH_EXAMPLE.limits,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { nativeOutputSchemas } from "./toolOutputSchemas.js";
|
|
3
3
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
4
|
+
import { toolContractMetadata } from "./toolEffects.js";
|
|
4
5
|
const examples = {
|
|
5
6
|
inspect_macho: {},
|
|
6
7
|
inspect_signature: {},
|
|
@@ -14,16 +15,11 @@ const native = (name, description, inputSchema) => {
|
|
|
14
15
|
throw new Error(`Missing native output schema for ${name}`);
|
|
15
16
|
return {
|
|
16
17
|
name,
|
|
18
|
+
...toolContractMetadata(name),
|
|
17
19
|
description,
|
|
18
20
|
kind: "native-provider",
|
|
19
21
|
inputSchema,
|
|
20
22
|
outputSchema,
|
|
21
|
-
annotations: {
|
|
22
|
-
readOnlyHint: true,
|
|
23
|
-
destructiveHint: false,
|
|
24
|
-
idempotentHint: true,
|
|
25
|
-
openWorldHint: false,
|
|
26
|
-
},
|
|
27
23
|
examples: [
|
|
28
24
|
{
|
|
29
25
|
title: `Example ${name.replaceAll("_", " ")} request`,
|
|
@@ -51,8 +51,12 @@ export const PROMPT_CONTRACTS = [
|
|
|
51
51
|
},
|
|
52
52
|
steps: [
|
|
53
53
|
{
|
|
54
|
-
tools: [
|
|
55
|
-
|
|
54
|
+
tools: [
|
|
55
|
+
"binary_session",
|
|
56
|
+
"open_binary",
|
|
57
|
+
"analyze_javascript_application",
|
|
58
|
+
],
|
|
59
|
+
instruction: "Inspect provider availability and effects first. For an approved JavaScript/Electron artifact, reconstruct its application graph without execution; otherwise open target_path only when no matching target is active.",
|
|
56
60
|
},
|
|
57
61
|
{
|
|
58
62
|
tools: ["list_documents", "set_current_document", "binary_overview"],
|
|
@@ -62,6 +66,10 @@ export const PROMPT_CONTRACTS = [
|
|
|
62
66
|
tools: ["search_strings", "search_procedures", "procedure_address"],
|
|
63
67
|
instruction: "Search in literal mode first, follow every continuation needed for the stated scope, and resolve selected procedures to canonical addresses.",
|
|
64
68
|
},
|
|
69
|
+
{
|
|
70
|
+
tools: ["trace_application_feature"],
|
|
71
|
+
instruction: "When authenticated application-graph Evidence exists, trace a typed literal route, API, channel, module, string, or native export through a bounded cross-layer subgraph before native localization.",
|
|
72
|
+
},
|
|
65
73
|
{
|
|
66
74
|
tools: [
|
|
67
75
|
"analyze_function",
|
|
@@ -95,6 +103,14 @@ export const PROMPT_CONTRACTS = [
|
|
|
95
103
|
tools: ["inventory_artifact"],
|
|
96
104
|
instruction: "Inventory each target independently before extraction. Follow nodes, occurrences, and edges to completion and retain every Evidence page for each manifest.",
|
|
97
105
|
},
|
|
106
|
+
{
|
|
107
|
+
tools: [
|
|
108
|
+
"analyze_javascript_application",
|
|
109
|
+
"reconcile_javascript_runtime",
|
|
110
|
+
"compare_application_versions",
|
|
111
|
+
],
|
|
112
|
+
instruction: "For JavaScript/Electron versions, reconstruct each approved artifact independently, optionally reconcile separately retained passive runtime Evidence, then compare authenticated graphs with unique-only identity tiers. Keep ambiguous and incomplete matches unknown.",
|
|
113
|
+
},
|
|
98
114
|
{
|
|
99
115
|
tools: ["export_evidence_bundle", "compare_artifacts"],
|
|
100
116
|
instruction: "Resolve any supplied manifest IDs to retained inventory Evidence, validate graph commitments, then compare the complete left and right Evidence page sets.",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Stable provider identifier accepted at CLI, MCP, and environment boundaries. */
|
|
3
|
+
export const analysisProviderIdSchema = z
|
|
4
|
+
.string()
|
|
5
|
+
.min(1)
|
|
6
|
+
.max(64)
|
|
7
|
+
.regex(/^[a-z][a-z0-9-]*$/u)
|
|
8
|
+
.refine((value) => value !== "auto", {
|
|
9
|
+
message: "auto is reserved for provider selection",
|
|
10
|
+
});
|
|
11
|
+
/** Explicit provider ID or the deterministic automatic-selection policy. */
|
|
12
|
+
export const analysisProviderSelectorSchema = z.union([
|
|
13
|
+
z.literal("auto"),
|
|
14
|
+
analysisProviderIdSchema,
|
|
15
|
+
]);
|
|
16
|
+
/** Stable reasons a deep provider cannot participate in target selection. */
|
|
17
|
+
export const PROVIDER_REJECTION_CODES = [
|
|
18
|
+
"not_configured",
|
|
19
|
+
"executable_missing",
|
|
20
|
+
"runtime_missing",
|
|
21
|
+
"unsupported_host",
|
|
22
|
+
"unsupported_version",
|
|
23
|
+
"target_kind_unsupported",
|
|
24
|
+
"target_format_unsupported",
|
|
25
|
+
"architecture_unsupported",
|
|
26
|
+
"open_options_invalid",
|
|
27
|
+
"version_unresolved",
|
|
28
|
+
];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { analysisProviderSelectorSchema } from "./providerSelection.js";
|
|
2
3
|
/** Input contract for opening a target with an optional staged snapshot. */
|
|
3
4
|
export const openBinaryInputSchema = z.object({
|
|
4
5
|
path: z.string().min(1),
|
|
6
|
+
provider_id: analysisProviderSelectorSchema.optional(),
|
|
5
7
|
snapshot_path: z.string().min(1).optional(),
|
|
6
8
|
});
|
|
7
9
|
/** Input contract for closing a target after an optional atomic snapshot. */
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EMPTY_PROCESS_CAPTURE_EXAMPLE } from "./processCaptureExample.js";
|
|
2
1
|
import { UNKNOWN_CONTRACT_EXAMPLES } from "./unknownContractExamples.js";
|
|
3
2
|
import { ARTIFACT_COMPARISON_EXAMPLE } from "./artifactComparisonExample.js";
|
|
4
3
|
import { FUNCTION_COMPARISON_EXAMPLE } from "./functionComparisonExample.js";
|
|
@@ -38,32 +37,18 @@ export const TOOL_EXAMPLE_OVERRIDES = {
|
|
|
38
37
|
},
|
|
39
38
|
compare_process_captures: {
|
|
40
39
|
left_evidence_id: `ev_${"0".repeat(64)}`,
|
|
41
|
-
left: EMPTY_PROCESS_CAPTURE_EXAMPLE,
|
|
42
40
|
right_evidence_id: `ev_${"1".repeat(64)}`,
|
|
43
|
-
right: EMPTY_PROCESS_CAPTURE_EXAMPLE,
|
|
44
41
|
},
|
|
45
|
-
compare_artifacts:
|
|
46
|
-
|
|
42
|
+
compare_artifacts: {
|
|
43
|
+
left_evidence_ids: [ARTIFACT_COMPARISON_EXAMPLE.left.evidence_id],
|
|
44
|
+
right_evidence_ids: [ARTIFACT_COMPARISON_EXAMPLE.right.evidence_id],
|
|
45
|
+
},
|
|
46
|
+
compare_functions: {
|
|
47
|
+
left_evidence_ids: [FUNCTION_COMPARISON_EXAMPLE.left.evidence_id],
|
|
48
|
+
right_evidence_ids: [FUNCTION_COMPARISON_EXAMPLE.right.evidence_id],
|
|
49
|
+
},
|
|
47
50
|
compare_bundles: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
artifacts: [],
|
|
51
|
-
providers: [],
|
|
52
|
-
environments: [],
|
|
53
|
-
scenarios: [],
|
|
54
|
-
captures: [],
|
|
55
|
-
unknowns: [],
|
|
56
|
-
records: [],
|
|
57
|
-
},
|
|
58
|
-
right: {
|
|
59
|
-
bundle_version: 2,
|
|
60
|
-
artifacts: [],
|
|
61
|
-
providers: [],
|
|
62
|
-
environments: [],
|
|
63
|
-
scenarios: [],
|
|
64
|
-
captures: [],
|
|
65
|
-
unknowns: [],
|
|
66
|
-
records: [],
|
|
67
|
-
},
|
|
51
|
+
left_bundle_path: "/approved/left-evidence.json",
|
|
52
|
+
right_bundle_path: "/approved/right-evidence.json",
|
|
68
53
|
},
|
|
69
54
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
3
|
-
import {
|
|
3
|
+
import { processScenarioSchema } from "../domain/processCapture.js";
|
|
4
4
|
import { recordUnknownInputSchema, updateUnknownInputSchema, } from "../domain/residualUnknown.js";
|
|
5
5
|
import { artifactComparisonInputSchema } from "../domain/artifactComparison.js";
|
|
6
6
|
import { functionComparisonInputSchema } from "../domain/functionComparison.js";
|
|
@@ -14,11 +14,17 @@ import { enhancedOutputSchemas, officialOutputSchemas, requireOutputSchema, sess
|
|
|
14
14
|
import { TOOL_EXAMPLE_OVERRIDES } from "./toolContractExamples.js";
|
|
15
15
|
import { NATIVE_TOOL_CONTRACTS } from "./nativeToolContracts.js";
|
|
16
16
|
import { ARTIFACT_TOOL_CONTRACTS } from "./artifactToolContracts.js";
|
|
17
|
+
import { MANAGED_TOOL_CONTRACTS } from "./managedToolContracts.js";
|
|
18
|
+
import { MANAGED_WORKFLOW_TOOL_CONTRACTS } from "./managedWorkflowToolContracts.js";
|
|
17
19
|
import { BROWSER_TOOL_CONTRACTS } from "./browserToolContracts.js";
|
|
18
20
|
import { ELECTRON_TOOL_CONTRACTS } from "./electronToolContracts.js";
|
|
21
|
+
import { APPLICATION_TOOL_CONTRACTS } from "./applicationToolContracts.js";
|
|
19
22
|
import { closeBinaryInputSchema, openBinaryInputSchema, } from "./sessionLifecycleInputs.js";
|
|
23
|
+
import { toolContractMetadata } from "./toolEffects.js";
|
|
20
24
|
const document = z.string().optional().describe("The document name");
|
|
21
|
-
const address = z
|
|
25
|
+
const address = z
|
|
26
|
+
.string()
|
|
27
|
+
.describe("A provider-normalized address; default memory uses 0x-prefixed hexadecimal");
|
|
22
28
|
const optionalAddress = address.optional();
|
|
23
29
|
const procedure = z.string().describe("The procedure name or address");
|
|
24
30
|
const searchPattern = z
|
|
@@ -52,23 +58,6 @@ const examplesFor = (name, inputSchema) => {
|
|
|
52
58
|
},
|
|
53
59
|
];
|
|
54
60
|
};
|
|
55
|
-
const annotations = (name, kind) => ({
|
|
56
|
-
readOnlyHint: (kind === "enhanced" && name !== "trace_feature") ||
|
|
57
|
-
name === "binary_session" ||
|
|
58
|
-
name === "list_unknowns" ||
|
|
59
|
-
name === "verify_unknown_resolution",
|
|
60
|
-
destructiveHint: name === "export_evidence_bundle" ||
|
|
61
|
-
name === "close_binary" ||
|
|
62
|
-
name === "unset_bookmark" ||
|
|
63
|
-
name === "set_address_name" ||
|
|
64
|
-
name === "set_addresses_names" ||
|
|
65
|
-
name === "set_comment" ||
|
|
66
|
-
name === "set_inline_comment",
|
|
67
|
-
idempotentHint: name !== "close_binary" &&
|
|
68
|
-
name !== "record_unknown" &&
|
|
69
|
-
name !== "update_unknown",
|
|
70
|
-
openWorldHint: name === "capture_process_scenario",
|
|
71
|
-
});
|
|
72
61
|
const official = (name, description, inputSchema) => {
|
|
73
62
|
const trackedInputSchema = inputSchema.extend({
|
|
74
63
|
unknown_registry_approved: z
|
|
@@ -78,35 +67,35 @@ const official = (name, description, inputSchema) => {
|
|
|
78
67
|
});
|
|
79
68
|
return {
|
|
80
69
|
name,
|
|
70
|
+
...toolContractMetadata(name),
|
|
81
71
|
description,
|
|
82
72
|
kind: "official-proxy",
|
|
83
73
|
inputSchema: trackedInputSchema,
|
|
84
74
|
outputSchema: requireOutputSchema(officialOutputSchemas, name),
|
|
85
|
-
annotations: annotations(name, "official-proxy"),
|
|
86
75
|
examples: examplesFor(name, trackedInputSchema),
|
|
87
76
|
};
|
|
88
77
|
};
|
|
89
78
|
const enhanced = (name, description, inputSchema) => ({
|
|
90
79
|
name,
|
|
80
|
+
...toolContractMetadata(name),
|
|
91
81
|
description,
|
|
92
82
|
kind: "enhanced",
|
|
93
83
|
inputSchema,
|
|
94
84
|
outputSchema: requireOutputSchema(enhancedOutputSchemas, name),
|
|
95
|
-
annotations: annotations(name, "enhanced"),
|
|
96
85
|
examples: examplesFor(name, inputSchema),
|
|
97
86
|
});
|
|
98
87
|
const session = (name, description, inputSchema) => ({
|
|
99
88
|
name,
|
|
89
|
+
...toolContractMetadata(name),
|
|
100
90
|
description,
|
|
101
91
|
kind: "session",
|
|
102
92
|
inputSchema,
|
|
103
93
|
outputSchema: requireOutputSchema(sessionOutputSchemas, name),
|
|
104
|
-
annotations: annotations(name, "session"),
|
|
105
94
|
examples: examplesFor(name, inputSchema),
|
|
106
95
|
});
|
|
107
96
|
/** Bridge operations exposed without additional application composition. */
|
|
108
97
|
export const OFFICIAL_TOOL_CONTRACTS = [
|
|
109
|
-
official("address_name", "Resolve the analyzed name at a code or data address
|
|
98
|
+
official("address_name", "Resolve the primary analyzed name at a code or data address. Headless providers require an explicit address; GUI providers may default to their current cursor. Null means the provider has no primary name at that address.", z.object({ document, address: optionalAddress })),
|
|
110
99
|
official("comment", "Read the regular analysis comment at an address, defaulting to the current cursor. This is read-only and returns null when no comment exists; use set_comment to persist a finding.", z.object({ document, address: optionalAddress })),
|
|
111
100
|
official("current_address", "Return Hopper's current cursor address for the selected document. Use only for interactive navigation state; prefer explicit addresses in reproducible investigations.", z.object({ document })),
|
|
112
101
|
official("current_procedure", "Return the analyzed procedure containing Hopper's current cursor. Use procedure_info or analyze_function next; this depends on GUI cursor state and is not an exhaustive lookup.", z.object({ document })),
|
|
@@ -114,19 +103,19 @@ export const OFFICIAL_TOOL_CONTRACTS = [
|
|
|
114
103
|
official("goto_address", "Move Hopper's GUI cursor to a hexadecimal address and return the resolved address. This changes navigation state but not analysis data; use explicit-address tools for headless workflows.", z.object({ address, document })),
|
|
115
104
|
official("inline_comment", "Read the inline instruction comment at an address, defaulting to the current cursor. Returns null when absent; use set_inline_comment to write one.", z.object({ document, address: optionalAddress })),
|
|
116
105
|
official("list_bookmarks", "List every bookmark in the selected Hopper document as address and name pairs. Use bookmarks as analyst-authored navigation aids; this does not discover code references.", z.object({ document })),
|
|
117
|
-
official("list_documents", "List
|
|
118
|
-
official("list_names", "Page through analyzed
|
|
119
|
-
official("list_procedures", "Page through analyzed procedures as address/value pairs.
|
|
120
|
-
official("list_segments", "List
|
|
121
|
-
official("list_strings", "Page through
|
|
106
|
+
official("list_documents", "List provider program or document identities. Hopper may expose several documents; a Ghidra headless session contains exactly its one imported Program.", z.object({})),
|
|
107
|
+
official("list_names", "Page through analyzed memory and external symbols as address/value pairs. Provider metadata distinguishes Ghidra primary, dynamic, external, type, and source facts when available; follow next_offset before claiming exhaustive coverage.", z.object({ document, address: optionalAddress, ...pagination })),
|
|
108
|
+
official("list_procedures", "Page through analyzed procedures as address/value pairs after provider analysis. Ghidra metadata distinguishes thunks and external functions; follow next_offset for exhaustive coverage and use returned addresses in later function operations.", z.object({ document, ...pagination })),
|
|
109
|
+
official("list_segments", "List segments or memory blocks using exclusive end addresses. Ghidra reports block permissions, address space, image base, initialization, and overlay facts; Hopper marks unavailable permissions explicitly.", z.object({ document })),
|
|
110
|
+
official("list_strings", "Page through provider-defined strings, or filter to one address, as address/value pairs. Ghidra reports charset, missing-terminator status, byte length, and explicit value truncation; follow next_offset for exhaustive results.", z.object({ document, address: optionalAddress, ...pagination })),
|
|
122
111
|
official("next_address", "Return the next analyzed object address after an explicit address or current cursor. This is a navigation primitive, not instruction-flow or CFG analysis.", z.object({ document, address: optionalAddress })),
|
|
123
112
|
official("prev_address", "Return the previous analyzed instruction start before an explicit address or current cursor. This is a navigation primitive and may fail at document boundaries.", z.object({ document, address: optionalAddress })),
|
|
124
|
-
official("procedure_address", "Resolve
|
|
113
|
+
official("procedure_address", "Resolve an unambiguous procedure symbol name or provider-normalized address to its canonical entry address. External address spaces remain explicit; use the result before xrefs, assembly, or decompilation.", z.object({ procedure, document })),
|
|
125
114
|
official("procedure_assembly", "Return assembly for one analyzed procedure identified by symbol or hexadecimal address. Use when pseudocode loses calling-convention or instruction-level detail; output is currently returned as one unpaginated string.", z.object({ procedure, document })),
|
|
126
|
-
official("procedure_callees", "Return
|
|
127
|
-
official("procedure_callers", "Return
|
|
115
|
+
official("procedure_callees", "Return the provider's resolved direct callees for one procedure identified by symbol or address. Unresolved indirect calls may be absent; use analyze_function and typed references to preserve available edge uncertainty.", z.object({ procedure, document })),
|
|
116
|
+
official("procedure_callers", "Return the provider's resolved direct callers for one procedure identified by symbol or address. Results reflect completed static analysis and may omit unresolved indirect references.", z.object({ procedure, document })),
|
|
128
117
|
official("procedure_info", "Return bounded metadata for one procedure identified by symbol or address: entrypoint, signature, locals, size, and block count. Follow with decompilation or assembly for behavior.", z.object({ procedure, document })),
|
|
129
|
-
official("procedure_references", "Return a bounded set of raw incoming or outgoing reference edges for one procedure. Endpoint procedures are resolved only
|
|
118
|
+
official("procedure_references", "Return a bounded set of raw incoming or outgoing reference edges for one procedure. Endpoint procedures are resolved only from provider containment; Ghidra preserves observed reference kinds while providers without kind authority mark them unavailable.", z.object({
|
|
130
119
|
procedure,
|
|
131
120
|
direction: z.enum(["incoming", "outgoing"]).default("outgoing"),
|
|
132
121
|
offset: z.number().int().min(0).default(0),
|
|
@@ -134,10 +123,10 @@ export const OFFICIAL_TOOL_CONTRACTS = [
|
|
|
134
123
|
max_instructions: z.number().int().min(1).max(5000).default(500),
|
|
135
124
|
document,
|
|
136
125
|
})),
|
|
137
|
-
official("procedure_pseudo_code", "Decompile one analyzed procedure by symbol name or
|
|
138
|
-
official("resolve_containing_procedure", "Resolve an arbitrary address, including an
|
|
139
|
-
official("search_procedures", "Search analyzed procedure names using literal matching by default or regex opt-in.
|
|
140
|
-
official("search_strings", "Search analyzed strings using literal matching by default or regex opt-in.
|
|
126
|
+
official("procedure_pseudo_code", "Decompile one analyzed procedure by symbol name or provider-normalized address. Returns provider-specific pseudocode, never original source or cross-provider text equivalence, and may return null; request procedure_assembly when instruction precision matters.", z.object({ procedure, document })),
|
|
127
|
+
official("resolve_containing_procedure", "Resolve an arbitrary address, including an interior instruction or exact external entry, to its provider-analyzed containing procedure. A negative result distinguishes outside segments from not in a procedure and is never guessed from nearby symbols.", z.object({ address, document })),
|
|
128
|
+
official("search_procedures", "Search analyzed procedure names using literal matching by default or regex opt-in. Ghidra bounds literal work and rejects regex constructs, paths, candidates, or cumulative work outside its finite budgets. Results are deterministic and offset-paginated.", z.object(searchInput)),
|
|
129
|
+
official("search_strings", "Search analyzed strings using literal matching by default or regex opt-in. Ghidra bounds literal work and rejects regex constructs, paths, candidates, or cumulative work outside its finite budgets. Results are deterministic, offset-paginated, and explicitly truncated.", z.object(searchInput)),
|
|
141
130
|
official("set_address_name", "Assign an analyst name to one hexadecimal address and report Hopper's boolean result. This mutates analysis metadata; read it back with address_name before relying on it.", z.object({ address, name: z.string(), document })),
|
|
142
131
|
official("set_addresses_names", "Assign analyst names to an address/name map and return per-address success booleans. This mutates analysis metadata; use for bounded batches and verify failures individually.", z.object({ names: z.record(z.string(), z.string()), document })),
|
|
143
132
|
official("set_bookmark", "Create or replace a bookmark at a hexadecimal address. This mutates navigation metadata; verify with list_bookmarks and do not treat bookmarks as binary evidence.", z.object({ address, name: z.string().optional(), document })),
|
|
@@ -153,11 +142,11 @@ export const ENHANCED_TOOL_CONTRACTS = [
|
|
|
153
142
|
enhanced("get_objc_classes", "Discover and deduplicate Objective-C class labels after exhaustively paging names, optionally filtering by literal substring. Returns at most 100 classes; inspect matching metadata and references next.", enhancedInputSchemas.get_objc_classes),
|
|
154
143
|
enhanced("get_objc_protocols", "Discover and deduplicate Objective-C and Swift protocol labels after exhaustively paging names. Returns at most 100 entries; use xrefs or analyze_function to connect a protocol to implementations.", enhancedInputSchemas.get_objc_protocols),
|
|
155
144
|
enhanced("batch_decompile", "Decompile up to 20 explicit procedure symbols or addresses concurrently. Returns ordered per-item ok/error variants and aggregate counts; use analyze_function for a richer single-function dossier.", enhancedInputSchemas.batch_decompile),
|
|
156
|
-
enhanced("get_call_graph", "Traverse
|
|
145
|
+
enhanced("get_call_graph", "Traverse the bound provider's caller or callee relationships from one symbol or address for at most five levels. Every node has an ok/error status and failures use safe typed projections; unresolved indirect calls may be missing and results are not a whole-program CFG.", enhancedInputSchemas.get_call_graph),
|
|
157
146
|
enhanced("analyze_swift_types", "Categorize exhaustively paged procedure names into Swift classes, structs, enums, protocols, extensions, and other symbols. Scans at most 5,000 names and returns at most 50 entries per category.", enhancedInputSchemas.analyze_swift_types),
|
|
158
|
-
enhanced("find_xrefs_to_name", "Resolve an exact name through
|
|
147
|
+
enhanced("find_xrefs_to_name", "Resolve an exact name through the bound provider's exhaustively paged name inventory and return a resolved or unresolved result. Unresolved names use the stable name_not_found reason; this compact xref workflow returns address-only projections.", enhancedInputSchemas.find_xrefs_to_name),
|
|
159
148
|
enhanced("binary_overview", "Use immediately after opening a target to summarize document, exhaustive procedure/string counts, and a bounded segment sample. detail controls segment fields and limit controls only the returned segment sample.", enhancedInputSchemas.binary_overview),
|
|
160
|
-
enhanced("analyze_function", "Preferred bounded analysis for one procedure symbol or address. Returns identity, pseudocode, optional assembly, comments, calls,
|
|
149
|
+
enhanced("analyze_function", "Preferred bounded analysis for one procedure symbol or address. Returns identity, provider-specific pseudocode, optional assembly, comments, calls, typed-or-explicitly-unavailable references, referenced strings/names, and local CFG blocks with exact truncation metadata.", enhancedInputSchemas.analyze_function),
|
|
161
150
|
enhanced("trace_feature", "Trace a bounded literal feature query through matching strings and procedures, xrefs, and truthful containing-procedure resolution. Returns the operation budget, truncation, and residual unknowns; unknown_registry_approved: true records them durably without inferring reference kinds.", enhancedInputSchemas.trace_feature),
|
|
162
151
|
];
|
|
163
152
|
/** Caller observations used to compare a live server with expected identity. */
|
|
@@ -169,28 +158,46 @@ export const binarySessionInputSchema = z.object({
|
|
|
169
158
|
.optional(),
|
|
170
159
|
expected_server_path: z.string().min(1).optional(),
|
|
171
160
|
});
|
|
161
|
+
/** Session-owned Evidence bundle export options. */
|
|
162
|
+
export const exportEvidenceBundleInputSchema = z.strictObject({
|
|
163
|
+
path: z.string().min(1).optional(),
|
|
164
|
+
overwrite: z.boolean().default(false),
|
|
165
|
+
});
|
|
166
|
+
/** Session-owned Evidence bundle import options. */
|
|
167
|
+
export const importEvidenceBundleInputSchema = z.strictObject({
|
|
168
|
+
path: z.string().min(1),
|
|
169
|
+
});
|
|
170
|
+
/** Evidence references for deterministic process comparison. */
|
|
171
|
+
export const processComparisonInputSchema = z.strictObject({
|
|
172
|
+
left_evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
|
|
173
|
+
right_evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
|
|
174
|
+
max_capture_age_ms: z.number().int().nonnegative().optional(),
|
|
175
|
+
unknown_registry_approved: z
|
|
176
|
+
.literal(true)
|
|
177
|
+
.optional()
|
|
178
|
+
.describe("Explicit approval to record capture disagreement durably"),
|
|
179
|
+
});
|
|
180
|
+
/** Residual-unknown list filters. */
|
|
181
|
+
export const listUnknownsInputSchema = z.strictObject({
|
|
182
|
+
status: z
|
|
183
|
+
.enum(["open", "investigating", "blocked", "contradicted", "resolved"])
|
|
184
|
+
.optional(),
|
|
185
|
+
severity: z.enum(["low", "medium", "high", "critical"]).optional(),
|
|
186
|
+
domain: z.string().trim().min(1).max(100).optional(),
|
|
187
|
+
});
|
|
188
|
+
/** Exact residual-unknown identity to revalidate. */
|
|
189
|
+
export const verifyUnknownResolutionInputSchema = z.strictObject({
|
|
190
|
+
unknown_id: z.string().regex(/^unk_[a-f0-9]{64}$/u),
|
|
191
|
+
});
|
|
172
192
|
/** Target lifecycle tools available only on the long-lived MCP adapter. */
|
|
173
193
|
export const SESSION_TOOL_CONTRACTS = [
|
|
174
|
-
session("open_binary", "Open a local executable, application bundle, archive, JavaScript, source map, plist, or
|
|
194
|
+
session("open_binary", "Open a local executable, application bundle, archive, JavaScript, source map, plist, or analysis database after validation. provider_id selects one deep provider or deterministic auto selection; the binding remains stable until close or an explicit switch, with no failure fallback. An optional snapshot v2 is imported atomically and must match the binary identity, concrete provider, and canonical analysis profile exactly.", openBinaryInputSchema),
|
|
175
195
|
session("close_binary", "Optionally write a provider-neutral analysis snapshot atomically, then close the active target and every provider resource started for it. Snapshot files require an operator-approved root and explicit overwrite; a failed save leaves the session open so cached analysis is not lost.", closeBinaryInputSchema),
|
|
176
|
-
session("binary_session", "Report provider
|
|
177
|
-
session("export_evidence_bundle", "Return the session's deterministic Evidence v2 bundle, or atomically write it beneath an operator-approved root. Existing files require overwrite: true; records and manifests use canonical byte-stable ordering.",
|
|
178
|
-
|
|
179
|
-
overwrite: z.boolean().default(false),
|
|
180
|
-
})),
|
|
181
|
-
session("import_evidence_bundle", "Read a bounded local JSON bundle beneath an operator-approved root, validate every Evidence v2 ID and canonical manifest, then atomically merge it. Imported content is data only and is never executed.", z.object({ path: z.string().min(1) })),
|
|
196
|
+
session("binary_session", "Report deterministic deep-provider candidates, host availability, target support, the immutable active binding/profile, capability descriptors, and whether a target is open. Candidate discovery never starts an analysis process; use rejection codes and local diagnostics before choosing provider_id.", binarySessionInputSchema),
|
|
197
|
+
session("export_evidence_bundle", "Return the session's deterministic Evidence v2 bundle, or atomically write it beneath an operator-approved root. Existing files require overwrite: true; records and manifests use canonical byte-stable ordering.", exportEvidenceBundleInputSchema),
|
|
198
|
+
session("import_evidence_bundle", "Read a bounded local JSON bundle beneath an operator-approved root, validate every Evidence v2 ID and canonical manifest, then atomically merge it. Imported content is data only and is never executed.", importEvidenceBundleInputSchema),
|
|
182
199
|
session("capture_process_scenario", "Run one bounded process under a PTY using operator-approved executable and working roots. Produces Process Capture v4; legacy v3 captures cannot be upgraded and must be recaptured with this tool. Requires approved: true; unknown_registry_approved: true separately records capture residuals. Captures raw and xterm-rendered terminal frames, scripted interactions, lifecycle filesystem checkpoints, process ownership, declarative command shims, and loopback replay. Disabled unless operator policy enables it; not a security sandbox.", processScenarioSchema),
|
|
183
|
-
session("compare_process_captures", "Compare two compatible Process Capture v4 observations across terminal, interaction, exit, settlement, process, filesystem, command-shim, HTTP, and WebSocket evidence, returning the first bounded divergence. Process Capture v3 is unsupported and must be recaptured with capture_process_scenario. Missing or truncated observations are never treated as equivalent.",
|
|
184
|
-
left_evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
|
|
185
|
-
left: processCaptureSchema,
|
|
186
|
-
right_evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
|
|
187
|
-
right: processCaptureSchema,
|
|
188
|
-
max_capture_age_ms: z.number().int().nonnegative().optional(),
|
|
189
|
-
unknown_registry_approved: z
|
|
190
|
-
.literal(true)
|
|
191
|
-
.optional()
|
|
192
|
-
.describe("Explicit approval to record capture disagreement durably"),
|
|
193
|
-
})),
|
|
200
|
+
session("compare_process_captures", "Compare two compatible Process Capture v4 observations across terminal, interaction, exit, settlement, process, filesystem, command-shim, HTTP, and WebSocket evidence, returning the first bounded divergence. Process Capture v3 is unsupported and must be recaptured with capture_process_scenario. Missing or truncated observations are never treated as equivalent.", processComparisonInputSchema),
|
|
194
201
|
session("compare_artifacts", "Compare two bounded sets of inventory_artifact Evidence pages by logical occurrence path, content identity, metadata, and graph relations. Pages must share and satisfy their graph commitment; every delta cites both sets, and gaps yield truncated or unknown, never equivalence.", artifactComparisonInputSchema),
|
|
195
202
|
session("compare_functions", "Compare two explicit bounded sets of analyze_function Evidence pages across identity, exact provider text, calls, references, strings, and address-normalized CFG topology. Missing or provider-incompatible facets remain truncated or unknown; every conclusion cites both Evidence sets.", functionComparisonInputSchema),
|
|
196
203
|
session("compare_bundles", "Compare two canonical Evidence v2 bundles by exact record membership, explicit one-to-one observation pairs, and complete residual-unknown revision histories. Missing bundle members describe omission only, never behavioral equivalence; output is digest-anchored and deterministically paginated.", bundleComparisonInputSchema),
|
|
@@ -198,16 +205,10 @@ export const SESSION_TOOL_CONTRACTS = [
|
|
|
198
205
|
session("build_call_path", "Build bounded shortest-first direct-callee paths from explicit analyze_function Evidence groups using exact canonical addresses. Missing dossiers, incomplete callee pages, provider mixing, and depth frontiers remain unknown; every node and edge cites source Evidence.", callPathInputSchema),
|
|
199
206
|
session("correlate_static_and_runtime", "Evaluate explicit caller-declared hypotheses between exact static comparison findings and runtime comparison dimensions. Similar names or paths are never auto-matched, consistent cochange never proves causality, and unknown or truncated inputs remain unresolved.", staticRuntimeCorrelationInputSchema),
|
|
200
207
|
session("verify_reconstruction", "Verify a finite typed behavioral and structural specification against a canonical Evidence bundle. Pass means every declared claim has complete comparable authority—not global source equivalence; changed claims fail and missing, limited, or unresolved evidence stays unknown.", reconstructionVerificationInputSchema),
|
|
201
|
-
session("list_unknowns", "List current residual-unknown heads in deterministic ID order, with optional exact status, severity, and domain filters. This is read-only; unresolved, contradicted, and non-truth dispositions remain distinct.",
|
|
202
|
-
status: z
|
|
203
|
-
.enum(["open", "investigating", "blocked", "contradicted", "resolved"])
|
|
204
|
-
.optional(),
|
|
205
|
-
severity: z.enum(["low", "medium", "high", "critical"]).optional(),
|
|
206
|
-
domain: z.string().trim().min(1).max(100).optional(),
|
|
207
|
-
})),
|
|
208
|
+
session("list_unknowns", "List current residual-unknown heads in deterministic ID order, with optional exact status, severity, and domain filters. This is read-only; unresolved, contradicted, and non-truth dispositions remain distinct.", listUnknownsInputSchema),
|
|
208
209
|
session("record_unknown", "Create one deterministic residual unknown and immutable mutation evidence. Requires approved: true, validates all evidence and relationship references, and rejects duplicate stable identity.", recordUnknownInputSchema),
|
|
209
210
|
session("update_unknown", "Append one immutable full-state revision and mutation evidence. Requires approved: true and exact expected_revision; stale concurrent writers fail instead of overwriting newer analysis.", updateUnknownInputSchema),
|
|
210
|
-
session("verify_unknown_resolution", "Revalidate the current residual-unknown head against live bundled evidence, exact authority/confidence/environment requirements, and revision integrity. Withdrawn and out-of-scope dispositions are not truth claims.",
|
|
211
|
+
session("verify_unknown_resolution", "Revalidate the current residual-unknown head against live bundled evidence, exact authority/confidence/environment requirements, and revision integrity. Withdrawn and out-of-scope dispositions are not truth claims.", verifyUnknownResolutionInputSchema),
|
|
211
212
|
];
|
|
212
213
|
/** Complete ordered public inventory used by registration and verification. */
|
|
213
214
|
export const TOOL_CONTRACTS = [
|
|
@@ -215,7 +216,10 @@ export const TOOL_CONTRACTS = [
|
|
|
215
216
|
...ENHANCED_TOOL_CONTRACTS,
|
|
216
217
|
...NATIVE_TOOL_CONTRACTS,
|
|
217
218
|
...ARTIFACT_TOOL_CONTRACTS,
|
|
219
|
+
...MANAGED_TOOL_CONTRACTS,
|
|
220
|
+
...MANAGED_WORKFLOW_TOOL_CONTRACTS,
|
|
218
221
|
...BROWSER_TOOL_CONTRACTS,
|
|
219
222
|
...ELECTRON_TOOL_CONTRACTS,
|
|
223
|
+
...APPLICATION_TOOL_CONTRACTS,
|
|
220
224
|
...SESSION_TOOL_CONTRACTS,
|
|
221
225
|
];
|