Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Converge AI Chat message actions on shared Button primitives
rcourtman6559c37626b4
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex cc49d2de5a..9847db4a03 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -108,7 +108,10 @@ handlers, but their visible button chrome must compose the sharedHeader utilities, session row controls, transcript fallback close/downloadcontrols, activity-dock queued follow-up actions, composer send, footerhelp/route actions, and compact dismiss controls must not recreate local-h-6/h-7/h-8/h-9 icon-button class shells.+h-5/h-6/h-7/h-8/h-9 icon-button class shells. Message and tool transcript copy+controls own Assistant copy targets and copied-state timing, but their visible+copied-state icon chrome must compose `CopyValueButton` from the same shared+button primitive boundary rather than message- or tool-local copy/check shells.Assistant live workflow status follows OpenCode's current-state timelinemodel. CANONICAL (supersedes the per-row transcript-status rules elsewhere indiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 0601ac5852..4a6f163009 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -564,8 +564,12 @@ not a replacement status card, CTA band, or page-local nested card.actions, transcript fallback close/download actions, activity-dock queuedfollow-up controls, composer send, footer help/route actions, and compactdismiss controls: the Assistant owns chat/session behavior and copy, while- `ActionIconButton` owns h-6/h-7/h-8/h-9 sizing, outline, primary, accent,+ `ActionIconButton` owns h-5/h-6/h-7/h-8/h-9 sizing, outline, primary, accent,warning, info, danger, disabled, title, and focus chrome.+ AI Chat message and tool copy controls follow the copy-action boundary:+ MessageItem and ToolExecutionBlock own the copied text and timer semantics,+ while `CopyValueButton` owns copied-state iconography, disabled handling,+ focus, and embedded-row propagation behavior.Global app-shell prompts are part of the same action boundary.`frontend-modern/src/components/GitHubStarBanner.tsx` may own its displaytiming, product copy, and GitHub destination, but its primary, defer, anddiff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.jsonindex 2e7ae9d762..ee839d3d08 100644--- a/frontend-modern/scripts/shared-template-registry.json+++ b/frontend-modern/scripts/shared-template-registry.json@@ -1258,6 +1258,7 @@{ "path": "src/components/Alerts/AlertResourceTableRow.tsx" },{ "path": "src/components/Alerts/ResourceTable.tsx" },{ "path": "src/components/AI/Chat/index.tsx" },+ { "path": "src/components/AI/Chat/MessageItem.tsx" },{ "path": "src/components/Settings/RolesPanel.tsx" },{ "path": "src/components/Settings/SSOProvidersPanel.tsx" },{ "path": "src/features/standalone/AgentsMachinesTable.tsx" }@@ -1307,6 +1308,12 @@"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border bg-surface text-muted transition-colors hover:border-border hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30"]},+ {+ "path": "src/components/AI/Chat/MessageItem.tsx",+ "patterns": [+ "inline-flex h-5 w-5 items-center justify-center rounded text-blue-700 transition-colors hover:bg-blue-100 hover:text-blue-950 focus:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30"+ ]+ },{"path": "src/features/standalone/AgentsMachinesTable.tsx","patterns": [@@ -1345,11 +1352,30 @@"export": "CopyValueButton"},"requiredConsumers": [+ { "path": "src/components/AI/Chat/MessageItem.tsx" },+ { "path": "src/components/AI/Chat/ToolExecutionBlock.tsx" },{ "path": "src/components/Discovery/DiscoveryTab.tsx" },{ "path": "src/components/Settings/SSOProvidersPanel.tsx" },{ "path": "src/components/shared/WebInterfaceUrlField.tsx" }],"forbiddenPatterns": [+ {+ "path": "src/components/AI/Chat/MessageItem.tsx",+ "patterns": [+ "lucide-solid/icons/copy",+ "lucide-solid/icons/check';",+ "mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border-subtle bg-surface text-muted opacity-0 shadow-sm transition-opacity hover:text-base-content",+ "ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md border border-border-subtle bg-surface text-muted opacity-0 shadow-sm transition-opacity hover:text-base-content"+ ]+ },+ {+ "path": "src/components/AI/Chat/ToolExecutionBlock.tsx",+ "patterns": [+ "lucide-solid/icons/copy",+ "lucide-solid/icons/check';",+ "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border-subtle bg-surface text-muted transition-colors hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30"+ ]+ },{"path": "src/components/Discovery/DiscoveryTab.tsx","patterns": [@@ -3216,6 +3242,29 @@"scripts/shared-template-audit.mjs"]},+ {+ "id": "ai-chat-message-queued-action-icon-local-shell",+ "category": "action-button",+ "summary": "AI Chat queued message edit/remove actions must not recreate local 20px blue icon-button shells; compose ActionIconButton.",+ "canonical": {+ "path": "src/components/shared/Button.tsx",+ "export": "ActionIconButton"+ },+ "scopes": ["src/components/AI/Chat/MessageItem.tsx"],+ "extensions": [".tsx"],+ "allPatterns": [+ "inline-flex h-5 w-5 items-center justify-center rounded text-blue-700 transition-colors hover:bg-blue-100 hover:text-blue-950 focus:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30"+ ],+ "legacyReason": "Retired migration debt. AI Chat queued message icon actions belong to ActionIconButton.",+ "allowedPaths": [],+ "ignoredPaths": ["src/components/shared/Button.test.tsx"],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/Button.test.tsx",+ "src/components/AI/Chat/__tests__/MessageItem.test.tsx",+ "scripts/shared-template-audit.mjs"+ ]+ },{"id": "ai-chat-action-icon-header-local-shell","category": "action-button",@@ -3346,6 +3395,55 @@"scripts/shared-template-audit.mjs"]},+ {+ "id": "ai-chat-message-copy-value-local-shell",+ "category": "copy-action",+ "summary": "AI Chat user and assistant message copy controls must not recreate local copied-state icon shells; compose CopyValueButton.",+ "canonical": {+ "path": "src/components/shared/Button.tsx",+ "export": "CopyValueButton"+ },+ "scopes": ["src/components/AI/Chat/MessageItem.tsx"],+ "extensions": [".tsx"],+ "allPatterns": [+ "inline-flex h-7 w-7",+ "border border-border-subtle bg-surface text-muted opacity-0 shadow-sm transition-opacity hover:text-base-content",+ "CopyIcon class=\"h-3.5 w-3.5\""+ ],+ "legacyReason": "Retired migration debt. AI Chat message copy actions belong to CopyValueButton.",+ "allowedPaths": [],+ "ignoredPaths": ["src/components/shared/Button.test.tsx"],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/Button.test.tsx",+ "src/components/AI/Chat/__tests__/MessageItem.test.tsx",+ "scripts/shared-template-audit.mjs"+ ]+ },+ {+ "id": "ai-chat-tool-copy-value-local-shell",+ "category": "copy-action",+ "summary": "AI Chat tool command and detail copy controls must not recreate local copied-state icon shells; compose CopyValueButton.",+ "canonical": {+ "path": "src/components/shared/Button.tsx",+ "export": "CopyValueButton"+ },+ "scopes": ["src/components/AI/Chat/ToolExecutionBlock.tsx"],+ "extensions": [".tsx"],+ "allPatterns": [+ "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border-subtle bg-surface text-muted transition-colors hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30",+ "CopyIcon class=\"h-3 w-3\""+ ],+ "legacyReason": "Retired migration debt. AI Chat tool copy actions belong to CopyValueButton.",+ "allowedPaths": [],+ "ignoredPaths": ["src/components/shared/Button.test.tsx"],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/Button.test.tsx",+ "src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx",+ "scripts/shared-template-audit.mjs"+ ]+ },{"id": "settings-connection-editor-local-warning-callout-shell","category": "callout",diff --git a/frontend-modern/src/components/AI/Chat/MessageItem.tsx b/frontend-modern/src/components/AI/Chat/MessageItem.tsxindex c41902f067..82d2b9a069 100644--- a/frontend-modern/src/components/AI/Chat/MessageItem.tsx+++ b/frontend-modern/src/components/AI/Chat/MessageItem.tsx@@ -9,10 +9,8 @@ import {createSignal,onCleanup,} from 'solid-js';-import CheckIcon from 'lucide-solid/icons/check';import CircleAlertIcon from 'lucide-solid/icons/circle-alert';import ClockIcon from 'lucide-solid/icons/clock';-import CopyIcon from 'lucide-solid/icons/copy';import CpuIcon from 'lucide-solid/icons/cpu';import PencilIcon from 'lucide-solid/icons/pencil';import RotateCcwIcon from 'lucide-solid/icons/rotate-ccw';@@ -44,6 +42,7 @@ import type {} from './types';import { AI_CHAT_ASSISTANT_MESSAGE_LABEL } from '@/utils/aiChatPresentation';import { formatAIModelRouteLabel } from '@/utils/aiProviderPresentation';+import { ActionIconButton, CopyValueButton } from '@/components/shared/Button';import { copyToClipboard } from '@/utils/clipboard';interface MessageItemProps {@@ -523,9 +522,8 @@ export const MessageItem: Component<MessageItemProps> = (props) => {return getAssistantAnswerText(props.message);};const canCopy = () => !props.message.isStreaming && !!copyableMessageText();- const copyMessage = async (event?: MouseEvent) => {- event?.stopPropagation();- const text = copyableMessageText();+ const copyMessage = async (value: string) => {+ const text = value.trim();if (!text) return;const ok = await copyToClipboard(text);if (!ok) return;@@ -543,17 +541,15 @@ export const MessageItem: Component<MessageItemProps> = (props) => {<Show when={isUser()}><div class="group flex max-w-[85%] items-start justify-end gap-2"><Show when={canCopy()}>- <button- type="button"- onClick={(event) => void copyMessage(event)}- aria-label={copyButtonLabel()}- title={copyButtonLabel()}- class="mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border-subtle bg-surface text-muted opacity-0 shadow-sm transition-opacity hover:text-base-content focus:opacity-100 group-hover:opacity-100"- >- <Show when={copied()} fallback={<CopyIcon class="h-3.5 w-3.5" aria-hidden="true" />}>- <CheckIcon class="h-3.5 w-3.5 text-emerald-500" aria-hidden="true" />- </Show>- </button>+ <CopyValueButton+ value={copyableMessageText()}+ copied={copied()}+ onCopyValue={copyMessage}+ label={copyButtonLabel()}+ size="md"+ stopPropagation+ class="mt-1 opacity-0 shadow-sm transition-opacity focus:opacity-100 group-hover:opacity-100"+ /></Show><divclass={`min-w-0 px-4 py-2.5 rounded-md rounded-br-sm shadow-sm ${@@ -581,26 +577,24 @@ export const MessageItem: Component<MessageItemProps> = (props) => {)}</Show><Show when={props.onEditQueued}>- <button- type="button"+ <ActionIconButtononClick={() => props.onEditQueued?.()}- aria-label="Edit queued follow-up"- title="Edit queued follow-up"- class="inline-flex h-5 w-5 items-center justify-center rounded text-blue-700 transition-colors hover:bg-blue-100 hover:text-blue-950 focus:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30 dark:text-blue-200 dark:hover:bg-blue-900/60"+ label="Edit queued follow-up"+ tone="accentGhost"+ size="2xs"><PencilIcon class="h-3 w-3" aria-hidden="true" />- </button>+ </ActionIconButton></Show><Show when={props.onCancelQueued}>- <button- type="button"+ <ActionIconButtononClick={() => props.onCancelQueued?.()}- aria-label="Remove queued follow-up"- title="Remove queued follow-up"- class="inline-flex h-5 w-5 items-center justify-center rounded text-blue-700 transition-colors hover:bg-blue-100 hover:text-blue-950 focus:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30 dark:text-blue-200 dark:hover:bg-blue-900/60"+ label="Remove queued follow-up"+ tone="accentGhost"+ size="2xs"><XIcon class="h-3 w-3" aria-hidden="true" />- </button>+ </ActionIconButton></Show></div></Show>@@ -656,20 +650,15 @@ export const MessageItem: Component<MessageItemProps> = (props) => {</span></Show><Show when={canCopy()}>- <button- type="button"- onClick={(event) => void copyMessage(event)}- aria-label={copyButtonLabel()}- title={copyButtonLabel()}- class="ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md border border-border-subtle bg-surface text-muted opacity-0 shadow-sm transition-opacity hover:text-base-content focus:opacity-100 group-hover:opacity-100"- >- <Show- when={copied()}- fallback={<CopyIcon class="h-3.5 w-3.5" aria-hidden="true" />}- >- <CheckIcon class="h-3.5 w-3.5 text-emerald-500" aria-hidden="true" />- </Show>- </button>+ <CopyValueButton+ value={copyableMessageText()}+ copied={copied()}+ onCopyValue={copyMessage}+ label={copyButtonLabel()}+ size="md"+ stopPropagation+ class="ml-auto opacity-0 shadow-sm transition-opacity focus:opacity-100 group-hover:opacity-100"+ /></Show></div>diff --git a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsxindex 097b21cda8..e14aae332b 100644--- a/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx+++ b/frontend-modern/src/components/AI/Chat/ToolExecutionBlock.tsx@@ -8,15 +8,14 @@ import {For,createUniqueId,} from 'solid-js';-import CheckIcon from 'lucide-solid/icons/check';import CheckCircleIcon from 'lucide-solid/icons/check-circle';import ChevronRightIcon from 'lucide-solid/icons/chevron-right';import ClockIcon from 'lucide-solid/icons/clock';-import CopyIcon from 'lucide-solid/icons/copy';import LoaderCircleIcon from 'lucide-solid/icons/loader-circle';import XCircleIcon from 'lucide-solid/icons/x-circle';import type { ToolExecution, PendingTool, ToolCancellation } from './types';import { copyToClipboard } from '@/utils/clipboard';+import { CopyValueButton } from '@/components/shared/Button';import { getToolCallResultTextClass } from '@/utils/patrolRunPresentation';import {getToolLabel,@@ -186,9 +185,8 @@ const VisibleToolCommandPreview: Component<ToolCommandPreviewProps> = (props) =>const copyLabel = () => (copied() ? 'Copied tool command' : 'Copy tool command');const commandText = () => props.preview.replace(/^\$\s*/, '').trim() || props.preview.trim();- const copyCommand = async (event: MouseEvent) => {- event.stopPropagation();- const text = commandText();+ const copyCommand = async (value: string) => {+ const text = value.trim();if (!text) return;const ok = await copyToClipboard(text);if (!ok) return;@@ -214,19 +212,18 @@ const VisibleToolCommandPreview: Component<ToolCommandPreviewProps> = (props) =>>{props.preview}</code>- <button- type="button"- class="mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border-subtle bg-surface text-muted transition-colors hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30"- onClick={(event) => void copyCommand(event)}+ <CopyValueButton+ value={commandText()}+ copied={copied()}+ onCopyValue={copyCommand}+ label={copyLabel()}+ variant="neutral"+ size="sm"+ stopPropagation+ class="mt-0.5"onMouseDown={(event) => event.stopPropagation()}onKeyDown={handleKeyDown}- title={copyLabel()}- aria-label={copyLabel()}- >- <Show when={copied()} fallback={<CopyIcon class="h-3 w-3" aria-hidden="true" />}>- <CheckIcon class="h-3 w-3 text-emerald-600" aria-hidden="true" />- </Show>- </button>+ /></div>);};@@ -303,20 +300,15 @@ const ToolDetailsPanel: Component<ToolDetailsPanelProps> = (props) => {<div class="text-[9px] font-semibold uppercase tracking-wide text-muted">{detailTitle(detail.kind)}</div>- <button- type="button"- class="inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border-subtle bg-surface text-muted transition-colors hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30"- onClick={() => void copyDetail(detail.kind, detail.text)}- title={detailCopyLabel(detail.kind)}- aria-label={detailCopyLabel(detail.kind)}- >- <Show- when={copiedDetail() === detail.kind}- fallback={<CopyIcon class="h-3 w-3" aria-hidden="true" />}- >- <CheckIcon class="h-3 w-3 text-emerald-600" aria-hidden="true" />- </Show>- </button>+ <CopyValueButton+ value={detail.text}+ copied={copiedDetail() === detail.kind}+ onCopyValue={(value) => copyDetail(detail.kind, value)}+ label={detailCopyLabel(detail.kind)}+ variant="neutral"+ size="sm"+ stopPropagation+ /></div><pre class={detailPreClass(detail.kind)}>{detail.text}</pre></div>diff --git a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsxindex 6c5501b112..5370a96f9e 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx@@ -2,6 +2,7 @@ import { describe, expect, it, vi, afterEach } from 'vitest';import { cleanup, render, screen, fireEvent, waitFor } from '@solidjs/testing-library';import { createSignal } from 'solid-js';import { MessageItem } from '../MessageItem';+import messageItemSource from '../MessageItem.tsx?raw';import type { ChatMessage, PendingApproval, PendingQuestion, StreamDisplayEvent } from '../types';// Mock child components to isolate MessageItem logic@@ -126,6 +127,20 @@ function makeHandlers() {}describe('MessageItem', () => {+ it('keeps message copy and queued icon actions on shared Button primitives', () => {+ expect(messageItemSource).toContain('@/components/shared/Button');+ expect(messageItemSource).toContain('CopyValueButton');+ expect(messageItemSource).toContain('ActionIconButton');+ expect(messageItemSource).not.toContain("lucide-solid/icons/copy");+ expect(messageItemSource).not.toContain("lucide-solid/icons/check';");+ expect(messageItemSource).not.toContain(+ 'mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border-subtle bg-surface text-muted opacity-0 shadow-sm transition-opacity hover:text-base-content',+ );+ expect(messageItemSource).not.toContain(+ 'inline-flex h-5 w-5 items-center justify-center rounded text-blue-700 transition-colors hover:bg-blue-100 hover:text-blue-950 focus:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30',+ );+ });+describe('user message rendering', () => {it('renders user message in a compact bubble', () => {const { container } = render(() => (diff --git a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsxindex e137c4044a..e9593f29db 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/ToolExecutionBlock.test.tsx@@ -8,6 +8,7 @@ import {PendingToolsList,ToolExecutionsList,} from '../ToolExecutionBlock';+import toolExecutionBlockSource from '../ToolExecutionBlock.tsx?raw';import { ASSISTANT_FAST_TOOL_COMPLETION_SETTLE_MS } from '../streamActivityTiming';import type { ToolExecution, PendingTool, ToolCancellation } from '../types';@@ -55,6 +56,16 @@ const FAST_TOOL_SETTLE_TEST_MS = ASSISTANT_FAST_TOOL_COMPLETION_SETTLE_MS + 80;// ============================================================describe('ToolExecutionBlock', () => {+ it('keeps tool copy controls on the shared CopyValueButton primitive', () => {+ expect(toolExecutionBlockSource).toContain('@/components/shared/Button');+ expect(toolExecutionBlockSource).toContain('CopyValueButton');+ expect(toolExecutionBlockSource).not.toContain("lucide-solid/icons/copy");+ expect(toolExecutionBlockSource).not.toContain("lucide-solid/icons/check';");+ expect(toolExecutionBlockSource).not.toContain(+ 'inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border-subtle bg-surface text-muted transition-colors hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30',+ );+ });+// --- Tool label mapping ---it.each([diff --git a/frontend-modern/src/components/shared/Button.test.tsx b/frontend-modern/src/components/shared/Button.test.tsxindex 982521255c..435f20a4f3 100644--- a/frontend-modern/src/components/shared/Button.test.tsx+++ b/frontend-modern/src/components/shared/Button.test.tsx@@ -191,6 +191,7 @@ describe('Button', () => {it('renders copy-value icon and chip buttons through the shared primitive', () => {const onCopy = vi.fn();+ const onParentClick = vi.fn();render(() => (<>@@ -211,6 +212,14 @@ describe('Button', () => {<span>8443/tcp</span></CopyValueButton><CopyValueButton value=" " onCopyValue={onCopy} label="Copy blank" />+ <div onClick={onParentClick}>+ <CopyValueButton+ value="nested"+ onCopyValue={onCopy}+ label="Copy nested"+ stopPropagation+ />+ </div></>));@@ -225,6 +234,10 @@ describe('Button', () => {expect(chipButton).toHaveClass('text-[10px]');expect(screen.getByRole('button', { name: 'Copy blank' })).toBeDisabled();++ screen.getByRole('button', { name: 'Copy nested' }).click();+ expect(onCopy).toHaveBeenCalledWith('nested');+ expect(onParentClick).not.toHaveBeenCalled();});it('renders compact action icon buttons through the shared primitive', () => {@@ -232,6 +245,9 @@ describe('Button', () => {render(() => (<>+ <ActionIconButton label="Queued edit" tone="accentGhost" size="2xs">+ <span aria-hidden="true">Q</span>+ </ActionIconButton><ActionIconButton label="Edit thresholds" tone="accent" size="xs" onClick={onClick}><span aria-hidden="true">E</span></ActionIconButton>@@ -266,6 +282,7 @@ describe('Button', () => {expect(button).toHaveClass('w-6');expect(button).toHaveClass('bg-blue-50');+ expect(screen.getByRole('button', { name: 'Queued edit' })).toHaveClass('h-5');expect(screen.getByRole('button', { name: 'Open help' })).toHaveClass('border-border');expect(screen.getByRole('button', { name: 'Notifications enabled' })).toHaveClass('bg-surface-alt',diff --git a/frontend-modern/src/components/shared/Button.tsx b/frontend-modern/src/components/shared/Button.tsxindex 5ba54cca2b..12fa273274 100644--- a/frontend-modern/src/components/shared/Button.tsx+++ b/frontend-modern/src/components/shared/Button.tsx@@ -51,6 +51,7 @@ export interface CopyValueButtonProps extends Omit<label: string;variant?: CopyValueButtonVariant;size?: CopyValueButtonSize;+ stopPropagation?: boolean;class?: string;children?: JSX.Element;}@@ -179,6 +180,7 @@ export function CopyValueButton(props: CopyValueButtonProps) {'label','variant','size',+ 'stopPropagation','class','children','disabled',@@ -197,7 +199,8 @@ export function CopyValueButton(props: CopyValueButtonProps) {class: local.class,})}disabled={local.disabled || !trimmedValue()}- onClick={() => {+ onClick={(event) => {+ if (local.stopPropagation) event.stopPropagation();const value = trimmedValue();if (!value) return;void local.onCopyValue(value);diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex 060535d9be..b4b6b7d11c 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -10,6 +10,8 @@ import gitHubStarBannerSource from '@/components/GitHubStarBanner.tsx?raw';import assistantCommandHelpDialogSource from '@/components/AI/Chat/AssistantCommandHelpDialog.tsx?raw';import chatMessagesSource from '@/components/AI/Chat/ChatMessages.tsx?raw';import aiChatSource from '@/components/AI/Chat/index.tsx?raw';+import messageItemSource from '@/components/AI/Chat/MessageItem.tsx?raw';+import toolExecutionBlockSource from '@/components/AI/Chat/ToolExecutionBlock.tsx?raw';import findingsPanelSource from '@/components/AI/FindingsPanel.tsx?raw';import aiModelPickerSource from '@/components/shared/AIModelPicker.tsx?raw';import buttonSource from '@/components/shared/Button.tsx?raw';@@ -3000,6 +3002,15 @@ describe('shared primitive guardrails', () => {const aiChatActionIconFooterGuard = registry.patternGuards?.find((guard) => guard.id === 'ai-chat-action-icon-footer-local-shell',);+ const aiChatMessageQueuedActionGuard = registry.patternGuards?.find(+ (guard) => guard.id === 'ai-chat-message-queued-action-icon-local-shell',+ );+ const aiChatMessageCopyValueGuard = registry.patternGuards?.find(+ (guard) => guard.id === 'ai-chat-message-copy-value-local-shell',+ );+ const aiChatToolCopyValueGuard = registry.patternGuards?.find(+ (guard) => guard.id === 'ai-chat-tool-copy-value-local-shell',+ );const commandCopyGuard = registry.patternGuards?.find((guard) => guard.id === 'button-command-copy-local-shell',);@@ -3836,6 +3847,7 @@ describe('shared primitive guardrails', () => {'src/components/Alerts/AlertResourceTableRow.tsx','src/components/Alerts/ResourceTable.tsx','src/components/AI/Chat/index.tsx',+ 'src/components/AI/Chat/MessageItem.tsx','src/components/Settings/RolesPanel.tsx','src/components/Settings/SSOProvidersPanel.tsx','src/features/standalone/AgentsMachinesTable.tsx',@@ -3890,6 +3902,12 @@ describe('shared primitive guardrails', () => {'flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border bg-surface text-muted transition-colors hover:border-border hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30',]),}),+ expect.objectContaining({+ path: 'src/components/AI/Chat/MessageItem.tsx',+ patterns: expect.arrayContaining([+ 'inline-flex h-5 w-5 items-center justify-center rounded text-blue-700 transition-colors hover:bg-blue-100 hover:text-blue-950 focus:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30',+ ]),+ }),expect.objectContaining({path: 'src/features/standalone/AgentsMachinesTable.tsx',patterns: expect.arrayContaining([@@ -3937,6 +3955,20 @@ describe('shared primitive guardrails', () => {expect(standaloneAgentMachineActionGuard?.ignoredPaths).toEqual(['src/components/shared/Button.test.tsx',]);+ expect(aiChatMessageQueuedActionGuard?.canonical?.path).toBe(+ 'src/components/shared/Button.tsx',+ );+ expect(aiChatMessageQueuedActionGuard?.canonical?.export).toBe('ActionIconButton');+ expect(aiChatMessageQueuedActionGuard?.allPatterns).toEqual([+ 'inline-flex h-5 w-5 items-center justify-center rounded text-blue-700 transition-colors hover:bg-blue-100 hover:text-blue-950 focus:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30',+ ]);+ expect(aiChatMessageQueuedActionGuard?.scopes).toEqual([+ 'src/components/AI/Chat/MessageItem.tsx',+ ]);+ expect(aiChatMessageQueuedActionGuard?.allowedPaths ?? []).toHaveLength(0);+ expect(aiChatMessageQueuedActionGuard?.ignoredPaths).toEqual([+ 'src/components/shared/Button.test.tsx',+ ]);for (const guard of [aiChatActionIconHeaderGuard,aiChatActionIconAccentGuard,@@ -3971,10 +4003,54 @@ describe('shared primitive guardrails', () => {expect(copyValueRule?.canonical?.path).toBe('src/components/shared/Button.tsx');expect(copyValueRule?.canonical?.export).toBe('CopyValueButton');expect(copyValueRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual([+ 'src/components/AI/Chat/MessageItem.tsx',+ 'src/components/AI/Chat/ToolExecutionBlock.tsx','src/components/Discovery/DiscoveryTab.tsx','src/components/Settings/SSOProvidersPanel.tsx','src/components/shared/WebInterfaceUrlField.tsx',]);+ expect(copyValueRule?.forbiddenPatterns).toEqual(+ expect.arrayContaining([+ expect.objectContaining({+ path: 'src/components/AI/Chat/MessageItem.tsx',+ patterns: expect.arrayContaining([+ 'lucide-solid/icons/copy',+ "lucide-solid/icons/check';",+ 'mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border-subtle bg-surface text-muted opacity-0 shadow-sm transition-opacity hover:text-base-content',+ 'ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md border border-border-subtle bg-surface text-muted opacity-0 shadow-sm transition-opacity hover:text-base-content',+ ]),+ }),+ expect.objectContaining({+ path: 'src/components/AI/Chat/ToolExecutionBlock.tsx',+ patterns: expect.arrayContaining([+ 'lucide-solid/icons/copy',+ "lucide-solid/icons/check';",+ 'inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border-subtle bg-surface text-muted transition-colors hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30',+ ]),+ }),+ ]),+ );+ for (const guard of [aiChatMessageCopyValueGuard, aiChatToolCopyValueGuard]) {+ expect(guard?.canonical?.path).toBe('src/components/shared/Button.tsx');+ expect(guard?.canonical?.export).toBe('CopyValueButton');+ expect(guard?.allowedPaths ?? []).toHaveLength(0);+ expect(guard?.ignoredPaths).toEqual(['src/components/shared/Button.test.tsx']);+ }+ expect(aiChatMessageCopyValueGuard?.scopes).toEqual([+ 'src/components/AI/Chat/MessageItem.tsx',+ ]);+ expect(aiChatMessageCopyValueGuard?.allPatterns).toEqual([+ 'inline-flex h-7 w-7',+ 'border border-border-subtle bg-surface text-muted opacity-0 shadow-sm transition-opacity hover:text-base-content',+ 'CopyIcon class="h-3.5 w-3.5"',+ ]);+ expect(aiChatToolCopyValueGuard?.scopes).toEqual([+ 'src/components/AI/Chat/ToolExecutionBlock.tsx',+ ]);+ expect(aiChatToolCopyValueGuard?.allPatterns).toEqual([+ 'inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border-subtle bg-surface text-muted transition-colors hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30',+ 'CopyIcon class="h-3 w-3"',+ ]);expect(copyableCodeRowRule?.canonical?.path).toBe('src/components/shared/CopyableCodeRow.tsx');expect(copyableCodeRowRule?.canonical?.export).toBe('CopyableCodeRow');expect(copyableCodeRowRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual([@@ -4055,6 +4131,7 @@ describe('shared primitive guardrails', () => {expect(buttonModelSource).toContain('warningGhost:');expect(buttonModelSource).toContain('warningOutline:');expect(buttonModelSource).toContain('infoGhost:');+ expect(buttonModelSource).toContain(["'2xs'", ": 'h-5 w-5'"].join(''));expect(buttonModelSource).toContain(['lg', ": 'h-9 w-9'"].join(''));expect(buttonModelSource).toContain('dangerOutline:');expect(buttonModelSource).toContain('settingsAction:');@@ -4108,6 +4185,27 @@ describe('shared primitive guardrails', () => {expect(agentsMachinesTableSource).not.toContain('inline-flex h-7 w-7 items-center justify-center rounded-md text-muted transition-colors hover:bg-surface-hover hover:text-base-content focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/60',);+ expect(messageItemSource).toContain('@/components/shared/Button');+ expect(messageItemSource).toContain('ActionIconButton');+ expect(messageItemSource).toContain('CopyValueButton');+ expect(messageItemSource).not.toContain("lucide-solid/icons/copy");+ expect(messageItemSource).not.toContain("lucide-solid/icons/check';");+ expect(messageItemSource).not.toContain(+ 'mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border-subtle bg-surface text-muted opacity-0 shadow-sm transition-opacity hover:text-base-content',+ );+ expect(messageItemSource).not.toContain(+ 'ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md border border-border-subtle bg-surface text-muted opacity-0 shadow-sm transition-opacity hover:text-base-content',+ );+ expect(messageItemSource).not.toContain(+ 'inline-flex h-5 w-5 items-center justify-center rounded text-blue-700 transition-colors hover:bg-blue-100 hover:text-blue-950 focus:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30',+ );+ expect(toolExecutionBlockSource).toContain('@/components/shared/Button');+ expect(toolExecutionBlockSource).toContain('CopyValueButton');+ expect(toolExecutionBlockSource).not.toContain("lucide-solid/icons/copy");+ expect(toolExecutionBlockSource).not.toContain("lucide-solid/icons/check';");+ expect(toolExecutionBlockSource).not.toContain(+ 'inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border-subtle bg-surface text-muted transition-colors hover:bg-surface-hover hover:text-base-content focus:outline-none focus:ring-2 focus:ring-blue-500/30',+ );expect(resourceDetailDrawerDebugTabSource).toContain('@/components/shared/Button');expect(resourceDetailDrawerDebugTabSource).not.toContain('rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-medium text-base-content',diff --git a/frontend-modern/src/components/shared/buttonModel.ts b/frontend-modern/src/components/shared/buttonModel.tsindex 0d750ccbac..070e57c064 100644--- a/frontend-modern/src/components/shared/buttonModel.ts+++ b/frontend-modern/src/components/shared/buttonModel.ts@@ -93,7 +93,7 @@ export type ActionIconButtonTone =| 'warningOutline'| 'infoGhost'| 'danger';-export type ActionIconButtonSize = 'xs' | 'sm' | 'md' | 'lg';+export type ActionIconButtonSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg';export const COPY_VALUE_BUTTON_BASE_CLASS ='inline-flex shrink-0 items-center justify-center rounded transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50';@@ -157,6 +157,7 @@ export const ACTION_ICON_BUTTON_TONE_CLASSES: Record<ActionIconButtonTone, strin};export const ACTION_ICON_BUTTON_SIZE_CLASSES: Record<ActionIconButtonSize, string> = {+ '2xs': 'h-5 w-5',xs: 'h-6 w-6',sm: 'h-7 w-7',md: 'h-8 w-8',