import type { ToolContract } from './ToolContract.js'; /** Current lockfile format version. */ declare const LOCKFILE_VERSION: 1; /** Default lockfile name. */ export declare const LOCKFILE_NAME: "mcp-fusion.lock"; /** * Root structure of `mcp-fusion.lock`. * * Designed for human reviewability in pull request diffs. * Keys are sorted, values are deterministic. */ export interface CapabilityLockfile { /** Format version for forward-compatible parsing */ readonly lockfileVersion: typeof LOCKFILE_VERSION; /** MCP server name */ readonly serverName: string; /** MCP Fusion framework version */ readonly fusionVersion: string; /** ISO-8601 generation timestamp */ readonly generatedAt: string; /** SHA-256 over all tool digests — the server's behavioral identity */ readonly integrityDigest: string; /** Per-capability lockfile entries */ readonly capabilities: LockfileCapabilities; } /** * Capability sections in the lockfile. * * Currently supports `tools` and `prompts`. Future sections may * include `resources` and `subscriptions`. */ export interface LockfileCapabilities { /** Per-tool behavioral snapshots, sorted by tool name */ readonly tools: Readonly>; /** Per-prompt declarative snapshots, sorted by prompt name */ readonly prompts?: Readonly>; } /** * Behavioral snapshot for a single tool. * * Every field is derived from the `ToolContract` — no manual * annotation required. The snapshot captures everything an LLM * relies on to behave correctly with this tool. */ export interface LockfileTool { /** SHA-256 integrity digest for this tool's behavioral contract */ readonly integrityDigest: string; /** Declarative surface visible via MCP `tools/list` */ readonly surface: LockfileToolSurface; /** Behavioral contract internals */ readonly behavior: LockfileToolBehavior; /** Token economics profile */ readonly tokenEconomics: LockfileTokenEconomics; /** Handler entitlements (I/O capabilities) */ readonly entitlements: LockfileEntitlements; } /** Surface section of a lockfile tool entry. */ export interface LockfileToolSurface { /** Tool description */ readonly description: string | null; /** Sorted action keys */ readonly actions: readonly string[]; /** SHA-256 of the canonical input schema */ readonly inputSchemaDigest: string; /** Sorted tags */ readonly tags: readonly string[]; } /** Behavior section of a lockfile tool entry. */ export interface LockfileToolBehavior { /** Presenter egress schema digest (null if no Presenter) */ readonly egressSchemaDigest: string | null; /** System rules fingerprint */ readonly systemRulesFingerprint: string; /** Actions marked as destructive */ readonly destructiveActions: readonly string[]; /** Actions marked as read-only */ readonly readOnlyActions: readonly string[]; /** Named middleware chain */ readonly middlewareChain: readonly string[]; /** Affordance topology — suggested next-action tool names */ readonly affordanceTopology: readonly string[]; /** Cognitive guardrails */ readonly cognitiveGuardrails: { readonly agentLimitMax: number | null; readonly egressMaxBytes: number | null; }; } /** Token economics section of a lockfile tool entry. */ export interface LockfileTokenEconomics { /** Cognitive overload risk classification */ readonly inflationRisk: string; /** Number of fields in the egress schema */ readonly schemaFieldCount: number; /** Whether output collections are unbounded */ readonly unboundedCollection: boolean; } /** Entitlements section of a lockfile tool entry. */ export interface LockfileEntitlements { /** Filesystem I/O */ readonly filesystem: boolean; /** Network I/O */ readonly network: boolean; /** Subprocess execution */ readonly subprocess: boolean; /** Cryptographic operations */ readonly crypto: boolean; /** Dynamic code evaluation (eval, Function, vm) */ readonly codeEvaluation: boolean; } /** * Duck-typed interface for prompt builders. * * Decouples the lockfile module from the Prompt Engine implementation. * Any object implementing these methods can be snapshotted. */ export interface PromptBuilderLike { getName(): string; getDescription(): string | undefined; getTags(): string[]; hasMiddleware(): boolean; getHydrationTimeout(): number | undefined; buildPromptDefinition(): { name: string; title?: string; description?: string; icons?: { light?: string; dark?: string; }; arguments?: Array<{ name: string; description?: string; required?: boolean; }>; }; } /** * Behavioral snapshot for a single prompt. * * Captures the declarative surface that an LLM client relies on * to offer the correct slash-command palette. Changes to arguments, * descriptions, or middleware affect how the LLM invokes the prompt. */ export interface LockfilePrompt { /** SHA-256 integrity digest for this prompt's declarative contract */ readonly integrityDigest: string; /** Human-readable description */ readonly description: string | null; /** Display title (MCP BaseMetadata.title) */ readonly title: string | null; /** Sorted capability tags */ readonly tags: readonly string[]; /** Argument definitions from the Zod schema */ readonly arguments: readonly LockfilePromptArgument[]; /** SHA-256 of canonical arguments JSON */ readonly argumentsDigest: string; /** Whether middleware is attached to this prompt */ readonly hasMiddleware: boolean; /** Hydration timeout in ms, or null if unlimited */ readonly hydrationTimeout: number | null; } /** A single prompt argument definition. */ export interface LockfilePromptArgument { /** Argument name */ readonly name: string; /** Human-readable description */ readonly description: string | null; /** Whether this argument is required */ readonly required: boolean; } /** * Options for lockfile generation beyond tools. */ export interface GenerateLockfileOptions { /** Prompt builders to snapshot alongside tools */ readonly prompts?: ReadonlyArray; } /** * Generate a `CapabilityLockfile` from compiled tool contracts * and (optionally) prompt builders. * * This is a **pure function**: given the same contracts and metadata, * it always produces the same lockfile (modulo `generatedAt` timestamp). * * @param serverName - MCP server name * @param contracts - Record of tool name → materialized contract * @param fusionVersion - MCP Fusion version string * @param options - Optional: prompt builders to include * @returns A fully materialized lockfile */ export declare function generateLockfile(serverName: string, contracts: Readonly>, fusionVersion: string, options?: GenerateLockfileOptions): Promise; /** * Serialize a lockfile to a deterministic JSON string. * * Uses sorted keys and 2-space indentation for git-friendly diffs. * The output is canonical — identical lockfiles produce identical strings. * * @param lockfile - The lockfile to serialize * @returns Deterministic JSON string with trailing newline */ export declare function serializeLockfile(lockfile: CapabilityLockfile): string; /** * Result of a lockfile verification check. */ export interface LockfileCheckResult { /** Whether the lockfile matches the current server surface */ readonly ok: boolean; /** Human-readable status message */ readonly message: string; /** Added tools since lockfile was generated */ readonly added: readonly string[]; /** Removed tools since lockfile was generated */ readonly removed: readonly string[]; /** Tools whose behavioral digest changed */ readonly changed: readonly string[]; /** Tools that match the lockfile exactly */ readonly unchanged: readonly string[]; /** Added prompts since lockfile was generated */ readonly addedPrompts: readonly string[]; /** Removed prompts since lockfile was generated */ readonly removedPrompts: readonly string[]; /** Prompts whose declarative digest changed */ readonly changedPrompts: readonly string[]; /** Prompts that match the lockfile exactly */ readonly unchangedPrompts: readonly string[]; } /** * Verify that a lockfile matches the current server contracts and prompts. * * This is the **CI gate**: `fusion lock --check` calls this function * and exits non-zero if the lockfile is stale. * * @param lockfile - Previously generated lockfile (from disk) * @param contracts - Current compiled tool contracts (from code) * @param options - Optional: prompt builders for prompt verification * @returns Check result with per-tool and per-prompt diff details */ export declare function checkLockfile(lockfile: CapabilityLockfile, contracts: Readonly>, options?: GenerateLockfileOptions): Promise; /** * Parse and validate a lockfile JSON string. * * @param content - Raw JSON string from `mcp-fusion.lock` * @returns Parsed lockfile, or null if invalid */ export declare function parseLockfile(content: string): CapabilityLockfile | null; /** * Write a lockfile to disk. * * @param lockfile - The lockfile to persist * @param projectRoot - Project root directory */ export declare function writeLockfile(lockfile: CapabilityLockfile, projectRoot: string): Promise; /** * Read a lockfile from disk. * * @param projectRoot - Project root directory * @returns Parsed lockfile, or null if not found / invalid */ export declare function readLockfile(projectRoot: string): Promise; export {}; //# sourceMappingURL=CapabilityLockfile.d.ts.map