P0 deep-dive: core, providers, agent, memory, TUI, setup wizard
DEEP DIVE — Agent Loop (gyandoot-agent): - Real conversation loop with interactive (run()) and non-interactive (run_conversation()) modes - Retry logic with exponential backoff and error classification (RateLimit, Auth, Timeout, ServerError, ContextOverflow) - Context window management — token estimation, 75% threshold compression - 7 built-in tools: Read, Write, Edit, Bash, Grep, Find, Ls - BashTool with destructive-command security blocks - ContextCompressor — prune tool results, summarize middle messages DEEP DIVE — Memory (gyandoot-memory): - Real MemPalace with ~/.gyandoot/palace/wings/<wing>/ directory tree - Daily transcript files (YYYY-MM-DD_transcript.md) with append-only format - L0/L1 identity persistence (< 157 tokens for L0) - Session digest to drawer.md - File persistence support for transcripts and identity store DEEP DIVE — Core (gyandoot-core): - GyandootConfig with TOML deserialization for all sections - ConfigLoader with env > profile > file > default chain - Rich types: Message, ToolCall, ToolResult, SessionId - Comprehensive error types with thiserror derive DEEP DIVE — Providers (gyandoot-providers): - Provider trait with chat/chat_stream/models - OpenAI provider with streaming SSE and function calling - Anthropic provider with Messages API + tool use - Ollama provider with merge_system/no_tools auto-detect - SseParser, StreamEvent, TokenStream for SSE parsing - ProviderFactory for creation from config NEW — TUI crate (gyandoot-tui): - Banner: Kapil-approved robot head ASCII art with ANSI colors - Setup wizard: 7 providers, interactive config, connection test - Terminal helpers: spinner, confirm, text input, selection menu - Ratatui TUI: keyboard input, commands, status display All 12 crates + CLI binary compile with 0 errors.
This commit is contained in:
45
src/main.rs
45
src/main.rs
@@ -69,6 +69,12 @@ enum Commands {
|
||||
#[command(subcommand)]
|
||||
action: BrowserAction,
|
||||
},
|
||||
/// Run the interactive setup wizard for provider configuration
|
||||
#[command(name = "setup")]
|
||||
Setup,
|
||||
/// Launch the TUI interface
|
||||
#[command(name = "tui")]
|
||||
Tui,
|
||||
}
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
@@ -149,6 +155,12 @@ async fn main() -> anyhow::Result<()> {
|
||||
Some(Commands::Browser { action }) => {
|
||||
cmd_browser(action).await?;
|
||||
}
|
||||
Some(Commands::Setup) => {
|
||||
cmd_setup().await?;
|
||||
}
|
||||
Some(Commands::Tui) => {
|
||||
cmd_tui().await?;
|
||||
}
|
||||
None => {
|
||||
// Default: run interactive CLI mode
|
||||
cmd_run(&cli.profile, "cli", None).await?;
|
||||
@@ -295,7 +307,7 @@ async fn cmd_skills(action: SkillsAction) -> anyhow::Result<()> {
|
||||
|
||||
/// Handle memory management subcommands
|
||||
async fn cmd_memory(action: MemoryAction) -> anyhow::Result<()> {
|
||||
let palace = gyandoot_memory::palace::MemPalace::new();
|
||||
let palace = gyandoot_memory::palace::MemPalace::new("default");
|
||||
match action {
|
||||
MemoryAction::Status => {
|
||||
#[allow(unused_variables)]
|
||||
@@ -357,4 +369,35 @@ async fn cmd_browser(action: BrowserAction) -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Run the interactive setup wizard
|
||||
async fn cmd_setup() -> anyhow::Result<()> {
|
||||
tracing::info!("Starting setup wizard");
|
||||
match gyandoot_tui::setup::run_setup_wizard() {
|
||||
Ok(Some(result)) => {
|
||||
if result.connection_ok {
|
||||
println!("\n✅ Setup complete! Provider '{}' configured successfully.", result.provider);
|
||||
} else {
|
||||
println!("\n⚠️ Setup saved but connection test failed for '{}'.", result.provider);
|
||||
println!(" Check your API key and base URL, then try again.");
|
||||
}
|
||||
println!(" Config: {}", result.config_path.display());
|
||||
}
|
||||
Ok(None) => {
|
||||
println!("Setup cancelled.");
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::error!("Setup wizard failed: {}", e);
|
||||
eprintln!("Setup error: {}", e);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Launch the TUI interface
|
||||
async fn cmd_tui() -> anyhow::Result<()> {
|
||||
tracing::info!("Launching TUI");
|
||||
gyandoot_tui::tui::run_tui()?;
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user