# `ToolCall.LocalTypeAlgorithm`

Shared local-type expansion algorithm used by AST and, later, `TypeExpr`.

The algorithm owns cyclic detection, inlining and instantiation budgets,
hoisting, and `$defs` naming. Adapters supply the node structure, variable
substitution, reference syntax, and naming details.

# `instantiation`

```elixir
@type instantiation() :: %{
  key: ToolCall.LocalTypeAlgorithm.Adapter.key(),
  args: [term()],
  body: term()
}
```

One hoisted `$defs` entry, with the arguments of its instantiation.

# `cyclic_keys`

```elixir
@spec cyclic_keys(map(), module()) ::
  MapSet.t(ToolCall.LocalTypeAlgorithm.Adapter.key())
```

# `expand`

```elixir
@spec expand(term(), map(), module(), keyword()) ::
  {term(), boolean(), [instantiation()]}
```

# `max_defs`

```elixir
@spec max_defs() :: pos_integer()
```

---

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