fix(arch): unify TS/Rust types + classroom persistence registration + approval audit
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- M11-03: Register ClassroomPersistence via Tauri .setup() hook with in-memory fallback. Previously missing — classroom commands would crash at runtime. - M3-02: Document BrowserHand as schema validator + TypeScript delegation passthrough (dual-path architecture explicitly documented). - M4-04: Add defense-in-depth audit logging in execute_hand() and execute_hand_with_source() when needs_approval hands bypass approval gate. - TYPE-01: Add #[serde(rename_all = "camelCase")] to Rust AgentInfo. Add missing fields to TS AgentInfo (messageCount, createdAt, updatedAt). Fix KernelStatus TS interface to match Rust KernelStatusResponse (baseUrl/model instead of defaultProvider/defaultModel). - SEC2-P1-01: Document EXTRACTION_DRIVER OnceCell as legacy path; Kernel struct field is the active path. - TriggerSource: Add #[derive(PartialEq)] for approval audit comparisons.
This commit is contained in:
@@ -227,28 +227,37 @@ impl LlmDriverForExtraction for TauriExtractionDriver {
|
||||
}
|
||||
}
|
||||
|
||||
/// Global extraction driver instance (lazy-initialized).
|
||||
/// Global extraction driver instance (legacy path, kept for compatibility).
|
||||
///
|
||||
/// **Architecture note:** The Kernel struct now holds its own `extraction_driver` field
|
||||
/// (set via `kernel.set_extraction_driver()`), which is the primary path used by
|
||||
/// the middleware chain. This OnceCell global is a legacy artifact — its accessors
|
||||
/// are dead code. The `configure_extraction_driver()` function is still called during
|
||||
/// kernel_init for backward compatibility but the primary consumption path is
|
||||
/// through the Kernel struct.
|
||||
static EXTRACTION_DRIVER: tokio::sync::OnceCell<Arc<TauriExtractionDriver>> =
|
||||
tokio::sync::OnceCell::const_new();
|
||||
|
||||
/// Configure the global extraction driver.
|
||||
/// Configure the global extraction driver (legacy path).
|
||||
///
|
||||
/// Call this during kernel initialization after the Kernel's LLM driver is available.
|
||||
/// Called during kernel initialization. The primary path is via
|
||||
/// `kernel.set_extraction_driver()` which stores the driver in the Kernel struct
|
||||
/// for use by the middleware chain.
|
||||
pub fn configure_extraction_driver(driver: Arc<dyn LlmDriver>, model: String) {
|
||||
let adapter = TauriExtractionDriver::new(driver, model);
|
||||
let _ = EXTRACTION_DRIVER.set(Arc::new(adapter));
|
||||
tracing::info!("[ExtractionAdapter] Extraction driver configured");
|
||||
tracing::info!("[ExtractionAdapter] Extraction driver configured (legacy OnceCell path)");
|
||||
}
|
||||
|
||||
/// Check if the extraction driver is available.
|
||||
/// Check if the extraction driver is available (legacy OnceCell path).
|
||||
#[allow(dead_code)]
|
||||
pub fn is_extraction_driver_configured() -> bool {
|
||||
EXTRACTION_DRIVER.get().is_some()
|
||||
}
|
||||
|
||||
/// Get the global extraction driver.
|
||||
/// Get the global extraction driver (legacy OnceCell path).
|
||||
///
|
||||
/// Returns `None` if not yet configured via `configure_extraction_driver`.
|
||||
/// Prefer accessing via `kernel.extraction_driver()` when the Kernel is available.
|
||||
#[allow(dead_code)]
|
||||
pub fn get_extraction_driver() -> Option<Arc<TauriExtractionDriver>> {
|
||||
EXTRACTION_DRIVER.get().cloned()
|
||||
|
||||
Reference in New Issue
Block a user