import "reflect-metadata";
import { CopilotRuntimeLike } from "../core/runtime.mjs";
import { CopilotRuntimeHooks } from "../core/hooks.mjs";
import { ActivateChannelEngine, ChannelsControl } from "../core/channel-manager.mjs";
import { Router } from "express";
import { CorsOptions } from "cors";

//#region src/v2/runtime/endpoints/express.d.ts
/**
 * An Express {@link Router} that may also carry an optional
 * {@link ChannelsControl} surface. The Router object itself is request-scoped
 * middleware, but an Express app can only run inside a long-running
 * `http.Server` — so this wrapper is a lifecycle-owning host like
 * `createCopilotNodeListener`: it STARTS activation of the runtime's declared
 * managed Channels at creation, and `.channels` is here to observe (`ready()`)
 * or tear down (`stop()`) that activation.
 */
type CopilotExpressRouter = Router & {
  channels?: ChannelsControl;
};
interface CopilotExpressEndpointParams {
  runtime: CopilotRuntimeLike;
  basePath: string;
  /**
   * Endpoint mode.
   * - `"multi-route"` (default): separate routes for each operation
   * - `"single-route"`: single POST endpoint with JSON envelope dispatch
   */
  mode?: "multi-route" | "single-route";
  /**
   * CORS configuration for the Express router.
   * - `true` (default): permissive CORS (`origin: "*"`, all methods, all headers).
   * - `false`: no CORS middleware is applied — handle it yourself.
   * - object: passed directly to the Express `cors()` middleware.
   */
  cors?: boolean | CorsOptions;
  /**
   * Lifecycle hooks for request processing.
   */
  hooks?: CopilotRuntimeHooks;
  /**
   * Whether the underlying handler builds the control surface for the runtime's
   * declared managed Channels — and, because Express is a long-running host,
   * starts their activation at creation. Defaults to `true`. Set `false` to
   * build no surface and open no socket (tests, short-lived scripts). See
   * `CopilotRuntimeHandlerOptions.activateChannels`.
   */
  activateChannels?: boolean;
  /**
   * @internal Test seam: inject a fake Channel activation engine. Forwarded
   * to `createCopilotRuntimeHandler`. Not part of the public API.
   */
  __channelEngine?: ActivateChannelEngine;
}
declare function createCopilotExpressHandler({
  runtime,
  basePath,
  mode,
  cors: corsOption,
  hooks,
  activateChannels,
  __channelEngine
}: CopilotExpressEndpointParams): CopilotExpressRouter;
//#endregion
export { CopilotExpressEndpointParams, CopilotExpressRouter, createCopilotExpressHandler };
//# sourceMappingURL=express.d.mts.map