Backplane.AiProtocol.Lifecycle (backplane_ai_protocol v0.7.0)

Copy Markdown

Pure lifecycle transitions for one local execution handle.

Summary

Types

finish_status()

@type finish_status() :: :complete | :incomplete

status()

@type status() :: :completed | :incomplete | :failed | :cancelled | :interrupted

t()

@type t() :: %Backplane.AiProtocol.Lifecycle{terminal: map() | nil}

Functions

cancel(error, upstream_outcome)

@spec cancel(
  t() | {:ok, t()} | {:error, Backplane.AiProtocol.Error.t()},
  :known | :unknown
) ::
  {:ok, t()} | {:error, Backplane.AiProtocol.Error.t()}

fail(error, kind)

@spec fail(t() | {:ok, t()} | {:error, Backplane.AiProtocol.Error.t()}, atom()) ::
  {:ok, t()} | {:error, Backplane.AiProtocol.Error.t()}

finish(error, status, stop_reason)

@spec finish(
  t() | {:ok, t()} | {:error, Backplane.AiProtocol.Error.t()},
  finish_status(),
  atom()
) ::
  {:ok, t()} | {:error, Backplane.AiProtocol.Error.t()}

interrupt(error, upstream_outcome)

@spec interrupt(
  t() | {:ok, t()} | {:error, Backplane.AiProtocol.Error.t()},
  :known | :unknown
) ::
  {:ok, t()} | {:error, Backplane.AiProtocol.Error.t()}

new()

@spec new() :: t()

start_attempt(error)

@spec start_attempt(t() | {:ok, t()} | {:error, Backplane.AiProtocol.Error.t()}) ::
  {:ok, t()} | {:error, Backplane.AiProtocol.Error.t()}

terminal(error)

@spec terminal(t() | {:ok, t()} | {:error, Backplane.AiProtocol.Error.t()}) ::
  {:ok, map()} | {:error, Backplane.AiProtocol.Error.t()}