Skip to content
Français

TaskInteractionContext

import type { TaskInteractionContext } from "@elie-laloum/outpost";
  • stateRequired
    WorkflowJson | undefined
    Latest immutable task continuation state restored from the checkpoint, or undefined before the first save.
  • answerRequired
    WorkflowAnswerRecord | undefined
    Accepted human reply available to the resumed task attempt.
  • saveRequired
    (state: WorkflowJson) => Promise<void>
    Validate, copy and persist JSON state during the current active attempt. Does not suspend execution.
  • suspendRequired
    (question: WorkflowInputQuestion, state: WorkflowJson) => never
    Store a new question and continuation state, then end this attempt through a suspension signal. Do not catch that signal; the scheduler persists waiting-input before returning.
export interface TaskInteractionContext {
  readonly state: WorkflowJson | undefined;
  readonly answer: WorkflowAnswerRecord | undefined;
  save(state: WorkflowJson): Promise<void>;
  suspend(question: WorkflowInputQuestion, state: WorkflowJson): never;
}