Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(agents): move image warnings into attachment actions (#8990)
Wolf Mermelstein01684b260175
diff --git a/apps/web/src/components/ui/components/Dropdown.docs.tsx b/apps/web/src/components/ui/components/Dropdown.docs.tsxindex e0d9b16d17..d85c7b4a55 100644--- a/apps/web/src/components/ui/components/Dropdown.docs.tsx+++ b/apps/web/src/components/ui/components/Dropdown.docs.tsx@@ -42,6 +42,24 @@ function MultiselectDemo() {}// #endregion+// #region demo:unavailable+function UnavailableDemo() {+ return (+ <Dropdown>+ <Dropdown.Trigger>Add</Dropdown.Trigger>+ <Dropdown.Content class="min-w-48">+ <Dropdown.Group>+ <Dropdown.Item disabledReason="This model doesn't support images">+ Add photos+ </Dropdown.Item>+ <Dropdown.Item>Add files</Dropdown.Item>+ </Dropdown.Group>+ </Dropdown.Content>+ </Dropdown>+ );+}+// #endregion+export default defineDoc({name: 'Dropdown',category: 'Overlays',@@ -59,5 +77,12 @@ export default defineDoc({'Checkbox or Space toggles and stays open. Row or Enter adds and closes. Shift-click, Shift+Enter, or Only selects just one and stays open. Only is always visible on touch.',render: MultiselectDemo,},+ {+ id: 'unavailable',+ title: 'Unavailable items',+ description:+ 'disabledReason grays an item out and explains why in a tooltip beside it on hover or keyboard focus, or as a second line on touch. Unlike disabled, arrow keys still reach it; selecting it does nothing.',+ render: UnavailableDemo,+ },],});diff --git a/apps/web/src/components/ui/components/Dropdown.test.tsx b/apps/web/src/components/ui/components/Dropdown.test.tsxnew file mode 100644index 0000000000..2134823743--- /dev/null+++ b/apps/web/src/components/ui/components/Dropdown.test.tsx@@ -0,0 +1,39 @@+/** @vitest-environment jsdom */+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';+import { afterEach, expect, it, vi } from 'vitest';+import { Dropdown } from './Dropdown';++afterEach(cleanup);++it('keeps an item with a disabled reason reachable, described, and inert', () => {+ const select = vi.fn();+ render(() => (+ <Dropdown open>+ <Dropdown.Trigger>Add</Dropdown.Trigger>+ <Dropdown.Content>+ <Dropdown.Item+ disabledReason="GPT OSS 120B doesn't support images"+ onSelect={select}+ >+ Add photos+ </Dropdown.Item>+ <Dropdown.Item>Add files</Dropdown.Item>+ </Dropdown.Content>+ </Dropdown>+ ));+ const item = screen.getByRole('menuitem', { name: /Add photos/ });+ expect(item.getAttribute('aria-disabled')).toBe('true');+ expect(item.hasAttribute('data-disabled')).toBe(true);+ const files = screen.getByRole('menuitem', { name: 'Add files' });+ files.focus();+ fireEvent.keyDown(files, { key: 'ArrowUp' });+ expect(document.activeElement).toBe(item);+ const reason = document.getElementById(+ item.getAttribute('aria-describedby') ?? ''+ );+ expect(reason?.textContent).toBe("GPT OSS 120B doesn't support images");+ fireEvent.keyDown(item, { key: 'Enter' });+ fireEvent.click(item);+ expect(select).not.toHaveBeenCalled();+ expect(screen.getByRole('menu')).toBeTruthy();+});diff --git a/apps/web/src/components/ui/components/Dropdown.tsx b/apps/web/src/components/ui/components/Dropdown.tsxindex 688c0e50b6..f7a77698cd 100644--- a/apps/web/src/components/ui/components/Dropdown.tsx+++ b/apps/web/src/components/ui/components/Dropdown.tsx@@ -27,6 +27,7 @@ import {import { Button, type ButtonProps } from './Button';import { MultiSelectItemContent } from './MultiSelectItemContent';import { Surface, type SurfaceProps } from './Surface';+import { Tooltip } from './Tooltip';/*<Dropdown>@@ -100,6 +101,12 @@ export type DropdownItemProps = Omit<'closeOnSelect'> & {closeOnSelect?: SelectionDismissal;+ /**+ * Shows the item as unavailable and explains why: a tooltip beside the row+ * on hover or keyboard focus, a second line on touch. Unlike `disabled`, the+ * row stays reachable so the reason can be read; selecting it does nothing.+ */+ disabledReason?: string;};export type DropdownMultiSelectItemProps = Omit<DropdownItemProps,@@ -461,21 +468,88 @@ function DropdownSub(props: DropdownSubProps) {function DropdownItem(props: DropdownItemProps) {const selection = createSelectionDismissal();- const [local, rest] = splitProps(props, ['class', 'ref', 'closeOnSelect']);+ const [local, rest] = splitProps(props, [+ 'class',+ 'ref',+ 'closeOnSelect',+ 'disabledReason',+ ]);return (- <KobalteDropdownMenu.Item- class={cn(ROW_CLASS, local.class)}- {...rest}- ref={(element) => {- selection.track(element);- callRef(local.ref, element);- }}- closeOnSelect={- local.closeOnSelect === 'unless-shift'- ? selection.shouldClose()- : local.closeOnSelect+ <Show+ when={local.disabledReason}+ fallback={+ <KobalteDropdownMenu.Item+ class={cn(ROW_CLASS, local.class)}+ {...rest}+ ref={(element) => {+ selection.track(element);+ callRef(local.ref, element);+ }}+ closeOnSelect={+ local.closeOnSelect === 'unless-shift'+ ? selection.shouldClose()+ : local.closeOnSelect+ }+ />}- />+ >+ {(reason) => (+ <UnavailableItem {...rest} class={local.class} reason={reason()} />+ )}+ </Show>+ );+}++/**+ * Kobalte skips `disabled` items, so their reason could never be reached by+ * keyboard. This row keeps its place in the menu, announced as disabled.+ */+function UnavailableItem(+ props: Omit<DropdownItemProps, 'closeOnSelect' | 'disabledReason'> & {+ reason: string;+ }+) {+ const [local, rest] = splitProps(props, [+ 'class',+ 'ref',+ 'reason',+ 'children',+ 'onSelect',+ 'disabled',+ ]);+ // Kobalte focuses the row on hover as well as on arrow keys.+ const [focused, setFocused] = createSignal(false);+ return (+ <Tooltip+ label={local.reason}+ placement="right"+ open={focused()}+ class="w-full"+ >+ <KobalteDropdownMenu.Item+ {...rest}+ class={cn(ROW_CLASS, 'touch:flex-wrap touch:gap-y-0.5', local.class)}+ closeOnSelect={false}+ aria-disabled="true"+ data-disabled=""+ ref={(element) => {+ const show = () => setFocused(true);+ const hide = () => setFocused(false);+ element.addEventListener('focus', show);+ element.addEventListener('blur', hide);+ onCleanup(() => {+ element.removeEventListener('focus', show);+ element.removeEventListener('blur', hide);+ });+ callRef(local.ref, element);+ }}+ >+ {local.children}+ <KobalteDropdownMenu.ItemDescription class="sr-only touch:not-sr-only touch:basis-full touch:text-xs touch:text-ink-muted">+ {local.reason}+ </KobalteDropdownMenu.ItemDescription>+ </KobalteDropdownMenu.Item>+ </Tooltip>);}diff --git a/apps/web/src/features/agents-view/components/ChatComposer.test.tsx b/apps/web/src/features/agents-view/components/ChatComposer.test.tsxindex ea4927f8bf..2cd4b38b0f 100644--- a/apps/web/src/features/agents-view/components/ChatComposer.test.tsx+++ b/apps/web/src/features/agents-view/components/ChatComposer.test.tsx@@ -813,9 +813,7 @@ it('blocks existing images on text-only models and preserves the draft until swi/>));type('Describe this');- expect(screen.getByRole('status').textContent).toContain(- 'does not support images'- );+ expect(screen.queryByText(/This model does not support images/)).toBeNull();expect(screen.getByRole('button', { name: 'Send' }).hasAttribute('disabled')).toBe(true);diff --git a/apps/web/src/features/agents-view/components/ChatComposer.tsx b/apps/web/src/features/agents-view/components/ChatComposer.tsxindex 6d8a5fb89f..83b5c8e333 100644--- a/apps/web/src/features/agents-view/components/ChatComposer.tsx+++ b/apps/web/src/features/agents-view/components/ChatComposer.tsx@@ -5,6 +5,7 @@ import {DictationPanel,} from '@app/features/dictation/components/dictation-controls';import { createComposerDictation } from '@app/features/dictation/composer-dictation';+import { t } from '@app/lib/i18n';import { InputProvider } from '@channel/Input/context';import { Input } from '@channel/Input/Input';import type { InputAttachmentData, InputCommands } from '@channel/Input/types';@@ -57,6 +58,7 @@ export function ChatComposer(props: {onDraftChange: (draft: string) => void;blockedReason?: string;supportsImages?: boolean | null;+ modelName?: string;selector: JSX.Element;onSend: (prompt: string, attachments: InputAttachmentData[]) => void;session?: AgentInputProps;@@ -409,9 +411,19 @@ export function ChatComposer(props: {<Input.AttachFilesActionaccept={null}disabled={disabled()}- trigger={(openFiles) => (+ trigger={(openFiles, openImages) => (<AgentComposerAddMenuopenFiles={openFiles}+ openImages={openImages}+ imageUnsupportedReason={+ props.supportsImages === false+ ? t('common.imagesUnsupported', {+ model:+ props.modelName ??+ t('common.selectedModel'),+ })+ : undefined+ }openLibrary={() => openTypeahead('library')}openSkills={() => openTypeahead('skills')}getEditor={() => editor.lexical.getRootElement()}@@ -503,11 +515,6 @@ export function ChatComposer(props: {</Input.DropZone><DictationPanel dictation={dictation} /></ComposerSurface>- <Show when={props.supportsImages === false}>- <p role="status" class="px-3 py-1 text-xs text-ink-muted">- {IMAGE_INPUT_WARNING}- </p>- </Show><Show when={!isTouchDevice()}>{repositoryDrawer()}</Show><DictationFeedback dictation={dictation} /></div>@@ -532,6 +539,7 @@ export function ChatSessionInput(props: AgentInputProps) {onSend={props.onSend}session={props}supportsImages={props.supportsImages}+ modelName={props.modelName}attachments={props.attachments}onAttachFiles={props.onAttachFiles}onRemoveAttachment={props.onRemoveAttachment}diff --git a/apps/web/src/features/agents-view/views/ComposerAddMenu.test.tsx b/apps/web/src/features/agents-view/views/ComposerAddMenu.test.tsxindex 464ffc8f1c..209afcdfb6 100644--- a/apps/web/src/features/agents-view/views/ComposerAddMenu.test.tsx+++ b/apps/web/src/features/agents-view/views/ComposerAddMenu.test.tsx@@ -108,9 +108,10 @@ afterEach(() => {else delete (HTMLElement.prototype as Partial<HTMLElement>).scrollTo;vi.unstubAllGlobals();});-function setup() {+function setup(imageUnsupportedReason?: string) {const actions = {openFiles: vi.fn(),+ openImages: vi.fn(),openLibrary: vi.fn(),openSkills: vi.fn(),};@@ -119,7 +120,11 @@ function setup() {<style>{'[role="menu"] {animation-name:none;transition-duration:0s}'}</style>- <AgentComposerAddMenu {...actions} getEditor={() => null} />+ <AgentComposerAddMenu+ {...actions}+ imageUnsupportedReason={imageUnsupportedReason}+ getEditor={() => null}+ /></>));const trigger = screen.getByRole('button', { name: /^Add$/ });@@ -130,10 +135,9 @@ function setup() {it('keeps uploads available through the richer menu', () => {const actions = setup();- fireEvent.keyDown(- screen.getByRole('menuitem', { name: /Add photos & files/ }),- { key: 'Enter' }- );+ fireEvent.keyDown(screen.getByRole('menuitem', { name: /Add files/ }), {+ key: 'Enter',+ });expect(actions.openFiles).toHaveBeenCalledOnce();});it.each([@@ -208,3 +212,40 @@ it('hands the mobile sheet off to connection settings', async () => {fireEvent.click(await screen.findByRole('button', { name: /GitHub/ }));expect(await screen.findByText('Settings for github')).toBeTruthy();});++it('refuses photos on a text-only model while keeping the file action usable', () => {+ const actions = setup("GPT OSS 120B doesn't support images");+ const photos = screen.getByRole('menuitem', { name: /Add photos/ });+ expect(photos.getAttribute('aria-disabled')).toBe('true');+ const reason = document.getElementById(+ photos.getAttribute('aria-describedby') ?? ''+ );+ expect(reason?.textContent).toBe("GPT OSS 120B doesn't support images");+ fireEvent.keyDown(photos, { key: 'Enter' });+ expect(actions.openImages).not.toHaveBeenCalled();+ expect(screen.getByRole('menu')).toBeTruthy();+ fireEvent.keyDown(screen.getByRole('menuitem', { name: /Add files/ }), {+ key: 'Enter',+ });+ expect(actions.openFiles).toHaveBeenCalledOnce();+});++it('opens the photo picker for an image-capable model', () => {+ const actions = setup();+ fireEvent.keyDown(screen.getByRole('menuitem', { name: /Add photos/ }), {+ key: 'Enter',+ });+ expect(actions.openImages).toHaveBeenCalledOnce();+});++it('keeps file uploads available in the mobile sheet for a text-only model', async () => {+ state.mobile = true;+ const actions = setup("GPT OSS 120B doesn't support images");+ const photos = await screen.findByRole('button', { name: /Add photos/ });+ expect(photos.hasAttribute('disabled')).toBe(true);+ expect(photos.textContent).toContain("GPT OSS 120B doesn't support images");+ fireEvent.click(photos);+ expect(actions.openImages).not.toHaveBeenCalled();+ fireEvent.click(screen.getByRole('button', { name: /Add files/ }));+ expect(actions.openFiles).toHaveBeenCalledOnce();+});diff --git a/apps/web/src/features/agents-view/views/ComposerAddMenu.tsx b/apps/web/src/features/agents-view/views/ComposerAddMenu.tsxindex c187882f84..788696c75d 100644--- a/apps/web/src/features/agents-view/views/ComposerAddMenu.tsx+++ b/apps/web/src/features/agents-view/views/ComposerAddMenu.tsx@@ -8,12 +8,12 @@ import { useSettingsTabAvailable } from '@core/constant/settingsTabsConfig';import { isMobile } from '@core/mobile/isMobile';import { PipedreamConnectorIcon } from '@core/pipedream/ConnectorIcon';import LightningIcon from '@icon/system/regular/lightning.svg';-import PaperclipIcon from '@icon/system/regular/paperclip.svg';import PlugsIcon from '@icon/system/regular/plugs.svg';import PlusIcon from '@icon/system/regular/plus.svg';import BooksIcon from '@phosphor/books.svg';import { Button, Dialog } from '@ui';import { createSignal, lazy, Show, Suspense } from 'solid-js';+import { agentAttachmentItems } from '../../block-agent/ui/attachment-menu';import type { ProviderId } from '../../settings/connections/model';import { providerIcon } from '../../settings/connections/provider-meta';import { useConnectionsModel } from '../../settings/connections/use-connections-model';@@ -35,6 +35,8 @@ type Target =/** Shared composer actions plus the owner's existing connection settings. */export function AgentComposerAddMenu(props: {openFiles: () => void;+ openImages: () => void;+ imageUnsupportedReason?: string;openLibrary: () => void;openSkills: () => void;getEditor: () => HTMLElement | null | undefined;@@ -54,13 +56,11 @@ export function AgentComposerAddMenu(props: {const groups = (): ComposerAddMenuGroup[] => [{items: [- {- id: 'upload',- label: 'Add photos & files',- description: 'Upload from your device',- icon: <PaperclipIcon />,- onSelect: props.openFiles,- },+ ...agentAttachmentItems(+ props.openFiles,+ props.openImages,+ props.imageUnsupportedReason+ ),{id: 'library',label: 'Add from library',diff --git a/apps/web/src/features/agents-view/views/NewChatPage.tsx b/apps/web/src/features/agents-view/views/NewChatPage.tsxindex ab91d8c73d..4d61ad0520 100644--- a/apps/web/src/features/agents-view/views/NewChatPage.tsx+++ b/apps/web/src/features/agents-view/views/NewChatPage.tsx@@ -7,6 +7,7 @@ import {} from '@channel/Input';import { FloatRegionOrInline } from '@components/app/mobile/float-regions/FloatRegion';import { SpeedToggle } from '@core/component/AI/component/input/SpeedToggle';+import { modelLabel } from '@core/component/AI/constant/model-label';import {acceleratedSpeed,speedForModel,@@ -509,6 +510,12 @@ export function NewChatPage(props: {drawerOpenplaceholder={coding() ? 'Describe what you want to build' : undefined}onSend={send}+ modelName={modelLabel(+ composerModelOverride(),+ selectedCatalog+ .models()+ .find((model) => model.id === composerModelOverride())?.name+ )}supportsImages={selectedCatalog.models()diff --git a/apps/web/src/features/block-agent/component/AgentComposer.tsx b/apps/web/src/features/block-agent/component/AgentComposer.tsxindex 0f53018d06..2f974aedc7 100644--- a/apps/web/src/features/block-agent/component/AgentComposer.tsx+++ b/apps/web/src/features/block-agent/component/AgentComposer.tsx@@ -1,4 +1,5 @@import { SpeedToggle } from '@core/component/AI/component/input/SpeedToggle';+import { modelLabel } from '@core/component/AI/constant/model-label';import {acceleratedSpeed,speedForModel,@@ -344,6 +345,12 @@ export function AgentComposer(props: {onSendNext={() => {if (!readOnly()) sendNext();}}+ modelName={modelLabel(+ metadata()?.model ?? undefined,+ metadata()?.supportedModels.find(+ (model) => model.id === metadata()?.model+ )?.name+ )}supportsImages={metadata()?.supportedModels.find((model) => model.id === metadata()?.modeldiff --git a/apps/web/src/features/block-agent/state/image-input.ts b/apps/web/src/features/block-agent/state/image-input.tsindex 5b5cc1051e..cd1a6b18a2 100644--- a/apps/web/src/features/block-agent/state/image-input.ts+++ b/apps/web/src/features/block-agent/state/image-input.ts@@ -1,3 +1,3 @@-/** Shared copy for model capability warnings in agent composers. */+/** Toast copy for refused image attachments in agent composers. */export const IMAGE_INPUT_WARNING ='This model does not support images. Choose a vision model to attach images.';diff --git a/apps/web/src/features/block-agent/ui/AgentInput.test.tsx b/apps/web/src/features/block-agent/ui/AgentInput.test.tsxindex 3e70623edf..6eb138225b 100644--- a/apps/web/src/features/block-agent/ui/AgentInput.test.tsx+++ b/apps/web/src/features/block-agent/ui/AgentInput.test.tsx@@ -447,9 +447,7 @@ it('keeps an attached image and text unsent while the selected model is text-onlattachments={[{ id: 'image', name: 'test.png', kind: 'image' }]}/>));- expect(screen.getByRole('status').textContent).toContain(- 'does not support images'- );+ expect(screen.queryByText(/This model does not support images/)).toBeNull();editor.enter?.();expect(send).not.toHaveBeenCalled();expect(editor.clear).not.toHaveBeenCalled();diff --git a/apps/web/src/features/block-agent/ui/AgentInput.tsx b/apps/web/src/features/block-agent/ui/AgentInput.tsxindex 6069cfdb42..2497a7f11d 100644--- a/apps/web/src/features/block-agent/ui/AgentInput.tsx+++ b/apps/web/src/features/block-agent/ui/AgentInput.tsx@@ -1,3 +1,4 @@+import { t } from '@app/lib/i18n';import { getAttachmentKindFromFile } from '@channel/Input/utils/file-helpers';import { toast } from '@core/component/Toast/Toast';import { createResizeObserver } from '@solid-primitives/resize-observer';@@ -19,6 +20,10 @@ import {DictationPanel,} from '@app/features/dictation/components/dictation-controls';import { createComposerDictation } from '@app/features/dictation/composer-dictation';+import {+ ComposerAddDrawer,+ ComposerAddMenu,+} from '@channel/Input/ComposerAddMenu';import { InputProvider } from '@channel/Input/context';import { Input } from '@channel/Input/Input';import type { InputAttachmentData, InputCommands } from '@channel/Input/types';@@ -43,6 +48,7 @@ import {onMount,Show,} from 'solid-js';+import { agentAttachmentItems } from './attachment-menu';/*** Id of the agent input's text-area wrapper. Exposed so callers (e.g. the@@ -56,6 +62,7 @@ export type QuoteInsert = (text: string) => void;export interface AgentInputProps {/** Image capability of the selected model; unknown runtimes omit it. */supportsImages?: boolean | null;+ modelName?: string;placeholder?: string;/** Context to seed in the composer without sending it. */initialInput?: string;@@ -125,6 +132,13 @@ export interface AgentInputProps {}export function AgentInput(props: AgentInputProps) {+ const [attachDrawerOpen, setAttachDrawerOpen] = createSignal(false);+ const imageUnsupportedReason = () =>+ props.supportsImages === false+ ? t('common.imagesUnsupported', {+ model: props.modelName ?? t('common.selectedModel'),+ })+ : undefined;const [owned, setOwned] = createSignal(props.initialInput ?? '');const controlled = () => props.onDraftChange !== undefined;const markdown = () => (controlled() ? (props.draft ?? '') : owned());@@ -340,11 +354,6 @@ export function AgentInput(props: AgentInputProps) {classList={{ 'opacity-50': props.readOnly }}>{/* Desktop: the model pill sits above the box, as it always has. */}- <Show when={props.supportsImages === false}>- <p role="status" class="px-3 py-1 text-xs text-ink-muted">- {IMAGE_INPUT_WARNING}- </p>- </Show><Show when={!isTouchDevice() && props.modelControl}><div class="flex items-center px-0.5">{props.modelControl}</div></Show>@@ -430,6 +439,32 @@ export function AgentInput(props: AgentInputProps) {<Input.AttachFilesActionaccept={null}disabled={props.disabled || props.readOnly}+ trigger={(openFiles, openImages) => {+ const groups = () => [+ {+ items: agentAttachmentItems(+ openFiles,+ openImages,+ imageUnsupportedReason()+ ),+ },+ ];+ return (+ <>+ <ComposerAddMenu+ groups={groups()}+ disabled={props.disabled || props.readOnly}+ onOpenDrawer={() => setAttachDrawerOpen(true)}+ />+ <ComposerAddDrawer+ groups={groups()}+ open={attachDrawerOpen()}+ onOpenChange={setAttachDrawerOpen}+ getEditor={() => editor.lexical.getRootElement()}+ />+ </>+ );+ }}/></Show><div class="ml-auto flex shrink-0 items-center gap-[3.75px]">diff --git a/apps/web/src/features/block-agent/ui/attachment-menu.tsx b/apps/web/src/features/block-agent/ui/attachment-menu.tsxnew file mode 100644index 0000000000..8cc37f5d2e--- /dev/null+++ b/apps/web/src/features/block-agent/ui/attachment-menu.tsx@@ -0,0 +1,28 @@+import { t } from '@app/lib/i18n';+import type { ComposerAddMenuItem } from '@channel/Input/ComposerAddMenu';+import ImageIcon from '@icon/system/regular/image.svg';+import PaperclipIcon from '@icon/system/regular/paperclip.svg';++export function agentAttachmentItems(+ openFiles: () => void,+ openImages: () => void,+ imageUnsupportedReason?: string+): ComposerAddMenuItem[] {+ return [+ {+ id: 'photos',+ label: t('common.addPhotos'),+ description: t('common.photosFromDevice'),+ icon: <ImageIcon />,+ disabledReason: imageUnsupportedReason,+ onSelect: openImages,+ },+ {+ id: 'upload',+ label: t('common.addFiles'),+ description: t('common.filesFromDevice'),+ icon: <PaperclipIcon />,+ onSelect: () => openFiles(),+ },+ ];+}diff --git a/apps/web/src/features/channel/Input/ComposerAddMenu.tsx b/apps/web/src/features/channel/Input/ComposerAddMenu.tsxindex e8270990ad..dce7ade7c1 100644--- a/apps/web/src/features/channel/Input/ComposerAddMenu.tsx+++ b/apps/web/src/features/channel/Input/ComposerAddMenu.tsx@@ -14,6 +14,11 @@ export type ComposerAddMenuItem = {hint?: string;onSelect: () => void;disabled?: boolean;+ /**+ * Grays the item out and says why: beside the row on hover or focus, as+ * its second line on touch.+ */+ disabledReason?: string;/*** The item puts the caret in the editor (a mention, an inserted card), so* the editor takes focus as the menu closes instead of the +.@@ -124,6 +129,7 @@ function AddDropdown(props: {{(item) => (<Dropdown.Itemdisabled={item.disabled}+ disabledReason={item.disabledReason}onSelect={() => select(item)}class={item.description@@ -196,7 +202,7 @@ export function ComposerAddDrawer(props: {<For each={group.items}>{(item) => (<MobileDrawer.Item- disabled={item.disabled}+ disabled={item.disabled || !!item.disabledReason}data-composer-add-item={item.id}ref={(el) => {if (item.focusesEditor)@@ -215,10 +221,15 @@ export function ComposerAddDrawer(props: {</span><span class="min-w-0 flex-1"><span class="block">{item.label}</span>- <Show when={item.description}>- <span class="block text-xs text-ink-muted font-normal">- {item.description}- </span>+ {/* No hover on a phone: the reason is the line. */}+ <Show+ when={item.disabledReason ?? item.description}+ >+ {(line) => (+ <span class="block text-xs text-ink-muted font-normal">+ {line()}+ </span>+ )}</Show></span></MobileDrawer.Item>diff --git a/apps/web/src/features/channel/Input/InputActions.tsx b/apps/web/src/features/channel/Input/InputActions.tsxindex e440243a65..a70d6fefc5 100644--- a/apps/web/src/features/channel/Input/InputActions.tsx+++ b/apps/web/src/features/channel/Input/InputActions.tsx@@ -22,7 +22,8 @@ export function AttachFilesAction(accept?: string | null;disabled?: boolean;children?: JSX.Element;- trigger?: (openPicker: () => void) => JSX.Element;+ /** Custom actions share the file input; Photos narrows it to images. */+ trigger?: (openPicker: () => void, openImages: () => void) => JSX.Element;} = {}) {const commands = useInputCommands();@@ -56,7 +57,20 @@ export function AttachFilesAction(data-input-attach-file-picker/>{props.trigger ? (- props.trigger(() => fileInputRef?.click())+ props.trigger(+ () => {+ if (!fileInputRef) return;+ if (props.accept === null) fileInputRef.removeAttribute('accept');+ else+ fileInputRef.accept = props.accept ?? CHANNEL_FILE_PICKER_ACCEPT;+ fileInputRef.click();+ },+ () => {+ if (!fileInputRef) return;+ fileInputRef.accept = 'image/*';+ fileInputRef.click();+ }+ )) : (<InputActionButtonlabel="Attach files"diff --git a/apps/web/src/features/channel/Input/tests/attach-files-action.test.tsx b/apps/web/src/features/channel/Input/tests/attach-files-action.test.tsxindex 5d3d727685..19cda9601c 100644--- a/apps/web/src/features/channel/Input/tests/attach-files-action.test.tsx+++ b/apps/web/src/features/channel/Input/tests/attach-files-action.test.tsx@@ -21,7 +21,12 @@ it('routes a custom trigger through the existing picker and attachment command',><AttachFilesActionaccept={null}- trigger={(open) => <button onClick={open}>Upload</button>}+ trigger={(open, images) => (+ <>+ <button onClick={open}>Upload</button>+ <button onClick={images}>Photos</button>+ </>+ )}/></InputProvider>));@@ -31,6 +36,10 @@ it('routes a custom trigger through the existing picker and attachment command',fireEvent.click(screen.getByRole('button', { name: 'Upload' }));expect(click).toHaveBeenCalledOnce();expect(picker.hasAttribute('accept')).toBe(false);+ fireEvent.click(screen.getByRole('button', { name: 'Photos' }));+ expect(picker.accept).toBe('image/*');+ fireEvent.click(screen.getByRole('button', { name: 'Upload' }));+ expect(picker.hasAttribute('accept')).toBe(false);const file = new File(['example'], 'example.txt');fireEvent.change(picker, { target: { files: [file] } });expect(attachFiles).toHaveBeenCalledWith([file]);diff --git a/apps/web/src/lib/i18n/locales/en/common.ts b/apps/web/src/lib/i18n/locales/en/common.tsindex ac8b9bb3d7..4baae1b9bd 100644--- a/apps/web/src/lib/i18n/locales/en/common.ts+++ b/apps/web/src/lib/i18n/locales/en/common.ts@@ -1,4 +1,10 @@export default {+ addPhotos: 'Add photos',+ addFiles: 'Add files',+ photosFromDevice: 'Images from your device',+ filesFromDevice: 'Documents and other files',+ selectedModel: 'This model',+ imagesUnsupported: "{{model}} doesn't support images",cancel: 'Cancel',close: 'Close',delete: 'Delete',diff --git a/docs/agent-guide/ai-chat.md b/docs/agent-guide/ai-chat.mdindex a3aaa5d56e..e16767b0d3 100644--- a/docs/agent-guide/ai-chat.md+++ b/docs/agent-guide/ai-chat.md@@ -382,7 +382,7 @@ the shimmer.pressed; runs of routines set to **Show runs** are always listed. Everyroutine run carries the same clock icon after its age. The list startswithout hidden runs each time the Agents view opens.-- The agent composer's **+ (Add)** menu offers **Add photos & files**,+- The agent composer's **+ (Add)** menu offers **Add photos**, **Add files**,**Add from library** (`@` references), and **Use a skill** (`/`; sessions show**Skills & commands**). Desktop uses a scrollable menu; phones use a bottomsheet with the same actions. Selecting a reference or skill restores editor@@ -1342,8 +1342,8 @@ mention only notifies people who could already open it.In Home, a new Agents conversation, and an existing agent session, files can beattached to a prompt three ways: drop them anywhere on the composer (a"Drop files here to send them to the agent" overlay appears), paste them from the-clipboard, or use the paperclip **`Attach files`** button. Every file uploads to the-static file service and shows as a chip above the text (media thumbnails, document+clipboard, or choose **Add photos** / **Add files** from the **+ (Add)** menu.+Every file uploads to the static file service and shows as a chip above the text (media thumbnails, documentpills with a remove `×`); **Send** is disabled while an upload is pending. The agentreceives each file as an ACP `resource_link` (a URL it can fetch) after the prompt text,and the sent prompt renders its files in the transcript (image thumbnails and@@ -2019,7 +2019,12 @@ uploaded images as normalized inline content, including attachments from earlierturns. Test an image-only prompt and a text-plus-image prompt, then follow upwithout reattaching the image.-Text-only model choices show a description and a composer warning. Pasted,+Text-only model choices show a description. In the composer’s + menu, only+**Add photos** is dimmed, with a tooltip beside the row using the model’s house+name (`"<Model> doesn't support images"`) on hover or arrow-key focus; selecting+it does nothing and leaves the menu open. Touch shows the reason as the row’s+second line instead. **Add files** remains available without a tooltip, and no+warning banner is shown. Pasted,dropped, and picked images should be refused before upload; document attachmentsand text should still work. If an image is already attached when switching to atext-only model, keep the draft and image chip but disable Send until the image