rea-agents 2.5.0 → 3.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.
Files changed (253) hide show
  1. package/README.md +20 -12
  2. package/bridge/ghidra/ReaGhidraBridge.java +477 -4
  3. package/bridge/hopper_bridge.py +54 -4
  4. package/dist/application/AnalysisContextQueries.js +142 -0
  5. package/dist/application/AnalysisSnapshotCache.js +4 -2
  6. package/dist/application/ApplicationWorkflowEvidenceResolver.js +19 -11
  7. package/dist/application/ArtifactInventory/policy.js +17 -0
  8. package/dist/application/ArtifactInventory/reader.js +1 -4
  9. package/dist/application/ArtifactInventory/scanCanonical.js +0 -3
  10. package/dist/application/ArtifactInventory/scanReader.js +7 -7
  11. package/dist/application/ArtifactInventory/types.js +1 -5
  12. package/dist/application/BinarySession.js +19 -20
  13. package/dist/application/BinarySessionComposition.js +21 -0
  14. package/dist/application/BinarySessionRecords.js +106 -10
  15. package/dist/application/BinarySessionStatus.js +11 -5
  16. package/dist/application/BrowserEvidence.js +3 -5
  17. package/dist/application/CapabilityClientRequirements.js +26 -0
  18. package/dist/application/CapabilityInventory.js +140 -55
  19. package/dist/application/ClientRegistrationStatus.js +4 -1
  20. package/dist/application/CrossVersionInventory.js +7 -6
  21. package/dist/application/DirectAnalysis.js +6 -2
  22. package/dist/application/ElectronActiveEvidence.js +55 -0
  23. package/dist/application/ElectronActiveObservationPort.js +1 -0
  24. package/dist/application/ElectronActiveObservationService.js +81 -0
  25. package/dist/application/EnhancedTools.js +49 -17
  26. package/dist/application/EvidenceBundleCommands.js +5 -1
  27. package/dist/application/EvidenceLedger.js +53 -17
  28. package/dist/application/JavaScriptArtifactAnalysis.js +13 -4
  29. package/dist/application/JavaScriptReplayPermission.js +1 -1
  30. package/dist/application/JavaScriptReplayService.js +23 -15
  31. package/dist/application/LazyAnalysisProvider.js +77 -0
  32. package/dist/application/LoopbackReplay.js +1 -1
  33. package/dist/application/ManagedRuntimeCorrelationService.js +9 -5
  34. package/dist/application/NativeApiInspection.js +80 -0
  35. package/dist/application/NodeRuntimeCharacterizationService.js +8 -9
  36. package/dist/application/ProcessCaptureLifecycle.js +5 -0
  37. package/dist/application/ProcessCli.js +2 -1
  38. package/dist/application/ProcessHarness.js +8 -3
  39. package/dist/application/ProcessNormalization.js +2 -1
  40. package/dist/application/ProjectPermissionStore.js +1 -0
  41. package/dist/application/ReferenceSourceImport.js +2 -2
  42. package/dist/application/SessionProviderRouter.js +6 -6
  43. package/dist/application/SetupClientConfiguration.js +10 -3
  44. package/dist/application/WindowsCapabilities.js +5 -4
  45. package/dist/application/runtime.js +26 -9
  46. package/dist/artifacts/ArtifactProvider.js +8 -10
  47. package/dist/artifacts/SafeOutputTree.js +7 -8
  48. package/dist/browser/CdpCaptureStorageFingerprints.js +10 -7
  49. package/dist/browser/CdpElectronInspection.js +3 -1
  50. package/dist/browser/JavaScriptRuntimeScope.js +5 -0
  51. package/dist/browser/PlaywrightBrowserScenarioProvider.js +8 -2
  52. package/dist/browser/PlaywrightElectronActiveActions.js +324 -0
  53. package/dist/browser/PlaywrightElectronActiveProvider.js +294 -0
  54. package/dist/browser/PlaywrightScenarioBrowser.js +4 -4
  55. package/dist/browser/PlaywrightScenarioSession.js +4 -4
  56. package/dist/browser/SensitiveTextCapture.js +1 -1
  57. package/dist/browser/V8InspectorCaptureProjection.js +1 -0
  58. package/dist/browser/V8InspectorProvider.js +3 -3
  59. package/dist/catalogIdentity.js +15 -9
  60. package/dist/cli/artifactCommands.js +5 -3
  61. package/dist/cli/coreAnalysisCommands.js +41 -0
  62. package/dist/cli/managedCommands.js +1 -1
  63. package/dist/cliApplicationCommands.js +2 -2
  64. package/dist/cliBrowserAdvancedCommands.js +11 -5
  65. package/dist/cliBrowserCommands.js +14 -7
  66. package/dist/cliCommandNames.js +2 -0
  67. package/dist/cliElectronCommands.js +46 -4
  68. package/dist/cliJavaScriptRuntimeCommands.js +14 -6
  69. package/dist/cliObservationOptions.js +4 -0
  70. package/dist/cliPolicyCommands.js +1 -0
  71. package/dist/config/browserScenario.js +77 -0
  72. package/dist/config/electronAutomation.js +35 -0
  73. package/dist/config/environment.js +6 -0
  74. package/dist/config/javascriptReplay.js +41 -0
  75. package/dist/config/managedRuntime.js +25 -0
  76. package/dist/config/parseConfig.js +56 -200
  77. package/dist/config/parsers.js +10 -1
  78. package/dist/config/passiveObservation.js +157 -0
  79. package/dist/config/processCapture.js +47 -0
  80. package/dist/contracts/applicationToolContracts.js +2 -5
  81. package/dist/contracts/applicationWorkflowInputContracts.js +86 -96
  82. package/dist/contracts/artifactToolContracts.js +35 -37
  83. package/dist/contracts/browserToolContracts.js +2 -2
  84. package/dist/contracts/electronToolContracts.js +30 -1
  85. package/dist/contracts/enhancedInputs.js +21 -27
  86. package/dist/contracts/functionWorkflowToolContracts.js +29 -0
  87. package/dist/contracts/managedToolContracts.js +4 -9
  88. package/dist/contracts/managedWorkflowExamples.js +12 -9
  89. package/dist/contracts/managedWorkflowToolContracts.js +30 -27
  90. package/dist/contracts/nativeToolContracts.js +2 -3
  91. package/dist/contracts/promptContracts.js +14 -15
  92. package/dist/contracts/sessionToolSchemas.js +61 -0
  93. package/dist/contracts/toolContractExamples.js +4 -0
  94. package/dist/contracts/toolContractHelpers.js +23 -0
  95. package/dist/contracts/toolContracts.js +12 -67
  96. package/dist/contracts/toolEffects.js +19 -0
  97. package/dist/contracts/toolOutputSchemaGroups.js +66 -11
  98. package/dist/contracts/toolOutputSchemaPrimitives.js +76 -26
  99. package/dist/contracts/toolSchemaMetadata.js +128 -0
  100. package/dist/doctorRuntime.js +1 -1
  101. package/dist/domain/analysisErrorPresentation.js +8 -2
  102. package/dist/domain/analysisErrorProjection.js +1 -0
  103. package/dist/domain/androidApplication.js +2 -0
  104. package/dist/domain/appleApplication.js +2 -0
  105. package/dist/domain/binaryTarget.js +7 -5
  106. package/dist/domain/binaryTargetTypes.js +1 -0
  107. package/dist/domain/browserCaptureComparison.js +21 -69
  108. package/dist/domain/browserObservation.js +22 -9
  109. package/dist/domain/bytecodeProvider.js +177 -0
  110. package/dist/domain/callPath.js +3 -2
  111. package/dist/domain/conformancePackage.js +169 -0
  112. package/dist/domain/conformanceReplay.js +104 -0
  113. package/dist/domain/conformanceTrustGate.js +328 -0
  114. package/dist/domain/customProtocolCapture.js +137 -0
  115. package/dist/domain/electronActiveObservation.js +277 -0
  116. package/dist/domain/electronObservation.js +15 -11
  117. package/dist/domain/electronStaticAnalysisValues.js +4 -1
  118. package/dist/domain/eventProcessTree.js +217 -0
  119. package/dist/domain/evidenceBundle.js +47 -0
  120. package/dist/domain/functionComparisonNormalization.js +15 -8
  121. package/dist/domain/functionDossierEvidence.js +9 -4
  122. package/dist/domain/hopperStartupFailure.js +1 -1
  123. package/dist/domain/hopperValues.js +68 -68
  124. package/dist/domain/inputIssueProjection.js +11 -2
  125. package/dist/domain/investigationWorkspace.js +16 -15
  126. package/dist/domain/javascriptExportShapeComparisonSchemas.js +2 -2
  127. package/dist/domain/javascriptReplay.js +79 -63
  128. package/dist/domain/javascriptRuntimeObservation.js +1 -0
  129. package/dist/domain/javascriptRuntimeReconciliationActive.js +89 -0
  130. package/dist/domain/javascriptRuntimeReconciliationGraph.js +11 -10
  131. package/dist/domain/javascriptRuntimeReconciliationMatching.js +57 -49
  132. package/dist/domain/javascriptRuntimeReconciliationParsing.js +5 -1
  133. package/dist/domain/javascriptRuntimeReconciliationResult.js +21 -14
  134. package/dist/domain/javascriptRuntimeReconciliationSchemas.js +1 -1
  135. package/dist/domain/javascriptSemanticAnalysis.js +8 -12
  136. package/dist/domain/javascriptSourceParser.js +15 -0
  137. package/dist/domain/javascriptStaticAnalysis.js +8 -12
  138. package/dist/domain/knownPageCoverage.js +15 -7
  139. package/dist/domain/mobileApplicationInvestigation.js +159 -0
  140. package/dist/domain/nativeApiBoundary.js +138 -0
  141. package/dist/domain/nodeRuntimeCharacterization.js +14 -13
  142. package/dist/domain/objcSwiftMetadata.js +150 -0
  143. package/dist/domain/packageAnalysis.js +123 -0
  144. package/dist/domain/peInspection.js +196 -0
  145. package/dist/domain/processCaptureReactiveValidation.js +8 -3
  146. package/dist/domain/processCaptureValidation.js +7 -3
  147. package/dist/domain/processComparison.js +12 -7
  148. package/dist/domain/processObservation.js +5 -6
  149. package/dist/domain/processReactiveMatching.js +14 -7
  150. package/dist/domain/processReactiveTransition.js +9 -3
  151. package/dist/domain/processScenario.js +6 -3
  152. package/dist/domain/processTraceComparison.js +3 -2
  153. package/dist/domain/protocolCapture.js +245 -0
  154. package/dist/domain/reconstructionReadinessSchemas.js +30 -2
  155. package/dist/domain/referenceSourceImportParsing.js +2 -2
  156. package/dist/domain/replayMachineRuntime.js +5 -3
  157. package/dist/domain/sourceToBundleComparison.js +2 -2
  158. package/dist/domain/sourceToBundleComparisonSchemas.js +8 -8
  159. package/dist/domain/sourceToBundleSignals.js +7 -1
  160. package/dist/domain/staticRuntimeCorrelation.js +7 -5
  161. package/dist/domain/webBundleAnalysis.js +14 -14
  162. package/dist/domain/webCaptureDiff.js +15 -12
  163. package/dist/dotnet/ManagedNativeBoundaryInspector.js +2 -3
  164. package/dist/dotnet/ManagedStaticProvider.js +34 -5
  165. package/dist/generatedMcpToolCatalog.js +37 -0
  166. package/dist/generatedPackageMetadata.js +4 -4
  167. package/dist/ghidra/GhidraClient.js +1 -1
  168. package/dist/ghidra/GhidraClientStartup.js +1 -1
  169. package/dist/ghidra/GhidraDefaults.js +1 -1
  170. package/dist/ghidra/GhidraFunctionValues.js +44 -16
  171. package/dist/ghidra/GhidraInventoryValues.js +57 -47
  172. package/dist/ghidra/GhidraProvider.js +18 -10
  173. package/dist/ghidra/GhidraProviderCapabilities.js +45 -39
  174. package/dist/ghidra/GhidraSocketConnection.js +1 -1
  175. package/dist/ghidra/protocol.js +19 -42
  176. package/dist/hopper/BridgeLauncher.js +3 -1
  177. package/dist/hopper/HopperAnalysisProfile.js +2 -4
  178. package/dist/hopper/HopperCleanup.js +5 -6
  179. package/dist/hopper/HopperClient.js +27 -3
  180. package/dist/hopper/HopperProvider.js +42 -44
  181. package/dist/hopper/HopperRequestQueue.js +32 -4
  182. package/dist/hopper/HopperResponseStream.js +2 -2
  183. package/dist/hopper/LinuxPrivateDisplayProbe.js +16 -10
  184. package/dist/hopper/protocol.js +63 -21
  185. package/dist/main/reload.js +1 -6
  186. package/dist/main/state.js +0 -14
  187. package/dist/main/transport.js +31 -41
  188. package/dist/main.js +17 -13
  189. package/dist/mcpDoctor.js +4 -26
  190. package/dist/mcpStartupPolicy.js +14 -0
  191. package/dist/process/PrivateRuntimeRoot.js +17 -0
  192. package/dist/process/ProcessOwnership.js +64 -128
  193. package/dist/process/ProcessOwnershipIdentity.js +13 -0
  194. package/dist/process/ProcessOwnershipObservation.js +88 -0
  195. package/dist/process/ProcessOwnershipProcessTree.js +22 -0
  196. package/dist/process/ProviderDeadline.js +8 -12
  197. package/dist/process/WindowsAuthority.js +32 -0
  198. package/dist/reference/ReferenceSourceReader.js +3 -3
  199. package/dist/reference/ReferenceSourceReaderEntries.js +2 -2
  200. package/dist/replay/JavaScriptReplayWorker.js +95 -11
  201. package/dist/replay/JavaScriptReplayWorkerTypes.js +1 -0
  202. package/dist/replay/LinuxJavaScriptReplayRunner.js +10 -15
  203. package/dist/replay/ReplayOutcome.js +26 -15
  204. package/dist/replay/ReplayWorkerProtocol.js +34 -29
  205. package/dist/server/createServer.js +101 -144
  206. package/dist/server/mcpClientMetadata.js +32 -0
  207. package/dist/server/registerApplicationTools/characterization.js +6 -13
  208. package/dist/server/registerApplicationTools/compareExportShapes.js +2 -7
  209. package/dist/server/registerApplicationTools/compareSourceToBundle.js +2 -7
  210. package/dist/server/registerApplicationTools/compareVersions.js +3 -8
  211. package/dist/server/registerApplicationTools/controlledReplay.js +6 -11
  212. package/dist/server/registerApplicationTools/coverage.js +13 -19
  213. package/dist/server/registerApplicationTools/obligationLedger.js +1 -6
  214. package/dist/server/registerApplicationTools/readiness.js +1 -6
  215. package/dist/server/registerApplicationTools/traceFeature.js +3 -8
  216. package/dist/server/registerApplicationTools/traceSemantics.js +1 -6
  217. package/dist/server/registerArtifactComparisonTool.js +12 -16
  218. package/dist/server/registerBrowserScenarioTool.js +1 -6
  219. package/dist/server/registerBrowserTools.js +37 -79
  220. package/dist/server/registerBundleComparisonTool.js +10 -14
  221. package/dist/server/registerCloseLifecycleTool.js +6 -14
  222. package/dist/server/registerElectronTools.js +30 -47
  223. package/dist/server/registerEnhancedTools.js +124 -122
  224. package/dist/server/registerEvidenceResources.js +50 -101
  225. package/dist/server/registerEvidenceTools.js +5 -9
  226. package/dist/server/registerFunctionComparisonTool.js +11 -15
  227. package/dist/server/registerInvestigationTools.js +42 -59
  228. package/dist/server/registerJavaScriptApplicationGraphResource.js +0 -4
  229. package/dist/server/registerJavaScriptRuntimeObservationTools.js +13 -27
  230. package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +4 -9
  231. package/dist/server/registerManagedWorkflowTools/contract.js +2 -3
  232. package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -8
  233. package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +3 -8
  234. package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +8 -13
  235. package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +4 -9
  236. package/dist/server/registerOfficialTools.js +8 -9
  237. package/dist/server/registerProcessComparisonTool.js +19 -24
  238. package/dist/server/registerReconstructionObligationLedgerResource.js +0 -7
  239. package/dist/server/registerReconstructionReadinessResource.js +0 -7
  240. package/dist/server/registerReplayMachineTool.js +4 -10
  241. package/dist/server/registerSessionRecordTools.js +146 -47
  242. package/dist/server/registerSessionStatusTool.js +14 -29
  243. package/dist/server/registerSessionTools.js +45 -41
  244. package/dist/server/sessionAvailabilityPolicy.js +2 -1
  245. package/dist/server/sessionToolPolicies.js +1 -5
  246. package/dist/server/toolRegistrationOptions.js +4 -177
  247. package/dist/server/toolResult.js +14 -18
  248. package/package.json +35 -16
  249. package/scripts/electron-active-hook-boundaries.cjs +394 -0
  250. package/scripts/electron-active-hook.cjs +501 -0
  251. package/skills/reverse-engineer-anything/SKILL.md +10 -3
  252. package/dist/server/DynamicToolAvailability.js +0 -70
  253. package/dist/server/toolInputValidation.js +0 -77
@@ -9,21 +9,7 @@ const evidenceIdSchema = z
9
9
  .string()
10
10
  .regex(/^ev_[a-f0-9]{64}$/u)
11
11
  .describe("Evidence ID returned earlier in this session");
12
- const requireExactlyOne = (context, fields) => {
13
- const [leftName, left, rightName, right] = fields;
14
- if ((left === undefined) !== (right === undefined))
15
- return;
16
- context.addIssue({
17
- code: "custom",
18
- path: [left === undefined ? leftName : rightName],
19
- message: `Supply exactly one of ${leftName} or ${rightName}`,
20
- });
21
- };
22
- /** MCP/CLI trace request accepting full Evidence or a ledger reference. */
23
- export const traceApplicationFeatureRequestSchema = z
24
- .strictObject({
25
- application: evidenceSchema.optional(),
26
- application_evidence_id: evidenceIdSchema.optional(),
12
+ const traceApplicationFeatureFacts = {
27
13
  native_observations: traceApplicationFeatureInputSchema.shape.native_observations,
28
14
  native_observation_evidence_ids: z
29
15
  .array(evidenceIdSchema)
@@ -32,37 +18,30 @@ export const traceApplicationFeatureRequestSchema = z
32
18
  seed: traceApplicationFeatureInputSchema.shape.seed,
33
19
  direction: traceApplicationFeatureInputSchema.shape.direction,
34
20
  limits: traceApplicationFeatureInputSchema.shape.limits,
35
- })
36
- .superRefine((input, context) => {
37
- requireExactlyOne(context, [
38
- "application",
39
- input.application,
40
- "application_evidence_id",
41
- input.application_evidence_id,
42
- ]);
43
- });
21
+ };
22
+ /** MCP/CLI trace request accepting full Evidence or a ledger reference. */
23
+ export const traceApplicationFeatureRequestSchema = z.union([
24
+ z.strictObject({
25
+ ...traceApplicationFeatureFacts,
26
+ application: evidenceSchema,
27
+ }),
28
+ z.strictObject({
29
+ ...traceApplicationFeatureFacts,
30
+ application_evidence_id: evidenceIdSchema,
31
+ }),
32
+ ]);
44
33
  /** MCP/CLI semantic trace request accepting full Evidence or a ledger reference. */
45
- export const traceJavaScriptSemanticsRequestSchema = z
46
- .strictObject({
47
- application: evidenceSchema.optional(),
48
- application_evidence_id: evidenceIdSchema.optional(),
49
- query: javaScriptSemanticQueryInputSchema,
50
- })
51
- .superRefine((input, context) => {
52
- requireExactlyOne(context, [
53
- "application",
54
- input.application,
55
- "application_evidence_id",
56
- input.application_evidence_id,
57
- ]);
58
- });
59
- /** MCP/CLI comparison request accepting full Evidence or ledger references. */
60
- export const compareApplicationVersionsRequestSchema = z
61
- .strictObject({
62
- left: evidenceSchema.optional(),
63
- left_evidence_id: evidenceIdSchema.optional(),
64
- right: evidenceSchema.optional(),
65
- right_evidence_id: evidenceIdSchema.optional(),
34
+ export const traceJavaScriptSemanticsRequestSchema = z.union([
35
+ z.strictObject({
36
+ application: evidenceSchema,
37
+ query: javaScriptSemanticQueryInputSchema,
38
+ }),
39
+ z.strictObject({
40
+ application_evidence_id: evidenceIdSchema,
41
+ query: javaScriptSemanticQueryInputSchema,
42
+ }),
43
+ ]);
44
+ const compareApplicationVersionsFacts = {
66
45
  left_native_observations: compareApplicationVersionsInputSchema.shape.left_native_observations,
67
46
  left_native_observation_evidence_ids: z
68
47
  .array(evidenceIdSchema)
@@ -75,63 +54,74 @@ export const compareApplicationVersionsRequestSchema = z
75
54
  .default([]),
76
55
  limits: compareApplicationVersionsInputSchema.shape.limits,
77
56
  unknown_registry_approved: compareApplicationVersionsInputSchema.shape.unknown_registry_approved,
78
- })
79
- .superRefine((input, context) => {
80
- requireExactlyOne(context, [
81
- "left",
82
- input.left,
83
- "left_evidence_id",
84
- input.left_evidence_id,
85
- ]);
86
- requireExactlyOne(context, [
87
- "right",
88
- input.right,
89
- "right_evidence_id",
90
- input.right_evidence_id,
91
- ]);
92
- });
93
- /** Historical-source comparison accepting full application Evidence or a ledger reference. */
94
- export const compareSourceToBundleRequestSchema = z
95
- .strictObject({
57
+ };
58
+ /** MCP/CLI comparison request accepting full Evidence or ledger references. */
59
+ export const compareApplicationVersionsRequestSchema = z.union([
60
+ z.strictObject({
61
+ ...compareApplicationVersionsFacts,
62
+ left: evidenceSchema,
63
+ right: evidenceSchema,
64
+ }),
65
+ z.strictObject({
66
+ ...compareApplicationVersionsFacts,
67
+ left: evidenceSchema,
68
+ right_evidence_id: evidenceIdSchema,
69
+ }),
70
+ z.strictObject({
71
+ ...compareApplicationVersionsFacts,
72
+ left_evidence_id: evidenceIdSchema,
73
+ right: evidenceSchema,
74
+ }),
75
+ z.strictObject({
76
+ ...compareApplicationVersionsFacts,
77
+ left_evidence_id: evidenceIdSchema,
78
+ right_evidence_id: evidenceIdSchema,
79
+ }),
80
+ ]);
81
+ const compareSourceToBundleFacts = {
96
82
  reference: compareSourceToBundleInputSchema.shape.reference,
97
- application: evidenceSchema.optional(),
98
- application_evidence_id: evidenceIdSchema.optional(),
99
83
  limits: compareSourceToBundleInputSchema.shape.limits,
100
84
  unknown_registry_approved: compareSourceToBundleInputSchema.shape.unknown_registry_approved,
101
- })
102
- .superRefine((input, context) => {
103
- requireExactlyOne(context, [
104
- "application",
105
- input.application,
106
- "application_evidence_id",
107
- input.application_evidence_id,
108
- ]);
109
- });
110
- /** MCP/CLI export-shape request accepting full Evidence or ledger references. */
111
- export const compareJavaScriptExportShapesRequestSchema = z
112
- .strictObject({
113
- left: evidenceSchema.optional(),
114
- left_evidence_id: evidenceIdSchema.optional(),
115
- right: evidenceSchema.optional(),
116
- right_evidence_id: evidenceIdSchema.optional(),
85
+ };
86
+ /** Historical-source comparison accepting full application Evidence or a ledger reference. */
87
+ export const compareSourceToBundleRequestSchema = z.union([
88
+ z.strictObject({
89
+ ...compareSourceToBundleFacts,
90
+ application: evidenceSchema,
91
+ }),
92
+ z.strictObject({
93
+ ...compareSourceToBundleFacts,
94
+ application_evidence_id: evidenceIdSchema,
95
+ }),
96
+ ]);
97
+ const compareJavaScriptExportShapesFacts = {
117
98
  left_module_path: compareJavaScriptExportShapesInputSchema.shape.left_module_path,
118
99
  left_export_name: compareJavaScriptExportShapesInputSchema.shape.left_export_name,
119
100
  right_module_path: compareJavaScriptExportShapesInputSchema.shape.right_module_path,
120
101
  right_export_name: compareJavaScriptExportShapesInputSchema.shape.right_export_name,
121
102
  limits: compareJavaScriptExportShapesInputSchema.shape.limits,
122
103
  unknown_registry_approved: compareJavaScriptExportShapesInputSchema.shape.unknown_registry_approved,
123
- })
124
- .superRefine((input, context) => {
125
- requireExactlyOne(context, [
126
- "left",
127
- input.left,
128
- "left_evidence_id",
129
- input.left_evidence_id,
130
- ]);
131
- requireExactlyOne(context, [
132
- "right",
133
- input.right,
134
- "right_evidence_id",
135
- input.right_evidence_id,
136
- ]);
137
- });
104
+ };
105
+ /** MCP/CLI export-shape request accepting full Evidence or ledger references. */
106
+ export const compareJavaScriptExportShapesRequestSchema = z.union([
107
+ z.strictObject({
108
+ ...compareJavaScriptExportShapesFacts,
109
+ left: evidenceSchema,
110
+ right: evidenceSchema,
111
+ }),
112
+ z.strictObject({
113
+ ...compareJavaScriptExportShapesFacts,
114
+ left: evidenceSchema,
115
+ right_evidence_id: evidenceIdSchema,
116
+ }),
117
+ z.strictObject({
118
+ ...compareJavaScriptExportShapesFacts,
119
+ left_evidence_id: evidenceIdSchema,
120
+ right: evidenceSchema,
121
+ }),
122
+ z.strictObject({
123
+ ...compareJavaScriptExportShapesFacts,
124
+ left_evidence_id: evidenceIdSchema,
125
+ right_evidence_id: evidenceIdSchema,
126
+ }),
127
+ ]);
@@ -1,7 +1,9 @@
1
+ import { isAbsolute } from "node:path";
1
2
  import { z } from "zod";
2
3
  import { artifactOutputSchemas } from "./toolOutputSchemas.js";
3
4
  import { jsonValueSchema } from "../domain/jsonValue.js";
4
5
  import { toolContractMetadata } from "./toolEffects.js";
6
+ import { requireOutputSchema } from "./toolOutputSchemaPrimitives.js";
5
7
  import { artifactInspectionLimitsSchema } from "../domain/artifactInspection.js";
6
8
  const pageInput = {
7
9
  node_offset: z.number().int().min(0).default(0),
@@ -29,29 +31,36 @@ const traversalLimitsInput = {
29
31
  max_depth: z.number().int().min(0).max(100).default(20),
30
32
  max_path_bytes: z.number().int().min(1).max(65_535).default(4_096),
31
33
  };
32
- /** Exact caller boundary for deterministic artifact inventory. */
33
- export const artifactInventoryInputSchema = z
34
- .object({
34
+ const integrityInput = {
35
+ fail: {
36
+ integrity_policy: z.literal("fail").default("fail"),
37
+ integrity_continue_approved: z.literal(false).default(false),
38
+ max_integrity_mismatches: z.number().int().min(1).max(100).default(10),
39
+ },
40
+ continue: {
41
+ integrity_policy: z.literal("record-and-continue"),
42
+ integrity_continue_approved: z.literal(true),
43
+ max_integrity_mismatches: z.number().int().min(1).max(100).default(10),
44
+ },
45
+ };
46
+ const artifactInventoryFacts = {
35
47
  native_mount_approved: z.boolean().default(false),
36
- integrity_policy: z.enum(["fail", "record-and-continue"]).default("fail"),
37
- integrity_continue_approved: z.boolean().default(false),
38
- max_integrity_mismatches: z.number().int().min(1).max(100).default(10),
39
48
  ...pageInput,
40
49
  ...traversalLimitsInput,
41
- })
42
- .superRefine((input, context) => {
43
- if (input.integrity_policy === "record-and-continue" &&
44
- input.integrity_continue_approved !== true)
45
- context.addIssue({
46
- code: "custom",
47
- path: ["integrity_continue_approved"],
48
- message: "record-and-continue requires explicit approval",
49
- });
50
- });
50
+ };
51
+ /** Exact caller boundary for deterministic artifact inventory. */
52
+ export const artifactInventoryInputSchema = z.union([
53
+ z.object({ ...artifactInventoryFacts, ...integrityInput.fail }),
54
+ z.object({ ...artifactInventoryFacts, ...integrityInput.continue }),
55
+ ]);
51
56
  /** Exact caller boundary for approved artifact extraction. */
52
57
  export const artifactExtractionInputSchema = z.object({
53
58
  approved: z.literal(true),
54
- output_root: z.string().min(1).max(4_096),
59
+ output_root: z
60
+ .string()
61
+ .min(1)
62
+ .max(4_096)
63
+ .refine(isAbsolute, "Extraction output root must be absolute"),
55
64
  occurrence_ids: z
56
65
  .array(z.string().regex(/^occ_[a-f0-9]{64}$/u))
57
66
  .min(1)
@@ -61,24 +70,15 @@ export const artifactExtractionInputSchema = z.object({
61
70
  ...traversalLimitsInput,
62
71
  });
63
72
  /** Bounded provider-neutral inspection using one atomic inventory substep. */
64
- export const artifactInspectionInputSchema = z
65
- .object({
73
+ const artifactInspectionFacts = {
66
74
  native_mount_approved: z.boolean().default(false),
67
- integrity_policy: z.enum(["fail", "record-and-continue"]).default("fail"),
68
- integrity_continue_approved: z.boolean().default(false),
69
- max_integrity_mismatches: z.number().int().min(1).max(100).default(10),
70
75
  ...artifactInspectionLimitsSchema.shape,
71
76
  ...traversalLimitsInput,
72
- })
73
- .superRefine((input, context) => {
74
- if (input.integrity_policy === "record-and-continue" &&
75
- input.integrity_continue_approved !== true)
76
- context.addIssue({
77
- code: "custom",
78
- path: ["integrity_continue_approved"],
79
- message: "record-and-continue requires explicit approval",
80
- });
81
- });
77
+ };
78
+ export const artifactInspectionInputSchema = z.union([
79
+ z.object({ ...artifactInspectionFacts, ...integrityInput.fail }),
80
+ z.object({ ...artifactInspectionFacts, ...integrityInput.continue }),
81
+ ]);
82
82
  const exampleInputSchema = z.record(z.string(), jsonValueSchema);
83
83
  const examples = {
84
84
  inventory_artifact: {},
@@ -90,9 +90,7 @@ const examples = {
90
90
  },
91
91
  };
92
92
  const artifact = (name, description, inputSchema) => {
93
- const outputSchema = artifactOutputSchemas[name];
94
- if (outputSchema === undefined)
95
- throw new Error(`Missing artifact output schema for ${name}`);
93
+ const outputSchema = requireOutputSchema(artifactOutputSchemas, name);
96
94
  return {
97
95
  name,
98
96
  ...toolContractMetadata(name),
@@ -110,7 +108,7 @@ const artifact = (name, description, inputSchema) => {
110
108
  };
111
109
  /** Artifact-graph inventory and explicitly approved safe extraction contracts. */
112
110
  export const ARTIFACT_TOOL_CONTRACTS = [
113
- artifact("inventory_artifact", "Inventory the active application or package as a deterministic, content-addressed artifact graph. Returns bounded node and edge pages without extracting or mounting by default.", artifactInventoryInputSchema),
114
- artifact("inspect_artifact", "Inspect the active artifact through one bounded, cancellable inventory substep. Returns the full substep Evidence and its ID, observations, derived relationships, hypotheses, contradictions, unexplored branches, limitations, and format-specific next probes. Any substep failure fails the whole call.", artifactInspectionInputSchema),
111
+ artifact("inventory_artifact", "After open_binary binds a local archive, application package, or other artifact—or when one is already active—inventory it as a deterministic, content-addressed artifact graph. This tool accepts no path; in a target-free session open the target first. Returns bounded node and edge pages without extracting or mounting by default.", artifactInventoryInputSchema),
112
+ artifact("inspect_artifact", "After open_binary binds a local archive, application package, or other artifact—or when one is already active—inspect it through one bounded, cancellable inventory substep. This tool accepts no path; in a target-free session open the target first. Returns the full substep Evidence and its ID, observations, derived relationships, hypotheses, contradictions, unexplored branches, limitations, and format-specific next probes. Any substep failure fails the whole call.", artifactInspectionInputSchema),
115
113
  artifact("extract_artifact", "Extract selected graph artifacts beneath an explicit output root. Requires approval, rejects traversal and symlink escapes, never overwrites, enforces bomb limits, and verifies cleanup.", artifactExtractionInputSchema),
116
114
  ];
@@ -2,7 +2,7 @@ import { browserTargetListSchema, inspectWebPageInputSchema, listBrowserTargetsI
2
2
  import { analyzeWebBundleInputSchema, webBundleAnalysisSchema, } from "../domain/webBundleAnalysis.js";
3
3
  import { observeWebSessionInputSchema, webObservationSessionSchema, } from "../domain/browserSession.js";
4
4
  import { discoverWebMcpToolsInputSchema, webMcpDiscoverySchema, } from "../domain/webMcpDiscovery.js";
5
- import { browserCaptureComparisonWireSchema, browserCaptureComparisonSchema, } from "../domain/browserCaptureComparison.js";
5
+ import { browserCaptureComparisonInputSchema, browserCaptureComparisonSchema, } from "../domain/browserCaptureComparison.js";
6
6
  import { captureWebScreenshotInputSchema, compareWebScreenshotsInputSchema, webScreenshotDiffSchema, webScreenshotSchema, } from "../domain/webScreenshot.js";
7
7
  import { toolContractMetadata } from "./toolEffects.js";
8
8
  import { evidenceResultOf } from "./toolOutputSchemas.js";
@@ -248,7 +248,7 @@ export const BROWSER_TOOL_CONTRACTS = [
248
248
  ...toolContractMetadata("compare_web_captures"),
249
249
  description: "Compare either passive web captures or step-indexed browser scenarios. Scenario comparison aligns exact step IDs, records deterministic literal normalization, and exposes bounded artifact-level changes plus alignment failures. Missing or truncated evidence never proves equality.",
250
250
  kind: "browser-provider",
251
- inputSchema: browserCaptureComparisonWireSchema,
251
+ inputSchema: browserCaptureComparisonInputSchema,
252
252
  outputSchema: captureDiffOutputSchema,
253
253
  examples: [
254
254
  {
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { toolContractMetadata } from "./toolEffects.js";
3
3
  import { evidenceResultOf } from "./toolOutputSchemas.js";
4
4
  import { electronPageInspectionSchema, electronTargetListSchema, inspectElectronPageInputSchema, listElectronTargetsInputSchema, } from "../domain/electronObservation.js";
5
+ import { electronActiveObservationInputSchema, electronActiveObservationResultSchema, } from "../domain/electronActiveObservation.js";
5
6
  import { analyzeJavaScriptApplicationInputSchema, javaScriptApplicationAnalysisResultV1Schema, javascriptApplicationAnalysisResultSchema, } from "../domain/javascriptApplicationAnalysis.js";
6
7
  import { JAVASCRIPT_APPLICATION_NODE_KINDS } from "../domain/javascriptApplicationGraphSchemas.js";
7
8
  import { applicationCoverageSchema } from "../domain/javascriptApplicationEvidenceSchemas.js";
@@ -78,6 +79,23 @@ const applicationOutputSchema = evidenceResultOf(z.union([
78
79
  const reconciliationOutputSchema = evidenceResultOf(javascriptRuntimeReconciliationResultSchema);
79
80
  const endpoint = "http://127.0.0.1:9223";
80
81
  const root = "/Applications/Example.app/Contents/Resources";
82
+ const activeExample = {
83
+ schema_version: 1,
84
+ executable_path: "/Applications/Electron.app/Contents/MacOS/Electron",
85
+ application_path: "/Applications/Example.app/Contents/Resources/main.js",
86
+ application_root: "/Applications/Example.app/Contents/Resources",
87
+ args: [],
88
+ actions: [{ step_id: "exercise-ipc", kind: "click", selector: "#run" }],
89
+ limits: {
90
+ max_duration_ms: 60_000,
91
+ action_timeout_ms: 5_000,
92
+ max_actions: 20,
93
+ max_ipc_events: 2_000,
94
+ max_processes: 32,
95
+ max_windows: 32,
96
+ },
97
+ approved: true,
98
+ };
81
99
  /** Root-confined Electron file-page discovery and inspection contracts. */
82
100
  export const ELECTRON_TOOL_CONTRACTS = [
83
101
  {
@@ -154,7 +172,7 @@ export const ELECTRON_TOOL_CONTRACTS = [
154
172
  {
155
173
  name: "reconcile_javascript_runtime",
156
174
  ...toolContractMetadata("reconcile_javascript_runtime"),
157
- description: "Reconcile verified static JavaScript application graphs with existing passive web or Electron CDP Evidence. Exact captured-source digests take priority over caller-declared file/URL mappings; target, frame, script, and worker ambiguity remains explicit, and source-map authority stays separate.",
175
+ description: "Reconcile verified static JavaScript application graphs with existing passive web/Electron CDP, passive V8 Inspector, or provider-owned active Electron Evidence. Active Electron captures contribute an explicitly partial target-only runtime record; they never invent renderer scripts, frames, workers, or execution claims. Exact captured-source digests take priority over caller-declared file/URL mappings; target, frame, script, and worker ambiguity remains explicit, and source-map authority stays separate.",
158
176
  kind: "electron-provider",
159
177
  inputSchema: reconcileJavaScriptRuntimeInputSchema,
160
178
  outputSchema: reconciliationOutputSchema,
@@ -165,4 +183,15 @@ export const ELECTRON_TOOL_CONTRACTS = [
165
183
  },
166
184
  ],
167
185
  },
186
+ {
187
+ name: "capture_electron_scenario",
188
+ ...toolContractMetadata("capture_electron_scenario"),
189
+ description: "Use this for an explicitly approved, provider-owned Electron run when passive CDP or Inspector observation cannot exercise application behavior. REA owns startup and teardown, accepts bounded click/wait actions plus window-targeted renderer reload/crash and synthetic open-url/second-instance delivery, and returns correlated window/WebContents/process/preload/session/navigation/shell/IPC evidence without retaining payload values. Results identify observed and unavailable event families, coverage status, action targets, and truncation. External shell, navigation, permission, download, popup, updater, and OS-integration effects are blocked and recorded. Use passive Electron tools for observation-only work.",
190
+ kind: "electron-provider",
191
+ inputSchema: electronActiveObservationInputSchema,
192
+ outputSchema: evidenceResultOf(electronActiveObservationResultSchema),
193
+ examples: [
194
+ { title: "Exercise an owned Electron application", input: activeExample },
195
+ ],
196
+ },
168
197
  ];
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- const traceLiteralInputSchema = z.object({
2
+ const traceLiteralInputSchema = z.strictObject({
3
3
  query: z.string().min(1),
4
4
  case_sensitive: z.boolean().default(false),
5
5
  limit: z.number().int().min(1).max(100).default(20),
@@ -11,27 +11,27 @@ const traceLiteralInputSchema = z.object({
11
11
  });
12
12
  /** Input schemas shared by MCP registration and enhanced application dispatch. */
13
13
  export const enhancedInputSchemas = {
14
- swift_classes: z.object({ pattern: z.string().default("") }),
15
- get_objc_classes: z.object({ pattern: z.string().default("") }),
16
- get_objc_protocols: z.object({}),
17
- batch_decompile: z.object({
14
+ swift_classes: z.strictObject({ pattern: z.string().default("") }),
15
+ get_objc_classes: z.strictObject({ pattern: z.string().default("") }),
16
+ get_objc_protocols: z.strictObject({}),
17
+ batch_decompile: z.strictObject({
18
18
  addresses: z
19
19
  .array(z.string().describe("A provider-normalized procedure address"))
20
20
  .max(20)
21
21
  .default([]),
22
22
  }),
23
- get_call_graph: z.object({
23
+ get_call_graph: z.strictObject({
24
24
  address: z.string().describe("A provider-normalized procedure address"),
25
25
  direction: z.enum(["forward", "backward"]).default("forward"),
26
26
  depth: z.number().int().min(1).max(5).default(2),
27
27
  }),
28
- analyze_swift_types: z.object({}),
29
- find_xrefs_to_name: z.object({ name: z.string() }),
30
- binary_overview: z.object({
28
+ analyze_swift_types: z.strictObject({}),
29
+ find_xrefs_to_name: z.strictObject({ name: z.string() }),
30
+ binary_overview: z.strictObject({
31
31
  detail: z.enum(["concise", "detailed"]).default("concise"),
32
32
  limit: z.number().int().min(1).max(50).default(10),
33
33
  }),
34
- analyze_function: z.object({
34
+ analyze_function: z.strictObject({
35
35
  procedure: z.string().describe("A procedure name or address"),
36
36
  include_assembly: z.boolean().default(false),
37
37
  limit: z.number().int().min(1).max(500).default(100),
@@ -40,7 +40,7 @@ export const enhancedInputSchemas = {
40
40
  pseudocode_offset: z.number().int().min(0).default(0),
41
41
  assembly_offset: z.number().int().min(0).default(0),
42
42
  collection_offset: z
43
- .object({
43
+ .strictObject({
44
44
  comments: z.number().int().min(0).default(0),
45
45
  callers: z.number().int().min(0).default(0),
46
46
  callees: z.number().int().min(0).default(0),
@@ -61,9 +61,18 @@ export const enhancedInputSchemas = {
61
61
  basic_blocks: 0,
62
62
  }),
63
63
  }),
64
+ inspect_native_api: z.strictObject({
65
+ procedure: z.string().describe("A procedure name or address"),
66
+ max_pseudocode_chars: z.number().int().min(1).max(100_000).default(20_000),
67
+ max_instructions: z.number().int().min(1).max(5_000).default(500),
68
+ unknown_registry_approved: z
69
+ .literal(true)
70
+ .optional()
71
+ .describe("Explicit approval to record unsupported native API branches durably"),
72
+ }),
64
73
  trace_feature: traceLiteralInputSchema,
65
74
  find_code_for_string: traceLiteralInputSchema,
66
- trace_call_path: z.object({
75
+ trace_call_path: z.strictObject({
67
76
  start: z.string().describe("A provider-normalized procedure address"),
68
77
  goal: z
69
78
  .string()
@@ -79,18 +88,3 @@ export const enhancedInputSchemas = {
79
88
  .describe("Explicit approval to record bounded residuals durably"),
80
89
  }),
81
90
  };
82
- /** Runtime parser for dispatching only the closed enhanced names. */
83
- export const enhancedToolNameSchema = z.enum([
84
- "swift_classes",
85
- "get_objc_classes",
86
- "get_objc_protocols",
87
- "batch_decompile",
88
- "get_call_graph",
89
- "analyze_swift_types",
90
- "find_xrefs_to_name",
91
- "binary_overview",
92
- "analyze_function",
93
- "trace_feature",
94
- "find_code_for_string",
95
- "trace_call_path",
96
- ]);
@@ -0,0 +1,29 @@
1
+ import { jsonObjectSchema } from "../domain/jsonValue.js";
2
+ import { enhancedInputSchemas } from "./enhancedInputs.js";
3
+ import { TOOL_EXAMPLE_OVERRIDES } from "./toolContractExamples.js";
4
+ import { toolContractMetadata } from "./toolEffects.js";
5
+ import { enhancedOutputSchemas } from "./toolOutputSchemas.js";
6
+ import { requireOutputSchema } from "./toolOutputSchemaPrimitives.js";
7
+ const functionWorkflow = (name, description) => {
8
+ const inputSchema = enhancedInputSchemas[name];
9
+ const outputSchema = requireOutputSchema(enhancedOutputSchemas, name);
10
+ return {
11
+ name,
12
+ ...toolContractMetadata(name),
13
+ description,
14
+ kind: "enhanced",
15
+ inputSchema,
16
+ outputSchema,
17
+ examples: [
18
+ {
19
+ title: `Example ${name.replaceAll("_", " ")} request`,
20
+ input: jsonObjectSchema.parse(inputSchema.parse(TOOL_EXAMPLE_OVERRIDES[name] ?? {})),
21
+ },
22
+ ],
23
+ };
24
+ };
25
+ /** Function dossier and native API reconstruction workflow contracts. */
26
+ export const FUNCTION_WORKFLOW_TOOL_CONTRACTS = [
27
+ functionWorkflow("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. Providers with a structured decompiler model also expose native API boundary types, confidence, evidence, jump-table data/target addresses, and explicit decompiler-artifact labels."),
28
+ functionWorkflow("inspect_native_api", "Reconstruct one native function boundary through inspectable substeps. Returns structured inferred return/parameter types with confidence and evidence, jump-table dispatch/data/target mappings, explicit decompiler-artifact labels, unsupported branches, and residual unknowns."),
29
+ ];
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { managedOutputSchemas } from "./toolOutputSchemas.js";
3
3
  import { toolContractMetadata } from "./toolEffects.js";
4
+ import { requireOutputSchema } from "./toolOutputSchemaPrimitives.js";
4
5
  /** Exact caller boundary for execution-free PE/CLI triage and identity. */
5
6
  export const managedArtifactInputSchema = z.object({
6
7
  path: z
@@ -102,15 +103,9 @@ export const managedNativeBoundaryInputSchema = z.object({
102
103
  .max(16_777_216)
103
104
  .default(1_048_576),
104
105
  });
105
- const outputSchema = managedOutputSchemas.inspect_managed_artifact;
106
- if (outputSchema === undefined)
107
- throw new Error("Missing managed output schema for inspect_managed_artifact");
108
- const memberOutputSchema = managedOutputSchemas.inspect_managed_members;
109
- if (memberOutputSchema === undefined)
110
- throw new Error("Missing managed output schema for inspect_managed_members");
111
- const nativeBoundaryOutputSchema = managedOutputSchemas.inspect_managed_native_boundaries;
112
- if (nativeBoundaryOutputSchema === undefined)
113
- throw new Error("Missing managed output schema for inspect_managed_native_boundaries");
106
+ const outputSchema = requireOutputSchema(managedOutputSchemas, "inspect_managed_artifact");
107
+ const memberOutputSchema = requireOutputSchema(managedOutputSchemas, "inspect_managed_members");
108
+ const nativeBoundaryOutputSchema = requireOutputSchema(managedOutputSchemas, "inspect_managed_native_boundaries");
114
109
  /** Read-only managed artifact contracts. */
115
110
  export const MANAGED_TOOL_CONTRACTS = [
116
111
  {
@@ -45,15 +45,18 @@ const emptyManagedMembers = (sha256, mvid) => ({
45
45
  coverage: { state: "complete", issues: [] },
46
46
  limitations: [],
47
47
  });
48
- const emptyPage = (limit) => ({
49
- items: [],
50
- offset: 0,
51
- limit,
52
- total: 0,
53
- returned: 0,
54
- dropped: 0,
55
- complete: true,
56
- });
48
+ const emptyPage = (limit) => {
49
+ const items = [];
50
+ return {
51
+ items,
52
+ offset: 0,
53
+ limit,
54
+ total: 0,
55
+ returned: 0,
56
+ dropped: 0,
57
+ complete: true,
58
+ };
59
+ };
57
60
  const evidence = (result) => createEvidence(undefined, MANAGED_STATIC_EXAMPLE_PROVIDER, {
58
61
  operation: "inspect_managed_members",
59
62
  parameters: {},