mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 01:28:15 +00:00
* refactor(contracts): declare each tool's effect audit on its contract Every public tool's effects lived in a 255-entry TOOL_EFFECT_AUDIT table in toolEffects.ts, keyed by name and looked up again by toolContractMetadata, the capability inventory (toolSessionEffects) and tests (TOOL_EFFECTS). toolContractMetadata(name, audit) now takes the audit from the contract declaration, and the contract carries both the provider-wide effects and the session effects. The inventory reads contract.sessionEffects. The table, TOOL_EFFECTS and toolSessionEffects are removed; toolEffects.ts keeps the effect type, the shared presets and annotation derivation. Effects, session effects, annotations and titles are byte-identical for all 255 contracts. * test(contracts): read focused effect expectations from their contract family
79 lines
2.7 KiB
TypeScript
79 lines
2.7 KiB
TypeScript
import type { z } from "zod";
|
|
|
|
import type { JsonValue } from "../domain/jsonValue.js";
|
|
import type { ToolAvailabilityDeclaration } from "./toolAvailability.js";
|
|
import type { DerivedToolAnnotations, ToolEffects } from "./toolEffects.js";
|
|
|
|
/** One validated example request for an MCP tool contract. */
|
|
export interface ToolExample {
|
|
readonly title: string;
|
|
readonly input: Readonly<Record<string, JsonValue>>;
|
|
}
|
|
|
|
/** Canonical adapter families responsible for public MCP tools. */
|
|
export const TOOL_KINDS = [
|
|
"official-proxy",
|
|
"enhanced",
|
|
"native-provider",
|
|
"artifact-provider",
|
|
"managed-provider",
|
|
"android-provider",
|
|
"apktool-provider",
|
|
"flutter-provider",
|
|
"jeb-provider",
|
|
"adb-provider",
|
|
"firmware-provider",
|
|
"browser-provider",
|
|
"electron-provider",
|
|
"runtime-provider",
|
|
"pcap-provider",
|
|
"application",
|
|
"session",
|
|
] as const;
|
|
|
|
/** Adapter family responsible for implementing a public MCP tool. */
|
|
export type ToolKind = (typeof TOOL_KINDS)[number];
|
|
|
|
/** Single source of truth for a public MCP tool. */
|
|
export interface ToolContract<
|
|
Name extends string = string,
|
|
InputSchema extends z.ZodType<Readonly<Record<string, unknown>>> = z.ZodType<
|
|
Readonly<Record<string, unknown>>
|
|
>,
|
|
OutputSchema extends z.ZodType<Readonly<Record<string, unknown>>> = z.ZodType<
|
|
Readonly<Record<string, unknown>>
|
|
>,
|
|
> {
|
|
readonly name: Name;
|
|
readonly title: string;
|
|
readonly description: string;
|
|
readonly kind: ToolKind;
|
|
/** What the tool needs before it can run; see ToolAvailabilityDeclaration. */
|
|
readonly availability?: ToolAvailabilityDeclaration;
|
|
/**
|
|
* The CLI exposes this contract as the one-shot command named by its
|
|
* kebab-case name (`inspect_pe_imports` is `rea inspect-pe-imports`). The
|
|
* CLI command inventory is derived from this declaration.
|
|
*/
|
|
readonly cli?: true;
|
|
/** This handler dispatches through the active binary-analysis session. */
|
|
readonly requiresActiveTarget?: boolean;
|
|
/** Adapter delivery of a retained summary; detail never reaches analysis. */
|
|
readonly retainedSummary?: {
|
|
readonly evidenceParameters: "omit-detail" | "preserve-detail";
|
|
};
|
|
readonly inputSchema: InputSchema;
|
|
readonly outputSchema: OutputSchema;
|
|
/** Possible effects across every supported provider profile. */
|
|
readonly effects: ToolEffects;
|
|
/** Effects the tool owns before composing the selected provider. */
|
|
readonly sessionEffects: ToolEffects;
|
|
readonly annotations: DerivedToolAnnotations;
|
|
/**
|
|
* Results, successful or failed, can contain text that originates from the
|
|
* analysis target. MCP delivery marks such results as untrusted data.
|
|
*/
|
|
readonly returnsTargetContent: boolean;
|
|
readonly examples: readonly ToolExample[];
|
|
}
|