index.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * VL Workflow Engine
  3. * JS port of the Go workflow executor (spec v3.16)
  4. *
  5. * Usage:
  6. * const { Engine } = require('vl-workflow-engine');
  7. * const engine = new Engine(workflowJSON);
  8. * const errors = engine.validate();
  9. * const ctx = await engine.execute(params, adapters);
  10. */
  11. const { Engine } = require('./lib/engine');
  12. const { ExpressionEvaluator, toBool, toFloat } = require('./lib/expression');
  13. const { Registry, parseServiceSignature, parseVariableDeclaration, parseParamDeclaration } = require('./lib/registry');
  14. const { ParallelExecutor, ParallelError } = require('./lib/parallel');
  15. const {
  16. WorkflowType, StepType, getStepType, ExecutionStatus, WriteMode, LoopMode,
  17. ParallelErrorStrategy, RunEventType, SUPPORTED_VERSIONS, isV310OrLater,
  18. RESERVED_NEXT_KEYWORDS,
  19. LLMError, buildErrorMap, ExecutionContext, ChildExecutionContext
  20. } = require('./lib/types');
  21. const { applyOutputMapping, emitEvent, LoopBreakSignal } = require('./lib/executor');
  22. module.exports = {
  23. // Core
  24. Engine,
  25. // Expression
  26. ExpressionEvaluator, toBool, toFloat,
  27. // Registry
  28. Registry, parseServiceSignature, parseVariableDeclaration, parseParamDeclaration,
  29. // Parallel
  30. ParallelExecutor, ParallelError,
  31. // Types & Constants
  32. WorkflowType, StepType, getStepType, ExecutionStatus, WriteMode, LoopMode,
  33. ParallelErrorStrategy, RunEventType, SUPPORTED_VERSIONS, isV310OrLater,
  34. LLMError, buildErrorMap, ExecutionContext, ChildExecutionContext,
  35. RESERVED_NEXT_KEYWORDS,
  36. // Executor helpers (for custom step handlers)
  37. applyOutputMapping, emitEvent, LoopBreakSignal
  38. };