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>
41 lines
1.6 KiB
Rust
41 lines
1.6 KiB
Rust
use akode_exec_server_protocol::EXEC_CLOSED_METHOD;
|
|
use akode_exec_server_protocol::EXEC_EXITED_METHOD;
|
|
use akode_exec_server_protocol::EXEC_OUTPUT_DELTA_METHOD;
|
|
use akode_exec_server_protocol::HTTP_REQUEST_BODY_DELTA_METHOD;
|
|
use akode_exec_server_protocol::JSONRPCMessage;
|
|
use akode_exec_server_protocol::MAX_HTTP_BODY_DELTA_BYTES;
|
|
|
|
// A transport may materialize one larger frame before its JSON-RPC kind is known.
|
|
pub(crate) const MAX_CLIENT_INBOUND_REQUEST_LEN: usize = 8 * 1024;
|
|
// Streamed HTTP bodies carry up to 1 MiB before base64 and JSON-RPC framing.
|
|
pub(crate) const MAX_CLIENT_INBOUND_NOTIFICATION_LEN: usize = 2 * MAX_HTTP_BODY_DELTA_BYTES;
|
|
|
|
pub(crate) fn client_inbound_message_exceeded_limit(
|
|
message: Result<&JSONRPCMessage, &serde_json::Error>,
|
|
encoded_len: usize,
|
|
max_request_len: usize,
|
|
) -> Option<usize> {
|
|
let max_len = match message {
|
|
Ok(JSONRPCMessage::Notification(notification))
|
|
if matches!(
|
|
notification.method.as_str(),
|
|
EXEC_OUTPUT_DELTA_METHOD
|
|
| EXEC_EXITED_METHOD
|
|
| EXEC_CLOSED_METHOD
|
|
| HTTP_REQUEST_BODY_DELTA_METHOD
|
|
) =>
|
|
{
|
|
MAX_CLIENT_INBOUND_NOTIFICATION_LEN
|
|
}
|
|
Ok(JSONRPCMessage::Request(_)) | Ok(JSONRPCMessage::Notification(_)) | Err(_) => {
|
|
max_request_len
|
|
}
|
|
Ok(JSONRPCMessage::Response(_)) | Ok(JSONRPCMessage::Error(_)) => return None,
|
|
};
|
|
(encoded_len > max_len).then_some(max_len)
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "client_inbound_request_limit_tests.rs"]
|
|
mod tests;
|