Skip to main content

ActOptions

@rotorsoft/act-root


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

Type Alias: ActOptions<TLanes>

ActOptions<TLanes> = object

Defined in: libs/act/src/act.ts:175

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

Type Parametersโ€‹

TLanesโ€‹

TLanes extends string = string

Propertiesโ€‹

autocloseCycleMs?โ€‹

readonly optional autocloseCycleMs?: number

Defined in: libs/act/src/act.ts:230

Online close cycle cadence in ms (#837 / epic #802). The app-level autoclose controller ticks at this interval, iterates states with .autocloses(...) declared, and schedules truncate-and-seed for streams whose predicate returned true.

Default DEFAULT_AUTOCLOSE_CYCLE_MS (60 s). Validated [10_000, 3_600_000] at act().build(); out-of-range throws.

Zero-cost when no state declares .autocloses(...) โ€” the controller is never constructed in that case.


closeBatchSize?โ€‹

readonly optional closeBatchSize?: number

Defined in: libs/act/src/act.ts:241

Max number of streams the autoclose cycle considers per tick per state (#837). Bounds memory + truncate fan-out so a misconfigured predicate that matches "everything" can't take down the writer.

Default DEFAULT_CLOSE_BATCH_SIZE (64). Validated [1, 1024]. Above 1024, the builder throws โ€” operators with genuine high-throughput needs opt out by passing a custom predicate that pre-filters.


closeOnError?โ€‹

readonly optional closeOnError?: boolean

Defined in: libs/act/src/act.ts:259

Whether predicate exceptions should mark the stream as closed (#837). Default false โ€” a thrown predicate is logged and the stream is skipped that cycle. Set true to close on error (defensive policy for "if I can't evaluate, assume terminal").


closeYieldMs?โ€‹

readonly optional closeYieldMs?: number

Defined in: libs/act/src/act.ts:252

Microsecond yield delay between successive Store.truncate calls within one cycle tick (#837). Defaults to 0 (microtask yield only). SQLite operators set a positive value to let the writer lock release between rows; PG / InMemory adapters generally don't need it because they don't serialize writers globally.

Validated [0, 1000].


correlator?โ€‹

readonly optional correlator?: Correlator

Defined in: libs/act/src/act.ts:196

Correlation-id generator for originating actions (ACT-404). 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/act.ts:217

Run the local reaction pipeline on this instance (#803). 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/act.ts:208

Subscribe to Store.notify on this instance (#803). 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/act.ts:176

Cap for the LRU set tracking already- subscribed reaction streams. Default: DEFAULT_MAX_SUBSCRIBED_STREAMS.


onlyLanes?โ€‹

readonly optional onlyLanes?: ReadonlyArray<TLanes>

Defined in: libs/act/src/act.ts:198

Restrict this process to a subset of declared lanes (ACT-1103).


scoped?โ€‹

readonly optional scoped?: Scoped

Defined in: libs/act/src/act.ts:185

Per-Act ports (ACT-501). 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/act.ts:177

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.