Repository navigation
App Shell and Layout
- Primary Function: Autonomous CI/CD pipeline monitoring, build log analysis, dependency resolution, and edge deployment verification.
- Runtime Target: Bun 1.4.x with native ESM and TypeScript striping.
- Framework Integration: Elysia edge routes & Rsbuild plugins.
-
Session Sidebar (left, default 280px —
DEFAULT_LEFT_PANEL_WIDTHinshared/lib/workspace/sidebar-width.ts; floor 264, ceiling 500): workspace folders bound to oh-my-pi projects, each listing its sessions, plus search/sort/archive toolbar and the settings/about/new-workspace/scheduler modals (src/client/components/layout/session-sidebar/). It has TWO chromes behind one setting — see the entry below. -
The session sidebar has TWO chromes behind ONE setting, and the setting is a presentation choice — never a second sidebar (
sidebarStyle: 'classic' | 'modern',shared/lib/workspace/sidebar-style.ts,client/hooks/workspace/sidebar-style.ts, Settings → Appearance → Layout). The structure that makes it safe:SessionsView(desktop) andmobile/SessionSidebarare DISPATCHERS that own the controller, the search/archive/sort state, the batch machine and every dialog, and each chrome receives exactly oneSessionSidebarVariantProps(layout/session-sidebar/variant-props.ts). A chrome therefore cannot grow a private copy of an action — the batch bar is drawn by the dispatcher for the same reason.classicisClassicView+mobile-session-sidebar/ClassicDrawer, i.e. the shipped markup moved verbatim, and it is the DEFAULT (DEFAULT_SIDEBAR_STYLE) so an upgrade rearranges nothing.modernislayout/session-sidebar/modern/on desktop and the SAME component withtouchdensity in the phone drawer — one row implementation (common/session-row/) at two sizes, not two implementations. Four measured details: the icon and title columns are shared with the workspace header, numerically — 4px inset, a 16px slot (18px on touch), 8px before the text, in bothmodern/WorkspaceHeaderandcommon/session-row; before that rule the folder mark centred at x=20 against the row's status glyph at 24, the folder name sat at 34 against the title's 40, and the two⋯triggers were 9px apart (folder 8px from the panel edge, row 16px) — a 4px, a 6px and a 9px step, which is why the list read as two lists. The trailing column is 22px on desktop and 28px on touch in BOTH, ending 4px inside the list's content edge. Themodernskeleton draws only the LIST — the search line, chips and action row are real controls that already render whileinitializing, so a skeleton with its own copies put two search fields on screen and its ownpx-2doubled the container's inset; its heights are the live ones (26/31 desktop, 32/44 touch), measured, because a placeholder of a different height is a layout shift with extra steps. And the filter row never wraps: four chips measured 265px against 256px of content at the 280px default, soSelectfell to a second line and grew the row by 27px. The fix is a measured two-form Select (filterSelectForminshared/lib/workspace/sidebar-filter-row.ts): a 28px glyph in the trailing slot below ~286px, a fourth chip above it. Only Select is right-aligned; the filter group is not. The group is a reading order that starts at the same left edge as the search field and the rows, and two mistakes were measured here:ml-autoon the GROUP pushed All/Running/Archived to the right edge as soon as the chip form appeared (the filters jumped sideways while the panel was dragged), andml-autoon the chip while it was still INSIDE the group did nothing at all — the group isshrink-0and only as wide as its chips, so it had no free space to claim and the chip sat flush afterArchived. Select is therefore a SIBLING of the group, and the row's own spare space is what pushes it to the trailing edge in both forms. The classic chrome keeps itsh-full-lessflex-1because the batch bar is a sibling BELOW it in the same column (ah-fullchild pushed the bar out of the panel); the classic search field force-opens when a query is present, because a query that survived a style switch otherwise left a filtered list with nothing on screen explaining it (and closing search clears the query for the same reason);modern's trailing column overlays the age and the⋯in ONE box (opacity only — neverdisplay:none), because at the 264px floor the title has ~176px and two trailing columns cost it a third. The live switch is announced, not polled: the settings modal callsapplySettingsSideEffects→applySidebarStyle→omp:sidebar-style-changed, anduseSidebarStyleis the single subscriber — the sidebar is visible BEHIND the modal, so a missing announcement shows the old chrome until a reload. -
A brand-new chat's sidebar row belongs to a CLIENT store, not to the URL — and both layouts read the same one (
pending-sessions.ts,src/client/hooks/chat/omp/). omp writes a session's.jsonlonly when the first assistant message settles (measured ~17s, its writes are buffered), so until then the row exists only because Kabmo draws it. It used to be derived from?sessionId=inside the controller, which made it a property of the ACTIVE session: clicking another session deleted the row, and it reappeared seconds later when omp's scan caught up (the reported "hilang dari session sidebar dan muncul setelah beberapa saat"). And because only the desktop sidebar passedincludePendingSessions, a phone showed no row at all until the scan landed. The store is now the single owner:startPendingSessionmints the id at the click (every creator — both sidebars, the New Chat dialog, the pluginopenNewbridge — writes what it returns into the URL, because an id the store does not know is a row nothing can draw),markPendingSessionSentis called by the send path,adoptPendingSessionmoves the entry onto the omp UUID a spawn answers with, andhydratePendingSessionregisters an id a reload (or a second tab) re-enters with an empty store — including a mid-run adopted id, whosestreamrow is the only thing that keeps its row after a switch.withPendingRows(pending-rows.ts, split out because the store hit the per-file ceiling — the store owns an entry's LIFETIME, that module owns how one is DRAWN) folds the entries in for BOTH layouts, before the search filter (a row the user's own search hides is a row the search never offered to find), forces its host folder open (desktop readsisExpanded; the phone seeds its drawer expansion from the same list, so a seed taken from the raw folders would collapse the one row nothing else can recover), and stamps the row from the ID's OWN clock (pendingSessionTitle), neverDate.now()— a re-stamp on every revalidate advanced the title's seconds and re-shuffledLATEST_SESSIONordering mid-run. Retention: an authoritative row always wins, a live run holds its row wherever the user navigates, an UNSENT draft keeps its row ONLY while there is a draft to get back to (hasComposerDraftover the session's own UI state: blank text and no attachments retires the row, and an UNREAD slot keeps it — a blob still in flight means the answer is unknown, not empty; the OPEN chat's own row is exempt, because that is the row on screen), because its content is real — the draft lives in that session's UI state — so the row is what makes it reachable again;MAX_UNSENT_DRAFTSbounds how many real drafts are held, and a SENT entry is released afterPENDING_SETTLE_MSso a child that died before writing a transcript cannot leave a row behind for the life of the tab. A plain move away from a pending chat is not an adoption:consumeAdoptionrecords thefromId → toIdpair a SPAWN produced and the session-state provider migrates only on that claim, because every switch away looks identical from the URL and the ungated version copied the pending chat'schat.draftinto the session the user clicked next (measured).useSessionSidebarController's only remaining layout option isexpandSearchMatches(desktop); the pending row is not a per-layout request. Pinned bypending-sessions.test.ts(the rules),session-sidebar-controller.test.ts(mounted through the real provider, so a case mounted with NO options is the phone's own call) andsidebar.e2e.ts/mobile.e2e.ts(a real click, a real switch — both fail with the old URL-derived row restored). -
A workspace opens itself when a row inside it needs to be seen — a run in flight, or a chat with no transcript yet (
folder-auto-expand.ts,src/client/hooks/chat/omp/). A collapsed workspace drew the spinner and thenew-…row inside a body nobody could see, so the one answer to "did my prompt land?" was hidden by the folder's own state. Two halves, because a render flag alone does not survive the run ending: the controller force-opens a folder hosting astreamsession in the list it renders (the same rulewithPendingRowsalready applied to a pending row's host), and writesworkspace_folders.is_expandedthrough the one toggle the category header uses (folder-expansion.ts— the phone's drawer now calls it too, instead of its own rawfetch), so a reload and the other layout read one answer. The write is EDGE-triggered per session id, which is what keeps a tool call's structure push from re-issuing it several times a minute. Measured against a real server: a collapsedomptestwith onestreamrow wentis_expanded 0 → 1and rendered its 75 rows after a sidebar refresh, andNew session in generalon a collapsed folder wrote the same flag before the row was ever sent in. -
The workspace list is the user's, and the omp-project sync only SEEDS it — once per database, and only while it is still empty (
syncWorkspaceFoldersFromDiscovery,src/server/lib/db/workspace-sync.ts, called once fromgetDb()). It is a bootstrap, not a background indexer: with any row present — bound or unbound, a hand-made grouping counts — it returns without touching the table, andSYNC_WORKSPACE=falseskips it outright. Two conditions because "empty" has two meanings a row count cannot separate: a database that has never been seeded, and one whose owner deleted every folder on purpose. Theworkspace_sync_ranmarker inapp_settingscovers the second, and it is written on EVERY path that decides — including the "list is non-empty, step aside" one, which is the upgrade path: an install that predates the marker arrives with folders and no marker, so skipping without recording would leave the hole open for exactly the installs that have been running longest. It is written BEFORE the insert loop — a pass that found no project still counts as run, or the first session written afterwards would seed the list. The sync's input is every session file under~/.omp/agent/sessions, and a session's cwd is whatever directory omp was spawned in, so without the gate each scratch directory that appeared after the user had curated their sidebar became a new folder on the next boot. Measured on the author's install: 556 session files carrying 43 distinct cwds, 33 of them scratch (/tmp/omp-*,/var/folders/.../T/opencode/*,$HOMEitself), against a sidebar of 3 — and 88 folders already deleted, 13 of them in a single minute. The delete path is why it could not self-correct: it only tombstones the paths it saw (deleted_workspaces), so the next scratch cwd is a fresh insert, not a resurrection. Verified end to end on real boots against database copies: a curated 3-folder one stayed at 3 with no banner line, an emptied one seeded from discovery, one already carrying the marker stayed at 0 with the list empty, and a pre-marker 3-folder database recorded the marker on its first boot and then stayed at 0 after its folders were deleted.workspace-sync.test.tspins both gates and both directions — a non-empty list is never appended to, an empty one is seeded, an emptied one is not refilled, a no-project pass still spends the one run, and a pre-marker database records it. -
The New Workspace dialog is two tabs, and both of them write a row into that list (
src/client/components/layout/session-sidebar/new-workspace-modal/, reached from the toolbar'sFolderPluson both layouts). Create registers a directory that already exists; Clone fetches a repository and registers it in one step. Two tabs rather than one column of controls because the two flows ask for different things and neither is a variation of the other: Create needs a name and a listing to pick from, Clone needs a URL and a parent and produces its own name. The modal owns the ONE value both tabs share — the directory being browsed — so a folder entered in Create is the parent Clone shows; a second path state per tab is two fields that can disagree about where the user is. -
The listing is read from
/api/fs/browse, through one shared module (src/shared/lib/fs/browse.ts, also used byFolderPicker, whichBrowse…still opens for deep navigation). Clicking a row ENTERS that folder and moves the path field with it: the dialog has no second destination, so a row can only mean "go there" and the path it sets is what a submit reads. ⟳ Refresh re-reads the current directory; 📁+ New folder opens an inline name field. The new folder is created, NOT selected — the listing is refreshed and the user picks it — because "make a folder" and "use this folder" are two decisions. A refusal (name taken, slashes in the name, missing parent) is reported inline and leaves the field open, since a refusal that closed it would read as success. -
mkdirandcloneare their own routes, NOT/api/fs/action'screate(src/server/routes/folders/{mkdir,clone}.ts). That route scopes throughresolveRoot, which only accepts the app root, a path beneath it, or a registeredproject_path— and the whole point of this dialog is to name a directory that is NOT registered yet (~/projects). A request for one would fall back to the app root and create the folder in the wrong place. So both routes validate an absolute existing parent themselves, and the folder name must be one path segment (isSinglePathSegment), which is what provesjoin(parent, name)cannot resolve outside the parent. -
Clone checks the name collision BEFORE it clones, and removes the partial tree on failure. A rejected workspace that already cost a full download is a failure the user can only undo by hand; and
git clonecreates the destination before it knows the fetch will work, so a failure leaves a partial directory in the user's projects. The workspace row is written from the RESOLVED destination — a name derived from the URL after the clone picked its own path is exactly how the row and the directory drift.gitruns as argv withGIT_TERMINAL_PROMPT=0(runGit,lib/fs/git-run.ts), because a private repository would otherwise block on a credential prompt with no terminal to answer it and the URL is user input. -
Both creation paths share one insert (
registerWorkspaceFolder,src/server/lib/workspace/register-folder.server.ts, used byfolders/create.tsandfolders/clone.ts): case-insensitive name guard, tombstone clear by CANONICAL key (adeleted_workspacesrow for the same directory would otherwise make the new folder vanish on the next boot), the skill-discovery watcher sync, and thesidebar-structuresignal.isGitUrl/repoSluglive in@/shared/lib/git/urlso the Clone button's enabled state and the route's refusal read the same predicate — a per-caller copy is what lets the button enable on a string the server then rejects. Both routes refuse underMOCK=true. -
Batch delete is TWO modes, not one, because the noun differs (
src/client/hooks/workspace/batch-selection.ts+src/client/components/common/batch-selection/). The checkboxes do not exist until the user asks for them —modeisnulland every row is an ordinary row — because a sidebar that draws a checkbox on every row turns every click into a choice between selecting and opening.workspacemode starts from the top toolbar'sSelect workspaces(aSIDEBAR_TOOLBAR_PRIORITYentry, so a narrow sidebar moves it into the⋯menu) and deletes workspace REGISTRATIONS — the same semantics as the folder's ownDelete Workspace, tombstone included, so the sync cannot re-add it; transcript files are untouched.sessionmode starts from ONE workspace's⋯→Select sessionsand is SCOPED to that workspace's rows (scopeFolderId): its header checkbox selects the rows it offers, other folders stay ordinary lists, and "select all" is therefore unambiguous. A row in select mode toggles the selection instead of opening the session and loses its⋯action trigger, its roster chevron and its context menu — an action beside a checkbox is a second thing the click could mean. The header checkbox is tri-state (indeterminateis a DOM PROPERTY, assigned through a ref inSelectionCheckbox— no attribute equivalent), computed byselectionSummaryover the rows the ARCHIVE FILTER currently offers, so "select all" can never select a row the user cannot see or unselect. The session mode expands every folder; the workspace mode deliberately does not — it selects folders, not rows, and expanding three trees to pick a folder is motion for nothing. Select-all and unselect-all are two buttons, not one toggle: after a partial selection the user needs both directions and one alternating control cannot say which it means. The count and the payload are the LIVE selection (liveSelection), not the raw array: a selection is deliberately never pruned as the list changes — a row can vanish for one render (a folder collapsing under a filter, a push mid-refresh) and an effect that dropped it would discard a real choice — but an id that is gone from the scope must not be counted or sent. Measured with two tabs open: one deleted a session, and the other's bar went on reading1 of 0 sessions selectedwith Delete enabled for an id that existed nowhere. A session selection also lifts the list's pagination window (selectVisibleSessionsis bypassed whilesessionCheckboxes): "select all" counts what the folder offers, and a window would tick rows with no checkbox on screen and no way to untick them — the reveal controls are hidden in that mode for the same reason. Delete is refused with nothing selected, then opensBatchDeleteModal, which names what actually disappears per mode and lists per-id refusals after the run — the bar's Delete never deletes on its own, and a refusal leaves the mode and its selection standing so the surviving rows can be retried.tests/e2e/specs/batch-delete.e2e.tsis the assembled proof (no checkbox before the mode, both entry points, a header checkbox that selects exactly its scope, a real delete that removes exactly the counted rows), and it taught two things a unit test cannot: the desktop folder trigger had noaria-labelat all (titleonly), and a⋯menu row built as a<div onClick>is not a button to assistive tech or togetByRole— both now carry the role their job implies. -
Both batch verbs are ONE request each, and they share the single-delete sequence (
sessions/batch-delete.ts,folders/batch-delete.ts). A client loop would pay N round trips and republish the sidebar N times; the server answers{removed, refused[]}so the dialog reports counts and reasons instead of reassembling N answers. Session removal moved intoremoveSession(lib/omp/session/delete-flow.server.ts) precisely so the batch cannot drift fromDELETE /api/sessions/:sessionId: pendingnew-…refusal,isSinglePathSegment, the busy-child 409,destroyAndWait, thenpurgeBtwForSession→purgeSessionData— in that order. A refusal is a VERDICT, never an abort: a batch holding one mid-run session still deletes the rest. The staticbatch-deletesegment is registered BEFORE the:idroutes (an id route winning the match would turn every batch into a 405).sidebar-toolbar.tsgained theselectcontrol, soSIDEBAR_TOOLBAR_PRIORITYstill decides what survives a narrow row. -
Top Navbar: active session title plus view controls — switch to mobile view, toggle the editor panel, and toggle the right panel (
src/client/components/layout/desktop-layout/TopNavbar.tsx). -
Both headers draw ONE control cluster, in one order (
src/client/components/common/header-controls/,HeaderControls). The two navbars are separate components — a phone's title area and a desktop titlebar have nothing in common — so the ORDER was written twice and drifted: the phone drew reload → context → sign out → panel while the desktop drew plugin slots → install → reload → sign out → editor → context → panel, and a user switching layouts had to re-find every control. The order is now stated once, in the component: install → plugin header slots → reload → context → lock (sign out) → editor → right panel, with each layout passing only what it has (install and the editor toggle are desktop-only; the right panel is an open-the-drawer button on the phone). The dev-only layout switch sits AFTER that list, so it cannot push a product control out of the agreed order.PWAInstallButtonandHeaderPanelButtonsmoved out ofdesktop-layout/with it, andwithChord(the keymap-derived tooltip suffix) moved tosrc/client/lib/ui/with-chord.tsbecause both headers label the same toggles. PluginheaderPanelentries render on both layouts now — the slot was documented as desktop-only, and a phone that dropped it was one more control that moved when the layout changed. Only the dropdown's geometry is per-layout: anchored under its trigger on the desktop, pinned to the viewport on the phone, which has no room for a 320px panel hanging off a control near the right edge.header-controls/index.test.tsxasserts the RENDERED sequence for both layouts (a table in a module would pass while a call site rendered something else), with install made visible through a realbeforeinstallpromptand sign-out through the auth store primed the way the bootstrap primes it. The cluster carriestitlebar-no-dragITSELF, and it draws the page-owned caption buttons on BOTH layouts — two bugs with one root cause: a shell fact stated at one call site.app-regionINHERITS (WebView2's own spec says so, and Chromium 152 began enforcing it), so a header markedapp-region: dragmakes every descendant a drag handle unless something below it says otherwise — and a drag handle swallows the click, silently. The desktop navbar wrapped this cluster in atitlebar-no-dragdiv and the PHONE's header did not, so on Windows every control in a phone-width window (reload, context, sign out, the right panel,⋯) looked right and did nothing. The marker now sits on the cluster's own root, so the next layout that draws it is correct by construction. The same reasoning movesWindowControlshere from the desktop navbar: a desktop shell window may be NARROWER thanApp's 768px breakpoint (all three shells allow a 720px window), so a Windows/Linux window resized down switches to the phone layout — and the phone drew no close / minimise / maximise at all, with no native title bar behind them to fall back on. macOS never reaches that branch (drawsWindowControlsis false: its traffic lights are the system's).shell-chrome.test.tsxpins the rendered tree for both layouts — the cluster's class, the three buttons on the phone and at the shell's 720px minimum, their absence on macOS and in a browser, and a real click reachingwindow_closefrom the phone layout — because both bugs were a CALL SITE's omission, which a test reading the component would have passed. A plugin header entry can be an ACTION (opensPanel), and a phone too narrow for it folds it into⋯.app.headerPanel({ opensPanel: 'rightPanel' | 'panel' })names a SLOT, never a column: the host resolves it to that panel's instance key (plugin:<id>:<slot>) and dispatchesomp:open-panel, and EACH LAYOUT opens it where the USER placed it — the desktop resolves the column from the dock state (useOpenPanelRequest, so the left dock, the right column and the editor column all work and a user who moved the panel did not break the readout), and the phone resolves the DRAWER fromphoneDrawerForPanel(a panel placed on the left with the rail on is the left drawer; the same placement with the rail off stays in the right drawer, becausephoneRightPanelskeeps it there — the left drawer draws no strip then; aneditor-slot takeover has no drawer at all and the click does nothing rather than opening a screen that cannot show it). The phone's two tab slots are read throughuseSharedSessionState, not the privateuseSessionState: the click writes the tab and the drawer MOUNTS on that screen change, so a private copy would open on the view it read at mount.opensPanelcannot be combined withdropdown(one click opens one thing) and naming a panel the bundle never registered is refused at registration. The fold is measured, not guessed: a 73pxCPU 18% / RAM 2.5Greadout in a 390px row cut the session title to 48px of its 74px, soMOBILE_HEADER_ACTION_PX(430) is exactly the width where the title keeps all of it — below that an ACTION entry moves into the⋯menu as the same action (requestOpenPanel), while a dropdown (needs its trigger's anchor) or a static readout (has no action) never folds. A plugin owns its trigger's markup, so the phone caps one entry atMOBILE_HEADER_ENTRY_MAX_PX(96) rather than letting one readout take the row. The split is resolved ONCE per header (useHeaderEntries) because two surfaces draw it — the row and the menu — and asking twice would be two media queries deciding one row. Every header that can be the window's top strip is a title bar, and the phone's headers were not. A desktop shell window may be narrower thanApp's 768px layout breakpoint (macOS, Windows and Linux all allow a 720px window), so a narrowed shell window renders the PHONE layout — whose headers carried neitherdata-drag-regionnor the shell's own left inset. On macOS that left the main screen with no draggable strip at all, and the drawer headers' wordmarks and hamburgers sat UNDER the 76px of traffic lights, becausetitlebarPaddingLeftreadsenv(titlebar-area-x), which a native WKWebView never defines; the shell's width has to come fromtitlebarInsetLeft. The right drawer was worse: it had no drag region at all, so it was a screen with nothing to move the window by. Adding the attribute to a header is only half the change —app-regionINHERITS, so the controls inside must carrytitlebar-no-dragor they become drag handles that swallow their own clicks on Windows.titlebar-css.test.tsnow lists all five title-bar headers (both desktop ones and the three phone ones) instead of the desktop pair, which is exactly how the gap shipped. -
The PWA window-control inset is stated ONCE, in
src/shared/lib/ui/titlebar.ts, because four headers draw it and the formula was wrong on macOS. Withdisplay_override: ["window-controls-overlay"]thetitlebar-area-*env variables describe the area the page may use — it runs from the frame edge to the innermost edge of the overlay housing the window controls — so the LEFT inset istitlebar-area-xand the RIGHT inset is what is left over AFTER the area ends:100vw - titlebar-area-x - titlebar-area-width. The headers computed the right inset as100vw - titlebar-area-width, which is the same number only whenxis 0 (Windows/Linux, controls on the right). On macOS the traffic lights are on the LEFT (x ≈ 76px), so that form charged their width to the wrong edge: a measured 76px dead strip between the last navbar control and the window's right edge, which is the reported "kenapa ada jarak".titlebarPaddingLeft/titlebarPaddingRighttake the base padding (and, on the phone, the notch insets) and every header uses them — the desktop navbar, the sidebar title, the phone header, the phone sessions drawer, the phone right drawer, the editor header and the full-screen diff — so a header added later cannot restate the arithmetic.titlebar.test.tssubstitutes real macOS/Windows/tab geometries into the returned declarations and evaluates them (16 / 138 / 16 on the right, 76 / 16 / 16 on the left) rather than asserting the string, andshell.e2e.tsmeasures the last navbar control's gap to the window edge in a real browser; both fail with the old formula restored. -
The context-usage ring is ONE component on both headers, and it is a gauge, not a dot (
src/client/components/common/context-usage-button/,ContextUsageButton). The phone had this control from the start and the desktop navbar did not, so the only way to see how close a run was to its model's window on a desktop was to open the Context panel in the right column. The ring fills CLOCKWISE withcontextPercent, and the rotation is the SVGtransformattribute (rotate(-90 9 9)) rather than a Tailwind-rotate-90: a CSS transform on an SVG child resolves its origin againsttransform-box, whose default differs between engines, and can pivot the arc around the viewBox corner. The stroke attributes are written KEBAB-CASE (stroke-dasharray) because Preact assigns a prop whose name exists as a DOM property and otherwise callssetAttribute— camelCase produced astrokeDasharrayattribute no renderer reads (happy-dom exposed it; a test assertinggetAttributecaught it). The bands are one table (CONTEXT_BAND_TONES+contextUsageBand,src/shared/lib/chat/context/usage.ts): under 50%success, 50–59.9%warning, 60% and uperror, boundaries belonging to the worse band. Red begins well before omp's typical compaction point —compaction.thresholdPercentships an 80% preset labelled "Typical threshold" — so the ring warns while there is still room to act. Verified in the browser on both layouts: 12/42% →text-success, 50/55% →text-warning, 60/72% →text-error, with the arc's computedstrokeresolving to the band's colour. The source isuseSessionContextTelemetry(src/client/hooks/chat/context/telemetry.ts): thesession:<id>:telemetrytopic first (so the ring moves during a run, on the same pushes the Context panel gets) with the HTTP route as the fallback for MOCK mode and in-memory sessions. The popover is the same markup on both layouts — pinned to the phone's header geometry, anchored under the trigger on the desktop — and a session with no turn saysSession not startedinstead of printing zeros as if they were measurements. Pinned bycontext-usage-button/index.test.tsx(through a real realtime server) andusage.test.ts(the band table and the ring geometry). -
Chat Timeline (center): the streaming agent conversation — thinking accordions, tool-call cards, rendered mermaid diagrams (click one to open the zoom/pan viewer in
src/client/components/common/diagram-viewer/), queue panel, and the composer (src/client/components/workspace/chat-timeline/). -
The composer's three Enter bindings are SETTINGS, and they live in the
kabmo_settingsblob (resolveComposerKeybindings,src/shared/lib/chat/composer/keybindings.ts). Settings → Chats → Keybindings persistskeybindingSend/keybindingNewLine/keybindingSteeringthroughwriteKabmoSettings, so they nest underkabmo_settings— NOT at the top level ofappSettings, which is the rawapp_settingsrow map. The handler used to read each one asappSettings?.keybindingSend, found nothing, and fell back to its default, so the panel showed a choice the composer ignored: measured in the browser, with "send" set to Ctrl+Enter a bare Enter still cleared the draft and started a turn.readKabmoSettingresolves the blob and top-level keys alike (the same helper the composer already used forgoalDefaultBudget), and the file's own defaults mirror the settings editor's so an unset key reads as the binding the panel renders. Resolution happens per KEYPRESS, not per render, which is what makes a binding changed in Settings apply to the very next Enter with no event and no reload — the composer has nothing to re-render for the next keydown to observe it.keybindings.test.tspins the blob as the source (including that the blob beats a stale top-level copy), and the defaults. -
The composer stretches from a control at the trailing edge of its top row, and "bigger" means two different things per layout (
chat-input/expansion.tsis the decision table; the button isMaximize composer/Restore composerinAttachmentToolbar). A phone takes the whole viewport — the card becomesfixed inset-0 z-40, so every dialog stays above it (extension/askz-50, goal and undoz-[60], plan reviewz-[70], toastsz-[200]; a stretched composer over a blocking dialog would make the agent's question unanswerable) and the soft keyboard is lifted by the card's OWN overlap with the visible area (useKeyboardInset(cardRef, expandable && expanded)— measured 336px of an 844px viewport with a stubbedvisualViewport, which put the Send button's bottom at 500 against a visible bottom of 508). A desktop grows IN PLACE —min-h-[38vh]on the textarea (measured 342px at a 900px viewport) with the card still in the dock at its panel width, because a full-screen composer there would hide the transcript the prompt is written against. Three rules are load-bearing and each was a bug first. The card's POSITION is a field of its own, never a class in the base list: Tailwind orders its position utilitiesstatic, fixed, absolute, relative, sticky, so arelativein the base string WINS over afixedadded later whatever the order they are written in — measured, the phone card reportedposition: relativewithfixed inset-0 z-40sitting on it and stayed in the dock, which a unit test on the returned class cannot see (only a browser resolves which class wins). The popup flips over the draft on a stretched phone (ComposerPickerPlacement:upis the dockedbottom-full mb-1,overistop-2inside the textarea's own wrapper, whichComposerTextarea.wrapperClassNamemakes the flex member that owns the leftover height) — a full-height composer's top edge IS the screen's, so an upward list is drawn off the viewport with nothing to scroll back. A DISPATCHED send collapses the stretch on BOTH layouts, and Escape collapses either (a documentkeydownlistener, so it works with the popup closed; with the popup OPEN the picker eats the first Escape and the second collapses). The collapse is driven by the send pipeline'sonSent(useComposerPipeline), never by the click handler: it wasif (isMobile) setExpanded(false)inhandleSubmit, so a desktop kept a 38vh box over the conversation the prompt was written against, and on either layout a press that dispatched NOTHING (an empty draft, an attachment whose read produced no body) collapsed a box whose content had not been sent — a refusal that read as success.onSentruns after every guard and immediately beforeonSend, so the button, Enter, Cmd+Enter steering and a queued follow-up all collapse it and a refused send does not. The control is spelledMaximize, notExpand, becausechat.e2e.tscollects every[aria-label^="Expand "]and requires each to name a TOOL — a second control spelled that way read as a tool card titledcomposer.expandablegates it: the chat composer and the pending-session composer have it, the New Chat modal (which maximizes its own card) and the BTW form (sized by the panel it sits in) do not. Pinned byexpansion.test.tsand, for the class-order trap a unit test cannot see,tests/e2e/specs/composer-stretch.e2e.tsplus the stretch spec inmobile.e2e.ts. -
The chat's content width is ONE variable and ONE class, chosen by
data-chat-widthon<html>— and the composer follows the transcript.compact720px /wide970px /full100% of the chat PANEL, all three in the--chat-column-maxtable insrc/client/tailwind.css;chat-column(width 100% + that max +margin-inline: auto) is what every column element carries. Before this the number was written out EIGHT times asmax-w-[970px]—TimelineBody,ComposerDock, bothSessionSkeletoncolumns, bothSubagentViewcolumns andEmptyWorkspacePrompt's two — which is eight chances for a mode to half-apply, and a grep for the literal is the check that it did not. The mode is not a layout: unlikeeditorViewMode(whosecompact/fullHIDE the chat), no width mode hides a panel or moves a control, so the two must not share a name.fullwidens the composer too, deliberately: the composer is a card in the same transcript (expansion.tssays so), and a "full" mode that stopped the input at 970 while the answer ran to 1400 would be a silent substitution — the cost isComposerToolbar'sjustify-betweenstretching on an ultrawide, which is a toolbar problem to fix there, never by narrowing the card. The default is REMOVED from the attribute rather than written, so:rootis the single statement of 970 and a document that never chose a mode is byte-identical to one that chosewide; the override selectors are:root[data-chat-width="…"]because a bare[data-chat-width]ties with:rooton specificity and would win or lose on source order. The mode is GLOBAL (kabmo_settings.chatWidthMode), not per-session: a line length is a property of the person and the display, and a per-session value would reset every new chat. Applied at boot byinitChatWidthMode()inmain.tsx(right afterprimeKabmoSettings, so no frame at the wrong width) and on change from the settings modal, whoseChats › Chat Widthcontrol draws the three widths as bars. A phone is narrower than the smallest column, so all three modes render identically there and the control says so in words. Verified in a browser: at 1920 the transcript and the composer both measured 720 / 970 / 1048 withdocOverflow0, and a click on Compact survived a reload asdata-chat-width="compact"at 720px. -
The composer's style is ONE table of ROW ORDER, and a style can never drop a control.
Chats › Composerpicksclassic|calm|console|stage|glass(shared/lib/chat/composer/style.ts, persisted ascomposerStylein thekabmo_settingsblob, announced byomp:composer-style-changed). Every style renders the same five rows — attachments, notice, draft, voice, toolbar — and the table names their ORDER, never their presence;chat-input/ComposerRows.tsxbuilds all five unconditionally andComposerFrameloops overrows. That is deliberate: the access-mode selector is a safety contract, so a style able to omit it would be a style able to send a write-capable turn from a card that said "read-only".calmandconsolemove the draft above the attachment row;consoleadds a mono rail and anomp ›glyph;stagediffers only while the chat is EMPTY (hero), where the draft floor goes 68/80px → 132px. The style's pixels are plain CSS, not Tailwind classes, keyed bydata-composer-style/data-composer-heroon the card (tailwind.css,.composer-draft/.composer-attach-row/.composer-toolbar-row): measured in a browser,rounded-mdwritten beside the expansion frame'srounded-xlrendered 12px, because Tailwind resolves two utilities of one property by the order it EMITTED the rules, not by the order they appear inclassName— the same trapcardPositionClassalready exists for. Verified in a browser at 1440×900 and 390×844: all four styles drew the paperclip, the stretch control, Plan, Goal, the access selector, the model and thinking pickers, voice and Send; the stretched phone card stayedfixed inset-0 z-40390×844 in every style; a click on Console in the settings card re-attributed the live composer toconsolewith a 6px radius without a reload, and the choice survived one.glassis a SURFACE, not an order —classic's rows, a frosted frame — and it is the only style that leaves the paper identity (DESIGN.md§4): 58% of--theme-paperwithbackdrop-filter: blur(16px) saturate(1.15)and an ink-only sheen, still token-based, still NO chroma (the source render's coloured glow was dropped; chroma is reserved for--theme-error), plus an opaque fallback under@supports not (backdrop-filter). Its blur has a subject only when the phone STRETCHES the card over the transcript; docked it reads as frosted paper and the code says so. A style's radius is plain CSS and therefore beat the expansion frame'srounded-none— measured: a stretchedglasscard kept 20px over afixed inset-0surface (andconsolekept 6px the same way), showing the canvas at the corners. The card now carriesdata-composer-expanded, and ONE rule after every style setsborder-radius: 0for it; re-measured: all five styles docked at 12/16/6/12/20px, all five stretched at 0px. -
A turn is steered, never cancelled, and the binding governs which key does it. Ctrl/Cmd+Enter (or whichever
keybindingSteeringnames) submits throughsteerOmpAgent→OmpAgentHandle.steerOmpRun→POST /api/agent/:id {type:'steer'}, which delivers INTO the running turn (omp answers oneagent_start/agent_endpair;abort_and_promptproduces two and throws the watched answer away). Verified against the real spawn path with the scripted child: the frame reaching the child is{"type":"steer","message":"…"}, a steer while the session is idle is refused400 session_idle, andfollowUpBehavior: 'steering'makes even a plain mid-run Enter steer instead of queueing. -
A running subagent is steerable and stoppable, from the roster and from its transcript.
cancel_subagent/steer_subagentare omp RPC verbs that act on ONE subagent without touching the parent turn, wired throughsessions/subagent-control.ts(POST-only, id validated against the same grammar the transcript path derivation uses) and thePASSTHROUGH_COMMANDSset. The id is the ROSTER id the session file andget_subagentsboth report — measured on 18.8.3 it is a slug (Sleeper,ListOmpws), NOT a uuid, and thesubagent_progressframe carries noidat all, so the roster is the only source. Both routes answer409 session_not_runningfor a session this process does not manage, because a subagent is by definition something the session's own child runs — the spawn path must never boot a child to answer "stop that". The UI isSubagentControls(a steer box plus a stop button, rendered in place of the transcript's composer ONLY while the subagent runs) and a stop button on each roster row, which is a SIBLING of the row's own button rather than nested inside it (a button in a button is invalid and swallows the inner click). -
The subagent transcript renders the chat's own footer, in whichever variant the chat is in.
SubagentViewpassesisMobiledown toRunFooter, so a phone gets the same compact row the main agent gets — provider • model • thinking inline, everything else (date, duration, tokens) behind the three-dot sheet — instead of the desktop row it used to draw.showActions={false}(anduserActions={false}on its message rows) is the same rule the BTW panel follows: Retry / New-chat / Undo act on the CHAT, and this view owns no chat turn, so they would be dead buttons. The thinking level must come from the CHILD, never the parent session — a subagent routinely runs at a different level than the chat that spawned it. Two sources, because the two paths carry different data: a live child reportsprogress.resolvedThinkingLevel(omp'sAgentProgress;parseSubagentProgressreads it), while an on-disk transcript records it as athinking_level_changeentry thatconvertMessageswalks and stamps onto each non-user row (mirrors the server'sloadSessionMessages). Note the frame shape:subagent_progressnests theAgentProgressunderpayload.progressand puts noidon the wrapper, soreadSubagentProgressFrameunwraps it — reading the wrapper alone silently dropped every field the frame reports, including the resolved model. That reader is shared by the roster, the transcript hook and the server's liveness fold. -
Editor Panel: opened-file tabs and code editing (
src/client/components/workspace/editor/). -
Both editors draw the same type, from one module (
src/shared/lib/code/editor/typography.ts). The desktop editor and the phone's full-screen editor are the same surface on two layouts, so face and line box are shared while padding and gutter width stay per-layout. They were not: the stack was written out as a literal twice in the desktop editor and replaced by a baremonospaceon the phone, which dropped Fira Code and put the phone's line numbers in a different face from the code beside them — the gutter was alreadyfont-mono. Two further drifts went with it: the phone used a pxline-height(20px) that does not scale with the zoom control, so at 18px the rows were cramped and at 10px loose, and it pinned the gutter totext-[10px]and a fixedw-10while the code scaled, clipping a 3-digit line number at the top of the range. The line box is a ratio (EDITOR_LINE_HEIGHT) applied to the editor and its gutter — with word wrap off the gutter rows carry no explicit height and take their spacing from their own line-height, so a gutter pinned to a different value drifts out of register with the lines it counts. The zoom bounds are shared too (8–24px), because a phone clamped to a narrower range is a different editor, not a smaller one. Verified in the browser on the CodeMirror surface: at 12px both layouts measureFira Code / 12px / 18pxon.cm-content,.cm-line,.cm-guttersand a gutter element, and zooming to 18px moves all four to18px / 27px; the clamp stops at 8 and 24 on both. The type is INHERITED by the editor rather than restated in a CM6 theme: the host element carries family, size and line box, and.cm-editorinherits — a theme extension carrying a pixel size would have to be reconfigured on every zoom step, and a reconfigure re-creates the editor's plugins (including the tokenizer). -
The editor surface IS CodeMirror 6, and Shiki stayed the tokenizer.
code-surface/(index.tsx+extensions.ts,handle.ts,shiki.ts,keymap.ts,theme.ts,documents.ts,marks.ts,fold.ts,bracket-guide.ts,stream-language.ts) replaced a transparent<textarea>over a Shiki-highlighted<pre>plus Kabmo's own windowing, wrap measurement, undo stack, multi-cursor replication, find matcher and gutter geometry — measured on a 4 800-line file, one keystroke cost 59.6 ms median before and 0.2 ms after, flat from 8 000 to 20 000 lines (the surface renders ~54.cm-linenodes at 20 000). The palette is not CM6's: a lezer grammar build would cover 48 of the 59 idsshiki-langsknows and paint a second palette, while the chat timeline, diff panel, wiki reader and markdown preview all render throughhighlightCode— so aViewPlugintokenizesview.viewport(+40 context lines, 12 000-char line bail-out) and emitsDecoration.markcarrying Shiki's--shiki-light/--shiki-darkpair, which makes a theme switch CSS-only.CodeSurfaceHandleis unchanged, which is what kept the find widget, outline jump, line jump and search reveal working without knowing about CM6. Three facts in that stack are load-bearing and each was a bug first. The per-tabEditorStatecache (documents.ts, applied withview.setState) is what gives a tab its own caret and UNDO HISTORY — a single buffer meant ⌘Z after a tab switch undid an edit in the file the user was no longer looking at — and it is LRU-bounded at 12, because a history holds whole-document snapshots.languageDatamust return an object KEYED by the data name:languageDataAtlooks the name up in each provider's result, so returning the tokens bare (() => [{ line: '//' }]) yields an empty list,toggleCommentreturnsfalse, and ⌘/ silently does nothing — measured in TypeScript and YAML with no error anywhere. CM6'sdefaultKeymapis appended after the generated bindings: it is what makes Enter, Backspace, arrows, Home/End and word-wise movement work at all, and appending it is what keeps a chord the table claims from being shadowed. Read-only is BOTH facets (readOnlystops the commands,editable(false)stops typing); a viewer takes both.applyDocumentmust NOT be silenced as an external write: thewritingRefguard exists so a write that came FROM the parent does not echo back throughonValueChange, and a find-bar replace is a USER edit — suppressing it left the parent holding the pre-replace buffer, so the autosave never saw the change and the next render compared the stalevalueagainst the document and wrote the OLD text back (measured: replace-all, switch tab, come back → the original text, and nothing on disk). -
The editor reads three config formats, bands conflict markers, and says when it is empty — all three are viewport work, not document work.
code-surface/lint.ts+lint-parsers.tsinstalllinter()+lintGutter()forjson/yaml/tomlonly, and the parsers arrive through literalimport()(yaml32.3 KB gzip,jsonc-parser6.8,smol-toml6.9 — 46 KB the README tab must not pay, the same tradestream-modes.tsrecords); JSON is parsed STRICT (disallowComments), because a lint that blesses a comment intsconfigaccuses nothing and the toolchain refuses the file, andjson5is excluded outright since it accepts what JSON rejects. Two diagnostics at one offset are collapsed to one — measured: a trailing comma is reported as bothPropertyNameExpectedandValueExpectedat the same character.code-surface/conflict-markers.tsbands<<<<<<<,|||||||and>>>>>>>withDecoration.line, deliberately NOT=======(a Markdown setext underline and this repository's own comment headers would paint a conflict band in unconflicted files), and the walk is the viewport loopindent-guide.tsuses rather thanMatchDecorator— measured in a real browser, aDecoration.linereturned fromMatchDecorator's callback is placed over the MATCHED RANGE and rendered the marker lines as blank<br>rows while the document still held their text. Both editor status strips print⚠ N conflictsfromcountConflicts, which counts a marker only at a line start ("a <<<<<<< b"is a string literal, not a conflict). An empty buffer drawsplaceholder()(This file is empty), andEditorView.exceptionSinkreports a throwing plugin throughreportEditorError(src/client/lib/editor-errors.ts, deduped per message over 5 s) into a toast — subscribed fromuseToasts, which every toast host already calls, so no shell can forget it; the event is CLAIMED by the first listener because several hosts are mounted at once and one report produced three toasts before that. -
A stream language makes bracket matching token-aware, and the pair GUIDE draws the span the highlight cannot.
stream-modes.tsmaps 48 of the 59 Shiki ids to a@codemirror/legacy-modesmode, loaded lazily through literalimport()specifiers and installed into a per-documentlanguageCompartment. Lezer grammars were measured and rejected:javascriptLanguagealone is +39 KB gzip, the wholelang-*set covers 24 of 59 languages for +439 KB, and — the decisive fact — a lezer tree is LAZY, so bracket matching is WRONG until the parse catches up (3 wrong pairs at mount on a 176-line file, and 2 still wrong on a 337-line one after a full parse,Toolbar.tsx:97). A stream mode is ~1 KB, and its tree exists synchronously: the same 176-line file is 0 wrong pairs at mount. The loader must be a literal specifier, oneimport()per entry — a template literal (import(\…/mode/${name}`)) builds fine and then NEVER resolves at runtime in the dev server, which rewrites it tohmr.dynamicImport('@codemirror/legacy-modes/mode/${ref.module}')with the placeholder unsubstituted. Measured in the browser: the mode silently failed to load, the surface stayed textual, and no console error was logged. The pattern is the repo's ownLANG_LOADERS. **STREAM_MODE_EXPORTSis a second table because the export name is not derivable from the Shiki id** —scssissCSS,objective-cisobjectiveC,dockerfileisdockerFile, andjavascript/clike/sqleach ship several modes from one module. **The compartment is installed BEFORE the manuallanguageDatatable**, becauselanguageDataAtreturns every provider's answer in order and the commands take the FIRST: measured, a wrong manual##entry won and commented a Rust line until the mode went first. **bracket-guide.tsdraws the vertical rule from the caret's brace to its pair** (Decoration.lineper row,--bracket-guide-colcarrying the column of the pair's LEFTMOST brace — one straight line cannot meet two braces in different columns, andconst v = merge(base, {opens at 30 while its closer sits at 0, so taking the minimum is what makes the rule land on a brace rather than float above nothing. The column iscountColumncells, not code units, because CM6 writestab-size: state.tabSizeon.cm-content; and the CSS offset adds--surface-padback, because an absolutely-positioned::beforeresolves against the line's PADDING box while the glyph starts inside it — measured before that fix: the rule sat 16px left of the brace it named). Blank lines get no guide (the gap is the signal), a one-line pair gets none (nothing to connect), and a span pastMAX_GUIDE_LINES(400) is refused rather than drawn. It reads the samematchBracketscallbracketMatching()makes, so the line and the highlight cannot disagree. Verified in Chromium: on a 16-line nested file the guide covers 11 rows at column 37 with--theme-infoat 45%, and with the stringconst s = "}";inside the block the guide runs PAST it to the real closing brace; a caret placed exactly on that string brace paints **no** highlight and **no** guide, which is the token-aware answer the textual matcher cannot give. Pinned bybracket-guide.test.ts(the pair, the columns, the blank-line and cap rules, every mode loader resolving to a real mode object, and the two language sets covering all 59 ids) andstream-language.test.ts` (the compartment keeps the document and the undo history, and the mode's tokens come first). -
Folding and bracket matching ship WITHOUT a grammar, and that choice is what makes them work in 59 languages instead of 19.
code-surface/fold.tsregisters afoldServicethat answers from INDENTATION (vim'sfoldmethod=indent): a line folds up to the last following line indented deeper than it, blank lines never end a block, and the opener stays visible because the range starts atline.to.foldGutter()— notcodeFolding()— is the entry point, because the gutter brings the fold STATE field with it: afoldEffectdispatched into a state that has nofoldStateis discarded with no error (measured: no placeholder, no throw), which is the failure that would look like a working gutter that does nothing.bracketMatching()is the other half and it is TEXTUAL here, which is a trade stated rather than hidden: with no lezer tree it pairs by scanning, soconst a = "{"andconst c = "}"are paired 28 characters apart. A token-aware answer needs a grammar (115 KB gzip forlang-javascriptalone) andmatchBracketscosts 0.008–0.04 ms per caret move, so the wrong answer is cheap and confined to braces inside strings. The cap on the fold scan is a cost bound, and it REFUSES rather than truncates. The scan walks forward until the indentation dedents, so a generated JSON that is one 500 000-line block would be walked on every gutter line the reader scrolls past — measured 74.6 ms per call unbounded, 0.50 ms withMAX_FOLD_LINES(5 000). Past the cap the answer isnull(no marker, no fold), because a range ending at an arbitrary line is a fold the reader never chose; a block that reaches the END of the document is not capped and still folds. Two theme facts were measured, and each fails silently. The bracket rules must spell the focused form&.cm-focused .cm-matchingBracket— the package's own is.ͼ1.cm-focused .cm-matchingBracket(specificity 0,2,0), so a bare.cm-matchingBrackethere is (0,1,1) and loses, leaving CM6's hardcoded#328c8252in a themed app. Andborder: 1px solid var(--x)is a shorthand style-mod tries to EXPAND and cannot parse — it emitsborder-width: var(--x); border-style: var(--x), which paints nothing — socm-foldPlaceholderdeclaresborderWidth/borderStyle/borderColorseparately. Read-only viewers still fold (verified), folds survive a per-tabsetStateround trip and map through edits, and the four chords are CM6's ownfoldKeymaprows (⌥⌘[/⌥⌘]/Ctrl-Alt-[/Ctrl-Alt-]), added toEDITOR_KEY_BINDINGSandPALETTE_ORDERso the palette cannot advertise a chord nothing binds. Verified in a real Chromium against an isolated MOCK server: the fold gutter renders 4 markers on a 16-line nested file, a click took 17 rendered lines to 5 with the…placeholder, clicking the placeholder restored all 17,⌥⌘[folded and⌥⌘]unfolded (including the“character macOS actually reports for Option+[), and the caret beside a{painted both{and}with the background resolving to--theme-info(rgb(2,132,199)) rather than CM6's hex. Pinned byfold.test.ts(the rule, including the cap and the per-language samples),fold-stack.test.ts(the mounted stack: the state field, CM6'sfoldable()agreeing, a real gutter marker, a read-only fold, and the bracket classes) andtheme.test.ts(the focused-rule specificity and the longhand declarations). -
useFileTabscloses the previous workspace's tabs on a root CHANGE, and on nothing else. The editor column's tab list is per session and restored from the blob, so the wipe exists for exactly one event: the user moved to another workspace, whose files must not stay open. Two other arrivals look like that event and are not, and each cost a measured bug. Anullroot is not a root —activeProjectPathis derived from the sidebar's folder list, which is empty for a beat on every load and again whenever the structure topic re-subscribes, so wiping on it closed the tabs the user had just opened (the reported "the file I clicked vanished and the editor says Select a file to open", and the rareoutline.e2e.tsfailure). The FIRST known root is not a change either — it is the workspace the page was already showing, so wiping on it discarded the tabs the session blob had just restored; that is whyeditor-scroll.e2e.tshad to gate every tree click on the/stateresponse, and why a click that lost that race left the editor blank.file-tabs.test.tspins both directions (a transientnullkeeps the tabs, a different root closes them). -
A blob that arrives after a write made DURING its read must not discard that write.
loadSessionmerges local keys over the response for two separate reasons and needs both:dirtySessionscovers a write whose persist has not landed, while a write whose persist HAS landed clears that flag and would otherwise be adopted away by a response computed before it — measured as a file opened during the page's first/stateread coming back withlayout.openedFilesgone. The store therefore records a monotonic counter per(session, key)write and merges exactly the keys written after the read STARTED; a key the local side no longer holds was CLEARED in that window, so the response's copy is deleted rather than restored.store.test.tspins the three shapes (written, untouched, cleared). -
A dropped file OPENS; it is never inserted into the buffer — and that needed a capture-phase claim, because CodeMirror handles
dropitself.handlers.dropin@codemirror/viewreads each dropped file's TEXT and inserts it at the pointer, then callspreventDefault— so the panel's ownonDropsawdefaultPreventedand stood down. Measured in the browser: droppingb.tson an opena.tsputb.ts's text at the top of the buffer and the debounced autosave wrote it to disk, while the overlay had promised "Drop a file to open it".useEditorDroptherefore also returnscaptureDropProps(onDropCapture), spread on the same element asdropProps; it claims ONLY a drag over[data-code-surface](the attributeCodeSurfacesets on its host), so a drop on the composer stays the composer's and a text drag is still CodeMirror's to insert.use-editor-drop.test.tspins all three directions (claimed on a surface, untouched elsewhere, atext/plaindrag ignored). -
A dropped file opens on a desktop shell too, and there the page has to ASK the shell for the path. Measured on macOS 27 by delivering a real Finder pasteboard into a
WKWebView:types ["Files"],files [File],getData('text/uri-list')andgetData('text/plain')both empty,File.pathundefined, andDataTransferItem.getAsFileSystemHandleundefined. Both ofuseEditorDrop's routes are therefore dead there — WebKit implements no File System Access API (bug 257792), and it stopped adding local filenames as URLs to a file drag (changeset 222257), so/api/fs/scopeis never asked either — and every Finder drop on the macOS shell was refused with "that drop carried no readable file" while the SAME drop attached fine in the composer, which only needs the bytes. That asymmetry is why it read as an editor bug rather than a missing capability.DropWebView(packages/macos/Sources/KabmoDesktop/DroppedPaths.swift) readsNSFilenamesPboardType(falling back topublic.file-url) inperformDragOperationbefore callingsuper, and the page asks for it withdropped_paths(client/lib/desktop/dropped-paths.ts); measured, the injection lands ahead of the DOM event so the handler sees the answer. Three rules are load-bearing.superis still called and its value is the return — the page needs the DOM event to know WHERE the drop landed (editor column, composer, code surface) and the composer attaches from the payload's bytes, so swallowing the drag would fix the editor by breaking the chat. The answer is CONSUMED once (and cleared bydraggingExited): a drag released over no target leaves the record unread, and answering it to the NEXT drop reopens a file the user abandoned. The page age-checks it (SHELL_DROP_TTL_MS, 2s) because it asks in the drop's own turn, so anything older is a leftover. The other two shells do NOT need it and do not implement it — WebKitGTK preloadstext/uri-listfor a file-manager drag, and WebView2 is Chromium where the file-system handle exists — so the bridge read fails there and the drop's own payload decides. Pinned byuse-editor-drop.shell.test.ts(the shell path opens the file, a handle still wins, an in-page drag is still reported, a stale answer is refused) andpackages/macos/TestsWindow/DroppedPathsWindowTests.swift(a real drag into the realDropWebView: the DOM event still arrives with bytes and no URI list, the shell captured the path, the second ask answers nothing, and a drag that leaves clears it). -
The find widget's count and the bytes Replace writes come from ONE regex compiler, and the flags are the reason. The scan runs through CodeMirror's
RegExpCursor, which compiles the pattern source withgm(+u), whilebuildFindRegexused a bareg/gi— so the two ends answered differently on ordinary queries. Measured before the fix:^foocounted 2 matches on a three-line file and Replace All rewrote only the first (nom);\p{L}\dmatched three times and replaced ZERO (withoutua property escape is a literalp);\-was called invalid by the scan while Replace All edited the file with the non-unicode reading.BASE_FLAGS(gm+uwhere the engine has it) is now stated once infind-scan.tsand every path reads it, and a zero-width match is skipped by the write exactly as it is uncounted by the scan (^under "No results" used to insert at every line start).find-replace.test.tsasserts the two ends together rather than one engine in isolation. -
insertLineAbovekeeps the line's indentation. CM6 has no command for it, so the surface implements it — and a bare newline above an indented line left the caret at column 0, putting the next typed character outside the block. The new line carries the current line's own leading whitespace and the caret lands after it, which is the rule the textarea surface applied and what CM6's owninsertBlankLinederives fromIndentContextfor "below".keymap.test.tsdrives it throughrunSurfaceCommand(the palette's own path in) against a{state, dispatch}stand-in. -
Line blame is ONE whole-file read per tab, never one read per hover, and the cache key is the answer.
lib/fs/git-blame.tsrunsgit blame --porcelainonce for the file and the editor answers every line from that payload;blame-panel.tsdraws the card andblame-hover.tsowns the trigger. Measured on this repository: one blamed line costs 10–20 ms warm but 39 ms average over 20 sequential calls — a reader hovers a dozen lines a minute — while the whole file costs 30–110 ms once (34 KB raw for a 336-line file, 10 KB after the parse drops the document text) and 0.4–0.5 s at 20 000 lines.--porcelainreports each commit's metadata a SINGLE time (295 content lines carried 5authorrecords), so the payload is already compressed;--line-porcelainis 3.1× larger for nothing. The key is(absolute path, mtime, HEAD sha)because all three change the answer: an autosave shifts every line number, and a commit the agent makes while the panel is open changes every author.runGit's default 1 MiBmaxBufferwould TRUNCATE the answer silently —--porcelainmeasured 1.7 MB at 20 000 lines — so the read asks for 16 MiB and refuses a file over 8 MiB outright. -
A dirty buffer shows NO labels, and the card says why. An unsaved edit shifts every line number, so a label naming the previous author is not stale, it is WRONG — and the panel's own
isDirtyis the flag that decides it, because the editor's document moves a render before the controller hears about it. The controller therefore refuses to read while dirty, the labels disappear on the first keystroke, and the card answers "Not committed yet / This line changed in the editor" for the gutter instead of naming a person. A re-read that returns the SAME payload object is a cache HIT and cannot describe the edit either, so the label field clears its stale flag on a new IDENTITY, not on any notification. -
The hover target is the label AND the gutter's line number. The label only exists on a run's first line and never for an uncommitted line — precisely the line a reader asks about — so the gutter is the second target: it exists on every rendered line and is what VS Code anchors blame to. The listeners sit on
view.scrollDOM, notcontentDOM, because the gutters are SIBLINGS of the content inside the scroller: a listener on the content never sees a line number (measured — the first version's gutter hover did nothing). -
The answer reaches the labels through a state FIELD fed by a bridge plugin, not by a plugin reading the controller. Replacing a plugin's
decorationsoutside a transaction leaves the DOM showing the previous set — measured in the component test, a fresh payload produced no labels at all until an unrelated transaction ran. Soblame.tssubscribes to the controller and dispatches the payload as an effect, and the field'screatereads the controller directly so a document opened with a cached answer draws on the first paint (a plugin cannot dispatch during the view's construction: CM6 throws "Calls to EditorView.update are not allowed while an update is in progress"). -
log -Lis a SECOND read, asked for only when the reader opens the line's history. It costs 22–78 ms against a blamed line's 10–20 and answers the different question ("who created it" rather than "who touched it last"), so it is not part of the payload —?blameHistory=1&line=Nfetches it on demand and the controller caches it per line. -
The card is mounted on
document.bodywithposition: fixed, so the editor's scroller cannot clip it — and it does not follow the text. A card that moved under a pointer reading it would be worse than one the reader's own scroll dismisses; every close condition lives inblame-hover.ts(Escape, a press outside, a document change, a pointer that left both) because a card that outlived the line it describes is worse than no card. It is adialogto a screen reader and it stopsmousedownfrom reaching the document, which is what makes its text selectable. -
The label is a
Decoration.widget, never aDecoration.mark. A mark is part of the document: the caret can land in it,⌘Ccopies it into a pasted snippet, and a replace-all would rewrite it. Decorations are built for the VIEWPORT plus 40 lines of context, because one widget per run on a 20 000-line file is 2 249 extra DOM nodes laid out on every scroll. -
Six states, and only ONE is an error. A dirty buffer, a line past the end of HEAD, an untracked file and a folder that is not a repository are all ANSWERS ("nobody yet"); painting them red would make an ordinary state look like a failure and teach the reader to distrust the one case that is one.
git's own sentences are what the panel prints (measured:fatal: no such path 'x' in HEADfor an untracked file,fatal: Needed a single revisionfor an unborn HEAD,fatal: not a git repository …outside one). -
Two settings, and the label is OFF by default.
editorBlame(the card and the read) defaults on;editorBlameInlinedefaults off because the label sits at the END of a run's first line and the editor panel's floor is 320px, where it turns a long line into two. Both reach an open editor throughomp:editor-blame-changed, the same shape the font, theme, indent and typing settings use, and the toolbar's toggle writes the same blob key the Settings row does. The extension lives in a COMPARTMENT, so pressing the toggle reconfigures rather than re-mounts — a re-mount would cost the open tab its undo history for a reading aid. -
The phone's editor is
select-text. The full-screen sheet's root isselect-none(it is a header-and-status layout), and the code surface is now acontenteditablewhose selection and caret belong to the browser — an inheriteduser-select: noneis the one thing that can take both away on a device. The desktop pane already carried the class; the phone's surface did not. -
A text file's ceiling is 32 MiB, and it was measured rather than chosen. The old number was 5 MiB and its justification died with the
<textarea>it was written for ("well below the size at which a textarea stops responding"). Re-measured on the assembled app — a generated source file, Files panel open, Chromium: 5 MB opens in 99 ms at 17 ms/keystroke, 10 MB 147/32, 20 MB 212/34, 30 MB 323/39, 40 MB 283/45, 50 MB 372/72 with a 1 078 MB JS heap for ONE tab, and 64 MB never finishes loading. The curve is flat to 40 and breaks at 50, so 32 MiB is the last size with a comfortable margin below the knee.EDITOR_MAX_BYTES_BY_EXTstill overrides per extension and the two document ceilings are INDEPENDENT of it — the text one is now ABOVE the PDF one, which is fine because they answer different questions (a text buffer is held for the life of a tab and re-posted on every save; a PDF is streamed to Chrome's viewer and never buffered) rather than ranking a shared budget. A test that writesEDITOR_MAX_FILE_BYTES + 1and expects the PDF branch must use a PDF-sized number instead: "past text, under PDF" stopped existing.editor.e2e.tsopens a real 6 MB file and saves an edit, so the constant and the route cannot drift. -
Two costs had to come out before that ceiling was reachable, and both were linear-in-file-size work paid PER KEYSTROKE. (1)
syncExternalcompared the parent'svalueagainstdoc.toString()on every render — a full stringify of the document, and the parent re-renders on every keystroke, so a large file paid it twice per character (measured in Bun: 7.2 ms at 20 MB, 13.7 ms at 30 MB). It now compares againstlastValueRef, which the update listener and the function itself keep in step with what the DOCUMENT holds, so the usual case is one reference check; the browser showed the knee moving 67 → 39 ms at 30 MB and 83 → 45 ms at 40 MB. (2) The outline scanned AND rendered every declaration on every keystroke — see the bullet below. -
The outline is bounded twice, because a large file's outline is not a long list, it is a DOM. Measured on a 10 MB source with 63 618 declarations: 446 308 DOM nodes, 415 MB of JS heap, and 953 ms per keystroke while the Files panel was on screen (the editor's own cost is 34 ms), with 2.7 s to expand the section.
shared/lib/code/outline/rows.tsholds both bounds, and each answers a different question.MAX_OUTLINE_ROWS(500) caps the ROWS, with the count badge reading500/63,618and a line under the list naming what is not shown — an outline is a map you scan or jump from, so the window is the TOP of the file in source order, never a sample.MAX_OUTLINE_SCAN_CHARS(8 MiB) skips the SCAN, because it is one blocked stretch of main thread after each typing pause (38 ms at 1 MB, 160 at 5, 262 at 10, 519 at 20) and half a second per pause is not worth a list nobody reads; the panel says the file is too large to outline instead of showing an empty list, which would read as "no declarations here". The scan is also DEBOUNCED (useOutlineView, 300 ms): it walks the whole buffer and the buffer changes on every keystroke, so a live scan charged the walk to typing (704 ms/keystroke at 10 MB live against 34 ms without). A different DOCUMENT scans immediately — rows from the previous file point at lines of a document that is gone — and the timer is not armed at all past the scan ceiling, where the sentence never changes. Verified end to end: 10 MB with 63 618 symbols went from 953 ms/keystroke and 446 308 nodes to 33 ms and 4 495 nodes, and 20 MB from 519 ms of blocked main thread per pause to none. -
A markdown preview turns the outline into a TABLE OF CONTENTS, and the mode is the document's own
previewflag. The list is one component (OutlineSection) fed by one published document (EditorDocument.preview), and what a row DOES depends on which of the two views is on screen: in the SOURCE it is a symbol outline whose row publishes aLineRevealRequest(caret on the declaration, name selected); in a RENDERED markdown page it is a contents entry whose row publishes aHeadingRevealRequestand scrolls the page to that heading — the reader stays in the preview. The previous behaviour forced the source view open to satisfy a line request, which threw the reader out of the document they were reading (the reported "kenapa pindah ke edit"). Two stores, not one with a mode flag: the requests name different things and are served by different surfaces, and one editor holds both at once (a markdown tab toggles between them) — the same reasonline-revealis separate fromsearch-reveal. The heading match is by NORMALIZED text plus OCCURRENCE (shared/lib/markdown/headings.ts): the row's name is the source's spelling (Hello **world**) and the rendered heading printsHello world, so a raw comparison matches nothing; duplicate## Notesheadings are ordinary and a plain find always answers the first, so the nth row goes to the nth heading. The ordinal is the FALLBACK, never the first choice — inline markup that normalizes differently from what the renderer printed is one heading off rather than an inert click.findHeadingIndexis the single matcher, used by the desktop panel's jump (useHeadingJump) and the phone's sheet (MobileOutlineButton), because a second copy is how one of them lands on the firstNotesforever. The scroll is a RECT delta, notoffsetTop: the preview scroller isoverflow-autobut not positioned, so a heading'soffsetTopmeasures against whichever ancestor happens to be positioned. It also cancels the tab's pending scroll restore (cancelScrollRestore), or the replay that runs for ~600 ms after the document opens writes the remembered offset back over the jump. A request neither the surface nor the document can serve yet stays PENDING, never cleared: a source view answers line requests, and the preview's headings land a frame after its scroller, so clearing on "not now" loses a click that was about to be servable — the ruleuseLineJumpalready applies to a missing surface. The row's accessible name drops its line number in a preview (Heading Second Section, not… , line 9): a rendered document has none to name, and the number would describe a document the reader cannot see. Pinned byheadings.test.ts(normalization, occurrence, ordinal fallback),use-heading-jump.test.ts(which heading was chosen, wherescrollToplanded, the pending rules),use-editor-document.test.ts(only a MARKDOWN preview publishes the flag — a CSV grid and an SVG picture are rendered too but their rows are not headings),OutlineSection.test.tsxandOutlineButton.test.tsx(both surfaces, both modes), andoutline.e2e.ts+mobile-editor.e2e.ts(a real scroll in a real preview, with the reader still in the preview afterwards). -
A failed read is reported, never substituted, and a file's ceiling is enforced at the route too.
EDITOR_MAX_BYTES_BY_EXTis read by the classifier, by the refusal sentence AND by/api/fs/raw, so no entry point can bypass the limit and no two surfaces can name different numbers (unsupportedEditorMessagederives its number from the same table, and the tests derive their expectation from the constant rather than spelling "5.00 MB"). -
Every editor and diff scroll container remembers where it was left, per tab and per surface (
src/shared/lib/workspace/scroll-positions.ts+src/client/hooks/editor/use-scroll-restore.ts). The code surface's scroller is CodeMirror's own (view.scrollDOM) and a diff's is the merge view's element, so neither is a node the panel renders — the hook takes the element as an OPTION (element) rather than reading aref, and the surface reports it throughonScrolleron mount. The editor column still swaps ONE container's document on a tab switch, so the browser clamped the shared scroller to the height of whatever arrived next — measured: leaving a 400-line file at line ~40 and returning landed at line 1. The offsets live in the session's UI state (editor.scrollPositions, so they survive a reload), and the phone editor keeps its own slot (editor.mobileScrollPositions) because it is keyed by PATH while the desktop column is keyed by tab id — one map would let the desktop's prune drop the phone's entries. Three rules make it work, each a bug if dropped: the restore REPLAYS for ~600 ms, because a file's height is not final on the commit that opens it (the line geometry is measured in a layout effect and the panel animates its width) and a single write is clamped to the height that existed then; a reader's own scroll cancels the pending restore, since fighting the wheel is worse than a missed restore; and the offset is recorded from scroll EVENTS, never by reading the element in the effect's cleanup — a layout effect's cleanup runs after the DOM already holds the next tab's document, so readingelement.scrollTopthere stores the NEW file's offset under the OLD tab's key. A restore's own write is excluded by awritingRefflag, not by comparingscrollTopto the read-back value: a scroll event can be delivered SYNCHRONOUSLY from the assignment (measured in happy-dom, and a browser may deliver it before the next frame), when the read-back has not run yet and the delta looks like the reader's — that dropped the pending restore and left a growing document at its clamp. The container is armed even when nothing is stored, because "no entry" means the top and the shared container still carries the previous document's offset. Surfaces are separate offsets (code/renderedfor a file tab,unified/splitfor a diff): a markdown preview and its source, and the two diff row shapes, share neither a line nor a height. A closed tab's offset is dropped WHERE THE TAB CLOSES (dropScrollPosition, called fromuseFileTabs' close / diff-conversion / workspace-wipe paths) — never from an effect watchinglayout.openedFiles, which sees that list at moments that are not user actions (before the session's blob has restored the tabs, mid workspace switch) and deleted every stored position on the way in: measured, the offset persisted and then came back as{}after a reload. The hook reads the session context OPTIONALLY: the shared diff views also draw a chat tool card, and a caller may mount one without the provider. The element is handed in, not read through aref: the code surface's scroller is CodeMirror's (view.scrollDOM) and appears only once the view mounts, so the surface reports it throughonScrollerand the caller passes it as the hook'selementoption — which also re-arms the restore on the render it arrives in.tests/e2e/specs/editor-scroll.e2e.tspins the round trip and the reload, andmobile-editor.e2e.tsthe phone's (a real browser clamping a real container — happy-dom computes no layout, so the unit test's geometry is faked). -
The face itself is a setting, and only one of the offered faces is bundled (
EditorFontSection,EDITOR_FONT_CHOICES).editorFontStackputs the chosen family FIRST in the shared stack, so a face the device does not have falls through to the bundled Fira Code rather than replacing it — verified: an uninstalled family measures identically to Fira Code, not to a system serif. That property is why the picker can offer JetBrains Mono / SF Mono / Menlo / Consolas / Monaco / Courier New, none of which the app ships, and why the section marks Fira CodeBundledand previews each row in the face it names (an absent choice shows its own fallback before the user commits to it). A change has to reach an editor that is already open, which rules out readingappSettings— a boot-time prop the editor only sees again after a reload — so the picker broadcastsomp:editor-font-changedanduseEditorFontStacksubscribes, the same shape the theme uses; the event fires only when the value actually moved, or every unrelated settings toggle would churn every editor's stack. Verified live in the browser with no reload: the open editor's textarea,<pre>and gutter all moved fromMenlotoCourier Newin one step and stayed aligned, and the choice survived a full reload. -
The editor's COLOUR theme is a second axis beside the app palette (
EditorThemeSection,editorThemeinkabmo_settings,shared/lib/code/editor/themes.ts).autois the default and means "the app palette" — nothing changes for an install that never opens the picker — while any other value is a Shiki theme id that paints the code surface's own background, ink, gutter, selection, caret, find bands and diff bands. The separation is the feature: a reader who works in Dracula or Nord keeps that inside the editor while the console around it stays on the app theme. The catalogue is GENERATED, and its gate is what keeps it honest.scripts/editor-themes.mjswritesthemes.generated.tsfrom the installed@shikijs/themes(65 themes) — surface, ink, gutter, selection, cursor, find, border, the two diff bands and three syntax accents for the picker's swatch — so the grid draws every card without fetching a theme module (1.3 MB of TextMate JSON).bun run editor:themes:checkis a CI gate, andthemes.test.tsre-derives every row from the package, so a@shikijs/themesbump fails a test instead of shipping swatches the highlighter no longer has. A key a theme omits is acolor-mixof its OWN ink and surface — 46 themes ship noeditorGutter.backgroundand 8 noeditor.selectionBackground, and borrowing another theme's colour would make the swatch a lie. Two mechanisms, and confusing them is the bug. The CHROME is--editor-*custom properties written on the surface's host (editorThemeVars), with--theme-*as the fallback in every declaration — soautois a no-op, and switching between two editor themes is a pure repaint with no transaction at all. The TOKENS are baked into the Shiki decoration plugin, because Shiki is handed theme NAMES at tokenize time: that one is a COMPARTMENT reconfigure (themeCompartment), which keeps the document, the selection and the undo history. An explicit theme names ITSELF in both Shiki slots, so--shiki-lightand--shiki-darkhold the same value and the app's variant attribute is harmless;autokeeps the app's dual pair, which is why an app theme flip still recolours tokens with no re-tokenize. Verified in the browser: Dracula on a light app palette measuredrgb(40,42,54)on.cm-editor,rgb(248,248,242)on.cm-content, the theme's own gutter ink, and identical--shiki-light/--shiki-darkper token;Autoreturned the surface to transparent withrgb(20,19,16)ink; the choice survived a reload throughPOST /api/settings. The module is fetched on SELECTION, never at boot (theme-loader.ts, aglobalThis-free per-process registry with in-flight dedupe).codeToTokensthrows for a theme Shiki has not been given, so the decoration plugin subscribes toonEditorThemeReadyand rebuilds once it lands — without that a freshly picked theme would leave the surface uncoloured until something else forced a rebuild. A theme that fails to load leaves the app palette, which is a wrong palette rather than a blank editor. The setting reaches an already-open editor through an EVENT, not a prop —omp:editor-theme-changed, dispatched by the modal only when the value actually moved, the same shape the editor FONT uses, becauseappSettingsis a boot-time prop.useEditorTheme()returns{theme, vars, themes}in one hook rather than three subscriptions that could disagree for a frame. The two diff surfaces go throughThemedMergeDiffView(the panel's own file is at the size ceiling, and the chat's diff card is the same surface), so both wear the theme with no second subscription to keep in step. Both editors dropbg-paperfrom the surface's own class list — an explicit theme's background is opaque, so the panel colour under it would be a rectangle of the wrong shade at the edges;autostill shows the panel throughbackground-color: transparent.Autois a CARD, not a checkbox, and it is drawn under every light/dark filter — it is neither variant, and a user who filtered to Dark must still be able to get back to the app palette without first clearing the filter. -
SettingsStateholds only settings that do something. 16 of its 26 fields were dead — declared and defaulted in the modal, never rendered, never read (editorFontamong them, along withtunnelEnabled,activeProvider,binaryPath, …). They arrived in the Remix migration and were never implemented, and becauseDEFAULT_SETTINGSis only merged for display —diffSettingspersists just the keys an edit moved — their fake defaults never reached SQLite either, so nothing downstream could have depended on them.editorFontwas wired to the picker above rather than deleted; the other 15 were removed, and a field that only ever appears intypes/settings/state.tsandDEFAULT_SETTINGSis now the signal that it was never wired. -
The editor column has two WIDTH modes beside its full SCREEN one, and the three glyphs are three different shapes (
shared/lib/workspace/editor-view-mode.tsis the table,client/hooks/workspace/editor-view.tsreads it,common/editor-view-buttons/draws it). Compact view collapses the CHAT and gives its width to the editor; Full view collapses the chat AND the session sidebar; neither touches the right panel, because the outline, the search hits and the diff list are what a wider document is read against. The existingfixed inset-0control is a third, different thing — it covers the right panel too — so it keepsMaximizewhile compact draws a crossed-out message and full a closing panel edge: two spellings of one glyph is how a user learns to click the wrong one. The mode is SHARED state, not a private copy per toolbar (useSharedSessionState): the editor and the diff toolbar are the same surface on two tab kinds, so a mode entered from one must be the mode the other shows — a private copy left the diff readingnormalafter the editor entered compact. The chat stays MOUNTED and is sized to zero (Panelgained a collapsed-filler branch; the box isinert), because it owns the live run, the composer draft and the scroll position, and widening a document must not discard any of them. The mode only means anything while the editor column is open, and that is DERIVED rather than written back (editorOpenin the hook), so closing the column restores the chat and the sidebar and reopening returns to the width the user chose. The layout math has one option for it (chatHidden,panel-widths.ts): the chat floor and the pair's 70% share both exist to leave the conversation room, so with no conversation on screen the editor takes everything the right panel and the separators do not — its remembered fraction is left untouched, so leaving the mode restores it, and a drag made in the mode persists the RIGHT panel only (readPanelWidthsskips the editor, whose width there is arithmetic rather than a choice). The sidebar toggle and⌘Broute throughhandleToggleLeftPanel, which stepsfullback tocompact— flipping the rawshowLeftPanelflag would change a value the layout is ignoring and the click would do nothing. Both toolbars are ONE row, and what does not fit goes into a⋯menu (common/toolbar-row/, the rule inshared/lib/ui/toolbar-overflow.ts). Wrapping was the first answer and it is the wrong one: the editor panel is 320px wide on a 1440px screen, ten-plus controls do not fit, and a wrapped strip made the bar 72px tall — the document moved down by a whole row and the second row read as a second toolbar. A horizontal scroll is worse (the diff toolbar already measured 361px of content in a 296px box withStageentirely outside it and no scrollbar to say so). So the row isflex-nowrap, widths are MEASURED once per cluster set (a table of guessed pixels drifts with a label, an icon or a font), and the tail becomes menu rows NAMED IN WORDS. Pinning is not the visual order: Save is drawn first because that is where a reader looks, while the width modes sit last and are the reason the buttons exist — sopinnedmarks what a narrow panel must not bury (Save, the width modes and full screen on the editor; the change counts, the width modes, Stage and Edit File on the diff), and everything else is menu material. An unmeasured row draws everything (hiding before the width is known flashes a menu on every mount), and the pinned set is placed FIRST so an early unpinned control cannot consume the space a pinned one needs. The editor toolbar fits its row at the 320px floor with no trigger at all; the diff toolbar overflows there and shows⋯— both measured in the browser. Pinned byeditor-view-mode.test.ts(the hide table and the toggle),toolbar-overflow.test.ts(the pinned rule),toolbar-row/index.test.tsx(a wide row draws everything, a narrow one keeps the pinned cluster and offers the rest as menu rows that run the same actions),editor-view-buttons/index.test.tsx(two toolbars mounted under one provider — they share the slot, each reports its ownaria-pressed, the active mode returns tonormal, a stored mode is restored) andeditor-views.e2e.ts(real bounding boxes: compact zeroes the chat and keeps both other columns, full also zeroes the sidebar, the mode survives a reload, and the diff toolbar's buttons drive the same mode). -
Editor & Diff toolbars: every action is an icon-only
<button>carrying both atitleand anaria-label(a bare<svg onClick>is unreachable by keyboard), and each reflects its own state — word wrap / preview / full screen arearia-pressed, Save showssaving→saved→error, and Copy flashes a check for 1.5s. Two rules the toolbars exist to enforce: a failed read is reported, never substituted (useFileEditorhas nofallback; the mock sample it used to drop in was written straight over the real file by the next save), and a failed save says so (reportSaveError, since a silent failure left the user believing the file was written). A file whose read failed also has Save disabled — its buffer is empty, so writing it would blank the file on disk. The save status is reset when the active tab changes, because it describes the file that was written. Both toolbars are@containers, because the panel — not the viewport — is what runs out of room: the editor panel is 320px wide on a 1440px screen. The diff toolbar's action strip therefore wraps instead of scrolling:overflow-x-auto no-scrollbarclipped it invisibly (measured 361px of content in a 296px box, withStageentirely outside it and no scrollbar to say so), and it now costs one extra row on a narrow panel and nothing on a wide one. The editor toolbar's path block is hidden below@[420px]for the same reason — the action strip is 273px offlex-shrink-0, which left the path a measured 23px of truncated fragment (the tab above already carries the name) — and its action strip carriesml-autoso it stays right-aligned once that block is gone. -
The diff panel and the chat's diff card render CodeMirror's merge view, not a table.
diff-panel/merge.tsowns the two shapes (unifiedMergeViewfor Unified,MergeViewfor Split) andMergeDiffView.tsxmounts one per shape;diff-panel/{UnifiedView,SplitView}.tsxandshared/lib/fs/diff-parser.tsare deleted. The panel compares DOCUMENTS now, sooldContent/newContenttravel on the existingGET /api/fs/git?fileDiff=1response and Diff Only ↔ Full Code is a client-sidecollapseUnchangedCOMPARTMENT reconfigure (a re-mount would drop the reader's scroll) — the server's-U<n>probe existed only because a table renderer cannot collapse anything, andfullContextis gone. A changed token carries NO underline, and suppressing it is not a theme rule.@codemirror/mergemarks the changed characters with.cm-changedText(a deleted chunk's with.cm-deletedText) and its own BASE THEME paints a 2px gradient along the bottom of each fragment. A word-level change is usually several fragments —2→22is one — so the reader saw a run of short coloured bars under the code that reads as a second, broken baseline rather than as emphasis; the row's band and the gutter marker are the signals that remain, anddiff-panel.e2e.tsasserts both directions (the bar gone, the band still painted). Three facts about where the suppression can live, each measured. (1) It CANNOT go in the panel'sEditorView.theme: that rejects the&light/&darkselectors the package's rules are spelled with (RangeError: Unsupported selector: &light), and the throw took the whole merge view down leaving an empty host. (2) A plain.cm-changedText { background: none }LOSES — the package's rule is.ͼ2.cm-merge-b .cm-changedText, i.e. (0,3,0), and CodeMirror mounts its style modules AFTERtailwind.css. (3) Sotailwind.cssowns it with three class-level parts of its own (.cm-editor+.cm-merge-a/.cm-merge-b+ the span class), winning on specificity rather than by!important— which would also beat a future theme that legitimately wants a different treatment. Verified in both dev and the production bundle (the emitted rule readsbackground:0 0). The+n/-ncounts come fromChunk.build(a, b), never fromdiff():diff()is a CHARACTER diff, so changingline 5intoline 5 changedreports one insertion of" changed"and no deletion, and a badge built on it claimed+2for two edited lines (measured:Chunk.buildgives+2 -2for that pair,+2 -0for a new file,+1 -0for an inserted line). The chat card has a PATCH and no documents, soshared/lib/fs/patch-sides.tsrebuilds the two sides from the hunks — padding each side to the line its@@header names, or a mid-file change would be numbered from 1 — and collapses that padding withcontentMode: 'diff'. The merge package's own colours are hardcoded hex;diffTheme()overrides them with the palette variables, or a diff would be the one surface that ignores the theme. A card's diff SCROLLS because the CodeMirror root fills its host by LAYOUT, not by a percentage..cm-editor/.cm-mergeViewcarryheight: 100%, and a percentage resolves against a DEFINITE containing block — the diff panel's host has one, but a chat card's diff is bounded only bymax-h-72, and a box whose height comes frommax-heightis indefinite for that purpose. The root therefore computed toautoand grew to its content: measured on a real transcript, 1847px inside a 288px host, clipped byoverflow-hiddenwithscrollHeight === clientHeight, so a 30-line edit card showed nine rows with no way to reach the rest — in BOTH shapes (unified 1847, split 1928).min-h-0on the wrapper is necessary but NOT sufficient (it lets the item shrink; what the root needs is a height to shrink TO), andDiffView.test.tsused to claim it was.[data-code-surface]intailwind.cssis the other half: the host is a column flex container and the root a shrinking item (flex: 1 1 auto; min-height: 0), so the height arrives through layout whatever the host's own is — definite, capped, or automatic (an unconstrainedmax-h-nonehost still sizes to its content). The rule keys on the shared marker for that reason: both surfaces that draw a code surface restated this wrong once.css.test.tsgates the built rule andtests/e2e/specs/tool-diff-scroll.e2e.tsis the rendered proof (host 288 / root 288 / range > 200 / a scroll that moves, in both shapes; A/B'd — both cases fail with the rule removed), driven by theedit:<pairs>prompt directive the fake child gained (every row a CHANGE, orcontentMode: 'diff'collapses the patch back under the ceiling and the range is 0). -
The diff toolbar steps through changed hunks, and the count comes from the merge view's own chunks (
diff-panel/chunks.ts,HunkStepper.tsx).getChunksis a FUNCTION on the state and answersnullfor a state with no merge extension (state.field(getChunks)throws "Field is not present in this state"), and the SIDE matters: a split view's B editor is the working file (side: 'b') and a unified view reports'b'too, so readingfromAmeasures the other document. The package's owngoToNextChunk/goToPreviousChunkmove the SELECTION and returnfalsewhen the caret is already inside the only chunk, so the handle'sstepChunkre-centres the row after the move (a read-only editor does not scroll for a programmatic selection) and the toolbar hides the cluster whencountis 0. The position is PUSHED from aupdateListeneron the one reporting side plus a seed at mount — a caller that recomputed it on its own render would print a number the view had already moved past. Measured in the browser:–/3on mount, then1/3,2/3,3/3, wrapping to1/3, with the scroller following (0 → 35 → 476 px). -
Diff Panel toolbar:
DiscardpostsactionType: 'revert'— the server's own name for "restore this file from the index", and the one that handles the untracked case (removes the file). Sendingdiscard, which no handler matched, returned{success: true}for doing nothing. Stage/unstage/discard await the response and surface a rejection in an inline error strip; the previous fire-and-forget submit flipped the badge optimistically and let a rejected action look successful. The Split/Unified segments each set their mode (toggling meant clicking the already-active segment flipped the view). The toolbar is an@container, so its labels collapse on a narrow panel rather than a narrow viewport — the editor panel is 320px wide on a 1440px screen, andsm:kept every label on, overflowing it. The+n/-ncounts sit in the action strip rather than the identity block: the editor tab carries the file name but never the counts, and they are computed bycountChangesfromChunk.build— the rows the merge view actually draws, not git's own tally (see the bullet above). A second segment pair beside Split/Unified chooses how much of the file is shown —Diff Only(default) orFull Code. It is a separate group because the two axes are orthogonal (Unified/Split is the shape of the rows, Full/Diff is how many there are), and each segment sets its own mode for the same reason the view pair does. The mode is acollapseUnchangedCOMPARTMENT, so it reconfigures the live editor instead of re-mounting it — the documents are already both sides of the file, and the reader's scroll survives the toggle.diff.contentModepersists per session besidediff.viewMode. Word wrap is a third toolbar toggle, on by default (diff.wordWrap) — a long line that runs off a 320px panel hides the very change the diff was opened for. It isEditorView.lineWrappingin a compartment (measured:scrollWidthequalsclientWidthwrapped, 4 525 against 320 unwrapped on a 600-char line), which is also why the old table-layout reasoning is gone with the tables. -
Diff→editor conversion goes through
useFileTabs().convertDiffToEditor, which replaces the tab immutably and reusesfileTabId(src/shared/lib/workspace/file-tab-id.ts). The panel used to assignactiveFile.isDiff = falseon the object insidelayout.openedFiles: React saw no change (identical array identity), and because that array is what gets persisted the mutation reached the database — the "diff" tab came back as a file tab after a reload and its diff never returned. If the target file already has a tab the diff entry is dropped instead, or the two would share an id. -
Both diff shapes fold, and detect the brace pair, through the same stack the editor uses.
diff-panel/folding.tscomposesbracketMatching()+bracketGuide(the open/close highlight and the vertical rule between a brace and its match),foldGutter()(the marker AND the fold state field — afoldEffectdispatched into a state with nofoldStateis discarded silently),foldKeymap, and TWO fold services in that order:braceFoldRangefirst,indentFoldServiceas the fallback. The brace rule folds a line that opens{/[/(to the line BEFORE its matching closer, so the closing brace stays on screen — the boundary a reader comparing two sides expects — and indentation is what still folds a block the brackets cannot describe (YAML, Python, a wrapped expression). The scan is textual (the same documented tradebracketMatching()makes: braces inside strings pair) and capped atMAX_FOLD_LINES, refusing rather than truncating. A pair that closes on the next line hides nothing, so it does not fold. The split shape registers the stack in EACH of its two editors, so the two halves fold independently. Read-only does not block any of it.surfaceThemealready styles the fold gutter, the placeholder and the bracket pair; its fold glyph and placeholder now read--editor-fg/--editor-bgfirst, because the diff is the one reader that can wear a dark editor theme (Dracula) inside a light console — app ink at 45% over that surface is a glyph nobody can see. Pinned bydiff-panel/folding.test.ts(the rule, the cap, both mounted shapes, the guide) anddiff-panel.e2e.ts's brace spec (a real gutter click folds and a placeholder click unfolds, and a real click beside a{paints both ends plus the guide — geometry happy-dom cannot produce). -
handleOpenFileactivates the id of the tab it MATCHED, never the id it computed. The same path reaches the editor under two ids: the explorer passes a row's ownid(its relative path, so"notes.md"), while a search row, a chat link and a drop computefileTabId(path)(a hash). The handler computedfile.id ?? fileTabId(file.path)and then activated that — after the updater had already found the existing tab under the OTHER id. The active id named no tab, soEditorfound no active file and drew "Select a tab to view content" over the file that was already open, with the tab strip still showing it (measured in the browser:layout.openedFiles[0].id = "notes.md"againstlayout.activeFileId = 1582000100). The resolution happens OUTSIDE the updater, againstgetSessionValue(...'layout.openedFiles'): a state updater may run more than once, and activating a tab is not idempotent. Reading the store rather than the hook's own value keeps the callback's identity stable, which matters because the search panel's memoized rows depend on it. Pinned byfile-tabs.test.ts(all three directions: existing tab keeps its id, a new file gets the computed one, and the reverse order dedupes) andtests/e2e/specs/search-panel.e2e.ts(a real click on a hit for a file the explorer opened). -
Right Panel + Activity Bar: switchable developer panels —
context(Context & Telemetry),files,search,git(Source Control),wiki,terminal(Bun),user-browser,browser,usage,todoandplan(src/client/components/workspace/,src/client/components/layout/RightActivityBar.tsx). -
The Files panel lists EVERY entry — there is no noise table.
listDirectoryEntries(src/server/lib/fs/listing.ts, shared by/api/fs/dirand the realtimefs:topic so the two cannot disagree) used to drop a hardcoded set of names (node_modules,.git,dist,build) at every depth. That hid directories the user had no other way to reach:packages/android/distholds the built APKs, and the reported symptom was the folder simply not existing in the panel. A name cannot tell a dependency tree from a folder of release artifacts, so the panel's only signal is now theignoredflag — onegit check-ignoreper listing (never one per entry), which DIMS a git-ignored row instead of deleting it. Cost is bounded by laziness, not by filtering: children are read one directory per request and only when expanded (measured on this repo: root listing 59 ms,node_modules50 ms,.git21 ms), and a row nobody expands is never read. A folder holding exactly ONE folder and nothing else is collapsed into a single row naming the chain (com/java/app/package), because a row per level spends four rows to reach the files inside and every editor folds that.folderChainwalks it in the server listing — onereaddirper folder entry, and only for the folders that have exactly one entry (measured 0.77 ms for the 18 folders at this repository's root) — while the chain's own levels are never listed, so the read the user would have paid on each expand is one that no longer happens. The row's identity is the DEEPEST directory (path/id), which is what an expand reads and what a rename, delete, drag or paste acts on; only itsnamecarries the chain. The walk stops at the first level that holds a file, two entries or nothing, so a folder of files never folds. The client folds by the same rule infoldSingleChildFolders(shared/lib/fs/folder-chain.ts, applied byrehydrateTreeinfile-tree.ts— the one function that builds a rendered tree, so every read, every topic snapshot and every local edit goes through it) because a create or a rename inserts a chain the server has not listed yet;placeEntrydescends into a chain row by its own path, and when an entry lands BESIDE one it UNFOLDS that row rather than drawing the folder twice. The reveal after a create or rename therefore expandsdrawnAncestors— the rows that exist — never the path's own segments, which would putlibandlib/deepin the expansion set when the single row islib/deep, and the next refresh would read each of them for nothing. A collapsed row is asked about its deepest path in the onegit check-ignorecall, which is enough: a rule naming an outer level answers for the deeper one too (verified). A rename or a delete acts on that deepest path, so the delete dialog names it explicitly (this deletes <path> only) rather than letting the chain label promise four directories and perform one. Pinned bylisting.test.ts,folder-chain.test.ts,file-tree.test.ts, the panel'sindex.test.tsandtests/e2e/specs/files-nested.e2e.ts(a real chain on a real disk, expanded, and a rename beside it that unfolds it). The remaining name table,SKIP_DIRSinroutes/fs/read.ts, belongs to the FLAT recursive walk behind/api/fs/list(the composer's@picker): that one is capped atMAX_FILES3000, and descending intonode_moduleswould spend the whole budget inside dependencies and leave the picker with no project file in it. -
Every right-panel view is a PLUGIN, including the eleven Kabmo ships. One catalog (
usePanelCatalog,src/client/components/workspace/plugin-panel/resolve.tsx) merges the built-in views and the installed plugins, and the activity bar, the desktop panel stack and the phone's tab strip all render from it — so a view cannot be a table in one layout and a fetch in the other.RIGHT_PANEL_TYPES(src/shared/lib/workspace/right-panels.ts) stays the single source of the ORDER (it is shared, with no client import, because the width map and the persisted-id guard read it too), andbuiltin.tsx(src/client/components/workspace/panels/) is the built-in half: id, title, label, icon, alazy()component, sizing andrequiresWorkspace. Thelazy()wrapper is created at MODULE scope, which is whatlazy-panels.tsxused to arrange: a view's code stays in its own chunk, and because the wrapper's identity is stable across renders a view stays MOUNTED (its tree expansion, search results and terminal buffer alive) while the layout hides it with CSS.requiresWorkspaceandliveWhileHiddenare DATA rather than conditions at a call site: a view that reads the working tree is inert without a folder while one that reads the SESSION (todo,plan,usage, both browsers) is not — gating those showed "No session selected" over a list that was right there — and only the terminal stays live while another view is on screen, because it owns a live PTY.panel-meta.tsxandlazy-panels.tsxare gone with it; there is no per-view branch left in any layout. -
Enablement is ONE axis and one store, and the ID PREFIX is what keeps the two kinds apart. A built-in view is switched off by its BARE id (
git,files,terminal) and a plugin byplugin:<pluginId>— the same key the client filters its catalog by and the same key the server tests before publishing a bundle. That prefix is load-bearing on the server too:registry.server.tsgates a plugin's bundle onpluginPanelKey(manifest.id), and testing the bare manifest id there made a disabled plugin still reportenabled: truewhile its panel stayed hidden — two answers for one question. The server stores whatever ids it is given and never learns which are built-in;disabledPanelstravels onGET /api/panelsand the client resolves its own views against it. Absent means enabled, which is what makes a freshly installed plugin live immediately, what shows every built-in view on a fresh install, and what keeps a database written before this feature from switching everything off. Two surfaces write the same set through the samesetEnabled(id, enabled): the activity bar's right-click menu (every panel, on or off, with its row kept while off — the only place it can be switched back on; nothing is pinned any more) and Settings → Panel Plugins'BuiltinList(all eleven with the switch a plugin card gets, and no Remove, because the code is in the bundle). The retiredhiddenRightPanelslist is folded into the disabled set ONCE, guarded by the old key's PRESENCE and deleting it as it goes, so the pass is idempotent and a view switched back on afterwards cannot be re-adopted (migrateHiddenPanels). -
Two browser panels, one toolbar, and only one of them may offer device presets.
browser-panel/mirrors the tab this session's omp agent drives in the project-shared Chromium (a read-only screencast: status, URL, zoom, include-in-chat, copy, reconnect);user-browser-panel/is the user's own private iframe with real history and navigation. Both renderbrowser-toolbar/, whose device cluster (BrowserViewportSelector+ViewportMode) is optional — the user panel passes it, the agent panel deliberately does not. A preset is genuine emulation only where the CSS box is the layout viewport (an iframe); on the agent panel it could just letterbox a fixed-resolution JPEG while claiming to emulate a device, and the cluster's 401px pushed the bar toscrollWidth 482 > clientWidth 373on a 373px panel, crushing the read-only URL to 18px. Agent-side emulation belongs to the agent itself (tab.emulate()/browser.open({ viewport })).VIEWPORT_CLASSES(common/viewport.ts) is therefore user-panel-only. -
The editor's document cache is bounded by BYTES, not only by tab count.
MAX_CACHED(12 states) bounds the number of tabs, and that is not a memory bound: a text file's ceiling is 32 MiB, so twelve of them is up to 384 MB of document text plus CodeMirror's rope and each tab's undo history, which holds whole-document snapshots.MAX_CACHED_CHARS(8 MiB) drops the least recently used document past the budget even while the count is under the tab bound, and the document being opened is never the one dropped — losing an OPEN tab's history is the exact failure the cache exists to prevent.
Using Kabmo
How it is built
- Architecture
- Runtime and toolchain
- App shell and layout
- Chat stream and tools
- omp engine and settings
- Plugins, skills and automation
- Desktop integration
- Workspace panels
- Providers
- Harnesses
- Tool panels
Shipping it
History