PEP-257: переводы, словарь, полный экран, визуальная проверка

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
peppa-bot 2026-11-24 12:37:16 +00:00
parent c01261bad5
commit 8053f7b65c
21 changed files with 145 additions and 6 deletions

View File

@ -102,7 +102,7 @@ async function SessionRow({ s, selected, needsPm }: { s: SessionView; selected:
async function SessionPane({ s }: { s: SessionView }) {
const t = await getT();
return (
<section aria-label={t("Терминал")} className="flex min-w-0 flex-col gap-2.5 lg:sticky lg:top-4 lg:h-[calc(100dvh-10rem)]" data-session-pane={s.id}>
<section aria-label={t("Терминал")} className="flex min-w-0 flex-col gap-2.5 lg:h-[calc(100dvh-10rem)]" data-session-pane={s.id}>
<header className="flex flex-wrap items-center gap-x-2 gap-y-1 text-sm">
<StatusBadge status={s.status} kind="session" />
{s.taskKey ? <Key href={`/t/${s.taskKey}`}>{s.taskKey}</Key> : <Key href={`/p/${s.projectKey}`}>{s.projectKey}</Key>}

View File

@ -194,6 +194,7 @@ export async function RunnerDetails({ s, questions, events, steps, stories, back
// PEP-257: one place for terminals — «Сессии», opened on this session.
<Link href={`/sessions?id=${s.id}`} data-open-session={s.id} className="inline-flex items-center gap-2 self-start rounded-md border bg-card px-3 py-1.5 text-sm text-foreground hover:bg-accent hover:no-underline">
<SquareTerminal className="size-4" />
{/* glossary-ignore: «Работа агентов» и «Сессии» — только в виде «Инженер» */}
{t("Открыть в «Сессиях»")}
</Link>
)}

View File

@ -134,6 +134,7 @@ export function RunnerTerminal({ sessionId, live, fill = false }: { sessionId: n
family.current = font;
// Open only when the web font is there: xterm measures the cell once, at open.
const fonts = document.fonts;
// i18n-ignore: sample glyphs (Latin and Cyrillic) for the font loader, not a text
const ready = fonts ? Promise.race([fonts.load(`12px ${font}`, "W Ж").then(() => fonts.ready), new Promise((r) => setTimeout(r, 2000))]) : Promise.resolve();
void Promise.all([import("@xterm/xterm"), ready]).then(([{ Terminal }]) => {
if (disposed || !host.current) return;
@ -303,7 +304,7 @@ export function RunnerTerminal({ sessionId, live, fill = false }: { sessionId: n
<div ref={scroller} data-terminal-scroller className={cn("overflow-auto rounded-lg border bg-[#0b0b0d] p-1.5", full || fill ? "min-h-0 flex-1" : "max-h-[60vh]", input && live && "border-primary/60")}>
{/* xterm's helper textarea and scrollbar keep offsets of the previous font size for a
moment and stuck out below the terminal (a blank strip to scroll into) — clip them. */}
<div style={scale !== 1 ? { width: grid.w * scale, height: grid.h * scale } : undefined} className="overflow-hidden">
<div style={scale !== 1 ? { width: grid.w * scale, height: grid.h * scale } : undefined} className="w-max overflow-hidden">
<div ref={host} className="w-max origin-top-left overflow-hidden" style={scale !== 1 ? { transform: `scale(${scale})` } : undefined} />
</div>
</div>

View File

@ -238,9 +238,11 @@ export async function SessionCard({ s, back, showTitle = false, live = false, st
<SessionUsageLine usage={s.usage} provider={s.provider} />
<AttachCommand name={s.tmuxName} />
<SessionActions s={s} back={back} />
{!["done", "failed"].includes(s.status) && (
{/* «Сессии» are a section of «Инженер»: a product view gets no terminal link (PEP-123). */}
{!["done", "failed"].includes(s.status) && (await uiMode()) === "engineer" && (
<Button asChild size="sm" variant="outline" className="self-start">
<Link href={`/sessions?id=${s.id}`} data-open-session={s.id}>
{/* glossary-ignore: кнопка только в виде «Инженер» */}
<SquareTerminal /> {t("Открыть в «Сессиях»")}
</Link>
</Button>

View File

@ -40,5 +40,5 @@
"apps/web/components/RunnerTerminal.tsx": {"tmux": 1, "сессия": 2, "терминал": 2},
"apps/web/components/Runners.tsx": {"tmux": 1, "ветка": 1, "контекст": 1, "пул": 2, "раннер": 12, "стори": 15, "терминал": 2, "токен": 1},
"apps/web/components/Sidebar.tsx": {"команда": 2},
"apps/web/components/cards.tsx": {"tmux": 1, "терминал": 3}
"apps/web/components/cards.tsx": {"tmux": 1, "терминал": 2}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 KiB

View File

@ -0,0 +1,48 @@
# PEP-257: визуальная проверка терминала и раздела «Сессии»
Стенд: production-сборка веба (`next build` + `node server.ts`), отдельная база с `mock-ui-seed`,
настоящий tmux 3.3a (`PEPPA_TMUX_SOCKET=stand`), в pane — вывод с русскими и английскими
строками, цветным diff, строками длиннее окна и статусной строкой Claude Code; pane 220×50, как
у агентов. Браузер — headless Chromium (playwright-core), окно 1440×900, `deviceScaleFactor: 2`
(как Retina). Сценарий — `scenario.mjs` (результат каждого шага — JSON ниже).
## До исправления
- `0-before-panel.png`, `0-before-terminal.png` — «Работа агентов», терминал в панели:
`letter-spacing: 3px` у строк xterm, сетка 2200 px на 220 колонок при шрифте 12 px, видна
только левая часть строк, нижней панели tmux нет (кадр 50 строк = только pane).
## После
| Шаг | Снимок | Итог |
|---|---|---|
| 1. Вход в «Сессии» без `id` | `1-first.png` | выбрана первая (#2, ждёт ответа — выше), терминал сразу «в эфире» |
| 2. Клик по другой живой сессии | `2-switch.png` | `/sessions?id=1`, справа её терминал, сессии не создаются и не останавливаются |
| 3–4. Обратно, перезагрузка страницы | — | та же сессия, кадр заново, всё на месте |
| 5. Окно 1100×800 | `5-narrow.png` | все 220 колонок в ширину, панель tmux видна |
| 6. Окно 1920×1080 | `6-wide.png` | то же, шрифт крупнее |
| 7–8. Кнопки + / − | `7-plus.png` | ручной размер без масштаба, горизонтальная прокрутка, текст не теряется |
| 9. «По ширине» | — | снова все колонки в окне |
| 10–11. Полный экран и выход (Esc) | `10-full.png` | как в нативном терминале; панель tmux внизу |
| 12. Страница стори PAY-1 | `12-story.png` | терминала нет (`.xterm` = 0), кнопка «Открыть в «Сессиях»» |
| 13. Переход со стори | — | `/sessions?id=2`, выбрана именно сессия стори |
| 14. Завершённая `?id=7` | — | «Сессия #7 уже завершена — открыта другая.» |
| 15. «Работа агентов» | — | терминала нет, ссылка на `/sessions?id=2` |
| Пустое состояние | `14-empty.png` | «Живых сессий нет.» + как запустить |
На каждом шаге с терминалом: `iframe` = 0, `letter-spacing: normal`, 51 строка (50 pane + 1
статус tmux), последняя строка видна в области терминала, русская и английская длинные строки
видны целиком (до «КОНЕЦ» / «END»), ошибок страницы нет. Ввод: «Ввод» + печать `privet-123`
дошли в pane (`tmux capture-pane`).
## Панель tmux
Нижней панели не было, потому что `capture-pane` отдаёт только содержимое pane, а панель tmux
рисует клиенту при `attach`; у сессий она включена (`status on`). Теперь строку берём у самого
tmux: `#{T:status-format[0]}` (тот же текст, что увидит `tmux attach`: `[peppa-pay` — tmux сам
режет `status-left` до `status-left-length` 10, окно `0:bash*`, справа заголовок pane и время),
стили `#[…]` переведены в цвета. Тест `terminal.test.ts` сверяет строку с конфигурацией tmux и
`status off`.
Ограничение окружения: значки `⏵⏵` в строке Claude Code на Linux-стенде без шрифта с этими
символами показаны квадратами; на Mac шрифт есть.

View File

@ -0,0 +1,63 @@
import { chromium } from "/tmp/tools/node_modules/playwright-core/index.mjs";
const [login] = process.argv.slice(2);
const B = "http://localhost:18300";
const b = await chromium.launch({ executablePath: process.env.CHROME });
const ctx = await b.newContext({ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 2 });
const p = await ctx.newPage();
const errors = [];
p.on("pageerror", (e) => errors.push(e.message));
await p.goto(login, { waitUntil: "networkidle" }).catch(() => {});
await p.waitForTimeout(1500);
const O = "/tmp/shots/check";
const state = (label) => p.evaluate((label) => {
const sc = document.querySelector("[data-terminal-scroller]");
const rows = [...document.querySelectorAll(".xterm-rows > div")];
const last = rows.at(-1);
const scR = sc?.getBoundingClientRect();
const lastR = last?.getBoundingClientRect();
return {
label, url: location.pathname + location.search,
pane: document.querySelector("[data-session-pane]")?.getAttribute("data-session-pane"),
current: document.querySelector("[aria-current=true][data-session-row]")?.getAttribute("data-session-row"),
status: document.querySelector("[data-terminal-status]")?.getAttribute("data-terminal-status"),
font: document.querySelector("[data-terminal-font]")?.getAttribute("data-terminal-font"),
iframes: document.querySelectorAll("iframe").length,
letter: rows[0] && getComputedStyle(rows[0].parentElement).letterSpacing,
rows: rows.length,
statusBar: last?.textContent.trim().slice(0, 60),
statusBarVisible: !!(scR && lastR && lastR.bottom <= scR.bottom + 1 && lastR.top >= scR.top - 1),
gridFits: !!(sc && sc.scrollWidth <= sc.clientWidth + 1),
russianLine: rows.some((r) => r.textContent.includes("Это длинная строка ответа агента") && r.textContent.includes("КОНЕЦ")),
englishLine: rows.some((r) => r.textContent.includes("This is a long English line") && r.textContent.includes("END")),
};
}, label);
const log = async (label, shot) => { await p.waitForTimeout(1200); const s = await state(label); console.log(JSON.stringify(s)); if (shot) await p.screenshot({ path: `${O}-${shot}.png` }); return s; };
await p.goto(B + "/sessions", { waitUntil: "networkidle" }); await p.waitForTimeout(3000);
await log("1 вход: первая сессия выбрана сама", "1-first");
await p.click("[data-session-row='1']"); await p.waitForURL(/id=1/);
await log("2 переключение на другую живую сессию", "2-switch");
await p.click("[data-session-row='2']"); await p.waitForURL(/id=2/);
await log("3 обратно на первую", null);
await p.reload({ waitUntil: "networkidle" }); await p.waitForTimeout(2500);
await log("4 повторное открытие (перезагрузка)", "4-reload");
await p.setViewportSize({ width: 1100, height: 800 }); await log("5 окно 1100×800", "5-narrow");
await p.setViewportSize({ width: 1920, height: 1080 }); await log("6 окно 1920×1080", "6-wide");
await p.setViewportSize({ width: 1440, height: 900 });
await p.click("[data-terminal-zoom='+']"); await log("7 кнопка + (ручной размер, прокрутка)", "7-plus");
await p.click("[data-terminal-zoom='-']"); await p.click("[data-terminal-zoom='-']"); await log("8 кнопка −", null);
await p.click("[data-terminal-fit]"); await log("9 снова «По ширине»", null);
await p.click("button[aria-label='Во весь экран']"); await log("10 полный экран", "10-full");
await p.keyboard.press("Escape"); await log("11 выход из полного экрана", null);
await p.goto(B + "/t/PAY-1", { waitUntil: "networkidle" }); await p.waitForTimeout(1500);
const story = await p.evaluate(() => ({ xterm: document.querySelectorAll(".xterm").length, link: document.querySelector("[data-open-session]")?.getAttribute("href") }));
console.log(JSON.stringify({ label: "12 страница стори", ...story }));
await p.screenshot({ path: `${O}-12-story.png` });
await p.click("[data-open-session]"); await p.waitForURL(/sessions\?id=/); await p.waitForTimeout(2500);
await log("13 переход со стори", "13-from-story");
await p.goto(B + "/sessions?id=7", { waitUntil: "networkidle" }); await p.waitForTimeout(1500);
console.log(JSON.stringify({ label: "14 завершённая #7", gone: await p.evaluate(() => document.querySelector("[data-session-gone]")?.textContent) }));
await p.goto(B + "/runners?id=2", { waitUntil: "networkidle" }); await p.waitForTimeout(1500);
console.log(JSON.stringify({ label: "15 работа агентов", xterm: await p.evaluate(() => document.querySelectorAll(".xterm").length), link: await p.evaluate(() => document.querySelector("[data-open-session]")?.getAttribute("href")) }));
console.log("page errors:", errors);
await b.close();

View File

@ -18,6 +18,7 @@ import { feedback } from "./feedback.ts";
import { intent } from "./intent.ts";
import { attachments } from "./attachments.ts";
import { capacity } from "./capacity.ts";
import { sessions } from "./sessions.ts";
import { untrusted } from "./untrusted.ts";
import { mcpGuide } from "./mcp-guide.ts";
import { subscriptionRequest } from "./subscription-request.ts";
@ -32,4 +33,4 @@ import { accessHub } from "./access-hub.ts";
import { errors } from "./errors.ts";
import { features } from "./features.ts";
export const en: Dict = { ...errors, ...common, ...story, ...project, ...admin, ...settings, ...help, ...runner, ...bot, ...merge, ...merge_a, ...merge_b, ...merge_c, ...merge_d, ...feedback, ...attachments, ...capacity, ...untrusted, ...mcpGuide, ...subscriptionRequest, ...domainGuard, ...observe, ...intent, ...proposals, ...analyst, ...chatsUx, ...accountMerge, ...acceptScreen, ...accessHub, ...features };
export const en: Dict = { ...errors, ...common, ...story, ...project, ...admin, ...settings, ...help, ...runner, ...bot, ...merge, ...merge_a, ...merge_b, ...merge_c, ...merge_d, ...feedback, ...attachments, ...capacity, ...sessions, ...untrusted, ...mcpGuide, ...subscriptionRequest, ...domainGuard, ...observe, ...intent, ...proposals, ...analyst, ...chatsUx, ...accountMerge, ...acceptScreen, ...accessHub, ...features };

View File

@ -0,0 +1,11 @@
// PEP-257: «Сессии» — the terminals of all live agent sessions in one place.
export const sessions: Record<string, string> = {
"Живые сессии агентов ваших проектов: выберите слева — справа сразу её терминал.": "Live agent sessions of your projects: pick one on the left — its terminal opens on the right.",
"Сессия #{id} уже завершена — открыта другая.": "Session #{id} has already ended — another one is open.",
"Живых сессий нет.": "No live sessions.",
"Агент запускается, когда стори переносят в «В работе» на доске проекта, или кнопкой «Новый терминал» в «Работе агентов».": "An agent starts when a story is moved to «In progress» on the project board, or with «New terminal» in «Agents at work».",
"Список сессий": "Sessions",
"Открыть в «Сессиях»": "Open in «Sessions»",
"Все колонки по ширине окна": "All columns across the window width",
"По ширине": "Fit width",
};

View File

@ -18,6 +18,7 @@ import { feedback } from "./feedback.ts";
import { intent } from "./intent.ts";
import { attachments } from "./attachments.ts";
import { capacity } from "./capacity.ts";
import { sessions } from "./sessions.ts";
import { untrusted } from "./untrusted.ts";
import { mcpGuide } from "./mcp-guide.ts";
import { subscriptionRequest } from "./subscription-request.ts";
@ -32,4 +33,4 @@ import { accessHub } from "./access-hub.ts";
import { errors } from "./errors.ts";
import { features } from "./features.ts";
export const kk: Dict = { ...errors, ...admin, ...bot, ...common, ...help, ...mergeA, ...mergeB, ...mergeC, ...mergeD, ...merge, ...project, ...runner, ...settings, ...story, ...feedback, ...attachments, ...capacity, ...untrusted, ...mcpGuide, ...subscriptionRequest, ...domainGuard, ...observe, ...intent, ...proposals, ...analyst, ...chatsUx, ...accountMerge, ...acceptScreen, ...accessHub, ...features };
export const kk: Dict = { ...errors, ...admin, ...bot, ...common, ...help, ...mergeA, ...mergeB, ...mergeC, ...mergeD, ...merge, ...project, ...runner, ...settings, ...story, ...feedback, ...attachments, ...capacity, ...sessions, ...untrusted, ...mcpGuide, ...subscriptionRequest, ...domainGuard, ...observe, ...intent, ...proposals, ...analyst, ...chatsUx, ...accountMerge, ...acceptScreen, ...accessHub, ...features };

View File

@ -0,0 +1,11 @@
// PEP-257: «Сессии» — the terminals of all live agent sessions in one place.
export const sessions: Record<string, string> = {
"Живые сессии агентов ваших проектов: выберите слева — справа сразу её терминал.": "Жобаларыңыздағы агенттердің белсенді сессиялары: сол жақтан таңдаңыз — оң жақта бірден оның терминалы ашылады.",
"Сессия #{id} уже завершена — открыта другая.": "#{id} сессиясы аяқталған — басқасы ашылды.",
"Живых сессий нет.": "Белсенді сессиялар жоқ.",
"Агент запускается, когда стори переносят в «В работе» на доске проекта, или кнопкой «Новый терминал» в «Работе агентов».": "Агент жоба тақтасында стори «Жұмыста» бағанына ауыстырылғанда немесе «Агенттер жұмысы» бөліміндегі «Жаңа терминал» батырмасымен іске қосылады.",
"Список сессий": "Сессиялар тізімі",
"Открыть в «Сессиях»": "«Сессиялар» бөлімінде ашу",
"Все колонки по ширине окна": "Барлық бағандар терезе енімен",
"По ширине": "Ені бойынша",
};