@dxos/app-framework 0.9.0 → 0.9.1-staging.ee54ba693a

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 (224) hide show
  1. package/dist/lib/browser/{capability-BOPAKKWG.mjs → capability-S44TE2H7.mjs} +9 -9
  2. package/dist/lib/browser/{chunk-66IXTIVK.mjs → chunk-3NQLTQCP.mjs} +6 -7
  3. package/dist/lib/browser/chunk-3NQLTQCP.mjs.map +7 -0
  4. package/dist/lib/browser/chunk-53HJHMS5.mjs +7 -0
  5. package/dist/lib/browser/chunk-53HJHMS5.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-Y66ELD4U.mjs → chunk-KRJ4KK2W.mjs} +36 -7
  7. package/dist/lib/browser/chunk-KRJ4KK2W.mjs.map +7 -0
  8. package/dist/lib/browser/{chunk-KZUDO43J.mjs → chunk-LUH4Y5F2.mjs} +31 -23
  9. package/dist/lib/browser/chunk-LUH4Y5F2.mjs.map +7 -0
  10. package/dist/lib/browser/{chunk-CO3XLNUX.mjs → chunk-NKVRSMFN.mjs} +18 -18
  11. package/dist/lib/browser/chunk-NKVRSMFN.mjs.map +7 -0
  12. package/dist/lib/browser/{chunk-DC3WRPBV.mjs → chunk-OO53M5UK.mjs} +45 -12
  13. package/dist/lib/browser/chunk-OO53M5UK.mjs.map +7 -0
  14. package/dist/lib/browser/{chunk-IW44C7UL.mjs → chunk-OPTS3ZSN.mjs} +1 -1
  15. package/dist/lib/browser/chunk-OPTS3ZSN.mjs.map +7 -0
  16. package/dist/lib/browser/{chunk-HFLKXMT7.mjs → chunk-U5MESPM5.mjs} +61 -45
  17. package/dist/lib/browser/chunk-U5MESPM5.mjs.map +7 -0
  18. package/dist/lib/browser/{chunk-XHS5KDNX.mjs → chunk-UGYCLOXE.mjs} +25 -25
  19. package/dist/lib/browser/chunk-UGYCLOXE.mjs.map +7 -0
  20. package/dist/lib/browser/{chunk-5GY3YOEL.mjs → chunk-VF37YTXJ.mjs} +5 -5
  21. package/dist/lib/browser/chunk-VF37YTXJ.mjs.map +7 -0
  22. package/dist/lib/browser/{chunk-FO3IYSLV.mjs → chunk-YUVQIOTB.mjs} +29 -37
  23. package/dist/lib/browser/chunk-YUVQIOTB.mjs.map +7 -0
  24. package/dist/lib/browser/cli/index.mjs +9 -9
  25. package/dist/lib/browser/cli/index.mjs.map +2 -2
  26. package/dist/lib/browser/common/activation-events.mjs +7 -7
  27. package/dist/lib/browser/common/capabilities.mjs +7 -7
  28. package/dist/lib/browser/config/index.mjs +8 -0
  29. package/dist/lib/browser/config/index.mjs.map +7 -0
  30. package/dist/lib/browser/core/activation-event.mjs +1 -1
  31. package/dist/lib/browser/core/capability.mjs +1 -1
  32. package/dist/lib/browser/core/plugin-manager.mjs +4 -4
  33. package/dist/lib/browser/core/plugin.mjs +12 -2
  34. package/dist/lib/browser/core/url-loader.mjs +3 -3
  35. package/dist/lib/browser/index.mjs +14 -10
  36. package/dist/lib/browser/index.mjs.map +1 -1
  37. package/dist/lib/browser/meta.json +1 -1
  38. package/dist/lib/browser/{process-manager-capability-GXNUO7AR.mjs → process-manager-capability-QK4BMKMN.mjs} +9 -9
  39. package/dist/lib/browser/testing/index.mjs +15 -15
  40. package/dist/lib/browser/testing/index.mjs.map +3 -3
  41. package/dist/lib/browser/testing/react.mjs +11 -11
  42. package/dist/lib/browser/testing/react.mjs.map +3 -3
  43. package/dist/lib/browser/ui/index.mjs +18 -10
  44. package/dist/lib/node-esm/{capability-KZWRTX7R.mjs → capability-3YRF77LV.mjs} +9 -9
  45. package/dist/lib/node-esm/chunk-2UPUZXGU.mjs +9 -0
  46. package/dist/lib/node-esm/chunk-2UPUZXGU.mjs.map +7 -0
  47. package/dist/lib/node-esm/{chunk-XIGPWXCQ.mjs → chunk-4SE7SX7N.mjs} +45 -12
  48. package/dist/lib/node-esm/chunk-4SE7SX7N.mjs.map +7 -0
  49. package/dist/lib/node-esm/{chunk-XOCUANHO.mjs → chunk-BMW6P6QA.mjs} +6 -7
  50. package/dist/lib/node-esm/chunk-BMW6P6QA.mjs.map +7 -0
  51. package/dist/lib/node-esm/{chunk-A5CHGAZE.mjs → chunk-DRT75WGD.mjs} +61 -45
  52. package/dist/lib/node-esm/chunk-DRT75WGD.mjs.map +7 -0
  53. package/dist/lib/node-esm/{chunk-XGBUKRCK.mjs → chunk-FKMVORZN.mjs} +31 -23
  54. package/dist/lib/node-esm/chunk-FKMVORZN.mjs.map +7 -0
  55. package/dist/lib/node-esm/{chunk-CTKEZHKF.mjs → chunk-GLH4LGHZ.mjs} +1 -1
  56. package/dist/lib/node-esm/chunk-GLH4LGHZ.mjs.map +7 -0
  57. package/dist/lib/node-esm/{chunk-SX5NVETP.mjs → chunk-IL7O7IRX.mjs} +25 -25
  58. package/dist/lib/node-esm/chunk-IL7O7IRX.mjs.map +7 -0
  59. package/dist/lib/node-esm/{chunk-FSVGKTF6.mjs → chunk-ND2HETHD.mjs} +36 -7
  60. package/dist/lib/node-esm/chunk-ND2HETHD.mjs.map +7 -0
  61. package/dist/lib/node-esm/{chunk-KFZEB6BV.mjs → chunk-TLKYZKPW.mjs} +5 -5
  62. package/dist/lib/node-esm/chunk-TLKYZKPW.mjs.map +7 -0
  63. package/dist/lib/node-esm/{chunk-WK7OIQKI.mjs → chunk-VCPGX7WN.mjs} +29 -37
  64. package/dist/lib/node-esm/chunk-VCPGX7WN.mjs.map +7 -0
  65. package/dist/lib/node-esm/{chunk-NULBHQYS.mjs → chunk-XSZMX53L.mjs} +18 -18
  66. package/dist/lib/node-esm/chunk-XSZMX53L.mjs.map +7 -0
  67. package/dist/lib/node-esm/cli/index.mjs +9 -9
  68. package/dist/lib/node-esm/cli/index.mjs.map +2 -2
  69. package/dist/lib/node-esm/common/activation-events.mjs +7 -7
  70. package/dist/lib/node-esm/common/capabilities.mjs +7 -7
  71. package/dist/lib/node-esm/config/index.mjs +9 -0
  72. package/dist/lib/node-esm/config/index.mjs.map +7 -0
  73. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  74. package/dist/lib/node-esm/core/capability.mjs +1 -1
  75. package/dist/lib/node-esm/core/plugin-manager.mjs +4 -4
  76. package/dist/lib/node-esm/core/plugin.mjs +12 -2
  77. package/dist/lib/node-esm/core/url-loader.mjs +3 -3
  78. package/dist/lib/node-esm/index.mjs +14 -10
  79. package/dist/lib/node-esm/index.mjs.map +1 -1
  80. package/dist/lib/node-esm/meta.json +1 -1
  81. package/dist/lib/node-esm/{process-manager-capability-TX5TA6YN.mjs → process-manager-capability-5S7WZ2JR.mjs} +9 -9
  82. package/dist/lib/node-esm/testing/index.mjs +15 -15
  83. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  84. package/dist/lib/node-esm/testing/react.mjs +11 -11
  85. package/dist/lib/node-esm/testing/react.mjs.map +3 -3
  86. package/dist/lib/node-esm/ui/index.mjs +18 -10
  87. package/dist/plugin/node-esm/index.mjs +414 -81
  88. package/dist/plugin/node-esm/index.mjs.map +4 -4
  89. package/dist/plugin/node-esm/meta.json +1 -1
  90. package/dist/types/src/cli/cli.d.ts +1 -1
  91. package/dist/types/src/common/activation-events.d.ts.map +1 -1
  92. package/dist/types/src/common/capabilities.d.ts +2 -2
  93. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  94. package/dist/types/src/config/index.d.ts +2 -0
  95. package/dist/types/src/config/index.d.ts.map +1 -0
  96. package/dist/types/src/core/activation-event.d.ts +9 -6
  97. package/dist/types/src/core/activation-event.d.ts.map +1 -1
  98. package/dist/types/src/core/capability.d.ts +9 -3
  99. package/dist/types/src/core/capability.d.ts.map +1 -1
  100. package/dist/types/src/core/edge-registry-plugin-provider.d.ts +6 -11
  101. package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -1
  102. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  103. package/dist/types/src/core/plugin-manifest.d.ts +25 -7
  104. package/dist/types/src/core/plugin-manifest.d.ts.map +1 -1
  105. package/dist/types/src/core/plugin.d.ts +89 -91
  106. package/dist/types/src/core/plugin.d.ts.map +1 -1
  107. package/dist/types/src/core/registry.d.ts +17 -57
  108. package/dist/types/src/core/registry.d.ts.map +1 -1
  109. package/dist/types/src/core/url-loader.d.ts +2 -2
  110. package/dist/types/src/core/url-loader.d.ts.map +1 -1
  111. package/dist/types/src/index.d.ts +1 -0
  112. package/dist/types/src/index.d.ts.map +1 -1
  113. package/dist/types/src/plugin-process-manager/history/capability.d.ts +1 -3
  114. package/dist/types/src/plugin-process-manager/history/capability.d.ts.map +1 -1
  115. package/dist/types/src/plugin-process-manager/meta.d.ts +32 -2
  116. package/dist/types/src/plugin-process-manager/meta.d.ts.map +1 -1
  117. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts +1 -4
  118. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -1
  119. package/dist/types/src/testing/harness.d.ts +1 -1
  120. package/dist/types/src/testing/harness.d.ts.map +1 -1
  121. package/dist/types/src/testing/react.d.ts +6 -5
  122. package/dist/types/src/testing/react.d.ts.map +1 -1
  123. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  124. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  125. package/dist/types/src/ui/components/App/App.stories.d.ts +2 -2
  126. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
  127. package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts +6 -0
  128. package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts.map +1 -1
  129. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +6 -10
  130. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
  131. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  132. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +1 -1
  133. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
  134. package/dist/types/src/ui/components/Surface/context.d.ts +6 -2
  135. package/dist/types/src/ui/components/Surface/context.d.ts.map +1 -1
  136. package/dist/types/src/ui/components/Surface/index.d.ts +11 -4
  137. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  138. package/dist/types/src/ui/components/Surface/types.d.ts +52 -72
  139. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  140. package/dist/types/src/ui/hooks/useApp.d.ts +1 -1
  141. package/dist/types/src/ui/hooks/useCapabilities.d.ts +17 -1
  142. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
  143. package/dist/types/src/vite-plugin/composer/index.d.ts +11 -4
  144. package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -1
  145. package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -1
  146. package/dist/types/src/vite-plugin/index.d.ts +1 -0
  147. package/dist/types/src/vite-plugin/index.d.ts.map +1 -1
  148. package/dist/types/src/vite-plugin/load.d.ts +16 -0
  149. package/dist/types/src/vite-plugin/load.d.ts.map +1 -0
  150. package/dist/types/src/vite-plugin/manifest.d.ts +16 -4
  151. package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -1
  152. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -1
  153. package/dist/types/tsconfig.tsbuildinfo +1 -1
  154. package/docs/registry-spec.md +331 -0
  155. package/moon.yml +1 -0
  156. package/package.json +50 -39
  157. package/src/cli/cli.ts +2 -2
  158. package/src/common/activation-events.ts +3 -3
  159. package/src/common/capabilities.ts +18 -18
  160. package/src/config/index.ts +5 -0
  161. package/src/core/activation-event.ts +15 -8
  162. package/src/core/capability.ts +18 -6
  163. package/src/core/edge-registry-plugin-provider.ts +41 -42
  164. package/src/core/plugin-manager.test.ts +133 -137
  165. package/src/core/plugin-manager.ts +25 -19
  166. package/src/core/plugin-manifest.test.ts +5 -5
  167. package/src/core/plugin-manifest.ts +13 -10
  168. package/src/core/plugin.ts +58 -114
  169. package/src/core/registry.ts +20 -60
  170. package/src/core/url-loader.test.ts +2 -2
  171. package/src/core/url-loader.ts +23 -19
  172. package/src/index.ts +1 -0
  173. package/src/testing/harness.ts +5 -3
  174. package/src/testing/react.test.tsx +4 -2
  175. package/src/testing/react.tsx +10 -9
  176. package/src/testing/service.ts +2 -2
  177. package/src/testing/withPluginManager.stories.tsx +4 -2
  178. package/src/testing/withPluginManager.tsx +3 -1
  179. package/src/ui/components/App/App.stories.tsx +2 -2
  180. package/src/ui/components/PluginManager/PluginManagerProvider.ts +7 -0
  181. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +22 -22
  182. package/src/ui/components/Surface/SurfaceComponent.tsx +90 -79
  183. package/src/ui/components/Surface/SurfaceProfilerContext.tsx +1 -1
  184. package/src/ui/components/Surface/context.ts +6 -4
  185. package/src/ui/components/Surface/index.ts +14 -3
  186. package/src/ui/components/Surface/types.test.ts +43 -51
  187. package/src/ui/components/Surface/types.ts +99 -64
  188. package/src/ui/hooks/useApp.test.tsx +1 -1
  189. package/src/ui/hooks/useApp.tsx +2 -2
  190. package/src/ui/hooks/useCapabilities.ts +49 -2
  191. package/src/vite-plugin/boot-loader/BootLoader.solid-stories.tsx +11 -11
  192. package/src/vite-plugin/boot-loader/loader.ts +3 -3
  193. package/src/vite-plugin/composer/index.ts +134 -61
  194. package/src/vite-plugin/import-map/index.ts +23 -7
  195. package/src/vite-plugin/index.ts +1 -0
  196. package/src/vite-plugin/load.ts +57 -0
  197. package/src/vite-plugin/manifest.test.ts +3 -3
  198. package/src/vite-plugin/manifest.ts +21 -10
  199. package/src/vite-plugin/packages.ts +0 -2
  200. package/tsconfig.json +5 -2
  201. package/dist/lib/browser/chunk-5GY3YOEL.mjs.map +0 -7
  202. package/dist/lib/browser/chunk-66IXTIVK.mjs.map +0 -7
  203. package/dist/lib/browser/chunk-CO3XLNUX.mjs.map +0 -7
  204. package/dist/lib/browser/chunk-DC3WRPBV.mjs.map +0 -7
  205. package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +0 -7
  206. package/dist/lib/browser/chunk-HFLKXMT7.mjs.map +0 -7
  207. package/dist/lib/browser/chunk-IW44C7UL.mjs.map +0 -7
  208. package/dist/lib/browser/chunk-KZUDO43J.mjs.map +0 -7
  209. package/dist/lib/browser/chunk-XHS5KDNX.mjs.map +0 -7
  210. package/dist/lib/browser/chunk-Y66ELD4U.mjs.map +0 -7
  211. package/dist/lib/node-esm/chunk-A5CHGAZE.mjs.map +0 -7
  212. package/dist/lib/node-esm/chunk-CTKEZHKF.mjs.map +0 -7
  213. package/dist/lib/node-esm/chunk-FSVGKTF6.mjs.map +0 -7
  214. package/dist/lib/node-esm/chunk-KFZEB6BV.mjs.map +0 -7
  215. package/dist/lib/node-esm/chunk-NULBHQYS.mjs.map +0 -7
  216. package/dist/lib/node-esm/chunk-SX5NVETP.mjs.map +0 -7
  217. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +0 -7
  218. package/dist/lib/node-esm/chunk-XGBUKRCK.mjs.map +0 -7
  219. package/dist/lib/node-esm/chunk-XIGPWXCQ.mjs.map +0 -7
  220. package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +0 -7
  221. /package/dist/lib/browser/{capability-BOPAKKWG.mjs.map → capability-S44TE2H7.mjs.map} +0 -0
  222. /package/dist/lib/browser/{process-manager-capability-GXNUO7AR.mjs.map → process-manager-capability-QK4BMKMN.mjs.map} +0 -0
  223. /package/dist/lib/node-esm/{capability-KZWRTX7R.mjs.map → capability-3YRF77LV.mjs.map} +0 -0
  224. /package/dist/lib/node-esm/{process-manager-capability-TX5TA6YN.mjs.map → process-manager-capability-5S7WZ2JR.mjs.map} +0 -0
@@ -5,16 +5,16 @@ import {
5
5
  import "./chunk-Q2GLJTVV.mjs";
6
6
  import {
7
7
  capabilities_exports
8
- } from "./chunk-CO3XLNUX.mjs";
9
- import "./chunk-5GY3YOEL.mjs";
10
- import "./chunk-FO3IYSLV.mjs";
11
- import "./chunk-KZUDO43J.mjs";
12
- import "./chunk-XHS5KDNX.mjs";
13
- import "./chunk-66IXTIVK.mjs";
14
- import "./chunk-DC3WRPBV.mjs";
8
+ } from "./chunk-NKVRSMFN.mjs";
9
+ import "./chunk-VF37YTXJ.mjs";
10
+ import "./chunk-YUVQIOTB.mjs";
11
+ import "./chunk-LUH4Y5F2.mjs";
12
+ import "./chunk-UGYCLOXE.mjs";
13
+ import "./chunk-3NQLTQCP.mjs";
14
+ import "./chunk-OO53M5UK.mjs";
15
15
  import {
16
16
  capability_exports
17
- } from "./chunk-IW44C7UL.mjs";
17
+ } from "./chunk-OPTS3ZSN.mjs";
18
18
  import "./chunk-J5LGTIGS.mjs";
19
19
 
20
20
  // src/plugin-process-manager/history/capability.ts
@@ -32,4 +32,4 @@ var capability_default = capability_exports.makeModule(Effect.fnUntraced(functio
32
32
  export {
33
33
  capability_default as default
34
34
  };
35
- //# sourceMappingURL=capability-BOPAKKWG.mjs.map
35
+ //# sourceMappingURL=capability-S44TE2H7.mjs.map
@@ -13,13 +13,12 @@ __export(activation_event_exports, {
13
13
  make: () => make,
14
14
  oneOf: () => oneOf
15
15
  });
16
+ import { DXN } from "@dxos/keys";
16
17
  import { compositeKey } from "@dxos/util";
17
- var make = (id, specifier) => {
18
- return {
19
- id,
20
- specifier
21
- };
22
- };
18
+ var make = (nsid, specifier) => ({
19
+ id: DXN.make(nsid),
20
+ specifier
21
+ });
23
22
  var eventKey = (event) => event.specifier ? compositeKey(event.id, event.specifier) : event.id;
24
23
  var oneOf = (...events) => ({
25
24
  type: "one-of",
@@ -45,4 +44,4 @@ export {
45
44
  getEvents,
46
45
  activation_event_exports
47
46
  };
48
- //# sourceMappingURL=chunk-66IXTIVK.mjs.map
47
+ //# sourceMappingURL=chunk-3NQLTQCP.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/core/activation-event.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { DXN } from '@dxos/keys';\nimport { compositeKey } from '@dxos/util';\n\n/**\n * A unique DXN identifier representing an event.\n *\n * @example dxn:org.dxos.plugin.example.event.ready\n */\nexport type ActivationEvent = {\n id: DXN.DXN;\n specifier?: string;\n};\n\n/**\n * An activation event that can be a single event, or a combination of events.\n */\nexport type Events =\n | ActivationEvent\n | { type: 'one-of'; events: ActivationEvent[] }\n | { type: 'all-of'; events: ActivationEvent[] };\n\n/**\n * Helper to define an activation event from an NSID.\n * Static NSID strings are validated at compile time via {@link DXN.Name}.\n */\nexport const make: {\n <T extends string>(\n nsid: [DXN.Name<T>] extends [never] ? `Invalid NSID \"${T}\": final segment must be camelCase (no hyphens)` : T,\n specifier?: string,\n ): ActivationEvent;\n} = (nsid: string, specifier?: string): ActivationEvent => ({\n id: DXN.make(nsid),\n specifier,\n});\n\n/**\n * Helper to create an activation event key.\n */\nexport const eventKey = (event: ActivationEvent) =>\n event.specifier ? compositeKey(event.id, event.specifier) : event.id;\n\n/**\n * Helper to create an activation event that triggers when any of the given events are activated.\n */\nexport const oneOf = (...events: ActivationEvent[]) => ({ type: 'one-of' as const, events });\n\n/**\n * Helper to create an activation event that triggers when all of the given events are activated.\n */\nexport const allOf = (...events: ActivationEvent[]) => ({ type: 'all-of' as const, events });\n\n/**\n * Helper to check if an activation event is a one-of event.\n */\nexport const isOneOf = (events: Events): events is { type: 'one-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'one-of';\n\n/**\n * Helper to check if an activation event is an all-of event.\n */\nexport const isAllOf = (events: Events): events is { type: 'all-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'all-of';\n\n/**\n * Helper to get the events from an activation event.\n */\nexport const getEvents = (events: Events) => ('type' in events ? events.events : [events]);\n"],
5
+ "mappings": ";;;;;AAAA;;;;;;;;;;AAIA,SAASA,WAAW;AACpB,SAASC,oBAAoB;AAwBtB,IAAMC,OAKT,CAACC,MAAcC,eAAyC;EAC1DC,IAAIL,IAAIE,KAAKC,IAAAA;EACbC;AACF;AAKO,IAAME,WAAW,CAACC,UACvBA,MAAMH,YAAYH,aAAaM,MAAMF,IAAIE,MAAMH,SAAS,IAAIG,MAAMF;AAK7D,IAAMG,QAAQ,IAAIC,YAA+B;EAAEC,MAAM;EAAmBD;AAAO;AAKnF,IAAME,QAAQ,IAAIF,YAA+B;EAAEC,MAAM;EAAmBD;AAAO;AAKnF,IAAMG,UAAU,CAACH,WACtB,UAAUA,UAAUA,OAAOC,SAAS;AAK/B,IAAMG,UAAU,CAACJ,WACtB,UAAUA,UAAUA,OAAOC,SAAS;AAK/B,IAAMI,YAAY,CAACL,WAAoB,UAAUA,SAASA,OAAOA,SAAS;EAACA;;",
6
+ "names": ["DXN", "compositeKey", "make", "nsid", "specifier", "id", "eventKey", "event", "oneOf", "events", "type", "allOf", "isOneOf", "isAllOf", "getEvents"]
7
+ }
@@ -0,0 +1,7 @@
1
+ // src/config/index.ts
2
+ import { Config2 } from "@dxos/protocols";
3
+
4
+ export {
5
+ Config2
6
+ };
7
+ //# sourceMappingURL=chunk-53HJHMS5.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/config/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nexport { Config2 } from '@dxos/protocols';\n"],
5
+ "mappings": ";AAIA,SAASA,eAAe;",
6
+ "names": ["Config2"]
7
+ }
@@ -1,20 +1,21 @@
1
1
  import {
2
2
  PluginManagerProvider,
3
3
  topologicalSort,
4
+ useOptionalPluginManager,
4
5
  usePluginManager
5
- } from "./chunk-HFLKXMT7.mjs";
6
+ } from "./chunk-U5MESPM5.mjs";
6
7
  import {
7
8
  PluginManagerContext
8
9
  } from "./chunk-FJ4765WW.mjs";
9
10
  import {
10
11
  capabilities_exports
11
- } from "./chunk-CO3XLNUX.mjs";
12
+ } from "./chunk-NKVRSMFN.mjs";
12
13
  import {
13
14
  activation_events_exports
14
- } from "./chunk-5GY3YOEL.mjs";
15
+ } from "./chunk-VF37YTXJ.mjs";
15
16
  import {
16
17
  plugin_manager_exports
17
- } from "./chunk-XHS5KDNX.mjs";
18
+ } from "./chunk-UGYCLOXE.mjs";
18
19
 
19
20
  // src/ui/components/App/App.tsx
20
21
  import React2, { useEffect as useEffect3, useLayoutEffect } from "react";
@@ -39,7 +40,7 @@ var useApp = ({ pluginManager, pluginLoader: pluginLoaderProp, onPluginRemove, p
39
40
  const defaults = useDefaultValue(defaultsProp, () => []);
40
41
  const setupEvents = useDefaultValue(setupEventsProp, () => []);
41
42
  const pluginLoader = useMemo(() => pluginLoaderProp ?? ((id) => Effect.sync(() => {
42
- const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
43
+ const plugin = plugins.find((plugin2) => plugin2.meta.profile.key === id);
43
44
  invariant(plugin, `Plugin not found: ${id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 48, S: void 0, A: ["plugin", "`Plugin not found: ${id}`"] });
44
45
  return {
45
46
  plugin
@@ -241,19 +242,27 @@ var humanizeEventKey = (eventKey) => {
241
242
  };
242
243
 
243
244
  // src/ui/hooks/useCapabilities.ts
245
+ import { Atom } from "@effect-atom/atom";
244
246
  import { useAtomValue } from "@effect-atom/atom-react";
245
247
  import { useCallback as useCallback2 } from "react";
246
248
  import { invariant as invariant2 } from "@dxos/invariant";
247
249
  var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/ui/hooks/useCapabilities.ts";
250
+ var emptyCapabilities = Atom.make(() => []);
251
+ var emptyAtomValue = Atom.make(() => void 0);
248
252
  var useCapabilities = (interfaceDef) => {
249
253
  const manager = usePluginManager();
250
254
  return useAtomValue(manager.capabilities.atom(interfaceDef));
251
255
  };
252
256
  var useCapability = (interfaceDef) => {
253
257
  const capabilities = useCapabilities(interfaceDef);
254
- invariant2(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 23, S: void 0, A: ["capabilities.length > 0", "`No capability found for ${interfaceDef.identifier}`"] });
258
+ invariant2(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 26, S: void 0, A: ["capabilities.length > 0", "`No capability found for ${interfaceDef.identifier}`"] });
255
259
  return capabilities[0];
256
260
  };
261
+ var useOptionalCapabilities = (interfaceDef) => {
262
+ const manager = useOptionalPluginManager();
263
+ return useAtomValue(manager ? manager.capabilities.atom(interfaceDef) : emptyCapabilities);
264
+ };
265
+ var useOptionalCapability = (interfaceDef) => useOptionalCapabilities(interfaceDef)[0];
257
266
  var useAtomCapability = (atomCapability) => {
258
267
  const atom = useCapability(atomCapability);
259
268
  return useAtomValue(atom);
@@ -273,6 +282,23 @@ var useAtomCapabilityState = (atomCapability) => {
273
282
  update
274
283
  ];
275
284
  };
285
+ var useOptionalAtomCapabilityState = (atomCapability) => {
286
+ const registry = useOptionalCapability(capabilities_exports.AtomRegistry);
287
+ const atom = useOptionalCapability(atomCapability);
288
+ const value = useAtomValue(atom ?? emptyAtomValue);
289
+ const update = useCallback2((fn) => {
290
+ if (registry && atom) {
291
+ registry.set(atom, fn(registry.get(atom)));
292
+ }
293
+ }, [
294
+ registry,
295
+ atom
296
+ ]);
297
+ return [
298
+ value,
299
+ update
300
+ ];
301
+ };
276
302
  var useOperationInvoker = () => useCapability(capabilities_exports.OperationInvoker);
277
303
 
278
304
  // src/ui/hooks/useLoading.tsx
@@ -462,8 +488,11 @@ export {
462
488
  useApp,
463
489
  useCapabilities,
464
490
  useCapability,
491
+ useOptionalCapabilities,
492
+ useOptionalCapability,
465
493
  useAtomCapability,
466
494
  useAtomCapabilityState,
495
+ useOptionalAtomCapabilityState,
467
496
  useOperationInvoker,
468
497
  LoadingState,
469
498
  useLoading,
@@ -473,4 +502,4 @@ export {
473
502
  useSettingsState,
474
503
  App
475
504
  };
476
- //# sourceMappingURL=chunk-Y66ELD4U.mjs.map
505
+ //# sourceMappingURL=chunk-KRJ4KK2W.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ui/components/App/App.tsx", "../../../src/ui/hooks/useApp.tsx", "../../../src/ui/hooks/useCapabilities.ts", "../../../src/ui/hooks/useLoading.tsx", "../../../src/ui/hooks/useProcessManagerRuntime.ts", "../../../src/ui/hooks/useSettingsState.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type PropsWithChildren, useEffect, useLayoutEffect } from 'react';\n\nimport { Capabilities } from '../../../common';\nimport { topologicalSort } from '../../../helpers';\nimport { LoadingState, type StartupProgress, type UseAppOptions, useCapabilities, useLoading } from '../../hooks';\n\ndeclare global {\n interface Window {\n /**\n * Driver injected by `@dxos/app-framework/vite-plugin`'s `bootLoaderPlugin`\n * (a Solid app inlined into `index.html`). Declared here — on a module that\n * is part of the `@dxos/app-framework/ui` export surface — so the React side\n * and host apps (e.g. composer-app) can drive the loader without each\n * re-declaring the type. The canonical definition lives in the plugin's\n * `loader-app/types.ts`; this mirror exists because that source compiles in a\n * separate (Solid) program that doesn't ship its globals to consumers.\n */\n __bootLoader?: {\n status: (payload: {\n event?: string;\n module?: string;\n humanized: string;\n /**\n * Optional `(index/total)` tick. When present, the loader replaces the\n * current line in place (\"Loading plugins (12/80)\") instead of appending\n * a new entry — keeps the visible log compact during long counted phases.\n */\n range?: { index: number; total: number };\n }) => void;\n progress: (fraction?: number) => void;\n ready: () => void;\n dismiss: () => void;\n };\n }\n}\n\nexport type AppProps = Pick<UseAppOptions, 'debounce'> & {\n ready: boolean;\n error: unknown;\n progress?: StartupProgress;\n};\n\nconst FIRST_INTERACTIVE_MARK = 'app-framework:first-interactive';\n\nexport const App = ({ ready, error, debounce, progress }: AppProps) => {\n const reactContexts = useCapabilities(Capabilities.ReactContext);\n const reactRoots = useCapabilities(Capabilities.ReactRoot);\n const stage = useLoading(ready, debounce);\n const placeholderDismissed = stage >= LoadingState.Done;\n\n // Relay the startup lifecycle into the boot loader injected by\n // `@dxos/app-framework/vite-plugin` (a Solid app inlined into `index.html`,\n // the only visible loading UI). Plugin activation fills the `[0.5, 1]` half\n // of the ring; the raw `event` / `module` ids ride along so the loader owns\n // how each transition is rendered and traced. No-op once the outro has\n // started (`FadeOut`), so the dismissal runs uncontended.\n useEffect(() => {\n if (stage >= LoadingState.FadeOut) {\n return;\n }\n const fraction = progress?.progress ?? 0;\n window.__bootLoader?.progress(0.5 + fraction * 0.5);\n if (progress?.humanizedName) {\n window.__bootLoader?.status({\n event: progress.event,\n module: progress.module,\n humanized: `Activating ${progress.humanizedName}`,\n });\n }\n }, [stage, progress?.progress, progress?.event, progress?.module, progress?.humanizedName]);\n\n // Hand off at fade-out: play the loader's graceful shrink-and-fade outro.\n // `useLayoutEffect` runs before the next paint so the outro begins in the\n // same frame the real shell starts rendering beneath it.\n useLayoutEffect(() => {\n if (stage >= LoadingState.FadeOut) {\n window.__bootLoader?.ready();\n }\n }, [stage]);\n\n // Emit a once-per-app `app-framework:first-interactive` mark the first time\n // the loader is dismissed and the real app shell renders. Closes the gap\n // between `Startup` activated and the first interactive paint.\n //\n // Also the framework-owned handoff-complete signal: `dismiss()` removes the\n // loader immediately on the fast-load path (where `useLoading` skips\n // `FadeOut`), and is a no-op once an outro is already in flight, so it never\n // cuts the animation short.\n useEffect(() => {\n if (!placeholderDismissed) {\n return;\n }\n if (performance.getEntriesByName(FIRST_INTERACTIVE_MARK).length === 0) {\n performance.mark(FIRST_INTERACTIVE_MARK);\n }\n window.__bootLoader?.dismiss();\n }, [placeholderDismissed]);\n\n // Used in tests to exercise the error boundary & reset dialog (see\n // composer-app's `basic.spec.ts`). Thrown into the surrounding `ErrorBoundary`.\n if (location.search === '?throw') {\n throw new Error('Test error');\n }\n\n if (error) {\n // This triggers the error boundary to provide UI feedback for the startup error.\n throw error;\n }\n\n // The boot loader owns the screen until handoff completes; render nothing\n // until then (any DOM here would sit invisibly behind the `z-index: 10`\n // loader anyway).\n // TODO(wittjosiah): Consider using Suspense instead.\n if (!placeholderDismissed) {\n return null;\n }\n\n const ComposedContext = composeContexts(reactContexts);\n return (\n <ComposedContext>\n {reactRoots.map(({ id, root: Component }) => (\n <Component key={id} />\n ))}\n </ComposedContext>\n );\n};\n\nconst composeContexts = (contexts: Capabilities.ReactContext[]) => {\n if (contexts.length === 0) {\n return ({ children }: PropsWithChildren) => <>{children}</>;\n }\n\n return topologicalSort(contexts)\n .map(({ context }) => context)\n .reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-atom/atom-react';\nimport * as Effect from 'effect/Effect';\nimport * as Fiber from 'effect/Fiber';\nimport * as PubSub from 'effect/PubSub';\nimport * as Queue from 'effect/Queue';\nimport React, { type FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { EffectEx } from '@dxos/effect';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { ErrorBoundary, ErrorFallback, type FallbackProps } from '@dxos/react-error-boundary';\nimport { useAsyncEffect, useDefaultValue } from '@dxos/react-hooks';\nimport { ContextProtocolProvider } from '@dxos/web-context-react';\n\nimport { ActivationEvents, Capabilities } from '../../common';\nimport { PluginManagerContext } from '../../context';\nimport { type ActivationEvent, type Plugin, PluginManager } from '../../core';\nimport { App, PluginManagerProvider } from '../components';\n\nconst ENABLED_KEY = 'org.dxos.app-framework.enabled';\n\nexport type StartupProgress = {\n /** Number of modules that have been activated. */\n activated: number;\n /** Total number of modules registered. */\n total: number;\n /** Fractional progress (0-1). */\n progress: number;\n /**\n * Raw activation event key (e.g. `org.dxos.app-framework.event.startup`).\n * Set on event-level transitions, *and* on module-level transitions where\n * it carries the parent activation event that first triggered the\n * module's load (plumbed through `_loadCapabilitiesForModules` →\n * `_loadModule`). Consumers can use this either as the primary id (when\n * {@link module} is absent) or as an extra \"context\" field alongside\n * {@link module}.\n */\n event?: string;\n /**\n * Raw module id (e.g. `org.dxos.plugin.observability.module.ReactSurface`)\n * when the in-flight activation is module-level. When present,\n * {@link event} may also be set, identifying the parent activation that\n * triggered this module's load.\n */\n module?: string;\n /**\n * Pre-humanized label for the currently surfaced transition (module\n * label if {@link module} is set, otherwise the event label), supplied\n * for consumers that want a sensible default. Hosts that prefer to\n * render their own label can read the raw {@link event}/{@link module}\n * fields and ignore this — the framework leaves the policy choice\n * (which transitions to surface, how to format them, whether to drop\n * sub-modules entirely) to the host's `Placeholder`.\n */\n humanizedName?: string;\n};\n\nexport type UseAppOptions = {\n pluginManager?: PluginManager.PluginManager;\n pluginLoader?: PluginManager.ManagerOptions['pluginLoader'];\n onPluginRemove?: PluginManager.ManagerOptions['onRemove'];\n pluginRegistryProvider?: PluginManager.ManagerOptions['pluginRegistryProvider'];\n plugins?: Plugin.Plugin[];\n defaults?: string[];\n /**\n * Additional activation events to fire before startup.\n * These are fired alongside SetupReactSurface before the Startup event.\n */\n setupEvents?: ActivationEvent.ActivationEvent[];\n cacheEnabled?: boolean;\n safeMode?: boolean;\n debounce?: number;\n timeout?: number;\n fallback?: FC<FallbackProps>;\n};\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const plugins = [LayoutPlugin(), MyPlugin()];\n * const defaults = [MyPluginId];\n * const fallback = () => <div>Initializing Plugins...</div>;\n * const App = useApp({ plugins, defaults, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.pluginLoader A function which loads new plugins.\n * @param params.plugins All plugins available to the application. Plugins whose `meta.profile.tags` includes `'system'` are treated as core (force-enabled, not user-toggleable).\n * @param params.defaults Default plugins are enabled by default but can be disabled by the user.\n * @param params.cacheEnabled Whether to cache enabled plugins in localStorage.\n * @param params.safeMode Whether to enable safe mode, which disables optional plugins.\n * @param params.fallback Fallback component to render if an error occurs during startup.\n */\nexport const useApp = ({\n pluginManager,\n pluginLoader: pluginLoaderProp,\n onPluginRemove,\n pluginRegistryProvider,\n plugins: pluginsProp,\n defaults: defaultsProp,\n setupEvents: setupEventsProp,\n fallback = ErrorFallback,\n cacheEnabled = false,\n safeMode = false,\n debounce = 0,\n timeout = 30_000,\n}: UseAppOptions) => {\n const plugins = useDefaultValue(pluginsProp, () => []);\n const defaults = useDefaultValue(defaultsProp, () => []);\n const setupEvents = useDefaultValue(setupEventsProp, () => []);\n\n const pluginLoader = useMemo(\n () =>\n pluginLoaderProp ??\n ((id: string) =>\n Effect.sync(() => {\n const plugin = plugins.find((plugin) => plugin.meta.profile.key === id);\n invariant(plugin, `Plugin not found: ${id}`);\n return { plugin };\n })),\n [pluginLoaderProp, plugins],\n );\n\n const readyRef = useRef(false);\n const [ready, setReady] = useState(false);\n const errorRef = useRef<unknown>(null);\n const [error, setError] = useState<unknown>(null);\n const [startupProgress, setStartupProgress] = useState<StartupProgress>({\n activated: 0,\n total: 0,\n progress: 0,\n });\n // TODO(wittjosiah): Migrate to Atom.kvs for isomorphic storage.\n const cached: string[] = useMemo(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? '[]'), []);\n const enabled = useMemo(\n () => (safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults),\n [safeMode, cacheEnabled, cached, defaults],\n );\n const isExternalManager = !!pluginManager;\n const manager = useMemo(() => {\n const mgr =\n pluginManager ??\n PluginManager.make({\n pluginLoader,\n plugins,\n enabled,\n onRemove: onPluginRemove,\n pluginRegistryProvider,\n });\n log('useApp: useMemo created/reused manager', { provided: !!pluginManager });\n return mgr;\n }, [pluginManager, pluginLoader, plugins, enabled, onPluginRemove, pluginRegistryProvider]);\n\n useEffect(() => {\n if (!cacheEnabled) {\n return;\n }\n return manager.registry.subscribe(manager.enabled, (value) => {\n localStorage.setItem(ENABLED_KEY, JSON.stringify(value));\n });\n }, [cacheEnabled, manager]);\n\n useEffect(() => {\n setupDevtools(manager);\n }, [manager]);\n\n useAsyncEffect(async () => {\n log('useApp: effect mount');\n\n manager.capabilities.contribute({\n interface: Capabilities.PluginManager,\n implementation: manager,\n module: 'org.dxos.app-framework.plugin-manager',\n });\n\n manager.capabilities.contribute({\n interface: Capabilities.AtomRegistry,\n implementation: manager.registry,\n module: 'org.dxos.app-framework.atom-registry',\n });\n\n const fiber = Effect.gen(function* () {\n const queue = yield* PubSub.subscribe(manager.activation);\n const listener = yield* Effect.forkDaemon(\n Queue.take(queue).pipe(\n Effect.tap(({ event, state, module, error: error$ }) =>\n Effect.sync(() => {\n // Event-level Startup activated (no `module` field) fires once,\n // after every module triggered by Startup has finished. Module\n // activations now also carry their parent event id (so the trace\n // can attribute a module to its triggering event), which means\n // each module activated under Startup publishes\n // `{ event: 'startup', state: 'activated', module: <id> }`. Without\n // the `!module` guard the listener would mark the app ready on\n // the *first* such module rather than waiting for the event-level\n // completion — leaving downstream capabilities (operation-invoker,\n // app-graph, …) un-registered when the boot loader dismisses.\n if (event === ActivationEvents.Startup.id && state === 'activated' && !module) {\n clearTimeout(timeoutId);\n setReady(true);\n readyRef.current = true;\n // Trigger startup profiler dump if available.\n (globalThis as any).composer?.profiler?.dump();\n // Notify any host observability layer that startup completed.\n // A `CustomEvent` keeps this generic — app-framework doesn't\n // import a provider, and consumers can capture the startup\n // summary without us picking one.\n if (typeof window !== 'undefined') {\n window.dispatchEvent(new CustomEvent('app-framework:startup-activated'));\n }\n return;\n }\n // `activating` is the start-of-load signal. Surface the raw\n // `module` (or `event`) plus a pre-humanized label so the\n // boot loader can decide how to render each transition — show\n // everything, suppress noisy sub-modules, group by plugin,\n // or apply its own formatting. We intentionally do NOT touch\n // these fields on `activated`: pairing the two would cause\n // back-to-back identical updates to the host's effect, which\n // the boot loader treats as a re-trigger because\n // `progress.progress` moved. Leaving the label alone on\n // completion keeps it accurate (\"now activating X\") until\n // the next module starts.\n if (module && state === 'activating' && !readyRef.current) {\n setStartupProgress((current) => ({\n ...current,\n // `event` here is the activation event that first\n // triggered this module load (plumbed through\n // `_loadCapabilitiesForModules` → `_loadModule`).\n // Falsy/empty falls back to undefined so consumers can\n // tell \"no parent context\" from \"parent context: <X>\".\n event: event || undefined,\n module,\n humanizedName: humanizeModuleId(module),\n }));\n }\n // Update the activation count when a module commits. The\n // ring's fraction comes from this; `event`/`module`/\n // `humanizedName` were set by the matching `activating`\n // message above and are left alone so the count can advance\n // without re-firing the host's status callback.\n if (module && state === 'activated' && !readyRef.current) {\n const active = manager.getActive();\n const total = manager.getModules().length;\n setStartupProgress((current) => ({\n ...current,\n activated: active.length,\n total,\n progress: total > 0 ? active.length / total : 0,\n }));\n }\n // Event-level `activating` (no `module`) — fired at the start\n // of `_activateModulesForEvent` and recursively for each\n // before/after event. Surfaces a label during the gap before\n // the first module-level message lands; subsequent module\n // updates immediately overwrite this with a more specific\n // label.\n if (event && !module && state === 'activating' && !readyRef.current) {\n setStartupProgress((current) => ({\n ...current,\n event,\n module: undefined,\n humanizedName: humanizeEventKey(event),\n }));\n }\n if (error$ && !readyRef.current) {\n setError(error$);\n errorRef.current = error$;\n }\n }),\n ),\n Effect.forever,\n ),\n );\n\n yield* Effect.all([\n ...setupEvents.map((event) => manager.activate(event)),\n manager.activate(ActivationEvents.SetupReactSurface),\n manager.activate(ActivationEvents.Startup),\n ]);\n\n return yield* Fiber.join(listener);\n }).pipe(Effect.scoped, Effect.runFork);\n\n // Set up a timeout for startup.\n const timeoutId = setTimeout(() => {\n if (!readyRef.current && !errorRef.current) {\n log.warn('startup timeout diagnostic', {\n eventsFired: manager.getEventsFired(),\n activeModules: manager.getActive(),\n pendingReset: manager.getPendingReset(),\n });\n void EffectEx.runAndForwardErrors(Fiber.interrupt(fiber));\n setError(new Error(`Startup timed out after ${timeout}ms`));\n }\n }, timeout);\n\n return () => {\n log('useApp: effect cleanup');\n clearTimeout(timeoutId);\n void EffectEx.runAndForwardErrors(Fiber.interrupt(fiber));\n if (!isExternalManager) {\n void EffectEx.runAndForwardErrors(manager.shutdown());\n }\n };\n }, [manager]);\n\n const progressRef = useRef(startupProgress);\n progressRef.current = startupProgress;\n\n return useCallback(\n () => (\n <ErrorBoundary name='app' FallbackComponent={fallback}>\n <PluginManagerProvider value={manager}>\n <ContextProtocolProvider value={manager} context={PluginManagerContext}>\n <RegistryContext.Provider value={manager.registry}>\n <App ready={ready} error={error} debounce={debounce} progress={progressRef.current} />\n </RegistryContext.Provider>\n </ContextProtocolProvider>\n </PluginManagerProvider>\n </ErrorBoundary>\n ),\n [fallback, manager, ready, error],\n );\n};\n\nconst setupDevtools = (manager: PluginManager.PluginManager) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.manager = manager;\n};\n\n/**\n * Extracts a human-readable label from a module ID.\n *\n * Module IDs follow `org.dxos.plugin.<plugin-slug>.module.<module-name>`,\n * where `<plugin-slug>` is kebab-case and `<module-name>` is either an\n * explicit string (often kebab-case, e.g. `'observability'`, `'namespace'`)\n * or a capability tag in PascalCase from `Capability.getModuleTag(...)`\n * (e.g. `'ReactSurface'`, `'AppGraphBuilder'`). The output is\n * `\"Title Case Plugin: kebab-module\"` so the visible status names both the\n * plugin and the aspect being activated, helping disambiguate the multiple\n * modules a plugin contributes.\n *\n * Examples:\n * - \"org.dxos.plugin.markdown.module.ReactSurface\" → \"Markdown: react-surface\"\n * - \"org.dxos.plugin.observability.module.AppGraphBuilder\" → \"Observability: app-graph-builder\"\n * - \"org.dxos.plugin.observability.module.observability\" → \"Observability\"\n * (the module name matches the plugin slug — collapsed to avoid\n * \"Observability: observability\" noise.)\n */\nconst humanizeModuleId = (moduleId: string): string => {\n const match = moduleId.match(/\\.plugin\\.([^.]+)\\.module\\.(.+)$/);\n if (!match) {\n // Fallback: use the last segment.\n const parts = moduleId.split('.');\n return parts[parts.length - 1];\n }\n const [, pluginSlug, moduleName] = match;\n const pluginLabel = pluginSlug\n .split('-')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n // Normalise the module name to kebab-case so PascalCase capability tags\n // (\"ReactSurface\") read consistently with explicit kebab IDs\n // (\"operation-handler\"). The two-step substitution handles consecutive\n // uppercase runs (`URLLoader` → `url-loader`) without splitting them\n // mid-acronym.\n const moduleLabel = moduleName\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')\n .toLowerCase();\n // Capability modules whose name matches the plugin slug (e.g. the\n // observability plugin's `observability` capability module) would render\n // as \"Observability: observability\" — drop the redundant suffix.\n if (moduleLabel === pluginSlug) {\n return pluginLabel;\n }\n return `${pluginLabel}: ${moduleLabel}`;\n};\n\n/**\n * Extracts a human-readable label from an activation event key.\n * E.g., \"org.dxos.app-framework.event.setup-react-surface\" → \"Setup React Surface\".\n */\nconst humanizeEventKey = (eventKey: string): string => {\n // Strip a leading specifier (composite key form: \"<id>:<specifier>\").\n const id = eventKey.split(':')[0];\n // Match the trailing segment after `.event.`.\n const match = id.match(/\\.event\\.(.+)$/);\n const slug = match ? match[1] : (id.split('.').pop() ?? id);\n return slug\n .split('-')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom';\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport { useCallback } from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { Capabilities } from '../../common';\nimport { type Capability } from '../../core';\nimport { useOptionalPluginManager, usePluginManager } from '../components';\n\n/** Stable empty result for capability lookups made outside a plugin manager. */\nconst emptyCapabilities = Atom.make(() => [] as const);\n\n/** Stable atom yielding `undefined`, used as the fallback for optional atom-capability lookups. */\nconst emptyAtomValue = Atom.make(() => undefined);\n\n/**\n * Hook to request capabilities from the plugin context.\n * @returns An array of capabilities.\n */\nexport const useCapabilities = <T>(interfaceDef: Capability.InterfaceDef<T>) => {\n const manager = usePluginManager();\n return useAtomValue(manager.capabilities.atom(interfaceDef));\n};\n\n/**\n * Hook to request a capability from the plugin context.\n * @returns The capability.\n * @throws If no capability is found.\n */\n// TODO(burdon): Option not to throw?\nexport const useCapability = <T>(interfaceDef: Capability.InterfaceDef<T>) => {\n const capabilities = useCapabilities(interfaceDef);\n invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`);\n return capabilities[0];\n};\n\n/**\n * Hook to request capabilities without requiring a plugin manager.\n * @returns An array of capabilities, or an empty array when rendered outside a {@link PluginManagerProvider}.\n */\nexport const useOptionalCapabilities = <T>(interfaceDef: Capability.InterfaceDef<T>): readonly T[] => {\n const manager = useOptionalPluginManager();\n return useAtomValue(\n manager ? manager.capabilities.atom(interfaceDef) : (emptyCapabilities as Atom.Atom<readonly T[]>),\n );\n};\n\n/**\n * Hook to request a single capability without requiring a plugin manager.\n * @returns The first matching capability, or `undefined` when none is registered (or there is no plugin manager).\n */\nexport const useOptionalCapability = <T>(interfaceDef: Capability.InterfaceDef<T>): T | undefined =>\n useOptionalCapabilities(interfaceDef)[0];\n\n/**\n * Hook to get the current value of an atom capability.\n * Automatically subscribes to changes.\n * @example const settings = useAtomCapability(CommentCapabilities.Settings);\n */\nexport const useAtomCapability = <T>(atomCapability: Capability.InterfaceDef<Atom.Atom<T>>): T => {\n const atom = useCapability(atomCapability);\n return useAtomValue(atom);\n};\n\n/**\n * Hook to get value and updater for an atom capability.\n * Returns [currentValue, updateFn] similar to useState.\n * @example const [settings, updateSettings] = useAtomCapabilityState(CommentCapabilities.Settings);\n */\nexport const useAtomCapabilityState = <T>(\n atomCapability: Capability.InterfaceDef<Atom.Writable<T>>,\n): [T, (fn: (current: T) => T) => void] => {\n const registry = useCapability(Capabilities.AtomRegistry);\n const atom = useCapability(atomCapability);\n const value = useAtomValue(atom);\n const update = useCallback(\n (fn: (current: T) => T) => {\n registry.set(atom, fn(registry.get(atom)));\n },\n [registry, atom],\n );\n return [value, update];\n};\n\n/**\n * Tolerant variant of {@link useAtomCapabilityState}: returns `[undefined, noop]` when the atom\n * capability is not registered (e.g. the contributing plugin is not installed) rather than\n * throwing. The updater is a no-op while the capability is absent.\n */\nexport const useOptionalAtomCapabilityState = <T>(\n atomCapability: Capability.InterfaceDef<Atom.Writable<T>>,\n): [T | undefined, (fn: (current: T) => T) => void] => {\n const registry = useOptionalCapability(Capabilities.AtomRegistry);\n const atom = useOptionalCapability(atomCapability);\n const value = useAtomValue(atom ?? emptyAtomValue);\n const update = useCallback(\n (fn: (current: T) => T) => {\n if (registry && atom) {\n registry.set(atom, fn(registry.get(atom)));\n }\n },\n [registry, atom],\n );\n return [value, update];\n};\n\n/**\n * Hook to get the operation invoker capability.\n */\nexport const useOperationInvoker = (): Capabilities.OperationInvoker => useCapability(Capabilities.OperationInvoker);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useRef, useState } from 'react';\n\nexport enum LoadingState {\n Loading = 0,\n FadeIn = 1,\n FadeOut = 2,\n Done = 3,\n}\n\n/**\n * To avoid \"flashing\" the placeholder, we wait a period of time before starting the loading animation.\n * If loading completes during this time the placehoder is not shown, otherwise is it displayed for a minimum period of time.\n *\n * States:\n * 0: Loading - Wait for a period of time before starting the loading animation.\n * 1: Fade-in - Display a loading animation.\n * 2: Fade-out - Fade out the loading animation.\n * 3: Done - Remove the placeholder.\n */\nexport const useLoading = (ready: boolean, debounce = 0) => {\n const [stage, setStage] = useState<LoadingState>(LoadingState.Loading);\n // Mirror `ready` into a ref so the interval's `setStage` callback can read\n // the latest value without depending on the effect re-running. The pure\n // closure-capture pattern (with `ready` in deps) sticks the FSM at\n // `FadeIn` whenever HMR doesn't propagate the dep change end-to-end —\n // a ref sidesteps that entirely and fires the read on every tick.\n const readyRef = useRef(ready);\n readyRef.current = ready;\n\n useEffect(() => {\n if (!debounce) {\n return;\n }\n\n const i = setInterval(() => {\n setStage((stage) => {\n const isReady = readyRef.current;\n switch (stage) {\n case LoadingState.Loading: {\n if (!isReady) {\n return LoadingState.FadeIn;\n }\n clearInterval(i);\n return LoadingState.Done;\n }\n\n case LoadingState.FadeIn: {\n if (isReady) {\n return LoadingState.FadeOut;\n }\n break;\n }\n\n case LoadingState.FadeOut: {\n clearInterval(i);\n return LoadingState.Done;\n }\n }\n\n return stage;\n });\n }, debounce);\n\n return () => clearInterval(i);\n }, [debounce]);\n\n if (!debounce) {\n return ready ? LoadingState.Done : LoadingState.Loading;\n }\n\n return stage;\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport { type DependencyList, use, useCallback, useMemo } from 'react';\n\nimport { Operation, ServiceResolver } from '@dxos/compute';\nimport { EffectEx } from '@dxos/effect';\nimport type { SpaceId } from '@dxos/keys';\n\nimport { Capabilities } from '../../common';\nimport { useCapability } from './useCapabilities';\n\n/**\n * Resolve the shared {@link Capabilities.ProcessManagerRuntime} from the plugin context.\n */\nexport const useProcessManagerRuntime = (): Capabilities.ProcessManagerRuntime =>\n useCapability(Capabilities.ProcessManagerRuntime);\n\n/**\n * Build a callback that runs an effect on the {@link Capabilities.ProcessManagerRuntime}\n * with space-scoped services resolved via {@link ServiceResolver.provide}.\n *\n * The `tags` tuple must list every service the effect requires (beyond the\n * fixed {@link Capabilities.ProcessManagerRuntimeServices}); these services are\n * resolved for the given `spaceId` through the runtime's service resolver.\n *\n * Nested `Operation.invoke` / `Operation.schedule` calls within the effect\n * inherit `spaceId` as a default {@link Operation.InvokeOptions} so that\n * spawned operation processes have a space context (and therefore can resolve\n * space-scoped services like `Database.Service`) without each call site having\n * to thread the id through manually.\n */\nexport const useSpaceCallback = <const Tags extends readonly Context.Tag<any, any>[], T>(\n spaceId: SpaceId | undefined,\n tags: Tags,\n fn: () => Effect.Effect<T, any, Context.Tag.Identifier<Tags[number]> | Capabilities.ProcessManagerRuntimeServices>,\n deps?: DependencyList,\n): (() => Promise<T>) => {\n const runtime = useProcessManagerRuntime();\n return useCallback(() => {\n if (spaceId === undefined) {\n throw new TypeError('Space not provided to useSpaceCallback');\n }\n const layer = Layer.merge(\n ServiceResolver.provide({ space: spaceId }, ...tags),\n Operation.withInvocationOptions({ spaceId }),\n );\n return runtime.runPromise(fn().pipe(Effect.provide(layer)) as Effect.Effect<T, any, any>);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [runtime, spaceId, ...(deps ?? [])]);\n};\n\n/**\n * Suspensefully resolve a single space-scoped service via the\n * {@link Capabilities.ProcessManagerRuntime}'s service resolver.\n */\nexport const useSpaceService = <T extends Context.Tag<any, any>>(\n tag: T,\n spaceId: SpaceId | undefined,\n): Context.Tag.Service<T> | undefined => {\n const runtime = useProcessManagerRuntime();\n const promise = useMemo(() => {\n if (spaceId === undefined) {\n return undefined;\n }\n const layer = ServiceResolver.provide({ space: spaceId }, tag);\n const effect = Effect.flatMap(tag, (service) => Effect.succeed(service)).pipe(Effect.provide(layer));\n return runtime.runPromiseExit(effect as Effect.Effect<Context.Tag.Service<T>, any, any>);\n }, [runtime, spaceId, tag]);\n if (!promise) {\n return undefined;\n }\n return EffectEx.unwrapExit(use(promise));\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom, RegistryContext, useAtomValue } from '@effect-atom/atom-react';\nimport { useCallback, useContext } from 'react';\n\n/**\n * Hook to read and update a settings atom.\n * Returns the current value and an update function.\n */\nexport const useSettingsState = <T>(\n atom: Atom.Writable<T>,\n): { settings: T; updateSettings: (fn: (current: T) => T) => void } => {\n const registry = useContext(RegistryContext);\n const settings = useAtomValue(atom);\n\n const updateSettings = useCallback(\n (fn: (current: T) => T) => {\n registry.set(atom, fn(registry.get(atom)));\n },\n [registry, atom],\n );\n\n return { settings, updateSettings };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAIA,OAAOA,UAAiCC,aAAAA,YAAWC,uBAAuB;;;ACA1E,SAASC,uBAAuB;AAChC,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,OAAOC,SAAkBC,aAAaC,WAAWC,SAASC,QAAQC,gBAAgB;AAElF,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAASC,WAAW;AACpB,SAASC,eAAeC,qBAAyC;AACjE,SAASC,gBAAgBC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BAAAA;IACnB;AACAoB,WAAOC,cAAcW,QAAAA;EACvB,GAAG;IAAClB;GAAqB;AAIzB,MAAImB,SAASC,WAAW,UAAU;AAChC,UAAM,IAAIC,MAAM,YAAA;EAClB;AAEA,MAAIhC,OAAO;AAET,UAAMA;EACR;AAMA,MAAI,CAACW,sBAAsB;AACzB,WAAO;EACT;AAEA,QAAMsB,kBAAkBC,gBAAgB/B,aAAAA;AACxC,SACE,gBAAAgC,OAAA,cAACF,iBAAAA,MACE1B,WAAW6B,IAAI,CAAC,EAAEC,IAAIC,MAAMC,UAAS,MACpC,gBAAAJ,OAAA,cAACI,WAAAA;IAAUC,KAAKH;;AAIxB;AAEA,IAAMH,kBAAkB,CAACO,aAAAA;AACvB,MAAIA,SAASd,WAAW,GAAG;AACzB,WAAO,CAAC,EAAEe,SAAQ,MAA0B,gBAAAP,OAAA,cAAAA,OAAA,UAAA,MAAGO,QAAAA;EACjD;AAEA,SAAOC,gBAAgBF,QAAAA,EACpBL,IAAI,CAAC,EAAEQ,QAAO,MAAOA,OAAAA,EACrBC,OAAO,CAACC,KAAKC,SAAS,CAAC,EAAEL,SAAQ,MAChC,gBAAAP,OAAA,cAACW,KAAAA,MACC,gBAAAX,OAAA,cAACY,MAAAA,MAAML,QAAAA,CAAAA,CAAAA;AAGf;",
6
+ "names": ["React", "useEffect", "useLayoutEffect", "RegistryContext", "Effect", "Fiber", "PubSub", "Queue", "React", "useCallback", "useEffect", "useMemo", "useRef", "useState", "EffectEx", "invariant", "log", "ErrorBoundary", "ErrorFallback", "useAsyncEffect", "useDefaultValue", "ContextProtocolProvider", "ENABLED_KEY", "defaults", "useDefaultValue", "defaultsProp", "setupEvents", "setupEventsProp", "pluginLoader", "pluginLoaderProp", "plugin", "find", "meta", "invariant", "id", "plugins", "errorRef", "useRef", "error", "setError", "useState", "startupProgress", "setStartupProgress", "activated", "total", "progress", "safeMode", "cacheEnabled", "cached", "pluginManager", "enabled", "onRemove", "pluginRegistryProvider", "mgr", "onPluginRemove", "useEffect", "manager", "useAsyncEffect", "capabilities", "contribute", "interface", "Capabilities", "PluginManager", "implementation", "module", "registry", "fiber", "forkDaemon", "setReady", "readyRef", "current", "globalThis", "humanizedName", "humanizeModuleId", "length", "active", "event", "error$", "Effect", "forever", "activate", "ActivationEvents", "Startup", "join", "listener", "pipe", "timeoutId", "eventsFired", "getEventsFired", "activeModules", "pendingReset", "getPendingReset", "runAndForwardErrors", "interrupt", "Error", "timeout", "clearTimeout", "Fiber", "isExternalManager", "EffectEx", "shutdown", "progressRef", "name", "FallbackComponent", "fallback", "value", "ContextProtocolProvider", "PluginManagerContext", "App", "ready", "debounce", "composer", "match", "parts", "pluginSlug", "moduleName", "pluginLabel", "split", "map", "word", "Atom", "useAtomValue", "useCallback", "invariant", "__dxlog_file", "useAtomValue", "capabilities", "interfaceDef", "invariant", "length", "atom", "useCapability", "atomCapability", "value", "update", "fn", "registry", "set", "useCallback", "useOptionalCapability", "emptyAtomValue", "useEffect", "useRef", "useState", "LoadingState", "useLoading", "ready", "debounce", "stage", "setStage", "readyRef", "current", "i", "setInterval", "isReady", "clearInterval", "Effect", "Layer", "use", "useCallback", "useMemo", "Operation", "ServiceResolver", "EffectEx", "useProcessManagerRuntime", "useCapability", "Capabilities", "ProcessManagerRuntime", "useSpaceCallback", "spaceId", "tags", "fn", "deps", "runtime", "useCallback", "undefined", "TypeError", "layer", "merge", "ServiceResolver", "provide", "space", "Operation", "withInvocationOptions", "runPromise", "pipe", "useSpaceService", "tag", "promise", "useMemo", "effect", "flatMap", "service", "succeed", "runPromiseExit", "EffectEx", "unwrapExit", "use", "RegistryContext", "useAtomValue", "useCallback", "useContext", "useSettingsState", "atom", "registry", "settings", "updateSettings", "fn", "set", "get", "FIRST_INTERACTIVE_MARK", "App", "ready", "error", "debounce", "progress", "reactContexts", "useCapabilities", "Capabilities", "ReactContext", "reactRoots", "ReactRoot", "stage", "useLoading", "placeholderDismissed", "LoadingState", "Done", "useEffect", "FadeOut", "fraction", "window", "__bootLoader", "humanizedName", "status", "event", "module", "humanized", "useLayoutEffect", "performance", "getEntriesByName", "length", "mark", "dismiss", "location", "search", "Error", "ComposedContext", "composeContexts", "React", "map", "id", "root", "Component", "key", "contexts", "children", "topologicalSort", "context", "reduce", "Acc", "Next"]
7
+ }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isPlugin
3
- } from "./chunk-DC3WRPBV.mjs";
3
+ } from "./chunk-OO53M5UK.mjs";
4
4
  import {
5
5
  __export
6
6
  } from "./chunk-J5LGTIGS.mjs";
@@ -55,26 +55,34 @@ import * as HttpClientResponse from "@effect/platform/HttpClientResponse";
55
55
  import * as Effect2 from "effect/Effect";
56
56
  import * as Schema from "effect/Schema";
57
57
  import { BaseError as BaseError2 } from "@dxos/errors";
58
- import { PLUGIN_ENTRY_FILENAME } from "@dxos/protocols";
58
+ import { PLUGIN_ENTRY_FILENAME, PluginManifestSchema } from "@dxos/protocols";
59
59
  var PLUGIN_DEV_SERVER_PORT = 3967;
60
60
  var PluginManifestError = class extends BaseError2.extend("PluginManifestError", "Plugin manifest is invalid") {
61
61
  };
62
62
  var Manifest = Schema.Struct({
63
- id: Schema.String,
64
- name: Schema.String,
65
- version: Schema.String,
63
+ // Reuse the build manifest field definitions from `@dxos/protocols` (the shape `composerPlugin`
64
+ // emits), minus `assets` which we relax below, plus the dev-only `devEntry`.
65
+ ...PluginManifestSchema.omit("assets").fields,
66
+ /**
67
+ * Relative asset paths. Relaxed vs the build `PluginManifestSchema` (which requires >= 1) because
68
+ * dev-server manifests list no assets — chunks/styles flow through the dev server on demand.
69
+ */
66
70
  assets: Schema.Array(Schema.String),
67
- devEntry: Schema.String.pipe(Schema.optional)
71
+ /** Present only for dev-server manifests; points at the unbundled source entry. */
72
+ devEntry: Schema.optional(Schema.String)
68
73
  });
69
74
  var resolve = (manifestUrl, manifest) => {
70
75
  const dev = manifest.devEntry !== void 0;
71
76
  return {
72
- id: manifest.id,
77
+ key: manifest.key,
73
78
  name: manifest.name,
74
79
  version: manifest.version,
75
80
  entryUrl: new URL(dev ? manifest.devEntry : PLUGIN_ENTRY_FILENAME, manifestUrl).toString(),
76
81
  assetUrls: manifest.assets.map((asset) => new URL(asset, manifestUrl).toString()),
77
- dev
82
+ dev,
83
+ ...manifest.dependencies !== void 0 ? {
84
+ dependencies: manifest.dependencies
85
+ } : {}
78
86
  };
79
87
  };
80
88
  var parse = (manifestUrl, payload) => {
@@ -135,7 +143,7 @@ var getPersistedRemotePlugins = (storage, key) => {
135
143
  if (!Array.isArray(parsed)) {
136
144
  return [];
137
145
  }
138
- return parsed.filter((entry) => typeof entry === "object" && entry !== null && typeof entry.id === "string" && typeof entry.url === "string");
146
+ return parsed.filter((entry) => typeof entry === "object" && entry !== null && typeof entry.id === "string" && typeof entry.url === "string" && (entry.version === void 0 || typeof entry.version === "string"));
139
147
  } catch {
140
148
  return [];
141
149
  }
@@ -230,14 +238,14 @@ var loadStylesheets = (manifest, cache) => Effect3.gen(function* () {
230
238
  }
231
239
  const cssUrls = manifest.assetUrls.filter((url) => url.endsWith(".css"));
232
240
  for (const url of cssUrls) {
233
- const resolved = yield* cache.resolve(manifest.id, url);
234
- if (document.querySelector(`link[data-dxos-plugin-id="${manifest.id}"][href="${resolved}"]`)) {
241
+ const resolved = yield* cache.resolve(manifest.key, url);
242
+ if (document.querySelector(`link[data-dxos-plugin-id="${manifest.key}"][href="${resolved}"]`)) {
235
243
  continue;
236
244
  }
237
245
  const link = document.createElement("link");
238
246
  link.rel = "stylesheet";
239
247
  link.href = resolved;
240
- link.dataset.dxosPluginId = manifest.id;
248
+ link.dataset.dxosPluginId = manifest.key;
241
249
  document.head.appendChild(link);
242
250
  }
243
251
  });
@@ -264,9 +272,9 @@ var loadFromManifest = (manifestUrl, cache) => Effect3.gen(function* () {
264
272
  manifestUrl,
265
273
  ...manifest.assetUrls
266
274
  ] : manifest.assetUrls;
267
- yield* cache.cache(manifest.id, cachedUrls).pipe(wrapCacheError);
275
+ yield* cache.cache(manifest.key, cachedUrls).pipe(wrapCacheError);
268
276
  }
269
- const entryUrl = manifest.dev ? manifest.entryUrl : yield* cache.resolve(manifest.id, manifest.entryUrl).pipe(wrapCacheError);
277
+ const entryUrl = manifest.dev ? manifest.entryUrl : yield* cache.resolve(manifest.key, manifest.entryUrl).pipe(wrapCacheError);
270
278
  const mod = yield* Effect3.tryPromise({
271
279
  try: () => import(
272
280
  /* @vite-ignore */
@@ -281,7 +289,7 @@ var loadFromManifest = (manifestUrl, cache) => Effect3.gen(function* () {
281
289
  })
282
290
  });
283
291
  const plugin = normalizePluginExport(mod);
284
- if (!plugin.meta.id || !plugin.meta.name) {
292
+ if (!plugin.meta.profile.key || !plugin.meta.profile.name) {
285
293
  return yield* Effect3.fail(new RemotePluginLoadError({
286
294
  context: {
287
295
  locator: manifestUrl,
@@ -289,13 +297,13 @@ var loadFromManifest = (manifestUrl, cache) => Effect3.gen(function* () {
289
297
  }
290
298
  }));
291
299
  }
292
- if (plugin.meta.id !== manifest.id) {
300
+ if (plugin.meta.profile.key !== manifest.key) {
293
301
  return yield* Effect3.fail(new RemotePluginLoadError({
294
302
  context: {
295
303
  locator: manifestUrl,
296
304
  reason: "meta-mismatch",
297
- metaId: plugin.meta.id,
298
- manifestId: manifest.id
305
+ metaId: plugin.meta.profile.key,
306
+ manifestId: manifest.key
299
307
  }
300
308
  }));
301
309
  }
@@ -354,7 +362,7 @@ var make = (builtinPlugins, options = {}) => {
354
362
  const key = options.key ?? DEFAULT_KEY;
355
363
  const cache = options.cache ?? noop();
356
364
  return (locator) => Effect3.gen(function* () {
357
- const builtin = builtinPlugins.find((plugin2) => plugin2.meta.id === locator);
365
+ const builtin = builtinPlugins.find((plugin2) => plugin2.meta.profile.key === locator);
358
366
  if (builtin) {
359
367
  return {
360
368
  plugin: builtin
@@ -370,18 +378,18 @@ var make = (builtinPlugins, options = {}) => {
370
378
  }
371
379
  const { plugin, manifest } = yield* loadFromManifest(locator, cache);
372
380
  if (!manifest.dev) {
373
- const duplicate = builtinPlugins.find((existing) => existing.meta.id === plugin.meta.id);
381
+ const duplicate = builtinPlugins.find((existing) => existing.meta.profile.key === plugin.meta.profile.key);
374
382
  if (duplicate) {
375
383
  return yield* Effect3.fail(new RemotePluginLoadError({
376
384
  context: {
377
385
  locator,
378
386
  reason: "duplicate-id",
379
- id: plugin.meta.id
387
+ id: plugin.meta.profile.key
380
388
  }
381
389
  }));
382
390
  }
383
391
  persistRemotePlugin(storage, key, {
384
- id: plugin.meta.id,
392
+ id: plugin.meta.profile.key,
385
393
  url: locator
386
394
  });
387
395
  }
@@ -419,4 +427,4 @@ export {
419
427
  uninstall,
420
428
  url_loader_exports
421
429
  };
422
- //# sourceMappingURL=chunk-KZUDO43J.mjs.map
430
+ //# sourceMappingURL=chunk-LUH4Y5F2.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/core/url-loader.ts", "../../../src/core/plugin-asset-cache.ts", "../../../src/core/plugin-manifest.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nimport { BaseError } from '@dxos/errors';\nimport { log } from '@dxos/log';\n\nimport * as Plugin from './plugin';\nimport * as PluginAssetCache from './plugin-asset-cache';\nimport * as PluginManifest from './plugin-manifest';\n\nconst DEFAULT_KEY = 'org.dxos.composer.remote-plugins';\n\n/**\n * Tagged error for any failure during remote plugin loading. Construction sites\n * set `context.locator` and `context.reason` (one of `'invalid-locator' |\n * 'manifest-error' | 'cache-error' | 'import-failed' | 'meta-missing' |\n * 'meta-mismatch' | 'duplicate-id'`) so handlers can route on the failure mode.\n */\nexport class RemotePluginLoadError extends BaseError.extend('RemotePluginLoadError', 'Failed to load remote plugin') {}\n\n/**\n * Abstraction over key-value storage (defaults to localStorage).\n */\nexport type Storage = {\n get(key: string): string | null;\n set(key: string, value: string): void;\n};\n\n/**\n * Options for configuring the URL loader.\n */\nexport type Options = {\n storage?: Storage;\n key?: string;\n /**\n * Per-platform offline asset cache. Defaults to a no-op cache (no offline support).\n */\n cache?: PluginAssetCache.Cache;\n};\n\n/**\n * Options for the preload entry point. Adds an optional progress hook so hosts\n * can drive a boot-loader counter (`Loading plugins (3/12)…`) as remote plugin\n * manifests resolve. Resolution order is *not* deterministic — each entry races\n * its own network fetch — so callers should treat `loaded` as a count, not an\n * index. Failures are still swallowed; `loaded` advances on both success and\n * recoverable failure so the counter always reaches `total`.\n */\nexport type PreloadOptions = Options & {\n onPluginLoaded?: (loaded: number, total: number) => void;\n};\n\n/**\n * Persisted record of a remote plugin that has been loaded previously.\n *\n * `url` is the URL of the plugin manifest (`plugin.json`), not the entry module.\n */\nexport type RemotePluginView = {\n id: string;\n url: string;\n /** Installed version string, e.g. `v1.0.0`. Populated after install from a community catalog entry. */\n version?: string;\n};\n\nconst defaultStorage = (): Storage => ({\n get: (key) => localStorage.getItem(key),\n set: (key, value) => localStorage.setItem(key, value),\n});\n\nconst getPersistedRemotePlugins = (storage: Storage, key: string): RemotePluginView[] => {\n try {\n const parsed: unknown = JSON.parse(storage.get(key) ?? '[]');\n if (!Array.isArray(parsed)) {\n return [];\n }\n return parsed.filter(\n (entry): entry is RemotePluginView =>\n typeof entry === 'object' &&\n entry !== null &&\n typeof entry.id === 'string' &&\n typeof entry.url === 'string' &&\n (entry.version === undefined || typeof entry.version === 'string'),\n );\n } catch {\n return [];\n }\n};\n\nconst persistRemotePlugin = (storage: Storage, key: string, entry: RemotePluginView): void => {\n try {\n const entries = getPersistedRemotePlugins(storage, key).filter((existing) => existing.id !== entry.id);\n entries.push(entry);\n storage.set(key, JSON.stringify(entries));\n } catch (error) {\n log.warn('failed to persist remote plugin entry', { entry, error });\n }\n};\n\nconst removePersistedRemotePlugin = (storage: Storage, key: string, pluginId: string): void => {\n try {\n const entries = getPersistedRemotePlugins(storage, key).filter((existing) => existing.id !== pluginId);\n storage.set(key, JSON.stringify(entries));\n } catch (error) {\n log.warn('failed to remove remote plugin entry', { pluginId, error });\n }\n};\n\nconst isUrl = (locator: string): boolean => {\n try {\n const url = new URL(locator);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n return false;\n }\n};\n\n/**\n * Returns true when the URL's hostname is the local host (localhost, 127.0.0.1, or ::1).\n */\nexport const isLocalUrl = (locator: string): boolean => {\n try {\n const hostname = new URL(locator).hostname.toLowerCase();\n // WHATWG URL returns '::1' without brackets in Node; some browsers return '[::1]'.\n return hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '::1' || hostname === '[::1]';\n } catch {\n return false;\n }\n};\n\n/**\n * Returns the list of remote plugin entries previously persisted by {@link make}.\n * Useful for UI code that needs to know which loaded plugins were installed from a URL\n * (e.g. to surface a tag on remote or localhost-hosted plugins).\n */\nexport const getRemoteEntries = (options: Options = {}): readonly RemotePluginView[] => {\n const storage = options.storage ?? defaultStorage();\n const key = options.key ?? DEFAULT_KEY;\n return getPersistedRemotePlugins(storage, key);\n};\n\n/**\n * Updates the persisted installed version for an already-stored remote plugin entry.\n * Does nothing if the plugin has not been persisted yet.\n */\nexport const setInstalledVersion = (id: string, version: string, options: Options = {}): void => {\n const storage = options.storage ?? defaultStorage();\n const key = options.key ?? DEFAULT_KEY;\n const entries = getPersistedRemotePlugins(storage, key);\n const index = entries.findIndex((entry) => entry.id === id);\n if (index === -1) {\n return;\n }\n entries[index] = { ...entries[index], version };\n try {\n storage.set(key, JSON.stringify(entries));\n } catch (error) {\n log.warn('failed to update installed version for remote plugin', { id, version, error });\n }\n};\n\n/**\n * Returns the installed version string for the given plugin id, or `undefined` if\n * the plugin was installed without version tracking (legacy install) or is not found.\n */\nexport const getInstalledVersion = (id: string, options: Options = {}): string | undefined => {\n const storage = options.storage ?? defaultStorage();\n const key = options.key ?? DEFAULT_KEY;\n return getPersistedRemotePlugins(storage, key).find((entry) => entry.id === id)?.version;\n};\n\nconst normalizePluginExport = (mod: Record<string, unknown>): Plugin.Plugin => {\n const exported = mod.default;\n if (Plugin.isPlugin(exported)) {\n return exported;\n }\n if (typeof exported === 'function') {\n const result = (exported as () => unknown)();\n if (Plugin.isPlugin(result)) {\n return result;\n }\n }\n throw new Error('Remote module default export is not a Plugin or a zero-arg plugin factory.');\n};\n\n/**\n * Loads stylesheets declared in the manifest by appending `<link rel=\"stylesheet\">` elements to the host document.\n * Each link is tagged with `data-dxos-plugin-id` so `uninstall` can clean them up.\n */\nconst loadStylesheets = (\n manifest: PluginManifest.ResolvedManifest,\n cache: PluginAssetCache.Cache,\n): Effect.Effect<void, PluginAssetCache.PluginAssetCacheError> =>\n Effect.gen(function* () {\n if (typeof document === 'undefined') {\n return;\n }\n const cssUrls = manifest.assetUrls.filter((url) => url.endsWith('.css'));\n for (const url of cssUrls) {\n const resolved = yield* cache.resolve(manifest.key, url);\n if (document.querySelector(`link[data-dxos-plugin-id=\"${manifest.key}\"][href=\"${resolved}\"]`)) {\n continue;\n }\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = resolved;\n link.dataset.dxosPluginId = manifest.key;\n document.head.appendChild(link);\n }\n });\n\nconst loadFromManifest = (\n manifestUrl: string,\n cache: PluginAssetCache.Cache,\n): Effect.Effect<{ plugin: Plugin.Plugin; manifest: PluginManifest.ResolvedManifest }, RemotePluginLoadError> =>\n Effect.gen(function* () {\n log.info('loading remote plugin', { manifestUrl });\n const manifest = yield* PluginManifest.fetchManifest(manifestUrl).pipe(\n Effect.mapError(\n (cause) => new RemotePluginLoadError({ context: { locator: manifestUrl, reason: 'manifest-error' }, cause }),\n ),\n );\n const wrapCacheError = Effect.mapError(\n (cause: PluginAssetCache.PluginAssetCacheError) =>\n new RemotePluginLoadError({ context: { locator: manifestUrl, reason: 'cache-error' }, cause }),\n );\n // Dev-mode manifests (served by `vite dev` via composerPlugin) skip the offline\n // cache: chunks resolve on demand through the dev server, the asset list isn't\n // enumerable up-front, and CSS arrives via runtime <style> injection rather than\n // static <link> tags.\n if (!manifest.dev) {\n // Cache the manifest URL alongside its declared assets. Without it, `preload` on a\n // subsequent reload would fetch the manifest from the network — and fail when the\n // plugin's host is offline, dropping the plugin from the runtime.\n const cachedUrls =\n manifest.assetUrls.indexOf(manifestUrl) === -1 ? [manifestUrl, ...manifest.assetUrls] : manifest.assetUrls;\n yield* cache.cache(manifest.key, cachedUrls).pipe(wrapCacheError);\n }\n const entryUrl = manifest.dev\n ? manifest.entryUrl\n : yield* cache.resolve(manifest.key, manifest.entryUrl).pipe(wrapCacheError);\n const mod = yield* Effect.tryPromise({\n try: () => import(/* @vite-ignore */ entryUrl),\n catch: (cause) =>\n new RemotePluginLoadError({ context: { locator: manifestUrl, reason: 'import-failed' }, cause }),\n });\n const plugin = normalizePluginExport(mod);\n if (!plugin.meta.profile.key || !plugin.meta.profile.name) {\n return yield* Effect.fail(\n new RemotePluginLoadError({ context: { locator: manifestUrl, reason: 'meta-missing' } }),\n );\n }\n if (plugin.meta.profile.key !== manifest.key) {\n return yield* Effect.fail(\n new RemotePluginLoadError({\n context: {\n locator: manifestUrl,\n reason: 'meta-mismatch',\n metaId: plugin.meta.profile.key,\n manifestId: manifest.key,\n },\n }),\n );\n }\n // Append stylesheets only after the entry imports cleanly and meta validation\n // passes. If we did this earlier and the import or meta checks failed, the\n // `<link>` tags would leak into the host DOM with no plugin to own their\n // teardown — `uninstall` only runs for plugins the manager actually accepted.\n // In dev mode, Vite injects styles at runtime via the module graph, so static\n // <link> tags would duplicate (or 404, since CSS chunks aren't pre-built).\n if (!manifest.dev) {\n yield* loadStylesheets(manifest, cache).pipe(wrapCacheError);\n }\n return { plugin, manifest };\n });\n\n/**\n * Preloads previously persisted remote plugins from storage. Per-entry failures\n * are logged and swallowed — the returned effect always succeeds with whichever\n * plugins loaded cleanly, so a single bad entry can't block the host's startup.\n */\nexport const preload = (options: PreloadOptions = {}): Effect.Effect<Plugin.Plugin[], never> =>\n Effect.gen(function* () {\n const storage = options.storage ?? defaultStorage();\n const key = options.key ?? DEFAULT_KEY;\n const cache = options.cache ?? PluginAssetCache.noop();\n const onPluginLoaded = options.onPluginLoaded;\n\n const entries = getPersistedRemotePlugins(storage, key);\n if (entries.length === 0) {\n return [];\n }\n log.info('preloading remote plugins', { count: entries.length });\n const total = entries.length;\n let loaded = 0;\n const results = yield* Effect.all(\n entries.map((entry) =>\n loadFromManifest(entry.url, cache).pipe(\n Effect.tapError((error) => Effect.sync(() => log.warn('failed to preload remote plugin', { entry, error }))),\n Effect.option,\n // Tick the progress hook on both success and recoverable failure so\n // the counter monotonically reaches `total`. The host-supplied\n // callback is best-effort: any synchronous throw flows through\n // `Effect.try` and gets logged + ignored so a buggy hook can't\n // derail the preload.\n Effect.tap(() =>\n Effect.sync(() => {\n loaded += 1;\n }).pipe(\n Effect.andThen(Effect.try(() => onPluginLoaded?.(loaded, total))),\n Effect.tapError((error) => Effect.sync(() => log.warn('onPluginLoaded threw', { loaded, total, error }))),\n Effect.ignore,\n ),\n ),\n ),\n ),\n { concurrency: 'unbounded' },\n );\n return results.flatMap((result) =>\n Option.match(result, {\n onNone: () => [],\n onSome: ({ plugin }) => [plugin],\n }),\n );\n });\n\n/**\n * Creates a plugin loader that resolves built-in plugins by ID or loads remote plugins from URLs.\n *\n * Remote URLs must point at a plugin manifest (`plugin.json`). The loader fetches the manifest,\n * eagerly persists every declared asset via the configured `PluginAssetCache`, then dynamic-imports\n * the entry module.\n */\nexport const make = (builtinPlugins: Plugin.Plugin[], options: Options = {}) => {\n const storage = options.storage ?? defaultStorage();\n const key = options.key ?? DEFAULT_KEY;\n const cache = options.cache ?? PluginAssetCache.noop();\n\n return (locator: string): Effect.Effect<{ plugin: Plugin.Plugin; dev?: boolean }, RemotePluginLoadError> =>\n Effect.gen(function* () {\n const builtin = builtinPlugins.find((plugin) => plugin.meta.profile.key === locator);\n if (builtin) {\n return { plugin: builtin };\n }\n if (!isUrl(locator)) {\n return yield* Effect.fail(new RemotePluginLoadError({ context: { locator, reason: 'invalid-locator' } }));\n }\n const { plugin, manifest } = yield* loadFromManifest(locator, cache);\n // Production manifests can't collide with a builtin id — that would make\n // the registered plugin permanently inaccessible. Dev manifests are\n // allowed to collide because the manager shadow primitive handles the\n // overlap (dev plugin takes the id slot for the session, original is\n // restored on uninstall or page reload).\n if (!manifest.dev) {\n const duplicate = builtinPlugins.find((existing) => existing.meta.profile.key === plugin.meta.profile.key);\n if (duplicate) {\n return yield* Effect.fail(\n new RemotePluginLoadError({ context: { locator, reason: 'duplicate-id', id: plugin.meta.profile.key } }),\n );\n }\n persistRemotePlugin(storage, key, { id: plugin.meta.profile.key, url: locator });\n }\n return { plugin, dev: manifest.dev };\n });\n};\n\n/**\n * Removes a previously installed remote plugin: drops the persisted entry, evicts cached\n * assets, and removes any stylesheet `<link>` tags that {@link loadFromManifest} appended.\n *\n * Cache eviction failures are logged and swallowed — the persisted entry has already been\n * dropped so the user-visible state is consistent regardless of whether the platform\n * cache cooperated.\n */\nexport const uninstall = (pluginId: string, options: Options = {}): Effect.Effect<void, never> =>\n Effect.gen(function* () {\n const storage = options.storage ?? defaultStorage();\n const key = options.key ?? DEFAULT_KEY;\n const cache = options.cache ?? PluginAssetCache.noop();\n\n removePersistedRemotePlugin(storage, key, pluginId);\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`link[data-dxos-plugin-id=\"${pluginId}\"]`).forEach((node) => node.remove());\n }\n yield* cache.evict(pluginId).pipe(\n Effect.tapError((error) => Effect.sync(() => log.warn('failed to evict plugin assets', { pluginId, error }))),\n Effect.ignore,\n );\n });\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { BaseError } from '@dxos/errors';\n\n/**\n * Tagged error for cache operations. Construction sites supply `context.operation`\n * (one of `'cache' | 'evict' | 'resolve' | 'list'`) and `context.pluginId` so\n * downstream handlers can route on the failed call without scanning the message.\n */\nexport class PluginAssetCacheError extends BaseError.extend(\n 'PluginAssetCacheError',\n 'Plugin asset cache operation failed',\n) {}\n\n/**\n * Per-platform offline cache for third-party plugin assets.\n *\n * Implementations live alongside their platform glue (composer-app's\n * `asset-cache/{tauri,service-worker}.ts`); the no-op default is for tests\n * and unsupported environments.\n */\nexport interface Cache {\n /**\n * Persist all listed URLs under the namespace of `pluginId`. Idempotent.\n * The order of `urls` is significant — the first entry is treated as the entry module.\n */\n cache(pluginId: string, urls: readonly string[]): Effect.Effect<void, PluginAssetCacheError>;\n\n /**\n * Drop all assets for a plugin (uninstall).\n */\n evict(pluginId: string): Effect.Effect<void, PluginAssetCacheError>;\n\n /**\n * Resolves a plugin asset URL to a platform-specific cached URL when one is available.\n * Returns the original URL when no cached copy exists or the platform serves cached\n * responses transparently (e.g. service worker fetch interception on web).\n */\n resolve(pluginId: string, url: string): Effect.Effect<string, PluginAssetCacheError>;\n\n /**\n * List currently cached plugin ids (diagnostic).\n */\n list(): Effect.Effect<readonly string[], PluginAssetCacheError>;\n}\n\n/**\n * No-op implementation. Used when no platform cache is registered (tests, unsupported environments).\n * Plugins still load — they just have no offline guarantee.\n */\nexport const noop = (): Cache => ({\n cache: () => Effect.void,\n evict: () => Effect.void,\n resolve: (_pluginId, url) => Effect.succeed(url),\n list: () => Effect.succeed([] as readonly string[]),\n});\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport * as FetchHttpClient from '@effect/platform/FetchHttpClient';\nimport * as HttpClient from '@effect/platform/HttpClient';\nimport * as HttpClientRequest from '@effect/platform/HttpClientRequest';\nimport * as HttpClientResponse from '@effect/platform/HttpClientResponse';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { BaseError } from '@dxos/errors';\nimport { PLUGIN_ENTRY_FILENAME, PluginManifestSchema } from '@dxos/protocols';\n\n/**\n * Default port the Vite plugin (`composerPlugin`) binds the dev server to.\n *\n * Shared single source of truth — `composerPlugin` reads it as the default\n * port, and the host's \"Load Dev Plugin\" affordance pre-fills the manifest URL\n * with `http://localhost:${PLUGIN_DEV_SERVER_PORT}/manifest.json`. Lives in\n * app-framework rather than `@dxos/protocols` because the constant is a\n * client-side convention (host loader + Vite plugin) rather than a wire-level\n * protocol.\n */\nexport const PLUGIN_DEV_SERVER_PORT = 3967;\n\n/**\n * Tagged error for manifest fetch / parse failures. Construction sites set\n * `context.manifestUrl` and `context.reason` (one of `'fetch-failed' |\n * 'http-error' | 'parse-failed' | 'invalid'`) so handlers can route on the\n * specific failure mode.\n */\nexport class PluginManifestError extends BaseError.extend('PluginManifestError', 'Plugin manifest is invalid') {}\n\n/**\n * Schema for a third-party plugin manifest.\n *\n * Production manifests are published as a sibling of the plugin's entry module\n * ({@link PLUGIN_ENTRY_FILENAME}) and advertise every file the plugin needs at\n * runtime so the host can eagerly cache them for offline use.\n *\n * Dev manifests (served by `vite dev` via {@link composerPlugin}) set `devEntry`\n * to point at the unbundled source entry. The host's loader treats the presence\n * of `devEntry` as the dev-mode signal: it imports the entry directly from the\n * dev server, skips eager asset caching, and skips static stylesheet injection\n * (Vite handles CSS via runtime `<style>` injection during HMR). `assets` is not\n * required to enumerate every file in dev mode — chunks and styles flow through\n * the dev server on demand.\n */\nexport const Manifest = Schema.Struct({\n // Reuse the build manifest field definitions from `@dxos/protocols` (the shape `composerPlugin`\n // emits), minus `assets` which we relax below, plus the dev-only `devEntry`.\n ...PluginManifestSchema.omit('assets').fields,\n /**\n * Relative asset paths. Relaxed vs the build `PluginManifestSchema` (which requires >= 1) because\n * dev-server manifests list no assets — chunks/styles flow through the dev server on demand.\n */\n assets: Schema.Array(Schema.String),\n /** Present only for dev-server manifests; points at the unbundled source entry. */\n devEntry: Schema.optional(Schema.String),\n});\n\nexport type Manifest = Schema.Schema.Type<typeof Manifest>;\n\n/**\n * Resolved manifest with all asset paths converted to absolute URLs.\n *\n * `dev` reflects whether the source manifest declared a `devEntry`. Loaders branch\n * on this to skip offline caching and stylesheet injection — both are no-ops (or\n * actively wrong) when the plugin is being served by a Vite dev server.\n */\nexport type ResolvedManifest = Pick<Manifest, 'key' | 'name' | 'version' | 'dependencies'> & {\n entryUrl: string;\n assetUrls: readonly string[];\n dev: boolean;\n};\n\n/**\n * Resolves a parsed manifest's relative asset paths against the manifest's URL.\n * In dev mode the entry comes from `devEntry`; otherwise it's the canonical\n * {@link PLUGIN_ENTRY_FILENAME} sitting next to the manifest.\n */\nconst resolve = (manifestUrl: string, manifest: Manifest): ResolvedManifest => {\n const dev = manifest.devEntry !== undefined;\n return {\n key: manifest.key,\n name: manifest.name,\n version: manifest.version,\n entryUrl: new URL(dev ? manifest.devEntry! : PLUGIN_ENTRY_FILENAME, manifestUrl).toString(),\n assetUrls: manifest.assets.map((asset) => new URL(asset, manifestUrl).toString()),\n dev,\n ...(manifest.dependencies !== undefined ? { dependencies: manifest.dependencies } : {}),\n };\n};\n\n/**\n * Synchronous decode + validate + resolve for an in-memory manifest payload. Used\n * by tests and tooling that have the manifest body already loaded; the runtime\n * path goes through {@link fetchManifest}.\n */\nexport const parse = (manifestUrl: string, payload: unknown): ResolvedManifest => {\n const manifest = Schema.decodeUnknownSync(Manifest)(payload);\n if (manifest.devEntry === undefined && !manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {\n throw new Error(`Manifest at ${manifestUrl} does not list ${PLUGIN_ENTRY_FILENAME} in assets.`);\n }\n return resolve(manifestUrl, manifest);\n};\n\n/**\n * Fetches and parses a manifest from the given URL via Effect's HTTP client and\n * Schema-driven JSON decoding. All failure modes surface as a single tagged\n * {@link PluginManifestError}; callers route on `error.context.reason`.\n */\nexport const fetchManifest = (manifestUrl: string): Effect.Effect<ResolvedManifest, PluginManifestError> =>\n Effect.gen(function* () {\n const response = yield* HttpClientRequest.get(manifestUrl).pipe(\n HttpClient.execute,\n Effect.mapError((cause) => new PluginManifestError({ context: { manifestUrl, reason: 'fetch-failed' }, cause })),\n );\n if (response.status >= 400) {\n return yield* Effect.fail(\n new PluginManifestError({ context: { manifestUrl, reason: 'http-error', status: response.status } }),\n );\n }\n const manifest = yield* HttpClientResponse.schemaBodyJson(Manifest)(response).pipe(\n Effect.mapError((cause) => new PluginManifestError({ context: { manifestUrl, reason: 'parse-failed' }, cause })),\n );\n if (manifest.devEntry === undefined && !manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {\n return yield* Effect.fail(\n new PluginManifestError({\n context: { manifestUrl, reason: 'invalid' },\n cause: `assets does not include ${PLUGIN_ENTRY_FILENAME}`,\n }),\n );\n }\n return resolve(manifestUrl, manifest);\n }).pipe(Effect.scoped, Effect.provide(FetchHttpClient.layer));\n"],
5
+ "mappings": ";;;;;;;;AAAA;;;;;;;;;;;AAIA,YAAYA,aAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,aAAAA,kBAAiB;AAC1B,SAASC,WAAW;;;ACRpB;;;;;AAIA,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAOnB,IAAMC,wBAAN,cAAoCD,UAAUE,OACnD,yBACA,qCAAA,EAAA;AACC;AAsCI,IAAMC,OAAO,OAAc;EAChCC,OAAO,MAAaC;EACpBC,OAAO,MAAaD;EACpBE,SAAS,CAACC,WAAWC,QAAeC,eAAQD,GAAAA;EAC5CE,MAAM,MAAaD,eAAQ,CAAA,CAAE;AAC/B;;;AC3DA;;;;;;;;AAIA,YAAYE,qBAAqB;AACjC,YAAYC,gBAAgB;AAC5B,YAAYC,uBAAuB;AACnC,YAAYC,wBAAwB;AACpC,YAAYC,aAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,aAAAA,kBAAiB;AAC1B,SAASC,uBAAuBC,4BAA4B;AAYrD,IAAMC,yBAAyB;AAQ/B,IAAMC,sBAAN,cAAkCJ,WAAUK,OAAO,uBAAuB,4BAAA,EAAA;AAA+B;AAiBzG,IAAMC,WAAkBC,cAAO;;;EAGpC,GAAGL,qBAAqBM,KAAK,QAAA,EAAUC;;;;;EAKvCC,QAAeC,aAAaC,aAAM;;EAElCC,UAAiBC,gBAAgBF,aAAM;AACzC,CAAA;AAsBA,IAAMG,UAAU,CAACC,aAAqBC,aAAAA;AACpC,QAAMC,MAAMD,SAASJ,aAAaM;AAClC,SAAO;IACLC,KAAKH,SAASG;IACdC,MA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DV,OAAS,GAAA;oBAAEvB,aAAAA,IAAAA,sBAAAA;iBAASwB;UAA0B;UAAE,QAAA;QACxG;MACA,CAAA,CAAM;IACN;AACA,UAAA,EAAA,QAAA,SAAA,IAAA,OAAA,iBAAA,SAAA,KAAA;QAME,CAAA,SAAI0B,KAAW;YACb,YAAcN,eACZ,KAAIZ,CAAAA,aAAAA,SAAsB,KAAA,QAAA,QAAA,OAAA,KAAA,QAAA,GAAA;qBAAET;sBAAWvB,aAAAA,IAAAA,sBAAAA;mBAASwB;YAAwBnB;YAA4B,QAAA;YAAE,IAAA,OAAA,KAAA,QAAA;UAE1G;QACA8C,CAAAA,CAAAA;;0BAAsEnD,SAAAA,KAAAA;QAAQ,IAAA,OAAA,KAAA,QAAA;QAChF,KAAA;MACA,CAAA;;WAAiBoD;MAAkB;MACrC,KAAA,SAAA;IACF;EAEF,CAAA;;AAWI,IAAM/D,YAAcA,CAAAA,UAAOP,UAAAA,CAAAA,MAAAA,YAAAA,aAAAA;AAC3B,QAAM8C,UAAQ3B,QAAQ2B,WAASQ,eAAiBC;AAEhDgB,QAAAA,MAAAA,QAAAA,OAAAA;AACA,QAAI,QAAOtC,QAAAA,SAA0B,KAAA;8BAC1BuC,SAAkB,KAAA,QAAA;AAC7B,MAAA,OAAA,aAAA,aAAA;AACA,aAAaC,iBAAgBb,6BACAE,QAAOY,IAAK,EAAA,QAAUC,CAAAA,SAAK,KAAA,OAAA,CAAA;;eAA6ChE,MAAAA,QAAAA,EAAAA,KAAAA,iBAAAA,CAAAA,UAAAA,aAAAA,MAAAA,IAAAA,KAAAA,iCAAAA;IAAM;IAG1G;;;",
6
+ "names": ["Effect", "Option", "BaseError", "log", "Effect", "BaseError", "PluginAssetCacheError", "extend", "noop", "cache", "void", "evict", "resolve", "_pluginId", "url", "succeed", "list", "FetchHttpClient", "HttpClient", "HttpClientRequest", "HttpClientResponse", "Effect", "Schema", "BaseError", "PLUGIN_ENTRY_FILENAME", "PluginManifestSchema", "PLUGIN_DEV_SERVER_PORT", "PluginManifestError", "extend", "Manifest", "Struct", "omit", "fields", "assets", "Array", "String", "devEntry", "optional", "resolve", "manifestUrl", "manifest", "dev", "undefined", "key", "name", "version", "entryUrl", "URL", "toString", "assetUrls", "map", "asset", "dependencies", "parse", "payload", "decodeUnknownSync", "includes", "Error", "fetchManifest", "gen", "response", "get", "pipe", "execute", "mapError", "cause", "context", "reason", "status", "fail", "schemaBodyJson", "scoped", "provide", "layer", "DEFAULT_KEY", "defaultStorage", "BaseError", "value", "localStorage", "getPersistedRemotePlugins", "storage", "key", "get", "parsed", "entries", "error", "log", "entry", "pluginId", "url", "URL", "hostname", "locator", "options", "index", "findIndex", "version", "id", "find", "normalizePluginExport", "mod", "exported", "Plugin", "result", "resolved", "resolve", "manifest", "document", "querySelector", "link", "href", "dataset", "head", "loadFromManifest", "manifestUrl", "context", "reason", "cause", "wrapCacheError", "assetUrls", "cache", "entryUrl", "try", "catch", "RemotePluginLoadError", "plugin", "metaId", "manifestId", "PluginAssetCache", "noop", "onPluginLoaded", "info", "total", "results", "pipe", "andThen", "Effect", "loaded", "flatMap", "onSome", "gen", "builtin", "duplicate", "persistRemotePlugin", "dev", "removePersistedRemotePlugin", "querySelectorAll", "evict", "sync", "warn"]
7
+ }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  capability_exports
3
- } from "./chunk-IW44C7UL.mjs";
3
+ } from "./chunk-OPTS3ZSN.mjs";
4
4
  import {
5
5
  __export
6
6
  } from "./chunk-J5LGTIGS.mjs";
@@ -33,24 +33,24 @@ __export(capabilities_exports, {
33
33
  });
34
34
  import * as Effect from "effect/Effect";
35
35
  var Null = capability_exports.make("org.dxos.app-framework.capability.null");
36
- var PluginManager = capability_exports.make("org.dxos.app-framework.capability.plugin-manager");
37
- var AtomRegistry = capability_exports.make("org.dxos.app-framework.capability.atom-registry");
38
- var ReactContext = capability_exports.make("org.dxos.app-framework.capability.react-context");
39
- var ReactRoot = capability_exports.make("org.dxos.app-framework.capability.react-root");
40
- var ReactSurface = capability_exports.make("org.dxos.app-framework.common.react-surface");
36
+ var PluginManager = capability_exports.make("org.dxos.app-framework.capability.pluginManager");
37
+ var AtomRegistry = capability_exports.make("org.dxos.app-framework.capability.atomRegistry");
38
+ var ReactContext = capability_exports.make("org.dxos.app-framework.capability.reactContext");
39
+ var ReactRoot = capability_exports.make("org.dxos.app-framework.capability.reactRoot");
40
+ var ReactSurface = capability_exports.make("org.dxos.app-framework.capability.reactSurface");
41
41
  var Command = capability_exports.make("org.dxos.app-framework.capability.command");
42
42
  var Layer = capability_exports.make("org.dxos.app-framework.capability.layer");
43
- var LayerSpec = capability_exports.make("org.dxos.app-framework.capability.layer-spec");
44
- var TraceSink = capability_exports.make("org.dxos.app-framework.capability.trace-sink");
45
- var ServiceResolver = capability_exports.make("org.dxos.app-framework.capability.service-resolver");
46
- var ProcessMonitor = capability_exports.make("org.dxos.app-framework.capability.process-monitor");
47
- var ProcessManagerRuntime = capability_exports.make("org.dxos.app-framework.capability.process-manager-runtime");
48
- var ManagedRuntime = capability_exports.make("org.dxos.app-framework.capability.managed-runtime");
49
- var OperationHandler = capability_exports.make("org.dxos.app-framework.capability.operation-handler");
50
- var UndoMapping = capability_exports.make("org.dxos.app-framework.capability.undo-mapping");
51
- var OperationInvoker = capability_exports.make("org.dxos.app-framework.capability.operation-invoker");
52
- var UndoRegistry = capability_exports.make("org.dxos.app-framework.capability.undo-registry");
53
- var HistoryTracker = capability_exports.make("org.dxos.app-framework.capability.history-tracker");
43
+ var LayerSpec = capability_exports.make("org.dxos.app-framework.capability.layerSpec");
44
+ var TraceSink = capability_exports.make("org.dxos.app-framework.capability.traceSink");
45
+ var ServiceResolver = capability_exports.make("org.dxos.app-framework.capability.serviceResolver");
46
+ var ProcessMonitor = capability_exports.make("org.dxos.app-framework.capability.processMonitor");
47
+ var ProcessManagerRuntime = capability_exports.make("org.dxos.app-framework.capability.processManagerRuntime");
48
+ var ManagedRuntime = capability_exports.make("org.dxos.app-framework.capability.managedRuntime");
49
+ var OperationHandler = capability_exports.make("org.dxos.app-framework.capability.operationHandler");
50
+ var UndoMapping = capability_exports.make("org.dxos.app-framework.capability.undoMapping");
51
+ var OperationInvoker = capability_exports.make("org.dxos.app-framework.capability.operationInvoker");
52
+ var UndoRegistry = capability_exports.make("org.dxos.app-framework.capability.undoRegistry");
53
+ var HistoryTracker = capability_exports.make("org.dxos.app-framework.capability.historyTracker");
54
54
  var getAtomValue = (atomCapability) => Effect.gen(function* () {
55
55
  const registry = yield* capability_exports.get(AtomRegistry);
56
56
  const atom = yield* capability_exports.get(atomCapability);
@@ -92,4 +92,4 @@ export {
92
92
  subscribeAtom,
93
93
  capabilities_exports
94
94
  };
95
- //# sourceMappingURL=chunk-CO3XLNUX.mjs.map
95
+ //# sourceMappingURL=chunk-NKVRSMFN.mjs.map