Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(composer): restore missing slash command and mention triggers

Steven Enamakelde2caef66bb4
diff --git a/app/src/components/assistant-ui/elements/composer.tsx b/app/src/components/assistant-ui/elements/composer.tsx
index 73d2feab14..8d4467ab1c 100644
--- a/app/src/components/assistant-ui/elements/composer.tsx
+++ b/app/src/components/assistant-ui/elements/composer.tsx
@@ -114,10 +114,7 @@ export function ComposerCommandItem({
command,
active,
...props
-}: Omit<ComponentProps<'button'>, 'children'> & {
- command: ComposerCommand;
- active: boolean;
-}) {
+}: Omit<ComponentProps<'button'>, 'children'> & { command: ComposerCommand; active: boolean }) {
return (
<ComposerMenuItem active={active} {...props}>
<command.icon className="text-foreground/35 size-3.5 shrink-0" />
@@ -138,10 +135,7 @@ export function ComposerPersonItem({
person,
active,
...props
-}: Omit<ComponentProps<'button'>, 'children'> & {
- person: ComposerPerson;
- active: boolean;
-}) {
+}: Omit<ComponentProps<'button'>, 'children'> & { person: ComposerPerson; active: boolean }) {
return (
<ComposerMenuItem active={active} {...props}>
<span className="bg-foreground/[0.06] text-foreground/45 flex size-5 shrink-0 items-center justify-center rounded-full text-[9px] font-medium">
diff --git a/app/src/components/assistant-ui/thread.composerTriggers.test.tsx b/app/src/components/assistant-ui/thread.composerTriggers.test.tsx
index d427bb8d73..6eb27db78a 100644
--- a/app/src/components/assistant-ui/thread.composerTriggers.test.tsx
+++ b/app/src/components/assistant-ui/thread.composerTriggers.test.tsx
@@ -1,8 +1,8 @@
import {
AssistantRuntimeProvider,
type ThreadMessageLike,
- useExternalStoreRuntime,
unstable_useTriggerPopoverRootContextOptional,
+ useExternalStoreRuntime,
} from '@assistant-ui/react';
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
diff --git a/app/src/features/conversations/aui/ComposerTriggers.test.tsx b/app/src/features/conversations/aui/ComposerTriggers.test.tsx
index ece3a016c4..3eed4a8d05 100644
--- a/app/src/features/conversations/aui/ComposerTriggers.test.tsx
+++ b/app/src/features/conversations/aui/ComposerTriggers.test.tsx
@@ -1,10 +1,10 @@
-import { combineReducers, configureStore } from '@reduxjs/toolkit';
import {
AssistantRuntimeProvider,
ComposerPrimitive,
type ThreadMessageLike,
useExternalStoreRuntime,
} from '@assistant-ui/react';
+import { combineReducers, configureStore } from '@reduxjs/toolkit';
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
import type { ReactNode } from 'react';
import { Provider } from 'react-redux';
diff --git a/app/src/features/conversations/aui/useMentionSource.test.tsx b/app/src/features/conversations/aui/useMentionSource.test.tsx
index 507bf0f181..08dc09c70f 100644
--- a/app/src/features/conversations/aui/useMentionSource.test.tsx
+++ b/app/src/features/conversations/aui/useMentionSource.test.tsx
@@ -1,4 +1,3 @@
-import { combineReducers, configureStore } from '@reduxjs/toolkit';
import {
AssistantRuntimeProvider,
type ThreadMessageLike,
@@ -6,6 +5,7 @@ import {
useAui,
useExternalStoreRuntime,
} from '@assistant-ui/react';
+import { combineReducers, configureStore } from '@reduxjs/toolkit';
import { act, renderHook, waitFor } from '@testing-library/react';
import type { ReactNode } from 'react';
import { Provider } from 'react-redux';
@@ -95,7 +95,12 @@ describe('memoryMentionsFromChunks', () => {
const [mention] = memoryMentionsFromChunks([
chunk('c1', 'Design [sync]\nnotes {v2} with a very long tail that keeps going on'),
]);
- expect(mention).toMatchObject({ id: 'c1', type: 'memory', description: 'email', icon: 'memory' });
+ expect(mention).toMatchObject({
+ id: 'c1',
+ type: 'memory',
+ description: 'email',
+ icon: 'memory',
+ });
expect(mention!.label).toBe('Design sync notes v2 with a very long tail that…');
const text = unstable_defaultDirectiveFormatter.serialize(mention!);
@@ -111,7 +116,9 @@ describe('memoryMentionsFromChunks', () => {
});
it('falls back to the source id when a chunk has no preview', () => {
- const [mention] = memoryMentionsFromChunks([{ ...chunk('c2', ''), content_preview: undefined }]);
+ const [mention] = memoryMentionsFromChunks([
+ { ...chunk('c2', ''), content_preview: undefined },
+ ]);
expect(mention!.label).toBe('thread-9');
});
});
diff --git a/app/src/features/conversations/aui/useMentionSource.ts b/app/src/features/conversations/aui/useMentionSource.ts
index d9f2561969..34a0d04f21 100644
--- a/app/src/features/conversations/aui/useMentionSource.ts
+++ b/app/src/features/conversations/aui/useMentionSource.ts
@@ -39,10 +39,7 @@ const RECALL_DEBOUNCE_MS = 200;
const MIN_QUERY_LENGTH = 2;
const MAX_LABEL_LENGTH = 48;
-const ICON_MAP: Record<string, Unstable_IconComponent> = {
- memory: BrainIcon,
- files: FileIcon,
-};
+const ICON_MAP: Record<string, Unstable_IconComponent> = { memory: BrainIcon, files: FileIcon };
const NO_ARTIFACTS: readonly ArtifactSnapshot[] = [];
diff --git a/app/src/features/conversations/aui/useSlashCommandSource.test.tsx b/app/src/features/conversations/aui/useSlashCommandSource.test.tsx
index 4e29c59b86..461a78e1ca 100644
--- a/app/src/features/conversations/aui/useSlashCommandSource.test.tsx
+++ b/app/src/features/conversations/aui/useSlashCommandSource.test.tsx
@@ -1,17 +1,17 @@
-import { combineReducers, configureStore } from '@reduxjs/toolkit';
import {
AssistantRuntimeProvider,
type ThreadMessageLike,
useAui,
useExternalStoreRuntime,
} from '@assistant-ui/react';
+import { combineReducers, configureStore } from '@reduxjs/toolkit';
import { act, renderHook, waitFor } from '@testing-library/react';
import type { ReactNode } from 'react';
import { Provider } from 'react-redux';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { MOCK_COMMANDS_LIST } from '../../../pages/dev/assistant-ui-demo/assistantUiMock/mockScript';
import { registry } from '../../../lib/commands/registry';
+import { MOCK_COMMANDS_LIST } from '../../../pages/dev/assistant-ui-demo/assistantUiMock/mockScript';
import { callCoreRpc } from '../../../services/coreRpcClient';
import runModeReducer from '../../../store/runModeSlice';
import {
@@ -62,10 +62,9 @@ function setup({ running = false }: { running?: boolean } = {}) {
<Runtime>{children}</Runtime>
</Provider>
);
- const hook = renderHook(
- () => ({ source: useSlashCommandSource('t1'), aui: useAui() }),
- { wrapper }
- );
+ const hook = renderHook(() => ({ source: useSlashCommandSource('t1'), aui: useAui() }), {
+ wrapper,
+ });
return { store, onCancel, ...hook };
}
diff --git a/app/src/lib/i18n/ar.ts b/app/src/lib/i18n/ar.ts
index 17c0d667d4..bd37b405ec 100644
--- a/app/src/lib/i18n/ar.ts
+++ b/app/src/lib/i18n/ar.ts
@@ -167,8 +167,7 @@ const messages: TranslationMap = {
'يتم تخزين خزنة الذاكرة هذه على مضيف openhuman-core ({os}). لا يمكن فتحها أو عرضها إلا على ذلك الجهاز، وليس من هذا الجهاز.',
// Guardrail notice for a `chat_error{error_type:"guardrail"}` turn (wire-contract.md).
'conversations.chatError.guardrail.title': 'لم يمر هذا الطلب بفحص أمان',
- 'conversations.chatError.guardrail.explanationFallback':
- 'منعت السياسة هذا الرد قبل إرساله.',
+ 'conversations.chatError.guardrail.explanationFallback': 'منعت السياسة هذا الرد قبل إرساله.',
'conversations.chatError.guardrail.tryInstead': 'جرّب بدلاً من ذلك',
'conversations.toolFailure.whyLabel': 'لماذا',
'conversations.toolFailure.nextLabel': 'ما الذي يجب فعله بعد ذلك',
diff --git a/app/src/pages/dev/ToolCallGallery.tsx b/app/src/pages/dev/ToolCallGallery.tsx
index 03a6268628..20c70c724f 100644
--- a/app/src/pages/dev/ToolCallGallery.tsx
+++ b/app/src/pages/dev/ToolCallGallery.tsx
@@ -6,6 +6,7 @@
* each tool's icon and both tenses, so a label or icon regression is visible
* at a glance. Registered only in dev builds (see `AppRoutes.tsx`).
*/
+import { BrainIcon, FileIcon, ListChecksIcon, SparklesIcon, WorkflowIcon } from 'lucide-react';
import { useState } from 'react';
import {
@@ -32,7 +33,19 @@ import { ToolIcon } from '../../features/conversations/tools/ToolIcon';
import { describeToolCall, toolLabel } from '../../features/conversations/tools/toolPresentation';
import { useT } from '../../lib/i18n/I18nContext';
import type { PendingApproval } from '../../store/chatRuntimeSlice';
-import { MOCK_MESSAGE_QUEUE } from './assistant-ui-demo/assistantUiMock/mockScript';
+import {
+ MOCK_COMMANDS_LIST,
+ MOCK_MEMORY_RECALL,
+ MOCK_MESSAGE_QUEUE,
+ MOCK_THREAD_FILES,
+} from './assistant-ui-demo/assistantUiMock/mockScript';
+
+/** Icon per `commands_list` kind for the composer menu fixture. */
+const COMMAND_KIND_ICONS = {
+ builtin: ListChecksIcon,
+ skill: SparklesIcon,
+ workflow: WorkflowIcon,
+} as const;
/** Fixtures for every approval-card state (WS-B, assistant-ui-elements plan). */
const APPROVAL_PENDING_APPROVAL: PendingApproval = {
@@ -396,6 +409,45 @@ export default function ToolCallGallery() {
<Timeline events={MEMORY_TIMELINE_EVENTS} visibleCount={MEMORY_TIMELINE_EVENTS.length} />
</section>
+ <section className="flex flex-col gap-2">
+ <h2 className="text-foreground/60 mb-2 text-xs font-medium uppercase">
+ Composer / and @ menus
+ </h2>
+ <ComposerMenu
+ open
+ data-testid="tool-gallery-slash-menu"
+ className="relative bottom-auto mb-0">
+ {MOCK_COMMANDS_LIST.map((command, index) => (
+ <ComposerCommandItem
+ key={command.id}
+ active={index === 0}
+ command={{
+ name: command.id,
+ description: command.description ?? command.label,
+ icon: COMMAND_KIND_ICONS[command.kind],
+ }}
+ />
+ ))}
+ </ComposerMenu>
+ <ComposerMenu
+ open
+ data-testid="tool-gallery-mention-menu"
+ className="relative bottom-auto mb-0">
+ {MOCK_MEMORY_RECALL.chunks.map((chunk, index) => (
+ <ComposerMenuItem key={chunk.id} active={index === 0}>
+ <BrainIcon className="text-foreground/35 size-3.5 shrink-0" />
+ <span className="flex-1 truncate text-start">{chunk.content_preview}</span>
+ </ComposerMenuItem>
+ ))}
+ {MOCK_THREAD_FILES.map(file => (
+ <ComposerMenuItem key={file.id}>
+ <FileIcon className="text-foreground/35 size-3.5 shrink-0" />
+ <span className="flex-1 truncate text-start">{file.label}</span>
+ </ComposerMenuItem>
+ ))}
+ </ComposerMenu>
+ </section>
+
<section>
<h2 className="text-foreground/60 mb-2 text-xs font-medium uppercase">
Core catalog ({(coreToolNames as string[]).length})
diff --git a/app/src/pages/dev/assistant-ui-demo/assistantUiMock/mockScript.ts b/app/src/pages/dev/assistant-ui-demo/assistantUiMock/mockScript.ts
index bf353474b5..02c7c90e3a 100644
--- a/app/src/pages/dev/assistant-ui-demo/assistantUiMock/mockScript.ts
+++ b/app/src/pages/dev/assistant-ui-demo/assistantUiMock/mockScript.ts
@@ -349,5 +349,9 @@ export const MOCK_MEMORY_RECALL: RecallResponse = {
};
export const MOCK_THREAD_FILES = [
- { id: 'mock-artifact-1', label: 'Signed contract', description: 'artifacts/signed-contract.docx' },
+ {
+ id: 'mock-artifact-1',
+ label: 'Signed contract',
+ description: 'artifacts/signed-contract.docx',
+ },
] as const;