@bluelibs/runner - v6.8.0
    Preparing search index...

    Class TaskRunner

    Coordinates task execution for the runtime.

    The task runner owns task admission checks, middleware composition, execution-context tracking, abort-signal propagation, and health-policy enforcement. It also adapts to the runtime lifecycle: before store.lock(), tasks are recomposed on every call because resources may still register interceptors during init(). After the store is locked, the interceptor graph becomes stable, so composed runners are cached per task id for fast repeated execution.

    Index
    • Creates a task runner bound to the shared runtime state.

      Parameters

      • store: Store

        The central runtime registry used to resolve tasks, resources, and lifecycle state.

      • eventManager: EventManager

        The event manager associated with the current runtime.

      • logger: Logger

        The runtime logger instance available to task execution.

      • executionContextStore: ExecutionContextStore = ...

        The execution-context store used to propagate nested task frames and abort signals.

      Returns TaskRunner

    eventManager: EventManager

    The event manager associated with the current runtime.

    logger: Logger

    The runtime logger instance available to task execution.

    runnerStore: Map<string | symbol, CachedTaskRunner> = ...
    store: Store

    The central runtime registry used to resolve tasks, resources, and lifecycle state.

    • Registers a global interceptor around task execution.

      Interceptors wrap the composed task middleware chain from the outside and may optionally be limited to matching task definitions via options.when. This must be called before store.lock(), while the runtime is still building its middleware graph.

      Parameters

      Returns void

    • Executes a registered task through the runtime pipeline.

      This applies lifecycle admission checks, resolves the effective abort signal, enforces task health policies, runs middleware, and records the execution frame for nested task tracing.

      Type Parameters

      Parameters

      • task: ITask<TInput, TOutput, TDeps>

        The registered task definition to execute.

      • Optionalinput: TInput

        The input payload passed to the task.

      • Optionaloptions: TaskCallOptions

        Optional call metadata such as source and abort signal.

      Returns Promise<TOutput | undefined>

      The task result, or undefined if the task resolves without a value.