Projects: shareable, registry-backed, container-mounted; drop ticket board
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:
2026-07-20 22:21:10 +01:00
parent bd88f02226
commit 2ec394c17c
26 changed files with 963 additions and 1245 deletions
+22 -2
View File
@@ -23,7 +23,7 @@ use std::time::Duration;
use anyhow::{bail, Context, Result};
use sqlx::SqlitePool;
use core_api::user_fs::{SharedMount, UserFs};
use core_api::user_fs::{ProjectMount, SharedMount, UserFs};
use crate::db;
@@ -38,6 +38,9 @@ const DOCKERFILE: &str = include_str!("Dockerfile");
pub const HOMES_DIR: &str = "homes";
/// Subdirectory of the working directory holding shared folders.
pub const SHARED_DIR: &str = "shared";
/// Subdirectory of the working directory holding project folders
/// (`{WD}/projects/{owner_userid}/{slug}`).
pub const PROJECTS_DIR: &str = "projects";
/// Home mount point inside the container.
pub const CONTAINER_HOME: &str = "/root";
/// Grace window `docker stop` gives in-container processes (SIGTERM → SIGKILL)
@@ -69,7 +72,24 @@ pub async fn build_user_fs(system: &SqlitePool, user_id: &str) -> Result<UserFs>
})
.collect();
Ok(UserFs::new(user_id, home_host, container_name(user_id), container_home, shared))
// Projects (owned + shared-with-them). Host keys on the owner's stable userid; the
// agent/container path keys on the owner's username (`projects/{owner_username}/{slug}`).
let project_rows = db::project_members::list_for_user_mounts(system, user_id).await?;
let projects = project_rows
.into_iter()
.map(|p| ProjectMount {
container: container_home
.join(PROJECTS_DIR)
.join(&p.owner_username)
.join(&p.slug),
host: wd.join(PROJECTS_DIR).join(&p.owner_user_id).join(&p.slug),
owner_username: p.owner_username,
slug: p.slug,
can_write: p.can_write,
})
.collect();
Ok(UserFs::new(user_id, home_host, container_name(user_id), container_home, shared, projects))
}
/// Owns the container lifecycle: the docker availability check, the runtime image,