A bot's powers came from bots.kind alone, so only the coordinator could hand work to other bots. bot_types now works like user_types: a row with no workspace holds everywhere (the coordinator), one with a workspace only there (a workspace admin), and no row is a worker. bots.kind stays the legacy marker of the one coordinator for who sees it. The matrices in src/dict/bot-types-dict.ts say what each type may do, whom it may direct and who grants it, read by one generic interpreter (rbac/type-assignment.ts) that userTypeAssignment now wraps too. Every run reads its powers once (grabBotRunPowers) and the chat tools, task runs and task tools gate on them instead of kind; a run's powers are its type's and its user's together. In the workspace it leads, an admin hands tasks to the workers there (results relayed back to it), sets their instructions, adds tasks to their lists and keeps the workspace's context when its user may. Super admins and admins grant it from the workspace's settings or the chat header's menu, and the coordinator with set_bot_type. Admins are marked with a filled green shield beside their name across the workspace, kept live by pushBotUpdated's admin_workspace_ids. Co-Authored-By: Claude Opus 5.5 <[email protected]>
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { ShieldCheck } from "lucide-react";
|
|
import { twMerge } from "tailwind-merge";
|
|
|
|
type Props = {
|
|
/**
|
|
* Its size in pixels; 14 sits beside a 14px name.
|
|
*/
|
|
size?: number;
|
|
/**
|
|
* The tooltip and accessible name.
|
|
*/
|
|
label?: string;
|
|
className?: string;
|
|
};
|
|
|
|
/**
|
|
* The mark of a workspace's admin bot: a filled success-green shield with
|
|
* its check cut out in the background's colour, set beside the bot's name
|
|
* (never on its stone, which takes no badges). A role, not a status, and
|
|
* never the bot's own colour.
|
|
*/
|
|
export default function AdminShield({
|
|
size = 17,
|
|
label = "Workspace admin",
|
|
className,
|
|
}: Props) {
|
|
return (
|
|
<ShieldCheck
|
|
size={size}
|
|
role="img"
|
|
aria-label={label}
|
|
className={twMerge(
|
|
"shrink-0 inline-block align-middle",
|
|
"fill-success text-on-ink dark:fill-success-dark",
|
|
className,
|
|
)}
|
|
>
|
|
<title>{label}</title>
|
|
</ShieldCheck>
|
|
);
|
|
}
|