Let the coordinator create workspaces and write findings in tasks

create_workspace gives the coordinator a way to start a workspace with its shared context, and the tool list is shared, so a new id can be used by create_bot or add_bot_to_workspace in the same reply.

A coordinator's tasks now get create_workspace and update_workspace too: the research task that had the material could only report it, never write it into the workspace, so the coordinator promised an update it had no turn to make.

A workspace created from chat is pushed as server:workspace-created, from the tool and from the live relay, so the rail shows it without a reload.
This commit is contained in:
2026-10-19 14:32:47 +01:00
parent 1cafb40eef
commit 550aaeabac
12 changed files with 268 additions and 16 deletions
+10 -6
View File
@@ -7,6 +7,7 @@ import searchComputersTool from "../computer/search-computers-tool";
import addBotToWorkspaceTool from "./add-bot-to-workspace-tool";
import assignComputerTool from "./assign-computer-tool";
import createBotTool from "./create-bot-tool";
import createWorkspaceTool from "./create-workspace-tool";
import delegateTaskTool from "./delegate-task-tool";
import grabBotTools from "./grab-bot-tools";
import updateWorkspaceTool from "./update-workspace-tool";
@@ -45,12 +46,13 @@ type Params = {
* in a workspace switching its default computer), start_task for longer
* work, search_computers to find what's on its computers,
* ask_user_to_take_over when only the user can do something on one, and
* for the coordinator (the super admin's alone) create_bot to grow the
* crew, delegate_task to every worker (the workspace's in a workspace)
* plus, in its own chat, add_bot_to_workspace and assign_computer (which
* workspace and which computers each crew member gets) or, in a
* workspace, set_bot_workspace_instructions. Anything else on a computer
* goes through a task, never mid-reply.
* for the coordinator (the super admin's alone) create_workspace and
* update_workspace (a workspace and its shared context), create_bot to
* grow the crew, delegate_task to every worker (the workspace's in a
* workspace) plus, in its own chat, add_bot_to_workspace and
* assign_computer (which workspace and which computers each crew member
* gets) or, in a workspace, set_bot_workspace_instructions. Anything else
* on a computer goes through a task, never mid-reply.
*/
export default async function grabBotChatTools({
bot,
@@ -83,6 +85,8 @@ export default async function grabBotChatTools({
const workspaces = (await grabUserWorkspaces({ user_id })).filter((w) => !w.archived);
tools.push(createWorkspaceTool({ user_id, workspaces }));
if (workspaces.length) {
tools.push(updateWorkspaceTool({ user_id, workspaces, workspace_id }));
}