import { l as HostConfigInputV2, C as CanonicalHostConfigV2, m as HostConfigOAuthProfile, M as McpProtocolVersion } from '../types-HXAijHji.js'; export { n as CanonicalHostConfigSkillSelection, o as CspDomainSet, p as HARNESS_IDS, q as HOST_CONFIG_SCHEMA_VERSION_V2, f as Harness, g as HostConfigComputer, a as HostConfigConnectionDefaults, b as HostConfigMcpProfileV1, r as HostConfigOAuthProfileV1, s as HostConfigOAuthProfileV2, H as HostConfigSkillSelection, i as McpToolResultImageRenderPlacement, e as McpToolResultImageRendering, h as McpToolResultImageRenderingPolicy, d as ModelVisibleMcpToolResults, t as OAUTH_AUTH_MODELS, u as OAUTH_PROFILE_EVIDENCE_STATUSES, v as OAUTH_SCOPE_REQUEST_MODES, w as OAUTH_TOKEN_ENDPOINT_AUTH_METHODS, x as OAuthAuthModel, y as OAuthDcrIdentity, z as OAuthProfileEvidence, A as OAuthProfileEvidenceStatus, B as OAuthProtocolVersionPinning, O as OAuthScopeRequest, D as OAuthScopeRequestMode, E as OAuthSpecRevision, F as OAuthSpecVersionClaim, k as OAuthTokenEndpointAuthMethod, G as SEP_1865_PERMISSION_FEATURES, I as isHarness } from '../types-HXAijHji.js'; export { H as HostExecutionPolicy, R as ResolvedMcpToolResultImageRenderingPolicy, T as ToolExposureSignals, a as ToolMetadataSource, b as applyVisibilityPolicyAndCountSignals, c as buildHostIterationMetadata, d as buildHostSnapshotMetadata, e as extractHostExecutionPolicy, f as filterAppOnlyTools, r as resolveMcpToolResultImageRendering } from '../tool-visibility-B8MWtym0.js'; import { H as HostJson } from '../public-types-CX8stXC3.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 | undefined): boolean; /** * HostConfig v2 canonicalizer — pure, browser-safe, byte-stable. * * SOURCE OF TRUTH — and the ONLY implementation: `convex/lib/hostConfigV2.ts` * imports this function rather than mirroring it (mcpjam-backend PR #409). * * 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. * Adding a new OPTIONAL field is safe for existing hashes as long as it is * omitted when absent — the golden vectors in * `sdk/tests/host-config-parity.test.ts` prove it and must keep passing * WITHOUT regeneration. See the `./types.ts` header for the backend * persistence caveat. */ /** * Canonicalize the per-host OAuth profile (HP-3 / HP-43). * * Exported because HP-45 (seed validated findings) and HP-47 (per-client * sweep) build profiles outside a full HostConfig and need to normalize + * validate them standalone before they are attached to a host — the private * catalog resolves its rows through this same entry point. * * Dispatches on `profileVersion`. V1 canonicalization is FROZEN (existing * content-addressed hashes must stay valid) and a V1 row is never rewritten * to V2 — whichever version came in is what comes out. */ declare function canonicalizeOAuthProfile(input: HostConfigOAuthProfile | undefined): HostConfigOAuthProfile | undefined; 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; /** * 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; /** * 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 | "auto" | undefined): McpProtocolVersion | undefined; /** * The MCP connection facts a host advertises — what to send in the `initialize` * handshake (`clientInfo`, `clientCapabilities`, protocol version) and whether * the host filters app-only tools from its model's view. * * Lets a non-browser surface (CLI, MCP server, API) connect to an MCP server * "as a host" using the same facts the playground does. The wire fields map * directly onto `MCPServerConfig` (`clientInfo` / `clientCapabilities` / * `supportedProtocolVersions` / `mcpProtocolVersion` / * `mirrorToolParamHeaders`); `respectToolVisibility` * drives `applyVisibilityPolicyAndCountSignals` on a tool list. */ interface HostConnectionProfile { clientInfo?: { name?: string; version?: string; } & Record; clientCapabilities?: Record; supportedProtocolVersions?: string[]; mcpProtocolVersion?: string; /** * SEP-2243 `Mcp-Param-*` mirroring, already reduced to the wire-layer * boolean `MCPServerConfig.mirrorToolParamHeaders` takes: `undefined` = * mirror (the spec-conforming default), `false` = the host asked to * simulate a client that never sends them. Only ever `false` or absent — * `"mirror"` collapses to absent so the wire config stays untouched. */ mirrorToolParamHeaders?: boolean; /** * Client-conformance knobs, reduced to their wire shape: only the * NON-default value survives (the full-behavior literal and an absent * field are the same instruction, and an unknown future literal fails * closed into the full behavior). * * `true` = treat page one of paginated lists as the complete result. Maps * onto `MCPServerConfig.firstPageOnly`, which the client manager enforces * with a transport wrapper. */ firstPageOnly?: true; /** * `false` = the client does not drive MRTR `input_required` rounds. * Enforcement lands in a follow-up PR; carrying the reduction here keeps * the profile → wire mapping in one place. */ supportsMrtr?: false; /** * `true` = the client never opens the server→client notification channel * (legacy: the standalone GET SSE stream; 2026-07-28: * `subscriptions/listen`). ChatGPT measures this way — prober saw it never * open one — so a host emulating ChatGPT must not either. */ suppressListenChannel?: true; /** * `true` = the client ignores `notifications/tools/list_changed` instead of * acting on it. Only meaningful when the channel is open, since nothing can * arrive otherwise. */ dropToolListChanged?: true; /** undefined = spec default (filter app-only tools); false = host opts out. */ respectToolVisibility: boolean | undefined; } /** * Derive a {@link HostConnectionProfile} from a **seeded host config** — the * internal `mcpProfile` shape that `seedHostTemplate(id)` returns. Pure read, no * I/O. `clientInfo` + `supportedProtocolVersions` live under * `mcpProfile.initialize`; the protocol-version pin lives at * `mcpProfile.mcpProtocolVersion` (sibling of `initialize`); the advertised * capabilities and visibility policy live at the top level. * * (Not the public `Host.toJSON()` shape, which uses `mcp.protocolVersion` etc.) */ declare function hostConnectionProfile(hostConfig: Record): HostConnectionProfile; /** * 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" | "goose" → 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): 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 agree on the transport-integrity hash. The eventual * stored v2 `hostConfigs` row may have a different hash because backend * materialization layers suite-resolved Convex `serverIds` back in. * * The normalizer's only behavior is to STRIP fields that must not ride the * eval wire: * - `serverIds` (runtime-manager identifiers, never `Id<'servers'>`) * - `optionalServerIds` * - `serverConnectionOverrides` (server-keyed overrides also use runtime ids) * - `computer` (mutable per-user state — an eval that shells * into a personal computer isn't reproducible; * the backend also rejects it at run start. * See mcpjam-backend docs/project-computers.md) * - `skillSelection` (explicit `skillIds` are platform-internal * Convex skill ids, not portable across * projects/deployments) * * Skill-selection stripping is EXTERNAL-wire-only: platform-owned eval suites * keep `skillSelection` in their persisted HostConfigs — only this external * SDK eval wire normalization strips it (until a portable skill reference is * defined). * * 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`), the eval-forbidden `computer` field, and the * platform-internal `skillSelection` so the SDK reporter and backend handler * hash byte-identical wire shapes — and so evals never carry a personal * computer or non-portable Convex ids. 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, HostConfigOAuthProfile, type HostConnectionProfile, McpProtocolVersion, canonicalizeHostConfigV2, canonicalizeOAuthProfile, compatPresetForHostStyle, computeHostConfigHashV2, hostConnectionProfile, isAppOnlyTool, normalizeSdkEvalHostConfigForWire, readOpenAiCompatOverride, resolveEffectiveMcpProtocolVersion, resolveOpenAiCompatForHostConfig, sha256Hex };