import "./AgentProvisioningPolicyEditor.css"; import { AGENT_PROVISIONING_APPROVAL_MODES, type AgentProvisioningApprovalMode, type ProjectSettings, } from "@fusion/core"; interface Props { value: ProjectSettings["agentProvisioning"] | undefined; onChange(next: ProjectSettings["agentProvisioning"] | undefined): void; disabled?: boolean; } const MODE_LABELS: Record = { always: { label: "Always require approval", description: "All fn_agent_create/fn_agent_delete requests require approval unless caller is trusted.", }, "trusted-only": { label: "Trusted-only", description: "Trusted roles/agent IDs bypass approval; other callers require approval.", }, never: { label: "Never require approval", description: "Allow provisioning without approval for non-privileged callers.", }, }; function tokenizeList(value: string): string[] { return Array.from( new Set( value .split(/[\n,]+/) .map((entry) => entry.trim()) .filter((entry) => entry.length > 0), ), ); } export function AgentProvisioningPolicyEditor({ value, onChange, disabled = false }: Props) { const approvalMode = value?.approvalMode ?? "trusted-only"; const alwaysApproveDelete = value?.alwaysApproveDelete ?? true; const update = (patch: Partial>) => { onChange({ ...(value ?? {}), ...patch }); }; return (
{MODE_LABELS[approvalMode].description}