Discover editor project transcripts and cursorDiskKV histories without modifying the source. Share one SQLite/WAL snapshot across a scan, refresh metadata changes, deduplicate CLI histories, and reject deletion of read-only sessions. Count message-only sessions and expose an all-dates action when a filter hides existing history. Read Cursor CLI text, reasoning and tool parts, and OpenCode v1/v2 transcripts through the existing transcript API.
39 KiB
GUI app shell
The desktop app has a tray (menu bar) icon whose click drops a compact
panel, and a regular window. Both show one small web UI served from
embedded assets. The page talks to Go over a JSON API on the same handler,
with no binding generator and no bundler. magpie web serves the same page
to a browser for a machine with no desktop. Package internal/gui hosts all
three.
Responsibilities and sources of truth
| Part | Responsibility | Source |
|---|---|---|
| Native host | Run starts the Wails v3 app: the tray icon, the panel, the main window, single-instance handover, magpie:// import links and open at login. host implements Windows for the API: show and hide, open URLs and folders, copy to the clipboard, fit and tint the panel, and set the text size. |
app.go, mainwindow.go, traymenu.go |
| Backend | startBackend starts the gateway this process serves, unless another magpie already serves it. In that case this process only shows the other one's status (gw is nil). stopServing drains requests in flight. |
backend.go |
| API and assets | Handler serves assets/ (embedded with //go:embed assets) and the /api/* routes, such as /api/state, /api/set and /api/agents/{action}/{id}. held lets one API request's reads share one catalog build (provider.Hold), and drops it after any write. revalidated and versionedPage name each script by its content hash, so a cache never serves an old app.js under a new page; a file asked for under its current hash (?v=) is cached for good (immutable), anything else is revalidated by its ETag. |
api.go |
| Browser mode | StartWeb serves the page and the gateway for magpie web. The browser signs in with a run key in a link. Gateway mode shows Providers, Gateway, Routing, Usage, Sessions, Plugins and Settings on a machine that is only a gateway. webHandler gzips the page's text files and the API's JSON for a browser that takes gzip (webCompressed, with a -gzip ETag that still answers 304); the app's own windows read the page in-process and get it uncompressed. |
web.go, gatewaymode.go |
| The page | app.js keeps one state object per view and renders it into a list, with no framework. The views have their own files: routing.js, library.js, plugins.js, sessions.js and context.js (Usage's Context tab, and the context window card the Routing page draws under a request's story, fed by /api/context in context.go, which scores and tags each agent; clicking a part, a cell or an item opens its text from /api/context/text, the last 10 requests' masked bodies in memory (openCtxText), rendered 100 items and 20000 characters at a time; its "Tuned for you" cards are fed by /api/tune in tune.go, see agent wiring). Strings go through t() with translations in i18n.js (zh, zh-TW, ja and de; the English text is the key and the fallback). zh-TW is Traditional Chinese with Taiwan's words; a system language of zh-TW, zh-HK, zh-MO or any zh-Hant picks it, and the tray menu and notifications follow (trayLang). Dropdowns use openProtoMenu. Every app menu (openProtoMenu, openRowMenu, openSessCombo) is placed by placeMenu: under its anchor, or over it when the window runs out below; one that fits neither way takes the larger room, its height held to it, and scrolls inside itself, and a scroll inside a menu doesn't close it (#1437, removed-groups-menu-scroll.test.cjs). The highest any popover goes is popTop: 8px under header.top on a Mac window, where the traffic lights are drawn over the page, and 8px from the top elsewhere; placeMenu, the field picker's placePop (which also holds #pop's height to that room) and an agent's model list (openAgentModels) all use it (#1573, popover-mac-chrome.test.cjs). Scrolling is done only by scrollOnPurpose(e) with the reader's event. |
assets/app.js, assets/i18n.js |
| Window navigation | In the window from 1024 points wide (SIDE_AT, the same width as app.css's side-nav rules), layoutNav moves the brand, the pages (#nav) and Settings into the sidebar (#side): the pages in four groups (Work, Models, Insights, Extend; a group none of whose pages shows, as in gateway mode, leaves out its name), the gateway's address at its foot (sideGwRead, read from /api/providers only while there is a sidebar), and the header a breadcrumb (renderCrumb). The open page's own tabs (NAV_SUBS: Usage, Library, Plugins, Settings) are listed under it as .nav-s rows (role="tab", data-of the page tab's id) and the page's strip is hidden; a row's click clicks that tab at once, the selection (.nav-hl) having set off as the row was pressed (navSubGlide; back if the press leaves the row), and is the list's only shape: a row hovered or pressed has no ground of its own, and a MutationObserver draws the list again when the strip changes. A page's tabs share its one scroll, so a row that picks another tab opens it at its top (scrollOnPurpose with the row's click); the tab already open, picked again, leaves the page where it is (sidebar-tab-top.test.cjs). The list opens and folds with an iOS-like spring (navSubEnter, navSubLeave; none under reduced motion), and a folding list is out of reach at once. Narrower, the page beside a sidebar would be narrower than Usage's requests table needs (768 points), so they go back into the header's row, as a Mac sidebar gives way in a narrow window. At every width the reader can pick the sidebar or the header's tabs from the title bar's button (#sideToggle, ⌃⌘S or Ctrl+Shift+S; toggleSideNav), kept in localStorage magpie.navLayout (side or top) and so laid out from the first frame; none picked, the sidebar comes from SIDE_AT. Picked in a narrow window the sidebar is narrower (184 points under 860), and magpie web on a phone keeps its own tab bar and has no button. The two layouts trade places in a view transition (navMorph, app.css .nav-morph): the sidebar slides, each page's tab flies to its place in the other, and the page slides as one (its old image dropped, so no line prints twice); without view transitions, under reduced motion, or in the Linux app the change is at once: WebKitGTK with compositing off (WEBKIT_DISABLE_COMPOSITING_MODE, which webkit_linux.go sets under Wayland) crashes in a view transition. Elsewhere a transition still going after MORPH_MAX (1.5s) is skipped, so a webview that never ends one can't leave the window on the old layout's picture. See side-toggle.test.cjs. A window made wider or narrower drops what a click held (heldWidth): the page laid out again isn't the click's doing. The reader's own place is kept instead for a second while the page is laid out again (relaid, a ResizeObserver on the open page's parts calling backToReader): crossing SIDE_AT the browser clamps the scroll to each layout it passes through, and the page ended short of its foot (#1672, text-size.test.cjs). See sidebar.test.cjs. A sidebar longer than a short window keeps no scroll bar beside its pages: the native bars of .side-scroll and .side-foot are hidden, and sideBars lays a thin bar over each box's edge that shows while it scrolls, fades about a second after it stops (kept while hovered or dragged), can be dragged or clicked to page, and is gone when the box fits, the same in WebKit, WebView2 and WebKitGTK. See sidebar-overlay-scrollbar.test.cjs. |
assets/app.js, assets/app.css |
| No GUI build | -tags nogui builds magpie without the GUI: hasGUI is false and runGUI says to use magpie tui. The files of internal/gui that need Wails build under !nogui. |
gui_off.go |
Runtime path
magpiewith no arguments,magpie appormagpie traycallsrunGUI, which callsgui.Run. Anoguibuild runs the TUI instead. A second launch hands over to the instance already running. On Windows, before any window is made,webView2Checkasks Wails whether the WebView2 runtime is there (Env.Info().PlatformInfo["WebView2"], "" when its lookup fails; a key Wails doesn't set counts as there). Without it Wails would exit on the first window with nothing on screen, so magpie logs it, shows a Windows message box in the reader's language naming the runtime, Microsoft's download page (webView2Page) andmagpie web/magpie tui, opens the page on Yes, andRunends (#1806,webview2.go,TestWebView2MissingFromWailson Windows). The box can't come fromErrorHandler, which runs on the thread Wails makes its windows on.startBackendbrings up the gateway, or finds another magpie serving it.- The panel and the window load
index.htmlfromHandler.boot.jspasses the saved language, theme, text size and desktop font choices before the first paint. - The page reads
GET /api/stateand writes throughPOSTroutes. Each write answers with the new state, built underheld. - Closing the window hides it. On the Mac a full-screen window first leaves full screen (
closeStep). The system's close on the panel (a title bar's X, Alt+F4, a window manager's close key) hides it as Escape does, so the tray icon opens it again; a panel lightweight mode let go, no longerh.panel, closes (makePanel,TestPanelCloseHidesIt). Lightweight mode lets go only of a window closed this way: one covered by another app's window, minimised, or open as magpie was hidden is still open (windowUp, not Wails'IsVisible, which is the occlusion state), and so is it for the Dock while the window is open and for a restart (#1381,TestCoveredWindowStaysUp). On the Mac the tray icon and a usage cell close an open panel by the same test (windowOpenintogglePanelNowandtrayCellClick, not Wails'ToggleWindow), so under a window over the whole screen, such as a remote-desktop server's privacy curtain, the icon still closes the panel instead of showing it again (#1661,TestTrayCellClickReleasedPanel). - The window opens as it was last left. Its settled size and whether it was maximised are kept in
settings.Windowandsettings.WindowMaximised(settle; per machine, seeKeepOwn). A maximised window keeps the size it restores to.makeMainopens it at that size (openSize). On its first show,placeMainmaximises it again on the Mac and Windows (on Windows once the page has come). On Linux,makeMainmakes it maximised withStartState. On Windows a size larger than the screen's work area is fitted and centred (fitRoom), and the larger size stays kept. The window's position is not kept. - On the Mac, Settings › Show in Dock puts magpie in the Dock never (the default: out of the Dock, and so out of Command-Tab), while the window is open (
DockWindow) or always (Dock); a full-screen window joins it whatever the setting (inDock,dockOnFullscreen).openMainjoins before it shows the window (setDockruns on the main thread at once). An app activated out of the Dock (the quick panel's focus) that then joins it stays last in Command-Tab's order though it is in front, so joining to the front activates magpie by way of the Dock (dockStep,activateAgain; #1381,TestDockStep,TestDockJoinLeadsCommandTab). It does so without asking NSApp whether magpie is active: the Mac makes it the front app at once, and NSApp says so only once the main thread has taken that in, after the join on a busy Mac (#1651).
Constraints and failure behavior
Streamed output speed
Usage rows and aggregates use Record.Decode and DecodeOf in
internal/usage/usage.go. Routing uses
decodeOf in routing.js; Usage
rows use ledDecode in app.js.
When an answer follows reasoning, only answer tokens are timed from the
first answer text. Without answer text, all output tokens are timed only
when the gateway records paced visible reasoning and a usable content flow.
firstToken.reasoningMs in
ttft.go requires reasoning at the first
content and subsequent reasoning deltas at least 100 ms later. It excludes
native Responses and Gemini, whose summaries do not measure their reported
reasoning tokens, and redacted thinking, including translated sealed blocks.
The upstream protocol is retained when the client receives a translation.
These are receive-side timing checks, not access to the vendor's generation
clock: a relay that releases a buffered reply evenly can still look paced.
Without an upstream guarantee, this is an observed output-rate estimate.
Summaries stay excluded rather than extending their visible portion's time
to an unobserved reasoning-token count.
Record.FirstReasoning (first_reasoning_ms) and the corresponding
Call, Route and Try field (firstReasoning) record this evidence with
the same origin as their duration. Historical records have no evidence and
keep their previous speed. Request-page caches and compressed snapshots
preserve the optional field; the packed row keeps ReasoningHidden in
its own Flags bit (rowReasoningHidden), apart from pricing's
swapKnown, which every priced row carries. ReasoningHidden (reasoning_hidden in the
ledger, reasoningHidden in traces) suppresses a no-text speed even when
redacted/encrypted thinking has no reported reasoning-token count. A
Responses summary is marked this way on its own-login path too, and after
an endpoint fallback, where the try's protocol still names the first
endpoint, by the upstream that answered (summaryUpstream in
continuation.go). Optional
OTel attributes carry the evidence without response text. The existing burst and held-content limits in
DecodeOf still apply, and hidden reasoning does not enter average speed.
TestVisibleReasoningSpeed, TestReasoningSpeedEvidence,
TestReasoningSpeedThroughGateway, TestMixedRedactedReasoning,
TestHiddenReasoningThroughTranslation, TestSlowReleasedReasoningIsUntimed,
TestPricedRowKeepsReasoningEvidence, TestSummaryAfterEndpointFallbackStaysHidden and
reasoning-speed.test.cjs
cover the calculation, cache round trip, translated streams and both pages.
Routing purpose filter
The request heading's purpose menu in routing.js
uses openProtoMenu's live checkbox selection: each tick immediately shows
requests matching any selected purpose, with the menu kept open. An empty
selection, All purposes or Clear filter restores every purpose without
changing the day or request/session view. A live menu stays open when its
redraw clamps the list's scroll; the reader scrolling outside still dismisses it.
Choosing All purposes closes the menu and returns keyboard focus to the
purpose button without scrolling; unticking the last checkbox keeps the
menu open and focused on that checkbox.
Counts, the current story and replay
follow the same filtered list. Selected purposes remain available when a day
has no matching requests. Opening a request from another page clears the
filter only when that request is excluded. Usage's purpose picker remains a
single choice sent to the ledger API. See purpose-filter.test.cjs and
routing-purpose-state.test.cjs.
Routing mode chip
The stage's chip and the Accounts and keys heading in
routing.js name how a route
routes only where that can be changed: a group, or a provider in
/api/groups' pools (two or more accounts or keys on). There they are
.rt-go controls (goTo, goRouting) that bring the group's card or the
provider's row under Several accounts or keys into view through
scrollOnPurpose, mark it (rt-found) and focus its routing. A provider
with one on names no routing, and the mode paragraph says how to get one
(LONE). The header is drawn again when the groups come in (headOf).
See routing-mode-goes.test.cjs.
Routing key and account folds
Three or more API keys, or three or more accounts, of one provider standing
next to each other for one model (same fixed effort, fallback and
group-in-group heading) fold into one stage row, li.rt-fold in
routing.js (FOLD_AT,
rebuild). It shows the count and their state together: the one that is
lit and what it is doing, how many are available and how many rest
(together). Requests that land on a folded seat fly to the fold
(shownRow). Clicking it (or Enter / Space) shows each in place, wired
from the fold. Accounts and keys folds a provider's keys, and its accounts,
into one .rt-keys row each with their summed tally.
A group in the group's heading (li.rt-sub, subNode) folds the same way
(toggleSub): folded, it says how many it routes to and what they do
together, a request to any seat under it flies to the heading
(row.shut), and its wire is the last one drawn (wiresTo).
Keys start folded. Accounts and group-in-group headings start open when
they hold fewer than LONG (6), folded otherwise (Aiirobyte on Discord: a
group of many accounts took the page). What the reader opens is kept in
localStorage magpie.routingKeysOpen and what they fold in
magpie.routingFolded (keepOpen, isOpen), keyed provider/model for
keys and provider/model@ for accounts on the stage, provider/* and
provider/@ in the list, and group/<id> for a heading. Display only: the
gateway's order and choice of seat don't change. Two stay two rows. See
routing-keys-fold.test.cjs and routing-group-fold.test.cjs.
Routing account windows
A subscription account's row in Accounts and keys shows each of its
windows under the one figure routing went by, with when each resets
("5 hours 40% used · resets in 2h"), as the Usage page reads them (#1833).
cardOf in routing.js matches
the route's account to app.js's quotas: a subscription card of this
computer (no from) whose provider is the account's agent (a plugin's
provider id) or its provider, and whose user is the account's, ignoring
case. winsOf names them with familyWindows, quotaText and
resetInText. Nothing new is read: opening Routing asks
/api/usage/quotas in the ordinary way (show, when the readings are
missing or over a minute old), never ?asked=1. A kept day's list shows
none, since those requests were weighed by readings long gone. See
routing-account-windows.test.cjs.
The refresh beside the Accounts and keys heading (#rtReadAllowances,
#1834) reads them again by hand: loadQuotas(true), the asked read the
Usage page's Refresh now makes. It turns while the read is on its way,
and a click then asks nothing more. Nothing on the page reads again by
itself. It shows only live, with a subscription account listed. See
routing-read-allowances.test.cjs.
On the stage, an account's seat tells the same windows in its tooltip,
under its id (render, #1835). The row itself keeps one line: the
fullest window while idle, what it is doing while it answers. See
routing-seat-windows.test.cjs.
Desktop fonts
Settings → General offers independent interface and code fonts, each with
the installed family's actual styles. GET /api/fonts calls
fonts.List: DirectWrite on Windows,
CoreText on macOS and Fontconfig on Linux. Discovery is lazy, cached in the
handler, and refreshed by the menu. It returns names and CSS traits, never
font files or paths. A failed refresh answers 503 and preserves the previous
collection; an empty successful collection is distinct from failure.
magpie web and nogui do not expose this desktop catalogue.
settings.UIFont and settings.CodeFont keep the family, style name,
OpenType weight, CSS slope and width percentage. A missing choice keeps the
platform default. A settings POST can restore that default with an explicit
null; omitting the field preserves it, as does every browser-mode save.
KeepOwn preserves this computer's choices during sync and backup restore.
Invalid traits reject the save without replacing the previous settings.
fonts.js applies choices at boot and
through applyPrefs. After a successful font change host.fontsChanged
notifies both existing webviews through receiveFonts, without waiting for
the other window to gain focus; a released lightweight webview uses boot
settings when recreated. An in-flight local save ignores the notification
and finishes its own queue.
The selected family precedes the existing platform fallback stack. The
interface and code traits apply independently; explicit component weights
still mark emphasis. A choice takes precedence over Omarchy's font, while
restoring the default follows the theme again. If discovery finds a saved
face missing, the page retains its name, explains the fallback and uses the
default until the face is available or the user chooses another. A discovery
error never clears a saved choice. The browser's own typography is unchanged.
The menus support search, keyboard selection and refresh. Styles are ordered by weight, then normal, italic and oblique; width and name break remaining ties. Family changes keep a matching style where possible, otherwise the nearest regular face; named variable instances are offered without arbitrary axis controls.
Recent-call bodies
providersState in providers.go sends
recent-call metadata without request or response bodies, including after
provider writes (#1521: forty calls' bodies made /api/providers about
20 MB). Each call in the gateway's 40-call ring has an id, numbered in
Server.record. Opening a recent call on Gateway fetches its captured
previews from GET /api/gateway/call?id=… (Server.RecentCall), sent
Cache-Control: no-store. The route sits on the same mux as the rest of
the API, so magpie web's key guard covers it. The bodies are the ones the
ring kept, masked as the request was (redacted); the route doesn't fetch
S3 or change capture, export or archival. A call evicted from the ring, or
a gateway served by another magpie, returns 404. The page keys a row by
that id (callRow), keeps fetched bodies in memory while their calls
remain in the list, preserves them across summary refreshes, and offers a
retry after a failed read. See TestRecentCallBodiesOnDemand and
recent-call-bodies.test.cjs.
Shared UI rules
- Settings → General is laid out as macOS System Settings is (1ooogle on X): a row says its name alone when that says enough (Appearance, Language, Text size, the fonts, the tray click, the Codex model rows, Open at login, Show in Dock), and keeps one short line where the setting isn't clear from its name or has a consequence (Long conversations, Lightweight mode, Prevent sleep, Session terminal, Codex subagents). A font row's line shows only while its fonts load or fail; the text size keys are the choices' tooltip. Language is one menu button showing the language picked, opened in the app's menu (
renderLangPick). Seesettings-general.test.cjs. - Settings' search-provider picker offers Off, saved as
searcher: "off". Its help explains API-only search and suppresses provider fallback/own-search hints while off; the search priority row is hidden because no provider competes with the APIs. See gateway search behavior,renderSearcher,TestSettingsSearchProviderOffandsearcher-pick.test.cjs. - Settings' Search APIs add row has a base URL field under the key for every API (#1580): the vendor's own address is its placeholder, picking an API already added fills in its saved URL so a new key alone keeps it, and Add with no key changes only the URL. See a search API's base URL,
renderSearchandsearch-api.test.cjs. - Every user-visible string has zh, zh-TW, ja and de translations with the same placeholders.
gui-zh-tw.test.cjs,gui-ja.test.cjsandgui-de.test.cjsfail on a missing one;gui-zh-tw.test.cjsalso fails on a zh-TW string with a Simplified character left in it. - A click never moves the page. Code scrolls a view only with the reader's event in hand (
scrollOnPurpose);click-scroll.test.cjsguards this. A click is taken where the reader left the view: a scroll not theirs made just before it, whose scroll event the browser sends only at the next frame, after the click, is put back first (backToReaderin the click guard, #1554). - There are no native
<select>elements and no colored left-border stripes. State is shown with a dot or a swatch. - The Usage page's cards and the tray panel's Allowances tab share one order,
settings.UsageOrder(byUsageOrder). In the panel a balance-only card stands where that order puts it, and balances next to each other share one Balances grid (panelBalances, #1510); none is gathered after the plans. The panel's Arrange (panelArrange) moves rows in it and hides subscriptions from that tab alone (settings.PanelUsageHidden); both save throughPOST /api/usage/arrange, which changes only the field it is sent, and the Settings save keeps both. Hiding is display only: a menu bar cell's card shows though hidden (panelPeek). SeeTestUsageArrangePanelHidden,panel-arrange.test.cjsandpanel-balance-order.test.cjs. - A client in the Usage page's Agents list can be hidden from that list (ikunbots on X): its row's "…" button or right-click opens the row menu with Hide from this list, saved by client id in
settings.UsageAgentsHiddenthrough the samePOST /api/usage/arrange(agentsHidden), and kept by the Settings save. The ledger, the totals and the chart still count a hidden client. A quiet "{n} hidden" line under the list opens them, each with Unhide (hideUsageAgent). SeeTestUsageArrangeAgentsHiddenandusage-agents-hide.test.cjs. - A request's details in the Usage ledger say its tokens at every width (#1839,
ledDetail): "{i} in · {o} out · {r} cache read · {w} cache creation", 0 said as 0, with how much was written for 5 minutes and for an hour when it says so. A failure that spent nothing has no Tokens row. Seeledger-cache-tokens.test.cjsandusage-ledger-detail.test.cjs. - The requests magpie makes by itself (a routing classifier's, a web search's, an image description's) are told apart from the agents' on the Usage page (#1839): magpie's row among the agents and its rows in the ledger carry a "magpie's own" mark (
ownBadge), an account's, key's or model's row adds "{n} by magpie itself" from the summary'sown, and an account's card says how many of the period's requests were magpie's own (ownLine, drawn again once the summary comes after the allowances). Seeown-requests.test.cjsandTestSummaryCountsMagpiesOwnCallsApart. - Opening the allowances is asking to see them (#1588,
quotasOpenedinapp.js): the Usage page from the nav or its Overview tab picked, the window brought back to the front on the Overview, the tray panel's Allowances tab picked or the panel brought up on it, and a menu bar cell clicked each loadusage/quotas?asked=1, as Refresh now does. An asked read makes the backend read every account again (AskClaudeUsage), so an opening within 30s (QUOTAS_OPEN_GAP) of the last asked read sends an ordinary read instead, which joins one on its way; Refresh now always asks. A panel page loaded while it is put away (hidden, or without focus) doesn't ask. The timed refresh is unchanged and never asks. Seeallowance-open-read.test.cjs. - The Usage page's cards are packed into columns, never all stretched to a row's height (
packUsage, #860): each card in that order goes to the leftmost column that ends highest, on 1px grid rows, so short cards stack beside a tall one. The last card in each column then reaches down to where the tallest column ends (amin-height, cleared before the cards are measured again), so cards side by side in one row are as tall as each other and a stack ends with the tall card beside it (ikunbots on X); content stays at each card's top. The page's order (DOM, dragging, Alt+arrows) staysUsageOrder. The column count is the most 260px columns that fit, or one fewer when that leaves much less empty room; it is chosen again only when the cards change or the width fits another number of columns, so a card opened or folded stays where it is, even as the scrollbar comes in. Seeusage-pack.test.cjs. - The Providers page has a search box over its list (#1614,
findProvidersinapp.js): the words typed keep the rows, on and off, whose text or data say them all: name, id, preset, addresses, every model's id and name, the account's user and plan and each login's, account names and key names. The Turned off fold stays open while searching; Escape or clearing the box shows every row and the fold as it was. A row that is on reorders by dragging its logo, Alt+↑/↓, Alt+Shift+↑/↓ (top, bottom) or its right-click menu (openProviderMenu: Move to top, Move up, Move down, Move to bottom). While searching, a step or a drop moves it among the rows shown (it takes the place of the row it passes,stepProvider,shownToOn) and the hidden ones keep their order; Move to top and Move to bottom go to the ends of the whole list. Every move saves the whole order throughPOST /api/providers/arrange. Seeprovider-find.test.cjsandprovider-order.test.cjs. - A new user's Agents page (the window's first page and the panel's Agents tab) has a Get started card above the agents in the welcome's place (wangye1644294 on X,
guideCardinapp.js). Its three steps are: add a model source; connect an agent, where the agents magpie found that can be connected are named and each is connected in one click (agents/connect); and, optional, a routing group, with the most harmless starter template that can be made from the user's models (provider.Templates, Never stuck first) added in one click throughPOST /api/groups/template. Every tick comes from the state: the models magpie serves (servedin/api/state, groups left out), an agent wired, or a group that isn't automatic. None comes from the card having been seen. The card goes once the first two steps are done. Its close button savessettings.GuideHiddenthroughPOST /api/settings/guide, so the panel, the window and a reload agree, and the Settings save keeps it. Seegetting-started.test.cjs. - Every page of the window keeps to one width, at most 1200px of content centred, with a 16px gutter in a narrow window (
padding: max(16px, calc(50% - 600px))on each#view-…, #860). Routing, Usage and Sessions are in that rule too (面条 on Discord), so a large screen doesn't stretch them edge to edge while the others sit in the middle; their columns follow the room they get (byWidth). Seepage-width.test.cjs. - The page must work in Chromium (Windows' WebView2) and WebKit (macOS, and WebKitGTK on Linux). GUI tests run in both engines.
- On Linux the panel is frameless and the main window has a hidden title bar (
plainTitlebar). GTK 3 asks KDE's Wayland session (KWin's decoration protocol) for a frame drawn by KWin on any window without client-side decorations, an undecorated one too, soownFrametells KWin the panel draws its own on each realize (#1283). GTK 4 builds ask for none themselves. With no KWin title bar, and with a Wayland window placed by the compositor rather than by the icon, the panel's header is its drag handle on Linux, as the window's is (--wails-draggableinapp.js;panel-drag-linux.test.cjs); on the Mac and Windows the panel isn't dragged (#1430). - On Linux the panel is a solid window, as the main window is, and its page paints
--bgwhole (panelOptions,body.linux.panelinapp.css). The Mac's and Windows' panels stay translucent. A see-through panel is an RGBA, app-paintable GTK window under a transparent webview, and on KDE Plasma 6 its page, painted at 93%, left a fainter copy of the old scroll position as it scrolled (Wayland and XWayland, compositing mode on or off) while the main window never did (#1803,TestPanelSolidOnLinux,panel-linux-opaque.test.cjs). Xvfb with picom on WebKitGTK 2.54 doesn't show the ghost either way, so the fix rests on the reporter's machine. - A Wayland window can't place itself, so under Hyprland and niri the compositor is asked to put the panel under the bar. Under Hyprland
placePanelgives it a window rule at the cursor (omarchy.PlacePanel) and closes it on a click outside (omarchy.ReportClicks). The rule names the monitor under the cursor and moves the panel to x, y from that monitor's corner (omarchy.PanelAt): Hyprland adds the window's monitor's place to amove, so a position across the whole layout put the panel off a monitor not at 0,0 (#1785,TestPanelAtMonitorOffScreenOrigin). The cursor and the clients' places thatomarchy.ClickedOutsidecompares are both across the layout. niri (omarchy.Niri,NIRI_SOCKETset) takes no rules at runtime and doesn't report the cursor. Thereomarchy.NiriPanelwatches niri's event stream and moves the panel each time it opens: the window of magpie's pid titledpanelTitle, moved withMoveFloatingWindow(afterMoveWindowToFloatingif it was tiled). It goes 6 px under the working area's top, centred on the x the tray host passed toActivate(x, y). Wails keeps that x in its Linux tray (trayClick,TestTrayClickIsWails), and it is taken across the bar, since that's all a Wayland bar knows. With no click (magpie panel), or with one off the output, it goes top right. Wails'HideOnFocusLostcloses it, since a click on another window takes niri's focus. It still opens in the middle and slides up, and a bar at the bottom or the side isn't accounted for (#1670). - Wails calls the tray's click handler both for the icon's click (
Activate) and when the tray host opens the icon's menu (dbusmenu's "opened" event). KDE opens the menu on a right-click, and the panel that click opened took the focus and shut the menu on Wayland. On Linux the handler ignores the call when it comes from the menu opening (menuOpeningintrayclick.go, which looks for Wails'(*linuxSystemTray).Eventamong its callers;TestTrayMenuOpenFrameIsWailsfails if Wails renames it or stops calling the handler there) (#1430). - On GTK 3 builds, the app gives GDK a font DPI before the first webview when it has none (
fontDPI,fontdpi_gtk3.h). GDK's unset value is -1, and WebKitGTK 2.54's GTK 3 settings reader multiplies it by 1024 unchecked, so every page lays out at a negative width with a 9000000px font (#1371). An unset DPI takesgtk-xft-dpi, or 96, times a validGDK_DPI_SCALE; a positive one is left alone. Wails initialises GTK (its GtkApplication) only insideRunand makes each window from a default-idle-priority callback on the main loop, sofontDPI, called just beforeRun, queues the check as aG_PRIORITY_HIGHidle: it runs on the main thread after GTK's own start, before the first window.TestFontDPIUnsetopens a real WebKitGTK page throughmagpie_font_dpiand needs a display (Xvfb). - Tests never touch a live agent config. The package's
TestMainruns undertestenv's home of its own. A macOS test that shows windows runs them in a process of its own throughrunAppKit(appkit_darwin_test.go). AppKit and WebKit take their home from the account, not from HOME, sorunAppKitgives them a temporary one withCFFIXED_USER_HOME; appearance, contrast and languages still come from the account. The test fails when that process leaves a folder in the real~/Library/WebKitor~/Library/Caches. Playwright tests serveassets/with isolated/apifixtures. POST /api/settings/codex-auto-reviewaccepts an empty value (Codex's own choice) or an exact model/group ID inprovider.Served, including unlisted providers. A known provider with an unknown or empty model name is rejected without changing the saved reviewer or catalog tag. Generic gateway request resolution remains permissive; it is not the validator for this setting. SeeHandlerinapi.goandTestCodexAutoReviewSettingincodex_auto_review_test.go.
openModal makes the background inert when an editor opens fresh, leaving
confirmations and menus interactive through redraws. closeModal releases
that background as soon as the close animation starts, so clicks reach the
page while the editor fades away. Opening an editor during that animation
protects the background again. ux-safety.test.cjs checks these transitions.
Routing's New group buttons share newGroup, which asks before replacing a
dirty group draft; Cancel retains the draft and Discard opens the new editor.
newGroupWith applies the same guard when creating a group from a model and
waits for show to accept navigation before creating its draft.
Verification
The session readers include Cursor CLI chat stores, Cursor editor project
transcripts and older editor cursorDiskKV conversations. CLI stores win
when the same session ID has a project transcript. Editor conversations are
read only, including at the delete API, and cannot be resumed by cursor-agent.
Project transcripts contain no message timestamps or billing data; their
existing file modification time supplies the activity date, and tokens and
cost are not inferred. Database bubbles retain their own timestamps.
The editor database is opened as one read-only snapshot per listing, shared
by its chats and removed when the listing ends. Metadata changes invalidate
the cached summary even if the project transcript has not changed. See
cursor_editor.go,
TestCursorEditorTranscript and TestCursorEditorLiveDatabaseAndMetadataRefresh
in cursor_editor_test.go.
Messages without tokens or an active-time estimate still count as sessions
in the overview. Cursor and OpenCode conversations can be opened through
the existing transcript API, including CLI reasoning and tool calls. When the selected date range is empty but
matching history exists, Usage offers All sessions, preserving the agent,
model, folder and search filters. See sessions-empty-range.test.cjs.
go test -tags nogui ./internal/gui
go test -run TestWebView2 ./internal/gui # on Windows: Wails' runtime lookup, missing and present
go test -v ./internal/fonts # native discovery on each desktop OS
make test-ui # every internal/gui/tests/*.test.cjs, Chromium and WebKit
BROWSER=webkit node --test internal/gui/tests/click-scroll.test.cjs
make test-ui needs Node.js and Playwright (playwright install chromium webkit). Set NODE_PATH when Playwright is installed outside the repo. The
Test workflow in CI does not run this suite, so a GUI change must run it
locally and report the result. See tests/README.md.