advanced library

Low-level and compatibility APIs for Stem integrations.

Prefer package:stem/stable.dart for application code. This entrypoint exposes the full historical surface for custom transports, instrumentation, signals, and framework integrations that need implementation details.

Classes

AfterTaskPublishPayload
Payload emitted after a task has been published to the broker.
AtomicTerminalResultBackend
Optional atomic terminal-state arbitration for result backends.
BatchStatus
Durable batch status projection derived from group metadata/results.
BatchSubmission
Handle returned when a batch is submitted.
Beat
Scheduler loop that dispatches due ScheduleEntry records.
BeforeTaskPublishPayload
Payload emitted before a task is published to the broker.
BroadcastDefinition
Broadcast channel declaration.
Broker
Abstract broker compatibility facade implemented by queue adapters.
BrokerCapabilities
Runtime-declared capabilities of a broker adapter.
BrokerCapabilitiesProvider
Optional provider interface for adapters with capability declarations that are more precise than the legacy Broker getters.
CalendarScheduleSpec
Schedule specification that matches specific calendar attributes.
Canvas
A high-level API for composing and dispatching tasks.
ChordMetadata
Metadata keys used for chord coordination.
ChordPolicy
Failure policy for a Canvas chord.
ChordResult<T extends Object?>
Result returned by Canvas.chord.
ClockedScheduleSpec
Schedule specification for a fixed, absolute run time.
CodecTaskPayloadEncoder<T>
Bridges a PayloadCodec into the existing TaskPayloadEncoder contract.
ConsoleMetricsExporter
Simple exporter that prints JSON metrics to either sink or stdout.
ControlCommandCompletedPayload
Payload emitted when a control command completes execution.
ControlCommandMessage
Control-plane command dispatched to worker control queues.
ControlCommandReceivedPayload
Payload emitted when a control command is received by a worker.
ControlEnvelopeTypes
Envelope name constants used by control messages.
ControlQueueNames
Helpers for building control queue names.
ControlReplyMessage
Control-plane reply emitted by a worker in response to a command.
CronScheduleSpec
Schedule specification for standard Cron expressions.
DartasticMetricsExporter
Metrics exporter that relays events through Dartastic's OTLP pipeline.
DeadLetterBroker
Optional broker capability for dead-letter inspection and replay.
DeadLetterEntry
Dead letter queue entry containing the failed envelope and metadata.
DeadLetterPage
Page of dead letter results with optional continuation offset.
DeadLetterReplayResult
Result describing entries considered for replay.
DefaultQueueConfig
Default queue alias configuration tying alias to a canonical queue name.
Delivery
Runtime wrapper containing the envelope plus broker-specific receipt info.
DlqEntrySnapshot
Represents a single entry captured in the dead-letter queue.
EmitWorkflowEventRequest
Workflow event emit request payload for isolate communication.
EmitWorkflowEventResponse
Response payload for isolate workflow event emit requests.
EmitWorkflowEventSignal
Request to emit a workflow event from an isolate.
EncodingResultBackend
Result backend decorator that applies TaskPayloadEncoder semantics.
EnqueueTaskSignal
Request to enqueue a task from an isolate.
Envelope
Task payload persisted inside a broker. Since: 0.1.0
EventBus
Distributes external events to workflow runs.
ExponentialJitterRetryStrategy
Exponential backoff with jitter, capped at a configurable duration.
ExtendLeaseSignal
Signals a request to extend a task lease.
FakeWorkflowClock
Controllable clock intended for tests.
FencedLock
A lock handle that carries a monotonically increasing fencing token.
FileRevokeStore
File-based RevokeStore using newline-delimited JSON entries.
Flow<T extends Object?>
Convenience wrapper that builds a WorkflowDefinition using the declarative FlowBuilder DSL.
FlowBuilder
Builder used by Flow to capture workflow steps in declaration order.
FlowContext
Context provided to each workflow step invocation.
FlowStep
Node in a workflow Flow.
FlowStepControl
Control directive emitted by a workflow step to suspend execution.
FunctionTaskHandler<R>
Convenience task handler that delegates execution to a top-level function suitable for isolate execution. Set runInIsolate to false or use FunctionTaskHandler.inline to keep execution in the worker isolate.
GroupDescriptor
Descriptor for group (e.g., chord) aggregation.
GroupDispatch<T extends Object?>
Handle returned by Canvas.group providing a stream of typed results.
GroupStatus
Aggregated status for a group/chord.
HeartbeatSignal
Signals a heartbeat from an executing task.
HeartbeatTransport
Transport abstraction for distributing worker heartbeat payloads.
InMemoryTaskRegistry
Default in-memory registry implementation.
InMemoryWorkflowRegistry
In-memory WorkflowRegistry implementation for local runs and tests.
InspectableBroker
Optional broker capability for queue-depth inspection.
IntervalScheduleSpec
Schedule specification for fixed time intervals.
JsonTaskPayloadEncoder
Default encoder that stores payloads verbatim as JSON-friendly values.
LeaseBroker
Optional broker capability for extending active delivery leases.
Lock
Handle to a lock acquired from a LockStore.
LockStore
Lock store used for unique jobs or scheduling coordination. Since: 0.1.0
LockStoreFactory
Factory for building LockStore instances.
MetricEvent
Immutable metric event emitted to exporters.
MetricsExporter
Consumers implement exporters to relay metric events to specific sinks.
Middleware
Middleware hook invoked for lifecycle events around enqueue/consume/execute. Since: 0.1.0
NoArgsTaskDefinition<TResult>
Typed producer-facing definition for tasks that take no input args.
NoArgsWorkflowRef<TResult extends Object?>
Typed producer-facing reference for workflows that take no input params.
NoopHeartbeatTransport
Transport that intentionally drops all heartbeats.
NoopWorkflowIntrospectionSink
Default no-op sink for workflow step events.
ObservabilityConfig
Aggregates configuration controlling observability integrations.
ObservabilityReport
Aggregated observability information for queues, workers, and DLQ entries.
PayloadCodec<T>
Encodes and decodes a strongly-typed payload value.
PayloadSigner
Handles signing and verification of envelope payloads.
PayloadVersionRegistry<T>
Registry of version-specific payload decoders for a single durable DTO type.
ProgressSignal
Signals a task progress update.
PrometheusMetricsExporter
Exporter that accumulates metrics into Prometheus exposition format.
QueueBinding
Binding between a routing key (and optional headers) and a queue.
QueueBroker
Core queue operations required to publish and consume task deliveries.
QueueCustomEvent
Represents a custom queue event emitted through QueueEventsProducer.
QueueDefinition
Detailed queue definition with optional routing metadata.
QueueEvents
Listens for queue-scoped custom events emitted by QueueEventsProducer.
QueueEventsProducer
Emits queue-scoped custom events.
QueueHeartbeat
Aggregated in-flight counts for a specific queue.
QueuePriorityRange
Priority range constraint applied to a queue definition.
QueueSnapshot
Point-in-time metrics describing a specific queue.
RateLimit
Typed rate-limit configuration shared across workers. Since: 0.3.0
RateLimitDecision
Result of attempting to acquire tokens from the rate limiter.
RateLimiter
Optional rate limiter interface shared across workers. Since: 0.1.0
ResultBackend
Result backend describes how task states are persisted and retrieved. Since: 0.1.0
RetryStrategy
Retry strategy used to compute the next backoff delay. Since: 0.1.0
RevokeEntry
Represents a persisted revoke entry for a task.
RevokeStore
Storage abstraction for task revocations.
RevokeStoreFactory
Factory for building RevokeStore instances.
RouteDecision
Describes the routing decision for an enqueue request.
RouteDefinition
Declarative routing rule mapping match criteria to targets.
RouteMatch
Routing match criteria with optional task glob, headers, or queue override.
RouteRequest
Immutable request used when resolving routing decisions.
RouteTarget
Route target describing queue or broadcast destination.
RoutingConfig
Canonical representation of routing configuration loaded from YAML or JSON.
RoutingInfo
Routing metadata that accompanies published envelopes.
RoutingRegistry
Registry that resolves routing configuration into queue/broadcast decisions.
RoutingSubscription
Subscription describing the queues and broadcast channels a worker should consume from.
RunState
Snapshot of a workflow run persisted by a WorkflowStore.
ScheduleCalculator
Computes the next run time for schedule entries.
ScheduleEntry
Schedule entry persisted by a Beat-like scheduler.
ScheduleEntryDispatchedPayload
Payload emitted when a schedule entry has been dispatched.
ScheduleEntryDuePayload
Payload emitted when a schedule entry becomes due for execution.
ScheduleEntryFailedPayload
Payload emitted when a schedule entry fails to execute.
ScheduleSpec
Base class for all scheduler specifications.
ScheduleSpecKind
Enumerates supported scheduler specification kinds.
ScheduleStore
Storage abstraction used by the scheduler to fetch due entries. Since: 0.1.0
ScheduleStoreFactory
Factory for building ScheduleStore instances.
ScheduleTimezoneResolver
Lazily resolves timezone identifiers.
Signal<T extends StemEvent>
Dispatchable signal with typed payloads and listener management.
SignalContext
Context passed to every signal dispatch.
SignalDispatchConfig
Configuration applied to all signals dispatched through SignalHub.
SignalFilter<T extends StemEvent>
Filters signal emissions based on payload and context.
SignalMiddleware
Middleware adapter that forwards enqueue and execution lifecycle events to the Stem signal dispatcher. Useful for incremental migrations where existing middleware chains should emit signals without rewriting core coordinator or worker logic.
SignalSubscription
Handle representing a registered signal listener.
SigningConfig
Configuration describing signing keys and behaviour.
SolarScheduleSpec
Schedule specification based on celestial/solar events.
StartWorkflowRequest
Workflow start request payload for isolate communication.
StartWorkflowResponse
Response payload for isolate workflow start requests.
StartWorkflowSignal
Request to start a workflow from an isolate.
Stem
Facade used by producer applications to enqueue tasks.
StemApp
Convenience bootstrap for setting up a Stem runtime with sensible defaults.
StemBackendFactory
Factory for building ResultBackend instances.
StemBrokerFactory
Factory for building QueueBroker instances.
StemClient
Shared entrypoint that owns broker/backend configuration for Stem runtimes.
StemClock
Shared clock abstraction used across the Stem ecosystem.
StemConfig
Configuration source for Stem clients and worker processes.
StemEvent
Shared base contract for events emitted across Stem components.
StemMemoryAdapter
Built-in adapter for in-memory stores using the memory:// scheme.
StemMetrics
Central registry that aggregates metrics before exporting them.
StemModule
Generated or hand-authored bundle of tasks and workflow definitions.
StemObserver
Observer-only task result surface.
StemProducer
Producer-only task enqueue surface.
StemResourceFactory<T>
Wrapper for constructing and disposing Stem resources lazily.
StemSignalConfiguration
Configuration for controlling Stem signals behavior.
StemSignalEmitter
Helper used by coordinators, workers, and middleware to emit strongly typed Stem signals without duplicating payload construction.
StemSignals
Central registry for all Stem framework signals.
StemStack
Resolved factories for a Stem deployment stack.
StemStoreAdapter
Adapter that can resolve Stem store factories from a URL.
StemStoreOverrides
Optional URL overrides for specific store kinds.
StemTaskApp
Convenience bootstrap for setting up a Stem runtime with sensible defaults.
StemTracer
Utilities for Stem's tracing integration (Dartastic OpenTelemetry).
StemWorkerConfig
Worker configuration used by the bootstrap helpers.
StemWorkerHost
Worker lifecycle surface for a managed application runtime.
StemWorkflowApp
Helper that bootstraps a workflow runtime on top of StemApp.
SystemStemClock
Default wall-clock implementation.
SystemWorkflowClock
Default clock that proxies to DateTime.now.
TaskCall<TArgs, TResult>
Represents a pending enqueue operation built from a TaskDefinition.
TaskCancellationToken
Cooperative cancellation state exposed to task code.
TaskChainResult<T extends Object?>
Result returned by Canvas.chain.
TaskContext
Context passed to handler implementations during execution.
TaskDefinition<TArgs, TResult>
Declarative task definition to build typed enqueue calls.
TaskDefn
Declares a function-backed task definition.
TaskEnqueueOptions
Options that apply only to the enqueue operation.
TaskEnqueuer
Interface implemented by enqueuers like Stem and task contexts.
TaskEnqueueRequest
Enqueue request payload for isolate communication.
TaskEnqueueResponse
Response payload for isolate enqueue requests.
TaskEnqueueScope
Provides ambient metadata for task enqueue operations.
TaskError
Error metadata captured for failures.
TaskExecutionContext
Shared execution surface for task handlers and isolate entrypoints.
TaskExecutionModeProvider
Optional provider for handlers that explicitly declare their execution mode.
TaskFailurePayload
Payload emitted when a task fails.
TaskHandler<R>
Runtime task handler. Since: 0.1.0
TaskInputContext
Shared input surface for task execution contexts that retain invocation args.
TaskInvocationContext
Context exposed to task entrypoints regardless of execution environment.
TaskInvocationSignal
Control messages emitted by task entrypoints running inside isolates.
TaskMetadata
Optional task metadata for documentation and tooling.
TaskObserver
Observation surface for task and group lifecycle state.
TaskOptions
Configuration options attached to task handlers.
TaskPayloadEncoder
Transforms task handler results to and from backend-friendly payloads.
TaskPayloadEncoderRegistry
Registry for managing and resolving TaskPayloadEncoder instances.
TaskPostrunPayload
Payload emitted after a task finishes execution.
TaskPrerunPayload
Payload emitted before a task begins execution.
TaskReceivedPayload
Payload emitted when a task is received by a worker.
TaskRegistrationEvent
Event emitted when a task handler registers with a registry.
TaskRegistry
Registry mapping task names to handler implementations.
TaskResult<T extends Object?>
Typed view over a TaskStatus returned by helpers such as Stem.waitForTask or canvas typed operations.
TaskResultCaller
Shared typed task-dispatch surface used by producers, apps, and contexts.
TaskRetryPayload
Payload emitted when a task is scheduled for retry.
TaskRetryPolicy
Retry policy configuration for tasks and publish attempts.
TaskRevokedPayload
Payload emitted when a task is revoked.
TaskSignature<T extends Object?>
Describes a task to schedule along with optional decoder metadata.
TaskStatus
Canonical task record stored in the result backend.
TaskStatusListRequest
Query parameters used to list task status records.
TaskStatusPage
Paginated page of task status records.
TaskStatusRecord
Immutable record representing a persisted task status with timestamps.
TaskSuccessPayload
Payload emitted when a task completes successfully.
TlsConfig
TLS configuration for brokers, result backends, and schedule stores.
TlsEnvKeys
Environment variable keys for TLS configuration.
TypedCanvasChain<TInput, TCurrent extends Object?>
A fluent, heterogeneous typed Canvas chain.
TypedTaskHandler<TArgs, TResult>
Typed task handler for the recommended manual registration path.
UniqueTaskClaim
Result of a uniqueness acquisition attempt.
UniqueTaskCoordinator
Coordinates unique task claims using a LockStore.
UniqueTaskMetadata
Internal metadata keys stored on envelopes/result backend to track unique tasks.
WaitForWorkflowRequest
Workflow wait request payload for isolate communication.
WaitForWorkflowResponse
Response payload for isolate workflow wait requests.
WaitForWorkflowSignal
Request to wait for a workflow from an isolate.
Worker
Worker runtime that consumes tasks from a broker and executes handlers.
WorkerAutoscaleConfig
Autoscaling configuration for worker concurrency.
WorkerChildLifecyclePayload
Payload emitted for worker child isolate lifecycle events.
WorkerEvent
An event emitted during worker operation.
WorkerHeartbeat
Structured payload describing worker state for external monitoring systems.
WorkerHeartbeatPayload
Payload emitted when a worker sends a heartbeat.
WorkerInfo
Basic metadata representing a worker that emitted a signal.
WorkerLifecycleConfig
Lifecycle guard configuration for worker isolates and shutdown semantics.
WorkerLifecyclePayload
Payload emitted for worker lifecycle events (start, stop, etc.).
WorkerSnapshot
Captures details about a worker instance at the sample instant.
WorkflowAnnotations
Collection of workflow-related annotations.
WorkflowCaller
Shared typed workflow-start surface used by apps, runtimes, and contexts.
WorkflowCancellationPolicy
Controls how the workflow runtime auto-cancels runs.
WorkflowCheckpoint
Declared script checkpoint metadata used for tooling and replay boundaries.
WorkflowCheckpointView
Uniform workflow checkpoint view for dashboard/CLI drilldowns.
WorkflowClock
Abstraction over time sources used by the workflow runtime and stores.
WorkflowDefinition<T extends Object?>
Declarative workflow definition built via FlowBuilder or a higher-level script facade. Flow definitions capture an ordered execution plan. Script definitions capture a script body plus optional checkpoint metadata used for introspection and tooling.
WorkflowDefn
Declares a workflow definition class.
WorkflowEdge
Describes a directed edge between workflow steps.
WorkflowEventBusFactory
Factory for building workflow EventBus instances that depend on a store.
WorkflowEventEmitter
Shared typed workflow-event dispatch surface used by apps and runtimes.
WorkflowEventRef<T>
Typed reference to a workflow resume event topic.
WorkflowExecutionContext
Shared execution context surface for flow steps and script checkpoints.
WorkflowManifestCheckpoint
Immutable manifest entry describing a declared script checkpoint.
WorkflowManifestEntry
Immutable manifest entry describing a workflow definition.
WorkflowManifestFlowStep
Immutable manifest entry describing a declared flow step.
WorkflowRef<TParams, TResult extends Object?>
Typed producer-facing reference to a registered workflow.
WorkflowRegistry
Registry for workflow definitions keyed by name.
WorkflowResult<T extends Object?>
Typed result returned by StemWorkflowApp.waitForCompletion.
WorkflowResumeContext
Shared suspension/resume surface implemented by flow steps and script checkpoints.
WorkflowRun
Marks a workflow class method as the run entrypoint.
WorkflowRunDetailView
Combined run + checkpoint drilldown view.
WorkflowRunPayload
Payload emitted for workflow run events.
WorkflowRunRuntimeMetadata
Run-scoped runtime metadata persisted alongside workflow params.
WorkflowRuntime
Coordinates execution of workflow runs by dequeuing tasks, invoking steps, and persisting progress via a WorkflowStore.
WorkflowRuntimeEvent
Runtime orchestration event emitted by the workflow runtime.
WorkflowRunView
Uniform workflow run view tailored for dashboard/CLI drilldowns.
WorkflowScript<T extends Object?>
High-level workflow facade that allows scripts to be authored as a single async function using step, sleep, and awaitEvent helpers.
WorkflowScriptContext
Runtime context exposed to workflow scripts. Implementations are provided by the workflow runtime so scripts can execute with durable semantics.
WorkflowScriptStepContext
Context provided to each script checkpoint invocation. Mirrors FlowContext but tailored for the facade helpers.
WorkflowStartCall<TParams, TResult extends Object?>
Typed start request built from a WorkflowRef.
WorkflowStep
Marks a workflow class method as a durable step.
WorkflowStepEntry
Persisted step checkpoint metadata for a workflow run.
WorkflowStepEvent
Step-level execution event emitted by the workflow runtime.
WorkflowStore
Persistent storage for workflow runs, checkpoints, and suspensions.
WorkflowStoreFactory
Factory for building WorkflowStore instances.
WorkflowWatcher
Describes a workflow event watcher registered by the runtime.
WorkflowWatcherResolution
Represents a watcher that has been resolved (event delivered or timed out).

Enums

BatchLifecycleState
Lifecycle states for first-class batch submissions.
BrokerDeliveryGuarantee
Delivery guarantee advertised by a broker adapter.
ChordPolicyKind
Determines when a chord callback may run.
FlowControlType
Enumerates the suspension control types.
MetricType
Known metric aggregation types supported by the exporters.
RateLimiterFailureMode
Defines behavior when a limiter backend call fails.
RouteDecisionType
Distinguishes queue vs broadcast routing decisions.
RoutingTargetType
Target classification for routing operations.
SigningAlgorithm
Supported signing algorithms.
StemStoreKind
Store categories that can be resolved by adapters.
TaskExecutionMode
Selects the isolate in which a task handler executes.
TaskState
Logical task status across enqueue, running, success, failure states.
UniqueTaskClaimStatus
Indicates whether uniqueness was acquired or a duplicate was detected.
WorkerEventType
Types of events a worker can emit.
WorkerShutdownMode
Shutdown modes for workers.
WorkflowChannelKind
Logical channel used by workflow-related task enqueues.
WorkflowContinuationReason
Why a workflow continuation task was enqueued.
WorkflowDefinitionKind
Identifies whether a workflow is step-based or script-based.
WorkflowKind
Workflow definition type for annotated definitions.
WorkflowRunStatus
Status of a workflow run emitted via signals.
WorkflowRuntimeEventType
Runtime-level workflow events emitted by orchestration transitions.
WorkflowStatus
Lifecycle state of a workflow run.
WorkflowStepEventType
Enumerates workflow step event types emitted by the runtime.
WorkflowStepKind
Kinds of workflow steps exposed for introspection.

Mixins

WorkflowIntrospectionSink
Sink for workflow step execution events.

Extensions

BrokerCapabilitiesExtension on Broker
Resolves capabilities without making Broker implementations add a new required member. External adapters therefore remain source-compatible and still receive a useful snapshot from the legacy getters.
ControlCommandEnvelope on ControlCommandMessage
Extension helpers to convert a command into an Envelope.
ControlReplyEnvelope on ControlReplyMessage
Extension helpers to convert a reply into an Envelope.
LockFencingTokenX on Lock
Provides the fencing token when a lock implementation supports fencing.
NoArgsTaskDefinitionExtension on NoArgsTaskDefinition<TResult>
Convenience helpers for waiting on typed no-arg task definitions.
PayloadMapX on Map<String, Object?>
Typed read helpers for durable task-argument and workflow-parameter maps.
QueueBrokerCapabilitiesExtension on QueueBroker
Resolves capabilities for code that accepts the narrow QueueBroker type.
QueueBrokerOptionalOperations on QueueBroker
Optional operations for code that accepts the narrow QueueBroker type.
StemAppWorkflowExtension on StemApp
Convenience helpers for layering workflows onto an existing StemApp.
StemStackClientBootstrap on StemStack
Convenience helpers for bootstrapping clients from a resolved StemStack.
TaskDefinitionCanvasX on TaskDefinition<TArgs, TResult>
Convenience helpers for turning TaskDefinitions into signatures.
TaskDefinitionExtension on TaskDefinition<TArgs, TResult>
Convenience helpers for waiting on typed task definitions.
TaskEnqueuerBuilderExtension on TaskEnqueuer
Convenience helpers for building typed enqueue requests directly from a task enqueuer.
TaskExecutionContextProgressX on TaskExecutionContext
Shared task-progress helpers for execution contexts.
TaskHandlerExecutionModeX on TaskHandler<R>
Resolves the execution mode for a legacy or explicitly-declared handler.
TaskInputContextArgs on TaskInputContext
Typed read helpers for task invocation args.
TaskStateX on TaskState
Helpers for reasoning about task lifecycle states.
WorkflowEventRefExtension on WorkflowEventRef<T>
Convenience helpers for dispatching typed workflow events.
WorkflowEventRefWaitExtension on WorkflowEventRef<T>
Direct typed wait helpers on WorkflowEventRef.
WorkflowExecutionContextParams on WorkflowExecutionContext
Typed read helpers for workflow start parameters.
WorkflowExecutionContextValues on WorkflowExecutionContext
Typed read helpers for prior workflow step and checkpoint values.
WorkflowManifestDefinition on WorkflowDefinition<Object?>
Converts workflow definitions into typed manifest entries.
WorkflowRefExtension on WorkflowRef<TParams, TResult>
Convenience helpers for waiting on typed workflow refs using a generic WorkflowCaller.
WorkflowResumeContextValues on WorkflowResumeContext
Typed resume helpers for durable workflow suspensions.
WorkflowScriptContextParams on WorkflowScriptContext
Typed read helpers for workflow start parameters in script run methods.
WorkflowScriptStepSuspensionJson on WorkflowScriptStepContext
Low-level suspension helpers for workflow script checkpoints.

Constants

signatureHeader → const String
Header storing the base64 encoded payload signature.
signatureKeyHeader → const String
Header storing the signing key identifier used to calculate the signature.
stemArgsEncoderHeader → const String
Header key storing the args encoder identifier.
stemArgsEncoderMetaKey → const String
Metadata key storing the args encoder identifier.
stemResultEncoderMetaKey → const String
Metadata key storing the result encoder identifier.
workflow → const WorkflowAnnotations
Annotation namespace for workflow metadata.
workflowParentRunIdParamKey → const String
Reserved params key storing the parent workflow run identifier.
workflowRunTaskName → const String
Task name used for workflow run execution tasks.
workflowRuntimeMetadataParamKey → const String
Reserved params key storing internal runtime metadata for workflow runs.

Functions

controlCommandFromEnvelope(Envelope envelope) ControlCommandMessage
Parses a ControlCommandMessage from a control command Envelope.
controlReplyFromEnvelope(Envelope envelope) ControlReplyMessage
Parses a ControlReplyMessage from a control reply Envelope.
ensureTaskPayloadEncoderRegistry(TaskPayloadEncoderRegistry? registry, {TaskPayloadEncoder resultEncoder = const JsonTaskPayloadEncoder(), TaskPayloadEncoder argsEncoder = const JsonTaskPayloadEncoder(), Iterable<TaskPayloadEncoder> additionalEncoders = const []}) TaskPayloadEncoderRegistry
Ensures a TaskPayloadEncoderRegistry is available, instantiating one when registry is null and registering any additionalEncoders with whichever registry is ultimately used.
generateEnvelopeId() String
Unique identifier generator used for task envelopes by default.
generateRevokeVersion() int
Generates a monotonically increasing revoke version based on UTC time.
logTlsHandshakeFailure({required String component, required String host, required int port, required TlsConfig? config, required Object error, required StackTrace stack}) → void
Logs diagnostic details for failed TLS handshakes.
registerModuleTaskHandlers(TaskRegistry registry, Iterable<TaskHandler<Object?>> handlers) → void
Registers task handlers while tolerating re-registration of identical handler instances.
stemNow() DateTime
Returns the current instant from the active clock scope.
task<T extends Object?>(String name, {Map<String, Object?> args = const {}, Map<String, String> headers = const {}, TaskOptions options = const TaskOptions(), Map<String, Object?> meta = const {}, DateTime? notBefore, T decode(Object? payload)?}) TaskSignature<T>
Returns a TaskSignature that creates an Envelope for a task.
withStemClock<T>(StemClock clock, T body()) → T
Runs body using clock as the active clock for this zone.
withTaskPayloadEncoder(ResultBackend backend, TaskPayloadEncoderRegistry registry) ResultBackend
Wraps a ResultBackend to encode/decode payloads via registry.

Typedefs

Clock = DateTime Function()
Clock function used for deterministic testing.
SignalErrorReporter = void Function(String signalName, Object error, StackTrace stackTrace)
Function signature for reporting signal errors.
SignalHandler<T extends StemEvent> = FutureOr<void> Function(T payload, SignalContext context)
Signature for signal handlers.
SignalPredicate<T extends StemEvent> = bool Function(T payload, SignalContext context)
Predicate used to filter signal payloads.
TaskArgsDecoder<TArgs> = TArgs Function(Map<String, Object?> args)
Decodes persisted task arguments into the typed handler input.
TaskArgsEncoder<TArgs> = Map<String, Object?> Function(TArgs args)
Encodes strongly typed task arguments into a JSON-ready map.
TaskEntrypoint = FutureOr<Object?> Function(TaskInvocationContext context, Map<String, Object?> args)
Signature for task entrypoints that can run inside isolate executors.
TaskMetaBuilder<TArgs> = Map<String, Object?> Function(TArgs args)
Builds metadata for a task invocation using its arguments.
TaskResultDecoder<TResult> = TResult Function(Object? payload)
Decodes a persisted task result payload into a typed value.
WorkflowScriptBody<T extends Object?> = FutureOr<T> Function(WorkflowScriptContext context)
Declarative workflow definition built via FlowBuilder.

Exceptions / Errors

ScheduleConflictException
Thrown when a schedule mutation conflicts with a newer store version.
SignatureVerificationException
Thrown when an envelope signature is missing or invalid.
TaskCancellationException
Thrown when a task cooperatively observes cancellation.
TaskRetryRequest
Signals an explicit retry request from within a task handler.
TaskRevokedException
Exception thrown when a task is revoked during execution.
WorkflowSuspensionSignal
Internal control-flow signal used by expression-style suspension helpers.