@botiverse/porthole 0.3.4 → 0.4.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.
@@ -1,5 +1,6 @@
1
1
  import { capabilitySpec, isCapabilityName, } from "../config/capabilities.js";
2
2
  import { createHost } from "../host/create-host.js";
3
+ import { webPlatform } from "../platform/web.js";
3
4
  import { contentLine, instrumented, } from "./instrument.js";
4
5
  /**
5
6
  * What a host that declines answers each host function with (P074): no prompt sent, no link
@@ -18,6 +19,18 @@ const DECLINED = {
18
19
  throw new Error("The host declined the read");
19
20
  },
20
21
  };
22
+ /**
23
+ * The web platform, with no person on the page: no call comes from a click (P078). The driver's
24
+ * own evaluations count as gestures in some engines (Firefox), which would let a call on load
25
+ * through a host's gesture check; nobody clicks in a check.
26
+ */
27
+ const NOBODY = {
28
+ name: "web, unattended",
29
+ createSurface(container, spec) {
30
+ const surface = webPlatform.createSurface(container, spec);
31
+ return { ...surface, userActivation: () => false };
32
+ },
33
+ };
21
34
  /** A handler for each host function the config declares: it notes the call and answers no. */
22
35
  function declining(capabilities, calls) {
23
36
  const handlers = {};
@@ -95,6 +108,7 @@ const check = {
95
108
  // Every host function the config declares, answered as a host that declines (P074): a
96
109
  // person asked to confirm says no, a handler says no, and each call is noted.
97
110
  handlers: declining(Object.keys(spec.config.capabilities), calls),
111
+ platform: NOBODY,
98
112
  confirm: () => Promise.resolve("declined"),
99
113
  // A served config's instance, issued by the check's own server on this page's origin.
100
114
  locator: {