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
28z: Details summary fits a phone (two lines below sm), one step-count rule (#821)
Oleksandr Ivanchenkof2ae3b36e163
diff --git a/frontend/src/activity.ts b/frontend/src/activity.tsindex 033da880..5d9cb48f 100644--- a/frontend/src/activity.ts+++ b/frontend/src/activity.ts@@ -280,16 +280,16 @@ export function formatClock(ms: number): string {* "· 1 didn't run" when an approval went unanswered (26d) and "· you said no to 1" when the person denied a call (28a).* Counts read the rows Details draws: a folded card and its command count once (28t). */export function activitySummary(a: SavedActivity): string {- // Counts read the rows Details draws: a folded card and its command count once (28t).- const rows = foldAnswers(a.steps).rows;- const n = rows.filter((s) => s.kind !== 'note').length + a.dropped;+ // One step rule for the saved summary and the live "Working · N steps" (28z): shownStepCount.+ const n = shownStepCount(a.steps) + a.dropped;const steps = `${n} ${n === 1 ? 'step' : 'steps'}`;const span = activitySpan(a.steps);const parts = span !== null && span >= 1000 ? [`Worked ${formatClock(span)}`, steps] : [steps];const failed = a.steps.filter((s) => s.status === 'failed').length;if (failed) parts.push(`${failed} failed`);// Raw status, not shownStatus: a human step nobody finished in time (28n) doesn't count here.- const unanswered = rows.filter((s) => s.status === 'unanswered').length;+ // Read the folded rows Details draws, so a card and its command count once (28t).+ const unanswered = foldAnswers(a.steps).rows.filter((s) => s.status === 'unanswered').length;if (unanswered) parts.push(`${unanswered} didn’t run`);const declined = a.steps.filter((s) => s.kind === 'tool' && s.status === 'declined').length;if (declined) parts.push(`you said no to ${declined}`);diff --git a/frontend/src/components/ActivityList.tsx b/frontend/src/components/ActivityList.tsxindex 8589c7b4..00bcf070 100644--- a/frontend/src/components/ActivityList.tsx+++ b/frontend/src/components/ActivityList.tsx@@ -256,8 +256,11 @@ const Steps: React.FC<{ steps: ActivityStep[]; live?: LiveActivity; dropped?: nu};/** The saved reply's steps row (and the live one once it folds, 18f): one class string, so both are the same height. */+// 28z: on a phone the saved summary may wrap to two lines, so both rows keep their icons on the first line (items-start + 1.5px).+// Below sm the three children (icon, text, chevron) are a one-row grid centred in the 44 px touch box (content-center),+// so a one-line row still sits 14/14 and a two-line row fills the box (Mira, 28z round 2).export const STEPS_ROW_BUTTON =- 'max-w-full min-w-0 flex items-center gap-2 px-3 py-1.5 rounded-xl text-xs text-zinc-400 hover:text-zinc-200 bg-zinc-900/70 hover:bg-zinc-800/70 border border-zinc-700/60 hover:border-zinc-600/80 transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400';+ 'max-w-full min-w-0 flex items-center gap-2 px-3 py-1.5 rounded-xl text-xs text-zinc-400 hover:text-zinc-200 bg-zinc-900/70 hover:bg-zinc-800/70 border border-zinc-700/60 hover:border-zinc-600/80 transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400 max-sm:grid max-sm:grid-cols-[auto_minmax(0,1fr)_auto] max-sm:content-center max-sm:items-start';/** The list the steps row opens to. */export const STEPS_ROW_LIST = 'mt-1.5 w-full max-w-2xl rounded-xl border border-zinc-700/60 bg-zinc-900/60 overflow-hidden shadow-[var(--kws-shadow)]';@@ -340,10 +343,10 @@ export const LiveActivityList: React.FC<{ live: LiveActivity; idBase: string; co<section aria-label="What the bot is doing" data-steps-folded="" className="mt-2 max-w-full"><div className="flex max-w-full min-w-0 items-center gap-2"><button type="button" onClick={() => setOpen((o) => !o)} aria-expanded={open} aria-controls={open ? listId : undefined} className={STEPS_ROW_BUTTON}>- <ListTree size={13} className="text-sky-400/80" aria-hidden="true" />+ <ListTree size={13} className="flex-shrink-0 max-sm:mt-[1.5px] text-sky-400/80" aria-hidden="true" />{/* No time while running, as in the card */}<span className="truncate min-w-0">Working · {work} {work === 1 ? 'step' : 'steps'}</span>- <ChevronRight size={13} className={`flex-shrink-0 text-zinc-400 transition-transform motion-reduce:transition-none ${open ? 'rotate-90' : ''}`} aria-hidden="true" />+ <ChevronRight size={13} className={`flex-shrink-0 max-sm:mt-[1.5px] text-zinc-400 transition-transform motion-reduce:transition-none ${open ? 'rotate-90' : ''}`} aria-hidden="true" /></button>{lead && <div className="min-w-0 shrink">{lead}</div>}</div>@@ -414,9 +417,14 @@ export const SavedActivityList: React.FC<{aria-controls={open ? listId : undefined}className={STEPS_ROW_BUTTON}>- <ListTree size={13} className={unanswered ? 'text-amber-300' : failed ? 'text-rose-300' : 'text-sky-400/80'} aria-hidden="true" />- <span className="truncate min-w-0">{activitySummary(activity)}</span>- <ChevronRight size={13} className={`flex-shrink-0 text-zinc-400 transition-transform motion-reduce:transition-none ${open ? 'rotate-90' : ''}`} aria-hidden="true" />+ <ListTree size={13} className={`flex-shrink-0 max-sm:mt-[1.5px] ${unanswered ? 'text-amber-300' : failed ? 'text-rose-300' : 'text-sky-400/80'}`} aria-hidden="true" />+ {/* 28z: on a phone two lines at most, left-aligned, and a line only breaks between " · " parts ("you said no to 1" stays whole). */}+ <span className="min-w-0 text-left break-words max-sm:line-clamp-2 sm:truncate" data-steps-summary="">+ {activitySummary(activity).split(' · ').map((part, i) => (+ <React.Fragment key={i}>{i > 0 && ' · '}<span className="whitespace-nowrap">{part}</span></React.Fragment>+ ))}+ </span>+ <ChevronRight size={13} className={`flex-shrink-0 max-sm:mt-[1.5px] text-zinc-400 transition-transform motion-reduce:transition-none ${open ? 'rotate-90' : ''}`} aria-hidden="true" /></button>{open && (<div className={STEPS_ROW_LIST}>diff --git a/frontend/tests/detailsSummaryFitsPhone.test.mjs b/frontend/tests/detailsSummaryFitsPhone.test.mjsnew file mode 100644index 00000000..94b5eeea--- /dev/null+++ b/frontend/tests/detailsSummaryFitsPhone.test.mjs@@ -0,0 +1,71 @@+// 28z (autonomy/details-summary-fits-phone/brief.md): the Details summary wraps to two lines on a phone instead of+// cutting off its last count, and the saved summary counts steps with the same rule as the live "Working · N steps"+// (shownStepCount). Tests marked "fails on 770b27ee" fail there.+process.env.TZ = 'UTC';+import assert from 'node:assert/strict';+import test from 'node:test';+import { readFileSync } from 'node:fs';+import { loadBundled } from './bundle.mjs';++globalThis.localStorage ??= { getItem: () => null, setItem: () => {}, removeItem: () => {} };++const m = await loadBundled(`+ import React from 'react';+ import { renderToStaticMarkup } from 'react-dom/server.browser';+ import { SavedActivityList } from './src/components/ActivityList';+ export { parseActivityMeta, activitySummary, shownStepCount } from './src/activity';+ export const saved = (props) => renderToStaticMarkup(React.createElement(SavedActivityList, props));+`);++const at = (min) => new Date(Date.parse('2026-11-17T18:00:00Z') + min * 60000).toISOString();+const AP = 'Waiting for your approval: Running a command';+const ap = (id, status, t, tool = 'Bash') => ({ id, kind: 'approval', status, title: AP, tool, started_at: at(t), ended_at: at(t + 0.2), duration_ms: 12000 });+const tool = (id, status, title, t, name = 'Bash', detail) => ({ id, kind: 'tool', status, title, tool: name, started_at: at(t), ended_at: at(t + 0.5), duration_ms: 30000, ...(detail ? { detail } : {}) });+const DENIED = 'The user denied this tool call.';+const note = (id, t) => ({ id, kind: 'note', status: 'ok', title: 'Claude Code doesn’t share its thinking.', started_at: at(t), ended_at: at(t) });+const parse = (raw, dropped = 0) => m.parseActivityMeta({ activity: { steps: raw, dropped } });+const summaryCount = (a) => Number(/(\d+) steps?/.exec(m.activitySummary(a))[1]);++test('the summary’s step count is shownStepCount + dropped: folded pair, unpaired card, note, dropped', () => {+ const cases = {+ 'folded pair': parse([ap('tk1', 'ok', 0), tool('t1', 'ok', 'Running `npm run build`', 0.2)]),+ 'declined pair': parse([tool('t1', 'failed', 'Running `rm -rf dist`', 0, 'Bash', DENIED), ap('tk1', 'declined', 0.01)]),+ 'unpaired card': parse([ap('tk1', 'unanswered', 0), tool('t1', 'ok', 'Read a.ts', 1, 'Read')]),+ 'card for another tool': parse([ap('tk1', 'ok', 0, 'Write'), tool('t1', 'ok', 'Running `ls`', 0.2)]),+ note: parse([tool('t1', 'ok', 'Read a.ts', 0, 'Read'), note('n1', 0.5), tool('t2', 'ok', 'Edit a.ts', 1, 'Edit')]),+ dropped: parse([ap('tk1', 'ok', 0), tool('t1', 'ok', 'Running `npm run build`', 0.2), note('n1', 0.5)], 7),+ };+ const want = { 'folded pair': 1, 'declined pair': 1, 'unpaired card': 2, 'card for another tool': 2, note: 2, dropped: 8 };+ for (const [name, a] of Object.entries(cases)) {+ assert.equal(summaryCount(a), m.shownStepCount(a.steps) + a.dropped, name);+ assert.equal(summaryCount(a), want[name], name);+ }+});++test('activitySummary counts steps through shownStepCount, not its own copy of the rule (fails on 770b27ee)', () => {+ const src = readFileSync(new URL('../src/activity.ts', import.meta.url), 'utf8');+ const body = src.slice(src.indexOf('export function activitySummary'), src.indexOf('\n}\n', src.indexOf('export function activitySummary')));+ assert.match(body, /shownStepCount\(a\.steps\) \+ a\.dropped/);+ assert.doesNotMatch(body, /kind !== 'note'/, 'the note rule lives only in shownStepCount');+});++test('on a phone the summary wraps to two lines between its parts, left-aligned, one line from sm up; icons sit on the first line (fails on 770b27ee)', () => {+ const a = parse([tool('t1', 'failed', 'Running `rm -rf dist`', 0, 'Bash', DENIED), ap('tk1', 'declined', 0.01), tool('t2', 'ok', 'Read a.ts', 26, 'Read')]);+ const html = m.saved({ activity: a, idBase: 'r1' });+ const span = /<span class="([^"]*)" data-steps-summary="">(.*?)<\/span><svg/.exec(html);+ assert.ok(span, 'the summary span is there');+ const cls = span[1].split(' ');+ for (const c of ['min-w-0', 'text-left', 'break-words', 'max-sm:line-clamp-2', 'sm:truncate']) assert.ok(cls.includes(c), c);+ assert.ok(!cls.includes('truncate'), 'no one-line cut below sm');+ assert.equal(span[2].replace(/<[^>]+>/g, ''), m.activitySummary(a), 'the whole summary is in the DOM, same text');+ // a line breaks only between parts: each " · " part is one no-wrap piece+ const parts = [...span[2].matchAll(/<span class="whitespace-nowrap">([^<]*)<\/span>/g)].map((x) => x[1]);+ assert.deepEqual(parts, m.activitySummary(a).split(' · '));+ assert.ok(parts.includes('you said no to 1'));+ const button = /<button type="button" aria-expanded="false" class="([^"]*)"/.exec(html)[1].split(' ');+ assert.ok(button.includes('max-sm:items-start'), 'chevron and icon top-aligned on a phone');+ assert.ok(button.includes('max-sm:grid'), 'a one-row grid on a phone');+ assert.ok(button.includes('max-sm:content-center'), 'a one-line row is centred in the 44 px touch box');+ assert.ok(button.includes('items-center'), 'centred from sm up');+ assert.equal((html.match(/max-sm:mt-\[1\.5px\]/g) ?? []).length, 2, 'both icons line up with the first line');+});diff --git a/frontend/tests/foldedPairCountsOnce.test.mjs b/frontend/tests/foldedPairCountsOnce.test.mjsindex aca5ce3b..b8fd69c7 100644--- a/frontend/tests/foldedPairCountsOnce.test.mjs+++ b/frontend/tests/foldedPairCountsOnce.test.mjs@@ -48,7 +48,7 @@ test('the 28s reply reads "8 steps · 1 didn’t run · you said no to 1", overassert.equal(m.activitySummary(a), 'Worked 26:00 · 8 steps · 1 didn’t run · you said no to 1');const html = m.saved({ activity: a, idBase: 'r1', defaultOpen: true });assert.equal(rows(html), 8, 'Details draws 8 rows');- assert.match(html, /8 steps · 1 didn’t run · you said no to 1/);+ assert.match(html.replace(/<[^>]+>/g, ''), /8 steps · 1 didn’t run · you said no to 1/);});test('a run with no approvals counts as before', () => {diff --git a/frontend/tests/oneRowPerAnswer.test.mjs b/frontend/tests/oneRowPerAnswer.test.mjsindex 79da42fe..cb8da3bd 100644--- a/frontend/tests/oneRowPerAnswer.test.mjs+++ b/frontend/tests/oneRowPerAnswer.test.mjs@@ -139,6 +139,6 @@ test('saved steps are unchanged by the fold; the summary is the one Details showassert.equal(steps.steps.length, 6);assert.deepEqual(steps.steps.map((s) => s.status), ['ok', 'ok', 'declined', 'declined', 'unanswered', 'unanswered']);const html = open(steps);- assert.match(html, new RegExp(m.activitySummary(steps).replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));+ assert.match(html.replace(/<[^>]+>/g, ''), new RegExp(m.activitySummary(steps).replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));assert.equal(m.activitySummary(steps), m.activitySummary(RIG()));});