Renderer presentation and binding in apps/web. Cross-window transfer and main-process View geometry: see their own records.
Model
Concept
Meaning
Tab
Chat, file or folder, terminal, web page or application page. Each keeps its own Back/Forward history.
Group
Tabs shown side by side as one strip entry, laid out by a canvas. MAX_CENTER_TAB_GROUP_MEMBERS is unlimited. Created by groupTab; a preview expanded to split uses setSplitWebTab.
Leaf
A kind:"web" entry in the center-tabs store. Id w:<url>; a fork from nextPopupWebTabId is w:<url>:popup:…. Floating does not remove it.
Pairing
The one first-class session-page relationship (pairedOwnerByTabId). A session may pair with many pages; closing either side clears it. Set when an Agent opens the page in the session, the user drags it into the session's split, or the user collapses it. Standalone pages have none, and no collapse action.
Binding
At most one active (tabId, ownerTabId) in the useWebTabPip singleton, plus previews per session. Not persisted. Rebinding keeps the old pairing.
Host
Where the page renders now: pane, chat preview or none. Derived by pipCoversCenter; components store no visibility.
A leaf has one native WebContentsView at a time. The preview is that real page, never a mask or screenshot; page tab and preview never show together.
Where one leaf is shown
Tabto preview: collapseWebTabToPip
Previewto tab: end + setActiveto split: end + setSplitWebTabto background: hide()
Splitto preview: ungroup, then collapse
Backgroundto preview: composer chip calls show
end() clears only the binding; the leaf stays until closeTab. Owner or leaf closing calls it. Switching session is not a transition.
Preview store fields
Field
Meaning
tabIdownerTabId
Active binding; both set or both null.
backgroundTabIdbackgroundOwnerTabId
Restore record left by hide().
rect
Memory only, not cleared by hide/end. clampPipRect keeps it inside the pane, minimum 240×160. Default: upper right, under the session controls; a drag takes over.
show(tabId, ownerTabId)
Registers the pairing, sets the binding, clears background. Replaces the old binding.
Binding ex.dev owned by session A, for each active center tab:
Situation
Leaf is web
Page not active
Owner on canvas
Session matches
Host
Session A active
yes
yes
yes
yes
preview
Session B active
yes
yes
no
not reached
none
Page tab active
yes
no
not reached
not reached
page fills the area
File or terminal active, A not beside it
yes
yes
no
not reached
none
Another pane focused, A visible in the split
yes
yes
yes
yes
preview
A navigated to another conversation
yes
yes
yes
no
none
The binding stays in every row; pipCoversCenter just returns something else. The window overview also hides the preview. After ✕, the chip runs the same function on the background pair. In a graph view the preview docks in the side column under the minimap until pulled out.
Preview behaviour
Case
Behaviour
Coming back to a conversation
applyFollowPreview shows that conversation's own preview. With none, a preview of a pane still on the canvas stays, or one from a pane beside it comes up; otherwise it hides.
After ✕
Not reopened on return; the chip brings it back. The chip names the page surfaceRefForChat reports and offers Close or Show only when that page is this chat's preview page. In a split it is a plain label. The preview folds into the on-screen chip naming its own page (data-web-surface-chip), its own pane first; with none it fades, and reopens from Preview in conversation.
Opening the bound page
Binding and follow preference stay. .webFrame measures the native bounds and fills the content area, with no reserved space.
Collapse target
Original owner if still there, else the session in the group, else the pairing table. None: no button or menu item. Then: leave split or group, setActive(owner), show, with no reload.
Interactive floating page
Reuses the Electron WebContentsView for clicks, scrolling and typing; no second Page or forwarded coordinates. Each animation frame updates host transform and native bounds; release persists geometry.
Plain browser: sandboxed iframe for HTTP(S), a separate document whose login and frame-ancestor limits follow browser policy. Restricted URLs show an unavailable message and keep Open page.
Older bridges without visible views keep a labeled image fallback (usePipSnapshots). A current Desktop bridge does no capture.
Hidden, switched or unmounted previews release bounds and observers without closing the Page. Menus and dialogs occlude native content.
Agent interaction
op=open
Result
Has session_id or background
Background: ensureExclusiveWebTab, marked agent-owned, listed in Resources. No focus change, no preview.
Otherwise, session active, desktop wide enough, a web page in its group, no owner conflict
Split: openWebTabInSplit, then registerPipPair.
Otherwise, session active
Preview: show. A fork via ensureExclusiveWebTab on owner conflict or pipOpenMustFork; otherwise reuse the canonical leaf.
Otherwise
Foreground tab.
Foreground paths wait for waitForWebTabReady (2 s), then activate and answer webtab_result. On failure outside split, restorePriorActiveTabAfterFailedWebOpen restores focus. Split needs width 360+480+6 (split-layout.ts); app-shell.tsx publishes it.
op=close
Result
Leaf missing or not web
tab_not_found
In any group's memberIds
tab_in_user_layout
Otherwise
{ok:true}, then closeTab; the store subscription ends a bound preview.
A page private to another conversation answers page_not_accessible (agentCanAccessWebTab).
surfaceRefForChat picks: visible web pane in the session's group, then splitWebTabId when the session is active, then the preview leaf when the session owns it. None or no bounds: no surface.
op=preview/activate act on visibleWebTabById, and answer "not visible" for hidden pages; a background preview reads a selected mirror without revealing the Page.
Known differences from product intent
Difference
Detail
Fork ignores hidden previews
pipOpenMustFork checks only the active binding; B's show clears A's restore chip.
Fork knows only canonical leaves
The check is webTabId(url) === boundTabId. Each fork can leave an orphan leaf, removed by op=close or the user.
Close does not track the opener
Only group membership is checked: an Agent-opened page dragged into a group cannot be closed, and an accessible standalone user page can.
Split path skips pipOpenMustFork
It only checks agent ownership, and changes the group's web pane URL.
show does not ungroup
A leaf in another group stays a member while bound as a preview.
Regions differ
surfaceRefForChat marks ungrouped pages right; browserPageInventory marks them center.
Browser windows share one layout
Outside the desktop App there is no window id: every browser window of one origin saves to centerTabs. An open window keeps its layout, but a reload takes whichever window saved last.
Binding is not persisted
Reload loses binding, background and position; leaves return as tabs, and Resources previews reapply.
Navigation in a tab
Action
Result
Open a session
In place in the current session tab or new-tab page; from other page types, select an existing session tab or create one. Reopening the current session adds no history.
Back / Forward
Only the current tab's history, at the far left of the strip; choosing after going back drops forward entries. If the destination conversation is already open in another tab, that tab is selected and the source history stays.
Default entry page
A replaced New tab page stays first in history. Back returns to it without adding a tab.
Application pages
Every route (Settings, Agents, Abilities, Applications, History, Tasks) is a visit in the selected tab, and the label follows it. Unknown routes show their path.
A page has one tab
Visiting a page another tab shows focuses that tab, moved to the route (recordRouteNavigation). Programs, Skills, MCP and Plugins are Abilities; Chats, Projects and Memory are History; every Settings section is Settings.
From inside a split
A page opens in a new top-level tab after the split. A restored member holding a page route leaves its split.
Drafts and titles
History keeps draft ids, input stays keyed by session id. Background ACK and title updates change matching records without activating or appending.
Reload and delete
History persists with version-2 tabs; legacy tabs become single-entry. Sessions confirmed removed leave every history; unloaded records do not count.
pageHistory is the only store: page identity, session metadata, content route and file view, no nested histories, no input or messages. Session legacy history converts on first navigation.
Tab id is the instance, sessionId its current session. Collisions get a unique suffix; a slot whose target already belongs to another tab gets a unique identity.
Route sync reacts to pathname only; markSessionReady handles session ACK; navigation reacts to current-tab sessionId and draft changes.
Native browser URL history stays in browser controls. Web pages keep their own controls. Session history is app state, separate from browser History.
Window transfer checks prepared session history before and after the async ACK; a navigation change cancels a stale transfer, and rollback does not overwrite newer navigation.
Restoring a detail route first loads its exported host route, then replaces the URL before recording the visit. Duplicate activations share one navigation; a late host commit restores the latest target and is not a visit. Detail routes never reload the document on tab switch.
Provider selection derives from the route parameter. A late list response may pick a fallback only on the unqualified page; changing the detail does not reload the catalog.
center-tabs-store.ts composes store/ (state, commit helpers, actions) and navigation/ (pure helpers, selectors). No action module owns a second history.
The strip
Case
Rule
New tab position
Opened from a tab (link, popup, conversation, file or page preview): right of it, in opening order (insertNextTo). Plus button, New chat, background Agent pages: at the end.
Controls
Back, Forward, New tab: 28px wide, 8px gap. An empty tab list takes no space. New tab has no left divider.
Closing the last tab
Allowed. Window and strip stay, content blank, across routes and reloads, with no automatic draft. Session-owned hidden pages stay in Resources and are never the fallback. Close selects visible neighbors after normalizing split groups.
Press and release
Press uses the drag background and blur, changes no page. Release without drag activates by normal click; drag, Escape, cancel or lost focus consumes the click. Focus ring stays.
Drag appearance
Tab and pane-label previews share background, backdrop-filter and shadow variables. Settings → General: transparency 0–100%, blur 0–40px, shadow 0–100%, live preview, Restore defaults. Defaults: 20%, 16px, saturation 1.2, 25% of the original shadow alpha. Text and icons stay opaque.
Remove from group
Takes only that tab out of its split; the other panes stay side by side, and a split left with one pane dissolves. Other splits are never touched.
New window cue
Stays in the strip, above native page bounds: renderer content cannot stack over an Electron child view.
Drag a page onto Resources
A single web tab attaches that exact Page to the visible conversation on release. Targets: the Resources navigation row, plus its body when open; never one combined rectangle. One border matching the target's outer bounds, no blur. Groups, drafts and other kinds are not sources or destinations.
Page attachment and drag settings detail
The server checks owner authorization, the session and the live window/tab/native-target identity from the registered desktop connection, then reuses BrowserResourceStore; no URL copy.
Failure reports an error and does not navigate, detach or fabricate a binding. Connection changes reject stale results. Cancelling sends nothing. Success opens Resources and keeps conversation, page identity, top tab and associations. It does not interrupt another execution's operation.
Preferences live in local storage, normalized; the pre-paint theme script applies them before hydration; storage events sync same-origin windows. Theme changes keep them. Invalid fields use defaults, numbers are clamped, zero disables that effect. Ordinary buttons and Resources outlines are unaffected. Dragging in the strip reorders; outside it transfers windows as before.
What belongs to a window
A window's layout is its own. Nothing a window does to its tabs or splits reaches another window.
Per window, saved under centerTabs:<window id>. A window reads only its own key and no window listens for another's writes, so opening, closing, resizing or changing a split stays in that window.
New window
Starts with the tabs moved into it and no split of its own; it inherits no layout.
Restart
Every window open at quit comes back under the same id (session-windows.js) and restores its own layout.
Unsent input
Per window, saved under that window's id like its layout.
Shared on purpose
Preferences of this device: left sidebar open, right panel open, its view and width, collapsed projects. A window reads them when it loads; changing one never moves an open window. Appearance preferences follow storage events and change every window at once.
Conversation file previews
Chat left, document right, reusing tab groups and DocumentWindow.
Case
Rule
Output rows
Completed live replies show local Markdown links and send_file attachments as compact rows.
Auto-open
First supported output, beside its focused conversation. Never for history, failed or cancelled replies, background conversations. A manual split or dirty preview stays. Same authorized file reuses its tab.
Owner
Project files: project document owner. Other absolute paths: session-checked read-only attachment owner. Content is never executed or embedded as raw HTML, nor authorized by a model-written path.
Refresh
A visible document checks authorized metadata and shows File changed with Refresh. Refresh is always available, reads disk without cache, applies only on success, and never discards local edits, pending publications or rich-editor changes. Hidden panes stop polling; failures keep the old display and offer retry.
One editor per document
File tabs for the same project document share one persistent editor, moved into the active layout with its draft. Closed only when no tab references it. Duplicates visible together offer Show here.
Native window controls
Row
40 CSS px, shared vertical center with arrows and tab controls
Everything above is implemented. Native acceptance still to run on an installed App: interactive floating page (changing counter, click, type, scroll, drag), tab attach to Resources, native control alignment within one DIP at normal zoom, conversation file previews.