Give the coordinator working crew management tools

- Resolve the crew and workspaces fresh inside each tool run, so a bot or
  workspace created earlier in the same reply is usable: create_bot,
  assign_computer, add_bot_to_workspace, delegate_task and
  set_bot_workspace_instructions.
- Add coordinator-only update_bot, find_bot, find_workspace, delete_bot,
  delete_workspace and remove_bot_from_workspace tools.
- Push server:workspace-removed when a workspace is deleted, and
  workspace_ids on server:bot-updated so a workspace's crew drops a bot
  that was taken out of it.
This commit is contained in:
2026-10-19 20:34:51 +01:00
parent b79cebf397
commit 139b3e443d
20 changed files with 648 additions and 39 deletions
@@ -1,7 +1,11 @@
import { useState } from "react";
import type { BUN_SQLITE_COBBLE_BOT_MESSAGES } from "@/db/types/db";
import useServerEvent from "@/src/hooks/use-server-event";
import type { WorkspaceCreatedData, WorkspaceWithActivity } from "@/src/types";
import type {
WorkspaceCreatedData,
WorkspaceRemovedData,
WorkspaceWithActivity,
} from "@/src/types";
type Params = {
workspaces: WorkspaceWithActivity[];
@@ -35,6 +39,12 @@ export default function useLiveWorkspaces({ workspaces, open_workspace_id }: Par
},
});
useServerEvent({
event: "server:workspace-removed",
onData: (data: WorkspaceRemovedData) =>
setLive((prev) => prev.filter((workspace) => workspace.id != data.workspace_id)),
});
useServerEvent({
event: "server:bot-message",
onData: (message: BUN_SQLITE_COBBLE_BOT_MESSAGES) => {