You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/20 15:30:42 UTC
(maka) 01/09: fix(ui): make queued message delivery understandable
This is an automated email from the ASF dual-hosted git repository.
Astro-Han pushed a commit to branch fix/ui-queue-delivery-feedback
in repository https://gitbox.apache.org/repos/asf/maka.git
commit 2f5e39b4bcae0c857905cf2992f42eb5dafea6a0
Author: AstroHan <le...@outlook.com>
AuthorDate: Sun Sep 20 15:40:23 2026 +0800
fix(ui): make queued message delivery understandable
Explain unconfirmed delivery and the messages waiting behind it without
exposing Host terminology. Use labelled icon actions with tooltips and
one body text size across queue content and status. Keep the existing
Host admission, reconciliation identity and cancellation authority.
Extend the existing controller, composer and recovery checks and reuse
the queue story for unknown and failed delivery states. No new delivery
state or scheduler is introduced.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <15...@users.noreply.github.com>
Generated-by: Devin
---
apps/desktop/e2e/session-local-recovery.spec.ts | 8 +-
.../main/__tests__/message-queue-ui-state.test.ts | 52 ++++--
.../controller/session-local-messages.tsx | 19 ++-
.../src/renderer/locales/session-local-copy.ts | 50 +++---
apps/desktop/src/renderer/styles/composer.css | 7 +-
.../stories/composer-message-queue.stories.tsx | 178 +++++++++++++++++----
docs/astryx-surface-file-inventory.md | 2 +-
.../ui/src/__tests__/composer-send-toggle.test.tsx | 28 +++-
packages/ui/src/chat-turn.tsx | 2 +-
packages/ui/src/chat-view.tsx | 2 +-
packages/ui/src/composer-message-queue.tsx | 21 ++-
packages/ui/src/conversation-copy.ts | 18 +--
12 files changed, 284 insertions(+), 103 deletions(-)
diff --git a/apps/desktop/e2e/session-local-recovery.spec.ts b/apps/desktop/e2e/session-local-recovery.spec.ts
index 75b6cdf8e7..fa3787e74a 100644
--- a/apps/desktop/e2e/session-local-recovery.spec.ts
+++ b/apps/desktop/e2e/session-local-recovery.spec.ts
@@ -56,7 +56,7 @@ test('a locally saved message survives renderer and application restart, then ex
await awaitSendReady(page);
await page.locator(COMPOSER_INPUT).press('Enter');
await expect(page.locator(COMPOSER_INPUT)).toHaveText('');
- await expect(page.getByText('已本地保存 · 等待发送')).toBeVisible();
+ await expect(page.getByText('等待发送')).toBeVisible();
const before = await page.evaluate((id) => window.maka.sessionLocal.listMessages(id), sessionId!);
const message = before.find((item) => item.text === pending)!;
expect(message.state).toBe('saved');
@@ -65,7 +65,7 @@ test('a locally saved message survives renderer and application restart, then ex
await page.reload();
await ensureSidebarExpanded(page);
await page.locator(`[data-session-id=${JSON.stringify(sessionId)}]`).click();
- await expect(page.getByText('已本地保存 · 等待发送')).toBeVisible();
+ await expect(page.getByText('等待发送')).toBeVisible();
expect(
(await page.evaluate((id) => window.maka.sessionLocal.listMessages(id), sessionId!)).find(
(item) => item.text === pending,
@@ -146,7 +146,7 @@ test('a new task is readable locally before the Host session exists', async ({
await awaitSendReady(page);
await page.locator(COMPOSER_INPUT).press('Enter');
await expect(page.locator(COMPOSER_INPUT)).toHaveText('');
- await expect(page.getByText('已本地保存 · 等待发送')).toBeVisible();
+ await expect(page.getByText('等待发送')).toBeVisible();
await ensureSidebarExpanded(page);
const sessionId = await page
.locator('[data-session-id]:has([aria-current="page"])')
@@ -157,7 +157,7 @@ test('a new task is readable locally before the Host session exists', async ({
await page.reload();
await ensureSidebarExpanded(page);
await page.locator(`[data-session-id=${JSON.stringify(sessionId)}]`).click();
- await expect(page.getByText('已本地保存 · 等待发送')).toBeVisible();
+ await expect(page.getByText('等待发送')).toBeVisible();
await expect(page.getByText('读取任务失败', { exact: true })).toHaveCount(0);
page = await sessionLocalWindow.restart();
await ensureSidebarExpanded(page);
diff --git a/apps/desktop/src/main/__tests__/message-queue-ui-state.test.ts b/apps/desktop/src/main/__tests__/message-queue-ui-state.test.ts
index db165cc4cb..72792cccf6 100644
--- a/apps/desktop/src/main/__tests__/message-queue-ui-state.test.ts
+++ b/apps/desktop/src/main/__tests__/message-queue-ui-state.test.ts
@@ -33,16 +33,22 @@ test('local delivery recovery cannot republish accepted Host queue rows', async
const { root } = installReactRenderer();
const transient = new Map<string, TransientUserMessageProjection>();
let changed!: (sessionId: string) => void;
- let messages: DesktopLocalMessage[] = ['steering', 'followup', 'root'].map((messageId) => ({
- sessionId: 'session-1', messageId, createdAt: 1, state: 'unknown', canCancel: false,
- text: messageId, attachments: [], inlineReferences: [],
- placement: messageId === 'steering' ? 'current_turn' : 'next_turn',
- }));
+ const cancelled: string[][] = [];
+ const reconciled: string[][] = [];
+ let messages: DesktopLocalMessage[] = [
+ { sessionId: 'session-1', messageId: 'steering', createdAt: 1, state: 'unknown', canCancel: false,
+ text: 'steering', attachments: [], inlineReferences: [], placement: 'current_turn' },
+ { sessionId: 'session-1', messageId: 'followup', createdAt: 2, state: 'saved', canCancel: true,
+ text: 'followup', attachments: [], inlineReferences: [], placement: 'next_turn' },
+ { sessionId: 'session-1', messageId: 'root', createdAt: 3, state: 'unknown', canCancel: false,
+ text: 'root', attachments: [], inlineReferences: [], placement: 'next_turn' },
+ ];
await act(async () => root.render(createElement(LocaleProvider, { locale: 'en', children:
createElement(ConversationServicesProvider, { services: {
listMessages: async () => messages,
subscribeChanges: (handler) => { changed = handler; return () => {}; },
- cancelMessage: async () => {}, reconcileMessage: async () => {},
+ cancelMessage: async (sessionId, messageId) => { cancelled.push([sessionId, messageId]); },
+ reconcileMessage: async (sessionId, messageId) => { reconciled.push([sessionId, messageId]); },
sessions: { list: async () => [], subscribeChanges: () => () => {}, readSnapshot: async () => { throw new Error('unexpected snapshot read'); } },
skills: { listInvocable: async () => [] },
workspace: { searchFiles: async () => ({ ok: false as const, reason: 'no_project' as const }) },
@@ -55,13 +61,39 @@ test('local delivery recovery cannot republish accepted Host queue rows', async
reportError: (message) => { throw new Error(message); },
}) }),
})));
- assert.equal(transient.get('steering')?.deliveryActions?.length, 1, 'unconfirmed sends retain their receipt check');
- messages = messages.map((message) => ({ ...message, state: 'accepted', ...(message.messageId === 'root' ? { turnId: 'started-turn' } : {}) }));
+ const steering = transient.get('steering');
+ assert.equal(steering?.deliveryStatus, 'Delivery unconfirmed. Do not send again.');
+ assert.deepEqual(steering?.deliveryActions?.map((action) => action.label), ['Check delivery'],
+ 'an unconfirmed send offers only its receipt check, never cancellation');
+ const followup = transient.get('followup');
+ assert.equal(followup?.deliveryStatus, 'Waiting for earlier messages to be delivered',
+ 'a saved row behind an unresolved predecessor explains the wait');
+ assert.deepEqual(followup?.deliveryActions?.map((action) => action.label), ['Cancel sending']);
+ await act(async () => { await steering?.deliveryActions?.[0]?.onClick(); });
+ assert.deepEqual(reconciled, [['session-1', 'steering']]);
+ assert.equal(transient.has('steering'), true, 'checking delivery does not retire the row');
+ await act(async () => { await followup?.deliveryActions?.[0]?.onClick(); });
+ assert.deepEqual(cancelled, [['session-1', 'followup']]);
+ assert.equal(transient.has('followup'), false, 'cancel retires the local row');
+ messages = [
+ { ...messages[0]!, state: 'failed', canCancel: true },
+ { sessionId: 'session-1', messageId: 'settled', createdAt: 4, state: 'accepted', canCancel: false,
+ text: 'settled', attachments: [], inlineReferences: [], placement: 'next_turn' },
+ { ...messages[2]!, state: 'accepted', turnId: 'started-turn' },
+ { sessionId: 'session-1', messageId: 'later', createdAt: 5, state: 'saved', canCancel: true,
+ text: 'later', attachments: [], inlineReferences: [], placement: 'next_turn' },
+ ];
await act(async () => changed('session-1'));
- assert.deepEqual([...transient.keys()], ['root']);
+ const failed = transient.get('steering');
+ assert.equal(failed?.deliveryStatus, 'Could not send · message kept');
+ assert.deepEqual(failed?.deliveryActions?.map((action) => action.label), ['Delete unsent message']);
+ assert.equal(transient.get('later')?.deliveryStatus, 'Waiting to send',
+ 'failed and accepted predecessors do not hold back a later saved row');
+ assert.deepEqual([...transient.keys()], ['steering', 'root', 'later']);
assert.equal(transient.get('root')?.transientPlacement, 'current_turn');
await act(async () => changed('session-1'));
- assert.deepEqual([...transient.keys()], ['root'], 'a retained local copy cannot resurrect a withdrawn queue entry');
+ assert.deepEqual([...transient.keys()], ['steering', 'root', 'later'],
+ 'a retained local copy cannot resurrect a withdrawn queue entry');
});
test('queue_update events drive the independent desktop queue projection', () => {
diff --git a/apps/desktop/src/renderer/features/conversation/controller/session-local-messages.tsx b/apps/desktop/src/renderer/features/conversation/controller/session-local-messages.tsx
index 0e08e4679b..c968cd7388 100644
--- a/apps/desktop/src/renderer/features/conversation/controller/session-local-messages.tsx
+++ b/apps/desktop/src/renderer/features/conversation/controller/session-local-messages.tsx
@@ -19,6 +19,7 @@
import { useEffect } from 'react';
import { useUiLocale, type TransientUserMessageProjection } from '@maka/ui';
+import { ICON_SIZE, Search, Trash2, X } from '@maka/ui/icons';
import { getSessionLocalCopy } from '../../../locales/session-local-copy.js';
import { useConversationServices } from '../services.js';
@@ -42,6 +43,7 @@ export function SessionLocalMessages(props: {
.listMessages(sessionId)
.then((messages) => {
if (disposed || revision !== admitted) return;
+ let waitingForPrevious = false;
for (const message of messages) {
if (message.state === 'accepted' && !message.turnId) {
// The Host queue owns accepted steering and follow-ups. A local
@@ -49,9 +51,12 @@ export function SessionLocalMessages(props: {
retire(sessionId, message.messageId);
continue;
}
- const action = (operation: () => Promise<void>) => () => {
- void operation().catch(() => reportError(copy.updateError));
- };
+ const deliveryStatus = message.state === 'saved' && waitingForPrevious
+ ? copy.waitingForPrevious
+ : copy[message.state];
+ if (message.state !== 'accepted' && message.state !== 'failed') waitingForPrevious = true;
+ const action = (operation: () => Promise<void>) => () =>
+ operation().catch(() => reportError(copy.updateError));
publish(sessionId, {
id: message.messageId,
text: message.text,
@@ -62,12 +67,15 @@ export function SessionLocalMessages(props: {
quotes: message.quotes,
inlineReferences: message.inlineReferences,
hostTurnId: message.turnId,
- deliveryStatus: copy[message.state],
+ deliveryStatus,
deliveryDetail: message.error,
deliveryActions: message.canCancel
? [
{
- label: copy.remove,
+ label: message.state === 'failed' ? copy.remove : copy.cancel,
+ icon: message.state === 'failed'
+ ? <Trash2 size={ICON_SIZE.control} aria-hidden="true" />
+ : <X size={ICON_SIZE.control} aria-hidden="true" />,
onClick: action(async () => {
await services.cancelMessage(sessionId, message.messageId);
retire(sessionId, message.messageId);
@@ -78,6 +86,7 @@ export function SessionLocalMessages(props: {
? [
{
label: copy.check,
+ icon: <Search size={ICON_SIZE.control} aria-hidden="true" />,
onClick: action(() =>
services.reconcileMessage(sessionId, message.messageId),
),
diff --git a/apps/desktop/src/renderer/locales/session-local-copy.ts b/apps/desktop/src/renderer/locales/session-local-copy.ts
index c96e9ff98b..83b9293cca 100644
--- a/apps/desktop/src/renderer/locales/session-local-copy.ts
+++ b/apps/desktop/src/renderer/locales/session-local-copy.ts
@@ -26,39 +26,47 @@ interface SessionLocalCopy {
unknown: string;
failed: string;
remove: string;
+ cancel: string;
check: string;
+ waitingForPrevious: string;
updateError: string;
}
const catalog = {
en: {
- saved: 'Saved locally · waiting to send',
- sending: 'Delivering to Host',
- accepted: 'Host accepted',
- unknown: 'Host outcome unknown',
- failed: 'Not sent · local copy retained',
- remove: 'Remove local copy',
- check: 'Check status',
+ saved: 'Waiting to send',
+ sending: 'Sending…',
+ accepted: 'Delivered',
+ unknown: 'Delivery unconfirmed. Do not send again.',
+ failed: 'Could not send · message kept',
+ remove: 'Delete unsent message',
+ cancel: 'Cancel sending',
+ check: 'Check delivery',
+ waitingForPrevious: 'Waiting for earlier messages to be delivered',
updateError: 'Unable to update the saved message',
},
'zh-CN': {
- saved: '已本地保存 · 等待发送',
- sending: '正在投递到 Host',
- accepted: 'Host 已接受',
- unknown: 'Host 接受结果未知',
- failed: '未发送 · 本地副本已保留',
- remove: '移除本地副本',
- check: '核对状态',
+ saved: '等待发送',
+ sending: '正在发送…',
+ accepted: '已送达',
+ unknown: '暂时无法确认是否送达,请勿重复发送',
+ failed: '未能发送 · 消息已保留',
+ remove: '删除未发送的消息',
+ cancel: '取消发送',
+ check: '检查是否送达',
+ waitingForPrevious: '等待前面的消息送达',
updateError: '无法更新已保存的消息',
},
'zh-TW': {
- saved: '已儲存於本機 · 等待傳送',
- sending: '正在投遞至 Host',
- accepted: 'Host 已接受',
- unknown: 'Host 接受結果未知',
- failed: '未傳送 · 本機副本已保留',
- remove: '移除本機副本',
- check: '核對狀態',
+ saved: '等待傳送',
+ sending: '正在傳送…',
+ accepted: '已送達',
+ unknown: '暫時無法確認是否送達,請勿重複傳送',
+ failed: '無法傳送 · 訊息已保留',
+ remove: '刪除未傳送的訊息',
+ cancel: '取消傳送',
+ check: '檢查是否送達',
+ waitingForPrevious: '等待前面的訊息送達',
updateError: '無法更新已儲存的訊息',
},
} satisfies UiCatalog<SessionLocalCopy>;
diff --git a/apps/desktop/src/renderer/styles/composer.css b/apps/desktop/src/renderer/styles/composer.css
index 13df3e7d05..944e3bf379 100644
--- a/apps/desktop/src/renderer/styles/composer.css
+++ b/apps/desktop/src/renderer/styles/composer.css
@@ -679,11 +679,14 @@
gap: var(--space-2);
padding: var(--space-1) var(--space-2);
color: var(--muted-foreground);
- font-size: 11px;
+ font: var(--maka-text-body);
white-space: nowrap;
}
.maka-composer-queue-delivery {
- font-size: 11px;
+ display: block;
+ white-space: normal;
+ overflow-wrap: anywhere;
+ font: var(--maka-text-body);
color: var(--muted-foreground);
}
diff --git a/apps/desktop/stories/composer-message-queue.stories.tsx b/apps/desktop/stories/composer-message-queue.stories.tsx
index 363f69fc08..a49196d731 100644
--- a/apps/desktop/stories/composer-message-queue.stories.tsx
+++ b/apps/desktop/stories/composer-message-queue.stories.tsx
@@ -17,20 +17,103 @@
* under the License.
*/
-import { useState } from 'react';
+import { useCallback, useMemo, useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
import type { ComponentProps } from 'react';
import type { MessageQueueEntryProjection } from '@maka/core/events';
import type { SessionSummary } from '@maka/core/session';
import { Composer } from '@maka/ui';
-import type { ChatModelChoice } from '@maka/ui';
+import type { ChatModelChoice, TransientUserMessageProjection } from '@maka/ui';
+import {
+ ConversationServicesProvider,
+ SessionLocalMessages,
+ type ConversationServices,
+} from '../src/renderer/features/conversation';
+import type { DesktopLocalMessage } from '../src/shared/session-local-contract.js';
const NOW = Date.UTC(2026, 6, 1, 9, 30, 0);
+const SESSION_ID = 's';
+
+type DeliveryState = 'queued' | 'unconfirmed' | 'failed';
+
+function localDeliveryMessages(state: DeliveryState): DesktopLocalMessage[] {
+ const base = {
+ sessionId: SESSION_ID,
+ attachments: [],
+ inlineReferences: [],
+ placement: 'next_turn' as const,
+ };
+ if (state === 'unconfirmed') {
+ return [
+ {
+ ...base,
+ messageId: 'local-unconfirmed',
+ createdAt: NOW - 60_000,
+ state: 'unknown',
+ canCancel: false,
+ text: 'Check whether the queue drained before retrying the compaction audit.',
+ error: 'Connection dropped before the receipt arrived',
+ },
+ {
+ ...base,
+ messageId: 'local-waiting',
+ createdAt: NOW - 30_000,
+ state: 'saved',
+ canCancel: true,
+ text: 'Summarize the retry budget for the pending follow-ups.',
+ },
+ ];
+ }
+ if (state === 'failed') {
+ return [
+ {
+ ...base,
+ messageId: 'local-failed',
+ createdAt: NOW - 60_000,
+ state: 'failed',
+ canCancel: true,
+ text: 'Attach the runtime.sqlite compaction log to the report.',
+ error: 'Message preparation failed. The local copy is retained.',
+ },
+ ];
+ }
+ return [];
+}
+
+function localDeliveryServices(state: DeliveryState): ConversationServices {
+ let messages = localDeliveryMessages(state);
+ return {
+ listMessages: async () => messages,
+ cancelMessage: async (_sessionId, messageId) => {
+ messages = messages.filter((message) => message.messageId !== messageId);
+ },
+ reconcileMessage: async () => undefined,
+ subscribeChanges: () => () => undefined,
+ sessions: {
+ list: async () => [],
+ subscribeChanges: () => () => undefined,
+ readSnapshot: async () => {
+ throw new Error('Session snapshots are not used in this story');
+ },
+ },
+ skills: { listInvocable: async () => [] },
+ workspace: {
+ searchFiles: async () => ({ ok: false as const, reason: 'no_project' as const }),
+ },
+ newTasks: {
+ subscribeChanges: () => () => undefined,
+ listInvocableSkills: async () => [],
+ searchFiles: async () => ({ ok: false as const, reason: 'no_project' as const }),
+ },
+ mcp: { subscribeChanges: () => () => undefined },
+ };
+}
const meta = {
title: 'Product/Composer Message Queue',
+ component: QueuedComposer,
parameters: { layout: 'fullscreen' },
-} satisfies Meta;
+} satisfies Meta<typeof QueuedComposer>;
export default meta;
@@ -91,7 +174,7 @@ function followUpEntry(entryId: string, text: string): MessageQueueEntryProjecti
* (projection in, mutations
* out) is the real one; only the authority is simulated.
*/
-function QueuedComposer() {
+function QueuedComposer({ deliveryState }: { deliveryState: DeliveryState }) {
const [followup, setFollowup] = useState<MessageQueueEntryProjection[]>([
{
entryId: 'entry-steer',
@@ -120,43 +203,72 @@ function QueuedComposer() {
streaming: true,
};
+ const [published, setPublished] = useState(new Map<string, TransientUserMessageProjection>());
+ const publish = useCallback((_sessionId: string, message: TransientUserMessageProjection) => {
+ setPublished((current) => new Map(current).set(message.id, message));
+ }, []);
+ const retire = useCallback((_sessionId: string, messageId: string) => {
+ setPublished((current) => {
+ const next = new Map(current);
+ next.delete(messageId);
+ return next;
+ });
+ }, []);
+ const services = useMemo(() => localDeliveryServices(deliveryState), [deliveryState]);
+
return (
- <Composer
- {...base}
- queuedMessages={followup}
- queuedMessageRevision={1}
- onPromoteQueuedEntry={(entryId) => {
- setFollowup((current) => current.filter((candidate) => candidate.entryId !== entryId));
- }}
- onUpdateQueuedEntry={(entryId, _expectedQueueRevision, text) => {
- setFollowup((current) =>
- current.map((candidate) =>
- candidate.entryId === entryId
- ? { ...candidate, content: { ...candidate.content, text, displayText: text } }
- : candidate,
- ),
- );
- }}
- onDeleteQueuedEntry={(entryId) => {
- setFollowup((current) => current.filter((candidate) => candidate.entryId !== entryId));
- }}
- onReorderQueuedEntries={(entryIds) => {
- setFollowup((current) =>
- entryIds.flatMap((entryId) =>
- current.filter((candidate) => candidate.entryId === entryId),
- ),
- );
- }}
- />
+ <ConversationServicesProvider services={services}>
+ <SessionLocalMessages
+ sessionId={SESSION_ID}
+ publish={publish}
+ retire={retire}
+ reportError={noop}
+ />
+ <Composer
+ {...base}
+ queuedMessages={deliveryState === 'queued' ? followup : []}
+ pendingMessages={[...published.values()]}
+ queuedMessageRevision={1}
+ onPromoteQueuedEntry={(entryId) => {
+ setFollowup((current) => current.filter((candidate) => candidate.entryId !== entryId));
+ }}
+ onUpdateQueuedEntry={(entryId, _expectedQueueRevision, text) => {
+ setFollowup((current) =>
+ current.map((candidate) =>
+ candidate.entryId === entryId
+ ? { ...candidate, content: { ...candidate.content, text, displayText: text } }
+ : candidate,
+ ),
+ );
+ }}
+ onDeleteQueuedEntry={(entryId) => {
+ setFollowup((current) => current.filter((candidate) => candidate.entryId !== entryId));
+ }}
+ onReorderQueuedEntries={(entryIds) => {
+ setFollowup((current) =>
+ entryIds.flatMap((entryId) =>
+ current.filter((candidate) => candidate.entryId === entryId),
+ ),
+ );
+ }}
+ />
+ </ConversationServicesProvider>
);
}
// Real path: mid-turn sends stay visible above the composer until consumed.
// Drag follow-ups to reorder; 调整方向 promotes one, 编辑 updates it in place.
export const PendingPlate: Story = {
- render: () => (
+ args: { deliveryState: 'queued' },
+ argTypes: {
+ deliveryState: {
+ options: ['queued', 'unconfirmed', 'failed'],
+ control: { type: 'radio' },
+ },
+ },
+ render: (args) => (
<div style={{ padding: '24px 24px 48px', maxWidth: 840 }}>
- <QueuedComposer />
+ <QueuedComposer key={args.deliveryState} deliveryState={args.deliveryState} />
</div>
),
};
diff --git a/docs/astryx-surface-file-inventory.md b/docs/astryx-surface-file-inventory.md
index fa000af5d8..720c4b5f28 100644
--- a/docs/astryx-surface-file-inventory.md
+++ b/docs/astryx-surface-file-inventory.md
@@ -266,7 +266,7 @@ Wiki bar: Design Conventions · API Use-the-System · Theming · Container Paddi
| `packages/ui/src/client-plugin-runtime.tsx` | ui-composition | none | aligned — no raw controls; no Astryx JSX usage | aligned |
| `packages/ui/src/client-plugin-slots.tsx` | ui-composition | none | aligned — no raw controls; no Astryx JSX usage | aligned |
| `packages/ui/src/components.tsx` | ui-composition | none | aligned — no raw controls; no Astryx JSX usage | aligned |
-| `packages/ui/src/composer-message-queue.tsx` | shell-chrome-or-panel | Button, IconButton, List, ListItem, Tooltip | raw `<textarea` (API Use-the-System) | polish |
+| `packages/ui/src/composer-message-queue.tsx` | shell-chrome-or-panel | IconButton, List, ListItem, Tooltip | raw `<textarea` (API Use-the-System) | polish |
| `packages/ui/src/composer.tsx` | shell-chrome-or-panel | Button, ChatComposer, ChatComposerDrawer, ChatComposerInput, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuDivider, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, IconButton, Lightbox, Token, Tooltip | aligned — uses Astryx (Button, ChatComposer, ChatComposerDrawer, ChatComposerInput, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuDivider, DropdownMenuItem) | aligned |
| `packages/ui/src/daily-review-panel.tsx` | module-hub | Banner, Button, Divider, EmptyState, HStack, Heading, List, ListItem, SegmentedControl, SegmentedControlItem, Skeleton, StackItem, Text, Toolbar, VStack | aligned — uses Astryx (Banner, Button, Divider, EmptyState, HStack, Heading, List, ListItem) | aligned |
| `packages/ui/src/directory-reference-chip.tsx` | ui-composition | Token, Tooltip | aligned — uses Astryx (Token, Tooltip) | aligned |
diff --git a/packages/ui/src/__tests__/composer-send-toggle.test.tsx b/packages/ui/src/__tests__/composer-send-toggle.test.tsx
index c9f61dea52..6982f4380d 100644
--- a/packages/ui/src/__tests__/composer-send-toggle.test.tsx
+++ b/packages/ui/src/__tests__/composer-send-toggle.test.tsx
@@ -34,6 +34,7 @@ import { renderToStaticMarkup } from 'react-dom/server';
import { parseHTML } from 'linkedom';
import { Composer } from '../composer.js';
import { LocaleProvider } from '../locale-context.js';
+import { ICON_SIZE, Search } from '../icons.js';
function renderComposer(streaming: boolean): string {
return renderToStaticMarkup(
@@ -294,12 +295,13 @@ test('keeps Host order visible until the reordered projection arrives', async ()
/>
</LocaleProvider>,
));
- const buttons = [...container.querySelectorAll<HTMLButtonElement>('button')];
- const editButtons = buttons.filter((button) => button.textContent === 'Edit');
+ const editButtons = [
+ ...container.querySelectorAll<HTMLButtonElement>('[aria-label="Edit"]'),
+ ];
const deleteButtons = [
...container.querySelectorAll<HTMLButtonElement>('[aria-label="Delete"]'),
];
- assert.equal(buttons.filter((button) => button.textContent === 'Steer').length, 2);
+ assert.equal(container.querySelectorAll('[aria-label="Steer"]').length, 2);
assert.equal(editButtons.length, 3);
assert.equal(deleteButtons.length, 3);
await act(async () => {
@@ -373,17 +375,27 @@ test('deduplicates pending steering against Host queue entries and keeps the pla
const document = parseHTML(`<html><body>${markup}</body></html>`).document;
assert.equal(document.querySelectorAll('.maka-composer-queue-text').length, 1);
assert.equal(document.querySelector('.maka-composer-queue-text')?.textContent, pending.text);
- assert.equal(document.querySelector('.maka-composer-queue-status')?.textContent, 'Steering · Applied together');
+ assert.equal(document.querySelector('.maka-composer-queue-status')?.textContent, 'Steering');
}
});
test('a locally saved follow-up keeps its delivery status and recovery actions in the pending list', () => {
const markup = renderToStaticMarkup(<LocaleProvider locale="en"><Composer onSend={() => undefined} onStop={() => undefined}
- pendingMessages={[{ id: 'local', text: 'offline follow-up', ts: 1, transientPlacement: 'next_turn',
- deliveryStatus: 'Delivery uncertain', deliveryDetail: 'Connection interrupted',
- deliveryActions: [{ label: 'Check delivery', onClick() {} }] }]} /></LocaleProvider>);
+ pendingMessages={[
+ { id: 'local', text: 'offline follow-up', ts: 1, transientPlacement: 'next_turn',
+ deliveryStatus: 'Delivery uncertain', deliveryDetail: 'Connection interrupted',
+ deliveryActions: [{ label: 'Check delivery', icon: <Search size={ICON_SIZE.control} aria-hidden="true" />, onClick() {} }] },
+ { id: 'sending', text: 'still sending', ts: 2, transientPlacement: 'next_turn',
+ deliveryStatus: 'Sending…' },
+ ]} /></LocaleProvider>);
const document = parseHTML(`<html><body>${markup}</body></html>`).document;
assert.equal(document.querySelector('.maka-composer-queue-delivery')?.textContent, 'Delivery uncertain');
- assert.ok([...document.querySelectorAll('.maka-composer-queue-actions button')].some((button) => button.textContent === 'Check delivery'));
+ assert.ok(document.querySelector('.maka-composer-queue-actions button[aria-label="Check delivery"]'),
+ 'the delivery action stays an accessible labelled icon control');
+ const rows = [...document.querySelectorAll('li')];
+ const sendingRow = rows.find((row) => row.textContent?.includes('still sending'));
+ assert.ok(sendingRow);
+ assert.equal(sendingRow.querySelectorAll('.maka-composer-queue-actions button').length, 0,
+ 'a local row without delivery actions offers no Host edit/steer/delete operations');
});
diff --git a/packages/ui/src/chat-turn.tsx b/packages/ui/src/chat-turn.tsx
index 1315d464e7..98db71ff7d 100644
--- a/packages/ui/src/chat-turn.tsx
+++ b/packages/ui/src/chat-turn.tsx
@@ -199,7 +199,7 @@ const UserMessageBody = memo(function UserMessageBody(props: {
{timeOrDelivery}
</span> : timeOrDelivery}
{props.delivery?.deliveryActions?.map((action) => (
- <UiButton key={action.label} label={action.label} variant="ghost" size="sm" onClick={action.onClick} />
+ <UiIconButton key={action.label} label={action.label} tooltip={action.label} variant="ghost" size="sm" icon={action.icon} clickAction={action.onClick} />
))}
<MessageCopyButton
messageId={props.messageId}
diff --git a/packages/ui/src/chat-view.tsx b/packages/ui/src/chat-view.tsx
index 50f9e03485..400a59ceea 100644
--- a/packages/ui/src/chat-view.tsx
+++ b/packages/ui/src/chat-view.tsx
@@ -150,7 +150,7 @@ export interface TransientUserMessageProjection {
pendingSteering?: boolean;
deliveryStatus?: string;
deliveryDetail?: string;
- deliveryActions?: readonly { label: string; onClick(): void }[];
+ deliveryActions?: readonly { label: string; icon: ReactNode; onClick(): void | Promise<void> }[];
id: string;
text: string;
ts: number;
diff --git a/packages/ui/src/composer-message-queue.tsx b/packages/ui/src/composer-message-queue.tsx
index 08f0db5df8..1d810c8d68 100644
--- a/packages/ui/src/composer-message-queue.tsx
+++ b/packages/ui/src/composer-message-queue.tsx
@@ -20,10 +20,10 @@
import { memo, useRef, useState } from 'react';
import type { TransientUserMessageProjection } from './chat-view.js';
import type { MessageQueueEntryProjection } from '@maka/core/events';
-import { Button, IconButton, Tooltip } from '@astryxdesign/core';
+import { IconButton, Tooltip } from '@astryxdesign/core';
import { List, ListItem } from '@astryxdesign/core/List';
import type { ConversationCopy } from './conversation-copy.js';
-import { Check, GripVertical, HelpCircle, ICON_SIZE, Trash2, X } from './icons.js';
+import { Check, CornerDownLeft, GripVertical, HelpCircle, ICON_SIZE, Pencil, Trash2, X } from './icons.js';
import { useMountedRef } from './use-mounted-ref.js';
type ComposerQueueEntry = Omit<MessageQueueEntryProjection, 'state'> & {
@@ -204,7 +204,7 @@ export const ComposerMessageQueue = memo(function ComposerMessageQueue(
</>
)}
style={{ minHeight: 28, paddingBlock: 0 }}
- startContent={(
+ startContent={entry.localMessage ? undefined : (
<span
className="maka-composer-queue-grip"
draggable={reorderable}
@@ -224,8 +224,9 @@ export const ComposerMessageQueue = memo(function ComposerMessageQueue(
)}
endContent={(
<span className="maka-composer-queue-actions">
- {entry.localMessage?.deliveryActions?.length ? entry.localMessage.deliveryActions.map((action) => (
- <Button key={action.label} variant="ghost" size="sm" type="button" label={action.label} onClick={action.onClick} />
+ {entry.localMessage ? entry.localMessage.deliveryActions?.map((action) => (
+ <IconButton key={action.label} variant="ghost" size="sm" type="button"
+ label={action.label} tooltip={action.label} icon={action.icon} clickAction={action.onClick} />
)) : editing ? (
<>
<IconButton
@@ -251,7 +252,7 @@ export const ComposerMessageQueue = memo(function ComposerMessageQueue(
</>
) : (
<>
- <Button
+ <IconButton
variant="ghost"
size="sm"
type="button"
@@ -262,21 +263,25 @@ export const ComposerMessageQueue = memo(function ComposerMessageQueue(
|| !props.onUpdateEntry
}
label={copy.editQueuedEntry}
+ tooltip={copy.editQueuedEntry}
onClick={() => beginEdit(entry)}
+ icon={<Pencil size={ICON_SIZE.control} aria-hidden="true" />}
/>
{entry.placement === 'next_turn' ? (
- <Button
+ <IconButton
variant="ghost"
size="sm"
type="button"
- isDisabled={pendingEntryId !== null || entry.state !== 'queued'}
+ isDisabled={pendingEntryId !== null || entry.state !== 'queued' || !props.onPromoteEntry}
label={copy.promoteQueuedEntry}
+ tooltip={copy.promoteQueuedEntry}
onClick={() => void runEntryAction(
entry.entryId,
props.onPromoteEntry
? () => props.onPromoteEntry?.(entry.entryId)
: undefined,
)}
+ icon={<CornerDownLeft size={ICON_SIZE.control} aria-hidden="true" />}
/>
) : null}
<IconButton
diff --git a/packages/ui/src/conversation-copy.ts b/packages/ui/src/conversation-copy.ts
index 050a3eddd5..45b36731e5 100644
--- a/packages/ui/src/conversation-copy.ts
+++ b/packages/ui/src/conversation-copy.ts
@@ -513,10 +513,10 @@ const CONVERSATION_COPY = {
placeholder: '描述任务,@ 引用文件或会话,/ 选择技能…', textareaAriaLabel: '消息输入框', pastedQuoteLabel: '粘贴的文本', selectedSkillsAriaLabel: '已选择的 Skill', removeSkillAriaLabel: (name) => `移除 Skill:${name}`, awaitingPermission: '等待你确认权限…',
sending: '正在发送…', importing: '正在导入…', sendLabel: '发送',
queuedMessagesAriaLabel: (count) => `${count} 条待发送消息`,
- steeringPending: '调整方向 · 等待整批生效',
- followupPending: '下一轮 · 每轮一条',
+ steeringPending: '调整方向',
+ followupPending: '下一轮',
queueShortcutsLabel: '发送快捷键',
- queueShortcuts: 'Shift+Enter:转向(Steering)\nEnter:下一轮(Follow-up)',
+ queueShortcuts: 'Shift+Enter:调整当前轮方向,待处理消息一起生效。\nEnter:排到下一轮,每轮处理一条。',
promoteQueuedEntry: '调整方向', editQueuedEntry: '编辑', saveQueuedEntry: '保存', cancelQueuedEntryEdit: '取消编辑', deleteQueuedEntry: '删除', reorderQueuedEntry: '拖动排序',
stopLabel: '停止', stopping: '停止中…',
streaming: 'Maka 正在回答…', processing: 'Maka 正在处理…', continuing: 'Maka 继续中…',
@@ -674,10 +674,10 @@ const CONVERSATION_COPY = {
placeholder: '描述任務,@ 引用檔案,/ 選擇技能…', textareaAriaLabel: '訊息輸入框', pastedQuoteLabel: '貼上的文本', selectedSkillsAriaLabel: '已選擇的 Skill', removeSkillAriaLabel: (name) => `移除 Skill:${name}`, awaitingPermission: '等待你確認權限…',
sending: '正在傳送…', importing: '正在匯入…', sendLabel: '傳送',
queuedMessagesAriaLabel: (count) => `${count} 條待發送訊息`,
- steeringPending: '調整方向 · 等待整批生效',
- followupPending: '下一輪 · 每輪一條',
+ steeringPending: '調整方向',
+ followupPending: '下一輪',
queueShortcutsLabel: '傳送快速鍵',
- queueShortcuts: 'Shift+Enter:轉向(Steering)\nEnter:下一輪(Follow-up)',
+ queueShortcuts: 'Shift+Enter:調整目前這輪方向,待處理訊息一起生效。\nEnter:排到下一輪,每輪處理一則。',
promoteQueuedEntry: '調整方向', editQueuedEntry: '編輯', saveQueuedEntry: '儲存', cancelQueuedEntryEdit: '取消編輯', deleteQueuedEntry: '刪除', reorderQueuedEntry: '拖動排序',
stopLabel: '停止', stopping: '停止中…',
streaming: 'Maka 正在回答…', processing: 'Maka 正在處理…', continuing: 'Maka 繼續中…',
@@ -864,10 +864,10 @@ const CONVERSATION_COPY = {
placeholder: 'Describe a task, @ to reference files or sessions, / for skills…', textareaAriaLabel: 'Message input', pastedQuoteLabel: 'Pasted text', selectedSkillsAriaLabel: 'Selected Skills', removeSkillAriaLabel: (name) => `Remove Skill: ${name}`, awaitingPermission: 'Waiting for your permission decision…',
sending: 'Sending…', importing: 'Importing…', sendLabel: 'Send',
queuedMessagesAriaLabel: (count) => `${count} queued message${count === 1 ? '' : 's'}`,
- steeringPending: 'Steering · Applied together',
- followupPending: 'Follow-up · One per turn',
+ steeringPending: 'Steering',
+ followupPending: 'Next turn',
queueShortcutsLabel: 'Send shortcuts',
- queueShortcuts: 'Shift+Enter: Steering\nEnter: Follow-up',
+ queueShortcuts: 'Shift+Enter: Steer the current turn; pending messages are applied together.\nEnter: Queue for the next turn; one message per turn.',
promoteQueuedEntry: 'Steer', editQueuedEntry: 'Edit', saveQueuedEntry: 'Save', cancelQueuedEntryEdit: 'Cancel editing', deleteQueuedEntry: 'Delete', reorderQueuedEntry: 'Drag to reorder',
stopLabel: 'Stop', stopping: 'Stopping…',
streaming: 'Maka is responding…', processing: 'Maka is working…', continuing: 'Maka is continuing…',
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org