import { Command, Option } from "commander";
import { SSMClient } from "@aws-sdk/client-ssm";
import { spawn } from "node:child_process";
import { WebSocket } from "ws";
import { IncomingMessage, Server, ServerResponse } from "node:http";
import graphlib from "graphlib";
import * as vm from "node:vm";

//#region src/types/resource.d.ts
interface CloudFormationTemplate {
  AWSTemplateFormatVersion?: string;
  Description?: string;
  Parameters?: Record<string, TemplateParameter>;
  Resources: Record<string, TemplateResource>;
  Outputs?: Record<string, TemplateOutput>;
  Conditions?: Record<string, unknown>;
  Mappings?: Record<string, unknown>;
  Transform?: unknown;
  Rules?: Record<string, unknown>;
}
interface TemplateParameter {
  Type: string;
  Default?: unknown;
  Description?: string;
  AllowedValues?: unknown[];
  AllowedPattern?: string;
  ConstraintDescription?: string;
}
interface TemplateResource {
  Type: string;
  Properties?: Record<string, unknown>;
  DependsOn?: string | readonly string[];
  Condition?: string;
  Metadata?: Record<string, unknown>;
  CreationPolicy?: Record<string, unknown>;
  UpdatePolicy?: Record<string, unknown>;
  DeletionPolicy?: 'Delete' | 'Retain' | 'Snapshot';
  UpdateReplacePolicy?: 'Delete' | 'Retain' | 'Snapshot';
}
interface TemplateOutput {
  Value: unknown;
  Description?: string;
  Export?: {
    Name: string;
  };
}
//#endregion
//#region src/types/state.d.ts
interface ResourceState {
  physicalId: string;
  resourceType: string;
  properties: Record<string, unknown>;
  observedProperties?: Record<string, unknown>;
  attributes?: Record<string, unknown>;
  dependencies?: string[];
  metadata?: Record<string, unknown>;
  deletionPolicy?: 'Delete' | 'Retain' | 'Snapshot' | 'RetainExceptOnCreate' | undefined;
  updateReplacePolicy?: 'Delete' | 'Retain' | 'Snapshot' | 'RetainExceptOnCreate' | undefined;
  provisionedBy?: 'sdk' | 'cc-api' | undefined;
}
//#endregion
//#region src/local/state-resolver.d.ts
type StateSubstitutionResult = {
  kind: 'literal';
  value: string | number | boolean;
} | {
  kind: 'unresolved';
  reason: string;
};
interface PseudoParameters {
  accountId?: string;
  region?: string;
  partition?: string;
  urlSuffix?: string;
}
interface CrossStackResolver {
  resolveImport(exportName: string): Promise<string | undefined>;
  resolveGetStackOutput(producerStack: string, producerRegion: string, outputName: string): Promise<string | undefined>;
}
interface SubstitutionContext {
  resources: Record<string, ResourceState>;
  parameters?: Record<string, string>;
  sensitiveParameters?: ReadonlySet<string>;
  onSensitiveParameterConsumed?: (logicalId: string) => void;
  pseudoParameters?: PseudoParameters;
  crossStackResolver?: CrossStackResolver;
  consumerRegion?: string;
}
declare function substituteAgainstState(value: unknown, contextOrResources: SubstitutionContext | Record<string, ResourceState>): StateSubstitutionResult;
declare function substituteAgainstStateAsync(value: unknown, contextOrResources: SubstitutionContext | Record<string, ResourceState>): Promise<StateSubstitutionResult>;
interface StateEnvSubstitutionAudit {
  resolvedKeys: string[];
  unresolved: Array<{
    key: string;
    reason: string;
  }>;
  sensitiveKeys: string[];
}
declare function substituteEnvVarsFromState(templateEnv: Record<string, unknown> | undefined, contextOrResources: SubstitutionContext | Record<string, ResourceState>): {
  env: Record<string, unknown>;
  audit: StateEnvSubstitutionAudit;
};
declare function substituteEnvVarsFromStateAsync(templateEnv: Record<string, unknown> | undefined, contextOrResources: SubstitutionContext | Record<string, ResourceState>): Promise<{
  env: Record<string, unknown>;
  audit: StateEnvSubstitutionAudit;
}>;
//#endregion
//#region src/local/ssm-parameter-resolver.d.ts
interface SsmParameterRef {
  logicalId: string;
  ssmName: string;
  isList: boolean;
}
interface ResolvedSsmParameters {
  values: Record<string, string>;
  secureStringLogicalIds: string[];
}
declare function collectSsmParameterRefs(template: Pick<CloudFormationTemplate, 'Parameters'> | undefined): SsmParameterRef[];
declare function resolveSsmParameters(client: SSMClient, refs: readonly SsmParameterRef[], label: string): Promise<ResolvedSsmParameters>;
//#endregion
//#region src/local/local-state-provider.d.ts
interface LocalStateRecord {
  resources: Record<string, ResourceState>;
  outputs: Record<string, string>;
  region: string;
}
interface LocalStateProvider {
  readonly label: string;
  load(stackName: string, synthRegion: string | undefined): Promise<LocalStateRecord | undefined>;
  buildCrossStackResolver(consumerRegion: string): Promise<CrossStackResolver | undefined>;
  resolveDeployedFunctionEnv?(functionPhysicalId: string): Promise<Record<string, string> | undefined>;
  resolveLambdaExecutionRoleArn?(functionPhysicalId: string): Promise<string | undefined>;
  resolveAgentCoreRuntimeRoleArn?(runtimePhysicalId: string): Promise<string | undefined>;
  resolveTemplateSsmParameters?(template: CloudFormationTemplate): Promise<ResolvedSsmParameters>;
  getLastLoadError?(): string | undefined;
  dispose(): void;
}
//#endregion
//#region src/cli/commands/local-state-source.d.ts
interface LocalStateSourceOptions {
  fromCfnStack?: string | boolean;
  region?: string;
  profile?: string;
  stackRegion?: string;
  [key: string]: unknown;
}
type LocalStateProviderFactory = (options: LocalStateSourceOptions) => LocalStateProvider;
type ExtraStateProviders = Record<string, LocalStateProviderFactory>;
declare function resolveCfnStackName(fromCfnStack: string | boolean, stackName: string): string;
declare function isCfnFlagPresent(opts: Pick<LocalStateSourceOptions, 'fromCfnStack'>): boolean;
declare function resolveCfnRegion(options: Pick<LocalStateSourceOptions, 'stackRegion' | 'region'>, synthRegion: string | undefined): string;
declare function resolveCfnFallbackRegion(options: Pick<LocalStateSourceOptions, 'fromCfnStack' | 'profile'>, synthRegion: string | undefined): Promise<string | undefined>;
declare class LocalStateSourceError extends Error {
  constructor(message: string);
}
declare function rejectExplicitCfnStackWithMultipleStacks(options: Pick<LocalStateSourceOptions, 'fromCfnStack'>, routedStackCount: number): void;
declare function createLocalStateProvider(options: LocalStateSourceOptions, stackName: string, synthRegion: string | undefined, extraStateProviders?: ExtraStateProviders): LocalStateProvider | undefined;
//#endregion
//#region src/local/embed-config.d.ts
interface CdkLocalEmbedConfig {
  cliName?: string;
  binaryName?: string;
  productName?: string;
  resourceNamePrefix?: string;
  awsBindMountPath?: string;
  envPrefix?: string;
  sigV4StrictByDefault?: boolean;
  sigV4OptFlag?: string;
}
interface ResolvedEmbedConfig {
  cliName: string;
  binaryName: string;
  productName: string;
  resourceNamePrefix: string;
  awsBindMountPath: string;
  envPrefix: string;
  sigV4StrictByDefault: boolean;
  sigV4OptFlag: string;
}
declare function setEmbedConfig(config?: CdkLocalEmbedConfig): void;
declare function getEmbedConfig(): ResolvedEmbedConfig;
declare function resetEmbedConfig(): void;
//#endregion
//#region src/synthesis/assembly-reader.d.ts
interface StackInfo {
  stackName: string;
  displayName: string;
  artifactId: string;
  template: CloudFormationTemplate;
  assetManifestPath?: string | undefined;
  dependencyNames: string[];
  region?: string | undefined;
  account?: string | undefined;
  terminationProtection?: boolean | undefined;
  nestedTemplates?: Record<string, string> | undefined;
}
//#endregion
//#region src/local/lambda-resolver.d.ts
type ResolvedLambda = ResolvedZipLambda | ResolvedImageLambda;
interface ResolvedLambdaBase {
  stack: StackInfo;
  logicalId: string;
  resource: TemplateResource;
  memoryMb: number;
  timeoutSec: number;
  layers: ResolvedLambdaLayer[];
  ephemeralStorageMb?: number;
}
type ResolvedLambdaLayer = ResolvedAssetLambdaLayer | ResolvedArnLambdaLayer;
interface ResolvedAssetLambdaLayer {
  kind: 'asset';
  logicalId: string;
  assetPath: string;
}
interface ResolvedArnLambdaLayer {
  kind: 'arn';
  logicalId: string;
  arn: string;
  region: string;
  accountId: string;
  name: string;
  version: string;
}
interface ResolvedZipLambda extends ResolvedLambdaBase {
  kind: 'zip';
  runtime: string;
  handler: string;
  codePath: string | null;
  inlineCode?: string;
}
interface ResolvedImageLambda extends ResolvedLambdaBase {
  kind: 'image';
  imageUri: string;
  imageConfig: {
    command?: string[];
    entryPoint?: string[];
    workingDirectory?: string;
  };
  architecture: 'x86_64' | 'arm64';
}
//#endregion
//#region src/cli/commands/local-invoke.d.ts
interface CreateLocalInvokeCommandOptions {
  extraStateProviders?: ExtraStateProviders;
  embedConfig?: CdkLocalEmbedConfig;
}
declare function createLocalInvokeCommand(opts?: CreateLocalInvokeCommandOptions): Command;
declare function addInvokeSpecificOptions(cmd: Command): Command;
//#endregion
//#region src/local/file-watcher.d.ts
interface FileWatcher {
  close(): Promise<void>;
}
interface FileWatcherOptions {
  paths: readonly string[];
  onChange: (changedPaths: readonly string[]) => void;
  debounceMs?: number;
  ignoreInitial?: boolean;
  ignored?: (path: string) => boolean;
  shouldTrigger?: (path: string) => boolean;
}
declare function createFileWatcher(options: FileWatcherOptions): FileWatcher;
//#endregion
//#region src/local/source-change-classifier.d.ts
interface ReloadAssetContext {
  oldAssetHash?: string;
  newAssetHash: string;
  newAssetSourceDir: string;
  dockerFile: string;
}
type ReloadVerdict = {
  kind: 'rebuild';
  reason: string;
} | {
  kind: 'soft-reload';
  reason: string;
  newAssetSourceDir: string;
};
declare function classifySourceChange(changedPaths: readonly string[], ctx: ReloadAssetContext | undefined): ReloadVerdict;
//#endregion
//#region src/local/intrinsic-image.d.ts
interface ImageResolutionContext {
  pseudoParameters?: {
    accountId?: string;
    region?: string;
    partition?: string;
    urlSuffix?: string;
  };
  stateResources?: Record<string, ResourceState>;
  stateParameters?: Record<string, string>;
  stateSensitiveParameters?: readonly string[];
  stateLoadFailureMessage?: string;
}
declare function formatStateRemedy(context: ImageResolutionContext | undefined): string;
declare function derivePseudoParametersFromRegion(region: string | undefined, accountId?: string): {
  accountId?: string;
  region: string;
  partition: string;
  urlSuffix: string;
} | undefined;
type FnJoinResolveOutcome = {
  kind: 'not-applicable';
} | {
  kind: 'resolved';
  uri: string;
} | {
  kind: 'needs-state';
  repoLogicalId: string;
} | {
  kind: 'unsupported-join';
  reason: string;
};
declare function tryResolveImageFnJoin(raw: unknown, resources: Record<string, TemplateResource>, context: ImageResolutionContext | undefined): FnJoinResolveOutcome;
declare function substituteImagePlaceholders(flat: string, resources: Record<string, TemplateResource>, context: ImageResolutionContext | undefined): string;
//#endregion
//#region src/local/agentcore-resolver.d.ts
declare const AGENTCORE_RUNTIME_TYPE = "AWS::BedrockAgentCore::Runtime";
declare const AGENTCORE_HTTP_PROTOCOL = "HTTP";
declare const AGENTCORE_MCP_PROTOCOL = "MCP";
declare const AGENTCORE_A2A_PROTOCOL = "A2A";
declare const AGENTCORE_AGUI_PROTOCOL = "AGUI";
interface ResolvedAgentCoreRuntime {
  stack: StackInfo;
  logicalId: string;
  resource: TemplateResource;
  containerUri?: string;
  codeArtifact?: AgentCoreCodeArtifact;
  environmentVariables: Record<string, unknown>;
  roleArn?: string;
  protocol: string;
  jwtAuthorizer?: AgentCoreJwtAuthorizer;
}
interface AgentCoreJwtAuthorizer {
  discoveryUrl: string;
  allowedAudience?: string[];
  allowedClients?: string[];
  allowedScopes?: string[];
  customClaims?: AgentCoreCustomClaim[];
}
interface AgentCoreCustomClaim {
  name: string;
  valueType: 'STRING' | 'STRING_ARRAY';
  operator: 'EQUALS' | 'CONTAINS' | 'CONTAINS_ANY';
  value: string | string[];
}
interface AgentCoreCodeArtifact {
  runtime: string;
  entryPoint: string[];
  codeAssetHash: string;
  s3Source?: {
    bucket?: string;
    bucketIntrinsic?: unknown;
    key: string;
    versionId?: string;
  };
}
declare class AgentCoreResolutionError extends Error {
  constructor(message: string);
}
declare function resolveAgentCoreTarget(target: string, stacks: StackInfo[], imageContext?: ImageResolutionContext): ResolvedAgentCoreRuntime;
declare function pickAgentCoreCandidateStack(target: string, stacks: StackInfo[]): StackInfo | undefined;
//#endregion
//#region src/local/agentcore-client.d.ts
declare const AGENTCORE_SESSION_ID_HEADER = "X-Amzn-Bedrock-AgentCore-Runtime-Session-Id";
interface AgentCoreInvokeResult {
  status: number;
  contentType: string | null;
  raw: string;
  streamed: boolean;
}
declare function waitForAgentCorePing(host: string, port: number, timeoutMs?: number): Promise<void>;
interface InvokeAgentCoreOptions {
  sessionId: string;
  timeoutMs: number;
  authorization?: string;
  additionalHeaders?: Record<string, string>;
  onChunk?: (text: string) => void;
}
declare function invokeAgentCore(host: string, port: number, event: unknown, options: InvokeAgentCoreOptions): Promise<AgentCoreInvokeResult>;
//#endregion
//#region src/local/agentcore-mcp-client.d.ts
declare const MCP_CONTAINER_PORT = 8000;
declare const MCP_PATH = "/mcp";
declare const MCP_PROTOCOL_VERSION = "2025-06-18";
interface McpJsonRpcRequest {
  method: string;
  params?: unknown;
}
interface McpInvokeResult {
  ok: boolean;
  raw: string;
}
interface McpInvokeOptions {
  readyTimeoutMs?: number;
  requestTimeoutMs?: number;
  fetchImpl?: typeof fetch;
}
declare function mcpInvokeOnce(host: string, port: number, request: McpJsonRpcRequest, options?: McpInvokeOptions): Promise<McpInvokeResult>;
declare function parseSseForJsonRpc(text: string, id: number): unknown;
//#endregion
//#region src/local/agentcore-a2a-client.d.ts
declare const A2A_CONTAINER_PORT = 9000;
declare const A2A_PATH = "/";
interface A2aJsonRpcRequest {
  method: string;
  params?: unknown;
}
interface A2aInvokeResult {
  ok: boolean;
  raw: string;
}
interface A2aInvokeOptions {
  readyTimeoutMs?: number;
  requestTimeoutMs?: number;
  fetchImpl?: typeof fetch;
}
declare function a2aInvokeOnce(host: string, port: number, request: A2aJsonRpcRequest, options?: A2aInvokeOptions): Promise<A2aInvokeResult>;
//#endregion
//#region src/local/agentcore-ws-client.d.ts
interface InvokeAgentCoreWsOptions {
  sessionId: string;
  onMessage: (text: string) => void;
  timeoutMs: number;
  authorization?: string;
  frameSource?: AsyncIterable<string>;
  abortSignal?: AbortSignal;
  webSocketImpl?: typeof WebSocket;
}
interface AgentCoreWsResult {
  frames: number;
}
declare function invokeAgentCoreWs(host: string, port: number, event: unknown, options: InvokeAgentCoreWsOptions): Promise<AgentCoreWsResult>;
//#endregion
//#region src/local/env-resolver.d.ts
interface EnvResolutionResult {
  resolved: Record<string, string>;
  unresolved: string[];
}
interface EnvOverrideFile {
  Parameters?: Record<string, string | null>;
  [logicalIdOrDisplayPath: string]: Record<string, string | null> | undefined;
}
declare function resolveEnvVars(logicalId: string, displayPath: string | undefined, templateEnv: Record<string, unknown> | undefined, overrides?: EnvOverrideFile): EnvResolutionResult;
//#endregion
//#region src/types/assets.d.ts
interface DockerImageAssetSource {
  directory?: string;
  executable?: string[];
  dockerFile?: string;
  dockerBuildTarget?: string;
  dockerBuildArgs?: Record<string, string>;
  dockerBuildContexts?: Record<string, string>;
  dockerBuildSsh?: string;
  dockerBuildSecrets?: Record<string, string>;
  networkMode?: string;
  platform?: string;
  dockerOutputs?: string[];
  cacheFrom?: DockerCacheOption[];
  cacheTo?: DockerCacheOption;
  cacheDisabled?: boolean;
}
interface DockerCacheOption {
  type: string;
  params?: Record<string, string>;
}
//#endregion
//#region src/cli/commands/local-invoke-agentcore.d.ts
interface CreateLocalInvokeAgentCoreCommandOptions {
  extraStateProviders?: ExtraStateProviders;
  embedConfig?: CdkLocalEmbedConfig;
}
declare function createLocalInvokeAgentCoreCommand(opts?: CreateLocalInvokeAgentCoreCommandOptions): Command;
declare function addInvokeAgentCoreSpecificOptions(cmd: Command): Command;
//#endregion
//#region src/utils/profile-resolver.d.ts
declare function resolveProfileCredentials(profile: string): Promise<{
  accessKeyId: string;
  secretAccessKey: string;
  sessionToken?: string;
  region?: string;
}>;
declare function buildStsClientConfig(args: {
  region?: string | undefined;
  profile?: string | undefined;
}): {
  region?: string;
  profile?: string;
};
//#endregion
//#region src/cli/config-loader.d.ts
interface CdkWatchConfig {
  include: string[];
  exclude: string[];
}
declare function resolveWatchConfig(): CdkWatchConfig;
//#endregion
//#region src/local/httpv2-service-integration.d.ts
type SupportedSubtype = 'EventBridge-PutEvents' | 'SQS-SendMessage' | 'SQS-ReceiveMessage' | 'SQS-DeleteMessage' | 'SQS-PurgeQueue' | 'Kinesis-PutRecord' | 'StepFunctions-StartExecution' | 'StepFunctions-StartSyncExecution' | 'StepFunctions-StopExecution' | 'AppConfig-GetConfiguration';
//#endregion
//#region src/local/container-pool.d.ts
interface ContainerHandle {
  logicalId: string;
  containerId: string;
  containerName: string;
  hostPort: number;
  containerHost: string;
  stopLogStream: () => void;
}
interface ContainerPool {
  acquire(logicalId: string): Promise<ContainerHandle>;
  release(handle: ContainerHandle): void;
  dispose(): Promise<void>;
}
//#endregion
//#region src/local/vtl-engine.d.ts
declare class VtlEvaluationError extends Error {
  constructor(message: string);
}
//#endregion
//#region src/local/integration-response-selector.d.ts
interface IntegrationResponseEntry {
  StatusCode: string;
  SelectionPattern?: string;
  ResponseParameters?: Record<string, string>;
  ResponseTemplates?: Record<string, string>;
  ContentHandling?: string;
}
interface SelectedIntegrationResponse {
  entry: IntegrationResponseEntry | null;
  statusCode: number;
}
declare function selectIntegrationResponse(entries: IntegrationResponseEntry[] | undefined, matchTarget: string, fallbackStatusCode?: number): SelectedIntegrationResponse;
declare function tryParseStatus(raw: unknown): number | undefined;
declare function evaluateResponseParameters(responseParameters: Record<string, string> | undefined, opts?: {
  onUnsupported?: (key: string, value: string, reason: string) => void;
}): Record<string, string>;
declare function pickResponseTemplate(responseTemplates: Record<string, string> | undefined, accept: string | undefined): {
  template: string;
  contentType: string;
} | undefined;
//#endregion
//#region src/local/rest-v1-integrations.d.ts
interface MockIntegrationConfig {
  kind: 'mock';
  requestTemplate: string | undefined;
  responses: IntegrationResponseEntry[];
}
interface HttpProxyIntegrationConfig {
  kind: 'http-proxy';
  uri: string;
  integrationHttpMethod?: string;
  requestParameters?: Record<string, string>;
  responses: IntegrationResponseEntry[];
}
interface HttpIntegrationConfig {
  kind: 'http';
  uri: string;
  integrationHttpMethod?: string;
  requestParameters?: Record<string, string>;
  requestTemplates?: Record<string, string>;
  responses: IntegrationResponseEntry[];
}
interface AwsLambdaIntegrationConfig {
  kind: 'aws-lambda';
  lambdaLogicalId: string;
  requestTemplates?: Record<string, string>;
  responses: IntegrationResponseEntry[];
}
//#endregion
//#region src/local/route-discovery.d.ts
type RestV1IntegrationConfig = MockIntegrationConfig | HttpProxyIntegrationConfig | HttpIntegrationConfig | AwsLambdaIntegrationConfig;
interface DiscoveredRoute {
  method: string;
  pathPattern: string;
  lambdaLogicalId: string;
  source: 'http-api' | 'rest-v1' | 'function-url';
  apiVersion: 'v1' | 'v2';
  stage: string;
  apiLogicalId?: string;
  apiStackName?: string;
  apiCdkPath?: string;
  stageVariables?: Record<string, string> | null;
  invokeMode?: 'BUFFERED' | 'RESPONSE_STREAM';
  unsupported?: {
    reason: string;
  };
  mockCors?: {
    statusCode: number;
    headers: Record<string, string>;
  };
  serviceIntegration?: {
    subtype: SupportedSubtype;
    requestParameters: Readonly<Record<string, unknown>>;
    responseParameters?: Readonly<Record<string, Readonly<Record<string, string>>>>;
  };
  restV1Integration?: RestV1IntegrationConfig;
  declaredAt: string;
}
declare function discoverRoutes(stacks: readonly StackInfo[]): DiscoveredRoute[];
//#endregion
//#region src/local/websocket-route-discovery.d.ts
interface DiscoveredWebSocketApi {
  apiLogicalId: string;
  apiStackName: string;
  declaredAt: string;
  apiCdkPath?: string;
  routeSelectionExpression: string;
  stage: string;
  routes: WebSocketRouteEntry[];
  unsupported?: {
    reason: string;
  };
}
interface WebSocketRouteEntry {
  routeKey: string;
  targetLambdaLogicalId: string;
  lambdaStackName: string;
  declaredAt: string;
}
declare function discoverWebSocketApis(stacks: readonly StackInfo[]): {
  apis: DiscoveredWebSocketApi[];
  errors: string[];
};
declare function discoverWebSocketApisOrThrow(stacks: readonly StackInfo[]): DiscoveredWebSocketApi[];
declare function parseSelectionExpressionPath(expr: string): string[];
declare function webSocketApiMatchesIdentifier(api: DiscoveredWebSocketApi, identifier: string): boolean;
declare function filterWebSocketApisByIdentifiers(apis: readonly DiscoveredWebSocketApi[], identifiers: readonly string[]): DiscoveredWebSocketApi[];
declare function availableWebSocketApiIdentifiers(apis: readonly DiscoveredWebSocketApi[]): string[];
//#endregion
//#region src/local/cors-handler.d.ts
interface CorsConfig {
  AllowOrigins: string[];
  AllowMethods: string[];
  AllowHeaders: string[];
  ExposeHeaders: string[];
  MaxAge?: number;
  AllowCredentials?: boolean;
}
declare function buildCorsConfigByApiId(template: CloudFormationTemplate): Map<string, CorsConfig>;
declare function buildCorsConfigFromCloudFrontChain(template: CloudFormationTemplate): Map<string, CorsConfig>;
declare function isFunctionUrlOacFronted(template: CloudFormationTemplate, fnUrlLogicalId: string): boolean;
interface PreflightResponse {
  statusCode: number;
  headers: Record<string, string>;
}
declare function matchPreflight(req: {
  method: string;
  headers: Record<string, string[]>;
}, config: CorsConfig): PreflightResponse | null;
declare function applyCorsResponseHeaders(res: ServerResponse, apiLogicalId: string | undefined, corsConfigByApiId: Map<string, CorsConfig>, requestOrigin: string | undefined): void;
//#endregion
//#region src/local/authorizer-resolver.d.ts
interface LambdaTokenAuthorizer {
  kind: 'lambda-token';
  logicalId: string;
  lambdaLogicalId: string;
  tokenHeader: string;
  resultTtlSeconds: number;
  declaredAt: string;
}
interface LambdaRequestAuthorizer {
  kind: 'lambda-request';
  logicalId: string;
  lambdaLogicalId: string;
  identitySources: ReadonlyArray<IdentitySourceSelector>;
  resultTtlSeconds: number;
  apiVersion: 'v1' | 'v2';
  declaredAt: string;
}
interface CognitoPoolRef {
  userPoolArn: string;
  region: string;
  userPoolId: string;
}
interface CognitoUserPoolAuthorizer {
  kind: 'cognito';
  logicalId: string;
  pools: ReadonlyArray<CognitoPoolRef>;
  userPoolArn: string;
  region: string;
  userPoolId: string;
  declaredAt: string;
}
interface JwtAuthorizer {
  kind: 'jwt';
  logicalId: string;
  issuer: string;
  audience: ReadonlyArray<string>;
  region?: string;
  userPoolId?: string;
  declaredAt: string;
}
interface IamAuthorizer {
  kind: 'iam';
  logicalId: 'AWS_IAM';
  declaredAt: string;
  oacFronted?: boolean;
}
type AuthorizerInfo = LambdaTokenAuthorizer | LambdaRequestAuthorizer | CognitoUserPoolAuthorizer | JwtAuthorizer | IamAuthorizer;
type IdentitySourceSelector = {
  kind: 'header';
  name: string;
} | {
  kind: 'query';
  name: string;
} | {
  kind: 'context';
  name: string;
} | {
  kind: 'stage-variable';
  name: string;
};
interface RouteWithAuth {
  route: DiscoveredRoute;
  authorizer?: AuthorizerInfo;
}
declare function attachAuthorizers(stacks: readonly StackInfo[], routes: readonly DiscoveredRoute[]): RouteWithAuth[];
//#endregion
//#region src/local/authorizer-cache.d.ts
interface CachedAuthorizerResult {
  allow: boolean;
  principalId?: string;
  context?: Record<string, unknown>;
  policy?: unknown;
}
interface AuthorizerCache {
  get(authorizerLogicalId: string, identityHash: string): CachedAuthorizerResult | undefined;
  set(authorizerLogicalId: string, identityHash: string, ttlSeconds: number, result: CachedAuthorizerResult): void;
  clear(): void;
  size(): number;
}
declare function createAuthorizerCache(opts?: {
  now?: () => number;
}): AuthorizerCache;
//#endregion
//#region src/local/cognito-jwt.d.ts
interface JwksKey {
  kid: string;
  n: string;
  e: string;
  alg?: string;
  kty: string;
  use?: string;
}
interface JwksCacheEntry {
  byKid: Map<string, JwksKey>;
  expiresAt: number;
  passThrough: boolean;
}
interface JwksCache {
  fetchAndCache(jwksUrl: string): Promise<JwksCacheEntry>;
  peek(jwksUrl: string): JwksCacheEntry | undefined;
  clear(): void;
}
type WarnedAt = Map<string, number>;
declare function createJwksCache(opts?: {
  fetchImpl?: (url: string) => Promise<{
    ok: boolean;
    status: number;
    text: () => Promise<string>;
  }>;
  now?: () => number;
  ttlMs?: number;
  failureTtlMs?: number;
}): JwksCache;
declare function buildCognitoJwksUrl(region: string, userPoolId: string): string;
declare function buildJwksUrlFromIssuer(issuer: string): string;
declare function verifyCognitoJwt(authorizer: CognitoUserPoolAuthorizer, authorizationHeader: string | undefined, jwksCache: JwksCache, opts?: {
  now?: () => number;
  warnedAt?: WarnedAt;
}): Promise<CachedAuthorizerResult & {
  identityHash: string | undefined;
  ttlSeconds: number;
}>;
declare function verifyJwtAuthorizer(authorizer: JwtAuthorizer, authorizationHeader: string | undefined, jwksCache: JwksCache, opts?: {
  now?: () => number;
  warnedAt?: WarnedAt;
}): Promise<CachedAuthorizerResult & {
  identityHash: string | undefined;
  ttlSeconds: number;
}>;
interface DiscoveryJwtAuthorizer {
  discoveryUrl: string;
  allowedAudience?: readonly string[];
  allowedClients?: readonly string[];
  allowedScopes?: readonly string[];
  customClaims?: readonly JwtCustomClaim[];
}
interface JwtCustomClaim {
  name: string;
  valueType: 'STRING' | 'STRING_ARRAY';
  operator: 'EQUALS' | 'CONTAINS' | 'CONTAINS_ANY';
  value: string | string[];
}
declare function verifyJwtViaDiscovery(authorizer: DiscoveryJwtAuthorizer, authorizationHeader: string | undefined, jwksCache: JwksCache, opts?: {
  now?: () => number;
  warnedAt?: WarnedAt;
  fetchImpl?: (url: string) => Promise<{
    ok: boolean;
    status: number;
    text: () => Promise<string>;
  }>;
}): Promise<CachedAuthorizerResult & {
  identityHash: string | undefined;
  ttlSeconds: number;
}>;
//#endregion
//#region src/local/sigv4-verify.d.ts
interface ResolvedCredentials {
  accessKeyId: string;
  secretAccessKey: string;
  sessionToken?: string | undefined;
}
type CredentialsLoader = () => Promise<ResolvedCredentials>;
declare function defaultCredentialsLoader(): CredentialsLoader;
//#endregion
//#region src/local/http-server.d.ts
interface ServerState {
  routes: readonly RouteWithAuth[];
  pool: ContainerPool;
  corsConfigByApiId: Map<string, CorsConfig>;
}
interface StartApiServerOptions {
  state: ServerState;
  rieTimeoutMs: number;
  host: string;
  port: number;
  authorizerCache?: AuthorizerCache;
  jwksCache?: JwksCache;
  jwksWarnedAt?: WarnedAt;
  mtls?: MtlsServerConfig;
  sigV4CredentialsLoader?: CredentialsLoader;
  sigV4WarnedForeignIds?: Set<string>;
  sigV4Strict?: boolean;
  defaultRegion?: string;
  preDispatch?: (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
}
interface MtlsServerConfig {
  caPem: Buffer;
  certPem: Buffer;
  keyPem: Buffer;
}
interface StartedApiServer {
  port: number;
  host: string;
  scheme: 'http' | 'https';
  server: Server;
  close: () => Promise<void>;
  setServerState: (next: ServerState) => ServerState;
  getServerState: () => ServerState;
}
declare function startApiServer(opts: StartApiServerOptions): Promise<StartedApiServer>;
declare function readMtlsMaterialsFromDisk(opts: {
  truststorePath: string;
  certPath: string;
  keyPath: string;
}): MtlsServerConfig;
//#endregion
//#region src/cli/commands/local-start-api.d.ts
interface CreateLocalStartApiCommandOptions {
  extraStateProviders?: ExtraStateProviders;
  embedConfig?: CdkLocalEmbedConfig;
}
interface WatchPredicates {
  ignored: (absPath: string) => boolean;
  shouldTrigger: (absPath: string) => boolean;
  excludePatterns: string[];
}
declare function createWatchPredicates(args: {
  watchRoot: string;
  output: string;
  watchConfig: CdkWatchConfig;
}): WatchPredicates;
interface ApiTargetSubset {
  readonly filtered: RouteWithAuth[];
  readonly filteredWebSocketApis: DiscoveredWebSocketApi[];
  readonly unmatched: string[];
}
declare function resolveApiTargetSubset(routes: readonly RouteWithAuth[], identifiers: readonly string[], stackNames: readonly string[], webSocketApis?: readonly DiscoveredWebSocketApi[]): ApiTargetSubset;
declare function createLocalStartApiCommand(opts?: CreateLocalStartApiCommandOptions): Command;
declare function addStartApiSpecificOptions(cmd: Command): Command;
//#endregion
//#region src/local/ecs-task-resolver.d.ts
interface ResolvedEcsTask {
  stack: StackInfo;
  taskDefinitionLogicalId: string;
  resource: TemplateResource;
  family: string;
  networkMode: 'bridge' | 'awsvpc' | 'host' | 'none';
  taskRoleArn?: string;
  executionRoleArn?: string;
  containers: ResolvedEcsContainer[];
  volumes: ResolvedEcsVolume[];
  runtimePlatform?: {
    cpuArchitecture: 'X86_64' | 'ARM64';
    operatingSystemFamily: 'LINUX';
  };
  warnings: string[];
}
interface ResolvedEcsContainer {
  name: string;
  image: ResolvedEcsImage;
  command?: string[];
  entryPoint?: string[];
  workingDirectory?: string;
  environment: Record<string, string>;
  sensitiveEnvKeys: string[];
  secrets: {
    name: string;
    valueFrom: string;
  }[];
  portMappings: {
    name?: string;
    containerPort: number;
    hostPort?: number;
    protocol: 'tcp' | 'udp';
  }[];
  mountPoints: {
    sourceVolume: string;
    containerPath: string;
    readOnly: boolean;
  }[];
  dependsOn: {
    containerName: string;
    condition: 'START' | 'COMPLETE' | 'SUCCESS' | 'HEALTHY';
  }[];
  links: string[];
  essential: boolean;
  healthCheck?: {
    command: string[];
    interval?: number;
    timeout?: number;
    retries?: number;
    startPeriod?: number;
  };
  user?: string;
  privileged?: boolean;
  readonlyRootFilesystem?: boolean;
  ulimits: {
    name: string;
    softLimit: number;
    hardLimit: number;
  }[];
  warnings: string[];
}
type ResolvedEcsImage = {
  kind: 'cdk-asset';
  assetHash?: string;
} | {
  kind: 'ecr';
  uri: string;
  account: string;
  region: string;
} | {
  kind: 'public';
  uri: string;
};
interface ResolvedEcsVolume {
  name: string;
  kind: 'host' | 'docker';
  hostPath?: string;
  dockerVolumeConfig?: {
    scope: 'task' | 'shared';
    autoprovision?: boolean;
    driver?: string;
    driverOpts?: Record<string, string>;
    labels?: Record<string, string>;
  };
}
declare class EcsTaskResolutionError extends Error {
  constructor(message: string);
}
type EcsImageResolutionContext = ImageResolutionContext;
//#endregion
//#region src/cli/commands/local-run-task.d.ts
interface CreateLocalRunTaskCommandOptions {
  extraStateProviders?: ExtraStateProviders;
  embedConfig?: CdkLocalEmbedConfig;
}
declare function createLocalRunTaskCommand(opts?: CreateLocalRunTaskCommandOptions): Command;
declare function addRunTaskSpecificOptions(cmd: Command): Command;
//#endregion
//#region src/utils/error-handler.d.ts
declare class CdkLocalError extends Error {
  readonly code: string;
  readonly cause: Error | undefined;
  constructor(message: string, code: string, cause?: Error);
}
declare class LocalInvokeBuildError extends CdkLocalError {
  constructor(message: string, cause?: Error);
}
//#endregion
//#region src/local/target-lister.d.ts
interface TargetEntry {
  logicalId: string;
  stackName: string;
  qualifiedId: string;
  displayPath?: string;
  kind?: string;
}
interface TargetListing {
  lambdas: TargetEntry[];
  apis: TargetEntry[];
  ecsServices: TargetEntry[];
  ecsTaskDefinitions: TargetEntry[];
  agentCoreRuntimes: TargetEntry[];
  loadBalancers: TargetEntry[];
  cloudFrontDistributions: TargetEntry[];
}
declare function listTargets(stacks: readonly StackInfo[]): TargetListing;
declare function countTargets(listing: TargetListing): number;
//#endregion
//#region src/local/ecs-service-resolver.d.ts
interface ResolvedServiceConnect {
  namespaceName: string;
  services: ReadonlyArray<{
    portName: string;
    containerPort: number;
    discoveryName: string;
    clientAliases: ReadonlyArray<{
      dnsName?: string;
      port: number;
    }>;
  }>;
}
interface ResolvedServiceRegistry {
  cloudMapServiceLogicalId: string;
  containerName?: string;
  containerPort?: number;
}
interface ResolvedEcsService {
  stack: StackInfo;
  serviceLogicalId: string;
  resource: TemplateResource;
  serviceName: string;
  serviceDisplayName: string;
  desiredCount: number;
  healthCheckGracePeriodSeconds: number;
  task: ResolvedEcsTask;
  serviceConnect?: ResolvedServiceConnect;
  serviceRegistries: ReadonlyArray<ResolvedServiceRegistry>;
  warnings: string[];
}
//#endregion
//#region src/local/cloud-map-registry.d.ts
interface RegisteredEndpoint {
  ip: string;
  port: number;
  ownerKey: string;
}
interface RegistrationHandle {
  readonly fqdn: string;
  readonly ownerKey: string;
}
interface RegistryListing {
  namespace: string;
  discoveryName: string;
  endpoints: ReadonlyArray<RegisteredEndpoint>;
  isAlias: boolean;
}
declare class CloudMapRegistry {
  private readonly byFqdn;
  private readonly aliasIndex;
  register(namespace: string, discoveryName: string, endpoint: RegisteredEndpoint): RegistrationHandle;
  registerAlias(alias: string, targetFqdn: string): void;
  unregister(handle: RegistrationHandle): boolean;
  unregisterByOwner(ownerKeyPrefix: string): number;
  lookup(namespace: string, discoveryName: string): ReadonlyArray<RegisteredEndpoint> | undefined;
  lookupAlias(alias: string): ReadonlyArray<RegisteredEndpoint> | undefined;
  buildAddHostFlags(excludeOwnerKeyPrefix?: string): string[];
  list(): ReadonlyArray<RegistryListing>;
  isEmpty(): boolean;
}
//#endregion
//#region src/local/cloud-map-resolver.d.ts
interface ResolvedCloudMapNamespace {
  logicalId: string;
  name: string;
}
interface ResolvedCloudMapService {
  logicalId: string;
  namespaceLogicalId: string;
  namespaceName: string;
  name: string;
  dnsRecords: ReadonlyArray<{
    type: 'A' | 'SRV';
    ttlSeconds: number;
  }>;
}
interface CloudMapIndex {
  namespacesByLogicalId: Map<string, ResolvedCloudMapNamespace>;
  namespacesByName: Map<string, ResolvedCloudMapNamespace>;
  servicesByLogicalId: Map<string, ResolvedCloudMapService>;
  warnings: string[];
}
declare function buildCloudMapIndex(stack: StackInfo): CloudMapIndex;
//#endregion
//#region src/local/ecs-service-runner.d.ts
declare const SOFT_RELOAD_COMPLETION_LOG_SUFFIX = "restart + TCP-ready probe complete; Cloud Map + front-door re-published.";
declare const DEFAULT_SHADOW_READY_TIMEOUT_MS = 60000;
declare function setShadowReadyTimeoutMs(timeoutMs: number): void;
//#endregion
//#region src/local/alb-path-matcher.d.ts
interface AlbHttpHeaderCondition {
  name: string;
  values: readonly string[];
}
interface AlbQueryStringCondition {
  key?: string;
  value: string;
}
//#endregion
//#region src/local/elb-front-door-resolver.d.ts
type FrontDoorForwardTarget = FrontDoorEcsTarget | FrontDoorLambdaTarget;
interface FrontDoorEcsTarget {
  kind: 'ecs';
  serviceLogicalId: string;
  targetContainerName: string;
  targetContainerPort: number;
  targetGroupLogicalId: string;
  weight: number;
}
interface FrontDoorLambdaTarget {
  kind: 'lambda';
  lambdaLogicalId: string;
  targetGroupLogicalId: string;
  multiValueHeaders: boolean;
  weight: number;
}
interface FrontDoorRedirectAction {
  kind: 'redirect';
  statusCode: 301 | 302;
  protocol?: string;
  host?: string;
  port?: string;
  path?: string;
  query?: string;
}
interface FrontDoorFixedResponseAction {
  kind: 'fixed-response';
  statusCode: number;
  contentType?: string;
  messageBody?: string;
}
interface FrontDoorForwardAction {
  kind: 'forward';
  targets: FrontDoorForwardTarget[];
}
interface FrontDoorAuthGuard {
  kind: 'authenticate-cognito' | 'authenticate-oidc';
  issuer: string;
  audience: string;
  region?: string;
  userPoolId?: string;
  sessionCookieName: string;
  label: string;
}
type ResolvedListenerAction = FrontDoorForwardAction | FrontDoorRedirectAction | FrontDoorFixedResponseAction;
interface ResolvedListenerRule {
  priority: number;
  pathPatterns: string[];
  hostPatterns: string[];
  httpHeaderConditions: AlbHttpHeaderCondition[];
  httpRequestMethods: string[];
  queryStringConditions: AlbQueryStringCondition[];
  sourceIpCidrs: string[];
  action: ResolvedListenerAction;
  authGuard?: FrontDoorAuthGuard;
}
interface ResolvedListenerFrontDoor {
  listenerPort: number;
  listenerProtocol: 'HTTP' | 'HTTPS';
  listenerLogicalId: string;
  defaultAction?: ResolvedListenerAction;
  defaultAuthGuard?: FrontDoorAuthGuard;
  rules: ResolvedListenerRule[];
}
interface AlbFrontDoorResolution {
  listeners: ResolvedListenerFrontDoor[];
  warnings: string[];
}
declare function resolveAlbFrontDoor(stack: StackInfo, albLogicalId: string): AlbFrontDoorResolution;
declare function isApplicationLoadBalancer(resource: TemplateResource): boolean;
//#endregion
//#region src/cli/commands/ecs-service-emulator.d.ts
interface EcsServiceEmulatorOptions {
  app?: string;
  output: string;
  verbose: boolean;
  region?: string;
  profile?: string;
  roleArn?: string;
  context?: string[];
  cluster: string;
  envVars?: string;
  containerHost: string;
  assumeTaskRole?: string | boolean;
  assumeRole?: string | boolean;
  pull: boolean;
  build: boolean;
  ecrRoleArn?: string;
  hostPort?: string[];
  lbPort?: string[];
  tls?: boolean;
  tlsCert?: string;
  tlsKey?: string;
  verifyAuth?: boolean;
  bearerToken?: string;
  platform?: string;
  maxTasks: number;
  restartPolicy: 'on-failure' | 'always' | 'none';
  fromCfnStack?: string | boolean;
  stackRegion?: string;
  watch?: boolean;
  logs?: boolean;
  imageOverride?: string[];
  imageBuildArg?: string[];
  imageBuildSecret?: string[];
  imageTarget?: string[];
  interactiveOverrides?: boolean;
  strictOverrides?: boolean;
  shadowReadyTimeout?: number;
  [key: string]: unknown;
}
interface ServiceBoot {
  target: string;
}
type PlannedForwardTarget = PlannedEcsForwardTarget | PlannedLambdaForwardTarget;
interface PlannedEcsForwardTarget {
  kind: 'ecs';
  serviceTarget: string;
  targetContainerName: string;
  targetContainerPort: number;
  weight: number;
}
interface PlannedLambdaForwardTarget {
  kind: 'lambda';
  lambda: ResolvedLambda;
  targetGroupArn: string;
  multiValueHeaders: boolean;
  weight: number;
}
interface PlannedForwardAction {
  kind: 'forward';
  targets: PlannedForwardTarget[];
}
interface PlannedRedirectAction {
  kind: 'redirect';
  statusCode: 301 | 302;
  protocol?: string;
  host?: string;
  port?: string;
  path?: string;
  query?: string;
}
interface PlannedFixedResponseAction {
  kind: 'fixed-response';
  statusCode: number;
  contentType?: string;
  messageBody?: string;
}
type PlannedAction = PlannedForwardAction | PlannedRedirectAction | PlannedFixedResponseAction;
interface PlannedFrontDoorListener {
  listenerPort: number;
  hostPort: number;
  protocol: 'HTTP' | 'HTTPS';
  defaultAction?: PlannedAction;
  defaultAuthGuard?: FrontDoorAuthGuard;
  rules: Array<{
    priority: number;
    pathPatterns: string[];
    hostPatterns: string[];
    httpHeaderConditions: AlbHttpHeaderCondition[];
    httpRequestMethods: string[];
    queryStringConditions: AlbQueryStringCondition[];
    sourceIpCidrs: string[];
    action: PlannedAction;
    authGuard?: FrontDoorAuthGuard;
  }>;
}
interface FrontDoorPlan {
  listeners: PlannedFrontDoorListener[];
}
interface EmulatorStrategy {
  pickEntries(stacks: StackInfo[]): TargetEntry[];
  pickerMessage: string;
  pickerNoun: string;
  onMissing(): CdkLocalError;
  resolveBoots(stacks: StackInfo[], chosenTargets: string[]): {
    boots: ServiceBoot[];
    frontDoor?: FrontDoorPlan;
    warnings: string[];
  };
  lbPortOverrides: Record<number, number>;
  suppressLoadBalancerWarning?: boolean;
  supportsWatch?: boolean;
}
declare function runEcsServiceEmulator(targets: string[], options: EcsServiceEmulatorOptions, strategy: EmulatorStrategy, extraStateProviders: ExtraStateProviders | undefined): Promise<void>;
declare function buildEcsImageResolutionContext(target: string, stacks: StackInfo[], options: EcsServiceEmulatorOptions, stateProvider: LocalStateProvider | undefined): Promise<EcsImageResolutionContext | undefined>;
declare const MAX_TASKS_SUBNET_RANGE_CAP = 83;
declare function parseMaxTasks(raw: string): number;
declare function parseRestartPolicy(raw: string): 'on-failure' | 'always' | 'none';
declare function resolveSharedSidecarCredentials(options: {
  profile?: string;
}): Promise<{
  accessKeyId: string;
  secretAccessKey: string;
  sessionToken?: string;
} | undefined>;
declare function ecsClusterOption(): Option;
declare function addEcsAssumeRoleOptions(cmd: Command): Command;
declare function resolveEcsAssumeRoleOption(options: {
  assumeTaskRole?: string | boolean;
  assumeRole?: string | boolean;
}): string | boolean | undefined;
declare function addCommonEcsServiceOptions(cmd: Command): Command;
declare function addImageOverrideOptions(cmd: Command): Command;
//#endregion
//#region src/cli/commands/local-start-service.d.ts
interface CreateLocalStartServiceCommandOptions {
  extraStateProviders?: ExtraStateProviders;
  embedConfig?: CdkLocalEmbedConfig;
}
declare function serviceStrategy(): EmulatorStrategy;
declare function createLocalStartServiceCommand(opts?: CreateLocalStartServiceCommandOptions): Command;
declare function addStartServiceSpecificOptions(cmd: Command): Command;
//#endregion
//#region src/cli/commands/local-start-alb.d.ts
interface CreateLocalStartAlbCommandOptions {
  extraStateProviders?: ExtraStateProviders;
  embedConfig?: CdkLocalEmbedConfig;
}
declare function parseLbPortOverrides(values: string[] | undefined): Record<number, number>;
declare function resolveAlbTarget(target: string, stacks: StackInfo[]): {
  stack: StackInfo;
  albLogicalId: string;
};
declare function albStrategy(options: EcsServiceEmulatorOptions): EmulatorStrategy;
declare function createLocalStartAlbCommand(opts?: CreateLocalStartAlbCommandOptions): Command;
declare function addAlbSpecificOptions(cmd: Command): Command;
//#endregion
//#region src/local/cloudfront-function-runtime.d.ts
interface CfValue {
  value: string;
  multiValue?: Array<{
    value: string;
  }>;
}
interface CfRequest {
  method: string;
  uri: string;
  querystring: Record<string, CfValue>;
  headers: Record<string, CfValue>;
  cookies: Record<string, CfValue>;
}
interface CfResponse {
  statusCode: number;
  statusDescription?: string;
  headers: Record<string, CfValue>;
  cookies?: Record<string, CfValue>;
  body?: string | {
    encoding?: 'text' | 'base64';
    data?: string;
  };
}
interface CfViewerRequestEvent {
  version: '1.0';
  context: {
    distributionDomainName: string;
    distributionId: string;
    eventType: string;
    requestId: string;
  };
  viewer: {
    ip: string;
  };
  request: CfRequest;
}
interface CfViewerResponseEvent extends CfViewerRequestEvent {
  response: CfResponse;
}
interface CompiledCloudFrontFunction {
  logicalId: string;
  runtime: string;
  script: vm.Script;
}
declare function compileCloudFrontFunction(logicalId: string, code: string, runtime: string): CompiledCloudFrontFunction;
type ViewerRequestOutcome = {
  kind: 'continue';
  request: CfRequest;
} | {
  kind: 'response';
  response: CfResponse;
};
declare function runViewerRequest(fn: CompiledCloudFrontFunction, event: CfViewerRequestEvent): Promise<ViewerRequestOutcome>;
declare function runViewerResponse(fn: CompiledCloudFrontFunction, event: CfViewerResponseEvent): Promise<CfResponse>;
//#endregion
//#region src/local/cloudfront-static-origin.d.ts
interface ResolvedCustomErrorResponse {
  errorCode: number;
  responsePagePath?: string;
  responseCode?: number;
}
interface StaticOriginResult {
  statusCode: number;
  headers: Record<string, string>;
  body: Buffer;
}
declare function serveFromStaticOrigin(input: {
  localDirs: readonly string[];
  uri: string;
  defaultRootObject?: string;
  customErrorResponses?: readonly ResolvedCustomErrorResponse[];
}): StaticOriginResult;
//#endregion
//#region src/local/cloudfront-resolver.d.ts
interface ResolvedCloudFrontFunction extends CompiledCloudFrontFunction {}
interface ResolvedBehavior {
  pathPattern?: string;
  targetOriginId: string;
  viewerProtocolPolicy?: string;
  viewerRequest?: ResolvedCloudFrontFunction;
  viewerResponse?: ResolvedCloudFrontFunction;
  hasLambdaEdge: boolean;
  cors?: CorsConfig;
}
type ResolvedOrigin = {
  kind: 's3';
  originId: string;
  localDirs: string[];
} | {
  kind: 's3-unresolved';
  originId: string;
  bucketLogicalId?: string;
} | {
  kind: 'lambda-url';
  originId: string;
  functionLogicalId: string;
  functionUrlLogicalId: string;
} | {
  kind: 'custom';
  originId: string;
  domainName: string;
};
interface ResolvedDistribution {
  logicalId: string;
  stackName: string;
  defaultRootObject?: string;
  behaviors: ResolvedBehavior[];
  origins: Map<string, ResolvedOrigin>;
  customErrorResponses: ResolvedCustomErrorResponse[];
}
declare const CLOUDFRONT_DISTRIBUTION_TYPE = "AWS::CloudFront::Distribution";
declare function resolveCloudFrontDistribution(args: {
  stack: StackInfo;
  logicalId: string;
  originOverrides?: Map<string, string>;
}): ResolvedDistribution;
declare function pickFunctionUrlLogicalIdFromOrigin(value: unknown): string | undefined;
declare function pickTargetFunctionLogicalId(value: unknown): string | undefined;
declare function isCloudFrontDistribution(resource: TemplateResource): boolean;
//#endregion
//#region src/local/front-door-tls.d.ts
interface FrontDoorTlsMaterials {
  certPem: Buffer;
  keyPem: Buffer;
}
//#endregion
//#region src/local/cloudfront-server.d.ts
type LambdaUrlInvokerMap = Map<string, (event: Record<string, unknown>) => Promise<unknown>>;
interface StartedCloudFrontServer {
  url: string;
  port: number;
  scheme: 'http' | 'https';
  update(distribution: ResolvedDistribution): void;
  close(): Promise<void>;
}
interface StartCloudFrontServerOptions {
  distribution: ResolvedDistribution;
  host: string;
  port: number;
  tls?: FrontDoorTlsMaterials;
  lambdaInvokers?: LambdaUrlInvokerMap;
}
declare function startCloudFrontServer(options: StartCloudFrontServerOptions): Promise<StartedCloudFrontServer>;
declare function matchBehavior(behaviors: readonly ResolvedBehavior[], uri: string): ResolvedBehavior | undefined;
//#endregion
//#region src/cli/commands/local-start-cloudfront.d.ts
declare class LocalStartCloudFrontError extends CdkLocalError {
  constructor(message: string, cause?: Error);
}
interface CreateLocalStartCloudFrontCommandOptions {
  embedConfig?: CdkLocalEmbedConfig;
}
declare function parseOriginOverrides(values: string[] | undefined): Map<string, string>;
declare function resolveCloudFrontTarget(target: string, stacks: StackInfo[]): {
  stack: StackInfo;
  logicalId: string;
};
declare function createLocalStartCloudFrontCommand(opts?: CreateLocalStartCloudFrontCommandOptions): Command;
declare function addStartCloudFrontSpecificOptions(cmd: Command): Command;
//#endregion
//#region src/cli/commands/local-list.d.ts
interface CreateLocalListCommandOptions {
  embedConfig?: CdkLocalEmbedConfig;
}
interface FormatTargetListingOptions {
  long?: boolean;
}
declare function formatTargetListing(listing: TargetListing, cliName: string, options?: FormatTargetListingOptions): string;
declare function createLocalListCommand(opts?: CreateLocalListCommandOptions): Command;
declare function addListSpecificOptions(cmd: Command): Command;
//#endregion
//#region src/local/studio-events.d.ts
type StudioTargetKind = 'lambda' | 'api' | 'alb' | 'ecs' | 'ecs-task' | 'cloudfront' | 'agentcore';
interface StudioInvocationEvent {
  id: string;
  ts: number;
  target: string;
  kind: StudioTargetKind;
  label: string;
  request?: unknown;
  response?: unknown;
  status?: number;
  durationMs?: number;
  reinvokeOf?: string;
}
interface StudioLogEvent {
  ts: number;
  containerId: string;
  target: string;
  line: string;
  stream?: 'stdout' | 'stderr';
}
interface StudioServeEvent {
  ts: number;
  target: string;
  kind: StudioTargetKind;
  status: 'starting' | 'running' | 'stopped' | 'error';
  endpoints?: string[];
  hostUrl?: string;
  pid?: number;
  message?: string;
}
interface StudioEventMap {
  invocation: [StudioInvocationEvent];
  log: [StudioLogEvent];
  serve: [StudioServeEvent];
}
declare class StudioEventBus {
  private readonly emitter;
  constructor();
  emit<E extends keyof StudioEventMap>(event: E, ...args: StudioEventMap[E]): void;
  on<E extends keyof StudioEventMap>(event: E, listener: (...args: StudioEventMap[E]) => void): this;
  off<E extends keyof StudioEventMap>(event: E, listener: (...args: StudioEventMap[E]) => void): this;
  listenerCount<E extends keyof StudioEventMap>(event: E): number;
}
//#endregion
//#region src/local/studio-store.d.ts
interface StudioStoreOptions {
  maxInvocations?: number;
  maxLogs?: number;
  bindGraceMs?: number;
}
interface StudioHistory {
  invocations: StudioInvocationEvent[];
  logs: StudioLogEvent[];
}
interface StudioLogSearchOptions {
  target?: string;
  limit?: number;
}
interface StudioStore {
  history: () => StudioHistory;
  searchLogs: (query: string, opts?: StudioLogSearchOptions) => StudioLogEvent[];
  logsForInvocation: (id: string) => StudioLogEvent[];
  invocation: (id: string) => StudioInvocationEvent | undefined;
  dispose: () => void;
}
declare function createStudioStore(bus: StudioEventBus, options?: StudioStoreOptions): StudioStore;
//#endregion
//#region src/local/studio-server.d.ts
interface StudioTarget {
  id: string;
  qualifiedId: string;
  surface?: string;
  servable?: boolean;
  pinned?: boolean;
  backingPinnedServices?: {
    id: string;
    label: string;
  }[];
}
interface StudioTargetGroup {
  kind: 'lambda' | 'api' | 'alb' | 'ecs' | 'ecs-task' | 'cloudfront' | 'agentcore';
  title: string;
  entries: StudioTarget[];
}
declare function toStudioTargetGroups(listing: TargetListing): StudioTargetGroup[];
declare function annotatePinnedEcsTargets(groups: StudioTargetGroup[], classify: (targetId: string) => boolean): boolean;
declare function annotateAlbPinnedBackingServices(groups: StudioTargetGroup[], resolveBackingPinned: (albEntry: StudioTarget) => {
  id: string;
  label: string;
}[]): boolean;
declare function filterStudioTargetGroups(groups: StudioTargetGroup[], globs: string[] | undefined): StudioTargetGroup[];
interface StudioServerOptions {
  port: number;
  host?: string;
  bus: StudioEventBus;
  targetGroups: StudioTargetGroup[];
  dockerfiles?: string[];
  appLabel: string;
  cliName: string;
  maxPortBump?: number;
  onRun?: (body: unknown) => Promise<unknown>;
  onStop?: (body: unknown) => Promise<unknown>;
  onServeRequest?: (body: unknown) => Promise<unknown>;
  onReinvoke?: (body: unknown) => Promise<unknown>;
  getRunning?: () => unknown;
  store?: StudioStore;
  getConfig?: () => unknown;
  patchConfig?: (body: unknown) => Promise<unknown>;
}
interface RunningStudioServer {
  url: string;
  port: number;
  close: () => Promise<void>;
  setTargets: (groups: StudioTargetGroup[], dockerfiles?: string[]) => void;
}
declare function startStudioServer(options: StudioServerOptions): Promise<RunningStudioServer>;
//#endregion
//#region src/local/studio-child-args.d.ts
interface SharedChildConfig {
  app?: string;
  assemblyDir?: string;
  profile?: string;
  region?: string;
  context?: Record<string, string>;
  fromCfnStack?: string | boolean;
  assumeRole?: string;
}
//#endregion
//#region src/local/studio-option-specs.d.ts
interface PairValue {
  left: string;
  right: string;
}
type OptionValues = Record<string, boolean | string | PairValue[]>;
//#endregion
//#region src/local/studio-dispatch.d.ts
interface StudioRunRequest {
  targetId: string;
  kind: StudioTargetKind;
  event: unknown;
  options?: OptionValues;
  rawArgs?: string;
  imageOverride?: string;
  imageOverrides?: Record<string, string>;
  reinvokeOf?: string;
}
interface StudioRunResult {
  invocationId: string;
  ok: boolean;
  status: number;
  response?: unknown;
  raw?: string;
  error?: string;
  durationMs: number;
}
interface StudioDispatchConfig extends SharedChildConfig {
  cliEntry: string;
  bus: StudioEventBus;
  cwd?: string;
  nodeBin?: string;
  spawnFn?: typeof spawn;
  clock?: () => number;
  idFactory?: () => string;
}
interface StudioDispatcher {
  run: (req: StudioRunRequest) => Promise<StudioRunResult>;
}
declare function createStudioDispatcher(config: StudioDispatchConfig): StudioDispatcher;
//#endregion
//#region src/local/studio-proxy.d.ts
interface StudioProxyConfig {
  bus: StudioEventBus;
  target: string;
  kind: StudioTargetKind;
  upstream: string;
  host?: string;
  clock?: () => number;
  idFactory?: () => string;
  maxCaptureBytes?: number;
}
interface RunningStudioProxy {
  url: string;
  port: number;
  close: () => Promise<void>;
}
declare function startStudioProxy(config: StudioProxyConfig): Promise<RunningStudioProxy>;
//#endregion
//#region src/local/studio-serve-manager.d.ts
interface StudioServeRequest {
  targetId: string;
  kind: StudioTargetKind;
  options?: OptionValues;
  rawArgs?: string;
  imageOverride?: string;
  imageOverrides?: Record<string, string>;
}
interface StudioStopRequest {
  targetId: string;
}
interface StudioServeState {
  targetId: string;
  kind: StudioTargetKind;
  status: 'starting' | 'running' | 'stopped' | 'error';
  endpoints: string[];
  hostUrl?: string;
  pid?: number;
  startedAt: number;
}
interface StudioServeManagerConfig extends SharedChildConfig {
  cliEntry: string;
  bus: StudioEventBus;
  watch?: boolean;
  cwd?: string;
  nodeBin?: string;
  spawnFn?: typeof spawn;
  clock?: () => number;
  readyTimeoutMs?: number;
  stopGraceMs?: number;
  setTimeoutFn?: typeof setTimeout;
  clearTimeoutFn?: typeof clearTimeout;
  proxyFactory?: (config: StudioProxyConfig) => Promise<RunningStudioProxy>;
  captureRequests?: boolean;
}
interface StudioServeManager {
  start: (req: StudioServeRequest) => Promise<StudioServeState>;
  stop: (req: StudioStopRequest) => Promise<void>;
  list: () => StudioServeState[];
  stopAll: () => Promise<void>;
}
declare function createStudioServeManager(config: StudioServeManagerConfig): StudioServeManager;
//#endregion
//#region src/cli/commands/local-studio.d.ts
declare function coerceRunRequest(body: unknown): StudioRunRequest;
declare function coerceStopRequest(body: unknown): StudioStopRequest;
interface StudioServeRequestPayload {
  targetId: string;
  method: string;
  path?: string;
  headers?: Record<string, string>;
  body?: string;
}
declare function resolveServeBaseUrl(state: StudioServeState): string | undefined;
declare function coerceServeRequest(body: unknown): StudioServeRequestPayload;
interface CreateLocalStudioCommandOptions {
  embedConfig?: CdkLocalEmbedConfig;
}
declare function createLocalStudioCommand(opts?: CreateLocalStudioCommandOptions): Command;
declare function addStudioSpecificOptions(cmd: Command): Command;
//#endregion
export { LambdaUrlInvokerMap as $, substituteAgainstState as $i, attachAuthorizers as $n, InvokeAgentCoreOptions as $r, runEcsServiceEmulator as $t, startStudioServer as A, getEmbedConfig as Ai, ServerState as An, createLocalInvokeAgentCoreCommand as Ar, serviceStrategy as At, StudioServeEvent as B, resolveCfnFallbackRegion as Bi, buildCognitoJwksUrl as Bn, A2aInvokeResult as Br, PlannedFrontDoorListener as Bt, RunningStudioServer as C, FileWatcherOptions as Ci, CreateLocalStartApiCommandOptions as Cn, ContainerPool as Cr, albStrategy as Ct, annotateAlbPinnedBackingServices as D, createLocalInvokeCommand as Di, createWatchPredicates as Dn, resolveProfileCredentials as Dr, CreateLocalStartServiceCommandOptions as Dt, StudioTargetGroup as E, addInvokeSpecificOptions as Ei, createLocalStartApiCommand as En, buildStsClientConfig as Er, resolveAlbTarget as Et, StudioStoreOptions as F, LocalStateSourceError as Fi, defaultCredentialsLoader as Fn, InvokeAgentCoreWsOptions as Fr, PlannedAction as Ft, createLocalListCommand as G, ResolvedSsmParameters as Gi, verifyJwtViaDiscovery as Gn, MCP_PROTOCOL_VERSION as Gr, addEcsAssumeRoleOptions as Gt, CreateLocalListCommandOptions as H, resolveCfnStackName as Hi, createJwksCache as Hn, a2aInvokeOnce as Hr, PlannedRedirectAction as Ht, createStudioStore as I, LocalStateSourceOptions as Ii, DiscoveryJwtAuthorizer as In, invokeAgentCoreWs as Ir, PlannedEcsForwardTarget as It, LocalStartCloudFrontError as J, resolveSsmParameters as Ji, createAuthorizerCache as Jn, McpJsonRpcRequest as Jr, ecsClusterOption as Jt, formatTargetListing as K, SsmParameterRef as Ki, AuthorizerCache as Kn, McpInvokeOptions as Kr, addImageOverrideOptions as Kt, StudioEventBus as L, createLocalStateProvider as Li, JwksCache as Ln, A2A_CONTAINER_PORT as Lr, PlannedFixedResponseAction as Lt, StudioHistory as M, setEmbedConfig as Mi, readMtlsMaterialsFromDisk as Mn, EnvOverrideFile as Mr, EmulatorStrategy as Mt, StudioLogSearchOptions as N, ExtraStateProviders as Ni, startApiServer as Nn, resolveEnvVars as Nr, FrontDoorPlan as Nt, annotatePinnedEcsTargets as O, ResolvedArnLambdaLayer as Oi, resolveApiTargetSubset as On, CreateLocalInvokeAgentCoreCommandOptions as Or, addStartServiceSpecificOptions as Ot, StudioStore as P, LocalStateProviderFactory as Pi, CredentialsLoader as Pn, AgentCoreWsResult as Pr, MAX_TASKS_SUBNET_RANGE_CAP as Pt, resolveCloudFrontTarget as Q, SubstitutionContext as Qi, RouteWithAuth as Qn, AgentCoreInvokeResult as Qr, resolveSharedSidecarCredentials as Qt, StudioInvocationEvent as R, isCfnFlagPresent as Ri, JwtCustomClaim as Rn, A2A_PATH as Rr, PlannedForwardAction as Rt, createStudioDispatcher as S, FileWatcher as Si, ApiTargetSubset as Sn, VtlEvaluationError as Sr, addAlbSpecificOptions as St, StudioTarget as T, CreateLocalInvokeCommandOptions as Ti, addStartApiSpecificOptions as Tn, resolveWatchConfig as Tr, parseLbPortOverrides as Tt, FormatTargetListingOptions as U, LocalStateProvider as Ui, verifyCognitoJwt as Un, MCP_CONTAINER_PORT as Ur, ServiceBoot as Ut, StudioTargetKind as V, resolveCfnRegion as Vi, buildJwksUrlFromIssuer as Vn, A2aJsonRpcRequest as Vr, PlannedLambdaForwardTarget as Vt, addListSpecificOptions as W, LocalStateRecord as Wi, verifyJwtAuthorizer as Wn, MCP_PATH as Wr, addCommonEcsServiceOptions as Wt, createLocalStartCloudFrontCommand as X, PseudoParameters as Xi, LambdaRequestAuthorizer as Xn, parseSseForJsonRpc as Xr, parseRestartPolicy as Xt, addStartCloudFrontSpecificOptions as Y, CrossStackResolver as Yi, AuthorizerInfo as Yn, mcpInvokeOnce as Yr, parseMaxTasks as Yt, parseOriginOverrides as Z, StateEnvSubstitutionAudit as Zi, LambdaTokenAuthorizer as Zn, AGENTCORE_SESSION_ID_HEADER as Zr, resolveEcsAssumeRoleOption as Zt, startStudioProxy as _, substituteImagePlaceholders as _i, LocalInvokeBuildError as _n, IntegrationResponseEntry as _r, CompiledCloudFrontFunction as _t, coerceServeRequest as a, AGENTCORE_MCP_PROTOCOL as ai, SOFT_RELOAD_COMPLETION_LOG_SUFFIX as an, matchPreflight as ar, ResolvedCloudFrontFunction as at, StudioRunRequest as b, ReloadVerdict as bi, createLocalRunTaskCommand as bn, selectIntegrationResponse as br, runViewerResponse as bt, resolveServeBaseUrl as c, AgentCoreCustomClaim as ci, buildCloudMapIndex as cn, availableWebSocketApiIdentifiers as cr, isCloudFrontDistribution as ct, StudioServeRequest as d, ResolvedAgentCoreRuntime as di, ResolvedEcsService as dn, filterWebSocketApisByIdentifiers as dr, resolveCloudFrontDistribution as dt, substituteAgainstStateAsync as ea, invokeAgentCore as ei, FrontDoorForwardTarget as en, CorsConfig as er, StartedCloudFrontServer as et, StudioServeState as f, pickAgentCoreCandidateStack as fi, TargetEntry as fn, parseSelectionExpressionPath as fr, ResolvedCustomErrorResponse as ft, StudioProxyConfig as g, formatStateRemedy as gi, CdkLocalError as gn, discoverRoutes as gr, CfResponse as gt, RunningStudioProxy as h, derivePseudoParametersFromRegion as hi, listTargets as hn, RestV1IntegrationConfig as hr, CfRequest as ht, coerceRunRequest as i, AGENTCORE_HTTP_PROTOCOL as ii, DEFAULT_SHADOW_READY_TIMEOUT_MS as in, isFunctionUrlOacFronted as ir, ResolvedBehavior as it, toStudioTargetGroups as j, resetEmbedConfig as ji, StartedApiServer as jn, DockerImageAssetSource as jr, EcsServiceEmulatorOptions as jt, filterStudioTargetGroups as k, CdkLocalEmbedConfig as ki, MtlsServerConfig as kn, addInvokeAgentCoreSpecificOptions as kr, createLocalStartServiceCommand as kt, StudioServeManager as l, AgentCoreJwtAuthorizer as li, CloudMapRegistry as ln, discoverWebSocketApis as lr, pickFunctionUrlLogicalIdFromOrigin as lt, createStudioServeManager as m, ImageResolutionContext as mi, countTargets as mn, DiscoveredRoute as mr, serveFromStaticOrigin as mt, StudioServeRequestPayload as n, substituteEnvVarsFromStateAsync as na, AGENTCORE_A2A_PROTOCOL as ni, isApplicationLoadBalancer as nn, buildCorsConfigByApiId as nr, startCloudFrontServer as nt, coerceStopRequest as o, AGENTCORE_RUNTIME_TYPE as oi, setShadowReadyTimeoutMs as on, DiscoveredWebSocketApi as or, ResolvedDistribution as ot, StudioStopRequest as p, resolveAgentCoreTarget as pi, TargetListing as pn, webSocketApiMatchesIdentifier as pr, StaticOriginResult as pt, CreateLocalStartCloudFrontCommandOptions as q, collectSsmParameterRefs as qi, CachedAuthorizerResult as qn, McpInvokeResult as qr, buildEcsImageResolutionContext as qt, addStudioSpecificOptions as r, CloudFormationTemplate as ra, AGENTCORE_AGUI_PROTOCOL as ri, resolveAlbFrontDoor as rn, buildCorsConfigFromCloudFrontChain as rr, CLOUDFRONT_DISTRIBUTION_TYPE as rt, createLocalStudioCommand as s, AgentCoreCodeArtifact as si, CloudMapIndex as sn, WebSocketRouteEntry as sr, ResolvedOrigin as st, CreateLocalStudioCommandOptions as t, substituteEnvVarsFromState as ta, waitForAgentCorePing as ti, ResolvedListenerAction as tn, applyCorsResponseHeaders as tr, matchBehavior as tt, StudioServeManagerConfig as u, AgentCoreResolutionError as ui, RegistrationHandle as un, discoverWebSocketApisOrThrow as ur, pickTargetFunctionLogicalId as ut, StudioDispatchConfig as v, tryResolveImageFnJoin as vi, CreateLocalRunTaskCommandOptions as vn, evaluateResponseParameters as vr, compileCloudFrontFunction as vt, StudioServerOptions as w, createFileWatcher as wi, WatchPredicates as wn, CdkWatchConfig as wr, createLocalStartAlbCommand as wt, StudioRunResult as x, classifySourceChange as xi, EcsTaskResolutionError as xn, tryParseStatus as xr, CreateLocalStartAlbCommandOptions as xt, StudioDispatcher as y, ReloadAssetContext as yi, addRunTaskSpecificOptions as yn, pickResponseTemplate as yr, runViewerRequest as yt, StudioLogEvent as z, rejectExplicitCfnStackWithMultipleStacks as zi, WarnedAt as zn, A2aInvokeOptions as zr, PlannedForwardTarget as zt };
//# sourceMappingURL=local-studio-BXe9E0Q0.d.ts.map