The forge toolbar
A small pill the app proxy adds to an app's pages (production and every pull's preview), so you always know where you are and can get back to the forge.
- Where it goes: into an HTML page the app sent whole and uncompressed,
once, before the last
</body>(at the end when there is none). JSON, images, scripts, styles, attachments, ranges andHEADpass through byte for byte. A page that already carries the tag is not given a second. - What it says: the app, the environment and, on a preview, a link "Pull #N: <state>" to the pull's page on the forge; Home goes to the forge.
- The preview line: on a preview the pill's panel has one link to the pull, "Pull #N: checking", "Pull #N: green" or "Pull #N: red" (running or queued reads checking; also "cancelled" and "no check yet"), with the title as its tooltip, set as text. The state is the newest check of the pull's head, read when the page loads: it updates on reload only, never polled. Production has no such line.
- Comment on the pull: a preview's panel also has a comment box, built by a small script of its own (
src/apps/toolbar_comment.ts, under 4 KB) that the pill fetches from the app's host the first time a preview's panel opens; production pages and a closed pill never load it, and the pill keeps its 24 KB budget. A viewer the tag names as signed out (data-inabsent) sees "Sign in to comment on this pull", which goes through/__forge/signinand back to the page, instead of a box. The box postsPOST /__forge/commentwith{ text }, same-origin and with the page's proof, and the comment lands on the pull the environment's name gives (pull-N; never a number from the body), as the person the app's grant names. Words: signed out is401("Sign in to the forge to comment on this pull."); production, an unknown number or a non-pull is404; empty text is400, and so is text over 4000 characters (COMMENT_MAX, the box'smaxLengthtoo) withbody_too_long; too many is429withRetry-After(6 a minute for a person, 20 for a socket address, so a script holding one proof cannot flood the pull's author). A refused comment keeps what was typed and says why under the box; only a posted one clears it, and its "Commented on pull #N." links to the address the door answered with (only when that is on the forge's origin). The terminal already comments on a pull (src/tui/screens/pull.ts), so this is a page-only surface. Seesrc/apps/pull_comment.ts. - Which commit: one more line,
Serving a1b2c3d, thenLive since 4 min ago(its title is the exact UTC time;· behind mainfollows on production when its default branch has moved on, fromdata-lagging), the short id linked to the commit on the forge. The id and the instant come from the forge's own record of the running environment (the same source as the note's build), never the client's; they travel as escapeddata-commitanddata-liveattributes and are set as text. Only a reader of the repository gets them, and with no running record the line is left out. - Make it yours: on a public app, a reader who is not on its crew sees
one more link, "Make it yours", to the forge's own make-it-yours page for
that app (no new route), opened in the same tab. Signed out, that page asks
for sign-in and returns to itself. The owner, any member who can write, a private app and a sealed
pull's preview see none. A read-only member of a public repository is
offered it (they cannot write, so there is something to fork); a suspended,
removed or unknown account is not, while a signed-out reader is. The pill is
a page-only surface: the terminal already has make-it-yours
(
src/tui/screens/yours.ts). Who the reader is comes from the app's own grant, read by/__forge/crew, never from the page. - What a note carries: a note sent from the pill also carries where it came
from, folded at the foot of the issue under a closed "Context" block: the
page, the viewport, the build the app is serving (from the forge's own record of the running
environment, never the client's word) and up to five recent console errors
(
console.error, uncaught errors and unhandled rejections, message text only). Each error is cut to 200 characters, control characters, URL queries and anything shaped like a token, password or key are taken out on the server, and the whole is bounded by the request cap. The page and viewport are checked by the server and shown as inline code. The sender sees nothing new; the fold is closed until opened. - No layout shift: it is
position: fixedinside a closed shadow root and adds nothing to the page's flow or style sheets. - Escaping: app and pull names travel as escaped
data-*attributes and are set as text, never as markup. - Content-Security-Policy: the script is served from the app's own host
(
/__forge/toolbar-<hash>.js), soscript-src 'self'admits it, and an app's nonce is copied onto the tag. A policy that admits neither leaves the pill out; the app still works. - Off:
"toolbar": falseinforge.json.
Moving the toolbar
The pill sits bottom-right until you move it. Three ways, all the same move:
- The panel button: "Move to the other side" in the open panel swaps left and right and keeps the height. It sits in the panel, so the pill itself does not change size; it is the last tab stop, after Close.
- Arrow keys: with the pill focused, Left and Right choose the side, Up and Down the top or bottom.
- Drag: drag the pill to a corner; it snaps to the nearest one.
Each move is announced to screen readers ("Moved to the top right"). The corner is remembered per app origin in the browser (forge-pill-corner), independent of dismissal; an unknown stored value falls back to bottom-right. test/toolbar-swap.test.ts.
Tests: test/toolbar-injection.test.ts, test/apps-toolbar.test.ts, test/note-context.test.ts, test/apps-feedback.test.ts, test/apps-toolbar-yours.test.ts, test/toolbar-serving.test.ts, test/toolbar-where.test.ts, test/toolbar-budget.test.ts.
By keyboard and screen reader
The pill is a button named for the app and where it runs, with aria-expanded. Enter or Space opens the panel and moves focus to the note field; Escape closes it and returns focus to the pill. The note form and its field have labels, and the line under Send is role="status", set as text, so "Sent" or the refusal is announced and never parsed as markup. test/toolbar-keyboard.test.ts asserts this from the shipped script (and in a real Chromium where one runs).