@botiverse/porthole 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/bridge/bridge.d.ts +8 -1
  2. package/dist/bridge/bridge.js +7 -0
  3. package/dist/bridge/unseen.d.ts +8 -0
  4. package/dist/bridge/unseen.js +17 -0
  5. package/dist/check/files.js +14 -10
  6. package/dist/check/lint.js +1 -1
  7. package/dist/check/page-source.js +1 -1
  8. package/dist/check/scroll.d.ts +29 -13
  9. package/dist/check/scroll.js +74 -18
  10. package/dist/config/capabilities.d.ts +16 -3
  11. package/dist/config/capabilities.js +1 -0
  12. package/dist/conformance/harness-source.js +1 -1
  13. package/dist/guide/runtime.js +1 -1
  14. package/dist/host/create-host.js +27 -0
  15. package/dist/host/types.d.ts +15 -0
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.js +1 -0
  18. package/dist/platform/focus-guard.d.ts +143 -0
  19. package/dist/platform/focus-guard.js +445 -0
  20. package/dist/platform/types.d.ts +18 -0
  21. package/dist/platform/web.js +22 -0
  22. package/dist/react/frame.d.ts +8 -0
  23. package/dist/react/frame.js +4 -0
  24. package/dist/runtime/requests.js +34 -12
  25. package/dist/runtime/types.generated.js +1 -1
  26. package/docs/ADOPTING.md +85 -6
  27. package/docs/DECISIONS.md +355 -5
  28. package/docs/DESIGN.md +9 -2
  29. package/docs/THREAT_MODEL.md +121 -29
  30. package/package.json +1 -1
  31. package/src/bridge/bridge.ts +17 -1
  32. package/src/bridge/unseen.ts +24 -0
  33. package/src/check/files.ts +14 -10
  34. package/src/check/lint.ts +1 -1
  35. package/src/check/scroll.ts +106 -38
  36. package/src/config/capabilities.ts +16 -3
  37. package/src/guide/runtime.ts +1 -1
  38. package/src/host/create-host.ts +29 -0
  39. package/src/host/types.ts +13 -0
  40. package/src/index.ts +1 -0
  41. package/src/platform/focus-guard.ts +572 -0
  42. package/src/platform/types.ts +17 -0
  43. package/src/platform/web.ts +22 -0
  44. package/src/react/frame.tsx +10 -0
  45. package/src/runtime/requests.ts +36 -14
  46. package/src/runtime/types.generated.ts +1 -1
  47. package/types/runtime/v1/comments.d.ts +8 -4
package/docs/ADOPTING.md CHANGED
@@ -277,7 +277,9 @@ display.on("annotation", (report) => {
277
277
  drawn), so give a draft's id at random like any other; a `kind` other than `"posted"` or
278
278
  `"draft"` throws, as a bad anchor does (React: `onHostError`, kind `"annotations"`). The shell
279
279
  is your content server's: upgrade its Porthole first, or an older shell draws a draft as a
280
- posted mark without a marker.
280
+ posted mark without a marker. The view a draft's `activated` opens is guarded like any (below)
281
+ and puts no "Post", "Submit review" or "Discard" one click away: a page can fake that click on
282
+ the person's own press in the content (P107, P109).
281
283
  - **No drafts to a page that can pass them on**, or accept that it does: a page with the runtime's
282
284
  `db` writes and `user` can store who is drafting where (`user.get()` and the marks it is shown)
283
285
  for its author and other viewers to read before the draft is posted, and tie the posted comment
@@ -290,8 +292,9 @@ display.on("annotation", (report) => {
290
292
  report opens or moves takes no press of any kind for 500 ms after it appears or moves (no
291
293
  `pointerdown`, `pointerup`, `click` or key: menu triggers act on a press, and menu items click
292
294
  themselves on a release), ignores a press that began before that, opens beside the frame rather
293
- than over `rect` where the layout allows, takes no focus, and has no destructive action (resolve,
294
- delete) one click away. Making it `inert` while it arms does all of the first:
295
+ than over `rect` where the layout allows, takes no focus, and has nothing one click away that
296
+ posts, submits, resolves, deletes or discards. Making it `inert` while it arms does all of the
297
+ first:
295
298
 
296
299
  ```js
297
300
  // Call placed() each time the view appears or moves. For 500 ms it takes nothing (inert: no
@@ -342,6 +345,37 @@ display.on("annotation", (report) => {
342
345
  the person can't see; a quote (`exact`) keeps it, to be found again. Hand either to a model only
343
346
  as the page's words.
344
347
 
348
+ ### The keyboard: what a display can take, and what you get
349
+
350
+ Any display can move the keyboard into its frame (`element.focus()` in the page, with no gesture
351
+ on Chromium and WebKit), and what the person goes on typing in your composer or chat box then goes
352
+ to the page. `createHost` (and so `PortholeView`) guards every display (P109): when focus leaves
353
+ one of your page's text fields (a `<textarea>`, an `<input>` that takes text, a `contenteditable`
354
+ region) for a display's frame without the person's press on the frame or a Tab into it, focus goes
355
+ back to the field, and the display tells you; a display that keeps doing it is stopped.
356
+
357
+ ```js
358
+ display.on("focusTaken", ({ typing }) => toast(typing ? "This page tried to take what you were typing." : "This page tried to take the keyboard."));
359
+ display.on("contentError", ({ message }) => log(message)); // "The content kept taking the keyboard from the page; it was stopped."
360
+ // Moving focus into a display yourself (a "focus the page" shortcut): use the display's own move.
361
+ display.focus(); // not frame.focus(): from a text field, that one is taken for the page's and undone
362
+ // Opening your composer focused (on `selected`, say): Porthole's move, not textarea.focus().
363
+ import { focusField } from "@botiverse/porthole";
364
+ focusField(composer.textarea); // Firefox ignores a plain focus() while a fighting frame holds focus
365
+ ```
366
+
367
+ - **Free:** the guard, on by default, with no option. A page gets at most the keys typed before
368
+ focus is back (none or one in a sentence, measured on all three engines); three tries while the
369
+ person types (within 10 s), or five within 2 s, stop the display (`reload()` runs it again).
370
+ - **Yours:** don't move focus from a text field into a display with the frame's own `focus()`
371
+ (use `display.focus()`), nor into your composer with the field's own `focus()` where a display
372
+ may hold focus (use `focusField`: on Firefox a page with the person's gesture that takes focus
373
+ back on its blur keeps a plain `focus()` from landing, and gets the keys); with a platform of your own (a native web view), implement `focused`,
374
+ `onFocusTaken` and `focus` on its surface, or a display can read what is typed beside it; know
375
+ the limits (THREAT_MODEL §7 "The keyboard": on Firefox, which shows your page no press
376
+ in a frame, a page keeps the keyboard if the pointer came over its frame after the person last
377
+ typed and after the field got focus; moves between two frames aren't judged).
378
+
345
379
  ## 4. Served pages: the host kit
346
380
 
347
381
  ### Local development
@@ -525,9 +559,11 @@ handlers: {
525
559
  db: (args, { viewer, declared, instance, changed, signal }) => myApi.db(instance, viewer, args, declared?.rules, { changed, signal }),
526
560
  artifact: (args, { viewer, instance }) => myApi.artifact(instance, viewer, args), // Refused("conflict") when base moved
527
561
  assets: (args, { viewer, instance }) => myApi.assets(instance, viewer, args),
528
- // true if it opened; a draft (P108) is shown whole and editable, posted only on the person's Send,
529
- // the composer armed for 500 ms (THREAT_MODEL §6)
530
- comments: ({ anchor, draft }) => composer.open(anchor, { draft }),
562
+ // true if it opened. Never over the person's own words or place; a page's draft (P108) shown whole,
563
+ // editable, as the page's suggestion, taking no focus, posted only on the person's Send (below)
564
+ // (inUse: the composer holds the person's own words, or a place they chose)
565
+ comments: ({ anchor, draft }) =>
566
+ composer.inUse() ? false : draft === undefined ? composer.open(anchor) : openPageDraft(composer, anchor, draft),
531
567
  },
532
568
  // 5. The mount: what this version declared, within what the artifact declares now; null for a
533
569
  // page published before 0.7 (required under a runtime). Before rendering: a stored
@@ -538,6 +574,49 @@ if (shown && !shown.ok) return <VersionError problems={shown.problems} />; //
538
574
  <PortholeView display="page" instance={instance} declaration={shown ? shown.declaration : null} />
539
575
  ```
540
576
 
577
+ - **A page's draft in your composer** (P108, P109): `comments.open` reaches your handler only from
578
+ a gesture with the person in that frame (a press in it, a Tab into it; not their typing in your
579
+ UI), but the page still picks the moment (the second click of a double click, a field it asked
580
+ them to type into). So the composer it fills is the person's to act on:
581
+
582
+ ```js
583
+ // A composer the page filled: its words are the page's until the person acts in it.
584
+ function openPageDraft(composer, anchor, draft) {
585
+ // Opens beside the frame, and takes no focus: keys stay where the person was typing, so what
586
+ // they type for the page never lands in a postable comment.
587
+ composer.open(anchor, { text: draft, focus: false }); // where your composer focuses, focusField
588
+ // Armed as THREAT_MODEL §6 says: no press of any kind for 500 ms (guardPresses, § Annotations).
589
+ guardPresses(composer.element).placed();
590
+ // Said by you, outside the frame where the page can't draw, until they edit it: never shown as
591
+ // one of their own drafts.
592
+ composer.setNote("Suggested by this page");
593
+ composer.input.addEventListener("input", () => composer.setNote(null), { once: true });
594
+ // Enter sends only once the person has focused or edited the composer themselves (a press in
595
+ // it, a Tab into it, their typing); until then Send is a click. It opened without focus, and a
596
+ // page can't move focus into your page's fields, so its focus is theirs.
597
+ let theirs = false;
598
+ for (const type of ["pointerdown", "focus", "input"]) {
599
+ composer.input.addEventListener(type, () => (theirs = true), { once: true });
600
+ }
601
+ composer.input.addEventListener("keydown", (event) => {
602
+ if (event.key === "Enter" && !theirs) event.preventDefault();
603
+ });
604
+ return true;
605
+ }
606
+ ```
607
+
608
+ - Never over the person's words: while the composer holds their text, or a place they chose,
609
+ answer `false`, or show the page's words as a separate suggestion that takes no focus; never
610
+ replace, append to or retarget what they wrote.
611
+ - Show the draft whole, as plain text (a comment that renders as markdown hides an HTML comment
612
+ or a link definition from readers but not from an agent: render a page-drafted comment as
613
+ plain text, or show before Send what readers will see); show the anchor's `label` and `quote`
614
+ as isolated text (`<bdi>`, `dir="auto"`). Porthole has already refused a draft with anything
615
+ invisible, a line separator or a run of blanks, and taken what can't be seen out of the label
616
+ and quote.
617
+ - Nothing one click away in it, or in a draft's view, posts, submits or discards; your own list
618
+ of a person's drafts (not the frame's markers, which a page can draw too) is how they find
619
+ theirs.
541
620
  - **Built-ins** (`clipboard`, `links`, `downloads`, `comments`) reach every page whose kind offers
542
621
  them; everything else only a page that declared it. A page with no declaration (one published
543
622
  before 0.7) gets the built-ins through `use` and 0.6's globals as before: give it a declaration
package/docs/DECISIONS.md CHANGED
@@ -3033,7 +3033,7 @@ store); `test/runtime.test.ts` (the CSP sources; upload limits and names).
3033
3033
  the public suffix list (CORP becomes defense in depth), or a host needs assets shared across
3034
3034
  artifacts (`copy_from`: a new id in the destination).
3035
3035
 
3036
- ## P090 · 2026-10-18 · Comments from the page: the host's composer at the page's anchor, write-only · Accepted; amended by P091, P108
3036
+ ## P090 · 2026-10-18 · Comments from the page: the host's composer at the page's anchor, write-only · Accepted; amended by P091, P108, P109
3037
3037
 
3038
3038
  **Decision.** `comments` is a built-in (P086) host function served by a handler: `open({ name,
3039
3039
  label?, quote? })` (a name the page chose, ≤ 256 characters, `slide-3`, `refs/a.md#L12`; a label ≤
@@ -5108,7 +5108,7 @@ none`), a host shows right-to-left text (the gutter is on the right), a host nee
5108
5108
  markers itself (then it draws them from `anchored`), an engine changes what gives a page
5109
5109
  activation, or MCP Apps defines annotations.
5110
5110
 
5111
- ## P106 · 2026-10-23 · A page held to one screen by its own styles is warned before it is published · Accepted
5111
+ ## P106 · 2026-10-23 · A page held to one screen by its own styles is warned before it is published · Accepted; amended by P110
5112
5112
 
5113
5113
  From Raft's triage of its Artifacts (task #71): agents' first versions of high-fidelity mockups,
5114
5114
  bundled from an app's own code, carry the app shell's global styles, `html, body { height: 100%;
@@ -5447,7 +5447,7 @@ fact more (a mark is a draft), bounded by the host's duty above.
5447
5447
  third state is asked for (resolved, private: then a state list, still not a style knob), the
5448
5448
  shell gets forced-colors styles, or MCP Apps defines annotations.
5449
5449
 
5450
- ## P108 · 2026-10-26 · A comment's draft from the page: text the composer starts with, never posted by the page · Accepted
5450
+ ## P108 · 2026-10-26 · A comment's draft from the page: text the composer starts with, never posted by the page · Accepted; amended by P109
5451
5451
 
5452
5452
  Amends P090. A page that asks for decisions (Raft's "decision sheet": a card per question with
5453
5453
  "Approve" and "Needs changes" buttons) opens the host's composer at the card with `comments.open`
@@ -5462,13 +5462,18 @@ them (#proj-workspace, 2026-10-26).
5462
5462
  draft that isn't a string does: the shell sends it as the page gave it (options that aren't an
5463
5463
  object send `null`), read after the click's check, so a getter that throws is a rejection. The
5464
5464
  handler gets `{ anchor, draft }`.
5465
- 2. **The rest is P090's.** From a click (`user-activation`, 30 a minute), view level; content hears
5466
- only whether the composer opened; no method reads a thread; the page never posts.
5465
+ 2. **The rest is P090's.** From a gesture (`user-activation`, 30 a minute), view level; content
5466
+ hears only whether the composer opened; no method reads a thread; the page never posts. (The
5467
+ review of 0.12.0, P109: that gate was the host page's activation, which any gesture on it gives
5468
+ for 5 s, the person typing in the host's own composer included, not "a click" in the frame;
5469
+ P109 asks for the person in the calling frame.)
5467
5470
  3. **The host's duties** (THREAT_MODEL §6 and §7, ADOPTING's example): show the draft whole, as the
5468
5471
  person's editable plain text, in its own composer; post it only on the person's Send; arm the
5469
5472
  composer as §6 arms a view the content brought: no press, and no Enter that sends, for 500 ms
5470
5473
  after it opens, Send not focused, beside the frame where the layout allows. Once posted the
5471
5474
  comment is the person's, mentions in it included: that is why they must see it all first.
5475
+ (P109 adds: an open never replaces what the person typed; the composer takes no focus, sends
5476
+ on no Enter until the person has acted in it, and says the text is the page's.)
5472
5477
  `defineRuntimeConformance` checks that the handler takes a draft (answers a boolean); that it
5473
5478
  never posts on its own can't be seen from a handler and is the host's.
5474
5479
 
@@ -5493,3 +5498,348 @@ and reach no handler, a checklist reaches the composer; "comments are write-only
5493
5498
  the anchor). Negative control `comment-draft` (the draft taken as given) → the first case, every
5494
5499
  engine. `types/runtime/v1/check.ts` (the page-shaped call compiles); the runtime conformance's
5495
5500
  comments case sends a draft.
5501
+
5502
+ ## P109 · 2026-10-26 · After the review of 0.12.0's drafts: the keyboard given back, `comments.open` from the frame the person is in, a page's draft the person's to act on, stricter draft text · Accepted
5503
+
5504
+ Amends P090 and P108, and THREAT_MODEL §6 and §7. From the review of P107 and P108 at 0.12.0
5505
+ (2026-10-26: no P0, two P1s, three P2s, two P3s) and the review of the 0.11.0 and 0.12.0 releases
5506
+ (three documentation findings). Both P1s are about the person at the keyboard beside the frame,
5507
+ where P107 and P108 put the person's unposted words (a composer, its drafts) and tell the page when.
5508
+
5509
+ - **D0 (P1).** A framed page calls `focus()` on its own input whenever it likes, and on Chromium and
5510
+ WebKit needs no gesture for it: the keyboard leaves the host's focused composer, and the rest of
5511
+ what the person types goes to the page (measured on all three engines, the take at once, the
5512
+ page's input then holding everything after it). True of every display since 0.1, not only of
5513
+ drafts; nothing in THREAT_MODEL, ADOPTING or the suite named focus as a channel, and §7's "what
5514
+ they wrote stay[s] in the host's own UI" didn't hold.
5515
+ - **D1 (P1).** The `comments` gate was the host page's transient activation, which lasts 5 s after
5516
+ any gesture anywhere on it, typing in the host's own composer included; the shell's click check is
5517
+ the page's own and a raw `porthole/call` skips it (on Firefox, where the person typing in the host
5518
+ gives the frame activation too, the shell's own call passed). So a page opened the composer with
5519
+ its draft every 2 s while the person typed their own comment, never clicked; P108's and §7's "a
5520
+ click to open" was wrong, and nothing said what an open does to a composer that holds the
5521
+ person's words.
5522
+ - **D2–D4 (P2).** The host duties let a page-drafted composer take focus (keys typed for the page
5523
+ land in it) and send on Enter after 500 ms; P107's "no submit, no discard one click away" in a
5524
+ draft's view wasn't in the host docs; nothing asked the composer to say its text came from the
5525
+ page, while the page can draw the person's own draft markers.
5526
+ - **D5, D6 (P3).** The draft's "visible text" kept P100's joiners between shaped letters and in
5527
+ emoji (identical pixels on all three engines: about a bit per letter boundary), U+2028/2029
5528
+ (drawn as nothing on Firefox and WebKit), and blank-looking text; the anchor's label and quote
5529
+ beside the draft weren't checked for any of it.
5530
+ - **R-1–R-3 (docs).** P108's duty wording (R-1, as D1); 0.11.0 was never published (its release
5531
+ stopped at the CI gate) though CHANGELOG and THREAT_MODEL read as if it were, and 0.12.0's notes
5532
+ left out 0.11.0's (R-2); THREAT_MODEL §8 and its status line were stale (R-3).
5533
+
5534
+ **Measured** (served frames on Porthole's own `createHost`, Chromium 153, Firefox 155, WebKit 26.6
5535
+ through Playwright 1.63; WebKit with libraries extracted on a box that lacks them):
5536
+ - What the host's page sees of a move into a frame. Chromium and WebKit blur its window as it
5537
+ happens; at that blur a press on the frame (a click, a held press, a tap) leaves the frame element
5538
+ `:active`, and a page's own `focus()` doesn't; a Tab is the host's own keydown just before.
5539
+ Firefox doesn't blur the host's window and shows no `:active` (false even while a press is
5540
+ held); a focusout on the field wasn't seen in these runs (the review of the guard saw one):
5541
+ `document.activeElement` changes, read at the next animation frame, and the pointer over the
5542
+ frame (`:hover`, `pointerover` on the frame element, for a touch too) is all it shows of a press.
5543
+ - Transient activation lasts 5.04–5.10 s after a gesture on all three, and Playwright's
5544
+ `evaluate` in a frame is a gesture there on all three.
5545
+ - Focus given back inside that blur (synchronously or in a microtask) leaves Chromium and WebKit
5546
+ split: the host's `activeElement` is its text area, the keys still go to the frame (all 47 of a
5547
+ sentence). Given back in a task after, it holds; Firefox takes it back only from a frame that was
5548
+ blurred first.
5549
+ - Nothing the host sets on the frame stops its `focus()`: an `inert` frame took focus 60 times in
5550
+ 2 s on Chromium and Firefox. So focus given back can't stop a page trying again, and each try
5551
+ leaves it the keys typed until focus is back.
5552
+ - With the guard below, a page calling `focus()` every 700 ms, 250 ms, 30 ms or in a busy loop
5553
+ while the person types a 47-character sentence 60 ms a key into the host's text area (one run
5554
+ each, on a loaded box): the composer kept every key on Chromium and WebKit and all but one in one
5555
+ of four runs on Firefox, and the display was stopped after three tries; without it the page got
5556
+ every key after its first try. Each try the guard undoes leaves the page the keys typed until
5557
+ focus is back, which is why it stops a page that keeps trying (point 1).
5558
+
5559
+ **Decision.**
5560
+ 1. **The focus guard** (`src/platform/focus-guard.ts`, in the web platform, so every `createHost`
5561
+ display and `PortholeView` has it, on by default with no option). When focus leaves one of the
5562
+ host page's text fields (a text area, a text-taking `<input>`, an editable region, inside open
5563
+ shadow roots too) for a display's frame, the move is the person's if:
5564
+ - the host moved it (`DisplayHandle.focus()`, new: a frame's `iframe.focus()` called by the host
5565
+ itself would be taken for the page's);
5566
+ - their last key on the page was Tab or Shift+Tab, within a second;
5567
+ - a press on the frame: where the engine tells the move as it happens (Chromium, WebKit), the
5568
+ frame element is `:active`; where it doesn't (Firefox), the pointer is over the frame and came
5569
+ over it after the text field got focus and after the person last typed on the page;
5570
+ - or a gesture the host's own events don't explain: the page has transient activation, and for
5571
+ longer than activation lasts (5 s) it saw no gesture of its own (a key, a press, a click, text
5572
+ typed) and the text field has had focus: the person pressed or activated something in a frame
5573
+ since (an assistive technology's activation moves no pointer and sends the host no key).
5574
+ Anything else is the page's: once the engine has finished the move, focus goes back to the text
5575
+ field (the frame blurred first), and the display hears `focusTaken` (`{ typing }`: a key on the
5576
+ page within the last second; React `onFocusTaken`). Three while the person types within 10 s,
5577
+ or five within 2 s, stop the display, as a frame that keeps navigating away is (P031): a
5578
+ `contentError`, "The content kept taking the keyboard from the page; it was stopped.", and
5579
+ `reload()` runs it again. A page that takes focus once on its own (an input it focuses on load)
5580
+ gets it taken back once, and isn't stopped.
5581
+ 2. **`comments` asks for the person in the calling frame** (`CapabilitySpec.inFrame`): its
5582
+ `user-activation` gate also needs the host page's focus in that frame (`Surface.focused()`),
5583
+ after the guard judged any move into it, so keys that reached the frame before focus went back
5584
+ count for nothing. A press in the frame or a Tab into it gives that focus (measured: a click on
5585
+ a button, on text or in a field puts the host's `activeElement` on the frame, on all three); the
5586
+ person typing in the host's UI, or a gesture in another display, doesn't. Refused as
5587
+ `no-user-activation`. The other gesture-gated functions keep the page's activation alone:
5588
+ `sendPrompt` and `callTool` are confirmed by the person, a copy shows its notice, a link opens a
5589
+ tab; none of them writes into the person's words.
5590
+ 3. **A page's draft is the person's to act on** (THREAT_MODEL §7 and ADOPTING, with code): an open
5591
+ never replaces, appends to or moves what the person typed or the place they chose (answer
5592
+ `false`, or show the page's words as a separate suggestion that takes no focus); a composer the
5593
+ page filled takes no focus when it opens and doesn't send on Enter until the person has focused
5594
+ or edited it themselves (Send is a click until then); it says the text is the page's ("Suggested
5595
+ by this page", drawn by the host outside the frame) until the person edits it, and never shows
5596
+ it as one of their own drafts (the host's own list of drafts is how a person finds theirs, not
5597
+ the frame's markers, which the page can draw too); and a view a frame's report opens, a draft's
5598
+ included, puts nothing one click away that posts, submits, resolves, deletes or discards.
5599
+ 4. **Stricter draft text** (`parseCommentRequest`): a draft is refused for any invisible character
5600
+ but a joiner or non-joiner with a letter or mark on each side (U+200C, U+200D: Persian's
5601
+ می‌خواهم, Hindi's क्‍ष, Malayalam's എന്‍റെ; in any script, since a person's text needs them
5602
+ wherever letters shape) and a variation selector after a pictograph or in a keycap (❤️, 1️⃣):
5603
+ so a joiner first or last, doubled, beside a space or punctuation, or in an emoji sequence
5604
+ (👩‍💻) is refused, where it shapes nothing and hides text or makes a blank-looking draft; a line or paragraph
5605
+ separator (U+2028, U+2029), blank-looking text (only spaces of any kind, blank lines and U+2800),
5606
+ more than 32 blanks in a row, or more than two blank lines in a row. The anchor's `label` and
5607
+ `quote` lose what a person can't see (P105's `withoutUnseen`, and U+2028/2029) and are refused if
5608
+ that leaves them blank: they are shown beside the draft, never posted as the person's words, so
5609
+ they are cleaned as P105 cleans an annotation's label rather than refused.
5610
+ 5. **The docs say what holds** (R-1–R-3): THREAT_MODEL §6 (what every host gets and must do about
5611
+ the keyboard; no action one click away in a draft's view), §7 (the keyboard, the composer's
5612
+ duties, the gate as it is), §8 (the 2026-10-19 review's decisions, all merged) and its status
5613
+ line; CHANGELOG marks 0.11.0 as never published, its changes shipped in 0.12.0, and carries its
5614
+ upgrade notes into the next version's; capabilities.ts says what `user-activation` is.
5615
+
5616
+ **Trust.** What holds, and what doesn't:
5617
+ - A page can still take the keyboard; what it gets is the keys typed until focus is back (none to
5618
+ one in a sentence, measured), and a page that keeps trying is stopped. On Firefox, which tells
5619
+ the host's page nothing of the move or of a press in the frame, the guard reads focus at each
5620
+ animation frame, so the keys typed in that frame go to the page; and a page can keep the
5621
+ keyboard while the pointer rests over its frame if it came over the frame after the person last
5622
+ typed on the page and after the text field got focus (a person who typed, moved the pointer over
5623
+ the frame, and types on without clicking). Accepted, and said in THREAT_MODEL §7.
5624
+ - A false take-back: a press on the frame on Firefox while the pointer has rested over it since
5625
+ before the text field got focus (a composer that opened on a selection in the frame), and an
5626
+ assistive technology's activation within 5 s of the person's own key or press on the page, are
5627
+ taken for the page's, and focus goes back to the text field; the next press once the pointer has
5628
+ left the frame and come back, a Tab, or an activation after those 5 s, is the person's. Firefox also
5629
+ focuses a frame's document but not its field on a press that follows typing in the host, with or
5630
+ without the guard (measured).
5631
+ - Moves between two frames, or into a frame from what isn't a text field, aren't judged: no text
5632
+ of the host's page goes with them (S7 covers a frame beside another).
5633
+ - A host with its own platform (a native web view) has no guard unless it implements `focused`,
5634
+ `onFocusTaken` and `focus` the same way; without `focused`, `comments` keeps the activation gate
5635
+ alone, as before.
5636
+
5637
+ **API.** `DisplayEvents.focusTaken` (`{ typing: boolean }`), `DisplayControls.focus()`,
5638
+ `PortholeFrameProps.onFocusTaken`; `Surface.focused?`, `onFocusTaken?`, `focus?` (the platform
5639
+ seam); `BridgeOptions.focused`; `CapabilitySpec.inFrame`. A draft or an anchor refused before is
5640
+ refused still; some accepted before are refused now (joiners, separators, blank runs), and a label
5641
+ or quote with invisible characters reaches the handler without them.
5642
+
5643
+ **Tested.** `test/focus-guard.test.ts`: `personMoved` per rule, per engine kind, the composer
5644
+ opened on a selection and the Tab window. `test/runtime.test.ts` (D5, D6): the review's payloads
5645
+ refused (a family emoji, a joiner first, last, doubled, beside a space or punctuation, U+2028,
5646
+ U+2029, a draft of U+2800, 1,900 no-break spaces, four blank lines), Persian, Hindi, Bengali and
5647
+ Malayalam with their joiners, ❤️, 1️⃣, 👍🏽 and a checklist pass; a label with a
5648
+ right-to-left override and tags, and a quote with a zero-width space, reach the handler without
5649
+ them, and one with nothing visible left is refused. `leak/served/runtime.spec.ts`, Chromium,
5650
+ WebKit and Firefox: "a page that takes the keyboard while the person types in the host's
5651
+ composer gets a key or two at most, and is stopped" (the pointer resting over the frame, the
5652
+ composer focused by the host as on `selected`, the page's `focus()` every 500 ms); "the person's
5653
+ own moves into the frame keep the keyboard" (a press on its field after typing in the composer, a
5654
+ Tab, an activation in the frame with no host event 5.5 s after the composer's last gesture);
5655
+ "comments.open while the person types in the host's composer reaches no handler, by the page's own
5656
+ call or the shell's; from a press in the frame it does"; "a page that takes the keyboard back on
5657
+ its own blur keeps none of it" (GK-1, below). Negative controls `focus-guard` (every move taken for
5658
+ the person's) → its two probes, and `comments-in-frame` (the focus check out) → its probe, every
5659
+ engine; `focus-guard-watch` (the watch after a take-back out) → the blur probe on Firefox.
5660
+
5661
+ A joiner between two letters that shapes nothing draws as nothing (the review's Devanagari and
5662
+ Arabic payloads, about a bit per letter boundary): accepted, as P100 accepts it, because refusing
5663
+ it refuses Persian and the Indic scripts' ordinary text (the coordinator's call after the first
5664
+ cut refused all joiners). A Malayalam word that ends in an old-style chillu (a virama and U+200D
5665
+ before a space) is refused; the atomic chillus (U+0D7A–U+0D7F) pass.
5666
+
5667
+ **Threat it re-opens.** None: no default, gate or policy loosens. A draft, a label or a quote
5668
+ refused before is refused still.
5669
+
5670
+ **Rejected.**
5671
+ - Making the frame `inert` while the person types (or after a take-back): it doesn't stop a
5672
+ cross-origin frame's `focus()` (measured), and it hides the frame from assistive technology.
5673
+ - Giving focus back inside the blur: Chromium and WebKit then show the text area focused while
5674
+ the keys go to the frame (measured), worse than no guard, since the host believes it.
5675
+ - The pointer over the frame as a press on every engine: the composer that opens on a selection
5676
+ has the pointer resting there, which is the case D0 is about; on Chromium and WebKit `:active`
5677
+ says more, and only Firefox, which says nothing else, falls back to it.
5678
+ - The focus check on every gesture gate: the others don't write into the person's words (above),
5679
+ and pages that call them from a gesture the host's page had (Playwright's evaluate in tests, a
5680
+ host button that forwards a click) would change behavior for no closed threat.
5681
+ - Refusing every joiner in a draft (the first cut): it refused Persian and the Indic scripts'
5682
+ ordinary text; P100's list of shaping scripts instead: any letters may need them, and the
5683
+ hiding needs a place where nothing shapes (a space, punctuation, an edge, a run), which is
5684
+ refused. Stripping rather than refusing: a draft is the page's words in the person's name,
5685
+ which Porthole refuses rather than rewrites (P100); a label and a quote are shown, never
5686
+ posted, so they are cleaned (P105).
5687
+
5688
+ **After the review of the guard** (2026-10-26, GK-1, P1 on Firefox; Chromium and WebKit held
5689
+ against every strategy tried). A page that only takes focus back on its own blur
5690
+ (`field.onblur = () => field.focus()`, no timer, no gesture) beat the guard on Firefox: 38 of 38
5691
+ keys of a sentence reached the frame, `focusTaken` fired once, the display was never stopped, and
5692
+ `comments.open` reached the handler 10 to 13 times. The take-back's `frame.blur()` fires the page's
5693
+ blur, whose `focus()` left Firefox's focus on `<body>`; the next look then took `<body>` for where
5694
+ focus was and stopped looking (it looked only while a text field had focus); and the person's keys
5695
+ went to the frame, so the page saw no typing to count. Now:
5696
+ - **The guard keeps watching after each take-back** (each animation frame, `HELD_MS` 300 ms): focus
5697
+ found in the frame again, or on nothing, is a take-back that failed (after `GIVE_BACK_MS`, 100 ms,
5698
+ for one that hasn't landed yet; at once for one taken again after it landed), given back again
5699
+ and counted as `failed`; the watch ends once focus has stayed in the field, the person presses
5700
+ the host's page or puts focus somewhere of theirs, or the frame presses through as the person's.
5701
+ A move into a text field from a frame is watched the same way, and focus going from a frame to
5702
+ nothing just after the person pressed a text field is taken back to it (on Firefox, a page with a
5703
+ gesture of the person's that fights back leaves focus there; the keys would be lost).
5704
+ - **The guard looks at each animation frame while any frame is guarded**, not only while a text
5705
+ field has focus, so it knows where focus is when it next moves (one read of the focused element a
5706
+ frame), and looks at once after a focusout.
5707
+ - **The stop counts a failed take-back like one made while the person typed**: three of either
5708
+ within 10 s, or five within 2 s. A person's own move never fails a take-back.
5709
+ - **`focused()` asks for the person's own move into the frame**: a frame that took focus when
5710
+ nothing of the host's had it (no press, Tab or unexplained gesture) holds it, but isn't the
5711
+ person's for a gesture gate; and it is false for 1 s after a press on the host's page that came
5712
+ after focus went into the frame (the press gives the page activation before focus leaves it).
5713
+ - **`focusField(field)`** (new export): the host's own move into one of its text fields, for a
5714
+ composer that opens focused. Firefox ignores a host's plain `focus()` while a frame that has a
5715
+ gesture of the person's (the selection that opened the composer) holds focus and takes it back on
5716
+ its blur: no focus event, the keys go to the frame (measured; Chromium and WebKit move it).
5717
+ `focusField` blurs the frame first and has the guard watch that focus lands, a frame that keeps it
5718
+ failing take-backs toward its stop. A host that opens a composer with a plain `focus()` beside
5719
+ such a page on Firefox isn't covered (THREAT_MODEL §7).
5720
+ Measured, the review's probe (`blurOnly`, `blurPlusInterval`, `focusoutOnly`; the person types a
5721
+ 38-character sentence 70 ms a key): Firefox before, 38 of 38 keys to the frame, never stopped, 10
5722
+ opens; after, at most 1 key to the frame, four `focusTaken`, stopped, no open; Chromium and WebKit
5723
+ 0 keys, no open, before and after. A page that fights with a gesture of the person's, the person
5724
+ clicking the composer: Firefox before, every key lost to `<body>` and nothing counted; after, 1 key
5725
+ to the frame, stopped. The host opening its composer with `focusField` beside such a page after the
5726
+ person's selection in it: Firefox, all but one key in the composer, stopped after three failed
5727
+ take-backs; with a plain `focus()`, every key to the frame. The new probes and the honest ones
5728
+ passed three times in a row on all three engines. Rejected: a one-off check of the give-back, or a
5729
+ focusout listener alone (the review tried both: the page's re-take races any single check).
5730
+
5731
+ CI's slower Firefox then failed the blur probe twice ("got ''"). Reproduced on two cores, four
5732
+ workers, 20 runs: 2 failed. The trace: the page's own `focus()` came late (its timer, under load)
5733
+ and met the person's press on the composer; Firefox left focus on `<body>` (not the frame, not the
5734
+ composer), no move the guard judged, so every key was lost to `<body>`, none reached the frame,
5735
+ and nothing was counted. Now a press on a text field that leaves focus on nothing within 300 ms is
5736
+ taken into that field (a take-back the page failed if a frame had focus as the person pressed),
5737
+ and a display stopped mid-fight gives the field focus back if Firefox leaves it on nothing as the
5738
+ frame goes. The probes wait for states (the page armed once its own activation lapsed, the frame
5739
+ holding focus, the fight over) instead of times.
5740
+
5741
+ **Revisit when** an engine stops blurring the host's window on a move into a frame, or shows a
5742
+ press on the frame without `:active`, or Firefox starts doing either (the guard then judges every
5743
+ engine alike); browsers give the embedder a way to stop a frame's `focus()` (Permissions Policy's
5744
+ `focus-without-user-activation`, Chromium-only and experimental today); a host needs drafts in a
5745
+ script whose joiners shape; or MCP Apps defines focus between a host and a view.
5746
+
5747
+ ## P110 · 2026-10-26 · After the audit of P106: the scroll-lock rule fails soft, reads only the sheets it may, and sees a fixed body · Accepted
5748
+
5749
+ Amends P106. The audit of 0.12.0 (2026-10-26, part "scroll") found no isolation surface in P106
5750
+ (text in, a string out, on the host's side) and five findings about what a page's text does to the
5751
+ call, and what it misses.
5752
+
5753
+ **Decision.**
5754
+ 1. **A CSS escape is read as CSS Syntax reads it** (S1). An escape of 0, a surrogate or past
5755
+ U+10FFFF (six hex digits reach U+FFFFFF) is U+FFFD. `String.fromCodePoint` threw on the last:
5756
+ one selector like `.\ffffff`, in a page, a linked sheet or a page past the entry, threw out of
5757
+ `lintContent`, `admitContent`, `lintFiles`, `admitFiles` and `checkPage`, and so failed the
5758
+ show or publish of a page browsers accept (0.10.0 had no such path).
5759
+ 2. **The rule fails soft.** It is advisory, so a throw inside it is that page not checked, never
5760
+ a failed lint: `scrollLock` catches it and says "The page wasn't checked for scroll lock: its
5761
+ styles couldn't be read. If it holds html, body or its root to one screen (…), let it scroll
5762
+ as a document.", a warning with the page's path and no line. The other pages of a version are
5763
+ still checked.
5764
+ 3. **Only the sheets the rule may read are asked for and decoded** (S2). A linked sheet is found
5765
+ with the fewest characters it may hold first (`LinkedSheet` gives `{ path, least, text() }`:
5766
+ a string's length; as bytes, a third of them less a BOM's, as UTF-8 takes at most 3 bytes a
5767
+ character), so `take` refuses one whose fewest characters are already past what's left (32
5768
+ sheets, a page's 4 MiB, the version's 8 MiB) before its text is decoded; once a page has read
5769
+ 32 sheets or 4 MiB, or the version's budget is spent, no sheet more is asked for. Otherwise it
5770
+ is decoded (as bytes, at most the 6 MiB that hold its first 2 MiB of characters), cut to 2 MiB
5771
+ of characters, and charged what it holds, or dropped if that doesn't fit. The caps count
5772
+ characters, as they did, whether the host gives strings or bytes: the first cut of this
5773
+ charged and cut a sheet given as bytes by its bytes, and the re-review showed that reads less
5774
+ in a way that also warns wrongly (an override past 2 MiB of a non-ASCII sheet's bytes, or in a
5775
+ sheet past the page's 4 MiB of them, went unread, and the hold before it was warned; as
5776
+ strings, the same version was silent). `lintFiles` keeps no decoded sheet past its read (it
5777
+ kept every one for the set).
5778
+ Measured with the audit's shape (one page linking 400 sheets of 240 KB, each with one CJK
5779
+ character, as bytes, 96 MB; node 24, arm64): before, out of memory under a 64 MB heap, and with
5780
+ 2 GB 209 MB of heap in use after the call, 445 MB peak RSS, 922 decodes of 198 M characters;
5781
+ after, it runs under a 32 MB heap, 28 MB in use after the call under 64 MB, 259-269 MB peak
5782
+ RSS (220-237 MB with the page linking none), 539 decodes of 104 M characters (522 and 100 M linking
5783
+ none: the rest is the 17 sheets that fit 4 MiB).
5784
+ 4. **A fixed body holds the page whatever its height** (S3), and **body's own overflow is the
5785
+ viewport's where html's is visible**. A fixed box adds nothing to what the frame scrolls, so
5786
+ `body { position: fixed; top: 0; left: 0; right: 0 }` (the scroll-lock libraries' way, as
5787
+ static CSS) holds it, as does `body { position: fixed; inset: 0; overflow: auto }` with html's
5788
+ overflow visible: the viewport takes body's `auto`, and body itself doesn't scroll. Both are
5789
+ warned now ("body (position: fixed) holds it to one screen …: add body { position: static }
5790
+ after those rules"). Where html's overflow isn't visible, body's own overflow decides, as
5791
+ before: `html { overflow: hidden } body { position: fixed; inset: 0; overflow: auto }`
5792
+ scrolls in body, and isn't warned. Measured on Chromium, Firefox and WebKit (WPE, with the
5793
+ audit's extracted libraries; a cross-origin 600x400 frame, a 3,050 px page, twelve wheel
5794
+ steps): both held on all three; with html hidden, and with `top: 0; height: 100%; overflow:
5795
+ auto` under html hidden, the end is reached on all three, and the rule is silent.
5796
+ 5. **The quirks-mode case is not one in Porthole** (S4). The audit's false warning,
5797
+ `html { overflow: hidden } body { height: 100%; overflow: auto }` with no doctype, scrolls
5798
+ when the page is its own document in quirks mode (body's 100% is then the frame's). Porthole
5799
+ never shows it so: every page, a version's files included, is rendered into the shell's
5800
+ `<!doctype html>` document (its head and body imported, `renderDocument`), which stays in
5801
+ standards mode. The same page rendered that way is held on all three engines (compatMode
5802
+ `CSS1Compat`), so the warning is right there, and the doctype is rightly not read.
5803
+ 6. **Not html's `style=""`** (the re-review, from P106). The shell imports a page's html
5804
+ attributes but `style` (`renderDocument`), so `<html style="height: 100%; overflow: hidden">`
5805
+ never applies in Porthole's frame: such a page scrolls on Chromium, Firefox and WebKit as the
5806
+ shell renders it (held only as a raw document). The rule warned it, and told the agent to edit
5807
+ the attribute, which would change nothing; it no longer reads it. Body's and the root's
5808
+ `style=""` are imported, and still read.
5809
+ 7. **The budget test has the minute its neighbours have** (S5), as do the two timing tests in
5810
+ `check.test.ts` (one took 5.5 s, past the default 5 s, at a load of 23): their own bounds are
5811
+ what they check.
5812
+
5813
+ **Why.** P106's rule is advice: whatever a page holds, it should cost what P106 says it costs and
5814
+ never stop a show or a publish. The fixed body is the one hold the audit found that every engine
5815
+ agrees on and that has no reading other than "held".
5816
+
5817
+ **Rejected.**
5818
+ - *The root fixed without a height as held too* (the audit's `#root { position: fixed; top: 0;
5819
+ width: 100% }`, held on all three engines): a card centered on the screen, `#root { position:
5820
+ fixed; top: 50%; left: 50%; transform: … }`, is the same shape and meant to fit; it would be
5821
+ warned for nothing. Nor html fixed: not measured, and not seen in pages. Both stay misses.
5822
+ - *Reading the doctype for quirks mode* (the audit's fix): the page is never in quirks mode in
5823
+ Porthole's frames (above); it would trade a right warning for a miss.
5824
+ - *A cache of decoded sheets for the version* (as before): a sheet two pages link is decoded for
5825
+ each now, which the version's 8 MiB already bounds; the cache held every linked sheet.
5826
+
5827
+ **Limits.** Added to P106's: the root or html fixed without a one-screen height; a fixed body
5828
+ without one, with its own `overflow: auto`, under an html of `overflow: auto` or `scroll` (body
5829
+ grows with what it holds, so likely nothing scrolls; taken as scrolling itself, not warned). Where a throw makes a page "not checked", the hold
5830
+ it may have is said only as that warning.
5831
+
5832
+ **Tested.** `test/check.test.ts` (P110): `\ffffff`, `\110000`, `\d800`, `\0` and `\10ffff` in a
5833
+ class and an id lint and admit; `\ffffff`, `\110000`, `\dfff` and `\0` read as U+FFFD (a
5834
+ `body.\ffffffx` rule holds a `<body class="�x">`); a fixed body with `top: 0` and no height warned (the message and
5835
+ the fix), with `inset: 0; overflow: auto` warned, neither under html hidden, a fixed root without
5836
+ a height not; html's `style="height: 100%; overflow: hidden"` not warned, body's
5837
+ `style="overflow: hidden"` warned. `test/files.test.ts`: one page linking 400 sheets asks for 32
5838
+ and decodes 32; of 240 KB each, decodes the 17 that fit 4 MiB, the rest asked for their fewest
5839
+ characters only; the re-review's two versions of megabytes of CJK CSS (an override past 2 MiB of a
5840
+ sheet's bytes, and one in a third sheet past 4 MiB of bytes) silent as strings and as bytes; a sheet finder
5841
+ that throws gives the "wasn't checked" warning; `admitFiles` with `\ffffff` in a linked sheet and
5842
+ `\110000` on a second page admits it, the hold after the escape found.
5843
+
5844
+ **Revisit when** a page's own document is ever shown outside the shell (then quirks mode is real),
5845
+ or an engine starts counting fixed boxes in what the viewport scrolls.
package/docs/DESIGN.md CHANGED
@@ -629,8 +629,9 @@ What both adopters still wrote after 0.2 moves into Porthole (ADOPTING.md is the
629
629
  `document.write`. Warnings for the rest: a document sent as a widget (taken as its body,
630
630
  `fragmentOf`), the clipboard, dialogs, forms, hosts outside egress, unpinned CDN libraries,
631
631
  `position: fixed` in a flow layout, new windows without `openLink`, the page's own styles
632
- holding it to one screen (P106: `src/check/scroll.ts`, a cascade of html, body and the root's
633
- overflow, height and position; `lintFiles` reads the version's linked stylesheets too).
632
+ holding it to one screen (P106, P110: `src/check/scroll.ts`, a cascade of html, body and the
633
+ root's overflow, height and position; `lintFiles` reads the version's linked stylesheets too,
634
+ only those within its caps; advisory, so a throw in it says the page wasn't checked).
634
635
  - **`admitContent(config, content, { refuseOn })`**: the show tool's gate. It refuses errors by
635
636
  default with a text that says what to change; otherwise it shows the content (a widget's
636
637
  document taken as its body) and returns the warnings as a note.
@@ -991,6 +992,9 @@ for that to lapse and click with raw input.
991
992
  | The runtime: per-user data (P088) | `dbAccess`: `me` is the host's id; another's `data/users/<id>`, or anything else under `data`, refused at every level, in the bridge and the host | `test/runtime.test.ts`; `leak/served/runtime.spec.ts`: "a person's own data is theirs" | `db-private` → that case (all three) |
992
993
  | The runtime: comments write-only (P090) | the bridge answers `comments` with `true` only for a handler's `true`; no read method | `test/runtime.test.ts`; `leak/served/runtime.spec.ts`: "comments are write-only" | `comments-result` → that case (all three) |
993
994
  | The runtime: a comment's draft is visible text (P108) | the bridge refuses a draft that isn't a string, is blank, past 2,000 characters, or holds what a person can't see (`unseen`), before any handler | `test/runtime.test.ts`: "a draft (P108)"; `leak/served/runtime.spec.ts`: "a comment's draft is the host's to check" | `comment-draft` → that case (all three) |
995
+ | The runtime: a draft is visible text, strictly; the anchor beside it cleaned (P109) | a draft with a joiner (U+200C, U+200D) anywhere but between two letters or marks (first, last, doubled, beside a space or punctuation, in an emoji sequence), a line or paragraph separator, blank-looking text, more than 32 blanks or two blank lines in a row is refused; the label and quote lose what a person can't see, refused if nothing visible is left | `test/runtime.test.ts`: "a draft is visible text, strictly (P109)" | — (unit-tested: the bridge's own check, behind `comment-draft`'s) |
996
+ | The keyboard: the focus guard (P109) | a move of the keyboard from one of the host page's text fields into a display's frame that the person didn't make (no press on the frame, `:active` on Chromium and WebKit, the pointer coming over it on Firefox; no Tab; no gesture the page's own events don't explain) is undone once the move is over; three while typing within 10 s, or five within 2 s, stop the display | `test/focus-guard.test.ts`; `leak/served/runtime.spec.ts`: "a page that takes the keyboard while the person types in the host's composer…", "a page that takes the keyboard back on its own blur keeps none of it…" (GK-1), "a composer the host focuses with focusField…", "the person's own moves into the frame keep the keyboard…" | `focus-guard` → the first (all three) and the next two (Firefox); `focus-guard-watch` (the watch after a take-back, the look at every frame) → those two (Firefox) |
997
+ | The runtime: `comments.open` from the frame the person is in (P109) | its `user-activation` gate also needs the host page's focus in the calling frame (`CapabilitySpec.inFrame`, `Surface.focused`), after the focus guard | `leak/served/runtime.spec.ts`: "comments.open while the person types in the host's composer reaches no handler…" | `comments-in-frame` → that case (all three) |
994
998
  | The asset library (P089, P091) | `/_blob/<id>` (or the frame's `<sealed base>__porthole/blob/<id>`) for an access to its artifact (a cookie, a sealed `Referer`, the sealed path), then the host's check, the store asked with it; typed by name, never a page, code only where trusted and uploaded code may run (asked at each load; by id alone, every artifact config must, P103), inert CSP, CORP, revalidated; the page's CSP opens `<origin>/_blob/` for images, media, fonts and data, for scripts and styles only where uploads are the admins' | `test/assets.test.ts` (a forged same-origin claim: 401; another artifact's session: 404; revoked: 403; bearer mode; a stricter config turns trusted code into a download, bearer mode too); `leak/served/runtime.spec.ts`: an upload loads in its frame; a set's page loads it; static `/_blob/` in a frame by `Referer` (Chromium, Firefox; WebKit sends only the origin: measured); "a script asset runs as code only if an admin uploaded it"; "scripts load from /_blob/ only where uploads are the admins'"; "an asset reaches only its own artifact's pages"; "an asset opened on its own runs nothing" | `blob-trusted` → the trusted-code case; `blob-script,blob-trusted` (two walls) → that case and the tab's CSP case; `blob-inert` → the opened-on-its-own case (all three; `scripts/controls.ts`) |
995
999
  | Workers (P044, P045) | no Node module in `/server`; D1 tickets taken by one `DELETE … RETURNING` | `test/workers.test.ts` (workerd, no `nodejs_compat`, real D1: once per ticket, a race, anonymous, a revocation, flat names, reserved namespaces) | — |
996
1000
 
@@ -1459,6 +1463,9 @@ control the tables above name to the registry):
1459
1463
  | `live-held-read` | `served/runtime.spec.ts` | `a read above the viewer's level: a result the host pushed is refused as a cold read is` | — | — |
1460
1464
  | `db-private` | `served/runtime.spec.ts` | `a person's own data is theirs: another person's is refused, never reaching the service` | — | — |
1461
1465
  | `comments-result` | `served/runtime.spec.ts` | `comments are write-only: the composer opens from a click, content hears only that` | — | — |
1466
+ | `focus-guard` | `served/runtime.spec.ts` | `a page that takes the keyboard while the person types in the host's composer gets a key or two at most, and is stopped` | Firefox: `a page that takes the keyboard back on its own blur keeps none of it: the composer keeps its words, and comments.open reaches no handler`, `a composer the host focuses with focusField, beside a page with the person's gesture that takes focus back on its blur, gets their words` | — |
1467
+ | `focus-guard-watch` | `served/runtime.spec.ts` | nothing | Firefox: `a page that takes the keyboard back on its own blur keeps none of it: the composer keeps its words, and comments.open reaches no handler`, `a composer the host focuses with focusField, beside a page with the person's gesture that takes focus back on its blur, gets their words` | no probe can see it on Chromium and WebKit: they blur the host's window on every move into a frame and a take-back lands, and a page can't take focus back from its own blur there (measured) |
1468
+ | `comments-in-frame` | `served/runtime.spec.ts` | `comments.open while the person types in the host's composer reaches no handler, by the page's own call or the shell's; from a press in the frame it does` | — | — |
1462
1469
  | `comment-draft` | `served/runtime.spec.ts` | `a comment's draft is the host's to check: past the limit, holding what a person can't see, or not text, it opens no composer (P108)` | — | — |
1463
1470
  | `blob-script` | `served/runtime.spec.ts` | nothing | — | an untrusted script asset is served as a download (`blob-script,blob-trusted`) |
1464
1471
  | `blob-trusted` | `served/runtime.spec.ts` | `a script asset runs as code only if an admin uploaded it where uploads are the admins'` | — | — |