feat(dotnet): add managed member comparison
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
import { createEvidence } from "../domain/evidence.js";
|
||||
import type { ManagedMemberInspection } from "../domain/managedArtifact.js";
|
||||
|
||||
const MANAGED_STATIC_EXAMPLE_PROVIDER = {
|
||||
id: "rea-dotnet-static",
|
||||
name: "REA managed static analysis provider",
|
||||
version: "1",
|
||||
} as const;
|
||||
|
||||
const emptyManagedMembers = (
|
||||
sha256: string,
|
||||
mvid: string,
|
||||
): ManagedMemberInspection => ({
|
||||
schema_version: 1,
|
||||
artifact: {
|
||||
path: `/examples/${sha256.slice(0, 8)}.dll`,
|
||||
sha256,
|
||||
byte_length: 4096,
|
||||
format: "pe",
|
||||
},
|
||||
module: {
|
||||
name: "Example.dll",
|
||||
generation: 0,
|
||||
mvid,
|
||||
enc_id: null,
|
||||
enc_base_id: null,
|
||||
token: "0x00000001",
|
||||
row_offset: 0,
|
||||
},
|
||||
metadata: {
|
||||
status: "complete",
|
||||
version: "v4.0.30319",
|
||||
table_row_counts: {},
|
||||
},
|
||||
identity_scope: {
|
||||
token_identity: "build-local",
|
||||
requires_artifact_sha256: sha256,
|
||||
requires_mvid: mvid,
|
||||
},
|
||||
types: emptyPage(100),
|
||||
fields: emptyPage(100),
|
||||
methods: emptyPage(100),
|
||||
member_refs: emptyPage(100),
|
||||
call_edges: emptyPage(250),
|
||||
field_accesses: emptyPage(250),
|
||||
coverage: { state: "complete", issues: [] },
|
||||
limitations: [],
|
||||
});
|
||||
|
||||
const emptyPage = <Item>(limit: number) => ({
|
||||
items: [] as Item[],
|
||||
offset: 0,
|
||||
limit,
|
||||
total: 0,
|
||||
returned: 0,
|
||||
dropped: 0,
|
||||
complete: true,
|
||||
});
|
||||
|
||||
const evidence = (result: ManagedMemberInspection) =>
|
||||
createEvidence(undefined, MANAGED_STATIC_EXAMPLE_PROVIDER, {
|
||||
operation: "inspect_managed_members",
|
||||
parameters: {},
|
||||
result,
|
||||
rawResult: null,
|
||||
limitations: result.limitations,
|
||||
});
|
||||
|
||||
/** Minimal valid managed member comparison request for public contracts. */
|
||||
export const MANAGED_MEMBER_COMPARISON_EXAMPLE = {
|
||||
left: evidence(
|
||||
emptyManagedMembers("0".repeat(64), "00112233-4455-6677-8899-aabbccddeeff"),
|
||||
),
|
||||
right: evidence(
|
||||
emptyManagedMembers("1".repeat(64), "ffeeddcc-bbaa-9988-7766-554433221100"),
|
||||
),
|
||||
limits: {
|
||||
max_method_matches: 100,
|
||||
max_field_matches: 50,
|
||||
max_candidates: 25,
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
import { compareManagedMembersInputSchema } from "../domain/managedMemberComparison.js";
|
||||
import type { ToolContract } from "./toolContracts.js";
|
||||
import { managedWorkflowOutputSchemas } from "./toolOutputSchemas.js";
|
||||
import { MANAGED_MEMBER_COMPARISON_EXAMPLE } from "./managedWorkflowExamples.js";
|
||||
|
||||
const comparisonOutputSchema =
|
||||
managedWorkflowOutputSchemas.compare_managed_members;
|
||||
if (comparisonOutputSchema === undefined)
|
||||
throw new Error(
|
||||
"Missing managed workflow output schema for compare_managed_members",
|
||||
);
|
||||
|
||||
/** Provider-neutral managed-code workflow contracts. */
|
||||
export const MANAGED_WORKFLOW_TOOL_CONTRACTS = [
|
||||
{
|
||||
name: "compare_managed_members",
|
||||
description:
|
||||
"Compare two authenticated inspect_managed_members Evidence records using unique-only CIL/signature and structural method-shape tiers. Names are reported as observations but are not used as a matching basis; metadata tokens are remapped as build-local coordinates bound to each artifact SHA-256 and MVID.",
|
||||
kind: "application",
|
||||
inputSchema: compareManagedMembersInputSchema,
|
||||
outputSchema: comparisonOutputSchema,
|
||||
annotations: {
|
||||
readOnlyHint: true,
|
||||
destructiveHint: false,
|
||||
idempotentHint: true,
|
||||
openWorldHint: false,
|
||||
},
|
||||
examples: [
|
||||
{
|
||||
title: "Compare two managed member observations",
|
||||
input: MANAGED_MEMBER_COMPARISON_EXAMPLE,
|
||||
},
|
||||
],
|
||||
},
|
||||
] as const satisfies readonly ToolContract[];
|
||||
@@ -27,6 +27,7 @@ import { TOOL_EXAMPLE_OVERRIDES } from "./toolContractExamples.js";
|
||||
import { NATIVE_TOOL_CONTRACTS } from "./nativeToolContracts.js";
|
||||
import { ARTIFACT_TOOL_CONTRACTS } from "./artifactToolContracts.js";
|
||||
import { MANAGED_TOOL_CONTRACTS } from "./managedToolContracts.js";
|
||||
import { MANAGED_WORKFLOW_TOOL_CONTRACTS } from "./managedWorkflowToolContracts.js";
|
||||
import { BROWSER_TOOL_CONTRACTS } from "./browserToolContracts.js";
|
||||
import { ELECTRON_TOOL_CONTRACTS } from "./electronToolContracts.js";
|
||||
import { APPLICATION_TOOL_CONTRACTS } from "./applicationToolContracts.js";
|
||||
@@ -527,6 +528,7 @@ export const TOOL_CONTRACTS = [
|
||||
...NATIVE_TOOL_CONTRACTS,
|
||||
...ARTIFACT_TOOL_CONTRACTS,
|
||||
...MANAGED_TOOL_CONTRACTS,
|
||||
...MANAGED_WORKFLOW_TOOL_CONTRACTS,
|
||||
...BROWSER_TOOL_CONTRACTS,
|
||||
...ELECTRON_TOOL_CONTRACTS,
|
||||
...APPLICATION_TOOL_CONTRACTS,
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
managedArtifactInspectionSchema,
|
||||
managedMemberInspectionSchema,
|
||||
} from "../domain/managedArtifact.js";
|
||||
import { managedMemberComparisonResultSchema } from "../domain/managedMemberComparison.js";
|
||||
import { artifactComparisonResultSchema } from "../domain/artifactComparison.js";
|
||||
import { functionComparisonResultSchema } from "../domain/functionComparison.js";
|
||||
import { bundleComparisonResultSchema } from "../domain/bundleComparison.js";
|
||||
@@ -539,6 +540,13 @@ export const managedOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
|
||||
inspect_managed_members: resultOf(managedMemberInspectionSchema),
|
||||
};
|
||||
|
||||
/** Exact Evidence v2 schema for provider-neutral managed workflows. */
|
||||
export const managedWorkflowOutputSchemas: Readonly<
|
||||
Record<string, z.ZodObject>
|
||||
> = {
|
||||
compare_managed_members: resultOf(managedMemberComparisonResultSchema),
|
||||
};
|
||||
|
||||
/** Exact structured-content schemas for target lifecycle operations. */
|
||||
export const sessionOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
|
||||
open_binary: lifecycleResultOf(
|
||||
|
||||
Reference in New Issue
Block a user