Output of a handled turn.
Results carry everything the host boundary needs after a turn: user-visible reply text, updated state, effects, awaitables, route metadata, and events for logging.
{:ok, %Spectre.Result{reply_text: text, state: state}} =
Spectre.ask(MyAgent, "hello")
Summary
Functions
Normalizes the latest terminal action effect into a host-facing outcome.
Returns every terminal lifecycle transition emitted by this result.
Returns the completion with the same precedence used by turn decisions: effect transitions first, then awaitables.
Returns a compact, normalized lifecycle view for host turn dispatch.
Returns the active awaitable from authoritative state, falling back to the transition-local awaitables carried by the result.
Returns the current pending effect from authoritative state, or from a state-less result assembled by a host.
Returns whether the result contains non-blank user-visible reply text.
Types
@type t() :: %Spectre.Result{ awaitables: [Spectre.Awaitable.t()], effects: [Spectre.Effect.t()], events: [term()], input: Spectre.Input.t() | nil, metadata: map(), reply_text: String.t(), route: Spectre.Route.t() | nil, state: Spectre.State.t() | nil }
Functions
@spec action_outcome(t()) :: Spectre.Effect.outcome()
Normalizes the latest terminal action effect into a host-facing outcome.
@spec completions(t()) :: [Spectre.Effect.t() | Spectre.Awaitable.t()]
Returns every terminal lifecycle transition emitted by this result.
@spec latest_completion(t()) :: Spectre.Effect.t() | Spectre.Awaitable.t() | nil
Returns the completion with the same precedence used by turn decisions: effect transitions first, then awaitables.
Returns a compact, normalized lifecycle view for host turn dispatch.
@spec open_awaitable(t()) :: Spectre.Awaitable.t() | nil
Returns the active awaitable from authoritative state, falling back to the transition-local awaitables carried by the result.
@spec pending_effect(t()) :: Spectre.Effect.t() | nil
Returns the current pending effect from authoritative state, or from a state-less result assembled by a host.
Returns whether the result contains non-blank user-visible reply text.