rea-agents 1.7.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -31
- package/dist/application/CapabilityInventory.js +18 -0
- package/dist/application/CrossVersionInvestigation.js +10 -6
- package/dist/application/Doctor.js +56 -6
- package/dist/application/ElectronBoundaryAnalysis.js +96 -0
- package/dist/application/ElectronBoundaryGraph.js +9 -0
- package/dist/application/ElectronBoundaryGraphContext.js +62 -0
- package/dist/application/ElectronBoundaryGraphIpc.js +242 -0
- package/dist/application/ElectronBoundaryGraphNative.js +86 -0
- package/dist/application/ElectronBoundaryGraphWindows.js +199 -0
- package/dist/application/EnhancedTools.js +38 -13
- package/dist/application/InvestigationProviders.js +30 -0
- package/dist/application/JavaScriptApplicationEvidence.js +26 -0
- package/dist/application/JavaScriptApplicationEvidenceGraph.js +89 -0
- package/dist/application/JavaScriptApplicationService.js +74 -0
- package/dist/application/JavaScriptApplicationWorkflowEvidence.js +29 -0
- package/dist/application/JavaScriptApplicationWorkflowService.js +90 -0
- package/dist/application/JavaScriptArtifactAnalysis.js +7 -1
- package/dist/application/JavaScriptArtifactGraphBuilder.js +59 -16
- package/dist/application/JavaScriptArtifactGraphEvidence.js +24 -14
- package/dist/application/JavaScriptArtifactReconstruction.js +3 -0
- package/dist/application/JavaScriptArtifactReconstructionInput.js +2 -83
- package/dist/application/JavaScriptReplayPlanning.js +201 -0
- package/dist/application/JavaScriptReplayService.js +266 -0
- package/dist/application/JavaScriptRuntimeReconciliationEvidence.js +25 -0
- package/dist/application/JavaScriptRuntimeReconciliationService.js +27 -0
- package/dist/application/ManagedApplicationGraphService.js +55 -0
- package/dist/application/ManagedMemberComparisonService.js +122 -0
- package/dist/application/ManagedNativeVerificationService.js +39 -0
- package/dist/application/ManagedReconstructionService.js +58 -0
- package/dist/application/ManagedRuntimeCorrelationService.js +103 -0
- package/dist/application/PermissionAuthority.js +1 -1
- package/dist/application/ProcessSampling.js +15 -11
- package/dist/application/ProjectPermissionStore.js +1 -0
- package/dist/application/runtime.js +2 -0
- package/dist/browser/CdpCaptureEvents.js +49 -0
- package/dist/browser/CdpElectronInspection.js +106 -162
- package/dist/browser/CdpElectronProvider.js +5 -1
- package/dist/browser/CdpElectronScriptEvents.js +69 -0
- package/dist/browser/CdpElectronScripts.js +94 -0
- package/dist/browser/CdpElectronWorkers.js +56 -0
- package/dist/browser/CdpPageCapture.js +8 -4
- package/dist/catalogIdentity.js +4 -1
- package/dist/cli.js +388 -0
- package/dist/cliApplicationCommands.js +62 -0
- package/dist/cliCommandNames.js +13 -0
- package/dist/cliElectronCommands.js +103 -1
- package/dist/cliJsonInput.js +54 -0
- package/dist/config.js +83 -0
- package/dist/contracts/applicationToolContracts.js +91 -0
- package/dist/contracts/artifactToolContracts.js +5 -9
- package/dist/contracts/browserToolContracts.js +14 -62
- package/dist/contracts/electronToolContracts.js +45 -19
- package/dist/contracts/errorSchemas.js +1 -0
- package/dist/contracts/investigationExamples.js +0 -6
- package/dist/contracts/javascriptApplicationWorkflowExamples.js +46 -0
- package/dist/contracts/javascriptRuntimeReconciliationExample.js +208 -0
- package/dist/contracts/managedToolContracts.js +153 -0
- package/dist/contracts/managedWorkflowExamples.js +346 -0
- package/dist/contracts/managedWorkflowToolContracts.js +203 -0
- package/dist/contracts/nativeToolContracts.js +2 -6
- package/dist/contracts/promptContracts.js +18 -2
- package/dist/contracts/toolContractExamples.js +10 -25
- package/dist/contracts/toolContracts.js +47 -45
- package/dist/contracts/toolEffects.js +160 -0
- package/dist/contracts/toolOutputSchemas.js +46 -31
- package/dist/doctorRuntime.js +42 -1
- package/dist/domain/artifactComparison.js +3 -4
- package/dist/domain/browserObservation.js +3 -0
- package/dist/domain/bundleComparison.js +4 -4
- package/dist/domain/electronObservation.js +13 -0
- package/dist/domain/electronStaticAnalysis.js +9 -0
- package/dist/domain/electronStaticAnalysisBrowser.js +194 -0
- package/dist/domain/electronStaticAnalysisIpc.js +171 -0
- package/dist/domain/electronStaticAnalysisNative.js +164 -0
- package/dist/domain/electronStaticAnalysisTypes.js +1 -0
- package/dist/domain/electronStaticAnalysisValues.js +103 -0
- package/dist/domain/errors.js +67 -1
- package/dist/domain/functionComparisonSchemas.js +3 -8
- package/dist/domain/inputIssueProjection.js +52 -0
- package/dist/domain/javascriptApplicationAnalysis.js +155 -0
- package/dist/domain/javascriptApplicationChangeGraph.js +231 -0
- package/dist/domain/javascriptApplicationEvidenceSchemas.js +18 -0
- package/dist/domain/javascriptApplicationGraph.js +2 -1
- package/dist/domain/javascriptApplicationGraphSchemas.js +7 -0
- package/dist/domain/javascriptApplicationVersionComparison.js +116 -0
- package/dist/domain/javascriptApplicationVersionComparisonSchemas.js +139 -0
- package/dist/domain/javascriptApplicationVersionItems.js +221 -0
- package/dist/domain/javascriptApplicationVersionKeys.js +170 -0
- package/dist/domain/javascriptFeatureSeed.js +140 -0
- package/dist/domain/javascriptFeatureTrace.js +232 -0
- package/dist/domain/javascriptFeatureTraceSchemas.js +136 -0
- package/dist/domain/javascriptFeatureTraversal.js +88 -0
- package/dist/domain/javascriptNativeHandoff.js +85 -0
- package/dist/domain/javascriptReplay.js +361 -0
- package/dist/domain/javascriptRuntimeLoadState.js +106 -0
- package/dist/domain/javascriptRuntimeReconciliation.js +42 -0
- package/dist/domain/javascriptRuntimeReconciliationGraph.js +169 -0
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +247 -0
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +160 -0
- package/dist/domain/javascriptRuntimeReconciliationResult.js +119 -0
- package/dist/domain/javascriptRuntimeReconciliationRuntime.js +316 -0
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +245 -0
- package/dist/domain/javascriptRuntimeStaticCandidates.js +191 -0
- package/dist/domain/javascriptStaticAnalysis.js +31 -43
- package/dist/domain/javascriptStaticAnalysisFindings.js +39 -0
- package/dist/domain/javascriptStaticAnalysisHelpers.js +10 -0
- package/dist/domain/javascriptStaticAnalysisState.js +6 -0
- package/dist/domain/managedApplicationGraph.js +556 -0
- package/dist/domain/managedArtifact.js +444 -0
- package/dist/domain/managedMemberComparison.js +565 -0
- package/dist/domain/managedNativeVerification.js +408 -0
- package/dist/domain/managedReconstruction.js +183 -0
- package/dist/domain/managedRuntimeCorrelation.js +175 -0
- package/dist/domain/reconstructionVerificationSchemas.js +1 -3
- package/dist/dotnet/ManagedArtifactInspector.js +318 -0
- package/dist/dotnet/ManagedMemberInspector.js +887 -0
- package/dist/dotnet/ManagedMetadataHeaps.js +131 -0
- package/dist/dotnet/ManagedMetadataInventory.js +368 -0
- package/dist/dotnet/ManagedMetadataLayout.js +322 -0
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +391 -0
- package/dist/dotnet/ManagedPeReader.js +157 -0
- package/dist/dotnet/ManagedReaderFailure.js +10 -0
- package/dist/dotnet/ManagedStaticProvider.js +203 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraProvider.js +6 -0
- package/dist/main.js +14 -0
- package/dist/replay/JavaScriptReplayWorker.js +286 -0
- package/dist/replay/LinuxJavaScriptReplayRunner.js +434 -0
- package/dist/replay/LinuxRuntimeClosure.js +46 -0
- package/dist/replay/LinuxSeccompPolicy.js +40 -0
- package/dist/replay/ReplayWorkerProtocol.js +55 -0
- package/dist/replay/SystemJavaScriptReplayHost.js +182 -0
- package/dist/server/createServer.js +52 -0
- package/dist/server/registerApplicationTools.js +115 -0
- package/dist/server/registerArtifactComparisonTool.js +16 -9
- package/dist/server/registerBrowserTools.js +33 -8
- package/dist/server/registerBundleComparisonTool.js +17 -20
- package/dist/server/registerElectronTools.js +45 -3
- package/dist/server/registerEnhancedTools.js +58 -13
- package/dist/server/registerEvidenceTools.js +5 -1
- package/dist/server/registerFunctionComparisonTool.js +14 -7
- package/dist/server/registerInvestigationTools.js +21 -17
- package/dist/server/registerManagedTools.js +6 -0
- package/dist/server/registerManagedWorkflowTools.js +277 -0
- package/dist/server/registerOfficialTools.js +8 -8
- package/dist/server/registerProcessComparisonTool.js +25 -47
- package/dist/server/registerSessionStatusTool.js +7 -7
- package/dist/server/registerSessionTools.js +51 -86
- package/dist/server/sessionEvidence.js +14 -19
- package/dist/server/toolInputValidation.js +77 -0
- package/dist/server/toolRegistrationOptions.js +79 -2
- package/dist/server/toolResult.js +25 -17
- package/package.json +12 -4
- package/scripts/rea.mjs +1 -1
- package/skills/rea-analysis/SKILL.md +59 -3
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { readFile, stat } from "node:fs/promises";
|
|
2
|
+
import { AnalysisInputError, projectAnalysisError } from "./domain/errors.js";
|
|
3
|
+
const MAX_JSON_INPUT_BYTES = 64 * 1_024 * 1_024;
|
|
4
|
+
/** Parse bounded inline JSON or one bounded local JSON file for a CLI workflow. */
|
|
5
|
+
export const parseCliJsonInput = async (value, operation) => {
|
|
6
|
+
const inline = parseJson(value);
|
|
7
|
+
if (inline !== undefined)
|
|
8
|
+
return { ok: true, value: inline };
|
|
9
|
+
if (["{", "["].includes(value.trimStart()[0] ?? ""))
|
|
10
|
+
return { ok: false, error: inputError(operation) };
|
|
11
|
+
try {
|
|
12
|
+
const metadata = await stat(value);
|
|
13
|
+
if (!metadata.isFile())
|
|
14
|
+
return jsonFileError(value, operation, "not-file");
|
|
15
|
+
if (metadata.size > MAX_JSON_INPUT_BYTES)
|
|
16
|
+
return jsonFileError(value, operation, "too-large");
|
|
17
|
+
const bytes = await readFile(value);
|
|
18
|
+
if (bytes.byteLength > MAX_JSON_INPUT_BYTES)
|
|
19
|
+
return jsonFileError(value, operation, "too-large");
|
|
20
|
+
const parsed = parseJson(bytes.toString("utf8"));
|
|
21
|
+
return parsed === undefined
|
|
22
|
+
? jsonFileError(value, operation, "invalid-json")
|
|
23
|
+
: { ok: true, value: parsed };
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return jsonFileError(value, operation, "read-failed");
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const parseJson = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
return JSON.parse(value);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const inputError = (operation) => ({
|
|
38
|
+
error: "Application workflow failed",
|
|
39
|
+
...projectAnalysisError(new AnalysisInputError(operation, undefined, [
|
|
40
|
+
{ path: [], reason: "invalid_format", expected: "JSON" },
|
|
41
|
+
])),
|
|
42
|
+
});
|
|
43
|
+
const jsonFileError = (path, operation, reason) => ({
|
|
44
|
+
ok: false,
|
|
45
|
+
error: {
|
|
46
|
+
error: "Application workflow failed",
|
|
47
|
+
...projectAnalysisError(new AnalysisInputError(operation, undefined, reason === "invalid-json"
|
|
48
|
+
? [{ path: [], reason: "invalid_format", expected: "JSON" }]
|
|
49
|
+
: [])),
|
|
50
|
+
input_path: path,
|
|
51
|
+
input_reason: reason,
|
|
52
|
+
maximum_input_bytes: MAX_JSON_INPUT_BYTES,
|
|
53
|
+
},
|
|
54
|
+
});
|
package/dist/config.js
CHANGED
|
@@ -55,6 +55,40 @@ const environmentSchema = z
|
|
|
55
55
|
REA_ELECTRON_OBSERVE_ENABLED: z.enum(["true", "false"]).default("false"),
|
|
56
56
|
REA_ELECTRON_CDP_ENDPOINTS_JSON: z.string().default("[]"),
|
|
57
57
|
REA_ELECTRON_FILE_ROOTS_JSON: z.string().default("[]"),
|
|
58
|
+
REA_JAVASCRIPT_REPLAY_ENABLED: z.enum(["true", "false"]).default("false"),
|
|
59
|
+
REA_JAVASCRIPT_REPLAY_ROOTS_JSON: z.string().default("[]"),
|
|
60
|
+
REA_JAVASCRIPT_REPLAY_NODE_PATH: z
|
|
61
|
+
.string()
|
|
62
|
+
.min(1)
|
|
63
|
+
.refine(isAbsolute, "REA_JAVASCRIPT_REPLAY_NODE_PATH must be absolute")
|
|
64
|
+
.default(process.execPath),
|
|
65
|
+
REA_JAVASCRIPT_REPLAY_BWRAP_PATH: z
|
|
66
|
+
.string()
|
|
67
|
+
.min(1)
|
|
68
|
+
.refine(isAbsolute, "REA_JAVASCRIPT_REPLAY_BWRAP_PATH must be absolute")
|
|
69
|
+
.default("/usr/bin/bwrap"),
|
|
70
|
+
REA_JAVASCRIPT_REPLAY_SYSTEMD_RUN_PATH: z
|
|
71
|
+
.string()
|
|
72
|
+
.min(1)
|
|
73
|
+
.refine(isAbsolute, "REA_JAVASCRIPT_REPLAY_SYSTEMD_RUN_PATH must be absolute")
|
|
74
|
+
.default("/usr/bin/systemd-run"),
|
|
75
|
+
REA_JAVASCRIPT_REPLAY_SYSTEMCTL_PATH: z
|
|
76
|
+
.string()
|
|
77
|
+
.min(1)
|
|
78
|
+
.refine(isAbsolute, "REA_JAVASCRIPT_REPLAY_SYSTEMCTL_PATH must be absolute")
|
|
79
|
+
.default("/usr/bin/systemctl"),
|
|
80
|
+
REA_JAVASCRIPT_REPLAY_SHELL_PATH: z
|
|
81
|
+
.string()
|
|
82
|
+
.min(1)
|
|
83
|
+
.refine(isAbsolute, "REA_JAVASCRIPT_REPLAY_SHELL_PATH must be absolute")
|
|
84
|
+
.default("/usr/bin/bash"),
|
|
85
|
+
REA_MANAGED_RUNTIME_ENABLED: z.enum(["true", "false"]).default("false"),
|
|
86
|
+
REA_MANAGED_RUNTIME_ROOTS_JSON: z.string().default("[]"),
|
|
87
|
+
REA_MANAGED_RUNTIME_EXECUTABLE_PATH: z
|
|
88
|
+
.string()
|
|
89
|
+
.min(1)
|
|
90
|
+
.refine(isAbsolute, "REA_MANAGED_RUNTIME_EXECUTABLE_PATH must be absolute")
|
|
91
|
+
.default("/usr/bin/dotnet"),
|
|
58
92
|
REA_PERMISSION_PROJECT_ROOT: z.string().min(1).optional(),
|
|
59
93
|
REA_PERMISSION_PROJECT_STORE: z.string().min(1).optional(),
|
|
60
94
|
})
|
|
@@ -200,6 +234,16 @@ export const parseConfig = (environment) => {
|
|
|
200
234
|
const electronFileRoots = parseElectronFileRoots(parsedEnvironment.data.REA_ELECTRON_FILE_ROOTS_JSON);
|
|
201
235
|
if (!electronFileRoots.ok)
|
|
202
236
|
return electronFileRoots;
|
|
237
|
+
const javascriptReplayRoots = parseStringArray(parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_ROOTS_JSON, "REA_JAVASCRIPT_REPLAY_ROOTS_JSON");
|
|
238
|
+
if (!javascriptReplayRoots.ok)
|
|
239
|
+
return javascriptReplayRoots;
|
|
240
|
+
if (javascriptReplayRoots.value.some((root) => !isAbsolute(root)))
|
|
241
|
+
return err(new ConfigurationError("REA_JAVASCRIPT_REPLAY_ROOTS_JSON must encode absolute roots"));
|
|
242
|
+
const managedRuntimeRoots = parseStringArray(parsedEnvironment.data.REA_MANAGED_RUNTIME_ROOTS_JSON, "REA_MANAGED_RUNTIME_ROOTS_JSON");
|
|
243
|
+
if (!managedRuntimeRoots.ok)
|
|
244
|
+
return managedRuntimeRoots;
|
|
245
|
+
if (managedRuntimeRoots.value.some((root) => !isAbsolute(root)))
|
|
246
|
+
return err(new ConfigurationError("REA_MANAGED_RUNTIME_ROOTS_JSON must encode absolute roots"));
|
|
203
247
|
const permissionCeilings = [
|
|
204
248
|
...(parsedEnvironment.data.REA_PROCESS_CAPTURE_ENABLED === "true"
|
|
205
249
|
? [
|
|
@@ -241,6 +285,31 @@ export const parseConfig = (environment) => {
|
|
|
241
285
|
...(parsedEnvironment.data.REA_ARTIFACT_NATIVE_MOUNT_ENABLED === "true"
|
|
242
286
|
? [permissionScope("native_mount", [], { mount: true })]
|
|
243
287
|
: []),
|
|
288
|
+
...(parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_ENABLED === "true"
|
|
289
|
+
? [
|
|
290
|
+
permissionScope("javascript_replay", javascriptReplayRoots.value, {
|
|
291
|
+
executables: [
|
|
292
|
+
parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_NODE_PATH,
|
|
293
|
+
parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_BWRAP_PATH,
|
|
294
|
+
parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_SYSTEMD_RUN_PATH,
|
|
295
|
+
parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_SYSTEMCTL_PATH,
|
|
296
|
+
parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_SHELL_PATH,
|
|
297
|
+
],
|
|
298
|
+
network: "none",
|
|
299
|
+
mount: true,
|
|
300
|
+
}),
|
|
301
|
+
]
|
|
302
|
+
: []),
|
|
303
|
+
...(parsedEnvironment.data.REA_MANAGED_RUNTIME_ENABLED === "true"
|
|
304
|
+
? [
|
|
305
|
+
permissionScope("managed_runtime", managedRuntimeRoots.value, {
|
|
306
|
+
executables: [
|
|
307
|
+
parsedEnvironment.data.REA_MANAGED_RUNTIME_EXECUTABLE_PATH,
|
|
308
|
+
],
|
|
309
|
+
network: "none",
|
|
310
|
+
}),
|
|
311
|
+
]
|
|
312
|
+
: []),
|
|
244
313
|
];
|
|
245
314
|
return ok({
|
|
246
315
|
analysisProvider: parsedEnvironment.data.REA_ANALYSIS_PROVIDER,
|
|
@@ -278,6 +347,20 @@ export const parseConfig = (environment) => {
|
|
|
278
347
|
electronObservationEnabled: parsedEnvironment.data.REA_ELECTRON_OBSERVE_ENABLED === "true",
|
|
279
348
|
electronCdpEndpoints: electronEndpoints.value,
|
|
280
349
|
electronFileRoots: electronFileRoots.value,
|
|
350
|
+
javascriptReplayPolicy: {
|
|
351
|
+
enabled: parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_ENABLED === "true",
|
|
352
|
+
roots: javascriptReplayRoots.value,
|
|
353
|
+
nodePath: parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_NODE_PATH,
|
|
354
|
+
bubblewrapPath: parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_BWRAP_PATH,
|
|
355
|
+
systemdRunPath: parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_SYSTEMD_RUN_PATH,
|
|
356
|
+
systemctlPath: parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_SYSTEMCTL_PATH,
|
|
357
|
+
shellPath: parsedEnvironment.data.REA_JAVASCRIPT_REPLAY_SHELL_PATH,
|
|
358
|
+
},
|
|
359
|
+
managedRuntimePolicy: {
|
|
360
|
+
enabled: parsedEnvironment.data.REA_MANAGED_RUNTIME_ENABLED === "true",
|
|
361
|
+
roots: managedRuntimeRoots.value,
|
|
362
|
+
executablePath: parsedEnvironment.data.REA_MANAGED_RUNTIME_EXECUTABLE_PATH,
|
|
363
|
+
},
|
|
281
364
|
permissionCeilings,
|
|
282
365
|
administratorPermissionGrants: administratorGrants(permissionCeilings),
|
|
283
366
|
permissionProjectRoot: parsedEnvironment.data.REA_PERMISSION_PROJECT_ROOT,
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { applicationVersionComparisonResultSchema, compareApplicationVersionsInputSchema, } from "../domain/javascriptApplicationVersionComparisonSchemas.js";
|
|
2
|
+
import { applicationFeatureTraceResultSchema, traceApplicationFeatureInputSchema, } from "../domain/javascriptFeatureTraceSchemas.js";
|
|
3
|
+
import { controlledReplayInputSchema, controlledReplayOutputSchema, } from "../domain/javascriptReplay.js";
|
|
4
|
+
import { toolContractMetadata } from "./toolEffects.js";
|
|
5
|
+
import { evidenceResultOf } from "./toolOutputSchemas.js";
|
|
6
|
+
import { JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE, JAVASCRIPT_FEATURE_TRACE_EXAMPLE, } from "./javascriptApplicationWorkflowExamples.js";
|
|
7
|
+
const traceOutputSchema = evidenceResultOf(applicationFeatureTraceResultSchema);
|
|
8
|
+
const comparisonOutputSchema = evidenceResultOf(applicationVersionComparisonResultSchema);
|
|
9
|
+
/** Provider-neutral graph workflow contracts shared by MCP and CLI adapters. */
|
|
10
|
+
export const APPLICATION_TOOL_CONTRACTS = [
|
|
11
|
+
{
|
|
12
|
+
name: "trace_application_feature",
|
|
13
|
+
...toolContractMetadata("trace_application_feature"),
|
|
14
|
+
description: "Trace a typed literal seed through an authenticated JavaScript Application Graph with explicit direction, depth, node, edge, and path bounds. Original static, native, passive-runtime, inferred, and unknown authorities remain distinct; native addon handoffs never open a provider or execute the application.",
|
|
15
|
+
kind: "application",
|
|
16
|
+
inputSchema: traceApplicationFeatureInputSchema,
|
|
17
|
+
outputSchema: traceOutputSchema,
|
|
18
|
+
examples: [
|
|
19
|
+
{
|
|
20
|
+
title: "Trace one module seed through a retained application graph",
|
|
21
|
+
input: JAVASCRIPT_FEATURE_TRACE_EXAMPLE,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "compare_application_versions",
|
|
27
|
+
...toolContractMetadata("compare_application_versions"),
|
|
28
|
+
description: "Compare two authenticated JavaScript Application Graph versions using unique-only exact digest, module source digest, source-map identity, structural fingerprint, and non-module semantic-key tiers. Reports added, removed, changed, ambiguous, and unknown entities plus a bounded changed_from graph without fuzzy or module-ordinal pairing.",
|
|
29
|
+
kind: "application",
|
|
30
|
+
inputSchema: compareApplicationVersionsInputSchema,
|
|
31
|
+
outputSchema: comparisonOutputSchema,
|
|
32
|
+
examples: [
|
|
33
|
+
{
|
|
34
|
+
title: "Compare authenticated static and reconciled application graphs",
|
|
35
|
+
input: JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "run_controlled_replay",
|
|
41
|
+
...toolContractMetadata("run_controlled_replay"),
|
|
42
|
+
description: "Plan or execute a content-bound extracted-module JavaScript replay inside the Linux Bubblewrap, seccomp, and cgroup boundary. Execution requires approved: true and the exact plan digest. Supports deterministic boundary cases and optional left/right differential comparison; observations have controlled-replay authority and do not claim real application runtime behavior.",
|
|
43
|
+
kind: "application",
|
|
44
|
+
inputSchema: controlledReplayInputSchema,
|
|
45
|
+
outputSchema: controlledReplayOutputSchema,
|
|
46
|
+
examples: [
|
|
47
|
+
{
|
|
48
|
+
title: "Plan one extracted ESM parser replay",
|
|
49
|
+
input: {
|
|
50
|
+
mode: "plan",
|
|
51
|
+
left: {
|
|
52
|
+
modules: [
|
|
53
|
+
{
|
|
54
|
+
alias: "parser",
|
|
55
|
+
path: "/approved/parser.mjs",
|
|
56
|
+
format: "esm",
|
|
57
|
+
role: "module",
|
|
58
|
+
dependencies: {},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
entry_alias: "parser",
|
|
62
|
+
entry_export: "default",
|
|
63
|
+
},
|
|
64
|
+
cases: [{ case_id: "empty", arguments: [""] }],
|
|
65
|
+
determinism: {
|
|
66
|
+
clock_iso: "2000-01-01T00:00:00.000Z",
|
|
67
|
+
random_seed: 0,
|
|
68
|
+
locale: "en-US",
|
|
69
|
+
timezone: "UTC",
|
|
70
|
+
platform: "linux",
|
|
71
|
+
},
|
|
72
|
+
limits: {
|
|
73
|
+
wall_time_ms: 3000,
|
|
74
|
+
memory_bytes: 134217728,
|
|
75
|
+
tasks: 8,
|
|
76
|
+
cpu_quota_percent: 50,
|
|
77
|
+
tmpfs_bytes: 16777216,
|
|
78
|
+
module_bytes: 4194304,
|
|
79
|
+
input_bytes: 262144,
|
|
80
|
+
protocol_bytes: 16777216,
|
|
81
|
+
output_bytes: 524288,
|
|
82
|
+
stderr_bytes: 32768,
|
|
83
|
+
result_depth: 16,
|
|
84
|
+
result_nodes: 10000,
|
|
85
|
+
},
|
|
86
|
+
approved: false,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { artifactOutputSchemas } from "./toolOutputSchemas.js";
|
|
3
3
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
4
|
+
import { toolContractMetadata } from "./toolEffects.js";
|
|
4
5
|
const pageInput = {
|
|
5
6
|
node_offset: z.number().int().min(0).default(0),
|
|
6
7
|
node_limit: z.number().int().min(1).max(500).default(100),
|
|
@@ -67,22 +68,17 @@ const examples = {
|
|
|
67
68
|
occurrence_ids: [`occ_${"0".repeat(64)}`],
|
|
68
69
|
},
|
|
69
70
|
};
|
|
70
|
-
const artifact = (name, description, inputSchema
|
|
71
|
+
const artifact = (name, description, inputSchema) => {
|
|
71
72
|
const outputSchema = artifactOutputSchemas[name];
|
|
72
73
|
if (outputSchema === undefined)
|
|
73
74
|
throw new Error(`Missing artifact output schema for ${name}`);
|
|
74
75
|
return {
|
|
75
76
|
name,
|
|
77
|
+
...toolContractMetadata(name),
|
|
76
78
|
description,
|
|
77
79
|
kind: "artifact-provider",
|
|
78
80
|
inputSchema,
|
|
79
81
|
outputSchema,
|
|
80
|
-
annotations: {
|
|
81
|
-
readOnlyHint: !mutatesFilesystem,
|
|
82
|
-
destructiveHint: false,
|
|
83
|
-
idempotentHint: true,
|
|
84
|
-
openWorldHint: false,
|
|
85
|
-
},
|
|
86
82
|
examples: [
|
|
87
83
|
{
|
|
88
84
|
title: `Example ${name.replaceAll("_", " ")} request`,
|
|
@@ -93,6 +89,6 @@ const artifact = (name, description, inputSchema, mutatesFilesystem) => {
|
|
|
93
89
|
};
|
|
94
90
|
/** Artifact-graph inventory and explicitly approved safe extraction contracts. */
|
|
95
91
|
export const ARTIFACT_TOOL_CONTRACTS = [
|
|
96
|
-
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
|
|
97
|
-
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
|
|
92
|
+
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),
|
|
93
|
+
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),
|
|
98
94
|
];
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { evidenceEnvelopeSchema } from "../domain/evidence.js";
|
|
3
1
|
import { browserTargetListSchema, inspectWebPageInputSchema, listBrowserTargetsInputSchema, webPageInspectionSchema, } from "../domain/browserObservation.js";
|
|
4
2
|
import { analyzeWebBundleInputSchema, webBundleAnalysisSchema, } from "../domain/webBundleAnalysis.js";
|
|
5
3
|
import { observeWebSessionInputSchema, webObservationSessionSchema, } from "../domain/browserSession.js";
|
|
6
4
|
import { discoverWebMcpToolsInputSchema, webMcpDiscoverySchema, } from "../domain/webMcpDiscovery.js";
|
|
7
5
|
import { compareWebCapturesInputSchema, webCaptureDiffSchema, } from "../domain/webCaptureDiff.js";
|
|
8
6
|
import { captureWebScreenshotInputSchema, compareWebScreenshotsInputSchema, webScreenshotDiffSchema, webScreenshotSchema, } from "../domain/webScreenshot.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
import { toolContractMetadata } from "./toolEffects.js";
|
|
8
|
+
import { evidenceResultOf } from "./toolOutputSchemas.js";
|
|
9
|
+
const evidenceResult = evidenceResultOf;
|
|
12
10
|
const listOutputSchema = evidenceResult(browserTargetListSchema);
|
|
13
|
-
const inspectionOutputSchema =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const bundleOutputSchema = evidenceEnvelopeSchema
|
|
17
|
-
.omit({ normalized_result: true })
|
|
18
|
-
.extend({ normalized_result: webBundleAnalysisSchema });
|
|
19
|
-
const observationSessionOutputSchema = evidenceEnvelopeSchema
|
|
20
|
-
.omit({ normalized_result: true })
|
|
21
|
-
.extend({ normalized_result: webObservationSessionSchema });
|
|
11
|
+
const inspectionOutputSchema = evidenceResult(webPageInspectionSchema);
|
|
12
|
+
const bundleOutputSchema = evidenceResult(webBundleAnalysisSchema);
|
|
13
|
+
const observationSessionOutputSchema = evidenceResult(webObservationSessionSchema);
|
|
22
14
|
const webMcpOutputSchema = evidenceResult(webMcpDiscoverySchema);
|
|
23
15
|
const captureDiffOutputSchema = evidenceResult(webCaptureDiffSchema);
|
|
24
16
|
const screenshotOutputSchema = evidenceResult(webScreenshotSchema);
|
|
@@ -29,16 +21,11 @@ const origin = "https://app.example.test";
|
|
|
29
21
|
export const BROWSER_TOOL_CONTRACTS = [
|
|
30
22
|
{
|
|
31
23
|
name: "list_browser_targets",
|
|
24
|
+
...toolContractMetadata("list_browser_targets"),
|
|
32
25
|
description: "List bounded page targets from an approved user-owned loopback Chrome DevTools Protocol endpoint. Only targets whose current URL matches an approved exact origin are returned; URL credentials, query values, and fragments are redacted.",
|
|
33
26
|
kind: "browser-provider",
|
|
34
27
|
inputSchema: listBrowserTargetsInputSchema,
|
|
35
28
|
outputSchema: listOutputSchema,
|
|
36
|
-
annotations: {
|
|
37
|
-
readOnlyHint: true,
|
|
38
|
-
destructiveHint: false,
|
|
39
|
-
idempotentHint: true,
|
|
40
|
-
openWorldHint: true,
|
|
41
|
-
},
|
|
42
29
|
examples: [
|
|
43
30
|
{
|
|
44
31
|
title: "List approved browser page targets",
|
|
@@ -54,16 +41,11 @@ export const BROWSER_TOOL_CONTRACTS = [
|
|
|
54
41
|
},
|
|
55
42
|
{
|
|
56
43
|
name: "inspect_web_page",
|
|
44
|
+
...toolContractMetadata("inspect_web_page"),
|
|
57
45
|
description: "Passively inspect one approved page target through CDP without evaluating JavaScript, navigating, clicking, closing, or mutating the page. Returns bounded DOM structure, accessibility, scripts, resources, attach-window network and console metadata, workers, and redacted storage inventory as Evidence v2.",
|
|
58
46
|
kind: "browser-provider",
|
|
59
47
|
inputSchema: inspectWebPageInputSchema,
|
|
60
48
|
outputSchema: inspectionOutputSchema,
|
|
61
|
-
annotations: {
|
|
62
|
-
readOnlyHint: true,
|
|
63
|
-
destructiveHint: false,
|
|
64
|
-
idempotentHint: true,
|
|
65
|
-
openWorldHint: true,
|
|
66
|
-
},
|
|
67
49
|
examples: [
|
|
68
50
|
{
|
|
69
51
|
title: "Inspect one approved browser page",
|
|
@@ -112,16 +94,11 @@ export const BROWSER_TOOL_CONTRACTS = [
|
|
|
112
94
|
},
|
|
113
95
|
{
|
|
114
96
|
name: "analyze_web_bundle",
|
|
97
|
+
...toolContractMetadata("analyze_web_bundle"),
|
|
115
98
|
description: "Capture explicitly approved JavaScript source from one approved CDP page and statically derive a bounded chunk graph, route and endpoint candidates, vendor fingerprints, page-declared WebMCP metadata, and optional separately approved source-map evidence. JavaScript is parsed but never executed.",
|
|
116
99
|
kind: "browser-provider",
|
|
117
100
|
inputSchema: analyzeWebBundleInputSchema,
|
|
118
101
|
outputSchema: bundleOutputSchema,
|
|
119
|
-
annotations: {
|
|
120
|
-
readOnlyHint: true,
|
|
121
|
-
destructiveHint: false,
|
|
122
|
-
idempotentHint: true,
|
|
123
|
-
openWorldHint: true,
|
|
124
|
-
},
|
|
125
102
|
examples: [
|
|
126
103
|
{
|
|
127
104
|
title: "Analyze an approved page bundle",
|
|
@@ -152,16 +129,11 @@ export const BROWSER_TOOL_CONTRACTS = [
|
|
|
152
129
|
},
|
|
153
130
|
{
|
|
154
131
|
name: "observe_web_session",
|
|
132
|
+
...toolContractMetadata("observe_web_session"),
|
|
155
133
|
description: "Arm a bounded CDP observation window while the user operates the page. Allows approved same-origin reload and SPA navigation, records ordered navigation, redirect, lifecycle, and failure metadata, and stops before retaining an out-of-policy destination.",
|
|
156
134
|
kind: "browser-provider",
|
|
157
135
|
inputSchema: observeWebSessionInputSchema,
|
|
158
136
|
outputSchema: observationSessionOutputSchema,
|
|
159
|
-
annotations: {
|
|
160
|
-
readOnlyHint: true,
|
|
161
|
-
destructiveHint: false,
|
|
162
|
-
idempotentHint: false,
|
|
163
|
-
openWorldHint: true,
|
|
164
|
-
},
|
|
165
137
|
examples: [
|
|
166
138
|
{
|
|
167
139
|
title: "Observe one external user action",
|
|
@@ -178,16 +150,11 @@ export const BROWSER_TOOL_CONTRACTS = [
|
|
|
178
150
|
},
|
|
179
151
|
{
|
|
180
152
|
name: "discover_webmcp_tools",
|
|
153
|
+
...toolContractMetadata("discover_webmcp_tools"),
|
|
181
154
|
description: "Passively inventory page-registered WebMCP tools using the experimental CDP WebMCP domain. Metadata is bounded and page-declared-untrusted; REA never registers or invokes discovered tools.",
|
|
182
155
|
kind: "browser-provider",
|
|
183
156
|
inputSchema: discoverWebMcpToolsInputSchema,
|
|
184
157
|
outputSchema: webMcpOutputSchema,
|
|
185
|
-
annotations: {
|
|
186
|
-
readOnlyHint: true,
|
|
187
|
-
destructiveHint: false,
|
|
188
|
-
idempotentHint: true,
|
|
189
|
-
openWorldHint: true,
|
|
190
|
-
},
|
|
191
158
|
examples: [
|
|
192
159
|
{
|
|
193
160
|
title: "Discover current WebMCP declarations",
|
|
@@ -207,16 +174,11 @@ export const BROWSER_TOOL_CONTRACTS = [
|
|
|
207
174
|
},
|
|
208
175
|
{
|
|
209
176
|
name: "compare_web_captures",
|
|
177
|
+
...toolContractMetadata("compare_web_captures"),
|
|
210
178
|
description: "Compare two normalized web captures across DOM, scripts, resources, network, safe metadata, and optional WebMCP inventories. Stable observed changes are distinguished from unknown absence caused by incomplete capture coverage.",
|
|
211
179
|
kind: "browser-provider",
|
|
212
180
|
inputSchema: compareWebCapturesInputSchema,
|
|
213
181
|
outputSchema: captureDiffOutputSchema,
|
|
214
|
-
annotations: {
|
|
215
|
-
readOnlyHint: true,
|
|
216
|
-
destructiveHint: false,
|
|
217
|
-
idempotentHint: true,
|
|
218
|
-
openWorldHint: false,
|
|
219
|
-
},
|
|
220
182
|
examples: [
|
|
221
183
|
{
|
|
222
184
|
title: "Compare two normalized captures",
|
|
@@ -230,16 +192,11 @@ export const BROWSER_TOOL_CONTRACTS = [
|
|
|
230
192
|
},
|
|
231
193
|
{
|
|
232
194
|
name: "capture_web_screenshot",
|
|
195
|
+
...toolContractMetadata("capture_web_screenshot"),
|
|
233
196
|
description: "Capture the current visible viewport of one approved page as a bounded, content-addressed PNG artifact. Screenshot capture requires separate explicit approval and never scrolls, navigates, or evaluates page JavaScript.",
|
|
234
197
|
kind: "browser-provider",
|
|
235
198
|
inputSchema: captureWebScreenshotInputSchema,
|
|
236
199
|
outputSchema: screenshotOutputSchema,
|
|
237
|
-
annotations: {
|
|
238
|
-
readOnlyHint: true,
|
|
239
|
-
destructiveHint: false,
|
|
240
|
-
idempotentHint: false,
|
|
241
|
-
openWorldHint: true,
|
|
242
|
-
},
|
|
243
200
|
examples: [
|
|
244
201
|
{
|
|
245
202
|
title: "Capture an approved viewport",
|
|
@@ -256,16 +213,11 @@ export const BROWSER_TOOL_CONTRACTS = [
|
|
|
256
213
|
},
|
|
257
214
|
{
|
|
258
215
|
name: "compare_web_screenshots",
|
|
216
|
+
...toolContractMetadata("compare_web_screenshots"),
|
|
259
217
|
description: "Compare two self-verifying PNG screenshot artifacts with bounded local pixel metrics. Returns exact changed-pixel ratios and channel deltas without OCR or external services.",
|
|
260
218
|
kind: "browser-provider",
|
|
261
219
|
inputSchema: compareWebScreenshotsInputSchema,
|
|
262
220
|
outputSchema: screenshotDiffOutputSchema,
|
|
263
|
-
annotations: {
|
|
264
|
-
readOnlyHint: true,
|
|
265
|
-
destructiveHint: false,
|
|
266
|
-
idempotentHint: true,
|
|
267
|
-
openWorldHint: false,
|
|
268
|
-
},
|
|
269
221
|
examples: [
|
|
270
222
|
{
|
|
271
223
|
title: "Compare two screenshot artifacts",
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toolContractMetadata } from "./toolEffects.js";
|
|
2
|
+
import { evidenceResultOf } from "./toolOutputSchemas.js";
|
|
2
3
|
import { electronPageInspectionSchema, electronTargetListSchema, inspectElectronPageInputSchema, listElectronTargetsInputSchema, } from "../domain/electronObservation.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { analyzeJavaScriptApplicationInputSchema, javascriptApplicationAnalysisResultSchema, } from "../domain/javascriptApplicationAnalysis.js";
|
|
5
|
+
import { javascriptRuntimeReconciliationResultSchema, reconcileJavaScriptRuntimeInputSchema, } from "../domain/javascriptRuntimeReconciliationSchemas.js";
|
|
6
|
+
import { JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE } from "./javascriptRuntimeReconciliationExample.js";
|
|
7
|
+
const listOutputSchema = evidenceResultOf(electronTargetListSchema);
|
|
8
|
+
const inspectionOutputSchema = evidenceResultOf(electronPageInspectionSchema);
|
|
9
|
+
const applicationOutputSchema = evidenceResultOf(javascriptApplicationAnalysisResultSchema);
|
|
10
|
+
const reconciliationOutputSchema = evidenceResultOf(javascriptRuntimeReconciliationResultSchema);
|
|
9
11
|
const endpoint = "http://127.0.0.1:9223";
|
|
10
12
|
const root = "/Applications/Example.app/Contents/Resources";
|
|
11
13
|
/** Root-confined Electron file-page discovery and inspection contracts. */
|
|
12
14
|
export const ELECTRON_TOOL_CONTRACTS = [
|
|
13
15
|
{
|
|
14
16
|
name: "list_electron_targets",
|
|
17
|
+
...toolContractMetadata("list_electron_targets"),
|
|
15
18
|
description: "List Electron file:// page targets from an approved user-owned loopback CDP endpoint. Every path is canonicalized and must remain contained by an approved filesystem root, including after symlink resolution.",
|
|
16
19
|
kind: "electron-provider",
|
|
17
20
|
inputSchema: listElectronTargetsInputSchema,
|
|
18
21
|
outputSchema: listOutputSchema,
|
|
19
|
-
annotations: {
|
|
20
|
-
readOnlyHint: true,
|
|
21
|
-
destructiveHint: false,
|
|
22
|
-
idempotentHint: true,
|
|
23
|
-
openWorldHint: true,
|
|
24
|
-
},
|
|
25
22
|
examples: [
|
|
26
23
|
{
|
|
27
24
|
title: "List approved Electron file pages",
|
|
@@ -37,16 +34,11 @@ export const ELECTRON_TOOL_CONTRACTS = [
|
|
|
37
34
|
},
|
|
38
35
|
{
|
|
39
36
|
name: "inspect_electron_page",
|
|
37
|
+
...toolContractMetadata("inspect_electron_page"),
|
|
40
38
|
description: "Passively inspect one approved Electron file page through CDP. Returns root-confined frames, DOM structure, resource paths, and scripts without evaluating renderer JavaScript or invoking Electron APIs; script contents require separate approval.",
|
|
41
39
|
kind: "electron-provider",
|
|
42
40
|
inputSchema: inspectElectronPageInputSchema,
|
|
43
41
|
outputSchema: inspectionOutputSchema,
|
|
44
|
-
annotations: {
|
|
45
|
-
readOnlyHint: true,
|
|
46
|
-
destructiveHint: false,
|
|
47
|
-
idempotentHint: true,
|
|
48
|
-
openWorldHint: true,
|
|
49
|
-
},
|
|
50
42
|
examples: [
|
|
51
43
|
{
|
|
52
44
|
title: "Inspect an approved Electron page",
|
|
@@ -63,6 +55,7 @@ export const ELECTRON_TOOL_CONTRACTS = [
|
|
|
63
55
|
max_dom_nodes: 2_000,
|
|
64
56
|
max_scripts: 500,
|
|
65
57
|
max_resources: 2_000,
|
|
58
|
+
max_workers: 500,
|
|
66
59
|
max_script_source_bytes: 1_048_576,
|
|
67
60
|
max_total_script_source_bytes: 4_194_304,
|
|
68
61
|
},
|
|
@@ -70,4 +63,37 @@ export const ELECTRON_TOOL_CONTRACTS = [
|
|
|
70
63
|
},
|
|
71
64
|
],
|
|
72
65
|
},
|
|
66
|
+
{
|
|
67
|
+
name: "analyze_javascript_application",
|
|
68
|
+
...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.",
|
|
70
|
+
kind: "electron-provider",
|
|
71
|
+
inputSchema: analyzeJavaScriptApplicationInputSchema,
|
|
72
|
+
outputSchema: applicationOutputSchema,
|
|
73
|
+
examples: [
|
|
74
|
+
{
|
|
75
|
+
title: "Analyze one approved local Electron application",
|
|
76
|
+
input: {
|
|
77
|
+
input_path: "/Applications/Example.app/Contents/Resources/app.asar",
|
|
78
|
+
format: "auto",
|
|
79
|
+
approved: true,
|
|
80
|
+
source_map_read_approved: false,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "reconcile_javascript_runtime",
|
|
87
|
+
...toolContractMetadata("reconcile_javascript_runtime"),
|
|
88
|
+
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.",
|
|
89
|
+
kind: "electron-provider",
|
|
90
|
+
inputSchema: reconcileJavaScriptRuntimeInputSchema,
|
|
91
|
+
outputSchema: reconciliationOutputSchema,
|
|
92
|
+
examples: [
|
|
93
|
+
{
|
|
94
|
+
title: "Reconcile one passive Electron capture",
|
|
95
|
+
input: JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
73
99
|
];
|
|
@@ -95,6 +95,7 @@ export const analysisErrorProjectionSchema = z.discriminatedUnion("code", [
|
|
|
95
95
|
generic("configuration_invalid"),
|
|
96
96
|
generic("target_unavailable"),
|
|
97
97
|
generic("execution_failure"),
|
|
98
|
+
generic("plan_stale"),
|
|
98
99
|
]);
|
|
99
100
|
/** JSON Schema document used by generated API documentation and clients. */
|
|
100
101
|
export const analysisErrorJsonSchema = z.toJSONSchema(analysisErrorProjectionSchema);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { compareFunctions } from "../domain/functionComparison.js";
|
|
2
2
|
import { createEvidence } from "../domain/evidence.js";
|
|
3
3
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
4
|
-
import { createEvidenceBundle } from "../domain/evidenceBundle.js";
|
|
5
4
|
import { compareProcessCaptures, processCaptureSchema, } from "../domain/processCapture.js";
|
|
6
5
|
import { FUNCTION_COMPARISON_EXAMPLE } from "./functionComparisonExample.js";
|
|
7
6
|
import { EMPTY_PROCESS_CAPTURE_EXAMPLE } from "./processCaptureExample.js";
|
|
@@ -109,10 +108,5 @@ export const INVESTIGATION_EXAMPLES = {
|
|
|
109
108
|
},
|
|
110
109
|
],
|
|
111
110
|
},
|
|
112
|
-
evidence_bundle: createEvidenceBundle([
|
|
113
|
-
PROCESS_CAPTURE_REFERENCE,
|
|
114
|
-
PROCESS_CAPTURE_RECONSTRUCTION,
|
|
115
|
-
PROCESS_COMPARISON_EVIDENCE,
|
|
116
|
-
]),
|
|
117
111
|
},
|
|
118
112
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createEvidence } from "../domain/evidence.js";
|
|
2
|
+
import { reconcileJavaScriptRuntime } from "../domain/javascriptRuntimeReconciliation.js";
|
|
3
|
+
import { JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE, JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE, } from "./javascriptRuntimeReconciliationExample.js";
|
|
4
|
+
const reconciliation = reconcileJavaScriptRuntime(JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE);
|
|
5
|
+
const reconciliationEvidence = createEvidence(undefined, {
|
|
6
|
+
id: "rea-javascript-runtime-reconciliation",
|
|
7
|
+
name: "REA JavaScript runtime reconciliation",
|
|
8
|
+
version: "1",
|
|
9
|
+
}, {
|
|
10
|
+
predicateType: "rea.javascript-runtime-reconciliation/v1",
|
|
11
|
+
operation: "reconcile_javascript_runtime",
|
|
12
|
+
parameters: {
|
|
13
|
+
static_layers: JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE.static_layers.map(({ role, analysis }) => ({
|
|
14
|
+
role,
|
|
15
|
+
evidence_id: analysis.evidence_id,
|
|
16
|
+
runtime_mappings: [],
|
|
17
|
+
})),
|
|
18
|
+
runtime_evidence_ids: JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE.runtime_observations.map(({ evidence_id: id }) => id),
|
|
19
|
+
limits: {
|
|
20
|
+
max_runtime_entities: 10_000,
|
|
21
|
+
max_reconciliation_items: 20_000,
|
|
22
|
+
max_static_load_states: 20_000,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
result: reconciliation,
|
|
26
|
+
confidence: "inferred",
|
|
27
|
+
authority: "analyst-inference",
|
|
28
|
+
limitations: reconciliation.limitations,
|
|
29
|
+
evidenceLinks: reconciliation.evidence_links,
|
|
30
|
+
});
|
|
31
|
+
/** Valid public trace request without proprietary artifacts. */
|
|
32
|
+
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
|
+
},
|
|
40
|
+
direction: "both",
|
|
41
|
+
};
|
|
42
|
+
/** Valid static/runtime graph pair demonstrating comparison authority. */
|
|
43
|
+
export const JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE = {
|
|
44
|
+
left: JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE,
|
|
45
|
+
right: reconciliationEvidence,
|
|
46
|
+
};
|