rea-agents 2.0.0 → 2.1.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 +78 -32
- package/bridge/ghidra/ReaGhidraBridge.java +96 -11
- package/dist/application/ArtifactExtraction.js +1 -1
- package/dist/application/ArtifactInventory/classify.js +42 -0
- package/dist/application/ArtifactInventory/hash.js +43 -0
- package/dist/application/ArtifactInventory/reader.js +41 -0
- package/dist/application/ArtifactInventory/scanCanonical.js +155 -0
- package/dist/application/ArtifactInventory/scanReader.js +124 -0
- package/dist/application/ArtifactInventory/types.js +10 -0
- package/dist/application/ArtifactInventory.js +9 -351
- package/dist/application/AuthorizedArtifactInventory.js +2 -2
- package/dist/application/BinarySession.js +47 -270
- package/dist/application/BinarySessionExecution.js +28 -0
- package/dist/application/BinarySessionOpen.js +39 -0
- package/dist/application/BinarySessionRecords.js +149 -0
- package/dist/application/BinarySessionStatus.js +75 -0
- package/dist/application/CapabilityInventory.js +24 -2
- package/dist/application/ClientRegistrationStatus.js +1 -1
- package/dist/application/CrossVersionInventory.js +8 -2
- package/dist/application/CrossVersionInvestigation.js +1 -23
- package/dist/application/CrossVersionInvestigationCollections.js +23 -0
- package/dist/application/DirectAnalysis.js +47 -44
- package/dist/application/Doctor.js +156 -238
- package/dist/application/DoctorDiagnostics.js +180 -0
- package/dist/application/ElectronBoundaryAnalysis.js +23 -7
- package/dist/application/ElectronBoundaryGraphWindows.js +32 -8
- package/dist/application/EnhancedToolPagination.js +22 -0
- package/dist/application/EnhancedToolTypes.js +4 -0
- package/dist/application/EnhancedTools.js +20 -37
- package/dist/application/InstrumentedJavaScriptReplayHost.js +36 -0
- package/dist/application/InvestigationWorkspaceStore.js +24 -10
- package/dist/application/JavaScriptArtifactAnalysis.js +45 -6
- package/dist/application/JavaScriptArtifactFiles.js +6 -2
- package/dist/application/JavaScriptArtifactGraphBuilder.js +23 -1
- package/dist/application/JavaScriptArtifactGraphBundlers.js +225 -0
- package/dist/application/JavaScriptArtifactGraphContext.js +37 -36
- package/dist/application/JavaScriptArtifactGraphDocuments.js +27 -4
- package/dist/application/JavaScriptArtifactGraphFindings.js +54 -8
- package/dist/application/JavaScriptArtifactGraphStructure.js +29 -101
- package/dist/application/JavaScriptArtifactPathResolution.js +269 -0
- package/dist/application/JavaScriptArtifactReconstruction.js +1 -1
- package/dist/application/JavaScriptJsonModules.js +39 -0
- package/dist/application/JavaScriptModuleRelationships.js +262 -0
- package/dist/application/JavaScriptReplayPermission.js +16 -0
- package/dist/application/JavaScriptReplayService.js +182 -156
- package/dist/application/LinuxHopper.js +10 -0
- package/dist/application/MacHopper.js +22 -11
- package/dist/application/NodeRuntimeCharacterizationService.js +196 -0
- package/dist/application/PermissionAuthority.js +106 -63
- package/dist/application/ProcessCaptureCapability.js +1 -1
- package/dist/application/ProcessCapturePermission.js +13 -0
- package/dist/application/ProcessCli.js +2 -12
- package/dist/application/ProcessHarness.js +1 -1
- package/dist/application/ProjectPermissionStore.js +48 -9
- package/dist/application/RealHopperAssertions.js +76 -0
- package/dist/application/ReconstructionCoverageService.js +69 -0
- package/dist/application/ReconstructionCoverageWorkspaceStore.js +31 -0
- package/dist/application/RuntimeExecutableDiagnostics.js +172 -0
- package/dist/application/Setup.js +147 -259
- package/dist/application/SetupClientConfiguration.js +220 -0
- package/dist/application/SetupClients.js +24 -2
- package/dist/application/SetupPlan.js +123 -12
- package/dist/application/SetupSkill.js +26 -12
- package/dist/application/SupportedClients.js +1 -0
- package/dist/application/Uninstall.js +6 -3
- package/dist/application/WindowsCapabilities.js +86 -0
- package/dist/artifacts/AsarArtifactReader.js +11 -0
- package/dist/browser/BrowserProcessStartup.js +88 -0
- package/dist/browser/CdpCaptureDocuments.js +12 -8
- package/dist/browser/CdpCaptureEventBodyShapes.js +75 -0
- package/dist/browser/CdpCaptureEventHandlers.js +336 -0
- package/dist/browser/CdpCaptureEventHelpers.js +71 -0
- package/dist/browser/CdpCaptureEventState.js +1 -0
- package/dist/browser/CdpCaptureEventTypes.js +1 -0
- package/dist/browser/CdpCaptureEvents.js +29 -496
- package/dist/browser/CdpObservationSession.js +51 -8
- package/dist/browser/CdpPageCapture.js +12 -133
- package/dist/browser/CdpPageCaptureScripts.js +97 -0
- package/dist/browser/CdpPageCaptureWorkers.js +46 -0
- package/dist/browser/CdpWebMcpDiscovery.js +38 -14
- package/dist/browser/PngVisualDiff.js +9 -2
- package/dist/catalogIdentity.js +4 -0
- package/dist/cli/artifactCommands.js +82 -0
- package/dist/cli/coreAnalysisCommands.js +232 -0
- package/dist/cli/managedCommands.js +397 -0
- package/dist/cli/managedProjectGraphCommand.js +24 -0
- package/dist/cli/options.js +9 -0
- package/dist/cli/setupCommands.js +108 -0
- package/dist/cli/types.js +1 -0
- package/dist/cli/utilityCommands.js +122 -0
- package/dist/cli.js +10 -768
- package/dist/cliApplicationCommands.js +118 -4
- package/dist/cliBrowserAdvancedCommands.js +73 -16
- package/dist/cliBrowserCommands.js +39 -115
- package/dist/cliCommandNames.js +4 -0
- package/dist/cliElectronCommands.js +33 -62
- package/dist/cliEvidenceCommands.js +13 -2
- package/dist/cliInvestigationCommands.js +53 -10
- package/dist/cliObservationOptions.js +137 -0
- package/dist/cliPolicyCommands.js +80 -46
- package/dist/cliSetup.js +289 -0
- package/dist/config/environment.js +107 -0
- package/dist/config/parseConfig.js +228 -0
- package/dist/config/parsers.js +68 -0
- package/dist/config/permissions.js +30 -0
- package/dist/config/types.js +1 -0
- package/dist/config.js +1 -375
- package/dist/contracts/applicationToolContracts.js +134 -0
- package/dist/contracts/managedToolContracts.js +1 -1
- package/dist/contracts/managedWorkflowToolContracts.js +3 -3
- package/dist/contracts/providerSelection.js +2 -0
- package/dist/contracts/toolContracts.js +2 -2
- package/dist/contracts/toolEffects.js +14 -0
- package/dist/contracts/toolOutputSchemaGroups.js +232 -0
- package/dist/contracts/toolOutputSchemaPrimitives.js +327 -0
- package/dist/contracts/toolOutputSchemas.js +2 -550
- package/dist/domain/analysisErrorPresentation.js +234 -0
- package/dist/domain/analysisErrorProjection.js +284 -0
- package/dist/domain/artifactComparison.js +34 -15
- package/dist/domain/binaryTarget.js +87 -37
- package/dist/domain/browserObservation.js +1 -285
- package/dist/domain/browserObservationSchemas.js +286 -0
- package/dist/domain/electronStaticAnalysisBrowser.js +14 -2
- package/dist/domain/errors.js +4 -486
- package/dist/domain/functionComparison.js +4 -165
- package/dist/domain/functionComparisonDimensions.js +164 -0
- package/dist/domain/javascriptApplicationVersionItems.js +18 -6
- package/dist/domain/javascriptApplicationVersionKeys.js +8 -8
- package/dist/domain/javascriptExportInstrumentation.js +97 -0
- package/dist/domain/javascriptFeatureTraversal.js +19 -7
- package/dist/domain/javascriptRuntimeStaticCandidates.js +3 -1
- package/dist/domain/javascriptSemanticAnalysis.js +386 -0
- package/dist/domain/javascriptSemanticIr.js +30 -0
- package/dist/domain/javascriptSemanticProjection.js +366 -0
- package/dist/domain/javascriptSemanticState.js +40 -0
- package/dist/domain/javascriptSemanticTraversal.js +22 -0
- package/dist/domain/javascriptSemanticValues.js +352 -0
- package/dist/domain/javascriptStaticAnalysis.js +5 -221
- package/dist/domain/javascriptStaticAnalysisBundler.js +209 -0
- package/dist/domain/javascriptStaticAnalysisCalls.js +180 -0
- package/dist/domain/javascriptStaticAnalysisHelpers.js +71 -2
- package/dist/domain/knownPageCoverage.js +21 -0
- package/dist/domain/managedApplicationGraph.js +14 -364
- package/dist/domain/managedApplicationGraphCoverage.js +170 -0
- package/dist/domain/managedApplicationGraphNodeCoverage.js +6 -0
- package/dist/domain/managedApplicationGraphNodes.js +336 -0
- package/dist/domain/managedArtifact.js +16 -8
- package/dist/domain/managedMemberComparison.js +37 -391
- package/dist/domain/managedMemberComparisonCoverage.js +72 -0
- package/dist/domain/managedMemberComparisonMatch.js +356 -0
- package/dist/domain/managedNativeVerification.js +27 -389
- package/dist/domain/managedNativeVerificationMatch.js +272 -0
- package/dist/domain/managedNativeVerificationSchemas.js +141 -0
- package/dist/domain/managedReconstruction.js +82 -69
- package/dist/domain/managedRuntimeCorrelation.js +12 -3
- package/dist/domain/nodeRuntimeCharacterization.js +66 -0
- package/dist/domain/permissionPolicy.js +2 -0
- package/dist/domain/reconstructionCoverage.js +387 -0
- package/dist/domain/reconstructionCoverageEvaluation.js +212 -0
- package/dist/domain/reconstructionVerificationSchemas.js +8 -0
- package/dist/domain/runtimeCharacterization.js +85 -0
- package/dist/domain/webBundleAnalyzer.js +3 -409
- package/dist/domain/webBundleAnalyzerAst.js +77 -0
- package/dist/domain/webBundleAnalyzerInspection.js +307 -0
- package/dist/domain/webBundleAnalyzerResult.js +120 -0
- package/dist/dotnet/ManagedArtifactInspector.js +50 -29
- package/dist/dotnet/ManagedMemberInspector.js +51 -785
- package/dist/dotnet/ManagedMemberInspectorCore.js +297 -0
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +427 -0
- package/dist/dotnet/ManagedMemberRows.js +120 -0
- package/dist/dotnet/ManagedMetadataInventory.js +42 -306
- package/dist/dotnet/ManagedMetadataInventoryRows.js +292 -0
- package/dist/dotnet/ManagedMetadataLayout.js +48 -111
- package/dist/dotnet/ManagedMetadataRowSizes.js +54 -0
- package/dist/dotnet/ManagedMethodBodyReader.js +143 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +311 -0
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +102 -350
- package/dist/dotnet/ManagedPeReader.js +59 -28
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraClient.js +76 -91
- package/dist/ghidra/GhidraClientStartup.js +29 -0
- package/dist/ghidra/GhidraClientWire.js +34 -0
- package/dist/ghidra/GhidraDefaults.js +1 -1
- package/dist/ghidra/GhidraDiagnostics.js +6 -1
- package/dist/ghidra/GhidraInstallation.js +20 -15
- package/dist/ghidra/GhidraLauncher.js +93 -29
- package/dist/ghidra/GhidraProvider.js +61 -161
- package/dist/ghidra/GhidraProviderCapabilities.js +173 -0
- package/dist/ghidra/GhidraSessionValues.js +2 -0
- package/dist/ghidra/GhidraSocketConnection.js +44 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +30 -0
- package/dist/ghidra/GhidraTransport.js +71 -0
- package/dist/identity.js +3 -2
- package/dist/main/messages.js +5 -0
- package/dist/main/reload.js +49 -0
- package/dist/main/shutdown.js +25 -0
- package/dist/main/startup.js +14 -0
- package/dist/main/state.js +26 -0
- package/dist/main/transport.js +61 -0
- package/dist/main/types.js +1 -0
- package/dist/main.js +35 -146
- package/dist/process/PrivateRuntimeRoot.js +3 -2
- package/dist/process/ProcessOwnership.js +35 -0
- package/dist/process/ProviderProcess.js +2 -0
- package/dist/replay/JavaScriptReplayWorker.js +64 -50
- package/dist/replay/LinuxJavaScriptReplayRunner.js +173 -390
- package/dist/replay/LinuxJavaScriptReplaySandbox.js +140 -0
- package/dist/replay/ReplayOutcome.js +95 -0
- package/dist/replay/ReplayProcessLifecycle.js +71 -0
- package/dist/server/ProcessCaptureElicitation.js +157 -0
- package/dist/server/createServer.js +119 -54
- package/dist/server/registerApplicationTools/characterization.js +57 -0
- package/dist/server/registerApplicationTools/compareVersions.js +34 -0
- package/dist/server/registerApplicationTools/controlledReplay.js +38 -0
- package/dist/server/registerApplicationTools/coverage.js +84 -0
- package/dist/server/registerApplicationTools/helpers.js +42 -0
- package/dist/server/registerApplicationTools/traceFeature.js +26 -0
- package/dist/server/registerApplicationTools/types.js +1 -0
- package/dist/server/registerApplicationTools.js +10 -112
- package/dist/server/registerBrowserTools.js +59 -83
- package/dist/server/registerElectronTools.js +31 -46
- package/dist/server/registerEnhancedTools.js +34 -42
- package/dist/server/registerEvidenceResources.js +54 -0
- package/dist/server/registerInvestigationTools/helpers.js +74 -0
- package/dist/server/registerInvestigationTools/types.js +1 -0
- package/dist/server/registerInvestigationTools.js +83 -116
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +65 -0
- package/dist/server/registerManagedWorkflowTools/contract.js +8 -0
- package/dist/server/registerManagedWorkflowTools/evidence.js +43 -0
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +39 -0
- package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +39 -0
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +52 -0
- package/dist/server/registerManagedWorkflowTools/types.js +1 -0
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +75 -0
- package/dist/server/registerManagedWorkflowTools.js +10 -274
- package/dist/server/registerOfficialTools.js +73 -59
- package/dist/server/registerSessionRecordTools.js +137 -0
- package/dist/server/registerSessionStatusTool.js +2 -1
- package/dist/server/registerSessionTools.js +60 -164
- package/dist/server/sessionAvailabilityPolicy.js +10 -0
- package/dist/server/toolRegistrationOptions.js +101 -3
- package/dist/server/toolResult.js +5 -0
- package/package.json +10 -11
- package/skills/{rea-analysis → reverse-engineer-anything}/SKILL.md +20 -7
- package/scripts/prepare-node-pty.mjs +0 -35
- package/scripts/rebuild-native.mjs +0 -22
|
@@ -1,550 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { evidenceBundleSchema } from "../domain/evidenceBundle.js";
|
|
4
|
-
import { residualUnknownSchema } from "../domain/residualUnknown.js";
|
|
5
|
-
import { functionDossierSchema, localVariableSchema, procedureClassificationSchema, procedureIdentitySchema, referenceKindSchema, } from "../domain/hopperValues.js";
|
|
6
|
-
import { demangleSwiftSchema, inspectMachoSchema, inspectPlistSchema, inspectSignatureSchema, listArchitecturesSchema, } from "../domain/nativeInspection.js";
|
|
7
|
-
import { artifactExtractionResultSchema, artifactInventoryResultSchema, } from "../domain/artifactGraph.js";
|
|
8
|
-
import { managedArtifactInspectionSchema, managedMemberInspectionSchema, managedNativeBoundaryInspectionSchema, } from "../domain/managedArtifact.js";
|
|
9
|
-
import { managedMemberComparisonResultSchema } from "../domain/managedMemberComparison.js";
|
|
10
|
-
import { managedNativeVerificationResultSchema } from "../domain/managedNativeVerification.js";
|
|
11
|
-
import { managedReconstructionImportResultSchema } from "../domain/managedReconstruction.js";
|
|
12
|
-
import { managedRuntimeCorrelationResultSchema } from "../domain/managedRuntimeCorrelation.js";
|
|
13
|
-
import { managedApplicationGraphResultSchema } from "../domain/managedApplicationGraph.js";
|
|
14
|
-
import { artifactComparisonResultSchema } from "../domain/artifactComparison.js";
|
|
15
|
-
import { functionComparisonResultSchema } from "../domain/functionComparison.js";
|
|
16
|
-
import { bundleComparisonResultSchema } from "../domain/bundleComparison.js";
|
|
17
|
-
import { changedBehaviorResultSchema } from "../domain/changedBehavior.js";
|
|
18
|
-
import { callPathResultSchema } from "../domain/callPath.js";
|
|
19
|
-
import { staticRuntimeCorrelationResultSchema } from "../domain/staticRuntimeCorrelation.js";
|
|
20
|
-
import { reconstructionVerificationResultSchema } from "../domain/reconstructionVerification.js";
|
|
21
|
-
import { analysisErrorProjectionSchema } from "./errorSchemas.js";
|
|
22
|
-
import { analysisProfileSchema } from "../domain/analysisProfile.js";
|
|
23
|
-
import { PROVIDER_REJECTION_CODES, } from "./providerSelection.js";
|
|
24
|
-
/** Compact MCP result with an immutable link to complete session Evidence. */
|
|
25
|
-
export const evidenceResultOf = (schema) => z.strictObject({
|
|
26
|
-
result: schema,
|
|
27
|
-
evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
|
|
28
|
-
evidence_uri: z.string().regex(/^rea:\/\/evidence\/ev_[a-f0-9]{64}$/u),
|
|
29
|
-
});
|
|
30
|
-
const resultOf = evidenceResultOf;
|
|
31
|
-
const lifecycleResultOf = (schema) => z.object({ result: schema });
|
|
32
|
-
/** Resolve a required named output schema or reject contract drift. */
|
|
33
|
-
export const requireOutputSchema = (schemas, name) => {
|
|
34
|
-
const schema = schemas[name];
|
|
35
|
-
if (schema === undefined)
|
|
36
|
-
throw new Error(`Missing output schema for ${name}`);
|
|
37
|
-
return schema;
|
|
38
|
-
};
|
|
39
|
-
const targetFormatSchema = z.enum([
|
|
40
|
-
"hopper",
|
|
41
|
-
"analysis-database",
|
|
42
|
-
"mach-o",
|
|
43
|
-
"elf",
|
|
44
|
-
"pe",
|
|
45
|
-
"zip",
|
|
46
|
-
"ipa",
|
|
47
|
-
"apk",
|
|
48
|
-
"asar",
|
|
49
|
-
"dmg",
|
|
50
|
-
"pkg",
|
|
51
|
-
"plist",
|
|
52
|
-
"javascript",
|
|
53
|
-
"source-map",
|
|
54
|
-
]);
|
|
55
|
-
const targetKindSchema = z.enum([
|
|
56
|
-
"executable",
|
|
57
|
-
"database",
|
|
58
|
-
"archive",
|
|
59
|
-
"artifact",
|
|
60
|
-
]);
|
|
61
|
-
const providerCapability = z.object({
|
|
62
|
-
operation: z.string(),
|
|
63
|
-
available: z.boolean(),
|
|
64
|
-
reason: z.string().nullable(),
|
|
65
|
-
input_contract_version: z.number().int().min(1),
|
|
66
|
-
output_contract_version: z.number().int().min(1),
|
|
67
|
-
pagination: z.enum(["none", "offset", "cursor"]),
|
|
68
|
-
exhaustive: z.boolean(),
|
|
69
|
-
effects: z.object({
|
|
70
|
-
mutates_artifact: z.boolean(),
|
|
71
|
-
launches_process: z.boolean(),
|
|
72
|
-
may_show_ui: z.boolean(),
|
|
73
|
-
may_access_network: z.boolean(),
|
|
74
|
-
may_write_filesystem: z.boolean(),
|
|
75
|
-
changes_permissions: z.boolean(),
|
|
76
|
-
requires_root: z.boolean(),
|
|
77
|
-
}),
|
|
78
|
-
limits: z.object({
|
|
79
|
-
max_results: z.number().int().min(0).nullable(),
|
|
80
|
-
max_payload_bytes: z.number().int().min(0).nullable(),
|
|
81
|
-
timeout_ms: z.number().int().min(0).nullable(),
|
|
82
|
-
}),
|
|
83
|
-
limitations: z.array(z.string()),
|
|
84
|
-
});
|
|
85
|
-
const providerIdentity = z.object({
|
|
86
|
-
id: z.string(),
|
|
87
|
-
name: z.string(),
|
|
88
|
-
version: z.string().nullable(),
|
|
89
|
-
});
|
|
90
|
-
const providerRejectionCode = z.enum(PROVIDER_REJECTION_CODES);
|
|
91
|
-
const providerDiagnostics = z.record(z.string(), z.json());
|
|
92
|
-
const providerAvailability = z.discriminatedUnion("status", [
|
|
93
|
-
z.object({
|
|
94
|
-
status: z.literal("available"),
|
|
95
|
-
code: z.null(),
|
|
96
|
-
reason: z.null(),
|
|
97
|
-
diagnostics: providerDiagnostics,
|
|
98
|
-
}),
|
|
99
|
-
z.object({
|
|
100
|
-
status: z.literal("unavailable"),
|
|
101
|
-
code: providerRejectionCode,
|
|
102
|
-
reason: z.string().min(1),
|
|
103
|
-
diagnostics: providerDiagnostics,
|
|
104
|
-
}),
|
|
105
|
-
]);
|
|
106
|
-
const providerTargetSupport = z.discriminatedUnion("status", [
|
|
107
|
-
z.object({
|
|
108
|
-
status: z.literal("unknown"),
|
|
109
|
-
code: z.null(),
|
|
110
|
-
reason: z.string().min(1),
|
|
111
|
-
diagnostics: providerDiagnostics,
|
|
112
|
-
}),
|
|
113
|
-
z.object({
|
|
114
|
-
status: z.literal("supported"),
|
|
115
|
-
code: z.null(),
|
|
116
|
-
reason: z.null(),
|
|
117
|
-
diagnostics: providerDiagnostics,
|
|
118
|
-
}),
|
|
119
|
-
z.object({
|
|
120
|
-
status: z.literal("unsupported"),
|
|
121
|
-
code: z.enum([
|
|
122
|
-
"target_kind_unsupported",
|
|
123
|
-
"target_format_unsupported",
|
|
124
|
-
"architecture_unsupported",
|
|
125
|
-
]),
|
|
126
|
-
reason: z.string().min(1),
|
|
127
|
-
diagnostics: providerDiagnostics,
|
|
128
|
-
}),
|
|
129
|
-
]);
|
|
130
|
-
const sessionProvider = z.object({
|
|
131
|
-
provider: providerIdentity,
|
|
132
|
-
providers: z.array(providerIdentity),
|
|
133
|
-
capabilities: z.array(providerCapability),
|
|
134
|
-
analysis_provider_binding: z
|
|
135
|
-
.object({
|
|
136
|
-
provider: providerIdentity,
|
|
137
|
-
selection_source: z.enum([
|
|
138
|
-
"request",
|
|
139
|
-
"environment",
|
|
140
|
-
"auto-single-candidate",
|
|
141
|
-
]),
|
|
142
|
-
analysis_profile: analysisProfileSchema,
|
|
143
|
-
})
|
|
144
|
-
.nullable(),
|
|
145
|
-
analysis_provider_candidates: z.array(z.object({
|
|
146
|
-
provider: providerIdentity,
|
|
147
|
-
availability: providerAvailability,
|
|
148
|
-
target_support: providerTargetSupport,
|
|
149
|
-
selected: z.boolean(),
|
|
150
|
-
capabilities: z.array(providerCapability),
|
|
151
|
-
})),
|
|
152
|
-
tool_availability: z.array(z.object({
|
|
153
|
-
name: z.string(),
|
|
154
|
-
surface: z.string(),
|
|
155
|
-
available: z.boolean(),
|
|
156
|
-
reason: z.enum([
|
|
157
|
-
"available",
|
|
158
|
-
"target_required",
|
|
159
|
-
"provider_missing",
|
|
160
|
-
"provider_unavailable",
|
|
161
|
-
"target_unsupported",
|
|
162
|
-
"unsupported_host",
|
|
163
|
-
"policy_disabled",
|
|
164
|
-
]),
|
|
165
|
-
remediation: z.string().nullable(),
|
|
166
|
-
effects: z.strictObject({
|
|
167
|
-
mutatesTarget: z.boolean(),
|
|
168
|
-
mutatesSession: z.boolean(),
|
|
169
|
-
writesFilesystem: z.boolean(),
|
|
170
|
-
launchesProcess: z.boolean(),
|
|
171
|
-
accessesNetwork: z.boolean(),
|
|
172
|
-
changesUiState: z.boolean(),
|
|
173
|
-
mayDiscardData: z.boolean(),
|
|
174
|
-
idempotent: z.boolean(),
|
|
175
|
-
}),
|
|
176
|
-
annotations: z.object({
|
|
177
|
-
read_only: z.boolean(),
|
|
178
|
-
destructive: z.boolean(),
|
|
179
|
-
idempotent: z.boolean(),
|
|
180
|
-
open_world: z.boolean(),
|
|
181
|
-
}),
|
|
182
|
-
})),
|
|
183
|
-
client_features: z.object({
|
|
184
|
-
elicitation_form: z.boolean(),
|
|
185
|
-
elicitation_url: z.boolean(),
|
|
186
|
-
roots: z.boolean(),
|
|
187
|
-
sampling: z.boolean(),
|
|
188
|
-
}),
|
|
189
|
-
server_identity: z.object({
|
|
190
|
-
package: z.object({
|
|
191
|
-
name: z.string(),
|
|
192
|
-
version: z.string(),
|
|
193
|
-
root_path: z.string(),
|
|
194
|
-
build_commit: z.string().nullable(),
|
|
195
|
-
}),
|
|
196
|
-
server: z.object({
|
|
197
|
-
name: z.string(),
|
|
198
|
-
version: z.string(),
|
|
199
|
-
started_at: z.string(),
|
|
200
|
-
command_path: z.string(),
|
|
201
|
-
}),
|
|
202
|
-
sdk: z.object({
|
|
203
|
-
server: z.string(),
|
|
204
|
-
client_test: z.string(),
|
|
205
|
-
core: z.string(),
|
|
206
|
-
}),
|
|
207
|
-
negotiated_protocol_version: z.string().nullable(),
|
|
208
|
-
client: z.object({ name: z.string(), version: z.string() }).nullable(),
|
|
209
|
-
skill: z.object({ name: z.string(), expected_version: z.string() }),
|
|
210
|
-
catalog: z.record(z.string(), z.json()),
|
|
211
|
-
protocol_features: z.object({
|
|
212
|
-
progress: z.boolean(),
|
|
213
|
-
cancellation: z.boolean(),
|
|
214
|
-
evidence_resources: z.boolean(),
|
|
215
|
-
elicitation: z.boolean(),
|
|
216
|
-
}),
|
|
217
|
-
alignment: z.object({
|
|
218
|
-
state: z.enum(["aligned", "mcp_server_restart_required", "unknown"]),
|
|
219
|
-
reasons: z.array(z.string()),
|
|
220
|
-
remediation: z.string().nullable(),
|
|
221
|
-
}),
|
|
222
|
-
}),
|
|
223
|
-
});
|
|
224
|
-
const nullableText = z.string().nullable();
|
|
225
|
-
const addressList = z.array(z.string());
|
|
226
|
-
const addressedEntry = z.object({ address: z.string(), name: z.string() });
|
|
227
|
-
const procedureIdentity = procedureIdentitySchema;
|
|
228
|
-
const localVariable = localVariableSchema;
|
|
229
|
-
const containingProcedureResolution = z.discriminatedUnion("found", [
|
|
230
|
-
z.object({
|
|
231
|
-
query_address: z.string(),
|
|
232
|
-
found: z.literal(true),
|
|
233
|
-
procedure: procedureIdentity,
|
|
234
|
-
}),
|
|
235
|
-
z.object({
|
|
236
|
-
query_address: z.string(),
|
|
237
|
-
found: z.literal(false),
|
|
238
|
-
procedure: z.null(),
|
|
239
|
-
reason: z.enum(["outside_segments", "not_in_procedure"]),
|
|
240
|
-
}),
|
|
241
|
-
]);
|
|
242
|
-
const unavailable = z.object({
|
|
243
|
-
available: z.literal(false),
|
|
244
|
-
reason: z.string(),
|
|
245
|
-
});
|
|
246
|
-
const availableMemoryPermissions = z.object({
|
|
247
|
-
available: z.literal(true),
|
|
248
|
-
source: z.literal("ghidra-memory-block"),
|
|
249
|
-
});
|
|
250
|
-
const bounded = (item) => z.object({
|
|
251
|
-
items: z.array(item),
|
|
252
|
-
total: z.number().int().min(0).nullable(),
|
|
253
|
-
returned: z.number().int().min(0),
|
|
254
|
-
truncated: z.boolean(),
|
|
255
|
-
next_offset: z.number().int().min(0).nullable(),
|
|
256
|
-
});
|
|
257
|
-
const addressedValue = z.object({
|
|
258
|
-
address: z.string(),
|
|
259
|
-
value: z.string(),
|
|
260
|
-
value_truncated: z.boolean().optional(),
|
|
261
|
-
symbol: z
|
|
262
|
-
.object({
|
|
263
|
-
primary: z.boolean(),
|
|
264
|
-
dynamic: z.boolean(),
|
|
265
|
-
external: z.boolean(),
|
|
266
|
-
type: z.string(),
|
|
267
|
-
source: z.enum(["default", "analysis", "ai", "imported", "user_defined"]),
|
|
268
|
-
})
|
|
269
|
-
.optional(),
|
|
270
|
-
procedure: z
|
|
271
|
-
.object({
|
|
272
|
-
external: z.boolean(),
|
|
273
|
-
thunk: z.boolean(),
|
|
274
|
-
thunk_target: z.string().nullable(),
|
|
275
|
-
})
|
|
276
|
-
.optional(),
|
|
277
|
-
string: z
|
|
278
|
-
.object({
|
|
279
|
-
encoding: z.string(),
|
|
280
|
-
termination: z.enum(["missing", "present_or_not_required"]),
|
|
281
|
-
byte_length: z.number().int().min(0),
|
|
282
|
-
})
|
|
283
|
-
.optional(),
|
|
284
|
-
});
|
|
285
|
-
const pageOutput = z.object({
|
|
286
|
-
items: z.array(addressedValue),
|
|
287
|
-
offset: z.number().int().min(0),
|
|
288
|
-
limit: z.number().int().min(1),
|
|
289
|
-
total: z.number().int().min(0),
|
|
290
|
-
next_offset: z.number().int().min(0).nullable(),
|
|
291
|
-
has_more: z.boolean(),
|
|
292
|
-
});
|
|
293
|
-
const searchPageOutput = pageOutput.extend({
|
|
294
|
-
items: z.array(z.object({
|
|
295
|
-
address: z.string(),
|
|
296
|
-
value: z.string(),
|
|
297
|
-
value_truncated: z.boolean(),
|
|
298
|
-
})),
|
|
299
|
-
});
|
|
300
|
-
const memoryRegionOutput = z.object({
|
|
301
|
-
name: z.string(),
|
|
302
|
-
start: z.string(),
|
|
303
|
-
end: z.string(),
|
|
304
|
-
readable: z.boolean().nullable(),
|
|
305
|
-
writable: z.boolean().nullable(),
|
|
306
|
-
executable: z.boolean().nullable(),
|
|
307
|
-
permissions: z.union([unavailable, availableMemoryPermissions]),
|
|
308
|
-
provenance: z.enum(["hopper-public-python-api", "ghidra-memory-block"]),
|
|
309
|
-
address_space: z.string().optional(),
|
|
310
|
-
image_base: z.string().optional(),
|
|
311
|
-
initialized: z.boolean().optional(),
|
|
312
|
-
overlay: z.boolean().optional(),
|
|
313
|
-
});
|
|
314
|
-
const segmentOutput = resultOf(z.array(memoryRegionOutput.extend({ sections: z.array(memoryRegionOutput) })));
|
|
315
|
-
const procedureInfoOutput = resultOf(z.object({
|
|
316
|
-
name: z.string(),
|
|
317
|
-
entrypoint: z.string(),
|
|
318
|
-
basicblock_count: z.number().int().min(0),
|
|
319
|
-
length: z.number().min(0),
|
|
320
|
-
signature: nullableText,
|
|
321
|
-
locals: z.array(localVariable),
|
|
322
|
-
classification: procedureClassificationSchema.nullable().default(null),
|
|
323
|
-
}));
|
|
324
|
-
const symbolDiscoveryOutput = (property) => resultOf(z.object({
|
|
325
|
-
count: z.number().int().min(0),
|
|
326
|
-
[property]: z.array(addressedEntry),
|
|
327
|
-
}));
|
|
328
|
-
const graphNode = z.discriminatedUnion("status", [
|
|
329
|
-
z.object({
|
|
330
|
-
address: z.string(),
|
|
331
|
-
status: z.literal("ok"),
|
|
332
|
-
calls: z.array(z.string()),
|
|
333
|
-
}),
|
|
334
|
-
z.object({
|
|
335
|
-
address: z.string(),
|
|
336
|
-
status: z.literal("error"),
|
|
337
|
-
error: analysisErrorProjectionSchema,
|
|
338
|
-
}),
|
|
339
|
-
]);
|
|
340
|
-
const functionDossierOutput = resultOf(functionDossierSchema);
|
|
341
|
-
/** Exact structured-content schemas shared by direct analysis providers. */
|
|
342
|
-
export const officialOutputSchemas = {
|
|
343
|
-
address_name: resultOf(nullableText),
|
|
344
|
-
comment: resultOf(nullableText),
|
|
345
|
-
current_address: resultOf(z.string()),
|
|
346
|
-
current_procedure: resultOf(z.string()),
|
|
347
|
-
current_document: resultOf(z.string()),
|
|
348
|
-
goto_address: resultOf(z.string()),
|
|
349
|
-
inline_comment: resultOf(nullableText),
|
|
350
|
-
list_bookmarks: resultOf(z.array(addressedEntry)),
|
|
351
|
-
list_documents: resultOf(z.array(z.string())),
|
|
352
|
-
list_names: resultOf(pageOutput),
|
|
353
|
-
list_procedures: resultOf(pageOutput),
|
|
354
|
-
list_segments: segmentOutput,
|
|
355
|
-
list_strings: resultOf(pageOutput),
|
|
356
|
-
next_address: resultOf(z.string()),
|
|
357
|
-
prev_address: resultOf(z.string()),
|
|
358
|
-
procedure_address: resultOf(z.string()),
|
|
359
|
-
procedure_assembly: resultOf(z.string()),
|
|
360
|
-
procedure_callees: resultOf(addressList),
|
|
361
|
-
procedure_callers: resultOf(addressList),
|
|
362
|
-
procedure_info: procedureInfoOutput,
|
|
363
|
-
procedure_references: resultOf(z.object({
|
|
364
|
-
procedure: procedureIdentity,
|
|
365
|
-
direction: z.enum(["incoming", "outgoing"]),
|
|
366
|
-
references: bounded(z.object({
|
|
367
|
-
source_address: z.string(),
|
|
368
|
-
target_address: z.string(),
|
|
369
|
-
source_procedure: procedureIdentity.nullable(),
|
|
370
|
-
target_procedure: procedureIdentity.nullable(),
|
|
371
|
-
kind: referenceKindSchema,
|
|
372
|
-
})),
|
|
373
|
-
instructions_scanned: z.number().int().min(0),
|
|
374
|
-
instruction_scan_truncated: z.boolean(),
|
|
375
|
-
})),
|
|
376
|
-
procedure_pseudo_code: resultOf(nullableText),
|
|
377
|
-
resolve_containing_procedure: resultOf(containingProcedureResolution),
|
|
378
|
-
search_procedures: resultOf(searchPageOutput),
|
|
379
|
-
search_strings: resultOf(searchPageOutput),
|
|
380
|
-
set_address_name: resultOf(z.boolean()),
|
|
381
|
-
set_addresses_names: resultOf(z.record(z.string(), z.boolean())),
|
|
382
|
-
set_bookmark: resultOf(z.boolean()),
|
|
383
|
-
set_comment: resultOf(z.boolean()),
|
|
384
|
-
set_current_document: resultOf(z.string()),
|
|
385
|
-
set_inline_comment: resultOf(z.boolean()),
|
|
386
|
-
unset_bookmark: resultOf(z.boolean()),
|
|
387
|
-
xrefs: resultOf(addressList),
|
|
388
|
-
};
|
|
389
|
-
/** Exact structured-content schemas for composed analysis workflows. */
|
|
390
|
-
export const enhancedOutputSchemas = {
|
|
391
|
-
swift_classes: symbolDiscoveryOutput("classes"),
|
|
392
|
-
get_objc_classes: symbolDiscoveryOutput("classes"),
|
|
393
|
-
get_objc_protocols: symbolDiscoveryOutput("protocols"),
|
|
394
|
-
batch_decompile: resultOf(z.object({
|
|
395
|
-
items: z.array(z.discriminatedUnion("status", [
|
|
396
|
-
z.object({
|
|
397
|
-
address: z.string(),
|
|
398
|
-
status: z.literal("ok"),
|
|
399
|
-
pseudocode: z.string().min(1),
|
|
400
|
-
}),
|
|
401
|
-
z.object({
|
|
402
|
-
address: z.string(),
|
|
403
|
-
status: z.literal("error"),
|
|
404
|
-
error: analysisErrorProjectionSchema,
|
|
405
|
-
}),
|
|
406
|
-
])),
|
|
407
|
-
total: z.number().int().min(0),
|
|
408
|
-
succeeded: z.number().int().min(0),
|
|
409
|
-
failed: z.number().int().min(0),
|
|
410
|
-
})),
|
|
411
|
-
get_call_graph: resultOf(z.record(z.string(), z.array(graphNode))),
|
|
412
|
-
analyze_swift_types: resultOf(z.object({
|
|
413
|
-
total: z.number().int().min(0),
|
|
414
|
-
categories: z.record(z.string(), z.object({
|
|
415
|
-
count: z.number().int().min(0),
|
|
416
|
-
items: z.array(addressedEntry),
|
|
417
|
-
})),
|
|
418
|
-
})),
|
|
419
|
-
find_xrefs_to_name: resultOf(z.discriminatedUnion("status", [
|
|
420
|
-
z.object({
|
|
421
|
-
status: z.literal("resolved"),
|
|
422
|
-
name: z.string(),
|
|
423
|
-
address: z.string(),
|
|
424
|
-
xrefs: addressList,
|
|
425
|
-
}),
|
|
426
|
-
z.object({
|
|
427
|
-
status: z.literal("unresolved"),
|
|
428
|
-
name: z.string(),
|
|
429
|
-
reason: z.literal("name_not_found"),
|
|
430
|
-
}),
|
|
431
|
-
])),
|
|
432
|
-
binary_overview: resultOf(z.object({
|
|
433
|
-
document: z.string(),
|
|
434
|
-
detail: z.enum(["concise", "detailed"]),
|
|
435
|
-
segments: z.array(z.object({
|
|
436
|
-
name: z.string(),
|
|
437
|
-
start: z.string(),
|
|
438
|
-
end: z.string(),
|
|
439
|
-
length: z.number().min(0).optional(),
|
|
440
|
-
})),
|
|
441
|
-
segment_count: z.number().int().min(0),
|
|
442
|
-
procedure_count: z.number().int().min(0),
|
|
443
|
-
string_count: z.number().int().min(0),
|
|
444
|
-
})),
|
|
445
|
-
analyze_function: functionDossierOutput,
|
|
446
|
-
trace_feature: resultOf(z.object({
|
|
447
|
-
query: z.string(),
|
|
448
|
-
search_mode: z.literal("literal"),
|
|
449
|
-
operations_used: z.number().int().min(0),
|
|
450
|
-
operation_budget: z.number().int().min(1),
|
|
451
|
-
matches: z.array(z.object({
|
|
452
|
-
type: z.enum(["string", "procedure"]),
|
|
453
|
-
address: z.string(),
|
|
454
|
-
value: z.string(),
|
|
455
|
-
})),
|
|
456
|
-
references: z.array(z.object({
|
|
457
|
-
target_address: z.string(),
|
|
458
|
-
source_address: z.string(),
|
|
459
|
-
containing_procedure: containingProcedureResolution,
|
|
460
|
-
})),
|
|
461
|
-
truncated: z.boolean(),
|
|
462
|
-
residual_unknowns: z.array(z.string()),
|
|
463
|
-
})),
|
|
464
|
-
};
|
|
465
|
-
/** Exact Evidence v2 schemas for provider-neutral native inspection. */
|
|
466
|
-
export const nativeOutputSchemas = {
|
|
467
|
-
inspect_macho: resultOf(inspectMachoSchema),
|
|
468
|
-
inspect_signature: resultOf(inspectSignatureSchema),
|
|
469
|
-
inspect_plist: resultOf(inspectPlistSchema),
|
|
470
|
-
list_architectures: resultOf(listArchitecturesSchema),
|
|
471
|
-
demangle_swift: resultOf(demangleSwiftSchema),
|
|
472
|
-
};
|
|
473
|
-
/** Exact Evidence v2 schemas for provider-neutral artifact graph operations. */
|
|
474
|
-
export const artifactOutputSchemas = {
|
|
475
|
-
inventory_artifact: resultOf(artifactInventoryResultSchema),
|
|
476
|
-
extract_artifact: resultOf(artifactExtractionResultSchema),
|
|
477
|
-
};
|
|
478
|
-
/** Exact Evidence v2 schema for execution-free managed static analysis. */
|
|
479
|
-
export const managedOutputSchemas = {
|
|
480
|
-
inspect_managed_artifact: resultOf(managedArtifactInspectionSchema),
|
|
481
|
-
inspect_managed_members: resultOf(managedMemberInspectionSchema),
|
|
482
|
-
inspect_managed_native_boundaries: resultOf(managedNativeBoundaryInspectionSchema),
|
|
483
|
-
};
|
|
484
|
-
/** Exact Evidence v2 schema for provider-neutral managed workflows. */
|
|
485
|
-
export const managedWorkflowOutputSchemas = {
|
|
486
|
-
compare_managed_members: resultOf(managedMemberComparisonResultSchema),
|
|
487
|
-
verify_managed_native_boundaries: resultOf(managedNativeVerificationResultSchema),
|
|
488
|
-
import_managed_reconstruction: resultOf(managedReconstructionImportResultSchema),
|
|
489
|
-
plan_managed_runtime_correlation: resultOf(managedRuntimeCorrelationResultSchema),
|
|
490
|
-
project_managed_application_graph: resultOf(managedApplicationGraphResultSchema),
|
|
491
|
-
};
|
|
492
|
-
/** Exact structured-content schemas for target lifecycle operations. */
|
|
493
|
-
export const sessionOutputSchemas = {
|
|
494
|
-
open_binary: lifecycleResultOf(z.object({
|
|
495
|
-
path: z.string(),
|
|
496
|
-
format: targetFormatSchema,
|
|
497
|
-
kind: targetKindSchema,
|
|
498
|
-
loaderArgs: z.array(z.string()),
|
|
499
|
-
sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
500
|
-
architecture: z.enum(["x86", "x86_64", "arm", "arm64"]).nullable(),
|
|
501
|
-
})),
|
|
502
|
-
close_binary: lifecycleResultOf(z.union([
|
|
503
|
-
z.null(),
|
|
504
|
-
z.object({
|
|
505
|
-
path: z.string(),
|
|
506
|
-
bytes: z.number().int().min(0),
|
|
507
|
-
entries: z.number().int().min(0),
|
|
508
|
-
}),
|
|
509
|
-
])),
|
|
510
|
-
binary_session: lifecycleResultOf(z.union([
|
|
511
|
-
sessionProvider.extend({ open: z.literal(false) }),
|
|
512
|
-
sessionProvider.extend({
|
|
513
|
-
open: z.literal(true),
|
|
514
|
-
path: z.string(),
|
|
515
|
-
format: targetFormatSchema,
|
|
516
|
-
kind: targetKindSchema,
|
|
517
|
-
sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
518
|
-
architecture: z.enum(["x86", "x86_64", "arm", "arm64"]).nullable(),
|
|
519
|
-
}),
|
|
520
|
-
])),
|
|
521
|
-
export_evidence_bundle: lifecycleResultOf(z.union([
|
|
522
|
-
evidenceBundleSchema,
|
|
523
|
-
z.object({
|
|
524
|
-
path: z.string(),
|
|
525
|
-
bytes: z.number().int().min(0),
|
|
526
|
-
records: z.number().int().min(0),
|
|
527
|
-
}),
|
|
528
|
-
])),
|
|
529
|
-
import_evidence_bundle: lifecycleResultOf(z.object({
|
|
530
|
-
imported: z.number().int().min(0),
|
|
531
|
-
total: z.number().int().min(0),
|
|
532
|
-
})),
|
|
533
|
-
capture_process_scenario: resultOf(processCaptureSchema),
|
|
534
|
-
compare_process_captures: resultOf(processCaptureComparisonSchema),
|
|
535
|
-
compare_artifacts: resultOf(artifactComparisonResultSchema),
|
|
536
|
-
compare_functions: resultOf(functionComparisonResultSchema),
|
|
537
|
-
compare_bundles: resultOf(bundleComparisonResultSchema),
|
|
538
|
-
find_changed_behavior: resultOf(changedBehaviorResultSchema),
|
|
539
|
-
build_call_path: resultOf(callPathResultSchema),
|
|
540
|
-
correlate_static_and_runtime: resultOf(staticRuntimeCorrelationResultSchema),
|
|
541
|
-
verify_reconstruction: resultOf(reconstructionVerificationResultSchema),
|
|
542
|
-
list_unknowns: lifecycleResultOf(z.array(residualUnknownSchema)),
|
|
543
|
-
record_unknown: lifecycleResultOf(residualUnknownSchema),
|
|
544
|
-
update_unknown: lifecycleResultOf(residualUnknownSchema),
|
|
545
|
-
verify_unknown_resolution: lifecycleResultOf(z.object({
|
|
546
|
-
valid: z.boolean(),
|
|
547
|
-
truthVerified: z.boolean(),
|
|
548
|
-
unknown: residualUnknownSchema,
|
|
549
|
-
})),
|
|
550
|
-
};
|
|
1
|
+
export * from "./toolOutputSchemaPrimitives.js";
|
|
2
|
+
export * from "./toolOutputSchemaGroups.js";
|