rea-agents 2.0.0 → 2.2.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 +103 -38
- package/bridge/ghidra/ReaGhidraBridge.java +96 -11
- package/dist/application/AndroidApplicationService.js +17 -0
- package/dist/application/AppleApplicationService.js +17 -0
- package/dist/application/ArtifactExtraction.js +1 -1
- package/dist/application/ArtifactInventory/classify.js +42 -0
- package/dist/application/ArtifactInventory/hash.js +43 -0
- package/dist/application/ArtifactInventory/reader.js +41 -0
- package/dist/application/ArtifactInventory/scanCanonical.js +155 -0
- package/dist/application/ArtifactInventory/scanReader.js +124 -0
- package/dist/application/ArtifactInventory/types.js +10 -0
- package/dist/application/ArtifactInventory.js +9 -351
- package/dist/application/AuthorizedArtifactInventory.js +2 -2
- package/dist/application/BinarySession.js +47 -270
- package/dist/application/BinarySessionExecution.js +28 -0
- package/dist/application/BinarySessionOpen.js +39 -0
- package/dist/application/BinarySessionRecords.js +149 -0
- package/dist/application/BinarySessionStatus.js +75 -0
- package/dist/application/CapabilityInventory.js +24 -2
- package/dist/application/ClientRegistrationStatus.js +11 -4
- package/dist/application/CrossVersionInventory.js +8 -2
- package/dist/application/CrossVersionInvestigation.js +1 -23
- package/dist/application/CrossVersionInvestigationCollections.js +23 -0
- package/dist/application/DirectAnalysis.js +47 -44
- package/dist/application/Doctor.js +156 -238
- package/dist/application/DoctorDiagnostics.js +180 -0
- package/dist/application/ElectronBoundaryAnalysis.js +23 -7
- package/dist/application/ElectronBoundaryGraphWindows.js +32 -8
- package/dist/application/EnhancedToolPagination.js +22 -0
- package/dist/application/EnhancedToolTypes.js +4 -0
- package/dist/application/EnhancedTools.js +20 -37
- package/dist/application/InstrumentedJavaScriptReplayHost.js +36 -0
- package/dist/application/InventoryProjectionEvidence.js +41 -0
- package/dist/application/InvestigationProviders.js +12 -0
- package/dist/application/InvestigationWorkspaceStore.js +24 -10
- package/dist/application/JavaScriptArtifactAnalysis.js +45 -6
- package/dist/application/JavaScriptArtifactFiles.js +6 -2
- package/dist/application/JavaScriptArtifactGraphBuilder.js +23 -1
- package/dist/application/JavaScriptArtifactGraphBundlers.js +225 -0
- package/dist/application/JavaScriptArtifactGraphContext.js +37 -36
- package/dist/application/JavaScriptArtifactGraphDocuments.js +27 -4
- package/dist/application/JavaScriptArtifactGraphFindings.js +54 -8
- package/dist/application/JavaScriptArtifactGraphStructure.js +29 -101
- package/dist/application/JavaScriptArtifactPathResolution.js +269 -0
- package/dist/application/JavaScriptArtifactReconstruction.js +1 -1
- package/dist/application/JavaScriptJsonModules.js +39 -0
- package/dist/application/JavaScriptModuleRelationships.js +262 -0
- package/dist/application/JavaScriptReplayPermission.js +16 -0
- package/dist/application/JavaScriptReplayService.js +182 -156
- package/dist/application/LinuxHopper.js +10 -0
- package/dist/application/MacHopper.js +22 -11
- package/dist/application/NodeRuntimeCharacterizationService.js +196 -0
- package/dist/application/PermissionAuthority.js +106 -63
- package/dist/application/ProcessCaptureCapability.js +1 -1
- package/dist/application/ProcessCapturePermission.js +13 -0
- package/dist/application/ProcessCli.js +2 -12
- package/dist/application/ProcessHarness.js +1 -1
- package/dist/application/ProcessPairedExperiment.js +72 -0
- package/dist/application/ProjectPermissionStore.js +48 -9
- package/dist/application/RealHopperAssertions.js +76 -0
- package/dist/application/ReconstructionCoverageService.js +69 -0
- package/dist/application/ReconstructionCoverageWorkspaceStore.js +31 -0
- package/dist/application/RuntimeExecutableDiagnostics.js +172 -0
- package/dist/application/Setup.js +148 -260
- package/dist/application/SetupClientConfiguration.js +224 -0
- package/dist/application/SetupClients.js +24 -2
- package/dist/application/SetupPlan.js +124 -12
- package/dist/application/SetupSkill.js +54 -36
- package/dist/application/SupportedClients.js +1 -0
- package/dist/application/Uninstall.js +12 -3
- package/dist/application/Upgrade.js +16 -1
- package/dist/application/WindowsCapabilities.js +86 -0
- package/dist/artifacts/AsarArtifactReader.js +11 -0
- package/dist/browser/BrowserProcessStartup.js +88 -0
- package/dist/browser/CdpCaptureDocuments.js +12 -8
- package/dist/browser/CdpCaptureEventBodyShapes.js +75 -0
- package/dist/browser/CdpCaptureEventHandlers.js +336 -0
- package/dist/browser/CdpCaptureEventHelpers.js +71 -0
- package/dist/browser/CdpCaptureEventState.js +1 -0
- package/dist/browser/CdpCaptureEventTypes.js +1 -0
- package/dist/browser/CdpCaptureEvents.js +29 -496
- package/dist/browser/CdpObservationSession.js +51 -8
- package/dist/browser/CdpPageCapture.js +12 -133
- package/dist/browser/CdpPageCaptureScripts.js +97 -0
- package/dist/browser/CdpPageCaptureWorkers.js +46 -0
- package/dist/browser/CdpWebMcpDiscovery.js +38 -14
- package/dist/browser/PngVisualDiff.js +9 -2
- package/dist/catalogIdentity.js +4 -0
- package/dist/cli/artifactCommands.js +82 -0
- package/dist/cli/coreAnalysisCommands.js +232 -0
- package/dist/cli/managedCommands.js +397 -0
- package/dist/cli/managedProjectGraphCommand.js +24 -0
- package/dist/cli/options.js +9 -0
- package/dist/cli/setupCommands.js +113 -0
- package/dist/cli/types.js +1 -0
- package/dist/cli/utilityCommands.js +122 -0
- package/dist/cli.js +10 -768
- package/dist/cliApplicationCommands.js +118 -4
- package/dist/cliBrowserAdvancedCommands.js +73 -16
- package/dist/cliBrowserCommands.js +39 -115
- package/dist/cliCommandNames.js +4 -0
- package/dist/cliElectronCommands.js +33 -62
- package/dist/cliEvidenceCommands.js +13 -2
- package/dist/cliInvestigationCommands.js +53 -10
- package/dist/cliObservationOptions.js +137 -0
- package/dist/cliPolicyCommands.js +80 -46
- package/dist/cliSetup.js +306 -0
- package/dist/config/environment.js +107 -0
- package/dist/config/parseConfig.js +228 -0
- package/dist/config/parsers.js +68 -0
- package/dist/config/permissions.js +30 -0
- package/dist/config/types.js +1 -0
- package/dist/config.js +1 -375
- package/dist/contracts/applicationToolContracts.js +134 -0
- package/dist/contracts/electronToolContracts.js +51 -3
- package/dist/contracts/managedToolContracts.js +8 -3
- package/dist/contracts/managedWorkflowToolContracts.js +3 -3
- package/dist/contracts/providerSelection.js +2 -0
- package/dist/contracts/sessionStatusContract.js +26 -0
- package/dist/contracts/toolContractTypes.js +12 -1
- package/dist/contracts/toolContracts.js +5 -12
- package/dist/contracts/toolEffects.js +14 -0
- package/dist/contracts/toolOutputSchemaGroups.js +274 -0
- package/dist/contracts/toolOutputSchemaPrimitives.js +328 -0
- package/dist/contracts/toolOutputSchemas.js +2 -550
- package/dist/domain/analysisErrorPresentation.js +234 -0
- package/dist/domain/analysisErrorProjection.js +284 -0
- package/dist/domain/androidApplication.js +206 -0
- package/dist/domain/appleApplication.js +221 -0
- package/dist/domain/artifactComparison.js +34 -15
- package/dist/domain/binaryTarget.js +87 -37
- package/dist/domain/boundedCartesianProjection.js +15 -0
- package/dist/domain/browserObservation.js +1 -285
- package/dist/domain/browserObservationSchemas.js +286 -0
- package/dist/domain/electronStaticAnalysisBrowser.js +14 -2
- package/dist/domain/errors.js +4 -486
- package/dist/domain/functionComparison.js +4 -165
- package/dist/domain/functionComparisonDimensions.js +164 -0
- package/dist/domain/javascriptApplicationVersionItems.js +18 -6
- package/dist/domain/javascriptApplicationVersionKeys.js +8 -8
- package/dist/domain/javascriptExportInstrumentation.js +97 -0
- package/dist/domain/javascriptFeatureTraversal.js +19 -7
- package/dist/domain/javascriptRuntimeStaticCandidates.js +3 -1
- package/dist/domain/javascriptSemanticAnalysis.js +386 -0
- package/dist/domain/javascriptSemanticIr.js +30 -0
- package/dist/domain/javascriptSemanticProjection.js +366 -0
- package/dist/domain/javascriptSemanticState.js +40 -0
- package/dist/domain/javascriptSemanticTraversal.js +22 -0
- package/dist/domain/javascriptSemanticValues.js +352 -0
- package/dist/domain/javascriptStaticAnalysis.js +5 -221
- package/dist/domain/javascriptStaticAnalysisBundler.js +209 -0
- package/dist/domain/javascriptStaticAnalysisCalls.js +180 -0
- package/dist/domain/javascriptStaticAnalysisHelpers.js +71 -2
- package/dist/domain/knownPageCoverage.js +21 -0
- package/dist/domain/managedApplicationGraph.js +14 -364
- package/dist/domain/managedApplicationGraphCoverage.js +170 -0
- package/dist/domain/managedApplicationGraphNodeCoverage.js +6 -0
- package/dist/domain/managedApplicationGraphNodes.js +336 -0
- package/dist/domain/managedArtifact.js +16 -8
- package/dist/domain/managedMemberComparison.js +37 -391
- package/dist/domain/managedMemberComparisonCoverage.js +72 -0
- package/dist/domain/managedMemberComparisonMatch.js +356 -0
- package/dist/domain/managedNativeVerification.js +27 -389
- package/dist/domain/managedNativeVerificationMatch.js +272 -0
- package/dist/domain/managedNativeVerificationSchemas.js +141 -0
- package/dist/domain/managedReconstruction.js +82 -69
- package/dist/domain/managedRuntimeCorrelation.js +12 -3
- package/dist/domain/nodeRuntimeCharacterization.js +66 -0
- package/dist/domain/permissionPolicy.js +2 -0
- package/dist/domain/processComparison.js +19 -0
- package/dist/domain/processPairedExperiment.js +128 -0
- package/dist/domain/reconstructionCoverage.js +387 -0
- package/dist/domain/reconstructionCoverageEvaluation.js +212 -0
- package/dist/domain/reconstructionVerificationSchemas.js +8 -0
- package/dist/domain/replayMachine.js +316 -0
- package/dist/domain/replayMachineRuntime.js +215 -0
- package/dist/domain/runtimeCharacterization.js +85 -0
- package/dist/domain/runtimeIdentification.js +210 -0
- package/dist/domain/webBundleAnalyzer.js +3 -409
- package/dist/domain/webBundleAnalyzerAst.js +77 -0
- package/dist/domain/webBundleAnalyzerInspection.js +307 -0
- package/dist/domain/webBundleAnalyzerResult.js +120 -0
- package/dist/dotnet/ManagedArtifactInspector.js +50 -29
- package/dist/dotnet/ManagedMemberInspector.js +51 -785
- package/dist/dotnet/ManagedMemberInspectorCore.js +297 -0
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +427 -0
- package/dist/dotnet/ManagedMemberRows.js +120 -0
- package/dist/dotnet/ManagedMetadataInventory.js +42 -306
- package/dist/dotnet/ManagedMetadataInventoryRows.js +292 -0
- package/dist/dotnet/ManagedMetadataLayout.js +48 -111
- package/dist/dotnet/ManagedMetadataRowSizes.js +54 -0
- package/dist/dotnet/ManagedMethodBodyReader.js +143 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +311 -0
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +102 -350
- package/dist/dotnet/ManagedPeReader.js +59 -28
- package/dist/evaluation/CodexAgentEval.js +132 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraClient.js +76 -91
- package/dist/ghidra/GhidraClientStartup.js +29 -0
- package/dist/ghidra/GhidraClientWire.js +34 -0
- package/dist/ghidra/GhidraDefaults.js +1 -1
- package/dist/ghidra/GhidraDiagnostics.js +6 -1
- package/dist/ghidra/GhidraInstallation.js +20 -15
- package/dist/ghidra/GhidraLauncher.js +93 -29
- package/dist/ghidra/GhidraProvider.js +61 -161
- package/dist/ghidra/GhidraProviderCapabilities.js +173 -0
- package/dist/ghidra/GhidraSessionValues.js +2 -0
- package/dist/ghidra/GhidraSocketConnection.js +44 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +30 -0
- package/dist/ghidra/GhidraTransport.js +71 -0
- package/dist/identity.js +4 -2
- package/dist/main/messages.js +5 -0
- package/dist/main/reload.js +49 -0
- package/dist/main/shutdown.js +25 -0
- package/dist/main/startup.js +14 -0
- package/dist/main/state.js +26 -0
- package/dist/main/transport.js +61 -0
- package/dist/main/types.js +1 -0
- package/dist/main.js +35 -146
- package/dist/process/PrivateRuntimeRoot.js +3 -2
- package/dist/process/ProcessOwnership.js +35 -0
- package/dist/process/ProviderProcess.js +2 -0
- package/dist/replay/JavaScriptReplayWorker.js +64 -50
- package/dist/replay/LinuxJavaScriptReplayRunner.js +173 -390
- package/dist/replay/LinuxJavaScriptReplaySandbox.js +140 -0
- package/dist/replay/ReplayOutcome.js +95 -0
- package/dist/replay/ReplayProcessLifecycle.js +71 -0
- package/dist/server/ProcessCaptureElicitation.js +157 -0
- package/dist/server/createServer.js +124 -56
- package/dist/server/javascriptApplicationResult.js +85 -0
- package/dist/server/registerApplicationTools/characterization.js +57 -0
- package/dist/server/registerApplicationTools/compareVersions.js +34 -0
- package/dist/server/registerApplicationTools/controlledReplay.js +38 -0
- package/dist/server/registerApplicationTools/coverage.js +84 -0
- package/dist/server/registerApplicationTools/helpers.js +42 -0
- package/dist/server/registerApplicationTools/traceFeature.js +26 -0
- package/dist/server/registerApplicationTools/types.js +1 -0
- package/dist/server/registerApplicationTools.js +10 -112
- package/dist/server/registerBrowserTools.js +59 -83
- package/dist/server/registerElectronTools.js +48 -49
- package/dist/server/registerEnhancedTools.js +34 -42
- package/dist/server/registerEvidenceResources.js +56 -0
- package/dist/server/registerInvestigationTools/helpers.js +74 -0
- package/dist/server/registerInvestigationTools/types.js +1 -0
- package/dist/server/registerInvestigationTools.js +83 -116
- package/dist/server/registerJavaScriptApplicationGraphResource.js +69 -0
- package/dist/server/registerManagedTools.js +18 -1
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +65 -0
- package/dist/server/registerManagedWorkflowTools/contract.js +8 -0
- package/dist/server/registerManagedWorkflowTools/evidence.js +43 -0
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +39 -0
- package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +39 -0
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +52 -0
- package/dist/server/registerManagedWorkflowTools/types.js +1 -0
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +75 -0
- package/dist/server/registerManagedWorkflowTools.js +10 -274
- package/dist/server/registerOfficialTools.js +73 -59
- package/dist/server/registerSessionRecordTools.js +137 -0
- package/dist/server/registerSessionStatusTool.js +97 -26
- package/dist/server/registerSessionTools.js +60 -164
- package/dist/server/sessionAvailabilityPolicy.js +10 -0
- package/dist/server/toolRegistrationOptions.js +101 -3
- package/dist/server/toolResult.js +15 -4
- package/package.json +11 -11
- package/skills/reverse-engineer-anything/SKILL.md +76 -0
- package/skills/reverse-engineer-anything/references/controlled-replay.md +12 -0
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +33 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +25 -0
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +36 -0
- package/skills/reverse-engineer-anything/references/runtime-observation.md +24 -0
- package/scripts/prepare-node-pty.mjs +0 -35
- package/scripts/rebuild-native.mjs +0 -22
- package/skills/rea-analysis/SKILL.md +0 -222
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** Project internal provider routing state into the caller-visible session status. */
|
|
2
|
+
export const binarySessionStatus = ({ target, route, router, runtimeAvailability, }) => {
|
|
3
|
+
const configuredProvider = router.configuredIdentity();
|
|
4
|
+
const provider = providerSummary(configuredProvider);
|
|
5
|
+
const providers = router.providerIdentities(route).map(providerSummary);
|
|
6
|
+
const capabilities = [...(route.capabilities?.values() ?? [])]
|
|
7
|
+
.sort((left, right) => left.operation.localeCompare(right.operation))
|
|
8
|
+
.map((descriptor) => ({
|
|
9
|
+
...descriptor,
|
|
10
|
+
...runtimeAvailability.get(descriptor.operation),
|
|
11
|
+
}))
|
|
12
|
+
.map(capabilityStatus);
|
|
13
|
+
const analysisProviderBinding = route.binding === null
|
|
14
|
+
? null
|
|
15
|
+
: {
|
|
16
|
+
provider: providerSummary(route.binding.identity),
|
|
17
|
+
selection_source: route.binding.selectionSource,
|
|
18
|
+
analysis_profile: structuredClone(route.binding.profile),
|
|
19
|
+
};
|
|
20
|
+
const analysisProviderCandidates = router
|
|
21
|
+
.candidateStatuses(route)
|
|
22
|
+
.map((candidate) => ({
|
|
23
|
+
provider: providerSummary(candidate.provider),
|
|
24
|
+
availability: structuredClone(candidate.availability),
|
|
25
|
+
target_support: structuredClone(candidate.targetSupport),
|
|
26
|
+
selected: candidate.selected,
|
|
27
|
+
capabilities: candidate.capabilities
|
|
28
|
+
.slice()
|
|
29
|
+
.sort((left, right) => left.operation.localeCompare(right.operation))
|
|
30
|
+
.map(capabilityStatus),
|
|
31
|
+
}));
|
|
32
|
+
const common = {
|
|
33
|
+
provider,
|
|
34
|
+
providers,
|
|
35
|
+
capabilities,
|
|
36
|
+
analysis_provider_binding: analysisProviderBinding,
|
|
37
|
+
analysis_provider_candidates: analysisProviderCandidates,
|
|
38
|
+
};
|
|
39
|
+
return target === undefined
|
|
40
|
+
? { open: false, ...common }
|
|
41
|
+
: {
|
|
42
|
+
open: true,
|
|
43
|
+
...common,
|
|
44
|
+
path: target.path,
|
|
45
|
+
sha256: target.sha256,
|
|
46
|
+
format: target.format,
|
|
47
|
+
kind: target.kind,
|
|
48
|
+
architecture: target.architecture ?? null,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const providerSummary = ({ id, name, version, }) => ({ id, name, version });
|
|
52
|
+
const capabilityStatus = (descriptor) => ({
|
|
53
|
+
operation: descriptor.operation,
|
|
54
|
+
available: descriptor.available,
|
|
55
|
+
reason: descriptor.reason,
|
|
56
|
+
input_contract_version: descriptor.inputContractVersion,
|
|
57
|
+
output_contract_version: descriptor.outputContractVersion,
|
|
58
|
+
pagination: descriptor.pagination,
|
|
59
|
+
exhaustive: descriptor.exhaustive,
|
|
60
|
+
effects: {
|
|
61
|
+
mutates_artifact: descriptor.effects.mutatesArtifact,
|
|
62
|
+
launches_process: descriptor.effects.launchesProcess,
|
|
63
|
+
may_show_ui: descriptor.effects.mayShowUi,
|
|
64
|
+
may_access_network: descriptor.effects.mayAccessNetwork,
|
|
65
|
+
may_write_filesystem: descriptor.effects.mayWriteFilesystem,
|
|
66
|
+
changes_permissions: descriptor.effects.changesPermissions,
|
|
67
|
+
requires_root: descriptor.effects.requiresRoot,
|
|
68
|
+
},
|
|
69
|
+
limits: {
|
|
70
|
+
max_results: descriptor.limits.maxResults,
|
|
71
|
+
max_payload_bytes: descriptor.limits.maxPayloadBytes,
|
|
72
|
+
timeout_ms: descriptor.limits.timeoutMs,
|
|
73
|
+
},
|
|
74
|
+
limitations: [...descriptor.limitations],
|
|
75
|
+
});
|
|
@@ -37,7 +37,14 @@ export const buildCapabilityInventory = (sessionStatus, policy) => {
|
|
|
37
37
|
const status = statusSchema.parse(sessionStatus);
|
|
38
38
|
const descriptors = new Map(status.capabilities.map((descriptor) => [descriptor.operation, descriptor]));
|
|
39
39
|
return TOOL_CONTRACTS.map((contract) => {
|
|
40
|
-
const availability = availabilityFor(
|
|
40
|
+
const availability = availabilityFor({
|
|
41
|
+
name: contract.name,
|
|
42
|
+
kind: contract.kind,
|
|
43
|
+
targetOpen: status.open,
|
|
44
|
+
targetKind: status.kind,
|
|
45
|
+
descriptors,
|
|
46
|
+
policy,
|
|
47
|
+
});
|
|
41
48
|
return {
|
|
42
49
|
name: contract.name,
|
|
43
50
|
surface: contract.kind,
|
|
@@ -54,7 +61,16 @@ export const buildCapabilityInventory = (sessionStatus, policy) => {
|
|
|
54
61
|
};
|
|
55
62
|
}).sort((left, right) => left.name.localeCompare(right.name));
|
|
56
63
|
};
|
|
57
|
-
const availabilityFor = (
|
|
64
|
+
const availabilityFor = (context) => {
|
|
65
|
+
const policyDecision = policyAvailability(context);
|
|
66
|
+
if (policyDecision !== null)
|
|
67
|
+
return policyDecision;
|
|
68
|
+
const targetDecision = targetAvailability(context);
|
|
69
|
+
if (targetDecision !== null)
|
|
70
|
+
return targetDecision;
|
|
71
|
+
return providerAvailability(context);
|
|
72
|
+
};
|
|
73
|
+
const policyAvailability = ({ name, kind, policy, }) => {
|
|
58
74
|
if (name === "capture_process_scenario" && !policy.processCaptureEnabled)
|
|
59
75
|
return {
|
|
60
76
|
reason: "policy_disabled",
|
|
@@ -98,6 +114,9 @@ const availabilityFor = (name, kind, targetOpen, targetKind, descriptors, policy
|
|
|
98
114
|
};
|
|
99
115
|
if (kind === "session")
|
|
100
116
|
return { reason: "available", remediation: null };
|
|
117
|
+
return null;
|
|
118
|
+
};
|
|
119
|
+
const targetAvailability = ({ kind, targetKind, targetOpen, }) => {
|
|
101
120
|
if (!targetOpen)
|
|
102
121
|
return {
|
|
103
122
|
reason: "target_required",
|
|
@@ -111,6 +130,9 @@ const availabilityFor = (name, kind, targetOpen, targetKind, descriptors, policy
|
|
|
111
130
|
reason: "target_unsupported",
|
|
112
131
|
remediation: "Inventory or extract a native executable, then call open_binary on that executable.",
|
|
113
132
|
};
|
|
133
|
+
return null;
|
|
134
|
+
};
|
|
135
|
+
const providerAvailability = ({ descriptors, kind, name, }) => {
|
|
114
136
|
if (kind === "enhanced")
|
|
115
137
|
return composedAvailability(name, descriptors);
|
|
116
138
|
const descriptor = descriptors.get(name);
|
|
@@ -6,7 +6,11 @@ import { PRODUCT_IDENTITY } from "../identity.js";
|
|
|
6
6
|
import { supportedClients } from "./SupportedClients.js";
|
|
7
7
|
const objectSchema = z.record(z.string(), z.unknown());
|
|
8
8
|
const registrationSchema = z
|
|
9
|
-
.object({
|
|
9
|
+
.object({
|
|
10
|
+
command: z.string().min(1),
|
|
11
|
+
args: z.array(z.string()).default([]),
|
|
12
|
+
startup_timeout_sec: z.number().positive().optional(),
|
|
13
|
+
})
|
|
10
14
|
.passthrough();
|
|
11
15
|
/** Inspect supported client registrations without reading their environment. */
|
|
12
16
|
export const readClientRegistrationStatuses = async (home, currentCommandPath = resolve(process.argv[1] ?? "unknown")) => {
|
|
@@ -25,7 +29,7 @@ export const readClientRegistrationStatuses = async (home, currentCommandPath =
|
|
|
25
29
|
}
|
|
26
30
|
const registration = registrationSchema.parse(raw);
|
|
27
31
|
const command = [registration.command, ...registration.args];
|
|
28
|
-
statuses.push(status(client.name, client.configPath, command, registrationAligned(
|
|
32
|
+
statuses.push(status(client.name, client.configPath, command, registrationAligned(registration, client.name, currentCommandPath)
|
|
29
33
|
? "aligned"
|
|
30
34
|
: "stale"));
|
|
31
35
|
}
|
|
@@ -35,11 +39,14 @@ export const readClientRegistrationStatuses = async (home, currentCommandPath =
|
|
|
35
39
|
}
|
|
36
40
|
return statuses.sort((left, right) => left.client.localeCompare(right.client));
|
|
37
41
|
};
|
|
38
|
-
const registrationAligned = (
|
|
42
|
+
const registrationAligned = (registration, client, currentCommandPath) => {
|
|
43
|
+
const command = [registration.command, ...registration.args];
|
|
44
|
+
if (client === "codex" && registration.startup_timeout_sec !== 30)
|
|
45
|
+
return false;
|
|
39
46
|
if (command.length === 4 &&
|
|
40
47
|
command[0] === "npx" &&
|
|
41
48
|
command[1] === "-y" &&
|
|
42
|
-
command[2] === PRODUCT_IDENTITY.
|
|
49
|
+
command[2] === PRODUCT_IDENTITY.registrationPackageSpecifier &&
|
|
43
50
|
command[3] === "mcp")
|
|
44
51
|
return true;
|
|
45
52
|
return (command.length === 2 &&
|
|
@@ -10,8 +10,14 @@ export const AUTOMATIC_RUN_LIMITATION = "Automatic cross-version runs compare sh
|
|
|
10
10
|
/** Start both independent version scans while preserving left/right identity. */
|
|
11
11
|
export const scanVersionInventories = async (options, scanner = scanAuthorizedArtifactInventory) => {
|
|
12
12
|
const [left, right] = await Promise.all([
|
|
13
|
-
scanner(options.leftPath, options.inputRoots, options.limits,
|
|
14
|
-
|
|
13
|
+
scanner(options.leftPath, options.inputRoots, options.limits, {
|
|
14
|
+
signal: options.signal,
|
|
15
|
+
integrity: options.integrity,
|
|
16
|
+
}),
|
|
17
|
+
scanner(options.rightPath, options.inputRoots, options.limits, {
|
|
18
|
+
signal: options.signal,
|
|
19
|
+
integrity: options.integrity,
|
|
20
|
+
}),
|
|
15
21
|
]);
|
|
16
22
|
return { left, right };
|
|
17
23
|
};
|
|
@@ -7,6 +7,7 @@ import { createInventoryEvidencePages, runLimitations, scanVersions, targetFor,
|
|
|
7
7
|
import { readInvestigationWorkspace, writeInvestigationWorkspace, } from "./InvestigationWorkspaceStore.js";
|
|
8
8
|
import { createArtifactComparisonEvidence, createChangedBehaviorEvidence, } from "./CrossVersionInvestigationEvidence.js";
|
|
9
9
|
import { selectCompletedInvestigationReplay } from "./CrossVersionInvestigationReplay.js";
|
|
10
|
+
import { investigationEvidenceIds as evidenceIds, mergeInvestigationEvidence as mergeEvidence, recordsForInvestigationRun as recordsForRun, replaceInvestigationRun as replaceRun, } from "./CrossVersionInvestigationCollections.js";
|
|
10
11
|
/** Run or resume a deterministic cross-version artifact investigation. */
|
|
11
12
|
export const runCrossVersionInvestigation = async (input, policy, execution) => {
|
|
12
13
|
const parsed = crossVersionInvestigationInputSchema.safeParse(input);
|
|
@@ -298,26 +299,3 @@ const inventoryEvidence = (workspace, run) => {
|
|
|
298
299
|
? ok({ left, right })
|
|
299
300
|
: err(new EvidenceIntegrityError("Investigation inventory checkpoint is incomplete"));
|
|
300
301
|
};
|
|
301
|
-
const recordsForRun = (workspace, run) => {
|
|
302
|
-
const ids = new Set([
|
|
303
|
-
...run.left_inventory_evidence_ids,
|
|
304
|
-
...run.right_inventory_evidence_ids,
|
|
305
|
-
...(run.comparison_evidence_id === null
|
|
306
|
-
? []
|
|
307
|
-
: [run.comparison_evidence_id]),
|
|
308
|
-
...(run.result_evidence_id === null ? [] : [run.result_evidence_id]),
|
|
309
|
-
]);
|
|
310
|
-
return workspace.bundle.records.filter(({ evidence_id: id }) => ids.has(id));
|
|
311
|
-
};
|
|
312
|
-
const mergeEvidence = (current, additions) => {
|
|
313
|
-
const records = new Map(current.map((record) => [record.evidence_id, record]));
|
|
314
|
-
for (const record of additions)
|
|
315
|
-
if (!records.has(record.evidence_id))
|
|
316
|
-
records.set(record.evidence_id, record);
|
|
317
|
-
return [...records.values()];
|
|
318
|
-
};
|
|
319
|
-
const replaceRun = (runs, replacement) => [
|
|
320
|
-
...runs.filter(({ run_id: id }) => id !== replacement.run_id),
|
|
321
|
-
replacement,
|
|
322
|
-
];
|
|
323
|
-
const evidenceIds = (records) => records.map(({ evidence_id: id }) => id);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const recordsForInvestigationRun = (workspace, run) => {
|
|
2
|
+
const ids = new Set([
|
|
3
|
+
...run.left_inventory_evidence_ids,
|
|
4
|
+
...run.right_inventory_evidence_ids,
|
|
5
|
+
...(run.comparison_evidence_id === null
|
|
6
|
+
? []
|
|
7
|
+
: [run.comparison_evidence_id]),
|
|
8
|
+
...(run.result_evidence_id === null ? [] : [run.result_evidence_id]),
|
|
9
|
+
]);
|
|
10
|
+
return workspace.bundle.records.filter(({ evidence_id: id }) => ids.has(id));
|
|
11
|
+
};
|
|
12
|
+
export const mergeInvestigationEvidence = (current, additions) => {
|
|
13
|
+
const records = new Map(current.map((record) => [record.evidence_id, record]));
|
|
14
|
+
for (const record of additions)
|
|
15
|
+
if (!records.has(record.evidence_id))
|
|
16
|
+
records.set(record.evidence_id, record);
|
|
17
|
+
return [...records.values()];
|
|
18
|
+
};
|
|
19
|
+
export const replaceInvestigationRun = (runs, replacement) => [
|
|
20
|
+
...runs.filter(({ run_id: id }) => id !== replacement.run_id),
|
|
21
|
+
replacement,
|
|
22
|
+
];
|
|
23
|
+
export const investigationEvidenceIds = (records) => records.map(({ evidence_id: id }) => id);
|
|
@@ -31,7 +31,7 @@ export const runDirectAnalysis = async (path, tool, arguments_, options = {}) =>
|
|
|
31
31
|
: { permissionAuthority: options.permissionAuthority }),
|
|
32
32
|
}));
|
|
33
33
|
/** Execute one provider-native semantic operation with atomic provenance. */
|
|
34
|
-
export const runProviderAnalysis = async (path, tool, arguments_, logger = silentLogger, signal) => withProcessCancellation(signal, (operationSignal) => runAnalysis(path, tool, arguments_, {
|
|
34
|
+
export const runProviderAnalysis = async (...[path, tool, arguments_, logger = silentLogger, signal]) => withProcessCancellation(signal, (operationSignal) => runAnalysis(path, tool, arguments_, {
|
|
35
35
|
logger,
|
|
36
36
|
snapshotPath: undefined,
|
|
37
37
|
signal: operationSignal,
|
|
@@ -172,49 +172,14 @@ const runAnalysis = async (path, tool, arguments_, options) => {
|
|
|
172
172
|
const writable = await authorizeDeferredWrite(authorization.value);
|
|
173
173
|
if (!writable.ok)
|
|
174
174
|
return cliError(writable.error);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
tool
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
else {
|
|
184
|
-
evidence = createEvidence(opened.value, tool === "analyze_function"
|
|
185
|
-
? session.providerIdentity(tool)
|
|
186
|
-
: REA_WORKFLOW_PROVIDER, {
|
|
187
|
-
operation: tool,
|
|
188
|
-
parameters: arguments_,
|
|
189
|
-
result: result.value,
|
|
190
|
-
...(evidenceProfile === undefined
|
|
191
|
-
? {}
|
|
192
|
-
: { analysisProfile: evidenceProfile }),
|
|
193
|
-
confidence: "derived",
|
|
194
|
-
limitations: ["Derived by an REA composed workflow."],
|
|
195
|
-
});
|
|
196
|
-
output = evidence;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
const result = await session.execute(tool, arguments_, { signal });
|
|
201
|
-
if (!result.ok)
|
|
202
|
-
output = cliError(result.error);
|
|
203
|
-
else {
|
|
204
|
-
evidence = createEvidence(result.value.subject ?? opened.value, result.value.provider, {
|
|
205
|
-
operation: tool,
|
|
206
|
-
parameters: arguments_,
|
|
207
|
-
result: result.value.result,
|
|
208
|
-
...(result.value.analysisProfile === undefined
|
|
209
|
-
? {}
|
|
210
|
-
: { analysisProfile: result.value.analysisProfile }),
|
|
211
|
-
rawResult: result.value.rawResult,
|
|
212
|
-
limitations: result.value.limitations,
|
|
213
|
-
locations: result.value.locations,
|
|
214
|
-
});
|
|
215
|
-
output = evidence;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
175
|
+
const { output, evidence } = await executeAnalysisTool({
|
|
176
|
+
session,
|
|
177
|
+
openedTarget: opened.value,
|
|
178
|
+
tool,
|
|
179
|
+
arguments: arguments_,
|
|
180
|
+
signal,
|
|
181
|
+
evidenceProfile,
|
|
182
|
+
});
|
|
218
183
|
if (evidence !== undefined)
|
|
219
184
|
session.recordEvidence(evidence);
|
|
220
185
|
if (snapshotPath !== undefined && evidence !== undefined) {
|
|
@@ -231,6 +196,44 @@ const runAnalysis = async (path, tool, arguments_, options) => {
|
|
|
231
196
|
await session.close();
|
|
232
197
|
}
|
|
233
198
|
};
|
|
199
|
+
const executeAnalysisTool = async (input) => {
|
|
200
|
+
const { session, tool, signal, evidenceProfile } = input;
|
|
201
|
+
if (tool === "binary_overview" ||
|
|
202
|
+
tool === "analyze_function" ||
|
|
203
|
+
tool === "trace_feature") {
|
|
204
|
+
const result = await new EnhancedTools(session).execute(tool, input.arguments, signal);
|
|
205
|
+
if (!result.ok)
|
|
206
|
+
return { output: cliError(result.error) };
|
|
207
|
+
const evidence = createEvidence(input.openedTarget, tool === "analyze_function"
|
|
208
|
+
? session.providerIdentity(tool)
|
|
209
|
+
: REA_WORKFLOW_PROVIDER, {
|
|
210
|
+
operation: tool,
|
|
211
|
+
parameters: input.arguments,
|
|
212
|
+
result: result.value,
|
|
213
|
+
...(evidenceProfile === undefined
|
|
214
|
+
? {}
|
|
215
|
+
: { analysisProfile: evidenceProfile }),
|
|
216
|
+
confidence: "derived",
|
|
217
|
+
limitations: ["Derived by an REA composed workflow."],
|
|
218
|
+
});
|
|
219
|
+
return { output: evidence, evidence };
|
|
220
|
+
}
|
|
221
|
+
const result = await session.execute(tool, input.arguments, { signal });
|
|
222
|
+
if (!result.ok)
|
|
223
|
+
return { output: cliError(result.error) };
|
|
224
|
+
const evidence = createEvidence(result.value.subject ?? input.openedTarget, result.value.provider, {
|
|
225
|
+
operation: tool,
|
|
226
|
+
parameters: input.arguments,
|
|
227
|
+
result: result.value.result,
|
|
228
|
+
...(result.value.analysisProfile === undefined
|
|
229
|
+
? {}
|
|
230
|
+
: { analysisProfile: result.value.analysisProfile }),
|
|
231
|
+
rawResult: result.value.rawResult,
|
|
232
|
+
limitations: result.value.limitations,
|
|
233
|
+
locations: result.value.locations,
|
|
234
|
+
});
|
|
235
|
+
return { output: evidence, evidence };
|
|
236
|
+
};
|
|
234
237
|
const withProcessCancellation = async (suppliedSignal, operation) => {
|
|
235
238
|
if (suppliedSignal !== undefined)
|
|
236
239
|
return operation(suppliedSignal);
|