aKode 0.5.0: riepilogo della memoria a inizio sessione, sollecito alle azioni annunciate, daemon allineato al CLI

- ext/memoria: legge una volta per sessione la risorsa memoria://briefing
  (file di git status, budget di token, timeout breve), accetta solo un
  blocco <memoria_briefing> chiuso e limitato, lo inserisce dopo le istruzioni
  del plugin e lo tiene in cache per il thread (prefisso del prompt stabile).
  Impostazioni [memoria] briefing, briefing_timeout_ms, briefing_max_tokens.
- Turno: se il modello chiude con un messaggio che annuncia un'azione senza
  chiamare strumenti, un solo sollecito per turno ([agent] announce_nudges,
  predefinito 1, 0 lo disattiva), con avviso visibile e test sui messaggi
  osservati con Qwen.
- Daemon: sync_with_cli confronta l'eseguibile del CLI con il pacchetto del
  daemon e, se diverso, lo seleziona e riavvia solo quando non ci sono
  sessioni caricate; altrimenti avviso. Usato all'avvio della TUI, da
  `akode update`, da install.sh e da `akode app-server daemon update
  --from-cli --if-idle`. Prima un daemon preparato una volta restava alla
  versione vecchia (CLI 0.4.0 con app server 0.3.1).
- Test: snapshot del doctor indipendenti dalla versione; snapshot della TUI
  aggiornati alla 0.5.0 e allo schema dei tool appiattiti della 0.4.0.
- Versione 0.5.0 e sezione Novità nel README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-14 21:49:51 +01:00
parent 546bd1da18
commit 95f4ddcd72
52 changed files with 1267 additions and 224 deletions

View File

@@ -695,6 +695,27 @@ pub enum ThreadStoreConfig {
/// Default for `[agent] max_repeated_failures`.
pub const DEFAULT_MAX_REPEATED_FAILURES: u32 = 3;
/// Default for `[agent] announce_nudges`.
pub const DEFAULT_ANNOUNCE_NUDGES: u32 = 1;
/// Session-start briefing of the `memoria` plugin (`[memoria]`).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct MemoriaBriefingConfig {
pub enabled: bool,
pub timeout_ms: u64,
pub max_tokens: u32,
}
impl Default for MemoriaBriefingConfig {
fn default() -> Self {
Self {
enabled: true,
timeout_ms: 3000,
max_tokens: 1500,
}
}
}
/// Application configuration loaded from disk and merged with overrides.
#[derive(Debug, Clone, PartialEq)]
pub struct Config {
@@ -1225,6 +1246,13 @@ pub struct Config {
/// (`[agent] max_repeated_failures`). `0` disables the check.
pub max_repeated_failures: u32,
/// One-shot reminder when a turn ends with an announced but not executed action
/// (`[agent] announce_nudges`). `0` disables it.
pub announce_nudges: u32,
/// Session-start briefing of the `memoria` plugin (`[memoria]`).
pub memoria_briefing: MemoriaBriefingConfig,
/// Idle timeout for unsubscribed app-server threads.
pub thread_unload_delay: Duration,
@@ -4225,6 +4253,26 @@ impl Config {
.as_ref()
.and_then(|agent| agent.max_repeated_failures)
.unwrap_or(DEFAULT_MAX_REPEATED_FAILURES);
let announce_nudges = cfg
.agent
.as_ref()
.and_then(|agent| agent.announce_nudges)
.unwrap_or(DEFAULT_ANNOUNCE_NUDGES);
let memoria_briefing = {
let defaults = MemoriaBriefingConfig::default();
let toml = cfg.memoria.clone().unwrap_or_default();
MemoriaBriefingConfig {
enabled: toml.briefing.unwrap_or(defaults.enabled),
timeout_ms: toml
.briefing_timeout_ms
.unwrap_or(defaults.timeout_ms)
.clamp(100, 30_000),
max_tokens: toml
.briefing_max_tokens
.unwrap_or(defaults.max_tokens)
.clamp(300, 3000),
}
};
let background_terminal_max_timeout = cfg
.background_terminal_max_timeout
.unwrap_or(DEFAULT_MAX_BACKGROUND_TERMINAL_TIMEOUT_MS)
@@ -4827,6 +4875,8 @@ impl Config {
code_mode,
background_terminal_max_timeout,
max_repeated_failures,
announce_nudges,
memoria_briefing,
thread_unload_delay,
ghost_snapshot,
multi_agent_v2,