pub struct Wizard {Show 23 fields
pub step: Step,
pub cursor: usize,
pub providers: Vec<ProviderRow>,
pub detail: usize,
pub defaults: Vec<Field>,
pub limits: Vec<Field>,
pub agents: Vec<AgentRow>,
pub mcp: Vec<McpRow>,
pub mcp_scan_errors: Vec<String>,
pub edit: Option<Edit>,
pub reveal: bool,
pub show_help: bool,
pub show_tos_confirm: bool,
pub claude_code_tos_accepted: bool,
pub should_quit: bool,
pub finished: bool,
pub message: Option<String>,
pub base: Config,
pub env_only: HashMap<&'static str, String>,
pub opener: BrowserOpener,
pub verify_tx: UnboundedSender<VerifyRequest>,
pub reply_rx: UnboundedReceiver<VerifyReply>,
pub ticks: u64,
/* private fields */
}Expand description
The whole wizard.
Fields§
§step: Step§cursor: usizeSelected row within the current step.
providers: Vec<ProviderRow>§detail: usizeWhich selected provider the credential screen is showing.
defaults: Vec<Field>§limits: Vec<Field>§agents: Vec<AgentRow>§mcp: Vec<McpRow>§mcp_scan_errors: Vec<String>§edit: Option<Edit>§reveal: boolShow credentials in clear text.
show_help: bool§show_tos_confirm: boolThe Claude Code terms-of-service confirmation is on screen, and is the only thing keys mean until it is answered.
claude_code_tos_accepted: boolThe user has acknowledged the Claude Code transport’s terms risk. A hard gate on saving: the transport cannot be written to the config without it, and deselecting the transport withdraws it.
should_quit: bool§finished: boolSet once the plan has been applied, so the loop knows to stop.
message: Option<String>A one-line status message.
base: ConfigThe config as loaded from the file, which is what the plan is diffed against and built on.
env_only: HashMap<&'static str, String>Credentials present only in the environment. Shown, never written.
opener: BrowserOpenerOpens a provider’s signup page. Injected rather than called directly:
lev dash once had a unit test launch a real browser, and this is the
same shape of hazard.
verify_tx: UnboundedSender<VerifyRequest>§reply_rx: UnboundedReceiver<VerifyReply>§ticks: u64Tick counter, for the spinner.
Implementations§
Source§impl Wizard
impl Wizard
Sourcepub fn new(
base: Config,
env_lookup: &dyn Fn(&str) -> Option<String>,
candidates: Vec<(String, Candidate)>,
scan_errors: Vec<String>,
agents_dir: &Path,
opener: BrowserOpener,
) -> Self
pub fn new( base: Config, env_lookup: &dyn Fn(&str) -> Option<String>, candidates: Vec<(String, Candidate)>, scan_errors: Vec<String>, agents_dir: &Path, opener: BrowserOpener, ) -> Self
Build the wizard from the config file and the surrounding environment.
base must come from reading the file, not from Config::load():
load folds $ANTHROPIC_API_KEY and friends into the struct, and the
old wizard then re-serialized the whole thing - silently writing a key
the user had deliberately kept in their environment into
~/.leviath/config.toml. Environment-supplied credentials are tracked
separately in env_only and shown as such.
Sourcepub fn take_verify_ends(
&mut self,
) -> Option<(UnboundedReceiver<VerifyRequest>, UnboundedSender<VerifyReply>)>
pub fn take_verify_ends( &mut self, ) -> Option<(UnboundedReceiver<VerifyRequest>, UnboundedSender<VerifyReply>)>
Hand the background verifier loop its channel ends. Returns None if
already taken.
Sourcepub fn selected_providers(&self) -> Vec<usize>
pub fn selected_providers(&self) -> Vec<usize>
Providers the user picked, in table order.
Sourcepub fn detail_row(&self) -> Option<usize>
pub fn detail_row(&self) -> Option<usize>
The provider row the credential screen is currently showing.
Sourcepub fn claude_code_selected(&self) -> bool
pub fn claude_code_selected(&self) -> bool
Whether the Claude Code transport is one of the picked providers.
Sourcepub fn needs_tos_confirmation(&self) -> bool
pub fn needs_tos_confirmation(&self) -> bool
Whether saving must first ask the user to acknowledge Anthropic’s terms. Enabling the transport routes inference through a subscription session, so the risk is confirmed once, explicitly, rather than being buried in a paragraph nobody reads.
Sourcepub fn move_cursor(&mut self, delta: isize)
pub fn move_cursor(&mut self, delta: isize)
Move the selection, clamped to the step’s rows.
Sourcepub fn next_detail(&mut self) -> bool
pub fn next_detail(&mut self) -> bool
Within the credential screen, move to the next selected provider; returns false when there is no next one.
Sourcepub fn prev_detail(&mut self) -> bool
pub fn prev_detail(&mut self) -> bool
The reverse of Self::next_detail.
Sourcepub fn request_verification(&mut self, index: usize)
pub fn request_verification(&mut self, index: usize)
Ask the background verifier about the provider at index.
A provider with nothing to check is left alone rather than queued: a blank API key would fail with a message about the key rather than saying the obvious, that none was given.
Sourcepub fn verify_all(&mut self)
pub fn verify_all(&mut self)
Ask about every selected provider at once.
Sourcepub fn drain_verifications(&mut self)
pub fn drain_verifications(&mut self)
Take whatever the background verifier has answered.
Sourcepub fn discovered_models(&self) -> Vec<String>
pub fn discovered_models(&self) -> Vec<String>
Every model id any provider reported, deduplicated, for the picker.
Sourcepub fn rebuild_defaults(&mut self)
pub fn rebuild_defaults(&mut self)
Rebuild the Defaults screen. Called on entry, since both the provider list and the discovered models can change between visits.
Sourcepub fn apply_provider_concurrency_default(&mut self)
pub fn apply_provider_concurrency_default(&mut self)
Set the concurrency default that suits the chosen provider.
A local Ollama serves one model at a time, so eight concurrent inferences against it queue and thrash rather than going faster. Only applied while the field still holds the general default, so a number the user typed is never overwritten.
Sourcepub fn commit_edit(&mut self)
pub fn commit_edit(&mut self)
Commit an edited text buffer into wherever it belongs.
Sourcepub fn build_config(&self) -> Config
pub fn build_config(&self) -> Config
Fold every choice into the config that will be written.
Sourcepub fn build_plan(&self) -> SetupPlan
pub fn build_plan(&self) -> SetupPlan
The plan this wizard describes.
Sourcepub fn review_lines(&self) -> Vec<String>
pub fn review_lines(&self) -> Vec<String>
Lines for the review screen.
Sourcepub fn selected_inline_secrets(&self) -> Vec<String>
pub fn selected_inline_secrets(&self) -> Vec<String>
MCP rows carrying a credential copied verbatim out of another tool’s
config, which importing would duplicate into ~/.leviath/config.toml.
Auto Trait Implementations§
impl !RefUnwindSafe for Wizard
impl !UnwindSafe for Wizard
impl Freeze for Wizard
impl Send for Wizard
impl Sync for Wizard
impl Unpin for Wizard
impl UnsafeUnpin for Wizard
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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