import { a as CollectionDefinition, i as Engine, n as OAuthFlowExecutor, s as Clock, t as CredentialMaterialProvider } from "./index-ChIfeWzk.js";
import { A as WorkflowDefinition, E as RunId, F as RunCurrentState, G as TypeToken, J as RunEventBus, L as RunPruneCandidate, N as PersistedRunState, T as PersistedRunPolicySnapshot, Tt as WorkflowRunDetailDto, V as RunSummary, W as Container, Y as TestCaseRunStatus, a as BinaryStorage, d as NodeExecutionScheduler, jt as WorkflowId, nt as McpServerDeclaration, p as WorkflowRepository, q as RunEvent, rt as AnyCredentialType, tt as WorkflowActivationPolicy, u as NodeExecutionRequestHandler } from "./ItemsInputNormalizer-CFkfNMLt.js";
import { C as CodemationContainerRegistration, l as CodemationPluginPackageMetadata, o as CodemationPlugin, r as AppConfig } from "./CodemationAppContext-K51b7oXe.js";
import { a as CodemationAuthConfig, l as Logger, t as CodemationWhitelabelConfig, u as LoggerFactory } from "./CodemationWhitelabelConfig-Ca2mCUeC.js";
import { t as LogLevelPolicyFactory } from "./LogLevelPolicyFactory-ewCHLDLn.js";
import { t as CredentialStore } from "./CredentialServices-B3wPyp2y.js";
import { i as TelemetryMetricPointStore, n as TelemetryArtifactStore, o as TelemetrySpanStore, r as TelemetryExporter, s as TelemetrySpanUpsert, t as RunTraceContextRepository } from "./TelemetryContracts-DpZEODQM.js";
import { n as PrismaDatabaseClient } from "./AppConfigFactory-DncmwCD1.js";
import { t as PrismaMigrationDeployer } from "./PrismaMigrationDeployer-DdEcXXVi.js";
import { t as InternalHonoApiRouteRegistrar } from "./InternalHonoApiRouteRegistrar-Ce1yxpnO.js";
import { s as ProcessRunner } from "./PublicFrontendBootstrapFactory-ClEjZP74.js";
import "reflect-metadata";
import { Hono, MiddlewareHandler } from "hono";
import "jose";

//#region src/application/bus/Command.d.ts
declare abstract class Command<TResult> {
  protected readonly __resultType?: TResult;
}
//#endregion
//#region src/application/bus/CommandBus.d.ts
interface CommandBus {
  execute<TResult>(command: Command<TResult>): Promise<TResult>;
}
//#endregion
//#region src/application/bus/Query.d.ts
declare abstract class Query<TResult> {
  protected readonly __resultType?: TResult;
}
//#endregion
//#region src/application/bus/QueryBus.d.ts
interface QueryBus {
  execute<TResult>(query: Query<TResult>): Promise<TResult>;
}
//#endregion
//#region src/infrastructure/config/CodemationPluginRegistrar.d.ts
declare class CodemationPluginRegistrar {
  apply(args: Readonly<{
    plugins: ReadonlyArray<CodemationPlugin>;
    container: Container;
    appConfig: AppConfig;
    registerCredentialType: (type: AnyCredentialType) => void;
    registerCollection: (definition: CollectionDefinition) => void;
    mergeMcpServers: (declarations: ReadonlyArray<McpServerDeclaration>) => void;
    loggerFactory: LoggerFactory;
  }>): Promise<void>;
}
//#endregion
//#region src/application/contracts/WorkflowWebsocketMessage.d.ts
type WorkflowWebsocketMessage = Readonly<{
  kind: "event";
  event: RunEvent;
}> | Readonly<{
  kind: "workflowChanged";
  workflowId: string;
}> | Readonly<{
  kind: "devBuildStarted";
  workflowId: string;
  buildVersion?: string;
}> | Readonly<{
  kind: "devBuildCompleted";
  workflowId: string;
  buildVersion: string;
}> | Readonly<{
  kind: "devBuildFailed";
  workflowId: string;
  message: string;
}> | Readonly<{
  kind: "telemetryEvent";
  runId: string;
  span: TelemetrySpanUpsert;
}>;
//#endregion
//#region src/application/websocket/WorkflowWebsocketPublisher.d.ts
interface WorkflowWebsocketPublisher {
  publishToRoom(roomId: string, message: WorkflowWebsocketMessage): Promise<void>;
}
//#endregion
//#region ../managed-auth/src/types.d.ts
/**
 * A successfully verified CP-signed JWT principal.
 * `userId` maps to the JWT `sub` claim; `workspaceId` maps to `aud`.
 */
interface VerifiedManagedPrincipal {
  readonly userId: string;
  readonly workspaceId: string;
}
//#endregion
//#region src/presentation/websocket/WebsocketAuthenticator.types.d.ts
/**
 * Authenticates an incoming WebSocket upgrade request.
 *
 * Implementations parse the upgrade URL (e.g. `?token=<jwt>`) and verify the
 * credential.  Returns the verified principal on success, or `null` when the
 * request must be rejected with close-code 4401.
 */
interface WebsocketAuthenticator {
  authenticate(requestUrl: string | undefined): Promise<VerifiedManagedPrincipal | null>;
}
//#endregion
//#region src/presentation/websocket/WorkflowWebsocketServer.d.ts
declare class WorkflowWebsocketServer implements WorkflowWebsocketPublisher {
  private readonly port;
  private readonly bindHost;
  private readonly logger;
  private readonly authenticator;
  private websocketServer;
  private readonly sockets;
  private readonly roomIdsBySocket;
  private started;
  constructor(port: number, bindHost: string, logger: Logger, authenticator?: WebsocketAuthenticator | null);
  /** Returns the actual port the server is listening on (useful when constructed with port 0). */
  get listeningPort(): number;
  start(): Promise<void>;
  stop(): Promise<void>;
  publishToRoom(roomId: string, message: WorkflowWebsocketMessage): Promise<void>;
  private connect;
  private handleMessage;
  private awaitListening;
  private closeAfterFailedStart;
  private parseClientMessage;
}
//#endregion
//#region src/bootstrap/CodemationContainerRegistrationRegistrar.d.ts
declare class CodemationContainerRegistrationRegistrar {
  apply(container: Container, registrations: ReadonlyArray<CodemationContainerRegistration<unknown>>): void;
  private applyRegistration;
  private isValueRegistration;
  private isClassRegistration;
}
//#endregion
//#region src/bootstrap/AppContainerFactory.d.ts
type AppContainerInputs = Readonly<{
  appConfig: AppConfig;
  sharedWorkflowWebsocketServer: WorkflowWebsocketServer | null;
}>;
declare class AppContainerFactory {
  private readonly containerRegistrationRegistrar;
  private readonly pluginRegistrar;
  private static readonly queryHandlers;
  private static readonly commandHandlers;
  private static readonly honoRouteRegistrars;
  constructor(containerRegistrationRegistrar?: CodemationContainerRegistrationRegistrar, pluginRegistrar?: CodemationPluginRegistrar);
  create(inputs: AppContainerInputs): Promise<Container>;
  private collectCredentialTypes;
  private registerMcpCatalog;
  private mergeConfigMcpServers;
  private applyPlugins;
  private registerCredentialTypes;
  private registerControlPlaneCatalogFetcher;
  private registerConfiguredRegistrations;
  private registerCollectionsInfrastructure;
  private registerCoreInfrastructure;
  private registerRepositoriesAndBuses;
  private registerApplicationServicesAndRoutes;
  private registerManagedAuthInfrastructure;
  private registerPairingInfrastructure;
  private registerOperationalInfrastructure;
  private registerWorkflowAuditWriter;
  private registerRuntimeInfrastructure;
  private resolvePrismaOwnership;
  private registerRuntimeNodeActivationScheduler;
  private createWorkflowPolicyRuntimeDefaults;
  private createBinaryStorage;
  private createRuntimeSummary;
  private requireRedisUrl;
  private readPositiveInteger;
  private synchronizeLiveWorkflowRepository;
}
//#endregion
//#region src/bootstrap/AppContainerLifecycle.d.ts
declare class AppContainerLifecycle {
  private readonly container;
  private readonly ownedPrismaClient;
  constructor(container: Container, ownedPrismaClient: PrismaDatabaseClient | null);
  start(): Promise<void>;
  startWorkerSubscribers(): Promise<void>;
  stop(args?: Readonly<{
    stopWebsocketServer?: boolean;
  }>): Promise<void>;
}
//#endregion
//#region src/bootstrap/runtime/DatabaseMigrations.d.ts
declare class DatabaseMigrations {
  private readonly appConfig;
  private readonly prismaMigrationDeployer;
  constructor(appConfig: AppConfig, prismaMigrationDeployer: PrismaMigrationDeployer);
  migrate(): Promise<void>;
}
//#endregion
//#region src/infrastructure/collections/CollectionAdvisoryLockService.types.d.ts
/**
 * Mutual exclusion service for schema sync.
 * Ensures only one process runs schema migration at a time.
 * Postgres: database-level advisory locks. SQLite: in-process async mutex.
 */
interface CollectionAdvisoryLockService {
  /**
   * Acquire a lock, run fn, and release the lock.
   * The key should be stable across restarts.
   */
  withLock<T>(key: string, fn: () => Promise<T>): Promise<T>;
}
//#endregion
//#region src/infrastructure/collections/collectionSchemaTypes.d.ts
/**
 * Schema types for collections — pure types, no classes, no imports with side effects.
 */
interface ColumnSpec {
  readonly name: string;
  readonly type: "uuid" | "text" | "integer" | "bigint" | "double" | "boolean" | "timestamptz" | "jsonb";
  readonly nullable: boolean;
  readonly default?: unknown;
}
interface IndexSpec {
  readonly name: string;
  readonly fields: ReadonlyArray<string>;
  readonly unique: boolean;
}
interface LiveCollectionTable {
  readonly columns: ReadonlyArray<ColumnSpec>;
  readonly indexes: ReadonlyArray<IndexSpec>;
}
interface LiveCollectionsSchema {
  readonly tables: Readonly<Record<string, LiveCollectionTable>>;
}
interface DiffOps {
  readonly collection: string;
  /** Present when the table does not exist and must be created. Contains all columns including auto-fields. */
  readonly createTable?: ReadonlyArray<ColumnSpec>;
  readonly addColumns: ReadonlyArray<ColumnSpec>;
  readonly dropColumns: ReadonlyArray<string>;
  readonly addIndexes: ReadonlyArray<IndexSpec>;
  readonly dropIndexes: ReadonlyArray<string>;
}
interface CollectionSyncResult {
  readonly planned: ReadonlyArray<DiffOps>;
  readonly applied: ReadonlyArray<DiffOps>;
}
//#endregion
//#region src/infrastructure/collections/CollectionDdlEmitter.types.d.ts
/**
 * Generates SQL DDL for creating and modifying collection tables.
 * Driver-specific implementations handle quoting, type mapping, and extensions.
 */
interface CollectionDdlEmitter {
  /**
   * Generate SQL to create the collections schema (Postgres only).
   * Returns null for SQLite (uses table name prefixes instead).
   */
  createSchemaSql(): string | null;
  /**
   * Generate SQL to create a new collection table with auto fields (id, created_at, updated_at).
   */
  createTableSql(definition: CollectionDefinition, columns: ReadonlyArray<ColumnSpec>): string;
  /**
   * Generate SQL to add a column to an existing table.
   */
  addColumnSql(definition: CollectionDefinition, column: ColumnSpec): string;
  /**
   * Generate SQL to drop a column from a table.
   * SQLite driver throws a clear error directing the user to a manual migration.
   */
  dropColumnSql(definition: CollectionDefinition, columnName: string): string;
  /**
   * Generate SQL to create an index on a collection table.
   */
  createIndexSql(definition: CollectionDefinition, index: IndexSpec): string;
  /**
   * Generate SQL to drop an index.
   */
  dropIndexSql(definition: CollectionDefinition, indexName: string): string;
  /**
   * Get the qualified table reference for a collection.
   * Postgres: "collections"."name", SQLite: "collections_name"
   */
  qualifyTable(collectionName: string): string;
}
//#endregion
//#region src/infrastructure/collections/CollectionRegistry.d.ts
/**
 * Singleton registry that exposes the declared collection definitions from AppConfig.
 * Injected by tsyringe; constructed once per app container.
 */
declare class CollectionRegistry {
  private readonly definitions;
  constructor(appConfig: AppConfig);
  resolve(name: string): CollectionDefinition | undefined;
  list(): ReadonlyArray<CollectionDefinition>;
  has(name: string): boolean;
}
//#endregion
//#region src/infrastructure/collections/CollectionSchemaIntrospector.types.d.ts
/**
 * Reads the live (actual) database schema for collections.
 * Driver-specific implementations read from information_schema (Postgres) or sqlite_master (SQLite).
 */
interface CollectionSchemaIntrospector {
  introspect(): Promise<LiveCollectionsSchema>;
}
//#endregion
//#region src/infrastructure/collections/CollectionSchemaDiffer.d.ts
/**
 * Pure logic for diffing declared collection schemas against live database schema.
 * No database access, no DI dependencies — testable in isolation.
 */
declare class CollectionSchemaDiffer {
  /**
   * Compute schema differences between a declared collection definition and the live table.
   * Returns the operations needed to bring the live schema in sync with the declared schema.
   */
  diff(declared: CollectionDefinition, live: LiveCollectionTable | undefined): DiffOps;
  private buildColumnsForCreate;
  private buildColumnSpec;
  private mapFieldType;
  private buildIndexSpec;
}
//#endregion
//#region src/infrastructure/collections/CollectionSchemaSyncer.d.ts
/**
 * Orchestrates schema synchronization for declared collections.
 *
 * Algorithm:
 * 1. Acquire advisory lock
 * 2. Create collections schema (Postgres only — SQLite emitter returns null)
 * 3. Introspect live schema
 * 4. Compute diffs for each declared collection
 * 5. Block destructive changes unless CODEMATION_COLLECTIONS_ALLOW_DESTRUCTIVE=1
 * 6. Apply DDL if not dryRun
 */
declare class CollectionSchemaSyncer {
  private readonly collectionRegistry;
  private readonly introspector;
  private readonly differ;
  private readonly ddlEmitter;
  private readonly lockService;
  private readonly prismaClient;
  private readonly logger;
  private readonly env;
  constructor(collectionRegistry: CollectionRegistry, introspector: CollectionSchemaIntrospector, differ: CollectionSchemaDiffer, ddlEmitter: CollectionDdlEmitter, lockService: CollectionAdvisoryLockService, prismaClient: PrismaDatabaseClient, logger: Logger, env: Readonly<NodeJS.ProcessEnv>);
  sync(opts?: {
    dryRun?: boolean;
  }): Promise<CollectionSyncResult>;
  private hasChanges;
  private applyOps;
}
//#endregion
//#region src/infrastructure/collections/CollectionSchemaSyncerHolder.d.ts
/**
 * Optional holder for CollectionSchemaSyncer.
 * Registered in the DI container always (with syncer=null when not applicable).
 * Lets FrontendRuntime / WorkerRuntime inject it without nullability issues.
 */
declare class CollectionSchemaSyncerHolder {
  private readonly syncer;
  constructor(syncer: CollectionSchemaSyncer | null);
  syncIfAvailable(opts?: {
    dryRun?: boolean;
  }): Promise<CollectionSyncResult | null>;
  hasSync(): boolean;
}
//#endregion
//#region src/domain/workflows/WorkflowActivationRepository.d.ts
type WorkflowActivationRow = Readonly<{
  workflowId: string;
  isActive: boolean;
}>;
interface WorkflowActivationRepository {
  loadAll(): Promise<ReadonlyArray<WorkflowActivationRow>>;
  upsert(workflowId: string, active: boolean): Promise<void>;
}
//#endregion
//#region src/infrastructure/persistence/RuntimeWorkflowActivationPolicy.d.ts
/**
 * In-memory activation map: missing workflow id ⇒ inactive. Hydrated from persistence at startup and updated on command.
 */
declare class RuntimeWorkflowActivationPolicy implements WorkflowActivationPolicy {
  private readonly activeByWorkflowId;
  hydrateFromRepository(repository: WorkflowActivationRepository): Promise<void>;
  set(workflowId: string, active: boolean): void;
  isActive(workflowId: WorkflowId): boolean;
}
//#endregion
//#region src/domain/runs/WorkflowRunRepository.d.ts
interface WorkflowRunRepository {
  load(runId: string): Promise<PersistedRunState | undefined>;
  loadRunDetail?(runId: string): Promise<WorkflowRunDetailDto | undefined>;
  save(state: PersistedRunState): Promise<void>;
  listRuns(args: Readonly<{
    workflowId?: string;
    limit?: number;
  }>): Promise<ReadonlyArray<RunSummary>>;
  listRunsOlderThan?(args: Readonly<{
    nowIso: string;
    defaultRetentionSeconds: number;
    limit?: number;
  }>): Promise<ReadonlyArray<RunPruneCandidate>>;
  listBinaryStorageKeys?(runId: RunId): Promise<ReadonlyArray<string>>;
  deleteRun(runId: RunId): Promise<void>;
  /** Update the testCaseStatus field for a test-suite child run. Used by TestSuiteRunTracker. */
  updateTestCaseStatus?(runId: RunId, status: TestCaseRunStatus): Promise<void>;
}
//#endregion
//#region src/application/telemetry/OtelIdentityFactory.d.ts
declare class OtelIdentityFactory {
  createTraceId(runId: string): string;
  createRootSpanId(runId: string): string;
  createNodeSpanId(activationId: string): string;
  createConnectionInvocationSpanId(invocationId: string): string;
  createArtifactId(): string;
  createEphemeralSpanId(): string;
  private hashToHex;
  private ensureNonZeroHex;
}
//#endregion
//#region src/domain/workflows/WorkflowDefinitionRepository.d.ts
interface WorkflowDefinitionRepository {
  listDefinitions(): Promise<ReadonlyArray<WorkflowDefinition>>;
  getDefinition(workflowId: string): Promise<WorkflowDefinition | undefined>;
  resolveSnapshot(args: Readonly<{
    workflowId: string;
    workflowSnapshot?: unknown;
  }>): Promise<WorkflowDefinition | undefined>;
}
//#endregion
//#region src/application/telemetry/TelemetryEnricherChain.d.ts
interface TelemetryNodeMetadata {
  readonly workflowFolder?: string;
  readonly nodeType?: string;
  readonly nodeRole?: string;
}
declare class TelemetryEnricherChain {
  private readonly workflowDefinitionRepository;
  private readonly definitionsByWorkflowId;
  constructor(workflowDefinitionRepository: WorkflowDefinitionRepository);
  enrichNode(args: Readonly<{
    workflowId: string;
    nodeId: string;
  }>): Promise<TelemetryNodeMetadata>;
  enrichRun(workflowId: string): Promise<Readonly<{
    workflowFolder?: string;
  }>>;
  private loadDefinition;
  private toWorkflowFolder;
  private toNodeType;
  private toNodeRole;
}
//#endregion
//#region src/application/telemetry/TelemetryRetentionTimestampFactory.d.ts
declare class TelemetryRetentionTimestampFactory {
  /** Default span retention: 7 days (overridden by policySnapshot). */
  static readonly defaultSpanRetentionSeconds: number;
  /** Default artifact retention: 3 days (overridden by policySnapshot). */
  static readonly defaultArtifactRetentionSeconds: number;
  /** Default metric retention: 30 days (overridden by policySnapshot). */
  static readonly defaultMetricRetentionSeconds: number;
  createSpanExpiry(policySnapshot: PersistedRunPolicySnapshot | undefined, observedAt: Date): string;
  createArtifactExpiry(policySnapshot: PersistedRunPolicySnapshot | undefined, observedAt: Date): string;
  createMetricExpiry(policySnapshot: PersistedRunPolicySnapshot | undefined, observedAt: Date): string;
  createTraceContextExpiry(policySnapshot: PersistedRunPolicySnapshot | undefined, observedAt: Date): string;
  private createExpiry;
}
//#endregion
//#region src/application/telemetry/RunEventBusTelemetryReporter.d.ts
declare class RunEventBusTelemetryReporter {
  private readonly runEventBus;
  private readonly runTraceContextRepository;
  private readonly workflowRunRepository;
  private readonly telemetrySpanStore;
  private readonly telemetryEnricherChain;
  private readonly telemetryRetentionTimestampFactory;
  private readonly otelIdentityFactory;
  private subscription;
  constructor(runEventBus: RunEventBus, runTraceContextRepository: RunTraceContextRepository, workflowRunRepository: WorkflowRunRepository, telemetrySpanStore: TelemetrySpanStore, telemetryEnricherChain: TelemetryEnricherChain, telemetryRetentionTimestampFactory: TelemetryRetentionTimestampFactory, otelIdentityFactory: OtelIdentityFactory);
  start(): Promise<void>;
  stop(): Promise<void>;
  private handleEvent;
  private handleRunCreated;
  private handleRunSaved;
  private handleNodeSnapshot;
  private createNodeSpanUpsert;
  private loadPolicySnapshot;
}
//#endregion
//#region src/application/websocket/WorkflowRunEventWebsocketRelay.d.ts
declare class WorkflowRunEventWebsocketRelay {
  private readonly workflowWebsocketPublisher;
  private readonly runEventBus;
  private subscription;
  constructor(workflowWebsocketPublisher: WorkflowWebsocketPublisher, runEventBus: RunEventBus);
  start(): Promise<void>;
  stop(): Promise<void>;
}
//#endregion
//#region src/application/logging/LogFilter.d.ts
type LogFilter = (entry: Readonly<{
  scope: string;
  level: "info" | "warn" | "error" | "debug";
  message: string;
}>) => boolean;
//#endregion
//#region src/infrastructure/logging/ServerLoggerFactory.d.ts
declare class ServerLoggerFactory implements LoggerFactory {
  private readonly logLevelPolicyFactory;
  constructor(logLevelPolicyFactory: LogLevelPolicyFactory);
  create(scope: string): Logger;
  createFiltered(scope: string, filter: LogFilter): Logger;
  createPerformanceDiagnostics(scope: string): Logger;
}
//#endregion
//#region src/application/runs/WorkflowRunRetentionPruneScheduler.d.ts
/**
 * Periodically deletes terminal workflow runs whose age exceeds the effective retention
 * (`policySnapshot.retentionSeconds` or `CODEMATION_RUN_RETENTION_DEFAULT_SECONDS`),
 * removes binary blobs referenced from run state via {@link BinaryStorage}, and
 * independently prunes spans, artifacts, and metric points once their own retention
 * timestamps expire.
 */
declare class WorkflowRunRetentionPruneScheduler {
  private readonly clock;
  private readonly runs;
  private readonly binaryStorage;
  private readonly telemetrySpanStore;
  private readonly telemetryArtifactStore;
  private readonly telemetryMetricPointStore;
  private readonly appConfig;
  private static readonly defaultIntervalMs;
  private timer;
  private readonly logger;
  constructor(clock: Clock, runs: WorkflowRunRepository, binaryStorage: BinaryStorage, telemetrySpanStore: TelemetrySpanStore, telemetryArtifactStore: TelemetryArtifactStore, telemetryMetricPointStore: TelemetryMetricPointStore, appConfig: AppConfig, loggerFactory: ServerLoggerFactory);
  start(): void;
  stop(): void;
  /** Exposed for tests; production path is the interval started by {@link start}. */
  runOnce(): Promise<void>;
  private runScheduledTick;
  private loadStorageKeysFromRunStateFallback;
  private collectStorageKeysFromValue;
}
//#endregion
//#region src/bootstrap/runtime/FrontendRuntime.d.ts
declare class FrontendRuntime {
  private readonly appConfig;
  private readonly databaseMigrations;
  private readonly runtimeWorkflowActivationPolicy;
  private readonly workflowActivationRepository;
  private readonly workflowRepository;
  private readonly workflowWebsocketServer;
  private readonly workflowRunEventWebsocketRelay;
  private readonly runEventBusTelemetryReporter;
  private readonly workflowRunRetentionPruneScheduler;
  private readonly engine;
  private readonly collectionSchemaSyncerHolder;
  constructor(appConfig: AppConfig, databaseMigrations: DatabaseMigrations, runtimeWorkflowActivationPolicy: RuntimeWorkflowActivationPolicy, workflowActivationRepository: WorkflowActivationRepository, workflowRepository: WorkflowRepository, workflowWebsocketServer: WorkflowWebsocketServer, workflowRunEventWebsocketRelay: WorkflowRunEventWebsocketRelay, runEventBusTelemetryReporter: RunEventBusTelemetryReporter, workflowRunRetentionPruneScheduler: WorkflowRunRetentionPruneScheduler, engine: Engine, collectionSchemaSyncerHolder: CollectionSchemaSyncerHolder);
  start(args?: Readonly<{
    skipPresentationServers?: boolean;
  }>): Promise<void>;
}
//#endregion
//#region src/infrastructure/scheduler/WorkerRuntimeScheduler.d.ts
type WorkerRuntimeHandle = Readonly<{
  stop: () => Promise<void>;
}>;
interface WorkerRuntimeScheduler extends NodeExecutionScheduler {
  createWorker(args: Readonly<{
    queues: ReadonlyArray<string>;
    requestHandler: NodeExecutionRequestHandler;
  }>): WorkerRuntimeHandle;
  close(): Promise<void>;
}
//#endregion
//#region src/bootstrap/runtime/WorkerRuntime.d.ts
declare class WorkerRuntime {
  private readonly appConfig;
  private readonly databaseMigrations;
  private readonly runtimeWorkflowActivationPolicy;
  private readonly workflowActivationRepository;
  private readonly workflowRepository;
  private readonly engine;
  private readonly runEventBusTelemetryReporter;
  private readonly workflowRunRetentionPruneScheduler;
  private readonly scheduler;
  private readonly lifecycle;
  private readonly collectionSchemaSyncerHolder;
  constructor(appConfig: AppConfig, databaseMigrations: DatabaseMigrations, runtimeWorkflowActivationPolicy: RuntimeWorkflowActivationPolicy, workflowActivationRepository: WorkflowActivationRepository, workflowRepository: WorkflowRepository, engine: Engine, runEventBusTelemetryReporter: RunEventBusTelemetryReporter, workflowRunRetentionPruneScheduler: WorkflowRunRetentionPruneScheduler, scheduler: WorkerRuntimeScheduler, lifecycle: AppContainerLifecycle, collectionSchemaSyncerHolder: CollectionSchemaSyncerHolder);
  start(queues: ReadonlyArray<string>): Promise<WorkerRuntimeHandle>;
}
//#endregion
//#region src/application/auth/AuthenticatedPrincipal.d.ts
type AuthenticatedPrincipal = Readonly<{
  id: string;
  email: string | null;
  name: string | null;
  /** Set to "managed-jwt" when the principal was verified from a CP-signed bearer token. */
  source?: "managed-jwt";
  /** The workspace ID from the JWT `aud` claim. Present when source === "managed-jwt". */
  workspaceId?: string;
}>;
//#endregion
//#region src/application/auth/SessionVerifier.d.ts
interface SessionVerifier {
  verify(request: Request): Promise<AuthenticatedPrincipal | null>;
}
//#endregion
//#region src/presentation/http/ServerHttpRouteParams.d.ts
type ServerHttpRouteParams = Readonly<Record<string, string>>;
//#endregion
//#region src/presentation/http/routeHandlers/BinaryHttpRouteHandlerFactory.d.ts
declare class BinaryHttpRouteHandler {
  private readonly queryBus;
  private readonly commandBus;
  private readonly binaryStorage;
  constructor(queryBus: QueryBus, commandBus: CommandBus, binaryStorage: BinaryStorage);
  getRunBinaryContent(_: Request, params: ServerHttpRouteParams): Promise<Response>;
  getWorkflowOverlayBinaryContent(_: Request, params: ServerHttpRouteParams): Promise<Response>;
  postWorkflowDebuggerOverlayBinaryUpload(request: Request, params: ServerHttpRouteParams): Promise<Response>;
  private createBinaryResponse;
  private createContentDisposition;
  private escapeFilename;
}
//#endregion
//#region src/presentation/http/hono/HonoApiRouteRegistrar.d.ts
interface HonoApiRouteRegistrar {
  register(app: Hono): void;
}
//#endregion
//#region src/auth/managed/ManagedCorsMiddleware.d.ts
/**
 * CORS allowlist middleware for managed mode.
 *
 * `CP_WEB_ORIGIN` (provisioner-injected) is a comma-separated allowlist of the
 * browser origins the CP UI may be served from — e.g. the Caddy origin and the
 * direct dev port. The request's own origin is echoed back only when it is a
 * member; all other origins are refused on preflight with a 403.
 */
declare class ManagedCorsMiddleware {
  private readonly allowedOrigins;
  constructor(allowedOrigin: string);
  private isAllowed;
  handle(): MiddlewareHandler;
}
//#endregion
//#region src/presentation/http/hono/CodemationHonoApiAppFactory.d.ts
declare class CodemationHonoApiApp {
  private readonly app;
  constructor(sessionVerifier: SessionVerifier, registrars: ReadonlyArray<HonoApiRouteRegistrar>, binaryHttpRouteHandler: BinaryHttpRouteHandler, internalRegistrars: ReadonlyArray<InternalHonoApiRouteRegistrar>, corsMiddlewareList: ReadonlyArray<ManagedCorsMiddleware>);
  getHono(): Hono;
  fetch(request: Request): Response | Promise<Response>;
}
//#endregion
//#region src/application/bus/CommandHandler.d.ts
declare abstract class CommandHandler<TCommand extends Command<TResult>, TResult> {
  abstract execute(command: TCommand): Promise<TResult>;
}
//#endregion
//#region src/application/bus/DomainEvent.d.ts
declare abstract class DomainEvent {}
//#endregion
//#region src/application/bus/DomainEventBus.d.ts
interface DomainEventBus {
  publish(event: DomainEvent): Promise<void>;
}
//#endregion
//#region src/application/bus/DomainEventHandler.d.ts
declare abstract class DomainEventHandler<TEvent extends DomainEvent> {
  abstract handle(event: TEvent): Promise<void>;
}
//#endregion
//#region src/application/bus/QueryHandler.d.ts
declare abstract class QueryHandler<TQuery extends Query<TResult>, TResult> {
  abstract execute(query: TQuery): Promise<TResult>;
}
//#endregion
//#region src/application/telemetry/TelemetrySpanPublisher.d.ts
interface TelemetrySpanPublisher {
  publishSpan(span: TelemetrySpanUpsert): Promise<void>;
}
//#endregion
//#region src/domain/workflows/WorkflowDebuggerOverlayState.d.ts
type WorkflowDebuggerOverlayState = Readonly<{
  workflowId: string;
  updatedAt: string;
  copiedFromRunId?: string;
  currentState: RunCurrentState;
}>;
//#endregion
//#region src/domain/workflows/WorkflowDebuggerOverlayRepository.d.ts
interface WorkflowDebuggerOverlayRepository {
  load(workflowId: string): Promise<WorkflowDebuggerOverlayState | undefined>;
  save(state: WorkflowDebuggerOverlayState): Promise<void>;
}
//#endregion
//#region src/audit/IAuditEmitter.d.ts
/**
 * Workspace-local audit emitter contract.
 * Mirror of the CP-side IAuditEmitter shape; kept separate to avoid cross-repo coupling.
 */
interface WorkflowAuditActor {
  readonly userId: string;
  readonly sessionId?: string;
}
interface WorkflowAuditResource {
  readonly type: string;
  readonly id: string;
}
interface WorkflowAuditEntry {
  readonly id: string;
  readonly occurredAt: string;
  readonly actor: WorkflowAuditActor;
  readonly action: string;
  readonly resource: WorkflowAuditResource;
  readonly outcome: "success" | "failure";
  readonly errorCode?: string;
  readonly correlationId?: string;
  /** Denormalised on every row for query convenience. */
  readonly workflowId: string;
  readonly runId?: string;
  readonly nodeId?: string;
}
interface IWorkflowAuditEmitter {
  emit(entry: WorkflowAuditEntry): Promise<void>;
}
//#endregion
//#region src/applicationTokens.d.ts
declare const ApplicationTokens: {
  readonly CodemationAuthConfig: TypeToken<CodemationAuthConfig | undefined>;
  readonly CodemationWhitelabelConfig: TypeToken<CodemationWhitelabelConfig>;
  readonly AppConfig: TypeToken<AppConfig>;
  readonly WebSocketPort: TypeToken<number>;
  readonly WebSocketBindHost: TypeToken<string>;
  readonly QueryBus: TypeToken<QueryBus>;
  readonly CommandBus: TypeToken<CommandBus>;
  readonly DomainEventBus: TypeToken<DomainEventBus>;
  readonly QueryHandler: TypeToken<QueryHandler<Query<unknown>, unknown>>;
  readonly CommandHandler: TypeToken<CommandHandler<Command<unknown>, unknown>>;
  readonly DomainEventHandler: TypeToken<DomainEventHandler<DomainEvent>>;
  readonly HonoApiRouteRegistrar: TypeToken<HonoApiRouteRegistrar>;
  readonly InternalHonoApiRouteRegistrar: TypeToken<InternalHonoApiRouteRegistrar>;
  readonly ManagedCorsMiddleware: TypeToken<ManagedCorsMiddleware>;
  readonly WebsocketAuthenticator: TypeToken<WebsocketAuthenticator | null>;
  readonly WorkflowWebsocketPublisher: TypeToken<WorkflowWebsocketPublisher>;
  readonly TelemetrySpanPublisher: TypeToken<TelemetrySpanPublisher>;
  readonly WorkerRuntimeScheduler: TypeToken<WorkerRuntimeScheduler>;
  readonly WorkflowDefinitionRepository: TypeToken<WorkflowDefinitionRepository>;
  readonly WorkflowActivationRepository: TypeToken<WorkflowActivationRepository>;
  readonly WorkflowDebuggerOverlayRepository: TypeToken<WorkflowDebuggerOverlayRepository>;
  readonly WorkflowRunRepository: TypeToken<WorkflowRunRepository>;
  readonly LoggerFactory: TypeToken<LoggerFactory>;
  /**
   * Opt-in timing/diagnostics logger (`CODEMATION_PERFORMANCE_LOGGING` + normal minimum log level).
   */
  readonly PerformanceDiagnosticsLogger: TypeToken<Logger>;
  readonly CredentialStore: TypeToken<CredentialStore>;
  readonly RunTraceContextRepository: TypeToken<RunTraceContextRepository>;
  readonly TelemetrySpanStore: TypeToken<TelemetrySpanStore>;
  readonly TelemetryArtifactStore: TypeToken<TelemetryArtifactStore>;
  readonly TelemetryMetricPointStore: TypeToken<TelemetryMetricPointStore>;
  readonly TelemetryExporter: TypeToken<TelemetryExporter>;
  readonly PrismaClient: TypeToken<PrismaDatabaseClient>;
  readonly SessionVerifier: TypeToken<SessionVerifier>;
  readonly Clock: TypeToken<Clock>;
  readonly WorkflowAuditEmitter: TypeToken<IWorkflowAuditEmitter>;
  readonly ProcessRunner: TypeToken<ProcessRunner>;
  readonly OAuthFlowExecutor: TypeToken<OAuthFlowExecutor>;
  /**
   * The provider that `CachingCredentialMaterialProvider` wraps. Bound to
   * `LocalCredentialMaterialProvider` in standalone mode and to
   * `CompositeCredentialMaterialProvider` in managed mode (which dispatches
   * by `ref.source`). See `packages/host/src/credentials/` and
   * `planning/sprints/credentials-vault/02-controlplane-material-provider.md`.
   */
  readonly CredentialMaterialInnerProvider: TypeToken<CredentialMaterialProvider>;
};
//#endregion
//#region src/bootstrap/CodemationBootstrapRequest.d.ts
declare class CodemationBootstrapRequest {
  readonly consumerRoot: string;
  readonly repoRoot: string;
  readonly workflowSources: ReadonlyArray<string>;
  readonly env?: Readonly<NodeJS.ProcessEnv>;
  constructor(args: Readonly<{
    consumerRoot: string;
    repoRoot: string;
    workflowSources?: ReadonlyArray<string>;
    env?: Readonly<NodeJS.ProcessEnv>;
  }>);
  resolveEnvironment(): NodeJS.ProcessEnv;
}
//#endregion
//#region src/presentation/config/CodemationPluginListMerger.d.ts
/**
 * Merges explicitly configured plugins with auto-discovered plugins.
 * Configured plugins are applied first; discovered plugins fill in gaps.
 * Plugins discovered from package.json manifests are deduped by npm package name so the same package is not
 * registered twice when the consumer config lists a discovered plugin explicitly and auto-discovery also finds it.
 */
declare class CodemationPluginListMerger {
  private readonly packageMetadata;
  constructor(packageMetadata: CodemationPluginPackageMetadata);
  merge(configuredPlugins: ReadonlyArray<CodemationPlugin>, discoveredPlugins: ReadonlyArray<CodemationPlugin>): ReadonlyArray<CodemationPlugin>;
  private tryAdd;
}
//#endregion
export { Command as C, CommandBus as S, AppContainerLifecycle as _, CodemationHonoApiApp as a, QueryBus as b, SessionVerifier as c, WorkflowRunRetentionPruneScheduler as d, ServerLoggerFactory as f, DatabaseMigrations as g, CollectionSchemaSyncerHolder as h, WorkflowDebuggerOverlayRepository as i, WorkerRuntime as l, WorkflowRunRepository as m, CodemationBootstrapRequest as n, BinaryHttpRouteHandler as o, LogFilter as p, ApplicationTokens as r, ServerHttpRouteParams as s, CodemationPluginListMerger as t, FrontendRuntime as u, AppContainerFactory as v, Query as x, WorkflowWebsocketServer as y };
//# sourceMappingURL=CodemationPluginListMerger-DS6I3Xe0.d.ts.map