Files
imeai-aKode/akode-rs/tui/src/app_server_connection.rs
andrea.difonzo 7c1c6dfa8d Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
  nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 12:37:52 +01:00

54 lines
2.3 KiB
Rust

//! Applies the selected server's socket policy on initial connections and reconnects.
use crate::AppServerTarget;
#[cfg(windows)]
use crate::DEFAULT_IN_PROCESS_CHANNEL_CAPACITY;
use crate::connect_remote_app_server;
use akode_app_server_client::AppServerClient;
#[cfg(windows)]
use akode_app_server_client::RemoteAppServerClient;
#[cfg(windows)]
use akode_app_server_client::RemoteAppServerConnectArgs;
#[cfg(windows)]
use akode_app_server_client::RemoteAppServerEndpoint;
#[cfg(windows)]
use akode_utils_absolute_path::AbsolutePathBuf;
pub(crate) async fn connect(target: &AppServerTarget) -> color_eyre::Result<AppServerClient> {
match target {
AppServerTarget::Cloud => {
color_eyre::eyre::bail!("Reopen aKode to reconnect the cloud backend.");
}
AppServerTarget::Embedded => {
color_eyre::eyre::bail!("embedded sessions have no remote connection")
}
#[cfg(windows)]
AppServerTarget::LocalDaemon {
endpoint: RemoteAppServerEndpoint::UnixSocket { socket_path },
..
} => {
// Revalidate at the real connection, not just the earlier discovery probe.
let (socket_path, _directory) =
akode_uds::validate_private_socket_path(socket_path.as_path())?;
let app_server =
RemoteAppServerClient::connect_local_daemon(RemoteAppServerConnectArgs {
required_human_approval: true,
endpoint: RemoteAppServerEndpoint::UnixSocket {
socket_path: AbsolutePathBuf::from_absolute_path_checked(socket_path)?,
},
client_name: "akode-tui".to_string(),
client_version: env!("CARGO_PKG_VERSION").to_string(),
experimental_api: true,
mcp_server_openai_form_elicitation: false,
opt_out_notification_methods: Vec::new(),
channel_capacity: DEFAULT_IN_PROCESS_CHANNEL_CAPACITY,
})
.await?;
Ok(AppServerClient::Remote(app_server))
}
AppServerTarget::LocalDaemon { endpoint, .. } | AppServerTarget::Remote { endpoint } => {
connect_remote_app_server(endpoint.clone()).await
}
}
}