[pather / planner] add bend_policy, default to error on non-minimal number of bends

This commit is contained in:
Jan Petykiewicz 2026-08-27 10:34:35 -07:00
commit 91a5d63b57
5 changed files with 267 additions and 25 deletions

View file

@ -450,15 +450,17 @@ Stable imports for custom tool authors live in `masque.builder`. The
`masque.builder.planner` module is an internal planner implementation; do not
import it from user code.
`trace_into()` uses the same primitive-offer route selection and now searches
bounded route topologies with up to four bend roles. This preserves the common
straight, bend, S-like, U-like, and dogleg cases while allowing routes that
need an additional bounded bend pair. Bend-family requests search one-bend
`trace_into()` uses the same primitive-offer route selection and defaults to
the minimal main-route bend count required by the endpoint relationship: zero
for a straight, one for a quarter-turn, and two for S- and U-like connections.
Ptype adapters do not consume this bend budget. Set `bend_policy='flexible'`
to search bounded route topologies with up to four bend roles, including
dogleg and loop-like fallbacks. Bend-family requests then search one-bend
routes before three-bend routes; other families search zero-to-two-bend routes
before four-bend routes. The first band with a legal route wins. Within that
band, candidates are ordered by total primitive-offer cost, adapter count, step
count, and deterministic discovery order. The route `strategy` affects only
that final discovery-order tie-break.
band, candidates are ordered by total primitive-offer cost, adapter count,
step count, and deterministic discovery order. The route `strategy` affects
only that final discovery-order tie-break.
Explicit-length `jog()` routes may also be satisfied by composing a straight
primitive before or after an omitted-length native S primitive. `uturn()` routes