import type { InteractiveQuestion } from './clarification.js';
import type { InteractiveOption } from './interactive-question.js';
/** Primitive field types supported by the MCP elicitation protocol. */
export type ElicitationFieldType = 'text' | 'number' | 'boolean' | 'enum' | 'multi-select';
/** Shared base for all elicitation field definitions. */
export interface ElicitationFieldBase {
    /** Machine-readable key used as the response object property name. */
    key: string;
    /** Human-readable label shown in the UI. */
    label: string;
    /** Whether the field must be filled before submitting the form. */
    required?: boolean;
    /** Optional default value pre-populated in the field. */
    defaultValue?: string | number | boolean | string[];
}
/** A free-text input field. */
export interface ElicitationTextField extends ElicitationFieldBase {
    type: 'text';
    /** Maximum allowed character length. */
    maxLength?: number;
    /** Placeholder hint shown inside the input. */
    placeholder?: string;
}
/** A numeric input field. */
export interface ElicitationNumberField extends ElicitationFieldBase {
    type: 'number';
    min?: number;
    max?: number;
}
/** A boolean toggle / checkbox field. */
export interface ElicitationBooleanField extends ElicitationFieldBase {
    type: 'boolean';
}
/** A single-select dropdown field constrained to a list of options. */
export interface ElicitationEnumField extends ElicitationFieldBase {
    type: 'enum';
    /** Ordered list of allowed values. */
    options: string[];
}
/** A multi-select field allowing zero or more items from a list. */
export interface ElicitationMultiSelectField extends ElicitationFieldBase {
    type: 'multi-select';
    /** Ordered list of selectable items. */
    options: string[];
}
/** Union of all supported field types. */
export type ElicitationField = ElicitationTextField | ElicitationNumberField | ElicitationBooleanField | ElicitationEnumField | ElicitationMultiSelectField;
/** A fully-built elicitation request ready to be sent to the MCP client. */
export interface ElicitationRequest {
    /** Short title displayed as the form heading. */
    title: string;
    /** Optional longer description shown below the title. */
    description?: string;
    /** Ordered list of fields to render. */
    fields: ElicitationField[];
}
/** Raw values returned by the client after the user fills the form. */
export type ElicitationResponseValues = Record<string, string | number | boolean | string[]>;
/** Parsed and validated elicitation response. */
export interface ElicitationResponse {
    /** Whether the user completed and submitted the form (vs. cancelling). */
    submitted: boolean;
    /** Validated field values keyed by field.key. Present only when submitted=true. */
    values?: ElicitationResponseValues;
    /** Validation errors per field key. Present when submitted=true but some fields are invalid. */
    errors?: Record<string, string>;
}
/** Result of parsing a raw client elicitation response. */
export interface ElicitationParseResult {
    /** True when all required fields are present and valid. */
    valid: boolean;
    /** Validated values, only present when valid=true. */
    values?: ElicitationResponseValues;
    /** Map of field key to error message for invalid fields. */
    errors: Record<string, string>;
}
/** Capability flag indicating whether the MCP server/client supports elicitation. */
export interface ElicitationCapability {
    /** True when the connected client declares elicitation support. */
    supported: boolean;
}
/** Options for building a text elicitation field. */
export interface TextFieldOptions {
    required?: boolean;
    maxLength?: number;
    placeholder?: string;
    defaultValue?: string;
}
/** Options for building a number elicitation field. */
export interface NumberFieldOptions {
    required?: boolean;
    min?: number;
    max?: number;
    defaultValue?: number;
}
/** Options for building a boolean elicitation field. */
export interface BooleanFieldOptions {
    required?: boolean;
    defaultValue?: boolean;
}
/** Options for building an enum elicitation field. */
export interface EnumFieldOptions {
    required?: boolean;
    defaultValue?: string;
}
/** Options for building a multi-select elicitation field. */
export interface MultiSelectOptions {
    required?: boolean;
    defaultValue?: string[];
}
/** Action returned by a client elicitation (MCP spec 2025-06-18). */
export type ElicitationAction = 'accept' | 'cancel' | 'decline';
/** Result of a client-capability probe for elicitation support. */
export interface ElicitationCapabilityResult {
    supported: boolean;
    reason?: string;
}
/**
 * Minimal shape of the MCP server used by `canElicit` / `elicitOrFallback`.
 * Kept structural so tests can inject a lightweight double without depending
 * on the full @modelcontextprotocol/sdk Server type.
 */
export interface ElicitationCapableServer {
    getClientCapabilities?: () => Record<string, unknown> | undefined;
    elicitInput?: (request: unknown) => Promise<unknown>;
}
/**
 * Minimal shell around an McpServer used by requestElicitation in engine/.
 * The engine only needs access to server.server to call elicitInput via
 * dynamic dispatch — nothing else from McpServer is required.
 * Kept as Record<string, unknown> to avoid SDK import in engine layer.
 */
export interface McpServerShell {
    server: Record<string, unknown>;
}
/** Single property inside an elicitation JSON Schema. */
export interface ElicitationSchemaProperty {
    type: 'string' | 'number' | 'boolean';
    description?: string;
    enum?: string[];
    enumNames?: string[];
    default?: string;
}
/**
 * Helper return type for `buildEnumSchema` — a single property entry that
 * the caller assembles into a full ElicitationSchema.
 */
export interface EnumSchemaBuilderResult {
    field: string;
    property: ElicitationSchemaProperty;
}
/** MCP Elicitation requested-schema (subset of JSON Schema). */
export interface ElicitationSchema {
    type: 'object';
    properties: Record<string, ElicitationSchemaProperty>;
    required?: string[];
}
/**
 * Outcome of `elicitOrFallback`. Callers discriminate on `mode`:
 *   - 'native': the client supported elicitation and replied; check `action`
 *   - 'fallback': include `interactiveQuestions` in the tool's
 *     structuredContent so the LLM relays via AskUserQuestion
 */
export type ElicitOrFallbackOutcome = {
    mode: 'native';
    action: ElicitationAction;
    content?: Record<string, unknown>;
} | {
    mode: 'fallback';
    interactiveQuestions: InteractiveQuestion[];
};
/**
 * Classification for the decision being elicited.
 * - 'policy' / 'business': requires user input (routed to elicitOrFallback)
 * - 'technical': inferred from codebase signals; elicitation is skipped
 */
export type DecisionType = 'policy' | 'business' | 'technical';
export type DecisionGapKind = 'behavior' | 'permission' | 'provider' | 'billing-model' | 'data' | 'failure' | 'scope';
export interface DecisionGap {
    id: string;
    kind: DecisionGapKind;
    header: string;
    question: string;
    evidence: string[];
    impact: string;
    options: InteractiveOption[];
    multiSelect: boolean;
    blocking: boolean;
}
export interface QuestionGroundingContext {
    gap: DecisionGap;
    requestText: string;
}
export interface QuestionGroundingResult {
    passed: boolean;
    reason?: string;
}
/**
 * Outcome when the decision was already cached in conventions.json.
 * The caller can return this value immediately without prompting the user.
 */
export interface CachedDecisionOutcome {
    mode: 'cached';
    value: string;
}
/** Full outcome union for elicitFromUser. */
export type ElicitFromUserResult = ElicitOrFallbackOutcome | CachedDecisionOutcome;
/**
 * Full options bag for `elicitFromUser()`.
 * Callers provide a schema for native elicitation AND a fallback question set
 * for clients that do not support the MCP elicitation protocol.
 */
export interface ElicitFromUserOptions {
    /** Unique slug for this decision — used as the cache key. E.g. 'spec-target'. */
    decisionKey: string;
    /** Policy/business decisions prompt the user; technical decisions are inferred. */
    decisionType: DecisionType;
    /** Human-readable message shown as form heading (native) or question text (fallback). */
    message: string;
    /** JSON Schema for the native elicitation form. */
    schema: ElicitationSchema;
    /** Fallback question(s) for non-elicitation clients. */
    fallback: InteractiveQuestion | InteractiveQuestion[];
    /** MCP server instance for capability detection. Pass null to force fallback. */
    server: unknown;
    /** Project path for reading/writing conventions.json decisions cache. */
    projectPath: string;
    /**
     * For technical decisions: the value inferred from codebase signals.
     * When decisionType === 'technical', this is returned immediately without IO.
     */
    inferredValue?: string;
}
//# sourceMappingURL=elicitation.d.ts.map