@multiplier-labs/stepflow 0.3.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 (76) hide show
  1. package/.github/workflows/publish.yml +30 -0
  2. package/README.md +408 -0
  3. package/dist/chunk-FQCT3I2A.js +1512 -0
  4. package/dist/chunk-FQCT3I2A.js.map +1 -0
  5. package/dist/chunk-GXY66V7Q.js +111 -0
  6. package/dist/chunk-GXY66V7Q.js.map +1 -0
  7. package/dist/chunk-U5QGN3RT.js +715 -0
  8. package/dist/chunk-U5QGN3RT.js.map +1 -0
  9. package/dist/chunk-XCF4PLN7.js +575 -0
  10. package/dist/chunk-XCF4PLN7.js.map +1 -0
  11. package/dist/events/index.d.ts +346 -0
  12. package/dist/events/index.js +11 -0
  13. package/dist/events/index.js.map +1 -0
  14. package/dist/index-CPfGsmrp.d.ts +567 -0
  15. package/dist/index.d.ts +748 -0
  16. package/dist/index.js +1707 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/scheduler/index.d.ts +6 -0
  19. package/dist/scheduler/index.js +12 -0
  20. package/dist/scheduler/index.js.map +1 -0
  21. package/dist/storage/index.d.ts +402 -0
  22. package/dist/storage/index.js +13 -0
  23. package/dist/storage/index.js.map +1 -0
  24. package/dist/types-BVShq7zT.d.ts +150 -0
  25. package/dist/types-BlwFEGzj.d.ts +276 -0
  26. package/dist/types-DzkEqnQJ.d.ts +75 -0
  27. package/docs/github-packages-setup.md +97 -0
  28. package/docs/stepflow-api-reference.md +1662 -0
  29. package/package.json +85 -0
  30. package/src/core/engine.test.ts +1421 -0
  31. package/src/core/engine.ts +717 -0
  32. package/src/core/index.ts +7 -0
  33. package/src/core/orchestrator.ts +590 -0
  34. package/src/core/types.ts +242 -0
  35. package/src/events/index.ts +8 -0
  36. package/src/events/memory.test.ts +109 -0
  37. package/src/events/memory.ts +95 -0
  38. package/src/events/socketio.test.ts +428 -0
  39. package/src/events/socketio.ts +269 -0
  40. package/src/events/types.ts +121 -0
  41. package/src/events/webhook.test.ts +695 -0
  42. package/src/events/webhook.ts +591 -0
  43. package/src/index.ts +270 -0
  44. package/src/planning/index.ts +52 -0
  45. package/src/planning/planner.ts +601 -0
  46. package/src/planning/planning.test.ts +790 -0
  47. package/src/planning/registry.test.ts +445 -0
  48. package/src/planning/registry.ts +369 -0
  49. package/src/planning/types.ts +570 -0
  50. package/src/scheduler/cron.test.ts +480 -0
  51. package/src/scheduler/cron.ts +449 -0
  52. package/src/scheduler/index.ts +18 -0
  53. package/src/scheduler/postgres-persistence.test.ts +906 -0
  54. package/src/scheduler/postgres-persistence.ts +546 -0
  55. package/src/scheduler/sqlite-persistence.test.ts +235 -0
  56. package/src/scheduler/sqlite-persistence.ts +268 -0
  57. package/src/scheduler/types.ts +78 -0
  58. package/src/storage/index.ts +27 -0
  59. package/src/storage/memory.test.ts +399 -0
  60. package/src/storage/memory.ts +248 -0
  61. package/src/storage/postgres.ts +1550 -0
  62. package/src/storage/sqlite.test.ts +593 -0
  63. package/src/storage/sqlite.ts +662 -0
  64. package/src/storage/types.ts +368 -0
  65. package/src/utils/errors.test.ts +152 -0
  66. package/src/utils/errors.ts +191 -0
  67. package/src/utils/id.ts +21 -0
  68. package/src/utils/index.ts +8 -0
  69. package/src/utils/logger.test.ts +127 -0
  70. package/src/utils/logger.ts +96 -0
  71. package/src/utils/postgres-deps.ts +63 -0
  72. package/src/utils/retry.test.ts +197 -0
  73. package/src/utils/retry.ts +121 -0
  74. package/tsconfig.json +21 -0
  75. package/tsup.config.ts +14 -0
  76. package/vitest.config.ts +9 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/errors.ts","../src/utils/retry.ts","../src/core/orchestrator.ts","../src/core/engine.ts","../src/planning/registry.ts","../src/planning/planner.ts"],"sourcesContent":["/**\n * Custom error classes for the workflow engine.\n */\n\nimport type { WorkflowError } from \"../core/types\";\n\n/**\n * Base error class for workflow-related errors.\n */\nexport class WorkflowEngineError extends Error {\n readonly code: string;\n readonly details?: Record<string, unknown>;\n\n constructor(\n code: string,\n message: string,\n details?: Record<string, unknown>,\n ) {\n super(message);\n this.name = \"WorkflowEngineError\";\n this.code = code;\n this.details = details;\n }\n\n /**\n * Convert to a WorkflowError record for storage.\n */\n toRecord(): WorkflowError {\n return {\n code: this.code,\n message: this.message,\n stack: this.stack,\n details: this.details,\n };\n }\n\n /**\n * Create a WorkflowError record from any error.\n */\n static fromError(\n error: unknown,\n defaultCode = \"UNKNOWN_ERROR\",\n ): WorkflowError {\n if (error instanceof WorkflowEngineError) {\n return error.toRecord();\n }\n\n if (error instanceof Error) {\n return {\n code: defaultCode,\n message: error.message,\n stack: error.stack,\n };\n }\n\n return {\n code: defaultCode,\n message: String(error),\n };\n }\n}\n\n/**\n * Error thrown when a workflow is not found in the registry.\n */\nexport class WorkflowNotFoundError extends WorkflowEngineError {\n constructor(kind: string) {\n super(\"WORKFLOW_NOT_FOUND\", `Workflow \"${kind}\" is not registered`, {\n kind,\n });\n this.name = \"WorkflowNotFoundError\";\n }\n}\n\n/**\n * Error thrown when a workflow is already registered.\n */\nexport class WorkflowAlreadyRegisteredError extends WorkflowEngineError {\n constructor(kind: string) {\n super(\n \"WORKFLOW_ALREADY_REGISTERED\",\n `Workflow \"${kind}\" is already registered`,\n { kind },\n );\n this.name = \"WorkflowAlreadyRegisteredError\";\n }\n}\n\n/**\n * Error thrown when a run is not found.\n */\nexport class RunNotFoundError extends WorkflowEngineError {\n constructor(runId: string) {\n super(\"RUN_NOT_FOUND\", `Run \"${runId}\" not found`, { runId });\n this.name = \"RunNotFoundError\";\n }\n}\n\n/**\n * Error thrown when a step fails.\n */\nexport class StepError extends WorkflowEngineError {\n readonly stepKey: string;\n readonly attempt: number;\n readonly cause?: Error;\n\n constructor(\n stepKey: string,\n message: string,\n attempt: number,\n cause?: Error,\n ) {\n super(\"STEP_ERROR\", message, { stepKey, attempt });\n this.name = \"StepError\";\n this.stepKey = stepKey;\n this.attempt = attempt;\n this.cause = cause;\n }\n}\n\n/**\n * Error thrown when a step times out.\n */\nexport class StepTimeoutError extends WorkflowEngineError {\n readonly stepKey: string;\n readonly timeoutMs: number;\n\n constructor(stepKey: string, timeoutMs: number) {\n super(\"STEP_TIMEOUT\", `Step \"${stepKey}\" timed out after ${timeoutMs}ms`, {\n stepKey,\n timeoutMs,\n });\n this.name = \"StepTimeoutError\";\n this.stepKey = stepKey;\n this.timeoutMs = timeoutMs;\n }\n}\n\n/**\n * Error thrown when a workflow is canceled.\n */\nexport class WorkflowCanceledError extends WorkflowEngineError {\n constructor(runId: string) {\n super(\"WORKFLOW_CANCELED\", `Workflow run \"${runId}\" was canceled`, {\n runId,\n });\n this.name = \"WorkflowCanceledError\";\n }\n}\n\n/**\n * Error thrown when waitForRun times out polling for a terminal status.\n */\nexport class WaitForRunTimeoutError extends WorkflowEngineError {\n readonly runId: string;\n readonly timeoutMs: number;\n\n constructor(runId: string, timeoutMs: number) {\n super(\n \"WAIT_FOR_RUN_TIMEOUT\",\n `Timeout waiting for run ${runId} after ${timeoutMs}ms`,\n {\n runId,\n timeoutMs,\n },\n );\n this.name = \"WaitForRunTimeoutError\";\n this.runId = runId;\n this.timeoutMs = timeoutMs;\n }\n}\n\n/**\n * Error thrown when a workflow times out.\n */\nexport class WorkflowTimeoutError extends WorkflowEngineError {\n readonly timeoutMs: number;\n\n constructor(runId: string, timeoutMs: number) {\n super(\n \"WORKFLOW_TIMEOUT\",\n `Workflow run \"${runId}\" timed out after ${timeoutMs}ms`,\n {\n runId,\n timeoutMs,\n },\n );\n this.name = \"WorkflowTimeoutError\";\n this.timeoutMs = timeoutMs;\n }\n}\n","/**\n * Retry utilities for the workflow engine.\n */\n\nimport { WorkflowCanceledError } from \"./errors\";\n\n/**\n * Options for retry behavior.\n */\nexport interface RetryOptions {\n /** Maximum number of retry attempts (default: 3) */\n maxRetries: number;\n /** Initial delay between retries in ms (default: 1000) */\n delay: number;\n /** Backoff multiplier (default: 2) */\n backoff: number;\n /** Optional abort signal to cancel retries */\n signal?: AbortSignal;\n /** Optional callback before each retry */\n onRetry?: (attempt: number, error: Error, nextDelay: number) => void;\n}\n\n/**\n * Default retry options.\n */\nexport const DEFAULT_RETRY_OPTIONS: RetryOptions = {\n maxRetries: 3,\n delay: 1000,\n backoff: 2,\n};\n\n/**\n * Sleep for a given number of milliseconds.\n * Can be canceled via AbortSignal.\n */\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise((resolve, reject) => {\n if (signal?.aborted) {\n reject(new WorkflowCanceledError(\"run\"));\n return;\n }\n\n const cleanup = () => {\n clearTimeout(timeoutId);\n if (onAbort) signal?.removeEventListener(\"abort\", onAbort);\n };\n\n let onAbort: (() => void) | undefined;\n\n const timeoutId = setTimeout(() => {\n cleanup();\n resolve();\n }, ms);\n\n if (signal) {\n onAbort = () => {\n cleanup();\n reject(new WorkflowCanceledError(\"run\"));\n };\n signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n });\n}\n\n/**\n * Execute a function with retry logic.\n *\n * @param fn - The async function to execute\n * @param options - Retry configuration\n * @returns The result of the function\n * @throws The last error if all retries are exhausted\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n options: Partial<RetryOptions> = {},\n): Promise<T> {\n const opts: RetryOptions = { ...DEFAULT_RETRY_OPTIONS, ...options };\n let lastError: Error | undefined;\n let currentDelay = opts.delay;\n\n for (let attempt = 1; attempt <= opts.maxRetries + 1; attempt++) {\n // Check if aborted before attempting\n if (opts.signal?.aborted) {\n throw new Error(\"Aborted\");\n }\n\n try {\n return await fn();\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n\n // If this was the last attempt, throw\n if (attempt > opts.maxRetries) {\n throw lastError;\n }\n\n // Call onRetry callback if provided\n opts.onRetry?.(attempt, lastError, currentDelay);\n\n // Wait before next attempt\n await sleep(currentDelay, opts.signal);\n\n // Apply backoff multiplier\n currentDelay = Math.round(currentDelay * opts.backoff);\n }\n }\n\n // This should never be reached, but TypeScript needs it\n throw lastError ?? new Error(\"Retry failed\");\n}\n\n/**\n * Calculate the delay for a specific retry attempt.\n */\nexport function calculateRetryDelay(\n attempt: number,\n baseDelay: number,\n backoff: number,\n): number {\n return Math.round(baseDelay * Math.pow(backoff, attempt - 1));\n}\n","/**\n * Workflow Orchestrator\n *\n * This module is the heart of the workflow execution system.\n * It manages the execution of workflow steps, handles errors,\n * emits events, and persists state.\n */\n\nimport type {\n WorkflowDefinition,\n WorkflowStep,\n WorkflowContext,\n RunResult,\n Logger,\n SpawnChildOptions,\n} from \"./types\";\nimport type { StorageAdapter } from \"../storage/types\";\nimport type { EventTransport, WorkflowEvent } from \"../events/types\";\nimport {\n WorkflowEngineError,\n StepError,\n StepTimeoutError,\n WorkflowCanceledError,\n WorkflowTimeoutError,\n} from \"../utils/errors\";\nimport { createScopedLogger } from \"../utils/logger\";\nimport { sleep, calculateRetryDelay } from \"../utils/retry\";\n\n/**\n * Checkpoint data for resuming workflows.\n */\nexport interface WorkflowCheckpoint {\n /** Set of step keys that have been completed */\n completedStepKeys: Set<string>;\n /** Accumulated results from completed steps */\n results: Record<string, unknown>;\n}\n\n/**\n * Options for executing a workflow.\n */\nexport interface ExecuteOptions {\n /** The run ID */\n runId: string;\n /** The workflow definition */\n definition: WorkflowDefinition;\n /** Input parameters */\n input: Record<string, unknown>;\n /** Optional metadata */\n metadata?: Record<string, unknown>;\n /** Storage adapter */\n storage: StorageAdapter;\n /** Event transport */\n events: EventTransport;\n /** Logger instance */\n logger: Logger;\n /** Abort controller for cancellation */\n abortController: AbortController;\n /** Function to spawn child workflows */\n spawnChild: (options: SpawnChildOptions) => Promise<string>;\n /** Optional checkpoint for resuming from a previous execution */\n checkpoint?: WorkflowCheckpoint;\n}\n\n/**\n * Execute a workflow definition.\n * This is the main execution logic that runs all steps sequentially.\n */\nexport async function executeWorkflow(\n options: ExecuteOptions,\n): Promise<RunResult> {\n const {\n runId,\n definition,\n input,\n metadata = {},\n storage,\n events,\n logger,\n abortController,\n spawnChild,\n checkpoint,\n } = options;\n\n const startTime = Date.now();\n const isResume = !!checkpoint;\n\n // Update run status to running (if not already)\n // On resume, don't overwrite the original startedAt\n await storage.updateRun(runId, {\n status: \"running\",\n ...(isResume ? {} : { startedAt: new Date() }),\n });\n\n emitEvent(events, logger, {\n runId,\n kind: definition.kind,\n eventType: isResume ? \"run.resumed\" : \"run.started\",\n timestamp: new Date(),\n payload: isResume\n ? { resumedFrom: Array.from(checkpoint.completedStepKeys) }\n : undefined,\n });\n\n // Build the execution context, using checkpoint results if resuming\n const context: WorkflowContext = {\n runId,\n stepId: \"\", // Will be set for each step before handler is called\n kind: definition.kind,\n input,\n results: checkpoint?.results ? { ...checkpoint.results } : {},\n metadata,\n logger: createScopedLogger(logger, runId),\n signal: abortController.signal,\n spawnChild,\n emit: (eventType: string, payload?: unknown) => {\n emitEvent(events, logger, {\n runId,\n kind: definition.kind,\n eventType,\n timestamp: new Date(),\n payload,\n });\n },\n };\n\n // Set up workflow-level timeout if specified\n let workflowTimeoutId: ReturnType<typeof setTimeout> | undefined;\n let workflowTimeoutError: WorkflowTimeoutError | undefined;\n\n if (definition.timeout) {\n workflowTimeoutId = setTimeout(() => {\n workflowTimeoutError = new WorkflowTimeoutError(\n runId,\n definition.timeout!,\n );\n abortController.abort();\n }, definition.timeout);\n }\n\n try {\n // Execute beforeRun hook\n if (definition.hooks?.beforeRun) {\n await definition.hooks.beforeRun(context);\n }\n\n // Execute each step in sequence\n for (const step of definition.steps) {\n // Check for cancellation\n if (abortController.signal.aborted) {\n throw new WorkflowCanceledError(runId);\n }\n\n context.currentStep = step.key;\n\n // Skip already completed steps when resuming\n if (checkpoint?.completedStepKeys.has(step.key)) {\n logger.info(\n `Skipping step \"${step.key}\" (already completed in previous run)`,\n );\n emitEvent(events, logger, {\n runId,\n kind: definition.kind,\n eventType: \"step.skipped\",\n stepKey: step.key,\n timestamp: new Date(),\n payload: { reason: \"checkpoint\" },\n });\n continue;\n }\n\n // Check skip condition\n if (step.skipIf) {\n const shouldSkip = await step.skipIf(context);\n if (shouldSkip) {\n logger.info(`Skipping step \"${step.key}\" (condition met)`);\n\n emitEvent(events, logger, {\n runId,\n kind: definition.kind,\n eventType: \"step.skipped\",\n stepKey: step.key,\n timestamp: new Date(),\n });\n\n continue;\n }\n }\n\n // Execute the step\n const result = await executeStep(step, context, {\n definition,\n storage,\n events,\n logger,\n abortController,\n });\n\n // Store result in context\n context.results[step.key] = result;\n\n // Save checkpoint (accumulated results)\n await storage.updateRun(runId, {\n context: { ...context.results },\n });\n }\n\n // All steps completed successfully\n // Clear workflow timeout\n if (workflowTimeoutId) {\n clearTimeout(workflowTimeoutId);\n }\n\n const duration = Date.now() - startTime;\n const runResult: RunResult = {\n status: \"succeeded\",\n results: context.results,\n duration,\n };\n\n // Execute afterRun hook\n if (definition.hooks?.afterRun) {\n await definition.hooks.afterRun(context, runResult);\n }\n\n // Update run status\n await storage.updateRun(runId, {\n status: \"succeeded\",\n context: context.results,\n finishedAt: new Date(),\n });\n\n emitEvent(events, logger, {\n runId,\n kind: definition.kind,\n eventType: \"run.completed\",\n timestamp: new Date(),\n payload: { results: context.results, duration },\n });\n\n return runResult;\n } catch (error) {\n // Clear workflow timeout\n if (workflowTimeoutId) {\n clearTimeout(workflowTimeoutId);\n }\n\n const duration = Date.now() - startTime;\n\n // Check if this was a workflow timeout (abort triggered by our timeout handler)\n const actualError = workflowTimeoutError ?? error;\n const workflowError = WorkflowEngineError.fromError(actualError);\n\n // Determine final status\n const isTimeout = actualError instanceof WorkflowTimeoutError;\n const isCanceled =\n !isTimeout && actualError instanceof WorkflowCanceledError;\n const status = isCanceled ? \"canceled\" : \"failed\";\n const eventType = isTimeout\n ? \"run.timeout\"\n : isCanceled\n ? \"run.canceled\"\n : \"run.failed\";\n\n const runResult: RunResult = {\n status,\n results: context.results,\n error: workflowError,\n duration,\n };\n\n // Execute afterRun hook (even on failure)\n if (definition.hooks?.afterRun) {\n try {\n await definition.hooks.afterRun(context, runResult);\n } catch (hookError) {\n logger.error(\"afterRun hook failed:\", hookError);\n }\n }\n\n // Update run status\n await storage.updateRun(runId, {\n status,\n context: context.results,\n error: workflowError,\n finishedAt: new Date(),\n });\n\n emitEvent(events, logger, {\n runId,\n kind: definition.kind,\n eventType,\n timestamp: new Date(),\n payload: { error: workflowError.message, duration },\n });\n\n return runResult;\n }\n}\n\n/**\n * Options for executing a single step.\n */\ninterface StepExecutionOptions<TInput = Record<string, unknown>> {\n definition: WorkflowDefinition<TInput>;\n storage: StorageAdapter;\n events: EventTransport;\n logger: Logger;\n abortController: AbortController;\n}\n\n/**\n * Execute a single workflow step with error handling and retries.\n */\nasync function executeStep<TInput>(\n step: WorkflowStep<TInput>,\n context: WorkflowContext<TInput>,\n options: StepExecutionOptions<TInput>,\n): Promise<unknown> {\n const { definition, storage, events, logger, abortController } = options;\n\n // Determine error strategy\n const onError = step.onError ?? definition.defaultOnError ?? \"fail\";\n const maxRetries = step.maxRetries ?? 3;\n const retryDelay = step.retryDelay ?? 1000;\n const retryBackoff = step.retryBackoff ?? 2;\n\n let attempt = 0;\n let lastError: Error | undefined;\n\n while (true) {\n attempt++;\n\n // Check for cancellation\n if (abortController.signal.aborted) {\n throw new WorkflowCanceledError(context.runId);\n }\n\n // Create step record\n const stepRecord = await storage.createStep({\n runId: context.runId,\n stepKey: step.key,\n stepName: step.name,\n status: \"running\",\n attempt,\n startedAt: new Date(),\n });\n\n // Set the current step's ID in context so handlers can track granular operations (e.g., token usage)\n context.stepId = stepRecord.id;\n\n // Emit step started event\n emitEvent(events, logger, {\n runId: context.runId,\n kind: context.kind,\n eventType: \"step.started\",\n stepKey: step.key,\n timestamp: new Date(),\n payload: { attempt },\n });\n\n // Execute beforeStep hook\n if (definition.hooks?.beforeStep) {\n await definition.hooks.beforeStep(context, step);\n }\n\n try {\n // Execute with optional timeout\n // Always race against abort signal to support workflow-level timeouts\n let result: unknown;\n\n if (step.timeout) {\n result = await executeWithTimeout(\n () => step.handler(context),\n step.timeout,\n abortController.signal,\n step.key,\n );\n } else {\n // Race step handler against abort signal for workflow-level timeout support\n result = await raceWithAbort(\n step.handler(context),\n abortController.signal,\n );\n }\n\n // Step succeeded\n await storage.updateStep(stepRecord.id, {\n status: \"succeeded\",\n result,\n finishedAt: new Date(),\n });\n\n // Execute afterStep hook\n if (definition.hooks?.afterStep) {\n await definition.hooks.afterStep(context, step, result);\n }\n\n emitEvent(events, logger, {\n runId: context.runId,\n kind: context.kind,\n eventType: \"step.completed\",\n stepKey: step.key,\n timestamp: new Date(),\n payload: { result },\n });\n\n return result;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n\n // Check if this is a cancellation (abort signal fired)\n const isCanceled =\n error instanceof WorkflowCanceledError ||\n abortController.signal.aborted;\n\n // Update step record with error\n await storage.updateStep(stepRecord.id, {\n status: isCanceled ? \"canceled\" : \"failed\",\n error: WorkflowEngineError.fromError(error),\n finishedAt: new Date(),\n });\n\n // If canceled, re-throw immediately without retry/skip logic\n if (isCanceled) {\n emitEvent(events, logger, {\n runId: context.runId,\n kind: context.kind,\n eventType: \"step.failed\",\n stepKey: step.key,\n timestamp: new Date(),\n payload: { error: lastError.message, attempt },\n });\n throw error;\n }\n\n // Execute onStepError hook\n if (definition.hooks?.onStepError) {\n try {\n await definition.hooks.onStepError(context, step, lastError);\n } catch (hookError) {\n logger.error(\"onStepError hook failed:\", hookError);\n }\n }\n\n emitEvent(events, logger, {\n runId: context.runId,\n kind: context.kind,\n eventType: \"step.failed\",\n stepKey: step.key,\n timestamp: new Date(),\n payload: { error: lastError.message, attempt },\n });\n\n // Handle error based on strategy\n if (onError === \"skip\") {\n logger.warn(`Step \"${step.key}\" failed, skipping (strategy: skip)`);\n emitEvent(events, logger, {\n runId: context.runId,\n kind: context.kind,\n eventType: \"step.skipped\",\n stepKey: step.key,\n timestamp: new Date(),\n payload: { reason: \"error\", error: lastError.message },\n });\n return undefined;\n }\n\n if (onError === \"retry\" && attempt <= maxRetries) {\n const delay = calculateRetryDelay(attempt, retryDelay, retryBackoff);\n logger.warn(\n `Step \"${step.key}\" failed, retrying in ${delay}ms (attempt ${attempt}/${maxRetries})`,\n );\n\n emitEvent(events, logger, {\n runId: context.runId,\n kind: context.kind,\n eventType: \"step.retry\",\n stepKey: step.key,\n timestamp: new Date(),\n payload: { attempt, maxRetries, delay, error: lastError.message },\n });\n\n try {\n await sleep(delay, abortController.signal);\n } catch (sleepError) {\n if (sleepError instanceof WorkflowCanceledError) {\n await storage.updateStep(stepRecord.id, {\n status: \"canceled\",\n finishedAt: new Date(),\n });\n }\n throw sleepError;\n }\n continue;\n }\n\n // Strategy is 'fail' or retries exhausted\n throw new StepError(step.key, lastError.message, attempt, lastError);\n }\n }\n}\n\n/**\n * Execute a function with a timeout.\n *\n * Uses Promise.race to resolve as soon as either the function completes, the\n * timeout fires, or the abort signal triggers. The `finally` block is critical:\n * without it, the losing promise's timer/listener would remain active, leaking\n * memory — especially problematic in long-running engines processing many steps.\n */\nasync function executeWithTimeout<T>(\n fn: () => Promise<T>,\n timeoutMs: number,\n signal: AbortSignal,\n stepKey: string,\n): Promise<T> {\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n let onAbort: (() => void) | undefined;\n\n try {\n return await Promise.race([\n fn(),\n new Promise<never>((_, reject) => {\n timeoutId = setTimeout(() => {\n reject(new StepTimeoutError(stepKey, timeoutMs));\n }, timeoutMs);\n\n onAbort = () => {\n clearTimeout(timeoutId);\n reject(new WorkflowCanceledError(\"run\"));\n };\n signal.addEventListener(\"abort\", onAbort, { once: true });\n }),\n ]);\n } finally {\n if (timeoutId) clearTimeout(timeoutId);\n if (onAbort) signal.removeEventListener(\"abort\", onAbort);\n }\n}\n\n/**\n * Race a promise against an abort signal.\n *\n * Steps without their own timeout still need to respect workflow-level timeouts\n * and cancellation. This wraps the step handler in a Promise.race so that an\n * abort signal (from workflow timeout or user cancellation) can interrupt it.\n *\n * The `finally` cleanup removes the abort listener to prevent accumulating\n * listeners on the signal across many steps — without it, each step would\n * leave a dangling listener even after completing successfully.\n */\nasync function raceWithAbort<T>(\n promise: Promise<T>,\n signal: AbortSignal,\n): Promise<T> {\n if (signal.aborted) {\n throw new WorkflowCanceledError(\"run\");\n }\n\n let onAbort: (() => void) | undefined;\n\n try {\n return await Promise.race([\n promise,\n new Promise<never>((_, reject) => {\n onAbort = () => reject(new WorkflowCanceledError(\"run\"));\n signal.addEventListener(\"abort\", onAbort, { once: true });\n }),\n ]);\n } finally {\n if (onAbort) signal.removeEventListener(\"abort\", onAbort);\n }\n}\n\n/**\n * Helper to emit an event.\n */\nfunction emitEvent(\n events: EventTransport,\n logger: Logger,\n event: WorkflowEvent,\n): void {\n try {\n events.emit(event);\n } catch (error) {\n // Log but don't fail the workflow for event emission errors\n logger.error(\"Failed to emit event:\", error);\n }\n}\n","/**\n * Main WorkflowEngine class.\n *\n * This is the primary entry point for the workflow engine.\n * It provides methods for registering workflows, starting runs,\n * and managing workflow execution.\n */\n\nimport type {\n WorkflowKind,\n WorkflowDefinition,\n WorkflowContext,\n Logger,\n SpawnChildOptions,\n} from \"./types\";\nimport type { StorageAdapter, WorkflowRunRecord } from \"../storage/types\";\nimport type {\n EventTransport,\n EventCallback,\n Unsubscribe,\n WorkflowEvent,\n} from \"../events/types\";\nimport { MemoryStorageAdapter } from \"../storage/memory\";\nimport { MemoryEventTransport } from \"../events/memory\";\nimport { executeWorkflow } from \"./orchestrator\";\nimport {\n WorkflowNotFoundError,\n WorkflowAlreadyRegisteredError,\n RunNotFoundError,\n WaitForRunTimeoutError,\n} from \"../utils/errors\";\nimport { ConsoleLogger } from \"../utils/logger\";\n\n// ============================================================================\n// Configuration Types\n// ============================================================================\n\n/**\n * Configuration for the workflow engine.\n */\nexport interface WorkflowEngineConfig {\n /** Storage adapter for persistence (default: MemoryStorageAdapter) */\n storage?: StorageAdapter;\n\n /** Event transport for real-time updates (default: MemoryEventTransport) */\n events?: EventTransport;\n\n /** Logger instance (default: ConsoleLogger) */\n logger?: Logger;\n\n /** Global settings */\n settings?: {\n /** Default timeout for workflows in ms */\n defaultTimeout?: number;\n\n /** Maximum concurrent workflows */\n maxConcurrency?: number;\n };\n}\n\n/**\n * Options for starting a workflow run.\n */\nexport interface StartRunOptions<TInput = Record<string, unknown>> {\n /** Workflow type to run */\n kind: WorkflowKind;\n\n /** Input parameters */\n input?: TInput;\n\n /** Optional metadata (e.g., userId, topicId) */\n metadata?: Record<string, unknown>;\n\n /** Parent run ID (for child workflows) */\n parentRunId?: string;\n\n /** Delay before starting (ms) */\n delay?: number;\n\n /** Priority for queue ordering (higher = runs first, default: 0) */\n priority?: number;\n}\n\n// ============================================================================\n// WorkflowEngine Class\n// ============================================================================\n\n/**\n * Main workflow engine class.\n *\n * @example\n * ```typescript\n * const engine = new WorkflowEngine({\n * storage: new MemoryStorageAdapter(),\n * });\n *\n * engine.registerWorkflow({\n * kind: 'my.workflow',\n * name: 'My Workflow',\n * steps: [\n * {\n * key: 'step1',\n * name: 'First Step',\n * handler: async (ctx) => {\n * return { message: 'Hello!' };\n * },\n * },\n * ],\n * });\n *\n * const runId = await engine.startRun({ kind: 'my.workflow' });\n * ```\n */\n/**\n * Queued run waiting to be executed when capacity is available.\n */\ninterface QueuedRun {\n runId: string;\n definition: WorkflowDefinition;\n input: Record<string, unknown>;\n metadata?: Record<string, unknown>;\n priority: number;\n queuedAt: Date;\n}\n\nexport class WorkflowEngine {\n private registry = new Map<WorkflowKind, WorkflowDefinition>();\n private storage: StorageAdapter;\n private events: EventTransport;\n private logger: Logger;\n private activeRuns = new Map<string, AbortController>();\n private settings: NonNullable<WorkflowEngineConfig[\"settings\"]>;\n private runQueue: QueuedRun[] = [];\n\n constructor(config: WorkflowEngineConfig = {}) {\n this.storage = config.storage ?? new MemoryStorageAdapter();\n this.events = config.events ?? new MemoryEventTransport();\n this.logger = config.logger ?? new ConsoleLogger();\n this.settings = config.settings ?? {};\n }\n\n /**\n * Initialize the engine and its storage/event adapters.\n * Call this before starting runs if your storage adapter requires initialization\n * (e.g., PostgresStorageAdapter).\n */\n async initialize(): Promise<void> {\n if (this.storage.initialize) {\n await this.storage.initialize();\n }\n }\n\n /**\n * Get the current number of active runs.\n */\n getActiveRunCount(): number {\n return this.activeRuns.size;\n }\n\n /**\n * Get the number of queued runs waiting for capacity.\n */\n getQueuedRunCount(): number {\n return this.runQueue.length;\n }\n\n /**\n * Check if capacity is available for a new run.\n */\n private hasCapacity(): boolean {\n const maxConcurrency = this.settings.maxConcurrency;\n if (maxConcurrency === undefined || maxConcurrency <= 0) {\n return true; // No limit\n }\n return this.activeRuns.size < maxConcurrency;\n }\n\n // ============================================================================\n // Workflow Registration\n // ============================================================================\n\n /**\n * Register a workflow definition.\n * Must be called before runs of this type can be started.\n *\n * @param definition - The workflow definition\n * @throws WorkflowAlreadyRegisteredError if already registered\n */\n registerWorkflow<TInput = Record<string, unknown>>(\n definition: WorkflowDefinition<TInput>,\n ): void {\n if (this.registry.has(definition.kind)) {\n throw new WorkflowAlreadyRegisteredError(definition.kind);\n }\n this.registry.set(definition.kind, definition as WorkflowDefinition);\n this.logger.debug(`Registered workflow: ${definition.kind}`);\n }\n\n /**\n * Unregister a workflow definition.\n *\n * @param kind - The workflow kind to unregister\n * @returns true if the workflow was unregistered, false if not found\n */\n unregisterWorkflow(kind: WorkflowKind): boolean {\n const deleted = this.registry.delete(kind);\n if (deleted) {\n this.logger.debug(`Unregistered workflow: ${kind}`);\n }\n return deleted;\n }\n\n /**\n * Get a registered workflow definition.\n *\n * @param kind - The workflow kind\n * @returns The workflow definition or undefined\n */\n getWorkflow(kind: WorkflowKind): WorkflowDefinition | undefined {\n return this.registry.get(kind);\n }\n\n /**\n * Get all registered workflow kinds.\n */\n getRegisteredWorkflows(): WorkflowKind[] {\n return Array.from(this.registry.keys());\n }\n\n // ============================================================================\n // Run Management\n // ============================================================================\n\n /**\n * Start a new workflow run (non-blocking).\n * The run executes asynchronously and this method returns immediately.\n * If maxConcurrency is set and reached, the run is queued.\n *\n * @param options - Run options including kind and input\n * @returns The generated run ID\n * @throws WorkflowNotFoundError if the workflow kind is not registered\n */\n async startRun<TInput = Record<string, unknown>>(\n options: StartRunOptions<TInput>,\n ): Promise<string> {\n const definition = this.registry.get(options.kind);\n if (!definition) {\n throw new WorkflowNotFoundError(options.kind);\n }\n\n // Create run record (status: queued)\n const run = await this.storage.createRun({\n kind: options.kind,\n status: \"queued\",\n parentRunId: options.parentRunId,\n input: (options.input ?? {}) as Record<string, unknown>,\n metadata: options.metadata ?? {},\n context: {},\n });\n\n const runId = run.id;\n\n // Emit run created event\n this.events.emit({\n runId,\n kind: options.kind,\n eventType: \"run.created\",\n timestamp: new Date(),\n payload: {\n input: options.input,\n metadata: options.metadata,\n priority: options.priority ?? 0,\n },\n });\n\n // Check if we have capacity to start immediately\n if (this.hasCapacity()) {\n // Start execution immediately\n this.executeRun(\n runId,\n definition,\n (options.input ?? {}) as Record<string, unknown>,\n options.metadata,\n options.delay,\n );\n } else {\n // Queue the run for later execution\n this.queueRun({\n runId,\n definition,\n input: (options.input ?? {}) as Record<string, unknown>,\n metadata: options.metadata,\n priority: options.priority ?? 0,\n queuedAt: new Date(),\n });\n\n this.logger.debug(\n `Run ${runId} queued (${this.runQueue.length} in queue)`,\n );\n\n // Emit queued event\n this.events.emit({\n runId,\n kind: options.kind,\n eventType: \"run.queued\",\n timestamp: new Date(),\n payload: { queuePosition: this.runQueue.length },\n });\n }\n\n return runId;\n }\n\n /**\n * Queue a run in priority order.\n */\n private queueRun(queuedRun: QueuedRun): void {\n // Insert in priority order (higher priority first, then FIFO for same priority)\n let inserted = false;\n for (let i = 0; i < this.runQueue.length; i++) {\n if (queuedRun.priority > this.runQueue[i].priority) {\n this.runQueue.splice(i, 0, queuedRun);\n inserted = true;\n break;\n }\n }\n if (!inserted) {\n this.runQueue.push(queuedRun);\n }\n }\n\n /**\n * Execute a run (internal method).\n */\n private executeRun(\n runId: string,\n definition: WorkflowDefinition,\n input: Record<string, unknown>,\n metadata?: Record<string, unknown>,\n delay?: number,\n ): void {\n this.launchRun(runId, definition, input, metadata, delay);\n }\n\n /**\n * Launch a workflow run asynchronously.\n * Shared by both executeRun (new runs) and resumeRun (checkpoint recovery).\n */\n private launchRun(\n runId: string,\n definition: WorkflowDefinition,\n input: Record<string, unknown>,\n metadata?: Record<string, unknown>,\n delay?: number,\n checkpoint?: {\n completedStepKeys: Set<string>;\n results: Record<string, unknown>;\n },\n ): void {\n const abortController = new AbortController();\n this.activeRuns.set(runId, abortController);\n\n const execute = async () => {\n try {\n await executeWorkflow({\n runId,\n definition,\n input,\n metadata,\n storage: this.storage,\n events: this.events,\n logger: this.logger,\n abortController,\n spawnChild: (childOptions: SpawnChildOptions) =>\n this.spawnChild(runId, childOptions),\n checkpoint,\n });\n } finally {\n this.activeRuns.delete(runId);\n this.processQueue();\n }\n };\n\n if (delay) {\n setTimeout(execute, delay);\n } else {\n setImmediate(execute);\n }\n }\n\n /**\n * Process the queue and start runs if capacity is available.\n */\n private processQueue(): void {\n while (this.hasCapacity() && this.runQueue.length > 0) {\n const next = this.runQueue.shift()!;\n this.logger.debug(`Starting queued run ${next.runId}`);\n\n // Emit dequeued event\n this.events.emit({\n runId: next.runId,\n kind: next.definition.kind,\n eventType: \"run.dequeued\",\n timestamp: new Date(),\n });\n\n this.executeRun(next.runId, next.definition, next.input, next.metadata);\n }\n }\n\n /**\n * Start a child workflow from within a parent workflow.\n * Called internally by the context.spawnChild helper.\n */\n private async spawnChild(\n parentRunId: string,\n options: SpawnChildOptions,\n ): Promise<string> {\n return this.startRun({\n kind: options.kind,\n input: options.input,\n metadata: options.metadata,\n parentRunId,\n });\n }\n\n /**\n * Cancel a running workflow.\n * Signals the workflow to stop at the next cancellation point.\n *\n * @param runId - The run ID to cancel\n * @throws {RunNotFoundError} If no run with the given ID exists\n */\n async cancelRun(runId: string): Promise<void> {\n const run = await this.storage.getRun(runId);\n if (!run) {\n throw new RunNotFoundError(runId);\n }\n\n // Don't overwrite terminal statuses\n if ([\"succeeded\", \"failed\", \"canceled\", \"timeout\"].includes(run.status)) {\n return;\n }\n\n // Remove from queue if queued\n const queueIndex = this.runQueue.findIndex((q) => q.runId === runId);\n if (queueIndex !== -1) {\n this.runQueue.splice(queueIndex, 1);\n }\n\n // Signal abort to the running workflow\n const controller = this.activeRuns.get(runId);\n if (controller) {\n controller.abort();\n }\n\n // Update status in storage (the orchestrator will also update on completion)\n await this.storage.updateRun(runId, {\n status: \"canceled\",\n finishedAt: new Date(),\n });\n\n this.events.emit({\n runId,\n kind: run.kind,\n eventType: \"run.canceled\",\n timestamp: new Date(),\n });\n }\n\n /**\n * Get the current status of a run.\n *\n * @param runId - The run ID to look up\n * @returns The run record or null if not found\n */\n async getRunStatus(runId: string): Promise<WorkflowRunRecord | null> {\n return this.storage.getRun(runId);\n }\n\n private static readonly TERMINAL_STATUSES = [\n \"succeeded\",\n \"failed\",\n \"canceled\",\n \"timeout\",\n ];\n private static readonly TERMINAL_EVENT_TYPES = [\n \"run.completed\",\n \"run.failed\",\n \"run.canceled\",\n \"run.timeout\",\n ];\n\n /**\n * Wait for a run to complete.\n * Subscribes to run events and resolves when a terminal event fires.\n * Falls back to an initial storage read to avoid race conditions.\n *\n * @param runId - The run ID to wait for\n * @param options - Wait options\n * @returns The final run record\n */\n async waitForRun(\n runId: string,\n options: { timeout?: number } = {},\n ): Promise<WorkflowRunRecord> {\n const timeout = options.timeout ?? 60000;\n\n // Check storage first to handle already-completed runs (avoids race condition)\n const existingRun = await this.storage.getRun(runId);\n if (!existingRun) {\n throw new RunNotFoundError(runId);\n }\n if (WorkflowEngine.TERMINAL_STATUSES.includes(existingRun.status)) {\n return existingRun;\n }\n\n return new Promise<WorkflowRunRecord>((resolve, reject) => {\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n let unsubscribe: (() => void) | undefined;\n\n const cleanup = () => {\n if (timeoutId) clearTimeout(timeoutId);\n if (unsubscribe) unsubscribe();\n };\n\n // Set up timeout\n timeoutId = setTimeout(() => {\n cleanup();\n reject(new WaitForRunTimeoutError(runId, timeout));\n }, timeout);\n\n // Subscribe to run events\n unsubscribe = this.events.subscribe(runId, async (event) => {\n if (WorkflowEngine.TERMINAL_EVENT_TYPES.includes(event.eventType)) {\n cleanup();\n try {\n const run = await this.storage.getRun(runId);\n if (!run) {\n reject(new RunNotFoundError(runId));\n } else {\n resolve(run);\n }\n } catch (err) {\n reject(err);\n }\n }\n });\n });\n }\n\n // ============================================================================\n // Resume Support\n // ============================================================================\n\n /**\n * Resume an interrupted workflow run from its checkpoint.\n * The run must be in 'queued' or 'running' status.\n *\n * @param runId - The run ID to resume\n * @returns The run ID (same as input)\n * @throws {RunNotFoundError} If no run with the given ID exists\n * @throws {Error} If the run status is not 'queued' or 'running'\n * @throws {WorkflowNotFoundError} If the workflow kind is not registered\n */\n async resumeRun(runId: string): Promise<string> {\n const run = await this.storage.getRun(runId);\n if (!run) {\n throw new RunNotFoundError(runId);\n }\n\n // Check if run can be resumed\n if (![\"queued\", \"running\"].includes(run.status)) {\n throw new Error(`Cannot resume run ${runId}: status is \"${run.status}\"`);\n }\n\n // Get the workflow definition\n const definition = this.registry.get(run.kind);\n if (!definition) {\n throw new WorkflowNotFoundError(run.kind);\n }\n\n // Check if already being executed\n if (this.activeRuns.has(runId)) {\n this.logger.warn(`Run ${runId} is already active, skipping resume`);\n return runId;\n }\n\n this.logger.info(`Resuming run ${runId} from checkpoint`);\n\n // Get completed step keys from the context\n const completedStepKeys = new Set(Object.keys(run.context));\n\n this.launchRun(runId, definition, run.input, run.metadata, undefined, {\n completedStepKeys,\n results: run.context,\n });\n\n return runId;\n }\n\n /**\n * Get all runs that were interrupted and can be resumed.\n * Returns runs with status 'queued' or 'running'.\n */\n async getResumableRuns(): Promise<WorkflowRunRecord[]> {\n const result = await this.storage.listRuns({\n status: [\"queued\", \"running\"],\n });\n return result.items;\n }\n\n /**\n * Resume all interrupted runs.\n * Useful for recovering after a server restart.\n *\n * @returns Array of resumed run IDs\n */\n async resumeAllInterrupted(): Promise<string[]> {\n const resumableRuns = await this.getResumableRuns();\n const resumedIds: string[] = [];\n\n for (const run of resumableRuns) {\n // Only resume if the workflow is registered\n if (this.registry.has(run.kind)) {\n try {\n await this.resumeRun(run.id);\n resumedIds.push(run.id);\n } catch (error) {\n this.logger.error(`Failed to resume run ${run.id}:`, error);\n }\n } else {\n this.logger.warn(\n `Cannot resume run ${run.id}: workflow \"${run.kind}\" not registered`,\n );\n }\n }\n\n return resumedIds;\n }\n\n // ============================================================================\n // Event Subscription\n // ============================================================================\n\n /**\n * Subscribe to events for a specific run.\n *\n * @param runId - The run ID to subscribe to\n * @param callback - Event handler\n * @returns Unsubscribe function\n */\n subscribeToRun(runId: string, callback: EventCallback): Unsubscribe {\n return this.events.subscribe(runId, callback);\n }\n\n /**\n * Subscribe to all workflow events.\n *\n * @param callback - Event handler\n * @returns Unsubscribe function\n */\n subscribeToAll(callback: EventCallback): Unsubscribe {\n return this.events.subscribeAll(callback);\n }\n\n // ============================================================================\n // Storage Access\n // ============================================================================\n\n /**\n * Get the storage adapter.\n * Useful for querying runs and steps directly.\n */\n getStorage(): StorageAdapter {\n return this.storage;\n }\n\n /**\n * Get the event transport.\n * Useful for custom event handling.\n */\n getEvents(): EventTransport {\n return this.events;\n }\n\n // ============================================================================\n // Lifecycle\n // ============================================================================\n\n /**\n * Shutdown the engine gracefully.\n * Cancels all active runs and closes resources.\n */\n async shutdown(): Promise<void> {\n this.logger.info(\"Shutting down workflow engine...\");\n\n // Cancel all active runs\n for (const [runId, controller] of this.activeRuns) {\n this.logger.debug(`Canceling active run: ${runId}`);\n controller.abort();\n }\n\n // Close event transport\n if (this.events.close) {\n this.events.close();\n }\n\n // Close storage adapter\n if (this.storage.close) {\n await this.storage.close();\n }\n\n this.activeRuns.clear();\n this.logger.info(\"Workflow engine shutdown complete\");\n }\n}\n","/**\n * Recipe and Step Handler registries.\n * Provides storage and retrieval of recipes and handlers.\n */\n\nimport RE2 from \"re2\";\nimport type { WorkflowStep } from \"../core/types\";\nimport type {\n Recipe,\n RecipeCondition,\n RecipeRegistry,\n RecipeQueryOptions,\n RegisteredStepHandler,\n StepHandlerRegistry,\n WorkflowKind,\n} from \"./types\";\n\n// ============================================================================\n// Step Handler Registry Implementation\n// ============================================================================\n\n/**\n * In-memory implementation of the step handler registry.\n */\nexport class MemoryStepHandlerRegistry implements StepHandlerRegistry {\n private handlers = new Map<string, RegisteredStepHandler>();\n private tagIndex = new Map<string, Set<string>>();\n\n /** Register a step handler. Throws if a handler with the same ID is already registered. */\n register<TInput = Record<string, unknown>>(\n handler: RegisteredStepHandler<TInput>,\n ): void {\n if (this.handlers.has(handler.id)) {\n throw new Error(`Step handler '${handler.id}' is already registered`);\n }\n\n this.handlers.set(handler.id, handler as RegisteredStepHandler);\n\n // Index by tags\n if (handler.tags) {\n for (const tag of handler.tags) {\n if (!this.tagIndex.has(tag)) {\n this.tagIndex.set(tag, new Set());\n }\n this.tagIndex.get(tag)!.add(handler.id);\n }\n }\n }\n\n /** Get a handler by its unique ID, or undefined if not registered. */\n get(id: string): RegisteredStepHandler | undefined {\n return this.handlers.get(id);\n }\n\n /** Check whether a handler with the given ID is registered. */\n has(id: string): boolean {\n return this.handlers.has(id);\n }\n\n /** List all registered step handlers. */\n list(): RegisteredStepHandler[] {\n return Array.from(this.handlers.values());\n }\n\n /** List all handlers tagged with the given tag. */\n listByTag(tag: string): RegisteredStepHandler[] {\n const ids = this.tagIndex.get(tag);\n if (!ids) return [];\n\n return Array.from(ids)\n .map((id) => this.handlers.get(id))\n .filter((h): h is RegisteredStepHandler => h !== undefined);\n }\n\n /**\n * Resolve a handler reference to a WorkflowStep handler function.\n * Returns undefined if the handler is not found.\n */\n resolve(handlerRef: string): WorkflowStep[\"handler\"] | undefined {\n const registered = this.handlers.get(handlerRef);\n return registered?.handler;\n }\n\n /**\n * Clear all registered handlers (useful for testing).\n */\n clear(): void {\n this.handlers.clear();\n this.tagIndex.clear();\n }\n}\n\n// ============================================================================\n// Recipe Registry Implementation\n// ============================================================================\n\n/**\n * In-memory implementation of the recipe registry.\n */\nexport class MemoryRecipeRegistry implements RecipeRegistry {\n private recipes = new Map<string, Recipe>();\n private kindIndex = new Map<WorkflowKind, Set<string>>();\n private variantIndex = new Map<string, string>(); // \"kind:variant\" -> recipeId\n private tagIndex = new Map<string, Set<string>>();\n\n /** Register a single recipe. Throws if a recipe with the same ID or kind:variant pair is already registered. */\n register(recipe: Recipe): void {\n if (this.recipes.has(recipe.id)) {\n throw new Error(`Recipe '${recipe.id}' is already registered`);\n }\n\n this.recipes.set(recipe.id, recipe);\n\n // Index by workflow kind\n if (!this.kindIndex.has(recipe.workflowKind)) {\n this.kindIndex.set(recipe.workflowKind, new Set());\n }\n this.kindIndex.get(recipe.workflowKind)!.add(recipe.id);\n\n // Index by kind:variant\n const variantKey = `${recipe.workflowKind}:${recipe.variant}`;\n if (this.variantIndex.has(variantKey)) {\n throw new Error(\n `Recipe variant '${recipe.variant}' for '${recipe.workflowKind}' is already registered`,\n );\n }\n this.variantIndex.set(variantKey, recipe.id);\n\n // Index by tags\n if (recipe.tags) {\n for (const tag of recipe.tags) {\n if (!this.tagIndex.has(tag)) {\n this.tagIndex.set(tag, new Set());\n }\n this.tagIndex.get(tag)!.add(recipe.id);\n }\n }\n }\n\n /** Register multiple recipes at once. */\n registerAll(recipes: Recipe[]): void {\n for (const recipe of recipes) {\n this.register(recipe);\n }\n }\n\n /** Get a recipe by its unique ID, or undefined if not registered. */\n get(recipeId: string): Recipe | undefined {\n return this.recipes.get(recipeId);\n }\n\n /** Check whether a recipe with the given ID is registered. */\n has(recipeId: string): boolean {\n return this.recipes.has(recipeId);\n }\n\n /** Get all recipes registered for a given workflow kind. */\n getByKind(workflowKind: WorkflowKind): Recipe[] {\n const ids = this.kindIndex.get(workflowKind);\n if (!ids) return [];\n\n return Array.from(ids)\n .map((id) => this.recipes.get(id))\n .filter((r): r is Recipe => r !== undefined);\n }\n\n /** Get the recipe for a specific workflow kind and variant combination. */\n getVariant(workflowKind: WorkflowKind, variant: string): Recipe | undefined {\n const variantKey = `${workflowKind}:${variant}`;\n const recipeId = this.variantIndex.get(variantKey);\n if (!recipeId) return undefined;\n return this.recipes.get(recipeId);\n }\n\n /**\n * Get the default recipe for a workflow kind.\n * Returns the 'default' variant if one exists, otherwise falls back to the\n * recipe with the lowest numeric priority value (lower number = higher precedence).\n */\n getDefault(workflowKind: WorkflowKind): Recipe | undefined {\n // First try to find a 'default' variant\n const defaultRecipe = this.getVariant(workflowKind, \"default\");\n if (defaultRecipe) return defaultRecipe;\n\n // Fall back to the recipe with the lowest numeric priority (highest precedence).\n // Note: this ascending order is the inverse of RuleBasedPlanner.selectRecipe,\n // which uses descending priority as a tiebreaker in condition-based scoring.\n const recipes = this.getByKind(workflowKind);\n if (recipes.length === 0) return undefined;\n\n return recipes.reduce((lowest, current) => {\n const currentPriority = current.priority ?? 0;\n const lowestPriority = lowest.priority ?? 0;\n return currentPriority < lowestPriority ? current : lowest;\n });\n }\n\n /** List all variant names registered for a workflow kind. */\n listVariants(workflowKind: WorkflowKind): string[] {\n const recipes = this.getByKind(workflowKind);\n return recipes.map((r) => r.variant);\n }\n\n /** Query recipes with optional filters for kind, variant, tags, and input conditions. */\n query(options: RecipeQueryOptions): Recipe[] {\n let results = this.list();\n\n if (options.workflowKind) {\n results = results.filter((r) => r.workflowKind === options.workflowKind);\n }\n\n if (options.variant) {\n results = results.filter((r) => r.variant === options.variant);\n }\n\n if (options.tags && options.tags.length > 0) {\n results = results.filter((r) =>\n options.tags!.some((tag) => r.tags?.includes(tag)),\n );\n }\n\n if (options.matchConditions) {\n results = results.filter((r) => {\n if (!r.conditions || r.conditions.length === 0) return true;\n return this.evaluateConditions(r.conditions, options.matchConditions!);\n });\n }\n\n return results;\n }\n\n /** List all registered recipes. */\n list(): Recipe[] {\n return Array.from(this.recipes.values());\n }\n\n /**\n * Clear all registered recipes (useful for testing).\n */\n clear(): void {\n this.recipes.clear();\n this.kindIndex.clear();\n this.variantIndex.clear();\n this.tagIndex.clear();\n }\n\n /**\n * Evaluate recipe conditions against an input.\n * Returns true if all conditions match.\n *\n * Note: This intentionally mirrors the condition evaluation in planner.ts\n * to keep registry queries independent of the planner implementation.\n */\n private evaluateConditions(\n conditions: Recipe[\"conditions\"],\n input: Record<string, unknown>,\n ): boolean {\n if (!conditions || conditions.length === 0) return true;\n\n return conditions.every((condition) => {\n const fieldValue = this.getNestedValue(input, condition.field);\n return this.evaluateCondition(condition, fieldValue);\n });\n }\n\n /**\n * Get a nested value from an object using dot notation.\n */\n private getNestedValue(obj: Record<string, unknown>, path: string): unknown {\n return path.split(\".\").reduce<unknown>((current, key) => {\n if (current && typeof current === \"object\" && key in current) {\n return (current as Record<string, unknown>)[key];\n }\n return undefined;\n }, obj);\n }\n\n /**\n * Evaluate a single condition.\n */\n private evaluateCondition(\n condition: RecipeCondition,\n fieldValue: unknown,\n ): boolean {\n const { operator, value } = condition;\n\n switch (operator) {\n case \"eq\":\n return fieldValue === value;\n\n case \"neq\":\n return fieldValue !== value;\n\n case \"gt\":\n return typeof fieldValue === \"number\" && typeof value === \"number\"\n ? fieldValue > value\n : false;\n\n case \"gte\":\n return typeof fieldValue === \"number\" && typeof value === \"number\"\n ? fieldValue >= value\n : false;\n\n case \"lt\":\n return typeof fieldValue === \"number\" && typeof value === \"number\"\n ? fieldValue < value\n : false;\n\n case \"lte\":\n return typeof fieldValue === \"number\" && typeof value === \"number\"\n ? fieldValue <= value\n : false;\n\n case \"contains\":\n if (typeof fieldValue === \"string\" && typeof value === \"string\") {\n return fieldValue.includes(value);\n }\n if (Array.isArray(fieldValue)) {\n return fieldValue.includes(value);\n }\n return false;\n\n case \"matches\":\n if (typeof fieldValue === \"string\" && typeof value === \"string\") {\n try {\n return new RE2(value).test(fieldValue);\n } catch {\n return false;\n }\n }\n return false;\n\n case \"exists\":\n return (\n fieldValue !== undefined && fieldValue !== null && fieldValue !== \"\"\n );\n\n case \"notExists\":\n return (\n fieldValue === undefined || fieldValue === null || fieldValue === \"\"\n );\n\n default:\n return false;\n }\n }\n}\n\n// ============================================================================\n// Default Instances\n// ============================================================================\n\n/**\n * Create a combined registry that holds both recipes and step handlers.\n */\nexport interface CombinedRegistry {\n recipes: MemoryRecipeRegistry;\n handlers: MemoryStepHandlerRegistry;\n}\n\n/**\n * Create a new combined registry instance.\n */\nexport function createRegistry(): CombinedRegistry {\n return {\n recipes: new MemoryRecipeRegistry(),\n handlers: new MemoryStepHandlerRegistry(),\n };\n}\n","/**\n * Rule-based planner implementation.\n * Selects recipes and generates plans based on conditions and input analysis.\n */\n\nimport RE2 from \"re2\";\nimport { generateId } from \"../utils/id\";\nimport type {\n ConditionOperator,\n Plan,\n PlannedStep,\n Planner,\n PlanModification,\n PlanningContext,\n PlanValidationResult,\n Recipe,\n RecipeCondition,\n RecipeRegistry,\n RecipeSelectionResult,\n ResourceEstimate,\n StepHandlerRegistry,\n WorkflowKind,\n} from \"./types\";\n\n// ============================================================================\n// Condition Evaluation\n// ============================================================================\n\n/**\n * Get a nested value from an object using dot notation.\n */\nfunction getNestedValue(obj: Record<string, unknown>, path: string): unknown {\n return path.split(\".\").reduce<unknown>((current, key) => {\n if (current && typeof current === \"object\" && key in current) {\n return (current as Record<string, unknown>)[key];\n }\n return undefined;\n }, obj);\n}\n\n/**\n * Evaluate a single condition against a value.\n */\nfunction evaluateCondition(\n operator: ConditionOperator,\n fieldValue: unknown,\n conditionValue: unknown,\n): boolean {\n switch (operator) {\n case \"eq\":\n return fieldValue === conditionValue;\n\n case \"neq\":\n return fieldValue !== conditionValue;\n\n case \"gt\":\n return typeof fieldValue === \"number\" &&\n typeof conditionValue === \"number\"\n ? fieldValue > conditionValue\n : false;\n\n case \"gte\":\n return typeof fieldValue === \"number\" &&\n typeof conditionValue === \"number\"\n ? fieldValue >= conditionValue\n : false;\n\n case \"lt\":\n return typeof fieldValue === \"number\" &&\n typeof conditionValue === \"number\"\n ? fieldValue < conditionValue\n : false;\n\n case \"lte\":\n return typeof fieldValue === \"number\" &&\n typeof conditionValue === \"number\"\n ? fieldValue <= conditionValue\n : false;\n\n case \"contains\":\n if (\n typeof fieldValue === \"string\" &&\n typeof conditionValue === \"string\"\n ) {\n return fieldValue.includes(conditionValue);\n }\n if (Array.isArray(fieldValue)) {\n return fieldValue.includes(conditionValue);\n }\n return false;\n\n case \"matches\":\n if (\n typeof fieldValue === \"string\" &&\n typeof conditionValue === \"string\"\n ) {\n try {\n return new RE2(conditionValue).test(fieldValue);\n } catch {\n return false;\n }\n }\n return false;\n\n case \"exists\":\n return (\n fieldValue !== undefined && fieldValue !== null && fieldValue !== \"\"\n );\n\n case \"notExists\":\n return (\n fieldValue === undefined || fieldValue === null || fieldValue === \"\"\n );\n\n default:\n return false;\n }\n}\n\n/**\n * Score a recipe's conditions against input.\n * Returns a score from 0-100 based on how well conditions match.\n */\nfunction scoreConditions(\n conditions: RecipeCondition[] | undefined,\n input: Record<string, unknown>,\n): number {\n // No conditions = default match with low score\n if (!conditions || conditions.length === 0) {\n return 10;\n }\n\n let matched = 0;\n for (const condition of conditions) {\n const fieldValue = getNestedValue(input, condition.field);\n if (evaluateCondition(condition.operator, fieldValue, condition.value)) {\n matched++;\n }\n }\n\n // All conditions must match for any positive score\n if (matched < conditions.length) {\n return 0;\n }\n\n // Base score 50 ensures condition-matched recipes beat unconditional defaults (score 10).\n // Each additional condition adds 10 points, capped at 100 so forced recipes (100) still win.\n return Math.min(100, 50 + conditions.length * 10);\n}\n\n// ============================================================================\n// Rule-Based Planner Implementation\n// ============================================================================\n\n/**\n * Configuration for the RuleBasedPlanner.\n */\nexport interface RuleBasedPlannerConfig {\n /** Recipe registry to use */\n recipeRegistry: RecipeRegistry;\n\n /** Step handler registry for validation */\n handlerRegistry?: StepHandlerRegistry;\n\n /** Whether to validate handler references during planning */\n validateHandlers?: boolean;\n\n /** Resource estimation defaults (used by estimateResources) */\n resourceEstimates?: {\n /** Estimated API calls per step (default: 1) */\n apiCallsPerStep?: number;\n /** Estimated tokens per step (default: 500) */\n tokensPerStep?: number;\n /** Estimated duration per step in ms (default: 2000) */\n durationPerStep?: number;\n /** Estimated API calls per child workflow (default: 5) */\n apiCallsPerChild?: number;\n };\n}\n\n/**\n * Rule-based planner that selects recipes based on condition matching.\n */\nexport class RuleBasedPlanner implements Planner {\n private recipeRegistry: RecipeRegistry;\n private handlerRegistry?: StepHandlerRegistry;\n private validateHandlers: boolean;\n private resourceEstimates: Required<\n NonNullable<RuleBasedPlannerConfig[\"resourceEstimates\"]>\n >;\n\n constructor(config: RuleBasedPlannerConfig) {\n this.recipeRegistry = config.recipeRegistry;\n this.handlerRegistry = config.handlerRegistry;\n this.validateHandlers = config.validateHandlers ?? false;\n this.resourceEstimates = {\n apiCallsPerStep: config.resourceEstimates?.apiCallsPerStep ?? 1,\n tokensPerStep: config.resourceEstimates?.tokensPerStep ?? 500,\n durationPerStep: config.resourceEstimates?.durationPerStep ?? 2000,\n apiCallsPerChild: config.resourceEstimates?.apiCallsPerChild ?? 5,\n };\n }\n\n /**\n * Select the best recipe for a workflow kind and input.\n */\n async selectRecipe(\n workflowKind: WorkflowKind,\n input: Record<string, unknown>,\n context?: PlanningContext,\n ): Promise<RecipeSelectionResult> {\n // Check for forced recipe in hints\n if (context?.hints?.forceRecipeId) {\n const forced = this.recipeRegistry.get(context.hints.forceRecipeId);\n if (forced) {\n return {\n recipe: forced,\n score: 100,\n reason: `Forced recipe: ${context.hints.forceRecipeId}`,\n };\n }\n }\n\n // Check for preferred variant in hints\n if (context?.hints?.preferredVariant) {\n const preferred = this.recipeRegistry.getVariant(\n workflowKind,\n context.hints.preferredVariant,\n );\n if (preferred) {\n return {\n recipe: preferred,\n score: 90,\n reason: `Preferred variant: ${context.hints.preferredVariant}`,\n };\n }\n }\n\n // Get all recipes for this workflow kind\n const recipes = this.recipeRegistry.getByKind(workflowKind);\n\n if (recipes.length === 0) {\n throw new Error(`No recipes found for workflow kind: ${workflowKind}`);\n }\n\n // Score each recipe\n const scored = recipes.map((recipe) => ({\n recipe,\n conditionScore: scoreConditions(recipe.conditions, input),\n priorityScore: recipe.priority ?? 0,\n }));\n\n // Sort by condition score (desc), then priority (desc)\n scored.sort((a, b) => {\n if (b.conditionScore !== a.conditionScore) {\n return b.conditionScore - a.conditionScore;\n }\n return b.priorityScore - a.priorityScore;\n });\n\n // Find best matching recipe\n const best = scored.find((s) => s.conditionScore > 0);\n\n if (best) {\n const reason = this.buildSelectionReason(best.recipe, input);\n return {\n recipe: best.recipe,\n score: best.conditionScore,\n reason,\n };\n }\n\n // Fall back to default recipe\n const defaultRecipe = this.recipeRegistry.getDefault(workflowKind);\n if (defaultRecipe) {\n return {\n recipe: defaultRecipe,\n score: 10,\n reason: `Fallback to default recipe: ${defaultRecipe.id}`,\n };\n }\n\n // Last resort: use first recipe\n return {\n recipe: recipes[0],\n score: 5,\n reason: `No matching recipe, using first available: ${recipes[0].id}`,\n };\n }\n\n /**\n * Generate a plan from a recipe and input.\n */\n async generatePlan(\n recipe: Recipe,\n input: Record<string, unknown>,\n context?: PlanningContext,\n ): Promise<Plan> {\n const modifications: PlanModification[] = [];\n\n // Start with recipe steps\n let steps = recipe.steps.map((step) => this.recipeStepToPlannedStep(step));\n\n // Apply hint-based modifications\n if (context?.hints) {\n const { skipSteps, includeSteps, additionalConfig } = context.hints;\n\n // Mark steps to skip\n if (skipSteps && skipSteps.length > 0) {\n for (const stepKey of skipSteps) {\n const stepIndex = steps.findIndex((s) => s.key === stepKey);\n if (stepIndex >= 0) {\n steps = steps.filter((s) => s.key !== stepKey);\n modifications.push({\n type: \"remove_step\",\n stepKey,\n value: null,\n reason: `Skipped via planning hints`,\n });\n }\n }\n }\n\n // Apply additional config to all steps\n if (additionalConfig) {\n for (const step of steps) {\n step.config = { ...step.config, ...additionalConfig };\n }\n modifications.push({\n type: \"modify_step\",\n value: additionalConfig,\n reason: \"Applied additional config from planning hints\",\n });\n }\n }\n\n // Apply constraint-based modifications\n if (context?.constraints) {\n const constraintMods = this.applyConstraints(steps, context.constraints);\n modifications.push(...constraintMods.modifications);\n steps = constraintMods.steps;\n }\n\n // Build the plan\n const plan: Plan = {\n id: generateId(),\n recipeId: recipe.id,\n variant: recipe.variant,\n modifications,\n steps,\n defaults: recipe.defaults ?? {},\n reasoning: this.buildPlanReasoning(recipe, modifications, context),\n createdAt: new Date(),\n };\n\n // Estimate resources\n plan.resourceEstimate = this.estimateResources(plan);\n\n return plan;\n }\n\n /**\n * Combined operation: select recipe and generate plan.\n */\n async plan(\n workflowKind: WorkflowKind,\n input: Record<string, unknown>,\n context?: PlanningContext,\n ): Promise<Plan> {\n const selection = await this.selectRecipe(workflowKind, input, context);\n const plan = await this.generatePlan(selection.recipe, input, context);\n\n // Add selection reasoning to plan\n plan.reasoning = `${selection.reason}. ${plan.reasoning ?? \"\"}`.trim();\n\n return plan;\n }\n\n /**\n * Validate a plan before execution.\n */\n validatePlan(plan: Plan): PlanValidationResult {\n const errors: string[] = [];\n const warnings: string[] = [];\n\n // Check plan has steps\n if (!plan.steps || plan.steps.length === 0) {\n errors.push(\"Plan has no steps\");\n }\n\n // Check for duplicate step keys\n const stepKeys = new Set<string>();\n for (const step of plan.steps) {\n if (stepKeys.has(step.key)) {\n errors.push(`Duplicate step key: ${step.key}`);\n }\n stepKeys.add(step.key);\n }\n\n // Validate each step\n for (const step of plan.steps) {\n if (!step.key) {\n errors.push(\"Step missing key\");\n }\n if (!step.name) {\n warnings.push(`Step '${step.key}' missing name`);\n }\n if (!step.handlerRef) {\n errors.push(`Step '${step.key}' missing handlerRef`);\n }\n\n // Validate handler exists (if registry available)\n if (this.validateHandlers && this.handlerRegistry) {\n if (!this.handlerRegistry.has(step.handlerRef)) {\n errors.push(\n `Step '${step.key}' references unknown handler: ${step.handlerRef}`,\n );\n }\n }\n }\n\n // Check child workflows\n if (plan.childWorkflows) {\n for (const child of plan.childWorkflows) {\n if (!child.kind) {\n errors.push(\"Child workflow missing kind\");\n }\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n warnings,\n };\n }\n\n /**\n * Estimate resources required for a plan.\n */\n estimateResources(plan: Plan): ResourceEstimate {\n const {\n apiCallsPerStep,\n tokensPerStep,\n durationPerStep,\n apiCallsPerChild,\n } = this.resourceEstimates;\n\n const stepCount = plan.steps.length;\n const childCount = plan.childWorkflows?.length ?? 0;\n\n return {\n apiCalls: stepCount * apiCallsPerStep + childCount * apiCallsPerChild,\n tokens: stepCount * tokensPerStep,\n duration: stepCount * durationPerStep,\n };\n }\n\n // ============================================================================\n // Private Helpers\n // ============================================================================\n\n /**\n * Convert a recipe step to a planned step.\n */\n private recipeStepToPlannedStep(step: Recipe[\"steps\"][0]): PlannedStep {\n return {\n key: step.key,\n name: step.name,\n handlerRef: step.handlerRef,\n config: step.config ?? {},\n onError: step.onError,\n maxRetries: step.maxRetries,\n retryDelay: step.retryDelay,\n retryBackoff: step.retryBackoff,\n timeout: step.timeout,\n skipCondition: step.skipCondition,\n };\n }\n\n /**\n * Apply constraints to steps and generate modifications.\n */\n private applyConstraints(\n steps: PlannedStep[],\n constraints: NonNullable<PlanningContext[\"constraints\"]>,\n ): { steps: PlannedStep[]; modifications: PlanModification[] } {\n const modifications: PlanModification[] = [];\n const perStepTimeout = constraints.maxDuration\n ? Math.floor(constraints.maxDuration / steps.length)\n : undefined;\n\n // Apply all constraint mutations in a single pass\n const modifiedSteps = steps.map((step) => {\n const modified = { ...step };\n\n if (constraints.priority === \"speed\") {\n modified.timeout = modified.timeout\n ? Math.min(modified.timeout, 30000)\n : 30000;\n modified.maxRetries = Math.min(modified.maxRetries ?? 3, 1);\n }\n\n if (constraints.priority === \"cost\") {\n modified.maxRetries = 0;\n }\n\n if (perStepTimeout !== undefined) {\n modified.timeout = modified.timeout\n ? Math.min(modified.timeout, perStepTimeout)\n : perStepTimeout;\n }\n\n return modified;\n });\n\n // Record what was applied\n if (constraints.priority === \"speed\") {\n modifications.push({\n type: \"set_default\",\n value: { priority: \"speed\" },\n reason: \"Optimized for speed: reduced timeouts and retries\",\n });\n }\n if (constraints.priority === \"cost\") {\n modifications.push({\n type: \"set_default\",\n value: { priority: \"cost\" },\n reason: \"Optimized for cost: disabled retries\",\n });\n }\n if (constraints.maxDuration) {\n modifications.push({\n type: \"set_default\",\n value: { maxDuration: constraints.maxDuration },\n reason: `Applied duration constraint: ${constraints.maxDuration}ms total`,\n });\n }\n\n return { steps: modifiedSteps, modifications };\n }\n\n /**\n * Build a human-readable selection reason.\n */\n private buildSelectionReason(\n recipe: Recipe,\n input: Record<string, unknown>,\n ): string {\n const parts: string[] = [`Selected recipe: ${recipe.id}`];\n\n if (recipe.conditions && recipe.conditions.length > 0) {\n const conditionDescriptions = recipe.conditions.map((c) => {\n const value = getNestedValue(input, c.field);\n return `${c.field} ${c.operator} ${JSON.stringify(c.value)} (actual: ${JSON.stringify(value)})`;\n });\n parts.push(`Matched conditions: ${conditionDescriptions.join(\", \")}`);\n }\n\n if (recipe.priority !== undefined && recipe.priority > 0) {\n parts.push(`Priority: ${recipe.priority}`);\n }\n\n return parts.join(\". \");\n }\n\n /**\n * Build reasoning text for a plan.\n */\n private buildPlanReasoning(\n recipe: Recipe,\n modifications: PlanModification[],\n context?: PlanningContext,\n ): string {\n const parts: string[] = [];\n\n parts.push(`Using recipe '${recipe.name}' (${recipe.variant} variant)`);\n\n if (modifications.length > 0) {\n parts.push(`Applied ${modifications.length} modification(s)`);\n }\n\n if (context?.constraints) {\n const constraintList: string[] = [];\n if (context.constraints.priority) {\n constraintList.push(`priority=${context.constraints.priority}`);\n }\n if (context.constraints.maxDuration) {\n constraintList.push(`maxDuration=${context.constraints.maxDuration}ms`);\n }\n if (context.constraints.maxApiCalls) {\n constraintList.push(`maxApiCalls=${context.constraints.maxApiCalls}`);\n }\n if (constraintList.length > 0) {\n parts.push(`Constraints: ${constraintList.join(\", \")}`);\n }\n }\n\n return parts.join(\". \") + \".\";\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AASO,IAAM,sBAAN,MAAM,6BAA4B,MAAM;AAAA,EACpC;AAAA,EACA;AAAA,EAET,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QAAQ,EAAE;AAAA,IAC3C;AAEA,WAAO,MAAM,KAAK,IAAI;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA,EAKQ,mBACN,QACA,eACA,SACQ;AACR,UAAM,QAAkB,CAAC;AAEzB,UAAM,KAAK,iBAAiB,OAAO,IAAI,MAAM,OAAO,OAAO,WAAW;AAEtE,QAAI,cAAc,SAAS,GAAG;AAC5B,YAAM,KAAK,WAAW,cAAc,MAAM,kBAAkB;AAAA,IAC9D;AAEA,QAAI,SAAS,aAAa;AACxB,YAAM,iBAA2B,CAAC;AAClC,UAAI,QAAQ,YAAY,UAAU;AAChC,uBAAe,KAAK,YAAY,QAAQ,YAAY,QAAQ,EAAE;AAAA,MAChE;AACA,UAAI,QAAQ,YAAY,aAAa;AACnC,uBAAe,KAAK,eAAe,QAAQ,YAAY,WAAW,IAAI;AAAA,MACxE;AACA,UAAI,QAAQ,YAAY,aAAa;AACnC,uBAAe,KAAK,eAAe,QAAQ,YAAY,WAAW,EAAE;AAAA,MACtE;AACA,UAAI,eAAe,SAAS,GAAG;AAC7B,cAAM,KAAK,gBAAgB,eAAe,KAAK,IAAI,CAAC,EAAE;AAAA,MACxD;AAAA,IACF;AAEA,WAAO,MAAM,KAAK,IAAI,IAAI;AAAA,EAC5B;AACF;","names":["RE2","RE2"]}
@@ -0,0 +1,6 @@
1
+ export { C as CronScheduler, a as CronSchedulerConfig, P as PostgresSchedulePersistence, b as PostgresSchedulePersistenceConfig, S as SQLiteSchedulePersistence, c as SQLiteSchedulePersistenceConfig, d as SchedulePersistence, e as Scheduler, T as TriggerType, h as WorkflowSchedule } from '../index-CPfGsmrp.js';
2
+ import '../types-BVShq7zT.js';
3
+ import '../types-BlwFEGzj.js';
4
+ import '../types-DzkEqnQJ.js';
5
+ import 'better-sqlite3';
6
+ import 'pg';
@@ -0,0 +1,12 @@
1
+ import {
2
+ CronScheduler,
3
+ PostgresSchedulePersistence,
4
+ SQLiteSchedulePersistence
5
+ } from "../chunk-U5QGN3RT.js";
6
+ import "../chunk-GXY66V7Q.js";
7
+ export {
8
+ CronScheduler,
9
+ PostgresSchedulePersistence,
10
+ SQLiteSchedulePersistence
11
+ };
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}