Files
imeai-aKode/akode-rs/core/src/agent/host/admission.rs
andrea.difonzo 7c1c6dfa8d 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>
2026-11-17 12:37:52 +01:00

31 lines
1.3 KiB
Rust

//! Connects host-owned turn capacity to Core task lifetimes.
use crate::agent::types::AgentExecutionGuard;
use akode_protocol::ThreadId;
use akode_protocol::error::Result;
use futures::future::BoxFuture;
/// Identifies the execution for which Core requests host capacity.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct AgentTurnAdmissionRequest {
pub thread_id: ThreadId,
pub turn_id: String,
}
/// Acquires host-owned capacity before each configured runtime task executes, including roots.
///
/// Select host ownership and install this provider before thread startup finishes. Return
/// `AgentLimitReached` when capacity is exhausted rather than waiting for a slot.
/// Cancellation drops the acquisition future. Errors fail the attempted turn
/// without falling back to Local admission. The returned guard releases or arranges
/// release of capacity when Core ends the task.
/// A submitted turn can be denied after its input was accepted. Core records that
/// input and reports the error through the ordinary turn lifecycle.
/// Hosts own remote retries, abandoned acquisitions and worker-loss recovery.
pub trait AgentTurnAdmission: Send + Sync {
fn admit_turn(
&self,
request: AgentTurnAdmissionRequest,
) -> BoxFuture<'_, Result<AgentExecutionGuard>>;
}