Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

feat(console): lay out the viewer's messages like everyone else's

raullopez-sandboxbe85ab590215
diff --git a/console/apps/switch-console-desktop/src/renderer/features/chats/components/chat-timeline.tsx b/console/apps/switch-console-desktop/src/renderer/features/chats/components/chat-timeline.tsx
index 223f292c7..22a15381e 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/chats/components/chat-timeline.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/chats/components/chat-timeline.tsx
@@ -18,7 +18,6 @@ import { messageAnchorId, threadChip } from '../chat-threads';
import { hiddenStopRows } from '../stop-rows';
import type { AgentActivity } from '../stores/chat-activity-store';
import type { ChatTimeline, PendingSend } from '../stores/chat-timeline-store';
-import { chatsStore } from '../stores/chats';
import { ChatMarkdown } from '../ui/chat-markdown';
import { FailedIcon, WorkLogRow } from '../ui/work-log';
import {
@@ -54,12 +53,7 @@ function isBridged(message: ChatMessage): boolean {
return message.source !== 'console' && message.source !== 'switch';
}
-function sourceLabel(message: ChatMessage): string {
- if (!isBridged(message)) return message.sender.name;
- return `${message.sender.name} · from ${bridgePlatformLabel(message.source)}`;
-}
-
-/** Another person's initials disc: people have no picture in Switch. */
+/** A person's initials disc: people have no picture in Switch. */
function PersonAvatar({ name }: { name: string }) {
return (
<span
@@ -152,7 +146,6 @@ export const ChatTimelineView = observer(function ChatTimelineView({
);
const agentOf = (agentId: string | null) => agents.find((agent) => agent.id === agentId) ?? null;
const find = (messageId: string) => timeline.byId(messageId);
- const myUserId = chatsStore.userId;
const turnAgents = new Map(
[...turnsByMessage].map(([messageId, list]) => [
messageId,
@@ -216,7 +209,6 @@ export const ChatTimelineView = observer(function ChatTimelineView({
const chip = threadChip(message, find);
const turns = turnsByMessage.get(message.messageId) ?? [];
const agent = agentOf(message.sender.agentId);
- const mine = message.sender.userId !== null && message.sender.userId === myUserId;
const agentLabel = {
name: agent ? chatAgentLabel(agent) : message.sender.name,
iconUrl: agent?.iconUrl ?? null,
@@ -268,28 +260,6 @@ export const ChatTimelineView = observer(function ChatTimelineView({
tone={ended.outcome === 'completed' ? 'passive' : 'failed'}
/>
</AgentRow>
- ) : message.sender.kind === 'human' && mine ? (
- <div
- id={messageAnchorId(message.messageId)}
- className={cn('group/row flex flex-col items-end gap-1', spacing())}
- >
- {chip && <ThreadChipButton chip={chip} />}
- <div className="flex max-w-[85%] items-start gap-1">
- <ReplyButton onReply={() => onReply(message)} />
- <div className="min-w-0 rounded-2xl bg-background-1 px-4 py-2.5 text-sm leading-relaxed break-words whitespace-pre-wrap">
- {message.body}
- </div>
- </div>
- <ChatAttachments
- serverId={serverId}
- roomId={timeline.roomId}
- attachments={message.attachments}
- />
- <span className="text-xs text-foreground-passive">
- {sourceLabel(message)}
- {turns.some(({ turn }) => turn.status === 'queued') && ' · queued'}
- </span>
- </div>
) : message.sender.kind === 'human' ? (
<div
id={messageAnchorId(message.messageId)}
@@ -422,7 +392,7 @@ const PendingBubble = observer(function PendingBubble({
: null;
return (
<div
- className={cn('flex flex-col items-end gap-1', className)}
+ className={cn('flex flex-col items-start gap-1 pl-10', className)}
aria-busy={send.state === 'sending'}
>
{chip && <ThreadChipButton chip={chip} />}
@@ -430,7 +400,7 @@ const PendingBubble = observer(function PendingBubble({
{send.body}
</div>
{send.files.length > 0 && (
- <ul className="flex flex-col items-end gap-0.5 text-xs">
+ <ul className="flex flex-col items-start gap-0.5 text-xs">
{send.files.map((file) => (
<li
key={file.id}
@@ -450,8 +420,8 @@ const PendingBubble = observer(function PendingBubble({
<Loader2 className="size-3 animate-spin" /> Sending…
</span>
) : (
- <div role="alert" className="flex max-w-[85%] flex-col items-end gap-1 text-xs">
- <span className="text-right text-foreground-destructive">
+ <div role="alert" className="flex max-w-[85%] flex-col items-start gap-1 text-xs">
+ <span className="text-foreground-destructive">
{send.state === 'conflict'
? 'This request id was already used for a different message, so it was not sent. Discard it and send again.'
: send.uncertain
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/chat-timeline-view.test.ts b/console/apps/switch-console-desktop/src/renderer/tests/chat-timeline-view.test.ts
new file mode 100644
index 000000000..4dd0dc0e9
--- /dev/null
+++ b/console/apps/switch-console-desktop/src/renderer/tests/chat-timeline-view.test.ts
@@ -0,0 +1,55 @@
+import { createElement } from 'react';
+import { renderToStaticMarkup } from 'react-dom/server';
+import { describe, expect, it, vi } from 'vitest';
+import { ChatTimelineView } from '@renderer/features/chats/components/chat-timeline';
+import {
+ ChatTimeline,
+ type TimelineApi,
+} from '@renderer/features/chats/stores/chat-timeline-store';
+import type { ChatMessage } from '@shared/core/chats/chats';
+
+vi.mock('@renderer/lib/ipc', () => ({ events: { on: vi.fn() }, rpc: {} }));
+// The viewer is Alice.
+vi.mock('@renderer/features/chats/stores/chats', () => ({ chatsStore: { userId: 'me' } }));
+
+function message(seq: number, userId: string, name: string): ChatMessage {
+ return {
+ messageId: `m${seq}`,
+ seq,
+ roomId: 'room-1',
+ sentAt: '2026-01-01T00:00:00Z',
+ sender: { clientId: 'c', name, kind: 'human', agentId: null, userId },
+ source: 'console',
+ body: `body ${seq}`,
+ format: null,
+ threadRootId: null,
+ attachments: [],
+ clientTxn: null,
+ namedAgentIds: [],
+ threadReplyCount: 0,
+ threadLastReplySeq: null,
+ };
+}
+
+const api = {} as TimelineApi;
+
+describe('ChatTimelineView', () => {
+ it('lays out every human message the same way, the viewer’s included', () => {
+ const timeline = new ChatTimeline('room-1', api);
+ timeline.apply(message(1, 'me', 'Alice'));
+ timeline.apply(message(2, 'other', 'Bob'));
+ const html = renderToStaticMarkup(
+ createElement(ChatTimelineView, {
+ serverId: 's',
+ timeline,
+ agents: [],
+ activities: [],
+ onReply: () => {},
+ })
+ );
+ expect(html).not.toContain('items-end');
+ expect(html).toContain('title="Alice"');
+ expect(html).toContain('title="Bob"');
+ expect(html.match(/aria-label="Reply"/g)).toHaveLength(2);
+ });
+});