Skip to content

@oona/vlo / index / ReducerEvent

Type Alias: ReducerEvent ​

ReducerEvent = { input: Json; random: string; ts_ms: number; type: "started"; usage_total: Usage; } | { activity: string; attempt: number; cause?: Cause; error?: string; output?: Json; random: string; status: Status; step_id: string; ts_ms: number; type: "task_done"; usage: Usage; usage_total: Usage; } | { name: string; payload: Json; random: string; step_id: string; ts_ms: number; type: "signal"; usage_total: Usage; } | { random: string; step_id: string; ts_ms: number; type: "timer"; usage_total: Usage; } | { child_run_id: string; output?: Json; random: string; status: Status; step_id: string; ts_ms: number; type: "child_done"; usage_total: Usage; }

Defined in: sdk/ts/sdk/src/kernel/protocol.ts:241

usage_total rides on every variant: the run's banked total including this event, so a reducer can decide on a budget without keeping its own tally.

Union Members ​

Type Literal ​

{ input: Json; random: string; ts_ms: number; type: "started"; usage_total: Usage; }

input ​

input: Json

The start input, as given to init.

random ​

random: string

32 hex chars of journaled randomness — the reducer's only entropy.

ts_ms ​

ts_ms: number

Journaled event time, epoch milliseconds — the reducer's only clock.

type ​

type: "started"

The run's first event.

usage_total ​

usage_total: Usage

The run's banked usage including this event.


Type Literal ​

{ activity: string; attempt: number; cause?: Cause; error?: string; output?: Json; random: string; status: Status; step_id: string; ts_ms: number; type: "task_done"; usage: Usage; usage_total: Usage; }

activity ​

activity: string

Activity name.

attempt ​

attempt: number

The attempt that produced this result.

cause? ​

optional cause?: Cause

Why it did not succeed.

error? ​

optional error?: string

Error message from the worker or host.

output? ​

optional output?: Json

Validated output; present when succeeded.

random ​

random: string

32 hex chars of journaled randomness.

status ​

status: Status

succeeded, failed or cancelled.

step_id ​

step_id: string

Step id of the task.

ts_ms ​

ts_ms: number

Journaled event time, epoch milliseconds.

type ​

type: "task_done"

A task reached a terminal status.

usage ​

usage: Usage

What this attempt itself consumed; zeroed when the worker reported none.

usage_total ​

usage_total: Usage

The run's banked usage including this event.


Type Literal ​

{ name: string; payload: Json; random: string; step_id: string; ts_ms: number; type: "signal"; usage_total: Usage; }

name ​

name: string

Signal name.

payload ​

payload: Json

Validated payload.

random ​

random: string

32 hex chars of journaled randomness.

step_id ​

step_id: string

Step id of the wait.

ts_ms ​

ts_ms: number

Journaled event time, epoch milliseconds.

type ​

type: "signal"

A signal the run was waiting on was delivered.

usage_total ​

usage_total: Usage

The run's banked usage including this event.


Type Literal ​

{ random: string; step_id: string; ts_ms: number; type: "timer"; usage_total: Usage; }

random ​

random: string

32 hex chars of journaled randomness.

step_id ​

step_id: string

Step id of the timer.

ts_ms ​

ts_ms: number

Journaled event time, epoch milliseconds.

type ​

type: "timer"

A timer fired.

usage_total ​

usage_total: Usage

The run's banked usage including this event.


Type Literal ​

{ child_run_id: string; output?: Json; random: string; status: Status; step_id: string; ts_ms: number; type: "child_done"; usage_total: Usage; }

child_run_id ​

child_run_id: string

The child's run id.

output? ​

optional output?: Json

The child's output; present when it completed.

random ​

random: string

32 hex chars of journaled randomness.

status ​

status: Status

succeeded, failed or cancelled, mapped from the child's run status.

step_id ​

step_id: string

Step id of the spawn.

ts_ms ​

ts_ms: number

Journaled event time, epoch milliseconds.

type ​

type: "child_done"

A child run closed.

usage_total ​

usage_total: Usage

The run's banked usage including this event.