import * as z from 'zod'; import { ad as Registry } from './action-2eSGxHx0.js'; import 'json-schema'; import './context.js'; import './statusTypes.js'; import 'dotprompt'; import 'ajv'; /** * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ declare const RunActionResponseSchema: z.ZodObject<{ result: z.ZodOptional; error: z.ZodOptional; telemetry: z.ZodOptional; }, "strip", z.ZodTypeAny, { traceId?: string | undefined; }, { traceId?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { error?: unknown; telemetry?: { traceId?: string | undefined; } | undefined; result?: unknown; }, { error?: unknown; telemetry?: { traceId?: string | undefined; } | undefined; result?: unknown; }>; type RunActionResponse = z.infer; interface ReflectionServerOptions { /** * Exact port to bind; fails if it is taken. `0` lets the OS pick. When * unset, probes upward from 3100. `GENKIT_REFLECTION_PORT` overrides this. */ port?: number; /** Body size limit for the server. Defaults to `30mb`. */ bodyLimit?: string; /** Configured environments. Defaults to `dev`. */ configuredEnvs?: string[]; /** Display name that will be shown in developer tooling. */ name?: string; } /** * Reflection server exposes an API for inspecting and interacting with Genkit in development. * * This is for use in development environments. * * @hidden */ declare class ReflectionServer { /** List of all running servers needed to be cleaned up on process exit. */ private static RUNNING_SERVERS; /** Registry instance to be used for API calls. */ private registry; /** Options for the reflection server. */ private options; /** Port the server is actually running on. This may differ from `options.port` if the original was occupied. Null if server is not running. */ private port; /** Express server instance. Null if server is not running. */ private server; /** Path to the runtime file. Null if server is not running. */ private runtimeFilePath; /** Map of active actions indexed by trace ID for cancellation support. */ private activeActions; private v2Server; constructor(registry: Registry, options?: ReflectionServerOptions); get runtimeId(): string; /** * Finds a free port, probing upward from `startPort`. Used only when no * port was chosen; a chosen port is bound exactly. */ findPort(startPort?: number): Promise; /** * Binds `app` and sets `this.port`. * * A chosen port (env or code) is bound exactly or fails: shifting to the * next free one would leave whoever chose it talking to a dead port. * * A probed port is retried on EADDRINUSE: findPort() checks a port and * releases it before listen() binds, so another process starting at the * same time (e.g. two runtimes in a monorepo) can take it in between. */ private listen; /** * Rejects a request that does not carry the configured secret. * * `/api/__health` is exempt: it carries no registry content and is what * orchestrators and the CLI probe before they have any reason to know a * secret. The 401 body is empty on purpose. */ private authMiddleware; /** * Starts the server. * * The server will be registered to be shut down on process exit. */ start(): Promise; /** * Stops the server and removes it from the list of running servers to clean up on exit. */ stop(): Promise; private removeFromRunningServers; /** * Writes the runtime file to the project root. */ private writeRuntimeFile; /** * Cleans up the port file. */ private cleanupRuntimeFile; /** * Stops all running reflection servers. */ static stopAll(): Promise; } export { ReflectionServer, type ReflectionServerOptions, type RunActionResponse, RunActionResponseSchema };