feat(dotnet): add managed artifact triage

This commit is contained in:
N0zoM1z0
2026-07-16 17:05:03 +09:00
committed by N0zoM1z0
parent 80faff3e5b
commit c251c38aa2
155 changed files with 4101 additions and 287 deletions
+64
View File
@@ -0,0 +1,64 @@
import { z } from "zod";
import type { ToolContract } from "./toolContracts.js";
import { managedOutputSchemas } from "./toolOutputSchemas.js";
/** Exact caller boundary for execution-free PE/CLI triage and identity. */
export const managedArtifactInputSchema = z.object({
reference_offset: z.number().int().min(0).default(0),
reference_limit: z.number().int().min(1).max(500).default(100),
resource_offset: z.number().int().min(0).default(0),
resource_limit: z.number().int().min(1).max(500).default(100),
attribute_offset: z.number().int().min(0).default(0),
attribute_limit: z.number().int().min(1).max(500).default(100),
max_file_bytes: z
.number()
.int()
.min(4_096)
.max(1_073_741_824)
.default(268_435_456),
max_metadata_bytes: z
.number()
.int()
.min(256)
.max(268_435_456)
.default(67_108_864),
max_table_rows: z.number().int().min(1).max(1_000_000).default(100_000),
max_heap_item_bytes: z
.number()
.int()
.min(1)
.max(16_777_216)
.default(1_048_576),
});
const outputSchema = managedOutputSchemas.inspect_managed_artifact;
if (outputSchema === undefined)
throw new Error("Missing managed output schema for inspect_managed_artifact");
/** Read-only managed artifact contracts. */
export const MANAGED_TOOL_CONTRACTS = [
{
name: "inspect_managed_artifact",
description:
"Classify the active PE/CLI artifact and inventory exact assembly/module identity, target framework evidence, references, resources, and custom attributes without loading or executing target code. Returns bounded pages and explicit partial or malformed coverage.",
kind: "managed-provider",
inputSchema: managedArtifactInputSchema,
outputSchema,
annotations: {
readOnlyHint: true,
destructiveHint: false,
idempotentHint: true,
openWorldHint: false,
},
examples: [
{
title: "Example inspect managed artifact request",
input: {},
},
],
},
] as const satisfies readonly ToolContract[];
/** Names of execution-free managed static operations. */
export type ManagedToolName = (typeof MANAGED_TOOL_CONTRACTS)[number]["name"];
+1
View File
@@ -22,6 +22,7 @@ export type ToolKind =
| "enhanced"
| "native-provider"
| "artifact-provider"
| "managed-provider"
| "browser-provider"
| "electron-provider"
| "application"
+2
View File
@@ -26,6 +26,7 @@ import {
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 { BROWSER_TOOL_CONTRACTS } from "./browserToolContracts.js";
import { ELECTRON_TOOL_CONTRACTS } from "./electronToolContracts.js";
import { APPLICATION_TOOL_CONTRACTS } from "./applicationToolContracts.js";
@@ -525,6 +526,7 @@ export const TOOL_CONTRACTS = [
...ENHANCED_TOOL_CONTRACTS,
...NATIVE_TOOL_CONTRACTS,
...ARTIFACT_TOOL_CONTRACTS,
...MANAGED_TOOL_CONTRACTS,
...BROWSER_TOOL_CONTRACTS,
...ELECTRON_TOOL_CONTRACTS,
...APPLICATION_TOOL_CONTRACTS,
+6
View File
@@ -24,6 +24,7 @@ import {
artifactExtractionResultSchema,
artifactInventoryResultSchema,
} from "../domain/artifactGraph.js";
import { managedArtifactInspectionSchema } from "../domain/managedArtifact.js";
import { artifactComparisonResultSchema } from "../domain/artifactComparison.js";
import { functionComparisonResultSchema } from "../domain/functionComparison.js";
import { bundleComparisonResultSchema } from "../domain/bundleComparison.js";
@@ -529,6 +530,11 @@ export const artifactOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
extract_artifact: resultOf(artifactExtractionResultSchema),
};
/** Exact Evidence v2 schema for execution-free managed static analysis. */
export const managedOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
inspect_managed_artifact: resultOf(managedArtifactInspectionSchema),
};
/** Exact structured-content schemas for target lifecycle operations. */
export const sessionOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
open_binary: lifecycleResultOf(