Make bot types an extension of the bot's kind

Coordinator and worker come from bots.kind; bot_types now only holds
workspace_admin (was admin), each row naming its workspace, with no scope
field. Rows from v0.2.8 and earlier are fixed at boot by migrateBotTypes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-26 06:05:18 +01:00
co-authored by Claude Opus 5.5
parent 657a76d868
commit 926bad6bea
29 changed files with 168 additions and 175 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ export default function findBotTool(): HarnessTool<Args> {
return matches
.map((bot) => {
const led = (types.get(Number(bot.id)) || [])
.filter((bt) => bt.bot_type == "admin" && bt.workspace_id)
.filter((bt) => bt.bot_type == "workspace_admin" && bt.workspace_id)
.map((bt) => workspaceRef({ id: Number(bt.workspace_id) }));
return `${botRef({ id: bot.id || 0 })} ${bot.name} (${bot.kind}${bot.role ? `: ${bot.role}` : ""})${led.length ? `, admin of ${led.join(", ")}` : ""}\n## Instructions:\n${bot.system_prompt}`;
+2 -2
View File
@@ -68,14 +68,14 @@ export default function setBotTypeTool({ user_id, bot_id, workers, workspaces, w
user_id,
actor_bot_id: bot_id,
bot_id: args.bot_id,
bot_type: "admin" as const,
bot_type: "workspace_admin" as const,
workspace_id: target_workspace_id,
};
const { bot, workspace } = args.admin ? await setBotType(change) : await removeBotType(change);
const saved = (await grabBotTypes({ bot_id: args.bot_id })).some(
(bt) => bt.bot_type == "admin" && bt.workspace_id == target_workspace_id,
(bt) => bt.bot_type == "workspace_admin" && bt.workspace_id == target_workspace_id,
);
if (saved != args.admin) {