feat(compression): adaptive auto transcript compactor

This commit is contained in:
2025-10-26 00:25:23 +02:00
parent 877ece07be
commit a0868a9b49
13 changed files with 850 additions and 24 deletions

View File

@@ -33,13 +33,22 @@ use tokio::sync::mpsc;
use crate::commands::cloud::{load_runtime_credentials, set_env_var};
pub async fn launch(initial_mode: Mode) -> Result<()> {
#[derive(Debug, Clone, Copy, Default)]
pub struct LaunchOptions {
pub disable_auto_compress: bool,
}
pub async fn launch(initial_mode: Mode, options: LaunchOptions) -> Result<()> {
set_env_var("OWLEN_AUTO_CONSENT", "1");
let color_support = detect_terminal_color_support();
let mut cfg = config::try_load_config().unwrap_or_default();
let _ = cfg.refresh_mcp_servers(None);
if options.disable_auto_compress {
cfg.chat.auto_compress = false;
}
if let Some(previous_theme) = apply_terminal_theme(&mut cfg, &color_support) {
let term_label = match &color_support {
TerminalColorSupport::Limited { term } => Cow::from(term.as_str()),
@@ -107,6 +116,10 @@ pub async fn launch(initial_mode: Mode) -> Result<()> {
app.set_system_status(notice);
}
if options.disable_auto_compress {
app.append_system_status("Auto compression off");
}
app.set_mode(initial_mode).await;
enable_raw_mode()?;

View File

@@ -12,5 +12,5 @@ use owlen_tui::config;
#[tokio::main(flavor = "multi_thread")]
async fn main() -> Result<()> {
bootstrap::launch(Mode::Code).await
bootstrap::launch(Mode::Code, bootstrap::LaunchOptions::default()).await
}

View File

@@ -34,6 +34,9 @@ struct Args {
/// Start in code mode (enables all tools)
#[arg(long, short = 'c')]
code: bool,
/// Disable automatic transcript compression for this session
#[arg(long)]
no_auto_compress: bool,
#[command(subcommand)]
command: Option<OwlenCommand>,
}
@@ -462,10 +465,20 @@ fn ensure_string_extra_with_change(
#[tokio::main(flavor = "multi_thread")]
async fn main() -> Result<()> {
// Parse command-line arguments
let Args { code, command } = Args::parse();
let Args {
code,
command,
no_auto_compress,
} = Args::parse();
if let Some(command) = command {
return run_command(command).await;
}
let initial_mode = if code { Mode::Code } else { Mode::Chat };
bootstrap::launch(initial_mode).await
bootstrap::launch(
initial_mode,
bootstrap::LaunchOptions {
disable_auto_compress: no_auto_compress,
},
)
.await
}