@botiverse/porthole 0.3.3 → 0.3.5
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/README.md +2 -0
- package/dist/bridge/types.d.ts +3 -2
- package/dist/check/page-source.js +1 -1
- package/dist/conformance/harness-source.js +1 -1
- package/dist/guide/guide.js +18 -11
- package/dist/host/types.d.ts +5 -1
- package/dist/react/frame.d.ts +4 -1
- package/dist/react/view.d.ts +4 -1
- package/dist/react/view.js +1 -1
- package/docs/ADOPTING.md +42 -2
- package/docs/DECISIONS.md +18 -0
- package/docs/DESIGN.md +5 -2
- package/package.json +1 -1
- package/src/bridge/types.ts +3 -2
- package/src/guide/guide.ts +21 -12
- package/src/host/types.ts +5 -1
- package/src/react/frame.tsx +4 -1
- package/src/react/view.tsx +5 -2
package/dist/guide/guide.js
CHANGED
|
@@ -39,6 +39,13 @@ const KIND_WORDS = {
|
|
|
39
39
|
};
|
|
40
40
|
/** What the manual calls `https:` (any https site), where a config opens passive kinds to it. */
|
|
41
41
|
export const ANY_HTTPS_SITE = "any https site";
|
|
42
|
+
/** Kinds in words, as a list: "fonts, images, audio and video" (media's two words are two items). */
|
|
43
|
+
const kindsInWords = (kinds) => {
|
|
44
|
+
const words = kinds.flatMap((kind) => kind === "media" ? ["audio", "video"] : [KIND_WORDS[kind]]);
|
|
45
|
+
return words.length === 1
|
|
46
|
+
? (words[0] ?? "")
|
|
47
|
+
: `${words.slice(0, -1).join(", ")} and ${words.at(-1)}`;
|
|
48
|
+
};
|
|
42
49
|
/** The sources content may load `kind` from, as the manual names them: origins, any https site. */
|
|
43
50
|
const sourcesFor = (config, kind) => [
|
|
44
51
|
...(anyHttps(config, kind) ? [ANY_HTTPS_SITE] : []),
|
|
@@ -60,15 +67,18 @@ function network(config) {
|
|
|
60
67
|
byOrigin.set(origin, [...(byOrigin.get(origin) ?? []), kind]);
|
|
61
68
|
}
|
|
62
69
|
}
|
|
70
|
+
// Any https site last, the widest: "…; fonts, images, audio and video from any https site" (P059).
|
|
71
|
+
const anywhere = byOrigin.get(ANY_HTTPS_SITE);
|
|
72
|
+
byOrigin.delete(ANY_HTTPS_SITE);
|
|
63
73
|
const groups = new Map();
|
|
64
74
|
for (const [origin, each] of byOrigin) {
|
|
65
|
-
const
|
|
66
|
-
const key = words.length === 1
|
|
67
|
-
? (words[0] ?? "")
|
|
68
|
-
: `${words.slice(0, -1).join(", ")} and ${words.at(-1)}`;
|
|
75
|
+
const key = kindsInWords(each);
|
|
69
76
|
groups.set(key, [...(groups.get(key) ?? []), origin]);
|
|
70
77
|
}
|
|
71
|
-
const parts = [
|
|
78
|
+
const parts = [
|
|
79
|
+
...[...groups].map(([words, origins]) => `${words} from ${origins.join(", ")}`),
|
|
80
|
+
...(anywhere === undefined ? [] : [`${kindsInWords(anywhere)} from ${ANY_HTTPS_SITE}`]),
|
|
81
|
+
];
|
|
72
82
|
return `Network: only ${parts.join("; ")}. Anything else fails.`;
|
|
73
83
|
}
|
|
74
84
|
/** Whether a whole document takes the theme only when it declares support (ThemeConfig.documents). */
|
|
@@ -246,12 +256,9 @@ export function generateToolDescription(config) {
|
|
|
246
256
|
const origins = [
|
|
247
257
|
...new Set(["script", "style", "font", "img", "media", "connect"].flatMap((kind) => egressOrigins(config, kind))),
|
|
248
258
|
];
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const fromAnywhere = passive.length === 0
|
|
253
|
-
? ""
|
|
254
|
-
: `${passive.length === 1 ? passive[0] : `${passive.slice(0, -1).join(", ")} and ${passive.at(-1)}`} from ${ANY_HTTPS_SITE}`;
|
|
259
|
+
// The same words, in the same order, as the manual's Network line.
|
|
260
|
+
const passive = ["font", "img", "media"].filter((kind) => anyHttps(config, kind));
|
|
261
|
+
const fromAnywhere = passive.length === 0 ? "" : `${kindsInWords(passive)} from ${ANY_HTTPS_SITE}`;
|
|
255
262
|
const net = origins.length === 0 && fromAnywhere === ""
|
|
256
263
|
? "with no network (nothing loads from outside)"
|
|
257
264
|
: origins.length === 0
|
package/dist/host/types.d.ts
CHANGED
|
@@ -51,7 +51,11 @@ export interface MountOptions {
|
|
|
51
51
|
readonly scheme: ColorScheme;
|
|
52
52
|
/** Handlers for this display only, over the host's. */
|
|
53
53
|
readonly handlers?: CapabilityHandlers;
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Domain and external isolation: the instance to locate. Opaque: the host's own name for what
|
|
56
|
+
* the display shows, given back to the host in its confirmations (`ConfirmRequest.display`) and
|
|
57
|
+
* never sent to the frame (P077).
|
|
58
|
+
*/
|
|
55
59
|
readonly instance?: InstanceRef;
|
|
56
60
|
/** A whole document the frame starts with (an MCP Apps view), hardened by the shell. */
|
|
57
61
|
readonly document?: string;
|
package/dist/react/frame.d.ts
CHANGED
|
@@ -126,7 +126,10 @@ export interface PortholeFrameProps {
|
|
|
126
126
|
readonly partial?: boolean;
|
|
127
127
|
/** A whole document to start with (an MCP Apps view). */
|
|
128
128
|
readonly document?: string;
|
|
129
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* Domain and external isolation: the instance to show. Opaque: the host's own name for what it
|
|
131
|
+
* shows, for its confirmations only, never sent to the frame (P077).
|
|
132
|
+
*/
|
|
130
133
|
readonly instance?: InstanceRef;
|
|
131
134
|
/** The color scheme it shows in. Default: the provider's `scheme`, else light. */
|
|
132
135
|
readonly scheme?: ColorScheme;
|
package/dist/react/view.d.ts
CHANGED
|
@@ -22,7 +22,10 @@ export interface PortholeFallbackProps extends FrameFallback {
|
|
|
22
22
|
export interface PortholeViewProps extends Omit<PortholeFrameProps, "config" | "instance" | "content" | "fill"> {
|
|
23
23
|
/** The display kind (`defineDisplays`). */
|
|
24
24
|
readonly display: string;
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* The instance: what a served frame shows; for an opaque one, the host's own name for it, given
|
|
27
|
+
* back in its confirmations only, never sent to the frame (P077).
|
|
28
|
+
*/
|
|
26
29
|
readonly instance?: InstanceRef;
|
|
27
30
|
/**
|
|
28
31
|
* The content: a served shell's to draw, and what an opaque frame shows while frames aren't
|
package/dist/react/view.js
CHANGED
|
@@ -73,7 +73,7 @@ export function PortholeView(props) {
|
|
|
73
73
|
if (failed !== null) {
|
|
74
74
|
return _jsx(_Fragment, { children: (fallback ?? DefaultFallback)({ ...failed, link, retry }) });
|
|
75
75
|
}
|
|
76
|
-
return (_jsx(PortholeFrame, { ...frame, config: config, generation: (frame.generation ?? 0) + generation, ...(
|
|
76
|
+
return (_jsx(PortholeFrame, { ...frame, config: config, generation: (frame.generation ?? 0) + generation, ...(instance === undefined ? {} : { instance }), ...(content === undefined ? {} : { content }), onOutcome: (outcome) => {
|
|
77
77
|
onOutcome?.(outcome);
|
|
78
78
|
const said = frameFallback(outcome, { url });
|
|
79
79
|
if (said !== null) {
|
package/docs/ADOPTING.md
CHANGED
|
@@ -42,6 +42,46 @@ manual tells the agent so (the page scrolls itself; `position: fixed` works). `M
|
|
|
42
42
|
and `<PortholeFrame fill>` are deprecated: they size the frame but leave the manual saying the
|
|
43
43
|
height follows the content.
|
|
44
44
|
|
|
45
|
+
### Choosing egress
|
|
46
|
+
|
|
47
|
+
Egress is what content may load and send out: scripts, styles, fonts, images, audio and video, and
|
|
48
|
+
data (fetch, WebSocket). Every preset starts closed, and a kind opens more only through its
|
|
49
|
+
`options.egress`. There are three levels:
|
|
50
|
+
|
|
51
|
+
| Level | Config (`options`) | What it opens | The risk it re-opens | Typical host | The agent's manual says | Why | Tested by |
|
|
52
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
53
|
+
| **Closed** (the default) | nothing to write | Nothing from outside the frame: content runs on what it carries (inline code, `data:` and `blob:` URLs). | None. | Widgets that draw their own SVG and CSS; any host that hasn't decided yet. | `Network: none. Nothing loads from outside` (and `write everything inline`) | [P006](DECISIONS.md#p006--2026-10-11--egress-is-closed-by-default-including-channels-a-frame-csp-doesnt-cover--accepted), [P022](DECISIONS.md#p022--2026-10-11--every-preset-starts-with-egress-closed-library-cdns-are-a-one-line-opt-in--accepted) | probes `1.connect`, `2.resources`, `3.webrtc`, `4.*` (nested frames), `5.*` (navigating out), `8.*` (resource hints), `10.self`; served `served.domain.egress` |
|
|
54
|
+
| **Library CDNs** (`LIBRARY_CDNS`, plus script hosts of your own) | `egress: LIBRARY_CDNS`; more script hosts: `egress: { ...LIBRARY_CDNS, script: [...LIBRARY_CDNS.script, "https://cdn.example.com"] }` | Scripts, styles, fonts, images and data from cdnjs, jsDelivr, unpkg and esm.sh; Google Fonts. Nothing else. | Code you don't control runs in the frame (a compromised or look-alike package), still inside the sandbox and egress; and a path requested from a CDN is a narrow channel out, read by the CDN's operator. The manual tells agents to pin versions. | Ferry's widgets (`LIBRARY_CDNS`), Raft Artifacts' pages (`LIBRARY_CDNS` and a few script hosts of its own): agents load Chart.js, ECharts, d3, Mermaid. | `scripts, styles, fonts, images and data (fetch, WebSocket) from https://cdnjs.cloudflare.com` … and `pin an exact version` | [P022](DECISIONS.md#p022--2026-10-11--every-preset-starts-with-egress-closed-library-cdns-are-a-one-line-opt-in--accepted), [P048](DECISIONS.md#p048--2026-10-11--artifact-pages-reach-library-cdns-only-by-the-hosts-config--accepted) | `leak/cdn.spec.ts` (a CDN library loads only when the config opens it, opaque and served; another origin never); probes `1.connect`, `2.resources` (an allowed origin loads, no other does) |
|
|
55
|
+
| **Passive from any https site** (`anyHttps`, on top of either) | `egress: { ...LIBRARY_CDNS, anyHttps: ["img"] }`; closed but for them: `egress: { anyHttps: ["img"] }` | The passive kinds you name (`img`, `media`, `font`) from any https site. Never scripts, styles, data, workers or frames, and never `http:`: a config naming another kind is refused. | Any site an image names learns that someone viewed the content, and from which address; content can send data out in an image URL to a server of its choosing (the channel P006 closes); whoever owns an image controls what it shows, inside the frame. | A host showing content that already exists, with hotlinked media: Raft's HTML attachment previews, reports whose `<img>` point at other sites (the case P059 was written for). | `images from any https site` (`fonts, images, audio and video from any https site` for all three) | [P059](DECISIONS.md#p059--2026-10-11--passive-content-may-load-from-any-https-site-by-the-hosts-explicit-choice--accepted), [P062](DECISIONS.md#p062--2026-10-11--serveddomainegress-holds-a-host-to-its-own-configs-egress--accepted) | `leak/cdn.spec.ts` (a hotlinked image loads; a script, a stylesheet and a fetch to the same site never reach it; without the flag, nothing does); served `served.domain.egress` (the image must reach an https canary; scripts, styles, fetches and frames never), `leak/served/any-https.spec.ts` |
|
|
56
|
+
|
|
57
|
+
How to decide: **start closed; add `LIBRARY_CDNS` if agents use libraries; add passive `anyHttps`
|
|
58
|
+
only for existing content with hotlinks**, and only the kinds it hotlinks (usually `img`). An
|
|
59
|
+
agent writing new content can inline what it shows, so agent-made pages never need `anyHttps`.
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
import { defineDisplays, LIBRARY_CDNS } from "@botiverse/porthole";
|
|
63
|
+
|
|
64
|
+
export const displays = defineDisplays({
|
|
65
|
+
// Closed: nothing to write.
|
|
66
|
+
widget: { preset: "inlineWidget" },
|
|
67
|
+
// Library CDNs (and, if you need one, a script host of your own).
|
|
68
|
+
artifact: { preset: "artifact", options: { egress: { ...LIBRARY_CDNS, script: [...(LIBRARY_CDNS.script ?? []), "https://cdn.example.com"] } } },
|
|
69
|
+
// Existing pages with hotlinked images: Library CDNs, and images from any https site.
|
|
70
|
+
attachment: { preset: "artifact", options: { egress: { ...LIBRARY_CDNS, anyHttps: ["img"] } } },
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- Each kind's documents name it as their preset (`document.preset: "attachment"`); `egress` is
|
|
75
|
+
the kind's whole policy, so kinds that differ in egress are kinds of their own.
|
|
76
|
+
- Origins are exact (`https://cdn.example.com`), or `https://*.` a domain of your own; a wildcard
|
|
77
|
+
over a public suffix (`*.com`, `*.github.io`) is refused.
|
|
78
|
+
- An opaque frame also inherits your page's CSP ([P058](DECISIONS.md#p058--2026-10-11--an-opaque-frame-is-as-closed-as-its-page-the-suite-says-when-a-case-cant-be-observed--accepted)): where your page closes images or
|
|
79
|
+
fetches, opaque content is that closed whatever its egress opens (see "The page's CSP"). A
|
|
80
|
+
served frame has only its own policy.
|
|
81
|
+
- `checkPage` and `lintContent` tell the agent when its content reaches past the kind's egress, by
|
|
82
|
+
directive. The manual names exactly the origins the CSP allows (`test/agreement.test.ts`), and
|
|
83
|
+
DESIGN.md § "Egress hardening, each with its test" is the long form.
|
|
84
|
+
|
|
45
85
|
## 3. Opaque displays: the page only
|
|
46
86
|
|
|
47
87
|
```js
|
|
@@ -66,8 +106,8 @@ a copy button copied), and `renderConfirm` (your own dialog, given `accept`, `de
|
|
|
66
106
|
`redirect`: Porthole keeps the queue, runs `accept` inside its click, and counts declines toward
|
|
67
107
|
muting the display; `redirect`, for "edit it first", answers the call `"redirected"` and neither
|
|
68
108
|
counts nor resets the count). The request names the display (`request.display`: its `id`,
|
|
69
|
-
`title`, and the `instance`
|
|
70
|
-
records. `useRunAgain()` gives a "run again" button.
|
|
109
|
+
`title`, and the `instance` you gave the frame, served or opaque), so the dialog can say what it
|
|
110
|
+
is from your own records. It stays on your side: an opaque frame never gets the instance. `useRunAgain()` gives a "run again" button.
|
|
71
111
|
|
|
72
112
|
## 4. Served pages: the host kit
|
|
73
113
|
|
package/docs/DECISIONS.md
CHANGED
|
@@ -2142,3 +2142,21 @@ and the failure shows only where the path runs.
|
|
|
2142
2142
|
for an opaque one); `test/kit03.test.ts` (a host made in the `listen` callback is checked without a
|
|
2143
2143
|
request, once, however often it is started).
|
|
2144
2144
|
|
|
2145
|
+
## P077 · 2026-10-12 · A confirmation names the host's instance in opaque frames too · Accepted
|
|
2146
|
+
|
|
2147
|
+
**Decision.** P076 gave `ConfirmRequest.display` the instance only where the frame is served,
|
|
2148
|
+
because `PortholeView` handed the instance to its frame only then. The instance is the host's own
|
|
2149
|
+
value in both modes: Ferry passes `instance={widgetInstance(sessionId)}` to `PortholeView`
|
|
2150
|
+
whether its frame ends up served or opaque (the content domain down, absent on a self-hosted
|
|
2151
|
+
server, the first seconds before the probe). 0.3.4: `PortholeView` gives its frame the instance
|
|
2152
|
+
in both modes, and an opaque mount's `instance` (`MountOptions`, `PortholeFrame`) is documented
|
|
2153
|
+
as the host's own name for what it shows, given back in its confirmations only.
|
|
2154
|
+
|
|
2155
|
+
**Never sent to the frame.** An opaque frame's document is the shell built from the config, with
|
|
2156
|
+
no instance in it; the instance is used to locate only a served frame, and the bridge's display
|
|
2157
|
+
(where confirmations get it) stays on the host's side. A served frame already knows its scope:
|
|
2158
|
+
its origin is named from it.
|
|
2159
|
+
**Measured.** `leak/react.spec.ts`: `renderConfirm` names the instance the host gave, served and
|
|
2160
|
+
opaque (failing on 0.3.3 for opaque); for an opaque frame, the instance is in none of the frame's
|
|
2161
|
+
attributes, its document, its address or name, nor any message its page heard.
|
|
2162
|
+
|
package/docs/DESIGN.md
CHANGED
|
@@ -541,7 +541,8 @@ What both adopters still wrote after 0.2 moves into Porthole (ADOPTING.md is the
|
|
|
541
541
|
opaque, with its fallback), `usePortholeLink`, and the provider's shared `scheme`, `theme`
|
|
542
542
|
(`cssVariableTheme`), `nonce: "auto"`, `handlers`, `openLink`, `notify` and `renderConfirm`
|
|
543
543
|
(`accept`, `decline`, and `redirect`: `"redirected"`, which doesn't count toward muting, P074;
|
|
544
|
-
the request's `display` carries the
|
|
544
|
+
the request's `display` carries the instance the host gave the frame, served or opaque, and an
|
|
545
|
+
opaque frame never gets it, P076, P077).
|
|
545
546
|
A flip of the provider's scheme or a new themeKey re-themes running frames in place: no effect
|
|
546
547
|
that makes a display depends on the context value those renew (#9, P074).
|
|
547
548
|
- **The viewer handoff** for a page that holds a token: `POST /porthole/handoff` with the app's
|
|
@@ -747,7 +748,9 @@ absent.
|
|
|
747
748
|
|
|
748
749
|
## Egress hardening, each with its test
|
|
749
750
|
|
|
750
|
-
Closed by default; opened only to origins the config declares.
|
|
751
|
+
Closed by default; opened only to origins the config declares. For a host choosing a level
|
|
752
|
+
(closed, library CDNs, passive media from any https site), ADOPTING.md § "Choosing egress" is the
|
|
753
|
+
summary; this section is the long form. The leak suite
|
|
751
754
|
(`src/conformance/probes.ts`, run by `pnpm test:leak` against the reference host)
|
|
752
755
|
attempts each channel from inside the content, as an agent's code would, and asserts
|
|
753
756
|
with an out-of-band oracle that nothing left: an HTTP canary that also counts raw TCP
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botiverse/porthole",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "A host-side sandbox for agent-made HTML: isolation, egress hardening, a themed shell, gated host functions, and the agent manual, from one config.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": {
|
package/src/bridge/types.ts
CHANGED
|
@@ -30,8 +30,9 @@ export type CapabilityHandler<N extends CapabilityName> = (
|
|
|
30
30
|
export type CapabilityHandlers = { readonly [N in HandledCapability]?: CapabilityHandler<N> };
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* The display a confirmation is for, as the host named it: its id and title, and the instance
|
|
34
|
-
*
|
|
33
|
+
* The display a confirmation is for, as the host named it: its id and title, and the instance the
|
|
34
|
+
* host gave it, served or opaque (P076, P077), so a host can word its dialog from its own records.
|
|
35
|
+
* Host-side only: none of it is the content's word, and an opaque frame never gets the instance.
|
|
35
36
|
*/
|
|
36
37
|
export interface ConfirmDisplay {
|
|
37
38
|
readonly id: string;
|
package/src/guide/guide.ts
CHANGED
|
@@ -87,6 +87,16 @@ const KIND_WORDS: Readonly<Record<EgressKind, string>> = {
|
|
|
87
87
|
/** What the manual calls `https:` (any https site), where a config opens passive kinds to it. */
|
|
88
88
|
export const ANY_HTTPS_SITE = "any https site";
|
|
89
89
|
|
|
90
|
+
/** Kinds in words, as a list: "fonts, images, audio and video" (media's two words are two items). */
|
|
91
|
+
const kindsInWords = (kinds: readonly EgressKind[]): string => {
|
|
92
|
+
const words = kinds.flatMap((kind) =>
|
|
93
|
+
kind === "media" ? ["audio", "video"] : [KIND_WORDS[kind]],
|
|
94
|
+
);
|
|
95
|
+
return words.length === 1
|
|
96
|
+
? (words[0] ?? "")
|
|
97
|
+
: `${words.slice(0, -1).join(", ")} and ${words.at(-1)}`;
|
|
98
|
+
};
|
|
99
|
+
|
|
90
100
|
/** The sources content may load `kind` from, as the manual names them: origins, any https site. */
|
|
91
101
|
const sourcesFor = (config: PortholeConfig, kind: EgressKind): string[] => [
|
|
92
102
|
...(anyHttps(config, kind) ? [ANY_HTTPS_SITE] : []),
|
|
@@ -109,16 +119,18 @@ function network(config: PortholeConfig): string {
|
|
|
109
119
|
byOrigin.set(origin, [...(byOrigin.get(origin) ?? []), kind]);
|
|
110
120
|
}
|
|
111
121
|
}
|
|
122
|
+
// Any https site last, the widest: "…; fonts, images, audio and video from any https site" (P059).
|
|
123
|
+
const anywhere = byOrigin.get(ANY_HTTPS_SITE);
|
|
124
|
+
byOrigin.delete(ANY_HTTPS_SITE);
|
|
112
125
|
const groups = new Map<string, string[]>();
|
|
113
126
|
for (const [origin, each] of byOrigin) {
|
|
114
|
-
const
|
|
115
|
-
const key =
|
|
116
|
-
words.length === 1
|
|
117
|
-
? (words[0] ?? "")
|
|
118
|
-
: `${words.slice(0, -1).join(", ")} and ${words.at(-1)}`;
|
|
127
|
+
const key = kindsInWords(each);
|
|
119
128
|
groups.set(key, [...(groups.get(key) ?? []), origin]);
|
|
120
129
|
}
|
|
121
|
-
const parts = [
|
|
130
|
+
const parts = [
|
|
131
|
+
...[...groups].map(([words, origins]) => `${words} from ${origins.join(", ")}`),
|
|
132
|
+
...(anywhere === undefined ? [] : [`${kindsInWords(anywhere)} from ${ANY_HTTPS_SITE}`]),
|
|
133
|
+
];
|
|
122
134
|
return `Network: only ${parts.join("; ")}. Anything else fails.`;
|
|
123
135
|
}
|
|
124
136
|
|
|
@@ -416,13 +428,10 @@ export function generateToolDescription(config: PortholeConfig): string {
|
|
|
416
428
|
),
|
|
417
429
|
),
|
|
418
430
|
];
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
.map((kind) => KIND_WORDS[kind]);
|
|
431
|
+
// The same words, in the same order, as the manual's Network line.
|
|
432
|
+
const passive = (["font", "img", "media"] as const).filter((kind) => anyHttps(config, kind));
|
|
422
433
|
const fromAnywhere =
|
|
423
|
-
passive.length === 0
|
|
424
|
-
? ""
|
|
425
|
-
: `${passive.length === 1 ? passive[0] : `${passive.slice(0, -1).join(", ")} and ${passive.at(-1)}`} from ${ANY_HTTPS_SITE}`;
|
|
434
|
+
passive.length === 0 ? "" : `${kindsInWords(passive)} from ${ANY_HTTPS_SITE}`;
|
|
426
435
|
const net =
|
|
427
436
|
origins.length === 0 && fromAnywhere === ""
|
|
428
437
|
? "with no network (nothing loads from outside)"
|
package/src/host/types.ts
CHANGED
|
@@ -51,7 +51,11 @@ export interface MountOptions {
|
|
|
51
51
|
readonly scheme: ColorScheme;
|
|
52
52
|
/** Handlers for this display only, over the host's. */
|
|
53
53
|
readonly handlers?: CapabilityHandlers;
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Domain and external isolation: the instance to locate. Opaque: the host's own name for what
|
|
56
|
+
* the display shows, given back to the host in its confirmations (`ConfirmRequest.display`) and
|
|
57
|
+
* never sent to the frame (P077).
|
|
58
|
+
*/
|
|
55
59
|
readonly instance?: InstanceRef;
|
|
56
60
|
/** A whole document the frame starts with (an MCP Apps view), hardened by the shell. */
|
|
57
61
|
readonly document?: string;
|
package/src/react/frame.tsx
CHANGED
|
@@ -359,7 +359,10 @@ export interface PortholeFrameProps {
|
|
|
359
359
|
readonly partial?: boolean;
|
|
360
360
|
/** A whole document to start with (an MCP Apps view). */
|
|
361
361
|
readonly document?: string;
|
|
362
|
-
/**
|
|
362
|
+
/**
|
|
363
|
+
* Domain and external isolation: the instance to show. Opaque: the host's own name for what it
|
|
364
|
+
* shows, for its confirmations only, never sent to the frame (P077).
|
|
365
|
+
*/
|
|
363
366
|
readonly instance?: InstanceRef;
|
|
364
367
|
/** The color scheme it shows in. Default: the provider's `scheme`, else light. */
|
|
365
368
|
readonly scheme?: ColorScheme;
|
package/src/react/view.tsx
CHANGED
|
@@ -37,7 +37,10 @@ export interface PortholeViewProps extends Omit<
|
|
|
37
37
|
> {
|
|
38
38
|
/** The display kind (`defineDisplays`). */
|
|
39
39
|
readonly display: string;
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* The instance: what a served frame shows; for an opaque one, the host's own name for it, given
|
|
42
|
+
* back in its confirmations only, never sent to the frame (P077).
|
|
43
|
+
*/
|
|
41
44
|
readonly instance?: InstanceRef;
|
|
42
45
|
/**
|
|
43
46
|
* The content: a served shell's to draw, and what an opaque frame shows while frames aren't
|
|
@@ -144,7 +147,7 @@ export function PortholeView(props: PortholeViewProps): ReactElement | null {
|
|
|
144
147
|
{...frame}
|
|
145
148
|
config={config}
|
|
146
149
|
generation={(frame.generation ?? 0) + generation}
|
|
147
|
-
{...(
|
|
150
|
+
{...(instance === undefined ? {} : { instance })}
|
|
148
151
|
{...(content === undefined ? {} : { content })}
|
|
149
152
|
onOutcome={(outcome: FrameOutcome) => {
|
|
150
153
|
onOutcome?.(outcome);
|