Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ as members with permissions.
This is the desktop app. It works on its own computer today; the plan for
everything after that is the design doc.

## What works (0.21.0)
## What works (0.22.0)

- A workspaces home: create workspaces, open them.
- Inside a workspace: channels, with the top third of each channel kept for
Expand All @@ -29,7 +29,7 @@ everything after that is the design doc.
anything else.
2. **Channels:** a switch per channel it can work in, saved as you flip
it (the one you're in starts on). Agents see nothing else; finer
access is in a channel's **Access** button: *can read*, or *can read
access, and the org and team rules, are in a channel's **Access** button: *can read*, or *can read
and change*.
3. **Done:** "Now write @intake in #student-intake and you're set."

Expand Down Expand Up @@ -124,6 +124,20 @@ everything after that is the design doc.
grants what an add-on asks to touch (Markdown: files matching `*.md`;
off, it edits nothing) and shows which agents may use its tools. An
agent's settings are a page in Settings, opened from the sidebar too.
- **Orgs.** Every workspace belongs to an org: Settings › *workspace* ›
**Org** shows it as an outline of seats. A seat has a title, reports to
one other seat, and is held by you, an agent, or nobody yet (open). The
top seat leads it (you, as CEO, to start), and it goes at most five
levels deep. A seat and everyone under it is a *team*; moving a seat
moves its team. A channel's **Access** opens it to any of: everyone in
the org (new channels start that way), whole teams, and named members,
then lists who that comes to and why, with *can read* or *can read and
change* for each. An agent without a seat gets in only by name. Each
change is a commit in the channel's history. An agent's **Profile**
shows where it sits, up to the top, and its reports as @mentions that
open their profiles. Removing an agent leaves its seat open. Seats are
the groundwork for more people: someone who joins takes a seat, and the
team and channels under it are already theirs.
- **Export.** *Export workspace* in the sidebar writes a folder to
Documents/gild exports: each channel's chat as markdown and JSON lines, its
table as CSV and JSON, its docs as markdown, its full history as a git repository you can clone,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gild-desktop",
"private": true,
"version": "0.21.0",
"version": "0.22.0",
"license": "Apache-2.0",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gild-desktop"
version = "0.21.0"
version = "0.22.0"
description = "gild: the open workspace where people and agents work together"
license = "Apache-2.0"
repository = "https://github.com/gildworkspaces/desktop"
Expand Down
96 changes: 95 additions & 1 deletion src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::collections::BTreeMap;

use clients::{ClientStatus, Clients, KINDS};
use records::{Access, Change, Doc, Record};
use store::{Agent, AgentAccess, AgentInfo, AuditEntry, Channel, ChannelData, ChannelDocs, ChannelView, LoopRules, Message, Profile, Store, Workspace, Working};
use store::{Agent, AgentAccess, AgentInfo, AuditEntry, Channel, ChannelData, ChannelDocs, ChannelView, Holder, LoopRules, Message, Org, Profile, Store, Workspace, Working};
use tauri::{Manager, State};

/// The one store, opened when the app starts.
Expand Down Expand Up @@ -455,6 +455,90 @@ fn set_access(core: State<Core>, channel_id: String, agent_id: String, access: O
})
}

/// Open a channel to its org, to teams in it, or neither.
#[tauri::command]
fn set_channel_rules(core: State<Core>, channel_id: String, org: bool, teams: Vec<String>) -> Result<Vec<AgentAccess>, String> {
with(&core, |s| {
s.set_rules(&channel_id, &s.me()?, org, &teams)?;
s.channel_access(&channel_id)
})
}

/// Read or change for an agent that's in a channel, however it's in.
#[tauri::command]
fn set_level(core: State<Core>, channel_id: String, agent_id: String, access: Access) -> Result<Vec<AgentAccess>, String> {
with(&core, |s| {
s.set_level(&channel_id, &s.me()?, &agent_id, access)?;
s.channel_access(&channel_id)
})
}

/// The channel's org and team rules, as its history has them.
#[tauri::command]
fn channel_rules(core: State<Core>, channel_id: String) -> Result<ChannelRules, String> {
with(&core, |s| {
let acl = s.current_acl(&channel_id)?;
Ok(ChannelRules { org: acl.org, teams: acl.teams })
})
}

#[derive(Serialize)]
struct ChannelRules {
org: bool,
teams: Vec<String>,
}

#[tauri::command]
fn orgs(core: State<Core>) -> Result<Vec<Org>, String> {
with(&core, |s| s.orgs())
}

#[tauri::command]
fn rename_org(core: State<Core>, org_id: String, name: String) -> Result<Vec<Org>, String> {
with(&core, |s| {
s.rename_org(&org_id, &name)?;
s.orgs()
})
}

#[tauri::command]
fn add_seat(core: State<Core>, parent_id: String, title: String) -> Result<Vec<Org>, String> {
with(&core, |s| {
s.add_seat(&parent_id, &title)?;
s.orgs()
})
}

#[tauri::command]
fn set_seat(core: State<Core>, seat_id: String, title: String, holder: Option<Holder>) -> Result<Vec<Org>, String> {
with(&core, |s| {
s.set_seat(&seat_id, &title, holder)?;
s.orgs()
})
}

#[tauri::command]
fn move_seat(core: State<Core>, seat_id: String, parent_id: String) -> Result<Vec<Org>, String> {
with(&core, |s| {
s.move_seat(&seat_id, &parent_id)?;
s.orgs()
})
}

#[tauri::command]
fn remove_seat(core: State<Core>, seat_id: String) -> Result<Vec<Org>, String> {
with(&core, |s| {
s.remove_seat(&seat_id)?;
s.orgs()
})
}

/// You, as the holder of seats.
#[tauri::command]
fn me_id(core: State<Core>) -> Result<String, String> {
with(&core, |s| s.me_id())
}

#[tauri::command]
fn activity(core: State<Core>, channel_id: String) -> Result<Vec<AuditEntry>, String> {
with(&core, |s| s.activity(&channel_id))
Expand Down Expand Up @@ -570,6 +654,16 @@ pub fn run() {
connect_agent,
remove_agent,
channel_access,
set_channel_rules,
set_level,
channel_rules,
orgs,
rename_org,
add_seat,
set_seat,
move_seat,
remove_seat,
me_id,
set_access,
activity,
mcp_status,
Expand Down
14 changes: 13 additions & 1 deletion src-tauri/src/records.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
//!
//! In the repository:
//! .gild/acl.json who besides the workspace's people may use
//! this channel: agent id → "read" | "write"
//! this channel: agent id → "read" | "write",
//! and the org and teams it's open to
//! .gild/view.json the channel's view: columns and statuses
//! .gild/records/<id>.json one file per record, so two writers never
//! touch the same file for different records
Expand Down Expand Up @@ -36,9 +37,20 @@ pub enum Access {
Write,
}

/// Who may be in a channel: named agents, and, through the workspace's org,
/// everyone in it (`org`) or whole teams (`teams`: a seat and every seat
/// under it). `levels` sets read or change for a member who is in through
/// the org or a team (change when unset). Fields left at their default
/// aren't written, so a channel with only named agents keeps the file it had.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct Acl {
pub agents: std::collections::BTreeMap<String, Access>,
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub org: bool,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub teams: Vec<String>,
#[serde(default, skip_serializing_if = "std::collections::BTreeMap::is_empty")]
pub levels: std::collections::BTreeMap<String, Access>,
}
pub const RECORDS_DIR: &str = ".gild/records";

Expand Down
Loading
Loading