rea-agents 1.7.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 +38 -31
- package/dist/application/CapabilityInventory.js +18 -0
- package/dist/application/CrossVersionInvestigation.js +10 -6
- package/dist/application/Doctor.js +56 -6
- 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 +38 -13
- package/dist/application/InvestigationProviders.js +30 -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 +7 -1
- package/dist/application/JavaScriptArtifactGraphBuilder.js +59 -16
- package/dist/application/JavaScriptArtifactGraphEvidence.js +24 -14
- package/dist/application/JavaScriptArtifactReconstruction.js +3 -0
- package/dist/application/JavaScriptArtifactReconstructionInput.js +2 -83
- 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/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/ProcessSampling.js +15 -11
- package/dist/application/ProjectPermissionStore.js +1 -0
- package/dist/application/runtime.js +2 -0
- package/dist/browser/CdpCaptureEvents.js +49 -0
- package/dist/browser/CdpElectronInspection.js +106 -162
- package/dist/browser/CdpElectronProvider.js +5 -1
- package/dist/browser/CdpElectronScriptEvents.js +69 -0
- package/dist/browser/CdpElectronScripts.js +94 -0
- package/dist/browser/CdpElectronWorkers.js +56 -0
- package/dist/browser/CdpPageCapture.js +8 -4
- package/dist/catalogIdentity.js +4 -1
- package/dist/cli.js +388 -0
- package/dist/cliApplicationCommands.js +62 -0
- package/dist/cliCommandNames.js +13 -0
- package/dist/cliElectronCommands.js +103 -1
- package/dist/cliJsonInput.js +54 -0
- package/dist/config.js +83 -0
- 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/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/toolContractExamples.js +10 -25
- package/dist/contracts/toolContracts.js +47 -45
- package/dist/contracts/toolEffects.js +160 -0
- package/dist/contracts/toolOutputSchemas.js +46 -31
- package/dist/doctorRuntime.js +42 -1
- package/dist/domain/artifactComparison.js +3 -4
- 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 +67 -1
- package/dist/domain/functionComparisonSchemas.js +3 -8
- package/dist/domain/inputIssueProjection.js +52 -0
- package/dist/domain/javascriptApplicationAnalysis.js +155 -0
- package/dist/domain/javascriptApplicationChangeGraph.js +231 -0
- package/dist/domain/javascriptApplicationEvidenceSchemas.js +18 -0
- package/dist/domain/javascriptApplicationGraph.js +2 -1
- package/dist/domain/javascriptApplicationGraphSchemas.js +7 -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/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 +31 -43
- package/dist/domain/javascriptStaticAnalysisFindings.js +39 -0
- package/dist/domain/javascriptStaticAnalysisHelpers.js +10 -0
- package/dist/domain/javascriptStaticAnalysisState.js +6 -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/GhidraProvider.js +6 -0
- package/dist/main.js +14 -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 +52 -0
- 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 +58 -13
- 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 +8 -8
- package/dist/server/registerProcessComparisonTool.js +25 -47
- package/dist/server/registerSessionStatusTool.js +7 -7
- package/dist/server/registerSessionTools.js +51 -86
- 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 +12 -4
- package/scripts/rea.mjs +1 -1
- package/skills/rea-analysis/SKILL.md +59 -3
|
@@ -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.",
|
|
@@ -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,9 +14,13 @@ 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
25
|
const address = z
|
|
22
26
|
.string()
|
|
@@ -54,23 +58,6 @@ const examplesFor = (name, inputSchema) => {
|
|
|
54
58
|
},
|
|
55
59
|
];
|
|
56
60
|
};
|
|
57
|
-
const annotations = (name, kind) => ({
|
|
58
|
-
readOnlyHint: (kind === "enhanced" && name !== "trace_feature") ||
|
|
59
|
-
name === "binary_session" ||
|
|
60
|
-
name === "list_unknowns" ||
|
|
61
|
-
name === "verify_unknown_resolution",
|
|
62
|
-
destructiveHint: name === "export_evidence_bundle" ||
|
|
63
|
-
name === "close_binary" ||
|
|
64
|
-
name === "unset_bookmark" ||
|
|
65
|
-
name === "set_address_name" ||
|
|
66
|
-
name === "set_addresses_names" ||
|
|
67
|
-
name === "set_comment" ||
|
|
68
|
-
name === "set_inline_comment",
|
|
69
|
-
idempotentHint: name !== "close_binary" &&
|
|
70
|
-
name !== "record_unknown" &&
|
|
71
|
-
name !== "update_unknown",
|
|
72
|
-
openWorldHint: name === "capture_process_scenario",
|
|
73
|
-
});
|
|
74
61
|
const official = (name, description, inputSchema) => {
|
|
75
62
|
const trackedInputSchema = inputSchema.extend({
|
|
76
63
|
unknown_registry_approved: z
|
|
@@ -80,30 +67,30 @@ const official = (name, description, inputSchema) => {
|
|
|
80
67
|
});
|
|
81
68
|
return {
|
|
82
69
|
name,
|
|
70
|
+
...toolContractMetadata(name),
|
|
83
71
|
description,
|
|
84
72
|
kind: "official-proxy",
|
|
85
73
|
inputSchema: trackedInputSchema,
|
|
86
74
|
outputSchema: requireOutputSchema(officialOutputSchemas, name),
|
|
87
|
-
annotations: annotations(name, "official-proxy"),
|
|
88
75
|
examples: examplesFor(name, trackedInputSchema),
|
|
89
76
|
};
|
|
90
77
|
};
|
|
91
78
|
const enhanced = (name, description, inputSchema) => ({
|
|
92
79
|
name,
|
|
80
|
+
...toolContractMetadata(name),
|
|
93
81
|
description,
|
|
94
82
|
kind: "enhanced",
|
|
95
83
|
inputSchema,
|
|
96
84
|
outputSchema: requireOutputSchema(enhancedOutputSchemas, name),
|
|
97
|
-
annotations: annotations(name, "enhanced"),
|
|
98
85
|
examples: examplesFor(name, inputSchema),
|
|
99
86
|
});
|
|
100
87
|
const session = (name, description, inputSchema) => ({
|
|
101
88
|
name,
|
|
89
|
+
...toolContractMetadata(name),
|
|
102
90
|
description,
|
|
103
91
|
kind: "session",
|
|
104
92
|
inputSchema,
|
|
105
93
|
outputSchema: requireOutputSchema(sessionOutputSchemas, name),
|
|
106
|
-
annotations: annotations(name, "session"),
|
|
107
94
|
examples: examplesFor(name, inputSchema),
|
|
108
95
|
});
|
|
109
96
|
/** Bridge operations exposed without additional application composition. */
|
|
@@ -171,28 +158,46 @@ export const binarySessionInputSchema = z.object({
|
|
|
171
158
|
.optional(),
|
|
172
159
|
expected_server_path: z.string().min(1).optional(),
|
|
173
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
|
+
});
|
|
174
192
|
/** Target lifecycle tools available only on the long-lived MCP adapter. */
|
|
175
193
|
export const SESSION_TOOL_CONTRACTS = [
|
|
176
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),
|
|
177
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),
|
|
178
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),
|
|
179
|
-
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.",
|
|
180
|
-
|
|
181
|
-
overwrite: z.boolean().default(false),
|
|
182
|
-
})),
|
|
183
|
-
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) })),
|
|
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),
|
|
184
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),
|
|
185
|
-
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.",
|
|
186
|
-
left_evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
|
|
187
|
-
left: processCaptureSchema,
|
|
188
|
-
right_evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
|
|
189
|
-
right: processCaptureSchema,
|
|
190
|
-
max_capture_age_ms: z.number().int().nonnegative().optional(),
|
|
191
|
-
unknown_registry_approved: z
|
|
192
|
-
.literal(true)
|
|
193
|
-
.optional()
|
|
194
|
-
.describe("Explicit approval to record capture disagreement durably"),
|
|
195
|
-
})),
|
|
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),
|
|
196
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),
|
|
197
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),
|
|
198
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),
|
|
@@ -200,16 +205,10 @@ export const SESSION_TOOL_CONTRACTS = [
|
|
|
200
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),
|
|
201
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),
|
|
202
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),
|
|
203
|
-
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.",
|
|
204
|
-
status: z
|
|
205
|
-
.enum(["open", "investigating", "blocked", "contradicted", "resolved"])
|
|
206
|
-
.optional(),
|
|
207
|
-
severity: z.enum(["low", "medium", "high", "critical"]).optional(),
|
|
208
|
-
domain: z.string().trim().min(1).max(100).optional(),
|
|
209
|
-
})),
|
|
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),
|
|
210
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),
|
|
211
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),
|
|
212
|
-
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),
|
|
213
212
|
];
|
|
214
213
|
/** Complete ordered public inventory used by registration and verification. */
|
|
215
214
|
export const TOOL_CONTRACTS = [
|
|
@@ -217,7 +216,10 @@ export const TOOL_CONTRACTS = [
|
|
|
217
216
|
...ENHANCED_TOOL_CONTRACTS,
|
|
218
217
|
...NATIVE_TOOL_CONTRACTS,
|
|
219
218
|
...ARTIFACT_TOOL_CONTRACTS,
|
|
219
|
+
...MANAGED_TOOL_CONTRACTS,
|
|
220
|
+
...MANAGED_WORKFLOW_TOOL_CONTRACTS,
|
|
220
221
|
...BROWSER_TOOL_CONTRACTS,
|
|
221
222
|
...ELECTRON_TOOL_CONTRACTS,
|
|
223
|
+
...APPLICATION_TOOL_CONTRACTS,
|
|
222
224
|
...SESSION_TOOL_CONTRACTS,
|
|
223
225
|
];
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
const effects = (overrides = {}) => ({
|
|
2
|
+
mutatesTarget: false,
|
|
3
|
+
mutatesSession: false,
|
|
4
|
+
writesFilesystem: false,
|
|
5
|
+
launchesProcess: false,
|
|
6
|
+
accessesNetwork: false,
|
|
7
|
+
changesUiState: false,
|
|
8
|
+
mayDiscardData: false,
|
|
9
|
+
idempotent: true,
|
|
10
|
+
...overrides,
|
|
11
|
+
});
|
|
12
|
+
const evidence = effects({ mutatesSession: true });
|
|
13
|
+
const nativeEvidence = effects({ mutatesSession: true, launchesProcess: true });
|
|
14
|
+
const browserEvidence = effects({
|
|
15
|
+
mutatesSession: true,
|
|
16
|
+
accessesNetwork: true,
|
|
17
|
+
});
|
|
18
|
+
const sessionEvidence = effects({ mutatesSession: true });
|
|
19
|
+
/** Explicit effect audit for every public tool. */
|
|
20
|
+
export const TOOL_EFFECTS = {
|
|
21
|
+
address_name: evidence,
|
|
22
|
+
comment: evidence,
|
|
23
|
+
current_address: evidence,
|
|
24
|
+
current_procedure: evidence,
|
|
25
|
+
current_document: evidence,
|
|
26
|
+
goto_address: effects({ mutatesSession: true, changesUiState: true }),
|
|
27
|
+
inline_comment: evidence,
|
|
28
|
+
list_bookmarks: evidence,
|
|
29
|
+
list_documents: evidence,
|
|
30
|
+
list_names: evidence,
|
|
31
|
+
list_procedures: evidence,
|
|
32
|
+
list_segments: evidence,
|
|
33
|
+
list_strings: evidence,
|
|
34
|
+
next_address: evidence,
|
|
35
|
+
prev_address: evidence,
|
|
36
|
+
procedure_address: evidence,
|
|
37
|
+
procedure_assembly: evidence,
|
|
38
|
+
procedure_callees: evidence,
|
|
39
|
+
procedure_callers: evidence,
|
|
40
|
+
procedure_info: evidence,
|
|
41
|
+
procedure_references: evidence,
|
|
42
|
+
procedure_pseudo_code: evidence,
|
|
43
|
+
resolve_containing_procedure: evidence,
|
|
44
|
+
search_procedures: evidence,
|
|
45
|
+
search_strings: evidence,
|
|
46
|
+
set_address_name: effects({ mutatesTarget: true, mutatesSession: true }),
|
|
47
|
+
set_addresses_names: effects({ mutatesTarget: true, mutatesSession: true }),
|
|
48
|
+
set_bookmark: effects({ mutatesTarget: true, mutatesSession: true }),
|
|
49
|
+
set_comment: effects({ mutatesTarget: true, mutatesSession: true }),
|
|
50
|
+
set_current_document: effects({ mutatesSession: true, changesUiState: true }),
|
|
51
|
+
set_inline_comment: effects({ mutatesTarget: true, mutatesSession: true }),
|
|
52
|
+
unset_bookmark: effects({
|
|
53
|
+
mutatesTarget: true,
|
|
54
|
+
mutatesSession: true,
|
|
55
|
+
mayDiscardData: true,
|
|
56
|
+
}),
|
|
57
|
+
xrefs: evidence,
|
|
58
|
+
swift_classes: evidence,
|
|
59
|
+
get_objc_classes: evidence,
|
|
60
|
+
get_objc_protocols: evidence,
|
|
61
|
+
batch_decompile: evidence,
|
|
62
|
+
get_call_graph: evidence,
|
|
63
|
+
analyze_swift_types: evidence,
|
|
64
|
+
find_xrefs_to_name: evidence,
|
|
65
|
+
binary_overview: evidence,
|
|
66
|
+
analyze_function: evidence,
|
|
67
|
+
trace_feature: effects({ mutatesSession: true, idempotent: false }),
|
|
68
|
+
inspect_macho: nativeEvidence,
|
|
69
|
+
inspect_signature: nativeEvidence,
|
|
70
|
+
inspect_plist: nativeEvidence,
|
|
71
|
+
list_architectures: nativeEvidence,
|
|
72
|
+
demangle_swift: nativeEvidence,
|
|
73
|
+
inventory_artifact: evidence,
|
|
74
|
+
extract_artifact: effects({ mutatesSession: true, writesFilesystem: true }),
|
|
75
|
+
inspect_managed_artifact: evidence,
|
|
76
|
+
inspect_managed_members: evidence,
|
|
77
|
+
inspect_managed_native_boundaries: evidence,
|
|
78
|
+
compare_managed_members: sessionEvidence,
|
|
79
|
+
verify_managed_native_boundaries: sessionEvidence,
|
|
80
|
+
import_managed_reconstruction: sessionEvidence,
|
|
81
|
+
plan_managed_runtime_correlation: sessionEvidence,
|
|
82
|
+
project_managed_application_graph: sessionEvidence,
|
|
83
|
+
list_browser_targets: browserEvidence,
|
|
84
|
+
inspect_web_page: browserEvidence,
|
|
85
|
+
analyze_web_bundle: browserEvidence,
|
|
86
|
+
observe_web_session: browserEvidence,
|
|
87
|
+
discover_webmcp_tools: browserEvidence,
|
|
88
|
+
compare_web_captures: browserEvidence,
|
|
89
|
+
capture_web_screenshot: browserEvidence,
|
|
90
|
+
compare_web_screenshots: browserEvidence,
|
|
91
|
+
list_electron_targets: browserEvidence,
|
|
92
|
+
inspect_electron_page: browserEvidence,
|
|
93
|
+
analyze_javascript_application: evidence,
|
|
94
|
+
reconcile_javascript_runtime: evidence,
|
|
95
|
+
trace_application_feature: evidence,
|
|
96
|
+
compare_application_versions: evidence,
|
|
97
|
+
run_controlled_replay: effects({
|
|
98
|
+
mutatesSession: true,
|
|
99
|
+
writesFilesystem: true,
|
|
100
|
+
launchesProcess: true,
|
|
101
|
+
}),
|
|
102
|
+
open_binary: effects({ mutatesSession: true, launchesProcess: true }),
|
|
103
|
+
close_binary: effects({
|
|
104
|
+
mutatesSession: true,
|
|
105
|
+
writesFilesystem: true,
|
|
106
|
+
mayDiscardData: true,
|
|
107
|
+
idempotent: false,
|
|
108
|
+
}),
|
|
109
|
+
binary_session: effects(),
|
|
110
|
+
export_evidence_bundle: effects({
|
|
111
|
+
writesFilesystem: true,
|
|
112
|
+
mayDiscardData: true,
|
|
113
|
+
}),
|
|
114
|
+
import_evidence_bundle: effects({ mutatesSession: true }),
|
|
115
|
+
capture_process_scenario: effects({
|
|
116
|
+
mutatesSession: true,
|
|
117
|
+
writesFilesystem: true,
|
|
118
|
+
launchesProcess: true,
|
|
119
|
+
idempotent: false,
|
|
120
|
+
}),
|
|
121
|
+
compare_process_captures: sessionEvidence,
|
|
122
|
+
compare_artifacts: sessionEvidence,
|
|
123
|
+
compare_functions: sessionEvidence,
|
|
124
|
+
compare_bundles: effects({ mutatesSession: true }),
|
|
125
|
+
find_changed_behavior: sessionEvidence,
|
|
126
|
+
build_call_path: sessionEvidence,
|
|
127
|
+
correlate_static_and_runtime: sessionEvidence,
|
|
128
|
+
verify_reconstruction: sessionEvidence,
|
|
129
|
+
list_unknowns: effects(),
|
|
130
|
+
record_unknown: effects({ mutatesSession: true, idempotent: false }),
|
|
131
|
+
update_unknown: effects({ mutatesSession: true, idempotent: false }),
|
|
132
|
+
verify_unknown_resolution: effects(),
|
|
133
|
+
};
|
|
134
|
+
/** Derive MCP annotations without tool-name or tool-family heuristics. */
|
|
135
|
+
export const annotationsFromEffects = (value) => ({
|
|
136
|
+
readOnlyHint: !(value.mutatesTarget ||
|
|
137
|
+
value.mutatesSession ||
|
|
138
|
+
value.writesFilesystem ||
|
|
139
|
+
value.launchesProcess ||
|
|
140
|
+
value.accessesNetwork ||
|
|
141
|
+
value.changesUiState ||
|
|
142
|
+
value.mayDiscardData),
|
|
143
|
+
destructiveHint: value.mayDiscardData,
|
|
144
|
+
idempotentHint: value.idempotent,
|
|
145
|
+
openWorldHint: value.launchesProcess || value.accessesNetwork,
|
|
146
|
+
});
|
|
147
|
+
/** Resolve the audited metadata for one public tool. */
|
|
148
|
+
export const toolContractMetadata = (name) => {
|
|
149
|
+
const audited = TOOL_EFFECTS[name];
|
|
150
|
+
if (audited === undefined)
|
|
151
|
+
throw new Error(`Missing effect audit for ${name}`);
|
|
152
|
+
return {
|
|
153
|
+
title: name
|
|
154
|
+
.split("_")
|
|
155
|
+
.map((word) => word[0]?.toUpperCase() + word.slice(1))
|
|
156
|
+
.join(" "),
|
|
157
|
+
effects: audited,
|
|
158
|
+
annotations: annotationsFromEffects(audited),
|
|
159
|
+
};
|
|
160
|
+
};
|