rea-agents 2.1.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.
Files changed (193) hide show
  1. package/README.md +84 -18
  2. package/dist/application/AndroidApplicationService.js +17 -0
  3. package/dist/application/AppleApplicationService.js +17 -0
  4. package/dist/application/ApplicationWorkflowEvidenceResolver.js +162 -0
  5. package/dist/application/BinarySession.js +9 -2
  6. package/dist/application/BinarySessionStatus.js +39 -1
  7. package/dist/application/CapabilityInventory.js +15 -0
  8. package/dist/application/ClientRegistrationStatus.js +11 -4
  9. package/dist/application/CommandShimReplay.js +6 -3
  10. package/dist/application/CompositeProvider.js +5 -2
  11. package/dist/application/DirectAnalysis.js +1 -20
  12. package/dist/application/DirectAnalysisStatus.js +83 -0
  13. package/dist/application/Doctor.js +34 -25
  14. package/dist/application/DoctorDiagnostics.js +1 -4
  15. package/dist/application/DoctorProjection.js +43 -0
  16. package/dist/application/DoctorScope.js +102 -0
  17. package/dist/application/EvidenceReferenceResolver.js +26 -0
  18. package/dist/application/InventoryProjectionEvidence.js +41 -0
  19. package/dist/application/InvestigationProviders.js +12 -0
  20. package/dist/application/JavaScriptApplicationEvidence.js +1 -1
  21. package/dist/application/JavaScriptApplicationEvidenceGraph.js +10 -1
  22. package/dist/application/JavaScriptApplicationService.js +3 -2
  23. package/dist/application/JavaScriptApplicationWorkflowEvidence.js +26 -0
  24. package/dist/application/JavaScriptApplicationWorkflowService.js +49 -1
  25. package/dist/application/JavaScriptArtifactReconstruction.js +7 -0
  26. package/dist/application/JavaScriptModuleRelationships.js +25 -1
  27. package/dist/application/JavaScriptReturnShapeProjection.js +111 -0
  28. package/dist/application/JavaScriptSemanticGraphBuilder.js +294 -0
  29. package/dist/application/JavaScriptSemanticGraphConstruction.js +144 -0
  30. package/dist/application/JavaScriptSemanticGraphEvidence.js +86 -0
  31. package/dist/application/JavaScriptSemanticGraphFlowProjection.js +72 -0
  32. package/dist/application/JavaScriptSemanticGraphProjection.js +33 -0
  33. package/dist/application/JavaScriptSemanticTraceService.js +45 -0
  34. package/dist/application/LoopbackReplay.js +277 -133
  35. package/dist/application/LoopbackReplayRecorder.js +101 -0
  36. package/dist/application/PermissionAuthority.js +7 -3
  37. package/dist/application/ProcessCaptureJournal.js +95 -0
  38. package/dist/application/ProcessCaptureLifecycle.js +24 -13
  39. package/dist/application/ProcessCheckpoints.js +30 -4
  40. package/dist/application/ProcessCli.js +26 -4
  41. package/dist/application/ProcessHarness.js +20 -50
  42. package/dist/application/ProcessNormalization.js +3 -2
  43. package/dist/application/ProcessPairedExperiment.js +72 -0
  44. package/dist/application/ProcessReactiveCoordinator.js +218 -0
  45. package/dist/application/ProcessReactiveEffects.js +133 -0
  46. package/dist/application/ProcessReactiveObservations.js +20 -0
  47. package/dist/application/ProcessSampling.js +2 -0
  48. package/dist/application/SessionProviderRouter.js +7 -6
  49. package/dist/application/Setup.js +14 -13
  50. package/dist/application/SetupClientConfiguration.js +10 -6
  51. package/dist/application/SetupPlan.js +4 -3
  52. package/dist/application/SetupRegistrationEnvironment.js +12 -0
  53. package/dist/application/SetupSkill.js +44 -40
  54. package/dist/application/TerminalRenderer.js +3 -1
  55. package/dist/application/Uninstall.js +7 -1
  56. package/dist/application/Upgrade.js +16 -1
  57. package/dist/browser/CdpEndpoint.js +37 -4
  58. package/dist/catalogIdentity.js +16 -7
  59. package/dist/cli/coreAnalysisCommands.js +34 -2
  60. package/dist/cli/javascriptApplicationAnalysis.js +19 -0
  61. package/dist/cli/setupCommands.js +84 -30
  62. package/dist/cli/utilityCommands.js +10 -2
  63. package/dist/cliApplicationCommands.js +79 -16
  64. package/dist/cliCommandNames.js +3 -0
  65. package/dist/cliElectronCommands.js +23 -33
  66. package/dist/cliObservationOptions.js +1 -1
  67. package/dist/cliOutput.js +56 -0
  68. package/dist/cliProcessCommands.js +32 -1
  69. package/dist/cliSetup.js +55 -29
  70. package/dist/contracts/applicationToolContracts.js +54 -7
  71. package/dist/contracts/applicationWorkflowInputContracts.js +119 -0
  72. package/dist/contracts/electronToolContracts.js +73 -4
  73. package/dist/contracts/javascriptApplicationWorkflowExamples.js +32 -9
  74. package/dist/contracts/managedToolContracts.js +7 -2
  75. package/dist/contracts/processCaptureExample.js +1 -0
  76. package/dist/contracts/replayMachineExample.js +37 -0
  77. package/dist/contracts/sessionStatusContract.js +26 -0
  78. package/dist/contracts/toolContractExamples.js +2 -0
  79. package/dist/contracts/toolContractTypes.js +12 -1
  80. package/dist/contracts/toolContracts.js +8 -11
  81. package/dist/contracts/toolEffects.js +3 -0
  82. package/dist/contracts/toolOutputSchemaGroups.js +53 -9
  83. package/dist/contracts/toolOutputSchemaPrimitives.js +73 -32
  84. package/dist/doctorRuntime.js +41 -0
  85. package/dist/domain/analysisErrorPresentation.js +5 -3
  86. package/dist/domain/analysisErrorProjection.js +7 -1
  87. package/dist/domain/androidApplication.js +206 -0
  88. package/dist/domain/appleApplication.js +221 -0
  89. package/dist/domain/boundedCartesianProjection.js +15 -0
  90. package/dist/domain/changedBehavior.js +5 -4
  91. package/dist/domain/completionLedgerGeneration.js +190 -0
  92. package/dist/domain/errors.js +4 -2
  93. package/dist/domain/evidenceCompletionLedger.js +113 -0
  94. package/dist/domain/hopperStartupFailure.js +9 -0
  95. package/dist/domain/javascriptApplicationAnalysis.js +44 -2
  96. package/dist/domain/javascriptExportShapeComparison.js +145 -0
  97. package/dist/domain/javascriptExportShapeComparisonIdentity.js +11 -0
  98. package/dist/domain/javascriptExportShapeComparisonSchemas.js +277 -0
  99. package/dist/domain/javascriptExportShapeSelection.js +132 -0
  100. package/dist/domain/javascriptExportShapeVariants.js +272 -0
  101. package/dist/domain/javascriptRuntimeReconciliationParsing.js +2 -2
  102. package/dist/domain/javascriptSemanticAnalysis.js +17 -36
  103. package/dist/domain/javascriptSemanticCallResolution.js +129 -0
  104. package/dist/domain/javascriptSemanticCalls.js +269 -0
  105. package/dist/domain/javascriptSemanticGraph.js +356 -0
  106. package/dist/domain/javascriptSemanticGraphSchemas.js +329 -0
  107. package/dist/domain/javascriptSemanticGraphSerialization.js +23 -0
  108. package/dist/domain/javascriptSemanticIr.js +14 -1
  109. package/dist/domain/javascriptSemanticPrimitives.js +36 -0
  110. package/dist/domain/javascriptSemanticProjection.js +36 -4
  111. package/dist/domain/javascriptSemanticProvenance.js +29 -0
  112. package/dist/domain/javascriptSemanticQuery.js +294 -0
  113. package/dist/domain/javascriptSemanticQueryAssessment.js +74 -0
  114. package/dist/domain/javascriptSemanticQueryIdentity.js +86 -0
  115. package/dist/domain/javascriptSemanticQueryRelations.js +15 -0
  116. package/dist/domain/javascriptSemanticQuerySchemas.js +188 -0
  117. package/dist/domain/javascriptSemanticReturns.js +187 -0
  118. package/dist/domain/javascriptSemanticState.js +32 -0
  119. package/dist/domain/javascriptSemanticTraceSchemas.js +14 -0
  120. package/dist/domain/javascriptSemanticValues.js +54 -70
  121. package/dist/domain/processCapture.js +36 -0
  122. package/dist/domain/processCaptureValidation.js +101 -12
  123. package/dist/domain/processComparison.js +96 -24
  124. package/dist/domain/processObservation.js +153 -0
  125. package/dist/domain/processPairedExperiment.js +128 -0
  126. package/dist/domain/processReactiveCheckpointDataflow.js +32 -0
  127. package/dist/domain/processReactiveMatching.js +210 -0
  128. package/dist/domain/processReactiveRuntime.js +109 -0
  129. package/dist/domain/processReactiveScenario.js +361 -0
  130. package/dist/domain/processReactiveScenarioPreflight.js +120 -0
  131. package/dist/domain/processReactiveTransition.js +159 -0
  132. package/dist/domain/processScenario.js +12 -0
  133. package/dist/domain/processTraceComparison.js +43 -0
  134. package/dist/domain/processTraceDimensionProjection.js +50 -0
  135. package/dist/domain/processTraceEvaluation.js +312 -0
  136. package/dist/domain/processTraceSpecification.js +373 -0
  137. package/dist/domain/reconstructionVerification.js +5 -4
  138. package/dist/domain/replayMachine.js +332 -0
  139. package/dist/domain/replayMachineRun.js +216 -0
  140. package/dist/domain/replayMachineRuntime.js +294 -0
  141. package/dist/domain/runtimeIdentification.js +210 -0
  142. package/dist/domain/staticRuntimeCorrelation.js +4 -2
  143. package/dist/evaluation/CodexAgentEval.js +156 -0
  144. package/dist/generatedPackageMetadata.js +2 -2
  145. package/dist/ghidra/GhidraClient.js +13 -2
  146. package/dist/ghidra/GhidraDiagnostics.js +1 -0
  147. package/dist/ghidra/GhidraLauncher.js +7 -3
  148. package/dist/ghidra/GhidraProvider.js +8 -1
  149. package/dist/hopper/BridgeLauncher.js +56 -14
  150. package/dist/hopper/HopperClient.js +23 -10
  151. package/dist/hopper/HopperDiagnostics.js +14 -0
  152. package/dist/hopper/HopperProcessDiagnostic.js +14 -0
  153. package/dist/hopper/HopperProvider.js +8 -1
  154. package/dist/hopper/LinuxPrivateDisplayDiagnostic.js +72 -0
  155. package/dist/hopper/LinuxPrivateDisplayProbe.js +217 -0
  156. package/dist/identity.js +2 -1
  157. package/dist/main/transport.js +2 -0
  158. package/dist/mcpDoctor.js +310 -0
  159. package/dist/process/ProcessOwnership.js +200 -53
  160. package/dist/process/ProviderRunLineage.js +21 -0
  161. package/dist/server/createServer.js +8 -2
  162. package/dist/server/javascriptApplicationResult.js +106 -0
  163. package/dist/server/registerApplicationTools/characterization.js +3 -3
  164. package/dist/server/registerApplicationTools/compareExportShapes.js +37 -0
  165. package/dist/server/registerApplicationTools/compareVersions.js +12 -6
  166. package/dist/server/registerApplicationTools/controlledReplay.js +2 -2
  167. package/dist/server/registerApplicationTools/coverage.js +3 -3
  168. package/dist/server/registerApplicationTools/helpers.js +37 -25
  169. package/dist/server/registerApplicationTools/traceFeature.js +9 -5
  170. package/dist/server/registerApplicationTools/traceSemantics.js +30 -0
  171. package/dist/server/registerApplicationTools.js +4 -0
  172. package/dist/server/registerElectronTools.js +19 -5
  173. package/dist/server/registerEvidenceResources.js +7 -1
  174. package/dist/server/registerJavaScriptApplicationGraphResource.js +69 -0
  175. package/dist/server/registerManagedTools.js +18 -1
  176. package/dist/server/registerProcessComparisonTool.js +17 -7
  177. package/dist/server/registerReplayMachineTool.js +20 -0
  178. package/dist/server/registerSessionStatusTool.js +95 -25
  179. package/dist/server/registerSessionTools.js +12 -7
  180. package/dist/server/sessionAvailabilityPolicy.js +2 -1
  181. package/dist/server/toolResult.js +10 -4
  182. package/dist/serverIdentity.js +19 -0
  183. package/package.json +62 -29
  184. package/scripts/hopper-demo-x11.py +459 -61
  185. package/scripts/prepack.mjs +55 -0
  186. package/scripts/prepare.mjs +28 -0
  187. package/scripts/rea.mjs +26 -5
  188. package/skills/reverse-engineer-anything/SKILL.md +69 -228
  189. package/skills/reverse-engineer-anything/references/controlled-replay.md +12 -0
  190. package/skills/reverse-engineer-anything/references/evidence-workflows.md +33 -0
  191. package/skills/reverse-engineer-anything/references/javascript-applications.md +35 -0
  192. package/skills/reverse-engineer-anything/references/native-and-artifacts.md +36 -0
  193. package/skills/reverse-engineer-anything/references/runtime-observation.md +24 -0
@@ -0,0 +1,119 @@
1
+ import { z } from "zod";
2
+ import { evidenceSchema } from "../domain/evidence.js";
3
+ import { compareApplicationVersionsInputSchema } from "../domain/javascriptApplicationVersionComparisonSchemas.js";
4
+ import { compareJavaScriptExportShapesInputSchema } from "../domain/javascriptExportShapeComparisonSchemas.js";
5
+ import { traceApplicationFeatureInputSchema } from "../domain/javascriptFeatureTraceSchemas.js";
6
+ import { javaScriptSemanticQueryInputSchema } from "../domain/javascriptSemanticQuerySchemas.js";
7
+ const evidenceIdSchema = z
8
+ .string()
9
+ .regex(/^ev_[a-f0-9]{64}$/u)
10
+ .describe("Evidence ID returned earlier in this session");
11
+ const requireExactlyOne = (context, fields) => {
12
+ const [leftName, left, rightName, right] = fields;
13
+ if ((left === undefined) !== (right === undefined))
14
+ return;
15
+ context.addIssue({
16
+ code: "custom",
17
+ path: [left === undefined ? leftName : rightName],
18
+ message: `Supply exactly one of ${leftName} or ${rightName}`,
19
+ });
20
+ };
21
+ /** MCP/CLI trace request accepting full Evidence or a ledger reference. */
22
+ export const traceApplicationFeatureRequestSchema = z
23
+ .strictObject({
24
+ application: evidenceSchema.optional(),
25
+ application_evidence_id: evidenceIdSchema.optional(),
26
+ native_observations: traceApplicationFeatureInputSchema.shape.native_observations,
27
+ native_observation_evidence_ids: z
28
+ .array(evidenceIdSchema)
29
+ .max(64)
30
+ .default([]),
31
+ seed: traceApplicationFeatureInputSchema.shape.seed,
32
+ direction: traceApplicationFeatureInputSchema.shape.direction,
33
+ limits: traceApplicationFeatureInputSchema.shape.limits,
34
+ })
35
+ .superRefine((input, context) => {
36
+ requireExactlyOne(context, [
37
+ "application",
38
+ input.application,
39
+ "application_evidence_id",
40
+ input.application_evidence_id,
41
+ ]);
42
+ });
43
+ /** MCP/CLI semantic trace request accepting full Evidence or a ledger reference. */
44
+ export const traceJavaScriptSemanticsRequestSchema = z
45
+ .strictObject({
46
+ application: evidenceSchema.optional(),
47
+ application_evidence_id: evidenceIdSchema.optional(),
48
+ query: javaScriptSemanticQueryInputSchema,
49
+ })
50
+ .superRefine((input, context) => {
51
+ requireExactlyOne(context, [
52
+ "application",
53
+ input.application,
54
+ "application_evidence_id",
55
+ input.application_evidence_id,
56
+ ]);
57
+ });
58
+ /** MCP/CLI comparison request accepting full Evidence or ledger references. */
59
+ export const compareApplicationVersionsRequestSchema = z
60
+ .strictObject({
61
+ left: evidenceSchema.optional(),
62
+ left_evidence_id: evidenceIdSchema.optional(),
63
+ right: evidenceSchema.optional(),
64
+ right_evidence_id: evidenceIdSchema.optional(),
65
+ left_native_observations: compareApplicationVersionsInputSchema.shape.left_native_observations,
66
+ left_native_observation_evidence_ids: z
67
+ .array(evidenceIdSchema)
68
+ .max(64)
69
+ .default([]),
70
+ right_native_observations: compareApplicationVersionsInputSchema.shape.right_native_observations,
71
+ right_native_observation_evidence_ids: z
72
+ .array(evidenceIdSchema)
73
+ .max(64)
74
+ .default([]),
75
+ limits: compareApplicationVersionsInputSchema.shape.limits,
76
+ unknown_registry_approved: compareApplicationVersionsInputSchema.shape.unknown_registry_approved,
77
+ })
78
+ .superRefine((input, context) => {
79
+ requireExactlyOne(context, [
80
+ "left",
81
+ input.left,
82
+ "left_evidence_id",
83
+ input.left_evidence_id,
84
+ ]);
85
+ requireExactlyOne(context, [
86
+ "right",
87
+ input.right,
88
+ "right_evidence_id",
89
+ input.right_evidence_id,
90
+ ]);
91
+ });
92
+ /** MCP/CLI export-shape request accepting full Evidence or ledger references. */
93
+ export const compareJavaScriptExportShapesRequestSchema = z
94
+ .strictObject({
95
+ left: evidenceSchema.optional(),
96
+ left_evidence_id: evidenceIdSchema.optional(),
97
+ right: evidenceSchema.optional(),
98
+ right_evidence_id: evidenceIdSchema.optional(),
99
+ left_module_path: compareJavaScriptExportShapesInputSchema.shape.left_module_path,
100
+ left_export_name: compareJavaScriptExportShapesInputSchema.shape.left_export_name,
101
+ right_module_path: compareJavaScriptExportShapesInputSchema.shape.right_module_path,
102
+ right_export_name: compareJavaScriptExportShapesInputSchema.shape.right_export_name,
103
+ limits: compareJavaScriptExportShapesInputSchema.shape.limits,
104
+ unknown_registry_approved: compareJavaScriptExportShapesInputSchema.shape.unknown_registry_approved,
105
+ })
106
+ .superRefine((input, context) => {
107
+ requireExactlyOne(context, [
108
+ "left",
109
+ input.left,
110
+ "left_evidence_id",
111
+ input.left_evidence_id,
112
+ ]);
113
+ requireExactlyOne(context, [
114
+ "right",
115
+ input.right,
116
+ "right_evidence_id",
117
+ input.right_evidence_id,
118
+ ]);
119
+ });
@@ -1,12 +1,80 @@
1
+ import { z } from "zod";
1
2
  import { toolContractMetadata } from "./toolEffects.js";
2
3
  import { evidenceResultOf } from "./toolOutputSchemas.js";
3
4
  import { electronPageInspectionSchema, electronTargetListSchema, inspectElectronPageInputSchema, listElectronTargetsInputSchema, } from "../domain/electronObservation.js";
4
- import { analyzeJavaScriptApplicationInputSchema, javascriptApplicationAnalysisResultSchema, } from "../domain/javascriptApplicationAnalysis.js";
5
+ import { analyzeJavaScriptApplicationInputSchema, javaScriptApplicationAnalysisResultV1Schema, javascriptApplicationAnalysisResultSchema, } from "../domain/javascriptApplicationAnalysis.js";
6
+ import { JAVASCRIPT_APPLICATION_NODE_KINDS } from "../domain/javascriptApplicationGraphSchemas.js";
7
+ import { applicationCoverageSchema } from "../domain/javascriptApplicationEvidenceSchemas.js";
5
8
  import { javascriptRuntimeReconciliationResultSchema, reconcileJavaScriptRuntimeInputSchema, } from "../domain/javascriptRuntimeReconciliationSchemas.js";
6
9
  import { JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE } from "./javascriptRuntimeReconciliationExample.js";
7
10
  const listOutputSchema = evidenceResultOf(electronTargetListSchema);
8
11
  const inspectionOutputSchema = evidenceResultOf(electronPageInspectionSchema);
9
- const applicationOutputSchema = evidenceResultOf(javascriptApplicationAnalysisResultSchema);
12
+ /** MCP-only response selection; analysis identity does not depend on projection. */
13
+ export const analyzeJavaScriptApplicationToolInputSchema = analyzeJavaScriptApplicationInputSchema.extend({
14
+ detail: z
15
+ .enum(["summary", "full"])
16
+ .default("summary")
17
+ .describe("summary returns bounded findings and paged graph resource URIs; full returns the complete graph only when explicitly required"),
18
+ });
19
+ /** Bounded default projection for agent-facing JavaScript application analysis. */
20
+ const applicationGraphSummarySchema = z.strictObject({
21
+ graph_id: z.string().regex(/^jag_[a-f0-9]{64}$/u),
22
+ node_count: z.number().int().min(0),
23
+ edge_count: z.number().int().min(0),
24
+ roots: z.strictObject({
25
+ items: z.array(z.string().regex(/^jag_node_[a-f0-9]{64}$/u)),
26
+ total: z.number().int().min(0),
27
+ truncated: z.boolean(),
28
+ }),
29
+ node_kinds: z.array(z.strictObject({
30
+ kind: z.enum(JAVASCRIPT_APPLICATION_NODE_KINDS),
31
+ count: z.number().int().min(1),
32
+ })),
33
+ top_findings: z.array(z.strictObject({
34
+ node_id: z.string().regex(/^jag_node_[a-f0-9]{64}$/u),
35
+ kind: z.enum(JAVASCRIPT_APPLICATION_NODE_KINDS),
36
+ label: z.string().nullable(),
37
+ authority: z.string(),
38
+ state: z.string(),
39
+ confidence: z.string(),
40
+ location: z.json(),
41
+ })),
42
+ coverage: applicationCoverageSchema,
43
+ limitations: z.array(z.string()),
44
+ pages: z.strictObject({
45
+ nodes: z.string().startsWith("rea://evidence/"),
46
+ edges: z.string().startsWith("rea://evidence/"),
47
+ page_limit: z.number().int().min(1).max(500),
48
+ }),
49
+ });
50
+ const semanticGraphSummarySchema = z.strictObject({
51
+ graph_id: z.string().regex(/^jsrg_[a-f0-9]{64}$/u),
52
+ nodes: z.number().int().min(0),
53
+ relations: z.number().int().min(0),
54
+ unknown_frontiers: z.number().int().min(0),
55
+ fingerprints: z.number().int().min(0),
56
+ coverage: z.enum(["complete", "partial", "unknown", "unavailable"]),
57
+ query_tool: z.literal("trace_javascript_semantics"),
58
+ });
59
+ const summaryFields = {
60
+ unknowns: z.array(z.string().min(1).max(4_096)).max(1_000),
61
+ graph: applicationGraphSummarySchema,
62
+ };
63
+ /** Bounded default projection for agent-facing JavaScript application analysis. */
64
+ export const javascriptApplicationAnalysisSummarySchema = z.discriminatedUnion("schema_version", [
65
+ javaScriptApplicationAnalysisResultV1Schema
66
+ .omit({ graph: true })
67
+ .extend(summaryFields),
68
+ javaScriptApplicationAnalysisResultV1Schema.omit({ graph: true }).extend({
69
+ schema_version: z.literal(2),
70
+ ...summaryFields,
71
+ semantic_graph: semanticGraphSummarySchema,
72
+ }),
73
+ ]);
74
+ const applicationOutputSchema = evidenceResultOf(z.union([
75
+ javascriptApplicationAnalysisSummarySchema,
76
+ javascriptApplicationAnalysisResultSchema,
77
+ ]));
10
78
  const reconciliationOutputSchema = evidenceResultOf(javascriptRuntimeReconciliationResultSchema);
11
79
  const endpoint = "http://127.0.0.1:9223";
12
80
  const root = "/Applications/Example.app/Contents/Resources";
@@ -66,9 +134,9 @@ export const ELECTRON_TOOL_CONTRACTS = [
66
134
  {
67
135
  name: "analyze_javascript_application",
68
136
  ...toolContractMetadata("analyze_javascript_application"),
69
- description: "Statically reconstruct one approved local ASAR or extracted JavaScript application as Evidence v2 and JavaScript Application Graph v1. Maps BrowserWindow preferences, preload and contextBridge APIs, literal and dynamic IPC, handler locations, sender-validation observations, utility processes, and requested native addon bindings without executing JavaScript; source-map contents require separate approval.",
137
+ description: "Statically reconstruct one approved local ASAR or extracted JavaScript application without executing it. The default summary returns architecture/security counts, top evidence-backed findings, unknowns, and paged graph resource URIs; request detail=full only when the complete graph must be returned immediately. Identical inputs are deterministic, so do not repeat the call or reread full Evidence without a specific missing detail.",
70
138
  kind: "electron-provider",
71
- inputSchema: analyzeJavaScriptApplicationInputSchema,
139
+ inputSchema: analyzeJavaScriptApplicationToolInputSchema,
72
140
  outputSchema: applicationOutputSchema,
73
141
  examples: [
74
142
  {
@@ -78,6 +146,7 @@ export const ELECTRON_TOOL_CONTRACTS = [
78
146
  format: "auto",
79
147
  approved: true,
80
148
  source_map_read_approved: false,
149
+ detail: "summary",
81
150
  },
82
151
  },
83
152
  ],
@@ -28,19 +28,42 @@ const reconciliationEvidence = createEvidence(undefined, {
28
28
  limitations: reconciliation.limitations,
29
29
  evidenceLinks: reconciliation.evidence_links,
30
30
  });
31
- /** Valid public trace request without proprietary artifacts. */
31
+ const EXAMPLE_EVIDENCE_ID = `ev_${"0".repeat(64)}`;
32
+ const SECOND_EXAMPLE_EVIDENCE_ID = `ev_${"1".repeat(64)}`;
33
+ const TRACE_SEED = {
34
+ kind: "module",
35
+ value: "renderer.js",
36
+ match: "exact",
37
+ case_sensitive: false,
38
+ };
39
+ /** Natural trace request using the Evidence ID returned by its producer. */
32
40
  export const JAVASCRIPT_FEATURE_TRACE_EXAMPLE = {
33
- application: JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE,
34
- seed: {
35
- kind: "module",
36
- value: "renderer.js",
37
- match: "exact",
38
- case_sensitive: false,
39
- },
41
+ application_evidence_id: EXAMPLE_EVIDENCE_ID,
42
+ seed: TRACE_SEED,
40
43
  direction: "both",
41
44
  };
42
- /** Valid static/runtime graph pair demonstrating comparison authority. */
45
+ /** Natural version comparison using two producer-returned Evidence IDs. */
43
46
  export const JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE = {
47
+ left_evidence_id: EXAMPLE_EVIDENCE_ID,
48
+ right_evidence_id: SECOND_EXAMPLE_EVIDENCE_ID,
49
+ };
50
+ /** Exact static return-shape comparison using producer-returned Evidence IDs. */
51
+ export const JAVASCRIPT_EXPORT_SHAPE_COMPARISON_EXAMPLE = {
52
+ left_evidence_id: EXAMPLE_EVIDENCE_ID,
53
+ right_evidence_id: SECOND_EXAMPLE_EVIDENCE_ID,
54
+ left_module_path: "parser.mjs",
55
+ left_export_name: "default",
56
+ right_module_path: "parser.mjs",
57
+ right_export_name: "default",
58
+ };
59
+ /** Full-Evidence compatibility fixture used by pure domain and adapter tests. */
60
+ export const JAVASCRIPT_FEATURE_TRACE_FULL_EVIDENCE_EXAMPLE = {
61
+ application: JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE,
62
+ seed: TRACE_SEED,
63
+ direction: "both",
64
+ };
65
+ /** Full-Evidence compatibility comparison fixture. */
66
+ export const JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE = {
44
67
  left: JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE,
45
68
  right: reconciliationEvidence,
46
69
  };
@@ -3,6 +3,11 @@ import { managedOutputSchemas } from "./toolOutputSchemas.js";
3
3
  import { toolContractMetadata } from "./toolEffects.js";
4
4
  /** Exact caller boundary for execution-free PE/CLI triage and identity. */
5
5
  export const managedArtifactInputSchema = z.object({
6
+ path: z
7
+ .string()
8
+ .min(1)
9
+ .optional()
10
+ .describe("Managed PE/CLI path to open before inspection; omit only when a managed target is already active"),
6
11
  reference_offset: z.number().int().min(0).default(0),
7
12
  reference_limit: z.number().int().min(1).max(500).default(100),
8
13
  resource_offset: z.number().int().min(0).default(0),
@@ -111,14 +116,14 @@ export const MANAGED_TOOL_CONTRACTS = [
111
116
  {
112
117
  name: "inspect_managed_artifact",
113
118
  ...toolContractMetadata("inspect_managed_artifact"),
114
- description: "Classify the active PE/CLI artifact and inventory exact assembly/module identity, target framework evidence, references, resources, and custom attributes without loading or executing target code. Returns bounded pages and explicit partial or malformed coverage.",
119
+ description: "Open and classify an explicit managed PE/CLI path, or inspect the active managed target, then inventory exact assembly/module identity, target framework evidence, references, resources, and custom attributes without loading or executing target code. Returns bounded pages and explicit partial or malformed coverage.",
115
120
  kind: "managed-provider",
116
121
  inputSchema: managedArtifactInputSchema,
117
122
  outputSchema,
118
123
  examples: [
119
124
  {
120
125
  title: "Example inspect managed artifact request",
121
- input: {},
126
+ input: { path: "/tmp/Example.dll" },
122
127
  },
123
128
  ],
124
129
  },
@@ -55,6 +55,7 @@ export const EMPTY_PROCESS_CAPTURE_EXAMPLE = {
55
55
  ],
56
56
  shim_events: [],
57
57
  protocol_events: [],
58
+ replay_transitions: [],
58
59
  files_before: [],
59
60
  files_after: [],
60
61
  filesystem_effects: [],
@@ -0,0 +1,37 @@
1
+ import { jsonObjectSchema } from "../domain/jsonValue.js";
2
+ /** Minimal login callback accepted by the direct replay-machine contract. */
3
+ export const REPLAY_MACHINE_RUN_EXAMPLE = jsonObjectSchema.parse({
4
+ machine: {
5
+ initial_state: "waiting",
6
+ states: [{ name: "waiting" }, { name: "complete", terminal: true }],
7
+ transitions: [
8
+ {
9
+ id: "accept_callback",
10
+ from: "waiting",
11
+ to: "complete",
12
+ trigger: { protocol: "http", method: "POST", path: "/callback" },
13
+ captures: [
14
+ {
15
+ variable: "token",
16
+ value: { source: "request_json", path: ["token"] },
17
+ sensitive: true,
18
+ },
19
+ ],
20
+ actions: [{ type: "http_response", status: 204, body: "" }],
21
+ max_uses: 1,
22
+ },
23
+ ],
24
+ max_transitions: 1,
25
+ },
26
+ events: [
27
+ {
28
+ protocol: "http",
29
+ connection: "not_applicable",
30
+ at_ms: 0,
31
+ method: "POST",
32
+ path: "/callback",
33
+ headers: {},
34
+ body: '{"token":"opaque"}',
35
+ },
36
+ ],
37
+ });
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ import { TOOL_KINDS } from "./toolContractTypes.js";
3
+ /** Caller observations and projection controls for binary_session. */
4
+ export const binarySessionInputSchema = z.object({
5
+ detail: z
6
+ .enum(["summary", "capabilities", "full"])
7
+ .default("summary")
8
+ .describe("summary returns routing state; capabilities returns one filtered tool-availability page; full returns complete diagnostics only when required"),
9
+ capability_family: z
10
+ .enum(TOOL_KINDS)
11
+ .optional()
12
+ .describe("Optional tool family for detail=capabilities"),
13
+ cursor: z
14
+ .number()
15
+ .int()
16
+ .min(0)
17
+ .default(0)
18
+ .describe("Zero-based capability cursor for detail=capabilities"),
19
+ limit: z.number().int().min(1).max(100).default(25),
20
+ expected_package_version: z.string().min(1).optional(),
21
+ expected_catalog_digest: z
22
+ .string()
23
+ .regex(/^[a-f0-9]{64}$/u)
24
+ .optional(),
25
+ expected_server_path: z.string().min(1).optional(),
26
+ });
@@ -2,6 +2,7 @@ import { UNKNOWN_CONTRACT_EXAMPLES } from "./unknownContractExamples.js";
2
2
  import { ARTIFACT_COMPARISON_EXAMPLE } from "./artifactComparisonExample.js";
3
3
  import { FUNCTION_COMPARISON_EXAMPLE } from "./functionComparisonExample.js";
4
4
  import { INVESTIGATION_EXAMPLES } from "./investigationExamples.js";
5
+ import { REPLAY_MACHINE_RUN_EXAMPLE } from "./replayMachineExample.js";
5
6
  /** Canonical examples for contracts whose required inputs have no defaults. */
6
7
  export const TOOL_EXAMPLE_OVERRIDES = {
7
8
  ...UNKNOWN_CONTRACT_EXAMPLES,
@@ -35,6 +36,7 @@ export const TOOL_EXAMPLE_OVERRIDES = {
35
36
  executable: "/usr/bin/true",
36
37
  working_directory: "/tmp",
37
38
  },
39
+ run_replay_machine: REPLAY_MACHINE_RUN_EXAMPLE,
38
40
  compare_process_captures: {
39
41
  left_evidence_id: `ev_${"0".repeat(64)}`,
40
42
  right_evidence_id: `ev_${"1".repeat(64)}`,
@@ -1 +1,12 @@
1
- export {};
1
+ /** Canonical adapter families responsible for public MCP tools. */
2
+ export const TOOL_KINDS = [
3
+ "official-proxy",
4
+ "enhanced",
5
+ "native-provider",
6
+ "artifact-provider",
7
+ "managed-provider",
8
+ "browser-provider",
9
+ "electron-provider",
10
+ "application",
11
+ "session",
12
+ ];
@@ -9,6 +9,8 @@ import { changedBehaviorInputSchema } from "../domain/changedBehavior.js";
9
9
  import { callPathInputSchema } from "../domain/callPath.js";
10
10
  import { staticRuntimeCorrelationInputSchema } from "../domain/staticRuntimeCorrelation.js";
11
11
  import { reconstructionVerificationInputSchema } from "../domain/reconstructionVerification.js";
12
+ import { replayMachineRunInputSchema } from "../domain/replayMachineRun.js";
13
+ import { processTraceSpecificationSchema } from "../domain/processTraceComparison.js";
12
14
  import { enhancedInputSchemas } from "./enhancedInputs.js";
13
15
  import { enhancedOutputSchemas, officialOutputSchemas, requireOutputSchema, sessionOutputSchemas, } from "./toolOutputSchemas.js";
14
16
  import { TOOL_EXAMPLE_OVERRIDES } from "./toolContractExamples.js";
@@ -21,6 +23,8 @@ import { ELECTRON_TOOL_CONTRACTS } from "./electronToolContracts.js";
21
23
  import { APPLICATION_TOOL_CONTRACTS } from "./applicationToolContracts.js";
22
24
  import { closeBinaryInputSchema, openBinaryInputSchema, } from "./sessionLifecycleInputs.js";
23
25
  import { toolContractMetadata } from "./toolEffects.js";
26
+ import { binarySessionInputSchema } from "./sessionStatusContract.js";
27
+ export { binarySessionInputSchema } from "./sessionStatusContract.js";
24
28
  const document = z.string().optional().describe("The document name");
25
29
  const address = z
26
30
  .string()
@@ -149,15 +153,6 @@ export const ENHANCED_TOOL_CONTRACTS = [
149
153
  enhanced("analyze_function", "Preferred bounded analysis for one procedure symbol or address. Returns identity, provider-specific pseudocode, optional assembly, comments, calls, typed-or-explicitly-unavailable references, referenced strings/names, and local CFG blocks with exact truncation metadata.", enhancedInputSchemas.analyze_function),
150
154
  enhanced("trace_feature", "Trace a bounded literal feature query through matching strings and procedures, xrefs, and truthful containing-procedure resolution. Returns the operation budget, truncation, and residual unknowns; unknown_registry_approved: true records them durably without inferring reference kinds.", enhancedInputSchemas.trace_feature),
151
155
  ];
152
- /** Caller observations used to compare a live server with expected identity. */
153
- export const binarySessionInputSchema = z.object({
154
- expected_package_version: z.string().min(1).optional(),
155
- expected_catalog_digest: z
156
- .string()
157
- .regex(/^[a-f0-9]{64}$/u)
158
- .optional(),
159
- expected_server_path: z.string().min(1).optional(),
160
- });
161
156
  /** Session-owned Evidence bundle export options. */
162
157
  export const exportEvidenceBundleInputSchema = z.strictObject({
163
158
  path: z.string().min(1).optional(),
@@ -171,6 +166,7 @@ export const importEvidenceBundleInputSchema = z.strictObject({
171
166
  export const processComparisonInputSchema = z.strictObject({
172
167
  left_evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
173
168
  right_evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
169
+ trace_spec: processTraceSpecificationSchema.optional(),
174
170
  max_capture_age_ms: z.number().int().nonnegative().optional(),
175
171
  unknown_registry_approved: z
176
172
  .literal(true)
@@ -193,11 +189,11 @@ export const verifyUnknownResolutionInputSchema = z.strictObject({
193
189
  export const SESSION_TOOL_CONTRACTS = [
194
190
  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),
195
191
  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),
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),
192
+ session("binary_session", "Report compact target, provider, and alignment state without starting analysis. The default summary is the routing check agents should use; detail=capabilities returns one family-filtered availability page, while detail=full is reserved for complete provider diagnostics.", binarySessionInputSchema),
197
193
  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
194
  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),
199
195
  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),
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
+ session("compare_process_captures", "Compare two compatible Process Capture v4 observations across terminal, interaction, lifecycle, process, filesystem, command-shim, HTTP, and WebSocket evidence. Optional trace_spec validates exact events against an explicit partial order or finite trace language; concurrency is never inferred from timestamps or broad sorting. Missing, journal-free, or truncated observations are never treated as equivalent.", processComparisonInputSchema),
201
197
  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),
202
198
  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),
203
199
  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),
@@ -209,6 +205,7 @@ export const SESSION_TOOL_CONTRACTS = [
209
205
  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),
210
206
  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),
211
207
  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),
208
+ session("run_replay_machine", "Evaluate ordered HTTP and WebSocket events directly against one validated finite replay machine without opening sockets or launching a target. Returns every decision, a capture-value-free transition journal, one redacted action table entry per used transition, captured aliases, final state, and exact configured and consumed limits.", replayMachineRunInputSchema),
212
209
  ];
213
210
  /** Complete ordered public inventory used by registration and verification. */
214
211
  export const TOOL_CONTRACTS = [
@@ -93,7 +93,10 @@ export const TOOL_EFFECTS = {
93
93
  analyze_javascript_application: evidence,
94
94
  reconcile_javascript_runtime: evidence,
95
95
  trace_application_feature: evidence,
96
+ trace_javascript_semantics: evidence,
96
97
  compare_application_versions: evidence,
98
+ compare_javascript_export_shapes: evidence,
99
+ run_replay_machine: effects(),
97
100
  run_controlled_replay: effects({
98
101
  mutatesSession: true,
99
102
  writesFilesystem: true,
@@ -18,8 +18,9 @@ import { changedBehaviorResultSchema } from "../domain/changedBehavior.js";
18
18
  import { callPathResultSchema } from "../domain/callPath.js";
19
19
  import { staticRuntimeCorrelationResultSchema } from "../domain/staticRuntimeCorrelation.js";
20
20
  import { reconstructionVerificationResultSchema } from "../domain/reconstructionVerification.js";
21
+ import { replayMachineRunOutputSchema } from "../domain/replayMachineRun.js";
21
22
  import { analysisErrorProjectionSchema } from "./errorSchemas.js";
22
- import { addressList, addressedEntry, bounded, containingProcedureResolution, functionDossierOutput, graphNode, lifecycleResultOf, nullableText, pageOutput, procedureIdentity, procedureInfoOutput, evidenceResultOf as resultOf, searchPageOutput, segmentOutput, sessionProvider, symbolDiscoveryOutput, targetFormatSchema, targetKindSchema, } from "./toolOutputSchemaPrimitives.js";
23
+ import { addressList, addressedEntry, bounded, containingProcedureResolution, functionDossierOutput, graphNode, lifecycleResultOf, nullableText, pageOutput, procedureIdentity, procedureInfoOutput, evidenceResultOf as resultOf, searchPageOutput, segmentOutput, sessionProvider, providerIdentity, toolAvailability, symbolDiscoveryOutput, targetFormatSchema, targetKindSchema, } from "./toolOutputSchemaPrimitives.js";
23
24
  /** Exact structured-content schemas shared by direct analysis providers. */
24
25
  export const officialOutputSchemas = {
25
26
  address_name: resultOf(nullableText),
@@ -190,15 +191,57 @@ export const sessionOutputSchemas = {
190
191
  }),
191
192
  ])),
192
193
  binary_session: lifecycleResultOf(z.union([
193
- sessionProvider.extend({ open: z.literal(false) }),
194
- sessionProvider.extend({
195
- open: z.literal(true),
196
- path: z.string(),
197
- format: targetFormatSchema,
198
- kind: targetKindSchema,
199
- sha256: z.string().regex(/^[a-f0-9]{64}$/u),
200
- architecture: z.enum(["x86", "x86_64", "arm", "arm64"]).nullable(),
194
+ z.object({
195
+ view: z.literal("summary"),
196
+ open: z.boolean(),
197
+ provider: providerIdentity,
198
+ active_provider: providerIdentity.nullable(),
199
+ target: z
200
+ .object({
201
+ path: z.string(),
202
+ format: targetFormatSchema,
203
+ kind: targetKindSchema,
204
+ sha256: z.string().regex(/^[a-f0-9]{64}$/u),
205
+ architecture: z.enum(["x86", "x86_64", "arm", "arm64"]).nullable(),
206
+ })
207
+ .nullable(),
208
+ alignment: z.object({
209
+ state: z.enum(["aligned", "mcp_server_restart_required", "unknown"]),
210
+ reasons: z.array(z.string()),
211
+ remediation: z.string().nullable(),
212
+ }),
213
+ recommended_actions: z.array(z.string()),
214
+ }),
215
+ z.object({
216
+ view: z.literal("capabilities"),
217
+ open: z.boolean(),
218
+ provider: providerIdentity,
219
+ active_provider: providerIdentity.nullable(),
220
+ capability_family: z.string().nullable(),
221
+ capabilities: z.object({
222
+ items: z.array(toolAvailability),
223
+ cursor: z.number().int().min(0),
224
+ limit: z.number().int().min(1),
225
+ total: z.number().int().min(0),
226
+ next_cursor: z.number().int().min(0).nullable(),
227
+ has_more: z.boolean(),
228
+ }),
201
229
  }),
230
+ z.union([
231
+ sessionProvider.extend({
232
+ view: z.literal("full"),
233
+ open: z.literal(false),
234
+ }),
235
+ sessionProvider.extend({
236
+ view: z.literal("full"),
237
+ open: z.literal(true),
238
+ path: z.string(),
239
+ format: targetFormatSchema,
240
+ kind: targetKindSchema,
241
+ sha256: z.string().regex(/^[a-f0-9]{64}$/u),
242
+ architecture: z.enum(["x86", "x86_64", "arm", "arm64"]).nullable(),
243
+ }),
244
+ ]),
202
245
  ])),
203
246
  export_evidence_bundle: lifecycleResultOf(z.union([
204
247
  evidenceBundleSchema,
@@ -229,4 +272,5 @@ export const sessionOutputSchemas = {
229
272
  truthVerified: z.boolean(),
230
273
  unknown: residualUnknownSchema,
231
274
  })),
275
+ run_replay_machine: lifecycleResultOf(replayMachineRunOutputSchema),
232
276
  };