import { a as CollectionDefinition, o as DefinedCollection } from "./index-ChIfeWzk.js";
import { A as WorkflowDefinition, G as TypeToken, K as EngineExecutionLimitsPolicyConfig, W as Container, nt as McpServerDeclaration, rt as AnyCredentialType } from "./ItemsInputNormalizer-CFkfNMLt.js";
import { a as CodemationAuthConfig, n as CodemationLogConfig, t as CodemationWhitelabelConfig, u as LoggerFactory } from "./CodemationWhitelabelConfig-Ca2mCUeC.js";

//#region src/presentation/config/CodemationClassToken.d.ts
type CodemationClassToken<TValue> = TypeToken<TValue> & (new (...args: never[]) => TValue);
//#endregion
//#region src/bootstrap/CodemationContainerRegistration.d.ts
interface CodemationContainerRegistrationBase<TValue> {
  readonly token: TypeToken<TValue>;
}
interface CodemationValueRegistration<TValue> extends CodemationContainerRegistrationBase<TValue> {
  readonly useValue: TValue;
}
interface CodemationClassRegistration<TValue> extends CodemationContainerRegistrationBase<TValue> {
  readonly useClass: CodemationClassToken<TValue>;
}
interface CodemationFactoryRegistration<TValue> extends CodemationContainerRegistrationBase<TValue> {
  readonly useFactory: (container: Container) => TValue;
}
type CodemationContainerRegistration<TValue = unknown> = CodemationValueRegistration<TValue> | CodemationClassRegistration<TValue> | CodemationFactoryRegistration<TValue>;
//#endregion
//#region src/presentation/config/CodemationWorkflowDiscovery.d.ts
interface CodemationWorkflowDiscovery {
  readonly directories?: ReadonlyArray<string>;
}
//#endregion
//#region src/presentation/config/CodemationConfig.d.ts
type CodemationEventBusKind = "memory" | "redis";
type CodemationSchedulerKind = "local" | "bullmq";
type CodemationDatabaseKind = "postgresql" | "sqlite";
interface CodemationDatabaseConfig {
  readonly kind?: CodemationDatabaseKind;
  /** TCP PostgreSQL URL when `kind` is `postgresql` (or omitted with a postgres URL). */
  readonly url?: string;
  /** SQLite database file path when `kind` is `sqlite`. Relative paths resolve from the consumer app root. */
  readonly sqliteFilePath?: string;
}
interface CodemationEventBusConfig {
  readonly kind?: CodemationEventBusKind;
  readonly redisUrl?: string;
  readonly queuePrefix?: string;
}
interface CodemationSchedulerConfig {
  readonly kind?: CodemationSchedulerKind;
  readonly queuePrefix?: string;
  readonly workerQueues?: ReadonlyArray<string>;
}
type CodemationAppSchedulerKind = "inline" | "queue";
interface CodemationAppSchedulerConfig {
  readonly kind?: CodemationAppSchedulerKind;
  readonly queuePrefix?: string;
  readonly workerQueues?: ReadonlyArray<string>;
  readonly redisUrl?: string;
}
/**
 * Optional overrides for engine execution limits (activation budget and subworkflow depth caps).
 * Omitted fields keep framework defaults. Advanced users can bind `CoreTokens.EngineExecutionLimitsPolicy` for full control.
 */
type CodemationEngineExecutionLimitsConfig = Readonly<Partial<EngineExecutionLimitsPolicyConfig>>;
interface CodemationAppDefinition {
  readonly frontendPort?: number;
  readonly databaseUrl?: string;
  readonly database?: CodemationDatabaseConfig;
  readonly scheduler?: CodemationAppSchedulerConfig;
  readonly auth?: CodemationAuthConfig;
  readonly whitelabel?: CodemationWhitelabelConfig;
  readonly log?: CodemationLogConfig;
  readonly engineExecutionLimits?: CodemationEngineExecutionLimitsConfig;
}
interface CodemationApplicationRuntimeConfig {
  readonly frontendPort?: number;
  readonly database?: CodemationDatabaseConfig;
  readonly eventBus?: CodemationEventBusConfig;
  readonly scheduler?: CodemationSchedulerConfig;
  /** Merged with engine defaults when building the execution limits policy (API + workers). */
  readonly engineExecutionLimits?: CodemationEngineExecutionLimitsConfig;
}
interface CodemationConfig {
  readonly app?: CodemationAppDefinition;
  /**
   * Reserved compatibility-date field. Declares the Codemation framework version this workspace
   * targets. Logged at INFO level on boot. No enforcement in 1.0.0.
   * See backlog/codemation-version-compatibility-gate.md.
   */
  readonly codemationVersion?: string;
  readonly register?: (context: CodemationAppContext) => void;
  readonly runtime?: CodemationApplicationRuntimeConfig;
  readonly workflows?: ReadonlyArray<WorkflowDefinition>;
  readonly workflowDiscovery?: CodemationWorkflowDiscovery;
  readonly plugins?: ReadonlyArray<CodemationPlugin>;
  /** Consumer-defined `CredentialType` entries (see `@codemation/core`), applied when the host loads config. */
  readonly credentialTypes?: ReadonlyArray<AnyCredentialType>;
  /** MCP server declarations from this config file (merged with plugin and control-plane sources at startup). */
  readonly mcpServers?: ReadonlyArray<McpServerDeclaration>;
  /** Declared collections available at runtime via `ctx.collections`. Accepts either raw `CollectionDefinition` or `DefinedCollection` (the result of `defineCollection(...)`). */
  readonly collections?: ReadonlyArray<CollectionDefinition | DefinedCollection>;
  /** Optional shell whitelabel (product name, logo path). */
  readonly whitelabel?: CodemationWhitelabelConfig;
  /** Required for production hosts; optional only when using development bypass (never in production). */
  readonly auth?: CodemationAuthConfig;
  /**
   * Namespace-level log filters (first matching rule wins). Unmatched namespaces use `CODEMATION_LOG_LEVEL` / defaults.
   * Omit to keep env-only behavior.
   */
  readonly log?: CodemationLogConfig;
}
//#endregion
//#region src/presentation/config/CodemationPlugin.d.ts
interface CodemationPluginContext extends CodemationRegistrationContextBase {
  readonly container: Container;
  readonly appConfig: AppConfig;
  readonly loggerFactory: LoggerFactory;
}
interface CodemationPluginConfig {
  readonly pluginPackageId?: string;
  readonly credentialTypes?: ReadonlyArray<AnyCredentialType>;
  readonly mcpServers?: ReadonlyArray<McpServerDeclaration>;
  readonly register?: (context: CodemationPluginContext) => void | Promise<void>;
  readonly sandbox?: CodemationConfig;
}
type CodemationPlugin = CodemationPluginConfig;
declare class CodemationPluginPackageMetadata {
  private static readonly packageNameSymbol;
  attachPackageName(plugin: CodemationPlugin, packageName: string): CodemationPlugin;
  readPackageName(plugin: CodemationPlugin): string | undefined;
}
//#endregion
//#region src/presentation/config/AppConfig.d.ts
type AppPersistenceConfig = Readonly<{
  kind: "none";
}> | Readonly<{
  kind: "postgresql";
  databaseUrl: string;
}> | Readonly<{
  kind: "sqlite";
  databaseFilePath: string;
}>;
type AppPluginLoadSummary = Readonly<{
  packageName: string;
  source: "configured" | "discovered";
}>;
interface AppConfig {
  readonly consumerRoot: string;
  readonly repoRoot: string;
  readonly env: Readonly<NodeJS.ProcessEnv>;
  readonly workflowSources: ReadonlyArray<string>;
  readonly workflows: ReadonlyArray<WorkflowDefinition>;
  readonly containerRegistrations: ReadonlyArray<CodemationContainerRegistration<unknown>>;
  readonly credentialTypes: ReadonlyArray<AnyCredentialType>;
  readonly collections: ReadonlyArray<CollectionDefinition>;
  readonly plugins: ReadonlyArray<CodemationPlugin>;
  readonly pluginLoadSummary?: ReadonlyArray<AppPluginLoadSummary>;
  readonly mcpServers: ReadonlyArray<McpServerDeclaration>;
  readonly hasConfiguredCredentialSessionServiceRegistration: boolean;
  readonly log?: CodemationLogConfig;
  readonly engineExecutionLimits?: CodemationEngineExecutionLimitsConfig;
  readonly databaseUrl?: string;
  readonly database?: CodemationDatabaseConfig;
  readonly persistence: AppPersistenceConfig;
  readonly scheduler: Readonly<{
    kind: CodemationSchedulerKind;
    queuePrefix?: string;
    workerQueues: ReadonlyArray<string>;
    redisUrl?: string;
  }>;
  readonly eventing: Readonly<{
    kind: CodemationEventBusKind;
    queuePrefix?: string;
    redisUrl?: string;
  }>;
  readonly auth?: CodemationAuthConfig;
  readonly whitelabel: CodemationWhitelabelConfig;
  readonly webSocketPort: number;
  readonly webSocketBindHost: string;
}
//#endregion
//#region src/presentation/config/CodemationAppContext.d.ts
interface CodemationRegistrationContextBase {
  readonly appConfig?: AppConfig;
  registerCredentialType(type: AnyCredentialType): void;
  registerCollection(definition: CollectionDefinition): void;
  registerNode<TValue>(token: TypeToken<TValue>, implementation?: CodemationClassToken<TValue>): void;
  registerValue<TValue>(token: TypeToken<TValue>, value: TValue): void;
  registerClass<TValue>(token: TypeToken<TValue>, implementation: CodemationClassToken<TValue>): void;
  registerFactory<TValue>(token: TypeToken<TValue>, factory: (container: Container) => TValue): void;
}
interface CodemationAppContext extends CodemationRegistrationContextBase {
  registerWorkflow(workflow: WorkflowDefinition): void;
  registerWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void;
  discoverWorkflows(...directories: ReadonlyArray<string>): void;
}
//#endregion
export { CodemationContainerRegistration as C, CodemationWorkflowDiscovery as S, CodemationEngineExecutionLimitsConfig as _, AppPluginLoadSummary as a, CodemationSchedulerConfig as b, CodemationPluginContext as c, CodemationAppSchedulerConfig as d, CodemationAppSchedulerKind as f, CodemationDatabaseKind as g, CodemationDatabaseConfig as h, AppPersistenceConfig as i, CodemationPluginPackageMetadata as l, CodemationConfig as m, CodemationRegistrationContextBase as n, CodemationPlugin as o, CodemationApplicationRuntimeConfig as p, AppConfig as r, CodemationPluginConfig as s, CodemationAppContext as t, CodemationAppDefinition as u, CodemationEventBusConfig as v, CodemationClassToken as w, CodemationSchedulerKind as x, CodemationEventBusKind as y };
//# sourceMappingURL=CodemationAppContext-K51b7oXe.d.ts.map