rea-agents 2.2.0 → 2.3.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 +56 -9
- package/dist/application/ApplicationWorkflowEvidenceResolver.js +162 -0
- package/dist/application/BinarySession.js +9 -2
- package/dist/application/BinarySessionStatus.js +39 -1
- package/dist/application/CapabilityInventory.js +15 -0
- package/dist/application/CommandShimReplay.js +6 -3
- package/dist/application/CompositeProvider.js +5 -2
- package/dist/application/DirectAnalysis.js +1 -20
- package/dist/application/DirectAnalysisStatus.js +83 -0
- package/dist/application/Doctor.js +34 -25
- package/dist/application/DoctorDiagnostics.js +1 -4
- package/dist/application/DoctorProjection.js +43 -0
- package/dist/application/DoctorScope.js +102 -0
- package/dist/application/EvidenceReferenceResolver.js +26 -0
- package/dist/application/JavaScriptApplicationEvidence.js +1 -1
- package/dist/application/JavaScriptApplicationEvidenceGraph.js +10 -1
- package/dist/application/JavaScriptApplicationService.js +3 -2
- package/dist/application/JavaScriptApplicationWorkflowEvidence.js +26 -0
- package/dist/application/JavaScriptApplicationWorkflowService.js +49 -1
- package/dist/application/JavaScriptArtifactReconstruction.js +7 -0
- package/dist/application/JavaScriptModuleRelationships.js +25 -1
- package/dist/application/JavaScriptReturnShapeProjection.js +111 -0
- package/dist/application/JavaScriptSemanticGraphBuilder.js +294 -0
- package/dist/application/JavaScriptSemanticGraphConstruction.js +144 -0
- package/dist/application/JavaScriptSemanticGraphEvidence.js +86 -0
- package/dist/application/JavaScriptSemanticGraphFlowProjection.js +72 -0
- package/dist/application/JavaScriptSemanticGraphProjection.js +33 -0
- package/dist/application/JavaScriptSemanticTraceService.js +45 -0
- package/dist/application/LoopbackReplay.js +277 -133
- package/dist/application/LoopbackReplayRecorder.js +101 -0
- package/dist/application/PermissionAuthority.js +7 -3
- package/dist/application/ProcessCaptureJournal.js +95 -0
- package/dist/application/ProcessCaptureLifecycle.js +24 -13
- package/dist/application/ProcessCheckpoints.js +30 -4
- package/dist/application/ProcessCli.js +26 -4
- package/dist/application/ProcessHarness.js +20 -50
- package/dist/application/ProcessNormalization.js +3 -2
- package/dist/application/ProcessReactiveCoordinator.js +218 -0
- package/dist/application/ProcessReactiveEffects.js +133 -0
- package/dist/application/ProcessReactiveObservations.js +20 -0
- package/dist/application/ProcessSampling.js +2 -0
- package/dist/application/SessionProviderRouter.js +7 -6
- package/dist/application/Setup.js +11 -10
- package/dist/application/SetupPlan.js +1 -1
- package/dist/application/SetupRegistrationEnvironment.js +12 -0
- package/dist/application/TerminalRenderer.js +3 -1
- package/dist/browser/CdpEndpoint.js +37 -4
- package/dist/catalogIdentity.js +16 -7
- package/dist/cli/coreAnalysisCommands.js +34 -2
- package/dist/cli/javascriptApplicationAnalysis.js +19 -0
- package/dist/cli/setupCommands.js +81 -32
- package/dist/cli/utilityCommands.js +10 -2
- package/dist/cliApplicationCommands.js +79 -16
- package/dist/cliCommandNames.js +3 -0
- package/dist/cliElectronCommands.js +23 -33
- package/dist/cliObservationOptions.js +1 -1
- package/dist/cliOutput.js +56 -0
- package/dist/cliProcessCommands.js +32 -1
- package/dist/cliSetup.js +30 -21
- package/dist/contracts/applicationToolContracts.js +54 -7
- package/dist/contracts/applicationWorkflowInputContracts.js +119 -0
- package/dist/contracts/electronToolContracts.js +53 -32
- package/dist/contracts/javascriptApplicationWorkflowExamples.js +32 -9
- package/dist/contracts/processCaptureExample.js +1 -0
- package/dist/contracts/replayMachineExample.js +37 -0
- package/dist/contracts/toolContractExamples.js +2 -0
- package/dist/contracts/toolContracts.js +5 -1
- package/dist/contracts/toolEffects.js +3 -0
- package/dist/contracts/toolOutputSchemaGroups.js +2 -0
- package/dist/contracts/toolOutputSchemaPrimitives.js +40 -0
- package/dist/doctorRuntime.js +41 -0
- package/dist/domain/analysisErrorPresentation.js +5 -3
- package/dist/domain/analysisErrorProjection.js +7 -1
- package/dist/domain/changedBehavior.js +5 -4
- package/dist/domain/completionLedgerGeneration.js +190 -0
- package/dist/domain/errors.js +4 -2
- package/dist/domain/evidenceCompletionLedger.js +113 -0
- package/dist/domain/hopperStartupFailure.js +9 -0
- package/dist/domain/javascriptApplicationAnalysis.js +44 -2
- package/dist/domain/javascriptExportShapeComparison.js +145 -0
- package/dist/domain/javascriptExportShapeComparisonIdentity.js +11 -0
- package/dist/domain/javascriptExportShapeComparisonSchemas.js +277 -0
- package/dist/domain/javascriptExportShapeSelection.js +132 -0
- package/dist/domain/javascriptExportShapeVariants.js +272 -0
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +2 -2
- package/dist/domain/javascriptSemanticAnalysis.js +17 -36
- package/dist/domain/javascriptSemanticCallResolution.js +129 -0
- package/dist/domain/javascriptSemanticCalls.js +269 -0
- package/dist/domain/javascriptSemanticGraph.js +356 -0
- package/dist/domain/javascriptSemanticGraphSchemas.js +329 -0
- package/dist/domain/javascriptSemanticGraphSerialization.js +23 -0
- package/dist/domain/javascriptSemanticIr.js +14 -1
- package/dist/domain/javascriptSemanticPrimitives.js +36 -0
- package/dist/domain/javascriptSemanticProjection.js +36 -4
- package/dist/domain/javascriptSemanticProvenance.js +29 -0
- package/dist/domain/javascriptSemanticQuery.js +294 -0
- package/dist/domain/javascriptSemanticQueryAssessment.js +74 -0
- package/dist/domain/javascriptSemanticQueryIdentity.js +86 -0
- package/dist/domain/javascriptSemanticQueryRelations.js +15 -0
- package/dist/domain/javascriptSemanticQuerySchemas.js +188 -0
- package/dist/domain/javascriptSemanticReturns.js +187 -0
- package/dist/domain/javascriptSemanticState.js +32 -0
- package/dist/domain/javascriptSemanticTraceSchemas.js +14 -0
- package/dist/domain/javascriptSemanticValues.js +54 -70
- package/dist/domain/processCapture.js +36 -0
- package/dist/domain/processCaptureValidation.js +101 -12
- package/dist/domain/processComparison.js +78 -25
- package/dist/domain/processObservation.js +153 -0
- package/dist/domain/processReactiveCheckpointDataflow.js +32 -0
- package/dist/domain/processReactiveMatching.js +210 -0
- package/dist/domain/processReactiveRuntime.js +109 -0
- package/dist/domain/processReactiveScenario.js +361 -0
- package/dist/domain/processReactiveScenarioPreflight.js +120 -0
- package/dist/domain/processReactiveTransition.js +159 -0
- package/dist/domain/processScenario.js +12 -0
- package/dist/domain/processTraceComparison.js +43 -0
- package/dist/domain/processTraceDimensionProjection.js +50 -0
- package/dist/domain/processTraceEvaluation.js +312 -0
- package/dist/domain/processTraceSpecification.js +373 -0
- package/dist/domain/reconstructionVerification.js +5 -4
- package/dist/domain/replayMachine.js +18 -2
- package/dist/domain/replayMachineRun.js +216 -0
- package/dist/domain/replayMachineRuntime.js +88 -9
- package/dist/domain/staticRuntimeCorrelation.js +4 -2
- package/dist/evaluation/CodexAgentEval.js +24 -0
- package/dist/generatedPackageMetadata.js +1 -1
- package/dist/ghidra/GhidraClient.js +13 -2
- package/dist/ghidra/GhidraDiagnostics.js +1 -0
- package/dist/ghidra/GhidraLauncher.js +7 -3
- package/dist/ghidra/GhidraProvider.js +8 -1
- package/dist/hopper/BridgeLauncher.js +56 -14
- package/dist/hopper/HopperClient.js +23 -10
- package/dist/hopper/HopperDiagnostics.js +14 -0
- package/dist/hopper/HopperProcessDiagnostic.js +14 -0
- package/dist/hopper/HopperProvider.js +8 -1
- package/dist/hopper/LinuxPrivateDisplayDiagnostic.js +72 -0
- package/dist/hopper/LinuxPrivateDisplayProbe.js +217 -0
- package/dist/main/transport.js +2 -0
- package/dist/mcpDoctor.js +310 -0
- package/dist/process/ProcessOwnership.js +200 -53
- package/dist/process/ProviderRunLineage.js +21 -0
- package/dist/server/createServer.js +4 -1
- package/dist/server/javascriptApplicationResult.js +22 -1
- package/dist/server/registerApplicationTools/characterization.js +3 -3
- package/dist/server/registerApplicationTools/compareExportShapes.js +37 -0
- package/dist/server/registerApplicationTools/compareVersions.js +12 -6
- package/dist/server/registerApplicationTools/controlledReplay.js +2 -2
- package/dist/server/registerApplicationTools/coverage.js +3 -3
- package/dist/server/registerApplicationTools/helpers.js +37 -25
- package/dist/server/registerApplicationTools/traceFeature.js +9 -5
- package/dist/server/registerApplicationTools/traceSemantics.js +30 -0
- package/dist/server/registerApplicationTools.js +4 -0
- package/dist/server/registerEvidenceResources.js +5 -1
- package/dist/server/registerProcessComparisonTool.js +17 -7
- package/dist/server/registerReplayMachineTool.js +20 -0
- package/dist/server/registerSessionTools.js +12 -7
- package/dist/server/sessionAvailabilityPolicy.js +2 -1
- package/dist/serverIdentity.js +19 -0
- package/package.json +62 -30
- package/scripts/hopper-demo-x11.py +459 -61
- package/scripts/prepack.mjs +55 -0
- package/scripts/prepare.mjs +28 -0
- package/scripts/rea.mjs +26 -5
- package/skills/reverse-engineer-anything/SKILL.md +2 -2
- package/skills/reverse-engineer-anything/references/javascript-applications.md +10 -0
|
@@ -46,7 +46,7 @@ export const summarizeJavaScriptApplicationEvidence = (evidence) => {
|
|
|
46
46
|
location: observation.evidence.location,
|
|
47
47
|
};
|
|
48
48
|
});
|
|
49
|
-
const
|
|
49
|
+
const summary = result.schema_version === 1 ? omitGraph(result) : omitGraphs(result);
|
|
50
50
|
const unknowns = new Set([
|
|
51
51
|
...result.limitations,
|
|
52
52
|
...result.graph.limitations,
|
|
@@ -59,6 +59,19 @@ export const summarizeJavaScriptApplicationEvidence = (evidence) => {
|
|
|
59
59
|
unknowns.add(`Application graph coverage is ${result.graph.coverage.status}; omitted facts remain unknown.`);
|
|
60
60
|
return javascriptApplicationAnalysisSummarySchema.parse({
|
|
61
61
|
...summary,
|
|
62
|
+
...(result.schema_version === 1
|
|
63
|
+
? {}
|
|
64
|
+
: {
|
|
65
|
+
semantic_graph: {
|
|
66
|
+
graph_id: result.semantic_graph.graph_id,
|
|
67
|
+
nodes: result.semantic_graph.nodes.length,
|
|
68
|
+
relations: result.semantic_graph.relations.length,
|
|
69
|
+
unknown_frontiers: result.semantic_graph.unknowns.length,
|
|
70
|
+
fingerprints: result.semantic_graph.fingerprints.length,
|
|
71
|
+
coverage: result.semantic_graph.coverage.status,
|
|
72
|
+
query_tool: "trace_javascript_semantics",
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
62
75
|
unknowns: [...unknowns],
|
|
63
76
|
graph: {
|
|
64
77
|
graph_id: result.graph.graph_id,
|
|
@@ -83,3 +96,11 @@ export const summarizeJavaScriptApplicationEvidence = (evidence) => {
|
|
|
83
96
|
},
|
|
84
97
|
});
|
|
85
98
|
};
|
|
99
|
+
const omitGraph = (result) => {
|
|
100
|
+
const { graph: _graph, ...summary } = result;
|
|
101
|
+
return summary;
|
|
102
|
+
};
|
|
103
|
+
const omitGraphs = (result) => {
|
|
104
|
+
const { graph: _graph, semantic_graph: _semanticGraph, ...summary } = result;
|
|
105
|
+
return summary;
|
|
106
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { executeNodeCharacterization, prepareNodeCharacterization, } from "../../application/NodeRuntimeCharacterizationService.js";
|
|
2
|
-
import {
|
|
2
|
+
import { applicationToolContract } from "../../contracts/applicationToolContracts.js";
|
|
3
3
|
import { nodeCharacterizationExecutionInputSchema, nodeCharacterizationExecutionOutputSchema, nodeCharacterizationPreparationInputSchema, nodeCharacterizationPreparationOutputSchema, } from "../../domain/nodeRuntimeCharacterization.js";
|
|
4
4
|
import { parseEvidence } from "../../domain/evidence.js";
|
|
5
5
|
import { logToolExecution } from "../toolLogging.js";
|
|
@@ -8,8 +8,8 @@ import { toolRegistrationOptions } from "../toolRegistrationOptions.js";
|
|
|
8
8
|
import { safeParseToolInput } from "../toolInputValidation.js";
|
|
9
9
|
import { mcpProgressReporter } from "../mcpProgress.js";
|
|
10
10
|
import { recordSources } from "./helpers.js";
|
|
11
|
-
const prepareContract =
|
|
12
|
-
const executeContract =
|
|
11
|
+
const prepareContract = applicationToolContract("prepare_node_characterization");
|
|
12
|
+
const executeContract = applicationToolContract("execute_node_characterization");
|
|
13
13
|
/** Register node runtime characterization prepare and execute tools. */
|
|
14
14
|
export const registerCharacterizationTools = (server, options) => {
|
|
15
15
|
server.registerTool(prepareContract.name, toolRegistrationOptions(prepareContract), async (input, context) => {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { resolveCompareJavaScriptExportShapesRequestValidated } from "../../application/ApplicationWorkflowEvidenceResolver.js";
|
|
2
|
+
import { compareJavaScriptExportShapesEvidenceValidated } from "../../application/JavaScriptApplicationWorkflowService.js";
|
|
3
|
+
import { applicationToolContract } from "../../contracts/applicationToolContracts.js";
|
|
4
|
+
import { compareJavaScriptExportShapesRequestSchema } from "../../contracts/applicationWorkflowInputContracts.js";
|
|
5
|
+
import { javaScriptExportShapeComparisonResultSchema } from "../../domain/javascriptExportShapeComparisonSchemas.js";
|
|
6
|
+
import { safeParseToolInput } from "../toolInputValidation.js";
|
|
7
|
+
import { logToolExecution } from "../toolLogging.js";
|
|
8
|
+
import { toCallToolResult } from "../toolResult.js";
|
|
9
|
+
import { toolRegistrationOptions } from "../toolRegistrationOptions.js";
|
|
10
|
+
import { recordResult, recordSources } from "./helpers.js";
|
|
11
|
+
const contract = applicationToolContract("compare_javascript_export_shapes");
|
|
12
|
+
/** Register the execution-free exact JavaScript export-shape comparison. */
|
|
13
|
+
export const registerCompareJavaScriptExportShapesTool = (server, options) => {
|
|
14
|
+
server.registerTool(contract.name, toolRegistrationOptions(contract), async (input) => {
|
|
15
|
+
const parsedInput = safeParseToolInput(compareJavaScriptExportShapesRequestSchema, input, contract.name);
|
|
16
|
+
if (!parsedInput.ok)
|
|
17
|
+
return toCallToolResult(parsedInput, contract);
|
|
18
|
+
const resolved = resolveCompareJavaScriptExportShapesRequestValidated(parsedInput.value, options.evidenceLookup);
|
|
19
|
+
if (!resolved.ok)
|
|
20
|
+
return toCallToolResult(resolved, contract);
|
|
21
|
+
const parsed = resolved.value;
|
|
22
|
+
const result = await logToolExecution(options.logger, contract.name, () => Promise.resolve(compareJavaScriptExportShapesEvidenceValidated(parsed)));
|
|
23
|
+
if (!result.ok)
|
|
24
|
+
return toCallToolResult(result, contract);
|
|
25
|
+
const recorded = recordSources(options.recordEvidence, [
|
|
26
|
+
parsed.left,
|
|
27
|
+
parsed.right,
|
|
28
|
+
]);
|
|
29
|
+
if (!recorded.ok)
|
|
30
|
+
return toCallToolResult(recorded, contract);
|
|
31
|
+
const comparison = javaScriptExportShapeComparisonResultSchema.parse(result.value.normalized_result);
|
|
32
|
+
const unknown = comparison.summary.unknown > 0;
|
|
33
|
+
return recordResult(options, contract, result.value, parsed.unknown_registry_approved === true && unknown
|
|
34
|
+
? "javascript-export-shape"
|
|
35
|
+
: undefined);
|
|
36
|
+
});
|
|
37
|
+
};
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { compareApplicationVersionsEvidenceValidated } from "../../application/JavaScriptApplicationWorkflowService.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { resolveCompareApplicationVersionsRequestValidated } from "../../application/ApplicationWorkflowEvidenceResolver.js";
|
|
3
|
+
import { applicationToolContract } from "../../contracts/applicationToolContracts.js";
|
|
4
|
+
import { compareApplicationVersionsRequestSchema } from "../../contracts/applicationWorkflowInputContracts.js";
|
|
4
5
|
import { applicationVersionComparisonResultSchema } from "../../domain/javascriptApplicationVersionComparisonSchemas.js";
|
|
5
6
|
import { logToolExecution } from "../toolLogging.js";
|
|
6
7
|
import { toCallToolResult } from "../toolResult.js";
|
|
7
8
|
import { toolRegistrationOptions } from "../toolRegistrationOptions.js";
|
|
8
9
|
import { safeParseToolInput } from "../toolInputValidation.js";
|
|
9
10
|
import { recordResult, recordSources } from "./helpers.js";
|
|
10
|
-
const compareContract =
|
|
11
|
+
const compareContract = applicationToolContract("compare_application_versions");
|
|
11
12
|
/** Register the provider-neutral JavaScript version comparison tool. */
|
|
12
13
|
export const registerCompareApplicationVersionsTool = (server, options) => {
|
|
13
14
|
server.registerTool(compareContract.name, toolRegistrationOptions(compareContract), async (input) => {
|
|
14
|
-
const parsedInput = safeParseToolInput(
|
|
15
|
+
const parsedInput = safeParseToolInput(compareApplicationVersionsRequestSchema, input, compareContract.name);
|
|
15
16
|
if (!parsedInput.ok)
|
|
16
17
|
return toCallToolResult(parsedInput, compareContract);
|
|
17
|
-
const
|
|
18
|
+
const resolved = resolveCompareApplicationVersionsRequestValidated(parsedInput.value, options.evidenceLookup);
|
|
19
|
+
if (!resolved.ok)
|
|
20
|
+
return toCallToolResult(resolved, compareContract);
|
|
21
|
+
const parsed = resolved.value;
|
|
18
22
|
const result = await logToolExecution(options.logger, compareContract.name, () => Promise.resolve(compareApplicationVersionsEvidenceValidated(parsed)));
|
|
19
23
|
if (!result.ok)
|
|
20
24
|
return toCallToolResult(result, compareContract);
|
|
@@ -29,6 +33,8 @@ export const registerCompareApplicationVersionsTool = (server, options) => {
|
|
|
29
33
|
return toCallToolResult(recorded, compareContract);
|
|
30
34
|
const comparison = applicationVersionComparisonResultSchema.parse(result.value.normalized_result);
|
|
31
35
|
const unknown = comparison.summary.unknown > 0;
|
|
32
|
-
return recordResult(options, compareContract, result.value, parsed.unknown_registry_approved === true && unknown
|
|
36
|
+
return recordResult(options, compareContract, result.value, parsed.unknown_registry_approved === true && unknown
|
|
37
|
+
? "application-version-comparison"
|
|
38
|
+
: undefined);
|
|
33
39
|
});
|
|
34
40
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { runControlledReplayValidated } from "../../application/JavaScriptReplayService.js";
|
|
2
|
-
import {
|
|
2
|
+
import { applicationToolContract } from "../../contracts/applicationToolContracts.js";
|
|
3
3
|
import { controlledReplayInputSchema, controlledReplayOutputSchema, } from "../../domain/javascriptReplay.js";
|
|
4
4
|
import { parseEvidence } from "../../domain/evidence.js";
|
|
5
5
|
import { logToolExecution } from "../toolLogging.js";
|
|
@@ -8,7 +8,7 @@ import { toolRegistrationOptions } from "../toolRegistrationOptions.js";
|
|
|
8
8
|
import { safeParseToolInput } from "../toolInputValidation.js";
|
|
9
9
|
import { mcpProgressReporter } from "../mcpProgress.js";
|
|
10
10
|
import { recordSources } from "./helpers.js";
|
|
11
|
-
const replayContract =
|
|
11
|
+
const replayContract = applicationToolContract("run_controlled_replay");
|
|
12
12
|
/** Register the controlled JavaScript replay tool. */
|
|
13
13
|
export const registerControlledReplayTool = (server, options) => {
|
|
14
14
|
server.registerTool(replayContract.name, toolRegistrationOptions(replayContract), async (input, context) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { commitReconstructionCoverage, queryReconstructionCoverage, } from "../../application/ReconstructionCoverageService.js";
|
|
2
2
|
import { readReconstructionCoverageWorkspace } from "../../application/ReconstructionCoverageWorkspaceStore.js";
|
|
3
3
|
import { authorizeFileReadWithDeferredWrite, authorizeRootPermission, } from "../../application/DeferredFileAuthorization.js";
|
|
4
|
-
import {
|
|
4
|
+
import { applicationToolContract } from "../../contracts/applicationToolContracts.js";
|
|
5
5
|
import { reconstructionCoverageCommitInputSchema, reconstructionCoverageQueryInputSchema, } from "../../application/ReconstructionCoverageService.js";
|
|
6
6
|
import { reconstructionClosureResultSchema } from "../../domain/reconstructionCoverage.js";
|
|
7
7
|
import { AnalysisCapabilityUnavailableError, EvidenceIntegrityError, } from "../../domain/errors.js";
|
|
@@ -11,8 +11,8 @@ import { toCallToolResult } from "../toolResult.js";
|
|
|
11
11
|
import { toolRegistrationOptions } from "../toolRegistrationOptions.js";
|
|
12
12
|
import { safeParseToolInput } from "../toolInputValidation.js";
|
|
13
13
|
import { coverageWorkspaceUri } from "./helpers.js";
|
|
14
|
-
const commitContract =
|
|
15
|
-
const queryContract =
|
|
14
|
+
const commitContract = applicationToolContract("commit_reconstruction_coverage");
|
|
15
|
+
const queryContract = applicationToolContract("query_reconstruction_coverage");
|
|
16
16
|
/** Register reconstruction coverage commit and query tools. */
|
|
17
17
|
export const registerCoverageTools = (server, options) => {
|
|
18
18
|
registerCommitTool(server, options);
|
|
@@ -9,34 +9,46 @@ export const recordSources = (recordEvidence, sources) => {
|
|
|
9
9
|
}
|
|
10
10
|
return { ok: true, value: null };
|
|
11
11
|
};
|
|
12
|
-
export const recordResult = (options, contract, evidence,
|
|
13
|
-
const recorded =
|
|
14
|
-
? options.
|
|
15
|
-
|
|
16
|
-
question: "Which application entities remain unmatched or ambiguous across these versions?",
|
|
17
|
-
severity: "medium",
|
|
18
|
-
domain: "application-version-comparison",
|
|
19
|
-
supporting_evidence_ids: [evidence.evidence_id],
|
|
20
|
-
contradicting_evidence_ids: [],
|
|
21
|
-
required_authority: "shipped-artifact",
|
|
22
|
-
required_confidence: "observed",
|
|
23
|
-
required_environment: null,
|
|
24
|
-
recommended_probes: [
|
|
25
|
-
{
|
|
26
|
-
operation: "analyze_javascript_application",
|
|
27
|
-
rationale: "Repeat static reconstruction with complete artifacts and source maps when available.",
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
operation: "reconcile_javascript_runtime",
|
|
31
|
-
rationale: "Add approved passive runtime Evidence without promoting it to static fact.",
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
relationships: [],
|
|
35
|
-
})
|
|
36
|
-
: options.recordEvidence?.(evidence);
|
|
12
|
+
export const recordResult = (options, contract, evidence, unknownKind) => {
|
|
13
|
+
const recorded = unknownKind === undefined
|
|
14
|
+
? options.recordEvidence?.(evidence)
|
|
15
|
+
: options.recordEvidenceWithUnknown?.(evidence, unknownRegistration(evidence, unknownKind));
|
|
37
16
|
if (recorded !== undefined && !recorded.ok)
|
|
38
17
|
return toCallToolResult(recorded, contract);
|
|
39
18
|
return toCallToolResult({ ok: true, value: evidence }, contract, {
|
|
40
19
|
evidenceResourcesAvailable: recorded !== undefined,
|
|
41
20
|
});
|
|
42
21
|
};
|
|
22
|
+
const unknownRegistration = (evidence, kind) => ({
|
|
23
|
+
approved: true,
|
|
24
|
+
question: kind === "application-version-comparison"
|
|
25
|
+
? "Which application entities remain unmatched or ambiguous across these versions?"
|
|
26
|
+
: "Which selected JavaScript export return shapes remain dynamic, incomplete, or ambiguously paired?",
|
|
27
|
+
severity: "medium",
|
|
28
|
+
domain: kind,
|
|
29
|
+
supporting_evidence_ids: [evidence.evidence_id],
|
|
30
|
+
contradicting_evidence_ids: [],
|
|
31
|
+
required_authority: "shipped-artifact",
|
|
32
|
+
required_confidence: "observed",
|
|
33
|
+
required_environment: null,
|
|
34
|
+
recommended_probes: [
|
|
35
|
+
{
|
|
36
|
+
operation: "analyze_javascript_application",
|
|
37
|
+
rationale: "Repeat static reconstruction with complete artifacts and source maps when available.",
|
|
38
|
+
},
|
|
39
|
+
...(kind === "application-version-comparison"
|
|
40
|
+
? [
|
|
41
|
+
{
|
|
42
|
+
operation: "reconcile_javascript_runtime",
|
|
43
|
+
rationale: "Add approved passive runtime Evidence without promoting it to static fact.",
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
: [
|
|
47
|
+
{
|
|
48
|
+
operation: "run_controlled_replay",
|
|
49
|
+
rationale: "Validate exact approved module behavior separately when runtime semantics are required.",
|
|
50
|
+
},
|
|
51
|
+
]),
|
|
52
|
+
],
|
|
53
|
+
relationships: [],
|
|
54
|
+
});
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { traceApplicationFeatureEvidenceValidated } from "../../application/JavaScriptApplicationWorkflowService.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { resolveTraceApplicationFeatureRequestValidated } from "../../application/ApplicationWorkflowEvidenceResolver.js";
|
|
3
|
+
import { applicationToolContract } from "../../contracts/applicationToolContracts.js";
|
|
4
|
+
import { traceApplicationFeatureRequestSchema } from "../../contracts/applicationWorkflowInputContracts.js";
|
|
4
5
|
import { logToolExecution } from "../toolLogging.js";
|
|
5
6
|
import { toCallToolResult } from "../toolResult.js";
|
|
6
7
|
import { toolRegistrationOptions } from "../toolRegistrationOptions.js";
|
|
7
8
|
import { safeParseToolInput } from "../toolInputValidation.js";
|
|
8
9
|
import { recordResult, recordSources } from "./helpers.js";
|
|
9
|
-
const traceContract =
|
|
10
|
+
const traceContract = applicationToolContract("trace_application_feature");
|
|
10
11
|
/** Register the provider-neutral JavaScript feature trace tool. */
|
|
11
12
|
export const registerTraceFeatureTool = (server, options) => {
|
|
12
13
|
server.registerTool(traceContract.name, toolRegistrationOptions(traceContract), async (input) => {
|
|
13
|
-
const parsedInput = safeParseToolInput(
|
|
14
|
+
const parsedInput = safeParseToolInput(traceApplicationFeatureRequestSchema, input, traceContract.name);
|
|
14
15
|
if (!parsedInput.ok)
|
|
15
16
|
return toCallToolResult(parsedInput, traceContract);
|
|
16
|
-
const
|
|
17
|
+
const resolved = resolveTraceApplicationFeatureRequestValidated(parsedInput.value, options.evidenceLookup);
|
|
18
|
+
if (!resolved.ok)
|
|
19
|
+
return toCallToolResult(resolved, traceContract);
|
|
20
|
+
const parsed = resolved.value;
|
|
17
21
|
const result = await logToolExecution(options.logger, traceContract.name, () => Promise.resolve(traceApplicationFeatureEvidenceValidated(parsed)));
|
|
18
22
|
if (!result.ok)
|
|
19
23
|
return toCallToolResult(result, traceContract);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { resolveTraceJavaScriptSemanticsRequestValidated } from "../../application/ApplicationWorkflowEvidenceResolver.js";
|
|
2
|
+
import { traceJavaScriptSemanticsEvidenceValidated } from "../../application/JavaScriptSemanticTraceService.js";
|
|
3
|
+
import { applicationToolContract } from "../../contracts/applicationToolContracts.js";
|
|
4
|
+
import { traceJavaScriptSemanticsRequestSchema } from "../../contracts/applicationWorkflowInputContracts.js";
|
|
5
|
+
import { safeParseToolInput } from "../toolInputValidation.js";
|
|
6
|
+
import { logToolExecution } from "../toolLogging.js";
|
|
7
|
+
import { toolRegistrationOptions } from "../toolRegistrationOptions.js";
|
|
8
|
+
import { toCallToolResult } from "../toolResult.js";
|
|
9
|
+
import { recordResult, recordSources } from "./helpers.js";
|
|
10
|
+
const contract = applicationToolContract("trace_javascript_semantics");
|
|
11
|
+
/** Register the bounded JavaScript semantic relation trace tool. */
|
|
12
|
+
export const registerTraceJavaScriptSemanticsTool = (server, options) => {
|
|
13
|
+
server.registerTool(contract.name, toolRegistrationOptions(contract), async (input) => {
|
|
14
|
+
const parsedInput = safeParseToolInput(traceJavaScriptSemanticsRequestSchema, input, contract.name);
|
|
15
|
+
if (!parsedInput.ok)
|
|
16
|
+
return toCallToolResult(parsedInput, contract);
|
|
17
|
+
const resolved = resolveTraceJavaScriptSemanticsRequestValidated(parsedInput.value, options.evidenceLookup);
|
|
18
|
+
if (!resolved.ok)
|
|
19
|
+
return toCallToolResult(resolved, contract);
|
|
20
|
+
const result = await logToolExecution(options.logger, contract.name, () => Promise.resolve(traceJavaScriptSemanticsEvidenceValidated(resolved.value)));
|
|
21
|
+
if (!result.ok)
|
|
22
|
+
return toCallToolResult(result, contract);
|
|
23
|
+
const recorded = recordSources(options.recordEvidence, [
|
|
24
|
+
resolved.value.application,
|
|
25
|
+
]);
|
|
26
|
+
if (!recorded.ok)
|
|
27
|
+
return toCallToolResult(recorded, contract);
|
|
28
|
+
return recordResult(options, contract, result.value);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { registerTraceFeatureTool } from "./registerApplicationTools/traceFeature.js";
|
|
2
|
+
import { registerTraceJavaScriptSemanticsTool } from "./registerApplicationTools/traceSemantics.js";
|
|
2
3
|
import { registerCompareApplicationVersionsTool } from "./registerApplicationTools/compareVersions.js";
|
|
4
|
+
import { registerCompareJavaScriptExportShapesTool } from "./registerApplicationTools/compareExportShapes.js";
|
|
3
5
|
import { registerControlledReplayTool } from "./registerApplicationTools/controlledReplay.js";
|
|
4
6
|
import { registerCharacterizationTools } from "./registerApplicationTools/characterization.js";
|
|
5
7
|
import { registerCoverageTools } from "./registerApplicationTools/coverage.js";
|
|
6
8
|
/** Register provider-neutral JavaScript application graph workflows. */
|
|
7
9
|
export const registerApplicationTools = (server, options) => {
|
|
8
10
|
registerTraceFeatureTool(server, options);
|
|
11
|
+
registerTraceJavaScriptSemanticsTool(server, options);
|
|
9
12
|
registerCompareApplicationVersionsTool(server, options);
|
|
13
|
+
registerCompareJavaScriptExportShapesTool(server, options);
|
|
10
14
|
registerControlledReplayTool(server, options);
|
|
11
15
|
registerCharacterizationTools(server, options);
|
|
12
16
|
registerCoverageTools(server, options);
|
|
@@ -317,7 +317,11 @@ const evidenceSection = (result, section) => {
|
|
|
317
317
|
if (section === "process")
|
|
318
318
|
return pick(result, ["process_samples", "exit", "settlement", "cleanup"]);
|
|
319
319
|
if (section === "protocol")
|
|
320
|
-
return pick(result, [
|
|
320
|
+
return pick(result, [
|
|
321
|
+
"protocol_events",
|
|
322
|
+
"replay_transitions",
|
|
323
|
+
"shim_events",
|
|
324
|
+
]);
|
|
321
325
|
const value = result[section];
|
|
322
326
|
return value === undefined ? undefined : value;
|
|
323
327
|
};
|
|
@@ -11,6 +11,11 @@ import { toolRegistrationOptions } from "./toolRegistrationOptions.js";
|
|
|
11
11
|
import { runDerivedOperation } from "./runDerivedOperation.js";
|
|
12
12
|
import { safeParseToolInput } from "./toolInputValidation.js";
|
|
13
13
|
import { resolveSessionEvidenceIds } from "./sessionEvidence.js";
|
|
14
|
+
const PROCESS_CAPTURE_EVIDENCE = {
|
|
15
|
+
operation: "capture_process_scenario",
|
|
16
|
+
predicate: "rea.process-capture/v4",
|
|
17
|
+
};
|
|
18
|
+
const sourceLocations = (left, right) => [...(left ?? []), ...(right ?? [])];
|
|
14
19
|
/** Register deterministic process-capture comparison and contradiction tracking. */
|
|
15
20
|
export const registerProcessComparisonTool = (server, session, contract, now = Date.now) => {
|
|
16
21
|
server.registerTool(contract.name, toolRegistrationOptions(contract), async (input, context) => {
|
|
@@ -18,14 +23,10 @@ export const registerProcessComparisonTool = (server, session, contract, now = D
|
|
|
18
23
|
if (!parsedInput.ok)
|
|
19
24
|
return toCallToolResult(parsedInput, contract);
|
|
20
25
|
const parsed = parsedInput.value;
|
|
21
|
-
const
|
|
22
|
-
operation: "capture_process_scenario",
|
|
23
|
-
predicate: "rea.process-capture/v4",
|
|
24
|
-
};
|
|
25
|
-
const leftRecord = resolveSessionEvidenceIds(session, [parsed.left_evidence_id], expected);
|
|
26
|
+
const leftRecord = resolveSessionEvidenceIds(session, [parsed.left_evidence_id], PROCESS_CAPTURE_EVIDENCE);
|
|
26
27
|
if (!leftRecord.ok)
|
|
27
28
|
return toCallToolResult(leftRecord, contract);
|
|
28
|
-
const rightRecord = resolveSessionEvidenceIds(session, [parsed.right_evidence_id],
|
|
29
|
+
const rightRecord = resolveSessionEvidenceIds(session, [parsed.right_evidence_id], PROCESS_CAPTURE_EVIDENCE);
|
|
29
30
|
if (!rightRecord.ok)
|
|
30
31
|
return toCallToolResult(rightRecord, contract);
|
|
31
32
|
let comparison;
|
|
@@ -38,6 +39,9 @@ export const registerProcessComparisonTool = (server, session, contract, now = D
|
|
|
38
39
|
...(parsed.max_capture_age_ms === undefined
|
|
39
40
|
? {}
|
|
40
41
|
: { maxCaptureAgeMs: parsed.max_capture_age_ms }),
|
|
42
|
+
...(parsed.trace_spec === undefined
|
|
43
|
+
? {}
|
|
44
|
+
: { traceSpecification: parsed.trace_spec }),
|
|
41
45
|
now,
|
|
42
46
|
}));
|
|
43
47
|
if (!computed.ok)
|
|
@@ -50,18 +54,24 @@ export const registerProcessComparisonTool = (server, session, contract, now = D
|
|
|
50
54
|
: "Invalid Process Capture v4")), contract);
|
|
51
55
|
}
|
|
52
56
|
const evidence = createEvidence(undefined, PROCESS_PROVIDER, {
|
|
53
|
-
predicateType:
|
|
57
|
+
predicateType: parsed.trace_spec === undefined
|
|
58
|
+
? "rea.process-comparison/v3"
|
|
59
|
+
: "rea.process-comparison/v4",
|
|
54
60
|
operation: contract.name,
|
|
55
61
|
parameters: {
|
|
56
62
|
left_evidence_id: parsed.left_evidence_id,
|
|
57
63
|
right_evidence_id: parsed.right_evidence_id,
|
|
58
64
|
left_normalization: leftCapture.normalization,
|
|
59
65
|
right_normalization: rightCapture.normalization,
|
|
66
|
+
...(parsed.trace_spec === undefined
|
|
67
|
+
? {}
|
|
68
|
+
: { trace_spec: jsonValueSchema.parse(parsed.trace_spec) }),
|
|
60
69
|
},
|
|
61
70
|
result: jsonValueSchema.parse(comparison),
|
|
62
71
|
confidence: "derived",
|
|
63
72
|
authority: "analyst-inference",
|
|
64
73
|
limitations: comparison.limitations,
|
|
74
|
+
locations: sourceLocations(leftRecord.value[0]?.locations, rightRecord.value[0]?.locations),
|
|
65
75
|
evidenceLinks: [parsed.left_evidence_id, parsed.right_evidence_id],
|
|
66
76
|
});
|
|
67
77
|
return toCallToolResult(recordDerivedEvidence(session, evidence, comparisonUnknownInput(parsed, comparison)), contract);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SESSION_TOOL_CONTRACTS } from "../contracts/toolContracts.js";
|
|
2
|
+
import { replayMachineRunInputSchema, runReplayMachine, } from "../domain/replayMachineRun.js";
|
|
3
|
+
import { ok } from "../domain/result.js";
|
|
4
|
+
import { safeParseToolInput } from "./toolInputValidation.js";
|
|
5
|
+
import { logToolExecution } from "./toolLogging.js";
|
|
6
|
+
import { toCallToolResult } from "./toolResult.js";
|
|
7
|
+
import { toolRegistrationOptions } from "./toolRegistrationOptions.js";
|
|
8
|
+
const contract = SESSION_TOOL_CONTRACTS.find(({ name }) => name === "run_replay_machine");
|
|
9
|
+
if (contract === undefined)
|
|
10
|
+
throw new TypeError("Missing run_replay_machine tool contract");
|
|
11
|
+
/** Register direct execution-free finite replay-machine evaluation. */
|
|
12
|
+
export const registerReplayMachineTool = (server, logger) => {
|
|
13
|
+
server.registerTool(contract.name, toolRegistrationOptions(contract), async (input) => {
|
|
14
|
+
const parsed = safeParseToolInput(replayMachineRunInputSchema, input, contract.name);
|
|
15
|
+
if (!parsed.ok)
|
|
16
|
+
return toCallToolResult(parsed, contract);
|
|
17
|
+
const result = await logToolExecution(logger, contract.name, () => Promise.resolve(ok(runReplayMachine(parsed.value))));
|
|
18
|
+
return toCallToolResult(result, contract);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -23,7 +23,8 @@ import { mcpProgressReporter } from "./mcpProgress.js";
|
|
|
23
23
|
import { authorizeProcessCaptureWithElicitation, } from "./ProcessCaptureElicitation.js";
|
|
24
24
|
import { isInputRequiredResult } from "@modelcontextprotocol/server";
|
|
25
25
|
import { registerEvidenceTools, registerUnknownTools, } from "./registerSessionRecordTools.js";
|
|
26
|
-
import {
|
|
26
|
+
import { registerReplayMachineTool } from "./registerReplayMachineTool.js";
|
|
27
|
+
import { sessionAvailabilityPolicy, } from "./sessionAvailabilityPolicy.js";
|
|
27
28
|
const permissionFailure = (failure) => {
|
|
28
29
|
if (failure.ok)
|
|
29
30
|
return err(new AnalysisProtocolError("Expected a denied permission"));
|
|
@@ -212,6 +213,14 @@ const registerCloseLifecycleTool = ({ server, session, logger, contracts: [, clo
|
|
|
212
213
|
: toCallToolResult(closed, closeContract);
|
|
213
214
|
});
|
|
214
215
|
};
|
|
216
|
+
const registerRecordAndReplayTools = (server, session, logger) => {
|
|
217
|
+
registerUnknownTools({
|
|
218
|
+
server,
|
|
219
|
+
session,
|
|
220
|
+
contracts: SESSION_TOOL_CONTRACTS,
|
|
221
|
+
});
|
|
222
|
+
registerReplayMachineTool(server, logger);
|
|
223
|
+
};
|
|
215
224
|
export const registerSessionTools = (server, session, logger, options = {}) => {
|
|
216
225
|
const processPolicy = options.processPolicy ?? DENY_PROCESS_POLICY;
|
|
217
226
|
const evidenceFilePolicy = options.evidenceFilePolicy ?? DENY_EVIDENCE_FILE_POLICY;
|
|
@@ -224,7 +233,7 @@ export const registerSessionTools = (server, session, logger, options = {}) => {
|
|
|
224
233
|
contracts: [openContract, closeContract, statusContract],
|
|
225
234
|
snapshotFilePolicy: analysisSnapshotFilePolicy,
|
|
226
235
|
startedAt: options.startedAt ?? new Date().toISOString(),
|
|
227
|
-
availabilityPolicy: sessionAvailabilityPolicy(options.availabilityPolicy, processPolicy, evidenceFilePolicy),
|
|
236
|
+
availabilityPolicy: sessionAvailabilityPolicy(options.availabilityPolicy, processPolicy, evidenceFilePolicy, options.investigationInputRoots ?? []),
|
|
228
237
|
...(options.permissionAuthority === undefined
|
|
229
238
|
? {}
|
|
230
239
|
: { permissionAuthority: options.permissionAuthority }),
|
|
@@ -274,9 +283,5 @@ export const registerSessionTools = (server, session, logger, options = {}) => {
|
|
|
274
283
|
? {}
|
|
275
284
|
: { permissionAuthority: options.permissionAuthority }),
|
|
276
285
|
});
|
|
277
|
-
|
|
278
|
-
server,
|
|
279
|
-
session,
|
|
280
|
-
contracts: SESSION_TOOL_CONTRACTS,
|
|
281
|
-
});
|
|
286
|
+
registerRecordAndReplayTools(server, session, logger);
|
|
282
287
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/** Select configured availability reporting or the target-free defaults. */
|
|
2
|
-
export const sessionAvailabilityPolicy = (configured, processPolicy, evidenceFilePolicy) => configured ??
|
|
2
|
+
export const sessionAvailabilityPolicy = (configured, processPolicy, evidenceFilePolicy, investigationInputRoots) => configured ??
|
|
3
3
|
(() => ({
|
|
4
4
|
processCaptureEnabled: processPolicy.enabled,
|
|
5
5
|
evidenceFileRoots: evidenceFilePolicy.roots.length,
|
|
6
|
+
investigationInputRoots: investigationInputRoots.length,
|
|
6
7
|
browserObservationEnabled: false,
|
|
7
8
|
electronObservationEnabled: false,
|
|
8
9
|
javascriptReplayEnabled: false,
|
package/dist/serverIdentity.js
CHANGED
|
@@ -68,3 +68,22 @@ export const createServerIdentity = (input) => {
|
|
|
68
68
|
},
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
|
+
/** Compact identity projection for CLI summaries; MCP retains full identity. */
|
|
72
|
+
export const createServerIdentitySummary = (input) => {
|
|
73
|
+
const identity = createServerIdentity(input);
|
|
74
|
+
return {
|
|
75
|
+
package: {
|
|
76
|
+
name: identity.package.name,
|
|
77
|
+
version: identity.package.version,
|
|
78
|
+
},
|
|
79
|
+
server: {
|
|
80
|
+
name: identity.server.name,
|
|
81
|
+
version: identity.server.version,
|
|
82
|
+
},
|
|
83
|
+
catalog: {
|
|
84
|
+
counts: identity.catalog.counts,
|
|
85
|
+
digests: identity.catalog.digests,
|
|
86
|
+
},
|
|
87
|
+
alignment: identity.alignment,
|
|
88
|
+
};
|
|
89
|
+
};
|