@bratsos/workflow-engine 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +274 -513
  2. package/dist/{chunk-7IITBLFY.js → chunk-NYKMT46J.js} +268 -25
  3. package/dist/chunk-NYKMT46J.js.map +1 -0
  4. package/dist/chunk-SPXBCZLB.js +17 -0
  5. package/dist/chunk-SPXBCZLB.js.map +1 -0
  6. package/dist/chunk-WZ533CPU.js +1108 -0
  7. package/dist/chunk-WZ533CPU.js.map +1 -0
  8. package/dist/{client-5vz5Vv4A.d.ts → client-D4PoxADF.d.ts} +3 -143
  9. package/dist/client.d.ts +3 -2
  10. package/dist/{index-DmR3E8D7.d.ts → index-DAzCfO1R.d.ts} +20 -1
  11. package/dist/index.d.ts +234 -601
  12. package/dist/index.js +46 -2034
  13. package/dist/index.js.map +1 -1
  14. package/dist/{interface-Cv22wvLG.d.ts → interface-MMqhfQQK.d.ts} +69 -2
  15. package/dist/kernel/index.d.ts +26 -0
  16. package/dist/kernel/index.js +3 -0
  17. package/dist/kernel/index.js.map +1 -0
  18. package/dist/kernel/testing/index.d.ts +44 -0
  19. package/dist/kernel/testing/index.js +85 -0
  20. package/dist/kernel/testing/index.js.map +1 -0
  21. package/dist/persistence/index.d.ts +2 -2
  22. package/dist/persistence/index.js +2 -1
  23. package/dist/persistence/prisma/index.d.ts +2 -2
  24. package/dist/persistence/prisma/index.js +2 -1
  25. package/dist/plugins-CPC-X0rR.d.ts +421 -0
  26. package/dist/ports-tU3rzPXJ.d.ts +245 -0
  27. package/dist/stage-BPw7m9Wx.d.ts +144 -0
  28. package/dist/testing/index.d.ts +23 -1
  29. package/dist/testing/index.js +156 -13
  30. package/dist/testing/index.js.map +1 -1
  31. package/package.json +11 -1
  32. package/skills/workflow-engine/SKILL.md +234 -348
  33. package/skills/workflow-engine/references/03-runtime-setup.md +111 -426
  34. package/skills/workflow-engine/references/05-persistence-setup.md +32 -0
  35. package/skills/workflow-engine/references/07-testing-patterns.md +141 -474
  36. package/skills/workflow-engine/references/08-common-patterns.md +125 -428
  37. package/dist/chunk-7IITBLFY.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,633 +1,266 @@
1
- import { S as Stage, a as StageMetrics, W as WorkflowEventType, b as WorkflowSSEEvent, L as LogContext, A as AIHelper, M as ModelKey, c as LogLevel } from './client-5vz5Vv4A.js';
2
- export { d as AIBatch, e as AIBatchHandle, f as AIBatchProvider, g as AIBatchRequest, h as AIBatchResult, i as AICallType, j as AIEmbedResult, k as AIObjectResult, l as AIStreamResult, m as AITextResult, n as AVAILABLE_MODELS, o as AsyncBatchStageDefinition, B as BatchLogFn, D as DEFAULT_MODEL_KEY, E as EmbedOptions, p as EnhancedStageContext, I as InferInput, q as ModelConfig, r as ModelRegistry, s as ModelStats, t as ModelStatsTracker, u as ModelSyncConfig, N as NoInputSchema, O as ObjectOptions, R as RecordCallParams, v as SimpleStageResult, w as StageResult, x as StreamOptions, y as SyncStageDefinition, T as TextOptions, z as calculateCost, C as createAIHelper, F as defineAsyncBatchStage, G as defineStage, H as getDefaultModel, J as getModel, K as getModelById, P as getRegisteredModel, Q as listModels, U as listRegisteredModels, V as modelSupportsBatch, X as printAvailableModels, Y as registerModels, Z as requireStageOutput } from './client-5vz5Vv4A.js';
1
+ import { M as ModelKey } from './client-D4PoxADF.js';
2
+ export { A as AIBatch, a as AIBatchHandle, b as AIBatchProvider, c as AIBatchRequest, d as AIBatchResult, e as AICallType, f as AIEmbedResult, g as AIHelper, h as AIObjectResult, i as AIStreamResult, j as AITextResult, k as AVAILABLE_MODELS, l as AsyncBatchStageDefinition, B as BatchLogFn, D as DEFAULT_MODEL_KEY, E as EmbedOptions, m as EnhancedStageContext, I as InferInput, L as LogContext, n as ModelConfig, o as ModelRegistry, p as ModelStats, q as ModelStatsTracker, r as ModelSyncConfig, N as NoInputSchema, O as ObjectOptions, R as RecordCallParams, S as SimpleStageResult, s as StreamOptions, t as SyncStageDefinition, T as TextOptions, W as WorkflowEventType, u as WorkflowSSEEvent, v as calculateCost, w as createAIHelper, x as defineAsyncBatchStage, y as defineStage, z as getDefaultModel, C as getModel, F as getModelById, G as getRegisteredModel, H as listModels, J as listRegisteredModels, K as modelSupportsBatch, P as printAvailableModels, Q as registerModels, U as requireStageOutput } from './client-D4PoxADF.js';
3
+ import { L as LogLevel } from './stage-BPw7m9Wx.js';
4
+ export { S as Stage, a as StageResult } from './stage-BPw7m9Wx.js';
5
+ export { C as CommandResult, I as IdempotencyInProgressError, y as InferWorkflowStageIds, J as JobExecuteCommand, a as JobExecuteResult, b as Kernel, c as KernelCommand, d as KernelCommandType, e as KernelConfig, W as KernelWorkflowRegistry, L as LeaseReapStaleCommand, f as LeaseReapStaleResult, O as OutboxFlushCommand, g as OutboxFlushResult, P as PluginDefinition, h as PluginReplayDLQCommand, i as PluginReplayDLQResult, j as PluginRunner, k as PluginRunnerConfig, R as RunCancelCommand, l as RunCancelResult, m as RunClaimPendingCommand, n as RunClaimPendingResult, o as RunCreateCommand, p as RunCreateResult, q as RunRerunFromCommand, r as RunRerunFromResult, s as RunTransitionCommand, t as RunTransitionResult, S as StagePollSuspendedCommand, u as StagePollSuspendedResult, z as Workflow, A as WorkflowBuilder, v as createKernel, w as createPluginRunner, x as definePlugin } from './plugins-CPC-X0rR.js';
3
6
  import z$1, { z } from 'zod';
4
- import { EventEmitter } from 'node:events';
5
- import { W as WorkflowPersistence, A as AICallLogger, J as JobQueue } from './interface-Cv22wvLG.js';
6
- export { b as AICallRecord, a as AIHelperStats, p as ArtifactType, C as CreateAICallInput, m as CreateLogInput, e as CreateRunInput, h as CreateStageInput, D as DequeueResult, E as EnqueueJobInput, c as JobRecord, d as JobStatus, L as LogLevel, S as SaveArtifactInput, q as Status, U as UpdateRunInput, k as UpdateStageInput, j as UpsertStageInput, n as WorkflowArtifactRecord, o as WorkflowLogRecord, f as WorkflowRunRecord, i as WorkflowStageRecord, l as WorkflowStageStatus, g as WorkflowStatus } from './interface-Cv22wvLG.js';
7
- export { P as PrismaAICallLogger, a as PrismaJobQueue, c as PrismaWorkflowPersistence, e as createPrismaAICallLogger, f as createPrismaJobQueue, g as createPrismaWorkflowPersistence } from './index-DmR3E8D7.js';
7
+ export { A as AICallLogger, i as AICallRecord, h as AIHelperStats, r as ArtifactType, g as CreateAICallInput, f as CreateLogInput, C as CreateOutboxEventInput, a as CreateRunInput, b as CreateStageInput, D as DequeueResult, E as EnqueueJobInput, I as IdempotencyRecord, J as JobQueue, j as JobRecord, k as JobStatus, L as LogLevel, O as OutboxRecord, o as SaveArtifactInput, s as StaleVersionError, S as Status, U as UpdateRunInput, e as UpdateStageInput, d as UpsertStageInput, p as WorkflowArtifactRecord, q as WorkflowLogRecord, l as WorkflowPersistence, W as WorkflowRunRecord, c as WorkflowStageRecord, n as WorkflowStageStatus, m as WorkflowStatus } from './interface-MMqhfQQK.js';
8
+ export { P as PrismaAICallLogger, a as PrismaJobQueue, c as PrismaWorkflowPersistence, e as createPrismaAICallLogger, f as createPrismaJobQueue, g as createPrismaWorkflowPersistence } from './index-DAzCfO1R.js';
8
9
  import { ToolSet } from 'ai';
10
+ export { B as BlobStore, C as Clock, E as EventSink, J as JobTransport, K as KernelEvent, a as KernelEventType, P as Persistence, S as Scheduler } from './ports-tU3rzPXJ.js';
9
11
 
10
12
  /**
11
- * Workflow Builder - Fluent API for composing type-safe workflows
13
+ * Config Presets - Common configuration patterns for workflow stages
12
14
  *
13
- * Workflows are composed of stages that are executed sequentially or in parallel.
14
- * The builder ensures type safety: output of one stage matches input of next stage.
15
- *
16
- * ## Type System Features
17
- *
18
- * ### Automatic Context Inference
19
- * The workflow context type is automatically accumulated as you pipe stages.
20
- * Use `InferWorkflowContext<typeof workflow>` to extract the context type.
21
- *
22
- * ```typescript
23
- * const workflow = new WorkflowBuilder(...)
24
- * .pipe(stage1)
25
- * .pipe(stage2)
26
- * .build();
27
- *
28
- * // Auto-generated type
29
- * type MyContext = InferWorkflowContext<typeof workflow>;
30
- * // = { "stage-1": Stage1Output, "stage-2": Stage2Output }
31
- * ```
32
- *
33
- * ### Stage ID Constants
34
- * Use `workflow.stageIds` for type-safe stage ID references.
35
- */
36
-
37
- interface StageNode {
38
- stage: Stage<any, any, any>;
39
- executionGroup: number;
40
- }
41
- declare class Workflow<TInput extends z.ZodTypeAny, TOutput extends z.ZodTypeAny, TContext extends Record<string, unknown> = {}> {
42
- readonly id: string;
43
- readonly name: string;
44
- readonly description: string;
45
- readonly inputSchema: TInput;
46
- readonly outputSchema: TOutput;
47
- private readonly stages;
48
- readonly contextType?: TContext | undefined;
49
- constructor(id: string, name: string, description: string, inputSchema: TInput, outputSchema: TOutput, stages: StageNode[], contextType?: TContext | undefined);
50
- /**
51
- * Get execution plan as groups of stages
52
- * Stages in the same group can be executed in parallel
53
- */
54
- getExecutionPlan(): StageNode[][];
55
- /**
56
- * Get a specific stage by ID
57
- */
58
- getStage(stageId: string): Stage<any, any, any> | undefined;
59
- /**
60
- * Get all stages in order
61
- */
62
- getAllStages(): StageNode[];
63
- /**
64
- * Get a visual representation of the workflow execution order
65
- */
66
- getExecutionOrder(): string;
67
- /**
68
- * Get all stage IDs in execution order
69
- *
70
- * @returns Array of stage IDs
71
- *
72
- * @example
73
- * ```typescript
74
- * const ids = workflow.getStageIds();
75
- * // ["data-extraction", "guidelines", "generator"]
76
- * ```
77
- */
78
- getStageIds(): string[];
79
- /**
80
- * Check if a stage ID exists in this workflow
81
- *
82
- * @param stageId - The stage ID to check
83
- * @returns true if the stage exists
84
- */
85
- hasStage(stageId: string): boolean;
86
- /**
87
- * Validate workflow configuration before execution
88
- * Checks that all stage configs match their schemas
89
- *
90
- * @param config - Configuration object with keys matching stage IDs
91
- * @returns Validation result with any errors
92
- */
93
- validateConfig(config: Record<string, unknown>): {
94
- valid: boolean;
95
- errors: Array<{
96
- stageId: string;
97
- error: string;
98
- }>;
99
- };
100
- /**
101
- * Estimate total cost for the workflow
102
- */
103
- estimateCost(input: z.infer<TInput>, config: Record<string, unknown>): number;
104
- /**
105
- * Get configuration schemas for all stages in this workflow
106
- * Returns a map of stageId → { schema, defaults, name, description }
107
- */
108
- getStageConfigs(): Record<string, {
109
- schema: z.ZodTypeAny;
110
- defaults: Record<string, unknown>;
111
- name: string;
112
- description?: string;
113
- }>;
114
- /**
115
- * Generate default configuration object for all stages
116
- * Automatically discovers all stage configs - add/remove stages and this updates automatically
117
- */
118
- getDefaultConfig(): Record<string, Record<string, unknown>>;
119
- /**
120
- * Get all stages in a specific execution group
121
- */
122
- getStagesInExecutionGroup(groupIndex: number): Stage<any, any, any>[];
123
- /**
124
- * Get the sequential index of a stage (0-based)
125
- */
126
- getStageIndex(stageId: string): number;
127
- /**
128
- * Get the execution group index for a stage
129
- */
130
- getExecutionGroupIndex(stageId: string): number;
131
- /**
132
- * Get the ID of the stage immediately preceding the given stage
133
- */
134
- getPreviousStageId(stageId: string): string | undefined;
135
- }
136
- declare class WorkflowBuilder<TInput extends z.ZodTypeAny, TCurrentOutput extends z.ZodTypeAny, TContext extends Record<string, unknown> = {}> {
137
- private id;
138
- private name;
139
- private description;
140
- private inputSchema;
141
- private currentOutputSchema;
142
- private stages;
143
- private currentExecutionGroup;
144
- constructor(id: string, name: string, description: string, inputSchema: TInput, currentOutputSchema: TCurrentOutput);
145
- /**
146
- * Add a stage to the workflow (sequential execution)
147
- *
148
- * Automatically accumulates the stage's output in the context under its stage ID.
149
- * This provides type-safe access to all previous stage outputs.
150
- *
151
- * Note: This accepts any stage regardless of strict input type matching.
152
- * This is necessary because stages using passthrough() can accept objects
153
- * with additional fields beyond what's declared in their input schema.
154
- * Runtime validation via Zod ensures type safety at execution time.
155
- *
156
- * Validates that all declared dependencies exist in the workflow.
157
- */
158
- pipe<TStageInput extends z.ZodTypeAny, TStageOutput extends z.ZodTypeAny, TStageConfig extends z.ZodTypeAny, TStageContext extends Record<string, unknown>>(stage: Stage<TStageInput, TStageOutput, TStageConfig, TStageContext>): WorkflowBuilder<TInput, TStageOutput, TContext & {
159
- [x: string]: z.infer<TStageOutput>;
160
- }>;
161
- /**
162
- * Add a stage with strict input type checking
163
- *
164
- * Note: pipeStrict() and pipeLoose() have been removed as they were
165
- * just aliases for pipe(). Use pipe() for all stage chaining.
166
- */
167
- /**
168
- * Add multiple stages that execute in parallel
169
- *
170
- * All stages receive the same input (current output)
171
- * Their outputs are merged into an object by index AND accumulated in context by stage ID.
172
- *
173
- * Note: This accepts stages regardless of strict input type matching.
174
- * This is necessary because stages using passthrough() can accept objects
175
- * with additional fields. Runtime validation via Zod ensures type safety.
176
- *
177
- * Validates that all declared dependencies exist in the workflow.
178
- */
179
- parallel<TStages extends {
180
- id: string;
181
- outputSchema: z.ZodTypeAny;
182
- dependencies?: string[];
183
- }[]>(stages: [...TStages]): WorkflowBuilder<TInput, z.ZodTypeAny, TContext & {
184
- [K in TStages[number]["id"]]: TStages[number] extends {
185
- outputSchema: infer O;
186
- } ? O extends z.ZodTypeAny ? z.infer<O> : never : never;
187
- }>;
188
- /**
189
- * Build the final workflow
190
- */
191
- build(): Workflow<TInput, TCurrentOutput, TContext>;
192
- /**
193
- * Get current stage count
194
- */
195
- getStageCount(): number;
196
- /**
197
- * Get execution group count
198
- */
199
- getExecutionGroupCount(): number;
200
- }
201
- /**
202
- * Extract stage IDs as a union type from a Workflow instance
203
- *
204
- * Useful for creating type-safe stage ID references.
15
+ * These presets provide standardized schemas for common stage configurations,
16
+ * reducing boilerplate and ensuring consistency across stages.
205
17
  *
206
18
  * @example
207
19
  * ```typescript
208
- * type StageId = InferWorkflowStageIds<typeof myWorkflow>;
209
- * // = "data-extraction" | "guidelines" | "generator"
20
+ * import { defineStage } from "./stage-factory";
21
+ * import { withAIConfig, withStandardConfig } from "./config-presets";
22
+ *
23
+ * // Use AI-focused config preset
24
+ * const myStage = defineStage({
25
+ * id: "my-stage",
26
+ * name: "My Stage",
27
+ * schemas: {
28
+ * input: z.object({ data: z.string() }),
29
+ * output: z.object({ result: z.string() }),
30
+ * config: withAIConfig(z.object({
31
+ * customField: z.string(),
32
+ * })),
33
+ * },
34
+ * async execute(ctx) {
35
+ * // ctx.config.model, ctx.config.temperature available
36
+ * // plus ctx.config.customField
37
+ * },
38
+ * });
210
39
  *
211
- * function getStageOutput(stageId: StageId) { ... }
40
+ * // Use standard config preset (includes AI + concurrency + feature flags)
41
+ * const fullStage = defineStage({
42
+ * id: "full-stage",
43
+ * name: "Full Stage",
44
+ * schemas: {
45
+ * input: "none",
46
+ * output: z.object({ result: z.string() }),
47
+ * config: withStandardConfig(z.object({
48
+ * specificOption: z.boolean().default(true),
49
+ * })),
50
+ * },
51
+ * async execute(ctx) {
52
+ * // All standard config + custom fields available
53
+ * },
54
+ * });
212
55
  * ```
213
56
  */
214
- type InferWorkflowStageIds<W> = W extends Workflow<any, any, infer C> ? keyof C & string : never;
215
57
 
216
58
  /**
217
- * Workflow Executor - Executes workflows with support for resume and suspension
218
- *
219
- * Key features:
220
- * - Sequential and parallel stage execution
221
- * - Automatic state persistence to R2 and database
222
- * - Resume from last completed stage
223
- * - Suspend/resume for long-running batch jobs
224
- * - Event emission for real-time updates
225
- *
226
- * Note: Stages should import createAIHelper directly from ~/lib/ai-helper
227
- * and create their own AI helper instances with appropriate topics.
228
- * The executor creates a helper for tracking aggregate stats per stage.
59
+ * AI/LLM configuration options
229
60
  */
230
-
231
- interface WorkflowExecutorOptions {
232
- persistence?: WorkflowPersistence;
233
- /** Optional AI call logger. If not provided, AI tracking is disabled. */
234
- aiLogger?: AICallLogger;
235
- }
236
- declare class WorkflowExecutor extends EventEmitter {
237
- private workflow;
238
- private workflowRunId;
239
- private workflowType;
240
- private cancelled;
241
- private persistence;
242
- private aiLogger;
243
- constructor(workflow: Workflow<any, any>, workflowRunId: string, workflowType: string, storageProviderOrOptions?: WorkflowExecutorOptions);
244
- /**
245
- * Override emit to also forward events to the global event bus for SSE
246
- */
247
- emit(eventName: string | symbol, ...args: any[]): boolean;
248
- /**
249
- * Check if the workflow has been interrupted (cancelled or suspended) externally
250
- * This checks the database status to detect external requests
251
- */
252
- private checkExternalInterruption;
253
- /**
254
- * Execute the workflow
255
- *
256
- * @param input - Workflow input data
257
- * @param config - Configuration for each stage (keyed by stage ID)
258
- * @param options - Execution options (resume, etc.)
259
- * @returns Final output or 'suspended' if workflow is suspended
260
- */
261
- execute<TInput, TOutput>(input: TInput, config: Record<string, unknown>, options?: {
262
- resume?: boolean;
263
- fromStage?: string;
264
- }): Promise<TOutput | "suspended">;
265
- /**
266
- * Execute a single stage
267
- */
268
- private executeStage;
269
- /**
270
- * Load resume state from database
271
- */
272
- private loadResumeState;
273
- /**
274
- * Load workflow context from all completed stages
275
- * This rebuilds the workflowContext object so resumed stages can access previous outputs
276
- */
277
- private loadWorkflowContext;
278
- /**
279
- * Load state for rerunning from a specific stage.
280
- * Requires that previous stages have already been executed and their outputs persisted.
281
- *
282
- * @param stageId - The stage ID to start execution from
283
- * @returns The execution group, input data, and workflow context
284
- */
285
- private loadFromStageState;
286
- /**
287
- * Create a minimal storage shim for context.storage (for API compatibility).
288
- * Stage implementations should not rely on this - it may be removed in future.
289
- */
290
- private createStorageShim;
291
- /**
292
- * Get aggregated statistics for the workflow run
293
- */
294
- private getAggregatedStats;
295
- /**
296
- * Log a message with automatic database persistence
297
- */
298
- private log;
299
- }
300
-
61
+ declare const AIConfigSchema: z.ZodObject<{
62
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
63
+ temperature: z.ZodDefault<z.ZodNumber>;
64
+ maxTokens: z.ZodOptional<z.ZodNumber>;
65
+ }, z.core.$strip>;
66
+ type AIConfig = z.infer<typeof AIConfigSchema>;
301
67
  /**
302
- * Stage Executor - Executes a single stage
303
- *
304
- * Unlike WorkflowExecutor which runs entire workflows,
305
- * this executes exactly ONE stage and returns.
306
- *
307
- * Designed for distributed workers.
68
+ * Concurrency and rate limiting configuration
308
69
  */
309
-
310
- interface WorkflowRegistry {
311
- getWorkflow(id: string): Workflow<any, any> | undefined;
312
- }
313
- interface StageExecutionRequest {
314
- workflowRunId: string;
315
- workflowId: string;
316
- stageId: string;
317
- config: Record<string, unknown>;
318
- }
319
- interface StageExecutionResult {
320
- type: "completed" | "suspended" | "failed";
321
- output?: unknown;
322
- suspendedState?: unknown;
323
- nextPollAt?: Date;
324
- error?: string;
325
- metrics?: StageMetrics;
326
- }
327
- declare class StageExecutor {
328
- private registry;
329
- private persistence;
330
- private workerId;
331
- constructor(registry: WorkflowRegistry, persistence: WorkflowPersistence, workerId?: string);
332
- /**
333
- * Execute a single stage
334
- */
335
- execute(request: StageExecutionRequest): Promise<StageExecutionResult>;
336
- private handleCompleted;
337
- private handleSuspended;
338
- private handleFailed;
339
- private loadWorkflowContext;
340
- /**
341
- * Create a minimal storage shim for context.storage (for API compatibility).
342
- * Stage implementations should not rely on this - it may be removed in future.
343
- */
344
- private createStorageShim;
345
- private resolveStageInput;
346
- private getStageNumber;
347
- private getExecutionGroup;
348
- private log;
349
- }
350
-
70
+ declare const ConcurrencyConfigSchema: z.ZodObject<{
71
+ concurrency: z.ZodDefault<z.ZodNumber>;
72
+ delayMs: z.ZodDefault<z.ZodNumber>;
73
+ maxRetries: z.ZodDefault<z.ZodNumber>;
74
+ }, z.core.$strip>;
75
+ type ConcurrencyConfig = z.infer<typeof ConcurrencyConfigSchema>;
351
76
  /**
352
- * Storage abstraction for stage artifacts and outputs
353
- *
354
- * Modified to support Prisma/Memory storage only (R2 removed)
77
+ * Feature flag configuration for conditional behavior
355
78
  */
356
- interface StageStorage {
357
- /**
358
- * Save data to storage
359
- */
360
- save<T>(key: string, data: T): Promise<void>;
361
- /**
362
- * Load data from storage
363
- */
364
- load<T>(key: string): Promise<T>;
365
- /**
366
- * Check if key exists in storage
367
- */
368
- exists(key: string): Promise<boolean>;
369
- /**
370
- * Delete data from storage
371
- */
372
- delete(key: string): Promise<void>;
373
- /**
374
- * Generate a storage key for a stage
375
- */
376
- getStageKey(stageId: string, suffix?: string): string;
377
- /**
378
- * Save stage output with standard key
379
- */
380
- saveStageOutput<T>(stageId: string, output: T): Promise<string>;
381
- /**
382
- * Load stage output with standard key
383
- */
384
- loadStageOutput<T>(stageId: string): Promise<T>;
385
- /**
386
- * Save arbitrary artifact for a stage
387
- */
388
- saveArtifact<T>(stageId: string, artifactName: string, data: T): Promise<string>;
389
- /**
390
- * Load arbitrary artifact for a stage
391
- */
392
- loadArtifact<T>(stageId: string, artifactName: string): Promise<T>;
393
- /**
394
- * List all artifacts for a workflow run (for export)
395
- */
396
- listAllArtifacts(): Promise<Array<{
397
- key: string;
398
- stageId: string;
399
- name: string;
400
- }>>;
401
- /**
402
- * Provider metadata
403
- */
404
- readonly providerType: "prisma" | "memory";
405
- }
406
-
79
+ declare const FeatureFlagsConfigSchema: z.ZodObject<{
80
+ featureFlags: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
81
+ }, z.core.$strip>;
82
+ type FeatureFlagsConfig = z.infer<typeof FeatureFlagsConfigSchema>;
407
83
  /**
408
- * Factory for creating storage provider instances
409
- *
410
- * Prisma storage requires a PrismaClient to be passed via options.
84
+ * Logging and debugging configuration
411
85
  */
412
-
413
- type PrismaClient = any;
414
- type StorageProviderType = "prisma" | "memory";
415
- interface StorageFactoryOptions {
416
- provider: StorageProviderType;
417
- workflowRunId: string;
418
- workflowType: string;
419
- /** Required when provider is "prisma" */
420
- prisma?: PrismaClient;
421
- }
86
+ declare const DebugConfigSchema: z.ZodObject<{
87
+ verbose: z.ZodDefault<z.ZodBoolean>;
88
+ dryRun: z.ZodDefault<z.ZodBoolean>;
89
+ }, z.core.$strip>;
90
+ type DebugConfig = z.infer<typeof DebugConfigSchema>;
422
91
  /**
423
- * Create a storage instance based on the provider type
424
- */
425
- declare function createStorage(options: StorageFactoryOptions): StageStorage;
426
- /**
427
- * Get default provider from environment or config
428
- * Falls back to 'prisma' for database-backed persistence
92
+ * Add AI configuration to any schema
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * const myConfig = withAIConfig(z.object({
97
+ * customField: z.string(),
98
+ * }));
99
+ * // Result has: model, temperature, maxTokens, customField
100
+ * ```
429
101
  */
430
- declare function getDefaultStorageProvider(): StorageProviderType;
431
-
102
+ declare function withAIConfig<T extends z.ZodRawShape>(schema: z.ZodObject<T>): z.ZodObject<(keyof T & ("model" | "temperature" | "maxTokens") extends never ? T & {
103
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
104
+ temperature: z.ZodDefault<z.ZodNumber>;
105
+ maxTokens: z.ZodOptional<z.ZodNumber>;
106
+ } : { [K in keyof T as K extends "model" | "temperature" | "maxTokens" ? never : K]: T[K]; } & {
107
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
108
+ temperature: z.ZodDefault<z.ZodNumber>;
109
+ maxTokens: z.ZodOptional<z.ZodNumber>;
110
+ }) extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.core.$strip>;
432
111
  /**
433
- * Workflow Event Bus - Global event emitter for workflow events
434
- *
435
- * This singleton allows SSE endpoints to subscribe to real-time workflow events
436
- * emitted by WorkflowExecutor instances running in the same process.
437
- *
438
- * Supports cross-process events via PostgreSQL LISTEN/NOTIFY when enabled.
112
+ * Add concurrency configuration to any schema
439
113
  *
440
- * Events are namespaced by workflowRunId:
441
- * - workflow:{runId}:stage:started
442
- * - workflow:{runId}:stage:completed
443
- * - workflow:{runId}:log
444
- * - etc.
114
+ * @example
115
+ * ```typescript
116
+ * const myConfig = withConcurrency(z.object({
117
+ * items: z.array(z.string()),
118
+ * }));
119
+ * // Result has: concurrency, delayMs, maxRetries, items
120
+ * ```
445
121
  */
446
-
122
+ declare function withConcurrency<T extends z.ZodRawShape>(schema: z.ZodObject<T>): z.ZodObject<(keyof T & ("concurrency" | "delayMs" | "maxRetries") extends never ? T & {
123
+ concurrency: z.ZodDefault<z.ZodNumber>;
124
+ delayMs: z.ZodDefault<z.ZodNumber>;
125
+ maxRetries: z.ZodDefault<z.ZodNumber>;
126
+ } : { [K in keyof T as K extends "concurrency" | "delayMs" | "maxRetries" ? never : K]: T[K]; } & {
127
+ concurrency: z.ZodDefault<z.ZodNumber>;
128
+ delayMs: z.ZodDefault<z.ZodNumber>;
129
+ maxRetries: z.ZodDefault<z.ZodNumber>;
130
+ }) extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.core.$strip>;
447
131
  /**
448
- * Interface matching PgNotify from @zertai/database
449
- * Defined here to avoid importing the database package into workflow-engine
450
- */
451
- interface PgNotifyLike {
452
- listen(channel: string, handler: (channel: string, payload: string) => void): Promise<() => void>;
453
- notify(channel: string, payload: string): Promise<void>;
454
- isConnected(): boolean;
455
- }
456
- declare class WorkflowEventBus extends EventEmitter {
457
- private static instance;
458
- private pgNotify;
459
- private static readonly PG_CHANNEL;
460
- private pgListenerUnsubscribe;
461
- private static readonly MAX_PAYLOAD_SIZE;
462
- private constructor();
463
- static getInstance(): WorkflowEventBus;
464
- /**
465
- * Enable cross-process event publishing via PostgreSQL NOTIFY
466
- *
467
- * Call this during process initialization to enable events to propagate
468
- * across multiple workers and the React Router app.
469
- *
470
- * @param pgNotify - A connected PgNotify instance from @zertai/database
471
- */
472
- enablePgNotify(pgNotify: PgNotifyLike): Promise<void>;
473
- /**
474
- * Disable cross-process events (for cleanup)
475
- */
476
- disablePgNotify(): void;
477
- /**
478
- * Check if cross-process events are enabled
479
- */
480
- isPgNotifyEnabled(): boolean;
481
- /**
482
- * Truncate event payload to fit within PostgreSQL NOTIFY size limits.
483
- * Large data fields (like workflow output) are replaced with a truncation marker.
484
- */
485
- private truncatePayloadForNotify;
486
- /**
487
- * Emit event locally only (used for re-emitting pg notifications)
488
- */
489
- private emitLocally;
490
- /**
491
- * Emit a workflow event with proper namespacing
492
- *
493
- * When PgNotify is enabled, also publishes to PostgreSQL for cross-process
494
- * consumption by other workers and the React Router app.
495
- */
496
- emitWorkflowEvent(workflowRunId: string, eventType: WorkflowEventType, payload: Record<string, unknown>): void;
497
- /**
498
- * Subscribe to all events for a specific workflow run
499
- */
500
- subscribeToWorkflow(workflowRunId: string, handler: (event: WorkflowSSEEvent) => void): () => void;
501
- /**
502
- * Subscribe to a specific event type globally (across all workflows)
503
- */
504
- subscribeGlobal(eventType: WorkflowEventType, handler: (event: WorkflowSSEEvent) => void): () => void;
505
- /**
506
- * Subscribe to a specific event type for a workflow
507
- */
508
- subscribeToEvent(workflowRunId: string, eventType: WorkflowEventType, handler: (event: WorkflowSSEEvent) => void): () => void;
509
- }
510
- declare const workflowEventBus: WorkflowEventBus;
511
-
512
- /**
513
- * Workflow Runtime - Unified API for workflow execution
132
+ * Add feature flags configuration to any schema
514
133
  *
515
- * The main entry point for the workflow engine. Handles everything:
516
- * - Creating new workflow runs (with validation)
517
- * - Polling for pending workflows → enqueuing first stage
518
- * - Processing jobs from the queue (executing stages)
519
- * - Polling for suspended stages → resuming execution
520
- * - Transitioning workflows between stages
134
+ * @example
135
+ * ```typescript
136
+ * const myConfig = withFeatureFlags(z.object({
137
+ * setting: z.boolean(),
138
+ * }));
139
+ * // Result has: featureFlags, setting
140
+ * ```
521
141
  */
522
-
523
- interface WorkflowRuntimeConfig {
524
- /** Persistence implementation */
525
- persistence: WorkflowPersistence;
526
- /** Job queue implementation */
527
- jobQueue: JobQueue;
528
- /** Workflow registry */
529
- registry: WorkflowRegistry;
530
- /** AI call logger for createAIHelper */
531
- aiCallLogger?: AICallLogger;
532
- /** Interval between poll cycles in milliseconds (default: 10000) */
533
- pollIntervalMs?: number;
534
- /** Interval between job dequeue attempts in milliseconds (default: 1000) */
535
- jobPollIntervalMs?: number;
536
- /** Worker ID (default: auto-generated) */
537
- workerId?: string;
538
- /** Stale job threshold in milliseconds (default: 60000) */
539
- staleJobThresholdMs?: number;
540
- /** Function to determine workflow priority */
541
- getWorkflowPriority?: (workflowId: string) => number;
542
- }
543
- interface CreateRunOptions {
544
- workflowId: string;
545
- input: Record<string, unknown>;
546
- config?: Record<string, unknown>;
547
- priority?: number;
548
- /** Domain-specific metadata */
549
- metadata?: Record<string, unknown>;
550
- }
551
- interface CreateRunResult {
552
- workflowRunId: string;
553
- }
554
- declare class WorkflowRuntime {
555
- private isPolling;
556
- private isProcessingJobs;
557
- private isRunning;
558
- private pollIntervalMs;
559
- private jobPollIntervalMs;
560
- private staleJobThresholdMs;
561
- private workerId;
562
- private persistence;
563
- private jobQueue;
564
- private registry;
565
- private aiCallLogger?;
566
- private getWorkflowPriority?;
567
- private pollTimer;
568
- private stageExecutor;
569
- private jobsProcessed;
570
- constructor(config: WorkflowRuntimeConfig);
571
- /**
572
- * Create an AI helper bound to this runtime's logger
573
- * @param topic - Topic for logging (e.g., "workflow.abc123.stage.extraction")
574
- * @param logContext - Optional log context for persistence logging in batch operations
575
- */
576
- createAIHelper(topic: string, logContext?: LogContext): AIHelper;
577
- /**
578
- * Create a LogContext for a workflow stage (for use with createAIHelper)
579
- * This enables batch operations to log to the workflow persistence.
580
- */
581
- createLogContext(workflowRunId: string, stageRecordId: string): LogContext;
582
- /**
583
- * Start the runtime as a full worker (processes jobs + polls)
584
- */
585
- start(): Promise<void>;
586
- /**
587
- * Stop the runtime
588
- */
589
- stop(): void;
590
- /**
591
- * Create a new workflow run with validation.
592
- * The runtime will pick it up on the next poll cycle and start execution.
593
- */
594
- createRun(options: CreateRunOptions): Promise<CreateRunResult>;
595
- /**
596
- * Process jobs from the queue
597
- */
598
- private processJobs;
599
- private getWorkflowId;
600
- /**
601
- * Poll for pending workflows and suspended stages
602
- */
603
- private poll;
604
- /**
605
- * Poll for pending workflows and enqueue their first stage.
606
- * Uses claimNextPendingRun() for zero-contention claiming with FOR UPDATE SKIP LOCKED.
607
- */
608
- private pollPendingWorkflows;
609
- /**
610
- * Poll suspended stages and resume if ready (public for manual triggering)
611
- */
612
- pollSuspendedStages(): Promise<void>;
613
- /**
614
- * Transition a workflow to its next state (public for external calls)
615
- */
616
- transitionWorkflow(workflowRunId: string): Promise<void>;
617
- private checkAndResume;
618
- private resumeWorkflow;
619
- /**
620
- * Create a minimal storage shim for context.storage (for API compatibility).
621
- */
622
- private createStorageShim;
623
- private markStageFailed;
624
- private enqueueExecutionGroup;
625
- private completeWorkflow;
626
- }
142
+ declare function withFeatureFlags<T extends z.ZodRawShape>(schema: z.ZodObject<T>): z.ZodObject<(keyof T & "featureFlags" extends never ? T & {
143
+ featureFlags: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
144
+ } : { [K in keyof T as K extends "featureFlags" ? never : K]: T[K]; } & {
145
+ featureFlags: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
146
+ }) extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.core.$strip>;
627
147
  /**
628
- * Factory function to create a WorkflowRuntime instance
148
+ * Standard config preset combining AI + Concurrency + Feature Flags
149
+ *
150
+ * This is the recommended preset for most stages that need:
151
+ * - AI/LLM operations
152
+ * - Parallel processing
153
+ * - Feature flagging
154
+ *
155
+ * @example
156
+ * ```typescript
157
+ * const myConfig = withStandardConfig(z.object({
158
+ * customOption: z.boolean().default(true),
159
+ * }));
160
+ * // Result has all standard fields plus customOption
161
+ * ```
629
162
  */
630
- declare function createWorkflowRuntime(config: WorkflowRuntimeConfig): WorkflowRuntime;
163
+ declare function withStandardConfig<T extends z.ZodRawShape>(schema: z.ZodObject<T>): z.ZodObject<(keyof (keyof (keyof T & ("model" | "temperature" | "maxTokens") extends never ? T & {
164
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
165
+ temperature: z.ZodDefault<z.ZodNumber>;
166
+ maxTokens: z.ZodOptional<z.ZodNumber>;
167
+ } : { [K in keyof T as K extends "model" | "temperature" | "maxTokens" ? never : K]: T[K]; } & {
168
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
169
+ temperature: z.ZodDefault<z.ZodNumber>;
170
+ maxTokens: z.ZodOptional<z.ZodNumber>;
171
+ }) & ("concurrency" | "delayMs" | "maxRetries") extends never ? ((keyof T & ("model" | "temperature" | "maxTokens") extends never ? T & {
172
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
173
+ temperature: z.ZodDefault<z.ZodNumber>;
174
+ maxTokens: z.ZodOptional<z.ZodNumber>;
175
+ } : { [K in keyof T as K extends "model" | "temperature" | "maxTokens" ? never : K]: T[K]; } & {
176
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
177
+ temperature: z.ZodDefault<z.ZodNumber>;
178
+ maxTokens: z.ZodOptional<z.ZodNumber>;
179
+ }) extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never) & {
180
+ concurrency: z.ZodDefault<z.ZodNumber>;
181
+ delayMs: z.ZodDefault<z.ZodNumber>;
182
+ maxRetries: z.ZodDefault<z.ZodNumber>;
183
+ } : (((keyof T & ("model" | "temperature" | "maxTokens") extends never ? T & {
184
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
185
+ temperature: z.ZodDefault<z.ZodNumber>;
186
+ maxTokens: z.ZodOptional<z.ZodNumber>;
187
+ } : { [K in keyof T as K extends "model" | "temperature" | "maxTokens" ? never : K]: T[K]; } & {
188
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
189
+ temperature: z.ZodDefault<z.ZodNumber>;
190
+ maxTokens: z.ZodOptional<z.ZodNumber>;
191
+ }) extends infer T_4 ? { [k_1 in keyof T_4]: T_4[k_1]; } : never) extends infer T_3 extends z.core.util.SomeObject ? { [K_1 in keyof T_3 as K_1 extends "concurrency" | "delayMs" | "maxRetries" ? never : K_1]: T_3[K_1]; } : never) & {
192
+ concurrency: z.ZodDefault<z.ZodNumber>;
193
+ delayMs: z.ZodDefault<z.ZodNumber>;
194
+ maxRetries: z.ZodDefault<z.ZodNumber>;
195
+ }) & "featureFlags" extends never ? ((keyof (keyof T & ("model" | "temperature" | "maxTokens") extends never ? T & {
196
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
197
+ temperature: z.ZodDefault<z.ZodNumber>;
198
+ maxTokens: z.ZodOptional<z.ZodNumber>;
199
+ } : { [K in keyof T as K extends "model" | "temperature" | "maxTokens" ? never : K]: T[K]; } & {
200
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
201
+ temperature: z.ZodDefault<z.ZodNumber>;
202
+ maxTokens: z.ZodOptional<z.ZodNumber>;
203
+ }) & ("concurrency" | "delayMs" | "maxRetries") extends never ? ((keyof T & ("model" | "temperature" | "maxTokens") extends never ? T & {
204
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
205
+ temperature: z.ZodDefault<z.ZodNumber>;
206
+ maxTokens: z.ZodOptional<z.ZodNumber>;
207
+ } : { [K in keyof T as K extends "model" | "temperature" | "maxTokens" ? never : K]: T[K]; } & {
208
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
209
+ temperature: z.ZodDefault<z.ZodNumber>;
210
+ maxTokens: z.ZodOptional<z.ZodNumber>;
211
+ }) extends infer T_6 ? { [k_1 in keyof T_6]: T_6[k_1]; } : never) & {
212
+ concurrency: z.ZodDefault<z.ZodNumber>;
213
+ delayMs: z.ZodDefault<z.ZodNumber>;
214
+ maxRetries: z.ZodDefault<z.ZodNumber>;
215
+ } : (((keyof T & ("model" | "temperature" | "maxTokens") extends never ? T & {
216
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
217
+ temperature: z.ZodDefault<z.ZodNumber>;
218
+ maxTokens: z.ZodOptional<z.ZodNumber>;
219
+ } : { [K in keyof T as K extends "model" | "temperature" | "maxTokens" ? never : K]: T[K]; } & {
220
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
221
+ temperature: z.ZodDefault<z.ZodNumber>;
222
+ maxTokens: z.ZodOptional<z.ZodNumber>;
223
+ }) extends infer T_8 ? { [k_1 in keyof T_8]: T_8[k_1]; } : never) extends infer T_7 extends z.core.util.SomeObject ? { [K_1 in keyof T_7 as K_1 extends "concurrency" | "delayMs" | "maxRetries" ? never : K_1]: T_7[K_1]; } : never) & {
224
+ concurrency: z.ZodDefault<z.ZodNumber>;
225
+ delayMs: z.ZodDefault<z.ZodNumber>;
226
+ maxRetries: z.ZodDefault<z.ZodNumber>;
227
+ }) extends infer T_5 ? { [k_2 in keyof T_5]: T_5[k_2]; } : never) & {
228
+ featureFlags: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
229
+ } : (((keyof (keyof T & ("model" | "temperature" | "maxTokens") extends never ? T & {
230
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
231
+ temperature: z.ZodDefault<z.ZodNumber>;
232
+ maxTokens: z.ZodOptional<z.ZodNumber>;
233
+ } : { [K in keyof T as K extends "model" | "temperature" | "maxTokens" ? never : K]: T[K]; } & {
234
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
235
+ temperature: z.ZodDefault<z.ZodNumber>;
236
+ maxTokens: z.ZodOptional<z.ZodNumber>;
237
+ }) & ("concurrency" | "delayMs" | "maxRetries") extends never ? ((keyof T & ("model" | "temperature" | "maxTokens") extends never ? T & {
238
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
239
+ temperature: z.ZodDefault<z.ZodNumber>;
240
+ maxTokens: z.ZodOptional<z.ZodNumber>;
241
+ } : { [K in keyof T as K extends "model" | "temperature" | "maxTokens" ? never : K]: T[K]; } & {
242
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
243
+ temperature: z.ZodDefault<z.ZodNumber>;
244
+ maxTokens: z.ZodOptional<z.ZodNumber>;
245
+ }) extends infer T_11 ? { [k_1 in keyof T_11]: T_11[k_1]; } : never) & {
246
+ concurrency: z.ZodDefault<z.ZodNumber>;
247
+ delayMs: z.ZodDefault<z.ZodNumber>;
248
+ maxRetries: z.ZodDefault<z.ZodNumber>;
249
+ } : (((keyof T & ("model" | "temperature" | "maxTokens") extends never ? T & {
250
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
251
+ temperature: z.ZodDefault<z.ZodNumber>;
252
+ maxTokens: z.ZodOptional<z.ZodNumber>;
253
+ } : { [K in keyof T as K extends "model" | "temperature" | "maxTokens" ? never : K]: T[K]; } & {
254
+ model: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"gemini-2.5-flash", string>>>;
255
+ temperature: z.ZodDefault<z.ZodNumber>;
256
+ maxTokens: z.ZodOptional<z.ZodNumber>;
257
+ }) extends infer T_13 ? { [k_1 in keyof T_13]: T_13[k_1]; } : never) extends infer T_12 extends z.core.util.SomeObject ? { [K_1 in keyof T_12 as K_1 extends "concurrency" | "delayMs" | "maxRetries" ? never : K_1]: T_12[K_1]; } : never) & {
258
+ concurrency: z.ZodDefault<z.ZodNumber>;
259
+ delayMs: z.ZodDefault<z.ZodNumber>;
260
+ maxRetries: z.ZodDefault<z.ZodNumber>;
261
+ }) extends infer T_10 ? { [k_2 in keyof T_10]: T_10[k_2]; } : never) extends infer T_9 extends z.core.util.SomeObject ? { [K_2 in keyof T_9 as K_2 extends "featureFlags" ? never : K_2]: T_9[K_2]; } : never) & {
262
+ featureFlags: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
263
+ }) extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.core.$strip>;
631
264
 
632
265
  /**
633
266
  * Model Mapping for Batch Providers
@@ -933,4 +566,4 @@ declare class OpenAIBatchProvider implements BatchProvider<OpenAIBatchRequest, R
933
566
  private mapStatus;
934
567
  }
935
568
 
936
- export { AICallLogger, AIHelper, AnthropicBatchProvider, type AnthropicBatchProviderConfig, type AnthropicBatchRequest, type BaseBatchRequest, type BatchHandle, type BatchLogger, type BatchMetrics, type BatchProvider, type BatchRequest, type BatchRequestText, type BatchRequestWithSchema, type BatchResult, type BatchState, type BatchStatus, type BatchSubmitOptions, type CreateRunOptions, type CreateRunResult, GoogleBatchProvider, type GoogleBatchProviderConfig, type GoogleBatchRequest, type InferWorkflowStageIds, JobQueue, LogContext, ModelKey, OpenAIBatchProvider, type OpenAIBatchProviderConfig, type OpenAIBatchRequest, type PgNotifyLike, type RawBatchResult, type SerializedBatch, Stage, type StageExecutionRequest, type StageExecutionResult, StageExecutor, Workflow, WorkflowBuilder, WorkflowEventType, WorkflowExecutor, WorkflowPersistence, type WorkflowRegistry, WorkflowRuntime, type WorkflowRuntimeConfig, WorkflowSSEEvent, createStorage, createWorkflowRuntime, getBestProviderForModel, getDefaultStorageProvider, resolveModelForProvider, workflowEventBus };
569
+ export { type AIConfig, AIConfigSchema, AnthropicBatchProvider, type AnthropicBatchProviderConfig, type AnthropicBatchRequest, type BaseBatchRequest, type BatchHandle, type BatchLogger, type BatchMetrics, type BatchProvider, type BatchRequest, type BatchRequestText, type BatchRequestWithSchema, type BatchResult, type BatchState, type BatchStatus, type BatchSubmitOptions, type ConcurrencyConfig, ConcurrencyConfigSchema, type DebugConfig, DebugConfigSchema, type FeatureFlagsConfig, FeatureFlagsConfigSchema, GoogleBatchProvider, type GoogleBatchProviderConfig, type GoogleBatchRequest, ModelKey, OpenAIBatchProvider, type OpenAIBatchProviderConfig, type OpenAIBatchRequest, type RawBatchResult, type SerializedBatch, getBestProviderForModel, resolveModelForProvider, withAIConfig, withConcurrency, withFeatureFlags, withStandardConfig };