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(ai): support skill management and grouped agent slash menus (#7165)
Eric Hayes183643a715ed
diff --git a/apps/web/src/features/block-agent/ui/AgentInput.tsx b/apps/web/src/features/block-agent/ui/AgentInput.tsxindex 83de65832a..aafb128ffc 100644--- a/apps/web/src/features/block-agent/ui/AgentInput.tsx+++ b/apps/web/src/features/block-agent/ui/AgentInput.tsx@@ -72,7 +72,7 @@ export interface AgentInputProps {autofocus?: boolean;/*** Slash commands the harness advertises (ACP `available_commands_update`);- * typing `/` opens a typeahead over them. `/` stays plain text while empty.+ * shown alongside skills and pull requests in the `/` menu.*/commands?: () => AgentCommandItem[];/**diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownConfigBuilder.ts b/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownConfigBuilder.tsindex ba30e160bf..2b7c3d8a13 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownConfigBuilder.ts+++ b/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownConfigBuilder.ts@@ -188,7 +188,7 @@ export class EditorConfigBuilder implements EditorBuilder {/*** Enable the agent commands (`/`) typeahead menu — for agent composers.- * Lists the slash commands a connected coding agent advertises over ACP;+ * Lists skills, pull requests, and commands advertised over ACP;* selecting one inserts `/name` as plain text, which is sent to the agent* as ordinary prompt text. Shares the `/` trigger with the actions and* skills menus, so it only takes effect when both are disabled.diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShell.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShell.tsxindex 849137fe2d..b70b2cf4b6 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShell.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShell.tsx@@ -21,7 +21,6 @@ import {import { DecoratorRenderer } from '../component/core/DecoratorRenderer';import { NodeAccessoryRenderer } from '../component/core/NodeAccessoryRenderer';import { ActionMenu } from '../component/menu/ActionsMenu';-import { AgentCommandsMenu } from '../component/menu/AgentCommandsMenu';import { EmojiMenu } from '../component/menu/EmojiMenu';import { FloatingFormatMenu } from '../component/menu/FloatingFormatMenu';import { FloatingLinkMenu } from '../component/menu/FloatingLinkMenu';@@ -353,10 +352,12 @@ export const MarkdownShell: Component<MarkdownShellProps> = (props) => {{/* Agent Commands Menu */}<Show when={state.agentCommandsMenuOps}>{(menu) => (- <AgentCommandsMenu+ <SkillsMenueditor={editor}menu={menu()}- commands={builderConfig.agentCommands?.commands ?? (() => [])}+ agentCommands={+ builderConfig.agentCommands?.commands ?? (() => [])+ }useBlockBoundary={false}portalScope={props.portalScope}/>diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/builder/buildHandleFromConfig.ts b/apps/web/src/lib/core/component/LexicalMarkdown/builder/buildHandleFromConfig.tsindex 2253fa8f58..5265c364aa 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/builder/buildHandleFromConfig.ts+++ b/apps/web/src/lib/core/component/LexicalMarkdown/builder/buildHandleFromConfig.ts@@ -235,7 +235,6 @@ export function buildHandleFromConfig(config: EditorConfig): EditorHandle {plugins.use(agentCommandsPlugin({menu: agentCommandsMenuOps,- commands: config.agentCommands.commands,}));}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/AgentCommandsMenu/AgentCommandRow.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/AgentCommandsMenu/AgentCommandRow.tsxnew file mode 100644index 0000000000..da4e9d6927--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/AgentCommandsMenu/AgentCommandRow.tsx@@ -0,0 +1,56 @@+import { cn } from '@ui';+import { createEffect, Show } from 'solid-js';+import type { AgentCommandItem } from '../../../plugins/agent-commands';++export function AgentCommandRow(props: {+ command: AgentCommandItem;+ index: number;+ selected: boolean;+ itemAction: () => void;+ setIndex: (index: number) => void;+}) {+ let itemRef: HTMLDivElement | undefined;++ createEffect(() => {+ if (props.selected && itemRef) {+ itemRef.scrollIntoView({ block: 'nearest' });+ }+ });++ return (+ <div+ ref={itemRef}+ on:mouseup={(e) => {+ e.preventDefault();+ e.stopPropagation();+ }}+ on:mousedown={(e) => {+ e.preventDefault();+ e.stopPropagation();+ }}+ on:click={(e) => {+ props.itemAction();+ e.stopPropagation();+ }}+ on:mousemove={() => props.setIndex(props.index)}+ class={cn('group flex items-baseline gap-2 p-1.5 mx-1.5 rounded-md', {+ 'bg-ink/5': props.selected,+ })}+ >+ <span class="shrink-0 text-ink text-xs sm:text-sm font-medium">+ /{props.command.name}+ </span>+ <Show when={props.command.inputHint}>+ <span class="shrink-0 text-xs text-ink-extra-muted">+ {props.command.inputHint}+ </span>+ </Show>+ <span+ class="min-w-0 truncate text-xs text-ink-muted"+ title={props.command.description}+ >+ {props.command.description}+ </span>+ </div>+ );+}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/AgentCommandsMenu/AgentCommandsMenu.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/AgentCommandsMenu/AgentCommandsMenu.tsxdeleted file mode 100644index b939653b6d..0000000000--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/AgentCommandsMenu/AgentCommandsMenu.tsx+++ /dev/null@@ -1,278 +0,0 @@-import { type PortalScope, ScopedPortal } from '@core/component/ScopedPortal';-import clickOutside from '@core/directive/clickOutside';-import { useIsKeyPressActive } from '@core/util/useIsKeyPressActive';-import { cn, Surface } from '@ui';-import type { LexicalEditor } from 'lexical';-import {- createEffect,- createSignal,- For,- onCleanup,- onMount,- Show,- untrack,-} from 'solid-js';-import { floatWithSelection } from '../../../directive/floatWithSelection';-import {- type AgentCommandItem,- CLOSE_AGENT_COMMAND_SEARCH_COMMAND,- INSERT_AGENT_COMMAND_COMMAND,-} from '../../../plugins/agent-commands';-import type { MenuOperations } from '../../../shared/inlineMenu';-import { useMenuKeyboardNavigation } from '../useMenuKeyboardNavigation';--false && clickOutside;-false && floatWithSelection;--// Height consumed by Surface's border + vertical padding-const PANEL_DECORATION_HEIGHT = 18;--type AgentCommandsMenuProps = {- editor: LexicalEditor;- menu: MenuOperations;- /** Slash commands advertised by the connected agent. */- commands: () => AgentCommandItem[];- /** whether the menu checks against block boundary in floating middleware. uses floating-ui default if false. */- useBlockBoundary?: boolean;- portalScope?: PortalScope;-};--/**- * Typeahead menu opened by typing `/` in an agent composer. Lists the slash- * commands the connected coding agent advertised over ACP; selecting one- * inserts `/name` as plain text at the cursor — commands travel to the agent- * as ordinary prompt text.- */-export function AgentCommandsMenu(props: AgentCommandsMenuProps) {- const searchTerm = props.menu.searchTerm;- const activeSearchTerm = () => (props.menu.isOpen() ? searchTerm() : '');-- // Name-prefix matches first, then substring matches on name or description.- const filteredCommands = () => {- const term = activeSearchTerm().trim().toLowerCase();- const all = props.commands();- if (!term) return all;- const prefix: AgentCommandItem[] = [];- const contains: AgentCommandItem[] = [];- for (const command of all) {- const name = command.name.toLowerCase();- if (name.startsWith(term)) {- prefix.push(command);- } else if (- name.includes(term) ||- command.description.toLowerCase().includes(term)- ) {- contains.push(command);- }- }- return [...prefix, ...contains];- };-- const [selectedIndex, setSelectedIndex] = createSignal(0);- const [mountSelection, setMountSelection] = createSignal<Selection | null>();- const [escapeSpaceState, setEscapeSpaceState] = createSignal<- 'start' | 'single' | null- >('start');-- const { isKeypressActive } = useIsKeyPressActive();- const setSelectedIndexFromMouse = (index: number) => {- if (isKeypressActive()) return;- setSelectedIndex(index);- };-- const [menuOpen, setMenuOpen] = [props.menu.isOpen, props.menu.setIsOpen];-- createEffect(() => {- if (menuOpen()) {- setMountSelection(document.getSelection());- setSelectedIndex(0);- setEscapeSpaceState('start');- } else {- setMountSelection(null);- }- });-- createEffect(() => {- searchTerm();- setSelectedIndex(0);- });-- createEffect(() => {- const count = filteredCommands().length;- if (count > 0 && selectedIndex() >= count) {- setSelectedIndex(count - 1);- }- });-- const closeMenu = () => {- props.editor.dispatchCommand(CLOSE_AGENT_COMMAND_SEARCH_COMMAND, undefined);- setMenuOpen(false);- };-- const insertCommand = (command: AgentCommandItem) => {- props.editor.dispatchCommand(INSERT_AGENT_COMMAND_COMMAND, command);- };-- useMenuKeyboardNavigation({- isActive: menuOpen,- onUp: () => {- const items = filteredCommands();- if (items.length === 0) return;- setSelectedIndex((selectedIndex() - 1 + items.length) % items.length);- },- onDown: () => {- const items = filteredCommands();- if (items.length === 0) return;- setSelectedIndex((selectedIndex() + 1) % items.length);- },- onLeft: () => {- // block horizontal arrows- },- onRight: () => {- // block horizontal arrows- },- onSelect: () => {- const selectedItem = filteredCommands()[selectedIndex()];- if (selectedItem) {- insertCommand(selectedItem);- } else {- closeMenu();- }- },- onClose: closeMenu,- onSpace: () => {- switch (escapeSpaceState()) {- case 'single':- case 'start':- closeMenu();- return true;- case null:- setEscapeSpaceState('single');- return false;- }- return false;- },- onOtherKey: () => {- setEscapeSpaceState(null);- },- });-- const focusOut = () => {- closeMenu();- };- onMount(() => {- document.addEventListener('focusout', focusOut);- onCleanup(() => {- document.removeEventListener('focusout', focusOut);- });- });-- const [menuAvailableHeight, setMenuAvailableHeight] = createSignal<- number | undefined- >(undefined);-- const contentMaxHeight = () => {- const h = menuAvailableHeight();- if (h === undefined) return 256;- return Math.min(256, Math.max(0, h - PANEL_DECORATION_HEIGHT));- };-- return (- <Show when={menuOpen()}>- <ScopedPortal scope={props.portalScope}>- <div- class="w-96 max-w-[calc(100cqw-1rem-2px)] cursor-default select-none z-modal-content menu-open-animation"- use:floatWithSelection={{- selection: untrack(mountSelection),- reactiveOnContainer: props.editor.getRootElement(),- useBlockBoundary: props.useBlockBoundary,- onAvailableHeight: setMenuAvailableHeight,- }}- use:clickOutside={() => {- closeMenu();- }}- on:touchstart={(e) => e.stopPropagation()}- >- <Surface depth={2} class="pt-2 pb-1.5 glass bg-menu-glass rounded-xl">- <div class="px-3.5 pb-1 text-xs font-medium text-ink-muted">- Commands- </div>- <Show- when={filteredCommands().length > 0}- fallback={- <div class="px-3.5 pb-1 text-ink-extra-muted">No results</div>- }- >- <div- class="overflow-y-auto scrollbar-hidden"- style={{ 'max-height': `${contentMaxHeight()}px` }}- >- <For each={filteredCommands()}>- {(command, index) => (- <AgentCommandRow- command={command}- index={index()}- selected={index() === selectedIndex()}- itemAction={() => insertCommand(command)}- setIndex={setSelectedIndexFromMouse}- />- )}- </For>- </div>- </Show>- </Surface>- </div>- </ScopedPortal>- </Show>- );-}--function AgentCommandRow(props: {- command: AgentCommandItem;- index: number;- selected: boolean;- itemAction: () => void;- setIndex: (index: number) => void;-}) {- let itemRef: HTMLDivElement | undefined;-- createEffect(() => {- if (props.selected && itemRef) {- itemRef.scrollIntoView({ block: 'nearest' });- }- });-- return (- <div- ref={itemRef}- on:mouseup={(e) => {- e.preventDefault();- e.stopPropagation();- }}- on:mousedown={(e) => {- e.preventDefault();- e.stopPropagation();- }}- on:click={(e) => {- props.itemAction();- e.stopPropagation();- }}- on:mousemove={() => props.setIndex(props.index)}- class={cn('group flex items-baseline gap-2 p-1.5 mx-1.5 rounded-md', {- 'bg-ink/5': props.selected,- })}- >- <span class="shrink-0 text-ink text-xs sm:text-sm font-medium">- /{props.command.name}- </span>- <Show when={props.command.inputHint}>- <span class="shrink-0 text-xs text-ink-extra-muted">- {props.command.inputHint}- </span>- </Show>- <span class="min-w-0 truncate text-xs text-ink-muted">- {props.command.description}- </span>- </div>- );-}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/AgentCommandsMenu/filterCommands.ts b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/AgentCommandsMenu/filterCommands.tsnew file mode 100644index 0000000000..76b6498000--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/AgentCommandsMenu/filterCommands.ts@@ -0,0 +1,21 @@+import type { AgentCommandItem } from '../../../plugins/agent-commands';++/** Keep name-prefix matches ahead of name/description substring matches. */+export function filterCommands(commands: AgentCommandItem[], search: string) {+ const term = search.trim().toLowerCase();+ if (!term) return commands;+ const prefix: AgentCommandItem[] = [];+ const contains: AgentCommandItem[] = [];+ for (const command of commands) {+ const name = command.name.toLowerCase();+ if (name.startsWith(term)) {+ prefix.push(command);+ } else if (+ name.includes(term) ||+ command.description.toLowerCase().includes(term)+ ) {+ contains.push(command);+ }+ }+ return [...prefix, ...contains];+}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/AgentCommandsMenu/index.ts b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/AgentCommandsMenu/index.tsdeleted file mode 100644index 955e0f81d5..0000000000--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/AgentCommandsMenu/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './AgentCommandsMenu';diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/MentionsMenu/components/MentionsMenuItem.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/MentionsMenu/components/MentionsMenuItem.tsxindex 839205bb22..7acb3d90dd 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/MentionsMenu/components/MentionsMenuItem.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/MentionsMenu/components/MentionsMenuItem.tsx@@ -5,7 +5,7 @@ import ClockIcon from '@phosphor/clock.svg';import EmailIcon from '@phosphor/envelope.svg';import UsersIcon from '@phosphor/users.svg';import { cn } from '@ui';-import { createEffect, Show } from 'solid-js';+import { createEffect, type JSX, Show } from 'solid-js';import { match } from 'ts-pattern';import type { MentionItem } from '../../../../utils/mentionsUtils';import { isBotMentionItem } from '../utils/botMention';@@ -23,6 +23,7 @@ export function MentionsMenuItem(props: {setOpen: (open: boolean) => void;/** When true, disables the internal scrollIntoView behavior (used when list is virtualized) */disableScrollIntoView?: boolean;+ actions?: JSX.Element;}) {let itemRef: HTMLDivElement | undefined;@@ -130,6 +131,7 @@ export function MentionsMenuItem(props: {</span></Show></div>+ {props.actions}</div>);}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/PullRequestRow.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/PullRequestRow.tsxnew file mode 100644index 0000000000..8446ba2458--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/PullRequestRow.tsx@@ -0,0 +1,43 @@+import type { GithubPullRequestEntity } from '@entity';+import GitPullRequest from '@phosphor/git-pull-request.svg';+import { cn } from '@ui';+import { createEffect } from 'solid-js';++export function PullRequestRow(props: {+ item: GithubPullRequestEntity;+ selected: boolean;+ onSelect: () => void;+ onHover: () => void;+}) {+ let ref: HTMLDivElement | undefined;+ createEffect(() => {+ if (props.selected) ref?.scrollIntoView({ block: 'nearest' });+ });+ const label = () =>+ `${props.item.metadata.owner}/${props.item.metadata.repo} #${props.item.metadata.number}`;+ return (+ <div+ ref={ref}+ class={cn('flex items-center gap-2 p-1.5 mx-1.5 rounded-md', {+ 'bg-ink/5': props.selected,+ })}+ onPointerDown={(event) => event.preventDefault()}+ onMouseDown={(event) => event.preventDefault()}+ onMouseMove={props.onHover}+ onClick={(event) => {+ event.stopPropagation();+ props.onSelect();+ }}+ >+ <GitPullRequest class="size-4 shrink-0 text-ink-muted" />+ <div class="min-w-0">+ <div class="truncate text-sm text-ink" title={props.item.name}>+ {props.item.name}+ </div>+ <div class="truncate text-xs text-ink-muted" title={label()}>+ {label()}+ </div>+ </div>+ </div>+ );+}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/SkillActions.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/SkillActions.tsxnew file mode 100644index 0000000000..cb93654674--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/SkillActions.tsx@@ -0,0 +1,42 @@+import type { EntityItem } from '@core/context/quickAccess';+import Pencil from '@phosphor/pencil-simple.svg';+import Trash from '@phosphor/trash-simple.svg';+import { Show } from 'solid-js';++/** Document actions only; built-in skills have no editable document. */+export function SkillActions(props: {+ item: EntityItem;+ onEdit: () => void;+ onDelete?: () => void;+}) {+ return (+ <div class="ml-2 flex shrink-0 items-center gap-1">+ <button+ type="button"+ aria-label={`Edit ${props.item.data.name}`}+ title="Edit skill"+ class="rounded p-1 text-ink-muted hover:bg-hover hover:text-ink"+ on:click={(event) => {+ event.stopPropagation();+ props.onEdit();+ }}+ >+ <Pencil class="size-4" />+ </button>+ <Show when={props.onDelete}>+ <button+ type="button"+ aria-label={`Delete ${props.item.data.name}`}+ title="Delete skill"+ class="rounded p-1 text-ink-muted hover:bg-hover hover:text-ink"+ on:click={(event) => {+ event.stopPropagation();+ props.onDelete?.();+ }}+ >+ <Trash class="size-4" />+ </button>+ </Show>+ </div>+ );+}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/SkillsMenu.test.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/SkillsMenu.test.tsxnew file mode 100644index 0000000000..7729ac3dc6--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/SkillsMenu.test.tsx@@ -0,0 +1,227 @@+import type { EntityItem } from '@core/context/quickAccess';+import {+ cleanup,+ fireEvent,+ render,+ screen,+ waitFor,+} from '@solidjs/testing-library';+import { createEditor } from 'lexical';+import { createSignal, type ParentProps } from 'solid-js';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import {+ INSERT_AGENT_COMMAND_COMMAND,+ REMOVE_AGENT_COMMAND_SEARCH_COMMAND,+} from '../../../plugins/agent-commands';+import {+ INSERT_DOCUMENT_MENTION_COMMAND,+ INSERT_PR_MENTION_COMMAND,+} from '../../../plugins/mentions';+import { createMenuOperations } from '../../../shared/inlineMenu';+import { SkillsMenu } from './SkillsMenu';++const mocks = vi.hoisted(() => ({+ open: vi.fn(),+ delete: vi.fn(),+ create: vi.fn(),+}));+const skill = (id: string, name: string, ownerId: string): EntityItem => ({+ kind: 'entity',+ id,+ bucket: 'skill',+ searchText: name.toLowerCase(),+ sortTimestamp: 0,+ timestamps: {},+ data: {+ id,+ name,+ ownerId,+ type: 'document',+ fileType: 'md',+ subType: { type: 'skill' },+ },+});++vi.mock('@app/lib/analytics/analytics-context', () => ({+ useAnalytics: () => ({ track: vi.fn() }),+}));+vi.mock('@core/context/user', () => ({ useUserId: () => () => 'me' }));+vi.mock('@components/app/split-layout/layout', () => ({+ useSplitLayout: () => ({+ openWithSplit: mocks.open,+ popoverSplit: mocks.create,+ }),+}));+vi.mock('@app/features/next-soup/actions/make-delete-action', () => ({+ makeDeleteAction: () => ({+ canExecute: (item: { ownerId: string }) => item.ownerId === 'me',+ execute: mocks.delete,+ }),+}));+vi.mock('@queries/storage/system-skills', () => ({+ useSystemSkillsQuery: () => ({+ skills: () => [{ id: 'builtin', name: 'Built-in guide' }],+ isSystemSkillId: (id: string) => id === 'builtin',+ }),+}));+vi.mock('@queries/soup/slash-menu-pull-requests', () => ({+ useSlashMenuPullRequests: () => ({+ query: { isPending: false, isError: false },+ pullRequests: () => [+ {+ id: 'pr-42',+ name: 'Fix skills',+ metadata: { owner: 'macro', repo: 'app', number: 42 },+ },+ ],+ }),+}));+vi.mock('../MentionsMenu/hooks/useEntityMention', () => ({+ useEntityMention: (options: { searchTerm: () => string }) => ({+ entities: () =>+ [+ skill('mine', 'My skill', 'me'),+ skill('shared', 'Shared skill', 'someone'),+ ].filter((item) =>+ item.searchText.includes(options.searchTerm().toLowerCase())+ ),+ }),+}));+vi.mock('@core/component/ScopedPortal', () => ({+ ScopedPortal: (props: ParentProps) => props.children,+}));+vi.mock('../../../directive/floatWithSelection', () => ({+ floatWithSelection: vi.fn(),+}));+vi.mock('@core/component/EntityIcon', () => ({ EntityIcon: () => null }));+vi.mock('@core/component/UserIcon', () => ({ UserIcon: () => null }));+vi.mock('@core/constant/allBlocks', () => ({+ fileTypeToBlockName: () => 'md',+}));+vi.mock('../../../plugins/mentions', () => ({+ INSERT_DOCUMENT_MENTION_COMMAND: { type: 'insert-document' },+ INSERT_PR_MENTION_COMMAND: { type: 'insert-pr' },+}));+vi.mock('@ui', () => ({+ Surface: (props: ParentProps) => <div>{props.children}</div>,+ cn: (base: string) => base,+}));++beforeEach(() => {+ vi.clearAllMocks();+ Element.prototype.scrollIntoView = vi.fn();+});+afterEach(cleanup);++function setup(agent = true) {+ const editor = createEditor();+ const dispatch = vi.spyOn(editor, 'dispatchCommand');+ const menu = createMenuOperations();+ const [commands, setCommands] = createSignal([+ { name: 'compact', description: 'Summarize context', inputHint: null },+ ]);+ render(() => (+ <SkillsMenu+ editor={editor}+ menu={menu}+ agentCommands={agent ? commands : undefined}+ />+ ));+ menu.openMenu();+ return { editor, dispatch, menu, setCommands };+}++describe('skill slash menu', () => {+ it('offers skills and PRs before the harness advertises commands', () => {+ const { setCommands } = setup();+ setCommands([]);+ expect(screen.getByText('My skill')).toBeTruthy();+ expect(screen.getByText('Pull requests')).toBeTruthy();+ expect(screen.getByText('Fix skills')).toBeTruthy();+ expect(screen.getByText('No commands available')).toBeTruthy();+ });++ it('inserts a skill through the agent search plugin', () => {+ const { dispatch, menu } = setup();+ fireEvent.click(screen.getByText('My skill'));+ expect(dispatch).toHaveBeenCalledWith(+ REMOVE_AGENT_COMMAND_SEARCH_COMMAND,+ undefined+ );+ expect(dispatch).toHaveBeenCalledWith(INSERT_DOCUMENT_MENTION_COMMAND, {+ documentId: 'mine',+ documentName: 'My skill',+ blockName: 'skill',+ });+ expect(menu.isOpen()).toBe(false);+ });++ it('opens the existing skill without inserting a mention', () => {+ const { dispatch, menu } = setup();+ fireEvent.click(screen.getByRole('button', { name: 'Edit My skill' }));+ expect(mocks.open).toHaveBeenCalledWith(+ { type: 'skill', id: 'mine' },+ { preferNewSplit: true }+ );+ expect(dispatch).not.toHaveBeenCalledWith(+ INSERT_DOCUMENT_MENTION_COMMAND,+ expect.anything()+ );+ expect(menu.isOpen()).toBe(false);+ });++ it('offers deletion only for owned documents and reuses the delete flow', () => {+ setup();+ expect(+ screen.queryByRole('button', { name: 'Delete Shared skill' })+ ).toBeNull();+ expect(screen.queryByRole('button', { name: /Edit Built-in/ })).toBeNull();+ expect(+ screen.queryByRole('button', { name: /Delete Built-in/ })+ ).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'Delete My skill' }));+ expect(mocks.delete).toHaveBeenCalledWith([+ expect.objectContaining({ id: 'mine' }),+ ]);+ });++ it('navigates across sections and inserts a PR chip then a command', () => {+ const { dispatch, menu } = setup();+ for (let i = 0; i < 3; i++)+ fireEvent.keyDown(document, { key: 'ArrowDown' });+ fireEvent.keyDown(document, { key: 'Enter' });+ expect(dispatch).toHaveBeenCalledWith(INSERT_PR_MENTION_COMMAND, {+ id: 'pr-42',+ label: 'macro/app#42',+ });+ menu.openMenu();+ for (let i = 0; i < 4; i++)+ fireEvent.keyDown(document, { key: 'ArrowDown' });+ fireEvent.keyDown(document, { key: 'Enter' });+ expect(dispatch).toHaveBeenCalledWith(INSERT_AGENT_COMMAND_COMMAND, {+ name: 'compact',+ description: 'Summarize context',+ inputHint: null,+ });+ });++ it('filters all sections and keeps new-skill creation selectable', async () => {+ const { menu } = setup();+ menu.setSearchTerm('compact');+ await waitFor(() => expect(screen.queryByText('My skill')).toBeNull());+ expect(screen.queryByText('Fix skills')).toBeNull();+ expect(screen.getByText('/compact')).toBeTruthy();+ fireEvent.keyDown(document, { key: 'ArrowUp' });+ fireEvent.keyDown(document, { key: 'Enter' });+ expect(mocks.create).toHaveBeenCalledWith(+ expect.objectContaining({ id: 'skill-compose' })+ );+ });++ it('keeps regular chat menus limited to skills with the same edit controls', () => {+ setup(false);+ expect(screen.queryByText('Pull requests')).toBeNull();+ expect(screen.queryByText('Commands')).toBeNull();+ expect(screen.getByRole('button', { name: 'Edit My skill' })).toBeTruthy();+ });+});diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/SkillsMenu.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/SkillsMenu.tsxindex 574199e343..bee34f0da7 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/SkillsMenu.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/SkillsMenu/SkillsMenu.tsx@@ -1,3 +1,4 @@+import { makeDeleteAction } from '@app/features/next-soup/actions/make-delete-action';import { useAnalytics } from '@app/lib/analytics/analytics-context';import type {ComposeSkillProps,@@ -7,16 +8,20 @@ import { useSplitLayout } from '@components/app/split-layout/layout';import { type PortalScope, ScopedPortal } from '@core/component/ScopedPortal';import type { EntityItem } from '@core/context/quickAccess';import { searchQuickAccessEntities } from '@core/context/quickAccess/entity-search';+import { useUserId } from '@core/context/user';import clickOutside from '@core/directive/clickOutside';import { debouncedDependent } from '@core/util/debounce';import { useIsKeyPressActive } from '@core/util/useIsKeyPressActive';+import type { GithubPullRequestEntity } from '@entity';import PlusIcon from '@phosphor/plus.svg';+import { useSlashMenuPullRequests } from '@queries/soup/slash-menu-pull-requests';import { useSystemSkillsQuery } from '@queries/storage/system-skills';import type { SystemSkillSummary } from '@service-storage/generated/schemas/systemSkillSummary';import { cn, Surface } from '@ui';import type { LexicalEditor } from 'lexical';import {createEffect,+ createMemo,createSignal,For,onCleanup,@@ -26,21 +31,35 @@ import {untrack,} from 'solid-js';import { floatWithSelection } from '../../../directive/floatWithSelection';-import { INSERT_DOCUMENT_MENTION_COMMAND } from '../../../plugins/mentions';+import {+ type AgentCommandItem,+ CLOSE_AGENT_COMMAND_SEARCH_COMMAND,+ INSERT_AGENT_COMMAND_COMMAND,+ REMOVE_AGENT_COMMAND_SEARCH_COMMAND,+} from '../../../plugins/agent-commands';+import {+ INSERT_DOCUMENT_MENTION_COMMAND,+ INSERT_PR_MENTION_COMMAND,+} from '../../../plugins/mentions';import {CLOSE_SKILL_SEARCH_COMMAND,REMOVE_SKILL_SEARCH_COMMAND,} from '../../../plugins/skills';import type { MenuOperations } from '../../../shared/inlineMenu';+import { AgentCommandRow } from '../AgentCommandsMenu/AgentCommandRow';+import { filterCommands } from '../AgentCommandsMenu/filterCommands';+import { ItemBin } from '../MentionsMenu/components/ItemBin';import { MentionsMenuItem } from '../MentionsMenu/components/MentionsMenuItem';import { useEntityMention } from '../MentionsMenu/hooks/useEntityMention';import { useMenuKeyboardNavigation } from '../useMenuKeyboardNavigation';+import { PullRequestRow } from './PullRequestRow';+import { SkillActions } from './SkillActions';false && clickOutside;false && floatWithSelection;-// Height consumed by Surface's border + vertical padding-const PANEL_DECORATION_HEIGHT = 18;+// Surface border/padding plus the fixed New skill footer.+const PANEL_DECORATION_HEIGHT = 58;/*** A built-in system skill as a menu item. System skills are static strings in@@ -72,6 +91,8 @@ type SkillsMenuProps = {/** whether the menu checks against block boundary in floating middleware. uses floating-ui default if false. */useBlockBoundary?: boolean;portalScope?: PortalScope;+ /** Enables the combined agent menu, even before any commands arrive. */+ agentCommands?: () => AgentCommandItem[];};/**@@ -108,6 +129,25 @@ function SkillsMenuInner(props: SkillsMenuProps) {...searchQuickAccessEntities(systemSkillItems(), activeSearchTerm()),];+ const commands = createMemo(() =>+ filterCommands(props.agentCommands?.() ?? [], activeSearchTerm())+ );+ const { query: pullRequestQuery, pullRequests: allPullRequests } =+ useSlashMenuPullRequests(+ () => !!props.agentCommands && props.menu.isOpen()+ );+ const pullRequests = createMemo(() => {+ if (!props.agentCommands) return [];+ const term = activeSearchTerm().trim().toLowerCase();+ return allPullRequests().filter((item) =>+ `${item.name} ${item.metadata.owner}/${item.metadata.repo} #${item.metadata.number}`+ .toLowerCase()+ .includes(term)+ );+ });+ const commandOffset = () => skills().length + pullRequests().length;+ const newSkillIndex = () => commandOffset() + commands().length;+const [selectedIndex, setSelectedIndex] = createSignal(0);const [mountSelection, setMountSelection] = createSignal<Selection | null>();const [escapeSpaceState, setEscapeSpaceState] = createSignal<@@ -137,8 +177,7 @@ function SkillsMenuInner(props: SkillsMenuProps) {setSelectedIndex(0);});- // Selectable rows: every skill plus the trailing "New skill" row.- const itemCount = () => skills().length + 1;+ const itemCount = () => newSkillIndex() + 1;createEffect(() => {if (selectedIndex() >= itemCount()) {@@ -147,13 +186,28 @@ function SkillsMenuInner(props: SkillsMenuProps) {});const closeMenu = () => {- props.editor.dispatchCommand(CLOSE_SKILL_SEARCH_COMMAND, undefined);+ props.editor.dispatchCommand(+ props.agentCommands+ ? CLOSE_AGENT_COMMAND_SEARCH_COMMAND+ : CLOSE_SKILL_SEARCH_COMMAND,+ undefined+ );+ setMenuOpen(false);+ };++ const removeSearch = () => {+ props.editor.dispatchCommand(+ props.agentCommands+ ? REMOVE_AGENT_COMMAND_SEARCH_COMMAND+ : REMOVE_SKILL_SEARCH_COMMAND,+ undefined+ );setMenuOpen(false);};const insertSkill = (item: EntityItem) => {analytics.track('skills_menu_use', {});- props.editor.dispatchCommand(REMOVE_SKILL_SEARCH_COMMAND, undefined);+ removeSearch();props.editor.dispatchCommand(INSERT_DOCUMENT_MENTION_COMMAND, {documentId: item.id,documentName: item.data.name ?? '',@@ -166,15 +220,38 @@ function SkillsMenuInner(props: SkillsMenuProps) {insertSkill(item);};- const { popoverSplit } = useSplitLayout();+ const insertPullRequest = (item: GithubPullRequestEntity) => {+ removeSearch();+ props.editor.dispatchCommand(INSERT_PR_MENTION_COMMAND, {+ id: item.id,+ label: `${item.metadata.owner}/${item.metadata.repo}#${item.metadata.number}`,+ });+ };++ const insertCommand = (command: AgentCommandItem) => {+ props.editor.dispatchCommand(INSERT_AGENT_COMMAND_COMMAND, command);+ setMenuOpen(false);+ };++ const { popoverSplit, openWithSplit } = useSplitLayout();+ const deleteAction = makeDeleteAction({ userId: useUserId() });++ const editSkill = (item: EntityItem) => {+ closeMenu();+ openWithSplit({ type: 'skill', id: item.id }, { preferNewSplit: true });+ };++ const deleteSkill = (item: EntityItem) => {+ closeMenu();+ void deleteAction.execute([item.data]);+ };/*** Opens the skill composer dialog; when the skill is created there, its* mention is inserted at the cursor so the AI picks it up.*/const createNewSkill = () => {- props.editor.dispatchCommand(REMOVE_SKILL_SEARCH_COMMAND, undefined);- setMenuOpen(false);+ removeSearch();const onSuccess = ({ documentId, title }: ComposeSkillSuccess) => {props.editor.dispatchCommand(INSERT_DOCUMENT_MENTION_COMMAND, {documentId,@@ -205,8 +282,15 @@ function SkillsMenuInner(props: SkillsMenuProps) {},onSelect: () => {const selectedItem = skills()[selectedIndex()];+ const selectedPullRequest =+ pullRequests()[selectedIndex() - skills().length];+ const selectedCommand = commands()[selectedIndex() - commandOffset()];if (selectedItem) {itemAction(selectedItem);+ } else if (selectedPullRequest) {+ insertPullRequest(selectedPullRequest);+ } else if (selectedCommand) {+ insertCommand(selectedCommand);} else {void createNewSkill();}@@ -245,8 +329,9 @@ function SkillsMenuInner(props: SkillsMenuProps) {const contentMaxHeight = () => {const h = menuAvailableHeight();- if (h === undefined) return 256;- return Math.min(256, Math.max(0, h - PANEL_DECORATION_HEIGHT));+ const preferredHeight = props.agentCommands ? 384 : 256;+ if (h === undefined) return preferredHeight;+ return Math.min(preferredHeight, Math.max(0, h - PANEL_DECORATION_HEIGHT));};return (@@ -266,35 +351,133 @@ function SkillsMenuInner(props: SkillsMenuProps) {on:touchstart={(e) => e.stopPropagation()}><Surface depth={2} class="pt-2 pb-1.5 glass bg-menu-glass rounded-xl">- <div class="px-3.5 pb-1 text-xs font-medium text-ink-muted">- Skills- </div>- <Show- when={skills().length > 0}- fallback={- <div class="px-3.5 pb-1 text-ink-extra-muted">- {searchTerm() ? 'No results' : 'No skills yet'}- </div>- }+ <div+ class="overflow-y-auto scrollbar-hidden"+ style={{ 'max-height': `${contentMaxHeight()}px` }}>- <div- class="overflow-y-auto scrollbar-hidden"- style={{ 'max-height': `${contentMaxHeight()}px` }}+ <ItemBin+ label="Skills"+ binType="skills"+ isSelected={selectedIndex() < skills().length}>- <For each={skills()}>- {(item, index) => (- <MentionsMenuItem- item={item}- index={index()}- selected={index() === selectedIndex()}- itemAction={() => itemAction(item)}- setIndex={setSelectedIndexFromMouse}- setOpen={setMenuOpen}- />- )}- </For>- </div>- </Show>+ <Show+ when={skills().length > 0}+ fallback={+ <div class="px-3.5 pb-2 text-xs text-ink-extra-muted">+ {searchTerm() ? 'No matching skills' : 'No skills yet'}+ </div>+ }+ >+ <For each={skills()}>+ {(item, index) => (+ <MentionsMenuItem+ item={item}+ index={index()}+ selected={index() === selectedIndex()}+ itemAction={() => itemAction(item)}+ setIndex={setSelectedIndexFromMouse}+ setOpen={setMenuOpen}+ actions={+ <Show+ when={+ item.data.ownerId !== '' &&+ !systemSkills.isSystemSkillId(item.id)+ }+ >+ <SkillActions+ item={item}+ onEdit={() => editSkill(item)}+ onDelete={+ deleteAction.canExecute(item.data)+ ? () => deleteSkill(item)+ : undefined+ }+ />+ </Show>+ }+ />+ )}+ </For>+ </Show>+ </ItemBin>+ <Show when={props.agentCommands}>+ <div class="mt-2 border-t border-edge pt-2">+ <ItemBin+ label="Pull requests"+ binType="pull-requests"+ isSelected={+ selectedIndex() >= skills().length &&+ selectedIndex() < commandOffset()+ }+ >+ <Show+ when={pullRequests().length > 0}+ fallback={+ <div class="px-3.5 pb-2 text-xs text-ink-extra-muted">+ {pullRequestQuery.isError+ ? 'Could not load pull requests'+ : pullRequestQuery.isPending+ ? 'Loading pull requests…'+ : 'No matching pull requests'}+ </div>+ }+ >+ <For each={pullRequests()}>+ {(item, index) => (+ <PullRequestRow+ item={item}+ selected={+ selectedIndex() === skills().length + index()+ }+ onHover={() =>+ setSelectedIndexFromMouse(+ skills().length + index()+ )+ }+ onSelect={() => insertPullRequest(item)}+ />+ )}+ </For>+ </Show>+ </ItemBin>+ </div>+ <div class="mt-2 border-t border-edge pt-2">+ <ItemBin+ label="Commands"+ binType="commands"+ isSelected={+ selectedIndex() >= commandOffset() &&+ selectedIndex() < newSkillIndex()+ }+ >+ <Show+ when={commands().length > 0}+ fallback={+ <div class="px-3.5 pb-2 text-xs text-ink-extra-muted">+ {searchTerm()+ ? 'No matching commands'+ : 'No commands available'}+ </div>+ }+ >+ <For each={commands()}>+ {(command, index) => (+ <AgentCommandRow+ command={command}+ index={commandOffset() + index()}+ selected={+ selectedIndex() === commandOffset() + index()+ }+ setIndex={setSelectedIndexFromMouse}+ itemAction={() => insertCommand(command)}+ />+ )}+ </For>+ </Show>+ </ItemBin>+ </div>+ </Show>+ </div><div class="mt-1 pt-1 border-t border-edge"><divon:mouseup={(e) => {@@ -309,9 +492,9 @@ function SkillsMenuInner(props: SkillsMenuProps) {void createNewSkill();e.stopPropagation();}}- on:mousemove={() => setSelectedIndexFromMouse(skills().length)}+ on:mousemove={() => setSelectedIndexFromMouse(newSkillIndex())}class={cn('group flex items-center p-1.5 mx-1.5 rounded-md', {- 'bg-ink/5': selectedIndex() === skills().length,+ 'bg-ink/5': selectedIndex() === newSkillIndex(),})}><div class="mr-2 flex items-center">diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/agent-commands/agentCommandsPlugin.test.ts b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/agent-commands/agentCommandsPlugin.test.tsnew file mode 100644index 0000000000..ee97dd5fea--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/agent-commands/agentCommandsPlugin.test.ts@@ -0,0 +1,82 @@+import { registerRichText } from '@lexical/rich-text';+import { InlineSearchNode } from '@macro-inc/lexical-core';+import { $createParagraphNode, $getRoot, createEditor } from 'lexical';+import { afterEach, describe, expect, it } from 'vitest';+import { createMenuOperations } from '../../shared/inlineMenu';+import {+ agentCommandsPlugin,+ INSERT_AGENT_COMMAND_COMMAND,+ REMOVE_AGENT_COMMAND_SEARCH_COMMAND,+} from './agentCommandsPlugin';++const cleanups: (() => void)[] = [];+afterEach(() => cleanups.splice(0).forEach((cleanup) => cleanup()));++function setup() {+ const editor = createEditor({+ namespace: 'agent-slash-test',+ nodes: [InlineSearchNode],+ onError: (error) => {+ throw error;+ },+ });+ const root = document.createElement('div');+ root.contentEditable = 'true';+ document.body.append(root);+ editor.setRootElement(root);+ const menu = createMenuOperations();+ const unregisterRichText = registerRichText(editor);+ const unregisterPlugin = agentCommandsPlugin({ menu })(editor);+ editor.update(+ () => {+ const paragraph = $createParagraphNode();+ $getRoot().clear().append(paragraph);+ paragraph.select();+ },+ { discrete: true }+ );+ root.dispatchEvent(new KeyboardEvent('keydown', { key: '/', bubbles: true }));+ cleanups.push(() => {+ unregisterPlugin();+ unregisterRichText();+ editor.setRootElement(null);+ root.remove();+ });+ return { editor, menu };+}++describe('agent slash trigger', () => {+ it('opens without advertised commands so skills can be selected', () => {+ const { editor, menu } = setup();+ editor.read(() => expect($getRoot().getTextContent()).toBe('/'));+ expect(menu.isOpen()).toBe(true);+ });++ it.each([null, 'instructions'])(+ 'inserts commands with an argument space only when needed (%s)',+ (inputHint) => {+ const { editor } = setup();+ editor.dispatchCommand(INSERT_AGENT_COMMAND_COMMAND, {+ name: 'review',+ description: 'Review code',+ inputHint,+ });+ editor.read(() => {+ expect($getRoot().getTextContent()).toBe(+ inputHint ? '/review ' : '/review'+ );+ expect(+ $getRoot()+ .getAllTextNodes()+ .some((node) => node instanceof InlineSearchNode)+ ).toBe(false);+ });+ }+ );++ it('removes the slash search before inserting skill or PR mentions', () => {+ const { editor } = setup();+ editor.dispatchCommand(REMOVE_AGENT_COMMAND_SEARCH_COMMAND, undefined);+ editor.read(() => expect($getRoot().getTextContent()).toBe(''));+ });+});diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/agent-commands/agentCommandsPlugin.ts b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/agent-commands/agentCommandsPlugin.tsindex 5343097a45..7c07e1b0c4 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/agent-commands/agentCommandsPlugin.ts+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/agent-commands/agentCommandsPlugin.ts@@ -60,8 +60,6 @@ export const INSERT_AGENT_COMMAND_COMMAND: LexicalCommand<AgentCommandItem> =type AgentCommandsPluginProps = {menu: MenuOperations;- /** Reactive source of the commands the connected agent advertises. */- commands: () => AgentCommandItem[];peerIdValidator?: PeerIdValidator;};@@ -92,10 +90,9 @@ function $getActiveCommandSearchNode(): InlineSearchNode | null {/*** Registers the `/` trigger for the agent commands menu. Typing `/` at a* valid trigger position (start of line or after whitespace) opens a- * typeahead listing the slash commands the connected agent advertised over- * ACP; selecting one inserts `/name` as plain text at the cursor (see- * AgentCommandsMenu). The `/` falls through as regular text while the agent- * has not advertised any commands.+ * combined skills, pull requests, and harness commands menu. Skills remain+ * available before the agent advertises any commands. Selecting a command+ * inserts `/name` as plain text at the cursor.** Shares the `/` symbol with the actions and skills menus, so this plugin* must only be enabled in editors where both of those are disabled — the@@ -125,7 +122,6 @@ function registerAgentCommandsPlugin(const { menu } = props;function typeSymbolCommand() {- if (props.commands().length === 0) return false;const shouldTrigger = validTriggerPosition(editor, beforeRegex, afterRegex);if (shouldTrigger) {editor.update(() => {diff --git a/apps/web/src/lib/queries/soup/slash-menu-pull-requests.ts b/apps/web/src/lib/queries/soup/slash-menu-pull-requests.tsnew file mode 100644index 0000000000..bf50aa8b6e--- /dev/null+++ b/apps/web/src/lib/queries/soup/slash-menu-pull-requests.ts@@ -0,0 +1,25 @@+import { QUERY_FILTERS_BASE } from '@app/features/next-soup/filters/query-filters';+import { isGithubPrEntity } from '@entity';+import { type Accessor, createMemo } from 'solid-js';+import { queryReadyGate } from '../gate';+import { useSoupItemsQuery } from './items';++/** Accessible pull requests, using the same live feed as the PR list. */+export function useSlashMenuPullRequests(enabled: Accessor<boolean>) {+ const query = useSoupItemsQuery(+ () => ({+ params: { limit: 500, sort_method: 'viewed_updated' },+ body: {+ ...QUERY_FILTERS_BASE,+ foreign_entity_filters: {+ foreign_entity_sources: ['github_pull_request'],+ },+ },+ }),+ () => ({ enabled: enabled(), staleTime: 60_000 })+ );+ const pullRequests = createMemo(() =>+ queryReadyGate(query) ? query.data.filter(isGithubPrEntity) : []+ );+ return { query, pullRequests };+}diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.mdindex a30f2acd29..2d888660bf 100644--- a/docs/AGENT_GUIDE/ai-chat.md+++ b/docs/AGENT_GUIDE/ai-chat.md@@ -504,8 +504,14 @@ An agent session is `/app/agent/<uuid>`. The composer placeholder is**`Message the agent, @mention anything`**. Creating one (`c` then `a`, or`Create` → `Agent`) leaves that composer focused — on mobile that is the sameCreate-menu `triggerFocusInput` as chat, so the keyboard opens. Type `/` to-open slash commands the connected agent advertised (Claude, OpenCode, and-Cursor). `/` stays ordinary text until that list arrives. Type `@` to insert the same mention chips+open sections for **Skills**, **Pull requests**, and **Commands**. Skills are+available even before the connected agent advertises commands. Select a skill+to insert its mention, a pull request to reference it, or a harness command+to insert `/name` as text. Search filters all sections; arrow keys move across+sections and Enter selects the highlighted item. Saved skills have an **Edit**+button that opens their document editor; skills you own also have **Delete**,+which opens the usual deletion confirmation. Built-in skills have no edit or+delete controls. **New skill** creates a skill and inserts its mention. Type `@` to insert the same mention chipsused in chat and channels; they serialize as mention-chip tags in the promptthe agent sees (`<m-document-mention>` for docs/channels/chats/tasks/emails/calendarevents/skills, `<m-date-mention>` for a day or time, `<m-agent-session-mention>`