Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(quick-create): frequent agent quick-switch chips and dialog hairline (MUL-10012) (#11347)
Jiayuan Zhangc34dc2eadf13
diff --git a/docs/theming.md b/docs/theming.mdindex 3685a929fd..a1a1eac6ce 100644--- a/docs/theming.md+++ b/docs/theming.md@@ -753,7 +753,7 @@ and dark differ, both defaults are given.| `--switch-unchecked-thumb` | `var(--background)` / `var(--foreground)` | Thumb of a switch that is off. || `--switch-border-color` | `transparent` | Outline of a switch, on or off. || `--popover-radius` | `var(--radius)` | Popovers. |-| `--floating-border-color` | `color-mix(in oklab, var(--surface-border), var(--foreground) 6%)` | Hairline around layers that float over the page without a backdrop: menus, popovers, select lists and floating panels. |+| `--floating-border-color` | `color-mix(in oklab, var(--surface-border), var(--foreground) 6%)` | Hairline around layers that float over the page: menus, popovers, select lists, floating panels, dialogs and alert dialogs. || `--dialog-radius` | `calc(var(--radius) * 1.5)` | Dialogs and alert dialogs. || `--tooltip-radius` | `var(--radius)` | Tooltips. || `--avatar-radius` | `calc(infinity * 1px)` | Avatars. Set a length for square avatars. |diff --git a/packages/core/appearance/theme-variables.ts b/packages/core/appearance/theme-variables.tsindex 1bb9cac4fa..d482336f39 100644--- a/packages/core/appearance/theme-variables.ts+++ b/packages/core/appearance/theme-variables.ts@@ -241,7 +241,7 @@ const CONTROLS: Entry[] = [["switch-unchecked-thumb", "Thumb of a switch that is off.", "var(--background)", "var(--foreground)"],["switch-border-color", "Outline of a switch, on or off.", "transparent"],["popover-radius", "Popovers.", "var(--radius)"],- ["floating-border-color", "Hairline around layers that float over the page without a backdrop: menus, popovers, select lists and floating panels.", "color-mix(in oklab, var(--surface-border), var(--foreground) 6%)"],+ ["floating-border-color", "Hairline around layers that float over the page: menus, popovers, select lists, floating panels, dialogs and alert dialogs.", "color-mix(in oklab, var(--surface-border), var(--foreground) 6%)"],["dialog-radius", "Dialogs and alert dialogs.", "calc(var(--radius) * 1.5)"],["tooltip-radius", "Tooltips.", "var(--radius)"],["avatar-radius", "Avatars. Set a length for square avatars.", "calc(infinity * 1px)"],diff --git a/packages/core/issues/stores/quick-create-store.test.ts b/packages/core/issues/stores/quick-create-store.test.tsindex fd464a0bbe..d34669db21 100644--- a/packages/core/issues/stores/quick-create-store.test.ts+++ b/packages/core/issues/stores/quick-create-store.test.ts@@ -1,9 +1,10 @@import { beforeEach, describe, expect, it } from "vitest";-import { useQuickCreateStore } from "./quick-create-store";+import { rankFrequentActors, useQuickCreateStore } from "./quick-create-store";const RESET_STATE = {lastActorType: null,lastActorId: null,+ actorCreateCounts: {},keepOpen: false,};@@ -36,4 +37,40 @@ describe("quick create store", () => {expect(useQuickCreateStore.getState().lastActorType).toBeNull();expect(useQuickCreateStore.getState().lastActorId).toBeNull();});++ it("counts creates per actor, keeping an agent and a squad with the same id apart", () => {+ const { countActorCreate } = useQuickCreateStore.getState();++ countActorCreate("agent", "a");+ countActorCreate("agent", "a");+ countActorCreate("squad", "a");++ expect(useQuickCreateStore.getState().actorCreateCounts).toEqual({+ "agent:a": 2,+ "squad:a": 1,+ });+ });+});++describe("rankFrequentActors", () => {+ const agent = (id: string) => ({ type: "agent" as const, id });+ const squad = (id: string) => ({ type: "squad" as const, id });++ it("puts the actors with the most creates first", () => {+ const counts = { "agent:a": 1, "agent:c": 5, "squad:s": 3 };+ expect(rankFrequentActors(counts, [agent("a"), agent("b"), agent("c"), squad("s")], 3))+ .toEqual([agent("c"), squad("s"), agent("a")]);+ });++ it("fills slots without counts, and breaks ties, in candidate order", () => {+ const counts = { "agent:c": 2, "agent:b": 2 };+ expect(rankFrequentActors(counts, [agent("a"), agent("b"), agent("c"), agent("d")], 3))+ .toEqual([agent("b"), agent("c"), agent("a")]);+ expect(rankFrequentActors({}, [agent("a"), agent("b")], 3)).toEqual([agent("a"), agent("b")]);+ });++ it("ignores counts for actors that are no longer candidates", () => {+ const counts = { "agent:gone": 9, "agent:b": 1 };+ expect(rankFrequentActors(counts, [agent("a"), agent("b")], 3)).toEqual([agent("b"), agent("a")]);+ });});diff --git a/packages/core/issues/stores/quick-create-store.ts b/packages/core/issues/stores/quick-create-store.tsindex 37647abe3b..bc906470f0 100644--- a/packages/core/issues/stores/quick-create-store.ts+++ b/packages/core/issues/stores/quick-create-store.ts@@ -31,22 +31,62 @@ export type QuickCreateActorType = "agent" | "squad";//// The in-progress agent prompt no longer lives here — it moved into the// unified issue-create draft's `agent` slot (draft-store) so it shares one-// lifecycle with the manual draft (MUL-5181). This store keeps only the-// last-successful actor and the shared keep-open toggle.+// lifecycle with the manual draft (MUL-5181). This store keeps the+// last-successful actor, how many creates each actor has filed (which ranks+// the quick-switch chips, MUL-10012), and the shared keep-open toggle.interface QuickCreateState {lastActorType: QuickCreateActorType | null;lastActorId: string | null;setLastActor: (type: QuickCreateActorType | null, id: string | null) => void;+ /** Successful creates per actor, keyed by `actorCountKey`. */+ actorCreateCounts: Record<string, number>;+ countActorCreate: (type: QuickCreateActorType, id: string) => void;keepOpen: boolean;setKeepOpen: (v: boolean) => void;}+export interface QuickCreateActorRef {+ type: QuickCreateActorType;+ id: string;+}++export function actorCountKey(type: QuickCreateActorType, id: string): string {+ return `${type}:${id}`;+}++/**+ * The actors shown as quick-switch chips: most creates first, ties and the+ * slots no count fills kept in `candidates` order. Callers pass only actors+ * the user can pick right now, so counts left behind by a deleted or+ * archived agent never take a slot.+ */+export function rankFrequentActors(+ counts: Record<string, number>,+ candidates: readonly QuickCreateActorRef[],+ limit: number,+): QuickCreateActorRef[] {+ const countOf = (a: QuickCreateActorRef) => counts[actorCountKey(a.type, a.id)] ?? 0;+ return candidates+ .map((actor, index) => ({ actor, index, count: countOf(actor) }))+ .sort((a, b) => b.count - a.count || a.index - b.index)+ .slice(0, limit)+ .map(({ actor }) => actor);+}+export const useQuickCreateStore = create<QuickCreateState>()(persist((set) => ({lastActorType: null,lastActorId: null,setLastActor: (type, id) => set({ lastActorType: type, lastActorId: id }),+ actorCreateCounts: {},+ countActorCreate: (type, id) =>+ set((s) => {+ const key = actorCountKey(type, id);+ return {+ actorCreateCounts: { ...s.actorCreateCounts, [key]: (s.actorCreateCounts[key] ?? 0) + 1 },+ };+ }),keepOpen: false,setKeepOpen: (v) => set({ keepOpen: v }),}),@@ -68,6 +108,7 @@ registerDraftCleanup({useQuickCreateStore.setState({lastActorType: null,lastActorId: null,+ actorCreateCounts: {},keepOpen: false,}),});diff --git a/packages/ui/components/ui/alert-dialog.tsx b/packages/ui/components/ui/alert-dialog.tsxindex 0eba94d8c1..3fb002c260 100644--- a/packages/ui/components/ui/alert-dialog.tsx+++ b/packages/ui/components/ui/alert-dialog.tsx@@ -58,7 +58,7 @@ function AlertDialogContent({data-slot="alert-dialog-content"data-size={size}className={cn(- "group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] grid-cols-1 -translate-x-1/2 -translate-y-1/2 gap-4 rounded-dialog bg-surface-raised p-4 text-popover-foreground shadow-[var(--floating-shadow)] ring-1 ring-surface-border data-open:animation-duration-[var(--dialog-enter-duration)] data-closed:animation-duration-[var(--dialog-exit-duration)] data-open:ease-[var(--dialog-enter-easing)] data-closed:ease-[var(--dialog-exit-easing)] motion-reduce:animate-none! outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",+ "group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] grid-cols-1 -translate-x-1/2 -translate-y-1/2 gap-4 rounded-dialog bg-surface-raised p-4 text-popover-foreground shadow-[var(--floating-shadow)] ring-1 ring-floating-border data-open:animation-duration-[var(--dialog-enter-duration)] data-closed:animation-duration-[var(--dialog-exit-duration)] data-open:ease-[var(--dialog-enter-easing)] data-closed:ease-[var(--dialog-exit-easing)] motion-reduce:animate-none! outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",className)}{...props}diff --git a/packages/ui/components/ui/dialog.tsx b/packages/ui/components/ui/dialog.tsxindex 5a3f89fd29..5516c0aded 100644--- a/packages/ui/components/ui/dialog.tsx+++ b/packages/ui/components/ui/dialog.tsx@@ -101,7 +101,7 @@ function DialogContent({// fits is unaffected. `overflow-auto` shares tailwind-merge's// conflict group with `overflow-hidden`, so a dialog that manages// its own scrolling still opts out by passing that.- "fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100%-2rem)] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 overflow-auto rounded-dialog bg-surface-raised p-4 text-body text-popover-foreground shadow-[var(--floating-shadow)] ring-1 ring-surface-border data-open:animation-duration-[var(--dialog-enter-duration)] data-closed:animation-duration-[var(--dialog-exit-duration)] data-open:ease-[var(--dialog-enter-easing)] data-closed:ease-[var(--dialog-exit-easing)] motion-reduce:animate-none! outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",+ "fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100%-2rem)] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 overflow-auto rounded-dialog bg-surface-raised p-4 text-body text-popover-foreground shadow-[var(--floating-shadow)] ring-1 ring-floating-border data-open:animation-duration-[var(--dialog-enter-duration)] data-closed:animation-duration-[var(--dialog-exit-duration)] data-open:ease-[var(--dialog-enter-easing)] data-closed:ease-[var(--dialog-exit-easing)] motion-reduce:animate-none! outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",className)}{...props}diff --git a/packages/views/locales/en/modals.json b/packages/views/locales/en/modals.jsonindex b30910041f..aff4f113e2 100644--- a/packages/views/locales/en/modals.json+++ b/packages/views/locales/en/modals.json@@ -241,6 +241,8 @@"created_by": "Created by","select_agent_aria": "Select agent","pick_an_agent": "Pick an agent...",+ "all_actors": "All agents and squads",+ "frequent_actors_aria": "Frequently used","no_agents": "No agents or squads available.","search_placeholder": "Search agents and squads...","agents_group": "Agents",diff --git a/packages/views/locales/es/modals.json b/packages/views/locales/es/modals.jsonindex 26af63dbbf..79552fb898 100644--- a/packages/views/locales/es/modals.json+++ b/packages/views/locales/es/modals.json@@ -216,6 +216,8 @@"created_by": "Creado por","select_agent_aria": "Seleccionar agente","pick_an_agent": "Elige un agente…",+ "all_actors": "Todos los agentes y squads",+ "frequent_actors_aria": "Usados con frecuencia","no_agents": "No hay agentes ni squads disponibles.","search_placeholder": "Buscar agentes y squads…","agents_group": "Agentes",diff --git a/packages/views/locales/fr/modals.json b/packages/views/locales/fr/modals.jsonindex 5261f1e02a..25a0f95c78 100644--- a/packages/views/locales/fr/modals.json+++ b/packages/views/locales/fr/modals.json@@ -241,6 +241,8 @@"created_by": "Créé par","select_agent_aria": "Sélectionner un agent","pick_an_agent": "Choisir un agent…",+ "all_actors": "Tous les agents et squads",+ "frequent_actors_aria": "Les plus utilisés","no_agents": "Aucun agent ni squad disponible.","search_placeholder": "Rechercher des agents et des squads…","agents_group": "Agents",diff --git a/packages/views/locales/ja/modals.json b/packages/views/locales/ja/modals.jsonindex ce4d6b73e3..f396c6820b 100644--- a/packages/views/locales/ja/modals.json+++ b/packages/views/locales/ja/modals.json@@ -239,6 +239,8 @@"created_by": "作成者","select_agent_aria": "エージェントを選択","pick_an_agent": "エージェントを選択…",+ "all_actors": "すべてのエージェントとスクワッド",+ "frequent_actors_aria": "よく使う","no_agents": "利用可能なエージェントまたはスクワッドがありません。","search_placeholder": "エージェントとスクワッドを検索…","agents_group": "エージェント",diff --git a/packages/views/locales/ko/modals.json b/packages/views/locales/ko/modals.jsonindex 4a5c8d4e46..eeeeaa8038 100644--- a/packages/views/locales/ko/modals.json+++ b/packages/views/locales/ko/modals.json@@ -239,6 +239,8 @@"created_by": "생성자","select_agent_aria": "에이전트 선택","pick_an_agent": "에이전트 선택...",+ "all_actors": "모든 에이전트와 스쿼드",+ "frequent_actors_aria": "자주 사용","no_agents": "사용 가능한 에이전트나 스쿼드가 없습니다.","search_placeholder": "에이전트와 스쿼드 검색...","agents_group": "에이전트",diff --git a/packages/views/locales/ru/modals.json b/packages/views/locales/ru/modals.jsonindex 250f687a53..967c437778 100644--- a/packages/views/locales/ru/modals.json+++ b/packages/views/locales/ru/modals.json@@ -239,6 +239,8 @@"created_by": "Создано","select_agent_aria": "Выбрать агента","pick_an_agent": "Выберите агента…",+ "all_actors": "Все агенты и команды",+ "frequent_actors_aria": "Часто используемые","no_agents": "Нет доступных агентов или команд.","search_placeholder": "Поиск агентов и команд…","agents_group": "Агенты",diff --git a/packages/views/locales/zh-Hans/modals.json b/packages/views/locales/zh-Hans/modals.jsonindex 4beef9b81d..b3fe81dd7f 100644--- a/packages/views/locales/zh-Hans/modals.json+++ b/packages/views/locales/zh-Hans/modals.json@@ -239,6 +239,8 @@"created_by": "创建者","select_agent_aria": "选择智能体","pick_an_agent": "选一个智能体...",+ "all_actors": "全部智能体和小队",+ "frequent_actors_aria": "常用","no_agents": "暂无可用智能体或小队。","search_placeholder": "搜索智能体或小队...","agents_group": "智能体",diff --git a/packages/views/locales/zh-Hant/modals.json b/packages/views/locales/zh-Hant/modals.jsonindex f952375f86..5bd7800eff 100644--- a/packages/views/locales/zh-Hant/modals.json+++ b/packages/views/locales/zh-Hant/modals.json@@ -239,6 +239,8 @@"created_by": "建立者","select_agent_aria": "選擇 AI 代理","pick_an_agent": "選一個 AI 代理...",+ "all_actors": "全部 AI 代理和小隊",+ "frequent_actors_aria": "常用","no_agents": "暫無可用 AI 代理或小隊。","search_placeholder": "搜尋 AI 代理或小隊...","agents_group": "AI 代理",diff --git a/packages/views/modals/create-issue-batch-continuation.test.tsx b/packages/views/modals/create-issue-batch-continuation.test.tsxindex 13b5603ff5..fd9b0c6dae 100644--- a/packages/views/modals/create-issue-batch-continuation.test.tsx+++ b/packages/views/modals/create-issue-batch-continuation.test.tsx@@ -491,8 +491,7 @@ describe("assignee across create-mode switches", () => {renderUi(<CreateIssueDialog onClose={vi.fn()} initialMode="manual" />);await user.type(screen.getByPlaceholderText("Issue title"), "Review payment callback");await user.click(screen.getByRole("button", { name: /Switch to Agent/i }));- await user.click(await screen.findByRole("button", { name: /Created by/ }));- await user.click(await screen.findByRole("button", { name: /^Agent X$/ }));+ await user.click(await screen.findByRole("button", { name: "Agent X", pressed: false }));await user.click(screen.getByRole("button", { name: /Switch to Manual/i }));expect(screen.getByTestId("assignee-picker")).toHaveAttribute("data-assignee-id", "agent-x");await user.click(screen.getByRole("button", { name: "Create issue" }));@@ -507,7 +506,7 @@ describe("assignee across create-mode switches", () => {await user.click(screen.getByRole("button", { name: "Clear assignee" }));for (let i = 0; i < 2; i++) {await user.click(screen.getByRole("button", { name: /Switch to Agent/i }));- await screen.findByRole("button", { name: /Created by.*Default Agent/ });+ await screen.findByRole("button", { name: "Default Agent", pressed: true });await user.click(screen.getByRole("button", { name: /Switch to Manual/i }));expect(screen.getByTestId("assignee-picker")).toHaveAttribute("data-assignee-id", "none");}@@ -521,8 +520,7 @@ describe("assignee across create-mode switches", () => {const user = userEvent.setup();renderUi(<CreateIssueDialog onClose={vi.fn()} initialMode="manual" data={{ assignee_type: "member", assignee_id: "alice" }} />);await user.click(screen.getByRole("button", { name: /Switch to Agent/i }));- await user.click(await screen.findByRole("button", { name: /Created by/ }));- await user.click(await screen.findByRole("button", { name: /^Agent X$/ }));+ await user.click(await screen.findByRole("button", { name: "Agent X", pressed: false }));await user.click(screen.getByRole("button", { name: /Switch to Manual/i }));expect(screen.getByTestId("assignee-picker")).toHaveAttribute("data-assignee-id", "alice");});diff --git a/packages/views/modals/quick-create-issue.test.tsx b/packages/views/modals/quick-create-issue.test.tsxindex e2760e1d80..3c1e308306 100644--- a/packages/views/modals/quick-create-issue.test.tsx+++ b/packages/views/modals/quick-create-issue.test.tsx@@ -8,7 +8,7 @@ import {type ReactNode,} from "react";import { describe, it, expect, vi, beforeEach } from "vitest";-import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react";import userEvent from "@testing-library/user-event";const mockQuickCreateIssue = vi.hoisted(() => vi.fn());@@ -26,6 +26,7 @@ vi.mock("../voice", () => ({}));const mockCreateCommentSubIssue = vi.hoisted(() => vi.fn());const mockSetLastActor = vi.hoisted(() => vi.fn());+const mockCountActorCreate = vi.hoisted(() => vi.fn());const mockSetQuickCreateFieldVisible = vi.hoisted(() => vi.fn());const mockSetKeepOpen = vi.hoisted(() => vi.fn());const mockSetLastMode = vi.hoisted(() => vi.fn());@@ -109,6 +110,8 @@ const mockQuickCreateStore = {lastActorType: null as "agent" | "squad" | null,lastActorId: null as string | null,setLastActor: mockSetLastActor,+ actorCreateCounts: {} as Record<string, number>,+ countActorCreate: mockCountActorCreate,keepOpen: false,setKeepOpen: mockSetKeepOpen,// Not part of the store's interface any more (MUL-5862), but an older@@ -137,6 +140,10 @@ const mockSquadsData = vi.hoisted(() => ({ list: [] as Array<{ id: string; name: string; leader_id: string; archived_at: string | null }> }),);+const mockAgentsData = vi.hoisted(+ () => ({ list: [] as Array<{ id: string; name: string; archived_at: string | null; runtime_id: string }> }),+);+// Per-test override for the runtimes list. Non-admin members receive a// filtered list (ListVisibleAgentRuntimes) that omits other members' private// machines, so a selected agent can point at a runtime_id that is simply not@@ -163,9 +170,7 @@ vi.mock("@tanstack/react-query", () => ({case "members":return { data: [{ user_id: "user-1", role: "admin" }] };case "agents":- return {- data: [{ id: "agent-1", name: "Bohan", archived_at: null, runtime_id: "runtime-1" }],- };+ return { data: mockAgentsData.list };case "runtimes":return { data: mockRuntimesData.list };case "projects":@@ -230,7 +235,8 @@ vi.mock("@multica/core/projects/queries", () => ({projectListOptions: () => ({ queryKey: ["projects"] }),}));-vi.mock("@multica/core/issues/stores/quick-create-store", () => ({+vi.mock("@multica/core/issues/stores/quick-create-store", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@multica/core/issues/stores/quick-create-store")>()),useQuickCreateStore: (selector?: (state: typeof mockQuickCreateStore) => unknown) =>(selector ? selector(mockQuickCreateStore) : mockQuickCreateStore),}));@@ -504,6 +510,16 @@ const TEST_RESOURCES = {en: { common: enCommon, modals: enModals, editor: enEditor, projects: enProjects, issues: enIssues },};+// A row of the actor popover, as opposed to the quick-switch chip that can+// carry the same name.+function pickerRow(name: RegExp) {+ const rows = screen+ .getAllByRole("button", { name })+ .filter((el) => el.hasAttribute("data-selected"));+ expect(rows).toHaveLength(1);+ return rows[0]!;+}+function renderPanel(props: React.ComponentProps<typeof AgentCreatePanel>) {return render(<I18nProvider locale="en" resources={TEST_RESOURCES}>@@ -530,7 +546,7 @@ describe("AgentCreatePanel", () => {expect(screen.getByRole("button", { name: /^Create$/i })).toBeEnabled();expect(screen.queryByText(/daemon.*version/i)).not.toBeInTheDocument();expect(screen.getAllByText("Bohan").length).toBeGreaterThan(0);- expect(screen.getByText("Cloud Squad")).toBeInTheDocument();+ expect(pickerRow(/Cloud Squad/)).toBeInTheDocument();});it("blocks Qoder agents when the prompt references an attachment", () => {@@ -555,6 +571,8 @@ describe("AgentCreatePanel", () => {mockQuickCreateStore.lastActorType = null;mockQuickCreateStore.lastActorId = null;mockQuickCreateStore.lastProjectId = null;+ mockQuickCreateStore.actorCreateCounts = {};+ mockAgentsData.list = [{ id: "agent-1", name: "Bohan", archived_at: null, runtime_id: "runtime-1" }];mockCreateSettingsStore.quickCreateFields = ["project"];mockQuickCreateStore.keepOpen = false;mockIssueDraftStore.draft = emptyIssueDraft();@@ -640,7 +658,7 @@ describe("AgentCreatePanel", () => {setIsExpanded: vi.fn(),});- await user.click(screen.getByRole("button", { name: /Frontend Squad/ }));+ await user.click(pickerRow(/Frontend Squad/));await user.click(screen.getByTestId("project-picker"));await user.click(screen.getByTestId("priority-picker"));await user.click(screen.getByTestId("due-date-picker"));@@ -659,7 +677,7 @@ describe("AgentCreatePanel", () => {firstOpen.unmount();renderPanel({ onClose: vi.fn(), isExpanded: false, setIsExpanded: vi.fn() });- expect(screen.getByRole("button", { name: /Frontend Squad/ })).toHaveAttribute(+ expect(pickerRow(/Frontend Squad/)).toHaveAttribute("data-selected","true",);@@ -913,7 +931,7 @@ describe("AgentCreatePanel", () => {// The picker mock renders both sections inline as buttons; click the// squad row directly.- await user.click(screen.getByRole("button", { name: /Frontend Squad/ }));+ await user.click(pickerRow(/Frontend Squad/));const editor = screen.getByPlaceholderText('Tell the agent what to do, e.g. "fix the slow inbox loading in the Web project"',@@ -974,7 +992,7 @@ describe("AgentCreatePanel", () => {renderPanel({ onClose: vi.fn(), isExpanded: false, setIsExpanded: vi.fn() });- await user.click(screen.getByRole("button", { name: /Bohan/ }));+ await user.click(pickerRow(/Bohan/));await user.click(screen.getByTestId("project-picker"));await user.type(screen.getByPlaceholderText(@@ -1229,7 +1247,7 @@ describe("AgentCreatePanel", () => {renderPanel({ onClose: vi.fn(), isExpanded: false, setIsExpanded: vi.fn() });- await user.click(screen.getByRole("button", { name: /Bohan/ }));+ await user.click(pickerRow(/Bohan/));// No misleading "daemon has no CLI version" wall...expect(@@ -1257,7 +1275,7 @@ describe("AgentCreatePanel", () => {renderPanel({ onClose: vi.fn(), isExpanded: false, setIsExpanded: vi.fn() });- await user.click(screen.getByRole("button", { name: /Bohan/ }));+ await user.click(pickerRow(/Bohan/));expect(screen.getByText(/Create with agent needs ≥/i)).toBeInTheDocument();await user.type(@@ -1337,4 +1355,103 @@ describe("AgentCreatePanel", () => {expect(attach).not.toHaveAttribute("data-size");});});++ // MUL-10012 — the three most used actors sit next to "Created by" as chips,+ // ranked by how many issues each has filed, and ⌥1–⌥3 pick them.+ describe("quick-switch chips", () => {+ const agent = (id: string, name: string) => ({ id, name, archived_at: null, runtime_id: "runtime-1" });+ const PROMPT_PLACEHOLDER =+ 'Tell the agent what to do, e.g. "fix the slow inbox loading in the Web project"';++ beforeEach(() => {+ mockAgentsData.list = [+ agent("agent-1", "Bohan"),+ agent("agent-2", "Ada"),+ agent("agent-3", "Cyd"),+ agent("agent-4", "Dex"),+ ];+ mockQuickCreateStore.actorCreateCounts = { "agent:agent-3": 5, "agent:agent-4": 2 };+ });++ const chips = () =>+ within(screen.getByRole("group", { name: "Frequently used" })).getAllByRole("button");+ const chipNames = () => chips().map((el) => el.textContent);+ const pressedChip = () => chips().find((el) => el.getAttribute("aria-pressed") === "true");++ it("ranks the chips by create count and fills the rest in list order", () => {+ renderPanel({ onClose: vi.fn(), isExpanded: false, setIsExpanded: vi.fn() });++ expect(chipNames()).toEqual(["Cyd", "Dex", "Bohan"]);+ // With no draft or last pick, the default actor is the first agent.+ expect(pressedChip()).toHaveTextContent("Bohan");+ });++ it("submits with the chip the user clicked", async () => {+ const user = userEvent.setup();+ renderPanel({ onClose: vi.fn(), isExpanded: false, setIsExpanded: vi.fn() });++ await user.click(screen.getByRole("button", { name: "Dex", pressed: false }));+ expect(pressedChip()).toHaveTextContent("Dex");++ await user.type(screen.getByPlaceholderText(PROMPT_PLACEHOLDER), " now");+ await user.click(screen.getByRole("button", { name: /^Create$/i }));++ await waitFor(() => {+ expect(mockQuickCreateIssue).toHaveBeenCalledWith(+ expect.objectContaining({ agent_id: "agent-4" }),+ );+ });+ expect(mockCountActorCreate).toHaveBeenCalledWith("agent", "agent-4");+ });++ it("picks a chip with ⌥ + its position, even from inside the prompt", () => {+ renderPanel({ onClose: vi.fn(), isExpanded: false, setIsExpanded: vi.fn() });++ const notPrevented = fireEvent.keyDown(screen.getByPlaceholderText(PROMPT_PLACEHOLDER), {+ key: "2",+ code: "Digit2",+ altKey: true,+ });++ expect(notPrevented).toBe(false);+ expect(pressedChip()).toHaveTextContent("Dex");+ expect(mockIssueDraftStore.draft.agent).toEqual(+ expect.objectContaining({ actorType: "agent", actorId: "agent-4" }),+ );+ });++ it("leaves ⌥ + a digit past the chips to the editor", () => {+ mockAgentsData.list = [agent("agent-1", "Bohan")];+ renderPanel({ onClose: vi.fn(), isExpanded: false, setIsExpanded: vi.fn() });++ const notPrevented = fireEvent.keyDown(screen.getByPlaceholderText(PROMPT_PLACEHOLDER), {+ key: "2",+ code: "Digit2",+ altKey: true,+ });++ expect(notPrevented).toBe(true);+ });++ it("shows a pick from the full list as its own chip without moving the ranked ones", async () => {+ const user = userEvent.setup();+ renderPanel({ onClose: vi.fn(), isExpanded: false, setIsExpanded: vi.fn() });++ await user.click(pickerRow(/Ada/));++ expect(chipNames()).toEqual(["Cyd", "Dex", "Bohan", "Ada"]);+ expect(pressedChip()).toHaveTextContent("Ada");+ });++ it("keeps the chip order fixed while the dialog stays open", async () => {+ const user = userEvent.setup();+ renderPanel({ onClose: vi.fn(), isExpanded: false, setIsExpanded: vi.fn() });++ mockQuickCreateStore.actorCreateCounts = { "agent:agent-1": 50 };+ // Any re-render reads the store again; the ranking must not.+ await user.type(screen.getByPlaceholderText(PROMPT_PLACEHOLDER), "x");++ expect(chipNames()).toEqual(["Cyd", "Dex", "Bohan"]);+ });+ });});diff --git a/packages/views/modals/quick-create-issue.tsx b/packages/views/modals/quick-create-issue.tsxindex 614cd5b1ed..eb8d008cb4 100644--- a/packages/views/modals/quick-create-issue.tsx+++ b/packages/views/modals/quick-create-issue.tsx@@ -5,6 +5,7 @@ import {ArrowLeftRight,CalendarDays,Check,+ ChevronDown,ChevronRight,FolderKanban,Maximize2,@@ -36,6 +37,7 @@ import { agentListOptions, squadListOptions } from "@multica/core/workspace/querimport { projectListOptions } from "@multica/core/projects/queries";import { isProjectArchived } from "@multica/core/projects";import {+ rankFrequentActors,useQuickCreateStore,type QuickCreateActorType,} from "@multica/core/issues/stores/quick-create-store";@@ -51,7 +53,13 @@ import {checkQuickCreateFieldsCliVersion,readRuntimeCliVersion,} from "@multica/core/runtimes";-import { useShortcut } from "@multica/core/shortcuts";+import {+ createShortcutChord,+ shortcutMatchesEvent,+ useShortcut,+ type ShortcutChord,+} from "@multica/core/shortcuts";+import { isImeComposing } from "@multica/core/utils";import { ShortcutKeycaps } from "../common/shortcut-keycaps";import { DeferredTooltip } from "../common/deferred-tooltip";import {@@ -95,6 +103,15 @@ type ActorSelection =| { type: "agent"; id: string }| { type: "squad"; id: string };+const sameActor = (a: ActorSelection | null, b: ActorSelection | null) =>+ !!a && !!b && a.type === b.type && a.id === b.id;++// ⌥1–⌥3 pick the quick-switch chips. Command/Ctrl+digit is not available:+// browsers and the desktop tab strip own it (PRIMARY_RESERVED_VARIANTS).+const QUICK_SWITCH_SHORTCUTS: readonly ShortcutChord[] = ["1", "2", "3"].map((key) =>+ createShortcutChord(key, { alt: true }),+);+// AgentCreatePanel — agent-mode body of the create-issue dialog. Renders// only the inner content; the surrounding `<Dialog>` AND `<DialogContent>`// (Portal + Overlay + Popup) are owned by CreateIssueDialog so mode-switching@@ -189,6 +206,11 @@ export function AgentCreatePanel({const lastActorType = useQuickCreateStore((s) => s.lastActorType);const lastActorId = useQuickCreateStore((s) => s.lastActorId);const setLastActor = useQuickCreateStore((s) => s.setLastActor);+ const countActorCreate = useQuickCreateStore((s) => s.countActorCreate);+ // Ranked from the counts as they were when the dialog opened: a create in+ // keep-open mode must not reorder the chips under ⌥1–⌥3 mid-session.+ const actorCreateCounts = useQuickCreateStore((s) => s.actorCreateCounts);+ const [countsAtOpen] = useState(actorCreateCounts);const visibleFields = useIssueCreateSettingsStore((s) => s.quickCreateFields);const keepOpen = useQuickCreateStore((s) => s.keepOpen);const setKeepOpen = useQuickCreateStore((s) => s.setKeepOpen);@@ -271,6 +293,44 @@ export function AgentCreatePanel({return visibleSquads.find((s) => s.id === actor.id);}, [actor, visibleSquads]);+ const frequentActors = useMemo<ActorSelection[]>(+ () =>+ rankFrequentActors(+ countsAtOpen,+ [+ ...visibleAgents.map((a) => ({ type: "agent" as const, id: a.id })),+ ...visibleSquads.map((s) => ({ type: "squad" as const, id: s.id })),+ ],+ QUICK_SWITCH_SHORTCUTS.length,+ ),+ [countsAtOpen, visibleAgents, visibleSquads],+ );++ const pickActor = useCallback(+ (next: ActorSelection) => {+ setActor(next);+ setAgent({ actorType: next.type, actorId: next.id });+ setError(null);+ },+ [setAgent],+ );++ // Capture phase on the document so the chord is handled before the prompt+ // editor sees it: on macOS ⌥1 would otherwise type "¡".+ useEffect(() => {+ const onKeyDown = (e: KeyboardEvent) => {+ if (e.defaultPrevented || isImeComposing(e)) return;+ const index = QUICK_SWITCH_SHORTCUTS.findIndex((s) => shortcutMatchesEvent(s, e));+ const next = frequentActors[index];+ if (!next) return;+ e.preventDefault();+ e.stopPropagation();+ pickActor(next);+ };+ document.addEventListener("keydown", onKeyDown, true);+ return () => document.removeEventListener("keydown", onKeyDown, true);+ }, [frequentActors, pickActor]);+// Unfinished selections live in the shared issue-create draft. The// last-successful actor remains a separate fallback, so closing a draft// never overwrites the default established by an actual create.@@ -494,6 +554,7 @@ export function AgentCreatePanel({});}setLastActor(actor.type, actor.id);+ countActorCreate(actor.type, actor.id);setLastMode("agent");toast.success(t(($) => $.create_issue.agent.toast_sent), {duration: 4000,@@ -742,15 +803,12 @@ export function AgentCreatePanel({<div className="px-5 pt-1 pb-2 shrink-0"><ActorPickeractor={actor}+ frequentActors={frequentActors}visibleAgents={visibleAgents}visibleSquads={visibleSquads}selectedAgent={selectedAgent}selectedSquad={selectedSquad}- onPick={(next) => {- setActor(next);- setAgent({ actorType: next.type, actorId: next.id });- setError(null);- }}+ onPick={pickActor}t={t}/></div>@@ -1018,13 +1076,15 @@ export function AgentCreatePanel({);}-// ActorPicker — the "Created by" trigger + searchable popover listing-// agents and squads. Lives in this file (not under issues/components/pickers)-// because it composes the generic PropertyPicker with a quick-create-shaped-// trigger styled to match the modal header row — promoting it would invite-// reuse pressure on a UI that's deliberately tuned for this one surface.+// ActorPicker — the "Created by" row: one chip per frequently used actor+// (⌥1–⌥3), then a chevron opening the searchable popover of every agent and+// squad. A pick from the popover that is not one of the chips gets its own+// selected chip, so the ranked chips never shift under their shortcuts.+// Lives in this file (not under issues/components/pickers) because it is+// tuned for this one surface — promoting it would invite reuse pressure.function ActorPicker({actor,+ frequentActors,visibleAgents,visibleSquads,selectedAgent,@@ -1033,6 +1093,7 @@ function ActorPicker({t,}: {actor: ActorSelection | null;+ frequentActors: ActorSelection[];visibleAgents: Agent[];visibleSquads: Squad[];selectedAgent: Agent | undefined;@@ -1053,89 +1114,163 @@ function ActorPicker({[visibleSquads, query],);- const displayLabel = selectedSquad?.name ?? selectedAgent?.name;const displayActor: ActorSelection | null = selectedSquad? { type: "squad", id: selectedSquad.id }: selectedAgent? { type: "agent", id: selectedAgent.id }: null;+ const pinnedActor =+ displayActor && !frequentActors.some((a) => sameActor(a, displayActor)) ? displayActor : null;+ const nameOf = (a: ActorSelection) =>+ (a.type === "agent"+ ? visibleAgents.find((x) => x.id === a.id)?.name+ : visibleSquads.find((x) => x.id === a.id)?.name) ?? "";+ const allActorsLabel = t(($) => $.create_issue.agent.all_actors);+ const hasChips = frequentActors.length > 0;return (- <PropertyPicker- open={open}- onOpenChange={(v: boolean) => {- setOpen(v);- if (!v) setFilter("");- }}- width="w-64"- align="start"- searchable- searchPlaceholder={t(($) => $.create_issue.agent.search_placeholder)}- onSearchChange={setFilter}- trigger={- <span className="flex items-center gap-2 text-caption text-muted-foreground hover:text-foreground transition-colors">- <span>{t(($) => $.create_issue.agent.created_by)}</span>- {displayActor && displayLabel ? (- <span className="flex items-center gap-1.5 text-foreground">- <ActorAvatar- actorType={displayActor.type}- actorId={displayActor.id}- size="sm"- />- {displayLabel}- </span>+ <div className="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-caption">+ <span className="text-muted-foreground">{t(($) => $.create_issue.agent.created_by)}</span>+ <div+ role="group"+ aria-label={t(($) => $.create_issue.agent.frequent_actors_aria)}+ className="flex min-w-0 flex-wrap items-center gap-0.5"+ >+ {frequentActors.map((a, i) => (+ <ActorChip+ key={`${a.type}:${a.id}`}+ actor={a}+ name={nameOf(a)}+ selected={sameActor(a, displayActor)}+ shortcut={QUICK_SWITCH_SHORTCUTS[i]}+ onClick={() => onPick(a)}+ />+ ))}+ {pinnedActor && (+ <>+ <span aria-hidden="true" className="mx-1 h-3.5 w-px bg-border" />+ <ActorChip+ actor={pinnedActor}+ name={nameOf(pinnedActor)}+ selected+ onClick={() => onPick(pinnedActor)}+ />+ </>+ )}+ </div>+ <PropertyPicker+ open={open}+ onOpenChange={(v: boolean) => {+ setOpen(v);+ if (!v) setFilter("");+ }}+ width="w-64"+ align="start"+ searchable+ searchPlaceholder={t(($) => $.create_issue.agent.search_placeholder)}+ onSearchChange={setFilter}+ tooltip={hasChips ? allActorsLabel : undefined}+ triggerRender={+ <button+ type="button"+ aria-label={hasChips ? allActorsLabel : undefined}+ className={cn(+ "flex h-6 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60 hover:text-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground transition-colors cursor-pointer",+ hasChips ? "w-6" : "px-1.5",+ )}+ />+ }+ trigger={+ hasChips ? (+ <ChevronDown className="size-3.5" />) : (<span>{t(($) => $.create_issue.agent.pick_an_agent)}</span>- )}- </span>- }- >- {filteredAgents.length === 0 && filteredSquads.length === 0 ? (- query ? (- <PickerEmpty />+ )+ }+ >+ {filteredAgents.length === 0 && filteredSquads.length === 0 ? (+ query ? (+ <PickerEmpty />+ ) : (+ <div className="px-2 py-1.5 text-caption text-muted-foreground">+ {t(($) => $.create_issue.agent.no_agents)}+ </div>+ )) : (- <div className="px-2 py-1.5 text-caption text-muted-foreground">- {t(($) => $.create_issue.agent.no_agents)}- </div>- )- ) : (- <>- {filteredAgents.length > 0 && (- <PickerSection label={t(($) => $.create_issue.agent.agents_group)}>- {filteredAgents.map((a) => (- <PickerItem- key={a.id}- selected={actor?.type === "agent" && actor.id === a.id}- onClick={() => {- onPick({ type: "agent", id: a.id });- setOpen(false);- }}- >- <ActorAvatar actorType="agent" actorId={a.id} size="sm" />- <span className="truncate">{a.name}</span>- </PickerItem>- ))}- </PickerSection>- )}- {filteredSquads.length > 0 && (- <PickerSection label={t(($) => $.create_issue.agent.squads_group)}>- {filteredSquads.map((s) => (- <PickerItem- key={s.id}- selected={actor?.type === "squad" && actor.id === s.id}- onClick={() => {- onPick({ type: "squad", id: s.id });- setOpen(false);- }}- >- <ActorAvatar actorType="squad" actorId={s.id} size="sm" />- <span className="truncate">{s.name}</span>- </PickerItem>- ))}- </PickerSection>- )}- </>- )}- </PropertyPicker>+ <>+ {filteredAgents.length > 0 && (+ <PickerSection label={t(($) => $.create_issue.agent.agents_group)}>+ {filteredAgents.map((a) => (+ <PickerItem+ key={a.id}+ selected={actor?.type === "agent" && actor.id === a.id}+ onClick={() => {+ onPick({ type: "agent", id: a.id });+ setOpen(false);+ }}+ >+ <ActorAvatar actorType="agent" actorId={a.id} size="sm" />+ <span className="truncate">{a.name}</span>+ </PickerItem>+ ))}+ </PickerSection>+ )}+ {filteredSquads.length > 0 && (+ <PickerSection label={t(($) => $.create_issue.agent.squads_group)}>+ {filteredSquads.map((s) => (+ <PickerItem+ key={s.id}+ selected={actor?.type === "squad" && actor.id === s.id}+ onClick={() => {+ onPick({ type: "squad", id: s.id });+ setOpen(false);+ }}+ >+ <ActorAvatar actorType="squad" actorId={s.id} size="sm" />+ <span className="truncate">{s.name}</span>+ </PickerItem>+ ))}+ </PickerSection>+ )}+ </>+ )}+ </PropertyPicker>+ </div>+ );+}++function ActorChip({+ actor,+ name,+ selected,+ shortcut,+ onClick,+}: {+ actor: ActorSelection;+ name: string;+ selected: boolean;+ shortcut?: ShortcutChord;+ onClick: () => void;+}) {+ return (+ <TooltipHint+ label={name}+ shortcut={shortcut ? <ShortcutKeycaps shortcut={shortcut} decorative /> : undefined}+ >+ <button+ type="button"+ aria-pressed={selected}+ onClick={onClick}+ className={cn(+ "inline-flex h-6 min-w-0 max-w-36 items-center gap-1.5 rounded-md pr-2 pl-1 transition-colors cursor-pointer",+ selected+ ? "bg-surface-selected font-medium text-surface-selected-foreground"+ : "text-muted-foreground hover:bg-accent/60 hover:text-foreground",+ )}+ >+ <ActorAvatar actorType={actor.type} actorId={actor.id} size="xs" />+ <span className="truncate">{name}</span>+ </button>+ </TooltipHint>);}