@ariestools/actor
v2.0.0
Published
Environment-agnostic Actor base class with lifecycle, timers, readiness, and optional telemetry
Downloads
4,324
Readme
@ariestools/actor
Actor.whenStopped() observes the instance's first complete stop or forced
shutdown. It resolves after cleanup or rejects if forced cleanup fails;
cancellation and startup failure alone do not settle it. The result remains
retained across standalone restarts. Actor-system consumers use this structural
signal to revoke an individual resident's dependency scope after cleanup.
The Actor base class — the extracted XL1 ActorV3 pattern, merged with the
dapp-core AbstractActor improvements — plus supervision helpers. Compiles
neutral (browser + node + any JS runtime).
Actor— create/start/stop lifecycle (AbstractCreatable), non-overlapping interval timers withfirstRun: 'immediate' | 'deferred'phasing, readiness warm pass (readyHandler/runReadyHandler/whenReady), abort signal per start cycle, pre-lock cooperativerequestCancellation(), memoizedshutdown()rollback, and no-op-safe OpenTelemetry instrument helpers (counter/gauge/histogram/upDownCounter/span/spanAsync)Orchestrator— parallel/dynamic actor supervision (from xyo-chain), with a structural readiness guard instead of aninstanceofgate and cancellation requested before it waits for in-flight starts or enters actor stopbootActors— sequential create → start → warm-pass boot with rollbackstopOrShutdown— stop withshutdown()fallbackcreateMemoryLocator— Map-backedInstanceLocatorfor tests, browser boot, and locator-less consumerscreateDeferred— rejection-sink-attached deferredPeriodicActor— non-overlapping scheduled and one-shot passes, retry accounting, overridable terminal-error policy, andwhenFailed()for process supervisionProviderActor— anActorconstructed from aProviderActorContext. Actor-specific config varies per actor, while every context references the same immutableResolvedProviderSystemand therefore the same locator, provider instances, resolved provider config, and provider resolution. It layers thePeriodicActorrun coordinator with scheduling disabled by default:runToCompletion()provides an auto-stopping one-shot lifecycle,wake()accepts wired events, andisSchedulingEnabled: trueenables timer events.
Actor structurally satisfies @ariestools/cli-kit's ManagedActor contract;
a type-level conformance spec (cli-kit as devDependency) locks that in.
