mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 16:27:37 +01:00
* feat(workbench): one project side by side, on one screen or two A project's session and Loki as columns of one window, and its site in a window of its own — beside this one or on the other screen. Nothing in it is new UI: the columns are TerminalSurface and LokiWorkspace mounted as they are; the site is the live page with the owner's pass, where pointing and "Fix it now" already live. What the workbench adds is the arrangement. - /projects/[id]/workbench, a Workbench row on the project page, and the pane SSOT in config/workbench.ts (session, loki). - The site is a window, not a pane, on purpose: every fleet site sends frame-ancestors 'none' and Cross-Origin-Opener-Policy same-origin, so it can be neither framed nor reached as an opener. The workbench says only what it knows. docs/architecture/workbench.md. - Windows open the best way the platform offers: Fleet Runner places them from the real display list (new IPC open-workbench-window, v0.8.60, caller tiled left / new window right, or the other display whole, an open window brought forward); a Chromium browser places a popup on the other screen once allowed; any browser gets a half-screen popup. - Any pane in its own window (?pane=): a solo window hides the shell chrome at every width; the windows of one project on one machine keep each other honest over a BroadcastChannel (a popped-out pane leaves its window and returns when that window closes). - Which panes a window shows is device-local (localStorage per project), never a column on the project. Two columns from xl; below that one pane at a time and the strip chooses; below md the phone's rows. - Each column's side rail (the session's Loki rail, the chat's history) is remembered for the workbench apart from its own page and starts closed in a column: TerminalSurface gets `rail`, LokiWorkspace gets `basePath`, `project` and `history`. - Full screen is the browser's own, on the workbench root. - Pure parts tested: scripts/test/workbench-layout.ts, workbench-windows.ts, workbench-placement.ts. Checked by hand at 390, 720, 1000, 1440 and 1920px and as a one-pane window at 900px, no horizontal scroll. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmswy1H6cYyL3hmLRy9 * refactor(workbench): one placement rule, a window's own layout, honest re-opens A second pass over the workbench after an independent review of the diff. - One placement module for both sides: src/lib/workbench/placement.ts is the pure rule the browser popup and Fleet Runner's real windows share (the desktop copy is gone). Tiling respects the caller's minimum width, so the 800px shell and the new window meet on a 1440px display instead of overlapping; only a display too small for both overlaps. - The layout is the window's: sessionStorage per project, kept across the window's reloads and never shared. Two full workbench windows of one project each keep their own arrangement; localStorage's cross-window storage event clobbered them. useLocalStorageState takes the area. - A popped-out pane announces itself closed on every way out — pagehide and a soft navigation away — and open again from the back-forward cache. - A window already open is brought forward, never navigated again: the site's address carries a pass minted per visit, and a second navigation left it unread in the address bar. Fleet Runner keys windows by the URL without its fragment, restores a minimized one and places it where the person now asks. - The screen-management prompt is raised when "On the other screen" is chosen, not on the open that follows: a click that waits for a prompt goes stale and the browser refuses the window. - Close in a solo window leads somewhere even when window.close() is a no-op (a typed address): it falls through to the whole workbench. - The dock click on macOS asks whether the SHELL window exists, not any window, so a site window open with the shell closed no longer hides it. - Which panes are on screen (columns, or one of them) is a pure, tested rule; window opening lives in one hook (use-workbench-windows) instead of two states; the phone's rows read each pane's surface from the registry; useBodyClass serves both the immersive chat and the solo window. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmswy1H6cYyL3hmLRy9 * feat(workbench): one box — Session and Watch, not Session and Loki The first cut put Loki's chat in the second column. Beside the session's box that was a second place to type on one screen, and a person had to work out which box did what ("I see two chats, and it just gets confusing"). The session's box already does the one thing the screen is for — it types into the live agent, or starts one — and the session already offers Loki about itself ("What's going on?"). - The second column is Watch: the project's run as a live thread (what you asked, Loki narrating, the agent's screen, and where the change is — pull request, tested and merged, live), mounted from ProjectWatch as it is. It has no box. Loki's chat stays its own page. - The pane registry carries where each pane's own page is (`pageHref`), so the phone's rows and the columns read one list. - A pane body can be a scrolling thread (Watch) or a surface that fills the pane (the session). - LokiWorkspace is back to what it was: the host-path, project and history props it only grew for the workbench are gone with their only caller. - The project row says what the screen is for: "Say what to change and watch it happen, with the site beside". Checked by hand at 390, 720, 1000, 1440 and 1920px and in both solo windows: no horizontal scroll, no console errors. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmswy1H6cYyL3hmLRy9 * feat(workbench): one screen, one box — the site as Loki sees it, the robot, one line of state "If a user sees tons of options, they can feel a paralysis" (owner, 2026-10-31). The screen showed about twenty controls: the Sessions page's builder picker, tab strip, agent and view switches, Watch's card with its own buttons, pane toggles, a window-placement menu. One thing to do, a few things to see — so: - The site, left, as Loki's own browser sees it (WorkbenchSiteView): the review worker already walks the site in a headless Chromium on the box and keeps one frame per action with the action named. While it walks, this shows the robot using the site, frame by frame — the one thing no window of yours can show; at rest, the last look. A tap opens the real site in its own window, where the person uses it and the widget does the watching. Fleet sites forbid framing and sever window.opener, so a picture of Loki's browser is what can honestly be shown inside Loki. - The robot, right: TerminalSurface in a new quiet shape (`quiet`) — no builder picker (which builder runs a project is a stored decision), no tab strip of other projects, no shell rows; the chat | terminal switch and the agent stay. Its box is the ONE box on the screen. - One line of state over the robot (WorkbenchStateLine): the sentence the Watch track composes, a dot for its tone, "Watch it work" for the whole story. Pure stateLine() in lib/workbench/state-line.ts, tested. The Watch column is gone from the screen. - One "⋯" for the rest: the robot in its own window / on the other screen, the site on the other screen, full screen. The pane toggles and the placement menu are gone; a placement named for one opening wins and becomes the remembered one. - The pane registry is the robot alone; the site is a region. Below xl the robot alone (the site is in its own window anyway). On a phone: the site, the robot, Watch it work, as rows. - TerminalSurface stayed under the function-size ceiling by lifting the builder-picker wrapper and the resume filter out of it. Checked by hand at 390, 720, 1440 and 1920px and in the solo window: no horizontal scroll, no console errors. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmswy1H6cYyL3hmLRy9 * feat(workbench): a focus screen — the app's chrome leaves while you build Three layers of navigation sat around two columns: the sidebar's twenty destinations, the project strip ("Profile · Chat · Home · Sessions"), then the workbench's own header and the robot's bar with the Sessions page's agent menu — "Frankenstein elements just thrown together" (owner, 2026-11-01). - While the workbench is open, the sidebar, top bar, bottom tabs, footer and project strip are gone (body.fc-workbench-focus, the former solo rule applied to the whole screen from md up). They are for moving between pages, and a person here is not moving. The one back link in the header is the way out. A phone keeps its own bars: the rows need them. - The robot's bar is the chat | terminal switch alone (TerminalSessionBar `agentSwitch`, off in the quiet shape): the session's own chip names the agent and its box changes it. What is on the screen now, left to right: back, Open the site, "⋯"; the site as Loki sees it; the robot with one line of state, the view switch and the one box. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmswy1H6cYyL3hmLRy9 * feat(workbench): two windows of one desk — one frame, a title bar each The site sat in a card and the robot stood bare beside it, with a line of state floating above and a caption floating below: two different things on one screen. Now both regions, and a solo window, are one frame (WorkbenchFrame): a title bar — a dot for its tone, one sentence, one link — over a body. - The site's bar is its address and what Loki is doing there ("Live", "Loki is using it: …", "Loki's last look: …"), like a browser's own tab; its body the page, top-aligned; before any look, the address alone and "Tap to open" — never a sentence apologising for an empty box. - The robot's bar is the build's state (hooks/use-run-state, the Watch track's sentence) with "Watch it work"; its body the session with the one box. WorkbenchStateLine is folded into it. - The floating Ask Loki button leaves in focus: its panel is the second chat this screen deliberately has not, and it sat on the send arrow. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmswy1H6cYyL3hmLRy9 * feat(nav): Loki first — the chat is the default screen, three words then folds The owner's philosophy, 2026-11-01, now in AGENTS.md ("Why Loki exists, and for whom"): a good Loki chat, reachable in one step, is the screen that opens; the rest of the app one tap away; a friend on your side, not a staff; never a screen that makes a person feel stupid; measure by effort, not features. - APP_HOME and RUNNER_HOME are /loki: signing in, and Fleet Runner starting with the computer, land on the chat. They landed on Today, a page to read before a person could say anything. - The sidebar is three bare words — Loki, Home, Projects — the same three as the phone's bottom bar (Loki first there too), then folded groups that each say the question they answer: Waiting for you (Approvals, Feedback), Your day (Today, Suggestions, Voice), Across your projects (Sessions, Missions, Activity, Prompts), Under the hood (Packages, System), and Private behind the PIN. Not a drawer called More: the navigation test records why a "More" section rots, and still forbids it; the phone's More is the folded groups as a sheet. - Every sidebar line says what it is for on hover (the item's own description), so nothing has to be guessed. - SidebarSection gains `bare` (no header, never folded) and `foldedByDefault`; the tests that pinned the old Build / Loki / To review / The fleet placement now pin the new homes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmswy1H6cYyL3hmLRy9 * feat(voice): Loki speaks as someone on your side The owner's philosophy (AGENTS.md, "Why Loki exists"): a friend on your side, not a staff you direct; never a word that makes a person feel stupid. The public pages still said the opposite. - Hero: "Say what you want. Loki builds it with you." (was "Describe it. Agents build it."). The lede, APP_DESCRIPTION, the social-card tagline and the how-it-works steps follow. Every factual claim is one the product keeps: it builds with AI agents, puts it online, changes it on ask. - /why's principles open with two new ones from the owner's words: "On your side" and "Life is short". Commitments about how Loki is made, not claims about what it does. - The new-project card says "Say what you want. Loki sets it up and starts building." instead of repos and agents; the sidebar's Loki line drops "dispatch" for "Loki answers, or builds it with you". - The hero's two sentences are separate balanced blocks: on a phone each breaks as an even pair, never one word alone. The mission headline on /why ("Direct the creation of …") is left for the owner to decide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmswy1H6cYyL3hmLRy9 * feat(voice): the mission reads "with someone on your side" /why's headline was "Direct the creation of everything you can imagine." — the staff-you-manage voice the owner set aside. It now reads "Make everything you can imagine, with someone on your side.", the owner's own call (2026-11-01). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmswy1H6cYyL3hmLRy9 --------- Co-authored-by: Claude <noreply@anthropic.com>
181 lines
8.0 KiB
TypeScript
181 lines
8.0 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import {
|
|
ACCOUNT_NAV_ITEMS,
|
|
FLEET_SURFACES,
|
|
MOBILE_NAV_ITEMS,
|
|
NAV,
|
|
NAV_ITEMS,
|
|
SIDEBAR_SECTIONS,
|
|
SITE_NAV_ITEMS,
|
|
} from "../../src/config/navigation";
|
|
|
|
// ─── The loop is the taxonomy ────────────────────────────────────────────────
|
|
// Loki's sidebar answers three operator questions and nothing else. This test
|
|
// exists because the previous structure decayed in a way a reviewer could not
|
|
// see: a section literally named "More" accumulated Approvals, Terminal,
|
|
// Prompts, Activity, System, Thoughts and the public /fleet register — seven
|
|
// unrelated pages whose only shared property was that nobody had decided where
|
|
// they went. A landfill does not announce itself; it has to be made
|
|
// unrepresentable.
|
|
|
|
const LOOP = [
|
|
// Four words first, a person's questions (2026-11-01, AGENTS.md "Why Loki
|
|
// exists"): Loki (the default screen), Home, Projects — bare, no header.
|
|
{ id: "now", items: ["loki", "control", "projects"], bare: true },
|
|
// Everything else folded, each group one question — never a drawer.
|
|
{ id: "waiting", items: ["approvals", "feedback"], bare: false },
|
|
{ id: "day", items: ["today", "suggestions"], bare: false },
|
|
// "bots" opens the one list on OrangeCat (the bot's face is OrangeCat's,
|
|
// its work is Loki's; one list, not two — #1495).
|
|
{ id: "talk", items: ["voice", "bots"], bare: false },
|
|
{ id: "across", items: ["terminal", "missions", "activity", "prompts"], bare: false },
|
|
{ id: "hood", items: ["packages", "system"], bare: false },
|
|
] as const;
|
|
|
|
for (const expected of LOOP) {
|
|
const section = SIDEBAR_SECTIONS.find((s) => s.id === expected.id);
|
|
assert.ok(section, `${expected.id} section exists`);
|
|
assert.deepEqual(
|
|
section.items.map((i) => i.id),
|
|
[...expected.items],
|
|
`${expected.id} holds exactly the pages that answer its question`,
|
|
);
|
|
assert.ok(
|
|
section.question.trim().length > 0,
|
|
`${expected.id} states the operator question it answers — a section that ` +
|
|
`cannot state its question is the "More" failure starting over`,
|
|
);
|
|
assert.equal(
|
|
Boolean(section.bare),
|
|
expected.bare,
|
|
`${expected.id} is ${expected.bare ? "the bare four" : "a folded group with a header"}`,
|
|
);
|
|
if (!expected.bare)
|
|
assert.ok(
|
|
section.foldedByDefault,
|
|
`${expected.id} is folded until opened — the sidebar reads as four words`,
|
|
);
|
|
}
|
|
// The bare section is exactly the phone's bottom bar: one list, two shapes.
|
|
assert.deepEqual(
|
|
SIDEBAR_SECTIONS.find((s) => s.bare)?.items.map((i) => i.id),
|
|
MOBILE_NAV_ITEMS.map((i) => i.id),
|
|
"the four words and the bottom bar are the same list",
|
|
);
|
|
// Every folded page says what it is for on hover (SidebarNavItem title).
|
|
for (const section of SIDEBAR_SECTIONS.filter((s) => !s.bare))
|
|
for (const item of section.items)
|
|
assert.ok(item.description.trim().length > 0, `${item.id} says what it is for`);
|
|
|
|
// The landfill, by every name it might return under.
|
|
for (const banned of ["more", "other", "misc", "site", "tools"]) {
|
|
assert.equal(
|
|
SIDEBAR_SECTIONS.some((s) => s.id === banned),
|
|
false,
|
|
`"${banned}" is not a section — a section is one operator question, not a drawer`,
|
|
);
|
|
}
|
|
|
|
// ─── Nothing is listed twice ─────────────────────────────────────────────────
|
|
const sidebarIds = SIDEBAR_SECTIONS.flatMap((s) => s.items.map((i) => i.id));
|
|
assert.equal(new Set(sidebarIds).size, sidebarIds.length, "no nav item is listed in two sections");
|
|
|
|
// The sidebar navigates; the account menu acts on the account. An item in both
|
|
// is how the sidebar footer quietly became a second settings page.
|
|
for (const item of ACCOUNT_NAV_ITEMS) {
|
|
assert.equal(
|
|
sidebarIds.includes(item.id),
|
|
false,
|
|
`${item.id} belongs to the account menu, not the sidebar`,
|
|
);
|
|
}
|
|
|
|
// ─── Marketing pages left the signed-in shell, but stay findable ─────────────
|
|
// "Investors" was in the authenticated sidebar. Curating the sidebar must not
|
|
// make a page unreachable, so the palette still indexes every one of them.
|
|
for (const item of SITE_NAV_ITEMS) {
|
|
assert.equal(
|
|
sidebarIds.includes(item.id),
|
|
false,
|
|
`${item.id} is a public marketing page — not an operator surface`,
|
|
);
|
|
assert.ok(
|
|
NAV_ITEMS.some((i) => i.id === item.id),
|
|
`${item.id} stays in NAV_ITEMS so Cmd-K can still reach it`,
|
|
);
|
|
}
|
|
|
|
// ─── Retired routes are deleted, not hidden ──────────────────────────────────
|
|
// `agents` → /control and `atlas` → /projects survived as NAV entries pointing
|
|
// at the pages that replaced them. Because NAV_ITEMS is what AppTopBar and
|
|
// PageTitle search for "which page am I on?", the first match won: /control
|
|
// would have been titled "Agents". The redirect pages reference their TARGETS
|
|
// (NAV.control, NAV.projects), so the redirects stay honest without them.
|
|
for (const retired of ["agents", "atlas", "duet"]) {
|
|
assert.equal(
|
|
retired in NAV,
|
|
false,
|
|
`${retired} is retired — a nav entry pointing at its own replacement shadows it`,
|
|
);
|
|
}
|
|
|
|
// No two nav items may share an href, for the same reason.
|
|
const hrefs = NAV_ITEMS.map((i) => i.href);
|
|
assert.equal(
|
|
new Set(hrefs).size,
|
|
hrefs.length,
|
|
"no two nav items share an href — the 'which page am I on?' lookup takes the first match",
|
|
);
|
|
|
|
// ─── Mobile bottom bar mirrors the loop ──────────────────────────────────────
|
|
// Home, Projects, Loki, plus More. A tab that is not in a section would mean
|
|
// the bar and the sheet describe different products.
|
|
assert.deepEqual(
|
|
MOBILE_NAV_ITEMS.map((i) => i.id),
|
|
["loki", "control", "projects"],
|
|
"the bottom bar carries what is opened daily — Loki first, Home, Projects — and More holds the rest",
|
|
);
|
|
assert.equal(NAV.control.label, "Home", "Control is called Home");
|
|
for (const tab of MOBILE_NAV_ITEMS) {
|
|
assert.ok(sidebarIds.includes(tab.id), `${tab.id} is a real sidebar destination`);
|
|
}
|
|
// A heading over a single row reads as a menu that lost its contents ("Your
|
|
// day" over Today alone, "Build" over Terminal alone — owner, 2026-10-19).
|
|
// On the phone the tabs are filtered out of More, so count what is left.
|
|
const tabIds = new Set(MOBILE_NAV_ITEMS.map((i) => i.id));
|
|
// The bare three ARE the tabs, so the sheet shows nothing of theirs: skipped.
|
|
for (const section of SIDEBAR_SECTIONS.filter((s) => !s.private && !s.bare)) {
|
|
const inMore = section.items.filter((i) => !tabIds.has(i.id));
|
|
assert.ok(
|
|
inMore.length >= 2,
|
|
`"${section.label}" shows ${inMore.length} row(s) in the phone's More sheet — at least two, or fold it into another section`,
|
|
);
|
|
}
|
|
assert.equal(NAV.terminal.label, "Sessions", "the page of agent sessions is called Sessions");
|
|
|
|
// ─── Private zone ────────────────────────────────────────────────────────────
|
|
const priv = SIDEBAR_SECTIONS.find((s) => s.id === "private");
|
|
assert.ok(priv, "private section exists");
|
|
assert.ok(priv.private, "private section is PIN-gated");
|
|
for (const id of ["people", "robots", "crew"] as const) {
|
|
assert.ok(
|
|
priv.items.some((i) => i.id === id),
|
|
`${id} stays in the private book`,
|
|
);
|
|
assert.equal(NAV[id].href, `/${id}`, `${id} has its own route`);
|
|
}
|
|
|
|
// ─── Project workspace tabs ──────────────────────────────────────────────────
|
|
assert.ok(
|
|
FLEET_SURFACES.some((s) => s.id === "terminal"),
|
|
"Terminal stays a project-scoped fleet tab",
|
|
);
|
|
for (const surface of FLEET_SURFACES) {
|
|
assert.ok(
|
|
NAV_ITEMS.some((i) => i.href === surface.href),
|
|
`${surface.id} points at a real nav destination`,
|
|
);
|
|
}
|
|
|
|
console.log("✓ navigation IA tests passed");
|