@botiverse/porthole 0.4.1 → 0.5.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 (71) hide show
  1. package/README.md +3 -1
  2. package/dist/bridge/bridge.d.ts +16 -2
  3. package/dist/bridge/bridge.js +65 -12
  4. package/dist/bridge/types.d.ts +44 -6
  5. package/dist/check/lint.js +2 -2
  6. package/dist/check/page-source.js +1 -1
  7. package/dist/check/page.js +5 -0
  8. package/dist/compile/policy.d.ts +5 -0
  9. package/dist/compile/policy.js +18 -1
  10. package/dist/config/capabilities.d.ts +25 -2
  11. package/dist/config/capabilities.js +13 -0
  12. package/dist/config/schema.d.ts +7 -0
  13. package/dist/config/validate.js +14 -3
  14. package/dist/conformance/harness/page.js +1 -0
  15. package/dist/conformance/harness-source.js +1 -1
  16. package/dist/displays/displays.d.ts +1 -1
  17. package/dist/guide/guide.js +48 -8
  18. package/dist/host/create-host.js +5 -1
  19. package/dist/host/types.d.ts +12 -1
  20. package/dist/index.d.ts +4 -3
  21. package/dist/index.js +2 -1
  22. package/dist/libraries/files.generated.d.ts +1 -0
  23. package/dist/libraries/files.generated.js +8 -0
  24. package/dist/libraries/libraries.d.ts +36 -0
  25. package/dist/libraries/libraries.js +40 -0
  26. package/dist/mcp/adapter.js +31 -2
  27. package/dist/presets/presets.d.ts +15 -0
  28. package/dist/presets/presets.js +27 -2
  29. package/dist/protocol/live-data.d.ts +27 -0
  30. package/dist/protocol/live-data.js +98 -0
  31. package/dist/protocol/mcp-apps.d.ts +9 -0
  32. package/dist/protocol/mcp-apps.js +11 -0
  33. package/dist/protocol/shell-adapter.js +35 -2
  34. package/dist/react/dialog.js +2 -0
  35. package/dist/react/frame.d.ts +15 -1
  36. package/dist/react/frame.js +35 -1
  37. package/dist/server/libraries.d.ts +7 -0
  38. package/dist/server/libraries.js +27 -0
  39. package/dist/server/server.js +2 -1
  40. package/dist/shell/runtime.d.ts +5 -1
  41. package/dist/shell/runtime.js +165 -1
  42. package/docs/ADOPTING.md +57 -1
  43. package/docs/DECISIONS.md +129 -0
  44. package/docs/DESIGN.md +19 -6
  45. package/package.json +3 -1
  46. package/src/bridge/bridge.ts +85 -13
  47. package/src/bridge/types.ts +45 -3
  48. package/src/check/lint.ts +2 -1
  49. package/src/check/page.ts +5 -0
  50. package/src/compile/policy.ts +19 -1
  51. package/src/config/capabilities.ts +21 -0
  52. package/src/config/schema.ts +7 -0
  53. package/src/config/validate.ts +21 -3
  54. package/src/conformance/harness/page.ts +1 -0
  55. package/src/displays/displays.ts +1 -1
  56. package/src/guide/guide.ts +57 -7
  57. package/src/host/create-host.ts +5 -1
  58. package/src/host/types.ts +12 -1
  59. package/src/index.ts +13 -0
  60. package/src/libraries/files.generated.ts +8 -0
  61. package/src/libraries/libraries.ts +64 -0
  62. package/src/mcp/adapter.ts +40 -2
  63. package/src/presets/presets.ts +46 -3
  64. package/src/protocol/live-data.ts +138 -0
  65. package/src/protocol/mcp-apps.ts +12 -0
  66. package/src/protocol/shell-adapter.ts +35 -3
  67. package/src/react/dialog.tsx +2 -0
  68. package/src/react/frame.tsx +54 -0
  69. package/src/server/libraries.ts +28 -0
  70. package/src/server/server.ts +2 -1
  71. package/src/shell/runtime.ts +165 -1
package/src/host/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AnnotateMode, AnnotationMark, AnnotationReport } from "../annotate/types.ts";
2
- import type { Confirm, CapabilityHandlers, Refusal } from "../bridge/types.ts";
2
+ import type { Confirm, CapabilityHandlers, Consent, DataCache, Refusal } from "../bridge/types.ts";
3
3
  import type { CompiledConfig } from "../compile/compile.ts";
4
4
  import type { CapabilityName } from "../config/capabilities.ts";
5
5
  import type { ColorScheme } from "../config/schema.ts";
@@ -19,6 +19,17 @@ export interface HostOptions<C extends AdapterConnection = ShellConnection> {
19
19
  readonly handlers?: CapabilityHandlers;
20
20
  /** Who confirms `confirm`-gated calls. Absent: those calls are refused. */
21
21
  readonly confirm?: Confirm;
22
+ /**
23
+ * Whether a display may make its `consent`-gated calls (read the viewer's data, P079): asked
24
+ * once per display, before the first, and kept for the display's life (its reloads too).
25
+ * Absent: those calls are refused.
26
+ */
27
+ readonly consent?: Consent;
28
+ /**
29
+ * What the host last had for a resource (P079): a read of one the content subscribes to is
30
+ * answered with it at once, marked stale, then with the handler's fresh result.
31
+ */
32
+ readonly cached?: DataCache;
22
33
  /**
23
34
  * The host's live values for the config's theme variables, for `scheme` (read from its own
24
35
  * design tokens). A name it leaves out, or answers empty, gets the config's default.
package/src/index.ts CHANGED
@@ -55,9 +55,17 @@ export {
55
55
  LIBRARY_CDNS,
56
56
  presets,
57
57
  type PresetName,
58
+ type LiveWidgetOptions,
58
59
  type PresetOptions,
59
60
  type UrlPresetOptions,
60
61
  } from "./presets/presets.ts";
62
+ export {
63
+ LIBRARY_PATH,
64
+ VENDORED_LIBRARIES,
65
+ libraryPath,
66
+ licensePath,
67
+ type VendoredLibrary,
68
+ } from "./libraries/libraries.ts";
61
69
 
62
70
  // The compiler.
63
71
  export { compile, type CompiledConfig } from "./compile/compile.ts";
@@ -115,10 +123,12 @@ export {
115
123
  MCP_APPS_PROTOCOL_VERSION,
116
124
  MCP_APPS_STYLE_VARIABLES,
117
125
  PORTHOLE_STYLES,
126
+ STALE_META,
118
127
  type HostContext,
119
128
  } from "./protocol/mcp-apps.ts";
120
129
  export type {
121
130
  CallContext,
131
+ CallOptions,
122
132
  CallOutcome,
123
133
  CapabilityHandler,
124
134
  CapabilityHandlers,
@@ -126,9 +136,12 @@ export type {
126
136
  ConfirmAnswer,
127
137
  ConfirmDisplay,
128
138
  ConfirmRequest,
139
+ Consent,
140
+ DataCache,
129
141
  Proceed,
130
142
  HostFunctionBridge,
131
143
  Refusal,
144
+ SubscriptionContext,
132
145
  } from "./bridge/types.ts";
133
146
  export { createHost } from "./host/create-host.ts";
134
147
  // The client half of the host kit, and the display registry (P072).