feat(dotnet): add managed runtime correlation planning
This commit is contained in:
@@ -66,6 +66,65 @@ const evidence = (result: ManagedMemberInspection) =>
|
||||
limitations: result.limitations,
|
||||
});
|
||||
|
||||
const runtimeMembers = (): ManagedMemberInspection => {
|
||||
const result = emptyManagedMembers(
|
||||
"2".repeat(64),
|
||||
"11112222-3333-4444-5555-666677778888",
|
||||
);
|
||||
return {
|
||||
...result,
|
||||
methods: {
|
||||
...result.methods,
|
||||
items: [
|
||||
{
|
||||
token: "0x06000001",
|
||||
row_offset: 128,
|
||||
declaring_type_token: "0x02000001",
|
||||
declaring_type: "Example.Program",
|
||||
name: "Main",
|
||||
rva: 8192,
|
||||
impl_flags: 0,
|
||||
flags: 22,
|
||||
signature: {
|
||||
raw_length: 3,
|
||||
raw_sha256: "3".repeat(64),
|
||||
kind: "method",
|
||||
parse_status: "decoded",
|
||||
calling_convention: "default",
|
||||
generic_parameter_count: 0,
|
||||
parameter_count: 0,
|
||||
return_type: "void",
|
||||
parameter_types: [],
|
||||
field_type: null,
|
||||
issue: null,
|
||||
},
|
||||
body: {
|
||||
status: "present",
|
||||
header_format: "tiny",
|
||||
rva: 8192,
|
||||
file_offset: 512,
|
||||
max_stack: 8,
|
||||
init_locals: false,
|
||||
local_var_sig_token: null,
|
||||
il_size: 1,
|
||||
il_sha256: "4".repeat(64),
|
||||
normalized_il_sha256: "5".repeat(64),
|
||||
instruction_count: 1,
|
||||
decoded_instruction_count: 1,
|
||||
truncated_instructions: 0,
|
||||
opcode_counts: { ret: 1 },
|
||||
anchors: [],
|
||||
exception_regions: [],
|
||||
issue: null,
|
||||
},
|
||||
},
|
||||
],
|
||||
total: 1,
|
||||
returned: 1,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
/** Minimal valid managed member comparison request for public contracts. */
|
||||
export const MANAGED_MEMBER_COMPARISON_EXAMPLE = {
|
||||
left: evidence(
|
||||
@@ -80,3 +139,28 @@ export const MANAGED_MEMBER_COMPARISON_EXAMPLE = {
|
||||
max_candidates: 25,
|
||||
},
|
||||
};
|
||||
|
||||
const runtimeExampleEvidence = evidence(runtimeMembers());
|
||||
|
||||
/** Minimal valid managed runtime-correlation planning request. */
|
||||
export const MANAGED_RUNTIME_CORRELATION_EXAMPLE = {
|
||||
static_members: runtimeExampleEvidence,
|
||||
method: {
|
||||
token: "0x06000001",
|
||||
signature_sha256: "3".repeat(64),
|
||||
normalized_il_sha256: "5".repeat(64),
|
||||
},
|
||||
requested_effect: "attach",
|
||||
host: {
|
||||
os: "linux",
|
||||
clr_family: "dotnet",
|
||||
architecture: "x86_64",
|
||||
},
|
||||
bounds: {
|
||||
timeout_ms: 5_000,
|
||||
max_threads: 32,
|
||||
max_output_bytes: 65_536,
|
||||
allow_network: false,
|
||||
allow_ui: false,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { compareManagedMembersInputSchema } from "../domain/managedMemberComparison.js";
|
||||
import { managedRuntimeCorrelationInputSchema } from "../domain/managedRuntimeCorrelation.js";
|
||||
import type { ToolContract } from "./toolContracts.js";
|
||||
import { managedWorkflowOutputSchemas } from "./toolOutputSchemas.js";
|
||||
import { MANAGED_MEMBER_COMPARISON_EXAMPLE } from "./managedWorkflowExamples.js";
|
||||
import {
|
||||
MANAGED_MEMBER_COMPARISON_EXAMPLE,
|
||||
MANAGED_RUNTIME_CORRELATION_EXAMPLE,
|
||||
} from "./managedWorkflowExamples.js";
|
||||
|
||||
const comparisonOutputSchema =
|
||||
managedWorkflowOutputSchemas.compare_managed_members;
|
||||
@@ -9,6 +13,12 @@ if (comparisonOutputSchema === undefined)
|
||||
throw new Error(
|
||||
"Missing managed workflow output schema for compare_managed_members",
|
||||
);
|
||||
const runtimeOutputSchema =
|
||||
managedWorkflowOutputSchemas.plan_managed_runtime_correlation;
|
||||
if (runtimeOutputSchema === undefined)
|
||||
throw new Error(
|
||||
"Missing managed workflow output schema for plan_managed_runtime_correlation",
|
||||
);
|
||||
|
||||
/** Provider-neutral managed-code workflow contracts. */
|
||||
export const MANAGED_WORKFLOW_TOOL_CONTRACTS = [
|
||||
@@ -32,4 +42,24 @@ export const MANAGED_WORKFLOW_TOOL_CONTRACTS = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "plan_managed_runtime_correlation",
|
||||
description:
|
||||
"Prepare a separately authorized managed runtime-correlation admission plan from authenticated inspect_managed_members Evidence. The operation is default-disabled, requires the managed_runtime permission ceiling and grant, locks the exact artifact SHA-256, MVID, method signature, and normalized IL shape, distinguishes attach/load/debugger/reflection/instrumentation effects, and records that no target code was executed.",
|
||||
kind: "application",
|
||||
inputSchema: managedRuntimeCorrelationInputSchema,
|
||||
outputSchema: runtimeOutputSchema,
|
||||
annotations: {
|
||||
readOnlyHint: true,
|
||||
destructiveHint: false,
|
||||
idempotentHint: true,
|
||||
openWorldHint: false,
|
||||
},
|
||||
examples: [
|
||||
{
|
||||
title: "Plan an exact-build managed runtime correlation",
|
||||
input: MANAGED_RUNTIME_CORRELATION_EXAMPLE,
|
||||
},
|
||||
],
|
||||
},
|
||||
] as const satisfies readonly ToolContract[];
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
managedNativeBoundaryInspectionSchema,
|
||||
} from "../domain/managedArtifact.js";
|
||||
import { managedMemberComparisonResultSchema } from "../domain/managedMemberComparison.js";
|
||||
import { managedRuntimeCorrelationResultSchema } from "../domain/managedRuntimeCorrelation.js";
|
||||
import { artifactComparisonResultSchema } from "../domain/artifactComparison.js";
|
||||
import { functionComparisonResultSchema } from "../domain/functionComparison.js";
|
||||
import { bundleComparisonResultSchema } from "../domain/bundleComparison.js";
|
||||
@@ -549,6 +550,9 @@ export const managedWorkflowOutputSchemas: Readonly<
|
||||
Record<string, z.ZodObject>
|
||||
> = {
|
||||
compare_managed_members: resultOf(managedMemberComparisonResultSchema),
|
||||
plan_managed_runtime_correlation: resultOf(
|
||||
managedRuntimeCorrelationResultSchema,
|
||||
),
|
||||
};
|
||||
|
||||
/** Exact structured-content schemas for target lifecycle operations. */
|
||||
|
||||
Reference in New Issue
Block a user