Expand description
agent-tui — ratatui terminal UI layer.
Depends on agent-core + agent-engine + render crates only. Never depends on bin.
Modules§
- auth
- OAuth 2.0 Authorization Code + PKCE flow for Anthropic (Claude Pro/Max).
- chain
- Chain pointer management — named bookmarks that auto-advance on compaction.
- config
- core
- Core infrastructure — config, session, auth, logging, error types, protocol.
- engine
- Engine — shared business logic for both TUI and headless modes.
- error
- events
- Event Bus — universal message ingestion for agent sessions.
- extensions
- Extension system for SynapsCLI.
- help
- logging
- mcp
- MCP (Model Context Protocol) integration — JSON-RPC client, tool bridging, lazy loading.
- memory
- Local-first memory store.
- models
- Curated list of Claude models known to work with this CLI. Centralized so the settings dropdown, defaults, and subagent hints agree.
- pricing
- Centralised pricing logic for Anthropic models.
- protocol
- runtime
- session
- sidecar
- Sidecar plugin support: long-running plugin processes that stream events into the host over a JSONL line protocol.
- skills
- Skills and plugins subsystem.
- toast
- Public toast notification primitives for extensions and host UIs.
- tools
- Tool system — trait, registry, and built-in tool implementations.
- tui
- Chat TUI binary — event loop, terminal setup, module wiring.
- watcher_
types
Structs§
- Cancellation
Token - A token which can be used to signal a cancellation request to one or more tasks.
- Runtime
- The core runtime — manages API communication, tool execution, authentication, and streaming for all SynapsCLI binaries (chat, chatui, server, agent, watcher).
- Session
- Session
Info - Lightweight info for listing sessions without loading full message history
- Synaps
Config - Parsed configuration from the config file.
- Tool
Context - Context passed to tool execution — composition of channels, capabilities, and limits.
- Tool
Registry - Registry of available tools. Maintains a name→tool map and a cached JSON schema
array that gets sent to the API. Thread-safe via
Arc<RwLock<ToolRegistry>>.
Enums§
- Agent
Event - LlmEvent
- Runtime
Error - Session
Event - Stream
Event - Top-level stream event — grouped into concern-specific sub-enums.
- Value
- Represents any valid JSON value.
Traits§
- Tool
- The core trait for all tools. Implement this to add a new tool.
Functions§
- epoch_
millis - Current time as Unix epoch milliseconds. Panics only if system clock is before 1970.
- find_
session - Find a session by full or partial ID match
- find_
session_ by_ name - Find a session by its assigned name (not partial ID). Iterates session headers one file at a time and returns on first match, avoiding a full directory scan when the named session appears early.
- latest_
session - Load the most recently updated session
- list_
recent_ sessions - The
limitmost-recently-modified sessions (by file mtime), most-recent first. Sorts the directory entries by mtime WITHOUT parsing, then reads only the toplimitheaders — so/sessionsis O(limit) reads instead of O(#sessions). mtime is an exact proxy forupdated_at(the file is rewritten on every save). - list_
sessions - List all sessions, sorted by most recently updated.
- load_
config - Parse the config file at ~/.synaps-cli/config (or profile variant). Returns default config if file doesn’t exist or can’t be read.
- resolve_
session - Resolve a query string to a Session. Resolution order:
- resolve_
system_ prompt - Resolve the system prompt from CLI flag, config file, or default. Priority: explicit value > ~/.synaps-cli/system.md > built-in default.
- truncate_
str - Truncate a string to at most
maxbytes at a valid UTF-8 boundary. - validate_
name - Validate a session or chain name: [a-z0-9-]{1,40}.