Large World graph, agent platform, brain stack & dashboard rebuild
Frontend - Large World: collapse org/company/team tiers into one expandable React Flow hierarchy (WorldFlow) with per-click expand, persisted node positions, a compact tree sidebar, wrench multi-select delete across levels, and a sized right slide-out (phone/tablet/full) showing an agent summary + drill button. - Agent page: GitHub-style animated contribution grid (VitalsCard), collapsible System Prompt + Personality cards, restructured anatomy cards, bigger avatar with name/title header row, Markdown/JSON-aware rendering, brain registry + history, avatar generate/upload. - User-icon menu (Infrastructure/Brains/Tools/Profile/Credits) + ToolPanel; Master Planner deploy wizard (Specialists/Swarm/Scheduled/Triggered); Team Runs view; reap-progress modal; dashboard is the single live interface. Backend - cm-brain crate (.brain as the agent definition) + brain apply/history. - Hard-purge reap (FK-ordered) + sandbox release + SSE batch-delete. - Swarm self-verifying loop, mode-aware planner, web.search tool, webhooks (migration 0013), org/company/team delete endpoints, scheduler sweeps. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
9f266d5806
commit
34f744734b
@@ -112,6 +112,55 @@ pub async fn create_company(
|
||||
))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct PatchCompanyRequest {
|
||||
/// New TopologyKind (snake_case).
|
||||
pub kind: String,
|
||||
}
|
||||
|
||||
/// `PATCH /api/companies/{id}` — change a company's topology: rebuild the graph
|
||||
/// over its bound teams (stable node ids keep the node→team bindings) + persist.
|
||||
pub async fn patch_company(
|
||||
State(state): State<AppState>,
|
||||
Authed(user): Authed,
|
||||
Path(id): Path<Uuid>,
|
||||
Json(body): Json<PatchCompanyRequest>,
|
||||
) -> Result<StatusCode, ApiError> {
|
||||
let company = cm_db::repo::companies::get(&state.pool, id, user.workspace_id).await?;
|
||||
let kind = parse_kind(&body.kind)?;
|
||||
let bindings = cm_db::repo::companies::teams_for_company(&state.pool, company.id).await?;
|
||||
|
||||
let by_node: std::collections::HashMap<String, (Uuid, String)> = bindings
|
||||
.into_iter()
|
||||
.map(|b| (b.node_id, (b.team_id, b.role)))
|
||||
.collect();
|
||||
let n = by_node.len();
|
||||
let roles: Vec<String> = (0..n)
|
||||
.map(|i| by_node.get(&format!("n{i}")).map(|(_, r)| r.clone()).unwrap_or_else(|| "team".into()))
|
||||
.collect();
|
||||
let role_refs: Vec<&str> = roles.iter().map(String::as_str).collect();
|
||||
let mut graph = build(kind, &role_refs).map_err(|_| ApiError::BadRequest)?;
|
||||
for node in graph.nodes.iter_mut() {
|
||||
if let Some((tid, _)) = by_node.get(&node.id) {
|
||||
node.attrs.insert("team_id".into(), tid.to_string());
|
||||
node.attrs.insert("agent".into(), tid.to_string());
|
||||
}
|
||||
}
|
||||
let graph_json = serde_json::to_value(&graph).map_err(|_| ApiError::Internal)?;
|
||||
cm_db::repo::companies::set_topology(&state.pool, company.id, user.workspace_id, kind.as_str(), &graph_json).await?;
|
||||
Ok(StatusCode::NO_CONTENT)
|
||||
}
|
||||
|
||||
/// `DELETE /api/companies/{id}` — remove a company (its teams remain).
|
||||
pub async fn delete_company(
|
||||
State(state): State<AppState>,
|
||||
Authed(user): Authed,
|
||||
Path(id): Path<Uuid>,
|
||||
) -> Result<StatusCode, ApiError> {
|
||||
cm_db::repo::companies::delete_company(&state.pool, id, user.workspace_id).await?;
|
||||
Ok(StatusCode::NO_CONTENT)
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct CompanySummaryOut {
|
||||
pub id: String,
|
||||
|
||||
Reference in New Issue
Block a user