Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
Chat: only your own messages sit on your side (25b) (#762)
Oleksandr Ivanchenkoc4149c08aae8
diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsxindex a6c71b68..e46cee90 100644--- a/frontend/src/components/ChatView.tsx+++ b/frontend/src/components/ChatView.tsx@@ -228,6 +228,8 @@ function SenderLetter({ name }: { name: string }) {const REPLY_AVATAR_PHONE = 20;const REPLY_BUBBLE = 'px-3.5 py-3 sm:p-5 rounded-2xl text-sm leading-relaxed shadow-sm w-full';const REPLY_BUBBLE_BOT = 'bg-zinc-900/60 text-zinc-200 rounded-tl-sm border border-zinc-800/80';+// 25b: a customer's or a bot's chat-API message, on the left. Outline only: not yours (filled, lighter), not a bot reply (filled); never violet.+const OTHER_BUBBLE = 'bg-transparent text-zinc-200 rounded-tl-sm border border-zinc-700';export interface ChatViewProps {/** H3: a line under the person's held message ("Waiting for Juno: …", Try again), by message id. */@@ -1789,6 +1791,9 @@ export const ChatView: React.FC<ChatViewProps> = ({// 23c: a customer's or a bot's "user" message says who wrote it; the person (Telegram too) and a coding agent as beforeconst otherSender = isUser ? otherSenderLabel(msg.meta, knownBots, msg.sender_id) : null;const displayName = isUser ? otherSender ?? agentSenderLabel(msg.meta) ?? 'You' : botDisplayName(msg.sender_id, knownBots);+ // 25b: only what you wrote sits on your side (you, you from Telegram, your coding agent). A customer or a bot's+ // chat-API message sits on the left in a neutral bubble. Side and look only; content still follows isUser.+ const onYourSide = isUser && !otherSender;// P4: a share that now sits under its bot's reply reads as part of it, without a second header.const underReply = !isUser && filesOnly && (arranged.attached.has(msg.id) || liveShareIds.has(msg.id));const olderCopies = filesOnly ? arranged.earlier.get(msg.id) : undefined;@@ -1808,7 +1813,7 @@ export const ChatView: React.FC<ChatViewProps> = ({data-shared-under={underReply ? '' : undefined}// The log's space-y gap would win over a margin class; inline style pulls the tiles up to the reply's actionsstyle={underReply ? { marginTop: '0.5rem' } : undefined}- className={`group/msg flex items-start gap-3.5 w-full max-w-5xl rounded-xl focus:outline-none ${isUser ? 'ml-auto flex-row-reverse justify-start' : ''} ${+ className={`group/msg flex items-start gap-3.5 w-full max-w-5xl rounded-xl focus:outline-none ${onYourSide ? 'ml-auto flex-row-reverse justify-start' : ''} ${flashId === msg.id ? (flashKind === 'quote' ? 'kw-flash-quote' : 'kw-flash') : ''} ${freshTrack.current.fresh.has(msg.id) ? 'kws-in' : ''}`}>@@ -1835,7 +1840,7 @@ export const ChatView: React.FC<ChatViewProps> = ({</span>)}- <div className={`flex flex-col min-w-0 ${isUser ? 'max-w-[85%] sm:max-w-2xl items-end' : 'flex-1 max-w-4xl items-start'}`}>+ <div className={`flex flex-col min-w-0 ${onYourSide ? 'max-w-[85%] sm:max-w-2xl items-end' : isUser ? 'max-w-[85%] sm:max-w-2xl items-start' : 'flex-1 max-w-4xl items-start'}`}>{underReply ? (<span className="sr-only">Shared by {displayName}</span>) : isUser ? (@@ -1922,18 +1927,26 @@ export const ChatView: React.FC<ChatViewProps> = ({{!filesOnly && (text.trim() || !files.length) && (<div className={isUser ? 'relative w-full max-w-2xl' : 'contents'}>{isUser && (() => {- // The person's message: the overflow sits in the empty gutter left of the bubble, bottom-aligned, no row- const more = continueMenu(msg, messageAbout(otherSender), 'end', 'hover');- return more ? <div className="absolute right-full bottom-0 mr-1" data-message-more-gutter="">{more}</div> : null;+ // A "user" message: the overflow sits in the empty gutter beside the bubble, bottom-aligned, no row.+ // Yours: left of your bubble. A customer's or a bot's (25b, on the left): right of theirs.+ const more = continueMenu(msg, messageAbout(otherSender), onYourSide ? 'end' : 'start', 'hover');+ return more ? (+ <div className={onYourSide ? 'absolute right-full bottom-0 mr-1' : 'absolute left-full bottom-0 ml-1'} data-message-more-gutter="">+ {more}+ </div>+ ) : null;})()}<divclassName={`${REPLY_BUBBLE} ${- isUser+ onYourSide? 'bg-zinc-800 text-zinc-100 rounded-tr-sm border border-zinc-700/60 max-w-2xl'- : workAhead- ? 'bg-indigo-950/15 text-zinc-200 rounded-tl-sm border border-dashed border-indigo-400/25'- : REPLY_BUBBLE_BOT+ : isUser+ ? `${OTHER_BUBBLE} max-w-2xl`+ : workAhead+ ? 'bg-indigo-950/15 text-zinc-200 rounded-tl-sm border border-dashed border-indigo-400/25'+ : REPLY_BUBBLE_BOT}`}+ data-other-bubble={isUser && !onYourSide ? '' : undefined}data-work-ahead={workAhead ? '' : undefined}>{isUser ? (@@ -1956,7 +1969,7 @@ export const ChatView: React.FC<ChatViewProps> = ({</div></div>)}- {files.length > 0 && <FileTiles files={files} align={isUser ? 'end' : 'start'} sharedBy={filesOnly && !isUser ? displayName : undefined} at={msg.created_at ?? null} />}+ {files.length > 0 && <FileTiles files={files} align={onYourSide ? 'end' : 'start'} sharedBy={filesOnly && !isUser ? displayName : undefined} at={msg.created_at ?? null} />}{isUser && heldNotes?.[msg.id]}{filesOnly && !isUser && files.length > 0 && shareInfo(msg.meta).auto && (// P4: kwnt posted the turn's last screenshot because the reply claimed a picture and none was shared@@ -2048,7 +2061,7 @@ export const ChatView: React.FC<ChatViewProps> = ({)}</>)}- {continueError?.id === msg.id && <MessageMoreError text={continueError.text} align={isUser ? 'end' : 'start'} />}+ {continueError?.id === msg.id && <MessageMoreError text={continueError.text} align={onYourSide ? 'end' : 'start'} />}</div></div>);diff --git a/frontend/tests/continueChat.test.mjs b/frontend/tests/continueChat.test.mjsindex 3acfea26..fbdd874b 100644--- a/frontend/tests/continueChat.test.mjs+++ b/frontend/tests/continueChat.test.mjs@@ -204,8 +204,9 @@ test('ChatView puts ⋯ right after Copy, the line before the messages, and keepconst more = src.indexOf("continueMenu(msg, `${displayName}'s reply`, 'start')");assert.ok(copy > 0 && more > copy && more - copy < 200, '⋯ sits next to Copy');// 23c: "your message" for the person, "<name>'s message" for a customer or a bot (messageAbout)- assert.match(src, /continueMenu\(msg, messageAbout\(otherSender\), 'end', 'hover'\)/);- assert.match(src, /absolute right-full bottom-0 mr-1" data-message-more-gutter/, 'the person’s ⋯ sits in the gutter, no row of its own');+ // 25b: yours opens from the left gutter ('end'), a customer's or a bot's (now on the left) from the right one ('start')+ assert.match(src, /continueMenu\(msg, messageAbout\(otherSender\), onYourSide \? 'end' : 'start', 'hover'\)/);+ assert.match(src, /onYourSide \? 'absolute right-full bottom-0 mr-1' : 'absolute left-full bottom-0 ml-1'\} data-message-more-gutter/, 'the ⋯ sits in the gutter, no row of its own');assert.equal(/mt-1 flex justify-end">\{more\}/.test(src), false, 'no ⋯ row under the person’s bubble');assert.ok(src.indexOf('<ContinuedLine') > 0);assert.equal(/handleCopy\([^)]*continued/i.test(src), false);diff --git a/frontend/tests/othersMessagesOwnSide.test.mjs b/frontend/tests/othersMessagesOwnSide.test.mjsnew file mode 100644index 00000000..d819b30c--- /dev/null+++ b/frontend/tests/othersMessagesOwnSide.test.mjs@@ -0,0 +1,111 @@+// 25b (autonomy/others-messages-own-side/brief.md): only what you wrote sits on your side of the chat.+// A Telegram customer's message and a bot's chat-API message sit on the left in a neutral bubble with their letter;+// yours, yours from Telegram and a coding agent's stay on the right in your bubble. Content rules are unchanged.+import assert from 'node:assert/strict';+import test from 'node:test';+import { loadBundled } from './bundle.mjs';++globalThis.localStorage ??= { getItem: () => null, setItem: () => {}, removeItem: () => {} };++const ui = await loadBundled(`+ import React from 'react';+ import { renderToStaticMarkup } from 'react-dom/server.browser';+ import { ChatView } from './src/components/ChatView';+ export const chat = (props) => renderToStaticMarkup(React.createElement(ChatView, props));+`);++const SCOUT = { id: '0e7bf95d-cb8b-4396-a0d7-bcf14a38ab47', name: 'Scout', status: 'idle' };+const j = (o) => JSON.stringify(o);+const customer = j({ source: 'telegram-customer', from_customer: 'Ann', customer_chat_id: 4242 });+const bot = j({ sent_by_bot: true, sent_by_bot_name: 'Scout', sent_by_kwant_id: SCOUT.id });+const viaTelegram = j({ source: 'telegram' });+const agent = j({ from_agent: 'Claude Code' });+const file = { id: '3f2b8c1e-7d4a-4b9e-9c1a-2e5f6a7b8c9d', name: 'receipt-10482.pdf', mime: 'application/pdf', size: 48213 };+const msg = (id, meta, sender_id = 'PlayerHero', role = 'user') => ({+ id, sender_role: role, sender_id, text: `text of ${id}`, meta, created_at: '2026-11-16T09:00:00Z',+});+const props = (messages) => ({+ title: 'Support', messages, streamingText: '', streamingThinking: '', isStreaming: false,+ pendingApprovals: [], onSendMessage: async () => true, onResolveApproval: () => {},+ kwants: [{ id: 'k-support', name: 'Support', status: 'idle' }, SCOUT], teams: [], onContinueFrom: () => {},+ home: { kind: 'bot', bot: { id: 'k-support', name: 'Support' } },+});+// One message's markup: from its row to the next row.+const row = (html, id) => {+ const at = html.indexOf(`data-message-id="${id}"`);+ assert.ok(at > 0, `row ${id}`);+ const start = html.lastIndexOf('<div', at);+ const next = html.indexOf('data-message-id="', at + 10);+ return html.slice(start, next < 0 ? undefined : html.lastIndexOf('<div', next));+};+const rowClass = (r) => r.match(/^<div[^>]*class="([^"]*)"/)[1];+const YOUR_BUBBLE = /bg-zinc-800 text-zinc-100 rounded-tr-sm/;++const html = ui.chat(props([+ msg('c1', customer, 'telegram-customer:4242'),+ msg('b1', bot),+ msg('p1', null),+ msg('t1', viaTelegram),+ msg('g1', agent),+ msg('k1', null, 'Support', 'kwant'),+]));++test("a customer's and a bot's chat-API message sit on the left in the other bubble", () => {+ for (const id of ['c1', 'b1']) {+ const r = row(html, id);+ assert.doesNotMatch(rowClass(r), /flex-row-reverse|ml-auto/, `${id}: not on your side`);+ assert.match(r, /items-start/, `${id}: column starts on the left`);+ assert.doesNotMatch(r, /items-end/, id);+ assert.match(r, /data-other-bubble=""/, `${id}: the other bubble`);+ const bubble = r.match(/<div[^>]*class="([^"]*)"[^>]*data-other-bubble=""/)?.[1] ?? '';+ assert.match(bubble, /\bbg-transparent\b/, `${id}: outline, no fill`);+ assert.match(bubble, /\bborder-zinc-700(?![\/\d])/, `${id}: full zinc-700 edge`);+ assert.match(bubble, /text-zinc-200 rounded-tl-sm/, `${id}: neutral, left corner`);+ assert.doesNotMatch(bubble, /bg-zinc-900\/60/, `${id}: never a bot reply's fill`);+ assert.doesNotMatch(r, YOUR_BUBBLE, `${id}: never your bubble`);+ assert.doesNotMatch(r, /violet/, `${id}: no violet`);+ assert.match(r, /data-sender-letter=/, `${id}: still the letter avatar`);+ }+});++test('yours, yours from Telegram and a coding agent stay on the right in your bubble', () => {+ for (const id of ['p1', 't1', 'g1']) {+ const r = row(html, id);+ assert.match(rowClass(r), /ml-auto flex-row-reverse/, `${id}: your side`);+ assert.match(r, /items-end/, id);+ assert.match(r, YOUR_BUBBLE, id);+ assert.doesNotMatch(r, /data-other-bubble/, id);+ }+});++test("a bot's normal reply is untouched", () => {+ const r = row(html, 'k1');+ assert.doesNotMatch(rowClass(r), /flex-row-reverse/);+ assert.match(r, /flex-1 max-w-4xl items-start/);+ assert.doesNotMatch(r, /data-other-bubble/);+});++test("an other's menu opens from the right gutter and still names them; yours from the left", () => {+ const c1 = row(html, 'c1');+ assert.match(c1, /absolute left-full bottom-0 ml-1" data-message-more-gutter/);+ assert.match(c1, /aria-label="More for Ann \(customer\)'s message"/);+ assert.match(row(html, 'b1'), /aria-label="More for Scout \(bot\)'s message"/);+ const p1 = row(html, 'p1');+ assert.match(p1, /absolute right-full bottom-0 mr-1" data-message-more-gutter/);+ assert.match(p1, /aria-label="More for your message"/);+});++test("an other's attached file sits on their side; yours on yours", () => {+ const f = ui.chat(props([+ msg('c2', j({ ...JSON.parse(customer), attachments: [file] }), 'telegram-customer:4242'),+ msg('p2', j({ attachments: [file] })),+ ]));+ const c2 = row(f, 'c2');+ const p2 = row(f, 'p2');+ assert.match(c2, /receipt-10482\.pdf/);+ assert.match(p2, /receipt-10482\.pdf/);+ // FileTiles: align 'start' for others, 'end' for yours+ const tiles = (r) => r.slice(r.indexOf('receipt-10482.pdf') - 1500, r.indexOf('receipt-10482.pdf'));+ assert.doesNotMatch(tiles(c2), /justify-end|items-end|ml-auto/, 'customer file on the left');+ assert.match(tiles(p2), /justify-end|items-end|ml-auto/, 'your file on the right');+});diff --git a/frontend/tests/replyLandsStill.test.mjs b/frontend/tests/replyLandsStill.test.mjsindex 472b1bde..c80a929c 100644--- a/frontend/tests/replyLandsStill.test.mjs+++ b/frontend/tests/replyLandsStill.test.mjs@@ -77,7 +77,8 @@ test('the live row and the finished row share one geometry', () => {// The finished row uses the same strings.assert.match(chat, /size=\{REPLY_AVATAR\}\s+kwantId=\{replyKwantId\}/);assert.match(chat, /size=\{REPLY_AVATAR_PHONE\} kwantId=\{replyKwantId\}/);- assert.match(chat, /className=\{`\$\{REPLY_BUBBLE\} \$\{\s+isUser/);+ // 25b: the finished row picks its look by side (onYourSide), still from REPLY_BUBBLE+ assert.match(chat, /className=\{`\$\{REPLY_BUBBLE\} \$\{\s+onYourSide/);assert.match(chat, /: REPLY_BUBBLE_BOT\s+\}`\}/);});