import { o as DefinedCollection } from "./index-ChIfeWzk.js";
import { $ as DefinedNode, A as WorkflowDefinition, G as TypeToken, O as RunnableNodeConfig, Q as AnyRunnableNodeConfig, S as NodeInspectorSummaryRow, Z as ChainCursor, _ as Item, c as NodeExecutionContext, et as DefinedNodeConfigInput, i as ToolConfig, k as RunnableNodeOutputJson, n as AgentMessageConfig, nt as McpServerDeclaration, r as ChatModelConfig, rt as AnyCredentialType, t as AgentGuardrailConfig, ut as CredentialJsonRecord, v as Items } from "./ItemsInputNormalizer-CFkfNMLt.js";
import { c as CodemationPluginContext, m as CodemationConfig, o as CodemationPlugin, t as CodemationAppContext } from "./CodemationAppContext-K51b7oXe.js";
import { t as CodemationWhitelabelConfig } from "./CodemationWhitelabelConfig-Ca2mCUeC.js";
import { ZodType, z } from "zod";
import "ai";

//#region ../core-nodes/src/nodes/aggregate.d.ts
declare class Aggregate<TIn = unknown, TOut = unknown> implements RunnableNodeConfig<TIn, TOut> {
  readonly name: string;
  readonly aggregate: (items: Items<TIn>, ctx: NodeExecutionContext<Aggregate<TIn, TOut>>) => TOut | Promise<TOut>;
  readonly id?: string | undefined;
  readonly kind: "node";
  readonly type: TypeToken<unknown>;
  readonly execution: {
    readonly hint: "local";
  };
  readonly keepBinaries: true;
  readonly icon: "builtin:aggregate-rows";
  constructor(name: string, aggregate: (items: Items<TIn>, ctx: NodeExecutionContext<Aggregate<TIn, TOut>>) => TOut | Promise<TOut>, id?: string | undefined);
  inspectorSummary(): ReadonlyArray<NodeInspectorSummaryRow> | undefined;
}
//#endregion
//#region ../core-nodes/src/nodes/filter.d.ts
declare class Filter<TIn = unknown> implements RunnableNodeConfig<TIn, TIn> {
  readonly name: string;
  readonly predicate: (item: Item<TIn>, index: number, items: Items<TIn>, ctx: NodeExecutionContext<Filter<TIn>>) => boolean;
  readonly id?: string | undefined;
  readonly kind: "node";
  readonly type: TypeToken<unknown>;
  readonly execution: {
    readonly hint: "local";
  };
  readonly icon: "lucide:filter";
  constructor(name: string, predicate: (item: Item<TIn>, index: number, items: Items<TIn>, ctx: NodeExecutionContext<Filter<TIn>>) => boolean, id?: string | undefined);
  inspectorSummary(): ReadonlyArray<NodeInspectorSummaryRow> | undefined;
}
//#endregion
//#region ../core-nodes/src/nodes/if.d.ts
declare class If<TInputJson = unknown> implements RunnableNodeConfig<TInputJson, TInputJson> {
  readonly name: string;
  readonly predicate: (item: Item<TInputJson>, index: number, items: Items<TInputJson>, ctx: NodeExecutionContext<If<TInputJson>>) => boolean;
  readonly id?: string | undefined;
  readonly kind: "node";
  readonly type: TypeToken<unknown>;
  readonly execution: {
    readonly hint: "local";
  };
  readonly icon: "lucide:split@rot=90";
  readonly declaredOutputPorts: readonly ["true", "false"];
  constructor(name: string, predicate: (item: Item<TInputJson>, index: number, items: Items<TInputJson>, ctx: NodeExecutionContext<If<TInputJson>>) => boolean, id?: string | undefined);
  inspectorSummary(): ReadonlyArray<NodeInspectorSummaryRow> | undefined;
}
//#endregion
//#region ../core-nodes/src/nodes/switch.d.ts
type SwitchCaseKeyResolver<TInputJson = unknown> = (item: Item<TInputJson>, index: number, items: Items<TInputJson>, ctx: NodeExecutionContext<Switch<TInputJson>>) => string | Promise<string>;
declare class Switch<TInputJson = unknown> implements RunnableNodeConfig<TInputJson, TInputJson> {
  readonly name: string;
  readonly cfg: Readonly<{
    cases: readonly string[];
    defaultCase: string;
    resolveCaseKey: SwitchCaseKeyResolver<TInputJson>;
  }>;
  readonly id?: string | undefined;
  readonly kind: "node";
  readonly type: TypeToken<unknown>;
  readonly execution: {
    readonly hint: "local";
  };
  readonly icon: "lucide:git-branch-plus";
  readonly declaredOutputPorts: ReadonlyArray<string>;
  constructor(name: string, cfg: Readonly<{
    cases: readonly string[];
    defaultCase: string;
    resolveCaseKey: SwitchCaseKeyResolver<TInputJson>;
  }>, id?: string | undefined);
  inspectorSummary(): ReadonlyArray<NodeInspectorSummaryRow>;
}
//#endregion
//#region ../core-nodes/src/nodes/split.d.ts
declare class Split<TIn = unknown, TElem = unknown> implements RunnableNodeConfig<TIn, TElem> {
  readonly name: string;
  readonly getElements: (item: Item<TIn>, ctx: NodeExecutionContext<Split<TIn, TElem>>) => readonly TElem[];
  readonly id?: string | undefined;
  readonly kind: "node";
  readonly type: TypeToken<unknown>;
  readonly execution: {
    readonly hint: "local";
  };
  readonly keepBinaries: true;
  /**
   * When splitting yields zero items for a batch, downstream single-input nodes still run once with an empty batch.
   * Mirrors {@link MapData}'s empty-output behavior.
   */
  readonly continueWhenEmptyOutput: true;
  readonly icon: "builtin:split-rows";
  constructor(name: string, getElements: (item: Item<TIn>, ctx: NodeExecutionContext<Split<TIn, TElem>>) => readonly TElem[], id?: string | undefined);
  inspectorSummary(): ReadonlyArray<NodeInspectorSummaryRow> | undefined;
}
//#endregion
//#region ../core-nodes/src/nodes/mapData.d.ts
interface MapDataOptions {
  readonly id?: string;
  readonly keepBinaries?: boolean;
}
declare class MapData<TInputJson = unknown, TOutputJson = unknown> implements RunnableNodeConfig<TInputJson, TOutputJson> {
  readonly name: string;
  readonly map: (item: Item<TInputJson>, ctx: NodeExecutionContext<MapData<TInputJson, TOutputJson>>) => TOutputJson;
  private readonly options;
  readonly kind: "node";
  readonly type: TypeToken<unknown>;
  readonly execution: {
    readonly hint: "local";
  };
  /** Zero mapped items should still allow downstream nodes to run. */
  readonly continueWhenEmptyOutput: true;
  readonly icon: "lucide:square-pen";
  readonly keepBinaries: boolean;
  constructor(name: string, map: (item: Item<TInputJson>, ctx: NodeExecutionContext<MapData<TInputJson, TOutputJson>>) => TOutputJson, options?: MapDataOptions);
  get id(): string | undefined;
  inspectorSummary(): ReadonlyArray<NodeInspectorSummaryRow> | undefined;
}
//#endregion
//#region ../core-nodes/src/nodes/merge.d.ts
type MergeMode = "passThrough" | "append" | "mergeByPosition";
//#endregion
//#region ../core-nodes/src/workflowAuthoring/WorkflowAuthoringOptions.types.d.ts
type WorkflowAgentMessages<TCurrentJson> = AgentMessageConfig<TCurrentJson>;
interface WorkflowAgentOptions<TCurrentJson, TOutputSchema extends z.ZodTypeAny | undefined = undefined> {
  readonly messages: WorkflowAgentMessages<TCurrentJson>;
  readonly model: string | ChatModelConfig;
  readonly tools?: ReadonlyArray<ToolConfig>;
  readonly outputSchema?: TOutputSchema;
  readonly retryPolicy?: RunnableNodeConfig["retryPolicy"];
  readonly guardrails?: AgentGuardrailConfig;
  readonly id?: string;
}
//#endregion
//#region ../core-nodes/src/workflowAuthoring/WorkflowBranchBuilder.types.d.ts
type WorkflowMapCallback$1<TCurrentJson, TNextJson> = (item: Item<TCurrentJson>, ctx: NodeExecutionContext<MapData<TCurrentJson, TNextJson>>) => TNextJson;
declare class WorkflowBranchBuilder<TCurrentJson> {
  private readonly steps;
  constructor(steps?: ReadonlyArray<AnyRunnableNodeConfig>);
  then<TOutputJson, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson>>(config: TConfig): WorkflowBranchBuilder<RunnableNodeOutputJson<TConfig>>;
  map<TNextJson>(mapper: WorkflowMapCallback$1<TCurrentJson, TNextJson>): WorkflowBranchBuilder<TNextJson>;
  map<TNextJson>(name: string, mapper: WorkflowMapCallback$1<TCurrentJson, TNextJson>, options?: MapDataOptions): WorkflowBranchBuilder<TNextJson>;
  wait(duration: number | string): WorkflowBranchBuilder<TCurrentJson>;
  wait(name: string, duration: number | string, id?: string): WorkflowBranchBuilder<TCurrentJson>;
  split<TElem>(getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[]): WorkflowBranchBuilder<TElem>;
  split<TElem>(name: string, getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[], id?: string): WorkflowBranchBuilder<TElem>;
  filter(predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean): WorkflowBranchBuilder<TCurrentJson>;
  filter(name: string, predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean, id?: string): WorkflowBranchBuilder<TCurrentJson>;
  aggregate<TOut>(aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>): WorkflowBranchBuilder<TOut>;
  aggregate<TOut>(name: string, aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>, id?: string): WorkflowBranchBuilder<TOut>;
  agent<TOutputSchema extends z.ZodTypeAny>(options: WorkflowAgentOptions<TCurrentJson, TOutputSchema>): WorkflowBranchBuilder<z.output<TOutputSchema>>;
  agent(options: WorkflowAgentOptions<TCurrentJson, undefined>): WorkflowBranchBuilder<Record<string, unknown>>;
  agent<TOutputSchema extends z.ZodTypeAny>(name: string, options: WorkflowAgentOptions<TCurrentJson, TOutputSchema | undefined>): WorkflowBranchBuilder<TOutputSchema extends z.ZodTypeAny ? z.output<TOutputSchema> : Record<string, unknown>>;
  node<TConfig extends CredentialJsonRecord, TInputJson, TOutputJson>(definitionOrKey: DefinedNode<string, TConfig, TInputJson, TOutputJson> | string, config: DefinedNodeConfigInput<TConfig, TCurrentJson>, name?: string, id?: string): TCurrentJson extends TInputJson ? WorkflowBranchBuilder<TOutputJson> : never;
  getSteps(): ReadonlyArray<AnyRunnableNodeConfig>;
}
//#endregion
//#region ../core-nodes/src/workflowAuthoring/WorkflowChain.types.d.ts
type BranchCallback<TCurrentJson, TNextJson> = (branch: WorkflowBranchBuilder<TCurrentJson>) => WorkflowBranchBuilder<TNextJson>;
type RouteBranchCallback<TCurrentJson, TNextJson> = (branch: WorkflowChain<TCurrentJson>) => WorkflowChain<TNextJson>;
type WorkflowMapCallback<TCurrentJson, TNextJson> = (item: Item<TCurrentJson>, ctx: NodeExecutionContext<MapData<TCurrentJson, TNextJson>>) => TNextJson;
type WorkflowIfPredicate<TCurrentJson> = (item: Item<TCurrentJson>, ctx: NodeExecutionContext<If<TCurrentJson>>) => boolean;
type WorkflowSwitchCaseKeyResolver<TCurrentJson> = (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Switch<TCurrentJson>>) => string | Promise<string>;
declare class WorkflowChain<TCurrentJson> {
  private readonly chain;
  constructor(chain: ChainCursor<TCurrentJson>);
  then<TOutputJson, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson>>(config: TConfig): WorkflowChain<RunnableNodeOutputJson<TConfig>>;
  map<TNextJson>(mapper: WorkflowMapCallback<TCurrentJson, TNextJson>): WorkflowChain<TNextJson>;
  map<TNextJson>(name: string, mapper: WorkflowMapCallback<TCurrentJson, TNextJson>, options?: MapDataOptions): WorkflowChain<TNextJson>;
  wait(duration: number | string): WorkflowChain<TCurrentJson>;
  wait(name: string, duration: number | string, id?: string): WorkflowChain<TCurrentJson>;
  split<TElem>(getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[]): WorkflowChain<TElem>;
  split<TElem>(name: string, getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[], id?: string): WorkflowChain<TElem>;
  filter(predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean): WorkflowChain<TCurrentJson>;
  filter(name: string, predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean, id?: string): WorkflowChain<TCurrentJson>;
  aggregate<TOut>(aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>): WorkflowChain<TOut>;
  aggregate<TOut>(name: string, aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>, id?: string): WorkflowChain<TOut>;
  merge(): WorkflowChain<TCurrentJson>;
  merge(cfg: Readonly<{
    mode: MergeMode;
    prefer?: ReadonlyArray<string>;
  }>, id?: string): WorkflowChain<TCurrentJson>;
  merge(name: string, cfg?: Readonly<{
    mode: MergeMode;
    prefer?: ReadonlyArray<string>;
  }>, id?: string): WorkflowChain<TCurrentJson>;
  if<TBranchJson>(predicate: WorkflowIfPredicate<TCurrentJson>, branches: Readonly<{
    true?: BranchCallback<TCurrentJson, TBranchJson>;
    false?: BranchCallback<TCurrentJson, TBranchJson>;
  }>): WorkflowChain<TBranchJson>;
  if<TBranchJson>(name: string, predicate: WorkflowIfPredicate<TCurrentJson>, branches: Readonly<{
    true?: BranchCallback<TCurrentJson, TBranchJson>;
    false?: BranchCallback<TCurrentJson, TBranchJson>;
  }>): WorkflowChain<TBranchJson>;
  route<TBranchJson>(branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>): WorkflowChain<TBranchJson>;
  switch<TBranchJson>(cfg: Readonly<{
    cases: readonly string[];
    defaultCase: string;
    resolveCaseKey: WorkflowSwitchCaseKeyResolver<TCurrentJson>;
    branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>;
  }>): WorkflowChain<TBranchJson>;
  switch<TBranchJson>(name: string, cfg: Readonly<{
    cases: readonly string[];
    defaultCase: string;
    resolveCaseKey: WorkflowSwitchCaseKeyResolver<TCurrentJson>;
    branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>;
  }>, id?: string): WorkflowChain<TBranchJson>;
  agent<TOutputSchema extends z.ZodTypeAny>(options: WorkflowAgentOptions<TCurrentJson, TOutputSchema>): WorkflowChain<z.output<TOutputSchema>>;
  agent(options: WorkflowAgentOptions<TCurrentJson, undefined>): WorkflowChain<Record<string, unknown>>;
  agent<TOutputSchema extends z.ZodTypeAny>(name: string, options: WorkflowAgentOptions<TCurrentJson, TOutputSchema | undefined>): WorkflowChain<TOutputSchema extends z.ZodTypeAny ? z.output<TOutputSchema> : Record<string, unknown>>;
  node<TConfig extends CredentialJsonRecord, TInputJson, TOutputJson>(definitionOrKey: DefinedNode<string, TConfig, TInputJson, TOutputJson> | string, config: DefinedNodeConfigInput<TConfig, TCurrentJson>, name?: string, id?: string): TCurrentJson extends TInputJson ? WorkflowChain<TOutputJson> : never;
  build(): WorkflowDefinition;
}
//#endregion
//#region ../core-nodes/src/workflowAuthoring/WorkflowAuthoringBuilder.types.d.ts
declare class WorkflowAuthoringBuilder {
  private readonly id;
  private readonly workflowName;
  constructor(id: string, workflowName?: string);
  name(name: string): WorkflowAuthoringBuilder;
  manualTrigger<TOutputJson>(defaultItems: TOutputJson | ReadonlyArray<TOutputJson>): WorkflowChain<TOutputJson>;
  manualTrigger<TOutputJson>(name: string, defaultItems?: TOutputJson | ReadonlyArray<TOutputJson>, id?: string): WorkflowChain<TOutputJson>;
}
//#endregion
//#region ../core-nodes/src/workflowAuthoring.types.d.ts
declare function workflow(id: string): WorkflowAuthoringBuilder;
//#endregion
//#region src/presentation/config/CodemationAuthoring.types.d.ts
interface FriendlyCodemationDatabaseConfig {
  readonly kind: "postgresql" | "sqlite";
  readonly url?: string;
  /** Name of an environment variable whose value is the PostgreSQL connection URL. Co-exclusive with `url`. */
  readonly urlEnv?: string;
  readonly filePath?: string;
}
interface FriendlyCodemationExecutionConfig {
  readonly mode?: "inline" | "queue";
  /** Name of an environment variable whose value is "inline" or "queue". Co-exclusive with `mode`. */
  readonly modeEnv?: string;
  readonly queuePrefix?: string;
  readonly workerQueues?: ReadonlyArray<string>;
  readonly redisUrl?: string;
  /** Name of an environment variable whose value is the Redis connection URL. Co-exclusive with `redisUrl`. */
  readonly redisUrlEnv?: string;
}
interface DefineCodemationAppOptions extends Omit<CodemationConfig, "app" | "credentialTypes" | "register" | "whitelabel" | "auth" | "collections"> {
  readonly name?: string;
  /**
   * Reserved compatibility-date field. Declares the Codemation framework version this workspace
   * targets. No enforcement in 1.0.0 — presence only. See backlog/codemation-version-compatibility-gate.md.
   */
  readonly codemationVersion?: string;
  readonly auth?: CodemationConfig["auth"];
  readonly database?: FriendlyCodemationDatabaseConfig;
  readonly execution?: FriendlyCodemationExecutionConfig;
  readonly nodes?: ReadonlyArray<DefinedNode<string, Record<string, unknown>, unknown, unknown>>;
  readonly collections?: ReadonlyArray<DefinedCollection>;
  readonly credentialTypes?: ReadonlyArray<AnyCredentialType>;
  readonly credentials?: ReadonlyArray<AnyCredentialType>;
  readonly register?: (context: CodemationAppContext) => void;
  readonly whitelabel?: CodemationWhitelabelConfig;
  /**
   * Path (relative to the consumer project root) to a directory from which workflows are auto-discovered.
   * All `*.ts` / `*.tsx` files (excluding `*.test.*` and `*.d.ts`) are imported and any exported
   * `WorkflowDefinition` values are registered. Co-exclusive with providing this directory in
   * `workflowDiscovery.directories`.
   */
  readonly workflowsDir?: string;
}
interface DefinePluginOptions {
  readonly name?: string;
  readonly pluginPackageId?: string;
  readonly nodes?: ReadonlyArray<DefinedNode<string, Record<string, unknown>, unknown, unknown>>;
  readonly collections?: ReadonlyArray<DefinedCollection>;
  readonly credentials?: ReadonlyArray<AnyCredentialType>;
  readonly mcpServers?: ReadonlyArray<McpServerDeclaration>;
  readonly register?: (context: CodemationPluginContext) => void | Promise<void>;
  readonly sandbox?: CodemationConfig;
}
declare function defineCodemationApp(options: DefineCodemationAppOptions): CodemationConfig;
declare function definePlugin(options: DefinePluginOptions): CodemationPlugin & Readonly<{
  sandbox?: CodemationConfig;
}>;
//#endregion
export { defineCodemationApp as a, FriendlyCodemationExecutionConfig as i, DefinePluginOptions as n, definePlugin as o, FriendlyCodemationDatabaseConfig as r, workflow as s, DefineCodemationAppOptions as t };
//# sourceMappingURL=CodemationAuthoring.types-BXlXIl4K.d.ts.map