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:
@@ -71,10 +71,10 @@ const RESTART_RETRY_INTERVAL: Duration = Duration::from_millis(50);
|
||||
// envelope, and the worst-case six-byte JSON escape for every captured byte.
|
||||
const INSTALLER_STDERR_TAIL_BYTES: usize = 2 * 1024;
|
||||
const INSTALLER_STDERR_DRAIN_TIMEOUT: Duration = Duration::from_secs(1);
|
||||
#[cfg(unix)]
|
||||
const INSTALL_URL: &str = "https://chatgpt.com/codex/install.sh";
|
||||
#[cfg(windows)]
|
||||
const INSTALL_URL: &str = "https://chatgpt.com/codex/install.ps1";
|
||||
/// aKode has no hosted update source: the upstream installer lived on chatgpt.com and is
|
||||
/// never contacted. Updates are installed by re-running aKode's own installer.
|
||||
const NO_UPDATE_SOURCE_ERROR: &str =
|
||||
"aKode has no automatic update source; reinstall from the aKode release to update";
|
||||
|
||||
pub(crate) async fn run(
|
||||
http_client_factory: HttpClientFactory,
|
||||
@@ -747,7 +747,10 @@ async fn cancel_installer(child: &mut tokio::process::Child, package_root: &Path
|
||||
}
|
||||
|
||||
async fn fetch_installer_script(http: &impl InstallerHttp) -> Result<Vec<u8>> {
|
||||
match http.get(INSTALL_URL).await? {
|
||||
let Some(url) = http.installer_url() else {
|
||||
anyhow::bail!(NO_UPDATE_SOURCE_ERROR);
|
||||
};
|
||||
match http.get(url).await? {
|
||||
InstallerResponse::Success(body) => Ok(body),
|
||||
InstallerResponse::Unsuccessful { status } => {
|
||||
anyhow::bail!("standalone Codex updater request failed with status {status}")
|
||||
@@ -766,6 +769,11 @@ enum InstallerResponse {
|
||||
/// Implementations must issue a GET for the supplied URL, return exact response bytes for a
|
||||
/// successful status, and report a non-success status without buffering its response body.
|
||||
trait InstallerHttp: Send + Sync {
|
||||
/// Installer script URL. Production has none, so nothing is ever downloaded.
|
||||
fn installer_url(&self) -> Option<&str> {
|
||||
None
|
||||
}
|
||||
|
||||
fn get<'a>(
|
||||
&'a self,
|
||||
url: &'a str,
|
||||
|
||||
@@ -6,9 +6,9 @@ use pretty_assertions::assert_eq;
|
||||
#[cfg(unix)]
|
||||
use tempfile::TempDir;
|
||||
|
||||
use super::INSTALL_URL;
|
||||
use super::InstallerHttp;
|
||||
use super::InstallerResponse;
|
||||
use super::NO_UPDATE_SOURCE_ERROR;
|
||||
use super::fetch_installer_script;
|
||||
#[cfg(unix)]
|
||||
use super::manual_update::run as manual_update_once;
|
||||
@@ -25,6 +25,28 @@ use crate::managed_install::executable_identity;
|
||||
#[cfg(unix)]
|
||||
use crate::managed_install::executable_identity_from_reader;
|
||||
|
||||
const INSTALL_URL: &str = "https://updates.invalid/install.sh";
|
||||
|
||||
#[tokio::test]
|
||||
async fn production_installer_source_is_absent_and_nothing_is_requested() {
|
||||
struct NoSource(Mutex<Vec<String>>);
|
||||
impl InstallerHttp for NoSource {
|
||||
async fn get(&self, url: &str) -> anyhow::Result<InstallerResponse> {
|
||||
self.0
|
||||
.lock()
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner)
|
||||
.push(url.to_string());
|
||||
Ok(InstallerResponse::Success(Vec::new()))
|
||||
}
|
||||
}
|
||||
let http = NoSource(Mutex::new(Vec::new()));
|
||||
let error = fetch_installer_script(&http)
|
||||
.await
|
||||
.expect_err("no update source is configured");
|
||||
assert_eq!(error.to_string(), NO_UPDATE_SOURCE_ERROR);
|
||||
assert!(http.0.lock().unwrap().is_empty());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn installer_fetch_uses_exact_url_and_preserves_bytes() {
|
||||
let script = b"#!/bin/sh\nprintf 'update bytes'\n".to_vec();
|
||||
@@ -363,6 +385,10 @@ impl FakeInstallerHttp {
|
||||
}
|
||||
|
||||
impl InstallerHttp for FakeInstallerHttp {
|
||||
fn installer_url(&self) -> Option<&str> {
|
||||
Some(INSTALL_URL)
|
||||
}
|
||||
|
||||
async fn get(&self, url: &str) -> anyhow::Result<InstallerResponse> {
|
||||
self.requested_urls
|
||||
.lock()
|
||||
@@ -1262,6 +1288,10 @@ async fn installer_failure_preserves_stderr_before_drain_timeout() {
|
||||
async fn update_rejects_a_package_root_change_during_download() {
|
||||
struct ChangingRoot<'a>(&'a std::path::Path);
|
||||
impl InstallerHttp for ChangingRoot<'_> {
|
||||
fn installer_url(&self) -> Option<&str> {
|
||||
Some(INSTALL_URL)
|
||||
}
|
||||
|
||||
async fn get(&self, _url: &str) -> anyhow::Result<InstallerResponse> {
|
||||
std::os::unix::fs::symlink(
|
||||
self.0.join("packages/standalone"),
|
||||
|
||||
Reference in New Issue
Block a user