Skip to content

Rulvar API reference


Rulvar API reference / @rulvar/rulvar / EventBus

Class: EventBus

Defined in: packages/core/dist/index.d.ts

The per-run event bus. seq is strictly increasing in emission order; iterate() yields events from subscription onward; on() is the callback form over the same stream and the same seq values.

Constructors

Constructor

ts
new EventBus(options): EventBus;

Defined in: packages/core/dist/index.d.ts

Parameters

ParameterTypeDescription
options{ firstSeq?: number; mask?: (body) => WorkflowEventBody; maskEvents?: boolean; now?: () => number; runId: string; spans: SpanRegistry; }-
options.firstSeq?numberFirst seq value (default 0): the resumed-segment base that keeps seq strictly increasing per run across segments (v1.22.0 review P1-2).
options.mask?(body) => WorkflowEventBodyThe compiled masking policy applied when maskEvents is on (RV-217): the default credential set plus host patterns. Absent falls back to the default maskSecretsDeep.
options.maskEvents?booleanDefault true (M8-T04): key-shaped strings in every emitted body are masked. Telemetry only, never the journal: events are excluded from identity by construction, so masking cannot perturb replay.
options.now?() => number-
options.runIdstring-
options.spansSpanRegistry-

Returns

EventBus

Methods

emit()

ts
emit(
   body, 
   spanId, 
   replayed?): WorkflowEvent;

Defined in: packages/core/dist/index.d.ts

Parameters

ParameterType
bodyWorkflowEventBody
spanIdstring
replayed?boolean

Returns

WorkflowEvent


end()

ts
end(): void;

Defined in: packages/core/dist/index.d.ts

Ends every open iterator once the run has settled.

Returns

void


iterate()

ts
iterate(): AsyncIterable<WorkflowEvent>;

Defined in: packages/core/dist/index.d.ts

Returns

AsyncIterable&lt;WorkflowEvent&gt;


on()

ts
on<T>(type, cb): () => void;

Defined in: packages/core/dist/index.d.ts

Type Parameters

Type Parameter
T extends | "plan:revised" | "node:parked" | "node:cancelled" | "node:linked" | "orchestrator:woke" | "orchestrator:budget" | "orchestrator:acceptance" | "escalation:raised" | "escalation:decided" | "spawn:admitted" | "spawn:rejected" | "admission:lease-lost" | "verify:failed" | "ledger:op" | "stall:detected" | "guard:oscillation" | "resolution:applied" | "resolution:superseded" | "termination:debit" | "termination:denied" | "termination:config-drift" | "journal:compat" | "agent:queued" | "agent:start" | "agent:phase:start" | "agent:phase:end" | "agent:end" | "agent:error" | "quota:denied" | "budget:exposure-wait" | "agent:schema-retry" | "control:wire" | "agent:stream" | "run:start" | "run:end" | "phase:start" | "log" | "budget:update" | "external:waiting" | "approval:pending" | "child:start" | "child:end" | "determinism:warning" | "tool:start" | "tool:end"

Parameters

ParameterType
typeT
cb(event) => void

Returns

() => void