Skip to main content

TuiConfig

Struct TuiConfig 

Source
pub struct TuiConfig {
Show 26 fields pub chat_style: ChatStyle, pub prompt: Option<String>, pub no_splash: bool, pub edit_mode: EditMode, pub gutter: Option<u16>, pub footer: FooterMode, pub color: ColorMode, pub thinking: ThinkingMode, pub tool_output_lines: usize, pub max_tool_rounds: usize, pub workflow_grace_rounds: usize, pub permissions: ToolPermissions, pub debug: Option<bool>, pub trace: Option<bool>, pub build_check_cmd: Option<String>, pub num_ctx: Option<u32>, pub real_context_discovery: Option<bool>, pub connect_timeout_secs: u64, pub inference_timeout_secs: u64, pub keep_alive: String, pub markdown: MarkdownMode, pub mid_loop_trim_threshold: usize, pub mid_loop_trim_tokens: Option<usize>, pub sanitize_mcp_server_names: bool, pub mcp_allow_insecure_hosts: Vec<String>, pub allow_bang_escape: bool,
}
Expand description

TUI appearance preferences stored under [tui] in newt.toml.

Fields§

§chat_style: ChatStyle

Whether to show “newt” / “you” labels before the carets.

§prompt: Option<String>

PS1-style prompt template.

Tokens: \w workspace basename, \W full path, \h hostname, \v newt version. Default: "\\w $ " (compact) / "you $ " (verbose).

§no_splash: bool

Skip the full-screen ANSI art splash and show a compact header instead. Equivalent to the --no-splash CLI flag.

§edit_mode: EditMode

Key binding mode for the chat input line. "emacs" (default), "vi", or "nano". Also overridable via NEWT_EDIT_MODE. (nano is emacs-style/modeless — it differs from emacs only in label today; the rich-tui surface honors it.)

§gutter: Option<u16>

Rich-tui (issue #416) input gutter width, in columns. Unset = auto (the responsive default: a prompt gutter when it fits under ~1/3 of the width, else a stacked prompt row). 0 turns the gutter off (prompt on its own row, input flush-left); a positive value indents the input that many columns (a value wide enough to hold the prompt renders it inline). No effect on the lean surface.

§footer: FooterMode

Input-footer mode: the transient multi-line input block with a status header. "auto" (default) shows it on a TTY and degrades to a plain scroller otherwise; "on" always shows it; "off" never does (the --plain CLI flag, or NEWT_FOOTER=off).

§color: ColorMode

Color / theme mode (issue #527): "auto" (default), "always", "never", "minimal", "inverted", "dark", "light", "mono". The --color CLI flag and --mono override this; NO_COLOR / TERM=dumb force it off unless an explicit --color is given. This is the on/off + theme mode; [tui.colors] below is the palette.

§thinking: ThinkingMode

How a thinking model’s streamed reasoning is shown: "stream" (default — dim reasoning + a cargo-style spinner, TTY only) or "off".

§tool_output_lines: usize

Maximum lines of tool output shown inline before offering “show all?”. Default: 20. Set to 0 to always show everything.

§max_tool_rounds: usize

Maximum number of tool-call rounds the model may take within a single turn before the agent forces a final, tools-disabled completion. Each round is one model response that may emit tool calls; once this many rounds have run without a tool-free answer, newt asks the model once more with tools disabled so the user still gets a real (partial) answer instead of a placeholder. Default: 40 (raised from 25 — a modest safety margin alongside workflow_grace_rounds and the workflow-classifier delegate hint; genuinely open-ended diagnostic work should reach for crew/team delegation rather than depend on an unbounded cap here).

§workflow_grace_rounds: usize

Additional progress-aware rounds available after max_tool_rounds when an active workflow still has incomplete steps and the recent rounds show repair progress or actionable evidence. Default: 5. Set to 0 to make the normal round cap hard again.

§permissions: ToolPermissions

Tool-call permission policy for the interactive TUI: which tools the model may invoke and over which targets. This is a preset that selects an attenuation — the host (newt-identity) lowers it into a signed, attenuation-only capability that enforcement consults. Default: WorkspaceDev.

§debug: Option<bool>

Enable per-round agent-loop diagnostics printed to the TUI. Shows each round’s content excerpt, tool-call count, token usage, and flags empty model responses before they become silent failures. Also set via the NEWT_DEBUG=1 environment variable.

§trace: Option<bool>

Enable deep backend/inference diagnostics. Intended for issue reports and compatibility debugging; also set via NEWT_TRACE=1.

§build_check_cmd: Option<String>

Shell command to run after every successful file write or edit, to give the agent immediate ground-truth feedback on whether its change compiled / passed basic checks. Output is appended to the tool result so the model sees it without needing to ask.

Set this per-workspace in .newt/config.toml — not globally — because the right command depends on the project’s build system:

[tui]
build_check_cmd = "cargo check -q --workspace"  # Rust
# build_check_cmd = "npm run build --silent"    # Node
# build_check_cmd = "python -m py_compile"      # Python

None (default) disables auto-checking — no extra command is run.

§num_ctx: Option<u32>

Ollama context-window cap sent as options.num_ctx on every request. Limits the KV-cache allocation so a large model can’t exhaust VRAM mid-session. None → newt trusts the model’s declared context window from Ollama /api/show and sends ~80 % of it as num_ctx (see real_context_discovery). Set an explicit cap here (e.g. 8192 / 16384) on VRAM-constrained hosts; this always takes precedence over the declared window.

§real_context_discovery: Option<bool>

Opt into empirical context-window discovery (the conserve-for-tiny- hardware mode). When false/unset (the default), newt trusts the declared /api/show window: safe_context tracks ~80 % of it and is raised back to it each session, so a model is never permanently capped by a past overflow. When true, newt instead keeps the conservative behaviour — bootstrap safe_context once, never auto-raise it, and let runtime context-window 400s ratchet it down and persist (for hardware that genuinely can’t serve the full declared window). Overridable per-model via [[model_tuning]] real_context_discovery.

§connect_timeout_secs: u64

TCP connect timeout in seconds for inference requests (default: 5). A fast failure here means the endpoint is down (connection refused), distinguishing it from a slow-but-alive endpoint that needs the full inference_timeout_secs to respond. Keep this short.

§inference_timeout_secs: u64

Total inference request timeout in seconds (default: 120). This is the wall-clock budget for the model to generate a complete response — large models on a busy DGX may need the full window.

§keep_alive: String

How long Ollama keeps a model resident in VRAM after the last request, as an Ollama duration string (e.g. "5m", "0", "-1"). Default: "5m". Use "0" to unload immediately after each turn (maximum headroom for multi-model or multi-agent workloads at the cost of a reload on each turn). Use "-1" to keep forever.

§markdown: MarkdownMode

Markdown rendering of assistant output (Step 25.4, #568). auto (default) renders whenever color is active; on/off force it. The /markdown [on|off] command overrides this for the session.

§mid_loop_trim_threshold: usize

Maximum number of messages in the in-progress tool-call message list before the agent trims the middle to prevent context overflow. Default: 40 (≈ 20 tool-call rounds). Set lower on memory-constrained endpoints or when num_ctx is small.

§mid_loop_trim_tokens: Option<usize>

Estimated-token threshold that triggers a mid-loop context trim, independent of mid_loop_trim_threshold (which counts messages). A single tool round can return a multi-KB file listing or JSON payload that adds hundreds of thousands of tokens in one message — far below the message-count threshold but well past the model’s context window. When set, trimming fires as soon as the estimated token count (chars / 4) exceeds this value. None disables token-based trimming. Default: None (message-count trimming only). See issue #223.

§sanitize_mcp_server_names: bool

Normalise hyphens to underscores in MCP server names when advertising tool definitions and routing tool calls. Some API proxies (e.g. those that wrap the Anthropic backend) replace hyphens with underscores in tool names; advertising the sanitised form ensures the model’s tool calls round-trip back unchanged and routes correctly. Default: true. Set to false only when every connected MCP server is behind a proxy that preserves hyphens verbatim.

§mcp_allow_insecure_hosts: Vec<String>

Hosts (IP or hostname) for which newt may send an MCP OAuth Bearer token over an UNENCRYPTED (non-https) connection. Empty by default: a stored Bearer is sent only over https or to loopback (localhost/127.0.0.1/ ::1). newt WARNs on every non-loopback unencrypted MCP connection regardless; an allow-listed host still warns but the token is sent. This is the explicit opt-out of the secure-by-default transport policy — see docs/decisions/mcp_transport_security.md.

§allow_bang_escape: bool

Whether the interactive ! bang-escape is available — typing ! <cmd> at the prompt runs a host command with the user’s own authority (not the agent’s OCAP leash). Default: true. Set false for locked-down or shared deployments where the human at the keyboard should not have an unconfined host shell-out. The model can never invoke ! either way; this only governs the human. See docs/decisions/plain_scroller_tui.md.

Trait Implementations§

Source§

impl Clone for TuiConfig

Source§

fn clone(&self) -> TuiConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TuiConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TuiConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TuiConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for TuiConfig

Source§

impl PartialEq for TuiConfig

Source§

fn eq(&self, other: &TuiConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TuiConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TuiConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more