oats.cli

Command-line interface, interactive REPL, and TUI components.

oats.cli.interactive

Interactive REPL for oats-enabled coder — local-first-tool-calling AI coding agent architecture.

Launch in any directory to get a multi-turn coding assistant powered by your local ai stack (we use vLLM atm).

Usage:

ot # interactive mode ot -r last # resume last session ot -m hosted_vllm/Qwen3-32B-AWQ

async oats.cli.interactive.run_interactive(console, provider_id=None, model_id=None, session_id=None, project_dir=None, auto_approve=False, resume=None)[source]

Main interactive REPL loop.

oats.cli.interactive.main()[source]

Entry point for the interactive CLI.

oats.cli.approval

Interactive approval system for coder2.

Provides Yes / Yes-to-all / No / No+instructions approval prompts for tool operations that need user confirmation.

Modes:

AUTO — approve everything (default with -y flag) SUPERVISED — ask before write/bash/delete operations PLAN — review-only, no execution

class oats.cli.approval.ApprovalMode(*values)[source]

Bases: str, Enum

Operating modes for the approval system.

AUTO = 'auto'
SUPERVISED = 'supervised'
PLAN = 'plan'
class oats.cli.approval.ApprovalAction(*values)[source]

Bases: str, Enum

Result of an approval prompt.

YES = 'yes'
YES_ALL = 'yes_all'
NO = 'no'
NO_WITH_INSTRUCTIONS = 'no_with_instructions'
class oats.cli.approval.ApprovalResult(action, instructions=None)[source]

Bases: object

Result from an approval prompt.

action: ApprovalAction
instructions: str | None = None
__init__(action, instructions=None)
class oats.cli.approval.ApprovalManager(mode=ApprovalMode.AUTO)[source]

Bases: object

Manages the approval flow for tool operations.

__init__(mode=ApprovalMode.AUTO)[source]

Initialize the approval manager with the given mode.

Parameters:

mode – The operating mode (AUTO, SUPERVISED, or PLAN).

property mode: ApprovalMode

Return the current approval mode.

needs_approval(tool_name)[source]

Check if a tool operation needs user approval.

Return type:

bool

prompt_approval(tool_name, description)[source]

Prompt the user for approval of a tool operation.

Uses plain input() to avoid conflicting with the main REPL’s prompt_toolkit application (which is already running in the asyncio event loop when this is called via run_in_executor).

y/Enter = yes, a = yes to all, n = no, i = no + instructions

Return type:

ApprovalResult

auto_approve_tool(tool_name)[source]

Mark a specific tool type as auto-approved for this session.

reset()[source]

Reset the auto-approved tools set to empty.

oats.cli.approval.get_approval_manager()[source]

Return the process-wide approval manager, creating one in AUTO on first call.

Return type:

ApprovalManager

oats.cli.approval.set_approval_mode(mode)[source]

Set the approval mode on the shared manager.

Return type:

None

oats.cli.check_providers

CLI utility to list and check the configuration status of all available providers.

Prints each provider’s name, ID, and whether it is currently configured (has valid credentials and endpoint settings).

oats.cli.check_providers.check_providers()[source]

List available providers.

Return type:

None

oats.cli.process_message

Stream a user message through the session processor and render the response in the TUI.

Handles all event types emitted by the processor (text deltas, tool calls, tool results, usage stats, compaction, errors, warnings) and displays them with appropriate icons, formatting, and a live status indicator.

async oats.cli.process_message.process_message(console, processor, message, session, auto_approve=True, images=None, max_tokens=8192)[source]

Process a single message through the session processor, streaming output.

Return type:

str

oats.cli.validate_coder_env

Validate the CODER_CONFIG_FILE environment and provider/model configuration.

Checks that the CODER_CONFIG_FILE env var is set, points to a valid JSON file, and contains the expected provider and model definitions. Raises Exception with a detailed error message on any validation failure.

oats.cli.validate_coder_env.validate_coder_env(provider_id, model_id=None, verbose=False)[source]

Validate the coder environment configuration for a given provider and model.

Checks in order: 1. CODER_CONFIG_FILE env var is set and non-empty. 2. The file exists and contains valid JSON. 3. The JSON has a provider root key with the requested provider_id. 4. The provider definition has a base_url and a models list. 5. If model_id is given, it exists in the provider’s models list.

Return type:

bool

Parameters:
  • provider_id – The provider ID to look up in the config.

  • model_id – Optional model ID to validate against the provider’s models.

  • verbose – If True, log a success message.

Returns:

True if validation passes.

Raises:

Exception – With a detailed error message if any check fails.

oats.cli.validate_coder_env.main()[source]

Standalone entry point: validate default providers and print status.

oats.cli.tui.tui_banner

Terminal UI banner and session information display utilities.

Handles printing the startup banner (with git repo detection, model and provider info), session details, token cost summaries, and file access logs for the current session.

oats.cli.tui.tui_consts

Terminal UI constants, environment defaults, and display helpers.

Defines symbols used throughout the TUI (tool icons, status glyphs), default environment variables for the coder profile, and utility functions for formatting token counts, shortening model IDs, and detecting the best image rendering protocol for the current terminal.

oats.cli.tui.tui_utils

Terminal UI utility functions for the interactive coder REPL.

Provides helpers for rendering tools, configuration, git diffs/logs, session history, web page browsing, think-block filtering, and a live animated status tracker. Also includes the slash-command help table and various formatting utilities.

class oats.cli.tui.tui_utils.ThinkFilter[source]

Bases: object

Filters <think>…</think> blocks from streaming deltas.

Shows a minimal indicator while the model reasons, then emits only the actionable content after </think>.

__init__()[source]

Initialize the think filter with an empty buffer.

feed(delta)[source]

Feed a text delta and return the filtered output.

Accumulates the delta in the internal buffer and drains any complete think blocks, returning only non-think content.

Return type:

str

flush()[source]

Flush remaining buffer content, stripping any incomplete think blocks.

Return type:

str