diff --git a/apps/backend/cmd/plugin-fixture/fixture-package/ui/bundle.js b/apps/backend/cmd/plugin-fixture/fixture-package/ui/bundle.js index 643342bcb2..41efdfb9e8 100644 --- a/apps/backend/cmd/plugin-fixture/fixture-package/ui/bundle.js +++ b/apps/backend/cmd/plugin-fixture/fixture-package/ui/bundle.js @@ -13,8 +13,9 @@ * end to end: a "Notes" task panel (registerTaskPanel, mobile-enabled) that * round-trips a single per-user document through host.storage * (get on mount, debounced set, subscribe to pick up a write from another - * tab/surface), a task-card-indicators slot component, and a - * registerTaskMenuAction under the kanban card's "edit" group. + * tab/surface), a task-card-indicators slot component, a task-card-tags slot + * component, and a registerTaskMenuAction under the kanban card's "edit" + * group. * * The task-created counter lives in module scope (not component state) with * a tiny listener set, so it survives across route navigations (the page @@ -173,6 +174,15 @@ ); } + function CardTags(props) { + var slotProps = props.slotProps || {}; + return jsx( + "span", + { "data-testid": "e2e-card-tags", "data-task-id": slotProps.taskId }, + "tags", + ); + } + function StatusSlot(props) { var slotProps = props.slotProps || {}; var id = slotProps.placement === "left" ? "hello-status-left" : "hello-status-right"; @@ -209,6 +219,7 @@ mobileEnabled: true, }); registry.registerComponent("task-card-indicators", CardIndicator); + registry.registerComponent("task-card-tags", CardTags); registry.registerTaskMenuAction({ id: "enhance-notes", label: "Enhance notes", diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md index 9a58b7d829..9af1bb93d8 100644 --- a/apps/web/AGENTS.md +++ b/apps/web/AGENTS.md @@ -284,7 +284,7 @@ plugin leaks a stale registration. (`session-mobile-bottom-nav.tsx`) with `presentation: "mobile"`. - **Kanban card contributions:** `registerTaskMenuAction({ group: "edit", ... })` turns the flat `Edit` item into an `Edit` submenu (`kanban-card-edit-submenu.tsx`); - `registerComponent("task-card-indicators", ...)` renders beside `PRTaskIcon` via ``. + `registerComponent("task-card-indicators", ...)` renders beside `PRTaskIcon` via ``; `task-card-tags` renders in its own row below the badges (for contributions too wide for the title-row indicators spot, e.g. tag chips). - **`host.storage`:** authenticated per-user key/value storage (`lib/plugins/host-api.ts`), backed by `/api/plugins/{id}/user-state/...` (`docs/decisions/2026-08-01-per-user-plugin-storage.md`). `subscribe` (`lib/plugins/user-state-sync.ts`) wraps `registerWsHandler` with own-plugin filtering diff --git a/apps/web/components/kanban-card-content.test.tsx b/apps/web/components/kanban-card-content.test.tsx index 6f89f52ab1..2d6f1d61b8 100644 --- a/apps/web/components/kanban-card-content.test.tsx +++ b/apps/web/components/kanban-card-content.test.tsx @@ -25,32 +25,120 @@ const TASK: Task = { workflowStepId: "step-1", }; +const NOTES_PLUGIN_ID = "kandev-plugin-notes"; +const SECOND_PLUGIN_ID = "kandev-plugin-second"; +const TAGS_TEST_ID = "plugin-tags"; +const TAGS_SLOT = "task-card-tags"; +const INDICATOR_TEST_ID = "plugin-indicator"; +const SLOT_PROPS_TEXT = "task-1|ws-1|step-1"; + +function SlotPropsProbe({ testId, slotProps }: { testId: string; slotProps?: unknown }) { + const props = slotProps as { taskId: string; workspaceId: string; workflowStepId: string }; + return ( + + {props.taskId}|{props.workspaceId}|{props.workflowStepId} + + ); +} + afterEach(() => { cleanup(); - pluginRegistry.unregisterPlugin("kandev-plugin-notes"); + pluginRegistry.unregisterPlugin(NOTES_PLUGIN_ID); + pluginRegistry.unregisterPlugin(SECOND_PLUGIN_ID); }); describe("KanbanCardBody — task-card-indicators slot", () => { it("renders no extra markup when no plugin is registered for the slot (AC14)", () => { const { container } = render(); - expect(container.querySelector('[data-testid="plugin-indicator"]')).toBeNull(); + expect(container.querySelector(`[data-testid="${INDICATOR_TEST_ID}"]`)).toBeNull(); }); it("renders a registered indicator with taskId/workspaceId/workflowStepId as slotProps (AC13)", () => { function Indicator({ slotProps }: { slotProps?: unknown }) { - const props = slotProps as { taskId: string; workspaceId: string; workflowStepId: string }; - return ( - - {props.taskId}|{props.workspaceId}|{props.workflowStepId} - - ); + return ; } - pluginRegistry - .forPlugin("kandev-plugin-notes") - .registerComponent("task-card-indicators", Indicator); + pluginRegistry.forPlugin(NOTES_PLUGIN_ID).registerComponent("task-card-indicators", Indicator); render(); - expect(screen.getByTestId("plugin-indicator").textContent).toBe("task-1|ws-1|step-1"); + expect(screen.getByTestId(INDICATOR_TEST_ID).textContent).toBe(SLOT_PROPS_TEXT); + }); +}); + +describe("KanbanCardBody — task-card-tags slot", () => { + it("renders no extra markup when no plugin is registered for the slot (AC3)", () => { + const { container } = render(); + expect(container.querySelector(`[data-testid="${TAGS_TEST_ID}"]`)).toBeNull(); + }); + + it("renders a registered tags component with taskId/workspaceId/workflowStepId as slotProps (AC2)", () => { + function Tags({ slotProps }: { slotProps?: unknown }) { + return ; + } + pluginRegistry.forPlugin(NOTES_PLUGIN_ID).registerComponent(TAGS_SLOT, Tags); + + render(); + + expect(screen.getByTestId(TAGS_TEST_ID).textContent).toBe(SLOT_PROPS_TEXT); + }); + + it("renders as its own row, distinct from the title row that hosts task-card-indicators (AC2)", () => { + function Tags() { + return ; + } + function Indicator() { + return ; + } + pluginRegistry.forPlugin(NOTES_PLUGIN_ID).registerComponent(TAGS_SLOT, Tags); + pluginRegistry.forPlugin(NOTES_PLUGIN_ID).registerComponent("task-card-indicators", Indicator); + + render(); + + const titleRow = screen.getByTestId("kanban-card-title-row"); + const tags = screen.getByTestId(TAGS_TEST_ID); + const indicator = screen.getByTestId(INDICATOR_TEST_ID); + expect(titleRow.contains(indicator)).toBe(true); + expect(titleRow.contains(tags)).toBe(false); + }); + + it("renders both plugins registered for the slot, in registration order (AC4)", () => { + function First() { + return ; + } + function Second() { + return ; + } + pluginRegistry.forPlugin(NOTES_PLUGIN_ID).registerComponent(TAGS_SLOT, First); + pluginRegistry.forPlugin(SECOND_PLUGIN_ID).registerComponent(TAGS_SLOT, Second); + + render(); + + const first = screen.getByTestId("tags-first"); + const second = screen.getByTestId("tags-second"); + expect(first.compareDocumentPosition(second) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); + }); + + it("isolates a throwing task-card-tags component so the card and other slot components still render (AC6)", () => { + function ThrowingTags(): never { + throw new Error("boom"); + } + function OtherIndicator() { + return ; + } + // Suppress the expected React error-boundary console noise for this test. + const consoleError = vi.spyOn(console, "error").mockImplementation(() => {}); + try { + pluginRegistry.forPlugin(NOTES_PLUGIN_ID).registerComponent(TAGS_SLOT, ThrowingTags); + pluginRegistry + .forPlugin(NOTES_PLUGIN_ID) + .registerComponent("task-card-indicators", OtherIndicator); + + render(); + + expect(screen.getByTestId("task-card-title").textContent).toBe(TASK.title); + expect(screen.getByTestId(INDICATOR_TEST_ID)).toBeTruthy(); + } finally { + consoleError.mockRestore(); + } }); }); diff --git a/apps/web/components/kanban-card-content.tsx b/apps/web/components/kanban-card-content.tsx index fc19e09cf9..c41361cbb2 100644 --- a/apps/web/components/kanban-card-content.tsx +++ b/apps/web/components/kanban-card-content.tsx @@ -18,11 +18,11 @@ import { Checkbox } from "@kandev/ui/checkbox"; import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from "@kandev/ui/dropdown-menu"; import { Tooltip, TooltipContent, TooltipTrigger } from "@kandev/ui/tooltip"; import { PRTaskIcon } from "@/components/github/pr-task-icon"; -import { PluginSlot } from "@/components/plugins/plugin-slot"; import { KanbanCardDropdownMenuItems, type KanbanCardMenuEntry, } from "@/components/kanban-card-menu-items"; +import { TaskCardIndicators, TaskCardTags } from "@/components/kanban-card-plugin-slots"; import { useAppStore, useAppStoreApi } from "@/components/state-provider"; import { RemoteCloudTooltip } from "@/components/task/remote-cloud-tooltip"; import { useTaskPendingInput } from "@/hooks/use-task-pending-input"; @@ -126,22 +126,6 @@ function RepoChipRow({ chips }: { chips: RepositoryChip[] }) { ); } -/** - * `task-card-indicators` slot (AC13): reads the active workspace from the - * store itself, rather than threading `workspaceId` through the - * KanbanCardFrame -> KanbanCardShell -> KanbanCardBody prop chain, since - * `` already renders nothing when the slot is empty (AC14). - */ -function TaskCardIndicators({ task }: { task: Task }) { - const workspaceId = useAppStore((state) => state.workspaces.activeId); - return ( - - ); -} - export function KanbanCardBody({ task, repositoryChips, @@ -156,7 +140,7 @@ export function KanbanCardBody({
-
+

+ ); } diff --git a/apps/web/components/kanban-card-plugin-slots.tsx b/apps/web/components/kanban-card-plugin-slots.tsx new file mode 100644 index 0000000000..785a7abcf1 --- /dev/null +++ b/apps/web/components/kanban-card-plugin-slots.tsx @@ -0,0 +1,37 @@ +"use client"; + +import { PluginSlot } from "@/components/plugins/plugin-slot"; +import { useAppStore } from "@/components/state-provider"; +import type { Task } from "@/components/kanban-card"; + +/** + * `task-card-indicators` slot (AC13): reads the active workspace from the + * store itself, rather than threading `workspaceId` through the + * KanbanCardFrame -> KanbanCardShell -> KanbanCardBody prop chain, since + * `` already renders nothing when the slot is empty (AC14). + */ +export function TaskCardIndicators({ task }: { task: Task }) { + const workspaceId = useAppStore((state) => state.workspaces.activeId); + return ( + + ); +} + +/** + * `task-card-tags` slot: unlike `task-card-indicators` (cramped, inline + * beside the title/PR icon), this renders in its own row on the card so a + * contribution like a row of tag chips has room. Same `slotProps` shape as + * `task-card-indicators` — `{ taskId, workspaceId, workflowStepId }`. + */ +export function TaskCardTags({ task }: { task: Task }) { + const workspaceId = useAppStore((state) => state.workspaces.activeId); + return ( + + ); +} diff --git a/apps/web/e2e/fixtures/test-base.ts b/apps/web/e2e/fixtures/test-base.ts index 135fa6ee2b..f66c8567da 100644 --- a/apps/web/e2e/fixtures/test-base.ts +++ b/apps/web/e2e/fixtures/test-base.ts @@ -196,6 +196,7 @@ export const test = backendFixture.extend< mcp_task_agent_profile_default: "current_task", sidebar_views: [DEFAULT_SIDEBAR_VIEW], sidebar_active_view_id: DEFAULT_SIDEBAR_VIEW.id, + sidebar_draft: null, saved_layouts: [], lsp_auto_start_languages: [], lsp_auto_install_languages: [], @@ -332,6 +333,7 @@ test.beforeEach(async ({ apiClient, seedData }) => { mcp_task_agent_profile_default: "current_task", sidebar_views: [DEFAULT_SIDEBAR_VIEW], sidebar_active_view_id: DEFAULT_SIDEBAR_VIEW.id, + sidebar_draft: null, saved_layouts: [], lsp_auto_start_languages: [], lsp_auto_install_languages: [], diff --git a/apps/web/e2e/helpers/api-client.ts b/apps/web/e2e/helpers/api-client.ts index e4bb832fe1..797b0c40aa 100644 --- a/apps/web/e2e/helpers/api-client.ts +++ b/apps/web/e2e/helpers/api-client.ts @@ -923,6 +923,8 @@ export class ApiClient { default_utility_agent_id?: string; default_utility_model?: string; sidebar_views?: unknown[]; + sidebar_active_view_id?: string; + sidebar_draft?: unknown; saved_layouts?: unknown[]; lsp_auto_start_languages?: string[]; lsp_auto_install_languages?: string[]; diff --git a/apps/web/e2e/pages/session-page.ts b/apps/web/e2e/pages/session-page.ts index b2ec2705dc..62df0cbbf3 100644 --- a/apps/web/e2e/pages/session-page.ts +++ b/apps/web/e2e/pages/session-page.ts @@ -1006,6 +1006,7 @@ export class SessionPage { */ async sendMessage(text: string) { const editor = await this.composerReady(); + await this.waitForDirectInput(); await editor.click(); await editor.fill(text); const modifier = process.platform === "darwin" ? "Meta" : "Control"; @@ -1018,6 +1019,7 @@ export class SessionPage { */ async sendMessageViaButton(text: string) { const editor = await this.composerReady(); + await this.waitForDirectInput(); await editor.click(); await editor.fill(text); const isTouch = await this.page.evaluate(() => window.matchMedia("(pointer: coarse)").matches); @@ -1028,6 +1030,24 @@ export class SessionPage { await this.clickSubmitWhenReady(); } + /** + * Wait until the composer is in direct-input mode — the idle placeholder + * ("Continue working on the task...") visible, not the queue affordance + * ("Queue instructions to the agent..."). + * + * The submit button stays enabled while the session is busy (the queue + * affordance lets you type-and-queue), and `composerReady()` only checks + * editability, so a send right after a turn completes can race the store's + * RUNNING→WAITING_FOR_INPUT transition and silently queue the message + * instead of delivering it. Gating the send on the idle placeholder makes + * sends to an idle session deterministic: typing only starts once the store + * session state is genuinely promptable. Must run on an empty editor — the + * placeholder decoration is only rendered while the editor has no content. + */ + async waitForDirectInput(timeout = 15_000) { + await expect(this.anyIdleInput()).toBeVisible({ timeout }); + } + /** The composer's send/submit button (scoped to the active chat panel). */ submitButton(): Locator { return this.activeChat().getByTestId("submit-message-button"); diff --git a/apps/web/e2e/tests/plugins/plugin-task-card-tags.spec.ts b/apps/web/e2e/tests/plugins/plugin-task-card-tags.spec.ts new file mode 100644 index 0000000000..213772b572 --- /dev/null +++ b/apps/web/e2e/tests/plugins/plugin-task-card-tags.spec.ts @@ -0,0 +1,96 @@ +/** + * E2E: the `task-card-tags` slot (docs/plans/plugins/PLUGIN-API.md), added + * alongside `task-card-indicators` so a Kanban-card contribution too wide for + * the cramped title-row spot (e.g. a row of tag chips) gets its own row. + * + * Uses the same real `plugin-fixture` gRPC plugin package as + * `plugin-task-panel.spec.ts` — see that file's header for how + * apps/backend/.build/kandev-plugin-e2e-1.0.0.tar.gz is built + * (`make -C apps/backend e2e-plugin-package`). The fixture's `ui/bundle.js` + * registers a `task-card-tags` slot component alongside `task-card-indicators` + * — see apps/backend/cmd/plugin-fixture/fixture-package/ui/bundle.js. + */ +import { expect, test } from "../../fixtures/test-base"; +import { installFixturePlugin, PLUGIN_ID } from "../../helpers/plugin-fixture"; +import { KanbanPage } from "../../pages/kanban-page"; +import type { ApiClient } from "../../helpers/api-client"; + +async function uninstallViaApi(apiClient: ApiClient): Promise { + await apiClient.rawRequest("DELETE", `/api/plugins/${PLUGIN_ID}`).catch(() => undefined); +} + +test.describe("Plugins — task-card-tags slot", () => { + test.afterEach(async ({ apiClient }) => { + await uninstallViaApi(apiClient); + }); + + test("task-card-tags slot renders the plugin's component on the kanban card (AC2)", async ({ + testPage, + apiClient, + seedData, + }) => { + test.setTimeout(60_000); + + await installFixturePlugin(testPage); + + const seedTask = await apiClient.createTask(seedData.workspaceId, "Plugin card tags task", { + workflow_id: seedData.workflowId, + workflow_step_id: seedData.startStepId, + }); + await testPage.goto("/"); + const kanban = new KanbanPage(testPage); + await expect(kanban.board).toBeVisible({ timeout: 15_000 }); + + const tags = kanban.taskCard(seedTask.id).getByTestId("e2e-card-tags"); + await expect(tags).toBeVisible({ timeout: 15_000 }); + await expect(tags).toHaveAttribute("data-task-id", seedTask.id); + }); + + test("no task-card-tags markup renders when the plugin isn't installed (AC3)", async ({ + testPage, + apiClient, + seedData, + }) => { + test.setTimeout(60_000); + + const seedTask = await apiClient.createTask(seedData.workspaceId, "No plugin card tags task", { + workflow_id: seedData.workflowId, + workflow_step_id: seedData.startStepId, + }); + await testPage.goto("/"); + const kanban = new KanbanPage(testPage); + await expect(kanban.board).toBeVisible({ timeout: 15_000 }); + + await expect(kanban.taskCard(seedTask.id).getByTestId("e2e-card-tags")).toHaveCount(0); + }); + + test("disabling the plugin removes its task-card-tags component from the card without a reload (AC5)", async ({ + testPage, + apiClient, + seedData, + }) => { + test.setTimeout(60_000); + + await installFixturePlugin(testPage); + const pluginRow = testPage.getByTestId(`plugin-row-${PLUGIN_ID}`); + + const seedTask = await apiClient.createTask(seedData.workspaceId, "Disable card tags task", { + workflow_id: seedData.workflowId, + workflow_step_id: seedData.startStepId, + }); + await testPage.goto("/"); + const kanban = new KanbanPage(testPage); + await expect(kanban.board).toBeVisible({ timeout: 15_000 }); + + const tags = kanban.taskCard(seedTask.id).getByTestId("e2e-card-tags"); + await expect(tags).toBeVisible({ timeout: 15_000 }); + + await testPage.goto("/settings/plugins"); + await pluginRow.getByRole("button", { name: "Disable" }).click(); + await expect(pluginRow.getByText("Disabled", { exact: true })).toBeVisible({ timeout: 10_000 }); + + await testPage.goto("/"); + await expect(kanban.board).toBeVisible({ timeout: 15_000 }); + await expect(kanban.taskCard(seedTask.id).getByTestId("e2e-card-tags")).toHaveCount(0); + }); +}); diff --git a/apps/web/lib/plugins/types.ts b/apps/web/lib/plugins/types.ts index f72979edc6..676b5d0abb 100644 --- a/apps/web/lib/plugins/types.ts +++ b/apps/web/lib/plugins/types.ts @@ -90,7 +90,11 @@ export interface PluginRouteOptions { * another plugin's page and authors don't gate on the current id themselves. * "task-card-indicators" (small icon/badge rendered beside the PR status icon * on every kanban card — receives `{ taskId, workspaceId, workflowStepId }` - * as `slotProps`). Not a closed union — hosts may register additional slot names. + * as `slotProps`), and "task-card-tags" (its own row on every kanban card, + * rendered below the badges row — for contributions too wide for the cramped + * title-row `task-card-indicators` spot, e.g. a row of tag chips — receives + * `TaskCardTagsSlotProps` as `slotProps`). Not a closed union — hosts may + * register additional slot names. */ export type PluginSlotName = string; @@ -108,6 +112,13 @@ export type AppStatusBarSlotProps = { activeSessionId: string | null; }; +/** Context the host passes to the `task-card-tags` slot on every kanban card. */ +export type TaskCardTagsSlotProps = { + taskId: string; + workspaceId: string | null; + workflowStepId: string | null; +}; + /** Component registered for a named slot; receives host-provided `slotProps`. */ export type SlotComponent = ReactType.ComponentType<{ slotProps?: unknown }>; diff --git a/docs/plans/plugins/PLUGIN-API.md b/docs/plans/plugins/PLUGIN-API.md index 8b93b2fd63..56f3fe7e5a 100644 --- a/docs/plans/plugins/PLUGIN-API.md +++ b/docs/plans/plugins/PLUGIN-API.md @@ -289,11 +289,17 @@ interface PluginRegistry { // . Initial slots: "task-sidebar", // "settings-nav", "chat-input-actions", "chat-top-bar", // "main-top-bar", "app-status-bar-left", "app-status-bar-right", - // "plugin-settings", and "task-card-indicators". + // "plugin-settings", "task-card-indicators", and "task-card-tags". // "task-card-indicators" renders a small icon/badge beside the PR status // icon on every kanban card and forwards // `{ taskId, workspaceId, workflowStepId }` as `slotProps`. Not a closed // union — hosts may register additional slot names. + // "task-card-tags" renders in its own row on every kanban card, below the + // badges row — for contributions too wide for the cramped title-row + // "task-card-indicators" spot (e.g. a row of tag chips) — and forwards the + // same `{ taskId: string, workspaceId: string | null, workflowStepId: string | null }` + // shape as `slotProps` (`workspaceId` is null with no active workspace, and + // `workflowStepId` is null when the task has no workflow step assigned). // "chat-input-actions" renders icon buttons in the chat composer toolbar // (beside the model picker, mic, and send) and forwards // `{ taskId, taskTitle, activeSessionId, sessionIds }` as `slotProps`. @@ -508,6 +514,12 @@ one). matching read-only surface: a small icon/badge rendered beside the PR status icon on every card, receiving `{ taskId, workspaceId, workflowStepId }`. +`"task-card-tags"` is a second, sibling read-only surface for the same +context — same `{ taskId, workspaceId, workflowStepId }` shape — but mounted +in its own row on the card instead of the cramped title row +`"task-card-indicators"` shares with `PRTaskIcon`. Use it for a contribution +that needs its own width, e.g. a row of tag chips. + ### Task filters `registerTaskFilter` adds one section to the kanban board's display dropdown @@ -565,8 +577,9 @@ defaults, or the bare component when the route opted out (`topbar: false`). (`components/task/chat/chat-input-toolbar-desktop.tsx` and `-mobile.tsx`, via `chat-input-plugin-actions.tsx`) hosts the `chat-input-actions` slot, passing - `{ taskId, taskTitle, activeSessionId, sessionIds }`. `kanban-card-content.tsx` - hosts `task-card-indicators` beside `PRTaskIcon`. + `{ taskId, taskTitle, activeSessionId, sessionIds }`. `kanban-card-plugin-slots.tsx` + hosts `task-card-indicators` beside `PRTaskIcon` and `task-card-tags` as its + own row, both mounted from `kanban-card-content.tsx`'s `KanbanCardBody`. - `components/task/dockview-shared.tsx` / `dockview-panel-content.tsx` / `dockview-desktop-layout.tsx`: the generic `"plugin-panel"` dockview component + `pluginPanelTab`, and `renderPanel`'s `"plugin-panel"` case diff --git a/docs/public/plugins-authoring.md b/docs/public/plugins-authoring.md index f0a297e361..13ff209841 100644 --- a/docs/public/plugins-authoring.md +++ b/docs/public/plugins-authoring.md @@ -214,6 +214,7 @@ to strings, but an unmounted name renders nowhere. | app-status-bar-right | Right side of desktop status bar or mobile status drawer | AppStatusBarSlotProps | | plugin-settings | Top of this plugin's Settings > Plugins page | { pluginId, status }; owner-scoped to the plugin being viewed | | task-card-indicators | Kanban card, beside the PR status icon | { taskId, workspaceId, workflowStepId } | +| task-card-tags | Kanban card, its own row below the badges row | { taskId, workspaceId, workflowStepId } | AppStatusBarSlotProps is { placement, presentation, density, pathname, activeWorkspaceId, activeTaskId, activeSessionId }. Desktop presentation is a @@ -663,10 +664,14 @@ menu — group `"edit"` nests it inside the `Edit` submenu, group `"primary"` renders it as a flat, top-level item positioned between the "Move to"/"Send to workflow" submenus and the "Link" submenu. `task-card-indicators` (see the named slots table) is the matching read-only -surface, rendered beside the PR status icon on every card. Both `visible(context)` -and `run(context)` receive the card's actual `presentation`: `"desktop"` on the -desktop kanban and `"mobile"` on the phone kanban. Use it when an action needs to -choose responsive behavior; the host supplies it through the card composition. +surface, rendered beside the PR status icon on every card. `task-card-tags` +is a sibling read-only surface with the same `slotProps` shape, mounted in its +own row instead of that cramped title-row spot — reach for it when a +contribution (e.g. a row of tag chips) needs its own width. Both +`visible(context)` and `run(context)` receive the card's actual `presentation`: +`"desktop"` on the desktop kanban and `"mobile"` on the phone kanban. Use it +when an action needs to choose responsive behavior; the host supplies it +through the card composition. ```js registry.registerTaskMenuAction({ diff --git a/docs/specs/plugins/spec.md b/docs/specs/plugins/spec.md index 2b0ffd63e8..638de0476c 100644 --- a/docs/specs/plugins/spec.md +++ b/docs/specs/plugins/spec.md @@ -629,6 +629,10 @@ Mattermost-webapp model), not iframes. The full contract lives in without blocking the menu from closing. `registerComponent("task-card-indicators", C)` renders `C` beside the PR status icon on every kanban card, receiving `{ taskId, workspaceId, workflowStepId }` as `slotProps`. + `registerComponent("task-card-tags", C)` renders `C` in its own row on every + kanban card (below the badges row), receiving the same + `{ taskId, workspaceId, workflowStepId }` shape — for a contribution too wide + for the cramped title-row `task-card-indicators` spot, e.g. a row of tag chips. - **`host.storage`:** authenticated, per-user key/value storage (`get`/`set`/`delete`/`list`/`subscribe`), backed by the `plugin_user_state` table (separate from the plugin-backend-only `plugin_state` table — no gRPC/proto @@ -912,6 +916,18 @@ complete. **WHEN** cleanup later succeeds and uninstall is retried, **THEN** all users' rows, the package, and the record are removed. +- **GIVEN** a plugin registers a component for `"task-card-tags"`, **WHEN** any + kanban card renders, **THEN** that component mounts in its own row (distinct + from the title row hosting `"task-card-indicators"`), receiving exactly + `{ taskId, workspaceId, workflowStepId }` for that card. **GIVEN** no plugin + is registered for the slot, **WHEN** a card renders, **THEN** no extra DOM + node or empty-row spacing appears. **GIVEN** two plugins register for + `"task-card-tags"`, **WHEN** a card renders, **THEN** both render, in + registration order. **GIVEN** a `"task-card-tags"` component throws during + render, **WHEN** that card renders, **THEN** the card's title and its other + slot components (e.g. `"task-card-indicators"`) still render, isolated by + the existing per-registration error boundary. + ## Out of scope - **Remote / operator-hosted plugin tier.** The earlier `base_url` registration model,