@botiverse/porthole 0.10.0 → 0.13.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 (68) hide show
  1. package/dist/annotate/types.d.ts +18 -6
  2. package/dist/annotate/validate.d.ts +11 -1
  3. package/dist/annotate/validate.js +18 -1
  4. package/dist/bridge/bridge.d.ts +8 -1
  5. package/dist/bridge/bridge.js +7 -0
  6. package/dist/bridge/unseen.d.ts +8 -0
  7. package/dist/bridge/unseen.js +17 -0
  8. package/dist/check/files.d.ts +2 -0
  9. package/dist/check/files.js +71 -50
  10. package/dist/check/lint.d.ts +8 -1
  11. package/dist/check/lint.js +18 -0
  12. package/dist/check/markup.d.ts +7 -0
  13. package/dist/check/markup.js +49 -0
  14. package/dist/check/page-source.js +1 -1
  15. package/dist/check/scroll.d.ts +116 -0
  16. package/dist/check/scroll.js +1485 -0
  17. package/dist/config/capabilities.d.ts +16 -3
  18. package/dist/config/capabilities.js +1 -0
  19. package/dist/conformance/harness-source.js +1 -1
  20. package/dist/conformance/runtime.js +6 -0
  21. package/dist/guide/guide.js +1 -1
  22. package/dist/guide/runtime.js +2 -2
  23. package/dist/host/create-host.js +30 -3
  24. package/dist/host/types.d.ts +15 -0
  25. package/dist/index.d.ts +2 -1
  26. package/dist/index.js +1 -0
  27. package/dist/platform/focus-guard.d.ts +143 -0
  28. package/dist/platform/focus-guard.js +445 -0
  29. package/dist/platform/types.d.ts +18 -0
  30. package/dist/platform/web.js +22 -0
  31. package/dist/react/frame.d.ts +10 -1
  32. package/dist/react/frame.js +4 -0
  33. package/dist/runtime/requests.d.ts +5 -0
  34. package/dist/runtime/requests.js +41 -4
  35. package/dist/runtime/types.generated.js +1 -1
  36. package/dist/shell/annotate.d.ts +2 -1
  37. package/dist/shell/annotate.js +29 -12
  38. package/dist/shell/use.js +9 -1
  39. package/docs/ADOPTING.md +106 -5
  40. package/docs/ARCHITECTURE.md +2 -1
  41. package/docs/DECISIONS.md +741 -2
  42. package/docs/DESIGN.md +38 -9
  43. package/docs/THREAT_MODEL.md +146 -19
  44. package/package.json +1 -1
  45. package/src/annotate/types.ts +19 -6
  46. package/src/annotate/validate.ts +20 -1
  47. package/src/bridge/bridge.ts +17 -1
  48. package/src/bridge/unseen.ts +24 -0
  49. package/src/check/files.ts +72 -54
  50. package/src/check/lint.ts +24 -0
  51. package/src/check/markup.ts +53 -0
  52. package/src/check/scroll.ts +1825 -0
  53. package/src/config/capabilities.ts +16 -3
  54. package/src/conformance/runtime.ts +9 -0
  55. package/src/guide/guide.ts +1 -0
  56. package/src/guide/runtime.ts +2 -2
  57. package/src/host/create-host.ts +38 -3
  58. package/src/host/types.ts +13 -0
  59. package/src/index.ts +2 -0
  60. package/src/platform/focus-guard.ts +572 -0
  61. package/src/platform/types.ts +17 -0
  62. package/src/platform/web.ts +22 -0
  63. package/src/react/frame.tsx +12 -1
  64. package/src/runtime/requests.ts +50 -6
  65. package/src/runtime/types.generated.ts +1 -1
  66. package/src/shell/annotate.ts +29 -12
  67. package/src/shell/use.ts +9 -1
  68. package/types/runtime/v1/comments.d.ts +20 -6
@@ -15,9 +15,14 @@ export type CapabilityName = (typeof CAPABILITY_NAMES)[number];
15
15
  /**
16
16
  * What must hold before a call reaches the host's handler. A capability's gates all apply.
17
17
  *
18
- * - `user-activation`: the call follows a real user gesture in the frame. The shell refuses a call
19
- * without one, and the host checks its own page's activation (which a gesture in a child frame
20
- * propagates to). It stops calls made on load or on a timer; it is not proof of intent.
18
+ * - `user-activation`: the call follows a real user gesture. The shell refuses a call without one
19
+ * in its frame, but that check is the page's own (a page posts the call itself and skips it).
20
+ * The host checks its own page's transient activation, which a gesture in a child frame
21
+ * propagates to, and which lasts 5 s after any gesture anywhere on the host's page: a click on
22
+ * the host's own UI, or the person typing in its own composer, counts. So it stops calls made on
23
+ * load, or on a timer while nobody does anything; it is not proof that the gesture was in this
24
+ * frame, nor of intent. Where a capability needs that (`comments`, P109: its draft goes into
25
+ * the person's composer), the host also asks that its page's focus be in the calling frame.
21
26
  * - `confirm`: the host's `confirm` function shows a person the call's whole effect, and the call
22
27
  * goes only if they accept. No `confirm` function means the call is refused (fail closed).
23
28
  * - `rateLimit`: at most `perMinute` calls per display per minute; the rest are refused.
@@ -53,6 +58,13 @@ export interface CapabilitySpec {
53
58
  readonly method: string;
54
59
  readonly sdk?: string;
55
60
  };
61
+ /**
62
+ * Its `user-activation` gate also needs the person in the calling frame (P109): the host page's
63
+ * focus in that frame, which a press on it or a Tab into it gives and the focus guard keeps from
64
+ * a frame's own `focus()`. Activation alone lasts 5 s after any gesture on the host's page,
65
+ * typing in its own composer included.
66
+ */
67
+ readonly inFrame?: true;
56
68
  }
57
69
  /** The most text one `copyText` call carries. */
58
70
  export declare const MAX_COPY_CHARS = 20000;
@@ -174,6 +186,7 @@ export declare const CAPABILITIES: {
174
186
  readonly request: {
175
187
  readonly method: "porthole/call";
176
188
  };
189
+ readonly inFrame: true;
177
190
  };
178
191
  /** This artifact's current version, and a new version of it, base-checked (P088). */
179
192
  readonly artifact: {
@@ -109,6 +109,7 @@ export const CAPABILITIES = {
109
109
  defaultGates: ["user-activation", rate(30)],
110
110
  served: "handler",
111
111
  request: { method: "porthole/call" },
112
+ inFrame: true,
112
113
  },
113
114
  /** This artifact's current version, and a new version of it, base-checked (P088). */
114
115
  artifact: { defaultGates: [rate(10)], served: "handler", request: { method: "porthole/call" } },