theway-daemon 0.1.25

theway daemon — the single agent-runtime kernel (bin `thewayd`): harness assembly, local/sandbox tool policy, triggers/cron/session/DAG runtime, skills, MCP/LSP wiring, serving the gRPC/HTTP/MCP transports from theway-transport. Terminal UI lives in the theway-tui crate.
Documentation
//! `thewayd` — headless agent runtime over gRPC, HTTP, or MCP.

use anyhow::Result;
use clap::Parser;
use theway_daemon::{DaemonOptions, DaemonTransport, SessionSelection, run};

include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/src/bin/thewayd/cli.rs"
));

#[tokio::main]
async fn main() -> Result<()> {
    let cli = Cli::parse();
    let transport = if cli.mcp {
        DaemonTransport::Mcp
    } else if cli.http {
        DaemonTransport::Http
    } else {
        DaemonTransport::Grpc
    };
    let paths = theway_daemon::DaemonPaths::from_cli_with_base(
        cli.cwd,
        cli.home,
        cli.skills_dir,
        cli.theway_dir,
    );
    let thinking = cli.thinking.parse().map_err(anyhow::Error::msg)?;
    let session = match (cli.resume_id, cli.continue_) {
        (Some(id), _) => SessionSelection::Id(id),
        (None, true) => SessionSelection::Latest,
        (None, false) => SessionSelection::New,
    };

    run(DaemonOptions {
        paths,
        transport,
        host: cli.host,
        port: cli.port,
        provider: cli.provider,
        model: cli.model,
        base_url: cli.base_url,
        thinking,
        session,
        approve_control_plane: cli.always_allow || cli.yes,
        debug: cli.debug,
        trigger_poll_secs: cli.trigger_poll_secs,
        builtin_skills: cli.builtin_skill,
        storage_service_addr: cli.storage_service_addr,
        executor_kind: cli.executor_kind,
        no_tgrep: cli.no_tgrep,
        api_key: cli.api_key,
        auto_fetch_models: cli.auto_fetch_models,
    })
    .await
}