# `Spectre.Route`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/types/route.ex#L1)

Normalized routing decision returned by Spectre.

A route is the stable handoff between router and runner. It contains the
selected label, handler, strategy, scores, and metadata needed for logging or
host decisions.

# `t`

```elixir
@type t() :: %Spectre.Route{
  accepted?: boolean(),
  confidence: float() | nil,
  core_route: term(),
  definition_injections: [Spectre.Prompt.Operation.t()],
  escalation_reason: String.t() | nil,
  fallback_error: term(),
  flow: atom() | nil,
  handler: Spectre.Rule.handler() | nil,
  injections: [Spectre.Prompt.Operation.t()],
  label: atom() | nil,
  labels: [atom()],
  local: map() | nil,
  margin: float() | nil,
  owner: module() | nil,
  raw: term(),
  rule: Spectre.Rule.t() | nil,
  scope: Spectre.Definition.scope() | nil,
  scores: map(),
  semantic_cache: term(),
  semantic_cache_after: term(),
  semantic_examples: [map()],
  strategy: atom(),
  terminal?: boolean()
}
```

# `from_rule`

```elixir
@spec from_rule(Spectre.Rule.t(), atom(), String.t() | nil) :: t()
```

Builds an accepted deterministic route from a compiled rule.

`raw` is the matched input text, or `nil` when inspecting a declaration or
restoring its dispatch identity without retaining the original transport.

    route = Spectre.Route.from_rule(rule, :regex, "hello")

# `new`

```elixir
@spec new(map() | keyword() | t()) :: t()
```

Builds a normalized route struct.

    route = Spectre.Route.new(label: :hello, accepted?: true)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
