/** * Platform host placeholders in an external MCP `url` (guuey#1272). * * A guuey-hosted official MCP is served at a different host per environment * (`admin-mcp.dev.sandbox.guuey.com` · `admin-mcp.staging.sandbox.guuey.com` * · `admin-mcp.us-east-1.guuey.com`), so a single committed manifest could * not point every environment's pod at the right one — the admin agent's * README carried a `sed` swap for dev/staging rehearsals, one forgotten swap * away from a dev pod on the PRODUCTION MCP. This module is the grammar of * the fix: the manifest names the fact, the door names the host. * * "url": "https://${platform.adminMcpDomain}/mcp" * * Rules (settled with oss + infra on guuey#1272): * - the placeholder may be the ENTIRE host component and nothing else — no * port, no label around it, never in a path or a query — so the door's * substitution is one host swap, not a string template a reviewer has to * reason about; * - the facts are a CLOSED set, {@link PLATFORM_URL_FACTS}: field names of * the platform's own env-domains record (`backend/amplify/cdk/env-domains.ts` * in the guuey repo; `functions/shared/platform-domains.ts` is what the door * reads). This list is a hand-copy — `platform-url.test.ts` reads both * sides off disk when they are present and fails when they drift; * - `${env.NAME}` is a DIFFERENT namespace (the app's declared secrets, see * `headers`); platform facts are never available there, by design. * * Sequencing, stated here because it is a deliberate trade: this schema * accepts a templated url BEFORE every door resolves it. An older door * refuses the template with its existing 400 ("url must be a URL"), which the * CLI prints verbatim — loud, immediate and attributable, unlike a value that * silently arrives as `undefined` at runtime. A templated url therefore needs * a door new enough to resolve it; the deployment snapshot the door stores * carries the RESOLVED url (every pod reads a plain URL, as before) and the * authored template travels beside it so `guuey pull` can write the template * back — the local manifest stays environment-agnostic across the round trip. */ import { z } from 'zod'; /** The facts a manifest may name — field names of the platform's env-domains record. */ export declare const PLATFORM_URL_FACTS: readonly ["adminMcpDomain", "platformMcpDomain", "mcpDomain", "apiDomain"]; export type PlatformUrlFact = (typeof PLATFORM_URL_FACTS)[number]; /** The four hosts for one environment, keyed by fact — what the door resolves against. */ export type PlatformUrlFacts = Readonly>; export type PlatformUrlShape = { readonly kind: 'url'; } | { readonly kind: 'template'; readonly fact: PlatformUrlFact; } | { readonly kind: 'invalid'; readonly reason: string; }; /** * Classify a manifest url: a plain URL, a valid platform template (the whole * host is one known placeholder and the rest parses as a URL), or invalid * with the reason a builder can act on. */ export declare function classifyPlatformUrl(value: string): PlatformUrlShape; /** The fact a templated url names, or `null` for a plain URL. */ export declare function platformUrlFact(value: string): PlatformUrlFact | null; /** * Resolve a templated url against one environment's facts; a plain URL is * returned unchanged. The door calls this when it writes a snapshot; a pod * never sees a template. */ export declare function resolvePlatformUrl(value: string, facts: PlatformUrlFacts): string; /** * A manifest url field: a URL, or a platform-templated URL under the rules * above. Used for `agent.mcpServers..url` and `mcpResourceUrl`. */ export declare const PlatformUrl: z.ZodString; //# sourceMappingURL=platform-url.d.ts.map