Major rebranding, i18n, dashboard, shared folders, role capabilities
- Rebrand: new app/agent icons, SKALD.md, warm "paper" CSS palette (terracotta accent, --radius tokens, WCAG contrast, reduced-motion), updated favicon, tray icon, skaldkonur asset - i18n: backend crate (i18n.rs, locale column, ui_locale config), frontend library (web/lib/i18n.js, I18nMixin, t(key)), translation files (web/i18n/), every component wired - Dashboard: <dashboard-page> replaces old home-page content; <app-copilot> becomes the landing page (full/dock layout modes) - Shared folders: API endpoints (shared_folders.rs), frontend page, can_write membership, container mount topology, user_fs routing - Role capabilities: new db table & authorization seam (data not enums), roles.attrs JSON for ui_mode / interface select - Setup: skald-setup prompts for language + password, sets ui_locale - General: components migrated to CSS variables, Lit conventions cleanup, connectors/catalog/marketplace/approval refactoring
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
//! fs-tools *before* reaching here; `UserFs` only ever sees physical paths.
|
||||
|
||||
use std::path::{Component, Path, PathBuf};
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
/// One shared folder mounted into a user's container.
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -128,6 +129,40 @@ fn strip_home_prefix(path: &str) -> &str {
|
||||
}
|
||||
}
|
||||
|
||||
/// A hot-swappable handle to a [`UserFs`] snapshot, shared by every holder that
|
||||
/// must observe a membership change without being rebuilt (blueprint §6 remount).
|
||||
///
|
||||
/// Cloning shares the *same* cell. `store` replaces the snapshot for all clones at
|
||||
/// once; each `load` returns the current `Arc<UserFs>`. A live chat session's
|
||||
/// handler holds a clone, so a shared-folder change reaches it on its next tool
|
||||
/// call — no handler eviction, and no cross-session race (the swap is a single
|
||||
/// pointer store behind the lock, and each `ToolContext` takes a consistent
|
||||
/// snapshot for the duration of its call).
|
||||
#[derive(Clone)]
|
||||
pub struct SharedFs(Arc<RwLock<Arc<UserFs>>>);
|
||||
|
||||
impl SharedFs {
|
||||
pub fn new(fs: UserFs) -> Self {
|
||||
Self(Arc::new(RwLock::new(Arc::new(fs))))
|
||||
}
|
||||
|
||||
/// The current snapshot. Cheap — clones an `Arc`.
|
||||
pub fn load(&self) -> Arc<UserFs> {
|
||||
Arc::clone(&self.0.read().expect("SharedFs lock poisoned"))
|
||||
}
|
||||
|
||||
/// Replace the snapshot seen by every holder of this cell.
|
||||
pub fn store(&self, fs: UserFs) {
|
||||
*self.0.write().expect("SharedFs lock poisoned") = Arc::new(fs);
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for SharedFs {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_tuple("SharedFs").field(&*self.load()).finish()
|
||||
}
|
||||
}
|
||||
|
||||
/// Pure lexical normalization (resolve `.`/`..`), no filesystem access.
|
||||
fn normalize(p: &Path) -> PathBuf {
|
||||
let mut out = PathBuf::new();
|
||||
|
||||
Reference in New Issue
Block a user