import { M as McpProtocolVersion } from './mcp-protocol-version-cf74324S.js';

/**
 * HostConfig v2 — portable type surface.
 *
 * SOURCE OF TRUTH. This module is the canonical home of the host-config
 * shape, canonicalizer, and hash. It is hand-mirrored (NOT imported) by the
 * Convex backend in `convex/lib/hostConfigV2.ts`, because Convex's isolate
 * bundling forbids importing `@mcpjam/sdk` (Node-only deps). Drift between
 * the two implementations is caught by a golden-vector parity test that runs
 * identical inputs through both canonicalizers and asserts byte-identical
 * canonical JSON + sha256 (see `sdk/tests/host-config-parity.test.ts` and
 * `mcpjam-backend/tests/convex/hostConfigV2Parity.test.ts`). When you change
 * a type or canonicalization rule here, update the backend mirror in the
 * same change set and regenerate both fixture copies.
 *
 * Pure + browser-safe: no `convex/values`, no `ctx.db`, no Node-only APIs.
 */

/**
 * Identifier of a host-config host style. Storage is a free-form string —
 * the canonical "what's a registered host" check lives in the inspector
 * client's `lib/host-styles` registry, not here. Treated as an opaque
 * pointer into that registry so users can register custom hosts (BYO)
 * without a backend deploy.
 */
type HostConfigStyle = string;
/**
 * Public alias of {@link HostConfigStyle}. **Intentionally `string`**, not a
 * closed union — the host registry is extensible (users can register custom
 * host styles via the client's `lib/host-styles` registry without an SDK or
 * backend deploy). Don't "tighten" this to `'mcpjam' | 'claude' | 'chatgpt'`;
 * it would break BYO hosts.
 */
type HostStyleId = HostConfigStyle;
/**
 * Opaque MCP server identifier. The backend brands this as `Id<'servers'>`;
 * the portable core treats it as a plain string because the canonicalizer
 * only sorts/dedupes serverIds — it never dereferences them.
 */
type ServerId = string;
declare const HOST_CONFIG_SCHEMA_VERSION_V2 = 2;
/**
 * Permissions Policy feature tokens corresponding to the four
 * SEP-1865 spec permissions. These are the KEBAB-CASE browser tokens
 * (as they appear in iframe `allow=` attributes), NOT the camelCase
 * mcpProfile.permissions.allow keys. The canonicalizer uses this list to
 * drop these features from `allowFeatures` (they belong in
 * `permissions.allow`).
 *
 * Naming gap (intentional): `permissions.allow.clipboardWrite` (camel,
 * spec field name) ↔ `allowFeatures["clipboard-write"]` (kebab,
 * Permissions Policy token). Do NOT normalize casing on either side.
 */
declare const SEP_1865_PERMISSION_FEATURES: readonly ["camera", "microphone", "geolocation", "clipboard-write"];
type HostConfigConnectionDefaults = {
    headers: Record<string, string>;
    requestTimeout: number;
};
type CspDomainSet = {
    connectDomains?: string[];
    resourceDomains?: string[];
    frameDomains?: string[];
    baseUriDomains?: string[];
};
type HostConfigMcpProfileV1 = {
    profileVersion: 1;
    mcpProtocolVersion?: McpProtocolVersion;
    initialize?: {
        supportedProtocolVersions?: string[];
        clientInfo?: Record<string, unknown>;
    };
    apps?: {
        sandbox?: {
            csp?: {
                mode?: "host-default" | "declared" | "relaxed";
                restrictTo?: CspDomainSet;
                cspDirectives?: Record<string, string[]>;
                extensions?: Record<string, unknown>;
            };
            permissions?: {
                mode?: "resource-declared" | "deny-all" | "custom";
                allow?: Record<string, boolean>;
                extensions?: Record<string, unknown>;
            };
            sandboxAttrs?: string[];
            allowFeatures?: Record<string, string>;
        };
        uiInitialize?: {
            hostInfo?: Record<string, unknown>;
        };
        compatRuntime?: {
            openaiApps?: boolean;
            openaiAppsOverrides?: OpenAiAppsCapabilities;
        };
        mcpAppsOverrides?: McpAppsCapabilities;
    };
    extensions?: Record<string, unknown>;
};
type OpenAiAppsCapabilities = {
    callTool?: boolean;
    sendFollowUpMessage?: boolean;
    setWidgetState?: boolean;
    requestDisplayMode?: "all" | "fullscreen-only" | "none";
    notifyIntrinsicHeight?: boolean;
    openExternal?: boolean;
    setOpenInAppUrl?: boolean;
    requestModal?: boolean;
    uploadFile?: boolean;
    selectFiles?: boolean;
    getFileDownloadUrl?: boolean;
    requestCheckout?: boolean;
    requestClose?: boolean;
};
type McpAppsCapabilities = {
    availableDisplayModes?: ("inline" | "fullscreen" | "pip")[];
    toolInputPartial?: boolean;
    toolCancelled?: boolean;
    hostContextChanged?: boolean;
    resourceTeardown?: boolean;
    toolInfo?: boolean;
    openLinks?: boolean;
    serverTools?: boolean;
    serverResources?: boolean;
    logging?: boolean;
    updateModelContext?: boolean;
    message?: boolean;
    sandboxPermissions?: boolean;
    cspFrameDomains?: boolean;
    cspBaseUriDomains?: boolean;
    resourcePrefersBorder?: boolean;
    downloadFile?: boolean;
    requestTeardown?: boolean;
    widgetDisplayModeRequests?: "accept" | "user-initiated-only" | "decline";
};
type HostConfigInputV2 = {
    hostStyle: HostConfigStyle;
    modelId: string;
    systemPrompt: string;
    temperature: number;
    requireToolApproval: boolean;
    progressiveToolDiscovery?: boolean;
    respectToolVisibility?: boolean;
    serverIds?: Array<ServerId>;
    optionalServerIds?: Array<ServerId>;
    connectionDefaults: HostConfigConnectionDefaults;
    clientCapabilities: Record<string, unknown>;
    hostContext: Record<string, unknown>;
    hostCapabilitiesOverride?: Record<string, unknown>;
    chatUiOverride?: Record<string, unknown>;
    mcpProfile?: HostConfigMcpProfileV1;
    serverConnectionOverrides?: Record<string, {
        headersOverride?: Record<string, string>;
        requestTimeoutOverride?: number;
        mcpProtocolVersionOverride?: McpProtocolVersion;
    }>;
};
type CanonicalHostConfigV2 = {
    schemaVersion: typeof HOST_CONFIG_SCHEMA_VERSION_V2;
    hostStyle: HostConfigStyle;
    modelId: string;
    systemPrompt: string;
    temperature: number;
    requireToolApproval: boolean;
    progressiveToolDiscovery?: boolean;
    respectToolVisibility?: boolean;
    serverIds: Array<ServerId>;
    optionalServerIds: Array<ServerId>;
    connectionDefaults: HostConfigConnectionDefaults;
    clientCapabilities: Record<string, unknown>;
    hostContext: Record<string, unknown>;
    hostCapabilitiesOverride?: Record<string, unknown>;
    chatUiOverride?: Record<string, unknown>;
    mcpProfile?: HostConfigMcpProfileV1;
    serverConnectionOverrides?: Record<string, {
        headersOverride?: Record<string, string>;
        requestTimeoutOverride?: number;
        mcpProtocolVersionOverride?: McpProtocolVersion;
    }>;
};

export { type CanonicalHostConfigV2 as C, type HostConfigInputV2 as H, type McpAppsCapabilities as M, type OpenAiAppsCapabilities as O, SEP_1865_PERMISSION_FEATURES as S, HOST_CONFIG_SCHEMA_VERSION_V2 as a, type HostConfigConnectionDefaults as b, type HostConfigMcpProfileV1 as c, type CspDomainSet as d, type HostStyleId as e, type ServerId as f };
