aKode fase 3: provider locali, chiavi per provider, modelli dal server, SearXNG

- Provider: rimossi openai, Bedrock e GCP integrati e ogni fallback a OpenAI;
  restano ollama, lmstudio e i provider personalizzati. Senza provider, exec e
  TUI mostrano come configurarlo.
- Chiave per provider: api_key = "keyring", provider_api_key_store =
  auto|keyring|file (fallback su file 0600 / ACL Windows); `codex login
  --provider <id> --with-api-key`, `logout --provider`; login status e doctor
  mostrano dove sta la chiave senza rivelarla.
- Modelli letti da GET {base_url}/models; contesto da config, poi dal server
  (/props, meta.n_ctx), poi 32768; apply_patch come tool function; niente tool
  ospitati; niente piu' avviso "metadata not found".
- Unione dei soli messaggi system/developer iniziali in un unico system;
  quelli successivi restano al loro posto come user (cache del server
  preservata: turno N prefisso esatto del turno N+1).
- Modelli ausiliari (memorie, guardian-v2) = modello di sessione se il
  preferito gpt-* non e' nel catalogo.
- Ricerca web: crate web-tools, backend SearXNG con web_search e web_fetch
  (protezione SSRF); senza backend nessuno strumento web.
- Skill: rimossa openai-docs; skill-installer punta a git.difonzo.net.
- apply_patch accetta gli header @@ -a,b +c,d @@ dei diff unificati.
- Rimossi resti: request_plugin_install, AppsInstructions, --cyber-access-program,
  URL updater/realtime predefiniti.
- Fix: importazione sessioni con provider vuoto.
- Istruzioni di sistema invariate. Test: cancellati solo quelli del codice
  rimosso, test di sicurezza adattati; restano solo fallimenti d'ambiente.
- Prova reale su imeAI + SearXNG: risposta, modifica file, web_search,
  cache riusata, connessioni solo verso .25 e .57.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-11 02:11:45 +01:00
parent 9e33707b8e
commit e39aae0085
545 changed files with 9742 additions and 24503 deletions

View File

@@ -33,7 +33,7 @@ async fn resume_lists_all_providers_and_fork_keeps_provider_filter() -> Result<(
),
)?;
for (hour, provider, preview) in [
("10", "openai", "Client provider history"),
("10", "mock", "Client provider history"),
("11", "server-provider", "Server provider history"),
] {
create_fake_rollout(
@@ -89,14 +89,14 @@ async fn resume_lists_all_providers_and_fork_keeps_provider_filter() -> Result<(
"--remote",
remote_endpoint.as_str(),
"-c",
"model_provider=\"openai\"",
"model_provider=\"mock\"",
]);
}
let case = format!("{action}: embedded={embedded}, last={last}, explicit={explicit}");
let mut terminal = PtyCodex::start_cli(&cwd, home, &args)?;
if action == "resume" && last && explicit {
// --last finds the newest thread across providers. An explicit override
// cannot switch that thread from server-provider to openai.
// cannot switch that thread from server-provider to mock.
terminal
.wait_for_screen("Cannot change this thread's model provider")
.with_context(|| format!("{case}; screen:\n{}", terminal.screen_contents()))?;
@@ -158,15 +158,12 @@ async fn selected_gateway_authenticates_before_its_first_chat() -> Result<()> {
&profile,
format!(
r#"
model_provider = "openai"
model_provider = "office"
model = "gpt-5.1"
forced_login_method = "api"
cli_auth_credentials_store = "file"
suppress_unstable_features_warning = true
[features]
gateway_setup_wizard = true
bedrock_setup_wizard = false
gcp_setup_wizard = false
api_key_model_discovery = false
[projects.{trusted}]
trust_level = "trusted"
@@ -184,23 +181,23 @@ requires_openai_auth = true
home,
&["--profile", "work", "--no-daemon", "verify the gateway"],
)?;
// aKode has no default provider, so the gateway is already selected; its sign-in must
// finish before the first chat request.
terminal
.wait_for_screen("Use a custom provider or gateway")
.wait_for_screen("Connect an API key to use aKode")
.with_context(|| terminal.screen_contents())?;
// Startup drains input after its first draw. Retry the navigation until it is accepted.
// Startup drains input after its first draw. Retry until the API key entry opens. Pick the
// option by number: Enter would arm the activation guard and swallow the save below.
let deadline = std::time::Instant::now() + Duration::from_secs(/*secs*/ 30);
while !terminal.screen_contains("> 2. Use a custom provider or gateway") {
while !terminal.screen_contains("Paste or type your API key") {
ensure!(
std::time::Instant::now() < deadline,
"gateway option was not highlighted: {}",
"API key entry did not open: {}",
terminal.screen_contents()
);
terminal.write_input(b"\x1b[B")?;
terminal.write_input(b"1")?;
terminal.read_output(Duration::from_millis(/*millis*/ 50))?;
}
terminal.write_input(b"\r")?;
terminal.wait_for_screen("Office gateway")?;
terminal.write_input(b"\x1b[H\r")?;
terminal.wait_for_screen("Paste or type your API key")?;
let deadline = std::time::Instant::now() + Duration::from_secs(/*secs*/ 30);
while !auth.is_file() && terminal.screen_contains("Paste or type your API key") {