Ripristinato akode update verso il Gitea dell'utente (come in 0.9.2, senza il sync del daemon)

Da 9494b768, e1ce139a e 1c278642: crate akode-update (ultima release da
git.difonzo.net/andrea/imeai-aKode, confronto semver, download solo dallo stesso host, verifica
SHA-256, sostituzione atomica), `akode update [--check]`, riga di avviso nella TUI, controllo in
background all'avvio al massimo ogni 24 h (disattivabile con [update] check_on_startup = false;
non installa mai nulla da solo). Nessun contatto con OpenAI o altri domini; il sistema upstream
(curl chatgpt.com/codex/install.sh, npm, brew) resta rimosso. Lasciato fuori l'allineamento del
daemon (95f4ddcd).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-17 14:35:07 +01:00
parent 925917c58c
commit 07ba31d492
22 changed files with 1538 additions and 75 deletions

View File

@@ -34,6 +34,7 @@ akode-app-server-daemon = { workspace = true }
akode-app-server-protocol = { workspace = true }
akode-arg0 = { workspace = true }
akode-install-context = { workspace = true }
akode-update = { workspace = true }
akode-config = { workspace = true }
akode-context-fragments = { workspace = true }
akode-core-plugins = { workspace = true }

View File

@@ -46,6 +46,7 @@ use crate::external_editor;
use crate::file_search::FileSearchManager;
use crate::history_cell;
use crate::history_cell::HistoryCell;
use crate::history_cell::UpdateAvailableHistoryCell;
use crate::hooks_rpc::HookTrustUpdate;
use crate::key_hint::KeyBinding;
use crate::key_hint::KeyBindingListExt;

View File

@@ -124,6 +124,12 @@ async fn non_startup_history_dismisses_logo_until_a_new_thread() -> Result<()> {
},
)),
);
app.insert_history_cell(
&mut tui,
Box::new(history_cell::UpdateAvailableHistoryCell::new(
"99.0.0".into(),
)),
);
app.insert_history_cell(
&mut tui,
Box::new(history_cell::SessionNoticeCell(

View File

@@ -18,6 +18,39 @@ use crate::session_start::complete_session_start;
use crate::unarchive_prompt::run_unarchive_prompt;
use color_eyre::eyre::ContextCompat;
/// Checks the configured release repository in the background (at most once per day) and
/// announces a newer aKode release with a one-line notice. Never blocks startup and never
/// installs anything.
fn spawn_startup_update_check(app_event_tx: &AppEventSender, config: &Config) {
if !config.update_check_on_startup {
return;
}
let app_event_tx = app_event_tx.clone();
let akode_home = config.codex_home.to_path_buf();
let repo_url = config.update_repo_url.clone();
tokio::spawn(async move {
let Ok(client) = akode_update::http_client(akode_update::STARTUP_CHECK_TIMEOUT) else {
return;
};
let check = akode_update::StartupCheck {
akode_home: &akode_home,
repo_url: &repo_url,
enabled: true,
current_version: env!("CARGO_PKG_VERSION"),
};
let latest = tokio::time::timeout(
akode_update::STARTUP_CHECK_TIMEOUT,
check.run(&client, chrono::Utc::now()),
)
.await;
if let Ok(Some(latest)) = latest {
app_event_tx.send(AppEvent::InsertHistoryCell(Box::new(
UpdateAvailableHistoryCell::new(latest.to_string()),
)));
}
});
}
fn spawn_startup_thread_start(
app_server: &AppServerSession,
local_settings: crate::local_settings::LocalSettings,
@@ -964,6 +997,7 @@ See the aKode keymap documentation for supported actions and examples."
)
});
let runtime_keymap = startup_try!(runtime_keymap);
let agents_overview =
agents_overview::AgentsOverviewState::new(local_settings.tui.agents_overview_grouping);
let mut app = Self {
@@ -1240,6 +1274,7 @@ See the aKode keymap documentation for supported actions and examples."
let mut waiting_for_initial_session_configured = wait_for_initial_session_configured;
let mut waiting_for_initial_session_header = true;
spawn_startup_update_check(&app.app_event_tx, &app.config);
let pre_loop_exit_reason: Option<ExitReason> = None;
let mut backends =

View File

@@ -9,6 +9,49 @@ use crate::wrapping::adaptive_wrap_line_to_width;
#[cfg_attr(not(test), allow(dead_code))]
const RECAP_HEADING: &str = "Conversation recap";
/// One-line startup notice for a newer aKode release (`akode update` installs it).
#[derive(Debug)]
pub(crate) struct UpdateAvailableHistoryCell {
latest_version: String,
}
impl UpdateAvailableHistoryCell {
pub(crate) fn new(latest_version: String) -> Self {
Self { latest_version }
}
}
impl HistoryCell for UpdateAvailableHistoryCell {
fn display_lines(&self, width: u16) -> Vec<Line<'static>> {
let line = Line::from(vec![
"È disponibile aKode ".fg(accent_color()),
self.latest_version.clone().bold().fg(accent_color()),
" — esegui ".into(),
"\"akode update\"".bold(),
]);
vec![
crate::line_truncation::truncate_line_with_ellipsis_if_overflow(
line,
usize::from(width),
),
]
}
fn raw_lines(&self) -> Vec<Line<'static>> {
vec![Line::from(format!(
"È disponibile aKode {} — esegui \"akode update\"",
self.latest_version
))]
}
fn display_hyperlink_lines(&self, width: u16) -> Vec<HyperlinkLine> {
crate::terminal_hyperlinks::annotate_web_urls(self.display_lines(width))
}
fn transcript_hyperlink_lines(&self, width: u16) -> Vec<HyperlinkLine> {
self.display_hyperlink_lines(width)
}
}
pub(crate) fn new_warning_event(message: String) -> WarningHistoryCell {
let style = crate::style::status_style(crate::style::StatusTone::Attention);
WarningHistoryCell {

View File

@@ -1326,6 +1326,20 @@ fn web_search_history_cell_snapshot() {
insta::assert_snapshot!(rendered);
}
#[test]
fn update_available_history_cell_is_one_italian_line() {
let cell = UpdateAvailableHistoryCell::new("9.9.9".to_string());
assert_eq!(
render_lines(&cell.display_lines(/*width*/ 110)),
vec!["È disponibile aKode 9.9.9 — esegui \"akode update\"".to_string()]
);
assert_eq!(
render_lines(&cell.raw_lines()),
vec!["È disponibile aKode 9.9.9 — esegui \"akode update\"".to_string()]
);
}
#[test]
fn web_search_history_cell_without_detail_snapshot() {
let cell = new_web_search_call("call-1".to_string(), String::new(), WebSearchAction::Other);