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
0.8.1 F4: working strip names the running bot and sits in the composer section at 390 (#481)
Oleksandr Ivanchenkof9ac893bd2ff
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsxindex 03b82d2d..2875d3c4 100644--- a/frontend/src/App.tsx+++ b/frontend/src/App.tsx@@ -24,6 +24,7 @@ import { HumanStepCard } from './components/HumanStepCard';import { StarAsk } from './components/StarAsk';import { starAskStore } from './starAsk';import { LiveActivity, appendThinking, applyActivity, parseStep, seedActivity } from './activity';+import { liveNamingOrder, namesToFill } from './workingStrip';import {HumanStep,HumanStepMeta,@@ -720,7 +721,10 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({setLive(liveRef.current);};const clearLive = (ctx: string | null | undefined) => {- if (ctx) delete streamsRef.current[ctx];+ if (ctx) {+ delete streamsRef.current[ctx];+ delete liveKwantRef.current[ctx];+ }if (ctx === openCtxRef.current) {setStreamingText('');setStreamingThinking('');@@ -732,6 +736,19 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({setLive(next);};const kwantName = (id: unknown) => (typeof id === 'string' ? kwantsRef.current.find((k) => k.id === id)?.name : undefined);+ // 0.8.1 F4: which bot runs in each live chat, so a name that wasn't known yet can be filled in. A page+ // opened mid-turn reads the running turns before the bot list arrives; without this the strip kept the+ // chat's own title ("@QATeam is getting started") for the whole turn.+ const liveKwantRef = useRef<Record<string, string>>({});+ const markLiveKwant = (ctx: string | null | undefined, kwantId: unknown) => {+ if (ctx && typeof kwantId === 'string' && kwantId) liveKwantRef.current[ctx] = kwantId;+ markLive(ctx, kwantName(kwantId));+ };+ // Once the bot list arrives (or changes), name the live chats still waiting for one.+ useEffect(() => {+ for (const [ctx, name] of namesToFill(liveRef.current, liveKwantRef.current, kwantName)) markLive(ctx, name);+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [kwants]);const chatLoadsRef = useRef(new ChatLoads());/** Loads a chat's latest messages into the cache, and on screen if it's open. */@@ -822,7 +839,8 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({for (const ctx of Object.keys(liveRef.current)) {if (!busy.has(ctx) && !discussionInProgressRef.current) clearLive(ctx);}- for (const t of Object.values(map)) markLive(t.context_id, kwantName(t.kwant_id));+ // The strip names the bot that is replying: queued turns first, so a running one in the same chat wins.+ for (const t of liveNamingOrder(Object.values(map))) markLiveKwant(t.context_id, t.kwant_id);// Titles for the "working on" badgesfor (const t of Object.values(map)) {if (t.thread_id && !threadsByKwantRef.current[t.kwant_id]) loadThreads(t.kwant_id);@@ -1071,7 +1089,7 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({turnStarted(d.kwant_id, key);moodTurnStarted(d.kwant_id);}- if (!discussionInProgressRef.current || ctx !== streamingContextIdRef.current) markLive(ctx, kwantName(d.kwant_id));+ if (!discussionInProgressRef.current || ctx !== streamingContextIdRef.current) markLiveKwant(ctx, d.kwant_id);}break;}@@ -1315,7 +1333,7 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({}if (event.type === 'TextDelta') buf.text += event.data;else buf.thinking = event.data;- if (!(ctx in liveRef.current)) markLive(ctx, kwantName(event.kwant_id));+ if (!(ctx in liveRef.current)) markLiveKwant(ctx, event.kwant_id);if (shouldRenderDelta(event, openCtxRef.current, streamingContextIdRef.current)) {if (event.type === 'TextDelta') {setStreamingText(buf.text);@@ -1333,7 +1351,7 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({if (!step || !ctx || !turnId) break;const cur = activityRef.current[turnId];setActivityMap({ ...activityRef.current, [turnId]: { ...applyActivity(cur, turnId, step), ctx } });- if (!(ctx in liveRef.current)) markLive(ctx, kwantName(event.kwant_id));+ if (!(ctx in liveRef.current)) markLiveKwant(ctx, event.kwant_id);break;}case 'human_step_updated':diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsxindex dadbfd4d..b2a96811 100644--- a/frontend/src/components/ChatView.tsx+++ b/frontend/src/components/ChatView.tsx@@ -762,7 +762,7 @@ export const ChatView: React.FC<ChatViewProps> = ({card.scrollIntoView({ block: 'end', behavior: reduce ? 'auto' : 'smooth' });setApprovalOffscreen(false);};- // The running turn's summary line (WorkingStrip): above the composer section on a phone, inside it on desktop.+ // The running turn's summary line (WorkingStrip): inside the composer section, right above the box.const workingStrip = (<WorkingStripactive={isStreaming}@@ -2099,9 +2099,6 @@ export const ChatView: React.FC<ChatViewProps> = ({</ScrollRow>)}- {/* Phone: its quiet line sits above the composer section. Desktop: inside it, right above the box. */}- {phone && workingStrip}-{/* Modern Composer Input Bar */}<divref={composerWrapRef}@@ -2190,7 +2187,8 @@ export const ChatView: React.FC<ChatViewProps> = ({</div>)}- {!phone && workingStrip}+ {/* Phone and desktop (0.8.1 F4): the quiet line sits inside the composer section, right above the box. */}+ {workingStrip}<formonSubmit={handleSubmit}diff --git a/frontend/src/components/QueuedBeside.tsx b/frontend/src/components/QueuedBeside.tsxindex 4b190b38..2cfffe8a 100644--- a/frontend/src/components/QueuedBeside.tsx+++ b/frontend/src/components/QueuedBeside.tsx@@ -31,7 +31,8 @@ export function QueuedBeside({ items }: { items?: QueuedState[] }) {return (<li key={q.turnId ?? i} className="flex items-start gap-1.5 text-[11px] leading-snug text-zinc-400"><span className="mt-[5px] w-1.5 h-1.5 rounded-full bg-zinc-500 shrink-0" aria-hidden="true" />- <span className="min-w-0">+ {/* text-wrap: pretty so a last word ("finish.") never sits alone on line 2 at 390 px (#479, Mira). */}+ <span className="min-w-0 [text-wrap:pretty]"><strong className="font-medium text-zinc-200">{q.named ? `${q.speaker} · ${place}` : place}</strong>{!sameAsAbove && <> {queuedText(q.reason, q.slots, q.named ? q.speaker : undefined)}</>}</span>diff --git a/frontend/src/components/WorkingStrip.tsx b/frontend/src/components/WorkingStrip.tsxindex 688f26c7..49afdee5 100644--- a/frontend/src/components/WorkingStrip.tsx+++ b/frontend/src/components/WorkingStrip.tsx@@ -34,8 +34,8 @@ interface WorkingStripProps {* line (0.6.13 spec A3), kept quiet (0.7.5): a plain ~28 px line, no card, 12 px text and a 16 px avatar,* with space below it so it never touches the composer. "Answer ↑" is the one thing with emphasis while* the bot waits on the person. Its buttons stay 28 px tall but tap like 44 px (kws-hit in modern.css).- * On desktop (0.8.0) it is the same kind of quiet line at desktop size, placed inside the composer section- * (ChatView renders it there), lined up with the composer box below it.+ * On desktop (0.8.0) it is the same kind of quiet line at desktop size. Both sit inside the composer+ * section (ChatView renders them there; on a phone too since 0.8.1 F4), lined up with the box below.*/export const WorkingStrip: React.FC<WorkingStripProps> = ({ active, name, title, live, queued, awaitingAnswer, awaitingBrowser, writing, onStop, onAnswer, onWatch, phone: forcePhone }) => {const mountedAt = useRef(Date.now());@@ -60,8 +60,8 @@ export const WorkingStrip: React.FC<WorkingStripProps> = ({ active, name, title,const answer = on && onAnswer && (phone || on === 'question') ? on : null;if (phone) {return (- <div className="kws-strip kws-strip-phone px-3 pt-1 pb-1.5" data-working-strip="" data-waiting-on={on ?? undefined}>- <div className="mx-auto flex h-7 max-w-4xl items-center gap-2">+ <div className="kws-strip kws-strip-phone mx-auto mb-2 max-w-4xl pl-[21px] pr-[9px]" data-working-strip="" data-waiting-on={on ?? undefined}>+ <div className="flex h-7 items-center gap-2"><span className={`shrink-0 inline-flex ${waiting ? '' : 'kw-avatar-working'}`}><ModernAvatar role={title} name={name} size={16} /></span>diff --git a/frontend/src/workingStrip.ts b/frontend/src/workingStrip.tsindex 9d708314..ae53eb18 100644--- a/frontend/src/workingStrip.ts+++ b/frontend/src/workingStrip.ts@@ -67,3 +67,31 @@ export function turnStart(live: LiveActivity | null | undefined, mountedAt: numb}return start;}++/**+ * 0.8.1 F4: live chats whose running bot has no name yet but can be named now: [chat, name] pairs.+ * `live` maps a chat to the name its strip shows ('' when the bot list hadn't loaded), `kwantIds` maps+ * a chat to its running bot's id. A chat that already shows a name keeps it.+ */+export function namesToFill(+ live: Record<string, string>,+ kwantIds: Record<string, string>,+ nameOf: (id: string) => string | undefined,+): [string, string][] {+ const out: [string, string][] = [];+ for (const [ctx, name] of Object.entries(live)) {+ if (name || !kwantIds[ctx]) continue;+ const n = nameOf(kwantIds[ctx]);+ if (n) out.push([ctx, n]);+ }+ return out;+}++/**+ * 0.8.1 F4: the order a page opened mid-turn names its live chats in. Each chat keeps the last name it+ * is given, so queued turns go first and a running turn in the same chat names the strip, never a bot+ * that is only waiting in line.+ */+export function liveNamingOrder<T extends { state?: string }>(turns: T[]): T[] {+ return [...turns.filter((t) => t.state !== 'running'), ...turns.filter((t) => t.state === 'running')];+}diff --git a/frontend/tests/mobileCards.test.mjs b/frontend/tests/mobileCards.test.mjsindex 48984247..dd24ef88 100644--- a/frontend/tests/mobileCards.test.mjs+++ b/frontend/tests/mobileCards.test.mjs@@ -148,12 +148,14 @@ test('inline code wraps anywhere and keeps its box on every line', () => {const live = (steps) => ({ turnId: 't1', thinking: {}, steps });const step = (over = {}) => ({ id: 's1', kind: 'tool', status: 'running', title: 'Using `web_search`', started_at: '2026-11-05T10:00:00Z', ...over });-test('on a phone the strip is one quiet line: no card, 28 px, 12 px text, 16 px avatar, space above the composer', () => {+test('on a phone the strip is one quiet line: no card, 28 px, 12 px text, 16 px avatar, 8 px above the box', () => {const html = m.strip({ active: true, name: 'Architect', title: 'Architect', live: live([step()]), phone: true });const wrap = /<div class="(kws-strip[^"]*)"/.exec(html)[1];- // Bottom spacing so it never sits on the composer's border; the composer's own 12 px side padding.- for (const c of ['kws-strip-phone', 'px-3', 'pt-1', 'pb-1.5']) assert.ok(wrap.split(' ').includes(c), c);- const line = /data-working-strip=""><div class="([^"]*)"/.exec(html)[1];+ // 0.8.1 F4: inside the composer section like desktop, so the same column and edges as the box below:+ // 21 px in (the avatar starts where the placeholder does), 9 px on the right, 8 px to the box.+ for (const c of ['kws-strip-phone', 'mx-auto', 'max-w-4xl', 'mb-2', 'pl-[21px]', 'pr-[9px]']) assert.ok(wrap.split(' ').includes(c), c);+ assert.ok(!wrap.split(' ').includes('px-3'), 'no second 12 px inset: the section already has it');+ const line = /data-working-strip=""[^>]*><div class="([^"]*)"/.exec(html)[1];assert.ok(line.split(' ').includes('h-7'), 'about 28 px tall');// No card: no border, background, shadow or rounding on the phone.assert.doesNotMatch(wrap + ' ' + line, /\bborder\b|\bbg-|shadow|rounded|min-h-\[44px\]/);@@ -224,17 +226,17 @@ test('desktop strip is the composer status line: no card, 28 px, 20 px avatar, eassert.doesNotMatch(watch, /min-h-8/);});-test('ChatView puts the desktop strip inside the composer section, right above the box; the phone keeps its place', () => {+test('ChatView puts the strip inside the composer section, right above the box, on a phone and on desktop (0.8.1 F4)', () => {const src = readFileSync(new URL('../src/components/ChatView.tsx', import.meta.url), 'utf8');- const phoneAt = src.indexOf('{phone && workingStrip}');const sectionAt = src.indexOf('{/* Modern Composer Input Bar */}');- const deskAt = src.indexOf('{!phone && workingStrip}');- const formAt = src.indexOf('<form', deskAt);- assert.ok(phoneAt > 0 && phoneAt < sectionAt, 'phone line above the composer section');- assert.ok(deskAt > sectionAt, 'desktop line inside the composer section');- assert.ok(src.indexOf('aria-label="Ask a member"', sectionAt) < deskAt, 'below the Ask chips');- assert.equal(src.slice(deskAt + '{!phone && workingStrip}'.length, formAt).trim(), '', 'directly above the box');- assert.equal(src.match(/<WorkingStrip\b/g).length, 1, 'one element, placed by layout');+ const at = src.indexOf('{workingStrip}');+ const formAt = src.indexOf('<form', at);+ assert.ok(sectionAt > 0 && at > sectionAt, 'inside the composer section');+ assert.ok(src.indexOf('aria-label="Ask a member"', sectionAt) < at, 'below the Ask chips');+ assert.equal(src.slice(at + '{workingStrip}'.length, formAt).trim(), '', 'directly above the box');+ assert.doesNotMatch(src, /\{!?phone && workingStrip\}/, 'no layout-specific place (Rigel: 390 sat outside the section)');+ assert.equal(src.split('{workingStrip}').length - 1, 1, 'rendered once');+ assert.equal(src.match(/<WorkingStrip\b/g).length, 1, 'one element');});test('on a phone the steps panel is one 44 px row, the engine note behind an info button', () => {diff --git a/frontend/tests/workingStripName.test.mjs b/frontend/tests/workingStripName.test.mjsnew file mode 100644index 00000000..0f95fb22--- /dev/null+++ b/frontend/tests/workingStripName.test.mjs@@ -0,0 +1,61 @@+// 0.8.1 F4 (Rigel, qa-final-080 "0.8.x" item 3): a page opened while a bot replies read the running turns+// before the bot list arrived, so the working strip kept the chat's title ("@QATeam is getting started")+// for the whole turn. It now remembers which bot runs in each chat and names it once the list loads; and a+// queued turn in the same chat never names the strip over the running one.+import assert from 'node:assert/strict';+import test from 'node:test';+import { readFileSync } from 'node:fs';+import { loadBundled } from './bundle.mjs';++const m = await loadBundled(`+ import React from 'react';+ import { renderToStaticMarkup } from 'react-dom/server.browser';+ import { QueuedBeside } from './src/components/QueuedBeside';+ export * from './src/workingStrip';+ export const beside = (items) => renderToStaticMarkup(React.createElement(QueuedBeside, { items }));+`);++const bots = { 'k-ann': 'Ann', 'k-bea': 'Beatrix' };+const nameOf = (id) => bots[id];++test('a chat marked live before the bot list loaded gets its bot name once the list is there', () => {+ assert.deepEqual(m.namesToFill({ 'ch-qa': '' }, { 'ch-qa': 'k-ann' }, nameOf), [['ch-qa', 'Ann']]);+});++test('a chat that already shows a name keeps it', () => {+ assert.deepEqual(m.namesToFill({ 'ch-qa': 'Laya' }, { 'ch-qa': 'k-ann' }, nameOf), []);+});++test('nothing to fill while the bot is still unknown, or with no bot id for the chat', () => {+ assert.deepEqual(m.namesToFill({ 'ch-qa': '' }, { 'ch-qa': 'k-ann' }, () => undefined), []);+ assert.deepEqual(m.namesToFill({ 'ch-qa': '' }, {}, nameOf), []);+});++test('the running turn names the strip, not a bot waiting in line in the same chat', () => {+ const turns = [+ { turn_id: 'r1', kwant_id: 'k-ann', context_id: 'ch-qa', state: 'running' },+ { turn_id: 'q2', kwant_id: 'k-bea', context_id: 'ch-qa', state: 'queued' },+ ];+ // App gives each chat the last name it sees: replay that.+ const named = {};+ for (const t of m.liveNamingOrder(turns)) named[t.context_id] = nameOf(t.kwant_id);+ assert.equal(named['ch-qa'], 'Ann');+ // A chat with only a queued turn is still named (its strip says "waiting in line").+ const only = {};+ for (const t of m.liveNamingOrder([{ kwant_id: 'k-bea', context_id: 'ch-x', state: 'queued' }])) only[t.context_id] = nameOf(t.kwant_id);+ assert.equal(only['ch-x'], 'Beatrix');+});++test('App wires it: page-open, turn and stream events record the bot id; the bot list fills names', () => {+ const src = readFileSync(new URL('../src/App.tsx', import.meta.url), 'utf8');+ assert.equal((src.match(/markLive\([^)]*kwantName\(/g) ?? []).length, 1, 'only markLiveKwant itself looks a name up');+ assert.ok((src.match(/markLiveKwant\(/g) ?? []).length >= 4, 'the four callers');+ assert.match(src, /liveNamingOrder\(Object\.values\(map\)\)/);+ assert.match(src, /namesToFill\(liveRef\.current, liveKwantRef\.current, kwantName\)[\s\S]{0,200}\}, \[kwants\]\);/);+ assert.match(src, /delete liveKwantRef\.current\[ctx\]/, 'cleared with the live chat');+});++test('the queued row text wraps pretty, so a last word never sits alone at 390 px (#479, Mira)', () => {+ const html = m.beside([{ position: 1, reason: 'agent_busy', speaker: 'Beatrix', named: true, turnId: 'q2' }]);+ assert.match(html, /<span class="min-w-0 \[text-wrap:pretty\]"><strong/);+});