@botiverse/porthole 0.6.0 → 0.8.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 (208) hide show
  1. package/README.md +25 -2
  2. package/THIRD_PARTY_NOTICES.md +421 -0
  3. package/dist/bridge/bounded-text.d.ts +34 -0
  4. package/dist/bridge/bounded-text.js +188 -0
  5. package/dist/bridge/bridge.d.ts +38 -5
  6. package/dist/bridge/bridge.js +469 -39
  7. package/dist/bridge/json-data.d.ts +28 -0
  8. package/dist/bridge/json-data.js +86 -0
  9. package/dist/bridge/navigation.d.ts +5 -0
  10. package/dist/bridge/navigation.js +7 -0
  11. package/dist/bridge/refusal.d.ts +5 -1
  12. package/dist/bridge/refusal.js +17 -0
  13. package/dist/bridge/types.d.ts +73 -5
  14. package/dist/check/check.d.ts +7 -0
  15. package/dist/check/check.js +1 -0
  16. package/dist/check/instrument.d.ts +3 -0
  17. package/dist/check/lint.js +4 -2
  18. package/dist/check/page-source.js +1 -1
  19. package/dist/check/page.js +16 -0
  20. package/dist/check/tools.js +2 -3
  21. package/dist/compile/compile.d.ts +6 -0
  22. package/dist/compile/compile.js +3 -1
  23. package/dist/compile/policy.d.ts +55 -0
  24. package/dist/compile/policy.js +157 -0
  25. package/dist/config/capabilities.d.ts +85 -7
  26. package/dist/config/capabilities.js +32 -2
  27. package/dist/config/schema.d.ts +35 -0
  28. package/dist/config/validate.d.ts +9 -3
  29. package/dist/config/validate.js +92 -8
  30. package/dist/config/warnings.d.ts +20 -0
  31. package/dist/config/warnings.js +25 -0
  32. package/dist/conformance/behavior.js +46 -1
  33. package/dist/conformance/cookies.d.ts +15 -0
  34. package/dist/conformance/cookies.js +80 -0
  35. package/dist/conformance/harness/page.d.ts +1 -0
  36. package/dist/conformance/harness/page.js +9 -2
  37. package/dist/conformance/harness-source.js +1 -1
  38. package/dist/conformance/host-kit.js +5 -1
  39. package/dist/conformance/index.d.ts +11 -0
  40. package/dist/conformance/index.js +2 -0
  41. package/dist/conformance/limits.js +38 -1
  42. package/dist/conformance/runtime.d.ts +58 -0
  43. package/dist/conformance/runtime.js +324 -0
  44. package/dist/conformance/served.d.ts +2 -0
  45. package/dist/conformance/served.js +737 -4
  46. package/dist/files/paths.js +4 -0
  47. package/dist/guide/gates.d.ts +9 -0
  48. package/dist/guide/gates.js +31 -0
  49. package/dist/guide/guide.d.ts +2 -0
  50. package/dist/guide/guide.js +35 -33
  51. package/dist/guide/limits.js +4 -4
  52. package/dist/guide/runtime.d.ts +13 -0
  53. package/dist/guide/runtime.js +210 -0
  54. package/dist/host/create-host.js +73 -37
  55. package/dist/host/locate.js +8 -0
  56. package/dist/host/locator.js +7 -0
  57. package/dist/host/pages-of-set.d.ts +43 -0
  58. package/dist/host/pages-of-set.js +196 -0
  59. package/dist/host/types.d.ts +26 -1
  60. package/dist/index.d.ts +11 -4
  61. package/dist/index.js +11 -2
  62. package/dist/isolation/types.d.ts +8 -0
  63. package/dist/mcp/adapter.js +11 -15
  64. package/dist/node/index.d.ts +36 -4
  65. package/dist/node/index.js +402 -101
  66. package/dist/presets/presets.d.ts +22 -8
  67. package/dist/presets/presets.js +40 -8
  68. package/dist/protocol/live-data.d.ts +6 -2
  69. package/dist/protocol/live-data.js +20 -1
  70. package/dist/protocol/mcp-apps.d.ts +13 -2
  71. package/dist/protocol/mcp-apps.js +10 -2
  72. package/dist/protocol/message-text.d.ts +8 -0
  73. package/dist/protocol/message-text.js +29 -0
  74. package/dist/protocol/runtime-calls.d.ts +28 -0
  75. package/dist/protocol/runtime-calls.js +116 -0
  76. package/dist/protocol/shell-adapter.js +64 -25
  77. package/dist/react/context-notice.d.ts +32 -0
  78. package/dist/react/context-notice.js +28 -0
  79. package/dist/react/dialog.js +91 -16
  80. package/dist/react/frame.d.ts +25 -1
  81. package/dist/react/frame.js +85 -2
  82. package/dist/react/index.d.ts +2 -1
  83. package/dist/react/index.js +2 -1
  84. package/dist/runtime/contract.d.ts +201 -0
  85. package/dist/runtime/contract.js +245 -0
  86. package/dist/runtime/db.d.ts +188 -0
  87. package/dist/runtime/db.js +502 -0
  88. package/dist/runtime/declaration.d.ts +100 -0
  89. package/dist/runtime/declaration.js +363 -0
  90. package/dist/runtime/levels.d.ts +33 -0
  91. package/dist/runtime/levels.js +41 -0
  92. package/dist/runtime/requests.d.ts +125 -0
  93. package/dist/runtime/requests.js +215 -0
  94. package/dist/runtime/segments.d.ts +8 -0
  95. package/dist/runtime/segments.js +14 -0
  96. package/dist/runtime/types.generated.d.ts +1 -0
  97. package/dist/runtime/types.generated.js +19 -0
  98. package/dist/server/files.d.ts +19 -1
  99. package/dist/server/files.js +115 -6
  100. package/dist/server/host.d.ts +24 -2
  101. package/dist/server/host.js +137 -2
  102. package/dist/server/index.d.ts +3 -2
  103. package/dist/server/index.js +2 -1
  104. package/dist/server/peer.d.ts +4 -0
  105. package/dist/server/peer.js +19 -0
  106. package/dist/server/proxy.d.ts +6 -0
  107. package/dist/server/proxy.js +12 -3
  108. package/dist/server/pseudonym.d.ts +9 -0
  109. package/dist/server/pseudonym.js +20 -0
  110. package/dist/server/server.d.ts +0 -5
  111. package/dist/server/server.js +318 -52
  112. package/dist/server/types.d.ts +74 -2
  113. package/dist/shell/document.d.ts +16 -0
  114. package/dist/shell/document.js +19 -2
  115. package/dist/shell/legacy.d.ts +21 -0
  116. package/dist/shell/legacy.js +63 -0
  117. package/dist/shell/plan.d.ts +17 -1
  118. package/dist/shell/plan.js +13 -2
  119. package/dist/shell/runtime.js +390 -56
  120. package/dist/shell/use.d.ts +15 -0
  121. package/dist/shell/use.js +235 -0
  122. package/docs/ADOPTING.md +205 -15
  123. package/docs/ARCHITECTURE.md +34 -5
  124. package/docs/DECISIONS.md +1867 -11
  125. package/docs/DESIGN.md +137 -17
  126. package/docs/THREAT_MODEL.md +616 -0
  127. package/package.json +16 -3
  128. package/src/bridge/bounded-text.ts +240 -0
  129. package/src/bridge/bridge.ts +601 -51
  130. package/src/bridge/json-data.ts +95 -0
  131. package/src/bridge/navigation.ts +10 -0
  132. package/src/bridge/refusal.ts +17 -0
  133. package/src/bridge/types.ts +76 -5
  134. package/src/check/check.ts +8 -0
  135. package/src/check/instrument.ts +3 -0
  136. package/src/check/lint.ts +4 -2
  137. package/src/check/page.ts +16 -0
  138. package/src/check/tools.ts +2 -3
  139. package/src/compile/compile.ts +9 -1
  140. package/src/compile/policy.ts +177 -0
  141. package/src/config/capabilities.ts +71 -5
  142. package/src/config/schema.ts +35 -0
  143. package/src/config/validate.ts +141 -8
  144. package/src/config/warnings.ts +42 -0
  145. package/src/conformance/behavior.ts +54 -1
  146. package/src/conformance/cookies.ts +93 -0
  147. package/src/conformance/harness/page.ts +11 -2
  148. package/src/conformance/host-kit.ts +10 -1
  149. package/src/conformance/index.ts +17 -0
  150. package/src/conformance/limits.ts +39 -1
  151. package/src/conformance/runtime.ts +594 -0
  152. package/src/conformance/served.ts +888 -4
  153. package/src/files/paths.ts +4 -0
  154. package/src/guide/gates.ts +37 -0
  155. package/src/guide/guide.ts +61 -55
  156. package/src/guide/limits.ts +4 -4
  157. package/src/guide/runtime.ts +253 -0
  158. package/src/host/create-host.ts +88 -36
  159. package/src/host/locate.ts +10 -0
  160. package/src/host/locator.ts +11 -0
  161. package/src/host/pages-of-set.ts +226 -0
  162. package/src/host/types.ts +33 -1
  163. package/src/index.ts +94 -0
  164. package/src/isolation/types.ts +8 -0
  165. package/src/mcp/adapter.ts +16 -20
  166. package/src/node/index.ts +507 -116
  167. package/src/presets/presets.ts +67 -17
  168. package/src/protocol/live-data.ts +31 -3
  169. package/src/protocol/mcp-apps.ts +11 -2
  170. package/src/protocol/message-text.ts +36 -0
  171. package/src/protocol/runtime-calls.ts +141 -0
  172. package/src/protocol/shell-adapter.ts +79 -26
  173. package/src/react/context-notice.tsx +95 -0
  174. package/src/react/dialog.tsx +108 -15
  175. package/src/react/frame.tsx +120 -0
  176. package/src/react/index.ts +8 -1
  177. package/src/runtime/contract.ts +339 -0
  178. package/src/runtime/db.ts +650 -0
  179. package/src/runtime/declaration.ts +516 -0
  180. package/src/runtime/levels.ts +69 -0
  181. package/src/runtime/requests.ts +355 -0
  182. package/src/runtime/segments.ts +17 -0
  183. package/src/runtime/types.generated.ts +19 -0
  184. package/src/server/files.ts +138 -7
  185. package/src/server/host.ts +170 -3
  186. package/src/server/index.ts +4 -0
  187. package/src/server/peer.ts +21 -0
  188. package/src/server/proxy.ts +13 -3
  189. package/src/server/pseudonym.ts +21 -0
  190. package/src/server/server.ts +370 -57
  191. package/src/server/types.ts +73 -2
  192. package/src/shell/document.ts +29 -4
  193. package/src/shell/legacy.ts +64 -0
  194. package/src/shell/plan.ts +37 -3
  195. package/src/shell/runtime.ts +390 -56
  196. package/src/shell/use.ts +235 -0
  197. package/types/runtime/v1/artifact.d.ts +50 -0
  198. package/types/runtime/v1/assets.d.ts +43 -0
  199. package/types/runtime/v1/chat.d.ts +13 -0
  200. package/types/runtime/v1/clipboard.d.ts +14 -0
  201. package/types/runtime/v1/comments.d.ts +24 -0
  202. package/types/runtime/v1/context.d.ts +27 -0
  203. package/types/runtime/v1/data.d.ts +29 -0
  204. package/types/runtime/v1/db.d.ts +110 -0
  205. package/types/runtime/v1/downloads.d.ts +22 -0
  206. package/types/runtime/v1/links.d.ts +13 -0
  207. package/types/runtime/v1/porthole.d.ts +44 -0
  208. package/types/runtime/v1/user.d.ts +19 -0
@@ -1,8 +1,9 @@
1
1
  import { ANNOTATE_METHODS, } from "../annotate/types.js";
2
2
  import { annotateMode, checkMarks, parseReport } from "../annotate/validate.js";
3
- import { createBridge, onceConsent } from "../bridge/bridge.js";
3
+ import { createBridge, onceConsent, } from "../bridge/bridge.js";
4
4
  import { compile } from "../compile/compile.js";
5
5
  import { servesFiles } from "../files/paths.js";
6
+ import { pagesOfSet } from "./pages-of-set.js";
6
7
  import { declaredCapabilities, effectiveGates } from "../compile/policy.js";
7
8
  import { isRefused } from "../bridge/refusal.js";
8
9
  import { capabilitySpec } from "../config/capabilities.js";
@@ -12,10 +13,10 @@ import { webPlatform } from "../platform/web.js";
12
13
  import { MCP_APPS_STYLE_VARIABLES, PORTHOLE_STYLES, } from "../protocol/mcp-apps.js";
13
14
  import { shellAdapter } from "../protocol/shell-adapter.js";
14
15
  import { resolveTheme } from "../theme/variables.js";
16
+ import { checkDeclaration } from "../runtime/declaration.js";
17
+ import { parseViewer } from "../runtime/levels.js";
15
18
  /** How long a display may take to load before its outcome is a timeout, by default. */
16
19
  const DEFAULT_LOAD_TIMEOUT_MS = 15_000;
17
- /** How long a set's page said its next load is another of its pages (P084), ms. */
18
- const PAGE_OF_SET_MS = 10_000;
19
20
  /** How many times a display is started again after its content navigated its frame away. */
20
21
  const MAX_RESTARTS = 3;
21
22
  const BASE_KEYS = new Set(["hostContextChanged", "teardown", "close"]);
@@ -59,6 +60,24 @@ export function createHost(config, options = {}) {
59
60
  if (config.isolation !== "opaque" && mount.instance === undefined) {
60
61
  throw new TypeError(`${config.isolation} isolation needs MountOptions.instance`);
61
62
  }
63
+ // The page's declaration and the viewer (P086, P087): the host's records, checked once.
64
+ // Under a runtime every mount says what its page declared, or null for a page published
65
+ // before 0.7, which then has 0.6's surface (after the review: never by omission).
66
+ if (config.runtime !== undefined && mount.declaration === undefined) {
67
+ throw new TypeError("Under config.runtime a mount needs MountOptions.declaration: the page's stored declaration, or null for a page published before 0.7");
68
+ }
69
+ if (config.runtime === undefined &&
70
+ mount.declaration !== undefined &&
71
+ mount.declaration !== null) {
72
+ throw new TypeError("MountOptions.declaration needs config.runtime: nothing would hold the page to it");
73
+ }
74
+ const declaration = mount.declaration === undefined || mount.declaration === null
75
+ ? null
76
+ : checkDeclaration(mount.declaration, config);
77
+ const mountViewer = mount.viewer === undefined ? null : parseViewer(mount.viewer);
78
+ if (mount.viewer !== undefined && mountViewer === null) {
79
+ throw new TypeError("MountOptions.viewer is { level: view | interact | admin | owner, id?, name? }");
80
+ }
62
81
  const listeners = new Map();
63
82
  const emit = (event, detail) => {
64
83
  for (const listener of listeners.get(event) ?? []) {
@@ -81,10 +100,9 @@ export function createHost(config, options = {}) {
81
100
  let height = mount.initialHeightPx ?? 0;
82
101
  let surface = null;
83
102
  let connection = null;
103
+ let bridge = null;
84
104
  let destroyed = false;
85
105
  let restarts = 0;
86
- // Until when the frame's next load is another page of its own set, as its content said (P084).
87
- let pageOfSetUntil = 0;
88
106
  let generation = 0;
89
107
  // The viewer's answer for this display (P079): asked once, kept across its frames; or the
90
108
  // host's refusal of them all (P080).
@@ -123,20 +141,21 @@ export function createHost(config, options = {}) {
123
141
  * A report from the frame: checked, taken only while the host asked for it (a selection
124
142
  * only in select mode, results only for its own marks), then through the bridge's gates.
125
143
  */
126
- const onAnnotation = (raw, bridge) => {
144
+ const onAnnotation = (raw, through) => {
127
145
  if (!isRecord(raw) ||
128
146
  raw.jsonrpc !== "2.0" ||
129
147
  "id" in raw ||
130
148
  typeof raw.method !== "string") {
131
149
  return;
132
150
  }
133
- const type = REPORTS[raw.method];
151
+ // Its own entries only: `constructor` or `toString` is no report (P095).
152
+ const type = Object.hasOwn(REPORTS, raw.method) ? REPORTS[raw.method] : undefined;
134
153
  if (type === undefined) {
135
154
  return;
136
155
  }
137
156
  let report = parseReport({ ...(isRecord(raw.params) ? raw.params : {}), type });
138
157
  if (report === null) {
139
- void bridge.call("annotate", null);
158
+ void through.call("annotate", null);
140
159
  return;
141
160
  }
142
161
  switch (report.type) {
@@ -172,7 +191,7 @@ export function createHost(config, options = {}) {
172
191
  break;
173
192
  }
174
193
  }
175
- void bridge.call("annotate", report);
194
+ void through.call("annotate", report);
176
195
  };
177
196
  const needsAnnotate = (operation) => {
178
197
  if (!annotates) {
@@ -272,8 +291,11 @@ export function createHost(config, options = {}) {
272
291
  }
273
292
  };
274
293
  const stop = () => {
294
+ // The run's bridge refuses what still waits for a confirmation: a yes to it runs nothing
295
+ // (P095, after the review), and the next run's bridge starts its count again.
296
+ bridge?.close();
297
+ bridge = null;
275
298
  handshaken = false;
276
- pageOfSetUntil = 0;
277
299
  abort?.abort();
278
300
  abort = null;
279
301
  outcomeWatch?.stop();
@@ -284,7 +306,18 @@ export function createHost(config, options = {}) {
284
306
  surface = null;
285
307
  };
286
308
  const start = (source) => {
287
- const created = platform.createSurface(container, {
309
+ const navigatedAway = () => {
310
+ emit("navigated", undefined);
311
+ if (restarts < MAX_RESTARTS) {
312
+ restarts += 1;
313
+ run();
314
+ }
315
+ else {
316
+ stop();
317
+ contentError("The content kept navigating its frame away; it was stopped.");
318
+ }
319
+ };
320
+ const framed = platform.createSurface(container, {
288
321
  source,
289
322
  title: mount.title,
290
323
  sandbox: compiled.sandbox,
@@ -298,6 +331,24 @@ export function createHost(config, options = {}) {
298
331
  ? { initialHeightPx: height }
299
332
  : { fill: true, initialHeightPx: config.limits.minHeightPx }),
300
333
  });
334
+ // A frame that speaks: another page of the content's own set (P084) is the same content,
335
+ // still connected (the new page's shell says hello again on the same transport); any other
336
+ // load after the first is the content navigating away (P031), and the display starts
337
+ // again. `pagesOfSet` tells them apart at each load (P098): what a new page says before
338
+ // its load is delivered as it comes, as P084 had it; from a load no notice explained until
339
+ // a notice for the mounted version comes, nothing the frame says reaches the display. A
340
+ // url-mode app's frame navigates as the app does (its entry page, then the app): never
341
+ // started again.
342
+ const mounted = mount.instance?.document;
343
+ const created = speaks
344
+ ? pagesOfSet({
345
+ surface: framed,
346
+ set: servesFiles(config) && mounted?.kind === "artifact"
347
+ ? { id: mounted.id, version: mounted.version }
348
+ : null,
349
+ away: navigatedAway,
350
+ })
351
+ : framed;
301
352
  surface = created;
302
353
  const watch = watchOutcome({
303
354
  surface: created,
@@ -318,7 +369,9 @@ export function createHost(config, options = {}) {
318
369
  });
319
370
  return;
320
371
  }
321
- const bridge = createBridge({
372
+ // The host's access at issue says who is viewing (P087); else the mount's word.
373
+ const viewer = (source.kind === "url" ? source.viewer : undefined) ?? mountViewer ?? undefined;
374
+ const opening = createBridge({
322
375
  config,
323
376
  display: {
324
377
  id: mount.displayId,
@@ -328,27 +381,28 @@ export function createHost(config, options = {}) {
328
381
  handlers,
329
382
  ...(options.confirm === undefined ? {} : { confirm: options.confirm }),
330
383
  ...(consent === undefined ? {} : { consent }),
384
+ ...(options.show === undefined ? {} : { show: options.show }),
331
385
  ...(options.cached === undefined ? {} : { cached: options.cached }),
332
386
  userActivation: () => created.userActivation(),
333
387
  onEvent: onBridge,
388
+ ...(declaration === null ? {} : { declaration }),
389
+ ...(viewer === undefined ? {} : { viewer }),
334
390
  });
335
391
  if (annotates) {
336
- created.transport.listen((raw) => onAnnotation(raw, bridge));
392
+ created.transport.listen((raw) => onAnnotation(raw, opening));
337
393
  }
394
+ bridge = opening;
338
395
  const opened = adapter.connect({
339
396
  display: { id: mount.displayId, title: mount.title },
340
397
  compiled,
341
398
  transport: created.transport,
342
- bridge,
399
+ bridge: opening,
343
400
  hostInfo,
344
401
  hostContext,
345
402
  emit: (event) => {
346
403
  if (event.type === "navigating") {
347
- // Only a display whose pages may come with files (P084), for the next load only, and
348
- // only soon: content can't bank it to skip a restart later (P031).
349
- if (servesFiles(config)) {
350
- pageOfSetUntil = Date.now() + PAGE_OF_SET_MS;
351
- }
404
+ // Which loads are the set's own pages is the frame's surface's to tell (P084, P098:
405
+ // `pagesOfSet`, from the frame's own words before any of them reach this display).
352
406
  return;
353
407
  }
354
408
  if (event.type === "initialized") {
@@ -366,24 +420,6 @@ export function createHost(config, options = {}) {
366
420
  for (const [name, args] of replay) {
367
421
  opened[name]?.(...args);
368
422
  }
369
- created.onNavigated(() => {
370
- // Another page of the content's own set (P084): the same content, still connected (the
371
- // new page's shell says hello again on the same transport). Not a restart.
372
- const ofSet = pageOfSetUntil > Date.now();
373
- pageOfSetUntil = 0;
374
- if (ofSet) {
375
- return;
376
- }
377
- emit("navigated", undefined);
378
- if (restarts < MAX_RESTARTS) {
379
- restarts += 1;
380
- run();
381
- }
382
- else {
383
- stop();
384
- contentError("The content kept navigating its frame away; it was stopped.");
385
- }
386
- });
387
423
  };
388
424
  const run = () => {
389
425
  stop();
@@ -1,4 +1,5 @@
1
1
  import { checkFrameLocation } from "../isolation/served.js";
2
+ import { parseViewer } from "../runtime/levels.js";
2
3
  /**
3
4
  * Where a served frame (domain or external isolation) loads from: the host's locator answers, and
4
5
  * `checkFrameLocation` checks the answer (one of the config's content origins, never the host's
@@ -7,10 +8,17 @@ import { checkFrameLocation } from "../isolation/served.js";
7
8
  export async function locateServed(locator, instance, config, hostOrigin, signal) {
8
9
  const location = await locator.locate(instance, signal);
9
10
  checkFrameLocation(location, config.contentOrigins, hostOrigin);
11
+ // The host's access, as its backend answered (P087): a viewer that doesn't parse is the host's
12
+ // error, never no viewer (after the review: a mount's own would take its place).
13
+ const viewer = location.viewer === undefined ? null : parseViewer(location.viewer);
14
+ if (location.viewer !== undefined && viewer === null) {
15
+ throw new TypeError("The host's location names a viewer that isn't one: { level: view | interact | admin | owner, id?: one path segment, name? }");
16
+ }
10
17
  return {
11
18
  kind: "url",
12
19
  url: new URL(location.url).href,
13
20
  origin: location.origin,
14
21
  ...(location.reports === true ? { reports: true } : {}),
22
+ ...(viewer === null ? {} : { viewer }),
15
23
  };
16
24
  }
@@ -1,3 +1,4 @@
1
+ import { parseViewer } from "../runtime/levels.js";
1
2
  /**
2
3
  * The client half of the host kit (P066): a locator that asks the app's issue endpoint
3
4
  * (`ContentHost.issue`) for a frame's location, and the choice between served and opaque configs.
@@ -49,10 +50,16 @@ export function httpLocator(url, options = {}) {
49
50
  (data.reports !== undefined && typeof data.reports !== "boolean")) {
50
51
  throw new LocateError("The app's issue endpoint gave no frame location", response.status, "bad-location");
51
52
  }
53
+ // Who is viewing, as the app's access decided (P087); one that doesn't parse is an error.
54
+ const viewer = data.viewer === undefined ? null : parseViewer(data.viewer);
55
+ if (data.viewer !== undefined && viewer === null) {
56
+ throw new LocateError("The app's issue endpoint named a viewer that isn't one", response.status, "bad-location");
57
+ }
52
58
  return {
53
59
  url: data.url,
54
60
  origin: data.origin,
55
61
  ...(typeof data.reports === "boolean" ? { reports: data.reports } : {}),
62
+ ...(viewer === null ? {} : { viewer }),
56
63
  };
57
64
  },
58
65
  };
@@ -0,0 +1,43 @@
1
+ import type { Surface } from "../platform/types.ts";
2
+ /** How long a set's page said its next load is another of its pages (P084), ms. */
3
+ export declare const PAGE_OF_SET_MS = 10000;
4
+ /**
5
+ * How long a load no page has announced waits for its notice before the display starts again, in
6
+ * a display whose pages may come with files (P098), ms. The notice can come after the load: on
7
+ * Chromium a cross-process `postMessage` is forwarded from a task of the sending document's, so
8
+ * the leaving page's notice can arrive after the next page's load or, when the navigation commits
9
+ * first, never; the arriving page says so too, and its word can come after its own load.
10
+ */
11
+ export declare const LATE_NOTICE_MS = 2000;
12
+ /** The most messages held each way while a load waits (P098); past them, the display starts again. */
13
+ export declare const HELD_MOST = 1000;
14
+ /** The artifact version a display mounted: the only set whose pages its notices may name. */
15
+ export interface FileSetRef {
16
+ readonly id: string;
17
+ readonly version: string;
18
+ }
19
+ /**
20
+ * Which of a frame's loads are another page of its own set (P084, P098), for a display whose
21
+ * pages may come with files; every other display passes `set: null`, and each load after the
22
+ * first is the content navigating away (P031).
23
+ *
24
+ * A notice (`porthole/navigating`, from the frame's window and content origin: the transport
25
+ * takes nothing else) names a page and the version its files are. The leaving page's notice is
26
+ * taken for the next load within `PAGE_OF_SET_MS`; the arriving page's (`arrived`) too, or for the
27
+ * load it came after. A load no notice explained waits `LATE_NOTICE_MS`, holding the frame
28
+ * (`HELD_MOST` messages each way at most; past them, started again): nothing it says reaches the
29
+ * display (no call is answered, no report taken), nothing is sent to it, and once the wait is
30
+ * over without a notice for the
31
+ * mounted version, the display starts again. A notice for another version, or the new page's
32
+ * hello before any notice, ends the wait at once: started again. Only a notice naming the mounted
33
+ * version ends a wait without a restart; one from a shell before P098 (no version) can only be
34
+ * taken for a load still to come, as before.
35
+ *
36
+ * Returns the surface the display uses: the same, its transport held while a load waits.
37
+ */
38
+ export declare function pagesOfSet(options: {
39
+ readonly surface: Surface;
40
+ readonly set: FileSetRef | null;
41
+ /** The frame left its content: start the display again. */
42
+ readonly away: () => void;
43
+ }): Surface;
@@ -0,0 +1,196 @@
1
+ import { MCP_APPS_METHODS, NAVIGATING_METHOD } from "../protocol/mcp-apps.js";
2
+ /** How long a set's page said its next load is another of its pages (P084), ms. */
3
+ export const PAGE_OF_SET_MS = 10_000;
4
+ /**
5
+ * How long a load no page has announced waits for its notice before the display starts again, in
6
+ * a display whose pages may come with files (P098), ms. The notice can come after the load: on
7
+ * Chromium a cross-process `postMessage` is forwarded from a task of the sending document's, so
8
+ * the leaving page's notice can arrive after the next page's load or, when the navigation commits
9
+ * first, never; the arriving page says so too, and its word can come after its own load.
10
+ */
11
+ export const LATE_NOTICE_MS = 2_000;
12
+ /** The most messages held each way while a load waits (P098); past them, the display starts again. */
13
+ export const HELD_MOST = 1_000;
14
+ const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
15
+ function noticeOf(raw, mounted) {
16
+ if (!isRecord(raw) || raw.jsonrpc !== "2.0" || raw.method !== NAVIGATING_METHOD || "id" in raw) {
17
+ return null;
18
+ }
19
+ const params = isRecord(raw.params) ? raw.params : {};
20
+ const named = params.set;
21
+ return {
22
+ url: typeof params.url === "string" ? params.url : "",
23
+ arrived: params.arrived === true,
24
+ set: named === undefined
25
+ ? "none"
26
+ : isRecord(named) && named.id === mounted.id && named.version === mounted.version
27
+ ? "ok"
28
+ : "other",
29
+ };
30
+ }
31
+ const isHello = (raw) => isRecord(raw) && raw.method === MCP_APPS_METHODS.initialize && "id" in raw;
32
+ /**
33
+ * Which of a frame's loads are another page of its own set (P084, P098), for a display whose
34
+ * pages may come with files; every other display passes `set: null`, and each load after the
35
+ * first is the content navigating away (P031).
36
+ *
37
+ * A notice (`porthole/navigating`, from the frame's window and content origin: the transport
38
+ * takes nothing else) names a page and the version its files are. The leaving page's notice is
39
+ * taken for the next load within `PAGE_OF_SET_MS`; the arriving page's (`arrived`) too, or for the
40
+ * load it came after. A load no notice explained waits `LATE_NOTICE_MS`, holding the frame
41
+ * (`HELD_MOST` messages each way at most; past them, started again): nothing it says reaches the
42
+ * display (no call is answered, no report taken), nothing is sent to it, and once the wait is
43
+ * over without a notice for the
44
+ * mounted version, the display starts again. A notice for another version, or the new page's
45
+ * hello before any notice, ends the wait at once: started again. Only a notice naming the mounted
46
+ * version ends a wait without a restart; one from a shell before P098 (no version) can only be
47
+ * taken for a load still to come, as before.
48
+ *
49
+ * Returns the surface the display uses: the same, its transport held while a load waits.
50
+ */
51
+ export function pagesOfSet(options) {
52
+ const { surface, set, away } = options;
53
+ if (set === null) {
54
+ surface.onNavigated(away);
55
+ return surface;
56
+ }
57
+ const raw = surface.transport;
58
+ // Taken for the next load until then, as that page.
59
+ let grantUntil = 0;
60
+ let grantFor = "";
61
+ // The page the frame's last load was taken as: a late copy of its notice is no new one.
62
+ let current = null;
63
+ // Loads waiting for their notice, and what the frame said and was sent meanwhile.
64
+ let waiting = 0;
65
+ let timer = null;
66
+ const heard = [];
67
+ const unsent = [];
68
+ const listeners = new Set();
69
+ let closed = false;
70
+ const deliver = (message) => {
71
+ for (const listener of listeners) {
72
+ listener(message);
73
+ }
74
+ };
75
+ const settle = () => {
76
+ if (timer !== null) {
77
+ clearTimeout(timer);
78
+ timer = null;
79
+ }
80
+ };
81
+ const leave = () => {
82
+ settle();
83
+ waiting = 0;
84
+ heard.length = 0;
85
+ unsent.length = 0;
86
+ away();
87
+ };
88
+ const taken = (url) => {
89
+ current = url;
90
+ waiting -= 1;
91
+ if (waiting > 0) {
92
+ return;
93
+ }
94
+ settle();
95
+ for (const message of unsent.splice(0)) {
96
+ raw.send(message);
97
+ }
98
+ for (const message of heard.splice(0)) {
99
+ deliver(message);
100
+ }
101
+ };
102
+ raw.listen((message) => {
103
+ if (closed) {
104
+ return;
105
+ }
106
+ const notice = noticeOf(message, set);
107
+ if (notice !== null) {
108
+ if (notice.set === "other" || (notice.arrived && notice.set !== "ok")) {
109
+ // Another version's page, or one that won't say which: never this display's.
110
+ if (waiting > 0) {
111
+ leave();
112
+ }
113
+ return;
114
+ }
115
+ if (waiting === 0 && notice.url === current) {
116
+ // A late copy for the page the frame is on (its leaving page's, or its own): no new page.
117
+ return;
118
+ }
119
+ if (waiting > 0) {
120
+ if (notice.set === "ok") {
121
+ taken(notice.url);
122
+ }
123
+ }
124
+ else {
125
+ // Either page's notice, for the next load within P084's ten seconds: the host hears the
126
+ // frame's load only once its images and modules have loaded, which can be seconds after
127
+ // the arriving page spoke (after the review of P098).
128
+ grantUntil = Date.now() + PAGE_OF_SET_MS;
129
+ grantFor = notice.url;
130
+ }
131
+ }
132
+ else if (waiting > 0 && isHello(message)) {
133
+ // A page that greets the host before saying it is one of the set's isn't.
134
+ leave();
135
+ return;
136
+ }
137
+ if (waiting > 0) {
138
+ if (heard.length >= HELD_MOST) {
139
+ // A page that floods the host while it waits isn't one of the set's.
140
+ leave();
141
+ return;
142
+ }
143
+ heard.push(message);
144
+ }
145
+ else {
146
+ deliver(message);
147
+ }
148
+ });
149
+ surface.onNavigated(() => {
150
+ if (grantUntil > Date.now()) {
151
+ grantUntil = 0;
152
+ current = grantFor;
153
+ return;
154
+ }
155
+ grantUntil = 0;
156
+ waiting += 1;
157
+ // From the first load that waits: more loads don't put the restart off.
158
+ if (timer === null) {
159
+ timer = setTimeout(leave, LATE_NOTICE_MS);
160
+ }
161
+ });
162
+ return {
163
+ ...surface,
164
+ transport: {
165
+ send(message) {
166
+ if (waiting > 0) {
167
+ if (unsent.length >= HELD_MOST) {
168
+ leave();
169
+ return;
170
+ }
171
+ unsent.push(message);
172
+ }
173
+ else {
174
+ raw.send(message);
175
+ }
176
+ },
177
+ listen(listener) {
178
+ listeners.add(listener);
179
+ return () => listeners.delete(listener);
180
+ },
181
+ close() {
182
+ closed = true;
183
+ listeners.clear();
184
+ raw.close();
185
+ },
186
+ },
187
+ destroy() {
188
+ closed = true;
189
+ settle();
190
+ heard.length = 0;
191
+ unsent.length = 0;
192
+ listeners.clear();
193
+ surface.destroy();
194
+ },
195
+ };
196
+ }
@@ -1,6 +1,6 @@
1
1
  import type { AnnotateMode, AnnotationMark, AnnotationReport } from "../annotate/types.ts";
2
2
  import type { Refused } from "../bridge/refusal.ts";
3
- import type { Confirm, CapabilityHandlers, Consent, DataCache, Refusal } from "../bridge/types.ts";
3
+ import type { Confirm, CapabilityHandlers, Consent, DataCache, Refusal, Show } from "../bridge/types.ts";
4
4
  import type { CompiledConfig } from "../compile/compile.ts";
5
5
  import type { CapabilityName } from "../config/capabilities.ts";
6
6
  import type { ColorScheme } from "../config/schema.ts";
@@ -8,6 +8,8 @@ import type { InstanceLocator, InstanceRef } from "../isolation/types.ts";
8
8
  import type { PlatformHost } from "../platform/types.ts";
9
9
  import type { AdapterConnection, ProtocolAdapter, ShellConnection } from "../protocol/adapter.ts";
10
10
  import type { HostContext } from "../protocol/mcp-apps.ts";
11
+ import type { PageDeclaration } from "../runtime/declaration.ts";
12
+ import type { ViewerInfo } from "../runtime/levels.ts";
11
13
  /**
12
14
  * The host-side API (framework-agnostic; the web platform by default). A host compiles a config
13
15
  * once (`createHost`), then mounts a display per piece of content. Everything here is mechanism;
@@ -26,6 +28,13 @@ export interface HostOptions<C extends AdapterConnection = ShellConnection> {
26
28
  * not run, P080).
27
29
  */
28
30
  readonly consent?: Consent | Refused;
31
+ /**
32
+ * Puts a `show`-gated call in front of the person, outside the frame, before its handler has it
33
+ * (P100): by default, every `setModelContext` update, the content's text for the model's next
34
+ * turns ("this content updated the agent's context: …", the latest per display). Absent: those
35
+ * calls are refused.
36
+ */
37
+ readonly show?: Show;
29
38
  /**
30
39
  * What the host last had for a resource (P079): a read of one the content subscribes to is
31
40
  * answered with it at once, marked stale, then with the handler's fresh result.
@@ -75,6 +84,22 @@ export interface MountOptions {
75
84
  readonly document?: string;
76
85
  /** The height to start at, before the content reports its own. */
77
86
  readonly initialHeightPx?: number;
87
+ /**
88
+ * What the page declared (P086), as the host stored it with the artifact at publish
89
+ * (`declareCapabilities`): its capabilities, and the runtime contract it is pinned to. The
90
+ * bridge holds the page to it; a page reaches only the built-ins and what it declared. Required
91
+ * under `config.runtime` (after the review): `null` says the page was published before 0.7 and
92
+ * has 0.6's surface (built-ins through `porthole.use`, 0.6's globals and requests as before).
93
+ * Checked against the config at mount (a `TypeError` for one that doesn't fit). For a version
94
+ * older than the artifact's current one, `intersectDeclarations(version's, current)`.
95
+ */
96
+ readonly declaration?: PageDeclaration | null;
97
+ /**
98
+ * Who is viewing (P087): their level, and for `user` their public id and name. A served
99
+ * display's issue answer (`FrameLocation.viewer`, from the host's access) takes precedence.
100
+ * Absent everywhere: 0.6's functions run as before; the runtime's own are refused.
101
+ */
102
+ readonly viewer?: ViewerInfo;
78
103
  /**
79
104
  * Fill the container (give it a height) instead of taking the content's height.
80
105
  *
package/dist/index.d.ts CHANGED
@@ -2,19 +2,26 @@
2
2
  * `@botiverse/porthole`: the framework-agnostic core. One config (a preset's) compiles into the
3
3
  * frame's policies, the shell, and the agent manual; the host mounts displays under it.
4
4
  */
5
- export { CAPABILITIES, CAPABILITY_NAMES, MAX_COPY_CHARS, capabilitySpec, isCapabilityName, type CapabilityArgs, type CapabilityName, type CapabilityResults, type CapabilitySpec, type Gate, type HandledCapability, } from "./config/capabilities.ts";
5
+ export { CAPABILITIES, CAPABILITY_NAMES, MAX_CONTEXT_CHARS, MAX_COPY_CHARS, capabilitySpec, isCapabilityName, type CapabilityArgs, type CapabilityName, type CapabilityResults, type CapabilitySpec, type Gate, type HandledCapability, } from "./config/capabilities.ts";
6
6
  export type { CapabilityConfig, CapabilityMap, ColorScheme, DisplayMode, EgressConfig, EmbedderConfig, GuideConfig, IsolationKind, LayoutConfig, Limits, PortholeConfig, StorageConfig, ThemeConfig, ThemeValue, } from "./config/schema.ts";
7
7
  export { PASSIVE_KINDS, type PassiveKind } from "./config/schema.ts";
8
8
  export { BUILT_IN_TOPICS, ConfigError, isOriginSource, originSourceProblem, validateConfig, } from "./config/validate.ts";
9
+ export { configWarnings, type ConfigWarning } from "./config/warnings.ts";
9
10
  export { URL_PERMISSIONS, URL_SANDBOX_EXTRAS, type UrlPermission, type UrlSandboxExtra, } from "./config/schema.ts";
10
11
  export { hostOriginProblem, isHostOrigin } from "./isolation/served.ts";
11
12
  export { FRAME_STATUS_METHOD } from "./isolation/types.ts";
12
- export { LIBRARY_CDNS, presets, type PresetName, type LiveWidgetOptions, type PresetOptions, type UrlPresetOptions, } from "./presets/presets.ts";
13
+ export { RUNTIME_CALL_METHOD, RUNTIME_CAPABILITIES, RUNTIME_CAPABILITY_NAMES, RUNTIME_EVENT_METHOD, RUNTIME_EXPERIMENTAL_KEY, RUNTIME_GLOBAL, RUNTIME_HOST_FUNCTIONS, RUNTIME_UNWATCH_METHOD, RUNTIME_VERSION, RUNTIME_VERSIONS, familyOf, isRuntimeCapabilityName, methodGates, isRuntimeVersion, methodLevel, offeredCapabilities, rosterOf, type RuntimeCapability, type RuntimeCapabilityName, type RuntimeMethod, type RuntimeVersion, } from "./runtime/contract.ts";
14
+ export { VIEWER_LEVELS, atLeast, isViewerLevel, parseViewer, type ViewerInfo, type ViewerLevel, } from "./runtime/levels.ts";
15
+ export { checkDeclaration, declarationProblems, declareCapabilities, declaredMatch, intersectDeclarations, tryIntersectDeclarations, type CapabilityDeclaration, type DeclarationProblem, type DeclaredCapability, type DeclaredData, type DeclaredDb, type PageDeclaration, } from "./runtime/declaration.ts";
16
+ export { DB_LIMITS, DB_USERS_PREFIX, dbAccess, isDbSegment, isPlainJson, withMe, dbRulesProblem, parseDbRequest, type DbData, type DbRequest, type DbResult, type DbRules, type DbSnapshot, type DbValue, type DbWhere, type DbWrite, } from "./runtime/db.ts";
17
+ export { ASSET_ID, ASSET_PATH, MAX_PUBLISH_FILES, assetNameProblem, assetUrl, isCodeAsset, type ArtifactInfo, type ArtifactRequest, type AssetInfo, type AssetRequest, type CommentAnchor, type CommentRequest, type DownloadedFile, type PublishedFile, type PublishedVersion, type UserInfo, } from "./runtime/requests.ts";
18
+ export { RUNTIME_TYPES } from "./runtime/types.generated.ts";
19
+ export { LIBRARY_CDNS, presets, type PresetName, type LiveCapabilityConfig, type LiveWidgetOptions, type PresetOptions, type UrlPresetOptions, } from "./presets/presets.ts";
13
20
  export { LIBRARY_PATH, VENDORED_LIBRARIES, libraryPath, licensePath, type VendoredLibrary, } from "./libraries/libraries.ts";
14
21
  export { checkFileSet, DEFAULT_ENTRY, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_FILES, DEFAULT_MAX_VERSION_BYTES, fileLimits, filePathProblem, lookupFile, requestFilePath, servesFiles, type FileLimits, type FileLookup, type FileSetProblem, } from "./files/paths.ts";
15
22
  export { fileTypeOf, KNOWN_EXTENSIONS, UNKNOWN_TYPE, type FileRole, type FileType, } from "./files/types.ts";
16
23
  export { compile, type CompiledConfig } from "./compile/compile.ts";
17
- export { allEgressOrigins, anyHttps, declaredCapabilities, effectiveGates, egressOrigins, embedderCsp, embedderFrameSourcesOf, FILE_SET_DIRECTIVES, fileSetCspDirectives, INERT_FILE_CSP, type CspDirective, type EgressKind, } from "./compile/policy.ts";
24
+ export { allEgressOrigins, anyHttps, declaredCapabilities, effectiveGates, egressOrigins, embedderCsp, embedderFrameSourcesOf, ASSET_CODE_DIRECTIVES, ASSET_DIRECTIVES, assetCodeRuns, assetCspDirectives, FILE_SET_DIRECTIVES, fileSetCspDirectives, INERT_FILE_CSP, type CspDirective, type EgressKind, } from "./compile/policy.ts";
18
25
  export { shellPlan, type ShellPlan } from "./shell/plan.ts";
19
26
  export type { ShellDocumentOptions } from "./shell/document.ts";
20
27
  export { generateGuide, generateToolDescription, type BuiltInTopic, type GuideTopic, } from "./guide/guide.ts";
@@ -26,7 +33,7 @@ export type { Transport } from "./transport/types.ts";
26
33
  export type { AdapterConnection, AdapterEvent, AdapterSession, ProtocolAdapter, ShellConnection, } from "./protocol/adapter.ts";
27
34
  export { COPY_TEXT_METHOD, MCP_APPS_METHODS, MCP_APPS_PROTOCOL_VERSION, MCP_APPS_STYLE_VARIABLES, NAVIGATING_METHOD, NAVIGATION_BLOCKED_METHOD, PORTHOLE_STYLES, STALE_META, type HostContext, } from "./protocol/mcp-apps.ts";
28
35
  export { REFUSAL_CODES, Refused, isRefused, type RefusalCode, type RefusalReason, } from "./bridge/refusal.ts";
29
- export type { CallContext, CallOptions, CallOutcome, CapabilityHandler, CapabilityHandlers, Confirm, ConfirmAnswer, ConfirmDisplay, ConfirmRequest, Consent, DataCache, Proceed, HostFunctionBridge, Refusal, SubscriptionContext, } from "./bridge/types.ts";
36
+ export type { CallContext, CallOptions, CallOutcome, CapabilityHandler, CapabilityHandlers, Confirm, ConfirmAnswer, ConfirmDisplay, ConfirmRequest, Consent, DataCache, Proceed, HostFunctionBridge, Refusal, Show, SubscriptionContext, DbContext, } from "./bridge/types.ts";
30
37
  export { createHost } from "./host/create-host.ts";
31
38
  export { entryTarget, frameFallback, portholeClient, type ContentClientMeta, type FrameFallback, type PortholeClient, type PortholeClientOptions, } from "./host/client.ts";
32
39
  export { defineDisplays, type DisplayKind, type Displays } from "./displays/displays.ts";
package/dist/index.js CHANGED
@@ -3,12 +3,21 @@
3
3
  * frame's policies, the shell, and the agent manual; the host mounts displays under it.
4
4
  */
5
5
  // The config and its vocabulary.
6
- export { CAPABILITIES, CAPABILITY_NAMES, MAX_COPY_CHARS, capabilitySpec, isCapabilityName, } from "./config/capabilities.js";
6
+ export { CAPABILITIES, CAPABILITY_NAMES, MAX_CONTEXT_CHARS, MAX_COPY_CHARS, capabilitySpec, isCapabilityName, } from "./config/capabilities.js";
7
7
  export { PASSIVE_KINDS } from "./config/schema.js";
8
8
  export { BUILT_IN_TOPICS, ConfigError, isOriginSource, originSourceProblem, validateConfig, } from "./config/validate.js";
9
+ export { configWarnings } from "./config/warnings.js";
9
10
  export { URL_PERMISSIONS, URL_SANDBOX_EXTRAS, } from "./config/schema.js";
10
11
  export { hostOriginProblem, isHostOrigin } from "./isolation/served.js";
11
12
  export { FRAME_STATUS_METHOD } from "./isolation/types.js";
13
+ // The capability runtime (P085-P090): its contract, levels, a page's declaration, its services'
14
+ // shapes. Hosts implement the services; Porthole carries, checks and gates the calls.
15
+ export { RUNTIME_CALL_METHOD, RUNTIME_CAPABILITIES, RUNTIME_CAPABILITY_NAMES, RUNTIME_EVENT_METHOD, RUNTIME_EXPERIMENTAL_KEY, RUNTIME_GLOBAL, RUNTIME_HOST_FUNCTIONS, RUNTIME_UNWATCH_METHOD, RUNTIME_VERSION, RUNTIME_VERSIONS, familyOf, isRuntimeCapabilityName, methodGates, isRuntimeVersion, methodLevel, offeredCapabilities, rosterOf, } from "./runtime/contract.js";
16
+ export { VIEWER_LEVELS, atLeast, isViewerLevel, parseViewer, } from "./runtime/levels.js";
17
+ export { checkDeclaration, declarationProblems, declareCapabilities, declaredMatch, intersectDeclarations, tryIntersectDeclarations, } from "./runtime/declaration.js";
18
+ export { DB_LIMITS, DB_USERS_PREFIX, dbAccess, isDbSegment, isPlainJson, withMe, dbRulesProblem, parseDbRequest, } from "./runtime/db.js";
19
+ export { ASSET_ID, ASSET_PATH, MAX_PUBLISH_FILES, assetNameProblem, assetUrl, isCodeAsset, } from "./runtime/requests.js";
20
+ export { RUNTIME_TYPES } from "./runtime/types.generated.js";
12
21
  // Presets.
13
22
  export { LIBRARY_CDNS, presets, } from "./presets/presets.js";
14
23
  export { LIBRARY_PATH, VENDORED_LIBRARIES, libraryPath, licensePath, } from "./libraries/libraries.js";
@@ -17,7 +26,7 @@ export { checkFileSet, DEFAULT_ENTRY, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_FILES,
17
26
  export { fileTypeOf, KNOWN_EXTENSIONS, UNKNOWN_TYPE, } from "./files/types.js";
18
27
  // The compiler.
19
28
  export { compile } from "./compile/compile.js";
20
- export { allEgressOrigins, anyHttps, declaredCapabilities, effectiveGates, egressOrigins, embedderCsp, embedderFrameSourcesOf, FILE_SET_DIRECTIVES, fileSetCspDirectives, INERT_FILE_CSP, } from "./compile/policy.js";
29
+ export { allEgressOrigins, anyHttps, declaredCapabilities, effectiveGates, egressOrigins, embedderCsp, embedderFrameSourcesOf, ASSET_CODE_DIRECTIVES, ASSET_DIRECTIVES, assetCodeRuns, assetCspDirectives, FILE_SET_DIRECTIVES, fileSetCspDirectives, INERT_FILE_CSP, } from "./compile/policy.js";
21
30
  export { shellPlan } from "./shell/plan.js";
22
31
  export { generateGuide, generateToolDescription, } from "./guide/guide.js";
23
32
  export { GUIDE_EXAMPLES } from "./guide/examples.js";