Skip to main content

Module controller

Module controller 

Source
Expand description

STEL L2 economics controller — evaluate StelPlan → StelDecision / StelEstimate.

Phase 2 P2-S3: normative admission states (serve | degrade | bypass | cache_hit).

Re-exports§

pub use crate::stel_core::consts::COMPACT_INVOKE_TOKENS;
pub use crate::stel_core::consts::COMPACT_SCHEMA_TOKENS;
pub use crate::stel_core::consts::STATIC_MANUAL_FLOOR;
pub use crate::stel_core::consts::STATIC_RESPONSE_FLOOR;

Structs§

EconomicsBreakdown
Token economics breakdown for one planned invocation.

Constants§

DEGRADE_DEFAULT_MAX_TOKENS
Default capped response budget applied on degrade when request omits max_tokens.
DEGRADE_MARGIN_LOW_TOKENS
Predicted net at or below this (but above zero) triggers degrade (margin_low).
SERVE_MARGIN_TOKENS
Minimum predicted net vs manual before serve (schema margin_high).

Functions§

active_tuning_in_force
Select the tuned constants that are IN FORCE for the current estimator (R3).
build_estimate
Build preview economics for preview: true (L1+L2 only).
decision_matches_golden
Golden-row helper: L2 decision should match fixture expected_decision for representative rows.
detect_pff_bypass
Policy P-FF: whole-file review queries bypass SymForge serve (A-012 / golden corpus).
economics_for_bypass
estimate_economics
Sum step estimates + compact surface overhead into a manual-vs-symforge comparison.
estimate_economics_tuned
Economics with an optional validated tuning in force (feature 013, T032, D8-ROOT).
evaluate_edit_plan
Evaluate L2 admission for a structural edit plan (no NL P-FF bypass path).
evaluate_plan
Evaluate L2 admission for a draft plan (does not execute L3).
evaluate_plan_tuned
Evaluate L2 admission with an optional validated tuning in force (feature 013, T032 / FR-006). When tuned is Some, the economics that drive the serve/degrade/bypass branches use the tuned constants, so the adaptive decision reflects better-grounded numbers; when None, the static floors apply and the decision is byte-identical to the pre-013 path. Routing correctness, policy/deny, and safety guards are untouched — only the token-estimate inputs change (FR-007). The caller must pass only an in-force tuning (see active_tuning_in_force).
evaluate_plan_with_session
Evaluate L2 admission with optional in-process session context for cache-hit detection.
index_ref_for_target
Build a grounded IndexRef for a resolved target. Used by the index-aware serve path to stamp real byte sizes onto plan steps before the L2 gate.