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>
This commit is contained in:
andrea.difonzo
2026-11-17 12:37:52 +01:00
parent e37a0deba9
commit 7c1c6dfa8d
10306 changed files with 748026 additions and 748088 deletions

View File

@@ -0,0 +1,53 @@
use std::process::Stdio;
use std::time::Duration;
use anyhow::Context;
use anyhow::Result;
use tokio::io::AsyncBufReadExt;
use tokio::io::BufReader;
use tokio::process::Child;
use tokio::process::Command;
use tokio::time::timeout;
pub(crate) struct HostHarness {
pub(crate) _child: Child,
pub(crate) endpoint: String,
}
impl HostHarness {
pub(crate) async fn start(listen_url: &str) -> Result<Self> {
let host_program = akode_utils_cargo_bin::cargo_bin("akode-code-mode-host")?;
let mut child = Command::new(host_program)
.args(["--listen", listen_url])
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.kill_on_drop(/*kill_on_drop*/ true)
.spawn()
.context("failed to start code-mode host")?;
let stdout = child
.stdout
.take()
.context("code-mode host stdout was not captured")?;
let endpoint = timeout(
Duration::from_secs(/*secs*/ 10),
BufReader::new(stdout).lines().next_line(),
)
.await
.context("timed out waiting for code-mode host endpoint")??
.context("code-mode host exited before publishing its endpoint")?;
let expected_scheme = if listen_url.starts_with("grpc://") {
"http"
} else {
"ws"
};
if !endpoint.starts_with(&format!("{expected_scheme}://127.0.0.1:")) {
anyhow::bail!("unexpected code-mode host endpoint `{endpoint}`");
}
Ok(Self {
_child: child,
endpoint,
})
}
}

View File

@@ -0,0 +1,49 @@
use akode_code_mode::CellId;
use akode_code_mode::CodeModeNestedToolCall;
use akode_code_mode::CodeModeSessionDelegate;
use akode_code_mode::NotificationFuture;
use akode_code_mode::ToolInvocationFuture;
use akode_protocol::ToolName;
use pretty_assertions::assert_eq;
use serde_json::json;
use tokio::sync::Semaphore;
use tokio_util::sync::CancellationToken;
pub(crate) struct LargeToolResultDelegate {
pub(crate) started: Semaphore,
pub(crate) release: Semaphore,
}
impl CodeModeSessionDelegate for LargeToolResultDelegate {
fn invoke_tool<'a>(
&'a self,
invocation: CodeModeNestedToolCall,
_cancellation: CancellationToken,
) -> ToolInvocationFuture<'a> {
Box::pin(async move {
if invocation.tool_name == ToolName::plain("fast") {
return Ok(json!({ "value": "isolated" }));
}
assert_eq!(invocation.tool_name, ToolName::plain("large"));
self.started.add_permits(/*n*/ 1);
self.release
.acquire()
.await
.map_err(|_| "large tool release closed".to_string())?
.forget();
Ok(json!({ "value": "x".repeat(8 * 1024 * 1024) }))
})
}
fn notify<'a>(
&'a self,
_call_id: String,
_cell_id: CellId,
_text: String,
_cancellation: CancellationToken,
) -> NotificationFuture<'a> {
Box::pin(async { Ok(()) })
}
fn cell_closed(&self, _cell_id: &CellId) {}
}

View File

@@ -0,0 +1,59 @@
use std::sync::Mutex;
use std::sync::PoisonError;
use akode_code_mode::CellId;
use akode_code_mode::CodeModeNestedToolCall;
use akode_code_mode::CodeModeSessionDelegate;
use akode_code_mode::NotificationFuture;
use akode_code_mode::ToolInvocationFuture;
use serde_json::json;
use tokio::sync::Notify;
use tokio_util::sync::CancellationToken;
#[derive(Default)]
pub(crate) struct RecordingDelegate {
pub(crate) invocations: Mutex<Vec<CodeModeNestedToolCall>>,
pub(crate) notifications: Mutex<Vec<(String, CellId, String)>>,
pub(crate) notification_delivered: Notify,
pub(crate) closed_cells: Mutex<Vec<CellId>>,
}
impl CodeModeSessionDelegate for RecordingDelegate {
fn invoke_tool<'a>(
&'a self,
invocation: CodeModeNestedToolCall,
_cancellation: CancellationToken,
) -> ToolInvocationFuture<'a> {
self.invocations
.lock()
.unwrap_or_else(PoisonError::into_inner)
.push(invocation);
Box::pin(async { Ok(json!({ "value": "output" })) })
}
fn notify<'a>(
&'a self,
call_id: String,
cell_id: CellId,
text: String,
_cancellation: CancellationToken,
) -> NotificationFuture<'a> {
self.notifications
.lock()
.unwrap_or_else(PoisonError::into_inner)
.push((call_id, cell_id, text));
self.notification_delivered.notify_one();
Box::pin(async { Ok(()) })
}
fn cell_closed(&self, cell_id: &CellId) {
self.closed_cells
.lock()
.unwrap_or_else(PoisonError::into_inner)
.push(cell_id.clone());
}
}
pub(crate) fn cell_id(value: &str) -> CellId {
CellId::new(value.to_string())
}