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.
- package/README.md +20 -12
- package/bridge/ghidra/ReaGhidraBridge.java +477 -4
- package/bridge/hopper_bridge.py +54 -4
- package/dist/application/AnalysisContextQueries.js +142 -0
- package/dist/application/AnalysisSnapshotCache.js +4 -2
- package/dist/application/ApplicationWorkflowEvidenceResolver.js +19 -11
- package/dist/application/ArtifactInventory/policy.js +17 -0
- package/dist/application/ArtifactInventory/reader.js +1 -4
- package/dist/application/ArtifactInventory/scanCanonical.js +0 -3
- package/dist/application/ArtifactInventory/scanReader.js +7 -7
- package/dist/application/ArtifactInventory/types.js +1 -5
- package/dist/application/BinarySession.js +19 -20
- package/dist/application/BinarySessionComposition.js +21 -0
- package/dist/application/BinarySessionRecords.js +106 -10
- package/dist/application/BinarySessionStatus.js +11 -5
- package/dist/application/BrowserEvidence.js +3 -5
- package/dist/application/CapabilityClientRequirements.js +26 -0
- package/dist/application/CapabilityInventory.js +140 -55
- package/dist/application/ClientRegistrationStatus.js +4 -1
- package/dist/application/CrossVersionInventory.js +7 -6
- package/dist/application/DirectAnalysis.js +6 -2
- package/dist/application/ElectronActiveEvidence.js +55 -0
- package/dist/application/ElectronActiveObservationPort.js +1 -0
- package/dist/application/ElectronActiveObservationService.js +81 -0
- package/dist/application/EnhancedTools.js +49 -17
- package/dist/application/EvidenceBundleCommands.js +5 -1
- package/dist/application/EvidenceLedger.js +53 -17
- package/dist/application/JavaScriptArtifactAnalysis.js +13 -4
- package/dist/application/JavaScriptReplayPermission.js +1 -1
- package/dist/application/JavaScriptReplayService.js +23 -15
- package/dist/application/LazyAnalysisProvider.js +77 -0
- package/dist/application/LoopbackReplay.js +1 -1
- package/dist/application/ManagedRuntimeCorrelationService.js +9 -5
- package/dist/application/NativeApiInspection.js +80 -0
- package/dist/application/NodeRuntimeCharacterizationService.js +8 -9
- package/dist/application/ProcessCaptureLifecycle.js +5 -0
- package/dist/application/ProcessCli.js +2 -1
- package/dist/application/ProcessHarness.js +8 -3
- package/dist/application/ProcessNormalization.js +2 -1
- package/dist/application/ProjectPermissionStore.js +1 -0
- package/dist/application/ReferenceSourceImport.js +2 -2
- package/dist/application/SessionProviderRouter.js +6 -6
- package/dist/application/SetupClientConfiguration.js +10 -3
- package/dist/application/WindowsCapabilities.js +5 -4
- package/dist/application/runtime.js +26 -9
- package/dist/artifacts/ArtifactProvider.js +8 -10
- package/dist/artifacts/SafeOutputTree.js +7 -8
- package/dist/browser/CdpCaptureStorageFingerprints.js +10 -7
- package/dist/browser/CdpElectronInspection.js +3 -1
- package/dist/browser/JavaScriptRuntimeScope.js +5 -0
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +8 -2
- package/dist/browser/PlaywrightElectronActiveActions.js +324 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +294 -0
- package/dist/browser/PlaywrightScenarioBrowser.js +4 -4
- package/dist/browser/PlaywrightScenarioSession.js +4 -4
- package/dist/browser/SensitiveTextCapture.js +1 -1
- package/dist/browser/V8InspectorCaptureProjection.js +1 -0
- package/dist/browser/V8InspectorProvider.js +3 -3
- package/dist/catalogIdentity.js +15 -9
- package/dist/cli/artifactCommands.js +5 -3
- package/dist/cli/coreAnalysisCommands.js +41 -0
- package/dist/cli/managedCommands.js +1 -1
- package/dist/cliApplicationCommands.js +2 -2
- package/dist/cliBrowserAdvancedCommands.js +11 -5
- package/dist/cliBrowserCommands.js +14 -7
- package/dist/cliCommandNames.js +2 -0
- package/dist/cliElectronCommands.js +46 -4
- package/dist/cliJavaScriptRuntimeCommands.js +14 -6
- package/dist/cliObservationOptions.js +4 -0
- package/dist/cliPolicyCommands.js +1 -0
- package/dist/config/browserScenario.js +77 -0
- package/dist/config/electronAutomation.js +35 -0
- package/dist/config/environment.js +6 -0
- package/dist/config/javascriptReplay.js +41 -0
- package/dist/config/managedRuntime.js +25 -0
- package/dist/config/parseConfig.js +56 -200
- package/dist/config/parsers.js +10 -1
- package/dist/config/passiveObservation.js +157 -0
- package/dist/config/processCapture.js +47 -0
- package/dist/contracts/applicationToolContracts.js +2 -5
- package/dist/contracts/applicationWorkflowInputContracts.js +86 -96
- package/dist/contracts/artifactToolContracts.js +35 -37
- package/dist/contracts/browserToolContracts.js +2 -2
- package/dist/contracts/electronToolContracts.js +30 -1
- package/dist/contracts/enhancedInputs.js +21 -27
- package/dist/contracts/functionWorkflowToolContracts.js +29 -0
- package/dist/contracts/managedToolContracts.js +4 -9
- package/dist/contracts/managedWorkflowExamples.js +12 -9
- package/dist/contracts/managedWorkflowToolContracts.js +30 -27
- package/dist/contracts/nativeToolContracts.js +2 -3
- package/dist/contracts/promptContracts.js +14 -15
- package/dist/contracts/sessionToolSchemas.js +61 -0
- package/dist/contracts/toolContractExamples.js +4 -0
- package/dist/contracts/toolContractHelpers.js +23 -0
- package/dist/contracts/toolContracts.js +12 -67
- package/dist/contracts/toolEffects.js +19 -0
- package/dist/contracts/toolOutputSchemaGroups.js +66 -11
- package/dist/contracts/toolOutputSchemaPrimitives.js +76 -26
- package/dist/contracts/toolSchemaMetadata.js +128 -0
- package/dist/doctorRuntime.js +1 -1
- package/dist/domain/analysisErrorPresentation.js +8 -2
- package/dist/domain/analysisErrorProjection.js +1 -0
- package/dist/domain/androidApplication.js +2 -0
- package/dist/domain/appleApplication.js +2 -0
- package/dist/domain/binaryTarget.js +7 -5
- package/dist/domain/binaryTargetTypes.js +1 -0
- package/dist/domain/browserCaptureComparison.js +21 -69
- package/dist/domain/browserObservation.js +22 -9
- package/dist/domain/bytecodeProvider.js +177 -0
- package/dist/domain/callPath.js +3 -2
- package/dist/domain/conformancePackage.js +169 -0
- package/dist/domain/conformanceReplay.js +104 -0
- package/dist/domain/conformanceTrustGate.js +328 -0
- package/dist/domain/customProtocolCapture.js +137 -0
- package/dist/domain/electronActiveObservation.js +277 -0
- package/dist/domain/electronObservation.js +15 -11
- package/dist/domain/electronStaticAnalysisValues.js +4 -1
- package/dist/domain/eventProcessTree.js +217 -0
- package/dist/domain/evidenceBundle.js +47 -0
- package/dist/domain/functionComparisonNormalization.js +15 -8
- package/dist/domain/functionDossierEvidence.js +9 -4
- package/dist/domain/hopperStartupFailure.js +1 -1
- package/dist/domain/hopperValues.js +68 -68
- package/dist/domain/inputIssueProjection.js +11 -2
- package/dist/domain/investigationWorkspace.js +16 -15
- package/dist/domain/javascriptExportShapeComparisonSchemas.js +2 -2
- package/dist/domain/javascriptReplay.js +79 -63
- package/dist/domain/javascriptRuntimeObservation.js +1 -0
- package/dist/domain/javascriptRuntimeReconciliationActive.js +89 -0
- package/dist/domain/javascriptRuntimeReconciliationGraph.js +11 -10
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +57 -49
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +5 -1
- package/dist/domain/javascriptRuntimeReconciliationResult.js +21 -14
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +1 -1
- package/dist/domain/javascriptSemanticAnalysis.js +8 -12
- package/dist/domain/javascriptSourceParser.js +15 -0
- package/dist/domain/javascriptStaticAnalysis.js +8 -12
- package/dist/domain/knownPageCoverage.js +15 -7
- package/dist/domain/mobileApplicationInvestigation.js +159 -0
- package/dist/domain/nativeApiBoundary.js +138 -0
- package/dist/domain/nodeRuntimeCharacterization.js +14 -13
- package/dist/domain/objcSwiftMetadata.js +150 -0
- package/dist/domain/packageAnalysis.js +123 -0
- package/dist/domain/peInspection.js +196 -0
- package/dist/domain/processCaptureReactiveValidation.js +8 -3
- package/dist/domain/processCaptureValidation.js +7 -3
- package/dist/domain/processComparison.js +12 -7
- package/dist/domain/processObservation.js +5 -6
- package/dist/domain/processReactiveMatching.js +14 -7
- package/dist/domain/processReactiveTransition.js +9 -3
- package/dist/domain/processScenario.js +6 -3
- package/dist/domain/processTraceComparison.js +3 -2
- package/dist/domain/protocolCapture.js +245 -0
- package/dist/domain/reconstructionReadinessSchemas.js +30 -2
- package/dist/domain/referenceSourceImportParsing.js +2 -2
- package/dist/domain/replayMachineRuntime.js +5 -3
- package/dist/domain/sourceToBundleComparison.js +2 -2
- package/dist/domain/sourceToBundleComparisonSchemas.js +8 -8
- package/dist/domain/sourceToBundleSignals.js +7 -1
- package/dist/domain/staticRuntimeCorrelation.js +7 -5
- package/dist/domain/webBundleAnalysis.js +14 -14
- package/dist/domain/webCaptureDiff.js +15 -12
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +2 -3
- package/dist/dotnet/ManagedStaticProvider.js +34 -5
- package/dist/generatedMcpToolCatalog.js +37 -0
- package/dist/generatedPackageMetadata.js +4 -4
- package/dist/ghidra/GhidraClient.js +1 -1
- package/dist/ghidra/GhidraClientStartup.js +1 -1
- package/dist/ghidra/GhidraDefaults.js +1 -1
- package/dist/ghidra/GhidraFunctionValues.js +44 -16
- package/dist/ghidra/GhidraInventoryValues.js +57 -47
- package/dist/ghidra/GhidraProvider.js +18 -10
- package/dist/ghidra/GhidraProviderCapabilities.js +45 -39
- package/dist/ghidra/GhidraSocketConnection.js +1 -1
- package/dist/ghidra/protocol.js +19 -42
- package/dist/hopper/BridgeLauncher.js +3 -1
- package/dist/hopper/HopperAnalysisProfile.js +2 -4
- package/dist/hopper/HopperCleanup.js +5 -6
- package/dist/hopper/HopperClient.js +27 -3
- package/dist/hopper/HopperProvider.js +42 -44
- package/dist/hopper/HopperRequestQueue.js +32 -4
- package/dist/hopper/HopperResponseStream.js +2 -2
- package/dist/hopper/LinuxPrivateDisplayProbe.js +16 -10
- package/dist/hopper/protocol.js +63 -21
- package/dist/main/reload.js +1 -6
- package/dist/main/state.js +0 -14
- package/dist/main/transport.js +31 -41
- package/dist/main.js +17 -13
- package/dist/mcpDoctor.js +4 -26
- package/dist/mcpStartupPolicy.js +14 -0
- package/dist/process/PrivateRuntimeRoot.js +17 -0
- package/dist/process/ProcessOwnership.js +64 -128
- package/dist/process/ProcessOwnershipIdentity.js +13 -0
- package/dist/process/ProcessOwnershipObservation.js +88 -0
- package/dist/process/ProcessOwnershipProcessTree.js +22 -0
- package/dist/process/ProviderDeadline.js +8 -12
- package/dist/process/WindowsAuthority.js +32 -0
- package/dist/reference/ReferenceSourceReader.js +3 -3
- package/dist/reference/ReferenceSourceReaderEntries.js +2 -2
- package/dist/replay/JavaScriptReplayWorker.js +95 -11
- package/dist/replay/JavaScriptReplayWorkerTypes.js +1 -0
- package/dist/replay/LinuxJavaScriptReplayRunner.js +10 -15
- package/dist/replay/ReplayOutcome.js +26 -15
- package/dist/replay/ReplayWorkerProtocol.js +34 -29
- package/dist/server/createServer.js +101 -144
- package/dist/server/mcpClientMetadata.js +32 -0
- package/dist/server/registerApplicationTools/characterization.js +6 -13
- package/dist/server/registerApplicationTools/compareExportShapes.js +2 -7
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +2 -7
- package/dist/server/registerApplicationTools/compareVersions.js +3 -8
- package/dist/server/registerApplicationTools/controlledReplay.js +6 -11
- package/dist/server/registerApplicationTools/coverage.js +13 -19
- package/dist/server/registerApplicationTools/obligationLedger.js +1 -6
- package/dist/server/registerApplicationTools/readiness.js +1 -6
- package/dist/server/registerApplicationTools/traceFeature.js +3 -8
- package/dist/server/registerApplicationTools/traceSemantics.js +1 -6
- package/dist/server/registerArtifactComparisonTool.js +12 -16
- package/dist/server/registerBrowserScenarioTool.js +1 -6
- package/dist/server/registerBrowserTools.js +37 -79
- package/dist/server/registerBundleComparisonTool.js +10 -14
- package/dist/server/registerCloseLifecycleTool.js +6 -14
- package/dist/server/registerElectronTools.js +30 -47
- package/dist/server/registerEnhancedTools.js +124 -122
- package/dist/server/registerEvidenceResources.js +50 -101
- package/dist/server/registerEvidenceTools.js +5 -9
- package/dist/server/registerFunctionComparisonTool.js +11 -15
- package/dist/server/registerInvestigationTools.js +42 -59
- package/dist/server/registerJavaScriptApplicationGraphResource.js +0 -4
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +13 -27
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +4 -9
- package/dist/server/registerManagedWorkflowTools/contract.js +2 -3
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -8
- package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +3 -8
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +8 -13
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +4 -9
- package/dist/server/registerOfficialTools.js +8 -9
- package/dist/server/registerProcessComparisonTool.js +19 -24
- package/dist/server/registerReconstructionObligationLedgerResource.js +0 -7
- package/dist/server/registerReconstructionReadinessResource.js +0 -7
- package/dist/server/registerReplayMachineTool.js +4 -10
- package/dist/server/registerSessionRecordTools.js +146 -47
- package/dist/server/registerSessionStatusTool.js +14 -29
- package/dist/server/registerSessionTools.js +45 -41
- package/dist/server/sessionAvailabilityPolicy.js +2 -1
- package/dist/server/sessionToolPolicies.js +1 -5
- package/dist/server/toolRegistrationOptions.js +4 -177
- package/dist/server/toolResult.js +14 -18
- package/package.json +35 -16
- package/scripts/electron-active-hook-boundaries.cjs +394 -0
- package/scripts/electron-active-hook.cjs +501 -0
- package/skills/reverse-engineer-anything/SKILL.md +10 -3
- package/dist/server/DynamicToolAvailability.js +0 -70
- package/dist/server/toolInputValidation.js +0 -77
|
@@ -42,11 +42,8 @@ export const targetKindSchema = z.enum([
|
|
|
42
42
|
"archive",
|
|
43
43
|
"artifact",
|
|
44
44
|
]);
|
|
45
|
-
const
|
|
45
|
+
const providerCapabilityFacts = {
|
|
46
46
|
operation: z.string(),
|
|
47
|
-
available: z.boolean(),
|
|
48
|
-
reason: z.string().nullable(),
|
|
49
|
-
availability_code: z.enum(PROVIDER_REJECTION_CODES).nullable(),
|
|
50
47
|
input_contract_version: z.number().int().min(1),
|
|
51
48
|
output_contract_version: z.number().int().min(1),
|
|
52
49
|
pagination: z.enum(["none", "offset", "cursor"]),
|
|
@@ -66,7 +63,21 @@ const providerCapability = z.object({
|
|
|
66
63
|
timeout_ms: z.number().int().min(0).nullable(),
|
|
67
64
|
}),
|
|
68
65
|
limitations: z.array(z.string()),
|
|
69
|
-
}
|
|
66
|
+
};
|
|
67
|
+
export const providerCapability = z.discriminatedUnion("available", [
|
|
68
|
+
z.object({
|
|
69
|
+
...providerCapabilityFacts,
|
|
70
|
+
available: z.literal(true),
|
|
71
|
+
reason: z.null(),
|
|
72
|
+
availability_code: z.null(),
|
|
73
|
+
}),
|
|
74
|
+
z.object({
|
|
75
|
+
...providerCapabilityFacts,
|
|
76
|
+
available: z.literal(false),
|
|
77
|
+
reason: z.string().nullable(),
|
|
78
|
+
availability_code: z.enum(PROVIDER_REJECTION_CODES).nullable(),
|
|
79
|
+
}),
|
|
80
|
+
]);
|
|
70
81
|
export const providerIdentity = z.object({
|
|
71
82
|
id: z.string(),
|
|
72
83
|
name: z.string(),
|
|
@@ -182,21 +193,25 @@ export const clientFeatureAvailabilitySchema = z.object({
|
|
|
182
193
|
roots: z.boolean(),
|
|
183
194
|
sampling: z.boolean(),
|
|
184
195
|
});
|
|
185
|
-
|
|
196
|
+
const toolAvailabilityMode = z.discriminatedUnion("available", [
|
|
197
|
+
z.object({
|
|
198
|
+
name: z.string(),
|
|
199
|
+
available: z.literal(true),
|
|
200
|
+
missing_operations: z.array(z.string()).max(0),
|
|
201
|
+
remediation: z.null(),
|
|
202
|
+
}),
|
|
203
|
+
z.object({
|
|
204
|
+
name: z.string(),
|
|
205
|
+
available: z.literal(false),
|
|
206
|
+
missing_operations: z.array(z.string()).min(1),
|
|
207
|
+
remediation: z.string().nullable(),
|
|
208
|
+
}),
|
|
209
|
+
]);
|
|
210
|
+
const toolAvailabilityFacts = {
|
|
186
211
|
name: z.string(),
|
|
187
212
|
surface: z.string(),
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
"available",
|
|
191
|
-
"client_capability_missing",
|
|
192
|
-
"target_required",
|
|
193
|
-
"provider_missing",
|
|
194
|
-
"provider_unavailable",
|
|
195
|
-
"target_unsupported",
|
|
196
|
-
"unsupported_host",
|
|
197
|
-
"policy_disabled",
|
|
198
|
-
]),
|
|
199
|
-
remediation: z.string().nullable(),
|
|
213
|
+
default_mode_available: z.boolean().optional(),
|
|
214
|
+
modes: z.array(toolAvailabilityMode).optional(),
|
|
200
215
|
client_requirements: z.object({
|
|
201
216
|
required: z.array(clientFeatureNameSchema),
|
|
202
217
|
optional: z.array(clientFeatureNameSchema),
|
|
@@ -219,7 +234,30 @@ export const toolAvailability = z.object({
|
|
|
219
234
|
idempotent: z.boolean(),
|
|
220
235
|
open_world: z.boolean(),
|
|
221
236
|
}),
|
|
222
|
-
}
|
|
237
|
+
};
|
|
238
|
+
export const toolUnavailabilityReason = z.enum([
|
|
239
|
+
"client_capability_missing",
|
|
240
|
+
"target_required",
|
|
241
|
+
"provider_missing",
|
|
242
|
+
"provider_unavailable",
|
|
243
|
+
"target_unsupported",
|
|
244
|
+
"unsupported_host",
|
|
245
|
+
"policy_disabled",
|
|
246
|
+
]);
|
|
247
|
+
export const toolAvailability = z.discriminatedUnion("available", [
|
|
248
|
+
z.object({
|
|
249
|
+
...toolAvailabilityFacts,
|
|
250
|
+
available: z.literal(true),
|
|
251
|
+
reason: z.literal("available"),
|
|
252
|
+
remediation: z.null(),
|
|
253
|
+
}),
|
|
254
|
+
z.object({
|
|
255
|
+
...toolAvailabilityFacts,
|
|
256
|
+
available: z.literal(false),
|
|
257
|
+
reason: toolUnavailabilityReason,
|
|
258
|
+
remediation: z.string().nullable(),
|
|
259
|
+
}),
|
|
260
|
+
]);
|
|
223
261
|
export const sessionProvider = z.object({
|
|
224
262
|
provider: providerIdentity,
|
|
225
263
|
providers: z.array(providerIdentity),
|
|
@@ -315,13 +353,25 @@ const availableMemoryPermissions = z.object({
|
|
|
315
353
|
available: z.literal(true),
|
|
316
354
|
source: z.literal("ghidra-memory-block"),
|
|
317
355
|
});
|
|
318
|
-
export const bounded = (item) =>
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
356
|
+
export const bounded = (item) => {
|
|
357
|
+
const facts = {
|
|
358
|
+
items: z.array(item),
|
|
359
|
+
total: z.number().int().min(0).nullable(),
|
|
360
|
+
returned: z.number().int().min(0),
|
|
361
|
+
};
|
|
362
|
+
return z.discriminatedUnion("truncated", [
|
|
363
|
+
z.object({
|
|
364
|
+
...facts,
|
|
365
|
+
truncated: z.literal(false),
|
|
366
|
+
next_offset: z.null(),
|
|
367
|
+
}),
|
|
368
|
+
z.object({
|
|
369
|
+
...facts,
|
|
370
|
+
truncated: z.literal(true),
|
|
371
|
+
next_offset: z.number().int().min(0).nullable(),
|
|
372
|
+
}),
|
|
373
|
+
]);
|
|
374
|
+
};
|
|
325
375
|
const addressedValue = z.object({
|
|
326
376
|
address: z.string(),
|
|
327
377
|
value: z.string(),
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const PROPERTY_DESCRIPTIONS = {
|
|
3
|
+
addresses: "Ordered provider-normalized procedure addresses to analyze.",
|
|
4
|
+
approved: "Explicit operator approval to perform this operation.",
|
|
5
|
+
after: "The later or right-hand observation to compare.",
|
|
6
|
+
before: "The earlier or left-hand observation to compare.",
|
|
7
|
+
boundary_id: "Exact reconstruction boundary identifier to evaluate.",
|
|
8
|
+
case_sensitive: "Whether text matching distinguishes uppercase and lowercase.",
|
|
9
|
+
cdp_endpoint: "Approved literal loopback Chrome DevTools Protocol endpoint.",
|
|
10
|
+
comment: "Exact analyst comment text to write.",
|
|
11
|
+
comparisons: "Validated comparison Evidence records to aggregate.",
|
|
12
|
+
coverage: "Exact reconstruction-coverage commitment to verify.",
|
|
13
|
+
detail: "Requested response detail level.",
|
|
14
|
+
direction: "Direction in which to traverse or compare relationships.",
|
|
15
|
+
document: "Exact provider document or program identity.",
|
|
16
|
+
error: "Structured, caller-actionable error when the operation fails.",
|
|
17
|
+
evidence: "Evidence v2 record produced by this operation.",
|
|
18
|
+
evidence_id: "Stable identifier of the recorded Evidence v2 observation.",
|
|
19
|
+
evidence_uri: "Session resource URI for the recorded Evidence v2 observation.",
|
|
20
|
+
executable: "Approved absolute path of the executable to run.",
|
|
21
|
+
format: "Declared input artifact format.",
|
|
22
|
+
name: "Exact name used by this operation.",
|
|
23
|
+
pattern: "Text or bounded pattern used to filter matching results.",
|
|
24
|
+
phase: "Current plan or execution phase of the operation.",
|
|
25
|
+
plan: "Content-bound execution plan and its approval commitment.",
|
|
26
|
+
query: "Non-empty feature or text query to investigate.",
|
|
27
|
+
question: "Concrete unresolved question to retain for later investigation.",
|
|
28
|
+
result: "Primary structured result returned by this operation.",
|
|
29
|
+
left: "Left-hand input used for comparison or differential execution.",
|
|
30
|
+
limit: "Maximum number of results to return in this page.",
|
|
31
|
+
limits: "Bounded resource-consumption and result-size limits for this operation.",
|
|
32
|
+
mode: "Operation mode that selects the requested behavior.",
|
|
33
|
+
offset: "Zero-based index of the first result to return.",
|
|
34
|
+
overwrite: "Whether an existing destination may be replaced.",
|
|
35
|
+
path: "Local filesystem path used by this operation.",
|
|
36
|
+
provider_id: "Exact deep-analysis provider ID, or automatic selection when omitted.",
|
|
37
|
+
right: "Right-hand input used for comparison or differential execution.",
|
|
38
|
+
schema_version: "Version of this structured result schema.",
|
|
39
|
+
source_evidence: "Evidence records supporting the prepared source transformation.",
|
|
40
|
+
status: "Current lifecycle or verification status.",
|
|
41
|
+
summary: "Concise evidence-backed summary of the result.",
|
|
42
|
+
symbols: "Ordered bounded Swift symbols to demangle.",
|
|
43
|
+
target_id: "Exact authorized CDP target identifier.",
|
|
44
|
+
unknown_id: "Exact residual-unknown identifier.",
|
|
45
|
+
unknown_registry_approved: "Explicit approval to record bounded residual uncertainty in the session registry.",
|
|
46
|
+
workspace_path: "Approved local path of the persistent investigation workspace.",
|
|
47
|
+
};
|
|
48
|
+
/** Attach caller guidance to a canonical schema for the SDK wire projection. */
|
|
49
|
+
export const toolInputSchemaWithMetadata = (contract) => {
|
|
50
|
+
const schema = contract.inputSchema.meta(z.globalRegistry.get(contract.inputSchema) ?? {});
|
|
51
|
+
const standard = schema["~standard"];
|
|
52
|
+
const inputJsonSchema = standard.jsonSchema?.input;
|
|
53
|
+
if (inputJsonSchema === undefined)
|
|
54
|
+
throw new TypeError("Tool input schema does not expose Standard JSON Schema");
|
|
55
|
+
// Zod's input projection drops root metadata when a descendant transforms.
|
|
56
|
+
// Preserve the parser and let the SDK own conversion of everything else.
|
|
57
|
+
Object.defineProperty(schema, "~standard", {
|
|
58
|
+
value: {
|
|
59
|
+
...standard,
|
|
60
|
+
jsonSchema: {
|
|
61
|
+
...standard.jsonSchema,
|
|
62
|
+
input: (options) => ({
|
|
63
|
+
...describeProperties(inputJsonSchema(options)),
|
|
64
|
+
examples: contract.examples.map(({ input }) => input),
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
return schema;
|
|
70
|
+
};
|
|
71
|
+
const describeProperties = (value) => Object.fromEntries(Object.entries(value).map(([key, child]) => {
|
|
72
|
+
if (key !== "properties" || !isObject(child))
|
|
73
|
+
return [key, describeValue(child)];
|
|
74
|
+
return [
|
|
75
|
+
key,
|
|
76
|
+
Object.fromEntries(Object.entries(child).map(([property, propertySchema]) => [
|
|
77
|
+
property,
|
|
78
|
+
isObject(propertySchema) &&
|
|
79
|
+
typeof propertySchema.description !== "string"
|
|
80
|
+
? {
|
|
81
|
+
...describeProperties(propertySchema),
|
|
82
|
+
description: fallbackPropertyDescription(property),
|
|
83
|
+
}
|
|
84
|
+
: describeValue(propertySchema),
|
|
85
|
+
])),
|
|
86
|
+
];
|
|
87
|
+
}));
|
|
88
|
+
const describeValue = (value) => {
|
|
89
|
+
if (Array.isArray(value))
|
|
90
|
+
return value.map(describeValue);
|
|
91
|
+
return isObject(value) ? describeProperties(value) : value;
|
|
92
|
+
};
|
|
93
|
+
const fallbackPropertyDescription = (property) => {
|
|
94
|
+
const explicit = PROPERTY_DESCRIPTIONS[property];
|
|
95
|
+
if (explicit !== undefined)
|
|
96
|
+
return explicit;
|
|
97
|
+
const words = property.replaceAll("_", " ");
|
|
98
|
+
if (property.endsWith("_approved"))
|
|
99
|
+
return `Explicit operator approval for ${words.slice(0, -9)}.`;
|
|
100
|
+
if (property.endsWith("_offset"))
|
|
101
|
+
return `Zero-based index of the first ${words.slice(0, -7)} to return.`;
|
|
102
|
+
if (property.endsWith("_limit"))
|
|
103
|
+
return `Maximum number of ${words.slice(0, -6)} entries to return.`;
|
|
104
|
+
if (property.startsWith("max_"))
|
|
105
|
+
return `Maximum permitted ${words.slice(4)} for this operation.`;
|
|
106
|
+
if (property.startsWith("include_"))
|
|
107
|
+
return `Whether to include ${words.slice(8)} in the result.`;
|
|
108
|
+
if (property.startsWith("expected_"))
|
|
109
|
+
return `Expected ${words.slice(9)} used to reject stale or mismatched input.`;
|
|
110
|
+
if (property.endsWith("_sha256"))
|
|
111
|
+
return `Exact SHA-256 digest of ${words.slice(0, -7)}.`;
|
|
112
|
+
if (property.endsWith("_evidence_id"))
|
|
113
|
+
return `Exact Evidence v2 identifier for the ${words.slice(0, -12)} observation.`;
|
|
114
|
+
if (property.endsWith("_evidence_ids"))
|
|
115
|
+
return `Ordered Evidence v2 identifiers for the ${words.slice(0, -13)} observations.`;
|
|
116
|
+
if (property.endsWith("_path"))
|
|
117
|
+
return `Local filesystem path for ${words.slice(0, -5)}.`;
|
|
118
|
+
if (property.endsWith("_uri"))
|
|
119
|
+
return `Canonical URI for ${words.slice(0, -4)}.`;
|
|
120
|
+
if (property.endsWith("_bytes"))
|
|
121
|
+
return `Bounded byte count for ${words.slice(0, -6)}.`;
|
|
122
|
+
if (property.endsWith("_root") || property.endsWith("_roots"))
|
|
123
|
+
return `Approved canonical filesystem ${words}.`;
|
|
124
|
+
if (property.startsWith("is_") || property.startsWith("has_"))
|
|
125
|
+
return `Whether ${words}.`;
|
|
126
|
+
return `Value for ${words}.`;
|
|
127
|
+
};
|
|
128
|
+
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
package/dist/doctorRuntime.js
CHANGED
|
@@ -58,7 +58,7 @@ const inspectJavaScriptReplay = async () => {
|
|
|
58
58
|
detail: config.error.message,
|
|
59
59
|
remediation: "Fix the reported REA_JAVASCRIPT_REPLAY_* configuration.",
|
|
60
60
|
};
|
|
61
|
-
if (
|
|
61
|
+
if (config.value.javascriptReplayPolicy.status === "disabled")
|
|
62
62
|
return {
|
|
63
63
|
name: "javascript-replay",
|
|
64
64
|
ok: true,
|
|
@@ -2,6 +2,8 @@ import { AnalysisInputError, ArtifactOperationError, BinaryTargetError, BrowserO
|
|
|
2
2
|
export const analysisErrorRemediationAction = (error) => {
|
|
3
3
|
if (error instanceof AnalysisInputError)
|
|
4
4
|
return "Correct the listed arguments and retry.";
|
|
5
|
+
if (error instanceof UnknownRegistryError && error.reason === "not-found")
|
|
6
|
+
return "Check that the unknown_id belongs to this session, then retry.";
|
|
5
7
|
if (error instanceof ReplayPlanStaleError)
|
|
6
8
|
return "Review the rebuilt replay plan and explicitly approve its new digest.";
|
|
7
9
|
if (error instanceof PermissionRequiredError)
|
|
@@ -64,7 +66,7 @@ const artifactErrorCategory = (reason) => {
|
|
|
64
66
|
return "truncated";
|
|
65
67
|
if (reason === "cancelled")
|
|
66
68
|
return "cancelled";
|
|
67
|
-
if (reason === "unavailable")
|
|
69
|
+
if (reason === "policy" || reason === "unavailable")
|
|
68
70
|
return "unavailable";
|
|
69
71
|
return "execution_failure";
|
|
70
72
|
};
|
|
@@ -103,6 +105,8 @@ export const analysisErrorUserMessage = (error) => {
|
|
|
103
105
|
return evidenceFileMessage(error.reason);
|
|
104
106
|
if (error instanceof InvestigationWorkspaceError)
|
|
105
107
|
return investigationWorkspaceMessage(error.reason);
|
|
108
|
+
if (error instanceof UnknownRegistryError && error.reason === "not-found")
|
|
109
|
+
return "The requested residual unknown does not exist in this session. Check the unknown_id and try again.";
|
|
106
110
|
if (error instanceof UnknownRegistryError)
|
|
107
111
|
return "Evidence state changed before the update completed. Refresh the current state and try again.";
|
|
108
112
|
if (error instanceof ConfigurationError)
|
|
@@ -163,8 +167,10 @@ const artifactMessage = (reason) => {
|
|
|
163
167
|
return "Artifact is too large to process safely. Narrow the requested path or use a smaller artifact.";
|
|
164
168
|
if (reason === "path")
|
|
165
169
|
return "Artifact path is not allowed. Choose a path inside the artifact and try again.";
|
|
170
|
+
if (reason === "policy")
|
|
171
|
+
return "Artifact integrity continuation is disabled by policy. Configure REA_ARTIFACT_INTEGRITY_CONTINUE_ENABLED=true and retry only if continuing after mismatches is approved.";
|
|
166
172
|
if (reason === "unavailable")
|
|
167
|
-
return "Artifact
|
|
173
|
+
return "Artifact processing is unavailable for the current target or policy. Check artifact support and required approvals.";
|
|
168
174
|
if (reason === "format" || reason === "integrity")
|
|
169
175
|
return "Artifact is invalid or has changed. Get a fresh copy and try again.";
|
|
170
176
|
return "Artifact could not be read or written. Check file access and try again.";
|
|
@@ -152,6 +152,7 @@ const requestErrorDetails = (error) => {
|
|
|
152
152
|
issues: error.issues.map((issue) => ({
|
|
153
153
|
path: [...issue.path],
|
|
154
154
|
reason: issue.reason,
|
|
155
|
+
...(issue.message === undefined ? {} : { message: issue.message }),
|
|
155
156
|
...(issue.expected === undefined ? {} : { expected: issue.expected }),
|
|
156
157
|
...(issue.minimum === undefined ? {} : { minimum: issue.minimum }),
|
|
157
158
|
...(issue.maximum === undefined ? {} : { maximum: issue.maximum }),
|
|
@@ -146,6 +146,8 @@ const classify = (all) => ({
|
|
|
146
146
|
});
|
|
147
147
|
const retain = (groups, maximum) => {
|
|
148
148
|
let remaining = maximum;
|
|
149
|
+
// SAFETY: the projection preserves every key from Groups and replaces only
|
|
150
|
+
// each readonly Component array with a bounded mutable Component array.
|
|
149
151
|
return Object.fromEntries(Object.entries(groups).map(([key, values]) => {
|
|
150
152
|
const selected = [...values]
|
|
151
153
|
.sort((left, right) => compare(left.path, right.path))
|
|
@@ -140,6 +140,8 @@ const classifyComponents = (all, roots) => {
|
|
|
140
140
|
};
|
|
141
141
|
const retainComponents = (groups, maximum) => {
|
|
142
142
|
let remaining = maximum;
|
|
143
|
+
// SAFETY: the projection preserves every key from Groups and replaces only
|
|
144
|
+
// each readonly Component array with a bounded mutable Component array.
|
|
143
145
|
return Object.fromEntries(Object.entries(groups).map(([key, values]) => {
|
|
144
146
|
const retained = [...values]
|
|
145
147
|
.sort((left, right) => compare(left.path, right.path))
|
|
@@ -36,14 +36,16 @@ export const parseBinaryTarget = async (input, cwd = process.cwd(), hostArchitec
|
|
|
36
36
|
format: "analysis-database",
|
|
37
37
|
});
|
|
38
38
|
const artifactFormat = await detectArtifactFormat(path, handle);
|
|
39
|
-
if (artifactFormat !== undefined)
|
|
40
|
-
|
|
39
|
+
if (artifactFormat !== undefined) {
|
|
40
|
+
const identity = {
|
|
41
41
|
path,
|
|
42
42
|
sourcePath: canonical,
|
|
43
43
|
sha256: await sha256Handle(handle),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
};
|
|
45
|
+
return isArchiveFormat(artifactFormat)
|
|
46
|
+
? ok({ ...identity, kind: "archive", format: artifactFormat })
|
|
47
|
+
: ok({ ...identity, kind: "artifact", format: artifactFormat });
|
|
48
|
+
}
|
|
47
49
|
const detected = await readExecutableMetadata(handle, hostArchitecture);
|
|
48
50
|
if (!detected.ok)
|
|
49
51
|
return err(new BinaryTargetError(path, detected.error));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,75 +1,27 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { browserScenarioDiffSchema, compareBrowserScenarios, compareBrowserScenariosInputSchema, } from "./browserScenarioDiff.js";
|
|
3
3
|
import { compareWebCaptures, captureSnapshotSchema, webCaptureDiffSchema, } from "./webCaptureDiff.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
.
|
|
15
|
-
.describe("
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
.default(2_000)
|
|
26
|
-
.describe("Maximum normalized change records to retain."),
|
|
27
|
-
})
|
|
28
|
-
.superRefine((input, context) => {
|
|
29
|
-
const hasPassive = input.before !== undefined || input.after !== undefined;
|
|
30
|
-
const hasScenario = input.before_scenario !== undefined || input.after_scenario !== undefined;
|
|
31
|
-
if (hasPassive === hasScenario)
|
|
32
|
-
context.addIssue({
|
|
33
|
-
code: "custom",
|
|
34
|
-
message: "Provide exactly one complete pair: before/after or before_scenario/after_scenario",
|
|
35
|
-
});
|
|
36
|
-
if (hasPassive && (input.before === undefined || input.after === undefined))
|
|
37
|
-
context.addIssue({
|
|
38
|
-
code: "custom",
|
|
39
|
-
message: "Passive comparison requires both before and after",
|
|
40
|
-
});
|
|
41
|
-
if (hasScenario &&
|
|
42
|
-
(input.before_scenario === undefined ||
|
|
43
|
-
input.after_scenario === undefined))
|
|
44
|
-
context.addIssue({
|
|
45
|
-
code: "custom",
|
|
46
|
-
message: "Browser scenario comparison requires both before_scenario and after_scenario",
|
|
47
|
-
});
|
|
48
|
-
if (hasPassive && input.normalization.rules.length > 0)
|
|
49
|
-
context.addIssue({
|
|
50
|
-
code: "custom",
|
|
51
|
-
path: ["normalization"],
|
|
52
|
-
message: "Literal normalization rules apply only to browser scenario captures",
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
/** Parsed legacy page snapshots or step-indexed browser scenarios. */
|
|
56
|
-
export const browserCaptureComparisonInputSchema = browserCaptureComparisonWireSchema.transform((input) => {
|
|
57
|
-
if (input.before_scenario !== undefined &&
|
|
58
|
-
input.after_scenario !== undefined)
|
|
59
|
-
return {
|
|
60
|
-
before_scenario: input.before_scenario,
|
|
61
|
-
after_scenario: input.after_scenario,
|
|
62
|
-
normalization: input.normalization,
|
|
63
|
-
max_changes: input.max_changes,
|
|
64
|
-
};
|
|
65
|
-
if (input.before !== undefined && input.after !== undefined)
|
|
66
|
-
return {
|
|
67
|
-
before: input.before,
|
|
68
|
-
after: input.after,
|
|
69
|
-
max_changes: input.max_changes,
|
|
70
|
-
};
|
|
71
|
-
throw new TypeError("Capture comparison pair refinement failed");
|
|
72
|
-
});
|
|
4
|
+
const maxChangesSchema = z
|
|
5
|
+
.number()
|
|
6
|
+
.int()
|
|
7
|
+
.min(1)
|
|
8
|
+
.max(20_000)
|
|
9
|
+
.default(2_000)
|
|
10
|
+
.describe("Maximum normalized change records to retain.");
|
|
11
|
+
/** Top-level MCP shape for exactly one complete passive or scenario pair. */
|
|
12
|
+
export const browserCaptureComparisonInputSchema = z.union([
|
|
13
|
+
z.strictObject({
|
|
14
|
+
before: captureSnapshotSchema.describe("Earlier passive web-page capture."),
|
|
15
|
+
after: captureSnapshotSchema.describe("Later passive web-page capture."),
|
|
16
|
+
max_changes: maxChangesSchema,
|
|
17
|
+
}),
|
|
18
|
+
z.strictObject({
|
|
19
|
+
before_scenario: compareBrowserScenariosInputSchema.shape.before_scenario.describe("Earlier browser scenario capture."),
|
|
20
|
+
after_scenario: compareBrowserScenariosInputSchema.shape.after_scenario.describe("Later browser scenario capture."),
|
|
21
|
+
normalization: compareBrowserScenariosInputSchema.shape.normalization.describe("Exact-literal normalization policy."),
|
|
22
|
+
max_changes: maxChangesSchema,
|
|
23
|
+
}),
|
|
24
|
+
]);
|
|
73
25
|
/** Result from passive page or browser scenario comparison. */
|
|
74
26
|
export const browserCaptureComparisonSchema = z.union([
|
|
75
27
|
browserScenarioDiffSchema,
|
|
@@ -186,9 +186,7 @@ const DEFAULT_BROWSER_INSPECTION_LIMITS = {
|
|
|
186
186
|
max_websocket_shape_bytes: 64 * 1_024,
|
|
187
187
|
max_total_websocket_shape_bytes: 1_024 * 1_024,
|
|
188
188
|
};
|
|
189
|
-
|
|
190
|
-
export const inspectWebPageInputSchema = z
|
|
191
|
-
.object({
|
|
189
|
+
const inspectWebPageInputFacts = {
|
|
192
190
|
...approvedBrowserInput,
|
|
193
191
|
target_id: z.string().trim().min(1).max(256),
|
|
194
192
|
observation_ms: z.number().int().min(0).max(10_000).default(500),
|
|
@@ -199,12 +197,21 @@ export const inspectWebPageInputSchema = z
|
|
|
199
197
|
json_body_schema_approved: z.boolean().default(false),
|
|
200
198
|
include_websocket_shapes: z.boolean().default(false),
|
|
201
199
|
websocket_shape_approved: z.boolean().default(false),
|
|
202
|
-
include_script_sources: z.boolean().default(false),
|
|
203
200
|
include_storage_keys: z.boolean().default(false),
|
|
204
201
|
include_storage_fingerprints: z.boolean().default(false),
|
|
205
202
|
limits: browserInspectionLimitsSchema.default(DEFAULT_BROWSER_INSPECTION_LIMITS),
|
|
206
|
-
}
|
|
207
|
-
|
|
203
|
+
};
|
|
204
|
+
const inspectWebPageWithoutSourceSchema = z.strictObject({
|
|
205
|
+
...inspectWebPageInputFacts,
|
|
206
|
+
include_script_sources: z.literal(false).default(false),
|
|
207
|
+
source_capture_approved: z.literal(false).default(false),
|
|
208
|
+
});
|
|
209
|
+
const inspectWebPageWithSourceShapeSchema = z.strictObject({
|
|
210
|
+
...inspectWebPageInputFacts,
|
|
211
|
+
include_script_sources: z.literal(true).default(true),
|
|
212
|
+
source_capture_approved: z.literal(true),
|
|
213
|
+
});
|
|
214
|
+
const refineInspectWebPageInput = (input, context) => {
|
|
208
215
|
if (input.include_storage_fingerprints && !input.include_storage_keys)
|
|
209
216
|
context.addIssue({
|
|
210
217
|
code: "custom",
|
|
@@ -260,14 +267,20 @@ export const inspectWebPageInputSchema = z
|
|
|
260
267
|
path: ["limits", "max_websocket_shape_bytes"],
|
|
261
268
|
message: "Per-frame WebSocket limit cannot exceed the total frame limit",
|
|
262
269
|
});
|
|
263
|
-
if (input.limits.max_ax_text_field_bytes >
|
|
264
|
-
input.limits.max_total_ax_text_bytes)
|
|
270
|
+
if (input.limits.max_ax_text_field_bytes > input.limits.max_total_ax_text_bytes)
|
|
265
271
|
context.addIssue({
|
|
266
272
|
code: "custom",
|
|
267
273
|
path: ["limits", "max_ax_text_field_bytes"],
|
|
268
274
|
message: "Per-field accessibility text limit cannot exceed the total text limit",
|
|
269
275
|
});
|
|
270
|
-
}
|
|
276
|
+
};
|
|
277
|
+
/** Source-capturing inspection input, reusable by static bundle analysis. */
|
|
278
|
+
export const inspectWebPageWithSourceInputSchema = inspectWebPageWithSourceShapeSchema.superRefine(refineInspectWebPageInput);
|
|
279
|
+
/** Public input for one passive, bounded inspection of an existing page. */
|
|
280
|
+
export const inspectWebPageInputSchema = z.union([
|
|
281
|
+
inspectWebPageWithoutSourceSchema.superRefine(refineInspectWebPageInput),
|
|
282
|
+
inspectWebPageWithSourceInputSchema,
|
|
283
|
+
]);
|
|
271
284
|
export const sanitizedBrowserUrlSchema = z.object({
|
|
272
285
|
url: z.string().max(MAX_SANITIZED_BROWSER_URL_CHARS),
|
|
273
286
|
origin: z.string().max(2_048).nullable(),
|