/** * invoke-input-validation.ts (see CHANGELOG 1.0.0, Part B) * * A central, catalog-driven input gate for the gateway invoke layer. Before a * resolved verb's handler (or its HTTP delegate) runs, the invocation's params * are validated against the method catalog's `inputSchema`, returning an honest * 400 instead of letting a wrong-typed or missing-required field reach a handler * that would silently coerce or misbehave. * * Scope is deliberately the TYPED subset only: * - Object schemas that declare `properties` are structurally validated. * - Generic object schemas (object with no `properties`, e.g. an * additionalProperties-only "any JSON object") pass through unchanged, the * status quo, so no verb is falsely rejected for extra fields. * - A verb with no `inputSchema` is untyped and passes through. * * The validator is lenient on unknown keys (does NOT enforce * `additionalProperties: false`): the goal is to reject provable type/shape * mismatches, not to tighten every loose handler that historically tolerated * extra fields. It reports the first violation it finds. */ import type { GatewayMethodDescriptor } from './method-catalog-shared.js'; /** Structured result of a rejected invocation, same 400 shape the router uses. */ export interface InvokeValidationError { readonly code: 'INVALID_INPUT'; readonly detail: string; } /** How a descriptor's inputSchema is treated by the validate gate. */ export type InvokeValidationDisposition = 'validated' | 'generic' | 'untyped'; /** * Classify an inputSchema for both the validate gate and coverage accounting: * - 'validated', an object schema with declared properties (structurally checked) * - 'generic' , an object schema with no properties (skipped) * - 'untyped' , absent, or a non-object root we do not structurally validate (skipped) */ export declare function classifyInputSchema(schema: Record | undefined): InvokeValidationDisposition; /** * Validate an invocation's params against a verb's inputSchema. Returns an * `InvokeValidationError` when a typed schema is violated, or null when the * params conform, the schema is generic/untyped, or there is nothing to check. * * `params` is the request payload the verb receives (the invoke body for * body-carrying verbs). `undefined` is treated as an empty object so a schema * with required fields honestly reports them missing. */ export declare function validateInvocationInput(descriptor: GatewayMethodDescriptor, params: unknown): InvokeValidationError | null; /** Coverage tallies for the operator contract manifest: how many cataloged verbs * the invoke input gate structurally validates vs skips (generic/untyped). */ export interface InvokeValidationCoverage { readonly methods: number; readonly validated: number; readonly skippedGeneric: number; readonly skippedUntyped: number; } export declare function summarizeInvokeValidationCoverage(methods: readonly GatewayMethodDescriptor[]): InvokeValidationCoverage; //# sourceMappingURL=invoke-input-validation.d.ts.map