/** * Defines the provider-neutral capability profile negotiated for one concrete * connector account and target. Rendering code consumes this profile directly; * connector names are deliberately absent from the runtime decision path. */ import type { InteractionBlock, InteractionKind } from "../types/interactions.js"; export declare const INTERACTION_PROFILE_VERSION: 1; export declare const INTERACTION_BLOCK_KINDS: readonly ["choice", "form", "followups", "task", "secret"]; export type InteractionDeliveryMode = "native" | "conversational" | "signed-hosted" | "sensitive-request"; export interface InteractionPrimitiveLimits { buttons: { supported: boolean; maxPerRow: number; maxPerMessage: number; maxLabelBytes: number; maxCallbackBytes: number; }; lists: { supported: boolean; maxItems: number; maxLabelBytes: number; maxDescriptionBytes: number; }; modals: { supported: boolean; maxFields: number; maxTitleBytes: number; }; forms: { supported: boolean; maxFields: number; maxOptionsPerField: number; }; links: { supported: boolean; maxUrlBytes: number; }; edits: { supported: boolean; windowMs: number | null; }; threads: { supported: boolean; maxTitleBytes: number; }; text: { maxMessageBytes: number; }; attachments: { supported: boolean; maxCount: number; maxBytesEach: number; mimeTypes: readonly string[]; }; } export interface InteractionBlockCapability { modes: readonly InteractionDeliveryMode[]; /** Maximum lifetime for a callback rendered from this block. */ maxSessionTtlMs: number; } export interface ConnectorInteractionCapabilityProfile { profileVersion: typeof INTERACTION_PROFILE_VERSION; profileId: string; connector: { source: string; accountId: string; }; target: { kind: string; id: string; }; blocks: Record; limits: InteractionPrimitiveLimits; /** Ordered, actionable degradation paths for non-secret input. */ nonSecretFallbacks: readonly Exclude[]; /** Secret and OAuth collection is never allowed through ordinary chat data. */ sensitiveFallback: "sensitive-request"; } export interface InteractionProfileTemplate { templateId: string; blocks: Record; limits: InteractionPrimitiveLimits; nonSecretFallbacks: ConnectorInteractionCapabilityProfile["nonSecretFallbacks"]; } /** Validate and defensively copy one complete per-account/target profile. */ export declare function normalizeConnectorInteractionCapabilityProfile(profile: ConnectorInteractionCapabilityProfile): ConnectorInteractionCapabilityProfile; /** Materialize a template for exactly one connector account and target. */ export declare function createConnectorInteractionCapabilityProfile(args: { template: InteractionProfileTemplate; source: string; accountId: string; targetKind: string; targetId: string; }): ConnectorInteractionCapabilityProfile; export interface NegotiatedInteractionDelivery { mode: InteractionDeliveryMode; reason: "preferred" | "native-limit" | "native-unavailable" | "sensitive"; limitations: readonly string[]; } export interface InteractionNegotiationContext { callbackBytes?: number; buttonsPerRow?: number; signedHostedUrl?: string; /** True only after the owning host verifies this URL's signature and authority. */ signedHostedUrlVerified?: boolean; requiresEdit?: boolean; sourceMessageCreatedAt?: number; now?: number; requiresThread?: boolean; } /** Select a layout solely from negotiated capability and present payload size. */ export declare function negotiateInteractionDelivery(block: InteractionBlock, profileValue: ConnectorInteractionCapabilityProfile, context?: InteractionNegotiationContext): NegotiatedInteractionDelivery; /** Rejects profile-ID collisions whose immutable account/target body differs. */ export declare class ConnectorInteractionProfileRegistry { private readonly profiles; register(value: ConnectorInteractionCapabilityProfile): ConnectorInteractionCapabilityProfile; get(profileId: string): ConnectorInteractionCapabilityProfile | null; } /** Deterministic reviewer-facing matrix; callers decide where to persist it. */ export declare function renderInteractionCapabilityMatrix(profiles: readonly ConnectorInteractionCapabilityProfile[]): string;