using System.Text.Json.Serialization; namespace ClawdDotNet.Core.Config; /// /// #684: A shared workspace — a folder several agents work in, with a named owner and a list /// of who may use it how. /// /// The right stands at the workspace, not at the agent (Organisation-Konzept, /// section 3). Before, every agent carried one sharedAccessLevel for the one shared /// folder of the instance, and "accounting may write its files, marketing may only read /// them" could not be said. Here each workspace lists its members; whoever is not on the /// list does not see it — not even that it exists. /// /// The one shared folder stays what it was. The folder SharedWorkspace /// with the per-agent level keeps working as the workspace shared, so every running /// installation and every task that names it goes on as before. Workspaces configured here /// live next to it, under SharedWorkspaces/<id>/. There is never a second /// value for the same thing: shared is governed only by the agent's level, every /// workspace here only by its member list. /// public sealed class WorkspaceConfig { /// The name agents use and the folder name; lower case, digits and dashes. [JsonPropertyName("id")] public string Id { get; set; } = ""; [JsonPropertyName("name")] public string Name { get; set; } = ""; /// What goes in here — shown to the members so they file things in the right place. [JsonPropertyName("purpose")] public string Purpose { get; set; } = ""; /// /// The unit the workspace belongs to — what is filed here is its property, and stays /// when an agent moves on. null: owned by the instance (the human). /// [JsonPropertyName("ownerUnitId")] public string? OwnerUnitId { get; set; } [JsonPropertyName("members")] public List Members { get; set; } = new(); /// /// Folders in which files can only be added, not changed or deleted — except by members /// with . Relative to the workspace. /// [JsonPropertyName("protectedPaths")] public List ProtectedPaths { get; set; } = new(); } /// /// #684: One entry on a workspace's member list — a unit or a single agent, with a level. /// A unit entry includes the units below it unless is off; /// a unit's own workspace is meant for the whole department. /// public sealed class WorkspaceMember { [JsonPropertyName("unitId")] public string? UnitId { get; set; } [JsonPropertyName("agentId")] public string? AgentId { get; set; } [JsonPropertyName("access")] public WorkspaceAccess Access { get; set; } = WorkspaceAccess.Read; [JsonPropertyName("includeSubUnits")] public bool IncludeSubUnits { get; set; } = true; } /// /// #684: What a member may do in a workspace. Each level includes the ones below it. /// Deleting and changing protected files needs — as the old /// Admin level did for the one shared folder. /// [JsonConverter(typeof(JsonStringEnumConverter))] public enum WorkspaceAccess { None = 0, Read = 1, Write = 2, Manage = 3 }