@bernierllc/nevar-action-executor
v0.1.0
Published
Dispatches action intents to registered handlers with retry, priorResults accumulation, and deferred trigger collection for the Nevar rules engine
Readme
@bernierllc/nevar-action-executor
Dispatches action intents to registered handlers for the Nevar rules engine. Manages retry logic, priorResults accumulation, and deferred trigger collection.
Installation
npm install @bernierllc/nevar-action-executorUsage
import { ActionExecutor, ActionHandlerLookup } from '@bernierllc/nevar-action-executor';
const executor = new ActionExecutor(registry, 'fail-fast');
const result = await executor.execute(intents, context);
// result.results - Array of ActionResult for each intent
// result.deferredTriggers - Collected deferred triggers from action outputs
// result.durationMs - Total execution durationAPI
ActionExecutor
Dispatches action intents to registered handlers sequentially. Accumulates prior results so each handler can access outputs from previous actions.
Constructor: new ActionExecutor(registry: ActionHandlerLookup, failureMode?: ActionFailureMode)
registry- Object withget(actionType)andhas(actionType)methods for looking up handlersfailureMode-'fail-fast'(default) stops on first error,'continue'executes all intents regardless of errors
Methods:
execute(intents, context, failureModeOverride?)- Executes action intents sequentially. Returns anExecutionResultwithresults: ActionResult[],deferredTriggers: DeferredTrigger[], anddurationMs: number. Supports per-intent retry viaActionRetryConfigusing@bernierllc/retry-policy.
Throws: NevarActionError if no handler is registered for an action type.
ActionHandlerLookup (type)
Interface for looking up action handlers. Decouples the executor from the concrete registry.
get(actionType: string): ActionHandlerDefinition | undefinedhas(actionType: string): boolean
Integration Documentation
Logger Integration
This package does not integrate with @bernierllc/logger. As a core package, logger integration is optional and not included by default. Consumers should handle logging at the service layer.
NeverHub Integration
This package does not integrate with @bernierllc/neverhub-adapter. As a core package, NeverHub integration is not applicable. NeverHub registration should be handled by service-layer packages that compose this package.
