@botiverse/porthole 0.12.0 → 0.14.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 (94) hide show
  1. package/dist/annotate/types.d.ts +32 -3
  2. package/dist/annotate/types.js +4 -0
  3. package/dist/annotate/validate.js +19 -2
  4. package/dist/bridge/bridge.d.ts +8 -1
  5. package/dist/bridge/bridge.js +7 -0
  6. package/dist/bridge/unseen.d.ts +8 -0
  7. package/dist/bridge/unseen.js +17 -0
  8. package/dist/check/files.js +14 -10
  9. package/dist/check/lint.js +1 -1
  10. package/dist/check/page-source.js +1 -1
  11. package/dist/check/scroll.d.ts +29 -13
  12. package/dist/check/scroll.js +74 -18
  13. package/dist/compile/policy.d.ts +7 -0
  14. package/dist/compile/policy.js +13 -1
  15. package/dist/config/capabilities.d.ts +16 -3
  16. package/dist/config/capabilities.js +1 -0
  17. package/dist/config/schema.d.ts +11 -0
  18. package/dist/config/validate.js +19 -0
  19. package/dist/conformance/harness-source.js +1 -1
  20. package/dist/displays/displays.js +3 -1
  21. package/dist/guide/limits.js +1 -1
  22. package/dist/guide/runtime.js +1 -1
  23. package/dist/host/create-host.d.ts +2 -0
  24. package/dist/host/create-host.js +100 -3
  25. package/dist/host/pass-on.d.ts +15 -0
  26. package/dist/host/pass-on.js +65 -0
  27. package/dist/host/types.d.ts +37 -0
  28. package/dist/index.d.ts +5 -1
  29. package/dist/index.js +5 -1
  30. package/dist/isolation/types.d.ts +8 -0
  31. package/dist/isolation/types.js +8 -0
  32. package/dist/platform/focus-guard.d.ts +212 -0
  33. package/dist/platform/focus-guard.js +620 -0
  34. package/dist/platform/types.d.ts +25 -0
  35. package/dist/platform/web.js +80 -2
  36. package/dist/presets/presets.d.ts +2 -0
  37. package/dist/presets/presets.js +1 -0
  38. package/dist/react/frame.d.ts +8 -0
  39. package/dist/react/frame.js +4 -0
  40. package/dist/runtime/requests.js +34 -12
  41. package/dist/runtime/types.generated.js +1 -1
  42. package/dist/server/files.js +19 -3
  43. package/dist/server/index.d.ts +1 -0
  44. package/dist/server/index.js +4 -0
  45. package/dist/server/nested.d.ts +37 -0
  46. package/dist/server/nested.js +70 -0
  47. package/dist/server/server.js +57 -7
  48. package/dist/shell/annotate.d.ts +1 -1
  49. package/dist/shell/annotate.js +157 -7
  50. package/dist/shell/frame.d.ts +45 -0
  51. package/dist/shell/frame.js +250 -0
  52. package/dist/shell/plan.js +2 -1
  53. package/dist/shell/runtime.js +49 -14
  54. package/docs/ADOPTING.md +140 -7
  55. package/docs/ARCHITECTURE.md +23 -0
  56. package/docs/DECISIONS.md +564 -5
  57. package/docs/DESIGN.md +18 -2
  58. package/docs/THREAT_MODEL.md +192 -30
  59. package/package.json +1 -1
  60. package/src/annotate/types.ts +28 -3
  61. package/src/annotate/validate.ts +23 -2
  62. package/src/bridge/bridge.ts +17 -1
  63. package/src/bridge/unseen.ts +24 -0
  64. package/src/check/files.ts +14 -10
  65. package/src/check/lint.ts +1 -1
  66. package/src/check/scroll.ts +106 -38
  67. package/src/compile/policy.ts +14 -1
  68. package/src/config/capabilities.ts +16 -3
  69. package/src/config/schema.ts +11 -0
  70. package/src/config/validate.ts +23 -0
  71. package/src/displays/displays.ts +3 -1
  72. package/src/guide/limits.ts +1 -1
  73. package/src/guide/runtime.ts +1 -1
  74. package/src/host/create-host.ts +105 -4
  75. package/src/host/pass-on.ts +73 -0
  76. package/src/host/types.ts +33 -0
  77. package/src/index.ts +5 -1
  78. package/src/isolation/types.ts +12 -0
  79. package/src/platform/focus-guard.ts +815 -0
  80. package/src/platform/types.ts +24 -0
  81. package/src/platform/web.ts +96 -2
  82. package/src/presets/presets.ts +3 -0
  83. package/src/react/frame.tsx +10 -0
  84. package/src/runtime/requests.ts +36 -14
  85. package/src/runtime/types.generated.ts +1 -1
  86. package/src/server/files.ts +19 -3
  87. package/src/server/index.ts +10 -0
  88. package/src/server/nested.ts +86 -0
  89. package/src/server/server.ts +65 -6
  90. package/src/shell/annotate.ts +157 -7
  91. package/src/shell/frame.ts +268 -0
  92. package/src/shell/plan.ts +2 -1
  93. package/src/shell/runtime.ts +49 -14
  94. package/types/runtime/v1/comments.d.ts +8 -4
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,557 @@ 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.
5846
+
5847
+ ## P111 · 2026-10-28 · A nested page: Porthole's shell at the framed address, the page its opaque child, and the shell's own activation decides the keyboard and `comments.open` · Accepted
5848
+
5849
+ **Context.** P109's focus guard and `comments.open`'s gate ask whether the person, not the page,
5850
+ moved the keyboard into a frame or clicked in it. In full Chromium a cross-site frame is out of
5851
+ process, and the host's page sees nothing of a press in it: measured on Chromium 153 (2026-10-28,
5852
+ not the headless shell Playwright runs by default), no `:active`, no `:hover`, no pointer event past
5853
+ the frame's edge, only its window blurring with its own activation on, which a page's `focus()`
5854
+ after the person typed in the host also gives. So a person's real click into a page's field was
5855
+ taken back every time (the display stopped at the third), and `comments.open` from a real click was
5856
+ refused within 5 s of any input on the host's page (porthole#53). WebKit keeps these frames in
5857
+ process (`:active` holds there) and was right. Nothing in the page's realm can be asked instead:
5858
+ in every mode before this one, the shell's runtime and the page share a document (served, opaque,
5859
+ the MCP proxy), so whatever the shell would report, the page could post from the same window
5860
+ (ARCHITECTURE "Trust boundaries" 4, P053).
5861
+
5862
+ **Decision.** A config may nest its artifact pages (`nested: true`: domain isolation, artifact
5863
+ mode). The address the host frames (a ticket's answer, a cookie's reload, an entered address)
5864
+ answers Porthole's shell alone, a document with no content in it, on the content origin, its script
5865
+ the only one its CSP runs (by hash), framing and fetching only the origin's sealed files' prefix.
5866
+ The shell frames the page in a child `<iframe sandbox="allow-scripts">` at the page's sealed address
5867
+ (P083); the page's answer carries the same sandbox in its CSP, so on a tab of its own it is opaque
5868
+ too. The page is the served page as before (the shell's runtime and its document), but its origin
5869
+ is opaque, its storage the runtime's in-memory stand-in, and it hears its parent, the shell, on the
5870
+ content origin; it never fetches with a cookie. The shell:
5871
+ - passes every message between the host and the page unchanged, the page's trusted by
5872
+ `event.source` alone (its origin is "null"), and drops any the page sends in the shell's own
5873
+ namespace (`porthole/shell/`);
5874
+ - tells the host its own state (`porthole/shell/state`: its transient activation and how long ago
5875
+ it turned on, and whether focus is in it), read each animation frame, on its focus and blur, and
5876
+ before each message of the page's is passed on. Activation goes up to ancestors, never down: a
5877
+ press or key in the page turns the shell's on, and nothing on the host's page does;
5878
+ - renews the page's sealed address (`<base>__porthole/renew`, same-origin, as P083 asks) and gives
5879
+ the page the new one (`porthole/files-renewed`), which the page's own loads can't (an opaque
5880
+ origin's are never same-origin).
5881
+ The host knows a frame is nested from its config only, never from the frame. For such a frame the
5882
+ focus guard's rule is: the person moved focus in if the shell's activation turned on within the
5883
+ last second (`SHELL_GESTURE_MS`) and the host's page had no trusted pointerdown or keydown of its
5884
+ own since; or by Tab, or the host's own move, or (where the engine shows it) a press on the frame
5885
+ element. No pointer-over or host-wide activation cue counts for it. A move the shell hasn't spoken
5886
+ of yet waits for its word (it comes at the shell's next frame, after the host heard the move) at
5887
+ most `SHELL_WAIT_MS` (500 ms), then is taken back. The same signal opens `comments.open`: its
5888
+ gate's "person in this frame" holds while the shell saw that gesture, or focus is in the frame by
5889
+ the person's move. An engine whose shell has no `navigator.userActivation` keeps 0.13's rule. A
5890
+ `storage` event tells the host, once per run, whether the page touched `localStorage` or
5891
+ `sessionStorage` (the page's word; never a key or a value).
5892
+
5893
+ **Threat it re-opens.** (1) A nested page's files are served with
5894
+ `Cross-Origin-Resource-Policy: cross-origin` and `Access-Control-Allow-Origin: *`, where P081 had
5895
+ `same-origin`: an opaque page's own loads are cross-origin. Whoever holds the sealed address could
5896
+ embed or read the files from any page; they could already fetch them with it, and P083 bounds the
5897
+ address (one version, one viewer, an hour on its own). (2) The page's sealed address opens past its
5898
+ hour only through the shell's renewal: P083's grace for a running page's own loads (same-origin
5899
+ only) can't apply, so a module the page loaded keeps an address that ends within the hour (its later
5900
+ imports fail), where P083 served them till the session's end. (3) The page loses its origin's
5901
+ storage (an in-memory stand-in, as opaque frames have). (4) A press in the page within 5 s of the
5902
+ last one turns no activation on: the second move into the frame (after the person went back to the
5903
+ host's page) is taken back until the activation lapses, or they Tab in. Accepted by the CTO.
5904
+
5905
+ **Why.** The shell is a realm the page can't reach, above its frame: the page is a different origin
5906
+ (opaque), so it has nothing of the shell's (DOM, globals, the window the host hears), and it can
5907
+ neither navigate it nor post as it. Its activation is the person's gesture in this page and no other.
5908
+
5909
+ **Rejected.** A shared shell on one host for every artifact (the per-artifact host stays: decided
5910
+ with the CTO); the page's runtime reporting its own gestures (the page's word, in the page's realm);
5911
+ the host's own activation edge (refreshed by the person's typing, so a press in the frame within 5 s
5912
+ of it is invisible); the pointer's last position on the host's page (it stops at the frame's edge,
5913
+ measured); consuming activation to see a new edge (it consumes the whole page's, the host's
5914
+ included).
5915
+
5916
+ **Residual.** Assets (`/_blob/`) and Porthole's vendored libraries aren't served to a nested page
5917
+ yet (the config refuses them). Another page of the set opens in the frame (the shell's `frame-src`
5918
+ is the sealed prefix) without the navigate events a served page's guard uses (opaque documents get
5919
+ none): the shell's CSP is the wall, as `frame-src` is for opaque frames (P033). The host's page gets
5920
+ the keys a person types within the wait for the shell's word on a move it can't judge at once (on a
5921
+ slow machine, up to 500 ms; measured well under a frame's time on Chromium). A trace's snapshots in
5922
+ Playwright are evaluations in each frame, as gestures: the browser cases run untraced.
5923
+
5924
+ **Tested.** `test/nested.test.ts`: the config's bounds; the page's sandbox (scripts only) and a
5925
+ static check that `allow-same-origin` appears in no sandbox Porthole writes or serves but a frame's
5926
+ on an origin of its own, and that every sandbox attribute is written from those lists; the shell's
5927
+ CSP and document; `/server`: the framed address answers the shell, the page at its sealed address
5928
+ without a cookie is sandboxed and hears the shell alone, its files' resource policy and CORS, only
5929
+ the shell renews; the host's rule. `leak/served/nested.spec.ts` on full Chromium (out-of-process
5930
+ frames), the headless shell, WebKit and Firefox, real input only: the page is an opaque origin at its
5931
+ sealed address; a real click into its field keeps the keyboard there; its `focus()` as it loads, on a
5932
+ timer while the person types, right after a click on the host's own button, 1.2, 3 and 4.5 s after
5933
+ the person paused typing in the host's composer, and 700 ms after the person pressed it and went
5934
+ back to the composer, is taken back; a marker's click is heard; `comments.open` from a real click
5935
+ within a second of typing in the host is allowed, and without one refused; a page that says the
5936
+ shell's words to its parent or to the host's window moves nothing; the host hears storage used.
5937
+ Negative controls `shell-namespace` (the shell passes its namespace on) and `shell-host-input` (no
5938
+ quiet host needed) each fail their probe on Chromium, WebKit and Firefox.
5939
+
5940
+ **Revisit when** an engine shows the host's page a press in an out-of-process frame, or a page needs
5941
+ its own storage (then a capability for it, never the content origin's), assets, or libraries.
5942
+
5943
+ **Amended after the CTO's review (porthole#54): a stalled shell.** The shell's "since" is when it
5944
+ saw its activation turn on, not when the press was. Where the page shares the shell's thread
5945
+ (WebKit; Firefox and Chromium where the frames share a process), a page that holds the thread from
5946
+ its own click handler pushes that moment past the person's next press and keys on the host's page,
5947
+ which then pass the "no host input since" check: the page could take the keyboard, or open the
5948
+ composer, after the person went back to the host. Now the shell looks every 50 ms (an interval as
5949
+ well as each animation frame), beats to the host as often (`porthole/shell/beat`), and says in each
5950
+ report how long it went without a look (`gap`). An activation that turns on in a report after the
5951
+ shell went more than `SHELL_STALL_MS` (100 ms) without a look, or the host heard nothing from it
5952
+ for longer, is uncertain: no one's gesture (the focus guard takes the move back, `comments.open` is
5953
+ refused) until it goes off. **Cost:** a page that keeps its thread busy (or a machine that is), in
5954
+ an engine where it shares the thread with the shell, has a person's real click taken for
5955
+ uncertain; their next press once the page is idle, or a Tab, gets in (measured on a machine at load
5956
+ 45: Firefox took back one of two rounds of a real click). Two messages a 50 ms per display. **Tested:**
5957
+ `leak/served/nested.spec.ts` "a shell's activation seen after a stall is no one's gesture until it
5958
+ goes off" (the host's rule, in the browser's own event loop, on every engine), and
5959
+ `leak/served/nested-stall.spec.ts` (the race end to end with real input: the page's handler holds
5960
+ the thread 1.5 s while the person goes back to the composer; on the headless shell it got through
5961
+ without the check, measured; elsewhere Playwright's input waits the stall out, so that case is no
5962
+ control's probe); negative control `shell-stall` (the gap ignored).
5963
+
5964
+ **Amended after the CTO's review (porthole#54): every file sandboxed.** A nested page's files are on
5965
+ its shell's origin, so a file a browser can run as a document, opened on a tab of its own (an SVG
5966
+ or an XML file with a script, "open image in new tab"), must not run there. Every answer below the
5967
+ sealed prefix carries a CSP sandbox, never `allow-same-origin`: a page's `sandbox allow-scripts`
5968
+ (opaque); every other file's `default-src 'none'; sandbox` (opaque, nothing runs: P081's inert CSP);
5969
+ and now a script's too (`sandbox`, where a served script had none). **Tested:**
5970
+ `test/nested.test.ts` (every type in Porthole's table, opened as a tab opens it: a sandbox, never
5971
+ `allow-same-origin`), and `leak/served/nested.spec.ts` "a page's SVG or XML file opened on a tab of
5972
+ its own is an opaque origin…" (each opaque; its script wrote nothing to the shell's origin's
5973
+ storage); negative control `file-sandbox` (a file without its sandbox).
5974
+
5975
+ **Workers in a nested page (the CTO's follow-up #85).** Whether the sandbox on a script's answer
5976
+ refuses a worker, measured on full Chromium, the headless shell, WebKit and Firefox
5977
+ (`leak/served/nested-workers.spec.ts`): it refuses none, every outcome the same with it taken out
5978
+ (the `file-sandbox` control). A worker from a script of the page's own set, classic or module, is
5979
+ refused on every engine, sandbox or not: a worker's script must be its creator's origin, and a
5980
+ nested page's is opaque (Chromium throws `SecurityError`, WebKit and Firefox fire `error`). A worker
5981
+ from a Blob URL starts and answers on every engine, and loads the set's scripts (`importScripts`,
5982
+ CORS-free) and, on WebKit and Firefox, its modules; Chromium refuses a module worker from a Blob URL
5983
+ in an opaque document, one that imports nothing included (no script's answer is involved). So no
5984
+ answer needs its sandbox taken off for a worker, and none is: the narrowest fix (no sandbox on a
5985
+ `Sec-Fetch-Dest: worker` answer) would fix nothing. The agent manual already teaches workers from
5986
+ `blob:` URLs only.
5987
+
5988
+ ## P112 · 2026-10-28 · 0.14's comment UX: what annotations add for a host's comment modes · Accepted
5989
+
5990
+ **Context.** Raft's comment design (its modes A–C, a card that follows its mark, a list in document
5991
+ order, block selection on touch) needs more from `annotate` than 0.13 has. Each addition is the
5992
+ content's word, as every report is (P053): the host uses it as a hint, never as a permission, and
5993
+ takes it only while it asked for it. Each item below landed on its own, with its negative control.
5994
+
5995
+ - **Escape while selecting text** (P4). In text selection mode an Escape is reported as
5996
+ `cancelled`, as it is while picking an element; the key stays the page's (a page that closes its
5997
+ own dialog on Escape still does), and the host decides what ends (a pick ends with it, as
5998
+ before). The host takes `cancelled` only while it asked for a pick or for text: a page can send
5999
+ it, and then only gets the host out of a mode the person can enter again (Raft: mode B ends, its
6000
+ drafts kept). Tested: `leak/annotate.spec.ts` "Escape while selecting text is cancelled…";
6001
+ negative control `cancel-any-mode` (a cancel with no mode on is heard).
6002
+ - **Following a mark** (P1). `annotations.track(id | null)`: while the followed mark moves (a
6003
+ scroll, a layout change), the frame reports `{ type: "tracked", id, rect }` at most once per
6004
+ animation frame. One mark at a time, and only a shown one (`track` throws for another; a `show`
6005
+ without it, or `clear`, stops it). The host takes a `tracked` only for the mark it follows, at
6006
+ most 60 a second, its box clamped to the frame, outside the bridge's 120 reports a minute (which
6007
+ a card that follows its mark would spend in two seconds). It costs a message and a box read per
6008
+ frame, only while the host follows a mark. The box is where to put a card, nothing more: a page
6009
+ can move it within its frame, as it can draw anything there. Tested: `leak/annotate.spec.ts` "a
6010
+ followed mark's box comes as it moves…"; negative control `track-checks` (any mark, any rate).
6011
+ - **A mark's place** (P2). Each attached result in `anchored` carries `order`: its place among the
6012
+ found marks by where it starts in the document, from 0, offscreen marks included (orphans have
6013
+ none); a change of place is reported as a move is. The host takes a whole number below the most
6014
+ marks a show carries, or drops the report. The page knows where its anchors are anyway; the host
6015
+ sorts by it and takes it as nothing more. Tested: `leak/annotate.spec.ts` "every found mark's
6016
+ place in the document…"; negative control `order-check` (any number taken).
6017
+ - **Holding a block** (P3). `start({ text: true, elements: "hold" })`: a finger held still (within
6018
+ 10 px) for 500 ms on a block selects it, reported as `selected` with an element anchor, as a pick
6019
+ is; the click its release makes (and a context menu) never reaches the page. Every other tap, a
6020
+ finger that moved, and any mouse are the page's, so the page stays usable while comments are on;
6021
+ the mode lasts until the host stops it (a pick ends after one). It makes nothing but `selected`,
6022
+ as `elements: true` does; a page can tell a long press happened, as it can tell a selection.
6023
+ Tested: `leak/annotate.spec.ts` "holding a block 500 ms selects it…" (the events as the browser
6024
+ dispatches them, sent in the frame: a page's realm can send them too, and what comes of them is a
6025
+ report, the page's word); negative control `hold-click` (the release's click reaches the page).
6026
+ - **Whether a page may pass a draft on** (P8). `mayPassOn(config, declaration)`, and
6027
+ `host.mayPassOn(declaration)`: true where the page can keep what it is given where others read
6028
+ it, knowing whose it is (`db` and `user`, both declared and offered), or reaches the network
6029
+ beyond the library CDNs (`anyHttps`, or any origin the config or a capability opens for any kind
6030
+ that isn't one of `LIBRARY_CDNS`'s for that kind: a CDN serves published packages by their path,
6031
+ and its logs are its operator's, not the page author's). ADOPTING's "no drafts to a page that can
6032
+ pass them on" as a function a host calls instead of reading the declaration itself. A pure
6033
+ function of the host's own records: `test/pass-on.test.ts` holds each channel alone, and none;
6034
+ there is no browser probe for it to fail.
6035
+ - **A draft-only composer may take focus** (P6). THREAT_MODEL §6 said every view a report opens
6036
+ takes no focus; ADOPTING's keyboard section opened a composer focused on `selected`. Now one
6037
+ rule in both: in a comment mode the person started themselves (the host's own control), a
6038
+ composer their selection opens may take focus with `focusField` if all it can do is save a draft
6039
+ (nothing posts, submits or sends from it), the rest of §6's guard holding; any other view a
6040
+ report opens takes none. What the page gains by choosing that moment is the person's next keys in
6041
+ a draft they see and can discard. As Raft's comment design proposes it (its mode B); Tenny's to
6042
+ confirm.
6043
+ *Amended after the CTO's review (porthole#54):* `db` alone was missed (a page can store the draft
6044
+ where its other readers see it, whoever wrote it), and so were `openLink` (the draft in a URL the
6045
+ person opens) and `artifact` (the draft in a new version). The whole vocabulary now: what carries
6046
+ what the page puts in it to someone other than the person viewing it counts, wherever the page
6047
+ can reach it (the config declares it, and under the runtime with a declaration through a built-in
6048
+ family or one the page declared): `db`, `artifact`, `assets`, `openLink`, `sendPrompt`,
6049
+ `setModelContext`, `callTool`, `readData`, `subscribeData` (their arguments go to the host's data
6050
+ services, which may be someone else's), and `reportError` where errors go to the agent. Not:
6051
+ `copyText` and `downloadFile` (the person's own clipboard and disk), `annotate`, `resize` and
6052
+ `comments` (the host's own UI; the composer is the person's, under the host's duties), and `user`
6053
+ (it only reads). Tested: `test/pass-on.test.ts`, each channel alone.
6054
+