@botiverse/porthole 0.14.7 → 0.14.9
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.
- package/CHANGELOG.md +74 -0
- package/dist/bridge/bridge.d.ts +6 -0
- package/dist/bridge/bridge.js +5 -0
- package/dist/check/files.js +2 -0
- package/dist/check/lint.js +82 -3
- package/dist/check/page-source.js +1 -1
- package/dist/compile/policy.d.ts +17 -6
- package/dist/compile/policy.js +22 -7
- package/dist/config/capabilities.d.ts +16 -2
- package/dist/config/capabilities.js +8 -0
- package/dist/config/schema.d.ts +13 -0
- package/dist/config/validate.js +15 -0
- package/dist/conformance/harness-source.js +1 -1
- package/dist/conformance/kit.d.ts +5 -0
- package/dist/conformance/kit.js +21 -0
- package/dist/conformance/limits.js +10 -5
- package/dist/conformance/probes.js +139 -28
- package/dist/conformance/served.js +25 -4
- package/dist/find/types.d.ts +83 -0
- package/dist/find/types.js +29 -0
- package/dist/find/validate.d.ts +17 -0
- package/dist/find/validate.js +82 -0
- package/dist/guide/guide.js +2 -1
- package/dist/guide/limits.js +8 -1
- package/dist/host/create-host.js +249 -4
- package/dist/host/pass-on.js +3 -2
- package/dist/host/types.d.ts +51 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -1
- package/dist/presets/presets.d.ts +6 -0
- package/dist/presets/presets.js +6 -0
- package/dist/react/frame.d.ts +43 -0
- package/dist/react/frame.js +107 -3
- package/dist/react/view.js +2 -0
- package/dist/runtime/contract.d.ts +1 -1
- package/dist/runtime/contract.js +1 -1
- package/dist/server/files.js +4 -3
- package/dist/server/server.js +4 -1
- package/dist/shell/annotate.js +2 -95
- package/dist/shell/document.d.ts +3 -3
- package/dist/shell/document.js +5 -3
- package/dist/shell/find.d.ts +82 -0
- package/dist/shell/find.js +725 -0
- package/dist/shell/plan.d.ts +5 -0
- package/dist/shell/plan.js +2 -0
- package/dist/shell/runtime.d.ts +30 -1
- package/dist/shell/runtime.js +789 -105
- package/dist/shell/text.d.ts +17 -0
- package/dist/shell/text.js +140 -0
- package/docs/ADOPTING.md +103 -0
- package/docs/ARCHITECTURE.md +10 -3
- package/docs/DECISIONS.md +513 -1
- package/docs/DESIGN.md +40 -4
- package/docs/THREAT_MODEL.md +75 -6
- package/docs/insertion-entry-points.md +112 -0
- package/package.json +1 -1
- package/src/bridge/bridge.ts +7 -0
- package/src/check/files.ts +2 -0
- package/src/check/lint.ts +97 -8
- package/src/compile/policy.ts +23 -6
- package/src/config/capabilities.ts +13 -1
- package/src/config/schema.ts +13 -0
- package/src/config/validate.ts +16 -0
- package/src/conformance/kit.ts +22 -0
- package/src/conformance/limits.ts +10 -5
- package/src/conformance/probes.ts +149 -28
- package/src/conformance/served.ts +24 -4
- package/src/find/types.ts +86 -0
- package/src/find/validate.ts +101 -0
- package/src/guide/guide.ts +3 -1
- package/src/guide/limits.ts +9 -1
- package/src/host/create-host.ts +267 -4
- package/src/host/pass-on.ts +3 -2
- package/src/host/types.ts +52 -0
- package/src/index.ts +13 -0
- package/src/presets/presets.ts +15 -0
- package/src/react/frame.tsx +160 -1
- package/src/react/view.tsx +3 -0
- package/src/runtime/contract.ts +1 -1
- package/src/server/files.ts +8 -2
- package/src/server/server.ts +4 -1
- package/src/shell/annotate.ts +3 -95
- package/src/shell/document.ts +5 -3
- package/src/shell/find.ts +731 -0
- package/src/shell/plan.ts +7 -0
- package/src/shell/runtime.ts +792 -105
- package/src/shell/text.ts +140 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The document's text as annotations (P053) and find in page (P131) read it, spliced into each of
|
|
3
|
+
* their runtimes (inside its own function, after it took `createTreeWalker` and `createRange` from
|
|
4
|
+
* the DOM before content ran): the body's text nodes in order, without scripts, styles, noscript
|
|
5
|
+
* and templates, as one string with each node's start (`textIndex()`); an offset into it as a
|
|
6
|
+
* boundary point (`pointAt`), a boundary point as an offset (`offsetOf`), a span as a range
|
|
7
|
+
* (`rangeAt`). One source, so a match find highlights and an anchor's `TextPositionSelector` count
|
|
8
|
+
* the same text. Plain ES2020, no template literals (it sits in one).
|
|
9
|
+
*
|
|
10
|
+
* Every built-in it calls is taken before content runs and called through the shell's `callOf`
|
|
11
|
+
* (P129): the walker's step, a node's type, name and text (the `nodeType`, `localName` and
|
|
12
|
+
* `nodeValue` getters), the body getter, a range's boundaries, and the map of nodes. Its
|
|
13
|
+
* lists are the shell's prototype-less ones (`listOf`, `pushTo`), and the names it skips a lookup
|
|
14
|
+
* with no prototype, so nothing content puts on `Array.prototype`, `Object.prototype`, `Map` or a
|
|
15
|
+
* DOM prototype takes part in what it reads.
|
|
16
|
+
*/
|
|
17
|
+
export declare const TEXT_INDEX: string;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The document's text as annotations (P053) and find in page (P131) read it, spliced into each of
|
|
3
|
+
* their runtimes (inside its own function, after it took `createTreeWalker` and `createRange` from
|
|
4
|
+
* the DOM before content ran): the body's text nodes in order, without scripts, styles, noscript
|
|
5
|
+
* and templates, as one string with each node's start (`textIndex()`); an offset into it as a
|
|
6
|
+
* boundary point (`pointAt`), a boundary point as an offset (`offsetOf`), a span as a range
|
|
7
|
+
* (`rangeAt`). One source, so a match find highlights and an anchor's `TextPositionSelector` count
|
|
8
|
+
* the same text. Plain ES2020, no template literals (it sits in one).
|
|
9
|
+
*
|
|
10
|
+
* Every built-in it calls is taken before content runs and called through the shell's `callOf`
|
|
11
|
+
* (P129): the walker's step, a node's type, name and text (the `nodeType`, `localName` and
|
|
12
|
+
* `nodeValue` getters), the body getter, a range's boundaries, and the map of nodes. Its
|
|
13
|
+
* lists are the shell's prototype-less ones (`listOf`, `pushTo`), and the names it skips a lookup
|
|
14
|
+
* with no prototype, so nothing content puts on `Array.prototype`, `Object.prototype`, `Map` or a
|
|
15
|
+
* DOM prototype takes part in what it reads.
|
|
16
|
+
*/
|
|
17
|
+
export const TEXT_INDEX = String.raw `// The document's text: the body's text nodes in order, without scripts, styles, templates.
|
|
18
|
+
const textNextNode = TreeWalker.prototype.nextNode;
|
|
19
|
+
const textTypeOf = getterOf(Node.prototype, "nodeType");
|
|
20
|
+
const textNameOf = getterOf(Element.prototype, "localName");
|
|
21
|
+
const textValueOf = getterOf(Node.prototype, "nodeValue");
|
|
22
|
+
const textBodyOf = getterOf(Document.prototype, "body");
|
|
23
|
+
const textSetStart = Range.prototype.setStart;
|
|
24
|
+
const textSetEnd = Range.prototype.setEnd;
|
|
25
|
+
const textCollapse = Range.prototype.collapse;
|
|
26
|
+
const textComparePoint = Range.prototype.comparePoint;
|
|
27
|
+
const TextMap = Map;
|
|
28
|
+
const textMapSet = Map.prototype.set;
|
|
29
|
+
const textMapGet = Map.prototype.get;
|
|
30
|
+
const textMapHas = Map.prototype.has;
|
|
31
|
+
const TEXT_SHOW = NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT;
|
|
32
|
+
const TEXT_ACCEPT = NodeFilter.FILTER_ACCEPT;
|
|
33
|
+
const TEXT_REJECT = NodeFilter.FILTER_REJECT;
|
|
34
|
+
const TEXT_SKIP = NodeFilter.FILTER_SKIP;
|
|
35
|
+
const SKIPPED = bare(null);
|
|
36
|
+
SKIPPED.script = 1;
|
|
37
|
+
SKIPPED.style = 1;
|
|
38
|
+
SKIPPED.noscript = 1;
|
|
39
|
+
SKIPPED.template = 1;
|
|
40
|
+
// A text node's text, read once through the kept getter; anything but a string is none.
|
|
41
|
+
const textOf = (node) => {
|
|
42
|
+
const value = textValueOf === null ? node.nodeValue : callOf(textValueOf, node, []);
|
|
43
|
+
return typeof value === "string" ? value : "";
|
|
44
|
+
};
|
|
45
|
+
const textKind = (node) => (textTypeOf === null ? node.nodeType : callOf(textTypeOf, node, []));
|
|
46
|
+
const textLesser = (a, b) => (a < b ? a : b);
|
|
47
|
+
const skippedElement = (node) => SKIPPED[textNameOf === null ? node.localName : callOf(textNameOf, node, [])] === 1;
|
|
48
|
+
const textIndex = () => {
|
|
49
|
+
const nodes = listOf();
|
|
50
|
+
const starts = listOf();
|
|
51
|
+
const at = new TextMap();
|
|
52
|
+
let text = "";
|
|
53
|
+
const body = textBodyOf === null ? document.body : callOf(textBodyOf, document, []);
|
|
54
|
+
if (body) {
|
|
55
|
+
const walker = callOf(createTreeWalker, document, [body, TEXT_SHOW, {
|
|
56
|
+
acceptNode: (node) => (textKind(node) === 1 ? (skippedElement(node) ? TEXT_REJECT : TEXT_SKIP) : TEXT_ACCEPT),
|
|
57
|
+
}]);
|
|
58
|
+
for (let node = callOf(textNextNode, walker, []); node !== null; node = callOf(textNextNode, walker, [])) {
|
|
59
|
+
callOf(textMapSet, at, [node, nodes.length]);
|
|
60
|
+
pushTo(nodes, node);
|
|
61
|
+
pushTo(starts, text.length);
|
|
62
|
+
text += textOf(node);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return { nodes, starts, at, text };
|
|
66
|
+
};
|
|
67
|
+
// A boundary point as an offset into the text: in a text node, where it is; elsewhere, the
|
|
68
|
+
// first text at or after it.
|
|
69
|
+
const offsetOf = (index, container, offset) => {
|
|
70
|
+
if (textKind(container) === 3 && callOf(textMapHas, index.at, [container])) {
|
|
71
|
+
return index.starts[callOf(textMapGet, index.at, [container])] + textLesser(offset, textOf(container).length);
|
|
72
|
+
}
|
|
73
|
+
const point = callOf(createRange, document, []);
|
|
74
|
+
try {
|
|
75
|
+
callOf(textSetStart, point, [container, offset]);
|
|
76
|
+
} catch (_) {
|
|
77
|
+
return index.text.length;
|
|
78
|
+
}
|
|
79
|
+
callOf(textCollapse, point, [true]);
|
|
80
|
+
let low = 0;
|
|
81
|
+
let high = index.nodes.length;
|
|
82
|
+
while (low < high) {
|
|
83
|
+
const middle = (low + high) >> 1;
|
|
84
|
+
if (callOf(textComparePoint, point, [index.nodes[middle], 0]) >= 0) {
|
|
85
|
+
high = middle;
|
|
86
|
+
} else {
|
|
87
|
+
low = middle + 1;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return low < index.nodes.length ? index.starts[low] : index.text.length;
|
|
91
|
+
};
|
|
92
|
+
const pointAt = (index, at, end) => {
|
|
93
|
+
let low = 0;
|
|
94
|
+
let high = index.nodes.length - 1;
|
|
95
|
+
let found = -1;
|
|
96
|
+
while (low <= high) {
|
|
97
|
+
const middle = (low + high) >> 1;
|
|
98
|
+
if (index.starts[middle] <= at) {
|
|
99
|
+
found = middle;
|
|
100
|
+
low = middle + 1;
|
|
101
|
+
} else {
|
|
102
|
+
high = middle - 1;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (found === -1) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
let node = index.nodes[found];
|
|
109
|
+
let offset = at - index.starts[found];
|
|
110
|
+
if (end) {
|
|
111
|
+
// An end at a node's very start belongs to the text before it.
|
|
112
|
+
while (offset === 0 && found > 0) {
|
|
113
|
+
found -= 1;
|
|
114
|
+
node = index.nodes[found];
|
|
115
|
+
offset = textOf(node).length;
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
while (offset >= textOf(node).length && found + 1 < index.nodes.length) {
|
|
119
|
+
found += 1;
|
|
120
|
+
node = index.nodes[found];
|
|
121
|
+
offset = 0;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return { node, offset: textLesser(offset, textOf(node).length) };
|
|
125
|
+
};
|
|
126
|
+
const rangeAt = (index, start, end) => {
|
|
127
|
+
const from = pointAt(index, start, false);
|
|
128
|
+
const to = pointAt(index, end, true);
|
|
129
|
+
if (from === null || to === null) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
const range = callOf(createRange, document, []);
|
|
133
|
+
try {
|
|
134
|
+
callOf(textSetStart, range, [from.node, from.offset]);
|
|
135
|
+
callOf(textSetEnd, range, [to.node, to.offset]);
|
|
136
|
+
} catch (_) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
return range;
|
|
140
|
+
};`;
|
package/docs/ADOPTING.md
CHANGED
|
@@ -389,6 +389,89 @@ composer.onClose(() => display.annotations.clearSelection());
|
|
|
389
389
|
the person can't see; a quote (`exact`) keeps it, to be found again. Hand either to a model only
|
|
390
390
|
as the page's words.
|
|
391
391
|
|
|
392
|
+
### Find in page: the host's find bar
|
|
393
|
+
|
|
394
|
+
With `find` declared (`capabilities: { find: {} }`), your own find bar searches a display
|
|
395
|
+
([P131](DECISIONS.md)): the shell finds the query in the page's text (case-insensitive by default,
|
|
396
|
+
any spacing), highlights every match it can see and the current one apart, brings the current one
|
|
397
|
+
into view (its scrolling box too), and answers where they stand. The page reads every query you
|
|
398
|
+
send (the search runs in the page's document): declare `find` only where the page may learn what
|
|
399
|
+
the person searches for (not a third-party app with egress, unless you accept that).
|
|
400
|
+
|
|
401
|
+
Send a query when the person pauses (a debounce of a few hundred ms) or presses Enter, not at
|
|
402
|
+
every key. Each query you send is posted into the page, so a bar that searches at every key shows
|
|
403
|
+
the page each prefix of what the person types and the rhythm of their typing; one that waits for
|
|
404
|
+
a pause shows it the words they settled on. It also spares a large page a search per key (the
|
|
405
|
+
shell searches only the latest of a burst, below).
|
|
406
|
+
|
|
407
|
+
```js
|
|
408
|
+
display.find.takeShortcut(true); // Cmd+F / Ctrl+F in the frame opens your bar, not the browser's
|
|
409
|
+
display.on("findRequested", () => bar.open()); // the page's word too: open the bar, nothing more
|
|
410
|
+
// "unsupported", or `${active}/${total}` ("+" after the total where `capped`).
|
|
411
|
+
bar.showResult = (result) => bar.show(result === "unsupported" ? "Not available here" : result);
|
|
412
|
+
// Only the answer to the latest query is shown: an earlier one may come back "unsupported".
|
|
413
|
+
let asked = 0;
|
|
414
|
+
const ask = (query, options) => {
|
|
415
|
+
const mine = ++asked;
|
|
416
|
+
void display.find.query(query, options).then((result) => mine === asked && bar.showResult(result));
|
|
417
|
+
};
|
|
418
|
+
// A new query once the person pauses or presses Enter: the first match in view becomes current.
|
|
419
|
+
let pause;
|
|
420
|
+
bar.onInput((query) => {
|
|
421
|
+
clearTimeout(pause);
|
|
422
|
+
pause = setTimeout(() => ask(query), 300);
|
|
423
|
+
});
|
|
424
|
+
bar.onEnter((query) => (clearTimeout(pause), ask(query)));
|
|
425
|
+
bar.onNext(() => ask(bar.query, { direction: "next" }));
|
|
426
|
+
bar.onPrevious(() => ask(bar.query, { direction: "prev" }));
|
|
427
|
+
display.on("findUpdated", bar.showResult); // the page changed: new numbers
|
|
428
|
+
bar.onClose(() => display.find.clear()); // Escape in your bar: highlights gone
|
|
429
|
+
// The display forgot the query: its content navigated away (it runs again). Reset your bar here,
|
|
430
|
+
// and wherever you reload() it or give it other content.
|
|
431
|
+
display.on("navigated", () => bar.reset());
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
- **`"unsupported"`**: the config doesn't declare `find`, the frame's shell is older than your
|
|
435
|
+
host (it answers that it doesn't know the request: upgrade the content server first), or no
|
|
436
|
+
answer came within `FIND_LIMITS.timeoutMs` (3 s) of the frame running. Also for a query that a
|
|
437
|
+
later one superseded before it ran (the shell searches only the latest of a burst; queries asked
|
|
438
|
+
before the frame ran: the latest is sent), and for one waiting when the content it was asked of
|
|
439
|
+
went (below): show the answer to your latest query only. A query asked before the frame ran
|
|
440
|
+
waits for it. An empty query clears and answers `{ total: 0, active: 0 }`; one longer than
|
|
441
|
+
`FIND_LIMITS.query` (256) rejects with a `TypeError`.
|
|
442
|
+
- **A query is for the content it was asked of.** A new run (`reload()`, a restart after the
|
|
443
|
+
content navigated its frame away, `navigated`) or other content (`setContent` with content that
|
|
444
|
+
doesn't continue what you gave: more of a streamed page keeps it) forgets the query: nothing is
|
|
445
|
+
highlighted or searched there until you call `find.query` again, so another page never sees the
|
|
446
|
+
last one's search. Clear your find bar's state (its query, "3/12") whenever the display shows
|
|
447
|
+
other content, then search again if the person asks. The shortcut (`takeShortcut`) is kept.
|
|
448
|
+
- **The numbers are the page's word**: at most 1,000 matches (`capped: true`: there may be
|
|
449
|
+
more), the current one from 1. `rect` is the current match's box in the frame's CSS px, clamped
|
|
450
|
+
to its viewport: a display that grows with its content (not `layout: "fill"`) doesn't scroll
|
|
451
|
+
itself, so scroll your page to the frame's position plus `rect`.
|
|
452
|
+
- **The shortcut** is yours only while you take it, and only where the page doesn't handle Cmd+F
|
|
453
|
+
or Ctrl+F itself. `findRequested` is taken only with the page's focus in the frame, so a page
|
|
454
|
+
can't open your bar while the person types in your composer. Your own page's Cmd+F (focus
|
|
455
|
+
outside every frame) is yours to handle as before. Escape and Cmd+G in the frame stay the page's:
|
|
456
|
+
close and move on from your bar.
|
|
457
|
+
- **Not found**: words in open shadow roots, in a page's own frames (P128), in form fields, in
|
|
458
|
+
images or a canvas, and words split across cells with no space between them.
|
|
459
|
+
- **React**: `onFindRequested` (given, the shortcut is yours) and `onFindUpdated` are props; the
|
|
460
|
+
handle holds `find(query, options)` and `clearFind()` beside `clearSelection()`. With no display
|
|
461
|
+
running, `find` answers `"unsupported"` and keeps the query for the content the frame shows: a
|
|
462
|
+
display made later for it (the frame nears the screen again) finds it again and tells
|
|
463
|
+
`onFindUpdated`. Other content forgets it: another `content` that doesn't continue it, a new
|
|
464
|
+
`generation`, `document`, `instance` (another artifact or version), `config`, `declaration` or
|
|
465
|
+
`viewer`. Reset your find bar when you change those. A refused query reaches `onHostError`,
|
|
466
|
+
kind `"find"`.
|
|
467
|
+
|
|
468
|
+
```tsx
|
|
469
|
+
const frame = useRef<PortholeFrameHandle>(null);
|
|
470
|
+
<PortholeView ref={frame} display="page" instance={instance} displayId={id} title={title}
|
|
471
|
+
onFindRequested={() => setFinding(true)} onFindUpdated={setFound} />;
|
|
472
|
+
const result = await frame.current?.find(query, { direction: "next" });
|
|
473
|
+
```
|
|
474
|
+
|
|
392
475
|
### The keyboard: what a display can take, and what you get
|
|
393
476
|
|
|
394
477
|
Any display can move the keyboard into its frame (`element.focus()` in the page, with no gesture
|
|
@@ -586,6 +669,26 @@ entry: {
|
|
|
586
669
|
})` to run it, and the manual's Files section where a kind serves files. Show a set served: an
|
|
587
670
|
opaque frame has no origin to serve its files from.
|
|
588
671
|
|
|
672
|
+
### A page's own nested frames (opt-in)
|
|
673
|
+
|
|
674
|
+
By default the shell refuses every nested frame content makes: markup frames are removed, and a
|
|
675
|
+
script that creates a frame-like element (`createElement("iframe")`, `object`, `embed`, …) gets a
|
|
676
|
+
`NotSupportedError` at that line (P130), so tell your users' agents to build pages without them (the
|
|
677
|
+
manual and the lint already do). Pasting or dropping formatted content into an editable element
|
|
678
|
+
inserts its plain text only. `nestedFrames: "own"` (P128) on a
|
|
679
|
+
kind's `options` lets a page keep an `<iframe>` of one of its version's own files (a relative
|
|
680
|
+
`src`, served kinds) or with `srcdoc` (every kind), as Claude's Artifacts do; frames of other
|
|
681
|
+
sites, `<object>` and `<embed>` stay out, and the manual and the lint say so:
|
|
682
|
+
|
|
683
|
+
```ts
|
|
684
|
+
artifact: { preset: "artifact", options: { layout: { kind: "fill" }, nestedFrames: "own" } },
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
It is a weakening: a nested frame is a realm of its own where the shell's defenses never ran, so
|
|
688
|
+
content there has WebRTC (a way out past `connect-src`) and can put text on the clipboard from a
|
|
689
|
+
click, with no notice. The CSP still governs every frame's loads and navigations. Not for url mode,
|
|
690
|
+
nested pages or live widgets (refused). Turn it on only where your product accepts that.
|
|
691
|
+
|
|
589
692
|
### Nested pages: the page below Porthole's shell
|
|
590
693
|
|
|
591
694
|
`nested: true` (P111) on an artifact kind served by the host kit puts the page in a frame of its
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -278,9 +278,10 @@ several displays on one page are in [THREAT_MODEL.md](THREAT_MODEL.md).
|
|
|
278
278
|
4. **Message boundary.** Every message crossing the frame is validated against a
|
|
279
279
|
schema and checked for sender identity before use; the shell accepts messages
|
|
280
280
|
only from its host, and the host only from its frame. What the frame says about
|
|
281
|
-
itself (its size, its errors, an annotation's anchor and where it is
|
|
282
|
-
content's word even when the shell says it, since they
|
|
283
|
-
bounds it and uses it as a UI hint, never as a permission
|
|
281
|
+
itself (its size, its errors, an annotation's anchor and where it is, how many
|
|
282
|
+
matches find found) is the content's word even when the shell says it, since they
|
|
283
|
+
share a realm: the host bounds it and uses it as a UI hint, never as a permission
|
|
284
|
+
(P053, P131). What the host sends in (a mark, a find query) the content can read.
|
|
284
285
|
A nested page (P111) is the one place they don't: the shell is a document of its
|
|
285
286
|
own, the page's parent, on another origin than the page's (opaque), so the page
|
|
286
287
|
reaches nothing of the shell's realm. Nor does any other content: the shell's
|
|
@@ -328,6 +329,12 @@ several displays on one page are in [THREAT_MODEL.md](THREAT_MODEL.md).
|
|
|
328
329
|
comments (P053). A mark may carry a count, drawn as a clickable marker whose click
|
|
329
330
|
the host hears and answers with its own UI outside the frame (P104), and may be a
|
|
330
331
|
draft, its author's unposted comment, drawn apart with a hollow marker (P107).
|
|
332
|
+
- **Find in page** (`find`): the host draws its own find bar and asks the shell for
|
|
333
|
+
a query (`porthole/find.query`, a request: how many matches, which is current);
|
|
334
|
+
the shell finds it in the same text index annotations read, highlights it in a layer
|
|
335
|
+
of its own, and says when the person pressed Cmd+F or Ctrl+F in the frame, where the
|
|
336
|
+
host takes the shortcut (P131). An older shell answers "isn't offered here", and the
|
|
337
|
+
host calls find unsupported there.
|
|
331
338
|
- **Served content.** A host plugs its own policy and infrastructure into `/server`:
|
|
332
339
|
who may see what (`authorize`), where tickets live (`TicketStore`: memory, D1),
|
|
333
340
|
how origins are named (`content.name`, other servers' `reserved` namespaces),
|