feat(infra): temp IdeA généralisé à tous les agents + purge du store managed-tmp au shutdown d'IdeA — #200 (QA verte)
This commit is contained in:
@ -134,9 +134,9 @@ pub use layout::{
|
||||
};
|
||||
pub use managed_temp::{
|
||||
AllocateManagedTemp, AllocateManagedTempInput, AllocateManagedTempOutput, GcManagedTemp,
|
||||
GcManagedTempOutput, ReleaseManagedTemp, ReleaseManagedTempInput, ReleaseManagedTempOutput,
|
||||
ResolveManagedTemp, ResolveManagedTempInput, ResolveManagedTempOutput,
|
||||
MANAGED_TEMP_DEFAULT_TTL_MS, MANAGED_TEMP_PURPOSE_MAX_CHARS,
|
||||
GcManagedTempOutput, PurgeManagedTemp, PurgeManagedTempOutput, ReleaseManagedTemp,
|
||||
ReleaseManagedTempInput, ReleaseManagedTempOutput, ResolveManagedTemp, ResolveManagedTempInput,
|
||||
ResolveManagedTempOutput, MANAGED_TEMP_DEFAULT_TTL_MS, MANAGED_TEMP_PURPOSE_MAX_CHARS,
|
||||
};
|
||||
pub use mcp_tool_permissions::{
|
||||
McpToolPermissionCatalogue, ReadMcpToolPermissions, ReadMcpToolPermissionsInput,
|
||||
|
||||
@ -191,6 +191,32 @@ impl GcManagedTemp {
|
||||
}
|
||||
}
|
||||
|
||||
/// Output for [`PurgeManagedTemp`].
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct PurgeManagedTempOutput {
|
||||
/// Purge report.
|
||||
pub report: ManagedTempGcReport,
|
||||
}
|
||||
|
||||
/// Eagerly purges all managed temporary allocations.
|
||||
pub struct PurgeManagedTemp {
|
||||
store: Arc<dyn ManagedTempStore>,
|
||||
}
|
||||
|
||||
impl PurgeManagedTemp {
|
||||
/// Builds the use case.
|
||||
#[must_use]
|
||||
pub fn new(store: Arc<dyn ManagedTempStore>) -> Self {
|
||||
Self { store }
|
||||
}
|
||||
|
||||
/// Executes the purge.
|
||||
pub async fn execute(&self) -> Result<PurgeManagedTempOutput, AppError> {
|
||||
let report = self.store.purge_all().await?;
|
||||
Ok(PurgeManagedTempOutput { report })
|
||||
}
|
||||
}
|
||||
|
||||
fn now_ms(clock: &Arc<dyn Clock>) -> u64 {
|
||||
u64::try_from(clock.now_millis()).unwrap_or(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user