pub struct ModelPolicyBuilderState {
pub scope: ModelScope,
pub harness_index: usize,
pub model: String,
pub model_choices: Vec<ModelChoice>,
pub model_choice_index: Option<usize>,
pub reasoning_index: usize,
pub reasoning_cycle: Vec<String>,
pub dry_run: bool,
pub refresh_integrity: bool,
pub focused_field: usize,
}Expand description
State for the model policy builder UI.
Fields§
§scope: ModelScope§harness_index: usizeIndex into CAPABLE_HARNESSES.
model: StringModel name or “auto”; empty leaves the model field of the rule untouched. Free text is still accepted — open registry namespaces (Ollama tags, OpenRouter slugs) are too large to enumerate, so the picker offers the verified and example values and typing covers everything else.
model_choices: Vec<ModelChoice>Registry-verified models selectable for the current harness, refreshed
by Self::refresh_choices. Empty when no registry is loaded.
model_choice_index: Option<usize>Position within model_choices; None means the model field holds a
free-typed value (or is empty) rather than a picked entry.
reasoning_index: usizeIndex into reasoning_cycle.
reasoning_cycle: Vec<String>Live reasoning cycle for the current (harness, model) pair. Index 0 is
always [MODEL_POLICY_REASONING_UNCHANGED]; when the pair supports an
effort at all, “auto” and the verified values follow. A single-entry
cycle therefore means “this pair has no projectable reasoning field”.
dry_run: bool§refresh_integrity: boolChain npm run asset-integrity:write after a successful apply.
focused_field: usizeImplementations§
Source§impl ModelPolicyBuilderState
impl ModelPolicyBuilderState
pub fn new() -> Self
Sourcepub fn refresh_choices(&mut self, registry: Option<&ModelRegistry>)
pub fn refresh_choices(&mut self, registry: Option<&ModelRegistry>)
Recompute both pickers from the registry for the current harness and model. Called whenever the harness or the model text changes.
The narrowing is the registry’s, not ours: a model that declares its own
reasoning_efforts gets exactly those, otherwise its namespace’s,
otherwise the harness vocabulary. A free-typed model the registry does
not enumerate keeps the full harness vocabulary and is left for
scripts/model-policy.mjs to accept or reject — the TUI never decides
legality itself.
registry: None (missing or unparsable catalog file) restores the
pre-registry behaviour: free-text model entry and the static union,
codex only.
Sourcepub fn reasoning_supported(&self) -> bool
pub fn reasoning_supported(&self) -> bool
Whether the reasoning field can be cycled at all — true when the
harness has a reasoning field, even if the selected model accepts no
concrete effort (auto is still reachable to clear it).
Sourcepub fn reasoning_clear_only(&self) -> bool
pub fn reasoning_clear_only(&self) -> bool
True when the harness has a reasoning field but the selected model accepts no concrete effort — the cycle holds only “(unchanged)” and “auto”.
Sourcepub fn reasoning_display(&self) -> &str
pub fn reasoning_display(&self) -> &str
The reasoning value currently shown for the focused field.
Sourcepub fn cycle_model(&mut self)
pub fn cycle_model(&mut self)
Step to the next verified model for this harness, wrapping through a free-text slot so the picker never traps the operator inside the list.
Sourcepub fn selected_choice(&self) -> Option<&ModelChoice>
pub fn selected_choice(&self) -> Option<&ModelChoice>
The picked registry entry, when the model field holds one.
Sourcepub fn command(&self) -> ModelPolicyCommand
pub fn command(&self) -> ModelPolicyCommand
Build the subprocess command from the current form state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModelPolicyBuilderState
impl RefUnwindSafe for ModelPolicyBuilderState
impl Send for ModelPolicyBuilderState
impl Sync for ModelPolicyBuilderState
impl Unpin for ModelPolicyBuilderState
impl UnsafeUnpin for ModelPolicyBuilderState
impl UnwindSafe for ModelPolicyBuilderState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more