Lay out and theme the panel
The panel floats in a corner, docks to an edge of the page, collapses to a pill, or hides. Set where it starts with data-position, data-open and data-mode on its script tag (or <weft-devtools>, a weft:* meta tag or mount()); after that the user’s own placement is remembered per origin. It is light or dark: data-theme decides, else the user’s ◐ choice, else your page’s theme. Every colour, radius and font is a --weft-* custom property your CSS can override.
Dock the panel on the right, open, and pad the page so nothing sits under it:
<script type="module" src="/studio/panel.js" data-weft data-position="right-dock" data-open="true" data-push="true"></script>Install the devtools panel lists every attribute, meta tag and mount() option, and the order they resolve in.


Layout
Section titled “Layout”The panel has four modes:
| Mode | What you see | How it gets there |
|---|---|---|
| float | A 520×560 box in the bottom-right corner (or bottom-left), dragged by its header, resized from its corner between 360×280 and the viewport minus 16 px | the default when open |
| dock | Full height on the left or right edge, or full width on the top or bottom, 460 px across by default and resized along that edge | data-position="right-dock" and the other -dock values, or the header’s ⇆ |
| pill | The collapsed button: the live dot and step count, and the current turn’s cost: · $0.0029 when Studio priced it, else its tokens once the run has finished, · 300 in · 58 out (an unpriced model, or a Studio without the pricing capability); — while it runs | collapsed, the default; data-mode="pill" |
| hidden | Nothing is drawn. The element, its host API and its events keep working | data-mode="hidden"; Alt+W or open() brings it back |
The attributes that set the starting layout:
| Attribute | Values | Default | Effect |
|---|---|---|---|
data-position | bottom-right, bottom-left, right-dock, left-dock, top-dock, bottom-dock | bottom-right | Where the dock starts: the float’s corner, or the docked edge. Changed later, it moves the dock |
data-open | "true" or an empty attribute | collapsed | Start expanded. Read once, when the element first connects: changing it later does nothing |
data-mode | float, dock, pill, hidden | from the two above | The starting mode. float and dock start open; pill starts collapsed. Read once: changing it later does nothing |
data-push | "true" | off | While docked and open, pad <html> on the docked side (below) |
data-z-index | an integer | --weft-z on the element, else 2147483000 | The dock’s and the pill’s z-index |
The header’s ⇆ button, labelled with the current layout (layout: float, layout: dock right), and Alt+Shift+W step through the layouts in one order: float, dock right, dock bottom, dock left, dock top. Under 640 px of panel width the turn list becomes a dropdown and the header’s buttons wrap. Each option says the turn’s status, steps and duration before its title or a replay’s lineage (● parked t3 · 1 step · 23 ms · Deploy…), so a cut title never cuts them. The default 520 px float and the 460 px left or right dock are both that narrow, so they show the dropdown until you widen them; a top or bottom dock is as wide as the viewport. Under a 480 px viewport the panel is a full-width bottom sheet, at most 70 vh tall. The resize handles work with a pointer or touch only.
Push the page aside
Section titled “Push the page aside”data-push="true" is the one write the panel makes to your document, and it is opt-in. While the panel is docked and open, it sets --weft-devtools-inset on <html> to the dock’s size and pads that side by it. As the bottom sheet (under a 480 px viewport) it pads the bottom by 70vh. Docked at the bottom with the default size, <html> carries:
--weft-devtools-inset: 460px; padding-bottom: var(--weft-devtools-inset);The inline padding it replaced, or one your page set meanwhile, is put back exactly when the dock closes, changes mode or disconnects. Padding does not move position: fixed or sticky elements, so keep a fixed composer clear with the same variable:
.composer { bottom: var(--weft-devtools-inset, 0); }Use right, left or top for those docks.
Redraws keep your place
Section titled “Redraws keep your place”The panel patches its DOM in place instead of rebuilding it. A turn row is matched by its run id and a step card by its step ordinal, so while a turn streams only its running step’s card changes. Focus, the caret, the panes’ scroll and the <details> you opened stay where they were, because their nodes stay.
The activity pill
Section titled “The activity pill”The collapsed pill shows the conversation is busy without opening the panel. While the stream the panel already holds lists a run as running, the pill pulses and shows the run’s live step count, ● 3, with the aria-label weft devtools · running, step 3; its title adds — Alt+W. The button’s text always starts devtools. The count is the open tail’s steps when that run is the turn the panel follows, else its row’s; while that is unknown the pill reads ● alone, weft devtools · running. The pulse is a CSS animation, off under prefers-reduced-motion. When the run ends, the next draw is the plain pill again, with the turn’s cost or tokens.


The panel resolves light or dark in this order:
- Explicit:
data-theme="light"or"dark"on the tag or element,<meta name="weft:theme">, ormount({ theme }). The header’s◐button then readstheme: dark, set by the pageand does nothing. - Stored: the user’s
◐choice. Each click steps auto → light → dark → auto; the choice is kept asthemeinlocalStorage["weft.devtools"], and auto clears it. - Auto: your page’s
<html data-theme="dark|light">, else<html class="dark|light">, else<html>’s computedcolor-schemewhen it is exactlydarkorlight, then the system’sprefers-color-scheme, else dark.


data-theme="auto" is the default and means “use steps 2 and 3”. A theme toggle on your page is followed live: one attributes-only MutationObserver on <html>’s class and data-theme, and one media-query listener, both removed on disconnect. The panel only reads <html>. The resolved theme is written to the element as data-theme-resolved, for your own CSS or tests.
Override the colours
Section titled “Override the colours”The palette is Studio’s (studio/web/src/lib/palette.ts), and both themes meet WCAG AA contrast (4.5:1 for text, 3:1 for UI). Every colour, radius and font is a custom property on the panel’s :host. A rule in your page’s CSS beats the shadow tree’s :host, in either theme:
weft-devtools { --weft-accent: #0b6bcb; --weft-font-prose: Georgia, serif;}| Token | Used for |
|---|---|
--weft-bg, --weft-bg2, --weft-bg3 | panes; header, steps and footer; the selected row and fields |
--weft-fg, --weft-dim, --weft-faint, --weft-line | text, secondary text, the faintest text, rules |
--weft-accent, --weft-on-accent | the accent, and text on it |
--weft-warn, --weft-err, --weft-info, --weft-ok, --weft-parked | status colours |
--weft-scrim, --weft-shadow | the ? overlay’s backdrop, the float’s shadow |
--weft-font, --weft-font-prose | ids, JSON and numbers; a step’s text, the prompt and notes (system-ui, sans-serif, no webfont) |
--weft-radius, --weft-radius-sm | corner radii |
--weft-result | a tool result’s tone |
--weft-status-run, --weft-status-run-ink | the running dot, the pill’s pulse and border; the running word |
--weft-z | the default z-index, below data-z-index |
--weft-faint (light), --weft-scrim and --weft-shadow are the panel’s own; the rest equal a Studio variable (--weft-parked is Studio’s status-parked). In light, --weft-bg2 equals --weft-bg, so the header and steps differ from the panes by their rule line only. Devtools panel reference lists them with the panel’s other attributes.
The “Studio not reachable” line sits in your page’s flow: on a mount you made, and since 0.20.0 on the panel’s own dock at a loopback endpoint you named. It takes your page’s text colour, not a theme’s.
Remembered state
Section titled “Remembered state”The panel keeps one JSON object per origin in localStorage["weft.devtools"]:
{"v":1,"mode":"float","side":"right","open":true,"hidden":false,"x":864,"y":324,"w":520,"h":560,"d":460,"run":"s_01…-t3","theme":"","raw":false,"tab":"story","debug":false}| Field | What it holds |
|---|---|
mode, side, open, hidden | float or dock, the docked edge, expanded, hidden |
x, y, w, h | the float’s box, in px |
d | the dock’s size across its edge, in px |
run | the last selected turn, by run id |
theme | the ◐ choice: light, dark, or "" for auto |
tab, raw | the turn’s open tab: story, request, waterfall or raw (a timeline stored before 0.20.0 opens story, or raw when raw is true); raw mirrors it |
debug | the ?weft=debug force-on switch (Install) |
The placement fields (mode through d) are written only once the user places the panel: a toggle, a drag, a resize or a re-dock. Until then your data-* attributes decide on every load; after it, the stored placement wins over them. A document with another v is ignored. Every read and write is guarded, so a private window forgets and the panel still works. To reset everything, including debug:
localStorage.removeItem("weft.devtools")Keyboard
Section titled “Keyboard”Alt+W is the only key the panel listens for on window. Every other key is heard on its shadow root, so it fires only while focus is inside the panel. A key typed into your page never reaches it, and keys typed into the panel’s own fields are typing. Alt+W that opens the dock puts focus in it, so the other keys work at once. ? inside the panel shows the list. Since 0.20.0 a key Studio also binds means the same there: j / k, [ / ], s / w / q / r, o and ? (Studio’s keyboard). / differs: here it filters the turn list or the raw tree, in Studio the runs list only.
| Key | Does |
|---|---|
Alt+W | Toggle the dock from anywhere on the page, except while a text field has focus. Ctrl+Shift+W too, where the browser delivers it |
Alt+Shift+W | Next layout: float, dock right, bottom, left, top |
Esc | Close (the ? list first). It is not stopped, so your page’s own Esc handlers still run |
j / k | Next / previous item of the list in focus (the turns) |
[ / ] | Previous / next step (⤢ carries it); J / K too |
s / w / q / r | The story, waterfall, request or raw tab; again, back to the tab before it |
o | Open the turn and step in Studio, in a new tab; g s too |
/ | Focus the filter: the raw tree’s on the raw tab, else the turn list’s |
← / → | On the tabs: previous / next tab (Home / End: first / last) |
? | The key list |
↓ / ↑ | On a turn row: move the list’s one tab stop (Enter or a click selects) |
Tab | In an open, focused float: wraps from the last control to the first (Shift+Tab back) |
The float is non-modal: it has no backdrop and the page stays live. Its Tab wrap is the panel’s only focus trap, and Esc collapses the dock to leave it. Docked, as a pill or as the bottom sheet, the panel never traps focus.
Accessibility
Section titled “Accessibility”Every control has an ARIA role or label, the turn list has a roving tabindex, and weft’s tests hold the panel to zero axe violations:
| Element | ARIA |
|---|---|
| The dock | role="complementary", aria-label="weft devtools" |
| The turn list | role="list" (aria-label="turns") of role="listitem" rows with a roving tabindex. The selected row has aria-current="true", and each row’s aria-label says it in words: turn 3, parked, Refund order 4411, 1 step, 120 in 30 out, just now |
| The running step’s text | aria-live="polite" with aria-busy="true" while it streams: a screen reader waits rather than re-reading each draw |
| The step-end status | a visually hidden role="status" line, written once when the running step ends: step N finished · n words |
| The turn’s tabs | role="tablist" (aria-label="turn views") of role="tab" buttons with aria-selected and one tabindex="0"; the drawn panel is a role="tabpanel" |
| Expanders | aria-expanded on “how to scope”, a subagent’s summary and each raw tree node |
| Filters | aria-label="filter turns", "status", "filter keys and values" |
| Icon buttons | an aria-label on each: ⤢, ⇆, ◐, –, ↺ and the pill. From 480 px of dock width, ⤢, ⇆ and ◐ also show the words Studio, layout and theme |
| The switcher, the turn dropdown | aria-label="conversation", aria-label="turn" |
| The experiment drawer | every field inside its <label>; selects labelled model, thinking, side effects, engine, thread |
weft’s own test studio/web/src/panel/a11y.test.ts runs axe-core over the panel’s shadow root in its modes, including (float open, docked right, the bottom sheet at 400 px, the pill, the raw tab with its tree open and filtered, the waterfall tab, the experiment drawer, the ? overlay), in both themes, and fails on any violation. jsdom has no layout, so colour contrast is held by theme.test.ts instead. Contrast over your page, focus-ring visibility and real screen-reader announcements are checked by hand in a browser. axe-core is a dev dependency only; panel.js does not contain it.
Complete example
Section titled “Complete example”A page that docks the panel at the bottom, pushes its own layout up, keeps a fixed composer clear, and recolours the accent. With the devtools example running, this is its page with the tag changed:
<!doctype html><html lang="en"><head> <meta charset="utf-8"> <title>Order help</title> <style> .composer { position: fixed; left: 0; right: 0; bottom: var(--weft-devtools-inset, 0); } weft-devtools { --weft-accent: #0b6bcb; } </style></head><body> <h1>Order help</h1> <form class="composer"><input name="text" size="40"> <button>Ask</button></form> <script type="module" src="/studio/panel.js" data-weft data-position="bottom-dock" data-open="true" data-push="true" data-z-index="50" data-theme="dark"></script></body></html>The dock opens across the bottom, dark, under any of your elements with a z-index above 50. The form stays above it. Once you drag, resize or re-dock it, your placement wins over these attributes on the next load, until localStorage.removeItem("weft.devtools").


Best practices & gotchas
Section titled “Best practices & gotchas”- Set the starting layout, then let the user own it. After the first placement the stored layout wins over
data-position,data-openanddata-modeon every load; to see your attributes again, clearlocalStorage["weft.devtools"]. (Source:studio/README.md:1191-1197;panel/layout.ts:79-97) data-modeanddata-openare read once. The element does not observedata-mode, and readsdata-openonly on its first connect; a framework that changes either after mount changes nothing. (Source:panel/element.ts:412-425,904-914)- Keep fixed elements clear with the variable, not the padding.
data-pushpads<html>, which never movesposition: fixedorstickycontent; usevar(--weft-devtools-inset, 0). (Source:studio/README.md:1135) - Override tokens on the
weft-devtoolsselector. Your page’s CSS cannot reach inside the shadow tree, but a rule on the host element sets its custom properties in both themes. (Source:studio/README.md:1153-1160) - Keyboard shortcuts need focus in the panel. Only
Alt+Wworks from the page; the rest fire inside the panel, so they never clash with your app’s keys. (Source:studio/README.md:1199-1207;panel/element.ts:496-499)