mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 20:29:02 +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>
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
/**
|
|
* What a browser is told about a workbench window, and what the windows say
|
|
* to each other. (Where a window goes is scripts/test/workbench-placement.ts.)
|
|
*
|
|
* Run: npx tsx scripts/test/workbench-windows.ts
|
|
*/
|
|
import assert from "node:assert/strict";
|
|
import { openingNote, popupFeatures } from "../../src/lib/workbench/windows";
|
|
import { parseBusMessage, workbenchChannelName } from "../../src/lib/workbench/bus";
|
|
|
|
assert.equal(
|
|
popupFeatures({ x: 1440, y: 0, width: 2560, height: 1440 }),
|
|
"popup,left=1440,top=0,width=2560,height=1440",
|
|
);
|
|
|
|
// Only a refused window earns a word.
|
|
assert.equal(openingNote(null), null);
|
|
assert.equal(openingNote({ how: "opened" }), null);
|
|
assert.equal(openingNote({ how: "placed" }), null);
|
|
assert.equal(openingNote({ how: "focused" }), null);
|
|
assert.equal(openingNote({ how: "desktop" }), null);
|
|
assert.match(openingNote({ how: "blocked" }) ?? "", /pop-ups/);
|
|
|
|
// The bus accepts exactly its own messages.
|
|
assert.deepEqual(parseBusMessage({ kind: "pane", pane: "session", state: "open", from: "w1" }), {
|
|
kind: "pane",
|
|
pane: "session",
|
|
state: "open",
|
|
from: "w1",
|
|
});
|
|
assert.equal(parseBusMessage({ kind: "pane", pane: "site", state: "open", from: "w1" }), null);
|
|
assert.equal(parseBusMessage({ kind: "pane", pane: "session", state: "gone", from: "w1" }), null);
|
|
assert.equal(parseBusMessage({ kind: "pane", pane: "session", state: "open", from: "" }), null);
|
|
assert.equal(parseBusMessage("pane"), null);
|
|
assert.equal(workbenchChannelName("p1"), "loki:workbench:p1");
|
|
|
|
console.log("workbench-windows: ok");
|