mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 16:27:37 +01:00
From the operator's phone screenshots of /terminal (Brave, Android): - Two switches for one choice. Keys | Write sat on the bar and Write opened a second Type | Prompt switch: four combinations for "how am I talking to this session". The bar is now ONE switch — Type · Prompt · Keys — and tapping the open one closes it back to watching. That also gives the terminal back the row the inner switch took. - The prompt library covered the whole session. It opens upward over the terminal at a flat 20rem; on a phone with the keyboard or browser toolbars that is every visible line. Named `.ui-picker-panel` caps it at min(20rem, 45dvh) wherever the picker is used. - Suggestions that did not make sense out of context. "next best steps:**" was a markdown heading the bullet-strip half-unwrapped, so the preamble filter missed it; emphasis is now stripped before that check (Loki's follow-ups share the parser). Chips show two lines instead of cutting a sentence mid-word, and the model is asked for steps under 50 characters. Claude-Session: https://claude.ai/code/session_01E1qoQ9syUYXCRNbyrpqPGa Co-authored-by: Claude <noreply@anthropic.com>
72 lines
3.2 KiB
TypeScript
72 lines
3.2 KiB
TypeScript
// Phone chrome that must stay calm (operator, 2026-10-05: "it looks
|
|
// Frankenstein … too much cognitive load"). Each case is one thing that used
|
|
// to stack, repeat, or dead-end on a phone.
|
|
// Run: npx tsx scripts/test/phone-chrome.ts
|
|
import { readFileSync } from "fs";
|
|
import { join } from "path";
|
|
|
|
let pass = 0;
|
|
let fail = 0;
|
|
function ok(cond: unknown, label: string) {
|
|
if (cond) pass++;
|
|
else {
|
|
fail++;
|
|
console.error(`✗ ${label}`);
|
|
}
|
|
}
|
|
const read = (f: string) => readFileSync(join(process.cwd(), f), "utf8");
|
|
|
|
{
|
|
// A builder that never sends the conversation is shown as the terminal —
|
|
// not as a screen explaining Fleet Runner versions.
|
|
const chat = read("src/components/terminal/ClaudeChatView.tsx");
|
|
const surface = read("src/components/terminal/TerminalSurface.tsx");
|
|
ok(!/Fleet Runner 0\.8\.38/.test(chat), "no runner-version dead end in the conversation view");
|
|
ok(chat.includes("onUnavailable"), "the conversation view reports when it cannot load");
|
|
ok(surface.includes("onUnavailable={"), "the terminal surface falls back to the terminal");
|
|
ok(!/attach=\{false\}/.test(chat), "the conversation view can attach a screenshot");
|
|
}
|
|
{
|
|
// The empty terminal names a way forward and offers it as a button.
|
|
const surface = read("src/components/terminal/TerminalSurface.tsx");
|
|
const actions = read("src/components/terminal/TerminalOfflineActions.tsx");
|
|
ok(surface.includes("<TerminalOfflineActions"), "offline/gated empty state offers actions");
|
|
ok(surface.includes('setSource("machine")'), "offline/gated empty state can switch builders");
|
|
ok(actions.includes('href="/download"'), "offline/gated empty state links Fleet Runner");
|
|
}
|
|
{
|
|
// One floating thing at a time on a phone: the bottom nav hides Loki's own
|
|
// feedback launcher, and reporting moves into the account menu.
|
|
const nav = read("src/components/shell/MobileNav.tsx");
|
|
const menu = read("src/components/shell/AccountMenu.tsx");
|
|
ok(/ui-mobile-nav"[^>]*data-fc-place="hidden"/.test(nav), "phone nav hides the widget launcher");
|
|
const opener = read("src/lib/open-feedback.ts");
|
|
ok(
|
|
menu.includes("Report a problem") &&
|
|
menu.includes("openFeedback(") &&
|
|
opener.includes(".report()"),
|
|
"menu offers Report a problem",
|
|
);
|
|
}
|
|
{
|
|
// The dock is one bar with one panel open in BOTH phone layouts — never the
|
|
// old stack of key rows + chips + composer.
|
|
const dock = read("src/components/terminal/TerminalMobileDock.tsx");
|
|
ok(!dock.includes("if (!immersive)"), "no separate stacked layout for the normal page");
|
|
ok(
|
|
dock.includes('immersive ? "none" : "write"'),
|
|
"normal opens on Write, full screen on nothing",
|
|
);
|
|
ok(dock.includes("ui-term-watchbar"), "the single bar is rendered");
|
|
// ONE switch on that bar: the input modes ARE the bar's chips. The old
|
|
// Keys | Write bar opened a second Type | Prompt switch inside Write.
|
|
ok(!/>\s*Write\s*</.test(dock), "no separate Write chip");
|
|
ok(
|
|
/ui-term-watchbar[\s\S]*<TerminalInputSwitch[\s\S]*selected=\{panel === "write"\}/.test(dock),
|
|
"input modes live on the bar, pressed only while their panel is open",
|
|
);
|
|
}
|
|
|
|
console.log(`${fail ? "✗" : "✓"} phone-chrome: ${pass} passed, ${fail} failed`);
|
|
if (fail) process.exit(1);
|