Next
What a phase commits for its own task: the next checkpoint, a wait, or the task’s outcome. Returned from the body
of TaskRuntime.commit.
import { type Ids, Next, TaskRuntime, Tx } from "@effective-harness/core"import * as Effect from "effect/Effect"
declare const task: { readonly conversationId: Ids.ConversationId }declare const receipt: { readonly id: string }
const program = Effect.gen(function* () { yield* TaskRuntime.commit( Effect.gen(function* () { yield* Tx.appendEntry(task.conversationId, { kind: "app.receipt", data: receipt }) return Next.complete({ receipt: receipt.id }) }) )})Since v0.0.0
Aborted (interface)
Section titled “Aborted (interface)”The task’s abort handler finished: the task ended aborted.
Signature
export interface Aborted<R> { readonly _tag: "Aborted" readonly reason?: string readonly result?: R}Since v0.0.0
Complete (interface)
Section titled “Complete (interface)”The task finished with a result.
Signature
export interface Complete<R> { readonly _tag: "Complete" readonly result: R}Since v0.0.0
Continue (interface)
Section titled “Continue (interface)”Replace the checkpoint and keep running.
Signature
export interface Continue<C> { readonly _tag: "Continue" readonly checkpoint: C}Since v0.0.0
Fail (interface)
Section titled “Fail (interface)”The task finished with an error, and optionally a partial result.
Signature
export interface Fail<R> { readonly _tag: "Fail" readonly error: TaskOutcomeError readonly result?: R}Since v0.0.0
Next (type alias)
Section titled “Next (type alias)”Signature
type Next<C = Json, R = Json> = Continue<C> | Wait<C> | Complete<R> | Fail<R> | Aborted<R>Since v0.0.0
Wait (interface)
Section titled “Wait (interface)”Park the task without an invocation until every task in on is terminal, then resume at checkpoint.
Signature
export interface Wait<C> { readonly _tag: "Wait" readonly checkpoint: C readonly on: ReadonlyArray<TaskId> readonly policy: JoinPolicy}Since v0.0.0
aborted
Section titled “aborted”Finish aborted; the outcome of an abort handler.
Signature
declare const aborted: <R = never>(reason?: string, result?: R) => Aborted<R>Since v0.0.0
complete
Section titled “complete”Finish with a result.
Signature
declare const complete: <R>(result: R) => Complete<R>Since v0.0.0
continue
Section titled “continue”Replace the checkpoint and keep running.
Signature
declare const continue: <C>(checkpoint: C) => Continue<C>Since v0.0.0
Finish failed.
Signature
declare const fail: <R = never>(error: TaskOutcomeError | string, result?: R) => Fail<R>Since v0.0.0
Park until every task in on is terminal. failFast aborts the other tasks once one fails.
Signature
declare const wait: <C>(checkpoint: C, on: ReadonlyArray<TaskId>, policy: JoinPolicy) => Wait<C>Since v0.0.0