Projects: shareable, registry-backed, container-mounted; drop ticket board
Nightly Build / build (push) Successful in 6m27s
Nightly Build / build (push) Successful in 6m27s
Rework projects from single-user leftovers into shareable endeavours.
- DB: move `projects` from the owner bucket to the registry (system.db,
not encrypted); add `owner_user_id` + `slug` (drop free `path`); new
`project_members(project_id, user_id, can_write)` mirroring
`shared_folder_members`. Drop `project_tickets` entirely. Only user↔agent
conversations stay encrypted (per-user DB) — each member keeps a private
project chat. Registry home dissolves the cross-DB-FK problem.
- Filesystem/container: on disk `{WD}/projects/{owner_userid}/{slug}`,
agent/container path `projects/{owner_username}/{slug}`. Two-segment routing
in UserFs (ProjectMount + host_base_and_tail arm) and a second loop in
build_user_fs; read-only members get a :ro mount. Reuse the shared-folder
remount machinery (refresh_user_shared_folders -> refresh_user_mounts).
- Remove the ticket system: ProjectTicketManager, UserContext.tickets, its
wiring, and the project_tickets references in scheduled_jobs/cron.
- API: repoint handlers to the registry pool + membership scoping. Sharing is
self-service — owner or any write-member may add/remove members and set
read/write; only the owner deletes; the owner cannot be removed. New
POST/DELETE /api/projects/{id}/members[/{user_id}]. Seed `@fs_any allow
projects/*`; build_runtime_run_context sets working_directory to the agent
path and drops the host-path allow_fs_writes.
- Frontend: create form without the free path field, owner/read-write badges;
the detail page becomes header + description + sharing panel + Open chat + a
file-explorer placeholder (the future primary surface). i18n en/it/fr.
This commit is contained in:
@@ -34,8 +34,6 @@ use crate::location::LocationManager;
|
||||
use crate::mcp::McpManager;
|
||||
use crate::memory::MemoryManager;
|
||||
use crate::plugin::PluginManager;
|
||||
use crate::projects::tickets::ProjectTicketManager;
|
||||
use crate::projects::ProjectManager;
|
||||
use crate::provider::ProviderRegistry;
|
||||
use crate::run_context::RunContextManager;
|
||||
use crate::secrets::SecretsStore;
|
||||
@@ -86,7 +84,10 @@ impl Skald {
|
||||
///
|
||||
/// Best-effort by contract: the membership row is already committed, so a Docker
|
||||
/// hiccup must not fail the caller; the state settles at the next login/boot.
|
||||
pub async fn refresh_user_shared_folders(&self, user_id: &str) -> anyhow::Result<()> {
|
||||
///
|
||||
/// Covers both shared-folder and project membership changes — both feed
|
||||
/// `build_user_fs`, so a recreate reflows either mount set.
|
||||
pub async fn refresh_user_mounts(&self, user_id: &str) -> anyhow::Result<()> {
|
||||
// New mount topology (graceful stop → remove → recreate from current rows).
|
||||
self.container().recreate(user_id).await?;
|
||||
|
||||
@@ -146,8 +147,6 @@ impl Skald {
|
||||
|
||||
// Tasks
|
||||
pub fn cron(&self) -> &Arc<TaskManager> { &self.tasks.cron }
|
||||
pub fn projects(&self) -> &Arc<ProjectManager> { &self.tasks.projects }
|
||||
pub fn ticket_manager(&self) -> &Arc<ProjectTicketManager> { &self.tasks.ticket_manager }
|
||||
|
||||
// Conversation
|
||||
pub fn manager(&self) -> &Arc<ChatSessionManager> { &self.conversation.manager }
|
||||
|
||||
@@ -30,8 +30,6 @@ use crate::location::LocationManager;
|
||||
use crate::mcp::McpManager;
|
||||
use crate::memory::MemoryManager;
|
||||
use crate::plugin::PluginManager;
|
||||
use crate::projects::tickets::ProjectTicketManager;
|
||||
use crate::projects::ProjectManager;
|
||||
use crate::provider::ProviderRegistry;
|
||||
use crate::run_context::RunContextManager;
|
||||
use crate::secrets::SecretsStore;
|
||||
@@ -174,12 +172,10 @@ impl Integrations {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Tasks: cron + projects/tickets ──────────────────────────────────────────
|
||||
// ── Tasks: cron ──────────────────────────────────────────────────────────────
|
||||
|
||||
pub(super) struct Tasks {
|
||||
pub(super) cron: Arc<TaskManager>,
|
||||
pub(super) projects: Arc<ProjectManager>,
|
||||
pub(super) ticket_manager: Arc<ProjectTicketManager>,
|
||||
pub(super) cron: Arc<TaskManager>,
|
||||
}
|
||||
|
||||
impl Tasks {
|
||||
@@ -193,11 +189,7 @@ impl Tasks {
|
||||
});
|
||||
let cron = TaskManager::new(Arc::clone(&rt.db), cron_tz, Arc::clone(&rt.system_bus));
|
||||
|
||||
let ticket_manager = ProjectTicketManager::new(Arc::clone(&rt.db));
|
||||
let projects = Arc::new(ProjectManager::new(Arc::clone(&rt.db)));
|
||||
info!("project manager ready");
|
||||
|
||||
Tasks { cron, projects, ticket_manager }
|
||||
Tasks { cron }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,6 +345,7 @@ impl Conversation {
|
||||
"skald-ownerless",
|
||||
std::path::PathBuf::from("/root"),
|
||||
Vec::new(),
|
||||
Vec::new(),
|
||||
));
|
||||
|
||||
let manager = Arc::new(ChatSessionManager::new(
|
||||
|
||||
@@ -51,7 +51,6 @@ use crate::inbox::Inbox;
|
||||
use crate::llm::LlmManager;
|
||||
use crate::mcp::{McpManager, McpProvider, UserMcpView};
|
||||
use crate::memory::MemoryManager;
|
||||
use crate::projects::tickets::ProjectTicketManager;
|
||||
use crate::run_context::RunContextManager;
|
||||
use crate::session::handler::{DEFAULT_MAX_PARALLEL_SUBAGENTS, DEFAULT_MAX_TOOL_ROUNDS};
|
||||
use crate::session::manager::ChatSessionManager;
|
||||
@@ -74,7 +73,6 @@ pub struct UserContext {
|
||||
pub sessions: Arc<ChatSessionManager>,
|
||||
pub chat_hub: Arc<ChatHub>,
|
||||
pub cron: Arc<TaskManager>,
|
||||
pub tickets: Arc<ProjectTicketManager>,
|
||||
pub approval: Arc<ApprovalManager>,
|
||||
pub clarification: Arc<ClarificationManager>,
|
||||
pub elicitation: Arc<ElicitationManager>,
|
||||
@@ -291,29 +289,12 @@ impl UserContextFactory {
|
||||
cron.set_self_arc(Arc::clone(&cron));
|
||||
chat_hub.set_task_mgr(Arc::clone(&cron));
|
||||
|
||||
// Per-user ticket manager — wired to the per-user TaskManager so
|
||||
// `start_ticket` spawns jobs in the user's own pool.
|
||||
let tickets = ProjectTicketManager::new(Arc::clone(&pool));
|
||||
tickets.set_task_manager(Arc::clone(&cron));
|
||||
|
||||
// Per-user cron loop. `start()` observes the shutdown token, so it stops on
|
||||
// shutdown; adopting it lets the supervisor also join it. The name is leaked
|
||||
// to satisfy the `&'static str` label — bounded by the (small) user count.
|
||||
let name: &'static str = Box::leak(format!("cron:{user_id}").into_boxed_str());
|
||||
self.supervisor.adopt(name, Arc::clone(&cron).start(self.shutdown_token.clone()));
|
||||
|
||||
// Per-user ticket-listener: reacts to JobCompleted events for this user's
|
||||
// tickets. All users' listeners receive the event (global system bus); only
|
||||
// the one that owns the ticket does the UPDATE — others no-op on 0 rows.
|
||||
let tname: &'static str = Box::leak(format!("tickets:{user_id}").into_boxed_str());
|
||||
self.supervisor.adopt_one(
|
||||
tname,
|
||||
Arc::clone(&tickets).start_listener(
|
||||
Arc::clone(&self.system_bus),
|
||||
self.shutdown_token.clone(),
|
||||
),
|
||||
);
|
||||
|
||||
Ok(Arc::new(UserContext {
|
||||
user_id: user_id.to_string(),
|
||||
pool,
|
||||
@@ -322,7 +303,6 @@ impl UserContextFactory {
|
||||
sessions: manager,
|
||||
chat_hub,
|
||||
cron,
|
||||
tickets,
|
||||
approval,
|
||||
clarification,
|
||||
elicitation,
|
||||
|
||||
@@ -32,7 +32,6 @@ pub(super) fn wire(
|
||||
tasks.cron.set_session(Arc::clone(&conversation.manager));
|
||||
tasks.cron.set_hub(Arc::clone(&conversation.chat_hub));
|
||||
tasks.cron.set_self_arc(Arc::clone(&tasks.cron));
|
||||
tasks.ticket_manager.set_task_manager(Arc::clone(&tasks.cron));
|
||||
conversation.chat_hub.set_task_mgr(Arc::clone(&tasks.cron));
|
||||
integrations.mcp.set_elicitation_handler(ElicitationBridge::new(Arc::clone(&interaction.elicitation)));
|
||||
info!("ChatHub initialised");
|
||||
|
||||
Reference in New Issue
Block a user