/** * The conclusion-over-graph tool contract (spec domain: `mcp-quality`). * * OpenLore's value proposition is that the *server* does graph traversal so the * *agent* never has to. A tool that returns a raw node-and-edge list silently * pushes the BFS back onto the model — the exact failure mode (multi-hop context * exhaustion, edge confabulation) the substrate exists to prevent. * * This module turns that convention into a checked invariant: * - {@link TOOL_OUTPUT_CLASS} classifies every dispatched MCP tool as either * `conclusion` (returns a path / ranked list / set / metric / verdict that * directly answers the query) or `explicit-topology` (intentionally returns * a node-and-edge graph). * - {@link assertConclusionShape} enforces that a `conclusion` tool's response * does not regress into a graph dump. * * The companion `tool-contract.test.ts` cross-checks the table against the live * `TOOL_DEFINITIONS` registration so a newly added tool that forgets to declare * a class fails CI. */ export type ToolOutputClass = 'conclusion' | 'explicit-topology'; /** * Every dispatched MCP tool (see `dispatchTool` in * `src/core/services/tool-dispatch.ts`) and its output class. * * Only two tools are `explicit-topology` — they exist to expose graph-level * structure and are exempt from the conclusion predicate: * - `get_subgraph` — a true `nodes[]` + `edges[]` neighbourhood dump. * - `get_call_graph` — a graph-level summary (stats, hub/entry lists, layer * violations). It currently returns bounded lists rather than raw edges, * but stays `explicit-topology` so the "exactly two graph tools" model * holds for future authors and so widening it back to raw topology needs * no reclassification. * * Everything else is `conclusion`. Adding a tool without an entry here makes the * completeness test fail, forcing the author to declare a class. */ export declare const TOOL_OUTPUT_CLASS: Record; /** The tools intentionally allowed to emit raw topology, sorted for stable assertions. */ export declare const EXPLICIT_TOPOLOGY_TOOLS: readonly string[]; /** Thrown when a `conclusion` tool's response violates the contract. */ export declare class ToolContractViolationError extends Error { readonly toolName: string; readonly violation: string; constructor(toolName: string, violation: string); } /** * Assert that a tool's response satisfies the conclusion-over-graph contract. * * - `explicit-topology` tools are exempt (they may return raw topology). * - An unclassified tool name throws — the contract refuses to silently pass a * tool that has not declared its class. * - A `conclusion` tool's response is rejected when it either: * (a) contains a top-level array of id-reference edge objects longer than * {@link MAX_PROVENANCE_EDGES} (a raw adjacency/edge dump), or * (b) carries both a top-level `nodes[]` and a top-level `edges[]`, so the * answer is only reconstructable by joining the two (a graph dump). * * "Top-level" means the response object's own enumerable values (or the * response itself when it is an array). Bounded provenance under the limit is * fine — a conclusion may cite a few edges to explain *why* it concluded. */ export declare function assertConclusionShape(toolName: string, response: unknown): void; //# sourceMappingURL=tool-contract.d.ts.map