Documentation
¶
Overview ¶
Package route wraps registry.Decider with everything internal/sdlc/engine needs to turn an AskJev effect into a JevDecided event: call-time criteria assembly for a select node's candidates and for top-level workflow selection (one assembler serving both, so their criteria have identical shape), bounded and redacted state, and Jev-unavailable/shadow-mode handling that always yields a usable decision — "a run never stalls on the classifier". route never decides thresholds itself; every decision is registry.Decider's, exactly as internal/mcp already reuses it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bound ¶
Bound head/tail-excerpts text to at most maxBytes, keeping both ends intact rather than truncating mid-structure — ralph's LOG_READ_MAX_BYTES discipline, ported to a single reusable place instead of every caller re-deriving its own truncation. maxBytes <= 0 means unbounded. The split is adjusted to the nearest rune boundary on each side so neither excerpt ends mid-character.
func CriteriaFromRubrics ¶
CriteriaFromRubrics is the one call-time criteria assembler both sdlc.agent-selection (id to each candidate's catalog rubric) and sdlc.workflow-selection (name to workflow description) use, so their criteria have identical shape by construction rather than by two call sites happening to agree: an empty id or rubric is dropped (Jev cannot use it either way), and each rubric is bounded the same way state is.
Types ¶
type Config ¶
type Config struct {
// Decider supplies the registry and applies its thresholds; its own
// Getenv controls JEVKIT_SHADOW, exactly as internal/mcp uses it.
Decider *registry.Decider
// Client asks Jev.
Client Asker
// Redact scrubs state and call-time rubrics before transport; an error
// rejects the call rather than sending unredacted text.
Redact func(string) (string, []redact.Hit, error)
// key, breaker open). It must not return or log the key.
Unavailable func(ctx context.Context) string
// Now stamps a synthesized (Jev-unavailable) decision; nil means
// time.Now.
Now func() time.Time
}
Config wires a Router. Everything except Now is required.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router asks Jev's registered question sets and applies their policy.
func (*Router) Decide ¶
func (r *Router) Decide(ctx context.Context, setID, state string, criteria map[string]string) (Result, error)
Decide asks question set setID against state (already bounded by the caller via Bound; Decide redacts it before it reaches the wire) and returns the registry policy's decision.
criteria supplies call-time options for a choice question the registry declares with none (sdlc.agent-selection's candidates, or sdlc.workflow-selection's available workflows) — id to rubric, the same shape for both, which is what makes them "one implementation of call-time criteria assembly" per the plan. Pass nil for any other question set, whose criteria (if any) are already fixed in the registry.
Decide never returns an error for a reason internal to Jev itself (unavailable, transport failure, an unusable response, or a decide failure): each of those instead yields Available=false and a synthesized fallback Decision, so a caller can always proceed. An error return means the call was malformed (an unknown question set, criteria supplied where none was needed or omitted where it was, or state that failed redaction).