refactor: declare auxiliary capabilities from source (#853)
This commit is contained in:
@@ -11,7 +11,10 @@ import {
|
||||
type ExecutionOptions,
|
||||
type ProviderIdentity,
|
||||
} from "../application/AnalysisProvider.js";
|
||||
import { MANAGED_STATIC_PROVIDER } from "../application/InvestigationProviders.js";
|
||||
import {
|
||||
MANAGED_STATIC_PROVIDER_IDENTITY as IDENTITY,
|
||||
managedStaticCapabilities,
|
||||
} from "./ManagedStaticProviderMetadata.js";
|
||||
import {
|
||||
MANAGED_TOOL_CONTRACTS,
|
||||
managedArtifactInputSchema,
|
||||
@@ -38,30 +41,10 @@ import { inspectManagedArtifactBytes } from "./ManagedArtifactInspector.js";
|
||||
import { inspectManagedMembersBytes } from "./ManagedMemberInspector.js";
|
||||
import { inspectManagedNativeBoundariesBytes } from "./ManagedNativeBoundaryInspector.js";
|
||||
|
||||
const IDENTITY: ProviderIdentity = Object.freeze(MANAGED_STATIC_PROVIDER);
|
||||
|
||||
/** Execution-free managed PE/CLI auxiliary provider. */
|
||||
export class ManagedStaticProvider implements AnalysisProvider {
|
||||
readonly #capabilities: readonly CapabilityDescriptor[] = Object.freeze(
|
||||
MANAGED_TOOL_CONTRACTS.map((contract) =>
|
||||
Object.freeze({
|
||||
provider: IDENTITY,
|
||||
operation: contract.name,
|
||||
available: true as const,
|
||||
reason: null,
|
||||
effects: Object.freeze({
|
||||
mutatesArtifact: false,
|
||||
launchesProcess: false,
|
||||
mayShowUi: false,
|
||||
mayAccessNetwork: false,
|
||||
mayWriteFilesystem: false,
|
||||
changesPermissions: false,
|
||||
requiresRoot: false,
|
||||
}),
|
||||
limitations: limitationsFor(contract.name),
|
||||
}),
|
||||
),
|
||||
);
|
||||
readonly #capabilities: readonly CapabilityDescriptor[] =
|
||||
managedStaticCapabilities();
|
||||
|
||||
identity(): ProviderIdentity {
|
||||
return IDENTITY;
|
||||
@@ -196,24 +179,6 @@ const isManagedOperation = (
|
||||
): operation is ManagedToolName =>
|
||||
MANAGED_TOOL_CONTRACTS.some(({ name }) => name === operation);
|
||||
|
||||
const limitationsFor = (operation: ManagedToolName): readonly string[] =>
|
||||
Object.freeze(
|
||||
operation === "inspect_managed_artifact"
|
||||
? [
|
||||
"This capability inventories PE/CLI identity only; inspect_managed_members admits metadata members, signatures, and CIL anchors.",
|
||||
"It never loads the target assembly, resolves dependencies through a CLR, decompiles C#, or executes target code.",
|
||||
]
|
||||
: operation === "inspect_managed_native_boundaries"
|
||||
? [
|
||||
"This capability inventories managed declarations for native boundaries only; native exports, thunks, and addresses require separate native-provider evidence.",
|
||||
"It never loads the target assembly, resolves dependencies through a CLR, decompiles C#, or executes target code.",
|
||||
]
|
||||
: [
|
||||
"This capability decodes PE/CLI metadata members, signatures, and file-backed method bodies; decompiled C# reconstruction and cross-build member comparison are separate operations.",
|
||||
"It never loads the target assembly, resolves dependencies through a CLR, decompiles C#, or executes target code.",
|
||||
],
|
||||
);
|
||||
|
||||
const inspectManagedOperation = (
|
||||
operation: ManagedToolName,
|
||||
parameters: Readonly<Record<string, JsonValue>>,
|
||||
|
||||
Reference in New Issue
Block a user