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
Sidebar: a bot's name wraps only between words; Needs you is a compact hand (#301)
Oleksandr Ivanchenkofd51f46faf1d
diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsxindex 49058505..27bb14a0 100644--- a/frontend/src/components/Sidebar.tsx+++ b/frontend/src/components/Sidebar.tsx@@ -365,6 +365,11 @@ export const Sidebar: React.FC<SidebarProps> = ({// Desktop: the one-line status under the name makes room for Edit and Remove on hover or focus.// It never wraps, so the room costs a few letters of the status, never the row's height.const actionRoom = !phone && hasRowActions ? ' group-hover/fleet:pr-9 group-focus-within/fleet:pr-9' : '';+ // An open browser step: the status line says so in words while it is open (the name line only has the hand)+ const needs = needsYou[k.id] ?? 0;+ const needsTip = `${k.name} needs you in the browser`;+ const warn = needs > 0 || status === 'needs_you';+ const busyLine = needs > 0 && !busyKwants[k.id]?.startsWith('Needs you in the browser') ? 'Needs you in the browser' : busyKwants[k.id];return (<divkey={`${team?.id ?? 'none'}:${k.id}`}@@ -384,8 +389,10 @@ export const Sidebar: React.FC<SidebarProps> = ({<div className="flex-1 min-w-0">{/* The name line never changes on hover: padding it here made the name wrap and the row jump */}<div data-bot-name-line className="flex items-start gap-1">- {/* The full name, on up to two lines (QA a); what it runs on is in the tooltip */}- <span data-bot-name className="min-w-0 text-body font-semibold leading-5 text-zinc-100 line-clamp-2 [overflow-wrap:anywhere]" title={`${k.name} · ${engineTip(k.preferred_model)}`}>+ {/* The full name, on up to two lines (QA a), wrapping only between words or after a hyphen:+ never inside a word ("Researche / r"). A word too long for the line ends in "…"; the+ whole name and what it runs on are in the tooltip */}+ <span data-bot-name className="min-w-0 text-body font-semibold leading-5 text-zinc-100 line-clamp-2 [overflow-wrap:normal] [word-break:normal] text-ellipsis" title={`${k.name} · ${engineTip(k.preferred_model)}`}>{k.name}</span>{isLead && (@@ -394,13 +401,19 @@ export const Sidebar: React.FC<SidebarProps> = ({lead</span>)}- {needsYou[k.id] > 0 && (+ {/* Compact on the name line (the hand, and a count past one), so it never squeezes the name;+ the words "Needs you in the browser" are on the status line below */}+ {needs > 0 && (<span- className="shrink-0 inline-flex items-center gap-1 px-1.5 py-px rounded-full text-2xs font-medium bg-amber-300/10 text-warn border border-amber-300/30"- title={`${k.name} needs you in the browser`}+ data-bot-needs-you={needs}+ role="img"+ // Mira's compact pill: 20 px high, hand 14 px, count 12 px/600 in tabular figures; flat amber, never holographic+ className="shrink-0 inline-flex items-center gap-1 h-5 px-1.5 rounded-full text-[12px] font-semibold tabular-nums leading-none text-[#fbbf24] bg-[rgba(251,191,36,0.12)] border border-[rgba(251,191,36,0.35)]"+ title={needsTip}+ aria-label={`Needs you (${needs})`}>- <Hand size={10} aria-hidden="true" />- Needs you{needsYou[k.id] > 1 ? ` · ${needsYou[k.id]}` : ''}+ <Hand size={14} aria-hidden="true" />+ <span aria-hidden="true">{needs}</span></span>)}{/* The space header already says when approvals are off for everyone: a bot only gets its own mark when it differs */}@@ -451,13 +464,14 @@ export const Sidebar: React.FC<SidebarProps> = ({</span>)}</div>- {busyKwants[k.id] ? (- <p className={`flex items-center gap-1.5 text-meta truncate${actionRoom} ${status === 'needs_you' ? 'text-warn' : status === 'queued' ? 'text-zinc-300' : 'text-[#b8adff]'}`} title={busyKwants[k.id]} data-bot-busy>- <span className={`kw-status-dot !h-1.5 !w-1.5 ${status === 'needs_you' ? 'kw-status-warn' : status === 'queued' ? 'kw-status-idle' : 'bg-[#9d8fff] kw-pulse'}`} aria-hidden="true" />- <span className="truncate">{busyKwants[k.id]}</span>+ {busyLine ? (+ <p className={`flex items-center gap-1.5 text-meta truncate${actionRoom} ${warn ? 'text-warn' : status === 'queued' ? 'text-zinc-300' : 'text-[#b8adff]'}`} title={busyLine} data-bot-busy>+ <span className={`kw-status-dot !h-1.5 !w-1.5 ${warn ? 'kw-status-warn' : status === 'queued' ? 'kw-status-idle' : 'bg-[#9d8fff] kw-pulse'}`} aria-hidden="true" />+ <span className="truncate">{busyLine}</span></p>) : (- <p className={`text-meta text-zinc-400 truncate${actionRoom}`}>{k.title}</p>+ // Keeps its one line even with no title, so Edit and Remove sit under the name, never on it (#290 N1)+ <p className={`text-meta text-zinc-400 truncate${actionRoom}${!phone && hasRowActions ? ' min-h-[1.125rem]' : ''}`}>{k.title}</p>)}</div>{/* Phones: one button at the row's end; in a team it opens the member's actions */}diff --git a/frontend/tests/ia.test.mjs b/frontend/tests/ia.test.mjsindex 69d2dd5f..36f615a7 100644--- a/frontend/tests/ia.test.mjs+++ b/frontend/tests/ia.test.mjs@@ -249,7 +249,8 @@ test('QA a: a long bot name wraps to two lines instead of cutting off at ~20 chaassert.ok(names.length >= 4, `every bot row has a name (phone=${phone})`);for (const [, cls, name] of names) {assert.match(cls, /\bline-clamp-2\b/, name);- assert.match(cls, /overflow-wrap:anywhere/, `${name}: a name with no spaces still breaks`);+ assert.doesNotMatch(cls, /overflow-wrap:anywhere|break-all|break-words/, `${name}: wraps between words, never inside one`);+ assert.match(cls, /\btext-ellipsis\b/, `${name}: a word too long for the line ends in …`);assert.doesNotMatch(cls, /\btruncate\b/, name);}assert.ok(names.some(([, , n]) => n === long), 'the team member row shows the whole name');diff --git a/frontend/tests/nameWrap.test.mjs b/frontend/tests/nameWrap.test.mjsnew file mode 100644index 00000000..5bde94a8--- /dev/null+++ b/frontend/tests/nameWrap.test.mjs@@ -0,0 +1,104 @@+// A bot's name in the sidebar wraps only between words (or after a hyphen), never inside a word:+// "Researche / r" next to the "Needs you" pill (Oleks, 0.6.11). The pill on the name line is the+// compact hand (plus a count past one); the words go on the status line. No row grows on hover, and+// a bot with no title keeps a status line so Edit and Remove never sit on a two-line name (#290 N1).+import assert from 'node:assert/strict';+import test from 'node:test';+import { readFileSync } from 'node:fs';+import { JSDOM } from 'jsdom';+import { loadBundled } from './bundle.mjs';++const dom = new JSDOM('<!doctype html><html><body></body></html>', { url: 'http://localhost/', pretendToBeVisual: true });+for (const k of ['window', 'document', 'navigator', 'HTMLElement', 'Node', 'DOMParser', 'localStorage', 'sessionStorage', 'getComputedStyle']) {+ if (k in dom.window) Object.defineProperty(globalThis, k, { value: dom.window[k], configurable: true, writable: true });+}++const m = await loadBundled(`+ export { default as React } from 'react';+ export { renderToStaticMarkup } from 'react-dom/server.browser';+ export { Sidebar } from './src/components/Sidebar';+`);+const { React } = m;+const noop = () => {};+const space = { id: 'spc_default', name: 'Default', icon: '💼', color: '#f59e0b', sort: 0, is_default: true, archived_at: null,+ created_at: '', general_channel_id: null, counts: { bots: 0, ready_accounts: 0, unread: 0 }, approvals: 'on' };+const bot = (id, name, title = 'Role', over = {}) => ({ id, name, title, persona_prompt: '', avatar_sprite: 'mouse', driver_type: 'claude', preferred_model: '', ...over });+const NAMES = ['Researcher', 'Booktun.ing Marketer', 'Low content book trending and low competetive idea finder', 'Abcdefghijklmnopqrstuvwxyzabcd'];+const kwants = [...NAMES.map((n, i) => bot(`k${i}`, n)), bot('k9', 'Untitled Researcher Bot', '')];+const team = { id: 't1', name: 'Ship', icon: '🚢', lead_kwant_id: 'k0', member_kwants: ['k0', 'k1', 'k9'] };+const render = (over = {}) => m.renderToStaticMarkup(React.createElement(m.Sidebar, {+ space, spaces: [space], onSwitchSpace: noop, onCreateSpace: noop, onOpenSpaceSettings: noop, onOpenArchived: noop, onOpenSearch: noop,+ kwants, channels: [], teams: [team], selectedId: '', isChannel: true, onSelectKwant: noop, onSelectChannel: noop, onSelectTeam: noop,+ onSummonKwant: noop, onCreateTeam: noop, onOpenInbox: noop, onOpenParallel: noop, onOpenMissions: noop, missionBoard: true,+ onEditKwant: noop, onUpdateTeamMembers: noop, needsYou: { k0: 1, k1: 2, k2: 1, k3: 3 }, ...over,+}));+const doc = (html) => new DOMParser().parseFromString(`<body>${html}</body>`, 'text/html');+// Every class that lets a browser break inside a word+const MID_WORD = /overflow-wrap:anywhere|overflow-wrap:break-word|word-break:break-all|word-break:break-word|\bbreak-all\b|\bbreak-words\b|\bhyphens-auto\b/;+++for (const phone of [false, true]) {+ test(`a name never breaks inside a word, on up to two lines, ending in … if a word is too long (phone=${phone})`, () => {+ const d = doc(render({ phone }));+ const names = [...d.querySelectorAll('[data-bot-name]')];+ assert.ok(names.length >= kwants.length, 'every bot row has a name');+ for (const el of names) {+ const cls = el.getAttribute('class');+ assert.doesNotMatch(cls, MID_WORD, `${el.textContent}: no mid-word break class`);+ assert.match(cls, /\[overflow-wrap:normal\]/, el.textContent);+ assert.match(cls, /\[word-break:normal\]/, el.textContent);+ assert.match(cls, /\bline-clamp-2\b/, el.textContent);+ assert.match(cls, /\btext-ellipsis\b/, el.textContent);+ assert.doesNotMatch(cls, /\btruncate\b|whitespace-nowrap/, `${el.textContent}: still wraps between words`);+ assert.match(el.getAttribute('title'), new RegExp(`^${el.textContent.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')} · `), 'the whole name is in the tooltip');+ }+ // Nothing on the name line lets the name's parents break words either+ for (const line of d.querySelectorAll('[data-bot-name-line]')) assert.doesNotMatch(line.getAttribute('class'), MID_WORD);+ });++ test(`the Needs you pill on the name line is the hand and a count, and the status line says it in words (phone=${phone})`, () => {+ const d = doc(render({ phone }));+ const pills = [...d.querySelectorAll('[data-bot-needs-you]')];+ assert.ok(pills.length >= 4, 'every bot with an open step has the pill');+ for (const p of pills) {+ const row = p.closest('[data-bot-row]');+ const name = row.querySelector('[data-bot-name]').textContent;+ const n = Number(p.getAttribute('data-bot-needs-you'));+ assert.equal(p.getAttribute('aria-label'), `Needs you (${n})`);+ assert.equal(p.getAttribute('title'), `${name} needs you in the browser`);+ assert.doesNotMatch(p.textContent, /Needs you/, 'no words on the name line');+ assert.equal(p.textContent, String(n), 'the hand and its count');+ assert.match(p.getAttribute('class'), /\bshrink-0\b/);+ for (const c of ['h-5', 'px-1.5', 'gap-1', 'rounded-full', 'text-[12px]', 'font-semibold', 'tabular-nums', 'text-[#fbbf24]', 'bg-[rgba(251,191,36,0.12)]', 'border-[rgba(251,191,36,0.35)]'])+ assert.ok(p.getAttribute('class').split(' ').includes(c), `pill spec: ${c}`);+ assert.doesNotMatch(p.getAttribute('class'), /holo/, 'never holographic');+ assert.match(p.innerHTML, /width="14"/, 'hand 14 px');+ const status = row.querySelector('[data-bot-busy]');+ assert.ok(status, `${name}: a status line`);+ assert.equal(status.textContent, 'Needs you in the browser');+ assert.match(status.getAttribute('class'), /\btext-warn\b/);+ }+ });+}++test('a bot that needs you because its chat waits on the browser keeps where (no doubled words)', () => {+ const d = doc(render({ busyKwants: { k0: 'Needs you in the browser in Engineering Room', k1: 'Working here' } }));+ const line = (id) => d.querySelector(`[data-bot-row="${id}"] [data-bot-busy]`).textContent;+ assert.equal(line('k0'), 'Needs you in the browser in Engineering Room');+ assert.equal(line('k1'), 'Needs you in the browser', 'an open step outranks "Working" while it is open');+ const free = doc(render({ needsYou: {}, busyKwants: { k1: 'Working here' } }));+ assert.equal(free.querySelector('[data-bot-row="k1"] [data-bot-busy]').textContent, 'Working here', 'back to the normal status once done');+ assert.equal(free.querySelectorAll('[data-bot-needs-you]').length, 0);+});++test('hover and focus never change the name line, and a bot with no title still reserves its status line (#290 N1)', () => {+ const d = doc(render({}));+ for (const line of d.querySelectorAll('[data-bot-name-line]')) assert.doesNotMatch(line.getAttribute('class'), /group-(hover|focus-within)\//, 'the name line has no hover/focus classes');+ for (const el of d.querySelectorAll('[data-bot-name], [data-bot-needs-you]')) assert.doesNotMatch(el.getAttribute('class'), /group-(hover|focus-within)\//);+ const row = d.querySelector('[data-bot-row="k9"]');+ const status = row.querySelector('[data-bot-name-line] + p');+ assert.equal(status.textContent, '');+ assert.match(status.getAttribute('class'), /min-h-\[1\.125rem\]/, 'one text-meta line high even with no title');+ const src = readFileSync(new URL('../tailwind.config.js', import.meta.url), 'utf8');+ assert.match(src, /meta: \['0\.75rem', \{ lineHeight: '1\.125rem' \}\]/, 'the reserved height is text-meta\'s line height');+});