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:
@@ -63,13 +63,25 @@ export default function useLiveBots({ bots, open_bot_id, workspace_id = null }:
|
||||
useServerEvent({
|
||||
event: "server:bot-updated",
|
||||
onData: (data: BotUpdatedData) =>
|
||||
setLive((prev) =>
|
||||
prev.map((bot) =>
|
||||
setLive((prev) => {
|
||||
/**
|
||||
* A membership change says which workspaces the bot is in
|
||||
* now; a workspace's crew drops it when it left.
|
||||
*/
|
||||
if (
|
||||
workspace_id &&
|
||||
data.workspace_ids &&
|
||||
!data.workspace_ids.includes(Number(workspace_id))
|
||||
) {
|
||||
return prev.filter((bot) => bot.id != data.id);
|
||||
}
|
||||
|
||||
return prev.map((bot) =>
|
||||
bot.id == data.id
|
||||
? { ...bot, face: data.face, status_line: data.status_line }
|
||||
: bot,
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
});
|
||||
|
||||
useServerEvent({
|
||||
|
||||
Reference in New Issue
Block a user