Skip to main content
Version: Current

ActOptions

@rotorsoft/act-root


@rotorsoft/act-root / act/src / ActOptions

Type Alias: ActOptions<TLanes>

ActOptions<TLanes> = object

Defined in: libs/act/src/types/act.ts:128

Options for Act construction (passed via ActBuilder.build).

Type Parameters​

TLanes​

TLanes extends string = string

Properties​

autocloseWindow?​

readonly optional autocloseWindow?: object

Defined in: libs/act/src/types/act.ts:189

Optional off-hours window restricting when autoclose evaluates. A synthesized autoclose reaction that triggers outside the window defers to the next instant the window opens — derived from the window itself, no polling cadence. Hours are [0, 23] integers in timeZone (IANA, default "UTC", DST-correct); start > end is an overnight window (e.g. { start: 22, end: 6 }). Omit to evaluate regardless of clock time.

end​

readonly end: number

start​

readonly start: number

timeZone?​

readonly optional timeZone?: string


autoSettle?​

readonly optional autoSettle?: boolean

Defined in: libs/act/src/types/act.ts:131

Settle on its own after a change that frees reaction work: a commit, reset(), unblock(), restore() or a notification from another process. Set false when you walk the pipeline yourself with correlate() / drain() (tests that check its steps, tools); the event-sourcing guide's settle section lists the timers that still run. Default: true.


circuitBreaker?​

readonly optional circuitBreaker?: CircuitBreakerOptions

Defined in: libs/act/src/types/act.ts:179

Orchestrator circuit breaker for the drain loop. After failureThreshold consecutive store failures the breaker opens and the drain loop skips claim() for cooldownMs instead of hammering a down backend, then allows a half-open trial. Out-of-range values throw a ZodError at act().build(). Defaults: threshold 5, cooldown 30s.


correlator?​

readonly optional correlator?: Correlator

Defined in: libs/act/src/types/act.ts:150

Correlation-id generator for originating actions. When omitted, Act uses default_correlator, which produces a readable, time-monotonic-within-window, lowercase id of the form {state[:4]}-{action[:4]}-{ts}{rnd} (18 chars).

Reactions inherit reactingTo.meta.correlation so the chain stays intact — the delegate is only consulted on originating commits and for the close-the-books transaction.


drain?​

readonly optional drain?: boolean

Defined in: libs/act/src/types/act.ts:171

Run the local reaction pipeline on this instance. Defaults to true. Set false on writer-only or sidecar instances: drain controllers' auto-cycle workers don't start, correlate() / drain() / settle() become no-ops, and the notify handler skips its drain-wakeup arm (but still emits the notified lifecycle event so observability sidecars work).


listen?​

readonly optional listen?: boolean

Defined in: libs/act/src/types/act.ts:162

Subscribe to Store.notify on this instance. Defaults to true. Set false on instances that only commit and never react — the subscriber-connection budget is the practical scaling ceiling for the notify/listen pattern, and writer-only fleets spend it for nothing when they subscribe to a channel they never read. Commits still emit notifications (that's part of the store's commit protocol); only the subscriber side is gated.


maxSubscribedStreams?​

readonly optional maxSubscribedStreams?: number

Defined in: libs/act/src/types/act.ts:129

Cap for the LRU tracking what each dynamically resolved reaction target was last subscribed at. Statically declared targets are held outside it and never evicted, so their lane and priority stay owned by the build-time subscribe. Default: DEFAULT_MAX_SUBSCRIBED_STREAMS.


onlyLanes?​

readonly optional onlyLanes?: ReadonlyArray<TLanes>

Defined in: libs/act/src/types/act.ts:152

Restrict this process to a subset of declared lanes.


scoped?​

readonly optional scoped?: Scoped

Defined in: libs/act/src/types/act.ts:139

Per-Act ports. When set, this Act runs against the provided store + cache instead of the singletons — threaded via AsyncLocalStorage so internals are unchanged. Both are required together (a shared cache across distinct stores would collide on stream keys). Omit for the singleton path.


settleDebounceMs?​

readonly optional settleDebounceMs?: number

Defined in: libs/act/src/types/act.ts:130

Debounce window (ms) used by settle() when the caller doesn't pass SettleOptions.debounceMs. Tune this once per Act instance instead of threading the value through every call site. Default: DEFAULT_SETTLE_DEBOUNCE_MS.