⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
improvement: rework the agent create and edit form (#171)
Croff308b046236f5
diff --git a/apps/api/src/modules/agents/core/__tests__/unit/tools.test.ts b/apps/api/src/modules/agents/core/__tests__/unit/tools.test.tsindex 21b75cce..449afe3c 100644--- a/apps/api/src/modules/agents/core/__tests__/unit/tools.test.ts+++ b/apps/api/src/modules/agents/core/__tests__/unit/tools.test.ts@@ -42,6 +42,13 @@ describe('normalizeToolKeys', () => {expect(normalizeToolKeys(all)).toEqual(all);});+ it('puts every action in a known feature group (the config UI groups by it)', () => {+ const groups = new Set(['issues', 'initiatives', 'cycles', 'notes', 'project']);+ for (const tool of [...AGENT_ACTIONS, ...ALWAYS_ON_ACTIONS]) {+ expect(groups.has(tool.group)).toBe(true);+ }+ });+it('registers initiative actions and read tools', () => {expect(AGENT_ACTIONS.map((tool) => tool.key)).toEqual(expect.arrayContaining(['create_initiative', 'update_initiative', 'delete_initiative']),diff --git a/apps/api/src/modules/agents/core/runtime/tools/catalog.ts b/apps/api/src/modules/agents/core/runtime/tools/catalog.tsindex 7246e4d5..59d9cc4d 100644--- a/apps/api/src/modules/agents/core/runtime/tools/catalog.ts+++ b/apps/api/src/modules/agents/core/runtime/tools/catalog.ts@@ -16,8 +16,12 @@// ToolMeta.overrides). An agent's effective rights are the intersection of these keys// and its project role.+// The feature an action belongs to, so the config UI can group the catalog.+export type ToolGroup = 'issues' | 'initiatives' | 'cycles' | 'notes' | 'project';+export interface ToolMeta {key: string;+ group: ToolGroup;label: string;// Shown in the config UI next to the label.description: string;@@ -38,12 +42,14 @@ const CARD_LAYOUT =export const AGENT_ACTIONS: ToolMeta[] = [{key: 'create_issue',+ group: 'issues',label: 'Create issues',description: 'Create new work items in the project.',always: false,},{key: 'update_issue',+ group: 'issues',label: 'Update issues',description:"Change an issue's state, type, initiative, cycle, assignee, delegate, details, priority, dates, or labels.",@@ -51,90 +57,105 @@ export const AGENT_ACTIONS: ToolMeta[] = [},{key: 'delete_issue',+ group: 'issues',label: 'Delete issues',description: 'Permanently delete issues and everything attached to them.',always: false,},{key: 'add_comment',+ group: 'issues',label: 'Comment on issues',description: 'Post comments on issues as this agent.',always: false,},{key: 'set_issue_field_value',+ group: 'issues',label: 'Set custom field values',description: 'Set custom field values on an issue.',always: false,},{key: 'link_issues',+ group: 'issues',label: 'Link issues',description: 'Mark an issue as blocking, blocked by, duplicating, or related to another one.',always: false,},{key: 'unlink_issues',+ group: 'issues',label: 'Unlink issues',description: 'Remove a relation between two issues.',always: false,},{key: 'add_attachment',+ group: 'issues',label: 'Add attachments',description: 'Attach a file to an issue from a URL or inline content.',always: false,},{key: 'delete_attachment',+ group: 'issues',label: 'Delete attachments',description: 'Delete file attachments from issues.',always: false,},{key: 'create_initiative',+ group: 'initiatives',label: 'Create initiatives',description: 'Create initiatives in the project.',always: false,},{key: 'update_initiative',+ group: 'initiatives',label: 'Update initiatives',description: 'Change initiative details, status, owner, dates, and labels.',always: false,},{key: 'delete_initiative',+ group: 'initiatives',label: 'Delete initiatives',description: 'Permanently delete initiatives.',always: false,},{key: 'create_cycle',+ group: 'cycles',label: 'Create cycles',description: 'Create cycles in the project.',always: false,},{key: 'update_cycle',+ group: 'cycles',label: 'Update cycles',description: 'Change a cycle’s name, description, and dates.',always: false,},{key: 'delete_cycle',+ group: 'cycles',label: 'Delete cycles',description: 'Permanently delete cycles. Their issues stay, without a cycle.',always: false,},{key: 'transfer_cycle_issues',+ group: 'cycles',label: 'Transfer cycle issues',description: "Move a cycle's unfinished issues to another cycle, or off any cycle.",always: false,},{key: 'list_note_boards',+ group: 'notes',label: 'List note boards',description: 'List and search the note boards the agent can see.',always: false,@@ -145,6 +166,7 @@ export const AGENT_ACTIONS: ToolMeta[] = [},{key: 'get_note_board',+ group: 'notes',label: 'Read a note board',description: 'View one board with all of its notes and the connections between them.',always: false,@@ -155,6 +177,7 @@ export const AGENT_ACTIONS: ToolMeta[] = [// person in the project.{key: 'create_note_board',+ group: 'notes',label: 'Create note boards',description: 'Create a note board with an optional set of notes.',always: false,@@ -167,6 +190,7 @@ export const AGENT_ACTIONS: ToolMeta[] = [},{key: 'update_note_board',+ group: 'notes',label: 'Update note boards',description: 'Rename a board and add, edit, or remove its notes.',always: false,@@ -179,6 +203,7 @@ export const AGENT_ACTIONS: ToolMeta[] = [},{key: 'delete_note_board',+ group: 'notes',label: 'Delete note boards',description: 'Permanently delete note boards and all of their notes.',always: false,@@ -191,60 +216,70 @@ export const AGENT_ACTIONS: ToolMeta[] = [export const ALWAYS_ON_ACTIONS: ToolMeta[] = [{key: 'get_current_date',+ group: 'project',label: 'Read the current date',description: 'Get the current date and time to resolve relative dates like today or next week.',always: true,},{key: 'get_project',+ group: 'project',label: 'Read project setup',description: 'View workflow states, issue types, labels, custom fields, and assignees.',always: true,},{key: 'search_issues',+ group: 'issues',label: 'Search issues',description: 'Find issues by a text query (title, description, number, custom fields).',always: true,},{key: 'list_issues',+ group: 'issues',label: 'List issues by filters',description: 'List issues filtered by state, type, assignee, priority, label, or due date.',always: true,},{key: 'get_issue',+ group: 'issues',label: 'Read an issue',description: 'View one issue in full, including its custom field values.',always: true,},{key: 'list_attachments',+ group: 'issues',label: 'List attachments',description: 'View the file attachment metadata on an issue.',always: true,},{key: 'list_initiatives',+ group: 'initiatives',label: 'List initiatives',description: 'View initiatives in the project.',always: true,},{key: 'get_initiative',+ group: 'initiatives',label: 'Read an initiative',description: 'View one initiative with its progress and health.',always: true,},{key: 'list_cycles',+ group: 'cycles',label: 'List cycles',description: 'View the cycles of the project with their progress.',always: true,},{key: 'get_cycle',+ group: 'cycles',label: 'Read a cycle',description: 'View one cycle with its dates and progress.',always: true,diff --git a/apps/api/src/modules/agents/tools/model.ts b/apps/api/src/modules/agents/tools/model.tsindex 5e98eb87..725a10f0 100644--- a/apps/api/src/modules/agents/tools/model.ts+++ b/apps/api/src/modules/agents/tools/model.ts@@ -9,6 +9,7 @@ export const toolParams = t.Object({ projectKey: t.String(), agentToolId: t.Nume// toggled off.const ToolMetaResponse = t.Object({key: t.String(),+ group: t.String(),label: t.String(),description: t.String(),always: t.Boolean(),diff --git a/apps/web/messages/ar/settings.json b/apps/web/messages/ar/settings.jsonindex 90878c2d..bdfa3884 100644--- a/apps/web/messages/ar/settings.json+++ b/apps/web/messages/ar/settings.json@@ -124,15 +124,18 @@"chooseRole": "اختيار دور","roleHintExternal": "طلبات API بتاعة الوكيل مش هتعدّي اللي الدور ده بيسمح بيه.","model": "النموذج",- "modelHint": "المزوّد والنموذج وموجّه النظام",+ "modelHint": "المزوّد والنموذج","credential": "بيانات الاعتماد","chooseCredential": "اختيار بيانات اعتماد",- "noCredential": "أضف مفتاح مزوّد ذكاء اصطناعي أولًا",- "noCredentialHint": "الوكيل محتاج مفتاح مزوّد عشان تقدر تختار نموذج.",- "addKey": "أضف مفتاحًا من صفحة التكاملات",+ "searchCredential": "ابحث في بيانات الاعتماد",+ "noCredentialsFound": "لا توجد بيانات اعتماد.",+ "noCredential": "لا يوجد مزوّد ذكاء اصطناعي متصل",+ "noCredentialHint": "أضف مفتاح مزوّد عشان تختار نموذجًا لهذا الوكيل.",+ "addKey": "الانتقال إلى التكاملات","chooseModel": "اختيار نموذج","searchModel": "ابحث أو اكتب معرّف نموذج","loadingModels": "جارٍ تحميل النماذج…",+ "noModels": "لا توجد نماذج.","noModel": "لم يُحدَّد نموذج","instructions": "التعليمات","instructionsPlaceholder": "الوكيل يتصرّف إزاي وأي قواعد يمشي عليها",@@ -180,17 +183,30 @@"runnerSeen": "آخر ظهور من {time}","actions": "الإجراءات","actionsHint": "اللي الوكيل يقدر يعمله في المشروع",+ "searchActions": "بحث في الإجراءات",+ "actionGroup": {+ "issues": "المهام",+ "initiatives": "المبادرات",+ "cycles": "الدورات",+ "notes": "لوحات الملاحظات",+ "project": "المشروع"+ },+ "loadingActions": "جارٍ تحميل الإجراءات…","noActions": "لا توجد إجراءات متاحة.","clearAll": "مسح الكل","selectAll": "تحديد الكل","skills": "المهارات (skills)","skillsHint": "تعليمات جاهزة الوكيل يقدر يحمّلها ويستخدمها",- "noSkills": "مفيش مهارات في المكتبة لسه. ضيف واحدة من صفحة المهارات.",+ "noSkills": "لا توجد مهارات بعد",+ "noSkillsHint": "أضف مهارة إلى المكتبة، ثم فعّلها هنا.",+ "goToSkills": "الانتقال إلى المهارات","searchSkills": "بحث في المهارات","noDescription": "لا يوجد وصف","tools": "الأدوات (tools)","toolsHint": "تكاملات خارجية الوكيل يقدر يناديها",- "noTools": "مفيش أدوات متظبطة لسه. ضيف واحدة من صفحة الأدوات.",+ "noTools": "لا توجد أدوات مُعدّة",+ "noToolsHint": "أعدّ أداة، ثم فعّلها هنا.",+ "goToTools": "الانتقال إلى الأدوات","searchTools": "بحث في الأدوات","advanced": "متقدم","advancedHint": "المعاينة وحد الخطوات والذاكرة",diff --git a/apps/web/messages/en/settings.json b/apps/web/messages/en/settings.jsonindex cc1094ae..05be2f67 100644--- a/apps/web/messages/en/settings.json+++ b/apps/web/messages/en/settings.json@@ -124,15 +124,18 @@"chooseRole": "Choose a role","roleHintExternal": "Caps what the agent may do.","model": "Model",- "modelHint": "Provider, model, and system prompt",+ "modelHint": "Provider and model","credential": "Credential","chooseCredential": "Choose a credential",- "noCredential": "Add an AI provider key first",- "noCredentialHint": "The agent needs a provider key to pick a model.",- "addKey": "Add a key on Integrations",+ "searchCredential": "Search credentials",+ "noCredentialsFound": "No credentials found.",+ "noCredential": "No AI provider connected",+ "noCredentialHint": "Connect a provider key to pick a model for this agent.",+ "addKey": "Go to Integrations","chooseModel": "Choose a model","searchModel": "Search or type a model id","loadingModels": "Loading models…",+ "noModels": "No models found.","noModel": "No model set","instructions": "Instructions","instructionsPlaceholder": "How the agent should behave and any rules to follow",@@ -180,17 +183,30 @@"runnerSeen": "Last seen {time} ago","actions": "Actions","actionsHint": "What the agent can do in the project",+ "searchActions": "Search actions",+ "actionGroup": {+ "issues": "Issues",+ "initiatives": "Initiatives",+ "cycles": "Cycles",+ "notes": "Note boards",+ "project": "Project"+ },+ "loadingActions": "Loading actions…","noActions": "No actions available.","clearAll": "Clear all","selectAll": "Select all","skills": "Skills","skillsHint": "Reusable instructions the agent can load",- "noSkills": "No skills in the library yet. Add one on the Skills page.",+ "noSkills": "No skills yet",+ "noSkillsHint": "Add a skill to the library, then enable it here.",+ "goToSkills": "Go to Skills","searchSkills": "Search skills","noDescription": "No description","tools": "Tools","toolsHint": "External integrations the agent can call",- "noTools": "No tools configured yet. Add one on the Tools page.",+ "noTools": "No tools configured",+ "noToolsHint": "Configure a tool, then enable it here.",+ "goToTools": "Go to Tools","searchTools": "Search tools","advanced": "Advanced","advancedHint": "Sampling, step limit, and memory",diff --git a/apps/web/messages/ru/settings.json b/apps/web/messages/ru/settings.jsonindex 869c3cd9..d45d4d6b 100644--- a/apps/web/messages/ru/settings.json+++ b/apps/web/messages/ru/settings.json@@ -124,15 +124,18 @@"chooseRole": "Выберите роль","roleHintExternal": "Ограничивает, что агент может делать.","model": "Модель",- "modelHint": "Провайдер, модель и системный промпт",+ "modelHint": "Провайдер и модель","credential": "Учётные данные","chooseCredential": "Выберите учётные данные",- "noCredential": "Сначала добавьте ключ AI-провайдера",- "noCredentialHint": "Чтобы выбрать модель, агенту нужен ключ провайдера.",- "addKey": "Добавить ключ в разделе «Интеграции»",+ "searchCredential": "Поиск учётных данных",+ "noCredentialsFound": "Учётные данные не найдены.",+ "noCredential": "AI-провайдер не подключён",+ "noCredentialHint": "Добавьте ключ провайдера, чтобы выбрать модель для агента.",+ "addKey": "Перейти в «Интеграции»","chooseModel": "Выберите модель","searchModel": "Найдите или введите id модели","loadingModels": "Загрузка моделей…",+ "noModels": "Модели не найдены.","noModel": "Модель не задана","instructions": "Инструкции","instructionsPlaceholder": "Как агент должен себя вести и каким правилам следовать",@@ -180,17 +183,30 @@"runnerSeen": "Был на связи {time} назад","actions": "Действия","actionsHint": "Что агент может делать в проекте",+ "searchActions": "Поиск действий",+ "actionGroup": {+ "issues": "Задачи",+ "initiatives": "Инициативы",+ "cycles": "Циклы",+ "notes": "Доски заметок",+ "project": "Проект"+ },+ "loadingActions": "Загрузка действий…","noActions": "Доступных действий нет.","clearAll": "Снять всё","selectAll": "Выбрать всё","skills": "Навыки","skillsHint": "Многоразовые инструкции, которые агент может загрузить",- "noSkills": "В библиотеке пока нет навыков. Добавьте на странице «Навыки».",+ "noSkills": "Навыков пока нет",+ "noSkillsHint": "Добавьте навык в библиотеку, затем включите его здесь.",+ "goToSkills": "Перейти к «Навыкам»","searchSkills": "Поиск навыков","noDescription": "Без описания","tools": "Инструменты","toolsHint": "Внешние интеграции, которые агент может вызывать",- "noTools": "Инструменты пока не настроены. Добавьте на странице «Инструменты».",+ "noTools": "Инструменты не настроены",+ "noToolsHint": "Настройте инструмент, затем включите его здесь.",+ "goToTools": "Перейти к «Инструментам»","searchTools": "Поиск инструментов","advanced": "Дополнительно","advancedHint": "Сэмплирование, лимит шагов и память",diff --git a/apps/web/messages/uk/settings.json b/apps/web/messages/uk/settings.jsonindex d3aad183..daaf3bef 100644--- a/apps/web/messages/uk/settings.json+++ b/apps/web/messages/uk/settings.json@@ -124,15 +124,18 @@"chooseRole": "Виберіть роль","roleHintExternal": "Обмежує те, що агент може робити.","model": "Модель",- "modelHint": "Провайдер, модель і системний промпт",+ "modelHint": "Провайдер і модель","credential": "Облікові дані","chooseCredential": "Виберіть облікові дані",- "noCredential": "Спочатку додайте ключ AI-провайдера",- "noCredentialHint": "Щоб вибрати модель, агенту потрібен ключ провайдера.",- "addKey": "Додати ключ в Інтеграціях",+ "searchCredential": "Пошук облікових даних",+ "noCredentialsFound": "Облікових даних не знайдено.",+ "noCredential": "AI-провайдера не підключено",+ "noCredentialHint": "Додайте ключ провайдера, щоб вибрати модель для агента.",+ "addKey": "Перейти до «Інтеграцій»","chooseModel": "Виберіть модель","searchModel": "Пошук або введіть id моделі","loadingModels": "Завантаження моделей…",+ "noModels": "Моделей не знайдено.","noModel": "Модель не задано","instructions": "Інструкції","instructionsPlaceholder": "Як має поводитися агент і яких правил дотримуватися",@@ -180,17 +183,30 @@"runnerSeen": "Востаннє на зв'язку {time} тому","actions": "Дії","actionsHint": "Що агент може робити в проєкті",+ "searchActions": "Пошук дій",+ "actionGroup": {+ "issues": "Задачі",+ "initiatives": "Ініціативи",+ "cycles": "Цикли",+ "notes": "Дошки нотаток",+ "project": "Проєкт"+ },+ "loadingActions": "Завантаження дій…","noActions": "Дій немає.","clearAll": "Зняти все","selectAll": "Вибрати все","skills": "Навички","skillsHint": "Багаторазові інструкції, які агент може завантажити",- "noSkills": "У бібліотеці ще немає навичок. Додайте на сторінці «Навички».",+ "noSkills": "Навичок ще немає",+ "noSkillsHint": "Додайте навичку до бібліотеки, потім увімкніть її тут.",+ "goToSkills": "Перейти до «Навичок»","searchSkills": "Пошук навичок","noDescription": "Без опису","tools": "Інструменти","toolsHint": "Зовнішні інтеграції, які агент може викликати",- "noTools": "Інструментів ще не налаштовано. Додайте на сторінці «Інструменти».",+ "noTools": "Інструменти не налаштовані",+ "noToolsHint": "Налаштуйте інструмент, потім увімкніть його тут.",+ "goToTools": "Перейти до «Інструментів»","searchTools": "Пошук інструментів","advanced": "Додатково","advancedHint": "Семплінг, ліміт кроків і пам'ять",diff --git a/apps/web/messages/zh-CN/settings.json b/apps/web/messages/zh-CN/settings.jsonindex 326047ac..2c8f24cf 100644--- a/apps/web/messages/zh-CN/settings.json+++ b/apps/web/messages/zh-CN/settings.json@@ -124,15 +124,18 @@"chooseRole": "选择角色","roleHintExternal": "限制代理可以做什么。","model": "模型",- "modelHint": "提供商、模型和系统提示词",+ "modelHint": "提供商和模型","credential": "凭据","chooseCredential": "选择凭据",- "noCredential": "请先添加 AI 提供商密钥",- "noCredentialHint": "代理需要提供商密钥才能选择模型。",- "addKey": "在集成页面添加密钥",+ "searchCredential": "搜索凭据",+ "noCredentialsFound": "未找到凭据。",+ "noCredential": "尚未连接 AI 提供商",+ "noCredentialHint": "添加提供商密钥后即可为该代理选择模型。",+ "addKey": "前往集成页面","chooseModel": "选择模型","searchModel": "搜索或输入模型 ID","loadingModels": "正在加载模型…",+ "noModels": "未找到模型。","noModel": "未设置模型","instructions": "指令","instructionsPlaceholder": "代理的行为方式和需要遵守的规则",@@ -180,17 +183,30 @@"runnerSeen": "{time} 前在线","actions": "操作","actionsHint": "代理在项目中可以执行的操作",+ "searchActions": "搜索操作",+ "actionGroup": {+ "issues": "任务",+ "initiatives": "举措",+ "cycles": "周期",+ "notes": "便签板",+ "project": "项目"+ },+ "loadingActions": "正在加载操作…","noActions": "暂无可用操作。","clearAll": "全部清除","selectAll": "全选","skills": "技能","skillsHint": "代理可以加载的可复用指令",- "noSkills": "技能库中暂无技能,请先在技能页面添加。",+ "noSkills": "尚无技能",+ "noSkillsHint": "先在库中添加技能,然后在这里启用。",+ "goToSkills": "前往技能页面","searchSkills": "搜索技能","noDescription": "无描述","tools": "工具","toolsHint": "代理可以调用的外部集成",- "noTools": "暂无已配置工具,请先在工具页面添加。",+ "noTools": "尚未配置工具",+ "noToolsHint": "先配置工具,然后在这里启用。",+ "goToTools": "前往工具页面","searchTools": "搜索工具","advanced": "高级设置","advancedHint": "采样、步骤上限和记忆",diff --git a/apps/web/src/features/settings/components/ai-agents/AgentActionRow.tsx b/apps/web/src/features/settings/components/ai-agents/AgentActionRow.tsxnew file mode 100644index 00000000..d36bbd15--- /dev/null+++ b/apps/web/src/features/settings/components/ai-agents/AgentActionRow.tsx@@ -0,0 +1,50 @@+import type { AgentTool } from '@/lib/api';+import { Checkbox } from '@/components/ui/checkbox';+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';+import { useTranslations } from 'next-intl';++// One action in the Actions checklist. A read-only action is shown checked and+// disabled, with a tooltip saying why it cannot be turned off.+export function AgentActionRow({+ tool,+ checked,+ onToggle,+}: {+ tool: AgentTool;+ checked: boolean;+ onToggle: (on: boolean) => void;+}) {+ const t = useTranslations('settings.agents');++ const body = (+ <span>+ <span className="text-sm">{tool.label}</span>+ <span className="block text-xs text-muted-foreground">{tool.description}</span>+ </span>+ );++ if (tool.always) {+ return (+ <Tooltip>+ <TooltipTrigger asChild>+ <div className="flex items-start gap-2 opacity-70">+ <Checkbox className="mt-0.5" checked disabled />+ {body}+ </div>+ </TooltipTrigger>+ <TooltipContent>{t('readOnlyAlwaysOn')}</TooltipContent>+ </Tooltip>+ );+ }++ return (+ <label className="flex cursor-pointer items-start gap-2">+ <Checkbox+ className="mt-0.5"+ checked={checked}+ onCheckedChange={(v) => onToggle(v === true)}+ />+ {body}+ </label>+ );+}diff --git a/apps/web/src/features/settings/components/ai-agents/AgentActionsSection.tsx b/apps/web/src/features/settings/components/ai-agents/AgentActionsSection.tsxindex 7e5f0021..bacfe653 100644--- a/apps/web/src/features/settings/components/ai-agents/AgentActionsSection.tsx+++ b/apps/web/src/features/settings/components/ai-agents/AgentActionsSection.tsx@@ -1,15 +1,17 @@'use client';+import { useMemo, useState } from 'react';import { ListChecks } from 'lucide-react';import type { AgentTool } from '@/lib/api';-import { Checkbox } from '@/components/ui/checkbox';-import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';-import { grantedToolCount } from '../../utils/agentForm';+import { grantedToolCount, groupInOrder } from '../../utils/agentForm';import { AgentFormSection } from './AgentFormSection';+import { AgentActionRow } from './AgentActionRow';+import { AgentListSearch, SEARCH_THRESHOLD } from './AgentListSearch';import { useTranslations } from 'next-intl';-// What the agent may do in the project. Read-only tools are always granted; the rest-// are opt-in. The counter shows the tools the agent actually has (the granted ones+// What the agent may do in the project, grouped by the feature each action belongs to+// and filterable by label and description. Read-only actions are always granted; the+// rest are opt-in. The counter shows the tools the agent actually has (the granted ones// plus the always-on read tools) over the full catalog.export default function AgentActionsSection({open,@@ -27,9 +29,30 @@ export default function AgentActionsSection({onChange: (keys: string[]) => void;}) {const t = useTranslations('settings.agents');- const grantable = tools.filter((t) => !t.always);+ const [query, setQuery] = useState('');const activeCount = grantedToolCount(tools, selected);- const allGranted = grantable.length > 0 && selected.length >= grantable.length;++ const matches = useMemo(() => {+ const q = query.trim().toLowerCase();+ if (!q) return tools;+ return tools.filter((tool) => `${tool.label} ${tool.description}`.toLowerCase().includes(q));+ }, [tools, query]);++ const groups = useMemo(() => groupInOrder(matches, (tool) => tool.group), [matches]);++ // The bulk toggle acts on the opt-in actions the filter leaves on screen, so it never+ // grants an action the user is not looking at.+ const shown = matches.filter((tool) => !tool.always);+ const allShownGranted = shown.length > 0 && shown.every((tool) => selected.includes(tool.key));++ function toggleShown() {+ const next = new Set(selected);+ for (const tool of shown) {+ if (allShownGranted) next.delete(tool.key);+ else next.add(tool.key);+ }+ onChange([...next]);+ }function toggleTool(key: string, on: boolean) {const next = new Set(selected);@@ -48,55 +71,56 @@ export default function AgentActionsSection({hint={t('actionsHint')}headerRight={tools.length > 0 ? `${activeCount} / ${tools.length}` : undefined}>- {toolsLoading && <p className="text-xs text-muted-foreground">Loading actions…</p>}+ {toolsLoading && <p className="text-xs text-muted-foreground">{t('loadingActions')}</p>}{!toolsLoading && tools.length === 0 && (<p className="text-xs text-muted-foreground">{t('noActions')}</p>)}{!toolsLoading && tools.length > 0 && (<>- {grantable.length > 0 && (- <div className="flex items-center justify-end">+ <div className="flex items-center justify-end gap-3">+ {tools.length > SEARCH_THRESHOLD && (+ <div className="min-w-0 flex-1">+ <AgentListSearch+ value={query}+ onChange={setQuery}+ placeholder={t('searchActions')}+ />+ </div>+ )}+ {shown.length > 0 && (<buttontype="button"- onClick={() => onChange(allGranted ? [] : grantable.map((t) => t.key))}- className="text-xs font-medium text-muted-foreground transition-colors hover:text-foreground"+ onClick={toggleShown}+ className="shrink-0 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground">- {allGranted ? t('clearAll') : t('selectAll')}+ {allShownGranted ? t('clearAll') : t('selectAll')}</button>- </div>- )}- <div className="grid grid-cols-1 gap-x-6 gap-y-2.5 sm:grid-cols-2">- {tools.map((tool) =>- tool.always ? (- <Tooltip key={tool.key}>- <TooltipTrigger asChild>- <div className="flex items-start gap-2 opacity-70">- <Checkbox className="mt-0.5" checked disabled />- <span>- <span className="text-sm">{tool.label}</span>- <span className="block text-xs text-muted-foreground">- {tool.description}- </span>- </span>- </div>- </TooltipTrigger>- <TooltipContent>{t('readOnlyAlwaysOn')}</TooltipContent>- </Tooltip>- ) : (- <label key={tool.key} className="flex cursor-pointer items-start gap-2">- <Checkbox- className="mt-0.5"- checked={selected.includes(tool.key)}- onCheckedChange={(v) => toggleTool(tool.key, v === true)}- />- <span>- <span className="text-sm">{tool.label}</span>- <span className="block text-xs text-muted-foreground">{tool.description}</span>- </span>- </label>- ),)}</div>++ {groups.length === 0 ? (+ <p className="py-4 text-center text-xs text-muted-foreground">+ {t('noMatch', { query: query.trim() })}+ </p>+ ) : (+ groups.map(([group, groupTools]) => (+ <div key={group} className="space-y-2.5">+ <p className="text-xs font-medium tracking-wide text-muted-foreground">+ {t(`actionGroup.${group}`)}+ </p>+ <div className="grid grid-cols-1 gap-x-6 gap-y-2.5 sm:grid-cols-2">+ {groupTools.map((tool) => (+ <AgentActionRow+ key={tool.key}+ tool={tool}+ checked={selected.includes(tool.key)}+ onToggle={(on) => toggleTool(tool.key, on)}+ />+ ))}+ </div>+ </div>+ ))+ )}</>)}</AgentFormSection>diff --git a/apps/web/src/features/settings/components/ai-agents/AgentCapabilityList.tsx b/apps/web/src/features/settings/components/ai-agents/AgentCapabilityList.tsxindex 44ffbc1d..d981c3ed 100644--- a/apps/web/src/features/settings/components/ai-agents/AgentCapabilityList.tsx+++ b/apps/web/src/features/settings/components/ai-agents/AgentCapabilityList.tsx@@ -1,24 +1,25 @@import { useMemo, useState } from 'react';-import { Search, X } from 'lucide-react';-import { Input } from '@/components/ui/input';import { Checkbox } from '@/components/ui/checkbox';import { useTranslations } from 'next-intl';+import { groupInOrder } from '../../utils/agentForm';+import { AgentListSearch, SEARCH_THRESHOLD } from './AgentListSearch';// One selectable capability row (a skill or a configured tool), normalized so the// list renders skills and tools the same way. `search` is the lowercased haystack the-// filter matches against.+// filter matches against; `group` is the heading the row sits under, when the list is+// grouped at all.export interface CapabilityItem {id: number;checked: boolean;title: string;- subtitle: string;+ subtitle?: string;+ group?: string;search: string;}-// A searchable, height-capped checklist of an agent's capabilities. The search box-// appears once the list is long enough to warrant it; the list scrolls past a fixed-// height so a big library does not push the rest of the form off screen. Shared by the-// Skills and Tools sections of the agent form.+// A searchable, height-capped checklist of an agent's capabilities. The list scrolls+// past a fixed height so a big library does not push the rest of the form off screen.+// Shared by the Skills and Tools sections of the agent form.export function AgentCapabilityList({items,onToggle,@@ -29,59 +30,47 @@ export function AgentCapabilityList({searchPlaceholder: string;}) {const t = useTranslations('settings.agents');- const tCommon = useTranslations('common');const [query, setQuery] = useState('');- const matches = useMemo(() => {+ const groups = useMemo(() => {const q = query.trim().toLowerCase();- if (!q) return items;- return items.filter((i) => i.search.includes(q));+ const matches = q ? items.filter((i) => i.search.includes(q)) : items;+ return groupInOrder(matches, (i) => i.group ?? '');}, [items, query]);- const showSearch = items.length > 5;-return (<div className="space-y-2">- {showSearch && (- <div className="relative">- <Search className="pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" />- <Input- value={query}- onChange={(e) => setQuery(e.target.value)}- placeholder={searchPlaceholder}- className="h-8 ps-9 pe-9 text-sm"- />- {query && (- <button- type="button"- onClick={() => setQuery('')}- className="absolute end-3 top-1/2 -translate-y-1/2 rounded-sm text-muted-foreground transition-colors hover:text-foreground"- aria-label={tCommon('clearSearch')}- >- <X className="size-4" />- </button>- )}- </div>+ {items.length > SEARCH_THRESHOLD && (+ <AgentListSearch value={query} onChange={setQuery} placeholder={searchPlaceholder} />)}- <div className="max-h-72 space-y-1.5 overflow-y-auto pe-1">- {matches.length === 0 ? (+ <div className="max-h-72 space-y-4 overflow-y-auto pe-1">+ {groups.length === 0 ? (<p className="py-4 text-center text-xs text-muted-foreground">{t('noMatch', { query: query.trim() })}</p>) : (- matches.map((item) => (- <label key={item.id} className="flex cursor-pointer items-start gap-2">- <Checkbox- className="mt-0.5"- checked={item.checked}- onCheckedChange={(v) => onToggle(item.id, v === true)}- />- <span>- <span className="text-sm">{item.title}</span>- <span className="block text-xs text-muted-foreground">{item.subtitle}</span>- </span>- </label>+ groups.map(([group, groupItems]) => (+ <div key={group} className="space-y-1.5">+ {group && (+ <p className="text-xs font-medium tracking-wide text-muted-foreground">{group}</p>+ )}+ {groupItems.map((item) => (+ <label key={item.id} className="flex cursor-pointer items-start gap-2">+ <Checkbox+ className="mt-0.5"+ checked={item.checked}+ onCheckedChange={(v) => onToggle(item.id, v === true)}+ />+ <span>+ <span className="text-sm">{item.title}</span>+ {item.subtitle && (+ <span className="block text-xs text-muted-foreground">{item.subtitle}</span>+ )}+ </span>+ </label>+ ))}+ </div>)))}</div>diff --git a/apps/web/src/features/settings/components/ai-agents/AgentComboboxTrigger.tsx b/apps/web/src/features/settings/components/ai-agents/AgentComboboxTrigger.tsxnew file mode 100644index 00000000..6afea452--- /dev/null+++ b/apps/web/src/features/settings/components/ai-agents/AgentComboboxTrigger.tsx@@ -0,0 +1,36 @@+import { ChevronsUpDown } from 'lucide-react';+import { Button } from '@/components/ui/button';+import { PopoverTrigger } from '@/components/ui/popover';++// The trigger the provider and model pickers share, so the two controls of the Model+// section read as one control shown twice. Renders the picked value, or the+// placeholder in muted text when nothing is picked yet.+export function AgentComboboxTrigger({+ value,+ placeholder,+ open,+ disabled,+}: {+ value: string;+ placeholder: string;+ open: boolean;+ disabled?: boolean;+}) {+ return (+ <PopoverTrigger asChild>+ <Button+ type="button"+ variant="outline"+ role="combobox"+ aria-expanded={open}+ disabled={disabled}+ className="w-full justify-between font-normal"+ >+ <span className={value ? 'truncate' : 'truncate text-muted-foreground'}>+ {value || placeholder}+ </span>+ <ChevronsUpDown className="ms-2 size-4 shrink-0 opacity-50" />+ </Button>+ </PopoverTrigger>+ );+}diff --git a/apps/web/src/features/settings/components/ai-agents/AgentCredentialField.tsx b/apps/web/src/features/settings/components/ai-agents/AgentCredentialField.tsxnew file mode 100644index 00000000..9c8cc373--- /dev/null+++ b/apps/web/src/features/settings/components/ai-agents/AgentCredentialField.tsx@@ -0,0 +1,75 @@+import { useState } from 'react';+import { Check } from 'lucide-react';+import type { IntegrationOption } from '@/lib/api';+import {+ Command,+ CommandEmpty,+ CommandGroup,+ CommandInput,+ CommandItem,+ CommandList,+} from '@/components/ui/command';+import { Popover, PopoverContent } from '@/components/ui/popover';+import { useTranslations } from 'next-intl';+import { AgentComboboxTrigger } from './AgentComboboxTrigger';++// Provider-key picker for an agent: the project's AI provider credentials, in the+// same control as the model picker next to it.+export default function AgentCredentialField({+ value,+ onChange,+ credentials,+ label,+}: {+ value: number | null;+ onChange: (credentialId: number) => void;+ credentials: IntegrationOption[];+ // How one credential is written out (integration name plus its own label).+ label: (credential: IntegrationOption) => string;+}) {+ const t = useTranslations('settings.agents');+ const [open, setOpen] = useState(false);+ const selected = credentials.find((c) => c.id === value);++ return (+ <Popover open={open} onOpenChange={setOpen}>+ <AgentComboboxTrigger+ value={selected ? label(selected) : ''}+ placeholder={t('chooseCredential')}+ open={open}+ />+ <PopoverContent className="w-(--radix-popover-trigger-width) p-0" align="start">+ {/* The input is what takes focus in the open popover, so it is also what makes+ the list navigable by keyboard. */}+ <Command>+ <CommandInput placeholder={t('searchCredential')} />+ <CommandList+ className="max-h-[16rem]"+ // The field lives inside a Radix Sheet whose scroll lock blocks wheel+ // events on this portaled list, so scroll it manually on wheel.+ onWheel={(e) => {+ e.currentTarget.scrollTop += e.deltaMode === 1 ? e.deltaY * 16 : e.deltaY;+ }}+ >+ <CommandEmpty>{t('noCredentialsFound')}</CommandEmpty>+ <CommandGroup>+ {credentials.map((credential) => (+ <CommandItem+ key={credential.id}+ value={label(credential)}+ onSelect={() => {+ onChange(credential.id);+ setOpen(false);+ }}+ >+ <span className="flex-1 truncate">{label(credential)}</span>+ {credential.id === value && <Check className="ms-auto size-4" />}+ </CommandItem>+ ))}+ </CommandGroup>+ </CommandList>+ </Command>+ </PopoverContent>+ </Popover>+ );+}diff --git a/apps/web/src/features/settings/components/ai-agents/AgentEmptyNotice.tsx b/apps/web/src/features/settings/components/ai-agents/AgentEmptyNotice.tsxnew file mode 100644index 00000000..33fec78d--- /dev/null+++ b/apps/web/src/features/settings/components/ai-agents/AgentEmptyNotice.tsx@@ -0,0 +1,36 @@+import Link from 'next/link';+import { ArrowUpRight, type LucideIcon } from 'lucide-react';++// What a section of the agent form shows when the library it configures is empty:+// what is missing, why it matters here, and the page that fills it. Used by Model+// (no provider key), Skills, and Tools so the three read the same.+export function AgentEmptyNotice({+ icon: Icon,+ title,+ hint,+ href,+ linkLabel,+}: {+ icon: LucideIcon;+ title: string;+ hint: string;+ href: string;+ linkLabel: string;+}) {+ return (+ <div className="flex items-start gap-3 rounded-lg bg-muted/50 px-4 py-3.5">+ <Icon className="mt-0.5 size-4 shrink-0 text-muted-foreground" />+ <div className="min-w-0 space-y-1">+ <p className="text-sm font-medium">{title}</p>+ <p className="text-xs text-muted-foreground">{hint}</p>+ <Link+ href={href}+ className="inline-flex items-center gap-1 pt-1 text-xs font-medium hover:underline"+ >+ {linkLabel}+ <ArrowUpRight className="size-3.5" />+ </Link>+ </div>+ </div>+ );+}diff --git a/apps/web/src/features/settings/components/ai-agents/AgentListSearch.tsx b/apps/web/src/features/settings/components/ai-agents/AgentListSearch.tsxnew file mode 100644index 00000000..788efed4--- /dev/null+++ b/apps/web/src/features/settings/components/ai-agents/AgentListSearch.tsx@@ -0,0 +1,41 @@+import { Search, X } from 'lucide-react';+import { Input } from '@/components/ui/input';+import { useTranslations } from 'next-intl';++// How many items a checklist has to hold before its filter box is worth showing.+export const SEARCH_THRESHOLD = 3;++// The filter box over a long checklist in the agent form (actions, skills, tools).+// It filters the list already on screen, it does not query the server.+export function AgentListSearch({+ value,+ onChange,+ placeholder,+}: {+ value: string;+ onChange: (value: string) => void;+ placeholder: string;+}) {+ const tCommon = useTranslations('common');+ return (+ <div className="relative">+ <Search className="pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" />+ <Input+ value={value}+ onChange={(e) => onChange(e.target.value)}+ placeholder={placeholder}+ className="h-8 ps-9 pe-9 text-sm"+ />+ {value && (+ <button+ type="button"+ onClick={() => onChange('')}+ className="absolute end-3 top-1/2 -translate-y-1/2 rounded-sm text-muted-foreground transition-colors hover:text-foreground"+ aria-label={tCommon('clearSearch')}+ >+ <X className="size-4" />+ </button>+ )}+ </div>+ );+}diff --git a/apps/web/src/features/settings/components/ai-agents/AgentModelField.tsx b/apps/web/src/features/settings/components/ai-agents/AgentModelField.tsxindex e5483587..32c586ae 100644--- a/apps/web/src/features/settings/components/ai-agents/AgentModelField.tsx+++ b/apps/web/src/features/settings/components/ai-agents/AgentModelField.tsx@@ -1,7 +1,6 @@import { useState } from 'react';-import { Check, ChevronsUpDown } from 'lucide-react';+import { Check } from 'lucide-react';import type { ProviderModel } from '@/lib/api';-import { Button } from '@/components/ui/button';import {Command,CommandEmpty,@@ -10,8 +9,9 @@ import {CommandItem,CommandList,} from '@/components/ui/command';-import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';+import { Popover, PopoverContent } from '@/components/ui/popover';import { useTranslations } from 'next-intl';+import { AgentComboboxTrigger } from './AgentComboboxTrigger';// Model picker for an agent: a searchable list of the selected provider's models// (from the models.dev registry) that also accepts a model id typed by hand, so a@@ -45,21 +45,12 @@ export default function AgentModelField({return (<Popover open={open} onOpenChange={setOpen}>- <PopoverTrigger asChild>- <Button- type="button"- variant="outline"- role="combobox"- aria-expanded={open}- disabled={disabled}- className="w-full justify-between font-normal"- >- <span className={value ? 'truncate' : 'truncate text-muted-foreground'}>- {value || t('chooseModel')}- </span>- <ChevronsUpDown className="ms-2 size-4 shrink-0 opacity-50" />- </Button>- </PopoverTrigger>+ <AgentComboboxTrigger+ value={value}+ placeholder={t('chooseModel')}+ open={open}+ disabled={disabled}+ /><PopoverContent className="w-(--radix-popover-trigger-width) p-0" align="start"><Command><CommandInput placeholder={t('searchModel')} value={search} onValueChange={setSearch} />@@ -71,7 +62,7 @@ export default function AgentModelField({e.currentTarget.scrollTop += e.deltaMode === 1 ? e.deltaY * 16 : e.deltaY;}}>- {!loading && !showCustom && <CommandEmpty>No models found.</CommandEmpty>}+ {!loading && !showCustom && <CommandEmpty>{t('noModels')}</CommandEmpty>}{loading && (<div className="px-3 py-2 text-sm text-muted-foreground">{t('loadingModels')}</div>)}diff --git a/apps/web/src/features/settings/components/ai-agents/AgentModelSection.tsx b/apps/web/src/features/settings/components/ai-agents/AgentModelSection.tsxindex 64afbd2a..8d70b7db 100644--- a/apps/web/src/features/settings/components/ai-agents/AgentModelSection.tsx+++ b/apps/web/src/features/settings/components/ai-agents/AgentModelSection.tsx@@ -1,25 +1,19 @@'use client';-import Link from 'next/link';-import { ArrowUpRight, Cpu } from 'lucide-react';+import { Cpu, KeyRound } from 'lucide-react';import type { IntegrationMeta, IntegrationOption, ProviderModel } from '@/lib/api';import { integrationsPath } from '@/utils/paths';-import {- Select,- SelectContent,- SelectItem,- SelectTrigger,- SelectValue,-} from '@/components/ui/select';import type { AgentFormValue } from '../../utils/agentForm';import { integrationLabel } from '../../utils/integrationLabels';import { AgentFormSection } from './AgentFormSection';-import { AgentInstructionsField } from './AgentInstructionsField';+import { AgentEmptyNotice } from './AgentEmptyNotice';+import AgentCredentialField from './AgentCredentialField';import AgentModelField from './AgentModelField';import { useTranslations } from 'next-intl';-// Which provider key the agent runs on, which model of that provider, and the system-// prompt. Only internal agents have it.+// Which provider key the agent runs on and which model of that provider. Only+// internal agents have it. With no provider key in the project both pickers are+// replaced by the notice that points at Integrations.export default function AgentModelSection({open,onOpenChange,@@ -56,63 +50,44 @@ export default function AgentModelSection({title={t('model')}hint={t('modelHint')}>- <div className="grid grid-cols-2 gap-3">- <div className="space-y-1.5">- <span className="text-sm font-medium">{t('credential')}</span>- {credentials.length === 0 ? (- <div className="space-y-2 rounded-md bg-muted/60 px-3 py-2.5">- <p className="text-xs font-medium">{t('noCredential')}</p>- <p className="text-xs text-muted-foreground">{t('noCredentialHint')}</p>- <Link- href={integrationsPath(projectKey)}- className="inline-flex items-center gap-1 text-xs font-medium hover:underline"- >- {t('addKey')}- <ArrowUpRight className="size-3.5" />- </Link>- </div>- ) : (- <Select- value={value.modelCredentialId != null ? String(value.modelCredentialId) : ''}- onValueChange={(v) => {- const id = Number(v);+ {credentials.length === 0 ? (+ <AgentEmptyNotice+ icon={KeyRound}+ title={t('noCredential')}+ hint={t('noCredentialHint')}+ href={integrationsPath(projectKey)}+ linkLabel={t('addKey')}+ />+ ) : (+ <div className="flex flex-wrap gap-3">+ <div className="max-w-[250px] min-w-0 flex-1 basis-44 space-y-1.5">+ <span className="text-sm font-medium">{t('credential')}</span>+ <AgentCredentialField+ value={value.modelCredentialId}+ credentials={credentials}+ label={credentialLabel}+ onChange={(id) =>// Switching provider clears the model: the models are per credential.onChange(id === value.modelCredentialId? { modelCredentialId: id }: { modelCredentialId: id, model: '' },- );- }}- >- <SelectTrigger>- <SelectValue placeholder={t('chooseCredential')} />- </SelectTrigger>- <SelectContent>- {credentials.map((c) => (- <SelectItem key={c.id} value={String(c.id)}>- {credentialLabel(c)}- </SelectItem>- ))}- </SelectContent>- </Select>- )}+ )+ }+ />+ </div>+ <div className="max-w-[250px] min-w-0 flex-1 basis-44 space-y-1.5">+ <span className="text-sm font-medium">{t('model')}</span>+ <AgentModelField+ value={value.model}+ onChange={(model) => onChange({ model })}+ models={models}+ loading={modelsLoading}+ disabled={value.modelCredentialId == null}+ />+ </div></div>- <div className="space-y-1.5">- <span className="text-sm font-medium">{t('model')}</span>- <AgentModelField- value={value.model}- onChange={(model) => onChange({ model })}- models={models}- loading={modelsLoading}- disabled={value.modelCredentialId == null}- />- </div>- </div>-- <AgentInstructionsField- value={value.instructions}- onChange={(instructions) => onChange({ instructions })}- />+ )}</AgentFormSection>);}diff --git a/apps/web/src/features/settings/components/ai-agents/AgentSheetForm.tsx b/apps/web/src/features/settings/components/ai-agents/AgentSheetForm.tsxindex e625d0ca..fa8dd5f3 100644--- a/apps/web/src/features/settings/components/ai-agents/AgentSheetForm.tsx+++ b/apps/web/src/features/settings/components/ai-agents/AgentSheetForm.tsx@@ -1,5 +1,7 @@import { useEffect, useRef, useState } from 'react';+import { Sparkles, Wrench } from 'lucide-react';import type { AiAgent } from '@/lib/api';+import { agentSkillsPath, agentToolsPath } from '@/utils/paths';import {useCreateAiAgent,useUpdateAiAgent,@@ -24,6 +26,7 @@ import {import { usePermissions } from '@/hooks/usePermissions';import { Button } from '@/components/ui/button';import { AgentCapabilityList } from './AgentCapabilityList';+import { AgentEmptyNotice } from './AgentEmptyNotice';import SettingsAiAgentFields from './SettingsAiAgentFields';import { AGENT_EXPANDED_WIDTH } from './AgentExpandedLayout';import {@@ -195,7 +198,13 @@ export function AgentSheetForm({// skill library the agent may load.const skillsContent = showSkills ? (skillsLibrary.length === 0 ? (- <p className="text-xs text-muted-foreground">{t('noSkills')}</p>+ <AgentEmptyNotice+ icon={Sparkles}+ title={t('noSkills')}+ hint={t('noSkillsHint')}+ href={agentSkillsPath(projectKey)}+ linkLabel={t('goToSkills')}+ />) : (<AgentCapabilityListsearchPlaceholder={t('searchSkills')}@@ -217,7 +226,13 @@ export function AgentSheetForm({// The Tools section body: the configured custom tools the agent may call.const toolsContent = showTools ? (toolsLibrary.length === 0 ? (- <p className="text-xs text-muted-foreground">{t('noTools')}</p>+ <AgentEmptyNotice+ icon={Wrench}+ title={t('noTools')}+ hint={t('noToolsHint')}+ href={agentToolsPath(projectKey)}+ linkLabel={t('goToTools')}+ />) : (<AgentCapabilityListsearchPlaceholder={t('searchTools')}@@ -227,21 +242,24 @@ export function AgentSheetForm({catalog.flatMap((i) => i.tools).find((t) => t.key === tool.toolKey)?.label ??tool.toolKey;const integration = integrationLabel(catalog, tool.integrationKey);- const on = tool.credentialLabel- ? `${integration} · ${tool.credentialLabel}`- : integration;return {id: tool.id,checked: selectedTools.includes(tool.id),title: toolLabel,- subtitle: on,- search: `${toolLabel} ${on}`.toLowerCase(),+ subtitle: tool.credentialLabel ?? undefined,+ group: integration,+ search: `${toolLabel} ${integration} ${tool.credentialLabel ?? ''}`.toLowerCase(),};})}/>)) : null;+ // "enabled / available" over each capability library, shown in the section header+ // and its nav entry. Nothing to count while the library is empty.+ const countBadge = (selected: number, total: number) =>+ total > 0 ? `${selected} / ${total}` : undefined;+// The full-width internal editor owns its scroll container (it holds the section// nav's scroll spy). Every other case stacks in a single column here. Once the// agent exists the chat takes the other half of the sheet and the form fills its@@ -268,7 +286,9 @@ export function AgentSheetForm({roles={rolesQuery.data ?? []}agent={agent}skillsContent={skillsContent}+ skillsBadge={countBadge(selectedSkills.length, skillsLibrary.length)}toolsContent={toolsContent}+ toolsBadge={countBadge(selectedTools.length, toolsLibrary.length)}revealedKey={revealedKey}onRevealedKey={setRevealedKey}/>diff --git a/apps/web/src/features/settings/components/ai-agents/SettingsAiAgentFields.tsx b/apps/web/src/features/settings/components/ai-agents/SettingsAiAgentFields.tsxindex 99bcc0fe..8f9ddcc8 100644--- a/apps/web/src/features/settings/components/ai-agents/SettingsAiAgentFields.tsx+++ b/apps/web/src/features/settings/components/ai-agents/SettingsAiAgentFields.tsx@@ -47,7 +47,9 @@ export default function SettingsAiAgentFields({roles,agent,skillsContent,+ skillsBadge,toolsContent,+ toolsBadge,revealedKey,onRevealedKey,}: {@@ -69,8 +71,13 @@ export default function SettingsAiAgentFields({// The Skills section body, built by the parent (it owns the skill library and// links). Null when Skills does not apply; the section is hidden then.skillsContent?: ReactNode | null;+ // "enabled / available" for the Skills header and nav entry. Undefined when the+ // library is empty and there is nothing to count.+ skillsBadge?: string;// The Tools section body (configured custom tools), built the same way.toolsContent?: ReactNode | null;+ // "enabled / available" for the Tools header and nav entry.+ toolsBadge?: string;// The plaintext key issued in this sheet (external agents only), shown once in the// API key section, and the way to drop it or replace it after a regenerate.revealedKey: string | null;@@ -138,12 +145,10 @@ export default function SettingsAiAgentFields({<p className="text-xs text-muted-foreground">{t('usernameHint')}</p></div>- {value.kind === 'external' && (- <AgentInstructionsField- value={value.instructions}- onChange={(instructions) => onChange({ instructions })}- />- )}+ <AgentInstructionsField+ value={value.instructions}+ onChange={(instructions) => onChange({ instructions })}+ /></div>);@@ -216,6 +221,7 @@ export default function SettingsAiAgentFields({icon={Sparkles}title={t('skills')}hint={t('skillsHint')}+ headerRight={skillsBadge}>{skillsContent}</AgentFormSection>@@ -229,6 +235,7 @@ export default function SettingsAiAgentFields({icon={Wrench}title={t('tools')}hint={t('toolsHint')}+ headerRight={toolsBadge}>{toolsContent}</AgentFormSection>@@ -313,16 +320,20 @@ export default function SettingsAiAgentFields({const navSections: SectionNavItem[] = [{ id: 'basics', label: t('basics'), icon: IdCard },{ id: 'model', label: t('model'), icon: Cpu },+ { id: 'advanced', label: t('advanced'), icon: SlidersHorizontal },{ id: 'triggers', label: t('triggers'), icon: Zap },{id: 'actions',label: t('actions'),icon: ListChecks,- badge: tools.length > 0 ? `${activeCount}/${tools.length}` : undefined,+ badge: tools.length > 0 ? `${activeCount} / ${tools.length}` : undefined,},- ...(skillsSection ? [{ id: 'skills', label: t('skills'), icon: Sparkles }] : []),- ...(toolsSection ? [{ id: 'tools', label: t('tools'), icon: Wrench }] : []),- { id: 'advanced', label: t('advanced'), icon: SlidersHorizontal },+ ...(skillsSection+ ? [{ id: 'skills', label: t('skills'), icon: Sparkles, badge: skillsBadge }]+ : []),+ ...(toolsSection+ ? [{ id: 'tools', label: t('tools'), icon: Wrench, badge: toolsBadge }]+ : []),];return (@@ -332,11 +343,11 @@ export default function SettingsAiAgentFields({>{basicsSection}{modelSection}+ {advancedSection}{triggersSection}{actionsSection}{skillsSection}{toolsSection}- {advancedSection}</AgentExpandedLayout>);}@@ -355,11 +366,11 @@ export default function SettingsAiAgentFields({) : (<>{modelSection}- {actionsSection}+ {advancedSection}{triggersSection}+ {actionsSection}{skillsSection}{toolsSection}- {advancedSection}</>)}</div>diff --git a/apps/web/src/features/settings/utils/agentForm.ts b/apps/web/src/features/settings/utils/agentForm.tsindex 4c452afa..0365c18c 100644--- a/apps/web/src/features/settings/utils/agentForm.ts+++ b/apps/web/src/features/settings/utils/agentForm.ts@@ -127,3 +127,16 @@ export function toUpdatePatch(v: AgentFormValue): AiAgentPatch {export function grantedToolCount(tools: AgentTool[], selected: string[]): number {return selected.length + tools.filter((t) => t.always).length;}++// Buckets a list by a key, keeping the order the keys first appear in, so a grouped+// checklist follows the order its source list came in.+export function groupInOrder<T, K extends string>(items: T[], key: (item: T) => K): [K, T[]][] {+ const groups = new Map<K, T[]>();+ for (const item of items) {+ const group = key(item);+ const bucket = groups.get(group);+ if (bucket) bucket.push(item);+ else groups.set(group, [item]);+ }+ return [...groups];+}diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.tsindex 4bfcd2ea..2e2e93ee 100644--- a/apps/web/src/lib/api.ts+++ b/apps/web/src/lib/api.ts@@ -281,6 +281,7 @@ export interface AgentScheduleRun {// read-only tools that are always granted and shown non-editable.export interface AgentTool {key: string;+ group: 'issues' | 'initiatives' | 'cycles' | 'notes' | 'project';label: string;description: string;always: boolean;