/** * Runtime context detection and entry availability matching (Node.js version). * * Provides: * - `RuntimeContext` — snapshot of the current platform, runtime, deployment, env, provider, target * - `EntryAvailability` — declarative constraint for when an entry is available * - `getRuntimeContext()` — lazy singleton returning the detected context * - `isEntryAvailable()` — pure matcher: does the constraint match the context? * - `checkEntryAvailability()` — structured matcher returning `{available, missingAxes}` * * Issue #417 adds: * - `os` as the new name for `platform` (alias preserved for back-compat) * - `provider` (vercel / lambda / cloudflare / netlify / docker / bare / …) * - `target` (the build output produced by `frontmcp build --target `) * - `surface` (per-call axis: mcp / cli / agent / job / http-trigger) */ /** * Snapshot of the current runtime environment. Detected once and cached * for the lifetime of the process. */ export interface RuntimeContext { /** OS platform: 'darwin', 'linux', 'win32', etc. (issue #417: renamed from platform) */ os: string; /** @deprecated Use `os` instead. Legacy alias preserved for back-compat. */ platform: string; /** JavaScript runtime: 'node', 'bun', 'deno', 'edge', 'browser' */ runtime: string; /** Deployment mode: 'distributed', 'serverless', 'standalone', or 'browser' */ deployment: string; /** Deploy provider (issue #417): 'vercel', 'lambda', 'cloudflare', 'docker', 'bare', … */ provider: string; /** Build target produced by `frontmcp build` (issue #417). `'unknown'` in dev. */ target: string; /** NODE_ENV value: 'production', 'development', 'test', etc. */ env: string; } /** * Per-call surface — `surface` is the only axis that varies per request. * Set by transport adapters / agent dispatchers / job runners on the * outgoing `ctx` so registry filtering can fork on call origin. */ export type Surface = 'mcp' | 'cli' | 'http-trigger' | 'job' | 'agent'; /** Call-context wrapper threaded through `findTool` for per-call filtering. */ export interface CallContext { surface?: Surface; } /** * Declarative constraint for entry availability. * * Semantics: * - AND across fields: all specified fields must match * - OR within arrays: at least one value in the array must match * - Omitted field: unconstrained (matches any value) * - Empty array: matches nothing (entry is never available) * - undefined/empty object: always available * * @example macOS only * ```typescript * { os: ['darwin'] } * ``` * * @example CLI binary on Linux only (issue #417) * ```typescript * { target: ['cli'], os: ['linux'] } * ``` * * @example MCP-only — block CLI / agent / job invocations (issue #417) * ```typescript * { surface: ['mcp'] } * ``` */ export interface EntryAvailability { /** OS constraint (issue #417: renamed from `platform`). */ os?: string[]; /** @deprecated Use `os` instead. Legacy alias preserved for back-compat. */ platform?: string[]; /** Runtime constraint: 'node', 'browser', 'edge', 'bun', 'deno' */ runtime?: string[]; /** Deployment constraint: 'distributed', 'serverless', 'standalone', 'browser' */ deployment?: string[]; /** Deploy-provider constraint (issue #417). */ provider?: string[]; /** Build-target constraint (issue #417). */ target?: string[]; /** Surface constraint (issue #417): 'mcp', 'cli', 'agent', 'job', 'http-trigger'. */ surface?: Surface[]; /** Environment constraint: 'production', 'development', 'test', etc. */ env?: string[]; } /** * Zod schema for validating EntryAvailability in metadata. */ export declare const entryAvailabilitySchema: import("@frontmcp/lazy-zod").ZodObject<{ os: import("@frontmcp/lazy-zod").ZodOptional>; platform: import("@frontmcp/lazy-zod").ZodOptional>; runtime: import("@frontmcp/lazy-zod").ZodOptional>; deployment: import("@frontmcp/lazy-zod").ZodOptional>; provider: import("@frontmcp/lazy-zod").ZodOptional>; target: import("@frontmcp/lazy-zod").ZodOptional>; surface: import("@frontmcp/lazy-zod").ZodOptional>>; env: import("@frontmcp/lazy-zod").ZodOptional>; }, import("zod/v4/core").$strict>; /** * Check if an entry is available in the given runtime context. * * Surface is checked separately because it's a per-call axis, not a * process-global one. Pass it via `callCtx.surface` to enforce * `availableWhen.surface` at call time. * * @param availability - The constraint (undefined = always available) * @param ctx - The current runtime context * @param callCtx - Optional per-call context (surface, …) * @returns true if the entry should be available */ export declare function isEntryAvailable(availability: EntryAvailability | undefined, ctx: RuntimeContext, callCtx?: CallContext): boolean; /** * Structured variant of `isEntryAvailable` — returns the list of axes * that failed so flow-level call sites can build a `missingAxes`-shaped * error response (issue #417). */ export declare function checkEntryAvailability(availability: EntryAvailability | undefined, ctx: RuntimeContext, callCtx?: CallContext): { available: boolean; missingAxes: (keyof EntryAvailability)[]; }; /** * Detect the current runtime context from the environment. */ export declare function detectRuntimeContext(): RuntimeContext; /** * Get the current runtime context (lazy singleton). * The context is detected on first call and cached for the process lifetime. */ export declare function getRuntimeContext(): RuntimeContext; /** * Reset the cached runtime context. For testing only. */ export declare function resetRuntimeContext(): void;