Type Alias: Command
Command = {
activity:string;id?:string;input:Json;lease_ttl_ms?:number;queue?:string;retry?:RetryPolicy;schema_ref?:string;timeout_ms?:number;type:"task"; } | {fire_at_ms?:number;fire_in_ms?:number;id?:string;type:"timer"; } | {id?:string;input:Json;type:"spawn";workflow:string; } | {id?:string;name:string;schema_ref?:string;timeout_ms?:number;type:"await_signal"; } | {channel:string;data:Json;type:"emit"; } | {output:Json;type:"complete"; } | {input:Json;type:"continue_as_new"; }
Defined in: sdk/ts/sdk/src/kernel/protocol.ts:136
A command as a reducer returns it and the kernel validates it. Build them with cmd.*. task, timer, spawn and await_signal open a step and take an optional step id (default: kernel-derived, ${type}#${step_no}); complete and continue_as_new must be last.
Union Members
Type Literal
{ activity: string; id?: string; input: Json; lease_ttl_ms?: number; queue?: string; retry?: RetryPolicy; schema_ref?: string; timeout_ms?: number; type: "task"; }
activity
activity:
string
Activity name.
id?
optionalid?:string
Explicit step id.
input
input:
Json
Validated task input.
lease_ttl_ms?
optionallease_ttl_ms?:number
Lease per attempt, in milliseconds. Default: the kernel's own.
queue?
optionalqueue?:string
Queue to dispatch on. Default "default".
retry?
optionalretry?:RetryPolicy
Retry policy. Default: the kernel's own.
schema_ref?
optionalschema_ref?:string
name@hash of the activity, recorded on the step's events.
timeout_ms?
optionaltimeout_ms?:number
Wall-clock budget for one attempt: the worker aborts at it, the host reaps past it.
type
type:
"task"
Run an activity.
Type Literal
{ fire_at_ms?: number; fire_in_ms?: number; id?: string; type: "timer"; }
fire_at_ms?
optionalfire_at_ms?:number
Absolute epoch time, in milliseconds.
fire_in_ms?
optionalfire_in_ms?:number
Delay from the reduced event's ts_ms, in milliseconds.
id?
optionalid?:string
Explicit step id.
type
type:
"timer"
Fire a timer event. Exactly one of fire_in_ms / fire_at_ms.
Type Literal
{ id?: string; input: Json; type: "spawn"; workflow: string; }
id?
optionalid?:string
Explicit step id.
input
input:
Json
The child's start input.
type
type:
"spawn"
Start a child run.
workflow
workflow:
string
Workflow name.
Type Literal
{ id?: string; name: string; schema_ref?: string; timeout_ms?: number; type: "await_signal"; }
id?
optionalid?:string
Explicit step id.
name
name:
string
Signal name.
schema_ref?
optionalschema_ref?:string
name@hash of the signal.
timeout_ms?
optionaltimeout_ms?:number
Recorded as the wait's expires_at_ms; not enforced by the host.
type
type:
"await_signal"
Park until a signal is delivered.
Type Literal
{ channel: string; data: Json; type: "emit"; }
channel
channel:
string
Channel name.
data
data:
Json
The payload.
type
type:
"emit"
Publish on a side channel; never journaled.
Type Literal
{ output: Json; type: "complete"; }
output
output:
Json
The run's output.
type
type:
"complete"
Close the run as completed.
Type Literal
{ input: Json; type: "continue_as_new"; }
input
input:
Json
Start input for the successor run.
type
type:
"continue_as_new"
Close the run as continued.