Let the coordinator and workspace admins hand over tasks and routines

delegate_task takes a task_id to hand over a task already on a list: it
moves to the worker (a workspace's task stays on its list), goes to
doing, and the job is linked back so its end is noted on the task.
hand_over_schedule moves a bot's own routine to another bot, keeping its
workspace. Users get Hand over in the Tasks UI and both routine lists.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-25 11:23:26 +01:00
co-authored by Claude Opus 5.5
parent b4283b607e
commit 93896646c7
36 changed files with 1334 additions and 94 deletions
@@ -6,6 +6,7 @@ import grabUserWorkspace from "@/src/functions/backend/db/workspaces/grab-user-w
import type { StorageScope } from "@/src/utils/storage-access";
import type { HarnessTool } from "../../types";
import delegateTaskTool from "./delegate-task-tool";
import handOverScheduleTool from "./hand-over-schedule-tool";
import setWorkspaceInstructionsTool from "./set-workspace-instructions-tool";
import updateWorkspaceTool from "./update-workspace-tool";
@@ -33,8 +34,8 @@ export type WorkspaceAdminTools = {
/**
* The tools a workspace admin leads its workspace with, each only while
* its types allow it there (`BotRunPowers.can`): delegate_task and
* set_bot_workspace_instructions for the members it may direct
* its types allow it there (`BotRunPowers.can`): delegate_task (with
* hand_over_schedule beside it) and set_bot_workspace_instructions for the members it may direct
* (`grabDirectableBots`), and update_workspace for this workspace alone,
* only when the user the run works for may change it too (a crew manager).
*/
@@ -67,6 +68,15 @@ export default async function grabWorkspaceAdminTools({
requester_name: bot.name || "The workspace's admin",
workers: members,
grabTargets,
admin_workspace_ids: powers.admin_workspace_ids,
}),
handOverScheduleTool({
user_id,
bot_id,
workspace_id,
requester_name: bot.name || "The workspace's admin",
workers: members,
grabTargets,
}),
);
}