import { f as HostConfigInputV2, g as CanonicalHostConfigV2, b as HostJson } from '../public-types-c84qENXu.js';
export { C as CspDomainSet, h as HOST_CONFIG_SCHEMA_VERSION_V2, i as HostConfigConnectionDefaults, j as HostConfigMcpProfileV1, k as SEP_1865_PERMISSION_FEATURES } from '../public-types-c84qENXu.js';
import { M as McpProtocolVersion } from '../mcp-protocol-version-cf74324S.js';
export { H as HostExecutionPolicy, T as ToolExposureSignals, a as ToolMetadataSource, b as applyVisibilityPolicyAndCountSignals, c as buildHostIterationMetadata, d as buildHostSnapshotMetadata, e as extractHostExecutionPolicy, f as filterAppOnlyTools } from '../tool-visibility-BcyAmAvf.js';

/**
 * SEP-1865 app-only-tool predicate.
 *
 * Pure leaf — no runtime imports. Lives in `host-config/` so the
 * `@mcpjam/sdk/host-config/internal` barrel can re-export it without
 * pulling Node-only deps (e.g. `ai`, `@modelcontextprotocol/client`)
 * that `mcp-client-manager/tool-converters.ts` brings in.
 *
 * `tool-converters.ts` re-exports `isAppOnlyTool` from this file so
 * existing external import paths continue to work.
 */
/**
 * Checks whether a tool is app-only per SEP-1865 (`_meta.ui.visibility = ["app"]`).
 *
 * Per SEP-1865, tools whose visibility does not include `"model"` MUST NOT be
 * included in the agent's tool list. They remain callable from the iframe/app
 * via `tools/call`, but the model never sees them.
 *
 * @param toolMeta - The tool's `_meta` field from listTools result
 * @returns true if the tool is app-only (must be hidden from the model)
 */
declare function isAppOnlyTool(toolMeta: Record<string, unknown> | undefined): boolean;

/**
 * HostConfig v2 canonicalizer — pure, browser-safe, byte-stable.
 *
 * SOURCE OF TRUTH (hand-mirrored by `convex/lib/hostConfigV2.ts`). Stable key
 * ordering matters for hash stability across runtimes: we JSON.stringify the
 * canonical object; Object.keys preserves insertion order, so we build output
 * with a fixed key order rather than spreading user input. Any behavior change
 * here must be mirrored in the backend in lockstep and the parity fixtures
 * regenerated (see `./types.ts` header).
 */

declare function canonicalizeHostConfigV2(input: HostConfigInputV2): CanonicalHostConfigV2;

/**
 * HostConfig v2 content hash — Web Crypto, ASYNC.
 *
 * Uses `crypto.subtle` (available in the browser, Node >= 20, and the Convex
 * isolate), so this is the single portable hashing path. There is
 * deliberately NO synchronous variant: the backend mirror is already async
 * (`convex/lib/keys.ts:sha256Hex` + `computeHostConfigHashV2`), so SDK and
 * backend stay byte-identical with zero call-site divergence. If a sync need
 * ever arises, add an explicit `*Sync` API backed by a vendored SHA-256
 * rather than making the default ambiguous.
 */

declare function sha256Hex(input: string): Promise<string>;
/**
 * Canonicalize `input` and return the sha256 of its canonical JSON. This is
 * the content-address used to dedupe persisted host-config rows; the backend
 * recomputes the same value to integrity-check client-supplied configs.
 */
declare function computeHostConfigHashV2(input: HostConfigInputV2): Promise<string>;

/**
 * HostConfig v2 — portable defaults + small pure resolvers.
 *
 * First-party, browser-safe, dependency-free. Exposed via
 * `@mcpjam/sdk/host-config/internal`. The Convex backend imports these
 * alongside the canonicalizer (one source of truth); the inspector client
 * re-exports them from `@/lib/client-config-v2` so its 60+ importers stay
 * untouched.
 *
 * Anything that mints a full `HostConfigInputV2` scaffold (an editor-facing
 * default-filler) belongs in the application layer that knows its own style
 * + model defaults — the SDK deliberately ships no default `style`/`model`
 * (Stage 0b hardening). This module is just the small, opinionated knobs
 * both backend and client can agree on.
 */

/**
 * Default sampling temperature when an editor mints a fresh host config.
 *
 * Mirror of the backend's `DEFAULT_TEMPERATURE_V2` constant (used by
 * `ensureProjectV2Default` to seed new project hosts) and the inspector
 * client's `emptyHostConfigInputV2` default. Lives here so both readers
 * agree on the same number — bumping it later is a one-place edit.
 */
declare const DEFAULT_TEMPERATURE_V2 = 0.7;
/**
 * Resolve the effective pinned MCP protocol version for a server
 * connection: per-server override beats host-level default; both
 * undefined yields undefined ("no opinion — SDK chooses at request time").
 *
 * `undefined` is a load-bearing sentinel — do NOT materialize a concrete
 * version when neither layer has an opinion, or canonical hashes churn
 * whenever the SDK default moves and future SDK default upgrades silently
 * no-op against existing rows.
 *
 * Both inputs are optional so callers can read straight off a hydrated
 * host-config row without normalizing first.
 */
declare function resolveEffectiveMcpProtocolVersion(serverOverride: McpProtocolVersion | undefined, hostDefault: McpProtocolVersion | undefined): McpProtocolVersion | undefined;

/**
 * OpenAI Apps compat resolution from a hostConfig (+ optional override).
 *
 * Pure — no Convex / Node / ai-sdk imports. The eval runner uses this to
 * decide whether to inject the OpenAI Apps compat shim into widget HTML
 * snapshots for hosts that emulate ChatGPT-style apps.
 *
 * Resolution order (first match wins):
 *   1. Explicit override on `hostConfigOverride.{mcpProfile|mcp}.apps.compatRuntime.openaiApps`
 *   2. Host-style preset from `hostConfigOverride.{hostStyle|style}`
 *   3. Explicit base on `hostConfig.{mcpProfile|mcp}.apps.compatRuntime.openaiApps`
 *   4. Host-style preset from `hostConfig.{hostStyle|style}` (defaults to `false`)
 *
 * Both canonical (`hostStyle`/`mcpProfile`) and public (`style`/`mcp`)
 * shapes are accepted because callers span: inspector eval runners
 * (canonical, via Convex) and SDK `HostRunner` / `HostRuntime` (public,
 * via `Host.toJSON()`).
 *
 * Style presets:
 *   - "chatgpt" | "copilot" | "mcpjam" → true
 *   - "claude"  | "cursor"  | "codex"  → false
 *   - anything else → undefined (falls through; ultimate default is false)
 */
declare function readOpenAiCompatOverride(value: unknown): boolean | undefined;
declare function compatPresetForHostStyle(hostStyle: unknown): boolean | undefined;
declare function resolveOpenAiCompatForHostConfig(hostConfig: unknown, hostConfigOverride?: Record<string, unknown>): boolean;

/**
 * SDK→backend eval ingestion wire normalizer (Stage 5, Step 1).
 *
 * `normalizeSdkEvalHostConfigForWire` produces the byte-stable input that BOTH
 * the SDK eval reporter (Step 3) and the backend ingestion handler (Step 2)
 * feed into `canonicalizeHostConfigV2` + `computeHostConfigHashV2`. By
 * normalizing on the wire — not on either side independently — we guarantee
 * client and backend mint the same content-addressed `hostConfigsV2` id from
 * the same logical configuration.
 *
 * The normalizer's only behavior is to STRIP fields that are runtime-manager
 * identifiers, never `Id<'servers'>`:
 *   - `serverIds`
 *   - `optionalServerIds`
 *   - `serverConnectionOverrides`  (server-keyed overrides also use runtime ids)
 *
 * Everything else is preserved verbatim. We do NOT canonicalize, sort, hash,
 * or otherwise reshape — that's the canonicalizer's job. This is a thin,
 * lossy projection that produces a uniformly-shaped `HostConfigInputV2`
 * regardless of whether the caller fed us a canonical input or a public
 * `Host.toJSON()` snapshot.
 *
 * Shape acceptance (Stage 4 trap-log finding): some callers feed already-
 * canonical `HostConfigInputV2` (storage-row vocabulary: `hostStyle`,
 * `mcpProfile`, `serverIds`); others feed `HostJson` from `Host.toJSON()`
 * (public vocabulary: `style`, `mcp`, `servers`). Detect by discriminative
 * keys and project the public shape to the canonical input shape BEFORE
 * stripping.
 *
 * Pure, browser-safe, runtime-free. No `node:*`, `ai`, or `MCPClientManager`
 * imports — this file must stay in the `host-config/internal` bundle slice
 * that the inspector client and the Convex backend can both consume.
 */

/**
 * Pass-1 wire normalizer for SDK→backend eval ingestion.
 *
 * Strips runtime-manager identifiers (`serverIds`, `optionalServerIds`,
 * `serverConnectionOverrides`) so the SDK reporter and backend handler hash
 * byte-identical wire shapes. Accepts EITHER a canonical
 * {@link HostConfigInputV2} OR a public {@link HostJson} (`Host.toJSON()`);
 * the public shape is projected to the canonical input shape before stripping.
 *
 * Pure, idempotent, side-effect-free.
 *
 * @param source canonical input or public `HostJson` snapshot
 * @returns a fresh `HostConfigInputV2` with runtime ids stripped
 */
declare function normalizeSdkEvalHostConfigForWire(source: HostConfigInputV2 | HostJson): HostConfigInputV2;

export { CanonicalHostConfigV2, DEFAULT_TEMPERATURE_V2, HostConfigInputV2, McpProtocolVersion, canonicalizeHostConfigV2, compatPresetForHostStyle, computeHostConfigHashV2, isAppOnlyTool, normalizeSdkEvalHostConfigForWire, readOpenAiCompatOverride, resolveEffectiveMcpProtocolVersion, resolveOpenAiCompatForHostConfig, sha256Hex };
