/** * What changed between the tool definitions a person approved and the ones a server serves now, * field by field, for the re-approval review. * * A pin is a hash: it says THAT something changed. A reviewer needs WHAT changed. Over four weeks * of HISTOR's log (snapshot 2026-10-20, 23,821 changes), 59.5% changed a tool's description * (45.1% by more than digits) and 30.8% added or removed tools, while 13.4% touched nothing but * digits, separators or whitespace (live counters, prices and limits written into definitions). * A review that shows two full JSON blobs for each of those trains people to approve without * reading. This module * shows the path of every changed value, the words added and removed in text, and marks a change * made only of numbers. It marks; it never approves: a changed limit is also a number. */ import type { ToolDef } from "./types.js"; export type WordOp = ["=" | "+" | "-", string]; export interface FieldChange { /** Dotted path inside the tool, e.g. `description` or `inputSchema.properties.days.maximum`. */ path: string; /** Absent when the value did not exist on that side. */ before?: unknown; after?: unknown; /** For a string on both sides: the word diff. */ words?: WordOp[]; /** Only digits, separators or whitespace differ (a counter, a date, a limit). Still a change. */ numbersOnly: boolean; /** Text this change adds about the user's approval or about which tool to use (see Attention). */ attention?: Attention[]; } /** * What a reviewer should read first: text a change ADDS about the user's approval ("without asking", "the user has * already approved") or about which tool the model should pick ("prefer this over web search", "never use another * tool"). A reader asked for it (dev.to, 2026-10-23); in HISTOR's 20 October snapshot, 12 of 23,821 changes added or * dropped such a routing hint, 9 of them in nothing but the description. It marks; it never approves or refuses. * English phrasing only. */ export type Attention = "approval" | "tool choice"; /** * A behaviour hint that moved (MCP tool annotations; absent = the specification's default: readOnlyHint false, * destructiveHint true, idempotentHint false, openWorldHint true). * * `widens`: the tool now says it does more (true → false for readOnlyHint): an approval given to it as it was does not * cover what it says now. `narrows`: it now claims less (false → true for readOnlyHint): a host that skips the prompt * for read-only or non-destructive tools stops asking about it. Hints are the server's word, not proof either way. * In HISTOR's record from 23 October to 16 November 2026 (snapshot 2026-11-16), readOnlyHint went true → false on 524 * tools and false → true on 321; on 176 and 262 of them the Vercel AI SDK's tool fingerprint did not change in that read. */ export interface HintMove { hint: "readOnlyHint" | "destructiveHint" | "idempotentHint" | "openWorldHint"; /** As served; null = absent. */ before: boolean | null; after: boolean | null; direction: "widens" | "narrows"; } export interface ToolChange { tool: string; kind: "added" | "removed" | "changed"; /** For `changed`: every value that differs. */ fields: FieldChange[]; /** For `added` / `removed`: the whole definition. */ definition?: ToolDef; /** A changed tool whose every field change is numbers only. */ numbersOnly: boolean; /** For `changed`: every Attention its fields add. For `added`: every Attention in the new tool's text. */ attention?: Attention[]; /** For `changed`: behaviour hints whose effective value moved. */ hints?: HintMove[]; } export interface DefinitionDiff { changes: ToolChange[]; added: number; removed: number; changed: number; /** Changed tools whose changes are numbers only. */ numbersOnly: number; /** Added or changed tools whose new text is about the user's approval or about tool choice. */ attention: number; /** Changed tools whose behaviour hints moved. */ hints: number; } /** Behaviour hints whose effective value differs between two versions of one tool. */ export declare function hintMoves(before: ToolDef | undefined, after: ToolDef | undefined): HintMove[]; /** One sentence per tool for a reviewer: what moved and what it means. */ export declare function describeHintMoves(tool: string, moves: readonly HintMove[]): string; /** Words and the spaces between them, so that joining the tokens gives the text back. */ export declare function tokenize(text: string): string[]; export declare function wordDiff(before: string, after: string): WordOp[]; /** Field-level changes from `before` (approved) to `after` (served now), tools matched by name. */ export declare function diffToolDefinitions(before: readonly ToolDef[], after: readonly ToolDef[]): DefinitionDiff; /** The diff as review lines: `[-removed-]` and `{+added+}` inside text, `before → after` for values. */ export declare function formatDefinitionDiff(diff: DefinitionDiff): string[]; /** The kinds of Attention whose phrasing appears in `after` and not in `before`. */ export declare function addedAttention(before: string, after: string): Attention[]; /** A registry package named by a launcher (`npx pkg`, `uvx pkg`), and whether the command names an exact version. * Without one, resolution can change between starts while the command and server identity hash stay the same. * A launch may reuse cached code; neither its requested version nor serverInfo verifies the installed artifact. */ export interface LaunchSpec { runner: string; ecosystem: "npm" | "pypi"; package: string; /** The version or range in the command, if any (`1.4.2`, `latest`, `^1`, `>=2`). */ requested?: string; pinned: boolean; } export declare function launchSpec(server: { command?: string; args?: readonly string[]; }): LaunchSpec | undefined; /** A version string a server reports about itself, if it is short and plain; anything else is not shown. */ export declare function plainVersion(v: unknown): string | undefined; /** Review lines on where a change came from: the version the server reported at approval and now, and whether * the launch command pins one. The reported version is the server's own word; the launch command is not. */ export declare function formatOriginLines(launch: LaunchSpec | undefined, approved: string | undefined, current: string | undefined, toolsChanged: boolean): string[]; //# sourceMappingURL=review-diff.d.ts.map